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,51 +0,0 @@
|
|
|
1
|
-
import { IgcInputBaseComponent } from '../input/input-base.js';
|
|
2
|
-
import type { RangeTextSelectMode, SelectionRangeDirection } from '../types.js';
|
|
3
|
-
import { MaskParser } from './mask-parser.js';
|
|
4
|
-
export type MaskSelection = {
|
|
5
|
-
start: number;
|
|
6
|
-
end: number;
|
|
7
|
-
};
|
|
8
|
-
export declare abstract class IgcMaskInputBaseComponent extends IgcInputBaseComponent {
|
|
9
|
-
protected readonly _parser: MaskParser;
|
|
10
|
-
protected _maskSelection: MaskSelection;
|
|
11
|
-
protected _compositionStart: number;
|
|
12
|
-
protected _focused: boolean;
|
|
13
|
-
protected _maskedValue: string;
|
|
14
|
-
protected get _inputSelection(): MaskSelection;
|
|
15
|
-
/** Indicates whether the current mask value is empty. */
|
|
16
|
-
protected get _isEmptyMask(): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Makes the control a readonly field.
|
|
19
|
-
*
|
|
20
|
-
* @attr readonly
|
|
21
|
-
* @default false
|
|
22
|
-
*/
|
|
23
|
-
readOnly: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* The masked pattern of the component.
|
|
26
|
-
*
|
|
27
|
-
* @attr
|
|
28
|
-
* @default 'CCCCCCCCCC'
|
|
29
|
-
*/
|
|
30
|
-
set mask(value: string);
|
|
31
|
-
get mask(): string;
|
|
32
|
-
/**
|
|
33
|
-
* The prompt symbol to use for unfilled parts of the mask pattern.
|
|
34
|
-
*
|
|
35
|
-
* @attr
|
|
36
|
-
* @default '_'
|
|
37
|
-
*/
|
|
38
|
-
set prompt(value: string);
|
|
39
|
-
get prompt(): string;
|
|
40
|
-
protected _handleInput({ inputType, isComposing, }: InputEvent): Promise<void>;
|
|
41
|
-
protected _setMaskSelection(): void;
|
|
42
|
-
protected _handleCompositionStart(): void;
|
|
43
|
-
protected _handleCompositionEnd({ data }: CompositionEvent): void;
|
|
44
|
-
protected _handleClick(): void;
|
|
45
|
-
protected abstract _updateSetRangeTextValue(): void;
|
|
46
|
-
protected abstract _updateInput(text: string, range: MaskSelection): void;
|
|
47
|
-
/** Sets the text selection range of the control */
|
|
48
|
-
setSelectionRange(start?: number, end?: number, direction?: SelectionRangeDirection): void;
|
|
49
|
-
/** Replaces the selected text in the control and re-applies the mask */
|
|
50
|
-
setRangeText(replacement: string, start?: number, end?: number, selectMode?: RangeTextSelectMode): void;
|
|
51
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
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 { property, state } from 'lit/decorators.js';
|
|
8
|
-
import { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';
|
|
9
|
-
import { IgcInputBaseComponent } from '../input/input-base.js';
|
|
10
|
-
import { MaskParser } from './mask-parser.js';
|
|
11
|
-
let IgcMaskInputBaseComponent = class IgcMaskInputBaseComponent extends IgcInputBaseComponent {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this._parser = new MaskParser();
|
|
15
|
-
this._maskSelection = { start: 0, end: 0 };
|
|
16
|
-
this._compositionStart = 0;
|
|
17
|
-
this._focused = false;
|
|
18
|
-
this._maskedValue = '';
|
|
19
|
-
this.readOnly = false;
|
|
20
|
-
}
|
|
21
|
-
get _inputSelection() {
|
|
22
|
-
return {
|
|
23
|
-
start: this._input?.selectionStart || 0,
|
|
24
|
-
end: this._input?.selectionEnd || 0,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
get _isEmptyMask() {
|
|
28
|
-
return this._maskedValue === this._parser.emptyMask;
|
|
29
|
-
}
|
|
30
|
-
set mask(value) {
|
|
31
|
-
this._parser.mask = value;
|
|
32
|
-
}
|
|
33
|
-
get mask() {
|
|
34
|
-
return this._parser.mask;
|
|
35
|
-
}
|
|
36
|
-
set prompt(value) {
|
|
37
|
-
this._parser.prompt = value;
|
|
38
|
-
}
|
|
39
|
-
get prompt() {
|
|
40
|
-
return this._parser.prompt;
|
|
41
|
-
}
|
|
42
|
-
async _handleInput({ inputType, isComposing, }) {
|
|
43
|
-
const value = this._input?.value ?? '';
|
|
44
|
-
const { start, end } = this._maskSelection;
|
|
45
|
-
const deletePosition = this._parser.getNextNonLiteralPosition(end) + 1;
|
|
46
|
-
this._setTouchedState();
|
|
47
|
-
switch (inputType) {
|
|
48
|
-
case 'deleteContentForward':
|
|
49
|
-
this._updateInput('', { start, end: deletePosition });
|
|
50
|
-
await this.updateComplete;
|
|
51
|
-
return this._input?.setSelectionRange(deletePosition, deletePosition);
|
|
52
|
-
case 'deleteContentBackward':
|
|
53
|
-
if (isComposing)
|
|
54
|
-
return;
|
|
55
|
-
return this._updateInput('', {
|
|
56
|
-
start: this._parser.getPreviousNonLiteralPosition(this._inputSelection.start + 1),
|
|
57
|
-
end,
|
|
58
|
-
});
|
|
59
|
-
case 'deleteByCut':
|
|
60
|
-
return this._updateInput('', this._maskSelection);
|
|
61
|
-
case 'insertText':
|
|
62
|
-
return this._updateInput(value.substring(start, this._inputSelection.end), this._maskSelection);
|
|
63
|
-
case 'insertFromPaste':
|
|
64
|
-
return this._updateInput(value.substring(start, this._inputSelection.end), {
|
|
65
|
-
start,
|
|
66
|
-
end: this._inputSelection.start,
|
|
67
|
-
});
|
|
68
|
-
case 'insertFromDrop':
|
|
69
|
-
return this._updateInput(value.substring(this._inputSelection.start, this._inputSelection.end), { ...this._inputSelection });
|
|
70
|
-
case undefined:
|
|
71
|
-
case '':
|
|
72
|
-
return this._updateInput(this._parser.parse(value.substring(start, this._inputSelection.end)), {
|
|
73
|
-
start,
|
|
74
|
-
end: this._inputSelection.end,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
_setMaskSelection() {
|
|
79
|
-
this._maskSelection = this._inputSelection;
|
|
80
|
-
}
|
|
81
|
-
_handleCompositionStart() {
|
|
82
|
-
this._compositionStart = this._inputSelection.start;
|
|
83
|
-
}
|
|
84
|
-
_handleCompositionEnd({ data }) {
|
|
85
|
-
this._updateInput(data, {
|
|
86
|
-
start: this._compositionStart,
|
|
87
|
-
end: this._inputSelection.end,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
_handleClick() {
|
|
91
|
-
const { selectionStart: start, selectionEnd: end } = this._input ?? {
|
|
92
|
-
selectionStart: 0,
|
|
93
|
-
selectionEnd: 0,
|
|
94
|
-
};
|
|
95
|
-
if (start === end && start === this._maskedValue.length) {
|
|
96
|
-
this.select();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
setSelectionRange(start, end, direction = 'none') {
|
|
100
|
-
this._input?.setSelectionRange(start ?? null, end ?? null, direction);
|
|
101
|
-
this._maskSelection = { start: start ?? 0, end: end ?? 0 };
|
|
102
|
-
}
|
|
103
|
-
setRangeText(replacement, start, end, selectMode) {
|
|
104
|
-
const current = this._inputSelection;
|
|
105
|
-
const _start = start ?? current.start;
|
|
106
|
-
const _end = end ?? current.end;
|
|
107
|
-
const result = this._parser.replace(this._maskedValue || this._parser.emptyMask, replacement, _start, _end);
|
|
108
|
-
this._maskedValue = this._parser.apply(this._parser.parse(result.value));
|
|
109
|
-
this._updateSetRangeTextValue();
|
|
110
|
-
this.updateComplete.then(() => {
|
|
111
|
-
switch (selectMode) {
|
|
112
|
-
case 'select':
|
|
113
|
-
this.setSelectionRange(_start, _end);
|
|
114
|
-
break;
|
|
115
|
-
case 'start':
|
|
116
|
-
this.setSelectionRange(_start, _start);
|
|
117
|
-
break;
|
|
118
|
-
case 'end':
|
|
119
|
-
this.setSelectionRange(_end, _end);
|
|
120
|
-
break;
|
|
121
|
-
default:
|
|
122
|
-
this.setSelectionRange(current.start, current.end);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
__decorate([
|
|
128
|
-
state()
|
|
129
|
-
], IgcMaskInputBaseComponent.prototype, "_focused", void 0);
|
|
130
|
-
__decorate([
|
|
131
|
-
state()
|
|
132
|
-
], IgcMaskInputBaseComponent.prototype, "_maskedValue", void 0);
|
|
133
|
-
__decorate([
|
|
134
|
-
property({ type: Boolean, reflect: true })
|
|
135
|
-
], IgcMaskInputBaseComponent.prototype, "readOnly", void 0);
|
|
136
|
-
__decorate([
|
|
137
|
-
property()
|
|
138
|
-
], IgcMaskInputBaseComponent.prototype, "mask", null);
|
|
139
|
-
__decorate([
|
|
140
|
-
property()
|
|
141
|
-
], IgcMaskInputBaseComponent.prototype, "prompt", null);
|
|
142
|
-
IgcMaskInputBaseComponent = __decorate([
|
|
143
|
-
blazorDeepImport
|
|
144
|
-
], IgcMaskInputBaseComponent);
|
|
145
|
-
export { IgcMaskInputBaseComponent };
|
|
146
|
-
//# sourceMappingURL=mask-input-base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mask-input-base.js","sourceRoot":"","sources":["../../../src/components/mask-input/mask-input-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQvC,IAAe,yBAAyB,GAAxC,MAAe,yBAA0B,SAAQ,qBAAqB;IAAtE;;QAGc,YAAO,GAAG,IAAI,UAAU,EAAE,CAAC;QAEpC,mBAAc,GAAkB,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;QACrD,sBAAiB,GAAG,CAAC,CAAC;QAGtB,aAAQ,GAAG,KAAK,CAAC;QAGjB,iBAAY,GAAG,EAAE,CAAC;QAyBrB,aAAQ,GAAG,KAAK,CAAC;IAyL1B,CAAC;IAhNC,IAAc,eAAe;QAC3B,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,cAAc,IAAI,CAAC;YACvC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,YAAY,IAAI,CAAC;SACpC,CAAC;IACJ,CAAC;IAGD,IAAc,YAAY;QACxB,OAAO,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IACtD,CAAC;IAsBD,IAAW,IAAI,CAAC,KAAa;QAC3B,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IASD,IAAW,MAAM,CAAC,KAAa;QAC7B,IAAI,CAAC,OAAO,CAAC,M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K,OAAO;oBACV,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;oBACvC,MAAM;gBACR,KAAK,KAAK;oBACR,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;oBACnC,MAAM;gBACR;oBACE,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;YACvD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CAGF,CAAA;AArNW;IADT,KAAK,EAAE;2DACmB;AAGjB;IADT,KAAK,EAAE;+DACoB;AAyBrB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2DACnB;AASxB;IADC,QAAQ,EAAE;qDAGV;AAaD;IADC,QAAQ,EAAE;uDAGV;AA/DmB,yBAAyB;IAD9C,gBAAgB;GACK,yBAAyB,CA8N9C","sourcesContent":["import { property, state } from 'lit/decorators.js';\nimport { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';\nimport { IgcInputBaseComponent } from '../input/input-base.js';\nimport type { RangeTextSelectMode, SelectionRangeDirection } from '../types.js';\nimport { MaskParser } from './mask-parser.js';\n\nexport type MaskSelection = {\n start: number;\n end: number;\n};\n\n@blazorDeepImport\nexport abstract class IgcMaskInputBaseComponent extends IgcInputBaseComponent {\n //#region Internal state and properties\n\n protected readonly _parser = new MaskParser();\n\n protected _maskSelection: MaskSelection = { start: 0, end: 0 };\n protected _compositionStart = 0;\n\n @state()\n protected _focused = false;\n\n @state()\n protected _maskedValue = '';\n\n protected get _inputSelection(): MaskSelection {\n return {\n start: this._input?.selectionStart || 0,\n end: this._input?.selectionEnd || 0,\n };\n }\n\n /** Indicates whether the current mask value is empty. */\n protected get _isEmptyMask(): boolean {\n return this._maskedValue === this._parser.emptyMask;\n }\n\n //#endregion\n\n //#region Public attributes and properties\n\n /**\n * Makes the control a readonly field.\n *\n * @attr readonly\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public readOnly = false;\n\n /**\n * The masked pattern of the component.\n *\n * @attr\n * @default 'CCCCCCCCCC'\n */\n @property()\n public set mask(value: string) {\n this._parser.mask = value;\n }\n\n public get mask(): string {\n return this._parser.mask;\n }\n\n /**\n * The prompt symbol to use for unfilled parts of the mask pattern.\n *\n * @attr\n * @default '_'\n */\n @property()\n public set prompt(value: string) {\n this._parser.prompt = value;\n }\n\n public get prompt(): string {\n return this._parser.prompt;\n }\n\n //#endregion\n\n //#region Event handlers\n\n protected async _handleInput({\n inputType,\n isComposing,\n }: InputEvent): Promise<void> {\n const value = this._input?.value ?? '';\n const { start, end } = this._maskSelection;\n const deletePosition = this._parser.getNextNonLiteralPosition(end) + 1;\n this._setTouchedState();\n\n switch (inputType) {\n case 'deleteContentForward':\n this._updateInput('', { start, end: deletePosition });\n await this.updateComplete;\n return this._input?.setSelectionRange(deletePosition, deletePosition);\n\n case 'deleteContentBackward':\n if (isComposing) return;\n return this._updateInput('', {\n start: this._parser.getPreviousNonLiteralPosition(\n this._inputSelection.start + 1\n ),\n end,\n });\n\n case 'deleteByCut':\n return this._updateInput('', this._maskSelection);\n\n case 'insertText':\n return this._updateInput(\n value.substring(start, this._inputSelection.end),\n this._maskSelection\n );\n\n case 'insertFromPaste':\n return this._updateInput(\n value.substring(start, this._inputSelection.end),\n {\n start,\n end: this._inputSelection.start,\n }\n );\n\n case 'insertFromDrop':\n return this._updateInput(\n value.substring(this._inputSelection.start, this._inputSelection.end),\n { ...this._inputSelection }\n );\n\n // Potential browser auto-fill behavior\n case undefined:\n case '':\n return this._updateInput(\n this._parser.parse(value.substring(start, this._inputSelection.end)),\n {\n start,\n end: this._inputSelection.end,\n }\n );\n }\n }\n\n protected _setMaskSelection(): void {\n this._maskSelection = this._inputSelection;\n }\n\n protected _handleCompositionStart(): void {\n this._compositionStart = this._inputSelection.start;\n }\n\n protected _handleCompositionEnd({ data }: CompositionEvent): void {\n this._updateInput(data, {\n start: this._compositionStart,\n end: this._inputSelection.end,\n });\n }\n\n protected _handleClick(): void {\n const { selectionStart: start, selectionEnd: end } = this._input ?? {\n selectionStart: 0,\n selectionEnd: 0,\n };\n\n // Clicking at the end of the input field will select the entire mask\n if (start === end && start === this._maskedValue.length) {\n this.select();\n }\n }\n\n //#endregion\n\n //#region Internal methods\n\n protected abstract _updateSetRangeTextValue(): void;\n protected abstract _updateInput(text: string, range: MaskSelection): void;\n\n //#endregion\n\n //#region Public methods\n\n /* blazorSuppress */\n /** Sets the text selection range of the control */\n public setSelectionRange(\n start?: number,\n end?: number,\n direction: SelectionRangeDirection = 'none'\n ): void {\n this._input?.setSelectionRange(start ?? null, end ?? null, direction);\n this._maskSelection = { start: start ?? 0, end: end ?? 0 };\n }\n\n /* blazorSuppress */\n /** Replaces the selected text in the control and re-applies the mask */\n public setRangeText(\n replacement: string,\n start?: number,\n end?: number,\n selectMode?: RangeTextSelectMode\n ): void {\n const current = this._inputSelection;\n const _start = start ?? current.start;\n const _end = end ?? current.end;\n\n const result = this._parser.replace(\n this._maskedValue || this._parser.emptyMask,\n replacement,\n _start,\n _end\n );\n this._maskedValue = this._parser.apply(this._parser.parse(result.value));\n this._updateSetRangeTextValue();\n\n this.updateComplete.then(() => {\n switch (selectMode) {\n case 'select':\n this.setSelectionRange(_start, _end);\n break;\n case 'start':\n this.setSelectionRange(_start, _start);\n break;\n case 'end':\n this.setSelectionRange(_end, _end);\n break;\n default:\n this.setSelectionRange(current.start, current.end);\n }\n });\n }\n\n //#endregion\n}\n"]}
|