@sd-angular/core 19.0.31 → 19.0.33
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/assets/scss/core/_read-state-panel.scss +57 -0
- package/components/data-state/index.d.ts +1 -0
- package/components/data-state/src/data-state.component.d.ts +41 -0
- package/components/import-excel/src/import-excel.component.d.ts +23 -1
- package/components/index.d.ts +1 -0
- package/components/quick-action/src/quick-action.component.d.ts +3 -1
- package/components/table/src/components/selector-action/selector-action.component.d.ts +12 -0
- package/components/table/src/models/table-option-selector.model.d.ts +2 -0
- package/components/table/src/table.component.d.ts +10 -1
- package/components/upload-file/src/upload-file.component.d.ts +5 -1
- package/fesm2022/sd-angular-core-components-badge.mjs +2 -2
- package/fesm2022/sd-angular-core-components-badge.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-button.mjs +2 -2
- package/fesm2022/sd-angular-core-components-button.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-data-state.mjs +72 -0
- package/fesm2022/sd-angular-core-components-data-state.mjs.map +1 -0
- package/fesm2022/sd-angular-core-components-form-generic.mjs +14 -14
- package/fesm2022/sd-angular-core-components-form-generic.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-import-excel.mjs +67 -18
- package/fesm2022/sd-angular-core-components-import-excel.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-inform.mjs +6 -6
- package/fesm2022/sd-angular-core-components-inform.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-query-bar.mjs +3 -3
- package/fesm2022/sd-angular-core-components-query-bar.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-query-builder.mjs +1 -1
- package/fesm2022/sd-angular-core-components-query-builder.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-quick-action.mjs +4 -2
- package/fesm2022/sd-angular-core-components-quick-action.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-stepper.mjs +2 -2
- package/fesm2022/sd-angular-core-components-stepper.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-table.mjs +125 -31
- package/fesm2022/sd-angular-core-components-table.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-tree.mjs +1 -1
- package/fesm2022/sd-angular-core-components-tree.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-upload-file.mjs +20 -6
- package/fesm2022/sd-angular-core-components-upload-file.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components.mjs +1 -0
- package/fesm2022/sd-angular-core-components.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs +247 -59
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-date-range.mjs +2 -2
- package/fesm2022/sd-angular-core-forms-date-range.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-date.mjs +2 -2
- package/fesm2022/sd-angular-core-forms-date.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-datetime.mjs +2 -2
- package/fesm2022/sd-angular-core-forms-datetime.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-select.mjs +290 -67
- package/fesm2022/sd-angular-core-forms-select.mjs.map +1 -1
- package/fesm2022/sd-angular-core-i18n.mjs +160 -0
- package/fesm2022/sd-angular-core-i18n.mjs.map +1 -1
- package/fesm2022/sd-angular-core-modules-layout.mjs +756 -15
- package/fesm2022/sd-angular-core-modules-layout.mjs.map +1 -1
- package/fesm2022/sd-angular-core-utilities-read-state.mjs +87 -0
- package/fesm2022/sd-angular-core-utilities-read-state.mjs.map +1 -0
- package/fesm2022/sd-angular-core-utilities.mjs +1 -0
- package/fesm2022/sd-angular-core-utilities.mjs.map +1 -1
- package/forms/autocomplete/src/autocomplete.component.d.ts +13 -2
- package/forms/select/src/select.component.d.ts +11 -1
- package/i18n/src/en.d.ts +32 -0
- package/modules/layout/components/layout-main/layout-main.component.d.ts +1 -1
- package/modules/layout/components/sidebar-mobile-v1/components/sidebar/sidebar.component.d.ts +2 -2
- package/modules/layout/components/sidebar-mobile-v1/main.component.d.ts +2 -2
- package/modules/layout/components/sidebar-v2/components/sidebar/sidebar.component.d.ts +56 -0
- package/modules/layout/components/sidebar-v2/components/user/user.component.d.ts +22 -0
- package/modules/layout/components/sidebar-v2/main.component.d.ts +25 -0
- package/modules/layout/configurations/layout.configuration.d.ts +5 -1
- package/modules/layout/services/layout.service.d.ts +2 -2
- package/package.json +9 -1
- package/utilities/index.d.ts +1 -0
- package/utilities/read-state/index.d.ts +1 -0
- package/utilities/read-state/src/read-state.d.ts +37 -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 { inject, TemplateRef, input, Directive, viewChild, contentChild, contentChildren, computed, ChangeDetectorRef, ElementRef, booleanAttribute,
|
|
4
|
+
import { inject, TemplateRef, input, Directive, viewChild, contentChild, contentChildren, computed, ChangeDetectorRef, ElementRef, booleanAttribute, output, model, signal, isSignal, DestroyRef, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
5
|
import { toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import * as i2 from '@angular/forms';
|
|
7
7
|
import { NgForm, FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
@@ -18,6 +18,9 @@ import { MatSelectModule } from '@angular/material/select';
|
|
|
18
18
|
import * as i4 from '@angular/material/tooltip';
|
|
19
19
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
20
20
|
import { SdView } from '@sd-angular/core/components/view';
|
|
21
|
+
import { SdDataStateTemplateDirective, SdDataState } from '@sd-angular/core/components/data-state';
|
|
22
|
+
import { SdReadChannel, combineReadStates, cloneReadRequest } from '@sd-angular/core/utilities/read-state';
|
|
23
|
+
import { SdTooltipDirective } from '@sd-angular/core/directives';
|
|
21
24
|
import { SdItemDefDefDirective, SdViewDefDirective } from '@sd-angular/core/forms/directives';
|
|
22
25
|
import { SdLabel } from '@sd-angular/core/forms/label';
|
|
23
26
|
import { SD_FORM_CONFIGURATION, sdFormControlState, sdViewedTransform, sdViewedInline, SdFormControl, HandleSdCustomValidator, SdInlineErrorValidator } from '@sd-angular/core/forms/models';
|
|
@@ -25,7 +28,7 @@ import { I18nService } from '@sd-angular/core/i18n';
|
|
|
25
28
|
import { sdIsEmpty, sdSerializeDataValue } from '@sd-angular/core/utilities/data-state';
|
|
26
29
|
import { Utilities, StringUtilities, ArrayUtilities } from '@sd-angular/core/utilities/extensions';
|
|
27
30
|
import { timer, combineLatest } from 'rxjs';
|
|
28
|
-
import { tap,
|
|
31
|
+
import { map, tap, shareReplay, startWith, debounce, switchMap, filter } from 'rxjs/operators';
|
|
29
32
|
|
|
30
33
|
class SdSelectFooterActionDirective {
|
|
31
34
|
templateRef = inject((TemplateRef));
|
|
@@ -129,6 +132,12 @@ class SdSelect {
|
|
|
129
132
|
transform: value => value ?? 'auto',
|
|
130
133
|
});
|
|
131
134
|
hideInlineError = input(false, { transform: booleanAttribute });
|
|
135
|
+
hideReadError = input(false, { transform: booleanAttribute });
|
|
136
|
+
dataStateTemplate = contentChild(SdDataStateTemplateDirective);
|
|
137
|
+
sdReadStateChange = output();
|
|
138
|
+
#valueRead = new SdReadChannel('VALUE', () => this.#emitReadState());
|
|
139
|
+
#searchRead = new SdReadChannel('SEARCH', () => this.#emitReadState());
|
|
140
|
+
readState = computed(() => combineReadStates(this.#valueRead.state(), this.#searchRead.state()));
|
|
132
141
|
required = input(false, { transform: booleanAttribute });
|
|
133
142
|
disabled = input(false, { transform: booleanAttribute });
|
|
134
143
|
/** Display mode: `false` edit · `true` static view · `'inline'` view + click-to-edit (bare editor). */
|
|
@@ -194,6 +203,13 @@ class SdSelect {
|
|
|
194
203
|
#cache = {};
|
|
195
204
|
#allItem = {};
|
|
196
205
|
#searchRequestId = 0;
|
|
206
|
+
#destroyed = false;
|
|
207
|
+
#searchDebouncing = false;
|
|
208
|
+
#failedValue;
|
|
209
|
+
#failedSearch;
|
|
210
|
+
#pendingValue;
|
|
211
|
+
#pendingSearch;
|
|
212
|
+
#valueCache = {};
|
|
197
213
|
#hashedValue;
|
|
198
214
|
// [NÂNG CẤP]: Xử lý Unwrap (Mở hộp) Signal lồng nhau nếu có
|
|
199
215
|
actualItems = computed(() => {
|
|
@@ -205,7 +221,12 @@ class SdSelect {
|
|
|
205
221
|
return rawItems;
|
|
206
222
|
});
|
|
207
223
|
// Thay vì toObservable(this.items), ta observe cái actualItems đã được unwrap
|
|
208
|
-
#items$ = toObservable(
|
|
224
|
+
#items$ = toObservable(computed(() => ({
|
|
225
|
+
items: this.actualItems(),
|
|
226
|
+
checksum: this.cacheChecksum(),
|
|
227
|
+
valueField: this.valueField(),
|
|
228
|
+
displayField: this.displayField(),
|
|
229
|
+
}))).pipe(map(context => context.items));
|
|
209
230
|
#valueModel$ = toObservable(this.valueModel);
|
|
210
231
|
filteredItems = signal([]);
|
|
211
232
|
selectedItems = signal([]);
|
|
@@ -332,6 +353,12 @@ class SdSelect {
|
|
|
332
353
|
const items = this.selectedItems();
|
|
333
354
|
if (!items || !items.length)
|
|
334
355
|
return '';
|
|
356
|
+
if (this.multiple()) {
|
|
357
|
+
return [
|
|
358
|
+
this.#i18n.t('core.form.select.selected-count', { count: items.length }),
|
|
359
|
+
...items.map(item => `• ${this.itemDisplay(item)}`),
|
|
360
|
+
].join('\n');
|
|
361
|
+
}
|
|
335
362
|
const vF = this.valueField();
|
|
336
363
|
return items.map(item => (vF ? `• ${this.itemValue(item)} - ${this.itemDisplay(item)}` : `• ${item}`)).join('\n');
|
|
337
364
|
});
|
|
@@ -360,6 +387,29 @@ class SdSelect {
|
|
|
360
387
|
};
|
|
361
388
|
#destroyRef = inject(DestroyRef);
|
|
362
389
|
constructor() {
|
|
390
|
+
// why: CDK dispatch keydown ở body capture; bắt Tab sớm hơn nhưng chỉ trong control/panel này.
|
|
391
|
+
this.#el.nativeElement.ownerDocument.addEventListener('keydown', this.focusReadRetry, true);
|
|
392
|
+
this.#destroyRef.onDestroy(() => {
|
|
393
|
+
this.#destroyed = true;
|
|
394
|
+
this.#el.nativeElement.ownerDocument.removeEventListener('keydown', this.focusReadRetry, true);
|
|
395
|
+
this.#valueRead.invalidate();
|
|
396
|
+
this.#searchRead.invalidate();
|
|
397
|
+
++this.#searchRequestId;
|
|
398
|
+
});
|
|
399
|
+
effect(() => {
|
|
400
|
+
this.actualItems();
|
|
401
|
+
this.valueModel();
|
|
402
|
+
this.valueField();
|
|
403
|
+
this.displayField();
|
|
404
|
+
this.cacheChecksum();
|
|
405
|
+
untracked(() => {
|
|
406
|
+
if ((this.#failedValue && !this.#failedValue.valid()) || (this.#pendingValue && !this.#pendingValue.request.valid())) {
|
|
407
|
+
this.#failedValue = undefined;
|
|
408
|
+
this.#pendingValue = undefined;
|
|
409
|
+
this.#valueRead.invalidate();
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
});
|
|
363
413
|
effect(() => {
|
|
364
414
|
const val = this.normalizedValue();
|
|
365
415
|
untracked(() => {
|
|
@@ -435,6 +485,13 @@ class SdSelect {
|
|
|
435
485
|
this.formControl.sdChanges.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => this.#ref.markForCheck());
|
|
436
486
|
const cleanItems$ = this.#items$.pipe(tap(() => {
|
|
437
487
|
this.#cache = {};
|
|
488
|
+
this.#allItem = {};
|
|
489
|
+
this.#valueCache = {};
|
|
490
|
+
this.#failedValue = this.#failedSearch = undefined;
|
|
491
|
+
this.#pendingValue = this.#pendingSearch = undefined;
|
|
492
|
+
this.#valueRead.invalidate();
|
|
493
|
+
this.#searchRead.invalidate();
|
|
494
|
+
++this.#searchRequestId;
|
|
438
495
|
this.inputControl.setValue('');
|
|
439
496
|
}), map(items => {
|
|
440
497
|
if (!items)
|
|
@@ -442,9 +499,19 @@ class SdSelect {
|
|
|
442
499
|
if (Array.isArray(items))
|
|
443
500
|
return items.filter(e => e !== null && e !== undefined);
|
|
444
501
|
return items;
|
|
445
|
-
}));
|
|
446
|
-
const search$ = this.inputControl.valueChanges.pipe(startWith(''), tap(searchText =>
|
|
502
|
+
}), shareReplay({ bufferSize: 1, refCount: true }));
|
|
503
|
+
const search$ = this.inputControl.valueChanges.pipe(startWith(''), tap(searchText => {
|
|
504
|
+
const text = searchText?.toString() || '';
|
|
505
|
+
if (text !== this.searchText()) {
|
|
506
|
+
++this.#searchRequestId;
|
|
507
|
+
this.#failedSearch = undefined;
|
|
508
|
+
this.#pendingSearch = undefined;
|
|
509
|
+
this.#searchRead.invalidate();
|
|
510
|
+
}
|
|
511
|
+
this.searchText.set(text);
|
|
512
|
+
}), tap(() => {
|
|
447
513
|
if (typeof this.actualItems() === 'function' && this.focused()) {
|
|
514
|
+
this.#searchDebouncing = true;
|
|
448
515
|
this.loading.set(true);
|
|
449
516
|
this.#ref.markForCheck();
|
|
450
517
|
}
|
|
@@ -487,15 +554,15 @@ class SdSelect {
|
|
|
487
554
|
flag2 = formValue === value2 ? 1 : 0;
|
|
488
555
|
return flag2 - flag1;
|
|
489
556
|
});
|
|
490
|
-
}), tap(() =>
|
|
491
|
-
this.loading.set(false);
|
|
492
|
-
this.#ref.markForCheck();
|
|
493
|
-
}));
|
|
557
|
+
}), filter((items) => items !== undefined), tap(() => this.#syncReadLoading()));
|
|
494
558
|
const selectedItems$ = combineLatest([cleanItems$, this.#valueModel$]).pipe(switchMap(async ([items, val]) => {
|
|
495
559
|
const vField = this.valueField();
|
|
496
560
|
const dField = this.displayField();
|
|
497
|
-
if (val === undefined || val === null || val === '')
|
|
561
|
+
if (val === undefined || val === null || val === '') {
|
|
562
|
+
this.#failedValue = undefined;
|
|
563
|
+
this.#valueRead.invalidate();
|
|
498
564
|
return [];
|
|
565
|
+
}
|
|
499
566
|
const values = Array.isArray(val) ? val : [val];
|
|
500
567
|
if (!vField)
|
|
501
568
|
return values;
|
|
@@ -508,30 +575,10 @@ class SdSelect {
|
|
|
508
575
|
[dField]: value,
|
|
509
576
|
});
|
|
510
577
|
});
|
|
511
|
-
}))
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
if (!this.multiple() || !Array.isArray(val) || val.length === 0) {
|
|
516
|
-
return ArrayUtilities.paging(allItems, limit);
|
|
517
|
-
}
|
|
518
|
-
// multiple mode: keep ALL selected items (for checkmarks) + limit unselected items
|
|
519
|
-
// why: if selected.length >= limit, paging would show only selected items → user can't pick new ones
|
|
520
|
-
const vField = this.valueField();
|
|
521
|
-
const selectedSet = new Set(val.map(String));
|
|
522
|
-
const selected = [];
|
|
523
|
-
const unselected = [];
|
|
524
|
-
for (const item of allItems) {
|
|
525
|
-
const itemVal = vField ? String(this.itemValue(item) ?? '') : String(item ?? '');
|
|
526
|
-
if (selectedSet.has(itemVal)) {
|
|
527
|
-
selected.push(item);
|
|
528
|
-
}
|
|
529
|
-
else {
|
|
530
|
-
unselected.push(item);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
return [...selected, ...ArrayUtilities.paging(unselected, limit)];
|
|
534
|
-
}));
|
|
578
|
+
}), filter((items) => items !== undefined),
|
|
579
|
+
// why: selectedItems và display cùng dùng một request VALUE, kể cả khi retry.
|
|
580
|
+
shareReplay({ bufferSize: 1, refCount: true }));
|
|
581
|
+
const filteredItems$ = allItems$.pipe(map(this.#pageReadItems));
|
|
535
582
|
const display$ = selectedItems$.pipe(map(items => items?.map(item => (this.displayField() ? this.itemDisplay(item) : item))?.join(', ') || ''));
|
|
536
583
|
filteredItems$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(val => {
|
|
537
584
|
this.filteredItems.set(val || []);
|
|
@@ -546,6 +593,46 @@ class SdSelect {
|
|
|
546
593
|
this.#ref.markForCheck();
|
|
547
594
|
});
|
|
548
595
|
}
|
|
596
|
+
#pageReadItems = (allItems) => {
|
|
597
|
+
const limit = this.limit();
|
|
598
|
+
const val = this.valueModel();
|
|
599
|
+
if (!this.multiple() || !Array.isArray(val) || val.length === 0)
|
|
600
|
+
return ArrayUtilities.paging(allItems, limit);
|
|
601
|
+
// why: giữ toàn bộ selection và thêm limit item chưa chọn, kể cả sau retry.
|
|
602
|
+
const selectedSet = new Set(val.map(String));
|
|
603
|
+
const selected = [];
|
|
604
|
+
const unselected = [];
|
|
605
|
+
for (const item of allItems) {
|
|
606
|
+
const value = this.valueField() ? String(this.itemValue(item) ?? '') : String(item ?? '');
|
|
607
|
+
(selectedSet.has(value) ? selected : unselected).push(item);
|
|
608
|
+
}
|
|
609
|
+
return [...selected, ...ArrayUtilities.paging(unselected, limit)];
|
|
610
|
+
};
|
|
611
|
+
#readRegion = () => this.selectRef()?.panel?.nativeElement.querySelector('.sd-read-state-region') ?? null;
|
|
612
|
+
focusReadRetry = (event) => {
|
|
613
|
+
if (event.key !== 'Tab' || event.shiftKey || !this.selectRef()?.panelOpen)
|
|
614
|
+
return;
|
|
615
|
+
const region = this.#readRegion();
|
|
616
|
+
if (!(event.target instanceof Node) || region?.contains(event.target))
|
|
617
|
+
return;
|
|
618
|
+
if (!this.#el.nativeElement.contains(event.target) && !this.selectRef()?.panel?.nativeElement.contains(event.target))
|
|
619
|
+
return;
|
|
620
|
+
const button = region?.querySelector('button:not([disabled]), [tabindex="0"]');
|
|
621
|
+
if (!button)
|
|
622
|
+
return;
|
|
623
|
+
event.preventDefault();
|
|
624
|
+
event.stopImmediatePropagation();
|
|
625
|
+
button.focus();
|
|
626
|
+
};
|
|
627
|
+
onReadRegionKeydown = (event) => {
|
|
628
|
+
event.stopPropagation();
|
|
629
|
+
if (event.key === 'Escape' || event.key === 'Tab') {
|
|
630
|
+
if (event.key === 'Escape' || event.shiftKey)
|
|
631
|
+
event.preventDefault();
|
|
632
|
+
this.selectRef()?.focus();
|
|
633
|
+
this.selectRef()?.close();
|
|
634
|
+
}
|
|
635
|
+
};
|
|
549
636
|
#updateValidator = (req, val, inl) => {
|
|
550
637
|
this.formControl.clearValidators();
|
|
551
638
|
this.formControl.clearAsyncValidators();
|
|
@@ -561,27 +648,62 @@ class SdSelect {
|
|
|
561
648
|
this.formControl.setAsyncValidators(asyncValidators.length ? asyncValidators : null);
|
|
562
649
|
this.formControl.updateValueAndValidity({ emitEvent: false });
|
|
563
650
|
};
|
|
564
|
-
#loadSelectedItems = async (value, items) => {
|
|
651
|
+
#loadSelectedItems = async (value, items, retry = false) => {
|
|
565
652
|
if (value === undefined || value === null || value === '')
|
|
566
653
|
return [];
|
|
567
|
-
const values = Array.isArray(value) ? value : [value];
|
|
654
|
+
const values = cloneReadRequest(Array.isArray(value) ? value : [value]);
|
|
568
655
|
const vField = this.valueField();
|
|
569
656
|
const dField = this.displayField();
|
|
570
657
|
if (!vField && !dField)
|
|
571
658
|
return values;
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
this.setNestedValue(dummy, dField, val);
|
|
581
|
-
objValue[String(val)] = dummy;
|
|
582
|
-
});
|
|
583
|
-
this.#allItem = { ...objValue, ...this.#allItem };
|
|
659
|
+
const request = this.#createReadRequest(items, { type: 'VALUE', value: cloneReadRequest(value) });
|
|
660
|
+
if (!request.valid())
|
|
661
|
+
return undefined;
|
|
662
|
+
if (this.#pendingValue?.request.key === request.key && this.#pendingValue.request.valid()) {
|
|
663
|
+
await this.#pendingValue.result;
|
|
664
|
+
}
|
|
665
|
+
else if (!retry && this.#failedValue?.key === request.key && this.#failedValue.valid()) {
|
|
666
|
+
// why: mở panel/search không tự retry hoặc che lỗi VALUE còn hiệu lực.
|
|
584
667
|
}
|
|
668
|
+
else {
|
|
669
|
+
const revision = this.#valueRead.begin(request.valid);
|
|
670
|
+
this.#failedValue = undefined;
|
|
671
|
+
const cached = this.#valueCache[request.key];
|
|
672
|
+
if (!retry && (cached !== undefined || values.every(val => this.#allItem[String(val)] !== undefined))) {
|
|
673
|
+
this.#valueRead.succeed(revision, cached?.length ?? values.length);
|
|
674
|
+
}
|
|
675
|
+
else {
|
|
676
|
+
const result = (async () => {
|
|
677
|
+
try {
|
|
678
|
+
const results = (await items(cloneReadRequest(request.args))) || [];
|
|
679
|
+
if (!this.#valueRead.isCurrent(revision))
|
|
680
|
+
return undefined;
|
|
681
|
+
this.#addToDict(results);
|
|
682
|
+
this.#valueCache[request.key] = results;
|
|
683
|
+
this.#valueRead.succeed(revision, results.length);
|
|
684
|
+
return results;
|
|
685
|
+
}
|
|
686
|
+
catch (error) {
|
|
687
|
+
if (this.#valueRead.isCurrent(revision)) {
|
|
688
|
+
this.#failedValue = request;
|
|
689
|
+
this.#valueRead.fail(revision, error);
|
|
690
|
+
}
|
|
691
|
+
return undefined;
|
|
692
|
+
}
|
|
693
|
+
finally {
|
|
694
|
+
if (this.#pendingValue?.request === request)
|
|
695
|
+
this.#pendingValue = undefined;
|
|
696
|
+
this.#syncReadLoading();
|
|
697
|
+
}
|
|
698
|
+
})();
|
|
699
|
+
this.#pendingValue = { request, result };
|
|
700
|
+
await result;
|
|
701
|
+
if (this.#pendingValue?.request === request)
|
|
702
|
+
this.#pendingValue = undefined;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
if (!request.valid())
|
|
706
|
+
return undefined;
|
|
585
707
|
return values.map(val => {
|
|
586
708
|
if (this.#allItem[val?.toString()])
|
|
587
709
|
return this.#allItem[val?.toString()];
|
|
@@ -592,27 +714,67 @@ class SdSelect {
|
|
|
592
714
|
return dummy;
|
|
593
715
|
});
|
|
594
716
|
};
|
|
595
|
-
#loadItems = async (searchText, items) => {
|
|
717
|
+
#loadItems = async (searchText, items, retry = false) => {
|
|
596
718
|
searchText = searchText?.toString() || '';
|
|
597
719
|
const key = Utilities.hash({ checksum: this.cacheChecksum() || null, searchText });
|
|
598
|
-
this.#
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
this.#addToDict(results);
|
|
605
|
-
const mapObj = new Map();
|
|
606
|
-
results.forEach(e => {
|
|
607
|
-
const k = this.itemValue(e);
|
|
608
|
-
if (k != null && !mapObj.has(k))
|
|
609
|
-
mapObj.set(k, e);
|
|
610
|
-
});
|
|
611
|
-
this.#cache[key] = Array.from(mapObj.values());
|
|
720
|
+
const request = this.#createReadRequest(items, { type: 'SEARCH', searchText });
|
|
721
|
+
if (!request.valid())
|
|
722
|
+
return undefined;
|
|
723
|
+
this.#searchDebouncing = false;
|
|
724
|
+
if (this.#pendingSearch?.request.key === request.key && this.#pendingSearch.request.valid()) {
|
|
725
|
+
await this.#pendingSearch.result;
|
|
612
726
|
}
|
|
727
|
+
else if (!retry && this.#failedSearch?.key === request.key && this.#failedSearch.valid()) {
|
|
728
|
+
// why: thất bại không ghi [] vào cache và không tự retry do subscription khác.
|
|
729
|
+
}
|
|
730
|
+
else if (this.#cache[key] !== undefined && !retry) {
|
|
731
|
+
const revision = this.#searchRead.begin(request.valid);
|
|
732
|
+
this.#searchRead.succeed(revision, this.#cache[key].length);
|
|
733
|
+
}
|
|
734
|
+
else if (this.focused() || retry) {
|
|
735
|
+
const currentRequestId = ++this.#searchRequestId;
|
|
736
|
+
const revision = this.#searchRead.begin(() => request.valid() && currentRequestId === this.#searchRequestId);
|
|
737
|
+
this.#failedSearch = undefined;
|
|
738
|
+
const result = (async () => {
|
|
739
|
+
try {
|
|
740
|
+
const results = (await items(cloneReadRequest(request.args))) || [];
|
|
741
|
+
if (!this.#searchRead.isCurrent(revision))
|
|
742
|
+
return undefined;
|
|
743
|
+
this.#addToDict(results);
|
|
744
|
+
const unique = new Map();
|
|
745
|
+
results.forEach(item => {
|
|
746
|
+
const value = this.itemValue(item);
|
|
747
|
+
if (value != null && !unique.has(value))
|
|
748
|
+
unique.set(value, item);
|
|
749
|
+
});
|
|
750
|
+
this.#cache[key] = Array.from(unique.values());
|
|
751
|
+
this.#searchRead.succeed(revision, results.length);
|
|
752
|
+
return results;
|
|
753
|
+
}
|
|
754
|
+
catch (error) {
|
|
755
|
+
if (this.#searchRead.isCurrent(revision)) {
|
|
756
|
+
this.#failedSearch = request;
|
|
757
|
+
this.#searchRead.fail(revision, error);
|
|
758
|
+
}
|
|
759
|
+
return undefined;
|
|
760
|
+
}
|
|
761
|
+
finally {
|
|
762
|
+
if (this.#pendingSearch?.request === request)
|
|
763
|
+
this.#pendingSearch = undefined;
|
|
764
|
+
this.#syncReadLoading();
|
|
765
|
+
}
|
|
766
|
+
})();
|
|
767
|
+
this.#pendingSearch = { request, result };
|
|
768
|
+
await result;
|
|
769
|
+
if (this.#pendingSearch?.request === request)
|
|
770
|
+
this.#pendingSearch = undefined;
|
|
771
|
+
}
|
|
772
|
+
// why: continuation của loader cũ không được mở revision VALUE sau khi đổi items/context.
|
|
773
|
+
if (!request.valid())
|
|
774
|
+
return undefined;
|
|
613
775
|
const selectedItems = await this.#loadSelectedItems(this.valueModel(), items);
|
|
614
|
-
if (
|
|
615
|
-
return
|
|
776
|
+
if (!request.valid() || selectedItems === undefined)
|
|
777
|
+
return undefined;
|
|
616
778
|
const finalMap = new Map();
|
|
617
779
|
[...selectedItems, ...(this.#cache[key] || [])].forEach(e => {
|
|
618
780
|
const k = this.itemValue(e);
|
|
@@ -621,6 +783,64 @@ class SdSelect {
|
|
|
621
783
|
});
|
|
622
784
|
return Array.from(finalMap.values());
|
|
623
785
|
};
|
|
786
|
+
#createReadRequest = (loader, args) => {
|
|
787
|
+
const checksum = Utilities.hash({ checksum: this.cacheChecksum(), valueField: this.valueField(), displayField: this.displayField() });
|
|
788
|
+
const key = Utilities.hash({ checksum, args });
|
|
789
|
+
return {
|
|
790
|
+
loader,
|
|
791
|
+
args: cloneReadRequest(args),
|
|
792
|
+
key,
|
|
793
|
+
valid: () => !this.#destroyed &&
|
|
794
|
+
this.actualItems() === loader &&
|
|
795
|
+
checksum === Utilities.hash({ checksum: this.cacheChecksum(), valueField: this.valueField(), displayField: this.displayField() }) &&
|
|
796
|
+
key ===
|
|
797
|
+
Utilities.hash({
|
|
798
|
+
checksum,
|
|
799
|
+
args: args.type === 'VALUE'
|
|
800
|
+
? { type: 'VALUE', value: this.valueModel() }
|
|
801
|
+
: { type: 'SEARCH', searchText: this.inputControl.value || '' },
|
|
802
|
+
}),
|
|
803
|
+
};
|
|
804
|
+
};
|
|
805
|
+
#syncReadLoading = () => {
|
|
806
|
+
if (this.#destroyed)
|
|
807
|
+
return;
|
|
808
|
+
this.loading.set(this.#searchDebouncing || this.#valueRead.state().status === 'loading' || this.#searchRead.state().status === 'loading');
|
|
809
|
+
this.#ref.markForCheck();
|
|
810
|
+
};
|
|
811
|
+
#emitReadState = () => {
|
|
812
|
+
if (this.#destroyed)
|
|
813
|
+
return;
|
|
814
|
+
this.#syncReadLoading();
|
|
815
|
+
this.sdReadStateChange.emit(this.readState());
|
|
816
|
+
};
|
|
817
|
+
/** Retry the error selected by readState; VALUE and SEARCH retain separate snapshots. */
|
|
818
|
+
retryRead = async () => {
|
|
819
|
+
const state = this.readState();
|
|
820
|
+
if (state.status !== 'error')
|
|
821
|
+
return;
|
|
822
|
+
const request = state.operation === 'VALUE' ? this.#failedValue : this.#failedSearch;
|
|
823
|
+
if (!request || !request.valid())
|
|
824
|
+
return;
|
|
825
|
+
if (this.#readRegion()?.contains(this.#el.nativeElement.ownerDocument.activeElement))
|
|
826
|
+
this.selectRef()?.focus();
|
|
827
|
+
if (state.operation === 'VALUE') {
|
|
828
|
+
const items = await this.#loadSelectedItems(request.args.value, request.loader, true);
|
|
829
|
+
if (!request.valid() || !items)
|
|
830
|
+
return;
|
|
831
|
+
this.selectedItems.set(items);
|
|
832
|
+
this.display.set(items.map(item => this.itemDisplay(item)).join(', '));
|
|
833
|
+
const selectedKeys = new Set(items.map(item => this.itemValue(item)));
|
|
834
|
+
this.filteredItems.set([...items, ...this.filteredItems().filter(item => !selectedKeys.has(this.itemValue(item)))]);
|
|
835
|
+
}
|
|
836
|
+
else {
|
|
837
|
+
const items = await this.#loadItems(request.args.searchText, request.loader, true);
|
|
838
|
+
if (!request.valid() || !items)
|
|
839
|
+
return;
|
|
840
|
+
this.filteredItems.set(this.#pageReadItems(items));
|
|
841
|
+
}
|
|
842
|
+
this.#syncReadLoading();
|
|
843
|
+
};
|
|
624
844
|
onSelectionChange = (change) => {
|
|
625
845
|
this.allSelected = !this.selectRef()?.options.some(e => !e.selected);
|
|
626
846
|
const value = change?.value ?? '';
|
|
@@ -756,11 +976,14 @@ class SdSelect {
|
|
|
756
976
|
}
|
|
757
977
|
};
|
|
758
978
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
759
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdSelect, isStandalone: true, selector: "sd-select", 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 }, cacheChecksum: { classPropertyName: "cacheChecksum", publicName: "cacheChecksum", isSignal: true, isRequired: false, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, minWidthPanel: { classPropertyName: "minWidthPanel", publicName: "minWidthPanel", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", 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 }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showSelectAll: { classPropertyName: "showSelectAll", publicName: "showSelectAll", 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 }, floatLabel: { classPropertyName: "floatLabel", publicName: "floatLabel", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueModel: "modelChange", sdChange: "sdChange", sdSelection: "sdSelection" }, host: { properties: { "class.sd-bare": "isInline()", "class.sd-viewed": "isViewed() || isInline()", "class.sd-has-label": "!!label()" } }, queries: [{ propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }, { propertyName: "sdSelectedTemplate", first: true, predicate: ["sdSelected"], 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: "footerActions", predicate: SdSelectFooterActionDirective, isSignal: true }], viewQueries: [{ propertyName: "matInputRef", first: true, predicate: MatInput, descendants: true, isSignal: true }, { propertyName: "selectRef", first: true, predicate: ["select"], 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 _multiple = multiple();\n@let _required = required();\n@let _normalizedValue = $any(normalizedValue());\n@let _focused = $any(focused());\n@let _isInline = isInline();\n@let _bare = _isInline;\n@let _hasValue = _multiple ? !!_normalizedValue?.length : _normalizedValue !== undefined && _normalizedValue !== null;\n@let _display = display();\n@let _size = size();\n@let _floatLabel = floatLabel();\n@let _valueField = valueField();\n@let _displayField = displayField();\n@let _autoId = autoId();\n\n@if (isViewed()) {\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"_normalizedValue\"\n [display]=\"_display\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\"\n [selectedItems]=\"selectedItems()\">\n </sd-view>\n} @else {\n @if (_isInline) {\n <!-- why: inline \u2014 sd-view text l\u00E0 \"m\u1EB7t\" + trigger; editor v\u1EABn render b\u00EAn d\u01B0\u1EDBi (chrome \u1EA9n qua\n .sd-inline-editor) \u0111\u1EC3 m\u1EDF panel. Text gi\u1EEF nguy\u00EAn, ch\u1EC9 \u0111\u1ED5i khi commit gi\u00E1 tr\u1ECB m\u1EDBi. -->\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]=\"_normalizedValue\"\n [display]=\"_display\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\"\n [selectedItems]=\"selectedItems()\">\n </sd-view>\n\n <!-- why: clear-\u00D7 ch\u1EC9 hi\u1EC7n khi hover (CSS), \u0111\u1EB7t CU\u1ED0I face + clear($event) stopPropagation \u2192\n xo\u00E1 gi\u00E1 tr\u1ECB m\u00E0 KH\u00D4NG m\u1EDF panel; tr\u00E1nh bug c\u0169 (\u00D7 s\u00E1t trigger b\u1ECB b\u1EA5m nh\u1EA7m l\u00FAc \u0111\u00F3ng panel). -->\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 <mat-icon>close</mat-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 <div\n class=\"d-flex align-items-center\"\n [class.sd-inline-editor]=\"_isInline\"\n [class.c-focused]=\"_focused\"\n [class.c-disabled]=\"formControl.disabled\"\n (click)=\"onClick()\"\n (mouseenter)=\"updatePanelWidth()\"\n (focusin)=\"updatePanelWidth()\"\n aria-hidden=\"true\">\n @if (_multiple) {\n <mat-form-field\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [appearance]=\"_appearance!\"\n [floatLabel]=\"_floatLabel\">\n @if (_appearance && _label) {\n <mat-label style=\"display: inline-block\">\n <div style=\"display: flex; align-items: center; gap: 4px\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <mat-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\">info_outline</mat-icon>\n }\n </div>\n </mat-label>\n }\n\n <mat-select\n #select\n multiple\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder() || _label || ''\"\n (selectionChange)=\"onSelectionChange($event)\"\n disableOptionCentering=\"true\"\n [panelWidth]=\"calculatedPanelWidth()\"\n [panelClass]=\"['sd-select-panel', 'sd-multiple']\"\n [class.sd-selected]=\"!_required && _normalizedValue?.length\"\n [required]=\"_required\"\n (openedChange)=\"onOpenedChange($event)\"\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 matTooltipClass=\"sd-multiline-tooltip\"\n [matTooltipDisabled]=\"!formControl.disabled || !_normalizedValue?.length\"\n [matTooltip]=\"tooltip() || ''\">\n <mat-select-trigger>\n @if (sdSelectedTemplate(); as _selTpl) {\n <ng-container\n *ngTemplateOutlet=\"_selTpl; context: { $implicit: selectedItems(), item: selectedItems(), items: selectedItems(), display: _display, multiple: true }\">\n </ng-container>\n } @else {\n <div class=\"sd-trigger-text\" [matTooltip]=\"_display || ''\" matTooltipPosition=\"above\">\n {{ _display }}\n </div>\n }\n </mat-select-trigger>\n\n @if (filtered()) {\n <div class=\"c-filter-input-container\">\n <div class=\"filter-input-wrapper\">\n <mat-icon>search</mat-icon>\n <input\n [formControl]=\"inputControl\"\n aria-hidden=\"true\"\n matInput\n autocomplete=\"off\"\n class=\"c-search-input\"\n (keydown)=\"$event.stopPropagation()\" />\n </div>\n </div>\n }\n\n <!-- why: row \"T\u1EA5t c\u1EA3\" KH\u00D4NG ph\u1EA3i mat-option th\u1EADt \u2014 n\u1EBFu l\u00E0 option, gi\u00E1 tr\u1ECB c\u1EE7a n\u00F3 l\u1ECDt v\u00E0o\n formControl.value v\u00E0 keyboard navigation c\u1EE7a mat-select. Nh\u01B0ng n\u00F3 ph\u1EA3i TR\u00D4NG y h\u1EC7t m\u1ED9t\n option: d\u00F9ng ch\u00EDnh <mat-pseudo-checkbox> + .mdc-list-item__primary-text m\u00E0 mat-option\n render, n\u00EAn \u0103n c\u00F9ng scale/margin (rule .sd-multiple) v\u00E0 c\u00F9ng m\u00E0u theme (panel mang\n class mat-primary) \u2014 mat-checkbox MDC th\u1EADt th\u00EC l\u1EC7ch c\u1ED9t v\u00E0 \u0103n accent (xanh l\u00E1).\n V\u00EC pseudo-checkbox l\u00E0 decorative + aria-hidden, ch\u00EDnh div mang role/aria/keyboard. -->\n @if (selectAllVisible()) {\n @let _selectAllState = selectAllState();\n <div\n class=\"sd-select-all-row\"\n role=\"checkbox\"\n tabindex=\"0\"\n [attr.aria-checked]=\"_selectAllState === 'indeterminate' ? 'mixed' : _selectAllState === 'checked'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-select-all' : null\"\n (click)=\"toggleSelectAll()\"\n (keydown.enter)=\"toggleSelectAll(); $event.preventDefault()\"\n (keydown.space)=\"toggleSelectAll(); $event.preventDefault()\"\n (keydown)=\"$event.stopPropagation()\">\n <mat-pseudo-checkbox class=\"mat-mdc-option-pseudo-checkbox\" [state]=\"_selectAllState\" aria-hidden=\"true\"></mat-pseudo-checkbox>\n <span class=\"mdc-list-item__primary-text\">{{ selectAllLabel() }}</span>\n </div>\n }\n\n @let _filteredItems = filteredItems();\n @if (_filteredItems) {\n @if (!_filteredItems.length && !loading()) {\n <mat-option class=\"sd-empty\" disabled>\n <img class=\"sd-image-data-empty\" alt=\"empty-image\" style=\"width: 95px\" />\n </mat-option>\n } @else {\n @let iDefTpl = itemDef()?.templateRef;\n @if (_valueField && _displayField) {\n @for (item of _filteredItems; track itemValue(item)) {\n <mat-option [value]=\"itemValue(item)\" [disabled]=\"itemDisabled(item)\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ itemDisplay(item) }}\n }\n </div>\n </mat-option>\n }\n } @else if (!_valueField && !_displayField) {\n @for (item of _filteredItems; track item) {\n <mat-option [value]=\"item\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ item }}\n }\n </div>\n </mat-option>\n }\n }\n }\n }\n\n @if (loading()) {\n <mat-option disabled class=\"sd-loading-option\">\n <mat-spinner diameter=\"24\"></mat-spinner>\n </mat-option>\n }\n\n @let _visibleFooterActions = visibleFooterActions();\n @if (_visibleFooterActions.length) {\n <div class=\"sd-select-footer-actions\">\n @for (action of _visibleFooterActions; track action) {\n <ng-container *ngTemplateOutlet=\"action.templateRef; context: footerActionContext()\"> </ng-container>\n }\n </div>\n }\n </mat-select>\n\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\"> error </mat-icon>\n }\n\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n\n @if (_normalizedValue?.length && !_required && !formControl.disabled && !_bare) {\n <button type=\"button\" class=\"sd-clear-btn\" matSuffix (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <mat-icon>close</mat-icon>\n </button>\n } @else {\n <mat-icon class=\"cursor-pointer sd-suffix-icon\" matSuffix>keyboard_arrow_down</mat-icon>\n }\n </mat-form-field>\n } @else {\n <mat-form-field\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [appearance]=\"_appearance!\"\n [floatLabel]=\"_floatLabel\">\n @if (_appearance && _label) {\n <mat-label style=\"display: inline-block\">\n <div style=\"display: flex; align-items: center; gap: 4px\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <mat-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\">info_outline</mat-icon>\n }\n </div>\n </mat-label>\n }\n\n <mat-select\n #select\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder() || _label || ''\"\n (selectionChange)=\"onSelectionChange($event)\"\n disableOptionCentering=\"true\"\n [panelWidth]=\"calculatedPanelWidth()\"\n [panelClass]=\"'sd-select-panel'\"\n [class.sd-selected]=\"!_required && _normalizedValue !== undefined && _normalizedValue !== null\"\n [required]=\"_required\"\n (openedChange)=\"onOpenedChange($event)\"\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 matTooltipClass=\"sd-multiline-tooltip\"\n [matTooltipDisabled]=\"!formControl.disabled || !_normalizedValue?.length\"\n [matTooltip]=\"tooltip() || ''\">\n <mat-select-trigger>\n @if (sdSelectedTemplate(); as _selTpl) {\n <ng-container\n *ngTemplateOutlet=\"_selTpl; context: { $implicit: selectedItems()[0], item: selectedItems()[0], items: selectedItems(), display: _display, multiple: false }\">\n </ng-container>\n } @else {\n {{ _display }}\n }\n </mat-select-trigger>\n\n @if (filtered()) {\n <div class=\"c-filter-input-container\">\n <div class=\"filter-input-wrapper\">\n <mat-icon>search</mat-icon>\n <input\n [formControl]=\"inputControl\"\n aria-hidden=\"true\"\n matInput\n autocomplete=\"off\"\n class=\"c-search-input\"\n (keydown)=\"$event.stopPropagation()\" />\n </div>\n </div>\n }\n\n @let _filteredItems = filteredItems();\n @if (_filteredItems) {\n @if (!_filteredItems.length && !loading()) {\n <mat-option class=\"sd-empty\" disabled>\n <img class=\"sd-image-data-empty\" alt=\"empty-image\" style=\"width: 95px\" />\n </mat-option>\n } @else {\n @let iDefTpl = itemDef()?.templateRef;\n\n @if (_valueField && _displayField) {\n @for (item of _filteredItems; track itemValue(item)) {\n <mat-option [value]=\"itemValue(item)\" [disabled]=\"itemDisabled(item)\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ itemDisplay(item) }}\n }\n </div>\n </mat-option>\n }\n } @else if (!_valueField && !_displayField) {\n @for (item of _filteredItems; track item) {\n <mat-option [value]=\"item\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ item }}\n }\n </div>\n </mat-option>\n }\n }\n }\n }\n\n @if (loading()) {\n <mat-option disabled class=\"sd-loading-option\">\n <mat-spinner diameter=\"24\"></mat-spinner>\n </mat-option>\n }\n\n @let _visibleFooterActions = visibleFooterActions();\n @if (_visibleFooterActions.length) {\n <div class=\"sd-select-footer-actions\">\n @for (action of _visibleFooterActions; track action) {\n <ng-container *ngTemplateOutlet=\"action.templateRef; context: footerActionContext()\"> </ng-container>\n }\n </div>\n }\n </mat-select>\n\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\"> error </mat-icon>\n }\n\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n\n @if (_normalizedValue !== undefined && _normalizedValue !== null && !_required && !formControl.disabled && !_bare) {\n <button type=\"button\" class=\"sd-clear-btn\" matSuffix (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <mat-icon>close</mat-icon>\n </button>\n } @else {\n <mat-icon class=\"cursor-pointer sd-suffix-icon\" matSuffix>keyboard_arrow_down</mat-icon>\n }\n </mat-form-field>\n }\n </div>\n}\n", styles: ["@charset \"UTF-8\";.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-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-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-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-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-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-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!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}:host{display:block;max-width:100%}:host(.sd-has-label){padding-top:4px}:host(.sd-viewed){padding-top:0}::ng-deep .sd-loading-option{min-height:50px!important}::ng-deep .sd-loading-option .mat-pseudo-checkbox{display:none!important}::ng-deep .sd-loading-option .mdc-list-item__primary-text{width:100%;display:flex;justify-content:center;align-items:center}.sd-trigger-text{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host ::ng-deep .mat-mdc-select-value{max-width:100%;overflow:hidden;width:0;min-width:100%}:host ::ng-deep .sd-selected .mat-mdc-select-arrow{display:none}:host ::ng-deep .mat-mdc-select-arrow{display:none!important}:host ::ng-deep .custom-arrow{pointer-events:none;position:absolute;right:1rem;top:50%;transform:translateY(-50%);display:flex;align-items:center}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field mat-select.mat-mdc-select-disabled .mat-mdc-select-value{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}::ng-deep .sd-select-panel .mat-mdc-option.sd-empty .mat-pseudo-checkbox{display:none}::ng-deep .sd-select-panel .mat-mdc-option{min-height:36px!important;padding:8px 12px!important}::ng-deep .sd-select-panel .c-filter-input-container{position:sticky;top:0;background-color:#fff;box-shadow:0 1px #f2f2f2;padding:8px;margin-bottom:8px;z-index:1000}::ng-deep .sd-select-panel .c-filter-input-container .filter-input-wrapper{display:flex;align-items:center;padding:4px 8px;border:1px solid var(--sd-black200);border-radius:4px;background-color:#fff}::ng-deep .sd-select-panel .c-filter-input-container .filter-input-wrapper .mat-icon{color:#dadada}::ng-deep .sd-select-panel .c-filter-input-container .filter-input-wrapper .c-search-input{background-color:#fff;border:none;outline:none;flex:1;padding:4px}::ng-deep .sd-select-panel .sd-select-footer-actions{position:sticky;bottom:0;z-index:1000;display:flex;flex-direction:column;gap:4px;border-top:1px solid #f2f2f2;background-color:#fff}::ng-deep .sd-select-panel .sd-select-all-row{display:flex;align-items:center;justify-content:flex-start;min-height:36px;padding:8px 12px;cursor:pointer;-webkit-user-select:none;user-select:none;border-bottom:1px solid #f2f2f2;background-color:#fff}::ng-deep .sd-select-panel .sd-select-all-row:hover,::ng-deep .sd-select-panel .sd-select-all-row:focus-visible{background-color:#0000000a;outline:none}::ng-deep .sd-select-panel .sd-select-all-row .mdc-list-item__primary-text{font-size:14px;white-space:normal}::ng-deep .sd-multiline-tooltip{white-space:pre-line}::ng-deep .mat-mdc-select-panel.sd-select-panel{padding:0}::ng-deep .mat-mdc-select-panel.sd-select-panel .mat-mdc-option.mdc-list-item--disabled.sd-empty .mdc-list-item__primary-text{opacity:.8;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:16px}::ng-deep .sd-select-panel .mat-pseudo-checkbox-minimal{transform:scale(.7);transform-origin:center right}::ng-deep .sd-select-panel.sd-multiple .mat-pseudo-checkbox{transform:scale(.75);margin-right:8px!important}::ng-deep .sd-select-panel.sd-multiple .mdc-list-item__primary-text{font-size:14px;white-space:normal}::ng-deep .mat-mdc-select-panel.sd-select-panel{max-width:90vw!important}::ng-deep .mat-mdc-select-panel.sd-select-panel .mat-mdc-option .mdc-list-item__primary-text{white-space:normal;word-break:break-word;line-height:1.4}:host(.sd-bare){display:inline-flex;align-items:center}: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 mat-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(.sd-bare) ::ng-deep .mat-mdc-form-field{width:auto}:host(.sd-bare) ::ng-deep .mat-mdc-text-field-wrapper{padding:0;background:transparent}:host(.sd-bare) ::ng-deep .mat-mdc-form-field-flex{padding:0;align-items:center}:host(.sd-bare) ::ng-deep .mdc-notched-outline{display:none}:host(.sd-bare) ::ng-deep .mat-mdc-form-field-subscript-wrapper{display:none}:host(.sd-bare) ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}:host(.sd-bare) ::ng-deep .mat-mdc-select-arrow-wrapper{display:none}\n"], dependencies: [{ 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])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[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: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i6.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i6.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i6.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: MatPseudoCheckbox, selector: "mat-pseudo-checkbox", inputs: ["state", "disabled", "appearance"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i7.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 });
|
|
979
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdSelect, isStandalone: true, selector: "sd-select", 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 }, cacheChecksum: { classPropertyName: "cacheChecksum", publicName: "cacheChecksum", isSignal: true, isRequired: false, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, minWidthPanel: { classPropertyName: "minWidthPanel", publicName: "minWidthPanel", 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 }, 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 }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showSelectAll: { classPropertyName: "showSelectAll", publicName: "showSelectAll", 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 }, floatLabel: { classPropertyName: "floatLabel", publicName: "floatLabel", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", 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" }, host: { properties: { "class.sd-bare": "isInline()", "class.sd-viewed": "isViewed() || isInline()", "class.sd-has-label": "!!label()" } }, queries: [{ propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }, { propertyName: "sdSelectedTemplate", first: true, predicate: ["sdSelected"], 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: "footerActions", predicate: SdSelectFooterActionDirective, isSignal: true }, { propertyName: "dataStateTemplate", first: true, predicate: SdDataStateTemplateDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "matInputRef", first: true, predicate: MatInput, descendants: true, isSignal: true }, { propertyName: "selectRef", first: true, predicate: ["select"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _selectedItems = selectedItems();\n@let _tooltip = tooltip();\n@let _label = label();\n@let _appearance = appearance();\n@let _hideInlineError = hideInlineError();\n@let _errorMessage = errorMessage();\n@let _helperText = helperText();\n@let _multiple = multiple();\n@let _required = required();\n@let _normalizedValue = $any(normalizedValue());\n@let _focused = $any(focused());\n@let _isInline = isInline();\n@let _bare = _isInline;\n@let _hasValue = _multiple ? !!_normalizedValue?.length : _normalizedValue !== undefined && _normalizedValue !== null;\n@let _display = display();\n@let _size = size();\n@let _floatLabel = floatLabel();\n@let _valueField = valueField();\n@let _displayField = displayField();\n@let _autoId = autoId();\n@let _loading = loading();\n@let _readState = readState();\n@let _hideReadError = hideReadError();\n\n<ng-template #selectionTooltip>\n <div class=\"sd-select-tooltip\">{{ _tooltip }}</div>\n</ng-template>\n\n@if (isViewed()) {\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"_normalizedValue\"\n [display]=\"_display\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\"\n [selectedItems]=\"_selectedItems\">\n </sd-view>\n} @else {\n @if (_isInline) {\n <!-- why: inline \u2014 sd-view text l\u00E0 \"m\u1EB7t\" + trigger; editor v\u1EABn render b\u00EAn d\u01B0\u1EDBi (chrome \u1EA9n qua\n .sd-inline-editor) \u0111\u1EC3 m\u1EDF panel. Text gi\u1EEF nguy\u00EAn, ch\u1EC9 \u0111\u1ED5i khi commit gi\u00E1 tr\u1ECB m\u1EDBi. -->\n <span\n class=\"sd-inline-view\"\n [sdTooltip]=\"_multiple && _tooltip ? selectionTooltip : ''\"\n sdTooltipPosition=\"top\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"enterInlineEdit()\"\n (keydown.enter)=\"enterInlineEdit()\">\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"_normalizedValue\"\n [display]=\"_display\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\"\n [selectedItems]=\"_selectedItems\">\n </sd-view>\n\n <!-- why: clear-\u00D7 ch\u1EC9 hi\u1EC7n khi hover (CSS), \u0111\u1EB7t CU\u1ED0I face + clear($event) stopPropagation \u2192\n xo\u00E1 gi\u00E1 tr\u1ECB m\u00E0 KH\u00D4NG m\u1EDF panel; tr\u00E1nh bug c\u0169 (\u00D7 s\u00E1t trigger b\u1ECB b\u1EA5m nh\u1EA7m l\u00FAc \u0111\u00F3ng panel). -->\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 <mat-icon>close</mat-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 <div\n class=\"d-flex align-items-center\" role=\"presentation\"\n [class.sd-inline-editor]=\"_isInline\"\n [class.c-focused]=\"_focused\"\n [class.c-disabled]=\"formControl.disabled\"\n (click)=\"onClick()\"\n (mouseenter)=\"updatePanelWidth()\"\n (focusin)=\"updatePanelWidth()\">\n @if (_multiple) {\n <mat-form-field\n [sdTooltip]=\"_tooltip ? selectionTooltip : ''\"\n sdTooltipPosition=\"top\"\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [appearance]=\"_appearance!\"\n [floatLabel]=\"_floatLabel\">\n @if (_appearance && _label) {\n <mat-label style=\"display: inline-block\">\n <div style=\"display: flex; align-items: center; gap: 4px\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <mat-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\">info_outline</mat-icon>\n }\n </div>\n </mat-label>\n }\n\n <mat-select\n #select\n multiple\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder() || _label || ''\"\n (selectionChange)=\"onSelectionChange($event)\"\n disableOptionCentering=\"true\"\n [panelWidth]=\"calculatedPanelWidth()\"\n [panelClass]=\"['sd-select-panel', 'sd-multiple']\"\n [class.sd-selected]=\"!_required && _normalizedValue?.length\"\n [required]=\"_required\"\n (openedChange)=\"onOpenedChange($event)\"\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 <mat-select-trigger>\n @if (sdSelectedTemplate(); as _selTpl) {\n <ng-container\n *ngTemplateOutlet=\"_selTpl; context: { $implicit: _selectedItems, item: _selectedItems, items: _selectedItems, display: _display, multiple: true }\">\n </ng-container>\n } @else {\n <div class=\"sd-trigger-text\">\n {{ _display }}\n </div>\n }\n </mat-select-trigger>\n\n @if (filtered()) {\n <div class=\"c-filter-input-container\">\n <div class=\"filter-input-wrapper\">\n <mat-icon>search</mat-icon>\n <input\n [formControl]=\"inputControl\"\n [attr.aria-label]=\"placeholder() || _label\"\n matInput\n autocomplete=\"off\"\n class=\"c-search-input\"\n (keydown)=\"focusReadRetry($event); $event.stopPropagation()\" />\n </div>\n </div>\n }\n\n <!-- why: row \"T\u1EA5t c\u1EA3\" KH\u00D4NG ph\u1EA3i mat-option th\u1EADt \u2014 n\u1EBFu l\u00E0 option, gi\u00E1 tr\u1ECB c\u1EE7a n\u00F3 l\u1ECDt v\u00E0o\n formControl.value v\u00E0 keyboard navigation c\u1EE7a mat-select. Nh\u01B0ng n\u00F3 ph\u1EA3i TR\u00D4NG y h\u1EC7t m\u1ED9t\n option: d\u00F9ng ch\u00EDnh <mat-pseudo-checkbox> + .mdc-list-item__primary-text m\u00E0 mat-option\n render, n\u00EAn \u0103n c\u00F9ng scale/margin (rule .sd-multiple) v\u00E0 c\u00F9ng m\u00E0u theme (panel mang\n class mat-primary) \u2014 mat-checkbox MDC th\u1EADt th\u00EC l\u1EC7ch c\u1ED9t v\u00E0 \u0103n accent (xanh l\u00E1).\n V\u00EC pseudo-checkbox l\u00E0 decorative + aria-hidden, ch\u00EDnh div mang role/aria/keyboard. -->\n @if (selectAllVisible()) {\n @let _selectAllState = selectAllState();\n <div\n class=\"sd-select-all-row\"\n role=\"checkbox\"\n tabindex=\"0\"\n [attr.aria-checked]=\"_selectAllState === 'indeterminate' ? 'mixed' : _selectAllState === 'checked'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-select-all' : null\"\n (click)=\"toggleSelectAll()\"\n (keydown.enter)=\"toggleSelectAll(); $event.preventDefault()\"\n (keydown.space)=\"toggleSelectAll(); $event.preventDefault()\"\n (keydown)=\"$event.stopPropagation()\">\n <mat-pseudo-checkbox class=\"mat-mdc-option-pseudo-checkbox\" [state]=\"_selectAllState\" aria-hidden=\"true\"></mat-pseudo-checkbox>\n <span class=\"mdc-list-item__primary-text\">{{ selectAllLabel() }}</span>\n </div>\n }\n\n @if (!_loading && _readState.status === 'error') {\n <!-- why: MatSelect query c\u1EA7n option khai b\u00E1o tr\u1EF1c ti\u1EBFp, kh\u00F4ng n\u1EB1m trong template outlet ngo\u00E0i control. -->\n <mat-option disabled class=\"sd-read-state-anchor\" aria-hidden=\"true\"></mat-option>\n }\n @let _filteredItems = filteredItems();\n @if (_filteredItems) {\n @if (!_filteredItems.length && !_loading && _readState.status !== 'error') {\n <mat-option class=\"sd-empty\" disabled>\n <img class=\"sd-image-data-empty\" alt=\"empty-image\" style=\"width: 95px\" />\n </mat-option>\n } @else {\n @let iDefTpl = itemDef()?.templateRef;\n @if (_valueField && _displayField) {\n @for (item of _filteredItems; track itemValue(item)) {\n <mat-option [value]=\"itemValue(item)\" [disabled]=\"itemDisabled(item)\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ itemDisplay(item) }}\n }\n </div>\n </mat-option>\n }\n } @else if (!_valueField && !_displayField) {\n @for (item of _filteredItems; track item) {\n <mat-option [value]=\"item\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ item }}\n }\n </div>\n </mat-option>\n }\n }\n }\n }\n\n <ng-container [ngTemplateOutlet]=\"readRegion\"></ng-container>\n\n @if (_loading) {\n <mat-option disabled class=\"sd-loading-option\">\n <mat-spinner diameter=\"24\"></mat-spinner>\n </mat-option>\n }\n\n @let _visibleFooterActions = visibleFooterActions();\n @if (_visibleFooterActions.length) {\n <div class=\"sd-select-footer-actions\">\n @for (action of _visibleFooterActions; track action) {\n <ng-container *ngTemplateOutlet=\"action.templateRef; context: footerActionContext()\"> </ng-container>\n }\n </div>\n }\n </mat-select>\n\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\"> error </mat-icon>\n }\n\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n\n @if (_normalizedValue?.length && !_required && !formControl.disabled && !_bare) {\n <button type=\"button\" class=\"sd-clear-btn\" matSuffix (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <mat-icon>close</mat-icon>\n </button>\n } @else {\n <mat-icon class=\"cursor-pointer sd-suffix-icon\" matSuffix>keyboard_arrow_down</mat-icon>\n }\n </mat-form-field>\n } @else {\n <mat-form-field\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [appearance]=\"_appearance!\"\n [floatLabel]=\"_floatLabel\">\n @if (_appearance && _label) {\n <mat-label style=\"display: inline-block\">\n <div style=\"display: flex; align-items: center; gap: 4px\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <mat-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\">info_outline</mat-icon>\n }\n </div>\n </mat-label>\n }\n\n <mat-select\n #select\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder() || _label || ''\"\n (selectionChange)=\"onSelectionChange($event)\"\n disableOptionCentering=\"true\"\n [panelWidth]=\"calculatedPanelWidth()\"\n [panelClass]=\"'sd-select-panel'\"\n [class.sd-selected]=\"!_required && _normalizedValue !== undefined && _normalizedValue !== null\"\n [required]=\"_required\"\n (openedChange)=\"onOpenedChange($event)\"\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 matTooltipClass=\"sd-multiline-tooltip\"\n [matTooltipDisabled]=\"!formControl.disabled || !_normalizedValue?.length\"\n [matTooltip]=\"_tooltip || ''\">\n <mat-select-trigger>\n @if (sdSelectedTemplate(); as _selTpl) {\n <ng-container\n *ngTemplateOutlet=\"_selTpl; context: { $implicit: _selectedItems[0], item: _selectedItems[0], items: _selectedItems, display: _display, multiple: false }\">\n </ng-container>\n } @else {\n {{ _display }}\n }\n </mat-select-trigger>\n\n @if (filtered()) {\n <div class=\"c-filter-input-container\">\n <div class=\"filter-input-wrapper\">\n <mat-icon>search</mat-icon>\n <input\n [formControl]=\"inputControl\"\n [attr.aria-label]=\"placeholder() || _label\"\n matInput\n autocomplete=\"off\"\n class=\"c-search-input\"\n (keydown)=\"focusReadRetry($event); $event.stopPropagation()\" />\n </div>\n </div>\n }\n\n @if (!_loading && _readState.status === 'error') {\n <mat-option disabled class=\"sd-read-state-anchor\" aria-hidden=\"true\"></mat-option>\n }\n @let _filteredItems = filteredItems();\n @if (_filteredItems) {\n @if (!_filteredItems.length && !_loading && _readState.status !== 'error') {\n <mat-option class=\"sd-empty\" disabled>\n <img class=\"sd-image-data-empty\" alt=\"empty-image\" style=\"width: 95px\" />\n </mat-option>\n } @else {\n @let iDefTpl = itemDef()?.templateRef;\n\n @if (_valueField && _displayField) {\n @for (item of _filteredItems; track itemValue(item)) {\n <mat-option [value]=\"itemValue(item)\" [disabled]=\"itemDisabled(item)\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ itemDisplay(item) }}\n }\n </div>\n </mat-option>\n }\n } @else if (!_valueField && !_displayField) {\n @for (item of _filteredItems; track item) {\n <mat-option [value]=\"item\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ item }}\n }\n </div>\n </mat-option>\n }\n }\n }\n }\n\n <ng-container [ngTemplateOutlet]=\"readRegion\"></ng-container>\n\n @if (_loading) {\n <mat-option disabled class=\"sd-loading-option\">\n <mat-spinner diameter=\"24\"></mat-spinner>\n </mat-option>\n }\n\n @let _visibleFooterActions = visibleFooterActions();\n @if (_visibleFooterActions.length) {\n <div class=\"sd-select-footer-actions\">\n @for (action of _visibleFooterActions; track action) {\n <ng-container *ngTemplateOutlet=\"action.templateRef; context: footerActionContext()\"> </ng-container>\n }\n </div>\n }\n </mat-select>\n\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\"> error </mat-icon>\n }\n\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n\n @if (_normalizedValue !== undefined && _normalizedValue !== null && !_required && !formControl.disabled && !_bare) {\n <button type=\"button\" class=\"sd-clear-btn\" matSuffix (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <mat-icon>close</mat-icon>\n </button>\n } @else {\n <mat-icon class=\"cursor-pointer sd-suffix-icon\" matSuffix>keyboard_arrow_down</mat-icon>\n }\n </mat-form-field>\n }\n </div>\n}\n\n<ng-template #readRegion>\n <!-- why: VALUE/SEARCH gi\u1EEF l\u1ED7i \u0111\u1ED9c l\u1EADp; trong l\u00FAc k\u00EAnh kh\u00E1c \u0111ang \u0111\u1ECDc ch\u1EC9 hi\u1EC3n th\u1ECB loading. -->\n @if (!_loading && _readState.status === 'error') {\n <!-- why: n\u00FAt retry n\u1EB1m ngo\u00E0i mat-option \u0111\u1EC3 kh\u00F4ng tr\u1EDF th\u00E0nh m\u1ED9t l\u1EF1a ch\u1ECDn/form value. -->\n @if (!_hideReadError) {\n <div class=\"sd-read-state-region\" role=\"presentation\" (mousedown)=\"$event.preventDefault()\" (click)=\"$event.stopPropagation()\" (keydown)=\"onReadRegionKeydown($event)\">\n <sd-data-state state=\"error\" compact retryable (sdRetry)=\"retryRead()\">\n @if (dataStateTemplate(); as custom) {\n <ng-template sdDataStateTemplate let-current let-retry=\"retry\" let-action=\"action\">\n <ng-container [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{ $implicit: current, state: current, retry: retry, action: action }\"></ng-container>\n </ng-template>\n }\n </sd-data-state>\n </div>\n }\n }\n</ng-template>\n", styles: ["@charset \"UTF-8\";.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-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-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-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-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-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-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!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}:host{display:block;max-width:100%}:host(.sd-has-label){padding-top:4px}:host(.sd-viewed){padding-top:0}::ng-deep .sd-loading-option{min-height:50px!important}::ng-deep .sd-loading-option .mat-pseudo-checkbox{display:none!important}::ng-deep .sd-loading-option .mdc-list-item__primary-text{width:100%;display:flex;justify-content:center;align-items:center}.sd-trigger-text{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host ::ng-deep .mat-mdc-select-value{max-width:100%;overflow:hidden;width:0;min-width:100%}:host ::ng-deep .sd-selected .mat-mdc-select-arrow{display:none}:host ::ng-deep .mat-mdc-select-arrow{display:none!important}:host ::ng-deep .custom-arrow{pointer-events:none;position:absolute;right:1rem;top:50%;transform:translateY(-50%);display:flex;align-items:center}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field mat-select.mat-mdc-select-disabled .mat-mdc-select-value{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}::ng-deep .sd-select-panel .mat-mdc-option.sd-empty .mat-pseudo-checkbox{display:none}::ng-deep .sd-select-panel .mat-mdc-option{min-height:36px!important;padding:8px 12px!important}::ng-deep .sd-select-panel .c-filter-input-container{position:sticky;top:0;background-color:#fff;box-shadow:0 1px #f2f2f2;padding:8px;margin-bottom:8px;z-index:1000}::ng-deep .sd-select-panel .c-filter-input-container .filter-input-wrapper{display:flex;align-items:center;padding:4px 8px;border:1px solid var(--sd-black200);border-radius:4px;background-color:#fff}::ng-deep .sd-select-panel .c-filter-input-container .filter-input-wrapper .mat-icon{color:#dadada}::ng-deep .sd-select-panel .c-filter-input-container .filter-input-wrapper .c-search-input{min-width:0;width:100%;background-color:#fff;border:none;outline:none;flex:1;padding:4px}::ng-deep .sd-select-panel .sd-select-footer-actions{position:sticky;bottom:0;z-index:1000;display:flex;flex-direction:column;gap:4px;border-top:1px solid #f2f2f2;background-color:#fff}::ng-deep .sd-select-panel .sd-select-all-row{display:flex;align-items:center;justify-content:flex-start;min-height:36px;padding:8px 12px;cursor:pointer;-webkit-user-select:none;user-select:none;border-bottom:1px solid #f2f2f2;background-color:#fff}::ng-deep .sd-select-panel .sd-select-all-row:hover,::ng-deep .sd-select-panel .sd-select-all-row:focus-visible{background-color:#0000000a;outline:none}::ng-deep .sd-select-panel .sd-select-all-row .mdc-list-item__primary-text{font-size:14px;white-space:normal}::ng-deep .sd-multiline-tooltip{white-space:pre-line}::ng-deep .mat-mdc-select-panel.sd-select-panel{padding:0}::ng-deep .mat-mdc-select-panel.sd-select-panel .mat-mdc-option.mdc-list-item--disabled.sd-empty .mdc-list-item__primary-text{opacity:.8;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:16px}::ng-deep .sd-select-panel .mat-pseudo-checkbox-minimal{transform:scale(.7);transform-origin:center right}::ng-deep .sd-select-panel.sd-multiple .mat-pseudo-checkbox{transform:scale(.75);margin-right:8px!important}::ng-deep .sd-select-panel.sd-multiple .mdc-list-item__primary-text{font-size:14px;white-space:normal}::ng-deep .mat-mdc-select-panel.sd-select-panel{max-width:90vw!important}::ng-deep .mat-mdc-select-panel.sd-select-panel .mat-mdc-option .mdc-list-item__primary-text{white-space:normal;word-break:break-word;line-height:1.4}:host(.sd-bare){display:inline-flex;align-items:center}: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 mat-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(.sd-bare) ::ng-deep .mat-mdc-form-field{width:auto}:host(.sd-bare) ::ng-deep .mat-mdc-text-field-wrapper{padding:0;background:transparent}:host(.sd-bare) ::ng-deep .mat-mdc-form-field-flex{padding:0;align-items:center}:host(.sd-bare) ::ng-deep .mdc-notched-outline{display:none}:host(.sd-bare) ::ng-deep .mat-mdc-form-field-subscript-wrapper{display:none}:host(.sd-bare) ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}:host(.sd-bare) ::ng-deep .mat-mdc-select-arrow-wrapper{display:none}.sd-select-tooltip{white-space:pre-line}::ng-deep .sd-select-panel .sd-read-state-anchor{display:none}::ng-deep .sd-select-panel .sd-read-state-region{container:sd-read-panel/inline-size;box-sizing:border-box;width:100%;min-width:0;text-align:center}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact{display:flex;flex-direction:column;align-items:center;min-height:120px;padding:20px 16px;text-align:center}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__symbol{margin:0 0 8px}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__message{max-width:100%}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__actions{justify-content:center}@container sd-read-panel (max-width: 220px){::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact{padding:8px 10px}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__symbol{width:24px;height:24px;margin-bottom:4px}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__icon{width:18px;height:18px;font-size:18px}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__message{line-height:18px}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__actions{margin-top:6px}}\n"], dependencies: [{ 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: "directive", type: SdTooltipDirective, selector: "[sdTooltip]", inputs: ["sdTooltip", "sdTooltipPosition", "sdTooltipDelay", "sdTooltipColor"] }, { 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])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[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: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i6.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i6.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i6.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: MatPseudoCheckbox, selector: "mat-pseudo-checkbox", inputs: ["state", "disabled", "appearance"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i7.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 });
|
|
760
980
|
}
|
|
761
981
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdSelect, decorators: [{
|
|
762
982
|
type: Component,
|
|
763
983
|
args: [{ selector: 'sd-select', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, host: { '[class.sd-bare]': 'isInline()', '[class.sd-viewed]': 'isViewed() || isInline()', '[class.sd-has-label]': '!!label()' }, imports: [
|
|
984
|
+
SdDataState,
|
|
985
|
+
SdDataStateTemplateDirective,
|
|
986
|
+
SdTooltipDirective,
|
|
764
987
|
CommonModule,
|
|
765
988
|
FormsModule,
|
|
766
989
|
ReactiveFormsModule,
|
|
@@ -774,7 +997,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
774
997
|
SdLabel,
|
|
775
998
|
SdView,
|
|
776
999
|
SdSelectFooterActionDirective,
|
|
777
|
-
], template: "@let _label = label();\n@let _appearance = appearance();\n@let _hideInlineError = hideInlineError();\n@let _errorMessage = errorMessage();\n@let _helperText = helperText();\n@let _multiple = multiple();\n@let _required = required();\n@let _normalizedValue = $any(normalizedValue());\n@let _focused = $any(focused());\n@let _isInline = isInline();\n@let _bare = _isInline;\n@let _hasValue = _multiple ? !!_normalizedValue?.length : _normalizedValue !== undefined && _normalizedValue !== null;\n@let _display = display();\n@let _size = size();\n@let _floatLabel = floatLabel();\n@let _valueField = valueField();\n@let _displayField = displayField();\n@let _autoId = autoId();\n\n@if (isViewed()) {\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"_normalizedValue\"\n [display]=\"_display\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\"\n [selectedItems]=\"selectedItems()\">\n </sd-view>\n} @else {\n @if (_isInline) {\n <!-- why: inline \u2014 sd-view text l\u00E0 \"m\u1EB7t\" + trigger; editor v\u1EABn render b\u00EAn d\u01B0\u1EDBi (chrome \u1EA9n qua\n .sd-inline-editor) \u0111\u1EC3 m\u1EDF panel. Text gi\u1EEF nguy\u00EAn, ch\u1EC9 \u0111\u1ED5i khi commit gi\u00E1 tr\u1ECB m\u1EDBi. -->\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]=\"_normalizedValue\"\n [display]=\"_display\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\"\n [selectedItems]=\"selectedItems()\">\n </sd-view>\n\n <!-- why: clear-\u00D7 ch\u1EC9 hi\u1EC7n khi hover (CSS), \u0111\u1EB7t CU\u1ED0I face + clear($event) stopPropagation \u2192\n xo\u00E1 gi\u00E1 tr\u1ECB m\u00E0 KH\u00D4NG m\u1EDF panel; tr\u00E1nh bug c\u0169 (\u00D7 s\u00E1t trigger b\u1ECB b\u1EA5m nh\u1EA7m l\u00FAc \u0111\u00F3ng panel). -->\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 <mat-icon>close</mat-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 <div\n class=\"d-flex align-items-center\"\n [class.sd-inline-editor]=\"_isInline\"\n [class.c-focused]=\"_focused\"\n [class.c-disabled]=\"formControl.disabled\"\n (click)=\"onClick()\"\n (mouseenter)=\"updatePanelWidth()\"\n (focusin)=\"updatePanelWidth()\"\n aria-hidden=\"true\">\n @if (_multiple) {\n <mat-form-field\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [appearance]=\"_appearance!\"\n [floatLabel]=\"_floatLabel\">\n @if (_appearance && _label) {\n <mat-label style=\"display: inline-block\">\n <div style=\"display: flex; align-items: center; gap: 4px\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <mat-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\">info_outline</mat-icon>\n }\n </div>\n </mat-label>\n }\n\n <mat-select\n #select\n multiple\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder() || _label || ''\"\n (selectionChange)=\"onSelectionChange($event)\"\n disableOptionCentering=\"true\"\n [panelWidth]=\"calculatedPanelWidth()\"\n [panelClass]=\"['sd-select-panel', 'sd-multiple']\"\n [class.sd-selected]=\"!_required && _normalizedValue?.length\"\n [required]=\"_required\"\n (openedChange)=\"onOpenedChange($event)\"\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 matTooltipClass=\"sd-multiline-tooltip\"\n [matTooltipDisabled]=\"!formControl.disabled || !_normalizedValue?.length\"\n [matTooltip]=\"tooltip() || ''\">\n <mat-select-trigger>\n @if (sdSelectedTemplate(); as _selTpl) {\n <ng-container\n *ngTemplateOutlet=\"_selTpl; context: { $implicit: selectedItems(), item: selectedItems(), items: selectedItems(), display: _display, multiple: true }\">\n </ng-container>\n } @else {\n <div class=\"sd-trigger-text\" [matTooltip]=\"_display || ''\" matTooltipPosition=\"above\">\n {{ _display }}\n </div>\n }\n </mat-select-trigger>\n\n @if (filtered()) {\n <div class=\"c-filter-input-container\">\n <div class=\"filter-input-wrapper\">\n <mat-icon>search</mat-icon>\n <input\n [formControl]=\"inputControl\"\n aria-hidden=\"true\"\n matInput\n autocomplete=\"off\"\n class=\"c-search-input\"\n (keydown)=\"$event.stopPropagation()\" />\n </div>\n </div>\n }\n\n <!-- why: row \"T\u1EA5t c\u1EA3\" KH\u00D4NG ph\u1EA3i mat-option th\u1EADt \u2014 n\u1EBFu l\u00E0 option, gi\u00E1 tr\u1ECB c\u1EE7a n\u00F3 l\u1ECDt v\u00E0o\n formControl.value v\u00E0 keyboard navigation c\u1EE7a mat-select. Nh\u01B0ng n\u00F3 ph\u1EA3i TR\u00D4NG y h\u1EC7t m\u1ED9t\n option: d\u00F9ng ch\u00EDnh <mat-pseudo-checkbox> + .mdc-list-item__primary-text m\u00E0 mat-option\n render, n\u00EAn \u0103n c\u00F9ng scale/margin (rule .sd-multiple) v\u00E0 c\u00F9ng m\u00E0u theme (panel mang\n class mat-primary) \u2014 mat-checkbox MDC th\u1EADt th\u00EC l\u1EC7ch c\u1ED9t v\u00E0 \u0103n accent (xanh l\u00E1).\n V\u00EC pseudo-checkbox l\u00E0 decorative + aria-hidden, ch\u00EDnh div mang role/aria/keyboard. -->\n @if (selectAllVisible()) {\n @let _selectAllState = selectAllState();\n <div\n class=\"sd-select-all-row\"\n role=\"checkbox\"\n tabindex=\"0\"\n [attr.aria-checked]=\"_selectAllState === 'indeterminate' ? 'mixed' : _selectAllState === 'checked'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-select-all' : null\"\n (click)=\"toggleSelectAll()\"\n (keydown.enter)=\"toggleSelectAll(); $event.preventDefault()\"\n (keydown.space)=\"toggleSelectAll(); $event.preventDefault()\"\n (keydown)=\"$event.stopPropagation()\">\n <mat-pseudo-checkbox class=\"mat-mdc-option-pseudo-checkbox\" [state]=\"_selectAllState\" aria-hidden=\"true\"></mat-pseudo-checkbox>\n <span class=\"mdc-list-item__primary-text\">{{ selectAllLabel() }}</span>\n </div>\n }\n\n @let _filteredItems = filteredItems();\n @if (_filteredItems) {\n @if (!_filteredItems.length && !loading()) {\n <mat-option class=\"sd-empty\" disabled>\n <img class=\"sd-image-data-empty\" alt=\"empty-image\" style=\"width: 95px\" />\n </mat-option>\n } @else {\n @let iDefTpl = itemDef()?.templateRef;\n @if (_valueField && _displayField) {\n @for (item of _filteredItems; track itemValue(item)) {\n <mat-option [value]=\"itemValue(item)\" [disabled]=\"itemDisabled(item)\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ itemDisplay(item) }}\n }\n </div>\n </mat-option>\n }\n } @else if (!_valueField && !_displayField) {\n @for (item of _filteredItems; track item) {\n <mat-option [value]=\"item\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ item }}\n }\n </div>\n </mat-option>\n }\n }\n }\n }\n\n @if (loading()) {\n <mat-option disabled class=\"sd-loading-option\">\n <mat-spinner diameter=\"24\"></mat-spinner>\n </mat-option>\n }\n\n @let _visibleFooterActions = visibleFooterActions();\n @if (_visibleFooterActions.length) {\n <div class=\"sd-select-footer-actions\">\n @for (action of _visibleFooterActions; track action) {\n <ng-container *ngTemplateOutlet=\"action.templateRef; context: footerActionContext()\"> </ng-container>\n }\n </div>\n }\n </mat-select>\n\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\"> error </mat-icon>\n }\n\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n\n @if (_normalizedValue?.length && !_required && !formControl.disabled && !_bare) {\n <button type=\"button\" class=\"sd-clear-btn\" matSuffix (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <mat-icon>close</mat-icon>\n </button>\n } @else {\n <mat-icon class=\"cursor-pointer sd-suffix-icon\" matSuffix>keyboard_arrow_down</mat-icon>\n }\n </mat-form-field>\n } @else {\n <mat-form-field\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [appearance]=\"_appearance!\"\n [floatLabel]=\"_floatLabel\">\n @if (_appearance && _label) {\n <mat-label style=\"display: inline-block\">\n <div style=\"display: flex; align-items: center; gap: 4px\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <mat-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\">info_outline</mat-icon>\n }\n </div>\n </mat-label>\n }\n\n <mat-select\n #select\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder() || _label || ''\"\n (selectionChange)=\"onSelectionChange($event)\"\n disableOptionCentering=\"true\"\n [panelWidth]=\"calculatedPanelWidth()\"\n [panelClass]=\"'sd-select-panel'\"\n [class.sd-selected]=\"!_required && _normalizedValue !== undefined && _normalizedValue !== null\"\n [required]=\"_required\"\n (openedChange)=\"onOpenedChange($event)\"\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 matTooltipClass=\"sd-multiline-tooltip\"\n [matTooltipDisabled]=\"!formControl.disabled || !_normalizedValue?.length\"\n [matTooltip]=\"tooltip() || ''\">\n <mat-select-trigger>\n @if (sdSelectedTemplate(); as _selTpl) {\n <ng-container\n *ngTemplateOutlet=\"_selTpl; context: { $implicit: selectedItems()[0], item: selectedItems()[0], items: selectedItems(), display: _display, multiple: false }\">\n </ng-container>\n } @else {\n {{ _display }}\n }\n </mat-select-trigger>\n\n @if (filtered()) {\n <div class=\"c-filter-input-container\">\n <div class=\"filter-input-wrapper\">\n <mat-icon>search</mat-icon>\n <input\n [formControl]=\"inputControl\"\n aria-hidden=\"true\"\n matInput\n autocomplete=\"off\"\n class=\"c-search-input\"\n (keydown)=\"$event.stopPropagation()\" />\n </div>\n </div>\n }\n\n @let _filteredItems = filteredItems();\n @if (_filteredItems) {\n @if (!_filteredItems.length && !loading()) {\n <mat-option class=\"sd-empty\" disabled>\n <img class=\"sd-image-data-empty\" alt=\"empty-image\" style=\"width: 95px\" />\n </mat-option>\n } @else {\n @let iDefTpl = itemDef()?.templateRef;\n\n @if (_valueField && _displayField) {\n @for (item of _filteredItems; track itemValue(item)) {\n <mat-option [value]=\"itemValue(item)\" [disabled]=\"itemDisabled(item)\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ itemDisplay(item) }}\n }\n </div>\n </mat-option>\n }\n } @else if (!_valueField && !_displayField) {\n @for (item of _filteredItems; track item) {\n <mat-option [value]=\"item\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ item }}\n }\n </div>\n </mat-option>\n }\n }\n }\n }\n\n @if (loading()) {\n <mat-option disabled class=\"sd-loading-option\">\n <mat-spinner diameter=\"24\"></mat-spinner>\n </mat-option>\n }\n\n @let _visibleFooterActions = visibleFooterActions();\n @if (_visibleFooterActions.length) {\n <div class=\"sd-select-footer-actions\">\n @for (action of _visibleFooterActions; track action) {\n <ng-container *ngTemplateOutlet=\"action.templateRef; context: footerActionContext()\"> </ng-container>\n }\n </div>\n }\n </mat-select>\n\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\"> error </mat-icon>\n }\n\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n\n @if (_normalizedValue !== undefined && _normalizedValue !== null && !_required && !formControl.disabled && !_bare) {\n <button type=\"button\" class=\"sd-clear-btn\" matSuffix (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <mat-icon>close</mat-icon>\n </button>\n } @else {\n <mat-icon class=\"cursor-pointer sd-suffix-icon\" matSuffix>keyboard_arrow_down</mat-icon>\n }\n </mat-form-field>\n }\n </div>\n}\n", styles: ["@charset \"UTF-8\";.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-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-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-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-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-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-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!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}:host{display:block;max-width:100%}:host(.sd-has-label){padding-top:4px}:host(.sd-viewed){padding-top:0}::ng-deep .sd-loading-option{min-height:50px!important}::ng-deep .sd-loading-option .mat-pseudo-checkbox{display:none!important}::ng-deep .sd-loading-option .mdc-list-item__primary-text{width:100%;display:flex;justify-content:center;align-items:center}.sd-trigger-text{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host ::ng-deep .mat-mdc-select-value{max-width:100%;overflow:hidden;width:0;min-width:100%}:host ::ng-deep .sd-selected .mat-mdc-select-arrow{display:none}:host ::ng-deep .mat-mdc-select-arrow{display:none!important}:host ::ng-deep .custom-arrow{pointer-events:none;position:absolute;right:1rem;top:50%;transform:translateY(-50%);display:flex;align-items:center}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field mat-select.mat-mdc-select-disabled .mat-mdc-select-value{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}::ng-deep .sd-select-panel .mat-mdc-option.sd-empty .mat-pseudo-checkbox{display:none}::ng-deep .sd-select-panel .mat-mdc-option{min-height:36px!important;padding:8px 12px!important}::ng-deep .sd-select-panel .c-filter-input-container{position:sticky;top:0;background-color:#fff;box-shadow:0 1px #f2f2f2;padding:8px;margin-bottom:8px;z-index:1000}::ng-deep .sd-select-panel .c-filter-input-container .filter-input-wrapper{display:flex;align-items:center;padding:4px 8px;border:1px solid var(--sd-black200);border-radius:4px;background-color:#fff}::ng-deep .sd-select-panel .c-filter-input-container .filter-input-wrapper .mat-icon{color:#dadada}::ng-deep .sd-select-panel .c-filter-input-container .filter-input-wrapper .c-search-input{background-color:#fff;border:none;outline:none;flex:1;padding:4px}::ng-deep .sd-select-panel .sd-select-footer-actions{position:sticky;bottom:0;z-index:1000;display:flex;flex-direction:column;gap:4px;border-top:1px solid #f2f2f2;background-color:#fff}::ng-deep .sd-select-panel .sd-select-all-row{display:flex;align-items:center;justify-content:flex-start;min-height:36px;padding:8px 12px;cursor:pointer;-webkit-user-select:none;user-select:none;border-bottom:1px solid #f2f2f2;background-color:#fff}::ng-deep .sd-select-panel .sd-select-all-row:hover,::ng-deep .sd-select-panel .sd-select-all-row:focus-visible{background-color:#0000000a;outline:none}::ng-deep .sd-select-panel .sd-select-all-row .mdc-list-item__primary-text{font-size:14px;white-space:normal}::ng-deep .sd-multiline-tooltip{white-space:pre-line}::ng-deep .mat-mdc-select-panel.sd-select-panel{padding:0}::ng-deep .mat-mdc-select-panel.sd-select-panel .mat-mdc-option.mdc-list-item--disabled.sd-empty .mdc-list-item__primary-text{opacity:.8;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:16px}::ng-deep .sd-select-panel .mat-pseudo-checkbox-minimal{transform:scale(.7);transform-origin:center right}::ng-deep .sd-select-panel.sd-multiple .mat-pseudo-checkbox{transform:scale(.75);margin-right:8px!important}::ng-deep .sd-select-panel.sd-multiple .mdc-list-item__primary-text{font-size:14px;white-space:normal}::ng-deep .mat-mdc-select-panel.sd-select-panel{max-width:90vw!important}::ng-deep .mat-mdc-select-panel.sd-select-panel .mat-mdc-option .mdc-list-item__primary-text{white-space:normal;word-break:break-word;line-height:1.4}:host(.sd-bare){display:inline-flex;align-items:center}: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 mat-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(.sd-bare) ::ng-deep .mat-mdc-form-field{width:auto}:host(.sd-bare) ::ng-deep .mat-mdc-text-field-wrapper{padding:0;background:transparent}:host(.sd-bare) ::ng-deep .mat-mdc-form-field-flex{padding:0;align-items:center}:host(.sd-bare) ::ng-deep .mdc-notched-outline{display:none}:host(.sd-bare) ::ng-deep .mat-mdc-form-field-subscript-wrapper{display:none}:host(.sd-bare) ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}:host(.sd-bare) ::ng-deep .mat-mdc-select-arrow-wrapper{display:none}\n"] }]
|
|
1000
|
+
], template: "@let _selectedItems = selectedItems();\n@let _tooltip = tooltip();\n@let _label = label();\n@let _appearance = appearance();\n@let _hideInlineError = hideInlineError();\n@let _errorMessage = errorMessage();\n@let _helperText = helperText();\n@let _multiple = multiple();\n@let _required = required();\n@let _normalizedValue = $any(normalizedValue());\n@let _focused = $any(focused());\n@let _isInline = isInline();\n@let _bare = _isInline;\n@let _hasValue = _multiple ? !!_normalizedValue?.length : _normalizedValue !== undefined && _normalizedValue !== null;\n@let _display = display();\n@let _size = size();\n@let _floatLabel = floatLabel();\n@let _valueField = valueField();\n@let _displayField = displayField();\n@let _autoId = autoId();\n@let _loading = loading();\n@let _readState = readState();\n@let _hideReadError = hideReadError();\n\n<ng-template #selectionTooltip>\n <div class=\"sd-select-tooltip\">{{ _tooltip }}</div>\n</ng-template>\n\n@if (isViewed()) {\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"_normalizedValue\"\n [display]=\"_display\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\"\n [selectedItems]=\"_selectedItems\">\n </sd-view>\n} @else {\n @if (_isInline) {\n <!-- why: inline \u2014 sd-view text l\u00E0 \"m\u1EB7t\" + trigger; editor v\u1EABn render b\u00EAn d\u01B0\u1EDBi (chrome \u1EA9n qua\n .sd-inline-editor) \u0111\u1EC3 m\u1EDF panel. Text gi\u1EEF nguy\u00EAn, ch\u1EC9 \u0111\u1ED5i khi commit gi\u00E1 tr\u1ECB m\u1EDBi. -->\n <span\n class=\"sd-inline-view\"\n [sdTooltip]=\"_multiple && _tooltip ? selectionTooltip : ''\"\n sdTooltipPosition=\"top\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"enterInlineEdit()\"\n (keydown.enter)=\"enterInlineEdit()\">\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"sdLabelTemplate()\"\n [value]=\"_normalizedValue\"\n [display]=\"_display\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"viewTemplate()\"\n [selectedItems]=\"_selectedItems\">\n </sd-view>\n\n <!-- why: clear-\u00D7 ch\u1EC9 hi\u1EC7n khi hover (CSS), \u0111\u1EB7t CU\u1ED0I face + clear($event) stopPropagation \u2192\n xo\u00E1 gi\u00E1 tr\u1ECB m\u00E0 KH\u00D4NG m\u1EDF panel; tr\u00E1nh bug c\u0169 (\u00D7 s\u00E1t trigger b\u1ECB b\u1EA5m nh\u1EA7m l\u00FAc \u0111\u00F3ng panel). -->\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 <mat-icon>close</mat-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 <div\n class=\"d-flex align-items-center\" role=\"presentation\"\n [class.sd-inline-editor]=\"_isInline\"\n [class.c-focused]=\"_focused\"\n [class.c-disabled]=\"formControl.disabled\"\n (click)=\"onClick()\"\n (mouseenter)=\"updatePanelWidth()\"\n (focusin)=\"updatePanelWidth()\">\n @if (_multiple) {\n <mat-form-field\n [sdTooltip]=\"_tooltip ? selectionTooltip : ''\"\n sdTooltipPosition=\"top\"\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [appearance]=\"_appearance!\"\n [floatLabel]=\"_floatLabel\">\n @if (_appearance && _label) {\n <mat-label style=\"display: inline-block\">\n <div style=\"display: flex; align-items: center; gap: 4px\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <mat-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\">info_outline</mat-icon>\n }\n </div>\n </mat-label>\n }\n\n <mat-select\n #select\n multiple\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder() || _label || ''\"\n (selectionChange)=\"onSelectionChange($event)\"\n disableOptionCentering=\"true\"\n [panelWidth]=\"calculatedPanelWidth()\"\n [panelClass]=\"['sd-select-panel', 'sd-multiple']\"\n [class.sd-selected]=\"!_required && _normalizedValue?.length\"\n [required]=\"_required\"\n (openedChange)=\"onOpenedChange($event)\"\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 <mat-select-trigger>\n @if (sdSelectedTemplate(); as _selTpl) {\n <ng-container\n *ngTemplateOutlet=\"_selTpl; context: { $implicit: _selectedItems, item: _selectedItems, items: _selectedItems, display: _display, multiple: true }\">\n </ng-container>\n } @else {\n <div class=\"sd-trigger-text\">\n {{ _display }}\n </div>\n }\n </mat-select-trigger>\n\n @if (filtered()) {\n <div class=\"c-filter-input-container\">\n <div class=\"filter-input-wrapper\">\n <mat-icon>search</mat-icon>\n <input\n [formControl]=\"inputControl\"\n [attr.aria-label]=\"placeholder() || _label\"\n matInput\n autocomplete=\"off\"\n class=\"c-search-input\"\n (keydown)=\"focusReadRetry($event); $event.stopPropagation()\" />\n </div>\n </div>\n }\n\n <!-- why: row \"T\u1EA5t c\u1EA3\" KH\u00D4NG ph\u1EA3i mat-option th\u1EADt \u2014 n\u1EBFu l\u00E0 option, gi\u00E1 tr\u1ECB c\u1EE7a n\u00F3 l\u1ECDt v\u00E0o\n formControl.value v\u00E0 keyboard navigation c\u1EE7a mat-select. Nh\u01B0ng n\u00F3 ph\u1EA3i TR\u00D4NG y h\u1EC7t m\u1ED9t\n option: d\u00F9ng ch\u00EDnh <mat-pseudo-checkbox> + .mdc-list-item__primary-text m\u00E0 mat-option\n render, n\u00EAn \u0103n c\u00F9ng scale/margin (rule .sd-multiple) v\u00E0 c\u00F9ng m\u00E0u theme (panel mang\n class mat-primary) \u2014 mat-checkbox MDC th\u1EADt th\u00EC l\u1EC7ch c\u1ED9t v\u00E0 \u0103n accent (xanh l\u00E1).\n V\u00EC pseudo-checkbox l\u00E0 decorative + aria-hidden, ch\u00EDnh div mang role/aria/keyboard. -->\n @if (selectAllVisible()) {\n @let _selectAllState = selectAllState();\n <div\n class=\"sd-select-all-row\"\n role=\"checkbox\"\n tabindex=\"0\"\n [attr.aria-checked]=\"_selectAllState === 'indeterminate' ? 'mixed' : _selectAllState === 'checked'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-select-all' : null\"\n (click)=\"toggleSelectAll()\"\n (keydown.enter)=\"toggleSelectAll(); $event.preventDefault()\"\n (keydown.space)=\"toggleSelectAll(); $event.preventDefault()\"\n (keydown)=\"$event.stopPropagation()\">\n <mat-pseudo-checkbox class=\"mat-mdc-option-pseudo-checkbox\" [state]=\"_selectAllState\" aria-hidden=\"true\"></mat-pseudo-checkbox>\n <span class=\"mdc-list-item__primary-text\">{{ selectAllLabel() }}</span>\n </div>\n }\n\n @if (!_loading && _readState.status === 'error') {\n <!-- why: MatSelect query c\u1EA7n option khai b\u00E1o tr\u1EF1c ti\u1EBFp, kh\u00F4ng n\u1EB1m trong template outlet ngo\u00E0i control. -->\n <mat-option disabled class=\"sd-read-state-anchor\" aria-hidden=\"true\"></mat-option>\n }\n @let _filteredItems = filteredItems();\n @if (_filteredItems) {\n @if (!_filteredItems.length && !_loading && _readState.status !== 'error') {\n <mat-option class=\"sd-empty\" disabled>\n <img class=\"sd-image-data-empty\" alt=\"empty-image\" style=\"width: 95px\" />\n </mat-option>\n } @else {\n @let iDefTpl = itemDef()?.templateRef;\n @if (_valueField && _displayField) {\n @for (item of _filteredItems; track itemValue(item)) {\n <mat-option [value]=\"itemValue(item)\" [disabled]=\"itemDisabled(item)\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ itemDisplay(item) }}\n }\n </div>\n </mat-option>\n }\n } @else if (!_valueField && !_displayField) {\n @for (item of _filteredItems; track item) {\n <mat-option [value]=\"item\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ item }}\n }\n </div>\n </mat-option>\n }\n }\n }\n }\n\n <ng-container [ngTemplateOutlet]=\"readRegion\"></ng-container>\n\n @if (_loading) {\n <mat-option disabled class=\"sd-loading-option\">\n <mat-spinner diameter=\"24\"></mat-spinner>\n </mat-option>\n }\n\n @let _visibleFooterActions = visibleFooterActions();\n @if (_visibleFooterActions.length) {\n <div class=\"sd-select-footer-actions\">\n @for (action of _visibleFooterActions; track action) {\n <ng-container *ngTemplateOutlet=\"action.templateRef; context: footerActionContext()\"> </ng-container>\n }\n </div>\n }\n </mat-select>\n\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\"> error </mat-icon>\n }\n\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n\n @if (_normalizedValue?.length && !_required && !formControl.disabled && !_bare) {\n <button type=\"button\" class=\"sd-clear-btn\" matSuffix (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <mat-icon>close</mat-icon>\n </button>\n } @else {\n <mat-icon class=\"cursor-pointer sd-suffix-icon\" matSuffix>keyboard_arrow_down</mat-icon>\n }\n </mat-form-field>\n } @else {\n <mat-form-field\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [appearance]=\"_appearance!\"\n [floatLabel]=\"_floatLabel\">\n @if (_appearance && _label) {\n <mat-label style=\"display: inline-block\">\n <div style=\"display: flex; align-items: center; gap: 4px\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <mat-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\">info_outline</mat-icon>\n }\n </div>\n </mat-label>\n }\n\n <mat-select\n #select\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder() || _label || ''\"\n (selectionChange)=\"onSelectionChange($event)\"\n disableOptionCentering=\"true\"\n [panelWidth]=\"calculatedPanelWidth()\"\n [panelClass]=\"'sd-select-panel'\"\n [class.sd-selected]=\"!_required && _normalizedValue !== undefined && _normalizedValue !== null\"\n [required]=\"_required\"\n (openedChange)=\"onOpenedChange($event)\"\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 matTooltipClass=\"sd-multiline-tooltip\"\n [matTooltipDisabled]=\"!formControl.disabled || !_normalizedValue?.length\"\n [matTooltip]=\"_tooltip || ''\">\n <mat-select-trigger>\n @if (sdSelectedTemplate(); as _selTpl) {\n <ng-container\n *ngTemplateOutlet=\"_selTpl; context: { $implicit: _selectedItems[0], item: _selectedItems[0], items: _selectedItems, display: _display, multiple: false }\">\n </ng-container>\n } @else {\n {{ _display }}\n }\n </mat-select-trigger>\n\n @if (filtered()) {\n <div class=\"c-filter-input-container\">\n <div class=\"filter-input-wrapper\">\n <mat-icon>search</mat-icon>\n <input\n [formControl]=\"inputControl\"\n [attr.aria-label]=\"placeholder() || _label\"\n matInput\n autocomplete=\"off\"\n class=\"c-search-input\"\n (keydown)=\"focusReadRetry($event); $event.stopPropagation()\" />\n </div>\n </div>\n }\n\n @if (!_loading && _readState.status === 'error') {\n <mat-option disabled class=\"sd-read-state-anchor\" aria-hidden=\"true\"></mat-option>\n }\n @let _filteredItems = filteredItems();\n @if (_filteredItems) {\n @if (!_filteredItems.length && !_loading && _readState.status !== 'error') {\n <mat-option class=\"sd-empty\" disabled>\n <img class=\"sd-image-data-empty\" alt=\"empty-image\" style=\"width: 95px\" />\n </mat-option>\n } @else {\n @let iDefTpl = itemDef()?.templateRef;\n\n @if (_valueField && _displayField) {\n @for (item of _filteredItems; track itemValue(item)) {\n <mat-option [value]=\"itemValue(item)\" [disabled]=\"itemDisabled(item)\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ itemDisplay(item) }}\n }\n </div>\n </mat-option>\n }\n } @else if (!_valueField && !_displayField) {\n @for (item of _filteredItems; track item) {\n <mat-option [value]=\"item\">\n <div>\n @if (iDefTpl) {\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\n } @else {\n {{ item }}\n }\n </div>\n </mat-option>\n }\n }\n }\n }\n\n <ng-container [ngTemplateOutlet]=\"readRegion\"></ng-container>\n\n @if (_loading) {\n <mat-option disabled class=\"sd-loading-option\">\n <mat-spinner diameter=\"24\"></mat-spinner>\n </mat-option>\n }\n\n @let _visibleFooterActions = visibleFooterActions();\n @if (_visibleFooterActions.length) {\n <div class=\"sd-select-footer-actions\">\n @for (action of _visibleFooterActions; track action) {\n <ng-container *ngTemplateOutlet=\"action.templateRef; context: footerActionContext()\"> </ng-container>\n }\n </div>\n }\n </mat-select>\n\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\"> error </mat-icon>\n }\n\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n\n @if (_normalizedValue !== undefined && _normalizedValue !== null && !_required && !formControl.disabled && !_bare) {\n <button type=\"button\" class=\"sd-clear-btn\" matSuffix (click)=\"clear($event)\" title=\"X\u00F3a\" aria-label=\"X\u00F3a\">\n <mat-icon>close</mat-icon>\n </button>\n } @else {\n <mat-icon class=\"cursor-pointer sd-suffix-icon\" matSuffix>keyboard_arrow_down</mat-icon>\n }\n </mat-form-field>\n }\n </div>\n}\n\n<ng-template #readRegion>\n <!-- why: VALUE/SEARCH gi\u1EEF l\u1ED7i \u0111\u1ED9c l\u1EADp; trong l\u00FAc k\u00EAnh kh\u00E1c \u0111ang \u0111\u1ECDc ch\u1EC9 hi\u1EC3n th\u1ECB loading. -->\n @if (!_loading && _readState.status === 'error') {\n <!-- why: n\u00FAt retry n\u1EB1m ngo\u00E0i mat-option \u0111\u1EC3 kh\u00F4ng tr\u1EDF th\u00E0nh m\u1ED9t l\u1EF1a ch\u1ECDn/form value. -->\n @if (!_hideReadError) {\n <div class=\"sd-read-state-region\" role=\"presentation\" (mousedown)=\"$event.preventDefault()\" (click)=\"$event.stopPropagation()\" (keydown)=\"onReadRegionKeydown($event)\">\n <sd-data-state state=\"error\" compact retryable (sdRetry)=\"retryRead()\">\n @if (dataStateTemplate(); as custom) {\n <ng-template sdDataStateTemplate let-current let-retry=\"retry\" let-action=\"action\">\n <ng-container [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{ $implicit: current, state: current, retry: retry, action: action }\"></ng-container>\n </ng-template>\n }\n </sd-data-state>\n </div>\n }\n }\n</ng-template>\n", styles: ["@charset \"UTF-8\";.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-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-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-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-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-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-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!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}:host{display:block;max-width:100%}:host(.sd-has-label){padding-top:4px}:host(.sd-viewed){padding-top:0}::ng-deep .sd-loading-option{min-height:50px!important}::ng-deep .sd-loading-option .mat-pseudo-checkbox{display:none!important}::ng-deep .sd-loading-option .mdc-list-item__primary-text{width:100%;display:flex;justify-content:center;align-items:center}.sd-trigger-text{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host ::ng-deep .mat-mdc-select-value{max-width:100%;overflow:hidden;width:0;min-width:100%}:host ::ng-deep .sd-selected .mat-mdc-select-arrow{display:none}:host ::ng-deep .mat-mdc-select-arrow{display:none!important}:host ::ng-deep .custom-arrow{pointer-events:none;position:absolute;right:1rem;top:50%;transform:translateY(-50%);display:flex;align-items:center}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field mat-select.mat-mdc-select-disabled .mat-mdc-select-value{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}::ng-deep .sd-select-panel .mat-mdc-option.sd-empty .mat-pseudo-checkbox{display:none}::ng-deep .sd-select-panel .mat-mdc-option{min-height:36px!important;padding:8px 12px!important}::ng-deep .sd-select-panel .c-filter-input-container{position:sticky;top:0;background-color:#fff;box-shadow:0 1px #f2f2f2;padding:8px;margin-bottom:8px;z-index:1000}::ng-deep .sd-select-panel .c-filter-input-container .filter-input-wrapper{display:flex;align-items:center;padding:4px 8px;border:1px solid var(--sd-black200);border-radius:4px;background-color:#fff}::ng-deep .sd-select-panel .c-filter-input-container .filter-input-wrapper .mat-icon{color:#dadada}::ng-deep .sd-select-panel .c-filter-input-container .filter-input-wrapper .c-search-input{min-width:0;width:100%;background-color:#fff;border:none;outline:none;flex:1;padding:4px}::ng-deep .sd-select-panel .sd-select-footer-actions{position:sticky;bottom:0;z-index:1000;display:flex;flex-direction:column;gap:4px;border-top:1px solid #f2f2f2;background-color:#fff}::ng-deep .sd-select-panel .sd-select-all-row{display:flex;align-items:center;justify-content:flex-start;min-height:36px;padding:8px 12px;cursor:pointer;-webkit-user-select:none;user-select:none;border-bottom:1px solid #f2f2f2;background-color:#fff}::ng-deep .sd-select-panel .sd-select-all-row:hover,::ng-deep .sd-select-panel .sd-select-all-row:focus-visible{background-color:#0000000a;outline:none}::ng-deep .sd-select-panel .sd-select-all-row .mdc-list-item__primary-text{font-size:14px;white-space:normal}::ng-deep .sd-multiline-tooltip{white-space:pre-line}::ng-deep .mat-mdc-select-panel.sd-select-panel{padding:0}::ng-deep .mat-mdc-select-panel.sd-select-panel .mat-mdc-option.mdc-list-item--disabled.sd-empty .mdc-list-item__primary-text{opacity:.8;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:16px}::ng-deep .sd-select-panel .mat-pseudo-checkbox-minimal{transform:scale(.7);transform-origin:center right}::ng-deep .sd-select-panel.sd-multiple .mat-pseudo-checkbox{transform:scale(.75);margin-right:8px!important}::ng-deep .sd-select-panel.sd-multiple .mdc-list-item__primary-text{font-size:14px;white-space:normal}::ng-deep .mat-mdc-select-panel.sd-select-panel{max-width:90vw!important}::ng-deep .mat-mdc-select-panel.sd-select-panel .mat-mdc-option .mdc-list-item__primary-text{white-space:normal;word-break:break-word;line-height:1.4}:host(.sd-bare){display:inline-flex;align-items:center}: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 mat-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(.sd-bare) ::ng-deep .mat-mdc-form-field{width:auto}:host(.sd-bare) ::ng-deep .mat-mdc-text-field-wrapper{padding:0;background:transparent}:host(.sd-bare) ::ng-deep .mat-mdc-form-field-flex{padding:0;align-items:center}:host(.sd-bare) ::ng-deep .mdc-notched-outline{display:none}:host(.sd-bare) ::ng-deep .mat-mdc-form-field-subscript-wrapper{display:none}:host(.sd-bare) ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}:host(.sd-bare) ::ng-deep .mat-mdc-select-arrow-wrapper{display:none}.sd-select-tooltip{white-space:pre-line}::ng-deep .sd-select-panel .sd-read-state-anchor{display:none}::ng-deep .sd-select-panel .sd-read-state-region{container:sd-read-panel/inline-size;box-sizing:border-box;width:100%;min-width:0;text-align:center}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact{display:flex;flex-direction:column;align-items:center;min-height:120px;padding:20px 16px;text-align:center}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__symbol{margin:0 0 8px}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__message{max-width:100%}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__actions{justify-content:center}@container sd-read-panel (max-width: 220px){::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact{padding:8px 10px}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__symbol{width:24px;height:24px;margin-bottom:4px}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__icon{width:18px;height:18px;font-size:18px}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__message{line-height:18px}::ng-deep .sd-select-panel .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__actions{margin-top:6px}}\n"] }]
|
|
778
1001
|
}], ctorParameters: () => [] });
|
|
779
1002
|
|
|
780
1003
|
/**
|