@formio/js 5.0.0-dev.5729.48085f7 → 5.0.0-dev.5732.56033f1

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.
package/lib/cjs/Form.d.ts CHANGED
@@ -398,10 +398,10 @@ export default class Form extends Element {
398
398
  getFormInitOptions(url: string, form: import('@formio/core').Form): object;
399
399
  /**
400
400
  * Sets the form to the JSON schema of a form.
401
- * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
401
+ * @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
402
402
  * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
403
403
  */
404
- setForm(formParam: import('@formio/core').Form): Promise<Webform | Wizard | PDF>;
404
+ setForm(formParam: import('@formio/core').Form | string): Promise<Webform | Wizard | PDF>;
405
405
  _form: any;
406
406
  getSubmission(formio: any, opts: any): any;
407
407
  /**
package/lib/cjs/Form.js CHANGED
@@ -195,7 +195,7 @@ class Form extends Element_1.default {
195
195
  }
196
196
  /**
197
197
  * Sets the form to the JSON schema of a form.
198
- * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
198
+ * @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
199
199
  * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
200
200
  */
201
201
  setForm(formParam) {
@@ -222,8 +222,14 @@ class Form extends Element_1.default {
222
222
  }
223
223
  this.loading = false;
224
224
  this.instance = this.instance || this.create(form.display);
225
- const options = this.getFormInitOptions(formParam, form);
226
- this.instance.setUrl(formParam, options);
225
+ // If we're in builder mode, instance.setUrl is not a function, so just manually set the URL.
226
+ if (this.instance.setUrl) {
227
+ const options = this.getFormInitOptions(formParam, form);
228
+ this.instance.setUrl(formParam, options);
229
+ }
230
+ else {
231
+ this.instance.url = formParam;
232
+ }
227
233
  this.instance.nosubmit = false;
228
234
  this._form = this.instance.form = form;
229
235
  if (submission) {
package/lib/cjs/PDF.js CHANGED
@@ -70,7 +70,7 @@ class PDF extends Webform_1.default {
70
70
  super.destroy(all);
71
71
  }
72
72
  rebuild() {
73
- if (this.builderMode && this.component.components) {
73
+ if (this.attached && this.builderMode && this.component.components) {
74
74
  this.destroyComponents();
75
75
  this.addComponents();
76
76
  return Promise.resolve();
@@ -9,9 +9,47 @@ export default class SelectComponent extends ListComponent {
9
9
  };
10
10
  static get serverConditionSettings(): {
11
11
  valueComponent(classComp: any): any;
12
+ dataTypeOperators: {
13
+ number: string[];
14
+ };
15
+ dataTypeValueComponents: {
16
+ number: {
17
+ lessThan: () => {
18
+ type: string;
19
+ };
20
+ greaterThan: () => {
21
+ type: string;
22
+ };
23
+ lessThanOrEqual: () => {
24
+ type: string;
25
+ };
26
+ greaterThanOrEqual: () => {
27
+ type: string;
28
+ };
29
+ };
30
+ };
12
31
  };
13
32
  static get conditionOperatorsSettings(): {
14
33
  valueComponent(classComp: any): any;
34
+ dataTypeOperators: {
35
+ number: string[];
36
+ };
37
+ dataTypeValueComponents: {
38
+ number: {
39
+ lessThan: () => {
40
+ type: string;
41
+ };
42
+ greaterThan: () => {
43
+ type: string;
44
+ };
45
+ lessThanOrEqual: () => {
46
+ type: string;
47
+ };
48
+ greaterThanOrEqual: () => {
49
+ type: string;
50
+ };
51
+ };
52
+ };
15
53
  };
16
54
  static savedValueTypes(schema: any): any[];
17
55
  templateData: {} | undefined;
@@ -62,6 +62,7 @@ class SelectComponent extends ListComponent_1.default {
62
62
  return SelectComponent.conditionOperatorsSettings;
63
63
  }
64
64
  static get conditionOperatorsSettings() {
65
+ const numberType = () => ({ type: 'number' });
65
66
  return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { valueComponent(classComp) {
66
67
  const valueComp = Object.assign(Object.assign({}, classComp), { type: 'select' });
67
68
  if ((0, utils_1.isSelectResourceWithObjectValue)(classComp)) {
@@ -76,6 +77,15 @@ class SelectComponent extends ListComponent_1.default {
76
77
  `;
77
78
  }
78
79
  return valueComp;
80
+ }, dataTypeOperators: {
81
+ number: ['lessThan', 'greaterThan', 'lessThanOrEqual', 'greaterThanOrEqual'],
82
+ }, dataTypeValueComponents: {
83
+ number: {
84
+ lessThan: numberType,
85
+ greaterThan: numberType,
86
+ lessThanOrEqual: numberType,
87
+ greaterThanOrEqual: numberType,
88
+ },
79
89
  } });
80
90
  }
81
91
  static savedValueTypes(schema) {
@@ -0,0 +1,44 @@
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
+ data: {
12
+ values: {
13
+ label: string;
14
+ value: string;
15
+ }[];
16
+ };
17
+ dataType: string;
18
+ key: string;
19
+ type: string;
20
+ input: boolean;
21
+ applyMaskOn?: undefined;
22
+ conditional?: undefined;
23
+ } | {
24
+ label: string;
25
+ applyMaskOn: string;
26
+ tableView: boolean;
27
+ key: string;
28
+ type: string;
29
+ input: boolean;
30
+ conditional: {
31
+ show: boolean;
32
+ conjunction: string;
33
+ conditions: {
34
+ component: string;
35
+ operator: string;
36
+ value: number;
37
+ }[];
38
+ };
39
+ widget?: undefined;
40
+ data?: undefined;
41
+ dataType?: undefined;
42
+ })[];
43
+ }
44
+ export default _default;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ title: 'FIO-8072',
5
+ name: 'fio8072',
6
+ path: 'fio8072',
7
+ type: 'form',
8
+ display: 'form',
9
+ components: [
10
+ {
11
+ label: 'Select',
12
+ widget: 'choicesjs',
13
+ tableView: true,
14
+ data: {
15
+ values: [
16
+ {
17
+ label: 'A',
18
+ value: '1',
19
+ },
20
+ {
21
+ label: 'B',
22
+ value: '2',
23
+ },
24
+ {
25
+ label: 'C',
26
+ value: '10',
27
+ },
28
+ {
29
+ label: 'D',
30
+ value: '1d',
31
+ },
32
+ ],
33
+ },
34
+ dataType: 'number',
35
+ key: 'select',
36
+ type: 'select',
37
+ input: true,
38
+ },
39
+ {
40
+ label: 'Text Field',
41
+ applyMaskOn: 'change',
42
+ tableView: true,
43
+ key: 'textField',
44
+ type: 'textfield',
45
+ input: true,
46
+ conditional: {
47
+ show: true,
48
+ conjunction: 'all',
49
+ conditions: [
50
+ {
51
+ component: 'select',
52
+ operator: 'lessThan',
53
+ value: 5,
54
+ },
55
+ ],
56
+ },
57
+ },
58
+ ],
59
+ };
@@ -21,5 +21,6 @@ import comp21 from './comp21';
21
21
  import comp22 from './comp22';
22
22
  import comp23 from './comp23';
23
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
+ import comp25 from './comp25';
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, comp25 };
25
26
  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.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;
6
+ exports.comp25 = 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"));
@@ -53,3 +53,5 @@ const comp23_1 = __importDefault(require("./comp23"));
53
53
  exports.comp23 = comp23_1.default;
54
54
  const comp24_1 = __importDefault(require("./comp24"));
55
55
  exports.comp24 = comp24_1.default;
56
+ const comp25_1 = __importDefault(require("./comp25"));
57
+ exports.comp25 = comp25_1.default;
package/lib/mjs/Form.d.ts CHANGED
@@ -398,10 +398,10 @@ export default class Form extends Element {
398
398
  getFormInitOptions(url: string, form: import('@formio/core').Form): object;
399
399
  /**
400
400
  * Sets the form to the JSON schema of a form.
401
- * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
401
+ * @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
402
402
  * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
403
403
  */
404
- setForm(formParam: import('@formio/core').Form): Promise<Webform | Wizard | PDF>;
404
+ setForm(formParam: import('@formio/core').Form | string): Promise<Webform | Wizard | PDF>;
405
405
  _form: any;
406
406
  getSubmission(formio: any, opts: any): any;
407
407
  /**
package/lib/mjs/Form.js CHANGED
@@ -264,7 +264,7 @@ export default class Form extends Element {
264
264
  }
265
265
  /**
266
266
  * Sets the form to the JSON schema of a form.
267
- * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
267
+ * @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
268
268
  * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
269
269
  */
270
270
  setForm(formParam) {
@@ -291,8 +291,14 @@ export default class Form extends Element {
291
291
  }
292
292
  this.loading = false;
293
293
  this.instance = this.instance || this.create(form.display);
294
- const options = this.getFormInitOptions(formParam, form);
295
- this.instance.setUrl(formParam, options);
294
+ // If we're in builder mode, instance.setUrl is not a function, so just manually set the URL.
295
+ if (this.instance.setUrl) {
296
+ const options = this.getFormInitOptions(formParam, form);
297
+ this.instance.setUrl(formParam, options);
298
+ }
299
+ else {
300
+ this.instance.url = formParam;
301
+ }
296
302
  this.instance.nosubmit = false;
297
303
  this._form = this.instance.form = form;
298
304
  if (submission) {
package/lib/mjs/PDF.js CHANGED
@@ -65,7 +65,7 @@ export default class PDF extends Webform {
65
65
  super.destroy(all);
66
66
  }
67
67
  rebuild() {
68
- if (this.builderMode && this.component.components) {
68
+ if (this.attached && this.builderMode && this.component.components) {
69
69
  this.destroyComponents();
70
70
  this.addComponents();
71
71
  return Promise.resolve();
@@ -9,9 +9,47 @@ export default class SelectComponent extends ListComponent {
9
9
  };
10
10
  static get serverConditionSettings(): {
11
11
  valueComponent(classComp: any): any;
12
+ dataTypeOperators: {
13
+ number: string[];
14
+ };
15
+ dataTypeValueComponents: {
16
+ number: {
17
+ lessThan: () => {
18
+ type: string;
19
+ };
20
+ greaterThan: () => {
21
+ type: string;
22
+ };
23
+ lessThanOrEqual: () => {
24
+ type: string;
25
+ };
26
+ greaterThanOrEqual: () => {
27
+ type: string;
28
+ };
29
+ };
30
+ };
12
31
  };
13
32
  static get conditionOperatorsSettings(): {
14
33
  valueComponent(classComp: any): any;
34
+ dataTypeOperators: {
35
+ number: string[];
36
+ };
37
+ dataTypeValueComponents: {
38
+ number: {
39
+ lessThan: () => {
40
+ type: string;
41
+ };
42
+ greaterThan: () => {
43
+ type: string;
44
+ };
45
+ lessThanOrEqual: () => {
46
+ type: string;
47
+ };
48
+ greaterThanOrEqual: () => {
49
+ type: string;
50
+ };
51
+ };
52
+ };
15
53
  };
16
54
  static savedValueTypes(schema: any): any[];
17
55
  templateData: {} | undefined;
@@ -57,6 +57,7 @@ export default class SelectComponent extends ListComponent {
57
57
  return SelectComponent.conditionOperatorsSettings;
58
58
  }
59
59
  static get conditionOperatorsSettings() {
60
+ const numberType = () => ({ type: 'number' });
60
61
  return {
61
62
  ...super.conditionOperatorsSettings,
62
63
  valueComponent(classComp) {
@@ -73,7 +74,18 @@ export default class SelectComponent extends ListComponent {
73
74
  `;
74
75
  }
75
76
  return valueComp;
76
- }
77
+ },
78
+ dataTypeOperators: {
79
+ number: ['lessThan', 'greaterThan', 'lessThanOrEqual', 'greaterThanOrEqual'],
80
+ },
81
+ dataTypeValueComponents: {
82
+ number: {
83
+ lessThan: numberType,
84
+ greaterThan: numberType,
85
+ lessThanOrEqual: numberType,
86
+ greaterThanOrEqual: numberType,
87
+ },
88
+ },
77
89
  };
78
90
  }
79
91
  static savedValueTypes(schema) {
@@ -0,0 +1,44 @@
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
+ data: {
12
+ values: {
13
+ label: string;
14
+ value: string;
15
+ }[];
16
+ };
17
+ dataType: string;
18
+ key: string;
19
+ type: string;
20
+ input: boolean;
21
+ applyMaskOn?: undefined;
22
+ conditional?: undefined;
23
+ } | {
24
+ label: string;
25
+ applyMaskOn: string;
26
+ tableView: boolean;
27
+ key: string;
28
+ type: string;
29
+ input: boolean;
30
+ conditional: {
31
+ show: boolean;
32
+ conjunction: string;
33
+ conditions: {
34
+ component: string;
35
+ operator: string;
36
+ value: number;
37
+ }[];
38
+ };
39
+ widget?: undefined;
40
+ data?: undefined;
41
+ dataType?: undefined;
42
+ })[];
43
+ }
44
+ export default _default;
@@ -0,0 +1,57 @@
1
+ export default {
2
+ title: 'FIO-8072',
3
+ name: 'fio8072',
4
+ path: 'fio8072',
5
+ type: 'form',
6
+ display: 'form',
7
+ components: [
8
+ {
9
+ label: 'Select',
10
+ widget: 'choicesjs',
11
+ tableView: true,
12
+ data: {
13
+ values: [
14
+ {
15
+ label: 'A',
16
+ value: '1',
17
+ },
18
+ {
19
+ label: 'B',
20
+ value: '2',
21
+ },
22
+ {
23
+ label: 'C',
24
+ value: '10',
25
+ },
26
+ {
27
+ label: 'D',
28
+ value: '1d',
29
+ },
30
+ ],
31
+ },
32
+ dataType: 'number',
33
+ key: 'select',
34
+ type: 'select',
35
+ input: true,
36
+ },
37
+ {
38
+ label: 'Text Field',
39
+ applyMaskOn: 'change',
40
+ tableView: true,
41
+ key: 'textField',
42
+ type: 'textfield',
43
+ input: true,
44
+ conditional: {
45
+ show: true,
46
+ conjunction: 'all',
47
+ conditions: [
48
+ {
49
+ component: 'select',
50
+ operator: 'lessThan',
51
+ value: 5,
52
+ },
53
+ ],
54
+ },
55
+ },
56
+ ],
57
+ };
@@ -21,5 +21,6 @@ import comp21 from './comp21';
21
21
  import comp22 from './comp22';
22
22
  import comp23 from './comp23';
23
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
+ import comp25 from './comp25';
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, comp25 };
25
26
  export { multiSelect, multiSelectOptions } from "./comp3";
@@ -22,4 +22,5 @@ import comp21 from './comp21';
22
22
  import comp22 from './comp22';
23
23
  import comp23 from './comp23';
24
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 };
25
+ import comp25 from './comp25';
26
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5729.48085f7",
3
+ "version": "5.0.0-dev.5732.56033f1",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {