@formio/js 5.0.0-rc.22 → 5.0.0-rc.24

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 (80) hide show
  1. package/README.md +24 -30
  2. package/dist/formio.builder.css +2 -0
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.embed.js +1 -1
  5. package/dist/formio.embed.min.js +1 -1
  6. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.form.css +2 -0
  8. package/dist/formio.form.js +14 -25
  9. package/dist/formio.form.min.css +1 -1
  10. package/dist/formio.form.min.js +1 -1
  11. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  12. package/dist/formio.full.css +2 -0
  13. package/dist/formio.full.js +15 -26
  14. package/dist/formio.full.min.css +1 -1
  15. package/dist/formio.full.min.js +1 -1
  16. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  17. package/dist/formio.js +1 -1
  18. package/dist/formio.min.js +1 -1
  19. package/dist/formio.min.js.LICENSE.txt +1 -1
  20. package/dist/formio.utils.js +1 -1
  21. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  22. package/lib/cjs/Embed.d.ts +4 -2
  23. package/lib/cjs/Embed.js +55 -42
  24. package/lib/cjs/WebformBuilder.js +1 -1
  25. package/lib/cjs/components/_classes/component/Component.js +3 -3
  26. package/lib/cjs/components/_classes/field/Field.d.ts +1 -0
  27. package/lib/cjs/components/_classes/field/Field.js +14 -0
  28. package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
  29. package/lib/cjs/components/_classes/list/ListComponent.js +6 -3
  30. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  31. package/lib/cjs/components/_classes/multivalue/Multivalue.js +0 -14
  32. package/lib/cjs/components/day/Day.d.ts +0 -1
  33. package/lib/cjs/components/day/Day.js +34 -14
  34. package/lib/cjs/components/day/fixtures/comp6.d.ts +81 -0
  35. package/lib/cjs/components/day/fixtures/comp6.js +76 -0
  36. package/lib/cjs/components/day/fixtures/index.d.ts +2 -1
  37. package/lib/cjs/components/day/fixtures/index.js +3 -1
  38. package/lib/cjs/components/radio/Radio.js +22 -12
  39. package/lib/cjs/components/select/Select.d.ts +2 -0
  40. package/lib/cjs/components/select/Select.js +6 -1
  41. package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -0
  42. package/lib/cjs/components/selectboxes/fixtures/comp7.d.ts +18 -0
  43. package/lib/cjs/components/selectboxes/fixtures/comp7.js +31 -0
  44. package/lib/cjs/components/selectboxes/fixtures/index.d.ts +2 -1
  45. package/lib/cjs/components/selectboxes/fixtures/index.js +3 -1
  46. package/lib/cjs/components/signature/Signature.d.ts +1 -2
  47. package/lib/cjs/components/signature/Signature.js +1 -2
  48. package/lib/cjs/utils/ChoicesWrapper.d.ts +1 -0
  49. package/lib/cjs/utils/ChoicesWrapper.js +19 -0
  50. package/lib/cjs/utils/utils.js +3 -3
  51. package/lib/mjs/Embed.d.ts +4 -2
  52. package/lib/mjs/Embed.js +54 -43
  53. package/lib/mjs/WebformBuilder.js +1 -1
  54. package/lib/mjs/components/_classes/component/Component.js +3 -3
  55. package/lib/mjs/components/_classes/field/Field.d.ts +1 -0
  56. package/lib/mjs/components/_classes/field/Field.js +13 -0
  57. package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
  58. package/lib/mjs/components/_classes/list/ListComponent.js +6 -3
  59. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  60. package/lib/mjs/components/_classes/multivalue/Multivalue.js +0 -13
  61. package/lib/mjs/components/day/Day.d.ts +0 -1
  62. package/lib/mjs/components/day/Day.js +33 -14
  63. package/lib/mjs/components/day/fixtures/comp6.d.ts +81 -0
  64. package/lib/mjs/components/day/fixtures/comp6.js +74 -0
  65. package/lib/mjs/components/day/fixtures/index.d.ts +2 -1
  66. package/lib/mjs/components/day/fixtures/index.js +2 -1
  67. package/lib/mjs/components/radio/Radio.js +22 -12
  68. package/lib/mjs/components/select/Select.d.ts +2 -0
  69. package/lib/mjs/components/select/Select.js +6 -1
  70. package/lib/mjs/components/selectboxes/SelectBoxes.js +10 -1
  71. package/lib/mjs/components/selectboxes/fixtures/comp7.d.ts +18 -0
  72. package/lib/mjs/components/selectboxes/fixtures/comp7.js +29 -0
  73. package/lib/mjs/components/selectboxes/fixtures/index.d.ts +2 -1
  74. package/lib/mjs/components/selectboxes/fixtures/index.js +2 -1
  75. package/lib/mjs/components/signature/Signature.d.ts +1 -2
  76. package/lib/mjs/components/signature/Signature.js +1 -2
  77. package/lib/mjs/utils/ChoicesWrapper.d.ts +1 -0
  78. package/lib/mjs/utils/ChoicesWrapper.js +19 -0
  79. package/lib/mjs/utils/utils.js +3 -3
  80. package/package.json +3 -4
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = __importDefault(require("lodash"));
7
7
  const moment_1 = __importDefault(require("moment"));
8
8
  const Field_1 = __importDefault(require("../_classes/field/Field"));
9
- const Input_1 = __importDefault(require("../_classes/input/Input"));
10
9
  const utils_1 = require("../../utils/utils");
11
10
  class DayComponent extends Field_1.default {
12
11
  static schema(...extend) {
@@ -258,6 +257,17 @@ class DayComponent extends Field_1.default {
258
257
  attach(element) {
259
258
  this.loadRefs(element, { day: 'single', month: 'single', year: 'single', input: 'multiple' });
260
259
  const superAttach = super.attach(element);
260
+ const updateValueAndSaveFocus = (element, name) => () => {
261
+ try {
262
+ this.saveCaretPosition(element, name);
263
+ }
264
+ catch (err) {
265
+ console.warn('An error occurred while trying to save caret position', err);
266
+ }
267
+ this.updateValue(null, {
268
+ modified: true,
269
+ });
270
+ };
261
271
  if (this.shouldDisabled) {
262
272
  this.setDisabled(this.refs.day, true);
263
273
  this.setDisabled(this.refs.month, true);
@@ -267,9 +277,7 @@ class DayComponent extends Field_1.default {
267
277
  }
268
278
  }
269
279
  else {
270
- this.addEventListener(this.refs.day, 'input', () => this.updateValue(null, {
271
- modified: true
272
- }));
280
+ this.addEventListener(this.refs.day, 'input', updateValueAndSaveFocus(this.refs.day, 'day'));
273
281
  // TODO: Need to rework this to work with day select as well.
274
282
  // Change day max input when month changes.
275
283
  this.addEventListener(this.refs.month, 'input', () => {
@@ -282,18 +290,14 @@ class DayComponent extends Field_1.default {
282
290
  if (maxDay && day > maxDay) {
283
291
  this.refs.day.value = this.refs.day.max;
284
292
  }
285
- this.updateValue(null, {
286
- modified: true
287
- });
293
+ updateValueAndSaveFocus(this.refs.month, 'month')();
288
294
  });
289
- this.addEventListener(this.refs.year, 'input', () => this.updateValue(null, {
290
- modified: true
291
- }));
295
+ this.addEventListener(this.refs.year, 'input', updateValueAndSaveFocus(this.refs.year, 'year'));
292
296
  this.addEventListener(this.refs.input, this.info.changeEvent, () => this.updateValue(null, {
293
297
  modified: true
294
298
  }));
295
- [this.refs.day, this.refs.month, this.refs.year].forEach((element) => {
296
- Input_1.default.prototype.addFocusBlurEvents.call(this, element);
299
+ [this.refs.day, this.refs.month, this.refs.year].filter((element) => !!element).forEach((element) => {
300
+ super.addFocusBlurEvents(element);
297
301
  });
298
302
  }
299
303
  this.setValue(this.dataValue);
@@ -526,9 +530,12 @@ class DayComponent extends Field_1.default {
526
530
  getValueAsString(value) {
527
531
  return this.getDate(value) || '';
528
532
  }
529
- focus() {
533
+ focus(field) {
530
534
  var _a, _b, _c;
531
- if (this.dayFirst && this.showDay || !this.dayFirst && !this.showMonth && this.showDay) {
535
+ if (field && typeof field === 'string' && this.refs[field]) {
536
+ this.refs[field].focus();
537
+ }
538
+ else if (this.dayFirst && this.showDay || !this.dayFirst && !this.showMonth && this.showDay) {
532
539
  (_a = this.refs.day) === null || _a === void 0 ? void 0 : _a.focus();
533
540
  }
534
541
  else if (this.dayFirst && !this.showDay && this.showMonth || !this.dayFirst && this.showMonth) {
@@ -538,6 +545,19 @@ class DayComponent extends Field_1.default {
538
545
  (_c = this.refs.year) === null || _c === void 0 ? void 0 : _c.focus();
539
546
  }
540
547
  }
548
+ restoreCaretPosition() {
549
+ var _a;
550
+ if ((_a = this.root) === null || _a === void 0 ? void 0 : _a.currentSelection) {
551
+ const { selection, index } = this.root.currentSelection;
552
+ if (this.refs[index]) {
553
+ const input = this.refs[index];
554
+ const isInputRangeSelectable = (i) => /text|search|password|tel|url/i.test((i === null || i === void 0 ? void 0 : i.type) || '');
555
+ if (isInputRangeSelectable(input)) {
556
+ input.setSelectionRange(...selection);
557
+ }
558
+ }
559
+ }
560
+ }
541
561
  isPartialDay(value) {
542
562
  if (!value) {
543
563
  return false;
@@ -0,0 +1,81 @@
1
+ declare namespace _default {
2
+ const type: string;
3
+ const display: string;
4
+ const components: ({
5
+ label: string;
6
+ applyMaskOn: string;
7
+ tableView: boolean;
8
+ key: string;
9
+ type: string;
10
+ input: boolean;
11
+ hideInputLabels?: undefined;
12
+ inputsLabelPosition?: undefined;
13
+ useLocaleSettings?: undefined;
14
+ fields?: undefined;
15
+ defaultValue?: undefined;
16
+ logic?: undefined;
17
+ disableOnInvalid?: undefined;
18
+ } | {
19
+ label: string;
20
+ hideInputLabels: boolean;
21
+ inputsLabelPosition: string;
22
+ useLocaleSettings: boolean;
23
+ tableView: boolean;
24
+ fields: {
25
+ day: {
26
+ hide: boolean;
27
+ };
28
+ month: {
29
+ hide: boolean;
30
+ };
31
+ year: {
32
+ hide: boolean;
33
+ };
34
+ };
35
+ defaultValue: string;
36
+ key: string;
37
+ logic: {
38
+ name: string;
39
+ trigger: {
40
+ type: string;
41
+ simple: {
42
+ show: boolean;
43
+ conjunction: string;
44
+ conditions: {
45
+ component: string;
46
+ operator: string;
47
+ }[];
48
+ };
49
+ };
50
+ actions: {
51
+ name: string;
52
+ type: string;
53
+ property: {
54
+ label: string;
55
+ value: string;
56
+ type: string;
57
+ };
58
+ state: boolean;
59
+ }[];
60
+ }[];
61
+ type: string;
62
+ input: boolean;
63
+ applyMaskOn?: undefined;
64
+ disableOnInvalid?: undefined;
65
+ } | {
66
+ type: string;
67
+ label: string;
68
+ key: string;
69
+ disableOnInvalid: boolean;
70
+ input: boolean;
71
+ tableView: boolean;
72
+ applyMaskOn?: undefined;
73
+ hideInputLabels?: undefined;
74
+ inputsLabelPosition?: undefined;
75
+ useLocaleSettings?: undefined;
76
+ fields?: undefined;
77
+ defaultValue?: undefined;
78
+ logic?: undefined;
79
+ })[];
80
+ }
81
+ export default _default;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ type: 'form',
5
+ display: 'form',
6
+ components: [
7
+ {
8
+ label: 'Text Field',
9
+ applyMaskOn: 'change',
10
+ tableView: true,
11
+ key: 'textField',
12
+ type: 'textfield',
13
+ input: true,
14
+ },
15
+ {
16
+ label: 'Day',
17
+ hideInputLabels: false,
18
+ inputsLabelPosition: 'top',
19
+ useLocaleSettings: false,
20
+ tableView: false,
21
+ fields: {
22
+ day: {
23
+ hide: true,
24
+ },
25
+ month: {
26
+ hide: false,
27
+ },
28
+ year: {
29
+ hide: false,
30
+ },
31
+ },
32
+ defaultValue: '00/00/0000',
33
+ key: 'day',
34
+ logic: [
35
+ {
36
+ name: 'Disable when Test is empty',
37
+ trigger: {
38
+ type: 'simple',
39
+ simple: {
40
+ show: true,
41
+ conjunction: 'all',
42
+ conditions: [
43
+ {
44
+ component: 'textField',
45
+ operator: 'isEmpty',
46
+ },
47
+ ],
48
+ },
49
+ },
50
+ actions: [
51
+ {
52
+ name: 'Disable',
53
+ type: 'property',
54
+ property: {
55
+ label: 'Disabled',
56
+ value: 'disabled',
57
+ type: 'boolean',
58
+ },
59
+ state: true,
60
+ },
61
+ ],
62
+ },
63
+ ],
64
+ type: 'day',
65
+ input: true,
66
+ },
67
+ {
68
+ type: 'button',
69
+ label: 'Submit',
70
+ key: 'submit',
71
+ disableOnInvalid: true,
72
+ input: true,
73
+ tableView: false,
74
+ },
75
+ ],
76
+ };
@@ -3,4 +3,5 @@ import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
- export { comp1, comp2, comp3, comp4, comp5 };
6
+ import comp6 from './comp6';
7
+ export { comp1, comp2, comp3, comp4, comp5, comp6 };
@@ -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.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = 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"));
@@ -14,3 +14,5 @@ const comp4_1 = __importDefault(require("./comp4"));
14
14
  exports.comp4 = comp4_1.default;
15
15
  const comp5_1 = __importDefault(require("./comp5"));
16
16
  exports.comp5 = comp5_1.default;
17
+ const comp6_1 = __importDefault(require("./comp6"));
18
+ exports.comp6 = comp6_1.default;
@@ -153,7 +153,12 @@ class RadioComponent extends ListComponent_1.default {
153
153
  if (!lodash_1.default.isString(this.dataValue)) {
154
154
  dataValue = lodash_1.default.toString(this.dataValue);
155
155
  }
156
- input.checked = (dataValue === input.value && (input.value || this.component.dataSrc !== 'url'));
156
+ if (this.isSelectURL && lodash_1.default.isObject(this.loadedOptions[index].value)) {
157
+ input.checked = lodash_1.default.isEqual(this.loadedOptions[index].value, this.dataValue);
158
+ }
159
+ else {
160
+ input.checked = (dataValue === input.value && (input.value || this.component.dataSrc !== 'url'));
161
+ }
157
162
  this.addEventListener(input, 'keyup', (event) => {
158
163
  if (event.key === ' ' && dataValue === input.value) {
159
164
  event.preventDefault();
@@ -183,9 +188,11 @@ class RadioComponent extends ListComponent_1.default {
183
188
  return this.dataValue;
184
189
  }
185
190
  let value = this.dataValue;
186
- this.refs.input.forEach((input) => {
191
+ this.refs.input.forEach((input, index) => {
187
192
  if (input.checked) {
188
- value = input.value;
193
+ value = (this.isSelectURL && lodash_1.default.isObject(this.loadedOptions[index].value)) ?
194
+ this.loadedOptions[index].value :
195
+ input.value;
189
196
  }
190
197
  });
191
198
  return value;
@@ -207,7 +214,10 @@ class RadioComponent extends ListComponent_1.default {
207
214
  return false;
208
215
  }
209
216
  getValueAsString(value) {
210
- if (!lodash_1.default.isString(value)) {
217
+ if (lodash_1.default.isObject(value)) {
218
+ value = JSON.stringify(value);
219
+ }
220
+ else if (!lodash_1.default.isString(value)) {
211
221
  value = lodash_1.default.toString(value);
212
222
  }
213
223
  if (this.component.dataSrc !== 'values') {
@@ -229,7 +239,7 @@ class RadioComponent extends ListComponent_1.default {
229
239
  if (this.optionsLoaded) {
230
240
  return;
231
241
  }
232
- if (!this.shouldLoad) {
242
+ if (!this.shouldLoad && this.listData) {
233
243
  this.loadItemsFromMetadata();
234
244
  return;
235
245
  }
@@ -260,7 +270,7 @@ class RadioComponent extends ListComponent_1.default {
260
270
  this.loadedOptions[i] = {
261
271
  label: this.itemTemplate(item)
262
272
  };
263
- if (lodash_1.default.isEqual(item, this.selectData)) {
273
+ if (lodash_1.default.isEqual(item, this.selectData || lodash_1.default.pick(this.dataValue, lodash_1.default.keys(item)))) {
264
274
  this.loadedOptions[i].value = this.dataValue;
265
275
  }
266
276
  });
@@ -271,13 +281,13 @@ class RadioComponent extends ListComponent_1.default {
271
281
  const listData = [];
272
282
  items === null || items === void 0 ? void 0 : items.forEach((item, i) => {
273
283
  this.loadedOptions[i] = {
274
- value: item[this.component.valueProperty],
275
- label: this.itemTemplate(item, item[this.component.valueProperty])
284
+ value: this.component.valueProperty ? item[this.component.valueProperty] : item,
285
+ label: this.component.valueProperty ? this.itemTemplate(item, item[this.component.valueProperty]) : this.itemTemplate(item, item, i)
276
286
  };
277
- listData.push(this.templateData[item[this.component.valueProperty]]);
278
- if (lodash_1.default.isUndefined(item[this.component.valueProperty]) ||
279
- lodash_1.default.isObject(item[this.component.valueProperty]) ||
280
- (!this.isRadio && lodash_1.default.isBoolean(item[this.component.valueProperty]))) {
287
+ listData.push(this.templateData[this.component.valueProperty ? item[this.component.valueProperty] : i]);
288
+ if ((this.component.valueProperty || !this.isRadio) && (lodash_1.default.isUndefined(item[this.component.valueProperty]) ||
289
+ (!this.isRadio && lodash_1.default.isObject(item[this.component.valueProperty])) ||
290
+ (!this.isRadio && lodash_1.default.isBoolean(item[this.component.valueProperty])))) {
281
291
  this.loadedOptions[i].invalid = true;
282
292
  }
283
293
  });
@@ -63,6 +63,7 @@ export default class SelectComponent extends ListComponent {
63
63
  value: any;
64
64
  label: any;
65
65
  };
66
+ itemTemplate(data: any, value: any): any;
66
67
  /**
67
68
  * Adds an option to the select dropdown.
68
69
  *
@@ -102,6 +103,7 @@ export default class SelectComponent extends ListComponent {
102
103
  focusableElement: any;
103
104
  choices: Choices | null | undefined;
104
105
  scrollList: any;
106
+ isRemoveButtonPressed: boolean | undefined;
105
107
  get isLoadingAvailable(): any;
106
108
  onScroll(): void;
107
109
  attachRefreshOnBlur(): void;
@@ -428,7 +428,7 @@ class SelectComponent extends ListComponent_1.default {
428
428
  const searching = fromSearch && ((_b = (_a = this.choices) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.isFocussed);
429
429
  if (!searching) {
430
430
  // If a value is provided, then select it.
431
- if (!this.isEmpty()) {
431
+ if (!this.isEmpty() || this.isRemoveButtonPressed) {
432
432
  this.setValue(this.dataValue, {
433
433
  noUpdateEvent: true
434
434
  });
@@ -814,6 +814,11 @@ class SelectComponent extends ListComponent_1.default {
814
814
  this.scrollList = this.choices.choiceList.element;
815
815
  this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
816
816
  }
817
+ if (choicesOptions.removeItemButton) {
818
+ this.addEventListener(input, 'removeItem', () => {
819
+ this.isRemoveButtonPressed = true;
820
+ });
821
+ }
817
822
  }
818
823
  this.focusableElement.setAttribute('tabIndex', tabIndex);
819
824
  // If a search field is provided, then add an event listener to update items on search.
@@ -245,5 +245,14 @@ class SelectBoxesComponent extends Radio_1.default {
245
245
  }
246
246
  return super.checkComponentValidity(data, dirty, rowData, options);
247
247
  }
248
+ validateValueAvailability(setting, value) {
249
+ if (!(0, utils_1.boolValue)(setting) || !value) {
250
+ return true;
251
+ }
252
+ const values = this.component.values;
253
+ const availableValueKeys = (values || []).map(({ value: optionValue }) => optionValue);
254
+ const valueKeys = Object.keys(value);
255
+ return valueKeys.every((key) => availableValueKeys.includes(key));
256
+ }
248
257
  }
249
258
  exports.default = SelectBoxesComponent;
@@ -0,0 +1,18 @@
1
+ declare namespace _default {
2
+ const label: string;
3
+ const optionsLabelPosition: string;
4
+ const tableView: boolean;
5
+ const values: {
6
+ label: string;
7
+ value: string;
8
+ shortcut: string;
9
+ }[];
10
+ namespace validate {
11
+ const onlyAvailableItems: boolean;
12
+ }
13
+ const key: string;
14
+ const type: string;
15
+ const input: boolean;
16
+ const inputType: string;
17
+ }
18
+ export default _default;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ label: 'Select Boxes',
5
+ optionsLabelPosition: 'right',
6
+ tableView: false,
7
+ values: [
8
+ {
9
+ label: 'a',
10
+ value: 'a',
11
+ shortcut: '',
12
+ },
13
+ {
14
+ label: 'b',
15
+ value: 'b',
16
+ shortcut: '',
17
+ },
18
+ {
19
+ label: 'c',
20
+ value: 'c',
21
+ shortcut: '',
22
+ },
23
+ ],
24
+ validate: {
25
+ onlyAvailableItems: true,
26
+ },
27
+ key: 'selectBoxes',
28
+ type: 'selectboxes',
29
+ input: true,
30
+ inputType: 'checkbox',
31
+ };
@@ -4,4 +4,5 @@ import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
- export { comp1, comp2, comp3, comp4, comp5, comp6 };
7
+ import comp7 from './comp7';
8
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7 };
@@ -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.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = 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"));
@@ -16,3 +16,5 @@ const comp5_1 = __importDefault(require("./comp5"));
16
16
  exports.comp5 = comp5_1.default;
17
17
  const comp6_1 = __importDefault(require("./comp6"));
18
18
  exports.comp6 = comp6_1.default;
19
+ const comp7_1 = __importDefault(require("./comp7"));
20
+ exports.comp7 = comp7_1.default;
@@ -37,11 +37,10 @@ export default class SignatureComponent extends Input {
37
37
  onDisabled(): void;
38
38
  checkSize(force: any, scale: any): void;
39
39
  signaturePad: SignaturePad | null | undefined;
40
- observer: _ResizeObserver | null | undefined;
40
+ observer: any;
41
41
  getValueAsString(value: any): "" | "Yes" | "No";
42
42
  focus(): void;
43
43
  setDataToSigaturePad(): void;
44
44
  }
45
45
  import Input from '../_classes/input/Input';
46
46
  import SignaturePad from 'signature_pad';
47
- import _ResizeObserver from 'resize-observer-polyfill';
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const signature_pad_1 = __importDefault(require("signature_pad"));
7
- const resize_observer_polyfill_1 = __importDefault(require("resize-observer-polyfill"));
8
7
  const Input_1 = __importDefault(require("../_classes/input/Input"));
9
8
  const lodash_1 = __importDefault(require("lodash"));
10
9
  const utils_1 = require("../../utils/utils");
@@ -202,7 +201,7 @@ class SignatureComponent extends Input_1.default {
202
201
  this.refs.padBody.style.maxWidth = '100%';
203
202
  }
204
203
  if (!this.builderMode && !this.options.preview) {
205
- this.observer = new resize_observer_polyfill_1.default(() => {
204
+ this.observer = new ResizeObserver(() => {
206
205
  this.checkSize();
207
206
  });
208
207
  this.observer.observe(this.refs.padBody);
@@ -19,6 +19,7 @@ declare class ChoicesWrapper extends Choices {
19
19
  }): void;
20
20
  isDirectionUsing: boolean;
21
21
  shouldOpenDropDown: boolean;
22
+ _onTouchEnd(event: any): void;
22
23
  _handleButtonAction(activeItems: any, element: any): void;
23
24
  _onEnterKey(args: any): void;
24
25
  _onDirectionKey(...args: any[]): void;
@@ -50,6 +50,25 @@ class ChoicesWrapper extends choices_js_1.default {
50
50
  this.isDirectionUsing = false;
51
51
  this.shouldOpenDropDown = true;
52
52
  }
53
+ _onTouchEnd(event) {
54
+ var target = (event || event.touches[0]).target;
55
+ var touchWasWithinContainer = this._wasTap && this.containerOuter.element.contains(target);
56
+ if (touchWasWithinContainer) {
57
+ var containerWasExactTarget = target === this.containerOuter.element || target === this.containerInner.element;
58
+ if (containerWasExactTarget) {
59
+ if (this._isTextElement) {
60
+ this.input.focus();
61
+ }
62
+ else if (this._isSelectMultipleElement) {
63
+ this.input.focus();
64
+ this.showDropdown();
65
+ }
66
+ }
67
+ // Prevents focus event firing
68
+ event.stopPropagation();
69
+ }
70
+ this._wasTap = true;
71
+ }
53
72
  _handleButtonAction(activeItems, element) {
54
73
  if (!this._isSelectOneElement) {
55
74
  return super._handleButtonAction(activeItems, element);
@@ -258,9 +258,9 @@ function checkSimpleConditional(component, condition, row, data, instance) {
258
258
  return true;
259
259
  }
260
260
  const value = getComponentActualValue(conditionComponentPath, data, row);
261
- const СonditionOperator = conditionOperators_1.default[operator];
262
- return СonditionOperator
263
- ? new СonditionOperator().getResult({ value, comparedValue, instance, component, conditionComponentPath })
261
+ const ConditionOperator = conditionOperators_1.default[operator];
262
+ return ConditionOperator
263
+ ? new ConditionOperator().getResult({ value, comparedValue, instance, component, conditionComponentPath })
264
264
  : true;
265
265
  });
266
266
  let result = false;
@@ -14,8 +14,10 @@ export class Formio {
14
14
  static global(prop: any): any;
15
15
  static createElement(type: any, attrs: any, children: any): any;
16
16
  static addScript(src: any, name: any): Promise<any>;
17
- static addStyles(href: any, addGlobally?: boolean): Promise<void>;
17
+ static addStyles(href: any): Promise<void>;
18
18
  static submitDone(instance: any, submission: any): Promise<void>;
19
- static renderForm(form: any, options: any): Promise<any>;
19
+ static formioScript(script: any, builder: any): any;
20
+ static init(element: any, builder?: boolean): Promise<void>;
20
21
  static createForm(element: any, form: any, options: any): Promise<any>;
22
+ static builder(element: any, form: any, options: any): Promise<any>;
21
23
  }