Skip to content

Commit 4ce6415

Browse files
authored
0.11.3. (#29)
1 parent eb4bb32 commit 4ce6415

18 files changed

+140
-40
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.11.3
2+
3+
This version improves the behavior of the `Dynamic` value editor, when the sub editor contains a control visible in the property header.
4+
15
## 0.11.2
26

37
This version adds a generic type to the `ChoiceValueModel` interface.

demos/webpack-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"sequential-workflow-model": "^0.2.0",
1919
"sequential-workflow-designer": "^0.17.0",
2020
"sequential-workflow-machine": "^0.4.0",
21-
"sequential-workflow-editor-model": "^0.11.2",
22-
"sequential-workflow-editor": "^0.11.2"
21+
"sequential-workflow-editor-model": "^0.11.3",
22+
"sequential-workflow-editor": "^0.11.3"
2323
},
2424
"devDependencies": {
2525
"ts-loader": "^9.4.2",

demos/webpack-app/src/editors/app.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.string-magic-editor input {
2+
background: #e9e8ff;
3+
border-color: #c0bef0;
4+
}
5+
.string-magic-editor input:focus {
6+
border-color: #9794d9;
7+
}

demos/webpack-app/src/editors/app.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
import { Designer, Uid } from 'sequential-workflow-designer';
2-
import { EditorProvider } from 'sequential-workflow-editor';
2+
import { EditorProvider, StringValueEditorEditorExtension } from 'sequential-workflow-editor';
33
import { definitionModel } from './model/definition-model';
44

55
import 'sequential-workflow-designer/css/designer.css';
66
import 'sequential-workflow-designer/css/designer-light.css';
77
import 'sequential-workflow-editor/css/editor.css';
8+
import './app.css';
89

910
export class App {
1011
public static create(): App {
1112
const placeholder = document.getElementById('designer') as HTMLElement;
1213

1314
const editorProvider = EditorProvider.create(definitionModel, {
14-
uidGenerator: Uid.next
15+
uidGenerator: Uid.next,
16+
extensions: [
17+
StringValueEditorEditorExtension.create({
18+
editorId: 'string-magic',
19+
class: 'string-magic-editor'
20+
})
21+
]
1522
});
1623

1724
const designer = Designer.create(placeholder, editorProvider.activateDefinition(), {

demos/webpack-app/src/editors/model/dynamic-step-model.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import {
33
createBooleanValueModel,
44
createStepModel,
55
createDynamicValueModel,
6-
createStringValueModel
6+
createStringValueModel,
7+
StringDictionary,
8+
createStringDictionaryValueModel
79
} from 'sequential-workflow-editor-model';
810
import { Step } from 'sequential-workflow-model';
911

@@ -12,6 +14,7 @@ export interface DynamicStepModel extends Step {
1214
componentType: 'task';
1315
properties: {
1416
example: Dynamic<string | boolean>;
17+
twoHeaderControls: Dynamic<StringDictionary | string>;
1518
};
1619
}
1720

@@ -21,4 +24,10 @@ export const dynamicStepModel = createStepModel<DynamicStepModel>('dynamic', 'ta
2124
models: [createStringValueModel({}), createBooleanValueModel({})]
2225
})
2326
);
27+
28+
step.property('twoHeaderControls').value(
29+
createDynamicValueModel({
30+
models: [createStringDictionaryValueModel({}), createStringValueModel({})]
31+
})
32+
);
2433
});

demos/webpack-app/src/editors/model/string-step-model.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ export const stringStepModel = createStepModel<StringStepModel>('string', 'task'
2020
defaultValue: 'Some default value'
2121
})
2222
);
23-
step.property('minLength3').value(
24-
createStringValueModel({
25-
minLength: 3
26-
})
27-
);
23+
step.property('minLength3')
24+
.value(
25+
createStringValueModel({
26+
minLength: 3,
27+
editorId: 'string-magic'
28+
})
29+
)
30+
.hint('This editor has a different color than the others, because it uses the string editor with custom CSS class.');
2831
step.property('patternYear').value(
2932
createStringValueModel({
3033
pattern: /^\d{4}$/

editor/css/editor.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
border-style: dashed;
117117
}
118118
.swe-select-small {
119-
padding: 3px 5px;
119+
padding: 4px 5px;
120120
}
121121
.swe-prepended-input {
122122
width: 100%;
@@ -198,3 +198,9 @@
198198
margin-bottom: 10px;
199199
color: #777;
200200
}
201+
202+
/* dynamic */
203+
204+
.swe-dynamic-sub-control {
205+
margin-left: 6px;
206+
}

editor/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sequential-workflow-editor",
3-
"version": "0.11.2",
3+
"version": "0.11.3",
44
"type": "module",
55
"main": "./lib/esm/index.js",
66
"types": "./lib/index.d.ts",
@@ -46,11 +46,11 @@
4646
"prettier:fix": "prettier --write ./src ./css"
4747
},
4848
"dependencies": {
49-
"sequential-workflow-editor-model": "^0.11.2",
49+
"sequential-workflow-editor-model": "^0.11.3",
5050
"sequential-workflow-model": "^0.2.0"
5151
},
5252
"peerDependencies": {
53-
"sequential-workflow-editor-model": "^0.11.2",
53+
"sequential-workflow-editor-model": "^0.11.3",
5454
"sequential-workflow-model": "^0.2.0"
5555
},
5656
"devDependencies": {

editor/src/components/row-component.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,12 @@ describe('RowComponent', () => {
2525
expect(row.view.children[1].className).toBe('swe-col swe-col-2');
2626
expect(row.view.children[2].className).toBe('swe-col');
2727
});
28+
29+
it('adds custom class', () => {
30+
const row = rowComponent([], {
31+
class: 'custom-class'
32+
});
33+
34+
expect(row.view.className).toBe('swe-row custom-class');
35+
});
2836
});

editor/src/components/row-component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ import { Component } from './component';
33

44
export interface RowComponentConfiguration {
55
cols?: (number | null)[];
6+
class?: string;
67
}
78

89
export function rowComponent(elements: HTMLElement[], configuration?: RowComponentConfiguration): Component {
10+
let viewClass = 'swe-row';
11+
if (configuration && configuration.class) {
12+
viewClass += ' ' + configuration.class;
13+
}
14+
915
const view = Html.element('div', {
10-
class: 'swe-row'
16+
class: viewClass
1117
});
1218
elements.forEach((element, index) => {
1319
const grow = configuration && configuration.cols ? configuration.cols[index] : 1;

0 commit comments

Comments
 (0)