Skip to content

Commit 8c1ed07

Browse files
authored
0.14.0. (#42)
1 parent 5193dc9 commit 8c1ed07

21 files changed

+56
-23
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.14.0
2+
3+
From now, the nullable any variable editor and the nullable variable editor display the expected variable types to select. This version also allows changes to the labels in the dropdown menu of the dynamic value editor.
4+
15
## 0.13.2
26

37
This version adds missing translations for the `variableDefinitions` value editor.

demos/webpack-app/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"sequential-workflow-model": "^0.2.0",
1919
"sequential-workflow-designer": "^0.21.2",
2020
"sequential-workflow-machine": "^0.4.0",
21-
"sequential-workflow-editor-model": "^0.13.2",
22-
"sequential-workflow-editor": "^0.13.2"
21+
"sequential-workflow-editor-model": "^0.14.0",
22+
"sequential-workflow-editor": "^0.14.0"
2323
},
2424
"devDependencies": {
2525
"ts-loader": "^9.4.2",

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ export class App {
4747
});
4848

4949
if (location.hash) {
50-
const type = location.hash.substring(1);
51-
const step = designer.getDefinition().sequence.find(s => s.type === type);
50+
const type = location.hash.substring(1).toLowerCase();
51+
const step = designer.getDefinition().sequence.find(s => s.type.toLowerCase() === type);
5252
if (step) {
5353
designer.selectStepById(step.id);
5454
}

docs/I18N-KEYS.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ This document lists all the I18N keys used in the Sequential Workflow Editor.
2121
"generatedString.differentValue": "Generator returns different value than the current value",
2222
"nullableAnyVariable.invalidVariableType": "The variable :name has invalid type",
2323
"nullableAnyVariable.select": "- Select -",
24+
"nullableAnyVariable.selectTypes": "- Select: :types -",
2425
"nullableAnyVariable.variableIsLost": "The variable :name is lost",
2526
"nullableAnyVariable.variableIsRequired": "The variable is required",
26-
"nullableVariable.select": "- Select -",
27+
"nullableVariable.selectType": "- Select: :type -",
2728
"nullableVariable.variableIsLost": "The variable :name is not found",
2829
"nullableVariable.variableIsRequired": "The variable is required",
2930
"nullableVariableDefinition.expectedType": "Variable type must be :type",

editor/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sequential-workflow-editor",
3-
"version": "0.13.2",
3+
"version": "0.14.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.13.2",
49+
"sequential-workflow-editor-model": "^0.14.0",
5050
"sequential-workflow-model": "^0.2.0"
5151
},
5252
"peerDependencies": {
53-
"sequential-workflow-editor-model": "^0.13.2",
53+
"sequential-workflow-editor-model": "^0.14.0",
5454
"sequential-workflow-model": "^0.2.0"
5555
},
5656
"devDependencies": {

editor/src/value-editors/nullable-any-variable/nullable-any-variable-editor.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,15 @@ export function nullableAnyVariableValueEditor(
3535
const select = selectComponent({
3636
stretched: true
3737
});
38-
select.setValues([
39-
context.i18n('nullableAnyVariable.select', '- Select -'),
40-
...variables.map(variable => formatVariableNameWithType(variable.name, variable.type))
41-
]);
38+
39+
const expectedTypes = context.model.configuration.valueTypes ? context.model.configuration.valueTypes.join(', ') : null;
40+
const actionText = expectedTypes
41+
? context.i18n('nullableAnyVariable.selectTypes', '- Select: :types -', {
42+
types: expectedTypes
43+
})
44+
: context.i18n('nullableAnyVariable.select', '- Select -');
45+
46+
select.setValues([actionText, ...variables.map(variable => formatVariableNameWithType(variable.name, variable.type))]);
4247
if (startValue) {
4348
select.selectIndex(variables.findIndex(variable => variable.name === startValue.name) + 1);
4449
} else {

editor/src/value-editors/nullable-variable/nullable-variable-value-editor.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export function nullableVariableValueEditor(context: ValueContext<NullableVariab
3232
stretched: true
3333
});
3434
select.setValues([
35-
context.i18n('nullableVariable.select', '- Select -'),
35+
context.i18n('nullableVariable.selectType', '- Select: :type -', {
36+
type: context.model.configuration.valueType
37+
}),
3638
...variables.map(variable => formatVariableNameWithType(variable.name, variable.type))
3739
]);
3840
if (startValue) {

model/package.json

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

model/src/value-models/any-variables/any-variables-value-model.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { AnyVariables, ValueType } from '../../types';
44
import { ValueContext } from '../../context';
55

66
export interface AnyVariablesValueModelConfiguration {
7+
label?: string;
78
valueTypes?: ValueType[];
9+
editorId?: string;
810
}
911

1012
export type AnyVariablesValueModel = ValueModel<AnyVariables, AnyVariablesValueModelConfiguration>;
@@ -16,7 +18,8 @@ export const createAnyVariablesValueModel = (
1618
): ValueModelFactoryFromModel<AnyVariablesValueModel> => ({
1719
create: (path: Path) => ({
1820
id: anyVariablesValueModelId,
19-
label: 'Variables',
21+
label: configuration.label ?? 'Variables',
22+
editorId: configuration.editorId,
2023
path,
2124
configuration,
2225
getDefaultValue() {
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export interface BooleanValueModelConfiguration {
2+
label?: string;
23
defaultValue?: boolean;
34
editorId?: string;
45
}

model/src/value-models/boolean/boolean-value-model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const createBooleanValueModel = (configuration: BooleanValueModelConfigur
1111
create: (path: Path) => ({
1212
id: booleanValueModelId,
1313
editorId: configuration.editorId,
14-
label: 'Boolean',
14+
label: configuration.label ?? 'Boolean',
1515
path,
1616
configuration,
1717
getDefaultValue() {

model/src/value-models/choice/choice-value-model.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import { Path } from '../../core/path';
33
import { ValueContext } from '../../context';
44

55
export interface ChoiceValueModelConfiguration<TValue extends string = string> {
6+
label?: string;
67
choices: TValue[];
78
defaultValue?: TValue;
9+
editorId?: string;
810
}
911

1012
export type ChoiceValueModel<TValue extends string = string> = ValueModel<TValue, ChoiceValueModelConfiguration<TValue>>;
@@ -21,7 +23,8 @@ export function createChoiceValueModel<TValue extends string>(
2123
return {
2224
create: (path: Path) => ({
2325
id: choiceValueModelId,
24-
label: 'Choice',
26+
label: configuration.label ?? 'Choice',
27+
editorId: configuration.editorId,
2528
path,
2629
configuration,
2730
getDefaultValue() {

model/src/value-models/generated-string/generated-string-value-model.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import { GeneratedStringContext } from './generated-string-context';
66
import { DefaultValueContext } from '../../context/default-value-context';
77

88
export interface GeneratedStringValueModelConfiguration<TProperties extends Properties = Properties> {
9+
label?: string;
910
generator(context: GeneratedStringContext<TProperties>): string;
11+
editorId?: string;
1012
}
1113

1214
export type GeneratedStringVariableValueModel<TProperties extends Properties = Properties> = ValueModel<
@@ -22,7 +24,8 @@ export function createGeneratedStringValueModel<TProperties extends Properties =
2224
return {
2325
create: (path: Path) => ({
2426
id: generatedStringValueModelId,
25-
label: 'Generated string',
27+
label: configuration.label ?? 'Generated string',
28+
editorId: configuration.editorId,
2629
path,
2730
configuration,
2831
getDefaultValue(context: DefaultValueContext<TProperties>) {

model/src/value-models/nullable-any-variable/nullable-any-variable-value-model.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import { NullableAnyVariable, ValueType } from '../../types';
44
import { ValueContext } from '../../context';
55

66
export interface NullableAnyVariableValueModelConfiguration {
7+
label?: string;
78
isRequired?: boolean;
89
valueTypes?: ValueType[];
10+
editorId?: string;
911
}
1012

1113
export type NullableAnyVariableValueModel = ValueModel<NullableAnyVariable, NullableAnyVariableValueModelConfiguration>;
@@ -17,7 +19,8 @@ export const createNullableAnyVariableValueModel = (
1719
): ValueModelFactoryFromModel<NullableAnyVariableValueModel> => ({
1820
create: (path: Path) => ({
1921
id: nullableAnyVariableValueModelId,
20-
label: 'Variable',
22+
label: configuration.label ?? 'Variable',
23+
editorId: configuration.editorId,
2124
path,
2225
configuration,
2326
getDefaultValue() {

model/src/value-models/nullable-variable/nullable-variable-value-model.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import { ValueType } from '../../types';
55
import { ValueContext } from '../../context';
66

77
export interface NullableVariableValueModelConfiguration {
8+
label?: string;
89
valueType: ValueType;
910
isRequired?: boolean;
11+
editorId?: string;
1012
}
1113

1214
export type NullableVariableValueModel = ValueModel<NullableVariable, NullableVariableValueModelConfiguration>;
@@ -18,7 +20,8 @@ export const createNullableVariableValueModel = (
1820
): ValueModelFactoryFromModel<NullableVariableValueModel> => ({
1921
create: (path: Path) => ({
2022
id: nullableVariableValueModelId,
21-
label: 'Variable',
23+
label: configuration.label ?? 'Variable',
24+
editorId: configuration.editorId,
2225
path,
2326
configuration,
2427
getDefaultValue(): NullableVariable {

model/src/value-models/number/number-value-model-configuration.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export interface NumberValueModelConfiguration {
2+
label?: string;
23
defaultValue?: number;
34
min?: number;
45
max?: number;

model/src/value-models/number/number-value-model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export const numberValueModelId = 'number';
1010
export const createNumberValueModel = (configuration: NumberValueModelConfiguration): ValueModelFactoryFromModel<NumberValueModel> => ({
1111
create: (path: Path) => ({
1212
id: numberValueModelId,
13+
label: configuration.label ?? 'Number',
1314
editorId: configuration.editorId,
14-
label: 'Number',
1515
path,
1616
configuration,
1717
getDefaultValue() {
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export interface StringDictionaryValueModelConfiguration {
2+
label?: string;
23
uniqueKeys?: boolean;
34
valueMinLength?: number;
5+
editorId?: string;
46
}

model/src/value-models/string-dictionary/string-dictionary-value-model.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export const createStringDictionaryValueModel = (
1313
): ValueModelFactoryFromModel<StringDictionaryValueModel> => ({
1414
create: (path: Path) => ({
1515
id: stringDictionaryValueModelId,
16-
label: 'Dictionary',
16+
label: configuration.label ?? 'Dictionary',
17+
editorId: configuration.editorId,
1718
path,
1819
configuration,
1920
getDefaultValue() {

model/src/value-models/string/string-value-model-configuration.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export interface StringValueModelConfiguration {
2+
label?: string;
23
minLength?: number;
34
defaultValue?: string;
45
pattern?: RegExp;

model/src/value-models/string/string-value-model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export const stringValueModelId = 'string';
1010
export const createStringValueModel = (configuration: StringValueModelConfiguration): ValueModelFactoryFromModel<StringValueModel> => ({
1111
create: (path: Path) => ({
1212
id: stringValueModelId,
13+
label: configuration.label ?? 'String',
1314
editorId: configuration.editorId,
14-
label: 'String',
1515
path,
1616
configuration,
1717
getDefaultValue() {

0 commit comments

Comments
 (0)