@formio/js 5.0.0-rc.67 → 5.0.0-rc.69

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. package/dist/formio.builder.css +0 -1
  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 +0 -1
  7. package/dist/formio.form.js +110 -859
  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 +1 -1
  11. package/dist/formio.full.css +0 -1
  12. package/dist/formio.full.js +22 -471
  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 +1 -1
  16. package/dist/formio.js +3 -3
  17. package/dist/formio.min.js +1 -1
  18. package/dist/formio.min.js.LICENSE.txt +1 -1
  19. package/dist/formio.utils.js +95 -874
  20. package/dist/formio.utils.min.js +1 -1
  21. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  22. package/lib/cjs/components/currency/Currency.d.ts +1 -0
  23. package/lib/cjs/components/datagrid/DataGrid.d.ts +9 -0
  24. package/lib/cjs/components/datagrid/DataGrid.js +49 -34
  25. package/lib/cjs/components/datagrid/fixtures/comp-with-reorder.d.ts +100 -0
  26. package/lib/cjs/components/datagrid/fixtures/comp-with-reorder.js +139 -0
  27. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  28. package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
  29. package/lib/cjs/components/datamap/DataMap.js +2 -2
  30. package/lib/cjs/components/editgrid/EditGrid.js +2 -1
  31. package/lib/cjs/components/editgrid/fixtures/comp16.d.ts +52 -0
  32. package/lib/cjs/components/editgrid/fixtures/comp16.js +71 -0
  33. package/lib/cjs/components/editgrid/fixtures/index.d.ts +2 -1
  34. package/lib/cjs/components/editgrid/fixtures/index.js +3 -1
  35. package/lib/cjs/components/number/Number.d.ts +10 -1
  36. package/lib/cjs/components/number/Number.js +16 -7
  37. package/lib/cjs/components/number/fixtures/comp8.d.ts +32 -0
  38. package/lib/cjs/components/number/fixtures/comp8.js +28 -0
  39. package/lib/cjs/components/number/fixtures/comp9.d.ts +18 -0
  40. package/lib/cjs/components/number/fixtures/comp9.js +21 -0
  41. package/lib/cjs/components/number/fixtures/index.d.ts +3 -1
  42. package/lib/cjs/components/number/fixtures/index.js +5 -1
  43. package/lib/mjs/components/currency/Currency.d.ts +1 -0
  44. package/lib/mjs/components/datagrid/DataGrid.d.ts +9 -0
  45. package/lib/mjs/components/datagrid/DataGrid.js +48 -33
  46. package/lib/mjs/components/datagrid/fixtures/comp-with-reorder.d.ts +100 -0
  47. package/lib/mjs/components/datagrid/fixtures/comp-with-reorder.js +137 -0
  48. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  49. package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
  50. package/lib/mjs/components/datamap/DataMap.js +1 -1
  51. package/lib/mjs/components/editgrid/EditGrid.js +2 -1
  52. package/lib/mjs/components/editgrid/fixtures/comp16.d.ts +52 -0
  53. package/lib/mjs/components/editgrid/fixtures/comp16.js +69 -0
  54. package/lib/mjs/components/editgrid/fixtures/index.d.ts +2 -1
  55. package/lib/mjs/components/editgrid/fixtures/index.js +2 -1
  56. package/lib/mjs/components/number/Number.d.ts +10 -1
  57. package/lib/mjs/components/number/Number.js +15 -6
  58. package/lib/mjs/components/number/fixtures/comp8.d.ts +32 -0
  59. package/lib/mjs/components/number/fixtures/comp8.js +26 -0
  60. package/lib/mjs/components/number/fixtures/comp9.d.ts +18 -0
  61. package/lib/mjs/components/number/fixtures/comp9.js +19 -0
  62. package/lib/mjs/components/number/fixtures/index.d.ts +3 -1
  63. package/lib/mjs/components/number/fixtures/index.js +3 -1
  64. package/package.json +2 -2
@@ -0,0 +1,69 @@
1
+ export default {
2
+ type: 'form',
3
+ display: 'wizard',
4
+ components: [
5
+ {
6
+ title: 'Page 1',
7
+ breadcrumbClickable: true,
8
+ buttonSettings: {
9
+ previous: true,
10
+ cancel: true,
11
+ next: true
12
+ },
13
+ collapsible: false,
14
+ tableView: false,
15
+ key: 'page3',
16
+ type: 'panel',
17
+ label: 'Page 2',
18
+ input: false,
19
+ components: [
20
+ {
21
+ label: 'Edit Grid',
22
+ tableView: true,
23
+ rowDrafts: false,
24
+ key: 'editGrid',
25
+ type: 'editgrid',
26
+ input: true,
27
+ components: [
28
+ {
29
+ label: 'Text Field',
30
+ tableView: true,
31
+ key: 'textField',
32
+ type: 'textfield',
33
+ input: true,
34
+ alwaysEnabled: false
35
+ }
36
+ ],
37
+ alwaysEnabled: false
38
+ }
39
+ ],
40
+ alwaysEnabled: false
41
+ },
42
+ {
43
+ title: 'Page 2',
44
+ breadcrumbClickable: true,
45
+ buttonSettings: {
46
+ previous: true,
47
+ cancel: true,
48
+ next: true
49
+ },
50
+ collapsible: false,
51
+ tableView: false,
52
+ key: 'page2',
53
+ type: 'panel',
54
+ label: 'Page 1',
55
+ input: false,
56
+ alwaysEnabled: false,
57
+ components: []
58
+ },
59
+ {
60
+ label: 'Submit',
61
+ showValidations: false,
62
+ alwaysEnabled: false,
63
+ tableView: false,
64
+ key: 'submit',
65
+ type: 'button',
66
+ input: true
67
+ }
68
+ ]
69
+ };
@@ -7,6 +7,7 @@ import comp12 from './comp12';
7
7
  import comp13 from './comp13';
8
8
  import comp14 from './comp14';
9
9
  import comp15 from './comp15';
10
+ import comp16 from './comp16';
10
11
  import comp4 from './comp4';
11
12
  import comp5 from './comp5';
12
13
  import comp6 from './comp6';
@@ -16,4 +17,4 @@ import comp9 from './comp9';
16
17
  import compOpenWhenEmpty from './comp-openWhenEmpty';
17
18
  import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
18
19
  import compWithCustomDefaultValue from './comp-with-custom-default-value';
19
- export { comp1, comp2, comp3, comp10, comp11, comp12, comp13, comp14, comp15, comp4, comp5, comp6, comp7, comp8, comp9, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue };
20
+ export { comp1, comp2, comp3, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp4, comp5, comp6, comp7, comp8, comp9, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue };
@@ -13,7 +13,8 @@ import comp12 from './comp12';
13
13
  import comp13 from './comp13';
14
14
  import comp14 from './comp14';
15
15
  import comp15 from './comp15';
16
+ import comp16 from './comp16';
16
17
  import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
17
18
  import compOpenWhenEmpty from './comp-openWhenEmpty';
18
19
  import compWithCustomDefaultValue from './comp-with-custom-default-value';
19
- export { comp1, comp2, comp3, comp10, comp11, comp12, comp13, comp14, comp15, comp4, comp5, comp6, comp7, comp8, comp9, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue };
20
+ export { comp1, comp2, comp3, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp4, comp5, comp6, comp7, comp8, comp9, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue };
@@ -31,7 +31,16 @@ export default class NumberComponent extends Input {
31
31
  setInputMask(input: any): void;
32
32
  getValueAt(index: any): number | null;
33
33
  setValueAt(index: any, value: any, flags?: {}): void;
34
- parseValue(input: any): number;
34
+ /**
35
+ * Converts a string to a floating point number, formats the number based on the parsed float function
36
+ * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat) and then returns the
37
+ * formatted number back as a string
38
+ * Example Input: "123.456,22"
39
+ * Example Output: "123456,22"
40
+ * @param {string | number} input the numeric string to parse
41
+ * @returns {string | null} a parsed string
42
+ */
43
+ parseValue(input: string | number): string | null;
35
44
  focus(): void;
36
45
  getMaskedValue(value: any): any;
37
46
  getValueAsString(value: any, options: any): any;
@@ -46,16 +46,16 @@ 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) {
53
- if (this.options.hasOwnProperty('thousandsSeparator')) {
54
- console.warn("Property 'thousandsSeparator' is deprecated. Please use i18n to specify delimiter.");
55
- }
56
- this.delimiter = this.options.properties?.thousandsSeparator || this.options.thousandsSeparator || separators.delimiter;
53
+ this.delimiter = this.component.thousandsSeparator || this.options.properties?.thousandsSeparator || this.options.thousandsSeparator || separators.delimiter;
57
54
  }
58
55
  else {
56
+ if (this.component.thousandsSeparator || this.options.properties?.thousandsSeparator || this.options.thousandsSeparator) {
57
+ console.warn('In order for thousands separator to work properly, you must set the delimiter to true in the component json');
58
+ }
59
59
  this.delimiter = '';
60
60
  }
61
61
  const requireDecimal = _.get(this.component, 'requireDecimal', false);
@@ -77,7 +77,7 @@ export default class NumberComponent extends Input {
77
77
  prefix: '',
78
78
  suffix: '',
79
79
  requireDecimal: _.get(this.component, 'requireDecimal', false),
80
- thousandsSeparatorSymbol: _.get(this.component, 'thousandsSeparator', this.delimiter),
80
+ thousandsSeparatorSymbol: this.delimiter || '',
81
81
  decimalSymbol: _.get(this.component, 'decimalSymbol', this.decimalSeparator),
82
82
  decimalLimit: _.get(this.component, 'decimalLimit', this.decimalLimit),
83
83
  allowNegative: _.get(this.component, 'allowNegative', true),
@@ -144,6 +144,15 @@ export default class NumberComponent extends Input {
144
144
  setValueAt(index, value, flags = {}) {
145
145
  return super.setValueAt(index, this.formatValue(this.parseValue(value)), flags);
146
146
  }
147
+ /**
148
+ * Converts a string to a floating point number, formats the number based on the parsed float function
149
+ * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat) and then returns the
150
+ * formatted number back as a string
151
+ * Example Input: "123.456,22"
152
+ * Example Output: "123456,22"
153
+ * @param {string | number} input the numeric string to parse
154
+ * @returns {string | null} a parsed string
155
+ */
147
156
  parseValue(input) {
148
157
  if (typeof input === 'string') {
149
158
  input = input.split(this.delimiter).join('').replace(this.decimalSeparator, '.');
@@ -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
+ };
@@ -0,0 +1,18 @@
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
+ thousandsSeparator: string;
16
+ }[];
17
+ }
18
+ export default _default;
@@ -0,0 +1,19 @@
1
+ export default {
2
+ components: [
3
+ {
4
+ "label": "Number",
5
+ "applyMaskOn": "change",
6
+ "mask": false,
7
+ "tableView": false,
8
+ "delimiter": true,
9
+ "requireDecimal": false,
10
+ "inputFormat": "plain",
11
+ "truncateMultipleSpaces": false,
12
+ "key": "number",
13
+ "type": "number",
14
+ "input": true,
15
+ "decimalSymbol": ",",
16
+ "thousandsSeparator": "."
17
+ }
18
+ ]
19
+ };
@@ -5,4 +5,6 @@ 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
+ import comp9 from './comp9';
10
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9 };
@@ -5,4 +5,6 @@ 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
+ import comp9 from './comp9';
10
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.67",
3
+ "version": "5.0.0-rc.69",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -81,7 +81,7 @@
81
81
  "dependencies": {
82
82
  "@formio/bootstrap": "3.0.0-rc.36",
83
83
  "@formio/choices.js": "^10.2.1",
84
- "@formio/core": "2.2.0-rc.5",
84
+ "@formio/core": "2.2.0-rc.7",
85
85
  "@formio/text-mask-addons": "^3.8.0-formio.2",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",