@legalplace/wizardx-core 4.42.15 → 4.43.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.
@@ -56,10 +56,10 @@ const stateToProps = (selectors) => (state, ownProps) => {
56
56
  const mandatoryIgnore = selectors.selectMandatoryIgnore();
57
57
  const { meta, options: childOptions, variables: childVariables } = option;
58
58
  const helper = meta.helper
59
- ? parseRawWithVariables(meta.helper, undefined, "________________")
59
+ ? parseRawWithVariables(meta.helper, undefined, "________________", index)
60
60
  : undefined;
61
61
  const warning = meta.warning
62
- ? parseRawWithVariables(meta.warning, undefined, "________________")
62
+ ? parseRawWithVariables(meta.warning, undefined, "________________", index)
63
63
  : undefined;
64
64
  const { type } = meta;
65
65
  return {
@@ -11,7 +11,7 @@ export declare type parseVariableLabelT = (id: number, index: number) => string;
11
11
  export declare const parseVariableLabel: parseVariableLabelT;
12
12
  export declare type parseOptionLabelT = (id: number, index: number) => string;
13
13
  export declare const parseOptionLabel: parseOptionLabelT;
14
- export declare type parseRawT = (text: string, inputs?: OptionsVariablesType, placeholder?: string) => string;
14
+ export declare type parseRawT = (text: string, inputs?: OptionsVariablesType, placeholder?: string, index?: number) => string;
15
15
  export declare const parseRawWithVariables: parseRawT;
16
16
  export declare type parseRawWithRelatedVariablesT = (text: string, optionId: number, index: number, inputs?: OptionsVariablesType, placeholder?: string) => string;
17
17
  export declare const parseRawWithRelatedVariables: parseRawWithRelatedVariablesT;
@@ -145,7 +145,7 @@ export const parseOptionLabel = (id, index = 0) => {
145
145
  });
146
146
  return parsedLabel;
147
147
  };
148
- export const parseRawWithVariables = (text, inputs, placeholder) => {
148
+ export const parseRawWithVariables = (text, inputs, placeholder, index = 0) => {
149
149
  const tagsMatch = text.match(/\[var:([0-9]+)\]/gi);
150
150
  let variables = [];
151
151
  if (tagsMatch !== null) {
@@ -163,8 +163,8 @@ export const parseRawWithVariables = (text, inputs, placeholder) => {
163
163
  variables.forEach((variableId) => {
164
164
  var _a;
165
165
  const value = inputs
166
- ? (_a = inputs.variables[variableId]) === null || _a === void 0 ? void 0 : _a[0]
167
- : selectVariableInputByIndex(variableId, 0);
166
+ ? (_a = inputs.variables[variableId]) === null || _a === void 0 ? void 0 : _a[index]
167
+ : selectVariableInputByIndex(variableId, index);
168
168
  if (value === undefined ||
169
169
  value === null ||
170
170
  (typeof value === "string" && value.trim().length === 0)) {
@@ -37,7 +37,8 @@ export class IntputsInitiator {
37
37
  for (let i = 0; i < optionsIds.length; i += 1) {
38
38
  const optionId = optionsIds[i];
39
39
  const option = this.references.options[optionId];
40
- let values = [false];
40
+ const defaultValue = !!option.meta.prechecked;
41
+ let values = [defaultValue];
41
42
  if (this.ovc &&
42
43
  Object.prototype.hasOwnProperty.call(this.ovc.options, optionId)) {
43
44
  if ([
@@ -59,10 +60,10 @@ export class IntputsInitiator {
59
60
  const rootOptionInput = this.ovc.options[rootOptionId];
60
61
  const { length } = !rootOptionInput && rootOptionReference.meta.type === "static"
61
62
  ? [true]
62
- : rootOptionInput !== null && rootOptionInput !== void 0 ? rootOptionInput : [false];
63
+ : rootOptionInput !== null && rootOptionInput !== void 0 ? rootOptionInput : [defaultValue];
63
64
  values = new Array(length)
64
- .fill(false)
65
- .map((_, index) => { var _a, _b; return ((_b = (_a = this.ovc) === null || _a === void 0 ? void 0 : _a.options[optionId]) === null || _b === void 0 ? void 0 : _b[index]) || false; });
65
+ .fill(defaultValue)
66
+ .map((_, index) => { var _a, _b, _c; return (_c = (_b = (_a = this.ovc) === null || _a === void 0 ? void 0 : _a.options[optionId]) === null || _b === void 0 ? void 0 : _b[index]) !== null && _c !== void 0 ? _c : defaultValue; });
66
67
  }
67
68
  }
68
69
  else if ([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "4.42.15",
3
+ "version": "4.43.1",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -26,9 +26,9 @@
26
26
  "@legalplace/lplogic": "2.3.1",
27
27
  "@legalplace/model-healthcheck": "^1.1.5",
28
28
  "@legalplace/pappers": "^1.2.4",
29
- "@legalplace/referencesparser": "^3.1.81",
29
+ "@legalplace/referencesparser": "^3.1.82",
30
30
  "@legalplace/storybook": "2.364.5",
31
- "@legalplace/typeorm-constants": "^3.77.1",
31
+ "@legalplace/typeorm-constants": "^3.77.2",
32
32
  "@loadable/component": "^5.15.0",
33
33
  "@redux-saga/core": "^1.1.3",
34
34
  "axios": "^0.24.0",
@@ -60,9 +60,9 @@
60
60
  "devDependencies": {
61
61
  "@legalplace/data-gouv": "^1.6.30",
62
62
  "@legalplace/eslint-config": "^2.3.0",
63
- "@legalplace/models-v3-types": "^5.14.13",
63
+ "@legalplace/models-v3-types": "^5.15.0",
64
64
  "@legalplace/prettier-config": "^2.1.3",
65
- "@legalplace/typeorm-entities": "^5.67.3",
65
+ "@legalplace/typeorm-entities": "^5.67.4",
66
66
  "@swc-node/jest": "^1.3.2",
67
67
  "@swc/core": "^1.2.93",
68
68
  "@swc/jest": "^0.2.4",
@@ -100,5 +100,5 @@
100
100
  "*.test.ts",
101
101
  "*.test.tsx"
102
102
  ],
103
- "gitHead": "77e055b29737066b81fbec3deebb22baefe661bb"
103
+ "gitHead": "f79044017fe458bd3b4683ee6f962cc7c554615b"
104
104
  }