@arquimedes.co/eureka-forms 1.9.54-test → 1.9.55-test

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.
@@ -1,6 +1,7 @@
1
1
  export interface GBaseStep {
2
2
  id: string;
3
3
  type: string;
4
+ editable?: boolean;
4
5
  dependencies?: string[];
5
6
  }
6
7
  export interface GTitle extends GBaseStep {
package/dist/App.js CHANGED
@@ -384,7 +384,7 @@ var mapOriginalValues = function (originalValues, form) {
384
384
  }
385
385
  for (var _f = 0, _g = Object.keys(element); _f < _g.length; _f++) {
386
386
  var idValue_1 = _g[_f];
387
- if (!step.steps[idValue_1]) {
387
+ if (!step.steps[idValue_1] && idValue_1 !== 'id') {
388
388
  newValues[idValue_1] = element[idValue_1];
389
389
  }
390
390
  }
@@ -116,7 +116,7 @@ function ColumnForm(_a) {
116
116
  newValues = {};
117
117
  for (_i = 0, _a = Object.keys(values); _i < _a.length; _i++) {
118
118
  idStep = _a[_i];
119
- newValues[idStep] = calcValue(idStep, form.steps, values, customSteps);
119
+ newValues[idStep] = calcValue(newValues, idStep, form.steps, values, customSteps);
120
120
  }
121
121
  if (!customSend) return [3 /*break*/, 4];
122
122
  return [4 /*yield*/, customSend(newValues, reload)];
@@ -220,7 +220,7 @@ function calcNextSection(form, idSection, sections) {
220
220
  }
221
221
  }
222
222
  }
223
- var calcValue = function (idStep, steps, values, customSteps, value) {
223
+ var calcValue = function (newValues, idStep, steps, values, customSteps, value) {
224
224
  var _a, _b;
225
225
  if (value === void 0) { value = values[idStep]; }
226
226
  var step = steps[idStep];
@@ -272,7 +272,8 @@ var calcValue = function (idStep, steps, values, customSteps, value) {
272
272
  var idStep_1 = _d[_c];
273
273
  var mappedId = element.ids[idStep_1];
274
274
  if (values[mappedId] !== undefined) {
275
- newValue[idStep_1] = calcValue(idStep_1, step.steps, values, customSteps, values[mappedId]);
275
+ newValue[idStep_1] = calcValue(newValues, idStep_1, step.steps, values, customSteps, values[mappedId]);
276
+ delete newValues[mappedId];
276
277
  }
277
278
  }
278
279
  mappedValues.push(newValue);
@@ -13,7 +13,7 @@ export interface FormComponentProps {
13
13
  organization: Organization;
14
14
  originalValues: Record<string, unknown>;
15
15
  customSteps: Record<string, CustomStep>;
16
- customSend?: (values: any, reload: Function) => Promise<void>;
16
+ customSend?: (values: any, reload: Function) => Promise<any>;
17
17
  customSubmit?: JSX.Element;
18
18
  widthStats: WidthStats;
19
19
  internal: boolean;
@@ -43,7 +43,7 @@ function MaterialSection(_a) {
43
43
  return _jsx("div", {}, idStep);
44
44
  }
45
45
  else if (step) {
46
- return (_createElement(StepComponent, __assign({}, others, { widthStats: widthStats, form: form, step: step, key: idStep, level: 0 })));
46
+ return (_createElement(StepComponent, __assign({}, others, { globalEditable: others.editable, widthStats: widthStats, form: form, step: step, key: idStep, level: 0 })));
47
47
  }
48
48
  else {
49
49
  console.error('Step not found:', idStep);
@@ -9,7 +9,7 @@ export interface RecursiveData {
9
9
  organization: Organization;
10
10
  control: Control<FieldValues, object>;
11
11
  formStyle: FormStyle;
12
- /** If the formsteps can be edited (For entities) */
12
+ /** If the formsteps can be edited (For internal) */
13
13
  editable: boolean;
14
14
  postview: boolean;
15
15
  partial: boolean;
@@ -30,10 +30,11 @@ function MapperElementComponent(_a) {
30
30
  return _jsx("div", {});
31
31
  }
32
32
  return (_jsx(PillElementContainer, __assign({ handleDelete: handleDelete }, others, { step: step, size: form.size }, { children: step.rootSteps.map(function (idSubStep) {
33
+ var _a;
33
34
  var subStep = form.steps[element.ids[idSubStep]];
34
35
  if (!subStep)
35
36
  return _jsx("div", {});
36
- return (_createElement(StepComponent, __assign({}, others, { form: form, step: subStep, key: idSubStep, level: level + 1 })));
37
+ return (_createElement(StepComponent, __assign({}, others, { globalEditable: others.editable ? (_a = step.editable) !== null && _a !== void 0 ? _a : true : false, form: form, step: subStep, key: idSubStep, level: level + 1 })));
37
38
  }) })));
38
39
  }
39
40
  export default MapperElementComponent;
@@ -5,6 +5,7 @@ export interface StepProps extends RecursiveData {
5
5
  step: FormStep;
6
6
  handleSizeChange?: Function;
7
7
  level: number;
8
+ globalEditable: boolean;
8
9
  }
9
10
  declare function StepComponent({ step, ...props }: StepProps): JSX.Element;
10
11
  export default StepComponent;
@@ -38,51 +38,52 @@ import EntityValuePickerStep from './EntityValueStep/EntityValueStep';
38
38
  import MapperStep from './MapperStep/MapperStep';
39
39
  import CollapsibleStep from './CollapsibleStep/CollapsibleStep';
40
40
  function StepComponent(_a) {
41
- var _b;
41
+ var _b, _c;
42
42
  var step = _a.step, props = __rest(_a, ["step"]);
43
43
  var customStep = props.customSteps[step.type];
44
+ var editable = props.globalEditable ? (_b = step.editable) !== null && _b !== void 0 ? _b : true : false;
44
45
  if (customStep) {
45
- return customStep.component(__assign(__assign({ step: step }, props), ((_b = customStep.componentProps) !== null && _b !== void 0 ? _b : {})));
46
+ return customStep.component(__assign(__assign(__assign({}, props), ((_c = customStep.componentProps) !== null && _c !== void 0 ? _c : {})), { step: step, editable: editable }));
46
47
  }
47
48
  switch (step.type) {
48
49
  case Types.TITLE: {
49
- return _jsx(TitleStep, __assign({ step: step }, props));
50
+ return (_jsx(TitleStep, __assign({}, props, { step: step, editable: editable })));
50
51
  }
51
52
  case Types.SELECTOR: {
52
- return _jsx(SelectorStep, __assign({ step: step }, props));
53
+ return (_jsx(SelectorStep, __assign({}, props, { step: step, editable: editable })));
53
54
  }
54
55
  case Types.CHECKBOX: {
55
- return _jsx(CheckBoxStep, __assign({ step: step }, props));
56
+ return (_jsx(CheckBoxStep, __assign({}, props, { step: step, editable: editable })));
56
57
  }
57
58
  case Types.CLASSIFIER_SELECTOR: {
58
- return (_jsx(ClassifierSelectorStep, __assign({ step: step }, props)));
59
+ return (_jsx(ClassifierSelectorStep, __assign({}, props, { step: step, editable: editable })));
59
60
  }
60
61
  case Types.TEXTAREA: {
61
- return _jsx(TextAreaStep, __assign({ step: step }, props));
62
+ return (_jsx(TextAreaStep, __assign({}, props, { step: step, editable: editable })));
62
63
  }
63
64
  case Types.TEXTINPUT: {
64
- return _jsx(TextInputStep, __assign({ step: step }, props));
65
+ return (_jsx(TextInputStep, __assign({}, props, { step: step, editable: editable })));
65
66
  }
66
67
  case Types.DATEPICKER: {
67
- return _jsx(DatePickerStep, __assign({ step: step }, props));
68
+ return (_jsx(DatePickerStep, __assign({}, props, { step: step, editable: editable })));
68
69
  }
69
70
  case Types.SEPARATOR: {
70
- return _jsx(SeparatorStep, __assign({ step: step }, props));
71
+ return (_jsx(SeparatorStep, __assign({}, props, { step: step, editable: editable })));
71
72
  }
72
73
  case Types.FILEUPLOAD: {
73
- return _jsx(FileUploadStep, __assign({ step: step }, props));
74
+ return (_jsx(FileUploadStep, __assign({}, props, { step: step, editable: editable })));
74
75
  }
75
76
  case Types.RATING: {
76
- return _jsx(RatingStep, __assign({ step: step }, props));
77
+ return (_jsx(RatingStep, __assign({}, props, { step: step, editable: editable })));
77
78
  }
78
79
  case Types.COLLAPSIBLE: {
79
- return _jsx(CollapsibleStep, __assign({ step: step }, props));
80
+ return (_jsx(CollapsibleStep, __assign({}, props, { step: step, editable: editable })));
80
81
  }
81
82
  case Types.ENTITYVALUEPICKER: {
82
- return (_jsx(EntityValuePickerStep, __assign({ step: step }, props)));
83
+ return (_jsx(EntityValuePickerStep, __assign({}, props, { step: step, editable: editable })));
83
84
  }
84
85
  case Types.MAPPER: {
85
- return _jsx(MapperStep, __assign({ step: step }, props));
86
+ return (_jsx(MapperStep, __assign({}, props, { step: step, editable: editable })));
86
87
  }
87
88
  default:
88
89
  break;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version":"1.9.54-test",
4
+ "version":"1.9.55-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",