@formio/js 5.0.0-dev.5796.ee2613b → 5.0.0-dev.5799.552d965

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 (45) hide show
  1. package/Changelog.md +3 -0
  2. package/dist/formio.form.js +564 -572
  3. package/dist/formio.form.min.js +1 -1
  4. package/dist/formio.form.min.js.LICENSE.txt +0 -10
  5. package/dist/formio.full.js +565 -573
  6. package/dist/formio.full.min.js +1 -1
  7. package/dist/formio.full.min.js.LICENSE.txt +0 -10
  8. package/dist/formio.js +1 -1
  9. package/dist/formio.min.js +1 -1
  10. package/dist/formio.utils.js +50 -48
  11. package/dist/formio.utils.min.js +1 -1
  12. package/dist/formio.utils.min.js.LICENSE.txt +4 -4
  13. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +8 -0
  14. package/lib/cjs/components/_classes/multivalue/Multivalue.js +12 -10
  15. package/lib/cjs/components/datetime/fixtures/comp14.d.ts +35 -0
  16. package/lib/cjs/components/datetime/fixtures/comp14.js +38 -0
  17. package/lib/cjs/components/datetime/fixtures/index.d.ts +6 -5
  18. package/lib/cjs/components/datetime/fixtures/index.js +3 -1
  19. package/lib/cjs/components/html/HTML.js +1 -1
  20. package/lib/cjs/components/radio/Radio.js +1 -1
  21. package/lib/cjs/components/select/Select.js +2 -5
  22. package/lib/cjs/components/select/editForm/Select.edit.validation.js +1 -2
  23. package/lib/cjs/components/select/fixtures/comp27.d.ts +18 -0
  24. package/lib/cjs/components/select/fixtures/comp27.js +19 -0
  25. package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
  26. package/lib/cjs/components/select/fixtures/index.js +3 -1
  27. package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
  28. package/lib/cjs/widgets/CalendarWidget.js +24 -10
  29. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +8 -0
  30. package/lib/mjs/components/_classes/multivalue/Multivalue.js +12 -10
  31. package/lib/mjs/components/datetime/fixtures/comp14.d.ts +35 -0
  32. package/lib/mjs/components/datetime/fixtures/comp14.js +36 -0
  33. package/lib/mjs/components/datetime/fixtures/index.d.ts +6 -5
  34. package/lib/mjs/components/datetime/fixtures/index.js +2 -1
  35. package/lib/mjs/components/html/HTML.js +1 -1
  36. package/lib/mjs/components/radio/Radio.js +1 -1
  37. package/lib/mjs/components/select/Select.js +2 -5
  38. package/lib/mjs/components/select/editForm/Select.edit.validation.js +1 -2
  39. package/lib/mjs/components/select/fixtures/comp27.d.ts +18 -0
  40. package/lib/mjs/components/select/fixtures/comp27.js +17 -0
  41. package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
  42. package/lib/mjs/components/select/fixtures/index.js +2 -1
  43. package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
  44. package/lib/mjs/widgets/CalendarWidget.js +24 -10
  45. package/package.json +2 -2
@@ -0,0 +1,18 @@
1
+ declare namespace _default {
2
+ let type: string;
3
+ let label: string;
4
+ let widget: string;
5
+ let tableView: boolean;
6
+ let dataSrc: string;
7
+ namespace data {
8
+ let custom: string;
9
+ }
10
+ let dataType: string;
11
+ let idPath: string;
12
+ let valueProperty: string;
13
+ let template: string;
14
+ let validateWhenHidden: boolean;
15
+ let key: string;
16
+ let input: boolean;
17
+ }
18
+ export default _default;
@@ -0,0 +1,17 @@
1
+ export default {
2
+ type: 'select',
3
+ label: 'Select',
4
+ widget: 'choicesjs',
5
+ tableView: true,
6
+ dataSrc: 'custom',
7
+ data: {
8
+ custom: 'values = data.dataSource;'
9
+ },
10
+ dataType: 'string',
11
+ idPath: 'name',
12
+ valueProperty: 'name',
13
+ template: '<span>{{ item.name }}</span>',
14
+ validateWhenHidden: false,
15
+ key: 'select',
16
+ input: true
17
+ };
@@ -23,5 +23,6 @@ import comp23 from './comp23';
23
23
  import comp24 from './comp24';
24
24
  import comp25 from './comp25';
25
25
  import comp26 from './comp26';
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, comp26 };
26
+ import comp27 from './comp27';
27
+ 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, comp26, comp27 };
27
28
  export { multiSelect, multiSelectOptions } from "./comp3";
@@ -24,4 +24,5 @@ import comp23 from './comp23';
24
24
  import comp24 from './comp24';
25
25
  import comp25 from './comp25';
26
26
  import comp26 from './comp26';
27
- 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, comp26 };
27
+ import comp27 from './comp27';
28
+ 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, comp26, comp27 };
@@ -256,7 +256,7 @@ export default class SelectBoxesComponent extends RadioComponent {
256
256
  if (!boolValue(setting) || !value) {
257
257
  return true;
258
258
  }
259
- const values = this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions;
259
+ const values = this.component.values;
260
260
  const availableValueKeys = (values || []).map(({ value: optionValue }) => optionValue);
261
261
  const valueKeys = Object.keys(value);
262
262
  return valueKeys.every((key) => availableValueKeys.includes(key));
@@ -96,14 +96,8 @@ export default class CalendarWidget extends InputWidget {
96
96
  this.settings.dateFormat = convertFormatToFlatpickr(this.settings.dateFormat);
97
97
  this.settings.position = 'auto center';
98
98
  this.settings.onChange = () => {
99
- if (this.settings.allowInput) {
100
- if (this.settings.isManuallyOverriddenValue && this.settings.enableTime) {
101
- this.calendar._input.value = this.settings.manualInputValue;
102
- }
103
- else {
104
- this.settings.manualInputValue = '';
105
- }
106
- this.settings.isManuallyOverriddenValue = false;
99
+ if (this.settings.allowInput && this.settings.enableTime) {
100
+ this.calendar._input.value = this.settings.isManuallyOverriddenValue ? this.settings.manualInputValue : this.calendar.altInput.value;
107
101
  }
108
102
  this.emit('update');
109
103
  };
@@ -112,8 +106,7 @@ export default class CalendarWidget extends InputWidget {
112
106
  this.hook('onCalendarClose');
113
107
  this.closedOn = Date.now();
114
108
  if (this.settings.allowInput && this.settings.enableTime) {
115
- this.calendar._input.value = this.settings.manualInputValue || this.calendar._input.value;
116
- this.settings.isManuallyOverriddenValue = false;
109
+ this.calendar._input.value = this.settings.isManuallyOverriddenValue ? this.settings.manualInputValue : this.calendar.altInput.value;
117
110
  this.emit('update');
118
111
  }
119
112
  if (this.settings.wasDefaultValueChanged) {
@@ -349,9 +342,14 @@ export default class CalendarWidget extends InputWidget {
349
342
  this.calendar = new Flatpickr(this._input, { ...this.settings, disableMobile: true });
350
343
  this.addEventListener(this.calendar.altInput, 'input', (event) => {
351
344
  if (this.settings.allowInput && this.settings.currentValue !== event.target.value) {
345
+ if (event.target.mask) {
346
+ event.target.mask.textMaskInputElement.update();
347
+ }
352
348
  this.settings.manualInputValue = event.target.value;
349
+ this._input.value = this.settings.manualInputValue;
353
350
  this.settings.isManuallyOverriddenValue = true;
354
351
  this.settings.currentValue = event.target.value;
352
+ this.emit('update');
355
353
  }
356
354
  if (event.target.value === '' && this.calendar.selectedDates.length > 0) {
357
355
  this.settings.wasDefaultValueChanged = true;
@@ -362,6 +360,18 @@ export default class CalendarWidget extends InputWidget {
362
360
  this.settings.wasDefaultValueChanged = false;
363
361
  }
364
362
  });
363
+ if (this.calendar.daysContainer) {
364
+ this.calendar.daysContainer.addEventListener('click', () => {
365
+ this.settings.isManuallyOverriddenValue = false;
366
+ this.calendar.updateValue(false);
367
+ });
368
+ }
369
+ if (this.calendar.timeContainer) {
370
+ this.calendar.timeContainer.addEventListener('click', () => {
371
+ this.settings.isManuallyOverriddenValue = false;
372
+ this.calendar.updateValue(false);
373
+ });
374
+ }
365
375
  const excludedFromMaskFormats = ['MMMM'];
366
376
  if (!this.settings.readOnly && !_.some(excludedFromMaskFormats, format => _.includes(this.settings.format, format))) {
367
377
  // Enforce the input mask of the format.
@@ -387,6 +397,10 @@ export default class CalendarWidget extends InputWidget {
387
397
  }
388
398
  // Make sure we commit the value after a blur event occurs.
389
399
  this.addEventListener(this.calendar._input, 'blur', (event) => {
400
+ // If we have manually overridden the value then we shouldn't call setDate because this will fill the input mask
401
+ if (this.settings.isManuallyOverriddenValue) {
402
+ return;
403
+ }
390
404
  const activeElement = this.settings.shadowRoot ? this.settings.shadowRoot.activeElement : document.activeElement;
391
405
  const relatedTarget = event.relatedTarget ? event.relatedTarget : activeElement;
392
406
  if (!(isIEBrowser && !relatedTarget) && !this.isCalendarElement(relatedTarget)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5796.ee2613b",
3
+ "version": "5.0.0-dev.5799.552d965",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -81,7 +81,7 @@
81
81
  "dependencies": {
82
82
  "@formio/bootstrap": "3.0.0-dev.98.17ba6ea",
83
83
  "@formio/choices.js": "^10.2.1",
84
- "@formio/core": "2.1.0-dev.105.1bff2e6",
84
+ "@formio/core": "2.1.0-dev.145.4491833",
85
85
  "@formio/text-mask-addons": "^3.8.0-formio.2",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",