ngx-easy-table-plus 15.7.0
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/LICENSE +20 -0
- package/README.md +37 -0
- package/esm2022/lib/components/base/base.component.mjs +541 -0
- package/esm2022/lib/components/base/base.module.mjs +46 -0
- package/esm2022/lib/components/header/header.component.mjs +24 -0
- package/esm2022/lib/components/pagination/pagination.component.mjs +68 -0
- package/esm2022/lib/components/thead/thead.component.mjs +147 -0
- package/esm2022/lib/index.mjs +7 -0
- package/esm2022/lib/model/api.mjs +24 -0
- package/esm2022/lib/model/columns.mjs +2 -0
- package/esm2022/lib/model/config.mjs +12 -0
- package/esm2022/lib/model/event.enum.mjs +24 -0
- package/esm2022/lib/model/pagination.mjs +2 -0
- package/esm2022/lib/pipes/global-search-pipe.mjs +30 -0
- package/esm2022/lib/pipes/render-pipe.mjs +18 -0
- package/esm2022/lib/pipes/search-pipe.mjs +51 -0
- package/esm2022/lib/pipes/sort.pipe.mjs +64 -0
- package/esm2022/lib/services/config-service.mjs +51 -0
- package/esm2022/lib/services/filters.service.mjs +16 -0
- package/esm2022/lib/services/group-rows.service.mjs +19 -0
- package/esm2022/lib/services/style.service.mjs +46 -0
- package/esm2022/lib/table.module.mjs +19 -0
- package/esm2022/ngx-easy-table-plus.mjs +5 -0
- package/esm2022/public_api.mjs +9 -0
- package/fesm2022/ngx-easy-table-plus.mjs +1142 -0
- package/fesm2022/ngx-easy-table-plus.mjs.map +1 -0
- package/index.d.ts +6 -0
- package/lib/components/base/base.component.d.ts +112 -0
- package/lib/components/base/base.component.d.ts.map +1 -0
- package/lib/components/base/base.module.d.ts +19 -0
- package/lib/components/base/base.module.d.ts.map +1 -0
- package/lib/components/header/header.component.d.ts +15 -0
- package/lib/components/header/header.component.d.ts.map +1 -0
- package/lib/components/pagination/pagination.component.d.ts +32 -0
- package/lib/components/pagination/pagination.component.d.ts.map +1 -0
- package/lib/components/thead/thead.component.d.ts +52 -0
- package/lib/components/thead/thead.component.d.ts.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/model/api.d.ts +117 -0
- package/lib/model/api.d.ts.map +1 -0
- package/lib/model/columns.d.ts +19 -0
- package/lib/model/columns.d.ts.map +1 -0
- package/lib/model/config.d.ts +53 -0
- package/lib/model/config.d.ts.map +1 -0
- package/lib/model/event.enum.d.ts +21 -0
- package/lib/model/event.enum.d.ts.map +1 -0
- package/lib/model/pagination.d.ts +6 -0
- package/lib/model/pagination.d.ts.map +1 -0
- package/lib/pipes/global-search-pipe.d.ts +9 -0
- package/lib/pipes/global-search-pipe.d.ts.map +1 -0
- package/lib/pipes/render-pipe.d.ts +8 -0
- package/lib/pipes/render-pipe.d.ts.map +1 -0
- package/lib/pipes/search-pipe.d.ts +15 -0
- package/lib/pipes/search-pipe.d.ts.map +1 -0
- package/lib/pipes/sort.pipe.d.ts +17 -0
- package/lib/pipes/sort.pipe.d.ts.map +1 -0
- package/lib/services/config-service.d.ts +9 -0
- package/lib/services/config-service.d.ts.map +1 -0
- package/lib/services/filters.service.d.ts +7 -0
- package/lib/services/filters.service.d.ts.map +1 -0
- package/lib/services/group-rows.service.d.ts +7 -0
- package/lib/services/group-rows.service.d.ts.map +1 -0
- package/lib/services/style.service.d.ts +12 -0
- package/lib/services/style.service.d.ts.map +1 -0
- package/lib/table.module.d.ts +10 -0
- package/lib/table.module.d.ts.map +1 -0
- package/ngx-easy-table-plus.d.ts.map +1 -0
- package/package.json +44 -0
- package/public_api.d.ts +9 -0
- package/public_api.d.ts.map +1 -0
- package/style.css +514 -0
- package/style.css.map +1 -0
- package/style.scss +616 -0
|
@@ -0,0 +1,1142 @@
|
|
|
1
|
+
import * as i3 from '@angular/common';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, ViewChild, Input, Output, HostListener, ViewChildren, Pipe, TemplateRef, ContentChild, NgModule } from '@angular/core';
|
|
5
|
+
import * as i3$1 from '@angular/cdk/drag-drop';
|
|
6
|
+
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
7
|
+
import { from, Subject } from 'rxjs';
|
|
8
|
+
import { groupBy, mergeMap, reduce, takeUntil, throttleTime, filter } from 'rxjs/operators';
|
|
9
|
+
import * as i1 from '@angular/cdk/scrolling';
|
|
10
|
+
import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
|
|
11
|
+
import * as i2 from 'ngx-pagination';
|
|
12
|
+
import { NgxPaginationModule } from 'ngx-pagination';
|
|
13
|
+
|
|
14
|
+
var STYLE;
|
|
15
|
+
(function (STYLE) {
|
|
16
|
+
STYLE["TINY"] = "tiny";
|
|
17
|
+
STYLE["BIG"] = "big";
|
|
18
|
+
STYLE["NORMAL"] = "normal";
|
|
19
|
+
})(STYLE || (STYLE = {}));
|
|
20
|
+
var THEME;
|
|
21
|
+
(function (THEME) {
|
|
22
|
+
THEME["LIGHT"] = "light";
|
|
23
|
+
THEME["DARK"] = "dark";
|
|
24
|
+
})(THEME || (THEME = {}));
|
|
25
|
+
|
|
26
|
+
var Event;
|
|
27
|
+
(function (Event) {
|
|
28
|
+
Event["onPagination"] = "onPagination";
|
|
29
|
+
Event["onOrder"] = "onOrder";
|
|
30
|
+
Event["onGlobalSearch"] = "onGlobalSearch";
|
|
31
|
+
Event["onSearch"] = "onSearch";
|
|
32
|
+
Event["onClick"] = "onClick";
|
|
33
|
+
Event["onDoubleClick"] = "onDoubleClick";
|
|
34
|
+
Event["onCheckboxSelect"] = "onCheckboxSelect";
|
|
35
|
+
Event["onRadioSelect"] = "onRadioSelect";
|
|
36
|
+
Event["onCheckboxToggle"] = "onCheckboxToggle";
|
|
37
|
+
Event["onSelectAll"] = "onSelectAll";
|
|
38
|
+
Event["onInfiniteScrollEnd"] = "onInfiniteScrollEnd";
|
|
39
|
+
Event["onColumnResizeMouseDown"] = "onColumnResizeMouseDown";
|
|
40
|
+
Event["onColumnResizeMouseUp"] = "onColumnResizeMouseUp";
|
|
41
|
+
/* @deprecated Will be removed in the next version */
|
|
42
|
+
Event["onRowDrop"] = "onRowDrop";
|
|
43
|
+
/* @deprecated Will be removed in the next version */
|
|
44
|
+
Event["onReorderStart"] = "onReorderStart";
|
|
45
|
+
Event["onRowCollapsedShow"] = "onRowCollapsedShow";
|
|
46
|
+
Event["onRowCollapsedHide"] = "onRowCollapsedHide";
|
|
47
|
+
Event["onRowContextMenu"] = "onRowContextMenu";
|
|
48
|
+
})(Event || (Event = {}));
|
|
49
|
+
|
|
50
|
+
var API;
|
|
51
|
+
(function (API) {
|
|
52
|
+
API["rowContextMenuClicked"] = "rowContextMenuClicked";
|
|
53
|
+
API["setInputValue"] = "setInputValue";
|
|
54
|
+
API["toggleRowIndex"] = "toggleRowIndex";
|
|
55
|
+
API["toggleCheckbox"] = "toggleCheckbox";
|
|
56
|
+
API["onGlobalSearch"] = "onGlobalSearch";
|
|
57
|
+
API["setPaginationCurrentPage"] = "setPaginationCurrentPage";
|
|
58
|
+
API["getPaginationCurrentPage"] = "getPaginationCurrentPage";
|
|
59
|
+
API["getPaginationTotalItems"] = "getPaginationTotalItems";
|
|
60
|
+
API["getNumberOfRowsPerPage"] = "getNumberOfRowsPerPage";
|
|
61
|
+
API["getPaginationLastPage"] = "getPaginationLastPage";
|
|
62
|
+
API["setPaginationRange"] = "setPaginationRange";
|
|
63
|
+
API["setPaginationPreviousLabel"] = "setPaginationPreviousLabel";
|
|
64
|
+
API["setPaginationNextLabel"] = "setPaginationNextLabel";
|
|
65
|
+
API["setPaginationDisplayLimit"] = "setPaginationDisplayLimit";
|
|
66
|
+
API["setTableClass"] = "setTableClass";
|
|
67
|
+
API["setRowClass"] = "setRowClass";
|
|
68
|
+
API["setCellClass"] = "setCellClass";
|
|
69
|
+
API["setRowStyle"] = "setRowStyle";
|
|
70
|
+
API["setCellStyle"] = "setCellStyle";
|
|
71
|
+
API["sortBy"] = "sortBy";
|
|
72
|
+
})(API || (API = {}));
|
|
73
|
+
|
|
74
|
+
// eslint-disable-next-line, no-underscore-dangle, id-blacklist, id-match
|
|
75
|
+
const DefaultConfig = {
|
|
76
|
+
searchEnabled: false,
|
|
77
|
+
headerEnabled: true,
|
|
78
|
+
orderEnabled: true,
|
|
79
|
+
orderEventOnly: false,
|
|
80
|
+
paginationEnabled: true,
|
|
81
|
+
clickEvent: true,
|
|
82
|
+
selectRow: false,
|
|
83
|
+
selectCol: false,
|
|
84
|
+
selectCell: false,
|
|
85
|
+
rows: 10,
|
|
86
|
+
additionalActions: false,
|
|
87
|
+
serverPagination: false,
|
|
88
|
+
isLoading: false,
|
|
89
|
+
detailsTemplate: false,
|
|
90
|
+
groupRows: false,
|
|
91
|
+
paginationRangeEnabled: true,
|
|
92
|
+
collapseAllRows: false,
|
|
93
|
+
checkboxes: false,
|
|
94
|
+
radio: false,
|
|
95
|
+
resizeColumn: false,
|
|
96
|
+
fixedColumnWidth: true,
|
|
97
|
+
horizontalScroll: false,
|
|
98
|
+
logger: false,
|
|
99
|
+
showDetailsArrow: false,
|
|
100
|
+
showContextMenu: false,
|
|
101
|
+
persistState: false,
|
|
102
|
+
paginationMaxSize: 5,
|
|
103
|
+
threeWaySort: false,
|
|
104
|
+
onDragOver: false,
|
|
105
|
+
tableLayout: {
|
|
106
|
+
style: STYLE.NORMAL,
|
|
107
|
+
theme: THEME.LIGHT,
|
|
108
|
+
borderless: false,
|
|
109
|
+
hover: true,
|
|
110
|
+
striped: false,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
class DefaultConfigService {
|
|
114
|
+
static { this.config = DefaultConfig; }
|
|
115
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: DefaultConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
116
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: DefaultConfigService }); }
|
|
117
|
+
}
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: DefaultConfigService, decorators: [{
|
|
119
|
+
type: Injectable
|
|
120
|
+
}] });
|
|
121
|
+
|
|
122
|
+
class GroupRowsService {
|
|
123
|
+
static doGroupRows(data, groupRowsBy) {
|
|
124
|
+
const grouped = [];
|
|
125
|
+
from(data)
|
|
126
|
+
.pipe(groupBy((row) => row[groupRowsBy]), mergeMap((group) => group.pipe(reduce((acc, curr) => [...acc, curr], []))))
|
|
127
|
+
.subscribe((row) => grouped.push(row));
|
|
128
|
+
return grouped;
|
|
129
|
+
}
|
|
130
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GroupRowsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
131
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GroupRowsService }); }
|
|
132
|
+
}
|
|
133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GroupRowsService, decorators: [{
|
|
134
|
+
type: Injectable
|
|
135
|
+
}] });
|
|
136
|
+
|
|
137
|
+
/* eslint-disable */
|
|
138
|
+
class StyleService {
|
|
139
|
+
setRowClass(val) {
|
|
140
|
+
const selector = `#table > tbody > tr:nth-child(${val.row})`;
|
|
141
|
+
const row = document.querySelector(selector);
|
|
142
|
+
if (row) {
|
|
143
|
+
row.classList.add(val.className);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
setCellClass(val) {
|
|
147
|
+
const selector = `#table > tbody > tr:nth-child(${val.row}) > td:nth-child(${val.cell})`;
|
|
148
|
+
const cell = document.querySelector(selector);
|
|
149
|
+
if (cell) {
|
|
150
|
+
cell.classList.add(val.className);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
setRowStyle(val) {
|
|
154
|
+
const selector = `#table > tbody > tr:nth-child(${val.row})`;
|
|
155
|
+
const row = document.querySelector(selector);
|
|
156
|
+
if (row) {
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
158
|
+
row.style[val.attr] = val.value;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
setCellStyle(val) {
|
|
162
|
+
const selector = `#table > tbody > tr:nth-child(${val.row}) > td:nth-child(${val.cell})`;
|
|
163
|
+
const cell = document.querySelector(selector);
|
|
164
|
+
if (cell) {
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
166
|
+
cell.style[val.attr] = val.value;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
pinnedWidth(pinned, column) {
|
|
170
|
+
if (pinned) {
|
|
171
|
+
return 150 * column + 'px';
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: StyleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
175
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: StyleService }); }
|
|
176
|
+
}
|
|
177
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: StyleService, decorators: [{
|
|
178
|
+
type: Injectable
|
|
179
|
+
}] });
|
|
180
|
+
|
|
181
|
+
class PaginationComponent {
|
|
182
|
+
constructor() {
|
|
183
|
+
this.updateRange = new EventEmitter();
|
|
184
|
+
this.ranges = [5, 10, 25, 50, 100];
|
|
185
|
+
this.showRange = false;
|
|
186
|
+
this.screenReaderPaginationLabel = 'Pagination';
|
|
187
|
+
this.screenReaderPageLabel = 'page';
|
|
188
|
+
this.screenReaderCurrentLabel = 'You are on page';
|
|
189
|
+
this.previousLabel = '';
|
|
190
|
+
this.nextLabel = '';
|
|
191
|
+
this.directionLinks = true;
|
|
192
|
+
}
|
|
193
|
+
onClick(targetElement) {
|
|
194
|
+
if (this.paginationRange && !this.paginationRange.nativeElement.contains(targetElement)) {
|
|
195
|
+
this.showRange = false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
ngOnChanges(changes) {
|
|
199
|
+
const { config } = changes;
|
|
200
|
+
if (config && config.currentValue) {
|
|
201
|
+
this.selectedLimit = this.config.rows;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
onPageChange(page) {
|
|
205
|
+
this.updateRange.emit({
|
|
206
|
+
page,
|
|
207
|
+
limit: this.selectedLimit,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
changeLimit(limit, callFromAPI) {
|
|
211
|
+
if (!callFromAPI) {
|
|
212
|
+
this.showRange = !this.showRange;
|
|
213
|
+
}
|
|
214
|
+
this.selectedLimit = limit;
|
|
215
|
+
this.updateRange.emit({
|
|
216
|
+
page: 1,
|
|
217
|
+
limit,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
221
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: PaginationComponent, selector: "pagination", inputs: { pagination: "pagination", config: "config", id: "id" }, outputs: { updateRange: "updateRange" }, host: { listeners: { "document:click": "onClick($event.target)" } }, viewQueries: [{ propertyName: "paginationDirective", first: true, predicate: ["paginationDirective"], descendants: true }, { propertyName: "paginationRange", first: true, predicate: ["paginationRange"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\r\n class=\"ngx-pagination-wrapper\"\r\n [style.display]=\"config.paginationEnabled ? '' : 'none'\"\r\n [class.ngx-table__table--dark-pagination-wrapper]=\"config.tableLayout.theme === 'dark'\"\r\n>\r\n <div class=\"ngx-pagination-steps\">\r\n <pagination-template\r\n #paginationDirective=\"paginationApi\"\r\n id=\"pagination-controls\"\r\n [id]=\"id\"\r\n [class.ngx-table__table--dark-pagination]=\"config.tableLayout.theme === 'dark'\"\r\n [maxSize]=\"config.paginationMaxSize || 5\"\r\n (pageChange)=\"onPageChange($event)\"\r\n >\r\n <ul\r\n class=\"ngx-pagination\"\r\n role=\"navigation\"\r\n [attr.aria-label]=\"screenReaderPaginationLabel\"\r\n [class.responsive]=\"true\"\r\n >\r\n <li\r\n class=\"pagination-previous\"\r\n [class.disabled]=\"paginationDirective.isFirstPage()\"\r\n *ngIf=\"directionLinks\"\r\n >\r\n <a\r\n tabindex=\"0\"\r\n *ngIf=\"1 < paginationDirective.getCurrent()\"\r\n (keyup.enter)=\"paginationDirective.previous()\"\r\n (click)=\"paginationDirective.previous()\"\r\n [attr.aria-label]=\"previousLabel + ' ' + screenReaderPageLabel\"\r\n >\r\n {{ previousLabel }} <span class=\"show-for-sr\">{{ screenReaderPageLabel }}</span>\r\n </a>\r\n <span *ngIf=\"paginationDirective.isFirstPage()\">\r\n {{ previousLabel }} <span class=\"show-for-sr\">{{ screenReaderPageLabel }}</span>\r\n </span>\r\n </li>\r\n <li class=\"small-screen\">\r\n {{ paginationDirective.getCurrent() }} / {{ paginationDirective.getLastPage() }}\r\n </li>\r\n <li\r\n [class.current]=\"paginationDirective.getCurrent() === page.value\"\r\n [class.ellipsis]=\"page.label === '...'\"\r\n *ngFor=\"let page of paginationDirective.pages\"\r\n >\r\n <a\r\n tabindex=\"0\"\r\n (keyup.enter)=\"paginationDirective.setCurrent(page.value)\"\r\n (click)=\"paginationDirective.setCurrent(page.value)\"\r\n *ngIf=\"paginationDirective.getCurrent() !== page.value\"\r\n >\r\n <span class=\"show-for-sr\">{{ screenReaderPageLabel }} </span>\r\n <span>{{ page.label }}</span>\r\n </a>\r\n <ng-container *ngIf=\"paginationDirective.getCurrent() === page.value\">\r\n <span class=\"show-for-sr\">{{ screenReaderCurrentLabel }} </span>\r\n <span>{{ page.label }}</span>\r\n </ng-container>\r\n </li>\r\n <li\r\n class=\"pagination-next\"\r\n [class.disabled]=\"paginationDirective.isLastPage()\"\r\n *ngIf=\"directionLinks\"\r\n >\r\n <a\r\n tabindex=\"0\"\r\n *ngIf=\"!paginationDirective.isLastPage()\"\r\n (keyup.enter)=\"paginationDirective.next()\"\r\n (click)=\"paginationDirective.next()\"\r\n [attr.aria-label]=\"nextLabel + ' ' + screenReaderPageLabel\"\r\n >\r\n {{ nextLabel }} <span class=\"show-for-sr\">{{ screenReaderPageLabel }}</span>\r\n </a>\r\n <span *ngIf=\"paginationDirective.isLastPage()\">\r\n {{ nextLabel }} <span class=\"show-for-sr\">{{ screenReaderPageLabel }}</span>\r\n </span>\r\n </li>\r\n </ul>\r\n </pagination-template>\r\n </div>\r\n <div\r\n class=\"ngx-pagination-range\"\r\n #paginationRange\r\n [class.ngx-table__table--dark-pagination-range]=\"config.tableLayout.theme === 'dark'\"\r\n *ngIf=\"config.paginationRangeEnabled\"\r\n >\r\n <div class=\"ngx-dropdown ngx-pagination-range-dropdown\" id=\"rowAmount\">\r\n <div class=\"ngx-btn-group\">\r\n <div class=\"ngx-pagination-range-dropdown-button\" (click)=\"showRange = !showRange\">\r\n {{selectedLimit}} <i class=\"ngx-icon ngx-icon-arrow-down\"></i>\r\n </div>\r\n <ul class=\"ngx-menu\" *ngIf=\"showRange\">\r\n <li\r\n class=\"ngx-pagination-range-dropdown-button-item\"\r\n [class.ngx-pagination-range--selected]=\"limit === selectedLimit\"\r\n (click)=\"changeLimit(limit, false)\"\r\n *ngFor=\"let limit of ranges\"\r\n >\r\n <span>{{limit}}</span>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.PaginationControlsDirective, selector: "pagination-template,[pagination-template]", inputs: ["id", "maxSize"], outputs: ["pageChange", "pageBoundsCorrection"], exportAs: ["paginationApi"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
222
|
+
}
|
|
223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PaginationComponent, decorators: [{
|
|
224
|
+
type: Component,
|
|
225
|
+
args: [{ selector: 'pagination', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n class=\"ngx-pagination-wrapper\"\r\n [style.display]=\"config.paginationEnabled ? '' : 'none'\"\r\n [class.ngx-table__table--dark-pagination-wrapper]=\"config.tableLayout.theme === 'dark'\"\r\n>\r\n <div class=\"ngx-pagination-steps\">\r\n <pagination-template\r\n #paginationDirective=\"paginationApi\"\r\n id=\"pagination-controls\"\r\n [id]=\"id\"\r\n [class.ngx-table__table--dark-pagination]=\"config.tableLayout.theme === 'dark'\"\r\n [maxSize]=\"config.paginationMaxSize || 5\"\r\n (pageChange)=\"onPageChange($event)\"\r\n >\r\n <ul\r\n class=\"ngx-pagination\"\r\n role=\"navigation\"\r\n [attr.aria-label]=\"screenReaderPaginationLabel\"\r\n [class.responsive]=\"true\"\r\n >\r\n <li\r\n class=\"pagination-previous\"\r\n [class.disabled]=\"paginationDirective.isFirstPage()\"\r\n *ngIf=\"directionLinks\"\r\n >\r\n <a\r\n tabindex=\"0\"\r\n *ngIf=\"1 < paginationDirective.getCurrent()\"\r\n (keyup.enter)=\"paginationDirective.previous()\"\r\n (click)=\"paginationDirective.previous()\"\r\n [attr.aria-label]=\"previousLabel + ' ' + screenReaderPageLabel\"\r\n >\r\n {{ previousLabel }} <span class=\"show-for-sr\">{{ screenReaderPageLabel }}</span>\r\n </a>\r\n <span *ngIf=\"paginationDirective.isFirstPage()\">\r\n {{ previousLabel }} <span class=\"show-for-sr\">{{ screenReaderPageLabel }}</span>\r\n </span>\r\n </li>\r\n <li class=\"small-screen\">\r\n {{ paginationDirective.getCurrent() }} / {{ paginationDirective.getLastPage() }}\r\n </li>\r\n <li\r\n [class.current]=\"paginationDirective.getCurrent() === page.value\"\r\n [class.ellipsis]=\"page.label === '...'\"\r\n *ngFor=\"let page of paginationDirective.pages\"\r\n >\r\n <a\r\n tabindex=\"0\"\r\n (keyup.enter)=\"paginationDirective.setCurrent(page.value)\"\r\n (click)=\"paginationDirective.setCurrent(page.value)\"\r\n *ngIf=\"paginationDirective.getCurrent() !== page.value\"\r\n >\r\n <span class=\"show-for-sr\">{{ screenReaderPageLabel }} </span>\r\n <span>{{ page.label }}</span>\r\n </a>\r\n <ng-container *ngIf=\"paginationDirective.getCurrent() === page.value\">\r\n <span class=\"show-for-sr\">{{ screenReaderCurrentLabel }} </span>\r\n <span>{{ page.label }}</span>\r\n </ng-container>\r\n </li>\r\n <li\r\n class=\"pagination-next\"\r\n [class.disabled]=\"paginationDirective.isLastPage()\"\r\n *ngIf=\"directionLinks\"\r\n >\r\n <a\r\n tabindex=\"0\"\r\n *ngIf=\"!paginationDirective.isLastPage()\"\r\n (keyup.enter)=\"paginationDirective.next()\"\r\n (click)=\"paginationDirective.next()\"\r\n [attr.aria-label]=\"nextLabel + ' ' + screenReaderPageLabel\"\r\n >\r\n {{ nextLabel }} <span class=\"show-for-sr\">{{ screenReaderPageLabel }}</span>\r\n </a>\r\n <span *ngIf=\"paginationDirective.isLastPage()\">\r\n {{ nextLabel }} <span class=\"show-for-sr\">{{ screenReaderPageLabel }}</span>\r\n </span>\r\n </li>\r\n </ul>\r\n </pagination-template>\r\n </div>\r\n <div\r\n class=\"ngx-pagination-range\"\r\n #paginationRange\r\n [class.ngx-table__table--dark-pagination-range]=\"config.tableLayout.theme === 'dark'\"\r\n *ngIf=\"config.paginationRangeEnabled\"\r\n >\r\n <div class=\"ngx-dropdown ngx-pagination-range-dropdown\" id=\"rowAmount\">\r\n <div class=\"ngx-btn-group\">\r\n <div class=\"ngx-pagination-range-dropdown-button\" (click)=\"showRange = !showRange\">\r\n {{selectedLimit}} <i class=\"ngx-icon ngx-icon-arrow-down\"></i>\r\n </div>\r\n <ul class=\"ngx-menu\" *ngIf=\"showRange\">\r\n <li\r\n class=\"ngx-pagination-range-dropdown-button-item\"\r\n [class.ngx-pagination-range--selected]=\"limit === selectedLimit\"\r\n (click)=\"changeLimit(limit, false)\"\r\n *ngFor=\"let limit of ranges\"\r\n >\r\n <span>{{limit}}</span>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n" }]
|
|
226
|
+
}], propDecorators: { paginationDirective: [{
|
|
227
|
+
type: ViewChild,
|
|
228
|
+
args: ['paginationDirective']
|
|
229
|
+
}], paginationRange: [{
|
|
230
|
+
type: ViewChild,
|
|
231
|
+
args: ['paginationRange']
|
|
232
|
+
}], pagination: [{
|
|
233
|
+
type: Input
|
|
234
|
+
}], config: [{
|
|
235
|
+
type: Input
|
|
236
|
+
}], id: [{
|
|
237
|
+
type: Input
|
|
238
|
+
}], updateRange: [{
|
|
239
|
+
type: Output
|
|
240
|
+
}], onClick: [{
|
|
241
|
+
type: HostListener,
|
|
242
|
+
args: ['document:click', ['$event.target']]
|
|
243
|
+
}] } });
|
|
244
|
+
|
|
245
|
+
class HeaderComponent {
|
|
246
|
+
constructor() {
|
|
247
|
+
this.update = new EventEmitter();
|
|
248
|
+
}
|
|
249
|
+
unifyKey(key) {
|
|
250
|
+
return key.replace('.', '_');
|
|
251
|
+
}
|
|
252
|
+
onSearch(input) {
|
|
253
|
+
this.update.emit([{ value: input.value, key: this.column.key }]);
|
|
254
|
+
}
|
|
255
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: HeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
256
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: HeaderComponent, selector: "table-header", inputs: { column: "column" }, outputs: { update: "update" }, ngImport: i0, template: "<label for=\"search_{{ unifyKey(column.key) }}\">\r\n <input\r\n type=\"text\"\r\n id=\"search_{{ unifyKey(column.key) }}\"\r\n aria-label=\"Search\"\r\n placeholder=\"{{ column.placeholder ? column.placeholder : column.title }}\"\r\n class=\"ngx-table__header-search\"\r\n #input\r\n (input)=\"onSearch(input)\"\r\n />\r\n</label>\r\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
257
|
+
}
|
|
258
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: HeaderComponent, decorators: [{
|
|
259
|
+
type: Component,
|
|
260
|
+
args: [{ selector: 'table-header', changeDetection: ChangeDetectionStrategy.OnPush, template: "<label for=\"search_{{ unifyKey(column.key) }}\">\r\n <input\r\n type=\"text\"\r\n id=\"search_{{ unifyKey(column.key) }}\"\r\n aria-label=\"Search\"\r\n placeholder=\"{{ column.placeholder ? column.placeholder : column.title }}\"\r\n class=\"ngx-table__header-search\"\r\n #input\r\n (input)=\"onSearch(input)\"\r\n />\r\n</label>\r\n" }]
|
|
261
|
+
}], propDecorators: { column: [{
|
|
262
|
+
type: Input
|
|
263
|
+
}], update: [{
|
|
264
|
+
type: Output
|
|
265
|
+
}] } });
|
|
266
|
+
|
|
267
|
+
class TableTHeadComponent {
|
|
268
|
+
onClick(targetElement) {
|
|
269
|
+
if (this.additionalActionMenu &&
|
|
270
|
+
!this.additionalActionMenu.nativeElement.contains(targetElement)) {
|
|
271
|
+
this.menuActive = false;
|
|
272
|
+
}
|
|
273
|
+
// if click outside the header then close opened Header Action Template
|
|
274
|
+
if (this.openedHeaderActionTemplate &&
|
|
275
|
+
// if no header have the clicked point
|
|
276
|
+
!this.headerDropdown.toArray().some((ref) => ref.nativeElement.contains(targetElement))) {
|
|
277
|
+
this.openedHeaderActionTemplate = null;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
constructor(styleService) {
|
|
281
|
+
this.styleService = styleService;
|
|
282
|
+
this.menuActive = false;
|
|
283
|
+
this.openedHeaderActionTemplate = null;
|
|
284
|
+
this.onSelectAllBinded = this.onSelectAll.bind(this);
|
|
285
|
+
this.filter = new EventEmitter();
|
|
286
|
+
this.order = new EventEmitter();
|
|
287
|
+
this.selectAll = new EventEmitter();
|
|
288
|
+
this.event = new EventEmitter();
|
|
289
|
+
}
|
|
290
|
+
getColumnDefinition(column) {
|
|
291
|
+
return column.searchEnabled || typeof column.searchEnabled === 'undefined';
|
|
292
|
+
}
|
|
293
|
+
orderBy(column) {
|
|
294
|
+
this.order.emit(column);
|
|
295
|
+
}
|
|
296
|
+
isOrderEnabled(column) {
|
|
297
|
+
const columnOrderEnabled = column.orderEnabled === undefined ? true : !!column.orderEnabled;
|
|
298
|
+
return this.config.orderEnabled && columnOrderEnabled;
|
|
299
|
+
}
|
|
300
|
+
columnDrop(event) {
|
|
301
|
+
moveItemInArray(this.columns, event.previousIndex, event.currentIndex);
|
|
302
|
+
}
|
|
303
|
+
onSearch($event) {
|
|
304
|
+
this.filter.emit($event);
|
|
305
|
+
}
|
|
306
|
+
getColumnWidth(column) {
|
|
307
|
+
if (column.width) {
|
|
308
|
+
return column.width;
|
|
309
|
+
}
|
|
310
|
+
return this.config.fixedColumnWidth ? 100 / this.columns.length + '%' : null;
|
|
311
|
+
}
|
|
312
|
+
onSelectAll() {
|
|
313
|
+
this.selectAll.emit();
|
|
314
|
+
}
|
|
315
|
+
onMouseDown(event, th) {
|
|
316
|
+
if (!this.config.resizeColumn) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
this.th = th;
|
|
320
|
+
this.startOffset = th.offsetWidth - event.pageX;
|
|
321
|
+
this.event.emit({
|
|
322
|
+
event: Event.onColumnResizeMouseDown,
|
|
323
|
+
value: event,
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
onMouseMove(event) {
|
|
327
|
+
if (!this.config.resizeColumn) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
if (this.th && this.th.style) {
|
|
331
|
+
this.th.style.width = this.startOffset + event.pageX + 'px';
|
|
332
|
+
this.th.style.cursor = 'col-resize';
|
|
333
|
+
this.th.style['user-select'] = 'none';
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
onMouseUp(event) {
|
|
337
|
+
if (!this.config.resizeColumn) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
this.event.emit({
|
|
341
|
+
event: Event.onColumnResizeMouseUp,
|
|
342
|
+
value: event,
|
|
343
|
+
});
|
|
344
|
+
this.th.style.cursor = 'default';
|
|
345
|
+
this.th = undefined;
|
|
346
|
+
}
|
|
347
|
+
showHeaderActionTemplateMenu(column) {
|
|
348
|
+
if (!column.headerActionTemplate) {
|
|
349
|
+
console.error('Column [headerActionTemplate] property not defined');
|
|
350
|
+
}
|
|
351
|
+
if (this.openedHeaderActionTemplate === column.key) {
|
|
352
|
+
this.openedHeaderActionTemplate = null;
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
this.openedHeaderActionTemplate = column.key;
|
|
356
|
+
}
|
|
357
|
+
showMenu() {
|
|
358
|
+
if (!this.additionalActionsTemplate) {
|
|
359
|
+
console.error('[additionalActionsTemplate] property not defined');
|
|
360
|
+
}
|
|
361
|
+
this.menuActive = !this.menuActive;
|
|
362
|
+
}
|
|
363
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: TableTHeadComponent, deps: [{ token: StyleService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
364
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: TableTHeadComponent, selector: "[table-thead]", inputs: { config: "config", columns: "columns", sortKey: "sortKey", sortState: "sortState", selectAllTemplate: "selectAllTemplate", filtersTemplate: "filtersTemplate", additionalActionsTemplate: "additionalActionsTemplate" }, outputs: { filter: "filter", order: "order", selectAll: "selectAll", event: "event" }, host: { listeners: { "document:click": "onClick($event.target)" } }, providers: [StyleService], viewQueries: [{ propertyName: "th", first: true, predicate: ["th"], descendants: true }, { propertyName: "additionalActionMenu", first: true, predicate: ["additionalActionMenu"], descendants: true }, { propertyName: "headerDropdown", predicate: ["headerDropdown"], descendants: true }], ngImport: i0, template: "<tr class=\"ngx-table__header\" *ngIf=\"config.headerEnabled && !config.columnReorder\">\r\n <th *ngIf=\"config.checkboxes || config.radio\" [style.width]=\"'3%'\">\r\n <ng-container\r\n *ngIf=\"selectAllTemplate && config.checkboxes\"\r\n [ngTemplateOutlet]=\"selectAllTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: onSelectAllBinded }\"\r\n >\r\n </ng-container>\r\n <label\r\n class=\"ngx-form-checkbox\"\r\n for=\"selectAllCheckboxes\"\r\n *ngIf=\"!selectAllTemplate && config.checkboxes\"\r\n >\r\n <input type=\"checkbox\" id=\"selectAllCheckboxes\" (change)=\"onSelectAll()\" />\r\n <em class=\"ngx-form-icon\" id=\"selectAllCheckbox\"></em>\r\n </label>\r\n </th>\r\n <ng-container *ngFor=\"let column of columns; let colIndex = index; let last = last\">\r\n <th\r\n class=\"ngx-table__header-cell\"\r\n [class.pinned-left]=\"column.pinned\"\r\n [ngClass]=\"column.cssClass && column.cssClass.includeHeader ? column.cssClass.name : ''\"\r\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\"\r\n #th\r\n [style.width]=\"getColumnWidth(column)\"\r\n (mousedown)=\"onMouseDown($event, th)\"\r\n (mouseup)=\"onMouseUp($event)\"\r\n (mousemove)=\"onMouseMove($event)\"\r\n >\r\n <div\r\n (click)=\"orderBy(column)\"\r\n style=\"display: inline\"\r\n [class.pointer]=\"isOrderEnabled(column)\"\r\n >\r\n <div class=\"ngx-table__header-title\">\r\n {{ column.title }}<span> </span>\r\n <em class=\"ngx-icon ngx-icon-pin\" *ngIf=\"column.pinned\"></em>\r\n <div [style.display]=\"config.orderEnabled ? 'inline' : 'none'\">\r\n <em\r\n *ngIf=\"sortKey === column.key && this.sortState.get(sortKey) === 'asc'\"\r\n class=\"ngx-icon ngx-icon-arrow-up\"\r\n >\r\n </em>\r\n <em\r\n *ngIf=\"sortKey === column.key && this.sortState.get(sortKey) === 'desc'\"\r\n class=\"ngx-icon ngx-icon-arrow-down\"\r\n >\r\n </em>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"ngx-dropdown\" *ngIf=\"!!column.headerActionTemplate\" #headerDropdown>\r\n <a class=\"ngx-btn ngx-btn-link\" (click)=\"showHeaderActionTemplateMenu(column)\">\r\n <span class=\"ngx-icon ngx-icon-more\"></span>\r\n </a>\r\n <div\r\n class=\"ngx-menu ngx-table__table-menu\"\r\n *ngIf=\"column.key === openedHeaderActionTemplate\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"column.headerActionTemplate\"> </ng-container>\r\n </div>\r\n </div>\r\n <div class=\"ngx-table__column-resizer\" *ngIf=\"config.resizeColumn && !last\"></div>\r\n </th>\r\n </ng-container>\r\n <th\r\n *ngIf=\"\r\n config.additionalActions ||\r\n config.detailsTemplate ||\r\n config.collapseAllRows ||\r\n config.groupRows\r\n \"\r\n class=\"ngx-table__header-cell-additional-actions\"\r\n >\r\n <div class=\"ngx-dropdown\" #additionalActionMenu *ngIf=\"config.additionalActions\">\r\n <a class=\"ngx-btn ngx-btn-link\" (click)=\"showMenu()\">\r\n <span class=\"ngx-icon ngx-icon-menu\"></span>\r\n </a>\r\n <ul class=\"ngx-menu ngx-table__table-menu\" *ngIf=\"menuActive\">\r\n <ng-container\r\n *ngIf=\"additionalActionsTemplate\"\r\n [ngTemplateOutlet]=\"additionalActionsTemplate\"\r\n >\r\n </ng-container>\r\n </ul>\r\n </div>\r\n </th>\r\n</tr>\r\n<tr\r\n class=\"ngx-table__header ngx-table__header--draggable\"\r\n *ngIf=\"config.headerEnabled && config.columnReorder\"\r\n cdkDropList\r\n cdkDropListOrientation=\"horizontal\"\r\n (cdkDropListDropped)=\"columnDrop($event)\"\r\n>\r\n <th *ngIf=\"config.checkboxes || config.radio\" [style.width]=\"'3%'\">\r\n <ng-container\r\n *ngIf=\"selectAllTemplate && config.checkboxes\"\r\n [ngTemplateOutlet]=\"selectAllTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: onSelectAllBinded }\"\r\n >\r\n </ng-container>\r\n <label\r\n class=\"ngx-form-checkbox\"\r\n for=\"selectAllCheckboxes\"\r\n *ngIf=\"!selectAllTemplate && config.checkboxes\"\r\n >\r\n <input type=\"checkbox\" id=\"selectAllCheckboxesDrag\" (change)=\"onSelectAll()\" />\r\n <em class=\"ngx-form-icon\" id=\"selectAllCheckboxDrag\"></em>\r\n </label>\r\n </th>\r\n <ng-container *ngFor=\"let column of columns; let colIndex = index; let last = last\">\r\n <th\r\n class=\"ngx-table__header-cell ngx-table__header-cell--draggable\"\r\n cdkDragLockAxis=\"x\"\r\n cdkDrag\r\n [cdkDragStartDelay]=\"config.reorderDelay || 0\"\r\n [class.pinned-left]=\"column.pinned\"\r\n [ngClass]=\"column.cssClass && column.cssClass.includeHeader ? column.cssClass.name : ''\"\r\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\"\r\n #th\r\n [style.width]=\"getColumnWidth(column)\"\r\n (mousedown)=\"onMouseDown($event, th)\"\r\n (mouseup)=\"onMouseUp($event)\"\r\n (mousemove)=\"onMouseMove($event)\"\r\n >\r\n <div\r\n (click)=\"orderBy(column)\"\r\n style=\"display: inline\"\r\n cdkDragHandle\r\n [class.pointer]=\"isOrderEnabled(column)\"\r\n >\r\n <div class=\"ngx-table__header-title\">\r\n {{ column.title }}<span> </span>\r\n <em class=\"ngx-icon ngx-icon-pin\" *ngIf=\"column.pinned\"></em>\r\n <div [style.display]=\"config.orderEnabled ? 'inline' : 'none'\">\r\n <em\r\n *ngIf=\"sortKey === column.key && this.sortState.get(sortKey) === 'asc'\"\r\n class=\"ngx-icon ngx-icon-arrow-up\"\r\n >\r\n </em>\r\n <em\r\n *ngIf=\"sortKey === column.key && this.sortState.get(sortKey) === 'desc'\"\r\n class=\"ngx-icon ngx-icon-arrow-down\"\r\n >\r\n </em>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"ngx-dropdown\" *ngIf=\"!!column.headerActionTemplate\" #headerDropdown>\r\n <a class=\"ngx-btn ngx-btn-link\" (click)=\"showHeaderActionTemplateMenu(column)\">\r\n <span class=\"ngx-icon ngx-icon-more\"></span>\r\n </a>\r\n <div\r\n class=\"ngx-menu ngx-table__table-menu\"\r\n *ngIf=\"column.key === openedHeaderActionTemplate\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"column.headerActionTemplate\"> </ng-container>\r\n </div>\r\n </div>\r\n <div class=\"ngx-table__column-resizer\" *ngIf=\"config.resizeColumn && !last\"></div>\r\n </th>\r\n </ng-container>\r\n <th\r\n *ngIf=\"\r\n config.additionalActions ||\r\n config.detailsTemplate ||\r\n config.collapseAllRows ||\r\n config.groupRows\r\n \"\r\n class=\"ngx-table__header-cell-additional-actions\"\r\n >\r\n <div class=\"ngx-dropdown\" #additionalActionMenu *ngIf=\"config.additionalActions\">\r\n <a class=\"ngx-btn ngx-btn-link\" (click)=\"showMenu()\">\r\n <span class=\"ngx-icon ngx-icon-menu\"></span>\r\n </a>\r\n <ul class=\"ngx-menu ngx-table__table-menu\" *ngIf=\"menuActive\">\r\n <ng-container\r\n *ngIf=\"additionalActionsTemplate\"\r\n [ngTemplateOutlet]=\"additionalActionsTemplate\"\r\n >\r\n </ng-container>\r\n </ul>\r\n </div>\r\n </th>\r\n</tr>\r\n<tr\r\n [style.display]=\"config.searchEnabled && !filtersTemplate ? 'table-row' : 'none'\"\r\n class=\"ngx-table__search-header\"\r\n>\r\n <th *ngIf=\"config.checkboxes || config.radio\"></th>\r\n <ng-container *ngFor=\"let column of columns; let colIndex = index\">\r\n <th\r\n [ngClass]=\"column.cssClass && column.cssClass.includeHeader ? column.cssClass.name : ''\"\r\n [class.pinned-left]=\"column.pinned\"\r\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\"\r\n >\r\n <table-header\r\n *ngIf=\"getColumnDefinition(column)\"\r\n (update)=\"onSearch($event)\"\r\n [column]=\"column\"\r\n >\r\n </table-header>\r\n </th>\r\n </ng-container>\r\n <th *ngIf=\"config.additionalActions || config.detailsTemplate\"></th>\r\n</tr>\r\n<ng-container *ngIf=\"filtersTemplate\">\r\n <tr>\r\n <ng-container [ngTemplateOutlet]=\"filtersTemplate\"> </ng-container>\r\n </tr>\r\n</ng-container>\r\n", styles: [".cdk-drag-preview{text-align:left;padding-top:9px;padding-left:4px;color:#50596c;border:1px solid #e7e9ed}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i3$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i3$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i3$1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: HeaderComponent, selector: "table-header", inputs: ["column"], outputs: ["update"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
365
|
+
}
|
|
366
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: TableTHeadComponent, decorators: [{
|
|
367
|
+
type: Component,
|
|
368
|
+
args: [{ selector: '[table-thead]', changeDetection: ChangeDetectionStrategy.OnPush, providers: [StyleService], template: "<tr class=\"ngx-table__header\" *ngIf=\"config.headerEnabled && !config.columnReorder\">\r\n <th *ngIf=\"config.checkboxes || config.radio\" [style.width]=\"'3%'\">\r\n <ng-container\r\n *ngIf=\"selectAllTemplate && config.checkboxes\"\r\n [ngTemplateOutlet]=\"selectAllTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: onSelectAllBinded }\"\r\n >\r\n </ng-container>\r\n <label\r\n class=\"ngx-form-checkbox\"\r\n for=\"selectAllCheckboxes\"\r\n *ngIf=\"!selectAllTemplate && config.checkboxes\"\r\n >\r\n <input type=\"checkbox\" id=\"selectAllCheckboxes\" (change)=\"onSelectAll()\" />\r\n <em class=\"ngx-form-icon\" id=\"selectAllCheckbox\"></em>\r\n </label>\r\n </th>\r\n <ng-container *ngFor=\"let column of columns; let colIndex = index; let last = last\">\r\n <th\r\n class=\"ngx-table__header-cell\"\r\n [class.pinned-left]=\"column.pinned\"\r\n [ngClass]=\"column.cssClass && column.cssClass.includeHeader ? column.cssClass.name : ''\"\r\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\"\r\n #th\r\n [style.width]=\"getColumnWidth(column)\"\r\n (mousedown)=\"onMouseDown($event, th)\"\r\n (mouseup)=\"onMouseUp($event)\"\r\n (mousemove)=\"onMouseMove($event)\"\r\n >\r\n <div\r\n (click)=\"orderBy(column)\"\r\n style=\"display: inline\"\r\n [class.pointer]=\"isOrderEnabled(column)\"\r\n >\r\n <div class=\"ngx-table__header-title\">\r\n {{ column.title }}<span> </span>\r\n <em class=\"ngx-icon ngx-icon-pin\" *ngIf=\"column.pinned\"></em>\r\n <div [style.display]=\"config.orderEnabled ? 'inline' : 'none'\">\r\n <em\r\n *ngIf=\"sortKey === column.key && this.sortState.get(sortKey) === 'asc'\"\r\n class=\"ngx-icon ngx-icon-arrow-up\"\r\n >\r\n </em>\r\n <em\r\n *ngIf=\"sortKey === column.key && this.sortState.get(sortKey) === 'desc'\"\r\n class=\"ngx-icon ngx-icon-arrow-down\"\r\n >\r\n </em>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"ngx-dropdown\" *ngIf=\"!!column.headerActionTemplate\" #headerDropdown>\r\n <a class=\"ngx-btn ngx-btn-link\" (click)=\"showHeaderActionTemplateMenu(column)\">\r\n <span class=\"ngx-icon ngx-icon-more\"></span>\r\n </a>\r\n <div\r\n class=\"ngx-menu ngx-table__table-menu\"\r\n *ngIf=\"column.key === openedHeaderActionTemplate\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"column.headerActionTemplate\"> </ng-container>\r\n </div>\r\n </div>\r\n <div class=\"ngx-table__column-resizer\" *ngIf=\"config.resizeColumn && !last\"></div>\r\n </th>\r\n </ng-container>\r\n <th\r\n *ngIf=\"\r\n config.additionalActions ||\r\n config.detailsTemplate ||\r\n config.collapseAllRows ||\r\n config.groupRows\r\n \"\r\n class=\"ngx-table__header-cell-additional-actions\"\r\n >\r\n <div class=\"ngx-dropdown\" #additionalActionMenu *ngIf=\"config.additionalActions\">\r\n <a class=\"ngx-btn ngx-btn-link\" (click)=\"showMenu()\">\r\n <span class=\"ngx-icon ngx-icon-menu\"></span>\r\n </a>\r\n <ul class=\"ngx-menu ngx-table__table-menu\" *ngIf=\"menuActive\">\r\n <ng-container\r\n *ngIf=\"additionalActionsTemplate\"\r\n [ngTemplateOutlet]=\"additionalActionsTemplate\"\r\n >\r\n </ng-container>\r\n </ul>\r\n </div>\r\n </th>\r\n</tr>\r\n<tr\r\n class=\"ngx-table__header ngx-table__header--draggable\"\r\n *ngIf=\"config.headerEnabled && config.columnReorder\"\r\n cdkDropList\r\n cdkDropListOrientation=\"horizontal\"\r\n (cdkDropListDropped)=\"columnDrop($event)\"\r\n>\r\n <th *ngIf=\"config.checkboxes || config.radio\" [style.width]=\"'3%'\">\r\n <ng-container\r\n *ngIf=\"selectAllTemplate && config.checkboxes\"\r\n [ngTemplateOutlet]=\"selectAllTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: onSelectAllBinded }\"\r\n >\r\n </ng-container>\r\n <label\r\n class=\"ngx-form-checkbox\"\r\n for=\"selectAllCheckboxes\"\r\n *ngIf=\"!selectAllTemplate && config.checkboxes\"\r\n >\r\n <input type=\"checkbox\" id=\"selectAllCheckboxesDrag\" (change)=\"onSelectAll()\" />\r\n <em class=\"ngx-form-icon\" id=\"selectAllCheckboxDrag\"></em>\r\n </label>\r\n </th>\r\n <ng-container *ngFor=\"let column of columns; let colIndex = index; let last = last\">\r\n <th\r\n class=\"ngx-table__header-cell ngx-table__header-cell--draggable\"\r\n cdkDragLockAxis=\"x\"\r\n cdkDrag\r\n [cdkDragStartDelay]=\"config.reorderDelay || 0\"\r\n [class.pinned-left]=\"column.pinned\"\r\n [ngClass]=\"column.cssClass && column.cssClass.includeHeader ? column.cssClass.name : ''\"\r\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\"\r\n #th\r\n [style.width]=\"getColumnWidth(column)\"\r\n (mousedown)=\"onMouseDown($event, th)\"\r\n (mouseup)=\"onMouseUp($event)\"\r\n (mousemove)=\"onMouseMove($event)\"\r\n >\r\n <div\r\n (click)=\"orderBy(column)\"\r\n style=\"display: inline\"\r\n cdkDragHandle\r\n [class.pointer]=\"isOrderEnabled(column)\"\r\n >\r\n <div class=\"ngx-table__header-title\">\r\n {{ column.title }}<span> </span>\r\n <em class=\"ngx-icon ngx-icon-pin\" *ngIf=\"column.pinned\"></em>\r\n <div [style.display]=\"config.orderEnabled ? 'inline' : 'none'\">\r\n <em\r\n *ngIf=\"sortKey === column.key && this.sortState.get(sortKey) === 'asc'\"\r\n class=\"ngx-icon ngx-icon-arrow-up\"\r\n >\r\n </em>\r\n <em\r\n *ngIf=\"sortKey === column.key && this.sortState.get(sortKey) === 'desc'\"\r\n class=\"ngx-icon ngx-icon-arrow-down\"\r\n >\r\n </em>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"ngx-dropdown\" *ngIf=\"!!column.headerActionTemplate\" #headerDropdown>\r\n <a class=\"ngx-btn ngx-btn-link\" (click)=\"showHeaderActionTemplateMenu(column)\">\r\n <span class=\"ngx-icon ngx-icon-more\"></span>\r\n </a>\r\n <div\r\n class=\"ngx-menu ngx-table__table-menu\"\r\n *ngIf=\"column.key === openedHeaderActionTemplate\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"column.headerActionTemplate\"> </ng-container>\r\n </div>\r\n </div>\r\n <div class=\"ngx-table__column-resizer\" *ngIf=\"config.resizeColumn && !last\"></div>\r\n </th>\r\n </ng-container>\r\n <th\r\n *ngIf=\"\r\n config.additionalActions ||\r\n config.detailsTemplate ||\r\n config.collapseAllRows ||\r\n config.groupRows\r\n \"\r\n class=\"ngx-table__header-cell-additional-actions\"\r\n >\r\n <div class=\"ngx-dropdown\" #additionalActionMenu *ngIf=\"config.additionalActions\">\r\n <a class=\"ngx-btn ngx-btn-link\" (click)=\"showMenu()\">\r\n <span class=\"ngx-icon ngx-icon-menu\"></span>\r\n </a>\r\n <ul class=\"ngx-menu ngx-table__table-menu\" *ngIf=\"menuActive\">\r\n <ng-container\r\n *ngIf=\"additionalActionsTemplate\"\r\n [ngTemplateOutlet]=\"additionalActionsTemplate\"\r\n >\r\n </ng-container>\r\n </ul>\r\n </div>\r\n </th>\r\n</tr>\r\n<tr\r\n [style.display]=\"config.searchEnabled && !filtersTemplate ? 'table-row' : 'none'\"\r\n class=\"ngx-table__search-header\"\r\n>\r\n <th *ngIf=\"config.checkboxes || config.radio\"></th>\r\n <ng-container *ngFor=\"let column of columns; let colIndex = index\">\r\n <th\r\n [ngClass]=\"column.cssClass && column.cssClass.includeHeader ? column.cssClass.name : ''\"\r\n [class.pinned-left]=\"column.pinned\"\r\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\"\r\n >\r\n <table-header\r\n *ngIf=\"getColumnDefinition(column)\"\r\n (update)=\"onSearch($event)\"\r\n [column]=\"column\"\r\n >\r\n </table-header>\r\n </th>\r\n </ng-container>\r\n <th *ngIf=\"config.additionalActions || config.detailsTemplate\"></th>\r\n</tr>\r\n<ng-container *ngIf=\"filtersTemplate\">\r\n <tr>\r\n <ng-container [ngTemplateOutlet]=\"filtersTemplate\"> </ng-container>\r\n </tr>\r\n</ng-container>\r\n", styles: [".cdk-drag-preview{text-align:left;padding-top:9px;padding-left:4px;color:#50596c;border:1px solid #e7e9ed}\n"] }]
|
|
369
|
+
}], ctorParameters: () => [{ type: StyleService }], propDecorators: { config: [{
|
|
370
|
+
type: Input
|
|
371
|
+
}], columns: [{
|
|
372
|
+
type: Input
|
|
373
|
+
}], sortKey: [{
|
|
374
|
+
type: Input
|
|
375
|
+
}], sortState: [{
|
|
376
|
+
type: Input
|
|
377
|
+
}], selectAllTemplate: [{
|
|
378
|
+
type: Input
|
|
379
|
+
}], filtersTemplate: [{
|
|
380
|
+
type: Input
|
|
381
|
+
}], additionalActionsTemplate: [{
|
|
382
|
+
type: Input
|
|
383
|
+
}], filter: [{
|
|
384
|
+
type: Output
|
|
385
|
+
}], order: [{
|
|
386
|
+
type: Output
|
|
387
|
+
}], selectAll: [{
|
|
388
|
+
type: Output
|
|
389
|
+
}], event: [{
|
|
390
|
+
type: Output
|
|
391
|
+
}], th: [{
|
|
392
|
+
type: ViewChild,
|
|
393
|
+
args: ['th']
|
|
394
|
+
}], headerDropdown: [{
|
|
395
|
+
type: ViewChildren,
|
|
396
|
+
args: ['headerDropdown']
|
|
397
|
+
}], additionalActionMenu: [{
|
|
398
|
+
type: ViewChild,
|
|
399
|
+
args: ['additionalActionMenu']
|
|
400
|
+
}], onClick: [{
|
|
401
|
+
type: HostListener,
|
|
402
|
+
args: ['document:click', ['$event.target']]
|
|
403
|
+
}] } });
|
|
404
|
+
|
|
405
|
+
class FiltersService {
|
|
406
|
+
static getPath(p, o) {
|
|
407
|
+
// https://github.com/dherges/ng-packagr/issues/696
|
|
408
|
+
/* eslint-disable-next-line */
|
|
409
|
+
const result = p.reduce((xs, x) => (xs && typeof xs[x] !== 'undefined' ? xs[x] : null), o);
|
|
410
|
+
return result;
|
|
411
|
+
}
|
|
412
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: FiltersService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
413
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: FiltersService }); }
|
|
414
|
+
}
|
|
415
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: FiltersService, decorators: [{
|
|
416
|
+
type: Injectable
|
|
417
|
+
}] });
|
|
418
|
+
|
|
419
|
+
class SearchPipe {
|
|
420
|
+
constructor() {
|
|
421
|
+
this.filters = {};
|
|
422
|
+
}
|
|
423
|
+
transform(array, filter, filteredCountSubject, config) {
|
|
424
|
+
filteredCountSubject.next(0);
|
|
425
|
+
if (typeof array === 'undefined') {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
if (typeof filter === 'undefined') {
|
|
429
|
+
filteredCountSubject.next(array.length);
|
|
430
|
+
return array;
|
|
431
|
+
}
|
|
432
|
+
filter.forEach((f) => {
|
|
433
|
+
this.filters[f.key] = f.value.toString().toLocaleLowerCase();
|
|
434
|
+
if (Object.keys(f).length === 0 || f.value === '') {
|
|
435
|
+
// eslint-disable-next-line
|
|
436
|
+
delete this.filters[f.key];
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
if (config && config.groupRows) {
|
|
440
|
+
return array.map((arr) => this.filterGroup(arr, filteredCountSubject));
|
|
441
|
+
}
|
|
442
|
+
return this.filterGroup(array, filteredCountSubject);
|
|
443
|
+
}
|
|
444
|
+
filterGroup(array, filteredCountSubject) {
|
|
445
|
+
const arr = array.filter((obj) => {
|
|
446
|
+
return Object.keys(this.filters).every((c) => {
|
|
447
|
+
const split = c.split('.');
|
|
448
|
+
const val = FiltersService.getPath(split, obj);
|
|
449
|
+
const element = typeof val === 'object' ? JSON.stringify(val) : val.toString().toLocaleLowerCase();
|
|
450
|
+
const strings = this.filters[c].split(',');
|
|
451
|
+
return strings.some((s) => element.indexOf(s.trim()) > -1);
|
|
452
|
+
});
|
|
453
|
+
});
|
|
454
|
+
filteredCountSubject.next(arr.length);
|
|
455
|
+
return arr;
|
|
456
|
+
}
|
|
457
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: SearchPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
458
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: SearchPipe, name: "search" }); }
|
|
459
|
+
}
|
|
460
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: SearchPipe, decorators: [{
|
|
461
|
+
type: Pipe,
|
|
462
|
+
args: [{
|
|
463
|
+
name: 'search',
|
|
464
|
+
}]
|
|
465
|
+
}] });
|
|
466
|
+
|
|
467
|
+
class RenderPipe {
|
|
468
|
+
transform(row, key) {
|
|
469
|
+
const split = key.split('.');
|
|
470
|
+
return FiltersService.getPath(split, row);
|
|
471
|
+
}
|
|
472
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: RenderPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
473
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: RenderPipe, name: "render" }); }
|
|
474
|
+
}
|
|
475
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: RenderPipe, decorators: [{
|
|
476
|
+
type: Pipe,
|
|
477
|
+
args: [{
|
|
478
|
+
name: 'render',
|
|
479
|
+
}]
|
|
480
|
+
}] });
|
|
481
|
+
|
|
482
|
+
class GlobalSearchPipe {
|
|
483
|
+
transform(array, filter, filteredCountSubject) {
|
|
484
|
+
filteredCountSubject.next(0);
|
|
485
|
+
if (typeof array === 'undefined') {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
if (typeof filter === 'undefined' || Object.keys(filter).length === 0 || filter === '') {
|
|
489
|
+
filteredCountSubject.next(array.length);
|
|
490
|
+
return array;
|
|
491
|
+
}
|
|
492
|
+
const arr = array.filter((row) => {
|
|
493
|
+
const element = JSON.stringify(Object.values(row));
|
|
494
|
+
const strings = filter.split(',');
|
|
495
|
+
return strings.some((s) => element.toLocaleLowerCase().indexOf(s.trim().toLocaleLowerCase()) > -1);
|
|
496
|
+
});
|
|
497
|
+
filteredCountSubject.next(arr.length);
|
|
498
|
+
return arr;
|
|
499
|
+
}
|
|
500
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GlobalSearchPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
501
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: GlobalSearchPipe, name: "global" }); }
|
|
502
|
+
}
|
|
503
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GlobalSearchPipe, decorators: [{
|
|
504
|
+
type: Pipe,
|
|
505
|
+
args: [{
|
|
506
|
+
name: 'global',
|
|
507
|
+
}]
|
|
508
|
+
}] });
|
|
509
|
+
|
|
510
|
+
class SortPipe {
|
|
511
|
+
constructor() {
|
|
512
|
+
this.defaultArray = [];
|
|
513
|
+
}
|
|
514
|
+
static isNaN(aV, bV) {
|
|
515
|
+
return isNaN(parseFloat(aV)) || !isFinite(aV) || isNaN(parseFloat(bV)) || !isFinite(bV);
|
|
516
|
+
}
|
|
517
|
+
static compare(a, b, key) {
|
|
518
|
+
const split = key.split('.');
|
|
519
|
+
const aPath = FiltersService.getPath(split, a);
|
|
520
|
+
const bPath = FiltersService.getPath(split, b);
|
|
521
|
+
const aValue = (aPath + '').toLowerCase();
|
|
522
|
+
const bValue = (bPath + '').toLowerCase();
|
|
523
|
+
if (SortPipe.isNaN(aPath, bPath)) {
|
|
524
|
+
return aValue.localeCompare(bValue);
|
|
525
|
+
}
|
|
526
|
+
if (parseFloat(aPath) < parseFloat(bPath)) {
|
|
527
|
+
return -1;
|
|
528
|
+
}
|
|
529
|
+
if (parseFloat(aPath) > parseFloat(bPath)) {
|
|
530
|
+
return 1;
|
|
531
|
+
}
|
|
532
|
+
return 0;
|
|
533
|
+
}
|
|
534
|
+
transform(array, filter, config) {
|
|
535
|
+
if (this.defaultArray.length === 0) {
|
|
536
|
+
this.defaultArray = array;
|
|
537
|
+
}
|
|
538
|
+
if (!filter.key || filter.key === '') {
|
|
539
|
+
return array;
|
|
540
|
+
}
|
|
541
|
+
if (filter.order === '') {
|
|
542
|
+
return this.defaultArray;
|
|
543
|
+
}
|
|
544
|
+
if (filter.order === 'asc') {
|
|
545
|
+
return this.sortAsc(array, filter, config);
|
|
546
|
+
}
|
|
547
|
+
return this.sortDesc(array, filter, config);
|
|
548
|
+
}
|
|
549
|
+
sortAsc(array, filter, config) {
|
|
550
|
+
if (config && config.groupRows) {
|
|
551
|
+
return array.map((arr) => arr.sort((a, b) => SortPipe.compare(a, b, filter.key)));
|
|
552
|
+
}
|
|
553
|
+
return array.sort((a, b) => SortPipe.compare(a, b, filter.key));
|
|
554
|
+
}
|
|
555
|
+
sortDesc(array, filter, config) {
|
|
556
|
+
if (config && config.groupRows) {
|
|
557
|
+
return array.map((arr) => arr.sort((a, b) => SortPipe.compare(b, a, filter.key)));
|
|
558
|
+
}
|
|
559
|
+
return array.sort((a, b) => SortPipe.compare(b, a, filter.key));
|
|
560
|
+
}
|
|
561
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: SortPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
562
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: SortPipe, name: "sort" }); }
|
|
563
|
+
}
|
|
564
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: SortPipe, decorators: [{
|
|
565
|
+
type: Pipe,
|
|
566
|
+
args: [{
|
|
567
|
+
name: 'sort',
|
|
568
|
+
}]
|
|
569
|
+
}] });
|
|
570
|
+
|
|
571
|
+
class BaseComponent {
|
|
572
|
+
onContextMenuClick(targetElement) {
|
|
573
|
+
if (this.contextMenu && !this.contextMenu.nativeElement.contains(targetElement)) {
|
|
574
|
+
this.rowContextMenuPosition = {
|
|
575
|
+
top: null,
|
|
576
|
+
left: null,
|
|
577
|
+
value: null,
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
constructor(cdr, scrollDispatcher, styleService) {
|
|
582
|
+
this.cdr = cdr;
|
|
583
|
+
this.scrollDispatcher = scrollDispatcher;
|
|
584
|
+
this.styleService = styleService;
|
|
585
|
+
this.unsubscribe = new Subject();
|
|
586
|
+
this.filterCount = -1;
|
|
587
|
+
this.filteredCountSubject = new Subject();
|
|
588
|
+
this.tableClass = null;
|
|
589
|
+
this.grouped = [];
|
|
590
|
+
this.isSelected = false;
|
|
591
|
+
this.page = 1;
|
|
592
|
+
this.count = 0;
|
|
593
|
+
this.sortState = new Map();
|
|
594
|
+
this.sortKey = null;
|
|
595
|
+
this.rowContextMenuPosition = {
|
|
596
|
+
top: null,
|
|
597
|
+
left: null,
|
|
598
|
+
value: null,
|
|
599
|
+
};
|
|
600
|
+
this.sortBy = {
|
|
601
|
+
key: '',
|
|
602
|
+
order: 'asc',
|
|
603
|
+
};
|
|
604
|
+
this.selectedDetailsTemplateRowId = new Set();
|
|
605
|
+
this.selectedCheckboxes = new Set();
|
|
606
|
+
this.id = 'table';
|
|
607
|
+
this.event = new EventEmitter();
|
|
608
|
+
this.filteredCountSubject.pipe(takeUntil(this.unsubscribe)).subscribe((count) => {
|
|
609
|
+
setTimeout(() => {
|
|
610
|
+
this.filterCount = count;
|
|
611
|
+
this.cdr.detectChanges();
|
|
612
|
+
});
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
ngOnInit() {
|
|
616
|
+
if (!this.columns) {
|
|
617
|
+
console.error('[columns] property required!');
|
|
618
|
+
}
|
|
619
|
+
if (this.configuration) {
|
|
620
|
+
this.config = this.configuration;
|
|
621
|
+
}
|
|
622
|
+
else {
|
|
623
|
+
this.config = DefaultConfigService.config;
|
|
624
|
+
}
|
|
625
|
+
this.limit = this.config.rows;
|
|
626
|
+
if (this.groupRowsBy) {
|
|
627
|
+
this.grouped = GroupRowsService.doGroupRows(this.data, this.groupRowsBy);
|
|
628
|
+
}
|
|
629
|
+
this.doDecodePersistedState();
|
|
630
|
+
}
|
|
631
|
+
ngOnDestroy() {
|
|
632
|
+
this.unsubscribe.next();
|
|
633
|
+
this.unsubscribe.complete();
|
|
634
|
+
}
|
|
635
|
+
ngAfterViewInit() {
|
|
636
|
+
const throttleValue = this.config.infiniteScrollThrottleTime
|
|
637
|
+
? this.config.infiniteScrollThrottleTime
|
|
638
|
+
: 200;
|
|
639
|
+
this.scrollDispatcher
|
|
640
|
+
.scrolled()
|
|
641
|
+
.pipe(throttleTime(throttleValue), filter((event) => {
|
|
642
|
+
return (!!event &&
|
|
643
|
+
this.viewPort &&
|
|
644
|
+
this.viewPort.getRenderedRange().end === this.viewPort.getDataLength());
|
|
645
|
+
}), takeUntil(this.unsubscribe))
|
|
646
|
+
.subscribe(() => {
|
|
647
|
+
this.emitEvent(Event.onInfiniteScrollEnd, null);
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
ngOnChanges(changes) {
|
|
651
|
+
const { configuration, data, pagination, groupRowsBy } = changes;
|
|
652
|
+
this.toggleRowIndex = changes.toggleRowIndex;
|
|
653
|
+
if (configuration && configuration.currentValue) {
|
|
654
|
+
this.config = configuration.currentValue;
|
|
655
|
+
}
|
|
656
|
+
if (data && data.currentValue) {
|
|
657
|
+
this.doApplyData(data);
|
|
658
|
+
}
|
|
659
|
+
if (pagination && pagination.currentValue) {
|
|
660
|
+
const { count, limit, offset } = pagination.currentValue;
|
|
661
|
+
this.count = count;
|
|
662
|
+
this.limit = limit;
|
|
663
|
+
this.page = offset;
|
|
664
|
+
}
|
|
665
|
+
if (groupRowsBy && groupRowsBy.currentValue) {
|
|
666
|
+
this.grouped = GroupRowsService.doGroupRows(this.data, this.groupRowsBy);
|
|
667
|
+
}
|
|
668
|
+
if (this.toggleRowIndex && this.toggleRowIndex.currentValue) {
|
|
669
|
+
const row = this.toggleRowIndex.currentValue;
|
|
670
|
+
this.collapseRow(row.index);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
orderBy(column) {
|
|
674
|
+
if (typeof column.orderEnabled !== 'undefined' && !column.orderEnabled) {
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
this.sortKey = column.key;
|
|
678
|
+
if (!this.config.orderEnabled || this.sortKey === '') {
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
this.setColumnOrder(column);
|
|
682
|
+
if (!this.config.orderEventOnly && !column.orderEventOnly) {
|
|
683
|
+
this.sortBy.key = this.sortKey;
|
|
684
|
+
this.sortBy.order = this.sortState.get(this.sortKey);
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
this.sortBy.key = '';
|
|
688
|
+
this.sortBy.order = '';
|
|
689
|
+
}
|
|
690
|
+
if (!this.config.serverPagination) {
|
|
691
|
+
this.data = [...this.data];
|
|
692
|
+
this.sortBy = { ...this.sortBy };
|
|
693
|
+
}
|
|
694
|
+
const value = {
|
|
695
|
+
key: this.sortKey,
|
|
696
|
+
order: this.sortState.get(this.sortKey),
|
|
697
|
+
};
|
|
698
|
+
this.emitEvent(Event.onOrder, value);
|
|
699
|
+
}
|
|
700
|
+
onClick($event, row, key, colIndex, rowIndex) {
|
|
701
|
+
if (this.config.selectRow) {
|
|
702
|
+
this.selectedRow = rowIndex;
|
|
703
|
+
}
|
|
704
|
+
if (this.config.selectCol && `${colIndex}`) {
|
|
705
|
+
this.selectedCol = colIndex;
|
|
706
|
+
}
|
|
707
|
+
if (this.config.selectCell && `${colIndex}`) {
|
|
708
|
+
this.selectedRow = rowIndex;
|
|
709
|
+
this.selectedCol = colIndex;
|
|
710
|
+
}
|
|
711
|
+
if (this.config.clickEvent) {
|
|
712
|
+
const value = {
|
|
713
|
+
event: $event,
|
|
714
|
+
row,
|
|
715
|
+
key,
|
|
716
|
+
rowId: rowIndex,
|
|
717
|
+
colId: colIndex,
|
|
718
|
+
};
|
|
719
|
+
this.emitEvent(Event.onClick, value);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
onDoubleClick($event, row, key, colIndex, rowIndex) {
|
|
723
|
+
const value = {
|
|
724
|
+
event: $event,
|
|
725
|
+
row,
|
|
726
|
+
key,
|
|
727
|
+
rowId: rowIndex,
|
|
728
|
+
colId: colIndex,
|
|
729
|
+
};
|
|
730
|
+
this.emitEvent(Event.onDoubleClick, value);
|
|
731
|
+
}
|
|
732
|
+
onCheckboxSelect($event, row, rowIndex) {
|
|
733
|
+
const value = {
|
|
734
|
+
event: $event,
|
|
735
|
+
row,
|
|
736
|
+
rowId: rowIndex,
|
|
737
|
+
};
|
|
738
|
+
this.emitEvent(Event.onCheckboxSelect, value);
|
|
739
|
+
}
|
|
740
|
+
onRadioSelect($event, row, rowIndex) {
|
|
741
|
+
const value = {
|
|
742
|
+
event: $event,
|
|
743
|
+
row,
|
|
744
|
+
rowId: rowIndex,
|
|
745
|
+
};
|
|
746
|
+
this.emitEvent(Event.onRadioSelect, value);
|
|
747
|
+
}
|
|
748
|
+
onSelectAll() {
|
|
749
|
+
this.isSelected = !this.isSelected;
|
|
750
|
+
this.emitEvent(Event.onSelectAll, this.isSelected);
|
|
751
|
+
}
|
|
752
|
+
onSearch($event) {
|
|
753
|
+
if (!this.config.serverPagination) {
|
|
754
|
+
this.term = $event;
|
|
755
|
+
}
|
|
756
|
+
this.emitEvent(Event.onSearch, $event);
|
|
757
|
+
}
|
|
758
|
+
onGlobalSearch(value) {
|
|
759
|
+
if (!this.config.serverPagination) {
|
|
760
|
+
this.globalSearchTerm = value;
|
|
761
|
+
}
|
|
762
|
+
this.emitEvent(Event.onGlobalSearch, value);
|
|
763
|
+
}
|
|
764
|
+
onPagination(pagination) {
|
|
765
|
+
this.page = pagination.page;
|
|
766
|
+
this.limit = pagination.limit;
|
|
767
|
+
this.config.rows = pagination.limit;
|
|
768
|
+
this.emitEvent(Event.onPagination, pagination);
|
|
769
|
+
}
|
|
770
|
+
toggleCheckbox(rowIndex) {
|
|
771
|
+
this.selectedCheckboxes.has(rowIndex)
|
|
772
|
+
? this.selectedCheckboxes.delete(rowIndex)
|
|
773
|
+
: this.selectedCheckboxes.add(rowIndex);
|
|
774
|
+
}
|
|
775
|
+
collapseRow(rowIndex) {
|
|
776
|
+
if (this.selectedDetailsTemplateRowId.has(rowIndex)) {
|
|
777
|
+
this.selectedDetailsTemplateRowId.delete(rowIndex);
|
|
778
|
+
this.emitEvent(Event.onRowCollapsedHide, rowIndex);
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
this.selectedDetailsTemplateRowId.add(rowIndex);
|
|
782
|
+
this.emitEvent(Event.onRowCollapsedShow, rowIndex);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
doDecodePersistedState() {
|
|
786
|
+
if (!this.config.persistState) {
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
const pagination = localStorage.getItem(Event.onPagination);
|
|
790
|
+
const sort = localStorage.getItem(Event.onOrder);
|
|
791
|
+
const search = localStorage.getItem(Event.onSearch);
|
|
792
|
+
if (pagination) {
|
|
793
|
+
this.onPagination(JSON.parse(pagination));
|
|
794
|
+
}
|
|
795
|
+
if (sort) {
|
|
796
|
+
const { key, order } = JSON.parse(sort);
|
|
797
|
+
this.bindApi({
|
|
798
|
+
type: API.sortBy,
|
|
799
|
+
value: { column: key, order },
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
if (search) {
|
|
803
|
+
this.bindApi({
|
|
804
|
+
type: API.setInputValue,
|
|
805
|
+
value: JSON.parse(search),
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
isRowCollapsed(rowIndex) {
|
|
810
|
+
if (this.config.collapseAllRows) {
|
|
811
|
+
return true;
|
|
812
|
+
}
|
|
813
|
+
return this.selectedDetailsTemplateRowId.has(rowIndex);
|
|
814
|
+
}
|
|
815
|
+
get loadingHeight() {
|
|
816
|
+
const table = document.getElementById(this.id);
|
|
817
|
+
if (table && table.rows && table.rows.length > 3) {
|
|
818
|
+
const searchEnabled = this.config.searchEnabled ? 1 : 0;
|
|
819
|
+
const headerEnabled = this.config.headerEnabled ? 1 : 0;
|
|
820
|
+
const borderTrHeight = 1;
|
|
821
|
+
const borderDivHeight = 2;
|
|
822
|
+
return ((table.rows.length - searchEnabled - headerEnabled) *
|
|
823
|
+
(table.rows[3].offsetHeight - borderTrHeight) -
|
|
824
|
+
borderDivHeight);
|
|
825
|
+
}
|
|
826
|
+
return 30;
|
|
827
|
+
}
|
|
828
|
+
get arrowDefinition() {
|
|
829
|
+
return this.config.showDetailsArrow || typeof this.config.showDetailsArrow === 'undefined';
|
|
830
|
+
}
|
|
831
|
+
onRowContextMenu($event, row, key, colIndex, rowIndex) {
|
|
832
|
+
if (!this.config.showContextMenu) {
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
$event.preventDefault();
|
|
836
|
+
const value = {
|
|
837
|
+
event: $event,
|
|
838
|
+
row,
|
|
839
|
+
key,
|
|
840
|
+
rowId: rowIndex,
|
|
841
|
+
colId: colIndex,
|
|
842
|
+
};
|
|
843
|
+
this.rowContextMenuPosition = {
|
|
844
|
+
top: `${$event.pageY - 10}px`,
|
|
845
|
+
left: `${$event.pageX - 10}px`,
|
|
846
|
+
value,
|
|
847
|
+
};
|
|
848
|
+
this.emitEvent(Event.onRowContextMenu, value);
|
|
849
|
+
}
|
|
850
|
+
doApplyData(data) {
|
|
851
|
+
const order = this.columns.find((c) => !!c.orderBy);
|
|
852
|
+
if (order) {
|
|
853
|
+
this.sortState.set(this.sortKey, order.orderBy === 'asc' ? 'desc' : 'asc');
|
|
854
|
+
this.orderBy(order);
|
|
855
|
+
}
|
|
856
|
+
else {
|
|
857
|
+
this.data = [...data.currentValue];
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
onDragStart(event) {
|
|
861
|
+
this.emitEvent(Event.onReorderStart, event);
|
|
862
|
+
}
|
|
863
|
+
onDrop(event) {
|
|
864
|
+
this.emitEvent(Event.onRowDrop, event);
|
|
865
|
+
moveItemInArray(this.data, event.previousIndex, event.currentIndex);
|
|
866
|
+
}
|
|
867
|
+
// DO NOT REMOVE. It is called from parent component. See src/app/demo/api-doc/api-doc.component.ts
|
|
868
|
+
apiEvent(event) {
|
|
869
|
+
return this.bindApi(event);
|
|
870
|
+
}
|
|
871
|
+
/* eslint-disable */
|
|
872
|
+
bindApi(event) {
|
|
873
|
+
switch (event.type) {
|
|
874
|
+
case API.rowContextMenuClicked:
|
|
875
|
+
this.rowContextMenuPosition = {
|
|
876
|
+
top: null,
|
|
877
|
+
left: null,
|
|
878
|
+
value: null,
|
|
879
|
+
};
|
|
880
|
+
break;
|
|
881
|
+
case API.toggleRowIndex:
|
|
882
|
+
this.collapseRow(event.value);
|
|
883
|
+
break;
|
|
884
|
+
case API.toggleCheckbox:
|
|
885
|
+
this.toggleCheckbox(event.value);
|
|
886
|
+
break;
|
|
887
|
+
case API.setInputValue:
|
|
888
|
+
if (this.config.searchEnabled) {
|
|
889
|
+
event.value.forEach((input) => {
|
|
890
|
+
const element = document.getElementById(`search_${input.key}`);
|
|
891
|
+
if (!element) {
|
|
892
|
+
console.error(`Column '${input.key}' not available in the DOM. Have you misspelled a name?`);
|
|
893
|
+
}
|
|
894
|
+
else {
|
|
895
|
+
element.value = input.value;
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
this.onSearch(event.value);
|
|
900
|
+
this.cdr.markForCheck();
|
|
901
|
+
break;
|
|
902
|
+
case API.onGlobalSearch:
|
|
903
|
+
this.onGlobalSearch(event.value);
|
|
904
|
+
this.cdr.markForCheck();
|
|
905
|
+
break;
|
|
906
|
+
case API.setRowClass:
|
|
907
|
+
if (Array.isArray(event.value)) {
|
|
908
|
+
event.value.forEach((val) => this.styleService.setRowClass(val));
|
|
909
|
+
break;
|
|
910
|
+
}
|
|
911
|
+
this.styleService.setRowClass(event.value);
|
|
912
|
+
this.cdr.markForCheck();
|
|
913
|
+
break;
|
|
914
|
+
case API.setCellClass:
|
|
915
|
+
if (Array.isArray(event.value)) {
|
|
916
|
+
event.value.forEach((val) => this.styleService.setCellClass(val));
|
|
917
|
+
break;
|
|
918
|
+
}
|
|
919
|
+
this.styleService.setCellClass(event.value);
|
|
920
|
+
break;
|
|
921
|
+
case API.setRowStyle:
|
|
922
|
+
if (Array.isArray(event.value)) {
|
|
923
|
+
event.value.forEach((val) => this.styleService.setRowStyle(val));
|
|
924
|
+
break;
|
|
925
|
+
}
|
|
926
|
+
this.styleService.setRowStyle(event.value);
|
|
927
|
+
break;
|
|
928
|
+
case API.setCellStyle:
|
|
929
|
+
if (Array.isArray(event.value)) {
|
|
930
|
+
event.value.forEach((val) => this.styleService.setCellStyle(val));
|
|
931
|
+
break;
|
|
932
|
+
}
|
|
933
|
+
this.styleService.setCellStyle(event.value);
|
|
934
|
+
break;
|
|
935
|
+
case API.setTableClass:
|
|
936
|
+
this.tableClass = event.value;
|
|
937
|
+
this.cdr.markForCheck();
|
|
938
|
+
break;
|
|
939
|
+
case API.getPaginationTotalItems:
|
|
940
|
+
return this.paginationComponent.paginationDirective.getTotalItems();
|
|
941
|
+
case API.getPaginationCurrentPage:
|
|
942
|
+
return this.paginationComponent.paginationDirective.getCurrent();
|
|
943
|
+
case API.getPaginationLastPage:
|
|
944
|
+
return this.paginationComponent.paginationDirective.getLastPage();
|
|
945
|
+
case API.getNumberOfRowsPerPage:
|
|
946
|
+
return this.paginationComponent.paginationDirective.isLastPage()
|
|
947
|
+
? this.paginationComponent.paginationDirective.getTotalItems() % this.limit
|
|
948
|
+
: this.limit;
|
|
949
|
+
case API.setPaginationCurrentPage:
|
|
950
|
+
this.paginationComponent.paginationDirective.setCurrent(event.value);
|
|
951
|
+
break;
|
|
952
|
+
case API.setPaginationRange:
|
|
953
|
+
this.paginationComponent.ranges = event.value;
|
|
954
|
+
break;
|
|
955
|
+
case API.setPaginationPreviousLabel:
|
|
956
|
+
this.paginationComponent.previousLabel = event.value;
|
|
957
|
+
break;
|
|
958
|
+
case API.setPaginationNextLabel:
|
|
959
|
+
this.paginationComponent.nextLabel = event.value;
|
|
960
|
+
break;
|
|
961
|
+
case API.setPaginationDisplayLimit:
|
|
962
|
+
this.paginationComponent.changeLimit(event.value, true);
|
|
963
|
+
break;
|
|
964
|
+
case API.sortBy:
|
|
965
|
+
const column = { title: '', key: event.value.column, orderBy: event.value.order };
|
|
966
|
+
this.orderBy(column);
|
|
967
|
+
this.cdr.detectChanges();
|
|
968
|
+
break;
|
|
969
|
+
default:
|
|
970
|
+
break;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
setColumnOrder(column) {
|
|
974
|
+
const key = column.key;
|
|
975
|
+
switch (this.sortState.get(key)) {
|
|
976
|
+
case '':
|
|
977
|
+
case undefined:
|
|
978
|
+
this.sortState.set(key, column.orderBy || 'desc');
|
|
979
|
+
break;
|
|
980
|
+
case 'asc':
|
|
981
|
+
this.config.threeWaySort ? this.sortState.set(key, '') : this.sortState.set(key, 'desc');
|
|
982
|
+
break;
|
|
983
|
+
case 'desc':
|
|
984
|
+
this.sortState.set(key, 'asc');
|
|
985
|
+
break;
|
|
986
|
+
}
|
|
987
|
+
if (this.sortState.size > 1) {
|
|
988
|
+
const temp = this.sortState.get(key);
|
|
989
|
+
this.sortState.clear();
|
|
990
|
+
this.sortState.set(key, temp);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
emitEvent(event, value) {
|
|
994
|
+
this.event.emit({ event, value });
|
|
995
|
+
if (this.config.persistState) {
|
|
996
|
+
localStorage.setItem(event, JSON.stringify(value));
|
|
997
|
+
}
|
|
998
|
+
if (this.config.logger) {
|
|
999
|
+
// eslint-disable-next-line no-console
|
|
1000
|
+
console.log({ event, value });
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
dragEnter($event) {
|
|
1004
|
+
$event.preventDefault();
|
|
1005
|
+
$event.stopPropagation();
|
|
1006
|
+
}
|
|
1007
|
+
dragOver($event) {
|
|
1008
|
+
$event.preventDefault();
|
|
1009
|
+
$event.stopPropagation();
|
|
1010
|
+
}
|
|
1011
|
+
dragLeave($event) {
|
|
1012
|
+
$event.preventDefault();
|
|
1013
|
+
$event.stopPropagation();
|
|
1014
|
+
}
|
|
1015
|
+
drop($event) {
|
|
1016
|
+
$event.preventDefault();
|
|
1017
|
+
$event.stopPropagation();
|
|
1018
|
+
const file = $event.dataTransfer?.files?.[0];
|
|
1019
|
+
if (file?.type !== 'application/json') {
|
|
1020
|
+
// eslint-disable-next-line no-console
|
|
1021
|
+
console.log('File not allowed');
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
const fileReader = new FileReader();
|
|
1025
|
+
fileReader.onload = (event) => {
|
|
1026
|
+
this.data = JSON.parse(event?.target?.result);
|
|
1027
|
+
this.cdr.markForCheck();
|
|
1028
|
+
};
|
|
1029
|
+
fileReader.readAsText(file);
|
|
1030
|
+
}
|
|
1031
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: BaseComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.ScrollDispatcher }, { token: StyleService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1032
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: BaseComponent, selector: "ngx-table", inputs: { configuration: "configuration", data: "data", pagination: "pagination", groupRowsBy: "groupRowsBy", id: "id", toggleRowIndex: "toggleRowIndex", detailsTemplate: "detailsTemplate", summaryTemplate: "summaryTemplate", groupRowsHeaderTemplate: "groupRowsHeaderTemplate", filtersTemplate: "filtersTemplate", selectAllTemplate: "selectAllTemplate", noResultsTemplate: "noResultsTemplate", loadingTemplate: "loadingTemplate", additionalActionsTemplate: "additionalActionsTemplate", rowContextMenu: "rowContextMenu", columns: "columns" }, outputs: { event: "event" }, host: { listeners: { "document:click": "onContextMenuClick($event.target)" } }, providers: [DefaultConfigService, GroupRowsService, StyleService], queries: [{ propertyName: "rowTemplate", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "paginationComponent", first: true, predicate: ["paginationComponent"], descendants: true }, { propertyName: "contextMenu", first: true, predicate: ["contextMenu"], descendants: true }, { propertyName: "table", first: true, predicate: ["table"], descendants: true }, { propertyName: "viewPort", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\r\n class=\"ngx-container\"\r\n [class.ngx-container--dark]=\"config.tableLayout.theme === 'dark'\"\r\n (dragenter)=\"dragEnter($event)\"\r\n (dragover)=\"dragOver($event)\"\r\n (dragleave)=\"dragLeave($event)\"\r\n (drop)=\"drop($event)\"\r\n>\r\n <table\r\n [id]=\"id\"\r\n #table\r\n [ngClass]=\"tableClass === null || tableClass === '' ? 'ngx-table' : tableClass\"\r\n [class.ngx-table__table--tiny]=\"config.tableLayout.style === 'tiny'\"\r\n [class.ngx-table__table--normal]=\"config.tableLayout.style === 'normal'\"\r\n [class.ngx-table__table--big]=\"config.tableLayout.style === 'big'\"\r\n [class.ngx-table__table--borderless]=\"config.tableLayout.borderless\"\r\n [class.ngx-table__table--dark]=\"config.tableLayout.theme === 'dark'\"\r\n [class.ngx-table__table--hoverable]=\"config.tableLayout.hover\"\r\n [class.ngx-table__table--striped]=\"config.tableLayout.striped\"\r\n [class.ngx-table__horizontal-scroll]=\"config.horizontalScroll && !config.isLoading\"\r\n >\r\n <thead\r\n [class.ngx-infinite-scroll-viewport-thead]=\"config.infiniteScroll\"\r\n table-thead\r\n [config]=\"config\"\r\n [sortKey]=\"sortKey\"\r\n [sortState]=\"sortState\"\r\n [selectAllTemplate]=\"selectAllTemplate\"\r\n [filtersTemplate]=\"filtersTemplate\"\r\n [additionalActionsTemplate]=\"additionalActionsTemplate\"\r\n [columns]=\"columns\"\r\n (selectAll)=\"onSelectAll()\"\r\n (filter)=\"onSearch($event)\"\r\n (order)=\"orderBy($event)\"\r\n (event)=\"emitEvent($event.event, $event.value)\"\r\n ></thead>\r\n <tbody *ngIf=\"data && !config.isLoading && !config.rowReorder\">\r\n <ng-container *ngIf=\"rowTemplate\">\r\n <ul\r\n class=\"ngx-table__table-row-context-menu\"\r\n [ngStyle]=\"{\r\n position: 'absolute',\r\n top: rowContextMenuPosition.top,\r\n left: rowContextMenuPosition.left\r\n }\"\r\n *ngIf=\"rowContextMenuPosition.top\"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"rowContextMenu\"\r\n [ngTemplateOutletContext]=\"{ $implicit: rowContextMenuPosition.value }\"\r\n >\r\n </ng-container>\r\n </ul>\r\n <ng-container *ngIf=\"!config.infiniteScroll\">\r\n <ng-container\r\n *ngFor=\"\r\n let row of data\r\n | sort: sortBy\r\n | search: term:filteredCountSubject\r\n | global: globalSearchTerm:filteredCountSubject\r\n | paginate: { itemsPerPage: limit, currentPage: page, totalItems: count, id: id }\r\n \"\r\n >\r\n <tr\r\n (click)=\"onClick($event, row, '', null, data.indexOf(row))\"\r\n #contextMenu\r\n (contextmenu)=\"onRowContextMenu($event, row, '', null, data.indexOf(row))\"\r\n (dblclick)=\"onDoubleClick($event, row, '', null, data.indexOf(row))\"\r\n [class.ngx-table__table-row--selected]=\"\r\n data.indexOf(row) === selectedRow && !config.selectCell\r\n \"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"rowTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row, index: data.indexOf(row) }\"\r\n >\r\n </ng-container>\r\n <td *ngIf=\"config.detailsTemplate\">\r\n <span\r\n class=\"ngx-icon\"\r\n *ngIf=\"arrowDefinition\"\r\n [ngClass]=\"\r\n isRowCollapsed(data.indexOf(row))\r\n ? 'ngx-icon-arrow-down'\r\n : 'ngx-icon-arrow-right'\r\n \"\r\n (click)=\"collapseRow(data.indexOf(row))\"\r\n >\r\n </span>\r\n </td>\r\n </tr>\r\n <tr\r\n *ngIf=\"\r\n (config.detailsTemplate && selectedDetailsTemplateRowId.has(data.indexOf(row))) ||\r\n config.collapseAllRows\r\n \"\r\n >\r\n <td [attr.colspan]=\"columns.length + 1\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"detailsTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row, index: data.indexOf(row) }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n </ng-container>\r\n <cdk-virtual-scroll-viewport\r\n itemSize=\"50\"\r\n *ngIf=\"config.infiniteScroll\"\r\n class=\"ngx-infinite-scroll-viewport\"\r\n >\r\n <ng-container\r\n *cdkVirtualFor=\"\r\n let row of data\r\n | sort: sortBy\r\n | search: term:filteredCountSubject\r\n | global: globalSearchTerm:filteredCountSubject;\r\n let rowIndex = index\r\n \"\r\n >\r\n <tr\r\n (click)=\"onClick($event, row, '', null, rowIndex)\"\r\n #contextMenu\r\n (contextmenu)=\"onRowContextMenu($event, row, '', null, rowIndex)\"\r\n (dblclick)=\"onDoubleClick($event, row, '', null, rowIndex)\"\r\n [class.ngx-table__table-row--selected]=\"\r\n rowIndex === selectedRow && !config.selectCell\r\n \"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"rowTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row, index: rowIndex }\"\r\n >\r\n </ng-container>\r\n <td *ngIf=\"config.detailsTemplate\">\r\n <span\r\n class=\"ngx-icon\"\r\n *ngIf=\"arrowDefinition\"\r\n [ngClass]=\"\r\n isRowCollapsed(rowIndex) ? 'ngx-icon-arrow-down' : 'ngx-icon-arrow-right'\r\n \"\r\n (click)=\"collapseRow(rowIndex)\"\r\n >\r\n </span>\r\n </td>\r\n </tr>\r\n <tr\r\n *ngIf=\"\r\n (config.detailsTemplate && selectedDetailsTemplateRowId.has(rowIndex)) ||\r\n config.collapseAllRows\r\n \"\r\n >\r\n <td [attr.colspan]=\"columns.length + 1\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"detailsTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row, index: rowIndex }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n </cdk-virtual-scroll-viewport>\r\n </ng-container>\r\n <ng-container *ngIf=\"!rowTemplate && !config.groupRows\">\r\n <ul\r\n class=\"ngx-table__table-row-context-menu\"\r\n [ngStyle]=\"{\r\n position: 'absolute',\r\n top: rowContextMenuPosition.top,\r\n left: rowContextMenuPosition.left\r\n }\"\r\n *ngIf=\"rowContextMenuPosition.top\"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"rowContextMenu\"\r\n [ngTemplateOutletContext]=\"{ $implicit: rowContextMenuPosition.value }\"\r\n >\r\n </ng-container>\r\n </ul>\r\n <ng-container *ngIf=\"!config.infiniteScroll\">\r\n <ng-container\r\n *ngFor=\"\r\n let row of data\r\n | sort: sortBy\r\n | search: term:filteredCountSubject\r\n | global: globalSearchTerm:filteredCountSubject\r\n | paginate: { itemsPerPage: limit, currentPage: page, totalItems: count, id: id }\r\n \"\r\n >\r\n <tr\r\n [class.ngx-table__table-row--selected]=\"\r\n data.indexOf(row) === selectedRow && !config.selectCell\r\n \"\r\n >\r\n <td *ngIf=\"config.checkboxes\">\r\n <label class=\"ngx-form-checkbox\">\r\n <input\r\n type=\"checkbox\"\r\n id=\"checkbox-{{ data.indexOf(row) }}\"\r\n [checked]=\"isSelected || selectedCheckboxes.has(data.indexOf(row))\"\r\n (change)=\"onCheckboxSelect($event, row, data.indexOf(row))\"\r\n />\r\n <em class=\"ngx-form-icon\"></em>\r\n </label>\r\n </td>\r\n <td *ngIf=\"config.radio\">\r\n <label>\r\n <input\r\n type=\"radio\"\r\n id=\"radio-{{ data.indexOf(row) }}\"\r\n name=\"radio\"\r\n (change)=\"onRadioSelect($event, row, data.indexOf(row))\"\r\n />\r\n </label>\r\n </td>\r\n <ng-container *ngFor=\"let column of columns; let colIndex = index\">\r\n <td\r\n (click)=\"onClick($event, row, column.key, colIndex, data.indexOf(row))\"\r\n #contextMenu\r\n (contextmenu)=\"\r\n onRowContextMenu($event, row, column.key, colIndex, data.indexOf(row))\r\n \"\r\n (dblclick)=\"onDoubleClick($event, row, column.key, colIndex, data.indexOf(row))\"\r\n [class.pinned-left]=\"column.pinned\"\r\n [ngClass]=\"column.cssClass ? column.cssClass.name : ''\"\r\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\"\r\n [class.ngx-table__table-col--selected]=\"\r\n colIndex === selectedCol && !config.selectCell\r\n \"\r\n [class.ngx-table__table-cell--selected]=\"\r\n colIndex === selectedCol &&\r\n data.indexOf(row) === selectedRow &&\r\n !config.selectCol &&\r\n !config.selectRow\r\n \"\r\n >\r\n <div *ngIf=\"!column.cellTemplate\">{{ row | render: column.key }}</div>\r\n <ng-container\r\n *ngIf=\"column.cellTemplate\"\r\n [ngTemplateOutlet]=\"column.cellTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: row,\r\n rowIndex: data.indexOf(row),\r\n column: column\r\n }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <td *ngIf=\"config.additionalActions || config.detailsTemplate\">\r\n <span\r\n class=\"ngx-icon\"\r\n *ngIf=\"arrowDefinition\"\r\n [ngClass]=\"\r\n isRowCollapsed(data.indexOf(row))\r\n ? 'ngx-icon-arrow-down'\r\n : 'ngx-icon-arrow-right'\r\n \"\r\n (click)=\"collapseRow(data.indexOf(row))\"\r\n >\r\n </span>\r\n </td>\r\n </tr>\r\n <tr\r\n *ngIf=\"\r\n (config.detailsTemplate && selectedDetailsTemplateRowId.has(data.indexOf(row))) ||\r\n config.collapseAllRows\r\n \"\r\n >\r\n <td *ngIf=\"config.checkboxes || config.radio\"></td>\r\n <td [attr.colspan]=\"columns.length + 1\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"detailsTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row, index: data.indexOf(row) }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n </ng-container>\r\n <!-- infinite scroll -->\r\n <cdk-virtual-scroll-viewport\r\n itemSize=\"50\"\r\n *ngIf=\"config.infiniteScroll\"\r\n class=\"ngx-infinite-scroll-viewport\"\r\n >\r\n <ng-container\r\n *cdkVirtualFor=\"\r\n let row of data\r\n | sort: sortBy\r\n | search: term:filteredCountSubject\r\n | global: globalSearchTerm:filteredCountSubject;\r\n let rowIndex = index\r\n \"\r\n >\r\n <tr\r\n [class.ngx-table__table-row--selected]=\"\r\n rowIndex === selectedRow && !config.selectCell\r\n \"\r\n >\r\n <td *ngIf=\"config.checkboxes\" width=\"3%\">\r\n <label class=\"ngx-form-checkbox\">\r\n <input\r\n type=\"checkbox\"\r\n id=\"checkbox-infinite-scroll-{{ rowIndex }}\"\r\n [checked]=\"isSelected || selectedCheckboxes.has(rowIndex)\"\r\n (change)=\"onCheckboxSelect($event, row, rowIndex)\"\r\n />\r\n <em class=\"ngx-form-icon\"></em>\r\n </label>\r\n </td>\r\n <td *ngIf=\"config.radio\" width=\"3%\">\r\n <label>\r\n <input\r\n type=\"radio\"\r\n id=\"radio-infinite-scroll-{{ rowIndex }}\"\r\n name=\"radio\"\r\n (change)=\"onRadioSelect($event, row, rowIndex)\"\r\n />\r\n </label>\r\n </td>\r\n <ng-container *ngFor=\"let column of columns; let colIndex = index\">\r\n <td\r\n (click)=\"onClick($event, row, column.key, colIndex, rowIndex)\"\r\n #contextMenu\r\n (contextmenu)=\"onRowContextMenu($event, row, column.key, colIndex, rowIndex)\"\r\n (dblclick)=\"onDoubleClick($event, row, column.key, colIndex, rowIndex)\"\r\n [class.pinned-left]=\"column.pinned\"\r\n [ngClass]=\"column.cssClass ? column.cssClass.name : ''\"\r\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\"\r\n [class.ngx-table__table-col--selected]=\"\r\n colIndex === selectedCol && !config.selectCell\r\n \"\r\n [class.ngx-table__table-cell--selected]=\"\r\n colIndex === selectedCol &&\r\n rowIndex === selectedRow &&\r\n !config.selectCol &&\r\n !config.selectRow\r\n \"\r\n >\r\n <div *ngIf=\"!column.cellTemplate\">{{ row | render: column.key }}</div>\r\n <ng-container\r\n *ngIf=\"column.cellTemplate\"\r\n [ngTemplateOutlet]=\"column.cellTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: row,\r\n rowIndex: rowIndex,\r\n column: column\r\n }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <td *ngIf=\"config.additionalActions || config.detailsTemplate\">\r\n <span\r\n class=\"ngx-icon\"\r\n *ngIf=\"arrowDefinition\"\r\n [ngClass]=\"\r\n isRowCollapsed(rowIndex) ? 'ngx-icon-arrow-down' : 'ngx-icon-arrow-right'\r\n \"\r\n (click)=\"collapseRow(rowIndex)\"\r\n >\r\n </span>\r\n </td>\r\n </tr>\r\n <tr\r\n *ngIf=\"\r\n (config.detailsTemplate && selectedDetailsTemplateRowId.has(rowIndex)) ||\r\n config.collapseAllRows\r\n \"\r\n >\r\n <td *ngIf=\"config.checkboxes || config.radio\"></td>\r\n <td [attr.colspan]=\"columns.length + 1\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"detailsTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row, index: rowIndex }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n </cdk-virtual-scroll-viewport>\r\n </ng-container>\r\n <ng-container *ngIf=\"!rowTemplate && config.groupRows\">\r\n <ng-container\r\n *ngFor=\"\r\n let group of grouped\r\n | sort: sortBy:config\r\n | search: term:filteredCountSubject:config\r\n | global: globalSearchTerm:filteredCountSubject\r\n | paginate: { itemsPerPage: limit, currentPage: page, totalItems: count, id: id };\r\n let rowIndex = index\r\n \"\r\n >\r\n <tr>\r\n <ng-container *ngIf=\"!groupRowsHeaderTemplate\">\r\n <td [attr.colspan]=\"columns.length\">\r\n <div>{{ group[0][groupRowsBy] }} ({{ group.length }})</div>\r\n </td>\r\n </ng-container>\r\n <ng-container\r\n *ngIf=\"groupRowsHeaderTemplate\"\r\n [ngTemplateOutlet]=\"groupRowsHeaderTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n total: group.length,\r\n key: groupRowsBy,\r\n value: group[0] ? group[0][groupRowsBy] : '',\r\n group: group,\r\n index: rowIndex\r\n }\"\r\n >\r\n </ng-container>\r\n <td>\r\n <span\r\n class=\"ngx-icon\"\r\n *ngIf=\"arrowDefinition\"\r\n [ngClass]=\"\r\n isRowCollapsed(rowIndex) ? 'ngx-icon-arrow-down' : 'ngx-icon-arrow-right'\r\n \"\r\n (click)=\"collapseRow(rowIndex)\"\r\n >\r\n </span>\r\n </td>\r\n </tr>\r\n <ng-container *ngIf=\"selectedDetailsTemplateRowId.has(rowIndex)\">\r\n <tr *ngFor=\"let row of group\">\r\n <td *ngFor=\"let column of columns\">\r\n {{ row | render: column.key }}\r\n <!-- TODO allow users to add groupRowsTemplateRef -->\r\n </td>\r\n <td></td>\r\n </tr>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n </tbody>\r\n <tbody\r\n *ngIf=\"data && !config.isLoading && config.rowReorder\"\r\n class=\"ngx-draggable-row-area\"\r\n cdkDropList\r\n (cdkDropListDropped)=\"onDrop($event)\"\r\n >\r\n <ng-container *ngIf=\"!rowTemplate && !config.groupRows\">\r\n <ng-container\r\n *ngFor=\"\r\n let row of data\r\n | sort: sortBy\r\n | search: term:filteredCountSubject\r\n | global: globalSearchTerm:filteredCountSubject\r\n | paginate: { itemsPerPage: limit, currentPage: page, totalItems: count, id: id }\r\n \"\r\n >\r\n <tr\r\n class=\"ngx-draggable-row\"\r\n cdkDrag\r\n (cdkDragStarted)=\"onDragStart($event)\"\r\n [cdkDragStartDelay]=\"config.reorderDelay || 0\"\r\n cdkDragLockAxis=\"y\"\r\n >\r\n <td *ngIf=\"config.checkboxes\">\r\n <label class=\"ngx-form-checkbox\">\r\n <input\r\n type=\"checkbox\"\r\n id=\"checkbox-draggable-{{ data.indexOf(row) }}\"\r\n [checked]=\"isSelected || selectedCheckboxes.has(data.indexOf(row))\"\r\n (change)=\"onCheckboxSelect($event, row, data.indexOf(row))\"\r\n />\r\n <em class=\"ngx-form-icon\"></em>\r\n </label>\r\n </td>\r\n <td *ngIf=\"config.radio\">\r\n <label>\r\n <input\r\n type=\"radio\"\r\n id=\"radio-draggable-{{ data.indexOf(row) }}\"\r\n name=\"radio\"\r\n (change)=\"onRadioSelect($event, row, data.indexOf(row))\"\r\n />\r\n </label>\r\n </td>\r\n <ng-container *ngFor=\"let column of columns; let colIndex = index\">\r\n <td\r\n (click)=\"onClick($event, row, column.key, colIndex, data.indexOf(row))\"\r\n (dblclick)=\"onDoubleClick($event, row, column.key, colIndex, data.indexOf(row))\"\r\n [class.ngx-table__table-col--selected]=\"\r\n colIndex === selectedCol && !config.selectCell\r\n \"\r\n [class.ngx-table__table-cell--selected]=\"\r\n colIndex === selectedCol &&\r\n data.indexOf(row) === selectedRow &&\r\n !config.selectCol &&\r\n !config.selectRow\r\n \"\r\n >\r\n <div *ngIf=\"!column.cellTemplate\">{{ row | render: column.key }}</div>\r\n <ng-container\r\n *ngIf=\"column.cellTemplate\"\r\n [ngTemplateOutlet]=\"column.cellTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: row,\r\n rowIndex: data.indexOf(row),\r\n column: column\r\n }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </ng-container>\r\n </ng-container>\r\n </tbody>\r\n <tbody *ngIf=\"filterCount === 0\">\r\n <tr class=\"ngx-table__body-empty\">\r\n <ng-container *ngIf=\"noResultsTemplate\" [ngTemplateOutlet]=\"noResultsTemplate\">\r\n </ng-container>\r\n <td [attr.colspan]=\"columns && columns.length + 1\" *ngIf=\"!noResultsTemplate\">\r\n <div class=\"ngx-table__table-no-results\">No results</div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n <tbody *ngIf=\"config.isLoading\">\r\n <tr class=\"ngx-table__body-loading\">\r\n <ng-container *ngIf=\"loadingTemplate\" [ngTemplateOutlet]=\"loadingTemplate\"> </ng-container>\r\n <td [attr.colspan]=\"columns && columns.length + 1\" *ngIf=\"!loadingTemplate\">\r\n <div [style.height.px]=\"loadingHeight\" class=\"ngx-table__table-loader-wrapper\">\r\n <div class=\"ngx-table__table-loader\"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n <tfoot *ngIf=\"summaryTemplate\">\r\n <tr>\r\n <ng-container\r\n [ngTemplateOutlet]=\"summaryTemplate\"\r\n [ngTemplateOutletContext]=\"{ total: data.length, limit: limit, page: page }\"\r\n >\r\n </ng-container>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n <pagination\r\n [attr.id]=\"'pagination' + id\"\r\n [id]=\"id\"\r\n #paginationComponent\r\n [config]=\"config\"\r\n [pagination]=\"pagination\"\r\n (updateRange)=\"onPagination($event)\"\r\n >\r\n </pagination>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i3$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i1.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i1.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i1.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: PaginationComponent, selector: "pagination", inputs: ["pagination", "config", "id"], outputs: ["updateRange"] }, { kind: "component", type: TableTHeadComponent, selector: "[table-thead]", inputs: ["config", "columns", "sortKey", "sortState", "selectAllTemplate", "filtersTemplate", "additionalActionsTemplate"], outputs: ["filter", "order", "selectAll", "event"] }, { kind: "pipe", type: i2.PaginatePipe, name: "paginate" }, { kind: "pipe", type: SearchPipe, name: "search" }, { kind: "pipe", type: RenderPipe, name: "render" }, { kind: "pipe", type: GlobalSearchPipe, name: "global" }, { kind: "pipe", type: SortPipe, name: "sort" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1033
|
+
}
|
|
1034
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: BaseComponent, decorators: [{
|
|
1035
|
+
type: Component,
|
|
1036
|
+
args: [{ selector: 'ngx-table', providers: [DefaultConfigService, GroupRowsService, StyleService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n class=\"ngx-container\"\r\n [class.ngx-container--dark]=\"config.tableLayout.theme === 'dark'\"\r\n (dragenter)=\"dragEnter($event)\"\r\n (dragover)=\"dragOver($event)\"\r\n (dragleave)=\"dragLeave($event)\"\r\n (drop)=\"drop($event)\"\r\n>\r\n <table\r\n [id]=\"id\"\r\n #table\r\n [ngClass]=\"tableClass === null || tableClass === '' ? 'ngx-table' : tableClass\"\r\n [class.ngx-table__table--tiny]=\"config.tableLayout.style === 'tiny'\"\r\n [class.ngx-table__table--normal]=\"config.tableLayout.style === 'normal'\"\r\n [class.ngx-table__table--big]=\"config.tableLayout.style === 'big'\"\r\n [class.ngx-table__table--borderless]=\"config.tableLayout.borderless\"\r\n [class.ngx-table__table--dark]=\"config.tableLayout.theme === 'dark'\"\r\n [class.ngx-table__table--hoverable]=\"config.tableLayout.hover\"\r\n [class.ngx-table__table--striped]=\"config.tableLayout.striped\"\r\n [class.ngx-table__horizontal-scroll]=\"config.horizontalScroll && !config.isLoading\"\r\n >\r\n <thead\r\n [class.ngx-infinite-scroll-viewport-thead]=\"config.infiniteScroll\"\r\n table-thead\r\n [config]=\"config\"\r\n [sortKey]=\"sortKey\"\r\n [sortState]=\"sortState\"\r\n [selectAllTemplate]=\"selectAllTemplate\"\r\n [filtersTemplate]=\"filtersTemplate\"\r\n [additionalActionsTemplate]=\"additionalActionsTemplate\"\r\n [columns]=\"columns\"\r\n (selectAll)=\"onSelectAll()\"\r\n (filter)=\"onSearch($event)\"\r\n (order)=\"orderBy($event)\"\r\n (event)=\"emitEvent($event.event, $event.value)\"\r\n ></thead>\r\n <tbody *ngIf=\"data && !config.isLoading && !config.rowReorder\">\r\n <ng-container *ngIf=\"rowTemplate\">\r\n <ul\r\n class=\"ngx-table__table-row-context-menu\"\r\n [ngStyle]=\"{\r\n position: 'absolute',\r\n top: rowContextMenuPosition.top,\r\n left: rowContextMenuPosition.left\r\n }\"\r\n *ngIf=\"rowContextMenuPosition.top\"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"rowContextMenu\"\r\n [ngTemplateOutletContext]=\"{ $implicit: rowContextMenuPosition.value }\"\r\n >\r\n </ng-container>\r\n </ul>\r\n <ng-container *ngIf=\"!config.infiniteScroll\">\r\n <ng-container\r\n *ngFor=\"\r\n let row of data\r\n | sort: sortBy\r\n | search: term:filteredCountSubject\r\n | global: globalSearchTerm:filteredCountSubject\r\n | paginate: { itemsPerPage: limit, currentPage: page, totalItems: count, id: id }\r\n \"\r\n >\r\n <tr\r\n (click)=\"onClick($event, row, '', null, data.indexOf(row))\"\r\n #contextMenu\r\n (contextmenu)=\"onRowContextMenu($event, row, '', null, data.indexOf(row))\"\r\n (dblclick)=\"onDoubleClick($event, row, '', null, data.indexOf(row))\"\r\n [class.ngx-table__table-row--selected]=\"\r\n data.indexOf(row) === selectedRow && !config.selectCell\r\n \"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"rowTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row, index: data.indexOf(row) }\"\r\n >\r\n </ng-container>\r\n <td *ngIf=\"config.detailsTemplate\">\r\n <span\r\n class=\"ngx-icon\"\r\n *ngIf=\"arrowDefinition\"\r\n [ngClass]=\"\r\n isRowCollapsed(data.indexOf(row))\r\n ? 'ngx-icon-arrow-down'\r\n : 'ngx-icon-arrow-right'\r\n \"\r\n (click)=\"collapseRow(data.indexOf(row))\"\r\n >\r\n </span>\r\n </td>\r\n </tr>\r\n <tr\r\n *ngIf=\"\r\n (config.detailsTemplate && selectedDetailsTemplateRowId.has(data.indexOf(row))) ||\r\n config.collapseAllRows\r\n \"\r\n >\r\n <td [attr.colspan]=\"columns.length + 1\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"detailsTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row, index: data.indexOf(row) }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n </ng-container>\r\n <cdk-virtual-scroll-viewport\r\n itemSize=\"50\"\r\n *ngIf=\"config.infiniteScroll\"\r\n class=\"ngx-infinite-scroll-viewport\"\r\n >\r\n <ng-container\r\n *cdkVirtualFor=\"\r\n let row of data\r\n | sort: sortBy\r\n | search: term:filteredCountSubject\r\n | global: globalSearchTerm:filteredCountSubject;\r\n let rowIndex = index\r\n \"\r\n >\r\n <tr\r\n (click)=\"onClick($event, row, '', null, rowIndex)\"\r\n #contextMenu\r\n (contextmenu)=\"onRowContextMenu($event, row, '', null, rowIndex)\"\r\n (dblclick)=\"onDoubleClick($event, row, '', null, rowIndex)\"\r\n [class.ngx-table__table-row--selected]=\"\r\n rowIndex === selectedRow && !config.selectCell\r\n \"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"rowTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row, index: rowIndex }\"\r\n >\r\n </ng-container>\r\n <td *ngIf=\"config.detailsTemplate\">\r\n <span\r\n class=\"ngx-icon\"\r\n *ngIf=\"arrowDefinition\"\r\n [ngClass]=\"\r\n isRowCollapsed(rowIndex) ? 'ngx-icon-arrow-down' : 'ngx-icon-arrow-right'\r\n \"\r\n (click)=\"collapseRow(rowIndex)\"\r\n >\r\n </span>\r\n </td>\r\n </tr>\r\n <tr\r\n *ngIf=\"\r\n (config.detailsTemplate && selectedDetailsTemplateRowId.has(rowIndex)) ||\r\n config.collapseAllRows\r\n \"\r\n >\r\n <td [attr.colspan]=\"columns.length + 1\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"detailsTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row, index: rowIndex }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n </cdk-virtual-scroll-viewport>\r\n </ng-container>\r\n <ng-container *ngIf=\"!rowTemplate && !config.groupRows\">\r\n <ul\r\n class=\"ngx-table__table-row-context-menu\"\r\n [ngStyle]=\"{\r\n position: 'absolute',\r\n top: rowContextMenuPosition.top,\r\n left: rowContextMenuPosition.left\r\n }\"\r\n *ngIf=\"rowContextMenuPosition.top\"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"rowContextMenu\"\r\n [ngTemplateOutletContext]=\"{ $implicit: rowContextMenuPosition.value }\"\r\n >\r\n </ng-container>\r\n </ul>\r\n <ng-container *ngIf=\"!config.infiniteScroll\">\r\n <ng-container\r\n *ngFor=\"\r\n let row of data\r\n | sort: sortBy\r\n | search: term:filteredCountSubject\r\n | global: globalSearchTerm:filteredCountSubject\r\n | paginate: { itemsPerPage: limit, currentPage: page, totalItems: count, id: id }\r\n \"\r\n >\r\n <tr\r\n [class.ngx-table__table-row--selected]=\"\r\n data.indexOf(row) === selectedRow && !config.selectCell\r\n \"\r\n >\r\n <td *ngIf=\"config.checkboxes\">\r\n <label class=\"ngx-form-checkbox\">\r\n <input\r\n type=\"checkbox\"\r\n id=\"checkbox-{{ data.indexOf(row) }}\"\r\n [checked]=\"isSelected || selectedCheckboxes.has(data.indexOf(row))\"\r\n (change)=\"onCheckboxSelect($event, row, data.indexOf(row))\"\r\n />\r\n <em class=\"ngx-form-icon\"></em>\r\n </label>\r\n </td>\r\n <td *ngIf=\"config.radio\">\r\n <label>\r\n <input\r\n type=\"radio\"\r\n id=\"radio-{{ data.indexOf(row) }}\"\r\n name=\"radio\"\r\n (change)=\"onRadioSelect($event, row, data.indexOf(row))\"\r\n />\r\n </label>\r\n </td>\r\n <ng-container *ngFor=\"let column of columns; let colIndex = index\">\r\n <td\r\n (click)=\"onClick($event, row, column.key, colIndex, data.indexOf(row))\"\r\n #contextMenu\r\n (contextmenu)=\"\r\n onRowContextMenu($event, row, column.key, colIndex, data.indexOf(row))\r\n \"\r\n (dblclick)=\"onDoubleClick($event, row, column.key, colIndex, data.indexOf(row))\"\r\n [class.pinned-left]=\"column.pinned\"\r\n [ngClass]=\"column.cssClass ? column.cssClass.name : ''\"\r\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\"\r\n [class.ngx-table__table-col--selected]=\"\r\n colIndex === selectedCol && !config.selectCell\r\n \"\r\n [class.ngx-table__table-cell--selected]=\"\r\n colIndex === selectedCol &&\r\n data.indexOf(row) === selectedRow &&\r\n !config.selectCol &&\r\n !config.selectRow\r\n \"\r\n >\r\n <div *ngIf=\"!column.cellTemplate\">{{ row | render: column.key }}</div>\r\n <ng-container\r\n *ngIf=\"column.cellTemplate\"\r\n [ngTemplateOutlet]=\"column.cellTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: row,\r\n rowIndex: data.indexOf(row),\r\n column: column\r\n }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <td *ngIf=\"config.additionalActions || config.detailsTemplate\">\r\n <span\r\n class=\"ngx-icon\"\r\n *ngIf=\"arrowDefinition\"\r\n [ngClass]=\"\r\n isRowCollapsed(data.indexOf(row))\r\n ? 'ngx-icon-arrow-down'\r\n : 'ngx-icon-arrow-right'\r\n \"\r\n (click)=\"collapseRow(data.indexOf(row))\"\r\n >\r\n </span>\r\n </td>\r\n </tr>\r\n <tr\r\n *ngIf=\"\r\n (config.detailsTemplate && selectedDetailsTemplateRowId.has(data.indexOf(row))) ||\r\n config.collapseAllRows\r\n \"\r\n >\r\n <td *ngIf=\"config.checkboxes || config.radio\"></td>\r\n <td [attr.colspan]=\"columns.length + 1\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"detailsTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row, index: data.indexOf(row) }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n </ng-container>\r\n <!-- infinite scroll -->\r\n <cdk-virtual-scroll-viewport\r\n itemSize=\"50\"\r\n *ngIf=\"config.infiniteScroll\"\r\n class=\"ngx-infinite-scroll-viewport\"\r\n >\r\n <ng-container\r\n *cdkVirtualFor=\"\r\n let row of data\r\n | sort: sortBy\r\n | search: term:filteredCountSubject\r\n | global: globalSearchTerm:filteredCountSubject;\r\n let rowIndex = index\r\n \"\r\n >\r\n <tr\r\n [class.ngx-table__table-row--selected]=\"\r\n rowIndex === selectedRow && !config.selectCell\r\n \"\r\n >\r\n <td *ngIf=\"config.checkboxes\" width=\"3%\">\r\n <label class=\"ngx-form-checkbox\">\r\n <input\r\n type=\"checkbox\"\r\n id=\"checkbox-infinite-scroll-{{ rowIndex }}\"\r\n [checked]=\"isSelected || selectedCheckboxes.has(rowIndex)\"\r\n (change)=\"onCheckboxSelect($event, row, rowIndex)\"\r\n />\r\n <em class=\"ngx-form-icon\"></em>\r\n </label>\r\n </td>\r\n <td *ngIf=\"config.radio\" width=\"3%\">\r\n <label>\r\n <input\r\n type=\"radio\"\r\n id=\"radio-infinite-scroll-{{ rowIndex }}\"\r\n name=\"radio\"\r\n (change)=\"onRadioSelect($event, row, rowIndex)\"\r\n />\r\n </label>\r\n </td>\r\n <ng-container *ngFor=\"let column of columns; let colIndex = index\">\r\n <td\r\n (click)=\"onClick($event, row, column.key, colIndex, rowIndex)\"\r\n #contextMenu\r\n (contextmenu)=\"onRowContextMenu($event, row, column.key, colIndex, rowIndex)\"\r\n (dblclick)=\"onDoubleClick($event, row, column.key, colIndex, rowIndex)\"\r\n [class.pinned-left]=\"column.pinned\"\r\n [ngClass]=\"column.cssClass ? column.cssClass.name : ''\"\r\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\"\r\n [class.ngx-table__table-col--selected]=\"\r\n colIndex === selectedCol && !config.selectCell\r\n \"\r\n [class.ngx-table__table-cell--selected]=\"\r\n colIndex === selectedCol &&\r\n rowIndex === selectedRow &&\r\n !config.selectCol &&\r\n !config.selectRow\r\n \"\r\n >\r\n <div *ngIf=\"!column.cellTemplate\">{{ row | render: column.key }}</div>\r\n <ng-container\r\n *ngIf=\"column.cellTemplate\"\r\n [ngTemplateOutlet]=\"column.cellTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: row,\r\n rowIndex: rowIndex,\r\n column: column\r\n }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <td *ngIf=\"config.additionalActions || config.detailsTemplate\">\r\n <span\r\n class=\"ngx-icon\"\r\n *ngIf=\"arrowDefinition\"\r\n [ngClass]=\"\r\n isRowCollapsed(rowIndex) ? 'ngx-icon-arrow-down' : 'ngx-icon-arrow-right'\r\n \"\r\n (click)=\"collapseRow(rowIndex)\"\r\n >\r\n </span>\r\n </td>\r\n </tr>\r\n <tr\r\n *ngIf=\"\r\n (config.detailsTemplate && selectedDetailsTemplateRowId.has(rowIndex)) ||\r\n config.collapseAllRows\r\n \"\r\n >\r\n <td *ngIf=\"config.checkboxes || config.radio\"></td>\r\n <td [attr.colspan]=\"columns.length + 1\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"detailsTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row, index: rowIndex }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n </cdk-virtual-scroll-viewport>\r\n </ng-container>\r\n <ng-container *ngIf=\"!rowTemplate && config.groupRows\">\r\n <ng-container\r\n *ngFor=\"\r\n let group of grouped\r\n | sort: sortBy:config\r\n | search: term:filteredCountSubject:config\r\n | global: globalSearchTerm:filteredCountSubject\r\n | paginate: { itemsPerPage: limit, currentPage: page, totalItems: count, id: id };\r\n let rowIndex = index\r\n \"\r\n >\r\n <tr>\r\n <ng-container *ngIf=\"!groupRowsHeaderTemplate\">\r\n <td [attr.colspan]=\"columns.length\">\r\n <div>{{ group[0][groupRowsBy] }} ({{ group.length }})</div>\r\n </td>\r\n </ng-container>\r\n <ng-container\r\n *ngIf=\"groupRowsHeaderTemplate\"\r\n [ngTemplateOutlet]=\"groupRowsHeaderTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n total: group.length,\r\n key: groupRowsBy,\r\n value: group[0] ? group[0][groupRowsBy] : '',\r\n group: group,\r\n index: rowIndex\r\n }\"\r\n >\r\n </ng-container>\r\n <td>\r\n <span\r\n class=\"ngx-icon\"\r\n *ngIf=\"arrowDefinition\"\r\n [ngClass]=\"\r\n isRowCollapsed(rowIndex) ? 'ngx-icon-arrow-down' : 'ngx-icon-arrow-right'\r\n \"\r\n (click)=\"collapseRow(rowIndex)\"\r\n >\r\n </span>\r\n </td>\r\n </tr>\r\n <ng-container *ngIf=\"selectedDetailsTemplateRowId.has(rowIndex)\">\r\n <tr *ngFor=\"let row of group\">\r\n <td *ngFor=\"let column of columns\">\r\n {{ row | render: column.key }}\r\n <!-- TODO allow users to add groupRowsTemplateRef -->\r\n </td>\r\n <td></td>\r\n </tr>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n </tbody>\r\n <tbody\r\n *ngIf=\"data && !config.isLoading && config.rowReorder\"\r\n class=\"ngx-draggable-row-area\"\r\n cdkDropList\r\n (cdkDropListDropped)=\"onDrop($event)\"\r\n >\r\n <ng-container *ngIf=\"!rowTemplate && !config.groupRows\">\r\n <ng-container\r\n *ngFor=\"\r\n let row of data\r\n | sort: sortBy\r\n | search: term:filteredCountSubject\r\n | global: globalSearchTerm:filteredCountSubject\r\n | paginate: { itemsPerPage: limit, currentPage: page, totalItems: count, id: id }\r\n \"\r\n >\r\n <tr\r\n class=\"ngx-draggable-row\"\r\n cdkDrag\r\n (cdkDragStarted)=\"onDragStart($event)\"\r\n [cdkDragStartDelay]=\"config.reorderDelay || 0\"\r\n cdkDragLockAxis=\"y\"\r\n >\r\n <td *ngIf=\"config.checkboxes\">\r\n <label class=\"ngx-form-checkbox\">\r\n <input\r\n type=\"checkbox\"\r\n id=\"checkbox-draggable-{{ data.indexOf(row) }}\"\r\n [checked]=\"isSelected || selectedCheckboxes.has(data.indexOf(row))\"\r\n (change)=\"onCheckboxSelect($event, row, data.indexOf(row))\"\r\n />\r\n <em class=\"ngx-form-icon\"></em>\r\n </label>\r\n </td>\r\n <td *ngIf=\"config.radio\">\r\n <label>\r\n <input\r\n type=\"radio\"\r\n id=\"radio-draggable-{{ data.indexOf(row) }}\"\r\n name=\"radio\"\r\n (change)=\"onRadioSelect($event, row, data.indexOf(row))\"\r\n />\r\n </label>\r\n </td>\r\n <ng-container *ngFor=\"let column of columns; let colIndex = index\">\r\n <td\r\n (click)=\"onClick($event, row, column.key, colIndex, data.indexOf(row))\"\r\n (dblclick)=\"onDoubleClick($event, row, column.key, colIndex, data.indexOf(row))\"\r\n [class.ngx-table__table-col--selected]=\"\r\n colIndex === selectedCol && !config.selectCell\r\n \"\r\n [class.ngx-table__table-cell--selected]=\"\r\n colIndex === selectedCol &&\r\n data.indexOf(row) === selectedRow &&\r\n !config.selectCol &&\r\n !config.selectRow\r\n \"\r\n >\r\n <div *ngIf=\"!column.cellTemplate\">{{ row | render: column.key }}</div>\r\n <ng-container\r\n *ngIf=\"column.cellTemplate\"\r\n [ngTemplateOutlet]=\"column.cellTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: row,\r\n rowIndex: data.indexOf(row),\r\n column: column\r\n }\"\r\n >\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </ng-container>\r\n </ng-container>\r\n </tbody>\r\n <tbody *ngIf=\"filterCount === 0\">\r\n <tr class=\"ngx-table__body-empty\">\r\n <ng-container *ngIf=\"noResultsTemplate\" [ngTemplateOutlet]=\"noResultsTemplate\">\r\n </ng-container>\r\n <td [attr.colspan]=\"columns && columns.length + 1\" *ngIf=\"!noResultsTemplate\">\r\n <div class=\"ngx-table__table-no-results\">No results</div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n <tbody *ngIf=\"config.isLoading\">\r\n <tr class=\"ngx-table__body-loading\">\r\n <ng-container *ngIf=\"loadingTemplate\" [ngTemplateOutlet]=\"loadingTemplate\"> </ng-container>\r\n <td [attr.colspan]=\"columns && columns.length + 1\" *ngIf=\"!loadingTemplate\">\r\n <div [style.height.px]=\"loadingHeight\" class=\"ngx-table__table-loader-wrapper\">\r\n <div class=\"ngx-table__table-loader\"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n <tfoot *ngIf=\"summaryTemplate\">\r\n <tr>\r\n <ng-container\r\n [ngTemplateOutlet]=\"summaryTemplate\"\r\n [ngTemplateOutletContext]=\"{ total: data.length, limit: limit, page: page }\"\r\n >\r\n </ng-container>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n <pagination\r\n [attr.id]=\"'pagination' + id\"\r\n [id]=\"id\"\r\n #paginationComponent\r\n [config]=\"config\"\r\n [pagination]=\"pagination\"\r\n (updateRange)=\"onPagination($event)\"\r\n >\r\n </pagination>\r\n</div>\r\n" }]
|
|
1037
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.ScrollDispatcher }, { type: StyleService }], propDecorators: { configuration: [{
|
|
1038
|
+
type: Input
|
|
1039
|
+
}], data: [{
|
|
1040
|
+
type: Input
|
|
1041
|
+
}], pagination: [{
|
|
1042
|
+
type: Input
|
|
1043
|
+
}], groupRowsBy: [{
|
|
1044
|
+
type: Input
|
|
1045
|
+
}], id: [{
|
|
1046
|
+
type: Input
|
|
1047
|
+
}], toggleRowIndex: [{
|
|
1048
|
+
type: Input
|
|
1049
|
+
}], detailsTemplate: [{
|
|
1050
|
+
type: Input
|
|
1051
|
+
}], summaryTemplate: [{
|
|
1052
|
+
type: Input
|
|
1053
|
+
}], groupRowsHeaderTemplate: [{
|
|
1054
|
+
type: Input
|
|
1055
|
+
}], filtersTemplate: [{
|
|
1056
|
+
type: Input
|
|
1057
|
+
}], selectAllTemplate: [{
|
|
1058
|
+
type: Input
|
|
1059
|
+
}], noResultsTemplate: [{
|
|
1060
|
+
type: Input
|
|
1061
|
+
}], loadingTemplate: [{
|
|
1062
|
+
type: Input
|
|
1063
|
+
}], additionalActionsTemplate: [{
|
|
1064
|
+
type: Input
|
|
1065
|
+
}], rowContextMenu: [{
|
|
1066
|
+
type: Input
|
|
1067
|
+
}], columns: [{
|
|
1068
|
+
type: Input
|
|
1069
|
+
}], event: [{
|
|
1070
|
+
type: Output
|
|
1071
|
+
}], rowTemplate: [{
|
|
1072
|
+
type: ContentChild,
|
|
1073
|
+
args: [TemplateRef]
|
|
1074
|
+
}], paginationComponent: [{
|
|
1075
|
+
type: ViewChild,
|
|
1076
|
+
args: ['paginationComponent']
|
|
1077
|
+
}], contextMenu: [{
|
|
1078
|
+
type: ViewChild,
|
|
1079
|
+
args: ['contextMenu']
|
|
1080
|
+
}], table: [{
|
|
1081
|
+
type: ViewChild,
|
|
1082
|
+
args: ['table']
|
|
1083
|
+
}], viewPort: [{
|
|
1084
|
+
type: ViewChild,
|
|
1085
|
+
args: [CdkVirtualScrollViewport]
|
|
1086
|
+
}], onContextMenuClick: [{
|
|
1087
|
+
type: HostListener,
|
|
1088
|
+
args: ['document:click', ['$event.target']]
|
|
1089
|
+
}] } });
|
|
1090
|
+
|
|
1091
|
+
class BaseModule {
|
|
1092
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: BaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1093
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: BaseModule, declarations: [BaseComponent,
|
|
1094
|
+
HeaderComponent,
|
|
1095
|
+
PaginationComponent,
|
|
1096
|
+
TableTHeadComponent,
|
|
1097
|
+
// Pipes
|
|
1098
|
+
SearchPipe,
|
|
1099
|
+
RenderPipe,
|
|
1100
|
+
GlobalSearchPipe,
|
|
1101
|
+
SortPipe], imports: [CommonModule, NgxPaginationModule, DragDropModule, ScrollingModule], exports: [BaseComponent] }); }
|
|
1102
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: BaseModule, imports: [CommonModule, NgxPaginationModule, DragDropModule, ScrollingModule] }); }
|
|
1103
|
+
}
|
|
1104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: BaseModule, decorators: [{
|
|
1105
|
+
type: NgModule,
|
|
1106
|
+
args: [{
|
|
1107
|
+
declarations: [
|
|
1108
|
+
BaseComponent,
|
|
1109
|
+
HeaderComponent,
|
|
1110
|
+
PaginationComponent,
|
|
1111
|
+
TableTHeadComponent,
|
|
1112
|
+
// Pipes
|
|
1113
|
+
SearchPipe,
|
|
1114
|
+
RenderPipe,
|
|
1115
|
+
GlobalSearchPipe,
|
|
1116
|
+
SortPipe,
|
|
1117
|
+
],
|
|
1118
|
+
imports: [CommonModule, NgxPaginationModule, DragDropModule, ScrollingModule],
|
|
1119
|
+
exports: [BaseComponent],
|
|
1120
|
+
}]
|
|
1121
|
+
}] });
|
|
1122
|
+
|
|
1123
|
+
class TableModule {
|
|
1124
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: TableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1125
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: TableModule, imports: [CommonModule, BaseModule], exports: [BaseComponent] }); }
|
|
1126
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: TableModule, imports: [CommonModule, BaseModule] }); }
|
|
1127
|
+
}
|
|
1128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: TableModule, decorators: [{
|
|
1129
|
+
type: NgModule,
|
|
1130
|
+
args: [{
|
|
1131
|
+
imports: [CommonModule, BaseModule],
|
|
1132
|
+
exports: [BaseComponent],
|
|
1133
|
+
providers: [],
|
|
1134
|
+
}]
|
|
1135
|
+
}] });
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Generated bundle index. Do not edit.
|
|
1139
|
+
*/
|
|
1140
|
+
|
|
1141
|
+
export { API, BaseComponent, DefaultConfig, Event, STYLE, THEME, TableModule };
|
|
1142
|
+
//# sourceMappingURL=ngx-easy-table-plus.mjs.map
|