@syncfusion/ej2-calendars 20.4.54 → 21.1.37
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 +7 -7
- 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 +437 -374
- package/dist/es6/ej2-calendars.es2015.js.map +1 -1
- package/dist/es6/ej2-calendars.es5.js +392 -329
- 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 +67 -58
- 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
|
}
|
|
@@ -3162,7 +3179,6 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3162
3179
|
*/
|
|
3163
3180
|
constructor(options, element) {
|
|
3164
3181
|
super(options, element);
|
|
3165
|
-
this.previousElementValue = '';
|
|
3166
3182
|
this.isDateIconClicked = false;
|
|
3167
3183
|
this.isAltKeyPressed = false;
|
|
3168
3184
|
this.isInteracted = true;
|
|
@@ -3190,7 +3206,7 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3190
3206
|
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && !isNullOrUndefined(this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0]) && this.floatLabelType !== 'Never') {
|
|
3191
3207
|
this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
3192
3208
|
}
|
|
3193
|
-
if (!isNullOrUndefined(closest(this.element,
|
|
3209
|
+
if (!isNullOrUndefined(closest(this.element, 'fieldset')) && closest(this.element, 'fieldset').disabled) {
|
|
3194
3210
|
this.enabled = false;
|
|
3195
3211
|
}
|
|
3196
3212
|
this.renderComplete();
|
|
@@ -3238,15 +3254,15 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3238
3254
|
initialize() {
|
|
3239
3255
|
this.checkInvalidValue(this.value);
|
|
3240
3256
|
if (this.enableMask) {
|
|
3241
|
-
this.notify(
|
|
3242
|
-
module:
|
|
3257
|
+
this.notify('createMask', {
|
|
3258
|
+
module: 'MaskedDateTime'
|
|
3243
3259
|
});
|
|
3244
3260
|
}
|
|
3245
3261
|
this.createInput();
|
|
3246
3262
|
this.updateHtmlAttributeToWrapper();
|
|
3247
3263
|
this.setAllowEdit();
|
|
3248
3264
|
this.updateInput(true);
|
|
3249
|
-
if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType
|
|
3265
|
+
if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType === 'Always' || !this.floatLabelType || !this.placeholder)) {
|
|
3250
3266
|
this.updateInputValue(this.maskedDateValue);
|
|
3251
3267
|
}
|
|
3252
3268
|
this.previousElementValue = this.inputElement.value;
|
|
@@ -3270,7 +3286,7 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3270
3286
|
if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
|
|
3271
3287
|
updatedCssClassValues = (this.cssClass.replace(/\s+/g, ' ')).trim();
|
|
3272
3288
|
}
|
|
3273
|
-
|
|
3289
|
+
const isBindClearAction = this.enableMask ? false : true;
|
|
3274
3290
|
this.inputWrapper = Input.createInput({
|
|
3275
3291
|
element: this.inputElement,
|
|
3276
3292
|
floatLabelType: this.floatLabelType,
|
|
@@ -3359,8 +3375,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3359
3375
|
}
|
|
3360
3376
|
else {
|
|
3361
3377
|
this.updateInputValue(this.maskedDateValue);
|
|
3362
|
-
this.notify(
|
|
3363
|
-
module:
|
|
3378
|
+
this.notify('createMask', {
|
|
3379
|
+
module: 'MaskedDateTime'
|
|
3364
3380
|
});
|
|
3365
3381
|
}
|
|
3366
3382
|
}
|
|
@@ -3526,8 +3542,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3526
3542
|
if (e.code !== 'Delete') {
|
|
3527
3543
|
e.preventDefault();
|
|
3528
3544
|
}
|
|
3529
|
-
this.notify(
|
|
3530
|
-
module:
|
|
3545
|
+
this.notify('keyDownHandler', {
|
|
3546
|
+
module: 'MaskedDateTime',
|
|
3531
3547
|
e: e
|
|
3532
3548
|
});
|
|
3533
3549
|
}
|
|
@@ -3602,8 +3618,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3602
3618
|
mouseUpHandler(e) {
|
|
3603
3619
|
if (this.enableMask) {
|
|
3604
3620
|
e.preventDefault();
|
|
3605
|
-
this.notify(
|
|
3606
|
-
module:
|
|
3621
|
+
this.notify('setMaskSelection', {
|
|
3622
|
+
module: 'MaskedDateTime'
|
|
3607
3623
|
});
|
|
3608
3624
|
}
|
|
3609
3625
|
}
|
|
@@ -3621,13 +3637,13 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3621
3637
|
this.popupUpdate();
|
|
3622
3638
|
this.changeEvent(event);
|
|
3623
3639
|
if (this.enableMask) {
|
|
3624
|
-
this.notify(
|
|
3625
|
-
module:
|
|
3640
|
+
this.notify('clearHandler', {
|
|
3641
|
+
module: 'MaskedDateTime'
|
|
3626
3642
|
});
|
|
3627
3643
|
}
|
|
3628
3644
|
if (closest(this.element, 'form')) {
|
|
3629
|
-
|
|
3630
|
-
|
|
3645
|
+
const element = this.element;
|
|
3646
|
+
const keyupEvent = document.createEvent('KeyboardEvent');
|
|
3631
3647
|
keyupEvent.initEvent('keyup', false, true);
|
|
3632
3648
|
element.dispatchEvent(keyupEvent);
|
|
3633
3649
|
}
|
|
@@ -3755,7 +3771,7 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3755
3771
|
return;
|
|
3756
3772
|
}
|
|
3757
3773
|
if (this.enableMask && !this.inputElement.value && this.placeholder) {
|
|
3758
|
-
if (this.maskedDateValue && !this.value && (this.floatLabelType
|
|
3774
|
+
if (this.maskedDateValue && !this.value && (this.floatLabelType === 'Auto' || this.floatLabelType === 'Never' || this.placeholder)) {
|
|
3759
3775
|
this.updateInputValue(this.maskedDateValue);
|
|
3760
3776
|
this.inputElement.selectionStart = 0;
|
|
3761
3777
|
this.inputElement.selectionEnd = this.inputElement.value.length;
|
|
@@ -3774,8 +3790,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3774
3790
|
inputHandler() {
|
|
3775
3791
|
this.isPopupClicked = false;
|
|
3776
3792
|
if (this.enableMask) {
|
|
3777
|
-
this.notify(
|
|
3778
|
-
module:
|
|
3793
|
+
this.notify('inputHandler', {
|
|
3794
|
+
module: 'MaskedDateTime'
|
|
3779
3795
|
});
|
|
3780
3796
|
}
|
|
3781
3797
|
}
|
|
@@ -3792,7 +3808,7 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3792
3808
|
this.popupUpdate();
|
|
3793
3809
|
this.changeTrigger(e);
|
|
3794
3810
|
if (this.enableMask && this.maskedDateValue && this.placeholder && this.floatLabelType !== 'Always') {
|
|
3795
|
-
if (this.inputElement.value
|
|
3811
|
+
if (this.inputElement.value === this.maskedDateValue && !this.value && (this.floatLabelType === 'Auto' || this.floatLabelType === 'Never' || this.placeholder)) {
|
|
3796
3812
|
this.updateInputValue('');
|
|
3797
3813
|
}
|
|
3798
3814
|
}
|
|
@@ -3881,31 +3897,33 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
3881
3897
|
break;
|
|
3882
3898
|
case 'tab':
|
|
3883
3899
|
case 'shiftTab':
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
e.
|
|
3900
|
+
{
|
|
3901
|
+
let start = this.inputElement.selectionStart;
|
|
3902
|
+
let end = this.inputElement.selectionEnd;
|
|
3903
|
+
if (this.enableMask && !this.popupObj && !this.readonly) {
|
|
3904
|
+
const length = this.inputElement.value.length;
|
|
3905
|
+
if ((start === 0 && end === length) || (end !== length && e.action === 'tab') || (start !== 0 && e.action === 'shiftTab')) {
|
|
3906
|
+
e.preventDefault();
|
|
3907
|
+
}
|
|
3908
|
+
this.notify('keyDownHandler', {
|
|
3909
|
+
module: 'MaskedDateTime',
|
|
3910
|
+
e: e
|
|
3911
|
+
});
|
|
3912
|
+
start = this.inputElement.selectionStart;
|
|
3913
|
+
end = this.inputElement.selectionEnd;
|
|
3890
3914
|
}
|
|
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;
|
|
3915
|
+
this.strictModeUpdate();
|
|
3916
|
+
this.updateInput();
|
|
3917
|
+
this.popupUpdate();
|
|
3918
|
+
this.changeTrigger(e);
|
|
3919
|
+
this.errorClass();
|
|
3920
|
+
if (this.enableMask) {
|
|
3921
|
+
this.inputElement.selectionStart = start;
|
|
3922
|
+
this.inputElement.selectionEnd = end;
|
|
3923
|
+
}
|
|
3924
|
+
this.hide(e);
|
|
3925
|
+
break;
|
|
3906
3926
|
}
|
|
3907
|
-
this.hide(e);
|
|
3908
|
-
break;
|
|
3909
3927
|
default:
|
|
3910
3928
|
this.defaultAction(e);
|
|
3911
3929
|
// Fix for close the popup when select the previously selected value.
|
|
@@ -4200,7 +4218,6 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4200
4218
|
}
|
|
4201
4219
|
return modules;
|
|
4202
4220
|
}
|
|
4203
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4204
4221
|
selectCalendar(e) {
|
|
4205
4222
|
let date;
|
|
4206
4223
|
let tempFormat;
|
|
@@ -4231,16 +4248,16 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4231
4248
|
date = this.globalize.formatDate(this.changedArgs.value, formatOptions);
|
|
4232
4249
|
}
|
|
4233
4250
|
if (this.enableMask) {
|
|
4234
|
-
this.notify(
|
|
4235
|
-
module:
|
|
4251
|
+
this.notify('createMask', {
|
|
4252
|
+
module: 'MaskedDateTime'
|
|
4236
4253
|
});
|
|
4237
4254
|
}
|
|
4238
4255
|
}
|
|
4239
4256
|
if (!isNullOrUndefined(date)) {
|
|
4240
4257
|
this.updateInputValue(date);
|
|
4241
4258
|
if (this.enableMask) {
|
|
4242
|
-
this.notify(
|
|
4243
|
-
module:
|
|
4259
|
+
this.notify('setMaskSelection', {
|
|
4260
|
+
module: 'MaskedDateTime'
|
|
4244
4261
|
});
|
|
4245
4262
|
}
|
|
4246
4263
|
}
|
|
@@ -4276,7 +4293,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4276
4293
|
else {
|
|
4277
4294
|
let prevent = true;
|
|
4278
4295
|
let outOfRange;
|
|
4279
|
-
if (!isNullOrUndefined(this.value) && !(+this.value >= +new Date(this.checkValue(this.min))
|
|
4296
|
+
if (!isNullOrUndefined(this.value) && !(+this.value >= +new Date(this.checkValue(this.min))
|
|
4297
|
+
&& +this.value <= +new Date(this.checkValue(this.max)))) {
|
|
4280
4298
|
outOfRange = new Date(this.checkValue(this.value));
|
|
4281
4299
|
this.setProperties({ 'value': null }, true);
|
|
4282
4300
|
}
|
|
@@ -4794,8 +4812,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4794
4812
|
this.updateInputValue(inputVal);
|
|
4795
4813
|
if (this.enableMask) {
|
|
4796
4814
|
this.updateInputValue(this.maskedDateValue);
|
|
4797
|
-
this.notify(
|
|
4798
|
-
module:
|
|
4815
|
+
this.notify('createMask', {
|
|
4816
|
+
module: 'MaskedDateTime'
|
|
4799
4817
|
});
|
|
4800
4818
|
}
|
|
4801
4819
|
}
|
|
@@ -4819,7 +4837,10 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4819
4837
|
const isDisabledDate = this.calendarElement &&
|
|
4820
4838
|
this.calendarElement.querySelectorAll(dateIdString)[0] &&
|
|
4821
4839
|
this.calendarElement.querySelectorAll(dateIdString)[0].classList.contains('e-disabled');
|
|
4822
|
-
if ((!isNullOrUndefined(this.value) && !isNullOrUndefined(this.min) &&
|
|
4840
|
+
if ((!isNullOrUndefined(this.value) && !isNullOrUndefined(this.min) &&
|
|
4841
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4842
|
+
!isNullOrUndefined(this.max) && !(new Date(this.value).setMilliseconds(0) >= new Date(this.min).setMilliseconds(0)
|
|
4843
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4823
4844
|
&& new Date(this.value).setMilliseconds(0) <= new Date(this.max).setMilliseconds(0)))
|
|
4824
4845
|
|| (!this.strictMode && this.inputElement.value !== '' && this.inputElement.value !== this.maskedDateValue && isNullOrUndefined(this.value) || isDisabledDate)) {
|
|
4825
4846
|
addClass([this.inputWrapper.container], ERROR);
|
|
@@ -4849,7 +4870,12 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4849
4870
|
newProp.value = this.value;
|
|
4850
4871
|
this.previousElementValue = this.inputElement.value;
|
|
4851
4872
|
if (isNullOrUndefined(this.value)) {
|
|
4852
|
-
this.
|
|
4873
|
+
if (this.enableMask) {
|
|
4874
|
+
this.updateInputValue(this.maskedDateValue);
|
|
4875
|
+
}
|
|
4876
|
+
else {
|
|
4877
|
+
this.updateInputValue('');
|
|
4878
|
+
}
|
|
4853
4879
|
this.currentDate = new Date(new Date().setHours(0, 0, 0, 0));
|
|
4854
4880
|
}
|
|
4855
4881
|
this.updateInput(true);
|
|
@@ -4859,8 +4885,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4859
4885
|
this.isInteracted = true;
|
|
4860
4886
|
this.preventChange = this.isAngular && this.preventChange ? !this.preventChange : this.preventChange;
|
|
4861
4887
|
if (this.enableMask) {
|
|
4862
|
-
this.notify(
|
|
4863
|
-
module:
|
|
4888
|
+
this.notify('createMask', {
|
|
4889
|
+
module: 'MaskedDateTime'
|
|
4864
4890
|
});
|
|
4865
4891
|
}
|
|
4866
4892
|
break;
|
|
@@ -4869,8 +4895,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4869
4895
|
this.bindInputEvent();
|
|
4870
4896
|
this.updateInput();
|
|
4871
4897
|
if (this.enableMask) {
|
|
4872
|
-
this.notify(
|
|
4873
|
-
module:
|
|
4898
|
+
this.notify('createMask', {
|
|
4899
|
+
module: 'MaskedDateTime'
|
|
4874
4900
|
});
|
|
4875
4901
|
if (!this.value) {
|
|
4876
4902
|
this.updateInputValue(this.maskedDateValue);
|
|
@@ -4902,8 +4928,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4902
4928
|
Input.setPlaceholder(this.placeholder, this.inputElement);
|
|
4903
4929
|
this.updateInput();
|
|
4904
4930
|
if (this.enableMask) {
|
|
4905
|
-
this.notify(
|
|
4906
|
-
module:
|
|
4931
|
+
this.notify('createMask', {
|
|
4932
|
+
module: 'MaskedDateTime'
|
|
4907
4933
|
});
|
|
4908
4934
|
}
|
|
4909
4935
|
break;
|
|
@@ -4949,8 +4975,8 @@ let DatePicker = class DatePicker extends Calendar {
|
|
|
4949
4975
|
break;
|
|
4950
4976
|
case 'enableMask':
|
|
4951
4977
|
if (this.enableMask) {
|
|
4952
|
-
this.notify(
|
|
4953
|
-
module:
|
|
4978
|
+
this.notify('createMask', {
|
|
4979
|
+
module: 'MaskedDateTime'
|
|
4954
4980
|
});
|
|
4955
4981
|
this.updateInputValue(this.maskedDateValue);
|
|
4956
4982
|
this.bindInputEvent();
|
|
@@ -5207,7 +5233,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
5207
5233
|
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && !isNullOrUndefined(this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0]) && this.floatLabelType !== 'Never') {
|
|
5208
5234
|
this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
5209
5235
|
}
|
|
5210
|
-
if (!isNullOrUndefined(closest(this.element,
|
|
5236
|
+
if (!isNullOrUndefined(closest(this.element, 'fieldset')) && closest(this.element, 'fieldset').disabled) {
|
|
5211
5237
|
this.enabled = false;
|
|
5212
5238
|
}
|
|
5213
5239
|
this.renderComplete();
|
|
@@ -5409,7 +5435,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
5409
5435
|
let attributes$$1 = {};
|
|
5410
5436
|
if (!isDynamic) {
|
|
5411
5437
|
for (let i = 0; i < this.element.attributes.length; i++) {
|
|
5412
|
-
attributes$$1[this.element.attributes[i].name] =
|
|
5438
|
+
attributes$$1[this.element.attributes[i].name] =
|
|
5439
|
+
this.element.getAttribute(this.element.attributes[i].name);
|
|
5413
5440
|
}
|
|
5414
5441
|
}
|
|
5415
5442
|
else {
|
|
@@ -5618,8 +5645,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
5618
5645
|
this.clearRange();
|
|
5619
5646
|
this.hide(e);
|
|
5620
5647
|
if (closest(this.element, 'form')) {
|
|
5621
|
-
|
|
5622
|
-
|
|
5648
|
+
const element = this.firstHiddenChild;
|
|
5649
|
+
const keyupEvent = document.createEvent('KeyboardEvent');
|
|
5623
5650
|
keyupEvent.initEvent('keyup', false, true);
|
|
5624
5651
|
element.dispatchEvent(keyupEvent);
|
|
5625
5652
|
}
|
|
@@ -5837,7 +5864,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
5837
5864
|
this.createControl();
|
|
5838
5865
|
this.bindCalendarEvents();
|
|
5839
5866
|
this.updateRange((this.isMobile ? [this.calendarElement] : [this.leftCalendar, this.rightCalendar]));
|
|
5840
|
-
if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) &&
|
|
5867
|
+
if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) &&
|
|
5868
|
+
!isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
|
|
5841
5869
|
this.disabledDateRender();
|
|
5842
5870
|
}
|
|
5843
5871
|
this.updateHeader();
|
|
@@ -6083,6 +6111,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
6083
6111
|
}
|
|
6084
6112
|
this.updateHiddenInput();
|
|
6085
6113
|
}
|
|
6114
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
6086
6115
|
getStartEndDate(date, isEnd, range, dateOptions) {
|
|
6087
6116
|
if (this.depth === 'Month') {
|
|
6088
6117
|
return this.globalize.parseDate(range[isEnd ? 1 : 0].trim(), dateOptions);
|
|
@@ -6471,7 +6500,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
6471
6500
|
const isLeftYear = leftHeader ? leftHeader.classList.contains('e-year') : false;
|
|
6472
6501
|
const isRightDecade = rightHeader ? rightHeader.classList.contains('e-decade') : false;
|
|
6473
6502
|
const isLeftDecade = leftHeader ? leftHeader.classList.contains('e-decade') : false;
|
|
6474
|
-
return isLeftCalendar && (isLeftMonth || isLeftYear || isLeftDecade) &&
|
|
6503
|
+
return isLeftCalendar && (isLeftMonth || isLeftYear || isLeftDecade) &&
|
|
6504
|
+
(isRightMonth || isRightYear || isRightDecade) && !this.isMobile;
|
|
6475
6505
|
}
|
|
6476
6506
|
keyNavigation(calendar, e) {
|
|
6477
6507
|
this.bindCalendarCellEvents(calendar);
|
|
@@ -8415,7 +8445,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
8415
8445
|
if (!this.strictMode && (isDisabled)) {
|
|
8416
8446
|
this.clearRange();
|
|
8417
8447
|
}
|
|
8418
|
-
if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) &&
|
|
8448
|
+
if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) &&
|
|
8449
|
+
!isDisabled && !isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
|
|
8419
8450
|
this.disabledDateRender();
|
|
8420
8451
|
}
|
|
8421
8452
|
this.errorClass();
|
|
@@ -9160,6 +9191,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
|
|
|
9160
9191
|
this.updateHeader();
|
|
9161
9192
|
}
|
|
9162
9193
|
}
|
|
9194
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
9163
9195
|
getStartEndValue(date, isEnd) {
|
|
9164
9196
|
if (this.depth === 'Month') {
|
|
9165
9197
|
return this.checkDateValue(new Date(this.checkValue(date)));
|
|
@@ -9693,7 +9725,7 @@ let TimePicker = class TimePicker extends Component {
|
|
|
9693
9725
|
this.bindEvents();
|
|
9694
9726
|
this.validateDisable();
|
|
9695
9727
|
this.setValue(this.getFormattedValue(this.value));
|
|
9696
|
-
if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType
|
|
9728
|
+
if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType === 'Always' || !this.floatLabelType || !this.placeholder)) {
|
|
9697
9729
|
this.updateInputValue(this.maskedDateValue);
|
|
9698
9730
|
this.checkErrorState(this.maskedDateValue);
|
|
9699
9731
|
}
|
|
@@ -9703,7 +9735,7 @@ let TimePicker = class TimePicker extends Component {
|
|
|
9703
9735
|
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && !isNullOrUndefined(this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0]) && this.floatLabelType !== 'Never') {
|
|
9704
9736
|
this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
9705
9737
|
}
|
|
9706
|
-
if (!isNullOrUndefined(closest(this.element,
|
|
9738
|
+
if (!isNullOrUndefined(closest(this.element, 'fieldset')) && closest(this.element, 'fieldset').disabled) {
|
|
9707
9739
|
this.enabled = false;
|
|
9708
9740
|
}
|
|
9709
9741
|
this.renderComplete();
|
|
@@ -9804,8 +9836,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
9804
9836
|
attributes(this.inputElement, { 'name': this.element.id });
|
|
9805
9837
|
}
|
|
9806
9838
|
if (this.enableMask) {
|
|
9807
|
-
this.notify(
|
|
9808
|
-
module:
|
|
9839
|
+
this.notify('createMask', {
|
|
9840
|
+
module: 'MaskedDateTime'
|
|
9809
9841
|
});
|
|
9810
9842
|
}
|
|
9811
9843
|
}
|
|
@@ -9831,7 +9863,7 @@ let TimePicker = class TimePicker extends Component {
|
|
|
9831
9863
|
}
|
|
9832
9864
|
createInputElement() {
|
|
9833
9865
|
let updatedCssClassesValue = this.cssClass;
|
|
9834
|
-
|
|
9866
|
+
const isBindClearAction = this.enableMask ? false : true;
|
|
9835
9867
|
if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
|
|
9836
9868
|
updatedCssClassesValue = (this.cssClass.replace(/\s+/g, ' ')).trim();
|
|
9837
9869
|
}
|
|
@@ -10151,7 +10183,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10151
10183
|
}
|
|
10152
10184
|
checkErrorState(val) {
|
|
10153
10185
|
const value = this.getDateObject(val);
|
|
10154
|
-
if ((this.validateState(value) && !this.invalidValueString) ||
|
|
10186
|
+
if ((this.validateState(value) && !this.invalidValueString) ||
|
|
10187
|
+
(this.enableMask && this.inputElement.value === this.maskedDateValue)) {
|
|
10155
10188
|
this.removeErrorClass();
|
|
10156
10189
|
}
|
|
10157
10190
|
else {
|
|
@@ -10399,8 +10432,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10399
10432
|
event.preventDefault();
|
|
10400
10433
|
if (this.enableMask) {
|
|
10401
10434
|
event.preventDefault();
|
|
10402
|
-
this.notify(
|
|
10403
|
-
module:
|
|
10435
|
+
this.notify('setMaskSelection', {
|
|
10436
|
+
module: 'MaskedDateTime'
|
|
10404
10437
|
});
|
|
10405
10438
|
return;
|
|
10406
10439
|
}
|
|
@@ -10463,8 +10496,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10463
10496
|
case 'down':
|
|
10464
10497
|
if (this.enableMask && !this.readonly && !this.isPopupOpen()) {
|
|
10465
10498
|
event.preventDefault();
|
|
10466
|
-
this.notify(
|
|
10467
|
-
module:
|
|
10499
|
+
this.notify('keyDownHandler', {
|
|
10500
|
+
module: 'MaskedDateTime',
|
|
10468
10501
|
e: event
|
|
10469
10502
|
});
|
|
10470
10503
|
}
|
|
@@ -10509,12 +10542,12 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10509
10542
|
case 'tab':
|
|
10510
10543
|
case 'shiftTab':
|
|
10511
10544
|
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
|
|
10545
|
+
if ((this.inputElement.selectionStart === 0 && this.inputElement.selectionEnd === this.inputElement.value.length) ||
|
|
10546
|
+
(this.inputElement.selectionEnd !== this.inputElement.value.length && event.action === 'tab') ||
|
|
10547
|
+
(this.inputElement.selectionStart !== 0 && event.action === 'shiftTab') || (event.action === 'left' || event.action === 'right')) {
|
|
10515
10548
|
event.preventDefault();
|
|
10516
10549
|
}
|
|
10517
|
-
this.notify(
|
|
10550
|
+
this.notify('keyDownHandler', { module: 'MaskedDateTime',
|
|
10518
10551
|
e: event
|
|
10519
10552
|
});
|
|
10520
10553
|
}
|
|
@@ -10777,8 +10810,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10777
10810
|
switch (e.code) {
|
|
10778
10811
|
case 'Delete':
|
|
10779
10812
|
if (this.enableMask && !this.popupObj && !this.readonly) {
|
|
10780
|
-
this.notify(
|
|
10781
|
-
module:
|
|
10813
|
+
this.notify('keyDownHandler', {
|
|
10814
|
+
module: 'MaskedDateTime',
|
|
10782
10815
|
e: e
|
|
10783
10816
|
});
|
|
10784
10817
|
}
|
|
@@ -10824,8 +10857,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10824
10857
|
}
|
|
10825
10858
|
inputEventHandler() {
|
|
10826
10859
|
if (this.enableMask) {
|
|
10827
|
-
this.notify(
|
|
10828
|
-
module:
|
|
10860
|
+
this.notify('inputHandler', {
|
|
10861
|
+
module: 'MaskedDateTime'
|
|
10829
10862
|
});
|
|
10830
10863
|
}
|
|
10831
10864
|
}
|
|
@@ -10875,13 +10908,13 @@ let TimePicker = class TimePicker extends Component {
|
|
|
10875
10908
|
this.popupWrapper.scrollTop = 0;
|
|
10876
10909
|
}
|
|
10877
10910
|
if (this.enableMask) {
|
|
10878
|
-
this.notify(
|
|
10879
|
-
module:
|
|
10911
|
+
this.notify('clearHandler', {
|
|
10912
|
+
module: 'MaskedDateTime'
|
|
10880
10913
|
});
|
|
10881
10914
|
}
|
|
10882
10915
|
if (closest(this.element, 'form')) {
|
|
10883
|
-
|
|
10884
|
-
|
|
10916
|
+
const element = this.element;
|
|
10917
|
+
const keyupEvent = document.createEvent('KeyboardEvent');
|
|
10885
10918
|
keyupEvent.initEvent('keyup', false, true);
|
|
10886
10919
|
element.dispatchEvent(keyupEvent);
|
|
10887
10920
|
}
|
|
@@ -11002,10 +11035,10 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11002
11035
|
if (!inputVal) {
|
|
11003
11036
|
this.updateInputValue(this.maskedDateValue);
|
|
11004
11037
|
}
|
|
11005
|
-
if (isNullOrUndefined(val) && value
|
|
11038
|
+
if (isNullOrUndefined(val) && value !== this.maskedDateValue) {
|
|
11006
11039
|
this.createMask();
|
|
11007
11040
|
}
|
|
11008
|
-
if (isNullOrUndefined(val) && value
|
|
11041
|
+
if (isNullOrUndefined(val) && value === this.maskedDateValue) {
|
|
11009
11042
|
this.updateInputValue(this.maskedDateValue);
|
|
11010
11043
|
}
|
|
11011
11044
|
}
|
|
@@ -11077,13 +11110,13 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11077
11110
|
else {
|
|
11078
11111
|
this.updateInputValue(time);
|
|
11079
11112
|
if (this.enableMask) {
|
|
11080
|
-
if (time
|
|
11113
|
+
if (time === '') {
|
|
11081
11114
|
this.updateInputValue(this.maskedDateValue);
|
|
11082
11115
|
}
|
|
11083
|
-
if (isNullOrUndefined(time) && value
|
|
11116
|
+
if (isNullOrUndefined(time) && value !== this.maskedDateValue) {
|
|
11084
11117
|
this.createMask();
|
|
11085
11118
|
}
|
|
11086
|
-
if (isNullOrUndefined(time) && value
|
|
11119
|
+
if (isNullOrUndefined(time) && value === this.maskedDateValue) {
|
|
11087
11120
|
this.updateInputValue(this.maskedDateValue);
|
|
11088
11121
|
}
|
|
11089
11122
|
}
|
|
@@ -11091,8 +11124,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11091
11124
|
return time;
|
|
11092
11125
|
}
|
|
11093
11126
|
createMask() {
|
|
11094
|
-
this.notify(
|
|
11095
|
-
module:
|
|
11127
|
+
this.notify('createMask', {
|
|
11128
|
+
module: 'MaskedDateTime'
|
|
11096
11129
|
});
|
|
11097
11130
|
}
|
|
11098
11131
|
findNextElement(event) {
|
|
@@ -11203,7 +11236,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11203
11236
|
return elementIndex;
|
|
11204
11237
|
}
|
|
11205
11238
|
keyHandler(event) {
|
|
11206
|
-
if (isNullOrUndefined(this.step) || this.step <= 0 || !isNullOrUndefined(this.inputWrapper)
|
|
11239
|
+
if (isNullOrUndefined(this.step) || this.step <= 0 || !isNullOrUndefined(this.inputWrapper)
|
|
11240
|
+
&& this.inputWrapper.buttons[0].classList.contains(DISABLED$3)) {
|
|
11207
11241
|
return;
|
|
11208
11242
|
}
|
|
11209
11243
|
const count = this.timeCollections.length;
|
|
@@ -11231,7 +11265,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11231
11265
|
this.activeIndex = index = this.activeIndex < 0 ? (count - 1) : this.activeIndex;
|
|
11232
11266
|
this.activeIndex = index = this.validLiElement(this.activeIndex, (event.keyCode === 40 || event.keyCode === 39) ?
|
|
11233
11267
|
false : true);
|
|
11234
|
-
nextItem = isNullOrUndefined(this.timeCollections[index]) ?
|
|
11268
|
+
nextItem = isNullOrUndefined(this.timeCollections[index]) ?
|
|
11269
|
+
this.timeCollections[0] : this.timeCollections[index];
|
|
11235
11270
|
}
|
|
11236
11271
|
else if (event.action === 'home') {
|
|
11237
11272
|
const index = this.validLiElement(0);
|
|
@@ -11519,7 +11554,7 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11519
11554
|
}
|
|
11520
11555
|
this.closePopup(0, e);
|
|
11521
11556
|
if (this.enableMask && this.maskedDateValue && this.placeholder && this.floatLabelType !== 'Always') {
|
|
11522
|
-
if (this.inputElement.value
|
|
11557
|
+
if (this.inputElement.value === this.maskedDateValue && !this.value && (this.floatLabelType === 'Auto' || this.floatLabelType === 'Never' || this.placeholder)) {
|
|
11523
11558
|
this.updateInputValue('');
|
|
11524
11559
|
}
|
|
11525
11560
|
}
|
|
@@ -11572,7 +11607,7 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11572
11607
|
this.selectInputText();
|
|
11573
11608
|
}
|
|
11574
11609
|
if (this.enableMask && !this.inputElement.value && this.placeholder) {
|
|
11575
|
-
if (this.maskedDateValue && !this.value && (this.floatLabelType
|
|
11610
|
+
if (this.maskedDateValue && !this.value && (this.floatLabelType === 'Auto' || this.floatLabelType === 'Never' || this.placeholder)) {
|
|
11576
11611
|
this.updateInputValue(this.maskedDateValue);
|
|
11577
11612
|
this.inputElement.selectionStart = 0;
|
|
11578
11613
|
this.inputElement.selectionEnd = this.inputElement.value.length;
|
|
@@ -11816,8 +11851,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11816
11851
|
this.updatePlaceHolder();
|
|
11817
11852
|
this.setValue(this.value);
|
|
11818
11853
|
if (this.enableMask) {
|
|
11819
|
-
this.notify(
|
|
11820
|
-
module:
|
|
11854
|
+
this.notify('createMask', {
|
|
11855
|
+
module: 'MaskedDateTime'
|
|
11821
11856
|
});
|
|
11822
11857
|
}
|
|
11823
11858
|
break;
|
|
@@ -11869,8 +11904,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11869
11904
|
this.preventChange = false;
|
|
11870
11905
|
}
|
|
11871
11906
|
if (this.enableMask) {
|
|
11872
|
-
this.notify(
|
|
11873
|
-
module:
|
|
11907
|
+
this.notify('createMask', {
|
|
11908
|
+
module: 'MaskedDateTime'
|
|
11874
11909
|
});
|
|
11875
11910
|
}
|
|
11876
11911
|
break;
|
|
@@ -11904,8 +11939,8 @@ let TimePicker = class TimePicker extends Component {
|
|
|
11904
11939
|
break;
|
|
11905
11940
|
case 'enableMask':
|
|
11906
11941
|
if (this.enableMask) {
|
|
11907
|
-
this.notify(
|
|
11908
|
-
module:
|
|
11942
|
+
this.notify('createMask', {
|
|
11943
|
+
module: 'MaskedDateTime'
|
|
11909
11944
|
});
|
|
11910
11945
|
this.updateInputValue(this.maskedDateValue);
|
|
11911
11946
|
}
|
|
@@ -12206,7 +12241,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
12206
12241
|
this.cloneElement = this.element.cloneNode(true);
|
|
12207
12242
|
this.dateTimeFormat = this.cldrDateTimeFormat();
|
|
12208
12243
|
this.initValue = this.value;
|
|
12209
|
-
if (!isNullOrUndefined(closest(this.element,
|
|
12244
|
+
if (!isNullOrUndefined(closest(this.element, 'fieldset')) && closest(this.element, 'fieldset').disabled) {
|
|
12210
12245
|
this.enabled = false;
|
|
12211
12246
|
}
|
|
12212
12247
|
super.updateHtmlAttributeToElement();
|
|
@@ -12219,12 +12254,12 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
12219
12254
|
super.updateHtmlAttributeToWrapper();
|
|
12220
12255
|
this.bindInputEvents();
|
|
12221
12256
|
if (this.enableMask) {
|
|
12222
|
-
this.notify(
|
|
12223
|
-
module:
|
|
12257
|
+
this.notify('createMask', {
|
|
12258
|
+
module: 'MaskedDateTime'
|
|
12224
12259
|
});
|
|
12225
12260
|
}
|
|
12226
12261
|
this.setValue(true);
|
|
12227
|
-
if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType
|
|
12262
|
+
if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType === 'Always' || !this.floatLabelType || !this.placeholder)) {
|
|
12228
12263
|
Input.setValue(this.maskedDateValue, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
12229
12264
|
}
|
|
12230
12265
|
this.setProperties({ scrollTo: this.checkDateValue(new Date(this.checkValue(this.scrollTo))) }, true);
|
|
@@ -12398,7 +12433,6 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
12398
12433
|
}
|
|
12399
12434
|
return cldrTime;
|
|
12400
12435
|
}
|
|
12401
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12402
12436
|
getCldrFormat(type) {
|
|
12403
12437
|
let cldrDateTime;
|
|
12404
12438
|
if (this.locale === 'en' || this.locale === 'en-US') {
|
|
@@ -12417,7 +12451,6 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
12417
12451
|
return false;
|
|
12418
12452
|
}
|
|
12419
12453
|
}
|
|
12420
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12421
12454
|
getCultureTimeObject(ld, c) {
|
|
12422
12455
|
if (this.calendarMode === 'Gregorian') {
|
|
12423
12456
|
return getValue('main.' + '' + this.locale + '.dates.calendars.gregorian.timeFormats.short', ld);
|
|
@@ -12515,8 +12548,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
12515
12548
|
});
|
|
12516
12549
|
}
|
|
12517
12550
|
const value = isNullOrUndefined(this.value) ? this.inputElement.value !== '' ?
|
|
12518
|
-
dateObject :
|
|
12519
|
-
new Date() : this.value;
|
|
12551
|
+
dateObject : new Date() : this.value;
|
|
12520
12552
|
this.valueWithMinutes = value;
|
|
12521
12553
|
this.listWrapper = createElement('div', { className: CONTENT$3, attrs: { 'tabindex': '0' } });
|
|
12522
12554
|
const min = this.startTime(value);
|
|
@@ -12809,8 +12841,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
12809
12841
|
return this.validateMinMaxRange(value);
|
|
12810
12842
|
}
|
|
12811
12843
|
createMask() {
|
|
12812
|
-
this.notify(
|
|
12813
|
-
module:
|
|
12844
|
+
this.notify('createMask', {
|
|
12845
|
+
module: 'MaskedDateTime'
|
|
12814
12846
|
});
|
|
12815
12847
|
}
|
|
12816
12848
|
combineDateTime(value) {
|
|
@@ -13118,7 +13150,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
13118
13150
|
return modules;
|
|
13119
13151
|
}
|
|
13120
13152
|
maskedDateModule() {
|
|
13121
|
-
|
|
13153
|
+
const modules = { args: [this], member: 'MaskedDateTime' };
|
|
13122
13154
|
return modules;
|
|
13123
13155
|
}
|
|
13124
13156
|
getTimeActiveElement() {
|
|
@@ -13262,7 +13294,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
13262
13294
|
let index = (event.keyCode === 40 || event.keyCode === 39) ? ++this.activeIndex : --this.activeIndex;
|
|
13263
13295
|
this.activeIndex = index = this.activeIndex === (listCount) ? 0 : this.activeIndex;
|
|
13264
13296
|
this.activeIndex = index = this.activeIndex < 0 ? (listCount - 1) : this.activeIndex;
|
|
13265
|
-
nextItemValue = isNullOrUndefined(this.timeCollections[index]) ?
|
|
13297
|
+
nextItemValue = isNullOrUndefined(this.timeCollections[index]) ?
|
|
13298
|
+
this.timeCollections[0] : this.timeCollections[index];
|
|
13266
13299
|
}
|
|
13267
13300
|
else if (event.action === 'home') {
|
|
13268
13301
|
this.activeIndex = 0;
|
|
@@ -13359,8 +13392,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
13359
13392
|
this.changeTrigger(null);
|
|
13360
13393
|
this.preventChange = this.isAngular && this.preventChange ? !this.preventChange : this.preventChange;
|
|
13361
13394
|
if (this.enableMask && this.value) {
|
|
13362
|
-
this.notify(
|
|
13363
|
-
module:
|
|
13395
|
+
this.notify('createMask', {
|
|
13396
|
+
module: 'MaskedDateTime'
|
|
13364
13397
|
});
|
|
13365
13398
|
}
|
|
13366
13399
|
break;
|
|
@@ -13403,8 +13436,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
13403
13436
|
this.dateTimeFormat = this.formatString;
|
|
13404
13437
|
this.setValue();
|
|
13405
13438
|
if (this.enableMask) {
|
|
13406
|
-
this.notify(
|
|
13407
|
-
module:
|
|
13439
|
+
this.notify('createMask', {
|
|
13440
|
+
module: 'MaskedDateTime'
|
|
13408
13441
|
});
|
|
13409
13442
|
if (!this.value) {
|
|
13410
13443
|
Input.setValue(this.maskedDateValue, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
@@ -13455,8 +13488,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
|
|
|
13455
13488
|
break;
|
|
13456
13489
|
case 'enableMask':
|
|
13457
13490
|
if (this.enableMask) {
|
|
13458
|
-
this.notify(
|
|
13459
|
-
module:
|
|
13491
|
+
this.notify('createMask', {
|
|
13492
|
+
module: 'MaskedDateTime'
|
|
13460
13493
|
});
|
|
13461
13494
|
Input.setValue(this.maskedDateValue, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
13462
13495
|
}
|
|
@@ -13623,7 +13656,7 @@ class MaskedDateTime {
|
|
|
13623
13656
|
hour: 'hour',
|
|
13624
13657
|
minute: 'minute',
|
|
13625
13658
|
second: 'second',
|
|
13626
|
-
dayOfTheWeek: 'day of the week'
|
|
13659
|
+
dayOfTheWeek: 'day of the week'
|
|
13627
13660
|
};
|
|
13628
13661
|
this.hiddenMask = '';
|
|
13629
13662
|
this.validCharacters = 'dMyhmHfasz';
|
|
@@ -13689,22 +13722,29 @@ class MaskedDateTime {
|
|
|
13689
13722
|
createMask(navigated = false) {
|
|
13690
13723
|
this.isDayPart = this.isMonthPart = this.isYearPart = this.isHourPart = this.isMinutePart = this.isSecondsPart = false;
|
|
13691
13724
|
this.dateformat = this.getCulturedFormat();
|
|
13692
|
-
if (this.parent.maskPlaceholder.day)
|
|
13725
|
+
if (this.parent.maskPlaceholder.day) {
|
|
13693
13726
|
this.defaultConstant['day'] = this.parent.maskPlaceholder.day;
|
|
13694
|
-
|
|
13727
|
+
}
|
|
13728
|
+
if (this.parent.maskPlaceholder.month) {
|
|
13695
13729
|
this.defaultConstant['month'] = this.parent.maskPlaceholder.month;
|
|
13696
|
-
|
|
13730
|
+
}
|
|
13731
|
+
if (this.parent.maskPlaceholder.year) {
|
|
13697
13732
|
this.defaultConstant['year'] = this.parent.maskPlaceholder.year;
|
|
13698
|
-
|
|
13733
|
+
}
|
|
13734
|
+
if (this.parent.maskPlaceholder.hour) {
|
|
13699
13735
|
this.defaultConstant['hour'] = this.parent.maskPlaceholder.hour;
|
|
13700
|
-
|
|
13736
|
+
}
|
|
13737
|
+
if (this.parent.maskPlaceholder.minute) {
|
|
13701
13738
|
this.defaultConstant['minute'] = this.parent.maskPlaceholder.minute;
|
|
13702
|
-
|
|
13739
|
+
}
|
|
13740
|
+
if (this.parent.maskPlaceholder.second) {
|
|
13703
13741
|
this.defaultConstant['second'] = this.parent.maskPlaceholder.second;
|
|
13704
|
-
|
|
13742
|
+
}
|
|
13743
|
+
if (this.parent.maskPlaceholder.dayOfTheWeek) {
|
|
13705
13744
|
this.defaultConstant['dayOfTheWeek'] = this.parent.maskPlaceholder.dayOfTheWeek.toString();
|
|
13745
|
+
}
|
|
13706
13746
|
this.getCUltureMaskFormat();
|
|
13707
|
-
|
|
13747
|
+
const inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
13708
13748
|
this.isHiddenMask = true;
|
|
13709
13749
|
this.hiddenMask = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
13710
13750
|
this.isHiddenMask = false;
|
|
@@ -13720,11 +13760,12 @@ class MaskedDateTime {
|
|
|
13720
13760
|
this.l10n = new L10n(this.parent.moduleName, this.defaultConstant, this.parent.locale);
|
|
13721
13761
|
this.objectString = Object.keys(this.defaultConstant);
|
|
13722
13762
|
for (let i = 0; i < this.objectString.length; i++) {
|
|
13723
|
-
this.defaultConstant[this.objectString[i].toString()] =
|
|
13763
|
+
this.defaultConstant[this.objectString[i].toString()] =
|
|
13764
|
+
this.l10n.getConstant(this.objectString[i].toString());
|
|
13724
13765
|
}
|
|
13725
13766
|
}
|
|
13726
13767
|
validCharacterCheck() {
|
|
13727
|
-
|
|
13768
|
+
const start = this.parent.inputElement.selectionStart;
|
|
13728
13769
|
for (let i = start, j = start - 1; i < this.hiddenMask.length || j >= 0; i++, j--) {
|
|
13729
13770
|
if (i < this.hiddenMask.length && this.validCharacters.indexOf(this.hiddenMask[i]) !== -1) {
|
|
13730
13771
|
this.setSelection(this.hiddenMask[i]);
|
|
@@ -13740,7 +13781,6 @@ class MaskedDateTime {
|
|
|
13740
13781
|
this.maskDateValue = new Date(+this.parent.value);
|
|
13741
13782
|
this.isDayPart = this.isMonthPart = this.isYearPart = this.isHourPart = this.isMinutePart = this.isSecondsPart = true;
|
|
13742
13783
|
this.updateValue();
|
|
13743
|
-
// this.parent.inputElement.selectionStart = start;
|
|
13744
13784
|
this.validCharacterCheck();
|
|
13745
13785
|
}
|
|
13746
13786
|
setSelection(validChar) {
|
|
@@ -13765,17 +13805,18 @@ class MaskedDateTime {
|
|
|
13765
13805
|
this.isDeleteKey = true;
|
|
13766
13806
|
return;
|
|
13767
13807
|
}
|
|
13768
|
-
if ((!args.e.altKey && !args.e.ctrlKey) && (args.e.key === ARROWLEFT || args.e.key === ARROWRIGHT
|
|
13808
|
+
if ((!args.e.altKey && !args.e.ctrlKey) && (args.e.key === ARROWLEFT || args.e.key === ARROWRIGHT
|
|
13809
|
+
|| args.e.key === SHIFTTAB || args.e.key === TAB || args.e.action === SHIFTTAB ||
|
|
13769
13810
|
args.e.key === END || args.e.key === HOME)) {
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
if ((start
|
|
13774
|
-
|
|
13811
|
+
const start = this.parent.inputElement.selectionStart;
|
|
13812
|
+
const end = this.parent.inputElement.selectionEnd;
|
|
13813
|
+
const length = this.parent.inputElement.value.length;
|
|
13814
|
+
if ((start === 0 && end === length) && (args.e.key === TAB || args.e.action === SHIFTTAB)) {
|
|
13815
|
+
const index = args.e.action === SHIFTTAB ? end : 0;
|
|
13775
13816
|
this.parent.inputElement.selectionStart = this.parent.inputElement.selectionEnd = index;
|
|
13776
13817
|
}
|
|
13777
13818
|
if (args.e.key === END || args.e.key === HOME) {
|
|
13778
|
-
|
|
13819
|
+
const range = args.e.key === END ? length : 0;
|
|
13779
13820
|
this.parent.inputElement.selectionStart = this.parent.inputElement.selectionEnd = range;
|
|
13780
13821
|
}
|
|
13781
13822
|
this.navigateSelection(args.e.key === ARROWLEFT || args.e.action === SHIFTTAB || args.e.key === END ? true : false);
|
|
@@ -13787,14 +13828,14 @@ class MaskedDateTime {
|
|
|
13787
13828
|
formatText = this.hiddenMask[start];
|
|
13788
13829
|
}
|
|
13789
13830
|
this.dateAlteration(args.e.key === ARROWDOWN ? true : false);
|
|
13790
|
-
|
|
13831
|
+
const inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
13791
13832
|
this.isHiddenMask = true;
|
|
13792
13833
|
this.hiddenMask = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
13793
13834
|
this.isHiddenMask = false;
|
|
13794
13835
|
this.previousHiddenMask = this.hiddenMask;
|
|
13795
13836
|
this.previousValue = inputValue;
|
|
13796
13837
|
this.parent.inputElement.value = inputValue;
|
|
13797
|
-
for (
|
|
13838
|
+
for (let i = 0; i < this.hiddenMask.length; i++) {
|
|
13798
13839
|
if (formatText === this.hiddenMask[i]) {
|
|
13799
13840
|
start = i;
|
|
13800
13841
|
break;
|
|
@@ -13805,17 +13846,18 @@ class MaskedDateTime {
|
|
|
13805
13846
|
}
|
|
13806
13847
|
}
|
|
13807
13848
|
isPersist() {
|
|
13808
|
-
|
|
13849
|
+
const isPersist = this.parent.isFocused || this.navigated;
|
|
13809
13850
|
return isPersist;
|
|
13810
13851
|
}
|
|
13811
13852
|
differenceCheck() {
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
if (previousVal.indexOf(newVal) === 0 && (newVal.length === 0 ||
|
|
13853
|
+
const start = this.parent.inputElement.selectionStart;
|
|
13854
|
+
const inputValue = this.parent.inputElement.value;
|
|
13855
|
+
const previousVal = this.previousValue.substring(0, start + this.previousValue.length - inputValue.length);
|
|
13856
|
+
const newVal = inputValue.substring(0, start);
|
|
13857
|
+
const newDateValue = new Date(+this.maskDateValue);
|
|
13858
|
+
const maxDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
|
|
13859
|
+
if (previousVal.indexOf(newVal) === 0 && (newVal.length === 0 ||
|
|
13860
|
+
this.previousHiddenMask[newVal.length - 1] !== this.previousHiddenMask[newVal.length])) {
|
|
13819
13861
|
for (let i = newVal.length; i < previousVal.length; i++) {
|
|
13820
13862
|
if (this.previousHiddenMask[i] !== '' && this.validCharacters.indexOf(this.previousHiddenMask[i]) >= 0) {
|
|
13821
13863
|
this.isDeletion = this.handleDeletion(this.previousHiddenMask[i], false);
|
|
@@ -13827,113 +13869,122 @@ class MaskedDateTime {
|
|
|
13827
13869
|
}
|
|
13828
13870
|
switch (this.previousHiddenMask[start - 1]) {
|
|
13829
13871
|
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()) {
|
|
13872
|
+
{
|
|
13873
|
+
let date = (this.isDayPart && newDateValue.getDate().toString().length < 2 &&
|
|
13874
|
+
!this.isPersist() ? newDateValue.getDate() * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
13875
|
+
this.isDateZero = (newVal[start - 1] === '0');
|
|
13876
|
+
this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
|
|
13877
|
+
this.navigated = this.navigated ? false : this.navigated;
|
|
13878
|
+
if (isNaN(date)) {
|
|
13845
13879
|
return;
|
|
13846
13880
|
}
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
|
|
13851
|
-
|
|
13852
|
-
|
|
13881
|
+
for (let i = 0; date > maxDate; i++) {
|
|
13882
|
+
date = parseInt(date.toString().slice(1), 10);
|
|
13883
|
+
}
|
|
13884
|
+
if (date >= 1) {
|
|
13885
|
+
newDateValue.setDate(date);
|
|
13886
|
+
this.isNavigate = date.toString().length === 2;
|
|
13887
|
+
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
13888
|
+
if (newDateValue.getMonth() !== this.maskDateValue.getMonth()) {
|
|
13889
|
+
return;
|
|
13890
|
+
}
|
|
13891
|
+
this.isDayPart = true;
|
|
13892
|
+
this.dayTypeCount = this.dayTypeCount + 1;
|
|
13893
|
+
}
|
|
13894
|
+
else {
|
|
13895
|
+
this.isDayPart = false;
|
|
13896
|
+
this.dayTypeCount = this.isDateZero ? this.dayTypeCount + 1 : this.dayTypeCount;
|
|
13897
|
+
}
|
|
13898
|
+
break;
|
|
13853
13899
|
}
|
|
13854
|
-
break;
|
|
13855
13900
|
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);
|
|
13901
|
+
{
|
|
13902
|
+
let month;
|
|
13903
|
+
if (newDateValue.getMonth().toString().length < 2 && !this.isPersist()) {
|
|
13904
|
+
month = (this.isMonthPart ? (newDateValue.getMonth() + 1) * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
13905
|
+
}
|
|
13906
|
+
else {
|
|
13907
|
+
month = parseInt(newVal[start - 1], 10);
|
|
13908
|
+
}
|
|
13909
|
+
this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
|
|
13910
|
+
this.navigated = this.navigated ? false : this.navigated;
|
|
13911
|
+
this.isMonthZero = (newVal[start - 1] === '0');
|
|
13912
|
+
if (!isNaN(month)) {
|
|
13913
|
+
while (month > 12) {
|
|
13914
|
+
month = parseInt(month.toString().slice(1), 10);
|
|
13876
13915
|
}
|
|
13877
|
-
if (
|
|
13878
|
-
|
|
13879
|
-
|
|
13880
|
-
if (
|
|
13881
|
-
newDateValue.setDate(
|
|
13916
|
+
if (month >= 1) {
|
|
13917
|
+
newDateValue.setMonth(month - 1);
|
|
13918
|
+
this.isNavigate = month.toString().length === 2;
|
|
13919
|
+
if (newDateValue.getMonth() !== month - 1) {
|
|
13920
|
+
newDateValue.setDate(1);
|
|
13921
|
+
newDateValue.setMonth(month - 1);
|
|
13882
13922
|
}
|
|
13923
|
+
if (this.isDayPart) {
|
|
13924
|
+
const previousMaxDate = new Date(this.previousDate.getFullYear(), this.previousDate.getMonth() + 1, 0).getDate();
|
|
13925
|
+
const currentMaxDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
|
|
13926
|
+
if (this.previousDate.getDate() === previousMaxDate && currentMaxDate <= previousMaxDate) {
|
|
13927
|
+
newDateValue.setDate(currentMaxDate);
|
|
13928
|
+
}
|
|
13929
|
+
}
|
|
13930
|
+
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
13931
|
+
this.isMonthPart = true;
|
|
13932
|
+
this.monthTypeCount = this.monthTypeCount + 1;
|
|
13933
|
+
}
|
|
13934
|
+
else {
|
|
13935
|
+
newDateValue.setMonth(0);
|
|
13936
|
+
this.isMonthPart = false;
|
|
13937
|
+
this.monthTypeCount = this.isMonthZero ? this.monthTypeCount + 1 : this.monthTypeCount;
|
|
13883
13938
|
}
|
|
13884
|
-
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
13885
|
-
this.isMonthPart = true;
|
|
13886
|
-
this.monthTypeCount = this.monthTypeCount + 1;
|
|
13887
13939
|
}
|
|
13888
13940
|
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;
|
|
13941
|
+
const monthString = (this.getCulturedValue('months[stand-alone].wide'));
|
|
13942
|
+
const monthValue = Object.keys(monthString);
|
|
13943
|
+
this.monthCharacter += newVal[start - 1].toLowerCase();
|
|
13944
|
+
while (this.monthCharacter.length > 0) {
|
|
13945
|
+
let i = 1;
|
|
13946
|
+
for (const months of monthValue) {
|
|
13947
|
+
if (monthString[i].toLowerCase().indexOf(this.monthCharacter) === 0) {
|
|
13948
|
+
newDateValue.setMonth(i - 1);
|
|
13949
|
+
this.isMonthPart = true;
|
|
13950
|
+
this.maskDateValue = newDateValue;
|
|
13951
|
+
return;
|
|
13952
|
+
}
|
|
13953
|
+
i++;
|
|
13906
13954
|
}
|
|
13907
|
-
|
|
13955
|
+
this.monthCharacter = this.monthCharacter.substring(1, this.monthCharacter.length);
|
|
13908
13956
|
}
|
|
13909
|
-
this.monthCharacter = this.monthCharacter.substring(1, this.monthCharacter.length);
|
|
13910
13957
|
}
|
|
13958
|
+
break;
|
|
13911
13959
|
}
|
|
13912
|
-
break;
|
|
13913
13960
|
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;
|
|
13961
|
+
{
|
|
13962
|
+
let year = (this.isYearPart && (newDateValue.getFullYear().toString().length < 4
|
|
13963
|
+
&& !this.isShortYear) ? newDateValue.getFullYear() * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
13964
|
+
this.isShortYear = false;
|
|
13965
|
+
this.isYearZero = (newVal[start - 1] === '0');
|
|
13966
|
+
if (isNaN(year)) {
|
|
13967
|
+
return;
|
|
13930
13968
|
}
|
|
13931
|
-
|
|
13932
|
-
|
|
13969
|
+
while (year > 9999) {
|
|
13970
|
+
year = parseInt(year.toString().slice(1), 10);
|
|
13971
|
+
}
|
|
13972
|
+
if (year < 1) {
|
|
13973
|
+
this.isYearPart = false;
|
|
13974
|
+
}
|
|
13975
|
+
else {
|
|
13976
|
+
newDateValue.setFullYear(year);
|
|
13977
|
+
if (year.toString().length === 4) {
|
|
13978
|
+
this.isNavigate = true;
|
|
13979
|
+
}
|
|
13980
|
+
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
13981
|
+
this.isYearPart = true;
|
|
13982
|
+
}
|
|
13983
|
+
break;
|
|
13933
13984
|
}
|
|
13934
|
-
break;
|
|
13935
13985
|
case 'h':
|
|
13936
|
-
this.hour = (this.isHourPart && (newDateValue.getHours() % 12 || 12).toString().length < 2
|
|
13986
|
+
this.hour = (this.isHourPart && (newDateValue.getHours() % 12 || 12).toString().length < 2
|
|
13987
|
+
&& !this.isPersist() ? (newDateValue.getHours() % 12 || 12) * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
13937
13988
|
this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
|
|
13938
13989
|
this.navigated = this.navigated ? false : this.navigated;
|
|
13939
13990
|
if (isNaN(this.hour)) {
|
|
@@ -13948,7 +13999,8 @@ class MaskedDateTime {
|
|
|
13948
13999
|
this.hourTypeCount = this.hourTypeCount + 1;
|
|
13949
14000
|
break;
|
|
13950
14001
|
case 'H':
|
|
13951
|
-
this.hour = (this.isHourPart && newDateValue.getHours().toString().length < 2 &&
|
|
14002
|
+
this.hour = (this.isHourPart && newDateValue.getHours().toString().length < 2 &&
|
|
14003
|
+
!this.isPersist() ? newDateValue.getHours() * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
13952
14004
|
this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
|
|
13953
14005
|
this.navigated = this.navigated ? false : this.navigated;
|
|
13954
14006
|
if (isNaN(this.hour)) {
|
|
@@ -13963,69 +14015,83 @@ class MaskedDateTime {
|
|
|
13963
14015
|
this.hourTypeCount = this.hourTypeCount + 1;
|
|
13964
14016
|
break;
|
|
13965
14017
|
case 'm':
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
14018
|
+
{
|
|
14019
|
+
let minutes = (this.isMinutePart && newDateValue.getMinutes().toString().length < 2
|
|
14020
|
+
&& !this.isPersist() ? newDateValue.getMinutes() * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
14021
|
+
this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
|
|
14022
|
+
this.navigated = this.navigated ? false : this.navigated;
|
|
14023
|
+
if (isNaN(minutes)) {
|
|
14024
|
+
return;
|
|
14025
|
+
}
|
|
14026
|
+
for (let i = 0; minutes > 59; i++) {
|
|
14027
|
+
minutes = parseInt(minutes.toString().slice(1), 10);
|
|
14028
|
+
}
|
|
14029
|
+
newDateValue.setMinutes(minutes);
|
|
14030
|
+
this.isNavigate = minutes.toString().length === 2;
|
|
14031
|
+
this.isMinutePart = true;
|
|
14032
|
+
this.minuteTypeCount = this.minuteTypeCount + 1;
|
|
14033
|
+
break;
|
|
13974
14034
|
}
|
|
13975
|
-
newDateValue.setMinutes(minutes);
|
|
13976
|
-
this.isNavigate = minutes.toString().length === 2;
|
|
13977
|
-
this.isMinutePart = true;
|
|
13978
|
-
this.minuteTypeCount = this.minuteTypeCount + 1;
|
|
13979
|
-
break;
|
|
13980
14035
|
case 's':
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
14036
|
+
{
|
|
14037
|
+
let seconds = (this.isSecondsPart && newDateValue.getSeconds().toString().length < 2 &&
|
|
14038
|
+
!this.isPersist() ? newDateValue.getSeconds() * 10 : 0) + parseInt(newVal[start - 1], 10);
|
|
14039
|
+
this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
|
|
14040
|
+
this.navigated = this.navigated ? false : this.navigated;
|
|
14041
|
+
if (isNaN(seconds)) {
|
|
14042
|
+
return;
|
|
14043
|
+
}
|
|
14044
|
+
for (let i = 0; seconds > 59; i++) {
|
|
14045
|
+
seconds = parseInt(seconds.toString().slice(1), 10);
|
|
14046
|
+
}
|
|
14047
|
+
newDateValue.setSeconds(seconds);
|
|
14048
|
+
this.isNavigate = seconds.toString().length === 2;
|
|
14049
|
+
this.isSecondsPart = true;
|
|
14050
|
+
this.secondTypeCount = this.secondTypeCount + 1;
|
|
14051
|
+
break;
|
|
13989
14052
|
}
|
|
13990
|
-
newDateValue.setSeconds(seconds);
|
|
13991
|
-
this.isNavigate = seconds.toString().length === 2;
|
|
13992
|
-
this.isSecondsPart = true;
|
|
13993
|
-
this.secondTypeCount = this.secondTypeCount + 1;
|
|
13994
|
-
break;
|
|
13995
14053
|
case 'a':
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14054
|
+
{
|
|
14055
|
+
this.periodCharacter += newVal[start - 1].toLowerCase();
|
|
14056
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14057
|
+
const periodString = (this.getCulturedValue('dayPeriods.format.wide'));
|
|
14058
|
+
const periodkeys = Object.keys(periodString);
|
|
14059
|
+
for (let i = 0; this.periodCharacter.length > 0; i++) {
|
|
14060
|
+
if ((periodString[periodkeys[0]].toLowerCase().indexOf(this.periodCharacter) === 0
|
|
14061
|
+
&& newDateValue.getHours() >= 12) || (periodString[periodkeys[1]].toLowerCase().
|
|
14062
|
+
indexOf(this.periodCharacter) === 0 && newDateValue.getHours() < 12)) {
|
|
14063
|
+
newDateValue.setHours((newDateValue.getHours() + 12) % 24);
|
|
14064
|
+
this.maskDateValue = newDateValue;
|
|
14065
|
+
}
|
|
14066
|
+
this.periodCharacter = this.periodCharacter.substring(1, this.periodCharacter.length);
|
|
14067
|
+
}
|
|
14068
|
+
break;
|
|
14008
14069
|
}
|
|
14009
|
-
break;
|
|
14010
14070
|
default:
|
|
14011
14071
|
break;
|
|
14012
14072
|
}
|
|
14013
14073
|
this.maskDateValue = newDateValue;
|
|
14014
14074
|
}
|
|
14075
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14015
14076
|
formatCheck() {
|
|
14077
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
14016
14078
|
const proxy = this;
|
|
14017
14079
|
function formatValueSpecifier(formattext) {
|
|
14018
14080
|
let result;
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14081
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14082
|
+
const daysAbbreviated = proxy.getCulturedValue('days[stand-alone].abbreviated');
|
|
14083
|
+
const dayKeyAbbreviated = Object.keys(daysAbbreviated);
|
|
14084
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14085
|
+
const daysWide = (proxy.getCulturedValue('days[stand-alone].wide'));
|
|
14086
|
+
const dayKeyWide = Object.keys(daysWide);
|
|
14087
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14088
|
+
const daysNarrow = (proxy.getCulturedValue('days[stand-alone].narrow'));
|
|
14089
|
+
const dayKeyNarrow = Object.keys(daysNarrow);
|
|
14090
|
+
const monthAbbreviated = (proxy.getCulturedValue('months[stand-alone].abbreviated'));
|
|
14091
|
+
const monthWide = (proxy.getCulturedValue('months[stand-alone].wide'));
|
|
14092
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14093
|
+
const periodString = (proxy.getCulturedValue('dayPeriods.format.wide'));
|
|
14094
|
+
const periodkeys = Object.keys(periodString);
|
|
14029
14095
|
let milliseconds;
|
|
14030
14096
|
let dateOptions;
|
|
14031
14097
|
switch (formattext) {
|
|
@@ -14034,7 +14100,7 @@ class MaskedDateTime {
|
|
|
14034
14100
|
case 'd':
|
|
14035
14101
|
result = proxy.isDayPart ? proxy.maskDateValue.getDate().toString() : proxy.defaultConstant['day'].toString();
|
|
14036
14102
|
result = proxy.zeroCheck(proxy.isDateZero, proxy.isDayPart, result);
|
|
14037
|
-
if (proxy.dayTypeCount
|
|
14103
|
+
if (proxy.dayTypeCount === 2) {
|
|
14038
14104
|
proxy.isNavigate = true;
|
|
14039
14105
|
proxy.dayTypeCount = 0;
|
|
14040
14106
|
}
|
|
@@ -14042,7 +14108,7 @@ class MaskedDateTime {
|
|
|
14042
14108
|
case 'dd':
|
|
14043
14109
|
result = proxy.isDayPart ? proxy.roundOff(proxy.maskDateValue.getDate(), 2) : proxy.defaultConstant['day'].toString();
|
|
14044
14110
|
result = proxy.zeroCheck(proxy.isDateZero, proxy.isDayPart, result);
|
|
14045
|
-
if (proxy.dayTypeCount
|
|
14111
|
+
if (proxy.dayTypeCount === 2) {
|
|
14046
14112
|
proxy.isNavigate = true;
|
|
14047
14113
|
proxy.dayTypeCount = 0;
|
|
14048
14114
|
}
|
|
@@ -14061,7 +14127,7 @@ class MaskedDateTime {
|
|
|
14061
14127
|
case 'M':
|
|
14062
14128
|
result = proxy.isMonthPart ? (proxy.maskDateValue.getMonth() + 1).toString() : proxy.defaultConstant['month'].toString();
|
|
14063
14129
|
result = proxy.zeroCheck(proxy.isMonthZero, proxy.isMonthPart, result);
|
|
14064
|
-
if (proxy.monthTypeCount
|
|
14130
|
+
if (proxy.monthTypeCount === 2) {
|
|
14065
14131
|
proxy.isNavigate = true;
|
|
14066
14132
|
proxy.monthTypeCount = 0;
|
|
14067
14133
|
}
|
|
@@ -14069,7 +14135,7 @@ class MaskedDateTime {
|
|
|
14069
14135
|
case 'MM':
|
|
14070
14136
|
result = proxy.isMonthPart ? proxy.roundOff(proxy.maskDateValue.getMonth() + 1, 2) : proxy.defaultConstant['month'].toString();
|
|
14071
14137
|
result = proxy.zeroCheck(proxy.isMonthZero, proxy.isMonthPart, result);
|
|
14072
|
-
if (proxy.monthTypeCount
|
|
14138
|
+
if (proxy.monthTypeCount === 2) {
|
|
14073
14139
|
proxy.isNavigate = true;
|
|
14074
14140
|
proxy.monthTypeCount = 0;
|
|
14075
14141
|
}
|
|
@@ -14094,56 +14160,56 @@ class MaskedDateTime {
|
|
|
14094
14160
|
break;
|
|
14095
14161
|
case 'h':
|
|
14096
14162
|
result = proxy.isHourPart ? (proxy.maskDateValue.getHours() % 12 || 12).toString() : proxy.defaultConstant['hour'].toString();
|
|
14097
|
-
if (proxy.hourTypeCount
|
|
14163
|
+
if (proxy.hourTypeCount === 2) {
|
|
14098
14164
|
proxy.isNavigate = true;
|
|
14099
14165
|
proxy.hourTypeCount = 0;
|
|
14100
14166
|
}
|
|
14101
14167
|
break;
|
|
14102
14168
|
case 'hh':
|
|
14103
14169
|
result = proxy.isHourPart ? proxy.roundOff(proxy.maskDateValue.getHours() % 12 || 12, 2) : proxy.defaultConstant['hour'].toString();
|
|
14104
|
-
if (proxy.hourTypeCount
|
|
14170
|
+
if (proxy.hourTypeCount === 2) {
|
|
14105
14171
|
proxy.isNavigate = true;
|
|
14106
14172
|
proxy.hourTypeCount = 0;
|
|
14107
14173
|
}
|
|
14108
14174
|
break;
|
|
14109
14175
|
case 'H':
|
|
14110
14176
|
result = proxy.isHourPart ? proxy.maskDateValue.getHours().toString() : proxy.defaultConstant['hour'].toString();
|
|
14111
|
-
if (proxy.hourTypeCount
|
|
14177
|
+
if (proxy.hourTypeCount === 2) {
|
|
14112
14178
|
proxy.isNavigate = true;
|
|
14113
14179
|
proxy.hourTypeCount = 0;
|
|
14114
14180
|
}
|
|
14115
14181
|
break;
|
|
14116
14182
|
case 'HH':
|
|
14117
14183
|
result = proxy.isHourPart ? proxy.roundOff(proxy.maskDateValue.getHours(), 2) : proxy.defaultConstant['hour'].toString();
|
|
14118
|
-
if (proxy.hourTypeCount
|
|
14184
|
+
if (proxy.hourTypeCount === 2) {
|
|
14119
14185
|
proxy.isNavigate = true;
|
|
14120
14186
|
proxy.hourTypeCount = 0;
|
|
14121
14187
|
}
|
|
14122
14188
|
break;
|
|
14123
14189
|
case 'm':
|
|
14124
14190
|
result = proxy.isMinutePart ? proxy.maskDateValue.getMinutes().toString() : proxy.defaultConstant['minute'].toString();
|
|
14125
|
-
if (proxy.minuteTypeCount
|
|
14191
|
+
if (proxy.minuteTypeCount === 2) {
|
|
14126
14192
|
proxy.isNavigate = true;
|
|
14127
14193
|
proxy.minuteTypeCount = 0;
|
|
14128
14194
|
}
|
|
14129
14195
|
break;
|
|
14130
14196
|
case 'mm':
|
|
14131
14197
|
result = proxy.isMinutePart ? proxy.roundOff(proxy.maskDateValue.getMinutes(), 2) : proxy.defaultConstant['minute'].toString();
|
|
14132
|
-
if (proxy.minuteTypeCount
|
|
14198
|
+
if (proxy.minuteTypeCount === 2) {
|
|
14133
14199
|
proxy.isNavigate = true;
|
|
14134
14200
|
proxy.minuteTypeCount = 0;
|
|
14135
14201
|
}
|
|
14136
14202
|
break;
|
|
14137
14203
|
case 's':
|
|
14138
14204
|
result = proxy.isSecondsPart ? proxy.maskDateValue.getSeconds().toString() : proxy.defaultConstant['second'].toString();
|
|
14139
|
-
if (proxy.secondTypeCount
|
|
14205
|
+
if (proxy.secondTypeCount === 2) {
|
|
14140
14206
|
proxy.isNavigate = true;
|
|
14141
14207
|
proxy.secondTypeCount = 0;
|
|
14142
14208
|
}
|
|
14143
14209
|
break;
|
|
14144
14210
|
case 'ss':
|
|
14145
14211
|
result = proxy.isSecondsPart ? proxy.roundOff(proxy.maskDateValue.getSeconds(), 2) : proxy.defaultConstant['second'].toString();
|
|
14146
|
-
if (proxy.secondTypeCount
|
|
14212
|
+
if (proxy.secondTypeCount === 2) {
|
|
14147
14213
|
proxy.isNavigate = true;
|
|
14148
14214
|
proxy.secondTypeCount = 0;
|
|
14149
14215
|
}
|
|
@@ -14192,14 +14258,12 @@ class MaskedDateTime {
|
|
|
14192
14258
|
}
|
|
14193
14259
|
maskInputHandler() {
|
|
14194
14260
|
let start = this.parent.inputElement.selectionStart;
|
|
14195
|
-
let selectionChar = this.previousHiddenMask[start - 1];
|
|
14196
14261
|
let formatText = '';
|
|
14197
14262
|
if (this.validCharacters.indexOf(this.hiddenMask[start]) !== -1) {
|
|
14198
14263
|
formatText = this.hiddenMask[start];
|
|
14199
14264
|
}
|
|
14200
|
-
let inputValue;
|
|
14201
14265
|
this.differenceCheck();
|
|
14202
|
-
inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
14266
|
+
const inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
14203
14267
|
this.isHiddenMask = true;
|
|
14204
14268
|
this.hiddenMask = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
14205
14269
|
this.isDateZero = this.isMonthZero = this.isYearZero = false;
|
|
@@ -14208,7 +14272,7 @@ class MaskedDateTime {
|
|
|
14208
14272
|
this.previousValue = inputValue;
|
|
14209
14273
|
this.parent.inputElement.value = inputValue;
|
|
14210
14274
|
this.parent.inputElement.value = inputValue;
|
|
14211
|
-
for (
|
|
14275
|
+
for (let i = 0; i < this.hiddenMask.length; i++) {
|
|
14212
14276
|
if (formatText === this.hiddenMask[i]) {
|
|
14213
14277
|
start = i;
|
|
14214
14278
|
break;
|
|
@@ -14217,7 +14281,7 @@ class MaskedDateTime {
|
|
|
14217
14281
|
this.parent.inputElement.selectionStart = start;
|
|
14218
14282
|
this.validCharacterCheck();
|
|
14219
14283
|
if ((this.isNavigate || this.isDeletion) && !this.isDeleteKey) {
|
|
14220
|
-
|
|
14284
|
+
const isbackward = this.isNavigate ? false : true;
|
|
14221
14285
|
this.isNavigate = this.isDeletion = false;
|
|
14222
14286
|
this.navigateSelection(isbackward);
|
|
14223
14287
|
}
|
|
@@ -14225,12 +14289,10 @@ class MaskedDateTime {
|
|
|
14225
14289
|
this.isDeletion = false;
|
|
14226
14290
|
}
|
|
14227
14291
|
this.isDeleteKey = false;
|
|
14228
|
-
// this.setSelection(selectionChar);
|
|
14229
|
-
// this.navigateSelection(inputValue);
|
|
14230
14292
|
}
|
|
14231
14293
|
navigateSelection(isbackward) {
|
|
14232
|
-
|
|
14233
|
-
|
|
14294
|
+
const start = this.parent.inputElement.selectionStart;
|
|
14295
|
+
const end = this.parent.inputElement.selectionEnd;
|
|
14234
14296
|
let formatIndex = isbackward ? start - 1 : end + 1;
|
|
14235
14297
|
this.navigated = true;
|
|
14236
14298
|
while (formatIndex < this.hiddenMask.length && formatIndex >= 0) {
|
|
@@ -14242,8 +14304,8 @@ class MaskedDateTime {
|
|
|
14242
14304
|
}
|
|
14243
14305
|
}
|
|
14244
14306
|
roundOff(val, count) {
|
|
14245
|
-
|
|
14246
|
-
|
|
14307
|
+
const valueText = val.toString();
|
|
14308
|
+
const length = count - valueText.length;
|
|
14247
14309
|
let result = '';
|
|
14248
14310
|
for (let i = 0; i < length; i++) {
|
|
14249
14311
|
result += '0';
|
|
@@ -14291,7 +14353,7 @@ class MaskedDateTime {
|
|
|
14291
14353
|
return true;
|
|
14292
14354
|
}
|
|
14293
14355
|
dateAlteration(isDecrement) {
|
|
14294
|
-
|
|
14356
|
+
const start = this.parent.inputElement.selectionStart;
|
|
14295
14357
|
let formatText = '';
|
|
14296
14358
|
if (this.validCharacters.indexOf(this.hiddenMask[start]) !== -1) {
|
|
14297
14359
|
formatText = this.hiddenMask[start];
|
|
@@ -14299,32 +14361,34 @@ class MaskedDateTime {
|
|
|
14299
14361
|
else {
|
|
14300
14362
|
return;
|
|
14301
14363
|
}
|
|
14302
|
-
|
|
14364
|
+
const newDateValue = new Date(this.maskDateValue.getFullYear(), this.maskDateValue.getMonth(), this.maskDateValue.getDate(), this.maskDateValue.getHours(), this.maskDateValue.getMinutes(), this.maskDateValue.getSeconds());
|
|
14303
14365
|
this.previousDate = new Date(this.maskDateValue.getFullYear(), this.maskDateValue.getMonth(), this.maskDateValue.getDate(), this.maskDateValue.getHours(), this.maskDateValue.getMinutes(), this.maskDateValue.getSeconds());
|
|
14304
|
-
|
|
14366
|
+
const incrementValue = isDecrement ? -1 : 1;
|
|
14305
14367
|
switch (formatText) {
|
|
14306
14368
|
case 'd':
|
|
14307
14369
|
newDateValue.setDate(newDateValue.getDate() + incrementValue);
|
|
14308
14370
|
break;
|
|
14309
14371
|
case 'M':
|
|
14310
|
-
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
|
|
14314
|
-
|
|
14315
|
-
|
|
14316
|
-
|
|
14317
|
-
|
|
14372
|
+
{
|
|
14373
|
+
const newMonth = newDateValue.getMonth() + incrementValue;
|
|
14374
|
+
newDateValue.setDate(1);
|
|
14375
|
+
newDateValue.setMonth(newMonth);
|
|
14376
|
+
if (this.isDayPart) {
|
|
14377
|
+
const previousMaxDate = new Date(this.previousDate.getFullYear(), this.previousDate.getMonth() + 1, 0).getDate();
|
|
14378
|
+
const currentMaxDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
|
|
14379
|
+
if (this.previousDate.getDate() === previousMaxDate && currentMaxDate <= previousMaxDate) {
|
|
14380
|
+
newDateValue.setDate(currentMaxDate);
|
|
14381
|
+
}
|
|
14382
|
+
else {
|
|
14383
|
+
newDateValue.setDate(this.previousDate.getDate());
|
|
14384
|
+
}
|
|
14318
14385
|
}
|
|
14319
14386
|
else {
|
|
14320
14387
|
newDateValue.setDate(this.previousDate.getDate());
|
|
14321
14388
|
}
|
|
14389
|
+
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
14390
|
+
break;
|
|
14322
14391
|
}
|
|
14323
|
-
else {
|
|
14324
|
-
newDateValue.setDate(this.previousDate.getDate());
|
|
14325
|
-
}
|
|
14326
|
-
this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
|
|
14327
|
-
break;
|
|
14328
14392
|
case 'y':
|
|
14329
14393
|
newDateValue.setFullYear(newDateValue.getFullYear() + incrementValue);
|
|
14330
14394
|
break;
|
|
@@ -14350,7 +14414,7 @@ class MaskedDateTime {
|
|
|
14350
14414
|
}
|
|
14351
14415
|
}
|
|
14352
14416
|
getCulturedValue(format) {
|
|
14353
|
-
|
|
14417
|
+
const locale = this.parent.locale;
|
|
14354
14418
|
let result;
|
|
14355
14419
|
if (locale === 'en' || locale === 'en-US') {
|
|
14356
14420
|
result = getValue(format, getDefaultDateObject());
|
|
@@ -14362,19 +14426,19 @@ class MaskedDateTime {
|
|
|
14362
14426
|
}
|
|
14363
14427
|
getCulturedFormat() {
|
|
14364
14428
|
let formatString = (this.getCulturedValue('dateTimeFormats[availableFormats].yMd')).toString();
|
|
14365
|
-
if (this.parent.moduleName
|
|
14429
|
+
if (this.parent.moduleName === 'datepicker') {
|
|
14366
14430
|
formatString = (this.getCulturedValue('dateTimeFormats[availableFormats].yMd')).toString();
|
|
14367
14431
|
if (this.parent.format && this.parent.formatString) {
|
|
14368
14432
|
formatString = this.parent.formatString;
|
|
14369
14433
|
}
|
|
14370
14434
|
}
|
|
14371
|
-
if (this.parent.moduleName
|
|
14435
|
+
if (this.parent.moduleName === 'datetimepicker') {
|
|
14372
14436
|
formatString = (this.getCulturedValue('dateTimeFormats[availableFormats].yMd')).toString();
|
|
14373
14437
|
if (this.parent.dateTimeFormat) {
|
|
14374
14438
|
formatString = this.parent.dateTimeFormat;
|
|
14375
14439
|
}
|
|
14376
14440
|
}
|
|
14377
|
-
if (this.parent.moduleName
|
|
14441
|
+
if (this.parent.moduleName === 'timepicker') {
|
|
14378
14442
|
formatString = this.parent.cldrTimeFormat();
|
|
14379
14443
|
}
|
|
14380
14444
|
return formatString;
|
|
@@ -14385,14 +14449,13 @@ class MaskedDateTime {
|
|
|
14385
14449
|
}
|
|
14386
14450
|
updateValue() {
|
|
14387
14451
|
this.monthCharacter = this.periodCharacter = '';
|
|
14388
|
-
|
|
14452
|
+
const inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
14389
14453
|
this.isHiddenMask = true;
|
|
14390
14454
|
this.hiddenMask = this.dateformat.replace(this.formatRegex, this.formatCheck());
|
|
14391
14455
|
this.isHiddenMask = false;
|
|
14392
14456
|
this.previousHiddenMask = this.hiddenMask;
|
|
14393
14457
|
this.previousValue = inputValue;
|
|
14394
14458
|
this.parent.updateInputValue(inputValue);
|
|
14395
|
-
//this.parent.inputElement.value = inputValue;
|
|
14396
14459
|
}
|
|
14397
14460
|
destroy() {
|
|
14398
14461
|
this.removeEventListener();
|