@sdcorejs/angular 22.2.5 → 22.2.6
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/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +3 -3
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs +4 -3
- package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +14 -14
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +38 -6
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +4 -3
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +3 -3
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +3 -3
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +3 -2
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-stepper.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-stepper.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +125 -37
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +5 -3
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +251 -60
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +293 -68
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +95 -0
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +2 -2
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +55 -9
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-notify.mjs +2 -2
- package/fesm2022/sdcorejs-angular-services-notify.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-read-state.mjs +88 -0
- package/fesm2022/sdcorejs-angular-utilities-read-state.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-utilities.mjs +1 -0
- package/fesm2022/sdcorejs-angular-utilities.mjs.map +1 -1
- package/package.json +5 -1
- package/types/sdcorejs-angular-components-import-excel.d.ts +23 -1
- package/types/sdcorejs-angular-components-table.d.ts +10 -1
- package/types/sdcorejs-angular-components-upload-file.d.ts +2 -1
- package/types/sdcorejs-angular-forms-autocomplete.d.ts +13 -2
- package/types/sdcorejs-angular-forms-select.d.ts +11 -1
- package/types/sdcorejs-angular-i18n.d.ts +19 -0
- package/types/sdcorejs-angular-services-confirm.d.ts +12 -0
- package/types/sdcorejs-angular-utilities-read-state.d.ts +42 -0
- package/types/sdcorejs-angular-utilities.d.ts +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i1 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { viewChild, contentChild, inject, ChangeDetectorRef, input, computed, booleanAttribute,
|
|
4
|
+
import { viewChild, contentChild, inject, ChangeDetectorRef, ElementRef, input, computed, booleanAttribute, output, signal, model, EventEmitter, effect, untracked, Output, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
5
|
import { toObservable } from '@angular/core/rxjs-interop';
|
|
6
6
|
import * as i2 from '@angular/forms';
|
|
7
7
|
import { NgForm, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
@@ -15,14 +15,16 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
|
15
15
|
import * as i4 from '@angular/material/tooltip';
|
|
16
16
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
17
17
|
import { SdView } from '@sdcorejs/angular/components/view';
|
|
18
|
+
import { SdDataStateTemplateDirective, SdDataState } from '@sdcorejs/angular/components/data-state';
|
|
19
|
+
import { SdReadChannel, combineReadStates, cloneReadRequest } from '@sdcorejs/angular/utilities/read-state';
|
|
18
20
|
import { SdItemDefDefDirective, SdViewDefDirective } from '@sdcorejs/angular/forms/directives';
|
|
19
21
|
import { SdLabel } from '@sdcorejs/angular/forms/label';
|
|
20
22
|
import { SD_FORM_CONFIGURATION, ɵsdTimerScope as _sdTimerScope, sdFormControlState, sdViewedTransform, sdViewedInline, SdFormControl, ɵsdFormControlConnector as _sdFormControlConnector, HandleSdCustomValidator, SdInlineErrorValidator } from '@sdcorejs/angular/forms/models';
|
|
21
23
|
import { I18nService } from '@sdcorejs/angular/i18n';
|
|
22
24
|
import { sdIsEmpty, sdSerializeDataValue } from '@sdcorejs/angular/utilities/data-state';
|
|
23
25
|
import { Utilities, ArrayUtilities } from '@sdcorejs/utils/fns';
|
|
24
|
-
import { Subscription, combineLatest, timer, of, defer, from } from 'rxjs';
|
|
25
|
-
import { tap,
|
|
26
|
+
import { Subscription, Subject, combineLatest, merge, timer, of, defer, EMPTY, from } from 'rxjs';
|
|
27
|
+
import { map, tap, shareReplay, startWith, debounce, takeUntil, switchMap, filter, catchError, finalize } from 'rxjs/operators';
|
|
26
28
|
import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
27
29
|
|
|
28
30
|
class SdAutocompleteErrotStateMatcher {
|
|
@@ -64,6 +66,7 @@ class SdAutocomplete {
|
|
|
64
66
|
// why: focus() (và open() gọi lại nó) hoãn 100ms rồi mới openPanel(). Không giữ handle thì
|
|
65
67
|
// panel overlay có thể mở SAU khi control đã destroy và không còn ai đóng nó.
|
|
66
68
|
#timers = _sdTimerScope();
|
|
69
|
+
#element = inject(ElementRef);
|
|
67
70
|
// ==========================================
|
|
68
71
|
// 3. SIGNAL INPUTS & MODEL
|
|
69
72
|
// ==========================================
|
|
@@ -130,6 +133,16 @@ class SdAutocomplete {
|
|
|
130
133
|
items = input(/* @ts-ignore */
|
|
131
134
|
...(ngDevMode ? [undefined, { debugName: "items" }] : /* istanbul ignore next */ []));
|
|
132
135
|
hideInlineError = input(false, { ...(ngDevMode ? { debugName: "hideInlineError" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
136
|
+
hideReadError = input(false, { ...(ngDevMode ? { debugName: "hideReadError" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
137
|
+
dataStateTemplate = contentChild(SdDataStateTemplateDirective, /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "dataStateTemplate" }] : /* istanbul ignore next */ []));
|
|
139
|
+
sdReadStateChange = output();
|
|
140
|
+
#valueRead = new SdReadChannel('VALUE', () => this.#emitReadState());
|
|
141
|
+
#searchRead = new SdReadChannel('SEARCH', () => this.#emitReadState());
|
|
142
|
+
readState = computed(() => combineReadStates(this.#valueRead.state(), this.#searchRead.state()), /* @ts-ignore */
|
|
143
|
+
...(ngDevMode ? [{ debugName: "readState" }] : /* istanbul ignore next */ []));
|
|
144
|
+
hasSearched = signal(false, /* @ts-ignore */
|
|
145
|
+
...(ngDevMode ? [{ debugName: "hasSearched" }] : /* istanbul ignore next */ []));
|
|
133
146
|
addable = input(false, { ...(ngDevMode ? { debugName: "addable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
134
147
|
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
135
148
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
@@ -211,8 +224,24 @@ class SdAutocomplete {
|
|
|
211
224
|
#cache = {};
|
|
212
225
|
#item = {};
|
|
213
226
|
#subscription = new Subscription();
|
|
227
|
+
#destroyed = false;
|
|
228
|
+
#searchDebouncing = false;
|
|
229
|
+
#lastSearchText = '';
|
|
230
|
+
#restoringReadFocus = false;
|
|
231
|
+
#valueCache = {};
|
|
232
|
+
#failedValue;
|
|
233
|
+
#failedSearch;
|
|
234
|
+
#valueRetryRequest;
|
|
235
|
+
#searchRetryRequest;
|
|
236
|
+
#retrySearch = new Subject();
|
|
237
|
+
#retryValue = new Subject();
|
|
214
238
|
// RXJS STREAMS
|
|
215
|
-
#items$ = toObservable(
|
|
239
|
+
#items$ = toObservable(computed(() => ({
|
|
240
|
+
items: this.items(),
|
|
241
|
+
checksum: this.cacheChecksum(),
|
|
242
|
+
valueField: this.valueField(),
|
|
243
|
+
displayField: this.displayField(),
|
|
244
|
+
}))).pipe(map(context => context.items));
|
|
216
245
|
#valueModel$ = toObservable(this.valueModel);
|
|
217
246
|
// PUBLIC SIGNALS (Render View)
|
|
218
247
|
filteredItems = signal([], /* @ts-ignore */
|
|
@@ -241,6 +270,19 @@ class SdAutocomplete {
|
|
|
241
270
|
return result;
|
|
242
271
|
};
|
|
243
272
|
constructor() {
|
|
273
|
+
effect(() => {
|
|
274
|
+
this.items();
|
|
275
|
+
this.valueModel();
|
|
276
|
+
this.cacheChecksum();
|
|
277
|
+
this.valueField();
|
|
278
|
+
this.displayField();
|
|
279
|
+
untracked(() => {
|
|
280
|
+
if (this.#failedValue && !this.#failedValue.valid()) {
|
|
281
|
+
this.#failedValue = undefined;
|
|
282
|
+
this.#valueRead.invalidate();
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
});
|
|
244
286
|
effect(() => {
|
|
245
287
|
const val = this.normalizedValue();
|
|
246
288
|
untracked(() => {
|
|
@@ -272,22 +314,46 @@ class SdAutocomplete {
|
|
|
272
314
|
}));
|
|
273
315
|
this.#subscription.add(this.formControl.sdChanges.subscribe(() => this.ref.markForCheck()));
|
|
274
316
|
this.#subscription.add(this.inputControl.sdChanges.subscribe(() => this.ref.markForCheck()));
|
|
275
|
-
this.#
|
|
317
|
+
this.#element.nativeElement.addEventListener('keydown', this.focusReadRetry, true);
|
|
318
|
+
this.#subscription.add(this.inputControl.valueChanges.subscribe(value => {
|
|
319
|
+
this.isTyping.set(true);
|
|
320
|
+
this.hasSearched.set(true);
|
|
321
|
+
this.#searchDebouncing = typeof this.items() === 'function';
|
|
322
|
+
const text = value || '';
|
|
323
|
+
if (text !== this.#lastSearchText) {
|
|
324
|
+
this.#failedSearch = undefined;
|
|
325
|
+
this.#searchRead.invalidate();
|
|
326
|
+
this.#lastSearchText = text;
|
|
327
|
+
}
|
|
328
|
+
this.#syncReadLoading();
|
|
329
|
+
}));
|
|
276
330
|
const cleanItems$ = this.#items$.pipe(tap(() => {
|
|
277
331
|
this.#cache = {};
|
|
332
|
+
this.#item = {};
|
|
333
|
+
this.#valueCache = {};
|
|
334
|
+
this.#failedValue = this.#failedSearch = undefined;
|
|
335
|
+
this.#valueRetryRequest = this.#searchRetryRequest = undefined;
|
|
336
|
+
this.#valueRead.invalidate();
|
|
337
|
+
this.#searchRead.invalidate();
|
|
278
338
|
}), map(items => {
|
|
279
339
|
if (!items)
|
|
280
340
|
return [];
|
|
281
341
|
if (Array.isArray(items))
|
|
282
342
|
return items.filter(e => e !== null && e !== undefined);
|
|
283
343
|
return items;
|
|
284
|
-
}));
|
|
344
|
+
}), shareReplay({ bufferSize: 1, refCount: true }));
|
|
285
345
|
const filteredItems$ = combineLatest([
|
|
286
346
|
cleanItems$,
|
|
287
|
-
this.inputControl.valueChanges.pipe(startWith(''),
|
|
288
|
-
|
|
347
|
+
merge(this.inputControl.valueChanges.pipe(startWith(''),
|
|
348
|
+
// why: retry thay thế debounce đang chờ; text cũ không được phát thêm một request sau retry.
|
|
349
|
+
debounce(() => timer(typeof this.items() === 'function' ? 500 : 0).pipe(takeUntil(this.#retrySearch)))), this.#retrySearch),
|
|
350
|
+
]).pipe(tap(() => {
|
|
351
|
+
this.isTyping.set(false);
|
|
352
|
+
this.#searchDebouncing = false;
|
|
353
|
+
}), switchMap(([items, searchText]) => {
|
|
289
354
|
const sText = searchText || '';
|
|
290
355
|
if (typeof items !== 'function') {
|
|
356
|
+
this.#syncReadLoading();
|
|
291
357
|
// [UPDATED]: Hỗ trợ search lồng nhau (nested) local
|
|
292
358
|
const filtered = items.filter((e) => {
|
|
293
359
|
const v = String(this.getNestedValue(e, this.valueField()) || '').toLowerCase();
|
|
@@ -297,64 +363,39 @@ class SdAutocomplete {
|
|
|
297
363
|
});
|
|
298
364
|
return of(ArrayUtilities.paging(filtered, this.limit()));
|
|
299
365
|
}
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
this.loading.set(true);
|
|
308
|
-
let obs;
|
|
309
|
-
const func = items({ type: 'SEARCH', searchText: sText });
|
|
310
|
-
if (func instanceof Promise)
|
|
311
|
-
obs = defer(() => from(func));
|
|
312
|
-
else
|
|
313
|
-
obs = func;
|
|
314
|
-
return obs.pipe(map(data => {
|
|
315
|
-
this.#cache[key] = data || [];
|
|
316
|
-
// [UPDATED]: Lưu cache #item theo nested value
|
|
317
|
-
(this.#cache[key] || []).forEach((e) => {
|
|
318
|
-
const valKey = this.getNestedValue(e, this.valueField());
|
|
319
|
-
if (valKey != null) {
|
|
320
|
-
this.#item[valKey] = e;
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
return this.#cache[key];
|
|
324
|
-
}), catchError(() => of([])));
|
|
325
|
-
}), tap(() => this.loading.set(false)));
|
|
326
|
-
const selected$ = combineLatest([cleanItems$, this.#valueModel$]).pipe(switchMap(([items, val]) => {
|
|
366
|
+
const retry = this.#searchRetryRequest;
|
|
367
|
+
this.#searchRetryRequest = undefined;
|
|
368
|
+
const request = retry?.valid() ? retry : this.#createReadRequest(items, { type: 'SEARCH', searchText: sText });
|
|
369
|
+
return this.#readItems(request, retry === request);
|
|
370
|
+
}));
|
|
371
|
+
const selected$ = combineLatest([cleanItems$, this.#valueModel$, this.#retryValue.pipe(startWith(undefined))]).pipe(switchMap(([items, val]) => {
|
|
327
372
|
const vField = this.valueField();
|
|
328
373
|
const dField = this.displayField();
|
|
329
|
-
if (!vField)
|
|
374
|
+
if (!vField) {
|
|
375
|
+
this.#valueRead.invalidate();
|
|
330
376
|
return of(val);
|
|
377
|
+
}
|
|
331
378
|
if (val || val === 0) {
|
|
332
379
|
if (typeof items === 'function') {
|
|
333
|
-
|
|
380
|
+
const retry = this.#valueRetryRequest;
|
|
381
|
+
this.#valueRetryRequest = undefined;
|
|
382
|
+
const request = retry?.valid() ? retry : this.#createReadRequest(items, { type: 'VALUE', value: val });
|
|
383
|
+
if (!retry && this.#item[val] && !this.#failedValue?.valid()) {
|
|
384
|
+
const revision = this.#valueRead.begin(request.valid);
|
|
385
|
+
this.#valueRead.succeed(revision, 1);
|
|
334
386
|
return of(this.#item[val]);
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
const func = items({ type: 'VALUE', value: val });
|
|
338
|
-
if (func instanceof Promise)
|
|
339
|
-
obs = defer(() => from(func));
|
|
340
|
-
else
|
|
341
|
-
obs = func;
|
|
342
|
-
return obs.pipe(map(data => {
|
|
343
|
-
// [UPDATED]: Lưu cache #item theo nested value
|
|
344
|
-
(data || []).forEach((e) => {
|
|
345
|
-
const valKey = this.getNestedValue(e, vField);
|
|
346
|
-
if (valKey != null) {
|
|
347
|
-
this.#item[valKey] = e;
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
return this.#item[val] || { [vField]: val, [dField]: val };
|
|
351
|
-
}), catchError(() => of({ [vField]: val, [dField]: val })));
|
|
387
|
+
}
|
|
388
|
+
return this.#readItems(request, retry === request).pipe(map(() => this.#item[val] || { [vField]: val, [dField]: val }));
|
|
352
389
|
}
|
|
353
390
|
// [UPDATED]: Tìm local theo nested field
|
|
354
391
|
return of(items.find((e) => this.getNestedValue(e, vField) === val));
|
|
355
392
|
}
|
|
393
|
+
this.#failedValue = undefined;
|
|
394
|
+
this.#valueRead.invalidate();
|
|
356
395
|
return of('');
|
|
357
|
-
}),
|
|
396
|
+
}),
|
|
397
|
+
// why: ba subscriber (selected/display/placeholder) dùng chung một request VALUE.
|
|
398
|
+
shareReplay({ bufferSize: 1, refCount: true }));
|
|
358
399
|
const controlPlaceHolder$ = selected$.pipe(map((item) => {
|
|
359
400
|
// [UPDATED]: Đọc PlaceHolder bằng getNestedValue
|
|
360
401
|
const dispVal = this.getNestedValue(item, this.displayField());
|
|
@@ -389,6 +430,10 @@ class SdAutocomplete {
|
|
|
389
430
|
}));
|
|
390
431
|
}
|
|
391
432
|
ngOnDestroy() {
|
|
433
|
+
this.#destroyed = true;
|
|
434
|
+
this.#element.nativeElement.removeEventListener('keydown', this.focusReadRetry, true);
|
|
435
|
+
this.#valueRead.invalidate();
|
|
436
|
+
this.#searchRead.invalidate();
|
|
392
437
|
this.#subscription.unsubscribe();
|
|
393
438
|
this.#cache = {};
|
|
394
439
|
this.#item = {};
|
|
@@ -421,19 +466,66 @@ class SdAutocomplete {
|
|
|
421
466
|
this.sdSelection.emit({ values: [val], selectedItems: [item], value: val, selectedItem: item });
|
|
422
467
|
}
|
|
423
468
|
}
|
|
424
|
-
this
|
|
469
|
+
this.#resetSearchText();
|
|
425
470
|
};
|
|
426
471
|
onFocus = () => {
|
|
472
|
+
this.hasSearched.set(true);
|
|
427
473
|
this.isFocused = true;
|
|
474
|
+
if (this.#restoringReadFocus || this.#failedSearch?.valid())
|
|
475
|
+
return;
|
|
428
476
|
this.filteredItems.set([]);
|
|
429
477
|
if (typeof this.items() === 'function') {
|
|
430
478
|
this.loading.set(true);
|
|
431
479
|
}
|
|
432
480
|
this.inputControl.setValue('', { emitEvent: true });
|
|
433
481
|
};
|
|
434
|
-
onBlur = () => {
|
|
482
|
+
onBlur = (event) => {
|
|
483
|
+
// why: Tab vào retry thuộc cùng control, không đổi snapshot text hoặc selection.
|
|
484
|
+
if (event?.relatedTarget instanceof Node && this.#readRegion()?.contains(event.relatedTarget))
|
|
485
|
+
return;
|
|
435
486
|
this.isFocused = false;
|
|
487
|
+
this.#resetSearchText();
|
|
488
|
+
};
|
|
489
|
+
#resetSearchText = () => {
|
|
490
|
+
const changed = !!this.inputControl.value;
|
|
436
491
|
this.inputControl.setValue('', { emitEvent: false });
|
|
492
|
+
this.#lastSearchText = '';
|
|
493
|
+
this.#searchDebouncing = false;
|
|
494
|
+
this.isTyping.set(false);
|
|
495
|
+
if (changed) {
|
|
496
|
+
this.#failedSearch = undefined;
|
|
497
|
+
this.#searchRead.invalidate();
|
|
498
|
+
}
|
|
499
|
+
this.#syncReadLoading();
|
|
500
|
+
};
|
|
501
|
+
#readRegion = () => this.autocompleteTrigger()?.autocomplete.panel?.nativeElement.querySelector('.sd-read-state-region') ?? null;
|
|
502
|
+
focusReadRetry = (event) => {
|
|
503
|
+
if (event.key !== 'Tab' || event.shiftKey || !this.autocompleteTrigger()?.panelOpen)
|
|
504
|
+
return;
|
|
505
|
+
const button = this.#readRegion()?.querySelector('button:not([disabled]), [tabindex="0"]');
|
|
506
|
+
if (!button)
|
|
507
|
+
return;
|
|
508
|
+
event.preventDefault();
|
|
509
|
+
event.stopImmediatePropagation();
|
|
510
|
+
button.focus();
|
|
511
|
+
};
|
|
512
|
+
onReadRegionKeydown = (event) => {
|
|
513
|
+
event.stopPropagation();
|
|
514
|
+
if (event.key === 'Escape' || (event.key === 'Tab' && event.shiftKey)) {
|
|
515
|
+
event.preventDefault();
|
|
516
|
+
this.#restoreReadFocus();
|
|
517
|
+
if (event.key === 'Escape')
|
|
518
|
+
this.autocompleteTrigger()?.closePanel();
|
|
519
|
+
}
|
|
520
|
+
else if (event.key === 'Tab') {
|
|
521
|
+
this.autocompleteTrigger()?.closePanel();
|
|
522
|
+
this.#restoreReadFocus();
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
#restoreReadFocus = () => {
|
|
526
|
+
this.#restoringReadFocus = true;
|
|
527
|
+
this.inputRef()?.nativeElement.focus();
|
|
528
|
+
this.#restoringReadFocus = false;
|
|
437
529
|
};
|
|
438
530
|
onClick = () => {
|
|
439
531
|
if (this.sdViewDef()?.templateRef) {
|
|
@@ -491,13 +583,112 @@ class SdAutocomplete {
|
|
|
491
583
|
// tức API public reValidate() trước đây không validate gì cả.
|
|
492
584
|
this.formControl.updateValueAndValidity({ emitEvent: true });
|
|
493
585
|
};
|
|
586
|
+
#createReadRequest = (loader, args) => {
|
|
587
|
+
const checksum = Utilities.hash({ checksum: this.cacheChecksum(), valueField: this.valueField(), displayField: this.displayField() });
|
|
588
|
+
const key = Utilities.hash({ checksum, args });
|
|
589
|
+
return {
|
|
590
|
+
loader,
|
|
591
|
+
args: cloneReadRequest(args),
|
|
592
|
+
key,
|
|
593
|
+
valid: () => !this.#destroyed &&
|
|
594
|
+
this.items() === loader &&
|
|
595
|
+
checksum === Utilities.hash({ checksum: this.cacheChecksum(), valueField: this.valueField(), displayField: this.displayField() }) &&
|
|
596
|
+
key ===
|
|
597
|
+
Utilities.hash({
|
|
598
|
+
checksum,
|
|
599
|
+
args: args.type === 'VALUE'
|
|
600
|
+
? { type: 'VALUE', value: this.valueModel() }
|
|
601
|
+
: { type: 'SEARCH', searchText: this.inputControl.value || '' },
|
|
602
|
+
}),
|
|
603
|
+
};
|
|
604
|
+
};
|
|
605
|
+
#readItems = (request, retry) => defer(() => {
|
|
606
|
+
const valueRequest = request.args.type === 'VALUE';
|
|
607
|
+
const channel = valueRequest ? this.#valueRead : this.#searchRead;
|
|
608
|
+
const failed = valueRequest ? this.#failedValue : this.#failedSearch;
|
|
609
|
+
if (!request.valid())
|
|
610
|
+
return EMPTY;
|
|
611
|
+
if (!retry && failed?.key === request.key && failed.valid()) {
|
|
612
|
+
this.#syncReadLoading();
|
|
613
|
+
return EMPTY;
|
|
614
|
+
}
|
|
615
|
+
const revision = channel.begin(request.valid);
|
|
616
|
+
if (valueRequest)
|
|
617
|
+
this.#failedValue = undefined;
|
|
618
|
+
else
|
|
619
|
+
this.#failedSearch = undefined;
|
|
620
|
+
const cache = valueRequest ? this.#valueCache : this.#cache;
|
|
621
|
+
if (!retry && cache[request.key] !== undefined) {
|
|
622
|
+
channel.succeed(revision, cache[request.key].length);
|
|
623
|
+
return of(cache[request.key]);
|
|
624
|
+
}
|
|
625
|
+
// why: defer bao quanh chính lời gọi loader để bắt cả throw đồng bộ; from giữ Promise/Observable.
|
|
626
|
+
return defer(() => from(request.loader(cloneReadRequest(request.args)))).pipe(filter(() => channel.isCurrent(revision)), map(data => data || []), tap(data => {
|
|
627
|
+
cache[request.key] = data;
|
|
628
|
+
data.forEach(item => {
|
|
629
|
+
const key = this.getNestedValue(item, this.valueField());
|
|
630
|
+
if (key != null)
|
|
631
|
+
this.#item[key] = item;
|
|
632
|
+
});
|
|
633
|
+
channel.succeed(revision, data.length);
|
|
634
|
+
}), filter(() => channel.isCurrent(revision)), catchError(error => {
|
|
635
|
+
if (channel.isCurrent(revision)) {
|
|
636
|
+
if (valueRequest)
|
|
637
|
+
this.#failedValue = request;
|
|
638
|
+
else
|
|
639
|
+
this.#failedSearch = request;
|
|
640
|
+
channel.fail(revision, error);
|
|
641
|
+
}
|
|
642
|
+
return EMPTY;
|
|
643
|
+
}), finalize(() => {
|
|
644
|
+
// why: cleanup của request cũ không đổi state/loading của request mới.
|
|
645
|
+
if (channel.isCurrent(revision)) {
|
|
646
|
+
if (channel.state().status === 'loading')
|
|
647
|
+
channel.invalidate();
|
|
648
|
+
this.#syncReadLoading();
|
|
649
|
+
}
|
|
650
|
+
}));
|
|
651
|
+
});
|
|
652
|
+
#syncReadLoading = () => {
|
|
653
|
+
if (this.#destroyed)
|
|
654
|
+
return;
|
|
655
|
+
this.loading.set(this.#searchDebouncing || this.#valueRead.state().status === 'loading' || this.#searchRead.state().status === 'loading');
|
|
656
|
+
this.ref.markForCheck();
|
|
657
|
+
};
|
|
658
|
+
#emitReadState = () => {
|
|
659
|
+
if (this.#destroyed)
|
|
660
|
+
return;
|
|
661
|
+
this.#syncReadLoading();
|
|
662
|
+
this.sdReadStateChange.emit(this.readState());
|
|
663
|
+
};
|
|
664
|
+
/** Retry bypasses text debounce/distinctness while using the original loader and request snapshot. */
|
|
665
|
+
retryRead = () => {
|
|
666
|
+
const state = this.readState();
|
|
667
|
+
if (state.status !== 'error')
|
|
668
|
+
return;
|
|
669
|
+
const request = state.operation === 'VALUE' ? this.#failedValue : this.#failedSearch;
|
|
670
|
+
if (!request?.valid())
|
|
671
|
+
return;
|
|
672
|
+
if (this.#readRegion()?.contains(this.#element.nativeElement.ownerDocument.activeElement))
|
|
673
|
+
this.#restoreReadFocus();
|
|
674
|
+
if (state.operation === 'VALUE') {
|
|
675
|
+
this.#valueRetryRequest = request;
|
|
676
|
+
this.#retryValue.next();
|
|
677
|
+
}
|
|
678
|
+
else {
|
|
679
|
+
this.#searchRetryRequest = request;
|
|
680
|
+
this.#retrySearch.next(request.args.searchText || '');
|
|
681
|
+
}
|
|
682
|
+
};
|
|
494
683
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
495
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdAutocomplete, isStandalone: true, selector: "sd-autocomplete", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null }, displayField: { classPropertyName: "displayField", publicName: "displayField", isSignal: true, isRequired: false, transformFunction: null }, disabledField: { classPropertyName: "disabledField", publicName: "disabledField", isSignal: true, isRequired: false, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: false, transformFunction: null }, cacheChecksum: { classPropertyName: "cacheChecksum", publicName: "cacheChecksum", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, addable: { classPropertyName: "addable", publicName: "addable", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "validator", isSignal: true, isRequired: false, transformFunction: null }, inlineError: { classPropertyName: "inlineError", publicName: "inlineError", isSignal: true, isRequired: false, transformFunction: null }, appearanceInput: { classPropertyName: "appearanceInput", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueModel: "modelChange", sdChange: "sdChange", sdSelection: "sdSelection", sdAdd: "sdAdd" }, host: { properties: { "class.sd-has-label": "!!label()", "class.sd-viewed": "isViewed() || isInline()", "class.sd-bare": "isInline()" } }, queries: [{ propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }, { propertyName: "itemDef", first: true, predicate: SdItemDefDefDirective, descendants: true, isSignal: true }, { propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, isSignal: true }, { propertyName: "autocompleteTrigger", first: true, predicate: MatAutocompleteTrigger, descendants: true, isSignal: true }], ngImport: i0, template: "@let _label = label();\n@let _appearance = appearance();\n@let _hideInlineError = hideInlineError();\n@let _errorMessage = errorMessage();\n@let _helperText = helperText();\n@let _required = required();\n@let _displayField = displayField();\n@let _disabledField = disabledField();\n@let iDefTpl = itemDef()?.templateRef;\n@let _loading = loading();\n@let nVal = $any(normalizedValue());\n@let _isInline = isInline();\n@let _bare = _isInline;\n@let _hasValue = nVal !== undefined && nVal !== null && nVal !== '';\n<!-- why: m\u1ED9t c\u1ED5ng gate duy nh\u1EA5t cho <mat-error>, aria-invalid v\u00E0 aria-describedby. -->\n@let _errorVisible = !!_errorMessage && formControl.touched;\n@let _showInlineError = !_hideInlineError && _errorVisible;\n\n@if (isViewed()) {\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"nVal\"\n [display]=\"display()\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\">\n </sd-view>\n} @else {\n @if (_isInline) {\n <!-- why: inline \u2014 sd-view l\u00E0 \"m\u1EB7t\" + trigger; autocomplete editor render \u1EA9n (.sd-inline-editor) ch\u1EC9 \u0111\u1EC3 m\u1EDF panel. -->\n <span class=\"sd-inline-view\" role=\"button\" tabindex=\"0\" (click)=\"enterInlineEdit()\" (keydown.enter)=\"enterInlineEdit()\">\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"nVal\"\n [display]=\"display()\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\">\n </sd-view>\n @if (clearable() && _hasValue && !_required && !formControl.disabled) {\n <button type=\"button\" class=\"sd-inline-clear\" (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </span>\n }\n\n @if (!_appearance) {\n <ng-content select=\"[sdLabel]\">\n @if (_label) {\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\n }\n </ng-content>\n }\n\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout. aria-hidden=\"true\" c\u0169 \u1EA9n C\u1EA2 c\u00E2y con \u2014 label, <input>,\n <mat-error>, n\u00FAt clear v\u00E0 c\u1EA3 panel g\u1EE3i \u00FD \u2014 kh\u1ECFi accessibility tree. role=\"presentation\"\n ch\u1EC9 v\u00F4 hi\u1EC7u ho\u00E1 ch\u00EDnh div, KH\u00D4NG lan xu\u1ED1ng con; (click) l\u00E0 ti\u1EC7n \u00EDch chu\u1ED9t m\u00E0 b\u00E0n ph\u00EDm \u0111\u00E3\n c\u00F3 qua Tab v\u00E0o <input>. -->\n <div\n class=\"d-flex align-items-center\"\n role=\"presentation\"\n [class.sd-inline-editor]=\"_isInline\"\n [class.c-focused]=\"isFocused\"\n [class.c-disabled]=\"formControl.disabled\"\n (click)=\"onClick()\">\n <mat-form-field\n [class.sd-md]=\"size() === 'md'\"\n [class.sd-sm]=\"size() === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [floatLabel]=\"nVal ? 'always' : 'auto'\"\n [appearance]=\"_appearance || 'outline'\">\n @if (_appearance && _label) {\n <mat-label class=\"sd-form-field-label\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <sd-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\" name=\"info\"></sd-icon>\n }\n </mat-label>\n }\n\n <!-- why: B\u1ECE aria-hidden tr\u00EAn ch\u00EDnh <input> \u2014 \u00F4 Tab t\u1EDBi v\u00E0 g\u00F5 \u0111\u01B0\u1EE3c, aria-hidden ch\u1EC9 khi\u1EBFn\n screen reader \u0111\u1ECDc ra kho\u1EA3ng l\u1EB7ng. -->\n <input\n [id]=\"id\"\n [formControl]=\"inputControl\"\n [placeholder]=\"controlPlaceHolder() || ''\"\n [class.c-selected]=\"nVal\"\n [matAutocomplete]=\"auto\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n matInput\n [autocomplete]=\"id\"\n autocorrect=\"off\"\n [errorStateMatcher]=\"matcher\"\n [required]=\"_required\"\n #input\n #autocompleteTrigger=\"matAutocompleteTrigger\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-invalid]=\"dataInvalid()\"\n [attr.data-empty]=\"dataEmpty()\"\n [attr.data-value]=\"dataValue()\"\n [attr.data-loading]=\"dataLoading()\"\n [attr.data-required]=\"dataRequired()\"\n [attr.data-error-message]=\"dataErrorMessage()\"\n [attr.aria-invalid]=\"_errorVisible ? 'true' : null\"\n [attr.aria-describedby]=\"_errorMessage ? errorId : null\" />\n\n @if (!_loading && nVal && !inputControl.disabled && !_bare) {\n <button type=\"button\" class=\"sd-clear-btn\" matSuffix (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n } @else if (_loading) {\n <mat-spinner [diameter]=\"20\" matSuffix></mat-spinner>\n } @else {\n <sd-icon class=\"cursor-pointer sd-suffix-icon\" matSuffix name=\"search\"></sd-icon>\n }\n\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onSelect($event.option.value)\" class=\"sd-autocomplete-panel\">\n @let _filteredItems = filteredItems();\n\n @if (_filteredItems?.length) {\n @for (item of _filteredItems; track $index) {\n <mat-option\n [value]=\"item\"\n matTooltipPosition=\"above\"\n [matTooltip]=\"_displayField ? getNestedValue(item, _displayField) : item\"\n [disabled]=\"_disabledField ? getNestedValue(item, _disabledField) : false\">\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ _displayField ? getNestedValue(item, _displayField) : item }}\n }\n </mat-option>\n }\n } @else if (!_filteredItems?.length && inputControl.value && !isTyping() && !_loading) {}\n\n @if (addable() && sdAdd.observed) {\n <mat-option class=\"sd__option--add\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\n <!-- why: tr\u01B0\u1EDBc l\u00E0 <div (click)> \u2014 kh\u00F4ng Tab t\u1EDBi \u0111\u01B0\u1EE3c, kh\u00F4ng c\u00F3 role, v\u00E0 ch\u1EC9 \"im l\u1EB7ng\"\n v\u1EDBi lint v\u00EC c\u1EA3 c\u1EE5m n\u1EB1m trong c\u00E2y aria-hidden. <button type=\"button\"> l\u1EA5y s\u1EB5n\n Enter/Space + role button, kh\u00F4ng ph\u1EA3i b\u1ECBa tabindex/keydown th\u1EE7 c\u00F4ng. -->\n <button type=\"button\" class=\"sd__option--add-btn\" (click)=\"onAdd($event)\">\n <sd-icon class=\"mr-1\" name=\"add\" aria-hidden=\"true\"></sd-icon>\n {{ 'New item' }}\n </button>\n </mat-option>\n }\n </mat-autocomplete>\n\n @if (_hideInlineError && _errorVisible) {\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\n @if (_hideInlineError && _errorVisible) {\n <span class=\"sd-visually-hidden\" [id]=\"errorId\" matSuffix>{{ _errorMessage }}</span>\n\n }\n\n @if (_showInlineError) {\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\n }\n </mat-form-field>\n </div>\n}\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-primary-contrast{color:var(--sd-primary-contrast)!important}.bg-primary-contrast{background:var(--sd-primary-contrast)!important}.border-primary-contrast{border-color:var(--sd-primary-contrast)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-secondary-contrast{color:var(--sd-secondary-contrast)!important}.bg-secondary-contrast{background:var(--sd-secondary-contrast)!important}.border-secondary-contrast{border-color:var(--sd-secondary-contrast)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-info-contrast{color:var(--sd-info-contrast)!important}.bg-info-contrast{background:var(--sd-info-contrast)!important}.border-info-contrast{border-color:var(--sd-info-contrast)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-success-contrast{color:var(--sd-success-contrast)!important}.bg-success-contrast{background:var(--sd-success-contrast)!important}.border-success-contrast{border-color:var(--sd-success-contrast)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-warning-contrast{color:var(--sd-warning-contrast)!important}.bg-warning-contrast{background:var(--sd-warning-contrast)!important}.border-warning-contrast{border-color:var(--sd-warning-contrast)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-error-contrast{color:var(--sd-error-contrast)!important}.bg-error-contrast{background:var(--sd-error-contrast)!important}.border-error-contrast{border-color:var(--sd-error-contrast)!important}.text-surface{color:var(--sd-surface)!important}.bg-surface{background:var(--sd-surface)!important}.border-surface{border-color:var(--sd-surface)!important}.text-surface-muted{color:var(--sd-surface-muted)!important}.bg-surface-muted{background:var(--sd-surface-muted)!important}.border-surface-muted{border-color:var(--sd-surface-muted)!important}.text-text{color:var(--sd-text)!important}.bg-text{background:var(--sd-text)!important}.border-text{border-color:var(--sd-text)!important}.text-text-secondary{color:var(--sd-text-secondary)!important}.bg-text-secondary{background:var(--sd-text-secondary)!important}.border-text-secondary{border-color:var(--sd-text-secondary)!important}.text-text-muted{color:var(--sd-text-muted)!important}.bg-text-muted{background:var(--sd-text-muted)!important}.border-text-muted{border-color:var(--sd-text-muted)!important}.text-border{color:var(--sd-border)!important}.bg-border{background:var(--sd-border)!important}.border-border{border-color:var(--sd-border)!important}.text-border-strong{color:var(--sd-border-strong)!important}.bg-border-strong{background:var(--sd-border-strong)!important}.border-border-strong{border-color:var(--sd-border-strong)!important}.text-disabled-bg{color:var(--sd-disabled-bg)!important}.bg-disabled-bg{background:var(--sd-disabled-bg)!important}.border-disabled-bg{border-color:var(--sd-disabled-bg)!important}.text-disabled-text{color:var(--sd-disabled-text)!important}.bg-disabled-text{background:var(--sd-disabled-text)!important}.border-disabled-text{border-color:var(--sd-disabled-text)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}.text-secondary{color:var(--sd-text-secondary)!important}.text-muted{color:var(--sd-text-muted)!important}.text-body{color:var(--sd-text)!important}.bg-muted{background:var(--sd-surface-muted)!important}:host(.sd-bare){position:relative}.sd-inline-view{cursor:pointer;display:inline-flex;align-items:center;width:100%;padding:1px 6px;border-radius:4px;background-color:#0000000a;transition:background-color .15s ease}.sd-inline-view:hover{background-color:#00000014}.sd-inline-view .sd-inline-clear{display:none;align-items:center;margin-left:4px;padding:0;border:0;background:transparent;cursor:pointer;line-height:0;color:var(--sd-text-secondary, #6b7280);transition:color .15s ease}.sd-inline-view .sd-inline-clear sd-icon{font-size:16px;width:16px;height:16px}.sd-inline-view .sd-inline-clear:hover{color:var(--sd-error, #b32626)}.sd-inline-view:hover .sd-inline-clear{display:inline-flex}.sd-inline-editor{position:absolute;inset:0;opacity:0;pointer-events:none}.sd-inline-editor ::ng-deep *{pointer-events:none!important}:host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-viewed){padding-top:0}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-surface-muted)}:host ::ng-deep .mat-mdc-form-field input.c-selected::placeholder{color:#000;opacity:1}:host ::ng-deep .mat-mdc-form-field input.c-selected:-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.c-selected::-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::placeholder{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected:-ms-input-placeholder{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::-ms-input-placeholder{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}:host ::ng-deep .mat-mdc-form-field:hover .icon-copy{opacity:1}:host ::ng-deep .mat-mdc-form-field .icon-copy{cursor:pointer;width:.9em;height:.9em;fill:#00000080;transition:opacity .2s linear;opacity:0}::ng-deep .sd-autocomplete-panel .mat-mdc-option{min-height:36px!important;padding:8px 12px!important}::ng-deep .sd-autocomplete-panel .mdc-list-item__primary-text{font-size:14px!important;line-height:normal}::ng-deep .sd-autocomplete-panel .mat-pseudo-checkbox{transform:scale(.7);margin-right:8px!important}::ng-deep .sd-autocomplete-panel .mat-pseudo-checkbox-minimal{transform:scale(.7);transform-origin:center right}.sd__option--add{position:sticky;bottom:0;background-color:#fff;z-index:10;color:#000000de;cursor:pointer!important}.sd__option--add-btn{display:flex;align-items:center;width:100%;border:0;padding:0;background:transparent;font:inherit;color:inherit;text-align:left;cursor:pointer}.c-loading-icon{position:absolute;right:5px;top:5px}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.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: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i5.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i5.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i6.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate", "selectedItems"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
684
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdAutocomplete, isStandalone: true, selector: "sd-autocomplete", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null }, displayField: { classPropertyName: "displayField", publicName: "displayField", isSignal: true, isRequired: false, transformFunction: null }, disabledField: { classPropertyName: "disabledField", publicName: "disabledField", isSignal: true, isRequired: false, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: false, transformFunction: null }, cacheChecksum: { classPropertyName: "cacheChecksum", publicName: "cacheChecksum", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, hideReadError: { classPropertyName: "hideReadError", publicName: "hideReadError", isSignal: true, isRequired: false, transformFunction: null }, addable: { classPropertyName: "addable", publicName: "addable", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "validator", isSignal: true, isRequired: false, transformFunction: null }, inlineError: { classPropertyName: "inlineError", publicName: "inlineError", isSignal: true, isRequired: false, transformFunction: null }, appearanceInput: { classPropertyName: "appearanceInput", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sdReadStateChange: "sdReadStateChange", valueModel: "modelChange", sdChange: "sdChange", sdSelection: "sdSelection", sdAdd: "sdAdd" }, host: { properties: { "class.sd-has-label": "!!label()", "class.sd-viewed": "isViewed() || isInline()", "class.sd-bare": "isInline()" } }, queries: [{ propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }, { propertyName: "itemDef", first: true, predicate: SdItemDefDefDirective, descendants: true, isSignal: true }, { propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }, { propertyName: "dataStateTemplate", first: true, predicate: SdDataStateTemplateDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, isSignal: true }, { propertyName: "autocompleteTrigger", first: true, predicate: MatAutocompleteTrigger, descendants: true, isSignal: true }], ngImport: i0, template: "@let _readState = readState();\n@let _isTyping = isTyping();\n@let _label = label();\n@let _appearance = appearance();\n@let _hideInlineError = hideInlineError();\n@let _errorMessage = errorMessage();\n@let _helperText = helperText();\n@let _required = required();\n@let _displayField = displayField();\n@let _disabledField = disabledField();\n@let iDefTpl = itemDef()?.templateRef;\n@let _loading = loading();\n@let nVal = $any(normalizedValue());\n@let _isInline = isInline();\n@let _bare = _isInline;\n@let _hasValue = nVal !== undefined && nVal !== null && nVal !== '';\n<!-- why: m\u1ED9t c\u1ED5ng gate duy nh\u1EA5t cho <mat-error>, aria-invalid v\u00E0 aria-describedby. -->\n@let _errorVisible = !!_errorMessage && formControl.touched;\n@let _showInlineError = !_hideInlineError && _errorVisible;\n\n@if (isViewed()) {\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"nVal\"\n [display]=\"display()\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\">\n </sd-view>\n} @else {\n @if (_isInline) {\n <!-- why: inline \u2014 sd-view l\u00E0 \"m\u1EB7t\" + trigger; autocomplete editor render \u1EA9n (.sd-inline-editor) ch\u1EC9 \u0111\u1EC3 m\u1EDF panel. -->\n <span class=\"sd-inline-view\" role=\"button\" tabindex=\"0\" (click)=\"enterInlineEdit()\" (keydown.enter)=\"enterInlineEdit()\">\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"nVal\"\n [display]=\"display()\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\">\n </sd-view>\n @if (clearable() && _hasValue && !_required && !formControl.disabled) {\n <button type=\"button\" class=\"sd-inline-clear\" (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </span>\n }\n\n @if (!_appearance) {\n <ng-content select=\"[sdLabel]\">\n @if (_label) {\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\n }\n </ng-content>\n }\n\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout. aria-hidden=\"true\" c\u0169 \u1EA9n C\u1EA2 c\u00E2y con \u2014 label, <input>,\n <mat-error>, n\u00FAt clear v\u00E0 c\u1EA3 panel g\u1EE3i \u00FD \u2014 kh\u1ECFi accessibility tree. role=\"presentation\"\n ch\u1EC9 v\u00F4 hi\u1EC7u ho\u00E1 ch\u00EDnh div, KH\u00D4NG lan xu\u1ED1ng con; (click) l\u00E0 ti\u1EC7n \u00EDch chu\u1ED9t m\u00E0 b\u00E0n ph\u00EDm \u0111\u00E3\n c\u00F3 qua Tab v\u00E0o <input>. -->\n <div\n class=\"d-flex align-items-center\"\n role=\"presentation\"\n [class.sd-inline-editor]=\"_isInline\"\n [class.c-focused]=\"isFocused\"\n [class.c-disabled]=\"formControl.disabled\"\n (click)=\"onClick()\">\n <mat-form-field\n [class.sd-md]=\"size() === 'md'\"\n [class.sd-sm]=\"size() === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [floatLabel]=\"nVal ? 'always' : 'auto'\"\n [appearance]=\"_appearance || 'outline'\">\n @if (_appearance && _label) {\n <mat-label class=\"sd-form-field-label\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <sd-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\" name=\"info\"></sd-icon>\n }\n </mat-label>\n }\n\n <!-- why: B\u1ECE aria-hidden tr\u00EAn ch\u00EDnh <input> \u2014 \u00F4 Tab t\u1EDBi v\u00E0 g\u00F5 \u0111\u01B0\u1EE3c, aria-hidden ch\u1EC9 khi\u1EBFn\n screen reader \u0111\u1ECDc ra kho\u1EA3ng l\u1EB7ng. -->\n <input\n [id]=\"id\"\n [formControl]=\"inputControl\"\n [placeholder]=\"controlPlaceHolder() || ''\"\n [class.c-selected]=\"nVal\"\n [matAutocomplete]=\"auto\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur($event)\"\n matInput\n [autocomplete]=\"id\"\n autocorrect=\"off\"\n [errorStateMatcher]=\"matcher\"\n [required]=\"_required\"\n #input\n #autocompleteTrigger=\"matAutocompleteTrigger\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-invalid]=\"dataInvalid()\"\n [attr.data-empty]=\"dataEmpty()\"\n [attr.data-value]=\"dataValue()\"\n [attr.data-loading]=\"dataLoading()\"\n [attr.data-required]=\"dataRequired()\"\n [attr.data-error-message]=\"dataErrorMessage()\"\n [attr.aria-invalid]=\"_errorVisible ? 'true' : null\"\n [attr.aria-describedby]=\"_errorMessage ? errorId : null\" />\n\n @if (!_loading && nVal && !inputControl.disabled && !_bare) {\n <button type=\"button\" class=\"sd-clear-btn\" matSuffix (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n } @else if (_loading) {\n <mat-spinner [diameter]=\"20\" matSuffix></mat-spinner>\n } @else {\n <sd-icon class=\"cursor-pointer sd-suffix-icon\" matSuffix name=\"search\"></sd-icon>\n }\n\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onSelect($event.option.value)\" class=\"sd-autocomplete-panel\">\n @let _filteredItems = filteredItems();\n\n <!-- why: kh\u00F4ng hi\u1EC3n th\u1ECB l\u1ED7i k\u00EAnh c\u0169 c\u00F9ng spinner c\u1EE7a k\u00EAnh \u0111ang \u0111\u1ECDc/retry. -->\n @if (!_loading && _readState.status === 'error') {\n <!-- why: anchor gi\u1EEF panel m\u1EDF khi kh\u00F4ng c\u00F3 option; n\u00FAt retry kh\u00F4ng n\u1EB1m trong mat-option. -->\n <mat-option disabled class=\"sd-read-state-anchor\" aria-hidden=\"true\"></mat-option>\n @if (!hideReadError()) {\n <div\n class=\"sd-read-state-region\"\n role=\"presentation\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"onReadRegionKeydown($event)\">\n <ng-container [ngTemplateOutlet]=\"readRegion\" [ngTemplateOutletContext]=\"{ state: 'error' }\"></ng-container>\n </div>\n }\n }\n\n @if (_filteredItems?.length) {\n @for (item of _filteredItems; track $index) {\n <mat-option\n [value]=\"item\"\n matTooltipPosition=\"above\"\n [matTooltip]=\"_displayField ? getNestedValue(item, _displayField) : item\"\n [disabled]=\"_disabledField ? getNestedValue(item, _disabledField) : false\">\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ _displayField ? getNestedValue(item, _displayField) : item }}\n }\n </mat-option>\n }\n } @else if (_loading) {\n <mat-option disabled><mat-spinner diameter=\"24\"></mat-spinner></mat-option>\n } @else if (hasSearched() && !_isTyping && _readState.status === 'empty') {\n <mat-option disabled class=\"sd-read-state-anchor\" aria-hidden=\"true\"></mat-option>\n <ng-container [ngTemplateOutlet]=\"readRegion\" [ngTemplateOutletContext]=\"{ state: 'empty' }\"></ng-container>\n }\n\n @if (addable() && sdAdd.observed) {\n <mat-option class=\"sd__option--add\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\n <!-- why: tr\u01B0\u1EDBc l\u00E0 <div (click)> \u2014 kh\u00F4ng Tab t\u1EDBi \u0111\u01B0\u1EE3c, kh\u00F4ng c\u00F3 role, v\u00E0 ch\u1EC9 \"im l\u1EB7ng\"\n v\u1EDBi lint v\u00EC c\u1EA3 c\u1EE5m n\u1EB1m trong c\u00E2y aria-hidden. <button type=\"button\"> l\u1EA5y s\u1EB5n\n Enter/Space + role button, kh\u00F4ng ph\u1EA3i b\u1ECBa tabindex/keydown th\u1EE7 c\u00F4ng. -->\n <button type=\"button\" class=\"sd__option--add-btn\" (click)=\"onAdd($event)\">\n <sd-icon class=\"mr-1\" name=\"add\" aria-hidden=\"true\"></sd-icon>\n {{ 'New item' }}\n </button>\n </mat-option>\n }\n </mat-autocomplete>\n\n @if (_hideInlineError && _errorVisible) {\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\n @if (_hideInlineError && _errorVisible) {\n <span class=\"sd-visually-hidden\" [id]=\"errorId\" matSuffix>{{ _errorMessage }}</span>\n }\n\n @if (_showInlineError) {\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\n }\n </mat-form-field>\n </div>\n}\n\n<ng-template #readRegion let-current=\"state\">\n <sd-data-state [state]=\"current\" compact [retryable]=\"current === 'error'\" (sdRetry)=\"retryRead()\">\n @if (dataStateTemplate(); as custom) {\n <ng-template sdDataStateTemplate let-state let-retry=\"retry\" let-action=\"action\">\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{ $implicit: state, state: state, retry: retry, action: action }\"></ng-container>\n </ng-template>\n }\n </sd-data-state>\n</ng-template>\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-primary-contrast{color:var(--sd-primary-contrast)!important}.bg-primary-contrast{background:var(--sd-primary-contrast)!important}.border-primary-contrast{border-color:var(--sd-primary-contrast)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-secondary-contrast{color:var(--sd-secondary-contrast)!important}.bg-secondary-contrast{background:var(--sd-secondary-contrast)!important}.border-secondary-contrast{border-color:var(--sd-secondary-contrast)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-info-contrast{color:var(--sd-info-contrast)!important}.bg-info-contrast{background:var(--sd-info-contrast)!important}.border-info-contrast{border-color:var(--sd-info-contrast)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-success-contrast{color:var(--sd-success-contrast)!important}.bg-success-contrast{background:var(--sd-success-contrast)!important}.border-success-contrast{border-color:var(--sd-success-contrast)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-warning-contrast{color:var(--sd-warning-contrast)!important}.bg-warning-contrast{background:var(--sd-warning-contrast)!important}.border-warning-contrast{border-color:var(--sd-warning-contrast)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-error-contrast{color:var(--sd-error-contrast)!important}.bg-error-contrast{background:var(--sd-error-contrast)!important}.border-error-contrast{border-color:var(--sd-error-contrast)!important}.text-surface{color:var(--sd-surface)!important}.bg-surface{background:var(--sd-surface)!important}.border-surface{border-color:var(--sd-surface)!important}.text-surface-muted{color:var(--sd-surface-muted)!important}.bg-surface-muted{background:var(--sd-surface-muted)!important}.border-surface-muted{border-color:var(--sd-surface-muted)!important}.text-text{color:var(--sd-text)!important}.bg-text{background:var(--sd-text)!important}.border-text{border-color:var(--sd-text)!important}.text-text-secondary{color:var(--sd-text-secondary)!important}.bg-text-secondary{background:var(--sd-text-secondary)!important}.border-text-secondary{border-color:var(--sd-text-secondary)!important}.text-text-muted{color:var(--sd-text-muted)!important}.bg-text-muted{background:var(--sd-text-muted)!important}.border-text-muted{border-color:var(--sd-text-muted)!important}.text-border{color:var(--sd-border)!important}.bg-border{background:var(--sd-border)!important}.border-border{border-color:var(--sd-border)!important}.text-border-strong{color:var(--sd-border-strong)!important}.bg-border-strong{background:var(--sd-border-strong)!important}.border-border-strong{border-color:var(--sd-border-strong)!important}.text-disabled-bg{color:var(--sd-disabled-bg)!important}.bg-disabled-bg{background:var(--sd-disabled-bg)!important}.border-disabled-bg{border-color:var(--sd-disabled-bg)!important}.text-disabled-text{color:var(--sd-disabled-text)!important}.bg-disabled-text{background:var(--sd-disabled-text)!important}.border-disabled-text{border-color:var(--sd-disabled-text)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}.text-secondary{color:var(--sd-text-secondary)!important}.text-muted{color:var(--sd-text-muted)!important}.text-body{color:var(--sd-text)!important}.bg-muted{background:var(--sd-surface-muted)!important}:host(.sd-bare){position:relative}.sd-inline-view{cursor:pointer;display:inline-flex;align-items:center;width:100%;padding:1px 6px;border-radius:4px;background-color:#0000000a;transition:background-color .15s ease}.sd-inline-view:hover{background-color:#00000014}.sd-inline-view .sd-inline-clear{display:none;align-items:center;margin-left:4px;padding:0;border:0;background:transparent;cursor:pointer;line-height:0;color:var(--sd-text-secondary, #6b7280);transition:color .15s ease}.sd-inline-view .sd-inline-clear sd-icon{font-size:16px;width:16px;height:16px}.sd-inline-view .sd-inline-clear:hover{color:var(--sd-error, #b32626)}.sd-inline-view:hover .sd-inline-clear{display:inline-flex}.sd-inline-editor{position:absolute;inset:0;opacity:0;pointer-events:none}.sd-inline-editor ::ng-deep *{pointer-events:none!important}:host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-viewed){padding-top:0}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-surface-muted)}:host ::ng-deep .mat-mdc-form-field input.c-selected::placeholder{color:#000;opacity:1}:host ::ng-deep .mat-mdc-form-field input.c-selected:-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.c-selected::-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::placeholder{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected:-ms-input-placeholder{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::-ms-input-placeholder{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}:host ::ng-deep .mat-mdc-form-field:hover .icon-copy{opacity:1}:host ::ng-deep .mat-mdc-form-field .icon-copy{cursor:pointer;width:.9em;height:.9em;fill:#00000080;transition:opacity .2s linear;opacity:0}::ng-deep .sd-autocomplete-panel .mat-mdc-option{min-height:36px!important;padding:8px 12px!important}::ng-deep .sd-autocomplete-panel .mdc-list-item__primary-text{font-size:14px!important;line-height:normal}::ng-deep .sd-autocomplete-panel .mat-pseudo-checkbox{transform:scale(.7);margin-right:8px!important}::ng-deep .sd-autocomplete-panel .mat-pseudo-checkbox-minimal{transform:scale(.7);transform-origin:center right}.sd__option--add{position:sticky;bottom:0;background-color:var(--sd-light);z-index:10;color:var(--sd-black500);display:flex;align-items:center;width:100%;min-height:48px;padding:0 16px;border:0;font:inherit;text-align:left;cursor:pointer!important}.sd__option--add-btn{display:flex;align-items:center;width:100%;border:0;padding:0;background:transparent;font:inherit;color:inherit;text-align:left;cursor:pointer}.c-loading-icon{position:absolute;right:5px;top:5px}::ng-deep .sd-autocomplete-panel .sd-read-state-anchor{display:none}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdDataState, selector: "sd-data-state", inputs: ["state", "title", "message", "icon", "fontSet", "retryable", "retryLabel", "actionLabel", "compact", "fullPage"], outputs: ["sdRetry", "sdAction"] }, { kind: "directive", type: SdDataStateTemplateDirective, selector: "ng-template[sdDataStateTemplate]" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.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: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i5.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i5.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i6.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate", "selectedItems"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
496
685
|
}
|
|
497
686
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdAutocomplete, decorators: [{
|
|
498
687
|
type: Component,
|
|
499
688
|
args: [{ selector: 'sd-autocomplete', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, host: { '[class.sd-has-label]': '!!label()', '[class.sd-viewed]': 'isViewed() || isInline()', '[class.sd-bare]': 'isInline()' }, imports: [
|
|
500
689
|
SdIcon,
|
|
690
|
+
SdDataState,
|
|
691
|
+
SdDataStateTemplateDirective,
|
|
501
692
|
CommonModule,
|
|
502
693
|
FormsModule,
|
|
503
694
|
ReactiveFormsModule,
|
|
@@ -508,8 +699,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
508
699
|
MatProgressSpinnerModule,
|
|
509
700
|
SdLabel,
|
|
510
701
|
SdView,
|
|
511
|
-
], template: "@let _label = label();\n@let _appearance = appearance();\n@let _hideInlineError = hideInlineError();\n@let _errorMessage = errorMessage();\n@let _helperText = helperText();\n@let _required = required();\n@let _displayField = displayField();\n@let _disabledField = disabledField();\n@let iDefTpl = itemDef()?.templateRef;\n@let _loading = loading();\n@let nVal = $any(normalizedValue());\n@let _isInline = isInline();\n@let _bare = _isInline;\n@let _hasValue = nVal !== undefined && nVal !== null && nVal !== '';\n<!-- why: m\u1ED9t c\u1ED5ng gate duy nh\u1EA5t cho <mat-error>, aria-invalid v\u00E0 aria-describedby. -->\n@let _errorVisible = !!_errorMessage && formControl.touched;\n@let _showInlineError = !_hideInlineError && _errorVisible;\n\n@if (isViewed()) {\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"nVal\"\n [display]=\"display()\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\">\n </sd-view>\n} @else {\n @if (_isInline) {\n <!-- why: inline \u2014 sd-view l\u00E0 \"m\u1EB7t\" + trigger; autocomplete editor render \u1EA9n (.sd-inline-editor) ch\u1EC9 \u0111\u1EC3 m\u1EDF panel. -->\n <span class=\"sd-inline-view\" role=\"button\" tabindex=\"0\" (click)=\"enterInlineEdit()\" (keydown.enter)=\"enterInlineEdit()\">\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"nVal\"\n [display]=\"display()\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\">\n </sd-view>\n @if (clearable() && _hasValue && !_required && !formControl.disabled) {\n <button type=\"button\" class=\"sd-inline-clear\" (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </span>\n }\n\n @if (!_appearance) {\n <ng-content select=\"[sdLabel]\">\n @if (_label) {\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\n }\n </ng-content>\n }\n\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout. aria-hidden=\"true\" c\u0169 \u1EA9n C\u1EA2 c\u00E2y con \u2014 label, <input>,\n <mat-error>, n\u00FAt clear v\u00E0 c\u1EA3 panel g\u1EE3i \u00FD \u2014 kh\u1ECFi accessibility tree. role=\"presentation\"\n ch\u1EC9 v\u00F4 hi\u1EC7u ho\u00E1 ch\u00EDnh div, KH\u00D4NG lan xu\u1ED1ng con; (click) l\u00E0 ti\u1EC7n \u00EDch chu\u1ED9t m\u00E0 b\u00E0n ph\u00EDm \u0111\u00E3\n c\u00F3 qua Tab v\u00E0o <input>. -->\n <div\n class=\"d-flex align-items-center\"\n role=\"presentation\"\n [class.sd-inline-editor]=\"_isInline\"\n [class.c-focused]=\"isFocused\"\n [class.c-disabled]=\"formControl.disabled\"\n (click)=\"onClick()\">\n <mat-form-field\n [class.sd-md]=\"size() === 'md'\"\n [class.sd-sm]=\"size() === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [floatLabel]=\"nVal ? 'always' : 'auto'\"\n [appearance]=\"_appearance || 'outline'\">\n @if (_appearance && _label) {\n <mat-label class=\"sd-form-field-label\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <sd-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\" name=\"info\"></sd-icon>\n }\n </mat-label>\n }\n\n <!-- why: B\u1ECE aria-hidden tr\u00EAn ch\u00EDnh <input> \u2014 \u00F4 Tab t\u1EDBi v\u00E0 g\u00F5 \u0111\u01B0\u1EE3c, aria-hidden ch\u1EC9 khi\u1EBFn\n screen reader \u0111\u1ECDc ra kho\u1EA3ng l\u1EB7ng. -->\n <input\n [id]=\"id\"\n [formControl]=\"inputControl\"\n [placeholder]=\"controlPlaceHolder() || ''\"\n [class.c-selected]=\"nVal\"\n [matAutocomplete]=\"auto\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n matInput\n [autocomplete]=\"id\"\n autocorrect=\"off\"\n [errorStateMatcher]=\"matcher\"\n [required]=\"_required\"\n #input\n #autocompleteTrigger=\"matAutocompleteTrigger\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-invalid]=\"dataInvalid()\"\n [attr.data-empty]=\"dataEmpty()\"\n [attr.data-value]=\"dataValue()\"\n [attr.data-loading]=\"dataLoading()\"\n [attr.data-required]=\"dataRequired()\"\n [attr.data-error-message]=\"dataErrorMessage()\"\n [attr.aria-invalid]=\"_errorVisible ? 'true' : null\"\n [attr.aria-describedby]=\"_errorMessage ? errorId : null\" />\n\n @if (!_loading && nVal && !inputControl.disabled && !_bare) {\n <button type=\"button\" class=\"sd-clear-btn\" matSuffix (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n } @else if (_loading) {\n <mat-spinner [diameter]=\"20\" matSuffix></mat-spinner>\n } @else {\n <sd-icon class=\"cursor-pointer sd-suffix-icon\" matSuffix name=\"search\"></sd-icon>\n }\n\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onSelect($event.option.value)\" class=\"sd-autocomplete-panel\">\n @let _filteredItems = filteredItems();\n\n @if (_filteredItems?.length) {\n @for (item of _filteredItems; track $index) {\n <mat-option\n [value]=\"item\"\n matTooltipPosition=\"above\"\n [matTooltip]=\"_displayField ? getNestedValue(item, _displayField) : item\"\n [disabled]=\"_disabledField ? getNestedValue(item, _disabledField) : false\">\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ _displayField ? getNestedValue(item, _displayField) : item }}\n }\n </mat-option>\n }\n } @else if (!_filteredItems?.length && inputControl.value && !isTyping() && !_loading) {}\n\n @if (addable() && sdAdd.observed) {\n <mat-option class=\"sd__option--add\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\n <!-- why: tr\u01B0\u1EDBc l\u00E0 <div (click)> \u2014 kh\u00F4ng Tab t\u1EDBi \u0111\u01B0\u1EE3c, kh\u00F4ng c\u00F3 role, v\u00E0 ch\u1EC9 \"im l\u1EB7ng\"\n v\u1EDBi lint v\u00EC c\u1EA3 c\u1EE5m n\u1EB1m trong c\u00E2y aria-hidden. <button type=\"button\"> l\u1EA5y s\u1EB5n\n Enter/Space + role button, kh\u00F4ng ph\u1EA3i b\u1ECBa tabindex/keydown th\u1EE7 c\u00F4ng. -->\n <button type=\"button\" class=\"sd__option--add-btn\" (click)=\"onAdd($event)\">\n <sd-icon class=\"mr-1\" name=\"add\" aria-hidden=\"true\"></sd-icon>\n {{ 'New item' }}\n </button>\n </mat-option>\n }\n </mat-autocomplete>\n\n @if (_hideInlineError && _errorVisible) {\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\n @if (_hideInlineError && _errorVisible) {\n <span class=\"sd-visually-hidden\" [id]=\"errorId\" matSuffix>{{ _errorMessage }}</span>\n\n }\n\n @if (_showInlineError) {\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\n }\n </mat-form-field>\n </div>\n}\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-primary-contrast{color:var(--sd-primary-contrast)!important}.bg-primary-contrast{background:var(--sd-primary-contrast)!important}.border-primary-contrast{border-color:var(--sd-primary-contrast)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-secondary-contrast{color:var(--sd-secondary-contrast)!important}.bg-secondary-contrast{background:var(--sd-secondary-contrast)!important}.border-secondary-contrast{border-color:var(--sd-secondary-contrast)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-info-contrast{color:var(--sd-info-contrast)!important}.bg-info-contrast{background:var(--sd-info-contrast)!important}.border-info-contrast{border-color:var(--sd-info-contrast)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-success-contrast{color:var(--sd-success-contrast)!important}.bg-success-contrast{background:var(--sd-success-contrast)!important}.border-success-contrast{border-color:var(--sd-success-contrast)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-warning-contrast{color:var(--sd-warning-contrast)!important}.bg-warning-contrast{background:var(--sd-warning-contrast)!important}.border-warning-contrast{border-color:var(--sd-warning-contrast)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-error-contrast{color:var(--sd-error-contrast)!important}.bg-error-contrast{background:var(--sd-error-contrast)!important}.border-error-contrast{border-color:var(--sd-error-contrast)!important}.text-surface{color:var(--sd-surface)!important}.bg-surface{background:var(--sd-surface)!important}.border-surface{border-color:var(--sd-surface)!important}.text-surface-muted{color:var(--sd-surface-muted)!important}.bg-surface-muted{background:var(--sd-surface-muted)!important}.border-surface-muted{border-color:var(--sd-surface-muted)!important}.text-text{color:var(--sd-text)!important}.bg-text{background:var(--sd-text)!important}.border-text{border-color:var(--sd-text)!important}.text-text-secondary{color:var(--sd-text-secondary)!important}.bg-text-secondary{background:var(--sd-text-secondary)!important}.border-text-secondary{border-color:var(--sd-text-secondary)!important}.text-text-muted{color:var(--sd-text-muted)!important}.bg-text-muted{background:var(--sd-text-muted)!important}.border-text-muted{border-color:var(--sd-text-muted)!important}.text-border{color:var(--sd-border)!important}.bg-border{background:var(--sd-border)!important}.border-border{border-color:var(--sd-border)!important}.text-border-strong{color:var(--sd-border-strong)!important}.bg-border-strong{background:var(--sd-border-strong)!important}.border-border-strong{border-color:var(--sd-border-strong)!important}.text-disabled-bg{color:var(--sd-disabled-bg)!important}.bg-disabled-bg{background:var(--sd-disabled-bg)!important}.border-disabled-bg{border-color:var(--sd-disabled-bg)!important}.text-disabled-text{color:var(--sd-disabled-text)!important}.bg-disabled-text{background:var(--sd-disabled-text)!important}.border-disabled-text{border-color:var(--sd-disabled-text)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}.text-secondary{color:var(--sd-text-secondary)!important}.text-muted{color:var(--sd-text-muted)!important}.text-body{color:var(--sd-text)!important}.bg-muted{background:var(--sd-surface-muted)!important}:host(.sd-bare){position:relative}.sd-inline-view{cursor:pointer;display:inline-flex;align-items:center;width:100%;padding:1px 6px;border-radius:4px;background-color:#0000000a;transition:background-color .15s ease}.sd-inline-view:hover{background-color:#00000014}.sd-inline-view .sd-inline-clear{display:none;align-items:center;margin-left:4px;padding:0;border:0;background:transparent;cursor:pointer;line-height:0;color:var(--sd-text-secondary, #6b7280);transition:color .15s ease}.sd-inline-view .sd-inline-clear sd-icon{font-size:16px;width:16px;height:16px}.sd-inline-view .sd-inline-clear:hover{color:var(--sd-error, #b32626)}.sd-inline-view:hover .sd-inline-clear{display:inline-flex}.sd-inline-editor{position:absolute;inset:0;opacity:0;pointer-events:none}.sd-inline-editor ::ng-deep *{pointer-events:none!important}:host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-viewed){padding-top:0}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-surface-muted)}:host ::ng-deep .mat-mdc-form-field input.c-selected::placeholder{color:#000;opacity:1}:host ::ng-deep .mat-mdc-form-field input.c-selected:-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.c-selected::-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::placeholder{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected:-ms-input-placeholder{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::-ms-input-placeholder{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}:host ::ng-deep .mat-mdc-form-field:hover .icon-copy{opacity:1}:host ::ng-deep .mat-mdc-form-field .icon-copy{cursor:pointer;width:.9em;height:.9em;fill:#00000080;transition:opacity .2s linear;opacity:0}::ng-deep .sd-autocomplete-panel .mat-mdc-option{min-height:36px!important;padding:8px 12px!important}::ng-deep .sd-autocomplete-panel .mdc-list-item__primary-text{font-size:14px!important;line-height:normal}::ng-deep .sd-autocomplete-panel .mat-pseudo-checkbox{transform:scale(.7);margin-right:8px!important}::ng-deep .sd-autocomplete-panel .mat-pseudo-checkbox-minimal{transform:scale(.7);transform-origin:center right}.sd__option--add{position:sticky;bottom:0;background-color:#fff;z-index:10;color:#000000de;cursor:pointer!important}.sd__option--add-btn{display:flex;align-items:center;width:100%;border:0;padding:0;background:transparent;font:inherit;color:inherit;text-align:left;cursor:pointer}.c-loading-icon{position:absolute;right:5px;top:5px}\n"] }]
|
|
512
|
-
}], ctorParameters: () => [], propDecorators: { inputRef: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }], autocompleteTrigger: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatAutocompleteTrigger), { isSignal: true }] }], sdLabelTemplate: [{ type: i0.ContentChild, args: ['sdLabel', { isSignal: true }] }], sdValueTemplate: [{ type: i0.ContentChild, args: ['sdValue', { isSignal: true }] }], itemDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdItemDefDefDirective), { isSignal: true }] }], sdViewDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdViewDefDirective), { isSignal: true }] }], autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], helperText: [{ type: i0.Input, args: [{ isSignal: true, alias: "helperText", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], valueField: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueField", required: false }] }], displayField: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayField", required: false }] }], disabledField: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledField", required: false }] }], limit: [{ type: i0.Input, args: [{ isSignal: true, alias: "limit", required: false }] }], cacheChecksum: [{ type: i0.Input, args: [{ isSignal: true, alias: "cacheChecksum", required: false }] }], hyperlink: [{ type: i0.Input, args: [{ isSignal: true, alias: "hyperlink", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], hideInlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideInlineError", required: false }] }], addable: [{ type: i0.Input, args: [{ isSignal: true, alias: "addable", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], viewed: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewed", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], validator: [{ type: i0.Input, args: [{ isSignal: true, alias: "validator", required: false }] }], inlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "inlineError", required: false }] }], appearanceInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], valueModel: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }, { type: i0.Output, args: ["modelChange"] }], sdChange: [{ type: i0.Output, args: ["sdChange"] }], sdSelection: [{ type: i0.Output, args: ["sdSelection"] }], sdAdd: [{
|
|
702
|
+
], template: "@let _readState = readState();\n@let _isTyping = isTyping();\n@let _label = label();\n@let _appearance = appearance();\n@let _hideInlineError = hideInlineError();\n@let _errorMessage = errorMessage();\n@let _helperText = helperText();\n@let _required = required();\n@let _displayField = displayField();\n@let _disabledField = disabledField();\n@let iDefTpl = itemDef()?.templateRef;\n@let _loading = loading();\n@let nVal = $any(normalizedValue());\n@let _isInline = isInline();\n@let _bare = _isInline;\n@let _hasValue = nVal !== undefined && nVal !== null && nVal !== '';\n<!-- why: m\u1ED9t c\u1ED5ng gate duy nh\u1EA5t cho <mat-error>, aria-invalid v\u00E0 aria-describedby. -->\n@let _errorVisible = !!_errorMessage && formControl.touched;\n@let _showInlineError = !_hideInlineError && _errorVisible;\n\n@if (isViewed()) {\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"nVal\"\n [display]=\"display()\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\">\n </sd-view>\n} @else {\n @if (_isInline) {\n <!-- why: inline \u2014 sd-view l\u00E0 \"m\u1EB7t\" + trigger; autocomplete editor render \u1EA9n (.sd-inline-editor) ch\u1EC9 \u0111\u1EC3 m\u1EDF panel. -->\n <span class=\"sd-inline-view\" role=\"button\" tabindex=\"0\" (click)=\"enterInlineEdit()\" (keydown.enter)=\"enterInlineEdit()\">\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"nVal\"\n [display]=\"display()\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\">\n </sd-view>\n @if (clearable() && _hasValue && !_required && !formControl.disabled) {\n <button type=\"button\" class=\"sd-inline-clear\" (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </span>\n }\n\n @if (!_appearance) {\n <ng-content select=\"[sdLabel]\">\n @if (_label) {\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\n }\n </ng-content>\n }\n\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout. aria-hidden=\"true\" c\u0169 \u1EA9n C\u1EA2 c\u00E2y con \u2014 label, <input>,\n <mat-error>, n\u00FAt clear v\u00E0 c\u1EA3 panel g\u1EE3i \u00FD \u2014 kh\u1ECFi accessibility tree. role=\"presentation\"\n ch\u1EC9 v\u00F4 hi\u1EC7u ho\u00E1 ch\u00EDnh div, KH\u00D4NG lan xu\u1ED1ng con; (click) l\u00E0 ti\u1EC7n \u00EDch chu\u1ED9t m\u00E0 b\u00E0n ph\u00EDm \u0111\u00E3\n c\u00F3 qua Tab v\u00E0o <input>. -->\n <div\n class=\"d-flex align-items-center\"\n role=\"presentation\"\n [class.sd-inline-editor]=\"_isInline\"\n [class.c-focused]=\"isFocused\"\n [class.c-disabled]=\"formControl.disabled\"\n (click)=\"onClick()\">\n <mat-form-field\n [class.sd-md]=\"size() === 'md'\"\n [class.sd-sm]=\"size() === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [floatLabel]=\"nVal ? 'always' : 'auto'\"\n [appearance]=\"_appearance || 'outline'\">\n @if (_appearance && _label) {\n <mat-label class=\"sd-form-field-label\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <sd-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\" name=\"info\"></sd-icon>\n }\n </mat-label>\n }\n\n <!-- why: B\u1ECE aria-hidden tr\u00EAn ch\u00EDnh <input> \u2014 \u00F4 Tab t\u1EDBi v\u00E0 g\u00F5 \u0111\u01B0\u1EE3c, aria-hidden ch\u1EC9 khi\u1EBFn\n screen reader \u0111\u1ECDc ra kho\u1EA3ng l\u1EB7ng. -->\n <input\n [id]=\"id\"\n [formControl]=\"inputControl\"\n [placeholder]=\"controlPlaceHolder() || ''\"\n [class.c-selected]=\"nVal\"\n [matAutocomplete]=\"auto\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur($event)\"\n matInput\n [autocomplete]=\"id\"\n autocorrect=\"off\"\n [errorStateMatcher]=\"matcher\"\n [required]=\"_required\"\n #input\n #autocompleteTrigger=\"matAutocompleteTrigger\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-invalid]=\"dataInvalid()\"\n [attr.data-empty]=\"dataEmpty()\"\n [attr.data-value]=\"dataValue()\"\n [attr.data-loading]=\"dataLoading()\"\n [attr.data-required]=\"dataRequired()\"\n [attr.data-error-message]=\"dataErrorMessage()\"\n [attr.aria-invalid]=\"_errorVisible ? 'true' : null\"\n [attr.aria-describedby]=\"_errorMessage ? errorId : null\" />\n\n @if (!_loading && nVal && !inputControl.disabled && !_bare) {\n <button type=\"button\" class=\"sd-clear-btn\" matSuffix (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n } @else if (_loading) {\n <mat-spinner [diameter]=\"20\" matSuffix></mat-spinner>\n } @else {\n <sd-icon class=\"cursor-pointer sd-suffix-icon\" matSuffix name=\"search\"></sd-icon>\n }\n\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onSelect($event.option.value)\" class=\"sd-autocomplete-panel\">\n @let _filteredItems = filteredItems();\n\n <!-- why: kh\u00F4ng hi\u1EC3n th\u1ECB l\u1ED7i k\u00EAnh c\u0169 c\u00F9ng spinner c\u1EE7a k\u00EAnh \u0111ang \u0111\u1ECDc/retry. -->\n @if (!_loading && _readState.status === 'error') {\n <!-- why: anchor gi\u1EEF panel m\u1EDF khi kh\u00F4ng c\u00F3 option; n\u00FAt retry kh\u00F4ng n\u1EB1m trong mat-option. -->\n <mat-option disabled class=\"sd-read-state-anchor\" aria-hidden=\"true\"></mat-option>\n @if (!hideReadError()) {\n <div\n class=\"sd-read-state-region\"\n role=\"presentation\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"onReadRegionKeydown($event)\">\n <ng-container [ngTemplateOutlet]=\"readRegion\" [ngTemplateOutletContext]=\"{ state: 'error' }\"></ng-container>\n </div>\n }\n }\n\n @if (_filteredItems?.length) {\n @for (item of _filteredItems; track $index) {\n <mat-option\n [value]=\"item\"\n matTooltipPosition=\"above\"\n [matTooltip]=\"_displayField ? getNestedValue(item, _displayField) : item\"\n [disabled]=\"_disabledField ? getNestedValue(item, _disabledField) : false\">\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ _displayField ? getNestedValue(item, _displayField) : item }}\n }\n </mat-option>\n }\n } @else if (_loading) {\n <mat-option disabled><mat-spinner diameter=\"24\"></mat-spinner></mat-option>\n } @else if (hasSearched() && !_isTyping && _readState.status === 'empty') {\n <mat-option disabled class=\"sd-read-state-anchor\" aria-hidden=\"true\"></mat-option>\n <ng-container [ngTemplateOutlet]=\"readRegion\" [ngTemplateOutletContext]=\"{ state: 'empty' }\"></ng-container>\n }\n\n @if (addable() && sdAdd.observed) {\n <mat-option class=\"sd__option--add\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\n <!-- why: tr\u01B0\u1EDBc l\u00E0 <div (click)> \u2014 kh\u00F4ng Tab t\u1EDBi \u0111\u01B0\u1EE3c, kh\u00F4ng c\u00F3 role, v\u00E0 ch\u1EC9 \"im l\u1EB7ng\"\n v\u1EDBi lint v\u00EC c\u1EA3 c\u1EE5m n\u1EB1m trong c\u00E2y aria-hidden. <button type=\"button\"> l\u1EA5y s\u1EB5n\n Enter/Space + role button, kh\u00F4ng ph\u1EA3i b\u1ECBa tabindex/keydown th\u1EE7 c\u00F4ng. -->\n <button type=\"button\" class=\"sd__option--add-btn\" (click)=\"onAdd($event)\">\n <sd-icon class=\"mr-1\" name=\"add\" aria-hidden=\"true\"></sd-icon>\n {{ 'New item' }}\n </button>\n </mat-option>\n }\n </mat-autocomplete>\n\n @if (_hideInlineError && _errorVisible) {\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\n @if (_hideInlineError && _errorVisible) {\n <span class=\"sd-visually-hidden\" [id]=\"errorId\" matSuffix>{{ _errorMessage }}</span>\n }\n\n @if (_showInlineError) {\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\n }\n </mat-form-field>\n </div>\n}\n\n<ng-template #readRegion let-current=\"state\">\n <sd-data-state [state]=\"current\" compact [retryable]=\"current === 'error'\" (sdRetry)=\"retryRead()\">\n @if (dataStateTemplate(); as custom) {\n <ng-template sdDataStateTemplate let-state let-retry=\"retry\" let-action=\"action\">\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{ $implicit: state, state: state, retry: retry, action: action }\"></ng-container>\n </ng-template>\n }\n </sd-data-state>\n</ng-template>\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-primary-contrast{color:var(--sd-primary-contrast)!important}.bg-primary-contrast{background:var(--sd-primary-contrast)!important}.border-primary-contrast{border-color:var(--sd-primary-contrast)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-secondary-contrast{color:var(--sd-secondary-contrast)!important}.bg-secondary-contrast{background:var(--sd-secondary-contrast)!important}.border-secondary-contrast{border-color:var(--sd-secondary-contrast)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-info-contrast{color:var(--sd-info-contrast)!important}.bg-info-contrast{background:var(--sd-info-contrast)!important}.border-info-contrast{border-color:var(--sd-info-contrast)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-success-contrast{color:var(--sd-success-contrast)!important}.bg-success-contrast{background:var(--sd-success-contrast)!important}.border-success-contrast{border-color:var(--sd-success-contrast)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-warning-contrast{color:var(--sd-warning-contrast)!important}.bg-warning-contrast{background:var(--sd-warning-contrast)!important}.border-warning-contrast{border-color:var(--sd-warning-contrast)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-error-contrast{color:var(--sd-error-contrast)!important}.bg-error-contrast{background:var(--sd-error-contrast)!important}.border-error-contrast{border-color:var(--sd-error-contrast)!important}.text-surface{color:var(--sd-surface)!important}.bg-surface{background:var(--sd-surface)!important}.border-surface{border-color:var(--sd-surface)!important}.text-surface-muted{color:var(--sd-surface-muted)!important}.bg-surface-muted{background:var(--sd-surface-muted)!important}.border-surface-muted{border-color:var(--sd-surface-muted)!important}.text-text{color:var(--sd-text)!important}.bg-text{background:var(--sd-text)!important}.border-text{border-color:var(--sd-text)!important}.text-text-secondary{color:var(--sd-text-secondary)!important}.bg-text-secondary{background:var(--sd-text-secondary)!important}.border-text-secondary{border-color:var(--sd-text-secondary)!important}.text-text-muted{color:var(--sd-text-muted)!important}.bg-text-muted{background:var(--sd-text-muted)!important}.border-text-muted{border-color:var(--sd-text-muted)!important}.text-border{color:var(--sd-border)!important}.bg-border{background:var(--sd-border)!important}.border-border{border-color:var(--sd-border)!important}.text-border-strong{color:var(--sd-border-strong)!important}.bg-border-strong{background:var(--sd-border-strong)!important}.border-border-strong{border-color:var(--sd-border-strong)!important}.text-disabled-bg{color:var(--sd-disabled-bg)!important}.bg-disabled-bg{background:var(--sd-disabled-bg)!important}.border-disabled-bg{border-color:var(--sd-disabled-bg)!important}.text-disabled-text{color:var(--sd-disabled-text)!important}.bg-disabled-text{background:var(--sd-disabled-text)!important}.border-disabled-text{border-color:var(--sd-disabled-text)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}.text-secondary{color:var(--sd-text-secondary)!important}.text-muted{color:var(--sd-text-muted)!important}.text-body{color:var(--sd-text)!important}.bg-muted{background:var(--sd-surface-muted)!important}:host(.sd-bare){position:relative}.sd-inline-view{cursor:pointer;display:inline-flex;align-items:center;width:100%;padding:1px 6px;border-radius:4px;background-color:#0000000a;transition:background-color .15s ease}.sd-inline-view:hover{background-color:#00000014}.sd-inline-view .sd-inline-clear{display:none;align-items:center;margin-left:4px;padding:0;border:0;background:transparent;cursor:pointer;line-height:0;color:var(--sd-text-secondary, #6b7280);transition:color .15s ease}.sd-inline-view .sd-inline-clear sd-icon{font-size:16px;width:16px;height:16px}.sd-inline-view .sd-inline-clear:hover{color:var(--sd-error, #b32626)}.sd-inline-view:hover .sd-inline-clear{display:inline-flex}.sd-inline-editor{position:absolute;inset:0;opacity:0;pointer-events:none}.sd-inline-editor ::ng-deep *{pointer-events:none!important}:host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-viewed){padding-top:0}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-surface-muted)}:host ::ng-deep .mat-mdc-form-field input.c-selected::placeholder{color:#000;opacity:1}:host ::ng-deep .mat-mdc-form-field input.c-selected:-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.c-selected::-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::placeholder{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected:-ms-input-placeholder{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::-ms-input-placeholder{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}:host ::ng-deep .mat-mdc-form-field:hover .icon-copy{opacity:1}:host ::ng-deep .mat-mdc-form-field .icon-copy{cursor:pointer;width:.9em;height:.9em;fill:#00000080;transition:opacity .2s linear;opacity:0}::ng-deep .sd-autocomplete-panel .mat-mdc-option{min-height:36px!important;padding:8px 12px!important}::ng-deep .sd-autocomplete-panel .mdc-list-item__primary-text{font-size:14px!important;line-height:normal}::ng-deep .sd-autocomplete-panel .mat-pseudo-checkbox{transform:scale(.7);margin-right:8px!important}::ng-deep .sd-autocomplete-panel .mat-pseudo-checkbox-minimal{transform:scale(.7);transform-origin:center right}.sd__option--add{position:sticky;bottom:0;background-color:var(--sd-light);z-index:10;color:var(--sd-black500);display:flex;align-items:center;width:100%;min-height:48px;padding:0 16px;border:0;font:inherit;text-align:left;cursor:pointer!important}.sd__option--add-btn{display:flex;align-items:center;width:100%;border:0;padding:0;background:transparent;font:inherit;color:inherit;text-align:left;cursor:pointer}.c-loading-icon{position:absolute;right:5px;top:5px}::ng-deep .sd-autocomplete-panel .sd-read-state-anchor{display:none}\n"] }]
|
|
703
|
+
}], ctorParameters: () => [], propDecorators: { inputRef: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }], autocompleteTrigger: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatAutocompleteTrigger), { isSignal: true }] }], sdLabelTemplate: [{ type: i0.ContentChild, args: ['sdLabel', { isSignal: true }] }], sdValueTemplate: [{ type: i0.ContentChild, args: ['sdValue', { isSignal: true }] }], itemDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdItemDefDefDirective), { isSignal: true }] }], sdViewDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdViewDefDirective), { isSignal: true }] }], autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], helperText: [{ type: i0.Input, args: [{ isSignal: true, alias: "helperText", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], valueField: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueField", required: false }] }], displayField: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayField", required: false }] }], disabledField: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledField", required: false }] }], limit: [{ type: i0.Input, args: [{ isSignal: true, alias: "limit", required: false }] }], cacheChecksum: [{ type: i0.Input, args: [{ isSignal: true, alias: "cacheChecksum", required: false }] }], hyperlink: [{ type: i0.Input, args: [{ isSignal: true, alias: "hyperlink", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], hideInlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideInlineError", required: false }] }], hideReadError: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideReadError", required: false }] }], dataStateTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdDataStateTemplateDirective), { isSignal: true }] }], sdReadStateChange: [{ type: i0.Output, args: ["sdReadStateChange"] }], addable: [{ type: i0.Input, args: [{ isSignal: true, alias: "addable", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], viewed: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewed", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], validator: [{ type: i0.Input, args: [{ isSignal: true, alias: "validator", required: false }] }], inlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "inlineError", required: false }] }], appearanceInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], valueModel: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }, { type: i0.Output, args: ["modelChange"] }], sdChange: [{ type: i0.Output, args: ["sdChange"] }], sdSelection: [{ type: i0.Output, args: ["sdSelection"] }], sdAdd: [{
|
|
513
704
|
type: Output
|
|
514
705
|
}] } });
|
|
515
706
|
|