@sd-angular/core 19.0.0-beta.35 → 19.0.0-beta.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/sd-angular-core-components-table.mjs +2 -2
- package/fesm2022/sd-angular-core-components-table.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs +75 -67
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-date-range.mjs +145 -245
- package/fesm2022/sd-angular-core-forms-date-range.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-select.mjs +79 -67
- package/fesm2022/sd-angular-core-forms-select.mjs.map +1 -1
- package/forms/autocomplete/src/autocomplete.component.d.ts +8 -8
- package/forms/date-range/src/date-range.component.d.ts +28 -33
- package/forms/select/src/select.component.d.ts +6 -6
- package/package.json +36 -36
- package/sd-angular-core-19.0.0-beta.36.tgz +0 -0
- package/sd-angular-core-19.0.0-beta.35.tgz +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { viewChild, contentChild, inject, ChangeDetectorRef, input, computed, booleanAttribute, model, output, EventEmitter, effect, untracked, Output, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { viewChild, contentChild, inject, ChangeDetectorRef, input, computed, booleanAttribute, model, output, EventEmitter, signal, effect, untracked, Output, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { toObservable } from '@angular/core/rxjs-interop';
|
|
4
|
-
import { tap, map, debounce, switchMap, catchError, finalize
|
|
4
|
+
import { tap, map, startWith, debounce, switchMap, catchError, finalize } from 'rxjs/operators';
|
|
5
5
|
import { Subscription, combineLatest, timer, of, defer, from } from 'rxjs';
|
|
6
6
|
import * as uuid from 'uuid';
|
|
7
7
|
import * as i1 from '@angular/common';
|
|
@@ -43,7 +43,7 @@ class SdAutocomplete {
|
|
|
43
43
|
// ==========================================
|
|
44
44
|
// 1. SIGNAL QUERIES
|
|
45
45
|
// ==========================================
|
|
46
|
-
|
|
46
|
+
inputRef = viewChild('input');
|
|
47
47
|
autocompleteTrigger = viewChild(MatAutocompleteTrigger);
|
|
48
48
|
sdLabelTemplate = contentChild('sdLabel');
|
|
49
49
|
sdValueTemplate = contentChild('sdValue');
|
|
@@ -61,7 +61,6 @@ class SdAutocomplete {
|
|
|
61
61
|
autoId = computed(() => (this.autoIdInput() ? `forms-autocomplete-${this.autoIdInput()}` : undefined));
|
|
62
62
|
name = input(uuid.v4());
|
|
63
63
|
size = input('md');
|
|
64
|
-
// Chấp nhận mọi loại Form cha truyền xuống (FormGroup<{}>, FormGroup<any>, NgForm...)
|
|
65
64
|
form = input();
|
|
66
65
|
label = input();
|
|
67
66
|
helperText = input();
|
|
@@ -84,39 +83,42 @@ class SdAutocomplete {
|
|
|
84
83
|
appearance = computed(() => this.appearanceInput() ?? this.formConfig?.appearance ?? 'outline');
|
|
85
84
|
valueModel = model(undefined, { alias: 'model' });
|
|
86
85
|
// ==========================================
|
|
87
|
-
// 4. SIGNAL OUTPUTS
|
|
86
|
+
// 4. SIGNAL OUTPUTS
|
|
88
87
|
// ==========================================
|
|
89
88
|
sdChange = output();
|
|
90
89
|
sdSelection = output();
|
|
91
90
|
sdAdd = new EventEmitter();
|
|
92
91
|
// ==========================================
|
|
93
|
-
// 5. INTERNAL STATE &
|
|
92
|
+
// 5. INTERNAL STATE & STREAMS
|
|
94
93
|
// ==========================================
|
|
95
|
-
loading = false;
|
|
94
|
+
loading = signal(false);
|
|
96
95
|
isFocused = false;
|
|
97
|
-
isTyping = false;
|
|
96
|
+
isTyping = signal(false);
|
|
98
97
|
inputControl = new SdFormControl();
|
|
99
98
|
formControl = new SdFormControl();
|
|
100
99
|
matcher = new SdAutocompleteErrotStateMatcher(this.formControl);
|
|
101
100
|
#cache = {};
|
|
102
101
|
#item = {};
|
|
103
102
|
#subscription = new Subscription();
|
|
104
|
-
//
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
// RXJS STREAMS
|
|
104
|
+
#items$ = toObservable(this.items);
|
|
105
|
+
#valueModel$ = toObservable(this.valueModel);
|
|
106
|
+
// PUBLIC SIGNALS (Render View)
|
|
107
|
+
filteredItems = signal([]);
|
|
108
|
+
selected = signal(null);
|
|
109
|
+
display = signal('');
|
|
110
|
+
controlPlaceHolder = signal('');
|
|
111
|
+
normalizedValue = computed(() => this.valueModel());
|
|
109
112
|
constructor() {
|
|
110
|
-
//
|
|
113
|
+
// Sync 1: Signal Model -> FormControl (Khi dùng [(model)])
|
|
111
114
|
effect(() => {
|
|
112
|
-
const val = this.
|
|
115
|
+
const val = this.normalizedValue();
|
|
113
116
|
untracked(() => {
|
|
114
117
|
if (this.formControl.value !== val) {
|
|
115
|
-
this.formControl.setValue(val);
|
|
118
|
+
this.formControl.setValue(val, { emitEvent: false });
|
|
116
119
|
}
|
|
117
120
|
});
|
|
118
121
|
});
|
|
119
|
-
// Đồng bộ Disable
|
|
120
122
|
effect(() => {
|
|
121
123
|
if (this.disabled()) {
|
|
122
124
|
this.inputControl.disable({ emitEvent: false });
|
|
@@ -127,7 +129,6 @@ class SdAutocomplete {
|
|
|
127
129
|
this.formControl.enable({ emitEvent: false });
|
|
128
130
|
}
|
|
129
131
|
});
|
|
130
|
-
// Cập nhật Validator
|
|
131
132
|
effect(() => {
|
|
132
133
|
const req = this.required();
|
|
133
134
|
const val = this.validator();
|
|
@@ -136,65 +137,59 @@ class SdAutocomplete {
|
|
|
136
137
|
});
|
|
137
138
|
}
|
|
138
139
|
ngOnInit() {
|
|
140
|
+
// Sync 2: FormControl -> Signal Model
|
|
141
|
+
this.#subscription.add(this.formControl.valueChanges.subscribe(val => {
|
|
142
|
+
if (this.valueModel() !== val) {
|
|
143
|
+
this.valueModel.set(val);
|
|
144
|
+
}
|
|
145
|
+
}));
|
|
139
146
|
this.#subscription.add(this.inputControl.touchChanges.subscribe(() => {
|
|
140
147
|
this.formControl.markAsTouched();
|
|
141
148
|
this.ref.markForCheck();
|
|
142
149
|
}));
|
|
143
150
|
this.#subscription.add(this.formControl.sdChanges.subscribe(() => this.ref.markForCheck()));
|
|
144
151
|
this.#subscription.add(this.inputControl.sdChanges.subscribe(() => this.ref.markForCheck()));
|
|
145
|
-
this.#subscription.add(this.inputControl.valueChanges.subscribe(() =>
|
|
146
|
-
|
|
147
|
-
}));
|
|
148
|
-
// CẦU NỐI RXJS - Bọc items Signal thành Observable
|
|
149
|
-
const cleanItems$ = toObservable(this.items).pipe(tap(() => {
|
|
152
|
+
this.#subscription.add(this.inputControl.valueChanges.subscribe(() => this.isTyping.set(true)));
|
|
153
|
+
const cleanItems$ = this.#items$.pipe(tap(() => {
|
|
150
154
|
this.#cache = {};
|
|
151
|
-
}),
|
|
152
|
-
map(items => {
|
|
155
|
+
}), map(items => {
|
|
153
156
|
if (!items)
|
|
154
157
|
return [];
|
|
155
158
|
if (Array.isArray(items))
|
|
156
159
|
return items.filter(e => e !== null && e !== undefined);
|
|
157
160
|
return items;
|
|
158
161
|
}));
|
|
159
|
-
|
|
162
|
+
const filteredItems$ = combineLatest([
|
|
160
163
|
cleanItems$,
|
|
161
|
-
|
|
162
|
-
this.inputControl.valueChanges.pipe(debounce(() => timer(typeof this.items() === 'function' ? 500 : 0))),
|
|
164
|
+
this.inputControl.valueChanges.pipe(startWith(''), debounce(() => timer(typeof this.items() === 'function' ? 500 : 0))),
|
|
163
165
|
]).pipe(switchMap(([items, searchText]) => {
|
|
164
|
-
this.isTyping
|
|
165
|
-
|
|
166
|
+
this.isTyping.set(false);
|
|
167
|
+
const sText = searchText || '';
|
|
166
168
|
if (typeof items !== 'function') {
|
|
167
|
-
return of(ArrayUtilities.paging(ArrayUtilities.search(items,
|
|
169
|
+
return of(ArrayUtilities.paging(ArrayUtilities.search(items, sText, [this.valueField(), this.displayField()]), this.limit()));
|
|
168
170
|
}
|
|
169
171
|
const key = SdUtilities.hash({
|
|
170
172
|
checksum: this.cacheChecksum() || null,
|
|
171
|
-
searchText,
|
|
173
|
+
searchText: sText,
|
|
172
174
|
});
|
|
173
175
|
if (this.#cache[key] !== undefined) {
|
|
174
|
-
this.isTyping
|
|
176
|
+
this.isTyping.set(false);
|
|
175
177
|
return of(this.#cache[key]);
|
|
176
178
|
}
|
|
177
179
|
let obs;
|
|
178
|
-
const func = items({ type: 'SEARCH', searchText });
|
|
179
|
-
if (func instanceof Promise)
|
|
180
|
+
const func = items({ type: 'SEARCH', searchText: sText });
|
|
181
|
+
if (func instanceof Promise)
|
|
180
182
|
obs = defer(() => from(func));
|
|
181
|
-
|
|
182
|
-
else {
|
|
183
|
+
else
|
|
183
184
|
obs = func;
|
|
184
|
-
|
|
185
|
-
this.loading = true;
|
|
186
|
-
this.ref.markForCheck();
|
|
185
|
+
this.loading.set(true);
|
|
187
186
|
return obs.pipe(map(data => {
|
|
188
187
|
this.#cache[key] = data || [];
|
|
189
188
|
Object.assign(this.#item, ArrayUtilities.toObject(this.valueField(), this.#cache[key]));
|
|
190
189
|
return this.#cache[key];
|
|
191
|
-
}), catchError(() => of([])), finalize(() =>
|
|
192
|
-
this.loading = false;
|
|
193
|
-
this.ref.markForCheck();
|
|
194
|
-
}));
|
|
190
|
+
}), catchError(() => of([])), finalize(() => this.loading.set(false)));
|
|
195
191
|
}));
|
|
196
|
-
|
|
197
|
-
const val = this.formControl.value;
|
|
192
|
+
const selected$ = combineLatest([cleanItems$, this.#valueModel$]).pipe(switchMap(([items, val]) => {
|
|
198
193
|
const vField = this.valueField();
|
|
199
194
|
const dField = this.displayField();
|
|
200
195
|
if (!vField)
|
|
@@ -205,36 +200,49 @@ class SdAutocomplete {
|
|
|
205
200
|
return of(this.#item[val]);
|
|
206
201
|
let obs;
|
|
207
202
|
const func = items({ type: 'VALUE', value: val });
|
|
208
|
-
if (func instanceof Promise)
|
|
203
|
+
if (func instanceof Promise)
|
|
209
204
|
obs = defer(() => from(func));
|
|
210
|
-
|
|
211
|
-
else {
|
|
205
|
+
else
|
|
212
206
|
obs = func;
|
|
213
|
-
|
|
207
|
+
this.loading.set(true);
|
|
214
208
|
return obs.pipe(map(data => {
|
|
215
209
|
Object.assign(this.#item, ArrayUtilities.toObject(vField, data));
|
|
216
210
|
return this.#item[val] || { [vField]: val, [dField]: val };
|
|
217
|
-
}), catchError(() => of({ [vField]: val, [dField]: val })), finalize(() =>
|
|
218
|
-
this.loading = false;
|
|
219
|
-
this.ref.markForCheck();
|
|
220
|
-
}));
|
|
211
|
+
}), catchError(() => of({ [vField]: val, [dField]: val })), finalize(() => this.loading.set(false)));
|
|
221
212
|
}
|
|
222
213
|
return of(items.find((e) => e[vField] === val));
|
|
223
214
|
}
|
|
224
215
|
return of('');
|
|
225
216
|
}));
|
|
226
|
-
|
|
217
|
+
const controlPlaceHolder$ = selected$.pipe(map((item) => {
|
|
227
218
|
return item?.[this.displayField()] ?? item ?? this.placeholder() ?? (this.appearance() ? this.label() : '');
|
|
228
219
|
}));
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
220
|
+
const display$ = selected$.pipe(map((item) => {
|
|
221
|
+
const dField = this.displayField(); // Lấy đúng trường displayField
|
|
222
|
+
if (dField && typeof item === 'object' && !!item) {
|
|
223
|
+
return item?.[dField] ?? '';
|
|
232
224
|
}
|
|
233
225
|
if (typeof item === 'string' || typeof item === 'number') {
|
|
234
|
-
return item;
|
|
226
|
+
return item.toString();
|
|
235
227
|
}
|
|
236
228
|
return '';
|
|
237
229
|
}));
|
|
230
|
+
this.#subscription.add(filteredItems$.subscribe(val => {
|
|
231
|
+
this.filteredItems.set(val || []);
|
|
232
|
+
this.ref.markForCheck();
|
|
233
|
+
}));
|
|
234
|
+
this.#subscription.add(selected$.subscribe(val => {
|
|
235
|
+
this.selected.set(val);
|
|
236
|
+
this.ref.markForCheck();
|
|
237
|
+
}));
|
|
238
|
+
this.#subscription.add(controlPlaceHolder$.subscribe(val => {
|
|
239
|
+
this.controlPlaceHolder.set(val || '');
|
|
240
|
+
this.ref.markForCheck();
|
|
241
|
+
}));
|
|
242
|
+
this.#subscription.add(display$.subscribe(val => {
|
|
243
|
+
this.display.set(val || '');
|
|
244
|
+
this.ref.markForCheck();
|
|
245
|
+
}));
|
|
238
246
|
}
|
|
239
247
|
ngAfterViewInit() {
|
|
240
248
|
const formGroup = this.form() instanceof NgForm ? this.form().form : this.form();
|
|
@@ -252,7 +260,7 @@ class SdAutocomplete {
|
|
|
252
260
|
const dField = this.displayField();
|
|
253
261
|
if (typeof item === 'string' || typeof item === 'number') {
|
|
254
262
|
if (this.formControl.value !== item) {
|
|
255
|
-
this.formControl.setValue(item);
|
|
263
|
+
this.formControl.setValue(item, { emitEvent: false });
|
|
256
264
|
this.valueModel.set(item);
|
|
257
265
|
this.sdChange.emit(item);
|
|
258
266
|
this.sdSelection.emit({ values: [item], selectedItems: [item], value: item, selectedItem: item });
|
|
@@ -261,7 +269,7 @@ class SdAutocomplete {
|
|
|
261
269
|
else if (vField && dField) {
|
|
262
270
|
const val = item?.[vField] || null;
|
|
263
271
|
if (this.formControl.value !== val) {
|
|
264
|
-
this.formControl.setValue(val);
|
|
272
|
+
this.formControl.setValue(val, { emitEvent: false });
|
|
265
273
|
this.valueModel.set(val);
|
|
266
274
|
this.sdChange.emit(val);
|
|
267
275
|
this.sdSelection.emit({ values: [val], selectedItems: [item], value: val, selectedItem: item });
|
|
@@ -285,20 +293,20 @@ class SdAutocomplete {
|
|
|
285
293
|
}
|
|
286
294
|
};
|
|
287
295
|
blur = () => {
|
|
288
|
-
this.
|
|
296
|
+
this.inputRef()?.nativeElement?.blur();
|
|
289
297
|
};
|
|
290
298
|
focus = () => {
|
|
291
299
|
this.isFocused = true;
|
|
292
300
|
setTimeout(() => {
|
|
293
301
|
this.autocompleteTrigger()?.openPanel();
|
|
294
|
-
this.
|
|
302
|
+
this.inputRef()?.nativeElement?.focus();
|
|
295
303
|
}, 100);
|
|
296
304
|
};
|
|
297
305
|
clear = ($event) => {
|
|
298
306
|
$event?.stopPropagation();
|
|
299
307
|
this.inputControl?.setValue('');
|
|
300
308
|
if (this.valueModel()) {
|
|
301
|
-
this.formControl.setValue(null);
|
|
309
|
+
this.formControl.setValue(null, { emitEvent: false });
|
|
302
310
|
this.valueModel.set(null);
|
|
303
311
|
this.sdChange.emit(null);
|
|
304
312
|
this.sdSelection.emit({ values: [null], selectedItems: [], value: null, selectedItem: null });
|
|
@@ -323,13 +331,13 @@ class SdAutocomplete {
|
|
|
323
331
|
validators.push(this.customInlineErrorValidator());
|
|
324
332
|
this.formControl.setValidators(validators.length ? validators : null);
|
|
325
333
|
this.formControl.setAsyncValidators(asyncValidators.length ? asyncValidators : null);
|
|
326
|
-
this.formControl.updateValueAndValidity();
|
|
334
|
+
this.formControl.updateValueAndValidity({ emitEvent: false });
|
|
327
335
|
};
|
|
328
336
|
customInlineErrorValidator() {
|
|
329
337
|
return () => ({ inlineError: true });
|
|
330
338
|
}
|
|
331
339
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
332
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdAutocomplete, isStandalone: true, selector: "sd-autocomplete", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null }, displayField: { classPropertyName: "displayField", publicName: "displayField", isSignal: true, isRequired: false, transformFunction: null }, disabledField: { classPropertyName: "disabledField", publicName: "disabledField", isSignal: true, isRequired: false, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: false, transformFunction: null }, cacheChecksum: { classPropertyName: "cacheChecksum", publicName: "cacheChecksum", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, addable: { classPropertyName: "addable", publicName: "addable", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "validator", isSignal: true, isRequired: false, transformFunction: null }, inlineError: { classPropertyName: "inlineError", publicName: "inlineError", isSignal: true, isRequired: false, transformFunction: null }, appearanceInput: { classPropertyName: "appearanceInput", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueModel: "modelChange", sdChange: "sdChange", sdSelection: "sdSelection", sdAdd: "sdAdd" }, queries: [{ propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }, { propertyName: "itemDef", first: true, predicate: SdItemDefDefDirective, descendants: true, isSignal: true }, { propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, isSignal: true }, { propertyName: "autocompleteTrigger", first: true, predicate: MatAutocompleteTrigger, descendants: true, isSignal: true }], ngImport: i0, template: "@if (viewed()) {\r\n <sd-view\r\n [label]=\"label()\"\r\n [labelTemplate]=\"sdLabelTemplate()\"\r\n [value]=\"formControl.value\"\r\n [display]=\"display | async\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"sdValueTemplate()\">\r\n </sd-view>\r\n} @else {\r\n @if (!appearance()) {\r\n <ng-content select=\"[sdLabel]\">\r\n @if (label()) {\r\n <sd-label [label]=\"label()\" [required]=\"required()\"></sd-label>\r\n }\r\n </ng-content>\r\n }\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"sdViewDef()?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n \r\n @if (sdViewDef()?.templateRef && !autocompleteTrigger()?.panelOpen && !isFocused) {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n sdViewDef()!.templateRef;\r\n context: {\r\n value: formControl.value,\r\n selectedItem: selected | async,\r\n }\r\n \">\r\n </ng-container>\r\n } @else {\r\n <mat-form-field\r\n [class.sd-md]=\"size() === 'md'\"\r\n [class.sd-sm]=\"size() === 'sm'\"\r\n [class.hide-inline-error]=\"hideInlineError()\"\r\n [floatLabel]=\"formControl.value ? 'always' : 'auto'\"\r\n [appearance]=\"appearance() || 'outline'\">\r\n \r\n @if (appearance() && label()) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ label() }}</span>\r\n @if (helperText()) {\r\n <mat-icon [matTooltip]=\"helperText()!\" matTooltipPosition=\"below\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n \r\n <input\r\n [id]=\"id\"\r\n [formControl]=\"inputControl\"\r\n [placeholder]=\"(controlPlaceHolder | async) || ''\"\r\n [class.c-selected]=\"formControl.value\"\r\n [matAutocomplete]=\"auto\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n matInput\r\n [autocomplete]=\"id\"\r\n autocorrect=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n [required]=\"required()\"\r\n #input\r\n #autocompleteTrigger=\"matAutocompleteTrigger\"\r\n [attr.data-autoId]=\"autoId()\"\r\n aria-hidden=\"true\" />\r\n \r\n @if (!loading && formControl.value && !inputControl.disabled) {\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel</mat-icon>\r\n } @else if (loading) {\r\n <mat-spinner [diameter]=\"20\" matSuffix></mat-spinner>\r\n } @else {\r\n <mat-icon class=\"pointer sd-suffix-icon\" matSuffix>search</mat-icon>\r\n }\r\n\r\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onSelect($event.option.value)\" class=\"sd-autocomplete-panel\">\r\n @let itemsList = filteredItems | async;\r\n \r\n @if (itemsList?.length) {\r\n @for (item of itemsList; track $index) {\r\n <mat-option\r\n [value]=\"item\"\r\n matTooltipPosition=\"above\"\r\n [matTooltip]=\"displayField() ? item[displayField()!] : item\"\r\n [disabled]=\"disabledField() ? item[disabledField()] : false\">\r\n \r\n @if (itemDef()?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"itemDef()!.templateRef ?? null; context: { item: item }\"> </ng-container>\r\n } @else {\r\n {{ displayField() ? item[displayField()!] : item }}\r\n }\r\n </mat-option>\r\n }\r\n } @else if (!itemsList?.length && inputControl.value && !isTyping && !loading) {\r\n }\r\n \r\n @if (addable() && sdAdd.observed) {\r\n <mat-option class=\"sd__option--add\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <div (click)=\"onAdd($event)\">\r\n <mat-icon class=\"mr-1\">add</mat-icon>\r\n {{ 'New item' }}\r\n </div>\r\n </mat-option>\r\n }\r\n </mat-autocomplete>\r\n\r\n @if (formControl.errors?.['required']) {\r\n <mat-error>\r\n @if (!hideInlineError()) {\r\n Vui l\u00F2ng nh\u1EADp th\u00F4ng tin\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['customValidator']) {\r\n <mat-error>\r\n @if (!hideInlineError()) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-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{padding-top:5px;display:block}: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 input.c-selected::placeholder{color:#000;opacity:1}:host ::ng-deep .mat-mdc-form-field input.c-selected:-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.c-selected::-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::placeholder{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected:-ms-input-placeholder{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::-ms-input-placeholder{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}:host ::ng-deep .mat-mdc-form-field:hover .icon-copy{opacity:1}:host ::ng-deep .mat-mdc-form-field .icon-copy{cursor:pointer;width:.9em;height:.9em;fill:#00000080;transition:opacity .2s linear;opacity:0}::ng-deep .sd-autocomplete-panel .mat-mdc-option{min-height:36px!important;padding:8px 12px!important}::ng-deep .sd-autocomplete-panel .mdc-list-item__primary-text{font-size:14px!important;line-height:normal}::ng-deep .sd-autocomplete-panel .mat-pseudo-checkbox{transform:scale(.75);margin-right:8px!important}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd__option--add{position:sticky;bottom:0;background-color:#fff;z-index:10;color:#000000de;cursor:pointer!important}.c-loading-icon{position:absolute;right:5px;top:5px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { 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: MatAutocompleteModule }, { kind: "component", type: i5.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i5.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
340
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdAutocomplete, isStandalone: true, selector: "sd-autocomplete", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null }, displayField: { classPropertyName: "displayField", publicName: "displayField", isSignal: true, isRequired: false, transformFunction: null }, disabledField: { classPropertyName: "disabledField", publicName: "disabledField", isSignal: true, isRequired: false, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: false, transformFunction: null }, cacheChecksum: { classPropertyName: "cacheChecksum", publicName: "cacheChecksum", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, addable: { classPropertyName: "addable", publicName: "addable", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "validator", isSignal: true, isRequired: false, transformFunction: null }, inlineError: { classPropertyName: "inlineError", publicName: "inlineError", isSignal: true, isRequired: false, transformFunction: null }, appearanceInput: { classPropertyName: "appearanceInput", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueModel: "modelChange", sdChange: "sdChange", sdSelection: "sdSelection", sdAdd: "sdAdd" }, queries: [{ propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }, { propertyName: "itemDef", first: true, predicate: SdItemDefDefDirective, descendants: true, isSignal: true }, { propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, isSignal: true }, { propertyName: "autocompleteTrigger", first: true, predicate: MatAutocompleteTrigger, descendants: true, isSignal: true }], ngImport: i0, template: "@let lbl = label();\r\n@let app = appearance();\r\n@let hideErr = hideInlineError();\r\n@let viewDef = sdViewDef();\r\n@let hText = helperText();\r\n@let req = required();\r\n@let vField = valueField();\r\n@let dField = displayField();\r\n@let disField = disabledField();\r\n@let iDefTpl = itemDef()?.templateRef;\r\n@let isLoad = loading();\r\n@let nVal = $any(normalizedValue());\r\n\r\n@if (viewed()) {\r\n <sd-view\r\n [label]=\"lbl\"\r\n [labelTemplate]=\"sdLabelTemplate()\"\r\n [value]=\"nVal\"\r\n [display]=\"display()\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"sdValueTemplate()\">\r\n </sd-view>\r\n} @else {\r\n @if (!app) {\r\n <ng-content select=\"[sdLabel]\">\r\n @if (lbl) {\r\n <sd-label [label]=\"lbl\" [required]=\"req\"></sd-label>\r\n }\r\n </ng-content>\r\n }\r\n \r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"viewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n \r\n @if (viewDef?.templateRef && !autocompleteTrigger()?.panelOpen && !isFocused) {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n viewDef!.templateRef;\r\n context: {\r\n value: nVal,\r\n selectedItem: selected()\r\n }\r\n \">\r\n </ng-container>\r\n } @else {\r\n <mat-form-field\r\n [class.sd-md]=\"size() === 'md'\"\r\n [class.sd-sm]=\"size() === 'sm'\"\r\n [class.hide-inline-error]=\"hideErr\"\r\n [floatLabel]=\"nVal ? 'always' : 'auto'\"\r\n [appearance]=\"app || 'outline'\">\r\n \r\n @if (app && lbl) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ lbl }}</span>\r\n @if (hText) {\r\n <mat-icon [matTooltip]=\"hText\" matTooltipPosition=\"below\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n \r\n <input\r\n [id]=\"id\"\r\n [formControl]=\"inputControl\"\r\n [placeholder]=\"controlPlaceHolder() || ''\"\r\n [class.c-selected]=\"nVal\"\r\n [matAutocomplete]=\"auto\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n matInput\r\n [autocomplete]=\"id\"\r\n autocorrect=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n [required]=\"req\"\r\n #input\r\n #autocompleteTrigger=\"matAutocompleteTrigger\"\r\n [attr.data-autoId]=\"autoId()\"\r\n aria-hidden=\"true\" />\r\n \r\n @if (!isLoad && nVal && !inputControl.disabled) {\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel</mat-icon>\r\n } @else if (isLoad) {\r\n <mat-spinner [diameter]=\"20\" matSuffix></mat-spinner>\r\n } @else {\r\n <mat-icon class=\"pointer sd-suffix-icon\" matSuffix>search</mat-icon>\r\n }\r\n\r\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onSelect($event.option.value)\" class=\"sd-autocomplete-panel\">\r\n @let itemsList = filteredItems();\r\n \r\n @if (itemsList?.length) {\r\n @for (item of itemsList; track $index) {\r\n <mat-option\r\n [value]=\"item\"\r\n matTooltipPosition=\"above\"\r\n [matTooltip]=\"dField ? item[dField] : item\"\r\n [disabled]=\"disField ? item[disField] : false\">\r\n \r\n @if (iDefTpl) {\r\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\r\n } @else {\r\n {{ dField ? item[dField] : item }}\r\n }\r\n </mat-option>\r\n }\r\n } @else if (!itemsList?.length && inputControl.value && !isTyping() && !isLoad) {\r\n }\r\n \r\n @if (addable() && sdAdd.observed) {\r\n <mat-option class=\"sd__option--add\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <div (click)=\"onAdd($event)\">\r\n <mat-icon class=\"mr-1\">add</mat-icon>\r\n {{ 'New item' }}\r\n </div>\r\n </mat-option>\r\n }\r\n </mat-autocomplete>\r\n\r\n @if (formControl.errors?.['required']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n Vui l\u00F2ng nh\u1EADp th\u00F4ng tin\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['customValidator']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-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{padding-top:5px;display:block}: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 input.c-selected::placeholder{color:#000;opacity:1}:host ::ng-deep .mat-mdc-form-field input.c-selected:-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.c-selected::-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::placeholder{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected:-ms-input-placeholder{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::-ms-input-placeholder{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}:host ::ng-deep .mat-mdc-form-field:hover .icon-copy{opacity:1}:host ::ng-deep .mat-mdc-form-field .icon-copy{cursor:pointer;width:.9em;height:.9em;fill:#00000080;transition:opacity .2s linear;opacity:0}::ng-deep .sd-autocomplete-panel .mat-mdc-option{min-height:36px!important;padding:8px 12px!important}::ng-deep .sd-autocomplete-panel .mdc-list-item__primary-text{font-size:14px!important;line-height:normal}::ng-deep .sd-autocomplete-panel .mat-pseudo-checkbox{transform:scale(.75);margin-right:8px!important}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd__option--add{position:sticky;bottom:0;background-color:#fff;z-index:10;color:#000000de;cursor:pointer!important}.c-loading-icon{position:absolute;right:5px;top:5px}\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: MatAutocompleteModule }, { kind: "component", type: i5.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i5.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
333
341
|
}
|
|
334
342
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdAutocomplete, decorators: [{
|
|
335
343
|
type: Component,
|
|
@@ -345,7 +353,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
|
|
|
345
353
|
MatProgressSpinnerModule,
|
|
346
354
|
SdLabel,
|
|
347
355
|
SdView,
|
|
348
|
-
], template: "@if (viewed()) {\r\n <sd-view\r\n [label]=\"label()\"\r\n [labelTemplate]=\"sdLabelTemplate()\"\r\n [value]=\"formControl.value\"\r\n [display]=\"display | async\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"sdValueTemplate()\">\r\n </sd-view>\r\n} @else {\r\n @if (!appearance()) {\r\n <ng-content select=\"[sdLabel]\">\r\n @if (label()) {\r\n <sd-label [label]=\"label()\" [required]=\"required()\"></sd-label>\r\n }\r\n </ng-content>\r\n }\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"sdViewDef()?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n \r\n @if (sdViewDef()?.templateRef && !autocompleteTrigger()?.panelOpen && !isFocused) {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n sdViewDef()!.templateRef;\r\n context: {\r\n value: formControl.value,\r\n selectedItem: selected | async,\r\n }\r\n \">\r\n </ng-container>\r\n } @else {\r\n <mat-form-field\r\n [class.sd-md]=\"size() === 'md'\"\r\n [class.sd-sm]=\"size() === 'sm'\"\r\n [class.hide-inline-error]=\"hideInlineError()\"\r\n [floatLabel]=\"formControl.value ? 'always' : 'auto'\"\r\n [appearance]=\"appearance() || 'outline'\">\r\n \r\n @if (appearance() && label()) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ label() }}</span>\r\n @if (helperText()) {\r\n <mat-icon [matTooltip]=\"helperText()!\" matTooltipPosition=\"below\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n \r\n <input\r\n [id]=\"id\"\r\n [formControl]=\"inputControl\"\r\n [placeholder]=\"(controlPlaceHolder | async) || ''\"\r\n [class.c-selected]=\"formControl.value\"\r\n [matAutocomplete]=\"auto\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n matInput\r\n [autocomplete]=\"id\"\r\n autocorrect=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n [required]=\"required()\"\r\n #input\r\n #autocompleteTrigger=\"matAutocompleteTrigger\"\r\n [attr.data-autoId]=\"autoId()\"\r\n aria-hidden=\"true\" />\r\n \r\n @if (!loading && formControl.value && !inputControl.disabled) {\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel</mat-icon>\r\n } @else if (loading) {\r\n <mat-spinner [diameter]=\"20\" matSuffix></mat-spinner>\r\n } @else {\r\n <mat-icon class=\"pointer sd-suffix-icon\" matSuffix>search</mat-icon>\r\n }\r\n\r\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onSelect($event.option.value)\" class=\"sd-autocomplete-panel\">\r\n @let itemsList = filteredItems | async;\r\n \r\n @if (itemsList?.length) {\r\n @for (item of itemsList; track $index) {\r\n <mat-option\r\n [value]=\"item\"\r\n matTooltipPosition=\"above\"\r\n [matTooltip]=\"displayField() ? item[displayField()!] : item\"\r\n [disabled]=\"disabledField() ? item[disabledField()] : false\">\r\n \r\n @if (itemDef()?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"itemDef()!.templateRef ?? null; context: { item: item }\"> </ng-container>\r\n } @else {\r\n {{ displayField() ? item[displayField()!] : item }}\r\n }\r\n </mat-option>\r\n }\r\n } @else if (!itemsList?.length && inputControl.value && !isTyping && !loading) {\r\n }\r\n \r\n @if (addable() && sdAdd.observed) {\r\n <mat-option class=\"sd__option--add\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <div (click)=\"onAdd($event)\">\r\n <mat-icon class=\"mr-1\">add</mat-icon>\r\n {{ 'New item' }}\r\n </div>\r\n </mat-option>\r\n }\r\n </mat-autocomplete>\r\n\r\n @if (formControl.errors?.['required']) {\r\n <mat-error>\r\n @if (!hideInlineError()) {\r\n Vui l\u00F2ng nh\u1EADp th\u00F4ng tin\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['customValidator']) {\r\n <mat-error>\r\n @if (!hideInlineError()) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-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{padding-top:5px;display:block}: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 input.c-selected::placeholder{color:#000;opacity:1}:host ::ng-deep .mat-mdc-form-field input.c-selected:-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.c-selected::-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::placeholder{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected:-ms-input-placeholder{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::-ms-input-placeholder{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}:host ::ng-deep .mat-mdc-form-field:hover .icon-copy{opacity:1}:host ::ng-deep .mat-mdc-form-field .icon-copy{cursor:pointer;width:.9em;height:.9em;fill:#00000080;transition:opacity .2s linear;opacity:0}::ng-deep .sd-autocomplete-panel .mat-mdc-option{min-height:36px!important;padding:8px 12px!important}::ng-deep .sd-autocomplete-panel .mdc-list-item__primary-text{font-size:14px!important;line-height:normal}::ng-deep .sd-autocomplete-panel .mat-pseudo-checkbox{transform:scale(.75);margin-right:8px!important}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd__option--add{position:sticky;bottom:0;background-color:#fff;z-index:10;color:#000000de;cursor:pointer!important}.c-loading-icon{position:absolute;right:5px;top:5px}\n"] }]
|
|
356
|
+
], template: "@let lbl = label();\r\n@let app = appearance();\r\n@let hideErr = hideInlineError();\r\n@let viewDef = sdViewDef();\r\n@let hText = helperText();\r\n@let req = required();\r\n@let vField = valueField();\r\n@let dField = displayField();\r\n@let disField = disabledField();\r\n@let iDefTpl = itemDef()?.templateRef;\r\n@let isLoad = loading();\r\n@let nVal = $any(normalizedValue());\r\n\r\n@if (viewed()) {\r\n <sd-view\r\n [label]=\"lbl\"\r\n [labelTemplate]=\"sdLabelTemplate()\"\r\n [value]=\"nVal\"\r\n [display]=\"display()\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"sdValueTemplate()\">\r\n </sd-view>\r\n} @else {\r\n @if (!app) {\r\n <ng-content select=\"[sdLabel]\">\r\n @if (lbl) {\r\n <sd-label [label]=\"lbl\" [required]=\"req\"></sd-label>\r\n }\r\n </ng-content>\r\n }\r\n \r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"viewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n \r\n @if (viewDef?.templateRef && !autocompleteTrigger()?.panelOpen && !isFocused) {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n viewDef!.templateRef;\r\n context: {\r\n value: nVal,\r\n selectedItem: selected()\r\n }\r\n \">\r\n </ng-container>\r\n } @else {\r\n <mat-form-field\r\n [class.sd-md]=\"size() === 'md'\"\r\n [class.sd-sm]=\"size() === 'sm'\"\r\n [class.hide-inline-error]=\"hideErr\"\r\n [floatLabel]=\"nVal ? 'always' : 'auto'\"\r\n [appearance]=\"app || 'outline'\">\r\n \r\n @if (app && lbl) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ lbl }}</span>\r\n @if (hText) {\r\n <mat-icon [matTooltip]=\"hText\" matTooltipPosition=\"below\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n \r\n <input\r\n [id]=\"id\"\r\n [formControl]=\"inputControl\"\r\n [placeholder]=\"controlPlaceHolder() || ''\"\r\n [class.c-selected]=\"nVal\"\r\n [matAutocomplete]=\"auto\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n matInput\r\n [autocomplete]=\"id\"\r\n autocorrect=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n [required]=\"req\"\r\n #input\r\n #autocompleteTrigger=\"matAutocompleteTrigger\"\r\n [attr.data-autoId]=\"autoId()\"\r\n aria-hidden=\"true\" />\r\n \r\n @if (!isLoad && nVal && !inputControl.disabled) {\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel</mat-icon>\r\n } @else if (isLoad) {\r\n <mat-spinner [diameter]=\"20\" matSuffix></mat-spinner>\r\n } @else {\r\n <mat-icon class=\"pointer sd-suffix-icon\" matSuffix>search</mat-icon>\r\n }\r\n\r\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onSelect($event.option.value)\" class=\"sd-autocomplete-panel\">\r\n @let itemsList = filteredItems();\r\n \r\n @if (itemsList?.length) {\r\n @for (item of itemsList; track $index) {\r\n <mat-option\r\n [value]=\"item\"\r\n matTooltipPosition=\"above\"\r\n [matTooltip]=\"dField ? item[dField] : item\"\r\n [disabled]=\"disField ? item[disField] : false\">\r\n \r\n @if (iDefTpl) {\r\n <ng-container *ngTemplateOutlet=\"iDefTpl ?? null; context: { item: item }\"> </ng-container>\r\n } @else {\r\n {{ dField ? item[dField] : item }}\r\n }\r\n </mat-option>\r\n }\r\n } @else if (!itemsList?.length && inputControl.value && !isTyping() && !isLoad) {\r\n }\r\n \r\n @if (addable() && sdAdd.observed) {\r\n <mat-option class=\"sd__option--add\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <div (click)=\"onAdd($event)\">\r\n <mat-icon class=\"mr-1\">add</mat-icon>\r\n {{ 'New item' }}\r\n </div>\r\n </mat-option>\r\n }\r\n </mat-autocomplete>\r\n\r\n @if (formControl.errors?.['required']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n Vui l\u00F2ng nh\u1EADp th\u00F4ng tin\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['customValidator']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-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{padding-top:5px;display:block}: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 input.c-selected::placeholder{color:#000;opacity:1}:host ::ng-deep .mat-mdc-form-field input.c-selected:-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.c-selected::-ms-input-placeholder{color:#000}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::placeholder{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected:-ms-input-placeholder{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled.c-selected::-ms-input-placeholder{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}:host ::ng-deep .mat-mdc-form-field:hover .icon-copy{opacity:1}:host ::ng-deep .mat-mdc-form-field .icon-copy{cursor:pointer;width:.9em;height:.9em;fill:#00000080;transition:opacity .2s linear;opacity:0}::ng-deep .sd-autocomplete-panel .mat-mdc-option{min-height:36px!important;padding:8px 12px!important}::ng-deep .sd-autocomplete-panel .mdc-list-item__primary-text{font-size:14px!important;line-height:normal}::ng-deep .sd-autocomplete-panel .mat-pseudo-checkbox{transform:scale(.75);margin-right:8px!important}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd__option--add{position:sticky;bottom:0;background-color:#fff;z-index:10;color:#000000de;cursor:pointer!important}.c-loading-icon{position:absolute;right:5px;top:5px}\n"] }]
|
|
349
357
|
}], ctorParameters: () => [], propDecorators: { sdAdd: [{
|
|
350
358
|
type: Output
|
|
351
359
|
}] } });
|