@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.
- package/Changelog.md +3 -0
- package/dist/formio.form.js +564 -572
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +0 -10
- package/dist/formio.full.js +565 -573
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +0 -10
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +50 -48
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +4 -4
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +8 -0
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +12 -10
- 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/html/HTML.js +1 -1
- package/lib/cjs/components/radio/Radio.js +1 -1
- package/lib/cjs/components/select/Select.js +2 -5
- package/lib/cjs/components/select/editForm/Select.edit.validation.js +1 -2
- package/lib/cjs/components/select/fixtures/comp27.d.ts +18 -0
- package/lib/cjs/components/select/fixtures/comp27.js +19 -0
- package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/select/fixtures/index.js +3 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/cjs/widgets/CalendarWidget.js +24 -10
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +8 -0
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +12 -10
- 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/html/HTML.js +1 -1
- package/lib/mjs/components/radio/Radio.js +1 -1
- package/lib/mjs/components/select/Select.js +2 -5
- package/lib/mjs/components/select/editForm/Select.edit.validation.js +1 -2
- package/lib/mjs/components/select/fixtures/comp27.d.ts +18 -0
- package/lib/mjs/components/select/fixtures/comp27.js +17 -0
- package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/select/fixtures/index.js +2 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/mjs/widgets/CalendarWidget.js +24 -10
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* dist/inputmask
|
|
3
3
|
* https://github.com/RobinHerbots/Inputmask
|
|
4
|
-
* Copyright (c) 2010 -
|
|
4
|
+
* Copyright (c) 2010 - 2024 Robin Herbots
|
|
5
5
|
* Licensed under the MIT license
|
|
6
|
-
* Version: 5.0.
|
|
6
|
+
* Version: 5.0.9
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/*!
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
* MIT licensed
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
/*! @license DOMPurify 3.1.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.5/LICENSE */
|
|
22
|
-
|
|
23
21
|
/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
|
|
24
22
|
|
|
25
23
|
/*! formiojs v5.0.0-rc.59 | https://unpkg.com/formiojs@5.0.0-rc.59/LICENSE.txt */
|
|
26
24
|
|
|
25
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
26
|
+
|
|
27
27
|
/**
|
|
28
28
|
* @license
|
|
29
29
|
* Lodash <https://lodash.com/>
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export default class Multivalue extends Field {
|
|
2
|
+
/**
|
|
3
|
+
* Normalize values coming into updateValue.
|
|
4
|
+
* @param {*} value - The value to normalize before setting.
|
|
5
|
+
* @param {Object} flags - Flags to use when normalizing the value.
|
|
6
|
+
* @param {*} emptyValue - The empty value for the field.
|
|
7
|
+
* @returns {*} - The normalized value.
|
|
8
|
+
*/
|
|
9
|
+
normalizeValue(value: any, flags?: Object, emptyValue?: any): any;
|
|
2
10
|
get addAnother(): string;
|
|
3
11
|
/**
|
|
4
12
|
* @returns {Field} - The created field.
|
|
@@ -9,37 +9,39 @@ class Multivalue extends Field_1.default {
|
|
|
9
9
|
/**
|
|
10
10
|
* Normalize values coming into updateValue.
|
|
11
11
|
* @param {*} value - The value to normalize before setting.
|
|
12
|
+
* @param {Object} flags - Flags to use when normalizing the value.
|
|
13
|
+
* @param {*} emptyValue - The empty value for the field.
|
|
12
14
|
* @returns {*} - The normalized value.
|
|
13
15
|
*/
|
|
14
|
-
normalizeValue(value) {
|
|
16
|
+
normalizeValue(value, flags = {}, emptyValue = this.emptyValue) {
|
|
15
17
|
if (this.component.multiple) {
|
|
16
18
|
if (Array.isArray(value)) {
|
|
17
19
|
if (value.length === 0) {
|
|
18
|
-
return [
|
|
20
|
+
return [emptyValue];
|
|
19
21
|
}
|
|
20
22
|
if (this.component.storeas === 'array') {
|
|
21
|
-
return super.normalizeValue([value]);
|
|
23
|
+
return super.normalizeValue([value], flags);
|
|
22
24
|
}
|
|
23
|
-
return super.normalizeValue(value);
|
|
25
|
+
return super.normalizeValue(value, flags);
|
|
24
26
|
}
|
|
25
27
|
else {
|
|
26
|
-
return super.normalizeValue(value == null ? [
|
|
28
|
+
return super.normalizeValue(value == null ? [emptyValue] : [value], flags);
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
else {
|
|
30
|
-
if (Array.isArray(value) &&
|
|
32
|
+
if (Array.isArray(value) && !Array.isArray(emptyValue)) {
|
|
31
33
|
if (this.component.storeas === 'string') {
|
|
32
|
-
return super.normalizeValue(value.join(this.delimiter || ''));
|
|
34
|
+
return super.normalizeValue(value.join(this.delimiter || ''), flags);
|
|
33
35
|
}
|
|
34
|
-
return super.normalizeValue(value[0] ||
|
|
36
|
+
return super.normalizeValue(value[0] || emptyValue, flags);
|
|
35
37
|
}
|
|
36
38
|
else {
|
|
37
|
-
return super.normalizeValue(value);
|
|
39
|
+
return super.normalizeValue(value, flags);
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
get dataValue() {
|
|
42
|
-
return super.dataValue;
|
|
44
|
+
return this.normalizeValue(super.dataValue);
|
|
43
45
|
}
|
|
44
46
|
set dataValue(value) {
|
|
45
47
|
super.dataValue = value;
|
|
@@ -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;
|
|
@@ -212,7 +212,7 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
212
212
|
if (!(0, utils_1.boolValue)(setting) || !value) {
|
|
213
213
|
return true;
|
|
214
214
|
}
|
|
215
|
-
const values = this.component.
|
|
215
|
+
const values = this.component.values;
|
|
216
216
|
if (values) {
|
|
217
217
|
return values.findIndex(({ value: optionValue }) => this.normalizeValue(optionValue) === value) !== -1;
|
|
218
218
|
}
|
|
@@ -1429,9 +1429,6 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1429
1429
|
case 'custom':
|
|
1430
1430
|
rawItems = this.getCustomItems();
|
|
1431
1431
|
break;
|
|
1432
|
-
case 'url':
|
|
1433
|
-
rawItems = this.selectItems;
|
|
1434
|
-
break;
|
|
1435
1432
|
}
|
|
1436
1433
|
if (typeof rawItems === 'string') {
|
|
1437
1434
|
try {
|
|
@@ -1490,7 +1487,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1490
1487
|
if (Array.isArray(data)) {
|
|
1491
1488
|
data.forEach((item) => item[valueProperty] = item[valueProperty].toString());
|
|
1492
1489
|
}
|
|
1493
|
-
else {
|
|
1490
|
+
else if (lodash_1.default.isObject(data)) {
|
|
1494
1491
|
data[valueProperty] = data[valueProperty].toString();
|
|
1495
1492
|
}
|
|
1496
1493
|
return data;
|
|
@@ -1525,7 +1522,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1525
1522
|
};
|
|
1526
1523
|
value = (this.component.multiple && Array.isArray(value))
|
|
1527
1524
|
? lodash_1.default.filter(items, (item) => value.includes(item.value))
|
|
1528
|
-
: valueProperty
|
|
1525
|
+
: (valueProperty && items)
|
|
1529
1526
|
? (_a = getFromValues()) !== null && _a !== void 0 ? _a : { value, label: value }
|
|
1530
1527
|
: value;
|
|
1531
1528
|
}
|
|
@@ -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,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
type: 'select',
|
|
5
|
+
label: 'Select',
|
|
6
|
+
widget: 'choicesjs',
|
|
7
|
+
tableView: true,
|
|
8
|
+
dataSrc: 'custom',
|
|
9
|
+
data: {
|
|
10
|
+
custom: 'values = data.dataSource;'
|
|
11
|
+
},
|
|
12
|
+
dataType: 'string',
|
|
13
|
+
idPath: 'name',
|
|
14
|
+
valueProperty: 'name',
|
|
15
|
+
template: '<span>{{ item.name }}</span>',
|
|
16
|
+
validateWhenHidden: false,
|
|
17
|
+
key: 'select',
|
|
18
|
+
input: true
|
|
19
|
+
};
|
|
@@ -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
|
-
|
|
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";
|
|
@@ -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.comp26 = exports.comp25 = exports.comp24 = exports.comp23 = exports.comp22 = exports.comp21 = exports.comp20 = 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;
|
|
6
|
+
exports.comp27 = exports.comp26 = exports.comp25 = exports.comp24 = exports.comp23 = exports.comp22 = exports.comp21 = exports.comp20 = 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"));
|
|
@@ -57,3 +57,5 @@ const comp25_1 = __importDefault(require("./comp25"));
|
|
|
57
57
|
exports.comp25 = comp25_1.default;
|
|
58
58
|
const comp26_1 = __importDefault(require("./comp26"));
|
|
59
59
|
exports.comp26 = comp26_1.default;
|
|
60
|
+
const comp27_1 = __importDefault(require("./comp27"));
|
|
61
|
+
exports.comp27 = comp27_1.default;
|
|
@@ -254,7 +254,7 @@ class SelectBoxesComponent extends Radio_1.default {
|
|
|
254
254
|
if (!(0, utils_1.boolValue)(setting) || !value) {
|
|
255
255
|
return true;
|
|
256
256
|
}
|
|
257
|
-
const values = this.component.
|
|
257
|
+
const values = this.component.values;
|
|
258
258
|
const availableValueKeys = (values || []).map(({ value: optionValue }) => optionValue);
|
|
259
259
|
const valueKeys = Object.keys(value);
|
|
260
260
|
return valueKeys.every((key) => availableValueKeys.includes(key));
|
|
@@ -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)) {
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export default class Multivalue extends Field {
|
|
2
|
+
/**
|
|
3
|
+
* Normalize values coming into updateValue.
|
|
4
|
+
* @param {*} value - The value to normalize before setting.
|
|
5
|
+
* @param {Object} flags - Flags to use when normalizing the value.
|
|
6
|
+
* @param {*} emptyValue - The empty value for the field.
|
|
7
|
+
* @returns {*} - The normalized value.
|
|
8
|
+
*/
|
|
9
|
+
normalizeValue(value: any, flags?: Object, emptyValue?: any): any;
|
|
2
10
|
get addAnother(): string;
|
|
3
11
|
/**
|
|
4
12
|
* @returns {Field} - The created field.
|
|
@@ -4,37 +4,39 @@ export default class Multivalue extends Field {
|
|
|
4
4
|
/**
|
|
5
5
|
* Normalize values coming into updateValue.
|
|
6
6
|
* @param {*} value - The value to normalize before setting.
|
|
7
|
+
* @param {Object} flags - Flags to use when normalizing the value.
|
|
8
|
+
* @param {*} emptyValue - The empty value for the field.
|
|
7
9
|
* @returns {*} - The normalized value.
|
|
8
10
|
*/
|
|
9
|
-
normalizeValue(value) {
|
|
11
|
+
normalizeValue(value, flags = {}, emptyValue = this.emptyValue) {
|
|
10
12
|
if (this.component.multiple) {
|
|
11
13
|
if (Array.isArray(value)) {
|
|
12
14
|
if (value.length === 0) {
|
|
13
|
-
return [
|
|
15
|
+
return [emptyValue];
|
|
14
16
|
}
|
|
15
17
|
if (this.component.storeas === 'array') {
|
|
16
|
-
return super.normalizeValue([value]);
|
|
18
|
+
return super.normalizeValue([value], flags);
|
|
17
19
|
}
|
|
18
|
-
return super.normalizeValue(value);
|
|
20
|
+
return super.normalizeValue(value, flags);
|
|
19
21
|
}
|
|
20
22
|
else {
|
|
21
|
-
return super.normalizeValue(value == null ? [
|
|
23
|
+
return super.normalizeValue(value == null ? [emptyValue] : [value], flags);
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
else {
|
|
25
|
-
if (Array.isArray(value) &&
|
|
27
|
+
if (Array.isArray(value) && !Array.isArray(emptyValue)) {
|
|
26
28
|
if (this.component.storeas === 'string') {
|
|
27
|
-
return super.normalizeValue(value.join(this.delimiter || ''));
|
|
29
|
+
return super.normalizeValue(value.join(this.delimiter || ''), flags);
|
|
28
30
|
}
|
|
29
|
-
return super.normalizeValue(value[0] ||
|
|
31
|
+
return super.normalizeValue(value[0] || emptyValue, flags);
|
|
30
32
|
}
|
|
31
33
|
else {
|
|
32
|
-
return super.normalizeValue(value);
|
|
34
|
+
return super.normalizeValue(value, flags);
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
get dataValue() {
|
|
37
|
-
return super.dataValue;
|
|
39
|
+
return this.normalizeValue(super.dataValue);
|
|
38
40
|
}
|
|
39
41
|
set dataValue(value) {
|
|
40
42
|
super.dataValue = value;
|
|
@@ -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 };
|
|
@@ -212,7 +212,7 @@ export default class RadioComponent extends ListComponent {
|
|
|
212
212
|
if (!boolValue(setting) || !value) {
|
|
213
213
|
return true;
|
|
214
214
|
}
|
|
215
|
-
const values = this.component.
|
|
215
|
+
const values = this.component.values;
|
|
216
216
|
if (values) {
|
|
217
217
|
return values.findIndex(({ value: optionValue }) => this.normalizeValue(optionValue) === value) !== -1;
|
|
218
218
|
}
|
|
@@ -1457,9 +1457,6 @@ export default class SelectComponent extends ListComponent {
|
|
|
1457
1457
|
case 'custom':
|
|
1458
1458
|
rawItems = this.getCustomItems();
|
|
1459
1459
|
break;
|
|
1460
|
-
case 'url':
|
|
1461
|
-
rawItems = this.selectItems;
|
|
1462
|
-
break;
|
|
1463
1460
|
}
|
|
1464
1461
|
if (typeof rawItems === 'string') {
|
|
1465
1462
|
try {
|
|
@@ -1517,7 +1514,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
1517
1514
|
if (Array.isArray(data)) {
|
|
1518
1515
|
data.forEach((item) => item[valueProperty] = item[valueProperty].toString());
|
|
1519
1516
|
}
|
|
1520
|
-
else {
|
|
1517
|
+
else if (_.isObject(data)) {
|
|
1521
1518
|
data[valueProperty] = data[valueProperty].toString();
|
|
1522
1519
|
}
|
|
1523
1520
|
return data;
|
|
@@ -1552,7 +1549,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
1552
1549
|
};
|
|
1553
1550
|
value = (this.component.multiple && Array.isArray(value))
|
|
1554
1551
|
? _.filter(items, (item) => value.includes(item.value))
|
|
1555
|
-
: valueProperty
|
|
1552
|
+
: (valueProperty && items)
|
|
1556
1553
|
? getFromValues() ?? { value, label: value }
|
|
1557
1554
|
: value;
|
|
1558
1555
|
}
|