@formio/js 5.1.0-rc.1 → 5.1.0-rc.11

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.
Files changed (106) hide show
  1. package/dist/formio.builder.css +22 -24
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.js +1 -1
  4. package/dist/formio.embed.min.js +1 -1
  5. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  6. package/dist/formio.form.css +22 -24
  7. package/dist/formio.form.js +36 -36
  8. package/dist/formio.form.min.css +1 -1
  9. package/dist/formio.form.min.js +1 -1
  10. package/dist/formio.form.min.js.LICENSE.txt +3 -3
  11. package/dist/formio.full.css +22 -24
  12. package/dist/formio.full.js +36 -36
  13. package/dist/formio.full.min.css +1 -1
  14. package/dist/formio.full.min.js +1 -1
  15. package/dist/formio.full.min.js.LICENSE.txt +3 -3
  16. package/dist/formio.js +21 -21
  17. package/dist/formio.min.js +1 -1
  18. package/dist/formio.min.js.LICENSE.txt +1 -1
  19. package/dist/formio.utils.js +18 -18
  20. package/dist/formio.utils.min.js +1 -1
  21. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  22. package/lib/cjs/Embed.js +1 -1
  23. package/lib/cjs/Formio.js +1 -1
  24. package/lib/cjs/Webform.d.ts +1 -1
  25. package/lib/cjs/Wizard.js +1 -1
  26. package/lib/cjs/components/_classes/component/Component.d.ts +15 -0
  27. package/lib/cjs/components/_classes/component/Component.js +51 -17
  28. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -2
  29. package/lib/cjs/components/_classes/field/Field.d.ts +2 -2
  30. package/lib/cjs/components/_classes/field/Field.js +1 -1
  31. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -1
  32. package/lib/cjs/components/_classes/nested/NestedComponent.js +16 -7
  33. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  34. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +3 -0
  35. package/lib/cjs/components/address/Address.d.ts +1 -2
  36. package/lib/cjs/components/address/Address.js +1 -1
  37. package/lib/cjs/components/address/fixtures/comp5.d.ts +46 -0
  38. package/lib/cjs/components/address/fixtures/comp5.js +87 -0
  39. package/lib/cjs/components/address/fixtures/index.d.ts +2 -1
  40. package/lib/cjs/components/address/fixtures/index.js +3 -1
  41. package/lib/cjs/components/button/Button.d.ts +1 -1
  42. package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
  43. package/lib/cjs/components/columns/Columns.d.ts +1 -1
  44. package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -1
  45. package/lib/cjs/components/datagrid/DataGrid.js +4 -1
  46. package/lib/cjs/components/datamap/DataMap.js +1 -1
  47. package/lib/cjs/components/day/Day.d.ts +1 -1
  48. package/lib/cjs/components/day/Day.js +2 -18
  49. package/lib/cjs/components/editgrid/EditGrid.js +2 -5
  50. package/lib/cjs/components/file/File.d.ts +1 -1
  51. package/lib/cjs/components/form/Form.d.ts +1 -0
  52. package/lib/cjs/components/form/Form.js +30 -14
  53. package/lib/cjs/components/html/HTML.js +15 -3
  54. package/lib/cjs/components/radio/Radio.d.ts +1 -1
  55. package/lib/cjs/components/select/Select.d.ts +1 -1
  56. package/lib/cjs/components/survey/Survey.d.ts +1 -1
  57. package/lib/cjs/components/table/Table.d.ts +1 -1
  58. package/lib/cjs/components/tabs/Tabs.d.ts +1 -1
  59. package/lib/cjs/formio.embed.d.ts +1 -1
  60. package/lib/cjs/formio.embed.js +3 -0
  61. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +5 -0
  62. package/lib/cjs/providers/address/GoogleAddressProvider.js +23 -1
  63. package/lib/cjs/translations/en.js +2 -2
  64. package/lib/mjs/Embed.js +1 -1
  65. package/lib/mjs/Formio.js +1 -1
  66. package/lib/mjs/Webform.d.ts +1 -1
  67. package/lib/mjs/Wizard.js +1 -1
  68. package/lib/mjs/components/_classes/component/Component.d.ts +15 -0
  69. package/lib/mjs/components/_classes/component/Component.js +51 -17
  70. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -2
  71. package/lib/mjs/components/_classes/field/Field.d.ts +2 -2
  72. package/lib/mjs/components/_classes/field/Field.js +1 -1
  73. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -1
  74. package/lib/mjs/components/_classes/nested/NestedComponent.js +16 -7
  75. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  76. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +3 -0
  77. package/lib/mjs/components/address/Address.d.ts +1 -2
  78. package/lib/mjs/components/address/Address.js +1 -1
  79. package/lib/mjs/components/address/fixtures/comp5.d.ts +46 -0
  80. package/lib/mjs/components/address/fixtures/comp5.js +85 -0
  81. package/lib/mjs/components/address/fixtures/index.d.ts +2 -1
  82. package/lib/mjs/components/address/fixtures/index.js +2 -1
  83. package/lib/mjs/components/button/Button.d.ts +1 -1
  84. package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
  85. package/lib/mjs/components/columns/Columns.d.ts +1 -1
  86. package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -1
  87. package/lib/mjs/components/datagrid/DataGrid.js +4 -1
  88. package/lib/mjs/components/datamap/DataMap.js +1 -1
  89. package/lib/mjs/components/day/Day.d.ts +1 -1
  90. package/lib/mjs/components/day/Day.js +2 -18
  91. package/lib/mjs/components/editgrid/EditGrid.js +2 -5
  92. package/lib/mjs/components/file/File.d.ts +1 -1
  93. package/lib/mjs/components/form/Form.d.ts +1 -0
  94. package/lib/mjs/components/form/Form.js +29 -14
  95. package/lib/mjs/components/html/HTML.js +15 -3
  96. package/lib/mjs/components/radio/Radio.d.ts +1 -1
  97. package/lib/mjs/components/select/Select.d.ts +1 -1
  98. package/lib/mjs/components/survey/Survey.d.ts +1 -1
  99. package/lib/mjs/components/table/Table.d.ts +1 -1
  100. package/lib/mjs/components/tabs/Tabs.d.ts +1 -1
  101. package/lib/mjs/formio.embed.d.ts +1 -1
  102. package/lib/mjs/formio.embed.js +1 -0
  103. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +5 -0
  104. package/lib/mjs/providers/address/GoogleAddressProvider.js +22 -1
  105. package/lib/mjs/translations/en.js +2 -2
  106. package/package.json +4 -4
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */
22
22
 
23
- /*! formiojs v5.1.0-rc.1 | https://unpkg.com/formiojs@5.1.0-rc.1/LICENSE.txt */
23
+ /*! formiojs v5.1.0-rc.11 | https://unpkg.com/formiojs@5.1.0-rc.11/LICENSE.txt */
24
24
 
25
25
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
26
26
 
package/lib/cjs/Embed.js CHANGED
@@ -418,7 +418,7 @@ Formio.formioReady = new Promise((ready, reject) => {
418
418
  _a._formioReady = ready;
419
419
  _a._formioReadyReject = reject;
420
420
  });
421
- Formio.version = 'FORMIO_VERSION';
421
+ Formio.version = '5.1.0-rc.11';
422
422
  // Create a report.
423
423
  Formio.Report = {
424
424
  create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
package/lib/cjs/Formio.js CHANGED
@@ -11,7 +11,7 @@ const CDN_1 = __importDefault(require("./CDN"));
11
11
  const providers_1 = __importDefault(require("./providers"));
12
12
  sdk_1.Formio.cdn = new CDN_1.default();
13
13
  sdk_1.Formio.Providers = providers_1.default;
14
- sdk_1.Formio.version = 'FORMIO_VERSION';
14
+ sdk_1.Formio.version = '5.1.0-rc.11';
15
15
  CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
16
16
  const isNil = (val) => val === null || val === undefined;
17
17
  sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
@@ -363,7 +363,7 @@ declare class Webform extends NestedDataComponent {
363
363
  executeFormController(): false | undefined;
364
364
  build(element: any): Promise<any>;
365
365
  getClassName(): string;
366
- render(): import("./components/_classes/field/Field").default;
366
+ render(): string;
367
367
  redraw(): Promise<void> | Promise<boolean>;
368
368
  attach(element: any): Promise<boolean>;
369
369
  hasRequiredFields(): boolean;
package/lib/cjs/Wizard.js CHANGED
@@ -667,7 +667,7 @@ class Wizard extends Webform_1.default {
667
667
  return this.page - 1;
668
668
  }
669
669
  beforeSubmit() {
670
- const pages = this.getPages();
670
+ const pages = this.getPages({ all: true });
671
671
  return Promise.all(pages.map((page) => {
672
672
  page.options.beforeSubmit = true;
673
673
  return page.beforeSubmit();
@@ -119,6 +119,13 @@ declare class Component extends Element {
119
119
  */
120
120
  paths: import('@formio/core').ComponentPaths;
121
121
  _path: string;
122
+ /**
123
+ * Determines if this component is conditionally hidden. Should generally not be set outside of conditional logic pipeline.
124
+ * This is necessary because of clearOnHide behavior that only clears when conditionally hidden - we need to track
125
+ * conditionallyHidden separately from "regular" visibility.
126
+ */
127
+ _parentConditionallyHidden: any;
128
+ _conditionallyHidden: any;
122
129
  /**
123
130
  * Determines if this component is visible, or not.
124
131
  */
@@ -224,6 +231,14 @@ declare class Component extends Element {
224
231
  * @returns {boolean} - Whether the component is visible or not.
225
232
  */
226
233
  get visible(): boolean;
234
+ get conditionallyHidden(): any;
235
+ /**
236
+ * Evaluates whether the component is conditionally hidden (as opposed to intentionally hidden, e.g. via the `hidden` component schema property).
237
+ * @param {object} data - The data object to evaluate the condition against.
238
+ * @param {object} row - The row object to evaluate the condition against.
239
+ * @returns {boolean} - Whether the component is conditionally hidden.
240
+ */
241
+ checkConditionallyHidden(data?: object, row?: object): boolean;
227
242
  set currentForm(instance: any);
228
243
  get currentForm(): any;
229
244
  _currentForm: any;
@@ -341,11 +341,18 @@ class Component extends Element_1.default {
341
341
  this._path = '';
342
342
  // Needs for Nextgen Rules Engine
343
343
  this.resetCaches();
344
+ /**
345
+ * Determines if this component is conditionally hidden. Should generally not be set outside of conditional logic pipeline.
346
+ * This is necessary because of clearOnHide behavior that only clears when conditionally hidden - we need to track
347
+ * conditionallyHidden separately from "regular" visibility.
348
+ */
349
+ this._parentConditionallyHidden = this.options.hasOwnProperty('parentConditionallyHidden') ? this.options.parentConditionallyHidden : false;
350
+ this._conditionallyHidden = this.checkConditionallyHidden(null, data) || this._parentConditionallyHidden;
344
351
  /**
345
352
  * Determines if this component is visible, or not.
346
353
  */
347
354
  this._parentVisible = this.options.hasOwnProperty('parentVisible') ? this.options.parentVisible : true;
348
- this._visible = this._parentVisible && this.conditionallyVisible(null, data);
355
+ this._visible = this._parentVisible && (this.hasCondition() ? !this._conditionallyHidden : !this.component.hidden);
349
356
  this._parentDisabled = false;
350
357
  /**
351
358
  * The reference attribute name for this component
@@ -414,7 +421,7 @@ class Component extends Element_1.default {
414
421
  if (this.allowData && this.key) {
415
422
  this.options.name += `[${this.key}]`;
416
423
  // If component is visible or not set to clear on hide, set the default value.
417
- if (this.visible || !this.component.clearOnHide) {
424
+ if (!(this.conditionallyHidden && this.component.clearOnHide)) {
418
425
  if (!this.hasValue()) {
419
426
  if (this.shouldAddDefaultValue) {
420
427
  this.dataValue = this.defaultValue;
@@ -485,7 +492,8 @@ class Component extends Element_1.default {
485
492
  init() {
486
493
  var _a;
487
494
  this.disabled = this.shouldDisabled;
488
- this._visible = this.conditionallyVisible(null, null);
495
+ this._conditionallyHidden = this.checkConditionallyHidden();
496
+ this._visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
489
497
  if ((_a = this.component.addons) === null || _a === void 0 ? void 0 : _a.length) {
490
498
  this.component.addons.forEach((addon) => this.createAddon(addon));
491
499
  }
@@ -627,7 +635,6 @@ class Component extends Element_1.default {
627
635
  return;
628
636
  }
629
637
  this._visible = value;
630
- this.clearOnHide();
631
638
  this.redraw();
632
639
  }
633
640
  }
@@ -648,6 +655,21 @@ class Component extends Element_1.default {
648
655
  }
649
656
  return this._visible && this._parentVisible;
650
657
  }
658
+ get conditionallyHidden() {
659
+ return this._conditionallyHidden || this._parentConditionallyHidden;
660
+ }
661
+ /**
662
+ * Evaluates whether the component is conditionally hidden (as opposed to intentionally hidden, e.g. via the `hidden` component schema property).
663
+ * @param {object} data - The data object to evaluate the condition against.
664
+ * @param {object} row - The row object to evaluate the condition against.
665
+ * @returns {boolean} - Whether the component is conditionally hidden.
666
+ */
667
+ checkConditionallyHidden(data = null, row = null) {
668
+ if (!this.hasCondition()) {
669
+ return false;
670
+ }
671
+ return !this.conditionallyVisible(data, row);
672
+ }
651
673
  get currentForm() {
652
674
  return this._currentForm;
653
675
  }
@@ -1264,7 +1286,7 @@ class Component extends Element_1.default {
1264
1286
  detach() {
1265
1287
  // First iterate through each ref and delete the component so there are no dangling component references.
1266
1288
  lodash_1.default.each(this.refs, (ref) => {
1267
- if (typeof ref === NodeList) {
1289
+ if (ref instanceof NodeList) {
1268
1290
  ref.forEach((elem) => {
1269
1291
  delete elem.component;
1270
1292
  });
@@ -1816,7 +1838,7 @@ class Component extends Element_1.default {
1816
1838
  rebuild() {
1817
1839
  this.destroy();
1818
1840
  this.init();
1819
- this.visible = this.conditionallyVisible(null, null);
1841
+ this.visible = this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden;
1820
1842
  return this.redraw();
1821
1843
  }
1822
1844
  /**
@@ -1883,8 +1905,8 @@ class Component extends Element_1.default {
1883
1905
  conditionallyVisible(data, row) {
1884
1906
  data = data || this.rootValue;
1885
1907
  row = row || this.data;
1886
- if (this.builderMode || this.previewMode || !this.hasCondition()) {
1887
- return !this.component.hidden;
1908
+ if (this.builderMode || this.previewMode) {
1909
+ return true;
1888
1910
  }
1889
1911
  data = data || (this.root ? this.root.data : {});
1890
1912
  return this.checkCondition(row, data);
@@ -1914,8 +1936,14 @@ class Component extends Element_1.default {
1914
1936
  if (!this.builderMode & !this.previewMode && this.fieldLogic(data, row)) {
1915
1937
  this.redraw();
1916
1938
  }
1917
- // Check advanced conditions
1918
- const visible = this.conditionallyVisible(data, row);
1939
+ // Check advanced conditions (and cache the result)
1940
+ const isConditionallyHidden = this.checkConditionallyHidden(data, row) || this._parentConditionallyHidden;
1941
+ if (isConditionallyHidden !== this._conditionallyHidden) {
1942
+ this._conditionallyHidden = isConditionallyHidden;
1943
+ this.clearOnHide();
1944
+ }
1945
+ // Check visibility
1946
+ const visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
1919
1947
  if (this.visible !== visible) {
1920
1948
  this.visible = visible;
1921
1949
  }
@@ -2025,6 +2053,12 @@ class Component extends Element_1.default {
2025
2053
  FormioUtils.setActionProperty(newComponent, action, result, row, data, this);
2026
2054
  const property = action.property.value;
2027
2055
  if (!lodash_1.default.isEqual(lodash_1.default.get(this.component, property), lodash_1.default.get(newComponent, property))) {
2056
+ // Advanced Logic can modify the component's hidden property; because we track conditionally hidden state
2057
+ // separately from the component's hidden property, and technically this Advanced Logic conditionally hides
2058
+ // a component, we need to set _conditionallyHidden to the new value
2059
+ if (property === 'hidden') {
2060
+ this._conditionallyHidden = newComponent.hidden;
2061
+ }
2028
2062
  changed = true;
2029
2063
  }
2030
2064
  break;
@@ -2038,7 +2072,7 @@ class Component extends Element_1.default {
2038
2072
  component: newComponent,
2039
2073
  result,
2040
2074
  });
2041
- if (!lodash_1.default.isEqual(oldValue, newValue) && !(this.component.clearOnHide && !this.visible)) {
2075
+ if (!lodash_1.default.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden)) {
2042
2076
  this.setValue(newValue);
2043
2077
  if (this.viewOnly) {
2044
2078
  this.dataValue = newValue;
@@ -2071,7 +2105,7 @@ class Component extends Element_1.default {
2071
2105
  component: newComponent,
2072
2106
  result,
2073
2107
  }, 'value');
2074
- if (!lodash_1.default.isEqual(oldValue, newValue) && !(this.component.clearOnHide && !this.visible)) {
2108
+ if (!lodash_1.default.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden)) {
2075
2109
  this.setValue(newValue);
2076
2110
  if (this.viewOnly) {
2077
2111
  this.dataValue = newValue;
@@ -2182,7 +2216,7 @@ class Component extends Element_1.default {
2182
2216
  this.component.clearOnHide !== false &&
2183
2217
  !this.options.readOnly &&
2184
2218
  !this.options.showHiddenFields) {
2185
- if (!this.visible) {
2219
+ if (this.conditionallyHidden) {
2186
2220
  this.deleteValue();
2187
2221
  }
2188
2222
  else if (!this.hasValue() && this.shouldAddDefaultValue) {
@@ -2432,7 +2466,7 @@ class Component extends Element_1.default {
2432
2466
  */
2433
2467
  get dataValue() {
2434
2468
  if (!this.key ||
2435
- (!this.visible && this.component.clearOnHide && !this.rootPristine)) {
2469
+ (this.conditionallyHidden && this.component.clearOnHide && !this.rootPristine)) {
2436
2470
  return this.emptyValue;
2437
2471
  }
2438
2472
  if (!this.hasValue() && this.shouldAddDefaultValue) {
@@ -2451,7 +2485,7 @@ class Component extends Element_1.default {
2451
2485
  set dataValue(value) {
2452
2486
  if (!this.allowData ||
2453
2487
  !this.key ||
2454
- (!this.visible && this.component.clearOnHide && !this.rootPristine)) {
2488
+ (this.conditionallyHidden && this.component.clearOnHide && !this.rootPristine)) {
2455
2489
  return;
2456
2490
  }
2457
2491
  if ((value !== null) && (value !== undefined)) {
@@ -2772,7 +2806,7 @@ class Component extends Element_1.default {
2772
2806
  // If no calculated value or
2773
2807
  // hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)
2774
2808
  const { clearOnHide } = this.component;
2775
- const shouldBeCleared = !this.visible && clearOnHide;
2809
+ const shouldBeCleared = this.conditionallyHidden && clearOnHide;
2776
2810
  const allowOverride = lodash_1.default.get(this.component, 'allowCalculateOverride', false);
2777
2811
  if (shouldBeCleared) {
2778
2812
  // remove calculated value so that the value is recalculated once component becomes visible
@@ -3422,7 +3456,7 @@ class Component extends Element_1.default {
3422
3456
  // If component definition changed, replace it.
3423
3457
  if (!lodash_1.default.isEqual(this.component, newComponent)) {
3424
3458
  this.component = newComponent;
3425
- const visible = this.conditionallyVisible(null, null);
3459
+ const visible = this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden;
3426
3460
  const disabled = this.shouldDisabled;
3427
3461
  // Change states which won't be recalculated during redrawing
3428
3462
  if (this.visible !== visible) {
@@ -133,10 +133,10 @@ exports.default = [
133
133
  {
134
134
  weight: 700,
135
135
  type: 'checkbox',
136
- label: 'Clear Value When Hidden',
136
+ label: 'Omit Value From Submission Data When Conditionally Hidden',
137
137
  key: 'clearOnHide',
138
138
  defaultValue: true,
139
- tooltip: 'When a field is hidden, clear the value.',
139
+ tooltip: 'When a field is conditionally hidden, omit the value from the submission data.',
140
140
  input: true
141
141
  },
142
142
  utils_1.default.javaScriptValue('Custom Default Value', 'customDefaultValue', 'customDefaultValue', 1000, '<p><h4>Example:</h4><pre>value = data.firstName + " " + data.lastName;</pre></p>', '<p><h4>Example:</h4><pre>{"cat": [{"var": "data.firstName"}, " ", {"var": "data.lastName"}]}</pre>'),
@@ -1,9 +1,9 @@
1
1
  export default class Field extends Component {
2
2
  /**
3
3
  * @param {object} element - The component to create.
4
- * @returns {Field} - The created field.
4
+ * @returns {string} - The rendered HTML string of a component
5
5
  */
6
- render(element: object): Field;
6
+ render(element: object): string;
7
7
  /**
8
8
  /* Saves current caret position to restore it after the component is redrawn
9
9
  * @param {HTMLElement} element - The element to save the caret position for.
@@ -11,7 +11,7 @@ const Component_1 = __importDefault(require("../component/Component"));
11
11
  class Field extends Component_1.default {
12
12
  /**
13
13
  * @param {object} element - The component to create.
14
- * @returns {Field} - The created field.
14
+ * @returns {string} - The rendered HTML string of a component
15
15
  */
16
16
  render(element) {
17
17
  if (this.noField) {
@@ -146,7 +146,7 @@ export default class NestedComponent extends Field {
146
146
  */
147
147
  addComponent(component: import('@formio/core').Component, data?: object, before?: HTMLElement, noAdd?: boolean | undefined): any;
148
148
  beforeFocus(): void;
149
- render(children: any): Field;
149
+ render(children: any): string;
150
150
  renderComponents(components: any): any;
151
151
  attach(element: any): Promise<[void, void]>;
152
152
  /**
@@ -85,17 +85,26 @@ class NestedComponent extends Field_1.default {
85
85
  const visibilityChanged = this._visible !== value;
86
86
  this._visible = value;
87
87
  const isVisible = this.visible;
88
+ const isConditionallyHidden = this.checkConditionallyHidden();
88
89
  const forceShow = this.shouldForceShow();
89
90
  const forceHide = this.shouldForceHide();
90
- this.components.forEach(component => {
91
+ this.components.forEach((component) => {
91
92
  // Set the parent visibility first since we may have nested components within nested components
92
93
  // and they need to be able to determine their visibility based on the parent visibility.
93
94
  component.parentVisible = isVisible;
94
- const conditionallyVisible = component.conditionallyVisible();
95
- if (forceShow || conditionallyVisible) {
95
+ component._parentConditionallyHidden = isConditionallyHidden;
96
+ let visible;
97
+ if (component.hasCondition()) {
98
+ component._conditionallyHidden = component.checkConditionallyHidden() || component._parentConditionallyHidden;
99
+ visible = !component.conditionallyHidden;
100
+ }
101
+ else {
102
+ visible = !component.component.hidden;
103
+ }
104
+ if (forceShow || visible) {
96
105
  component.visible = true;
97
106
  }
98
- else if (forceHide || !isVisible || !conditionallyVisible) {
107
+ else if (forceHide || !isVisible || !visible) {
99
108
  component.visible = false;
100
109
  }
101
110
  // If hiding a nested component, clear all errors below.
@@ -104,7 +113,6 @@ class NestedComponent extends Field_1.default {
104
113
  }
105
114
  });
106
115
  if (visibilityChanged) {
107
- this.clearOnHide();
108
116
  this.redraw();
109
117
  }
110
118
  }
@@ -369,6 +377,7 @@ class NestedComponent extends Field_1.default {
369
377
  data = data || this.data;
370
378
  options.parent = this;
371
379
  options.parentVisible = this.visible;
380
+ options.parentConditionallyHidden = this.conditionallyHidden;
372
381
  options.root = (options === null || options === void 0 ? void 0 : options.root) || this.root || this;
373
382
  options.localRoot = this.localRoot;
374
383
  options.skipInit = true;
@@ -627,7 +636,7 @@ class NestedComponent extends Field_1.default {
627
636
  clearOnHide(show) {
628
637
  super.clearOnHide(show);
629
638
  if (this.component.clearOnHide) {
630
- if (this.allowData && !this.hasValue() && !(this.options.server && !this.visible)) {
639
+ if (this.allowData && !this.hasValue() && !this.conditionallyHidden) {
631
640
  this.dataValue = this.defaultValue;
632
641
  }
633
642
  if (this.hasValue()) {
@@ -656,7 +665,7 @@ class NestedComponent extends Field_1.default {
656
665
  }
657
666
  calculateValue(data, flags, row) {
658
667
  // Do not iterate into children and calculateValues if this nested component is conditionally hidden.
659
- if (!this.conditionallyVisible()) {
668
+ if (this.conditionallyHidden) {
660
669
  return false;
661
670
  }
662
671
  return this.getComponents().reduce((changed, comp) => comp.calculateValue(data, flags, row) || changed, super.calculateValue(data, flags, row));
@@ -3,6 +3,7 @@ export default class NestedDataComponent extends NestedComponent {
3
3
  hasChanged(newValue: any, oldValue: any): boolean;
4
4
  get allowData(): boolean;
5
5
  get emptyValue(): {};
6
+ get shouldAddDefaultValue(): boolean;
6
7
  componentContext(): any;
7
8
  getValueAsString(value: any, options: any): string;
8
9
  getDataValueAsTable(value: any, options: any): string;
@@ -26,6 +26,9 @@ class NestedDataComponent extends NestedComponent_1.default {
26
26
  get emptyValue() {
27
27
  return {};
28
28
  }
29
+ get shouldAddDefaultValue() {
30
+ return !this.options.noDefaults || !this.options.server;
31
+ }
29
32
  componentContext() {
30
33
  return this.dataValue;
31
34
  }
@@ -60,7 +60,7 @@ export default class AddressComponent extends ContainerComponent {
60
60
  renderElement(value: any): any;
61
61
  renderRow(value: any, index: any): any;
62
62
  renderGrid(): any;
63
- render(): Field;
63
+ render(): string;
64
64
  onSelectAddress(address: any, element: any, index: any): void;
65
65
  addRow(): void;
66
66
  attach(element: any): Promise<void>;
@@ -71,4 +71,3 @@ export default class AddressComponent extends ContainerComponent {
71
71
  getValueAsString(value: any, options: any): any;
72
72
  }
73
73
  import ContainerComponent from '../container/Container';
74
- import Field from '../_classes/field/Field';
@@ -218,7 +218,7 @@ class AddressComponent extends Container_1.default {
218
218
  super.dataValue = value;
219
219
  }
220
220
  get dataValue() {
221
- const resultValue = lodash_1.default.get(this._data, this.component.path);
221
+ const resultValue = lodash_1.default.get(this._data, this.path);
222
222
  if (!lodash_1.default.isArray(resultValue) && this.component.multiple) {
223
223
  return [resultValue];
224
224
  }
@@ -0,0 +1,46 @@
1
+ declare namespace _default {
2
+ let type: string;
3
+ let display: string;
4
+ let title: string;
5
+ let name: string;
6
+ let path: string;
7
+ let components: ({
8
+ label: string;
9
+ tableView: boolean;
10
+ multiple: boolean;
11
+ provider: string;
12
+ validateWhenHidden: boolean;
13
+ key: string;
14
+ providerOptions: {
15
+ params: {
16
+ autocompleteOptions: {};
17
+ };
18
+ };
19
+ type: string;
20
+ input: boolean;
21
+ components: {
22
+ label: string;
23
+ tableView: boolean;
24
+ key: string;
25
+ type: string;
26
+ input: boolean;
27
+ customConditional: string;
28
+ }[];
29
+ defaultValue: {}[];
30
+ disableOnInvalid?: undefined;
31
+ } | {
32
+ type: string;
33
+ label: string;
34
+ key: string;
35
+ disableOnInvalid: boolean;
36
+ input: boolean;
37
+ tableView: boolean;
38
+ multiple?: undefined;
39
+ provider?: undefined;
40
+ validateWhenHidden?: undefined;
41
+ providerOptions?: undefined;
42
+ components?: undefined;
43
+ defaultValue?: undefined;
44
+ })[];
45
+ }
46
+ export default _default;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ type: 'form',
5
+ display: 'form',
6
+ title: 'FIO-9527',
7
+ name: 'fio9527',
8
+ path: 'fio9527',
9
+ components: [
10
+ {
11
+ label: 'Address',
12
+ tableView: false,
13
+ multiple: true,
14
+ provider: 'nominatim',
15
+ validateWhenHidden: false,
16
+ key: 'address',
17
+ providerOptions: {
18
+ params: {
19
+ autocompleteOptions: {}
20
+ }
21
+ },
22
+ type: 'address',
23
+ input: true,
24
+ components: [
25
+ {
26
+ label: 'Address 1',
27
+ tableView: false,
28
+ key: 'address1',
29
+ type: 'textfield',
30
+ input: true,
31
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
32
+ },
33
+ {
34
+ label: 'Address 2',
35
+ tableView: false,
36
+ key: 'address2',
37
+ type: 'textfield',
38
+ input: true,
39
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
40
+ },
41
+ {
42
+ label: 'City',
43
+ tableView: false,
44
+ key: 'city',
45
+ type: 'textfield',
46
+ input: true,
47
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
48
+ },
49
+ {
50
+ label: 'State',
51
+ tableView: false,
52
+ key: 'state',
53
+ type: 'textfield',
54
+ input: true,
55
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
56
+ },
57
+ {
58
+ label: 'Country',
59
+ tableView: false,
60
+ key: 'country',
61
+ type: 'textfield',
62
+ input: true,
63
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
64
+ },
65
+ {
66
+ label: 'Zip Code',
67
+ tableView: false,
68
+ key: 'zip',
69
+ type: 'textfield',
70
+ input: true,
71
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
72
+ }
73
+ ],
74
+ defaultValue: [
75
+ {}
76
+ ]
77
+ },
78
+ {
79
+ type: 'button',
80
+ label: 'Submit',
81
+ key: 'submit',
82
+ disableOnInvalid: true,
83
+ input: true,
84
+ tableView: false
85
+ }
86
+ ]
87
+ };
@@ -2,4 +2,5 @@ import comp1 from './comp1';
2
2
  import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
- export { comp1, comp2, comp3, comp4 };
5
+ import comp5 from './comp5';
6
+ export { comp1, comp2, comp3, comp4, comp5 };
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
7
7
  const comp1_1 = __importDefault(require("./comp1"));
8
8
  exports.comp1 = comp1_1.default;
9
9
  const comp2_1 = __importDefault(require("./comp2"));
@@ -12,3 +12,5 @@ const comp3_1 = __importDefault(require("./comp3"));
12
12
  exports.comp3 = comp3_1.default;
13
13
  const comp4_1 = __importDefault(require("./comp4"));
14
14
  exports.comp4 = comp4_1.default;
15
+ const comp5_1 = __importDefault(require("./comp5"));
16
+ exports.comp5 = comp5_1.default;
@@ -21,7 +21,7 @@ export default class ButtonComponent extends Field {
21
21
  get clicked(): any;
22
22
  get defaultValue(): boolean;
23
23
  get oauthConfig(): any;
24
- render(): Field;
24
+ render(): string;
25
25
  attachButton(): void;
26
26
  hasError: boolean | undefined;
27
27
  isDisabledOnInvalid: any;
@@ -39,7 +39,7 @@ export default class CheckBoxComponent extends Field {
39
39
  get labelInfo(): {
40
40
  hidden: boolean;
41
41
  };
42
- render(): Field;
42
+ render(): string;
43
43
  attach(element: any): Promise<void>;
44
44
  input: any;
45
45
  detach(element: any): void;
@@ -14,7 +14,7 @@ export default class ColumnsComponent extends NestedComponent {
14
14
  get columnKey(): string;
15
15
  columns: any[] | undefined;
16
16
  labelIsHidden(): boolean;
17
- render(): import("../_classes/field/Field").default;
17
+ render(): string;
18
18
  justifyColumn(items: any, index: any): boolean;
19
19
  justify(): any;
20
20
  get gridSize(): number;
@@ -54,7 +54,7 @@ export default class DataGridComponent extends NestedArrayComponent {
54
54
  hasTopSubmit(): any;
55
55
  hasBottomSubmit(): any;
56
56
  get canAddColumn(): boolean;
57
- render(): import("../_classes/field/Field").default;
57
+ render(): string;
58
58
  getRows(): {}[];
59
59
  getColumns(): any[];
60
60
  hasHeader(): any;
@@ -396,7 +396,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
396
396
  row
397
397
  });
398
398
  this.checkConditions();
399
- this.triggerChange();
399
+ this.triggerChange({ modified: true });
400
400
  this.redraw().then(() => {
401
401
  this.focusOnNewRowElement(this.rows[index]);
402
402
  });
@@ -476,6 +476,9 @@ class DataGridComponent extends NestedArrayComponent_1.default {
476
476
  options.name += `[${rowIndex}]`;
477
477
  options.row = `${rowIndex}-${colIndex}`;
478
478
  options.rowIndex = rowIndex;
479
+ options.onChange = (flags, changed, modified) => {
480
+ this.triggerChange({ modified });
481
+ };
479
482
  let columnComponent;
480
483
  if (this.builderMode) {
481
484
  col.id = col.id + rowIndex;
@@ -74,7 +74,7 @@ class DataMapComponent extends DataGrid_1.default {
74
74
  }
75
75
  get dataValue() {
76
76
  if (!this.key ||
77
- (!this.visible && this.component.clearOnHide)) {
77
+ (this.conditionallyHidden && this.component.clearOnHide)) {
78
78
  return this.emptyValue;
79
79
  }
80
80
  if (!this.hasValue() && this.shouldAddDefaultValue) {