@progress/kendo-angular-dateinputs 21.4.1 → 22.0.0
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/calendar/localization/calendar-messages.d.ts +1 -1
- package/calendar/localization/multiview-calendar-messages.d.ts +1 -1
- package/dateinput/localization/messages.d.ts +1 -1
- package/datepicker/localization/messages.d.ts +1 -1
- package/daterange/date-range-input.d.ts +1 -1
- package/daterange/localization/messages.d.ts +1 -1
- package/datetimepicker/localization/messages.d.ts +1 -1
- package/fesm2022/progress-kendo-angular-dateinputs.mjs +262 -262
- package/package.json +15 -23
- package/timepicker/localization/messages.d.ts +1 -1
- package/esm2022/calendar/calendar.component.mjs +0 -1711
- package/esm2022/calendar/calendar.module.mjs +0 -91
- package/esm2022/calendar/calendars.module.mjs +0 -87
- package/esm2022/calendar/footer.component.mjs +0 -77
- package/esm2022/calendar/for.directive.mjs +0 -116
- package/esm2022/calendar/header.component.mjs +0 -367
- package/esm2022/calendar/horizontal-view-list.component.mjs +0 -580
- package/esm2022/calendar/localization/calendar-custom-messages.component.mjs +0 -51
- package/esm2022/calendar/localization/calendar-localized-messages.directive.mjs +0 -39
- package/esm2022/calendar/localization/calendar-messages.mjs +0 -45
- package/esm2022/calendar/localization/multiview-calendar-custom-messages.component.mjs +0 -51
- package/esm2022/calendar/localization/multiview-calendar-localized-messages.directive.mjs +0 -39
- package/esm2022/calendar/localization/multiview-calendar-messages.mjs +0 -45
- package/esm2022/calendar/models/cell-context.interface.mjs +0 -5
- package/esm2022/calendar/models/navigation-action.enum.mjs +0 -20
- package/esm2022/calendar/models/orientation.mjs +0 -5
- package/esm2022/calendar/models/row-length-options.interface.mjs +0 -5
- package/esm2022/calendar/models/scrollable.interface.mjs +0 -5
- package/esm2022/calendar/models/selection-range-end.type.mjs +0 -5
- package/esm2022/calendar/models/selection-range.interface.mjs +0 -10
- package/esm2022/calendar/models/selection.mjs +0 -50
- package/esm2022/calendar/models/type.mjs +0 -5
- package/esm2022/calendar/models/view-service.interface.mjs +0 -5
- package/esm2022/calendar/models/view.enum.mjs +0 -16
- package/esm2022/calendar/models/view.type.mjs +0 -5
- package/esm2022/calendar/multiview-calendar.component.mjs +0 -1564
- package/esm2022/calendar/multiview-calendar.module.mjs +0 -89
- package/esm2022/calendar/navigation.component.mjs +0 -230
- package/esm2022/calendar/services/bus-view.service.mjs +0 -83
- package/esm2022/calendar/services/century-view.service.mjs +0 -219
- package/esm2022/calendar/services/decade-view.service.mjs +0 -217
- package/esm2022/calendar/services/disabled-dates.service.mjs +0 -66
- package/esm2022/calendar/services/dom.service.mjs +0 -203
- package/esm2022/calendar/services/month-view.service.mjs +0 -223
- package/esm2022/calendar/services/navigation.service.mjs +0 -60
- package/esm2022/calendar/services/scroll-sync.service.mjs +0 -89
- package/esm2022/calendar/services/selection.service.mjs +0 -62
- package/esm2022/calendar/services/weeknames.service.mjs +0 -33
- package/esm2022/calendar/services/year-view.service.mjs +0 -204
- package/esm2022/calendar/templates/cell-template.directive.mjs +0 -45
- package/esm2022/calendar/templates/century-cell-template.directive.mjs +0 -43
- package/esm2022/calendar/templates/decade-cell-template.directive.mjs +0 -43
- package/esm2022/calendar/templates/footer-template.directive.mjs +0 -44
- package/esm2022/calendar/templates/header-template.directive.mjs +0 -47
- package/esm2022/calendar/templates/header-title-template.directive.mjs +0 -43
- package/esm2022/calendar/templates/month-cell-template.directive.mjs +0 -43
- package/esm2022/calendar/templates/navigation-item-template.directive.mjs +0 -43
- package/esm2022/calendar/templates/weeknumber-cell-template.directive.mjs +0 -43
- package/esm2022/calendar/templates/year-cell-template.directive.mjs +0 -43
- package/esm2022/calendar/view-list.component.mjs +0 -497
- package/esm2022/calendar/view.component.mjs +0 -432
- package/esm2022/common/dom-queries.mjs +0 -24
- package/esm2022/common/models/fillmode.mjs +0 -5
- package/esm2022/common/models/rounded.mjs +0 -5
- package/esm2022/common/models/size.mjs +0 -5
- package/esm2022/common/models/week-days-format.mjs +0 -5
- package/esm2022/common/picker.service.mjs +0 -17
- package/esm2022/common/utils.mjs +0 -70
- package/esm2022/dateinput/arrow.enum.mjs +0 -13
- package/esm2022/dateinput/dateinput.component.mjs +0 -1196
- package/esm2022/dateinput/dateinput.module.mjs +0 -45
- package/esm2022/dateinput/localization/dateinput-custom-messages.component.mjs +0 -60
- package/esm2022/dateinput/localization/dateinput-localized-messages.directive.mjs +0 -39
- package/esm2022/dateinput/localization/messages.mjs +0 -39
- package/esm2022/dateinput/models/format-placeholder.model.mjs +0 -5
- package/esm2022/dateinput/models/format-settings.model.mjs +0 -5
- package/esm2022/dateinput/models/incremental-steps.model.mjs +0 -5
- package/esm2022/dateinputs.module.mjs +0 -136
- package/esm2022/datepicker/datepicker.component.mjs +0 -1758
- package/esm2022/datepicker/datepicker.module.mjs +0 -83
- package/esm2022/datepicker/localization/datepicker-custom-messages.component.mjs +0 -53
- package/esm2022/datepicker/localization/datepicker-localized-messages.directive.mjs +0 -39
- package/esm2022/datepicker/localization/messages.mjs +0 -63
- package/esm2022/daterange/auto-correct-on.type.mjs +0 -5
- package/esm2022/daterange/date-range-end-input.directive.mjs +0 -105
- package/esm2022/daterange/date-range-input.mjs +0 -138
- package/esm2022/daterange/date-range-popup-template.directive.mjs +0 -36
- package/esm2022/daterange/date-range-popup.component.mjs +0 -1051
- package/esm2022/daterange/date-range-selection.directive.mjs +0 -223
- package/esm2022/daterange/date-range-start-input.directive.mjs +0 -109
- package/esm2022/daterange/date-range.component.mjs +0 -116
- package/esm2022/daterange/date-range.module.mjs +0 -103
- package/esm2022/daterange/date-range.service.mjs +0 -225
- package/esm2022/daterange/localization/daterange-popup-custom-messages.component.mjs +0 -43
- package/esm2022/daterange/localization/daterange-popup-localized-messages.directive.mjs +0 -39
- package/esm2022/daterange/localization/messages.mjs +0 -51
- package/esm2022/datetimepicker/datetimepicker.component.mjs +0 -2505
- package/esm2022/datetimepicker/datetimepicker.module.mjs +0 -106
- package/esm2022/datetimepicker/localization/datetimepicker-custom-messages.component.mjs +0 -52
- package/esm2022/datetimepicker/localization/localized-messages.directive.mjs +0 -39
- package/esm2022/datetimepicker/localization/messages.mjs +0 -153
- package/esm2022/datetimepicker/models/active-tab.type.mjs +0 -5
- package/esm2022/defaults.mjs +0 -24
- package/esm2022/directives.mjs +0 -146
- package/esm2022/index.mjs +0 -78
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/popup-settings.model.mjs +0 -5
- package/esm2022/preventable-event.mjs +0 -27
- package/esm2022/progress-kendo-angular-dateinputs.mjs +0 -8
- package/esm2022/timepicker/localization/messages.mjs +0 -105
- package/esm2022/timepicker/localization/timepicker-custom-messages.component.mjs +0 -54
- package/esm2022/timepicker/localization/timepicker-localized-messages.directive.mjs +0 -39
- package/esm2022/timepicker/localization/timeselector-custom-messages.component.mjs +0 -45
- package/esm2022/timepicker/localization/timeselector-localized-messages.directive.mjs +0 -39
- package/esm2022/timepicker/models/incremental-steps.model.mjs +0 -5
- package/esm2022/timepicker/models/list-item.interface.mjs +0 -5
- package/esm2022/timepicker/models/list-service-settings.mjs +0 -5
- package/esm2022/timepicker/models/list-service.interface.mjs +0 -5
- package/esm2022/timepicker/models/time-part.default.mjs +0 -14
- package/esm2022/timepicker/services/dayperiod.service.mjs +0 -131
- package/esm2022/timepicker/services/dom.service.mjs +0 -126
- package/esm2022/timepicker/services/hours.service.mjs +0 -130
- package/esm2022/timepicker/services/milliseconds.service.mjs +0 -131
- package/esm2022/timepicker/services/minutes.service.mjs +0 -128
- package/esm2022/timepicker/services/seconds.service.mjs +0 -128
- package/esm2022/timepicker/timelist.component.mjs +0 -388
- package/esm2022/timepicker/timepicker.component.mjs +0 -1598
- package/esm2022/timepicker/timepicker.module.mjs +0 -71
- package/esm2022/timepicker/timeselector.component.mjs +0 -728
- package/esm2022/timepicker/util.mjs +0 -70
- package/esm2022/util.mjs +0 -406
- package/esm2022/validators/disabled-date.validator.mjs +0 -18
- package/esm2022/validators/disabled-dates-range.validator.mjs +0 -26
- package/esm2022/validators/incomplete-date.validator.mjs +0 -18
- package/esm2022/validators/max.validator.mjs +0 -21
- package/esm2022/validators/min.validator.mjs +0 -21
- package/esm2022/validators/time-range.validator.mjs +0 -23
- package/esm2022/virtualization/models/scrollable.interface.mjs +0 -5
- package/esm2022/virtualization/services/row-height.service.mjs +0 -73
- package/esm2022/virtualization/services/scroller.service.mjs +0 -109
- package/esm2022/virtualization/virtualization.component.mjs +0 -324
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { cloneDate } from '@progress/kendo-date-math';
|
|
6
|
-
import { TIME_PART } from './models/time-part.default';
|
|
7
|
-
const isEqualTillMinute = (value, min) => value.getHours() === min.getHours() && value.getMinutes() === min.getMinutes();
|
|
8
|
-
const isEqualTillSecond = (value, min) => isEqualTillMinute(value, min) && value.getSeconds() === min.getSeconds();
|
|
9
|
-
const isEqualTillMillisecond = (value, min) => isEqualTillSecond(value, min) && value.getMilliseconds() === min.getMilliseconds();
|
|
10
|
-
const defaultGetters = [
|
|
11
|
-
{
|
|
12
|
-
type: TIME_PART.hour,
|
|
13
|
-
getter: (value) => value.getHours(),
|
|
14
|
-
minGetter: (_, min) => min.getHours()
|
|
15
|
-
}, {
|
|
16
|
-
type: TIME_PART.minute,
|
|
17
|
-
getter: (value) => value.getMinutes(),
|
|
18
|
-
minGetter: (value, min) => isEqualTillMinute(value, min) ? min.getMinutes() : 0
|
|
19
|
-
}, {
|
|
20
|
-
type: TIME_PART.second,
|
|
21
|
-
getter: (value) => value.getSeconds(),
|
|
22
|
-
minGetter: (value, min) => isEqualTillSecond(value, min) ? min.getSeconds() : 0
|
|
23
|
-
}, {
|
|
24
|
-
type: TIME_PART.millisecond,
|
|
25
|
-
getter: (value) => value.getMilliseconds(),
|
|
26
|
-
minGetter: (value, min) => isEqualTillMillisecond(value, min) ? min.getMilliseconds() : 0
|
|
27
|
-
}
|
|
28
|
-
];
|
|
29
|
-
const left = getter => (origin, _) => getter(origin);
|
|
30
|
-
const right = getter => (_, candidate) => getter(candidate);
|
|
31
|
-
const convertToObject = (parts) => parts.reduce((obj, p) => { obj[p.type] = p.type; return obj; }, {});
|
|
32
|
-
const getterByPart = parts => g => parts[g.type] ? right(g.getter) : left(g.getter);
|
|
33
|
-
const gettersFactory = getters => parts => (getters.map(getterByPart(convertToObject(parts))));
|
|
34
|
-
const snapValue = (getter, minGetter, step) => (date, min) => {
|
|
35
|
-
const value = getter(date);
|
|
36
|
-
const minValue = minGetter(date, min);
|
|
37
|
-
const rest = value - minValue;
|
|
38
|
-
if (rest < 0) {
|
|
39
|
-
return minValue;
|
|
40
|
-
}
|
|
41
|
-
const mod = rest % step;
|
|
42
|
-
return value - mod + (mod > step / 2 ? step : 0);
|
|
43
|
-
};
|
|
44
|
-
const snappersFactory = (getters) => steps => (getters.map(g => {
|
|
45
|
-
const step = steps[g.type];
|
|
46
|
-
return step ? snapValue(g.getter, g.minGetter, step) : g.getter;
|
|
47
|
-
}));
|
|
48
|
-
/**
|
|
49
|
-
* @hidden
|
|
50
|
-
*/
|
|
51
|
-
export const generateGetters = gettersFactory(defaultGetters);
|
|
52
|
-
/**
|
|
53
|
-
* @hidden
|
|
54
|
-
*/
|
|
55
|
-
export const generateSnappers = snappersFactory(defaultGetters);
|
|
56
|
-
/**
|
|
57
|
-
* @hidden
|
|
58
|
-
*/
|
|
59
|
-
export const valueMerger = getters => (origin, candidate) => {
|
|
60
|
-
origin.setHours(...getters.map(g => g(origin, candidate)));
|
|
61
|
-
return origin;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* @hidden
|
|
65
|
-
*/
|
|
66
|
-
export const snapTime = snappers => (candidate, min) => {
|
|
67
|
-
const date = cloneDate(candidate);
|
|
68
|
-
date.setHours(...snappers.map(s => s(date, min)));
|
|
69
|
-
return date;
|
|
70
|
-
};
|
package/esm2022/util.mjs
DELETED
|
@@ -1,406 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { MS_PER_HOUR, MS_PER_MINUTE, addDays, cloneDate, getDate, isEqual } from '@progress/kendo-date-math';
|
|
6
|
-
import { MIDNIGHT_DATE } from './defaults';
|
|
7
|
-
import { EMPTY_SELECTIONRANGE } from './calendar/models/selection-range.interface';
|
|
8
|
-
import { isPresent } from './common/utils';
|
|
9
|
-
const isSet = (value) => value !== null && value !== undefined;
|
|
10
|
-
const setter = (method) => (date, value) => {
|
|
11
|
-
const clone = cloneDate(date);
|
|
12
|
-
clone[method](value);
|
|
13
|
-
return clone;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* @hidden
|
|
17
|
-
*/
|
|
18
|
-
export const setTime = (origin, candidate) => {
|
|
19
|
-
const date = cloneDate(origin);
|
|
20
|
-
date.setHours(candidate.getHours(), candidate.getMinutes(), candidate.getSeconds(), candidate.getMilliseconds());
|
|
21
|
-
return date;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* @hidden
|
|
25
|
-
*/
|
|
26
|
-
const getTimeInMilliseconds = (candidate) => {
|
|
27
|
-
const hoursInMilliseconds = candidate.getHours() * MS_PER_HOUR;
|
|
28
|
-
const minutesInMilliseconds = candidate.getMinutes() * MS_PER_MINUTE;
|
|
29
|
-
const secondsInMilliseconds = candidate.getSeconds() * 1000;
|
|
30
|
-
return hoursInMilliseconds + minutesInMilliseconds + secondsInMilliseconds + candidate.getMilliseconds();
|
|
31
|
-
};
|
|
32
|
-
const normalizeTimes = (candidate, min, max) => {
|
|
33
|
-
return {
|
|
34
|
-
candidateValue: setTime(MIDNIGHT_DATE, candidate),
|
|
35
|
-
maxValue: addDays(setTime(MIDNIGHT_DATE, max), getTimeInMilliseconds(min) < getTimeInMilliseconds(max) ? 0 : 1),
|
|
36
|
-
minValue: setTime(MIDNIGHT_DATE, min)
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* @hidden
|
|
41
|
-
*/
|
|
42
|
-
export const setYears = setter('setFullYear');
|
|
43
|
-
/**
|
|
44
|
-
* @hidden
|
|
45
|
-
*/
|
|
46
|
-
export const setHours = setter('setHours');
|
|
47
|
-
/**
|
|
48
|
-
* @hidden
|
|
49
|
-
*/
|
|
50
|
-
export const setMinutes = setter('setMinutes');
|
|
51
|
-
/**
|
|
52
|
-
* @hidden
|
|
53
|
-
*/
|
|
54
|
-
export const setSeconds = setter('setSeconds');
|
|
55
|
-
/**
|
|
56
|
-
* @hidden
|
|
57
|
-
*/
|
|
58
|
-
export const setMilliseconds = setter('setMilliseconds');
|
|
59
|
-
/**
|
|
60
|
-
* @hidden
|
|
61
|
-
*/
|
|
62
|
-
export const range = (start, end, step = 1) => {
|
|
63
|
-
const result = [];
|
|
64
|
-
for (let i = start; i < end; i = i + step) {
|
|
65
|
-
result.push(i);
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* @hidden
|
|
71
|
-
*/
|
|
72
|
-
export const isInRange = (candidate, min, max) => (!candidate || !((min && min > candidate) || (max && max < candidate)));
|
|
73
|
-
/**
|
|
74
|
-
* @hidden
|
|
75
|
-
*/
|
|
76
|
-
export const isInTimeRange = (candidate, min, max) => {
|
|
77
|
-
if (!candidate || !min || !max) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
const { candidateValue, minValue, maxValue } = normalizeTimes(candidate, min, max);
|
|
81
|
-
return minValue <= candidateValue && candidateValue <= maxValue;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* @hidden
|
|
85
|
-
*/
|
|
86
|
-
export const isValidRange = (min, max) => (!isSet(min) || !isSet(max) || min <= max);
|
|
87
|
-
/**
|
|
88
|
-
* @hidden
|
|
89
|
-
*/
|
|
90
|
-
export const dateInRange = (candidate, min, max) => {
|
|
91
|
-
if (!candidate) {
|
|
92
|
-
return candidate;
|
|
93
|
-
}
|
|
94
|
-
if (min && candidate < min) {
|
|
95
|
-
return cloneDate(min);
|
|
96
|
-
}
|
|
97
|
-
if (max && candidate > max) {
|
|
98
|
-
return cloneDate(max);
|
|
99
|
-
}
|
|
100
|
-
return candidate;
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* @hidden
|
|
104
|
-
*/
|
|
105
|
-
export const timeInRange = (candidate, min, max) => {
|
|
106
|
-
if (!candidate || !min || !max) {
|
|
107
|
-
return candidate;
|
|
108
|
-
}
|
|
109
|
-
const { candidateValue, minValue, maxValue } = normalizeTimes(candidate, min, max);
|
|
110
|
-
if (candidateValue < minValue) {
|
|
111
|
-
return setTime(candidate, min);
|
|
112
|
-
}
|
|
113
|
-
if (candidateValue > maxValue) {
|
|
114
|
-
return setTime(candidate, max);
|
|
115
|
-
}
|
|
116
|
-
return candidate;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* @hidden
|
|
120
|
-
*/
|
|
121
|
-
export const getNow = () => new Date();
|
|
122
|
-
/**
|
|
123
|
-
* @hidden
|
|
124
|
-
*/
|
|
125
|
-
export const getToday = () => getDate(new Date());
|
|
126
|
-
/**
|
|
127
|
-
* @hidden
|
|
128
|
-
*/
|
|
129
|
-
export const noop = (_) => { }; // eslint-disable-line no-empty
|
|
130
|
-
/**
|
|
131
|
-
* @hidden
|
|
132
|
-
*/
|
|
133
|
-
export const isWindowAvailable = () => {
|
|
134
|
-
return typeof window !== 'undefined';
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* @hidden
|
|
138
|
-
*/
|
|
139
|
-
export const stringifyClassObject = (classes) => {
|
|
140
|
-
const pushToAcc = (acc, cls) => classes[cls] ? acc.concat(cls) : acc;
|
|
141
|
-
return Object.keys(classes).reduce(pushToAcc, []).join(' ');
|
|
142
|
-
};
|
|
143
|
-
/**
|
|
144
|
-
* @hidden
|
|
145
|
-
*/
|
|
146
|
-
export const shiftWeekNames = (names, offset) => (names.slice(offset).concat(names.slice(0, offset)));
|
|
147
|
-
/**
|
|
148
|
-
* @hidden
|
|
149
|
-
*/
|
|
150
|
-
export const approximateStringMatching = (oldTextOrigin, oldFormat, newTextOrigin, caret) => {
|
|
151
|
-
// Remove the right part of the cursor.
|
|
152
|
-
//oldFormat = oldFormat.substring(0, caret + oldText.length - newText.length);
|
|
153
|
-
const oldIndex = caret + oldTextOrigin.length - newTextOrigin.length;
|
|
154
|
-
const oldTextSeparator = oldTextOrigin[oldIndex];
|
|
155
|
-
const oldText = oldTextOrigin.substring(0, caret + oldTextOrigin.length - newTextOrigin.length);
|
|
156
|
-
const newText = newTextOrigin.substring(0, caret);
|
|
157
|
-
const diff = [];
|
|
158
|
-
// Handle typing a single character over the same selection.
|
|
159
|
-
if (oldText === newText && caret > 0) {
|
|
160
|
-
diff.push([oldFormat[caret - 1], newText[caret - 1]]);
|
|
161
|
-
return diff;
|
|
162
|
-
}
|
|
163
|
-
if (oldText.startsWith(newText) && (newText.length === 0 || oldFormat[newText.length - 1] !== oldFormat[newText.length])) {
|
|
164
|
-
// Handle Delete/Backspace.
|
|
165
|
-
let deletedSymbol = "";
|
|
166
|
-
//XXX:
|
|
167
|
-
// Whole text is replaced with a same char
|
|
168
|
-
// Nasty patch required to keep the selection in the first segment
|
|
169
|
-
if (newText.length === 1) {
|
|
170
|
-
diff.push([oldFormat[0], newText[0]]);
|
|
171
|
-
}
|
|
172
|
-
for (let i = newText.length; i < oldText.length; i++) {
|
|
173
|
-
if (oldFormat[i] !== deletedSymbol && oldFormat[i] !== "_") {
|
|
174
|
-
deletedSymbol = oldFormat[i];
|
|
175
|
-
diff.push([deletedSymbol, ""]);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return diff;
|
|
179
|
-
}
|
|
180
|
-
// Handle inserting text (the new text is longer than the previous one).
|
|
181
|
-
// Handle typing over a literal as well.
|
|
182
|
-
if (newText.startsWith(oldText) || oldFormat[caret - 1] === "_") {
|
|
183
|
-
let symbol = oldFormat[0];
|
|
184
|
-
for (let i = Math.max(0, oldText.length - 1); i < oldFormat.length; i++) {
|
|
185
|
-
if (oldFormat[i] !== "_") {
|
|
186
|
-
symbol = oldFormat[i];
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return [[symbol, newText[caret - 1]]];
|
|
191
|
-
}
|
|
192
|
-
// Handle entering a space or a separator, for navigation to the next item.
|
|
193
|
-
if (newText.endsWith(" ") || (newText.endsWith(oldTextSeparator) && oldFormat[oldIndex] === '_')) {
|
|
194
|
-
return [[oldFormat[caret - 1], "_"]];
|
|
195
|
-
}
|
|
196
|
-
// Handle typing over a correctly selected part.
|
|
197
|
-
return [[oldFormat[caret - 1], newText[caret - 1]]];
|
|
198
|
-
};
|
|
199
|
-
/**
|
|
200
|
-
* @hidden
|
|
201
|
-
*/
|
|
202
|
-
export const domContainerFactory = (type) => (children, classes = "", styles = {}) => {
|
|
203
|
-
const container = document.createElement(type);
|
|
204
|
-
container.className = classes;
|
|
205
|
-
Object.keys(styles).forEach(key => container.style[key] = styles[key]);
|
|
206
|
-
if (typeof children === 'string') {
|
|
207
|
-
container.innerHTML = children || '';
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
(children || []).forEach(child => child && container.appendChild(child));
|
|
211
|
-
}
|
|
212
|
-
return container;
|
|
213
|
-
};
|
|
214
|
-
/**
|
|
215
|
-
* @hidden
|
|
216
|
-
*/
|
|
217
|
-
export const hasChange = (changes, field) => changes[field] !== undefined;
|
|
218
|
-
/**
|
|
219
|
-
* @hidden
|
|
220
|
-
*/
|
|
221
|
-
export const hasExistingValue = (changes, field) => changes[field] && changes[field].currentValue !== undefined && changes[field].currentValue !== null;
|
|
222
|
-
/**
|
|
223
|
-
* @hidden
|
|
224
|
-
*/
|
|
225
|
-
export const last = (list = []) => list && list[list.length - 1];
|
|
226
|
-
/**
|
|
227
|
-
* @hidden
|
|
228
|
-
*/
|
|
229
|
-
export const isInSelectionRange = (value, selectionRange) => {
|
|
230
|
-
const { start, end } = selectionRange || EMPTY_SELECTIONRANGE;
|
|
231
|
-
if (!start || !end) {
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
|
-
return start < value && value < end;
|
|
235
|
-
};
|
|
236
|
-
/**
|
|
237
|
-
* @hidden
|
|
238
|
-
*/
|
|
239
|
-
export const either = (value1, value2) => value1 || value2;
|
|
240
|
-
/**
|
|
241
|
-
* @hidden
|
|
242
|
-
*/
|
|
243
|
-
export const clampRange = (value) => ({ start: value, end: value });
|
|
244
|
-
/**
|
|
245
|
-
* @hidden
|
|
246
|
-
*/
|
|
247
|
-
export const isEqualRange = (initial, updated) => {
|
|
248
|
-
const { start: initialStart, end: initialEnd } = initial || EMPTY_SELECTIONRANGE;
|
|
249
|
-
const { start: updatedStart, end: updatedEnd } = updated || EMPTY_SELECTIONRANGE;
|
|
250
|
-
return isEqual(initialStart, updatedStart) && isEqual(initialEnd, updatedEnd);
|
|
251
|
-
};
|
|
252
|
-
/**
|
|
253
|
-
* @hidden
|
|
254
|
-
*/
|
|
255
|
-
export const areDatesEqual = (first, second) => {
|
|
256
|
-
first = first || [];
|
|
257
|
-
second = second || [];
|
|
258
|
-
return first.length === second.length && first.every((date, index) => isEqual(date, second[index]));
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* @hidden
|
|
262
|
-
*/
|
|
263
|
-
export const sortDates = (dates) => {
|
|
264
|
-
return dates.filter(date => isPresent(date)).sort((a, b) => a.getTime() - b.getTime());
|
|
265
|
-
};
|
|
266
|
-
/**
|
|
267
|
-
* @hidden
|
|
268
|
-
*
|
|
269
|
-
* Creates a new date based on the date information from the specified date portion
|
|
270
|
-
* and the time information from the time portion.
|
|
271
|
-
* If a parameter is not provided, returns `null`.
|
|
272
|
-
*/
|
|
273
|
-
export const mergeDateAndTime = (date, time) => {
|
|
274
|
-
if (!(date && time)) {
|
|
275
|
-
return null;
|
|
276
|
-
}
|
|
277
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds());
|
|
278
|
-
};
|
|
279
|
-
/**
|
|
280
|
-
* @hidden
|
|
281
|
-
*/
|
|
282
|
-
export const lastMillisecondOfDate = (date) => {
|
|
283
|
-
if (!date) {
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59, 999);
|
|
287
|
-
};
|
|
288
|
-
/**
|
|
289
|
-
* @hidden
|
|
290
|
-
*
|
|
291
|
-
* Returns an array with dates ranging between and including the specified start and
|
|
292
|
-
* end dates that are evaluated as disabled.
|
|
293
|
-
*/
|
|
294
|
-
export const disabledDatesInRange = (start, end, isDateDisabled) => {
|
|
295
|
-
if (!(start && end && isDateDisabled) || (start > end)) {
|
|
296
|
-
return [];
|
|
297
|
-
}
|
|
298
|
-
const dates = [];
|
|
299
|
-
let current = start;
|
|
300
|
-
while (current <= end) {
|
|
301
|
-
if (isDateDisabled(current)) {
|
|
302
|
-
dates.push(current);
|
|
303
|
-
}
|
|
304
|
-
current = addDays(current, 1);
|
|
305
|
-
}
|
|
306
|
-
return dates;
|
|
307
|
-
};
|
|
308
|
-
/**
|
|
309
|
-
* @hidden
|
|
310
|
-
*
|
|
311
|
-
* Crops the last two digits from the year of the provided date value.
|
|
312
|
-
*/
|
|
313
|
-
export const cropTwoDigitYear = (date) => {
|
|
314
|
-
if (!isPresent(date) || isNaN(date.getTime())) {
|
|
315
|
-
return 0;
|
|
316
|
-
}
|
|
317
|
-
return Number(date
|
|
318
|
-
.getFullYear()
|
|
319
|
-
.toString()
|
|
320
|
-
.slice(-2));
|
|
321
|
-
};
|
|
322
|
-
/**
|
|
323
|
-
* @hidden
|
|
324
|
-
*
|
|
325
|
-
* Used when resetting millisecond segment value in the DateInput
|
|
326
|
-
*/
|
|
327
|
-
export const msPaddingFromFormat = (format) => {
|
|
328
|
-
return Array(format.match(/S+(\1)/)[0].length).join("0"); // eslint-disable-line no-useless-backreference
|
|
329
|
-
};
|
|
330
|
-
/**
|
|
331
|
-
* @hidden
|
|
332
|
-
*/
|
|
333
|
-
export const millisecondDigitsInFormat = (format) => {
|
|
334
|
-
const result = format && format.match(/S+(\1)/); // eslint-disable-line no-useless-backreference
|
|
335
|
-
return result ? result[0].length : 0;
|
|
336
|
-
};
|
|
337
|
-
/**
|
|
338
|
-
* @hidden
|
|
339
|
-
*/
|
|
340
|
-
export const millisecondStepFor = (digits) => {
|
|
341
|
-
return Math.pow(10, 3 - digits);
|
|
342
|
-
};
|
|
343
|
-
/**
|
|
344
|
-
* @hidden
|
|
345
|
-
*
|
|
346
|
-
* Checks if a tab keydown would would move the focus outside of the calendar.
|
|
347
|
-
*/
|
|
348
|
-
export const isTabExitingCalendar = (calendarType, focusedElement, shiftKey) => {
|
|
349
|
-
if (!isPresent(focusedElement)) {
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
return calendarType === 'infinite' || ( // infinte calendar is always exited on first tab keydown
|
|
353
|
-
calendarType === 'classic' &&
|
|
354
|
-
(shiftKey && focusedElement.classList.contains('k-calendar-table')) || // exited on main calendar element focused and back-tab
|
|
355
|
-
(!shiftKey && focusedElement.classList.contains('k-calendar-table')) // exited on next button focused and regular tab
|
|
356
|
-
);
|
|
357
|
-
};
|
|
358
|
-
/**
|
|
359
|
-
* @hidden
|
|
360
|
-
* Returns the size class based on the component and size input.
|
|
361
|
-
*/
|
|
362
|
-
export const getSizeClass = (component, size) => {
|
|
363
|
-
const SIZE_CLASSES = {
|
|
364
|
-
'small': `k-${component}-sm`,
|
|
365
|
-
'medium': `k-${component}-md`,
|
|
366
|
-
'large': `k-${component}-lg`
|
|
367
|
-
};
|
|
368
|
-
return SIZE_CLASSES[size];
|
|
369
|
-
};
|
|
370
|
-
/**
|
|
371
|
-
* @hidden
|
|
372
|
-
* Returns the rounded class based on the rounded input.
|
|
373
|
-
*/
|
|
374
|
-
export const getRoundedClass = (rounded) => {
|
|
375
|
-
const ROUNDED_CLASSES = {
|
|
376
|
-
'small': 'k-rounded-sm',
|
|
377
|
-
'medium': 'k-rounded-md',
|
|
378
|
-
'large': 'k-rounded-lg',
|
|
379
|
-
'full': 'k-rounded-full'
|
|
380
|
-
};
|
|
381
|
-
return ROUNDED_CLASSES[rounded];
|
|
382
|
-
};
|
|
383
|
-
/**
|
|
384
|
-
* @hidden
|
|
385
|
-
* Return the fillMode class based on the component and fillMode input.
|
|
386
|
-
*/
|
|
387
|
-
export const getFillModeClass = (component, fillMode) => {
|
|
388
|
-
const FILLMODE_CLASSES = {
|
|
389
|
-
'solid': `k-${component}-solid`,
|
|
390
|
-
'flat': `k-${component}-flat`,
|
|
391
|
-
'outline': `k-${component}-outline`
|
|
392
|
-
};
|
|
393
|
-
return FILLMODE_CLASSES[fillMode];
|
|
394
|
-
};
|
|
395
|
-
/**
|
|
396
|
-
* @hidden
|
|
397
|
-
*/
|
|
398
|
-
export const DEFAULT_ROUNDED = 'medium';
|
|
399
|
-
/**
|
|
400
|
-
* @hidden
|
|
401
|
-
*/
|
|
402
|
-
export const DEFAULT_SIZE = 'medium';
|
|
403
|
-
/**
|
|
404
|
-
* @hidden
|
|
405
|
-
*/
|
|
406
|
-
export const DEFAULT_FILL_MODE = 'solid';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
export const disabledDatesValidator = (isDateDisabled) => {
|
|
9
|
-
return (control) => {
|
|
10
|
-
if (!isDateDisabled || !control.value) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
const error = {
|
|
14
|
-
disabledDate: true
|
|
15
|
-
};
|
|
16
|
-
return isDateDisabled(control.value) ? error : null;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { disabledDatesInRange } from '../util';
|
|
6
|
-
import { isPresent } from '../common/utils';
|
|
7
|
-
const noop = () => null;
|
|
8
|
-
/**
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
export const disabledDatesRangeValidator = (isDateDisabled) => {
|
|
12
|
-
if (!isPresent(isDateDisabled)) {
|
|
13
|
-
return noop;
|
|
14
|
-
}
|
|
15
|
-
return (selectedRange) => {
|
|
16
|
-
const isRangeComplete = isPresent(selectedRange) && isPresent(selectedRange.start) && isPresent(selectedRange.end);
|
|
17
|
-
if (!isRangeComplete || selectedRange.start > selectedRange.end) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
const disabledDates = disabledDatesInRange(selectedRange.start, selectedRange.end, isDateDisabled);
|
|
21
|
-
const error = {
|
|
22
|
-
disabledDatesInRange: disabledDates
|
|
23
|
-
};
|
|
24
|
-
return disabledDates.length ? error : null;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { isPresent } from '../common/utils';
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
export const incompleteDateValidator = () => {
|
|
10
|
-
return (control, incomplete) => {
|
|
11
|
-
if (!isPresent(control.value) && incomplete) {
|
|
12
|
-
return { incompleteDate: true };
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
export const maxValidator = (maxValue) => {
|
|
9
|
-
return (control) => {
|
|
10
|
-
const err = {
|
|
11
|
-
maxError: {
|
|
12
|
-
maxValue: maxValue,
|
|
13
|
-
value: control.value
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
if (!maxValue || !control.value) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return control.value > maxValue ? err : null;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
export const minValidator = (minValue) => {
|
|
9
|
-
return (control) => {
|
|
10
|
-
const err = {
|
|
11
|
-
minError: {
|
|
12
|
-
minValue: minValue,
|
|
13
|
-
value: control.value
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
if (!minValue || !control.value) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return control.value < minValue ? err : null;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { isInTimeRange } from '../util';
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
export const timeRangeValidator = (min, max) => {
|
|
10
|
-
return (control) => {
|
|
11
|
-
if (!min || !max || !control.value) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
const err = {
|
|
15
|
-
timeRangeError: {
|
|
16
|
-
maxValue: max,
|
|
17
|
-
minValue: min,
|
|
18
|
-
value: control.value
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
return isInTimeRange(control.value, min, max) ? null : err;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
export {};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
const update = (arr, idx, value) => ([
|
|
9
|
-
...arr.slice(0, idx + 1),
|
|
10
|
-
...(arr.slice(idx + 1).map(x => x + value))
|
|
11
|
-
]);
|
|
12
|
-
/**
|
|
13
|
-
* @hidden
|
|
14
|
-
*/
|
|
15
|
-
export class RowHeightService {
|
|
16
|
-
total;
|
|
17
|
-
rowHeight;
|
|
18
|
-
detailRowHeight;
|
|
19
|
-
offsets = [];
|
|
20
|
-
heights = [];
|
|
21
|
-
constructor(total = 0, rowHeight, detailRowHeight) {
|
|
22
|
-
this.total = total;
|
|
23
|
-
this.rowHeight = rowHeight;
|
|
24
|
-
this.detailRowHeight = detailRowHeight;
|
|
25
|
-
let agg = 0;
|
|
26
|
-
for (let idx = 0; idx < total; idx++) {
|
|
27
|
-
this.offsets.push(agg);
|
|
28
|
-
agg += rowHeight;
|
|
29
|
-
this.heights.push(rowHeight);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
height(rowIndex) {
|
|
33
|
-
return this.heights[rowIndex];
|
|
34
|
-
}
|
|
35
|
-
expandDetail(rowIndex) {
|
|
36
|
-
if (this.height(rowIndex) === this.rowHeight) {
|
|
37
|
-
this.updateRowHeight(rowIndex, this.detailRowHeight);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
collapseDetail(rowIndex) {
|
|
41
|
-
if (this.height(rowIndex) > this.rowHeight) {
|
|
42
|
-
this.updateRowHeight(rowIndex, this.detailRowHeight * -1);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
index(position) {
|
|
46
|
-
if (position < 0) {
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
const result = this.offsets.reduce((prev, current, idx) => {
|
|
50
|
-
if (prev !== undefined) {
|
|
51
|
-
return prev;
|
|
52
|
-
}
|
|
53
|
-
else if (current === position) {
|
|
54
|
-
return idx;
|
|
55
|
-
}
|
|
56
|
-
else if (current > position) {
|
|
57
|
-
return idx - 1;
|
|
58
|
-
}
|
|
59
|
-
return undefined;
|
|
60
|
-
}, undefined);
|
|
61
|
-
return result === undefined ? this.total - 1 : result;
|
|
62
|
-
}
|
|
63
|
-
offset(rowIndex) {
|
|
64
|
-
return this.offsets[rowIndex];
|
|
65
|
-
}
|
|
66
|
-
totalHeight() {
|
|
67
|
-
return this.heights.reduce((prev, curr) => prev + curr, 0);
|
|
68
|
-
}
|
|
69
|
-
updateRowHeight(rowIndex, value) {
|
|
70
|
-
this.heights[rowIndex] += value;
|
|
71
|
-
this.offsets = update(this.offsets, rowIndex, value);
|
|
72
|
-
}
|
|
73
|
-
}
|