@formio/js 5.0.0-dev.5798.beb3cc0 → 5.0.0-dev.5800.896e9df
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/Changelog.md +3 -0
- package/dist/formio.form.js +7 -7
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +7 -7
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +3 -3
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +2 -2
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +9 -5
- package/lib/cjs/components/datetime/fixtures/comp14.d.ts +35 -0
- package/lib/cjs/components/datetime/fixtures/comp14.js +38 -0
- package/lib/cjs/components/datetime/fixtures/index.d.ts +6 -5
- package/lib/cjs/components/datetime/fixtures/index.js +3 -1
- package/lib/cjs/components/day/Day.js +1 -1
- package/lib/cjs/components/html/HTML.js +1 -1
- package/lib/cjs/utils/formUtils.d.ts +1 -2
- package/lib/cjs/utils/formUtils.js +2 -3
- package/lib/cjs/widgets/CalendarWidget.js +24 -10
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +2 -2
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +9 -5
- package/lib/mjs/components/datetime/fixtures/comp14.d.ts +35 -0
- package/lib/mjs/components/datetime/fixtures/comp14.js +36 -0
- package/lib/mjs/components/datetime/fixtures/index.d.ts +6 -5
- package/lib/mjs/components/datetime/fixtures/index.js +2 -1
- package/lib/mjs/components/day/Day.js +1 -1
- package/lib/mjs/components/html/HTML.js +1 -1
- package/lib/mjs/utils/formUtils.d.ts +1 -2
- package/lib/mjs/utils/formUtils.js +2 -2
- package/lib/mjs/widgets/CalendarWidget.js +24 -10
- package/package.json +2 -2
|
@@ -2,11 +2,11 @@ export default class Multivalue extends Field {
|
|
|
2
2
|
/**
|
|
3
3
|
* Normalize values coming into updateValue.
|
|
4
4
|
* @param {*} value - The value to normalize before setting.
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {object} flags - Flags to use when normalizing the value.
|
|
6
6
|
* @param {*} emptyValue - The empty value for the field.
|
|
7
7
|
* @returns {*} - The normalized value.
|
|
8
8
|
*/
|
|
9
|
-
normalizeValue(value: any, flags?:
|
|
9
|
+
normalizeValue(value: any, flags?: object, emptyValue?: any): any;
|
|
10
10
|
get addAnother(): string;
|
|
11
11
|
/**
|
|
12
12
|
* @returns {Field} - The created field.
|
|
@@ -5,23 +5,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Field_1 = __importDefault(require("../field/Field"));
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const core_1 = require("@formio/core");
|
|
8
9
|
class Multivalue extends Field_1.default {
|
|
9
10
|
/**
|
|
10
11
|
* Normalize values coming into updateValue.
|
|
11
12
|
* @param {*} value - The value to normalize before setting.
|
|
12
|
-
* @param {
|
|
13
|
+
* @param {object} flags - Flags to use when normalizing the value.
|
|
13
14
|
* @param {*} emptyValue - The empty value for the field.
|
|
14
15
|
* @returns {*} - The normalized value.
|
|
15
16
|
*/
|
|
16
17
|
normalizeValue(value, flags = {}, emptyValue = this.emptyValue) {
|
|
18
|
+
const underlyingValueShouldBeArray = core_1.Utils.getModelType(this.component) === 'array' || this.component.storeas === 'array' || Array.isArray(emptyValue);
|
|
17
19
|
if (this.component.multiple) {
|
|
18
20
|
if (Array.isArray(value)) {
|
|
21
|
+
if (underlyingValueShouldBeArray) {
|
|
22
|
+
if (value.length === 0 || !Array.isArray(value[0])) {
|
|
23
|
+
return [value];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
19
26
|
if (value.length === 0) {
|
|
20
27
|
return [emptyValue];
|
|
21
28
|
}
|
|
22
|
-
if (this.component.storeas === 'array') {
|
|
23
|
-
return super.normalizeValue([value], flags);
|
|
24
|
-
}
|
|
25
29
|
return super.normalizeValue(value, flags);
|
|
26
30
|
}
|
|
27
31
|
else {
|
|
@@ -29,7 +33,7 @@ class Multivalue extends Field_1.default {
|
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
35
|
else {
|
|
32
|
-
if (Array.isArray(value) && !
|
|
36
|
+
if (Array.isArray(value) && !underlyingValueShouldBeArray) {
|
|
33
37
|
if (this.component.storeas === 'string') {
|
|
34
38
|
return super.normalizeValue(value.join(this.delimiter || ''), flags);
|
|
35
39
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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;
|
|
@@ -0,0 +1,38 @@
|
|
|
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,8 +1,4 @@
|
|
|
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';
|
|
6
2
|
import comp2 from './comp2';
|
|
7
3
|
import comp3 from './comp3';
|
|
8
4
|
import comp5 from './comp5';
|
|
@@ -10,4 +6,9 @@ import comp6 from './comp6';
|
|
|
10
6
|
import comp7 from './comp7';
|
|
11
7
|
import comp8 from './comp8';
|
|
12
8
|
import comp9 from './comp9';
|
|
13
|
-
|
|
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 };
|
|
@@ -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.
|
|
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;
|
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
|
8
8
|
exports.comp1 = comp1_1.default;
|
|
9
9
|
const comp2_1 = __importDefault(require("./comp2"));
|
|
@@ -28,3 +28,5 @@ 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;
|
|
@@ -561,7 +561,7 @@ class DayComponent extends Field_1.default {
|
|
|
561
561
|
}
|
|
562
562
|
isPartialDay(value) {
|
|
563
563
|
if (!value) {
|
|
564
|
-
return
|
|
564
|
+
return true;
|
|
565
565
|
}
|
|
566
566
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
567
567
|
const values = value.split('/');
|
|
@@ -8,11 +8,10 @@ export function findComponents(components: import('@formio/core').Component[], q
|
|
|
8
8
|
export const flattenComponents: typeof Utils.flattenComponents;
|
|
9
9
|
export const guid: typeof Utils.guid;
|
|
10
10
|
export const uniqueName: typeof Utils.uniqueName;
|
|
11
|
-
export const MODEL_TYPES:
|
|
11
|
+
export const MODEL_TYPES: any;
|
|
12
12
|
export const getModelType: typeof Utils.getModelType;
|
|
13
13
|
export const getComponentAbsolutePath: typeof Utils.getComponentAbsolutePath;
|
|
14
14
|
export const getComponentPath: typeof Utils.getComponentPath;
|
|
15
|
-
export const isComponentModelType: typeof Utils.isComponentModelType;
|
|
16
15
|
export const isComponentNestedDataType: typeof Utils.isComponentNestedDataType;
|
|
17
16
|
export const componentPath: typeof Utils.componentPath;
|
|
18
17
|
export const componentChildPath: any;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.componentChildPath = exports.componentPath = exports.isComponentNestedDataType = exports.
|
|
3
|
+
exports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.componentChildPath = exports.componentPath = exports.isComponentNestedDataType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES = exports.uniqueName = exports.guid = exports.flattenComponents = exports.findComponents = void 0;
|
|
4
4
|
const core_1 = require("@formio/core");
|
|
5
|
-
const { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath,
|
|
5
|
+
const { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentNestedDataType, componentPath, componentChildPath, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty } = core_1.Utils;
|
|
6
6
|
exports.flattenComponents = flattenComponents;
|
|
7
7
|
exports.guid = guid;
|
|
8
8
|
exports.uniqueName = uniqueName;
|
|
@@ -10,7 +10,6 @@ exports.MODEL_TYPES = MODEL_TYPES;
|
|
|
10
10
|
exports.getModelType = getModelType;
|
|
11
11
|
exports.getComponentAbsolutePath = getComponentAbsolutePath;
|
|
12
12
|
exports.getComponentPath = getComponentPath;
|
|
13
|
-
exports.isComponentModelType = isComponentModelType;
|
|
14
13
|
exports.isComponentNestedDataType = isComponentNestedDataType;
|
|
15
14
|
exports.componentPath = componentPath;
|
|
16
15
|
exports.componentChildPath = componentChildPath;
|
|
@@ -102,14 +102,8 @@ class CalendarWidget extends InputWidget_1.default {
|
|
|
102
102
|
this.settings.dateFormat = (0, utils_1.convertFormatToFlatpickr)(this.settings.dateFormat);
|
|
103
103
|
this.settings.position = 'auto center';
|
|
104
104
|
this.settings.onChange = () => {
|
|
105
|
-
if (this.settings.allowInput) {
|
|
106
|
-
|
|
107
|
-
this.calendar._input.value = this.settings.manualInputValue;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
this.settings.manualInputValue = '';
|
|
111
|
-
}
|
|
112
|
-
this.settings.isManuallyOverriddenValue = false;
|
|
105
|
+
if (this.settings.allowInput && this.settings.enableTime) {
|
|
106
|
+
this.calendar._input.value = this.settings.isManuallyOverriddenValue ? this.settings.manualInputValue : this.calendar.altInput.value;
|
|
113
107
|
}
|
|
114
108
|
this.emit('update');
|
|
115
109
|
};
|
|
@@ -118,8 +112,7 @@ class CalendarWidget extends InputWidget_1.default {
|
|
|
118
112
|
this.hook('onCalendarClose');
|
|
119
113
|
this.closedOn = Date.now();
|
|
120
114
|
if (this.settings.allowInput && this.settings.enableTime) {
|
|
121
|
-
this.calendar._input.value = this.settings.manualInputValue
|
|
122
|
-
this.settings.isManuallyOverriddenValue = false;
|
|
115
|
+
this.calendar._input.value = this.settings.isManuallyOverriddenValue ? this.settings.manualInputValue : this.calendar.altInput.value;
|
|
123
116
|
this.emit('update');
|
|
124
117
|
}
|
|
125
118
|
if (this.settings.wasDefaultValueChanged) {
|
|
@@ -358,9 +351,14 @@ class CalendarWidget extends InputWidget_1.default {
|
|
|
358
351
|
this.calendar = new Flatpickr(this._input, Object.assign(Object.assign({}, this.settings), { disableMobile: true }));
|
|
359
352
|
this.addEventListener(this.calendar.altInput, 'input', (event) => {
|
|
360
353
|
if (this.settings.allowInput && this.settings.currentValue !== event.target.value) {
|
|
354
|
+
if (event.target.mask) {
|
|
355
|
+
event.target.mask.textMaskInputElement.update();
|
|
356
|
+
}
|
|
361
357
|
this.settings.manualInputValue = event.target.value;
|
|
358
|
+
this._input.value = this.settings.manualInputValue;
|
|
362
359
|
this.settings.isManuallyOverriddenValue = true;
|
|
363
360
|
this.settings.currentValue = event.target.value;
|
|
361
|
+
this.emit('update');
|
|
364
362
|
}
|
|
365
363
|
if (event.target.value === '' && this.calendar.selectedDates.length > 0) {
|
|
366
364
|
this.settings.wasDefaultValueChanged = true;
|
|
@@ -371,6 +369,18 @@ class CalendarWidget extends InputWidget_1.default {
|
|
|
371
369
|
this.settings.wasDefaultValueChanged = false;
|
|
372
370
|
}
|
|
373
371
|
});
|
|
372
|
+
if (this.calendar.daysContainer) {
|
|
373
|
+
this.calendar.daysContainer.addEventListener('click', () => {
|
|
374
|
+
this.settings.isManuallyOverriddenValue = false;
|
|
375
|
+
this.calendar.updateValue(false);
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
if (this.calendar.timeContainer) {
|
|
379
|
+
this.calendar.timeContainer.addEventListener('click', () => {
|
|
380
|
+
this.settings.isManuallyOverriddenValue = false;
|
|
381
|
+
this.calendar.updateValue(false);
|
|
382
|
+
});
|
|
383
|
+
}
|
|
374
384
|
const excludedFromMaskFormats = ['MMMM'];
|
|
375
385
|
if (!this.settings.readOnly && !lodash_1.default.some(excludedFromMaskFormats, format => lodash_1.default.includes(this.settings.format, format))) {
|
|
376
386
|
// Enforce the input mask of the format.
|
|
@@ -397,6 +407,10 @@ class CalendarWidget extends InputWidget_1.default {
|
|
|
397
407
|
// Make sure we commit the value after a blur event occurs.
|
|
398
408
|
this.addEventListener(this.calendar._input, 'blur', (event) => {
|
|
399
409
|
var _a, _b, _c, _d;
|
|
410
|
+
// If we have manually overridden the value then we shouldn't call setDate because this will fill the input mask
|
|
411
|
+
if (this.settings.isManuallyOverriddenValue) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
400
414
|
const activeElement = this.settings.shadowRoot ? this.settings.shadowRoot.activeElement : document.activeElement;
|
|
401
415
|
const relatedTarget = event.relatedTarget ? event.relatedTarget : activeElement;
|
|
402
416
|
if (!(isIEBrowser && !relatedTarget) && !this.isCalendarElement(relatedTarget)) {
|
|
@@ -2,11 +2,11 @@ export default class Multivalue extends Field {
|
|
|
2
2
|
/**
|
|
3
3
|
* Normalize values coming into updateValue.
|
|
4
4
|
* @param {*} value - The value to normalize before setting.
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {object} flags - Flags to use when normalizing the value.
|
|
6
6
|
* @param {*} emptyValue - The empty value for the field.
|
|
7
7
|
* @returns {*} - The normalized value.
|
|
8
8
|
*/
|
|
9
|
-
normalizeValue(value: any, flags?:
|
|
9
|
+
normalizeValue(value: any, flags?: object, emptyValue?: any): any;
|
|
10
10
|
get addAnother(): string;
|
|
11
11
|
/**
|
|
12
12
|
* @returns {Field} - The created field.
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import Field from '../field/Field';
|
|
2
2
|
import _ from 'lodash';
|
|
3
|
+
import { Utils } from '@formio/core';
|
|
3
4
|
export default class Multivalue extends Field {
|
|
4
5
|
/**
|
|
5
6
|
* Normalize values coming into updateValue.
|
|
6
7
|
* @param {*} value - The value to normalize before setting.
|
|
7
|
-
* @param {
|
|
8
|
+
* @param {object} flags - Flags to use when normalizing the value.
|
|
8
9
|
* @param {*} emptyValue - The empty value for the field.
|
|
9
10
|
* @returns {*} - The normalized value.
|
|
10
11
|
*/
|
|
11
12
|
normalizeValue(value, flags = {}, emptyValue = this.emptyValue) {
|
|
13
|
+
const underlyingValueShouldBeArray = Utils.getModelType(this.component) === 'array' || this.component.storeas === 'array' || Array.isArray(emptyValue);
|
|
12
14
|
if (this.component.multiple) {
|
|
13
15
|
if (Array.isArray(value)) {
|
|
16
|
+
if (underlyingValueShouldBeArray) {
|
|
17
|
+
if (value.length === 0 || !Array.isArray(value[0])) {
|
|
18
|
+
return [value];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
14
21
|
if (value.length === 0) {
|
|
15
22
|
return [emptyValue];
|
|
16
23
|
}
|
|
17
|
-
if (this.component.storeas === 'array') {
|
|
18
|
-
return super.normalizeValue([value], flags);
|
|
19
|
-
}
|
|
20
24
|
return super.normalizeValue(value, flags);
|
|
21
25
|
}
|
|
22
26
|
else {
|
|
@@ -24,7 +28,7 @@ export default class Multivalue extends Field {
|
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
else {
|
|
27
|
-
if (Array.isArray(value) && !
|
|
31
|
+
if (Array.isArray(value) && !underlyingValueShouldBeArray) {
|
|
28
32
|
if (this.component.storeas === 'string') {
|
|
29
33
|
return super.normalizeValue(value.join(this.delimiter || ''), flags);
|
|
30
34
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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;
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
};
|
|
@@ -1,8 +1,4 @@
|
|
|
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';
|
|
6
2
|
import comp2 from './comp2';
|
|
7
3
|
import comp3 from './comp3';
|
|
8
4
|
import comp5 from './comp5';
|
|
@@ -10,4 +6,9 @@ import comp6 from './comp6';
|
|
|
10
6
|
import comp7 from './comp7';
|
|
11
7
|
import comp8 from './comp8';
|
|
12
8
|
import comp9 from './comp9';
|
|
13
|
-
|
|
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 };
|
|
@@ -10,4 +10,5 @@ import comp10 from './comp10';
|
|
|
10
10
|
import comp11 from './comp11';
|
|
11
11
|
import comp12 from './comp12';
|
|
12
12
|
import comp13 from './comp13';
|
|
13
|
-
|
|
13
|
+
import comp14 from './comp14';
|
|
14
|
+
export { comp1, comp2, comp3, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14 };
|
|
@@ -557,7 +557,7 @@ export default class DayComponent extends Field {
|
|
|
557
557
|
}
|
|
558
558
|
isPartialDay(value) {
|
|
559
559
|
if (!value) {
|
|
560
|
-
return
|
|
560
|
+
return true;
|
|
561
561
|
}
|
|
562
562
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
563
563
|
const values = value.split('/');
|
|
@@ -8,11 +8,10 @@ export function findComponents(components: import('@formio/core').Component[], q
|
|
|
8
8
|
export const flattenComponents: typeof Utils.flattenComponents;
|
|
9
9
|
export const guid: typeof Utils.guid;
|
|
10
10
|
export const uniqueName: typeof Utils.uniqueName;
|
|
11
|
-
export const MODEL_TYPES:
|
|
11
|
+
export const MODEL_TYPES: any;
|
|
12
12
|
export const getModelType: typeof Utils.getModelType;
|
|
13
13
|
export const getComponentAbsolutePath: typeof Utils.getComponentAbsolutePath;
|
|
14
14
|
export const getComponentPath: typeof Utils.getComponentPath;
|
|
15
|
-
export const isComponentModelType: typeof Utils.isComponentModelType;
|
|
16
15
|
export const isComponentNestedDataType: typeof Utils.isComponentNestedDataType;
|
|
17
16
|
export const componentPath: typeof Utils.componentPath;
|
|
18
17
|
export const componentChildPath: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Utils } from '@formio/core';
|
|
2
|
-
const { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath,
|
|
2
|
+
const { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentNestedDataType, componentPath, componentChildPath, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty } = Utils;
|
|
3
3
|
/**
|
|
4
4
|
* Deprecated version of findComponents. Renamed to searchComponents.
|
|
5
5
|
* @param {import('@formio/core').Component[]} components - The components to find components within.
|
|
@@ -10,4 +10,4 @@ export function findComponents(components, query) {
|
|
|
10
10
|
console.warn('formio.js/utils findComponents is deprecated. Use searchComponents instead.');
|
|
11
11
|
return searchComponents(components, query);
|
|
12
12
|
}
|
|
13
|
-
export { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath,
|
|
13
|
+
export { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentNestedDataType, componentPath, componentChildPath, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty };
|
|
@@ -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
|
-
|
|
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
|
|
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.
|
|
3
|
+
"version": "5.0.0-dev.5800.896e9df",
|
|
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.
|
|
84
|
+
"@formio/core": "2.1.0-dev.146.e57530c",
|
|
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",
|