sequential-workflow-designer-react 0.18.3 → 0.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.cjs CHANGED
@@ -163,7 +163,6 @@ function SequentialWorkflowDesigner(props) {
163
163
  var customActionHandlerRef = react.useRef(props.customActionHandler);
164
164
  var designerRef = react.useRef(null);
165
165
  var editorRootRef = react.useRef(null);
166
- var wrappedDefinitionRef = react.useRef(null);
167
166
  var definition = props.definition;
168
167
  var selectedStepId = props.selectedStepId;
169
168
  var isReadonly = props.isReadonly;
@@ -187,7 +186,6 @@ function SequentialWorkflowDesigner(props) {
187
186
  function forwardDefinition() {
188
187
  if (designerRef.current) {
189
188
  var wd = wrapDefinition(designerRef.current.getDefinition(), designerRef.current.isValid());
190
- wrappedDefinitionRef.current = wd;
191
189
  onDefinitionChangeRef.current(wd);
192
190
  }
193
191
  }
@@ -253,10 +251,6 @@ function SequentialWorkflowDesigner(props) {
253
251
  if (designerRef.current) {
254
252
  var isNotChanged = definition.value === designerRef.current.getDefinition();
255
253
  if (isNotChanged) {
256
- if (wrappedDefinitionRef.current !== definition) {
257
- wrappedDefinitionRef.current = definition;
258
- designerRef.current.updateRootComponent();
259
- }
260
254
  if (selectedStepId !== undefined && selectedStepId !== designerRef.current.getSelectedStepId()) {
261
255
  if (selectedStepId) {
262
256
  designerRef.current.selectStepById(selectedStepId);
@@ -373,6 +367,13 @@ var SequentialWorkflowDesignerController = /** @class */ (function () {
373
367
  this.updateRootComponent = function () {
374
368
  _this.getDesigner().updateRootComponent();
375
369
  };
370
+ /**
371
+ * Replaces the current definition with a new one and adds the previous definition to the undo stack.
372
+ * @param definition A new definition.
373
+ */
374
+ this.replaceDefinition = function (definition) {
375
+ return _this.getDesigner().replaceDefinition(definition);
376
+ };
376
377
  // Nothing...
377
378
  }
378
379
  SequentialWorkflowDesignerController.create = function () {
package/lib/esm/index.js CHANGED
@@ -161,7 +161,6 @@ function SequentialWorkflowDesigner(props) {
161
161
  var customActionHandlerRef = useRef(props.customActionHandler);
162
162
  var designerRef = useRef(null);
163
163
  var editorRootRef = useRef(null);
164
- var wrappedDefinitionRef = useRef(null);
165
164
  var definition = props.definition;
166
165
  var selectedStepId = props.selectedStepId;
167
166
  var isReadonly = props.isReadonly;
@@ -185,7 +184,6 @@ function SequentialWorkflowDesigner(props) {
185
184
  function forwardDefinition() {
186
185
  if (designerRef.current) {
187
186
  var wd = wrapDefinition(designerRef.current.getDefinition(), designerRef.current.isValid());
188
- wrappedDefinitionRef.current = wd;
189
187
  onDefinitionChangeRef.current(wd);
190
188
  }
191
189
  }
@@ -251,10 +249,6 @@ function SequentialWorkflowDesigner(props) {
251
249
  if (designerRef.current) {
252
250
  var isNotChanged = definition.value === designerRef.current.getDefinition();
253
251
  if (isNotChanged) {
254
- if (wrappedDefinitionRef.current !== definition) {
255
- wrappedDefinitionRef.current = definition;
256
- designerRef.current.updateRootComponent();
257
- }
258
252
  if (selectedStepId !== undefined && selectedStepId !== designerRef.current.getSelectedStepId()) {
259
253
  if (selectedStepId) {
260
254
  designerRef.current.selectStepById(selectedStepId);
@@ -371,6 +365,13 @@ var SequentialWorkflowDesignerController = /** @class */ (function () {
371
365
  this.updateRootComponent = function () {
372
366
  _this.getDesigner().updateRootComponent();
373
367
  };
368
+ /**
369
+ * Replaces the current definition with a new one and adds the previous definition to the undo stack.
370
+ * @param definition A new definition.
371
+ */
372
+ this.replaceDefinition = function (definition) {
373
+ return _this.getDesigner().replaceDefinition(definition);
374
+ };
374
375
  // Nothing...
375
376
  }
376
377
  SequentialWorkflowDesignerController.create = function () {
package/lib/index.d.ts CHANGED
@@ -58,6 +58,11 @@ declare class SequentialWorkflowDesignerController {
58
58
  * @description Rerender the root component and all its children.
59
59
  */
60
60
  readonly updateRootComponent: () => void;
61
+ /**
62
+ * Replaces the current definition with a new one and adds the previous definition to the undo stack.
63
+ * @param definition A new definition.
64
+ */
65
+ readonly replaceDefinition: (definition: Definition) => Promise<void>;
61
66
  /**
62
67
  * @returns `true` if the controller is ready to be used, `false` otherwise.
63
68
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sequential-workflow-designer-react",
3
3
  "description": "React wrapper for Sequential Workflow Designer component.",
4
- "version": "0.18.3",
4
+ "version": "0.18.4",
5
5
  "type": "module",
6
6
  "main": "./lib/esm/index.js",
7
7
  "types": "./lib/index.d.ts",
@@ -47,7 +47,7 @@
47
47
  "peerDependencies": {
48
48
  "react": "^18.2.0",
49
49
  "react-dom": "^18.2.0",
50
- "sequential-workflow-designer": "^0.18.3"
50
+ "sequential-workflow-designer": "^0.18.4"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@rollup/plugin-node-resolve": "^15.0.1",
@@ -63,7 +63,7 @@
63
63
  "prettier": "^2.8.2",
64
64
  "react": "^18.2.0",
65
65
  "react-dom": "^18.2.0",
66
- "sequential-workflow-designer": "^0.18.3",
66
+ "sequential-workflow-designer": "^0.18.4",
67
67
  "rollup": "^3.18.0",
68
68
  "rollup-plugin-dts": "^5.2.0",
69
69
  "rollup-plugin-typescript2": "^0.34.1",