@formio/js 5.0.0-dev.5589.fd575d0 → 5.0.0-dev.5592.bb7e96a

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.
@@ -830,7 +830,9 @@ class Webform extends NestedDataComponent_1.default {
830
830
  };
831
831
  }
832
832
  // Metadata needs to be available before setValue
833
- this._submission.metadata = submission.metadata || {};
833
+ this._submission.metadata = submission.metadata
834
+ ? lodash_1.default.cloneDeep(submission.metadata)
835
+ : {};
834
836
  this.editing = !!submission._id;
835
837
  // Set the timezone in the options if available.
836
838
  if (!this.options.submissionTimezone &&
@@ -5,15 +5,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = __importDefault(require("lodash"));
7
7
  const utils_1 = require("../../../utils/utils");
8
- const calculateSelectData = (context) => {
8
+ const calculateSingleSelectData = (context, defaultValue) => {
9
9
  const { instance, data } = context;
10
- const rawDefaultValue = instance.downloadedResources.find(resource => lodash_1.default.get(resource, data.valueProperty) === instance.getValue());
10
+ const rawDefaultValue = instance.downloadedResources.find(resource => lodash_1.default.get(resource, data.valueProperty) === defaultValue);
11
11
  const options = { data: {}, noeval: true };
12
12
  instance.interpolate(data.template, {
13
13
  item: rawDefaultValue,
14
14
  }, options);
15
15
  return options.data.item;
16
16
  };
17
+ const calculateSelectData = (context) => {
18
+ const { instance } = context;
19
+ const defaultValue = instance.getValue();
20
+ if (instance.component.multiple) {
21
+ const multiSelectData = {};
22
+ (defaultValue !== null && defaultValue !== void 0 ? defaultValue : []).forEach((defaultValueItem) => {
23
+ multiSelectData[defaultValueItem] = calculateSingleSelectData(context, defaultValueItem);
24
+ });
25
+ return multiSelectData;
26
+ }
27
+ else {
28
+ return calculateSingleSelectData(context, defaultValue);
29
+ }
30
+ };
17
31
  const setSelectData = (context) => {
18
32
  // Wait before downloadedResources will be set
19
33
  setTimeout(() => {
@@ -8,7 +8,7 @@ exports.default = {
8
8
  display: 'form',
9
9
  components: [{
10
10
  label: 'Select',
11
- widget: 'choicesjs',
11
+ widget: 'html5',
12
12
  tableView: true,
13
13
  dataSrc: 'url',
14
14
  data: {
@@ -10,20 +10,30 @@ declare namespace _default {
10
10
  tableView: boolean;
11
11
  dataSrc: string;
12
12
  data: {
13
- resource: string;
14
- };
15
- template: string;
16
- validate: {
17
- select: boolean;
13
+ url: string;
14
+ headers: {
15
+ key: string;
16
+ value: string;
17
+ }[];
18
18
  };
19
+ multiple: boolean;
20
+ valueProperty: string;
21
+ validateWhenHidden: boolean;
19
22
  key: string;
20
23
  type: string;
21
- searchField: string;
22
24
  input: boolean;
25
+ defaultValue: string[];
26
+ selectValues: string;
27
+ disableLimit: boolean;
23
28
  noRefreshOnScroll: boolean;
24
- addResource: boolean;
25
- reference: boolean;
26
- valueProperty: string;
29
+ selectData: {
30
+ value1: {
31
+ label: string;
32
+ };
33
+ value3: {
34
+ label: string;
35
+ };
36
+ };
27
37
  disableOnInvalid?: undefined;
28
38
  } | {
29
39
  type: string;
@@ -35,13 +45,14 @@ declare namespace _default {
35
45
  widget?: undefined;
36
46
  dataSrc?: undefined;
37
47
  data?: undefined;
38
- template?: undefined;
39
- validate?: undefined;
40
- searchField?: undefined;
41
- noRefreshOnScroll?: undefined;
42
- addResource?: undefined;
43
- reference?: undefined;
48
+ multiple?: undefined;
44
49
  valueProperty?: undefined;
50
+ validateWhenHidden?: undefined;
51
+ defaultValue?: undefined;
52
+ selectValues?: undefined;
53
+ disableLimit?: undefined;
54
+ noRefreshOnScroll?: undefined;
55
+ selectData?: undefined;
45
56
  })[];
46
57
  }
47
58
  export default _default;
@@ -1,40 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
- title: 'FIO-8234',
5
- name: 'fio8234',
6
- path: 'fio8234',
4
+ title: 'FIO-8281',
5
+ name: 'fio8281',
6
+ path: 'fio8281',
7
7
  type: 'form',
8
8
  display: 'form',
9
- components: [
10
- {
9
+ components: [{
11
10
  label: 'Select',
12
11
  widget: 'choicesjs',
13
12
  tableView: true,
14
- dataSrc: 'resource',
13
+ dataSrc: 'url',
15
14
  data: {
16
- resource: '665446284c9b0163c3e0c7e6',
17
- },
18
- template: '<span>{{ item.data.textField1 }}</span>',
19
- validate: {
20
- select: false,
15
+ url: 'https://fake_url.com',
16
+ headers: [
17
+ {
18
+ key: '',
19
+ value: ''
20
+ },
21
+ ],
21
22
  },
23
+ multiple: true,
24
+ valueProperty: 'value',
25
+ validateWhenHidden: false,
22
26
  key: 'select',
23
27
  type: 'select',
24
- searchField: 'data.textField2__regex',
25
28
  input: true,
29
+ defaultValue: ['value1', 'value3'],
30
+ selectValues: 'data',
31
+ disableLimit: false,
26
32
  noRefreshOnScroll: false,
27
- addResource: false,
28
- reference: false,
29
- valueProperty: 'data.textField2',
30
- },
31
- {
33
+ selectData: {
34
+ value1: {
35
+ label: 'Label 1',
36
+ },
37
+ value3: {
38
+ label: 'Label 3',
39
+ },
40
+ },
41
+ }, {
32
42
  type: 'button',
33
43
  label: 'Submit',
34
44
  key: 'submit',
35
45
  disableOnInvalid: true,
36
46
  input: true,
37
47
  tableView: false,
38
- },
39
- ],
48
+ }]
40
49
  };
@@ -0,0 +1,47 @@
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
+ widget: string;
10
+ tableView: boolean;
11
+ dataSrc: string;
12
+ data: {
13
+ resource: string;
14
+ };
15
+ template: string;
16
+ validate: {
17
+ select: boolean;
18
+ };
19
+ key: string;
20
+ type: string;
21
+ searchField: string;
22
+ input: boolean;
23
+ noRefreshOnScroll: boolean;
24
+ addResource: boolean;
25
+ reference: boolean;
26
+ valueProperty: string;
27
+ disableOnInvalid?: undefined;
28
+ } | {
29
+ type: string;
30
+ label: string;
31
+ key: string;
32
+ disableOnInvalid: boolean;
33
+ input: boolean;
34
+ tableView: boolean;
35
+ widget?: undefined;
36
+ dataSrc?: undefined;
37
+ data?: undefined;
38
+ template?: undefined;
39
+ validate?: undefined;
40
+ searchField?: undefined;
41
+ noRefreshOnScroll?: undefined;
42
+ addResource?: undefined;
43
+ reference?: undefined;
44
+ valueProperty?: undefined;
45
+ })[];
46
+ }
47
+ export default _default;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ title: 'FIO-8234',
5
+ name: 'fio8234',
6
+ path: 'fio8234',
7
+ type: 'form',
8
+ display: 'form',
9
+ components: [
10
+ {
11
+ label: 'Select',
12
+ widget: 'choicesjs',
13
+ tableView: true,
14
+ dataSrc: 'resource',
15
+ data: {
16
+ resource: '665446284c9b0163c3e0c7e6',
17
+ },
18
+ template: '<span>{{ item.data.textField1 }}</span>',
19
+ validate: {
20
+ select: false,
21
+ },
22
+ key: 'select',
23
+ type: 'select',
24
+ searchField: 'data.textField2__regex',
25
+ input: true,
26
+ noRefreshOnScroll: false,
27
+ addResource: false,
28
+ reference: false,
29
+ valueProperty: 'data.textField2',
30
+ },
31
+ {
32
+ type: 'button',
33
+ label: 'Submit',
34
+ key: 'submit',
35
+ disableOnInvalid: true,
36
+ input: true,
37
+ tableView: false,
38
+ },
39
+ ],
40
+ };
@@ -20,5 +20,6 @@ import comp20 from './comp20';
20
20
  import comp21 from './comp21';
21
21
  import comp22 from './comp22';
22
22
  import comp23 from './comp23';
23
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23 };
23
+ import comp24 from './comp24';
24
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24 };
24
25
  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.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.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"));
@@ -51,3 +51,5 @@ const comp22_1 = __importDefault(require("./comp22"));
51
51
  exports.comp22 = comp22_1.default;
52
52
  const comp23_1 = __importDefault(require("./comp23"));
53
53
  exports.comp23 = comp23_1.default;
54
+ const comp24_1 = __importDefault(require("./comp24"));
55
+ exports.comp24 = comp24_1.default;
@@ -834,7 +834,9 @@ export default class Webform extends NestedDataComponent {
834
834
  };
835
835
  }
836
836
  // Metadata needs to be available before setValue
837
- this._submission.metadata = submission.metadata || {};
837
+ this._submission.metadata = submission.metadata
838
+ ? _.cloneDeep(submission.metadata)
839
+ : {};
838
840
  this.editing = !!submission._id;
839
841
  // Set the timezone in the options if available.
840
842
  if (!this.options.submissionTimezone &&
@@ -1,14 +1,28 @@
1
1
  import _ from 'lodash';
2
2
  import { eachComponent } from '../../../utils/utils';
3
- const calculateSelectData = (context) => {
3
+ const calculateSingleSelectData = (context, defaultValue) => {
4
4
  const { instance, data } = context;
5
- const rawDefaultValue = instance.downloadedResources.find(resource => _.get(resource, data.valueProperty) === instance.getValue());
5
+ const rawDefaultValue = instance.downloadedResources.find(resource => _.get(resource, data.valueProperty) === defaultValue);
6
6
  const options = { data: {}, noeval: true };
7
7
  instance.interpolate(data.template, {
8
8
  item: rawDefaultValue,
9
9
  }, options);
10
10
  return options.data.item;
11
11
  };
12
+ const calculateSelectData = (context) => {
13
+ const { instance } = context;
14
+ const defaultValue = instance.getValue();
15
+ if (instance.component.multiple) {
16
+ const multiSelectData = {};
17
+ (defaultValue ?? []).forEach((defaultValueItem) => {
18
+ multiSelectData[defaultValueItem] = calculateSingleSelectData(context, defaultValueItem);
19
+ });
20
+ return multiSelectData;
21
+ }
22
+ else {
23
+ return calculateSingleSelectData(context, defaultValue);
24
+ }
25
+ };
12
26
  const setSelectData = (context) => {
13
27
  // Wait before downloadedResources will be set
14
28
  setTimeout(() => {
@@ -6,7 +6,7 @@ export default {
6
6
  display: 'form',
7
7
  components: [{
8
8
  label: 'Select',
9
- widget: 'choicesjs',
9
+ widget: 'html5',
10
10
  tableView: true,
11
11
  dataSrc: 'url',
12
12
  data: {
@@ -10,20 +10,30 @@ declare namespace _default {
10
10
  tableView: boolean;
11
11
  dataSrc: string;
12
12
  data: {
13
- resource: string;
14
- };
15
- template: string;
16
- validate: {
17
- select: boolean;
13
+ url: string;
14
+ headers: {
15
+ key: string;
16
+ value: string;
17
+ }[];
18
18
  };
19
+ multiple: boolean;
20
+ valueProperty: string;
21
+ validateWhenHidden: boolean;
19
22
  key: string;
20
23
  type: string;
21
- searchField: string;
22
24
  input: boolean;
25
+ defaultValue: string[];
26
+ selectValues: string;
27
+ disableLimit: boolean;
23
28
  noRefreshOnScroll: boolean;
24
- addResource: boolean;
25
- reference: boolean;
26
- valueProperty: string;
29
+ selectData: {
30
+ value1: {
31
+ label: string;
32
+ };
33
+ value3: {
34
+ label: string;
35
+ };
36
+ };
27
37
  disableOnInvalid?: undefined;
28
38
  } | {
29
39
  type: string;
@@ -35,13 +45,14 @@ declare namespace _default {
35
45
  widget?: undefined;
36
46
  dataSrc?: undefined;
37
47
  data?: undefined;
38
- template?: undefined;
39
- validate?: undefined;
40
- searchField?: undefined;
41
- noRefreshOnScroll?: undefined;
42
- addResource?: undefined;
43
- reference?: undefined;
48
+ multiple?: undefined;
44
49
  valueProperty?: undefined;
50
+ validateWhenHidden?: undefined;
51
+ defaultValue?: undefined;
52
+ selectValues?: undefined;
53
+ disableLimit?: undefined;
54
+ noRefreshOnScroll?: undefined;
55
+ selectData?: undefined;
45
56
  })[];
46
57
  }
47
58
  export default _default;
@@ -1,38 +1,47 @@
1
1
  export default {
2
- title: 'FIO-8234',
3
- name: 'fio8234',
4
- path: 'fio8234',
2
+ title: 'FIO-8281',
3
+ name: 'fio8281',
4
+ path: 'fio8281',
5
5
  type: 'form',
6
6
  display: 'form',
7
- components: [
8
- {
7
+ components: [{
9
8
  label: 'Select',
10
9
  widget: 'choicesjs',
11
10
  tableView: true,
12
- dataSrc: 'resource',
11
+ dataSrc: 'url',
13
12
  data: {
14
- resource: '665446284c9b0163c3e0c7e6',
15
- },
16
- template: '<span>{{ item.data.textField1 }}</span>',
17
- validate: {
18
- select: false,
13
+ url: 'https://fake_url.com',
14
+ headers: [
15
+ {
16
+ key: '',
17
+ value: ''
18
+ },
19
+ ],
19
20
  },
21
+ multiple: true,
22
+ valueProperty: 'value',
23
+ validateWhenHidden: false,
20
24
  key: 'select',
21
25
  type: 'select',
22
- searchField: 'data.textField2__regex',
23
26
  input: true,
27
+ defaultValue: ['value1', 'value3'],
28
+ selectValues: 'data',
29
+ disableLimit: false,
24
30
  noRefreshOnScroll: false,
25
- addResource: false,
26
- reference: false,
27
- valueProperty: 'data.textField2',
28
- },
29
- {
31
+ selectData: {
32
+ value1: {
33
+ label: 'Label 1',
34
+ },
35
+ value3: {
36
+ label: 'Label 3',
37
+ },
38
+ },
39
+ }, {
30
40
  type: 'button',
31
41
  label: 'Submit',
32
42
  key: 'submit',
33
43
  disableOnInvalid: true,
34
44
  input: true,
35
45
  tableView: false,
36
- },
37
- ],
46
+ }]
38
47
  };
@@ -0,0 +1,47 @@
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
+ widget: string;
10
+ tableView: boolean;
11
+ dataSrc: string;
12
+ data: {
13
+ resource: string;
14
+ };
15
+ template: string;
16
+ validate: {
17
+ select: boolean;
18
+ };
19
+ key: string;
20
+ type: string;
21
+ searchField: string;
22
+ input: boolean;
23
+ noRefreshOnScroll: boolean;
24
+ addResource: boolean;
25
+ reference: boolean;
26
+ valueProperty: string;
27
+ disableOnInvalid?: undefined;
28
+ } | {
29
+ type: string;
30
+ label: string;
31
+ key: string;
32
+ disableOnInvalid: boolean;
33
+ input: boolean;
34
+ tableView: boolean;
35
+ widget?: undefined;
36
+ dataSrc?: undefined;
37
+ data?: undefined;
38
+ template?: undefined;
39
+ validate?: undefined;
40
+ searchField?: undefined;
41
+ noRefreshOnScroll?: undefined;
42
+ addResource?: undefined;
43
+ reference?: undefined;
44
+ valueProperty?: undefined;
45
+ })[];
46
+ }
47
+ export default _default;
@@ -0,0 +1,38 @@
1
+ export default {
2
+ title: 'FIO-8234',
3
+ name: 'fio8234',
4
+ path: 'fio8234',
5
+ type: 'form',
6
+ display: 'form',
7
+ components: [
8
+ {
9
+ label: 'Select',
10
+ widget: 'choicesjs',
11
+ tableView: true,
12
+ dataSrc: 'resource',
13
+ data: {
14
+ resource: '665446284c9b0163c3e0c7e6',
15
+ },
16
+ template: '<span>{{ item.data.textField1 }}</span>',
17
+ validate: {
18
+ select: false,
19
+ },
20
+ key: 'select',
21
+ type: 'select',
22
+ searchField: 'data.textField2__regex',
23
+ input: true,
24
+ noRefreshOnScroll: false,
25
+ addResource: false,
26
+ reference: false,
27
+ valueProperty: 'data.textField2',
28
+ },
29
+ {
30
+ type: 'button',
31
+ label: 'Submit',
32
+ key: 'submit',
33
+ disableOnInvalid: true,
34
+ input: true,
35
+ tableView: false,
36
+ },
37
+ ],
38
+ };
@@ -20,5 +20,6 @@ import comp20 from './comp20';
20
20
  import comp21 from './comp21';
21
21
  import comp22 from './comp22';
22
22
  import comp23 from './comp23';
23
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23 };
23
+ import comp24 from './comp24';
24
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24 };
24
25
  export { multiSelect, multiSelectOptions } from "./comp3";
@@ -21,4 +21,5 @@ import comp20 from './comp20';
21
21
  import comp21 from './comp21';
22
22
  import comp22 from './comp22';
23
23
  import comp23 from './comp23';
24
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23 };
24
+ import comp24 from './comp24';
25
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5589.fd575d0",
3
+ "version": "5.0.0-dev.5592.bb7e96a",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -77,7 +77,7 @@
77
77
  "dependencies": {
78
78
  "@formio/bootstrap": "^3.0.0-rc.22",
79
79
  "@formio/choices.js": "^10.2.1",
80
- "@formio/core": "^2.1.0-dev.tt.2",
80
+ "@formio/core": "2.0.0-dev.102.df37631",
81
81
  "@formio/text-mask-addons": "^3.8.0-formio.2",
82
82
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
83
83
  "abortcontroller-polyfill": "^1.7.5",
@@ -105,7 +105,7 @@
105
105
  "lodash": "^4.17.21",
106
106
  "moment": "^2.29.4",
107
107
  "moment-timezone": "^0.5.44",
108
- "quill": "^2.0.0",
108
+ "quill": "^2.0.0-rc.4",
109
109
  "signature_pad": "^4.2.0",
110
110
  "string-hash": "^1.1.3",
111
111
  "tippy.js": "^6.3.7",