@arquimedes.co/eureka-forms 1.9.100-test → 1.9.102-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.
package/dist/App.js CHANGED
@@ -364,6 +364,7 @@ export var addInitialMapper = function (newValues, step) {
364
364
  var newElement = {
365
365
  ids: {},
366
366
  id: idElement,
367
+ originalValues: {},
367
368
  };
368
369
  var newSteps = {};
369
370
  for (var _i = 0, _a = Object.keys(step.steps); _i < _a.length; _i++) {
@@ -391,8 +392,11 @@ export var mapOriginalValue = function (step, value, newValues, form) {
391
392
  var mappedElement = {
392
393
  id: idElement,
393
394
  ids: {},
394
- value: element.value,
395
+ originalValues: {},
395
396
  };
397
+ if (element.value) {
398
+ mappedElement.value = element.value;
399
+ }
396
400
  for (var _f = 0, _g = Object.keys(step.steps); _f < _g.length; _f++) {
397
401
  var idStep = _g[_f];
398
402
  var newIdStep = step.id + '-' + idStep + '-' + idElement;
@@ -404,6 +408,12 @@ export var mapOriginalValue = function (step, value, newValues, form) {
404
408
  }
405
409
  }
406
410
  }
411
+ for (var _h = 0, _j = Object.keys(element); _h < _j.length; _h++) {
412
+ var key = _j[_h];
413
+ if (step.steps[key])
414
+ continue;
415
+ mappedElement.originalValues[key] = element[key];
416
+ }
407
417
  mappedElements.push(mappedElement);
408
418
  }
409
419
  return mappedElements;
@@ -237,10 +237,6 @@ export var calcValue = function (idStep, steps, values, customSteps, deleteIds,
237
237
  }
238
238
  else {
239
239
  switch (step === null || step === void 0 ? void 0 : step.type) {
240
- case Types.TITLE: {
241
- deleteIds.push(idStep);
242
- return null;
243
- }
244
240
  case Types.TEXTAREA: {
245
241
  if (step.hasTextEditor) {
246
242
  var currentContent = value.getCurrentContent();
@@ -276,10 +272,15 @@ export var calcValue = function (idStep, steps, values, customSteps, deleteIds,
276
272
  var element = elements_1[_i];
277
273
  var newValue = {
278
274
  id: element.id,
279
- value: element.value,
280
275
  };
281
- for (var _c = 0, _d = Object.keys(step.steps); _c < _d.length; _c++) {
282
- var idStep_1 = _d[_c];
276
+ for (var _c = 0, _d = Object.keys(element.originalValues); _c < _d.length; _c++) {
277
+ var key = _d[_c];
278
+ newValue[key] = element.originalValues[key];
279
+ }
280
+ if (element.value)
281
+ newValue.value = element.value;
282
+ for (var _e = 0, _f = Object.keys(step.steps); _e < _f.length; _e++) {
283
+ var idStep_1 = _f[_e];
283
284
  var mappedId = element.ids[idStep_1];
284
285
  if (values[mappedId] !== undefined) {
285
286
  newValue[idStep_1] = calcValue(idStep_1, step.steps, values, customSteps, deleteIds, values[mappedId]);
@@ -5,6 +5,7 @@ export interface MapperElement<Type> {
5
5
  id: string;
6
6
  deleted?: boolean;
7
7
  value?: Type;
8
+ originalValues: Record<string, any>;
8
9
  }
9
10
  export declare function ElementsComponent<Type = any>({ step, form, errors, inputRef, editable, postview, elements, formStyle, customAdd, loading, dependencyStore, setDependencyStore, ...others }: MapperStepProps<Type> & {
10
11
  loading?: boolean;
@@ -92,8 +92,10 @@ export function ElementsComponent(_a) {
92
92
  var newElement = {
93
93
  ids: {},
94
94
  id: idElement,
95
- value: value,
95
+ originalValues: {},
96
96
  };
97
+ if (value)
98
+ newElement.value = value;
97
99
  var newSteps = {};
98
100
  var newValues = {};
99
101
  for (var _i = 0, _a = Object.keys(step.steps); _i < _a.length; _i++) {
@@ -141,17 +143,16 @@ export function ElementsComponent(_a) {
141
143
  margin: step.description
142
144
  ? '10px 0px'
143
145
  : '0px 0px 5px 0px',
144
- } }, { children: step.description }))), mapElements(), _jsxs("div", __assign({ className: styles.btnContainer }, { children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }), step.creatable !== false && !customAdd && (_jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel + (step.required ? ' *' : ''), color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
146
+ } }, { children: step.description }))), mapElements(), _jsx("input", { ref: inputRef, className: styles.hiddenInput }), step.creatable !== false && (_jsxs("div", __assign({ className: styles.btnContainer }, { children: [!customAdd && (_jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel + (step.required ? ' *' : ''), color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
145
147
  if (editable && !postview) {
146
148
  handleAddElement();
147
149
  }
148
- } })), step.creatable !== false &&
149
- customAdd &&
150
+ } })), customAdd &&
150
151
  cloneElement(customAdd, {
151
152
  inputRef: inputRef,
152
153
  disabled: !editable || postview,
153
154
  handleAddElement: handleAddElement,
154
- })] })), !!errors[step.id] &&
155
+ })] }))), !!errors[step.id] &&
155
156
  elements.filter(function (elem) { return !elem.deleted; }).length === 0 && (_jsx("div", __assign({ className: styles.errorMsg, style: { color: formStyle.errorColor } }, { children: "Este campo es obligatorio" })))] })));
156
157
  }
157
158
  function MapperStep(props) {
@@ -84,7 +84,7 @@ export function SmartSelect(_a) {
84
84
  var calcDependencies = function (idStep, deps) {
85
85
  if (deps === void 0) { deps = []; }
86
86
  var step = form.steps[idStep];
87
- if (step.dependencies) {
87
+ if (step === null || step === void 0 ? void 0 : step.dependencies) {
88
88
  for (var _i = 0, _a = step.dependencies; _i < _a.length; _i++) {
89
89
  var dep = _a[_i];
90
90
  if (!deps.includes(dep)) {
@@ -26,7 +26,8 @@ import { calcStepWidth } from '../../StepFunctions';
26
26
  import styles from './MaterialTitleStep.module.css';
27
27
  function Title(_a) {
28
28
  var _b;
29
- var step = _a.step, form = _a.form, _c = _a.value, title = _c.title, description = _c.description, formStyle = _a.formStyle, widthStats = _a.widthStats;
29
+ var step = _a.step, form = _a.form, value = _a.value, formStyle = _a.formStyle, widthStats = _a.widthStats;
30
+ var _c = value !== null && value !== void 0 ? value : {}, title = _c.title, description = _c.description;
30
31
  var size = (_b = step.size) !== null && _b !== void 0 ? _b : form.size.blockNum;
31
32
  return (_jsxs("div", __assign({ className: styles.container, style: {
32
33
  color: formStyle.textColor,
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.100-test",
4
+ "version":"1.9.102-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",