Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.14.0. #42

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.14.0

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.

## 0.13.2

This version adds missing translations for the `variableDefinitions` value editor.
Expand Down
4 changes: 2 additions & 2 deletions demos/webpack-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"sequential-workflow-model": "^0.2.0",
"sequential-workflow-designer": "^0.21.2",
"sequential-workflow-machine": "^0.4.0",
"sequential-workflow-editor-model": "^0.13.2",
"sequential-workflow-editor": "^0.13.2"
"sequential-workflow-editor-model": "^0.14.0",
"sequential-workflow-editor": "^0.14.0"
},
"devDependencies": {
"ts-loader": "^9.4.2",
Expand Down
4 changes: 2 additions & 2 deletions demos/webpack-app/src/editors/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export class App {
});

if (location.hash) {
const type = location.hash.substring(1);
const step = designer.getDefinition().sequence.find(s => s.type === type);
const type = location.hash.substring(1).toLowerCase();
const step = designer.getDefinition().sequence.find(s => s.type.toLowerCase() === type);
if (step) {
designer.selectStepById(step.id);
}
Expand Down
3 changes: 2 additions & 1 deletion docs/I18N-KEYS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ This document lists all the I18N keys used in the Sequential Workflow Editor.
"generatedString.differentValue": "Generator returns different value than the current value",
"nullableAnyVariable.invalidVariableType": "The variable :name has invalid type",
"nullableAnyVariable.select": "- Select -",
"nullableAnyVariable.selectTypes": "- Select: :types -",
"nullableAnyVariable.variableIsLost": "The variable :name is lost",
"nullableAnyVariable.variableIsRequired": "The variable is required",
"nullableVariable.select": "- Select -",
"nullableVariable.selectType": "- Select: :type -",
"nullableVariable.variableIsLost": "The variable :name is not found",
"nullableVariable.variableIsRequired": "The variable is required",
"nullableVariableDefinition.expectedType": "Variable type must be :type",
Expand Down
6 changes: 3 additions & 3 deletions editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sequential-workflow-editor",
"version": "0.13.2",
"version": "0.14.0",
"type": "module",
"main": "./lib/esm/index.js",
"types": "./lib/index.d.ts",
Expand Down Expand Up @@ -46,11 +46,11 @@
"prettier:fix": "prettier --write ./src ./css"
},
"dependencies": {
"sequential-workflow-editor-model": "^0.13.2",
"sequential-workflow-editor-model": "^0.14.0",
"sequential-workflow-model": "^0.2.0"
},
"peerDependencies": {
"sequential-workflow-editor-model": "^0.13.2",
"sequential-workflow-editor-model": "^0.14.0",
"sequential-workflow-model": "^0.2.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ export function nullableAnyVariableValueEditor(
const select = selectComponent({
stretched: true
});
select.setValues([
context.i18n('nullableAnyVariable.select', '- Select -'),
...variables.map(variable => formatVariableNameWithType(variable.name, variable.type))
]);

const expectedTypes = context.model.configuration.valueTypes ? context.model.configuration.valueTypes.join(', ') : null;
const actionText = expectedTypes
? context.i18n('nullableAnyVariable.selectTypes', '- Select: :types -', {
types: expectedTypes
})
: context.i18n('nullableAnyVariable.select', '- Select -');

select.setValues([actionText, ...variables.map(variable => formatVariableNameWithType(variable.name, variable.type))]);
if (startValue) {
select.selectIndex(variables.findIndex(variable => variable.name === startValue.name) + 1);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export function nullableVariableValueEditor(context: ValueContext<NullableVariab
stretched: true
});
select.setValues([
context.i18n('nullableVariable.select', '- Select -'),
context.i18n('nullableVariable.selectType', '- Select: :type -', {
type: context.model.configuration.valueType
}),
...variables.map(variable => formatVariableNameWithType(variable.name, variable.type))
]);
if (startValue) {
Expand Down
2 changes: 1 addition & 1 deletion model/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sequential-workflow-editor-model",
"version": "0.13.2",
"version": "0.14.0",
"homepage": "https://nocode-js.com/",
"author": {
"name": "NoCode JS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { AnyVariables, ValueType } from '../../types';
import { ValueContext } from '../../context';

export interface AnyVariablesValueModelConfiguration {
label?: string;
valueTypes?: ValueType[];
editorId?: string;
}

export type AnyVariablesValueModel = ValueModel<AnyVariables, AnyVariablesValueModelConfiguration>;
Expand All @@ -16,7 +18,8 @@ export const createAnyVariablesValueModel = (
): ValueModelFactoryFromModel<AnyVariablesValueModel> => ({
create: (path: Path) => ({
id: anyVariablesValueModelId,
label: 'Variables',
label: configuration.label ?? 'Variables',
editorId: configuration.editorId,
path,
configuration,
getDefaultValue() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface BooleanValueModelConfiguration {
label?: string;
defaultValue?: boolean;
editorId?: string;
}
2 changes: 1 addition & 1 deletion model/src/value-models/boolean/boolean-value-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const createBooleanValueModel = (configuration: BooleanValueModelConfigur
create: (path: Path) => ({
id: booleanValueModelId,
editorId: configuration.editorId,
label: 'Boolean',
label: configuration.label ?? 'Boolean',
path,
configuration,
getDefaultValue() {
Expand Down
5 changes: 4 additions & 1 deletion model/src/value-models/choice/choice-value-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { Path } from '../../core/path';
import { ValueContext } from '../../context';

export interface ChoiceValueModelConfiguration<TValue extends string = string> {
label?: string;
choices: TValue[];
defaultValue?: TValue;
editorId?: string;
}

export type ChoiceValueModel<TValue extends string = string> = ValueModel<TValue, ChoiceValueModelConfiguration<TValue>>;
Expand All @@ -21,7 +23,8 @@ export function createChoiceValueModel<TValue extends string>(
return {
create: (path: Path) => ({
id: choiceValueModelId,
label: 'Choice',
label: configuration.label ?? 'Choice',
editorId: configuration.editorId,
path,
configuration,
getDefaultValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { GeneratedStringContext } from './generated-string-context';
import { DefaultValueContext } from '../../context/default-value-context';

export interface GeneratedStringValueModelConfiguration<TProperties extends Properties = Properties> {
label?: string;
generator(context: GeneratedStringContext<TProperties>): string;
editorId?: string;
}

export type GeneratedStringVariableValueModel<TProperties extends Properties = Properties> = ValueModel<
Expand All @@ -22,7 +24,8 @@ export function createGeneratedStringValueModel<TProperties extends Properties =
return {
create: (path: Path) => ({
id: generatedStringValueModelId,
label: 'Generated string',
label: configuration.label ?? 'Generated string',
editorId: configuration.editorId,
path,
configuration,
getDefaultValue(context: DefaultValueContext<TProperties>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { NullableAnyVariable, ValueType } from '../../types';
import { ValueContext } from '../../context';

export interface NullableAnyVariableValueModelConfiguration {
label?: string;
isRequired?: boolean;
valueTypes?: ValueType[];
editorId?: string;
}

export type NullableAnyVariableValueModel = ValueModel<NullableAnyVariable, NullableAnyVariableValueModelConfiguration>;
Expand All @@ -17,7 +19,8 @@ export const createNullableAnyVariableValueModel = (
): ValueModelFactoryFromModel<NullableAnyVariableValueModel> => ({
create: (path: Path) => ({
id: nullableAnyVariableValueModelId,
label: 'Variable',
label: configuration.label ?? 'Variable',
editorId: configuration.editorId,
path,
configuration,
getDefaultValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { ValueType } from '../../types';
import { ValueContext } from '../../context';

export interface NullableVariableValueModelConfiguration {
label?: string;
valueType: ValueType;
isRequired?: boolean;
editorId?: string;
}

export type NullableVariableValueModel = ValueModel<NullableVariable, NullableVariableValueModelConfiguration>;
Expand All @@ -18,7 +20,8 @@ export const createNullableVariableValueModel = (
): ValueModelFactoryFromModel<NullableVariableValueModel> => ({
create: (path: Path) => ({
id: nullableVariableValueModelId,
label: 'Variable',
label: configuration.label ?? 'Variable',
editorId: configuration.editorId,
path,
configuration,
getDefaultValue(): NullableVariable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface NumberValueModelConfiguration {
label?: string;
defaultValue?: number;
min?: number;
max?: number;
Expand Down
2 changes: 1 addition & 1 deletion model/src/value-models/number/number-value-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const numberValueModelId = 'number';
export const createNumberValueModel = (configuration: NumberValueModelConfiguration): ValueModelFactoryFromModel<NumberValueModel> => ({
create: (path: Path) => ({
id: numberValueModelId,
label: configuration.label ?? 'Number',
editorId: configuration.editorId,
label: 'Number',
path,
configuration,
getDefaultValue() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface StringDictionaryValueModelConfiguration {
label?: string;
uniqueKeys?: boolean;
valueMinLength?: number;
editorId?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const createStringDictionaryValueModel = (
): ValueModelFactoryFromModel<StringDictionaryValueModel> => ({
create: (path: Path) => ({
id: stringDictionaryValueModelId,
label: 'Dictionary',
label: configuration.label ?? 'Dictionary',
editorId: configuration.editorId,
path,
configuration,
getDefaultValue() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface StringValueModelConfiguration {
label?: string;
minLength?: number;
defaultValue?: string;
pattern?: RegExp;
Expand Down
2 changes: 1 addition & 1 deletion model/src/value-models/string/string-value-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const stringValueModelId = 'string';
export const createStringValueModel = (configuration: StringValueModelConfiguration): ValueModelFactoryFromModel<StringValueModel> => ({
create: (path: Path) => ({
id: stringValueModelId,
label: configuration.label ?? 'String',
editorId: configuration.editorId,
label: 'String',
path,
configuration,
getDefaultValue() {
Expand Down
Loading