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