diff --git a/CHANGELOG.md b/CHANGELOG.md index fe4f02a..0ab3748 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.14.4 + +This version exposes the `ToolboxGroup` interface in the `sequential-workflow-editor` package [#46](https://github.com/nocode-js/sequential-workflow-editor/issues/46#issuecomment-2439817733). + ## 0.14.3 This version provides the ability to sort the steps in the toolbox in a custom way. By default, the steps are sorted alphabetically. diff --git a/demos/webpack-app/package.json b/demos/webpack-app/package.json index d4747c8..74057f3 100644 --- a/demos/webpack-app/package.json +++ b/demos/webpack-app/package.json @@ -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.14.3", - "sequential-workflow-editor": "^0.14.3" + "sequential-workflow-editor-model": "^0.14.4", + "sequential-workflow-editor": "^0.14.4" }, "devDependencies": { "ts-loader": "^9.4.2", diff --git a/editor/package.json b/editor/package.json index a0bb47d..0c7cbb0 100644 --- a/editor/package.json +++ b/editor/package.json @@ -1,6 +1,6 @@ { "name": "sequential-workflow-editor", - "version": "0.14.3", + "version": "0.14.4", "type": "module", "main": "./lib/esm/index.js", "types": "./lib/index.d.ts", @@ -46,11 +46,11 @@ "prettier:fix": "prettier --write ./src ./css" }, "dependencies": { - "sequential-workflow-editor-model": "^0.14.3", + "sequential-workflow-editor-model": "^0.14.4", "sequential-workflow-model": "^0.2.0" }, "peerDependencies": { - "sequential-workflow-editor-model": "^0.14.3", + "sequential-workflow-editor-model": "^0.14.4", "sequential-workflow-model": "^0.2.0" }, "devDependencies": { diff --git a/editor/src/core/sort-toolbox-groups.spec.ts b/editor/src/core/sort-toolbox-groups.spec.ts index 314159f..75b108d 100644 --- a/editor/src/core/sort-toolbox-groups.spec.ts +++ b/editor/src/core/sort-toolbox-groups.spec.ts @@ -1,6 +1,6 @@ import { Step } from 'sequential-workflow-model'; -import { ToolboxGroup } from '../external-types'; import { sortToolboxGroups } from './sort-toolbox-groups'; +import { ToolboxGroup } from '../editor-provider-configuration'; function createStep(name: string): Step { return { diff --git a/editor/src/core/sort-toolbox-groups.ts b/editor/src/core/sort-toolbox-groups.ts index 1feb47c..7785518 100644 --- a/editor/src/core/sort-toolbox-groups.ts +++ b/editor/src/core/sort-toolbox-groups.ts @@ -1,5 +1,4 @@ -import { EditorToolboxSorter } from '../editor-provider-configuration'; -import { ToolboxGroup } from '../external-types'; +import { EditorToolboxSorter, ToolboxGroup } from '../editor-provider-configuration'; export const sortToolboxGroups: EditorToolboxSorter = (groups: ToolboxGroup[]) => { groups.forEach(group => { diff --git a/editor/src/editor-provider-configuration.ts b/editor/src/editor-provider-configuration.ts index 9812ba1..512aa15 100644 --- a/editor/src/editor-provider-configuration.ts +++ b/editor/src/editor-provider-configuration.ts @@ -1,19 +1,49 @@ import { I18n, UidGenerator } from 'sequential-workflow-editor-model'; -import { DefinitionWalker } from 'sequential-workflow-model'; +import { DefinitionWalker, Step } from 'sequential-workflow-model'; import { EditorExtension } from './editor-extension'; -import { ToolboxGroup } from './external-types'; export interface EditorProviderConfiguration { + /** + * A generator of unique identifiers. + */ uidGenerator: UidGenerator; + + /** + * The definition walker. If it's not set the editor uses the default definition walker from the `sequential-workflow-model` package. + */ definitionWalker?: DefinitionWalker; + + /** + * The translation service for the editor. + */ i18n?: I18n; + + /** + * Determines whether the header of the editor is hidden. + */ isHeaderHidden?: boolean; - extensions?: EditorExtension[]; /** * Sorter for the toolbox groups. By default, the groups are sorted alphabetically. */ toolboxSorter?: EditorToolboxSorter; + + /** + * Extensions for the editor. + */ + extensions?: EditorExtension[]; +} + +export interface ToolboxGroup { + /** + * The name of the group. + */ + name: string; + + /** + * The steps in the group. + */ + steps: Step[]; } export type EditorToolboxSorter = (groups: ToolboxGroup[]) => void; diff --git a/editor/src/editor-provider.ts b/editor/src/editor-provider.ts index 4440f7c..babe3ef 100644 --- a/editor/src/editor-provider.ts +++ b/editor/src/editor-provider.ts @@ -18,10 +18,9 @@ import { StepEditorContext, StepEditorProvider, StepLabelProvider, - StepValidator, - ToolboxGroup + StepValidator } from './external-types'; -import { EditorProviderConfiguration } from './editor-provider-configuration'; +import { EditorProviderConfiguration, ToolboxGroup } from './editor-provider-configuration'; import { EditorHeaderData } from './editor-header'; import { sortToolboxGroups } from './core/sort-toolbox-groups'; diff --git a/editor/src/external-types.ts b/editor/src/external-types.ts index 07619f4..176ab39 100644 --- a/editor/src/external-types.ts +++ b/editor/src/external-types.ts @@ -17,8 +17,3 @@ export type StepLabelProvider = (step: { type: string }) => string; export type StepValidator = (step: Step, _: unknown, definition: Definition) => boolean; export type RootValidator = (definition: Definition) => boolean; - -export interface ToolboxGroup { - name: string; - steps: Step[]; -} diff --git a/model/package.json b/model/package.json index f0790bc..d6c4312 100644 --- a/model/package.json +++ b/model/package.json @@ -1,6 +1,6 @@ { "name": "sequential-workflow-editor-model", - "version": "0.14.3", + "version": "0.14.4", "homepage": "https://nocode-js.com/", "author": { "name": "NoCode JS", diff --git a/model/src/builders/step-model-builder.ts b/model/src/builders/step-model-builder.ts index 81f38de..36fd65c 100644 --- a/model/src/builders/step-model-builder.ts +++ b/model/src/builders/step-model-builder.ts @@ -79,7 +79,7 @@ export class StepModelBuilder { /** * @returns The builder for the `name` property. - * @example `builder.name().value(stringValueModel({ defaultValue: 'Some name' })).label('Name');` + * @example `builder.name().value(createStringValueModel({ defaultValue: 'Some name' })).label('Name');` */ public name(): PropertyModelBuilder { return this.nameBuilder; @@ -88,7 +88,7 @@ export class StepModelBuilder { /** * @param propertyName Name of the property in the step. * @returns The builder for the property. - * @example `builder.property('foo').value(stringValueModel({ defaultValue: 'Some value' })).label('Foo');` + * @example `builder.property('foo').value(createStringValueModel({ defaultValue: 'Some value' })).label('Foo');` */ public property( propertyName: Key