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

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 (34) hide show
  1. package/dist/formio.embed.js +1 -1
  2. package/dist/formio.embed.min.js +1 -1
  3. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  4. package/dist/formio.form.js +107 -856
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.full.js +19 -468
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  10. package/dist/formio.js +3 -3
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +95 -874
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  16. package/lib/cjs/components/currency/Currency.d.ts +1 -0
  17. package/lib/cjs/components/number/Number.d.ts +10 -1
  18. package/lib/cjs/components/number/Number.js +16 -7
  19. package/lib/cjs/components/number/fixtures/comp8.d.ts +32 -0
  20. package/lib/cjs/components/number/fixtures/comp8.js +28 -0
  21. package/lib/cjs/components/number/fixtures/comp9.d.ts +18 -0
  22. package/lib/cjs/components/number/fixtures/comp9.js +21 -0
  23. package/lib/cjs/components/number/fixtures/index.d.ts +3 -1
  24. package/lib/cjs/components/number/fixtures/index.js +5 -1
  25. package/lib/mjs/components/currency/Currency.d.ts +1 -0
  26. package/lib/mjs/components/number/Number.d.ts +10 -1
  27. package/lib/mjs/components/number/Number.js +15 -6
  28. package/lib/mjs/components/number/fixtures/comp8.d.ts +32 -0
  29. package/lib/mjs/components/number/fixtures/comp8.js +26 -0
  30. package/lib/mjs/components/number/fixtures/comp9.d.ts +18 -0
  31. package/lib/mjs/components/number/fixtures/comp9.js +19 -0
  32. package/lib/mjs/components/number/fixtures/index.d.ts +3 -1
  33. package/lib/mjs/components/number/fixtures/index.js +3 -1
  34. package/package.json +2 -2
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.1.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.5/LICENSE */
22
22
 
23
- /*! formiojs v5.0.0-rc.68 | https://unpkg.com/formiojs@5.0.0-rc.68/LICENSE.txt */
23
+ /*! formiojs v5.0.0-rc.69 | https://unpkg.com/formiojs@5.0.0-rc.69/LICENSE.txt */
24
24
 
25
25
  /**
26
26
  * @license
@@ -2,6 +2,7 @@ export default class CurrencyComponent extends NumberComponent {
2
2
  constructor(component: any, options: any, data: any);
3
3
  currencyPrefix: any;
4
4
  currencySuffix: any;
5
+ parseValue(value: any): string | null;
5
6
  addZerosAndFormatValue(value: any): any;
6
7
  stripPrefixSuffix(value: any): any;
7
8
  }
@@ -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;
@@ -45,19 +45,19 @@ class NumberComponent extends Input_1.default {
45
45
  return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.number];
46
46
  }
47
47
  constructor(...args) {
48
- var _a, _b;
48
+ var _a, _b, _c;
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) {
55
- if (this.options.hasOwnProperty('thousandsSeparator')) {
56
- console.warn("Property 'thousandsSeparator' is deprecated. Please use i18n to specify delimiter.");
57
- }
58
- this.delimiter = ((_b = this.options.properties) === null || _b === void 0 ? void 0 : _b.thousandsSeparator) || this.options.thousandsSeparator || separators.delimiter;
55
+ this.delimiter = this.component.thousandsSeparator || ((_b = this.options.properties) === null || _b === void 0 ? void 0 : _b.thousandsSeparator) || this.options.thousandsSeparator || separators.delimiter;
59
56
  }
60
57
  else {
58
+ if (this.component.thousandsSeparator || ((_c = this.options.properties) === null || _c === void 0 ? void 0 : _c.thousandsSeparator) || this.options.thousandsSeparator) {
59
+ console.warn('In order for thousands separator to work properly, you must set the delimiter to true in the component json');
60
+ }
61
61
  this.delimiter = '';
62
62
  }
63
63
  const requireDecimal = lodash_1.default.get(this.component, 'requireDecimal', false);
@@ -79,7 +79,7 @@ class NumberComponent extends Input_1.default {
79
79
  prefix: '',
80
80
  suffix: '',
81
81
  requireDecimal: lodash_1.default.get(this.component, 'requireDecimal', false),
82
- thousandsSeparatorSymbol: lodash_1.default.get(this.component, 'thousandsSeparator', this.delimiter),
82
+ thousandsSeparatorSymbol: this.delimiter || '',
83
83
  decimalSymbol: lodash_1.default.get(this.component, 'decimalSymbol', this.decimalSeparator),
84
84
  decimalLimit: lodash_1.default.get(this.component, 'decimalLimit', this.decimalLimit),
85
85
  allowNegative: lodash_1.default.get(this.component, 'allowNegative', true),
@@ -146,6 +146,15 @@ class NumberComponent extends Input_1.default {
146
146
  setValueAt(index, value, flags = {}) {
147
147
  return super.setValueAt(index, this.formatValue(this.parseValue(value)), flags);
148
148
  }
149
+ /**
150
+ * Converts a string to a floating point number, formats the number based on the parsed float function
151
+ * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat) and then returns the
152
+ * formatted number back as a string
153
+ * Example Input: "123.456,22"
154
+ * Example Output: "123456,22"
155
+ * @param {string | number} input the numeric string to parse
156
+ * @returns {string | null} a parsed string
157
+ */
149
158
  parseValue(input) {
150
159
  if (typeof input === 'string') {
151
160
  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,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ components: [
5
+ {
6
+ "label": "Number",
7
+ "applyMaskOn": "change",
8
+ "mask": false,
9
+ "tableView": false,
10
+ "delimiter": false,
11
+ "requireDecimal": false,
12
+ "inputFormat": "plain",
13
+ "truncateMultipleSpaces": false,
14
+ "key": "number",
15
+ "type": "number",
16
+ "input": true,
17
+ "decimalSymbol": "-"
18
+ },
19
+ {
20
+ "type": "button",
21
+ "label": "Submit",
22
+ "key": "submit",
23
+ "disableOnInvalid": true,
24
+ "input": true,
25
+ "tableView": false
26
+ }
27
+ ]
28
+ };
@@ -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,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ components: [
5
+ {
6
+ "label": "Number",
7
+ "applyMaskOn": "change",
8
+ "mask": false,
9
+ "tableView": false,
10
+ "delimiter": true,
11
+ "requireDecimal": false,
12
+ "inputFormat": "plain",
13
+ "truncateMultipleSpaces": false,
14
+ "key": "number",
15
+ "type": "number",
16
+ "input": true,
17
+ "decimalSymbol": ",",
18
+ "thousandsSeparator": "."
19
+ }
20
+ ]
21
+ };
@@ -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 };
@@ -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.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ 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"));
@@ -18,3 +18,7 @@ const comp6_1 = __importDefault(require("./comp6"));
18
18
  exports.comp6 = comp6_1.default;
19
19
  const comp7_1 = __importDefault(require("./comp7"));
20
20
  exports.comp7 = comp7_1.default;
21
+ const comp8_1 = __importDefault(require("./comp8"));
22
+ exports.comp8 = comp8_1.default;
23
+ const comp9_1 = __importDefault(require("./comp9"));
24
+ exports.comp9 = comp9_1.default;
@@ -2,6 +2,7 @@ export default class CurrencyComponent extends NumberComponent {
2
2
  constructor(component: any, options: any, data: any);
3
3
  currencyPrefix: any;
4
4
  currencySuffix: any;
5
+ parseValue(value: any): string | null;
5
6
  addZerosAndFormatValue(value: any): any;
6
7
  stripPrefixSuffix(value: any): any;
7
8
  }
@@ -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.68",
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.6",
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",