Skip to content

Commit f23b57e

Browse files
authored
Merge pull request #16 from nocode-js/develop
0.5.1.
2 parents 7327ed7 + b90a07c commit f23b57e

21 files changed

+174
-84
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.5.1
2+
3+
* Fixed calculation of label width in the switch step.
4+
* Added an exclamation mark to the warning icon.
5+
16
## 0.5.0
27

38
* Fixed losing the disabled state during dragging.
@@ -82,7 +87,7 @@ const config = {
8287

8388
#### Editor's Context
8489

85-
We've changed an approach how the editors should notify the designer about changes in the definition. We've deleted `revalidate()` and `notifiyDefinitionChanged()` methods from the `Designer` class. Instead of this, now editors receive an editor's context.
90+
We've changed an approach how the editors should notify the designer about changes in the definition. We've deleted `revalidate()` and `notifyDefinitionChanged()` methods from the `Designer` class. Instead of this, now editors receive an editor's context.
8691

8792
```ts
8893
interface StepEditorContext {
@@ -111,7 +116,7 @@ const config = {
111116
};
112117
```
113118

114-
#### Type Requirments
119+
#### Type Requirements
115120

116121
The `type` of a step cannot contain special characters from now. Check [the type validator](src/core/type-validator.ts).
117122

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ To import the package:
5151
import { Designer } from 'sequential-workflow-designer';
5252
```
5353

54-
If you use [css-loader](https://webpack.js.org/loaders/css-loader/) or similar, you can add CSS files to your boundle:
54+
If you use [css-loader](https://webpack.js.org/loaders/css-loader/) or similar, you can add CSS files to your bundle:
5555

5656
```ts
5757
import 'sequential-workflow-designer/css/designer.css';
@@ -73,10 +73,10 @@ Add the below code to your head section in HTML document.
7373
```html
7474
<head>
7575
...
76-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.0/css/designer.css" rel="stylesheet">
77-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.0/css/designer-light.css" rel="stylesheet">
78-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.0/css/designer-dark.css" rel="stylesheet">
79-
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.0/dist/index.umd.js"></script>
76+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.1/css/designer.css" rel="stylesheet">
77+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.1/css/designer-light.css" rel="stylesheet">
78+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.1/css/designer-dark.css" rel="stylesheet">
79+
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.1/dist/index.umd.js"></script>
8080
```
8181

8282
Call the designer by:

designer/css/designer-dark.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,6 @@
162162
.sqd-theme-dark .sqd-validation-error {
163163
fill: #FFA200;
164164
}
165+
.sqd-theme-dark .sqd-validation-error-icon-path {
166+
fill: #000;
167+
}

designer/css/designer-light.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,6 @@
162162
.sqd-theme-light .sqd-validation-error {
163163
fill: #FFA200;
164164
}
165+
.sqd-theme-light .sqd-validation-error-icon-path {
166+
fill: #000;
167+
}

designer/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-designer",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"main": "./lib/index.mjs",
55
"types": "./lib/index.d.ts",
66
"repository": {

designer/src/core/icons.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export class Icons {
2525
public static options =
2626
'm19.4 44-1-6.3q-.95-.35-2-.95t-1.85-1.25l-5.9 2.7L4 30l5.4-3.95q-.1-.45-.125-1.025Q9.25 24.45 9.25 24q0-.45.025-1.025T9.4 21.95L4 18l4.65-8.2 5.9 2.7q.8-.65 1.85-1.25t2-.9l1-6.35h9.2l1 6.3q.95.35 2.025.925Q32.7 11.8 33.45 12.5l5.9-2.7L44 18l-5.4 3.85q.1.5.125 1.075.025.575.025 1.075t-.025 1.05q-.025.55-.125 1.05L44 30l-4.65 8.2-5.9-2.7q-.8.65-1.825 1.275-1.025.625-2.025.925l-1 6.3ZM24 30.5q2.7 0 4.6-1.9 1.9-1.9 1.9-4.6 0-2.7-1.9-4.6-1.9-1.9-4.6-1.9-2.7 0-4.6 1.9-1.9 1.9-1.9 4.6 0 2.7 1.9 4.6 1.9 1.9 4.6 1.9Z';
2727
public static expand = 'm24 30.75-12-12 2.15-2.15L24 26.5l9.85-9.85L36 18.8Z';
28+
public static alert =
29+
'M24 42q-1.45 0-2.475-1.025Q20.5 39.95 20.5 38.5q0-1.45 1.025-2.475Q22.55 35 24 35q1.45 0 2.475 1.025Q27.5 37.05 27.5 38.5q0 1.45-1.025 2.475Q25.45 42 24 42Zm-3.5-12V6h7v24Z';
2830

2931
public static appendPath(parent: SVGElement, pathClassName: string, d: string, size: number): SVGGElement {
3032
const g = Dom.svg('g');

designer/src/core/steps-traverser.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ContainerStep, Step, SwitchStep, TaskStep } from '../definition';
2-
import { StepExtensionsResolver } from '../workspace/step-extensions-resolver';
2+
import { StepExtensionResolver } from '../workspace/step-extension-resolver';
33
import { StepsTraverser } from './steps-traverser';
44

55
describe('StepsTraverser', () => {
@@ -49,7 +49,7 @@ describe('StepsTraverser', () => {
4949
let traverser: StepsTraverser;
5050

5151
beforeAll(() => {
52-
const extensions = StepExtensionsResolver.resolve([]);
52+
const extensions = StepExtensionResolver.create([]);
5353
traverser = new StepsTraverser(extensions);
5454
});
5555

designer/src/core/steps-traverser.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Branches, Definition, Sequence, Step } from '../definition';
22
import { StepChildrenType, StepChildren } from '../designer-configuration';
3-
import { StepExtensionDictionary } from '../workspace/component-context';
3+
import { StepExtensionResolver } from '../workspace/step-extension-resolver';
44

55
export interface StepWithParentSequence {
66
step: Step;
@@ -22,14 +22,11 @@ export interface StepWithParentAndChildSequences {
2222
}
2323

2424
export class StepsTraverser {
25-
public constructor(private readonly stepExtensions: StepExtensionDictionary) {}
25+
public constructor(private readonly stepExtensionResolver: StepExtensionResolver) {}
2626

2727
private getChildren(step: Step): StepChildren | null {
28-
const extension = this.stepExtensions[step.componentType];
29-
if (!extension) {
30-
throw new Error(`Not supported component type: ${step.componentType}`);
31-
}
32-
return extension.getChildren(step);
28+
const stepExtension = this.stepExtensionResolver.resolve(step.componentType);
29+
return stepExtension.getChildren(step);
3330
}
3431

3532
private find(

designer/src/designer-context.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import { DesignerConfiguration } from './designer-configuration';
77
import { DesignerState } from './designer-state';
88
import { HistoryController } from './history-controller';
99
import { LayoutController } from './layout-controller';
10-
import { StepExtensionDictionary } from './workspace/component-context';
10+
import { StepExtensionResolver } from './workspace/step-extension-resolver';
1111
import { WorkspaceController, WorkspaceControllerWrapper } from './workspace/workspace-controller';
1212

1313
export class DesignerContext {
1414
public static create(
1515
parent: HTMLElement,
1616
startDefinition: Definition,
1717
configuration: DesignerConfiguration,
18-
stepExtensions: StepExtensionDictionary
18+
stepExtensionResolver: StepExtensionResolver
1919
): DesignerContext {
2020
const definition = ObjectCloner.deepClone(startDefinition);
2121

@@ -26,7 +26,7 @@ export class DesignerContext {
2626
const state = new DesignerState(definition, isReadonly, isMobile, isMobile);
2727
const workspaceController = new WorkspaceControllerWrapper();
2828
const behaviorController = new BehaviorController();
29-
const stepsTraverser = new StepsTraverser(stepExtensions);
29+
const stepsTraverser = new StepsTraverser(stepExtensionResolver);
3030
const definitionModifier = new DefinitionModifier(stepsTraverser, state, configuration);
3131

3232
let historyController: HistoryController | undefined = undefined;

designer/src/designer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { DesignerState } from './designer-state';
77
import { DefinitionModifier } from './definition-modifier';
88
import { WorkspaceController } from './workspace/workspace-controller';
99
import { ComponentContext } from './workspace/component-context';
10-
import { StepExtensionsResolver } from './workspace/step-extensions-resolver';
10+
import { StepExtensionResolver } from './workspace/step-extension-resolver';
1111
import { StepOrName, StepsTraverser } from './core/steps-traverser';
1212

1313
export class Designer {
@@ -19,10 +19,10 @@ export class Designer {
1919
* @returns An instance of a designer.
2020
*/
2121
public static create(placeholder: HTMLElement, startDefinition: Definition, configuration: DesignerConfiguration): Designer {
22-
const stepExtensions = StepExtensionsResolver.resolve(configuration.extensions);
22+
const stepExtensionResolver = StepExtensionResolver.create(configuration.extensions);
2323

24-
const designerContext = DesignerContext.create(placeholder, startDefinition, configuration, stepExtensions);
25-
const componentContext = ComponentContext.create(configuration.steps, stepExtensions);
24+
const designerContext = DesignerContext.create(placeholder, startDefinition, configuration, stepExtensionResolver);
25+
const componentContext = ComponentContext.create(configuration.steps, stepExtensionResolver);
2626

2727
const view = DesignerView.create(placeholder, designerContext, componentContext, designerContext.layoutController, configuration);
2828
const designer = new Designer(

0 commit comments

Comments
 (0)