@formio/js 5.2.1-dev.6186.ffe4f6c → 5.2.1-dev.6228.7172789

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 (57) hide show
  1. package/Changelog.md +49 -0
  2. package/dist/formio.embed.js +1 -1
  3. package/dist/formio.embed.min.js +1 -1
  4. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  5. package/dist/formio.form.js +17 -17
  6. package/dist/formio.form.min.js +1 -1
  7. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  8. package/dist/formio.full.js +18 -18
  9. package/dist/formio.full.min.js +1 -1
  10. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  11. package/dist/formio.js +3 -3
  12. package/dist/formio.min.js +1 -1
  13. package/dist/formio.min.js.LICENSE.txt +1 -1
  14. package/dist/formio.utils.js +2 -2
  15. package/dist/formio.utils.min.js +1 -1
  16. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  17. package/lib/cjs/Element.js +2 -2
  18. package/lib/cjs/Embed.js +1 -1
  19. package/lib/cjs/Formio.js +1 -1
  20. package/lib/cjs/Webform.js +8 -0
  21. package/lib/cjs/WebformBuilder.d.ts +1 -0
  22. package/lib/cjs/WebformBuilder.js +26 -3
  23. package/lib/cjs/Wizard.js +7 -6
  24. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -1
  25. package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -2
  26. package/lib/cjs/components/datagrid/DataGrid.js +8 -1
  27. package/lib/cjs/components/editgrid/EditGrid.d.ts +2 -2
  28. package/lib/cjs/components/form/Form.d.ts +2 -1
  29. package/lib/cjs/components/form/Form.js +32 -20
  30. package/lib/cjs/components/radio/Radio.js +1 -1
  31. package/lib/cjs/components/select/Select.js +1 -1
  32. package/lib/cjs/components/tags/Tags.js +7 -0
  33. package/lib/cjs/formio.form.d.ts +2 -1
  34. package/lib/cjs/formio.form.js +2 -1
  35. package/lib/cjs/utils/index.d.ts +3 -2
  36. package/lib/cjs/utils/index.js +2 -1
  37. package/lib/mjs/Element.js +2 -2
  38. package/lib/mjs/Embed.js +1 -1
  39. package/lib/mjs/Formio.js +1 -1
  40. package/lib/mjs/Webform.js +8 -0
  41. package/lib/mjs/WebformBuilder.d.ts +1 -0
  42. package/lib/mjs/WebformBuilder.js +25 -3
  43. package/lib/mjs/Wizard.js +7 -6
  44. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -1
  45. package/lib/mjs/components/_classes/nested/NestedComponent.js +4 -2
  46. package/lib/mjs/components/datagrid/DataGrid.js +7 -1
  47. package/lib/mjs/components/editgrid/EditGrid.d.ts +2 -2
  48. package/lib/mjs/components/form/Form.d.ts +2 -1
  49. package/lib/mjs/components/form/Form.js +32 -20
  50. package/lib/mjs/components/radio/Radio.js +1 -1
  51. package/lib/mjs/components/select/Select.js +1 -1
  52. package/lib/mjs/components/tags/Tags.js +7 -0
  53. package/lib/mjs/formio.form.d.ts +2 -1
  54. package/lib/mjs/formio.form.js +2 -2
  55. package/lib/mjs/utils/index.d.ts +3 -2
  56. package/lib/mjs/utils/index.js +2 -2
  57. package/package.json +3 -3
@@ -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;
@@ -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', () => {
@@ -142,7 +142,7 @@ export default class RadioComponent extends ListComponent {
142
142
  });
143
143
  this.optionsLoaded = !this.component.dataSrc || this.component.dataSrc === 'values';
144
144
  this.loadedOptions = [];
145
- if (!this.visible) {
145
+ if (!this.visible || this.optionsLoaded) {
146
146
  this.itemsLoadedResolve();
147
147
  }
148
148
  // Get the template keys for this radio component.
@@ -1153,7 +1153,7 @@ export default class SelectComponent extends ListComponent {
1153
1153
  }
1154
1154
  // Choices will return undefined if nothing is selected. We really want '' to be empty.
1155
1155
  if (value === undefined || value === null) {
1156
- value = '';
1156
+ value = this.emptyValue;
1157
1157
  }
1158
1158
  return value;
1159
1159
  }
@@ -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 };
@@ -11,7 +11,7 @@ import Utils from './utils';
11
11
  import Licenses from './licenses';
12
12
  import EventEmitter from './EventEmitter';
13
13
  import Webform from './Webform';
14
- import { Evaluator, registerEvaluator } from './utils';
14
+ import { Evaluator, registerEvaluator, DefaultEvaluator } from './utils';
15
15
  Formio.loadModules = (path = `${Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
16
16
  Formio.requireLibrary(name, name, path, true)
17
17
  .then((modules) => {
@@ -126,4 +126,4 @@ export function useModule(defaultFn = null) {
126
126
  Formio.use = useModule();
127
127
  export { Formio as FormioCore } from './Formio';
128
128
  // Export the components.
129
- export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform };
129
+ export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform, DefaultEvaluator };
@@ -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;
@@ -163,6 +163,7 @@ declare const FormioUtils: {
163
163
  };
164
164
  import { Evaluator } from './Evaluator';
165
165
  import { registerEvaluator } from './Evaluator';
166
+ import { DefaultEvaluator } from './Evaluator';
166
167
  import { interpolate } from './Evaluator';
167
168
  import moment from 'moment';
168
- export { FormioUtils as Utils, Evaluator, registerEvaluator };
169
+ export { FormioUtils as Utils, Evaluator, registerEvaluator, DefaultEvaluator };
@@ -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, registerEvaluator, DefaultEvaluator };
21
21
  export * from './utils';
22
22
  export * from './formUtils';
23
23
  export default FormioUtils;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.2.1-dev.6186.ffe4f6c",
3
+ "version": "5.2.1-dev.6228.7172789",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -79,8 +79,8 @@
79
79
  },
80
80
  "homepage": "https://github.com/formio/formio.js#readme",
81
81
  "dependencies": {
82
- "@formio/bootstrap": "3.1.2-rc.1",
83
- "@formio/core": "2.5.1-rc.5",
82
+ "@formio/bootstrap": "3.1.2-rc.3",
83
+ "@formio/core": "2.5.1-rc.8",
84
84
  "@formio/text-mask-addons": "^3.8.0-formio.4",
85
85
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
86
86
  "abortcontroller-polyfill": "^1.7.5",