@libs-ui/components-list 0.1.1-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/defines/list.define.d.ts +10 -0
- package/esm2022/defines/list.define.mjs +70 -0
- package/esm2022/highlight-key-search/highlight-key-search.directive.mjs +82 -0
- package/esm2022/index.mjs +4 -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 +420 -0
- package/esm2022/pipes/check-selected-by-key.pipe.mjs +21 -0
- package/esm2022/templates/checkbox/checkbox.component.mjs +304 -0
- package/esm2022/templates/group/group.component.mjs +788 -0
- package/esm2022/templates/group/item/item.component.mjs +82 -0
- package/esm2022/templates/group/pipes/calculator-left-line-vertical-item.pipe.mjs +38 -0
- package/esm2022/templates/group/pipes/calculator-margin-left-item.pipe.mjs +40 -0
- package/esm2022/templates/group/pipes/calculator-padding-left-item.pipe.mjs +26 -0
- package/esm2022/templates/radio/radio.component.mjs +193 -0
- package/esm2022/templates/rows/rows.component.mjs +72 -0
- package/esm2022/templates/tag/tag.component.mjs +139 -0
- package/esm2022/templates/templates.component.abstract.mjs +350 -0
- package/esm2022/templates/text/text.component.mjs +247 -0
- package/fesm2022/libs-ui-components-list.mjs +2757 -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 +3 -0
- package/interfaces/config-item.interface.d.ts +260 -0
- package/interfaces/data-emit.interface.d.ts +16 -0
- package/interfaces/function-control-event.interface.d.ts +15 -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 +50 -0
- package/pipes/check-selected-by-key.pipe.d.ts +7 -0
- package/templates/checkbox/checkbox.component.d.ts +24 -0
- package/templates/group/group.component.d.ts +48 -0
- package/templates/group/item/item.component.d.ts +27 -0
- package/templates/group/pipes/calculator-left-line-vertical-item.pipe.d.ts +7 -0
- package/templates/group/pipes/calculator-margin-left-item.pipe.d.ts +7 -0
- package/templates/group/pipes/calculator-padding-left-item.pipe.d.ts +7 -0
- package/templates/radio/radio.component.d.ts +20 -0
- package/templates/rows/rows.component.d.ts +23 -0
- package/templates/tag/tag.component.d.ts +16 -0
- package/templates/templates.component.abstract.d.ts +94 -0
- package/templates/text/text.component.d.ts +24 -0
|
@@ -0,0 +1,2757 @@
|
|
|
1
|
+
import { AsyncPipe, NgComponentOutlet, NgTemplateOutlet, NgClass } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { input, inject, ElementRef, Directive, Pipe, signal, output, effect, untracked, ChangeDetectionStrategy, Component, model, viewChild, isSignal, computed } 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, isEmpty, convertObjectToSignal, isNil, convertSignalToObject, cloneDeep, get, escapeHtml, uuid, set, ERROR_MESSAGE_EMPTY_VALID, isEqual } from '@libs-ui/utils';
|
|
10
|
+
import * as i1 from '@ngx-translate/core';
|
|
11
|
+
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
12
|
+
import { lastValueFrom, Subject, interval, of, range, timer, takeUntil as takeUntil$1 } from 'rxjs';
|
|
13
|
+
import * as i1$1 from '@iharbeck/ngx-virtual-scroller';
|
|
14
|
+
import { VirtualScrollerComponent, VirtualScrollerModule } from '@iharbeck/ngx-virtual-scroller';
|
|
15
|
+
import { LibsUiComponentsCheckboxSingleComponent } from '@libs-ui/components-checkbox-single';
|
|
16
|
+
import { LibsUiComponentsScrollOverlayDirective } from '@libs-ui/components-scroll-overlay';
|
|
17
|
+
import { LibsUiComponentsSpinnerComponent } from '@libs-ui/components-spinner';
|
|
18
|
+
import { LibsUiIconsGetIconComponentPipe } from '@libs-ui/icons';
|
|
19
|
+
import { LibsUiPipesCallFunctionInTemplatePipe } from '@libs-ui/pipes-call-function-in-template';
|
|
20
|
+
import { LibsUiPipesConvertObjectToSignalPipe } from '@libs-ui/pipes-convert-object-to-signal';
|
|
21
|
+
import { LibsUiComponentsAvatarComponent } from '@libs-ui/components-avatar';
|
|
22
|
+
import { LibsUiComponentsBadgeComponent } from '@libs-ui/components-badge';
|
|
23
|
+
import { LibsUiHttpRequestService } from '@libs-ui/services-http-request';
|
|
24
|
+
import { takeUntil, skipWhile, take } from 'rxjs/operators';
|
|
25
|
+
import { LibsUiPipesConvertSignalToObjectPipe } from '@libs-ui/pipes-convert-signal-to-object';
|
|
26
|
+
import { LibsUiComponentsRadioSingleComponent } from '@libs-ui/components-radio-single';
|
|
27
|
+
import { LibsUiComponentsButtonsSortArrowComponent } from '@libs-ui/components-buttons-sort';
|
|
28
|
+
import { LibsUiComponentsSwitchComponent } from '@libs-ui/components-switch';
|
|
29
|
+
import { LibsUiPipesGetValueOfObjectPipe } from '@libs-ui/pipes-get-value-of-object';
|
|
30
|
+
|
|
31
|
+
class LibsUiComponentsListHighlightKeySearchDirective {
|
|
32
|
+
isHighlight = input(undefined);
|
|
33
|
+
keySearch = input(undefined);
|
|
34
|
+
classHighlight = input('libs-ui-list-highlight-text-search');
|
|
35
|
+
elementRef = inject(ElementRef);
|
|
36
|
+
ngAfterViewInit() {
|
|
37
|
+
if (!this.elementRef || !this.isHighlight() || !this.keySearch()) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.handlerHighlight(this.elementRef.nativeElement);
|
|
41
|
+
}
|
|
42
|
+
handlerHighlight(element) {
|
|
43
|
+
if (!element || element === null) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const children = Array.prototype.slice.call(element.childNodes);
|
|
47
|
+
if (!children.length) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
children.forEach((item) => {
|
|
51
|
+
if (item.nodeType === Node.TEXT_NODE) {
|
|
52
|
+
this.checkAndReplace(item);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (item.nodeType === Node.ELEMENT_NODE) {
|
|
56
|
+
this.handlerHighlight(item);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
checkAndReplace(node) {
|
|
61
|
+
let nodeVal = node.nodeValue;
|
|
62
|
+
const parentNode = node.parentNode;
|
|
63
|
+
let textNode = null;
|
|
64
|
+
if (!parentNode || !nodeVal) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const textToHighlight = deleteUnicode(this.keySearch()?.trim() || '').toLowerCase();
|
|
68
|
+
let isFirst = true;
|
|
69
|
+
while (true) {
|
|
70
|
+
const foundIndex = deleteUnicode(nodeVal).toLowerCase().indexOf(textToHighlight);
|
|
71
|
+
if (foundIndex < 0) {
|
|
72
|
+
if (isFirst) {
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
if (nodeVal) {
|
|
76
|
+
textNode = document.createTextNode(nodeVal);
|
|
77
|
+
parentNode.insertBefore(textNode, node);
|
|
78
|
+
}
|
|
79
|
+
parentNode.removeChild(node);
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
isFirst = false;
|
|
83
|
+
const start = nodeVal.substring(0, foundIndex);
|
|
84
|
+
const matched = nodeVal.substring(foundIndex, foundIndex + textToHighlight.length);
|
|
85
|
+
if (start) {
|
|
86
|
+
textNode = document.createTextNode(start);
|
|
87
|
+
parentNode.insertBefore(textNode, node);
|
|
88
|
+
}
|
|
89
|
+
const span = document.createElement('span');
|
|
90
|
+
if (!span.classList.contains(this.classHighlight())) {
|
|
91
|
+
span.classList.add(this.classHighlight());
|
|
92
|
+
}
|
|
93
|
+
span.appendChild(document.createTextNode(matched));
|
|
94
|
+
parentNode.insertBefore(span, node);
|
|
95
|
+
nodeVal = nodeVal.substring(foundIndex + textToHighlight.length);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListHighlightKeySearchDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
99
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.14", 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 });
|
|
100
|
+
}
|
|
101
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListHighlightKeySearchDirective, decorators: [{
|
|
102
|
+
type: Directive,
|
|
103
|
+
args: [{
|
|
104
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
105
|
+
selector: '[LibsUiComponentsListHighlightKeySearchDirective]',
|
|
106
|
+
standalone: true,
|
|
107
|
+
}]
|
|
108
|
+
}] });
|
|
109
|
+
|
|
110
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
111
|
+
class LibsUiCheckSelectedByKeyPipe {
|
|
112
|
+
transform(value, multiKeys, length) {
|
|
113
|
+
if (!multiKeys || !(multiKeys instanceof Array) || !multiKeys.length || !length) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return multiKeys.some((key) => key === value);
|
|
117
|
+
}
|
|
118
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiCheckSelectedByKeyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
119
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: LibsUiCheckSelectedByKeyPipe, isStandalone: true, name: "LibsUiCheckSelectedByKeyPipe" });
|
|
120
|
+
}
|
|
121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiCheckSelectedByKeyPipe, decorators: [{
|
|
122
|
+
type: Pipe,
|
|
123
|
+
args: [{
|
|
124
|
+
name: 'LibsUiCheckSelectedByKeyPipe',
|
|
125
|
+
standalone: true,
|
|
126
|
+
}]
|
|
127
|
+
}] });
|
|
128
|
+
|
|
129
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
130
|
+
class LibsUiComponentsListRowsComponent {
|
|
131
|
+
// #region PROPERTY
|
|
132
|
+
popoverIcon = signal(`<i class='libs-ui-icon-tooltip-outline text-[16px] ml-[8px]'></i>`);
|
|
133
|
+
configItemTextRows = signal([]);
|
|
134
|
+
// #region INPUT
|
|
135
|
+
configTemplate = input.required();
|
|
136
|
+
item = input();
|
|
137
|
+
keySelected = input();
|
|
138
|
+
fieldKey = input('id');
|
|
139
|
+
zIndex = input(1200, { transform: (value) => (!isEmpty(value) ? value + 1 : 1200) });
|
|
140
|
+
outChangStageFlagMousePopover = output();
|
|
141
|
+
outEvent = output();
|
|
142
|
+
constructor() {
|
|
143
|
+
effect(() => {
|
|
144
|
+
untracked(() => this.afterViewInit());
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
afterViewInit() {
|
|
148
|
+
if (!this.configTemplate().rows?.()?.length) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
this.configItemTextRows.set(this.configTemplate().rows?.() || []);
|
|
152
|
+
}
|
|
153
|
+
/* FUNCTIONS */
|
|
154
|
+
handlerSelectItem(event, item, action) {
|
|
155
|
+
if (event !== 'click') {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
this.outEvent.emit({ event, item, action });
|
|
159
|
+
}
|
|
160
|
+
async handlerErrorImage(event, functionGetImageError) {
|
|
161
|
+
event.stopPropagation();
|
|
162
|
+
if (!event.target || !functionGetImageError) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
event.target.src = await lastValueFrom(functionGetImageError(this.item()));
|
|
166
|
+
}
|
|
167
|
+
handlerChangStageFlagMouse(flag) {
|
|
168
|
+
this.outChangStageFlagMousePopover.emit(flag);
|
|
169
|
+
}
|
|
170
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListRowsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
171
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LibsUiComponentsListRowsComponent, isStandalone: true, selector: "libs_ui-components-list-templates_rows", inputs: { configTemplate: { classPropertyName: "configTemplate", publicName: "configTemplate", isSignal: true, isRequired: true, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: false, transformFunction: null }, keySelected: { classPropertyName: "keySelected", publicName: "keySelected", isSignal: true, isRequired: false, transformFunction: null }, fieldKey: { classPropertyName: "fieldKey", publicName: "fieldKey", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { outChangStageFlagMousePopover: "outChangStageFlagMousePopover", outEvent: "outEvent" }, ngImport: i0, template: "@if (configTemplate() && configItemTextRows(); as configItemTextRows) {\n <div class=\"flex flex-col w-full {{ configTemplate().classRows ?? '' }}\">\n @for (row of configItemTextRows; track $index; let indexRow = $index) {\n <div [class]=\"row().classRow\">\n @if (row().getImage && (item() | LibsUiPipesCallFunctionInTemplatePipe: row().getImage : item() | async); as imgUrl) {\n <img\n [class]=\"item() | LibsUiPipesCallFunctionInTemplatePipe: row().getClassImage : item() | async\"\n src=\"{{ imgUrl }}\"\n (error)=\"handlerErrorImage($event, row().getImageError)\" />\n }\n @if (item()['fieldRowAvatarConfig' + indexRow]; as avatarConfig) {\n <libs_ui-components-avatar\n [typeShape]=\"avatarConfig.typeShape || 'circle'\"\n [classInclude]=\"avatarConfig.classInclude\"\n [size]=\"avatarConfig.size || 32\"\n [linkAvatar]=\"avatarConfig.linkAvatar\"\n [linkAvatarError]=\"avatarConfig.linkAvatarError\"\n [idGenColor]=\"avatarConfig.idGenColor\"\n [textAvatar]=\"avatarConfig.textAvatar\" />\n }\n @if (fieldKey() && item()['fieldLabelRow' + indexRow] | async; as labelRow) {\n <libs_ui-components-popover\n type=\"text\"\n [config]=\"row().getPopoverConfig ? ('popover' | LibsUiPipesCallFunctionInTemplatePipe: row().getPopoverConfig : item() | async) : { zIndex: zIndex() }\"\n [classInclude]=\"keySelected() === item()[fieldKey()] ? row().classItemSelected || row().classGetValue || '' : row().classGetValue || ''\"\n [innerHtml]=\"labelRow\"\n (outChangStageFlagMouse)=\"handlerChangStageFlagMouse($event)\"\n (outEvent)=\"handlerSelectItem($event, item(), row().action)\" />\n }\n\n @if (fieldKey() && row().getComponentOutlet) {\n <ng-container\n *ngComponentOutlet=\"\n 'row:' + indexRow | LibsUiPipesCallFunctionInTemplatePipe: row().getComponentOutlet : item() | async;\n inputs: undefined | LibsUiPipesCallFunctionInTemplatePipe: row().getDataComponentOutlet : item() : 'row:' + indexRow : { valueIsEmpty: { item: item() } } | async\n \" />\n }\n @if (row().cols?.()?.length) {\n <div\n [class]=\"row().classCols || 'flex'\"\n [style]=\"item()[item()['fieldRowStylesDynamicCols' + indexRow]]\">\n @for (col of row().cols?.(); track $index; let colIndex = $index) {\n @if (col().getImage && (item() | LibsUiPipesCallFunctionInTemplatePipe: col().getImage : item() | async); as imgUrl) {\n <img\n [class]=\"item() | LibsUiPipesCallFunctionInTemplatePipe: col().getClassImage : item() | async\"\n src=\"{{ imgUrl }}\"\n (error)=\"handlerErrorImage($event, col().getImageError)\" />\n }\n @if (item()['fieldColAvatarConfig' + indexRow + colIndex]; as avatarConfig) {\n <libs_ui-components-avatar\n [typeShape]=\"avatarConfig.typeShape || 'circle'\"\n [classInclude]=\"avatarConfig.classInclude\"\n [size]=\"avatarConfig.size || 32\"\n [linkAvatar]=\"avatarConfig.linkAvatar\"\n [linkAvatarError]=\"avatarConfig.linkAvatarError\"\n [idGenColor]=\"avatarConfig.idGenColor\"\n [textAvatar]=\"avatarConfig.textAvatar\" />\n }\n @if (item()['fieldLabelCol' + indexRow + colIndex]; as labelColFunc) {\n <libs_ui-components-popover\n type=\"text\"\n [style]=\"' ' | LibsUiPipesCallFunctionInTemplatePipe: item()['fieldColStylesDynamic' + indexRow + colIndex] : item() | async\"\n [classInclude]=\"keySelected() === item()[fieldKey()] ? row().classItemSelected || item()['fieldColClass' + indexRow + colIndex] || '' : item()['fieldColClass' + indexRow + colIndex] || ''\"\n [innerHtml]=\"'fieldLabelCol' | LibsUiPipesCallFunctionInTemplatePipe: labelColFunc : item() | async\"\n [config]=\"{ zIndex: zIndex() }\"\n (outChangStageFlagMouse)=\"handlerChangStageFlagMouse($event)\"\n (outEvent)=\"handlerSelectItem($event, item(), col().action)\" />\n }\n @if (item()['fieldColPopover' + indexRow + colIndex]; as popover) {\n <libs_ui-components-popover\n [type]=\"popover.type ?? 'other'\"\n [config]=\"popover?.config\"\n [classInclude]=\"item()['fieldColClass' + indexRow + colIndex]\"\n [style]=\"' ' | LibsUiPipesCallFunctionInTemplatePipe: item()['fieldColStylesDynamic' + indexRow + colIndex] : item() | async\"\n (outChangStageFlagMouse)=\"handlerChangStageFlagMouse($event)\"\n (outEvent)=\"handlerSelectItem($event, item(), col().action)\">\n @let constHtmlDataView = popover.dataView || popoverIcon;\n <span\n [class]=\"popover.classInclude || ''\"\n [innerHtml]=\"constHtmlDataView | translate\"></span>\n </libs_ui-components-popover>\n }\n @if (fieldKey() && col().getComponentOutlet) {\n <ng-container\n *ngComponentOutlet=\"\n 'row:' + indexRow + '-col:' + colIndex | LibsUiPipesCallFunctionInTemplatePipe: col().getComponentOutlet : item() | async;\n inputs: undefined | LibsUiPipesCallFunctionInTemplatePipe: col().getDataComponentOutlet : item() : 'row:' + indexRow + '-col:' + colIndex : { valueIsEmpty: { item: item() } } | async\n \" />\n }\n @if (item()['fieldColToggle' + indexRow + colIndex]; as toggle) {\n <libs_ui-components-label\n [style]=\"' ' | LibsUiPipesCallFunctionInTemplatePipe: item()['fieldColStylesDynamic' + indexRow + colIndex] : item() | async\"\n [hasToggle]=\"toggle.hasToggle\"\n [toggleActive]=\"toggle.toggleActive\"\n [toggleDisable]=\"toggle.toggleDisable\"\n [popover]=\"toggle.popover\"\n [classInclude]=\"toggle.classInclude\"\n [labelLeft]=\"toggle.labelLeft\"\n [labelRight]=\"toggle.labelRight\"\n (outSwitchEvent)=\"handlerSelectItem('click', item(), col().action)\" />\n }\n @if (item()['fieldColButton' + indexRow + colIndex]; as button) {\n <libs_ui-components-buttons-button\n [type]=\"button.type\"\n [classIconLeft]=\"button.classIconLeft\"\n [classIconRight]=\"button.classIconRight\"\n [classLabel]=\"button.classLabel\"\n [iconOnlyType]=\"button.iconOnlyType\"\n [popover]=\"button.popover\"\n [disable]=\"button.disable\"\n [ignorePointerEvent]=\"button.ignorePointerEvent\"\n [classInclude]=\"item()['fieldColClass' + indexRow + colIndex] ?? ' '\"\n [ignoreStopPropagationEvent]=\"false\"\n (outClick)=\"handlerSelectItem('click', item(), col().action)\" />\n }\n @if (item()['fieldBadge' + indexRow + colIndex]; as badge) {\n <libs_ui-components-badge\n [mode]=\"badge.mode || 'x+'\"\n [style]=\"' ' | LibsUiPipesCallFunctionInTemplatePipe: item()['fieldColStylesDynamic' + indexRow + colIndex] : item() | async\"\n [count]=\"badge.count\"\n [maxCount]=\"badge.maxCount || 99\"\n [classCircle]=\"badge.classCircle || 'libs-ui-font-h4r'\" />\n }\n }\n </div>\n }\n </div>\n }\n </div>\n}\n", styles: [""], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "component", type: LibsUiComponentsAvatarComponent, selector: "libs_ui-components-avatar", inputs: ["typeShape", "classInclude", "size", "linkAvatar", "linkAvatarError", "classImageInclude", "zIndexPreviewImage", "clickPreviewImage", "idGenColor", "getLastTextAfterSpace", "textAvatar", "textAvatarClassInclude", "containertextAvatarClassInclude"], outputs: ["outAvatarError", "outEventPreviewImage"] }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "initEventInElementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }, { kind: "component", type: 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", "isHandlerEnterDocumentClickButton"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }, { 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: LibsUiComponentsBadgeComponent, selector: "libs_ui-components-badge", inputs: ["popoverConfig", "active", "count", "mode", "maxCount", "ignoreMarginDefault", "classCircle", "ignoreStopPropagationEvent"] }, { kind: "pipe", type: LibsUiPipesCallFunctionInTemplatePipe, name: "LibsUiPipesCallFunctionInTemplatePipe" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
172
|
+
}
|
|
173
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListRowsComponent, decorators: [{
|
|
174
|
+
type: Component,
|
|
175
|
+
args: [{ selector: 'libs_ui-components-list-templates_rows', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
176
|
+
AsyncPipe,
|
|
177
|
+
TranslateModule,
|
|
178
|
+
NgComponentOutlet,
|
|
179
|
+
LibsUiComponentsAvatarComponent,
|
|
180
|
+
LibsUiComponentsPopoverComponent,
|
|
181
|
+
LibsUiComponentsButtonsButtonComponent,
|
|
182
|
+
LibsUiComponentsLabelComponent,
|
|
183
|
+
LibsUiComponentsBadgeComponent,
|
|
184
|
+
LibsUiPipesCallFunctionInTemplatePipe,
|
|
185
|
+
], template: "@if (configTemplate() && configItemTextRows(); as configItemTextRows) {\n <div class=\"flex flex-col w-full {{ configTemplate().classRows ?? '' }}\">\n @for (row of configItemTextRows; track $index; let indexRow = $index) {\n <div [class]=\"row().classRow\">\n @if (row().getImage && (item() | LibsUiPipesCallFunctionInTemplatePipe: row().getImage : item() | async); as imgUrl) {\n <img\n [class]=\"item() | LibsUiPipesCallFunctionInTemplatePipe: row().getClassImage : item() | async\"\n src=\"{{ imgUrl }}\"\n (error)=\"handlerErrorImage($event, row().getImageError)\" />\n }\n @if (item()['fieldRowAvatarConfig' + indexRow]; as avatarConfig) {\n <libs_ui-components-avatar\n [typeShape]=\"avatarConfig.typeShape || 'circle'\"\n [classInclude]=\"avatarConfig.classInclude\"\n [size]=\"avatarConfig.size || 32\"\n [linkAvatar]=\"avatarConfig.linkAvatar\"\n [linkAvatarError]=\"avatarConfig.linkAvatarError\"\n [idGenColor]=\"avatarConfig.idGenColor\"\n [textAvatar]=\"avatarConfig.textAvatar\" />\n }\n @if (fieldKey() && item()['fieldLabelRow' + indexRow] | async; as labelRow) {\n <libs_ui-components-popover\n type=\"text\"\n [config]=\"row().getPopoverConfig ? ('popover' | LibsUiPipesCallFunctionInTemplatePipe: row().getPopoverConfig : item() | async) : { zIndex: zIndex() }\"\n [classInclude]=\"keySelected() === item()[fieldKey()] ? row().classItemSelected || row().classGetValue || '' : row().classGetValue || ''\"\n [innerHtml]=\"labelRow\"\n (outChangStageFlagMouse)=\"handlerChangStageFlagMouse($event)\"\n (outEvent)=\"handlerSelectItem($event, item(), row().action)\" />\n }\n\n @if (fieldKey() && row().getComponentOutlet) {\n <ng-container\n *ngComponentOutlet=\"\n 'row:' + indexRow | LibsUiPipesCallFunctionInTemplatePipe: row().getComponentOutlet : item() | async;\n inputs: undefined | LibsUiPipesCallFunctionInTemplatePipe: row().getDataComponentOutlet : item() : 'row:' + indexRow : { valueIsEmpty: { item: item() } } | async\n \" />\n }\n @if (row().cols?.()?.length) {\n <div\n [class]=\"row().classCols || 'flex'\"\n [style]=\"item()[item()['fieldRowStylesDynamicCols' + indexRow]]\">\n @for (col of row().cols?.(); track $index; let colIndex = $index) {\n @if (col().getImage && (item() | LibsUiPipesCallFunctionInTemplatePipe: col().getImage : item() | async); as imgUrl) {\n <img\n [class]=\"item() | LibsUiPipesCallFunctionInTemplatePipe: col().getClassImage : item() | async\"\n src=\"{{ imgUrl }}\"\n (error)=\"handlerErrorImage($event, col().getImageError)\" />\n }\n @if (item()['fieldColAvatarConfig' + indexRow + colIndex]; as avatarConfig) {\n <libs_ui-components-avatar\n [typeShape]=\"avatarConfig.typeShape || 'circle'\"\n [classInclude]=\"avatarConfig.classInclude\"\n [size]=\"avatarConfig.size || 32\"\n [linkAvatar]=\"avatarConfig.linkAvatar\"\n [linkAvatarError]=\"avatarConfig.linkAvatarError\"\n [idGenColor]=\"avatarConfig.idGenColor\"\n [textAvatar]=\"avatarConfig.textAvatar\" />\n }\n @if (item()['fieldLabelCol' + indexRow + colIndex]; as labelColFunc) {\n <libs_ui-components-popover\n type=\"text\"\n [style]=\"' ' | LibsUiPipesCallFunctionInTemplatePipe: item()['fieldColStylesDynamic' + indexRow + colIndex] : item() | async\"\n [classInclude]=\"keySelected() === item()[fieldKey()] ? row().classItemSelected || item()['fieldColClass' + indexRow + colIndex] || '' : item()['fieldColClass' + indexRow + colIndex] || ''\"\n [innerHtml]=\"'fieldLabelCol' | LibsUiPipesCallFunctionInTemplatePipe: labelColFunc : item() | async\"\n [config]=\"{ zIndex: zIndex() }\"\n (outChangStageFlagMouse)=\"handlerChangStageFlagMouse($event)\"\n (outEvent)=\"handlerSelectItem($event, item(), col().action)\" />\n }\n @if (item()['fieldColPopover' + indexRow + colIndex]; as popover) {\n <libs_ui-components-popover\n [type]=\"popover.type ?? 'other'\"\n [config]=\"popover?.config\"\n [classInclude]=\"item()['fieldColClass' + indexRow + colIndex]\"\n [style]=\"' ' | LibsUiPipesCallFunctionInTemplatePipe: item()['fieldColStylesDynamic' + indexRow + colIndex] : item() | async\"\n (outChangStageFlagMouse)=\"handlerChangStageFlagMouse($event)\"\n (outEvent)=\"handlerSelectItem($event, item(), col().action)\">\n @let constHtmlDataView = popover.dataView || popoverIcon;\n <span\n [class]=\"popover.classInclude || ''\"\n [innerHtml]=\"constHtmlDataView | translate\"></span>\n </libs_ui-components-popover>\n }\n @if (fieldKey() && col().getComponentOutlet) {\n <ng-container\n *ngComponentOutlet=\"\n 'row:' + indexRow + '-col:' + colIndex | LibsUiPipesCallFunctionInTemplatePipe: col().getComponentOutlet : item() | async;\n inputs: undefined | LibsUiPipesCallFunctionInTemplatePipe: col().getDataComponentOutlet : item() : 'row:' + indexRow + '-col:' + colIndex : { valueIsEmpty: { item: item() } } | async\n \" />\n }\n @if (item()['fieldColToggle' + indexRow + colIndex]; as toggle) {\n <libs_ui-components-label\n [style]=\"' ' | LibsUiPipesCallFunctionInTemplatePipe: item()['fieldColStylesDynamic' + indexRow + colIndex] : item() | async\"\n [hasToggle]=\"toggle.hasToggle\"\n [toggleActive]=\"toggle.toggleActive\"\n [toggleDisable]=\"toggle.toggleDisable\"\n [popover]=\"toggle.popover\"\n [classInclude]=\"toggle.classInclude\"\n [labelLeft]=\"toggle.labelLeft\"\n [labelRight]=\"toggle.labelRight\"\n (outSwitchEvent)=\"handlerSelectItem('click', item(), col().action)\" />\n }\n @if (item()['fieldColButton' + indexRow + colIndex]; as button) {\n <libs_ui-components-buttons-button\n [type]=\"button.type\"\n [classIconLeft]=\"button.classIconLeft\"\n [classIconRight]=\"button.classIconRight\"\n [classLabel]=\"button.classLabel\"\n [iconOnlyType]=\"button.iconOnlyType\"\n [popover]=\"button.popover\"\n [disable]=\"button.disable\"\n [ignorePointerEvent]=\"button.ignorePointerEvent\"\n [classInclude]=\"item()['fieldColClass' + indexRow + colIndex] ?? ' '\"\n [ignoreStopPropagationEvent]=\"false\"\n (outClick)=\"handlerSelectItem('click', item(), col().action)\" />\n }\n @if (item()['fieldBadge' + indexRow + colIndex]; as badge) {\n <libs_ui-components-badge\n [mode]=\"badge.mode || 'x+'\"\n [style]=\"' ' | LibsUiPipesCallFunctionInTemplatePipe: item()['fieldColStylesDynamic' + indexRow + colIndex] : item() | async\"\n [count]=\"badge.count\"\n [maxCount]=\"badge.maxCount || 99\"\n [classCircle]=\"badge.classCircle || 'libs-ui-font-h4r'\" />\n }\n }\n </div>\n }\n </div>\n }\n </div>\n}\n" }]
|
|
186
|
+
}], ctorParameters: () => [] });
|
|
187
|
+
|
|
188
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
189
|
+
/* eslint-disable @angular-eslint/use-lifecycle-interface */
|
|
190
|
+
class LibsUiComponentsListTemplatesComponentAbstract {
|
|
191
|
+
// #region PROPERTY
|
|
192
|
+
timeAnimationScrollToIndexItem = signal(250);
|
|
193
|
+
loading = signal(true);
|
|
194
|
+
heightViewPort = signal(0);
|
|
195
|
+
store = signal([]);
|
|
196
|
+
items = signal([]);
|
|
197
|
+
loadedLastItem = signal(false);
|
|
198
|
+
hasScroll = signal(false);
|
|
199
|
+
fieldKeyDefault = signal('id');
|
|
200
|
+
fieldKey = signal('id');
|
|
201
|
+
timeAutoScrollItemSelected = signal(0);
|
|
202
|
+
pagingStore = signal(undefined);
|
|
203
|
+
heightItem = signal(0);
|
|
204
|
+
timeIntervalIntervalSetHeightViewPort = signal(0);
|
|
205
|
+
timeIntervalCheckScroll = signal(250);
|
|
206
|
+
onDestroy = new Subject();
|
|
207
|
+
intervalSetHeightViewPortSubscription;
|
|
208
|
+
intervalCheckScrollSubscription;
|
|
209
|
+
// #region INPUT
|
|
210
|
+
functionGetItemsAutoAddList = input();
|
|
211
|
+
paddingLeftItem = input();
|
|
212
|
+
maxItemShow = input(0);
|
|
213
|
+
searchConfig = input();
|
|
214
|
+
config = input();
|
|
215
|
+
keySearch = model('');
|
|
216
|
+
dropdownTabKeyActive = input();
|
|
217
|
+
isSearchOnline = input(false);
|
|
218
|
+
onSearch = input();
|
|
219
|
+
onRefresh = input();
|
|
220
|
+
onSetHiddenItemByKey = input();
|
|
221
|
+
onRemoveItems = input();
|
|
222
|
+
onSetDataStore = input();
|
|
223
|
+
onUpdateMultiKeySelectedGroup = input();
|
|
224
|
+
onUpdateData = input();
|
|
225
|
+
clickExactly = input();
|
|
226
|
+
keySelected = model(); // sử dụng cho type radio,text.
|
|
227
|
+
multiKeySelected = model([]); // sử dụng cho type cho phép chọn nhiều.
|
|
228
|
+
keysDisableItem = input();
|
|
229
|
+
keysHiddenItem = model();
|
|
230
|
+
disable = input();
|
|
231
|
+
disableLabel = input();
|
|
232
|
+
zIndex = input(1200);
|
|
233
|
+
loadingIconSize = input();
|
|
234
|
+
resetKeyWhenSelectAllKeyDropdown = input();
|
|
235
|
+
ignoreClassDisableDefaultWhenUseKeysDisableItem = input(); // bỏ chế độ disable item trên html để disable từng phần trong rows
|
|
236
|
+
templateRefSearchNoData = input();
|
|
237
|
+
autoSelectedFirstItemCallOutsideBefore = input(false);
|
|
238
|
+
// #region OUTPUT
|
|
239
|
+
outSortSingleSelect = output();
|
|
240
|
+
outSelectKey = output(); // sử dụng cho type radio,text.
|
|
241
|
+
outSelectMultiKey = output(); // sử dụng cho type cho phép chọn nhiều.
|
|
242
|
+
outUnSelectMultiKey = output(); // sử dụng cho type cho phép chọn nhiều.
|
|
243
|
+
outFieldKey = output();
|
|
244
|
+
outChangeView = output();
|
|
245
|
+
outLoading = output();
|
|
246
|
+
outChangStageFlagMousePopover = output();
|
|
247
|
+
outLoadItemsComplete = output();
|
|
248
|
+
/* VIEW CHILD */
|
|
249
|
+
itemRef = viewChild('itemRef');
|
|
250
|
+
elementScroll = viewChild('elementScroll');
|
|
251
|
+
// #region INJECT
|
|
252
|
+
translateService = inject(TranslateService);
|
|
253
|
+
httpRequestService = inject(LibsUiHttpRequestService);
|
|
254
|
+
constructor() {
|
|
255
|
+
this.outLoading.emit(this.loading());
|
|
256
|
+
}
|
|
257
|
+
ngOnInit() {
|
|
258
|
+
this.onSearch()
|
|
259
|
+
?.pipe(takeUntil(this.onDestroy))
|
|
260
|
+
.subscribe((keySearch) => {
|
|
261
|
+
this.keySearch.set(keySearch ?? '');
|
|
262
|
+
this.processSearch();
|
|
263
|
+
});
|
|
264
|
+
this.onRefresh()
|
|
265
|
+
?.pipe(skipWhile(() => this.loading()), takeUntil(this.onDestroy))
|
|
266
|
+
.subscribe(() => {
|
|
267
|
+
if (this.dropdownTabKeyActive()) {
|
|
268
|
+
this.items.set([]);
|
|
269
|
+
this.store.set([]);
|
|
270
|
+
}
|
|
271
|
+
this.callApiByService(true);
|
|
272
|
+
});
|
|
273
|
+
this.onSetHiddenItemByKey()?.pipe(takeUntil(this.onDestroy)).subscribe(this.setHiddenItemByKey.bind(this));
|
|
274
|
+
this.outFieldKey.emit(getFieldKeyByType(this.config(), this.fieldKeyDefault()));
|
|
275
|
+
this.onRemoveItems()?.pipe(takeUntil(this.onDestroy)).subscribe(this.removeItems.bind(this));
|
|
276
|
+
this.onUpdateData()?.pipe(takeUntil(this.onDestroy)).subscribe(this.updateData.bind(this));
|
|
277
|
+
}
|
|
278
|
+
/* FUNCTIONS */
|
|
279
|
+
updateData(data) {
|
|
280
|
+
if (!data) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const { newData, functionCustomAddDataToStore } = data;
|
|
284
|
+
if (!newData() || !newData().length) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (this.config()?.type === 'checkbox') {
|
|
288
|
+
newData().forEach((item) => item.update((value) => ({ ...value, isAddNew: true })));
|
|
289
|
+
}
|
|
290
|
+
functionCustomAddDataToStore(newData, this.store);
|
|
291
|
+
this.processData();
|
|
292
|
+
}
|
|
293
|
+
getFieldKey() {
|
|
294
|
+
let fieldKey;
|
|
295
|
+
const config = this.config();
|
|
296
|
+
if (!config) {
|
|
297
|
+
return 'id';
|
|
298
|
+
}
|
|
299
|
+
switch (config.type) {
|
|
300
|
+
case 'group':
|
|
301
|
+
fieldKey = config.configTemplateGroup?.()?.fieldKey;
|
|
302
|
+
break;
|
|
303
|
+
case 'tag':
|
|
304
|
+
fieldKey = config.configTemplateTag?.()?.fieldKey;
|
|
305
|
+
break;
|
|
306
|
+
case 'text':
|
|
307
|
+
fieldKey = config.configTemplateText?.()?.fieldKey;
|
|
308
|
+
break;
|
|
309
|
+
case 'checkbox':
|
|
310
|
+
fieldKey = config.configTemplateCheckbox?.()?.fieldKey;
|
|
311
|
+
break;
|
|
312
|
+
case 'radio':
|
|
313
|
+
fieldKey = config.configTemplateRadio?.()?.fieldKey;
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
return fieldKey || 'id';
|
|
317
|
+
}
|
|
318
|
+
removeItems(keys) {
|
|
319
|
+
const fieldKey = this.getFieldKey();
|
|
320
|
+
[this.store(), this.items()].forEach((element) => {
|
|
321
|
+
if (this.config()?.type === 'group') {
|
|
322
|
+
element.forEach((item) => {
|
|
323
|
+
this.removeItem(item()[this.config()?.configTemplateGroup?.()?.fieldGetItems || 'items'](), keys, fieldKey);
|
|
324
|
+
});
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
this.removeItem(element, keys, fieldKey);
|
|
328
|
+
});
|
|
329
|
+
this.processData();
|
|
330
|
+
}
|
|
331
|
+
removeItem(data, keys, fieldKey) {
|
|
332
|
+
if (!data || !data.length) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
keys.forEach((key) => {
|
|
336
|
+
const index = data.findIndex((item) => item()[fieldKey] === key);
|
|
337
|
+
if (index > -1) {
|
|
338
|
+
data.splice(index, 1);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
setHeightViewPort(callBackCalculatorHeightSuccess) {
|
|
343
|
+
const lengthItems = this.getLengthItem();
|
|
344
|
+
this.heightItem.update((val) => this.config()?.heightItem || val);
|
|
345
|
+
if (!lengthItems || this.maxItemShow() === -1) {
|
|
346
|
+
this.outChangeView.emit([...this.items()]);
|
|
347
|
+
if (this.heightItem()) {
|
|
348
|
+
this.heightViewPort.set(this.heightItem());
|
|
349
|
+
}
|
|
350
|
+
callBackCalculatorHeightSuccess?.();
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
const totalHeightByCountItem = lengthItems < this.maxItemShow() ? lengthItems * this.heightItem() : this.maxItemShow() * this.heightItem();
|
|
354
|
+
const heightByCheckboxAll = this.config()?.configTemplateGroup?.()?.configCheckboxCheckAll ? 27 : 0;
|
|
355
|
+
const heightConfigButtonSelectAndUndSelectItem = this.config()?.configTemplateGroup?.()?.configButtonSelectAndUndSelectItem ? 27 : 0;
|
|
356
|
+
const heightViewPort = this.getHeightGroupHasLine() + totalHeightByCountItem + heightByCheckboxAll + heightConfigButtonSelectAndUndSelectItem;
|
|
357
|
+
if (!this.maxItemShow()) {
|
|
358
|
+
this.heightViewPort.set(0);
|
|
359
|
+
}
|
|
360
|
+
if (this.heightItem() >= (this.config()?.minHeightItem ?? 13)) {
|
|
361
|
+
if (heightViewPort && heightViewPort !== this.heightViewPort()) {
|
|
362
|
+
this.heightViewPort.set(heightViewPort);
|
|
363
|
+
}
|
|
364
|
+
this.outChangeView.emit([...this.items()]);
|
|
365
|
+
callBackCalculatorHeightSuccess?.();
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
this.intervalSetHeightViewPortSubscription?.unsubscribe();
|
|
369
|
+
this.intervalSetHeightViewPortSubscription = interval(this.timeIntervalIntervalSetHeightViewPort())
|
|
370
|
+
.pipe(takeUntil(this.onDestroy))
|
|
371
|
+
.subscribe(() => {
|
|
372
|
+
if (!this.itemRef() || !this.itemRef()?.nativeElement) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
this.heightItem.set(this.itemRef()?.nativeElement.getBoundingClientRect().height);
|
|
376
|
+
if (this.heightItem() < (this.config()?.minHeightItem || 13)) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
this.intervalSetHeightViewPortSubscription?.unsubscribe();
|
|
380
|
+
this.setHeightViewPort(callBackCalculatorHeightSuccess);
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
setHiddenItemByKey(keys) {
|
|
384
|
+
this.keysHiddenItem.set(keys);
|
|
385
|
+
if (this.store() && this.store().length) {
|
|
386
|
+
this.processData(false);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
checkViewPortScroll(callBack) {
|
|
390
|
+
const pre = this.hasScroll();
|
|
391
|
+
this.intervalCheckScrollSubscription?.unsubscribe();
|
|
392
|
+
this.intervalCheckScrollSubscription = interval(this.timeIntervalCheckScroll())
|
|
393
|
+
.pipe(take(5))
|
|
394
|
+
.subscribe(() => {
|
|
395
|
+
this.hasScroll.set(false);
|
|
396
|
+
if (this.items() && !this.items().length && pre && !this.hasScroll()) {
|
|
397
|
+
callBack?.(pre, this.hasScroll());
|
|
398
|
+
this.intervalCheckScrollSubscription?.unsubscribe();
|
|
399
|
+
}
|
|
400
|
+
callBack?.(pre, this.hasScroll());
|
|
401
|
+
this.intervalCheckScrollSubscription?.unsubscribe();
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
async callApiByService(firstCall = true) {
|
|
405
|
+
const config = this.config();
|
|
406
|
+
if (!config) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
try {
|
|
410
|
+
const { httpRequestData, ignoreShowDataWhenNotSearch } = config;
|
|
411
|
+
if (!httpRequestData?.() || (ignoreShowDataWhenNotSearch && !this.keySearch())) {
|
|
412
|
+
this.loading.set(false);
|
|
413
|
+
this.outLoading.emit(this.loading());
|
|
414
|
+
this.loadedLastItem.set(true);
|
|
415
|
+
if (ignoreShowDataWhenNotSearch && !this.keySearch()) {
|
|
416
|
+
this.items.set([]);
|
|
417
|
+
this.store.set([]);
|
|
418
|
+
this.processData(true);
|
|
419
|
+
}
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
this.loading.set(true);
|
|
423
|
+
this.outLoading.emit(this.loading());
|
|
424
|
+
const { argumentsValue, guideAutoUpdateArgumentsValue } = httpRequestData();
|
|
425
|
+
if (firstCall) {
|
|
426
|
+
const loadedLastItem = this.httpRequestService.updateArguments(argumentsValue, { ...this.fakeResponseApi(), dropdownTabKeyActive: this.dropdownTabKeyActive() }, this.pagingStore() || {}, this.keySearch(), this.isSearchOnline(), this.loadedLastItem(), guideAutoUpdateArgumentsValue);
|
|
427
|
+
this.loadedLastItem.set(loadedLastItem);
|
|
428
|
+
}
|
|
429
|
+
const result = await this.httpRequestService.callApi(httpRequestData());
|
|
430
|
+
this.pagingStore.set(result.paging);
|
|
431
|
+
if (!this.pagingStore()) {
|
|
432
|
+
this.loadedLastItem.set(true);
|
|
433
|
+
}
|
|
434
|
+
const loadedLastItem = this.httpRequestService.updateArguments(argumentsValue, { ...result, dropdownTabKeyActive: this.dropdownTabKeyActive() }, this.pagingStore() || {}, this.keySearch(), this.isSearchOnline(), this.loadedLastItem(), guideAutoUpdateArgumentsValue);
|
|
435
|
+
this.loadedLastItem.set(loadedLastItem);
|
|
436
|
+
if (firstCall) {
|
|
437
|
+
this.store.set(convertObjectToSignal(result.data || [])());
|
|
438
|
+
if (this.functionGetItemsAutoAddList()) {
|
|
439
|
+
const newItems = convertObjectToSignal(this.functionGetItemsAutoAddList()?.() || []);
|
|
440
|
+
this.store.update((items) => [...newItems(), ...items]);
|
|
441
|
+
}
|
|
442
|
+
this.processData(true);
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
this.store.update((items) => [...items, ...convertObjectToSignal(result.data || [])()]);
|
|
446
|
+
this.processData(false);
|
|
447
|
+
}
|
|
448
|
+
catch (error) {
|
|
449
|
+
this.loading.set(false);
|
|
450
|
+
this.outLoading.emit(this.loading());
|
|
451
|
+
console.log(error);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
fakeResponseApi() {
|
|
455
|
+
this.loadedLastItem.set(false);
|
|
456
|
+
this.pagingStore.set({});
|
|
457
|
+
return this.httpRequestService.fakeResponsePagingApi();
|
|
458
|
+
}
|
|
459
|
+
buildValueByConfig(item, configTemplate) {
|
|
460
|
+
const ref = item().ref || {};
|
|
461
|
+
const label = ref.label ?? ref.title ?? ref.value ?? ref.name;
|
|
462
|
+
const valueSearchByFunction = configTemplate?.getLabelSearch?.(ref);
|
|
463
|
+
if (!isNil(label) && typeof label !== 'object') {
|
|
464
|
+
item.update((currentItem) => {
|
|
465
|
+
return { ...currentItem, fieldLabel: typeof label === 'string' ? this.translateService.instant(label) : `${label}` };
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
if (configTemplate?.getValue) {
|
|
469
|
+
const value = configTemplate.getValue(ref, item);
|
|
470
|
+
const label = typeof value === 'number' ? `${value}` : value ? this.translateService.instant(`${value}`) : '';
|
|
471
|
+
item.update((currentItem) => {
|
|
472
|
+
return { ...currentItem, fieldLabel: label };
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
if (configTemplate?.getPopover) {
|
|
476
|
+
item.update((currentItem) => {
|
|
477
|
+
return { ...currentItem, popoverLabel: configTemplate?.getPopover?.(item()) };
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
if (!configTemplate?.rows?.()) {
|
|
481
|
+
return valueSearchByFunction ?? (item().fieldLabel || ' ');
|
|
482
|
+
}
|
|
483
|
+
let textSearch = item().fieldLabel || ' ';
|
|
484
|
+
const rows = convertSignalToObject(configTemplate.rows());
|
|
485
|
+
rows.forEach(async (row, indexRow) => {
|
|
486
|
+
const fieldNameRow = `fieldLabelRow${indexRow}`;
|
|
487
|
+
const currentItem = cloneDeep(item());
|
|
488
|
+
const newItem = { ...currentItem };
|
|
489
|
+
newItem[fieldNameRow] = (row.getValue && row.getValue(ref, item, indexRow)) || of('');
|
|
490
|
+
newItem[`fieldRowStylesDynamicCols${indexRow}`] = row.getRowStylesDynamicCols && row.getRowStylesDynamicCols(ref);
|
|
491
|
+
newItem[`fieldRowAvatarConfig${indexRow}`] = row.getAvatarConfig && row.getAvatarConfig(ref);
|
|
492
|
+
if (row.cols && row.cols.length) {
|
|
493
|
+
row.cols.forEach(async (col, indexCol) => {
|
|
494
|
+
const fieldNameCol = `fieldLabelCol${indexRow}${indexCol}`;
|
|
495
|
+
newItem[fieldNameCol] = col.getValue;
|
|
496
|
+
newItem[`fieldColClass${indexRow}${indexCol}`] = col.getClassCol && col.getClassCol(ref, indexCol);
|
|
497
|
+
newItem[`fieldColPopover${indexRow}${indexCol}`] = col.getPopover && col.getPopover(ref, indexCol);
|
|
498
|
+
newItem[`fieldBadge${indexRow}${indexCol}`] = col.getConfigBadge && col.getConfigBadge(ref, indexCol);
|
|
499
|
+
newItem[`fieldColStylesDynamic${indexRow}${indexCol}`] = col.getStylesDynamicCol;
|
|
500
|
+
newItem[`fieldColButton${indexRow}${indexCol}`] = col.getButton && col.getButton(ref, indexCol);
|
|
501
|
+
newItem[`fieldColSwitch${indexRow}${indexCol}`] = col.getLabelSwitch && col.getLabelSwitch(ref, indexCol);
|
|
502
|
+
newItem[`fieldColAvatarConfig${indexRow}${indexCol}`] = col.getAvatarConfig && col.getAvatarConfig(ref);
|
|
503
|
+
const text = (col.getValue && col.getValue(ref, item, indexRow, indexCol)) || of('');
|
|
504
|
+
textSearch = ` ${textSearch} ${(await lastValueFrom(text)) || ''} `;
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
item.update(() => newItem);
|
|
508
|
+
textSearch = ` ${textSearch} ${(await lastValueFrom(item()[fieldNameRow])) || ''} `;
|
|
509
|
+
});
|
|
510
|
+
return valueSearchByFunction ?? (textSearch || ' ');
|
|
511
|
+
}
|
|
512
|
+
handlerChangStageFlagMouse(flag) {
|
|
513
|
+
this.outChangStageFlagMousePopover.emit(flag);
|
|
514
|
+
}
|
|
515
|
+
getHeightGroupHasLine() {
|
|
516
|
+
return 0;
|
|
517
|
+
}
|
|
518
|
+
ngOnDestroy() {
|
|
519
|
+
clearTimeout(this.timeAutoScrollItemSelected());
|
|
520
|
+
this.onDestroy.next();
|
|
521
|
+
this.onDestroy.complete();
|
|
522
|
+
}
|
|
523
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListTemplatesComponentAbstract, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
524
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "18.2.14", type: LibsUiComponentsListTemplatesComponentAbstract, inputs: { functionGetItemsAutoAddList: { classPropertyName: "functionGetItemsAutoAddList", publicName: "functionGetItemsAutoAddList", 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 }, onUpdateData: { classPropertyName: "onUpdateData", publicName: "onUpdateData", 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 }, autoSelectedFirstItemCallOutsideBefore: { classPropertyName: "autoSelectedFirstItemCallOutsideBefore", publicName: "autoSelectedFirstItemCallOutsideBefore", 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 }, { propertyName: "elementScroll", first: true, predicate: ["elementScroll"], descendants: true, isSignal: true }], ngImport: i0 });
|
|
525
|
+
}
|
|
526
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListTemplatesComponentAbstract, decorators: [{
|
|
527
|
+
type: Directive
|
|
528
|
+
}], ctorParameters: () => [] });
|
|
529
|
+
|
|
530
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
531
|
+
class LibsUiComponentsListCheckboxComponent extends LibsUiComponentsListTemplatesComponentAbstract {
|
|
532
|
+
// #region PROPERTY
|
|
533
|
+
configTemplateCheckbox = signal(undefined);
|
|
534
|
+
virtualScrollerComponent = viewChild(VirtualScrollerComponent);
|
|
535
|
+
ngOnInit() {
|
|
536
|
+
if (isNil(this.config()?.configTemplateCheckbox?.())) {
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
super.ngOnInit();
|
|
540
|
+
this.configTemplateCheckbox.set(this.config()?.configTemplateCheckbox?.());
|
|
541
|
+
this.fieldKey.set(this.configTemplateCheckbox()?.fieldKey ?? this.fieldKeyDefault());
|
|
542
|
+
this.callApiByService();
|
|
543
|
+
}
|
|
544
|
+
/* FUNCTIONS */
|
|
545
|
+
async handlerSelect(isSelectAll, isClickCheckboxAll) {
|
|
546
|
+
if (isSelectAll && this.resetKeyWhenSelectAllKeyDropdown()) {
|
|
547
|
+
this.multiKeySelected.set([]);
|
|
548
|
+
}
|
|
549
|
+
if (!this.multiKeySelected()) {
|
|
550
|
+
this.multiKeySelected.set([]);
|
|
551
|
+
}
|
|
552
|
+
if (this.loading()) {
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
const result = await this.getIdsByService();
|
|
556
|
+
this.processHandlerSelectData(isSelectAll, isClickCheckboxAll && !isSelectAll ? cloneDeep(this.multiKeySelected()) : result.data);
|
|
557
|
+
}
|
|
558
|
+
processHandlerSelectData(isSelectAll, ids) {
|
|
559
|
+
const keysDisable = this.keysDisableItem() || [];
|
|
560
|
+
const keys = new Set(this.multiKeySelected());
|
|
561
|
+
this.multiKeySelected.set([]);
|
|
562
|
+
this.loading.set(false);
|
|
563
|
+
this.outLoading.emit(this.loading());
|
|
564
|
+
if (isSelectAll) {
|
|
565
|
+
if (ids.length) {
|
|
566
|
+
ids.forEach((id) => !keysDisable.some((keyDisable) => keyDisable === id) && keys.add(id));
|
|
567
|
+
}
|
|
568
|
+
if (!ids.length) {
|
|
569
|
+
this.items().forEach((item) => {
|
|
570
|
+
const key = item()[this.fieldKey()];
|
|
571
|
+
if (!keysDisable.some((keyDisable) => keyDisable === key)) {
|
|
572
|
+
keys.add(key);
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
this.multiKeySelected.update((items) => [...(items || []), ...keys]);
|
|
577
|
+
this.emitSelectMultiKey(this.multiKeySelected() || []);
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
const keyUnSelected = new Set();
|
|
581
|
+
ids.forEach((id) => {
|
|
582
|
+
if (!keysDisable.some((keyDisable) => keyDisable === id)) {
|
|
583
|
+
keys.delete(id);
|
|
584
|
+
keyUnSelected.add(id);
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
if (!ids.length) {
|
|
588
|
+
this.items().forEach((item) => {
|
|
589
|
+
const key = item()[this.fieldKey()];
|
|
590
|
+
if (!keysDisable.some((keyDisable) => keyDisable === key)) {
|
|
591
|
+
keys.delete(key);
|
|
592
|
+
keyUnSelected.add(key);
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
this.multiKeySelected.update((items) => [...(items || []), ...keys]);
|
|
597
|
+
this.outUnSelectMultiKey.emit(Array.from(keyUnSelected));
|
|
598
|
+
this.outSelectMultiKey.emit({ keys: this.multiKeySelected() || [], mapKeys: [], isClickManual: true });
|
|
599
|
+
}
|
|
600
|
+
async getIdsByService() {
|
|
601
|
+
if (!this.searchConfig() || !this.isSearchOnline()) {
|
|
602
|
+
return { code: 200, data: this.items().map((item) => item()[this.fieldKey()]) };
|
|
603
|
+
}
|
|
604
|
+
try {
|
|
605
|
+
if (!this.configTemplateCheckbox()?.httpRequestAllIdSelectOrUnSelect?.()) {
|
|
606
|
+
return { data: [] };
|
|
607
|
+
}
|
|
608
|
+
this.loading.set(true);
|
|
609
|
+
this.outLoading.emit(this.loading());
|
|
610
|
+
const httpRequestAllIdSelectOrUnSelect = this.configTemplateCheckbox()?.httpRequestAllIdSelectOrUnSelect?.();
|
|
611
|
+
if (!httpRequestAllIdSelectOrUnSelect) {
|
|
612
|
+
return { data: [] };
|
|
613
|
+
}
|
|
614
|
+
const { argumentsValue, guideAutoUpdateArgumentsValue } = httpRequestAllIdSelectOrUnSelect;
|
|
615
|
+
this.httpRequestService.updateArguments(argumentsValue, this.httpRequestService.fakeResponsePagingApi(), {}, this.keySearch(), this.isSearchOnline(), false, guideAutoUpdateArgumentsValue);
|
|
616
|
+
const result = await this.httpRequestService.callApi(httpRequestAllIdSelectOrUnSelect);
|
|
617
|
+
if (!result || !result.data || !result.data.length) {
|
|
618
|
+
return { data: [] };
|
|
619
|
+
}
|
|
620
|
+
return result;
|
|
621
|
+
}
|
|
622
|
+
catch (error) {
|
|
623
|
+
console.log(error);
|
|
624
|
+
return { data: [] };
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
handlerScrollBottom() {
|
|
628
|
+
if (this.loadedLastItem()) {
|
|
629
|
+
this.loading.set(false);
|
|
630
|
+
this.outLoading.emit(this.loading());
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
if (this.loading() || this.loadedLastItem()) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
this.loading.set(true);
|
|
637
|
+
this.outLoading.emit(this.loading());
|
|
638
|
+
this.callApiByService(false);
|
|
639
|
+
}
|
|
640
|
+
processSearch() {
|
|
641
|
+
if (!this.isSearchOnline()) {
|
|
642
|
+
return this.processData(true);
|
|
643
|
+
}
|
|
644
|
+
this.callApiByService(true);
|
|
645
|
+
}
|
|
646
|
+
handlerChange(event, item, ignoreDisable = false, isClickManual = true) {
|
|
647
|
+
if (this.configTemplateCheckbox()?.ignoreClickItemUnChecked) {
|
|
648
|
+
const key = item[this.fieldKey()];
|
|
649
|
+
if (this.multiKeySelected()?.includes(key)) {
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
if (!this.multiKeySelected()) {
|
|
654
|
+
this.multiKeySelected.set([]);
|
|
655
|
+
}
|
|
656
|
+
if (!ignoreDisable && (this.disable() || this.keysDisableItem()?.some((keyDisable) => keyDisable === item[this.fieldKey()]))) {
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
if (event instanceof Event) {
|
|
660
|
+
if (this.clickExactly()) {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
this.checkAndEmitMultiKeySelected(item, isClickManual);
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
this.checkAndEmitMultiKeySelected(item, isClickManual);
|
|
667
|
+
}
|
|
668
|
+
checkAndEmitMultiKeySelected(item, isClickManual = true) {
|
|
669
|
+
const key = get(item, this.fieldKey());
|
|
670
|
+
const indexOfKey = this.multiKeySelected()?.indexOf(key) ?? -1;
|
|
671
|
+
if (indexOfKey < 0) {
|
|
672
|
+
this.multiKeySelected.update((items) => [...(items || []), key]);
|
|
673
|
+
this.emitSelectMultiKey(this.multiKeySelected() || [], isClickManual);
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
this.multiKeySelected.update((items) => items?.filter((item) => item !== key));
|
|
677
|
+
this.outUnSelectMultiKey.emit([key]);
|
|
678
|
+
this.emitSelectMultiKey(this.multiKeySelected() || [], isClickManual);
|
|
679
|
+
}
|
|
680
|
+
async emitSelectMultiKey(multiKeySelected, isClickManual = true) {
|
|
681
|
+
const mapKeys = new Array();
|
|
682
|
+
if (!multiKeySelected || !multiKeySelected.length) {
|
|
683
|
+
return this.outSelectMultiKey.emit({ keys: [], mapKeys, isClickManual });
|
|
684
|
+
}
|
|
685
|
+
multiKeySelected.forEach((key) => {
|
|
686
|
+
const item = this.store().find((item) => item()[this.fieldKey()] === key);
|
|
687
|
+
mapKeys.push({ key, item: convertSignalToObject(item), isClickManual });
|
|
688
|
+
});
|
|
689
|
+
this.outSelectMultiKey.emit({ keys: this.multiKeySelected() || [], mapKeys, isClickManual });
|
|
690
|
+
}
|
|
691
|
+
processData(replace) {
|
|
692
|
+
const itemByKeySearch = [];
|
|
693
|
+
const keysHidden = this.keysHiddenItem() || [];
|
|
694
|
+
const itemsAddNew = [];
|
|
695
|
+
if (replace) {
|
|
696
|
+
this.items.set([]);
|
|
697
|
+
}
|
|
698
|
+
this.store().forEach((item) => {
|
|
699
|
+
const itemTypeAddNew = item().isAddNew;
|
|
700
|
+
item.update((current) => {
|
|
701
|
+
delete current.isAddNew;
|
|
702
|
+
return current;
|
|
703
|
+
});
|
|
704
|
+
const dataStore = cloneDeep(item);
|
|
705
|
+
dataStore.update((currentStore) => {
|
|
706
|
+
return { ...currentStore, ref: item() };
|
|
707
|
+
});
|
|
708
|
+
if (this.configTemplateCheckbox()?.getPopover) {
|
|
709
|
+
dataStore.update((currentStore) => {
|
|
710
|
+
return { ...currentStore, dataTooltip: this.configTemplateCheckbox()?.getPopover?.(dataStore()) };
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
const key = keysHidden.find((key) => dataStore()[this.fieldKey()] === key);
|
|
714
|
+
if (key === undefined) {
|
|
715
|
+
const text = deleteUnicode(this.buildValueByConfig(dataStore, this.configTemplateCheckbox())).toLocaleLowerCase();
|
|
716
|
+
const textEscape = escapeHtml(text);
|
|
717
|
+
const keySearch = deleteUnicode(escapeHtml(this.keySearch().toLocaleLowerCase()));
|
|
718
|
+
if (((this.isSearchOnline() && this.config()?.httpRequestData?.()?.serviceClass && !this.config()?.httpRequestData?.()?.objectInstance) || (text && (text.includes(keySearch) || textEscape.includes(keySearch)))) &&
|
|
719
|
+
(replace || (!replace && !this.items().find((dataItem) => dataItem()[this.fieldKey()] === dataStore()[this.fieldKey()]))) &&
|
|
720
|
+
!itemByKeySearch.find((dataItem) => dataItem()[this.fieldKey()] === dataStore()[this.fieldKey()])) {
|
|
721
|
+
dataStore.update((currentStore) => {
|
|
722
|
+
return {
|
|
723
|
+
...currentStore,
|
|
724
|
+
classLabelInclude: this.configTemplateCheckbox()?.getClassItem?.(dataStore()),
|
|
725
|
+
avatarConfig: this.configTemplateCheckbox()?.getAvatarConfig?.(dataStore()),
|
|
726
|
+
};
|
|
727
|
+
});
|
|
728
|
+
if (itemTypeAddNew) {
|
|
729
|
+
itemsAddNew.unshift(dataStore);
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
itemByKeySearch.push(dataStore);
|
|
733
|
+
}
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
this.items.update((items) => items.filter((item) => item()[this.fieldKey()] !== key));
|
|
737
|
+
});
|
|
738
|
+
const callbackCheckScroll = (preStateHasScroll, currentHasScroll) => {
|
|
739
|
+
this.scrollToItemSelected();
|
|
740
|
+
if (this.keysHiddenItem()?.length && preStateHasScroll && !currentHasScroll && this.isSearchOnline()) {
|
|
741
|
+
this.callApiByService(false);
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
if (replace) {
|
|
745
|
+
this.items.set(itemByKeySearch);
|
|
746
|
+
this.config()?.sort?.(this.items());
|
|
747
|
+
this.autoSelectFirstItem(this.items());
|
|
748
|
+
this.setHeightViewPort();
|
|
749
|
+
this.checkViewPortScroll(callbackCheckScroll);
|
|
750
|
+
this.loading.set(false);
|
|
751
|
+
this.outLoading.emit(this.loading());
|
|
752
|
+
this.outLoadItemsComplete.emit({ items: this.items() });
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
this.items.update((items) => [...itemsAddNew, ...(items || []), ...itemByKeySearch]);
|
|
756
|
+
this.config()?.sort?.(this.items());
|
|
757
|
+
this.setHeightViewPort();
|
|
758
|
+
this.checkViewPortScroll(callbackCheckScroll);
|
|
759
|
+
this.loading.set(false);
|
|
760
|
+
this.outLoading.emit(this.loading());
|
|
761
|
+
this.outLoadItemsComplete.emit({ items: this.items() });
|
|
762
|
+
}
|
|
763
|
+
scrollToItemSelected() {
|
|
764
|
+
if (!this.configTemplateCheckbox()?.autoScrollToItemSelected) {
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
clearTimeout(this.timeAutoScrollItemSelected());
|
|
768
|
+
this.timeAutoScrollItemSelected.set(setTimeout(() => {
|
|
769
|
+
if (!this.keySelected) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
const index = this.items().findIndex((item) => item()[this.fieldKey()] === this.keySelected());
|
|
773
|
+
if (index !== -1) {
|
|
774
|
+
const offsetContainer = this.elementScroll()?.nativeElement?.offsetHeight;
|
|
775
|
+
const additionalOffset = ((offsetContainer ? offsetContainer - this.heightItem() : 0) / 2) * -1;
|
|
776
|
+
this.virtualScrollerComponent()?.scrollToIndex(index, true, additionalOffset, this.timeAnimationScrollToIndexItem());
|
|
777
|
+
}
|
|
778
|
+
}));
|
|
779
|
+
}
|
|
780
|
+
autoSelectFirstItem(items) {
|
|
781
|
+
if (this.autoSelectedFirstItemCallOutsideBefore() || this.multiKeySelected()?.length || !this.config()?.autoSelectFirstItem || !items || !items.length) {
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
this.handlerChange('checkbox', items[0](), true, false);
|
|
785
|
+
}
|
|
786
|
+
getLengthItem() {
|
|
787
|
+
return this.items().length;
|
|
788
|
+
}
|
|
789
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListCheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
790
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LibsUiComponentsListCheckboxComponent, isStandalone: true, selector: "libs_ui-components-list-templates_checkbox", viewQueries: [{ propertyName: "virtualScrollerComponent", first: true, predicate: VirtualScrollerComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (configTemplateCheckbox(); as configTemplateCheckbox) {\n <div class=\"flex flex-col w-full h-full\">\n @if (items().length && configTemplateCheckbox.configButtonSelectAndUndSelectItem?.(); as configButtonSelectItem) {\n <div [class]=\"'flex items-center bg-[#ffffff] ' + (configButtonSelectItem.classInclude ?? 'libs-ui-border-bottom-general')\">\n <libs_ui-components-buttons-button\n [type]=\"configButtonSelectItem.buttonCheckAll?.type ?? 'button-link-primary'\"\n [label]=\"configButtonSelectItem.buttonCheckAll?.label ?? 'i18n_select_all_searched_results'\"\n [classInclude]=\"configButtonSelectItem.buttonCheckAll?.classInclude || 'pr-[8px]'\"\n [classLabel]=\"configButtonSelectItem.buttonCheckAll?.classLabel || 'libs-ui-font-h6ri'\"\n [disable]=\"loading() || disable() || false\"\n (outClick)=\"handlerSelect(true)\" />\n <div class=\"text-[#e6e7ea]\">|</div>\n <libs_ui-components-buttons-button\n [type]=\"configButtonSelectItem.buttonUncheckAll?.type ?? 'button-link-primary'\"\n [label]=\"configButtonSelectItem.buttonUncheckAll?.label ?? 'i18n_unselect_all_searched_results'\"\n [classInclude]=\"configButtonSelectItem.buttonUncheckAll?.classInclude || 'pl-[8px]'\"\n [classLabel]=\"configButtonSelectItem.buttonUncheckAll?.classLabel || 'libs-ui-font-h6ri'\"\n [disable]=\"loading() || disable() || false\"\n (outClick)=\"handlerSelect(false)\" />\n </div>\n }\n @if (items().length && configTemplateCheckbox.configCheckboxCheckAll?.(); as configCheckBox) {\n @let constHtmlLengthMultiKeySelected = multiKeySelected().length || 0;\n @let constHtmlLengthStore = store().length || -1;\n <div [class]=\"'flex libs-ui-border-bottom-general bg-[#ffffff] pl-[12px] ' + (configTemplateCheckbox.classIncludeHasConfigCheckBoxAll ?? 'py-[6px] libs-ui-border-bottom-general')\">\n <libs_ui-components-checkbox-single\n [label]=\"configCheckBox.label ?? 'i18n_all'\"\n [classLabelInclude]=\"configCheckBox.classLabelInclude || ''\"\n [checked]=\"(constHtmlLengthMultiKeySelected && constHtmlLengthMultiKeySelected >= constHtmlLengthStore) || false\"\n [stillOtherOptions]=\"!!constHtmlLengthMultiKeySelected && constHtmlLengthMultiKeySelected < constHtmlLengthStore\"\n [disable]=\"loading() || disable() || false\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChange)=\"handlerSelect($event.checked, true)\" />\n </div>\n }\n <div [class]=\"'relative h-full w-full ' + (!items() || !items().length ? 'bg-[#ffffff]' : configTemplateCheckbox.classListInclude || '')\">\n @if (items() && items().length) {\n <div\n #elementScroll\n LibsUiComponentsScrollOverlayDirective\n class=\"w-full\"\n [class.h-full]=\"!(heightViewPort() && !config()?.ignoreShowDataWhenNotSearch)\"\n [style.height]=\"heightViewPort() && !config()?.ignoreShowDataWhenNotSearch ? heightViewPort() + 'px' : '100%'\"\n (outScrollBottom)=\"handlerScrollBottom()\">\n <virtual-scroller\n #scroll\n [parentScroll]=\"elementScroll\"\n [items]=\"items()\"\n class=\"h-full\">\n @for (item of scroll.viewPortItems; track item()[fieldKey()]; let last = $last) {\n <div [class]=\"last ? configTemplateCheckbox.classIncludeLastViewItem || '' : ''\">\n <div\n #itemRef\n LibsUiComponentsListHighlightKeySearchDirective\n [isHighlight]=\"config()?.highlightTextSearchInResult\"\n [keySearch]=\"keySearch()\"\n [attr.clickExactly]=\"clickExactly()\"\n [class]=\"'libs-ui-list-template-checkbox-item libs-ui-font-h5r flex ' + (configTemplateCheckbox.classItemInclude || '')\"\n [class.w-full]=\"!configTemplateCheckbox.ignoreItemWidth100\"\n [class.libs-ui-bg-list-hover]=\"!clickExactly()\"\n [class.libs-ui-bg-list-hover-active]=\"!clickExactly()\"\n [class.!pl-[12px]]=\"paddingLeftItem()\"\n [class.!py-[6px]]=\"clickExactly()\"\n [class.!pr-[4px]]=\"hasScroll() && configTemplateCheckbox.rows\"\n [class.!pr-[12px]]=\"!hasScroll() && configTemplateCheckbox.rows\"\n (click)=\"handlerChange($event, item())\">\n <div\n class=\"flex flex-col w-full\"\n [class.!flex-row]=\"configTemplateCheckbox.rowSameLineCheckbox\">\n @if (item().fieldLabel) {\n <libs_ui-components-checkbox-single\n [label]=\"item().fieldLabel\"\n [avatarConfig]=\"(item().avatarConfig | LibsUiPipesConvertObjectToSignalPipe)?.()\"\n [linkImage]=\"configTemplateCheckbox.getImage ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: configTemplateCheckbox.getImage : item() | async) : item()[configTemplateCheckbox.fieldGetImage || '']\"\n [linkImageError]=\"\n configTemplateCheckbox.getImageError ? ('avatar_error' | LibsUiPipesCallFunctionInTemplatePipe: configTemplateCheckbox.getImageError : item() | async) : item()[configTemplateCheckbox.fieldGetLinkImageError || '']\n \"\n [classLabelInclude]=\"item().classLabelInclude || configTemplateCheckbox.classLabelInclude || 'libs-ui-font-h5r'\"\n [zIndexLabel]=\"configTemplateCheckbox.zIndexPopover ?? 1200\"\n [checked]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: multiKeySelected() : multiKeySelected().length\"\n [key]=\"item()[fieldKey()]\"\n [imgTypeIcon]=\"configTemplateCheckbox.hasAvatarGroupSocial\"\n [classInclude]=\"configTemplateCheckbox.classInclude || ''\"\n [classImageInclude]=\"configTemplateCheckbox.classIncludeImage || ''\"\n [bullet]=\"(item().bullet | LibsUiPipesConvertObjectToSignalPipe)?.()\"\n [disable]=\"loading() || disable() || (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\"\n [popover]=\"(item().popoverLabel | LibsUiPipesConvertObjectToSignalPipe)?.() | LibsUiPipesConvertSignalToObjectPipe\"\n [clickExactly]=\"clickExactly()\"\n [dataComponentOutlet]=\"undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateCheckbox.getDataComponentOutlet : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\"\n [componentOutlet]=\"0 | LibsUiPipesCallFunctionInTemplatePipe: configTemplateCheckbox.getComponentOutlet : item() : fieldKey() : { valueIs0: 0 } | async\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChange)=\"handlerChange('checkbox', item())\" />\n }\n @if (configTemplateCheckbox?.rows) {\n <libs_ui-components-list-templates_rows\n class=\"{{ !configTemplateCheckbox.ignoreItemWidth100 ? 'w-full' : '' }} {{ (configTemplateCheckbox.classRowsWrapper || configTemplateCheckbox.classRows) ?? '' }}\"\n [item]=\"item()\"\n [zIndex]=\"zIndex()\"\n [fieldKey]=\"fieldKey()\"\n [keySelected]=\"(item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: multiKeySelected() : multiKeySelected().length) ? item()[fieldKey()] : undefined\"\n [configTemplate]=\"configTemplateCheckbox\"\n (outEvent)=\"handlerChange('checkbox', $event.item)\" />\n }\n </div>\n </div>\n </div>\n }\n </virtual-scroller>\n </div>\n }\n @if ((!items() || !items().length) && (!config()?.ignoreShowDataWhenNotSearch || keySearch())) {\n <div [class]=\"'libs-ui-font-h5r text-[#9ca2ad] ' + (config()?.textNoDataClassInclude ?? 'py-[4px] px-[12px]')\">\n @if (config()?.hasIconNoData && !loading()) {\n <div class=\"mb-[16px]\">\n <div *ngComponentOutlet=\"(keySearch() ? 'no-result' : 'no-data') | LibsUiIconsGetIconComponentPipe | async\"></div>\n </div>\n }\n @if (!keySearch() && !loading()) {\n @let constHtmlTextNoData = config()?.textNoData || 'i18n_have_no_selection';\n <span>{{ constHtmlTextNoData | translate }}</span>\n }\n @if (templateRefSearchNoData() && keySearch() && !loading()) {\n <ng-container *ngTemplateOutlet=\"templateRefSearchNoData() || null; context: { keySearch: keySearch() }\" />\n }\n @if (!templateRefSearchNoData() && keySearch() && !loading()) {\n @let constHtmlTextSearchNoData = config()?.textSearchNoData || 'i18n_no_result';\n <span>{{ constHtmlTextSearchNoData | translate }}</span>\n }\n @if (loading()) {\n <span> </span>\n }\n </div>\n }\n @if (loading()) {\n <libs_ui-components-spinner [size]=\"'medium'\" />\n }\n </div>\n </div>\n}\n", styles: [".libs-ui-list-template-checkbox-item{padding:6px 16px;position:relative}\n"], dependencies: [{ kind: "ngmodule", type: VirtualScrollerModule }, { kind: "component", type: i1$1.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: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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", "isHandlerEnterDocumentClickButton"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsCheckboxSingleComponent, selector: "libs_ui-components-checkbox-single", inputs: ["key", "checked", "label", "classLabelInclude", "ignoreShowPopoverLabel", "typeLabelPopover", "popover", "linkImage", "linkImageError", "avatarConfig", "classImageInclude", "imgTypeIcon", "bullet", "classInclude", "clickExactly", "disable", "disableLabel", "ignoreCheckbox", "zIndexLabel", "stillOtherOptions", "error", "showBorderError", "description", "iconImageClass", "classIconInclude", "modeBorder", "dataComponentOutlet", "componentOutlet"], outputs: ["checkedChange", "linkImageChange", "outChange", "outEventPopover", "outClickLabel", "outChangStageFlagMousePopover"] }, { kind: "component", type: LibsUiComponentsSpinnerComponent, selector: "libs_ui-components-spinner", inputs: ["type", "size"] }, { kind: "directive", type: LibsUiComponentsScrollOverlayDirective, selector: "[LibsUiComponentsScrollOverlayDirective]", inputs: ["debugMode", "ignoreInit", "classContainer", "options", "elementCheckScrollX", "elementCheckScrollY", "elementScroll"], outputs: ["outScroll", "outScrollX", "outScrollY", "outScrollTop", "outScrollBottom"] }, { kind: "pipe", type: LibsUiCheckSelectedByKeyPipe, name: "LibsUiCheckSelectedByKeyPipe" }, { kind: "pipe", type: LibsUiIconsGetIconComponentPipe, name: "LibsUiIconsGetIconComponentPipe" }, { kind: "directive", type: LibsUiComponentsListHighlightKeySearchDirective, selector: "[LibsUiComponentsListHighlightKeySearchDirective]", inputs: ["isHighlight", "keySearch", "classHighlight"] }, { kind: "component", type: LibsUiComponentsListRowsComponent, selector: "libs_ui-components-list-templates_rows", inputs: ["configTemplate", "item", "keySelected", "fieldKey", "zIndex"], outputs: ["outChangStageFlagMousePopover", "outEvent"] }, { kind: "pipe", type: LibsUiPipesCallFunctionInTemplatePipe, name: "LibsUiPipesCallFunctionInTemplatePipe" }, { kind: "pipe", type: LibsUiPipesConvertObjectToSignalPipe, name: "LibsUiPipesConvertObjectToSignalPipe" }, { kind: "pipe", type: LibsUiPipesConvertSignalToObjectPipe, name: "LibsUiPipesConvertSignalToObjectPipe" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
791
|
+
}
|
|
792
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListCheckboxComponent, decorators: [{
|
|
793
|
+
type: Component,
|
|
794
|
+
args: [{ selector: 'libs_ui-components-list-templates_checkbox', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
795
|
+
VirtualScrollerModule,
|
|
796
|
+
NgComponentOutlet,
|
|
797
|
+
AsyncPipe,
|
|
798
|
+
TranslateModule,
|
|
799
|
+
NgTemplateOutlet,
|
|
800
|
+
LibsUiComponentsButtonsButtonComponent,
|
|
801
|
+
LibsUiComponentsCheckboxSingleComponent,
|
|
802
|
+
LibsUiComponentsSpinnerComponent,
|
|
803
|
+
LibsUiComponentsScrollOverlayDirective,
|
|
804
|
+
LibsUiCheckSelectedByKeyPipe,
|
|
805
|
+
LibsUiIconsGetIconComponentPipe,
|
|
806
|
+
LibsUiComponentsListHighlightKeySearchDirective,
|
|
807
|
+
LibsUiComponentsListRowsComponent,
|
|
808
|
+
LibsUiPipesCallFunctionInTemplatePipe,
|
|
809
|
+
LibsUiPipesConvertObjectToSignalPipe,
|
|
810
|
+
LibsUiPipesConvertSignalToObjectPipe,
|
|
811
|
+
], template: "@if (configTemplateCheckbox(); as configTemplateCheckbox) {\n <div class=\"flex flex-col w-full h-full\">\n @if (items().length && configTemplateCheckbox.configButtonSelectAndUndSelectItem?.(); as configButtonSelectItem) {\n <div [class]=\"'flex items-center bg-[#ffffff] ' + (configButtonSelectItem.classInclude ?? 'libs-ui-border-bottom-general')\">\n <libs_ui-components-buttons-button\n [type]=\"configButtonSelectItem.buttonCheckAll?.type ?? 'button-link-primary'\"\n [label]=\"configButtonSelectItem.buttonCheckAll?.label ?? 'i18n_select_all_searched_results'\"\n [classInclude]=\"configButtonSelectItem.buttonCheckAll?.classInclude || 'pr-[8px]'\"\n [classLabel]=\"configButtonSelectItem.buttonCheckAll?.classLabel || 'libs-ui-font-h6ri'\"\n [disable]=\"loading() || disable() || false\"\n (outClick)=\"handlerSelect(true)\" />\n <div class=\"text-[#e6e7ea]\">|</div>\n <libs_ui-components-buttons-button\n [type]=\"configButtonSelectItem.buttonUncheckAll?.type ?? 'button-link-primary'\"\n [label]=\"configButtonSelectItem.buttonUncheckAll?.label ?? 'i18n_unselect_all_searched_results'\"\n [classInclude]=\"configButtonSelectItem.buttonUncheckAll?.classInclude || 'pl-[8px]'\"\n [classLabel]=\"configButtonSelectItem.buttonUncheckAll?.classLabel || 'libs-ui-font-h6ri'\"\n [disable]=\"loading() || disable() || false\"\n (outClick)=\"handlerSelect(false)\" />\n </div>\n }\n @if (items().length && configTemplateCheckbox.configCheckboxCheckAll?.(); as configCheckBox) {\n @let constHtmlLengthMultiKeySelected = multiKeySelected().length || 0;\n @let constHtmlLengthStore = store().length || -1;\n <div [class]=\"'flex libs-ui-border-bottom-general bg-[#ffffff] pl-[12px] ' + (configTemplateCheckbox.classIncludeHasConfigCheckBoxAll ?? 'py-[6px] libs-ui-border-bottom-general')\">\n <libs_ui-components-checkbox-single\n [label]=\"configCheckBox.label ?? 'i18n_all'\"\n [classLabelInclude]=\"configCheckBox.classLabelInclude || ''\"\n [checked]=\"(constHtmlLengthMultiKeySelected && constHtmlLengthMultiKeySelected >= constHtmlLengthStore) || false\"\n [stillOtherOptions]=\"!!constHtmlLengthMultiKeySelected && constHtmlLengthMultiKeySelected < constHtmlLengthStore\"\n [disable]=\"loading() || disable() || false\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChange)=\"handlerSelect($event.checked, true)\" />\n </div>\n }\n <div [class]=\"'relative h-full w-full ' + (!items() || !items().length ? 'bg-[#ffffff]' : configTemplateCheckbox.classListInclude || '')\">\n @if (items() && items().length) {\n <div\n #elementScroll\n LibsUiComponentsScrollOverlayDirective\n class=\"w-full\"\n [class.h-full]=\"!(heightViewPort() && !config()?.ignoreShowDataWhenNotSearch)\"\n [style.height]=\"heightViewPort() && !config()?.ignoreShowDataWhenNotSearch ? heightViewPort() + 'px' : '100%'\"\n (outScrollBottom)=\"handlerScrollBottom()\">\n <virtual-scroller\n #scroll\n [parentScroll]=\"elementScroll\"\n [items]=\"items()\"\n class=\"h-full\">\n @for (item of scroll.viewPortItems; track item()[fieldKey()]; let last = $last) {\n <div [class]=\"last ? configTemplateCheckbox.classIncludeLastViewItem || '' : ''\">\n <div\n #itemRef\n LibsUiComponentsListHighlightKeySearchDirective\n [isHighlight]=\"config()?.highlightTextSearchInResult\"\n [keySearch]=\"keySearch()\"\n [attr.clickExactly]=\"clickExactly()\"\n [class]=\"'libs-ui-list-template-checkbox-item libs-ui-font-h5r flex ' + (configTemplateCheckbox.classItemInclude || '')\"\n [class.w-full]=\"!configTemplateCheckbox.ignoreItemWidth100\"\n [class.libs-ui-bg-list-hover]=\"!clickExactly()\"\n [class.libs-ui-bg-list-hover-active]=\"!clickExactly()\"\n [class.!pl-[12px]]=\"paddingLeftItem()\"\n [class.!py-[6px]]=\"clickExactly()\"\n [class.!pr-[4px]]=\"hasScroll() && configTemplateCheckbox.rows\"\n [class.!pr-[12px]]=\"!hasScroll() && configTemplateCheckbox.rows\"\n (click)=\"handlerChange($event, item())\">\n <div\n class=\"flex flex-col w-full\"\n [class.!flex-row]=\"configTemplateCheckbox.rowSameLineCheckbox\">\n @if (item().fieldLabel) {\n <libs_ui-components-checkbox-single\n [label]=\"item().fieldLabel\"\n [avatarConfig]=\"(item().avatarConfig | LibsUiPipesConvertObjectToSignalPipe)?.()\"\n [linkImage]=\"configTemplateCheckbox.getImage ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: configTemplateCheckbox.getImage : item() | async) : item()[configTemplateCheckbox.fieldGetImage || '']\"\n [linkImageError]=\"\n configTemplateCheckbox.getImageError ? ('avatar_error' | LibsUiPipesCallFunctionInTemplatePipe: configTemplateCheckbox.getImageError : item() | async) : item()[configTemplateCheckbox.fieldGetLinkImageError || '']\n \"\n [classLabelInclude]=\"item().classLabelInclude || configTemplateCheckbox.classLabelInclude || 'libs-ui-font-h5r'\"\n [zIndexLabel]=\"configTemplateCheckbox.zIndexPopover ?? 1200\"\n [checked]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: multiKeySelected() : multiKeySelected().length\"\n [key]=\"item()[fieldKey()]\"\n [imgTypeIcon]=\"configTemplateCheckbox.hasAvatarGroupSocial\"\n [classInclude]=\"configTemplateCheckbox.classInclude || ''\"\n [classImageInclude]=\"configTemplateCheckbox.classIncludeImage || ''\"\n [bullet]=\"(item().bullet | LibsUiPipesConvertObjectToSignalPipe)?.()\"\n [disable]=\"loading() || disable() || (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\"\n [popover]=\"(item().popoverLabel | LibsUiPipesConvertObjectToSignalPipe)?.() | LibsUiPipesConvertSignalToObjectPipe\"\n [clickExactly]=\"clickExactly()\"\n [dataComponentOutlet]=\"undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateCheckbox.getDataComponentOutlet : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\"\n [componentOutlet]=\"0 | LibsUiPipesCallFunctionInTemplatePipe: configTemplateCheckbox.getComponentOutlet : item() : fieldKey() : { valueIs0: 0 } | async\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChange)=\"handlerChange('checkbox', item())\" />\n }\n @if (configTemplateCheckbox?.rows) {\n <libs_ui-components-list-templates_rows\n class=\"{{ !configTemplateCheckbox.ignoreItemWidth100 ? 'w-full' : '' }} {{ (configTemplateCheckbox.classRowsWrapper || configTemplateCheckbox.classRows) ?? '' }}\"\n [item]=\"item()\"\n [zIndex]=\"zIndex()\"\n [fieldKey]=\"fieldKey()\"\n [keySelected]=\"(item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: multiKeySelected() : multiKeySelected().length) ? item()[fieldKey()] : undefined\"\n [configTemplate]=\"configTemplateCheckbox\"\n (outEvent)=\"handlerChange('checkbox', $event.item)\" />\n }\n </div>\n </div>\n </div>\n }\n </virtual-scroller>\n </div>\n }\n @if ((!items() || !items().length) && (!config()?.ignoreShowDataWhenNotSearch || keySearch())) {\n <div [class]=\"'libs-ui-font-h5r text-[#9ca2ad] ' + (config()?.textNoDataClassInclude ?? 'py-[4px] px-[12px]')\">\n @if (config()?.hasIconNoData && !loading()) {\n <div class=\"mb-[16px]\">\n <div *ngComponentOutlet=\"(keySearch() ? 'no-result' : 'no-data') | LibsUiIconsGetIconComponentPipe | async\"></div>\n </div>\n }\n @if (!keySearch() && !loading()) {\n @let constHtmlTextNoData = config()?.textNoData || 'i18n_have_no_selection';\n <span>{{ constHtmlTextNoData | translate }}</span>\n }\n @if (templateRefSearchNoData() && keySearch() && !loading()) {\n <ng-container *ngTemplateOutlet=\"templateRefSearchNoData() || null; context: { keySearch: keySearch() }\" />\n }\n @if (!templateRefSearchNoData() && keySearch() && !loading()) {\n @let constHtmlTextSearchNoData = config()?.textSearchNoData || 'i18n_no_result';\n <span>{{ constHtmlTextSearchNoData | translate }}</span>\n }\n @if (loading()) {\n <span> </span>\n }\n </div>\n }\n @if (loading()) {\n <libs_ui-components-spinner [size]=\"'medium'\" />\n }\n </div>\n </div>\n}\n", styles: [".libs-ui-list-template-checkbox-item{padding:6px 16px;position:relative}\n"] }]
|
|
812
|
+
}] });
|
|
813
|
+
|
|
814
|
+
class LibsUiComponentsListGroupCalculatorLeftLineVerticalItemPipe {
|
|
815
|
+
transform(level, maxLevel, isTreeView, isTreeViewJson, hasIcon) {
|
|
816
|
+
if (isTreeViewJson) {
|
|
817
|
+
if (level < 2) {
|
|
818
|
+
return 16;
|
|
819
|
+
}
|
|
820
|
+
return (level - 2) * 24 + 16;
|
|
821
|
+
}
|
|
822
|
+
if (isTreeView) {
|
|
823
|
+
let leftLine = level * 16;
|
|
824
|
+
if (hasIcon) {
|
|
825
|
+
leftLine += (level - 1) * 8;
|
|
826
|
+
}
|
|
827
|
+
return leftLine;
|
|
828
|
+
}
|
|
829
|
+
if (level > 1 && maxLevel > 2) {
|
|
830
|
+
level -= 1;
|
|
831
|
+
let leftLine = level * 12;
|
|
832
|
+
if (hasIcon) {
|
|
833
|
+
leftLine += level * 8;
|
|
834
|
+
}
|
|
835
|
+
return leftLine;
|
|
836
|
+
}
|
|
837
|
+
return 0;
|
|
838
|
+
}
|
|
839
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupCalculatorLeftLineVerticalItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
840
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupCalculatorLeftLineVerticalItemPipe, isStandalone: true, name: "LibsUiComponentsListGroupCalculatorLeftLineVerticalItemPipe" });
|
|
841
|
+
}
|
|
842
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupCalculatorLeftLineVerticalItemPipe, decorators: [{
|
|
843
|
+
type: Pipe,
|
|
844
|
+
args: [{
|
|
845
|
+
name: 'LibsUiComponentsListGroupCalculatorLeftLineVerticalItemPipe',
|
|
846
|
+
standalone: true,
|
|
847
|
+
}]
|
|
848
|
+
}] });
|
|
849
|
+
|
|
850
|
+
class LibsUiComponentsListGroupCalculatorMarginLeftItemPipe {
|
|
851
|
+
transform(level, maxLevel, isTreeView, isViewTreeJson, hasIcon, isViewLabelEmpty) {
|
|
852
|
+
if (!level) {
|
|
853
|
+
return 16;
|
|
854
|
+
}
|
|
855
|
+
if (isViewTreeJson) {
|
|
856
|
+
if (level === 1) {
|
|
857
|
+
return 0;
|
|
858
|
+
}
|
|
859
|
+
return (level - 2) * 24;
|
|
860
|
+
}
|
|
861
|
+
if (!isTreeView) {
|
|
862
|
+
if (maxLevel > 2 && level > 2) {
|
|
863
|
+
let marginLeft = (level - 1) * 12;
|
|
864
|
+
if (hasIcon) {
|
|
865
|
+
marginLeft += (level - 1) * 6;
|
|
866
|
+
}
|
|
867
|
+
return marginLeft;
|
|
868
|
+
}
|
|
869
|
+
return 0;
|
|
870
|
+
}
|
|
871
|
+
let marginLeft = 24 * level + (isViewLabelEmpty ? 8 : -16);
|
|
872
|
+
if (maxLevel === level && !isViewLabelEmpty) {
|
|
873
|
+
marginLeft -= 8;
|
|
874
|
+
}
|
|
875
|
+
return marginLeft;
|
|
876
|
+
}
|
|
877
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupCalculatorMarginLeftItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
878
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupCalculatorMarginLeftItemPipe, isStandalone: true, name: "LibsUiComponentsListGroupCalculatorMarginLeftItemPipe" });
|
|
879
|
+
}
|
|
880
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupCalculatorMarginLeftItemPipe, decorators: [{
|
|
881
|
+
type: Pipe,
|
|
882
|
+
args: [{
|
|
883
|
+
name: 'LibsUiComponentsListGroupCalculatorMarginLeftItemPipe',
|
|
884
|
+
standalone: true,
|
|
885
|
+
}]
|
|
886
|
+
}] });
|
|
887
|
+
|
|
888
|
+
class LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe {
|
|
889
|
+
transform(level, maxLevel, isTreeView, isTreeViewJson, hasChild) {
|
|
890
|
+
if (isTreeViewJson) {
|
|
891
|
+
if (level === 1 || !hasChild) {
|
|
892
|
+
return 16;
|
|
893
|
+
}
|
|
894
|
+
return 8;
|
|
895
|
+
}
|
|
896
|
+
if (isTreeView || level > 2) {
|
|
897
|
+
return 0;
|
|
898
|
+
}
|
|
899
|
+
return (level - 1) * 16;
|
|
900
|
+
}
|
|
901
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
902
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe, isStandalone: true, name: "LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe" });
|
|
903
|
+
}
|
|
904
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe, decorators: [{
|
|
905
|
+
type: Pipe,
|
|
906
|
+
args: [{
|
|
907
|
+
name: 'LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe',
|
|
908
|
+
standalone: true,
|
|
909
|
+
}]
|
|
910
|
+
}] });
|
|
911
|
+
|
|
912
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
913
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
914
|
+
class LibsUiComponentsListGroupItemComponent {
|
|
915
|
+
// #region INPUT
|
|
916
|
+
items = input([]);
|
|
917
|
+
configTemplateGroup = input();
|
|
918
|
+
keySearch = input();
|
|
919
|
+
fieldKey = input('id');
|
|
920
|
+
keysChecked = input([]);
|
|
921
|
+
keysDisableItem = input();
|
|
922
|
+
parentItem = input();
|
|
923
|
+
disable = input(undefined);
|
|
924
|
+
disableLabel = input(undefined);
|
|
925
|
+
config = input();
|
|
926
|
+
keysStillOtherOptions = input([]);
|
|
927
|
+
// #region OUTPUT
|
|
928
|
+
outChangeView = output();
|
|
929
|
+
outChange = output();
|
|
930
|
+
outChangStageFlagMousePopover = output();
|
|
931
|
+
/* FUNCTIONS */
|
|
932
|
+
handlerToggleExpand(e, item) {
|
|
933
|
+
e.stopPropagation();
|
|
934
|
+
item.update((current) => {
|
|
935
|
+
current.expand = !current.expand;
|
|
936
|
+
return current;
|
|
937
|
+
});
|
|
938
|
+
this.outChangeView.emit(item().expand);
|
|
939
|
+
}
|
|
940
|
+
handlerChangeView(expand) {
|
|
941
|
+
this.outChangeView.emit(expand);
|
|
942
|
+
}
|
|
943
|
+
handlerChangeChecked(item, field_key, disable) {
|
|
944
|
+
if (disable || (field_key && this.keysDisableItem() && this.keysDisableItem()?.length && this.keysDisableItem()?.some((key) => key === field_key))) {
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
if (item.level !== item.maxLevelGroup && this.configTemplateGroup()?.ignoreCheckboxItem) {
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
this.outChange.emit({ item });
|
|
951
|
+
}
|
|
952
|
+
handlerEventPopover(event, item) {
|
|
953
|
+
if (!item || !item.dataPopover || !this.configTemplateGroup() || !this.configTemplateGroup()?.actionPopoverByItem) {
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
this.configTemplateGroup()?.actionPopoverByItem?.(item, event);
|
|
957
|
+
}
|
|
958
|
+
handlerChangStageFlagMouse(flag) {
|
|
959
|
+
this.outChangStageFlagMousePopover.emit(flag);
|
|
960
|
+
}
|
|
961
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
962
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LibsUiComponentsListGroupItemComponent, isStandalone: true, selector: "libs_ui-components-list-templates_group-item", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, configTemplateGroup: { classPropertyName: "configTemplateGroup", publicName: "configTemplateGroup", isSignal: true, isRequired: false, transformFunction: null }, keySearch: { classPropertyName: "keySearch", publicName: "keySearch", isSignal: true, isRequired: false, transformFunction: null }, fieldKey: { classPropertyName: "fieldKey", publicName: "fieldKey", isSignal: true, isRequired: false, transformFunction: null }, keysChecked: { classPropertyName: "keysChecked", publicName: "keysChecked", isSignal: true, isRequired: false, transformFunction: null }, keysDisableItem: { classPropertyName: "keysDisableItem", publicName: "keysDisableItem", isSignal: true, isRequired: false, transformFunction: null }, parentItem: { classPropertyName: "parentItem", publicName: "parentItem", 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 }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, keysStillOtherOptions: { classPropertyName: "keysStillOtherOptions", publicName: "keysStillOtherOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { outChangeView: "outChangeView", outChange: "outChange", outChangStageFlagMousePopover: "outChangStageFlagMousePopover" }, ngImport: i0, template: "@if (configTemplateGroup(); as configTemplateGroup) {\n @if ((configTemplateGroup.isViewTree && !!items().length) || (parentItem().maxLevelGroup > 2 && parentItem().level > 1)) {\n <div\n class=\"libs-ui-list-group-item-line-vertical\"\n [style.left.px]=\"\n parentItem().level\n | LibsUiComponentsListGroupCalculatorLeftLineVerticalItemPipe\n : parentItem().maxLevelGroup\n : configTemplateGroup.isViewTree\n : configTemplateGroup.isViewTreeJson\n : !(configTemplateGroup.ignoreCheckboxItem || configTemplateGroup.ignoreRadioItem || configTemplateGroup.singleSelectItem)\n \"></div>\n }\n @if (items() && items().length) {\n @for (item of items(); track item()[fieldKey()]) {\n <div>\n <div\n [style.marginLeft.px]=\"\n item().level\n | LibsUiComponentsListGroupCalculatorMarginLeftItemPipe\n : item().maxLevelGroup\n : configTemplateGroup.isViewTree\n : configTemplateGroup.isViewTreeJson\n : !(configTemplateGroup.ignoreCheckboxItem || configTemplateGroup.ignoreRadioItem || configTemplateGroup.singleSelectItem)\n \"\n [style.paddingLeft.px]=\"\n item().level | LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe: item().maxLevelGroup : configTemplateGroup.isViewTree : configTemplateGroup.isViewTreeJson : !!item()[configTemplateGroup.fieldGetItems]?.()?.length\n \"\n [style.paddingRight.px]=\"\n item().level | LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe: item().maxLevelGroup : configTemplateGroup.isViewTree : configTemplateGroup.isViewTreeJson : !!item()[configTemplateGroup.fieldGetItems]?.()?.length\n \"\n [class]=\"'libs-ui-bg-list-hover py-[6px] pr-[16px] flex items-center relative libs-ui-bg-list-hover-active ' + item()?.classInclude\"\n [class.libs-ui-bg-list-active]=\"configTemplateGroup.singleSelectItem && item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length\"\n [class.libs-ui-disable]=\"configTemplateGroup.allowDisableLabel && (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\"\n [class.pointer-events-none]=\"configTemplateGroup.allowDisableLabel && (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\"\n [class.cursor-pointer]=\"!disable() && !(configTemplateGroup.singleSelectItem && item().level < item().maxLevelGroup) && !(item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\"\n [class.libs-ui-bg-list-active]=\"(item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length) && configTemplateGroup.hasBackgroundColorWhenItemSelected && item().isCheckManual\"\n (click)=\"handlerChangeChecked(item(), item()[fieldKey()], disable() || (configTemplateGroup.singleSelectItem && item().level < item().maxLevelGroup))\">\n @if (item().level < item().maxLevelGroup && configTemplateGroup.isViewTree) {\n <i\n class=\"libs-ui-icon-chevron-right before:!text-[16px]\"\n [class.rotate-90]=\"item().expand\"\n (click)=\"handlerToggleExpand($event, item)\"></i>\n }\n @if (item().level < item().maxLevelGroup && configTemplateGroup.isViewTreeJson && !!item()[configTemplateGroup.fieldGetItems]()?.length) {\n <div [class]=\"'p-[5px]'\">\n <div\n [class]=\"'libs-ui-list-group-json_icon-item-parent'\"\n [attr.disabled]=\"disable() || (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length) || false\"></div>\n </div>\n }\n <div class=\"flex w-full relative\">\n <div\n #labelRef\n class=\"invisible\"\n [class.hidden]=\"configTemplateGroup.ignoreFixHeightItem\">\n .\n </div>\n <div\n class=\"flex items-center w-full\"\n [class.absolute]=\"!configTemplateGroup.ignoreFixHeightItem\"\n [style.height.px]=\"!configTemplateGroup.ignoreFixHeightItem ? labelRef.clientHeight : 'auto'\">\n @let constHtmlClassIncludeItem = (configTemplateGroup.classIncludeItem || '') + ' w-full';\n @if (!configTemplateGroup.isViewRadio) {\n <libs_ui-components-checkbox-single\n [avatarConfig]=\"item().avatarConfig\"\n [class.ml-[8px]]=\"configTemplateGroup.isViewTree || (configTemplateGroup.isViewTreeJson && !!item()[configTemplateGroup.fieldGetItems]?.()?.length)\"\n [ignoreCheckbox]=\"configTemplateGroup.ignoreCheckboxItem || configTemplateGroup.singleSelectItem\"\n [class]=\"constHtmlClassIncludeItem\"\n [class.-w-auto]=\"configTemplateGroup.isViewTree && !configTemplateGroup.hasIconCheckSingleSelectItem\"\n [class.max-w-[calc(100%-12px)]]=\"((configTemplateGroup.isViewTree && !configTemplateGroup.hasIconCheckSingleSelectItem) || configTemplateGroup.widthLabelSub24WhenNotTreeView) && configTemplateGroup.ignoreIconExpandMarginRight\"\n [class.max-w-[calc(100%-24px)]]=\"\n ((configTemplateGroup.isViewTree && !configTemplateGroup.hasIconCheckSingleSelectItem) ||\n (configTemplateGroup.widthLabelSub24WhenNotTreeView &&\n (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length) &&\n configTemplateGroup.singleSelectItem &&\n (configTemplateGroup.hasIconCheckSingleSelectItem || item().isCheckedByDefaultKey))) &&\n !configTemplateGroup.ignoreIconExpandMarginRight\n \"\n [clickExactly]=\"false\"\n [zIndexLabel]=\"configTemplateGroup.zIndexLabel ?? 1\"\n [disable]=\"\n disable() ||\n (configTemplateGroup.singleSelectItem && item().level < item().maxLevelGroup && !configTemplateGroup.isViewTreeJson) ||\n (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length) ||\n false\n \"\n [label]=\"item().fieldLabel\"\n [checked]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length\"\n [stillOtherOptions]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysStillOtherOptions() : keysStillOtherOptions().length\"\n [classLabelInclude]=\"\n (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length) && configTemplateGroup.singleSelectItem && configTemplateGroup.colorBlueWhenItemSelected && item().isCheckManual\n ? 'libs-ui-color-default libs-ui-font-h5r'\n : 'libs-ui-font-h5r'\n \"\n [dataComponentOutlet]=\"undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getDataComponentOutletItem : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\"\n [componentOutlet]=\"0 | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getComponentOutletItem : item() : fieldKey() : { valueIs0: 0 } | async\"\n [popover]=\"item().dataPopover\"\n [linkImage]=\"configTemplateGroup.getImage ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getImage : item() | async) : (item()[configTemplateGroup.fieldGetAvatarItem || ''] | async)\"\n [linkImageError]=\"configTemplateGroup.getLinkImageError ? ('avatar_error' | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getLinkImageError : item() | async) : ''\"\n [imgTypeIcon]=\"configTemplateGroup.imgTypeIcon\"\n [iconImageClass]=\"item().iconImageClass ? item().iconImageClass : undefined\"\n [classImageInclude]=\"configTemplateGroup.classImageInclude || ''\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outEventPopover)=\"handlerEventPopover($event, item())\"\n (outChange)=\"handlerChangeChecked(item())\" />\n }\n @if (configTemplateGroup.isViewRadio) {\n <libs_ui-components-radio-single\n [avatarConfig]=\"item().avatarConfig\"\n [class.!ml-[8px]]=\"configTemplateGroup.isViewTree\"\n [ignoreRadio]=\"configTemplateGroup.ignoreRadioItem || configTemplateGroup.singleSelectItem\"\n [class]=\"constHtmlClassIncludeItem\"\n [class.w-auto]=\"configTemplateGroup.isViewTree && !configTemplateGroup.hasIconCheckSingleSelectItem\"\n [class.max-w-[calc(100%-12px)]]=\"((configTemplateGroup.isViewTree && !configTemplateGroup.hasIconCheckSingleSelectItem) || configTemplateGroup.widthLabelSub24WhenNotTreeView) && configTemplateGroup.ignoreIconExpandMarginRight\"\n [class.max-w-[calc(100%-24px)]]=\"((configTemplateGroup.isViewTree && !configTemplateGroup.hasIconCheckSingleSelectItem) || configTemplateGroup.widthLabelSub24WhenNotTreeView) && !configTemplateGroup.ignoreIconExpandMarginRight\"\n [clickExactly]=\"false\"\n [disable]=\"\n disable() ||\n (configTemplateGroup.disableItemNotLastLevel && !!item()[configTemplateGroup.fieldGetItems]?.()?.length) ||\n (configTemplateGroup.singleSelectItem && item().level < item().maxLevelGroup) ||\n (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length) ||\n false\n \"\n [label]=\"item().fieldLabel\"\n [zIndexLabel]=\"configTemplateGroup.zIndexLabel ?? 1\"\n [active]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length\"\n [classLabelInclude]=\"\n (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length) && configTemplateGroup.singleSelectItem && configTemplateGroup.colorBlueWhenItemSelected && item().isCheckManual\n ? 'text-[#009cdb] libs-ui-font-h5r '\n : ' libs-ui-font-h5r '\n \"\n [dataComponentOutlet]=\"undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getDataComponentOutletItem : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\"\n [componentOutlet]=\"0 | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getComponentOutletItem : item() : fieldKey() : { valueIs0: 0 } | async\"\n [popover]=\"item().dataPopover\"\n [linkImage]=\"\n configTemplateGroup.getImage\n ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: (item().specific_loadImgError && configTemplateGroup.getLinkImageError ? configTemplateGroup.getLinkImageError : configTemplateGroup.getImage) : item() | async)\n : item()[configTemplateGroup.fieldGetAvatarItem || '']\n \"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChange)=\"handlerChangeChecked(item())\" />\n }\n </div>\n </div>\n @if ((item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length) && configTemplateGroup.singleSelectItem && (configTemplateGroup.hasIconCheckSingleSelectItem || item().isCheckedByDefaultKey)) {\n <i\n class=\"libs-ui-icon-check before:!text-[16px]\"\n [class.!ml-[8px]]=\"item().dataPopover\"\n [class.libs-ui-icon-check]=\"configTemplateGroup.colorBlueWhenItemSelected && item().isCheckManual\"></i>\n }\n @if (!!item()[configTemplateGroup.fieldGetItems]?.()?.length && !configTemplateGroup.isViewTree && !configTemplateGroup.isViewTreeJson) {\n <i\n class=\"libs-ui-icon-chevron-right before:!text-[16px]\"\n [class.rotate-90]=\"item().expand\"\n [class.!ml-[8px]]=\"item().dataPopover\"\n (click)=\"handlerToggleExpand($event, item)\"></i>\n }\n </div>\n @if (item().expand || configTemplateGroup.isViewTreeJson) {\n @if (item().level < item().maxLevelGroup && !item()[configTemplateGroup.fieldGetItems]?.()?.length && configTemplateGroup.isViewTree) {\n <div\n class=\"libs-ui-font-h5r text-[#9ca2ad] relative\"\n [style.marginLeft.px]=\"\n item().level + 1\n | LibsUiComponentsListGroupCalculatorMarginLeftItemPipe\n : item().maxLevelGroup + 1\n : configTemplateGroup.isViewTree\n : configTemplateGroup.isViewTreeJson\n : !(configTemplateGroup.ignoreCheckboxItem || configTemplateGroup.ignoreRadioItem || configTemplateGroup.singleSelectItem)\n : true\n \"\n [class.!py-[8px]]=\"configTemplateGroup.fieldGetAvatarItem\"\n [class.!py-[4px]]=\"!configTemplateGroup.fieldGetAvatarItem\">\n <div [class]=\"item().classIncludeItemNoData || ''\">\n @if (!keySearch()) {\n <span>{{ 'i18n_no_data_yet' | translate }}</span>\n }\n @if (keySearch()) {\n <span>{{ 'i18n_no_result' | translate }}</span>\n }\n </div>\n </div>\n }\n @if (!!item()[configTemplateGroup.fieldGetItems]?.()?.length) {\n <libs_ui-components-list-templates_group-item\n [keySearch]=\"keySearch()\"\n [items]=\"item()[configTemplateGroup.fieldGetItems]()\"\n [parentItem]=\"item()\"\n [fieldKey]=\"fieldKey()\"\n [keysChecked]=\"keysChecked()\"\n [disable]=\"(disable() || (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)) && !configTemplateGroup.isViewTreeJson\"\n [keysDisableItem]=\"keysDisableItem()\"\n [configTemplateGroup]=\"configTemplateGroup\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChangeView)=\"handlerChangeView($event)\"\n (outChange)=\"handlerChangeChecked($event.item)\" />\n }\n }\n </div>\n }\n }\n\n @if ((!items() || !items().length) && parentItem().level < parentItem().maxLevelGroup) {\n <div\n class=\"libs-ui-font-h5r text-[#9ca2ad] relative\"\n [style.marginLeft.px]=\"\n parentItem().level + 1\n | LibsUiComponentsListGroupCalculatorMarginLeftItemPipe\n : parentItem().maxLevelGroup + 1\n : configTemplateGroup.isViewTree\n : configTemplateGroup.isViewTreeJson\n : !(configTemplateGroup.ignoreCheckboxItem || configTemplateGroup.ignoreRadioItem || configTemplateGroup.singleSelectItem)\n : true\n \"\n [style.paddingLeft.px]=\"parentItem().level + 1 | LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe: parentItem().maxLevelGroup + 1 : configTemplateGroup.isViewTree : configTemplateGroup.isViewTreeJson : false\"\n [class.py-[8px]]=\"configTemplateGroup.fieldGetAvatarItem\"\n [class.py-[4px]]=\"!configTemplateGroup.fieldGetAvatarItem\">\n <div [class]=\"parentItem().classIncludeItemNoData || ''\">\n @if (parentItem().iconEmptyDataInGroup) {\n <div class=\"pb-[16px]\">\n <ng-container *ngComponentOutlet=\"(keySearch() ? 'no-result' : 'no-data') | LibsUiIconsGetIconComponentPipe | async\" />\n </div>\n }\n @if (!keySearch()) {\n @let constHtmlTextNoData = parentItem().textDescriptionGroupWhenNoData || config()?.textNoData || 'i18n_no_result';\n <span>{{ constHtmlTextNoData | translate }}</span>\n }\n @if (keySearch()) {\n <span>{{ 'i18n_no_result' | translate }}</span>\n }\n </div>\n </div>\n }\n}\n", styles: [":host{position:relative}:host .libs-ui-list-group-item-line-vertical{position:absolute;width:1px;height:100%;background-color:#e6e7ea}.libs-ui-icon-check{--color: var(--libs-ui-color-default, #226ff5)}.libs-ui-icon-check:before{font-size:16px;color:var(--libs-ui-color-default, #226ff5)}[class*=libs-ui-icon-chevron]:before{color:#6a7383}.libs-ui-list-group-json_icon-item-parent{min-width:6px;min-height:6px;height:6px;width:6px;border-radius:50%;background-color:#226ff5}.libs-ui-list-group-json_icon-item-parent[disabled=true]{background-color:#6a7383!important}\n"], dependencies: [{ kind: "component", type: LibsUiComponentsListGroupItemComponent, selector: "libs_ui-components-list-templates_group-item", inputs: ["items", "configTemplateGroup", "keySearch", "fieldKey", "keysChecked", "keysDisableItem", "parentItem", "disable", "disableLabel", "config", "keysStillOtherOptions"], outputs: ["outChangeView", "outChange", "outChangStageFlagMousePopover"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "pipe", type: LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe, name: "LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe" }, { kind: "pipe", type: LibsUiComponentsListGroupCalculatorMarginLeftItemPipe, name: "LibsUiComponentsListGroupCalculatorMarginLeftItemPipe" }, { kind: "pipe", type: LibsUiComponentsListGroupCalculatorLeftLineVerticalItemPipe, name: "LibsUiComponentsListGroupCalculatorLeftLineVerticalItemPipe" }, { kind: "pipe", type: LibsUiIconsGetIconComponentPipe, name: "LibsUiIconsGetIconComponentPipe" }, { kind: "pipe", type: LibsUiCheckSelectedByKeyPipe, name: "LibsUiCheckSelectedByKeyPipe" }, { kind: "component", type: LibsUiComponentsCheckboxSingleComponent, selector: "libs_ui-components-checkbox-single", inputs: ["key", "checked", "label", "classLabelInclude", "ignoreShowPopoverLabel", "typeLabelPopover", "popover", "linkImage", "linkImageError", "avatarConfig", "classImageInclude", "imgTypeIcon", "bullet", "classInclude", "clickExactly", "disable", "disableLabel", "ignoreCheckbox", "zIndexLabel", "stillOtherOptions", "error", "showBorderError", "description", "iconImageClass", "classIconInclude", "modeBorder", "dataComponentOutlet", "componentOutlet"], outputs: ["checkedChange", "linkImageChange", "outChange", "outEventPopover", "outClickLabel", "outChangStageFlagMousePopover"] }, { kind: "pipe", type: LibsUiPipesCallFunctionInTemplatePipe, name: "LibsUiPipesCallFunctionInTemplatePipe" }, { kind: "component", type: LibsUiComponentsRadioSingleComponent, selector: "libs_ui-components-radio-single", inputs: ["key", "active", "classInclude", "label", "labelInterpolateParams", "ignorePopoverLabel", "classLabelInclude", "linkImage", "linkImageError", "avatarConfig", "classImageInclude", "imgTypeIcon", "bullet", "popover", "disable", "disableLabel", "clickExactly", "typeRadio", "ignoreRadio", "zIndexLabel", "classIncludeIcon", "dataComponentOutlet", "componentOutlet"], outputs: ["activeChange", "outClickLabel", "outChange", "outChangStageFlagMousePopover"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
963
|
+
}
|
|
964
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupItemComponent, decorators: [{
|
|
965
|
+
type: Component,
|
|
966
|
+
args: [{ selector: 'libs_ui-components-list-templates_group-item', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
967
|
+
NgComponentOutlet,
|
|
968
|
+
AsyncPipe,
|
|
969
|
+
TranslateModule,
|
|
970
|
+
LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe,
|
|
971
|
+
LibsUiComponentsListGroupCalculatorMarginLeftItemPipe,
|
|
972
|
+
LibsUiComponentsListGroupCalculatorLeftLineVerticalItemPipe,
|
|
973
|
+
LibsUiIconsGetIconComponentPipe,
|
|
974
|
+
LibsUiCheckSelectedByKeyPipe,
|
|
975
|
+
LibsUiComponentsCheckboxSingleComponent,
|
|
976
|
+
LibsUiPipesCallFunctionInTemplatePipe,
|
|
977
|
+
LibsUiComponentsRadioSingleComponent,
|
|
978
|
+
], template: "@if (configTemplateGroup(); as configTemplateGroup) {\n @if ((configTemplateGroup.isViewTree && !!items().length) || (parentItem().maxLevelGroup > 2 && parentItem().level > 1)) {\n <div\n class=\"libs-ui-list-group-item-line-vertical\"\n [style.left.px]=\"\n parentItem().level\n | LibsUiComponentsListGroupCalculatorLeftLineVerticalItemPipe\n : parentItem().maxLevelGroup\n : configTemplateGroup.isViewTree\n : configTemplateGroup.isViewTreeJson\n : !(configTemplateGroup.ignoreCheckboxItem || configTemplateGroup.ignoreRadioItem || configTemplateGroup.singleSelectItem)\n \"></div>\n }\n @if (items() && items().length) {\n @for (item of items(); track item()[fieldKey()]) {\n <div>\n <div\n [style.marginLeft.px]=\"\n item().level\n | LibsUiComponentsListGroupCalculatorMarginLeftItemPipe\n : item().maxLevelGroup\n : configTemplateGroup.isViewTree\n : configTemplateGroup.isViewTreeJson\n : !(configTemplateGroup.ignoreCheckboxItem || configTemplateGroup.ignoreRadioItem || configTemplateGroup.singleSelectItem)\n \"\n [style.paddingLeft.px]=\"\n item().level | LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe: item().maxLevelGroup : configTemplateGroup.isViewTree : configTemplateGroup.isViewTreeJson : !!item()[configTemplateGroup.fieldGetItems]?.()?.length\n \"\n [style.paddingRight.px]=\"\n item().level | LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe: item().maxLevelGroup : configTemplateGroup.isViewTree : configTemplateGroup.isViewTreeJson : !!item()[configTemplateGroup.fieldGetItems]?.()?.length\n \"\n [class]=\"'libs-ui-bg-list-hover py-[6px] pr-[16px] flex items-center relative libs-ui-bg-list-hover-active ' + item()?.classInclude\"\n [class.libs-ui-bg-list-active]=\"configTemplateGroup.singleSelectItem && item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length\"\n [class.libs-ui-disable]=\"configTemplateGroup.allowDisableLabel && (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\"\n [class.pointer-events-none]=\"configTemplateGroup.allowDisableLabel && (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\"\n [class.cursor-pointer]=\"!disable() && !(configTemplateGroup.singleSelectItem && item().level < item().maxLevelGroup) && !(item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\"\n [class.libs-ui-bg-list-active]=\"(item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length) && configTemplateGroup.hasBackgroundColorWhenItemSelected && item().isCheckManual\"\n (click)=\"handlerChangeChecked(item(), item()[fieldKey()], disable() || (configTemplateGroup.singleSelectItem && item().level < item().maxLevelGroup))\">\n @if (item().level < item().maxLevelGroup && configTemplateGroup.isViewTree) {\n <i\n class=\"libs-ui-icon-chevron-right before:!text-[16px]\"\n [class.rotate-90]=\"item().expand\"\n (click)=\"handlerToggleExpand($event, item)\"></i>\n }\n @if (item().level < item().maxLevelGroup && configTemplateGroup.isViewTreeJson && !!item()[configTemplateGroup.fieldGetItems]()?.length) {\n <div [class]=\"'p-[5px]'\">\n <div\n [class]=\"'libs-ui-list-group-json_icon-item-parent'\"\n [attr.disabled]=\"disable() || (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length) || false\"></div>\n </div>\n }\n <div class=\"flex w-full relative\">\n <div\n #labelRef\n class=\"invisible\"\n [class.hidden]=\"configTemplateGroup.ignoreFixHeightItem\">\n .\n </div>\n <div\n class=\"flex items-center w-full\"\n [class.absolute]=\"!configTemplateGroup.ignoreFixHeightItem\"\n [style.height.px]=\"!configTemplateGroup.ignoreFixHeightItem ? labelRef.clientHeight : 'auto'\">\n @let constHtmlClassIncludeItem = (configTemplateGroup.classIncludeItem || '') + ' w-full';\n @if (!configTemplateGroup.isViewRadio) {\n <libs_ui-components-checkbox-single\n [avatarConfig]=\"item().avatarConfig\"\n [class.ml-[8px]]=\"configTemplateGroup.isViewTree || (configTemplateGroup.isViewTreeJson && !!item()[configTemplateGroup.fieldGetItems]?.()?.length)\"\n [ignoreCheckbox]=\"configTemplateGroup.ignoreCheckboxItem || configTemplateGroup.singleSelectItem\"\n [class]=\"constHtmlClassIncludeItem\"\n [class.-w-auto]=\"configTemplateGroup.isViewTree && !configTemplateGroup.hasIconCheckSingleSelectItem\"\n [class.max-w-[calc(100%-12px)]]=\"((configTemplateGroup.isViewTree && !configTemplateGroup.hasIconCheckSingleSelectItem) || configTemplateGroup.widthLabelSub24WhenNotTreeView) && configTemplateGroup.ignoreIconExpandMarginRight\"\n [class.max-w-[calc(100%-24px)]]=\"\n ((configTemplateGroup.isViewTree && !configTemplateGroup.hasIconCheckSingleSelectItem) ||\n (configTemplateGroup.widthLabelSub24WhenNotTreeView &&\n (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length) &&\n configTemplateGroup.singleSelectItem &&\n (configTemplateGroup.hasIconCheckSingleSelectItem || item().isCheckedByDefaultKey))) &&\n !configTemplateGroup.ignoreIconExpandMarginRight\n \"\n [clickExactly]=\"false\"\n [zIndexLabel]=\"configTemplateGroup.zIndexLabel ?? 1\"\n [disable]=\"\n disable() ||\n (configTemplateGroup.singleSelectItem && item().level < item().maxLevelGroup && !configTemplateGroup.isViewTreeJson) ||\n (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length) ||\n false\n \"\n [label]=\"item().fieldLabel\"\n [checked]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length\"\n [stillOtherOptions]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysStillOtherOptions() : keysStillOtherOptions().length\"\n [classLabelInclude]=\"\n (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length) && configTemplateGroup.singleSelectItem && configTemplateGroup.colorBlueWhenItemSelected && item().isCheckManual\n ? 'libs-ui-color-default libs-ui-font-h5r'\n : 'libs-ui-font-h5r'\n \"\n [dataComponentOutlet]=\"undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getDataComponentOutletItem : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\"\n [componentOutlet]=\"0 | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getComponentOutletItem : item() : fieldKey() : { valueIs0: 0 } | async\"\n [popover]=\"item().dataPopover\"\n [linkImage]=\"configTemplateGroup.getImage ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getImage : item() | async) : (item()[configTemplateGroup.fieldGetAvatarItem || ''] | async)\"\n [linkImageError]=\"configTemplateGroup.getLinkImageError ? ('avatar_error' | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getLinkImageError : item() | async) : ''\"\n [imgTypeIcon]=\"configTemplateGroup.imgTypeIcon\"\n [iconImageClass]=\"item().iconImageClass ? item().iconImageClass : undefined\"\n [classImageInclude]=\"configTemplateGroup.classImageInclude || ''\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outEventPopover)=\"handlerEventPopover($event, item())\"\n (outChange)=\"handlerChangeChecked(item())\" />\n }\n @if (configTemplateGroup.isViewRadio) {\n <libs_ui-components-radio-single\n [avatarConfig]=\"item().avatarConfig\"\n [class.!ml-[8px]]=\"configTemplateGroup.isViewTree\"\n [ignoreRadio]=\"configTemplateGroup.ignoreRadioItem || configTemplateGroup.singleSelectItem\"\n [class]=\"constHtmlClassIncludeItem\"\n [class.w-auto]=\"configTemplateGroup.isViewTree && !configTemplateGroup.hasIconCheckSingleSelectItem\"\n [class.max-w-[calc(100%-12px)]]=\"((configTemplateGroup.isViewTree && !configTemplateGroup.hasIconCheckSingleSelectItem) || configTemplateGroup.widthLabelSub24WhenNotTreeView) && configTemplateGroup.ignoreIconExpandMarginRight\"\n [class.max-w-[calc(100%-24px)]]=\"((configTemplateGroup.isViewTree && !configTemplateGroup.hasIconCheckSingleSelectItem) || configTemplateGroup.widthLabelSub24WhenNotTreeView) && !configTemplateGroup.ignoreIconExpandMarginRight\"\n [clickExactly]=\"false\"\n [disable]=\"\n disable() ||\n (configTemplateGroup.disableItemNotLastLevel && !!item()[configTemplateGroup.fieldGetItems]?.()?.length) ||\n (configTemplateGroup.singleSelectItem && item().level < item().maxLevelGroup) ||\n (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length) ||\n false\n \"\n [label]=\"item().fieldLabel\"\n [zIndexLabel]=\"configTemplateGroup.zIndexLabel ?? 1\"\n [active]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length\"\n [classLabelInclude]=\"\n (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length) && configTemplateGroup.singleSelectItem && configTemplateGroup.colorBlueWhenItemSelected && item().isCheckManual\n ? 'text-[#009cdb] libs-ui-font-h5r '\n : ' libs-ui-font-h5r '\n \"\n [dataComponentOutlet]=\"undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getDataComponentOutletItem : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\"\n [componentOutlet]=\"0 | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getComponentOutletItem : item() : fieldKey() : { valueIs0: 0 } | async\"\n [popover]=\"item().dataPopover\"\n [linkImage]=\"\n configTemplateGroup.getImage\n ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: (item().specific_loadImgError && configTemplateGroup.getLinkImageError ? configTemplateGroup.getLinkImageError : configTemplateGroup.getImage) : item() | async)\n : item()[configTemplateGroup.fieldGetAvatarItem || '']\n \"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChange)=\"handlerChangeChecked(item())\" />\n }\n </div>\n </div>\n @if ((item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length) && configTemplateGroup.singleSelectItem && (configTemplateGroup.hasIconCheckSingleSelectItem || item().isCheckedByDefaultKey)) {\n <i\n class=\"libs-ui-icon-check before:!text-[16px]\"\n [class.!ml-[8px]]=\"item().dataPopover\"\n [class.libs-ui-icon-check]=\"configTemplateGroup.colorBlueWhenItemSelected && item().isCheckManual\"></i>\n }\n @if (!!item()[configTemplateGroup.fieldGetItems]?.()?.length && !configTemplateGroup.isViewTree && !configTemplateGroup.isViewTreeJson) {\n <i\n class=\"libs-ui-icon-chevron-right before:!text-[16px]\"\n [class.rotate-90]=\"item().expand\"\n [class.!ml-[8px]]=\"item().dataPopover\"\n (click)=\"handlerToggleExpand($event, item)\"></i>\n }\n </div>\n @if (item().expand || configTemplateGroup.isViewTreeJson) {\n @if (item().level < item().maxLevelGroup && !item()[configTemplateGroup.fieldGetItems]?.()?.length && configTemplateGroup.isViewTree) {\n <div\n class=\"libs-ui-font-h5r text-[#9ca2ad] relative\"\n [style.marginLeft.px]=\"\n item().level + 1\n | LibsUiComponentsListGroupCalculatorMarginLeftItemPipe\n : item().maxLevelGroup + 1\n : configTemplateGroup.isViewTree\n : configTemplateGroup.isViewTreeJson\n : !(configTemplateGroup.ignoreCheckboxItem || configTemplateGroup.ignoreRadioItem || configTemplateGroup.singleSelectItem)\n : true\n \"\n [class.!py-[8px]]=\"configTemplateGroup.fieldGetAvatarItem\"\n [class.!py-[4px]]=\"!configTemplateGroup.fieldGetAvatarItem\">\n <div [class]=\"item().classIncludeItemNoData || ''\">\n @if (!keySearch()) {\n <span>{{ 'i18n_no_data_yet' | translate }}</span>\n }\n @if (keySearch()) {\n <span>{{ 'i18n_no_result' | translate }}</span>\n }\n </div>\n </div>\n }\n @if (!!item()[configTemplateGroup.fieldGetItems]?.()?.length) {\n <libs_ui-components-list-templates_group-item\n [keySearch]=\"keySearch()\"\n [items]=\"item()[configTemplateGroup.fieldGetItems]()\"\n [parentItem]=\"item()\"\n [fieldKey]=\"fieldKey()\"\n [keysChecked]=\"keysChecked()\"\n [disable]=\"(disable() || (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)) && !configTemplateGroup.isViewTreeJson\"\n [keysDisableItem]=\"keysDisableItem()\"\n [configTemplateGroup]=\"configTemplateGroup\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChangeView)=\"handlerChangeView($event)\"\n (outChange)=\"handlerChangeChecked($event.item)\" />\n }\n }\n </div>\n }\n }\n\n @if ((!items() || !items().length) && parentItem().level < parentItem().maxLevelGroup) {\n <div\n class=\"libs-ui-font-h5r text-[#9ca2ad] relative\"\n [style.marginLeft.px]=\"\n parentItem().level + 1\n | LibsUiComponentsListGroupCalculatorMarginLeftItemPipe\n : parentItem().maxLevelGroup + 1\n : configTemplateGroup.isViewTree\n : configTemplateGroup.isViewTreeJson\n : !(configTemplateGroup.ignoreCheckboxItem || configTemplateGroup.ignoreRadioItem || configTemplateGroup.singleSelectItem)\n : true\n \"\n [style.paddingLeft.px]=\"parentItem().level + 1 | LibsUiComponentsListGroupCalculatorPaddingLeftItemPipe: parentItem().maxLevelGroup + 1 : configTemplateGroup.isViewTree : configTemplateGroup.isViewTreeJson : false\"\n [class.py-[8px]]=\"configTemplateGroup.fieldGetAvatarItem\"\n [class.py-[4px]]=\"!configTemplateGroup.fieldGetAvatarItem\">\n <div [class]=\"parentItem().classIncludeItemNoData || ''\">\n @if (parentItem().iconEmptyDataInGroup) {\n <div class=\"pb-[16px]\">\n <ng-container *ngComponentOutlet=\"(keySearch() ? 'no-result' : 'no-data') | LibsUiIconsGetIconComponentPipe | async\" />\n </div>\n }\n @if (!keySearch()) {\n @let constHtmlTextNoData = parentItem().textDescriptionGroupWhenNoData || config()?.textNoData || 'i18n_no_result';\n <span>{{ constHtmlTextNoData | translate }}</span>\n }\n @if (keySearch()) {\n <span>{{ 'i18n_no_result' | translate }}</span>\n }\n </div>\n </div>\n }\n}\n", styles: [":host{position:relative}:host .libs-ui-list-group-item-line-vertical{position:absolute;width:1px;height:100%;background-color:#e6e7ea}.libs-ui-icon-check{--color: var(--libs-ui-color-default, #226ff5)}.libs-ui-icon-check:before{font-size:16px;color:var(--libs-ui-color-default, #226ff5)}[class*=libs-ui-icon-chevron]:before{color:#6a7383}.libs-ui-list-group-json_icon-item-parent{min-width:6px;min-height:6px;height:6px;width:6px;border-radius:50%;background-color:#226ff5}.libs-ui-list-group-json_icon-item-parent[disabled=true]{background-color:#6a7383!important}\n"] }]
|
|
979
|
+
}] });
|
|
980
|
+
|
|
981
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
982
|
+
class LibsUiComponentsListGroupComponent extends LibsUiComponentsListTemplatesComponentAbstract {
|
|
983
|
+
// #region PROPERTY
|
|
984
|
+
configTemplateGroup = signal(undefined);
|
|
985
|
+
level = signal(1);
|
|
986
|
+
keysChecked = signal([]);
|
|
987
|
+
keysStillOtherOptions = signal([]);
|
|
988
|
+
totalItem = signal(0);
|
|
989
|
+
totalItemChecked = signal(0);
|
|
990
|
+
calculatorHeighItemSuccess = signal(false);
|
|
991
|
+
keyFetch = signal('');
|
|
992
|
+
PATTERN_FAKE_ID = 'fake-id-';
|
|
993
|
+
mappingItemsChecked = signal(new Map());
|
|
994
|
+
selectFirstItem = signal(false);
|
|
995
|
+
firstItemSelected = signal(undefined);
|
|
996
|
+
ngOnInit() {
|
|
997
|
+
if (!this.config()?.configTemplateGroup?.()) {
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
super.ngOnInit();
|
|
1001
|
+
this.configTemplateGroup.set(this.config()?.configTemplateGroup?.());
|
|
1002
|
+
this.timeIntervalIntervalSetHeightViewPort.set(this.configTemplateGroup()?.timeIntervalCalculatorHeight ?? 0);
|
|
1003
|
+
this.fieldKey.set(this.configTemplateGroup()?.fieldKey ?? this.fieldKeyDefault());
|
|
1004
|
+
this.selectFirstItem.set(false);
|
|
1005
|
+
if (this.configTemplateGroup()?.onlySelectFirstItem || (!this.multiKeySelected()?.length && this.config()?.autoSelectFirstItem)) {
|
|
1006
|
+
this.selectFirstItem.set(true);
|
|
1007
|
+
}
|
|
1008
|
+
this.callApiByService();
|
|
1009
|
+
this.onUpdateMultiKeySelectedGroup()
|
|
1010
|
+
?.pipe(takeUntil(this.onDestroy))
|
|
1011
|
+
.subscribe(() => {
|
|
1012
|
+
if (!this.store() || !this.store().length) {
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
this.keysChecked.set([]);
|
|
1016
|
+
this.mappingItemsChecked().clear();
|
|
1017
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1018
|
+
if (!configTemplateGroup) {
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
this.store().forEach((item) => {
|
|
1022
|
+
if (isEmpty(item()[this.fieldKey()])) {
|
|
1023
|
+
item.update((current) => {
|
|
1024
|
+
current[this.fieldKey()] = `${this.PATTERN_FAKE_ID}${uuid()}`;
|
|
1025
|
+
return current;
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
const itemGroup = item()[configTemplateGroup.fieldGetItems];
|
|
1029
|
+
const itemMap = cloneDeep(item);
|
|
1030
|
+
itemMap.update((current) => {
|
|
1031
|
+
current.ref = item;
|
|
1032
|
+
return current;
|
|
1033
|
+
});
|
|
1034
|
+
if (itemGroup) {
|
|
1035
|
+
this.checkedGroupItems(itemGroup(), item);
|
|
1036
|
+
}
|
|
1037
|
+
if (this.multiKeySelected() && this.multiKeySelected()?.length && this.multiKeySelected()?.find((key) => key === item()[this.fieldKey()])) {
|
|
1038
|
+
this.handlerChangeChecked(true, itemMap, false, !configTemplateGroup.singleSelectItem);
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
this.multiKeySelected.set([]);
|
|
1043
|
+
return;
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
handlerCheckedOrUnCheckedAll(checked) {
|
|
1047
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1048
|
+
if (!configTemplateGroup) {
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
if (!checked) {
|
|
1052
|
+
this.items().forEach((item) => {
|
|
1053
|
+
this.mappingItemsChecked().delete(item()[this.fieldKey()]);
|
|
1054
|
+
const itemsOfGroup = item()[configTemplateGroup.fieldGetItems];
|
|
1055
|
+
if (itemsOfGroup && itemsOfGroup() && itemsOfGroup().length) {
|
|
1056
|
+
this.removeCheckedItemsChild(itemsOfGroup());
|
|
1057
|
+
}
|
|
1058
|
+
});
|
|
1059
|
+
this.setKeysCheckedByMappingChecked(false);
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
this.items().forEach((item) => {
|
|
1063
|
+
this.mappingItemsChecked().set(item()[this.fieldKey()], item());
|
|
1064
|
+
const itemsOfGroup = item()[configTemplateGroup.fieldGetItems];
|
|
1065
|
+
if (itemsOfGroup && itemsOfGroup() && itemsOfGroup().length) {
|
|
1066
|
+
this.setCheckCheckedItemsChild(itemsOfGroup());
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
this.setKeysCheckedByMappingChecked(false);
|
|
1070
|
+
}
|
|
1071
|
+
checkedGroupItems(items, parent) {
|
|
1072
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1073
|
+
if (!configTemplateGroup || !items || !items.length) {
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
items.forEach((item) => {
|
|
1077
|
+
if (isNil(item()[this.fieldKey()]) || item()[this.fieldKey()] === '') {
|
|
1078
|
+
item.update((current) => {
|
|
1079
|
+
current[this.fieldKey()] = `${this.PATTERN_FAKE_ID}${uuid()}`;
|
|
1080
|
+
return;
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
const itemGroup = item()[configTemplateGroup.fieldGetItems];
|
|
1084
|
+
const itemMap = cloneDeep(item);
|
|
1085
|
+
itemMap.update((current) => {
|
|
1086
|
+
current.ref = item;
|
|
1087
|
+
current.parentItem = parent;
|
|
1088
|
+
return current;
|
|
1089
|
+
});
|
|
1090
|
+
if (itemGroup) {
|
|
1091
|
+
this.checkedGroupItems(itemGroup(), item);
|
|
1092
|
+
}
|
|
1093
|
+
if (this.multiKeySelected() && this.multiKeySelected()?.length && this.multiKeySelected()?.find((key) => key === item()[this.fieldKey()])) {
|
|
1094
|
+
this.handlerChangeChecked(true, itemMap, false, !configTemplateGroup.singleSelectItem);
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
if (configTemplateGroup.singleSelectItem) {
|
|
1098
|
+
this.handlerChangeChecked(false, itemMap, false, !configTemplateGroup.singleSelectItem);
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
handlerClickButtonGroup(buttonInGroup, item) {
|
|
1103
|
+
buttonInGroup.action?.(item);
|
|
1104
|
+
}
|
|
1105
|
+
handlerToggleExpand(e, item, acceptEvent = true) {
|
|
1106
|
+
if (!acceptEvent || this.configTemplateGroup()?.ignoreClickLabelGroup) {
|
|
1107
|
+
return;
|
|
1108
|
+
}
|
|
1109
|
+
if (e instanceof Event) {
|
|
1110
|
+
e.stopPropagation();
|
|
1111
|
+
}
|
|
1112
|
+
item.update((current) => {
|
|
1113
|
+
current.expand = !current.expand;
|
|
1114
|
+
return current;
|
|
1115
|
+
});
|
|
1116
|
+
this.refreshView();
|
|
1117
|
+
}
|
|
1118
|
+
handlerChangeView() {
|
|
1119
|
+
this.refreshView();
|
|
1120
|
+
}
|
|
1121
|
+
handlerChangeItemChecked(item) {
|
|
1122
|
+
const checked = !this.keysChecked().some((key) => item[this.fieldKey()] === key);
|
|
1123
|
+
if (!checked && this.configTemplateGroup()?.isViewRadio) {
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
this.handlerChangeChecked(checked, signal(item), false);
|
|
1127
|
+
}
|
|
1128
|
+
handlerChangeChecked(checked, item, isClickManual, isCheckedByDefaultKey) {
|
|
1129
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1130
|
+
if (!configTemplateGroup) {
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
if (!configTemplateGroup.isViewTreeJson && item().level !== item().maxLevelGroup && (configTemplateGroup.ignoreCheckboxGroup || configTemplateGroup.singleSelectItem)) {
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
const refItem = (item().ref || item);
|
|
1137
|
+
if (configTemplateGroup.singleSelectItem) {
|
|
1138
|
+
checked = true;
|
|
1139
|
+
const mappingItemsCheckedTemp = cloneDeep(this.mappingItemsChecked);
|
|
1140
|
+
for (const [key, itemCheck] of mappingItemsCheckedTemp()) {
|
|
1141
|
+
const itemByKey = this.mappingItemsChecked().get(key);
|
|
1142
|
+
itemByKey.isCheckManual = false;
|
|
1143
|
+
delete itemByKey.ref.isCheckManual;
|
|
1144
|
+
if (!itemCheck.ref.isCheckedByDefaultKey) {
|
|
1145
|
+
this.mappingItemsChecked().delete(key);
|
|
1146
|
+
this.outUnSelectMultiKey.emit([key]);
|
|
1147
|
+
continue;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
if (!isCheckedByDefaultKey) {
|
|
1151
|
+
item.update((current) => {
|
|
1152
|
+
current.isCheckManual = true;
|
|
1153
|
+
return current;
|
|
1154
|
+
});
|
|
1155
|
+
refItem.update((current) => {
|
|
1156
|
+
current.isCheckManual = true;
|
|
1157
|
+
return current;
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
const itemsOfGroup = item()[configTemplateGroup.fieldGetItems];
|
|
1162
|
+
// bỏ chọn tất cả các item để thực hiện check lại
|
|
1163
|
+
if (configTemplateGroup.isViewTreeJson || (configTemplateGroup.singleSelectItemByTree && !isCheckedByDefaultKey && !configTemplateGroup.notChangeStateItemCheckOther)) {
|
|
1164
|
+
Array.from(this.mappingItemsChecked().values()).forEach((item) => {
|
|
1165
|
+
delete item.isCheckManual;
|
|
1166
|
+
refItem.update((current) => {
|
|
1167
|
+
delete current.isCheckManual;
|
|
1168
|
+
return current;
|
|
1169
|
+
});
|
|
1170
|
+
});
|
|
1171
|
+
this.outUnSelectMultiKey.emit(this.keysChecked());
|
|
1172
|
+
this.mappingItemsChecked().clear();
|
|
1173
|
+
this.setKeysCheckedByMappingChecked(isClickManual, item);
|
|
1174
|
+
}
|
|
1175
|
+
if (checked) {
|
|
1176
|
+
this.expandAllItemsInGroup(item);
|
|
1177
|
+
this.mappingItemsChecked().set(item()[this.fieldKey()], item());
|
|
1178
|
+
if (isCheckedByDefaultKey) {
|
|
1179
|
+
refItem.update((current) => {
|
|
1180
|
+
current.isCheckedByDefaultKey = isCheckedByDefaultKey;
|
|
1181
|
+
return current;
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
item.update((current) => {
|
|
1185
|
+
current.isCheckedByDefaultKey = refItem().isCheckedByDefaultKey;
|
|
1186
|
+
return current;
|
|
1187
|
+
});
|
|
1188
|
+
if (configTemplateGroup.chooseChildThenAutoChooseParent) {
|
|
1189
|
+
// chỉ chọn các cha trên cùng tree, ko quan tâm node cha có các con đã đc tích hết chưa
|
|
1190
|
+
item.update((current) => {
|
|
1191
|
+
current.isCheckManual = true;
|
|
1192
|
+
return current;
|
|
1193
|
+
});
|
|
1194
|
+
refItem.update((current) => {
|
|
1195
|
+
current.isCheckManual = true;
|
|
1196
|
+
return current;
|
|
1197
|
+
});
|
|
1198
|
+
this.recursivelyCheckedParentByTree(item().parentItem);
|
|
1199
|
+
if (!configTemplateGroup.ignoreChooseParentThenAutoChooseChildren && !isCheckedByDefaultKey) {
|
|
1200
|
+
this.setCheckCheckedItemsChild(itemsOfGroup?.() || []);
|
|
1201
|
+
}
|
|
1202
|
+
this.setKeysCheckedByMappingChecked(isClickManual, item);
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
if (configTemplateGroup.ignoreChooseParentThenAutoChooseChildren) {
|
|
1206
|
+
// lựa chọn node cha sẽ bỏ qua việc chọn tất cả node con
|
|
1207
|
+
this.setKeysCheckedByMappingChecked(isClickManual, item);
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
if (itemsOfGroup && itemsOfGroup() && itemsOfGroup().length && !isCheckedByDefaultKey && !configTemplateGroup.isViewTreeJson) {
|
|
1211
|
+
const itemsChange = configTemplateGroup.ignoreChangeChildrenDisableWhenChangeParent ? itemsOfGroup().filter((item) => !this.keysDisableItem()?.find((key) => key === item()[this.fieldKey()])) : itemsOfGroup();
|
|
1212
|
+
this.setCheckCheckedItemsChild(itemsChange);
|
|
1213
|
+
}
|
|
1214
|
+
if (!configTemplateGroup.notChangeStateItemCheckOther && !configTemplateGroup.isViewTreeJson) {
|
|
1215
|
+
this.setCheckCheckedItemsParent(item().parentItem);
|
|
1216
|
+
}
|
|
1217
|
+
this.setKeysCheckedByMappingChecked(isClickManual, item);
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
item.update((current) => {
|
|
1221
|
+
current.isCheckManual = false;
|
|
1222
|
+
if (isCheckedByDefaultKey) {
|
|
1223
|
+
current.isCheckedByDefaultKey = false;
|
|
1224
|
+
}
|
|
1225
|
+
return current;
|
|
1226
|
+
});
|
|
1227
|
+
refItem.update((current) => {
|
|
1228
|
+
current.isCheckManual = false;
|
|
1229
|
+
if (isCheckedByDefaultKey) {
|
|
1230
|
+
current.isCheckedByDefaultKey = false;
|
|
1231
|
+
}
|
|
1232
|
+
return current;
|
|
1233
|
+
});
|
|
1234
|
+
this.mappingItemsChecked().delete(item()[this.fieldKey()]);
|
|
1235
|
+
this.keysChecked.set(Array.from(this.mappingItemsChecked().keys()));
|
|
1236
|
+
if (configTemplateGroup.notChangeStateItemCheckOther) {
|
|
1237
|
+
this.mappingItemsChecked().delete(item()[this.fieldKey()]);
|
|
1238
|
+
this.outUnSelectMultiKey.emit(!isEmpty(item()[this.fieldKey()]) ? [item()[this.fieldKey()]] : []);
|
|
1239
|
+
this.setKeysCheckedByMappingChecked(isClickManual, item);
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
if (configTemplateGroup.ignoreUnselectChildrenRemoveSelectParent) {
|
|
1243
|
+
this.recursivelyCheckedParentByTree(item().parentItem);
|
|
1244
|
+
}
|
|
1245
|
+
// nếu ko phải trường hơp của bank và danh mục sản phẩm thì bỏ cha sẽ bỏ con
|
|
1246
|
+
if (itemsOfGroup && itemsOfGroup() && itemsOfGroup().length) {
|
|
1247
|
+
const itemsChange = configTemplateGroup.ignoreChangeChildrenDisableWhenChangeParent ? itemsOfGroup().filter((item) => !this.keysDisableItem()?.find((key) => key === item()[this.fieldKey()])) : itemsOfGroup();
|
|
1248
|
+
this.removeCheckedItemsChild(itemsChange);
|
|
1249
|
+
}
|
|
1250
|
+
if (item().parentItem && !configTemplateGroup.ignoreUnselectChildrenRemoveSelectParent) {
|
|
1251
|
+
this.mappingItemsChecked().delete(item().parentItem[this.fieldKey()]);
|
|
1252
|
+
}
|
|
1253
|
+
this.setKeysCheckedByMappingChecked(isClickManual, item);
|
|
1254
|
+
}
|
|
1255
|
+
getItemsOfGroup(item, stores) {
|
|
1256
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1257
|
+
if (!configTemplateGroup || !stores || !stores.length) {
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
for (const group of stores()) {
|
|
1261
|
+
if (group()[this.fieldKey()] === item()[this.fieldKey()]) {
|
|
1262
|
+
return group()[configTemplateGroup.fieldGetItems];
|
|
1263
|
+
}
|
|
1264
|
+
const result = this.getItemsOfGroup(item, group()[configTemplateGroup.fieldGetItems]);
|
|
1265
|
+
return result;
|
|
1266
|
+
}
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
setKeysStillOtherOptions(item) {
|
|
1270
|
+
if (!item?.()) {
|
|
1271
|
+
this.keysStillOtherOptions.set([]);
|
|
1272
|
+
return;
|
|
1273
|
+
}
|
|
1274
|
+
const keysChecked = Array.from(this.mappingItemsChecked().keys());
|
|
1275
|
+
const itemParent = item().parentItem;
|
|
1276
|
+
const indexItem = this.keysStillOtherOptions().findIndex((key) => key === item()[this.fieldKey()]);
|
|
1277
|
+
if (indexItem >= 0) {
|
|
1278
|
+
this.keysStillOtherOptions.update((current) => {
|
|
1279
|
+
current.splice(indexItem, 1);
|
|
1280
|
+
return current;
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
if (!itemParent || !itemParent()) {
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1286
|
+
const itemsOfGroupParent = this.getItemsOfGroup(itemParent, this.store);
|
|
1287
|
+
if (!itemsOfGroupParent || !itemsOfGroupParent() || !itemsOfGroupParent().length) {
|
|
1288
|
+
return;
|
|
1289
|
+
}
|
|
1290
|
+
const indexParent = this.keysStillOtherOptions().findIndex((key) => key === itemParent()[this.fieldKey()]);
|
|
1291
|
+
if (itemsOfGroupParent().every((element) => keysChecked.includes(element()[this.fieldKey()])) && indexParent >= 0) {
|
|
1292
|
+
this.keysStillOtherOptions.update((current) => {
|
|
1293
|
+
current.splice(indexItem, 1);
|
|
1294
|
+
return current;
|
|
1295
|
+
});
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
if (itemsOfGroupParent().some((element) => keysChecked.includes(element()[this.fieldKey()])) && indexParent < 0) {
|
|
1299
|
+
this.keysStillOtherOptions.update((current) => [...current, itemParent()[this.fieldKey()]]);
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
if (indexParent >= 0) {
|
|
1303
|
+
this.keysStillOtherOptions.update((current) => {
|
|
1304
|
+
current.splice(indexItem, 1);
|
|
1305
|
+
return current;
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
setKeysCheckedByMappingChecked(isClickManual, item) {
|
|
1310
|
+
this.keysChecked.set(Array.from(this.mappingItemsChecked().keys()));
|
|
1311
|
+
this.emitMultiKeyChecked(isClickManual);
|
|
1312
|
+
this.setKeysStillOtherOptions(item);
|
|
1313
|
+
}
|
|
1314
|
+
emitMultiKeyChecked(isClickManual = true) {
|
|
1315
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1316
|
+
if (!configTemplateGroup) {
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
const dataMultiKeyChecked = { keys: new Array(), mapKeys: new Array(), isClickManual };
|
|
1320
|
+
if ((configTemplateGroup.emitAllItemChecked || configTemplateGroup.chooseChildThenAutoChooseParent) && !configTemplateGroup.ignoreEmitAllItemCheckedWhenChooseChildThenAutoChooseParent) {
|
|
1321
|
+
for (const [key, item] of this.mappingItemsChecked()) {
|
|
1322
|
+
dataMultiKeyChecked.keys.push(key);
|
|
1323
|
+
dataMultiKeyChecked.mapKeys.push({ key, item: item.ref?.() || item, isClickManual });
|
|
1324
|
+
}
|
|
1325
|
+
this.outSelectMultiKey.emit(dataMultiKeyChecked);
|
|
1326
|
+
this.totalItemChecked.set(dataMultiKeyChecked.keys.length);
|
|
1327
|
+
return;
|
|
1328
|
+
}
|
|
1329
|
+
for (const [key, item] of this.mappingItemsChecked()) {
|
|
1330
|
+
if (item[this.fieldKey()] &&
|
|
1331
|
+
!String(item[this.fieldKey()]).includes(this.PATTERN_FAKE_ID) &&
|
|
1332
|
+
(isEmpty(item[configTemplateGroup.fieldGetItems]) || !item[configTemplateGroup.fieldGetItems]().some((itemGroup) => this.mappingItemsChecked().get(itemGroup()[this.fieldKey()])))) {
|
|
1333
|
+
dataMultiKeyChecked.keys.push(key);
|
|
1334
|
+
dataMultiKeyChecked.mapKeys.push({ key, item: item.ref?.() || item, isClickManual });
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
this.outSelectMultiKey.emit(dataMultiKeyChecked);
|
|
1338
|
+
this.totalItemChecked.set(dataMultiKeyChecked.keys.length);
|
|
1339
|
+
}
|
|
1340
|
+
recursivelyCheckedParentByTree(item) {
|
|
1341
|
+
if (!item) {
|
|
1342
|
+
return;
|
|
1343
|
+
}
|
|
1344
|
+
this.mappingItemsChecked().set(item[this.fieldKey()], item());
|
|
1345
|
+
this.recursivelyCheckedParentByTree(item.parentItem);
|
|
1346
|
+
}
|
|
1347
|
+
setCheckCheckedItemsParent(item) {
|
|
1348
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1349
|
+
if (!configTemplateGroup || !item) {
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
const itemsOfGroup = item()[configTemplateGroup.fieldGetItems];
|
|
1353
|
+
if (!itemsOfGroup() || !itemsOfGroup().length) {
|
|
1354
|
+
return;
|
|
1355
|
+
}
|
|
1356
|
+
for (const itemGroup of itemsOfGroup()) {
|
|
1357
|
+
if (!this.mappingItemsChecked().has(itemGroup()[this.fieldKey()])) {
|
|
1358
|
+
return;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
this.mappingItemsChecked().set(item()[this.fieldKey()], item());
|
|
1362
|
+
if (item().parentItem) {
|
|
1363
|
+
this.setCheckCheckedItemsParent(item().parentItem);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
setCheckCheckedItemsChild(items) {
|
|
1367
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1368
|
+
if (!configTemplateGroup || !items || !items.length) {
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
items.forEach((item) => {
|
|
1372
|
+
this.mappingItemsChecked().set(item()[this.fieldKey()], item());
|
|
1373
|
+
const itemsOfGroup = item()[configTemplateGroup.fieldGetItems];
|
|
1374
|
+
if (itemsOfGroup && itemsOfGroup() && itemsOfGroup().length) {
|
|
1375
|
+
this.setCheckCheckedItemsChild(itemsOfGroup());
|
|
1376
|
+
}
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
removeCheckedItemsChild(items) {
|
|
1380
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1381
|
+
if (!configTemplateGroup || !items || !items.length) {
|
|
1382
|
+
return;
|
|
1383
|
+
}
|
|
1384
|
+
items.forEach((item) => {
|
|
1385
|
+
item.update((current) => {
|
|
1386
|
+
current.isCheckManual = false;
|
|
1387
|
+
return current;
|
|
1388
|
+
});
|
|
1389
|
+
this.mappingItemsChecked().delete(item()[this.fieldKey()]);
|
|
1390
|
+
this.outUnSelectMultiKey.emit([item()[this.fieldKey()]]);
|
|
1391
|
+
const itemsOfGroup = item()[configTemplateGroup.fieldGetItems];
|
|
1392
|
+
if (itemsOfGroup && itemsOfGroup() && itemsOfGroup().length) {
|
|
1393
|
+
this.removeCheckedItemsChild(itemsOfGroup());
|
|
1394
|
+
}
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
processSearch() {
|
|
1398
|
+
this.processData();
|
|
1399
|
+
}
|
|
1400
|
+
processData() {
|
|
1401
|
+
this.totalItem.set(0);
|
|
1402
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1403
|
+
if (!configTemplateGroup) {
|
|
1404
|
+
return;
|
|
1405
|
+
}
|
|
1406
|
+
let items = this.store().map((item) => {
|
|
1407
|
+
if (isNil(item()[this.fieldKey()]) || item()[this.fieldKey()] === '') {
|
|
1408
|
+
item.update((current) => {
|
|
1409
|
+
current[this.fieldKey()] = `${this.PATTERN_FAKE_ID}${uuid()}`;
|
|
1410
|
+
return;
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
const itemMap = cloneDeep(item);
|
|
1414
|
+
itemMap.update((current) => {
|
|
1415
|
+
current.ref = item;
|
|
1416
|
+
current.isRoot = true;
|
|
1417
|
+
current.expand = this.keySearch() ? true : false;
|
|
1418
|
+
current.maxLevelGroup = this.configTemplateGroup()?.getMaxLevelGroup(item());
|
|
1419
|
+
current.level = this.level();
|
|
1420
|
+
current.textDescriptionGroupWhenNoData = this.configTemplateGroup()?.getDescriptionGroupWhenNoData?.(item());
|
|
1421
|
+
current.iconEmptyDataInGroup = this.configTemplateGroup()?.getIconEmptyDataInGroup?.(item());
|
|
1422
|
+
return current;
|
|
1423
|
+
});
|
|
1424
|
+
if ((itemMap().level === itemMap().maxLevelGroup || !this.configTemplateGroup()?.ignoreCheckboxGroup) && !String(item()[this.fieldKey()])?.includes(this.PATTERN_FAKE_ID)) {
|
|
1425
|
+
this.totalItem.update((current) => current++);
|
|
1426
|
+
}
|
|
1427
|
+
if (!this.keySearch() && this.configTemplateGroup()?.getExpandGroup) {
|
|
1428
|
+
itemMap.update((current) => {
|
|
1429
|
+
current.expand = this.configTemplateGroup()?.getExpandGroup?.(item);
|
|
1430
|
+
return current;
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
if (this.configTemplateGroup()?.getPopoverGroup) {
|
|
1434
|
+
itemMap.update((current) => {
|
|
1435
|
+
current.dataPopover = this.configTemplateGroup()?.getPopoverGroup?.(item);
|
|
1436
|
+
return current;
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
if (this.configTemplateGroup()?.getButtonGroup) {
|
|
1440
|
+
itemMap.update((current) => {
|
|
1441
|
+
current.buttonInGroup = this.configTemplateGroup()?.getButtonGroup?.(item);
|
|
1442
|
+
return current;
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
const text = deleteUnicode(this.buildValueByConfig(itemMap)).toLocaleLowerCase();
|
|
1446
|
+
const textEscape = escapeHtml(text);
|
|
1447
|
+
const keySearch = deleteUnicode(escapeHtml((this.keySearch() || '').trim().toLocaleLowerCase()));
|
|
1448
|
+
itemMap.update((current) => {
|
|
1449
|
+
current.displayAllChild = false;
|
|
1450
|
+
return current;
|
|
1451
|
+
});
|
|
1452
|
+
if (!keySearch || (this.configTemplateGroup()?.searchAllLevel && (text.includes(keySearch) || textEscape.includes(keySearch)))) {
|
|
1453
|
+
itemMap.update((current) => {
|
|
1454
|
+
current.displayAllChild = true;
|
|
1455
|
+
current.hasDisplay = true;
|
|
1456
|
+
return current;
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
const itemGroup = item()[configTemplateGroup.fieldGetItems];
|
|
1460
|
+
itemMap.update((current) => {
|
|
1461
|
+
const children = current[configTemplateGroup.fieldGetItems];
|
|
1462
|
+
const data = this.filterItemsDisplay(this.convertDataByGroupInItem(itemGroup?.() || [], itemMap));
|
|
1463
|
+
children?.set(data);
|
|
1464
|
+
if (current[configTemplateGroup.fieldGetItems]?.()) {
|
|
1465
|
+
current[configTemplateGroup.fieldGetItems].update((itemFields) => {
|
|
1466
|
+
if (!itemFields.length) {
|
|
1467
|
+
return itemFields;
|
|
1468
|
+
}
|
|
1469
|
+
itemFields[0].isFirst = true;
|
|
1470
|
+
const lastIndex = itemFields?.length - 1;
|
|
1471
|
+
if (lastIndex >= 0) {
|
|
1472
|
+
itemFields[lastIndex].isLast = true;
|
|
1473
|
+
}
|
|
1474
|
+
return itemFields;
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
current.bonusPaddingLeft = 0;
|
|
1478
|
+
if (configTemplateGroup.getBonusPaddingLeftItem) {
|
|
1479
|
+
current.bonusPaddingLeft = configTemplateGroup.getBonusPaddingLeftItem(current);
|
|
1480
|
+
}
|
|
1481
|
+
if (configTemplateGroup.getClassIncludeItemNoData) {
|
|
1482
|
+
current.classIncludeItemNoData = configTemplateGroup.getClassIncludeItemNoData(current);
|
|
1483
|
+
}
|
|
1484
|
+
current.avatarConfig = configTemplateGroup.getAvatarConfig && configTemplateGroup.getAvatarConfig(current);
|
|
1485
|
+
return current;
|
|
1486
|
+
});
|
|
1487
|
+
if (this.multiKeySelected() && this.multiKeySelected()?.length && this.multiKeySelected()?.some((key) => key === itemMap()[this.fieldKey()])) {
|
|
1488
|
+
this.handlerChangeChecked(true, itemMap, false, true);
|
|
1489
|
+
}
|
|
1490
|
+
this.buildValueByConfig(itemMap);
|
|
1491
|
+
return itemMap;
|
|
1492
|
+
});
|
|
1493
|
+
if (this.configTemplateGroup()?.searchAllLevel && this.keySearch()) {
|
|
1494
|
+
items = items.filter((item) => {
|
|
1495
|
+
return item().hasDisplay;
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
this.config()?.sort?.(items);
|
|
1499
|
+
this.items.set(items);
|
|
1500
|
+
this.multiKeySelected.set([]);
|
|
1501
|
+
const callBackCalculatorHeightSuccess = () => {
|
|
1502
|
+
this.calculatorHeighItemSuccess.set(true);
|
|
1503
|
+
if (configTemplateGroup.expandFirstItem && this.items()[0]) {
|
|
1504
|
+
this.expandAllItemsInGroup(this.items()[0]);
|
|
1505
|
+
}
|
|
1506
|
+
this.setHeightViewPort();
|
|
1507
|
+
if (this.firstItemSelected && this.firstItemSelected()) {
|
|
1508
|
+
this.handlerChangeChecked(true, this.firstItemSelected, false);
|
|
1509
|
+
this.firstItemSelected.set(undefined);
|
|
1510
|
+
}
|
|
1511
|
+
};
|
|
1512
|
+
const checkLoadItem = (preStateHasScroll, currentHasScroll) => {
|
|
1513
|
+
if (this.keysHiddenItem()?.length && preStateHasScroll && !currentHasScroll && this.isSearchOnline()) {
|
|
1514
|
+
this.callApiByService(false);
|
|
1515
|
+
}
|
|
1516
|
+
};
|
|
1517
|
+
setTimeout(() => {
|
|
1518
|
+
this.loading.set(false);
|
|
1519
|
+
this.outLoading.emit(this.loading());
|
|
1520
|
+
this.refreshView(callBackCalculatorHeightSuccess, checkLoadItem);
|
|
1521
|
+
this.outLoadItemsComplete.emit({ items: this.items() });
|
|
1522
|
+
});
|
|
1523
|
+
return;
|
|
1524
|
+
}
|
|
1525
|
+
refreshView(callBackCalculatorHeightSuccess, checkLoadItem) {
|
|
1526
|
+
this.setHeightViewPort(callBackCalculatorHeightSuccess);
|
|
1527
|
+
this.checkViewPortScroll(checkLoadItem);
|
|
1528
|
+
}
|
|
1529
|
+
expandAllItemsInGroup(item) {
|
|
1530
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1531
|
+
if (!configTemplateGroup || !item) {
|
|
1532
|
+
return;
|
|
1533
|
+
}
|
|
1534
|
+
set(item, 'expand', true);
|
|
1535
|
+
const items = item[configTemplateGroup.fieldGetItems];
|
|
1536
|
+
if (isEmpty(items)) {
|
|
1537
|
+
return;
|
|
1538
|
+
}
|
|
1539
|
+
items.forEach((itemGroup) => this.expandAllItemsInGroup(itemGroup));
|
|
1540
|
+
}
|
|
1541
|
+
convertDataByGroupInItem(items, parentItem) {
|
|
1542
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1543
|
+
if (!configTemplateGroup || !items || !items.length) {
|
|
1544
|
+
return [];
|
|
1545
|
+
}
|
|
1546
|
+
const itemsMap = items.map((item) => {
|
|
1547
|
+
if (isNil(item()[this.fieldKey()]) || item()[this.fieldKey()] === '') {
|
|
1548
|
+
item()[this.fieldKey()] = `${this.PATTERN_FAKE_ID}${uuid()}`;
|
|
1549
|
+
}
|
|
1550
|
+
const itemMap = cloneDeep(item);
|
|
1551
|
+
itemMap.update((current) => {
|
|
1552
|
+
current.ref = item;
|
|
1553
|
+
current.parentItem = parentItem;
|
|
1554
|
+
current[this.fieldKey()] = item()[this.fieldKey()];
|
|
1555
|
+
current.maxLevelGroup = parentItem().maxLevelGroup;
|
|
1556
|
+
current.level = parentItem().level + 1;
|
|
1557
|
+
current.arrayLevel = range(2, current.level + 1);
|
|
1558
|
+
if ((current.level === current.maxLevelGroup || !configTemplateGroup.ignoreCheckboxItem) && !String(item()[this.fieldKey()])?.includes(this.PATTERN_FAKE_ID)) {
|
|
1559
|
+
this.totalItem.update((current) => current++);
|
|
1560
|
+
}
|
|
1561
|
+
current.expand = this.keySearch() ? true : false;
|
|
1562
|
+
if (!this.keySearch() && configTemplateGroup.getExpandItem) {
|
|
1563
|
+
current.expand = configTemplateGroup.getExpandItem(current);
|
|
1564
|
+
}
|
|
1565
|
+
current.displayAllChild = parentItem().displayAllChild;
|
|
1566
|
+
if (configTemplateGroup.getPopoverItem) {
|
|
1567
|
+
current.dataPopover = configTemplateGroup.getPopoverItem(current);
|
|
1568
|
+
}
|
|
1569
|
+
if (configTemplateGroup.getIconImageClass) {
|
|
1570
|
+
current.iconImageClass = configTemplateGroup.getIconImageClass(current);
|
|
1571
|
+
}
|
|
1572
|
+
const text = deleteUnicode(this.buildValueByConfig(isSignal(current) ? current : signal(current)).toLocaleLowerCase());
|
|
1573
|
+
const keySearch = deleteUnicode(escapeHtml((this.keySearch() || '').trim().toLocaleLowerCase()));
|
|
1574
|
+
const textEscape = escapeHtml(text);
|
|
1575
|
+
if (!this.keysHiddenItem()?.some((key) => key === current[this.fieldKey()]) &&
|
|
1576
|
+
(parentItem().displayAllChild || !keySearch || ((configTemplateGroup.searchAllLevel || !current[this.fieldKey()].includes(this.PATTERN_FAKE_ID)) && (text.includes(keySearch) || textEscape.includes(keySearch))))) {
|
|
1577
|
+
current.displayAllChild = true;
|
|
1578
|
+
this.setDisplayItem(current);
|
|
1579
|
+
}
|
|
1580
|
+
const itemGroup = current[configTemplateGroup.fieldGetItems];
|
|
1581
|
+
if (itemGroup?.()) {
|
|
1582
|
+
const data = this.filterItemsDisplay(this.convertDataByGroupInItem(itemGroup?.(), signal(current)));
|
|
1583
|
+
itemGroup.set(data);
|
|
1584
|
+
}
|
|
1585
|
+
if (current[configTemplateGroup.fieldGetItems]?.()) {
|
|
1586
|
+
current[configTemplateGroup.fieldGetItems].update((itemFields) => {
|
|
1587
|
+
if (!itemFields.length) {
|
|
1588
|
+
return itemFields;
|
|
1589
|
+
}
|
|
1590
|
+
itemFields[0].isFirst = true;
|
|
1591
|
+
const lastIndex = itemFields?.length - 1;
|
|
1592
|
+
if (lastIndex >= 0) {
|
|
1593
|
+
itemFields[lastIndex].isLast = true;
|
|
1594
|
+
}
|
|
1595
|
+
return itemFields;
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
current.bonusPaddingLeft = 0;
|
|
1599
|
+
if (configTemplateGroup.getBonusPaddingLeftItem) {
|
|
1600
|
+
current.bonusPaddingLeft = configTemplateGroup.getBonusPaddingLeftItem(current, parentItem);
|
|
1601
|
+
}
|
|
1602
|
+
if (configTemplateGroup.getClassIncludeItemNoData) {
|
|
1603
|
+
current.classIncludeItemNoData = configTemplateGroup.getClassIncludeItemNoData(current, parentItem);
|
|
1604
|
+
}
|
|
1605
|
+
if (configTemplateGroup.getLinkImageError) {
|
|
1606
|
+
current.linkImageError = configTemplateGroup.getLinkImageError(current);
|
|
1607
|
+
}
|
|
1608
|
+
if (configTemplateGroup.getClassIncludeItemContent) {
|
|
1609
|
+
current.classInclude = configTemplateGroup.getClassIncludeItemContent(item);
|
|
1610
|
+
}
|
|
1611
|
+
current.avatarConfig = configTemplateGroup.getAvatarConfig && configTemplateGroup.getAvatarConfig(current);
|
|
1612
|
+
if (this.multiKeySelected() && this.multiKeySelected()?.length && this.multiKeySelected()?.some((key) => key === current[this.fieldKey()])) {
|
|
1613
|
+
this.handlerChangeChecked(true, signal(current), false, true);
|
|
1614
|
+
}
|
|
1615
|
+
if (this.selectFirstItem() && current.level === current.maxLevelGroup) {
|
|
1616
|
+
this.firstItemSelected.set(current);
|
|
1617
|
+
this.selectFirstItem.set(false);
|
|
1618
|
+
}
|
|
1619
|
+
return current;
|
|
1620
|
+
});
|
|
1621
|
+
return itemMap;
|
|
1622
|
+
});
|
|
1623
|
+
return itemsMap;
|
|
1624
|
+
}
|
|
1625
|
+
setDisplayItem(item) {
|
|
1626
|
+
if (!item) {
|
|
1627
|
+
return;
|
|
1628
|
+
}
|
|
1629
|
+
set(item, 'hasDisplay', true);
|
|
1630
|
+
const parentItem = get(item, 'parentItem');
|
|
1631
|
+
if (get(parentItem, '')) {
|
|
1632
|
+
this.setDisplayItem(parentItem);
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
filterItemsDisplay(items) {
|
|
1636
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1637
|
+
if (!configTemplateGroup || !items || !items.length) {
|
|
1638
|
+
return [];
|
|
1639
|
+
}
|
|
1640
|
+
const itemsDisplay = items.filter((item) => item().hasDisplay);
|
|
1641
|
+
itemsDisplay.forEach((item) => {
|
|
1642
|
+
const itemGroup = item()[configTemplateGroup.fieldGetItems];
|
|
1643
|
+
item()[configTemplateGroup.fieldGetItems]?.set(this.filterItemsDisplay(itemGroup?.() || []));
|
|
1644
|
+
});
|
|
1645
|
+
return itemsDisplay;
|
|
1646
|
+
}
|
|
1647
|
+
getLengthItem() {
|
|
1648
|
+
const data = { length: this.items().length };
|
|
1649
|
+
if (data.length > this.maxItemShow()) {
|
|
1650
|
+
return data.length;
|
|
1651
|
+
}
|
|
1652
|
+
this.getLengthAllGroup(this.items(), data);
|
|
1653
|
+
return data.length;
|
|
1654
|
+
}
|
|
1655
|
+
getLengthAllGroup(items, data) {
|
|
1656
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1657
|
+
if (!configTemplateGroup || !items) {
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
for (const item of items) {
|
|
1661
|
+
if (!item().expand) {
|
|
1662
|
+
continue;
|
|
1663
|
+
}
|
|
1664
|
+
const group = item()[configTemplateGroup.fieldGetItems];
|
|
1665
|
+
if (!group) {
|
|
1666
|
+
continue;
|
|
1667
|
+
}
|
|
1668
|
+
data.length += group?.()?.length || 0;
|
|
1669
|
+
if ((!group?.() || !group?.().length) && item().level === 1 && (!configTemplateGroup.searchAllLevel || configTemplateGroup.autoCountWhenGroupEmptyItemLevel1)) {
|
|
1670
|
+
data.length += 1;
|
|
1671
|
+
}
|
|
1672
|
+
if (data.length > this.maxItemShow()) {
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
this.getLengthAllGroup(group(), data);
|
|
1676
|
+
if (data.length > this.maxItemShow()) {
|
|
1677
|
+
return;
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
getHeightGroupHasLine() {
|
|
1682
|
+
const configTemplateGroup = this.configTemplateGroup();
|
|
1683
|
+
if (!configTemplateGroup || configTemplateGroup?.ignoreGroupLine || !this.items()?.length) {
|
|
1684
|
+
return 0;
|
|
1685
|
+
}
|
|
1686
|
+
let length = 0;
|
|
1687
|
+
let count = 0;
|
|
1688
|
+
for (const item of this.items()) {
|
|
1689
|
+
if (length >= this.maxItemShow()) {
|
|
1690
|
+
break;
|
|
1691
|
+
}
|
|
1692
|
+
count += 1;
|
|
1693
|
+
length += 1;
|
|
1694
|
+
const group = item()[configTemplateGroup.fieldGetItems];
|
|
1695
|
+
const data = { length: item().expand ? group?.()?.length || 0 : 0 };
|
|
1696
|
+
this.getLengthAllGroup(group(), data);
|
|
1697
|
+
length += data.length;
|
|
1698
|
+
}
|
|
1699
|
+
const marginTopHasLine = configTemplateGroup.marginTopHasLine || 4;
|
|
1700
|
+
const height = count === 1 ? marginTopHasLine : (count - 1) * (marginTopHasLine * 3 + 1);
|
|
1701
|
+
return height;
|
|
1702
|
+
}
|
|
1703
|
+
buildValueByConfig(item) {
|
|
1704
|
+
const labelSearch = this.configTemplateGroup()?.getLabelSearch?.(item());
|
|
1705
|
+
if (item().isRoot) {
|
|
1706
|
+
if (this.configTemplateGroup()?.getLabelGroup) {
|
|
1707
|
+
item().fieldLabel = this.translateService.instant(this.configTemplateGroup()?.getLabelGroup(item()) || ' ');
|
|
1708
|
+
return labelSearch ?? item().fieldLabel;
|
|
1709
|
+
}
|
|
1710
|
+
item.update((current) => {
|
|
1711
|
+
current.fieldLabel = this.translateService.instant(current.label || current.name || ' ');
|
|
1712
|
+
return current;
|
|
1713
|
+
});
|
|
1714
|
+
return item().fieldLabel;
|
|
1715
|
+
}
|
|
1716
|
+
if (this.configTemplateGroup()?.getLabelItem) {
|
|
1717
|
+
item.update((current) => {
|
|
1718
|
+
current.fieldLabel = this.translateService.instant(this.configTemplateGroup()?.getLabelItem(current) || ' ');
|
|
1719
|
+
return current;
|
|
1720
|
+
});
|
|
1721
|
+
return labelSearch ?? item().fieldLabel;
|
|
1722
|
+
}
|
|
1723
|
+
item.update((current) => {
|
|
1724
|
+
current.fieldLabel = this.translateService.instant(current.label || current.name || ' ');
|
|
1725
|
+
return current;
|
|
1726
|
+
});
|
|
1727
|
+
return labelSearch ?? item().fieldLabel;
|
|
1728
|
+
}
|
|
1729
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1730
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LibsUiComponentsListGroupComponent, isStandalone: true, selector: "libs_ui-components-list-templates_group", usesInheritance: true, ngImport: i0, template: "@if (configTemplateGroup(); as configTemplateGroup) {\n @let constHtmlHeightViewPort = heightViewPort() ? heightViewPort() + 'px' : '100%';\n @let constHtmlDisable = loading() || disable() || false;\n <div\n class=\"libs-ui-list-group overflow-[hidden]\"\n [style.height]=\"constHtmlHeightViewPort\">\n <div class=\"flex flex-col w-full h-full relative min-h-[28px]\">\n @if (items().length && configTemplateGroup.configButtonSelectAndUndSelectItem?.(); as configButtonSelectItem) {\n <div [class]=\"'flex items-center bg-[#ffffff] ' + (configButtonSelectItem.classInclude ?? 'libs-ui-border-bottom-general')\">\n <libs_ui-components-buttons-button\n [type]=\"configButtonSelectItem.buttonCheckAll?.type ?? 'button-link-primary'\"\n [label]=\"configButtonSelectItem.buttonCheckAll?.label ?? 'i18n_select_all_searched_results'\"\n [classInclude]=\"configButtonSelectItem.buttonCheckAll?.classInclude || 'pr-[8px]'\"\n [classLabel]=\"configButtonSelectItem.buttonCheckAll?.classLabel || 'libs-ui-font-h6r'\"\n [disable]=\"constHtmlDisable\"\n (outClick)=\"handlerCheckedOrUnCheckedAll(true)\" />\n <div class=\"text-[#999999]\">|</div>\n <libs_ui-components-buttons-button\n [type]=\"configButtonSelectItem.buttonUncheckAll?.type ?? 'button-link-primary'\"\n [label]=\"configButtonSelectItem.buttonUncheckAll?.label ?? 'i18n_unselect_all_searched_results'\"\n [classInclude]=\"configButtonSelectItem.buttonUncheckAll?.classInclude || 'pl-[8px]'\"\n [classLabel]=\"configButtonSelectItem.buttonUncheckAll?.classLabel || 'libs-ui-font-h6s'\"\n [disable]=\"constHtmlDisable\"\n (outClick)=\"handlerCheckedOrUnCheckedAll(false)\" />\n </div>\n }\n @if (items().length && configTemplateGroup.configCheckboxCheckAll?.(); as configCheckBox) {\n <div [class]=\"'flex libs-ui-border-bottom-general ' + (configTemplateGroup.classIncludeHasConfigCheckBoxAll ?? ' bg-[#ffffff]')\">\n <libs_ui-components-checkbox-single\n [label]=\"configCheckBox.label ?? 'i18n_all'\"\n [classLabelInclude]=\"configCheckBox.classLabelInclude || ''\"\n [checked]=\"totalItemChecked() >= totalItem() && totalItem() > 0\"\n [disable]=\"constHtmlDisable\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChange)=\"handlerCheckedOrUnCheckedAll($event.checked)\" />\n </div>\n }\n @if (items() && items().length) {\n <div class=\"w-full h-full relative flex\">\n <div\n LibsUiComponentsScrollOverlayDirective\n class=\"w-full h-full absolute top-0 left-0 {{ configTemplateGroup.classIncludeGroup ? configTemplateGroup.classIncludeGroup : '' }}\">\n @for (item of items(); track item()[fieldKey()]; let first = $first; let last = $last) {\n <div\n #itemRef\n [style.marginTop.px]=\"!configTemplateGroup.ignoreGroupLine ? configTemplateGroup.marginTopHasLine || 4 : 0\"\n class=\"flex flex-col relative\">\n @let constHtmlPadding = level() * (configTemplateGroup.isViewTree ? 8 : 16);\n <div\n class=\"flex items-center py-[6px]\"\n [class.libs-ui-bg-list-hover]=\"!configTemplateGroup.ignoreClickLabelGroup\"\n [class.libs-ui-bg-list-hover-active]=\"!configTemplateGroup.ignoreClickLabelGroup\"\n [class.!cursor-pointer]=\"!configTemplateGroup.ignoreClickLabelGroup && (configTemplateGroup.ignoreCheckboxGroup || configTemplateGroup.singleSelectItem)\"\n [style.paddingLeft.px]=\"constHtmlPadding\"\n [style.paddingRight.px]=\"constHtmlPadding\"\n (click)=\"configTemplateGroup.ignoreCheckboxGroup || configTemplateGroup.singleSelectItem ? handlerToggleExpand($event, item) : undefined\">\n @if (configTemplateGroup.iconExpand === 'left' || configTemplateGroup.isViewTree) {\n <i\n class=\"cursor-pointer libs-ui-icon-chevron-right before:!text-[16px]\"\n [class.rotate-90]=\"item().expand\"\n (click)=\"handlerToggleExpand($event, item)\"></i>\n }\n <div\n class=\"flex\"\n [class.w-full]=\"configTemplateGroup.iconExpand === 'right' && !configTemplateGroup.isViewTree && (!configTemplateGroup.searchAllLevel || !!item()[configTemplateGroup.fieldGetItems]?.()?.length)\"\n [class.w-[calc(100%-16px)]]=\"configTemplateGroup.iconExpand === 'left' || configTemplateGroup.isViewTree\">\n @if (!configTemplateGroup.isViewRadio) {\n <libs_ui-components-checkbox-single\n [avatarConfig]=\"item().avatarConfig\"\n [class.ml-[8px]]=\"configTemplateGroup.iconExpand === 'left' || configTemplateGroup.isViewTree\"\n [ignoreCheckbox]=\"configTemplateGroup.ignoreCheckboxGroup || configTemplateGroup.singleSelectItem\"\n [class]=\"configTemplateGroup.classIncludeItem || ''\"\n [class.w-auto]=\"configTemplateGroup.isViewTree\"\n [class.w-full]=\"\n !item()[configTemplateGroup.fieldGetItems]?.()?.length &&\n !(\n (configTemplateGroup.isViewTree || configTemplateGroup.widthLabelSub24WhenNotTreeView) &&\n (configTemplateGroup.iconExpand === 'left' || (configTemplateGroup.iconExpand === 'right' && (!configTemplateGroup.searchAllLevel || !!item()[configTemplateGroup.fieldGetItems]?.()?.length)))\n )\n \"\n [class.max-w-[calc(100%-24px)]]=\"\n (configTemplateGroup.isViewTree || configTemplateGroup.widthLabelSub24WhenNotTreeView) &&\n (configTemplateGroup.iconExpand === 'left' || (configTemplateGroup.iconExpand === 'right' && (!configTemplateGroup.searchAllLevel || !!item()[configTemplateGroup.fieldGetItems]?.()?.length)))\n \"\n [label]=\"item().fieldLabel\"\n [popover]=\"item().dataPopover\"\n [zIndexLabel]=\"configTemplateGroup.zIndexLabel ?? zIndex()\"\n [dataComponentOutlet]=\"undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getDataComponentOutletGroup : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\"\n [componentOutlet]=\"0 | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getComponentOutletGroup : item() : fieldKey() : { valueIs0: 0 } | async\"\n [linkImage]=\"\n configTemplateGroup.getImage\n ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: (item().specific_loadImgError && configTemplateGroup.getLinkImageError ? configTemplateGroup.getLinkImageError : configTemplateGroup.getImage) : item() | async)\n : item()[configTemplateGroup.fieldGetAvatarItem || '']\n \"\n [imgTypeIcon]=\"configTemplateGroup.imgTypeIcon\"\n [classLabelInclude]=\"\n (configTemplateGroup.classLabelItem ? configTemplateGroup.classLabelItem : configTemplateGroup.isViewTree ? ' libs-ui-font-h6r ' : ' libs-ui-font-h6s ') +\n (configTemplateGroup.ignoreTextUppercaseLabelGroup || configTemplateGroup.isViewTree ? '' : ' text-uppercase ')\n \"\n [disable]=\"disable() || (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\"\n [checked]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length\"\n [stillOtherOptions]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysStillOtherOptions() : keysStillOtherOptions().length\"\n (outChange)=\"handlerChangeChecked($event.checked, item, true)\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outClickLabel)=\"handlerToggleExpand('clickLabel', item, configTemplateGroup.ignoreCheckboxGroup || configTemplateGroup.singleSelectItem)\" />\n }\n\n @if (configTemplateGroup.isViewRadio) {\n <libs_ui-components-radio-single\n [class.ml-[8px]]=\"configTemplateGroup.iconExpand === 'left' || configTemplateGroup.isViewTree\"\n [avatarConfig]=\"item().avatarConfig\"\n [ignoreRadio]=\"configTemplateGroup.ignoreRadioGroup || configTemplateGroup.singleSelectItem\"\n [class]=\"configTemplateGroup.classIncludeItem || ''\"\n [class.w-auto]=\"configTemplateGroup.isViewTree\"\n [class.w-full]=\"\n !item()[configTemplateGroup.fieldGetItems]?.()?.length &&\n !(\n (configTemplateGroup.isViewTree || configTemplateGroup.widthLabelSub24WhenNotTreeView) &&\n (configTemplateGroup.iconExpand === 'left' || (configTemplateGroup.iconExpand === 'right' && (!configTemplateGroup.searchAllLevel || !!item()[configTemplateGroup.fieldGetItems]?.()?.length)))\n )\n \"\n [class.max-w-[calc(100%-24px)]]=\"\n (configTemplateGroup.isViewTree || configTemplateGroup.widthLabelSub24WhenNotTreeView) &&\n (configTemplateGroup.iconExpand === 'left' || (configTemplateGroup.iconExpand === 'right' && (!configTemplateGroup.searchAllLevel || !!item()[configTemplateGroup.fieldGetItems]?.()?.length)))\n \"\n [label]=\"item().fieldLabel\"\n [popover]=\"item().dataPopover\"\n [dataComponentOutlet]=\"undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getDataComponentOutletGroup : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\"\n [componentOutlet]=\"0 | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getComponentOutletGroup : item() : fieldKey() : { valueIs0: 0 } | async\"\n [zIndexLabel]=\"configTemplateGroup.zIndexLabel ?? zIndex()\"\n [imgTypeIcon]=\"configTemplateGroup.imgTypeIcon\"\n [linkImage]=\"\n configTemplateGroup.getImage\n ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: (item().specific_loadImgError && configTemplateGroup.getLinkImageError ? configTemplateGroup.getLinkImageError : configTemplateGroup.getImage) : item() | async)\n : item()[configTemplateGroup.fieldGetAvatarItem || '']\n \"\n [classLabelInclude]=\"(configTemplateGroup.classLabelItem ? configTemplateGroup.classLabelItem : 'libs-ui-font-h6s ') + (configTemplateGroup.ignoreTextUppercaseLabelGroup ? '' : ' uppercase')\"\n [disable]=\"\n disable() ||\n (configTemplateGroup.disableItemNotLastLevel && !!item()[configTemplateGroup.fieldGetItems]?.()?.length) ||\n configTemplateGroup.ignoreCheckboxGroup ||\n configTemplateGroup.singleSelectItem ||\n (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\n \"\n [active]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length\"\n (outChange)=\"handlerChangeChecked($event.active, item, true)\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outClickLabel)=\"handlerToggleExpand('clickLabel', item, configTemplateGroup.ignoreRadioGroup || configTemplateGroup.singleSelectItem)\" />\n }\n\n @if (item().buttonInGroup; as buttonInGroup) {\n <libs_ui-components-buttons-button\n [type]=\"buttonInGroup.type || 'button-link-primary'\"\n [label]=\"buttonInGroup.label || ' '\"\n [classIconLeft]=\"(buttonInGroup.classIconLeft || '') + ' flex mr-[8px] !text-[8px]'\"\n [classInclude]=\"buttonInGroup.classInclude\"\n [classLabel]=\"buttonInGroup.classLabel || 'libs-ui-font-h5r'\"\n [disable]=\"buttonInGroup.disable || disable() || false\"\n (outClick)=\"handlerClickButtonGroup(buttonInGroup, item())\" />\n }\n </div>\n\n @if (configTemplateGroup.iconExpand === 'right' && !configTemplateGroup.isViewTree && (!configTemplateGroup.searchAllLevel || !!item()[configTemplateGroup.fieldGetItems]?.()?.length)) {\n <i\n class=\"flex items-center cursor-pointer libs-ui-icon-chevron-right before:!text-[16px]\"\n [class.!ml-[8px]]=\"item().dataPopover\"\n [class.rotate-90]=\"item().expand\"\n (click)=\"handlerToggleExpand($event, item)\"></i>\n }\n </div>\n @if (item().expand && calculatorHeighItemSuccess()) {\n <libs_ui-components-list-templates_group-item\n [keySearch]=\"keySearch()\"\n [items]=\"item()[configTemplateGroup.fieldGetItems]()\"\n [parentItem]=\"item()\"\n [fieldKey]=\"fieldKey()\"\n [keysChecked]=\"keysChecked()\"\n [disable]=\"disable()\"\n [keysDisableItem]=\"keysDisableItem() || []\"\n [configTemplateGroup]=\"configTemplateGroup\"\n [config]=\"config()\"\n [keysStillOtherOptions]=\"keysStillOtherOptions()\"\n (outChangeView)=\"handlerChangeView()\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChange)=\"handlerChangeItemChecked($event.item)\" />\n }\n @if (!last && !configTemplateGroup.ignoreGroupLine && calculatorHeighItemSuccess()) {\n <div\n class=\"libs-ui-list-group-line\"\n [style.marginTop.px]=\"!configTemplateGroup.ignoreGroupLine ? configTemplateGroup.marginTopHasLine || 4 : 0\"></div>\n }\n </div>\n }\n </div>\n </div>\n }\n @if (!items() || !items().length) {\n <div\n class=\"libs-ui-font-h5r text-[#c1c1c1] relative {{ configTemplateGroup.classIncludeNodata ? configTemplateGroup.classIncludeNodata : '' }}\"\n [style.marginLeft.px]=\"\n 0\n | LibsUiComponentsListGroupCalculatorMarginLeftItemPipe\n : 2\n : configTemplateGroup.isViewTree || configTemplateGroup.iconExpand === 'left'\n : configTemplateGroup.isViewTreeJson\n : !(configTemplateGroup.ignoreCheckboxItem || configTemplateGroup.ignoreRadioItem || configTemplateGroup.singleSelectItem)\n : true\n \"\n [class.py-[8px]]=\"configTemplateGroup.fieldGetAvatarItem\"\n [class.py-[4px]]=\"!configTemplateGroup.fieldGetAvatarItem\">\n @if (!keySearch() && !loading()) {\n @let constHtmlTextNoData = config()?.textNoData || 'i18n_no_data_yet';\n <div>{{ constHtmlTextNoData | translate }}</div>\n }\n @if (keySearch() && !loading()) {\n @let constHtmlTextSearchNoData = config()?.textSearchNoData || 'i18n_no_result';\n <div>{{ constHtmlTextSearchNoData | translate }}</div>\n }\n </div>\n }\n @if (loading()) {\n <libs_ui-components-spinner [size]=\"'medium'\" />\n }\n </div>\n </div>\n}\n", styles: [".libs-ui-list-group{display:flex;flex-direction:column;width:100%}.libs-ui-list-group .libs-ui-list-group-line{width:100%;height:1px;background-color:#e6e7ea}.libs-ui-list-group [class*=libs-ui-icon-chevron]:before{color:#6a7383}\n"], dependencies: [{ kind: "ngmodule", type: VirtualScrollerModule }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { 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", "isHandlerEnterDocumentClickButton"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsCheckboxSingleComponent, selector: "libs_ui-components-checkbox-single", inputs: ["key", "checked", "label", "classLabelInclude", "ignoreShowPopoverLabel", "typeLabelPopover", "popover", "linkImage", "linkImageError", "avatarConfig", "classImageInclude", "imgTypeIcon", "bullet", "classInclude", "clickExactly", "disable", "disableLabel", "ignoreCheckbox", "zIndexLabel", "stillOtherOptions", "error", "showBorderError", "description", "iconImageClass", "classIconInclude", "modeBorder", "dataComponentOutlet", "componentOutlet"], outputs: ["checkedChange", "linkImageChange", "outChange", "outEventPopover", "outClickLabel", "outChangStageFlagMousePopover"] }, { kind: "component", type: LibsUiComponentsRadioSingleComponent, selector: "libs_ui-components-radio-single", inputs: ["key", "active", "classInclude", "label", "labelInterpolateParams", "ignorePopoverLabel", "classLabelInclude", "linkImage", "linkImageError", "avatarConfig", "classImageInclude", "imgTypeIcon", "bullet", "popover", "disable", "disableLabel", "clickExactly", "typeRadio", "ignoreRadio", "zIndexLabel", "classIncludeIcon", "dataComponentOutlet", "componentOutlet"], outputs: ["activeChange", "outClickLabel", "outChange", "outChangStageFlagMousePopover"] }, { kind: "component", type: LibsUiComponentsSpinnerComponent, selector: "libs_ui-components-spinner", inputs: ["type", "size"] }, { kind: "directive", type: LibsUiComponentsScrollOverlayDirective, selector: "[LibsUiComponentsScrollOverlayDirective]", inputs: ["debugMode", "ignoreInit", "classContainer", "options", "elementCheckScrollX", "elementCheckScrollY", "elementScroll"], outputs: ["outScroll", "outScrollX", "outScrollY", "outScrollTop", "outScrollBottom"] }, { kind: "pipe", type: LibsUiCheckSelectedByKeyPipe, name: "LibsUiCheckSelectedByKeyPipe" }, { kind: "pipe", type: LibsUiPipesCallFunctionInTemplatePipe, name: "LibsUiPipesCallFunctionInTemplatePipe" }, { kind: "pipe", type: LibsUiComponentsListGroupCalculatorMarginLeftItemPipe, name: "LibsUiComponentsListGroupCalculatorMarginLeftItemPipe" }, { kind: "component", type: LibsUiComponentsListGroupItemComponent, selector: "libs_ui-components-list-templates_group-item", inputs: ["items", "configTemplateGroup", "keySearch", "fieldKey", "keysChecked", "keysDisableItem", "parentItem", "disable", "disableLabel", "config", "keysStillOtherOptions"], outputs: ["outChangeView", "outChange", "outChangStageFlagMousePopover"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1731
|
+
}
|
|
1732
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListGroupComponent, decorators: [{
|
|
1733
|
+
type: Component,
|
|
1734
|
+
args: [{ selector: 'libs_ui-components-list-templates_group', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1735
|
+
VirtualScrollerModule,
|
|
1736
|
+
AsyncPipe,
|
|
1737
|
+
TranslateModule,
|
|
1738
|
+
LibsUiComponentsButtonsButtonComponent,
|
|
1739
|
+
LibsUiComponentsCheckboxSingleComponent,
|
|
1740
|
+
LibsUiComponentsRadioSingleComponent,
|
|
1741
|
+
LibsUiComponentsSpinnerComponent,
|
|
1742
|
+
LibsUiComponentsScrollOverlayDirective,
|
|
1743
|
+
LibsUiCheckSelectedByKeyPipe,
|
|
1744
|
+
LibsUiPipesCallFunctionInTemplatePipe,
|
|
1745
|
+
LibsUiComponentsListGroupCalculatorMarginLeftItemPipe,
|
|
1746
|
+
LibsUiComponentsListGroupItemComponent,
|
|
1747
|
+
], template: "@if (configTemplateGroup(); as configTemplateGroup) {\n @let constHtmlHeightViewPort = heightViewPort() ? heightViewPort() + 'px' : '100%';\n @let constHtmlDisable = loading() || disable() || false;\n <div\n class=\"libs-ui-list-group overflow-[hidden]\"\n [style.height]=\"constHtmlHeightViewPort\">\n <div class=\"flex flex-col w-full h-full relative min-h-[28px]\">\n @if (items().length && configTemplateGroup.configButtonSelectAndUndSelectItem?.(); as configButtonSelectItem) {\n <div [class]=\"'flex items-center bg-[#ffffff] ' + (configButtonSelectItem.classInclude ?? 'libs-ui-border-bottom-general')\">\n <libs_ui-components-buttons-button\n [type]=\"configButtonSelectItem.buttonCheckAll?.type ?? 'button-link-primary'\"\n [label]=\"configButtonSelectItem.buttonCheckAll?.label ?? 'i18n_select_all_searched_results'\"\n [classInclude]=\"configButtonSelectItem.buttonCheckAll?.classInclude || 'pr-[8px]'\"\n [classLabel]=\"configButtonSelectItem.buttonCheckAll?.classLabel || 'libs-ui-font-h6r'\"\n [disable]=\"constHtmlDisable\"\n (outClick)=\"handlerCheckedOrUnCheckedAll(true)\" />\n <div class=\"text-[#999999]\">|</div>\n <libs_ui-components-buttons-button\n [type]=\"configButtonSelectItem.buttonUncheckAll?.type ?? 'button-link-primary'\"\n [label]=\"configButtonSelectItem.buttonUncheckAll?.label ?? 'i18n_unselect_all_searched_results'\"\n [classInclude]=\"configButtonSelectItem.buttonUncheckAll?.classInclude || 'pl-[8px]'\"\n [classLabel]=\"configButtonSelectItem.buttonUncheckAll?.classLabel || 'libs-ui-font-h6s'\"\n [disable]=\"constHtmlDisable\"\n (outClick)=\"handlerCheckedOrUnCheckedAll(false)\" />\n </div>\n }\n @if (items().length && configTemplateGroup.configCheckboxCheckAll?.(); as configCheckBox) {\n <div [class]=\"'flex libs-ui-border-bottom-general ' + (configTemplateGroup.classIncludeHasConfigCheckBoxAll ?? ' bg-[#ffffff]')\">\n <libs_ui-components-checkbox-single\n [label]=\"configCheckBox.label ?? 'i18n_all'\"\n [classLabelInclude]=\"configCheckBox.classLabelInclude || ''\"\n [checked]=\"totalItemChecked() >= totalItem() && totalItem() > 0\"\n [disable]=\"constHtmlDisable\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChange)=\"handlerCheckedOrUnCheckedAll($event.checked)\" />\n </div>\n }\n @if (items() && items().length) {\n <div class=\"w-full h-full relative flex\">\n <div\n LibsUiComponentsScrollOverlayDirective\n class=\"w-full h-full absolute top-0 left-0 {{ configTemplateGroup.classIncludeGroup ? configTemplateGroup.classIncludeGroup : '' }}\">\n @for (item of items(); track item()[fieldKey()]; let first = $first; let last = $last) {\n <div\n #itemRef\n [style.marginTop.px]=\"!configTemplateGroup.ignoreGroupLine ? configTemplateGroup.marginTopHasLine || 4 : 0\"\n class=\"flex flex-col relative\">\n @let constHtmlPadding = level() * (configTemplateGroup.isViewTree ? 8 : 16);\n <div\n class=\"flex items-center py-[6px]\"\n [class.libs-ui-bg-list-hover]=\"!configTemplateGroup.ignoreClickLabelGroup\"\n [class.libs-ui-bg-list-hover-active]=\"!configTemplateGroup.ignoreClickLabelGroup\"\n [class.!cursor-pointer]=\"!configTemplateGroup.ignoreClickLabelGroup && (configTemplateGroup.ignoreCheckboxGroup || configTemplateGroup.singleSelectItem)\"\n [style.paddingLeft.px]=\"constHtmlPadding\"\n [style.paddingRight.px]=\"constHtmlPadding\"\n (click)=\"configTemplateGroup.ignoreCheckboxGroup || configTemplateGroup.singleSelectItem ? handlerToggleExpand($event, item) : undefined\">\n @if (configTemplateGroup.iconExpand === 'left' || configTemplateGroup.isViewTree) {\n <i\n class=\"cursor-pointer libs-ui-icon-chevron-right before:!text-[16px]\"\n [class.rotate-90]=\"item().expand\"\n (click)=\"handlerToggleExpand($event, item)\"></i>\n }\n <div\n class=\"flex\"\n [class.w-full]=\"configTemplateGroup.iconExpand === 'right' && !configTemplateGroup.isViewTree && (!configTemplateGroup.searchAllLevel || !!item()[configTemplateGroup.fieldGetItems]?.()?.length)\"\n [class.w-[calc(100%-16px)]]=\"configTemplateGroup.iconExpand === 'left' || configTemplateGroup.isViewTree\">\n @if (!configTemplateGroup.isViewRadio) {\n <libs_ui-components-checkbox-single\n [avatarConfig]=\"item().avatarConfig\"\n [class.ml-[8px]]=\"configTemplateGroup.iconExpand === 'left' || configTemplateGroup.isViewTree\"\n [ignoreCheckbox]=\"configTemplateGroup.ignoreCheckboxGroup || configTemplateGroup.singleSelectItem\"\n [class]=\"configTemplateGroup.classIncludeItem || ''\"\n [class.w-auto]=\"configTemplateGroup.isViewTree\"\n [class.w-full]=\"\n !item()[configTemplateGroup.fieldGetItems]?.()?.length &&\n !(\n (configTemplateGroup.isViewTree || configTemplateGroup.widthLabelSub24WhenNotTreeView) &&\n (configTemplateGroup.iconExpand === 'left' || (configTemplateGroup.iconExpand === 'right' && (!configTemplateGroup.searchAllLevel || !!item()[configTemplateGroup.fieldGetItems]?.()?.length)))\n )\n \"\n [class.max-w-[calc(100%-24px)]]=\"\n (configTemplateGroup.isViewTree || configTemplateGroup.widthLabelSub24WhenNotTreeView) &&\n (configTemplateGroup.iconExpand === 'left' || (configTemplateGroup.iconExpand === 'right' && (!configTemplateGroup.searchAllLevel || !!item()[configTemplateGroup.fieldGetItems]?.()?.length)))\n \"\n [label]=\"item().fieldLabel\"\n [popover]=\"item().dataPopover\"\n [zIndexLabel]=\"configTemplateGroup.zIndexLabel ?? zIndex()\"\n [dataComponentOutlet]=\"undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getDataComponentOutletGroup : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\"\n [componentOutlet]=\"0 | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getComponentOutletGroup : item() : fieldKey() : { valueIs0: 0 } | async\"\n [linkImage]=\"\n configTemplateGroup.getImage\n ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: (item().specific_loadImgError && configTemplateGroup.getLinkImageError ? configTemplateGroup.getLinkImageError : configTemplateGroup.getImage) : item() | async)\n : item()[configTemplateGroup.fieldGetAvatarItem || '']\n \"\n [imgTypeIcon]=\"configTemplateGroup.imgTypeIcon\"\n [classLabelInclude]=\"\n (configTemplateGroup.classLabelItem ? configTemplateGroup.classLabelItem : configTemplateGroup.isViewTree ? ' libs-ui-font-h6r ' : ' libs-ui-font-h6s ') +\n (configTemplateGroup.ignoreTextUppercaseLabelGroup || configTemplateGroup.isViewTree ? '' : ' text-uppercase ')\n \"\n [disable]=\"disable() || (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\"\n [checked]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length\"\n [stillOtherOptions]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysStillOtherOptions() : keysStillOtherOptions().length\"\n (outChange)=\"handlerChangeChecked($event.checked, item, true)\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outClickLabel)=\"handlerToggleExpand('clickLabel', item, configTemplateGroup.ignoreCheckboxGroup || configTemplateGroup.singleSelectItem)\" />\n }\n\n @if (configTemplateGroup.isViewRadio) {\n <libs_ui-components-radio-single\n [class.ml-[8px]]=\"configTemplateGroup.iconExpand === 'left' || configTemplateGroup.isViewTree\"\n [avatarConfig]=\"item().avatarConfig\"\n [ignoreRadio]=\"configTemplateGroup.ignoreRadioGroup || configTemplateGroup.singleSelectItem\"\n [class]=\"configTemplateGroup.classIncludeItem || ''\"\n [class.w-auto]=\"configTemplateGroup.isViewTree\"\n [class.w-full]=\"\n !item()[configTemplateGroup.fieldGetItems]?.()?.length &&\n !(\n (configTemplateGroup.isViewTree || configTemplateGroup.widthLabelSub24WhenNotTreeView) &&\n (configTemplateGroup.iconExpand === 'left' || (configTemplateGroup.iconExpand === 'right' && (!configTemplateGroup.searchAllLevel || !!item()[configTemplateGroup.fieldGetItems]?.()?.length)))\n )\n \"\n [class.max-w-[calc(100%-24px)]]=\"\n (configTemplateGroup.isViewTree || configTemplateGroup.widthLabelSub24WhenNotTreeView) &&\n (configTemplateGroup.iconExpand === 'left' || (configTemplateGroup.iconExpand === 'right' && (!configTemplateGroup.searchAllLevel || !!item()[configTemplateGroup.fieldGetItems]?.()?.length)))\n \"\n [label]=\"item().fieldLabel\"\n [popover]=\"item().dataPopover\"\n [dataComponentOutlet]=\"undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getDataComponentOutletGroup : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\"\n [componentOutlet]=\"0 | LibsUiPipesCallFunctionInTemplatePipe: configTemplateGroup.getComponentOutletGroup : item() : fieldKey() : { valueIs0: 0 } | async\"\n [zIndexLabel]=\"configTemplateGroup.zIndexLabel ?? zIndex()\"\n [imgTypeIcon]=\"configTemplateGroup.imgTypeIcon\"\n [linkImage]=\"\n configTemplateGroup.getImage\n ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: (item().specific_loadImgError && configTemplateGroup.getLinkImageError ? configTemplateGroup.getLinkImageError : configTemplateGroup.getImage) : item() | async)\n : item()[configTemplateGroup.fieldGetAvatarItem || '']\n \"\n [classLabelInclude]=\"(configTemplateGroup.classLabelItem ? configTemplateGroup.classLabelItem : 'libs-ui-font-h6s ') + (configTemplateGroup.ignoreTextUppercaseLabelGroup ? '' : ' uppercase')\"\n [disable]=\"\n disable() ||\n (configTemplateGroup.disableItemNotLastLevel && !!item()[configTemplateGroup.fieldGetItems]?.()?.length) ||\n configTemplateGroup.ignoreCheckboxGroup ||\n configTemplateGroup.singleSelectItem ||\n (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\n \"\n [active]=\"item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysChecked() : keysChecked().length\"\n (outChange)=\"handlerChangeChecked($event.active, item, true)\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outClickLabel)=\"handlerToggleExpand('clickLabel', item, configTemplateGroup.ignoreRadioGroup || configTemplateGroup.singleSelectItem)\" />\n }\n\n @if (item().buttonInGroup; as buttonInGroup) {\n <libs_ui-components-buttons-button\n [type]=\"buttonInGroup.type || 'button-link-primary'\"\n [label]=\"buttonInGroup.label || ' '\"\n [classIconLeft]=\"(buttonInGroup.classIconLeft || '') + ' flex mr-[8px] !text-[8px]'\"\n [classInclude]=\"buttonInGroup.classInclude\"\n [classLabel]=\"buttonInGroup.classLabel || 'libs-ui-font-h5r'\"\n [disable]=\"buttonInGroup.disable || disable() || false\"\n (outClick)=\"handlerClickButtonGroup(buttonInGroup, item())\" />\n }\n </div>\n\n @if (configTemplateGroup.iconExpand === 'right' && !configTemplateGroup.isViewTree && (!configTemplateGroup.searchAllLevel || !!item()[configTemplateGroup.fieldGetItems]?.()?.length)) {\n <i\n class=\"flex items-center cursor-pointer libs-ui-icon-chevron-right before:!text-[16px]\"\n [class.!ml-[8px]]=\"item().dataPopover\"\n [class.rotate-90]=\"item().expand\"\n (click)=\"handlerToggleExpand($event, item)\"></i>\n }\n </div>\n @if (item().expand && calculatorHeighItemSuccess()) {\n <libs_ui-components-list-templates_group-item\n [keySearch]=\"keySearch()\"\n [items]=\"item()[configTemplateGroup.fieldGetItems]()\"\n [parentItem]=\"item()\"\n [fieldKey]=\"fieldKey()\"\n [keysChecked]=\"keysChecked()\"\n [disable]=\"disable()\"\n [keysDisableItem]=\"keysDisableItem() || []\"\n [configTemplateGroup]=\"configTemplateGroup\"\n [config]=\"config()\"\n [keysStillOtherOptions]=\"keysStillOtherOptions()\"\n (outChangeView)=\"handlerChangeView()\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChange)=\"handlerChangeItemChecked($event.item)\" />\n }\n @if (!last && !configTemplateGroup.ignoreGroupLine && calculatorHeighItemSuccess()) {\n <div\n class=\"libs-ui-list-group-line\"\n [style.marginTop.px]=\"!configTemplateGroup.ignoreGroupLine ? configTemplateGroup.marginTopHasLine || 4 : 0\"></div>\n }\n </div>\n }\n </div>\n </div>\n }\n @if (!items() || !items().length) {\n <div\n class=\"libs-ui-font-h5r text-[#c1c1c1] relative {{ configTemplateGroup.classIncludeNodata ? configTemplateGroup.classIncludeNodata : '' }}\"\n [style.marginLeft.px]=\"\n 0\n | LibsUiComponentsListGroupCalculatorMarginLeftItemPipe\n : 2\n : configTemplateGroup.isViewTree || configTemplateGroup.iconExpand === 'left'\n : configTemplateGroup.isViewTreeJson\n : !(configTemplateGroup.ignoreCheckboxItem || configTemplateGroup.ignoreRadioItem || configTemplateGroup.singleSelectItem)\n : true\n \"\n [class.py-[8px]]=\"configTemplateGroup.fieldGetAvatarItem\"\n [class.py-[4px]]=\"!configTemplateGroup.fieldGetAvatarItem\">\n @if (!keySearch() && !loading()) {\n @let constHtmlTextNoData = config()?.textNoData || 'i18n_no_data_yet';\n <div>{{ constHtmlTextNoData | translate }}</div>\n }\n @if (keySearch() && !loading()) {\n @let constHtmlTextSearchNoData = config()?.textSearchNoData || 'i18n_no_result';\n <div>{{ constHtmlTextSearchNoData | translate }}</div>\n }\n </div>\n }\n @if (loading()) {\n <libs_ui-components-spinner [size]=\"'medium'\" />\n }\n </div>\n </div>\n}\n", styles: [".libs-ui-list-group{display:flex;flex-direction:column;width:100%}.libs-ui-list-group .libs-ui-list-group-line{width:100%;height:1px;background-color:#e6e7ea}.libs-ui-list-group [class*=libs-ui-icon-chevron]:before{color:#6a7383}\n"] }]
|
|
1748
|
+
}] });
|
|
1749
|
+
|
|
1750
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1751
|
+
class LibsUiComponentsListRadioComponent extends LibsUiComponentsListTemplatesComponentAbstract {
|
|
1752
|
+
// #region PROPERTY
|
|
1753
|
+
configTemplateRadio = signal(undefined);
|
|
1754
|
+
/* VIEW CHILD */
|
|
1755
|
+
virtualScrollerComponent = viewChild(VirtualScrollerComponent);
|
|
1756
|
+
ngOnInit() {
|
|
1757
|
+
if (isNil(this.config()?.configTemplateRadio)) {
|
|
1758
|
+
return;
|
|
1759
|
+
}
|
|
1760
|
+
super.ngOnInit();
|
|
1761
|
+
this.configTemplateRadio.set(this.config()?.configTemplateRadio?.());
|
|
1762
|
+
this.fieldKey.set(this.configTemplateRadio()?.fieldKey ?? this.fieldKeyDefault());
|
|
1763
|
+
this.callApiByService();
|
|
1764
|
+
}
|
|
1765
|
+
/* FUNCTIONS */
|
|
1766
|
+
handlerScrollBottom() {
|
|
1767
|
+
if (this.loadedLastItem()) {
|
|
1768
|
+
this.loading.set(false);
|
|
1769
|
+
this.outLoading.emit(this.loading());
|
|
1770
|
+
return;
|
|
1771
|
+
}
|
|
1772
|
+
if (this.loading() || this.loadedLastItem()) {
|
|
1773
|
+
return;
|
|
1774
|
+
}
|
|
1775
|
+
this.loading.set(true);
|
|
1776
|
+
this.outLoading.emit(this.loading());
|
|
1777
|
+
this.callApiByService(false);
|
|
1778
|
+
}
|
|
1779
|
+
processSearch() {
|
|
1780
|
+
if (!this.isSearchOnline()) {
|
|
1781
|
+
return this.processData(true);
|
|
1782
|
+
}
|
|
1783
|
+
this.callApiByService(true);
|
|
1784
|
+
}
|
|
1785
|
+
handlerChange(event, item, ignoreDisable, isClickManual = true) {
|
|
1786
|
+
if (!item) {
|
|
1787
|
+
return;
|
|
1788
|
+
}
|
|
1789
|
+
if (this.disable() && !ignoreDisable) {
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
if (event instanceof Event) {
|
|
1793
|
+
if (this.clickExactly()) {
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1796
|
+
event.stopPropagation();
|
|
1797
|
+
this.keySelected.set(item[this.fieldKey()]);
|
|
1798
|
+
this.outSelectKey.emit({ key: this.keySelected(), item, isClickManual });
|
|
1799
|
+
return;
|
|
1800
|
+
}
|
|
1801
|
+
this.keySelected.set(item[this.fieldKey()]);
|
|
1802
|
+
this.outSelectKey.emit({ key: this.keySelected(), item, isClickManual });
|
|
1803
|
+
}
|
|
1804
|
+
processData(replace) {
|
|
1805
|
+
const itemByKeySearch = [];
|
|
1806
|
+
const keysHidden = this.keysHiddenItem() || [];
|
|
1807
|
+
if (replace) {
|
|
1808
|
+
this.items.set([]);
|
|
1809
|
+
}
|
|
1810
|
+
this.store().forEach((item) => {
|
|
1811
|
+
const dataStore = cloneDeep(item);
|
|
1812
|
+
dataStore.update((store) => {
|
|
1813
|
+
return { ...store, ref: item() };
|
|
1814
|
+
});
|
|
1815
|
+
const key = keysHidden.find((key) => dataStore()[this.fieldKey()] === key);
|
|
1816
|
+
if (key === undefined) {
|
|
1817
|
+
const text = deleteUnicode(this.buildValueByConfig(dataStore, this.configTemplateRadio())).toLocaleLowerCase();
|
|
1818
|
+
const textEscape = escapeHtml(text);
|
|
1819
|
+
const keySearch = deleteUnicode(escapeHtml(this.keySearch().toLocaleLowerCase()));
|
|
1820
|
+
if (((this.isSearchOnline() && this.config()?.httpRequestData?.()?.serviceClass && !this.config()?.httpRequestData?.()?.objectInstance) || (text && (text.includes(keySearch) || textEscape.includes(keySearch)))) &&
|
|
1821
|
+
(replace || (!replace && !this.items().find((dataItem) => dataItem()[this.fieldKey()] === dataStore()[this.fieldKey()]))) &&
|
|
1822
|
+
!itemByKeySearch.find((dataItem) => dataItem()[this.fieldKey()] === dataStore()[this.fieldKey()])) {
|
|
1823
|
+
if (this.configTemplateRadio()?.getPopover) {
|
|
1824
|
+
dataStore.update((currentStore) => {
|
|
1825
|
+
return { ...currentStore, dataTooltip: this.configTemplateRadio()?.getPopover?.(dataStore) };
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
dataStore.update((currentStore) => {
|
|
1829
|
+
return {
|
|
1830
|
+
...currentStore,
|
|
1831
|
+
classLabelInclude: this.configTemplateRadio()?.getClassItem?.(dataStore()),
|
|
1832
|
+
avatarConfig: this.configTemplateRadio()?.getAvatarConfig?.(dataStore()),
|
|
1833
|
+
};
|
|
1834
|
+
});
|
|
1835
|
+
itemByKeySearch.push(dataStore);
|
|
1836
|
+
}
|
|
1837
|
+
return;
|
|
1838
|
+
}
|
|
1839
|
+
const indexItemRemove = this.items().findIndex((item) => item()[this.fieldKey()] === key);
|
|
1840
|
+
if (indexItemRemove > -1) {
|
|
1841
|
+
this.items.update((items) => {
|
|
1842
|
+
items.splice(indexItemRemove, 1);
|
|
1843
|
+
return items;
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
});
|
|
1847
|
+
const callbackCheckScroll = (preStateHasScroll, currentHasScroll) => {
|
|
1848
|
+
this.scrollToItemSelected();
|
|
1849
|
+
if (this.keysHiddenItem()?.length && preStateHasScroll && !currentHasScroll && this.isSearchOnline()) {
|
|
1850
|
+
this.callApiByService(false);
|
|
1851
|
+
}
|
|
1852
|
+
};
|
|
1853
|
+
if (replace) {
|
|
1854
|
+
this.items.set(itemByKeySearch);
|
|
1855
|
+
this.config()?.sort?.(this.items());
|
|
1856
|
+
this.emitKeySelectedDefaultIfExistItem(this.items());
|
|
1857
|
+
this.autoSelectFirstItem(this.items());
|
|
1858
|
+
this.setHeightViewPort();
|
|
1859
|
+
this.loading.set(false);
|
|
1860
|
+
this.outLoading.emit(this.loading());
|
|
1861
|
+
this.outLoadItemsComplete.emit({ items: this.items(), paging: this.pagingStore() });
|
|
1862
|
+
this.checkViewPortScroll(callbackCheckScroll);
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
this.items.update((items) => [...(items || []), ...itemByKeySearch]);
|
|
1866
|
+
this.config()?.sort?.(this.items());
|
|
1867
|
+
this.setHeightViewPort();
|
|
1868
|
+
this.loading.set(false);
|
|
1869
|
+
this.outLoading.emit(this.loading());
|
|
1870
|
+
this.outLoadItemsComplete.emit({ items: this.items(), paging: this.pagingStore() });
|
|
1871
|
+
this.checkViewPortScroll(callbackCheckScroll);
|
|
1872
|
+
}
|
|
1873
|
+
scrollToItemSelected() {
|
|
1874
|
+
if (!this.configTemplateRadio()?.autoScrollToItemSelected) {
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
clearTimeout(this.timeAutoScrollItemSelected());
|
|
1878
|
+
this.timeAutoScrollItemSelected.set(setTimeout(() => {
|
|
1879
|
+
if (!this.keySelected) {
|
|
1880
|
+
return;
|
|
1881
|
+
}
|
|
1882
|
+
const index = this.items().findIndex((item) => item()[this.fieldKey()] === this.keySelected());
|
|
1883
|
+
if (index !== -1) {
|
|
1884
|
+
const offsetContainer = this.elementScroll()?.nativeElement?.offsetHeight;
|
|
1885
|
+
const additionalOffset = ((offsetContainer ? offsetContainer - this.heightItem() : 0) / 2) * -1;
|
|
1886
|
+
this.virtualScrollerComponent()?.scrollToIndex(index, true, additionalOffset, this.timeAnimationScrollToIndexItem());
|
|
1887
|
+
}
|
|
1888
|
+
}));
|
|
1889
|
+
}
|
|
1890
|
+
autoSelectFirstItem(items) {
|
|
1891
|
+
if (this.autoSelectedFirstItemCallOutsideBefore() || this.keySelected() || !this.config()?.autoSelectFirstItem || !items || !items.length) {
|
|
1892
|
+
return;
|
|
1893
|
+
}
|
|
1894
|
+
this.handlerChange('radio', items[0]?.(), true, false);
|
|
1895
|
+
}
|
|
1896
|
+
emitKeySelectedDefaultIfExistItem(items) {
|
|
1897
|
+
const item = items.find((store) => store()[this.fieldKey()] === this.keySelected());
|
|
1898
|
+
if (item) {
|
|
1899
|
+
this.handlerChange('radio', item(), true, false);
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
getLengthItem() {
|
|
1903
|
+
return this.items().length;
|
|
1904
|
+
}
|
|
1905
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListRadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1906
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LibsUiComponentsListRadioComponent, isStandalone: true, selector: "libs_ui-components-list-templates_radio", viewQueries: [{ propertyName: "virtualScrollerComponent", first: true, predicate: VirtualScrollerComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (configTemplateRadio(); as configTemplateRadio) {\n <div class=\"relative h-full w-full\">\n @if (items().length) {\n <div\n #elementScroll\n LibsUiComponentsScrollOverlayDirective\n class=\"w-full\"\n [class.h-full]=\"!heightViewPort()\"\n [style.height]=\"heightViewPort() ? heightViewPort() + 'px' : '100%'\"\n (outScrollBottom)=\"handlerScrollBottom()\">\n <virtual-scroller\n #scroll\n [parentScroll]=\"elementScroll\"\n [items]=\"items()\"\n class=\"h-full\">\n @for (item of scroll.viewPortItems; track item()[fieldKey()]) {\n <div\n #itemRef\n [class]=\"'libs-ui-list-template-radio-item libs-ui-font-h5r flex ' + (configTemplateRadio.classItemInclude || '')\"\n [class.libs-ui-bg-list-hover]=\"!clickExactly()\"\n [class.libs-ui-bg-list-hover-active]=\"!clickExactly()\"\n [class.!pl-[12px]]=\"paddingLeftItem()\"\n [class.bg-[#ffffff]]=\"clickExactly()\"\n [class.!py-[2px]]=\"clickExactly()\"\n (click)=\"handlerChange($event, item())\">\n <div\n class=\"flex flex-col w-full\"\n [class.!flex-row]=\"configTemplateRadio.rowSameLineRadio\">\n @if (item().fieldLabel) {\n <libs_ui-components-radio-single\n [label]=\"item().fieldLabel\"\n [avatarConfig]=\"item().avatarConfig\"\n [active]=\"keySelected() === item()[fieldKey()]\"\n [key]=\"item()[fieldKey()]\"\n [imgTypeIcon]=\"configTemplateRadio.hasAvatarGroupSocial\"\n [linkImage]=\"\n configTemplateRadio.getImage\n ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: (item().specific_loadImgError && configTemplateRadio.getImageError ? configTemplateRadio.getImageError : configTemplateRadio.getImage) : item() | async)\n : item()[configTemplateRadio.fieldGetImage || '']\n \"\n [classImageInclude]=\"configTemplateRadio.classIncludeImage || ''\"\n [bullet]=\"item().bullet?.()\"\n [disable]=\"loading() || disable() || (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\"\n [classLabelInclude]=\"item().classLabelInclude || ''\"\n [popover]=\"(item().popoverLabel | LibsUiPipesConvertObjectToSignalPipe)?.() | LibsUiPipesConvertSignalToObjectPipe\"\n [clickExactly]=\"clickExactly()\"\n [disableLabel]=\"disableLabel()\"\n [dataComponentOutlet]=\"undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateRadio.getDataComponentOutlet : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\"\n [componentOutlet]=\"0 | LibsUiPipesCallFunctionInTemplatePipe: configTemplateRadio.getComponentOutlet : item() : fieldKey() : { valueIs0: 0 } | async\"\n [zIndexLabel]=\"configTemplateRadio.zIndexPopover ?? 1200\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChange)=\"handlerChange('radio', item())\"\n (outClickLabel)=\"handlerChange('radio', item())\" />\n }\n @if (configTemplateRadio?.rows?.()) {\n <libs_ui-components-list-templates_rows\n class=\"w-full {{ (configTemplateRadio.classRowsWrapper || configTemplateRadio.classRows) ?? '' }}\"\n [item]=\"item()\"\n [fieldKey]=\"fieldKey()\"\n [keySelected]=\"keySelected()\"\n [configTemplate]=\"configTemplateRadio\"\n (outEvent)=\"handlerChange('radio', $event.item)\" />\n }\n </div>\n </div>\n }\n </virtual-scroller>\n </div>\n }\n @if (!items().length) {\n <div [class]=\"'libs-ui-font-h4r text-[#c1c1c1] ' + (config()?.textNoDataClassInclude ?? 'py-[4px] px-[12px]')\">\n @if (!keySearch() && !loading()) {\n @let constHtmlTextNoData = config()?.textNoData || 'i18n_have_no_selection';\n <span>{{ constHtmlTextNoData | translate }}</span>\n }\n @if (templateRefSearchNoData() && keySearch() && !loading()) {\n <ng-container *ngTemplateOutlet=\"templateRefSearchNoData() || null; context: { keySearch: keySearch() }\" />\n }\n @if (!templateRefSearchNoData() && keySearch() && !loading()) {\n @let constHtmlTextSearchNoData = config()?.textSearchNoData || 'i18n_no_result';\n <span>{{ constHtmlTextSearchNoData | translate }}</span>\n }\n @if (loading()) {\n <span> </span>\n }\n </div>\n }\n\n @if (loading()) {\n <libs_ui-components-spinner [size]=\"'medium'\" />\n }\n </div>\n}\n", styles: [".libs-ui-list-template-radio-item{padding:6px 16px;position:relative}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: VirtualScrollerModule }, { kind: "component", type: i1$1.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: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: LibsUiComponentsSpinnerComponent, selector: "libs_ui-components-spinner", inputs: ["type", "size"] }, { kind: "directive", type: LibsUiComponentsScrollOverlayDirective, selector: "[LibsUiComponentsScrollOverlayDirective]", inputs: ["debugMode", "ignoreInit", "classContainer", "options", "elementCheckScrollX", "elementCheckScrollY", "elementScroll"], outputs: ["outScroll", "outScrollX", "outScrollY", "outScrollTop", "outScrollBottom"] }, { kind: "component", type: LibsUiComponentsRadioSingleComponent, selector: "libs_ui-components-radio-single", inputs: ["key", "active", "classInclude", "label", "labelInterpolateParams", "ignorePopoverLabel", "classLabelInclude", "linkImage", "linkImageError", "avatarConfig", "classImageInclude", "imgTypeIcon", "bullet", "popover", "disable", "disableLabel", "clickExactly", "typeRadio", "ignoreRadio", "zIndexLabel", "classIncludeIcon", "dataComponentOutlet", "componentOutlet"], outputs: ["activeChange", "outClickLabel", "outChange", "outChangStageFlagMousePopover"] }, { kind: "pipe", type: LibsUiPipesCallFunctionInTemplatePipe, name: "LibsUiPipesCallFunctionInTemplatePipe" }, { kind: "pipe", type: LibsUiCheckSelectedByKeyPipe, name: "LibsUiCheckSelectedByKeyPipe" }, { kind: "component", type: LibsUiComponentsListRowsComponent, selector: "libs_ui-components-list-templates_rows", inputs: ["configTemplate", "item", "keySelected", "fieldKey", "zIndex"], outputs: ["outChangStageFlagMousePopover", "outEvent"] }, { kind: "pipe", type: LibsUiPipesConvertObjectToSignalPipe, name: "LibsUiPipesConvertObjectToSignalPipe" }, { kind: "pipe", type: LibsUiPipesConvertSignalToObjectPipe, name: "LibsUiPipesConvertSignalToObjectPipe" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1907
|
+
}
|
|
1908
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListRadioComponent, decorators: [{
|
|
1909
|
+
type: Component,
|
|
1910
|
+
args: [{ selector: 'libs_ui-components-list-templates_radio', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1911
|
+
NgTemplateOutlet,
|
|
1912
|
+
VirtualScrollerModule,
|
|
1913
|
+
AsyncPipe,
|
|
1914
|
+
TranslateModule,
|
|
1915
|
+
LibsUiComponentsSpinnerComponent,
|
|
1916
|
+
LibsUiComponentsScrollOverlayDirective,
|
|
1917
|
+
LibsUiComponentsRadioSingleComponent,
|
|
1918
|
+
LibsUiPipesCallFunctionInTemplatePipe,
|
|
1919
|
+
LibsUiCheckSelectedByKeyPipe,
|
|
1920
|
+
LibsUiComponentsListRowsComponent,
|
|
1921
|
+
LibsUiPipesConvertObjectToSignalPipe,
|
|
1922
|
+
LibsUiPipesConvertSignalToObjectPipe,
|
|
1923
|
+
], template: "@if (configTemplateRadio(); as configTemplateRadio) {\n <div class=\"relative h-full w-full\">\n @if (items().length) {\n <div\n #elementScroll\n LibsUiComponentsScrollOverlayDirective\n class=\"w-full\"\n [class.h-full]=\"!heightViewPort()\"\n [style.height]=\"heightViewPort() ? heightViewPort() + 'px' : '100%'\"\n (outScrollBottom)=\"handlerScrollBottom()\">\n <virtual-scroller\n #scroll\n [parentScroll]=\"elementScroll\"\n [items]=\"items()\"\n class=\"h-full\">\n @for (item of scroll.viewPortItems; track item()[fieldKey()]) {\n <div\n #itemRef\n [class]=\"'libs-ui-list-template-radio-item libs-ui-font-h5r flex ' + (configTemplateRadio.classItemInclude || '')\"\n [class.libs-ui-bg-list-hover]=\"!clickExactly()\"\n [class.libs-ui-bg-list-hover-active]=\"!clickExactly()\"\n [class.!pl-[12px]]=\"paddingLeftItem()\"\n [class.bg-[#ffffff]]=\"clickExactly()\"\n [class.!py-[2px]]=\"clickExactly()\"\n (click)=\"handlerChange($event, item())\">\n <div\n class=\"flex flex-col w-full\"\n [class.!flex-row]=\"configTemplateRadio.rowSameLineRadio\">\n @if (item().fieldLabel) {\n <libs_ui-components-radio-single\n [label]=\"item().fieldLabel\"\n [avatarConfig]=\"item().avatarConfig\"\n [active]=\"keySelected() === item()[fieldKey()]\"\n [key]=\"item()[fieldKey()]\"\n [imgTypeIcon]=\"configTemplateRadio.hasAvatarGroupSocial\"\n [linkImage]=\"\n configTemplateRadio.getImage\n ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: (item().specific_loadImgError && configTemplateRadio.getImageError ? configTemplateRadio.getImageError : configTemplateRadio.getImage) : item() | async)\n : item()[configTemplateRadio.fieldGetImage || '']\n \"\n [classImageInclude]=\"configTemplateRadio.classIncludeImage || ''\"\n [bullet]=\"item().bullet?.()\"\n [disable]=\"loading() || disable() || (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: keysDisableItem() : keysDisableItem()?.length)\"\n [classLabelInclude]=\"item().classLabelInclude || ''\"\n [popover]=\"(item().popoverLabel | LibsUiPipesConvertObjectToSignalPipe)?.() | LibsUiPipesConvertSignalToObjectPipe\"\n [clickExactly]=\"clickExactly()\"\n [disableLabel]=\"disableLabel()\"\n [dataComponentOutlet]=\"undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateRadio.getDataComponentOutlet : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\"\n [componentOutlet]=\"0 | LibsUiPipesCallFunctionInTemplatePipe: configTemplateRadio.getComponentOutlet : item() : fieldKey() : { valueIs0: 0 } | async\"\n [zIndexLabel]=\"configTemplateRadio.zIndexPopover ?? 1200\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outChange)=\"handlerChange('radio', item())\"\n (outClickLabel)=\"handlerChange('radio', item())\" />\n }\n @if (configTemplateRadio?.rows?.()) {\n <libs_ui-components-list-templates_rows\n class=\"w-full {{ (configTemplateRadio.classRowsWrapper || configTemplateRadio.classRows) ?? '' }}\"\n [item]=\"item()\"\n [fieldKey]=\"fieldKey()\"\n [keySelected]=\"keySelected()\"\n [configTemplate]=\"configTemplateRadio\"\n (outEvent)=\"handlerChange('radio', $event.item)\" />\n }\n </div>\n </div>\n }\n </virtual-scroller>\n </div>\n }\n @if (!items().length) {\n <div [class]=\"'libs-ui-font-h4r text-[#c1c1c1] ' + (config()?.textNoDataClassInclude ?? 'py-[4px] px-[12px]')\">\n @if (!keySearch() && !loading()) {\n @let constHtmlTextNoData = config()?.textNoData || 'i18n_have_no_selection';\n <span>{{ constHtmlTextNoData | translate }}</span>\n }\n @if (templateRefSearchNoData() && keySearch() && !loading()) {\n <ng-container *ngTemplateOutlet=\"templateRefSearchNoData() || null; context: { keySearch: keySearch() }\" />\n }\n @if (!templateRefSearchNoData() && keySearch() && !loading()) {\n @let constHtmlTextSearchNoData = config()?.textSearchNoData || 'i18n_no_result';\n <span>{{ constHtmlTextSearchNoData | translate }}</span>\n }\n @if (loading()) {\n <span> </span>\n }\n </div>\n }\n\n @if (loading()) {\n <libs_ui-components-spinner [size]=\"'medium'\" />\n }\n </div>\n}\n", styles: [".libs-ui-list-template-radio-item{padding:6px 16px;position:relative}\n"] }]
|
|
1924
|
+
}] });
|
|
1925
|
+
|
|
1926
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1927
|
+
class LibsUiComponentsListTagComponent extends LibsUiComponentsListTemplatesComponentAbstract {
|
|
1928
|
+
// #region PROPERTY
|
|
1929
|
+
configTemplateTag = signal(undefined);
|
|
1930
|
+
ngOnInit() {
|
|
1931
|
+
if (!this.config()?.configTemplateTag?.()) {
|
|
1932
|
+
return;
|
|
1933
|
+
}
|
|
1934
|
+
super.ngOnInit();
|
|
1935
|
+
this.configTemplateTag.set(this.config()?.configTemplateTag?.());
|
|
1936
|
+
this.fieldKey.set(this.configTemplateTag()?.fieldKey ?? this.fieldKeyDefault());
|
|
1937
|
+
this.callApiByService();
|
|
1938
|
+
}
|
|
1939
|
+
/* FUNCTIONS */
|
|
1940
|
+
handlerSelectItem(e, item) {
|
|
1941
|
+
if (e instanceof Event) {
|
|
1942
|
+
e.stopPropagation();
|
|
1943
|
+
e.preventDefault();
|
|
1944
|
+
}
|
|
1945
|
+
if (!item || (this.keysDisableItem() && this.keysDisableItem()?.some((key) => key === item[this.fieldKey()]))) {
|
|
1946
|
+
return;
|
|
1947
|
+
}
|
|
1948
|
+
const key = item[this.fieldKey()];
|
|
1949
|
+
const indexOfKey = this.multiKeySelected()?.indexOf(key) ?? -1;
|
|
1950
|
+
if (indexOfKey < 0) {
|
|
1951
|
+
this.multiKeySelected.update((items) => [...(items || []), key]);
|
|
1952
|
+
this.emitMoSelectMultiKey(this.multiKeySelected() || []);
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1955
|
+
this.multiKeySelected.update((items) => {
|
|
1956
|
+
items?.splice(indexOfKey, 1);
|
|
1957
|
+
return items;
|
|
1958
|
+
});
|
|
1959
|
+
this.outUnSelectMultiKey.emit([key]);
|
|
1960
|
+
this.emitMoSelectMultiKey(this.multiKeySelected() || []);
|
|
1961
|
+
}
|
|
1962
|
+
async emitMoSelectMultiKey(multiKeySelected, isClickManual = true) {
|
|
1963
|
+
const mapKeys = new Array();
|
|
1964
|
+
if (!multiKeySelected || !multiKeySelected.length) {
|
|
1965
|
+
return this.outSelectMultiKey.emit({ keys: [], mapKeys, isClickManual });
|
|
1966
|
+
}
|
|
1967
|
+
multiKeySelected.forEach((key) => {
|
|
1968
|
+
const item = this.store().find((item) => item()[this.fieldKey()] === key);
|
|
1969
|
+
mapKeys.push({ key, item, isClickManual });
|
|
1970
|
+
});
|
|
1971
|
+
this.outSelectMultiKey.emit({ keys: this.multiKeySelected() || [], mapKeys, isClickManual });
|
|
1972
|
+
}
|
|
1973
|
+
handlerScrollBottom() {
|
|
1974
|
+
if (this.loadedLastItem()) {
|
|
1975
|
+
this.loading.set(false);
|
|
1976
|
+
this.outLoading.emit(this.loading());
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
if (this.loading() || this.loadedLastItem()) {
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
this.loading.set(true);
|
|
1983
|
+
this.outLoading.emit(this.loading());
|
|
1984
|
+
this.callApiByService(false);
|
|
1985
|
+
}
|
|
1986
|
+
processSearch() {
|
|
1987
|
+
this.callApiByService(true);
|
|
1988
|
+
}
|
|
1989
|
+
processData(replace) {
|
|
1990
|
+
const itemByKeySearch = [];
|
|
1991
|
+
const keysHidden = this.keysHiddenItem() || [];
|
|
1992
|
+
if (replace) {
|
|
1993
|
+
this.items.set([]);
|
|
1994
|
+
}
|
|
1995
|
+
this.store().forEach((item) => {
|
|
1996
|
+
const dataStore = cloneDeep(item);
|
|
1997
|
+
dataStore.update((currentStore) => {
|
|
1998
|
+
return { ...currentStore, ref: item() };
|
|
1999
|
+
});
|
|
2000
|
+
const key = keysHidden.find((key) => dataStore()[this.fieldKey()] === key);
|
|
2001
|
+
if (key === undefined) {
|
|
2002
|
+
const text = this.buildValueByConfig(dataStore, this.configTemplateTag());
|
|
2003
|
+
if (text && deleteUnicode(text.toLocaleLowerCase()).includes(deleteUnicode(this.keySearch().toLocaleLowerCase())) && !this.items().find((dataItem) => dataItem()[this.fieldKey()] === dataStore()[this.fieldKey()])) {
|
|
2004
|
+
itemByKeySearch.push(dataStore);
|
|
2005
|
+
dataStore.update((currentStore) => {
|
|
2006
|
+
return {
|
|
2007
|
+
...currentStore,
|
|
2008
|
+
classItem: item().classItem || this.configTemplateTag()?.getClassItem?.(dataStore()),
|
|
2009
|
+
};
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
2012
|
+
return;
|
|
2013
|
+
}
|
|
2014
|
+
const indexItemRemove = this.items().findIndex((item) => item()[this.fieldKey()] === key);
|
|
2015
|
+
if (indexItemRemove > -1) {
|
|
2016
|
+
this.items.update((items) => {
|
|
2017
|
+
items.splice(indexItemRemove, 1);
|
|
2018
|
+
return items;
|
|
2019
|
+
});
|
|
2020
|
+
}
|
|
2021
|
+
});
|
|
2022
|
+
const checkLoadItem = (preStateHasScroll, currentHasScroll) => {
|
|
2023
|
+
if (this.keysHiddenItem()?.length && preStateHasScroll && !currentHasScroll && this.isSearchOnline()) {
|
|
2024
|
+
this.callApiByService(false);
|
|
2025
|
+
}
|
|
2026
|
+
};
|
|
2027
|
+
if (replace) {
|
|
2028
|
+
this.items.set(itemByKeySearch);
|
|
2029
|
+
this.config()?.sort?.(this.items());
|
|
2030
|
+
this.setHeightViewPort();
|
|
2031
|
+
this.checkViewPortScroll(checkLoadItem);
|
|
2032
|
+
this.loading.set(false);
|
|
2033
|
+
this.outLoading.emit(this.loading());
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
this.items.update((items) => [...(items || []), ...itemByKeySearch]);
|
|
2037
|
+
this.config()?.sort?.(this.items());
|
|
2038
|
+
this.setHeightViewPort();
|
|
2039
|
+
this.checkViewPortScroll(checkLoadItem);
|
|
2040
|
+
this.loading.set(false);
|
|
2041
|
+
this.outLoading.emit(this.loading());
|
|
2042
|
+
}
|
|
2043
|
+
getLengthItem() {
|
|
2044
|
+
return this.items().length;
|
|
2045
|
+
}
|
|
2046
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListTagComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2047
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LibsUiComponentsListTagComponent, isStandalone: true, selector: "libs_ui-components-list-templates_tag", usesInheritance: true, ngImport: i0, template: "@if (configTemplateTag(); as configTemplateTag) {\n <div\n class=\"w-full h-full relative\"\n LibsUiComponentsScrollOverlayDirective\n (outScrollBottom)=\"handlerScrollBottom()\">\n <div\n class=\"relative max-h-[150px] h-full {{ configTemplateTag.classIncludeContainer }}\"\n [ngClass]=\"{ 'flex flex-wrap': !configTemplateTag.ignoreItemFlexWrap }\"\n [class.min-h-[45px]]=\"!loading() && (!items() || !items().length)\"\n [class.min-h-[94px]]=\"loading() && items()\">\n @for (item of items(); track item()[fieldKey()]) {\n <div\n [class.libs-ui-disable]=\"loading() || disable()\"\n [class.pointer-events-none]=\"loading() || disable()\"\n [class]=\"item().classContainerItem\">\n @if (item().bullet; as bullet) {\n <div\n [class]=\"item().classItem || 'rounded-[10px] px-[8px] py-[1px] mb-[8px] mr-[8px]'\"\n [class.w-max]=\"configTemplateTag?.ignoreItemFlexWrap\"\n [style.background-color]=\"bullet().backgroundColor\"\n [style.color]=\"bullet().color\"\n (click)=\"handlerSelectItem($event, item())\">\n <span [innerHTML]=\"item().fieldLabel\"></span>\n </div>\n } @else {\n @let constHtmlIsSelected = item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: multiKeySelected() : multiKeySelected().length;\n <div\n (click)=\"handlerSelectItem($event, item())\"\n [class]=\"item().classItem || 'rounded-[20px] mb-[8px] mr-[8px] py-[4px] px-[8px] flex items-center cursor-pointer'\"\n [class.bg-[var(--libs-ui-color-light-2)]]=\"constHtmlIsSelected\"\n [class.text-[var(--libs-ui-color-default)]]=\"constHtmlIsSelected\"\n [class.bg-white]=\"!constHtmlIsSelected\"\n [class.text-[#6a7383]]=\"!constHtmlIsSelected\"\n [class.libs-ui-border-general]=\"!constHtmlIsSelected\">\n @if (constHtmlIsSelected) {\n <div class=\"mr-[8px] text-[12px] libs-ui-icon-check before:text-[var(--libs-ui-color-default)]\"></div>\n }\n <span\n class=\"libs-ui-font-h6r break-word\"\n [innerHTML]=\"item().fieldLabel\"></span>\n </div>\n }\n </div>\n }\n @if (!items() || !items().length) {\n <div [class]=\"'libs-ui-font-h5r text-[#9ca2ad] ' + (config()?.textNoDataClassInclude ?? 'py-[4px] flex items-center justify-center w-full')\">\n @if (!keySearch() && !loading()) {\n @let constHtmlTextNoData = config()?.textNoData || 'i18n_have_no_selection';\n {{ constHtmlTextNoData | translate }}\n }\n @if (templateRefSearchNoData() && keySearch() && !loading()) {\n <ng-container *ngTemplateOutlet=\"templateRefSearchNoData() || null; context: { keySearch: keySearch() }\" />\n }\n @if (!templateRefSearchNoData() && keySearch() && !loading()) {\n @let constHtmlTextSearchNoData = config()?.textSearchNoData || 'i18n_no_result';\n {{ constHtmlTextSearchNoData | translate }}\n }\n @if (loading()) {\n \n }\n </div>\n }\n </div>\n @if (loading()) {\n <div class=\"w-full h-full absolute top-0\">\n <libs_ui-components-spinner [size]=\"'medium'\" />\n </div>\n }\n </div>\n}\n", dependencies: [{ kind: "ngmodule", type: VirtualScrollerModule }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: LibsUiComponentsSpinnerComponent, selector: "libs_ui-components-spinner", inputs: ["type", "size"] }, { kind: "directive", type: LibsUiComponentsScrollOverlayDirective, selector: "[LibsUiComponentsScrollOverlayDirective]", inputs: ["debugMode", "ignoreInit", "classContainer", "options", "elementCheckScrollX", "elementCheckScrollY", "elementScroll"], outputs: ["outScroll", "outScrollX", "outScrollY", "outScrollTop", "outScrollBottom"] }, { kind: "pipe", type: LibsUiCheckSelectedByKeyPipe, name: "LibsUiCheckSelectedByKeyPipe" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2048
|
+
}
|
|
2049
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListTagComponent, decorators: [{
|
|
2050
|
+
type: Component,
|
|
2051
|
+
args: [{ selector: 'libs_ui-components-list-templates_tag', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [VirtualScrollerModule, NgTemplateOutlet, TranslateModule, NgClass, LibsUiComponentsSpinnerComponent, LibsUiComponentsScrollOverlayDirective, LibsUiCheckSelectedByKeyPipe], template: "@if (configTemplateTag(); as configTemplateTag) {\n <div\n class=\"w-full h-full relative\"\n LibsUiComponentsScrollOverlayDirective\n (outScrollBottom)=\"handlerScrollBottom()\">\n <div\n class=\"relative max-h-[150px] h-full {{ configTemplateTag.classIncludeContainer }}\"\n [ngClass]=\"{ 'flex flex-wrap': !configTemplateTag.ignoreItemFlexWrap }\"\n [class.min-h-[45px]]=\"!loading() && (!items() || !items().length)\"\n [class.min-h-[94px]]=\"loading() && items()\">\n @for (item of items(); track item()[fieldKey()]) {\n <div\n [class.libs-ui-disable]=\"loading() || disable()\"\n [class.pointer-events-none]=\"loading() || disable()\"\n [class]=\"item().classContainerItem\">\n @if (item().bullet; as bullet) {\n <div\n [class]=\"item().classItem || 'rounded-[10px] px-[8px] py-[1px] mb-[8px] mr-[8px]'\"\n [class.w-max]=\"configTemplateTag?.ignoreItemFlexWrap\"\n [style.background-color]=\"bullet().backgroundColor\"\n [style.color]=\"bullet().color\"\n (click)=\"handlerSelectItem($event, item())\">\n <span [innerHTML]=\"item().fieldLabel\"></span>\n </div>\n } @else {\n @let constHtmlIsSelected = item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: multiKeySelected() : multiKeySelected().length;\n <div\n (click)=\"handlerSelectItem($event, item())\"\n [class]=\"item().classItem || 'rounded-[20px] mb-[8px] mr-[8px] py-[4px] px-[8px] flex items-center cursor-pointer'\"\n [class.bg-[var(--libs-ui-color-light-2)]]=\"constHtmlIsSelected\"\n [class.text-[var(--libs-ui-color-default)]]=\"constHtmlIsSelected\"\n [class.bg-white]=\"!constHtmlIsSelected\"\n [class.text-[#6a7383]]=\"!constHtmlIsSelected\"\n [class.libs-ui-border-general]=\"!constHtmlIsSelected\">\n @if (constHtmlIsSelected) {\n <div class=\"mr-[8px] text-[12px] libs-ui-icon-check before:text-[var(--libs-ui-color-default)]\"></div>\n }\n <span\n class=\"libs-ui-font-h6r break-word\"\n [innerHTML]=\"item().fieldLabel\"></span>\n </div>\n }\n </div>\n }\n @if (!items() || !items().length) {\n <div [class]=\"'libs-ui-font-h5r text-[#9ca2ad] ' + (config()?.textNoDataClassInclude ?? 'py-[4px] flex items-center justify-center w-full')\">\n @if (!keySearch() && !loading()) {\n @let constHtmlTextNoData = config()?.textNoData || 'i18n_have_no_selection';\n {{ constHtmlTextNoData | translate }}\n }\n @if (templateRefSearchNoData() && keySearch() && !loading()) {\n <ng-container *ngTemplateOutlet=\"templateRefSearchNoData() || null; context: { keySearch: keySearch() }\" />\n }\n @if (!templateRefSearchNoData() && keySearch() && !loading()) {\n @let constHtmlTextSearchNoData = config()?.textSearchNoData || 'i18n_no_result';\n {{ constHtmlTextSearchNoData | translate }}\n }\n @if (loading()) {\n \n }\n </div>\n }\n </div>\n @if (loading()) {\n <div class=\"w-full h-full absolute top-0\">\n <libs_ui-components-spinner [size]=\"'medium'\" />\n </div>\n }\n </div>\n}\n" }]
|
|
2052
|
+
}] });
|
|
2053
|
+
|
|
2054
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2055
|
+
class LibsUiComponentsListTextComponent extends LibsUiComponentsListTemplatesComponentAbstract {
|
|
2056
|
+
// #region PROPERTY
|
|
2057
|
+
configTemplateText = signal(undefined);
|
|
2058
|
+
isShowHeightCalculate = computed(() => this.maxItemShow() === -1 ? false : this.heightViewPort() && (!this.config()?.ignoreShowDataWhenNotSearch || (this.config()?.ignoreShowDataWhenNotSearch && this.config()?.ignoreFixHeightShowDataWhenNotSearch)));
|
|
2059
|
+
/* VIEW CHILD */
|
|
2060
|
+
virtualScrollerComponent = viewChild(VirtualScrollerComponent);
|
|
2061
|
+
ngOnInit() {
|
|
2062
|
+
if (isEmpty(this.config()?.configTemplateText?.())) {
|
|
2063
|
+
return;
|
|
2064
|
+
}
|
|
2065
|
+
super.ngOnInit();
|
|
2066
|
+
this.configTemplateText.set(this.config()?.configTemplateText?.());
|
|
2067
|
+
this.fieldKey.set(this.configTemplateText()?.fieldKey ?? this.fieldKeyDefault());
|
|
2068
|
+
this.callApiByService();
|
|
2069
|
+
}
|
|
2070
|
+
/* FUNCTIONS */
|
|
2071
|
+
handlerScrollBottom() {
|
|
2072
|
+
if (this.loadedLastItem()) {
|
|
2073
|
+
this.loading.set(false);
|
|
2074
|
+
this.outLoading.emit(this.loading());
|
|
2075
|
+
return;
|
|
2076
|
+
}
|
|
2077
|
+
if (this.loading()) {
|
|
2078
|
+
return;
|
|
2079
|
+
}
|
|
2080
|
+
this.loading.set(true);
|
|
2081
|
+
this.outLoading.emit(this.loading());
|
|
2082
|
+
this.callApiByService(false);
|
|
2083
|
+
}
|
|
2084
|
+
processSearch() {
|
|
2085
|
+
if (!this.isSearchOnline()) {
|
|
2086
|
+
return this.processData(true);
|
|
2087
|
+
}
|
|
2088
|
+
this.callApiByService(true);
|
|
2089
|
+
}
|
|
2090
|
+
handlerClickRelative(e, item) {
|
|
2091
|
+
e.stopPropagation();
|
|
2092
|
+
if (this.clickExactly()) {
|
|
2093
|
+
return;
|
|
2094
|
+
}
|
|
2095
|
+
this.handlerSelectItem(e, item);
|
|
2096
|
+
}
|
|
2097
|
+
handlerSelectItem(e, item, action, ignoreDisable = false, isClickManual = true) {
|
|
2098
|
+
if (e instanceof Event) {
|
|
2099
|
+
e.stopPropagation();
|
|
2100
|
+
e.preventDefault();
|
|
2101
|
+
}
|
|
2102
|
+
if (item.disable) {
|
|
2103
|
+
return;
|
|
2104
|
+
}
|
|
2105
|
+
if (this.disable() && !ignoreDisable) {
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
if (typeof e === 'string' && e !== 'click') {
|
|
2109
|
+
return;
|
|
2110
|
+
}
|
|
2111
|
+
if (!item || (this.keysDisableItem() && this.keysDisableItem()?.some((key) => key === item[this.fieldKey()]))) {
|
|
2112
|
+
return;
|
|
2113
|
+
}
|
|
2114
|
+
if (action) {
|
|
2115
|
+
action(item.ref);
|
|
2116
|
+
this.items().forEach((item) => {
|
|
2117
|
+
this.buildValueByConfig(item, this.configTemplateText());
|
|
2118
|
+
});
|
|
2119
|
+
return;
|
|
2120
|
+
}
|
|
2121
|
+
if (this.configTemplateText()?.actionSort) {
|
|
2122
|
+
const currentItemSort = this.configTemplateText()?.itemSort?.();
|
|
2123
|
+
const mode = currentItemSort?.fieldSort !== item[this.fieldKey()] ? 'asc' : currentItemSort?.mode === 'desc' ? 'asc' : 'desc';
|
|
2124
|
+
const newSort = {
|
|
2125
|
+
fieldSort: item[this.fieldKey()],
|
|
2126
|
+
mode,
|
|
2127
|
+
modeNumber: mode === 'asc' ? 1 : 2,
|
|
2128
|
+
reset: () => 0,
|
|
2129
|
+
};
|
|
2130
|
+
this.configTemplateText()?.itemSort?.set(newSort);
|
|
2131
|
+
this.outSortSingleSelect.emit(this.configTemplateText()?.itemSort?.() || newSort);
|
|
2132
|
+
}
|
|
2133
|
+
this.keySelected.set(item[this.fieldKey()]);
|
|
2134
|
+
this.outSelectKey.emit({ key: this.keySelected(), item, isClickManual });
|
|
2135
|
+
}
|
|
2136
|
+
handlerSort(itemSort) {
|
|
2137
|
+
itemSort.reset = () => 0;
|
|
2138
|
+
this.configTemplateText()?.itemSort?.set(itemSort);
|
|
2139
|
+
this.outSortSingleSelect.emit(this.configTemplateText()?.itemSort?.() || itemSort);
|
|
2140
|
+
}
|
|
2141
|
+
processData(replace) {
|
|
2142
|
+
const itemByKeySearch = [];
|
|
2143
|
+
const keysHidden = this.keysHiddenItem() || [];
|
|
2144
|
+
if (replace) {
|
|
2145
|
+
this.items.set([]);
|
|
2146
|
+
}
|
|
2147
|
+
this.store().forEach((item) => {
|
|
2148
|
+
const dataStore = cloneDeep(item);
|
|
2149
|
+
const key = keysHidden.find((key) => dataStore()[this.fieldKey()] === key);
|
|
2150
|
+
dataStore.update((store) => {
|
|
2151
|
+
return { ...store, ref: item() };
|
|
2152
|
+
});
|
|
2153
|
+
if (key === undefined) {
|
|
2154
|
+
const text = deleteUnicode(this.buildValueByConfig(dataStore, this.configTemplateText())).toLocaleLowerCase();
|
|
2155
|
+
const textEscape = escapeHtml(text);
|
|
2156
|
+
const keySearch = deleteUnicode(escapeHtml(this.keySearch().toLocaleLowerCase()));
|
|
2157
|
+
if (((this.isSearchOnline() && this.config()?.httpRequestData?.()?.serviceClass && !this.config()?.httpRequestData?.()?.objectInstance) || (text && (text.includes(keySearch) || textEscape.includes(keySearch)))) &&
|
|
2158
|
+
(replace || (!replace && !this.items().find((dataItem) => dataItem()[this.fieldKey()] === dataStore()[this.fieldKey()]))) &&
|
|
2159
|
+
!itemByKeySearch.find((dataItem) => dataItem()[this.fieldKey()] === dataStore()[this.fieldKey()])) {
|
|
2160
|
+
dataStore.update((store) => {
|
|
2161
|
+
return {
|
|
2162
|
+
...store,
|
|
2163
|
+
hrefButton: this.configTemplateText()?.getHrefButton?.(store),
|
|
2164
|
+
classItem: item().classItem || this.configTemplateText()?.getClassItem?.(store),
|
|
2165
|
+
classInclude: store.classInclude || this.configTemplateText()?.getClassIncludePopover?.(store),
|
|
2166
|
+
buttonLeftConfig: this.configTemplateText()?.getConfigButtonLeft?.(store),
|
|
2167
|
+
classIconLeft: store.classIconLeft || this.configTemplateText()?.getClassIconLeft?.(store),
|
|
2168
|
+
hoverDanger: store.hoverDanger || this.configTemplateText()?.getConfigHoverDanger?.(store),
|
|
2169
|
+
avatarConfig: this.configTemplateText()?.getAvatarConfig?.(store),
|
|
2170
|
+
itemAlignStart: store.itemAlignStart || this.configTemplateText()?.getConfigAlignStart?.(store),
|
|
2171
|
+
};
|
|
2172
|
+
});
|
|
2173
|
+
itemByKeySearch.push(dataStore);
|
|
2174
|
+
}
|
|
2175
|
+
return;
|
|
2176
|
+
}
|
|
2177
|
+
const indexItemRemove = this.items().findIndex((item) => item()[this.fieldKey()] === key);
|
|
2178
|
+
if (indexItemRemove > -1) {
|
|
2179
|
+
this.items.update((items) => {
|
|
2180
|
+
items.splice(indexItemRemove, 1);
|
|
2181
|
+
return items;
|
|
2182
|
+
});
|
|
2183
|
+
}
|
|
2184
|
+
});
|
|
2185
|
+
const callbackCheckScroll = (preStateHasScroll, currentHasScroll) => {
|
|
2186
|
+
this.scrollToItemSelected();
|
|
2187
|
+
if (this.keysHiddenItem()?.length && preStateHasScroll && !currentHasScroll && this.isSearchOnline()) {
|
|
2188
|
+
this.callApiByService(false);
|
|
2189
|
+
}
|
|
2190
|
+
};
|
|
2191
|
+
if (replace) {
|
|
2192
|
+
const items = convertObjectToSignal(itemByKeySearch)();
|
|
2193
|
+
this.items.set(items);
|
|
2194
|
+
this.config()?.sort?.(this.items());
|
|
2195
|
+
this.emitKeySelectedDefaultIfExistItem(this.items());
|
|
2196
|
+
this.autoSelectFirstItem(this.items());
|
|
2197
|
+
this.setHeightViewPort();
|
|
2198
|
+
this.loading.set(false);
|
|
2199
|
+
this.checkViewPortScroll(callbackCheckScroll);
|
|
2200
|
+
this.outLoading.emit(this.loading());
|
|
2201
|
+
this.outLoadItemsComplete.emit({ items: this.items(), paging: this.pagingStore() });
|
|
2202
|
+
return;
|
|
2203
|
+
}
|
|
2204
|
+
const itemsBySearch = convertObjectToSignal(itemByKeySearch)();
|
|
2205
|
+
this.items.update((items) => [...items, ...itemsBySearch]);
|
|
2206
|
+
this.config()?.sort?.(this.items());
|
|
2207
|
+
this.setHeightViewPort();
|
|
2208
|
+
this.loading.set(false);
|
|
2209
|
+
this.checkViewPortScroll(callbackCheckScroll);
|
|
2210
|
+
this.outLoading.emit(this.loading());
|
|
2211
|
+
this.outLoadItemsComplete.emit({ items: this.items(), paging: this.pagingStore() });
|
|
2212
|
+
}
|
|
2213
|
+
scrollToItemSelected() {
|
|
2214
|
+
if (!this.configTemplateText()?.autoScrollToItemSelected) {
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2217
|
+
clearTimeout(this.timeAutoScrollItemSelected());
|
|
2218
|
+
this.timeAutoScrollItemSelected.set(setTimeout(() => {
|
|
2219
|
+
if (!this.keySelected()) {
|
|
2220
|
+
return;
|
|
2221
|
+
}
|
|
2222
|
+
const index = this.items().findIndex((item) => item()[this.fieldKey()] === this.keySelected());
|
|
2223
|
+
if (index !== -1) {
|
|
2224
|
+
const offsetContainer = this.elementScroll()?.nativeElement?.offsetHeight;
|
|
2225
|
+
const additionalOffset = ((offsetContainer ? offsetContainer - this.heightItem() : 0) / 2) * -1;
|
|
2226
|
+
this.virtualScrollerComponent()?.scrollToIndex(index, true, additionalOffset, this.timeAnimationScrollToIndexItem());
|
|
2227
|
+
}
|
|
2228
|
+
}));
|
|
2229
|
+
}
|
|
2230
|
+
autoSelectFirstItem(items) {
|
|
2231
|
+
if (this.autoSelectedFirstItemCallOutsideBefore() || this.keySelected() || !this.config()?.autoSelectFirstItem || !items || !items.length) {
|
|
2232
|
+
return;
|
|
2233
|
+
}
|
|
2234
|
+
this.handlerSelectItem('click', items[0](), undefined, true, false);
|
|
2235
|
+
}
|
|
2236
|
+
emitKeySelectedDefaultIfExistItem(items) {
|
|
2237
|
+
const item = items.find((store) => store()[this.fieldKey()] === this.keySelected());
|
|
2238
|
+
if (item) {
|
|
2239
|
+
this.handlerSelectItem('click', item(), undefined, true, false);
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
getLengthItem() {
|
|
2243
|
+
return this.items().length;
|
|
2244
|
+
}
|
|
2245
|
+
handlerImageError(event, item) {
|
|
2246
|
+
event.stopPropagation();
|
|
2247
|
+
item.specific_loadImgError = true;
|
|
2248
|
+
}
|
|
2249
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2250
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", 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\n #elementScroll\n [style.height]=\"isShowHeightCalculate() ? heightViewPort() + 'px' : '100%'\"\n class=\"w-full\"\n [class.h-full]=\"!isShowHeightCalculate()\"\n LibsUiComponentsScrollOverlayDirective\n (outScrollBottom)=\"handlerScrollBottom()\">\n @if (!configTemplateText.notUseVirtualScroll) {\n <virtual-scroller\n #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 @let constHtmlTextNoData = config()?.textNoData || 'i18n_have_no_selection';\n {{ constHtmlTextNoData | translate }}\n }\n @if (templateRefSearchNoData() && keySearch() && !loading()) {\n <ng-container *ngTemplateOutlet=\"templateRefSearchNoData() || null; context: { keySearch: keySearch() }\" />\n }\n @if (!templateRefSearchNoData() && keySearch() && !loading()) {\n @let constHtmlTextSearchNoData = config()?.textSearchNoData || 'i18n_no_result';\n {{ constHtmlTextSearchNoData | 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\n #listRef\n let-itemsView=\"itemsView\">\n @for (item of itemsView; track item()[fieldKey()]) {\n <div\n #itemRef\n [class]=\"item().classItemWrapper || ''\">\n <div\n LibsUiComponentsListHighlightKeySearchDirective\n [isHighlight]=\"config()?.highlightTextSearchInResult\"\n [keySearch]=\"keySearch()\"\n [class]=\"'libs-ui-list-template-text-item libs-ui-font-h5r 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-active]=\"!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 | LibsUiPipesConvertObjectToSignalPipe)?.(); as bullet) {\n <span\n class=\"libs-ui-list-template-text-item-bullet flex flex-shrink-0\"\n [style.backgroundColor]=\"bullet.backgroundColor\"\n (click)=\"handlerSelectItem($event, item())\"></span>\n }\n @if ((item().avatarConfig | LibsUiPipesConvertObjectToSignalPipe)?.(); as avatarConfig) {\n <libs_ui-components-avatar\n [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 [getLastTextAfterSpace]=\"avatarConfig.getLastTextAfterSpace\"\n [textAvatar]=\"avatarConfig.textAvatar\" />\n }\n @if (configTemplateText.getImage || configTemplateText.fieldGetImage) {\n <img\n [src]=\"\n configTemplateText.getImage\n ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: (item().specific_loadImgError && configTemplateText.getImageError ? configTemplateText.getImageError : configTemplateText.getImage) : item() | async)\n : item()[configTemplateText.fieldGetImage || '']\n \"\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 | LibsUiPipesConvertObjectToSignalPipe)?.(); as buttonLeft) {\n @if (item().hrefButton) {\n <a\n [class.w-full]=\"!buttonLeft.ignoreWidth100\"\n [href]=\"item().hrefButton\">\n <ng-container *ngTemplateOutlet=\"buttonLeftTemplate\" />\n </a>\n }\n @if (!item().hrefButton) {\n <div [class.w-full]=\"!buttonLeft.ignoreWidth100\">\n <ng-container *ngTemplateOutlet=\"buttonLeftTemplate\" />\n </div>\n }\n <ng-template #buttonLeftTemplate>\n <libs_ui-components-buttons-button\n class=\"w-full\"\n [type]=\"buttonLeft.type ?? 'button-link-primary'\"\n [label]=\"buttonLeft.label ?? ' '\"\n [zIndex]=\"buttonLeft.zIndex\"\n [disable]=\"buttonLeft.disable ?? false\"\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 | LibsUiPipesConvertSignalToObjectPipe\"\n [styleButton]=\"buttonLeft.styleButton | LibsUiPipesConvertSignalToObjectPipe\"\n (outClick)=\"handlerSelectItem($event, item())\" />\n </ng-template>\n }\n @if ((item().switchConfig | LibsUiPipesConvertObjectToSignalPipe)?.(); as switchConfig) {\n <libs_ui-components-switch\n [active]=\"switchConfig.active\"\n (outSwitch)=\"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 @if (((item().popoverLabel | LibsUiPipesConvertObjectToSignalPipe)?.() | LibsUiPipesConvertSignalToObjectPipe) ?? { type: 'text' }; as popoverLabel) {\n <libs_ui-components-popover\n [type]=\"popoverLabel.type || 'text'\"\n [elementRefCustom]=\"popoverLabel.type === 'text' ? undefined : itemRef\"\n [ignoreShowPopover]=\"popoverLabel.ignoreShowPopover\"\n [config]=\"popoverLabel.config ?? configTemplateText.configLabelPopover?.() ?? {}\"\n [innerHtml]=\"item().fieldLabel\"\n [classInclude]=\"item().classInclude\"\n (outEvent)=\"handlerSelectItem($event, item())\" />\n }\n }\n @if ((item().fieldPopover | LibsUiPipesConvertObjectToSignalPipe)?.(); as popover) {\n <libs_ui-components-popover\n class=\"{{ popover.classInclude }}\"\n [config]=\"popover.config\">\n @if (popover.dataView) {\n <div [innerHtml]=\"popover.dataView | translate\"></div>\n } @else {\n <i class=\"libs-ui-icon-tooltip-outline\"></i>\n }\n </libs_ui-components-popover>\n }\n @if (configTemplateText?.rows) {\n <libs_ui-components-list-templates_rows\n class=\"w-full {{ configTemplateText.classRowsWrapper || configTemplateText.classRows || '' }}\"\n [item]=\"item()\"\n [fieldKey]=\"fieldKey()\"\n [keySelected]=\"keySelected()\"\n [configTemplate]=\"configTemplateText\"\n [zIndex]=\"zIndex()\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outEvent)=\"handlerSelectItem($event.event, $event.item, $event.action)\" />\n }\n @if (configTemplateText.getComponentOutlet) {\n <ng-container\n *ngComponentOutlet=\"\n item() | LibsUiPipesGetValueOfObjectPipe: fieldKey() : undefined : true | LibsUiPipesCallFunctionInTemplatePipe: configTemplateText.getComponentOutlet : item() | async;\n inputs: undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateText.getDataComponentOutlet : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\n \" />\n }\n\n @if ((keySelected() === item()[fieldKey()] || (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: multiKeySelected() : multiKeySelected().length)) && !configTemplateText.ignoreIconSelected && !configTemplateText.actionSort) {\n <i [class]=\"'libs-ui-icon-check ' + (configTemplateText.classIncludeIconSelected || 'right-[12px]')\"></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\n [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;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$1.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: i1.TranslatePipe, name: "translate" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { 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", "classImageInclude", "zIndexPreviewImage", "clickPreviewImage", "idGenColor", "getLastTextAfterSpace", "textAvatar", "textAvatarClassInclude", "containertextAvatarClassInclude"], outputs: ["outAvatarError", "outEventPreviewImage"] }, { 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", "isHandlerEnterDocumentClickButton"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "initEventInElementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }, { kind: "directive", type: LibsUiComponentsScrollOverlayDirective, selector: "[LibsUiComponentsScrollOverlayDirective]", inputs: ["debugMode", "ignoreInit", "classContainer", "options", "elementCheckScrollX", "elementCheckScrollY", "elementScroll"], 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: "directive", type: LibsUiComponentsListHighlightKeySearchDirective, selector: "[LibsUiComponentsListHighlightKeySearchDirective]", inputs: ["isHighlight", "keySearch", "classHighlight"] }, { kind: "component", type: LibsUiComponentsListRowsComponent, selector: "libs_ui-components-list-templates_rows", inputs: ["configTemplate", "item", "keySelected", "fieldKey", "zIndex"], outputs: ["outChangStageFlagMousePopover", "outEvent"] }, { kind: "pipe", type: LibsUiPipesCallFunctionInTemplatePipe, name: "LibsUiPipesCallFunctionInTemplatePipe" }, { kind: "pipe", type: LibsUiPipesGetValueOfObjectPipe, name: "LibsUiPipesGetValueOfObjectPipe" }, { kind: "pipe", type: LibsUiPipesConvertObjectToSignalPipe, name: "LibsUiPipesConvertObjectToSignalPipe" }, { kind: "pipe", type: LibsUiPipesConvertSignalToObjectPipe, name: "LibsUiPipesConvertSignalToObjectPipe" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2251
|
+
}
|
|
2252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListTextComponent, decorators: [{
|
|
2253
|
+
type: Component,
|
|
2254
|
+
args: [{ selector: 'libs_ui-components-list-templates_text', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
2255
|
+
VirtualScrollerModule,
|
|
2256
|
+
NgTemplateOutlet,
|
|
2257
|
+
TranslateModule,
|
|
2258
|
+
NgClass,
|
|
2259
|
+
AsyncPipe,
|
|
2260
|
+
NgComponentOutlet,
|
|
2261
|
+
LibsUiComponentsSpinnerComponent,
|
|
2262
|
+
LibsUiComponentsAvatarComponent,
|
|
2263
|
+
LibsUiComponentsButtonsButtonComponent,
|
|
2264
|
+
LibsUiComponentsPopoverComponent,
|
|
2265
|
+
LibsUiComponentsScrollOverlayDirective,
|
|
2266
|
+
LibsUiCheckSelectedByKeyPipe,
|
|
2267
|
+
LibsUiComponentsSwitchComponent,
|
|
2268
|
+
LibsUiComponentsButtonsSortArrowComponent,
|
|
2269
|
+
LibsUiComponentsListHighlightKeySearchDirective,
|
|
2270
|
+
LibsUiComponentsListRowsComponent,
|
|
2271
|
+
LibsUiPipesCallFunctionInTemplatePipe,
|
|
2272
|
+
LibsUiPipesGetValueOfObjectPipe,
|
|
2273
|
+
LibsUiPipesConvertObjectToSignalPipe,
|
|
2274
|
+
LibsUiPipesConvertSignalToObjectPipe,
|
|
2275
|
+
], template: "@if (configTemplateText(); as configTemplateText) {\n <div class=\"relative h-full w-full\">\n @if (items() && items().length) {\n <div\n #elementScroll\n [style.height]=\"isShowHeightCalculate() ? heightViewPort() + 'px' : '100%'\"\n class=\"w-full\"\n [class.h-full]=\"!isShowHeightCalculate()\"\n LibsUiComponentsScrollOverlayDirective\n (outScrollBottom)=\"handlerScrollBottom()\">\n @if (!configTemplateText.notUseVirtualScroll) {\n <virtual-scroller\n #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 @let constHtmlTextNoData = config()?.textNoData || 'i18n_have_no_selection';\n {{ constHtmlTextNoData | translate }}\n }\n @if (templateRefSearchNoData() && keySearch() && !loading()) {\n <ng-container *ngTemplateOutlet=\"templateRefSearchNoData() || null; context: { keySearch: keySearch() }\" />\n }\n @if (!templateRefSearchNoData() && keySearch() && !loading()) {\n @let constHtmlTextSearchNoData = config()?.textSearchNoData || 'i18n_no_result';\n {{ constHtmlTextSearchNoData | 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\n #listRef\n let-itemsView=\"itemsView\">\n @for (item of itemsView; track item()[fieldKey()]) {\n <div\n #itemRef\n [class]=\"item().classItemWrapper || ''\">\n <div\n LibsUiComponentsListHighlightKeySearchDirective\n [isHighlight]=\"config()?.highlightTextSearchInResult\"\n [keySearch]=\"keySearch()\"\n [class]=\"'libs-ui-list-template-text-item libs-ui-font-h5r 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-active]=\"!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 | LibsUiPipesConvertObjectToSignalPipe)?.(); as bullet) {\n <span\n class=\"libs-ui-list-template-text-item-bullet flex flex-shrink-0\"\n [style.backgroundColor]=\"bullet.backgroundColor\"\n (click)=\"handlerSelectItem($event, item())\"></span>\n }\n @if ((item().avatarConfig | LibsUiPipesConvertObjectToSignalPipe)?.(); as avatarConfig) {\n <libs_ui-components-avatar\n [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 [getLastTextAfterSpace]=\"avatarConfig.getLastTextAfterSpace\"\n [textAvatar]=\"avatarConfig.textAvatar\" />\n }\n @if (configTemplateText.getImage || configTemplateText.fieldGetImage) {\n <img\n [src]=\"\n configTemplateText.getImage\n ? ('avatar' | LibsUiPipesCallFunctionInTemplatePipe: (item().specific_loadImgError && configTemplateText.getImageError ? configTemplateText.getImageError : configTemplateText.getImage) : item() | async)\n : item()[configTemplateText.fieldGetImage || '']\n \"\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 | LibsUiPipesConvertObjectToSignalPipe)?.(); as buttonLeft) {\n @if (item().hrefButton) {\n <a\n [class.w-full]=\"!buttonLeft.ignoreWidth100\"\n [href]=\"item().hrefButton\">\n <ng-container *ngTemplateOutlet=\"buttonLeftTemplate\" />\n </a>\n }\n @if (!item().hrefButton) {\n <div [class.w-full]=\"!buttonLeft.ignoreWidth100\">\n <ng-container *ngTemplateOutlet=\"buttonLeftTemplate\" />\n </div>\n }\n <ng-template #buttonLeftTemplate>\n <libs_ui-components-buttons-button\n class=\"w-full\"\n [type]=\"buttonLeft.type ?? 'button-link-primary'\"\n [label]=\"buttonLeft.label ?? ' '\"\n [zIndex]=\"buttonLeft.zIndex\"\n [disable]=\"buttonLeft.disable ?? false\"\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 | LibsUiPipesConvertSignalToObjectPipe\"\n [styleButton]=\"buttonLeft.styleButton | LibsUiPipesConvertSignalToObjectPipe\"\n (outClick)=\"handlerSelectItem($event, item())\" />\n </ng-template>\n }\n @if ((item().switchConfig | LibsUiPipesConvertObjectToSignalPipe)?.(); as switchConfig) {\n <libs_ui-components-switch\n [active]=\"switchConfig.active\"\n (outSwitch)=\"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 @if (((item().popoverLabel | LibsUiPipesConvertObjectToSignalPipe)?.() | LibsUiPipesConvertSignalToObjectPipe) ?? { type: 'text' }; as popoverLabel) {\n <libs_ui-components-popover\n [type]=\"popoverLabel.type || 'text'\"\n [elementRefCustom]=\"popoverLabel.type === 'text' ? undefined : itemRef\"\n [ignoreShowPopover]=\"popoverLabel.ignoreShowPopover\"\n [config]=\"popoverLabel.config ?? configTemplateText.configLabelPopover?.() ?? {}\"\n [innerHtml]=\"item().fieldLabel\"\n [classInclude]=\"item().classInclude\"\n (outEvent)=\"handlerSelectItem($event, item())\" />\n }\n }\n @if ((item().fieldPopover | LibsUiPipesConvertObjectToSignalPipe)?.(); as popover) {\n <libs_ui-components-popover\n class=\"{{ popover.classInclude }}\"\n [config]=\"popover.config\">\n @if (popover.dataView) {\n <div [innerHtml]=\"popover.dataView | translate\"></div>\n } @else {\n <i class=\"libs-ui-icon-tooltip-outline\"></i>\n }\n </libs_ui-components-popover>\n }\n @if (configTemplateText?.rows) {\n <libs_ui-components-list-templates_rows\n class=\"w-full {{ configTemplateText.classRowsWrapper || configTemplateText.classRows || '' }}\"\n [item]=\"item()\"\n [fieldKey]=\"fieldKey()\"\n [keySelected]=\"keySelected()\"\n [configTemplate]=\"configTemplateText\"\n [zIndex]=\"zIndex()\"\n (outChangStageFlagMousePopover)=\"handlerChangStageFlagMouse($event)\"\n (outEvent)=\"handlerSelectItem($event.event, $event.item, $event.action)\" />\n }\n @if (configTemplateText.getComponentOutlet) {\n <ng-container\n *ngComponentOutlet=\"\n item() | LibsUiPipesGetValueOfObjectPipe: fieldKey() : undefined : true | LibsUiPipesCallFunctionInTemplatePipe: configTemplateText.getComponentOutlet : item() | async;\n inputs: undefined | LibsUiPipesCallFunctionInTemplatePipe: configTemplateText.getDataComponentOutlet : item() : fieldKey() : { valueIsEmpty: { item: item() } } | async\n \" />\n }\n\n @if ((keySelected() === item()[fieldKey()] || (item()[fieldKey()] | LibsUiCheckSelectedByKeyPipe: multiKeySelected() : multiKeySelected().length)) && !configTemplateText.ignoreIconSelected && !configTemplateText.actionSort) {\n <i [class]=\"'libs-ui-icon-check ' + (configTemplateText.classIncludeIconSelected || 'right-[12px]')\"></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\n [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;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"] }]
|
|
2276
|
+
}] });
|
|
2277
|
+
|
|
2278
|
+
const getComponentByType = (typeTemplate) => {
|
|
2279
|
+
switch (typeTemplate) {
|
|
2280
|
+
case 'checkbox':
|
|
2281
|
+
return LibsUiComponentsListCheckboxComponent;
|
|
2282
|
+
case 'group':
|
|
2283
|
+
return LibsUiComponentsListGroupComponent;
|
|
2284
|
+
case 'radio':
|
|
2285
|
+
return LibsUiComponentsListRadioComponent;
|
|
2286
|
+
case 'text':
|
|
2287
|
+
return LibsUiComponentsListTextComponent;
|
|
2288
|
+
case 'tag':
|
|
2289
|
+
return LibsUiComponentsListTagComponent;
|
|
2290
|
+
}
|
|
2291
|
+
};
|
|
2292
|
+
const getFieldKeyByType = (config, fieldKeyDefault) => {
|
|
2293
|
+
if (!config) {
|
|
2294
|
+
return fieldKeyDefault;
|
|
2295
|
+
}
|
|
2296
|
+
switch (config.type) {
|
|
2297
|
+
case 'checkbox':
|
|
2298
|
+
return config.configTemplateCheckbox?.()?.fieldKey || fieldKeyDefault;
|
|
2299
|
+
case 'group':
|
|
2300
|
+
return config.configTemplateGroup?.()?.fieldKey || fieldKeyDefault;
|
|
2301
|
+
case 'radio':
|
|
2302
|
+
return config.configTemplateRadio?.()?.fieldKey || fieldKeyDefault;
|
|
2303
|
+
case 'text':
|
|
2304
|
+
return config.configTemplateText?.()?.fieldKey || fieldKeyDefault;
|
|
2305
|
+
case 'tag':
|
|
2306
|
+
return config.configTemplateTag?.()?.fieldKey || fieldKeyDefault;
|
|
2307
|
+
}
|
|
2308
|
+
};
|
|
2309
|
+
const initConfig = (config) => {
|
|
2310
|
+
if (!config) {
|
|
2311
|
+
return;
|
|
2312
|
+
}
|
|
2313
|
+
const defaultConfig = {
|
|
2314
|
+
fieldKey: 'id',
|
|
2315
|
+
getValue: (item) => {
|
|
2316
|
+
if (!item) {
|
|
2317
|
+
return ' ';
|
|
2318
|
+
}
|
|
2319
|
+
return item.label || item.name || ' ';
|
|
2320
|
+
},
|
|
2321
|
+
};
|
|
2322
|
+
switch (config.type) {
|
|
2323
|
+
case 'checkbox':
|
|
2324
|
+
if (!config.configTemplateCheckbox?.()) {
|
|
2325
|
+
config.configTemplateCheckbox?.set(defaultConfig);
|
|
2326
|
+
}
|
|
2327
|
+
break;
|
|
2328
|
+
case 'group':
|
|
2329
|
+
break;
|
|
2330
|
+
case 'radio':
|
|
2331
|
+
if (!config.configTemplateRadio?.()) {
|
|
2332
|
+
config.configTemplateRadio?.set(defaultConfig);
|
|
2333
|
+
}
|
|
2334
|
+
break;
|
|
2335
|
+
case 'text':
|
|
2336
|
+
if (!config.configTemplateText?.()) {
|
|
2337
|
+
config.configTemplateText?.set(defaultConfig);
|
|
2338
|
+
}
|
|
2339
|
+
break;
|
|
2340
|
+
}
|
|
2341
|
+
};
|
|
2342
|
+
|
|
2343
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2344
|
+
class LibsUiComponentsListComponent {
|
|
2345
|
+
// #region PROPERTY
|
|
2346
|
+
ERROR_MESSAGE_EMPTY_VALID = ERROR_MESSAGE_EMPTY_VALID;
|
|
2347
|
+
disableButtonUnSelectOption = signal(true);
|
|
2348
|
+
isErrorRequired = signal(false);
|
|
2349
|
+
loading = signal(false);
|
|
2350
|
+
keySearchStore = signal(undefined);
|
|
2351
|
+
onDestroy = new Subject();
|
|
2352
|
+
onSearch = new Subject();
|
|
2353
|
+
onRefresh = new Subject();
|
|
2354
|
+
onSetHiddenItemByKey = new Subject();
|
|
2355
|
+
onUpdateMultiKeySelectedGroup = new Subject();
|
|
2356
|
+
onRemoveItems = new Subject();
|
|
2357
|
+
onUpdateData = new Subject();
|
|
2358
|
+
cleanUpEffect;
|
|
2359
|
+
componentRef;
|
|
2360
|
+
configData = signal({
|
|
2361
|
+
type: 'text',
|
|
2362
|
+
configTemplateText: signal({
|
|
2363
|
+
fieldKey: 'id',
|
|
2364
|
+
getValue: (item) => {
|
|
2365
|
+
return item.label || item.name;
|
|
2366
|
+
},
|
|
2367
|
+
}),
|
|
2368
|
+
});
|
|
2369
|
+
groupMultiKeySelected = signal([]);
|
|
2370
|
+
functionControlInputSearch = signal(undefined);
|
|
2371
|
+
// #region INPUT
|
|
2372
|
+
hiddenInputSearch = input(false, { transform: (value) => value ?? false });
|
|
2373
|
+
dropdownTabKeyActive = input();
|
|
2374
|
+
keySearch = input();
|
|
2375
|
+
paddingLeftItem = input();
|
|
2376
|
+
config = input(this.configData(), { transform: (value) => value ?? this.configData() });
|
|
2377
|
+
autoSelectedFirstItemCallOutsideBefore = input(false);
|
|
2378
|
+
isSearchOnline = input();
|
|
2379
|
+
disable = input();
|
|
2380
|
+
disableLabel = input();
|
|
2381
|
+
labelConfig = input();
|
|
2382
|
+
searchConfig = input({}, { transform: (value) => value || {} });
|
|
2383
|
+
searchPadding = input();
|
|
2384
|
+
dividerClassInclude = input();
|
|
2385
|
+
hasDivider = input(true);
|
|
2386
|
+
buttonsOther = input(undefined);
|
|
2387
|
+
hasButtonUnSelectOption = input();
|
|
2388
|
+
clickExactly = input();
|
|
2389
|
+
backgroundListCustom = input('bg-[#ffffff]', { transform: (value) => value ?? 'bg-[#ffffff]' });
|
|
2390
|
+
maxItemShow = input();
|
|
2391
|
+
keySelected = input();
|
|
2392
|
+
multiKeySelected = input(undefined); // lưu ý khi sử dụng listview
|
|
2393
|
+
keysDisableItem = input(undefined); // không dùng giá trị này kết hợp với template checkbox có config chứa configCheckboxCheckAll
|
|
2394
|
+
keysHiddenItem = input(undefined); // không dùng giá trị này kết hợp với template checkbox có config chứa configCheckboxCheckAll
|
|
2395
|
+
focusInputSearch = input();
|
|
2396
|
+
skipFocusInputWhenKeySearchStoreUndefined = input();
|
|
2397
|
+
functionGetItemsAutoAddList = input(undefined);
|
|
2398
|
+
validRequired = input(undefined);
|
|
2399
|
+
showValidateBottom = input();
|
|
2400
|
+
zIndex = input();
|
|
2401
|
+
loadingIconSize = input(undefined);
|
|
2402
|
+
templateRefSearchNoData = input(undefined);
|
|
2403
|
+
resetKeyWhenSelectAllKeyDropdown = input();
|
|
2404
|
+
ignoreClassDisableDefaultWhenUseKeysDisableItem = input(); // bỏ chế độ disable item trên html để disable từng phần trong rows
|
|
2405
|
+
// #region OUTPUT
|
|
2406
|
+
outSelectKey = output(); // sử dụng cho type chọn 1
|
|
2407
|
+
outSelectMultiKey = output(); // sử dụng cho type cho phép chọn nhiều.
|
|
2408
|
+
outUnSelectMultiKey = output(); // sử dụng cho type cho phép chọn nhiều.
|
|
2409
|
+
outClickButtonOther = output();
|
|
2410
|
+
outFieldKey = output();
|
|
2411
|
+
outChangeView = output();
|
|
2412
|
+
outKeySearch = output();
|
|
2413
|
+
outLoading = output();
|
|
2414
|
+
outFunctionsControl = output();
|
|
2415
|
+
outChangStageFlagMousePopover = output();
|
|
2416
|
+
outLoadItemsComplete = output();
|
|
2417
|
+
/* VIEW CHILD */
|
|
2418
|
+
listViewElementRef = viewChild('listViewContainer');
|
|
2419
|
+
contentElementRef = viewChild('contentContainer');
|
|
2420
|
+
// #region INJECT
|
|
2421
|
+
dynamicComponentService = inject(LibsUiDynamicComponentService);
|
|
2422
|
+
constructor() {
|
|
2423
|
+
this.cleanUpEffect = effect(() => {
|
|
2424
|
+
const value = this.keySearch();
|
|
2425
|
+
untracked(() => {
|
|
2426
|
+
if (this.keySearchStore() === this.keySearch()) {
|
|
2427
|
+
return;
|
|
2428
|
+
}
|
|
2429
|
+
this.keySearchStore.set(value);
|
|
2430
|
+
this.onSearch.next(value);
|
|
2431
|
+
});
|
|
2432
|
+
});
|
|
2433
|
+
effect(() => {
|
|
2434
|
+
const keysDisableItem = this.keysDisableItem();
|
|
2435
|
+
untracked(() => {
|
|
2436
|
+
if (!isNil(keysDisableItem)) {
|
|
2437
|
+
this.componentRef?.setInput('keysDisableItem', keysDisableItem);
|
|
2438
|
+
}
|
|
2439
|
+
});
|
|
2440
|
+
});
|
|
2441
|
+
effect(() => {
|
|
2442
|
+
const keysHiddenItem = this.keysHiddenItem();
|
|
2443
|
+
untracked(() => {
|
|
2444
|
+
if (!isNil(keysHiddenItem)) {
|
|
2445
|
+
this.componentRef?.setInput('keysHiddenItem', keysHiddenItem);
|
|
2446
|
+
this.onSetHiddenItemByKey.next(keysHiddenItem);
|
|
2447
|
+
}
|
|
2448
|
+
});
|
|
2449
|
+
});
|
|
2450
|
+
effect(() => {
|
|
2451
|
+
const disable = this.disable();
|
|
2452
|
+
untracked(() => {
|
|
2453
|
+
if (!isNil(disable)) {
|
|
2454
|
+
this.componentRef?.setInput('disable', disable);
|
|
2455
|
+
}
|
|
2456
|
+
});
|
|
2457
|
+
});
|
|
2458
|
+
effect(() => {
|
|
2459
|
+
const keySelected = this.keySelected();
|
|
2460
|
+
untracked(() => {
|
|
2461
|
+
if (!isNil(keySelected)) {
|
|
2462
|
+
this.componentRef?.setInput('keySelected', keySelected);
|
|
2463
|
+
}
|
|
2464
|
+
});
|
|
2465
|
+
});
|
|
2466
|
+
let oldMultiKeySelected = this.multiKeySelected();
|
|
2467
|
+
effect(() => {
|
|
2468
|
+
const multiKeySelected = this.multiKeySelected();
|
|
2469
|
+
if (isEqual(oldMultiKeySelected, multiKeySelected)) {
|
|
2470
|
+
return;
|
|
2471
|
+
}
|
|
2472
|
+
oldMultiKeySelected = multiKeySelected;
|
|
2473
|
+
untracked(() => {
|
|
2474
|
+
if (!isNil(multiKeySelected)) {
|
|
2475
|
+
this.componentRef?.setInput('multiKeySelected', multiKeySelected);
|
|
2476
|
+
if (this.configData()?.type === 'group') {
|
|
2477
|
+
this.onUpdateMultiKeySelectedGroup.next();
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
});
|
|
2481
|
+
});
|
|
2482
|
+
effect(() => {
|
|
2483
|
+
if (!this.dropdownTabKeyActive()) {
|
|
2484
|
+
return;
|
|
2485
|
+
}
|
|
2486
|
+
this.refresh();
|
|
2487
|
+
});
|
|
2488
|
+
}
|
|
2489
|
+
ngOnInit() {
|
|
2490
|
+
this.outFunctionsControl.emit(this.FunctionsControl);
|
|
2491
|
+
if (this.keySearch()) {
|
|
2492
|
+
this.keySearchStore.set(this.keySearch());
|
|
2493
|
+
}
|
|
2494
|
+
const config = this.config();
|
|
2495
|
+
if (config) {
|
|
2496
|
+
this.configData.set(this.cloneConfig(config));
|
|
2497
|
+
}
|
|
2498
|
+
initConfig(this.configData());
|
|
2499
|
+
const compClass = getComponentByType(this.configData().type);
|
|
2500
|
+
this.componentRef = this.dynamicComponentService.resolveComponentFactory(compClass);
|
|
2501
|
+
timer(0)
|
|
2502
|
+
.pipe(takeUntil$1(this.onDestroy))
|
|
2503
|
+
.subscribe(() => {
|
|
2504
|
+
this.dynamicComponentService.addToElement(this.componentRef, this.contentElementRef()?.nativeElement);
|
|
2505
|
+
});
|
|
2506
|
+
this.componentRef.setInput('onSetHiddenItemByKey', this.onSetHiddenItemByKey);
|
|
2507
|
+
this.componentRef.setInput('config', this.configData());
|
|
2508
|
+
if (this.searchConfig()) {
|
|
2509
|
+
this.componentRef.setInput('searchConfig', this.searchConfig());
|
|
2510
|
+
}
|
|
2511
|
+
this.componentRef.setInput('onSearch', this.onSearch);
|
|
2512
|
+
this.componentRef.setInput('onRefresh', this.onRefresh);
|
|
2513
|
+
this.componentRef.setInput('onUpdateData', this.onUpdateData);
|
|
2514
|
+
this.componentRef.setInput('keySearch', this.keySearchStore() ?? '');
|
|
2515
|
+
this.componentRef.setInput('dropdownTabKeyActive', this.dropdownTabKeyActive());
|
|
2516
|
+
this.componentRef.setInput('clickExactly', this.clickExactly() || false);
|
|
2517
|
+
this.componentRef.setInput('disable', this.disable());
|
|
2518
|
+
this.componentRef.setInput('autoSelectedFirstItemCallOutsideBefore', this.autoSelectedFirstItemCallOutsideBefore());
|
|
2519
|
+
this.componentRef.setInput('paddingLeftItem', this.paddingLeftItem());
|
|
2520
|
+
this.componentRef.setInput('resetKeyWhenSelectAllKeyDropdown', this.resetKeyWhenSelectAllKeyDropdown());
|
|
2521
|
+
this.componentRef.setInput('ignoreClassDisableDefaultWhenUseKeysDisableItem', this.ignoreClassDisableDefaultWhenUseKeysDisableItem());
|
|
2522
|
+
this.componentRef.setInput('functionGetItemsAutoAddList', this.functionGetItemsAutoAddList());
|
|
2523
|
+
if (this.maxItemShow()) {
|
|
2524
|
+
this.componentRef.setInput('maxItemShow', this.maxItemShow());
|
|
2525
|
+
}
|
|
2526
|
+
this.componentRef.setInput('keySelected', this.keySelected());
|
|
2527
|
+
if (this.multiKeySelected()) {
|
|
2528
|
+
this.componentRef.setInput('multiKeySelected', this.multiKeySelected());
|
|
2529
|
+
}
|
|
2530
|
+
this.componentRef.setInput('keysDisableItem', this.keysDisableItem() || []);
|
|
2531
|
+
this.componentRef.setInput('keysHiddenItem', this.keysHiddenItem() || []);
|
|
2532
|
+
if (!isNil(this.keySelected()) || this.multiKeySelected()?.length) {
|
|
2533
|
+
this.disableButtonUnSelectOption.set(false);
|
|
2534
|
+
}
|
|
2535
|
+
this.componentRef.setInput('onUpdateMultiKeySelectedGroup', this.onUpdateMultiKeySelectedGroup);
|
|
2536
|
+
this.componentRef.setInput('onRemoveItems', this.onRemoveItems);
|
|
2537
|
+
this.componentRef.setInput('zIndex', this.zIndex());
|
|
2538
|
+
this.componentRef.setInput('isSearchOnline', this.isSearchOnline());
|
|
2539
|
+
this.componentRef.setInput('disableLabel', this.disableLabel() || false);
|
|
2540
|
+
this.componentRef.setInput('loadingIconSize', this.loadingIconSize());
|
|
2541
|
+
this.componentRef.setInput('templateRefSearchNoData', this.templateRefSearchNoData());
|
|
2542
|
+
let keySearch = '';
|
|
2543
|
+
const instance = this.componentRef.instance;
|
|
2544
|
+
instance.outChangeView.subscribe((data) => {
|
|
2545
|
+
this.outChangeView.emit(data);
|
|
2546
|
+
if (this.skipFocusInputWhenKeySearchStoreUndefined() && isNil(this.keySearchStore())) {
|
|
2547
|
+
return;
|
|
2548
|
+
}
|
|
2549
|
+
if (this.focusInputSearch() && this.keySearchStore() !== keySearch) {
|
|
2550
|
+
keySearch = this.keySearchStore() || '';
|
|
2551
|
+
this.functionControlInputSearch()?.focus();
|
|
2552
|
+
}
|
|
2553
|
+
});
|
|
2554
|
+
instance.outSelectKey.subscribe((data) => {
|
|
2555
|
+
this.disableButtonUnSelectOption.set(false);
|
|
2556
|
+
this.outSelectKey.emit(data);
|
|
2557
|
+
this.checkIsValid();
|
|
2558
|
+
});
|
|
2559
|
+
instance.outFieldKey.subscribe((fieldKey) => {
|
|
2560
|
+
this.outFieldKey.emit(fieldKey);
|
|
2561
|
+
});
|
|
2562
|
+
instance.outLoading.subscribe((loading) => {
|
|
2563
|
+
this.loading.set(loading);
|
|
2564
|
+
this.outLoading.emit(loading);
|
|
2565
|
+
});
|
|
2566
|
+
instance.outLoadItemsComplete.subscribe((event) => {
|
|
2567
|
+
this.outLoadItemsComplete.emit(event);
|
|
2568
|
+
});
|
|
2569
|
+
if (this.config() && this.config()?.configTemplateText && this.config()?.configTemplateText?.()?.actionSort) {
|
|
2570
|
+
instance.outSortSingleSelect.subscribe((itemSort) => {
|
|
2571
|
+
const config = this.config();
|
|
2572
|
+
if (config && config.configTemplateText && config.configTemplateText()?.actionSort) {
|
|
2573
|
+
config.configTemplateText()?.itemSort?.set(itemSort);
|
|
2574
|
+
config.configTemplateText()?.actionSort?.(itemSort);
|
|
2575
|
+
}
|
|
2576
|
+
});
|
|
2577
|
+
}
|
|
2578
|
+
instance.outChangStageFlagMousePopover.subscribe((flag) => {
|
|
2579
|
+
this.outChangStageFlagMousePopover.emit(flag);
|
|
2580
|
+
});
|
|
2581
|
+
const type = this.configData()?.type;
|
|
2582
|
+
if (type === 'text' || type === 'radio') {
|
|
2583
|
+
return;
|
|
2584
|
+
}
|
|
2585
|
+
instance.outSelectMultiKey.subscribe((data) => {
|
|
2586
|
+
this.disableButtonUnSelectOption.set(false);
|
|
2587
|
+
if (type === 'group') {
|
|
2588
|
+
this.groupMultiKeySelected.set(data.keys);
|
|
2589
|
+
}
|
|
2590
|
+
this.outSelectMultiKey.emit(data);
|
|
2591
|
+
this.checkIsValid();
|
|
2592
|
+
});
|
|
2593
|
+
}
|
|
2594
|
+
/* FUNCTIONS */
|
|
2595
|
+
get FunctionsControl() {
|
|
2596
|
+
return {
|
|
2597
|
+
checkIsValid: this.checkIsValid.bind(this),
|
|
2598
|
+
refresh: this.refresh.bind(this),
|
|
2599
|
+
resetKeySelected: this.handlerRemoveKeySelected.bind(this),
|
|
2600
|
+
getRectListView: async () => this.listViewElementRef()?.nativeElement.getBoundingClientRect(),
|
|
2601
|
+
removeItems: async (keys) => this.onRemoveItems.next(keys),
|
|
2602
|
+
updateData: async (data) => this.onUpdateData.next(data),
|
|
2603
|
+
};
|
|
2604
|
+
}
|
|
2605
|
+
handlerSearch(keySearch) {
|
|
2606
|
+
this.keySearchStore.set(keySearch);
|
|
2607
|
+
this.onSearch.next(keySearch);
|
|
2608
|
+
this.outKeySearch.emit(keySearch);
|
|
2609
|
+
}
|
|
2610
|
+
async handlerRemoveKeySelected() {
|
|
2611
|
+
if (!this.componentRef) {
|
|
2612
|
+
return;
|
|
2613
|
+
}
|
|
2614
|
+
this.outSelectKey.emit(undefined);
|
|
2615
|
+
this.outSelectMultiKey.emit(undefined);
|
|
2616
|
+
this.componentRef.setInput('keySelected', '');
|
|
2617
|
+
this.componentRef.setInput('multiKeySelected', undefined);
|
|
2618
|
+
this.disableButtonUnSelectOption.set(true);
|
|
2619
|
+
if (this.configData()?.type === 'group') {
|
|
2620
|
+
this.onUpdateMultiKeySelectedGroup.next();
|
|
2621
|
+
}
|
|
2622
|
+
await this.checkIsValid();
|
|
2623
|
+
}
|
|
2624
|
+
handlerClickButtonOther(button) {
|
|
2625
|
+
this.outClickButtonOther.emit(button);
|
|
2626
|
+
}
|
|
2627
|
+
handlerFunctionControlInputSearch(event) {
|
|
2628
|
+
this.functionControlInputSearch.set(event);
|
|
2629
|
+
}
|
|
2630
|
+
async checkIsValid() {
|
|
2631
|
+
if (!this.validRequired() || !this.config()?.type || !this.componentRef?.instance) {
|
|
2632
|
+
this.isErrorRequired.set(false);
|
|
2633
|
+
return true;
|
|
2634
|
+
}
|
|
2635
|
+
const type = this.config()?.type;
|
|
2636
|
+
let hasKey = !isEmpty(this.componentRef.instance.multiKeySelected());
|
|
2637
|
+
if (type === 'group') {
|
|
2638
|
+
hasKey = !isEmpty(this.groupMultiKeySelected());
|
|
2639
|
+
}
|
|
2640
|
+
if (type === 'text' || type === 'radio') {
|
|
2641
|
+
hasKey = !isNil(this.componentRef.instance.keySelected());
|
|
2642
|
+
}
|
|
2643
|
+
this.isErrorRequired.set(!hasKey);
|
|
2644
|
+
return hasKey;
|
|
2645
|
+
}
|
|
2646
|
+
async refresh() {
|
|
2647
|
+
untracked(() => {
|
|
2648
|
+
const config = this.config();
|
|
2649
|
+
if (!config) {
|
|
2650
|
+
return;
|
|
2651
|
+
}
|
|
2652
|
+
this.configData.set(this.cloneConfig(config));
|
|
2653
|
+
this.onRefresh.next();
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2656
|
+
cloneConfig(configInput) {
|
|
2657
|
+
if (!configInput) {
|
|
2658
|
+
return {};
|
|
2659
|
+
}
|
|
2660
|
+
const objectInstance = configInput.httpRequestData?.()?.objectInstance;
|
|
2661
|
+
const serviceClass = configInput.httpRequestData?.()?.serviceClass;
|
|
2662
|
+
const objectInstanceRequestAllIdSelectOrUnSelect = configInput.configTemplateCheckbox?.()?.httpRequestAllIdSelectOrUnSelect?.()?.objectInstance;
|
|
2663
|
+
const serviceClassRequestAllIdSelectOrUnSelect = configInput.configTemplateCheckbox?.()?.httpRequestAllIdSelectOrUnSelect?.()?.serviceClass;
|
|
2664
|
+
if (objectInstance) {
|
|
2665
|
+
configInput.httpRequestData?.update((current) => {
|
|
2666
|
+
delete current.objectInstance;
|
|
2667
|
+
return current;
|
|
2668
|
+
});
|
|
2669
|
+
}
|
|
2670
|
+
if (serviceClass) {
|
|
2671
|
+
configInput.httpRequestData?.update((current) => {
|
|
2672
|
+
delete current.serviceClass;
|
|
2673
|
+
return current;
|
|
2674
|
+
});
|
|
2675
|
+
}
|
|
2676
|
+
if (objectInstanceRequestAllIdSelectOrUnSelect) {
|
|
2677
|
+
configInput.configTemplateCheckbox?.()?.httpRequestAllIdSelectOrUnSelect?.update((current) => {
|
|
2678
|
+
delete current.objectInstance;
|
|
2679
|
+
return current;
|
|
2680
|
+
});
|
|
2681
|
+
}
|
|
2682
|
+
if (serviceClassRequestAllIdSelectOrUnSelect) {
|
|
2683
|
+
configInput.configTemplateCheckbox?.()?.httpRequestAllIdSelectOrUnSelect?.update((current) => {
|
|
2684
|
+
delete current.serviceClass;
|
|
2685
|
+
return current;
|
|
2686
|
+
});
|
|
2687
|
+
}
|
|
2688
|
+
const config = cloneDeep(configInput);
|
|
2689
|
+
if (objectInstance && config.httpRequestData) {
|
|
2690
|
+
config.httpRequestData.update((current) => {
|
|
2691
|
+
current.objectInstance = objectInstance;
|
|
2692
|
+
return current;
|
|
2693
|
+
});
|
|
2694
|
+
configInput.httpRequestData?.update((current) => {
|
|
2695
|
+
current.objectInstance = objectInstance;
|
|
2696
|
+
return current;
|
|
2697
|
+
});
|
|
2698
|
+
}
|
|
2699
|
+
if (serviceClass && config.httpRequestData) {
|
|
2700
|
+
config.httpRequestData.update((current) => {
|
|
2701
|
+
current.serviceClass = serviceClass;
|
|
2702
|
+
return current;
|
|
2703
|
+
});
|
|
2704
|
+
configInput.httpRequestData?.update((current) => {
|
|
2705
|
+
current.serviceClass = serviceClass;
|
|
2706
|
+
return current;
|
|
2707
|
+
});
|
|
2708
|
+
}
|
|
2709
|
+
if (serviceClassRequestAllIdSelectOrUnSelect && config.configTemplateCheckbox) {
|
|
2710
|
+
config.configTemplateCheckbox?.()?.httpRequestAllIdSelectOrUnSelect?.update((current) => {
|
|
2711
|
+
current.serviceClass = serviceClassRequestAllIdSelectOrUnSelect;
|
|
2712
|
+
return current;
|
|
2713
|
+
});
|
|
2714
|
+
configInput.configTemplateCheckbox?.()?.httpRequestAllIdSelectOrUnSelect?.update((current) => {
|
|
2715
|
+
current.serviceClass = serviceClassRequestAllIdSelectOrUnSelect;
|
|
2716
|
+
return current;
|
|
2717
|
+
});
|
|
2718
|
+
}
|
|
2719
|
+
if (objectInstanceRequestAllIdSelectOrUnSelect && config.configTemplateCheckbox) {
|
|
2720
|
+
config.configTemplateCheckbox?.()?.httpRequestAllIdSelectOrUnSelect?.update((current) => {
|
|
2721
|
+
current.objectInstance = objectInstance;
|
|
2722
|
+
return current;
|
|
2723
|
+
});
|
|
2724
|
+
configInput.configTemplateCheckbox?.()?.httpRequestAllIdSelectOrUnSelect?.update((current) => {
|
|
2725
|
+
current.objectInstance = objectInstance;
|
|
2726
|
+
return current;
|
|
2727
|
+
});
|
|
2728
|
+
}
|
|
2729
|
+
return config;
|
|
2730
|
+
}
|
|
2731
|
+
ngOnDestroy() {
|
|
2732
|
+
this.cleanUpEffect.destroy();
|
|
2733
|
+
this.outLoading.emit(false);
|
|
2734
|
+
this.dynamicComponentService.remove(this.componentRef);
|
|
2735
|
+
this.onRefresh.complete();
|
|
2736
|
+
this.onSearch.complete();
|
|
2737
|
+
this.onSetHiddenItemByKey.complete();
|
|
2738
|
+
this.onUpdateMultiKeySelectedGroup.complete();
|
|
2739
|
+
this.onDestroy.next();
|
|
2740
|
+
this.onDestroy.complete();
|
|
2741
|
+
}
|
|
2742
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2743
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", 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 }, paddingLeftItem: { classPropertyName: "paddingLeftItem", publicName: "paddingLeftItem", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, autoSelectedFirstItemCallOutsideBefore: { classPropertyName: "autoSelectedFirstItemCallOutsideBefore", publicName: "autoSelectedFirstItemCallOutsideBefore", isSignal: true, isRequired: false, 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 }, focusInputSearch: { classPropertyName: "focusInputSearch", publicName: "focusInputSearch", isSignal: true, isRequired: false, transformFunction: null }, skipFocusInputWhenKeySearchStoreUndefined: { classPropertyName: "skipFocusInputWhenKeySearchStoreUndefined", publicName: "skipFocusInputWhenKeySearchStoreUndefined", isSignal: true, isRequired: false, transformFunction: null }, functionGetItemsAutoAddList: { classPropertyName: "functionGetItemsAutoAddList", publicName: "functionGetItemsAutoAddList", 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", outKeySearch: "outKeySearch", 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\n #listViewContainer\n class=\"flex flex-col\"\n [class.w-full]=\"!maxItemShow()\"\n [class.h-full]=\"!maxItemShow() || maxItemShow() === -1\">\n @if (labelConfig(); as labelConfig) {\n <libs_ui-components-label\n [classInclude]=\"labelConfig.classInclude\"\n [labelLeft]=\"labelConfig.labelLeft\"\n [labelLeftClass]=\"labelConfig.labelLeftClass\"\n [required]=\"labelConfig.required\"\n [description]=\"labelConfig.description\"\n [descriptionClass]=\"labelConfig.descriptionClass\"\n [labelRight]=\"labelConfig.labelRight\"\n [labelRightClass]=\"labelConfig.labelRightClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [buttonsLeft]=\"labelConfig.buttonsLeft\"\n [buttonsRight]=\"labelConfig.buttonsRight\"\n [disableButtonsLeft]=\"labelConfig.disableButtonsLeft || disable()\"\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\" />\n }\n @if (!hiddenInputSearch()) {\n <libs_ui-components-inputs-search\n [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 (!hiddenInputSearch() && hasDivider() && (!config()?.ignoreShowDataWhenNotSearch || keySearchStore())) {\n <div\n class=\"libs-ui-border-top-general {{ dividerClassInclude() ? dividerClassInclude() : '' }}\"\n [class.libs-ui-divider-default]=\"!!searchPadding() && !dividerClassInclude()\"></div>\n }\n <div class=\"flex flex-col {{ config()?.ignoreShowDataWhenNotSearch && keySearchStore() && !config()?.ignoreFixHeightShowDataWhenNotSearch ? 'h-[353px]' : 'h-full' }}\">\n <div\n #contentContainer\n class=\"w-full h-full {{ backgroundListCustom() }}\"\n [class.libs-ui-disable]=\"disable() && disableLabel()\"\n [class.pointer-events-none]=\"disable() && disableLabel()\"></div>\n\n @for (buttonOther of buttonsOther(); track $index) {\n <div\n class=\"bg-[#ffffff] libs-ui-border-top-general\"\n [class.rounded-b-[4px]]=\"$last && !hasButtonUnSelectOption()\">\n <libs_ui-components-buttons-button\n [type]=\"buttonOther.type || 'button-link-primary'\"\n [label]=\"buttonOther.label || ' '\"\n [classIconLeft]=\"(buttonOther.classIconLeft || '') + ' flex mr-[8px] text-[16px]'\"\n classInclude=\"w-full 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] libs-ui-border-top-general\">\n <libs_ui-components-buttons-button\n label=\"i18n_unselect_option\"\n type=\"button-link-danger-high\"\n classIconLeft=\"flex mr-[8px] libs-ui-icon-close\"\n classInclude=\"w-full text-left rounded-0\"\n classLabel=\"libs-ui-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\" />\n }\n</div>\n\n<ng-template #templateValidate>\n @if (isErrorRequired()) {\n <div\n [class.mb-[8px]]=\"!showValidateBottom()\"\n [class.mt-[8px]]=\"showValidateBottom()\">\n @let constHtmlMessage = validRequired()?.message || ERROR_MESSAGE_EMPTY_VALID;\n <span\n class=\"libs-ui-text-error libs-ui-font-h7r\"\n [innerHtml]=\"constHtmlMessage | translate: validRequired()?.interpolateParams\"></span>\n </div>\n }\n</ng-template>\n", styles: [":host{background-color:#fff}:host ::ng-deep .libs-ui-list-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: i1.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: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "initEventInElementRefCustom", "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", "isHandlerEnterDocumentClickButton"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2744
|
+
}
|
|
2745
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsListComponent, decorators: [{
|
|
2746
|
+
type: Component,
|
|
2747
|
+
args: [{ selector: 'libs_ui-components-list', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, TranslateModule, LibsUiComponentsLabelComponent, LibsUiComponentsInputsSearchComponent, LibsUiComponentsPopoverComponent, LibsUiComponentsButtonsButtonComponent], template: "<div\n #listViewContainer\n class=\"flex flex-col\"\n [class.w-full]=\"!maxItemShow()\"\n [class.h-full]=\"!maxItemShow() || maxItemShow() === -1\">\n @if (labelConfig(); as labelConfig) {\n <libs_ui-components-label\n [classInclude]=\"labelConfig.classInclude\"\n [labelLeft]=\"labelConfig.labelLeft\"\n [labelLeftClass]=\"labelConfig.labelLeftClass\"\n [required]=\"labelConfig.required\"\n [description]=\"labelConfig.description\"\n [descriptionClass]=\"labelConfig.descriptionClass\"\n [labelRight]=\"labelConfig.labelRight\"\n [labelRightClass]=\"labelConfig.labelRightClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [buttonsLeft]=\"labelConfig.buttonsLeft\"\n [buttonsRight]=\"labelConfig.buttonsRight\"\n [disableButtonsLeft]=\"labelConfig.disableButtonsLeft || disable()\"\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\" />\n }\n @if (!hiddenInputSearch()) {\n <libs_ui-components-inputs-search\n [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 (!hiddenInputSearch() && hasDivider() && (!config()?.ignoreShowDataWhenNotSearch || keySearchStore())) {\n <div\n class=\"libs-ui-border-top-general {{ dividerClassInclude() ? dividerClassInclude() : '' }}\"\n [class.libs-ui-divider-default]=\"!!searchPadding() && !dividerClassInclude()\"></div>\n }\n <div class=\"flex flex-col {{ config()?.ignoreShowDataWhenNotSearch && keySearchStore() && !config()?.ignoreFixHeightShowDataWhenNotSearch ? 'h-[353px]' : 'h-full' }}\">\n <div\n #contentContainer\n class=\"w-full h-full {{ backgroundListCustom() }}\"\n [class.libs-ui-disable]=\"disable() && disableLabel()\"\n [class.pointer-events-none]=\"disable() && disableLabel()\"></div>\n\n @for (buttonOther of buttonsOther(); track $index) {\n <div\n class=\"bg-[#ffffff] libs-ui-border-top-general\"\n [class.rounded-b-[4px]]=\"$last && !hasButtonUnSelectOption()\">\n <libs_ui-components-buttons-button\n [type]=\"buttonOther.type || 'button-link-primary'\"\n [label]=\"buttonOther.label || ' '\"\n [classIconLeft]=\"(buttonOther.classIconLeft || '') + ' flex mr-[8px] text-[16px]'\"\n classInclude=\"w-full 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] libs-ui-border-top-general\">\n <libs_ui-components-buttons-button\n label=\"i18n_unselect_option\"\n type=\"button-link-danger-high\"\n classIconLeft=\"flex mr-[8px] libs-ui-icon-close\"\n classInclude=\"w-full text-left rounded-0\"\n classLabel=\"libs-ui-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\" />\n }\n</div>\n\n<ng-template #templateValidate>\n @if (isErrorRequired()) {\n <div\n [class.mb-[8px]]=\"!showValidateBottom()\"\n [class.mt-[8px]]=\"showValidateBottom()\">\n @let constHtmlMessage = validRequired()?.message || ERROR_MESSAGE_EMPTY_VALID;\n <span\n class=\"libs-ui-text-error libs-ui-font-h7r\"\n [innerHtml]=\"constHtmlMessage | translate: validRequired()?.interpolateParams\"></span>\n </div>\n }\n</ng-template>\n", styles: [":host{background-color:#fff}:host ::ng-deep .libs-ui-list-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"] }]
|
|
2748
|
+
}], ctorParameters: () => [] });
|
|
2749
|
+
|
|
2750
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2751
|
+
|
|
2752
|
+
/**
|
|
2753
|
+
* Generated bundle index. Do not edit.
|
|
2754
|
+
*/
|
|
2755
|
+
|
|
2756
|
+
export { LibsUiComponentsListComponent, getComponentByType, getFieldKeyByType, initConfig };
|
|
2757
|
+
//# sourceMappingURL=libs-ui-components-list.mjs.map
|