@formio/js 5.0.0-dev.5739.0b95c46 → 5.0.0-dev.5740.c7c00bc

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.
@@ -685,7 +685,7 @@ class NestedComponent extends Field_1.default {
685
685
  validationProcessor({ scope, data, row, instance, component }, flags) {
686
686
  const { dirty } = flags;
687
687
  if (this.root.hasExtraPages && this.page !== this.root.page) {
688
- instance = this.getComponentById(component.id);
688
+ instance = this.getComponent(component.path);
689
689
  }
690
690
  if (!instance) {
691
691
  return;
@@ -1,4 +1,8 @@
1
1
  import comp1 from './comp1';
2
+ import comp10 from './comp10';
3
+ import comp11 from './comp11';
4
+ import comp12 from './comp12';
5
+ import comp13 from './comp13';
2
6
  import comp2 from './comp2';
3
7
  import comp3 from './comp3';
4
8
  import comp5 from './comp5';
@@ -6,9 +10,4 @@ import comp6 from './comp6';
6
10
  import comp7 from './comp7';
7
11
  import comp8 from './comp8';
8
12
  import comp9 from './comp9';
9
- import comp10 from './comp10';
10
- import comp11 from './comp11';
11
- import comp12 from './comp12';
12
- import comp13 from './comp13';
13
- import comp14 from './comp14';
14
- export { comp1, comp2, comp3, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14 };
13
+ export { comp1, comp10, comp11, comp12, comp13, comp2, comp3, comp5, comp6, comp7, comp8, comp9 };
@@ -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.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp3 = exports.comp2 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = 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"));
@@ -28,5 +28,3 @@ const comp12_1 = __importDefault(require("./comp12"));
28
28
  exports.comp12 = comp12_1.default;
29
29
  const comp13_1 = __importDefault(require("./comp13"));
30
30
  exports.comp13 = comp13_1.default;
31
- const comp14_1 = __importDefault(require("./comp14"));
32
- exports.comp14 = comp14_1.default;
@@ -101,10 +101,16 @@ class CalendarWidget extends InputWidget_1.default {
101
101
  this.settings.altFormat = (0, utils_1.convertFormatToFlatpickr)(this.settings.format);
102
102
  this.settings.dateFormat = (0, utils_1.convertFormatToFlatpickr)(this.settings.dateFormat);
103
103
  this.settings.position = 'auto center';
104
- // This is called when a date is picked in Flatpickrs calendar
105
104
  this.settings.onChange = () => {
106
- // Because a date was picked using flatpickrs calendar we can be sure that we don't have a manually overridden value
107
- this.settings.isManuallyOverriddenValue = false;
105
+ if (this.settings.allowInput) {
106
+ if (this.settings.isManuallyOverriddenValue && this.settings.enableTime) {
107
+ this.calendar._input.value = this.settings.manualInputValue;
108
+ }
109
+ else {
110
+ this.settings.manualInputValue = '';
111
+ }
112
+ this.settings.isManuallyOverriddenValue = false;
113
+ }
108
114
  this.emit('update');
109
115
  };
110
116
  this.settings.onOpen = () => this.hook('onCalendarOpen');
@@ -112,13 +118,9 @@ class CalendarWidget extends InputWidget_1.default {
112
118
  this.hook('onCalendarClose');
113
119
  this.closedOn = Date.now();
114
120
  if (this.settings.allowInput && this.settings.enableTime) {
115
- // We need to make sure that this block of code runs after Flatpickr sets the inputs value so that we can
116
- // override the value Flatpickr sets with a manual value if we are in the state of manually overridden value
117
- setTimeout(() => {
118
- this.calendar._input.value = this.settings.isManuallyOverriddenValue ? this.settings.manualInputValue : this.calendar.altInput.value;
119
- this._input.value = this.settings.isManuallyOverriddenValue ? this.settings.manualInputValue : this.calendar.altInput.value;
120
- this.emit('update');
121
- });
121
+ this.calendar._input.value = this.settings.manualInputValue || this.calendar._input.value;
122
+ this.settings.isManuallyOverriddenValue = false;
123
+ this.emit('update');
122
124
  }
123
125
  if (this.settings.wasDefaultValueChanged) {
124
126
  this.calendar._input.value = this.settings.defaultValue;
@@ -270,7 +272,7 @@ class CalendarWidget extends InputWidget_1.default {
270
272
  */
271
273
  getValue() {
272
274
  // Standard output format.
273
- if (!this.calendar || this.settings.isManuallyOverriddenValue) {
275
+ if (!this.calendar) {
274
276
  return super.getValue();
275
277
  }
276
278
  // Get the selected dates from the calendar widget.
@@ -355,24 +357,19 @@ class CalendarWidget extends InputWidget_1.default {
355
357
  // Create a new flatpickr.
356
358
  this.calendar = new Flatpickr(this._input, Object.assign(Object.assign({}, this.settings), { disableMobile: true }));
357
359
  this.addEventListener(this.calendar.altInput, 'input', (event) => {
358
- // Need to give time for the input mask to update so that the manualInputValue can be properly set
359
- setTimeout(() => {
360
- if (this.settings.allowInput && this.settings.currentValue !== event.target.value) {
361
- this.settings.manualInputValue = event.target.value;
362
- this._input.value = this.settings.manualInputValue;
363
- this.settings.isManuallyOverriddenValue = true;
364
- this.settings.currentValue = event.target.value;
365
- this.emit('update');
366
- }
367
- if (event.target.value === '' && this.calendar.selectedDates.length > 0) {
368
- this.settings.wasDefaultValueChanged = true;
369
- this.settings.defaultValue = event.target.value;
370
- this.calendar.clear();
371
- }
372
- else {
373
- this.settings.wasDefaultValueChanged = false;
374
- }
375
- });
360
+ if (this.settings.allowInput && this.settings.currentValue !== event.target.value) {
361
+ this.settings.manualInputValue = event.target.value;
362
+ this.settings.isManuallyOverriddenValue = true;
363
+ this.settings.currentValue = event.target.value;
364
+ }
365
+ if (event.target.value === '' && this.calendar.selectedDates.length > 0) {
366
+ this.settings.wasDefaultValueChanged = true;
367
+ this.settings.defaultValue = event.target.value;
368
+ this.calendar.clear();
369
+ }
370
+ else {
371
+ this.settings.wasDefaultValueChanged = false;
372
+ }
376
373
  });
377
374
  const excludedFromMaskFormats = ['MMMM'];
378
375
  if (!this.settings.readOnly && !lodash_1.default.some(excludedFromMaskFormats, format => lodash_1.default.includes(this.settings.format, format))) {
@@ -400,10 +397,6 @@ class CalendarWidget extends InputWidget_1.default {
400
397
  // Make sure we commit the value after a blur event occurs.
401
398
  this.addEventListener(this.calendar._input, 'blur', (event) => {
402
399
  var _a, _b, _c, _d;
403
- // If we have manually overridden the value then we shouldn't call setDate because this will fill the input mask
404
- if (this.settings.isManuallyOverriddenValue) {
405
- return;
406
- }
407
400
  const activeElement = this.settings.shadowRoot ? this.settings.shadowRoot.activeElement : document.activeElement;
408
401
  const relatedTarget = event.relatedTarget ? event.relatedTarget : activeElement;
409
402
  if (!(isIEBrowser && !relatedTarget) && !this.isCalendarElement(relatedTarget)) {
@@ -681,7 +681,7 @@ export default class NestedComponent extends Field {
681
681
  validationProcessor({ scope, data, row, instance, component }, flags) {
682
682
  const { dirty } = flags;
683
683
  if (this.root.hasExtraPages && this.page !== this.root.page) {
684
- instance = this.getComponentById(component.id);
684
+ instance = this.getComponent(component.path);
685
685
  }
686
686
  if (!instance) {
687
687
  return;
@@ -1,4 +1,8 @@
1
1
  import comp1 from './comp1';
2
+ import comp10 from './comp10';
3
+ import comp11 from './comp11';
4
+ import comp12 from './comp12';
5
+ import comp13 from './comp13';
2
6
  import comp2 from './comp2';
3
7
  import comp3 from './comp3';
4
8
  import comp5 from './comp5';
@@ -6,9 +10,4 @@ import comp6 from './comp6';
6
10
  import comp7 from './comp7';
7
11
  import comp8 from './comp8';
8
12
  import comp9 from './comp9';
9
- import comp10 from './comp10';
10
- import comp11 from './comp11';
11
- import comp12 from './comp12';
12
- import comp13 from './comp13';
13
- import comp14 from './comp14';
14
- export { comp1, comp2, comp3, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14 };
13
+ export { comp1, comp10, comp11, comp12, comp13, comp2, comp3, comp5, comp6, comp7, comp8, comp9 };
@@ -10,5 +10,4 @@ import comp10 from './comp10';
10
10
  import comp11 from './comp11';
11
11
  import comp12 from './comp12';
12
12
  import comp13 from './comp13';
13
- import comp14 from './comp14';
14
- export { comp1, comp2, comp3, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14 };
13
+ export { comp1, comp10, comp11, comp12, comp13, comp2, comp3, comp5, comp6, comp7, comp8, comp9 };
@@ -95,10 +95,16 @@ export default class CalendarWidget extends InputWidget {
95
95
  this.settings.altFormat = convertFormatToFlatpickr(this.settings.format);
96
96
  this.settings.dateFormat = convertFormatToFlatpickr(this.settings.dateFormat);
97
97
  this.settings.position = 'auto center';
98
- // This is called when a date is picked in Flatpickrs calendar
99
98
  this.settings.onChange = () => {
100
- // Because a date was picked using flatpickrs calendar we can be sure that we don't have a manually overridden value
101
- this.settings.isManuallyOverriddenValue = false;
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;
107
+ }
102
108
  this.emit('update');
103
109
  };
104
110
  this.settings.onOpen = () => this.hook('onCalendarOpen');
@@ -106,13 +112,9 @@ export default class CalendarWidget extends InputWidget {
106
112
  this.hook('onCalendarClose');
107
113
  this.closedOn = Date.now();
108
114
  if (this.settings.allowInput && this.settings.enableTime) {
109
- // We need to make sure that this block of code runs after Flatpickr sets the inputs value so that we can
110
- // override the value Flatpickr sets with a manual value if we are in the state of manually overridden value
111
- setTimeout(() => {
112
- this.calendar._input.value = this.settings.isManuallyOverriddenValue ? this.settings.manualInputValue : this.calendar.altInput.value;
113
- this._input.value = this.settings.isManuallyOverriddenValue ? this.settings.manualInputValue : this.calendar.altInput.value;
114
- this.emit('update');
115
- });
115
+ this.calendar._input.value = this.settings.manualInputValue || this.calendar._input.value;
116
+ this.settings.isManuallyOverriddenValue = false;
117
+ this.emit('update');
116
118
  }
117
119
  if (this.settings.wasDefaultValueChanged) {
118
120
  this.calendar._input.value = this.settings.defaultValue;
@@ -262,7 +264,7 @@ export default class CalendarWidget extends InputWidget {
262
264
  */
263
265
  getValue() {
264
266
  // Standard output format.
265
- if (!this.calendar || this.settings.isManuallyOverriddenValue) {
267
+ if (!this.calendar) {
266
268
  return super.getValue();
267
269
  }
268
270
  // Get the selected dates from the calendar widget.
@@ -346,24 +348,19 @@ export default class CalendarWidget extends InputWidget {
346
348
  // Create a new flatpickr.
347
349
  this.calendar = new Flatpickr(this._input, { ...this.settings, disableMobile: true });
348
350
  this.addEventListener(this.calendar.altInput, 'input', (event) => {
349
- // Need to give time for the input mask to update so that the manualInputValue can be properly set
350
- setTimeout(() => {
351
- if (this.settings.allowInput && this.settings.currentValue !== event.target.value) {
352
- this.settings.manualInputValue = event.target.value;
353
- this._input.value = this.settings.manualInputValue;
354
- this.settings.isManuallyOverriddenValue = true;
355
- this.settings.currentValue = event.target.value;
356
- this.emit('update');
357
- }
358
- if (event.target.value === '' && this.calendar.selectedDates.length > 0) {
359
- this.settings.wasDefaultValueChanged = true;
360
- this.settings.defaultValue = event.target.value;
361
- this.calendar.clear();
362
- }
363
- else {
364
- this.settings.wasDefaultValueChanged = false;
365
- }
366
- });
351
+ if (this.settings.allowInput && this.settings.currentValue !== event.target.value) {
352
+ this.settings.manualInputValue = event.target.value;
353
+ this.settings.isManuallyOverriddenValue = true;
354
+ this.settings.currentValue = event.target.value;
355
+ }
356
+ if (event.target.value === '' && this.calendar.selectedDates.length > 0) {
357
+ this.settings.wasDefaultValueChanged = true;
358
+ this.settings.defaultValue = event.target.value;
359
+ this.calendar.clear();
360
+ }
361
+ else {
362
+ this.settings.wasDefaultValueChanged = false;
363
+ }
367
364
  });
368
365
  const excludedFromMaskFormats = ['MMMM'];
369
366
  if (!this.settings.readOnly && !_.some(excludedFromMaskFormats, format => _.includes(this.settings.format, format))) {
@@ -390,10 +387,6 @@ export default class CalendarWidget extends InputWidget {
390
387
  }
391
388
  // Make sure we commit the value after a blur event occurs.
392
389
  this.addEventListener(this.calendar._input, 'blur', (event) => {
393
- // If we have manually overridden the value then we shouldn't call setDate because this will fill the input mask
394
- if (this.settings.isManuallyOverriddenValue) {
395
- return;
396
- }
397
390
  const activeElement = this.settings.shadowRoot ? this.settings.shadowRoot.activeElement : document.activeElement;
398
391
  const relatedTarget = event.relatedTarget ? event.relatedTarget : activeElement;
399
392
  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.5739.0b95c46",
3
+ "version": "5.0.0-dev.5740.c7c00bc",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -1,35 +0,0 @@
1
- declare namespace _default {
2
- let components: {
3
- label: string;
4
- tableView: boolean;
5
- datePicker: {
6
- disableWeekends: boolean;
7
- disableWeekdays: boolean;
8
- };
9
- enableMinDateInput: boolean;
10
- enableMaxDateInput: boolean;
11
- validateWhenHidden: boolean;
12
- key: string;
13
- type: string;
14
- input: boolean;
15
- widget: {
16
- type: string;
17
- displayInTimezone: string;
18
- locale: string;
19
- useLocaleSettings: boolean;
20
- allowInput: boolean;
21
- mode: string;
22
- enableTime: boolean;
23
- noCalendar: boolean;
24
- format: string;
25
- hourIncrement: number;
26
- minuteIncrement: number;
27
- time_24hr: boolean;
28
- minDate: null;
29
- disableWeekends: boolean;
30
- disableWeekdays: boolean;
31
- maxDate: null;
32
- };
33
- }[];
34
- }
35
- export default _default;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
4
- components: [
5
- {
6
- "label": "Date / Time",
7
- "tableView": false,
8
- "datePicker": {
9
- "disableWeekends": false,
10
- "disableWeekdays": false
11
- },
12
- "enableMinDateInput": false,
13
- "enableMaxDateInput": false,
14
- "validateWhenHidden": false,
15
- "key": "dateTime",
16
- "type": "datetime",
17
- "input": true,
18
- "widget": {
19
- "type": "calendar",
20
- "displayInTimezone": "viewer",
21
- "locale": "en",
22
- "useLocaleSettings": false,
23
- "allowInput": true,
24
- "mode": "single",
25
- "enableTime": true,
26
- "noCalendar": false,
27
- "format": "yyyy-MM-dd hh:mm a",
28
- "hourIncrement": 1,
29
- "minuteIncrement": 1,
30
- "time_24hr": false,
31
- "minDate": null,
32
- "disableWeekends": false,
33
- "disableWeekdays": false,
34
- "maxDate": null
35
- }
36
- }
37
- ]
38
- };
@@ -1,35 +0,0 @@
1
- declare namespace _default {
2
- let components: {
3
- label: string;
4
- tableView: boolean;
5
- datePicker: {
6
- disableWeekends: boolean;
7
- disableWeekdays: boolean;
8
- };
9
- enableMinDateInput: boolean;
10
- enableMaxDateInput: boolean;
11
- validateWhenHidden: boolean;
12
- key: string;
13
- type: string;
14
- input: boolean;
15
- widget: {
16
- type: string;
17
- displayInTimezone: string;
18
- locale: string;
19
- useLocaleSettings: boolean;
20
- allowInput: boolean;
21
- mode: string;
22
- enableTime: boolean;
23
- noCalendar: boolean;
24
- format: string;
25
- hourIncrement: number;
26
- minuteIncrement: number;
27
- time_24hr: boolean;
28
- minDate: null;
29
- disableWeekends: boolean;
30
- disableWeekdays: boolean;
31
- maxDate: null;
32
- };
33
- }[];
34
- }
35
- export default _default;
@@ -1,36 +0,0 @@
1
- export default {
2
- components: [
3
- {
4
- "label": "Date / Time",
5
- "tableView": false,
6
- "datePicker": {
7
- "disableWeekends": false,
8
- "disableWeekdays": false
9
- },
10
- "enableMinDateInput": false,
11
- "enableMaxDateInput": false,
12
- "validateWhenHidden": false,
13
- "key": "dateTime",
14
- "type": "datetime",
15
- "input": true,
16
- "widget": {
17
- "type": "calendar",
18
- "displayInTimezone": "viewer",
19
- "locale": "en",
20
- "useLocaleSettings": false,
21
- "allowInput": true,
22
- "mode": "single",
23
- "enableTime": true,
24
- "noCalendar": false,
25
- "format": "yyyy-MM-dd hh:mm a",
26
- "hourIncrement": 1,
27
- "minuteIncrement": 1,
28
- "time_24hr": false,
29
- "minDate": null,
30
- "disableWeekends": false,
31
- "disableWeekdays": false,
32
- "maxDate": null
33
- }
34
- }
35
- ]
36
- };