@legalplace/wizardx-core 4.40.0 → 4.40.1

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/dist/App.js CHANGED
@@ -69,8 +69,8 @@ class WizardXCore extends React.Component {
69
69
  parent = source;
70
70
  }
71
71
  if (data.from && data.from === "BO") {
72
- const variable = data.variables[0];
73
- autoSave(variable, getStore());
72
+ const { variables } = data;
73
+ autoSave(variables, getStore());
74
74
  }
75
75
  });
76
76
  dispatch(callInitDataSmartscriptAction());
@@ -6,10 +6,10 @@ export declare const getRelatedParentsByVariableId: (variableId: number, index:
6
6
  condition: boolean | undefined;
7
7
  }[];
8
8
  export declare const getAutoCompleteParentVariableId: (variableId: number, index: number, type?: string | undefined) => number | undefined;
9
- export declare const autoSave: (variableData: {
9
+ export declare const autoSave: (variablesData: {
10
10
  variablesIds: number[];
11
11
  updateValue: string;
12
12
  index: number;
13
- }, store: Store<EmptyObject & StateType, AnyAction> & {
13
+ }[], store: Store<EmptyObject & StateType, AnyAction> & {
14
14
  dispatch: unknown;
15
15
  }) => Promise<void>;
@@ -56,21 +56,26 @@ const getResultAutoComplete = (variableId, updateValue, index, store) => __await
56
56
  store.dispatch(saveDataAction());
57
57
  }
58
58
  });
59
- export const autoSave = (variableData, store) => __awaiter(void 0, void 0, void 0, function* () {
60
- yield variableData.variablesIds.forEach((variableId, indexVariable) => __awaiter(void 0, void 0, void 0, function* () {
61
- let contentVariable = variableData.updateValue;
62
- if (variableData.variablesIds.length > 1) {
63
- contentVariable = `${variableData.updateValue.split(",")[indexVariable] || ""}`.trim();
64
- }
65
- const variable = store.getState().references.variables[variableId];
66
- const variableParentId = getAutoCompleteParentVariableId(variableId, variableData.index, variable === null || variable === void 0 ? void 0 : variable.type);
67
- if (variableParentId) {
68
- yield getResultAutoComplete(variableParentId, contentVariable, variableData.index, store);
69
- return;
70
- }
71
- store.dispatch(updateVariableAction(variableId, contentVariable, variableData.index));
72
- if (indexVariable === variableData.variablesIds.length - 1) {
73
- store.dispatch(saveDataAction());
74
- }
59
+ export const autoSave = (variablesData, store) => __awaiter(void 0, void 0, void 0, function* () {
60
+ yield variablesData.forEach((variableData, indexVariablesData) => __awaiter(void 0, void 0, void 0, function* () {
61
+ yield variableData.variablesIds.forEach((variableId, indexVariable) => __awaiter(void 0, void 0, void 0, function* () {
62
+ let contentVariable = variableData.updateValue;
63
+ if (variableData.variablesIds.length > 1) {
64
+ contentVariable = `${variableData.updateValue.split(",")[indexVariable] || ""}`.trim();
65
+ }
66
+ const variable = store.getState().references.variables[variableId];
67
+ const variableParentId = getAutoCompleteParentVariableId(variableId, variableData.index, variable === null || variable === void 0 ? void 0 : variable.type);
68
+ if (variableParentId) {
69
+ yield getResultAutoComplete(variableParentId, contentVariable, variableData.index, store);
70
+ return;
71
+ }
72
+ yield store.dispatch(updateVariableAction(variableId, contentVariable, variableData.index));
73
+ setTimeout(() => __awaiter(void 0, void 0, void 0, function* () {
74
+ if (indexVariable === variableData.variablesIds.length - 1 &&
75
+ indexVariablesData === variablesData.length - 1) {
76
+ store.dispatch(saveDataAction());
77
+ }
78
+ }), 200);
79
+ }));
75
80
  }));
76
81
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "4.40.0",
3
+ "version": "4.40.1",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -100,5 +100,5 @@
100
100
  "*.test.ts",
101
101
  "*.test.tsx"
102
102
  ],
103
- "gitHead": "884dee271e086f5fa8e0da797ce158adb5fa6ef6"
103
+ "gitHead": "0a7c701e3708f82e62c65047e7a6525ace7ecf41"
104
104
  }