@libs-ui/components-list 0.2.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/defines/list.define.d.ts +6 -0
- package/esm2022/defines/list.define.mjs +66 -0
- package/esm2022/highlight-key-search/highlight-key-search.directive.mjs +82 -0
- package/esm2022/index.mjs +3 -0
- package/esm2022/interfaces/config-item.interface.mjs +2 -0
- package/esm2022/interfaces/data-emit.interface.mjs +3 -0
- package/esm2022/interfaces/function-control-event.interface.mjs +2 -0
- package/esm2022/interfaces/index.mjs +6 -0
- package/esm2022/interfaces/tab.interface.mjs +2 -0
- package/esm2022/interfaces/templates-type.type.mjs +2 -0
- package/esm2022/libs-ui-components-list.mjs +5 -0
- package/esm2022/list.component.mjs +329 -0
- package/esm2022/pipes/call-function-in-template.pipe.mjs +28 -0
- package/esm2022/pipes/check-selected-by-key.pipe.mjs +21 -0
- package/esm2022/templates/templates.component.abstract.mjs +336 -0
- package/esm2022/templates/text/text.component.mjs +233 -0
- package/fesm2022/libs-ui-components-list.mjs +1077 -0
- package/fesm2022/libs-ui-components-list.mjs.map +1 -0
- package/highlight-key-search/highlight-key-search.directive.d.ts +13 -0
- package/index.d.ts +2 -0
- package/interfaces/config-item.interface.d.ts +225 -0
- package/interfaces/data-emit.interface.d.ts +10 -0
- package/interfaces/function-control-event.interface.d.ts +9 -0
- package/interfaces/index.d.ts +5 -0
- package/interfaces/tab.interface.d.ts +4 -0
- package/interfaces/templates-type.type.d.ts +1 -0
- package/list.component.d.ts +93 -0
- package/package.json +25 -0
- package/pipes/call-function-in-template.pipe.d.ts +8 -0
- package/pipes/check-selected-by-key.pipe.d.ts +7 -0
- package/templates/templates.component.abstract.d.ts +93 -0
- package/templates/text/text.component.d.ts +24 -0
|
@@ -0,0 +1,1077 @@
|
|
|
1
|
+
import { NgTemplateOutlet, NgClass, AsyncPipe } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { input, inject, ElementRef, Directive, Pipe, signal, model, output, viewChild, Component, ChangeDetectionStrategy, effect } from '@angular/core';
|
|
4
|
+
import { LibsUiComponentsButtonsButtonComponent } from '@libs-ui/components-buttons-button';
|
|
5
|
+
import { LibsUiComponentsInputsSearchComponent } from '@libs-ui/components-inputs-search';
|
|
6
|
+
import { LibsUiComponentsLabelComponent } from '@libs-ui/components-label';
|
|
7
|
+
import { LibsUiComponentsPopoverComponent } from '@libs-ui/components-popover';
|
|
8
|
+
import { LibsUiDynamicComponentService } from '@libs-ui/services-dynamic-component';
|
|
9
|
+
import { deleteUnicode, CHARACTER_DATA_EMPTY, isEmpty, isNil, cloneDeep, escapeHtml, ERROR_MESSAGE_EMPTY_VALID } from '@libs-ui/utils';
|
|
10
|
+
import * as i2 from '@ngx-translate/core';
|
|
11
|
+
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
12
|
+
import { Subject, interval, timer, takeUntil as takeUntil$1 } from 'rxjs';
|
|
13
|
+
import * as i1 from '@iharbeck/ngx-virtual-scroller';
|
|
14
|
+
import { VirtualScrollerComponent, VirtualScrollerModule } from '@iharbeck/ngx-virtual-scroller';
|
|
15
|
+
import { LibsUiComponentsAvatarComponent } from '@libs-ui/components-avatar';
|
|
16
|
+
import { LibsUiComponentsButtonsSortArrowComponent } from '@libs-ui/components-buttons-sort';
|
|
17
|
+
import { LibsUiComponentsScrollOverlayDirective } from '@libs-ui/components-scroll-overlay';
|
|
18
|
+
import { LibsUiComponentsSpinnerComponent } from '@libs-ui/components-spinner';
|
|
19
|
+
import { LibsUiComponentsSwitchComponent } from '@libs-ui/components-switch';
|
|
20
|
+
import { LibsUiHttpRequestService } from '@libs-ui/services-http-request';
|
|
21
|
+
import { takeUntil, skipWhile, take } from 'rxjs/operators';
|
|
22
|
+
|
|
23
|
+
class LibsUiComponentsListHighlightKeySearchDirective {
|
|
24
|
+
isHighlight = input(undefined);
|
|
25
|
+
keySearch = input(undefined);
|
|
26
|
+
classHighlight = input('libs-ui-list-highlight-text-search');
|
|
27
|
+
elementRef = inject(ElementRef);
|
|
28
|
+
ngAfterViewInit() {
|
|
29
|
+
if (!this.elementRef || !this.isHighlight() || !this.keySearch()) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this.handlerHighlight(this.elementRef.nativeElement);
|
|
33
|
+
}
|
|
34
|
+
handlerHighlight(element) {
|
|
35
|
+
if (!element || element === null) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const children = Array.prototype.slice.call(element.childNodes);
|
|
39
|
+
if (!children.length) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
children.forEach(item => {
|
|
43
|
+
if (item.nodeType === Node.TEXT_NODE) {
|
|
44
|
+
this.checkAndReplace(item);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (item.nodeType === Node.ELEMENT_NODE) {
|
|
48
|
+
this.handlerHighlight(item);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
checkAndReplace(node) {
|
|
53
|
+
let nodeVal = node.nodeValue;
|
|
54
|
+
const parentNode = node.parentNode;
|
|
55
|
+
let textNode = null;
|
|
56
|
+
if (!parentNode || !nodeVal) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const textToHighlight = deleteUnicode(this.keySearch()?.trim() || '').toLowerCase();
|
|
60
|
+
let isFirst = true;
|
|
61
|
+
while (true) {
|
|
62
|
+
const foundIndex = deleteUnicode(nodeVal).toLowerCase().indexOf(textToHighlight);
|
|
63
|
+
if (foundIndex < 0) {
|
|
64
|
+
if (isFirst) {
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
if (nodeVal) {
|
|
68
|
+
textNode = document.createTextNode(nodeVal);
|
|
69
|
+
parentNode.insertBefore(textNode, node);
|
|
70
|
+
}
|
|
71
|
+
parentNode.removeChild(node);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
isFirst = false;
|
|
75
|
+
const start = nodeVal.substring(0, foundIndex);
|
|
76
|
+
const matched = nodeVal.substring(foundIndex, foundIndex + textToHighlight.length);
|
|
77
|
+
if (start) {
|
|
78
|
+
textNode = document.createTextNode(start);
|
|
79
|
+
parentNode.insertBefore(textNode, node);
|
|
80
|
+
}
|
|
81
|
+
const span = document.createElement("span");
|
|
82
|
+
if (!span.classList.contains(this.classHighlight())) {
|
|
83
|
+
span.classList.add(this.classHighlight());
|
|
84
|
+
}
|
|
85
|
+
span.appendChild(document.createTextNode(matched));
|
|
86
|
+
parentNode.insertBefore(span, node);
|
|
87
|
+
nodeVal = nodeVal.substring(foundIndex + textToHighlight.length);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsListHighlightKeySearchDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
91
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: LibsUiComponentsListHighlightKeySearchDirective, isStandalone: true, selector: "[LibsUiComponentsListHighlightKeySearchDirective]", inputs: { isHighlight: { classPropertyName: "isHighlight", publicName: "isHighlight", isSignal: true, isRequired: false, transformFunction: null }, keySearch: { classPropertyName: "keySearch", publicName: "keySearch", isSignal: true, isRequired: false, transformFunction: null }, classHighlight: { classPropertyName: "classHighlight", publicName: "classHighlight", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
92
|
+
}
|
|
93
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsListHighlightKeySearchDirective, decorators: [{
|
|
94
|
+
type: Directive,
|
|
95
|
+
args: [{
|
|
96
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
97
|
+
selector: '[LibsUiComponentsListHighlightKeySearchDirective]',
|
|
98
|
+
standalone: true
|
|
99
|
+
}]
|
|
100
|
+
}] });
|
|
101
|
+
|
|
102
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
103
|
+
class MoLibsSharedPipesCallFunctionInTemplatePipe {
|
|
104
|
+
async transform(value, functionCall, item, lang, otherData) {
|
|
105
|
+
if (!functionCall) {
|
|
106
|
+
return this.getValueOfType(value);
|
|
107
|
+
}
|
|
108
|
+
return this.getValueOfType(await functionCall(value, item, lang, otherData));
|
|
109
|
+
}
|
|
110
|
+
async getValueOfType(value) {
|
|
111
|
+
if ('object' === typeof value || value instanceof Array || typeof value === 'boolean') {
|
|
112
|
+
return value !== null ? value : CHARACTER_DATA_EMPTY;
|
|
113
|
+
}
|
|
114
|
+
return value ? `${value}` : value === 0 ? '0' : CHARACTER_DATA_EMPTY;
|
|
115
|
+
}
|
|
116
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MoLibsSharedPipesCallFunctionInTemplatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
117
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: MoLibsSharedPipesCallFunctionInTemplatePipe, isStandalone: true, name: "MoLibsSharedPipesCallFunctionInTemplate" });
|
|
118
|
+
}
|
|
119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MoLibsSharedPipesCallFunctionInTemplatePipe, decorators: [{
|
|
120
|
+
type: Pipe,
|
|
121
|
+
args: [{
|
|
122
|
+
name: 'MoLibsSharedPipesCallFunctionInTemplate',
|
|
123
|
+
standalone: true
|
|
124
|
+
}]
|
|
125
|
+
}] });
|
|
126
|
+
|
|
127
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
128
|
+
class LibsUiCheckSelectedByKeyPipe {
|
|
129
|
+
transform(value, multiKeys, length) {
|
|
130
|
+
if (!multiKeys || !(multiKeys instanceof Array) || !multiKeys.length || !length) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
return multiKeys.some(key => key === value);
|
|
134
|
+
}
|
|
135
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiCheckSelectedByKeyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
136
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: LibsUiCheckSelectedByKeyPipe, isStandalone: true, name: "LibsUiCheckSelectedByKeyPipe" });
|
|
137
|
+
}
|
|
138
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiCheckSelectedByKeyPipe, decorators: [{
|
|
139
|
+
type: Pipe,
|
|
140
|
+
args: [{
|
|
141
|
+
name: 'LibsUiCheckSelectedByKeyPipe',
|
|
142
|
+
standalone: true
|
|
143
|
+
}]
|
|
144
|
+
}] });
|
|
145
|
+
|
|
146
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
147
|
+
/* eslint-disable @angular-eslint/use-lifecycle-interface */
|
|
148
|
+
class LibsUiComponentsListTemplatesComponentAbstract {
|
|
149
|
+
/* PROPERTY */
|
|
150
|
+
loading = signal(true);
|
|
151
|
+
heightViewPort = signal(0);
|
|
152
|
+
store = signal([]);
|
|
153
|
+
items = signal([]);
|
|
154
|
+
loadedLastItem = signal(false);
|
|
155
|
+
hasScroll = signal(false);
|
|
156
|
+
fieldKeyDefault = signal('id');
|
|
157
|
+
fieldKey = signal('id');
|
|
158
|
+
timeAutoScrollItemSelected = signal(0);
|
|
159
|
+
pagingStore = signal(undefined);
|
|
160
|
+
heightItem = signal(0);
|
|
161
|
+
timeIntervalIntervalSetHeightViewPort = signal(0);
|
|
162
|
+
timeIntervalCheckScroll = signal(250);
|
|
163
|
+
onDestroy = new Subject();
|
|
164
|
+
intervalSetHeightViewPortSubscription;
|
|
165
|
+
intervalCheckScrollSubscription;
|
|
166
|
+
/* INPUT */
|
|
167
|
+
functionCustomAddDataToStore = input();
|
|
168
|
+
functionGetItemAutoAddList = input();
|
|
169
|
+
paddingLeftItem = input(undefined);
|
|
170
|
+
maxItemShow = input(0);
|
|
171
|
+
searchConfig = input();
|
|
172
|
+
config = input();
|
|
173
|
+
keySearch = model('');
|
|
174
|
+
dropdownTabKeyActive = input();
|
|
175
|
+
isSearchOnline = input(false);
|
|
176
|
+
onSearch = input();
|
|
177
|
+
onRefresh = input();
|
|
178
|
+
onSetHiddenItemByKey = input();
|
|
179
|
+
onRemoveItems = input();
|
|
180
|
+
onSetDataStore = input();
|
|
181
|
+
onUpdateMultiKeySelectedGroup = input();
|
|
182
|
+
onItemChangeUnSelect = input();
|
|
183
|
+
clickExactly = input();
|
|
184
|
+
keySelected = model(); // sử dụng cho type radio,text.
|
|
185
|
+
multiKeySelected = model(); // sử dụng cho type cho phép chọn nhiều.
|
|
186
|
+
keysDisableItem = input();
|
|
187
|
+
keysHiddenItem = model();
|
|
188
|
+
disable = input();
|
|
189
|
+
disableLabel = input();
|
|
190
|
+
zIndex = input();
|
|
191
|
+
loadingIconSize = input();
|
|
192
|
+
resetKeyWhenSelectAllKeyDropdown = input();
|
|
193
|
+
ignoreClassDisableDefaultWhenUseKeysDisableItem = input(); // bỏ chế độ disable item trên html để disable từng phần trong rows
|
|
194
|
+
templateRefSearchNoData = input(undefined);
|
|
195
|
+
/* OUTPUT */
|
|
196
|
+
outSortSingleSelect = output();
|
|
197
|
+
outSelectKey = output(); // sử dụng cho type radio,text.
|
|
198
|
+
outSelectMultiKey = output(); // sử dụng cho type cho phép chọn nhiều.
|
|
199
|
+
outUnSelectMultiKey = output(); // sử dụng cho type cho phép chọn nhiều.
|
|
200
|
+
outFieldKey = output();
|
|
201
|
+
outChangeView = output();
|
|
202
|
+
outLoading = output();
|
|
203
|
+
outChangStageFlagMousePopover = output();
|
|
204
|
+
outLoadItemsComplete = output();
|
|
205
|
+
/* VIEW CHILD */
|
|
206
|
+
itemRef = viewChild('itemRef');
|
|
207
|
+
/* INJECT */
|
|
208
|
+
translateService = inject(TranslateService);
|
|
209
|
+
httpRequestService = inject(LibsUiHttpRequestService);
|
|
210
|
+
constructor() {
|
|
211
|
+
this.outLoading.emit(this.loading());
|
|
212
|
+
}
|
|
213
|
+
ngOnInit() {
|
|
214
|
+
this.onSearch()?.pipe(takeUntil(this.onDestroy)).subscribe((keySearch) => {
|
|
215
|
+
this.keySearch.set(keySearch);
|
|
216
|
+
// if (this.elementScroll) {
|
|
217
|
+
// this.elementScroll.scrollTop = 0;
|
|
218
|
+
// }
|
|
219
|
+
this.processSearch();
|
|
220
|
+
});
|
|
221
|
+
this.onRefresh()?.pipe(skipWhile(() => this.loading()), takeUntil(this.onDestroy)).subscribe(() => {
|
|
222
|
+
if (this.dropdownTabKeyActive()) {
|
|
223
|
+
this.items.set([]);
|
|
224
|
+
this.store.set([]);
|
|
225
|
+
}
|
|
226
|
+
this.callApiByService(true);
|
|
227
|
+
});
|
|
228
|
+
this.onItemChangeUnSelect()?.pipe(takeUntil(this.onDestroy)).subscribe((item) => {
|
|
229
|
+
if (!item) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
this.processKeyChangeUnSelect(item);
|
|
233
|
+
});
|
|
234
|
+
this.onSetDataStore()?.pipe(takeUntil(this.onDestroy)).subscribe((data) => {
|
|
235
|
+
console.log('vaoday', data);
|
|
236
|
+
this.setDataStore(data);
|
|
237
|
+
});
|
|
238
|
+
this.onSetHiddenItemByKey()?.pipe(takeUntil(this.onDestroy)).subscribe(this.setHiddenItemByKey.bind(this));
|
|
239
|
+
this.outFieldKey.emit(getFieldKeyByType(this.config(), this.fieldKeyDefault()));
|
|
240
|
+
this.onRemoveItems()?.pipe(takeUntil(this.onDestroy)).subscribe(this.removeItems.bind(this));
|
|
241
|
+
}
|
|
242
|
+
setDataStore(data) {
|
|
243
|
+
if (!data || !data.length) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (this.config()?.type === 'checkbox') {
|
|
247
|
+
data.forEach(item => (item.isAddNew = true));
|
|
248
|
+
}
|
|
249
|
+
this.functionCustomAddDataToStore()?.(data, this.store());
|
|
250
|
+
if (!this.functionCustomAddDataToStore()) {
|
|
251
|
+
this.store.update(items => {
|
|
252
|
+
return [...data, ...items];
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
this.processData();
|
|
256
|
+
}
|
|
257
|
+
getFieldKey() {
|
|
258
|
+
let fieldKey;
|
|
259
|
+
switch (this.config()?.type) {
|
|
260
|
+
case 'group':
|
|
261
|
+
fieldKey = this.config()?.configTemplateGroup?.fieldKey;
|
|
262
|
+
break;
|
|
263
|
+
case 'tag':
|
|
264
|
+
fieldKey = this.config()?.configTemplateTag?.fieldKey;
|
|
265
|
+
break;
|
|
266
|
+
case 'text':
|
|
267
|
+
fieldKey = this.config()?.configTemplateText?.fieldKey;
|
|
268
|
+
break;
|
|
269
|
+
case 'checkbox':
|
|
270
|
+
fieldKey = this.config()?.configTemplateCheckbox?.fieldKey;
|
|
271
|
+
break;
|
|
272
|
+
case 'radio':
|
|
273
|
+
fieldKey = this.config()?.configTemplateRadio?.fieldKey;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
return fieldKey || 'id';
|
|
277
|
+
}
|
|
278
|
+
removeItems(keys) {
|
|
279
|
+
const fieldKey = this.getFieldKey();
|
|
280
|
+
[this.store(), this.items()].forEach(element => {
|
|
281
|
+
if (this.config()?.type === 'group') {
|
|
282
|
+
element.forEach(item => {
|
|
283
|
+
this.removeItem(item[this.config()?.configTemplateGroup?.fieldGetItems || 'items'], keys, fieldKey);
|
|
284
|
+
});
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
this.removeItem(element, keys, fieldKey);
|
|
288
|
+
});
|
|
289
|
+
this.processData();
|
|
290
|
+
}
|
|
291
|
+
removeItem(data, keys, fieldKey) {
|
|
292
|
+
if (!data || !data.length) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
keys.forEach(key => {
|
|
296
|
+
const index = data.findIndex(item => item[fieldKey] === key);
|
|
297
|
+
if (index > -1) {
|
|
298
|
+
data.splice(index, 1);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
setHeightViewPort(callBackCalculatorHeightSuccess) {
|
|
303
|
+
console.log('setHeightViewPort');
|
|
304
|
+
const lengthItems = this.getLengthItem();
|
|
305
|
+
if (!lengthItems) {
|
|
306
|
+
this.outChangeView.emit([...this.items()]);
|
|
307
|
+
if (this.heightItem()) {
|
|
308
|
+
this.heightViewPort.set(this.heightItem());
|
|
309
|
+
}
|
|
310
|
+
callBackCalculatorHeightSuccess?.();
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
console.log('this.maxItemShow()', this.maxItemShow(), lengthItems);
|
|
314
|
+
const heightViewPort = this.getHeightGroupHasLine() + (lengthItems < this.maxItemShow() ? lengthItems * this.heightItem() : this.maxItemShow() * this.heightItem()) + (this.config()?.configTemplateGroup?.configCheckboxCheckAll ? 27 : 0) + (this.config()?.configTemplateGroup?.configButtonSelectAndUndSelectItem ? 27 : 0);
|
|
315
|
+
if (!this.maxItemShow()) {
|
|
316
|
+
this.heightViewPort.set(0);
|
|
317
|
+
}
|
|
318
|
+
if (this.heightItem() > 13) {
|
|
319
|
+
if (heightViewPort && heightViewPort !== this.heightViewPort()) {
|
|
320
|
+
this.heightViewPort.set(heightViewPort);
|
|
321
|
+
}
|
|
322
|
+
this.outChangeView.emit([...this.items()]);
|
|
323
|
+
callBackCalculatorHeightSuccess?.();
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
this.intervalSetHeightViewPortSubscription?.unsubscribe();
|
|
327
|
+
this.intervalSetHeightViewPortSubscription = interval(this.timeIntervalIntervalSetHeightViewPort()).pipe(takeUntil(this.onDestroy)).subscribe(() => {
|
|
328
|
+
if (!this.itemRef() || !this.itemRef()?.nativeElement) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
this.heightItem.set(this.itemRef()?.nativeElement.getBoundingClientRect().height);
|
|
332
|
+
if (this.heightItem() < 13) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
this.intervalSetHeightViewPortSubscription?.unsubscribe();
|
|
336
|
+
this.setHeightViewPort(callBackCalculatorHeightSuccess);
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
setHiddenItemByKey(keys) {
|
|
340
|
+
this.keysHiddenItem.set(keys);
|
|
341
|
+
if (this.store() && this.store().length) {
|
|
342
|
+
this.processData(false);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
checkViewPortScroll(callBack) {
|
|
346
|
+
const pre = this.hasScroll();
|
|
347
|
+
this.intervalCheckScrollSubscription?.unsubscribe();
|
|
348
|
+
this.intervalCheckScrollSubscription = interval(this.timeIntervalCheckScroll()).pipe(take(5)).subscribe(() => {
|
|
349
|
+
this.hasScroll.set(false);
|
|
350
|
+
if (this.items() && !this.items().length && pre && !this.hasScroll()) {
|
|
351
|
+
callBack?.(pre, this.hasScroll());
|
|
352
|
+
this.intervalCheckScrollSubscription?.unsubscribe();
|
|
353
|
+
}
|
|
354
|
+
// if (!this.elementScroll) {
|
|
355
|
+
// return;
|
|
356
|
+
// }
|
|
357
|
+
// if (this.elementScroll.offsetHeight < this.elementScroll.scrollHeight) {
|
|
358
|
+
// this.hasScroll.set(true);
|
|
359
|
+
// }
|
|
360
|
+
callBack?.(pre, this.hasScroll());
|
|
361
|
+
this.intervalCheckScrollSubscription?.unsubscribe();
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
async callApiByService(firstCall = true) {
|
|
365
|
+
const config = this.config();
|
|
366
|
+
if (!config) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
try {
|
|
370
|
+
const { httpRequestData, ignoreShowDataWhenNotSearch } = config;
|
|
371
|
+
if (!httpRequestData || (ignoreShowDataWhenNotSearch && !this.keySearch())) {
|
|
372
|
+
this.loading.set(false);
|
|
373
|
+
this.outLoading.emit(this.loading());
|
|
374
|
+
this.loadedLastItem.set(true);
|
|
375
|
+
if (ignoreShowDataWhenNotSearch && !this.keySearch()) {
|
|
376
|
+
this.items.set([]);
|
|
377
|
+
this.store.set([]);
|
|
378
|
+
this.processData(true);
|
|
379
|
+
}
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
this.loading.set(true);
|
|
383
|
+
this.outLoading.emit(this.loading());
|
|
384
|
+
const { argumentsValue, guideAutoUpdateArgumentsValue } = httpRequestData;
|
|
385
|
+
if (firstCall) {
|
|
386
|
+
const loadedLastItem = this.httpRequestService.updateArguments(argumentsValue, { ...this.fakeResponseApi(), dropdownTabKeyActive: this.dropdownTabKeyActive() }, this.pagingStore() || {}, this.keySearch(), this.isSearchOnline(), this.loadedLastItem(), guideAutoUpdateArgumentsValue);
|
|
387
|
+
this.loadedLastItem.set(loadedLastItem);
|
|
388
|
+
}
|
|
389
|
+
const result = await this.httpRequestService.callApi(httpRequestData);
|
|
390
|
+
this.pagingStore.set(result.paging);
|
|
391
|
+
if (!this.pagingStore) {
|
|
392
|
+
this.loadedLastItem.set(true);
|
|
393
|
+
}
|
|
394
|
+
const loadedLastItem = this.httpRequestService.updateArguments(argumentsValue, { ...result, dropdownTabKeyActive: this.dropdownTabKeyActive() }, this.pagingStore() || {}, this.keySearch(), this.isSearchOnline(), this.loadedLastItem(), guideAutoUpdateArgumentsValue);
|
|
395
|
+
this.loadedLastItem.set(loadedLastItem);
|
|
396
|
+
if (firstCall) {
|
|
397
|
+
this.store.set(result.data || []);
|
|
398
|
+
if (this.functionGetItemAutoAddList()) {
|
|
399
|
+
this.store.update(items => [...(this.functionGetItemAutoAddList()?.() || []), ...items]);
|
|
400
|
+
}
|
|
401
|
+
this.processData(true);
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
this.store.update(items => [...items, ...result.data]);
|
|
405
|
+
this.processData(false);
|
|
406
|
+
}
|
|
407
|
+
catch (error) {
|
|
408
|
+
this.loading.set(false);
|
|
409
|
+
this.outLoading.emit(this.loading());
|
|
410
|
+
console.log(error);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
fakeResponseApi() {
|
|
414
|
+
this.loadedLastItem.set(false);
|
|
415
|
+
this.pagingStore.set({});
|
|
416
|
+
return this.httpRequestService.fakeResponsePagingApi();
|
|
417
|
+
}
|
|
418
|
+
buildValueByConfig(item, configTemplate) {
|
|
419
|
+
const ref = item.ref || {};
|
|
420
|
+
const label = ref.label || ref.title || ref.value || ref.name || ' ';
|
|
421
|
+
if (typeof label === 'string') {
|
|
422
|
+
item.fieldLabel = this.translateService.instant(ref.label || ref.title || ref.value || ref.name || ' ');
|
|
423
|
+
}
|
|
424
|
+
if (configTemplate?.getValue) {
|
|
425
|
+
const value = configTemplate.getValue(ref);
|
|
426
|
+
item.fieldLabel = value ? this.translateService.instant(`${value}`) : '';
|
|
427
|
+
}
|
|
428
|
+
if (configTemplate?.getPopover) {
|
|
429
|
+
item.PopoverLabel = configTemplate?.getPopover(item);
|
|
430
|
+
}
|
|
431
|
+
if (!configTemplate?.rows) {
|
|
432
|
+
return item.fieldLabel;
|
|
433
|
+
}
|
|
434
|
+
let textSearch = item.fieldLabel || '';
|
|
435
|
+
configTemplate.rows.forEach((row, indexRow) => {
|
|
436
|
+
const fieldNameRow = `fieldLabelRow${indexRow}`;
|
|
437
|
+
item[fieldNameRow] = row.getValue && row.getValue(ref);
|
|
438
|
+
item[`fieldRowStylesDynamicCols${indexRow}`] = row.getRowStylesDynamicCols && row.getRowStylesDynamicCols(ref);
|
|
439
|
+
item[`fieldRowAvatarConfig${indexRow}`] = row.getAvatarConfig && row.getAvatarConfig(ref);
|
|
440
|
+
if (row.cols && row.cols.length) {
|
|
441
|
+
row.cols.forEach((col, indexCol) => {
|
|
442
|
+
const fieldNameCol = `fieldLabelCol${indexRow}${indexCol}`;
|
|
443
|
+
item[fieldNameCol] = col.getValue && col.getValue(ref, indexCol);
|
|
444
|
+
item[`fieldColPopover${indexRow}${indexCol}`] = col.getPopover && col.getPopover(ref, indexCol);
|
|
445
|
+
item[`fieldBadge${indexRow}${indexCol}`] = col.getConfigBadge && col.getConfigBadge(ref, indexCol);
|
|
446
|
+
item[`fieldColStylesDynamic${indexRow}${indexCol}`] = col.getStylesDynamicCol;
|
|
447
|
+
item[`fieldColButton${indexRow}${indexCol}`] = col.getButton && col.getButton(ref, indexCol);
|
|
448
|
+
item[`fieldColSwitch${indexRow}${indexCol}`] = col.getLabelSwitch && col.getLabelSwitch(ref, indexCol);
|
|
449
|
+
item[`fieldColAvatarConfig${indexRow}${indexCol}`] = col.getAvatarConfig && col.getAvatarConfig(ref);
|
|
450
|
+
textSearch = ` ${textSearch} ${item[fieldNameCol] || ''} `;
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
textSearch = ` ${textSearch} ${item[fieldNameRow] || ''} `;
|
|
454
|
+
});
|
|
455
|
+
return textSearch || ' ';
|
|
456
|
+
}
|
|
457
|
+
handlerChangStageFlagMouse(flag) {
|
|
458
|
+
this.outChangStageFlagMousePopover.emit(flag);
|
|
459
|
+
}
|
|
460
|
+
getHeightGroupHasLine() {
|
|
461
|
+
return 0;
|
|
462
|
+
}
|
|
463
|
+
ngOnDestroy() {
|
|
464
|
+
clearTimeout(this.timeAutoScrollItemSelected());
|
|
465
|
+
this.onDestroy.next();
|
|
466
|
+
this.onDestroy.complete();
|
|
467
|
+
}
|
|
468
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsListTemplatesComponentAbstract, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
469
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "18.2.13", type: LibsUiComponentsListTemplatesComponentAbstract, inputs: { functionCustomAddDataToStore: { classPropertyName: "functionCustomAddDataToStore", publicName: "functionCustomAddDataToStore", isSignal: true, isRequired: false, transformFunction: null }, functionGetItemAutoAddList: { classPropertyName: "functionGetItemAutoAddList", publicName: "functionGetItemAutoAddList", isSignal: true, isRequired: false, transformFunction: null }, paddingLeftItem: { classPropertyName: "paddingLeftItem", publicName: "paddingLeftItem", isSignal: true, isRequired: false, transformFunction: null }, maxItemShow: { classPropertyName: "maxItemShow", publicName: "maxItemShow", isSignal: true, isRequired: false, transformFunction: null }, searchConfig: { classPropertyName: "searchConfig", publicName: "searchConfig", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, keySearch: { classPropertyName: "keySearch", publicName: "keySearch", isSignal: true, isRequired: false, transformFunction: null }, dropdownTabKeyActive: { classPropertyName: "dropdownTabKeyActive", publicName: "dropdownTabKeyActive", isSignal: true, isRequired: false, transformFunction: null }, isSearchOnline: { classPropertyName: "isSearchOnline", publicName: "isSearchOnline", isSignal: true, isRequired: false, transformFunction: null }, onSearch: { classPropertyName: "onSearch", publicName: "onSearch", isSignal: true, isRequired: false, transformFunction: null }, onRefresh: { classPropertyName: "onRefresh", publicName: "onRefresh", isSignal: true, isRequired: false, transformFunction: null }, onSetHiddenItemByKey: { classPropertyName: "onSetHiddenItemByKey", publicName: "onSetHiddenItemByKey", isSignal: true, isRequired: false, transformFunction: null }, onRemoveItems: { classPropertyName: "onRemoveItems", publicName: "onRemoveItems", isSignal: true, isRequired: false, transformFunction: null }, onSetDataStore: { classPropertyName: "onSetDataStore", publicName: "onSetDataStore", isSignal: true, isRequired: false, transformFunction: null }, onUpdateMultiKeySelectedGroup: { classPropertyName: "onUpdateMultiKeySelectedGroup", publicName: "onUpdateMultiKeySelectedGroup", isSignal: true, isRequired: false, transformFunction: null }, onItemChangeUnSelect: { classPropertyName: "onItemChangeUnSelect", publicName: "onItemChangeUnSelect", isSignal: true, isRequired: false, transformFunction: null }, clickExactly: { classPropertyName: "clickExactly", publicName: "clickExactly", isSignal: true, isRequired: false, transformFunction: null }, keySelected: { classPropertyName: "keySelected", publicName: "keySelected", isSignal: true, isRequired: false, transformFunction: null }, multiKeySelected: { classPropertyName: "multiKeySelected", publicName: "multiKeySelected", isSignal: true, isRequired: false, transformFunction: null }, keysDisableItem: { classPropertyName: "keysDisableItem", publicName: "keysDisableItem", isSignal: true, isRequired: false, transformFunction: null }, keysHiddenItem: { classPropertyName: "keysHiddenItem", publicName: "keysHiddenItem", isSignal: true, isRequired: false, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, disableLabel: { classPropertyName: "disableLabel", publicName: "disableLabel", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, loadingIconSize: { classPropertyName: "loadingIconSize", publicName: "loadingIconSize", isSignal: true, isRequired: false, transformFunction: null }, resetKeyWhenSelectAllKeyDropdown: { classPropertyName: "resetKeyWhenSelectAllKeyDropdown", publicName: "resetKeyWhenSelectAllKeyDropdown", isSignal: true, isRequired: false, transformFunction: null }, ignoreClassDisableDefaultWhenUseKeysDisableItem: { classPropertyName: "ignoreClassDisableDefaultWhenUseKeysDisableItem", publicName: "ignoreClassDisableDefaultWhenUseKeysDisableItem", isSignal: true, isRequired: false, transformFunction: null }, templateRefSearchNoData: { classPropertyName: "templateRefSearchNoData", publicName: "templateRefSearchNoData", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { keySearch: "keySearchChange", keySelected: "keySelectedChange", multiKeySelected: "multiKeySelectedChange", keysHiddenItem: "keysHiddenItemChange", outSortSingleSelect: "outSortSingleSelect", outSelectKey: "outSelectKey", outSelectMultiKey: "outSelectMultiKey", outUnSelectMultiKey: "outUnSelectMultiKey", outFieldKey: "outFieldKey", outChangeView: "outChangeView", outLoading: "outLoading", outChangStageFlagMousePopover: "outChangStageFlagMousePopover", outLoadItemsComplete: "outLoadItemsComplete" }, viewQueries: [{ propertyName: "itemRef", first: true, predicate: ["itemRef"], descendants: true, isSignal: true }], ngImport: i0 });
|
|
470
|
+
}
|
|
471
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsListTemplatesComponentAbstract, decorators: [{
|
|
472
|
+
type: Directive
|
|
473
|
+
}], ctorParameters: () => [] });
|
|
474
|
+
|
|
475
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
476
|
+
class LibsUiComponentsListTextComponent extends LibsUiComponentsListTemplatesComponentAbstract {
|
|
477
|
+
configTemplateText = signal(undefined);
|
|
478
|
+
virtualScrollerComponent = viewChild(VirtualScrollerComponent);
|
|
479
|
+
ngOnInit() {
|
|
480
|
+
if (isEmpty(this.config()?.configTemplateText)) {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
super.ngOnInit();
|
|
484
|
+
this.configTemplateText.set(this.config()?.configTemplateText);
|
|
485
|
+
this.fieldKey.set(this.configTemplateText()?.fieldKey ?? this.fieldKeyDefault());
|
|
486
|
+
this.callApiByService();
|
|
487
|
+
}
|
|
488
|
+
handlerScrollBottom() {
|
|
489
|
+
if (this.loadedLastItem()) {
|
|
490
|
+
this.loading.set(false);
|
|
491
|
+
this.outLoading.emit(this.loading());
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
if (this.loading() || this.loadedLastItem()) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
this.loading.set(true);
|
|
498
|
+
this.outLoading.emit(this.loading());
|
|
499
|
+
this.callApiByService(false);
|
|
500
|
+
}
|
|
501
|
+
processSearch() {
|
|
502
|
+
if (!this.isSearchOnline()) {
|
|
503
|
+
return this.processData(true);
|
|
504
|
+
}
|
|
505
|
+
this.callApiByService(true);
|
|
506
|
+
}
|
|
507
|
+
handlerClickRelative(e, item) {
|
|
508
|
+
e.stopPropagation();
|
|
509
|
+
if (this.clickExactly()) {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
this.handlerSelectItem(e, item);
|
|
513
|
+
}
|
|
514
|
+
processKeyChangeUnSelect(item) {
|
|
515
|
+
if (isNil(item[this.fieldKey()]) || item[this.fieldKey()] === '' || this.keySelected() !== item[this.fieldKey()]) {
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
this.keySelected.set('');
|
|
519
|
+
this.outSelectKey.emit(undefined);
|
|
520
|
+
}
|
|
521
|
+
handlerSelectItem(e, item, action, ignoreDisable = false) {
|
|
522
|
+
if (e instanceof Event) {
|
|
523
|
+
e.stopPropagation();
|
|
524
|
+
e.preventDefault();
|
|
525
|
+
}
|
|
526
|
+
if (item.disable) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
if (this.disable() && !ignoreDisable) {
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
if (typeof e === 'string' && e !== 'click') {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
if (!item || (this.keysDisableItem() && this.keysDisableItem()?.some(key => key === item[this.fieldKey()]))) {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
if (action) {
|
|
539
|
+
action(item.ref);
|
|
540
|
+
this.items().forEach(item => {
|
|
541
|
+
this.buildValueByConfig(item, this.configTemplateText());
|
|
542
|
+
});
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
if (this.configTemplateText()?.actionSort) {
|
|
546
|
+
const currentItemSort = this.configTemplateText()?.itemSort;
|
|
547
|
+
const mode = currentItemSort?.fieldSort !== item[this.fieldKey()] ? 'asc' : currentItemSort?.mode === 'desc' ? 'asc' : 'desc';
|
|
548
|
+
const newSort = {
|
|
549
|
+
fieldSort: item[this.fieldKey()],
|
|
550
|
+
mode,
|
|
551
|
+
modeNumber: mode === 'asc' ? 1 : 2,
|
|
552
|
+
reset: () => 0
|
|
553
|
+
};
|
|
554
|
+
this.configTemplateText.update(item => {
|
|
555
|
+
if (!item) {
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
return { ...item, itemSort: newSort };
|
|
559
|
+
});
|
|
560
|
+
this.outSortSingleSelect.emit(this.configTemplateText()?.itemSort || newSort);
|
|
561
|
+
}
|
|
562
|
+
this.keySelected.set(item[this.fieldKey()]);
|
|
563
|
+
this.outSelectKey.emit({ key: this.keySelected(), item, isClickManual: true });
|
|
564
|
+
}
|
|
565
|
+
handlerSort(itemSort) {
|
|
566
|
+
itemSort.reset = () => 0;
|
|
567
|
+
this.configTemplateText.update(item => {
|
|
568
|
+
if (!item) {
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
return { ...item, itemSort: itemSort };
|
|
572
|
+
});
|
|
573
|
+
this.outSortSingleSelect.emit(this.configTemplateText()?.itemSort || itemSort);
|
|
574
|
+
}
|
|
575
|
+
processData(replace) {
|
|
576
|
+
const itemByKeySearch = [];
|
|
577
|
+
const keysHidden = this.keysHiddenItem() || [];
|
|
578
|
+
if (replace) {
|
|
579
|
+
this.items.set([]);
|
|
580
|
+
}
|
|
581
|
+
this.store().forEach((item) => {
|
|
582
|
+
const dataStore = cloneDeep(item);
|
|
583
|
+
const key = keysHidden.find(key => dataStore()[this.fieldKey()] === key);
|
|
584
|
+
dataStore.ref = item;
|
|
585
|
+
if (key === undefined) {
|
|
586
|
+
const text = deleteUnicode(this.buildValueByConfig(dataStore, this.configTemplateText())).toLocaleLowerCase();
|
|
587
|
+
const textEscape = escapeHtml(text);
|
|
588
|
+
const keySearch = deleteUnicode(escapeHtml(this.keySearch().toLocaleLowerCase()));
|
|
589
|
+
if (((this.isSearchOnline() && this.config()?.httpRequestData?.serviceName && this.config()?.httpRequestData?.serviceName !== 'commonDataStaticService' && !this.config()?.httpRequestData?.serviceOther) ||
|
|
590
|
+
(text && (text.includes(keySearch) || textEscape.includes(keySearch)))) && (replace || (!replace && !this.items().find(dataItem => dataItem[this.fieldKey()] === dataStore[this.fieldKey()]))) && !itemByKeySearch.find(dataItem => dataItem[this.fieldKey()] === dataStore[this.fieldKey()])) {
|
|
591
|
+
dataStore.hrefButton = this.configTemplateText()?.getHrefButton?.(dataStore);
|
|
592
|
+
dataStore.classItem = item.classItem || this.configTemplateText()?.getClassItem?.(dataStore);
|
|
593
|
+
dataStore.classInclude = dataStore.classInclude || this.configTemplateText()?.getClassIncludePopover?.(dataStore);
|
|
594
|
+
dataStore.buttonLeftConfig = this.configTemplateText()?.getConfigButtonLeft?.(dataStore);
|
|
595
|
+
dataStore.classIconLeft = dataStore.classIconLeft || this.configTemplateText()?.getClassIconLeft?.(dataStore);
|
|
596
|
+
dataStore.hoverDanger = dataStore.hoverDanger || this.configTemplateText()?.getConfigHoverDanger?.(dataStore);
|
|
597
|
+
dataStore.avatarConfig = this.configTemplateText()?.getAvatarConfig?.(dataStore);
|
|
598
|
+
dataStore.itemAlignStart = dataStore.itemAlignStart || this.configTemplateText()?.getConfigAlignStart?.(dataStore);
|
|
599
|
+
itemByKeySearch.push(dataStore);
|
|
600
|
+
}
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
const indexItemRemove = this.items().findIndex(item => item[this.fieldKey()] === key);
|
|
604
|
+
if (indexItemRemove > -1) {
|
|
605
|
+
this.items().splice(indexItemRemove, 1);
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
const checkLoadItem = (preStateHasScroll, currentHasScroll) => {
|
|
609
|
+
if (this.keysHiddenItem()?.length && preStateHasScroll && !currentHasScroll && (this.isSearchOnline())) {
|
|
610
|
+
this.callApiByService(false);
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
if (replace) {
|
|
614
|
+
this.items.set(itemByKeySearch);
|
|
615
|
+
this.config()?.sort?.(this.items());
|
|
616
|
+
this.emitKeySelectedDefaultIfExistItem(this.items());
|
|
617
|
+
this.autoSelectFirstItem(this.items());
|
|
618
|
+
this.setHeightViewPort();
|
|
619
|
+
this.loading.set(false);
|
|
620
|
+
this.checkViewPortScroll(checkLoadItem);
|
|
621
|
+
this.scrollToItemSelected();
|
|
622
|
+
this.outLoading.emit(this.loading());
|
|
623
|
+
this.outLoadItemsComplete.emit({ items: this.items(), paging: this.pagingStore() });
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
this.items.update(items => [...items, ...itemByKeySearch]);
|
|
627
|
+
this.config()?.sort?.(this.items());
|
|
628
|
+
this.setHeightViewPort();
|
|
629
|
+
this.loading.set(false);
|
|
630
|
+
this.checkViewPortScroll(checkLoadItem);
|
|
631
|
+
this.scrollToItemSelected();
|
|
632
|
+
this.outLoading.emit(this.loading());
|
|
633
|
+
this.outLoadItemsComplete.emit({ items: this.items(), paging: this.pagingStore() });
|
|
634
|
+
}
|
|
635
|
+
scrollToItemSelected() {
|
|
636
|
+
if (!this.configTemplateText()?.autoScrollToItemSelected) {
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
clearTimeout(this.timeAutoScrollItemSelected());
|
|
640
|
+
this.timeAutoScrollItemSelected.set(setTimeout(() => {
|
|
641
|
+
if (!this.keySelected()) {
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
const index = this.items().findIndex(item => item[this.fieldKey()] === this.keySelected);
|
|
645
|
+
if (index !== -1) {
|
|
646
|
+
this.virtualScrollerComponent()?.scrollToIndex(index);
|
|
647
|
+
}
|
|
648
|
+
}));
|
|
649
|
+
}
|
|
650
|
+
autoSelectFirstItem(items) {
|
|
651
|
+
if (this.keySelected() || !this.config()?.autoSelectFirstItem || !items || !items.length) {
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
this.handlerSelectItem('click', items[0], undefined, true);
|
|
655
|
+
}
|
|
656
|
+
emitKeySelectedDefaultIfExistItem(items) {
|
|
657
|
+
const item = items.find(store => store[this.fieldKey()] === this.keySelected);
|
|
658
|
+
if (item) {
|
|
659
|
+
this.handlerSelectItem('click', item, undefined, true);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
getLengthItem() {
|
|
663
|
+
return this.items().length;
|
|
664
|
+
}
|
|
665
|
+
handlerImageError(event, item) {
|
|
666
|
+
event.stopPropagation();
|
|
667
|
+
item.specific_loadImgError = true;
|
|
668
|
+
}
|
|
669
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsListTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
670
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsListTextComponent, isStandalone: true, selector: "libs_ui-components-list-templates_text", viewQueries: [{ propertyName: "virtualScrollerComponent", first: true, predicate: VirtualScrollerComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (configTemplateText(); as configTemplateText) {\n <div class=\"relative h-full w-full\">\n @if (items() && items().length) {\n <div #elementScroll\n [style.height]=\"!configTemplateText.notUseVirtualScroll && heightViewPort() && (!config()?.ignoreShowDataWhenNotSearch || (config()?.ignoreShowDataWhenNotSearch && config()?.ignoreFixHeightShowDataWhenNotSearch)) ? heightViewPort()+'px':'100%'\"\n class=\"w-full\"\n LibsUiComponentsScrollOverlayDirective\n (outScrollBottom)=\"handlerScrollBottom()\">\n @if (!configTemplateText.notUseVirtualScroll) {\n <virtual-scroller #scroll\n [parentScroll]=\"elementScroll\"\n [items]=\"items()\"\n class=\"h-full\">\n <ng-container *ngTemplateOutlet='listRef;context:{itemsView:scroll.viewPortItems}' />\n </virtual-scroller>\n }\n @if (configTemplateText.notUseVirtualScroll) {\n <ng-container *ngTemplateOutlet='listRef;context:{itemsView:items()}' />\n }\n </div>\n }\n @if ((!items() || !items().length) && (!config()?.ignoreShowDataWhenNotSearch || keySearch())) {\n <div [class]=\"'libs-ui-font-h5r text-[#9ca2ad] '+ (config()?.textNoDataClassInclude ?? 'py-[6px] px-[16px]')\">\n @if (!keySearch() && !loading()) {\n {{ (config()?.textNoData ?? 'i18n_have_no_selection') | translate }}\n }\n @if (templateRefSearchNoData() && keySearch() && !loading()) {\n <ng-container *ngTemplateOutlet=\"templateRefSearchNoData() || null;context:{keySearch:keySearch()}\"></ng-container>\n }\n @if (!templateRefSearchNoData() && keySearch() && !loading()) {\n {{ (config()?.textSearchNoData ?? 'i18n_no_result') | translate }}\n }\n @if (loading()) {\n \n }\n </div>\n }\n @if (loading()) {\n <libs_ui-components-spinner [size]=\"loadingIconSize() || 'medium'\" />\n }\n </div>\n <ng-template #listRef\n let-itemsView='itemsView'>\n @for (item of itemsView; track item[fieldKey()]) {\n <div #itemRef\n [class]=\"item.classItemWrapper || ''\">\n <div LibsUiComponentsListHighlightKeySearchDirective\n [isHighlight]=\"config()?.highlightTextSearchInResult\"\n [keySearch]=\"keySearch()\"\n [class]=\"'libs-ui-list-template-text-item flex '+(item.classItem || '')\"\n [class.items-center]=\"!item.itemAlignStart\"\n [class.items-start]=\"item.itemAlignStart\"\n [class.libs-ui-bg-list-hover-danger]=\"!clickExactly() && item.hoverDanger\"\n [class.libs-ui-bg-list-hover]=\"!clickExactly() && !item.hoverDanger\"\n [class.libs-ui-bg-list-selected]=\"!clickExactly() && keySelected() === item[fieldKey()]\"\n [class.pl-[16px]]=\"paddingLeftItem()\"\n [class.bg-[#ffffff]]=\"clickExactly()\"\n [class.libs-ui-bg-list-hover-ffffff]=\"item.disable\"\n [class.cursor-default]=\"item.disable\"\n [class.py-[2px]]=\"clickExactly()\"\n [class.pr-[48px]]=\"keySelected() === item[fieldKey()] && (!configTemplateText?.ignoreIconSelected || configTemplateText?.actionSort)&& !configTemplateText?.stylePaddingRightItemOther\"\n [ngClass]=\"{'pointer-events-none libs-ui-disable':loading() || disable() || ((item[fieldKey()] | LibsUiCheckSelectedByKeyPipe:keysDisableItem():keysDisableItem()?.length) && !ignoreClassDisableDefaultWhenUseKeysDisableItem())}\"\n (click)=\"handlerClickRelative($event,item)\">\n @if (item.bullet) {\n <span class=\"libs-ui-list-template-text-item-bullet flex flex-shrink-0\"\n [style.background-color]=\"item.bullet.backgroundColor\"\n (click)=\"handlerSelectItem($event,item)\">\n </span>\n }\n\n @if (item.avatarConfig; as avatarConfig) {\n <libs_ui-components-avatar [typeShape]=\"avatarConfig.typeShape || 'circle'\"\n [classInclude]=\"avatarConfig.classInclude\"\n [classImageInclude]=\"avatarConfig.classImageInclude\"\n [size]='avatarConfig.size || 32'\n [linkAvatar]=\"avatarConfig.linkAvatar\"\n [linkAvatarError]=\"avatarConfig.linkAvatarError\"\n [idGenColor]=\"avatarConfig.idGenColor\"\n [textAvatar]=\"avatarConfig.textAvatar\"\n [classImageInclude]=\"avatarConfig.classImageInclude\" />\n }\n @if (configTemplateText.getImage || configTemplateText.fieldGetImage) {\n <img\n [src]=\"configTemplateText.getImage ? (('avatar' | MoLibsSharedPipesCallFunctionInTemplate:(item.specific_loadImgError && configTemplateText.getImageError ? configTemplateText.getImageError : configTemplateText.getImage):item) | async) : item[configTemplateText.fieldGetImage || '']\"\n [class]=\"'libs-ui-list-template-text-item-avatar ' + (configTemplateText.classIncludeImage ?? '')\"\n [class.w-[18px]]=\"configTemplateText.imgTypeIcon\"\n [class.h-[18px]]=\"configTemplateText.imgTypeIcon\"\n (error)=\"handlerImageError($event, item)\"\n (click)=\"handlerSelectItem($event,item)\" />\n }\n @if (item.buttonLeftConfig; as buttonLeft) {\n @if (item.hrefButton) {\n <a [class.w-full]=\"!buttonLeft.ignoreWidth100\"\n [href]=\"item.hrefButton\">\n <ng-container *ngTemplateOutlet=\"buttonLeftTemplate\"></ng-container>\n </a>\n }\n @if (!item.hrefButton) {\n <div [class.w-full]=\"!buttonLeft.ignoreWidth100\">\n <ng-container *ngTemplateOutlet=\"buttonLeftTemplate\"></ng-container>\n </div>\n }\n <ng-template #buttonLeftTemplate>\n <libs_ui-components-buttons-button class=\"w-full\"\n [type]=\"buttonLeft.type || 'button-link-primary'\"\n [label]=\"buttonLeft.label || ' '\"\n [zIndex]=\"buttonLeft.zIndex\"\n [disable]=\"buttonLeft.disable\"\n [classIconLeft]=\"buttonLeft.classIconLeft ? ((buttonLeft.classIconLeft || '')+' flex mr-[8px] text-[12px]') : ''\"\n [classInclude]=\"(buttonLeft.classInclude|| '')+' w-full'\"\n [classLabel]=\"(buttonLeft.classLabel ?? 'libs-ui-font-h4r')\"\n [ignoreStopPropagationEvent]=\"buttonLeft.ignoreStopPropagationEvent\"\n [styleIconLeft]=\"buttonLeft.styleIconLeft\"\n [styleButton]=\"buttonLeft.styleButton\"\n (moClick)=\"handlerSelectItem($event,item)\" />\n </ng-template>\n }\n @if (item.switchConfig) {\n <libs_ui-components-switch [active]=\"item.switchConfig.active\"\n (moSwitch)=\"handlerSelectItem('click',item)\" />\n }\n @if (item.classIconLeft) {\n <i [class]=\"item.classIconLeft + ' mr-[8px] text-[14px]'\"></i>\n }\n @if (!item.ignoreShowFieldLabel && !configTemplateText.rows) {\n <libs_ui-components-popover [type]=\"item.popoverLabel?.type || 'text'\"\n [elementRefCustom]=\"item.popoverLabel?.type === 'text'? undefined:itemRef\"\n [ignoreShowPopover]=\"item.popoverLabel?.ignoreShowPopover\"\n [config]=\"item.popoverLabel?.config || (configTemplateText.configLabelPopover || {})\"\n [innerHtml]=\"item.fieldLabel\"\n [classInclude]=\"item.classInclude\"\n (moEvent)=\"handlerSelectItem($event,item)\" />\n }\n @if (!item.ignoreShowFieldLabel && !configTemplateText.rows) {\n <libs_ui-components-popover [type]=\"item.popoverLabel?.type || 'text'\"\n [elementRefCustom]=\"item.popoverLabel?.type === 'text'? undefined:itemRef\"\n [ignoreShowPopover]=\"item.popoverLabel?.ignoreShowPopover\"\n [config]=\"item.popoverLabel?.config || ((configTemplateText.configLabelPopover || {}))\"\n [innerHtml]=\"item.fieldLabel\"\n [classInclude]=\"item.classInclude\"\n (moEvent)=\"handlerSelectItem($event,item)\" />\n }\n @if (item.fieldPopover; as popover) {\n <libs_ui-components-popover class=\"{{ popover.classInclude || '' }}\"\n [config]=\"popover?.config\">\n @if (!popover.dataView) {\n <i class=\"libs-ui-icon-tooltip-outline\"></i>\n }\n @if (popover.dataView) {\n <div [innerHtml]=\"popover.dataView | translate\"></div>\n }\n </libs_ui-components-popover>\n }\n <!-- <libs-uis-shared-components-list_view-templates-rows *ngIf=\"configTemplateText?.rows\"\n class=\"w-100 {{ configTemplateText.classRowsWrapper || configTemplateText.classRows || '' }}\"\n [item]=\"item\"\n [fieldKey]=\"fieldKey\"\n [keySelected]=\"keySelected\"\n [configTemplate]=\"configTemplateText\"\n [zIndex]=\"zIndex\"\n (moChangStageFlagMouseTooltip)=\"handlerChangStageFlagMouse($event)\"\n (moEvent)=\"handlerSelectItem($event.event,$event.item,$event.action)\">\n </libs-uis-shared-components-list_view-templates-rows> -->\n @if ((keySelected === item[fieldKey()] || (item[fieldKey()] | LibsUiCheckSelectedByKeyPipe:multiKeySelected():multiKeySelected()?.length) ? item[fieldKey()] : undefined) && !configTemplateText.ignoreIconSelected && !configTemplateText.actionSort) {\n <i [class]=\"'libs-ui-icon-check '+(configTemplateText.classIncludeIconSelected || 'right-[12px]')\">\n </i>\n }\n @if (keySelected() === item[fieldKey()] && configTemplateText.actionSort) {\n <div class=\"libs-ui-list-template-text-sort\">\n <libs_ui-components-buttons-sort-arrow [disable]=\"loading() || disable() || false\"\n [mode]=\"configTemplateText.itemSort?.mode || ''\"\n [fieldSort]=\"item[fieldKey()]\"\n (outChange)=\"handlerSort($event)\" />\n </div>\n }\n </div>\n </div>\n }\n </ng-template>\n}\n", styles: [".libs-ui-list-template-text-item{padding:6px 16px 6px 1px;font-size:12px;line-height:18px;position:relative;cursor:pointer}.libs-ui-list-template-text-item>.libs-ui-icon-check,.libs-ui-list-template-text-item .libs-ui-list-template-text-sort{position:absolute;right:16px}.libs-ui-list-template-text-item>.libs-ui-icon-check:before,.libs-ui-list-template-text-item .libs-ui-list-template-text-sort:before{font-size:16px;color:var(--libs-ui-color-default, #226FF5)}.libs-ui-list-template-text-item-bullet{width:10px;height:10px;border-radius:50%;margin-right:8px;cursor:pointer}.libs-ui-list-template-text-item-avatar{width:24px;height:24px;border-radius:50%;margin-right:8px;cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: VirtualScrollerModule }, { kind: "component", type: i1.VirtualScrollerComponent, selector: "virtual-scroller,[virtualScroller]", inputs: ["executeRefreshOutsideAngularZone", "enableUnequalChildrenSizes", "RTL", "useMarginInsteadOfTranslate", "modifyOverflowStyleOfParentScroll", "stripedTable", "scrollbarWidth", "scrollbarHeight", "childWidth", "childHeight", "ssrChildWidth", "ssrChildHeight", "ssrViewportWidth", "ssrViewportHeight", "bufferAmount", "scrollAnimationTime", "resizeBypassRefreshThreshold", "scrollThrottlingTime", "scrollDebounceTime", "checkResizeInterval", "items", "compareItems", "horizontal", "parentScroll"], outputs: ["vsUpdate", "vsChange", "vsStart", "vsEnd"], exportAs: ["virtualScroller"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: LibsUiComponentsSpinnerComponent, selector: "libs_ui-components-spinner", inputs: ["type", "size"] }, { kind: "component", type: LibsUiComponentsAvatarComponent, selector: "libs_ui-components-avatar", inputs: ["typeShape", "classInclude", "size", "linkAvatar", "linkAvatarError", "idGenColor", "textAvatar", "classImageInclude"], outputs: ["outAvatarError"] }, { kind: "component", type: LibsUiComponentsButtonsButtonComponent, selector: "libs_ui-components-buttons-button", inputs: ["flagMouse", "type", "buttonCustom", "sizeButton", "label", "disable", "isPending", "imageLeft", "classInclude", "classIconLeft", "classIconRight", "classLabel", "iconOnlyType", "popover", "ignoreStopPropagationEvent", "zIndex", "widthLabelPopover", "styleIconLeft", "styleButton", "ignoreFocusWhenInputTab", "ignoreSetClickWhenShowPopover", "ignorePointerEvent", "isActive"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }, { kind: "directive", type: LibsUiComponentsScrollOverlayDirective, selector: "[LibsUiComponentsScrollOverlayDirective]", inputs: ["classContainer", "options"], outputs: ["outScroll", "outScrollX", "outScrollY", "outScrollTop", "outScrollBottom"] }, { kind: "pipe", type: LibsUiCheckSelectedByKeyPipe, name: "LibsUiCheckSelectedByKeyPipe" }, { kind: "component", type: LibsUiComponentsSwitchComponent, selector: "libs_ui-components-switch", inputs: ["size", "disable", "active"], outputs: ["activeChange", "outSwitch"] }, { kind: "component", type: LibsUiComponentsButtonsSortArrowComponent, selector: "libs_ui-components-buttons-sort-arrow", inputs: ["size", "mode", "fieldSort", "disable", "ignorePopoverContent", "popoverContentAsc", "popoverContentDesc", "defaultMode", "zIndex"], outputs: ["modeChange", "outChange"] }, { kind: "pipe", type: MoLibsSharedPipesCallFunctionInTemplatePipe, name: "MoLibsSharedPipesCallFunctionInTemplate" }, { kind: "directive", type: LibsUiComponentsListHighlightKeySearchDirective, selector: "[LibsUiComponentsListHighlightKeySearchDirective]", inputs: ["isHighlight", "keySearch", "classHighlight"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
671
|
+
}
|
|
672
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsListTextComponent, decorators: [{
|
|
673
|
+
type: Component,
|
|
674
|
+
args: [{ selector: 'libs_ui-components-list-templates_text', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
675
|
+
VirtualScrollerModule, NgTemplateOutlet, TranslateModule, NgClass, AsyncPipe,
|
|
676
|
+
LibsUiComponentsSpinnerComponent,
|
|
677
|
+
LibsUiComponentsAvatarComponent,
|
|
678
|
+
LibsUiComponentsButtonsButtonComponent,
|
|
679
|
+
LibsUiComponentsPopoverComponent,
|
|
680
|
+
LibsUiComponentsScrollOverlayDirective,
|
|
681
|
+
LibsUiCheckSelectedByKeyPipe,
|
|
682
|
+
LibsUiComponentsSwitchComponent,
|
|
683
|
+
LibsUiComponentsButtonsSortArrowComponent,
|
|
684
|
+
MoLibsSharedPipesCallFunctionInTemplatePipe,
|
|
685
|
+
LibsUiComponentsListHighlightKeySearchDirective
|
|
686
|
+
], template: "@if (configTemplateText(); as configTemplateText) {\n <div class=\"relative h-full w-full\">\n @if (items() && items().length) {\n <div #elementScroll\n [style.height]=\"!configTemplateText.notUseVirtualScroll && heightViewPort() && (!config()?.ignoreShowDataWhenNotSearch || (config()?.ignoreShowDataWhenNotSearch && config()?.ignoreFixHeightShowDataWhenNotSearch)) ? heightViewPort()+'px':'100%'\"\n class=\"w-full\"\n LibsUiComponentsScrollOverlayDirective\n (outScrollBottom)=\"handlerScrollBottom()\">\n @if (!configTemplateText.notUseVirtualScroll) {\n <virtual-scroller #scroll\n [parentScroll]=\"elementScroll\"\n [items]=\"items()\"\n class=\"h-full\">\n <ng-container *ngTemplateOutlet='listRef;context:{itemsView:scroll.viewPortItems}' />\n </virtual-scroller>\n }\n @if (configTemplateText.notUseVirtualScroll) {\n <ng-container *ngTemplateOutlet='listRef;context:{itemsView:items()}' />\n }\n </div>\n }\n @if ((!items() || !items().length) && (!config()?.ignoreShowDataWhenNotSearch || keySearch())) {\n <div [class]=\"'libs-ui-font-h5r text-[#9ca2ad] '+ (config()?.textNoDataClassInclude ?? 'py-[6px] px-[16px]')\">\n @if (!keySearch() && !loading()) {\n {{ (config()?.textNoData ?? 'i18n_have_no_selection') | translate }}\n }\n @if (templateRefSearchNoData() && keySearch() && !loading()) {\n <ng-container *ngTemplateOutlet=\"templateRefSearchNoData() || null;context:{keySearch:keySearch()}\"></ng-container>\n }\n @if (!templateRefSearchNoData() && keySearch() && !loading()) {\n {{ (config()?.textSearchNoData ?? 'i18n_no_result') | translate }}\n }\n @if (loading()) {\n \n }\n </div>\n }\n @if (loading()) {\n <libs_ui-components-spinner [size]=\"loadingIconSize() || 'medium'\" />\n }\n </div>\n <ng-template #listRef\n let-itemsView='itemsView'>\n @for (item of itemsView; track item[fieldKey()]) {\n <div #itemRef\n [class]=\"item.classItemWrapper || ''\">\n <div LibsUiComponentsListHighlightKeySearchDirective\n [isHighlight]=\"config()?.highlightTextSearchInResult\"\n [keySearch]=\"keySearch()\"\n [class]=\"'libs-ui-list-template-text-item flex '+(item.classItem || '')\"\n [class.items-center]=\"!item.itemAlignStart\"\n [class.items-start]=\"item.itemAlignStart\"\n [class.libs-ui-bg-list-hover-danger]=\"!clickExactly() && item.hoverDanger\"\n [class.libs-ui-bg-list-hover]=\"!clickExactly() && !item.hoverDanger\"\n [class.libs-ui-bg-list-selected]=\"!clickExactly() && keySelected() === item[fieldKey()]\"\n [class.pl-[16px]]=\"paddingLeftItem()\"\n [class.bg-[#ffffff]]=\"clickExactly()\"\n [class.libs-ui-bg-list-hover-ffffff]=\"item.disable\"\n [class.cursor-default]=\"item.disable\"\n [class.py-[2px]]=\"clickExactly()\"\n [class.pr-[48px]]=\"keySelected() === item[fieldKey()] && (!configTemplateText?.ignoreIconSelected || configTemplateText?.actionSort)&& !configTemplateText?.stylePaddingRightItemOther\"\n [ngClass]=\"{'pointer-events-none libs-ui-disable':loading() || disable() || ((item[fieldKey()] | LibsUiCheckSelectedByKeyPipe:keysDisableItem():keysDisableItem()?.length) && !ignoreClassDisableDefaultWhenUseKeysDisableItem())}\"\n (click)=\"handlerClickRelative($event,item)\">\n @if (item.bullet) {\n <span class=\"libs-ui-list-template-text-item-bullet flex flex-shrink-0\"\n [style.background-color]=\"item.bullet.backgroundColor\"\n (click)=\"handlerSelectItem($event,item)\">\n </span>\n }\n\n @if (item.avatarConfig; as avatarConfig) {\n <libs_ui-components-avatar [typeShape]=\"avatarConfig.typeShape || 'circle'\"\n [classInclude]=\"avatarConfig.classInclude\"\n [classImageInclude]=\"avatarConfig.classImageInclude\"\n [size]='avatarConfig.size || 32'\n [linkAvatar]=\"avatarConfig.linkAvatar\"\n [linkAvatarError]=\"avatarConfig.linkAvatarError\"\n [idGenColor]=\"avatarConfig.idGenColor\"\n [textAvatar]=\"avatarConfig.textAvatar\"\n [classImageInclude]=\"avatarConfig.classImageInclude\" />\n }\n @if (configTemplateText.getImage || configTemplateText.fieldGetImage) {\n <img\n [src]=\"configTemplateText.getImage ? (('avatar' | MoLibsSharedPipesCallFunctionInTemplate:(item.specific_loadImgError && configTemplateText.getImageError ? configTemplateText.getImageError : configTemplateText.getImage):item) | async) : item[configTemplateText.fieldGetImage || '']\"\n [class]=\"'libs-ui-list-template-text-item-avatar ' + (configTemplateText.classIncludeImage ?? '')\"\n [class.w-[18px]]=\"configTemplateText.imgTypeIcon\"\n [class.h-[18px]]=\"configTemplateText.imgTypeIcon\"\n (error)=\"handlerImageError($event, item)\"\n (click)=\"handlerSelectItem($event,item)\" />\n }\n @if (item.buttonLeftConfig; as buttonLeft) {\n @if (item.hrefButton) {\n <a [class.w-full]=\"!buttonLeft.ignoreWidth100\"\n [href]=\"item.hrefButton\">\n <ng-container *ngTemplateOutlet=\"buttonLeftTemplate\"></ng-container>\n </a>\n }\n @if (!item.hrefButton) {\n <div [class.w-full]=\"!buttonLeft.ignoreWidth100\">\n <ng-container *ngTemplateOutlet=\"buttonLeftTemplate\"></ng-container>\n </div>\n }\n <ng-template #buttonLeftTemplate>\n <libs_ui-components-buttons-button class=\"w-full\"\n [type]=\"buttonLeft.type || 'button-link-primary'\"\n [label]=\"buttonLeft.label || ' '\"\n [zIndex]=\"buttonLeft.zIndex\"\n [disable]=\"buttonLeft.disable\"\n [classIconLeft]=\"buttonLeft.classIconLeft ? ((buttonLeft.classIconLeft || '')+' flex mr-[8px] text-[12px]') : ''\"\n [classInclude]=\"(buttonLeft.classInclude|| '')+' w-full'\"\n [classLabel]=\"(buttonLeft.classLabel ?? 'libs-ui-font-h4r')\"\n [ignoreStopPropagationEvent]=\"buttonLeft.ignoreStopPropagationEvent\"\n [styleIconLeft]=\"buttonLeft.styleIconLeft\"\n [styleButton]=\"buttonLeft.styleButton\"\n (moClick)=\"handlerSelectItem($event,item)\" />\n </ng-template>\n }\n @if (item.switchConfig) {\n <libs_ui-components-switch [active]=\"item.switchConfig.active\"\n (moSwitch)=\"handlerSelectItem('click',item)\" />\n }\n @if (item.classIconLeft) {\n <i [class]=\"item.classIconLeft + ' mr-[8px] text-[14px]'\"></i>\n }\n @if (!item.ignoreShowFieldLabel && !configTemplateText.rows) {\n <libs_ui-components-popover [type]=\"item.popoverLabel?.type || 'text'\"\n [elementRefCustom]=\"item.popoverLabel?.type === 'text'? undefined:itemRef\"\n [ignoreShowPopover]=\"item.popoverLabel?.ignoreShowPopover\"\n [config]=\"item.popoverLabel?.config || (configTemplateText.configLabelPopover || {})\"\n [innerHtml]=\"item.fieldLabel\"\n [classInclude]=\"item.classInclude\"\n (moEvent)=\"handlerSelectItem($event,item)\" />\n }\n @if (!item.ignoreShowFieldLabel && !configTemplateText.rows) {\n <libs_ui-components-popover [type]=\"item.popoverLabel?.type || 'text'\"\n [elementRefCustom]=\"item.popoverLabel?.type === 'text'? undefined:itemRef\"\n [ignoreShowPopover]=\"item.popoverLabel?.ignoreShowPopover\"\n [config]=\"item.popoverLabel?.config || ((configTemplateText.configLabelPopover || {}))\"\n [innerHtml]=\"item.fieldLabel\"\n [classInclude]=\"item.classInclude\"\n (moEvent)=\"handlerSelectItem($event,item)\" />\n }\n @if (item.fieldPopover; as popover) {\n <libs_ui-components-popover class=\"{{ popover.classInclude || '' }}\"\n [config]=\"popover?.config\">\n @if (!popover.dataView) {\n <i class=\"libs-ui-icon-tooltip-outline\"></i>\n }\n @if (popover.dataView) {\n <div [innerHtml]=\"popover.dataView | translate\"></div>\n }\n </libs_ui-components-popover>\n }\n <!-- <libs-uis-shared-components-list_view-templates-rows *ngIf=\"configTemplateText?.rows\"\n class=\"w-100 {{ configTemplateText.classRowsWrapper || configTemplateText.classRows || '' }}\"\n [item]=\"item\"\n [fieldKey]=\"fieldKey\"\n [keySelected]=\"keySelected\"\n [configTemplate]=\"configTemplateText\"\n [zIndex]=\"zIndex\"\n (moChangStageFlagMouseTooltip)=\"handlerChangStageFlagMouse($event)\"\n (moEvent)=\"handlerSelectItem($event.event,$event.item,$event.action)\">\n </libs-uis-shared-components-list_view-templates-rows> -->\n @if ((keySelected === item[fieldKey()] || (item[fieldKey()] | LibsUiCheckSelectedByKeyPipe:multiKeySelected():multiKeySelected()?.length) ? item[fieldKey()] : undefined) && !configTemplateText.ignoreIconSelected && !configTemplateText.actionSort) {\n <i [class]=\"'libs-ui-icon-check '+(configTemplateText.classIncludeIconSelected || 'right-[12px]')\">\n </i>\n }\n @if (keySelected() === item[fieldKey()] && configTemplateText.actionSort) {\n <div class=\"libs-ui-list-template-text-sort\">\n <libs_ui-components-buttons-sort-arrow [disable]=\"loading() || disable() || false\"\n [mode]=\"configTemplateText.itemSort?.mode || ''\"\n [fieldSort]=\"item[fieldKey()]\"\n (outChange)=\"handlerSort($event)\" />\n </div>\n }\n </div>\n </div>\n }\n </ng-template>\n}\n", styles: [".libs-ui-list-template-text-item{padding:6px 16px 6px 1px;font-size:12px;line-height:18px;position:relative;cursor:pointer}.libs-ui-list-template-text-item>.libs-ui-icon-check,.libs-ui-list-template-text-item .libs-ui-list-template-text-sort{position:absolute;right:16px}.libs-ui-list-template-text-item>.libs-ui-icon-check:before,.libs-ui-list-template-text-item .libs-ui-list-template-text-sort:before{font-size:16px;color:var(--libs-ui-color-default, #226FF5)}.libs-ui-list-template-text-item-bullet{width:10px;height:10px;border-radius:50%;margin-right:8px;cursor:pointer}.libs-ui-list-template-text-item-avatar{width:24px;height:24px;border-radius:50%;margin-right:8px;cursor:pointer}\n"] }]
|
|
687
|
+
}] });
|
|
688
|
+
|
|
689
|
+
const getComponentByType = (typeTemplate) => {
|
|
690
|
+
switch (typeTemplate) {
|
|
691
|
+
case 'checkbox':
|
|
692
|
+
return LibsUiComponentsListTextComponent;
|
|
693
|
+
case 'group':
|
|
694
|
+
return LibsUiComponentsListTextComponent;
|
|
695
|
+
case 'radio':
|
|
696
|
+
return LibsUiComponentsListTextComponent;
|
|
697
|
+
case 'text':
|
|
698
|
+
return LibsUiComponentsListTextComponent;
|
|
699
|
+
case 'tag':
|
|
700
|
+
return LibsUiComponentsListTextComponent;
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
const getFieldKeyByType = (config, fieldKeyDefault) => {
|
|
704
|
+
if (!config) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
switch (config.type) {
|
|
708
|
+
case 'checkbox':
|
|
709
|
+
return config.configTemplateCheckbox?.fieldKey || fieldKeyDefault;
|
|
710
|
+
case 'group':
|
|
711
|
+
return config.configTemplateGroup?.fieldKey || fieldKeyDefault;
|
|
712
|
+
case 'radio':
|
|
713
|
+
return config.configTemplateRadio?.fieldKey || fieldKeyDefault;
|
|
714
|
+
case 'text':
|
|
715
|
+
return config.configTemplateText?.fieldKey || fieldKeyDefault;
|
|
716
|
+
case 'tag':
|
|
717
|
+
return config.configTemplateTag?.fieldKey || fieldKeyDefault;
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
const initConfig = (config) => {
|
|
721
|
+
if (!config) {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
const defaultConfig = {
|
|
725
|
+
fieldKey: 'id',
|
|
726
|
+
getValue: (item) => {
|
|
727
|
+
if (!item) {
|
|
728
|
+
return ' ';
|
|
729
|
+
}
|
|
730
|
+
return item.label || item.name || ' ';
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
switch (config.type) {
|
|
734
|
+
case 'checkbox':
|
|
735
|
+
if (!config.configTemplateCheckbox) {
|
|
736
|
+
config.configTemplateCheckbox = defaultConfig;
|
|
737
|
+
}
|
|
738
|
+
break;
|
|
739
|
+
case 'group':
|
|
740
|
+
break;
|
|
741
|
+
case 'radio':
|
|
742
|
+
if (!config.configTemplateRadio) {
|
|
743
|
+
config.configTemplateRadio = defaultConfig;
|
|
744
|
+
}
|
|
745
|
+
break;
|
|
746
|
+
case 'text':
|
|
747
|
+
if (!config.configTemplateText) {
|
|
748
|
+
config.configTemplateText = defaultConfig;
|
|
749
|
+
}
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
755
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
756
|
+
class LibsUiComponentsListComponent {
|
|
757
|
+
/* PROPERTY */
|
|
758
|
+
ERROR_MESSAGE_EMPTY_VALID = ERROR_MESSAGE_EMPTY_VALID;
|
|
759
|
+
disableButtonUnSelectOption = signal(true);
|
|
760
|
+
isErrorRequired = signal(false);
|
|
761
|
+
loading = signal(false);
|
|
762
|
+
keySearchStore = signal(undefined);
|
|
763
|
+
onDestroy = new Subject();
|
|
764
|
+
onSearch = new Subject();
|
|
765
|
+
onRefresh = new Subject();
|
|
766
|
+
onSetHiddenItemByKey = new Subject();
|
|
767
|
+
onSetDataStore = new Subject();
|
|
768
|
+
onItemChangeUnSelect = new Subject();
|
|
769
|
+
onUpdateMultiKeySelectedGroup = new Subject();
|
|
770
|
+
onRemoveItems = new Subject();
|
|
771
|
+
componentRef;
|
|
772
|
+
configData = signal({
|
|
773
|
+
type: 'text',
|
|
774
|
+
configTemplateText: {
|
|
775
|
+
fieldKey: 'id',
|
|
776
|
+
getValue: (item) => {
|
|
777
|
+
return item.label || item.name;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
groupMultiKeySelected = signal([]);
|
|
782
|
+
functionControlInputSearch = signal(undefined);
|
|
783
|
+
/* INPUT */
|
|
784
|
+
hiddenInputSearch = input(false);
|
|
785
|
+
dropdownTabKeyActive = input();
|
|
786
|
+
keySearch = input();
|
|
787
|
+
itemChangeUnSelect = input();
|
|
788
|
+
paddingLeftItem = input();
|
|
789
|
+
config = input.required();
|
|
790
|
+
isSearchOnline = input();
|
|
791
|
+
disable = input();
|
|
792
|
+
disableLabel = input();
|
|
793
|
+
labelConfig = input();
|
|
794
|
+
searchConfig = input({});
|
|
795
|
+
searchPadding = input();
|
|
796
|
+
dividerClassInclude = input();
|
|
797
|
+
hasDivider = input(true);
|
|
798
|
+
buttonsOther = input(undefined);
|
|
799
|
+
hasButtonUnSelectOption = input();
|
|
800
|
+
clickExactly = input();
|
|
801
|
+
backgroundListCustom = input('bg-[#ffffff]');
|
|
802
|
+
maxItemShow = input();
|
|
803
|
+
keySelected = input();
|
|
804
|
+
multiKeySelected = input(undefined); // lưu ý khi sử dụng listview
|
|
805
|
+
keysDisableItem = input(undefined); // không dùng giá trị này kết hợp với template checkbox có config chứa configCheckboxCheckAll
|
|
806
|
+
keysHiddenItem = input(undefined); // không dùng giá trị này kết hợp với template checkbox có config chứa configCheckboxCheckAll
|
|
807
|
+
data = input(undefined);
|
|
808
|
+
focusInputSearch = input();
|
|
809
|
+
skipFocusInputWhenKeySearchStoreUndefined = input();
|
|
810
|
+
functionCustomAddDataToStore = input();
|
|
811
|
+
functionGetItemAutoAddList = input(undefined);
|
|
812
|
+
validRequired = input(undefined);
|
|
813
|
+
showValidateBottom = input();
|
|
814
|
+
zIndex = input();
|
|
815
|
+
loadingIconSize = input(undefined);
|
|
816
|
+
templateRefSearchNoData = input(undefined);
|
|
817
|
+
resetKeyWhenSelectAllKeyDropdown = input();
|
|
818
|
+
ignoreClassDisableDefaultWhenUseKeysDisableItem = input(); // bỏ chế độ disable item trên html để disable từng phần trong rows
|
|
819
|
+
/* OUTPUT */
|
|
820
|
+
outSelectKey = output(); // sử dụng cho type chọn 1
|
|
821
|
+
outSelectMultiKey = output(); // sử dụng cho type cho phép chọn nhiều.
|
|
822
|
+
outUnSelectMultiKey = output(); // sử dụng cho type cho phép chọn nhiều.
|
|
823
|
+
outClickButtonOther = output();
|
|
824
|
+
outFieldKey = output();
|
|
825
|
+
outChangeView = output();
|
|
826
|
+
outLoading = output();
|
|
827
|
+
outFunctionsControl = output();
|
|
828
|
+
outChangStageFlagMousePopover = output();
|
|
829
|
+
outLoadItemsComplete = output();
|
|
830
|
+
/* VIEW CHILD */
|
|
831
|
+
listViewElementRef = viewChild('listViewContainer');
|
|
832
|
+
contentElementRef = viewChild('contentContainer');
|
|
833
|
+
/* INJECT */
|
|
834
|
+
dynamicComponentService = inject(LibsUiDynamicComponentService);
|
|
835
|
+
constructor() {
|
|
836
|
+
effect(() => {
|
|
837
|
+
this.keySearchStore.set(this.keySearch());
|
|
838
|
+
this.onSearch.next(this.keySearch());
|
|
839
|
+
}, { allowSignalWrites: true });
|
|
840
|
+
effect(() => this.onItemChangeUnSelect.next(this.itemChangeUnSelect()));
|
|
841
|
+
effect(() => {
|
|
842
|
+
if (!this.componentRef) {
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
if (!isEmpty(this.keysDisableItem())) {
|
|
846
|
+
this.componentRef.setInput('keysDisableItem', this.keysDisableItem());
|
|
847
|
+
}
|
|
848
|
+
if (!isEmpty(this.keysHiddenItem())) {
|
|
849
|
+
this.onSetHiddenItemByKey.next(this.keysHiddenItem() || []);
|
|
850
|
+
}
|
|
851
|
+
if (!isEmpty(this.disable())) {
|
|
852
|
+
this.componentRef.setInput('disable', this.disable());
|
|
853
|
+
}
|
|
854
|
+
if (!isEmpty(this.data())) {
|
|
855
|
+
this.onSetDataStore.next(this.data() || []);
|
|
856
|
+
}
|
|
857
|
+
if (!isEmpty(this.keySelected())) {
|
|
858
|
+
this.componentRef.setInput('keySelected', this.keySelected());
|
|
859
|
+
}
|
|
860
|
+
if (this.configData()?.type !== 'group' && !isEmpty(this.multiKeySelected())) {
|
|
861
|
+
this.componentRef.setInput('multiKeySelected', this.multiKeySelected());
|
|
862
|
+
}
|
|
863
|
+
if (this.configData()?.type === 'group' && !isEmpty(this.multiKeySelected())) {
|
|
864
|
+
this.componentRef.setInput('multiKeySelected', this.multiKeySelected());
|
|
865
|
+
this.onUpdateMultiKeySelectedGroup.next();
|
|
866
|
+
}
|
|
867
|
+
}, { allowSignalWrites: true });
|
|
868
|
+
effect(() => {
|
|
869
|
+
this.refresh();
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
ngOnInit() {
|
|
873
|
+
this.outFunctionsControl.emit({
|
|
874
|
+
checkIsValid: this.checkIsValid.bind(this),
|
|
875
|
+
refresh: this.refresh.bind(this),
|
|
876
|
+
resetKeySelected: this.handlerRemoveKeySelected.bind(this),
|
|
877
|
+
getRectListView: async () => this.listViewElementRef()?.nativeElement.getBoundingClientRect(),
|
|
878
|
+
removeItems: async (keys) => this.onRemoveItems.next(keys)
|
|
879
|
+
});
|
|
880
|
+
const config = this.config();
|
|
881
|
+
if (config) {
|
|
882
|
+
this.configData.set(this.cloneConfig(config));
|
|
883
|
+
}
|
|
884
|
+
initConfig(this.configData());
|
|
885
|
+
const compClass = getComponentByType(this.configData().type);
|
|
886
|
+
this.componentRef = this.dynamicComponentService.resolveComponentFactory(compClass);
|
|
887
|
+
// const instance = this.componentRef.instance;
|
|
888
|
+
timer(0).pipe(takeUntil$1(this.onDestroy)).subscribe(() => {
|
|
889
|
+
this.dynamicComponentService.addToElement(this.componentRef, this.contentElementRef()?.nativeElement);
|
|
890
|
+
});
|
|
891
|
+
this.componentRef.setInput('onSetDataStore', this.onSetDataStore);
|
|
892
|
+
this.componentRef.setInput('onSetHiddenItemByKey', this.onSetHiddenItemByKey);
|
|
893
|
+
this.componentRef.setInput('config', this.configData());
|
|
894
|
+
if (this.searchConfig()) {
|
|
895
|
+
this.componentRef.setInput('searchConfig', this.searchConfig());
|
|
896
|
+
}
|
|
897
|
+
this.componentRef.setInput('onSearch', this.onSearch);
|
|
898
|
+
this.componentRef.setInput('onRefresh', this.onRefresh);
|
|
899
|
+
this.componentRef.setInput('keySearch', this.keySearchStore() ?? '');
|
|
900
|
+
this.componentRef.setInput('dropdownTabKeyActive', this.dropdownTabKeyActive());
|
|
901
|
+
this.componentRef.setInput('clickExactly', this.clickExactly() || false);
|
|
902
|
+
this.componentRef.setInput('disable', this.disable());
|
|
903
|
+
this.componentRef.setInput('paddingLeftItem', this.paddingLeftItem());
|
|
904
|
+
this.componentRef.setInput('resetKeyWhenSelectAllKeyDropdown', this.resetKeyWhenSelectAllKeyDropdown());
|
|
905
|
+
this.componentRef.setInput('ignoreClassDisableDefaultWhenUseKeysDisableItem', this.ignoreClassDisableDefaultWhenUseKeysDisableItem());
|
|
906
|
+
this.componentRef.setInput('functionCustomAddDataToStore', this.functionCustomAddDataToStore());
|
|
907
|
+
this.componentRef.setInput('functionGetItemAutoAddList', this.functionGetItemAutoAddList());
|
|
908
|
+
timer(0).pipe(takeUntil$1(this.onDestroy)).subscribe(() => {
|
|
909
|
+
if (this.data()) {
|
|
910
|
+
this.onSetDataStore.next(this.data() || []);
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
if (this.maxItemShow()) {
|
|
914
|
+
this.componentRef.setInput('maxItemShow', this.maxItemShow());
|
|
915
|
+
}
|
|
916
|
+
this.componentRef.setInput('keySelected', this.keySelected());
|
|
917
|
+
if (this.multiKeySelected()) {
|
|
918
|
+
this.componentRef.setInput('multiKeySelected', this.multiKeySelected());
|
|
919
|
+
}
|
|
920
|
+
this.componentRef.setInput('keysDisableItem', this.keysDisableItem() || []);
|
|
921
|
+
this.componentRef.setInput('keysHiddenItem', this.keysHiddenItem() || []);
|
|
922
|
+
if (!isNil(this.keySelected()) || this.multiKeySelected()?.length) {
|
|
923
|
+
this.disableButtonUnSelectOption.set(false);
|
|
924
|
+
}
|
|
925
|
+
this.componentRef.setInput('onItemChangeUnSelect', this.onItemChangeUnSelect);
|
|
926
|
+
this.componentRef.setInput('onUpdateMultiKeySelectedGroup', this.onUpdateMultiKeySelectedGroup);
|
|
927
|
+
this.componentRef.setInput('onRemoveItems', this.onRemoveItems);
|
|
928
|
+
this.componentRef.setInput('zIndex', this.zIndex());
|
|
929
|
+
this.componentRef.setInput('isSearchOnline', this.isSearchOnline());
|
|
930
|
+
this.componentRef.setInput('disableLabel', this.disableLabel() || false);
|
|
931
|
+
this.componentRef.setInput('loadingIconSize', this.loadingIconSize());
|
|
932
|
+
this.componentRef.setInput('templateRefSearchNoData', this.templateRefSearchNoData());
|
|
933
|
+
let keySearch = '';
|
|
934
|
+
const instance = this.componentRef.instance;
|
|
935
|
+
instance.outChangeView.subscribe(data => {
|
|
936
|
+
this.outChangeView.emit(data);
|
|
937
|
+
if (this.skipFocusInputWhenKeySearchStoreUndefined() && isNil(this.keySearchStore)) {
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
if (this.focusInputSearch() && this.keySearchStore() !== keySearch) {
|
|
941
|
+
keySearch = this.keySearchStore() || '';
|
|
942
|
+
this.functionControlInputSearch()?.focus();
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
instance.outSelectKey.subscribe(data => {
|
|
946
|
+
this.disableButtonUnSelectOption.set(false);
|
|
947
|
+
this.outSelectKey.emit(data);
|
|
948
|
+
this.checkIsValid();
|
|
949
|
+
});
|
|
950
|
+
instance.outFieldKey.subscribe((fieldKey) => {
|
|
951
|
+
this.outFieldKey.emit(fieldKey);
|
|
952
|
+
});
|
|
953
|
+
instance.outLoading.subscribe((loading) => {
|
|
954
|
+
this.loading.set(loading);
|
|
955
|
+
this.outLoading.emit(loading);
|
|
956
|
+
});
|
|
957
|
+
instance.outLoadItemsComplete.subscribe((event) => {
|
|
958
|
+
this.outLoadItemsComplete.emit(event);
|
|
959
|
+
});
|
|
960
|
+
if (this.config() && this.config()?.configTemplateText && this.config()?.configTemplateText?.actionSort) {
|
|
961
|
+
instance.outSortSingleSelect.subscribe(itemSort => {
|
|
962
|
+
const config = this.config();
|
|
963
|
+
if (config && config.configTemplateText && config.configTemplateText?.actionSort) {
|
|
964
|
+
config.configTemplateText.itemSort = itemSort;
|
|
965
|
+
config.configTemplateText.actionSort(itemSort);
|
|
966
|
+
}
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
instance.outChangStageFlagMousePopover.subscribe((flag) => {
|
|
970
|
+
this.outChangStageFlagMousePopover.emit(flag);
|
|
971
|
+
});
|
|
972
|
+
const type = this.configData()?.type;
|
|
973
|
+
if (type === 'text' || type === 'radio') {
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
instance.outSelectMultiKey.subscribe(data => {
|
|
977
|
+
this.disableButtonUnSelectOption.set(false);
|
|
978
|
+
if (type === 'group') {
|
|
979
|
+
this.groupMultiKeySelected.set(data.keys);
|
|
980
|
+
}
|
|
981
|
+
this.outSelectMultiKey.emit(data);
|
|
982
|
+
this.checkIsValid();
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
handlerSearch(keySearch) {
|
|
986
|
+
this.keySearchStore.set(keySearch);
|
|
987
|
+
this.onSearch.next(keySearch);
|
|
988
|
+
}
|
|
989
|
+
async handlerRemoveKeySelected() {
|
|
990
|
+
if (!this.componentRef) {
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
this.outSelectKey.emit(undefined);
|
|
994
|
+
this.outSelectMultiKey.emit(undefined);
|
|
995
|
+
this.componentRef.setInput('keySelected', '');
|
|
996
|
+
this.componentRef.setInput('multiKeySelected', undefined);
|
|
997
|
+
this.disableButtonUnSelectOption.set(true);
|
|
998
|
+
await this.checkIsValid();
|
|
999
|
+
}
|
|
1000
|
+
handlerClickButtonOther(button) {
|
|
1001
|
+
this.outClickButtonOther.emit(button);
|
|
1002
|
+
}
|
|
1003
|
+
handlerFunctionControlInputSearch(event) {
|
|
1004
|
+
this.functionControlInputSearch.set(event);
|
|
1005
|
+
}
|
|
1006
|
+
async checkIsValid() {
|
|
1007
|
+
if (!this.validRequired || !this.config()?.type || !this.componentRef?.instance) {
|
|
1008
|
+
this.isErrorRequired.set(false);
|
|
1009
|
+
return true;
|
|
1010
|
+
}
|
|
1011
|
+
const type = this.config()?.type;
|
|
1012
|
+
let hasKey = !isEmpty(this.componentRef.instance.multiKeySelected);
|
|
1013
|
+
if (type === 'group') {
|
|
1014
|
+
hasKey = !isEmpty(this.groupMultiKeySelected);
|
|
1015
|
+
}
|
|
1016
|
+
if (type === 'text' || type === 'radio') {
|
|
1017
|
+
hasKey = !isNil(this.componentRef.instance.keySelected);
|
|
1018
|
+
}
|
|
1019
|
+
this.isErrorRequired.set(!hasKey);
|
|
1020
|
+
return hasKey;
|
|
1021
|
+
}
|
|
1022
|
+
async refresh() {
|
|
1023
|
+
const config = this.config();
|
|
1024
|
+
if (!config) {
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
this.dropdownTabKeyActive();
|
|
1028
|
+
Object.assign(this.configData, this.cloneConfig(config));
|
|
1029
|
+
this.onRefresh.next();
|
|
1030
|
+
}
|
|
1031
|
+
cloneConfig(configInput) {
|
|
1032
|
+
if (!configInput) {
|
|
1033
|
+
return {};
|
|
1034
|
+
}
|
|
1035
|
+
const serviceOther = configInput.httpRequestData?.serviceOther;
|
|
1036
|
+
const serviceOtherRequestAllIdSelectOrUnSelect = configInput.configTemplateCheckbox?.httpRequestAllIdSelectOrUnSelect?.serviceOther;
|
|
1037
|
+
serviceOther && delete configInput.httpRequestData?.serviceOther;
|
|
1038
|
+
serviceOtherRequestAllIdSelectOrUnSelect && delete configInput.configTemplateCheckbox?.httpRequestAllIdSelectOrUnSelect?.serviceOther;
|
|
1039
|
+
const config = cloneDeep(configInput);
|
|
1040
|
+
serviceOther && config.httpRequestData && (config.httpRequestData.serviceOther = serviceOther);
|
|
1041
|
+
serviceOtherRequestAllIdSelectOrUnSelect && config.configTemplateCheckbox?.httpRequestAllIdSelectOrUnSelect && (config.configTemplateCheckbox.httpRequestAllIdSelectOrUnSelect.serviceOther = serviceOtherRequestAllIdSelectOrUnSelect);
|
|
1042
|
+
serviceOther && configInput.httpRequestData && (configInput.httpRequestData.serviceOther = serviceOther);
|
|
1043
|
+
serviceOtherRequestAllIdSelectOrUnSelect && configInput.configTemplateCheckbox?.httpRequestAllIdSelectOrUnSelect && (configInput.configTemplateCheckbox.httpRequestAllIdSelectOrUnSelect.serviceOther = serviceOtherRequestAllIdSelectOrUnSelect);
|
|
1044
|
+
return config;
|
|
1045
|
+
}
|
|
1046
|
+
ngOnDestroy() {
|
|
1047
|
+
this.outLoading.emit(false);
|
|
1048
|
+
this.dynamicComponentService.remove(this.componentRef);
|
|
1049
|
+
this.onRefresh.complete();
|
|
1050
|
+
this.onSearch.complete();
|
|
1051
|
+
this.onSetHiddenItemByKey.complete();
|
|
1052
|
+
this.onUpdateMultiKeySelectedGroup.complete();
|
|
1053
|
+
this.onDestroy.next();
|
|
1054
|
+
this.onDestroy.complete();
|
|
1055
|
+
}
|
|
1056
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1057
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsListComponent, isStandalone: true, selector: "libs_ui-components-list", inputs: { hiddenInputSearch: { classPropertyName: "hiddenInputSearch", publicName: "hiddenInputSearch", isSignal: true, isRequired: false, transformFunction: null }, dropdownTabKeyActive: { classPropertyName: "dropdownTabKeyActive", publicName: "dropdownTabKeyActive", isSignal: true, isRequired: false, transformFunction: null }, keySearch: { classPropertyName: "keySearch", publicName: "keySearch", isSignal: true, isRequired: false, transformFunction: null }, itemChangeUnSelect: { classPropertyName: "itemChangeUnSelect", publicName: "itemChangeUnSelect", isSignal: true, isRequired: false, transformFunction: null }, paddingLeftItem: { classPropertyName: "paddingLeftItem", publicName: "paddingLeftItem", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, isSearchOnline: { classPropertyName: "isSearchOnline", publicName: "isSearchOnline", isSignal: true, isRequired: false, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, disableLabel: { classPropertyName: "disableLabel", publicName: "disableLabel", isSignal: true, isRequired: false, transformFunction: null }, labelConfig: { classPropertyName: "labelConfig", publicName: "labelConfig", isSignal: true, isRequired: false, transformFunction: null }, searchConfig: { classPropertyName: "searchConfig", publicName: "searchConfig", isSignal: true, isRequired: false, transformFunction: null }, searchPadding: { classPropertyName: "searchPadding", publicName: "searchPadding", isSignal: true, isRequired: false, transformFunction: null }, dividerClassInclude: { classPropertyName: "dividerClassInclude", publicName: "dividerClassInclude", isSignal: true, isRequired: false, transformFunction: null }, hasDivider: { classPropertyName: "hasDivider", publicName: "hasDivider", isSignal: true, isRequired: false, transformFunction: null }, buttonsOther: { classPropertyName: "buttonsOther", publicName: "buttonsOther", isSignal: true, isRequired: false, transformFunction: null }, hasButtonUnSelectOption: { classPropertyName: "hasButtonUnSelectOption", publicName: "hasButtonUnSelectOption", isSignal: true, isRequired: false, transformFunction: null }, clickExactly: { classPropertyName: "clickExactly", publicName: "clickExactly", isSignal: true, isRequired: false, transformFunction: null }, backgroundListCustom: { classPropertyName: "backgroundListCustom", publicName: "backgroundListCustom", isSignal: true, isRequired: false, transformFunction: null }, maxItemShow: { classPropertyName: "maxItemShow", publicName: "maxItemShow", isSignal: true, isRequired: false, transformFunction: null }, keySelected: { classPropertyName: "keySelected", publicName: "keySelected", isSignal: true, isRequired: false, transformFunction: null }, multiKeySelected: { classPropertyName: "multiKeySelected", publicName: "multiKeySelected", isSignal: true, isRequired: false, transformFunction: null }, keysDisableItem: { classPropertyName: "keysDisableItem", publicName: "keysDisableItem", isSignal: true, isRequired: false, transformFunction: null }, keysHiddenItem: { classPropertyName: "keysHiddenItem", publicName: "keysHiddenItem", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, focusInputSearch: { classPropertyName: "focusInputSearch", publicName: "focusInputSearch", isSignal: true, isRequired: false, transformFunction: null }, skipFocusInputWhenKeySearchStoreUndefined: { classPropertyName: "skipFocusInputWhenKeySearchStoreUndefined", publicName: "skipFocusInputWhenKeySearchStoreUndefined", isSignal: true, isRequired: false, transformFunction: null }, functionCustomAddDataToStore: { classPropertyName: "functionCustomAddDataToStore", publicName: "functionCustomAddDataToStore", isSignal: true, isRequired: false, transformFunction: null }, functionGetItemAutoAddList: { classPropertyName: "functionGetItemAutoAddList", publicName: "functionGetItemAutoAddList", isSignal: true, isRequired: false, transformFunction: null }, validRequired: { classPropertyName: "validRequired", publicName: "validRequired", isSignal: true, isRequired: false, transformFunction: null }, showValidateBottom: { classPropertyName: "showValidateBottom", publicName: "showValidateBottom", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, loadingIconSize: { classPropertyName: "loadingIconSize", publicName: "loadingIconSize", isSignal: true, isRequired: false, transformFunction: null }, templateRefSearchNoData: { classPropertyName: "templateRefSearchNoData", publicName: "templateRefSearchNoData", isSignal: true, isRequired: false, transformFunction: null }, resetKeyWhenSelectAllKeyDropdown: { classPropertyName: "resetKeyWhenSelectAllKeyDropdown", publicName: "resetKeyWhenSelectAllKeyDropdown", isSignal: true, isRequired: false, transformFunction: null }, ignoreClassDisableDefaultWhenUseKeysDisableItem: { classPropertyName: "ignoreClassDisableDefaultWhenUseKeysDisableItem", publicName: "ignoreClassDisableDefaultWhenUseKeysDisableItem", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { outSelectKey: "outSelectKey", outSelectMultiKey: "outSelectMultiKey", outUnSelectMultiKey: "outUnSelectMultiKey", outClickButtonOther: "outClickButtonOther", outFieldKey: "outFieldKey", outChangeView: "outChangeView", outLoading: "outLoading", outFunctionsControl: "outFunctionsControl", outChangStageFlagMousePopover: "outChangStageFlagMousePopover", outLoadItemsComplete: "outLoadItemsComplete" }, viewQueries: [{ propertyName: "listViewElementRef", first: true, predicate: ["listViewContainer"], descendants: true, isSignal: true }, { propertyName: "contentElementRef", first: true, predicate: ["contentContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<div #listViewContainer\n class=\"flex flex-col\"\n [class.w-full]=\"!maxItemShow\"\n [class.h-full]=\"!maxItemShow\">\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()\"\n [disableButtonsRight]=\"labelConfig.disableButtonsRight || disable()\"\n [hasToggle]=\"labelConfig.hasToggle\"\n [toggleActive]=\"labelConfig.toggleActive\"\n [toggleDisable]=\"labelConfig.toggleDisable || loading() || disable()\"\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\n @if (!showValidateBottom()) {\n <ng-container *ngTemplateOutlet=\"templateValidate\"></ng-container>\n }\n @if (!hiddenInputSearch()) {\n <libs_ui-components-inputs-search [searchConfig]=\"searchConfig()\"\n [class.px-[12px]]=\"searchPadding()\"\n [class]=\"searchConfig().classCoverInputSearch\"\n [disable]=\" disable() || loading() || false\"\n (outSearch)=\"handlerSearch($event)\"\n (outFunctionsControl)=\"handlerFunctionControlInputSearch($event)\" />\n }\n @if (config()?.configDescriptionGroup; as description) {\n <div [class]=\"description?.classInclude\">\n <libs_ui-components-popover [config]=\"description?.tooltipDescription\">\n <div [class]=\"description?.classTextDescriptionInclude\">{{ description.textDescription }}</div>\n </libs_ui-components-popover>\n </div>\n }\n @if (hasDivider() && (!config()?.ignoreShowDataWhenNotSearch || keySearchStore())) {\n <div class=\"libs-ui-border-top-general {{ dividerClassInclude() ? dividerClassInclude():'' }}\"\n [class.libs-ui-divider-default]=\"!!searchPadding() && !dividerClassInclude()\">\n </div>\n }\n <div class=\"flex flex-col {{ (config()?.ignoreShowDataWhenNotSearch && keySearchStore() && !config()?.ignoreFixHeightShowDataWhenNotSearch) ? 'h-[353px]' : 'h-full' }}\">\n <div #contentContainer\n class=\"w-full h-full {{ backgroundListCustom() }}\"\n [class.libs-ui-disable]=\"disable() && disableLabel()\"\n [class.pointer-events-none]=\"disable() && disableLabel()\">\n </div>\n\n @for (buttonOther of buttonsOther(); track $index) {\n <div class=\"bg-[#ffffff]\">\n <libs_ui-components-buttons-button [type]=\"buttonOther.type || 'button-link-primary'\"\n [label]=\"buttonOther.label || ' '\"\n [classIconLeft]=\"(buttonOther.classIconLeft || '')+' flex mr-[8px] text-[16px]'\"\n classInclude=\"w-full libs-ui-border-top-general text-left rounded-0 {{ buttonOther.classInclude ? buttonOther.classInclude:'' }}\"\n classLabel=\"libs-ui-font-h5r whitespace-normal\"\n [disable]=\"buttonOther.disable || disable() || loading() || false\"\n (outClick)=\"handlerClickButtonOther(buttonOther)\" />\n </div>\n }\n @if (hasButtonUnSelectOption()) {\n <div class=\"bg-[#ffffff] rounded-b-[4px]\">\n <libs_ui-components-buttons-button label=\"i18n_unselect_option\"\n type=\"button-link-danger-high\"\n classIconLeft=\"flex mr-[8px] libs-ui-icon-close\"\n classInclude=\"w-100 libs-ui-border-top-general text-left rounded-0\"\n classLabel=\"mo-lib-font-h5r whitespace-normal\"\n [disable]=\"disableButtonUnSelectOption() || disable() || loading() || false\"\n (outClick)=\"handlerRemoveKeySelected()\" />\n </div>\n }\n </div>\n @if (showValidateBottom()) {\n <ng-container *ngTemplateOutlet=\"templateValidate\"></ng-container>\n }\n</div>\n\n<ng-template #templateValidate>\n @if (isErrorRequired()) {\n <div [class.mb-[8px]]=\"!showValidateBottom()\"\n [class.mt-[8px]]=\"showValidateBottom()\">\n <span class=\"text-[#ee2d41] mo-lib-font-h7\"\n [innerHtml]=\"(validRequired()?.message || ERROR_MESSAGE_EMPTY_VALID)| translate:validRequired()?.interpolateParams\">\n </span>\n </div>\n }\n</ng-template>\n", styles: [":host{background-color:#fff}:host ::ng-deep .libs-ui-list-view-highlight-text-search{background-color:#ffdb80;border-radius:2px;display:inline-block;overflow:unset}.libs-ui-divider-default{width:calc(100% - 24px);margin:12px auto 0}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { 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: LibsUiComponentsInputsSearchComponent, selector: "libs_ui-components-inputs-search", inputs: ["disable", "readonly", "searchConfig", "ignoreAutoComplete", "debounceTime", "ignoreStopPropagationEvent", "focusTimeOut", "blurTimeOut"], outputs: ["outSearch", "outValueChange", "outIconLeft", "outIconRight", "outFocusAndBlur", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsButtonsButtonComponent, selector: "libs_ui-components-buttons-button", inputs: ["flagMouse", "type", "buttonCustom", "sizeButton", "label", "disable", "isPending", "imageLeft", "classInclude", "classIconLeft", "classIconRight", "classLabel", "iconOnlyType", "popover", "ignoreStopPropagationEvent", "zIndex", "widthLabelPopover", "styleIconLeft", "styleButton", "ignoreFocusWhenInputTab", "ignoreSetClickWhenShowPopover", "ignorePointerEvent", "isActive"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1058
|
+
}
|
|
1059
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsListComponent, decorators: [{
|
|
1060
|
+
type: Component,
|
|
1061
|
+
args: [{ selector: 'libs_ui-components-list', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1062
|
+
NgTemplateOutlet, TranslateModule,
|
|
1063
|
+
LibsUiComponentsLabelComponent,
|
|
1064
|
+
LibsUiComponentsInputsSearchComponent,
|
|
1065
|
+
LibsUiComponentsPopoverComponent,
|
|
1066
|
+
LibsUiComponentsButtonsButtonComponent
|
|
1067
|
+
], template: "<div #listViewContainer\n class=\"flex flex-col\"\n [class.w-full]=\"!maxItemShow\"\n [class.h-full]=\"!maxItemShow\">\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()\"\n [disableButtonsRight]=\"labelConfig.disableButtonsRight || disable()\"\n [hasToggle]=\"labelConfig.hasToggle\"\n [toggleActive]=\"labelConfig.toggleActive\"\n [toggleDisable]=\"labelConfig.toggleDisable || loading() || disable()\"\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\n @if (!showValidateBottom()) {\n <ng-container *ngTemplateOutlet=\"templateValidate\"></ng-container>\n }\n @if (!hiddenInputSearch()) {\n <libs_ui-components-inputs-search [searchConfig]=\"searchConfig()\"\n [class.px-[12px]]=\"searchPadding()\"\n [class]=\"searchConfig().classCoverInputSearch\"\n [disable]=\" disable() || loading() || false\"\n (outSearch)=\"handlerSearch($event)\"\n (outFunctionsControl)=\"handlerFunctionControlInputSearch($event)\" />\n }\n @if (config()?.configDescriptionGroup; as description) {\n <div [class]=\"description?.classInclude\">\n <libs_ui-components-popover [config]=\"description?.tooltipDescription\">\n <div [class]=\"description?.classTextDescriptionInclude\">{{ description.textDescription }}</div>\n </libs_ui-components-popover>\n </div>\n }\n @if (hasDivider() && (!config()?.ignoreShowDataWhenNotSearch || keySearchStore())) {\n <div class=\"libs-ui-border-top-general {{ dividerClassInclude() ? dividerClassInclude():'' }}\"\n [class.libs-ui-divider-default]=\"!!searchPadding() && !dividerClassInclude()\">\n </div>\n }\n <div class=\"flex flex-col {{ (config()?.ignoreShowDataWhenNotSearch && keySearchStore() && !config()?.ignoreFixHeightShowDataWhenNotSearch) ? 'h-[353px]' : 'h-full' }}\">\n <div #contentContainer\n class=\"w-full h-full {{ backgroundListCustom() }}\"\n [class.libs-ui-disable]=\"disable() && disableLabel()\"\n [class.pointer-events-none]=\"disable() && disableLabel()\">\n </div>\n\n @for (buttonOther of buttonsOther(); track $index) {\n <div class=\"bg-[#ffffff]\">\n <libs_ui-components-buttons-button [type]=\"buttonOther.type || 'button-link-primary'\"\n [label]=\"buttonOther.label || ' '\"\n [classIconLeft]=\"(buttonOther.classIconLeft || '')+' flex mr-[8px] text-[16px]'\"\n classInclude=\"w-full libs-ui-border-top-general text-left rounded-0 {{ buttonOther.classInclude ? buttonOther.classInclude:'' }}\"\n classLabel=\"libs-ui-font-h5r whitespace-normal\"\n [disable]=\"buttonOther.disable || disable() || loading() || false\"\n (outClick)=\"handlerClickButtonOther(buttonOther)\" />\n </div>\n }\n @if (hasButtonUnSelectOption()) {\n <div class=\"bg-[#ffffff] rounded-b-[4px]\">\n <libs_ui-components-buttons-button label=\"i18n_unselect_option\"\n type=\"button-link-danger-high\"\n classIconLeft=\"flex mr-[8px] libs-ui-icon-close\"\n classInclude=\"w-100 libs-ui-border-top-general text-left rounded-0\"\n classLabel=\"mo-lib-font-h5r whitespace-normal\"\n [disable]=\"disableButtonUnSelectOption() || disable() || loading() || false\"\n (outClick)=\"handlerRemoveKeySelected()\" />\n </div>\n }\n </div>\n @if (showValidateBottom()) {\n <ng-container *ngTemplateOutlet=\"templateValidate\"></ng-container>\n }\n</div>\n\n<ng-template #templateValidate>\n @if (isErrorRequired()) {\n <div [class.mb-[8px]]=\"!showValidateBottom()\"\n [class.mt-[8px]]=\"showValidateBottom()\">\n <span class=\"text-[#ee2d41] mo-lib-font-h7\"\n [innerHtml]=\"(validRequired()?.message || ERROR_MESSAGE_EMPTY_VALID)| translate:validRequired()?.interpolateParams\">\n </span>\n </div>\n }\n</ng-template>\n", styles: [":host{background-color:#fff}:host ::ng-deep .libs-ui-list-view-highlight-text-search{background-color:#ffdb80;border-radius:2px;display:inline-block;overflow:unset}.libs-ui-divider-default{width:calc(100% - 24px);margin:12px auto 0}\n"] }]
|
|
1068
|
+
}], ctorParameters: () => [] });
|
|
1069
|
+
|
|
1070
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* Generated bundle index. Do not edit.
|
|
1074
|
+
*/
|
|
1075
|
+
|
|
1076
|
+
export { LibsUiComponentsListComponent };
|
|
1077
|
+
//# sourceMappingURL=libs-ui-components-list.mjs.map
|