@libs-ui/components-tags 0.1.1-1

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.
@@ -0,0 +1,824 @@
1
+ import { NgTemplateOutlet, NgStyle } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { Pipe, signal, computed, input, model, output, viewChild, inject, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
4
+ import { LibsUiComponentsAvatarComponent } from '@libs-ui/components-avatar';
5
+ import { LibsUiComponentsClickOutsideDirective } from '@libs-ui/components-click-outside';
6
+ import { LibsUiComponentsInputsInputComponent } from '@libs-ui/components-inputs-input';
7
+ import { LibsUiComponentsLabelComponent } from '@libs-ui/components-label';
8
+ import { getFieldKeyByType, LibsUiComponentsListComponent } from '@libs-ui/components-list';
9
+ import { LibsUiComponentsPopoverComponent } from '@libs-ui/components-popover';
10
+ import { LibsUiComponentsScrollOverlayDirective } from '@libs-ui/components-scroll-overlay';
11
+ import { LibsUiHttpRequestService } from '@libs-ui/services-http-request';
12
+ import { get, rgbToHex, colorStepContrastFromOrigin, uuid, set, isNil, cloneDeep, escapeHtml, ERROR_MESSAGE_EMPTY_VALID, ERROR_MESSAGE_MAX_VALID, ERROR_MESSAGE_PATTEN_VALID } from '@libs-ui/utils';
13
+ import * as i1 from '@ngx-translate/core';
14
+ import { TranslateModule } from '@ngx-translate/core';
15
+ import { Subject, debounceTime, takeUntil } from 'rxjs';
16
+
17
+ class LibsUiComponentsTagsGetColorPipe {
18
+ transform(style, element) {
19
+ if (!style) {
20
+ return {};
21
+ }
22
+ let color = get(style, 'color');
23
+ let backgroundColor = (get(style, 'backgroundColor') || get(style, 'background'));
24
+ if (color && color.includes('rgb') && color.match(/d+/g)?.length) {
25
+ const [red, green, blue] = Array.from(color.match(/d+/g) || []);
26
+ color = rgbToHex({ red, green, blue });
27
+ }
28
+ if (backgroundColor && backgroundColor.includes('rgb') && backgroundColor.match(/\d+/g)?.length) {
29
+ const [red, green, blue] = Array.from(backgroundColor.match(/\d+/g) || []);
30
+ backgroundColor = rgbToHex({ red, green, blue });
31
+ }
32
+ if (color && /(^#)[a-z0-9]{3,6}/gi.test(color)) {
33
+ element.style.setProperty('--libs-ui-tags-item-icon-default', color);
34
+ element.style.setProperty('--libs-ui-tags-item-icon-background-hover', color);
35
+ }
36
+ if (backgroundColor && /(^#)[a-z0-9]{3,6}/gi.test(backgroundColor)) {
37
+ element.style.setProperty('--libs-ui-tags-item-icon-hover', backgroundColor);
38
+ element.style.setProperty('--libs-ui-tags-item-icon-active', backgroundColor);
39
+ element.style.setProperty('--libs-ui-tags-item-icon-background-active', colorStepContrastFromOrigin(backgroundColor, 60)?.light || '');
40
+ }
41
+ return style;
42
+ }
43
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsTagsGetColorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
44
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsTagsGetColorPipe, isStandalone: true, name: "LibsUiComponentsTagsGetColorPipe" });
45
+ }
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsTagsGetColorPipe, decorators: [{
47
+ type: Pipe,
48
+ args: [{
49
+ name: 'LibsUiComponentsTagsGetColorPipe',
50
+ standalone: true,
51
+ }]
52
+ }] });
53
+
54
+ /* eslint-disable @typescript-eslint/no-explicit-any */
55
+ class LibsUiComponentsTagsComponent {
56
+ // #region PROPERTY
57
+ flagMouse = signal({ isMouseEnter: false, isMouseEnterContent: false });
58
+ loading = signal(false);
59
+ loadingDetail = signal(false);
60
+ keySearch = signal('');
61
+ valueInput = signal('');
62
+ itemsSelected = signal([]);
63
+ showList = signal(false);
64
+ positionList = signal(undefined);
65
+ keysSelected = signal([]);
66
+ disableWhenMaxItem = signal(false);
67
+ focus = signal(false);
68
+ error = signal(undefined);
69
+ fieldKey = signal('id');
70
+ functionGetItemAutoAddList = computed(() => {
71
+ if (!this.enterAutoAddTagToList()) {
72
+ return;
73
+ }
74
+ return () => this.itemsSelected()
75
+ .filter((item) => `${get(item, this.fieldKey(), '')}`.search(this.fakeId()) === 0)
76
+ .reverse();
77
+ });
78
+ listKeyDisable = signal([]);
79
+ fakeId = signal(uuid());
80
+ timeOutFlag = signal(undefined);
81
+ timeOutChangeSearch = signal(undefined);
82
+ timeOutCheckViewChange = signal(undefined);
83
+ timeoutClickOutside = signal(undefined);
84
+ clientHeight = signal(undefined);
85
+ itemsOfList = signal([]);
86
+ keySearchChange = new Subject();
87
+ keySearchChangeSub = signal(undefined);
88
+ tempIgnoreEmit = signal(false);
89
+ popoverFunctionControl = signal(undefined);
90
+ inputFunctionControl = signal(undefined);
91
+ typePopover = signal(undefined);
92
+ listFunctionControl = signal(undefined);
93
+ defaultItemsSelectedCurrent = signal(undefined);
94
+ onDestroy = new Subject();
95
+ // #region INPUT
96
+ classIncludePopover = input();
97
+ enterAutoAddTagToList = input(false);
98
+ checkExitIsLabelInclude = input();
99
+ checkExitByFields = input();
100
+ parentBorderWidth = input();
101
+ functionCheckPermissionCreateTag = input(() => true);
102
+ placeholder = input();
103
+ httpRequestDetailItemByIds = input();
104
+ fieldLabel = input('label');
105
+ maxItemInput = input();
106
+ zIndex = input(1000, { transform: (value) => value ?? 1000 });
107
+ config = input();
108
+ disable = input();
109
+ readonly = input();
110
+ labelConfig = input();
111
+ defaultItemsSelected = input();
112
+ defaultKeysSelected = input();
113
+ listSearchConfig = input();
114
+ isSearchOnline = input(false);
115
+ listSearchPadding = input();
116
+ listDividerClassInclude = input();
117
+ listConfig = input();
118
+ listButtonsOther = input();
119
+ listClickExactly = input();
120
+ listBackgroundListCustom = input();
121
+ listMaxItemShow = input();
122
+ listHiddenInputSearchWhenHasSearchConfig = input();
123
+ removeTextSearchWhenBlurInput = input(true);
124
+ keysHiddenItem = model();
125
+ keysDisableItem = input();
126
+ ignoreEmitWhenSameDataSelected = input();
127
+ singleSelected = input();
128
+ classIncludeTagItem = input();
129
+ classIconRemoveTagItem = input();
130
+ showBorderActiveWhenFocusInput = input();
131
+ fieldGetImage = input();
132
+ imageSize = input(16);
133
+ linkImageError = input();
134
+ fieldGetTextAvatar = input('user');
135
+ classAvatarInclude = input();
136
+ getLastTextAfterSpace = input();
137
+ validRequired = input();
138
+ validMaxItemSelected = input();
139
+ validPattern = input();
140
+ showListBellow = input();
141
+ hiddenInputWhenReadonly = input();
142
+ // #region OUTPUT
143
+ outSelectMultiItem = output();
144
+ outValidEvent = output();
145
+ outFunctionsControl = output();
146
+ outClickButtonOther = output();
147
+ outShowListEvent = output();
148
+ outChangStageFlagMouse = output();
149
+ outLoadingGetDetailSelected = output();
150
+ /* VIEW CHILD */
151
+ tagsEl = viewChild.required('tagsEl');
152
+ /* INJECT*/
153
+ httpRequestService = inject(LibsUiHttpRequestService);
154
+ constructor() {
155
+ effect(() => {
156
+ const maxItemInput = this.maxItemInput();
157
+ untracked(() => {
158
+ this.disableWhenMaxItem.set(false);
159
+ if (maxItemInput && maxItemInput <= this.itemsSelected().length) {
160
+ this.disableWhenMaxItem.set(true);
161
+ }
162
+ });
163
+ });
164
+ effect(() => {
165
+ const listConfig = this.listConfig();
166
+ untracked(() => {
167
+ if (listConfig) {
168
+ this.fieldKey.set(getFieldKeyByType(listConfig, 'id'));
169
+ }
170
+ });
171
+ });
172
+ effect(() => {
173
+ const currentItems = this.defaultItemsSelected() || [];
174
+ untracked(() => {
175
+ const previousItems = this.defaultItemsSelectedCurrent() || [];
176
+ this.defaultItemsSelectedCurrent.set(this.defaultItemsSelected());
177
+ if (previousItems.length !== currentItems.length) {
178
+ this.updateItemsSelected(currentItems);
179
+ return;
180
+ }
181
+ for (const prevItem of previousItems) {
182
+ if (!currentItems.some((item) => get(item, this.fieldKey()) === get(prevItem, this.fieldKey()))) {
183
+ this.updateItemsSelected(currentItems);
184
+ break;
185
+ }
186
+ }
187
+ });
188
+ });
189
+ effect(() => {
190
+ const currentValue = this.defaultKeysSelected() || [];
191
+ untracked(() => {
192
+ const previousValue = this.keysSelected() || [];
193
+ if (previousValue.length !== currentValue.length) {
194
+ this.getDetailByIds(currentValue);
195
+ return;
196
+ }
197
+ const keysNew = currentValue.filter((key) => !this.itemsSelected().some((item) => get(item, this.fieldKey(), '') === key));
198
+ if (keysNew.length) {
199
+ this.getDetailByIds(keysNew);
200
+ }
201
+ });
202
+ });
203
+ effect(() => {
204
+ let listKeyDisable = [];
205
+ const keysDisableItem = this.keysDisableItem();
206
+ const itemsSelected = this.itemsSelected();
207
+ untracked(() => {
208
+ if (keysDisableItem?.length) {
209
+ listKeyDisable = [...keysDisableItem];
210
+ }
211
+ itemsSelected.forEach((item) => {
212
+ if (item.disableItem && !listKeyDisable.find((key) => key === item[this.fieldKey()])) {
213
+ listKeyDisable.push(item[this.fieldKey()]);
214
+ }
215
+ });
216
+ this.listKeyDisable.set(listKeyDisable);
217
+ });
218
+ });
219
+ }
220
+ ngOnInit() {
221
+ if (!this.config()) {
222
+ return;
223
+ }
224
+ const httpRequestDetailItemByIds = this.httpRequestDetailItemByIds();
225
+ if (httpRequestDetailItemByIds && (!httpRequestDetailItemByIds.guideAutoUpdateArgumentsValue || !httpRequestDetailItemByIds.guideAutoUpdateArgumentsValue?.detailById)) {
226
+ throw 'Config getDetailByIds yêu cầu tối thiểu các tham số guideAutoUpdateArgumentsValue, detailById';
227
+ }
228
+ const preprocessor = (keys) => {
229
+ if (!keys || !(keys instanceof Array) || !keys.length) {
230
+ return '';
231
+ }
232
+ return keys.join(';');
233
+ };
234
+ if (httpRequestDetailItemByIds?.guideAutoUpdateArgumentsValue?.detailById) {
235
+ httpRequestDetailItemByIds.guideAutoUpdateArgumentsValue.detailById.fieldGetValue = httpRequestDetailItemByIds.guideAutoUpdateArgumentsValue.detailById.fieldGetValue ?? 'keys';
236
+ httpRequestDetailItemByIds.guideAutoUpdateArgumentsValue.detailById.preprocessor = httpRequestDetailItemByIds.guideAutoUpdateArgumentsValue.detailById.preprocessor ?? preprocessor;
237
+ }
238
+ this.outFunctionsControl.emit(this.FunctionsControl);
239
+ }
240
+ get FunctionsControl() {
241
+ return {
242
+ checkIsValid: this.checkValid.bind(this),
243
+ removeList: async () => this.popoverFunctionControl()?.removePopoverOverlay(),
244
+ updateLabel: this.updateLabel.bind(this),
245
+ clearItemSelected: this.clearItemSelected.bind(this),
246
+ clearKeySearch: () => this.handlerValueChangeSearch(''),
247
+ focusInput: () => this.focusInput(),
248
+ getFakeId: async () => this.fakeId(),
249
+ createTag: this.handlerEnterEvent.bind(this),
250
+ removeItemSelected: this.handlerRemoveItemSelected.bind(this),
251
+ resetError: this.resetError.bind(this),
252
+ resetToDefaultDataSelected: this.resetToDefaultDataSelected.bind(this),
253
+ updateItemSelectedDisable: this.updateItemSelectedDisable.bind(this),
254
+ refreshListData: this.refreshListData.bind(this),
255
+ setError: this.setError.bind(this),
256
+ };
257
+ }
258
+ async setError(message) {
259
+ this.error.set({ message });
260
+ }
261
+ handlerPopoverFunctionControlEvent(event) {
262
+ this.popoverFunctionControl.set(event);
263
+ }
264
+ async updateLabel() {
265
+ if (!this.itemsSelected() || !this.itemsSelected().length) {
266
+ return;
267
+ }
268
+ this.itemsSelected.update((items) => {
269
+ items.forEach((item) => this.updateFieldLabel(item));
270
+ return [...items];
271
+ });
272
+ }
273
+ updateFieldLabel(item) {
274
+ const ref = get(item, 'ref') || item;
275
+ const getValue = this.config()?.getValue;
276
+ set(item, 'fieldLabel', `${get(ref, this.fieldLabel()) || get(ref, 'label') || get(ref, 'name') || ' '}`);
277
+ if (getValue) {
278
+ set(item, 'fieldLabel', getValue(ref) || ' ');
279
+ }
280
+ }
281
+ async clearItemSelected(ignoreValid = false) {
282
+ if (!this.itemsSelected() || !this.itemsSelected().length) {
283
+ return;
284
+ }
285
+ const length = this.itemsSelected().length - 1;
286
+ this.tempIgnoreEmit.set(true);
287
+ this.itemsSelected().forEach((item, index) => {
288
+ if (index === length) {
289
+ this.tempIgnoreEmit.set(false);
290
+ }
291
+ this.handlerRemoveItemSelected({
292
+ stopPropagation: () => {
293
+ return;
294
+ },
295
+ }, item, ignoreValid);
296
+ });
297
+ }
298
+ updateItemsSelected(itemsSelected, ignoreValidate = true, ignoreEmitKeySelectedWhenItemsNotExitsEmpty) {
299
+ if (!itemsSelected || !itemsSelected.length) {
300
+ return;
301
+ }
302
+ const itemsNotExits = [];
303
+ itemsSelected.forEach((item) => {
304
+ if (!item) {
305
+ return;
306
+ }
307
+ let fieldLabel = `${get(item, this.fieldLabel()) || get(item, 'label') || get(item, 'name') || ' '}`;
308
+ const getValue = this.config()?.getValue;
309
+ if (getValue) {
310
+ fieldLabel = getValue(item) || ' ';
311
+ }
312
+ const itemExits = this.checkExits(fieldLabel, get(item, this.fieldKey()));
313
+ if (itemExits?.isItemSelected) {
314
+ Object.assign(itemExits.item, item);
315
+ return;
316
+ }
317
+ itemsNotExits.push(item);
318
+ });
319
+ this.processData(itemsNotExits, ignoreValidate, ignoreEmitKeySelectedWhenItemsNotExitsEmpty);
320
+ }
321
+ handlerPopoverEvent(type) {
322
+ this.typePopover.set(type);
323
+ if (type === 'click') {
324
+ return;
325
+ }
326
+ if (type === 'remove') {
327
+ this.showList.set(false);
328
+ this.outShowListEvent.emit(false);
329
+ this.inputFunctionControl()?.blur();
330
+ return;
331
+ }
332
+ this.showList.set(true);
333
+ this.outShowListEvent.emit(true);
334
+ this.inputFunctionControl()?.focus();
335
+ }
336
+ handlerPopoverContentEvent(position) {
337
+ if (this.positionList() === position) {
338
+ return;
339
+ }
340
+ this.positionList.set(position);
341
+ }
342
+ async handlerRemoveItemSelected(event, itemRemove, ignoreValid) {
343
+ event.stopPropagation();
344
+ this.flagMouse.set({ isMouseEnter: true, isMouseEnterContent: true });
345
+ this.timeOutFlag.set(setTimeout(() => this.flagMouse.set({ isMouseEnter: false, isMouseEnterContent: false }), 250));
346
+ this.itemsSelected.update((items) => items.filter((item) => {
347
+ const keyRemove = get(itemRemove, this.fieldKey());
348
+ const keyItem = get(item, this.fieldKey());
349
+ const labelRemove = get(itemRemove, 'fieldLabel').trim();
350
+ const labelItem = get(item, 'fieldLabel').trim();
351
+ return ((isNil(keyRemove) || isNil(keyItem)) && labelRemove !== labelItem) || (!isNil(keyRemove) && !isNil(keyItem) && keyRemove !== keyItem);
352
+ }));
353
+ if (itemRemove && !isNil(get(itemRemove, this.fieldKey())) && `${get(itemRemove, this.fieldKey())}`.search(this.fakeId()) >= 0) {
354
+ this.keysHiddenItem.update((items) => Array.from(new Set([...(items || []), get(itemRemove, this.fieldKey())])));
355
+ }
356
+ this.keysSelected.set(Array.from(new Set(this.itemsSelected().map((item) => get(item, `ref.${this.fieldKey()}`)))));
357
+ this.disableWhenMaxItem.set(false);
358
+ const maxItemInput = this.maxItemInput();
359
+ if (maxItemInput && maxItemInput <= this.itemsSelected().length) {
360
+ this.disableWhenMaxItem.set(true);
361
+ }
362
+ if (!this.showList()) {
363
+ this.outSelectMultiItem.emit(this.getItemSelected());
364
+ this.checkViewChange(true, ignoreValid);
365
+ return;
366
+ }
367
+ if (this.showList()) {
368
+ this.tempIgnoreEmit.set(true);
369
+ }
370
+ if (!ignoreValid) {
371
+ this.checkValid();
372
+ }
373
+ this.tempIgnoreEmit.set(false);
374
+ }
375
+ handlerInputFunctionControl(event) {
376
+ this.inputFunctionControl.set(event);
377
+ }
378
+ handlerFocusAndBlurEvent(event) {
379
+ this.focus.set(false);
380
+ if (event.name === 'focus') {
381
+ this.focus.set(true);
382
+ }
383
+ if (event.name === 'blur' && this.typePopover()?.includes('mouseleave') && this.validRequired() && (!this.itemsSelected() || !this.itemsSelected().length)) {
384
+ this.checkValid();
385
+ }
386
+ }
387
+ handlerClickOutside(event) {
388
+ event.stopPropagation();
389
+ clearTimeout(this.timeoutClickOutside());
390
+ this.timeoutClickOutside.set(setTimeout(() => {
391
+ if (this.showList() || !this.removeTextSearchWhenBlurInput()) {
392
+ return;
393
+ }
394
+ this.valueInput.set('');
395
+ this.keySearch.set('');
396
+ this.inputFunctionControl()?.resetValue();
397
+ }, 250));
398
+ }
399
+ async handlerEnterEvent() {
400
+ if (!this.valueInput() || !`${this.valueInput()}`.trim()) {
401
+ return;
402
+ }
403
+ if (this.config()?.ignoreEnterCreateNewItem) {
404
+ const itemExits = this.checkExits();
405
+ if (!itemExits || itemExits.isItemSelected) {
406
+ return;
407
+ }
408
+ this.processData([itemExits.item]);
409
+ this.handlerValueChangeSearch('');
410
+ return;
411
+ }
412
+ if (!this.functionCheckPermissionCreateTag()()) {
413
+ return;
414
+ }
415
+ const itemExits = this.checkExits();
416
+ const valueInput = `${this.valueInput()}`.trim();
417
+ const newItem = { [this.fieldLabel()]: valueInput };
418
+ if (this.fieldKey()) {
419
+ set(newItem, this.fieldKey(), `${this.fakeId()}${valueInput}${uuid()}`);
420
+ }
421
+ if (!itemExits) {
422
+ if (this.checkPattern([newItem])) {
423
+ const itemBuildValue = { ...newItem };
424
+ const buildValue = this.config()?.buildValue;
425
+ if (buildValue) {
426
+ buildValue(itemBuildValue, newItem[this.fieldLabel()]);
427
+ }
428
+ newItem[this.fieldLabel()] = itemBuildValue[this.fieldLabel()];
429
+ if (this.enterAutoAddTagToList()) {
430
+ this.listFunctionControl()?.updateData({ newData: signal([signal(newItem)]), functionCustomAddDataToStore: (newData, store) => store.update((value) => [...newData(), ...value]) });
431
+ }
432
+ this.processData([newItem]);
433
+ this.handlerValueChangeSearch('');
434
+ }
435
+ return;
436
+ }
437
+ if (itemExits.isItemSelected) {
438
+ return;
439
+ }
440
+ this.processData([itemExits.item]);
441
+ this.handlerValueChangeSearch('');
442
+ }
443
+ async handlerValueChangeSearch(value) {
444
+ this.valueInput.set(`${value}`);
445
+ if (!`${value || ''}`.trim()) {
446
+ this.keySearchChangeSub()?.unsubscribe();
447
+ this.keySearchChangeSub.set(undefined);
448
+ this.timeOutChangeSearch.set(setTimeout(() => this.keySearch.set('')));
449
+ if (!this.config()?.ignoreEnterCreateNewItem) {
450
+ this.checkValid();
451
+ }
452
+ return;
453
+ }
454
+ if (this.config()?.ignoreInput) {
455
+ return;
456
+ }
457
+ if (!this.keySearchChangeSub()) {
458
+ this.setEventKeySearch();
459
+ }
460
+ this.keySearchChange.next(`${value || ''}`.trim());
461
+ }
462
+ setEventKeySearch() {
463
+ if (this.keySearchChangeSub()) {
464
+ return;
465
+ }
466
+ this.keySearchChangeSub.set(this.keySearchChange.pipe(debounceTime(1500), takeUntil(this.onDestroy)).subscribe((value) => this.keySearch.set(`${value || ''}`.trim())));
467
+ }
468
+ processData(items, ignoreValidate = false, ignoreEmitKeySelectedWhenItemsNotExitsEmpty) {
469
+ if (!items || !items.length) {
470
+ const itemsSelected = this.getItemSelected();
471
+ if (!ignoreEmitKeySelectedWhenItemsNotExitsEmpty) {
472
+ this.outSelectMultiItem.emit(itemsSelected);
473
+ }
474
+ this.keysSelected.set(Array.from(new Set(itemsSelected?.map((item) => get(item, `ref.${this.fieldKey()}`)))));
475
+ this.checkViewChange(false, ignoreValidate);
476
+ return;
477
+ }
478
+ const itemsMapping = items.map((item) => {
479
+ const ref = get(item, 'ref') || item;
480
+ item = cloneDeep(ref);
481
+ set(item, 'ref', ref);
482
+ this.updateFieldLabel(item);
483
+ const { getDisableItem, getStyles, getStylesTagSpecific, getTooltip } = this.config() || {};
484
+ if (getDisableItem) {
485
+ set(item, 'disableItem', getDisableItem(item));
486
+ }
487
+ if (getStyles) {
488
+ set(item, 'ngStyles', getStyles(item));
489
+ }
490
+ if (getStylesTagSpecific) {
491
+ const type = getStylesTagSpecific(item);
492
+ if (type === 'specific_violet_color') {
493
+ set(item, 'ngStyles', { color: '#7239EA', backgroundColor: '#F1EBFD' });
494
+ }
495
+ }
496
+ if (getTooltip) {
497
+ set(item, 'tooltip', getTooltip(item));
498
+ }
499
+ return item;
500
+ });
501
+ this.itemsSelected.update((items) => [...items, ...itemsMapping]);
502
+ this.keysSelected.set(Array.from(new Set(this.itemsSelected().map((item) => get(item, `ref.${this.fieldKey()}`)))));
503
+ this.outSelectMultiItem.emit(this.getItemSelected());
504
+ this.checkViewChange(false, ignoreValidate);
505
+ }
506
+ handlerDataChange(items) {
507
+ this.itemsOfList.set(items);
508
+ this.popoverFunctionControl()?.updatePopoverOverlayPosition();
509
+ if (!this.config()?.ignoreInput) {
510
+ this.inputFunctionControl()?.focus();
511
+ }
512
+ }
513
+ handlerLoading(event) {
514
+ this.loading.set(event);
515
+ }
516
+ checkViewChange(ignoreScrollBottom, ignoreValidate = false) {
517
+ this.disableWhenMaxItem.set(false);
518
+ const maxItemInput = this.maxItemInput();
519
+ if (maxItemInput && maxItemInput <= this.itemsSelected().length) {
520
+ this.disableWhenMaxItem.set(true);
521
+ }
522
+ this.timeOutCheckViewChange.set(setTimeout(() => {
523
+ const scrollHeight = this.tagsEl()?.nativeElement.scrollHeight;
524
+ if (!isNil(scrollHeight) && this.clientHeight() !== scrollHeight && this.positionList() !== 'top') {
525
+ this.popoverFunctionControl()?.updatePopoverOverlayPosition();
526
+ }
527
+ if (!ignoreScrollBottom && this.tagsEl() && this.tagsEl().nativeElement) {
528
+ this.tagsEl().nativeElement.scrollTop = scrollHeight;
529
+ }
530
+ this.clientHeight.set(scrollHeight);
531
+ }, 250));
532
+ if (!ignoreValidate) {
533
+ this.checkValid();
534
+ }
535
+ }
536
+ checkExits(label, id) {
537
+ let itemExits;
538
+ if (!isNil(id) && !`${id}`.includes(this.fakeId()) && this.fieldKey()) {
539
+ itemExits = this.itemsSelected().find((item) => !isNil(get(item, this.fieldKey())) && `${get(item, this.fieldKey())}`.trim() === `${id}`);
540
+ if (itemExits) {
541
+ return { item: itemExits, isItemSelected: !!itemExits };
542
+ }
543
+ return;
544
+ }
545
+ if (!label) {
546
+ label = `${this.valueInput() || ''}`.trim();
547
+ }
548
+ itemExits = this.itemsSelected().find((item) => (!isNil(get(item, 'fieldLabel')) && get(item, 'fieldLabel').trim() === label?.trim()) ||
549
+ (this.checkExitIsLabelInclude() && get(item, 'fieldLabel').trim().includes(label?.trim())) ||
550
+ (this.checkExitByFields() &&
551
+ this.checkExitByFields()?.some((field) => get(item, field)?.trim() === label?.trim() || get(item, field)?.trim() === escapeHtml(label?.trim() || '') || escapeHtml(get(item, field)?.trim() || ' ') === escapeHtml(label?.trim() || ''))));
552
+ if (itemExits) {
553
+ return { item: itemExits, isItemSelected: true };
554
+ }
555
+ itemExits = this.itemsOfList().find((item) => (!isNil(get(item, 'fieldLabel')) && get(item, 'fieldLabel').trim() === label?.trim()) ||
556
+ (this.checkExitIsLabelInclude() && get(item, 'fieldLabel').trim().includes(label?.trim())) ||
557
+ (this.checkExitByFields() &&
558
+ this.checkExitByFields()?.some((field) => get(item, field)?.trim() === label?.trim() || escapeHtml(get(item, field)?.trim() || ' ') === escapeHtml(label?.trim() || '') || get(item, field)?.trim() === escapeHtml(label?.trim() || ''))));
559
+ if (itemExits) {
560
+ return { item: itemExits, isItemSelected: false };
561
+ }
562
+ return;
563
+ }
564
+ handlerSelectedKey(event) {
565
+ if (!event || !event.item) {
566
+ return;
567
+ }
568
+ if (!isNil(event?.key)) {
569
+ this.popoverFunctionControl()?.removePopoverOverlay();
570
+ }
571
+ if (this.itemsSelected()[0]) {
572
+ this.tempIgnoreEmit.set(true);
573
+ this.handlerRemoveItemSelected({
574
+ stopPropagation: () => {
575
+ return;
576
+ },
577
+ }, this.itemsSelected()[0], this.itemsSelected()[0].disableItem);
578
+ this.tempIgnoreEmit.set(false);
579
+ }
580
+ this.updateItemsSelected([event.item], !!this.itemsSelected()[0]); // Bug #36075
581
+ }
582
+ getFlagEmitSelectedItem(keys) {
583
+ if (!this.ignoreEmitWhenSameDataSelected() || keys.length !== this.itemsSelected().length) {
584
+ return false;
585
+ }
586
+ for (const key of keys) {
587
+ if (!this.itemsSelected().some((item) => get(item, this.fieldKey()) === key)) {
588
+ return false;
589
+ }
590
+ }
591
+ return true;
592
+ }
593
+ async handlerSelectMultiKey(event) {
594
+ if (!event) {
595
+ return;
596
+ }
597
+ const keys = [];
598
+ const items = [];
599
+ if (event.keys && event.keys.length && (!event.mapKeys || !event.mapKeys.length)) {
600
+ keys.push(...event.keys);
601
+ }
602
+ const ignoreEmitKeySelectedWhenItemsNotExitsEmpty = this.getFlagEmitSelectedItem(cloneDeep(event.keys ?? []));
603
+ event.mapKeys.forEach((mapKey) => {
604
+ if (isNil(mapKey.key)) {
605
+ return;
606
+ }
607
+ if (mapKey.item) {
608
+ return items.push(mapKey.item);
609
+ }
610
+ if (!Array.isArray(this.itemsSelected())) {
611
+ return keys.push(mapKey.key);
612
+ }
613
+ const item = this.itemsSelected().find((item) => get(item, this.fieldKey()) === mapKey.key);
614
+ if (item) {
615
+ return items.push(item);
616
+ }
617
+ return keys.push(mapKey.key);
618
+ });
619
+ if (keys.length) {
620
+ const resultData = await this.getDetailByIds(keys, true);
621
+ items.push(...resultData);
622
+ }
623
+ const messageEmpty = this.validRequired()?.message || ERROR_MESSAGE_EMPTY_VALID;
624
+ let ignoreValidate = true;
625
+ if (messageEmpty === this.error()?.message) {
626
+ ignoreValidate = false;
627
+ }
628
+ const itemRemove = this.itemsSelected().find((itemSelected) => !isNil(get(itemSelected, this.fieldKey())) && !items.some((item) => get(itemSelected, this.fieldKey()) === get(item, this.fieldKey())));
629
+ this.itemsSelected.update((itemsSelected) => itemsSelected.filter((itemSelected) => isNil(get(itemSelected, this.fieldKey())) || (event.keys.length && items.some((item) => get(itemSelected, this.fieldKey()) === get(item, this.fieldKey())))));
630
+ if (itemRemove) {
631
+ if (this.enterAutoAddTagToList() && !isNil(get(itemRemove, this.fieldKey())) && `${get(itemRemove, this.fieldKey())}`.search(this.fakeId()) >= 0) {
632
+ this.keysHiddenItem.update((items) => [...(items || []), get(itemRemove, this.fieldKey())]);
633
+ }
634
+ }
635
+ if (!event.keys.length) {
636
+ this.checkValid();
637
+ this.keysSelected.set(Array.from(new Set(this.itemsSelected()?.map((item) => get(item, `ref.${this.fieldKey()}`)))));
638
+ this.outSelectMultiItem.emit(this.getItemSelected());
639
+ this.checkViewChange(false, ignoreValidate);
640
+ return;
641
+ }
642
+ this.updateItemsSelected(items, ignoreValidate, ignoreEmitKeySelectedWhenItemsNotExitsEmpty);
643
+ this.checkValid();
644
+ }
645
+ async getDetailByIds(keys, isResponseData) {
646
+ const httpRequestDetailItemByIds = this.httpRequestDetailItemByIds();
647
+ if (!httpRequestDetailItemByIds || this.loadingDetail() || !(keys instanceof Array) || !keys.length) {
648
+ return [];
649
+ }
650
+ this.updateLoadingDetail(true);
651
+ const cloneHttpDetailConfig = cloneDeep(httpRequestDetailItemByIds);
652
+ try {
653
+ const { argumentsValue, guideAutoUpdateArgumentsValue } = cloneHttpDetailConfig;
654
+ if (!guideAutoUpdateArgumentsValue || !guideAutoUpdateArgumentsValue.detailById) {
655
+ return [];
656
+ }
657
+ guideAutoUpdateArgumentsValue.detailById.fieldGetValue = 'keys';
658
+ this.httpRequestService.updateArguments(argumentsValue, { keys: keys }, {}, '', false, false, guideAutoUpdateArgumentsValue);
659
+ const result = (await this.httpRequestService.callApi(cloneHttpDetailConfig));
660
+ if (!isResponseData) {
661
+ this.updateItemsSelected(result.data || []);
662
+ this.updateLoadingDetail(false);
663
+ return [];
664
+ }
665
+ this.updateLoadingDetail(false);
666
+ return result.data || [];
667
+ }
668
+ catch (error) {
669
+ console.log(error);
670
+ this.updateLoadingDetail(false);
671
+ }
672
+ return [];
673
+ }
674
+ async checkValid() {
675
+ const valid = this.itemsSelected() && this.itemsSelected().length ? true : false;
676
+ const stateError = !!this.error();
677
+ this.error.set(undefined);
678
+ if (this.validRequired() && !valid) {
679
+ this.error.set({ ...this.validRequired(), message: this.validRequired()?.message || ERROR_MESSAGE_EMPTY_VALID });
680
+ }
681
+ if (!this.error()) {
682
+ this.checkPattern(this.itemsSelected());
683
+ this.checkMaxItemSelectedValid();
684
+ }
685
+ if (!this.tempIgnoreEmit()) {
686
+ this.outValidEvent.emit(!this.error());
687
+ }
688
+ if (stateError !== !!this.error()) {
689
+ this.popoverFunctionControl()?.updatePopoverOverlayPosition();
690
+ }
691
+ return !this.error();
692
+ }
693
+ checkMaxItemSelectedValid() {
694
+ const validMaxItemSelected = this.validMaxItemSelected();
695
+ if (validMaxItemSelected && this.itemsSelected().length > validMaxItemSelected.value) {
696
+ this.error.set({ ...validMaxItemSelected, message: validMaxItemSelected.message || ERROR_MESSAGE_MAX_VALID, interpolateParams: { value: validMaxItemSelected.value } });
697
+ return false;
698
+ }
699
+ return true;
700
+ }
701
+ checkPattern(items) {
702
+ const validPattern = this.validPattern();
703
+ if (!validPattern || !validPattern.length || !items || !items.length) {
704
+ return true;
705
+ }
706
+ for (const valid of validPattern) {
707
+ if (valid.pattern && items.some((item) => !valid.pattern.test(get(item, this.fieldLabel())))) {
708
+ this.error.set({ ...valid, message: valid.message || ERROR_MESSAGE_PATTEN_VALID });
709
+ return false;
710
+ }
711
+ }
712
+ return true;
713
+ }
714
+ handlerClickButtonOther(event) {
715
+ this.outClickButtonOther.emit(event);
716
+ }
717
+ getItemSelected() {
718
+ return this.itemsSelected().map((item) => {
719
+ const itemMap = { ...item };
720
+ if (!isNil(get(itemMap, this.fieldKey())) && `${get(itemMap, this.fieldKey())}`.search(this.fakeId()) === 0) {
721
+ set(itemMap, this.fieldKey(), '');
722
+ }
723
+ return itemMap;
724
+ });
725
+ }
726
+ async resetToDefaultDataSelected(itemSelected) {
727
+ if (itemSelected && Array.isArray(itemSelected)) {
728
+ this.itemsSelected.set([]);
729
+ this.updateItemsSelected(itemSelected);
730
+ return;
731
+ }
732
+ itemSelected = new Array();
733
+ if (!this.fieldKey()) {
734
+ return;
735
+ }
736
+ const defaultKeysSelected = this.defaultKeysSelected();
737
+ if (defaultKeysSelected && Array.isArray(defaultKeysSelected)) {
738
+ this.itemsSelected.set([]);
739
+ this.getDetailByIds(defaultKeysSelected);
740
+ return;
741
+ }
742
+ const defaultItemsSelected = this.defaultItemsSelected();
743
+ if (defaultItemsSelected && Array.isArray(defaultItemsSelected)) {
744
+ this.itemsSelected.set([]);
745
+ this.updateItemsSelected(defaultItemsSelected);
746
+ return;
747
+ }
748
+ }
749
+ handlerFunctionControlList(event) {
750
+ this.listFunctionControl.set(event);
751
+ }
752
+ async focusInput() {
753
+ this.inputFunctionControl()?.focus();
754
+ }
755
+ handlerChangeFlagMouse(event) {
756
+ this.outChangStageFlagMouse.emit(event);
757
+ }
758
+ handlerChangStageFlagMouse(flag) {
759
+ this.flagMouse.set(flag);
760
+ }
761
+ handlerClickTagItem(event) {
762
+ if (!this.showList()) {
763
+ return;
764
+ }
765
+ event.stopPropagation();
766
+ this.flagMouse.set({ isMouseEnter: true, isMouseEnterContent: true });
767
+ }
768
+ async resetError() {
769
+ this.error.set(undefined);
770
+ }
771
+ updateLoadingDetail(event) {
772
+ this.loadingDetail.set(event);
773
+ this.outLoadingGetDetailSelected.emit(event);
774
+ }
775
+ async updateItemSelectedDisable() {
776
+ const getDisableItem = this.config()?.getDisableItem;
777
+ if (!getDisableItem) {
778
+ return;
779
+ }
780
+ this.itemsSelected.update((itemsSelected) => itemsSelected.map((item) => ({ ...item, disableItem: getDisableItem(item) })));
781
+ }
782
+ async refreshListData() {
783
+ this.listFunctionControl()?.refresh();
784
+ }
785
+ ngOnDestroy() {
786
+ this.onDestroy.next();
787
+ this.onDestroy.complete();
788
+ if (this.timeOutFlag())
789
+ clearTimeout(this.timeOutFlag());
790
+ if (this.timeOutChangeSearch())
791
+ clearTimeout(this.timeOutChangeSearch());
792
+ if (this.timeOutCheckViewChange())
793
+ clearTimeout(this.timeOutCheckViewChange());
794
+ if (this.timeoutClickOutside())
795
+ clearTimeout(this.timeoutClickOutside());
796
+ if (this.keySearchChangeSub())
797
+ this.keySearchChangeSub()?.unsubscribe();
798
+ }
799
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsTagsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
800
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LibsUiComponentsTagsComponent, isStandalone: true, selector: "libs_ui-components-tags", inputs: { classIncludePopover: { classPropertyName: "classIncludePopover", publicName: "classIncludePopover", isSignal: true, isRequired: false, transformFunction: null }, enterAutoAddTagToList: { classPropertyName: "enterAutoAddTagToList", publicName: "enterAutoAddTagToList", isSignal: true, isRequired: false, transformFunction: null }, checkExitIsLabelInclude: { classPropertyName: "checkExitIsLabelInclude", publicName: "checkExitIsLabelInclude", isSignal: true, isRequired: false, transformFunction: null }, checkExitByFields: { classPropertyName: "checkExitByFields", publicName: "checkExitByFields", isSignal: true, isRequired: false, transformFunction: null }, parentBorderWidth: { classPropertyName: "parentBorderWidth", publicName: "parentBorderWidth", isSignal: true, isRequired: false, transformFunction: null }, functionCheckPermissionCreateTag: { classPropertyName: "functionCheckPermissionCreateTag", publicName: "functionCheckPermissionCreateTag", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, httpRequestDetailItemByIds: { classPropertyName: "httpRequestDetailItemByIds", publicName: "httpRequestDetailItemByIds", isSignal: true, isRequired: false, transformFunction: null }, fieldLabel: { classPropertyName: "fieldLabel", publicName: "fieldLabel", isSignal: true, isRequired: false, transformFunction: null }, maxItemInput: { classPropertyName: "maxItemInput", publicName: "maxItemInput", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, labelConfig: { classPropertyName: "labelConfig", publicName: "labelConfig", isSignal: true, isRequired: false, transformFunction: null }, defaultItemsSelected: { classPropertyName: "defaultItemsSelected", publicName: "defaultItemsSelected", isSignal: true, isRequired: false, transformFunction: null }, defaultKeysSelected: { classPropertyName: "defaultKeysSelected", publicName: "defaultKeysSelected", isSignal: true, isRequired: false, transformFunction: null }, listSearchConfig: { classPropertyName: "listSearchConfig", publicName: "listSearchConfig", isSignal: true, isRequired: false, transformFunction: null }, isSearchOnline: { classPropertyName: "isSearchOnline", publicName: "isSearchOnline", isSignal: true, isRequired: false, transformFunction: null }, listSearchPadding: { classPropertyName: "listSearchPadding", publicName: "listSearchPadding", isSignal: true, isRequired: false, transformFunction: null }, listDividerClassInclude: { classPropertyName: "listDividerClassInclude", publicName: "listDividerClassInclude", isSignal: true, isRequired: false, transformFunction: null }, listConfig: { classPropertyName: "listConfig", publicName: "listConfig", isSignal: true, isRequired: false, transformFunction: null }, listButtonsOther: { classPropertyName: "listButtonsOther", publicName: "listButtonsOther", isSignal: true, isRequired: false, transformFunction: null }, listClickExactly: { classPropertyName: "listClickExactly", publicName: "listClickExactly", isSignal: true, isRequired: false, transformFunction: null }, listBackgroundListCustom: { classPropertyName: "listBackgroundListCustom", publicName: "listBackgroundListCustom", isSignal: true, isRequired: false, transformFunction: null }, listMaxItemShow: { classPropertyName: "listMaxItemShow", publicName: "listMaxItemShow", isSignal: true, isRequired: false, transformFunction: null }, listHiddenInputSearchWhenHasSearchConfig: { classPropertyName: "listHiddenInputSearchWhenHasSearchConfig", publicName: "listHiddenInputSearchWhenHasSearchConfig", isSignal: true, isRequired: false, transformFunction: null }, removeTextSearchWhenBlurInput: { classPropertyName: "removeTextSearchWhenBlurInput", publicName: "removeTextSearchWhenBlurInput", isSignal: true, isRequired: false, transformFunction: null }, keysHiddenItem: { classPropertyName: "keysHiddenItem", publicName: "keysHiddenItem", isSignal: true, isRequired: false, transformFunction: null }, keysDisableItem: { classPropertyName: "keysDisableItem", publicName: "keysDisableItem", isSignal: true, isRequired: false, transformFunction: null }, ignoreEmitWhenSameDataSelected: { classPropertyName: "ignoreEmitWhenSameDataSelected", publicName: "ignoreEmitWhenSameDataSelected", isSignal: true, isRequired: false, transformFunction: null }, singleSelected: { classPropertyName: "singleSelected", publicName: "singleSelected", isSignal: true, isRequired: false, transformFunction: null }, classIncludeTagItem: { classPropertyName: "classIncludeTagItem", publicName: "classIncludeTagItem", isSignal: true, isRequired: false, transformFunction: null }, classIconRemoveTagItem: { classPropertyName: "classIconRemoveTagItem", publicName: "classIconRemoveTagItem", isSignal: true, isRequired: false, transformFunction: null }, showBorderActiveWhenFocusInput: { classPropertyName: "showBorderActiveWhenFocusInput", publicName: "showBorderActiveWhenFocusInput", isSignal: true, isRequired: false, transformFunction: null }, fieldGetImage: { classPropertyName: "fieldGetImage", publicName: "fieldGetImage", isSignal: true, isRequired: false, transformFunction: null }, imageSize: { classPropertyName: "imageSize", publicName: "imageSize", isSignal: true, isRequired: false, transformFunction: null }, linkImageError: { classPropertyName: "linkImageError", publicName: "linkImageError", isSignal: true, isRequired: false, transformFunction: null }, fieldGetTextAvatar: { classPropertyName: "fieldGetTextAvatar", publicName: "fieldGetTextAvatar", isSignal: true, isRequired: false, transformFunction: null }, classAvatarInclude: { classPropertyName: "classAvatarInclude", publicName: "classAvatarInclude", isSignal: true, isRequired: false, transformFunction: null }, getLastTextAfterSpace: { classPropertyName: "getLastTextAfterSpace", publicName: "getLastTextAfterSpace", isSignal: true, isRequired: false, transformFunction: null }, validRequired: { classPropertyName: "validRequired", publicName: "validRequired", isSignal: true, isRequired: false, transformFunction: null }, validMaxItemSelected: { classPropertyName: "validMaxItemSelected", publicName: "validMaxItemSelected", isSignal: true, isRequired: false, transformFunction: null }, validPattern: { classPropertyName: "validPattern", publicName: "validPattern", isSignal: true, isRequired: false, transformFunction: null }, showListBellow: { classPropertyName: "showListBellow", publicName: "showListBellow", isSignal: true, isRequired: false, transformFunction: null }, hiddenInputWhenReadonly: { classPropertyName: "hiddenInputWhenReadonly", publicName: "hiddenInputWhenReadonly", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { keysHiddenItem: "keysHiddenItemChange", outSelectMultiItem: "outSelectMultiItem", outValidEvent: "outValidEvent", outFunctionsControl: "outFunctionsControl", outClickButtonOther: "outClickButtonOther", outShowListEvent: "outShowListEvent", outChangStageFlagMouse: "outChangStageFlagMouse", outLoadingGetDetailSelected: "outLoadingGetDetailSelected" }, viewQueries: [{ propertyName: "tagsEl", first: true, predicate: ["tagsEl"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"flex flex-col w-full h-full\">\n @if (labelConfig(); as labelConfig) {\n <libs_ui-components-label\n [classInclude]=\"labelConfig.classInclude\"\n [labelLeft]=\"labelConfig.labelLeft\"\n [labelLeftClass]=\"labelConfig.labelLeftClass\"\n [required]=\"labelConfig.required\"\n [description]=\"labelConfig.description\"\n [descriptionClass]=\"labelConfig.descriptionClass\"\n [labelRight]=\"labelConfig.labelRight\"\n [labelRightClass]=\"labelConfig.labelRightClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [buttonsLeft]=\"labelConfig.buttonsLeft\"\n [buttonsRight]=\"labelConfig.buttonsRight\"\n [disableButtonsLeft]=\"labelConfig.disableButtonsLeft || disable() || loading() || loadingDetail()\"\n [disableButtonsRight]=\"labelConfig.disableButtonsRight || disable() || loading() || loadingDetail()\"\n [hasToggle]=\"labelConfig.hasToggle\"\n [toggleActive]=\"labelConfig.toggleActive\"\n [toggleActive]=\"labelConfig.toggleDisable || disable() || loading() || loadingDetail()\"\n [popover]=\"labelConfig.popover\"\n [iconPopoverClass]=\"labelConfig.iconPopoverClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [limitLength]=\"labelConfig.limitLength\"\n [buttonsDescription]=\"labelConfig.buttonsDescription\"\n [disableButtonsDescription]=\"labelConfig.disableButtonsDescription || disable()\"\n [buttonsDescriptionContainerClass]=\"labelConfig.buttonsDescriptionContainerClass\"\n [count]=\"labelConfig.count\" />\n }\n <libs_ui-components-popover\n class=\"w-full h-full\"\n [ignoreShowPopover]=\"disable() || readonly() || !!config()?.ignoreShowList || false\"\n [ignoreCursorPointerModeLikeClick]=\"true\"\n [elementRefCustom]=\"tagsEl\"\n [mode]=\"!config()?.ignoreInput ? 'click' : 'click-toggle'\"\n [ignoreHiddenPopoverContentWhenMouseLeave]=\"true\"\n [flagMouse]=\"flagMouse()\"\n [config]=\"{\n animationConfig: config()?.animationConfig || {},\n zIndex: zIndex(),\n widthByParent: true,\n parentBorderWidth: parentBorderWidth() ?? 0,\n maxHeight: 2048,\n maxWidth: 2048,\n direction: config()?.directionList || 'bottom',\n directionDistance: 2,\n template: !showListBellow() ? listViewEl : undefined,\n whiteTheme: true,\n ignoreArrow: true,\n classInclude: 'rounded-[4px] ' + classIncludePopover() + (!listConfig()?.ignoreShowDataWhenNotSearch || keySearch() ? ' libs-ui-border-general' : ''),\n position: { mode: 'start', distance: 0 },\n }\"\n (outFunctionsControl)=\"handlerPopoverFunctionControlEvent($event)\"\n (outEvent)=\"handlerPopoverEvent($event)\"\n (outEventPopoverContent)=\"handlerPopoverContentEvent($event)\"\n (outChangStageFlagMouse)=\"handlerChangeFlagMouse($event)\">\n <div\n class=\"relative\"\n [class.cursor-pointer]=\"!disable() && !readonly()\"\n [class.libs-ui-readonly]=\"readonly()\"\n [class.libs-ui-readonly-background]=\"readonly()\"\n [class.libs-ui-disable]=\"disable()\"\n [class.libs-ui-disable-background]=\"disable()\">\n @if (config()?.uiLikeDropdown) {\n <i\n class=\"flex text-[16px] absolute right-[16px] top-[8px] libs-ui-icon-move-right rotate-90 z-[1]\"\n [class.text-[#6a7383]]=\"!readonly() && !disable()\"\n [class.libs-ui-readonly]=\"readonly()\"\n [class.libs-ui-disable]=\"disable()\"></i>\n }\n <div\n #tagsEl\n [class]=\"'libs-ui-tags ' + (config()?.classInclude || '') + (readonly() ? config()?.classCustomWhenReadOnly || ' libs-ui-readonly' : '')\"\n [class.libs-ui-tags-not-popup]=\"(!showList() && !showBorderActiveWhenFocusInput()) || (!focus() && showBorderActiveWhenFocusInput())\"\n [class.libs-ui-tags-error]=\"!!error() && !config()?.ignoreShowError\"\n [class.!pr-[32px]]=\"config()?.uiLikeDropdown\"\n [class.libs-ui-readonly-background]=\"readonly()\"\n [class.libs-ui-disable-background]=\"disable()\"\n [class.libs-ui-border-primary-general]=\"focus() && showBorderActiveWhenFocusInput()\"\n LibsUiComponentsClickOutsideDirective\n LibsUiComponentsScrollOverlayDirective\n (outOutside)=\"handlerClickOutside($event)\">\n @for (item of itemsSelected(); track item[fieldKey()]) {\n <div\n LibsUiComponentsPopoverDirective\n [type]=\"item?.tooltip?.type || 'other'\"\n [config]=\"item?.tooltip?.config || { zIndex: zIndex() + 2 }\"\n [ignoreShowPopover]=\"!item?.tooltip || item.tooltip.ignoreShowPopover\"\n [ngStyle]=\"item?.bullet || item?.ngStyles\"\n [class]=\"classIncludeTagItem() || ''\"\n [class.libs-ui-tags-readonly]=\"item.disableItem\"\n [class.libs-ui-tags-item]=\"!item.disableItem\"\n [class.cursor-default]=\"disable() || readonly()\"\n (pointerdown)=\"handlerClickTagItem($event)\">\n @if (fieldGetImage() || config()?.fieldGetImage; as fieldGetImage) {\n <div class=\"flex items-center justify-center h-full\">\n <libs_ui-components-avatar\n [classInclude]=\"classAvatarInclude() || config()?.classAvatarInclude || 'mr-[8px]'\"\n [size]=\"imageSize() || config()?.imageSize\"\n [linkAvatar]=\"item[fieldGetImage]\"\n [linkAvatarError]=\"linkImageError() || config()?.linkImageError\"\n [idGenColor]=\"item[fieldGetTextAvatar() || config()?.fieldGetTextAvatar || '']\"\n [getLastTextAfterSpace]=\"getLastTextAfterSpace() || config()?.getLastTextAfterSpace\"\n [textAvatar]=\"item[fieldGetTextAvatar() || config()?.fieldGetTextAvatar || 'user']\" />\n </div>\n }\n @let constHtmlLabel = item.fieldLabel || ' ';\n <span\n class=\"libs-ui-font-h6r\"\n [innerHtml]=\"constHtmlLabel | translate\"></span>\n @if (!disable() && !item.disableItem && !readonly()) {\n <div class=\"flex items-center justify-center ml-[8px]\">\n @let constHtmlStyle = item?.bullet || item?.ngStyles;\n <i\n #iconCloseEl\n [attr.specificStyle]=\"!!constHtmlStyle\"\n [class]=\"'flex text-[16px] ' + (classIconRemoveTagItem() || 'libs-ui-icon-close')\"\n [class.cursor-pointer]=\"!disable() && !loading() && !loadingDetail()\"\n [class.pointer-events-none]=\"disable() || loading() || loadingDetail()\"\n [ngStyle]=\"constHtmlStyle | LibsUiComponentsTagsGetColorPipe: iconCloseEl\"\n (pointerdown)=\"handlerRemoveItemSelected($event, item)\"></i>\n </div>\n }\n </div>\n }\n @if (!singleSelected() || (singleSelected() && !itemsSelected().length)) {\n @if (!config()?.ignoreInput && !config()?.uiLikeDropdown && (!hiddenInputWhenReadonly() || (hiddenInputWhenReadonly() && !readonly()))) {\n <libs_ui-components-inputs-input\n class=\"grow\"\n [class.mb-[4px]]=\"itemsSelected().length\"\n [classInclude]=\"'w-full bg-transparent ' + (config()?.classInputInclude || 'px-[4px] min-w-[30px]')\"\n [defaultHeight]=\"24\"\n [placeholder]=\"readonly() ? '' : placeholder() || 'i18n_import_content'\"\n [noBorder]=\"true\"\n [(value)]=\"valueInput\"\n [disable]=\"disable() || loading() || loadingDetail() || disableWhenMaxItem()\"\n [readonly]=\"readonly()\"\n (outEnterEvent)=\"handlerEnterEvent()\"\n (valueChange)=\"handlerValueChangeSearch($event)\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlurEvent($event)\"\n (outFunctionsControl)=\"handlerInputFunctionControl($event)\" />\n }\n @if (config()?.ignoreInput && config()?.uiLikeDropdown && !itemsSelected().length) {\n <div\n class=\"flex items-center pb-[4px] pt-[2px] ml-[11px] libs-ui-font-h5r\"\n [class.text-[#9ca2ad]]=\"disable()\">\n @let constHtmlPlaceholder = placeholder() || 'i18n_select_value';\n {{ constHtmlPlaceholder | translate }}\n </div>\n }\n }\n </div>\n @if (error() && !config()?.ignoreShowError) {\n <div class=\"text-[#ee2d41] libs-ui-font-h7r mt-[8px]\">\n @let constHtmlMessage = error()?.message || ' ';\n {{ constHtmlMessage | translate: error()?.interpolateParams || {} }}\n </div>\n }\n </div>\n </libs_ui-components-popover>\n</div>\n@if (showListBellow()) {\n <ng-container *ngTemplateOutlet=\"listViewEl\"></ng-container>\n}\n<ng-template #listViewEl>\n @if (listConfig(); as listConfig) {\n <libs_ui-components-list\n [searchConfig]=\"listSearchConfig() || { classInclude: 'hidden', iconLeftClass: 'hidden' }\"\n [isSearchOnline]=\"isSearchOnline()\"\n [zIndex]=\"zIndex()\"\n [keySearch]=\"keySearch()\"\n [config]=\"listConfig\"\n [disable]=\"disable() || loadingDetail() || disableWhenMaxItem()\"\n [searchPadding]=\"listSearchPadding()\"\n [maxItemShow]=\"listMaxItemShow() || 6\"\n [multiKeySelected]=\"keysSelected()\"\n [clickExactly]=\"false\"\n [keysHiddenItem]=\"keysHiddenItem()\"\n [keysDisableItem]=\"listKeyDisable()\"\n [dividerClassInclude]=\"listDividerClassInclude() ?? 'hidden'\"\n [buttonsOther]=\"listButtonsOther()\"\n [backgroundListCustom]=\"listBackgroundListCustom()\"\n [functionGetItemsAutoAddList]=\"functionGetItemAutoAddList()\"\n [hiddenInputSearch]=\"listHiddenInputSearchWhenHasSearchConfig()\"\n (outFunctionsControl)=\"handlerFunctionControlList($event)\"\n (outSelectKey)=\"handlerSelectedKey($event)\"\n (outSelectMultiKey)=\"handlerSelectMultiKey($event)\"\n (outChangeView)=\"handlerDataChange($event)\"\n (outClickButtonOther)=\"handlerClickButtonOther($event)\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outLoading)=\"handlerLoading($event)\" />\n }\n</ng-template>\n", styles: [".libs-ui-tags{position:relative;display:flex;flex-wrap:wrap;border:1px solid var(--libs-ui-color-default, #226ff5);max-height:100px;overflow:auto;border-radius:4px;padding:3px 0 0 4px;min-height:32px}.libs-ui-tags-not-popup{border:1px solid #e6e7ea}.libs-ui-tags-error{border-color:#ff5454}.libs-ui-tags .libs-ui-tags-item{display:flex;align-items:center;margin:0 4px 3px 0;padding:4px 8px;color:var(--libs-ui-color-default, #226ff5);border-radius:20px;background-color:var(--libs-ui-color-light-2, #e9f1fe);word-break:break-word!important;overflow-wrap:break-word!important;cursor:default}.libs-ui-tags .libs-ui-tags-item i[class*=libs-ui-icon-],.libs-ui-tags .libs-ui-tags-item i[class*=icon-font-3rd]{border-radius:50%}.libs-ui-tags .libs-ui-tags-item i[class*=libs-ui-icon-]:before,.libs-ui-tags .libs-ui-tags-item i[class*=icon-font-3rd]:before{border-radius:50%;font-size:16px;color:var(--libs-ui-color-default, #226ff5)}.libs-ui-tags .libs-ui-tags-item i[class*=libs-ui-icon-]:hover:before,.libs-ui-tags .libs-ui-tags-item i[class*=icon-font-3rd]:hover:before{background:var(--libs-ui-color-light-6, #d3e2fd)}.libs-ui-tags .libs-ui-tags-item i[class*=libs-ui-icon-]:active:before,.libs-ui-tags .libs-ui-tags-item i[class*=icon-font-3rd]:active:before{background:var(--libs-ui-color-light-5, #bdd4fc)}.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=libs-ui-icon-],.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=icon-font-3rd]{border-radius:50%}.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=libs-ui-icon-]:before,.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=icon-font-3rd]:before{border-radius:50%;font-size:16px;color:var(--libs-ui-tags-item-icon-default)}.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=libs-ui-icon-]:hover:before,.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=icon-font-3rd]:hover:before{color:var(--libs-ui-tags-item-icon-hover);background:var(--libs-ui-tags-item-icon-background-hover)}.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=libs-ui-icon-]:active:before,.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=icon-font-3rd]:active:before{color:var(--libs-ui-tags-item-icon-active);background:var(--libs-ui-tags-item-icon-background-active)}.libs-ui-tags-disable{background:#f8f9fa;color:#9ca2ad}.libs-ui-tags-readonly{background:#f1ebfd;color:#7239ea;display:flex;align-items:center;margin:0 4px 4px 0;padding:4px 8px;border-radius:20px;word-break:break-word!important;overflow-wrap:break-word!important}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: LibsUiComponentsClickOutsideDirective, selector: "[LibsUiComponentsClickOutsideDirective]", outputs: ["outOutside", "outInSide"] }, { kind: "component", type: LibsUiComponentsLabelComponent, selector: "libs_ui-components-label", inputs: ["iconPopoverClass", "classInclude", "labelLeft", "labelLeftClass", "labelLeftBehindToggleButton", "popover", "required", "buttonsLeft", "disableButtonsLeft", "buttonsRight", "disableButtonsRight", "labelRight", "labelRightClass", "labelRightRequired", "hasToggle", "toggleSize", "toggleActive", "toggleDisable", "description", "descriptionClass", "buttonsDescription", "disableButtonsDescription", "buttonsDescriptionContainerClass", "onlyShowCount", "zIndexPopover", "timerDestroyPopover", "count", "limitLength"], outputs: ["outClickButton", "outSwitchEvent", "outLabelRightClick", "outLabelLeftClick"] }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "initEventInElementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsInputsInputComponent, selector: "libs_ui-components-inputs-input", inputs: ["tagInput", "dataType", "typeInput", "modeInput", "tabInsertContentTagInput", "textAreaEnterNotNewLine", "emitEmptyInDataTypeNumber", "keepZeroInTypeInt", "autoAddZeroLessThan10InTypeInt", "ignoreBlockInputMaxValue", "maxValueNumber", "minValueNumber", "fixedFloat", "acceptNegativeValue", "valueUpDownNumber", "classInclude", "maxLength", "readonly", "disable", "noBorder", "backgroundNone", "borderError", "useColorModeExist", "placeholder", "keepPlaceholderOnly", "value", "autoRemoveEmoji", "defaultHeight", "minHeightTextArea", "maxHeightTextArea", "focusTimeOut", "selectAllTimeOut", "blurTimeOut", "zIndexPopoverContent", "classContainerInput", "showCount", "ignoreStopPropagationEvent", "resize", "templateLeftBottomInput", "templateRightBottomInput", "classContainerBottomInput", "ignoreWidthInput100", "iframeTextareaCustomStyle", "iconLeftClass", "popoverContentIconLeft", "iconRightClass", "popoverContentIconRight", "resetAutoCompletePassword", "acceptOnlyClickIcon", "setIconRightColorSameColorDisableReadOnly", "onlyAcceptNegativeValue", "maxLengthNumberCount", "focusInput"], outputs: ["maxValueNumberChange", "minValueNumberChange", "fixedFloatChange", "acceptNegativeValueChange", "maxLengthChange", "valueChange", "maxLengthNumberCountChange", "outHeightAreaChange", "outChange", "outFocusAndBlurEvent", "outEnterEvent", "outInputEvent", "outIconLeft", "outIconRight", "outFunctionsControl", "outFilesDrop", "outFileDrop", "outChangeValueByButtonUpDown"] }, { kind: "component", type: LibsUiComponentsAvatarComponent, selector: "libs_ui-components-avatar", inputs: ["typeShape", "classInclude", "size", "linkAvatar", "linkAvatarError", "classImageInclude", "zIndexPreviewImage", "clickPreviewImage", "idGenColor", "getLastTextAfterSpace", "textAvatar", "textAvatarClassInclude", "containertextAvatarClassInclude"], outputs: ["outAvatarError", "outEventPreviewImage"] }, { kind: "component", type: LibsUiComponentsListComponent, selector: "libs_ui-components-list", inputs: ["hiddenInputSearch", "dropdownTabKeyActive", "keySearch", "paddingLeftItem", "config", "autoSelectedFirstItemCallOutsideBefore", "isSearchOnline", "disable", "disableLabel", "labelConfig", "searchConfig", "searchPadding", "dividerClassInclude", "hasDivider", "buttonsOther", "hasButtonUnSelectOption", "clickExactly", "backgroundListCustom", "maxItemShow", "keySelected", "multiKeySelected", "keysDisableItem", "keysHiddenItem", "focusInputSearch", "skipFocusInputWhenKeySearchStoreUndefined", "functionGetItemsAutoAddList", "validRequired", "showValidateBottom", "zIndex", "loadingIconSize", "templateRefSearchNoData", "resetKeyWhenSelectAllKeyDropdown", "ignoreClassDisableDefaultWhenUseKeysDisableItem"], outputs: ["outSelectKey", "outSelectMultiKey", "outUnSelectMultiKey", "outClickButtonOther", "outFieldKey", "outChangeView", "outKeySearch", "outLoading", "outFunctionsControl", "outChangStageFlagMousePopover", "outLoadItemsComplete"] }, { kind: "pipe", type: LibsUiComponentsTagsGetColorPipe, name: "LibsUiComponentsTagsGetColorPipe" }, { kind: "directive", type: LibsUiComponentsScrollOverlayDirective, selector: "[LibsUiComponentsScrollOverlayDirective]", inputs: ["debugMode", "ignoreInit", "classContainer", "options", "elementCheckScrollX", "elementCheckScrollY", "elementScroll"], outputs: ["outScroll", "outScrollX", "outScrollY", "outScrollTop", "outScrollBottom"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
801
+ }
802
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsTagsComponent, decorators: [{
803
+ type: Component,
804
+ args: [{ selector: 'libs_ui-components-tags', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
805
+ TranslateModule,
806
+ NgTemplateOutlet,
807
+ NgStyle,
808
+ LibsUiComponentsClickOutsideDirective,
809
+ LibsUiComponentsLabelComponent,
810
+ LibsUiComponentsPopoverComponent,
811
+ LibsUiComponentsInputsInputComponent,
812
+ LibsUiComponentsAvatarComponent,
813
+ LibsUiComponentsListComponent,
814
+ LibsUiComponentsTagsGetColorPipe,
815
+ LibsUiComponentsScrollOverlayDirective,
816
+ ], template: "<div class=\"flex flex-col w-full h-full\">\n @if (labelConfig(); as labelConfig) {\n <libs_ui-components-label\n [classInclude]=\"labelConfig.classInclude\"\n [labelLeft]=\"labelConfig.labelLeft\"\n [labelLeftClass]=\"labelConfig.labelLeftClass\"\n [required]=\"labelConfig.required\"\n [description]=\"labelConfig.description\"\n [descriptionClass]=\"labelConfig.descriptionClass\"\n [labelRight]=\"labelConfig.labelRight\"\n [labelRightClass]=\"labelConfig.labelRightClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [buttonsLeft]=\"labelConfig.buttonsLeft\"\n [buttonsRight]=\"labelConfig.buttonsRight\"\n [disableButtonsLeft]=\"labelConfig.disableButtonsLeft || disable() || loading() || loadingDetail()\"\n [disableButtonsRight]=\"labelConfig.disableButtonsRight || disable() || loading() || loadingDetail()\"\n [hasToggle]=\"labelConfig.hasToggle\"\n [toggleActive]=\"labelConfig.toggleActive\"\n [toggleActive]=\"labelConfig.toggleDisable || disable() || loading() || loadingDetail()\"\n [popover]=\"labelConfig.popover\"\n [iconPopoverClass]=\"labelConfig.iconPopoverClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [limitLength]=\"labelConfig.limitLength\"\n [buttonsDescription]=\"labelConfig.buttonsDescription\"\n [disableButtonsDescription]=\"labelConfig.disableButtonsDescription || disable()\"\n [buttonsDescriptionContainerClass]=\"labelConfig.buttonsDescriptionContainerClass\"\n [count]=\"labelConfig.count\" />\n }\n <libs_ui-components-popover\n class=\"w-full h-full\"\n [ignoreShowPopover]=\"disable() || readonly() || !!config()?.ignoreShowList || false\"\n [ignoreCursorPointerModeLikeClick]=\"true\"\n [elementRefCustom]=\"tagsEl\"\n [mode]=\"!config()?.ignoreInput ? 'click' : 'click-toggle'\"\n [ignoreHiddenPopoverContentWhenMouseLeave]=\"true\"\n [flagMouse]=\"flagMouse()\"\n [config]=\"{\n animationConfig: config()?.animationConfig || {},\n zIndex: zIndex(),\n widthByParent: true,\n parentBorderWidth: parentBorderWidth() ?? 0,\n maxHeight: 2048,\n maxWidth: 2048,\n direction: config()?.directionList || 'bottom',\n directionDistance: 2,\n template: !showListBellow() ? listViewEl : undefined,\n whiteTheme: true,\n ignoreArrow: true,\n classInclude: 'rounded-[4px] ' + classIncludePopover() + (!listConfig()?.ignoreShowDataWhenNotSearch || keySearch() ? ' libs-ui-border-general' : ''),\n position: { mode: 'start', distance: 0 },\n }\"\n (outFunctionsControl)=\"handlerPopoverFunctionControlEvent($event)\"\n (outEvent)=\"handlerPopoverEvent($event)\"\n (outEventPopoverContent)=\"handlerPopoverContentEvent($event)\"\n (outChangStageFlagMouse)=\"handlerChangeFlagMouse($event)\">\n <div\n class=\"relative\"\n [class.cursor-pointer]=\"!disable() && !readonly()\"\n [class.libs-ui-readonly]=\"readonly()\"\n [class.libs-ui-readonly-background]=\"readonly()\"\n [class.libs-ui-disable]=\"disable()\"\n [class.libs-ui-disable-background]=\"disable()\">\n @if (config()?.uiLikeDropdown) {\n <i\n class=\"flex text-[16px] absolute right-[16px] top-[8px] libs-ui-icon-move-right rotate-90 z-[1]\"\n [class.text-[#6a7383]]=\"!readonly() && !disable()\"\n [class.libs-ui-readonly]=\"readonly()\"\n [class.libs-ui-disable]=\"disable()\"></i>\n }\n <div\n #tagsEl\n [class]=\"'libs-ui-tags ' + (config()?.classInclude || '') + (readonly() ? config()?.classCustomWhenReadOnly || ' libs-ui-readonly' : '')\"\n [class.libs-ui-tags-not-popup]=\"(!showList() && !showBorderActiveWhenFocusInput()) || (!focus() && showBorderActiveWhenFocusInput())\"\n [class.libs-ui-tags-error]=\"!!error() && !config()?.ignoreShowError\"\n [class.!pr-[32px]]=\"config()?.uiLikeDropdown\"\n [class.libs-ui-readonly-background]=\"readonly()\"\n [class.libs-ui-disable-background]=\"disable()\"\n [class.libs-ui-border-primary-general]=\"focus() && showBorderActiveWhenFocusInput()\"\n LibsUiComponentsClickOutsideDirective\n LibsUiComponentsScrollOverlayDirective\n (outOutside)=\"handlerClickOutside($event)\">\n @for (item of itemsSelected(); track item[fieldKey()]) {\n <div\n LibsUiComponentsPopoverDirective\n [type]=\"item?.tooltip?.type || 'other'\"\n [config]=\"item?.tooltip?.config || { zIndex: zIndex() + 2 }\"\n [ignoreShowPopover]=\"!item?.tooltip || item.tooltip.ignoreShowPopover\"\n [ngStyle]=\"item?.bullet || item?.ngStyles\"\n [class]=\"classIncludeTagItem() || ''\"\n [class.libs-ui-tags-readonly]=\"item.disableItem\"\n [class.libs-ui-tags-item]=\"!item.disableItem\"\n [class.cursor-default]=\"disable() || readonly()\"\n (pointerdown)=\"handlerClickTagItem($event)\">\n @if (fieldGetImage() || config()?.fieldGetImage; as fieldGetImage) {\n <div class=\"flex items-center justify-center h-full\">\n <libs_ui-components-avatar\n [classInclude]=\"classAvatarInclude() || config()?.classAvatarInclude || 'mr-[8px]'\"\n [size]=\"imageSize() || config()?.imageSize\"\n [linkAvatar]=\"item[fieldGetImage]\"\n [linkAvatarError]=\"linkImageError() || config()?.linkImageError\"\n [idGenColor]=\"item[fieldGetTextAvatar() || config()?.fieldGetTextAvatar || '']\"\n [getLastTextAfterSpace]=\"getLastTextAfterSpace() || config()?.getLastTextAfterSpace\"\n [textAvatar]=\"item[fieldGetTextAvatar() || config()?.fieldGetTextAvatar || 'user']\" />\n </div>\n }\n @let constHtmlLabel = item.fieldLabel || ' ';\n <span\n class=\"libs-ui-font-h6r\"\n [innerHtml]=\"constHtmlLabel | translate\"></span>\n @if (!disable() && !item.disableItem && !readonly()) {\n <div class=\"flex items-center justify-center ml-[8px]\">\n @let constHtmlStyle = item?.bullet || item?.ngStyles;\n <i\n #iconCloseEl\n [attr.specificStyle]=\"!!constHtmlStyle\"\n [class]=\"'flex text-[16px] ' + (classIconRemoveTagItem() || 'libs-ui-icon-close')\"\n [class.cursor-pointer]=\"!disable() && !loading() && !loadingDetail()\"\n [class.pointer-events-none]=\"disable() || loading() || loadingDetail()\"\n [ngStyle]=\"constHtmlStyle | LibsUiComponentsTagsGetColorPipe: iconCloseEl\"\n (pointerdown)=\"handlerRemoveItemSelected($event, item)\"></i>\n </div>\n }\n </div>\n }\n @if (!singleSelected() || (singleSelected() && !itemsSelected().length)) {\n @if (!config()?.ignoreInput && !config()?.uiLikeDropdown && (!hiddenInputWhenReadonly() || (hiddenInputWhenReadonly() && !readonly()))) {\n <libs_ui-components-inputs-input\n class=\"grow\"\n [class.mb-[4px]]=\"itemsSelected().length\"\n [classInclude]=\"'w-full bg-transparent ' + (config()?.classInputInclude || 'px-[4px] min-w-[30px]')\"\n [defaultHeight]=\"24\"\n [placeholder]=\"readonly() ? '' : placeholder() || 'i18n_import_content'\"\n [noBorder]=\"true\"\n [(value)]=\"valueInput\"\n [disable]=\"disable() || loading() || loadingDetail() || disableWhenMaxItem()\"\n [readonly]=\"readonly()\"\n (outEnterEvent)=\"handlerEnterEvent()\"\n (valueChange)=\"handlerValueChangeSearch($event)\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlurEvent($event)\"\n (outFunctionsControl)=\"handlerInputFunctionControl($event)\" />\n }\n @if (config()?.ignoreInput && config()?.uiLikeDropdown && !itemsSelected().length) {\n <div\n class=\"flex items-center pb-[4px] pt-[2px] ml-[11px] libs-ui-font-h5r\"\n [class.text-[#9ca2ad]]=\"disable()\">\n @let constHtmlPlaceholder = placeholder() || 'i18n_select_value';\n {{ constHtmlPlaceholder | translate }}\n </div>\n }\n }\n </div>\n @if (error() && !config()?.ignoreShowError) {\n <div class=\"text-[#ee2d41] libs-ui-font-h7r mt-[8px]\">\n @let constHtmlMessage = error()?.message || ' ';\n {{ constHtmlMessage | translate: error()?.interpolateParams || {} }}\n </div>\n }\n </div>\n </libs_ui-components-popover>\n</div>\n@if (showListBellow()) {\n <ng-container *ngTemplateOutlet=\"listViewEl\"></ng-container>\n}\n<ng-template #listViewEl>\n @if (listConfig(); as listConfig) {\n <libs_ui-components-list\n [searchConfig]=\"listSearchConfig() || { classInclude: 'hidden', iconLeftClass: 'hidden' }\"\n [isSearchOnline]=\"isSearchOnline()\"\n [zIndex]=\"zIndex()\"\n [keySearch]=\"keySearch()\"\n [config]=\"listConfig\"\n [disable]=\"disable() || loadingDetail() || disableWhenMaxItem()\"\n [searchPadding]=\"listSearchPadding()\"\n [maxItemShow]=\"listMaxItemShow() || 6\"\n [multiKeySelected]=\"keysSelected()\"\n [clickExactly]=\"false\"\n [keysHiddenItem]=\"keysHiddenItem()\"\n [keysDisableItem]=\"listKeyDisable()\"\n [dividerClassInclude]=\"listDividerClassInclude() ?? 'hidden'\"\n [buttonsOther]=\"listButtonsOther()\"\n [backgroundListCustom]=\"listBackgroundListCustom()\"\n [functionGetItemsAutoAddList]=\"functionGetItemAutoAddList()\"\n [hiddenInputSearch]=\"listHiddenInputSearchWhenHasSearchConfig()\"\n (outFunctionsControl)=\"handlerFunctionControlList($event)\"\n (outSelectKey)=\"handlerSelectedKey($event)\"\n (outSelectMultiKey)=\"handlerSelectMultiKey($event)\"\n (outChangeView)=\"handlerDataChange($event)\"\n (outClickButtonOther)=\"handlerClickButtonOther($event)\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outLoading)=\"handlerLoading($event)\" />\n }\n</ng-template>\n", styles: [".libs-ui-tags{position:relative;display:flex;flex-wrap:wrap;border:1px solid var(--libs-ui-color-default, #226ff5);max-height:100px;overflow:auto;border-radius:4px;padding:3px 0 0 4px;min-height:32px}.libs-ui-tags-not-popup{border:1px solid #e6e7ea}.libs-ui-tags-error{border-color:#ff5454}.libs-ui-tags .libs-ui-tags-item{display:flex;align-items:center;margin:0 4px 3px 0;padding:4px 8px;color:var(--libs-ui-color-default, #226ff5);border-radius:20px;background-color:var(--libs-ui-color-light-2, #e9f1fe);word-break:break-word!important;overflow-wrap:break-word!important;cursor:default}.libs-ui-tags .libs-ui-tags-item i[class*=libs-ui-icon-],.libs-ui-tags .libs-ui-tags-item i[class*=icon-font-3rd]{border-radius:50%}.libs-ui-tags .libs-ui-tags-item i[class*=libs-ui-icon-]:before,.libs-ui-tags .libs-ui-tags-item i[class*=icon-font-3rd]:before{border-radius:50%;font-size:16px;color:var(--libs-ui-color-default, #226ff5)}.libs-ui-tags .libs-ui-tags-item i[class*=libs-ui-icon-]:hover:before,.libs-ui-tags .libs-ui-tags-item i[class*=icon-font-3rd]:hover:before{background:var(--libs-ui-color-light-6, #d3e2fd)}.libs-ui-tags .libs-ui-tags-item i[class*=libs-ui-icon-]:active:before,.libs-ui-tags .libs-ui-tags-item i[class*=icon-font-3rd]:active:before{background:var(--libs-ui-color-light-5, #bdd4fc)}.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=libs-ui-icon-],.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=icon-font-3rd]{border-radius:50%}.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=libs-ui-icon-]:before,.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=icon-font-3rd]:before{border-radius:50%;font-size:16px;color:var(--libs-ui-tags-item-icon-default)}.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=libs-ui-icon-]:hover:before,.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=icon-font-3rd]:hover:before{color:var(--libs-ui-tags-item-icon-hover);background:var(--libs-ui-tags-item-icon-background-hover)}.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=libs-ui-icon-]:active:before,.libs-ui-tags .libs-ui-tags-item [specificStyle=true] i[class*=icon-font-3rd]:active:before{color:var(--libs-ui-tags-item-icon-active);background:var(--libs-ui-tags-item-icon-background-active)}.libs-ui-tags-disable{background:#f8f9fa;color:#9ca2ad}.libs-ui-tags-readonly{background:#f1ebfd;color:#7239ea;display:flex;align-items:center;margin:0 4px 4px 0;padding:4px 8px;border-radius:20px;word-break:break-word!important;overflow-wrap:break-word!important}\n"] }]
817
+ }], ctorParameters: () => [] });
818
+
819
+ /**
820
+ * Generated bundle index. Do not edit.
821
+ */
822
+
823
+ export { LibsUiComponentsTagsComponent };
824
+ //# sourceMappingURL=libs-ui-components-tags.mjs.map