@formio/js 5.0.0-dev.5796.ee2613b → 5.0.0-dev.5797.3f96a70
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 +565 -573
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +0 -10
- package/dist/formio.full.js +572 -580
- 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/day/Day.d.ts +5 -0
- package/lib/cjs/components/day/Day.js +51 -11
- package/lib/cjs/components/day/editForm/Day.edit.day.d.ts +17 -0
- package/lib/cjs/components/day/editForm/Day.edit.day.js +19 -0
- package/lib/cjs/components/day/editForm/Day.edit.month.d.ts +5 -0
- package/lib/cjs/components/day/editForm/Day.edit.month.js +19 -0
- package/lib/cjs/components/day/editForm/Day.edit.year.d.ts +5 -0
- package/lib/cjs/components/day/editForm/Day.edit.year.js +13 -0
- 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 +0 -3
- package/lib/cjs/components/select/editForm/Select.edit.validation.js +1 -2
- 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/day/Day.d.ts +5 -0
- package/lib/mjs/components/day/Day.js +51 -11
- package/lib/mjs/components/day/editForm/Day.edit.day.d.ts +17 -0
- package/lib/mjs/components/day/editForm/Day.edit.day.js +16 -0
- package/lib/mjs/components/day/editForm/Day.edit.month.d.ts +5 -0
- package/lib/mjs/components/day/editForm/Day.edit.month.js +16 -0
- package/lib/mjs/components/day/editForm/Day.edit.year.d.ts +5 -0
- package/lib/mjs/components/day/editForm/Day.edit.year.js +10 -0
- 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 +0 -3
- package/lib/mjs/components/select/editForm/Select.edit.validation.js +1 -2
- 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;
|
|
@@ -97,6 +97,11 @@ export default class DayComponent extends Field {
|
|
|
97
97
|
* @returns {null|void} - Returns null if the value is invalid, otherwise void.
|
|
98
98
|
*/
|
|
99
99
|
setValueAt(index: number, value: any): null | void;
|
|
100
|
+
getDayWithHiddenFields(parts: any): {
|
|
101
|
+
month: any;
|
|
102
|
+
day: any;
|
|
103
|
+
year: any;
|
|
104
|
+
};
|
|
100
105
|
getFieldValue(name: any): number;
|
|
101
106
|
get parts(): {
|
|
102
107
|
day: number;
|
|
@@ -344,6 +344,18 @@ class DayComponent extends Field_1.default {
|
|
|
344
344
|
const valueParts = value.split('/');
|
|
345
345
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
346
346
|
const defaultValue = this.component.defaultValue ? this.component.defaultValue.split('/') : '';
|
|
347
|
+
let defaultDay = '';
|
|
348
|
+
let defaultMonth = '';
|
|
349
|
+
let defaultYear = '';
|
|
350
|
+
if (defaultValue) {
|
|
351
|
+
const hasHiddenFields = defaultValue.length !== 3;
|
|
352
|
+
defaultDay = hasHiddenFields ? this.getDayWithHiddenFields(defaultValue).day : defaultValue[DAY];
|
|
353
|
+
defaultMonth = hasHiddenFields ? this.getDayWithHiddenFields(defaultValue).month : defaultValue[MONTH];
|
|
354
|
+
defaultYear = hasHiddenFields ? this.getDayWithHiddenFields(defaultValue).year : defaultValue[YEAR];
|
|
355
|
+
}
|
|
356
|
+
if (this.options.building && defaultValue.length === 3) {
|
|
357
|
+
return this.component.defaultValue;
|
|
358
|
+
}
|
|
347
359
|
const getNextPart = (shouldTake, defaultValue) => {
|
|
348
360
|
// Only push the part if it's not an empty string
|
|
349
361
|
const part = shouldTake ? valueParts.shift() : defaultValue;
|
|
@@ -352,13 +364,13 @@ class DayComponent extends Field_1.default {
|
|
|
352
364
|
}
|
|
353
365
|
};
|
|
354
366
|
if (this.dayFirst) {
|
|
355
|
-
getNextPart(this.showDay,
|
|
367
|
+
getNextPart(this.showDay, defaultDay);
|
|
356
368
|
}
|
|
357
|
-
getNextPart(this.showMonth,
|
|
369
|
+
getNextPart(this.showMonth, defaultMonth);
|
|
358
370
|
if (!this.dayFirst) {
|
|
359
|
-
getNextPart(this.showDay,
|
|
371
|
+
getNextPart(this.showDay, defaultDay);
|
|
360
372
|
}
|
|
361
|
-
getNextPart(this.showYear,
|
|
373
|
+
getNextPart(this.showYear, defaultYear);
|
|
362
374
|
return dateParts.join('/');
|
|
363
375
|
}
|
|
364
376
|
/**
|
|
@@ -373,16 +385,23 @@ class DayComponent extends Field_1.default {
|
|
|
373
385
|
if (value === 'Invalid date') {
|
|
374
386
|
return null;
|
|
375
387
|
}
|
|
388
|
+
let day, month, year;
|
|
376
389
|
const parts = value.split('/');
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
390
|
+
if (parts.length !== 3) {
|
|
391
|
+
day = this.getDayWithHiddenFields(parts).day;
|
|
392
|
+
month = this.getDayWithHiddenFields(parts).month;
|
|
393
|
+
year = this.getDayWithHiddenFields(parts).year;
|
|
380
394
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
395
|
+
else {
|
|
396
|
+
if (this.component.dayFirst) {
|
|
397
|
+
day = parts.shift();
|
|
398
|
+
}
|
|
399
|
+
month = parts.shift();
|
|
400
|
+
if (!this.component.dayFirst) {
|
|
401
|
+
day = parts.shift();
|
|
402
|
+
}
|
|
403
|
+
year = parts.shift();
|
|
384
404
|
}
|
|
385
|
-
const year = parts.shift();
|
|
386
405
|
if (this.refs.day && this.showDay) {
|
|
387
406
|
this.refs.day.value = day === '00' ? '' : parseInt(day, 10);
|
|
388
407
|
}
|
|
@@ -393,6 +412,27 @@ class DayComponent extends Field_1.default {
|
|
|
393
412
|
this.refs.year.value = year === '0000' ? '' : parseInt(year, 10);
|
|
394
413
|
}
|
|
395
414
|
}
|
|
415
|
+
getDayWithHiddenFields(parts) {
|
|
416
|
+
let [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
417
|
+
if (!this.showDay) {
|
|
418
|
+
MONTH = MONTH === 0 ? 0 : MONTH - 1;
|
|
419
|
+
YEAR = YEAR - 1;
|
|
420
|
+
DAY = null;
|
|
421
|
+
}
|
|
422
|
+
if (!this.showMonth) {
|
|
423
|
+
DAY = DAY === 0 ? 0 : DAY - 1;
|
|
424
|
+
YEAR = YEAR - 1;
|
|
425
|
+
MONTH = null;
|
|
426
|
+
}
|
|
427
|
+
if (!this.showYear) {
|
|
428
|
+
YEAR = null;
|
|
429
|
+
}
|
|
430
|
+
return {
|
|
431
|
+
month: lodash_1.default.isNull(MONTH) ? '' : parts[MONTH],
|
|
432
|
+
day: lodash_1.default.isNull(DAY) ? '' : parts[DAY],
|
|
433
|
+
year: lodash_1.default.isNull(YEAR) ? '' : parts[YEAR],
|
|
434
|
+
};
|
|
435
|
+
}
|
|
396
436
|
getFieldValue(name) {
|
|
397
437
|
const parts = this.dataValue ? this.dataValue.split('/') : [];
|
|
398
438
|
let val = 0;
|
|
@@ -14,6 +14,7 @@ declare const _default: ({
|
|
|
14
14
|
input?: undefined;
|
|
15
15
|
placeholder?: undefined;
|
|
16
16
|
tooltip?: undefined;
|
|
17
|
+
onChange?: undefined;
|
|
17
18
|
} | {
|
|
18
19
|
weight: number;
|
|
19
20
|
type: string;
|
|
@@ -25,16 +26,32 @@ declare const _default: ({
|
|
|
25
26
|
wieght?: undefined;
|
|
26
27
|
datasrc?: undefined;
|
|
27
28
|
data?: undefined;
|
|
29
|
+
onChange?: undefined;
|
|
28
30
|
} | {
|
|
29
31
|
weight: number;
|
|
30
32
|
type: string;
|
|
31
33
|
label: string;
|
|
32
34
|
tooltip: string;
|
|
33
35
|
key: string;
|
|
36
|
+
onChange: ({ data }: {
|
|
37
|
+
data: any;
|
|
38
|
+
}) => void;
|
|
34
39
|
input: boolean;
|
|
35
40
|
wieght?: undefined;
|
|
36
41
|
datasrc?: undefined;
|
|
37
42
|
data?: undefined;
|
|
38
43
|
placeholder?: undefined;
|
|
44
|
+
} | {
|
|
45
|
+
weight: number;
|
|
46
|
+
type: string;
|
|
47
|
+
label: string;
|
|
48
|
+
tooltip: string;
|
|
49
|
+
key: string;
|
|
50
|
+
input: boolean;
|
|
51
|
+
wieght?: undefined;
|
|
52
|
+
datasrc?: undefined;
|
|
53
|
+
data?: undefined;
|
|
54
|
+
placeholder?: undefined;
|
|
55
|
+
onChange?: undefined;
|
|
39
56
|
})[];
|
|
40
57
|
export default _default;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
3
7
|
exports.default = [
|
|
4
8
|
{
|
|
5
9
|
wieght: 200,
|
|
@@ -35,6 +39,21 @@ exports.default = [
|
|
|
35
39
|
label: 'Hidden',
|
|
36
40
|
tooltip: 'Hide the Day part of the component.',
|
|
37
41
|
key: 'fields.day.hide',
|
|
42
|
+
onChange: ({ data }) => {
|
|
43
|
+
if (data.defaultValue) {
|
|
44
|
+
const defaultValueParts = data.defaultValue.split('/');
|
|
45
|
+
if (!data.fields.day.hide && defaultValueParts.length !== 3) {
|
|
46
|
+
const newDefaultValue = ['00'];
|
|
47
|
+
if (!data.fields.month.hide) {
|
|
48
|
+
data.dayFirst ? newDefaultValue.push(defaultValueParts[0]) : newDefaultValue.unshift(defaultValueParts[0]);
|
|
49
|
+
}
|
|
50
|
+
if (!data.fields.year.hide) {
|
|
51
|
+
newDefaultValue.push(defaultValueParts[1]);
|
|
52
|
+
}
|
|
53
|
+
lodash_1.default.set(data, 'defaultValue', newDefaultValue.join('/'));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
38
57
|
input: true
|
|
39
58
|
},
|
|
40
59
|
{
|
|
@@ -14,6 +14,7 @@ declare const _default: ({
|
|
|
14
14
|
input?: undefined;
|
|
15
15
|
placeholder?: undefined;
|
|
16
16
|
tooltip?: undefined;
|
|
17
|
+
onChange?: undefined;
|
|
17
18
|
} | {
|
|
18
19
|
weight: number;
|
|
19
20
|
type: string;
|
|
@@ -25,12 +26,16 @@ declare const _default: ({
|
|
|
25
26
|
wieght?: undefined;
|
|
26
27
|
datasrc?: undefined;
|
|
27
28
|
data?: undefined;
|
|
29
|
+
onChange?: undefined;
|
|
28
30
|
} | {
|
|
29
31
|
weight: number;
|
|
30
32
|
type: string;
|
|
31
33
|
label: string;
|
|
32
34
|
tooltip: string;
|
|
33
35
|
key: string;
|
|
36
|
+
onChange: ({ data }: {
|
|
37
|
+
data: any;
|
|
38
|
+
}) => void;
|
|
34
39
|
input: boolean;
|
|
35
40
|
wieght?: undefined;
|
|
36
41
|
datasrc?: undefined;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
3
7
|
exports.default = [
|
|
4
8
|
{
|
|
5
9
|
wieght: 200,
|
|
@@ -35,6 +39,21 @@ exports.default = [
|
|
|
35
39
|
label: 'Hidden',
|
|
36
40
|
tooltip: 'Hide the Month part of the component.',
|
|
37
41
|
key: 'fields.month.hide',
|
|
42
|
+
onChange: ({ data }) => {
|
|
43
|
+
if (data.defaultValue) {
|
|
44
|
+
const defaultValueParts = data.defaultValue.split('/');
|
|
45
|
+
if (!data.fields.month.hide && defaultValueParts.length !== 3) {
|
|
46
|
+
const newDefaultValue = ['00'];
|
|
47
|
+
if (!data.fields.day.hide) {
|
|
48
|
+
data.dayFirst ? newDefaultValue.unshift(defaultValueParts[0]) : newDefaultValue.push(defaultValueParts[0]);
|
|
49
|
+
}
|
|
50
|
+
if (!data.fields.year.hide) {
|
|
51
|
+
newDefaultValue.push(defaultValueParts[1]);
|
|
52
|
+
}
|
|
53
|
+
lodash_1.default.set(data, 'defaultValue', newDefaultValue.join('/'));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
38
57
|
input: true
|
|
39
58
|
},
|
|
40
59
|
];
|
|
@@ -14,6 +14,7 @@ declare const _default: ({
|
|
|
14
14
|
input?: undefined;
|
|
15
15
|
placeholder?: undefined;
|
|
16
16
|
tooltip?: undefined;
|
|
17
|
+
onChange?: undefined;
|
|
17
18
|
} | {
|
|
18
19
|
weight: number;
|
|
19
20
|
type: string;
|
|
@@ -25,12 +26,16 @@ declare const _default: ({
|
|
|
25
26
|
wieght?: undefined;
|
|
26
27
|
datasrc?: undefined;
|
|
27
28
|
data?: undefined;
|
|
29
|
+
onChange?: undefined;
|
|
28
30
|
} | {
|
|
29
31
|
weight: number;
|
|
30
32
|
type: string;
|
|
31
33
|
label: string;
|
|
32
34
|
tooltip: string;
|
|
33
35
|
key: string;
|
|
36
|
+
onChange: ({ data }: {
|
|
37
|
+
data: any;
|
|
38
|
+
}) => void;
|
|
34
39
|
input: boolean;
|
|
35
40
|
wieght?: undefined;
|
|
36
41
|
datasrc?: undefined;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
3
7
|
exports.default = [
|
|
4
8
|
{
|
|
5
9
|
wieght: 200,
|
|
@@ -53,6 +57,15 @@ exports.default = [
|
|
|
53
57
|
label: 'Hidden',
|
|
54
58
|
tooltip: 'Hide the Year part of the component.',
|
|
55
59
|
key: 'fields.year.hide',
|
|
60
|
+
onChange: ({ data }) => {
|
|
61
|
+
if (data.defaultValue) {
|
|
62
|
+
const defaultValueParts = data.defaultValue.split('/');
|
|
63
|
+
if (!data.fields.month.hide && defaultValueParts.length !== 3) {
|
|
64
|
+
defaultValueParts.push('0000');
|
|
65
|
+
lodash_1.default.set(data, 'defaultValue', defaultValueParts.join('/'));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
56
69
|
input: true
|
|
57
70
|
},
|
|
58
71
|
];
|
|
@@ -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 {
|
|
@@ -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.
|