@formio/js 5.0.0-dev.5668.b75e179 → 5.0.0-dev.5670.71b75b1

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 (55) hide show
  1. package/dist/formio.form.js +7 -7
  2. package/dist/formio.form.min.js +1 -1
  3. package/dist/formio.full.js +7 -7
  4. package/dist/formio.full.min.js +1 -1
  5. package/lib/cjs/Webform.d.ts +7 -0
  6. package/lib/cjs/Webform.js +13 -4
  7. package/lib/cjs/components/_classes/component/Component.d.ts +13 -0
  8. package/lib/cjs/components/_classes/component/Component.js +23 -13
  9. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
  10. package/lib/cjs/components/_classes/multivalue/Multivalue.js +8 -1
  11. package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
  12. package/lib/cjs/components/checkbox/Checkbox.js +1 -1
  13. package/lib/cjs/components/checkbox/fixtures/comp6.d.ts +32 -0
  14. package/lib/cjs/components/checkbox/fixtures/comp6.js +30 -0
  15. package/lib/cjs/components/checkbox/fixtures/index.d.ts +2 -1
  16. package/lib/cjs/components/checkbox/fixtures/index.js +3 -1
  17. package/lib/cjs/components/form/Form.d.ts +7 -0
  18. package/lib/cjs/components/form/Form.js +10 -1
  19. package/lib/cjs/components/number/Number.js +1 -1
  20. package/lib/cjs/components/number/fixtures/comp8.d.ts +32 -0
  21. package/lib/cjs/components/number/fixtures/comp8.js +28 -0
  22. package/lib/cjs/components/number/fixtures/index.d.ts +2 -1
  23. package/lib/cjs/components/number/fixtures/index.js +3 -1
  24. package/lib/cjs/components/phonenumber/fixtures/comp2.d.ts +16 -0
  25. package/lib/cjs/components/phonenumber/fixtures/comp2.js +25 -0
  26. package/lib/cjs/components/phonenumber/fixtures/index.d.ts +2 -1
  27. package/lib/cjs/components/phonenumber/fixtures/index.js +3 -1
  28. package/lib/cjs/components/signature/Signature.d.ts +0 -1
  29. package/lib/cjs/components/signature/Signature.js +1 -1
  30. package/lib/mjs/Webform.d.ts +7 -0
  31. package/lib/mjs/Webform.js +13 -4
  32. package/lib/mjs/components/_classes/component/Component.d.ts +13 -0
  33. package/lib/mjs/components/_classes/component/Component.js +31 -13
  34. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
  35. package/lib/mjs/components/_classes/multivalue/Multivalue.js +8 -1
  36. package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
  37. package/lib/mjs/components/checkbox/Checkbox.js +1 -1
  38. package/lib/mjs/components/checkbox/fixtures/comp6.d.ts +32 -0
  39. package/lib/mjs/components/checkbox/fixtures/comp6.js +28 -0
  40. package/lib/mjs/components/checkbox/fixtures/index.d.ts +2 -1
  41. package/lib/mjs/components/checkbox/fixtures/index.js +2 -1
  42. package/lib/mjs/components/form/Form.d.ts +7 -0
  43. package/lib/mjs/components/form/Form.js +10 -1
  44. package/lib/mjs/components/number/Number.js +1 -1
  45. package/lib/mjs/components/number/fixtures/comp8.d.ts +32 -0
  46. package/lib/mjs/components/number/fixtures/comp8.js +26 -0
  47. package/lib/mjs/components/number/fixtures/index.d.ts +2 -1
  48. package/lib/mjs/components/number/fixtures/index.js +2 -1
  49. package/lib/mjs/components/phonenumber/fixtures/comp2.d.ts +16 -0
  50. package/lib/mjs/components/phonenumber/fixtures/comp2.js +23 -0
  51. package/lib/mjs/components/phonenumber/fixtures/index.d.ts +2 -1
  52. package/lib/mjs/components/phonenumber/fixtures/index.js +2 -1
  53. package/lib/mjs/components/signature/Signature.d.ts +0 -1
  54. package/lib/mjs/components/signature/Signature.js +1 -1
  55. package/package.json +1 -1
@@ -232,10 +232,17 @@ export default class Multivalue extends Field {
232
232
  }
233
233
  /**
234
234
  * @param {any} input - The input element on which the mask is to be applied.
235
- * @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
235
+ * @param {string} mask - The mask pattern to apply to the input element. Exit early and remove previous mask if no mask.
236
236
  */
237
237
  updateMask(input, mask) {
238
238
  if (!mask) {
239
+ if (input.mask) {
240
+ input.mask.destroy();
241
+ }
242
+ if (!this.component.placeholder) {
243
+ input.removeAttribute('placeholder');
244
+ }
245
+ input.value = '';
239
246
  return;
240
247
  }
241
248
  this.setInputMask(input, mask, !this.component.placeholder);
@@ -43,7 +43,7 @@ export default class CheckBoxComponent extends Field {
43
43
  attach(element: any): Promise<void>;
44
44
  input: any;
45
45
  detach(element: any): void;
46
- get emptyValue(): false | null;
46
+ get emptyValue(): false | "";
47
47
  getValueAt(index: any): any;
48
48
  get checked(): boolean;
49
49
  setCheckedState(value: any): any;
@@ -116,7 +116,7 @@ export default class CheckBoxComponent extends Field {
116
116
  super.detach();
117
117
  }
118
118
  get emptyValue() {
119
- return this.component.inputType === 'radio' ? null : false;
119
+ return this.component.inputType === 'radio' ? '' : false;
120
120
  }
121
121
  isEmpty(value = this.dataValue) {
122
122
  return super.isEmpty(value) || value === false;
@@ -0,0 +1,32 @@
1
+ declare namespace _default {
2
+ let name: string;
3
+ let path: string;
4
+ let type: string;
5
+ let display: string;
6
+ let components: ({
7
+ label: string;
8
+ inputType: string;
9
+ tableView: boolean;
10
+ defaultValue: boolean;
11
+ key: string;
12
+ type: string;
13
+ name: string;
14
+ value: string;
15
+ input: boolean;
16
+ 'some name': boolean;
17
+ disableOnInvalid?: undefined;
18
+ } | {
19
+ type: string;
20
+ label: string;
21
+ key: string;
22
+ disableOnInvalid: boolean;
23
+ input: boolean;
24
+ tableView: boolean;
25
+ inputType?: undefined;
26
+ defaultValue?: undefined;
27
+ name?: undefined;
28
+ value?: undefined;
29
+ 'some name'?: undefined;
30
+ })[];
31
+ }
32
+ export default _default;
@@ -0,0 +1,28 @@
1
+ export default {
2
+ name: 'ckeckbox',
3
+ path: 'ckeckbox',
4
+ type: 'form',
5
+ display: 'form',
6
+ components: [
7
+ {
8
+ label: 'Checkbox',
9
+ inputType: 'radio',
10
+ tableView: false,
11
+ defaultValue: false,
12
+ key: 'checkbox',
13
+ type: 'checkbox',
14
+ name: 'some name',
15
+ value: 'ok',
16
+ input: true,
17
+ 'some name': false
18
+ },
19
+ {
20
+ type: 'button',
21
+ label: 'Submit',
22
+ key: 'submit',
23
+ disableOnInvalid: true,
24
+ input: true,
25
+ tableView: false
26
+ }
27
+ ],
28
+ };
@@ -3,5 +3,6 @@ import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
+ import comp6 from './comp6';
6
7
  import customDefaultComponent from './customDefaultComponent';
7
- export { comp1, comp2, comp3, comp4, comp5, customDefaultComponent };
8
+ export { comp1, comp2, comp3, comp4, comp5, comp6, customDefaultComponent };
@@ -4,4 +4,5 @@ import comp2 from './comp2';
4
4
  import comp3 from './comp3';
5
5
  import comp4 from './comp4';
6
6
  import comp5 from './comp5';
7
- export { comp1, comp2, comp3, comp4, comp5, customDefaultComponent };
7
+ import comp6 from './comp6';
8
+ export { comp1, comp2, comp3, comp4, comp5, comp6, customDefaultComponent };
@@ -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
+ * @return {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
  /**
@@ -639,9 +639,18 @@ export default class FormComponent extends Component {
639
639
  });
640
640
  }
641
641
  else {
642
- this.subForm.setValue(submission, flags);
642
+ this.onSetSubFormValue(submission, flags);
643
643
  }
644
644
  }
645
+ /**
646
+ * Sets the subform value
647
+ * @param {object|null|undefined} submission - The submission to set.
648
+ * @param {object|null|undefined} flags - Any flags to apply when setting the submission.
649
+ * @return {void}
650
+ */
651
+ onSetSubFormValue(submission, flags) {
652
+ this.subForm.setValue(submission, flags);
653
+ }
645
654
  isEmpty(value = this.dataValue) {
646
655
  return value === null || _.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value?.data) && !value?._id);
647
656
  }
@@ -46,7 +46,7 @@ export default class NumberComponent extends Input {
46
46
  constructor(...args) {
47
47
  super(...args);
48
48
  const separators = getNumberSeparators(this.options.language || navigator.language);
49
- this.decimalSeparator = this.options.decimalSeparator = this.options.decimalSeparator
49
+ this.decimalSeparator = this.options.decimalSeparator = this.component.decimalSymbol || this.options.decimalSeparator
50
50
  || this.options.properties?.decimalSeparator
51
51
  || separators.decimalSeparator;
52
52
  if (this.component.delimiter) {
@@ -0,0 +1,32 @@
1
+ declare namespace _default {
2
+ let components: ({
3
+ label: string;
4
+ applyMaskOn: string;
5
+ mask: boolean;
6
+ tableView: boolean;
7
+ delimiter: boolean;
8
+ requireDecimal: boolean;
9
+ inputFormat: string;
10
+ truncateMultipleSpaces: boolean;
11
+ key: string;
12
+ type: string;
13
+ input: boolean;
14
+ decimalSymbol: string;
15
+ disableOnInvalid?: undefined;
16
+ } | {
17
+ type: string;
18
+ label: string;
19
+ key: string;
20
+ disableOnInvalid: boolean;
21
+ input: boolean;
22
+ tableView: boolean;
23
+ applyMaskOn?: undefined;
24
+ mask?: undefined;
25
+ delimiter?: undefined;
26
+ requireDecimal?: undefined;
27
+ inputFormat?: undefined;
28
+ truncateMultipleSpaces?: undefined;
29
+ decimalSymbol?: undefined;
30
+ })[];
31
+ }
32
+ export default _default;
@@ -0,0 +1,26 @@
1
+ export default {
2
+ components: [
3
+ {
4
+ "label": "Number",
5
+ "applyMaskOn": "change",
6
+ "mask": false,
7
+ "tableView": false,
8
+ "delimiter": false,
9
+ "requireDecimal": false,
10
+ "inputFormat": "plain",
11
+ "truncateMultipleSpaces": false,
12
+ "key": "number",
13
+ "type": "number",
14
+ "input": true,
15
+ "decimalSymbol": "-"
16
+ },
17
+ {
18
+ "type": "button",
19
+ "label": "Submit",
20
+ "key": "submit",
21
+ "disableOnInvalid": true,
22
+ "input": true,
23
+ "tableView": false
24
+ }
25
+ ]
26
+ };
@@ -5,4 +5,5 @@ import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
7
  import comp7 from './comp7';
8
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7 };
8
+ import comp8 from './comp8';
9
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
@@ -5,4 +5,5 @@ import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
7
  import comp7 from './comp7';
8
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7 };
8
+ import comp8 from './comp8';
9
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
@@ -0,0 +1,16 @@
1
+ declare namespace _default {
2
+ let components: {
3
+ label: string;
4
+ applyMaskOn: string;
5
+ allowMultipleMasks: boolean;
6
+ tableView: boolean;
7
+ key: string;
8
+ type: string;
9
+ inputMasks: {
10
+ label: string;
11
+ mask: string;
12
+ }[];
13
+ input: boolean;
14
+ }[];
15
+ }
16
+ export default _default;
@@ -0,0 +1,23 @@
1
+ export default {
2
+ components: [
3
+ {
4
+ "label": "Phone Number",
5
+ "applyMaskOn": "change",
6
+ "allowMultipleMasks": true,
7
+ "tableView": true,
8
+ "key": "phoneNumber",
9
+ "type": "phoneNumber",
10
+ "inputMasks": [
11
+ {
12
+ "label": "Canada",
13
+ "mask": "(999) 999-9999"
14
+ },
15
+ {
16
+ "label": "Other",
17
+ "mask": ""
18
+ }
19
+ ],
20
+ "input": true
21
+ }
22
+ ]
23
+ };
@@ -1,2 +1,3 @@
1
- export { comp1 };
2
1
  import comp1 from './comp1';
2
+ import comp2 from './comp2';
3
+ export { comp1, comp2 };
@@ -1,2 +1,3 @@
1
1
  import comp1 from './comp1';
2
- export { comp1 };
2
+ import comp2 from './comp2';
3
+ export { comp1, comp2 };
@@ -22,7 +22,6 @@ export default class SignatureComponent extends Input {
22
22
  showCanvas(show: any): void;
23
23
  onDisabled(): void;
24
24
  checkSize(force: any, scale: any): void;
25
- getModalPreviewTemplate(): any;
26
25
  signaturePad: SignaturePad | null | undefined;
27
26
  observer: any;
28
27
  getValueAsString(value: any): "" | "Yes" | "No";
@@ -169,7 +169,7 @@ export default class SignatureComponent extends Input {
169
169
  return false;
170
170
  }
171
171
  getModalPreviewTemplate() {
172
- return this.renderTemplate('modalPreview', {
172
+ return this.renderModalPreview({
173
173
  previewText: this.dataValue ?
174
174
  `<img src=${this.dataValue} ${this._referenceAttributeName}='openModal' style="width: 100%;height: 100%;" />` :
175
175
  this.t('Click to Sign')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5668.b75e179",
3
+ "version": "5.0.0-dev.5670.71b75b1",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {