Skip to content

Commit 0124d4e

Browse files
authored
0.10.0. (#23)
1 parent 2f11515 commit 0124d4e

File tree

9 files changed

+58
-97
lines changed

9 files changed

+58
-97
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.10.0
2+
3+
This version deletes all deprecated `*ValueModel` functions. From now, use only `create*ValueModel` functions.
4+
15
## 0.9.3
26

37
Added `hasVariable` and `hasVariables` methods to the `PropertyValidatorContext` class.

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.16.1",
2020
"sequential-workflow-machine": "^0.4.0",
21-
"sequential-workflow-editor-model": "^0.9.3",
22-
"sequential-workflow-editor": "^0.9.3"
21+
"sequential-workflow-editor-model": "^0.10.0",
22+
"sequential-workflow-editor": "^0.10.0"
2323
},
2424
"devDependencies": {
2525
"ts-loader": "^9.4.2",

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.9.3",
3+
"version": "0.10.0",
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.9.3",
49+
"sequential-workflow-editor-model": "^0.10.0",
5050
"sequential-workflow-model": "^0.2.0"
5151
},
5252
"peerDependencies": {
53-
"sequential-workflow-editor-model": "^0.9.3",
53+
"sequential-workflow-editor-model": "^0.10.0",
5454
"sequential-workflow-model": "^0.2.0"
5555
},
5656
"devDependencies": {

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,15 @@ describe('ButtonComponent', () => {
1212
expect(button.view.innerText).toBe('Some button');
1313
expect(clicked).toBe(true);
1414
});
15+
16+
it('replaces icon', () => {
17+
const button = buttonComponent('Icon button', { icon: 'm200' });
18+
const getD = () => button.view.children[0].children[0].getAttribute('d');
19+
20+
expect(getD()).toBe('m200');
21+
22+
button.setIcon('m100');
23+
24+
expect(getD()).toBe('m100');
25+
});
1526
});

editor/src/components/button-component.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Icons } from '../core/icons';
55

66
export interface ButtonComponent extends Component {
77
onClick: SimpleEvent<void>;
8+
setIcon(d: string): void;
9+
setLabel(label: string): void;
810
}
911

1012
export interface ButtonComponentConfiguration {
@@ -19,6 +21,22 @@ export function buttonComponent(label: string, configuration?: ButtonComponentCo
1921
onClick.forward();
2022
}
2123

24+
function setIcon(d: string) {
25+
if (icon) {
26+
icon.getElementsByTagName('path')[0].setAttribute('d', d);
27+
} else {
28+
throw new Error('This button does not have icon');
29+
}
30+
}
31+
32+
function setLabel(label: string) {
33+
if (configuration?.icon) {
34+
throw new Error('Cannot change label on button with icon');
35+
} else {
36+
view.innerText = label;
37+
}
38+
}
39+
2240
const onClick = new SimpleEvent<void>();
2341

2442
let className = 'swe-button';
@@ -33,16 +51,19 @@ export function buttonComponent(label: string, configuration?: ButtonComponentCo
3351
title: label,
3452
'aria-label': label
3553
});
54+
let icon: SVGElement | undefined;
3655
if (configuration?.icon) {
37-
const svg = Icons.createSvg(configuration.icon, 'swe-button-icon');
38-
view.appendChild(svg);
56+
icon = Icons.createSvg(configuration.icon, 'swe-button-icon');
57+
view.appendChild(icon);
3958
} else {
4059
view.innerText = label;
4160
}
4261
view.addEventListener('click', onClicked, false);
4362

4463
return {
4564
view,
46-
onClick
65+
onClick,
66+
setIcon,
67+
setLabel
4768
};
4869
}

editor/src/components/input-component.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ export interface InputComponent extends Component {
66
onChanged: SimpleEvent<string>;
77
setValue(value: string): void;
88
getValue(): string;
9+
setReadonly(readonly: boolean): void;
910
}
1011

1112
export interface InputConfiguration {
12-
type?: 'text' | 'number';
13+
type?: 'text' | 'number' | 'password';
1314
isReadonly?: boolean;
1415
placeholder?: string;
1516
}
@@ -25,6 +26,14 @@ export function inputComponent(startValue: string, configuration?: InputConfigur
2526
return view.value;
2627
}
2728

29+
function setReadonly(readonly: boolean) {
30+
if (readonly) {
31+
view.setAttribute('readonly', 'readonly');
32+
} else {
33+
view.removeAttribute('readonly');
34+
}
35+
}
36+
2837
const view = Html.element('input', {
2938
class: 'swe-input swe-stretched',
3039
type: configuration?.type ?? 'text'
@@ -33,7 +42,7 @@ export function inputComponent(startValue: string, configuration?: InputConfigur
3342
view.setAttribute('placeholder', configuration.placeholder);
3443
}
3544
if (configuration?.isReadonly) {
36-
view.setAttribute('readonly', 'readonly');
45+
setReadonly(true);
3746
}
3847
view.value = startValue;
3948
view.addEventListener('input', () => {
@@ -44,6 +53,7 @@ export function inputComponent(startValue: string, configuration?: InputConfigur
4453
view,
4554
onChanged,
4655
setValue,
47-
getValue
56+
getValue,
57+
setReadonly
4858
};
4959
}

model/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sequential-workflow-editor-model",
3-
"version": "0.9.3",
3+
"version": "0.10.0",
44
"homepage": "https://nocode-js.com/",
55
"author": {
66
"name": "NoCode JS",

model/src/value-models/depreciated.ts

Lines changed: 0 additions & 84 deletions
This file was deleted.

model/src/value-models/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ export * from './sequence';
1212
export * from './string';
1313
export * from './string-dictionary';
1414
export * from './variable-definitions';
15-
export * from './depreciated';

0 commit comments

Comments
 (0)