@formio/js 5.0.0-dev.5749.8f49547 → 5.0.0-dev.5754.c86e9f5

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 (47) hide show
  1. package/Changelog.md +9 -0
  2. package/dist/formio.form.js +35 -15
  3. package/dist/formio.form.min.js +1 -1
  4. package/dist/formio.form.min.js.LICENSE.txt +2 -0
  5. package/dist/formio.full.js +37 -17
  6. package/dist/formio.full.min.js +1 -1
  7. package/dist/formio.full.min.js.LICENSE.txt +2 -0
  8. package/dist/formio.utils.js +24 -4
  9. package/dist/formio.utils.min.js +1 -1
  10. package/dist/formio.utils.min.js.LICENSE.txt +2 -0
  11. package/lib/cjs/Form.js +2 -2
  12. package/lib/cjs/Wizard.js +1 -1
  13. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  14. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +6 -0
  15. package/lib/cjs/components/datagrid/DataGrid.js +1 -0
  16. package/lib/cjs/components/datagrid/fixtures/comp11.d.ts +50 -0
  17. package/lib/cjs/components/datagrid/fixtures/comp11.js +55 -0
  18. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  19. package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
  20. package/lib/cjs/components/editgrid/EditGrid.js +1 -0
  21. package/lib/cjs/components/file/File.d.ts +1 -1
  22. package/lib/cjs/components/file/File.js +6 -1
  23. package/lib/cjs/components/form/editForm/Form.edit.form.js +1 -1
  24. package/lib/cjs/components/form/fixtures/index.d.ts +2 -1
  25. package/lib/cjs/components/form/fixtures/index.js +3 -1
  26. package/lib/cjs/components/form/fixtures/nestedWizardForm.d.ts +771 -0
  27. package/lib/cjs/components/form/fixtures/nestedWizardForm.js +765 -0
  28. package/lib/cjs/components/time/Time.form.js +2 -2
  29. package/lib/mjs/Form.js +2 -2
  30. package/lib/mjs/Wizard.js +1 -1
  31. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  32. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +6 -0
  33. package/lib/mjs/components/datagrid/DataGrid.js +1 -0
  34. package/lib/mjs/components/datagrid/fixtures/comp11.d.ts +50 -0
  35. package/lib/mjs/components/datagrid/fixtures/comp11.js +53 -0
  36. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  37. package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
  38. package/lib/mjs/components/editgrid/EditGrid.js +1 -0
  39. package/lib/mjs/components/file/File.d.ts +1 -1
  40. package/lib/mjs/components/file/File.js +6 -1
  41. package/lib/mjs/components/form/editForm/Form.edit.form.js +1 -1
  42. package/lib/mjs/components/form/fixtures/index.d.ts +2 -1
  43. package/lib/mjs/components/form/fixtures/index.js +2 -1
  44. package/lib/mjs/components/form/fixtures/nestedWizardForm.d.ts +771 -0
  45. package/lib/mjs/components/form/fixtures/nestedWizardForm.js +763 -0
  46. package/lib/mjs/components/time/Time.form.js +2 -2
  47. package/package.json +4 -4
@@ -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
- const Component_form_1 = __importDefault(require("../_classes/component/Component.form"));
6
+ const Components_1 = __importDefault(require("../Components"));
7
7
  const Time_edit_data_1 = __importDefault(require("./editForm/Time.edit.data"));
8
8
  const Time_edit_display_1 = __importDefault(require("./editForm/Time.edit.display"));
9
9
  /**
@@ -12,7 +12,7 @@ const Time_edit_display_1 = __importDefault(require("./editForm/Time.edit.displa
12
12
  * @returns {import('@formio/core').Component[]} - The edit form components.
13
13
  */
14
14
  function default_1(...extend) {
15
- return (0, Component_form_1.default)([
15
+ return Components_1.default.baseEditForm([
16
16
  {
17
17
  key: 'data',
18
18
  components: Time_edit_data_1.default,
package/lib/mjs/Form.js CHANGED
@@ -134,13 +134,13 @@ export default class Form extends Element {
134
134
  else {
135
135
  this.element = null;
136
136
  }
137
+ this.options = formOptions;
138
+ this.options.events = this.events;
137
139
  if (form) {
138
140
  this.setForm(form)
139
141
  .then(() => this.readyResolve(this.instance))
140
142
  .catch(this.readyReject);
141
143
  }
142
- this.options = formOptions;
143
- this.options.events = this.events;
144
144
  this.display = '';
145
145
  }
146
146
  createElement(tag, attrs, children) {
package/lib/mjs/Wizard.js CHANGED
@@ -13,7 +13,7 @@ export default class Wizard extends Webform {
13
13
  */
14
14
  constructor(elementOrOptions = undefined, _options = undefined) {
15
15
  let element, options;
16
- if (elementOrOptions instanceof HTMLElement || options) {
16
+ if (elementOrOptions instanceof HTMLElement || _options) {
17
17
  element = elementOrOptions;
18
18
  options = _options || {};
19
19
  }
@@ -15,5 +15,6 @@ export default class NestedArrayComponent extends NestedDataComponent {
15
15
  _getEmailTableHeader(options: any): string;
16
16
  _getEmailTableBody(options: any): string;
17
17
  getComponents(rowIndex: any): any;
18
+ removeSubmissionMetadataRow(index: any): void;
18
19
  }
19
20
  import NestedDataComponent from '../nesteddata/NestedDataComponent';
@@ -214,4 +214,10 @@ export default class NestedArrayComponent extends NestedDataComponent {
214
214
  }
215
215
  return super.getComponents();
216
216
  }
217
+ removeSubmissionMetadataRow(index) {
218
+ const componentMetadata = _.get(this.root, `submission.metadata.selectData.${this.path}`, null);
219
+ if (_.isArray(componentMetadata)) {
220
+ componentMetadata.splice(index, 1);
221
+ }
222
+ }
217
223
  }
@@ -436,6 +436,7 @@ export default class DataGridComponent extends NestedArrayComponent {
436
436
  this.splice(index, flags);
437
437
  this.emit('dataGridDeleteRow', { index });
438
438
  const [row] = this.rows.splice(index, 1);
439
+ this.removeSubmissionMetadataRow(index);
439
440
  this.removeRowComponents(row);
440
441
  this.updateRowsComponents(index);
441
442
  this.setValue(this.dataValue, flags);
@@ -0,0 +1,50 @@
1
+ declare namespace _default {
2
+ let title: string;
3
+ let name: string;
4
+ let path: string;
5
+ let type: string;
6
+ let display: string;
7
+ let components: ({
8
+ label: string;
9
+ reorder: boolean;
10
+ addAnotherPosition: string;
11
+ layoutFixed: boolean;
12
+ enableRowGroups: boolean;
13
+ initEmpty: boolean;
14
+ tableView: boolean;
15
+ key: string;
16
+ type: string;
17
+ input: boolean;
18
+ components: {
19
+ label: string;
20
+ widget: string;
21
+ tableView: boolean;
22
+ data: {
23
+ values: {
24
+ label: string;
25
+ value: string;
26
+ }[];
27
+ };
28
+ validateWhenHidden: boolean;
29
+ key: string;
30
+ type: string;
31
+ input: boolean;
32
+ defaultValue: string;
33
+ }[];
34
+ disableOnInvalid?: undefined;
35
+ } | {
36
+ type: string;
37
+ label: string;
38
+ key: string;
39
+ disableOnInvalid: boolean;
40
+ input: boolean;
41
+ tableView: boolean;
42
+ reorder?: undefined;
43
+ addAnotherPosition?: undefined;
44
+ layoutFixed?: undefined;
45
+ enableRowGroups?: undefined;
46
+ initEmpty?: undefined;
47
+ components?: undefined;
48
+ })[];
49
+ }
50
+ export default _default;
@@ -0,0 +1,53 @@
1
+ export default {
2
+ title: 'Select in Data Grid',
3
+ name: 'selectInDataGrid',
4
+ path: 'selectInDataGrid',
5
+ type: 'form',
6
+ display: 'form',
7
+ components: [
8
+ {
9
+ label: 'Data Grid',
10
+ reorder: false,
11
+ addAnotherPosition: 'bottom',
12
+ layoutFixed: false,
13
+ enableRowGroups: false,
14
+ initEmpty: false,
15
+ tableView: false,
16
+ key: 'dataGrid',
17
+ type: 'datagrid',
18
+ input: true,
19
+ components: [
20
+ {
21
+ label: 'Select',
22
+ widget: 'choicesjs',
23
+ tableView: true,
24
+ data: {
25
+ values: [
26
+ {
27
+ label: 'Individual',
28
+ value: 'individual'
29
+ },
30
+ {
31
+ label: 'Entity',
32
+ value: 'entity'
33
+ }
34
+ ]
35
+ },
36
+ validateWhenHidden: false,
37
+ key: 'select',
38
+ type: 'select',
39
+ input: true,
40
+ defaultValue: 'entity'
41
+ },
42
+ ]
43
+ },
44
+ {
45
+ type: 'button',
46
+ label: 'Submit',
47
+ key: 'submit',
48
+ disableOnInvalid: true,
49
+ input: true,
50
+ tableView: false
51
+ }
52
+ ]
53
+ };
@@ -8,6 +8,7 @@ import comp7 from './comp7';
8
8
  import comp8 from './comp8';
9
9
  import comp9 from './comp9';
10
10
  import comp10 from './comp10';
11
+ import comp11 from './comp11';
11
12
  import withCollapsibleRowGroups from './comp-with-collapsible-groups';
12
13
  import withConditionalFieldsAndValidations from './comp-with-conditional-components-and-validations';
13
14
  import withDefValue from './comp-with-def-value';
@@ -18,4 +19,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
18
19
  import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
19
20
  import withCheckboxes from './comp-with-checkboxes';
20
21
  import withReorder from './comp-with-reorder';
21
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
22
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
@@ -8,6 +8,7 @@ import comp7 from './comp7';
8
8
  import comp8 from './comp8';
9
9
  import comp9 from './comp9';
10
10
  import comp10 from './comp10';
11
+ import comp11 from './comp11';
11
12
  import withDefValue from './comp-with-def-value';
12
13
  import withRowGroupsAndDefValue from './comp-row-groups-with-def-value';
13
14
  import modalWithRequiredFields from './comp-modal-with-required-fields';
@@ -18,4 +19,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
18
19
  import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
19
20
  import withCheckboxes from './comp-with-checkboxes';
20
21
  import withReorder from './comp-with-reorder';
21
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
22
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
@@ -885,6 +885,7 @@ export default class EditGridComponent extends NestedArrayComponent {
885
885
  }
886
886
  this.clearErrors(rowIndex);
887
887
  this.baseRemoveRow(rowIndex);
888
+ this.removeSubmissionMetadataRow(rowIndex);
888
889
  this.splice(rowIndex);
889
890
  this.emit('editGridDeleteRow', {
890
891
  index: rowIndex
@@ -33,7 +33,7 @@ export default class FileComponent extends Field {
33
33
  get dataReady(): Promise<any>;
34
34
  loadImage(fileInfo: any): any;
35
35
  get emptyValue(): never[];
36
- getValueAsString(value: any): any;
36
+ getValueAsString(value: any, options: any): any;
37
37
  get defaultValue(): any[];
38
38
  get hasTypes(): any;
39
39
  _fileBrowseHidden: any;
@@ -103,7 +103,12 @@ export default class FileComponent extends Field {
103
103
  get emptyValue() {
104
104
  return [];
105
105
  }
106
- getValueAsString(value) {
106
+ getValueAsString(value, options) {
107
+ if (options?.review && !this.component.uploadOnly) {
108
+ return _.map(value, (val, index) => {
109
+ return `<a href="${val.url || '#'}" target="_blank" data-path='${this.path}' data-fileindex='${index}'>${val.originalName}</a>`;
110
+ }).join(', ');
111
+ }
107
112
  if (_.isArray(value)) {
108
113
  return _.map(value, 'originalName').join(', ');
109
114
  }
@@ -44,7 +44,7 @@ export default [
44
44
  },
45
45
  searchField: 'title__regex',
46
46
  template: '<span>{{ item._vid }}</span>',
47
- valueProperty: '_id',
47
+ valueProperty: 'revisionId',
48
48
  authenticate: true,
49
49
  label: 'Form Revision',
50
50
  key: 'revision',
@@ -7,4 +7,5 @@ import comp5 from './comp5';
7
7
  import comp6 from './comp6';
8
8
  import comp7 from './comp7';
9
9
  import comp8 from './comp8';
10
- export { formModalEdit, comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
10
+ import nestedWizardForm from './nestedWizardForm';
11
+ export { formModalEdit, comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, nestedWizardForm };
@@ -7,4 +7,5 @@ import comp5 from './comp5';
7
7
  import comp6 from './comp6';
8
8
  import comp7 from './comp7';
9
9
  import comp8 from './comp8';
10
- export { formModalEdit, comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
10
+ import nestedWizardForm from './nestedWizardForm';
11
+ export { formModalEdit, comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, nestedWizardForm };