@libs-ui/components-table 0.2.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/esm2022/index.mjs +4 -0
- package/esm2022/interfaces/button-action-event.interface.mjs +3 -0
- package/esm2022/interfaces/button-bar-event.interface.mjs +3 -0
- package/esm2022/interfaces/function-control-event.interface.mjs +2 -0
- package/esm2022/interfaces/hover-button-action-event.interface.mjs +2 -0
- package/esm2022/interfaces/index.mjs +11 -0
- package/esm2022/interfaces/load-more-event.interface.mjs +2 -0
- package/esm2022/interfaces/no-data-config.interface.mjs +2 -0
- package/esm2022/interfaces/sort-event.interface.mjs +2 -0
- package/esm2022/interfaces/table-config.interface.mjs +2 -0
- package/esm2022/interfaces/table.type.mjs +2 -0
- package/esm2022/interfaces/template-config.interface.mjs +3 -0
- package/esm2022/libs-ui-components-table.mjs +5 -0
- package/esm2022/table.component.mjs +608 -0
- package/esm2022/templates/template.abstract.component.mjs +16 -0
- package/esm2022/templates/templates.component.mjs +111 -0
- package/fesm2022/libs-ui-components-table.mjs +735 -0
- package/fesm2022/libs-ui-components-table.mjs.map +1 -0
- package/index.d.ts +3 -0
- package/interfaces/button-action-event.interface.d.ts +12 -0
- package/interfaces/button-bar-event.interface.d.ts +7 -0
- package/interfaces/function-control-event.interface.d.ts +13 -0
- package/interfaces/hover-button-action-event.interface.d.ts +4 -0
- package/interfaces/index.d.ts +10 -0
- package/interfaces/load-more-event.interface.d.ts +4 -0
- package/interfaces/no-data-config.interface.d.ts +8 -0
- package/interfaces/sort-event.interface.d.ts +5 -0
- package/interfaces/table-config.interface.d.ts +88 -0
- package/interfaces/table.type.d.ts +12 -0
- package/interfaces/template-config.interface.d.ts +60 -0
- package/package.json +25 -0
- package/table.component.d.ts +137 -0
- package/templates/template.abstract.component.d.ts +7 -0
- package/templates/templates.component.d.ts +25 -0
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+
import { NgStyle, NgClass, AsyncPipe, NgComponentOutlet, NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import { HttpParams } from '@angular/common/http';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { input, Component, ChangeDetectionStrategy, computed, signal, output, viewChild, inject, effect, untracked } from '@angular/core';
|
|
5
|
+
import * as i2 from '@iharbeck/ngx-virtual-scroller';
|
|
6
|
+
import { VirtualScrollerModule } from '@iharbeck/ngx-virtual-scroller';
|
|
7
|
+
import { LibsUiComponentsButtonsButtonComponent } from '@libs-ui/components-buttons-button';
|
|
8
|
+
import { LibsUiComponentsButtonsSortArrowComponent } from '@libs-ui/components-buttons-sort';
|
|
9
|
+
import { LibsUiComponentsCheckboxSingleComponent } from '@libs-ui/components-checkbox-single';
|
|
10
|
+
import { LibsUiComponentsDropdownComponent } from '@libs-ui/components-dropdown';
|
|
11
|
+
import { LibsUiComponentsPopoverComponent } from '@libs-ui/components-popover';
|
|
12
|
+
import { LibsUiComponentsScrollOverlayDirective } from '@libs-ui/components-scroll-overlay';
|
|
13
|
+
import { LibsUiComponentsSpinnerComponent } from '@libs-ui/components-spinner';
|
|
14
|
+
import { LibsUiIconsGetIconComponentPipe } from '@libs-ui/icons';
|
|
15
|
+
import { LibsUiPipesCallFunctionInTemplatePipe } from '@libs-ui/pipes-call-function-in-template';
|
|
16
|
+
import { LibsUiPipesCheckSelectedByKeyPipe } from '@libs-ui/pipes-check-selected-by-key';
|
|
17
|
+
import { LibsUiPipesConvertObjectToSignalPipe } from '@libs-ui/pipes-convert-object-to-signal';
|
|
18
|
+
import { LibsUiHttpRequestService } from '@libs-ui/services-http-request';
|
|
19
|
+
import { convertObjectToSignal, viewDataNumberByLanguage, get, deleteUnicode, set } from '@libs-ui/utils';
|
|
20
|
+
import * as i1 from '@ngx-translate/core';
|
|
21
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
22
|
+
import { Subject, lastValueFrom, timer, takeUntil } from 'rxjs';
|
|
23
|
+
import { LibsUiComponentsAvatarComponent } from '@libs-ui/components-avatar';
|
|
24
|
+
import { LibsUiComponentsButtonsStatusComponent } from '@libs-ui/components-buttons-status';
|
|
25
|
+
import { LibsUiComponentsLineClampComponent } from '@libs-ui/components-line-clamp';
|
|
26
|
+
import { LibsUiComponentsSwitchComponent } from '@libs-ui/components-switch';
|
|
27
|
+
import { LibsUiPipesCloneObjectPipe } from '@libs-ui/pipes-clone-object';
|
|
28
|
+
import { LibsUiPipesSecurityTrustPipe } from '@libs-ui/pipes-security-trust';
|
|
29
|
+
import { LibsUiComponentsBadgeComponent } from '@libs-ui/components-badge';
|
|
30
|
+
|
|
31
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
32
|
+
class LibsUiComponentsTableTemplatesComponent {
|
|
33
|
+
lockClick;
|
|
34
|
+
functionControls = new Map();
|
|
35
|
+
isImageError;
|
|
36
|
+
isHover = input();
|
|
37
|
+
configs = input();
|
|
38
|
+
templateCssWrapper = input();
|
|
39
|
+
item = input.required();
|
|
40
|
+
async handlerItemClick(event, config, dataField) {
|
|
41
|
+
if (event instanceof Event) {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
event.stopPropagation();
|
|
44
|
+
}
|
|
45
|
+
if (typeof event === 'string' && event !== 'click') {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (this.lockClick) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.lockClick = true;
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
this.lockClick = false;
|
|
54
|
+
}, 250);
|
|
55
|
+
if (config && config.action) {
|
|
56
|
+
config.action(dataField, this.item());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async clickButtonAction(button) {
|
|
60
|
+
if (this.lockClick) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this.lockClick = true;
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
this.lockClick = false;
|
|
66
|
+
}, 250);
|
|
67
|
+
button.action?.({ item: this.item() });
|
|
68
|
+
}
|
|
69
|
+
async handlerSwitch(switchItem, config) {
|
|
70
|
+
if (this.lockClick) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.lockClick = true;
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
this.lockClick = false;
|
|
76
|
+
}, 250);
|
|
77
|
+
config?.switchAction?.(switchItem, this.item());
|
|
78
|
+
}
|
|
79
|
+
async handlerSelectItemDropdown(fieldConfig, index, data) {
|
|
80
|
+
if (this.lockClick || !data) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
this.lockClick = true;
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
this.lockClick = false;
|
|
86
|
+
}, 250);
|
|
87
|
+
fieldConfig?.action?.(data.key, data.item, this.item());
|
|
88
|
+
this.functionControls?.get(index)?.reset();
|
|
89
|
+
this.functionControls?.get(index)?.removeList();
|
|
90
|
+
}
|
|
91
|
+
async handlerSelectItemsDropdown(fieldConfig, index, data) {
|
|
92
|
+
if (this.lockClick || !data) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
this.lockClick = true;
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
this.lockClick = false;
|
|
98
|
+
}, 250);
|
|
99
|
+
fieldConfig?.action?.(data.keys, convertObjectToSignal(data.mapKeys, false), this.item());
|
|
100
|
+
this.functionControls?.get(index)?.reset();
|
|
101
|
+
}
|
|
102
|
+
async handlerImageError(event) {
|
|
103
|
+
event.stopPropagation();
|
|
104
|
+
this.isImageError = true;
|
|
105
|
+
}
|
|
106
|
+
async handlerFunctionControl(event, index) {
|
|
107
|
+
this.functionControls.set(index, event);
|
|
108
|
+
}
|
|
109
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsTableTemplatesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
110
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsTableTemplatesComponent, isStandalone: true, selector: "libs_ui-components-table-templates", inputs: { isHover: { classPropertyName: "isHover", publicName: "isHover", isSignal: true, isRequired: false, transformFunction: null }, configs: { classPropertyName: "configs", publicName: "configs", isSignal: true, isRequired: false, transformFunction: null }, templateCssWrapper: { classPropertyName: "templateCssWrapper", publicName: "templateCssWrapper", isSignal: true, isRequired: false, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@if (configs(); as configs) {\n @if (item(); as item) {\n <div class=\"mo-lib-table-template {{ templateCssWrapper() || '' }}\">\n @for (config of configs; track $index) {\n @if (config.fieldsConfig) {\n <div [class]=\"config.cssWrapper\">\n @for (fieldConfig of config.fieldsConfig; track index;let index = $index;) {\n\n @if (!fieldConfig.rows && !fieldConfig.getComponentOutlet) {\n @switch (fieldConfig.instance) {\n @case (\"tooltip\") {\n @if ((fieldConfig.tooltip || {}); as tooltip) {\n <span LibsUiComponentsPopoverDirective\n [type]=\"tooltip.type || 'text'\"\n [mode]=\"tooltip.mode || 'hover'\"\n [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [classInclude]=\"tooltip.classInclude || ' '\"\n [ignoreShowPopover]=\"tooltip.ignoreShowPopover || false\"\n [config]=\"(fieldConfig.getTooltipConfig ? (item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getTooltipConfig:item() | async) : (tooltip.config | LibsUiPipesCloneObjectPipe)) | translate\"\n [innerHTML]=\" (fieldConfig.field ? item()[fieldConfig.field] : tooltip.dataView) | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item() | async | translate\"\n (outEvent)=\"handlerItemClick($event,fieldConfig,item()[fieldConfig.field])\">\n </span>\n }\n }\n @case (\"image\") {\n @if (((item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getImageSrc:item():isImageError) | async); as linkImage) {\n @if (linkImage !== ' ') {\n <img [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [src]=\"linkImage\"\n (error)=\"handlerImageError($event)\"\n (click)=\"handlerItemClick($event,fieldConfig,item()[fieldConfig.field])\" />\n }\n }\n }\n\n @case (\"avatar\") {\n @if ((item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getAvatarConfig:item()) | async ; as avatarConfig) {\n <libs_ui-components-avatar [typeShape]=\"avatarConfig.typeShape || 'circle'\"\n [classInclude]=\"avatarConfig.classInclude\"\n [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [size]='avatarConfig.size || 32'\n [linkAvatar]=\"avatarConfig.linkAvatar\"\n [linkAvatarError]=\"avatarConfig.linkAvatarError\"\n [idGenColor]=\"avatarConfig.idGenColor\"\n [textAvatar]=\"avatarConfig.textAvatar\"\n [getLastTextAfterSpace]=\"avatarConfig.getLastTextAfterSpace\" />\n }\n }\n\n @case (\"buttons\") {\n @if ((fieldConfig.buttons && fieldConfig.buttons.length) || fieldConfig.getButtonsByItem) {\n <div [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [class.invisible]=\"!isHover() && fieldConfig.showButtonHoverMode\">\n @for (button of (fieldConfig.buttons || (item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getButtonsByItem:item() | async)); track $index) {\n\n <libs_ui-components-buttons-button [type]=\"button().type || 'button-primary'\"\n [sizeButton]=\"button().sizeButton || 'smaller'\"\n [disable]=\"button().disable ?? (item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getDisable:item())\"\n [label]=\"button().label || ' '\"\n [classIconLeft]=\"button().classIconLeft || ''\"\n [classIconRight]=\"button().classIconRight || ''\"\n [popover]=\"button().popover || {}\"\n [classInclude]=\"button().classInclude || ''\"\n [ignorePointerEvent]=\"button().ignorePointerEvent\"\n (outClick)=\"clickButtonAction(button())\" />\n }\n </div>\n }\n }\n\n @case (\"button-status\") {\n <libs_ui-components-buttons-status\n [config]=\"(item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item()) | async\"\n (click)=\"handlerItemClick($event,fieldConfig,item()[fieldConfig.field])\" />\n }\n\n @case (\"switch\") {\n <libs_ui-components-switch\n [active]=\"item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getActiveValueSwitch:item() | async\"\n [disable]=\"item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getDisableValueSwitch:item() | async\"\n (outSwitch)=\"handlerSwitch($event,fieldConfig)\" />\n }\n\n\n @case ((fieldConfig.instance === 'other-action-show-popup' || fieldConfig.instance === 'badge' || fieldConfig.instance === 'button-action-show-popup') ? fieldConfig.instance : '') {\n @if ((item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item() | async) !== ' ') {\n <div [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [class.ml-[8px]]=\"!fieldConfig.ignoreClassMarginLeft\">\n <libs_ui-components-dropdown [isNgContent]=\"true\"\n [popoverCustomConfig]=\"{\n widthByParent:false,\n ignoreArrow: fieldConfig.dropdownConfig?.ignoreArrow || false,\n maxHeight: fieldConfig.dropdownConfig?.maxHeight || 2048,\n paddingLeftItem:fieldConfig.dropdownConfig?.paddingLeftItem ?? true,\n classInclude:fieldConfig.dropdownConfig?.classIncludePopup || 'w-[250px]',\n position: fieldConfig.dropdownConfig?.position || {\n mode:'center',\n distance:0\n }\n }\"\n [zIndex]=\"fieldConfig.dropdownConfig?.zIndex\"\n [listConfig]=\"fieldConfig.dropdownConfig?.getListViewConfig ? ((item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.dropdownConfig?.getListViewConfig:item()) | async):fieldConfig.dropdownConfig?.listViewConfig\"\n [listBackgroundCustom]=\"fieldConfig.dropdownConfig?.listViewBackgroundListCustom\"\n [listMaxItemShow]=\"fieldConfig.dropdownConfig?.listViewMaxItemShow || 5\"\n [listKeysDisable]=\"fieldConfig.dropdownConfig?.listViewKeysDisableItem\"\n (outFunctionsControl)=\"handlerFunctionControl($event, index)\"\n (outSelectKey)=\"handlerSelectItemDropdown(fieldConfig, index,$event)\"\n (outSelectMultiKey)=\"handlerSelectItemsDropdown(fieldConfig, index,$event)\">\n @if (fieldConfig.instance === 'other-action-show-popup') {\n <div\n [innerHtml]=\"(item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item())| async | translate\">\n </div>\n }\n @if (fieldConfig.instance === 'badge' && (item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item() | async) > 0) {\n <libs_ui-components-badge [active]=\"true\"\n [ignoreMarginDefault]=\"true\"\n mode=\"+x\"\n [count]=\"item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item() | async\"\n [maxCount]=\"99\" />\n }\n @if (fieldConfig.instance === 'button-action-show-popup') {\n <libs_ui-components-buttons-button\n [type]=\"fieldConfig?.buttonDropDown()?.type || 'button-primary'\"\n [sizeButton]=\"fieldConfig?.buttonDropDown()?.sizeButton || 'smaller'\"\n [disable]=\"fieldConfig?.buttonDropDown()?.disable ?? (item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getDisable:item() | async)\"\n [label]=\"fieldConfig?.buttonDropDown()?.label || ' '\"\n [classIconLeft]=\"fieldConfig?.buttonDropDown()?.classIconLeft || ''\"\n [classIconRight]=\"fieldConfig?.buttonDropDown()?.classIconRight || ''\"\n [popover]=\"fieldConfig?.buttonDropDown()?.popover || {}\"\n [classInclude]=\"fieldConfig?.buttonDropDown()?.classInclude || ''\"\n [ignoreStopPropagationEvent]=\"true\" />\n }\n\n </libs_ui-components-dropdown>\n </div>\n }\n }\n\n @case (\"line-clamp\") {\n <div [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\">\n @if (fieldConfig.lineClampConfig; as lineClampConfig) {\n <libs_ui-components-line_clamp\n [ignoreShowButtonCollapseExpand]=\"lineClampConfig.ignoreShowButtonCollapseExpand ?? true\"\n [showTooltip]=\"lineClampConfig.showTooltip ?? true\"\n [maxHeight]=\"lineClampConfig.maxHeight || 36\"\n [maxWidthPopover]=\"lineClampConfig.maxWidthPopover || 200\"\n [maxHeightPopover]=\"lineClampConfig.maxHeightPopover || 100\"\n [ngClassObject]=\"lineClampConfig.ngClassObject ?? { 'libs-ui-line-clamp-content mo-lib-font-head-5': true }\"\n [isInnerText]=\"lineClampConfig.isInnerText || false\"\n [ignoreStopPropagationTooltipEvent]=\"true\"\n [content]=\"item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item() | async\"\n (click)=\"handlerItemClick($event,fieldConfig,item()[fieldConfig.field])\" />\n }\n </div>\n }\n\n @case (\"shape-style\") {\n <div [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [innerHTML]=\"(item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item())| async | translate | LibsUiPipesSecurityTrustPipe:'html':true | async\"\n (click)=\"handlerItemClick($event,fieldConfig,item()[fieldConfig.field])\">\n </div>\n }\n @default {\n @if (((item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item()) | async | translate); as value) {\n @if (value !==' ') {\n <div [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [innerHTML]=\"value | LibsUiPipesSecurityTrustPipe:'html':true|async\"\n (click)=\"handlerItemClick($event,fieldConfig,item()[fieldConfig.field])\">\n </div>\n }\n }\n }\n }\n } @else {\n @if (fieldConfig.rows) {\n <div class=\"w-full flex relative {{ fieldConfig.rowsTemplateCssWrapper }}\">\n <div class=\"w-full flex absolute {{ fieldConfig.rowsTemplateCssWrapper }}\">\n <libs_ui-components-table-templates class=\"flex w-full\"\n [item]=\"item\"\n [configs]=\"fieldConfig.rows\" />\n </div>\n </div>\n }\n @else {\n <ng-container\n *ngComponentOutlet=\"(item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getComponentOutlet) | async; inputs:{item}\" />\n }\n }\n\n }\n </div>\n }\n }\n </div>\n }\n}\n", styles: [":host{width:100%;height:100%}:host .mo-lib-table-template{color:#071631;font-size:12px;font-weight:400;width:100%;height:inherit}:host .mo-lib-table-template .mo-lib-table-template-buttons-container{visibility:hidden!important}:host .mo-lib-table-template [is-hover=true].mo-lib-table-template-buttons-container{visibility:visible!important}\n"], dependencies: [{ kind: "component", type: LibsUiComponentsTableTemplatesComponent, selector: "libs_ui-components-table-templates", inputs: ["isHover", "configs", "templateCssWrapper", "item"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "component", type: LibsUiComponentsAvatarComponent, selector: "libs_ui-components-avatar", inputs: ["getLastTextAfterSpace", "typeShape", "classInclude", "size", "linkAvatar", "linkAvatarError", "idGenColor", "textAvatar", "classImageInclude"], outputs: ["outAvatarError"] }, { kind: "pipe", type: LibsUiPipesCallFunctionInTemplatePipe, name: "LibsUiPipesCallFunctionInTemplatePipe" }, { kind: "pipe", type: LibsUiPipesSecurityTrustPipe, name: "LibsUiPipesSecurityTrustPipe" }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsButtonsStatusComponent, selector: "libs_ui-components-buttons-status", inputs: ["config"] }, { kind: "component", type: LibsUiComponentsSwitchComponent, selector: "libs_ui-components-switch", inputs: ["size", "disable", "active"], outputs: ["activeChange", "outSwitch"] }, { kind: "pipe", type: LibsUiPipesCloneObjectPipe, name: "LibsUiPipesCloneObjectPipe" }, { kind: "component", type: LibsUiComponentsButtonsButtonComponent, selector: "libs_ui-components-buttons-button", inputs: ["flagMouse", "type", "buttonCustom", "sizeButton", "label", "disable", "isPending", "imageLeft", "classInclude", "classIconLeft", "classIconRight", "classLabel", "iconOnlyType", "popover", "ignoreStopPropagationEvent", "zIndex", "widthLabelPopover", "styleIconLeft", "styleButton", "ignoreFocusWhenInputTab", "ignoreSetClickWhenShowPopover", "ignorePointerEvent", "isActive"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsLineClampComponent, selector: "libs_ui-components-line_clamp", inputs: ["content", "lengthLimitDisplay", "maxHeight", "ignoreShowButtonCollapseExpand", "ignoreShowButtonCollapse", "showTooltip", "timeHidePopoverOnMouseout", "maxWidthPopover", "maxHeightPopover", "zIndexPopover", "isInnerText", "classClassLabelButtonCollapseExpand", "classClassIncludeButtonCollapseExpand", "ignoreStopPropagationTooltipEvent", "ngClassObject", "hasBackgroundGradient", "labelButtonViewMore", "labelButtonCollapse", "directionTooltip", "useXssFilter"], outputs: ["outDisplayLineClamp", "outAction", "outClick", "outFunctionControl"] }, { kind: "component", type: LibsUiComponentsDropdownComponent, selector: "libs_ui-components-dropdown", inputs: ["useXssFilter", "popoverElementRefCustom", "classInclude", "ignoreStopPropagationEvent", "flagMouse", "flagMouseContent", "popoverCustomConfig", "isNgContent", "zIndex", "convertItemSelected", "getPopoverItemSelected", "httpRequestDetailItemById", "lengthKeys", "textDisplayWhenNoSelect", "textDisplayWhenMultiSelect", "classIncludeTextDisplayWhenNoSelect", "fieldGetLabel", "labelPopoverConfig", "labelPopoverFullWidth", "hasContentUnitRight", "listSearchNoDataTemplateRef", "fieldGetImage", "imageSize", "typeShape", "fieldGetIcon", "fieldGetTextAvatar", "fieldGetColorAvatar", "classAvatarInclude", "getLastTextAfterSpace", "linkImageError", "showError", "showBorderError", "disable", "readonly", "labelConfig", "listSearchConfig", "isSearchOnline", "listHiddenInputSearch", "listSearchPadding", "listKeySearch", "listDividerClassInclude", "listConfig", "listButtonsOther", "listHasButtonUnSelectOption", "listClickExactly", "listBackgroundCustom", "listMaxItemShow", "listKeySelected", "listMultiKeySelected", "listKeysDisable", "listKeysHidden", "validRequired", "validMaxItemSelected", "changeValidUndefinedResetError", "allowSelectItemMultiple", "focusInputSearch", "onlyEmitDataWhenReset", "resetKeyWhenSelectAllKey", "listConfigHasDivider", "classIncludeIcon", "classIncludeContent", "listIgnoreClassDisableDefaultWhenUseKeysDisableItem", "tabKeyActive", "tabsConfig", "ignoreBorderBottom"], outputs: ["flagMouseChange", "flagMouseContentChange", "lengthKeysChange", "showBorderErrorChange", "listKeySelectedChange", "listMultiKeySelectedChange", "tabKeyActiveChange", "outSelectKey", "outSelectMultiKey", "outFunctionsControl", "outValidEvent", "outChangStageFlagMouse", "outDataChange", "outClickButtonOther", "outShowList", "outChangeTabKeyActive"] }, { kind: "component", type: LibsUiComponentsBadgeComponent, selector: "libs_ui-components-badge", inputs: ["popoverConfig", "active", "count", "mode", "maxCount", "ignoreMarginDefault", "classCircle", "ignoreStopPropagationEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
111
|
+
}
|
|
112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsTableTemplatesComponent, decorators: [{
|
|
113
|
+
type: Component,
|
|
114
|
+
args: [{ selector: 'libs_ui-components-table-templates', standalone: true, imports: [
|
|
115
|
+
NgStyle, NgClass, TranslateModule, AsyncPipe, NgComponentOutlet,
|
|
116
|
+
LibsUiComponentsAvatarComponent, LibsUiPipesCallFunctionInTemplatePipe,
|
|
117
|
+
LibsUiPipesSecurityTrustPipe, LibsUiComponentsPopoverComponent,
|
|
118
|
+
LibsUiComponentsButtonsStatusComponent, LibsUiComponentsSwitchComponent,
|
|
119
|
+
LibsUiPipesCloneObjectPipe, LibsUiComponentsButtonsButtonComponent,
|
|
120
|
+
LibsUiComponentsLineClampComponent, LibsUiComponentsDropdownComponent,
|
|
121
|
+
LibsUiComponentsBadgeComponent
|
|
122
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (configs(); as configs) {\n @if (item(); as item) {\n <div class=\"mo-lib-table-template {{ templateCssWrapper() || '' }}\">\n @for (config of configs; track $index) {\n @if (config.fieldsConfig) {\n <div [class]=\"config.cssWrapper\">\n @for (fieldConfig of config.fieldsConfig; track index;let index = $index;) {\n\n @if (!fieldConfig.rows && !fieldConfig.getComponentOutlet) {\n @switch (fieldConfig.instance) {\n @case (\"tooltip\") {\n @if ((fieldConfig.tooltip || {}); as tooltip) {\n <span LibsUiComponentsPopoverDirective\n [type]=\"tooltip.type || 'text'\"\n [mode]=\"tooltip.mode || 'hover'\"\n [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [classInclude]=\"tooltip.classInclude || ' '\"\n [ignoreShowPopover]=\"tooltip.ignoreShowPopover || false\"\n [config]=\"(fieldConfig.getTooltipConfig ? (item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getTooltipConfig:item() | async) : (tooltip.config | LibsUiPipesCloneObjectPipe)) | translate\"\n [innerHTML]=\" (fieldConfig.field ? item()[fieldConfig.field] : tooltip.dataView) | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item() | async | translate\"\n (outEvent)=\"handlerItemClick($event,fieldConfig,item()[fieldConfig.field])\">\n </span>\n }\n }\n @case (\"image\") {\n @if (((item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getImageSrc:item():isImageError) | async); as linkImage) {\n @if (linkImage !== ' ') {\n <img [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [src]=\"linkImage\"\n (error)=\"handlerImageError($event)\"\n (click)=\"handlerItemClick($event,fieldConfig,item()[fieldConfig.field])\" />\n }\n }\n }\n\n @case (\"avatar\") {\n @if ((item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getAvatarConfig:item()) | async ; as avatarConfig) {\n <libs_ui-components-avatar [typeShape]=\"avatarConfig.typeShape || 'circle'\"\n [classInclude]=\"avatarConfig.classInclude\"\n [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [size]='avatarConfig.size || 32'\n [linkAvatar]=\"avatarConfig.linkAvatar\"\n [linkAvatarError]=\"avatarConfig.linkAvatarError\"\n [idGenColor]=\"avatarConfig.idGenColor\"\n [textAvatar]=\"avatarConfig.textAvatar\"\n [getLastTextAfterSpace]=\"avatarConfig.getLastTextAfterSpace\" />\n }\n }\n\n @case (\"buttons\") {\n @if ((fieldConfig.buttons && fieldConfig.buttons.length) || fieldConfig.getButtonsByItem) {\n <div [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [class.invisible]=\"!isHover() && fieldConfig.showButtonHoverMode\">\n @for (button of (fieldConfig.buttons || (item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getButtonsByItem:item() | async)); track $index) {\n\n <libs_ui-components-buttons-button [type]=\"button().type || 'button-primary'\"\n [sizeButton]=\"button().sizeButton || 'smaller'\"\n [disable]=\"button().disable ?? (item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getDisable:item())\"\n [label]=\"button().label || ' '\"\n [classIconLeft]=\"button().classIconLeft || ''\"\n [classIconRight]=\"button().classIconRight || ''\"\n [popover]=\"button().popover || {}\"\n [classInclude]=\"button().classInclude || ''\"\n [ignorePointerEvent]=\"button().ignorePointerEvent\"\n (outClick)=\"clickButtonAction(button())\" />\n }\n </div>\n }\n }\n\n @case (\"button-status\") {\n <libs_ui-components-buttons-status\n [config]=\"(item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item()) | async\"\n (click)=\"handlerItemClick($event,fieldConfig,item()[fieldConfig.field])\" />\n }\n\n @case (\"switch\") {\n <libs_ui-components-switch\n [active]=\"item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getActiveValueSwitch:item() | async\"\n [disable]=\"item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getDisableValueSwitch:item() | async\"\n (outSwitch)=\"handlerSwitch($event,fieldConfig)\" />\n }\n\n\n @case ((fieldConfig.instance === 'other-action-show-popup' || fieldConfig.instance === 'badge' || fieldConfig.instance === 'button-action-show-popup') ? fieldConfig.instance : '') {\n @if ((item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item() | async) !== ' ') {\n <div [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [class.ml-[8px]]=\"!fieldConfig.ignoreClassMarginLeft\">\n <libs_ui-components-dropdown [isNgContent]=\"true\"\n [popoverCustomConfig]=\"{\n widthByParent:false,\n ignoreArrow: fieldConfig.dropdownConfig?.ignoreArrow || false,\n maxHeight: fieldConfig.dropdownConfig?.maxHeight || 2048,\n paddingLeftItem:fieldConfig.dropdownConfig?.paddingLeftItem ?? true,\n classInclude:fieldConfig.dropdownConfig?.classIncludePopup || 'w-[250px]',\n position: fieldConfig.dropdownConfig?.position || {\n mode:'center',\n distance:0\n }\n }\"\n [zIndex]=\"fieldConfig.dropdownConfig?.zIndex\"\n [listConfig]=\"fieldConfig.dropdownConfig?.getListViewConfig ? ((item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.dropdownConfig?.getListViewConfig:item()) | async):fieldConfig.dropdownConfig?.listViewConfig\"\n [listBackgroundCustom]=\"fieldConfig.dropdownConfig?.listViewBackgroundListCustom\"\n [listMaxItemShow]=\"fieldConfig.dropdownConfig?.listViewMaxItemShow || 5\"\n [listKeysDisable]=\"fieldConfig.dropdownConfig?.listViewKeysDisableItem\"\n (outFunctionsControl)=\"handlerFunctionControl($event, index)\"\n (outSelectKey)=\"handlerSelectItemDropdown(fieldConfig, index,$event)\"\n (outSelectMultiKey)=\"handlerSelectItemsDropdown(fieldConfig, index,$event)\">\n @if (fieldConfig.instance === 'other-action-show-popup') {\n <div\n [innerHtml]=\"(item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item())| async | translate\">\n </div>\n }\n @if (fieldConfig.instance === 'badge' && (item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item() | async) > 0) {\n <libs_ui-components-badge [active]=\"true\"\n [ignoreMarginDefault]=\"true\"\n mode=\"+x\"\n [count]=\"item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item() | async\"\n [maxCount]=\"99\" />\n }\n @if (fieldConfig.instance === 'button-action-show-popup') {\n <libs_ui-components-buttons-button\n [type]=\"fieldConfig?.buttonDropDown()?.type || 'button-primary'\"\n [sizeButton]=\"fieldConfig?.buttonDropDown()?.sizeButton || 'smaller'\"\n [disable]=\"fieldConfig?.buttonDropDown()?.disable ?? (item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getDisable:item() | async)\"\n [label]=\"fieldConfig?.buttonDropDown()?.label || ' '\"\n [classIconLeft]=\"fieldConfig?.buttonDropDown()?.classIconLeft || ''\"\n [classIconRight]=\"fieldConfig?.buttonDropDown()?.classIconRight || ''\"\n [popover]=\"fieldConfig?.buttonDropDown()?.popover || {}\"\n [classInclude]=\"fieldConfig?.buttonDropDown()?.classInclude || ''\"\n [ignoreStopPropagationEvent]=\"true\" />\n }\n\n </libs_ui-components-dropdown>\n </div>\n }\n }\n\n @case (\"line-clamp\") {\n <div [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\">\n @if (fieldConfig.lineClampConfig; as lineClampConfig) {\n <libs_ui-components-line_clamp\n [ignoreShowButtonCollapseExpand]=\"lineClampConfig.ignoreShowButtonCollapseExpand ?? true\"\n [showTooltip]=\"lineClampConfig.showTooltip ?? true\"\n [maxHeight]=\"lineClampConfig.maxHeight || 36\"\n [maxWidthPopover]=\"lineClampConfig.maxWidthPopover || 200\"\n [maxHeightPopover]=\"lineClampConfig.maxHeightPopover || 100\"\n [ngClassObject]=\"lineClampConfig.ngClassObject ?? { 'libs-ui-line-clamp-content mo-lib-font-head-5': true }\"\n [isInnerText]=\"lineClampConfig.isInnerText || false\"\n [ignoreStopPropagationTooltipEvent]=\"true\"\n [content]=\"item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item() | async\"\n (click)=\"handlerItemClick($event,fieldConfig,item()[fieldConfig.field])\" />\n }\n </div>\n }\n\n @case (\"shape-style\") {\n <div [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [innerHTML]=\"(item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item())| async | translate | LibsUiPipesSecurityTrustPipe:'html':true | async\"\n (click)=\"handlerItemClick($event,fieldConfig,item()[fieldConfig.field])\">\n </div>\n }\n @default {\n @if (((item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.parseValue:item()) | async | translate); as value) {\n @if (value !==' ') {\n <div [ngStyle]=\"fieldConfig.ngStyle || {}\"\n [ngClass]=\"fieldConfig.ngClass || {}\"\n [innerHTML]=\"value | LibsUiPipesSecurityTrustPipe:'html':true|async\"\n (click)=\"handlerItemClick($event,fieldConfig,item()[fieldConfig.field])\">\n </div>\n }\n }\n }\n }\n } @else {\n @if (fieldConfig.rows) {\n <div class=\"w-full flex relative {{ fieldConfig.rowsTemplateCssWrapper }}\">\n <div class=\"w-full flex absolute {{ fieldConfig.rowsTemplateCssWrapper }}\">\n <libs_ui-components-table-templates class=\"flex w-full\"\n [item]=\"item\"\n [configs]=\"fieldConfig.rows\" />\n </div>\n </div>\n }\n @else {\n <ng-container\n *ngComponentOutlet=\"(item()[fieldConfig.field] | LibsUiPipesCallFunctionInTemplatePipe:fieldConfig.getComponentOutlet) | async; inputs:{item}\" />\n }\n }\n\n }\n </div>\n }\n }\n </div>\n }\n}\n", styles: [":host{width:100%;height:100%}:host .mo-lib-table-template{color:#071631;font-size:12px;font-weight:400;width:100%;height:inherit}:host .mo-lib-table-template .mo-lib-table-template-buttons-container{visibility:hidden!important}:host .mo-lib-table-template [is-hover=true].mo-lib-table-template-buttons-container{visibility:visible!important}\n"] }]
|
|
123
|
+
}] });
|
|
124
|
+
|
|
125
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
126
|
+
class LibsUiComponentsTableComponent {
|
|
127
|
+
/** PROPERTY */
|
|
128
|
+
classHeaderContainer = computed(() => `libs-ui-table-header-container w-full flex ${this.ignoreClassBgHeader() ? '' : 'bg-white'} overflow-x-hidden z-[1] items-center ${this.classHeaderInclude() || ''}`);
|
|
129
|
+
keysSelected = signal([]);
|
|
130
|
+
loading = signal(false);
|
|
131
|
+
stores = signal([]);
|
|
132
|
+
items = signal([]);
|
|
133
|
+
itemFooter = signal({});
|
|
134
|
+
itemOfIndexHover;
|
|
135
|
+
keySearch = signal('');
|
|
136
|
+
totalItemInBackend = signal(0);
|
|
137
|
+
hasItemHightLight = signal(false);
|
|
138
|
+
totalItemDisplay = computed(() => viewDataNumberByLanguage((this.totalItem() ?? this.totalItemInBackend()), false));
|
|
139
|
+
hasScroll = signal(false);
|
|
140
|
+
instanceSort = signal(undefined);
|
|
141
|
+
hasActionButtonDropdownContent = signal(false);
|
|
142
|
+
pagingStore = signal({});
|
|
143
|
+
loadedLastItem = signal(false);
|
|
144
|
+
storeParamsCallApi = signal({});
|
|
145
|
+
timeoutLeaveItem = signal(undefined);
|
|
146
|
+
functionControlSelectMoreItem;
|
|
147
|
+
onDestroy = new Subject();
|
|
148
|
+
/** INPUT */
|
|
149
|
+
timeHighlighNewItem = input(2000, { transform: val => val ?? 2000 });
|
|
150
|
+
headerLeft = input([], { transform: val => val ?? [] });
|
|
151
|
+
headerRight = input([], { transform: val => val ?? [] });
|
|
152
|
+
configTemplateItemCollapseExpand = input();
|
|
153
|
+
showFooter = input();
|
|
154
|
+
ignoreBorderFooter = input();
|
|
155
|
+
customPositionFooter = input('bottom', { transform: val => val ?? 'bottom' });
|
|
156
|
+
footerLeft = input();
|
|
157
|
+
footerRight = input();
|
|
158
|
+
disableCheckbox = input(false, { transform: val => val ?? false });
|
|
159
|
+
enableUnequalChildrenSizes = input(false, { transform: val => val ?? false });
|
|
160
|
+
bufferAmount = input(5, { transform: val => val ? (val > 25 ? 25 : val) : 5 });
|
|
161
|
+
totalItem = input();
|
|
162
|
+
isDashBorder = input();
|
|
163
|
+
classHeaderInclude = input();
|
|
164
|
+
classBodyInclude = input('', { transform: val => val ?? '' });
|
|
165
|
+
classFooterInclude = input('', { transform: val => val ?? '' });
|
|
166
|
+
fieldKey = input('id', { transform: val => val || 'id' }); // tên field định danh item của listDatas
|
|
167
|
+
defaultKeysSelected = input();
|
|
168
|
+
labelBarNoSelectItem = input(`i18n_total_quantity`); // sử dụng để hiên thị khi tích chọn item
|
|
169
|
+
labelBarButtons = input('i18n_number_item_selected', { transform: val => val || 'i18n_number_item_selected' }); // sử dụng để hiên thị khi tích chọn item
|
|
170
|
+
classLabelBarButtons = input('', { transform: val => val ?? '' }); // sử dụng để hiên thị khi tích chọn item
|
|
171
|
+
barButtons = input();
|
|
172
|
+
sortLocal = input(); // trường hợp nếu sortLocal này không đáp ứng được nghiệp vụ thì mới cân nhắc sử dụng filterLocal
|
|
173
|
+
filterOrSortLocal = input();
|
|
174
|
+
httpRequestData = input();
|
|
175
|
+
httpRequestDataFooter = input();
|
|
176
|
+
newData = input();
|
|
177
|
+
filter = input({ filterData: {} }, { transform: val => val ?? { filterData: {} } });
|
|
178
|
+
ignoreBar = input();
|
|
179
|
+
classLabelBarNoSelectItem = input();
|
|
180
|
+
ignoreClassBgHeader = input();
|
|
181
|
+
noDataConfig = input({ textNoData: 'i18n_no_data_yet', textSearchNoData: 'i18n_no_result' });
|
|
182
|
+
ignoreBorderItemLast = input();
|
|
183
|
+
isHiddenHeaderWhenNodata = input();
|
|
184
|
+
maxItemSelected = input(100, { transform: val => val ?? 100 });
|
|
185
|
+
configSelectMoreItem = input();
|
|
186
|
+
onlyShowNoResult = input();
|
|
187
|
+
ignoreBorderItem = input();
|
|
188
|
+
/** OUTPUT */
|
|
189
|
+
outLoadMore = output();
|
|
190
|
+
outScrollIsGone = output();
|
|
191
|
+
outLoading = output();
|
|
192
|
+
outClickButtonAction = output();
|
|
193
|
+
outSort = output();
|
|
194
|
+
outClickBarButton = output();
|
|
195
|
+
outHoverButtonAction = output();
|
|
196
|
+
outKeysSelected = output();
|
|
197
|
+
outFunctionsControl = output();
|
|
198
|
+
outLoadDataComplete = output();
|
|
199
|
+
outTotalItem = output();
|
|
200
|
+
outLoadDataError = output();
|
|
201
|
+
/**VIEW CHILD */
|
|
202
|
+
headerElementRef = viewChild('headerElementRef');
|
|
203
|
+
footerElementRef = viewChild('footerElementRef');
|
|
204
|
+
footerLeftElementRef = viewChild('footerLeftElementRef');
|
|
205
|
+
bodyElementRef = viewChild('bodyElementRef');
|
|
206
|
+
bodyComponentRef = viewChild('bodyComponentRef');
|
|
207
|
+
;
|
|
208
|
+
httpRequestService = inject(LibsUiHttpRequestService);
|
|
209
|
+
constructor() {
|
|
210
|
+
effect(() => {
|
|
211
|
+
if (this.defaultKeysSelected()?.length) {
|
|
212
|
+
untracked(() => this.keysSelected.update(keys => ([...keys, ...(this.defaultKeysSelected() || [])])));
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
effect(() => {
|
|
216
|
+
if (this.showFooter()) {
|
|
217
|
+
untracked(() => this.callApiByServiceFooter());
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
effect(() => {
|
|
221
|
+
if (this.newData()?.data().length) {
|
|
222
|
+
untracked(() => this.addItems(this.newData()?.data, !this.newData()?.addToLastList));
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
effect(() => {
|
|
226
|
+
if (!this.filter().filterData || this.filter().ignoreCallApiAuto) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
untracked(() => {
|
|
230
|
+
this.keySearch.set(get(this.filter().filterData, 'keySearch', ''));
|
|
231
|
+
this.storeParamsCallApi.set(this.filter());
|
|
232
|
+
if (this.filter()?.filterData && !this.filter().filterData['instanceSort'] && this.instanceSort()) {
|
|
233
|
+
this.storeParamsCallApi.update(data => ({ ...data, instanceSort: this.instanceSort() }));
|
|
234
|
+
}
|
|
235
|
+
if (this.filterOrSortLocal() && this.stores().length) {
|
|
236
|
+
this.items.set(this.filterOrSortLocal()?.(signal([...this.stores()]), { ...(this.filter().filterData || {}), instanceSort: this.instanceSort() }) || []);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
this.callApiByService(true);
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
ngOnInit() {
|
|
244
|
+
this.outFunctionsControl.emit({
|
|
245
|
+
reset: this.reset.bind(this),
|
|
246
|
+
callApiByService: this.callApiByService.bind(this),
|
|
247
|
+
resetScroll: this.resetScroll.bind(this),
|
|
248
|
+
addItems: this.addItems.bind(this),
|
|
249
|
+
removeItems: this.removeItems.bind(this),
|
|
250
|
+
getCount: this.getCount.bind(this),
|
|
251
|
+
getScrollContainer: this.getScrollContainer.bind(this),
|
|
252
|
+
hideToolBarBottom: () => {
|
|
253
|
+
return;
|
|
254
|
+
},
|
|
255
|
+
resetKeySelected: () => this.keysSelected.set([])
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
getScrollContainer() {
|
|
259
|
+
return this.bodyComponentRef();
|
|
260
|
+
}
|
|
261
|
+
async callApiByService(firstCall, resetAfterCallApi) {
|
|
262
|
+
try {
|
|
263
|
+
if (firstCall) {
|
|
264
|
+
this.loadedLastItem.set(false);
|
|
265
|
+
}
|
|
266
|
+
if (!this.httpRequestData() || this.loading() || this.loadedLastItem()) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
this.loading.set(true);
|
|
270
|
+
this.outLoading.emit(this.loading());
|
|
271
|
+
this.resetIndexHover();
|
|
272
|
+
const { argumentsValue, guideAutoUpdateArgumentsValue } = this.httpRequestData();
|
|
273
|
+
if (guideAutoUpdateArgumentsValue && !guideAutoUpdateArgumentsValue.sortOrderBy && this.instanceSort()) {
|
|
274
|
+
guideAutoUpdateArgumentsValue.sortOrderBy = {
|
|
275
|
+
fieldGetValue: 'storeParamsCallApi.instanceSort.fieldSort',
|
|
276
|
+
fieldUpdate: '[0]',
|
|
277
|
+
subFieldUpdate: 'order_by'
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
if (guideAutoUpdateArgumentsValue && !guideAutoUpdateArgumentsValue.sortOrderType && this.instanceSort()) {
|
|
281
|
+
guideAutoUpdateArgumentsValue.sortOrderType = {
|
|
282
|
+
fieldGetValue: 'storeParamsCallApi.instanceSort.mode',
|
|
283
|
+
fieldUpdate: '[0]',
|
|
284
|
+
subFieldUpdate: 'order_type'
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
if (firstCall) {
|
|
288
|
+
if (!resetAfterCallApi) {
|
|
289
|
+
this.hasScroll.set(false);
|
|
290
|
+
this.stores.set([]);
|
|
291
|
+
this.items.set([]);
|
|
292
|
+
}
|
|
293
|
+
this.loadedLastItem.set(this.httpRequestService.updateArguments(argumentsValue, { ...this.fakeResponseApi(), storeParamsCallApi: this.storeParamsCallApi() }, this.pagingStore(), this.keySearch(), true, this.loadedLastItem(), guideAutoUpdateArgumentsValue));
|
|
294
|
+
}
|
|
295
|
+
const result = await this.httpRequestService.callApi(this.httpRequestData());
|
|
296
|
+
if (firstCall && resetAfterCallApi) {
|
|
297
|
+
this.hasScroll.set(false);
|
|
298
|
+
this.stores.set([]);
|
|
299
|
+
this.items.set([]);
|
|
300
|
+
}
|
|
301
|
+
this.pagingStore.set(result.paging);
|
|
302
|
+
this.totalItemInBackend.set(result.paging?.total_items || 0);
|
|
303
|
+
this.outTotalItem.emit(this.totalItemInBackend());
|
|
304
|
+
if (!this.pagingStore()) {
|
|
305
|
+
this.loadedLastItem.set(true);
|
|
306
|
+
}
|
|
307
|
+
this.loadedLastItem.set(this.httpRequestService.updateArguments(argumentsValue, { ...result, storeParamsCallApi: this.storeParamsCallApi() }, this.pagingStore(), this.keySearch(), true, this.loadedLastItem(), guideAutoUpdateArgumentsValue));
|
|
308
|
+
await this.addItems(convertObjectToSignal(result.data || []), false, true);
|
|
309
|
+
this.outLoadDataComplete.emit(this.stores);
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
console.log(error);
|
|
313
|
+
this.outLoadDataError.emit(error);
|
|
314
|
+
}
|
|
315
|
+
finally {
|
|
316
|
+
this.loading.set(false);
|
|
317
|
+
this.outLoading.emit(this.loading());
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
fakeResponseApi() {
|
|
321
|
+
this.loadedLastItem.set(false);
|
|
322
|
+
this.pagingStore.set({});
|
|
323
|
+
return this.httpRequestService.fakeResponsePagingApi();
|
|
324
|
+
}
|
|
325
|
+
async callApiByServiceFooter() {
|
|
326
|
+
if (!this.httpRequestDataFooter() || !this.showFooter()) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const { argumentsValue, guideAutoUpdateArgumentsValue } = this.httpRequestDataFooter();
|
|
330
|
+
this.httpRequestService.updateArguments(argumentsValue, { storeParamsCallApi: this.storeParamsCallApi() }, this.pagingStore(), this.keySearch(), true, false, guideAutoUpdateArgumentsValue);
|
|
331
|
+
const result = await this.httpRequestService.callApi(this.httpRequestDataFooter());
|
|
332
|
+
this.itemFooter.set(convertObjectToSignal(result.data)());
|
|
333
|
+
}
|
|
334
|
+
async addItems(items, addFirst, ignoreHightLight, ignoreReCallFooter, autoCountNewItem) {
|
|
335
|
+
if (!items() || !items().length) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const itemsAdd = [];
|
|
339
|
+
items().forEach(item => {
|
|
340
|
+
if (!this.checkExistItem(item)) {
|
|
341
|
+
itemsAdd.push(item);
|
|
342
|
+
if (!ignoreHightLight) {
|
|
343
|
+
this.hasItemHightLight.set(true);
|
|
344
|
+
item.update(data => ({ ...data, specificHightLight: true }));
|
|
345
|
+
}
|
|
346
|
+
if (addFirst) {
|
|
347
|
+
this.items.update(data => [item, ...data]);
|
|
348
|
+
this.stores.update(data => [item, ...data]);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
this.items.update(data => [...data, item]);
|
|
352
|
+
this.stores.update(data => [...data, item]);
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
if (autoCountNewItem && itemsAdd.length) {
|
|
356
|
+
this.totalItemInBackend.update(value => value + itemsAdd.length);
|
|
357
|
+
}
|
|
358
|
+
if (!ignoreHightLight) {
|
|
359
|
+
setTimeout(() => {
|
|
360
|
+
itemsAdd.forEach(item => item.update(data => ({ ...data, specificHightLight: false })));
|
|
361
|
+
this.hasItemHightLight.set(false);
|
|
362
|
+
}, this.timeHighlighNewItem());
|
|
363
|
+
}
|
|
364
|
+
await this.checkScroll();
|
|
365
|
+
if (!ignoreReCallFooter) {
|
|
366
|
+
await this.callApiByServiceFooter();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
checkExistItem(itemNew) {
|
|
370
|
+
return this.items().find(item => `${item()[this.fieldKey()]}` === `${itemNew()[this.fieldKey()]}`) ? true : false;
|
|
371
|
+
}
|
|
372
|
+
async removeItems(keys, ignoreReCallFooter) {
|
|
373
|
+
this.resetIndexHover();
|
|
374
|
+
if (!this.items().length) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
keys.forEach(key => {
|
|
378
|
+
this.items.update(items => {
|
|
379
|
+
let isUpdate = false;
|
|
380
|
+
const newItems = items.filter(item => {
|
|
381
|
+
if (`${item()[this.fieldKey()]}` === `${key}`) {
|
|
382
|
+
isUpdate = true;
|
|
383
|
+
return false;
|
|
384
|
+
}
|
|
385
|
+
return true;
|
|
386
|
+
});
|
|
387
|
+
return isUpdate ? newItems : items;
|
|
388
|
+
});
|
|
389
|
+
this.stores.update(items => {
|
|
390
|
+
let isUpdate = false;
|
|
391
|
+
const newItems = items.filter(item => {
|
|
392
|
+
if (`${item()[this.fieldKey()]}` === `${key}`) {
|
|
393
|
+
isUpdate = true;
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
return true;
|
|
397
|
+
});
|
|
398
|
+
return isUpdate ? newItems : items;
|
|
399
|
+
});
|
|
400
|
+
if (!this.keysSelected() || !this.keysSelected().length) {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
this.keysSelected.update(keys => keys.filter(keySelected => keySelected !== key));
|
|
404
|
+
});
|
|
405
|
+
this.totalItemInBackend.update(value => value - keys.length);
|
|
406
|
+
await this.checkScroll();
|
|
407
|
+
if (!ignoreReCallFooter) {
|
|
408
|
+
await this.callApiByServiceFooter();
|
|
409
|
+
}
|
|
410
|
+
this.outKeysSelected.emit({ keys: this.keysSelected() });
|
|
411
|
+
}
|
|
412
|
+
getCount() {
|
|
413
|
+
if (this.httpRequestData()) {
|
|
414
|
+
return this.pagingStore()?.total_items || this.items().length;
|
|
415
|
+
}
|
|
416
|
+
return this.items().length;
|
|
417
|
+
}
|
|
418
|
+
handlerScroll(e) {
|
|
419
|
+
e.stopPropagation();
|
|
420
|
+
this.headerElementRef().nativeElement.scrollLeft = e.target.scrollLeft;
|
|
421
|
+
if (this.footerElementRef()) {
|
|
422
|
+
this.footerElementRef().nativeElement.scrollLeft = e.target.scrollLeft;
|
|
423
|
+
}
|
|
424
|
+
this.resetIndexHover(e);
|
|
425
|
+
}
|
|
426
|
+
handlerScrollBottom(e) {
|
|
427
|
+
e.stopPropagation();
|
|
428
|
+
this.loadMore();
|
|
429
|
+
}
|
|
430
|
+
loadMore() {
|
|
431
|
+
if (this.loading()) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
this.outLoadMore.emit({ loadMoreSuccess: this.loadMoreSuccess.bind(this) });
|
|
435
|
+
this.callApiByService(false);
|
|
436
|
+
}
|
|
437
|
+
loadMoreSuccess(data) {
|
|
438
|
+
this.addItems(data, false);
|
|
439
|
+
this.loading.set(false);
|
|
440
|
+
this.outLoading.emit(this.loading());
|
|
441
|
+
}
|
|
442
|
+
handlerChangeAllChecked() {
|
|
443
|
+
this.keysSelected.set([]);
|
|
444
|
+
this.outKeysSelected.emit({ keys: this.keysSelected() });
|
|
445
|
+
}
|
|
446
|
+
handlerChangeCheckedAllItems(event) {
|
|
447
|
+
if (event.checked) {
|
|
448
|
+
this.keysSelected.set(this.items().filter(async (item) => !(await this.checkCancelConditionCheckedItem(item))).map(item => `${item()[this.fieldKey()]}`));
|
|
449
|
+
this.outKeysSelected.emit({ keys: this.keysSelected() });
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
this.keysSelected.set([]);
|
|
453
|
+
this.outKeysSelected.emit({ keys: this.keysSelected() });
|
|
454
|
+
}
|
|
455
|
+
async checkCancelConditionCheckedItem(item) {
|
|
456
|
+
let isCancelCheck = false;
|
|
457
|
+
if (!isCancelCheck && this.headerLeft().length && this.headerLeft()[0].checkConditionCheckBoxHidden) {
|
|
458
|
+
isCancelCheck = await lastValueFrom(this.headerLeft()[0].checkConditionCheckBoxHidden({ item: item() })) || false;
|
|
459
|
+
}
|
|
460
|
+
if (!isCancelCheck && this.headerRight().length && this.headerRight()[0].checkConditionCheckBoxHidden) {
|
|
461
|
+
isCancelCheck = await lastValueFrom(this.headerRight()[0].checkConditionCheckBoxHidden({ item: item() })) || false;
|
|
462
|
+
}
|
|
463
|
+
return isCancelCheck;
|
|
464
|
+
}
|
|
465
|
+
handlerChangeItemChecked(event, item) {
|
|
466
|
+
const key = item[this.fieldKey()];
|
|
467
|
+
const keys = new Set(this.keysSelected());
|
|
468
|
+
keys.add(key);
|
|
469
|
+
if (!event.checked) {
|
|
470
|
+
keys.delete(key);
|
|
471
|
+
}
|
|
472
|
+
this.keysSelected.set(Array.from(keys));
|
|
473
|
+
this.outKeysSelected.emit({ keys: this.keysSelected() });
|
|
474
|
+
}
|
|
475
|
+
handlerChangeSort(sort) {
|
|
476
|
+
if (this.instanceSort && this.instanceSort()?.fieldSort !== sort.fieldSort) {
|
|
477
|
+
this.instanceSort()?.reset();
|
|
478
|
+
}
|
|
479
|
+
this.instanceSort.set(sort);
|
|
480
|
+
if (this.sortLocal()) {
|
|
481
|
+
this.handlerSortLocal(sort);
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
this.storeParamsCallApi.update(data => ({ ...data, instanceSort: this.instanceSort() }));
|
|
485
|
+
this.callApiByService(true);
|
|
486
|
+
this.outSort.emit({
|
|
487
|
+
sort: sort,
|
|
488
|
+
onSortSuccess: this.onSortSuccess.bind(this)
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
handlerSortLocal(sort) {
|
|
492
|
+
if (this.filterOrSortLocal() && this.stores().length) {
|
|
493
|
+
this.items.set(this.filterOrSortLocal()?.(signal([...this.stores()]), { ...this.storeParamsCallApi(), instanceSort: sort }) || []);
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
const { fieldSort, mode } = sort;
|
|
497
|
+
this.items.update(items => {
|
|
498
|
+
items.sort((itemA, itemB) => {
|
|
499
|
+
let value1 = mode === 'asc' ? itemA()[fieldSort] : itemB()[fieldSort];
|
|
500
|
+
let value2 = mode === 'asc' ? itemB()[fieldSort] : itemA()[fieldSort];
|
|
501
|
+
if (typeof value1 === 'string' && typeof value2 === 'string') {
|
|
502
|
+
value1 = deleteUnicode(value1).toLocaleLowerCase();
|
|
503
|
+
value2 = deleteUnicode(value2).toLocaleLowerCase();
|
|
504
|
+
}
|
|
505
|
+
if (value1 === value2) {
|
|
506
|
+
return 0;
|
|
507
|
+
}
|
|
508
|
+
return value1 > value2 ? 1 : -1;
|
|
509
|
+
});
|
|
510
|
+
return [...items];
|
|
511
|
+
});
|
|
512
|
+
this.onSortSuccess();
|
|
513
|
+
}
|
|
514
|
+
handlerFunctionControlMoreSelectItem(functionControl) {
|
|
515
|
+
this.functionControlSelectMoreItem = functionControl;
|
|
516
|
+
}
|
|
517
|
+
handlerSelectedMoreItem(event) {
|
|
518
|
+
if (!event || !event.key || !this.configSelectMoreItem()) {
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
this.functionControlSelectMoreItem?.reset();
|
|
522
|
+
const perPage = Number(event.key).valueOf();
|
|
523
|
+
const currentPage = Number(this.setPerPageSelectMoreItem(perPage)).valueOf();
|
|
524
|
+
const isPagingNumber = this.configSelectMoreItem()?.pagingNumber;
|
|
525
|
+
if (currentPage > perPage || this.items.length >= perPage) {
|
|
526
|
+
if (!isPagingNumber) {
|
|
527
|
+
this.setPerPageSelectMoreItem(currentPage);
|
|
528
|
+
}
|
|
529
|
+
this.keysSelected.set(this.items().slice(0, perPage).map(item => `${item()[this.fieldKey()]}`));
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
this.callApiByService(true, true);
|
|
533
|
+
const sub = this.outLoadDataComplete.subscribe(() => {
|
|
534
|
+
sub.unsubscribe();
|
|
535
|
+
if (!isPagingNumber) {
|
|
536
|
+
this.setPerPageSelectMoreItem(currentPage);
|
|
537
|
+
}
|
|
538
|
+
this.keysSelected.set(this.items().slice(0, perPage).map(item => `${item()[this.fieldKey()]}`));
|
|
539
|
+
});
|
|
540
|
+
this.outLoadDataError.subscribe(() => {
|
|
541
|
+
this.setPerPageSelectMoreItem(currentPage);
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
setPerPageSelectMoreItem(perPage) {
|
|
545
|
+
const argumentsValue = this.httpRequestData()?.argumentsValue;
|
|
546
|
+
if (!argumentsValue || !this.configSelectMoreItem()) {
|
|
547
|
+
return '-1';
|
|
548
|
+
}
|
|
549
|
+
const keyPerPage = this.configSelectMoreItem()?.keyPerPage || 'per_page';
|
|
550
|
+
for (let i = 0; i < argumentsValue.length; i++) {
|
|
551
|
+
let argument = argumentsValue[i];
|
|
552
|
+
if (argument instanceof HttpParams && argument.has(keyPerPage)) {
|
|
553
|
+
const currentPerPage = argument.get(keyPerPage) || '25';
|
|
554
|
+
argument = argument.set(keyPerPage, perPage);
|
|
555
|
+
set(argumentsValue, `${i}`, argument);
|
|
556
|
+
return currentPerPage;
|
|
557
|
+
}
|
|
558
|
+
if (argument instanceof Object && Object.keys(argument).includes(keyPerPage)) {
|
|
559
|
+
const currentPerPage = argument.get(keyPerPage) || '25';
|
|
560
|
+
set(argument, keyPerPage, perPage);
|
|
561
|
+
return currentPerPage;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
return '-1';
|
|
565
|
+
}
|
|
566
|
+
onSortSuccess() {
|
|
567
|
+
this.loading.set(false);
|
|
568
|
+
this.outLoading.emit(this.loading());
|
|
569
|
+
this.resetScroll();
|
|
570
|
+
}
|
|
571
|
+
handlerButtonClick(type, buttonDropdownData, button) {
|
|
572
|
+
if (type === 'button') {
|
|
573
|
+
return this.outClickButtonAction.emit({ item: this.itemOfIndexHover, button: button });
|
|
574
|
+
}
|
|
575
|
+
this.outClickButtonAction.emit({ item: this.itemOfIndexHover, button, buttonDropdownData });
|
|
576
|
+
}
|
|
577
|
+
handlerBarButtonClick(button) {
|
|
578
|
+
const items = [];
|
|
579
|
+
this.keysSelected().forEach(key => {
|
|
580
|
+
const item = this.items().find(item => `${item()[this.fieldKey()]}` === `${key}`);
|
|
581
|
+
if (item) {
|
|
582
|
+
items.push(item);
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
return this.outClickBarButton.emit({
|
|
586
|
+
button,
|
|
587
|
+
items,
|
|
588
|
+
keys: this.keysSelected(),
|
|
589
|
+
hiddenBarButtons: () => {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
handlerButtonDropdownEvent(eventName) {
|
|
595
|
+
this.hasActionButtonDropdownContent.set(true);
|
|
596
|
+
if (eventName === 'remove' || eventName === 'mouseleave-content') {
|
|
597
|
+
this.hasActionButtonDropdownContent.set(false);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
setIndexHover(e, item) {
|
|
601
|
+
e.stopPropagation();
|
|
602
|
+
if (!this.items().length) {
|
|
603
|
+
this.resetIndexHover();
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
this.itemOfIndexHover = item;
|
|
607
|
+
}
|
|
608
|
+
resetIndexHoverWhenMouseLeave(e) {
|
|
609
|
+
e?.stopPropagation();
|
|
610
|
+
const currentIndexItemHover = this.itemOfIndexHover;
|
|
611
|
+
clearTimeout(this.timeoutLeaveItem());
|
|
612
|
+
this.timeoutLeaveItem.set(setTimeout(() => {
|
|
613
|
+
if (this.itemOfIndexHover && this.itemOfIndexHover !== currentIndexItemHover) {
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
this.resetIndexHover(e);
|
|
617
|
+
}));
|
|
618
|
+
}
|
|
619
|
+
resetIndexHover(e) {
|
|
620
|
+
e?.stopPropagation();
|
|
621
|
+
if (this.hasActionButtonDropdownContent()) {
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
this.itemOfIndexHover = undefined;
|
|
625
|
+
}
|
|
626
|
+
handlerMouseEnter(event) {
|
|
627
|
+
event.stopPropagation();
|
|
628
|
+
this.resetIndexHover(event);
|
|
629
|
+
if (this.classFooterInclude()) {
|
|
630
|
+
this.footerElementRef()?.nativeElement?.classList.remove('bg-[#f8f9fa]');
|
|
631
|
+
this.footerLeftElementRef()?.nativeElement?.classList.remove('bg-[#f8f9fa]');
|
|
632
|
+
this.footerElementRef()?.nativeElement?.classList.add(this.classFooterInclude());
|
|
633
|
+
this.footerLeftElementRef()?.nativeElement?.classList.add(this.classFooterInclude());
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
handlerMouseLeave(event) {
|
|
637
|
+
event.stopPropagation();
|
|
638
|
+
if (this.classFooterInclude()) {
|
|
639
|
+
this.footerElementRef()?.nativeElement?.classList.remove(this.classFooterInclude());
|
|
640
|
+
this.footerLeftElementRef()?.nativeElement?.classList.remove(this.classFooterInclude());
|
|
641
|
+
this.footerElementRef()?.nativeElement?.classList.add('bg-[#f8f9fa]');
|
|
642
|
+
this.footerLeftElementRef()?.nativeElement?.classList.add('bg-[#f8f9fa]');
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
resetScroll() {
|
|
646
|
+
if (this.headerElementRef()) {
|
|
647
|
+
this.headerElementRef().nativeElement.scrollLeft = 0;
|
|
648
|
+
}
|
|
649
|
+
if (this.BodyElement) {
|
|
650
|
+
this.BodyElement.scrollTop = 0;
|
|
651
|
+
this.BodyElement.scrollLeft = 0;
|
|
652
|
+
}
|
|
653
|
+
if (this.footerElementRef()) {
|
|
654
|
+
this.footerElementRef().nativeElement.scrollLeft = 0;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
reset(clearSort) {
|
|
658
|
+
if (clearSort) {
|
|
659
|
+
this.instanceSort()?.reset();
|
|
660
|
+
this.instanceSort.set(undefined);
|
|
661
|
+
}
|
|
662
|
+
this.hasScroll.set(false);
|
|
663
|
+
this.loading.set(false);
|
|
664
|
+
this.outLoading.emit(this.loading());
|
|
665
|
+
this.items.set([]);
|
|
666
|
+
this.stores.set([]);
|
|
667
|
+
this.fakeResponseApi();
|
|
668
|
+
}
|
|
669
|
+
async checkScroll() {
|
|
670
|
+
const hasScroll = this.hasScroll();
|
|
671
|
+
return new Promise(resolve => {
|
|
672
|
+
timer(500).pipe(takeUntil(this.onDestroy)).subscribe(() => {
|
|
673
|
+
if (this.BodyElement) {
|
|
674
|
+
this.hasScroll.set(this.BodyElement.scrollHeight > this.BodyElement.offsetHeight);
|
|
675
|
+
}
|
|
676
|
+
if (hasScroll && !this.hasScroll()) {
|
|
677
|
+
this.outScrollIsGone.emit({});
|
|
678
|
+
if (!this.filterOrSortLocal()) {
|
|
679
|
+
this.callApiByService(true);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
resolve();
|
|
683
|
+
});
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
get BodyElement() {
|
|
687
|
+
return this.bodyElementRef()?.nativeElement;
|
|
688
|
+
}
|
|
689
|
+
ngOnDestroy() {
|
|
690
|
+
this.onDestroy.next();
|
|
691
|
+
this.onDestroy.complete();
|
|
692
|
+
clearTimeout(this.timeoutLeaveItem());
|
|
693
|
+
}
|
|
694
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
695
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsTableComponent, isStandalone: true, selector: "libs_ui-components-table", inputs: { timeHighlighNewItem: { classPropertyName: "timeHighlighNewItem", publicName: "timeHighlighNewItem", isSignal: true, isRequired: false, transformFunction: null }, headerLeft: { classPropertyName: "headerLeft", publicName: "headerLeft", isSignal: true, isRequired: false, transformFunction: null }, headerRight: { classPropertyName: "headerRight", publicName: "headerRight", isSignal: true, isRequired: false, transformFunction: null }, configTemplateItemCollapseExpand: { classPropertyName: "configTemplateItemCollapseExpand", publicName: "configTemplateItemCollapseExpand", isSignal: true, isRequired: false, transformFunction: null }, showFooter: { classPropertyName: "showFooter", publicName: "showFooter", isSignal: true, isRequired: false, transformFunction: null }, ignoreBorderFooter: { classPropertyName: "ignoreBorderFooter", publicName: "ignoreBorderFooter", isSignal: true, isRequired: false, transformFunction: null }, customPositionFooter: { classPropertyName: "customPositionFooter", publicName: "customPositionFooter", isSignal: true, isRequired: false, transformFunction: null }, footerLeft: { classPropertyName: "footerLeft", publicName: "footerLeft", isSignal: true, isRequired: false, transformFunction: null }, footerRight: { classPropertyName: "footerRight", publicName: "footerRight", isSignal: true, isRequired: false, transformFunction: null }, disableCheckbox: { classPropertyName: "disableCheckbox", publicName: "disableCheckbox", isSignal: true, isRequired: false, transformFunction: null }, enableUnequalChildrenSizes: { classPropertyName: "enableUnequalChildrenSizes", publicName: "enableUnequalChildrenSizes", isSignal: true, isRequired: false, transformFunction: null }, bufferAmount: { classPropertyName: "bufferAmount", publicName: "bufferAmount", isSignal: true, isRequired: false, transformFunction: null }, totalItem: { classPropertyName: "totalItem", publicName: "totalItem", isSignal: true, isRequired: false, transformFunction: null }, isDashBorder: { classPropertyName: "isDashBorder", publicName: "isDashBorder", isSignal: true, isRequired: false, transformFunction: null }, classHeaderInclude: { classPropertyName: "classHeaderInclude", publicName: "classHeaderInclude", isSignal: true, isRequired: false, transformFunction: null }, classBodyInclude: { classPropertyName: "classBodyInclude", publicName: "classBodyInclude", isSignal: true, isRequired: false, transformFunction: null }, classFooterInclude: { classPropertyName: "classFooterInclude", publicName: "classFooterInclude", isSignal: true, isRequired: false, transformFunction: null }, fieldKey: { classPropertyName: "fieldKey", publicName: "fieldKey", isSignal: true, isRequired: false, transformFunction: null }, defaultKeysSelected: { classPropertyName: "defaultKeysSelected", publicName: "defaultKeysSelected", isSignal: true, isRequired: false, transformFunction: null }, labelBarNoSelectItem: { classPropertyName: "labelBarNoSelectItem", publicName: "labelBarNoSelectItem", isSignal: true, isRequired: false, transformFunction: null }, labelBarButtons: { classPropertyName: "labelBarButtons", publicName: "labelBarButtons", isSignal: true, isRequired: false, transformFunction: null }, classLabelBarButtons: { classPropertyName: "classLabelBarButtons", publicName: "classLabelBarButtons", isSignal: true, isRequired: false, transformFunction: null }, barButtons: { classPropertyName: "barButtons", publicName: "barButtons", isSignal: true, isRequired: false, transformFunction: null }, sortLocal: { classPropertyName: "sortLocal", publicName: "sortLocal", isSignal: true, isRequired: false, transformFunction: null }, filterOrSortLocal: { classPropertyName: "filterOrSortLocal", publicName: "filterOrSortLocal", isSignal: true, isRequired: false, transformFunction: null }, httpRequestData: { classPropertyName: "httpRequestData", publicName: "httpRequestData", isSignal: true, isRequired: false, transformFunction: null }, httpRequestDataFooter: { classPropertyName: "httpRequestDataFooter", publicName: "httpRequestDataFooter", isSignal: true, isRequired: false, transformFunction: null }, newData: { classPropertyName: "newData", publicName: "newData", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, ignoreBar: { classPropertyName: "ignoreBar", publicName: "ignoreBar", isSignal: true, isRequired: false, transformFunction: null }, classLabelBarNoSelectItem: { classPropertyName: "classLabelBarNoSelectItem", publicName: "classLabelBarNoSelectItem", isSignal: true, isRequired: false, transformFunction: null }, ignoreClassBgHeader: { classPropertyName: "ignoreClassBgHeader", publicName: "ignoreClassBgHeader", isSignal: true, isRequired: false, transformFunction: null }, noDataConfig: { classPropertyName: "noDataConfig", publicName: "noDataConfig", isSignal: true, isRequired: false, transformFunction: null }, ignoreBorderItemLast: { classPropertyName: "ignoreBorderItemLast", publicName: "ignoreBorderItemLast", isSignal: true, isRequired: false, transformFunction: null }, isHiddenHeaderWhenNodata: { classPropertyName: "isHiddenHeaderWhenNodata", publicName: "isHiddenHeaderWhenNodata", isSignal: true, isRequired: false, transformFunction: null }, maxItemSelected: { classPropertyName: "maxItemSelected", publicName: "maxItemSelected", isSignal: true, isRequired: false, transformFunction: null }, configSelectMoreItem: { classPropertyName: "configSelectMoreItem", publicName: "configSelectMoreItem", isSignal: true, isRequired: false, transformFunction: null }, onlyShowNoResult: { classPropertyName: "onlyShowNoResult", publicName: "onlyShowNoResult", isSignal: true, isRequired: false, transformFunction: null }, ignoreBorderItem: { classPropertyName: "ignoreBorderItem", publicName: "ignoreBorderItem", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { outLoadMore: "outLoadMore", outScrollIsGone: "outScrollIsGone", outLoading: "outLoading", outClickButtonAction: "outClickButtonAction", outSort: "outSort", outClickBarButton: "outClickBarButton", outHoverButtonAction: "outHoverButtonAction", outKeysSelected: "outKeysSelected", outFunctionsControl: "outFunctionsControl", outLoadDataComplete: "outLoadDataComplete", outTotalItem: "outTotalItem", outLoadDataError: "outLoadDataError" }, viewQueries: [{ propertyName: "headerElementRef", first: true, predicate: ["headerElementRef"], descendants: true, isSignal: true }, { propertyName: "footerElementRef", first: true, predicate: ["footerElementRef"], descendants: true, isSignal: true }, { propertyName: "footerLeftElementRef", first: true, predicate: ["footerLeftElementRef"], descendants: true, isSignal: true }, { propertyName: "bodyElementRef", first: true, predicate: ["bodyElementRef"], descendants: true, isSignal: true }, { propertyName: "bodyComponentRef", first: true, predicate: ["bodyComponentRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class='flex flex-col w-full h-full'>\n @if (!ignoreBar()) {\n <div\n class=\"flex items-center justify-between relative z-[1] bottom-0 left-0 w-full bg-white mb-[16px] libs-ui-table-shadow-bottom\"\n [class.px-[16px]]=\"keysSelected().length || labelBarNoSelectItem()\"\n [class.py-[6px]]=\"keysSelected().length || labelBarNoSelectItem()\"\n (mouseenter)=\"resetIndexHover($event)\">\n @if (!keysSelected().length && labelBarNoSelectItem()) {\n <div class=\"{{ classLabelBarNoSelectItem() ?? 'px-[12px] py-[5px]' }}\"\n [innerHtml]='labelBarNoSelectItem() | translate:{value:totalItemDisplay()}'>\n </div>\n }\n @if (keysSelected().length) {\n <div class=\"flex items-center pl-[12px]\">\n <div class=\"flex items-center h-full mt-[-2px]\">\n <libs_ui-components-checkbox-single [checked]=\"true\"\n [disable]=\"loading() || disableCheckbox()\"\n (outChange)=\"handlerChangeAllChecked()\" />\n </div>\n <div class=\"libs-ui-font-h5m text-[#071631] mr-[8px] {{ classLabelBarButtons() }}\">\n {{ labelBarButtons() | translate:{ value:keysSelected().length } }}\n </div>\n @if (configSelectMoreItem()) {\n <libs_ui-components-dropdown [isNgContent]=\"true\"\n [popoverCustomConfig]=\"{\n widthByParent:false,\n ignoreArrow: true,\n maxHeight: 2048,\n classInclude:'w-[121px]',\n position: {\n mode:'start',\n distance:0\n }\n }\"\n [listConfig]=\"({\n type:'text',\n configTemplateText:{\n fieldKey:'key',\n ignoreIconSelected:true,\n getValue:configSelectMoreItem()?.getValue\n }\n } | LibsUiPipesConvertObjectToSignalPipe:true)()\"\n [listMaxItemShow]=\"5\"\n class=\"w-[16px] h-[16px] mr-[8px]\"\n (outSelectKey)=\"handlerSelectedMoreItem($event)\"\n (outFunctionsControl)=\"handlerFunctionControlMoreSelectItem($event)\">\n <libs_ui-components-buttons-button [type]=\"'button-link-primary'\"\n [classInclude]=\"'p-0 m-0'\"\n [classIconLeft]=\"'before:!text-[16px] libs-ui-con-dropdown mr-[6px]'\"\n [popover]=\"{config:{content:'i18n_more_select'}}\"\n [ignoreStopPropagationEvent]=\"true\" />\n </libs_ui-components-dropdown>\n }\n <div class=\"h-[16px] libs-ui-border-left-general ml-[16px]\"></div>\n @if (barButtons()?.length) {\n @for (button of barButtons();track button) {\n <libs_ui-components-buttons-button [type]=\"button.type || 'button-link-primary'\"\n [classIconLeft]=\"button.classIconLeft || ''\"\n [classInclude]=\"button.classInclude || ''\"\n [label]=\"(button.label || ' ') | translate\"\n (outClick)=\"handlerBarButtonClick(button)\" />\n }\n }\n </div>\n }\n <ng-content select='div.libs-ui-table-bar-right'></ng-content>\n </div>\n }\n\n <div #tableContainerElementRef\n class=\"libs-ui-table flex flex-col w-full h-full relative\"\n [class.px-[16px]]='!ignoreBar()'\n (mouseleave)=\"resetIndexHover($event)\">\n <div #headerElementRef\n [class.libs-ui-border-bottom-dashed-general]=\"!hasItemHightLight() && isDashBorder()\"\n [class.libs-ui-border-bottom-general]=\"!hasItemHightLight() && !isDashBorder()\"\n [class.!hidden]=\"!items().length && isHiddenHeaderWhenNodata()\"\n [class]=\"classHeaderContainer()\"\n (mouseenter)=\"resetIndexHover($event)\">\n @if (headerLeft().length) {\n <div class=\"h-full flex sticky top-0 left-0 bg-[#ffffff] z-[1]\">\n @for (header of headerLeft();track header) {\n <ng-container *ngTemplateOutlet=\"templateHeaderRef;context:{headerItem:header,isHederLeft:true}\" />\n }\n </div>\n }\n @if (headerRight().length) {\n @for (header of headerRight();track header) {\n <ng-container *ngTemplateOutlet=\"templateHeaderRef;context:{headerItem:header,isHederLeft:false}\" />\n }\n }\n </div>\n @if (showFooter() && itemFooter() && customPositionFooter() === 'top') {\n <ng-container *ngTemplateOutlet='templateFooterRef' />\n }\n <div class=\"relative flex flex-col w-full h-full overflow-x-hidden bg-white {{ classBodyInclude() || '' }}\">\n @if (items().length) {\n <div #bodyElementRef\n class=\"flex h-full w-full relative\"\n LibsUiComponentsScrollOverlayDirective\n [options]=\"{scrollX: (!headerLeft().length || !headerRight()) ? 'hidden':'scroll'}\"\n (outScroll)=\"handlerScroll($event)\"\n (outScrollBottom)=\"handlerScrollBottom($event)\">\n <virtual-scroller #bodyComponentRef\n [items]=\"items()\"\n [enableUnequalChildrenSizes]=\"enableUnequalChildrenSizes()\"\n class=\"h-full\"\n [style.width.px]=\"headerElementRef.scrollWidth > (bodyElementRef ? bodyElementRef.scrollWidth : 0) ? headerElementRef.scrollWidth: undefined\"\n [parentScroll]=\"bodyElementRef\"\n [bufferAmount]=\"bufferAmount()\">\n @for (data of bodyComponentRef.viewPortItems;track data()) {\n <div #elementHover\n class=\"flex\"\n [class.bg-[#f3fcfc]]=\"data().specificHightLight\"\n [class.libs-ui-border-top-1px-36d3d3]=\"data().specificHightLight && $first && !ignoreBorderItem()\"\n [class.libs-ui-border-bottom-1px-36d3d3]=\"data().specificHightLight && !ignoreBorderItem()\"\n [ngClass]=\"(data().specificHightLight || ($last && ignoreBorderItemLast())) ? 'libs-ui-border-radius-bottom-left-4px libs-ui-border-radius-bottom-right-4px' : ignoreBorderItem() ? '' : isDashBorder() ? 'libs-ui-border-bottom-dashed-general' : 'libs-ui-border-bottom-general'\"\n [style.width.px]=\"headerElementRef.scrollWidth\"\n [class.bg-[#f8f9fa]]=\"itemOfIndexHover === data && !data().specificHightLight\"\n (mouseenter)=\"setIndexHover($event,data)\"\n (mouseleave)=\"resetIndexHoverWhenMouseLeave($event)\">\n @if (headerLeft().length || headerRight().length) {\n <div class=\"flex flex-col w-full\">\n <div class=\"flex w-full\">\n @if (headerLeft().length) {\n <div class=\"flex sticky top-0 left-0 z-[1]\"\n [class.bg-white]=\"!data().specificHightLight\"\n [class.bg-[#f3fcfc]]=\"data().specificHightLight\">\n @for (header of headerLeft();track header) {\n <div\n class=\"relative flex px-[12px] py-[8px] {{ header.ignoreBorderRight ? '': 'libs-ui-border-right-general' }}\"\n [class.bg-[#f8f9fa]]=\"itemOfIndexHover === data && !data().specificHightLight\"\n [ngStyle]=\"header.ngStyle || {}\"\n [ngClass]=\"header.ngClass || {}\">\n <ng-container *ngTemplateOutlet=\"templateBodyRef;context:{header:header,data:data}\" />\n </div>\n }\n </div>\n }\n @if (headerRight().length) {\n @for (header of headerRight();track header) {\n <div class=\"relative flex px-[12px] py-[8px]\"\n [ngStyle]=\"header.ngStyle || {}\"\n [ngClass]=\"header.ngClass || {}\">\n <ng-container *ngTemplateOutlet=\"templateBodyRef;context:{header:header,data:data}\" />\n </div>\n }\n }\n </div>\n @if (configTemplateItemCollapseExpand() && data().specificExpand && data()[configTemplateItemCollapseExpand()?.fieldGetDataExpand || 'specificDataExpand']) {\n <div [class]=\"configTemplateItemCollapseExpand()?.cssWrapper || 'flex w-full'\">\n @for (dataExpand of data()[configTemplateItemCollapseExpand()?.fieldGetDataExpand || 'specificDataExpand']();track $index) {\n @if (configTemplateItemCollapseExpand()?.colTemplateConfig) {\n <libs_ui-components-table-templates [item]=\"dataExpand\"\n [templateCssWrapper]=\"configTemplateItemCollapseExpand()?.templateCssWrapper\"\n [configs]=\"configTemplateItemCollapseExpand()?.colTemplateConfig\" />\n }\n } @empty {\n <div class=\"relative h-[100px]\">\n <ng-container *ngTemplateOutlet=\"templateNodataRef\" />\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n </virtual-scroller>\n\n @if ((!items().length) && !loading() && noDataConfig()) {\n <div class=\"h-full\"\n [style.flex]=\"'0 0 '+headerElementRef.scrollWidth+'px'\">\n </div>\n }\n </div>\n }\n @if ((!items().length) && !loading()) {\n <div class=\"relative h-full w-full\">\n <ng-container *ngTemplateOutlet=\"templateNodataRef\" />\n </div>\n }\n\n @if (showFooter() && itemFooter() && customPositionFooter() === 'bottom') {\n <ng-container *ngTemplateOutlet='templateFooterRef' />\n }\n\n @if (loading()) {\n <div class=\"absolute w-full h-full z-[2] flex items-center content-center\">\n <libs_ui-components-spinner />\n </div>\n }\n </div>\n </div>\n</div>\n\n<ng-template #templateHeaderRef\n let-header='headerItem'\n let-isHederLeft='isHederLeft'>\n <div\n [class]=\"'relative flex '+ (header.paddingLeftRightHeaderContainer ?? ' px-[12px] ') + (isHederLeft && !header.ignoreBorderRight ? ' libs-ui-border-right-general ' : ' ')+ ' libs-ui-table-header-col '\"\n [class.flex-col]=\"header.rowsConfig\"\n [class.py-[8px]]='!header.ignorePyDefault'\n [ngStyle]=\"header.ngStyle || {}\"\n [ngClass]=\"header.ngClass || {}\">\n @if (!header.rowsConfig) {\n <ng-container *ngTemplateOutlet=\"templateHeaderContentRef;context:{headerItem:header,isColRender:false}\" />\n }\n @if (header.rowsConfig;as rowsConfig) {\n @for (row of rowsConfig.rows;track row) {\n <div [class]=\"row.classRow\">\n @for (col of row.cols ; track col) {\n <ng-container *ngTemplateOutlet=\"templateHeaderContentRef;context:{headerItem:col,isColRender:true}\" />\n }\n </div>\n }\n }\n </div>\n</ng-template>\n\n<ng-template #templateHeaderContentRef\n let-header='headerItem'\n let-isColRender='isColRender'>\n <div class=\"flex libs-ui-font-h6m min-h-[18px] text-[#6a7383] max-w-full\"\n [class.items-center]='header.contentHeaderAlignCenter ?? true'\n [class.justify-end]='header.contentHeaderJustifyContentEnd'\n [ngStyle]=\"isColRender ? (header.ngStyle || {}) : {}\"\n [ngClass]=\"isColRender ? (header.ngClass || {}) : {}\">\n @if (header.hasCheckbox && !header.hasCheckboxAll) {\n <div class=\"flex h-full ml-[24px] {{ header.checkboxClassInclude }}\">\n </div>\n }\n @if (header.hasCheckboxAll) {\n <div class=\"flex h-full {{ header.checkboxAllClassInclude || 'mr-[16px]' }}\"\n [class.items-center]=\"header.checkboxAlignCenter\">\n <libs_ui-components-checkbox-single [key]=\"'all'\"\n [stillOtherOptions]=\"!!keysSelected().length && keysSelected().length !== items().length\"\n [checked]=\"!!keysSelected().length && keysSelected().length === items().length\"\n [disable]=\"loading()\"\n [classInclude]=\"header.checkboxClassInclude\"\n (outChange)=\"handlerChangeCheckedAllItems($event)\" />\n </div>\n }\n @if ((header.label | LibsUiPipesCallFunctionInTemplatePipe:header.parseValue:header)| async | translate; as labelHeaderColumn) {\n <libs_ui-components-popover [type]=\"header?.labelConfig?.type || 'text'\"\n [mode]=\"header?.labelConfig?.mode || 'hover'\"\n [classInclude]=\"(header?.labelConfig?.classInclude || '')\"\n [ignoreShowPopover]=\"header?.labelConfig?.ignoreShowTooltip || false\"\n [config]=\"header.labelConfig?.config || {content:labelHeaderColumn}\"\n [innerHTML]=\"labelHeaderColumn\" />\n }\n\n @if (header.tooltipOther; as tooltip) {\n <div class=\"ml-[4px]\">\n <libs_ui-components-popover [type]=\"tooltip?.type || 'other'\"\n [mode]=\"tooltip?.mode || 'hover'\"\n [classInclude]=\"tooltip.classInclude || 'text-[#6a7383]'\"\n [ignoreShowPopover]=\"tooltip.ignoreShowTooltip || false\"\n [config]=\"tooltip.config || {content:(tooltip.dataView || ' ') | translate, position: {\n mode: 'center',\n distance: 0,\n autoUpdatePosition: {\n endDistance: 12,\n startDistance: -12\n }\n }}\"\n [innerHTML]=\"tooltip.dataView\" />\n </div>\n }\n\n @if (header.hasSort && header.orderby) {\n <div class=\"ml-[4px]\">\n <libs_ui-components-buttons-sort-arrow [disable]=\"loading() || !items().length\"\n [fieldSort]=\"header.orderby\"\n [ignorePopoverContent]=\"header.sortIgnoreTooltipContent ?? true\"\n [popoverContentAsc]=\"header.sortTooltipContentAsc\"\n [popoverContentDesc]=\"header.sortTooltipContentDesc\"\n [defaultMode]=\"header.defaultMode\"\n [zIndex]=\"header.zIndexTooltipSort\"\n (outChange)=\"handlerChangeSort($event)\" />\n </div>\n }\n </div>\n @if (header.labelDescription) {\n <div class=\"flex\">\n <libs_ui-components-popover [type]=\"'text'\"\n [classInclude]=\"header.labelDescription.classInclude || ''\"\n [config]=\"{content: header.labelDescription.content | translate}\"\n [innerHTML]=\"header.labelDescription.content | translate\" />\n </div>\n }\n</ng-template>\n\n<ng-template #templateBodyRef\n let-header='header'\n let-data='data'>\n <div class=\"flex w-full h-full\">\n @if (header.hasCheckbox) {\n <div class=\"flex h-full\"\n [class.invisible]=\"header.checkConditionCheckBoxHidden &&( data() | LibsUiPipesCallFunctionInTemplatePipe:header.checkConditionCheckBoxHidden:data() | async)\"\n [class.items-center]=\"header.checkboxAlignCenter\">\n <libs_ui-components-checkbox-single [key]=\"data()[fieldKey()]\"\n [classInclude]=\"header.checkboxClassInclude\"\n [checked]=\"data()[fieldKey()] | LibsUiPipesCheckSelectedByKeyPipe:keysSelected():keysSelected().length\"\n [disable]=\"loading() || disableCheckbox() || !!(maxItemSelected() && !(data()[fieldKey()] | LibsUiPipesCheckSelectedByKeyPipe:keysSelected():keysSelected().length) && keysSelected().length >= maxItemSelected())\"\n (outChange)=\"handlerChangeItemChecked($event,data())\" />\n </div>\n }\n\n @if (header.colTemplateConfig) {\n <libs_ui-components-table-templates [isHover]=\"itemOfIndexHover === data && !data.specificHightLight\"\n [class]=\"header.templateCssWrapperHost || ''\"\n [item]=\"data\"\n [templateCssWrapper]=\"header.templateCssWrapper\"\n [configs]=\"header.colTemplateConfig\" />\n }\n </div>\n</ng-template>\n\n<ng-template #templateFooterRef>\n @if (!isHiddenHeaderWhenNodata() || (isHiddenHeaderWhenNodata() && items().length)) {\n <div #footerElementRef\n class=\"flex w-full bg-[#f8f9fa] overflow-x-hidden z-[1] {{ ignoreBorderFooter() ? '': (customPositionFooter() === 'top' ? 'libs-ui-border-bottom-general':'libs-ui-table-shadow-top libs-ui-border-top-general') }} min-h-[35px]\"\n (mouseenter)=\"handlerMouseEnter($event)\"\n (mouseleave)=\"handlerMouseLeave($event)\">\n @if (footerLeft()) {\n <div #footerLeftElementRef\n class=\"flex sticky top-0 left-0 z-[1] bg-[#f8f9fa]\">\n @for (footer of footerLeft();track footer) {\n <div\n class=\"flex items-center px-[12px] py-[8px] {{ footer.ignoreBorderRight ? '': 'libs-ui-border-right-general' }}\"\n [ngStyle]=\"footer.ngStyle || {}\"\n [ngClass]=\"footer.ngClass || {}\">\n @if (footer.colTemplateConfig) {\n <libs_ui-components-table-templates [item]=\"itemFooter\"\n [templateCssWrapper]=\"footer.templateCssWrapper\"\n [configs]=\"footer.colTemplateConfig\" />\n }\n </div>\n }\n </div>\n }\n @if (footerRight()) {\n @for (footer of footerRight();track footer) {\n <div class=\"flex items-center px-[12px] py-[8px]\"\n [ngStyle]=\"footer.ngStyle || {}\"\n [ngClass]=\"footer.ngClass || {}\">\n @if (footer.colTemplateConfig) {\n <libs_ui-components-table-templates [item]=\"itemFooter\"\n [templateCssWrapper]=\"footer.templateCssWrapper\"\n [configs]=\"footer.colTemplateConfig\" />\n }\n </div>\n }\n }\n\n </div>\n }\n</ng-template>\n\n<ng-template #templateNodataRef>\n @if (noDataConfig(); as config) {\n <div class=\"flex items-center justify-center w-full h-full absolute left-0 top-0 z-[1]\">\n <div class=\"flex flex-col items-center justify-center w-full h-full shrink-0\"\n LibsUiComponentsScrollOverlayDirective>\n @if (!keySearch() && !onlyShowNoResult()) {\n <ng-container *ngComponentOutlet=\" ('no-data' | LibsUiIconsGetIconComponentPipe | async);inputs:{size:64}\" />\n <div class=\"libs-ui-table-no-data-config-text\"\n [ngStyle]=\"config.ngStyle || {}\"\n [ngClass]=\"config.ngClass || {}\"\n [innerHtml]=\"config.textNoData | translate\">\n </div>\n }\n @if (keySearch() || onlyShowNoResult()) {\n <ng-container *ngComponentOutlet=\"('no-result' | LibsUiIconsGetIconComponentPipe | async);inputs:{size:64}\" />\n <div class=\"libs-ui-table-no-data-config-text\"\n [ngStyle]=\"config.ngStyle || {}\"\n [ngClass]=\"config.ngClass || {}\"\n [innerHtml]=\"config.textSearchNoData | translate\">\n </div>\n }\n </div>\n </div>\n }\n</ng-template>\n", styles: [".libs-ui-table-header-container{height:33px;flex-shrink:0}.libs-ui-table-header-col{height:100%;width:100%;align-items:center}.libs-ui-table-no-data-config-text{margin-top:16px;font-size:12px;color:#9ca2ad;font-family:var(--libs-ui-font-family-name, \"Arial\");font-weight:400}.libs-ui-table-no-data-config-icon{margin-bottom:12px}.libs-ui-table-no-data-config-icon:before{font-size:84px;color:#c1c1c1}.libs-ui-table-shadow-bottom{box-shadow:0 1px 1px #00143305,0 4px 8px #0014330a}@media only screen and (min-width: 1921px){.libs-ui-border-bottom-general{border-bottom:solid 2px #e6e8ed!important}}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "component", type: LibsUiComponentsTableTemplatesComponent, selector: "libs_ui-components-table-templates", inputs: ["isHover", "configs", "templateCssWrapper", "item"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: VirtualScrollerModule }, { kind: "component", type: i2.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: "component", type: LibsUiComponentsButtonsButtonComponent, selector: "libs_ui-components-buttons-button", inputs: ["flagMouse", "type", "buttonCustom", "sizeButton", "label", "disable", "isPending", "imageLeft", "classInclude", "classIconLeft", "classIconRight", "classLabel", "iconOnlyType", "popover", "ignoreStopPropagationEvent", "zIndex", "widthLabelPopover", "styleIconLeft", "styleButton", "ignoreFocusWhenInputTab", "ignoreSetClickWhenShowPopover", "ignorePointerEvent", "isActive"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsDropdownComponent, selector: "libs_ui-components-dropdown", inputs: ["useXssFilter", "popoverElementRefCustom", "classInclude", "ignoreStopPropagationEvent", "flagMouse", "flagMouseContent", "popoverCustomConfig", "isNgContent", "zIndex", "convertItemSelected", "getPopoverItemSelected", "httpRequestDetailItemById", "lengthKeys", "textDisplayWhenNoSelect", "textDisplayWhenMultiSelect", "classIncludeTextDisplayWhenNoSelect", "fieldGetLabel", "labelPopoverConfig", "labelPopoverFullWidth", "hasContentUnitRight", "listSearchNoDataTemplateRef", "fieldGetImage", "imageSize", "typeShape", "fieldGetIcon", "fieldGetTextAvatar", "fieldGetColorAvatar", "classAvatarInclude", "getLastTextAfterSpace", "linkImageError", "showError", "showBorderError", "disable", "readonly", "labelConfig", "listSearchConfig", "isSearchOnline", "listHiddenInputSearch", "listSearchPadding", "listKeySearch", "listDividerClassInclude", "listConfig", "listButtonsOther", "listHasButtonUnSelectOption", "listClickExactly", "listBackgroundCustom", "listMaxItemShow", "listKeySelected", "listMultiKeySelected", "listKeysDisable", "listKeysHidden", "validRequired", "validMaxItemSelected", "changeValidUndefinedResetError", "allowSelectItemMultiple", "focusInputSearch", "onlyEmitDataWhenReset", "resetKeyWhenSelectAllKey", "listConfigHasDivider", "classIncludeIcon", "classIncludeContent", "listIgnoreClassDisableDefaultWhenUseKeysDisableItem", "tabKeyActive", "tabsConfig", "ignoreBorderBottom"], outputs: ["flagMouseChange", "flagMouseContentChange", "lengthKeysChange", "showBorderErrorChange", "listKeySelectedChange", "listMultiKeySelectedChange", "tabKeyActiveChange", "outSelectKey", "outSelectMultiKey", "outFunctionsControl", "outValidEvent", "outChangStageFlagMouse", "outDataChange", "outClickButtonOther", "outShowList", "outChangeTabKeyActive"] }, { 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: "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"], outputs: ["checkedChange", "linkImageChange", "outChange", "outEventPopover", "outClickLabel", "outChangStageFlagMousePopover"] }, { kind: "pipe", type: LibsUiPipesConvertObjectToSignalPipe, name: "LibsUiPipesConvertObjectToSignalPipe" }, { kind: "component", type: LibsUiComponentsSpinnerComponent, selector: "libs_ui-components-spinner", inputs: ["type", "size"] }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }, { kind: "directive", type: LibsUiComponentsScrollOverlayDirective, selector: "[LibsUiComponentsScrollOverlayDirective]", inputs: ["debugMode", "classContainer", "options"], outputs: ["outScroll", "outScrollX", "outScrollY", "outScrollTop", "outScrollBottom"] }, { kind: "pipe", type: LibsUiIconsGetIconComponentPipe, name: "LibsUiIconsGetIconComponentPipe" }, { kind: "pipe", type: LibsUiPipesCallFunctionInTemplatePipe, name: "LibsUiPipesCallFunctionInTemplatePipe" }, { kind: "pipe", type: LibsUiPipesCheckSelectedByKeyPipe, name: "LibsUiPipesCheckSelectedByKeyPipe" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
696
|
+
}
|
|
697
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsTableComponent, decorators: [{
|
|
698
|
+
type: Component,
|
|
699
|
+
args: [{ selector: 'libs_ui-components-table', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
700
|
+
NgClass, NgStyle, AsyncPipe, NgTemplateOutlet, NgComponentOutlet, LibsUiComponentsTableTemplatesComponent,
|
|
701
|
+
TranslateModule, VirtualScrollerModule, LibsUiComponentsButtonsButtonComponent,
|
|
702
|
+
LibsUiComponentsDropdownComponent, LibsUiComponentsButtonsSortArrowComponent,
|
|
703
|
+
LibsUiComponentsCheckboxSingleComponent, LibsUiPipesConvertObjectToSignalPipe,
|
|
704
|
+
LibsUiComponentsSpinnerComponent, LibsUiComponentsPopoverComponent,
|
|
705
|
+
LibsUiComponentsScrollOverlayDirective, LibsUiIconsGetIconComponentPipe,
|
|
706
|
+
LibsUiPipesCallFunctionInTemplatePipe, LibsUiPipesCheckSelectedByKeyPipe
|
|
707
|
+
], template: "<div class='flex flex-col w-full h-full'>\n @if (!ignoreBar()) {\n <div\n class=\"flex items-center justify-between relative z-[1] bottom-0 left-0 w-full bg-white mb-[16px] libs-ui-table-shadow-bottom\"\n [class.px-[16px]]=\"keysSelected().length || labelBarNoSelectItem()\"\n [class.py-[6px]]=\"keysSelected().length || labelBarNoSelectItem()\"\n (mouseenter)=\"resetIndexHover($event)\">\n @if (!keysSelected().length && labelBarNoSelectItem()) {\n <div class=\"{{ classLabelBarNoSelectItem() ?? 'px-[12px] py-[5px]' }}\"\n [innerHtml]='labelBarNoSelectItem() | translate:{value:totalItemDisplay()}'>\n </div>\n }\n @if (keysSelected().length) {\n <div class=\"flex items-center pl-[12px]\">\n <div class=\"flex items-center h-full mt-[-2px]\">\n <libs_ui-components-checkbox-single [checked]=\"true\"\n [disable]=\"loading() || disableCheckbox()\"\n (outChange)=\"handlerChangeAllChecked()\" />\n </div>\n <div class=\"libs-ui-font-h5m text-[#071631] mr-[8px] {{ classLabelBarButtons() }}\">\n {{ labelBarButtons() | translate:{ value:keysSelected().length } }}\n </div>\n @if (configSelectMoreItem()) {\n <libs_ui-components-dropdown [isNgContent]=\"true\"\n [popoverCustomConfig]=\"{\n widthByParent:false,\n ignoreArrow: true,\n maxHeight: 2048,\n classInclude:'w-[121px]',\n position: {\n mode:'start',\n distance:0\n }\n }\"\n [listConfig]=\"({\n type:'text',\n configTemplateText:{\n fieldKey:'key',\n ignoreIconSelected:true,\n getValue:configSelectMoreItem()?.getValue\n }\n } | LibsUiPipesConvertObjectToSignalPipe:true)()\"\n [listMaxItemShow]=\"5\"\n class=\"w-[16px] h-[16px] mr-[8px]\"\n (outSelectKey)=\"handlerSelectedMoreItem($event)\"\n (outFunctionsControl)=\"handlerFunctionControlMoreSelectItem($event)\">\n <libs_ui-components-buttons-button [type]=\"'button-link-primary'\"\n [classInclude]=\"'p-0 m-0'\"\n [classIconLeft]=\"'before:!text-[16px] libs-ui-con-dropdown mr-[6px]'\"\n [popover]=\"{config:{content:'i18n_more_select'}}\"\n [ignoreStopPropagationEvent]=\"true\" />\n </libs_ui-components-dropdown>\n }\n <div class=\"h-[16px] libs-ui-border-left-general ml-[16px]\"></div>\n @if (barButtons()?.length) {\n @for (button of barButtons();track button) {\n <libs_ui-components-buttons-button [type]=\"button.type || 'button-link-primary'\"\n [classIconLeft]=\"button.classIconLeft || ''\"\n [classInclude]=\"button.classInclude || ''\"\n [label]=\"(button.label || ' ') | translate\"\n (outClick)=\"handlerBarButtonClick(button)\" />\n }\n }\n </div>\n }\n <ng-content select='div.libs-ui-table-bar-right'></ng-content>\n </div>\n }\n\n <div #tableContainerElementRef\n class=\"libs-ui-table flex flex-col w-full h-full relative\"\n [class.px-[16px]]='!ignoreBar()'\n (mouseleave)=\"resetIndexHover($event)\">\n <div #headerElementRef\n [class.libs-ui-border-bottom-dashed-general]=\"!hasItemHightLight() && isDashBorder()\"\n [class.libs-ui-border-bottom-general]=\"!hasItemHightLight() && !isDashBorder()\"\n [class.!hidden]=\"!items().length && isHiddenHeaderWhenNodata()\"\n [class]=\"classHeaderContainer()\"\n (mouseenter)=\"resetIndexHover($event)\">\n @if (headerLeft().length) {\n <div class=\"h-full flex sticky top-0 left-0 bg-[#ffffff] z-[1]\">\n @for (header of headerLeft();track header) {\n <ng-container *ngTemplateOutlet=\"templateHeaderRef;context:{headerItem:header,isHederLeft:true}\" />\n }\n </div>\n }\n @if (headerRight().length) {\n @for (header of headerRight();track header) {\n <ng-container *ngTemplateOutlet=\"templateHeaderRef;context:{headerItem:header,isHederLeft:false}\" />\n }\n }\n </div>\n @if (showFooter() && itemFooter() && customPositionFooter() === 'top') {\n <ng-container *ngTemplateOutlet='templateFooterRef' />\n }\n <div class=\"relative flex flex-col w-full h-full overflow-x-hidden bg-white {{ classBodyInclude() || '' }}\">\n @if (items().length) {\n <div #bodyElementRef\n class=\"flex h-full w-full relative\"\n LibsUiComponentsScrollOverlayDirective\n [options]=\"{scrollX: (!headerLeft().length || !headerRight()) ? 'hidden':'scroll'}\"\n (outScroll)=\"handlerScroll($event)\"\n (outScrollBottom)=\"handlerScrollBottom($event)\">\n <virtual-scroller #bodyComponentRef\n [items]=\"items()\"\n [enableUnequalChildrenSizes]=\"enableUnequalChildrenSizes()\"\n class=\"h-full\"\n [style.width.px]=\"headerElementRef.scrollWidth > (bodyElementRef ? bodyElementRef.scrollWidth : 0) ? headerElementRef.scrollWidth: undefined\"\n [parentScroll]=\"bodyElementRef\"\n [bufferAmount]=\"bufferAmount()\">\n @for (data of bodyComponentRef.viewPortItems;track data()) {\n <div #elementHover\n class=\"flex\"\n [class.bg-[#f3fcfc]]=\"data().specificHightLight\"\n [class.libs-ui-border-top-1px-36d3d3]=\"data().specificHightLight && $first && !ignoreBorderItem()\"\n [class.libs-ui-border-bottom-1px-36d3d3]=\"data().specificHightLight && !ignoreBorderItem()\"\n [ngClass]=\"(data().specificHightLight || ($last && ignoreBorderItemLast())) ? 'libs-ui-border-radius-bottom-left-4px libs-ui-border-radius-bottom-right-4px' : ignoreBorderItem() ? '' : isDashBorder() ? 'libs-ui-border-bottom-dashed-general' : 'libs-ui-border-bottom-general'\"\n [style.width.px]=\"headerElementRef.scrollWidth\"\n [class.bg-[#f8f9fa]]=\"itemOfIndexHover === data && !data().specificHightLight\"\n (mouseenter)=\"setIndexHover($event,data)\"\n (mouseleave)=\"resetIndexHoverWhenMouseLeave($event)\">\n @if (headerLeft().length || headerRight().length) {\n <div class=\"flex flex-col w-full\">\n <div class=\"flex w-full\">\n @if (headerLeft().length) {\n <div class=\"flex sticky top-0 left-0 z-[1]\"\n [class.bg-white]=\"!data().specificHightLight\"\n [class.bg-[#f3fcfc]]=\"data().specificHightLight\">\n @for (header of headerLeft();track header) {\n <div\n class=\"relative flex px-[12px] py-[8px] {{ header.ignoreBorderRight ? '': 'libs-ui-border-right-general' }}\"\n [class.bg-[#f8f9fa]]=\"itemOfIndexHover === data && !data().specificHightLight\"\n [ngStyle]=\"header.ngStyle || {}\"\n [ngClass]=\"header.ngClass || {}\">\n <ng-container *ngTemplateOutlet=\"templateBodyRef;context:{header:header,data:data}\" />\n </div>\n }\n </div>\n }\n @if (headerRight().length) {\n @for (header of headerRight();track header) {\n <div class=\"relative flex px-[12px] py-[8px]\"\n [ngStyle]=\"header.ngStyle || {}\"\n [ngClass]=\"header.ngClass || {}\">\n <ng-container *ngTemplateOutlet=\"templateBodyRef;context:{header:header,data:data}\" />\n </div>\n }\n }\n </div>\n @if (configTemplateItemCollapseExpand() && data().specificExpand && data()[configTemplateItemCollapseExpand()?.fieldGetDataExpand || 'specificDataExpand']) {\n <div [class]=\"configTemplateItemCollapseExpand()?.cssWrapper || 'flex w-full'\">\n @for (dataExpand of data()[configTemplateItemCollapseExpand()?.fieldGetDataExpand || 'specificDataExpand']();track $index) {\n @if (configTemplateItemCollapseExpand()?.colTemplateConfig) {\n <libs_ui-components-table-templates [item]=\"dataExpand\"\n [templateCssWrapper]=\"configTemplateItemCollapseExpand()?.templateCssWrapper\"\n [configs]=\"configTemplateItemCollapseExpand()?.colTemplateConfig\" />\n }\n } @empty {\n <div class=\"relative h-[100px]\">\n <ng-container *ngTemplateOutlet=\"templateNodataRef\" />\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n </virtual-scroller>\n\n @if ((!items().length) && !loading() && noDataConfig()) {\n <div class=\"h-full\"\n [style.flex]=\"'0 0 '+headerElementRef.scrollWidth+'px'\">\n </div>\n }\n </div>\n }\n @if ((!items().length) && !loading()) {\n <div class=\"relative h-full w-full\">\n <ng-container *ngTemplateOutlet=\"templateNodataRef\" />\n </div>\n }\n\n @if (showFooter() && itemFooter() && customPositionFooter() === 'bottom') {\n <ng-container *ngTemplateOutlet='templateFooterRef' />\n }\n\n @if (loading()) {\n <div class=\"absolute w-full h-full z-[2] flex items-center content-center\">\n <libs_ui-components-spinner />\n </div>\n }\n </div>\n </div>\n</div>\n\n<ng-template #templateHeaderRef\n let-header='headerItem'\n let-isHederLeft='isHederLeft'>\n <div\n [class]=\"'relative flex '+ (header.paddingLeftRightHeaderContainer ?? ' px-[12px] ') + (isHederLeft && !header.ignoreBorderRight ? ' libs-ui-border-right-general ' : ' ')+ ' libs-ui-table-header-col '\"\n [class.flex-col]=\"header.rowsConfig\"\n [class.py-[8px]]='!header.ignorePyDefault'\n [ngStyle]=\"header.ngStyle || {}\"\n [ngClass]=\"header.ngClass || {}\">\n @if (!header.rowsConfig) {\n <ng-container *ngTemplateOutlet=\"templateHeaderContentRef;context:{headerItem:header,isColRender:false}\" />\n }\n @if (header.rowsConfig;as rowsConfig) {\n @for (row of rowsConfig.rows;track row) {\n <div [class]=\"row.classRow\">\n @for (col of row.cols ; track col) {\n <ng-container *ngTemplateOutlet=\"templateHeaderContentRef;context:{headerItem:col,isColRender:true}\" />\n }\n </div>\n }\n }\n </div>\n</ng-template>\n\n<ng-template #templateHeaderContentRef\n let-header='headerItem'\n let-isColRender='isColRender'>\n <div class=\"flex libs-ui-font-h6m min-h-[18px] text-[#6a7383] max-w-full\"\n [class.items-center]='header.contentHeaderAlignCenter ?? true'\n [class.justify-end]='header.contentHeaderJustifyContentEnd'\n [ngStyle]=\"isColRender ? (header.ngStyle || {}) : {}\"\n [ngClass]=\"isColRender ? (header.ngClass || {}) : {}\">\n @if (header.hasCheckbox && !header.hasCheckboxAll) {\n <div class=\"flex h-full ml-[24px] {{ header.checkboxClassInclude }}\">\n </div>\n }\n @if (header.hasCheckboxAll) {\n <div class=\"flex h-full {{ header.checkboxAllClassInclude || 'mr-[16px]' }}\"\n [class.items-center]=\"header.checkboxAlignCenter\">\n <libs_ui-components-checkbox-single [key]=\"'all'\"\n [stillOtherOptions]=\"!!keysSelected().length && keysSelected().length !== items().length\"\n [checked]=\"!!keysSelected().length && keysSelected().length === items().length\"\n [disable]=\"loading()\"\n [classInclude]=\"header.checkboxClassInclude\"\n (outChange)=\"handlerChangeCheckedAllItems($event)\" />\n </div>\n }\n @if ((header.label | LibsUiPipesCallFunctionInTemplatePipe:header.parseValue:header)| async | translate; as labelHeaderColumn) {\n <libs_ui-components-popover [type]=\"header?.labelConfig?.type || 'text'\"\n [mode]=\"header?.labelConfig?.mode || 'hover'\"\n [classInclude]=\"(header?.labelConfig?.classInclude || '')\"\n [ignoreShowPopover]=\"header?.labelConfig?.ignoreShowTooltip || false\"\n [config]=\"header.labelConfig?.config || {content:labelHeaderColumn}\"\n [innerHTML]=\"labelHeaderColumn\" />\n }\n\n @if (header.tooltipOther; as tooltip) {\n <div class=\"ml-[4px]\">\n <libs_ui-components-popover [type]=\"tooltip?.type || 'other'\"\n [mode]=\"tooltip?.mode || 'hover'\"\n [classInclude]=\"tooltip.classInclude || 'text-[#6a7383]'\"\n [ignoreShowPopover]=\"tooltip.ignoreShowTooltip || false\"\n [config]=\"tooltip.config || {content:(tooltip.dataView || ' ') | translate, position: {\n mode: 'center',\n distance: 0,\n autoUpdatePosition: {\n endDistance: 12,\n startDistance: -12\n }\n }}\"\n [innerHTML]=\"tooltip.dataView\" />\n </div>\n }\n\n @if (header.hasSort && header.orderby) {\n <div class=\"ml-[4px]\">\n <libs_ui-components-buttons-sort-arrow [disable]=\"loading() || !items().length\"\n [fieldSort]=\"header.orderby\"\n [ignorePopoverContent]=\"header.sortIgnoreTooltipContent ?? true\"\n [popoverContentAsc]=\"header.sortTooltipContentAsc\"\n [popoverContentDesc]=\"header.sortTooltipContentDesc\"\n [defaultMode]=\"header.defaultMode\"\n [zIndex]=\"header.zIndexTooltipSort\"\n (outChange)=\"handlerChangeSort($event)\" />\n </div>\n }\n </div>\n @if (header.labelDescription) {\n <div class=\"flex\">\n <libs_ui-components-popover [type]=\"'text'\"\n [classInclude]=\"header.labelDescription.classInclude || ''\"\n [config]=\"{content: header.labelDescription.content | translate}\"\n [innerHTML]=\"header.labelDescription.content | translate\" />\n </div>\n }\n</ng-template>\n\n<ng-template #templateBodyRef\n let-header='header'\n let-data='data'>\n <div class=\"flex w-full h-full\">\n @if (header.hasCheckbox) {\n <div class=\"flex h-full\"\n [class.invisible]=\"header.checkConditionCheckBoxHidden &&( data() | LibsUiPipesCallFunctionInTemplatePipe:header.checkConditionCheckBoxHidden:data() | async)\"\n [class.items-center]=\"header.checkboxAlignCenter\">\n <libs_ui-components-checkbox-single [key]=\"data()[fieldKey()]\"\n [classInclude]=\"header.checkboxClassInclude\"\n [checked]=\"data()[fieldKey()] | LibsUiPipesCheckSelectedByKeyPipe:keysSelected():keysSelected().length\"\n [disable]=\"loading() || disableCheckbox() || !!(maxItemSelected() && !(data()[fieldKey()] | LibsUiPipesCheckSelectedByKeyPipe:keysSelected():keysSelected().length) && keysSelected().length >= maxItemSelected())\"\n (outChange)=\"handlerChangeItemChecked($event,data())\" />\n </div>\n }\n\n @if (header.colTemplateConfig) {\n <libs_ui-components-table-templates [isHover]=\"itemOfIndexHover === data && !data.specificHightLight\"\n [class]=\"header.templateCssWrapperHost || ''\"\n [item]=\"data\"\n [templateCssWrapper]=\"header.templateCssWrapper\"\n [configs]=\"header.colTemplateConfig\" />\n }\n </div>\n</ng-template>\n\n<ng-template #templateFooterRef>\n @if (!isHiddenHeaderWhenNodata() || (isHiddenHeaderWhenNodata() && items().length)) {\n <div #footerElementRef\n class=\"flex w-full bg-[#f8f9fa] overflow-x-hidden z-[1] {{ ignoreBorderFooter() ? '': (customPositionFooter() === 'top' ? 'libs-ui-border-bottom-general':'libs-ui-table-shadow-top libs-ui-border-top-general') }} min-h-[35px]\"\n (mouseenter)=\"handlerMouseEnter($event)\"\n (mouseleave)=\"handlerMouseLeave($event)\">\n @if (footerLeft()) {\n <div #footerLeftElementRef\n class=\"flex sticky top-0 left-0 z-[1] bg-[#f8f9fa]\">\n @for (footer of footerLeft();track footer) {\n <div\n class=\"flex items-center px-[12px] py-[8px] {{ footer.ignoreBorderRight ? '': 'libs-ui-border-right-general' }}\"\n [ngStyle]=\"footer.ngStyle || {}\"\n [ngClass]=\"footer.ngClass || {}\">\n @if (footer.colTemplateConfig) {\n <libs_ui-components-table-templates [item]=\"itemFooter\"\n [templateCssWrapper]=\"footer.templateCssWrapper\"\n [configs]=\"footer.colTemplateConfig\" />\n }\n </div>\n }\n </div>\n }\n @if (footerRight()) {\n @for (footer of footerRight();track footer) {\n <div class=\"flex items-center px-[12px] py-[8px]\"\n [ngStyle]=\"footer.ngStyle || {}\"\n [ngClass]=\"footer.ngClass || {}\">\n @if (footer.colTemplateConfig) {\n <libs_ui-components-table-templates [item]=\"itemFooter\"\n [templateCssWrapper]=\"footer.templateCssWrapper\"\n [configs]=\"footer.colTemplateConfig\" />\n }\n </div>\n }\n }\n\n </div>\n }\n</ng-template>\n\n<ng-template #templateNodataRef>\n @if (noDataConfig(); as config) {\n <div class=\"flex items-center justify-center w-full h-full absolute left-0 top-0 z-[1]\">\n <div class=\"flex flex-col items-center justify-center w-full h-full shrink-0\"\n LibsUiComponentsScrollOverlayDirective>\n @if (!keySearch() && !onlyShowNoResult()) {\n <ng-container *ngComponentOutlet=\" ('no-data' | LibsUiIconsGetIconComponentPipe | async);inputs:{size:64}\" />\n <div class=\"libs-ui-table-no-data-config-text\"\n [ngStyle]=\"config.ngStyle || {}\"\n [ngClass]=\"config.ngClass || {}\"\n [innerHtml]=\"config.textNoData | translate\">\n </div>\n }\n @if (keySearch() || onlyShowNoResult()) {\n <ng-container *ngComponentOutlet=\"('no-result' | LibsUiIconsGetIconComponentPipe | async);inputs:{size:64}\" />\n <div class=\"libs-ui-table-no-data-config-text\"\n [ngStyle]=\"config.ngStyle || {}\"\n [ngClass]=\"config.ngClass || {}\"\n [innerHtml]=\"config.textSearchNoData | translate\">\n </div>\n }\n </div>\n </div>\n }\n</ng-template>\n", styles: [".libs-ui-table-header-container{height:33px;flex-shrink:0}.libs-ui-table-header-col{height:100%;width:100%;align-items:center}.libs-ui-table-no-data-config-text{margin-top:16px;font-size:12px;color:#9ca2ad;font-family:var(--libs-ui-font-family-name, \"Arial\");font-weight:400}.libs-ui-table-no-data-config-icon{margin-bottom:12px}.libs-ui-table-no-data-config-icon:before{font-size:84px;color:#c1c1c1}.libs-ui-table-shadow-bottom{box-shadow:0 1px 1px #00143305,0 4px 8px #0014330a}@media only screen and (min-width: 1921px){.libs-ui-border-bottom-general{border-bottom:solid 2px #e6e8ed!important}}\n"] }]
|
|
708
|
+
}], ctorParameters: () => [] });
|
|
709
|
+
|
|
710
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
711
|
+
|
|
712
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
713
|
+
|
|
714
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
715
|
+
|
|
716
|
+
class LibsUiComponentsTableTemplateAbstractComponent {
|
|
717
|
+
item = input.required();
|
|
718
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsTableTemplateAbstractComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
719
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: LibsUiComponentsTableTemplateAbstractComponent, selector: "libs_ui-components-table-templates_abstract", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: ``, isInline: true });
|
|
720
|
+
}
|
|
721
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsTableTemplateAbstractComponent, decorators: [{
|
|
722
|
+
type: Component,
|
|
723
|
+
args: [{
|
|
724
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
725
|
+
selector: 'libs_ui-components-table-templates_abstract',
|
|
726
|
+
template: ``
|
|
727
|
+
}]
|
|
728
|
+
}] });
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* Generated bundle index. Do not edit.
|
|
732
|
+
*/
|
|
733
|
+
|
|
734
|
+
export { LibsUiComponentsTableComponent, LibsUiComponentsTableTemplateAbstractComponent };
|
|
735
|
+
//# sourceMappingURL=libs-ui-components-table.mjs.map
|