@formio/js 5.0.0-rc.96 → 5.0.0-rc.97

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.
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.1.6 | (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.6/LICENSE */
22
22
 
23
- /*! formiojs v5.0.0-rc.96 | https://unpkg.com/formiojs@5.0.0-rc.96/LICENSE.txt */
23
+ /*! formiojs v5.0.0-rc.97 | https://unpkg.com/formiojs@5.0.0-rc.97/LICENSE.txt */
24
24
 
25
25
  /**
26
26
  * @license
@@ -302,12 +302,13 @@ class RadioComponent extends ListComponent_1.default {
302
302
  .then((response) => {
303
303
  this.loading = false;
304
304
  this.setItems(response);
305
- this.optionsLoaded = true;
306
- this.redraw();
307
305
  })
308
306
  .catch((err) => {
309
- this.optionsLoaded = true;
310
307
  this.handleLoadingError(err);
308
+ })
309
+ .finally(() => {
310
+ this.optionsLoaded = true;
311
+ this.redraw();
311
312
  });
312
313
  }
313
314
  loadItemsFromMetadata() {
@@ -1240,7 +1240,7 @@ class SelectComponent extends ListComponent_1.default {
1240
1240
  }
1241
1241
  lodash_1.default.set(submission.metadata.selectData, this.path, templateData);
1242
1242
  }
1243
- if (flags.resetValue && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submission)) {
1243
+ if (flags.resetValue && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submission) && !this.options.readOnly) {
1244
1244
  const submission = this.root.submission;
1245
1245
  if (!submission.metadata) {
1246
1246
  submission.metadata = {};
@@ -0,0 +1,93 @@
1
+ declare namespace _default {
2
+ let _id: string;
3
+ let title: string;
4
+ let name: string;
5
+ let path: string;
6
+ let type: string;
7
+ let display: string;
8
+ let components: ({
9
+ label: string;
10
+ applyMaskOn: string;
11
+ mask: boolean;
12
+ tableView: boolean;
13
+ delimiter: boolean;
14
+ requireDecimal: boolean;
15
+ inputFormat: string;
16
+ truncateMultipleSpaces: boolean;
17
+ validateWhenHidden: boolean;
18
+ key: string;
19
+ type: string;
20
+ input: boolean;
21
+ widget?: undefined;
22
+ dataSrc?: undefined;
23
+ data?: undefined;
24
+ valueProperty?: undefined;
25
+ template?: undefined;
26
+ validate?: undefined;
27
+ searchField?: undefined;
28
+ noRefreshOnScroll?: undefined;
29
+ addResource?: undefined;
30
+ reference?: undefined;
31
+ searchThreshold?: undefined;
32
+ disableOnInvalid?: undefined;
33
+ } | {
34
+ label: string;
35
+ widget: string;
36
+ tableView: boolean;
37
+ dataSrc: string;
38
+ data: {
39
+ resource: string;
40
+ };
41
+ valueProperty: string;
42
+ template: string;
43
+ validate: {
44
+ select: boolean;
45
+ };
46
+ validateWhenHidden: boolean;
47
+ key: string;
48
+ type: string;
49
+ searchField: string;
50
+ noRefreshOnScroll: boolean;
51
+ addResource: boolean;
52
+ reference: boolean;
53
+ input: boolean;
54
+ searchThreshold: number;
55
+ applyMaskOn?: undefined;
56
+ mask?: undefined;
57
+ delimiter?: undefined;
58
+ requireDecimal?: undefined;
59
+ inputFormat?: undefined;
60
+ truncateMultipleSpaces?: undefined;
61
+ disableOnInvalid?: undefined;
62
+ } | {
63
+ type: string;
64
+ label: string;
65
+ key: string;
66
+ disableOnInvalid: boolean;
67
+ input: boolean;
68
+ tableView: boolean;
69
+ applyMaskOn?: undefined;
70
+ mask?: undefined;
71
+ delimiter?: undefined;
72
+ requireDecimal?: undefined;
73
+ inputFormat?: undefined;
74
+ truncateMultipleSpaces?: undefined;
75
+ validateWhenHidden?: undefined;
76
+ widget?: undefined;
77
+ dataSrc?: undefined;
78
+ data?: undefined;
79
+ valueProperty?: undefined;
80
+ template?: undefined;
81
+ validate?: undefined;
82
+ searchField?: undefined;
83
+ noRefreshOnScroll?: undefined;
84
+ addResource?: undefined;
85
+ reference?: undefined;
86
+ searchThreshold?: undefined;
87
+ })[];
88
+ let project: string;
89
+ let created: string;
90
+ let modified: string;
91
+ let machineName: string;
92
+ }
93
+ export default _default;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ _id: '672483c1d9abe46bcd70bca4',
5
+ title: 'yyyyyyy',
6
+ name: 'yyyyyyy',
7
+ path: 'yyyyyyy',
8
+ type: 'form',
9
+ display: 'form',
10
+ components: [
11
+ {
12
+ label: 'Number',
13
+ applyMaskOn: 'change',
14
+ mask: false,
15
+ tableView: false,
16
+ delimiter: false,
17
+ requireDecimal: false,
18
+ inputFormat: 'plain',
19
+ truncateMultipleSpaces: false,
20
+ validateWhenHidden: false,
21
+ key: 'number',
22
+ type: 'number',
23
+ input: true,
24
+ },
25
+ {
26
+ label: 'Select - Resource',
27
+ widget: 'choicesjs',
28
+ tableView: true,
29
+ dataSrc: 'resource',
30
+ data: {
31
+ resource: '672482f2d9abe46bcd70a0dc',
32
+ },
33
+ valueProperty: 'data.textField',
34
+ template: '<span>{{ item.data.textField }}</span>',
35
+ validate: {
36
+ select: false,
37
+ },
38
+ validateWhenHidden: false,
39
+ key: 'selectResource',
40
+ type: 'select',
41
+ searchField: 'data.textField__regex',
42
+ noRefreshOnScroll: false,
43
+ addResource: false,
44
+ reference: false,
45
+ input: true,
46
+ searchThreshold: 0.3,
47
+ },
48
+ {
49
+ type: 'button',
50
+ label: 'Submit',
51
+ key: 'submit',
52
+ disableOnInvalid: true,
53
+ input: true,
54
+ tableView: false,
55
+ },
56
+ ],
57
+ project: '67211a9aa929e4e6ebc2bf77',
58
+ created: '2024-11-01T07:31:13.647Z',
59
+ modified: '2024-11-01T12:51:23.213Z',
60
+ machineName: 'izutenexavvxnws:yyyyyyy',
61
+ };
@@ -24,5 +24,6 @@ import comp24 from './comp24';
24
24
  import comp25 from './comp25';
25
25
  import comp26 from './comp26';
26
26
  import comp27 from './comp27';
27
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25, comp26, comp27 };
27
+ import comp28 from './comp28';
28
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25, comp26, comp27, comp28 };
28
29
  export { multiSelect, multiSelectOptions } from "./comp3";
@@ -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.comp27 = exports.comp26 = exports.comp25 = exports.comp24 = exports.comp23 = exports.comp22 = exports.comp21 = exports.comp20 = exports.comp19 = exports.comp18 = exports.comp17 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp2 = exports.comp1 = exports.multiSelectOptions = exports.multiSelect = void 0;
6
+ exports.comp28 = exports.comp27 = exports.comp26 = exports.comp25 = exports.comp24 = exports.comp23 = exports.comp22 = exports.comp21 = exports.comp20 = exports.comp19 = exports.comp18 = exports.comp17 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp2 = exports.comp1 = exports.multiSelectOptions = exports.multiSelect = 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"));
@@ -59,3 +59,5 @@ const comp26_1 = __importDefault(require("./comp26"));
59
59
  exports.comp26 = comp26_1.default;
60
60
  const comp27_1 = __importDefault(require("./comp27"));
61
61
  exports.comp27 = comp27_1.default;
62
+ const comp28_1 = __importDefault(require("./comp28"));
63
+ exports.comp28 = comp28_1.default;
@@ -257,6 +257,18 @@ class SelectBoxesComponent extends Radio_1.default {
257
257
  }
258
258
  return super.checkComponentValidity(data, dirty, rowData, options, errors);
259
259
  }
260
+ setCustomValidity(messages, dirty, external) {
261
+ if (this.options.building && lodash_1.default.find(messages, { ruleName: 'invalidValueProperty' })) {
262
+ setTimeout(() => {
263
+ this.root && (0, utils_1.getComponent)(this.root.components, 'valueProperty').setCustomValidity(messages, dirty);
264
+ }, 0);
265
+ return super.setCustomValidity(lodash_1.default.filter(messages, (message) => message.ruleName !== 'invalidValueProperty'), dirty, external);
266
+ }
267
+ else {
268
+ return super.setCustomValidity(messages, dirty, external);
269
+ }
270
+ ;
271
+ }
260
272
  validateValueAvailability(setting, value) {
261
273
  if (!(0, utils_1.boolValue)(setting) || !value) {
262
274
  return true;
@@ -302,12 +302,13 @@ export default class RadioComponent extends ListComponent {
302
302
  .then((response) => {
303
303
  this.loading = false;
304
304
  this.setItems(response);
305
- this.optionsLoaded = true;
306
- this.redraw();
307
305
  })
308
306
  .catch((err) => {
309
- this.optionsLoaded = true;
310
307
  this.handleLoadingError(err);
308
+ })
309
+ .finally(() => {
310
+ this.optionsLoaded = true;
311
+ this.redraw();
311
312
  });
312
313
  }
313
314
  loadItemsFromMetadata() {
@@ -1268,7 +1268,7 @@ export default class SelectComponent extends ListComponent {
1268
1268
  }
1269
1269
  _.set(submission.metadata.selectData, this.path, templateData);
1270
1270
  }
1271
- if (flags.resetValue && this.root?.submission) {
1271
+ if (flags.resetValue && this.root?.submission && !this.options.readOnly) {
1272
1272
  const submission = this.root.submission;
1273
1273
  if (!submission.metadata) {
1274
1274
  submission.metadata = {};
@@ -0,0 +1,93 @@
1
+ declare namespace _default {
2
+ let _id: string;
3
+ let title: string;
4
+ let name: string;
5
+ let path: string;
6
+ let type: string;
7
+ let display: string;
8
+ let components: ({
9
+ label: string;
10
+ applyMaskOn: string;
11
+ mask: boolean;
12
+ tableView: boolean;
13
+ delimiter: boolean;
14
+ requireDecimal: boolean;
15
+ inputFormat: string;
16
+ truncateMultipleSpaces: boolean;
17
+ validateWhenHidden: boolean;
18
+ key: string;
19
+ type: string;
20
+ input: boolean;
21
+ widget?: undefined;
22
+ dataSrc?: undefined;
23
+ data?: undefined;
24
+ valueProperty?: undefined;
25
+ template?: undefined;
26
+ validate?: undefined;
27
+ searchField?: undefined;
28
+ noRefreshOnScroll?: undefined;
29
+ addResource?: undefined;
30
+ reference?: undefined;
31
+ searchThreshold?: undefined;
32
+ disableOnInvalid?: undefined;
33
+ } | {
34
+ label: string;
35
+ widget: string;
36
+ tableView: boolean;
37
+ dataSrc: string;
38
+ data: {
39
+ resource: string;
40
+ };
41
+ valueProperty: string;
42
+ template: string;
43
+ validate: {
44
+ select: boolean;
45
+ };
46
+ validateWhenHidden: boolean;
47
+ key: string;
48
+ type: string;
49
+ searchField: string;
50
+ noRefreshOnScroll: boolean;
51
+ addResource: boolean;
52
+ reference: boolean;
53
+ input: boolean;
54
+ searchThreshold: number;
55
+ applyMaskOn?: undefined;
56
+ mask?: undefined;
57
+ delimiter?: undefined;
58
+ requireDecimal?: undefined;
59
+ inputFormat?: undefined;
60
+ truncateMultipleSpaces?: undefined;
61
+ disableOnInvalid?: undefined;
62
+ } | {
63
+ type: string;
64
+ label: string;
65
+ key: string;
66
+ disableOnInvalid: boolean;
67
+ input: boolean;
68
+ tableView: boolean;
69
+ applyMaskOn?: undefined;
70
+ mask?: undefined;
71
+ delimiter?: undefined;
72
+ requireDecimal?: undefined;
73
+ inputFormat?: undefined;
74
+ truncateMultipleSpaces?: undefined;
75
+ validateWhenHidden?: undefined;
76
+ widget?: undefined;
77
+ dataSrc?: undefined;
78
+ data?: undefined;
79
+ valueProperty?: undefined;
80
+ template?: undefined;
81
+ validate?: undefined;
82
+ searchField?: undefined;
83
+ noRefreshOnScroll?: undefined;
84
+ addResource?: undefined;
85
+ reference?: undefined;
86
+ searchThreshold?: undefined;
87
+ })[];
88
+ let project: string;
89
+ let created: string;
90
+ let modified: string;
91
+ let machineName: string;
92
+ }
93
+ export default _default;
@@ -0,0 +1,59 @@
1
+ export default {
2
+ _id: '672483c1d9abe46bcd70bca4',
3
+ title: 'yyyyyyy',
4
+ name: 'yyyyyyy',
5
+ path: 'yyyyyyy',
6
+ type: 'form',
7
+ display: 'form',
8
+ components: [
9
+ {
10
+ label: 'Number',
11
+ applyMaskOn: 'change',
12
+ mask: false,
13
+ tableView: false,
14
+ delimiter: false,
15
+ requireDecimal: false,
16
+ inputFormat: 'plain',
17
+ truncateMultipleSpaces: false,
18
+ validateWhenHidden: false,
19
+ key: 'number',
20
+ type: 'number',
21
+ input: true,
22
+ },
23
+ {
24
+ label: 'Select - Resource',
25
+ widget: 'choicesjs',
26
+ tableView: true,
27
+ dataSrc: 'resource',
28
+ data: {
29
+ resource: '672482f2d9abe46bcd70a0dc',
30
+ },
31
+ valueProperty: 'data.textField',
32
+ template: '<span>{{ item.data.textField }}</span>',
33
+ validate: {
34
+ select: false,
35
+ },
36
+ validateWhenHidden: false,
37
+ key: 'selectResource',
38
+ type: 'select',
39
+ searchField: 'data.textField__regex',
40
+ noRefreshOnScroll: false,
41
+ addResource: false,
42
+ reference: false,
43
+ input: true,
44
+ searchThreshold: 0.3,
45
+ },
46
+ {
47
+ type: 'button',
48
+ label: 'Submit',
49
+ key: 'submit',
50
+ disableOnInvalid: true,
51
+ input: true,
52
+ tableView: false,
53
+ },
54
+ ],
55
+ project: '67211a9aa929e4e6ebc2bf77',
56
+ created: '2024-11-01T07:31:13.647Z',
57
+ modified: '2024-11-01T12:51:23.213Z',
58
+ machineName: 'izutenexavvxnws:yyyyyyy',
59
+ };
@@ -24,5 +24,6 @@ import comp24 from './comp24';
24
24
  import comp25 from './comp25';
25
25
  import comp26 from './comp26';
26
26
  import comp27 from './comp27';
27
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25, comp26, comp27 };
27
+ import comp28 from './comp28';
28
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25, comp26, comp27, comp28 };
28
29
  export { multiSelect, multiSelectOptions } from "./comp3";
@@ -25,4 +25,5 @@ import comp24 from './comp24';
25
25
  import comp25 from './comp25';
26
26
  import comp26 from './comp26';
27
27
  import comp27 from './comp27';
28
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25, comp26, comp27 };
28
+ import comp28 from './comp28';
29
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25, comp26, comp27, comp28 };
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { componentValueTypes, getComponentSavedTypes, boolValue } from '../../utils/utils';
2
+ import { componentValueTypes, getComponentSavedTypes, boolValue, getComponent } from '../../utils/utils';
3
3
  import RadioComponent from '../radio/Radio';
4
4
  export default class SelectBoxesComponent extends RadioComponent {
5
5
  static schema(...extend) {
@@ -258,6 +258,18 @@ export default class SelectBoxesComponent extends RadioComponent {
258
258
  }
259
259
  return super.checkComponentValidity(data, dirty, rowData, options, errors);
260
260
  }
261
+ setCustomValidity(messages, dirty, external) {
262
+ if (this.options.building && _.find(messages, { ruleName: 'invalidValueProperty' })) {
263
+ setTimeout(() => {
264
+ this.root && getComponent(this.root.components, 'valueProperty').setCustomValidity(messages, dirty);
265
+ }, 0);
266
+ return super.setCustomValidity(_.filter(messages, (message) => message.ruleName !== 'invalidValueProperty'), dirty, external);
267
+ }
268
+ else {
269
+ return super.setCustomValidity(messages, dirty, external);
270
+ }
271
+ ;
272
+ }
261
273
  validateValueAvailability(setting, value) {
262
274
  if (!boolValue(setting) || !value) {
263
275
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.96",
3
+ "version": "5.0.0-rc.97",
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.41",
83
83
  "@formio/choices.js": "^10.2.1",
84
- "@formio/core": "2.3.0-rc.18",
84
+ "@formio/core": "2.3.0-rc.21",
85
85
  "@formio/text-mask-addons": "^3.8.0-formio.3",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",