angular-ui-controls 0.0.0-stage → 0.1.0-rc.4
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/LICENSE +21 -0
- package/README.md +126 -2
- package/docs/api/README.md +29 -0
- package/docs/api/abbreviation-textarea.md +118 -0
- package/docs/api/action-menu.md +86 -0
- package/docs/api/advanced-select.md +214 -0
- package/docs/api/autocomplete.md +134 -0
- package/docs/api/checkbox.md +98 -0
- package/docs/api/date-picker.md +152 -0
- package/docs/api/date-range-picker.md +175 -0
- package/docs/api/date-time-picker.md +159 -0
- package/docs/api/file-upload.md +85 -0
- package/docs/api/number-input.md +162 -0
- package/docs/api/password-input.md +142 -0
- package/docs/api/pdf-viewer.md +50 -0
- package/docs/api/radio-group.md +126 -0
- package/docs/api/rich-text-editor.md +86 -0
- package/docs/api/search-filter.md +192 -0
- package/docs/api/search-input.md +160 -0
- package/docs/api/searchable-select.md +195 -0
- package/docs/api/segmented-control.md +93 -0
- package/docs/api/selection-list.md +120 -0
- package/docs/api/slide-toggle.md +105 -0
- package/docs/api/text-area.md +148 -0
- package/docs/api/text-input.md +159 -0
- package/docs/api/time-input.md +99 -0
- package/docs/api/time-picker.md +130 -0
- package/fesm2022/angular-ui-controls-editor-build-Cm2HSXEy.mjs +2 -0
- package/fesm2022/angular-ui-controls-editor-build-Cm2HSXEy.mjs.map +1 -0
- package/fesm2022/angular-ui-controls-forms.mjs +865 -0
- package/fesm2022/angular-ui-controls-forms.mjs.map +1 -0
- package/fesm2022/angular-ui-controls-text-input.mjs +1210 -0
- package/fesm2022/angular-ui-controls-text-input.mjs.map +1 -0
- package/fesm2022/angular-ui-controls.mjs +7181 -0
- package/fesm2022/angular-ui-controls.mjs.map +1 -0
- package/forms/index.d.ts +425 -0
- package/forms/index.d.ts.map +1 -0
- package/index.d.ts +4345 -0
- package/index.d.ts.map +1 -0
- package/package.json +82 -3
- package/text-input/index.d.ts +609 -0
- package/text-input/index.d.ts.map +1 -0
|
@@ -0,0 +1,1210 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, booleanAttribute, HostListener, Output, Input, Optional, Self, Directive, inject, ElementRef, ChangeDetectionStrategy, Component, Injectable, forwardRef, ViewChild, Pipe, NgModule } from '@angular/core';
|
|
3
|
+
import * as i3 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i1 from '@angular/forms';
|
|
6
|
+
import { FormsModule } from '@angular/forms';
|
|
7
|
+
import * as i4 from '@angular/material/form-field';
|
|
8
|
+
import { MatFormFieldModule, MatFormFieldControl } from '@angular/material/form-field';
|
|
9
|
+
import * as i5 from '@angular/material/input';
|
|
10
|
+
import { MatInputModule } from '@angular/material/input';
|
|
11
|
+
import * as i1$1 from '@angular/material/tooltip';
|
|
12
|
+
import { MatTooltip, MatTooltipModule } from '@angular/material/tooltip';
|
|
13
|
+
import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
|
|
14
|
+
import * as i2 from '@ngx-translate/core';
|
|
15
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
16
|
+
import { MatIconRegistry } from '@angular/material/icon';
|
|
17
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
18
|
+
import * as i2$1 from 'angular-mentions';
|
|
19
|
+
import { MentionModule } from 'angular-mentions';
|
|
20
|
+
import { Subject } from 'rxjs';
|
|
21
|
+
|
|
22
|
+
class BaseControlValueAccessor {
|
|
23
|
+
ngControl;
|
|
24
|
+
cdr;
|
|
25
|
+
/** The internal value of the control */
|
|
26
|
+
_value = null;
|
|
27
|
+
/** Standard change and touch callbacks */
|
|
28
|
+
onChangeCallback = () => { };
|
|
29
|
+
onTouchedCallback = () => { };
|
|
30
|
+
/** Internal storage for idPrefix */
|
|
31
|
+
rawIdPrefix = '';
|
|
32
|
+
/** Plain string property bound in template [id]="effectiveId" (zero function or CD overhead) */
|
|
33
|
+
effectiveId = '';
|
|
34
|
+
/** Internal storage for disabled state */
|
|
35
|
+
_disabled = false;
|
|
36
|
+
/**
|
|
37
|
+
* Disables the control. Angular Forms can also update this state through setDisabledState.
|
|
38
|
+
* @type boolean
|
|
39
|
+
*/
|
|
40
|
+
set disabled(val) {
|
|
41
|
+
this._disabled = val;
|
|
42
|
+
if (this.cdr) {
|
|
43
|
+
this.cdr.markForCheck();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
get disabled() {
|
|
47
|
+
if (this.ngControl?.control) {
|
|
48
|
+
return this.ngControl.control.disabled || this._disabled;
|
|
49
|
+
}
|
|
50
|
+
return this._disabled;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Optional namespace prepended to inner control IDs to distinguish repeated instances.
|
|
54
|
+
* @type string
|
|
55
|
+
*/
|
|
56
|
+
set idPrefix(prefix) {
|
|
57
|
+
this.rawIdPrefix = prefix || '';
|
|
58
|
+
this.configureId();
|
|
59
|
+
}
|
|
60
|
+
get idPrefix() {
|
|
61
|
+
return this.rawIdPrefix;
|
|
62
|
+
}
|
|
63
|
+
configureId() {
|
|
64
|
+
const rawId = this.rawInputId || this.inputId;
|
|
65
|
+
this.effectiveId = this.rawIdPrefix && rawId ? `${this.rawIdPrefix}_${rawId}` : rawId || '';
|
|
66
|
+
}
|
|
67
|
+
/** Canonical value binding. Programmatic writes never emit user change events. */
|
|
68
|
+
get value() {
|
|
69
|
+
return this._value;
|
|
70
|
+
}
|
|
71
|
+
set value(value) {
|
|
72
|
+
if (this.writingValue) {
|
|
73
|
+
this._value = value;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.writingValue = true;
|
|
77
|
+
try {
|
|
78
|
+
this.writeValue(value);
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
this.writingValue = false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
writingValue = false;
|
|
85
|
+
/** Raw value emitted once per committed user edit; supports [(value)]. */
|
|
86
|
+
valueChange = new EventEmitter();
|
|
87
|
+
/** Commit a view edit after the inner control has updated its local model. */
|
|
88
|
+
commitValue(value = this.value) {
|
|
89
|
+
if (this.disabled)
|
|
90
|
+
return;
|
|
91
|
+
this._value = value;
|
|
92
|
+
this.onChangeCallback(value);
|
|
93
|
+
this.valueChange.emit(value);
|
|
94
|
+
this.cdr?.markForCheck();
|
|
95
|
+
}
|
|
96
|
+
/** Touch the outer control only when focus leaves the whole composite control. */
|
|
97
|
+
handleFocusOut(event) {
|
|
98
|
+
const host = event.currentTarget;
|
|
99
|
+
if (event.relatedTarget && host?.contains(event.relatedTarget))
|
|
100
|
+
return;
|
|
101
|
+
this.onTouchedCallback();
|
|
102
|
+
}
|
|
103
|
+
constructor(ngControl, cdr) {
|
|
104
|
+
this.ngControl = ngControl;
|
|
105
|
+
this.cdr = cdr;
|
|
106
|
+
if (this.ngControl != null) {
|
|
107
|
+
this.ngControl.valueAccessor = this;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** Writes a new value from the form model to the view */
|
|
111
|
+
writeValue(value) {
|
|
112
|
+
this._value = value;
|
|
113
|
+
if (this.cdr) {
|
|
114
|
+
this.cdr.markForCheck();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/** Registers a callback function that is called when the control's value changes in the UI */
|
|
118
|
+
registerOnChange(fn) {
|
|
119
|
+
this.onChangeCallback = fn;
|
|
120
|
+
}
|
|
121
|
+
/** Registers a callback function that is called when the control is touched */
|
|
122
|
+
registerOnTouched(fn) {
|
|
123
|
+
this.onTouchedCallback = fn;
|
|
124
|
+
}
|
|
125
|
+
/** Updates the disabled state from the form model */
|
|
126
|
+
setDisabledState(isDisabled) {
|
|
127
|
+
this._disabled = isDisabled;
|
|
128
|
+
if (this.cdr) {
|
|
129
|
+
this.cdr.markForCheck();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: BaseControlValueAccessor, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
133
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.3.35", type: BaseControlValueAccessor, isStandalone: true, inputs: { disabled: ["disabled", "disabled", booleanAttribute], idPrefix: "idPrefix", value: "value" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "focusout": "handleFocusOut($event)" } }, ngImport: i0 });
|
|
134
|
+
}
|
|
135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: BaseControlValueAccessor, decorators: [{
|
|
136
|
+
type: Directive
|
|
137
|
+
}], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
|
|
138
|
+
type: Optional
|
|
139
|
+
}, {
|
|
140
|
+
type: Self
|
|
141
|
+
}] }, { type: i0.ChangeDetectorRef }], propDecorators: { disabled: [{
|
|
142
|
+
type: Input,
|
|
143
|
+
args: [{ transform: booleanAttribute }]
|
|
144
|
+
}], idPrefix: [{
|
|
145
|
+
type: Input
|
|
146
|
+
}], value: [{
|
|
147
|
+
type: Input
|
|
148
|
+
}], valueChange: [{
|
|
149
|
+
type: Output
|
|
150
|
+
}], handleFocusOut: [{
|
|
151
|
+
type: HostListener,
|
|
152
|
+
args: ['focusout', ['$event']]
|
|
153
|
+
}] } });
|
|
154
|
+
|
|
155
|
+
/** Normalize typing and paste consistently, while allowing intermediate '-' and decimal values. */
|
|
156
|
+
function normalizeInput(value, rules) {
|
|
157
|
+
if (rules.onlyAlphabets)
|
|
158
|
+
return value.replace(/[^\p{L}\p{M}\s]/gu, '');
|
|
159
|
+
if (!['number', 'percentage', 'integers'].includes(rules.inputType ?? ''))
|
|
160
|
+
return value;
|
|
161
|
+
const negative = !!rules.allowNegative && value.startsWith('-');
|
|
162
|
+
const decimal = rules.inputType !== 'integers' && rules.allowDecimal !== false;
|
|
163
|
+
const cleaned = value.replace(/[^\d.]/g, '');
|
|
164
|
+
const dot = cleaned.indexOf('.');
|
|
165
|
+
let whole = dot < 0 ? cleaned : cleaned.slice(0, dot);
|
|
166
|
+
let fraction = dot < 0 ? '' : cleaned.slice(dot + 1).replace(/\./g, '');
|
|
167
|
+
if (Number.isFinite(rules.maxDigits) && rules.maxDigits > 0)
|
|
168
|
+
whole = whole.slice(0, Math.floor(rules.maxDigits));
|
|
169
|
+
if (Number.isFinite(rules.decimalPlaces) && rules.decimalPlaces >= 0)
|
|
170
|
+
fraction = fraction.slice(0, Math.floor(rules.decimalPlaces));
|
|
171
|
+
return ((negative ? '-' : '') +
|
|
172
|
+
whole +
|
|
173
|
+
(decimal && dot >= 0 && rules.decimalPlaces !== 0 ? '.' + fraction : ''));
|
|
174
|
+
}
|
|
175
|
+
/** Apply numeric bounds on blur, so intermediate typing is not clamped prematurely. */
|
|
176
|
+
function clampInput(value, rules) {
|
|
177
|
+
if (!value.trim() || !['number', 'percentage', 'integers'].includes(rules.inputType ?? ''))
|
|
178
|
+
return value;
|
|
179
|
+
let number = Number(value);
|
|
180
|
+
if (!Number.isFinite(number))
|
|
181
|
+
return value;
|
|
182
|
+
if (Number.isFinite(rules.minValue))
|
|
183
|
+
number = Math.max(number, rules.minValue);
|
|
184
|
+
if (Number.isFinite(rules.maxValue))
|
|
185
|
+
number = Math.min(number, rules.maxValue);
|
|
186
|
+
return number === Number(value) ? value : String(number);
|
|
187
|
+
}
|
|
188
|
+
/** Filter primitives or object labels without mutating the source array. */
|
|
189
|
+
function filterOptions(items, query, key = '', startsWith = false) {
|
|
190
|
+
const search = String(query ?? '').toLocaleLowerCase();
|
|
191
|
+
if (!search)
|
|
192
|
+
return Array.from(items ?? []);
|
|
193
|
+
return (items ?? []).filter((item) => {
|
|
194
|
+
const label = String(key && item != null ? (item[key] ?? '') : (item ?? '')).toLocaleLowerCase();
|
|
195
|
+
return startsWith ? label.startsWith(search) : label.includes(search);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
/** Tokenize literal words for safe interpolation; user text is never treated as HTML or a regex. */
|
|
199
|
+
function highlightTokens(value, abbreviations, restricted) {
|
|
200
|
+
const words = new Map();
|
|
201
|
+
for (const [entries, kind] of [
|
|
202
|
+
[abbreviations, 'abbreviation'],
|
|
203
|
+
[restricted, 'restricted'],
|
|
204
|
+
])
|
|
205
|
+
for (const entry of entries ?? []) {
|
|
206
|
+
const word = entry.abbreviation ?? entry.word ?? entry.text;
|
|
207
|
+
if (word)
|
|
208
|
+
words.set(word.toLocaleLowerCase(), kind);
|
|
209
|
+
}
|
|
210
|
+
const tokens = [];
|
|
211
|
+
let plain = '';
|
|
212
|
+
let index = 0;
|
|
213
|
+
const keys = [...words.keys()].sort((a, b) => b.length - a.length);
|
|
214
|
+
const isWord = (c) => /[\p{L}\p{N}_]/u.test(c);
|
|
215
|
+
while (index < value.length) {
|
|
216
|
+
const match = keys.find((word) => value.slice(index, index + word.length).toLocaleLowerCase() === word &&
|
|
217
|
+
(!index || !isWord(value[index - 1])) &&
|
|
218
|
+
(!value[index + word.length] || !isWord(value[index + word.length])));
|
|
219
|
+
if (match) {
|
|
220
|
+
if (plain) {
|
|
221
|
+
tokens.push({ text: plain, kind: 'plain' });
|
|
222
|
+
plain = '';
|
|
223
|
+
}
|
|
224
|
+
tokens.push({
|
|
225
|
+
text: value.slice(index, index + match.length),
|
|
226
|
+
kind: words.get(match),
|
|
227
|
+
});
|
|
228
|
+
index += match.length;
|
|
229
|
+
}
|
|
230
|
+
else
|
|
231
|
+
plain += value[index++];
|
|
232
|
+
}
|
|
233
|
+
if (plain || !tokens.length)
|
|
234
|
+
tokens.push({ text: plain, kind: 'plain' });
|
|
235
|
+
return tokens;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Normalizes text/numeric input before Angular Forms receives the bubbling input event. */
|
|
239
|
+
class InputRulesDirective {
|
|
240
|
+
inputType = 'text';
|
|
241
|
+
onlyAlphabets = false;
|
|
242
|
+
maxDigits;
|
|
243
|
+
minValue;
|
|
244
|
+
maxValue;
|
|
245
|
+
allowDecimal;
|
|
246
|
+
decimalPlaces;
|
|
247
|
+
allowNegative = false;
|
|
248
|
+
element = inject(ElementRef).nativeElement;
|
|
249
|
+
normalize = (event) => {
|
|
250
|
+
if (event.isComposing)
|
|
251
|
+
return;
|
|
252
|
+
this.element.value = normalizeInput(this.element.value, this);
|
|
253
|
+
};
|
|
254
|
+
ngOnInit() {
|
|
255
|
+
this.element.addEventListener('input', this.normalize, true);
|
|
256
|
+
}
|
|
257
|
+
ngOnDestroy() {
|
|
258
|
+
this.element.removeEventListener('input', this.normalize, true);
|
|
259
|
+
}
|
|
260
|
+
clamp() {
|
|
261
|
+
const next = clampInput(this.element.value, this);
|
|
262
|
+
if (next !== this.element.value) {
|
|
263
|
+
this.element.value = next;
|
|
264
|
+
this.element.dispatchEvent(new Event('input', { bubbles: true }));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: InputRulesDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
268
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: InputRulesDirective, isStandalone: true, selector: "[uiInputRules]", inputs: { inputType: "inputType", onlyAlphabets: "onlyAlphabets", maxDigits: "maxDigits", minValue: "minValue", maxValue: "maxValue", allowDecimal: "allowDecimal", decimalPlaces: "decimalPlaces", allowNegative: "allowNegative" }, host: { listeners: { "blur": "clamp()" } }, ngImport: i0 });
|
|
269
|
+
}
|
|
270
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: InputRulesDirective, decorators: [{
|
|
271
|
+
type: Directive,
|
|
272
|
+
args: [{ selector: '[uiInputRules]', standalone: true }]
|
|
273
|
+
}], propDecorators: { inputType: [{
|
|
274
|
+
type: Input
|
|
275
|
+
}], onlyAlphabets: [{
|
|
276
|
+
type: Input
|
|
277
|
+
}], maxDigits: [{
|
|
278
|
+
type: Input
|
|
279
|
+
}], minValue: [{
|
|
280
|
+
type: Input
|
|
281
|
+
}], maxValue: [{
|
|
282
|
+
type: Input
|
|
283
|
+
}], allowDecimal: [{
|
|
284
|
+
type: Input
|
|
285
|
+
}], decimalPlaces: [{
|
|
286
|
+
type: Input
|
|
287
|
+
}], allowNegative: [{
|
|
288
|
+
type: Input
|
|
289
|
+
}], clamp: [{
|
|
290
|
+
type: HostListener,
|
|
291
|
+
args: ['blur']
|
|
292
|
+
}] } });
|
|
293
|
+
/** Removes leading whitespace from typing and paste; preserves whitespace inside the value. */
|
|
294
|
+
class TrimLeadingSpaceDirective {
|
|
295
|
+
element = inject(ElementRef).nativeElement;
|
|
296
|
+
trim = (e) => {
|
|
297
|
+
if (!e.isComposing)
|
|
298
|
+
this.element.value = this.element.value.replace(/^\s+/, '');
|
|
299
|
+
};
|
|
300
|
+
ngOnInit() {
|
|
301
|
+
this.element.addEventListener('input', this.trim, true);
|
|
302
|
+
}
|
|
303
|
+
ngOnDestroy() {
|
|
304
|
+
this.element.removeEventListener('input', this.trim, true);
|
|
305
|
+
}
|
|
306
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: TrimLeadingSpaceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
307
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: TrimLeadingSpaceDirective, isStandalone: true, selector: "[uiTrimLeadingSpace]", ngImport: i0 });
|
|
308
|
+
}
|
|
309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: TrimLeadingSpaceDirective, decorators: [{
|
|
310
|
+
type: Directive,
|
|
311
|
+
args: [{ selector: '[uiTrimLeadingSpace]', standalone: true }]
|
|
312
|
+
}] });
|
|
313
|
+
/** Limits the hour/minute fields to the configured count of decimal digits. */
|
|
314
|
+
class DigitLimitDirective {
|
|
315
|
+
uiDigitLimit = 2;
|
|
316
|
+
element = inject(ElementRef).nativeElement;
|
|
317
|
+
normalize = () => {
|
|
318
|
+
const limit = Number(this.uiDigitLimit);
|
|
319
|
+
const digits = this.element.value.replace(/\D/g, '');
|
|
320
|
+
this.element.value = Number.isFinite(limit) && limit > 0 ? digits.slice(0, limit) : digits;
|
|
321
|
+
};
|
|
322
|
+
ngOnInit() {
|
|
323
|
+
this.element.addEventListener('input', this.normalize, true);
|
|
324
|
+
}
|
|
325
|
+
ngOnDestroy() {
|
|
326
|
+
this.element.removeEventListener('input', this.normalize, true);
|
|
327
|
+
}
|
|
328
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: DigitLimitDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
329
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: DigitLimitDirective, isStandalone: true, selector: "[uiDigitLimit]", inputs: { uiDigitLimit: "uiDigitLimit" }, ngImport: i0 });
|
|
330
|
+
}
|
|
331
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: DigitLimitDirective, decorators: [{
|
|
332
|
+
type: Directive,
|
|
333
|
+
args: [{ selector: '[uiDigitLimit]', standalone: true }]
|
|
334
|
+
}], propDecorators: { uiDigitLimit: [{
|
|
335
|
+
type: Input
|
|
336
|
+
}] } });
|
|
337
|
+
/** Enables Arabic keyboard-layout substitution for Latin key presses; existing Arabic and IME input pass through. */
|
|
338
|
+
class ArabicInputDirective {
|
|
339
|
+
isEnabledArabicText = false;
|
|
340
|
+
element = inject(ElementRef).nativeElement;
|
|
341
|
+
keys = {
|
|
342
|
+
q: 'ض',
|
|
343
|
+
w: 'ص',
|
|
344
|
+
e: 'ث',
|
|
345
|
+
r: 'ق',
|
|
346
|
+
t: 'ف',
|
|
347
|
+
y: 'غ',
|
|
348
|
+
u: 'ع',
|
|
349
|
+
i: 'ه',
|
|
350
|
+
o: 'خ',
|
|
351
|
+
p: 'ح',
|
|
352
|
+
'[': 'ج',
|
|
353
|
+
']': 'د',
|
|
354
|
+
a: 'ش',
|
|
355
|
+
s: 'س',
|
|
356
|
+
d: 'ي',
|
|
357
|
+
f: 'ب',
|
|
358
|
+
g: 'ل',
|
|
359
|
+
h: 'ا',
|
|
360
|
+
j: 'ت',
|
|
361
|
+
k: 'ن',
|
|
362
|
+
l: 'م',
|
|
363
|
+
';': 'ك',
|
|
364
|
+
"'": 'ط',
|
|
365
|
+
z: 'ئ',
|
|
366
|
+
x: 'ء',
|
|
367
|
+
c: 'ؤ',
|
|
368
|
+
v: 'ر',
|
|
369
|
+
b: 'لا',
|
|
370
|
+
n: 'ى',
|
|
371
|
+
m: 'ة',
|
|
372
|
+
',': 'و',
|
|
373
|
+
'.': 'ز',
|
|
374
|
+
'/': 'ظ',
|
|
375
|
+
};
|
|
376
|
+
convert(event) {
|
|
377
|
+
if (!this.isEnabledArabicText ||
|
|
378
|
+
event.ctrlKey ||
|
|
379
|
+
event.metaKey ||
|
|
380
|
+
event.altKey ||
|
|
381
|
+
event.shiftKey ||
|
|
382
|
+
event.isComposing ||
|
|
383
|
+
this.element.readOnly ||
|
|
384
|
+
this.element.disabled)
|
|
385
|
+
return;
|
|
386
|
+
const replacement = this.keys[event.key];
|
|
387
|
+
if (!replacement)
|
|
388
|
+
return;
|
|
389
|
+
const start = this.element.selectionStart, end = this.element.selectionEnd;
|
|
390
|
+
if (start === null || end === null)
|
|
391
|
+
return;
|
|
392
|
+
const next = this.element.value.slice(0, start) + replacement + this.element.value.slice(end);
|
|
393
|
+
event.preventDefault();
|
|
394
|
+
if (this.element.maxLength >= 0 && next.length > this.element.maxLength)
|
|
395
|
+
return;
|
|
396
|
+
this.element.value = next;
|
|
397
|
+
this.element.setSelectionRange(start + replacement.length, start + replacement.length);
|
|
398
|
+
this.element.dispatchEvent(new Event('input', { bubbles: true }));
|
|
399
|
+
}
|
|
400
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: ArabicInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
401
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: ArabicInputDirective, isStandalone: true, selector: "[uiArabicInput]", inputs: { isEnabledArabicText: "isEnabledArabicText" }, host: { listeners: { "keydown": "convert($event)" } }, ngImport: i0 });
|
|
402
|
+
}
|
|
403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: ArabicInputDirective, decorators: [{
|
|
404
|
+
type: Directive,
|
|
405
|
+
args: [{ selector: '[uiArabicInput]', standalone: true }]
|
|
406
|
+
}], propDecorators: { isEnabledArabicText: [{
|
|
407
|
+
type: Input
|
|
408
|
+
}], convert: [{
|
|
409
|
+
type: HostListener,
|
|
410
|
+
args: ['keydown', ['$event']]
|
|
411
|
+
}] } });
|
|
412
|
+
/** Shows a Material tooltip only when the host text overflows its rendered box. */
|
|
413
|
+
class EllipsisTooltipDirective {
|
|
414
|
+
uiEllipsisTooltip = '';
|
|
415
|
+
tooltipPosition = 'above';
|
|
416
|
+
element = inject(ElementRef).nativeElement;
|
|
417
|
+
tooltip = inject(MatTooltip);
|
|
418
|
+
update() {
|
|
419
|
+
this.tooltip.message = String(this.uiEllipsisTooltip ?? '');
|
|
420
|
+
this.tooltip.position = this.tooltipPosition;
|
|
421
|
+
this.tooltip.disabled = !(this.element.scrollWidth > this.element.clientWidth ||
|
|
422
|
+
this.element.scrollHeight > this.element.clientHeight);
|
|
423
|
+
}
|
|
424
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: EllipsisTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
425
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: EllipsisTooltipDirective, isStandalone: true, selector: "[uiEllipsisTooltip]", inputs: { uiEllipsisTooltip: "uiEllipsisTooltip", tooltipPosition: "tooltipPosition" }, host: { listeners: { "mouseenter": "update()", "focusin": "update()" } }, hostDirectives: [{ directive: i1$1.MatTooltip }], ngImport: i0 });
|
|
426
|
+
}
|
|
427
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: EllipsisTooltipDirective, decorators: [{
|
|
428
|
+
type: Directive,
|
|
429
|
+
args: [{
|
|
430
|
+
selector: '[uiEllipsisTooltip]',
|
|
431
|
+
standalone: true,
|
|
432
|
+
hostDirectives: [MatTooltip],
|
|
433
|
+
}]
|
|
434
|
+
}], propDecorators: { uiEllipsisTooltip: [{
|
|
435
|
+
type: Input
|
|
436
|
+
}], tooltipPosition: [{
|
|
437
|
+
type: Input
|
|
438
|
+
}], update: [{
|
|
439
|
+
type: HostListener,
|
|
440
|
+
args: ['mouseenter']
|
|
441
|
+
}, {
|
|
442
|
+
type: HostListener,
|
|
443
|
+
args: ['focusin']
|
|
444
|
+
}] } });
|
|
445
|
+
/** Repositions an open autocomplete overlay when the viewport moves or resizes. */
|
|
446
|
+
class AutocompletePositionDirective {
|
|
447
|
+
trigger = inject(MatAutocompleteTrigger, { optional: true });
|
|
448
|
+
update() {
|
|
449
|
+
if (this.trigger?.panelOpen)
|
|
450
|
+
this.trigger.updatePosition();
|
|
451
|
+
}
|
|
452
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: AutocompletePositionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
453
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: AutocompletePositionDirective, isStandalone: true, selector: "[uiAutocompletePosition]", host: { listeners: { "window:resize": "update()", "window:scroll": "update()" } }, ngImport: i0 });
|
|
454
|
+
}
|
|
455
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: AutocompletePositionDirective, decorators: [{
|
|
456
|
+
type: Directive,
|
|
457
|
+
args: [{ selector: '[uiAutocompletePosition]', standalone: true }]
|
|
458
|
+
}], propDecorators: { update: [{
|
|
459
|
+
type: HostListener,
|
|
460
|
+
args: ['window:resize']
|
|
461
|
+
}, {
|
|
462
|
+
type: HostListener,
|
|
463
|
+
args: ['window:scroll']
|
|
464
|
+
}] } });
|
|
465
|
+
|
|
466
|
+
class PreventClipboardDirective {
|
|
467
|
+
/**
|
|
468
|
+
* Clipboard restriction flag retained with its current wiring. The local uiPreventClipboard directive blocks copy, cut, and paste when true.
|
|
469
|
+
* @default false
|
|
470
|
+
*/
|
|
471
|
+
preventCopyPasteCut = false;
|
|
472
|
+
constructor() { }
|
|
473
|
+
blockPaste(changeEvent) {
|
|
474
|
+
if (this.preventCopyPasteCut) {
|
|
475
|
+
changeEvent.preventDefault();
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
blockCopy(changeEvent) {
|
|
479
|
+
if (this.preventCopyPasteCut) {
|
|
480
|
+
changeEvent.preventDefault();
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
blockCut(changeEvent) {
|
|
484
|
+
if (this.preventCopyPasteCut) {
|
|
485
|
+
changeEvent.preventDefault();
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: PreventClipboardDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
489
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: PreventClipboardDirective, isStandalone: true, selector: "[uiPreventClipboard]", inputs: { preventCopyPasteCut: "preventCopyPasteCut" }, host: { listeners: { "paste": "blockPaste($event)", "copy": "blockCopy($event)", "cut": "blockCut($event)" } }, ngImport: i0 });
|
|
490
|
+
}
|
|
491
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: PreventClipboardDirective, decorators: [{
|
|
492
|
+
type: Directive,
|
|
493
|
+
args: [{
|
|
494
|
+
selector: '[uiPreventClipboard]',
|
|
495
|
+
standalone: true,
|
|
496
|
+
}]
|
|
497
|
+
}], ctorParameters: () => [], propDecorators: { preventCopyPasteCut: [{
|
|
498
|
+
type: Input
|
|
499
|
+
}], blockPaste: [{
|
|
500
|
+
type: HostListener,
|
|
501
|
+
args: ['paste', ['$event']]
|
|
502
|
+
}], blockCopy: [{
|
|
503
|
+
type: HostListener,
|
|
504
|
+
args: ['copy', ['$event']]
|
|
505
|
+
}], blockCut: [{
|
|
506
|
+
type: HostListener,
|
|
507
|
+
args: ['cut', ['$event']]
|
|
508
|
+
}] } });
|
|
509
|
+
|
|
510
|
+
class TextInputComponent extends BaseControlValueAccessor {
|
|
511
|
+
ngControl;
|
|
512
|
+
changeDetectorRef;
|
|
513
|
+
/**
|
|
514
|
+
* Clipboard restriction flag retained with its current wiring. The local uiPreventClipboard directive blocks copy, cut, and paste when true.
|
|
515
|
+
* @default false
|
|
516
|
+
* @type boolean
|
|
517
|
+
* @remarks Retained input; no consumer of this setting is present in the supplied class/template.
|
|
518
|
+
*/
|
|
519
|
+
preventCopyPasteCut = false;
|
|
520
|
+
/** HTML id attribute for the input element */
|
|
521
|
+
rawInputId = '';
|
|
522
|
+
/**
|
|
523
|
+
* Identifier assigned to the inner control; combined with idPrefix when supplied.
|
|
524
|
+
* @type string
|
|
525
|
+
* @remarks Required Angular input; provide a stable identifier.
|
|
526
|
+
*/
|
|
527
|
+
set inputId(id) {
|
|
528
|
+
this.rawInputId = id || '';
|
|
529
|
+
this.configureId();
|
|
530
|
+
}
|
|
531
|
+
get inputId() {
|
|
532
|
+
return this.rawInputId;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Tooltip text displayed on hover
|
|
536
|
+
* @default ''
|
|
537
|
+
* @type string
|
|
538
|
+
* @remarks Retained input; no consumer of this setting is present in the supplied class/template.
|
|
539
|
+
*/
|
|
540
|
+
tooltip = '';
|
|
541
|
+
/**
|
|
542
|
+
* Label text or translation key displayed for this control.
|
|
543
|
+
* @default ''
|
|
544
|
+
* @type string
|
|
545
|
+
*/
|
|
546
|
+
label = '';
|
|
547
|
+
/**
|
|
548
|
+
* Internal model getter/setter backed by the shared control value.
|
|
549
|
+
*/
|
|
550
|
+
get modelValue() {
|
|
551
|
+
return this.value;
|
|
552
|
+
}
|
|
553
|
+
set modelValue(val) {
|
|
554
|
+
this.value = val;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Validation error message
|
|
558
|
+
* @default ''
|
|
559
|
+
* @type string
|
|
560
|
+
*/
|
|
561
|
+
errorMessage = '';
|
|
562
|
+
/**
|
|
563
|
+
* Marks this control as required in its existing template; parent-form validators remain separately configured.
|
|
564
|
+
* @default false
|
|
565
|
+
* @type boolean
|
|
566
|
+
*/
|
|
567
|
+
required = false;
|
|
568
|
+
/**
|
|
569
|
+
* Consumer-defined field identifier included in event metadata. Existing event payload key names are preserved.
|
|
570
|
+
* @type string | number
|
|
571
|
+
* @renamedFrom textFieldName
|
|
572
|
+
*/
|
|
573
|
+
fieldName;
|
|
574
|
+
/**
|
|
575
|
+
* Hint text or translation key displayed while the control is empty.
|
|
576
|
+
* @default ''
|
|
577
|
+
* @type string
|
|
578
|
+
*/
|
|
579
|
+
placeholder = '';
|
|
580
|
+
/**
|
|
581
|
+
* Requests the existing read-only behavior without disabling the parent form control.
|
|
582
|
+
* @default false
|
|
583
|
+
* @type boolean
|
|
584
|
+
*/
|
|
585
|
+
readonly = false;
|
|
586
|
+
/**
|
|
587
|
+
* Maximum number of characters allowed
|
|
588
|
+
* @type number
|
|
589
|
+
*/
|
|
590
|
+
maxLength;
|
|
591
|
+
/**
|
|
592
|
+
* Shows the current input value in the tooltip when enabled.
|
|
593
|
+
* @default false
|
|
594
|
+
* @type boolean
|
|
595
|
+
* @renamedFrom showToolTip
|
|
596
|
+
*/
|
|
597
|
+
showTooltip = false;
|
|
598
|
+
/**
|
|
599
|
+
* Value written to the existing ChatGptAttr DOM attribute for field discovery.
|
|
600
|
+
* @default ''
|
|
601
|
+
* @type string
|
|
602
|
+
* @renamedFrom chatGptAttr
|
|
603
|
+
*/
|
|
604
|
+
assistantFieldId = '';
|
|
605
|
+
/**
|
|
606
|
+
* Prevents numbers and special special character
|
|
607
|
+
* @default false
|
|
608
|
+
* @type boolean
|
|
609
|
+
*/
|
|
610
|
+
onlyAlphabets = false;
|
|
611
|
+
/**
|
|
612
|
+
* Passes the Arabic typing flag to the existing utility directive.
|
|
613
|
+
* @default false
|
|
614
|
+
* @type boolean
|
|
615
|
+
* @renamedFrom appToArabic
|
|
616
|
+
*/
|
|
617
|
+
enableArabicInput = false;
|
|
618
|
+
/**
|
|
619
|
+
* Text displayed before the input value (e.g. '$', '+91', 'kg').
|
|
620
|
+
* @default ''
|
|
621
|
+
*/
|
|
622
|
+
prefix = '';
|
|
623
|
+
/**
|
|
624
|
+
* Controls whether the prefix is rendered. Set to `true` only when the prefix should be visible.
|
|
625
|
+
* @type boolean
|
|
626
|
+
*/
|
|
627
|
+
set showPrefix(enablePrefix) {
|
|
628
|
+
this.enablePrefix = enablePrefix;
|
|
629
|
+
}
|
|
630
|
+
enablePrefix = false;
|
|
631
|
+
/**
|
|
632
|
+
* Text displayed after the input, such as a unit or percentage sign.
|
|
633
|
+
* @default ''
|
|
634
|
+
* @renamedFrom postfix
|
|
635
|
+
*/
|
|
636
|
+
suffix = '';
|
|
637
|
+
/**
|
|
638
|
+
* Controls whether the suffix is rendered.
|
|
639
|
+
* @type boolean
|
|
640
|
+
* @renamedFrom showPostfix
|
|
641
|
+
*/
|
|
642
|
+
set showSuffix(enablePostfix) {
|
|
643
|
+
this.enablePostfix = enablePostfix;
|
|
644
|
+
}
|
|
645
|
+
enablePostfix = false;
|
|
646
|
+
/**
|
|
647
|
+
* Emits when the component model-change handler runs.
|
|
648
|
+
* @payload TextInputModelChangeEvent
|
|
649
|
+
* @remarks Payload shape is unchanged; see the emitting handler for field metadata.
|
|
650
|
+
* @renamedFrom onModelChange
|
|
651
|
+
*/
|
|
652
|
+
modelChange = new EventEmitter();
|
|
653
|
+
/**
|
|
654
|
+
* Emits from the existing input/change handler.
|
|
655
|
+
* @payload TextInputInputEvent
|
|
656
|
+
* @remarks Payload shape is unchanged; see the emitting handler for field metadata.
|
|
657
|
+
* @renamedFrom onInputChange
|
|
658
|
+
*/
|
|
659
|
+
inputChanged = new EventEmitter();
|
|
660
|
+
/**
|
|
661
|
+
* Emits when the inner field gains focus.
|
|
662
|
+
* @payload TextInputFocusEvent
|
|
663
|
+
* @remarks Payload shape is unchanged; see the emitting handler for field metadata.
|
|
664
|
+
* @renamedFrom onFocusChange
|
|
665
|
+
*/
|
|
666
|
+
focusGained = new EventEmitter();
|
|
667
|
+
/**
|
|
668
|
+
* Emits when the inner field loses focus.
|
|
669
|
+
* @payload TextInputBlurEvent
|
|
670
|
+
* @remarks Payload shape is unchanged; see the emitting handler for field metadata.
|
|
671
|
+
* @renamedFrom onBlurChange
|
|
672
|
+
*/
|
|
673
|
+
focusLost = new EventEmitter();
|
|
674
|
+
/**
|
|
675
|
+
* Emits on the inner field keydown event.
|
|
676
|
+
* @payload TextInputKeydownEvent
|
|
677
|
+
* @remarks Payload shape is unchanged; see the emitting handler for field metadata.
|
|
678
|
+
* @renamedFrom onKeydownHandle
|
|
679
|
+
*/
|
|
680
|
+
keyPressed = new EventEmitter();
|
|
681
|
+
/**
|
|
682
|
+
* Emits on the inner field keyup event.
|
|
683
|
+
* @payload TextInputKeyupEvent
|
|
684
|
+
* @remarks Payload shape is unchanged; see the emitting handler for field metadata.
|
|
685
|
+
* @renamedFrom onKeyupHandle
|
|
686
|
+
*/
|
|
687
|
+
keyReleased = new EventEmitter();
|
|
688
|
+
/**
|
|
689
|
+
* Emits when Enter is released in the inner field.
|
|
690
|
+
* @payload TextInputKeyEnterEvent
|
|
691
|
+
* @remarks Payload shape is unchanged; see the emitting handler for field metadata.
|
|
692
|
+
* @renamedFrom onKeyEnterHandle
|
|
693
|
+
*/
|
|
694
|
+
enterPressed = new EventEmitter();
|
|
695
|
+
/**
|
|
696
|
+
* Emits when the inner input is clicked.
|
|
697
|
+
* @payload TextInputClickEvent
|
|
698
|
+
* @remarks Payload shape is unchanged; see the emitting handler for field metadata.
|
|
699
|
+
* @renamedFrom onInputClickHandle
|
|
700
|
+
*/
|
|
701
|
+
inputClicked = new EventEmitter();
|
|
702
|
+
/**
|
|
703
|
+
* Returns shared field information attached
|
|
704
|
+
* to all emitted events.
|
|
705
|
+
*
|
|
706
|
+
* Includes:
|
|
707
|
+
* - Input DOM reference (if inputId is provided)
|
|
708
|
+
* - Current model value
|
|
709
|
+
* - Field identifier
|
|
710
|
+
*/
|
|
711
|
+
constructor(ngControl, translateService, changeDetectorRef) {
|
|
712
|
+
super(ngControl, changeDetectorRef);
|
|
713
|
+
this.ngControl = ngControl;
|
|
714
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
715
|
+
}
|
|
716
|
+
fieldInfo() {
|
|
717
|
+
let inputRef = null;
|
|
718
|
+
if (this.effectiveId) {
|
|
719
|
+
inputRef = typeof document === 'undefined' ? null : document.getElementById(this.effectiveId);
|
|
720
|
+
}
|
|
721
|
+
return {
|
|
722
|
+
...(inputRef && { inputRef: inputRef }),
|
|
723
|
+
modelValue: this.modelValue,
|
|
724
|
+
fieldName: this.fieldName,
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Emits when the model value changes
|
|
729
|
+
* @param modelChangeEvent - Updated model value
|
|
730
|
+
*/
|
|
731
|
+
modelValueChange(modelChangeEvent) {
|
|
732
|
+
this.modelChange.emit({
|
|
733
|
+
...this.fieldInfo(),
|
|
734
|
+
modelChangeEvent: modelChangeEvent,
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Emits on input value change
|
|
739
|
+
* @param changeValue - Input event
|
|
740
|
+
*/
|
|
741
|
+
inputChange(changeValue) {
|
|
742
|
+
this.inputChanged.emit({
|
|
743
|
+
...this.fieldInfo(),
|
|
744
|
+
changeEvent: changeValue,
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Emits when input gains focus
|
|
749
|
+
* @param onFocusEvent - Focus event
|
|
750
|
+
*/
|
|
751
|
+
focusChange(onFocusEvent) {
|
|
752
|
+
this.focusGained.emit({
|
|
753
|
+
...this.fieldInfo(),
|
|
754
|
+
focusEvent: onFocusEvent,
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Emits when input loses focus
|
|
759
|
+
* @param blurEvent - Blur event
|
|
760
|
+
*/
|
|
761
|
+
blurChange(blurEvent) {
|
|
762
|
+
this.focusLost.emit({
|
|
763
|
+
...this.fieldInfo(),
|
|
764
|
+
blurEvent: blurEvent,
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Emits on keydown action
|
|
769
|
+
* @param keyDownEvent - Keyboard event
|
|
770
|
+
*/
|
|
771
|
+
keydownHandle(keyDownEvent) {
|
|
772
|
+
this.keyPressed.emit({
|
|
773
|
+
...this.fieldInfo(),
|
|
774
|
+
keyDownEvent: keyDownEvent,
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Emits on keyup action
|
|
779
|
+
* @param keyUpEvent - Keyboard event
|
|
780
|
+
*/
|
|
781
|
+
keyupHandle(keyUpEvent) {
|
|
782
|
+
this.keyReleased.emit({
|
|
783
|
+
...this.fieldInfo(),
|
|
784
|
+
keyUpEvent: keyUpEvent,
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Emits when Enter key is pressed
|
|
789
|
+
* @param event - Keyboard or input event
|
|
790
|
+
*/
|
|
791
|
+
keyEnterHandle(event) {
|
|
792
|
+
this.enterPressed.emit({
|
|
793
|
+
...this.fieldInfo(),
|
|
794
|
+
keyEnterEvent: event,
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Emits when input field is clicked
|
|
799
|
+
* @param clickEvent - Mouse click event
|
|
800
|
+
*/
|
|
801
|
+
inputClick(clickEvent) {
|
|
802
|
+
this.inputClicked.emit({
|
|
803
|
+
...this.fieldInfo(),
|
|
804
|
+
clickEvent: clickEvent,
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: TextInputComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i2.TranslateService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
808
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.35", type: TextInputComponent, isStandalone: true, selector: "ui-text-input", inputs: { preventCopyPasteCut: "preventCopyPasteCut", inputId: "inputId", tooltip: "tooltip", label: "label", errorMessage: "errorMessage", required: "required", fieldName: "fieldName", placeholder: "placeholder", readonly: "readonly", maxLength: "maxLength", showTooltip: "showTooltip", assistantFieldId: "assistantFieldId", onlyAlphabets: "onlyAlphabets", enableArabicInput: "enableArabicInput", prefix: "prefix", showPrefix: "showPrefix", suffix: "suffix", showSuffix: "showSuffix" }, outputs: { modelChange: "modelChange", inputChanged: "inputChanged", focusGained: "focusGained", focusLost: "focusLost", keyPressed: "keyPressed", keyReleased: "keyReleased", enterPressed: "enterPressed", inputClicked: "inputClicked" }, usesInheritance: true, ngImport: i0, template: "<div [ngClass]=\"{ 'required-text': required && !modelValue }\">\n <mat-form-field appearance=\"outline\">\n @if (label) {\n <mat-label>{{ label | translate }}</mat-label>\n }\n @if (enablePrefix) {\n <span matTextPrefix>{{ prefix }} </span>\n }\n <input\n [id]=\"effectiveId\"\n [attr.ChatGptAttr]=\"assistantFieldId || null\"\n type=\"text\"\n matInput\n uiInputRules\n uiTrimLeadingSpace\n inputType=\"text\"\n uiArabicInput\n uiPreventClipboard\n [preventCopyPasteCut]=\"preventCopyPasteCut\"\n [isEnabledArabicText]=\"enableArabicInput\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"modelValue\"\n [ngModelOptions]=\"{ standalone: true }\"\n [onlyAlphabets]=\"onlyAlphabets\"\n (ngModelChange)=\"commitValue(); modelValueChange($event)\"\n (input)=\"inputChange($event)\"\n [attr.maxlength]=\"maxLength > 0 ? maxLength : null\"\n [attr.aria-required]=\"required\"\n (focus)=\"focusChange($event)\"\n (blur)=\"blurChange($event)\"\n placeholder=\"{{ placeholder | translate }}\"\n [readonly]=\"readonly\"\n (keydown)=\"keydownHandle($event)\"\n (keyup)=\"keyupHandle($event)\"\n (keyup.enter)=\"keyEnterHandle($event)\"\n (click)=\"inputClick($event)\"\n [required]=\"required\"\n [matTooltip]=\"showTooltip ? modelValue : ''\"\n />\n @if (enablePostfix) {\n <span matTextSuffix> {{ suffix }}</span>\n }\n @if (required && errorMessage) {\n <mat-error>\n {{ errorMessage | translate }}\n </mat-error>\n }\n </mat-form-field>\n</div>\n", styles: [":host{display:inline-block;width:100%}mat-form-field{width:100%;min-width:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i1$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "directive", type: InputRulesDirective, selector: "[uiInputRules]", inputs: ["inputType", "onlyAlphabets", "maxDigits", "minValue", "maxValue", "allowDecimal", "decimalPlaces", "allowNegative"] }, { kind: "directive", type: TrimLeadingSpaceDirective, selector: "[uiTrimLeadingSpace]" }, { kind: "directive", type: ArabicInputDirective, selector: "[uiArabicInput]", inputs: ["isEnabledArabicText"] }, { kind: "directive", type: PreventClipboardDirective, selector: "[uiPreventClipboard]", inputs: ["preventCopyPasteCut"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
809
|
+
}
|
|
810
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: TextInputComponent, decorators: [{
|
|
811
|
+
type: Component,
|
|
812
|
+
args: [{ selector: 'ui-text-input', standalone: true, imports: [
|
|
813
|
+
CommonModule,
|
|
814
|
+
FormsModule,
|
|
815
|
+
MatFormFieldModule,
|
|
816
|
+
MatInputModule,
|
|
817
|
+
MatTooltipModule,
|
|
818
|
+
TranslateModule,
|
|
819
|
+
InputRulesDirective,
|
|
820
|
+
TrimLeadingSpaceDirective,
|
|
821
|
+
ArabicInputDirective,
|
|
822
|
+
PreventClipboardDirective,
|
|
823
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"{ 'required-text': required && !modelValue }\">\n <mat-form-field appearance=\"outline\">\n @if (label) {\n <mat-label>{{ label | translate }}</mat-label>\n }\n @if (enablePrefix) {\n <span matTextPrefix>{{ prefix }} </span>\n }\n <input\n [id]=\"effectiveId\"\n [attr.ChatGptAttr]=\"assistantFieldId || null\"\n type=\"text\"\n matInput\n uiInputRules\n uiTrimLeadingSpace\n inputType=\"text\"\n uiArabicInput\n uiPreventClipboard\n [preventCopyPasteCut]=\"preventCopyPasteCut\"\n [isEnabledArabicText]=\"enableArabicInput\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"modelValue\"\n [ngModelOptions]=\"{ standalone: true }\"\n [onlyAlphabets]=\"onlyAlphabets\"\n (ngModelChange)=\"commitValue(); modelValueChange($event)\"\n (input)=\"inputChange($event)\"\n [attr.maxlength]=\"maxLength > 0 ? maxLength : null\"\n [attr.aria-required]=\"required\"\n (focus)=\"focusChange($event)\"\n (blur)=\"blurChange($event)\"\n placeholder=\"{{ placeholder | translate }}\"\n [readonly]=\"readonly\"\n (keydown)=\"keydownHandle($event)\"\n (keyup)=\"keyupHandle($event)\"\n (keyup.enter)=\"keyEnterHandle($event)\"\n (click)=\"inputClick($event)\"\n [required]=\"required\"\n [matTooltip]=\"showTooltip ? modelValue : ''\"\n />\n @if (enablePostfix) {\n <span matTextSuffix> {{ suffix }}</span>\n }\n @if (required && errorMessage) {\n <mat-error>\n {{ errorMessage | translate }}\n </mat-error>\n }\n </mat-form-field>\n</div>\n", styles: [":host{display:inline-block;width:100%}mat-form-field{width:100%;min-width:0}\n"] }]
|
|
824
|
+
}], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
|
|
825
|
+
type: Optional
|
|
826
|
+
}, {
|
|
827
|
+
type: Self
|
|
828
|
+
}] }, { type: i2.TranslateService }, { type: i0.ChangeDetectorRef }], propDecorators: { preventCopyPasteCut: [{
|
|
829
|
+
type: Input
|
|
830
|
+
}], inputId: [{
|
|
831
|
+
type: Input,
|
|
832
|
+
args: [{ required: true }]
|
|
833
|
+
}], tooltip: [{
|
|
834
|
+
type: Input
|
|
835
|
+
}], label: [{
|
|
836
|
+
type: Input
|
|
837
|
+
}], errorMessage: [{
|
|
838
|
+
type: Input
|
|
839
|
+
}], required: [{
|
|
840
|
+
type: Input
|
|
841
|
+
}], fieldName: [{
|
|
842
|
+
type: Input
|
|
843
|
+
}], placeholder: [{
|
|
844
|
+
type: Input
|
|
845
|
+
}], readonly: [{
|
|
846
|
+
type: Input
|
|
847
|
+
}], maxLength: [{
|
|
848
|
+
type: Input
|
|
849
|
+
}], showTooltip: [{
|
|
850
|
+
type: Input
|
|
851
|
+
}], assistantFieldId: [{
|
|
852
|
+
type: Input
|
|
853
|
+
}], onlyAlphabets: [{
|
|
854
|
+
type: Input
|
|
855
|
+
}], enableArabicInput: [{
|
|
856
|
+
type: Input
|
|
857
|
+
}], prefix: [{
|
|
858
|
+
type: Input
|
|
859
|
+
}], showPrefix: [{
|
|
860
|
+
type: Input
|
|
861
|
+
}], suffix: [{
|
|
862
|
+
type: Input
|
|
863
|
+
}], showSuffix: [{
|
|
864
|
+
type: Input
|
|
865
|
+
}], modelChange: [{
|
|
866
|
+
type: Output
|
|
867
|
+
}], inputChanged: [{
|
|
868
|
+
type: Output
|
|
869
|
+
}], focusGained: [{
|
|
870
|
+
type: Output
|
|
871
|
+
}], focusLost: [{
|
|
872
|
+
type: Output
|
|
873
|
+
}], keyPressed: [{
|
|
874
|
+
type: Output
|
|
875
|
+
}], keyReleased: [{
|
|
876
|
+
type: Output
|
|
877
|
+
}], enterPressed: [{
|
|
878
|
+
type: Output
|
|
879
|
+
}], inputClicked: [{
|
|
880
|
+
type: Output
|
|
881
|
+
}] } });
|
|
882
|
+
|
|
883
|
+
/** Registers bundled icons in a private namespace without external requests. */
|
|
884
|
+
class UiIconsService {
|
|
885
|
+
constructor() {
|
|
886
|
+
const registry = inject(MatIconRegistry);
|
|
887
|
+
const sanitizer = inject(DomSanitizer);
|
|
888
|
+
const paths = {
|
|
889
|
+
check: '<path d="m5 12 4 4L19 6"/>',
|
|
890
|
+
close: '<path d="m6 6 12 12M18 6 6 18"/>',
|
|
891
|
+
upload: '<path d="M12 16V3m-5 5 5-5 5 5M4 16v5h16v-5"/>',
|
|
892
|
+
search: '<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/>',
|
|
893
|
+
visible: '<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',
|
|
894
|
+
hidden: '<path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"/><path d="m2 2 20 20"/>',
|
|
895
|
+
};
|
|
896
|
+
for (const [name, path] of Object.entries(paths)) {
|
|
897
|
+
// The markup is a fixed local constant; no consumer text enters this trust boundary.
|
|
898
|
+
registry.addSvgIconLiteralInNamespace('ui', name, sanitizer.bypassSecurityTrustHtml(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${path}</svg>`));
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: UiIconsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
902
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: UiIconsService, providedIn: 'root' });
|
|
903
|
+
}
|
|
904
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: UiIconsService, decorators: [{
|
|
905
|
+
type: Injectable,
|
|
906
|
+
args: [{ providedIn: 'root' }]
|
|
907
|
+
}], ctorParameters: () => [] });
|
|
908
|
+
|
|
909
|
+
/** Editable textarea with safe abbreviation/restricted-word highlighting and Material form-field integration. */
|
|
910
|
+
class AbbreviationTextareaComponent {
|
|
911
|
+
ngControl;
|
|
912
|
+
static nextId = 0;
|
|
913
|
+
id = `ui-abbreviation-${AbbreviationTextareaComponent.nextId++}`;
|
|
914
|
+
placeholder = '';
|
|
915
|
+
accessibleLabel = '';
|
|
916
|
+
disabled = false;
|
|
917
|
+
required = false;
|
|
918
|
+
/** @deprecated Use readonly. */
|
|
919
|
+
readOnly = false;
|
|
920
|
+
get readonly() {
|
|
921
|
+
return this.readOnly;
|
|
922
|
+
}
|
|
923
|
+
set readonly(value) {
|
|
924
|
+
this.readOnly = value;
|
|
925
|
+
}
|
|
926
|
+
maxLength = null;
|
|
927
|
+
minRows = 3;
|
|
928
|
+
maxRows = 6;
|
|
929
|
+
preventCopy = false;
|
|
930
|
+
preventCut = false;
|
|
931
|
+
preventPaste = false;
|
|
932
|
+
abbreviationList = [];
|
|
933
|
+
restrictedWords = [];
|
|
934
|
+
mentionConfig = null;
|
|
935
|
+
assistantFieldId = '';
|
|
936
|
+
valueChange = new EventEmitter();
|
|
937
|
+
controlTextChange = new EventEmitter();
|
|
938
|
+
focusIn = new EventEmitter();
|
|
939
|
+
focusOut = new EventEmitter();
|
|
940
|
+
input;
|
|
941
|
+
highlight;
|
|
942
|
+
stateChanges = new Subject();
|
|
943
|
+
controlType = 'ui-abbreviation-textarea';
|
|
944
|
+
autofilled = false;
|
|
945
|
+
focused = false;
|
|
946
|
+
errorState = false;
|
|
947
|
+
describedBy = '';
|
|
948
|
+
tokens = [];
|
|
949
|
+
mentionOptions = { mentions: [] };
|
|
950
|
+
text = '';
|
|
951
|
+
change = () => { };
|
|
952
|
+
touched = () => { };
|
|
953
|
+
constructor(ngControl) {
|
|
954
|
+
this.ngControl = ngControl;
|
|
955
|
+
if (ngControl)
|
|
956
|
+
ngControl.valueAccessor = this;
|
|
957
|
+
}
|
|
958
|
+
get value() {
|
|
959
|
+
return this.text;
|
|
960
|
+
}
|
|
961
|
+
set value(value) {
|
|
962
|
+
this.text = value ?? '';
|
|
963
|
+
this.refresh();
|
|
964
|
+
}
|
|
965
|
+
get empty() {
|
|
966
|
+
return !this.text;
|
|
967
|
+
}
|
|
968
|
+
get shouldLabelFloat() {
|
|
969
|
+
return this.focused || !this.empty;
|
|
970
|
+
}
|
|
971
|
+
ngOnChanges() {
|
|
972
|
+
this.mentionOptions = {
|
|
973
|
+
mentions: (this.mentionConfig ?? []).map((config) => ({
|
|
974
|
+
items: config.items ?? [],
|
|
975
|
+
triggerChar: config.triggerChar ?? '@',
|
|
976
|
+
labelKey: config.labelKey ?? 'abbreviation',
|
|
977
|
+
mentionSelect: config.mentionSelect ??
|
|
978
|
+
((item) => String(item.remarks ?? item.abbreviation ?? item.label ?? '')),
|
|
979
|
+
})),
|
|
980
|
+
};
|
|
981
|
+
this.refresh();
|
|
982
|
+
}
|
|
983
|
+
ngDoCheck() {
|
|
984
|
+
const error = !!(this.ngControl?.invalid && (this.ngControl.touched || this.ngControl.dirty));
|
|
985
|
+
if (error !== this.errorState) {
|
|
986
|
+
this.errorState = error;
|
|
987
|
+
this.stateChanges.next();
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
ngAfterViewInit() {
|
|
991
|
+
this.adjustHeight();
|
|
992
|
+
}
|
|
993
|
+
adjustHeight() {
|
|
994
|
+
const el = this.input?.nativeElement;
|
|
995
|
+
if (!el || typeof getComputedStyle === 'undefined')
|
|
996
|
+
return;
|
|
997
|
+
const lineHeight = parseFloat(getComputedStyle(el).lineHeight) || 21;
|
|
998
|
+
const minHeight = Math.max(1, this.minRows) * lineHeight;
|
|
999
|
+
const maxHeight = Math.max(this.minRows, this.maxRows) * lineHeight;
|
|
1000
|
+
el.style.height = 'auto';
|
|
1001
|
+
const nextHeight = Math.min(Math.max(el.scrollHeight, minHeight), maxHeight);
|
|
1002
|
+
el.style.height = `${nextHeight}px`;
|
|
1003
|
+
el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden';
|
|
1004
|
+
this.syncScroll();
|
|
1005
|
+
}
|
|
1006
|
+
refresh() {
|
|
1007
|
+
this.tokens = highlightTokens(this.text, this.abbreviationList, this.restrictedWords);
|
|
1008
|
+
this.stateChanges.next();
|
|
1009
|
+
if (this.input) {
|
|
1010
|
+
Promise.resolve().then(() => this.adjustHeight());
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
writeValue(value) {
|
|
1014
|
+
this.value = value;
|
|
1015
|
+
}
|
|
1016
|
+
registerOnChange(fn) {
|
|
1017
|
+
this.change = fn;
|
|
1018
|
+
}
|
|
1019
|
+
registerOnTouched(fn) {
|
|
1020
|
+
this.touched = fn;
|
|
1021
|
+
}
|
|
1022
|
+
setDisabledState(disabled) {
|
|
1023
|
+
this.disabled = disabled;
|
|
1024
|
+
this.stateChanges.next();
|
|
1025
|
+
}
|
|
1026
|
+
setDescribedByIds(ids) {
|
|
1027
|
+
this.describedBy = ids.join(' ');
|
|
1028
|
+
}
|
|
1029
|
+
onContainerClick() {
|
|
1030
|
+
if (!this.disabled)
|
|
1031
|
+
this.input?.nativeElement.focus();
|
|
1032
|
+
}
|
|
1033
|
+
onInput(event) {
|
|
1034
|
+
this.value = event.target.value;
|
|
1035
|
+
this.change(this.text);
|
|
1036
|
+
this.controlTextChange.emit(this.text);
|
|
1037
|
+
this.valueChange.emit(this.text);
|
|
1038
|
+
}
|
|
1039
|
+
onFocus(event) {
|
|
1040
|
+
this.focused = true;
|
|
1041
|
+
this.stateChanges.next();
|
|
1042
|
+
this.focusIn.emit(event);
|
|
1043
|
+
}
|
|
1044
|
+
onBlur(event) {
|
|
1045
|
+
this.focused = false;
|
|
1046
|
+
this.touched();
|
|
1047
|
+
this.stateChanges.next();
|
|
1048
|
+
this.focusOut.emit(event);
|
|
1049
|
+
}
|
|
1050
|
+
syncScroll() {
|
|
1051
|
+
if (this.input && this.highlight) {
|
|
1052
|
+
this.highlight.nativeElement.scrollTop = this.input.nativeElement.scrollTop;
|
|
1053
|
+
this.highlight.nativeElement.scrollLeft = this.input.nativeElement.scrollLeft;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
block(event, prevent) {
|
|
1057
|
+
if (prevent)
|
|
1058
|
+
event.preventDefault();
|
|
1059
|
+
}
|
|
1060
|
+
ngOnDestroy() {
|
|
1061
|
+
this.stateChanges.complete();
|
|
1062
|
+
}
|
|
1063
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: AbbreviationTextareaComponent, deps: [{ token: i1.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1064
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.35", type: AbbreviationTextareaComponent, isStandalone: true, selector: "ui-abbreviation-textarea", inputs: { id: "id", placeholder: "placeholder", accessibleLabel: "accessibleLabel", disabled: "disabled", required: "required", readOnly: "readOnly", readonly: "readonly", maxLength: "maxLength", minRows: "minRows", maxRows: "maxRows", preventCopy: "preventCopy", preventCut: "preventCut", preventPaste: "preventPaste", abbreviationList: "abbreviationList", restrictedWords: "restrictedWords", mentionConfig: "mentionConfig", assistantFieldId: "assistantFieldId", value: "value" }, outputs: { valueChange: "valueChange", controlTextChange: "controlTextChange", focusIn: "focusIn", focusOut: "focusOut" }, host: { properties: { "attr.id": "id", "class.disabled": "disabled" } }, providers: [
|
|
1065
|
+
{
|
|
1066
|
+
provide: MatFormFieldControl,
|
|
1067
|
+
useExisting: forwardRef(() => AbbreviationTextareaComponent),
|
|
1068
|
+
},
|
|
1069
|
+
], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }, { propertyName: "highlight", first: true, predicate: ["highlight"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"editor\">\n <div #highlight class=\"highlight\" aria-hidden=\"true\">\n @for (token of tokens; track $index) {\n <span\n [class.abbreviation]=\"token.kind === 'abbreviation'\"\n [class.restricted]=\"token.kind === 'restricted'\"\n >{{ token.text }}</span\n >\n }\n {{ '\\n' }}\n </div>\n <textarea\n #input\n [attr.aria-label]=\"accessibleLabel || placeholder || 'Text'\"\n [value]=\"value\"\n [disabled]=\"disabled\"\n [readOnly]=\"readOnly\"\n [required]=\"required\"\n [rows]=\"minRows\"\n [style.max-height.em]=\"maxRows * 1.5\"\n [attr.maxlength]=\"maxLength\"\n [placeholder]=\"placeholder\"\n [attr.aria-describedby]=\"describedBy\"\n [attr.aria-required]=\"required\"\n [attr.aria-invalid]=\"errorState\"\n [attr.ChatGptAttr]=\"assistantFieldId || null\"\n [mentionConfig]=\"mentionOptions\"\n [mention]=\"[]\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n (scroll)=\"syncScroll()\"\n (copy)=\"block($event, preventCopy)\"\n (cut)=\"block($event, preventCut)\"\n (paste)=\"block($event, preventPaste)\"\n ></textarea>\n</div>\n", styles: [":host{display:block;width:100%}.editor{position:relative}textarea,.highlight{box-sizing:border-box;width:100%;margin:0;padding:0;border:0;font:inherit;line-height:1.5;letter-spacing:inherit;white-space:pre-wrap;overflow-wrap:break-word}textarea{position:relative;display:block;resize:none;overflow-y:auto;background:transparent;color:inherit;outline:none}.highlight{position:absolute;inset:0;overflow:hidden;pointer-events:none;color:transparent}.abbreviation{background:#ffc1074d}.restricted{background:#f443362e;text-decoration:underline wavy #d32f2f}:host(.disabled){opacity:.6}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MentionModule }, { kind: "directive", type: i2$1.MentionDirective, selector: "[mention], [mentionConfig]", inputs: ["mention", "mentionConfig", "mentionListTemplate"], outputs: ["searchTerm", "itemSelected", "opened", "closed"] }] });
|
|
1070
|
+
}
|
|
1071
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: AbbreviationTextareaComponent, decorators: [{
|
|
1072
|
+
type: Component,
|
|
1073
|
+
args: [{ selector: 'ui-abbreviation-textarea', standalone: true, imports: [CommonModule, MentionModule], providers: [
|
|
1074
|
+
{
|
|
1075
|
+
provide: MatFormFieldControl,
|
|
1076
|
+
useExisting: forwardRef(() => AbbreviationTextareaComponent),
|
|
1077
|
+
},
|
|
1078
|
+
], host: { '[attr.id]': 'id', '[class.disabled]': 'disabled' }, template: "<div class=\"editor\">\n <div #highlight class=\"highlight\" aria-hidden=\"true\">\n @for (token of tokens; track $index) {\n <span\n [class.abbreviation]=\"token.kind === 'abbreviation'\"\n [class.restricted]=\"token.kind === 'restricted'\"\n >{{ token.text }}</span\n >\n }\n {{ '\\n' }}\n </div>\n <textarea\n #input\n [attr.aria-label]=\"accessibleLabel || placeholder || 'Text'\"\n [value]=\"value\"\n [disabled]=\"disabled\"\n [readOnly]=\"readOnly\"\n [required]=\"required\"\n [rows]=\"minRows\"\n [style.max-height.em]=\"maxRows * 1.5\"\n [attr.maxlength]=\"maxLength\"\n [placeholder]=\"placeholder\"\n [attr.aria-describedby]=\"describedBy\"\n [attr.aria-required]=\"required\"\n [attr.aria-invalid]=\"errorState\"\n [attr.ChatGptAttr]=\"assistantFieldId || null\"\n [mentionConfig]=\"mentionOptions\"\n [mention]=\"[]\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n (scroll)=\"syncScroll()\"\n (copy)=\"block($event, preventCopy)\"\n (cut)=\"block($event, preventCut)\"\n (paste)=\"block($event, preventPaste)\"\n ></textarea>\n</div>\n", styles: [":host{display:block;width:100%}.editor{position:relative}textarea,.highlight{box-sizing:border-box;width:100%;margin:0;padding:0;border:0;font:inherit;line-height:1.5;letter-spacing:inherit;white-space:pre-wrap;overflow-wrap:break-word}textarea{position:relative;display:block;resize:none;overflow-y:auto;background:transparent;color:inherit;outline:none}.highlight{position:absolute;inset:0;overflow:hidden;pointer-events:none;color:transparent}.abbreviation{background:#ffc1074d}.restricted{background:#f443362e;text-decoration:underline wavy #d32f2f}:host(.disabled){opacity:.6}\n"] }]
|
|
1079
|
+
}], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
|
|
1080
|
+
type: Optional
|
|
1081
|
+
}, {
|
|
1082
|
+
type: Self
|
|
1083
|
+
}] }], propDecorators: { id: [{
|
|
1084
|
+
type: Input
|
|
1085
|
+
}], placeholder: [{
|
|
1086
|
+
type: Input
|
|
1087
|
+
}], accessibleLabel: [{
|
|
1088
|
+
type: Input
|
|
1089
|
+
}], disabled: [{
|
|
1090
|
+
type: Input
|
|
1091
|
+
}], required: [{
|
|
1092
|
+
type: Input
|
|
1093
|
+
}], readOnly: [{
|
|
1094
|
+
type: Input
|
|
1095
|
+
}], readonly: [{
|
|
1096
|
+
type: Input
|
|
1097
|
+
}], maxLength: [{
|
|
1098
|
+
type: Input
|
|
1099
|
+
}], minRows: [{
|
|
1100
|
+
type: Input
|
|
1101
|
+
}], maxRows: [{
|
|
1102
|
+
type: Input
|
|
1103
|
+
}], preventCopy: [{
|
|
1104
|
+
type: Input
|
|
1105
|
+
}], preventCut: [{
|
|
1106
|
+
type: Input
|
|
1107
|
+
}], preventPaste: [{
|
|
1108
|
+
type: Input
|
|
1109
|
+
}], abbreviationList: [{
|
|
1110
|
+
type: Input
|
|
1111
|
+
}], restrictedWords: [{
|
|
1112
|
+
type: Input
|
|
1113
|
+
}], mentionConfig: [{
|
|
1114
|
+
type: Input
|
|
1115
|
+
}], assistantFieldId: [{
|
|
1116
|
+
type: Input
|
|
1117
|
+
}], valueChange: [{
|
|
1118
|
+
type: Output
|
|
1119
|
+
}], controlTextChange: [{
|
|
1120
|
+
type: Output
|
|
1121
|
+
}], focusIn: [{
|
|
1122
|
+
type: Output
|
|
1123
|
+
}], focusOut: [{
|
|
1124
|
+
type: Output
|
|
1125
|
+
}], input: [{
|
|
1126
|
+
type: ViewChild,
|
|
1127
|
+
args: ['input']
|
|
1128
|
+
}], highlight: [{
|
|
1129
|
+
type: ViewChild,
|
|
1130
|
+
args: ['highlight']
|
|
1131
|
+
}], value: [{
|
|
1132
|
+
type: Input
|
|
1133
|
+
}] } });
|
|
1134
|
+
|
|
1135
|
+
/** Case-insensitive local option filtering. Server-backed callers can pass an empty query. */
|
|
1136
|
+
class SearchFilterPipe {
|
|
1137
|
+
transform(items, query, key = '', startsWith = false) {
|
|
1138
|
+
return filterOptions(items, query, key, startsWith);
|
|
1139
|
+
}
|
|
1140
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: SearchFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1141
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.35", ngImport: i0, type: SearchFilterPipe, isStandalone: true, name: "searchFilter" });
|
|
1142
|
+
}
|
|
1143
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: SearchFilterPipe, decorators: [{
|
|
1144
|
+
type: Pipe,
|
|
1145
|
+
args: [{ name: 'searchFilter', standalone: true }]
|
|
1146
|
+
}] });
|
|
1147
|
+
const UTILITIES = [
|
|
1148
|
+
InputRulesDirective,
|
|
1149
|
+
TrimLeadingSpaceDirective,
|
|
1150
|
+
DigitLimitDirective,
|
|
1151
|
+
ArabicInputDirective,
|
|
1152
|
+
EllipsisTooltipDirective,
|
|
1153
|
+
AutocompletePositionDirective,
|
|
1154
|
+
PreventClipboardDirective,
|
|
1155
|
+
AbbreviationTextareaComponent,
|
|
1156
|
+
SearchFilterPipe,
|
|
1157
|
+
];
|
|
1158
|
+
/** Internal shared template utilities; all implementations are shipped with this package. */
|
|
1159
|
+
class UiUtilitiesModule {
|
|
1160
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: UiUtilitiesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1161
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.35", ngImport: i0, type: UiUtilitiesModule, imports: [InputRulesDirective,
|
|
1162
|
+
TrimLeadingSpaceDirective,
|
|
1163
|
+
DigitLimitDirective,
|
|
1164
|
+
ArabicInputDirective,
|
|
1165
|
+
EllipsisTooltipDirective,
|
|
1166
|
+
AutocompletePositionDirective,
|
|
1167
|
+
PreventClipboardDirective,
|
|
1168
|
+
AbbreviationTextareaComponent, SearchFilterPipe], exports: [InputRulesDirective,
|
|
1169
|
+
TrimLeadingSpaceDirective,
|
|
1170
|
+
DigitLimitDirective,
|
|
1171
|
+
ArabicInputDirective,
|
|
1172
|
+
EllipsisTooltipDirective,
|
|
1173
|
+
AutocompletePositionDirective,
|
|
1174
|
+
PreventClipboardDirective,
|
|
1175
|
+
AbbreviationTextareaComponent, SearchFilterPipe] });
|
|
1176
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: UiUtilitiesModule, imports: [AbbreviationTextareaComponent] });
|
|
1177
|
+
}
|
|
1178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: UiUtilitiesModule, decorators: [{
|
|
1179
|
+
type: NgModule,
|
|
1180
|
+
args: [{ imports: UTILITIES, exports: UTILITIES }]
|
|
1181
|
+
}] });
|
|
1182
|
+
|
|
1183
|
+
const ARABIC_LANGUAGE = 'ar';
|
|
1184
|
+
/** Moment-based day-month-year display and parse formats used by the date controls. */
|
|
1185
|
+
const DATE_FORMATS = {
|
|
1186
|
+
parse: { dateInput: 'DD-MMM-YYYY' },
|
|
1187
|
+
display: {
|
|
1188
|
+
dateInput: 'DD-MMM-YYYY',
|
|
1189
|
+
monthYearLabel: 'MMM YYYY',
|
|
1190
|
+
dateA11yLabel: 'LL',
|
|
1191
|
+
monthYearA11yLabel: 'MMMM YYYY',
|
|
1192
|
+
},
|
|
1193
|
+
};
|
|
1194
|
+
/** Moment-based date/time formats used by the combined picker. */
|
|
1195
|
+
const DATE_TIME_FORMATS = {
|
|
1196
|
+
parse: { dateInput: 'DD-MMM-YYYY HH:mm' },
|
|
1197
|
+
display: {
|
|
1198
|
+
dateInput: 'DD-MMM-YYYY HH:mm',
|
|
1199
|
+
monthYearLabel: 'MMM YYYY',
|
|
1200
|
+
dateA11yLabel: 'LL',
|
|
1201
|
+
monthYearA11yLabel: 'MMMM YYYY',
|
|
1202
|
+
},
|
|
1203
|
+
};
|
|
1204
|
+
|
|
1205
|
+
/**
|
|
1206
|
+
* Generated bundle index. Do not edit.
|
|
1207
|
+
*/
|
|
1208
|
+
|
|
1209
|
+
export { ARABIC_LANGUAGE, AbbreviationTextareaComponent, ArabicInputDirective, AutocompletePositionDirective, BaseControlValueAccessor, DATE_FORMATS, DATE_TIME_FORMATS, DigitLimitDirective, EllipsisTooltipDirective, InputRulesDirective, PreventClipboardDirective, SearchFilterPipe, TextInputComponent, TrimLeadingSpaceDirective, UiIconsService, UiUtilitiesModule, clampInput, filterOptions, highlightTokens, normalizeInput };
|
|
1210
|
+
//# sourceMappingURL=angular-ui-controls-text-input.mjs.map
|