@formio/js 5.0.0-dev.5798.beb3cc0 → 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 +3 -3
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +3 -3
- package/dist/formio.full.min.js +1 -1
- 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/select/Select.js +2 -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/widgets/CalendarWidget.js +24 -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/select/Select.js +2 -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/widgets/CalendarWidget.js +24 -10
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -1487,7 +1487,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1487
1487
|
if (Array.isArray(data)) {
|
|
1488
1488
|
data.forEach((item) => item[valueProperty] = item[valueProperty].toString());
|
|
1489
1489
|
}
|
|
1490
|
-
else {
|
|
1490
|
+
else if (lodash_1.default.isObject(data)) {
|
|
1491
1491
|
data[valueProperty] = data[valueProperty].toString();
|
|
1492
1492
|
}
|
|
1493
1493
|
return data;
|
|
@@ -1522,7 +1522,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1522
1522
|
};
|
|
1523
1523
|
value = (this.component.multiple && Array.isArray(value))
|
|
1524
1524
|
? lodash_1.default.filter(items, (item) => value.includes(item.value))
|
|
1525
|
-
: valueProperty
|
|
1525
|
+
: (valueProperty && items)
|
|
1526
1526
|
? (_a = getFromValues()) !== null && _a !== void 0 ? _a : { value, label: value }
|
|
1527
1527
|
: value;
|
|
1528
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;
|
|
@@ -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)) {
|
|
@@ -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 };
|
|
@@ -1514,7 +1514,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
1514
1514
|
if (Array.isArray(data)) {
|
|
1515
1515
|
data.forEach((item) => item[valueProperty] = item[valueProperty].toString());
|
|
1516
1516
|
}
|
|
1517
|
-
else {
|
|
1517
|
+
else if (_.isObject(data)) {
|
|
1518
1518
|
data[valueProperty] = data[valueProperty].toString();
|
|
1519
1519
|
}
|
|
1520
1520
|
return data;
|
|
@@ -1549,7 +1549,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
1549
1549
|
};
|
|
1550
1550
|
value = (this.component.multiple && Array.isArray(value))
|
|
1551
1551
|
? _.filter(items, (item) => value.includes(item.value))
|
|
1552
|
-
: valueProperty
|
|
1552
|
+
: (valueProperty && items)
|
|
1553
1553
|
? getFromValues() ?? { value, label: value }
|
|
1554
1554
|
: value;
|
|
1555
1555
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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 };
|
|
@@ -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)) {
|