igniteui-webcomponents 7.1.3 → 7.2.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/CHANGELOG.md +41 -0
- package/components/banner/banner.d.ts +53 -17
- package/components/banner/banner.js +5 -0
- package/components/banner/banner.js.map +1 -1
- package/components/button/button-base.d.ts +80 -26
- package/components/button/button-base.js +64 -23
- package/components/button/button-base.js.map +1 -1
- package/components/button/button.d.ts +12 -3
- package/components/button/button.js +1 -1
- package/components/button/button.js.map +1 -1
- package/components/button/icon-button.d.ts +25 -9
- package/components/button/icon-button.js +2 -2
- package/components/button/icon-button.js.map +1 -1
- package/components/button-group/themes/shared/button/button.common.css.js +1 -1
- package/components/button-group/themes/shared/button/button.common.css.js.map +1 -1
- package/components/button-group/themes/shared/button/button.indigo.css.js +1 -1
- package/components/button-group/themes/shared/button/button.indigo.css.js.map +1 -1
- package/components/calendar/base.d.ts +5 -4
- package/components/calendar/base.js +3 -2
- package/components/calendar/base.js.map +1 -1
- package/components/calendar/calendar.js +17 -13
- package/components/calendar/calendar.js.map +1 -1
- package/components/calendar/days-view/days-view.d.ts +1 -0
- package/components/calendar/days-view/days-view.js +7 -4
- package/components/calendar/days-view/days-view.js.map +1 -1
- package/components/calendar/helpers.d.ts +1 -1
- package/components/calendar/helpers.js.map +1 -1
- package/components/chat/chat-message.js +8 -8
- package/components/chat/chat-message.js.map +1 -1
- package/components/chat/chat-state.d.ts +3 -1
- package/components/chat/chat-state.js +3 -2
- package/components/chat/chat-state.js.map +1 -1
- package/components/chat/chat.d.ts +5 -1
- package/components/chat/chat.js +14 -4
- package/components/chat/chat.js.map +1 -1
- package/components/checkbox/checkbox.js +1 -0
- package/components/checkbox/checkbox.js.map +1 -1
- package/components/checkbox/switch.js +1 -0
- package/components/checkbox/switch.js.map +1 -1
- package/components/combo/combo.d.ts +1 -0
- package/components/combo/combo.js +7 -0
- package/components/combo/combo.js.map +1 -1
- package/components/combo/controllers/navigation.js +3 -0
- package/components/combo/controllers/navigation.js.map +1 -1
- package/components/common/controllers/command.d.ts +62 -0
- package/components/common/controllers/command.js +25 -0
- package/components/common/controllers/command.js.map +1 -0
- package/components/common/controllers/id-resolver.d.ts +31 -0
- package/components/common/controllers/id-resolver.js +136 -0
- package/components/common/controllers/id-resolver.js.map +1 -0
- package/components/common/i18n/EN/calendar.resources.d.ts +16 -14
- package/components/common/i18n/EN/calendar.resources.js +1 -1
- package/components/common/i18n/EN/calendar.resources.js.map +1 -1
- package/components/common/i18n/EN/chat.resources.d.ts +10 -8
- package/components/common/i18n/EN/chat.resources.js.map +1 -1
- package/components/common/i18n/EN/date-picker.resources.d.ts +8 -0
- package/components/common/i18n/EN/date-picker.resources.js +8 -0
- package/components/common/i18n/EN/date-picker.resources.js.map +1 -0
- package/components/common/i18n/EN/date-range-picker.resources.d.ts +9 -7
- package/components/common/i18n/EN/date-range-picker.resources.js +1 -1
- package/components/common/i18n/EN/date-range-picker.resources.js.map +1 -1
- package/components/common/i18n/i18n-controller.d.ts +14 -11
- package/components/common/i18n/i18n-controller.js +33 -41
- package/components/common/i18n/i18n-controller.js.map +1 -1
- package/components/common/i18n/utils.d.ts +8 -2
- package/components/common/i18n/utils.js +52 -44
- package/components/common/i18n/utils.js.map +1 -1
- package/components/common/mixins/alert.d.ts +47 -9
- package/components/common/mixins/alert.js +55 -12
- package/components/common/mixins/alert.js.map +1 -1
- package/components/common/mixins/forms/associated.js +11 -0
- package/components/common/mixins/forms/associated.js.map +1 -1
- package/components/common/mixins/forms/form-transformers.d.ts +1 -1
- package/components/common/mixins/forms/form-transformers.js.map +1 -1
- package/components/common/mixins/forms/types.d.ts +5 -0
- package/components/common/mixins/forms/types.js.map +1 -1
- package/components/common/mixins/mask-behavior.d.ts +73 -0
- package/components/common/mixins/mask-behavior.js +159 -0
- package/components/common/mixins/mask-behavior.js.map +1 -0
- package/components/common/templates/input-shell.d.ts +24 -0
- package/components/common/templates/input-shell.js +43 -0
- package/components/common/templates/input-shell.js.map +1 -0
- package/components/common/templates/masked-input.d.ts +39 -0
- package/components/common/templates/masked-input.js +37 -0
- package/components/common/templates/masked-input.js.map +1 -0
- package/components/common/util.d.ts +11 -0
- package/components/common/util.js +20 -0
- package/components/common/util.js.map +1 -1
- package/components/date-picker/date-picker.d.ts +6 -4
- package/components/date-picker/date-picker.js +16 -5
- package/components/date-picker/date-picker.js.map +1 -1
- package/components/date-range-picker/date-range-input.d.ts +60 -0
- package/components/date-range-picker/date-range-input.js +251 -0
- package/components/date-range-picker/date-range-input.js.map +1 -0
- package/components/date-range-picker/date-range-mask-parser.d.ts +106 -0
- package/components/date-range-picker/date-range-mask-parser.js +121 -0
- package/components/date-range-picker/date-range-mask-parser.js.map +1 -0
- package/components/date-range-picker/date-range-picker.d.ts +17 -11
- package/components/date-range-picker/date-range-picker.js +89 -61
- package/components/date-range-picker/date-range-picker.js.map +1 -1
- package/components/date-range-picker/predefined-ranges-area.d.ts +4 -4
- package/components/date-range-picker/predefined-ranges-area.js +8 -4
- package/components/date-range-picker/predefined-ranges-area.js.map +1 -1
- package/components/date-range-picker/validators.d.ts +5 -19
- package/components/date-range-picker/validators.js +20 -16
- package/components/date-range-picker/validators.js.map +1 -1
- package/components/date-time-input/date-time-input.base.d.ts +155 -0
- package/components/date-time-input/date-time-input.base.js +275 -0
- package/components/date-time-input/date-time-input.base.js.map +1 -0
- package/components/date-time-input/date-time-input.d.ts +33 -122
- package/components/date-time-input/date-time-input.js +45 -258
- package/components/date-time-input/date-time-input.js.map +1 -1
- package/components/date-time-input/datetime-mask-parser.d.ts +11 -1
- package/components/date-time-input/datetime-mask-parser.js +5 -5
- package/components/date-time-input/datetime-mask-parser.js.map +1 -1
- package/components/dialog/dialog.d.ts +88 -31
- package/components/dialog/dialog.js +29 -31
- package/components/dialog/dialog.js.map +1 -1
- package/components/file-input/file-input.d.ts +1 -1
- package/components/input/input-base.d.ts +2 -10
- package/components/input/input-base.js +11 -57
- package/components/input/input-base.js.map +1 -1
- package/components/input/input.d.ts +1 -1
- package/components/input/input.js +1 -0
- package/components/input/input.js.map +1 -1
- package/components/input/themes/dark/input.shared.css.d.ts +1 -0
- package/components/input/themes/dark/input.shared.css.js +3 -0
- package/components/input/themes/dark/input.shared.css.js.map +1 -0
- package/components/input/themes/light/input.shared.css.js +1 -1
- package/components/input/themes/light/input.shared.css.js.map +1 -1
- package/components/input/themes/shared/input.common.css.js +1 -1
- package/components/input/themes/shared/input.common.css.js.map +1 -1
- package/components/input/themes/shared/input.material.css.js +1 -1
- package/components/input/themes/shared/input.material.css.js.map +1 -1
- package/components/input/themes/themes.js +4 -3
- package/components/input/themes/themes.js.map +1 -1
- package/components/mask-input/mask-input.d.ts +9 -4
- package/components/mask-input/mask-input.js +30 -36
- package/components/mask-input/mask-input.js.map +1 -1
- package/components/nav-drawer/nav-drawer.d.ts +93 -17
- package/components/nav-drawer/nav-drawer.js +148 -21
- package/components/nav-drawer/nav-drawer.js.map +1 -1
- package/components/nav-drawer/themes/container.base.css.js +1 -1
- package/components/nav-drawer/themes/container.base.css.js.map +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.common.css.js +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.common.css.js.map +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.fluent.css.js +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.fluent.css.js.map +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.indigo.css.js +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.indigo.css.js.map +1 -1
- package/components/radio/radio.js +1 -0
- package/components/radio/radio.js.map +1 -1
- package/components/snackbar/snackbar.d.ts +9 -5
- package/components/snackbar/snackbar.js +6 -8
- package/components/snackbar/snackbar.js.map +1 -1
- package/components/snackbar/themes/snackbar.base.css.js +1 -1
- package/components/snackbar/themes/snackbar.base.css.js.map +1 -1
- package/components/stepper/step.d.ts +1 -1
- package/components/stepper/step.js +4 -4
- package/components/stepper/step.js.map +1 -1
- package/components/toast/themes/toast.base.css.js +1 -1
- package/components/toast/themes/toast.base.css.js.map +1 -1
- package/components/toast/toast.d.ts +9 -2
- package/components/toast/toast.js +0 -2
- package/components/toast/toast.js.map +1 -1
- package/components/types.d.ts +4 -0
- package/components/types.js.map +1 -1
- package/custom-elements.json +34882 -28909
- package/igniteui-webcomponents.css-data.json +1 -1
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +5 -2
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/skills/igniteui-wc-choose-components/SKILL.md +3 -6
- package/skills/igniteui-wc-generate-from-image-design/references/component-mapping.md +4 -2
- package/web-types.json +2 -2
- package/components/mask-input/mask-input-base.d.ts +0 -51
- package/components/mask-input/mask-input-base.js +0 -146
- package/components/mask-input/mask-input-base.js.map +0 -1
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import { type PropertyValues } from 'lit';
|
|
2
|
-
import type { AbstractConstructor } from '../common/mixins/constructor.js';
|
|
3
|
-
import type { IgcInputComponentEventMap } from '../input/input-base.js';
|
|
4
|
-
import { IgcMaskInputBaseComponent, type MaskSelection } from '../mask-input/mask-input-base.js';
|
|
5
1
|
import { DatePart, type DatePartDeltas } from './date-part.js';
|
|
2
|
+
import { IgcDateTimeInputBaseComponent, type IgcDateTimeInputComponentEventMap } from './date-time-input.base.js';
|
|
6
3
|
import { DateTimeMaskParser } from './datetime-mask-parser.js';
|
|
7
|
-
export interface IgcDateTimeInputComponentEventMap extends Omit<IgcInputComponentEventMap, 'igcChange'> {
|
|
8
|
-
igcChange: CustomEvent<Date | null>;
|
|
9
|
-
}
|
|
10
|
-
declare const IgcDateTimeInputComponent_base: import("../common/mixins/constructor.js").Constructor<import("../common/mixins/event-emitter.js").EventEmitterInterface<IgcDateTimeInputComponentEventMap>> & AbstractConstructor<IgcMaskInputBaseComponent>;
|
|
11
4
|
/**
|
|
12
5
|
* A date time input is an input field that lets you set and edit the date and time in a chosen input element
|
|
13
6
|
* using customizable display and input formats.
|
|
@@ -33,159 +26,79 @@ declare const IgcDateTimeInputComponent_base: import("../common/mixins/construct
|
|
|
33
26
|
* @csspart suffix - The suffix wrapper.
|
|
34
27
|
* @csspart helper-text - The helper text wrapper.
|
|
35
28
|
*/
|
|
36
|
-
export
|
|
29
|
+
export interface IgcDateTimeInputEventMap extends Omit<IgcDateTimeInputComponentEventMap, 'igcChange'> {
|
|
30
|
+
igcChange: CustomEvent<Date | null>;
|
|
31
|
+
}
|
|
32
|
+
export default class IgcDateTimeInputComponent extends IgcDateTimeInputBaseComponent {
|
|
37
33
|
static readonly tagName = "igc-date-time-input";
|
|
38
34
|
static styles: import("lit").CSSResult[];
|
|
39
35
|
static register(): void;
|
|
40
|
-
protected readonly _parser: DateTimeMaskParser;
|
|
41
|
-
private _defaultDisplayFormat;
|
|
42
|
-
private _displayFormat?;
|
|
43
|
-
private _inputFormat?;
|
|
44
|
-
private _oldValue;
|
|
45
|
-
private _min;
|
|
46
|
-
private _max;
|
|
47
|
-
private readonly _i18nController;
|
|
48
36
|
protected readonly _themes: import("../../theming/theming-controller.js").ThemingController;
|
|
49
|
-
protected readonly
|
|
37
|
+
protected readonly _parser: DateTimeMaskParser;
|
|
50
38
|
protected readonly _formValue: import("../common/mixins/forms/form-value.js").FormValue<Date | null>;
|
|
51
39
|
protected get __validators(): import("../common/validators.js").Validator<IgcDateTimeInputComponent>[];
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* When focused, returns the part under the cursor.
|
|
55
|
-
* When unfocused, returns a default part based on available parts.
|
|
56
|
-
*/
|
|
57
|
-
private get _targetDatePart();
|
|
58
|
-
private get _datePartDeltas();
|
|
59
|
-
/**
|
|
60
|
-
* The date format to apply on the input.
|
|
61
|
-
* @attr input-format
|
|
62
|
-
*/
|
|
63
|
-
set inputFormat(val: string);
|
|
64
|
-
get inputFormat(): string;
|
|
40
|
+
protected get _datePartDeltas(): DatePartDeltas;
|
|
41
|
+
protected _oldValue: Date | null;
|
|
65
42
|
/**
|
|
66
43
|
* The value of the input.
|
|
67
44
|
* @attr
|
|
68
45
|
*/
|
|
69
46
|
set value(value: Date | string | null | undefined);
|
|
70
47
|
get value(): Date | null;
|
|
71
|
-
/**
|
|
72
|
-
* The minimum value required for the input to remain valid.
|
|
73
|
-
* @attr
|
|
74
|
-
*/
|
|
75
|
-
set min(value: Date | string | null | undefined);
|
|
76
|
-
get min(): Date | null;
|
|
77
|
-
/**
|
|
78
|
-
* The maximum value required for the input to remain valid.
|
|
79
|
-
* @attr
|
|
80
|
-
*/
|
|
81
|
-
set max(value: Date | string | null | undefined);
|
|
82
|
-
get max(): Date | null;
|
|
83
|
-
/**
|
|
84
|
-
* Format to display the value in when not editing.
|
|
85
|
-
* Defaults to the locale format if not set.
|
|
86
|
-
* @attr display-format
|
|
87
|
-
*/
|
|
88
|
-
set displayFormat(value: string);
|
|
89
|
-
get displayFormat(): string;
|
|
90
|
-
/**
|
|
91
|
-
* Delta values used to increment or decrement each date part on step actions.
|
|
92
|
-
* All values default to `1`.
|
|
93
|
-
*/
|
|
94
|
-
spinDelta?: DatePartDeltas;
|
|
95
|
-
/**
|
|
96
|
-
* Sets whether to loop over the currently spun segment.
|
|
97
|
-
* @attr spin-loop
|
|
98
|
-
*/
|
|
99
|
-
spinLoop: boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Gets/Sets the locale used for formatting the display value.
|
|
102
|
-
* @attr locale
|
|
103
|
-
*/
|
|
104
|
-
set locale(value: string);
|
|
105
|
-
get locale(): string;
|
|
106
|
-
constructor();
|
|
107
|
-
protected update(props: PropertyValues<this>): void;
|
|
108
|
-
protected _resolvePartNames(base: string): {
|
|
109
|
-
[x: string]: boolean;
|
|
110
|
-
prefixed: boolean;
|
|
111
|
-
suffixed: boolean;
|
|
112
|
-
filled: boolean;
|
|
113
|
-
};
|
|
114
|
-
protected _updateSetRangeTextValue(): void;
|
|
115
|
-
private _emitInputEvent;
|
|
116
|
-
private _handleResourceChange;
|
|
117
|
-
protected _handleDragLeave(): void;
|
|
118
|
-
protected _handleDragEnter(): void;
|
|
119
|
-
private _handleWheel;
|
|
120
48
|
protected _handleFocus(): Promise<void>;
|
|
121
49
|
protected _handleBlur(): void;
|
|
122
|
-
protected _setCurrentDateTime(): void;
|
|
123
|
-
/**
|
|
124
|
-
* Navigates to the previous or next date part.
|
|
125
|
-
*/
|
|
126
|
-
protected _navigateParts(direction: number): void;
|
|
127
50
|
/**
|
|
128
51
|
* Calculates the new cursor position when navigating between date parts.
|
|
129
52
|
* direction = 0: navigate to start of previous part
|
|
130
53
|
* direction = 1: navigate to start of next part
|
|
131
54
|
*/
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Handles keyboard-triggered spinning (arrow up/down).
|
|
135
|
-
*/
|
|
136
|
-
protected _keyboardSpin(direction: 'up' | 'down'): Promise<void>;
|
|
55
|
+
protected _calculatePartNavigationPosition(inputValue: string, direction: number): number;
|
|
137
56
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
|
|
141
|
-
protected _updateMaskDisplay(): void;
|
|
142
|
-
protected _updateInput(text: string, { start, end }: MaskSelection): Promise<void>;
|
|
143
|
-
/**
|
|
144
|
-
* Common logic for stepping up or down a date part.
|
|
57
|
+
* Gets the date part at the current cursor position.
|
|
58
|
+
* Uses inclusive end to handle cursor at the end of the last part.
|
|
59
|
+
* Returns undefined if cursor is not within a valid date part.
|
|
145
60
|
*/
|
|
146
|
-
|
|
61
|
+
protected _getDatePartAtCursor(): DatePart | undefined;
|
|
147
62
|
/**
|
|
148
|
-
*
|
|
63
|
+
* Gets the default date part to target when the input is not focused.
|
|
64
|
+
* Prioritizes: Date > Hours > First available part
|
|
149
65
|
*/
|
|
150
|
-
|
|
66
|
+
protected _getDefaultDatePart(): DatePart | undefined;
|
|
151
67
|
/**
|
|
152
|
-
*
|
|
68
|
+
* Builds the masked value string from the current date value.
|
|
69
|
+
* Returns empty mask if no value, or existing masked value if incomplete.
|
|
153
70
|
*/
|
|
154
|
-
|
|
71
|
+
protected _buildMaskedValue(): string;
|
|
155
72
|
/**
|
|
156
|
-
*
|
|
73
|
+
* Builds the formatted display value shown when the input is not focused.
|
|
157
74
|
*/
|
|
158
|
-
|
|
75
|
+
protected _buildDisplayValue(): string;
|
|
159
76
|
/**
|
|
160
|
-
*
|
|
77
|
+
* Commits a value produced by spinning a date part.
|
|
161
78
|
*/
|
|
162
|
-
|
|
79
|
+
protected _commitSpunValue(value: unknown): void;
|
|
163
80
|
/**
|
|
164
|
-
*
|
|
165
|
-
* Returns empty mask if no value, or existing masked value if incomplete.
|
|
81
|
+
* Sets the value to the current date/time.
|
|
166
82
|
*/
|
|
167
|
-
|
|
168
|
-
protected _initializeDefaultMask(): void;
|
|
83
|
+
protected _setCurrentDateTime(): void;
|
|
169
84
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* Returns undefined if cursor is not within a valid date part.
|
|
85
|
+
* Emits an `igcInput` event whose `detail` is the parsed value as an ISO
|
|
86
|
+
* string (preserving the legacy contract for this component).
|
|
173
87
|
*/
|
|
174
|
-
|
|
88
|
+
protected _emitInputEvent(): void;
|
|
175
89
|
/**
|
|
176
|
-
*
|
|
177
|
-
* Prioritizes: Date > Hours > First available part
|
|
90
|
+
* Calculates the new date value after spinning a date part.
|
|
178
91
|
*/
|
|
179
|
-
|
|
92
|
+
protected _calculateSpunValue(datePart: DatePart, delta: number | undefined, isDecrement: boolean): Date;
|
|
180
93
|
/**
|
|
181
|
-
*
|
|
94
|
+
* Spins a specific date part by the given delta.
|
|
182
95
|
*/
|
|
183
|
-
|
|
96
|
+
protected _spinDatePart(datePart: DatePart, delta: number): Date;
|
|
184
97
|
/**
|
|
185
98
|
* Updates the internal value based on the current masked input.
|
|
186
99
|
* Only sets a value if the mask is complete and parses to a valid date.
|
|
187
100
|
*/
|
|
188
|
-
|
|
101
|
+
protected _syncValueFromMask(): void;
|
|
189
102
|
/** Increments a date/time portion. */
|
|
190
103
|
stepUp(datePart?: DatePart, delta?: number): void;
|
|
191
104
|
/** Decrements a date/time portion. */
|
|
@@ -202,11 +115,9 @@ export default class IgcDateTimeInputComponent extends IgcDateTimeInputComponent
|
|
|
202
115
|
* @internal
|
|
203
116
|
*/
|
|
204
117
|
hasTimeParts(): boolean;
|
|
205
|
-
protected _renderInput(): import("lit-html").TemplateResult<1>;
|
|
206
118
|
}
|
|
207
119
|
declare global {
|
|
208
120
|
interface HTMLElementTagNameMap {
|
|
209
121
|
'igc-date-time-input': IgcDateTimeInputComponent;
|
|
210
122
|
}
|
|
211
123
|
}
|
|
212
|
-
export {};
|
|
@@ -4,31 +4,33 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
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;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
8
|
-
import { html } from 'lit';
|
|
9
|
-
import { eventOptions, property } from 'lit/decorators.js';
|
|
10
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
|
-
import { live } from 'lit/directives/live.js';
|
|
7
|
+
import { property } from 'lit/decorators.js';
|
|
12
8
|
import { addThemingController } from '../../theming/theming-controller.js';
|
|
13
9
|
import { convertToDate, isValidDate } from '../calendar/helpers.js';
|
|
14
|
-
import { addKeybindings, arrowDown, arrowLeft, arrowRight, arrowUp, ctrlKey, } from '../common/controllers/key-bindings.js';
|
|
15
|
-
import { addSlotController, setSlots } from '../common/controllers/slot.js';
|
|
16
10
|
import { registerComponent } from '../common/definitions/register.js';
|
|
17
|
-
import {
|
|
18
|
-
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
|
|
11
|
+
import { formatDisplayDate } from '../common/i18n/i18n-controller.js';
|
|
19
12
|
import { FormValueDateTimeTransformers } from '../common/mixins/forms/form-transformers.js';
|
|
20
13
|
import { createFormValueState } from '../common/mixins/forms/form-value.js';
|
|
21
|
-
import {
|
|
14
|
+
import { equal } from '../common/util.js';
|
|
22
15
|
import { styles } from '../input/themes/input.base.css.js';
|
|
23
16
|
import { styles as shared } from '../input/themes/shared/input.common.css.js';
|
|
24
17
|
import { all } from '../input/themes/themes.js';
|
|
25
|
-
import { IgcMaskInputBaseComponent, } from '../mask-input/mask-input-base.js';
|
|
26
18
|
import IgcValidationContainerComponent from '../validation-container/validation-container.js';
|
|
27
19
|
import { DatePart, DEFAULT_DATE_PARTS_SPIN_DELTAS, } from './date-part.js';
|
|
20
|
+
import { IgcDateTimeInputBaseComponent, } from './date-time-input.base.js';
|
|
28
21
|
import { createDatePart, DateParts, DateTimeMaskParser, } from './datetime-mask-parser.js';
|
|
29
22
|
import { dateTimeInputValidators } from './validators.js';
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
export default class IgcDateTimeInputComponent extends IgcDateTimeInputBaseComponent {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this._themes = addThemingController(this, all);
|
|
27
|
+
this._parser = new DateTimeMaskParser();
|
|
28
|
+
this._formValue = createFormValueState(this, {
|
|
29
|
+
initialValue: null,
|
|
30
|
+
transformers: FormValueDateTimeTransformers,
|
|
31
|
+
});
|
|
32
|
+
this._oldValue = null;
|
|
33
|
+
}
|
|
32
34
|
static { this.tagName = 'igc-date-time-input'; }
|
|
33
35
|
static { this.styles = [styles, shared]; }
|
|
34
36
|
static register() {
|
|
@@ -37,24 +39,9 @@ export default class IgcDateTimeInputComponent extends EventEmitterMixin(IgcMask
|
|
|
37
39
|
get __validators() {
|
|
38
40
|
return dateTimeInputValidators;
|
|
39
41
|
}
|
|
40
|
-
get _targetDatePart() {
|
|
41
|
-
return this._focused
|
|
42
|
-
? this._getDatePartAtCursor()
|
|
43
|
-
: this._getDefaultDatePart();
|
|
44
|
-
}
|
|
45
42
|
get _datePartDeltas() {
|
|
46
43
|
return { ...DEFAULT_DATE_PARTS_SPIN_DELTAS, ...this.spinDelta };
|
|
47
44
|
}
|
|
48
|
-
set inputFormat(val) {
|
|
49
|
-
if (val) {
|
|
50
|
-
this._applyMask(val);
|
|
51
|
-
this._inputFormat = val;
|
|
52
|
-
this._updateMaskDisplay();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
get inputFormat() {
|
|
56
|
-
return this._inputFormat || this._parser.mask;
|
|
57
|
-
}
|
|
58
45
|
set value(value) {
|
|
59
46
|
this._formValue.setValueAndFormState(value);
|
|
60
47
|
this._updateMaskDisplay();
|
|
@@ -62,112 +49,6 @@ export default class IgcDateTimeInputComponent extends EventEmitterMixin(IgcMask
|
|
|
62
49
|
get value() {
|
|
63
50
|
return this._formValue.value;
|
|
64
51
|
}
|
|
65
|
-
set min(value) {
|
|
66
|
-
this._min = convertToDate(value);
|
|
67
|
-
this._validate();
|
|
68
|
-
}
|
|
69
|
-
get min() {
|
|
70
|
-
return this._min;
|
|
71
|
-
}
|
|
72
|
-
set max(value) {
|
|
73
|
-
this._max = convertToDate(value);
|
|
74
|
-
this._validate();
|
|
75
|
-
}
|
|
76
|
-
get max() {
|
|
77
|
-
return this._max;
|
|
78
|
-
}
|
|
79
|
-
set displayFormat(value) {
|
|
80
|
-
this._displayFormat = value;
|
|
81
|
-
}
|
|
82
|
-
get displayFormat() {
|
|
83
|
-
return (this._displayFormat ?? this._inputFormat ?? this._defaultDisplayFormat);
|
|
84
|
-
}
|
|
85
|
-
set locale(value) {
|
|
86
|
-
this._i18nController.locale = value;
|
|
87
|
-
}
|
|
88
|
-
get locale() {
|
|
89
|
-
return this._i18nController.locale;
|
|
90
|
-
}
|
|
91
|
-
constructor() {
|
|
92
|
-
super();
|
|
93
|
-
this._parser = new DateTimeMaskParser();
|
|
94
|
-
this._defaultDisplayFormat = '';
|
|
95
|
-
this._oldValue = null;
|
|
96
|
-
this._min = null;
|
|
97
|
-
this._max = null;
|
|
98
|
-
this._i18nController = addI18nController(this, {
|
|
99
|
-
defaultEN: {},
|
|
100
|
-
onResourceChange: this._handleResourceChange,
|
|
101
|
-
});
|
|
102
|
-
this._themes = addThemingController(this, all);
|
|
103
|
-
this._slots = addSlotController(this, {
|
|
104
|
-
slots: Slots,
|
|
105
|
-
});
|
|
106
|
-
this._formValue = createFormValueState(this, {
|
|
107
|
-
initialValue: null,
|
|
108
|
-
transformers: FormValueDateTimeTransformers,
|
|
109
|
-
});
|
|
110
|
-
this.spinLoop = true;
|
|
111
|
-
addKeybindings(this, {
|
|
112
|
-
skip: () => this.readOnly,
|
|
113
|
-
bindingDefaults: { repeat: true },
|
|
114
|
-
})
|
|
115
|
-
.set([ctrlKey, ';'], this._setCurrentDateTime)
|
|
116
|
-
.set(arrowUp, this._keyboardSpin.bind(this, 'up'))
|
|
117
|
-
.set(arrowDown, this._keyboardSpin.bind(this, 'down'))
|
|
118
|
-
.set([ctrlKey, arrowLeft], this._navigateParts.bind(this, 0))
|
|
119
|
-
.set([ctrlKey, arrowRight], this._navigateParts.bind(this, 1));
|
|
120
|
-
}
|
|
121
|
-
update(props) {
|
|
122
|
-
if (props.has('displayFormat')) {
|
|
123
|
-
this._updateDefaultDisplayFormat();
|
|
124
|
-
}
|
|
125
|
-
if (props.has('locale')) {
|
|
126
|
-
this._initializeDefaultMask();
|
|
127
|
-
}
|
|
128
|
-
if (props.has('displayFormat') || props.has('locale')) {
|
|
129
|
-
this._updateMaskDisplay();
|
|
130
|
-
}
|
|
131
|
-
super.update(props);
|
|
132
|
-
}
|
|
133
|
-
_resolvePartNames(base) {
|
|
134
|
-
const result = super._resolvePartNames(base);
|
|
135
|
-
result.filled = result.filled || !this._isEmptyMask;
|
|
136
|
-
return result;
|
|
137
|
-
}
|
|
138
|
-
_updateSetRangeTextValue() {
|
|
139
|
-
this._updateValueFromMask();
|
|
140
|
-
}
|
|
141
|
-
_emitInputEvent() {
|
|
142
|
-
this._setTouchedState();
|
|
143
|
-
this.emitEvent('igcInput', { detail: this.value?.toString() });
|
|
144
|
-
}
|
|
145
|
-
_handleResourceChange() {
|
|
146
|
-
this._initializeDefaultMask();
|
|
147
|
-
this._updateMaskDisplay();
|
|
148
|
-
}
|
|
149
|
-
_handleDragLeave() {
|
|
150
|
-
if (!this._focused) {
|
|
151
|
-
this._updateMaskDisplay();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
_handleDragEnter() {
|
|
155
|
-
if (!this._focused) {
|
|
156
|
-
this._maskedValue = this._buildMaskedValue();
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
async _handleWheel(event) {
|
|
160
|
-
if (!this._focused || this.readOnly) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
event.preventDefault();
|
|
164
|
-
event.stopPropagation();
|
|
165
|
-
const { start, end } = this._inputSelection;
|
|
166
|
-
event.deltaY > 0 ? this.stepDown() : this.stepUp();
|
|
167
|
-
this._emitInputEvent();
|
|
168
|
-
await this.updateComplete;
|
|
169
|
-
this.setSelectionRange(start, end);
|
|
170
|
-
}
|
|
171
52
|
async _handleFocus() {
|
|
172
53
|
this._focused = true;
|
|
173
54
|
if (this.readOnly) {
|
|
@@ -197,19 +78,11 @@ export default class IgcDateTimeInputComponent extends EventEmitterMixin(IgcMask
|
|
|
197
78
|
else {
|
|
198
79
|
this._updateMaskDisplay();
|
|
199
80
|
}
|
|
200
|
-
if (!this.readOnly && this._oldValue
|
|
81
|
+
if (!this.readOnly && !equal(this._oldValue, this.value)) {
|
|
201
82
|
this.emitEvent('igcChange', { detail: this.value });
|
|
202
83
|
}
|
|
203
84
|
super._handleBlur();
|
|
204
85
|
}
|
|
205
|
-
_setCurrentDateTime() {
|
|
206
|
-
this.value = new Date();
|
|
207
|
-
this._emitInputEvent();
|
|
208
|
-
}
|
|
209
|
-
_navigateParts(direction) {
|
|
210
|
-
const position = this._calculatePartNavigationPosition(this._input?.value ?? '', direction);
|
|
211
|
-
this.setSelectionRange(position, position);
|
|
212
|
-
}
|
|
213
86
|
_calculatePartNavigationPosition(inputValue, direction) {
|
|
214
87
|
const cursorPos = this._maskSelection.start;
|
|
215
88
|
const dateParts = this._parser.dateParts;
|
|
@@ -220,39 +93,35 @@ export default class IgcDateTimeInputComponent extends EventEmitterMixin(IgcMask
|
|
|
220
93
|
const part = dateParts.find((part) => part.type === DateParts.Literal && part.start > cursorPos);
|
|
221
94
|
return part?.start ?? inputValue.length;
|
|
222
95
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
await this.updateComplete;
|
|
227
|
-
this.setSelectionRange(this._maskSelection.start, this._maskSelection.end);
|
|
96
|
+
_getDatePartAtCursor() {
|
|
97
|
+
return this._parser.getDatePartForCursor(this._inputSelection.start)
|
|
98
|
+
?.type;
|
|
228
99
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
this.
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
if (!isValidDate(this.value)) {
|
|
235
|
-
this._maskedValue = '';
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
this._maskedValue = formatDisplayDate(this.value, this.locale, this.displayFormat);
|
|
100
|
+
_getDefaultDatePart() {
|
|
101
|
+
return (this._parser.getPartByType(DateParts.Date)?.type ??
|
|
102
|
+
this._parser.getPartByType(DateParts.Hours)?.type ??
|
|
103
|
+
this._parser.getFirstDatePart()?.type);
|
|
239
104
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
105
|
+
_buildMaskedValue() {
|
|
106
|
+
return isValidDate(this.value)
|
|
107
|
+
? this._parser.formatDate(this.value)
|
|
108
|
+
: this._maskedValue || this._parser.emptyMask;
|
|
109
|
+
}
|
|
110
|
+
_buildDisplayValue() {
|
|
111
|
+
return isValidDate(this.value)
|
|
112
|
+
? formatDisplayDate(this.value, this.locale, this.displayFormat)
|
|
113
|
+
: '';
|
|
114
|
+
}
|
|
115
|
+
_commitSpunValue(value) {
|
|
116
|
+
this.value = value;
|
|
117
|
+
}
|
|
118
|
+
_setCurrentDateTime() {
|
|
119
|
+
this.value = new Date();
|
|
120
|
+
this._emitInputEvent();
|
|
250
121
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
this.value = this._calculateSpunValue(part, delta, isDecrement);
|
|
255
|
-
this.updateComplete.then(() => this._input?.setSelectionRange(start, end));
|
|
122
|
+
_emitInputEvent() {
|
|
123
|
+
this._setTouchedState();
|
|
124
|
+
this.emitEvent('igcInput', { detail: this.value?.toISOString() });
|
|
256
125
|
}
|
|
257
126
|
_calculateSpunValue(datePart, delta, isDecrement) {
|
|
258
127
|
const effectiveDelta = delta || this._datePartDeltas[datePart] || 1;
|
|
@@ -286,40 +155,7 @@ export default class IgcDateTimeInputComponent extends EventEmitterMixin(IgcMask
|
|
|
286
155
|
});
|
|
287
156
|
return newDate;
|
|
288
157
|
}
|
|
289
|
-
|
|
290
|
-
this._defaultDisplayFormat = getDateFormatter().getLocaleDateTimeFormat(this.locale);
|
|
291
|
-
}
|
|
292
|
-
_applyMask(formatString) {
|
|
293
|
-
const previous = this._parser.mask;
|
|
294
|
-
this._parser.mask = formatString;
|
|
295
|
-
if (!this.placeholder || previous === this.placeholder) {
|
|
296
|
-
this.placeholder = this._parser.mask;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
_buildMaskedValue() {
|
|
300
|
-
return isValidDate(this.value)
|
|
301
|
-
? this._parser.formatDate(this.value)
|
|
302
|
-
: this._maskedValue || this._parser.emptyMask;
|
|
303
|
-
}
|
|
304
|
-
_initializeDefaultMask() {
|
|
305
|
-
this._updateDefaultDisplayFormat();
|
|
306
|
-
if (!this._inputFormat) {
|
|
307
|
-
this._applyMask(getDefaultDateTimeFormat(this.locale));
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
_getDatePartAtCursor() {
|
|
311
|
-
return this._parser.getDatePartForCursor(this._inputSelection.start)
|
|
312
|
-
?.type;
|
|
313
|
-
}
|
|
314
|
-
_getDefaultDatePart() {
|
|
315
|
-
return (this._parser.getPartByType(DateParts.Date)?.type ??
|
|
316
|
-
this._parser.getPartByType(DateParts.Hours)?.type ??
|
|
317
|
-
this._parser.getFirstDatePart()?.type);
|
|
318
|
-
}
|
|
319
|
-
_isMaskComplete() {
|
|
320
|
-
return !this._maskedValue.includes(this.prompt);
|
|
321
|
-
}
|
|
322
|
-
_updateValueFromMask() {
|
|
158
|
+
_syncValueFromMask() {
|
|
323
159
|
if (!this._isMaskComplete()) {
|
|
324
160
|
this.value = null;
|
|
325
161
|
return;
|
|
@@ -328,10 +164,10 @@ export default class IgcDateTimeInputComponent extends EventEmitterMixin(IgcMask
|
|
|
328
164
|
this.value = isValidDate(parsedDate) ? parsedDate : null;
|
|
329
165
|
}
|
|
330
166
|
stepUp(datePart, delta) {
|
|
331
|
-
|
|
167
|
+
super.stepUp(datePart, delta);
|
|
332
168
|
}
|
|
333
169
|
stepDown(datePart, delta) {
|
|
334
|
-
|
|
170
|
+
super.stepDown(datePart, delta);
|
|
335
171
|
}
|
|
336
172
|
clear() {
|
|
337
173
|
this._maskedValue = '';
|
|
@@ -343,57 +179,8 @@ export default class IgcDateTimeInputComponent extends EventEmitterMixin(IgcMask
|
|
|
343
179
|
hasTimeParts() {
|
|
344
180
|
return this._parser.hasTimeParts();
|
|
345
181
|
}
|
|
346
|
-
_renderInput() {
|
|
347
|
-
return html `
|
|
348
|
-
<input
|
|
349
|
-
type="text"
|
|
350
|
-
part=${partMap(this._resolvePartNames('input'))}
|
|
351
|
-
name=${ifDefined(this.name)}
|
|
352
|
-
.value=${live(this._maskedValue)}
|
|
353
|
-
.placeholder=${this.placeholder || this._parser.emptyMask}
|
|
354
|
-
?readonly=${this.readOnly}
|
|
355
|
-
?disabled=${this.disabled}
|
|
356
|
-
@blur=${this._handleBlur}
|
|
357
|
-
@focus=${this._handleFocus}
|
|
358
|
-
@input=${this._handleInput}
|
|
359
|
-
@wheel=${this._handleWheel}
|
|
360
|
-
@keydown=${this._setMaskSelection}
|
|
361
|
-
@click=${this._handleClick}
|
|
362
|
-
@cut=${this._setMaskSelection}
|
|
363
|
-
@compositionstart=${this._handleCompositionStart}
|
|
364
|
-
@compositionend=${this._handleCompositionEnd}
|
|
365
|
-
@dragenter=${this._handleDragEnter}
|
|
366
|
-
@dragleave=${this._handleDragLeave}
|
|
367
|
-
@dragstart=${this._setMaskSelection}
|
|
368
|
-
/>
|
|
369
|
-
`;
|
|
370
|
-
}
|
|
371
182
|
}
|
|
372
|
-
__decorate([
|
|
373
|
-
property({ attribute: 'input-format' })
|
|
374
|
-
], IgcDateTimeInputComponent.prototype, "inputFormat", null);
|
|
375
183
|
__decorate([
|
|
376
184
|
property({ converter: convertToDate })
|
|
377
185
|
], IgcDateTimeInputComponent.prototype, "value", null);
|
|
378
|
-
__decorate([
|
|
379
|
-
property({ converter: convertToDate })
|
|
380
|
-
], IgcDateTimeInputComponent.prototype, "min", null);
|
|
381
|
-
__decorate([
|
|
382
|
-
property({ converter: convertToDate })
|
|
383
|
-
], IgcDateTimeInputComponent.prototype, "max", null);
|
|
384
|
-
__decorate([
|
|
385
|
-
property({ attribute: 'display-format' })
|
|
386
|
-
], IgcDateTimeInputComponent.prototype, "displayFormat", null);
|
|
387
|
-
__decorate([
|
|
388
|
-
property({ attribute: false })
|
|
389
|
-
], IgcDateTimeInputComponent.prototype, "spinDelta", void 0);
|
|
390
|
-
__decorate([
|
|
391
|
-
property({ type: Boolean, attribute: 'spin-loop' })
|
|
392
|
-
], IgcDateTimeInputComponent.prototype, "spinLoop", void 0);
|
|
393
|
-
__decorate([
|
|
394
|
-
property()
|
|
395
|
-
], IgcDateTimeInputComponent.prototype, "locale", null);
|
|
396
|
-
__decorate([
|
|
397
|
-
eventOptions({ passive: false })
|
|
398
|
-
], IgcDateTimeInputComponent.prototype, "_handleWheel", null);
|
|
399
186
|
//# sourceMappingURL=date-time-input.js.map
|