@formio/js 5.1.0-dev.6112.86987a5 → 5.1.0-dev.6112.b627acb

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 (83) hide show
  1. package/dist/formio.builder.css +6 -0
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.css +1 -1
  4. package/dist/formio.embed.min.css +1 -1
  5. package/dist/formio.form.css +6 -0
  6. package/dist/formio.form.js +43 -65
  7. package/dist/formio.form.min.css +1 -1
  8. package/dist/formio.form.min.js +1 -1
  9. package/dist/formio.full.css +6 -0
  10. package/dist/formio.full.js +47 -69
  11. package/dist/formio.full.min.css +1 -1
  12. package/dist/formio.full.min.js +1 -1
  13. package/dist/formio.js +21 -43
  14. package/dist/formio.min.js +1 -1
  15. package/dist/formio.utils.js +22 -44
  16. package/dist/formio.utils.min.js +1 -1
  17. package/lib/cjs/Element.js +2 -2
  18. package/lib/cjs/PDFBuilder.js +8 -6
  19. package/lib/cjs/Webform.js +9 -1
  20. package/lib/cjs/WebformBuilder.js +17 -6
  21. package/lib/cjs/Wizard.js +7 -6
  22. package/lib/cjs/WizardBuilder.js +4 -0
  23. package/lib/cjs/components/Components.js +7 -1
  24. package/lib/cjs/components/_classes/component/Component.d.ts +1 -0
  25. package/lib/cjs/components/_classes/component/Component.js +30 -17
  26. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +7 -0
  27. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -0
  28. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +2 -1
  29. package/lib/cjs/components/_classes/nested/NestedComponent.js +18 -5
  30. package/lib/cjs/components/address/Address.js +4 -4
  31. package/lib/cjs/components/address/editForm/Address.edit.provider.js +1 -1
  32. package/lib/cjs/components/datagrid/DataGrid.js +12 -1
  33. package/lib/cjs/components/editgrid/EditGrid.d.ts +2 -3
  34. package/lib/cjs/components/editgrid/EditGrid.js +0 -8
  35. package/lib/cjs/components/form/Form.d.ts +2 -1
  36. package/lib/cjs/components/form/Form.js +32 -20
  37. package/lib/cjs/components/number/Number.js +4 -1
  38. package/lib/cjs/components/radio/Radio.d.ts +1 -0
  39. package/lib/cjs/components/radio/Radio.js +5 -5
  40. package/lib/cjs/components/select/Select.js +1 -1
  41. package/lib/cjs/components/tags/Tags.js +7 -0
  42. package/lib/cjs/formio.form.d.ts +2 -1
  43. package/lib/cjs/formio.form.js +2 -1
  44. package/lib/cjs/providers/storage/url.js +7 -3
  45. package/lib/cjs/utils/formUtils.d.ts +3 -3
  46. package/lib/cjs/utils/index.d.ts +6 -5
  47. package/lib/cjs/utils/index.js +2 -1
  48. package/lib/cjs/utils/utils.js +0 -4
  49. package/lib/cjs/widgets/CalendarWidget.js +8 -1
  50. package/lib/mjs/Element.js +2 -2
  51. package/lib/mjs/PDFBuilder.js +8 -6
  52. package/lib/mjs/Webform.js +9 -1
  53. package/lib/mjs/WebformBuilder.js +17 -6
  54. package/lib/mjs/Wizard.js +7 -6
  55. package/lib/mjs/WizardBuilder.js +4 -0
  56. package/lib/mjs/components/Components.js +7 -1
  57. package/lib/mjs/components/_classes/component/Component.d.ts +1 -0
  58. package/lib/mjs/components/_classes/component/Component.js +29 -16
  59. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +7 -0
  60. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -0
  61. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +2 -1
  62. package/lib/mjs/components/_classes/nested/NestedComponent.js +17 -5
  63. package/lib/mjs/components/address/Address.js +4 -4
  64. package/lib/mjs/components/address/editForm/Address.edit.provider.js +1 -1
  65. package/lib/mjs/components/datagrid/DataGrid.js +11 -1
  66. package/lib/mjs/components/editgrid/EditGrid.d.ts +2 -3
  67. package/lib/mjs/components/editgrid/EditGrid.js +0 -8
  68. package/lib/mjs/components/form/Form.d.ts +2 -1
  69. package/lib/mjs/components/form/Form.js +32 -20
  70. package/lib/mjs/components/number/Number.js +4 -1
  71. package/lib/mjs/components/radio/Radio.d.ts +1 -0
  72. package/lib/mjs/components/radio/Radio.js +5 -5
  73. package/lib/mjs/components/select/Select.js +1 -1
  74. package/lib/mjs/components/tags/Tags.js +7 -0
  75. package/lib/mjs/formio.form.d.ts +2 -1
  76. package/lib/mjs/formio.form.js +2 -2
  77. package/lib/mjs/providers/storage/url.js +7 -3
  78. package/lib/mjs/utils/formUtils.d.ts +3 -3
  79. package/lib/mjs/utils/index.d.ts +6 -5
  80. package/lib/mjs/utils/index.js +2 -2
  81. package/lib/mjs/utils/utils.js +0 -4
  82. package/lib/mjs/widgets/CalendarWidget.js +8 -1
  83. package/package.json +2 -2
@@ -82,6 +82,7 @@ declare const _default: ({
82
82
  inline?: undefined;
83
83
  defaultValue?: undefined;
84
84
  values?: undefined;
85
+ customConditional?: undefined;
85
86
  logic?: undefined;
86
87
  dataSrc?: undefined;
87
88
  valueProperty?: undefined;
@@ -101,6 +102,7 @@ declare const _default: ({
101
102
  inline?: undefined;
102
103
  defaultValue?: undefined;
103
104
  values?: undefined;
105
+ customConditional?: undefined;
104
106
  logic?: undefined;
105
107
  dataSrc?: undefined;
106
108
  valueProperty?: undefined;
@@ -126,6 +128,7 @@ declare const _default: ({
126
128
  value: string;
127
129
  })[];
128
130
  placeholder?: undefined;
131
+ customConditional?: undefined;
129
132
  logic?: undefined;
130
133
  dataSrc?: undefined;
131
134
  valueProperty?: undefined;
@@ -141,6 +144,7 @@ declare const _default: ({
141
144
  tooltip: string;
142
145
  key: string;
143
146
  input: boolean;
147
+ customConditional: string;
144
148
  logic: ({
145
149
  name: string;
146
150
  trigger: {
@@ -211,6 +215,7 @@ declare const _default: ({
211
215
  inline?: undefined;
212
216
  defaultValue?: undefined;
213
217
  values?: undefined;
218
+ customConditional?: undefined;
214
219
  logic?: undefined;
215
220
  as?: undefined;
216
221
  editor?: undefined;
@@ -226,6 +231,7 @@ declare const _default: ({
226
231
  placeholder?: undefined;
227
232
  inline?: undefined;
228
233
  values?: undefined;
234
+ customConditional?: undefined;
229
235
  logic?: undefined;
230
236
  dataSrc?: undefined;
231
237
  valueProperty?: undefined;
@@ -248,6 +254,7 @@ declare const _default: ({
248
254
  placeholder?: undefined;
249
255
  inline?: undefined;
250
256
  values?: undefined;
257
+ customConditional?: undefined;
251
258
  logic?: undefined;
252
259
  dataSrc?: undefined;
253
260
  valueProperty?: undefined;
@@ -56,6 +56,7 @@ export default [
56
56
  tooltip: 'Encrypt this field on the server. This is two way encryption which is not suitable for passwords.',
57
57
  key: 'encrypted',
58
58
  input: true,
59
+ customConditional: 'show = data.encrypted;',
59
60
  logic: [
60
61
  {
61
62
  name: 'disabled',
@@ -108,6 +108,7 @@ export default class NestedComponent extends Field {
108
108
  * @returns {any} - The component that is located.
109
109
  */
110
110
  getComponent(path: string): any;
111
+ componentMatches: {} | undefined;
111
112
  /**
112
113
  * Return a component provided the Id of the component.
113
114
  * @param {string} id - The Id of the component.
@@ -154,7 +155,7 @@ export default class NestedComponent extends Field {
154
155
  * @param {import('@formio/core').Component[]} components - The components to attach logic to.
155
156
  */
156
157
  attachComponentsLogic(components: import('@formio/core').Component[]): void;
157
- attachComponents(element: any, components: any, container: any): Promise<any>;
158
+ attachComponents(element: any, components: any, container: any): Promise<void> | Promise<any[]>;
158
159
  /**
159
160
  * Remove a component from the components array and from the children object
160
161
  * @param {import('@formio/core').Component} component - The component to remove from the components.
@@ -308,6 +308,13 @@ export default class NestedComponent extends Field {
308
308
  * @returns {any} - The component that is located.
309
309
  */
310
310
  getComponent(path) {
311
+ // If the component is found
312
+ if (!this.componentMatches) {
313
+ this.componentMatches = {};
314
+ }
315
+ if (this.componentMatches && this.componentMatches[path]) {
316
+ return this.componentMatches[path];
317
+ }
311
318
  path = FormioUtils.getStringFromComponentPath(path);
312
319
  const matches = {
313
320
  path: undefined,
@@ -332,7 +339,8 @@ export default class NestedComponent extends Field {
332
339
  return match;
333
340
  });
334
341
  });
335
- return FormioUtils.getBestMatch(matches)?.instance;
342
+ this.componentMatches[path] = FormioUtils.getBestMatch(matches)?.instance;
343
+ return this.componentMatches[path];
336
344
  }
337
345
  /**
338
346
  * Return a component provided the Id of the component.
@@ -526,8 +534,7 @@ export default class NestedComponent extends Field {
526
534
  container = container || this.component.components;
527
535
  element = this.hook('attachComponents', element, components, container, this);
528
536
  if (!element) {
529
- // Return a non-resolving promise.
530
- return (new Promise(() => { }));
537
+ return Promise.resolve();
531
538
  }
532
539
  let index = 0;
533
540
  const promises = [];
@@ -552,6 +559,9 @@ export default class NestedComponent extends Field {
552
559
  if (this.componentsMap[component.path]) {
553
560
  delete this.componentsMap[component.path];
554
561
  }
562
+ if (this.root?.componentsMap[component.path]) {
563
+ delete this.root?.componentsMap[component.path];
564
+ }
555
565
  }
556
566
  /**
557
567
  * Removes a component provided the API key of that component.
@@ -795,8 +805,10 @@ export default class NestedComponent extends Field {
795
805
  return this.data;
796
806
  }
797
807
  resetValue() {
798
- super.resetValue();
808
+ // Reset values of child components first, then reset the parent one, otherwise it will restore the default
809
+ // value of parent component and clear it one by one while resetting child components
799
810
  this.getComponents().forEach((comp) => comp.resetValue());
811
+ super.resetValue();
800
812
  this.setPristine(true);
801
813
  }
802
814
  get dataReady() {
@@ -808,7 +820,7 @@ export default class NestedComponent extends Field {
808
820
  return false;
809
821
  }
810
822
  if (component.type === 'components') {
811
- if (component.tree && component.hasValue(value)) {
823
+ if ((component.tree || component.hasInput) && component.hasValue(value)) {
812
824
  return component.setValue(_.get(value, component.key), flags);
813
825
  }
814
826
  return component.setValue(value, flags);
@@ -245,7 +245,7 @@ export default class AddressComponent extends ContainerComponent {
245
245
  if (this.manualMode) {
246
246
  this.restoreComponentsContext();
247
247
  }
248
- if (changed || !_.isEmpty(value) && flags.fromSubmission) {
248
+ if (changed || !_.isEmpty(value) && flags.fromSubmission || flags.resetValue) {
249
249
  this.redraw();
250
250
  }
251
251
  return changed;
@@ -564,11 +564,11 @@ export default class AddressComponent extends ContainerComponent {
564
564
  }
565
565
  if (valueInManualMode) {
566
566
  if (this.component.manualModeViewString) {
567
- return this.interpolate(this.component.manualModeViewString, {
567
+ return this.evaluate(this.component.manualModeViewString, {
568
568
  address,
569
- data: this.data,
569
+ data: value,
570
570
  component: this.component,
571
- });
571
+ }, 'value');
572
572
  }
573
573
  return this.getComponents()
574
574
  .filter((component) => component.hasValue(address))
@@ -142,7 +142,7 @@ export default [
142
142
  key: 'manualModeViewString',
143
143
  label: 'Manual Mode View String',
144
144
  placeholder: 'Enter Manual Mode View String',
145
- description: '"address" variable references component value, "data" - submission data and "component" - address component schema.',
145
+ description: '"data.address" references component value and "component" - address component schema.',
146
146
  weight: 60,
147
147
  rows: 5,
148
148
  editor: 'ace',
@@ -415,12 +415,16 @@ export default class DataGridComponent extends NestedArrayComponent {
415
415
  }
416
416
  updateComponentsRowIndex(components, rowIndex) {
417
417
  components.forEach((component, colIndex) => {
418
+ if (this.componentsMap[component.paths.dataPath]) {
419
+ delete this.componentsMap[component.paths.dataPath];
420
+ }
418
421
  if (component.options?.name) {
419
422
  const newName = `[${this.key}][${rowIndex}]`;
420
423
  component.options.name = component.options.name.replace(`[${this.key}][${component.rowIndex}]`, newName);
421
424
  }
422
425
  component.rowIndex = rowIndex;
423
426
  component.row = `${rowIndex}-${colIndex}`;
427
+ this.componentsMap[component.paths.dataPath] = component;
424
428
  });
425
429
  }
426
430
  updateRowsComponents(rowIndex) {
@@ -492,7 +496,13 @@ export default class DataGridComponent extends NestedArrayComponent {
492
496
  const formComp = getComponent(this.component.components, changed.component.key);
493
497
  _.set(formComp, 'components', changed.component.components);
494
498
  }
495
- this.triggerChange({ modified });
499
+ // If we're in a nested form we need to ensure our changes are triggered upstream
500
+ if (changed.instance.root?.id && (this.root?.id !== changed.instance.root.id)) {
501
+ changed.instance.root.triggerChange(flags, changed, modified);
502
+ }
503
+ else {
504
+ this.triggerChange({ modified });
505
+ }
496
506
  };
497
507
  let columnComponent;
498
508
  if (this.builderMode) {
@@ -73,10 +73,10 @@ export default class EditGridComponent extends NestedArrayComponent {
73
73
  rowIndex: any;
74
74
  } | undefined;
75
75
  emptyRow: any;
76
- addRowModal(rowIndex: any): Promise<any>;
76
+ addRowModal(rowIndex: any): Promise<void> | Promise<any[]>;
77
77
  alert: Alert | null | undefined;
78
78
  showDialog(rowIndex: any): Promise<any>;
79
- editRow(rowIndex: any): Promise<any>;
79
+ editRow(rowIndex: any): Promise<void> | Promise<any[]>;
80
80
  clearErrors(rowIndex: any): void;
81
81
  cancelRow(rowIndex: any): void;
82
82
  saveRow(rowIndex: any, modified: any): boolean | undefined;
@@ -101,7 +101,6 @@ export default class EditGridComponent extends NestedArrayComponent {
101
101
  changeState(changed: any, flags: any): void;
102
102
  openWhenEmpty(): void;
103
103
  restoreRowContext(editRow: any, flags?: {}): void;
104
- emptyRows(): void;
105
104
  hasChanged: (newValue: any, oldValue: any) => boolean;
106
105
  }
107
106
  import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
@@ -1192,13 +1192,5 @@ export default class EditGridComponent extends NestedArrayComponent {
1192
1192
  this.setNestedValue(component, editRow.data, flags);
1193
1193
  });
1194
1194
  }
1195
- emptyRows() {
1196
- this.editRows.forEach((editRow, index) => this.destroyComponents(false, index));
1197
- this.editRows = [];
1198
- }
1199
- resetValue() {
1200
- super.resetValue();
1201
- this.emptyRows();
1202
- }
1203
1195
  }
1204
1196
  EditGridComponent.prototype.hasChanged = Component.prototype.hasChanged;
@@ -29,7 +29,7 @@ export default class FormComponent extends Component {
29
29
  * Prints out the value of form components as a datagrid value.
30
30
  */
31
31
  getValueAsString(value: any, options: any): any;
32
- attach(element: any): Promise<void>;
32
+ attach(element: any): Promise<any>;
33
33
  get hasLoadedForm(): any;
34
34
  get isRevisionChanged(): any;
35
35
  get subFormData(): any;
@@ -42,6 +42,7 @@ export default class FormComponent extends Component {
42
42
  everyComponent(...args: any[]): any;
43
43
  setSubFormDisabled(subForm: any): void;
44
44
  updateSubWizards(subForm: any): void;
45
+ setComponentsMap(): void;
45
46
  /**
46
47
  * Create a subform instance.
47
48
  * @param {boolean} [fromAttach] - This function is being called from an `attach` method.
@@ -286,29 +286,35 @@ export default class FormComponent extends Component {
286
286
  return;
287
287
  }
288
288
  this.setContent(element, this.render());
289
+ const postAttach = () => {
290
+ if (!this.builderMode && this.component.modalEdit) {
291
+ const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
292
+ const currentValue = modalShouldBeOpened ? this.componentModal.currentValue : this.dataValue;
293
+ this.componentModal = new ComponentModal(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
294
+ this.subForm.element = this.componentModal.refs.componentContent || this.subForm.element;
295
+ this.setOpenModalElement();
296
+ }
297
+ this.calculateValue();
298
+ };
289
299
  if (this.subForm) {
290
300
  if (this.isNestedWizard) {
291
301
  element = this.root.element;
292
302
  }
293
- this.subForm.attach(element);
294
- this.valueChanged = this.hasSetValue;
295
- if (!this.shouldConditionallyClear()) {
296
- if (!this.valueChanged && this.dataValue.state !== 'submitted') {
297
- this.setDefaultValue();
298
- }
299
- else {
300
- this.restoreValue();
303
+ return this.subForm.attach(element).then(() => {
304
+ this.valueChanged = this.hasSetValue;
305
+ if (!this.shouldConditionallyClear()) {
306
+ if (!this.valueChanged && this.dataValue.state !== 'submitted') {
307
+ this.setDefaultValue();
308
+ }
309
+ else {
310
+ this.restoreValue();
311
+ }
301
312
  }
302
- }
303
- }
304
- if (!this.builderMode && this.component.modalEdit) {
305
- const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
306
- const currentValue = modalShouldBeOpened ? this.componentModal.currentValue : this.dataValue;
307
- this.componentModal = new ComponentModal(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
308
- this.subForm.element = this.componentModal.refs.componentContent || this.subForm.element;
309
- this.setOpenModalElement();
313
+ postAttach();
314
+ this.setComponentsMap();
315
+ });
310
316
  }
311
- this.calculateValue();
317
+ postAttach();
312
318
  });
313
319
  });
314
320
  }
@@ -384,6 +390,14 @@ export default class FormComponent extends Component {
384
390
  this.emit('subWizardsUpdated', subForm);
385
391
  }
386
392
  }
393
+ setComponentsMap() {
394
+ if (!this.subForm) {
395
+ return;
396
+ }
397
+ const componentsMap = this.componentsMap;
398
+ const formComponentsMap = this.subForm.componentsMap;
399
+ _.assign(componentsMap, formComponentsMap);
400
+ }
387
401
  /**
388
402
  * Create a subform instance.
389
403
  * @param {boolean} [fromAttach] - This function is being called from an `attach` method.
@@ -408,9 +422,7 @@ export default class FormComponent extends Component {
408
422
  this.subForm = instance;
409
423
  this.subForm.currentForm = this;
410
424
  this.subForm.parentVisible = this.visible;
411
- const componentsMap = this.componentsMap;
412
- const formComponentsMap = this.subForm.componentsMap;
413
- _.assign(componentsMap, formComponentsMap);
425
+ this.setComponentsMap();
414
426
  this.component.components = this.subForm._form?.components;
415
427
  this.component.display = this.subForm._form?.display;
416
428
  this.subForm.on('change', () => {
@@ -89,10 +89,13 @@ export default class NumberComponent extends Input {
89
89
  }
90
90
  get defaultValue() {
91
91
  let defaultValue = super.defaultValue;
92
- if (typeof defaultValue === 'string') {
92
+ if (typeof defaultValue === 'string' && defaultValue) {
93
93
  // Default value may be a string or have custom thousands separators or decimal symbols, so we need to call
94
94
  // parseNumber on it
95
95
  defaultValue = this.parseNumber(defaultValue);
96
+ if (_.isNaN(defaultValue)) {
97
+ defaultValue = null;
98
+ }
96
99
  }
97
100
  if (!defaultValue && this.component.defaultValue === 0) {
98
101
  defaultValue = this.component.defaultValue;
@@ -16,6 +16,7 @@ export default class RadioComponent extends ListComponent {
16
16
  static savedValueTypes(schema: any): any[];
17
17
  constructor(component: any, options: any, data: any);
18
18
  previousValue: any;
19
+ uncheckValue(flags?: {}): void;
19
20
  get inputInfo(): any;
20
21
  get emptyValue(): string;
21
22
  get isRadio(): boolean;
@@ -80,13 +80,15 @@ export default class RadioComponent extends ListComponent {
80
80
  }
81
81
  return defaultValue;
82
82
  }
83
- resetValue() {
83
+ uncheckValue(flags = {}) {
84
84
  this.unset();
85
85
  this.setValue(this.emptyValue, {
86
86
  noUpdateEvent: true,
87
87
  noValidate: true,
88
88
  resetValue: true
89
89
  });
90
+ this.triggerChange(flags);
91
+ this.setSelectedClasses();
90
92
  }
91
93
  get inputInfo() {
92
94
  const info = super.elementInfo();
@@ -142,7 +144,7 @@ export default class RadioComponent extends ListComponent {
142
144
  });
143
145
  this.optionsLoaded = !this.component.dataSrc || this.component.dataSrc === 'values';
144
146
  this.loadedOptions = [];
145
- if (!this.visible) {
147
+ if (!this.visible || this.optionsLoaded) {
146
148
  this.itemsLoadedResolve();
147
149
  }
148
150
  // Get the template keys for this radio component.
@@ -400,9 +402,7 @@ export default class RadioComponent extends ListComponent {
400
402
  this.currentValue = this.dataValue;
401
403
  const shouldResetValue = flags && flags.modified && !flags.noUpdateEvent && this.previousValue === this.currentValue;
402
404
  if (shouldResetValue) {
403
- this.resetValue();
404
- this.triggerChange(flags);
405
- this.setSelectedClasses();
405
+ this.uncheckValue(flags);
406
406
  }
407
407
  this.previousValue = this.dataValue;
408
408
  return changed;
@@ -1154,7 +1154,7 @@ export default class SelectComponent extends ListComponent {
1154
1154
  }
1155
1155
  // Choices will return undefined if nothing is selected. We really want '' to be empty.
1156
1156
  if (value === undefined || value === null) {
1157
- value = '';
1157
+ value = this.emptyValue;
1158
1158
  }
1159
1159
  return value;
1160
1160
  }
@@ -158,6 +158,13 @@ export default class TagsComponent extends Input {
158
158
  this.refs.input[0].parentNode.lastChild.focus();
159
159
  }
160
160
  }
161
+ getValue() {
162
+ if (this.choices) {
163
+ const value = this.choices.getValue(true);
164
+ return value.join(`${this.delimiter}`);
165
+ }
166
+ return super.getValue();
167
+ }
161
168
  getValueAsString(value) {
162
169
  if (!value) {
163
170
  return '';
@@ -23,4 +23,5 @@ import { Formio } from './Formio';
23
23
  import Licenses from './licenses';
24
24
  import EventEmitter from './EventEmitter';
25
25
  import Webform from './Webform';
26
- export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform };
26
+ import { DefaultEvaluator } from './utils';
27
+ export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform, DefaultEvaluator };
@@ -12,7 +12,7 @@ import Licenses from './licenses';
12
12
  import EventEmitter from './EventEmitter';
13
13
  import Webform from './Webform';
14
14
  import { I18n } from '@formio/core';
15
- import { Evaluator, registerEvaluator } from './utils';
15
+ import { Evaluator, registerEvaluator, DefaultEvaluator } from './utils';
16
16
  Formio.loadModules = (path = `${Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
17
17
  Formio.requireLibrary(name, name, path, true)
18
18
  .then((modules) => {
@@ -130,4 +130,4 @@ export function useModule(defaultFn = null) {
130
130
  Formio.use = useModule();
131
131
  export { Formio as FormioCore } from './Formio';
132
132
  // Export the components.
133
- export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform };
133
+ export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform, DefaultEvaluator };
@@ -125,13 +125,17 @@ function url(formio) {
125
125
  deleteFile(fileInfo, options) {
126
126
  return new Promise((resolve, reject) => {
127
127
  const xhr = new XMLHttpRequest();
128
- xhr.open('DELETE', fileInfo.url, true);
128
+ xhr.open("DELETE", fileInfo.url, true);
129
+ const token = formio.getToken();
130
+ if (token) {
131
+ xhr.setRequestHeader("x-jwt-token", token);
132
+ }
129
133
  xhr.onload = () => {
130
134
  if (xhr.status >= 200 && xhr.status < 300) {
131
- resolve('File deleted');
135
+ resolve("File deleted");
132
136
  }
133
137
  else {
134
- reject(xhr.response || 'Unable to delete file');
138
+ reject(xhr.response || "Unable to delete file");
135
139
  }
136
140
  };
137
141
  if (options) {
@@ -26,10 +26,10 @@ export const getBestMatch: typeof Utils.getBestMatch;
26
26
  export const getComponentFromPath: typeof Utils.getComponentFromPath;
27
27
  export const getComponentValue: typeof Utils.getComponentValue;
28
28
  export const findComponents: typeof Utils.findComponents;
29
- export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => Promise<void>;
30
- export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => void;
29
+ export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataAsyncCallback | undefined) => Promise<void>;
30
+ export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataCallback | undefined) => void;
31
31
  export const getComponentKey: typeof Utils.getComponentKey;
32
- export const getContextualRowPath: typeof Utils.getContextualRowPath;
32
+ export const getContextualRowPath: any;
33
33
  export const getContextualRowData: typeof Utils.getContextualRowData;
34
34
  export const componentInfo: typeof Utils.componentInfo;
35
35
  export const eachComponent: typeof Utils.eachComponent;
@@ -2,7 +2,7 @@ export * from "./utils";
2
2
  export * from "./formUtils";
3
3
  export default FormioUtils;
4
4
  declare const FormioUtils: {
5
- Evaluator: import("./Evaluator").DefaultEvaluator;
5
+ Evaluator: DefaultEvaluator;
6
6
  interpolate: typeof interpolate;
7
7
  ConditionOperators: {
8
8
  [x: string]: typeof import("./conditionOperators/IsEqualTo").default | typeof import("./conditionOperators/DateGreaterThan").default;
@@ -37,10 +37,10 @@ declare const FormioUtils: {
37
37
  getComponentFromPath: typeof import("@formio/core/lib/utils/formUtil").getComponentFromPath;
38
38
  getComponentValue: typeof import("@formio/core/lib/utils/formUtil").getComponentValue;
39
39
  findComponents: typeof import("@formio/core/lib/utils/formUtil").findComponents;
40
- eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => Promise<void>;
41
- eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => void;
40
+ eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataAsyncCallback | undefined) => Promise<void>;
41
+ eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataCallback | undefined) => void;
42
42
  getComponentKey: typeof import("@formio/core/lib/utils/formUtil").getComponentKey;
43
- getContextualRowPath: typeof import("@formio/core/lib/utils/formUtil").getContextualRowPath;
43
+ getContextualRowPath: any;
44
44
  getContextualRowData: typeof import("@formio/core/lib/utils/formUtil").getContextualRowData;
45
45
  componentInfo: typeof import("@formio/core/lib/utils/formUtil").componentInfo;
46
46
  eachComponent: typeof import("@formio/core/lib/utils/formUtil").eachComponent;
@@ -164,7 +164,8 @@ declare const FormioUtils: {
164
164
  interpolateErrors: (component: Component, errors: FieldError[], interpolateFn: Function) => [];
165
165
  };
166
166
  import { Evaluator } from './Evaluator';
167
+ import { DefaultEvaluator } from './Evaluator';
167
168
  import { registerEvaluator } from './Evaluator';
168
169
  import { interpolate } from './Evaluator';
169
170
  import moment from 'moment';
170
- export { FormioUtils as Utils, Evaluator, registerEvaluator };
171
+ export { FormioUtils as Utils, Evaluator, DefaultEvaluator, registerEvaluator };
@@ -1,6 +1,6 @@
1
1
  import * as utils from './utils';
2
2
  import * as formUtils from './formUtils';
3
- import { Evaluator, registerEvaluator, interpolate } from './Evaluator';
3
+ import { Evaluator, registerEvaluator, interpolate, DefaultEvaluator } from './Evaluator';
4
4
  import ConditionOperators from './conditionOperators';
5
5
  import _ from 'lodash';
6
6
  import moment from 'moment';
@@ -17,7 +17,7 @@ if (typeof global === 'object') {
17
17
  global.FormioUtils = FormioUtils;
18
18
  }
19
19
  export { FormioUtils as Utils };
20
- export { Evaluator, registerEvaluator };
20
+ export { Evaluator, DefaultEvaluator, registerEvaluator };
21
21
  export * from './utils';
22
22
  export * from './formUtils';
23
23
  export default FormioUtils;
@@ -1,4 +1,3 @@
1
- /* global jQuery */
2
1
  import _ from 'lodash';
3
2
  import moment from 'moment-timezone/moment-timezone';
4
3
  import jtz from 'jstimezonedetect';
@@ -1014,9 +1013,6 @@ export function bootstrapVersion(options) {
1014
1013
  if (options.bootstrap) {
1015
1014
  return options.bootstrap;
1016
1015
  }
1017
- if ((typeof jQuery === 'function') && (typeof jQuery().collapse === 'function')) {
1018
- return parseInt(jQuery.fn.collapse.Constructor.VERSION.split('.')[0], 10);
1019
- }
1020
1016
  if (window.bootstrap && window.bootstrap.Collapse) {
1021
1017
  return parseInt(window.bootstrap.Collapse.VERSION.split('.')[0], 10);
1022
1018
  }
@@ -115,7 +115,14 @@ export default class CalendarWidget extends InputWidget {
115
115
  if (this._input) {
116
116
  const { locale } = this.settings;
117
117
  if (locale && locale.length >= 2 && locale !== 'en') {
118
- return Formio.requireLibrary(`flatpickr-${locale}`, `flatpickr.l10ns.${locale}`, `${Formio.cdn['flatpickr']}/l10n/${locale}.js`, true).then(() => this.initFlatpickr(Flatpickr));
118
+ return Formio.requireLibrary(`flatpickr-${locale}`, `flatpickr.l10ns.${locale}`, `${Formio.cdn['flatpickr']}/l10n/${locale}.js`, true)
119
+ .catch(() => {
120
+ // fallback to en if locale fails to load
121
+ this.settings.locale = 'en';
122
+ })
123
+ .finally(() => {
124
+ this.initFlatpickr(Flatpickr);
125
+ });
119
126
  }
120
127
  else {
121
128
  this.initFlatpickr(Flatpickr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6112.86987a5",
3
+ "version": "5.1.0-dev.6112.b627acb",
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
  "homepage": "https://github.com/formio/formio.js#readme",
82
82
  "dependencies": {
83
83
  "@formio/bootstrap": "v3.0.0-dev.121.085d187",
84
- "@formio/core": "2.4.0-dev.267.2866472",
84
+ "@formio/core": "2.5.1-rc.6",
85
85
  "@formio/text-mask-addons": "3.8.0-formio.4",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",