igniteui-webcomponents 7.1.2 → 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 +51 -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/stepper/stepper.js +5 -0
- package/components/stepper/stepper.js.map +1 -1
- package/components/stepper/themes/step/step.base.css.js +1 -1
- package/components/stepper/themes/step/step.base.css.js.map +1 -1
- package/components/stepper/themes/stepper/stepper.base.css.js +1 -1
- package/components/stepper/themes/stepper/stepper.base.css.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 +23 -6
- package/skills/igniteui-wc-choose-components/reference/mcp-setup.md +82 -0
- 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
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { LitElement, type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import type { ThemingController } from '../../theming/theming-controller.js';
|
|
3
|
+
import type { Constructor } from '../common/mixins/constructor.js';
|
|
4
|
+
import { type MaskSelection } from '../common/mixins/mask-behavior.js';
|
|
5
|
+
import type { IgcInputComponentEventMap } from '../input/input-base.js';
|
|
6
|
+
import type { DatePartDeltas } from './date-part.js';
|
|
7
|
+
export type { MaskSelection };
|
|
8
|
+
export interface IgcDateTimeInputComponentEventMap extends Omit<IgcInputComponentEventMap, 'igcChange'> {
|
|
9
|
+
igcChange: CustomEvent<unknown>;
|
|
10
|
+
}
|
|
11
|
+
declare const IgcDateTimeInputBaseComponent_base: import("../common/mixins/constructor.js").AbstractConstructor<import("../common/mixins/mask-behavior.js").MaskBehaviorElementInterface> & Constructor<import("../common/mixins/forms/types.js").FormRequiredInterface & import("../common/mixins/forms/types.js").FormAssociatedElementInterface> & Constructor<import("../common/mixins/event-emitter.js").EventEmitterInterface<IgcDateTimeInputComponentEventMap>> & Constructor<LitElement>;
|
|
12
|
+
export declare abstract class IgcDateTimeInputBaseComponent extends IgcDateTimeInputBaseComponent_base {
|
|
13
|
+
protected abstract readonly _themes: ThemingController;
|
|
14
|
+
protected readonly _slots: import("../common/controllers/slot.js").SlotController<"invalid" | "prefix" | "[default]" | "helper-text" | "suffix" | "value-missing" | "custom-error" | "range-overflow" | "range-underflow">;
|
|
15
|
+
protected readonly _inputId: string;
|
|
16
|
+
protected readonly _input?: HTMLInputElement;
|
|
17
|
+
protected get __validators(): import("../common/validators.js").Validator<import("./date-time-input.js").default>[];
|
|
18
|
+
private readonly _i18nController;
|
|
19
|
+
protected _min: Date | null;
|
|
20
|
+
protected _max: Date | null;
|
|
21
|
+
protected _defaultMask: string;
|
|
22
|
+
protected _defaultDisplayFormat: string;
|
|
23
|
+
protected _displayFormat?: string;
|
|
24
|
+
protected _inputFormat?: string;
|
|
25
|
+
protected get _targetDatePart(): unknown;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the control will have outlined appearance.
|
|
28
|
+
*
|
|
29
|
+
* @attr
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
outlined: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The placeholder attribute of the control.
|
|
35
|
+
* @attr
|
|
36
|
+
*/
|
|
37
|
+
placeholder: string;
|
|
38
|
+
/**
|
|
39
|
+
* The label for the control.
|
|
40
|
+
* @attr
|
|
41
|
+
*/
|
|
42
|
+
label: string;
|
|
43
|
+
/**
|
|
44
|
+
* The date format to apply on the input.
|
|
45
|
+
* @attr input-format
|
|
46
|
+
*/
|
|
47
|
+
get inputFormat(): string;
|
|
48
|
+
set inputFormat(val: string);
|
|
49
|
+
/**
|
|
50
|
+
* The minimum value required for the input to remain valid.
|
|
51
|
+
* @attr
|
|
52
|
+
*/
|
|
53
|
+
set min(value: Date | string | null | undefined);
|
|
54
|
+
get min(): Date | null;
|
|
55
|
+
/**
|
|
56
|
+
* The maximum value required for the input to remain valid.
|
|
57
|
+
* @attr
|
|
58
|
+
*/
|
|
59
|
+
set max(value: Date | string | null | undefined);
|
|
60
|
+
get max(): Date | null;
|
|
61
|
+
/**
|
|
62
|
+
* Format to display the value in when not editing.
|
|
63
|
+
* Defaults to the locale format if not set.
|
|
64
|
+
* @attr display-format
|
|
65
|
+
*/
|
|
66
|
+
set displayFormat(value: string);
|
|
67
|
+
get displayFormat(): string;
|
|
68
|
+
/**
|
|
69
|
+
* Delta values used to increment or decrement each date part on step actions.
|
|
70
|
+
* All values default to `1`.
|
|
71
|
+
*/
|
|
72
|
+
spinDelta?: DatePartDeltas;
|
|
73
|
+
/**
|
|
74
|
+
* Sets whether to loop over the currently spun segment.
|
|
75
|
+
* @attr spin-loop
|
|
76
|
+
*/
|
|
77
|
+
spinLoop: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Gets/Sets the locale used for formatting the display value.
|
|
80
|
+
* @attr locale
|
|
81
|
+
*/
|
|
82
|
+
set locale(value: string);
|
|
83
|
+
get locale(): string;
|
|
84
|
+
constructor();
|
|
85
|
+
protected update(props: PropertyValues<this>): void;
|
|
86
|
+
private _handleResourceChange;
|
|
87
|
+
protected _handleDragLeave(): void;
|
|
88
|
+
protected _handleDragEnter(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Handles wheel events for spinning date parts.
|
|
91
|
+
*/
|
|
92
|
+
protected _handleWheel(event: WheelEvent): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Navigates to the previous or next date part.
|
|
95
|
+
*/
|
|
96
|
+
protected _navigateParts(direction: number): void;
|
|
97
|
+
/**
|
|
98
|
+
* Handles keyboard-triggered spinning (arrow up/down).
|
|
99
|
+
*/
|
|
100
|
+
protected _keyboardSpin(direction: 'up' | 'down'): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Common logic for stepping up or down a date part.
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
protected _performStep(datePart: unknown, delta: number | undefined, isDecrement: boolean): void;
|
|
106
|
+
/**
|
|
107
|
+
* Updates the displayed mask value based on focus state.
|
|
108
|
+
* When focused, shows the editable mask. When unfocused, defers to the leaf's display formatter.
|
|
109
|
+
*/
|
|
110
|
+
protected _updateMaskDisplay(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Checks if all mask positions are filled (no prompt characters remain).
|
|
113
|
+
*/
|
|
114
|
+
protected _isMaskComplete(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Applies a mask pattern to the input, parsing the format string into date parts.
|
|
117
|
+
*/
|
|
118
|
+
protected _applyMask(formatString: string): void;
|
|
119
|
+
/**
|
|
120
|
+
* Updates the default display format based on current locale.
|
|
121
|
+
*/
|
|
122
|
+
private _updateDefaultDisplayFormat;
|
|
123
|
+
protected _initializeDefaultMask(): void;
|
|
124
|
+
/**
|
|
125
|
+
* Resolves the part names for the container based on the current state.
|
|
126
|
+
*/
|
|
127
|
+
protected _resolvePartNames(base: string): Record<string, boolean>;
|
|
128
|
+
/** Selects all the text inside the input. */
|
|
129
|
+
select(): void;
|
|
130
|
+
/** Sets focus on the control. */
|
|
131
|
+
focus(options?: FocusOptions): void;
|
|
132
|
+
/** Removes focus from the control. */
|
|
133
|
+
blur(): void;
|
|
134
|
+
/** Increments a date/time portion. */
|
|
135
|
+
stepUp(datePart?: unknown, delta?: number): void;
|
|
136
|
+
/** Decrements a date/time portion. */
|
|
137
|
+
stepDown(datePart?: unknown, delta?: number): void;
|
|
138
|
+
/** Clears the input element of user input. */
|
|
139
|
+
abstract clear(): void;
|
|
140
|
+
protected _renderInput(): TemplateResult;
|
|
141
|
+
protected render(): import("lit-html/directive.js").DirectiveResult<typeof import("lit-html/directives/cache.js").CacheDirective>;
|
|
142
|
+
protected abstract get _datePartDeltas(): DatePartDeltas;
|
|
143
|
+
protected abstract _buildMaskedValue(): string;
|
|
144
|
+
protected abstract _buildDisplayValue(): string;
|
|
145
|
+
protected abstract _syncValueFromMask(): void;
|
|
146
|
+
protected abstract _calculatePartNavigationPosition(value: string, direction: number): number;
|
|
147
|
+
protected abstract _calculateSpunValue(part: unknown, delta: number | undefined, isDecrement: boolean): unknown;
|
|
148
|
+
protected abstract _commitSpunValue(value: unknown): void;
|
|
149
|
+
protected abstract _setCurrentDateTime(): void;
|
|
150
|
+
protected abstract _handleFocus(): Promise<void>;
|
|
151
|
+
protected abstract _getDatePartAtCursor(): unknown;
|
|
152
|
+
protected abstract _getDefaultDatePart(): unknown;
|
|
153
|
+
abstract hasDateParts(): boolean;
|
|
154
|
+
abstract hasTimeParts(): boolean;
|
|
155
|
+
}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { getDateFormatter } from 'igniteui-i18n-core';
|
|
8
|
+
import { LitElement } from 'lit';
|
|
9
|
+
import { eventOptions, property, query } from 'lit/decorators.js';
|
|
10
|
+
import { cache } from 'lit/directives/cache.js';
|
|
11
|
+
import { convertToDate } from '../calendar/helpers.js';
|
|
12
|
+
import { addKeybindings, arrowDown, arrowLeft, arrowRight, arrowUp, ctrlKey, } from '../common/controllers/key-bindings.js';
|
|
13
|
+
import { addSlotController, setSlots } from '../common/controllers/slot.js';
|
|
14
|
+
import { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';
|
|
15
|
+
import { shadowOptions } from '../common/decorators/shadow-options.js';
|
|
16
|
+
import { addI18nController, getDefaultDateTimeFormat, } from '../common/i18n/i18n-controller.js';
|
|
17
|
+
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
|
|
18
|
+
import { FormAssociatedRequiredMixin } from '../common/mixins/forms/associated-required.js';
|
|
19
|
+
import { MaskBehaviorMixin, } from '../common/mixins/mask-behavior.js';
|
|
20
|
+
import { nextInputId, renderInputShell, } from '../common/templates/input-shell.js';
|
|
21
|
+
import { renderMaskedNativeInput } from '../common/templates/masked-input.js';
|
|
22
|
+
import { dateTimeInputValidators } from './validators.js';
|
|
23
|
+
const Slots = setSlots('prefix', 'suffix', 'helper-text', 'value-missing', 'range-overflow', 'range-underflow', 'custom-error', 'invalid');
|
|
24
|
+
let IgcDateTimeInputBaseComponent = class IgcDateTimeInputBaseComponent extends MaskBehaviorMixin(FormAssociatedRequiredMixin(EventEmitterMixin(LitElement))) {
|
|
25
|
+
get __validators() {
|
|
26
|
+
return dateTimeInputValidators;
|
|
27
|
+
}
|
|
28
|
+
get _targetDatePart() {
|
|
29
|
+
return this._focused
|
|
30
|
+
? this._getDatePartAtCursor()
|
|
31
|
+
: this._getDefaultDatePart();
|
|
32
|
+
}
|
|
33
|
+
get inputFormat() {
|
|
34
|
+
return this._inputFormat || this._parser.mask;
|
|
35
|
+
}
|
|
36
|
+
set inputFormat(val) {
|
|
37
|
+
if (val) {
|
|
38
|
+
this._applyMask(val);
|
|
39
|
+
this._inputFormat = val;
|
|
40
|
+
this._updateMaskDisplay();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
set min(value) {
|
|
44
|
+
this._min = convertToDate(value);
|
|
45
|
+
this._validate();
|
|
46
|
+
}
|
|
47
|
+
get min() {
|
|
48
|
+
return this._min;
|
|
49
|
+
}
|
|
50
|
+
set max(value) {
|
|
51
|
+
this._max = convertToDate(value);
|
|
52
|
+
this._validate();
|
|
53
|
+
}
|
|
54
|
+
get max() {
|
|
55
|
+
return this._max;
|
|
56
|
+
}
|
|
57
|
+
set displayFormat(value) {
|
|
58
|
+
this._displayFormat = value;
|
|
59
|
+
}
|
|
60
|
+
get displayFormat() {
|
|
61
|
+
return (this._displayFormat ?? this._inputFormat ?? this._defaultDisplayFormat);
|
|
62
|
+
}
|
|
63
|
+
set locale(value) {
|
|
64
|
+
this._i18nController.locale = value;
|
|
65
|
+
}
|
|
66
|
+
get locale() {
|
|
67
|
+
return this._i18nController.locale;
|
|
68
|
+
}
|
|
69
|
+
constructor() {
|
|
70
|
+
super();
|
|
71
|
+
this._slots = addSlotController(this, { slots: Slots });
|
|
72
|
+
this._inputId = nextInputId();
|
|
73
|
+
this._i18nController = addI18nController(this, {
|
|
74
|
+
defaultEN: {},
|
|
75
|
+
onResourceChange: this._handleResourceChange,
|
|
76
|
+
});
|
|
77
|
+
this._min = null;
|
|
78
|
+
this._max = null;
|
|
79
|
+
this._defaultDisplayFormat = '';
|
|
80
|
+
this.outlined = false;
|
|
81
|
+
this.spinLoop = true;
|
|
82
|
+
addKeybindings(this, {
|
|
83
|
+
skip: () => this.readOnly,
|
|
84
|
+
bindingDefaults: { repeat: true },
|
|
85
|
+
})
|
|
86
|
+
.set([ctrlKey, ';'], this._setCurrentDateTime)
|
|
87
|
+
.set(arrowUp, this._keyboardSpin.bind(this, 'up'))
|
|
88
|
+
.set(arrowDown, this._keyboardSpin.bind(this, 'down'))
|
|
89
|
+
.set([ctrlKey, arrowLeft], this._navigateParts.bind(this, 0))
|
|
90
|
+
.set([ctrlKey, arrowRight], this._navigateParts.bind(this, 1));
|
|
91
|
+
}
|
|
92
|
+
update(props) {
|
|
93
|
+
if (props.has('displayFormat')) {
|
|
94
|
+
this._updateDefaultDisplayFormat();
|
|
95
|
+
}
|
|
96
|
+
if (props.has('locale')) {
|
|
97
|
+
this._initializeDefaultMask();
|
|
98
|
+
}
|
|
99
|
+
if (props.has('displayFormat') || props.has('locale')) {
|
|
100
|
+
this._updateMaskDisplay();
|
|
101
|
+
}
|
|
102
|
+
super.update(props);
|
|
103
|
+
}
|
|
104
|
+
_handleResourceChange() {
|
|
105
|
+
this._initializeDefaultMask();
|
|
106
|
+
this._updateMaskDisplay();
|
|
107
|
+
}
|
|
108
|
+
_handleDragLeave() {
|
|
109
|
+
if (!this._focused) {
|
|
110
|
+
this._updateMaskDisplay();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
_handleDragEnter() {
|
|
114
|
+
if (!this._focused) {
|
|
115
|
+
this._maskedValue = this._buildMaskedValue();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async _handleWheel(event) {
|
|
119
|
+
if (!this._focused || this.readOnly)
|
|
120
|
+
return;
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
event.stopPropagation();
|
|
123
|
+
const { start, end } = this._inputSelection;
|
|
124
|
+
event.deltaY > 0 ? this.stepDown() : this.stepUp();
|
|
125
|
+
this._emitInputEvent();
|
|
126
|
+
await this.updateComplete;
|
|
127
|
+
this.setSelectionRange(start, end);
|
|
128
|
+
}
|
|
129
|
+
_navigateParts(direction) {
|
|
130
|
+
const position = this._calculatePartNavigationPosition(this._input?.value ?? '', direction);
|
|
131
|
+
this.setSelectionRange(position, position);
|
|
132
|
+
}
|
|
133
|
+
async _keyboardSpin(direction) {
|
|
134
|
+
direction === 'up' ? this.stepUp() : this.stepDown();
|
|
135
|
+
this._emitInputEvent();
|
|
136
|
+
await this.updateComplete;
|
|
137
|
+
this.setSelectionRange(this._maskSelection.start, this._maskSelection.end);
|
|
138
|
+
}
|
|
139
|
+
_performStep(datePart, delta, isDecrement) {
|
|
140
|
+
const part = datePart || this._targetDatePart;
|
|
141
|
+
if (!part)
|
|
142
|
+
return;
|
|
143
|
+
const { start, end } = this._inputSelection;
|
|
144
|
+
const newValue = this._calculateSpunValue(part, delta, isDecrement);
|
|
145
|
+
this._commitSpunValue(newValue);
|
|
146
|
+
this.updateComplete.then(() => this._input?.setSelectionRange(start, end));
|
|
147
|
+
}
|
|
148
|
+
_updateMaskDisplay() {
|
|
149
|
+
this._maskedValue = this._focused
|
|
150
|
+
? this._buildMaskedValue()
|
|
151
|
+
: this._buildDisplayValue();
|
|
152
|
+
}
|
|
153
|
+
_isMaskComplete() {
|
|
154
|
+
return !this._maskedValue.includes(this.prompt);
|
|
155
|
+
}
|
|
156
|
+
_applyMask(formatString) {
|
|
157
|
+
const previous = this._parser.mask;
|
|
158
|
+
this._parser.mask = formatString;
|
|
159
|
+
if (!this.placeholder || previous === this.placeholder) {
|
|
160
|
+
this.placeholder = this._parser.mask;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
_updateDefaultDisplayFormat() {
|
|
164
|
+
this._defaultDisplayFormat = getDateFormatter().getLocaleDateTimeFormat(this.locale);
|
|
165
|
+
}
|
|
166
|
+
_initializeDefaultMask() {
|
|
167
|
+
this._updateDefaultDisplayFormat();
|
|
168
|
+
if (!this._inputFormat) {
|
|
169
|
+
this._applyMask(getDefaultDateTimeFormat(this.locale));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
_resolvePartNames(base) {
|
|
173
|
+
return {
|
|
174
|
+
[base]: true,
|
|
175
|
+
prefixed: this._slots.hasAssignedElements('prefix', {
|
|
176
|
+
selector: '[slot="prefix"]:not([hidden])',
|
|
177
|
+
}),
|
|
178
|
+
suffixed: this._slots.hasAssignedElements('suffix', {
|
|
179
|
+
selector: '[slot="suffix"]:not([hidden])',
|
|
180
|
+
}),
|
|
181
|
+
filled: !this._isEmptyMask,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
select() {
|
|
185
|
+
this._input?.select();
|
|
186
|
+
}
|
|
187
|
+
focus(options) {
|
|
188
|
+
this._input?.focus(options);
|
|
189
|
+
}
|
|
190
|
+
blur() {
|
|
191
|
+
this._input?.blur();
|
|
192
|
+
}
|
|
193
|
+
stepUp(datePart, delta) {
|
|
194
|
+
this._performStep(datePart, delta, false);
|
|
195
|
+
}
|
|
196
|
+
stepDown(datePart, delta) {
|
|
197
|
+
this._performStep(datePart, delta, true);
|
|
198
|
+
}
|
|
199
|
+
_renderInput() {
|
|
200
|
+
const hasNegativeTabIndex = this.getAttribute('tabindex') === '-1';
|
|
201
|
+
const hasHelperText = this._slots.hasAssignedElements('helper-text');
|
|
202
|
+
return renderMaskedNativeInput({
|
|
203
|
+
id: this._inputId,
|
|
204
|
+
partNames: this._resolvePartNames('input'),
|
|
205
|
+
name: this.name,
|
|
206
|
+
value: this._maskedValue,
|
|
207
|
+
placeholder: this.placeholder || this._parser.emptyMask,
|
|
208
|
+
readOnly: this.readOnly,
|
|
209
|
+
disabled: this.disabled,
|
|
210
|
+
tabindex: hasNegativeTabIndex ? -1 : undefined,
|
|
211
|
+
ariaDescribedBy: hasHelperText ? 'helper-text' : undefined,
|
|
212
|
+
onInput: this._handleInput,
|
|
213
|
+
onFocus: this._handleFocus,
|
|
214
|
+
onBlur: this._handleBlur,
|
|
215
|
+
onClick: this._handleClick,
|
|
216
|
+
onSetMaskSelection: this._setMaskSelection,
|
|
217
|
+
onCompositionStart: this._handleCompositionStart,
|
|
218
|
+
onCompositionEnd: this._handleCompositionEnd,
|
|
219
|
+
onWheel: this._handleWheel,
|
|
220
|
+
onDragEnter: this._handleDragEnter,
|
|
221
|
+
onDragLeave: this._handleDragLeave,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
render() {
|
|
225
|
+
return cache(renderInputShell(this, {
|
|
226
|
+
theme: this._themes.theme,
|
|
227
|
+
label: this.label,
|
|
228
|
+
labelId: this._inputId,
|
|
229
|
+
containerParts: this._resolvePartNames('container'),
|
|
230
|
+
renderInput: this._renderInput,
|
|
231
|
+
}));
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
__decorate([
|
|
235
|
+
query('input')
|
|
236
|
+
], IgcDateTimeInputBaseComponent.prototype, "_input", void 0);
|
|
237
|
+
__decorate([
|
|
238
|
+
property({ type: Boolean, reflect: true })
|
|
239
|
+
], IgcDateTimeInputBaseComponent.prototype, "outlined", void 0);
|
|
240
|
+
__decorate([
|
|
241
|
+
property()
|
|
242
|
+
], IgcDateTimeInputBaseComponent.prototype, "placeholder", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
property()
|
|
245
|
+
], IgcDateTimeInputBaseComponent.prototype, "label", void 0);
|
|
246
|
+
__decorate([
|
|
247
|
+
property({ attribute: 'input-format' })
|
|
248
|
+
], IgcDateTimeInputBaseComponent.prototype, "inputFormat", null);
|
|
249
|
+
__decorate([
|
|
250
|
+
property({ converter: convertToDate })
|
|
251
|
+
], IgcDateTimeInputBaseComponent.prototype, "min", null);
|
|
252
|
+
__decorate([
|
|
253
|
+
property({ converter: convertToDate })
|
|
254
|
+
], IgcDateTimeInputBaseComponent.prototype, "max", null);
|
|
255
|
+
__decorate([
|
|
256
|
+
property({ attribute: 'display-format' })
|
|
257
|
+
], IgcDateTimeInputBaseComponent.prototype, "displayFormat", null);
|
|
258
|
+
__decorate([
|
|
259
|
+
property({ attribute: false })
|
|
260
|
+
], IgcDateTimeInputBaseComponent.prototype, "spinDelta", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
property({ type: Boolean, attribute: 'spin-loop' })
|
|
263
|
+
], IgcDateTimeInputBaseComponent.prototype, "spinLoop", void 0);
|
|
264
|
+
__decorate([
|
|
265
|
+
property()
|
|
266
|
+
], IgcDateTimeInputBaseComponent.prototype, "locale", null);
|
|
267
|
+
__decorate([
|
|
268
|
+
eventOptions({ passive: false })
|
|
269
|
+
], IgcDateTimeInputBaseComponent.prototype, "_handleWheel", null);
|
|
270
|
+
IgcDateTimeInputBaseComponent = __decorate([
|
|
271
|
+
blazorDeepImport,
|
|
272
|
+
shadowOptions({ delegatesFocus: true })
|
|
273
|
+
], IgcDateTimeInputBaseComponent);
|
|
274
|
+
export { IgcDateTimeInputBaseComponent };
|
|
275
|
+
//# sourceMappingURL=date-time-input.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-time-input.base.js","sourceRoot":"","sources":["../../../src/components/date-time-input/date-time-input.base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAA4C,MAAM,KAAK,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,GACR,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EACL,iBAAiB,GAElB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,WAAW,EACX,gBAAgB,GACjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAG9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAI1D,MAAM,KAAK,GAAG,QAAQ,CACpB,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,SAAS,CACV,CAAC;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EAAE,aAAa,EAAE,CAAC;wDAItC;AAYD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;kEAGzC;AAaM;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;gEACG;AAO3B;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;+DAC7B;AAOvB;IADC,QAAQ,EAAE;2DAGV;AAiEe;IADf,YAAY,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;iEAahC;AArOmB,6BAA6B;IAFlD,gBAAgB;IAChB,aAAa,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;GAClB,6BAA6B,CA8blD","sourcesContent":["import { getDateFormatter } from 'igniteui-i18n-core';\nimport { LitElement, type PropertyValues, type TemplateResult } from 'lit';\nimport { eventOptions, property, query } from 'lit/decorators.js';\nimport { cache } from 'lit/directives/cache.js';\nimport type { ThemingController } from '../../theming/theming-controller.js';\nimport { convertToDate } from '../calendar/helpers.js';\nimport {\n addKeybindings,\n arrowDown,\n arrowLeft,\n arrowRight,\n arrowUp,\n ctrlKey,\n} from '../common/controllers/key-bindings.js';\nimport { addSlotController, setSlots } from '../common/controllers/slot.js';\nimport { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';\nimport { shadowOptions } from '../common/decorators/shadow-options.js';\nimport {\n addI18nController,\n getDefaultDateTimeFormat,\n} from '../common/i18n/i18n-controller.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport { FormAssociatedRequiredMixin } from '../common/mixins/forms/associated-required.js';\nimport {\n MaskBehaviorMixin,\n type MaskSelection,\n} from '../common/mixins/mask-behavior.js';\nimport {\n nextInputId,\n renderInputShell,\n} from '../common/templates/input-shell.js';\nimport { renderMaskedNativeInput } from '../common/templates/masked-input.js';\nimport type { IgcInputComponentEventMap } from '../input/input-base.js';\nimport type { DatePartDeltas } from './date-part.js';\nimport { dateTimeInputValidators } from './validators.js';\n\nexport type { MaskSelection };\n\nconst Slots = setSlots(\n 'prefix',\n 'suffix',\n 'helper-text',\n 'value-missing',\n 'range-overflow',\n 'range-underflow',\n 'custom-error',\n 'invalid'\n);\n\nexport interface IgcDateTimeInputComponentEventMap extends Omit<\n IgcInputComponentEventMap,\n 'igcChange'\n> {\n igcChange: CustomEvent<unknown>;\n}\n\n@blazorDeepImport\n@shadowOptions({ delegatesFocus: true })\nexport abstract class IgcDateTimeInputBaseComponent extends MaskBehaviorMixin(\n FormAssociatedRequiredMixin(\n EventEmitterMixin<\n IgcDateTimeInputComponentEventMap,\n Constructor<LitElement>\n >(LitElement)\n )\n) {\n // #region Internal state and properties\n\n protected abstract readonly _themes: ThemingController;\n\n protected readonly _slots = addSlotController(this, { slots: Slots });\n\n protected readonly _inputId = nextInputId();\n\n @query('input')\n protected override readonly _input?: HTMLInputElement;\n\n protected override get __validators() {\n return dateTimeInputValidators;\n }\n\n private readonly _i18nController = addI18nController(this, {\n defaultEN: {},\n onResourceChange: this._handleResourceChange,\n });\n\n protected _min: Date | null = null;\n protected _max: Date | null = null;\n\n protected _defaultMask!: string;\n\n protected _defaultDisplayFormat = '';\n protected _displayFormat?: string;\n protected _inputFormat?: string;\n\n protected get _targetDatePart(): unknown {\n return this._focused\n ? this._getDatePartAtCursor()\n : this._getDefaultDatePart();\n }\n\n // #endregion\n\n // #region Public attributes and properties\n\n /**\n * Whether the control will have outlined appearance.\n *\n * @attr\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public outlined = false;\n\n /**\n * The placeholder attribute of the control.\n * @attr\n */\n @property()\n public placeholder!: string;\n\n /**\n * The label for the control.\n * @attr\n */\n @property()\n public label!: string;\n\n /**\n * The date format to apply on the input.\n * @attr input-format\n */\n @property({ attribute: 'input-format' })\n public get inputFormat(): string {\n return this._inputFormat || this._parser.mask;\n }\n\n public set inputFormat(val: string) {\n if (val) {\n this._applyMask(val);\n this._inputFormat = val;\n this._updateMaskDisplay();\n }\n }\n\n /**\n * The minimum value required for the input to remain valid.\n * @attr\n */\n @property({ converter: convertToDate })\n public set min(value: Date | string | null | undefined) {\n this._min = convertToDate(value);\n this._validate();\n }\n\n public get min(): Date | null {\n return this._min;\n }\n\n /**\n * The maximum value required for the input to remain valid.\n * @attr\n */\n @property({ converter: convertToDate })\n public set max(value: Date | string | null | undefined) {\n this._max = convertToDate(value);\n this._validate();\n }\n\n public get max(): Date | null {\n return this._max;\n }\n\n /**\n * Format to display the value in when not editing.\n * Defaults to the locale format if not set.\n * @attr display-format\n */\n @property({ attribute: 'display-format' })\n public set displayFormat(value: string) {\n this._displayFormat = value;\n }\n\n public get displayFormat(): string {\n return (\n this._displayFormat ?? this._inputFormat ?? this._defaultDisplayFormat\n );\n }\n\n /**\n * Delta values used to increment or decrement each date part on step actions.\n * All values default to `1`.\n */\n @property({ attribute: false })\n public spinDelta?: DatePartDeltas;\n\n /**\n * Sets whether to loop over the currently spun segment.\n * @attr spin-loop\n */\n @property({ type: Boolean, attribute: 'spin-loop' })\n public spinLoop = true;\n\n /**\n * Gets/Sets the locale used for formatting the display value.\n * @attr locale\n */\n @property()\n public set locale(value: string) {\n this._i18nController.locale = value;\n }\n\n public get locale(): string {\n return this._i18nController.locale;\n }\n\n // #endregion\n\n //#region Lifecycle Hooks\n\n constructor() {\n super();\n\n addKeybindings(this, {\n skip: () => this.readOnly,\n bindingDefaults: { repeat: true },\n })\n .set([ctrlKey, ';'], this._setCurrentDateTime)\n .set(arrowUp, this._keyboardSpin.bind(this, 'up'))\n .set(arrowDown, this._keyboardSpin.bind(this, 'down'))\n .set([ctrlKey, arrowLeft], this._navigateParts.bind(this, 0))\n .set([ctrlKey, arrowRight], this._navigateParts.bind(this, 1));\n }\n\n protected override update(props: PropertyValues<this>): void {\n if (props.has('displayFormat')) {\n this._updateDefaultDisplayFormat();\n }\n\n if (props.has('locale')) {\n this._initializeDefaultMask();\n }\n\n if (props.has('displayFormat') || props.has('locale')) {\n this._updateMaskDisplay();\n }\n\n super.update(props);\n }\n\n //#endregion\n\n // #region Event handlers\n\n private _handleResourceChange(): void {\n this._initializeDefaultMask();\n this._updateMaskDisplay();\n }\n\n protected _handleDragLeave(): void {\n if (!this._focused) {\n this._updateMaskDisplay();\n }\n }\n\n protected _handleDragEnter(): void {\n if (!this._focused) {\n this._maskedValue = this._buildMaskedValue();\n }\n }\n\n /**\n * Handles wheel events for spinning date parts.\n */\n @eventOptions({ passive: false })\n protected async _handleWheel(event: WheelEvent): Promise<void> {\n if (!this._focused || this.readOnly) return;\n\n event.preventDefault();\n event.stopPropagation();\n\n const { start, end } = this._inputSelection;\n event.deltaY > 0 ? this.stepDown() : this.stepUp();\n this._emitInputEvent();\n\n await this.updateComplete;\n this.setSelectionRange(start, end);\n }\n\n // #endregion\n\n //#region Keybindings\n\n /**\n * Navigates to the previous or next date part.\n */\n protected _navigateParts(direction: number): void {\n const position = this._calculatePartNavigationPosition(\n this._input?.value ?? '',\n direction\n );\n this.setSelectionRange(position, position);\n }\n\n /**\n * Handles keyboard-triggered spinning (arrow up/down).\n */\n protected async _keyboardSpin(direction: 'up' | 'down'): Promise<void> {\n direction === 'up' ? this.stepUp() : this.stepDown();\n this._emitInputEvent();\n await this.updateComplete;\n this.setSelectionRange(this._maskSelection.start, this._maskSelection.end);\n }\n\n // #endregion\n\n //#region Internal API\n\n /**\n * Common logic for stepping up or down a date part.\n * @internal\n */\n protected _performStep(\n datePart: unknown,\n delta: number | undefined,\n isDecrement: boolean\n ): void {\n const part = datePart || this._targetDatePart;\n if (!part) return;\n\n const { start, end } = this._inputSelection;\n const newValue = this._calculateSpunValue(part, delta, isDecrement);\n this._commitSpunValue(newValue);\n this.updateComplete.then(() => this._input?.setSelectionRange(start, end));\n }\n\n /**\n * Updates the displayed mask value based on focus state.\n * When focused, shows the editable mask. When unfocused, defers to the leaf's display formatter.\n */\n protected _updateMaskDisplay(): void {\n this._maskedValue = this._focused\n ? this._buildMaskedValue()\n : this._buildDisplayValue();\n }\n\n /**\n * Checks if all mask positions are filled (no prompt characters remain).\n */\n protected _isMaskComplete(): boolean {\n return !this._maskedValue.includes(this.prompt);\n }\n\n /**\n * Applies a mask pattern to the input, parsing the format string into date parts.\n */\n protected _applyMask(formatString: string): void {\n const previous = this._parser.mask;\n this._parser.mask = formatString;\n\n // Update placeholder if not set or if it matches the old format\n if (!this.placeholder || previous === this.placeholder) {\n this.placeholder = this._parser.mask;\n }\n }\n\n /**\n * Updates the default display format based on current locale.\n */\n private _updateDefaultDisplayFormat(): void {\n this._defaultDisplayFormat = getDateFormatter().getLocaleDateTimeFormat(\n this.locale\n );\n }\n\n protected _initializeDefaultMask(): void {\n this._updateDefaultDisplayFormat();\n\n if (!this._inputFormat) {\n this._applyMask(getDefaultDateTimeFormat(this.locale));\n }\n }\n\n /**\n * Resolves the part names for the container based on the current state.\n */\n protected _resolvePartNames(base: string): Record<string, boolean> {\n return {\n [base]: true,\n prefixed: this._slots.hasAssignedElements('prefix', {\n selector: '[slot=\"prefix\"]:not([hidden])',\n }),\n suffixed: this._slots.hasAssignedElements('suffix', {\n selector: '[slot=\"suffix\"]:not([hidden])',\n }),\n filled: !this._isEmptyMask,\n };\n }\n\n // #endregion\n\n // #region Public API\n\n /** Selects all the text inside the input. */\n public select(): void {\n this._input?.select();\n }\n\n /* alternateName: focusComponent */\n /** Sets focus on the control. */\n public override focus(options?: FocusOptions): void {\n this._input?.focus(options);\n }\n\n /* alternateName: blurComponent */\n /** Removes focus from the control. */\n public override blur(): void {\n this._input?.blur();\n }\n\n /** Increments a date/time portion. */\n public stepUp(datePart?: unknown, delta?: number): void {\n this._performStep(datePart, delta, false);\n }\n\n /** Decrements a date/time portion. */\n public stepDown(datePart?: unknown, delta?: number): void {\n this._performStep(datePart, delta, true);\n }\n\n /** Clears the input element of user input. */\n public abstract clear(): void;\n\n //#endregion\n\n //#region Render\n\n protected _renderInput(): TemplateResult {\n const hasNegativeTabIndex = this.getAttribute('tabindex') === '-1';\n const hasHelperText = this._slots.hasAssignedElements('helper-text');\n\n return renderMaskedNativeInput({\n id: this._inputId,\n partNames: this._resolvePartNames('input'),\n name: this.name,\n value: this._maskedValue,\n placeholder: this.placeholder || this._parser.emptyMask,\n readOnly: this.readOnly,\n disabled: this.disabled,\n tabindex: hasNegativeTabIndex ? -1 : undefined,\n ariaDescribedBy: hasHelperText ? 'helper-text' : undefined,\n onInput: this._handleInput,\n onFocus: this._handleFocus,\n onBlur: this._handleBlur,\n onClick: this._handleClick,\n onSetMaskSelection: this._setMaskSelection,\n onCompositionStart: this._handleCompositionStart,\n onCompositionEnd: this._handleCompositionEnd,\n onWheel: this._handleWheel,\n onDragEnter: this._handleDragEnter,\n onDragLeave: this._handleDragLeave,\n });\n }\n\n protected override render() {\n return cache(\n renderInputShell(this, {\n theme: this._themes.theme,\n label: this.label,\n labelId: this._inputId,\n containerParts: this._resolvePartNames('container'),\n renderInput: this._renderInput,\n })\n );\n }\n\n //#endregion\n\n // #region Abstract methods and properties\n\n protected abstract get _datePartDeltas(): DatePartDeltas;\n\n protected abstract _buildMaskedValue(): string;\n protected abstract _buildDisplayValue(): string;\n protected abstract override _syncValueFromMask(): void;\n protected abstract _calculatePartNavigationPosition(\n value: string,\n direction: number\n ): number;\n protected abstract _calculateSpunValue(\n part: unknown,\n delta: number | undefined,\n isDecrement: boolean\n ): unknown;\n protected abstract _commitSpunValue(value: unknown): void;\n protected abstract _setCurrentDateTime(): void;\n protected abstract _handleFocus(): Promise<void>;\n protected abstract _getDatePartAtCursor(): unknown;\n protected abstract _getDefaultDatePart(): unknown;\n\n public abstract hasDateParts(): boolean;\n public abstract hasTimeParts(): boolean;\n\n // #endregion\n}\n"]}
|