@formio/js 5.0.0-dev.5664.1af299f → 5.0.0-dev.5664.50b8944

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 (82) hide show
  1. package/Changelog.md +15 -2
  2. package/dist/formio.form.js +14 -14
  3. package/dist/formio.form.min.js +1 -1
  4. package/dist/formio.full.js +14 -14
  5. package/dist/formio.full.min.js +1 -1
  6. package/dist/formio.js +2 -2
  7. package/dist/formio.min.js +1 -1
  8. package/dist/formio.utils.js +1 -1
  9. package/dist/formio.utils.min.js +1 -1
  10. package/lib/cjs/Formio.js +1 -0
  11. package/lib/cjs/Webform.d.ts +7 -0
  12. package/lib/cjs/Webform.js +18 -5
  13. package/lib/cjs/components/_classes/component/Component.d.ts +13 -0
  14. package/lib/cjs/components/_classes/component/Component.js +27 -13
  15. package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
  16. package/lib/cjs/components/_classes/component/fixtures/comp7.d.ts +84 -0
  17. package/lib/cjs/components/_classes/component/fixtures/comp7.js +86 -0
  18. package/lib/cjs/components/_classes/component/fixtures/index.d.ts +2 -1
  19. package/lib/cjs/components/_classes/component/fixtures/index.js +3 -1
  20. package/lib/cjs/components/_classes/input/Input.js +23 -1
  21. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
  22. package/lib/cjs/components/_classes/multivalue/Multivalue.js +8 -1
  23. package/lib/cjs/components/datagrid/DataGrid.js +3 -0
  24. package/lib/cjs/components/datagrid/fixtures/comp9.d.ts +41 -0
  25. package/lib/cjs/components/datagrid/fixtures/comp9.js +44 -0
  26. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  27. package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
  28. package/lib/cjs/components/editgrid/EditGrid.js +2 -2
  29. package/lib/cjs/components/form/Form.d.ts +7 -0
  30. package/lib/cjs/components/form/Form.js +10 -1
  31. package/lib/cjs/components/number/Number.js +1 -1
  32. package/lib/cjs/components/number/fixtures/comp8.d.ts +32 -0
  33. package/lib/cjs/components/number/fixtures/comp8.js +28 -0
  34. package/lib/cjs/components/number/fixtures/index.d.ts +2 -1
  35. package/lib/cjs/components/number/fixtures/index.js +3 -1
  36. package/lib/cjs/components/phonenumber/fixtures/comp2.d.ts +16 -0
  37. package/lib/cjs/components/phonenumber/fixtures/comp2.js +25 -0
  38. package/lib/cjs/components/phonenumber/fixtures/index.d.ts +2 -1
  39. package/lib/cjs/components/phonenumber/fixtures/index.js +3 -1
  40. package/lib/cjs/components/select/Select.js +1 -2
  41. package/lib/cjs/components/signature/Signature.d.ts +0 -1
  42. package/lib/cjs/components/signature/Signature.js +1 -1
  43. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +5 -0
  44. package/lib/cjs/providers/address/GoogleAddressProvider.js +23 -1
  45. package/lib/cjs/utils/utils.js +0 -4
  46. package/lib/mjs/Formio.js +1 -0
  47. package/lib/mjs/Webform.d.ts +7 -0
  48. package/lib/mjs/Webform.js +18 -5
  49. package/lib/mjs/components/_classes/component/Component.d.ts +13 -0
  50. package/lib/mjs/components/_classes/component/Component.js +35 -13
  51. package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
  52. package/lib/mjs/components/_classes/component/fixtures/comp7.d.ts +84 -0
  53. package/lib/mjs/components/_classes/component/fixtures/comp7.js +84 -0
  54. package/lib/mjs/components/_classes/component/fixtures/index.d.ts +2 -1
  55. package/lib/mjs/components/_classes/component/fixtures/index.js +2 -1
  56. package/lib/mjs/components/_classes/input/Input.js +22 -1
  57. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
  58. package/lib/mjs/components/_classes/multivalue/Multivalue.js +8 -1
  59. package/lib/mjs/components/datagrid/DataGrid.js +3 -0
  60. package/lib/mjs/components/datagrid/fixtures/comp9.d.ts +41 -0
  61. package/lib/mjs/components/datagrid/fixtures/comp9.js +42 -0
  62. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  63. package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
  64. package/lib/mjs/components/editgrid/EditGrid.js +2 -2
  65. package/lib/mjs/components/form/Form.d.ts +7 -0
  66. package/lib/mjs/components/form/Form.js +10 -1
  67. package/lib/mjs/components/number/Number.js +1 -1
  68. package/lib/mjs/components/number/fixtures/comp8.d.ts +32 -0
  69. package/lib/mjs/components/number/fixtures/comp8.js +26 -0
  70. package/lib/mjs/components/number/fixtures/index.d.ts +2 -1
  71. package/lib/mjs/components/number/fixtures/index.js +2 -1
  72. package/lib/mjs/components/phonenumber/fixtures/comp2.d.ts +16 -0
  73. package/lib/mjs/components/phonenumber/fixtures/comp2.js +23 -0
  74. package/lib/mjs/components/phonenumber/fixtures/index.d.ts +2 -1
  75. package/lib/mjs/components/phonenumber/fixtures/index.js +2 -1
  76. package/lib/mjs/components/select/Select.js +1 -2
  77. package/lib/mjs/components/signature/Signature.d.ts +0 -1
  78. package/lib/mjs/components/signature/Signature.js +1 -1
  79. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +5 -0
  80. package/lib/mjs/providers/address/GoogleAddressProvider.js +22 -1
  81. package/lib/mjs/utils/utils.js +0 -4
  82. package/package.json +1 -2
package/lib/cjs/Formio.js CHANGED
@@ -125,3 +125,4 @@ if (typeof global !== 'undefined') {
125
125
  if (typeof window !== 'undefined') {
126
126
  sdk_1.Formio.addToGlobal(window);
127
127
  }
128
+ Embed_1.Formio._formioReady(sdk_1.Formio);
@@ -330,6 +330,13 @@ declare class Webform extends NestedDataComponent {
330
330
  * @returns {object} - The submission object.
331
331
  */
332
332
  get submission(): object;
333
+ /**
334
+ * Sets the submission value
335
+ * @param {object|null|undefined} submission - The submission to set.
336
+ * @param {object|null|undefined} flags - Any flags to apply when setting the submission.
337
+ * @returns {void}
338
+ */
339
+ onSetSubmission(submission: object | null | undefined, flags?: object | null | undefined): void;
333
340
  /**
334
341
  * Sets a submission and returns the promise when it is ready.
335
342
  * @param {any} submission - The submission to set.
@@ -13,6 +13,7 @@ const Components_1 = __importDefault(require("./components/Components"));
13
13
  const NestedDataComponent_1 = __importDefault(require("./components/_classes/nesteddata/NestedDataComponent"));
14
14
  const utils_1 = require("./utils/utils");
15
15
  const formUtils_1 = require("./utils/formUtils");
16
+ const dragula_1 = __importDefault(require("dragula"));
16
17
  // Initialize the available forms.
17
18
  Formio_1.Formio.forms = {};
18
19
  // Allow people to register components.
@@ -309,6 +310,7 @@ class Webform extends NestedDataComponent_1.default {
309
310
  // Ensure the root is set to this component.
310
311
  this.root = this;
311
312
  this.localRoot = this;
313
+ this.root.dragulaLib = dragula_1.default;
312
314
  }
313
315
  /* eslint-enable max-statements */
314
316
  get language() {
@@ -698,6 +700,18 @@ class Webform extends NestedDataComponent_1.default {
698
700
  set submission(submission) {
699
701
  this.setSubmission(submission);
700
702
  }
703
+ /**
704
+ * Sets the submission value
705
+ * @param {object|null|undefined} submission - The submission to set.
706
+ * @param {object|null|undefined} flags - Any flags to apply when setting the submission.
707
+ * @returns {void}
708
+ */
709
+ onSetSubmission(submission, flags = {}) {
710
+ this.submissionSet = true;
711
+ this.triggerChange(flags);
712
+ this.emit('beforeSetSubmission', submission);
713
+ this.setValue(submission, flags);
714
+ }
701
715
  /**
702
716
  * Sets a submission and returns the promise when it is ready.
703
717
  * @param {any} submission - The submission to set.
@@ -711,10 +725,7 @@ class Webform extends NestedDataComponent_1.default {
711
725
  if (resolveFlags) {
712
726
  flags = Object.assign(Object.assign({}, flags), resolveFlags);
713
727
  }
714
- this.submissionSet = true;
715
- this.triggerChange(flags);
716
- this.emit("beforeSetSubmission", submission);
717
- this.setValue(submission, flags);
728
+ this.onSetSubmission(submission, flags);
718
729
  return this.submissionReadyResolve(submission);
719
730
  }, (err) => this.submissionReadyReject(err))
720
731
  .catch((err) => this.submissionReadyReject(err)));
@@ -873,7 +884,9 @@ class Webform extends NestedDataComponent_1.default {
873
884
  this.addComponents();
874
885
  this.on("submitButton", (options) => {
875
886
  this.submit(false, options).catch((e) => {
876
- options.instance.loading = false;
887
+ if (options === null || options === void 0 ? void 0 : options.instance) {
888
+ options.instance.loading = false;
889
+ }
877
890
  return e !== false && e !== undefined && console.log(e);
878
891
  });
879
892
  }, true);
@@ -343,6 +343,12 @@ declare class Component extends Element {
343
343
  * @param {string} template - The template to use for the modal dialog.
344
344
  */
345
345
  setOpenModalElement(template?: string): void;
346
+ /**
347
+ * Renders a modal preview template and returns the markup as a string
348
+ * @param {object|null|undefined} ctx - The rendering context
349
+ * @returns {string} - The modal preview markup
350
+ */
351
+ renderModalPreview(ctx: object | null | undefined): string;
346
352
  /**
347
353
  * Returns the modal preview template.
348
354
  * @returns {string} - The modal preview template.
@@ -362,6 +368,13 @@ declare class Component extends Element {
362
368
  * @returns {string} - The rendered HTML string of a component.
363
369
  */
364
370
  render(children?: string, topLevel?: boolean): string;
371
+ /**
372
+ * Creates the tooltip instance using tippy.js and returns it
373
+ * @param {HTMLElement} tooltipEl - HTML element to attach the tooltip
374
+ * @param {object|null|undefined} settings - tippy.js options
375
+ * @returns {import('tippy.js').Tippy} - tippy.js instance
376
+ */
377
+ createTooltip(tooltipEl: HTMLElement, settings?: object | null | undefined): import('tippy.js').Tippy;
365
378
  /**
366
379
  * Attaches all the tooltips provided the refs object.
367
380
  * @param {object} toolTipsRefs - The refs for the tooltips within your template.
@@ -1046,6 +1046,14 @@ class Component extends Element_1.default {
1046
1046
  setOpenModalElement(template = null) {
1047
1047
  this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
1048
1048
  }
1049
+ /**
1050
+ * Renders a modal preview template and returns the markup as a string
1051
+ * @param {object|null|undefined} ctx - The rendering context
1052
+ * @returns {string} - The modal preview markup
1053
+ */
1054
+ renderModalPreview(ctx) {
1055
+ return this.renderTemplate('modalPreview', ctx || {});
1056
+ }
1049
1057
  /**
1050
1058
  * Returns the modal preview template.
1051
1059
  * @returns {string} - The modal preview template.
@@ -1057,7 +1065,7 @@ class Component extends Element_1.default {
1057
1065
  if (this.hasInput && ((_a = this.component.validate) === null || _a === void 0 ? void 0 : _a.required) && !this.isPDFReadOnlyMode) {
1058
1066
  modalLabel = { className: 'field-required' };
1059
1067
  }
1060
- return this.renderTemplate('modalPreview', {
1068
+ return this.renderModalPreview({
1061
1069
  previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('Click to set value'),
1062
1070
  messages: '',
1063
1071
  labelInfo: modalLabel,
@@ -1106,6 +1114,19 @@ class Component extends Element_1.default {
1106
1114
  }, topLevel);
1107
1115
  }
1108
1116
  }
1117
+ /**
1118
+ * Creates the tooltip instance using tippy.js and returns it
1119
+ * @param {HTMLElement} tooltipEl - HTML element to attach the tooltip
1120
+ * @param {object|null|undefined} settings - tippy.js options
1121
+ * @returns {import('tippy.js').Tippy} - tippy.js instance
1122
+ */
1123
+ createTooltip(tooltipEl, settings = {}) {
1124
+ const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
1125
+ const tooltipDataTitle = tooltipEl.getAttribute('data-title');
1126
+ const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
1127
+ .replace(/(?:\r\n|\r|\n)/g, '<br />');
1128
+ return (0, tippy_js_1.default)(tooltipEl, Object.assign(Object.assign({ allowHTML: true, trigger: 'mouseenter click focus', placement: 'right', zIndex: 10000, interactive: true }, settings), { content: this.t(this.sanitize(tooltipText), { _userInput: true }) }));
1129
+ }
1109
1130
  /**
1110
1131
  * Attaches all the tooltips provided the refs object.
1111
1132
  * @param {object} toolTipsRefs - The refs for the tooltips within your template.
@@ -1114,18 +1135,7 @@ class Component extends Element_1.default {
1114
1135
  attachTooltips(toolTipsRefs) {
1115
1136
  toolTipsRefs === null || toolTipsRefs === void 0 ? void 0 : toolTipsRefs.forEach((tooltip, index) => {
1116
1137
  if (tooltip) {
1117
- const tooltipAttribute = tooltip.getAttribute('data-tooltip');
1118
- const tooltipDataTitle = tooltip.getAttribute('data-title');
1119
- const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
1120
- .replace(/(?:\r\n|\r|\n)/g, '<br />');
1121
- this.tooltips[index] = (0, tippy_js_1.default)(tooltip, {
1122
- allowHTML: true,
1123
- trigger: 'mouseenter click focus',
1124
- placement: 'right',
1125
- zIndex: 10000,
1126
- interactive: true,
1127
- content: this.t(this.sanitize(tooltipText), { _userInput: true }),
1128
- });
1138
+ this.tooltips[index] = this.createTooltip(tooltip);
1129
1139
  }
1130
1140
  });
1131
1141
  }
@@ -3378,6 +3388,10 @@ class Component extends Element_1.default {
3378
3388
  const disabled = this.shouldDisabled;
3379
3389
  // Change states which won't be recalculated during redrawing
3380
3390
  if (this.visible !== visible) {
3391
+ // If the logic is triggered by an event and the action sets the hidden state then the original
3392
+ // component definition must be changed so that the components hidden state does not get flipped back by
3393
+ // the fieldLogic function
3394
+ this.originalComponent.hidden = !visible;
3381
3395
  this.visible = visible;
3382
3396
  }
3383
3397
  if (this.disabled !== disabled) {
@@ -190,5 +190,13 @@ exports.default = [
190
190
  key: 'tableView',
191
191
  input: true
192
192
  },
193
+ {
194
+ weight: 1600,
195
+ type: 'checkbox',
196
+ label: 'Modal Edit',
197
+ tooltip: 'Opens up a modal to edit the value of this component.',
198
+ key: 'modalEdit',
199
+ input: true
200
+ }
193
201
  ];
194
202
  /* eslint-enable max-len */
@@ -0,0 +1,84 @@
1
+ declare namespace _default {
2
+ let components: ({
3
+ label: string;
4
+ action: string;
5
+ showValidations: boolean;
6
+ tableView: boolean;
7
+ key: string;
8
+ type: string;
9
+ event: string;
10
+ input: boolean;
11
+ theme?: undefined;
12
+ collapsible?: undefined;
13
+ hidden?: undefined;
14
+ logic?: undefined;
15
+ collapsed?: undefined;
16
+ components?: undefined;
17
+ applyMaskOn?: undefined;
18
+ } | {
19
+ label: string;
20
+ action: string;
21
+ showValidations: boolean;
22
+ theme: string;
23
+ tableView: boolean;
24
+ key: string;
25
+ type: string;
26
+ event: string;
27
+ input: boolean;
28
+ collapsible?: undefined;
29
+ hidden?: undefined;
30
+ logic?: undefined;
31
+ collapsed?: undefined;
32
+ components?: undefined;
33
+ applyMaskOn?: undefined;
34
+ } | {
35
+ collapsible: boolean;
36
+ hidden: boolean;
37
+ key: string;
38
+ logic: {
39
+ name: string;
40
+ trigger: {
41
+ type: string;
42
+ event: string;
43
+ };
44
+ actions: {
45
+ name: string;
46
+ type: string;
47
+ property: {
48
+ label: string;
49
+ value: string;
50
+ type: string;
51
+ };
52
+ state: boolean;
53
+ }[];
54
+ }[];
55
+ type: string;
56
+ label: string;
57
+ collapsed: boolean;
58
+ input: boolean;
59
+ tableView: boolean;
60
+ components: never[];
61
+ action?: undefined;
62
+ showValidations?: undefined;
63
+ event?: undefined;
64
+ theme?: undefined;
65
+ applyMaskOn?: undefined;
66
+ } | {
67
+ label: string;
68
+ applyMaskOn: string;
69
+ tableView: boolean;
70
+ key: string;
71
+ type: string;
72
+ input: boolean;
73
+ action?: undefined;
74
+ showValidations?: undefined;
75
+ event?: undefined;
76
+ theme?: undefined;
77
+ collapsible?: undefined;
78
+ hidden?: undefined;
79
+ logic?: undefined;
80
+ collapsed?: undefined;
81
+ components?: undefined;
82
+ })[];
83
+ }
84
+ export default _default;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ components: [
5
+ {
6
+ "label": "Show",
7
+ "action": "event",
8
+ "showValidations": false,
9
+ "tableView": false,
10
+ "key": "show",
11
+ "type": "button",
12
+ "event": "show",
13
+ "input": true
14
+ },
15
+ {
16
+ "label": "Hide",
17
+ "action": "event",
18
+ "showValidations": false,
19
+ "theme": "danger",
20
+ "tableView": false,
21
+ "key": "hide",
22
+ "type": "button",
23
+ "event": "hide",
24
+ "input": true
25
+ },
26
+ {
27
+ "collapsible": true,
28
+ "hidden": true,
29
+ "key": "panel",
30
+ "logic": [
31
+ {
32
+ "name": "ShowPanel",
33
+ "trigger": {
34
+ "type": "event",
35
+ "event": "show"
36
+ },
37
+ "actions": [
38
+ {
39
+ "name": "Show",
40
+ "type": "property",
41
+ "property": {
42
+ "label": "Hidden",
43
+ "value": "hidden",
44
+ "type": "boolean"
45
+ },
46
+ "state": false
47
+ }
48
+ ]
49
+ },
50
+ {
51
+ "name": "HidePanel",
52
+ "trigger": {
53
+ "type": "event",
54
+ "event": "hide"
55
+ },
56
+ "actions": [
57
+ {
58
+ "name": "Hide",
59
+ "type": "property",
60
+ "property": {
61
+ "label": "Hidden",
62
+ "value": "hidden",
63
+ "type": "boolean"
64
+ },
65
+ "state": true
66
+ }
67
+ ]
68
+ }
69
+ ],
70
+ "type": "panel",
71
+ "label": "Panel",
72
+ "collapsed": false,
73
+ "input": false,
74
+ "tableView": false,
75
+ "components": []
76
+ },
77
+ {
78
+ "label": "Text Field",
79
+ "applyMaskOn": "change",
80
+ "tableView": true,
81
+ "key": "textField1",
82
+ "type": "textfield",
83
+ "input": true
84
+ }
85
+ ]
86
+ };
@@ -4,4 +4,5 @@ import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
- export { comp1, comp2, comp3, comp4, comp5, comp6 };
7
+ import comp7 from './comp7';
8
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7 };
@@ -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.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.comp7 = exports.comp6 = 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"));
@@ -16,3 +16,5 @@ const comp5_1 = __importDefault(require("./comp5"));
16
16
  exports.comp5 = comp5_1.default;
17
17
  const comp6_1 = __importDefault(require("./comp6"));
18
18
  exports.comp6 = comp6_1.default;
19
+ const comp7_1 = __importDefault(require("./comp7"));
20
+ exports.comp7 = comp7_1.default;
@@ -234,11 +234,33 @@ class Input extends Multivalue_1.default {
234
234
  this.addFocusBlurEvents(element);
235
235
  if (this.options.submitOnEnter) {
236
236
  this.addEventListener(element, 'keypress', (event) => {
237
+ var _a;
237
238
  const key = event.keyCode || event.which;
238
239
  if (key === 13) {
239
240
  event.preventDefault();
240
241
  event.stopPropagation();
241
- this.emit('submitButton');
242
+ let submitButton = null;
243
+ if ((_a = this.root) === null || _a === void 0 ? void 0 : _a.everyComponent) {
244
+ this.root.everyComponent((component) => {
245
+ if ((component === null || component === void 0 ? void 0 : component.component.type) === 'button' &&
246
+ (component === null || component === void 0 ? void 0 : component.component.action) === 'submit') {
247
+ submitButton = component;
248
+ return false;
249
+ }
250
+ });
251
+ }
252
+ const options = {};
253
+ if (submitButton) {
254
+ options.instance = submitButton;
255
+ options.component = submitButton.component;
256
+ options.noValidate = this.component.state === 'draft';
257
+ options.state = this.component.state || 'submitted';
258
+ submitButton.loading = true;
259
+ this.emit('submitButton', options);
260
+ }
261
+ else {
262
+ this.emit('submitButton', options);
263
+ }
242
264
  }
243
265
  });
244
266
  }
@@ -44,7 +44,7 @@ export default class Multivalue extends Field {
44
44
  attachMultiMask(index: number): boolean;
45
45
  /**
46
46
  * @param {any} input - The input element on which the mask is to be applied.
47
- * @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
47
+ * @param {string} mask - The mask pattern to apply to the input element. Exit early and remove previous mask if no mask.
48
48
  */
49
49
  updateMask(input: any, mask: string): void;
50
50
  /**
@@ -237,10 +237,17 @@ class Multivalue extends Field_1.default {
237
237
  }
238
238
  /**
239
239
  * @param {any} input - The input element on which the mask is to be applied.
240
- * @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
240
+ * @param {string} mask - The mask pattern to apply to the input element. Exit early and remove previous mask if no mask.
241
241
  */
242
242
  updateMask(input, mask) {
243
243
  if (!mask) {
244
+ if (input.mask) {
245
+ input.mask.destroy();
246
+ }
247
+ if (!this.component.placeholder) {
248
+ input.removeAttribute('placeholder');
249
+ }
250
+ input.value = '';
244
251
  return;
245
252
  }
246
253
  this.setInputMask(input, mask, !this.component.placeholder);
@@ -366,6 +366,9 @@ class DataGridComponent extends NestedArrayComponent_1.default {
366
366
  this.reorderValues(dataValue, oldPosition, newPosition, movedBelow);
367
367
  //reorder select data
368
368
  this.reorderValues(lodash_1.default.get(this.root, `submission.metadata.selectData.${this.path}`, []), oldPosition, newPosition, movedBelow);
369
+ // When components are reordered we need to set the dataGrid and form pristine properties to false
370
+ this.root.pristine = false;
371
+ this.pristine = false;
369
372
  //need to re-build rows to re-calculate indexes and other indexed fields for component instance (like rows for ex.)
370
373
  this.setValue(dataValue, { isReordered: true });
371
374
  this.rebuild();
@@ -0,0 +1,41 @@
1
+ declare namespace _default {
2
+ let components: {
3
+ label: string;
4
+ reorder: boolean;
5
+ addAnotherPosition: string;
6
+ layoutFixed: boolean;
7
+ enableRowGroups: boolean;
8
+ initEmpty: boolean;
9
+ tableView: boolean;
10
+ defaultValue: {}[];
11
+ key: string;
12
+ type: string;
13
+ input: boolean;
14
+ components: ({
15
+ label: string;
16
+ applyMaskOn: string;
17
+ tableView: boolean;
18
+ key: string;
19
+ type: string;
20
+ input: boolean;
21
+ mask?: undefined;
22
+ delimiter?: undefined;
23
+ requireDecimal?: undefined;
24
+ inputFormat?: undefined;
25
+ truncateMultipleSpaces?: undefined;
26
+ } | {
27
+ label: string;
28
+ applyMaskOn: string;
29
+ mask: boolean;
30
+ tableView: boolean;
31
+ delimiter: boolean;
32
+ requireDecimal: boolean;
33
+ inputFormat: string;
34
+ truncateMultipleSpaces: boolean;
35
+ key: string;
36
+ type: string;
37
+ input: boolean;
38
+ })[];
39
+ }[];
40
+ }
41
+ export default _default;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ "components": [
5
+ {
6
+ "label": "Data Grid",
7
+ "reorder": true,
8
+ "addAnotherPosition": "bottom",
9
+ "layoutFixed": false,
10
+ "enableRowGroups": false,
11
+ "initEmpty": false,
12
+ "tableView": false,
13
+ "defaultValue": [
14
+ {}
15
+ ],
16
+ "key": "dataGrid",
17
+ "type": "datagrid",
18
+ "input": true,
19
+ "components": [
20
+ {
21
+ "label": "Text Field",
22
+ "applyMaskOn": "change",
23
+ "tableView": true,
24
+ "key": "textField",
25
+ "type": "textfield",
26
+ "input": true
27
+ },
28
+ {
29
+ "label": "Number",
30
+ "applyMaskOn": "change",
31
+ "mask": false,
32
+ "tableView": false,
33
+ "delimiter": false,
34
+ "requireDecimal": false,
35
+ "inputFormat": "plain",
36
+ "truncateMultipleSpaces": false,
37
+ "key": "number",
38
+ "type": "number",
39
+ "input": true
40
+ }
41
+ ]
42
+ }
43
+ ]
44
+ };
@@ -6,6 +6,7 @@ import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
7
  import comp7 from './comp7';
8
8
  import comp8 from './comp8';
9
+ import comp9 from './comp9';
9
10
  import withCollapsibleRowGroups from './comp-with-collapsible-groups';
10
11
  import withConditionalFieldsAndValidations from './comp-with-conditional-components-and-validations';
11
12
  import withDefValue from './comp-with-def-value';
@@ -16,4 +17,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
16
17
  import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
17
18
  import withCheckboxes from './comp-with-checkboxes';
18
19
  import withReorder from './comp-with-reorder';
19
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
20
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
@@ -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.withReorder = exports.withCheckboxes = exports.twoWithAllowCalculatedOverride = exports.withAllowCalculateOverride = exports.modalWithRequiredFields = exports.withRowGroupsAndDefValue = exports.withLogic = exports.withDefValue = exports.withConditionalFieldsAndValidations = exports.withCollapsibleRowGroups = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.withReorder = exports.withCheckboxes = exports.twoWithAllowCalculatedOverride = exports.withAllowCalculateOverride = exports.modalWithRequiredFields = exports.withRowGroupsAndDefValue = exports.withLogic = exports.withDefValue = exports.withConditionalFieldsAndValidations = exports.withCollapsibleRowGroups = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = 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"));
@@ -20,6 +20,8 @@ const comp7_1 = __importDefault(require("./comp7"));
20
20
  exports.comp7 = comp7_1.default;
21
21
  const comp8_1 = __importDefault(require("./comp8"));
22
22
  exports.comp8 = comp8_1.default;
23
+ const comp9_1 = __importDefault(require("./comp9"));
24
+ exports.comp9 = comp9_1.default;
23
25
  const comp_with_def_value_1 = __importDefault(require("./comp-with-def-value"));
24
26
  exports.withDefValue = comp_with_def_value_1.default;
25
27
  const comp_row_groups_with_def_value_1 = __importDefault(require("./comp-row-groups-with-def-value"));
@@ -88,7 +88,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
88
88
  {% if (!instance.options.readOnly && !instance.disabled) { %}
89
89
  <div class="col-sm-2">
90
90
  <div class="btn-group pull-right">
91
- <button class="btn btn-default btn-light btn-sm editRow"><i class="{{ iconClass('pen-fill') }}"></i></button>
91
+ <button class="btn btn-default btn-light btn-sm editRow"><i class="{{ iconClass('edit') }}"></i></button>
92
92
  {% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}
93
93
  <button class="btn btn-danger btn-sm removeRow"><i class="{{ iconClass('trash') }}"></i></button>
94
94
  {% } %}
@@ -109,7 +109,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
109
109
  {% if (!instance.options.readOnly && !instance.disabled) { %}
110
110
  <td class="editgrid-table-column">
111
111
  <div class="btn-group">
112
- <button class="btn btn-default btn-light btn-sm editRow" aria-label="{{ t('Edit row') }}"><i class="{{ iconClass('pen-fill') }}"></i></button>
112
+ <button class="btn btn-default btn-light btn-sm editRow" aria-label="{{ t('Edit row') }}"><i class="{{ iconClass('edit') }}"></i></button>
113
113
  {% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}
114
114
  <button class="btn btn-danger btn-sm removeRow" aria-label="{{ t('Remove row') }}"><i class="{{ iconClass('trash') }}"></i></button>
115
115
  {% } %}
@@ -90,6 +90,13 @@ export default class FormComponent extends Component {
90
90
  isHidden(): boolean;
91
91
  setValue(submission: any, flags?: {}): boolean;
92
92
  setSubFormValue(submission: any, flags: any): void;
93
+ /**
94
+ * Sets the subform value
95
+ * @param {object|null|undefined} submission - The submission to set.
96
+ * @param {object|null|undefined} flags - Any flags to apply when setting the submission.
97
+ * @returns {void}
98
+ */
99
+ onSetSubFormValue(submission: object | null | undefined, flags: object | null | undefined): void;
93
100
  areAllComponentsEmpty(data: any): boolean;
94
101
  updateSubFormVisibility(): void;
95
102
  /**
@@ -649,9 +649,18 @@ class FormComponent extends Component_1.default {
649
649
  });
650
650
  }
651
651
  else {
652
- this.subForm.setValue(submission, flags);
652
+ this.onSetSubFormValue(submission, flags);
653
653
  }
654
654
  }
655
+ /**
656
+ * Sets the subform value
657
+ * @param {object|null|undefined} submission - The submission to set.
658
+ * @param {object|null|undefined} flags - Any flags to apply when setting the submission.
659
+ * @returns {void}
660
+ */
661
+ onSetSubFormValue(submission, flags) {
662
+ this.subForm.setValue(submission, flags);
663
+ }
655
664
  isEmpty(value = this.dataValue) {
656
665
  return value === null || lodash_1.default.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value === null || value === void 0 ? void 0 : value.data) && !(value === null || value === void 0 ? void 0 : value._id));
657
666
  }
@@ -48,7 +48,7 @@ class NumberComponent extends Input_1.default {
48
48
  var _a, _b;
49
49
  super(...args);
50
50
  const separators = (0, utils_1.getNumberSeparators)(this.options.language || navigator.language);
51
- this.decimalSeparator = this.options.decimalSeparator = this.options.decimalSeparator
51
+ this.decimalSeparator = this.options.decimalSeparator = this.component.decimalSymbol || this.options.decimalSeparator
52
52
  || ((_a = this.options.properties) === null || _a === void 0 ? void 0 : _a.decimalSeparator)
53
53
  || separators.decimalSeparator;
54
54
  if (this.component.delimiter) {