@formio/js 5.0.0-rc.88 → 5.0.0-rc.89

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.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 +17 -17
  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 +17 -17
  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 +8 -8
  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/Components.js +4 -2
  17. package/lib/cjs/components/_classes/component/Component.js +8 -4
  18. package/lib/cjs/components/_classes/list/ListComponent.d.ts +4 -0
  19. package/lib/cjs/components/_classes/list/ListComponent.js +17 -0
  20. package/lib/cjs/components/_classes/nested/fixtures/comp4.d.ts +4 -0
  21. package/lib/cjs/components/_classes/nested/fixtures/comp4.js +12 -0
  22. package/lib/cjs/components/_classes/nested/fixtures/index.d.ts +1 -0
  23. package/lib/cjs/components/_classes/nested/fixtures/index.js +3 -1
  24. package/lib/cjs/components/address/Address.js +10 -0
  25. package/lib/cjs/components/day/Day.js +13 -6
  26. package/lib/cjs/components/radio/Radio.d.ts +1 -1
  27. package/lib/cjs/components/radio/Radio.js +32 -1
  28. package/lib/cjs/components/radio/fixtures/comp13.d.ts +49 -0
  29. package/lib/cjs/components/radio/fixtures/comp13.js +49 -0
  30. package/lib/cjs/components/radio/fixtures/index.d.ts +2 -1
  31. package/lib/cjs/components/radio/fixtures/index.js +3 -1
  32. package/lib/cjs/components/select/Select.d.ts +0 -4
  33. package/lib/cjs/components/select/Select.js +0 -16
  34. package/lib/cjs/components/selectboxes/fixtures/comp8.d.ts +49 -0
  35. package/lib/cjs/components/selectboxes/fixtures/comp8.js +49 -0
  36. package/lib/cjs/components/tags/fixtures/index.d.ts +1 -1
  37. package/lib/cjs/components/tags/fixtures/index.js +5 -1
  38. package/lib/cjs/utils/utils.d.ts +1 -1
  39. package/lib/cjs/utils/utils.js +1 -13
  40. package/lib/mjs/components/Components.js +4 -2
  41. package/lib/mjs/components/_classes/component/Component.js +5 -1
  42. package/lib/mjs/components/_classes/list/ListComponent.d.ts +4 -0
  43. package/lib/mjs/components/_classes/list/ListComponent.js +17 -0
  44. package/lib/mjs/components/_classes/nested/fixtures/comp4.d.ts +4 -0
  45. package/lib/mjs/components/_classes/nested/fixtures/comp4.js +7 -0
  46. package/lib/mjs/components/_classes/nested/fixtures/index.d.ts +1 -0
  47. package/lib/mjs/components/_classes/nested/fixtures/index.js +1 -0
  48. package/lib/mjs/components/address/Address.js +10 -0
  49. package/lib/mjs/components/day/Day.js +13 -6
  50. package/lib/mjs/components/radio/Radio.d.ts +1 -1
  51. package/lib/mjs/components/radio/Radio.js +32 -1
  52. package/lib/mjs/components/radio/fixtures/comp13.d.ts +49 -0
  53. package/lib/mjs/components/radio/fixtures/comp13.js +47 -0
  54. package/lib/mjs/components/radio/fixtures/index.d.ts +2 -1
  55. package/lib/mjs/components/radio/fixtures/index.js +2 -1
  56. package/lib/mjs/components/select/Select.d.ts +0 -4
  57. package/lib/mjs/components/select/Select.js +0 -16
  58. package/lib/mjs/components/selectboxes/fixtures/comp8.d.ts +49 -0
  59. package/lib/mjs/components/selectboxes/fixtures/comp8.js +47 -0
  60. package/lib/mjs/components/tags/fixtures/index.d.ts +1 -1
  61. package/lib/mjs/components/tags/fixtures/index.js +3 -1
  62. package/lib/mjs/utils/utils.d.ts +1 -1
  63. package/lib/mjs/utils/utils.js +1 -2
  64. package/package.json +2 -2
@@ -11,21 +11,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
11
11
  if (k2 === undefined) k2 = k;
12
12
  o[k2] = m[k];
13
13
  }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
14
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
15
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
16
  };
22
- var __importStar = (this && this.__importStar) || function (mod) {
23
- if (mod && mod.__esModule) return mod;
24
- var result = {};
25
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
- __setModuleDefault(result, mod);
27
- return result;
28
- };
29
17
  var __importDefault = (this && this.__importDefault) || function (mod) {
30
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
31
19
  };
@@ -37,6 +25,7 @@ exports._ = lodash_1.default;
37
25
  const json_logic_js_1 = __importDefault(require("json-logic-js"));
38
26
  exports.jsonLogic = json_logic_js_1.default;
39
27
  const moment_timezone_1 = __importDefault(require("moment-timezone/moment-timezone"));
28
+ exports.moment = moment_timezone_1.default;
40
29
  const jstimezonedetect_1 = __importDefault(require("jstimezonedetect"));
41
30
  const operators_1 = require("./jsonlogic/operators");
42
31
  const dompurify_1 = __importDefault(require("dompurify"));
@@ -62,7 +51,6 @@ json_logic_js_1.default.add_operation('relativeMinDate', (relativeMinDate) => {
62
51
  json_logic_js_1.default.add_operation('relativeMaxDate', (relativeMaxDate) => {
63
52
  return (0, moment_timezone_1.default)().add(relativeMaxDate, 'days').toISOString();
64
53
  });
65
- exports.moment = __importStar(require("moment-timezone/moment-timezone"));
66
54
  /**
67
55
  * Sets the path to the component and parent schema.
68
56
  * @param {import('@formio/core').Component} component - The component to set the path for.
@@ -1,6 +1,7 @@
1
1
  import Component from './_classes/component/Component';
2
2
  import EditFormUtils from './_classes/component/editForm/utils';
3
3
  import BaseEditForm from './_classes/component/Component.form';
4
+ import { getComponentKey } from '../utils/utils';
4
5
  import _ from 'lodash';
5
6
  export default class Components {
6
7
  static _editFormUtils = EditFormUtils;
@@ -52,7 +53,8 @@ export default class Components {
52
53
  */
53
54
  static getComponentPath(component) {
54
55
  let path = '';
55
- if (component.component.key) {
56
+ const componentKey = getComponentKey(component.component);
57
+ if (componentKey) {
56
58
  let thisPath = component.options?.parent || component;
57
59
  while (thisPath && !thisPath.allowData && thisPath.parent) {
58
60
  thisPath = thisPath.parent;
@@ -64,7 +66,7 @@ export default class Components {
64
66
  const rowIndex = component.row;
65
67
  const rowIndexPath = rowIndex && !['container'].includes(thisPath.component.type) ? `[${Number.parseInt(rowIndex)}]` : '';
66
68
  path = `${thisPath.path}${rowIndexPath}.`;
67
- path += component.component.key;
69
+ path += componentKey;
68
70
  return _.trim(path, '.');
69
71
  }
70
72
  return path;
@@ -2904,7 +2904,7 @@ export default class Component extends Element {
2904
2904
  if (this.options.alwaysDirty) {
2905
2905
  flags.dirty = true;
2906
2906
  }
2907
- if (flags.fromSubmission && this.hasValue(data)) {
2907
+ if (flags.fromSubmission && this.hasValue(data) && !(this.pristine && this.protected)) {
2908
2908
  flags.dirty = true;
2909
2909
  }
2910
2910
  this.setDirty(flags.dirty);
@@ -2931,6 +2931,7 @@ export default class Component extends Element {
2931
2931
  value: this.validationValue,
2932
2932
  path: this.path || this.component.key,
2933
2933
  instance: this,
2934
+ form: this.root ? this.root._form : {},
2934
2935
  scope: { errors: [] },
2935
2936
  processors: [
2936
2937
  validateProcessInfo
@@ -3404,6 +3405,9 @@ export default class Component extends Element {
3404
3405
  if ('beforeFocus' in this.parent) {
3405
3406
  this.parent.beforeFocus(this);
3406
3407
  }
3408
+ if (!index && !_.isNumber(index) && this.refs?.input?.length) {
3409
+ index = this.refs.input.length - 1;
3410
+ }
3407
3411
  if (this.refs.input?.length) {
3408
3412
  const focusingInput = this.refs.input[index];
3409
3413
  if (this.component.widget?.type === 'calendar') {
@@ -1,6 +1,7 @@
1
1
  export default class ListComponent extends Field {
2
2
  get isSelectURL(): boolean;
3
3
  get selectData(): any;
4
+ get dataReady(): any;
4
5
  get shouldLoad(): boolean;
5
6
  getTemplateKeys(): void;
6
7
  templateKeys: string[] | undefined;
@@ -10,6 +11,9 @@ export default class ListComponent extends Field {
10
11
  loadItems(): void;
11
12
  getOptionTemplate(data: any, value: any, index: any): any;
12
13
  itemTemplate(data: any, value: any, index: any): any;
14
+ set itemsLoaded(promise: any);
15
+ get itemsLoaded(): any;
16
+ _itemsLoaded: any;
13
17
  handleLoadingError(err: any): void;
14
18
  loading: boolean | undefined;
15
19
  networkError: boolean | undefined;
@@ -21,6 +21,16 @@ export default class ListComponent extends Field {
21
21
  const selectData = _.get(this.root, 'submission.metadata.selectData', {});
22
22
  return _.get(selectData, this.path);
23
23
  }
24
+ get dataReady() {
25
+ // If the root submission has been set, and we are still not attached, then assume
26
+ // that our data is ready.
27
+ if (this.root &&
28
+ this.root.submissionSet &&
29
+ !this.attached) {
30
+ return Promise.resolve();
31
+ }
32
+ return this.itemsLoaded;
33
+ }
24
34
  get shouldLoad() {
25
35
  if (this.loadingError) {
26
36
  return false;
@@ -107,6 +117,12 @@ export default class ListComponent extends Field {
107
117
  return this.sanitize(JSON.stringify(data), this.shouldSanitizeValue);
108
118
  }
109
119
  }
120
+ get itemsLoaded() {
121
+ return this._itemsLoaded || Promise.resolve();
122
+ }
123
+ set itemsLoaded(promise) {
124
+ this._itemsLoaded = promise;
125
+ }
110
126
  handleLoadingError(err) {
111
127
  this.loading = false;
112
128
  if (err.networkError) {
@@ -169,6 +185,7 @@ export default class ListComponent extends Field {
169
185
  return;
170
186
  }
171
187
  let { url } = this.component.data;
188
+ url = _.trim(url);
172
189
  let method;
173
190
  let body;
174
191
  if (url.startsWith('/')) {
@@ -0,0 +1,4 @@
1
+ declare namespace _default {
2
+ let components: any[];
3
+ }
4
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import comp from '../checkbox/comp2';
2
+ export default {
3
+ components: [
4
+ { ...comp },
5
+ { ...comp, value: 'false' }
6
+ ]
7
+ };
@@ -1,3 +1,4 @@
1
1
  export { default as comp1 } from "./comp1";
2
2
  export { default as comp2 } from "./comp2";
3
3
  export { default as comp3 } from "./comp3";
4
+ export { default as comp4 } from "./comp4";
@@ -1,3 +1,4 @@
1
1
  export { default as comp1 } from './comp1';
2
2
  export { default as comp2 } from './comp2';
3
3
  export { default as comp3 } from './comp3';
4
+ export { default as comp4 } from './comp4';
@@ -210,6 +210,16 @@ export default class AddressComponent extends ContainerComponent {
210
210
  isValueInLegacyFormat(value) {
211
211
  return value && !value.mode;
212
212
  }
213
+ set dataValue(value) {
214
+ super.dataValue = value;
215
+ }
216
+ get dataValue() {
217
+ const resultValue = _.get(this._data, this.component.path);
218
+ if (!_.isArray(resultValue) && this.component.multiple) {
219
+ return [resultValue];
220
+ }
221
+ return super.dataValue;
222
+ }
213
223
  normalizeValue(value) {
214
224
  return (this.manualModeEnabled && this.isValueInLegacyFormat(value))
215
225
  ? {
@@ -495,26 +495,33 @@ export default class DayComponent extends Field {
495
495
  defaults = defaultValue.split('/').map(x => parseInt(x, 10));
496
496
  }
497
497
  if (this.showDay && this.refs.day) {
498
- day = parseInt(this.refs.day.value, 10);
498
+ day = this.refs.day.value === '' ? '' : parseInt(this.refs.day.value, 10);
499
499
  }
500
500
  if (day === undefined || _.isNaN(day)) {
501
- day = defaults[DAY] && !_.isNaN(defaults[DAY]) ? defaults[DAY] : 0;
501
+ day = (defaults.length !== 3 && value)
502
+ ? this.getDayWithHiddenFields(defaults).day
503
+ : (defaults[DAY] && !_.isNaN(defaults[DAY]) ? defaults[DAY] : 0);
502
504
  }
503
505
  if (this.showMonth && this.refs.month) {
504
506
  // Months are 0 indexed.
505
- month = parseInt(this.refs.month.value, 10);
507
+ month = this.refs.month.value === '' ? '' : parseInt(this.refs.month.value, 10);
506
508
  }
507
509
  if (month === undefined || _.isNaN(month)) {
508
- month = defaults[MONTH] && !_.isNaN(defaults[MONTH]) ? defaults[MONTH] : 0;
510
+ month = (defaults.length !== 3 && value)
511
+ ? this.getDayWithHiddenFields(defaults).month
512
+ : (defaults[MONTH] && !_.isNaN(defaults[MONTH]) ? defaults[MONTH] : 0);
509
513
  }
510
514
  if (this.showYear && this.refs.year) {
511
- year = parseInt(this.refs.year.value);
515
+ year = this.refs.year.value === '' ? '' : parseInt(this.refs.year.value);
512
516
  }
513
517
  if (year === undefined || _.isNaN(year)) {
514
- year = defaults[YEAR] && !_.isNaN(defaults[YEAR]) ? defaults[YEAR] : 0;
518
+ year = (defaults.length !== 3 && value)
519
+ ? this.getDayWithHiddenFields(defaults).year
520
+ : (defaults[YEAR] && !_.isNaN(defaults[YEAR]) ? defaults[YEAR] : 0);
515
521
  }
516
522
  let result;
517
523
  if (!day && !month && !year) {
524
+ this.dataValue = this.emptyValue;
518
525
  return null;
519
526
  }
520
527
  // add trailing zeros if the data is showed
@@ -23,10 +23,10 @@ export default class RadioComponent extends ListComponent {
23
23
  get listData(): any;
24
24
  templateData: {} | undefined;
25
25
  triggerUpdate: ((...args: any[]) => any) | undefined;
26
- itemsLoaded: Promise<any> | undefined;
27
26
  itemsLoadedResolve: ((value: any) => void) | undefined;
28
27
  optionsLoaded: boolean | undefined;
29
28
  loadedOptions: any[] | undefined;
29
+ beforeSubmit(): Promise<any>;
30
30
  render(): import("../_classes/field/Field").default;
31
31
  attach(element: any): Promise<void>;
32
32
  detach(element: any): void;
@@ -80,6 +80,14 @@ export default class RadioComponent extends ListComponent {
80
80
  }
81
81
  return defaultValue;
82
82
  }
83
+ resetValue() {
84
+ this.unset();
85
+ this.setValue(this.emptyValue, {
86
+ noUpdateEvent: true,
87
+ noValidate: true,
88
+ resetValue: true
89
+ });
90
+ }
83
91
  get inputInfo() {
84
92
  const info = super.elementInfo();
85
93
  info.type = 'input';
@@ -126,12 +134,23 @@ export default class RadioComponent extends ListComponent {
126
134
  this.itemsLoaded = new Promise((resolve) => {
127
135
  this.itemsLoadedResolve = resolve;
128
136
  });
129
- this.optionsLoaded = false;
137
+ this.optionsLoaded = !this.component.dataSrc || this.component.dataSrc === 'values';
130
138
  this.loadedOptions = [];
139
+ if (!this.visible) {
140
+ this.itemsLoadedResolve();
141
+ }
131
142
  // Get the template keys for this radio component.
132
143
  this.getTemplateKeys();
133
144
  }
145
+ beforeSubmit() {
146
+ return new Promise(res => {
147
+ this.dataReady.then(() => res(true));
148
+ });
149
+ }
134
150
  render() {
151
+ if (!this.optionsLoaded) {
152
+ return super.render(this.renderTemplate('loader'));
153
+ }
135
154
  return super.render(this.renderTemplate('radio', {
136
155
  input: this.inputInfo,
137
156
  inline: this.component.inline,
@@ -242,12 +261,22 @@ export default class RadioComponent extends ListComponent {
242
261
  this.refs.input[index].checked = (inputValue === value.toString());
243
262
  }
244
263
  }
264
+ get shouldLoad() {
265
+ // do not load options if the value is empty in readOnly and we have options available in metadata
266
+ if (this.options.readOnly && this.isEmpty() && this.listData) {
267
+ return false;
268
+ }
269
+ return super.shouldLoad;
270
+ }
245
271
  loadItems(url, search, headers, options, method, body) {
246
272
  if (this.optionsLoaded) {
273
+ this.itemsLoadedResolve();
247
274
  return;
248
275
  }
249
276
  if (!this.shouldLoad && this.listData) {
250
277
  this.loadItemsFromMetadata();
278
+ this.itemsLoadedResolve();
279
+ this.optionsLoaded = true;
251
280
  return;
252
281
  }
253
282
  // Ensure we have a method and remove any body if method is get
@@ -268,6 +297,7 @@ export default class RadioComponent extends ListComponent {
268
297
  this.redraw();
269
298
  })
270
299
  .catch((err) => {
300
+ this.optionsLoaded = true;
271
301
  this.handleLoadingError(err);
272
302
  });
273
303
  }
@@ -308,6 +338,7 @@ export default class RadioComponent extends ListComponent {
308
338
  }
309
339
  _.set(submission.metadata.listData, this.path, listData);
310
340
  }
341
+ this.itemsLoadedResolve();
311
342
  }
312
343
  setSelectedClasses() {
313
344
  if (this.refs.wrapper) {
@@ -0,0 +1,49 @@
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
+ optionsLabelPosition: string;
11
+ inline: boolean;
12
+ tableView: boolean;
13
+ dataSrc: string;
14
+ values: {
15
+ label: string;
16
+ value: string;
17
+ shortcut: string;
18
+ }[];
19
+ valueProperty: string;
20
+ validateWhenHidden: boolean;
21
+ key: string;
22
+ type: string;
23
+ data: {
24
+ url: string;
25
+ headers: {
26
+ key: string;
27
+ value: string;
28
+ }[];
29
+ };
30
+ input: boolean;
31
+ disableOnInvalid?: undefined;
32
+ } | {
33
+ type: string;
34
+ label: string;
35
+ key: string;
36
+ disableOnInvalid: boolean;
37
+ input: boolean;
38
+ tableView: boolean;
39
+ optionsLabelPosition?: undefined;
40
+ inline?: undefined;
41
+ dataSrc?: undefined;
42
+ values?: undefined;
43
+ valueProperty?: undefined;
44
+ validateWhenHidden?: undefined;
45
+ data?: undefined;
46
+ })[];
47
+ let project: string;
48
+ }
49
+ export default _default;
@@ -0,0 +1,47 @@
1
+ export default {
2
+ _id: '66ebe22841267c275a4cb34e',
3
+ title: 'test radio url 1',
4
+ name: 'testRadioUrl1',
5
+ path: 'testradiourl1',
6
+ type: 'form',
7
+ display: 'form',
8
+ components: [
9
+ {
10
+ label: 'Radio',
11
+ optionsLabelPosition: 'right',
12
+ inline: false,
13
+ tableView: false,
14
+ dataSrc: 'url',
15
+ values: [
16
+ {
17
+ label: '',
18
+ value: '',
19
+ shortcut: '',
20
+ },
21
+ ],
22
+ valueProperty: 'identifier',
23
+ validateWhenHidden: false,
24
+ key: 'radio',
25
+ type: 'radio',
26
+ data: {
27
+ url: 'https://test.test/options',
28
+ headers: [
29
+ {
30
+ key: '',
31
+ value: '',
32
+ },
33
+ ],
34
+ },
35
+ input: true,
36
+ },
37
+ {
38
+ type: 'button',
39
+ label: 'Submit',
40
+ key: 'submit',
41
+ disableOnInvalid: true,
42
+ input: true,
43
+ tableView: false,
44
+ },
45
+ ],
46
+ project: '66e930e238963ab0230de6df',
47
+ };
@@ -10,4 +10,5 @@ import comp9 from './comp9';
10
10
  import comp10 from './comp10';
11
11
  import comp11 from './comp11';
12
12
  import comp12 from './comp12';
13
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12 };
13
+ import comp13 from './comp13';
14
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13 };
@@ -10,4 +10,5 @@ import comp9 from './comp9';
10
10
  import comp10 from './comp10';
11
11
  import comp11 from './comp11';
12
12
  import comp12 from './comp12';
13
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12 };
13
+ import comp13 from './comp13';
14
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13 };
@@ -54,8 +54,6 @@ export default class SelectComponent extends ListComponent {
54
54
  static savedValueTypes(schema: any): any[];
55
55
  templateData: {} | undefined;
56
56
  triggerUpdate: ((...args: any[]) => any) | undefined;
57
- set itemsLoaded(promise: any);
58
- get itemsLoaded(): any;
59
57
  itemsLoadedResolve: ((value: any) => void) | undefined;
60
58
  isFromSearch: boolean | undefined;
61
59
  searchServerCount: any;
@@ -65,7 +63,6 @@ export default class SelectComponent extends ListComponent {
65
63
  defaultDownloadedResources: any;
66
64
  activated: boolean | undefined;
67
65
  shouldPositionDropdown: any;
68
- get dataReady(): any;
69
66
  get emptyValue(): {};
70
67
  get valueProperty(): any;
71
68
  get inputInfo(): any;
@@ -141,7 +138,6 @@ export default class SelectComponent extends ListComponent {
141
138
  lazyLoadInit: boolean | undefined;
142
139
  isInitApiCallNeeded(hasValue: any): any;
143
140
  setChoicesValue(value: any, hasPreviousValue: any, flags?: {}): void;
144
- _itemsLoaded: any;
145
141
  validateValueAvailability(setting: any, value: any): boolean;
146
142
  /**
147
143
  * Performs required transformations on the initial value to use in selectOptions
@@ -151,16 +151,6 @@ export default class SelectComponent extends ListComponent {
151
151
  // Get the template keys for this select component.
152
152
  this.getTemplateKeys();
153
153
  }
154
- get dataReady() {
155
- // If the root submission has been set, and we are still not attached, then assume
156
- // that our data is ready.
157
- if (this.root &&
158
- this.root.submissionSet &&
159
- !this.attached) {
160
- return Promise.resolve();
161
- }
162
- return this.itemsLoaded;
163
- }
164
154
  get defaultSchema() {
165
155
  return SelectComponent.schema();
166
156
  }
@@ -1398,12 +1388,6 @@ export default class SelectComponent extends ListComponent {
1398
1388
  }
1399
1389
  }
1400
1390
  }
1401
- get itemsLoaded() {
1402
- return this._itemsLoaded || Promise.resolve();
1403
- }
1404
- set itemsLoaded(promise) {
1405
- this._itemsLoaded = promise;
1406
- }
1407
1391
  validateValueAvailability(setting, value) {
1408
1392
  if (!boolValue(setting) || !value) {
1409
1393
  return true;
@@ -0,0 +1,49 @@
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
+ optionsLabelPosition: string;
11
+ tableView: boolean;
12
+ dataSrc: string;
13
+ values: {
14
+ label: string;
15
+ value: string;
16
+ shortcut: string;
17
+ }[];
18
+ valueProperty: string;
19
+ validateWhenHidden: boolean;
20
+ key: string;
21
+ type: string;
22
+ data: {
23
+ url: string;
24
+ headers: {
25
+ key: string;
26
+ value: string;
27
+ }[];
28
+ };
29
+ input: boolean;
30
+ inputType: string;
31
+ disableOnInvalid?: undefined;
32
+ } | {
33
+ type: string;
34
+ label: string;
35
+ key: string;
36
+ disableOnInvalid: boolean;
37
+ input: boolean;
38
+ tableView: boolean;
39
+ optionsLabelPosition?: undefined;
40
+ dataSrc?: undefined;
41
+ values?: undefined;
42
+ valueProperty?: undefined;
43
+ validateWhenHidden?: undefined;
44
+ data?: undefined;
45
+ inputType?: undefined;
46
+ })[];
47
+ let project: string;
48
+ }
49
+ export default _default;
@@ -0,0 +1,47 @@
1
+ export default {
2
+ _id: '66ebfb1141267c275a4cce11',
3
+ title: 'test selectboxes url',
4
+ name: 'testSelectboxesUrl',
5
+ path: 'testselectboxesurl',
6
+ type: 'form',
7
+ display: 'form',
8
+ components: [
9
+ {
10
+ label: 'Select Boxes',
11
+ optionsLabelPosition: 'right',
12
+ tableView: false,
13
+ dataSrc: 'url',
14
+ values: [
15
+ {
16
+ label: '',
17
+ value: '',
18
+ shortcut: '',
19
+ },
20
+ ],
21
+ valueProperty: 'identifier',
22
+ validateWhenHidden: false,
23
+ key: 'selectBoxes',
24
+ type: 'selectboxes',
25
+ data: {
26
+ url: 'https://test.test/options',
27
+ headers: [
28
+ {
29
+ key: '',
30
+ value: '',
31
+ },
32
+ ],
33
+ },
34
+ input: true,
35
+ inputType: 'checkbox',
36
+ },
37
+ {
38
+ type: 'button',
39
+ label: 'Submit',
40
+ key: 'submit',
41
+ disableOnInvalid: true,
42
+ input: true,
43
+ tableView: false,
44
+ },
45
+ ],
46
+ project: '66e930e238963ab0230de6df',
47
+ };
@@ -4,4 +4,4 @@ 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
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
@@ -4,4 +4,6 @@ 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
+ import comp8 from './comp8';
9
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
@@ -531,4 +531,4 @@ import jsonLogic from 'json-logic-js';
531
531
  import ConditionOperators from './conditionOperators';
532
532
  import { Evaluator } from './Evaluator';
533
533
  export const interpolate: typeof Evaluator.interpolate;
534
- export { jsonLogic, ConditionOperators, Evaluator, _ };
534
+ export { jsonLogic, ConditionOperators, moment, Evaluator, _ };
@@ -24,8 +24,7 @@ jsonLogic.add_operation('relativeMinDate', (relativeMinDate) => {
24
24
  jsonLogic.add_operation('relativeMaxDate', (relativeMaxDate) => {
25
25
  return moment().add(relativeMaxDate, 'days').toISOString();
26
26
  });
27
- export { jsonLogic, ConditionOperators };
28
- export * as moment from 'moment-timezone/moment-timezone';
27
+ export { jsonLogic, ConditionOperators, moment };
29
28
  /**
30
29
  * Sets the path to the component and parent schema.
31
30
  * @param {import('@formio/core').Component} component - The component to set the path for.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.88",
3
+ "version": "5.0.0-rc.89",
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.37",
83
83
  "@formio/choices.js": "^10.2.1",
84
- "@formio/core": "2.3.0-rc.7",
84
+ "@formio/core": "2.3.0-rc.8",
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",