@syncfusion/ej2-calendars 20.4.54 → 21.1.35
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 +0 -16
- package/README.md +94 -83
- package/dist/ej2-calendars.min.js +2 -2
- package/dist/ej2-calendars.umd.min.js +2 -2
- package/dist/ej2-calendars.umd.min.js.map +1 -1
- package/dist/es6/ej2-calendars.es2015.js +431 -372
- package/dist/es6/ej2-calendars.es2015.js.map +1 -1
- package/dist/es6/ej2-calendars.es5.js +386 -327
- package/dist/es6/ej2-calendars.es5.js.map +1 -1
- package/dist/global/ej2-calendars.min.js +2 -2
- package/dist/global/ej2-calendars.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +11 -11
- package/src/calendar/calendar-model.d.ts +1 -1
- package/src/calendar/calendar.js +13 -6
- package/src/calendar/islamic.js +39 -29
- package/src/datepicker/datepicker-model.d.ts +3 -3
- package/src/datepicker/datepicker.js +61 -56
- package/src/daterangepicker/daterangepicker.js +11 -5
- package/src/datetimepicker/datetimepicker-model.d.ts +3 -3
- package/src/datetimepicker/datetimepicker.d.ts +4 -4
- package/src/datetimepicker/datetimepicker.js +15 -17
- package/src/maskbase/masked-date-time.js +208 -179
- package/src/timepicker/timepicker-model.d.ts +7 -7
- package/src/timepicker/timepicker.d.ts +9 -9
- package/src/timepicker/timepicker.js +39 -36
- package/styles/bootstrap-dark.css +9 -8
- package/styles/bootstrap.css +9 -3
- package/styles/bootstrap4.css +6 -4
- package/styles/bootstrap5-dark.css +19 -17
- package/styles/bootstrap5.css +17 -15
- package/styles/calendar/_bootstrap-dark-definition.scss +1 -1
- package/styles/calendar/_bootstrap5-definition.scss +21 -21
- package/styles/calendar/_fabric-dark-definition.scss +5 -3
- package/styles/calendar/_fabric-definition.scss +2 -0
- package/styles/calendar/_fluent-definition.scss +36 -36
- package/styles/calendar/_highcontrast-definition.scss +3 -1
- package/styles/calendar/_highcontrast-light-definition.scss +2 -0
- package/styles/calendar/_layout.scss +53 -6
- package/styles/calendar/_material-dark-definition.scss +4 -2
- package/styles/calendar/_material-definition.scss +2 -0
- package/styles/calendar/_tailwind-definition.scss +13 -13
- package/styles/calendar/_theme.scss +74 -13
- package/styles/calendar/bootstrap-dark.css +4 -3
- package/styles/calendar/bootstrap.css +3 -2
- package/styles/calendar/bootstrap4.css +3 -2
- package/styles/calendar/bootstrap5-dark.css +14 -13
- package/styles/calendar/bootstrap5.css +13 -12
- package/styles/calendar/fabric-dark.css +15 -5
- package/styles/calendar/fabric.css +12 -2
- package/styles/calendar/fluent-dark.css +51 -28
- package/styles/calendar/fluent.css +51 -28
- package/styles/calendar/highcontrast-light.css +3 -2
- package/styles/calendar/highcontrast.css +14 -4
- package/styles/calendar/icons/_material3.scss +3 -3
- package/styles/calendar/material-dark.css +14 -4
- package/styles/calendar/material.css +12 -2
- package/styles/calendar/tailwind-dark.css +11 -10
- package/styles/calendar/tailwind.css +11 -10
- package/styles/datepicker/_bootstrap5-definition.scss +8 -8
- package/styles/datepicker/_fluent-definition.scss +8 -8
- package/styles/datepicker/_layout.scss +16 -6
- package/styles/datepicker/_tailwind-definition.scss +8 -8
- package/styles/datepicker/_theme.scss +11 -1
- package/styles/datepicker/icons/_material3.scss +3 -3
- package/styles/daterangepicker/_bootstrap-dark-definition.scss +5 -5
- package/styles/daterangepicker/_bootstrap-definition.scss +1 -1
- package/styles/daterangepicker/_bootstrap4-definition.scss +2 -2
- package/styles/daterangepicker/_bootstrap5-definition.scss +21 -21
- package/styles/daterangepicker/_fabric-dark-definition.scss +1 -1
- package/styles/daterangepicker/_fabric-definition.scss +1 -1
- package/styles/daterangepicker/_fluent-definition.scss +27 -27
- package/styles/daterangepicker/_highcontrast-definition.scss +1 -1
- package/styles/daterangepicker/_highcontrast-light-definition.scss +1 -1
- package/styles/daterangepicker/_layout.scss +50 -3
- package/styles/daterangepicker/_material-dark-definition.scss +1 -1
- package/styles/daterangepicker/_material-definition.scss +1 -1
- package/styles/daterangepicker/_tailwind-definition.scss +19 -19
- package/styles/daterangepicker/_theme.scss +93 -15
- package/styles/daterangepicker/bootstrap-dark.css +5 -5
- package/styles/daterangepicker/bootstrap.css +6 -1
- package/styles/daterangepicker/bootstrap4.css +3 -2
- package/styles/daterangepicker/bootstrap5-dark.css +5 -4
- package/styles/daterangepicker/bootstrap5.css +4 -3
- package/styles/daterangepicker/fabric-dark.css +1 -1
- package/styles/daterangepicker/fabric.css +1 -1
- package/styles/daterangepicker/fluent-dark.css +33 -9
- package/styles/daterangepicker/fluent.css +33 -9
- package/styles/daterangepicker/highcontrast-light.css +1 -1
- package/styles/daterangepicker/highcontrast.css +1 -1
- package/styles/daterangepicker/icons/_material3.scss +33 -6
- package/styles/daterangepicker/material-dark.css +1 -1
- package/styles/daterangepicker/material.css +8 -2
- package/styles/daterangepicker/tailwind-dark.css +2 -2
- package/styles/daterangepicker/tailwind.css +2 -2
- package/styles/datetimepicker/_bootstrap5-definition.scss +1 -1
- package/styles/datetimepicker/_fluent-definition.scss +1 -1
- package/styles/datetimepicker/_layout.scss +8 -3
- package/styles/datetimepicker/_tailwind-definition.scss +1 -1
- package/styles/datetimepicker/_theme.scss +24 -4
- package/styles/datetimepicker/icons/_material3.scss +1 -1
- package/styles/fabric-dark.css +16 -6
- package/styles/fabric.css +16 -4
- package/styles/fluent-dark.css +84 -37
- package/styles/fluent.css +84 -37
- package/styles/highcontrast-light.css +4 -3
- package/styles/highcontrast.css +15 -5
- package/styles/material-dark.css +15 -5
- package/styles/material.css +20 -4
- package/styles/tailwind-dark.css +13 -12
- package/styles/tailwind.css +13 -12
- package/styles/timepicker/_bootstrap-dark-definition.scss +1 -0
- package/styles/timepicker/_bootstrap-definition.scss +1 -0
- package/styles/timepicker/_bootstrap4-definition.scss +1 -0
- package/styles/timepicker/_bootstrap5-definition.scss +6 -5
- package/styles/timepicker/_fabric-dark-definition.scss +1 -0
- package/styles/timepicker/_fabric-definition.scss +1 -0
- package/styles/timepicker/_fluent-definition.scss +6 -5
- package/styles/timepicker/_fusionnew-definition.scss +1 -0
- package/styles/timepicker/_highcontrast-definition.scss +1 -0
- package/styles/timepicker/_highcontrast-light-definition.scss +1 -0
- package/styles/timepicker/_layout.scss +11 -3
- package/styles/timepicker/_material-dark-definition.scss +1 -0
- package/styles/timepicker/_material-definition.scss +1 -0
- package/styles/timepicker/_tailwind-definition.scss +6 -5
- package/styles/timepicker/_theme.scss +36 -6
- package/styles/timepicker/icons/_material3.scss +1 -1
- package/styles/calendar/_material3-definition.scss +0 -250
- package/styles/datepicker/_material3-definition.scss +0 -46
- package/styles/daterangepicker/_material3-definition.scss +0 -230
- package/styles/datetimepicker/_material3-definition.scss +0 -60
- package/styles/timepicker/_material3-definition.scss +0 -57
|
@@ -10,6 +10,7 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
10
10
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11
11
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12
12
|
};
|
|
13
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
13
14
|
//class constant defination.
|
|
14
15
|
const OTHERMONTH = 'e-other-month';
|
|
15
16
|
const OTHERDECADE = 'e-other-year';
|
|
@@ -121,7 +122,7 @@ let CalendarBase = class CalendarBase extends Component {
|
|
|
121
122
|
'data-role': 'calendar'
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
|
-
if (!isNullOrUndefined(closest(this.element,
|
|
125
|
+
if (!isNullOrUndefined(closest(this.element, 'fieldset')) && closest(this.element, 'fieldset').disabled) {
|
|
125
126
|
this.enabled = false;
|
|
126
127
|
}
|
|
127
128
|
this.createHeader();
|
|
@@ -426,7 +427,8 @@ let CalendarBase = class CalendarBase extends Component {
|
|
|
426
427
|
this.footer && detach(this.footer);
|
|
427
428
|
this.todayElement = null;
|
|
428
429
|
this.renderDayCellArgs = null;
|
|
429
|
-
this.calendarElement = this.tableBodyElement = this.footer = this.tableHeadElement =
|
|
430
|
+
this.calendarElement = this.tableBodyElement = this.footer = this.tableHeadElement =
|
|
431
|
+
this.nextIcon = this.previousIcon = this.table = null;
|
|
430
432
|
}
|
|
431
433
|
keyActionHandle(e, value, multiSelection) {
|
|
432
434
|
const focusedDate = this.tableBodyElement.querySelector('tr td.e-focused-date');
|
|
@@ -746,8 +748,9 @@ let CalendarBase = class CalendarBase extends Component {
|
|
|
746
748
|
// if (args.isDisabled && +this.value === +args.date) {
|
|
747
749
|
// this.setProperties({ value: null }, true);
|
|
748
750
|
// }
|
|
751
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
749
752
|
let currentTarget;
|
|
750
|
-
if (!isNullOrUndefined(e) && e.type
|
|
753
|
+
if (!isNullOrUndefined(e) && e.type === 'click') {
|
|
751
754
|
currentTarget = e.currentTarget;
|
|
752
755
|
}
|
|
753
756
|
if (multiSelection && !isNullOrUndefined(values) && !disabledCls) {
|
|
@@ -760,7 +763,8 @@ let CalendarBase = class CalendarBase extends Component {
|
|
|
760
763
|
|| (this.getDateVal(localDate, value))) {
|
|
761
764
|
addClass([tdEle], SELECTED);
|
|
762
765
|
}
|
|
763
|
-
if (!isNullOrUndefined(currentTarget) && currentTarget.innerText === tdEle.innerText &&
|
|
766
|
+
if (!isNullOrUndefined(currentTarget) && currentTarget.innerText === tdEle.innerText &&
|
|
767
|
+
this.previousDates && tdEle.classList.contains(SELECTED) && currentTarget.classList.contains(SELECTED)) {
|
|
764
768
|
removeClass([tdEle], SELECTED);
|
|
765
769
|
this.previousDates = false;
|
|
766
770
|
const copyValues = this.copyValues(values);
|
|
@@ -1011,7 +1015,8 @@ let CalendarBase = class CalendarBase extends Component {
|
|
|
1011
1015
|
if (this.weekNumber && rowIterator === otherMonthCell + 1 && elements[otherMonthCell + 1].classList.contains(OTHERMONTH)) {
|
|
1012
1016
|
addClass([trEle], OTHERMONTHROW);
|
|
1013
1017
|
}
|
|
1014
|
-
if (!this.weekNumber && rowIterator === otherMonthCell && elements[otherMonthCell].
|
|
1018
|
+
if (!this.weekNumber && rowIterator === otherMonthCell && elements[otherMonthCell].
|
|
1019
|
+
classList.contains(OTHERMONTH)) {
|
|
1015
1020
|
addClass([trEle], OTHERMONTHROW);
|
|
1016
1021
|
}
|
|
1017
1022
|
if (this.weekNumber) {
|
|
@@ -2546,7 +2551,9 @@ let Calendar = class Calendar extends CalendarBase {
|
|
|
2546
2551
|
if (!isNullOrUndefined(this.value)) {
|
|
2547
2552
|
this.setProperties({ value: this.value }, true);
|
|
2548
2553
|
}
|
|
2549
|
-
|
|
2554
|
+
// eslint-disable-next-line use-isnan
|
|
2555
|
+
if (!this.isMultiSelection && +this.value !== Number.NaN && (!isNullOrUndefined(this.value) &&
|
|
2556
|
+
!isNullOrUndefined(this.previousDate) || this.previousDate === null
|
|
2550
2557
|
&& !isNaN(+this.value))) {
|
|
2551
2558
|
this.changeEvent(e);
|
|
2552
2559
|
}
|
|
@@ -2749,8 +2756,8 @@ class Islamic {
|
|
|
2749
2756
|
}
|
|
2750
2757
|
break;
|
|
2751
2758
|
case 'Decade': {
|
|
2752
|
-
|
|
2753
|
-
|
|
2759
|
+
const startIslamicYear = 1361;
|
|
2760
|
+
const gregorianValue = HijriParser.toGregorian(startIslamicYear, 1, 1);
|
|
2754
2761
|
let prevDecadeCompare = this.hijriCompareDecade(date, this.calendarInstance.min) < 1;
|
|
2755
2762
|
const nextDecadeCompare = this.hijriCompareDecade(date, this.calendarInstance.max) > -1;
|
|
2756
2763
|
prevDecadeCompare = HijriParser.toGregorian(this.calendarInstance.headerTitleElement.textContent.split('-')[0].trim(), 1, 1).getFullYear() === gregorianValue.getFullYear() ? true : prevDecadeCompare;
|
|
@@ -2866,7 +2873,7 @@ class Islamic {
|
|
|
2866
2873
|
let endFullYr = endYr.getFullYear();
|
|
2867
2874
|
let startHdrYr = this.calendarInstance.globalize.formatDate(startYr, { type: 'dateTime', format: 'y', calendar: 'islamic' });
|
|
2868
2875
|
let endHdrYr = this.calendarInstance.globalize.formatDate(endYr, { type: 'dateTime', format: 'y', calendar: 'islamic' });
|
|
2869
|
-
|
|
2876
|
+
const splityear = this.calendarInstance.headerElement.textContent.split('-');
|
|
2870
2877
|
if ((!isNullOrUndefined(e) && (splityear[0] !== startHdrYr) && e.action === 'home') || (!isNullOrUndefined(e) && e.type === 'keydown' && e.action === 'end')) {
|
|
2871
2878
|
startHdrYr = this.calendarInstance.headerElement.textContent.split('-')[0].trim();
|
|
2872
2879
|
endHdrYr = this.calendarInstance.headerElement.textContent.split('-')[1].trim();
|
|
@@ -2877,55 +2884,62 @@ class Islamic {
|
|
|
2877
2884
|
this.calendarInstance.islamicPreviousHeader = null;
|
|
2878
2885
|
}
|
|
2879
2886
|
if (this.calendarInstance.previousIconClicked) {
|
|
2887
|
+
// eslint-disable-next-line no-var
|
|
2880
2888
|
for (var i = 0; i <= splityear.length; i++) {
|
|
2881
|
-
endHdrYr = endHdrYr - splityear[i] === 2 || splityear[i]
|
|
2889
|
+
endHdrYr = endHdrYr - splityear[i] === 2 || splityear[i]
|
|
2890
|
+
- endHdrYr === 2 ? (parseInt(endHdrYr, 10) + 1).toString() :
|
|
2891
|
+
endHdrYr - splityear[i] === 3 || splityear[i] - endHdrYr === 3 ?
|
|
2892
|
+
(parseInt(endHdrYr, 10) + 2).toString() : endHdrYr - splityear[i] === 4 ||
|
|
2893
|
+
splityear[i] - endHdrYr === 4 ? (parseInt(endHdrYr, 10) + 3).toString() :
|
|
2894
|
+
endHdrYr - splityear[i] === 5 || splityear[i] - endHdrYr === 5 ?
|
|
2895
|
+
(parseInt(endHdrYr, 10) + 4).toString() : endHdrYr;
|
|
2882
2896
|
if (endHdrYr - splityear[i] === 0 || splityear[i] - endHdrYr === 0) {
|
|
2883
|
-
endHdrYr = (parseInt(endHdrYr) - 1).toString();
|
|
2897
|
+
endHdrYr = (parseInt(endHdrYr, 10) - 1).toString();
|
|
2884
2898
|
}
|
|
2885
2899
|
}
|
|
2886
2900
|
if (endHdrYr - splityear[i] === 8 || splityear[i] - endHdrYr === 8) {
|
|
2887
|
-
endHdrYr = (parseInt(endHdrYr) - 9).toString();
|
|
2888
|
-
startHdrYr = (parseInt(endHdrYr) - 9).toString();
|
|
2901
|
+
endHdrYr = (parseInt(endHdrYr, 10) - 9).toString();
|
|
2902
|
+
startHdrYr = (parseInt(endHdrYr, 10) - 9).toString();
|
|
2889
2903
|
}
|
|
2890
2904
|
if (endHdrYr - splityear[i] === 7 || splityear[i] - endHdrYr === 7) {
|
|
2891
|
-
endHdrYr = (parseInt(endHdrYr) - 8).toString();
|
|
2892
|
-
startHdrYr = (parseInt(endHdrYr) - 9).toString();
|
|
2905
|
+
endHdrYr = (parseInt(endHdrYr, 10) - 8).toString();
|
|
2906
|
+
startHdrYr = (parseInt(endHdrYr, 10) - 9).toString();
|
|
2893
2907
|
}
|
|
2894
2908
|
startHdrYr = endHdrYr - startHdrYr === 10
|
|
2895
|
-
? (parseInt(startHdrYr) + 1).toString() : endHdrYr - startHdrYr === 11
|
|
2896
|
-
? (parseInt(startHdrYr) + 2).toString() : endHdrYr - startHdrYr === 12
|
|
2897
|
-
? (parseInt(startHdrYr) + 3).toString() : startHdrYr;
|
|
2909
|
+
? (parseInt(startHdrYr, 10) + 1).toString() : endHdrYr - startHdrYr === 11
|
|
2910
|
+
? (parseInt(startHdrYr, 10) + 2).toString() : endHdrYr - startHdrYr === 12
|
|
2911
|
+
? (parseInt(startHdrYr, 10) + 3).toString() : startHdrYr;
|
|
2898
2912
|
if (endHdrYr - startHdrYr === 8) {
|
|
2899
|
-
startHdrYr = (parseInt(startHdrYr) - 1).toString();
|
|
2913
|
+
startHdrYr = (parseInt(startHdrYr, 10) - 1).toString();
|
|
2900
2914
|
}
|
|
2901
2915
|
}
|
|
2902
2916
|
if (this.calendarInstance.nextIconClicked) {
|
|
2903
|
-
for (
|
|
2917
|
+
for (let i = 0; i <= splityear.length; i++) {
|
|
2904
2918
|
if (startHdrYr - splityear[i] === 0 || splityear[i] - startHdrYr === 0) {
|
|
2905
|
-
startHdrYr = (parseInt(startHdrYr) + 1).toString();
|
|
2919
|
+
startHdrYr = (parseInt(startHdrYr, 10) + 1).toString();
|
|
2906
2920
|
}
|
|
2907
2921
|
if (startHdrYr - splityear[i] === 2 && startHdrYr > splityear[i].trim()) {
|
|
2908
|
-
startHdrYr = (parseInt(startHdrYr) - 1).toString();
|
|
2922
|
+
startHdrYr = (parseInt(startHdrYr, 10) - 1).toString();
|
|
2909
2923
|
}
|
|
2910
2924
|
if (splityear[i] - startHdrYr === 1 && startHdrYr < splityear[i].trim()) {
|
|
2911
|
-
startHdrYr = (parseInt(startHdrYr) + 2).toString();
|
|
2925
|
+
startHdrYr = (parseInt(startHdrYr, 10) + 2).toString();
|
|
2912
2926
|
}
|
|
2913
2927
|
}
|
|
2914
2928
|
if (startHdrYr - this.calendarInstance.headerTitleElement.textContent.split('-')[1].trim() > 1) {
|
|
2915
|
-
startHdrYr = (parseInt(this.calendarInstance.headerTitleElement.textContent.split('-')[1].trim()) + 1).toString();
|
|
2916
|
-
endHdrYr = (parseInt(startHdrYr) + 9).toString();
|
|
2929
|
+
startHdrYr = (parseInt(this.calendarInstance.headerTitleElement.textContent.split('-')[1].trim(), 10) + 1).toString();
|
|
2930
|
+
endHdrYr = (parseInt(startHdrYr, 10) + 9).toString();
|
|
2917
2931
|
}
|
|
2918
|
-
endHdrYr = endHdrYr - startHdrYr === 10 ? (parseInt(endHdrYr) - 1).toString() : endHdrYr;
|
|
2932
|
+
endHdrYr = endHdrYr - startHdrYr === 10 ? (parseInt(endHdrYr, 10) - 1).toString() : endHdrYr;
|
|
2919
2933
|
endHdrYr = endHdrYr - startHdrYr === 7
|
|
2920
|
-
? (parseInt(endHdrYr) + 2).toString() : endHdrYr - startHdrYr === 8
|
|
2921
|
-
? (parseInt(endHdrYr) + 1).toString() : endHdrYr;
|
|
2934
|
+
? (parseInt(endHdrYr, 10) + 2).toString() : endHdrYr - startHdrYr === 8
|
|
2935
|
+
? (parseInt(endHdrYr, 10) + 1).toString() : endHdrYr;
|
|
2922
2936
|
}
|
|
2923
2937
|
this.calendarInstance.headerTitleElement.textContent = startHdrYr + ' - ' + (endHdrYr);
|
|
2924
2938
|
this.calendarInstance.nextIconClicked = this.calendarInstance.previousIconClicked = false;
|
|
2925
|
-
const year = (parseInt(startHdrYr) - 2).toString();
|
|
2926
|
-
startFullYr = Math.round(parseInt(startHdrYr) * 0.97 + 622);
|
|
2927
|
-
endFullYr = Math.round(parseInt(endHdrYr) * 0.97 + 622);
|
|
2928
|
-
|
|
2939
|
+
const year = (parseInt(startHdrYr, 10) - 2).toString();
|
|
2940
|
+
startFullYr = Math.round(parseInt(startHdrYr, 10) * 0.97 + 622);
|
|
2941
|
+
endFullYr = Math.round(parseInt(endHdrYr, 10) * 0.97 + 622);
|
|
2942
|
+
const startYear = Math.round(parseInt(year, 10) * 0.97 + 622);
|
|
2929
2943
|
for (let rowCount = 1; rowCount <= yearCell; ++rowCount) {
|
|
2930
2944
|
const year = startYear + rowCount;
|
|
2931
2945
|
localDate.setFullYear(year);
|
|
@@ -2939,12 +2953,14 @@ class Islamic {
|
|
|
2939
2953
|
islamicDate = this.getIslamicDate(localDate);
|
|
2940
2954
|
const gregorianObject = HijriParser.toGregorian(islamicDate.year, 1, 1);
|
|
2941
2955
|
localDate = gregorianObject;
|
|
2942
|
-
if (islamicDate.year === parseInt(startHdrYr) - 1 || islamicDate.year >= startHdrYr &&
|
|
2956
|
+
if (islamicDate.year === parseInt(startHdrYr, 10) - 1 || islamicDate.year >= startHdrYr &&
|
|
2957
|
+
islamicDate.year <= endFullYr || islamicDate.year === parseInt(endHdrYr, 10) + 1) {
|
|
2943
2958
|
const tdEle = this.islamicDayCell(localDate);
|
|
2944
2959
|
attributes(tdEle, { 'role': 'gridcell' });
|
|
2945
2960
|
const dayLink = this.calendarInstance.createElement('span');
|
|
2946
2961
|
dayLink.textContent = this.calendarInstance.globalize.formatDate(localDate, { type: 'dateTime', format: 'y', calendar: 'islamic' });
|
|
2947
|
-
if (islamicDate.year === parseInt(startHdrYr) - 1 || (year < startFullYr) ||
|
|
2962
|
+
if (islamicDate.year === parseInt(startHdrYr, 10) - 1 || (year < startFullYr) ||
|
|
2963
|
+
(year > endFullYr) && islamicDate.year !== parseInt(endHdrYr, 10)) {
|
|
2948
2964
|
addClass([tdEle], OTHERMONTH$1);
|
|
2949
2965
|
}
|
|
2950
2966
|
else if (year < new Date(this.islamicInValue(this.calendarInstance.min)).getFullYear()
|
|
@@ -2957,7 +2973,8 @@ class Islamic {
|
|
|
2957
2973
|
addClass([tdEle], SELECTED$1);
|
|
2958
2974
|
}
|
|
2959
2975
|
else {
|
|
2960
|
-
if (localDate.getFullYear() === this.calendarInstance.currentDate.getFullYear() &&
|
|
2976
|
+
if (localDate.getFullYear() === this.calendarInstance.currentDate.getFullYear() &&
|
|
2977
|
+
!tdEle.classList.contains(DISABLED$1)) {
|
|
2961
2978
|
addClass([tdEle], FOCUSEDDATE$1);
|
|
2962
2979
|
}
|
|
2963
2980
|
}
|
|
@@ -3190,7 +3207,7 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3190
3207
|
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && !isNullOrUndefined(this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0]) && this.floatLabelType !== 'Never') {
|
|
3191
3208
|
this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
3192
3209
|
}
|
|
3193
|
-
if (!isNullOrUndefined(closest(this.element,
|
|
3210
|
+
if (!isNullOrUndefined(closest(this.element, 'fieldset')) && closest(this.element, 'fieldset').disabled) {
|
|
3194
3211
|
this.enabled = false;
|
|
3195
3212
|
}
|
|
3196
3213
|
this.renderComplete();
|
|
@@ -3238,15 +3255,15 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3238
3255
|
initialize() {
|
|
3239
3256
|
this.checkInvalidValue(this.value);
|
|
3240
3257
|
if (this.enableMask) {
|
|
3241
|
-
this.notify(
|
|
3242
|
-
module:
|
|
3258
|
+
this.notify('createMask', {
|
|
3259
|
+
module: 'MaskedDateTime'
|
|
3243
3260
|
});
|
|
3244
3261
|
}
|
|
3245
3262
|
this.createInput();
|
|
3246
3263
|
this.updateHtmlAttributeToWrapper();
|
|
3247
3264
|
this.setAllowEdit();
|
|
3248
3265
|
this.updateInput(true);
|
|
3249
|
-
if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType
|
|
3266
|
+
if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType === 'Always' || !this.floatLabelType || !this.placeholder)) {
|
|
3250
3267
|
this.updateInputValue(this.maskedDateValue);
|
|
3251
3268
|
}
|
|
3252
3269
|
this.previousElementValue = this.inputElement.value;
|
|
@@ -3270,7 +3287,7 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3270
3287
|
if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
|
|
3271
3288
|
updatedCssClassValues = (this.cssClass.replace(/\s+/g, ' ')).trim();
|
|
3272
3289
|
}
|
|
3273
|
-
|
|
3290
|
+
const isBindClearAction = this.enableMask ? false : true;
|
|
3274
3291
|
this.inputWrapper = Input.createInput({
|
|
3275
3292
|
element: this.inputElement,
|
|
3276
3293
|
floatLabelType: this.floatLabelType,
|
|
@@ -3359,8 +3376,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3359
3376
|
}
|
|
3360
3377
|
else {
|
|
3361
3378
|
this.updateInputValue(this.maskedDateValue);
|
|
3362
|
-
this.notify(
|
|
3363
|
-
module:
|
|
3379
|
+
this.notify('createMask', {
|
|
3380
|
+
module: 'MaskedDateTime'
|
|
3364
3381
|
});
|
|
3365
3382
|
}
|
|
3366
3383
|
}
|
|
@@ -3526,8 +3543,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3526
3543
|
if (e.code !== 'Delete') {
|
|
3527
3544
|
e.preventDefault();
|
|
3528
3545
|
}
|
|
3529
|
-
this.notify(
|
|
3530
|
-
module:
|
|
3546
|
+
this.notify('keyDownHandler', {
|
|
3547
|
+
module: 'MaskedDateTime',
|
|
3531
3548
|
e: e
|
|
3532
3549
|
});
|
|
3533
3550
|
}
|
|
@@ -3602,8 +3619,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3602
3619
|
mouseUpHandler(e) {
|
|
3603
3620
|
if (this.enableMask) {
|
|
3604
3621
|
e.preventDefault();
|
|
3605
|
-
this.notify(
|
|
3606
|
-
module:
|
|
3622
|
+
this.notify('setMaskSelection', {
|
|
3623
|
+
module: 'MaskedDateTime'
|
|
3607
3624
|
});
|
|
3608
3625
|
}
|
|
3609
3626
|
}
|
|
@@ -3621,13 +3638,13 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3621
3638
|
this.popupUpdate();
|
|
3622
3639
|
this.changeEvent(event);
|
|
3623
3640
|
if (this.enableMask) {
|
|
3624
|
-
this.notify(
|
|
3625
|
-
module:
|
|
3641
|
+
this.notify('clearHandler', {
|
|
3642
|
+
module: 'MaskedDateTime'
|
|
3626
3643
|
});
|
|
3627
3644
|
}
|
|
3628
3645
|
if (closest(this.element, 'form')) {
|
|
3629
|
-
|
|
3630
|
-
|
|
3646
|
+
const element = this.element;
|
|
3647
|
+
const keyupEvent = document.createEvent('KeyboardEvent');
|
|
3631
3648
|
keyupEvent.initEvent('keyup', false, true);
|
|
3632
3649
|
element.dispatchEvent(keyupEvent);
|
|
3633
3650
|
}
|
|
@@ -3755,7 +3772,7 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3755
3772
|
return;
|
|
3756
3773
|
}
|
|
3757
3774
|
if (this.enableMask && !this.inputElement.value && this.placeholder) {
|
|
3758
|
-
if (this.maskedDateValue && !this.value && (this.floatLabelType
|
|
3775
|
+
if (this.maskedDateValue && !this.value && (this.floatLabelType === 'Auto' || this.floatLabelType === 'Never' || this.placeholder)) {
|
|
3759
3776
|
this.updateInputValue(this.maskedDateValue);
|
|
3760
3777
|
this.inputElement.selectionStart = 0;
|
|
3761
3778
|
this.inputElement.selectionEnd = this.inputElement.value.length;
|
|
@@ -3774,8 +3791,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3774
3791
|
inputHandler() {
|
|
3775
3792
|
this.isPopupClicked = false;
|
|
3776
3793
|
if (this.enableMask) {
|
|
3777
|
-
this.notify(
|
|
3778
|
-
module:
|
|
3794
|
+
this.notify('inputHandler', {
|
|
3795
|
+
module: 'MaskedDateTime'
|
|
3779
3796
|
});
|
|
3780
3797
|
}
|
|
3781
3798
|
}
|
|
@@ -3792,7 +3809,7 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3792
3809
|
this.popupUpdate();
|
|
3793
3810
|
this.changeTrigger(e);
|
|
3794
3811
|
if (this.enableMask && this.maskedDateValue && this.placeholder && this.floatLabelType !== 'Always') {
|
|
3795
|
-
if (this.inputElement.value
|
|
3812
|
+
if (this.inputElement.value === this.maskedDateValue && !this.value && (this.floatLabelType === 'Auto' || this.floatLabelType === 'Never' || this.placeholder)) {
|
|
3796
3813
|
this.updateInputValue('');
|
|
3797
3814
|
}
|
|
3798
3815
|
}
|
|
@@ -3881,31 +3898,33 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3881
3898
|
break;
|
|
3882
3899
|
case 'tab':
|
|
3883
3900
|
case 'shiftTab':
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
e.
|
|
3901
|
+
{
|
|
3902
|
+
let start = this.inputElement.selectionStart;
|
|
3903
|
+
let end = this.inputElement.selectionEnd;
|
|
3904
|
+
if (this.enableMask && !this.popupObj && !this.readonly) {
|
|
3905
|
+
const length = this.inputElement.value.length;
|
|
3906
|
+
if ((start === 0 && end === length) || (end !== length && e.action === 'tab') || (start !== 0 && e.action === 'shiftTab')) {
|
|
3907
|
+
e.preventDefault();
|
|
3908
|
+
}
|
|
3909
|
+
this.notify('keyDownHandler', {
|
|
3910
|
+
module: 'MaskedDateTime',
|
|
3911
|
+
e: e
|
|
3912
|
+
});
|
|
3913
|
+
start = this.inputElement.selectionStart;
|
|
3914
|
+
end = this.inputElement.selectionEnd;
|
|
3890
3915
|
}
|
|
3891
|
-
this.
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
this.errorClass();
|
|
3903
|
-
if (this.enableMask) {
|
|
3904
|
-
this.inputElement.selectionStart = start;
|
|
3905
|
-
this.inputElement.selectionEnd = end;
|
|
3916
|
+
this.strictModeUpdate();
|
|
3917
|
+
this.updateInput();
|
|
3918
|
+
this.popupUpdate();
|
|
3919
|
+
this.changeTrigger(e);
|
|
3920
|
+
this.errorClass();
|
|
3921
|
+
if (this.enableMask) {
|
|
3922
|
+
this.inputElement.selectionStart = start;
|
|
3923
|
+
this.inputElement.selectionEnd = end;
|
|
3924
|
+
}
|
|
3925
|
+
this.hide(e);
|
|
3926
|
+
break;
|
|
3906
3927
|
}
|
|
3907
|
-
this.hide(e);
|
|
3908
|
-
break;
|
|
3909
3928
|
default:
|
|
3910
3929
|
this.defaultAction(e);
|
|
3911
3930
|
// Fix for close the popup when select the previously selected value.
|
|
@@ -4200,7 +4219,6 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4200
4219
|
}
|
|
4201
4220
|
return modules;
|
|
4202
4221
|
}
|
|
4203
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4204
4222
|
selectCalendar(e) {
|
|
4205
4223
|
let date;
|
|
4206
4224
|
let tempFormat;
|
|
@@ -4231,16 +4249,16 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4231
4249
|
date = this.globalize.formatDate(this.changedArgs.value, formatOptions);
|
|
4232
4250
|
}
|
|
4233
4251
|
if (this.enableMask) {
|
|
4234
|
-
this.notify(
|
|
4235
|
-
module:
|
|
4252
|
+
this.notify('createMask', {
|
|
4253
|
+
module: 'MaskedDateTime'
|
|
4236
4254
|
});
|
|
4237
4255
|
}
|
|
4238
4256
|
}
|
|
4239
4257
|
if (!isNullOrUndefined(date)) {
|
|
4240
4258
|
this.updateInputValue(date);
|
|
4241
4259
|
if (this.enableMask) {
|
|
4242
|
-
this.notify(
|
|
4243
|
-
module:
|
|
4260
|
+
this.notify('setMaskSelection', {
|
|
4261
|
+
module: 'MaskedDateTime'
|
|
4244
4262
|
});
|
|
4245
4263
|
}
|
|
4246
4264
|
}
|
|
@@ -4276,7 +4294,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4276
4294
|
else {
|
|
4277
4295
|
let prevent = true;
|
|
4278
4296
|
let outOfRange;
|
|
4279
|
-
if (!isNullOrUndefined(this.value) && !(+this.value >= +new Date(this.checkValue(this.min))
|
|
4297
|
+
if (!isNullOrUndefined(this.value) && !(+this.value >= +new Date(this.checkValue(this.min))
|
|
4298
|
+
&& +this.value <= +new Date(this.checkValue(this.max)))) {
|
|
4280
4299
|
outOfRange = new Date(this.checkValue(this.value));
|
|
4281
4300
|
this.setProperties({ 'value': null }, true);
|
|
4282
4301
|
}
|
|
@@ -4794,8 +4813,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4794
4813
|
this.updateInputValue(inputVal);
|
|
4795
4814
|
if (this.enableMask) {
|
|
4796
4815
|
this.updateInputValue(this.maskedDateValue);
|
|
4797
|
-
this.notify(
|
|
4798
|
-
module:
|
|
4816
|
+
this.notify('createMask', {
|
|
4817
|
+
module: 'MaskedDateTime'
|
|
4799
4818
|
});
|
|
4800
4819
|
}
|
|
4801
4820
|
}
|
|
@@ -4819,7 +4838,10 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4819
4838
|
const isDisabledDate = this.calendarElement &&
|
|
4820
4839
|
this.calendarElement.querySelectorAll(dateIdString)[0] &&
|
|
4821
4840
|
this.calendarElement.querySelectorAll(dateIdString)[0].classList.contains('e-disabled');
|
|
4822
|
-
if ((!isNullOrUndefined(this.value) && !isNullOrUndefined(this.min) &&
|
|
4841
|
+
if ((!isNullOrUndefined(this.value) && !isNullOrUndefined(this.min) &&
|
|
4842
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4843
|
+
!isNullOrUndefined(this.max) && !(new Date(this.value).setMilliseconds(0) >= new Date(this.min).setMilliseconds(0)
|
|
4844
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4823
4845
|
&& new Date(this.value).setMilliseconds(0) <= new Date(this.max).setMilliseconds(0)))
|
|
4824
4846
|
|| (!this.strictMode && this.inputElement.value !== '' && this.inputElement.value !== this.maskedDateValue && isNullOrUndefined(this.value) || isDisabledDate)) {
|
|
4825
4847
|
addClass([this.inputWrapper.container], ERROR);
|
|
@@ -4859,8 +4881,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4859
4881
|
this.isInteracted = true;
|
|
4860
4882
|
this.preventChange = this.isAngular && this.preventChange ? !this.preventChange : this.preventChange;
|
|
4861
4883
|
if (this.enableMask) {
|
|
4862
|
-
this.notify(
|
|
4863
|
-
module:
|
|
4884
|
+
this.notify('createMask', {
|
|
4885
|
+
module: 'MaskedDateTime'
|
|
4864
4886
|
});
|
|
4865
4887
|
}
|
|
4866
4888
|
break;
|
|
@@ -4869,8 +4891,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4869
4891
|
this.bindInputEvent();
|
|
4870
4892
|
this.updateInput();
|
|
4871
4893
|
if (this.enableMask) {
|
|
4872
|
-
this.notify(
|
|
4873
|
-
module:
|
|
4894
|
+
this.notify('createMask', {
|
|
4895
|
+
module: 'MaskedDateTime'
|
|
4874
4896
|
});
|
|
4875
4897
|
if (!this.value) {
|
|
4876
4898
|
this.updateInputValue(this.maskedDateValue);
|
|
@@ -4902,8 +4924,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4902
4924
|
Input.setPlaceholder(this.placeholder, this.inputElement);
|
|
4903
4925
|
this.updateInput();
|
|
4904
4926
|
if (this.enableMask) {
|
|
4905
|
-
this.notify(
|
|
4906
|
-
module:
|
|
4927
|
+
this.notify('createMask', {
|
|
4928
|
+
module: 'MaskedDateTime'
|
|
4907
4929
|
});
|
|
4908
4930
|
}
|
|
4909
4931
|
break;
|
|
@@ -4949,8 +4971,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4949
4971
|
break;
|
|
4950
4972
|
case 'enableMask':
|
|
4951
4973
|
if (this.enableMask) {
|
|
4952
|
-
this.notify(
|
|
4953
|
-
module:
|
|
4974
|
+
this.notify('createMask', {
|
|
4975
|
+
module: 'MaskedDateTime'
|
|
4954
4976
|
});
|
|
4955
4977
|
this.updateInputValue(this.maskedDateValue);
|
|
4956
4978
|
this.bindInputEvent();
|
|
@@ -5207,7 +5229,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
5207
5229
|
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && !isNullOrUndefined(this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0]) && this.floatLabelType !== 'Never') {
|
|
5208
5230
|
this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
5209
5231
|
}
|
|
5210
|
-
if (!isNullOrUndefined(closest(this.element,
|
|
5232
|
+
if (!isNullOrUndefined(closest(this.element, 'fieldset')) && closest(this.element, 'fieldset').disabled) {
|
|
5211
5233
|
this.enabled = false;
|
|
5212
5234
|
}
|
|
5213
5235
|
this.renderComplete();
|
|
@@ -5409,7 +5431,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
5409
5431
|
let attributes$$1 = {};
|
|
5410
5432
|
if (!isDynamic) {
|
|
5411
5433
|
for (let i = 0; i < this.element.attributes.length; i++) {
|
|
5412
|
-
attributes$$1[this.element.attributes[i].name] =
|
|
5434
|
+
attributes$$1[this.element.attributes[i].name] =
|
|
5435
|
+
this.element.getAttribute(this.element.attributes[i].name);
|
|
5413
5436
|
}
|
|
5414
5437
|
}
|
|
5415
5438
|
else {
|
|
@@ -5618,8 +5641,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
5618
5641
|
this.clearRange();
|
|
5619
5642
|
this.hide(e);
|
|
5620
5643
|
if (closest(this.element, 'form')) {
|
|
5621
|
-
|
|
5622
|
-
|
|
5644
|
+
const element = this.firstHiddenChild;
|
|
5645
|
+
const keyupEvent = document.createEvent('KeyboardEvent');
|
|
5623
5646
|
keyupEvent.initEvent('keyup', false, true);
|
|
5624
5647
|
element.dispatchEvent(keyupEvent);
|
|
5625
5648
|
}
|
|
@@ -5837,7 +5860,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
5837
5860
|
this.createControl();
|
|
5838
5861
|
this.bindCalendarEvents();
|
|
5839
5862
|
this.updateRange((this.isMobile ? [this.calendarElement] : [this.leftCalendar, this.rightCalendar]));
|
|
5840
|
-
if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) &&
|
|
5863
|
+
if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) &&
|
|
5864
|
+
!isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
|
|
5841
5865
|
this.disabledDateRender();
|
|
5842
5866
|
}
|
|
5843
5867
|
this.updateHeader();
|
|
@@ -6083,6 +6107,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
6083
6107
|
}
|
|
6084
6108
|
this.updateHiddenInput();
|
|
6085
6109
|
}
|
|
6110
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
6086
6111
|
getStartEndDate(date, isEnd, range, dateOptions) {
|
|
6087
6112
|
if (this.depth === 'Month') {
|
|
6088
6113
|
return this.globalize.parseDate(range[isEnd ? 1 : 0].trim(), dateOptions);
|
|
@@ -6471,7 +6496,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
6471
6496
|
const isLeftYear = leftHeader ? leftHeader.classList.contains('e-year') : false;
|
|
6472
6497
|
const isRightDecade = rightHeader ? rightHeader.classList.contains('e-decade') : false;
|
|
6473
6498
|
const isLeftDecade = leftHeader ? leftHeader.classList.contains('e-decade') : false;
|
|
6474
|
-
return isLeftCalendar && (isLeftMonth || isLeftYear || isLeftDecade) &&
|
|
6499
|
+
return isLeftCalendar && (isLeftMonth || isLeftYear || isLeftDecade) &&
|
|
6500
|
+
(isRightMonth || isRightYear || isRightDecade) && !this.isMobile;
|
|
6475
6501
|
}
|
|
6476
6502
|
keyNavigation(calendar, e) {
|
|
6477
6503
|
this.bindCalendarCellEvents(calendar);
|
|
@@ -8415,7 +8441,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
8415
8441
|
if (!this.strictMode && (isDisabled)) {
|
|
8416
8442
|
this.clearRange();
|
|
8417
8443
|
}
|
|
8418
|
-
if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) &&
|
|
8444
|
+
if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) &&
|
|
8445
|
+
!isDisabled && !isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
|
|
8419
8446
|
this.disabledDateRender();
|
|
8420
8447
|
}
|
|
8421
8448
|
this.errorClass();
|
|
@@ -9160,6 +9187,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
9160
9187
|
this.updateHeader();
|
|
9161
9188
|
}
|
|
9162
9189
|
}
|
|
9190
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
9163
9191
|
getStartEndValue(date, isEnd) {
|
|
9164
9192
|
if (this.depth === 'Month') {
|
|
9165
9193
|
return this.checkDateValue(new Date(this.checkValue(date)));
|
|
@@ -9693,7 +9721,7 @@ let TimePicker = class TimePicker extends Component {
|
|
|
9693
9721
|
this.bindEvents();
|
|
9694
9722
|
this.validateDisable();
|
|
9695
9723
|
this.setValue(this.getFormattedValue(this.value));
|
|
9696
|
-
if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType
|
|
9724
|
+
if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType === 'Always' || !this.floatLabelType || !this.placeholder)) {
|
|
9697
9725
|
this.updateInputValue(this.maskedDateValue);
|
|
9698
9726
|
this.checkErrorState(this.maskedDateValue);
|
|
9699
9727
|
}
|
|
@@ -9703,7 +9731,7 @@ let TimePicker = class TimePicker extends Component {
|
|
|
9703
9731
|
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && !isNullOrUndefined(this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0]) && this.floatLabelType !== 'Never') {
|
|
9704
9732
|
this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
9705
9733
|
}
|
|
9706
|
-
if (!isNullOrUndefined(closest(this.element,
|
|
9734
|
+
if (!isNullOrUndefined(closest(this.element, 'fieldset')) && closest(this.element, 'fieldset').disabled) {
|
|
9707
9735
|
this.enabled = false;
|
|
9708
9736
|
}
|
|
9709
9737
|
this.renderComplete();
|
|
@@ -9804,8 +9832,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
9804
9832
|
attributes(this.inputElement, { 'name': this.element.id });
|
|
9805
9833
|
}
|
|
9806
9834
|
if (this.enableMask) {
|
|
9807
|
-
this.notify(
|
|
9808
|
-
module:
|
|
9835
|
+
this.notify('createMask', {
|
|
9836
|
+
module: 'MaskedDateTime'
|
|
9809
9837
|
});
|
|
9810
9838
|
}
|
|
9811
9839
|
}
|
|
@@ -9831,7 +9859,7 @@ let TimePicker = class TimePicker extends Component {
|
|
|
9831
9859
|
}
|
|
9832
9860
|
createInputElement() {
|
|
9833
9861
|
let updatedCssClassesValue = this.cssClass;
|
|
9834
|
-
|
|
9862
|
+
const isBindClearAction = this.enableMask ? false : true;
|
|
9835
9863
|
if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
|
|
9836
9864
|
updatedCssClassesValue = (this.cssClass.replace(/\s+/g, ' ')).trim();
|
|
9837
9865
|
}
|
|
@@ -10151,7 +10179,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10151
10179
|
}
|
|
10152
10180
|
checkErrorState(val) {
|
|
10153
10181
|
const value = this.getDateObject(val);
|
|
10154
|
-
if ((this.validateState(value) && !this.invalidValueString) ||
|
|
10182
|
+
if ((this.validateState(value) && !this.invalidValueString) ||
|
|
10183
|
+
(this.enableMask && this.inputElement.value === this.maskedDateValue)) {
|
|
10155
10184
|
this.removeErrorClass();
|
|
10156
10185
|
}
|
|
10157
10186
|
else {
|
|
@@ -10399,8 +10428,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10399
10428
|
event.preventDefault();
|
|
10400
10429
|
if (this.enableMask) {
|
|
10401
10430
|
event.preventDefault();
|
|
10402
|
-
this.notify(
|
|
10403
|
-
module:
|
|
10431
|
+
this.notify('setMaskSelection', {
|
|
10432
|
+
module: 'MaskedDateTime'
|
|
10404
10433
|
});
|
|
10405
10434
|
return;
|
|
10406
10435
|
}
|
|
@@ -10463,8 +10492,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10463
10492
|
case 'down':
|
|
10464
10493
|
if (this.enableMask && !this.readonly && !this.isPopupOpen()) {
|
|
10465
10494
|
event.preventDefault();
|
|
10466
|
-
this.notify(
|
|
10467
|
-
module:
|
|
10495
|
+
this.notify('keyDownHandler', {
|
|
10496
|
+
module: 'MaskedDateTime',
|
|
10468
10497
|
e: event
|
|
10469
10498
|
});
|
|
10470
10499
|
}
|
|
@@ -10509,12 +10538,12 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10509
10538
|
case 'tab':
|
|
10510
10539
|
case 'shiftTab':
|
|
10511
10540
|
if (!this.isPopupOpen() && this.enableMask && !this.readonly) {
|
|
10512
|
-
if ((this.inputElement.selectionStart
|
|
10513
|
-
(this.inputElement.selectionEnd !== this.inputElement.value.length && event.action
|
|
10514
|
-
(this.inputElement.selectionStart !== 0 && event.action
|
|
10541
|
+
if ((this.inputElement.selectionStart === 0 && this.inputElement.selectionEnd === this.inputElement.value.length) ||
|
|
10542
|
+
(this.inputElement.selectionEnd !== this.inputElement.value.length && event.action === 'tab') ||
|
|
10543
|
+
(this.inputElement.selectionStart !== 0 && event.action === 'shiftTab') || (event.action === 'left' || event.action === 'right')) {
|
|
10515
10544
|
event.preventDefault();
|
|
10516
10545
|
}
|
|
10517
|
-
this.notify(
|
|
10546
|
+
this.notify('keyDownHandler', { module: 'MaskedDateTime',
|
|
10518
10547
|
e: event
|
|
10519
10548
|
});
|
|
10520
10549
|
}
|
|
@@ -10777,8 +10806,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10777
10806
|
switch (e.code) {
|
|
10778
10807
|
case 'Delete':
|
|
10779
10808
|
if (this.enableMask && !this.popupObj && !this.readonly) {
|
|
10780
|
-
this.notify(
|
|
10781
|
-
module:
|
|
10809
|
+
this.notify('keyDownHandler', {
|
|
10810
|
+
module: 'MaskedDateTime',
|
|
10782
10811
|
e: e
|
|
10783
10812
|
});
|
|
10784
10813
|
}
|
|
@@ -10824,8 +10853,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10824
10853
|
}
|
|
10825
10854
|
inputEventHandler() {
|
|
10826
10855
|
if (this.enableMask) {
|
|
10827
|
-
this.notify(
|
|
10828
|
-
module:
|
|
10856
|
+
this.notify('inputHandler', {
|
|
10857
|
+
module: 'MaskedDateTime'
|
|
10829
10858
|
});
|
|
10830
10859
|
}
|
|
10831
10860
|
}
|
|
@@ -10875,13 +10904,13 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10875
10904
|
this.popupWrapper.scrollTop = 0;
|
|
10876
10905
|
}
|
|
10877
10906
|
if (this.enableMask) {
|
|
10878
|
-
this.notify(
|
|
10879
|
-
module:
|
|
10907
|
+
this.notify('clearHandler', {
|
|
10908
|
+
module: 'MaskedDateTime'
|
|
10880
10909
|
});
|
|
10881
10910
|
}
|
|
10882
10911
|
if (closest(this.element, 'form')) {
|
|
10883
|
-
|
|
10884
|
-
|
|
10912
|
+
const element = this.element;
|
|
10913
|
+
const keyupEvent = document.createEvent('KeyboardEvent');
|
|
10885
10914
|
keyupEvent.initEvent('keyup', false, true);
|
|
10886
10915
|
element.dispatchEvent(keyupEvent);
|
|
10887
10916
|
}
|
|
@@ -11002,10 +11031,10 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11002
11031
|
if (!inputVal) {
|
|
11003
11032
|
this.updateInputValue(this.maskedDateValue);
|
|
11004
11033
|
}
|
|
11005
|
-
if (isNullOrUndefined(val) && value
|
|
11034
|
+
if (isNullOrUndefined(val) && value !== this.maskedDateValue) {
|
|
11006
11035
|
this.createMask();
|
|
11007
11036
|
}
|
|
11008
|
-
if (isNullOrUndefined(val) && value
|
|
11037
|
+
if (isNullOrUndefined(val) && value === this.maskedDateValue) {
|
|
11009
11038
|
this.updateInputValue(this.maskedDateValue);
|
|
11010
11039
|
}
|
|
11011
11040
|
}
|
|
@@ -11077,13 +11106,13 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11077
11106
|
else {
|
|
11078
11107
|
this.updateInputValue(time);
|
|
11079
11108
|
if (this.enableMask) {
|
|
11080
|
-
if (time
|
|
11109
|
+
if (time === '') {
|
|
11081
11110
|
this.updateInputValue(this.maskedDateValue);
|
|
11082
11111
|
}
|
|
11083
|
-
if (isNullOrUndefined(time) && value
|
|
11112
|
+
if (isNullOrUndefined(time) && value !== this.maskedDateValue) {
|
|
11084
11113
|
this.createMask();
|
|
11085
11114
|
}
|
|
11086
|
-
if (isNullOrUndefined(time) && value
|
|
11115
|
+
if (isNullOrUndefined(time) && value === this.maskedDateValue) {
|
|
11087
11116
|
this.updateInputValue(this.maskedDateValue);
|
|
11088
11117
|
}
|
|
11089
11118
|
}
|
|
@@ -11091,8 +11120,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11091
11120
|
return time;
|
|
11092
11121
|
}
|
|
11093
11122
|
createMask() {
|
|
11094
|
-
this.notify(
|
|
11095
|
-
module:
|
|
11123
|
+
this.notify('createMask', {
|
|
11124
|
+
module: 'MaskedDateTime'
|
|
11096
11125
|
});
|
|
11097
11126
|
}
|
|
11098
11127
|
findNextElement(event) {
|
|
@@ -11203,7 +11232,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11203
11232
|
return elementIndex;
|
|
11204
11233
|
}
|
|
11205
11234
|
keyHandler(event) {
|
|
11206
|
-
if (isNullOrUndefined(this.step) || this.step <= 0 || !isNullOrUndefined(this.inputWrapper)
|
|
11235
|
+
if (isNullOrUndefined(this.step) || this.step <= 0 || !isNullOrUndefined(this.inputWrapper)
|
|
11236
|
+
&& this.inputWrapper.buttons[0].classList.contains(DISABLED$3)) {
|
|
11207
11237
|
return;
|
|
11208
11238
|
}
|
|
11209
11239
|
const count = this.timeCollections.length;
|
|
@@ -11231,7 +11261,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11231
11261
|
this.activeIndex = index = this.activeIndex < 0 ? (count - 1) : this.activeIndex;
|
|
11232
11262
|
this.activeIndex = index = this.validLiElement(this.activeIndex, (event.keyCode === 40 || event.keyCode === 39) ?
|
|
11233
11263
|
false : true);
|
|
11234
|
-
nextItem = isNullOrUndefined(this.timeCollections[index]) ?
|
|
11264
|
+
nextItem = isNullOrUndefined(this.timeCollections[index]) ?
|
|
11265
|
+
this.timeCollections[0] : this.timeCollections[index];
|
|
11235
11266
|
}
|
|
11236
11267
|
else if (event.action === 'home') {
|
|
11237
11268
|
const index = this.validLiElement(0);
|
|
@@ -11519,7 +11550,7 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11519
11550
|
}
|
|
11520
11551
|
this.closePopup(0, e);
|
|
11521
11552
|
if (this.enableMask && this.maskedDateValue && this.placeholder && this.floatLabelType !== 'Always') {
|
|
11522
|
-
if (this.inputElement.value
|
|
11553
|
+
if (this.inputElement.value === this.maskedDateValue && !this.value && (this.floatLabelType === 'Auto' || this.floatLabelType === 'Never' || this.placeholder)) {
|
|
11523
11554
|
this.updateInputValue('');
|
|
11524
11555
|
}
|
|
11525
11556
|
}
|
|
@@ -11572,7 +11603,7 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11572
11603
|
this.selectInputText();
|
|
11573
11604
|
}
|
|
11574
11605
|
if (this.enableMask && !this.inputElement.value && this.placeholder) {
|
|
11575
|
-
if (this.maskedDateValue && !this.value && (this.floatLabelType
|
|
11606
|
+
if (this.maskedDateValue && !this.value && (this.floatLabelType === 'Auto' || this.floatLabelType === 'Never' || this.placeholder)) {
|
|
11576
11607
|
this.updateInputValue(this.maskedDateValue);
|
|
11577
11608
|
this.inputElement.selectionStart = 0;
|
|
11578
11609
|
this.inputElement.selectionEnd = this.inputElement.value.length;
|
|
@@ -11816,8 +11847,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11816
11847
|
this.updatePlaceHolder();
|
|
11817
11848
|
this.setValue(this.value);
|
|
11818
11849
|
if (this.enableMask) {
|
|
11819
|
-
this.notify(
|
|
11820
|
-
module:
|
|
11850
|
+
this.notify('createMask', {
|
|
11851
|
+
module: 'MaskedDateTime'
|
|
11821
11852
|
});
|
|
11822
11853
|
}
|
|
11823
11854
|
break;
|
|
@@ -11869,8 +11900,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11869
11900
|
this.preventChange = false;
|
|
11870
11901
|
}
|
|
11871
11902
|
if (this.enableMask) {
|
|
11872
|
-
this.notify(
|
|
11873
|
-
module:
|
|
11903
|
+
this.notify('createMask', {
|
|
11904
|
+
module: 'MaskedDateTime'
|
|
11874
11905
|
});
|
|
11875
11906
|
}
|
|
11876
11907
|
break;
|
|
@@ -11904,8 +11935,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11904
11935
|
break;
|
|
11905
11936
|
case 'enableMask':
|
|
11906
11937
|
if (this.enableMask) {
|
|
11907
|
-
this.notify(
|
|
11908
|
-
module:
|
|
11938
|
+
this.notify('createMask', {
|
|
11939
|
+
module: 'MaskedDateTime'
|
|
11909
11940
|
});
|
|
11910
11941
|
this.updateInputValue(this.maskedDateValue);
|
|
11911
11942
|
}
|
|
@@ -12206,7 +12237,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
12206
12237
|
this.cloneElement = this.element.cloneNode(true);
|
|
12207
12238
|
this.dateTimeFormat = this.cldrDateTimeFormat();
|
|
12208
12239
|
this.initValue = this.value;
|
|
12209
|
-
if (!isNullOrUndefined(closest(this.element,
|
|
12240
|
+
if (!isNullOrUndefined(closest(this.element, 'fieldset')) && closest(this.element, 'fieldset').disabled) {
|
|
12210
12241
|
this.enabled = false;
|
|
12211
12242
|
}
|
|
12212
12243
|
super.updateHtmlAttributeToElement();
|
|
@@ -12219,12 +12250,12 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
12219
12250
|
super.updateHtmlAttributeToWrapper();
|
|
12220
12251
|
this.bindInputEvents();
|
|
12221
12252
|
if (this.enableMask) {
|
|
12222
|
-
this.notify(
|
|
12223
|
-
module:
|
|
12253
|
+
this.notify('createMask', {
|
|
12254
|
+
module: 'MaskedDateTime'
|
|
12224
12255
|
});
|
|
12225
12256
|
}
|
|
12226
12257
|
this.setValue(true);
|
|
12227
|
-
if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType
|
|
12258
|
+
if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType === 'Always' || !this.floatLabelType || !this.placeholder)) {
|
|
12228
12259
|
Input.setValue(this.maskedDateValue, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
12229
12260
|
}
|
|
12230
12261
|
this.setProperties({ scrollTo: this.checkDateValue(new Date(this.checkValue(this.scrollTo))) }, true);
|
|
@@ -12398,7 +12429,6 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
12398
12429
|
}
|
|
12399
12430
|
return cldrTime;
|
|
12400
12431
|
}
|
|
12401
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12402
12432
|
getCldrFormat(type) {
|
|
12403
12433
|
let cldrDateTime;
|
|
12404
12434
|
if (this.locale === 'en' || this.locale === 'en-US') {
|
|
@@ -12417,7 +12447,6 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
12417
12447
|
return false;
|
|
12418
12448
|
}
|
|
12419
12449
|
}
|
|
12420
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12421
12450
|
getCultureTimeObject(ld, c) {
|
|
12422
12451
|
if (this.calendarMode === 'Gregorian') {
|
|
12423
12452
|
return getValue('main.' + '' + this.locale + '.dates.calendars.gregorian.timeFormats.short', ld);
|
|
@@ -12515,8 +12544,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
12515
12544
|
});
|
|
12516
12545
|
}
|
|
12517
12546
|
const value = isNullOrUndefined(this.value) ? this.inputElement.value !== '' ?
|
|
12518
|
-
dateObject :
|
|
12519
|
-
new Date() : this.value;
|
|
12547
|
+
dateObject : new Date() : this.value;
|
|
12520
12548
|
this.valueWithMinutes = value;
|
|
12521
12549
|
this.listWrapper = createElement('div', { className: CONTENT$3, attrs: { 'tabindex': '0' } });
|
|
12522
12550
|
const min = this.startTime(value);
|
|
@@ -12809,8 +12837,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
12809
12837
|
return this.validateMinMaxRange(value);
|
|
12810
12838
|
}
|
|
12811
12839
|
createMask() {
|
|
12812
|
-
this.notify(
|
|
12813
|
-
module:
|
|
12840
|
+
this.notify('createMask', {
|
|
12841
|
+
module: 'MaskedDateTime'
|
|
12814
12842
|
});
|
|
12815
12843
|
}
|
|
12816
12844
|
combineDateTime(value) {
|
|
@@ -13118,7 +13146,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
13118
13146
|
return modules;
|
|
13119
13147
|
}
|
|
13120
13148
|
maskedDateModule() {
|
|
13121
|
-
|
|
13149
|
+
const modules = { args: [this], member: 'MaskedDateTime' };
|
|
13122
13150
|
return modules;
|
|
13123
13151
|
}
|
|
13124
13152
|
getTimeActiveElement() {
|
|
@@ -13262,7 +13290,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
13262
13290
|
let index = (event.keyCode === 40 || event.keyCode === 39) ? ++this.activeIndex : --this.activeIndex;
|
|
13263
13291
|
this.activeIndex = index = this.activeIndex === (listCount) ? 0 : this.activeIndex;
|
|
13264
13292
|
this.activeIndex = index = this.activeIndex < 0 ? (listCount - 1) : this.activeIndex;
|
|
13265
|
-
nextItemValue = isNullOrUndefined(this.timeCollections[index]) ?
|
|
13293
|
+
nextItemValue = isNullOrUndefined(this.timeCollections[index]) ?
|
|
13294
|
+
this.timeCollections[0] : this.timeCollections[index];
|
|
13266
13295
|
}
|
|
13267
13296
|
else if (event.action === 'home') {
|
|
13268
13297
|
this.activeIndex = 0;
|
|
@@ -13359,8 +13388,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
13359
13388
|
this.changeTrigger(null);
|
|
13360
13389
|
this.preventChange = this.isAngular && this.preventChange ? !this.preventChange : this.preventChange;
|
|
13361
13390
|
if (this.enableMask && this.value) {
|
|
13362
|
-
this.notify(
|
|
13363
|
-
module:
|
|
13391
|
+
this.notify('createMask', {
|
|
13392
|
+
module: 'MaskedDateTime'
|
|
13364
13393
|
});
|
|
13365
13394
|
}
|
|
13366
13395
|
break;
|
|
@@ -13403,8 +13432,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
13403
13432
|
this.dateTimeFormat = this.formatString;
|
|
13404
13433
|
this.setValue();
|
|
13405
13434
|
if (this.enableMask) {
|
|
13406
|
-
this.notify(
|
|
13407
|
-
module:
|
|
13435
|
+
this.notify('createMask', {
|
|
13436
|
+
module: 'MaskedDateTime'
|
|
13408
13437
|
});
|
|
13409
13438
|
if (!this.value) {
|
|
13410
13439
|
Input.setValue(this.maskedDateValue, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
@@ -13455,8 +13484,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
13455
13484
|
break;
|
|
13456
13485
|
case 'enableMask':
|
|
13457
13486
|
if (this.enableMask) {
|
|
13458
|
-
this.notify(
|
|
13459
|
-
module:
|
|
13487
|
+
this.notify('createMask', {
|
|
13488
|
+
module: 'MaskedDateTime'
|
|
13460
13489
|
});
|
|
13461
13490
|
Input.setValue(this.maskedDateValue, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
13462
13491
|
}
|
|
@@ -13623,7 +13652,7 @@ class MaskedDateTime {
|
|
|
13623
13652
|
hour: 'hour',
|
|
13624
13653
|
minute: 'minute',
|
|
13625
13654
|
second: 'second',
|
|
13626
|
-
dayOfTheWeek: 'day of the week'
|
|
13655
|
+
dayOfTheWeek: 'day of the week'
|
|
13627
13656
|
};
|
|
13628
13657
|
this.hiddenMask = '';
|
|
13629
13658
|
this.validCharacters = 'dMyhmHfasz';
|
|
@@ -13689,22 +13718,29 @@ class MaskedDateTime {
|
|
|
13689
13718
|
createMask(navigated = false) {
|
|
13690
13719
|
this.isDayPart = this.isMonthPart = this.isYearPart = this.isHourPart = this.isMinutePart = this.isSecondsPart = false;
|
|
13691
13720
|
this.dateformat = this.getCulturedFormat();
|
|
13692
|
-
if (this.parent.maskPlaceholder.day)
|
|
13721
|
+
if (this.parent.maskPlaceholder.day) {
|
|
13693
13722
|
this.defaultConstant['day'] = this.parent.maskPlaceholder.day;
|
|
13694
|
-
|
|
13723
|
+
}
|
|
13724
|
+
if (this.parent.maskPlaceholder.month) {
|
|
13695
13725
|
this.defaultConstant['month'] = this.parent.maskPlaceholder.month;
|
|
13696
|
-
|
|
13726
|
+
}
|
|
13727
|
+
if (this.parent.maskPlaceholder.year) {
|
|
13697
13728
|
this.defaultConstant['year'] = this.parent.maskPlaceholder.year;
|
|
13698
|
-
|
|
13729
|
+
}
|
|
13730
|
+
if (this.parent.maskPlaceholder.hour) {
|
|
13699
13731
|
this.defaultConstant['hour'] = this.parent.maskPlaceholder.hour;
|
|
13700
|
-
|
|
13732
|
+
}
|
|
13733
|
+
if (this.parent.maskPlaceholder.minute) {
|
|
13701
13734
|
this.defaultConstant['minute'] = this.parent.maskPlaceholder.minute;
|
|
13702
|
-
|
|
13735
|
+
}
|
|
13736
|
+
if (this.parent.maskPlaceholder.second) {
|
|
13703
13737
|
this.defaultConstant['second'] = this.parent.maskPlaceholder.second;
|
|
13704
|
-
|
|
13738
|
+
}
|
|
13739
|
+
if (this.parent.maskPlaceholder.dayOfTheWeek) {
|
|
13705
13740
|
this.defaultConstant['dayOfTheWeek'] = this.parent.maskPlaceholder.dayOfTheWeek.toString();
|
|
13741
|
+
}
|
|
13706
13742
|
this.getCUltureMaskFormat();
|
|
13707
|
-
|
|
13743
|
+
const inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
13708
13744
|
this.isHiddenMask = true;
|
|
13709
13745
|
this.hiddenMask = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
13710
13746
|
this.isHiddenMask = false;
|
|
@@ -13720,11 +13756,12 @@ class MaskedDateTime {
|
|
|
13720
13756
|
this.l10n = new L10n(this.parent.moduleName, this.defaultConstant, this.parent.locale);
|
|
13721
13757
|
this.objectString = Object.keys(this.defaultConstant);
|
|
13722
13758
|
for (let i = 0; i < this.objectString.length; i++) {
|
|
13723
|
-
this.defaultConstant[this.objectString[i].toString()] =
|
|
13759
|
+
this.defaultConstant[this.objectString[i].toString()] =
|
|
13760
|
+
this.l10n.getConstant(this.objectString[i].toString());
|
|
13724
13761
|
}
|
|
13725
13762
|
}
|
|
13726
13763
|
validCharacterCheck() {
|
|
13727
|
-
|
|
13764
|
+
const start = this.parent.inputElement.selectionStart;
|
|
13728
13765
|
for (let i = start, j = start - 1; i < this.hiddenMask.length || j >= 0; i++, j--) {
|
|
13729
13766
|
if (i < this.hiddenMask.length && this.validCharacters.indexOf(this.hiddenMask[i]) !== -1) {
|
|
13730
13767
|
this.setSelection(this.hiddenMask[i]);
|
|
@@ -13740,7 +13777,6 @@ class MaskedDateTime {
|
|
|
13740
13777
|
this.maskDateValue = new Date(+this.parent.value);
|
|
13741
13778
|
this.isDayPart = this.isMonthPart = this.isYearPart = this.isHourPart = this.isMinutePart = this.isSecondsPart = true;
|
|
13742
13779
|
this.updateValue();
|
|
13743
|
-
// this.parent.inputElement.selectionStart = start;
|
|
13744
13780
|
this.validCharacterCheck();
|
|
13745
13781
|
}
|
|
13746
13782
|
setSelection(validChar) {
|
|
@@ -13765,17 +13801,18 @@ class MaskedDateTime {
|
|
|
13765
13801
|
this.isDeleteKey = true;
|
|
13766
13802
|
return;
|
|
13767
13803
|
}
|
|
13768
|
-
if ((!args.e.altKey && !args.e.ctrlKey) && (args.e.key === ARROWLEFT || args.e.key === ARROWRIGHT
|
|
13804
|
+
if ((!args.e.altKey && !args.e.ctrlKey) && (args.e.key === ARROWLEFT || args.e.key === ARROWRIGHT
|
|
13805
|
+
|| args.e.key === SHIFTTAB || args.e.key === TAB || args.e.action === SHIFTTAB ||
|
|
13769
13806
|
args.e.key === END || args.e.key === HOME)) {
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
if ((start
|
|
13774
|
-
|
|
13807
|
+
const start = this.parent.inputElement.selectionStart;
|
|
13808
|
+
const end = this.parent.inputElement.selectionEnd;
|
|
13809
|
+
const length = this.parent.inputElement.value.length;
|
|
13810
|
+
if ((start === 0 && end === length) && (args.e.key === TAB || args.e.action === SHIFTTAB)) {
|
|
13811
|
+
const index = args.e.action === SHIFTTAB ? end : 0;
|
|
13775
13812
|
this.parent.inputElement.selectionStart = this.parent.inputElement.selectionEnd = index;
|
|
13776
13813
|
}
|
|
13777
13814
|
if (args.e.key === END || args.e.key === HOME) {
|
|
13778
|
-
|
|
13815
|
+
const range = args.e.key === END ? length : 0;
|
|
13779
13816
|
this.parent.inputElement.selectionStart = this.parent.inputElement.selectionEnd = range;
|
|
13780
13817
|
}
|
|
13781
13818
|
this.navigateSelection(args.e.key === ARROWLEFT || args.e.action === SHIFTTAB || args.e.key === END ? true : false);
|
|
@@ -13787,14 +13824,14 @@ class MaskedDateTime {
|
|
|
13787
13824
|
formatText = this.hiddenMask[start];
|
|
13788
13825
|
}
|
|
13789
13826
|
this.dateAlteration(args.e.key === ARROWDOWN ? true : false);
|
|
13790
|
-
|
|
13827
|
+
const inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
13791
13828
|
this.isHiddenMask = true;
|
|
13792
13829
|
this.hiddenMask = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
13793
13830
|
this.isHiddenMask = false;
|
|
13794
13831
|
this.previousHiddenMask = this.hiddenMask;
|
|
13795
13832
|
this.previousValue = inputValue;
|
|
13796
13833
|
this.parent.inputElement.value = inputValue;
|
|
13797
|
-
for (
|
|
13834
|
+
for (let i = 0; i < this.hiddenMask.length; i++) {
|
|
13798
13835
|
if (formatText === this.hiddenMask[i]) {
|
|
13799
13836
|
start = i;
|
|
13800
13837
|
break;
|
|
@@ -13805,17 +13842,18 @@ class MaskedDateTime {
|
|
|
13805
13842
|
}
|
|
13806
13843
|
}
|
|
13807
13844
|
isPersist() {
|
|
13808
|
-
|
|
13845
|
+
const isPersist = this.parent.isFocused || this.navigated;
|
|
13809
13846
|
return isPersist;
|
|
13810
13847
|
}
|
|
13811
13848
|
differenceCheck() {
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
if (previousVal.indexOf(newVal) === 0 && (newVal.length === 0 ||
|
|
13849
|
+
const start = this.parent.inputElement.selectionStart;
|
|
13850
|
+
const inputValue = this.parent.inputElement.value;
|
|
13851
|
+
const previousVal = this.previousValue.substring(0, start + this.previousValue.length - inputValue.length);
|
|
13852
|
+
const newVal = inputValue.substring(0, start);
|
|
13853
|
+
const newDateValue = new Date(+this.maskDateValue);
|
|
13854
|
+
const maxDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
|
|
13855
|
+
if (previousVal.indexOf(newVal) === 0 && (newVal.length === 0 ||
|
|
13856
|
+
this.previousHiddenMask[newVal.length - 1] !== this.previousHiddenMask[newVal.length])) {
|
|
13819
13857
|
for (let i = newVal.length; i < previousVal.length; i++) {
|
|
13820
13858
|
if (this.previousHiddenMask[i] !== '' && this.validCharacters.indexOf(this.previousHiddenMask[i]) >= 0) {
|
|
13821
13859
|
this.isDeletion = this.handleDeletion(this.previousHiddenMask[i], false);
|
|
@@ -13827,113 +13865,122 @@ class MaskedDateTime {
|
|
|
13827
13865
|
}
|
|
13828
13866
|
switch (this.previousHiddenMask[start - 1]) {
|
|
13829
13867
|
case 'd':
|
|
13830
|
-
|
|
13831
|
-
|
|
13832
|
-
|
|
13833
|
-
|
|
13834
|
-
|
|
13835
|
-
|
|
13836
|
-
|
|
13837
|
-
for (let i = 0; date > maxDate; i++) {
|
|
13838
|
-
date = parseInt(date.toString().slice(1), 10);
|
|
13839
|
-
}
|
|
13840
|
-
if (date >= 1) {
|
|
13841
|
-
newDateValue.setDate(date);
|
|
13842
|
-
this.isNavigate = date.toString().length === 2;
|
|
13843
|
-
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
13844
|
-
if (newDateValue.getMonth() !== this.maskDateValue.getMonth()) {
|
|
13868
|
+
{
|
|
13869
|
+
let date = (this.isDayPart && newDateValue.getDate().toString().length < 2 &&
|
|
13870
|
+
!this.isPersist() ? newDateValue.getDate() * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
13871
|
+
this.isDateZero = (newVal[start - 1] === '0');
|
|
13872
|
+
this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
|
|
13873
|
+
this.navigated = this.navigated ? false : this.navigated;
|
|
13874
|
+
if (isNaN(date)) {
|
|
13845
13875
|
return;
|
|
13846
13876
|
}
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
|
|
13851
|
-
|
|
13852
|
-
|
|
13877
|
+
for (let i = 0; date > maxDate; i++) {
|
|
13878
|
+
date = parseInt(date.toString().slice(1), 10);
|
|
13879
|
+
}
|
|
13880
|
+
if (date >= 1) {
|
|
13881
|
+
newDateValue.setDate(date);
|
|
13882
|
+
this.isNavigate = date.toString().length === 2;
|
|
13883
|
+
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
13884
|
+
if (newDateValue.getMonth() !== this.maskDateValue.getMonth()) {
|
|
13885
|
+
return;
|
|
13886
|
+
}
|
|
13887
|
+
this.isDayPart = true;
|
|
13888
|
+
this.dayTypeCount = this.dayTypeCount + 1;
|
|
13889
|
+
}
|
|
13890
|
+
else {
|
|
13891
|
+
this.isDayPart = false;
|
|
13892
|
+
this.dayTypeCount = this.isDateZero ? this.dayTypeCount + 1 : this.dayTypeCount;
|
|
13893
|
+
}
|
|
13894
|
+
break;
|
|
13853
13895
|
}
|
|
13854
|
-
break;
|
|
13855
13896
|
case 'M':
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
month
|
|
13869
|
-
|
|
13870
|
-
if (month >= 1) {
|
|
13871
|
-
newDateValue.setMonth(month - 1);
|
|
13872
|
-
this.isNavigate = month.toString().length === 2;
|
|
13873
|
-
if (newDateValue.getMonth() !== month - 1) {
|
|
13874
|
-
newDateValue.setDate(1);
|
|
13875
|
-
newDateValue.setMonth(month - 1);
|
|
13897
|
+
{
|
|
13898
|
+
let month;
|
|
13899
|
+
if (newDateValue.getMonth().toString().length < 2 && !this.isPersist()) {
|
|
13900
|
+
month = (this.isMonthPart ? (newDateValue.getMonth() + 1) * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
13901
|
+
}
|
|
13902
|
+
else {
|
|
13903
|
+
month = parseInt(newVal[start - 1], 10);
|
|
13904
|
+
}
|
|
13905
|
+
this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
|
|
13906
|
+
this.navigated = this.navigated ? false : this.navigated;
|
|
13907
|
+
this.isMonthZero = (newVal[start - 1] === '0');
|
|
13908
|
+
if (!isNaN(month)) {
|
|
13909
|
+
while (month > 12) {
|
|
13910
|
+
month = parseInt(month.toString().slice(1), 10);
|
|
13876
13911
|
}
|
|
13877
|
-
if (
|
|
13878
|
-
|
|
13879
|
-
|
|
13880
|
-
if (
|
|
13881
|
-
newDateValue.setDate(
|
|
13912
|
+
if (month >= 1) {
|
|
13913
|
+
newDateValue.setMonth(month - 1);
|
|
13914
|
+
this.isNavigate = month.toString().length === 2;
|
|
13915
|
+
if (newDateValue.getMonth() !== month - 1) {
|
|
13916
|
+
newDateValue.setDate(1);
|
|
13917
|
+
newDateValue.setMonth(month - 1);
|
|
13918
|
+
}
|
|
13919
|
+
if (this.isDayPart) {
|
|
13920
|
+
const previousMaxDate = new Date(this.previousDate.getFullYear(), this.previousDate.getMonth() + 1, 0).getDate();
|
|
13921
|
+
const currentMaxDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
|
|
13922
|
+
if (this.previousDate.getDate() === previousMaxDate && currentMaxDate <= previousMaxDate) {
|
|
13923
|
+
newDateValue.setDate(currentMaxDate);
|
|
13924
|
+
}
|
|
13882
13925
|
}
|
|
13926
|
+
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
13927
|
+
this.isMonthPart = true;
|
|
13928
|
+
this.monthTypeCount = this.monthTypeCount + 1;
|
|
13929
|
+
}
|
|
13930
|
+
else {
|
|
13931
|
+
newDateValue.setMonth(0);
|
|
13932
|
+
this.isMonthPart = false;
|
|
13933
|
+
this.monthTypeCount = this.isMonthZero ? this.monthTypeCount + 1 : this.monthTypeCount;
|
|
13883
13934
|
}
|
|
13884
|
-
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
13885
|
-
this.isMonthPart = true;
|
|
13886
|
-
this.monthTypeCount = this.monthTypeCount + 1;
|
|
13887
13935
|
}
|
|
13888
13936
|
else {
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
this.
|
|
13892
|
-
|
|
13893
|
-
|
|
13894
|
-
|
|
13895
|
-
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
newDateValue.setMonth(i - 1);
|
|
13903
|
-
this.isMonthPart = true;
|
|
13904
|
-
this.maskDateValue = newDateValue;
|
|
13905
|
-
return;
|
|
13937
|
+
const monthString = (this.getCulturedValue('months[stand-alone].wide'));
|
|
13938
|
+
const monthValue = Object.keys(monthString);
|
|
13939
|
+
this.monthCharacter += newVal[start - 1].toLowerCase();
|
|
13940
|
+
while (this.monthCharacter.length > 0) {
|
|
13941
|
+
let i = 1;
|
|
13942
|
+
for (const months of monthValue) {
|
|
13943
|
+
if (monthString[i].toLowerCase().indexOf(this.monthCharacter) === 0) {
|
|
13944
|
+
newDateValue.setMonth(i - 1);
|
|
13945
|
+
this.isMonthPart = true;
|
|
13946
|
+
this.maskDateValue = newDateValue;
|
|
13947
|
+
return;
|
|
13948
|
+
}
|
|
13949
|
+
i++;
|
|
13906
13950
|
}
|
|
13907
|
-
|
|
13951
|
+
this.monthCharacter = this.monthCharacter.substring(1, this.monthCharacter.length);
|
|
13908
13952
|
}
|
|
13909
|
-
this.monthCharacter = this.monthCharacter.substring(1, this.monthCharacter.length);
|
|
13910
13953
|
}
|
|
13954
|
+
break;
|
|
13911
13955
|
}
|
|
13912
|
-
break;
|
|
13913
13956
|
case 'y':
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
year = parseInt(year.toString().slice(1), 10);
|
|
13922
|
-
}
|
|
13923
|
-
if (year < 1) {
|
|
13924
|
-
this.isYearPart = false;
|
|
13925
|
-
}
|
|
13926
|
-
else {
|
|
13927
|
-
newDateValue.setFullYear(year);
|
|
13928
|
-
if (year.toString().length === 4) {
|
|
13929
|
-
this.isNavigate = true;
|
|
13957
|
+
{
|
|
13958
|
+
let year = (this.isYearPart && (newDateValue.getFullYear().toString().length < 4
|
|
13959
|
+
&& !this.isShortYear) ? newDateValue.getFullYear() * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
13960
|
+
this.isShortYear = false;
|
|
13961
|
+
this.isYearZero = (newVal[start - 1] === '0');
|
|
13962
|
+
if (isNaN(year)) {
|
|
13963
|
+
return;
|
|
13930
13964
|
}
|
|
13931
|
-
|
|
13932
|
-
|
|
13965
|
+
while (year > 9999) {
|
|
13966
|
+
year = parseInt(year.toString().slice(1), 10);
|
|
13967
|
+
}
|
|
13968
|
+
if (year < 1) {
|
|
13969
|
+
this.isYearPart = false;
|
|
13970
|
+
}
|
|
13971
|
+
else {
|
|
13972
|
+
newDateValue.setFullYear(year);
|
|
13973
|
+
if (year.toString().length === 4) {
|
|
13974
|
+
this.isNavigate = true;
|
|
13975
|
+
}
|
|
13976
|
+
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
13977
|
+
this.isYearPart = true;
|
|
13978
|
+
}
|
|
13979
|
+
break;
|
|
13933
13980
|
}
|
|
13934
|
-
break;
|
|
13935
13981
|
case 'h':
|
|
13936
|
-
this.hour = (this.isHourPart && (newDateValue.getHours() % 12 || 12).toString().length < 2
|
|
13982
|
+
this.hour = (this.isHourPart && (newDateValue.getHours() % 12 || 12).toString().length < 2
|
|
13983
|
+
&& !this.isPersist() ? (newDateValue.getHours() % 12 || 12) * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
13937
13984
|
this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
|
|
13938
13985
|
this.navigated = this.navigated ? false : this.navigated;
|
|
13939
13986
|
if (isNaN(this.hour)) {
|
|
@@ -13948,7 +13995,8 @@ class MaskedDateTime {
|
|
|
13948
13995
|
this.hourTypeCount = this.hourTypeCount + 1;
|
|
13949
13996
|
break;
|
|
13950
13997
|
case 'H':
|
|
13951
|
-
this.hour = (this.isHourPart && newDateValue.getHours().toString().length < 2 &&
|
|
13998
|
+
this.hour = (this.isHourPart && newDateValue.getHours().toString().length < 2 &&
|
|
13999
|
+
!this.isPersist() ? newDateValue.getHours() * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
13952
14000
|
this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
|
|
13953
14001
|
this.navigated = this.navigated ? false : this.navigated;
|
|
13954
14002
|
if (isNaN(this.hour)) {
|
|
@@ -13963,69 +14011,83 @@ class MaskedDateTime {
|
|
|
13963
14011
|
this.hourTypeCount = this.hourTypeCount + 1;
|
|
13964
14012
|
break;
|
|
13965
14013
|
case 'm':
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
14014
|
+
{
|
|
14015
|
+
let minutes = (this.isMinutePart && newDateValue.getMinutes().toString().length < 2
|
|
14016
|
+
&& !this.isPersist() ? newDateValue.getMinutes() * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
14017
|
+
this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
|
|
14018
|
+
this.navigated = this.navigated ? false : this.navigated;
|
|
14019
|
+
if (isNaN(minutes)) {
|
|
14020
|
+
return;
|
|
14021
|
+
}
|
|
14022
|
+
for (let i = 0; minutes > 59; i++) {
|
|
14023
|
+
minutes = parseInt(minutes.toString().slice(1), 10);
|
|
14024
|
+
}
|
|
14025
|
+
newDateValue.setMinutes(minutes);
|
|
14026
|
+
this.isNavigate = minutes.toString().length === 2;
|
|
14027
|
+
this.isMinutePart = true;
|
|
14028
|
+
this.minuteTypeCount = this.minuteTypeCount + 1;
|
|
14029
|
+
break;
|
|
13974
14030
|
}
|
|
13975
|
-
newDateValue.setMinutes(minutes);
|
|
13976
|
-
this.isNavigate = minutes.toString().length === 2;
|
|
13977
|
-
this.isMinutePart = true;
|
|
13978
|
-
this.minuteTypeCount = this.minuteTypeCount + 1;
|
|
13979
|
-
break;
|
|
13980
14031
|
case 's':
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
14032
|
+
{
|
|
14033
|
+
let seconds = (this.isSecondsPart && newDateValue.getSeconds().toString().length < 2 &&
|
|
14034
|
+
!this.isPersist() ? newDateValue.getSeconds() * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
14035
|
+
this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
|
|
14036
|
+
this.navigated = this.navigated ? false : this.navigated;
|
|
14037
|
+
if (isNaN(seconds)) {
|
|
14038
|
+
return;
|
|
14039
|
+
}
|
|
14040
|
+
for (let i = 0; seconds > 59; i++) {
|
|
14041
|
+
seconds = parseInt(seconds.toString().slice(1), 10);
|
|
14042
|
+
}
|
|
14043
|
+
newDateValue.setSeconds(seconds);
|
|
14044
|
+
this.isNavigate = seconds.toString().length === 2;
|
|
14045
|
+
this.isSecondsPart = true;
|
|
14046
|
+
this.secondTypeCount = this.secondTypeCount + 1;
|
|
14047
|
+
break;
|
|
13989
14048
|
}
|
|
13990
|
-
newDateValue.setSeconds(seconds);
|
|
13991
|
-
this.isNavigate = seconds.toString().length === 2;
|
|
13992
|
-
this.isSecondsPart = true;
|
|
13993
|
-
this.secondTypeCount = this.secondTypeCount + 1;
|
|
13994
|
-
break;
|
|
13995
14049
|
case 'a':
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14050
|
+
{
|
|
14051
|
+
this.periodCharacter += newVal[start - 1].toLowerCase();
|
|
14052
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14053
|
+
const periodString = (this.getCulturedValue('dayPeriods.format.wide'));
|
|
14054
|
+
const periodkeys = Object.keys(periodString);
|
|
14055
|
+
for (let i = 0; this.periodCharacter.length > 0; i++) {
|
|
14056
|
+
if ((periodString[periodkeys[0]].toLowerCase().indexOf(this.periodCharacter) === 0
|
|
14057
|
+
&& newDateValue.getHours() >= 12) || (periodString[periodkeys[1]].toLowerCase().
|
|
14058
|
+
indexOf(this.periodCharacter) === 0 && newDateValue.getHours() < 12)) {
|
|
14059
|
+
newDateValue.setHours((newDateValue.getHours() + 12) % 24);
|
|
14060
|
+
this.maskDateValue = newDateValue;
|
|
14061
|
+
}
|
|
14062
|
+
this.periodCharacter = this.periodCharacter.substring(1, this.periodCharacter.length);
|
|
14063
|
+
}
|
|
14064
|
+
break;
|
|
14008
14065
|
}
|
|
14009
|
-
break;
|
|
14010
14066
|
default:
|
|
14011
14067
|
break;
|
|
14012
14068
|
}
|
|
14013
14069
|
this.maskDateValue = newDateValue;
|
|
14014
14070
|
}
|
|
14071
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14015
14072
|
formatCheck() {
|
|
14073
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
14016
14074
|
const proxy = this;
|
|
14017
14075
|
function formatValueSpecifier(formattext) {
|
|
14018
14076
|
let result;
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14077
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14078
|
+
const daysAbbreviated = proxy.getCulturedValue('days[stand-alone].abbreviated');
|
|
14079
|
+
const dayKeyAbbreviated = Object.keys(daysAbbreviated);
|
|
14080
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14081
|
+
const daysWide = (proxy.getCulturedValue('days[stand-alone].wide'));
|
|
14082
|
+
const dayKeyWide = Object.keys(daysWide);
|
|
14083
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14084
|
+
const daysNarrow = (proxy.getCulturedValue('days[stand-alone].narrow'));
|
|
14085
|
+
const dayKeyNarrow = Object.keys(daysNarrow);
|
|
14086
|
+
const monthAbbreviated = (proxy.getCulturedValue('months[stand-alone].abbreviated'));
|
|
14087
|
+
const monthWide = (proxy.getCulturedValue('months[stand-alone].wide'));
|
|
14088
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14089
|
+
const periodString = (proxy.getCulturedValue('dayPeriods.format.wide'));
|
|
14090
|
+
const periodkeys = Object.keys(periodString);
|
|
14029
14091
|
let milliseconds;
|
|
14030
14092
|
let dateOptions;
|
|
14031
14093
|
switch (formattext) {
|
|
@@ -14034,7 +14096,7 @@ class MaskedDateTime {
|
|
|
14034
14096
|
case 'd':
|
|
14035
14097
|
result = proxy.isDayPart ? proxy.maskDateValue.getDate().toString() : proxy.defaultConstant['day'].toString();
|
|
14036
14098
|
result = proxy.zeroCheck(proxy.isDateZero, proxy.isDayPart, result);
|
|
14037
|
-
if (proxy.dayTypeCount
|
|
14099
|
+
if (proxy.dayTypeCount === 2) {
|
|
14038
14100
|
proxy.isNavigate = true;
|
|
14039
14101
|
proxy.dayTypeCount = 0;
|
|
14040
14102
|
}
|
|
@@ -14042,7 +14104,7 @@ class MaskedDateTime {
|
|
|
14042
14104
|
case 'dd':
|
|
14043
14105
|
result = proxy.isDayPart ? proxy.roundOff(proxy.maskDateValue.getDate(), 2) : proxy.defaultConstant['day'].toString();
|
|
14044
14106
|
result = proxy.zeroCheck(proxy.isDateZero, proxy.isDayPart, result);
|
|
14045
|
-
if (proxy.dayTypeCount
|
|
14107
|
+
if (proxy.dayTypeCount === 2) {
|
|
14046
14108
|
proxy.isNavigate = true;
|
|
14047
14109
|
proxy.dayTypeCount = 0;
|
|
14048
14110
|
}
|
|
@@ -14061,7 +14123,7 @@ class MaskedDateTime {
|
|
|
14061
14123
|
case 'M':
|
|
14062
14124
|
result = proxy.isMonthPart ? (proxy.maskDateValue.getMonth() + 1).toString() : proxy.defaultConstant['month'].toString();
|
|
14063
14125
|
result = proxy.zeroCheck(proxy.isMonthZero, proxy.isMonthPart, result);
|
|
14064
|
-
if (proxy.monthTypeCount
|
|
14126
|
+
if (proxy.monthTypeCount === 2) {
|
|
14065
14127
|
proxy.isNavigate = true;
|
|
14066
14128
|
proxy.monthTypeCount = 0;
|
|
14067
14129
|
}
|
|
@@ -14069,7 +14131,7 @@ class MaskedDateTime {
|
|
|
14069
14131
|
case 'MM':
|
|
14070
14132
|
result = proxy.isMonthPart ? proxy.roundOff(proxy.maskDateValue.getMonth() + 1, 2) : proxy.defaultConstant['month'].toString();
|
|
14071
14133
|
result = proxy.zeroCheck(proxy.isMonthZero, proxy.isMonthPart, result);
|
|
14072
|
-
if (proxy.monthTypeCount
|
|
14134
|
+
if (proxy.monthTypeCount === 2) {
|
|
14073
14135
|
proxy.isNavigate = true;
|
|
14074
14136
|
proxy.monthTypeCount = 0;
|
|
14075
14137
|
}
|
|
@@ -14094,56 +14156,56 @@ class MaskedDateTime {
|
|
|
14094
14156
|
break;
|
|
14095
14157
|
case 'h':
|
|
14096
14158
|
result = proxy.isHourPart ? (proxy.maskDateValue.getHours() % 12 || 12).toString() : proxy.defaultConstant['hour'].toString();
|
|
14097
|
-
if (proxy.hourTypeCount
|
|
14159
|
+
if (proxy.hourTypeCount === 2) {
|
|
14098
14160
|
proxy.isNavigate = true;
|
|
14099
14161
|
proxy.hourTypeCount = 0;
|
|
14100
14162
|
}
|
|
14101
14163
|
break;
|
|
14102
14164
|
case 'hh':
|
|
14103
14165
|
result = proxy.isHourPart ? proxy.roundOff(proxy.maskDateValue.getHours() % 12 || 12, 2) : proxy.defaultConstant['hour'].toString();
|
|
14104
|
-
if (proxy.hourTypeCount
|
|
14166
|
+
if (proxy.hourTypeCount === 2) {
|
|
14105
14167
|
proxy.isNavigate = true;
|
|
14106
14168
|
proxy.hourTypeCount = 0;
|
|
14107
14169
|
}
|
|
14108
14170
|
break;
|
|
14109
14171
|
case 'H':
|
|
14110
14172
|
result = proxy.isHourPart ? proxy.maskDateValue.getHours().toString() : proxy.defaultConstant['hour'].toString();
|
|
14111
|
-
if (proxy.hourTypeCount
|
|
14173
|
+
if (proxy.hourTypeCount === 2) {
|
|
14112
14174
|
proxy.isNavigate = true;
|
|
14113
14175
|
proxy.hourTypeCount = 0;
|
|
14114
14176
|
}
|
|
14115
14177
|
break;
|
|
14116
14178
|
case 'HH':
|
|
14117
14179
|
result = proxy.isHourPart ? proxy.roundOff(proxy.maskDateValue.getHours(), 2) : proxy.defaultConstant['hour'].toString();
|
|
14118
|
-
if (proxy.hourTypeCount
|
|
14180
|
+
if (proxy.hourTypeCount === 2) {
|
|
14119
14181
|
proxy.isNavigate = true;
|
|
14120
14182
|
proxy.hourTypeCount = 0;
|
|
14121
14183
|
}
|
|
14122
14184
|
break;
|
|
14123
14185
|
case 'm':
|
|
14124
14186
|
result = proxy.isMinutePart ? proxy.maskDateValue.getMinutes().toString() : proxy.defaultConstant['minute'].toString();
|
|
14125
|
-
if (proxy.minuteTypeCount
|
|
14187
|
+
if (proxy.minuteTypeCount === 2) {
|
|
14126
14188
|
proxy.isNavigate = true;
|
|
14127
14189
|
proxy.minuteTypeCount = 0;
|
|
14128
14190
|
}
|
|
14129
14191
|
break;
|
|
14130
14192
|
case 'mm':
|
|
14131
14193
|
result = proxy.isMinutePart ? proxy.roundOff(proxy.maskDateValue.getMinutes(), 2) : proxy.defaultConstant['minute'].toString();
|
|
14132
|
-
if (proxy.minuteTypeCount
|
|
14194
|
+
if (proxy.minuteTypeCount === 2) {
|
|
14133
14195
|
proxy.isNavigate = true;
|
|
14134
14196
|
proxy.minuteTypeCount = 0;
|
|
14135
14197
|
}
|
|
14136
14198
|
break;
|
|
14137
14199
|
case 's':
|
|
14138
14200
|
result = proxy.isSecondsPart ? proxy.maskDateValue.getSeconds().toString() : proxy.defaultConstant['second'].toString();
|
|
14139
|
-
if (proxy.secondTypeCount
|
|
14201
|
+
if (proxy.secondTypeCount === 2) {
|
|
14140
14202
|
proxy.isNavigate = true;
|
|
14141
14203
|
proxy.secondTypeCount = 0;
|
|
14142
14204
|
}
|
|
14143
14205
|
break;
|
|
14144
14206
|
case 'ss':
|
|
14145
14207
|
result = proxy.isSecondsPart ? proxy.roundOff(proxy.maskDateValue.getSeconds(), 2) : proxy.defaultConstant['second'].toString();
|
|
14146
|
-
if (proxy.secondTypeCount
|
|
14208
|
+
if (proxy.secondTypeCount === 2) {
|
|
14147
14209
|
proxy.isNavigate = true;
|
|
14148
14210
|
proxy.secondTypeCount = 0;
|
|
14149
14211
|
}
|
|
@@ -14192,14 +14254,12 @@ class MaskedDateTime {
|
|
|
14192
14254
|
}
|
|
14193
14255
|
maskInputHandler() {
|
|
14194
14256
|
let start = this.parent.inputElement.selectionStart;
|
|
14195
|
-
let selectionChar = this.previousHiddenMask[start - 1];
|
|
14196
14257
|
let formatText = '';
|
|
14197
14258
|
if (this.validCharacters.indexOf(this.hiddenMask[start]) !== -1) {
|
|
14198
14259
|
formatText = this.hiddenMask[start];
|
|
14199
14260
|
}
|
|
14200
|
-
let inputValue;
|
|
14201
14261
|
this.differenceCheck();
|
|
14202
|
-
inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
14262
|
+
const inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
14203
14263
|
this.isHiddenMask = true;
|
|
14204
14264
|
this.hiddenMask = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
14205
14265
|
this.isDateZero = this.isMonthZero = this.isYearZero = false;
|
|
@@ -14208,7 +14268,7 @@ class MaskedDateTime {
|
|
|
14208
14268
|
this.previousValue = inputValue;
|
|
14209
14269
|
this.parent.inputElement.value = inputValue;
|
|
14210
14270
|
this.parent.inputElement.value = inputValue;
|
|
14211
|
-
for (
|
|
14271
|
+
for (let i = 0; i < this.hiddenMask.length; i++) {
|
|
14212
14272
|
if (formatText === this.hiddenMask[i]) {
|
|
14213
14273
|
start = i;
|
|
14214
14274
|
break;
|
|
@@ -14217,7 +14277,7 @@ class MaskedDateTime {
|
|
|
14217
14277
|
this.parent.inputElement.selectionStart = start;
|
|
14218
14278
|
this.validCharacterCheck();
|
|
14219
14279
|
if ((this.isNavigate || this.isDeletion) && !this.isDeleteKey) {
|
|
14220
|
-
|
|
14280
|
+
const isbackward = this.isNavigate ? false : true;
|
|
14221
14281
|
this.isNavigate = this.isDeletion = false;
|
|
14222
14282
|
this.navigateSelection(isbackward);
|
|
14223
14283
|
}
|
|
@@ -14225,12 +14285,10 @@ class MaskedDateTime {
|
|
|
14225
14285
|
this.isDeletion = false;
|
|
14226
14286
|
}
|
|
14227
14287
|
this.isDeleteKey = false;
|
|
14228
|
-
// this.setSelection(selectionChar);
|
|
14229
|
-
// this.navigateSelection(inputValue);
|
|
14230
14288
|
}
|
|
14231
14289
|
navigateSelection(isbackward) {
|
|
14232
|
-
|
|
14233
|
-
|
|
14290
|
+
const start = this.parent.inputElement.selectionStart;
|
|
14291
|
+
const end = this.parent.inputElement.selectionEnd;
|
|
14234
14292
|
let formatIndex = isbackward ? start - 1 : end + 1;
|
|
14235
14293
|
this.navigated = true;
|
|
14236
14294
|
while (formatIndex < this.hiddenMask.length && formatIndex >= 0) {
|
|
@@ -14242,8 +14300,8 @@ class MaskedDateTime {
|
|
|
14242
14300
|
}
|
|
14243
14301
|
}
|
|
14244
14302
|
roundOff(val, count) {
|
|
14245
|
-
|
|
14246
|
-
|
|
14303
|
+
const valueText = val.toString();
|
|
14304
|
+
const length = count - valueText.length;
|
|
14247
14305
|
let result = '';
|
|
14248
14306
|
for (let i = 0; i < length; i++) {
|
|
14249
14307
|
result += '0';
|
|
@@ -14291,7 +14349,7 @@ class MaskedDateTime {
|
|
|
14291
14349
|
return true;
|
|
14292
14350
|
}
|
|
14293
14351
|
dateAlteration(isDecrement) {
|
|
14294
|
-
|
|
14352
|
+
const start = this.parent.inputElement.selectionStart;
|
|
14295
14353
|
let formatText = '';
|
|
14296
14354
|
if (this.validCharacters.indexOf(this.hiddenMask[start]) !== -1) {
|
|
14297
14355
|
formatText = this.hiddenMask[start];
|
|
@@ -14299,32 +14357,34 @@ class MaskedDateTime {
|
|
|
14299
14357
|
else {
|
|
14300
14358
|
return;
|
|
14301
14359
|
}
|
|
14302
|
-
|
|
14360
|
+
const newDateValue = new Date(this.maskDateValue.getFullYear(), this.maskDateValue.getMonth(), this.maskDateValue.getDate(), this.maskDateValue.getHours(), this.maskDateValue.getMinutes(), this.maskDateValue.getSeconds());
|
|
14303
14361
|
this.previousDate = new Date(this.maskDateValue.getFullYear(), this.maskDateValue.getMonth(), this.maskDateValue.getDate(), this.maskDateValue.getHours(), this.maskDateValue.getMinutes(), this.maskDateValue.getSeconds());
|
|
14304
|
-
|
|
14362
|
+
const incrementValue = isDecrement ? -1 : 1;
|
|
14305
14363
|
switch (formatText) {
|
|
14306
14364
|
case 'd':
|
|
14307
14365
|
newDateValue.setDate(newDateValue.getDate() + incrementValue);
|
|
14308
14366
|
break;
|
|
14309
14367
|
case 'M':
|
|
14310
|
-
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
|
|
14314
|
-
|
|
14315
|
-
|
|
14316
|
-
|
|
14317
|
-
|
|
14368
|
+
{
|
|
14369
|
+
const newMonth = newDateValue.getMonth() + incrementValue;
|
|
14370
|
+
newDateValue.setDate(1);
|
|
14371
|
+
newDateValue.setMonth(newMonth);
|
|
14372
|
+
if (this.isDayPart) {
|
|
14373
|
+
const previousMaxDate = new Date(this.previousDate.getFullYear(), this.previousDate.getMonth() + 1, 0).getDate();
|
|
14374
|
+
const currentMaxDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
|
|
14375
|
+
if (this.previousDate.getDate() === previousMaxDate && currentMaxDate <= previousMaxDate) {
|
|
14376
|
+
newDateValue.setDate(currentMaxDate);
|
|
14377
|
+
}
|
|
14378
|
+
else {
|
|
14379
|
+
newDateValue.setDate(this.previousDate.getDate());
|
|
14380
|
+
}
|
|
14318
14381
|
}
|
|
14319
14382
|
else {
|
|
14320
14383
|
newDateValue.setDate(this.previousDate.getDate());
|
|
14321
14384
|
}
|
|
14385
|
+
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
14386
|
+
break;
|
|
14322
14387
|
}
|
|
14323
|
-
else {
|
|
14324
|
-
newDateValue.setDate(this.previousDate.getDate());
|
|
14325
|
-
}
|
|
14326
|
-
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
14327
|
-
break;
|
|
14328
14388
|
case 'y':
|
|
14329
14389
|
newDateValue.setFullYear(newDateValue.getFullYear() + incrementValue);
|
|
14330
14390
|
break;
|
|
@@ -14350,7 +14410,7 @@ class MaskedDateTime {
|
|
|
14350
14410
|
}
|
|
14351
14411
|
}
|
|
14352
14412
|
getCulturedValue(format) {
|
|
14353
|
-
|
|
14413
|
+
const locale = this.parent.locale;
|
|
14354
14414
|
let result;
|
|
14355
14415
|
if (locale === 'en' || locale === 'en-US') {
|
|
14356
14416
|
result = getValue(format, getDefaultDateObject());
|
|
@@ -14362,19 +14422,19 @@ class MaskedDateTime {
|
|
|
14362
14422
|
}
|
|
14363
14423
|
getCulturedFormat() {
|
|
14364
14424
|
let formatString = (this.getCulturedValue('dateTimeFormats[availableFormats].yMd')).toString();
|
|
14365
|
-
if (this.parent.moduleName
|
|
14425
|
+
if (this.parent.moduleName === 'datepicker') {
|
|
14366
14426
|
formatString = (this.getCulturedValue('dateTimeFormats[availableFormats].yMd')).toString();
|
|
14367
14427
|
if (this.parent.format && this.parent.formatString) {
|
|
14368
14428
|
formatString = this.parent.formatString;
|
|
14369
14429
|
}
|
|
14370
14430
|
}
|
|
14371
|
-
if (this.parent.moduleName
|
|
14431
|
+
if (this.parent.moduleName === 'datetimepicker') {
|
|
14372
14432
|
formatString = (this.getCulturedValue('dateTimeFormats[availableFormats].yMd')).toString();
|
|
14373
14433
|
if (this.parent.dateTimeFormat) {
|
|
14374
14434
|
formatString = this.parent.dateTimeFormat;
|
|
14375
14435
|
}
|
|
14376
14436
|
}
|
|
14377
|
-
if (this.parent.moduleName
|
|
14437
|
+
if (this.parent.moduleName === 'timepicker') {
|
|
14378
14438
|
formatString = this.parent.cldrTimeFormat();
|
|
14379
14439
|
}
|
|
14380
14440
|
return formatString;
|
|
@@ -14385,14 +14445,13 @@ class MaskedDateTime {
|
|
|
14385
14445
|
}
|
|
14386
14446
|
updateValue() {
|
|
14387
14447
|
this.monthCharacter = this.periodCharacter = '';
|
|
14388
|
-
|
|
14448
|
+
const inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
14389
14449
|
this.isHiddenMask = true;
|
|
14390
14450
|
this.hiddenMask = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
14391
14451
|
this.isHiddenMask = false;
|
|
14392
14452
|
this.previousHiddenMask = this.hiddenMask;
|
|
14393
14453
|
this.previousValue = inputValue;
|
|
14394
14454
|
this.parent.updateInputValue(inputValue);
|
|
14395
|
-
//this.parent.inputElement.value = inputValue;
|
|
14396
14455
|
}
|
|
14397
14456
|
destroy() {
|
|
14398
14457
|
this.removeEventListener();
|