@formio/js 5.0.0-rc.21 → 5.0.0-rc.23

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 (71) hide show
  1. package/dist/formio.builder.css +2 -0
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  4. package/dist/formio.form.css +2 -0
  5. package/dist/formio.form.js +12 -12
  6. package/dist/formio.form.min.css +1 -1
  7. package/dist/formio.form.min.js +1 -1
  8. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  9. package/dist/formio.full.css +2 -0
  10. package/dist/formio.full.js +12 -12
  11. package/dist/formio.full.min.css +1 -1
  12. package/dist/formio.full.min.js +1 -1
  13. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  14. package/dist/formio.js +1 -1
  15. package/dist/formio.min.js +1 -1
  16. package/dist/formio.min.js.LICENSE.txt +1 -1
  17. package/dist/formio.utils.js +1 -1
  18. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  19. package/lib/cjs/Element.js +5 -0
  20. package/lib/cjs/components/_classes/component/Component.js +3 -3
  21. package/lib/cjs/components/_classes/field/Field.d.ts +1 -0
  22. package/lib/cjs/components/_classes/field/Field.js +14 -0
  23. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  24. package/lib/cjs/components/_classes/multivalue/Multivalue.js +0 -14
  25. package/lib/cjs/components/day/Day.d.ts +0 -1
  26. package/lib/cjs/components/day/Day.js +35 -11
  27. package/lib/cjs/components/day/fixtures/comp5.d.ts +29 -0
  28. package/lib/cjs/components/day/fixtures/comp5.js +32 -0
  29. package/lib/cjs/components/day/fixtures/comp6.d.ts +81 -0
  30. package/lib/cjs/components/day/fixtures/comp6.js +76 -0
  31. package/lib/cjs/components/day/fixtures/index.d.ts +3 -1
  32. package/lib/cjs/components/day/fixtures/index.js +5 -1
  33. package/lib/cjs/components/form/Form.js +2 -1
  34. package/lib/cjs/components/select/Select.js +2 -1
  35. package/lib/cjs/components/select/fixtures/comp19.d.ts +23 -0
  36. package/lib/cjs/components/select/fixtures/comp19.js +36 -0
  37. package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
  38. package/lib/cjs/components/select/fixtures/index.js +3 -1
  39. package/lib/cjs/components/tags/Tags.js +2 -0
  40. package/lib/cjs/components/tags/fixtures/comp6.d.ts +17 -0
  41. package/lib/cjs/components/tags/fixtures/comp6.js +20 -0
  42. package/lib/cjs/components/tags/fixtures/index.d.ts +2 -1
  43. package/lib/cjs/components/tags/fixtures/index.js +3 -1
  44. package/lib/cjs/utils/utils.js +3 -3
  45. package/lib/mjs/Element.js +5 -0
  46. package/lib/mjs/components/_classes/component/Component.js +3 -3
  47. package/lib/mjs/components/_classes/field/Field.d.ts +1 -0
  48. package/lib/mjs/components/_classes/field/Field.js +13 -0
  49. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  50. package/lib/mjs/components/_classes/multivalue/Multivalue.js +0 -13
  51. package/lib/mjs/components/day/Day.d.ts +0 -1
  52. package/lib/mjs/components/day/Day.js +34 -11
  53. package/lib/mjs/components/day/fixtures/comp5.d.ts +29 -0
  54. package/lib/mjs/components/day/fixtures/comp5.js +30 -0
  55. package/lib/mjs/components/day/fixtures/comp6.d.ts +81 -0
  56. package/lib/mjs/components/day/fixtures/comp6.js +74 -0
  57. package/lib/mjs/components/day/fixtures/index.d.ts +3 -1
  58. package/lib/mjs/components/day/fixtures/index.js +3 -1
  59. package/lib/mjs/components/form/Form.js +2 -1
  60. package/lib/mjs/components/select/Select.js +2 -1
  61. package/lib/mjs/components/select/fixtures/comp19.d.ts +23 -0
  62. package/lib/mjs/components/select/fixtures/comp19.js +34 -0
  63. package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
  64. package/lib/mjs/components/select/fixtures/index.js +2 -1
  65. package/lib/mjs/components/tags/Tags.js +2 -0
  66. package/lib/mjs/components/tags/fixtures/comp6.d.ts +17 -0
  67. package/lib/mjs/components/tags/fixtures/comp6.js +18 -0
  68. package/lib/mjs/components/tags/fixtures/index.d.ts +2 -1
  69. package/lib/mjs/components/tags/fixtures/index.js +2 -1
  70. package/lib/mjs/utils/utils.js +3 -3
  71. package/package.json +2 -2
@@ -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
+ };
@@ -2,4 +2,6 @@ import comp1 from './comp1';
2
2
  import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
- export { comp1, comp2, comp3, comp4 };
5
+ import comp5 from './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.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"));
@@ -12,3 +12,7 @@ const comp3_1 = __importDefault(require("./comp3"));
12
12
  exports.comp3 = comp3_1.default;
13
13
  const comp4_1 = __importDefault(require("./comp4"));
14
14
  exports.comp4 = comp4_1.default;
15
+ const comp5_1 = __importDefault(require("./comp5"));
16
+ exports.comp5 = comp5_1.default;
17
+ const comp6_1 = __importDefault(require("./comp6"));
18
+ exports.comp6 = comp6_1.default;
@@ -392,7 +392,8 @@ class FormComponent extends Component_1.default {
392
392
  if (this.builderMode || this.isHidden() || (this.isSubFormLazyLoad() && !fromAttach)) {
393
393
  return Promise.resolve();
394
394
  }
395
- if (this.hasLoadedForm && !this.isRevisionChanged) {
395
+ if (this.hasLoadedForm && !this.isRevisionChanged &&
396
+ !(this.options.pdf && this.useOriginalRevision && lodash_1.default.isNull(this.subForm) && !this.subFormLoading)) {
396
397
  // Pass config down to sub forms.
397
398
  if (this.root && this.root.form && this.root.form.config && !this.formObj.config) {
398
399
  this.formObj.config = this.root.form.config;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = __importDefault(require("lodash"));
7
7
  const Formio_1 = require("../../Formio");
8
8
  const ListComponent_1 = __importDefault(require("../_classes/list/ListComponent"));
9
+ const Input_1 = __importDefault(require("../_classes/input/Input"));
9
10
  const Form_1 = __importDefault(require("../../Form"));
10
11
  const utils_1 = require("../../utils/utils");
11
12
  const ChoicesWrapper_1 = __importDefault(require("../../utils/ChoicesWrapper"));
@@ -808,7 +809,7 @@ class SelectComponent extends ListComponent_1.default {
808
809
  this.choices.containerOuter.element.setAttribute('tabIndex', '-1');
809
810
  this.addEventListener(this.choices.containerOuter.element, 'focus', () => this.focusableElement.focus());
810
811
  }
811
- this.addFocusBlurEvents(this.focusableElement);
812
+ Input_1.default.prototype.addFocusBlurEvents.call(this, this.focusableElement);
812
813
  if (this.itemsFromUrl && !this.component.noRefreshOnScroll) {
813
814
  this.scrollList = this.choices.choiceList.element;
814
815
  this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
@@ -0,0 +1,23 @@
1
+ declare namespace _default {
2
+ const type: string;
3
+ const display: string;
4
+ const components: {
5
+ label: string;
6
+ widget: string;
7
+ tableView: boolean;
8
+ data: {
9
+ values: {
10
+ label: string;
11
+ value: string;
12
+ }[];
13
+ };
14
+ validateOn: string;
15
+ validate: {
16
+ custom: string;
17
+ };
18
+ key: string;
19
+ type: string;
20
+ input: boolean;
21
+ }[];
22
+ }
23
+ export default _default;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ type: 'form',
5
+ display: 'form',
6
+ components: [
7
+ {
8
+ label: 'Select',
9
+ widget: 'choicesjs',
10
+ tableView: true,
11
+ data: {
12
+ values: [
13
+ {
14
+ label: 'Banana',
15
+ value: 'banana'
16
+ },
17
+ {
18
+ label: 'Apple',
19
+ value: 'apple'
20
+ },
21
+ {
22
+ label: 'Pineapple',
23
+ value: 'pineapple'
24
+ }
25
+ ]
26
+ },
27
+ validateOn: 'blur',
28
+ validate: {
29
+ custom: "valid = data.select == 'apple' ? true : 'You must select an apple';"
30
+ },
31
+ key: 'select',
32
+ type: 'select',
33
+ input: true
34
+ },
35
+ ]
36
+ };
@@ -15,5 +15,6 @@ import comp15 from './comp15';
15
15
  import comp16 from './comp16';
16
16
  import comp17 from './comp17';
17
17
  import comp18 from './comp18';
18
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18 };
18
+ import comp19 from './comp19';
19
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19 };
19
20
  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.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.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"));
@@ -41,3 +41,5 @@ const comp17_1 = __importDefault(require("./comp17"));
41
41
  exports.comp17 = comp17_1.default;
42
42
  const comp18_1 = __importDefault(require("./comp18"));
43
43
  exports.comp18 = comp18_1.default;
44
+ const comp19_1 = __importDefault(require("./comp19"));
45
+ exports.comp19 = comp19_1.default;
@@ -84,6 +84,8 @@ class TagsComponent extends Input_1.default {
84
84
  });
85
85
  this.choices.itemList.element.tabIndex = element.tabIndex;
86
86
  this.addEventListener(this.choices.input.element, 'blur', () => {
87
+ // Emit event to the native Formio input, so the listener attached in the Input.js will be invoked
88
+ element.dispatchEvent(new Event('blur'));
87
89
  const value = this.choices.input.value;
88
90
  const maxTagsNumber = this.component.maxTags;
89
91
  const valuesCount = this.choices.getValue(true).length;
@@ -0,0 +1,17 @@
1
+ declare namespace _default {
2
+ const type: string;
3
+ const display: string;
4
+ const components: {
5
+ label: string;
6
+ tableView: boolean;
7
+ storeas: string;
8
+ validate: {
9
+ custom: string;
10
+ };
11
+ validateOn: string;
12
+ key: string;
13
+ type: string;
14
+ input: boolean;
15
+ }[];
16
+ }
17
+ export default _default;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ type: 'form',
5
+ display: 'form',
6
+ components: [
7
+ {
8
+ label: 'Tags',
9
+ tableView: false,
10
+ storeas: 'array',
11
+ validate: {
12
+ custom: "valid = data && data.tags.length <= 2 ? true : 'You cannot add more than 2 items'"
13
+ },
14
+ validateOn: 'blur',
15
+ key: 'tags',
16
+ type: 'tags',
17
+ input: true
18
+ },
19
+ ]
20
+ };
@@ -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;
@@ -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;
@@ -527,6 +527,11 @@ export default class Element {
527
527
  && !FormioUtils.Evaluator.templateSettings.interpolate.test(string)) {
528
528
  string = FormioUtils.translateHTMLTemplate(String(string), (value) => this.t(value));
529
529
  }
530
+ if (this.component.filter === string && !this.options.building) {
531
+ const evalContext = this.evalContext(data);
532
+ evalContext.data = _.mapValues(evalContext.data, (val) => _.isString(val) ? encodeURIComponent(val) : val);
533
+ return FormioUtils.interpolate(string, evalContext, options);
534
+ }
530
535
  return FormioUtils.interpolate(string, this.evalContext(data), options);
531
536
  }
532
537
  /**
@@ -1506,16 +1506,16 @@ export default class Component extends Element {
1506
1506
  if (this.refs.input?.length) {
1507
1507
  const { selection, index } = this.root.currentSelection;
1508
1508
  let input = this.refs.input[index];
1509
- const isInputRangeSelectable = /text|search|password|tel|url/i.test(input.type || '');
1509
+ const isInputRangeSelectable = (i) => /text|search|password|tel|url/i.test(i?.type || '');
1510
1510
  if (input) {
1511
- if (isInputRangeSelectable) {
1511
+ if (isInputRangeSelectable(input)) {
1512
1512
  input.setSelectionRange(...selection);
1513
1513
  }
1514
1514
  }
1515
1515
  else {
1516
1516
  input = this.refs.input[this.refs.input.length];
1517
1517
  const lastCharacter = input.value?.length || 0;
1518
- if (isInputRangeSelectable) {
1518
+ if (isInputRangeSelectable(input)) {
1519
1519
  input.setSelectionRange(lastCharacter, lastCharacter);
1520
1520
  }
1521
1521
  }
@@ -1,4 +1,5 @@
1
1
  export default class Field extends Component {
2
2
  render(element: any): any;
3
+ saveCaretPosition(element: any, index: any): void;
3
4
  }
4
5
  import Component from '../component/Component';
@@ -18,4 +18,17 @@ export default class Field extends Component {
18
18
  }));
19
19
  }
20
20
  }
21
+ // Saves current caret position to restore it after the component is redrawn
22
+ saveCaretPosition(element, index) {
23
+ if (this.root?.focusedComponent?.path === this.path) {
24
+ try {
25
+ this.root.currentSelection = { selection: [element.selectionStart, element.selectionEnd], index };
26
+ }
27
+ catch (e) {
28
+ if (!(e instanceof DOMException)) {
29
+ console.debug(e);
30
+ }
31
+ }
32
+ }
33
+ }
21
34
  }
@@ -12,7 +12,6 @@ export default class Multivalue extends Field {
12
12
  * @param index
13
13
  */
14
14
  attachElement(element: any, index: any): void;
15
- saveCaretPosition(element: any, index: any): void;
16
15
  onSelectMaskHandler(event: any): void;
17
16
  getMaskPattern(maskName: any): any;
18
17
  multiMasks: {} | undefined;
@@ -177,19 +177,6 @@ export default class Multivalue extends Field {
177
177
  }
178
178
  }
179
179
  }
180
- // Saves current caret position to restore it after the component is redrawn
181
- saveCaretPosition(element, index) {
182
- if (this.root?.focusedComponent?.path === this.path) {
183
- try {
184
- this.root.currentSelection = { selection: [element.selectionStart, element.selectionEnd], index };
185
- }
186
- catch (e) {
187
- if (!(e instanceof DOMException)) {
188
- console.debug(e);
189
- }
190
- }
191
- }
192
- }
193
180
  onSelectMaskHandler(event) {
194
181
  this.updateMask(event.target.maskInput, this.getMaskPattern(event.target.value));
195
182
  }
@@ -157,7 +157,6 @@ export default class DayComponent extends Field {
157
157
  * @return {null}
158
158
  */
159
159
  getValueAsString(value: any): null;
160
- focus(): void;
161
160
  isPartialDay(value: any): boolean;
162
161
  getValidationFormat(): "DD-MM-YYYY" | "MM-DD-YYYY";
163
162
  }
@@ -255,6 +255,17 @@ export default class DayComponent extends Field {
255
255
  attach(element) {
256
256
  this.loadRefs(element, { day: 'single', month: 'single', year: 'single', input: 'multiple' });
257
257
  const superAttach = super.attach(element);
258
+ const updateValueAndSaveFocus = (element, name) => () => {
259
+ try {
260
+ this.saveCaretPosition(element, name);
261
+ }
262
+ catch (err) {
263
+ console.warn('An error occurred while trying to save caret position', err);
264
+ }
265
+ this.updateValue(null, {
266
+ modified: true,
267
+ });
268
+ };
258
269
  if (this.shouldDisabled) {
259
270
  this.setDisabled(this.refs.day, true);
260
271
  this.setDisabled(this.refs.month, true);
@@ -264,9 +275,7 @@ export default class DayComponent extends Field {
264
275
  }
265
276
  }
266
277
  else {
267
- this.addEventListener(this.refs.day, 'input', () => this.updateValue(null, {
268
- modified: true
269
- }));
278
+ this.addEventListener(this.refs.day, 'input', updateValueAndSaveFocus(this.refs.day, 'day'));
270
279
  // TODO: Need to rework this to work with day select as well.
271
280
  // Change day max input when month changes.
272
281
  this.addEventListener(this.refs.month, 'input', () => {
@@ -279,16 +288,15 @@ export default class DayComponent extends Field {
279
288
  if (maxDay && day > maxDay) {
280
289
  this.refs.day.value = this.refs.day.max;
281
290
  }
282
- this.updateValue(null, {
283
- modified: true
284
- });
291
+ updateValueAndSaveFocus(this.refs.month, 'month')();
285
292
  });
286
- this.addEventListener(this.refs.year, 'input', () => this.updateValue(null, {
287
- modified: true
288
- }));
293
+ this.addEventListener(this.refs.year, 'input', updateValueAndSaveFocus(this.refs.year, 'year'));
289
294
  this.addEventListener(this.refs.input, this.info.changeEvent, () => this.updateValue(null, {
290
295
  modified: true
291
296
  }));
297
+ [this.refs.day, this.refs.month, this.refs.year].filter((element) => !!element).forEach((element) => {
298
+ super.addFocusBlurEvents(element);
299
+ });
292
300
  }
293
301
  this.setValue(this.dataValue);
294
302
  // Force the disabled state with getters and setters.
@@ -520,8 +528,11 @@ export default class DayComponent extends Field {
520
528
  getValueAsString(value) {
521
529
  return this.getDate(value) || '';
522
530
  }
523
- focus() {
524
- if (this.dayFirst && this.showDay || !this.dayFirst && !this.showMonth && this.showDay) {
531
+ focus(field) {
532
+ if (field && typeof field === 'string' && this.refs[field]) {
533
+ this.refs[field].focus();
534
+ }
535
+ else if (this.dayFirst && this.showDay || !this.dayFirst && !this.showMonth && this.showDay) {
525
536
  this.refs.day?.focus();
526
537
  }
527
538
  else if (this.dayFirst && !this.showDay && this.showMonth || !this.dayFirst && this.showMonth) {
@@ -531,6 +542,18 @@ export default class DayComponent extends Field {
531
542
  this.refs.year?.focus();
532
543
  }
533
544
  }
545
+ restoreCaretPosition() {
546
+ if (this.root?.currentSelection) {
547
+ const { selection, index } = this.root.currentSelection;
548
+ if (this.refs[index]) {
549
+ const input = this.refs[index];
550
+ const isInputRangeSelectable = (i) => /text|search|password|tel|url/i.test(i?.type || '');
551
+ if (isInputRangeSelectable(input)) {
552
+ input.setSelectionRange(...selection);
553
+ }
554
+ }
555
+ }
556
+ }
534
557
  isPartialDay(value) {
535
558
  if (!value) {
536
559
  return false;
@@ -0,0 +1,29 @@
1
+ declare namespace _default {
2
+ const type: string;
3
+ const display: string;
4
+ const components: {
5
+ label: string;
6
+ hideInputLabels: boolean;
7
+ inputsLabelPosition: string;
8
+ useLocaleSettings: boolean;
9
+ tableView: boolean;
10
+ fields: {
11
+ day: {
12
+ hide: boolean;
13
+ required: boolean;
14
+ };
15
+ month: {
16
+ hide: boolean;
17
+ };
18
+ year: {
19
+ hide: boolean;
20
+ };
21
+ };
22
+ validateOn: string;
23
+ key: string;
24
+ type: string;
25
+ input: boolean;
26
+ defaultValue: string;
27
+ }[];
28
+ }
29
+ export default _default;
@@ -0,0 +1,30 @@
1
+ export default {
2
+ type: 'form',
3
+ display: 'form',
4
+ components: [
5
+ {
6
+ label: 'Day',
7
+ hideInputLabels: false,
8
+ inputsLabelPosition: 'top',
9
+ useLocaleSettings: false,
10
+ tableView: false,
11
+ fields: {
12
+ day: {
13
+ hide: false,
14
+ required: true
15
+ },
16
+ month: {
17
+ hide: false
18
+ },
19
+ year: {
20
+ hide: false
21
+ }
22
+ },
23
+ validateOn: 'blur',
24
+ key: 'day',
25
+ type: 'day',
26
+ input: true,
27
+ defaultValue: '00/00/0000'
28
+ },
29
+ ]
30
+ };
@@ -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;