@acorex/components 7.24.4 → 17.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/common/lib/classes/datasource.class.d.ts +2 -0
- package/data-table/index.d.ts +3 -2
- package/data-table/lib/base-data-table.class.d.ts +25 -0
- package/data-table/lib/columns/row-command-column.component.d.ts +2 -2
- package/data-table/lib/data-table/data-table.component.d.ts +52 -0
- package/data-table/lib/data-table.module.d.ts +21 -18
- package/data-table/lib/{data-table.component.d.ts → infinite-scroll-data-table/infinite-scroll-data-table.component.d.ts} +8 -22
- package/esm2022/button/lib/button.component.mjs +2 -2
- package/esm2022/common/lib/classes/datasource.class.mjs +8 -2
- package/esm2022/common/lib/components/selection-base.component.class.mjs +12 -35
- package/esm2022/data-pager/lib/data-pager.component.mjs +7 -11
- package/esm2022/data-table/index.mjs +4 -3
- package/esm2022/data-table/lib/base-data-table.class.mjs +36 -0
- package/esm2022/data-table/lib/columns/row-command-column.component.mjs +57 -69
- package/esm2022/data-table/lib/columns/row-index-column.component.mjs +7 -21
- package/esm2022/data-table/lib/columns/row-select-column.component.mjs +6 -18
- package/esm2022/data-table/lib/data-table/data-table.component.mjs +233 -0
- package/esm2022/data-table/lib/data-table.module.mjs +24 -7
- package/esm2022/data-table/lib/infinite-scroll-data-table/infinite-scroll-data-table.component.mjs +272 -0
- package/esm2022/drawer/lib/drawer.component.mjs +2 -2
- package/esm2022/menu/lib/menu-item/menu-item.component.mjs +3 -3
- package/esm2022/menu/lib/menu.component.mjs +2 -2
- package/esm2022/otp/lib/otp.component.mjs +2 -2
- package/esm2022/phone-box/lib/phone-box.component.mjs +25 -42
- package/esm2022/phone-box/lib/phone-box.module.mjs +20 -3
- package/esm2022/select-box/lib/select-box.component.mjs +2 -2
- package/esm2022/text-area/lib/text-area.component.mjs +6 -22
- package/fesm2022/acorex-components-button.mjs +2 -2
- package/fesm2022/acorex-components-button.mjs.map +1 -1
- package/fesm2022/acorex-components-common.mjs +18 -35
- package/fesm2022/acorex-components-common.mjs.map +1 -1
- package/fesm2022/acorex-components-data-pager.mjs +5 -9
- package/fesm2022/acorex-components-data-pager.mjs.map +1 -1
- package/fesm2022/acorex-components-data-table.mjs +684 -470
- package/fesm2022/acorex-components-data-table.mjs.map +1 -1
- package/fesm2022/acorex-components-drawer.mjs +2 -2
- package/fesm2022/acorex-components-drawer.mjs.map +1 -1
- package/fesm2022/acorex-components-menu.mjs +4 -4
- package/fesm2022/acorex-components-menu.mjs.map +1 -1
- package/fesm2022/acorex-components-otp.mjs +2 -2
- package/fesm2022/acorex-components-otp.mjs.map +1 -1
- package/fesm2022/acorex-components-phone-box.mjs +45 -44
- package/fesm2022/acorex-components-phone-box.mjs.map +1 -1
- package/fesm2022/acorex-components-select-box.mjs +2 -2
- package/fesm2022/acorex-components-select-box.mjs.map +1 -1
- package/fesm2022/acorex-components-text-area.mjs +5 -21
- package/fesm2022/acorex-components-text-area.mjs.map +1 -1
- package/package.json +7 -13
- package/phone-box/lib/phone-box.component.d.ts +4 -13
- package/phone-box/lib/phone-box.module.d.ts +2 -1
- package/text-area/lib/text-area.component.d.ts +0 -1
- package/data-table-2/README.md +0 -3
- package/data-table-2/index.d.ts +0 -8
- package/data-table-2/lib/columns/data-table-column-resizable.directive.d.ts +0 -22
- package/data-table-2/lib/columns/data-table-column.d.ts +0 -22
- package/data-table-2/lib/columns/data-text-column.component.d.ts +0 -18
- package/data-table-2/lib/columns/row-command-column.component.d.ts +0 -40
- package/data-table-2/lib/columns/row-index-column.component.d.ts +0 -18
- package/data-table-2/lib/columns/row-select-column.component.d.ts +0 -14
- package/data-table-2/lib/data-table-2.component.d.ts +0 -61
- package/data-table-2/lib/data-table-2.module.d.ts +0 -24
- package/esm2022/data-table/lib/data-table.component.mjs +0 -290
- package/esm2022/data-table-2/acorex-components-data-table-2.mjs +0 -5
- package/esm2022/data-table-2/index.mjs +0 -9
- package/esm2022/data-table-2/lib/columns/data-table-column-resizable.directive.mjs +0 -59
- package/esm2022/data-table-2/lib/columns/data-table-column.mjs +0 -42
- package/esm2022/data-table-2/lib/columns/data-text-column.component.mjs +0 -81
- package/esm2022/data-table-2/lib/columns/row-command-column.component.mjs +0 -231
- package/esm2022/data-table-2/lib/columns/row-index-column.component.mjs +0 -71
- package/esm2022/data-table-2/lib/columns/row-select-column.component.mjs +0 -61
- package/esm2022/data-table-2/lib/data-table-2.component.mjs +0 -211
- package/esm2022/data-table-2/lib/data-table-2.module.mjs +0 -94
- package/fesm2022/acorex-components-data-table-2.mjs +0 -822
- package/fesm2022/acorex-components-data-table-2.mjs.map +0 -1
@@ -1,31 +1,35 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Injectable, Input, inject, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild,
|
2
|
+
import { Injectable, Input, Directive, HostListener, inject, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, EventEmitter, Output, ChangeDetectorRef, signal, ContentChildren, NgZone, NgModule } from '@angular/core';
|
3
|
+
import { isBrowser } from '@acorex/core/platform';
|
4
|
+
import { Subject, debounceTime, buffer, filter } from 'rxjs';
|
3
5
|
import { __decorate, __metadata } from 'tslib';
|
4
|
-
import * as i2
|
6
|
+
import * as i2 from '@acorex/core/format';
|
5
7
|
import { AXFormatService, AXFormatModule } from '@acorex/core/format';
|
6
8
|
import { Memorize } from '@acorex/core/memorize';
|
7
|
-
import * as i5
|
9
|
+
import * as i5 from '@acorex/components/common';
|
8
10
|
import { MXBaseComponent, convertArrayToDataSource, AXListDataSource, AXPagedComponent, AXCommonModule, AXRippleDirective } from '@acorex/components/common';
|
9
|
-
import * as
|
10
|
-
import {
|
11
|
-
import
|
12
|
-
import { Subject, buffer, debounceTime, filter } from 'rxjs';
|
13
|
-
import * as i1 from '@angular/common';
|
14
|
-
import { CommonModule } from '@angular/common';
|
15
|
-
import * as i2$1 from '@acorex/components/decorators';
|
11
|
+
import * as i1 from '@acorex/components/loading';
|
12
|
+
import { AXLoadingModule } from '@acorex/components/loading';
|
13
|
+
import * as i3 from '@acorex/components/decorators';
|
16
14
|
import { AXDecoratorModule } from '@acorex/components/decorators';
|
17
|
-
import * as
|
18
|
-
import { AXSkeletonModule } from '@acorex/components/skeleton';
|
19
|
-
import * as i5 from '@acorex/components/button';
|
15
|
+
import * as i3$1 from '@acorex/components/button';
|
20
16
|
import { AXButtonModule } from '@acorex/components/button';
|
21
|
-
import * as
|
22
|
-
import { AXLoadingModule } from '@acorex/components/loading';
|
23
|
-
import * as i4$1 from '@acorex/components/dropdown';
|
17
|
+
import * as i4 from '@acorex/components/dropdown';
|
24
18
|
import { AXDropdownModule } from '@acorex/components/dropdown';
|
25
19
|
import { AXUnsubscriber } from '@acorex/core/utils';
|
26
|
-
import
|
20
|
+
import * as i1$1 from '@angular/common';
|
21
|
+
import { CommonModule } from '@angular/common';
|
22
|
+
import * as i5$1 from '@acorex/components/data-pager';
|
23
|
+
import { AXDataPagerModule } from '@acorex/components/data-pager';
|
27
24
|
import { AXResultModule } from '@acorex/components/result';
|
25
|
+
import * as i4$1 from '@acorex/components/skeleton';
|
26
|
+
import { AXSkeletonModule } from '@acorex/components/skeleton';
|
28
27
|
import { AXTranslationModule } from '@acorex/core/translation';
|
28
|
+
import * as i6 from '@angular/cdk/drag-drop';
|
29
|
+
import { moveItemInArray, CdkDropList, CdkDrag, CdkDragPlaceholder, CdkDragHandle } from '@angular/cdk/drag-drop';
|
30
|
+
import * as i2$1 from '@angular/cdk/scrolling';
|
31
|
+
import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
|
32
|
+
import sum from 'lodash-es/sum';
|
29
33
|
|
30
34
|
class AXDataTableColumnComponent {
|
31
35
|
constructor() {
|
@@ -63,6 +67,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
63
67
|
type: Input
|
64
68
|
}] } });
|
65
69
|
|
70
|
+
class AXDataTableColumnResizableDirective {
|
71
|
+
constructor(el, renderer, ngZone, cdr) {
|
72
|
+
this.el = el;
|
73
|
+
this.renderer = renderer;
|
74
|
+
this.ngZone = ngZone;
|
75
|
+
this.cdr = cdr;
|
76
|
+
this.resize$ = new Subject();
|
77
|
+
this.onMouseMoveRawBound = this.onMouseMoveRaw.bind(this);
|
78
|
+
this.onMouseUpBound = this.onMouseUp.bind(this);
|
79
|
+
this.resize$.pipe(debounceTime(10)).subscribe((event) => this.onMouseMove(event));
|
80
|
+
}
|
81
|
+
onMouseDown(event) {
|
82
|
+
if (isBrowser()) {
|
83
|
+
event.stopPropagation();
|
84
|
+
this.ngZone.runOutsideAngular(() => {
|
85
|
+
this.startX = event.pageX;
|
86
|
+
this.startWidth = this.el?.nativeElement?.parentElement.offsetWidth;
|
87
|
+
document.addEventListener('mousemove', this.onMouseMoveRawBound);
|
88
|
+
document.addEventListener('mouseup', this.onMouseUpBound);
|
89
|
+
});
|
90
|
+
this.cdr.detach(); // Detach the change detector
|
91
|
+
}
|
92
|
+
}
|
93
|
+
onMouseMoveRaw(event) {
|
94
|
+
this.resize$.next(event);
|
95
|
+
}
|
96
|
+
onMouseMove(event) {
|
97
|
+
if (isBrowser()) {
|
98
|
+
const newWidth = this.startWidth + (event.pageX - this.startX);
|
99
|
+
this.renderer.setStyle(this.el?.nativeElement?.parentElement, 'width', `${newWidth}px`);
|
100
|
+
this.column.width = `${newWidth}px`;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
onMouseUp() {
|
104
|
+
document.removeEventListener('mousemove', this.onMouseMoveRawBound);
|
105
|
+
document.removeEventListener('mouseup', this.onMouseUpBound);
|
106
|
+
this.cdr.reattach(); // Reattach the change detector
|
107
|
+
}
|
108
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXDataTableColumnResizableDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
109
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.2", type: AXDataTableColumnResizableDirective, selector: "[ax-table-column-resizble]", inputs: { column: ["ax-table-column-resizble", "column"] }, host: { listeners: { "mousedown": "onMouseDown($event)" } }, ngImport: i0 }); }
|
110
|
+
}
|
111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXDataTableColumnResizableDirective, decorators: [{
|
112
|
+
type: Directive,
|
113
|
+
args: [{
|
114
|
+
selector: '[ax-table-column-resizble]',
|
115
|
+
}]
|
116
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }], propDecorators: { column: [{
|
117
|
+
type: Input,
|
118
|
+
args: ['ax-table-column-resizble']
|
119
|
+
}], onMouseDown: [{
|
120
|
+
type: HostListener,
|
121
|
+
args: ['mousedown', ['$event']]
|
122
|
+
}] } });
|
123
|
+
|
66
124
|
class AXDataTableTextColumnComponent extends AXDataTableColumnComponent {
|
67
125
|
constructor() {
|
68
126
|
super(...arguments);
|
@@ -138,57 +196,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
138
196
|
type: Input
|
139
197
|
}] } });
|
140
198
|
|
141
|
-
class
|
199
|
+
class AXBaseDataTable extends MXBaseComponent {
|
142
200
|
constructor() {
|
143
201
|
super(...arguments);
|
144
|
-
this.ngZone = inject(NgZone);
|
145
|
-
this.onPageChanged = new EventEmitter();
|
146
|
-
this.clickSubject = new Subject();
|
147
|
-
this.onRowClick = new EventEmitter();
|
148
|
-
this.onRowDbClick = new EventEmitter();
|
149
|
-
this.showHeader = true;
|
150
|
-
this.fetchDataMode = 'auto';
|
151
202
|
this.dataSource = convertArrayToDataSource([]);
|
152
|
-
this.loading = {
|
153
|
-
enabled: true,
|
154
|
-
animation: true,
|
155
|
-
};
|
156
|
-
this.isLoading = true;
|
157
|
-
this.hasItems = false;
|
158
|
-
this.totalRows = 0;
|
159
|
-
this.currentPage = 0;
|
160
|
-
this.totalPages = 0;
|
161
|
-
this.startRowIndex = 0;
|
162
|
-
this.lastIndex = 0;
|
163
|
-
this.focusedRowChange = new EventEmitter();
|
164
203
|
this.selectedRowsChange = new EventEmitter();
|
165
204
|
this._selectedRows = [];
|
166
|
-
this.itemHeight = 40;
|
167
|
-
this.width = '100%';
|
168
|
-
this.height = '100%';
|
169
|
-
this.onScrolledIndexChanged = new EventEmitter();
|
170
|
-
}
|
171
|
-
startFixedColumn() {
|
172
|
-
return this.columns?.toArray().filter((c) => c.fixed == 'start') ?? [];
|
173
|
-
}
|
174
|
-
endFixedColumn() {
|
175
|
-
return this.columns?.toArray().filter((c) => c.fixed == 'end') ?? [];
|
176
|
-
}
|
177
|
-
notFixedColumn() {
|
178
|
-
return this.columns?.toArray().filter((c) => !c.fixed) ?? [];
|
179
|
-
}
|
180
|
-
notFixedColumnCount() {
|
181
|
-
return this.columns?.toArray().filter((c) => !c.fixed).length ?? 0;
|
182
|
-
}
|
183
|
-
fixedColumnCount() {
|
184
|
-
return this.columns?.toArray().filter((c) => c.fixed).length ?? 0;
|
185
|
-
}
|
186
|
-
get focusedRow() {
|
187
|
-
return this._focusedRow;
|
188
|
-
}
|
189
|
-
set focusedRow(v) {
|
190
|
-
this._focusedRow = v;
|
191
|
-
this.focusedRowChange.emit(v);
|
192
205
|
}
|
193
206
|
get selectedRows() {
|
194
207
|
return this._selectedRows;
|
@@ -203,274 +216,75 @@ class AXDataTableComponent extends MXBaseComponent {
|
|
203
216
|
unSelectRows(...rows) {
|
204
217
|
this.selectedRows = this.selectedRows.filter((c) => !rows.includes(c));
|
205
218
|
}
|
206
|
-
|
207
|
-
|
219
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXBaseDataTable, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
220
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXBaseDataTable }); }
|
221
|
+
}
|
222
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXBaseDataTable, decorators: [{
|
223
|
+
type: Injectable
|
224
|
+
}], propDecorators: { dataSource: [{
|
225
|
+
type: Input
|
226
|
+
}], selectedRowsChange: [{
|
227
|
+
type: Output
|
228
|
+
}], selectedRows: [{
|
229
|
+
type: Input
|
230
|
+
}] } });
|
231
|
+
|
232
|
+
class AXBaseRowCommandColumnComponent extends AXDataTableColumnComponent {
|
233
|
+
constructor() {
|
234
|
+
super(...arguments);
|
235
|
+
this.grid = inject(AXBaseDataTable);
|
236
|
+
this.cdr = inject(ChangeDetectorRef);
|
237
|
+
this.allowSorting = false;
|
238
|
+
this.onItemClick = new EventEmitter();
|
208
239
|
}
|
209
|
-
|
210
|
-
|
211
|
-
this.listDataSource = new AXListDataSource({
|
212
|
-
source: this.dataSource,
|
213
|
-
});
|
214
|
-
this.listDataSource.source.onLoadingChanged.subscribe((data) => {
|
215
|
-
this.isLoading = data;
|
216
|
-
});
|
217
|
-
this.listDataSource.source.onChanged.subscribe((data) => {
|
218
|
-
this.totalRows = data.totalCount;
|
219
|
-
this.hasItems = data.totalCount > 0;
|
220
|
-
setTimeout(() => {
|
221
|
-
this.render();
|
222
|
-
}, 100);
|
223
|
-
});
|
224
|
-
//
|
225
|
-
this.clickSubject
|
226
|
-
.pipe(buffer(this.clickSubject.pipe(debounceTime(250))), filter((clickArray) => clickArray.length === 2))
|
227
|
-
.subscribe((clickArray) => {
|
228
|
-
this.handleRowDoubleClick(clickArray[0].event, clickArray[0].item);
|
229
|
-
});
|
240
|
+
get loadingEnabled() {
|
241
|
+
return false;
|
230
242
|
}
|
231
|
-
|
232
|
-
|
233
|
-
this.onScrolledIndexChanged.emit({
|
234
|
-
component: this,
|
235
|
-
index: this.lastIndex,
|
236
|
-
isUserInteraction: true,
|
237
|
-
});
|
243
|
+
get cssClass() {
|
244
|
+
return 'ax-command-column';
|
238
245
|
}
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
this.
|
244
|
-
this.
|
245
|
-
//
|
246
|
-
this.updateTotalCount();
|
246
|
+
}
|
247
|
+
class AXRowDropdownCommandColumnComponent extends AXBaseRowCommandColumnComponent {
|
248
|
+
constructor() {
|
249
|
+
super(...arguments);
|
250
|
+
this._items = [];
|
251
|
+
this.items = [];
|
247
252
|
}
|
248
|
-
|
249
|
-
|
250
|
-
if (this.startRowIndex < 1)
|
251
|
-
this.startRowIndex = 1;
|
252
|
-
if (this.startRowIndex > this.totalRows)
|
253
|
-
this.startRowIndex = this.totalRows;
|
253
|
+
get template() {
|
254
|
+
return this._template;
|
254
255
|
}
|
255
|
-
|
256
|
-
|
257
|
-
(this.footerContainer?.nativeElement.clientHeight ?? 0)}px)`;
|
256
|
+
get name() {
|
257
|
+
return 'cl-dd-cmd';
|
258
258
|
}
|
259
|
-
|
260
|
-
if (
|
261
|
-
|
262
|
-
.toArray()
|
263
|
-
.map((c) => typeof c.width == 'number'
|
264
|
-
? c.width
|
265
|
-
: Number(c.width.replace('px', ''))));
|
266
|
-
this.width = `${Math.max(sumPx, this.getHostElement().clientWidth - 5)}px`;
|
259
|
+
async handleOnOpened(rowData) {
|
260
|
+
if (Array.isArray(this.items)) {
|
261
|
+
this._items = this.items;
|
267
262
|
}
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
headerContainer.style.transform = `translateX(${-left}px)`;
|
263
|
+
else
|
264
|
+
typeof this.items == 'function';
|
265
|
+
{
|
266
|
+
const result = this['items'](rowData);
|
267
|
+
if (Array.isArray(result)) {
|
268
|
+
this._items = result;
|
275
269
|
}
|
276
|
-
|
277
|
-
|
278
|
-
// Function to copy fixed columns
|
279
|
-
copyFixedColumns() {
|
280
|
-
const originalRows = Array.from(this.viewport._contentWrapper.nativeElement.querySelectorAll('tr'));
|
281
|
-
const fixedColumnTable = this.getHostElement().querySelector('.ax-body-fixed-columns > table > tbody');
|
282
|
-
fixedColumnTable.querySelectorAll('tr').forEach((n) => n.remove());
|
283
|
-
for (const row of originalRows) {
|
284
|
-
const fixedCells = Array.from(row.querySelectorAll('[data-fixed="start"]'));
|
285
|
-
const fixedRow = document.createElement('tr');
|
286
|
-
for (const cell of fixedCells) {
|
287
|
-
const clonedCell = cell.cloneNode(true);
|
288
|
-
fixedRow.appendChild(clonedCell);
|
270
|
+
else if (result instanceof Promise) {
|
271
|
+
this._items = await result;
|
289
272
|
}
|
290
|
-
fixedColumnTable.appendChild(fixedRow);
|
291
273
|
}
|
292
|
-
|
293
|
-
fixedColumnTable.style.transform = `translateY(${-scrollTop}px)`;
|
294
|
-
}
|
295
|
-
render() {
|
296
|
-
this.viewport.checkViewportSize();
|
297
|
-
this.viewport.scrollToIndex(this.lastIndex);
|
298
|
-
this.cdr.markForCheck();
|
299
|
-
}
|
300
|
-
refresh() {
|
301
|
-
this.lastIndex = 0;
|
302
|
-
this.dataSource.refresh();
|
274
|
+
this.cdr.detectChanges();
|
303
275
|
}
|
304
|
-
|
305
|
-
this.
|
306
|
-
this.clickSubject.next({ event, item });
|
276
|
+
handleOnClosed() {
|
277
|
+
this._items = [];
|
307
278
|
}
|
308
|
-
|
309
|
-
|
310
|
-
this.
|
311
|
-
}
|
312
|
-
else {
|
313
|
-
this.focusedRow = item;
|
314
|
-
}
|
315
|
-
//
|
316
|
-
this.onRowClick.emit({
|
317
|
-
component: this,
|
318
|
-
data: item,
|
279
|
+
handleOnItemClick(e, data) {
|
280
|
+
const args = {
|
281
|
+
component: this.grid,
|
319
282
|
isUserInteraction: true,
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
this.onRowDbClick.emit({
|
326
|
-
component: this,
|
327
|
-
data: item,
|
328
|
-
isUserInteraction: true,
|
329
|
-
});
|
330
|
-
}
|
331
|
-
handleColumnClick(e, column) {
|
332
|
-
if (column instanceof AXDataTableTextColumnComponent) {
|
333
|
-
const sort = this.dataSource.query.sort.find((c) => c.field == column.dataField);
|
334
|
-
if (!sort) {
|
335
|
-
this.dataSource.query.sort.push({
|
336
|
-
field: column.dataField,
|
337
|
-
dir: 'asc',
|
338
|
-
});
|
339
|
-
}
|
340
|
-
else {
|
341
|
-
if (sort.dir == 'asc') {
|
342
|
-
sort.dir = 'desc';
|
343
|
-
}
|
344
|
-
else {
|
345
|
-
this.dataSource.query.sort = this.dataSource.query.sort.filter((c) => c != sort);
|
346
|
-
}
|
347
|
-
}
|
348
|
-
this.refresh();
|
349
|
-
}
|
350
|
-
}
|
351
|
-
getSort(column) {
|
352
|
-
if (column instanceof AXDataTableTextColumnComponent) {
|
353
|
-
const sort = this.dataSource.query.sort.find((c) => c.field == column.dataField);
|
354
|
-
return sort
|
355
|
-
? sort.dir == 'asc'
|
356
|
-
? 'ax-icon-arrow-long-down'
|
357
|
-
: 'ax-icon-arrow-long-up'
|
358
|
-
: undefined;
|
359
|
-
}
|
360
|
-
return undefined;
|
361
|
-
}
|
362
|
-
_handleOnScroll() {
|
363
|
-
this.updateHScroll();
|
364
|
-
}
|
365
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXDataTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
366
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.2", type: AXDataTableComponent, selector: "ax-data-table", inputs: { rowTemplate: "rowTemplate", emptyTemplate: "emptyTemplate", showHeader: "showHeader", fetchDataMode: "fetchDataMode", dataSource: "dataSource", loading: "loading", focusedRow: "focusedRow", selectedRows: "selectedRows", itemHeight: "itemHeight" }, outputs: { onPageChanged: "onPageChanged", onRowClick: "onRowClick", onRowDbClick: "onRowDbClick", focusedRowChange: "focusedRowChange", selectedRowsChange: "selectedRowsChange", onScrolledIndexChanged: "onScrolledIndexChanged" }, providers: [{ provide: AXPagedComponent, useExisting: AXDataTableComponent }], queries: [{ propertyName: "columns", predicate: AXDataTableColumnComponent }], viewQueries: [{ propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, static: true }, { propertyName: "headerContainer", first: true, predicate: ["headerContainer"], descendants: true }, { propertyName: "footerContainer", first: true, predicate: ["footerContainer"], descendants: true }, { propertyName: "scrollableContainer", first: true, predicate: ["scrolling"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"ax-header\"> </ng-content>\n<!------------------- Header contents ------------------->\n@if(showHeader){\n<div class=\"ax-header-content\">\n <div class=\"ax-header-columns\">\n <table tabindex=\"0\" [style.width]=\"width\" #headerContainer>\n <thead>\n <tr>\n @for(c of notFixedColumn();track c.name)\n {\n <th [class.ax-interactive]=\"c.allowSorting\" (click)=\"c.allowSorting ? handleColumnClick($event, c) : null\"\n [style.width]=\"c.width\">\n @if(c.headerTemplate)\n {\n <ng-container *ngTemplateOutlet=\"c.headerTemplate\"></ng-container>\n }\n @else {\n <div class=\"ax-caption\">\n {{ c.caption }}\n @if(getSort(c)){\n <ax-icon icon=\"ax-icon {{ getSort(c) }}\"></ax-icon>\n }\n </div>\n }\n <!-- @if(c.allowResizing)\n {\n <div class=\"ax-resize-handle\" [ax-table-column-resizble]=\"c\"></div>\n } -->\n </th>\n }\n <th></th>\n </tr>\n </thead>\n </table>\n </div>\n</div>\n}\n\n<!------------------- Body contents ------------------->\n<div [style.height]=\"height\" class=\"ax-body-content\">\n <div class=\"ax-body-columns\">\n <div cdkVirtualScrollingElement #scrolling [style.height]=\"'100%'\" (scroll)=\"_handleOnScroll()\">\n <cdk-virtual-scroll-viewport [itemSize]=\"itemHeight\" [style.--item-height]=\"itemHeight + 'px'\"\n (scrolledIndexChange)=\"_handleOnscrolledIndexChange($event)\">\n <table tabindex=\"0\" class=\"ax-table-body ax-relative\" [style.width]=\"width\">\n <colgroup>\n @for(c of notFixedColumn();track c.name)\n {\n <col [style.width]=\"c.width\" />\n }\n <col />\n </colgroup>\n <tbody>\n <ng-container *cdkVirtualFor=\"\n let item of listDataSource;\n templateCacheSize: 100;\n let i = index;\n trackBy: trackByIdx;\n let rIndex = index\n \">\n <!------------------- custom row template------------------->\n @if (rowTemplate != null) {\n <ng-container *ngTemplateOutlet=\"rowTemplate; context: { $implicit: { data: item, rowIndex: rIndex } }\">\n </ng-container>\n } @else {\n <!------------------- normal row template------------------->\n <tr [class.ax-state-focused]=\"focusedRow && item === focusedRow\" [attr.data-index]=\"rIndex\"\n [class.ax-state-selected]=\"selectedRows.includes(item)\" (click)=\"handleRowClick($event, item)\">\n <!------------------- start fixed column ------------------->\n\n <!------------------- Not fixed column ------------------->\n @for (c of notFixedColumn(); track c.name) {\n <!------------------- custom cell template ------------------->\n @if (c.cellTemplate) {\n <ng-container\n *ngTemplateOutlet=\"c.cellTemplate;context: { $implicit: { data: item, rowIndex: rIndex } }\">\n </ng-container>\n } @else {\n <!------------------- default cell template ------------------->\n <td [attr.data-label]=\"c.caption\" tabindex=\"0\" [class]=\"c.cssClass\">\n @if (item) {\n <!------------------- render cell ------------------->\n <ng-container\n *ngTemplateOutlet=\"c.template;context: { $implicit: { data: item, rowIndex: rIndex } }\"></ng-container>\n }\n @else {\n <!------------------- render loading ------------------->\n @if (c.loadingEnabled && loading) {\n <ax-skeleton [animated]=\"loading.animation\"></ax-skeleton>\n }\n }\n </td>\n }\n }\n <td></td>\n </tr>\n }\n </ng-container>\n </tbody>\n </table>\n </cdk-virtual-scroll-viewport>\n </div>\n </div>\n</div>\n<div class=\"ax-table-footer\" #footerContainer>\n <div class=\"ax-table-info\">\n <div>Showing {{ startRowIndex }} of {{ totalRows }} items</div>\n <ax-button look=\"blank\" class=\"ax-sm\" (onClick)=\"refresh()\">\n <ax-icon icon=\"ax-icon ax-icon-refresh\"></ax-icon>\n </ax-button>\n </div>\n <ng-content select=\"ax-footer\"> </ng-content>\n</div>", styles: [".ax-dark ax-data-table .ax-header-content th.ax-interactive:hover{background-color:rgba(var(--ax-color-neutral-500))!important}.ax-dark ax-data-table .ax-body-content tr:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-data-table .ax-body-content tr.ax-state-focused td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-data-table .ax-body-content tr.ax-state-focused:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important}.ax-dark ax-data-table .ax-body-content tr.ax-state-selected td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-data-table .ax-body-content tr.ax-state-selected:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important}ax-data-table{display:block;height:100%;overflow:hidden;border-radius:var(--ax-rounded-border-default);border-width:1px;border-color:rgba(var(--ax-color-border-default));font-size:.875rem;line-height:1.25rem}ax-data-table table{table-layout:fixed}ax-data-table .ax-header-content{position:relative;height:3rem;overflow:hidden}ax-data-table .ax-header-content .ax-header-fixed-columns{pointer-events:none;position:absolute;z-index:10}ax-data-table .ax-header-content .ax-header-fixed-columns th.ax-column-fixed{pointer-events:auto}ax-data-table .ax-header-content .ax-header-fixed-columns th:not(.ax-column-fixed){visibility:hidden;background-color:transparent}ax-data-table .ax-header-content .ax-header-columns{height:100%}ax-data-table .ax-header-content .ax-header-columns>table{height:100%;overflow:hidden;border-start-end-radius:var(--ax-rounded-border-default);border-start-start-radius:var(--ax-rounded-border-default)}ax-data-table .ax-header-content .ax-header-columns>table th{border-bottom-width:1px;border-inline-end-width:1px;border-style:solid;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-on-surface));padding:.75rem 1rem;text-align:start;font-weight:500;text-transform:uppercase;position:relative}ax-data-table .ax-header-content .ax-header-columns>table th.ax-interactive{cursor:pointer}ax-data-table .ax-header-content .ax-header-columns>table th.ax-interactive:hover{background-color:rgba(var(--ax-color-neutral-200))}ax-data-table .ax-header-content .ax-header-columns>table th .ax-resize-handle{position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;background:transparent}ax-data-table .ax-header-content .ax-header-columns>table th .ax-resize-handle:hover{background-color:rgba(var(--ax-color-neutral-300))}ax-data-table .ax-header-content .ax-header-columns>table th .ax-caption{display:flex;align-items:center;gap:.5rem}ax-data-table .ax-header-content .ax-header-columns>table th:last-child{border-inline-end-width:0px}ax-data-table .ax-body-content{position:relative}ax-data-table .ax-body-content .ax-body-fixed-columns{pointer-events:none;position:absolute;z-index:10}ax-data-table .ax-body-content .ax-body-columns{height:100%}ax-data-table .ax-body-content .ax-body-columns table{border-collapse:collapse}ax-data-table .ax-body-content .ax-body-columns table tr:nth-child(2n) td{background-color:rgba(var(--ax-color-on-surface))}ax-data-table .ax-body-content .ax-body-columns table tr:nth-child(2n) ax-skeleton{width:25%}ax-data-table .ax-body-content .ax-body-columns table tr{height:2.5rem}ax-data-table .ax-body-content .ax-body-columns table tr:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200))}ax-data-table .ax-body-content .ax-body-columns table tr.ax-state-focused td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200));color:rgba(var(--ax-color-primary-fore-tint))}ax-data-table .ax-body-content .ax-body-columns table tr.ax-state-focused:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-300))}ax-data-table .ax-body-content .ax-body-columns table tr.ax-state-selected td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-300));color:rgba(var(--ax-color-primary-fore-tint))}ax-data-table .ax-body-content .ax-body-columns table tr.ax-state-selected:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-400));color:rgba(var(--ax-color-primary-fore))}ax-data-table .ax-body-content .ax-body-columns table td{position:relative;min-width:2rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-bottom-width:1px;border-inline-end-width:1px;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-surface));padding:.5rem 1rem;vertical-align:middle}ax-data-table .ax-body-content .ax-body-columns table td.ax-index-column{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:rgba(var(--ax-color-on-surface));text-align:center}ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button.ax-state-disabled{position:relative!important;cursor:not-allowed!important;opacity:.5!important}ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column>div{position:absolute;inset-inline-start:0px;top:50%;display:flex;width:100%;transform:translateY(-50%);align-items:center;justify-content:center}ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button{position:relative;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:var(--ax-rounded-border-default);border-style:none;border-color:rgba(var(--ax-color-border-default));background-color:transparent;padding:.25rem;line-height:1;color:rgba(var(--ax-color-ghost-fore))}ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:hover:not(ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:hover.ax-state-selected,ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:hover.ax-state-disabled){opacity:.75}ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:active{opacity:1}ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button .ax-ripple{background-color:rgba(var(--ax-color-ghost-fore),.05)}ax-data-table .ax-body-content .ax-body-columns table td:last-child{border-inline-end-width:0px}ax-data-table .ax-body-content .ax-body-columns table td ax-skeleton{height:.875rem;width:33.333333%;border-radius:.375rem}ax-data-table .ax-table-footer{border-collapse:collapse;overflow:hidden;border-top-width:1px;border-color:rgba(var(--ax-color-border-default));padding:.5rem .875rem}ax-data-table .ax-table-footer .ax-table-info{display:flex;flex:1 1 0%;align-items:center;justify-content:space-between}\n"], dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i2.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i2.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: i2.CdkVirtualScrollableElement, selector: "[cdkVirtualScrollingElement]" }, { kind: "component", type: i2$1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i4.AXSkeletonComponent, selector: "ax-skeleton", inputs: ["animated"] }, { kind: "component", type: i5.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
367
|
-
}
|
368
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXDataTableComponent, decorators: [{
|
369
|
-
type: Component,
|
370
|
-
args: [{ selector: 'ax-data-table', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [{ provide: AXPagedComponent, useExisting: AXDataTableComponent }], template: "<ng-content select=\"ax-header\"> </ng-content>\n<!------------------- Header contents ------------------->\n@if(showHeader){\n<div class=\"ax-header-content\">\n <div class=\"ax-header-columns\">\n <table tabindex=\"0\" [style.width]=\"width\" #headerContainer>\n <thead>\n <tr>\n @for(c of notFixedColumn();track c.name)\n {\n <th [class.ax-interactive]=\"c.allowSorting\" (click)=\"c.allowSorting ? handleColumnClick($event, c) : null\"\n [style.width]=\"c.width\">\n @if(c.headerTemplate)\n {\n <ng-container *ngTemplateOutlet=\"c.headerTemplate\"></ng-container>\n }\n @else {\n <div class=\"ax-caption\">\n {{ c.caption }}\n @if(getSort(c)){\n <ax-icon icon=\"ax-icon {{ getSort(c) }}\"></ax-icon>\n }\n </div>\n }\n <!-- @if(c.allowResizing)\n {\n <div class=\"ax-resize-handle\" [ax-table-column-resizble]=\"c\"></div>\n } -->\n </th>\n }\n <th></th>\n </tr>\n </thead>\n </table>\n </div>\n</div>\n}\n\n<!------------------- Body contents ------------------->\n<div [style.height]=\"height\" class=\"ax-body-content\">\n <div class=\"ax-body-columns\">\n <div cdkVirtualScrollingElement #scrolling [style.height]=\"'100%'\" (scroll)=\"_handleOnScroll()\">\n <cdk-virtual-scroll-viewport [itemSize]=\"itemHeight\" [style.--item-height]=\"itemHeight + 'px'\"\n (scrolledIndexChange)=\"_handleOnscrolledIndexChange($event)\">\n <table tabindex=\"0\" class=\"ax-table-body ax-relative\" [style.width]=\"width\">\n <colgroup>\n @for(c of notFixedColumn();track c.name)\n {\n <col [style.width]=\"c.width\" />\n }\n <col />\n </colgroup>\n <tbody>\n <ng-container *cdkVirtualFor=\"\n let item of listDataSource;\n templateCacheSize: 100;\n let i = index;\n trackBy: trackByIdx;\n let rIndex = index\n \">\n <!------------------- custom row template------------------->\n @if (rowTemplate != null) {\n <ng-container *ngTemplateOutlet=\"rowTemplate; context: { $implicit: { data: item, rowIndex: rIndex } }\">\n </ng-container>\n } @else {\n <!------------------- normal row template------------------->\n <tr [class.ax-state-focused]=\"focusedRow && item === focusedRow\" [attr.data-index]=\"rIndex\"\n [class.ax-state-selected]=\"selectedRows.includes(item)\" (click)=\"handleRowClick($event, item)\">\n <!------------------- start fixed column ------------------->\n\n <!------------------- Not fixed column ------------------->\n @for (c of notFixedColumn(); track c.name) {\n <!------------------- custom cell template ------------------->\n @if (c.cellTemplate) {\n <ng-container\n *ngTemplateOutlet=\"c.cellTemplate;context: { $implicit: { data: item, rowIndex: rIndex } }\">\n </ng-container>\n } @else {\n <!------------------- default cell template ------------------->\n <td [attr.data-label]=\"c.caption\" tabindex=\"0\" [class]=\"c.cssClass\">\n @if (item) {\n <!------------------- render cell ------------------->\n <ng-container\n *ngTemplateOutlet=\"c.template;context: { $implicit: { data: item, rowIndex: rIndex } }\"></ng-container>\n }\n @else {\n <!------------------- render loading ------------------->\n @if (c.loadingEnabled && loading) {\n <ax-skeleton [animated]=\"loading.animation\"></ax-skeleton>\n }\n }\n </td>\n }\n }\n <td></td>\n </tr>\n }\n </ng-container>\n </tbody>\n </table>\n </cdk-virtual-scroll-viewport>\n </div>\n </div>\n</div>\n<div class=\"ax-table-footer\" #footerContainer>\n <div class=\"ax-table-info\">\n <div>Showing {{ startRowIndex }} of {{ totalRows }} items</div>\n <ax-button look=\"blank\" class=\"ax-sm\" (onClick)=\"refresh()\">\n <ax-icon icon=\"ax-icon ax-icon-refresh\"></ax-icon>\n </ax-button>\n </div>\n <ng-content select=\"ax-footer\"> </ng-content>\n</div>", styles: [".ax-dark ax-data-table .ax-header-content th.ax-interactive:hover{background-color:rgba(var(--ax-color-neutral-500))!important}.ax-dark ax-data-table .ax-body-content tr:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-data-table .ax-body-content tr.ax-state-focused td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-data-table .ax-body-content tr.ax-state-focused:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important}.ax-dark ax-data-table .ax-body-content tr.ax-state-selected td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-data-table .ax-body-content tr.ax-state-selected:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important}ax-data-table{display:block;height:100%;overflow:hidden;border-radius:var(--ax-rounded-border-default);border-width:1px;border-color:rgba(var(--ax-color-border-default));font-size:.875rem;line-height:1.25rem}ax-data-table table{table-layout:fixed}ax-data-table .ax-header-content{position:relative;height:3rem;overflow:hidden}ax-data-table .ax-header-content .ax-header-fixed-columns{pointer-events:none;position:absolute;z-index:10}ax-data-table .ax-header-content .ax-header-fixed-columns th.ax-column-fixed{pointer-events:auto}ax-data-table .ax-header-content .ax-header-fixed-columns th:not(.ax-column-fixed){visibility:hidden;background-color:transparent}ax-data-table .ax-header-content .ax-header-columns{height:100%}ax-data-table .ax-header-content .ax-header-columns>table{height:100%;overflow:hidden;border-start-end-radius:var(--ax-rounded-border-default);border-start-start-radius:var(--ax-rounded-border-default)}ax-data-table .ax-header-content .ax-header-columns>table th{border-bottom-width:1px;border-inline-end-width:1px;border-style:solid;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-on-surface));padding:.75rem 1rem;text-align:start;font-weight:500;text-transform:uppercase;position:relative}ax-data-table .ax-header-content .ax-header-columns>table th.ax-interactive{cursor:pointer}ax-data-table .ax-header-content .ax-header-columns>table th.ax-interactive:hover{background-color:rgba(var(--ax-color-neutral-200))}ax-data-table .ax-header-content .ax-header-columns>table th .ax-resize-handle{position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;background:transparent}ax-data-table .ax-header-content .ax-header-columns>table th .ax-resize-handle:hover{background-color:rgba(var(--ax-color-neutral-300))}ax-data-table .ax-header-content .ax-header-columns>table th .ax-caption{display:flex;align-items:center;gap:.5rem}ax-data-table .ax-header-content .ax-header-columns>table th:last-child{border-inline-end-width:0px}ax-data-table .ax-body-content{position:relative}ax-data-table .ax-body-content .ax-body-fixed-columns{pointer-events:none;position:absolute;z-index:10}ax-data-table .ax-body-content .ax-body-columns{height:100%}ax-data-table .ax-body-content .ax-body-columns table{border-collapse:collapse}ax-data-table .ax-body-content .ax-body-columns table tr:nth-child(2n) td{background-color:rgba(var(--ax-color-on-surface))}ax-data-table .ax-body-content .ax-body-columns table tr:nth-child(2n) ax-skeleton{width:25%}ax-data-table .ax-body-content .ax-body-columns table tr{height:2.5rem}ax-data-table .ax-body-content .ax-body-columns table tr:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200))}ax-data-table .ax-body-content .ax-body-columns table tr.ax-state-focused td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200));color:rgba(var(--ax-color-primary-fore-tint))}ax-data-table .ax-body-content .ax-body-columns table tr.ax-state-focused:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-300))}ax-data-table .ax-body-content .ax-body-columns table tr.ax-state-selected td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-300));color:rgba(var(--ax-color-primary-fore-tint))}ax-data-table .ax-body-content .ax-body-columns table tr.ax-state-selected:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-400));color:rgba(var(--ax-color-primary-fore))}ax-data-table .ax-body-content .ax-body-columns table td{position:relative;min-width:2rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-bottom-width:1px;border-inline-end-width:1px;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-surface));padding:.5rem 1rem;vertical-align:middle}ax-data-table .ax-body-content .ax-body-columns table td.ax-index-column{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:rgba(var(--ax-color-on-surface));text-align:center}ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button.ax-state-disabled{position:relative!important;cursor:not-allowed!important;opacity:.5!important}ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column>div{position:absolute;inset-inline-start:0px;top:50%;display:flex;width:100%;transform:translateY(-50%);align-items:center;justify-content:center}ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button{position:relative;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:var(--ax-rounded-border-default);border-style:none;border-color:rgba(var(--ax-color-border-default));background-color:transparent;padding:.25rem;line-height:1;color:rgba(var(--ax-color-ghost-fore))}ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:hover:not(ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:hover.ax-state-selected,ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:hover.ax-state-disabled){opacity:.75}ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:active{opacity:1}ax-data-table .ax-body-content .ax-body-columns table td.ax-command-column button .ax-ripple{background-color:rgba(var(--ax-color-ghost-fore),.05)}ax-data-table .ax-body-content .ax-body-columns table td:last-child{border-inline-end-width:0px}ax-data-table .ax-body-content .ax-body-columns table td ax-skeleton{height:.875rem;width:33.333333%;border-radius:.375rem}ax-data-table .ax-table-footer{border-collapse:collapse;overflow:hidden;border-top-width:1px;border-color:rgba(var(--ax-color-border-default));padding:.5rem .875rem}ax-data-table .ax-table-footer .ax-table-info{display:flex;flex:1 1 0%;align-items:center;justify-content:space-between}\n"] }]
|
371
|
-
}], propDecorators: { columns: [{
|
372
|
-
type: ContentChildren,
|
373
|
-
args: [AXDataTableColumnComponent]
|
374
|
-
}], onPageChanged: [{
|
375
|
-
type: Output
|
376
|
-
}], onRowClick: [{
|
377
|
-
type: Output
|
378
|
-
}], onRowDbClick: [{
|
379
|
-
type: Output
|
380
|
-
}], rowTemplate: [{
|
381
|
-
type: Input
|
382
|
-
}], emptyTemplate: [{
|
383
|
-
type: Input
|
384
|
-
}], showHeader: [{
|
385
|
-
type: Input
|
386
|
-
}], fetchDataMode: [{
|
387
|
-
type: Input
|
388
|
-
}], dataSource: [{
|
389
|
-
type: Input
|
390
|
-
}], loading: [{
|
391
|
-
type: Input
|
392
|
-
}], focusedRowChange: [{
|
393
|
-
type: Output
|
394
|
-
}], focusedRow: [{
|
395
|
-
type: Input
|
396
|
-
}], selectedRowsChange: [{
|
397
|
-
type: Output
|
398
|
-
}], selectedRows: [{
|
399
|
-
type: Input
|
400
|
-
}], itemHeight: [{
|
401
|
-
type: Input
|
402
|
-
}], viewport: [{
|
403
|
-
type: ViewChild,
|
404
|
-
args: [CdkVirtualScrollViewport, { static: true }]
|
405
|
-
}], onScrolledIndexChanged: [{
|
406
|
-
type: Output
|
407
|
-
}], headerContainer: [{
|
408
|
-
type: ViewChild,
|
409
|
-
args: ['headerContainer']
|
410
|
-
}], footerContainer: [{
|
411
|
-
type: ViewChild,
|
412
|
-
args: ['footerContainer']
|
413
|
-
}], scrollableContainer: [{
|
414
|
-
type: ViewChild,
|
415
|
-
args: ['scrolling', { static: true }]
|
416
|
-
}] } });
|
417
|
-
|
418
|
-
class AXBaseRowCommandColumnComponent extends AXDataTableColumnComponent {
|
419
|
-
constructor() {
|
420
|
-
super(...arguments);
|
421
|
-
this.grid = inject(AXDataTableComponent);
|
422
|
-
this.cdr = inject(ChangeDetectorRef);
|
423
|
-
this.allowSorting = false;
|
424
|
-
this.onItemClick = new EventEmitter();
|
425
|
-
}
|
426
|
-
get loadingEnabled() {
|
427
|
-
return false;
|
428
|
-
}
|
429
|
-
get cssClass() {
|
430
|
-
return 'ax-command-column';
|
431
|
-
}
|
432
|
-
}
|
433
|
-
class AXRowDropdownCommandColumnComponent extends AXBaseRowCommandColumnComponent {
|
434
|
-
constructor() {
|
435
|
-
super(...arguments);
|
436
|
-
this._items = [];
|
437
|
-
this.items = [];
|
438
|
-
}
|
439
|
-
get template() {
|
440
|
-
return this._template;
|
441
|
-
}
|
442
|
-
get name() {
|
443
|
-
return 'cl-dd-cmd';
|
444
|
-
}
|
445
|
-
async handleOnOpened(rowData) {
|
446
|
-
if (Array.isArray(this.items)) {
|
447
|
-
this._items = this.items;
|
448
|
-
}
|
449
|
-
else
|
450
|
-
typeof this.items == 'function';
|
451
|
-
{
|
452
|
-
const result = this['items'](rowData);
|
453
|
-
if (Array.isArray(result)) {
|
454
|
-
this._items = result;
|
455
|
-
}
|
456
|
-
else if (result instanceof Promise) {
|
457
|
-
this._items = await result;
|
458
|
-
}
|
459
|
-
}
|
460
|
-
this.cdr.detectChanges();
|
461
|
-
}
|
462
|
-
handleOnClosed() {
|
463
|
-
this._items = [];
|
464
|
-
}
|
465
|
-
handleOnItemClick(e, data) {
|
466
|
-
const args = {
|
467
|
-
component: this.grid,
|
468
|
-
isUserInteraction: true,
|
469
|
-
nativeEvent: e,
|
470
|
-
data,
|
471
|
-
name: e.name,
|
472
|
-
};
|
473
|
-
this.onItemClick.emit(args);
|
283
|
+
nativeEvent: e,
|
284
|
+
data,
|
285
|
+
name: e.name,
|
286
|
+
};
|
287
|
+
this.onItemClick.emit(args);
|
474
288
|
}
|
475
289
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXRowDropdownCommandColumnComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
476
290
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.2", type: AXRowDropdownCommandColumnComponent, selector: "ax-dropdown-command-column", inputs: { width: "width", caption: "caption", fixed: "fixed", items: "items" }, outputs: { onItemClick: "onItemClick" }, providers: [
|
@@ -480,35 +294,27 @@ class AXRowDropdownCommandColumnComponent extends AXBaseRowCommandColumnComponen
|
|
480
294
|
},
|
481
295
|
], viewQueries: [{ propertyName: "_template", first: true, predicate: TemplateRef, descendants: true }], usesInheritance: true, ngImport: i0, template: ` <ng-template let-row>
|
482
296
|
@if (row.data) {
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
} @else {
|
498
|
-
<div panel style="padding: 0.875rem;">
|
499
|
-
<ax-loading></ax-loading>
|
500
|
-
</div>
|
501
|
-
}
|
502
|
-
</ax-dropdown-panel>
|
503
|
-
</button>
|
504
|
-
</div>
|
297
|
+
<div>
|
298
|
+
<button [axRipple]>
|
299
|
+
<ax-icon icon="ax-icon ax-icon-solid ax-icon-more-horizontal"></ax-icon>
|
300
|
+
<ax-dropdown-panel [adaptivityEnabled]="true" (onOpened)="handleOnOpened(row.data)" (onClosed)="handleOnClosed()">
|
301
|
+
@if (_items.length) {
|
302
|
+
<ax-button-item-list (onItemClick)="handleOnItemClick($event, row.data)" [items]="_items"> </ax-button-item-list>
|
303
|
+
} @else {
|
304
|
+
<div panel style="padding: 0.875rem;">
|
305
|
+
<ax-loading></ax-loading>
|
306
|
+
</div>
|
307
|
+
}
|
308
|
+
</ax-dropdown-panel>
|
309
|
+
</button>
|
310
|
+
</div>
|
505
311
|
}
|
506
312
|
<ng-template #loading>
|
507
313
|
<div panel style="padding: 0.875rem;">
|
508
314
|
<ax-loading></ax-loading>
|
509
315
|
</div>
|
510
316
|
</ng-template>
|
511
|
-
</ng-template>`, isInline: true, dependencies: [{ kind: "component", type: i1
|
317
|
+
</ng-template>`, isInline: true, dependencies: [{ kind: "component", type: i1.AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i3$1.AXButtonItemListComponent, selector: "ax-button-item-list", inputs: ["items"], outputs: ["onItemClick"] }, { kind: "component", type: i4.AXDropdownPanelComponent, selector: "ax-dropdown-panel", inputs: ["isOpen", "fitParent", "dropdownWidth", "position", "_target", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }, { kind: "directive", type: i5.AXRippleDirective, selector: "[axRipple]", inputs: ["axRipple", "axRippleColor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
512
318
|
}
|
513
319
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXRowDropdownCommandColumnComponent, decorators: [{
|
514
320
|
type: Component,
|
@@ -516,28 +322,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
516
322
|
selector: 'ax-dropdown-command-column',
|
517
323
|
template: ` <ng-template let-row>
|
518
324
|
@if (row.data) {
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
} @else {
|
534
|
-
<div panel style="padding: 0.875rem;">
|
535
|
-
<ax-loading></ax-loading>
|
536
|
-
</div>
|
537
|
-
}
|
538
|
-
</ax-dropdown-panel>
|
539
|
-
</button>
|
540
|
-
</div>
|
325
|
+
<div>
|
326
|
+
<button [axRipple]>
|
327
|
+
<ax-icon icon="ax-icon ax-icon-solid ax-icon-more-horizontal"></ax-icon>
|
328
|
+
<ax-dropdown-panel [adaptivityEnabled]="true" (onOpened)="handleOnOpened(row.data)" (onClosed)="handleOnClosed()">
|
329
|
+
@if (_items.length) {
|
330
|
+
<ax-button-item-list (onItemClick)="handleOnItemClick($event, row.data)" [items]="_items"> </ax-button-item-list>
|
331
|
+
} @else {
|
332
|
+
<div panel style="padding: 0.875rem;">
|
333
|
+
<ax-loading></ax-loading>
|
334
|
+
</div>
|
335
|
+
}
|
336
|
+
</ax-dropdown-panel>
|
337
|
+
</button>
|
338
|
+
</div>
|
541
339
|
}
|
542
340
|
<ng-template #loading>
|
543
341
|
<div panel style="padding: 0.875rem;">
|
@@ -601,35 +399,39 @@ class AXRowCommandColumnComponent extends AXBaseRowCommandColumnComponent {
|
|
601
399
|
useExisting: AXRowCommandColumnComponent,
|
602
400
|
},
|
603
401
|
], viewQueries: [{ propertyName: "_template", first: true, predicate: TemplateRef, descendants: true }], usesInheritance: true, ngImport: i0, template: ` <ng-template let-row>
|
604
|
-
@if (row.data) {
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
402
|
+
@if (row.data) {
|
403
|
+
@for (item of getItems(row.data); track $index) {
|
404
|
+
<button
|
405
|
+
[style.color]="'rgba(var(--ax-color-' + (item.color ?? 'primary)')"
|
406
|
+
[disabled]="item.disabled"
|
407
|
+
[class.ax-state-disabled]="item.disabled"
|
408
|
+
[axRipple]="!item.disabled"
|
409
|
+
(click)="handleOnItemClick($event, item, row.data)"
|
410
|
+
>
|
411
|
+
<ax-icon [icon]="item.icon"></ax-icon>
|
412
|
+
</button>
|
413
|
+
}
|
414
|
+
}
|
415
|
+
</ng-template>`, isInline: true, dependencies: [{ kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "directive", type: i5.AXRippleDirective, selector: "[axRipple]", inputs: ["axRipple", "axRippleColor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
616
416
|
}
|
617
417
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXRowCommandColumnComponent, decorators: [{
|
618
418
|
type: Component,
|
619
419
|
args: [{
|
620
420
|
selector: 'ax-command-column',
|
621
421
|
template: ` <ng-template let-row>
|
622
|
-
@if (row.data) {
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
422
|
+
@if (row.data) {
|
423
|
+
@for (item of getItems(row.data); track $index) {
|
424
|
+
<button
|
425
|
+
[style.color]="'rgba(var(--ax-color-' + (item.color ?? 'primary)')"
|
426
|
+
[disabled]="item.disabled"
|
427
|
+
[class.ax-state-disabled]="item.disabled"
|
428
|
+
[axRipple]="!item.disabled"
|
429
|
+
(click)="handleOnItemClick($event, item, row.data)"
|
430
|
+
>
|
431
|
+
<ax-icon [icon]="item.icon"></ax-icon>
|
432
|
+
</button>
|
433
|
+
}
|
434
|
+
}
|
633
435
|
</ng-template>`,
|
634
436
|
encapsulation: ViewEncapsulation.None,
|
635
437
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
@@ -652,7 +454,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
652
454
|
class AXRowIndexColumnComponent extends AXDataTableColumnComponent {
|
653
455
|
constructor() {
|
654
456
|
super(...arguments);
|
655
|
-
this.grid = inject(
|
457
|
+
this.grid = inject(AXBaseDataTable);
|
656
458
|
this.unsubscriber = inject(AXUnsubscriber);
|
657
459
|
this.padZero = false;
|
658
460
|
this.formatCount = 1;
|
@@ -666,9 +468,7 @@ class AXRowIndexColumnComponent extends AXDataTableColumnComponent {
|
|
666
468
|
}
|
667
469
|
ngOnInit() {
|
668
470
|
if (this.padZero) {
|
669
|
-
this.grid.dataSource.onChanged
|
670
|
-
.pipe(this.unsubscriber.takeUntilDestroy)
|
671
|
-
.subscribe((c) => {
|
471
|
+
this.grid.dataSource.onChanged.pipe(this.unsubscriber.takeUntilDestroy).subscribe((c) => {
|
672
472
|
this.formatCount = c.totalCount.toString().length;
|
673
473
|
});
|
674
474
|
}
|
@@ -687,27 +487,15 @@ class AXRowIndexColumnComponent extends AXDataTableColumnComponent {
|
|
687
487
|
useExisting: AXRowIndexColumnComponent,
|
688
488
|
},
|
689
489
|
], viewQueries: [{ propertyName: "_template", first: true, predicate: TemplateRef, descendants: true }], usesInheritance: true, ngImport: i0, template: ` <ng-template let-row>
|
690
|
-
{{
|
691
|
-
|
692
|
-
| format
|
693
|
-
: 'number'
|
694
|
-
: { zeroPadLength: this.formatCount, thousandSeparator: false }
|
695
|
-
| async
|
696
|
-
}}
|
697
|
-
</ng-template>`, isInline: true, dependencies: [{ kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$2.AXFormatPipe, name: "format" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
490
|
+
{{ row.rowIndex + 1 | format: 'number' : { zeroPadLength: this.formatCount, thousandSeparator: false } | async }}
|
491
|
+
</ng-template>`, isInline: true, dependencies: [{ kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.AXFormatPipe, name: "format" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
698
492
|
}
|
699
493
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXRowIndexColumnComponent, decorators: [{
|
700
494
|
type: Component,
|
701
495
|
args: [{
|
702
496
|
selector: 'ax-index-column',
|
703
497
|
template: ` <ng-template let-row>
|
704
|
-
{{
|
705
|
-
row.rowIndex + 1
|
706
|
-
| format
|
707
|
-
: 'number'
|
708
|
-
: { zeroPadLength: this.formatCount, thousandSeparator: false }
|
709
|
-
| async
|
710
|
-
}}
|
498
|
+
{{ row.rowIndex + 1 | format: 'number' : { zeroPadLength: this.formatCount, thousandSeparator: false } | async }}
|
711
499
|
</ng-template>`,
|
712
500
|
encapsulation: ViewEncapsulation.None,
|
713
501
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
@@ -730,7 +518,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
730
518
|
class AXRowSelectColumnComponent extends AXDataTableColumnComponent {
|
731
519
|
constructor() {
|
732
520
|
super(...arguments);
|
733
|
-
this.grid = inject(
|
521
|
+
this.grid = inject(AXBaseDataTable);
|
734
522
|
}
|
735
523
|
get template() {
|
736
524
|
return this._template;
|
@@ -759,13 +547,7 @@ class AXRowSelectColumnComponent extends AXDataTableColumnComponent {
|
|
759
547
|
useExisting: AXRowSelectColumnComponent,
|
760
548
|
},
|
761
549
|
], viewQueries: [{ propertyName: "_template", first: true, predicate: TemplateRef, descendants: true }], usesInheritance: true, ngImport: i0, template: ` <ng-template let-row>
|
762
|
-
<input
|
763
|
-
class="ax-checkbox"
|
764
|
-
type="checkbox"
|
765
|
-
[disabled]="!row.data"
|
766
|
-
(change)="handleChange(row.data)"
|
767
|
-
[checked]="isSelected(row.data)"
|
768
|
-
/>
|
550
|
+
<input class="ax-checkbox" type="checkbox" [disabled]="!row.data" (change)="handleChange(row.data)" [checked]="isSelected(row.data)" />
|
769
551
|
</ng-template>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
770
552
|
}
|
771
553
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXRowSelectColumnComponent, decorators: [{
|
@@ -773,13 +555,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
773
555
|
args: [{
|
774
556
|
selector: 'ax-select-column',
|
775
557
|
template: ` <ng-template let-row>
|
776
|
-
<input
|
777
|
-
class="ax-checkbox"
|
778
|
-
type="checkbox"
|
779
|
-
[disabled]="!row.data"
|
780
|
-
(change)="handleChange(row.data)"
|
781
|
-
[checked]="isSelected(row.data)"
|
782
|
-
/>
|
558
|
+
<input class="ax-checkbox" type="checkbox" [disabled]="!row.data" (change)="handleChange(row.data)" [checked]="isSelected(row.data)" />
|
783
559
|
</ng-template>`,
|
784
560
|
encapsulation: ViewEncapsulation.None,
|
785
561
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
@@ -796,61 +572,486 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
796
572
|
args: [TemplateRef]
|
797
573
|
}] } });
|
798
574
|
|
799
|
-
class
|
800
|
-
constructor(
|
801
|
-
|
802
|
-
this.
|
803
|
-
this.
|
804
|
-
this.
|
805
|
-
this.
|
806
|
-
this.
|
807
|
-
this.
|
808
|
-
this.
|
575
|
+
class AXDataTableComponent extends AXBaseDataTable {
|
576
|
+
constructor() {
|
577
|
+
super(...arguments);
|
578
|
+
this.onColumnsOrderChanged = new EventEmitter();
|
579
|
+
this.displayedRows = signal([]);
|
580
|
+
this.page = signal(0);
|
581
|
+
this.pageSize = signal(0);
|
582
|
+
this.columnsList = signal([]);
|
583
|
+
this.showHeader = true;
|
584
|
+
this.fixedHeader = true;
|
585
|
+
this.itemHeight = 40;
|
586
|
+
this.fetchDataMode = 'auto';
|
587
|
+
this.loading = {
|
588
|
+
enabled: true,
|
589
|
+
animation: true,
|
590
|
+
};
|
591
|
+
this.isLoading = signal(true);
|
592
|
+
this.hasItems = false;
|
593
|
+
this.totalRows = 0;
|
594
|
+
this.currentPage = 0;
|
595
|
+
this.totalPages = 0;
|
596
|
+
this.startRowIndex = 0;
|
597
|
+
this.lastIndex = 0;
|
598
|
+
this.focusedRowChange = new EventEmitter();
|
599
|
+
this.onRowClick = new EventEmitter();
|
600
|
+
this.onRowDbClick = new EventEmitter();
|
601
|
+
this.clickSubject = new Subject();
|
809
602
|
}
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
this.ngZone.runOutsideAngular(() => {
|
814
|
-
this.startX = event.pageX;
|
815
|
-
this.startWidth = this.el?.nativeElement?.parentElement.offsetWidth;
|
816
|
-
document.addEventListener('mousemove', this.onMouseMoveRawBound);
|
817
|
-
document.addEventListener('mouseup', this.onMouseUpBound);
|
818
|
-
});
|
819
|
-
this.cdr.detach(); // Detach the change detector
|
820
|
-
}
|
603
|
+
ngAfterViewInit() {
|
604
|
+
this.calculateStickyColumnsPositions();
|
605
|
+
this.columnsList.set(this.columns.toArray());
|
821
606
|
}
|
822
|
-
|
823
|
-
this.
|
607
|
+
drop(event) {
|
608
|
+
moveItemInArray(this.columnsList(), event.previousIndex, event.currentIndex);
|
609
|
+
this.onColumnsOrderChanged.emit({
|
610
|
+
component: this,
|
611
|
+
data: { event },
|
612
|
+
isUserInteraction: true,
|
613
|
+
});
|
824
614
|
}
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
615
|
+
ngOnInit() {
|
616
|
+
super.ngOnInit();
|
617
|
+
this.dataSource.useCache = false;
|
618
|
+
this.totalRows = this.dataSource.items.length;
|
619
|
+
this.dataSource.onLoadingChanged.subscribe((data) => {
|
620
|
+
this.isLoading.set(data);
|
621
|
+
});
|
622
|
+
this.dataSource.onChanged.subscribe((data) => {
|
623
|
+
this.displayedRows.set(data.items);
|
624
|
+
this.totalRows = data.totalCount;
|
625
|
+
this.hasItems = data.totalCount > 0;
|
626
|
+
});
|
627
|
+
//
|
628
|
+
this.clickSubject
|
629
|
+
.pipe(buffer(this.clickSubject.pipe(debounceTime(250))), filter((clickArray) => clickArray.length === 2))
|
630
|
+
.subscribe((clickArray) => {
|
631
|
+
this.handleRowDoubleClick(clickArray[0].event, clickArray[0].item);
|
632
|
+
});
|
633
|
+
}
|
634
|
+
get focusedRow() {
|
635
|
+
return this._focusedRow;
|
636
|
+
}
|
637
|
+
set focusedRow(v) {
|
638
|
+
this._focusedRow = v;
|
639
|
+
this.focusedRowChange.emit(v);
|
640
|
+
}
|
641
|
+
handleRowClick(event, item) {
|
642
|
+
this.handleRowSingleClick(event, item);
|
643
|
+
this.clickSubject.next({ event, item });
|
644
|
+
}
|
645
|
+
handleRowSingleClick(event, item) {
|
646
|
+
if (this.focusedRow == item) {
|
647
|
+
this.focusedRow = null;
|
830
648
|
}
|
649
|
+
else {
|
650
|
+
this.focusedRow = item;
|
651
|
+
}
|
652
|
+
//
|
653
|
+
this.onRowClick.emit({
|
654
|
+
component: this,
|
655
|
+
data: item,
|
656
|
+
isUserInteraction: true,
|
657
|
+
});
|
831
658
|
}
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
659
|
+
onPageChanged(event) {
|
660
|
+
if (event.page - 1 != this.page()) {
|
661
|
+
this.page.set(event.page - 1);
|
662
|
+
this.displayedRows.set(new Array(this.dataSource.pageSize));
|
663
|
+
this.dataSource.setPage(event.page - 1);
|
664
|
+
}
|
665
|
+
else if (event.take != this.pageSize()) {
|
666
|
+
this.pageSize.set(event.take);
|
667
|
+
this.displayedRows.set(new Array(this.dataSource.pageSize));
|
668
|
+
this.dataSource.setPageSize(event.take);
|
669
|
+
}
|
836
670
|
}
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
671
|
+
handleRowDoubleClick(e, item) {
|
672
|
+
this.focusedRow = item;
|
673
|
+
//
|
674
|
+
this.onRowDbClick.emit({
|
675
|
+
component: this,
|
676
|
+
data: item,
|
677
|
+
isUserInteraction: true,
|
678
|
+
});
|
679
|
+
}
|
680
|
+
handleColumnClick(e, column) {
|
681
|
+
if (column instanceof AXDataTableTextColumnComponent) {
|
682
|
+
const sort = this.dataSource.query.sort.find((c) => c.field == column.dataField);
|
683
|
+
if (!sort) {
|
684
|
+
this.dataSource.query.sort.push({
|
685
|
+
field: column.dataField,
|
686
|
+
dir: 'asc',
|
687
|
+
});
|
688
|
+
}
|
689
|
+
else {
|
690
|
+
if (sort.dir == 'asc') {
|
691
|
+
sort.dir = 'desc';
|
692
|
+
}
|
693
|
+
else {
|
694
|
+
this.dataSource.query.sort = this.dataSource.query.sort.filter((c) => c != sort);
|
695
|
+
}
|
696
|
+
}
|
697
|
+
this.refresh();
|
698
|
+
}
|
699
|
+
}
|
700
|
+
getSort(column) {
|
701
|
+
if (column instanceof AXDataTableTextColumnComponent) {
|
702
|
+
const sort = this.dataSource.query.sort.find((c) => c.field == column.dataField);
|
703
|
+
return sort ? (sort.dir == 'asc' ? 'ax-icon-arrow-long-down' : 'ax-icon-arrow-long-up') : undefined;
|
704
|
+
}
|
705
|
+
return undefined;
|
706
|
+
}
|
707
|
+
refresh() {
|
708
|
+
this.lastIndex = 0;
|
709
|
+
this.dataSource.refresh();
|
710
|
+
}
|
711
|
+
calculateStickyColumnsPositions() {
|
712
|
+
let totalWidth = 0;
|
713
|
+
let accumulatedWidthFromStart = 0;
|
714
|
+
console.log('columns: ', this.columns);
|
715
|
+
this.columns.forEach((column) => {
|
716
|
+
const width = parseInt(column.width);
|
717
|
+
if (!isNaN(width)) {
|
718
|
+
totalWidth += width;
|
719
|
+
}
|
720
|
+
});
|
721
|
+
let lastStartColumn;
|
722
|
+
this.columns.forEach((column) => {
|
723
|
+
const width = parseInt(column.width);
|
724
|
+
if (column.fixed === 'start' && !isNaN(width)) {
|
725
|
+
column['stickyStart'] = accumulatedWidthFromStart + 'px';
|
726
|
+
lastStartColumn = column;
|
727
|
+
}
|
728
|
+
if (!isNaN(width)) {
|
729
|
+
accumulatedWidthFromStart += width;
|
730
|
+
}
|
731
|
+
});
|
732
|
+
if (lastStartColumn)
|
733
|
+
lastStartColumn['isLastFixedColumn'] = true;
|
734
|
+
let accumulatedWidthFromEnd = 0;
|
735
|
+
let firstEndColumn;
|
736
|
+
for (let i = this.columns.length - 1; i >= 0; i--) {
|
737
|
+
const column = this.columns.get(i);
|
738
|
+
const width = parseInt(column.width);
|
739
|
+
if (column.fixed === 'end' && !isNaN(width)) {
|
740
|
+
column['stickyEnd'] = accumulatedWidthFromEnd + 'px';
|
741
|
+
firstEndColumn = column;
|
742
|
+
}
|
743
|
+
if (!isNaN(width)) {
|
744
|
+
accumulatedWidthFromEnd += width;
|
745
|
+
}
|
746
|
+
}
|
747
|
+
if (firstEndColumn)
|
748
|
+
firstEndColumn['isFirstFixedColumn'] = true;
|
749
|
+
}
|
750
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXDataTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
751
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.2", type: AXDataTableComponent, selector: "ax-data-table", inputs: { dataSource: "dataSource", rowTemplate: "rowTemplate", emptyTemplate: "emptyTemplate", showHeader: "showHeader", fixedHeader: "fixedHeader", itemHeight: "itemHeight", fetchDataMode: "fetchDataMode", loading: "loading", focusedRow: "focusedRow" }, outputs: { onColumnsOrderChanged: "onColumnsOrderChanged", focusedRowChange: "focusedRowChange", onRowClick: "onRowClick", onRowDbClick: "onRowDbClick" }, host: { attributes: { "ngSkipHydration": "true" } }, providers: [
|
752
|
+
{
|
753
|
+
provide: AXBaseDataTable,
|
754
|
+
useExisting: AXDataTableComponent,
|
755
|
+
},
|
756
|
+
], queries: [{ propertyName: "columns", predicate: AXDataTableColumnComponent }], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"ax-header\"> </ng-content>\n<div class=\"ax-data-table-wrapper\">\n <table>\n @if (showHeader) {\n <thead [ngClass]=\"{ 'ax-data-table-sticky-header': fixedHeader }\">\n <tr cdkDropList cdkScrollable cdkDropListOrientation=\"horizontal\" (cdkDropListDropped)=\"drop($event)\">\n @for (column of columnsList(); track $index) {\n <th\n cdkDrag\n [cdkDragDisabled]=\"column.fixed\"\n cdkDragLockAxis=\"x\"\n class=\"ax-data-table-head-cell\"\n [class.ax-interactive]=\"column.allowSorting\"\n (click)=\"column.allowSorting ? handleColumnClick($event, column) : null\"\n [class.ax-data-table-sticky-header-cell]=\"column.fixed && column.width\"\n [style.width]=\"column.width\"\n [class.sticky-end]=\"column.fixed === 'end'\"\n [class.sticky-start]=\"column.fixed === 'start'\"\n [class.isFirst]=\"column['isFirstFixedColumn']\"\n [class.isLast]=\"column['isLastFixedColumn']\"\n [style.--sticky-start]=\"column['stickyStart']\"\n [style.--sticky-end]=\"column['stickyEnd']\"\n >\n <div class=\"ax-caption\">\n {{ column.caption }}\n @if (getSort(column)) {\n <ax-icon icon=\"ax-icon {{ getSort(column) }}\"></ax-icon>\n }\n </div>\n </th>\n }\n <th></th>\n </tr>\n </thead>\n }\n <tbody>\n @for (row of displayedRows(); track $index) {\n @if (rowTemplate) {\n <ng-container *ngTemplateOutlet=\"rowTemplate; context: { $implicit: { data: row, rowIndex: $index } }\"> </ng-container>\n } @else {\n <tr\n [class.ax-state-focused]=\"focusedRow && row === focusedRow\"\n [attr.data-index]=\"$index\"\n [class.ax-state-selected]=\"selectedRows.includes(row)\"\n style.height=\"{{ itemHeight }}px\"\n (click)=\"handleRowClick($event, row)\"\n >\n @for (c of columnsList(); track $index) {\n @if (c.cellTemplate) {\n <ng-container *ngTemplateOutlet=\"c.cellTemplate; context: { $implicit: { data: row, rowIndex: $index } }\"> </ng-container>\n } @else {\n <td\n [style.width]=\"c.width\"\n [class.ax-data-table-sticky-body-cell]=\"c.fixed && c.width\"\n [class.sticky-end]=\"c.fixed === 'end'\"\n [class.sticky-start]=\"c.fixed === 'start'\"\n [class.isFirst]=\"c['isFirstFixedColumn']\"\n [class.isLast]=\"c['isLastFixedColumn']\"\n [style.--sticky-start]=\"c['stickyStart']\"\n [style.--sticky-end]=\"c['stickyEnd']\"\n [attr.data-label]=\"c.caption\"\n tabindex=\"0\"\n [class]=\"c.cssClass\"\n >\n @if (row && !isLoading()) {\n <ng-container *ngTemplateOutlet=\"c.template; context: { $implicit: { data: row, rowIndex: $index } }\"></ng-container>\n } @else {\n @if (c.loadingEnabled && loading) {\n <ax-skeleton [animated]=\"loading.animation\"></ax-skeleton>\n }\n }\n </td>\n }\n }\n <td></td>\n </tr>\n }\n }\n </tbody>\n </table>\n</div>\n\n<div class=\"ax-table-footer\" #footerContainer>\n <ax-data-pager\n class=\"ax-justify-center md:ax-justify-between\"\n [displayMode]=\"'custom'\"\n (onChanged)=\"onPageChanged($event)\"\n [total]=\"dataSource.totalCount\"\n [size]=\"dataSource.pageSize\"\n >\n <ax-prefix class=\"ax-hidden lg:ax-flex\">\n <ax-data-pager-numeric-selector> </ax-data-pager-numeric-selector>\n <ax-data-pager-page-sizes> </ax-data-pager-page-sizes>\n </ax-prefix>\n <ax-prefix class=\"ax-flex lg:ax-hidden\">\n <ax-data-pager-prev-buttons> </ax-data-pager-prev-buttons>\n <ax-data-pager-input-selector> </ax-data-pager-input-selector>\n <ax-data-pager-next-buttons> </ax-data-pager-next-buttons>\n </ax-prefix>\n <ax-suffix class=\"ax-hidden md:ax-block\">\n <ax-data-pager-info> </ax-data-pager-info>\n </ax-suffix>\n </ax-data-pager>\n <ng-content select=\"ax-footer\"> </ng-content>\n</div>\n", styles: [".ax-dark ax-data-table thead th.ax-interactive:hover{background-color:rgba(var(--ax-color-neutral-500))!important}.ax-dark ax-data-table tbody tr:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-data-table tbody tr.ax-state-focused td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-data-table tbody tr.ax-state-focused:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important}.ax-dark ax-data-table tbody tr.ax-state-selected td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-data-table tbody tr.ax-state-selected:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important}@media screen and (min-width: 768px){html[dir=rtl] ax-data-table .ax-data-table-wrapper table thead th.ax-data-table-sticky-header-cell.sticky-start{box-shadow:inset 1px 0 rgba(var(--ax-color-border-default))}html[dir=rtl] ax-data-table .ax-data-table-wrapper table thead th.ax-data-table-sticky-header-cell.sticky-start.isLast{box-shadow:inset 2px 0 rgba(var(--ax-color-border-default))}html[dir=rtl] ax-data-table .ax-data-table-wrapper table thead th.ax-data-table-sticky-header-cell.sticky-end{box-shadow:inset -1px 0 rgba(var(--ax-color-border-default))}html[dir=rtl] ax-data-table .ax-data-table-wrapper table thead th.ax-data-table-sticky-header-cell.sticky-end.isFirst{box-shadow:inset -2px 0 rgba(var(--ax-color-border-default))}}@media screen and (min-width: 768px){html[dir=rtl] ax-data-table .ax-data-table-wrapper table tbody td.ax-data-table-sticky-body-cell.sticky-start{box-shadow:inset 1px 0 rgba(var(--ax-color-border-default))}html[dir=rtl] ax-data-table .ax-data-table-wrapper table tbody td.ax-data-table-sticky-body-cell.sticky-start.isLast{box-shadow:inset 2px 0 rgba(var(--ax-color-border-default))}html[dir=rtl] ax-data-table .ax-data-table-wrapper table tbody td.ax-data-table-sticky-body-cell.sticky-end{box-shadow:inset -1px 0 rgba(var(--ax-color-border-default))}html[dir=rtl] ax-data-table .ax-data-table-wrapper table tbody td.ax-data-table-sticky-body-cell.sticky-end.isFirst{box-shadow:inset -2px 0 rgba(var(--ax-color-border-default))}}ax-data-table{display:flex;flex-direction:column;height:100%;width:100%;font-size:.875rem;line-height:1.25rem;border-radius:var(--ax-rounded-border-default);border-width:1px;border-color:rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper{overflow:auto;width:100%;flex:1;border-radius:var(--ax-rounded-border-default)}ax-data-table .ax-data-table-wrapper table{display:table;height:100%;width:100%;table-layout:fixed;overflow-x:auto}ax-data-table .ax-data-table-wrapper table thead{overflow:hidden;border-start-end-radius:var(--ax-rounded-border-default);border-start-start-radius:var(--ax-rounded-border-default)}ax-data-table .ax-data-table-wrapper table thead th{border-bottom-width:1px;border-inline-end-width:1px;border-style:solid;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-on-surface));padding-inline-start:1rem;padding-inline-end:1rem;padding-top:.75rem;padding-bottom:.75rem;text-align:start;font-weight:500;text-transform:uppercase;position:relative}ax-data-table .ax-data-table-wrapper table thead th.ax-interactive{cursor:pointer}ax-data-table .ax-data-table-wrapper table thead th.ax-interactive:hover{background-color:rgba(var(--ax-color-neutral-200))}ax-data-table .ax-data-table-wrapper table thead th .ax-resize-handle{position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;background:transparent}ax-data-table .ax-data-table-wrapper table thead th .ax-resize-handle:hover{background-color:rgba(var(--ax-color-neutral-300))}ax-data-table .ax-data-table-wrapper table thead th .ax-caption{display:flex;align-items:center;gap:.5rem}ax-data-table .ax-data-table-wrapper table thead th:last-child{border-inline-end-width:0px}ax-data-table .ax-data-table-wrapper table thead.ax-data-table-sticky-header{position:sticky;top:0;background-color:rgba(var(--ax-color-on-surface));border-top:none;border-bottom:none;z-index:3;box-shadow:1px 0 rgba(var(--ax-color-border-default)),0 -1px rgba(var(--ax-color-border-default))}@media screen and (min-width: 768px){ax-data-table .ax-data-table-wrapper table thead .ax-data-table-sticky-header-cell{position:sticky;z-index:2;border-inline-start:none;border-inline-end:none}ax-data-table .ax-data-table-wrapper table thead .ax-data-table-sticky-header-cell.sticky-start{box-shadow:inset -1px 0 rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper table thead .ax-data-table-sticky-header-cell.sticky-start.isLast{box-shadow:inset -2px 0 rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper table thead .ax-data-table-sticky-header-cell.sticky-end{box-shadow:inset 1px 0 rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper table thead .ax-data-table-sticky-header-cell.sticky-end.isFirst{box-shadow:inset 2px 0 rgba(var(--ax-color-border-default))}}@media screen and (min-width: 768px){ax-data-table .ax-data-table-wrapper table tbody tr .ax-data-table-sticky-body-cell{position:sticky;z-index:2;background-color:rgba(var(--ax-color-surface));border-inline-start:none;border-inline-end:none}ax-data-table .ax-data-table-wrapper table tbody tr .ax-data-table-sticky-body-cell.sticky-start{box-shadow:inset -1px 0 rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper table tbody tr .ax-data-table-sticky-body-cell.sticky-start.isLast{box-shadow:inset -2px 0 rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper table tbody tr .ax-data-table-sticky-body-cell.sticky-end{box-shadow:inset 1px 0 rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper table tbody tr .ax-data-table-sticky-body-cell.sticky-end.isFirst{box-shadow:inset 2px 0 rgba(var(--ax-color-border-default))}}ax-data-table .ax-data-table-wrapper table tbody tr:nth-child(2n) td{background-color:rgba(var(--ax-color-on-surface))}ax-data-table .ax-data-table-wrapper table tbody tr:nth-child(2n) ax-skeleton{width:25%}ax-data-table .ax-data-table-wrapper table tbody tr{height:2.5rem}ax-data-table .ax-data-table-wrapper table tbody tr:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200))}ax-data-table .ax-data-table-wrapper table tbody tr.ax-state-focused td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200));color:rgba(var(--ax-color-primary-fore-tint))}ax-data-table .ax-data-table-wrapper table tbody tr.ax-state-focused:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-300))}ax-data-table .ax-data-table-wrapper table tbody tr.ax-state-selected td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-300));color:rgba(var(--ax-color-primary-fore-tint))}ax-data-table .ax-data-table-wrapper table tbody tr.ax-state-selected:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-400));color:rgba(var(--ax-color-primary-fore))}ax-data-table .ax-data-table-wrapper table tbody td{position:relative;min-width:2rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-bottom-width:1px;border-inline-end-width:1px;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-surface));padding-inline-start:1rem;padding-inline-end:1rem;padding-top:.5rem;padding-bottom:.5rem;vertical-align:middle}ax-data-table .ax-data-table-wrapper table tbody td.ax-index-column{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:rgba(var(--ax-color-on-surface));text-align:center}ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button.ax-state-disabled{position:relative!important;cursor:not-allowed!important;opacity:.5!important}ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column>div{position:absolute;inset-inline-start:0px;top:50%;display:flex;width:100%;transform:translateY(-50%);align-items:center;justify-content:center}ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button{position:relative;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:var(--ax-rounded-border-default);border-style:none;border-color:rgba(var(--ax-color-border-default));background-color:transparent;padding:.25rem;line-height:1;color:rgba(var(--ax-color-ghost-fore))}ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button:hover:not(ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button:hover.ax-state-selected,ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button:hover.ax-state-disabled){opacity:.75}ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button:active{opacity:1}ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button .ax-ripple{background-color:rgba(var(--ax-color-ghost-fore),.05)}ax-data-table .ax-data-table-wrapper table tbody td:last-child{border-inline-end-width:0px}ax-data-table .ax-data-table-wrapper table tbody td ax-skeleton{height:.875rem;width:33.333333%;border-radius:.375rem}ax-data-table .ax-data-table-wrapper table .sticky-end{inset-inline-end:var(--sticky-end)}ax-data-table .ax-data-table-wrapper table .sticky-start{inset-inline-start:var(--sticky-start)}ax-data-table .ax-table-footer{border-top-width:1px;border-collapse:collapse;overflow:hidden;border-color:rgba(var(--ax-color-border-default));padding-inline-start:.875rem;padding-inline-end:.875rem;padding-top:.5rem;padding-bottom:.5rem}ax-data-table .ax-table-footer .ax-table-info{display:flex;flex:1 1 0%;align-items:center;justify-content:space-between}.ax-data-table-head-cell{border-bottom-width:1px;border-inline-end-width:1px;box-shadow:0 5px 5px -3px rgba(var(--ax-color-primary-900),.2),0 8px 10px 1px rgba(var(--ax-color-primary-900),.14),0 3px 14px 2px rgba(var(--ax-color-primary-900),.12);border-style:solid;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-on-surface));padding-inline-start:1rem;padding-inline-end:1rem;padding-top:.75rem;padding-bottom:.75rem;text-align:start;font-weight:500;text-transform:uppercase;position:relative}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$1.CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }, { kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i3.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title , ax-sub-title, ax-placeholder, ax-overlay" }, { kind: "component", type: i4$1.AXSkeletonComponent, selector: "ax-skeleton", inputs: ["animated"] }, { kind: "component", type: i5$1.AXDataPagerComponent, selector: "ax-data-pager", inputs: ["value", "name", "disabled", "readonly", "size", "total", "displayMode"], outputs: ["valueChange", "onValueChanged", "disabledChange", "readonlyChange", "displayModeChange", "onChanged"] }, { kind: "component", type: i5$1.AXDataPagerNextButtonsComponent, selector: "ax-data-pager-next-buttons" }, { kind: "component", type: i5$1.AXDataPagerPrevButtonsComponent, selector: "ax-data-pager-prev-buttons" }, { kind: "component", type: i5$1.AXDataPagerPageSizesComponent, selector: "ax-data-pager-page-sizes", inputs: ["sizes"] }, { kind: "component", type: i5$1.AXDataPagerNumericSelectorComponent, selector: "ax-data-pager-numeric-selector" }, { kind: "component", type: i5$1.AXDataPagerInputSelectorComponent, selector: "ax-data-pager-input-selector" }, { kind: "component", type: i5$1.AXDataPagerInfoComponent, selector: "ax-data-pager-info", inputs: ["text"] }, { kind: "directive", type: i6.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i6.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
757
|
+
}
|
758
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXDataTableComponent, decorators: [{
|
759
|
+
type: Component,
|
760
|
+
args: [{ selector: 'ax-data-table', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { ngSkipHydration: 'true' }, inputs: ['dataSource'], providers: [
|
761
|
+
{
|
762
|
+
provide: AXBaseDataTable,
|
763
|
+
useExisting: AXDataTableComponent,
|
764
|
+
},
|
765
|
+
], template: "<ng-content select=\"ax-header\"> </ng-content>\n<div class=\"ax-data-table-wrapper\">\n <table>\n @if (showHeader) {\n <thead [ngClass]=\"{ 'ax-data-table-sticky-header': fixedHeader }\">\n <tr cdkDropList cdkScrollable cdkDropListOrientation=\"horizontal\" (cdkDropListDropped)=\"drop($event)\">\n @for (column of columnsList(); track $index) {\n <th\n cdkDrag\n [cdkDragDisabled]=\"column.fixed\"\n cdkDragLockAxis=\"x\"\n class=\"ax-data-table-head-cell\"\n [class.ax-interactive]=\"column.allowSorting\"\n (click)=\"column.allowSorting ? handleColumnClick($event, column) : null\"\n [class.ax-data-table-sticky-header-cell]=\"column.fixed && column.width\"\n [style.width]=\"column.width\"\n [class.sticky-end]=\"column.fixed === 'end'\"\n [class.sticky-start]=\"column.fixed === 'start'\"\n [class.isFirst]=\"column['isFirstFixedColumn']\"\n [class.isLast]=\"column['isLastFixedColumn']\"\n [style.--sticky-start]=\"column['stickyStart']\"\n [style.--sticky-end]=\"column['stickyEnd']\"\n >\n <div class=\"ax-caption\">\n {{ column.caption }}\n @if (getSort(column)) {\n <ax-icon icon=\"ax-icon {{ getSort(column) }}\"></ax-icon>\n }\n </div>\n </th>\n }\n <th></th>\n </tr>\n </thead>\n }\n <tbody>\n @for (row of displayedRows(); track $index) {\n @if (rowTemplate) {\n <ng-container *ngTemplateOutlet=\"rowTemplate; context: { $implicit: { data: row, rowIndex: $index } }\"> </ng-container>\n } @else {\n <tr\n [class.ax-state-focused]=\"focusedRow && row === focusedRow\"\n [attr.data-index]=\"$index\"\n [class.ax-state-selected]=\"selectedRows.includes(row)\"\n style.height=\"{{ itemHeight }}px\"\n (click)=\"handleRowClick($event, row)\"\n >\n @for (c of columnsList(); track $index) {\n @if (c.cellTemplate) {\n <ng-container *ngTemplateOutlet=\"c.cellTemplate; context: { $implicit: { data: row, rowIndex: $index } }\"> </ng-container>\n } @else {\n <td\n [style.width]=\"c.width\"\n [class.ax-data-table-sticky-body-cell]=\"c.fixed && c.width\"\n [class.sticky-end]=\"c.fixed === 'end'\"\n [class.sticky-start]=\"c.fixed === 'start'\"\n [class.isFirst]=\"c['isFirstFixedColumn']\"\n [class.isLast]=\"c['isLastFixedColumn']\"\n [style.--sticky-start]=\"c['stickyStart']\"\n [style.--sticky-end]=\"c['stickyEnd']\"\n [attr.data-label]=\"c.caption\"\n tabindex=\"0\"\n [class]=\"c.cssClass\"\n >\n @if (row && !isLoading()) {\n <ng-container *ngTemplateOutlet=\"c.template; context: { $implicit: { data: row, rowIndex: $index } }\"></ng-container>\n } @else {\n @if (c.loadingEnabled && loading) {\n <ax-skeleton [animated]=\"loading.animation\"></ax-skeleton>\n }\n }\n </td>\n }\n }\n <td></td>\n </tr>\n }\n }\n </tbody>\n </table>\n</div>\n\n<div class=\"ax-table-footer\" #footerContainer>\n <ax-data-pager\n class=\"ax-justify-center md:ax-justify-between\"\n [displayMode]=\"'custom'\"\n (onChanged)=\"onPageChanged($event)\"\n [total]=\"dataSource.totalCount\"\n [size]=\"dataSource.pageSize\"\n >\n <ax-prefix class=\"ax-hidden lg:ax-flex\">\n <ax-data-pager-numeric-selector> </ax-data-pager-numeric-selector>\n <ax-data-pager-page-sizes> </ax-data-pager-page-sizes>\n </ax-prefix>\n <ax-prefix class=\"ax-flex lg:ax-hidden\">\n <ax-data-pager-prev-buttons> </ax-data-pager-prev-buttons>\n <ax-data-pager-input-selector> </ax-data-pager-input-selector>\n <ax-data-pager-next-buttons> </ax-data-pager-next-buttons>\n </ax-prefix>\n <ax-suffix class=\"ax-hidden md:ax-block\">\n <ax-data-pager-info> </ax-data-pager-info>\n </ax-suffix>\n </ax-data-pager>\n <ng-content select=\"ax-footer\"> </ng-content>\n</div>\n", styles: [".ax-dark ax-data-table thead th.ax-interactive:hover{background-color:rgba(var(--ax-color-neutral-500))!important}.ax-dark ax-data-table tbody tr:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-data-table tbody tr.ax-state-focused td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-data-table tbody tr.ax-state-focused:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important}.ax-dark ax-data-table tbody tr.ax-state-selected td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-data-table tbody tr.ax-state-selected:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important}@media screen and (min-width: 768px){html[dir=rtl] ax-data-table .ax-data-table-wrapper table thead th.ax-data-table-sticky-header-cell.sticky-start{box-shadow:inset 1px 0 rgba(var(--ax-color-border-default))}html[dir=rtl] ax-data-table .ax-data-table-wrapper table thead th.ax-data-table-sticky-header-cell.sticky-start.isLast{box-shadow:inset 2px 0 rgba(var(--ax-color-border-default))}html[dir=rtl] ax-data-table .ax-data-table-wrapper table thead th.ax-data-table-sticky-header-cell.sticky-end{box-shadow:inset -1px 0 rgba(var(--ax-color-border-default))}html[dir=rtl] ax-data-table .ax-data-table-wrapper table thead th.ax-data-table-sticky-header-cell.sticky-end.isFirst{box-shadow:inset -2px 0 rgba(var(--ax-color-border-default))}}@media screen and (min-width: 768px){html[dir=rtl] ax-data-table .ax-data-table-wrapper table tbody td.ax-data-table-sticky-body-cell.sticky-start{box-shadow:inset 1px 0 rgba(var(--ax-color-border-default))}html[dir=rtl] ax-data-table .ax-data-table-wrapper table tbody td.ax-data-table-sticky-body-cell.sticky-start.isLast{box-shadow:inset 2px 0 rgba(var(--ax-color-border-default))}html[dir=rtl] ax-data-table .ax-data-table-wrapper table tbody td.ax-data-table-sticky-body-cell.sticky-end{box-shadow:inset -1px 0 rgba(var(--ax-color-border-default))}html[dir=rtl] ax-data-table .ax-data-table-wrapper table tbody td.ax-data-table-sticky-body-cell.sticky-end.isFirst{box-shadow:inset -2px 0 rgba(var(--ax-color-border-default))}}ax-data-table{display:flex;flex-direction:column;height:100%;width:100%;font-size:.875rem;line-height:1.25rem;border-radius:var(--ax-rounded-border-default);border-width:1px;border-color:rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper{overflow:auto;width:100%;flex:1;border-radius:var(--ax-rounded-border-default)}ax-data-table .ax-data-table-wrapper table{display:table;height:100%;width:100%;table-layout:fixed;overflow-x:auto}ax-data-table .ax-data-table-wrapper table thead{overflow:hidden;border-start-end-radius:var(--ax-rounded-border-default);border-start-start-radius:var(--ax-rounded-border-default)}ax-data-table .ax-data-table-wrapper table thead th{border-bottom-width:1px;border-inline-end-width:1px;border-style:solid;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-on-surface));padding-inline-start:1rem;padding-inline-end:1rem;padding-top:.75rem;padding-bottom:.75rem;text-align:start;font-weight:500;text-transform:uppercase;position:relative}ax-data-table .ax-data-table-wrapper table thead th.ax-interactive{cursor:pointer}ax-data-table .ax-data-table-wrapper table thead th.ax-interactive:hover{background-color:rgba(var(--ax-color-neutral-200))}ax-data-table .ax-data-table-wrapper table thead th .ax-resize-handle{position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;background:transparent}ax-data-table .ax-data-table-wrapper table thead th .ax-resize-handle:hover{background-color:rgba(var(--ax-color-neutral-300))}ax-data-table .ax-data-table-wrapper table thead th .ax-caption{display:flex;align-items:center;gap:.5rem}ax-data-table .ax-data-table-wrapper table thead th:last-child{border-inline-end-width:0px}ax-data-table .ax-data-table-wrapper table thead.ax-data-table-sticky-header{position:sticky;top:0;background-color:rgba(var(--ax-color-on-surface));border-top:none;border-bottom:none;z-index:3;box-shadow:1px 0 rgba(var(--ax-color-border-default)),0 -1px rgba(var(--ax-color-border-default))}@media screen and (min-width: 768px){ax-data-table .ax-data-table-wrapper table thead .ax-data-table-sticky-header-cell{position:sticky;z-index:2;border-inline-start:none;border-inline-end:none}ax-data-table .ax-data-table-wrapper table thead .ax-data-table-sticky-header-cell.sticky-start{box-shadow:inset -1px 0 rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper table thead .ax-data-table-sticky-header-cell.sticky-start.isLast{box-shadow:inset -2px 0 rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper table thead .ax-data-table-sticky-header-cell.sticky-end{box-shadow:inset 1px 0 rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper table thead .ax-data-table-sticky-header-cell.sticky-end.isFirst{box-shadow:inset 2px 0 rgba(var(--ax-color-border-default))}}@media screen and (min-width: 768px){ax-data-table .ax-data-table-wrapper table tbody tr .ax-data-table-sticky-body-cell{position:sticky;z-index:2;background-color:rgba(var(--ax-color-surface));border-inline-start:none;border-inline-end:none}ax-data-table .ax-data-table-wrapper table tbody tr .ax-data-table-sticky-body-cell.sticky-start{box-shadow:inset -1px 0 rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper table tbody tr .ax-data-table-sticky-body-cell.sticky-start.isLast{box-shadow:inset -2px 0 rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper table tbody tr .ax-data-table-sticky-body-cell.sticky-end{box-shadow:inset 1px 0 rgba(var(--ax-color-border-default))}ax-data-table .ax-data-table-wrapper table tbody tr .ax-data-table-sticky-body-cell.sticky-end.isFirst{box-shadow:inset 2px 0 rgba(var(--ax-color-border-default))}}ax-data-table .ax-data-table-wrapper table tbody tr:nth-child(2n) td{background-color:rgba(var(--ax-color-on-surface))}ax-data-table .ax-data-table-wrapper table tbody tr:nth-child(2n) ax-skeleton{width:25%}ax-data-table .ax-data-table-wrapper table tbody tr{height:2.5rem}ax-data-table .ax-data-table-wrapper table tbody tr:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200))}ax-data-table .ax-data-table-wrapper table tbody tr.ax-state-focused td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200));color:rgba(var(--ax-color-primary-fore-tint))}ax-data-table .ax-data-table-wrapper table tbody tr.ax-state-focused:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-300))}ax-data-table .ax-data-table-wrapper table tbody tr.ax-state-selected td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-300));color:rgba(var(--ax-color-primary-fore-tint))}ax-data-table .ax-data-table-wrapper table tbody tr.ax-state-selected:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-400));color:rgba(var(--ax-color-primary-fore))}ax-data-table .ax-data-table-wrapper table tbody td{position:relative;min-width:2rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-bottom-width:1px;border-inline-end-width:1px;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-surface));padding-inline-start:1rem;padding-inline-end:1rem;padding-top:.5rem;padding-bottom:.5rem;vertical-align:middle}ax-data-table .ax-data-table-wrapper table tbody td.ax-index-column{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:rgba(var(--ax-color-on-surface));text-align:center}ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button.ax-state-disabled{position:relative!important;cursor:not-allowed!important;opacity:.5!important}ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column>div{position:absolute;inset-inline-start:0px;top:50%;display:flex;width:100%;transform:translateY(-50%);align-items:center;justify-content:center}ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button{position:relative;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:var(--ax-rounded-border-default);border-style:none;border-color:rgba(var(--ax-color-border-default));background-color:transparent;padding:.25rem;line-height:1;color:rgba(var(--ax-color-ghost-fore))}ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button:hover:not(ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button:hover.ax-state-selected,ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button:hover.ax-state-disabled){opacity:.75}ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button:active{opacity:1}ax-data-table .ax-data-table-wrapper table tbody td.ax-command-column button .ax-ripple{background-color:rgba(var(--ax-color-ghost-fore),.05)}ax-data-table .ax-data-table-wrapper table tbody td:last-child{border-inline-end-width:0px}ax-data-table .ax-data-table-wrapper table tbody td ax-skeleton{height:.875rem;width:33.333333%;border-radius:.375rem}ax-data-table .ax-data-table-wrapper table .sticky-end{inset-inline-end:var(--sticky-end)}ax-data-table .ax-data-table-wrapper table .sticky-start{inset-inline-start:var(--sticky-start)}ax-data-table .ax-table-footer{border-top-width:1px;border-collapse:collapse;overflow:hidden;border-color:rgba(var(--ax-color-border-default));padding-inline-start:.875rem;padding-inline-end:.875rem;padding-top:.5rem;padding-bottom:.5rem}ax-data-table .ax-table-footer .ax-table-info{display:flex;flex:1 1 0%;align-items:center;justify-content:space-between}.ax-data-table-head-cell{border-bottom-width:1px;border-inline-end-width:1px;box-shadow:0 5px 5px -3px rgba(var(--ax-color-primary-900),.2),0 8px 10px 1px rgba(var(--ax-color-primary-900),.14),0 3px 14px 2px rgba(var(--ax-color-primary-900),.12);border-style:solid;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-on-surface));padding-inline-start:1rem;padding-inline-end:1rem;padding-top:.75rem;padding-bottom:.75rem;text-align:start;font-weight:500;text-transform:uppercase;position:relative}\n"] }]
|
766
|
+
}], propDecorators: { onColumnsOrderChanged: [{
|
767
|
+
type: Output
|
768
|
+
}], columns: [{
|
769
|
+
type: ContentChildren,
|
770
|
+
args: [AXDataTableColumnComponent]
|
771
|
+
}], rowTemplate: [{
|
772
|
+
type: Input
|
773
|
+
}], emptyTemplate: [{
|
774
|
+
type: Input
|
775
|
+
}], showHeader: [{
|
776
|
+
type: Input
|
777
|
+
}], fixedHeader: [{
|
778
|
+
type: Input
|
779
|
+
}], itemHeight: [{
|
780
|
+
type: Input
|
781
|
+
}], fetchDataMode: [{
|
782
|
+
type: Input
|
783
|
+
}], loading: [{
|
784
|
+
type: Input
|
785
|
+
}], focusedRow: [{
|
786
|
+
type: Input
|
787
|
+
}], focusedRowChange: [{
|
788
|
+
type: Output
|
789
|
+
}], onRowClick: [{
|
790
|
+
type: Output
|
791
|
+
}], onRowDbClick: [{
|
792
|
+
type: Output
|
793
|
+
}] } });
|
794
|
+
|
795
|
+
class AXInfiniteScrollDataTableComponent extends AXBaseDataTable {
|
796
|
+
constructor() {
|
797
|
+
super(...arguments);
|
798
|
+
this.ngZone = inject(NgZone);
|
799
|
+
this.onPageChanged = new EventEmitter();
|
800
|
+
this.clickSubject = new Subject();
|
801
|
+
this.onRowClick = new EventEmitter();
|
802
|
+
this.onRowDbClick = new EventEmitter();
|
803
|
+
this.showHeader = true;
|
804
|
+
this.fetchDataMode = 'auto';
|
805
|
+
this.loading = {
|
806
|
+
enabled: true,
|
807
|
+
animation: true,
|
808
|
+
};
|
809
|
+
this.isLoading = signal(true);
|
810
|
+
this.hasItems = false;
|
811
|
+
this.totalRows = 0;
|
812
|
+
this.currentPage = 0;
|
813
|
+
this.totalPages = 0;
|
814
|
+
this.startRowIndex = 0;
|
815
|
+
this.lastIndex = 0;
|
816
|
+
this.focusedRowChange = new EventEmitter();
|
817
|
+
this.itemHeight = 40;
|
818
|
+
this.width = '100%';
|
819
|
+
this.height = '100%';
|
820
|
+
this.onScrolledIndexChanged = new EventEmitter();
|
821
|
+
}
|
822
|
+
startFixedColumn() {
|
823
|
+
return this.columns?.toArray().filter((c) => c.fixed == 'start') ?? [];
|
824
|
+
}
|
825
|
+
endFixedColumn() {
|
826
|
+
return this.columns?.toArray().filter((c) => c.fixed == 'end') ?? [];
|
827
|
+
}
|
828
|
+
notFixedColumn() {
|
829
|
+
return this.columns?.toArray().filter((c) => !c.fixed) ?? [];
|
830
|
+
}
|
831
|
+
notFixedColumnCount() {
|
832
|
+
return this.columns?.toArray().filter((c) => !c.fixed).length ?? 0;
|
833
|
+
}
|
834
|
+
fixedColumnCount() {
|
835
|
+
return this.columns?.toArray().filter((c) => c.fixed).length ?? 0;
|
836
|
+
}
|
837
|
+
get focusedRow() {
|
838
|
+
return this._focusedRow;
|
839
|
+
}
|
840
|
+
set focusedRow(v) {
|
841
|
+
this._focusedRow = v;
|
842
|
+
this.focusedRowChange.emit(v);
|
843
|
+
}
|
844
|
+
trackByIdx(i) {
|
845
|
+
return i;
|
846
|
+
}
|
847
|
+
ngOnInit() {
|
848
|
+
super.ngOnInit();
|
849
|
+
this.listDataSource = new AXListDataSource({
|
850
|
+
source: this.dataSource,
|
851
|
+
});
|
852
|
+
this.listDataSource.source.onLoadingChanged.subscribe((data) => {
|
853
|
+
this.isLoading.set(data);
|
854
|
+
});
|
855
|
+
this.listDataSource.source.onChanged.subscribe((data) => {
|
856
|
+
this.totalRows = data.totalCount;
|
857
|
+
this.hasItems = data.totalCount > 0;
|
858
|
+
setTimeout(() => {
|
859
|
+
this.render();
|
860
|
+
}, 100);
|
861
|
+
});
|
862
|
+
//
|
863
|
+
this.clickSubject
|
864
|
+
.pipe(buffer(this.clickSubject.pipe(debounceTime(250))), filter((clickArray) => clickArray.length === 2))
|
865
|
+
.subscribe((clickArray) => {
|
866
|
+
this.handleRowDoubleClick(clickArray[0].event, clickArray[0].item);
|
867
|
+
});
|
868
|
+
}
|
869
|
+
_handleOnscrolledIndexChange(e) {
|
870
|
+
this.lastIndex = e;
|
871
|
+
this.onScrolledIndexChanged.emit({
|
872
|
+
component: this,
|
873
|
+
index: this.lastIndex,
|
874
|
+
isUserInteraction: true,
|
875
|
+
});
|
876
|
+
}
|
877
|
+
ngDoCheck() {
|
878
|
+
//this.copyFixedColumns();
|
879
|
+
this.updateHScroll();
|
880
|
+
//
|
881
|
+
this.updateWidth();
|
882
|
+
this.updateHeight();
|
883
|
+
//
|
884
|
+
this.updateTotalCount();
|
885
|
+
}
|
886
|
+
updateTotalCount() {
|
887
|
+
this.startRowIndex = this.lastIndex;
|
888
|
+
if (this.startRowIndex < 1)
|
889
|
+
this.startRowIndex = 1;
|
890
|
+
if (this.startRowIndex > this.totalRows)
|
891
|
+
this.startRowIndex = this.totalRows;
|
892
|
+
}
|
893
|
+
updateHeight() {
|
894
|
+
this.height = `calc(100% - ${(this.headerContainer?.nativeElement.clientHeight ?? 0) + (this.footerContainer?.nativeElement.clientHeight ?? 0)}px)`;
|
895
|
+
}
|
896
|
+
updateWidth() {
|
897
|
+
if (this.columns && this.columns.length) {
|
898
|
+
const sumPx = sum(this.columns.toArray().map((c) => (typeof c.width == 'number' ? c.width : Number(c.width.replace('px', '')))));
|
899
|
+
this.width = `${Math.max(sumPx, this.getHostElement().clientWidth - 5)}px`;
|
900
|
+
}
|
901
|
+
}
|
902
|
+
updateHScroll() {
|
903
|
+
this.ngZone.runOutsideAngular(() => {
|
904
|
+
if (this.headerContainer) {
|
905
|
+
const headerContainer = this.headerContainer.nativeElement;
|
906
|
+
const left = this.scrollableContainer.nativeElement.scrollLeft;
|
907
|
+
headerContainer.style.transform = `translateX(${-left}px)`;
|
908
|
+
}
|
909
|
+
});
|
910
|
+
}
|
911
|
+
// Function to copy fixed columns
|
912
|
+
copyFixedColumns() {
|
913
|
+
const originalRows = Array.from(this.viewport._contentWrapper.nativeElement.querySelectorAll('tr'));
|
914
|
+
const fixedColumnTable = this.getHostElement().querySelector('.ax-body-fixed-columns > table > tbody');
|
915
|
+
fixedColumnTable.querySelectorAll('tr').forEach((n) => n.remove());
|
916
|
+
for (const row of originalRows) {
|
917
|
+
const fixedCells = Array.from(row.querySelectorAll('[data-fixed="start"]'));
|
918
|
+
const fixedRow = document.createElement('tr');
|
919
|
+
for (const cell of fixedCells) {
|
920
|
+
const clonedCell = cell.cloneNode(true);
|
921
|
+
fixedRow.appendChild(clonedCell);
|
922
|
+
}
|
923
|
+
fixedColumnTable.appendChild(fixedRow);
|
924
|
+
}
|
925
|
+
const scrollTop = this.getHostElement().querySelector('.cdk-virtual-scrollable').scrollTop;
|
926
|
+
fixedColumnTable.style.transform = `translateY(${-scrollTop}px)`;
|
927
|
+
}
|
928
|
+
render() {
|
929
|
+
this.viewport.checkViewportSize();
|
930
|
+
this.viewport.scrollToIndex(this.lastIndex);
|
931
|
+
this.cdr.markForCheck();
|
932
|
+
}
|
933
|
+
refresh() {
|
934
|
+
this.lastIndex = 0;
|
935
|
+
this.listDataSource.refresh();
|
936
|
+
}
|
937
|
+
handleRowClick(event, item) {
|
938
|
+
this.handleRowSingleClick(event, item);
|
939
|
+
this.clickSubject.next({ event, item });
|
940
|
+
}
|
941
|
+
handleRowSingleClick(event, item) {
|
942
|
+
if (this.focusedRow == item) {
|
943
|
+
this.focusedRow = null;
|
944
|
+
}
|
945
|
+
else {
|
946
|
+
this.focusedRow = item;
|
947
|
+
}
|
948
|
+
//
|
949
|
+
this.onRowClick.emit({
|
950
|
+
component: this,
|
951
|
+
data: item,
|
952
|
+
isUserInteraction: true,
|
953
|
+
});
|
954
|
+
}
|
955
|
+
handleRowDoubleClick(e, item) {
|
956
|
+
this.focusedRow = item;
|
957
|
+
//
|
958
|
+
this.onRowDbClick.emit({
|
959
|
+
component: this,
|
960
|
+
data: item,
|
961
|
+
isUserInteraction: true,
|
962
|
+
});
|
963
|
+
}
|
964
|
+
handleColumnClick(e, column) {
|
965
|
+
if (column instanceof AXDataTableTextColumnComponent) {
|
966
|
+
const sort = this.dataSource.query.sort.find((c) => c.field == column.dataField);
|
967
|
+
if (!sort) {
|
968
|
+
this.dataSource.query.sort.push({
|
969
|
+
field: column.dataField,
|
970
|
+
dir: 'asc',
|
971
|
+
});
|
972
|
+
}
|
973
|
+
else {
|
974
|
+
if (sort.dir == 'asc') {
|
975
|
+
sort.dir = 'desc';
|
976
|
+
}
|
977
|
+
else {
|
978
|
+
this.dataSource.query.sort = this.dataSource.query.sort.filter((c) => c != sort);
|
979
|
+
}
|
980
|
+
}
|
981
|
+
this.refresh();
|
982
|
+
}
|
983
|
+
}
|
984
|
+
getSort(column) {
|
985
|
+
if (column instanceof AXDataTableTextColumnComponent) {
|
986
|
+
const sort = this.dataSource.query.sort.find((c) => c.field == column.dataField);
|
987
|
+
return sort ? (sort.dir == 'asc' ? 'ax-icon-arrow-long-down' : 'ax-icon-arrow-long-up') : undefined;
|
988
|
+
}
|
989
|
+
return undefined;
|
990
|
+
}
|
991
|
+
_handleOnScroll() {
|
992
|
+
this.updateHScroll();
|
993
|
+
}
|
994
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXInfiniteScrollDataTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
995
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.2", type: AXInfiniteScrollDataTableComponent, selector: "ax-infinite-scroll-data-table", inputs: { dataSource: "dataSource", rowTemplate: "rowTemplate", emptyTemplate: "emptyTemplate", showHeader: "showHeader", fetchDataMode: "fetchDataMode", loading: "loading", focusedRow: "focusedRow", itemHeight: "itemHeight" }, outputs: { onPageChanged: "onPageChanged", onRowClick: "onRowClick", onRowDbClick: "onRowDbClick", focusedRowChange: "focusedRowChange", onScrolledIndexChanged: "onScrolledIndexChanged" }, providers: [
|
996
|
+
{ provide: AXPagedComponent, useExisting: AXInfiniteScrollDataTableComponent },
|
997
|
+
{
|
998
|
+
provide: AXBaseDataTable,
|
999
|
+
useExisting: AXInfiniteScrollDataTableComponent,
|
1000
|
+
},
|
1001
|
+
], queries: [{ propertyName: "columns", predicate: AXDataTableColumnComponent }], viewQueries: [{ propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, static: true }, { propertyName: "headerContainer", first: true, predicate: ["headerContainer"], descendants: true }, { propertyName: "footerContainer", first: true, predicate: ["footerContainer"], descendants: true }, { propertyName: "scrollableContainer", first: true, predicate: ["scrolling"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"ax-header\"> </ng-content>\n<!------------------- Header contents ------------------->\n@if (showHeader) {\n <div class=\"ax-header-content\">\n <div class=\"ax-header-columns\">\n <table tabindex=\"0\" [style.width]=\"width\" #headerContainer>\n <thead>\n <tr>\n @for (c of notFixedColumn(); track c.name) {\n <th\n [class.ax-interactive]=\"c.allowSorting\"\n (click)=\"c.allowSorting ? handleColumnClick($event, c) : null\"\n [style.width]=\"c.width\"\n >\n @if (c.headerTemplate) {\n <ng-container *ngTemplateOutlet=\"c.headerTemplate\"></ng-container>\n } @else {\n <div class=\"ax-caption\">\n {{ c.caption }}\n @if (getSort(c)) {\n <ax-icon icon=\"ax-icon {{ getSort(c) }}\"></ax-icon>\n }\n </div>\n }\n <!-- @if(c.allowResizing)\n {\n <div class=\"ax-resize-handle\" [ax-table-column-resizble]=\"c\"></div>\n } -->\n </th>\n }\n <th></th>\n </tr>\n </thead>\n </table>\n </div>\n </div>\n}\n\n<!------------------- Body contents ------------------->\n<div [style.height]=\"height\" class=\"ax-body-content\">\n <div class=\"ax-body-columns\">\n <div cdkVirtualScrollingElement #scrolling [style.height]=\"'100%'\" (scroll)=\"_handleOnScroll()\">\n <cdk-virtual-scroll-viewport\n [itemSize]=\"itemHeight\"\n [style.--item-height]=\"itemHeight + 'px'\"\n (scrolledIndexChange)=\"_handleOnscrolledIndexChange($event)\"\n >\n <table tabindex=\"0\" class=\"ax-table-body ax-relative\" [style.width]=\"width\">\n <colgroup>\n @for (c of notFixedColumn(); track c.name) {\n <col [style.width]=\"c.width\" />\n }\n <col />\n </colgroup>\n <tbody>\n <ng-container\n *cdkVirtualFor=\"let item of listDataSource; templateCacheSize: 100; let i = index; trackBy: trackByIdx; let rIndex = index\"\n >\n <!------------------- custom row template------------------->\n @if (rowTemplate != null) {\n <ng-container *ngTemplateOutlet=\"rowTemplate; context: { $implicit: { data: item, rowIndex: rIndex } }\"> </ng-container>\n } @else {\n <!------------------- normal row template------------------->\n <tr\n [class.ax-state-focused]=\"focusedRow && item === focusedRow\"\n [attr.data-index]=\"rIndex\"\n [class.ax-state-selected]=\"selectedRows.includes(item)\"\n (click)=\"handleRowClick($event, item)\"\n >\n <!------------------- start fixed column ------------------->\n\n <!------------------- Not fixed column ------------------->\n @for (c of notFixedColumn(); track c.name) {\n <!------------------- custom cell template ------------------->\n @if (c.cellTemplate) {\n <ng-container *ngTemplateOutlet=\"c.cellTemplate; context: { $implicit: { data: item, rowIndex: rIndex } }\">\n </ng-container>\n } @else {\n <!------------------- default cell template ------------------->\n <td [attr.data-label]=\"c.caption\" tabindex=\"0\" [class]=\"c.cssClass\">\n @if (item && !isLoading()) {\n <!------------------- render cell ------------------->\n <ng-container\n *ngTemplateOutlet=\"c.template; context: { $implicit: { data: item, rowIndex: rIndex } }\"\n ></ng-container>\n } @else {\n <!------------------- render loading ------------------->\n @if (c.loadingEnabled && loading) {\n <ax-skeleton [animated]=\"loading.animation\"></ax-skeleton>\n }\n }\n </td>\n }\n }\n <td></td>\n </tr>\n }\n </ng-container>\n </tbody>\n </table>\n </cdk-virtual-scroll-viewport>\n </div>\n </div>\n</div>\n<div class=\"ax-table-footer\" #footerContainer>\n <div class=\"ax-table-info\">\n <div>Showing {{ startRowIndex }} of {{ totalRows }} items</div>\n <ax-button look=\"blank\" class=\"ax-sm\" (onClick)=\"refresh()\">\n <ax-icon icon=\"ax-icon ax-icon-refresh\"></ax-icon>\n </ax-button>\n </div>\n <ng-content select=\"ax-footer\"> </ng-content>\n</div>\n", styles: [".ax-dark ax-infinite-scroll-data-table .ax-header-content th.ax-interactive:hover{background-color:rgba(var(--ax-color-neutral-500))!important}.ax-dark ax-infinite-scroll-data-table .ax-body-content tr:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-infinite-scroll-data-table .ax-body-content tr.ax-state-focused td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-infinite-scroll-data-table .ax-body-content tr.ax-state-focused:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important}.ax-dark ax-infinite-scroll-data-table .ax-body-content tr.ax-state-selected td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-infinite-scroll-data-table .ax-body-content tr.ax-state-selected:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important}ax-infinite-scroll-data-table{display:block;height:100%;overflow:hidden;border-radius:var(--ax-rounded-border-default);border-width:1px;border-color:rgba(var(--ax-color-border-default));font-size:.875rem;line-height:1.25rem}ax-infinite-scroll-data-table table{table-layout:fixed}ax-infinite-scroll-data-table .ax-header-content{position:relative;height:3rem;overflow:hidden}ax-infinite-scroll-data-table .ax-header-content .ax-header-fixed-columns{pointer-events:none;position:absolute;z-index:10}ax-infinite-scroll-data-table .ax-header-content .ax-header-fixed-columns th.ax-column-fixed{pointer-events:auto}ax-infinite-scroll-data-table .ax-header-content .ax-header-fixed-columns th:not(.ax-column-fixed){visibility:hidden;background-color:transparent}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns{height:100%}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table{height:100%;overflow:hidden;border-start-end-radius:var(--ax-rounded-border-default);border-start-start-radius:var(--ax-rounded-border-default)}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th{border-bottom-width:1px;border-inline-end-width:1px;border-style:solid;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-on-surface));padding:.75rem 1rem;text-align:start;font-weight:500;text-transform:uppercase;position:relative}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th.ax-interactive{cursor:pointer}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th.ax-interactive:hover{background-color:rgba(var(--ax-color-neutral-200))}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th .ax-resize-handle{position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;background:transparent}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th .ax-resize-handle:hover{background-color:rgba(var(--ax-color-neutral-300))}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th .ax-caption{display:flex;align-items:center;gap:.5rem}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th:last-child{border-inline-end-width:0px}ax-infinite-scroll-data-table .ax-body-content{position:relative}ax-infinite-scroll-data-table .ax-body-content .ax-body-fixed-columns{pointer-events:none;position:absolute;z-index:10}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns{height:100%}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table{border-collapse:collapse}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr:nth-child(2n) td{background-color:rgba(var(--ax-color-on-surface))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr:nth-child(2n) ax-skeleton{width:25%}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr{height:2.5rem}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr.ax-state-focused td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200));color:rgba(var(--ax-color-primary-fore-tint))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr.ax-state-focused:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-300))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr.ax-state-selected td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-300));color:rgba(var(--ax-color-primary-fore-tint))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr.ax-state-selected:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-400));color:rgba(var(--ax-color-primary-fore))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td{position:relative;min-width:2rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-bottom-width:1px;border-inline-end-width:1px;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-surface));padding:.5rem 1rem;vertical-align:middle}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-index-column{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:rgba(var(--ax-color-on-surface));text-align:center}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button.ax-state-disabled{position:relative!important;cursor:not-allowed!important;opacity:.5!important}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column>div{position:absolute;inset-inline-start:0px;top:50%;display:flex;width:100%;transform:translateY(-50%);align-items:center;justify-content:center}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button{position:relative;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:var(--ax-rounded-border-default);border-style:none;border-color:rgba(var(--ax-color-border-default));background-color:transparent;padding:.25rem;line-height:1;color:rgba(var(--ax-color-ghost-fore))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:hover:not(ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:hover.ax-state-selected,ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:hover.ax-state-disabled){opacity:.75}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:active{opacity:1}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button .ax-ripple{background-color:rgba(var(--ax-color-ghost-fore),.05)}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td:last-child{border-inline-end-width:0px}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td ax-skeleton{height:.875rem;width:33.333333%;border-radius:.375rem}ax-infinite-scroll-data-table .ax-table-footer{border-collapse:collapse;overflow:hidden;border-top-width:1px;border-color:rgba(var(--ax-color-border-default));padding:.5rem .875rem}ax-infinite-scroll-data-table .ax-table-footer .ax-table-info{display:flex;flex:1 1 0%;align-items:center;justify-content:space-between}\n"], dependencies: [{ kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$1.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i2$1.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i2$1.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: i2$1.CdkVirtualScrollableElement, selector: "[cdkVirtualScrollingElement]" }, { kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i4$1.AXSkeletonComponent, selector: "ax-skeleton", inputs: ["animated"] }, { kind: "component", type: i3$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
1002
|
+
}
|
1003
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXInfiniteScrollDataTableComponent, decorators: [{
|
1004
|
+
type: Component,
|
1005
|
+
args: [{ selector: 'ax-infinite-scroll-data-table', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
1006
|
+
{ provide: AXPagedComponent, useExisting: AXInfiniteScrollDataTableComponent },
|
1007
|
+
{
|
1008
|
+
provide: AXBaseDataTable,
|
1009
|
+
useExisting: AXInfiniteScrollDataTableComponent,
|
1010
|
+
},
|
1011
|
+
], inputs: ['dataSource'], template: "<ng-content select=\"ax-header\"> </ng-content>\n<!------------------- Header contents ------------------->\n@if (showHeader) {\n <div class=\"ax-header-content\">\n <div class=\"ax-header-columns\">\n <table tabindex=\"0\" [style.width]=\"width\" #headerContainer>\n <thead>\n <tr>\n @for (c of notFixedColumn(); track c.name) {\n <th\n [class.ax-interactive]=\"c.allowSorting\"\n (click)=\"c.allowSorting ? handleColumnClick($event, c) : null\"\n [style.width]=\"c.width\"\n >\n @if (c.headerTemplate) {\n <ng-container *ngTemplateOutlet=\"c.headerTemplate\"></ng-container>\n } @else {\n <div class=\"ax-caption\">\n {{ c.caption }}\n @if (getSort(c)) {\n <ax-icon icon=\"ax-icon {{ getSort(c) }}\"></ax-icon>\n }\n </div>\n }\n <!-- @if(c.allowResizing)\n {\n <div class=\"ax-resize-handle\" [ax-table-column-resizble]=\"c\"></div>\n } -->\n </th>\n }\n <th></th>\n </tr>\n </thead>\n </table>\n </div>\n </div>\n}\n\n<!------------------- Body contents ------------------->\n<div [style.height]=\"height\" class=\"ax-body-content\">\n <div class=\"ax-body-columns\">\n <div cdkVirtualScrollingElement #scrolling [style.height]=\"'100%'\" (scroll)=\"_handleOnScroll()\">\n <cdk-virtual-scroll-viewport\n [itemSize]=\"itemHeight\"\n [style.--item-height]=\"itemHeight + 'px'\"\n (scrolledIndexChange)=\"_handleOnscrolledIndexChange($event)\"\n >\n <table tabindex=\"0\" class=\"ax-table-body ax-relative\" [style.width]=\"width\">\n <colgroup>\n @for (c of notFixedColumn(); track c.name) {\n <col [style.width]=\"c.width\" />\n }\n <col />\n </colgroup>\n <tbody>\n <ng-container\n *cdkVirtualFor=\"let item of listDataSource; templateCacheSize: 100; let i = index; trackBy: trackByIdx; let rIndex = index\"\n >\n <!------------------- custom row template------------------->\n @if (rowTemplate != null) {\n <ng-container *ngTemplateOutlet=\"rowTemplate; context: { $implicit: { data: item, rowIndex: rIndex } }\"> </ng-container>\n } @else {\n <!------------------- normal row template------------------->\n <tr\n [class.ax-state-focused]=\"focusedRow && item === focusedRow\"\n [attr.data-index]=\"rIndex\"\n [class.ax-state-selected]=\"selectedRows.includes(item)\"\n (click)=\"handleRowClick($event, item)\"\n >\n <!------------------- start fixed column ------------------->\n\n <!------------------- Not fixed column ------------------->\n @for (c of notFixedColumn(); track c.name) {\n <!------------------- custom cell template ------------------->\n @if (c.cellTemplate) {\n <ng-container *ngTemplateOutlet=\"c.cellTemplate; context: { $implicit: { data: item, rowIndex: rIndex } }\">\n </ng-container>\n } @else {\n <!------------------- default cell template ------------------->\n <td [attr.data-label]=\"c.caption\" tabindex=\"0\" [class]=\"c.cssClass\">\n @if (item && !isLoading()) {\n <!------------------- render cell ------------------->\n <ng-container\n *ngTemplateOutlet=\"c.template; context: { $implicit: { data: item, rowIndex: rIndex } }\"\n ></ng-container>\n } @else {\n <!------------------- render loading ------------------->\n @if (c.loadingEnabled && loading) {\n <ax-skeleton [animated]=\"loading.animation\"></ax-skeleton>\n }\n }\n </td>\n }\n }\n <td></td>\n </tr>\n }\n </ng-container>\n </tbody>\n </table>\n </cdk-virtual-scroll-viewport>\n </div>\n </div>\n</div>\n<div class=\"ax-table-footer\" #footerContainer>\n <div class=\"ax-table-info\">\n <div>Showing {{ startRowIndex }} of {{ totalRows }} items</div>\n <ax-button look=\"blank\" class=\"ax-sm\" (onClick)=\"refresh()\">\n <ax-icon icon=\"ax-icon ax-icon-refresh\"></ax-icon>\n </ax-button>\n </div>\n <ng-content select=\"ax-footer\"> </ng-content>\n</div>\n", styles: [".ax-dark ax-infinite-scroll-data-table .ax-header-content th.ax-interactive:hover{background-color:rgba(var(--ax-color-neutral-500))!important}.ax-dark ax-infinite-scroll-data-table .ax-body-content tr:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-infinite-scroll-data-table .ax-body-content tr.ax-state-focused td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-infinite-scroll-data-table .ax-body-content tr.ax-state-focused:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important}.ax-dark ax-infinite-scroll-data-table .ax-body-content tr.ax-state-selected td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900))!important;color:rgba(var(--ax-color-primary-fore))!important}.ax-dark ax-infinite-scroll-data-table .ax-body-content tr.ax-state-selected:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-800))!important}ax-infinite-scroll-data-table{display:block;height:100%;overflow:hidden;border-radius:var(--ax-rounded-border-default);border-width:1px;border-color:rgba(var(--ax-color-border-default));font-size:.875rem;line-height:1.25rem}ax-infinite-scroll-data-table table{table-layout:fixed}ax-infinite-scroll-data-table .ax-header-content{position:relative;height:3rem;overflow:hidden}ax-infinite-scroll-data-table .ax-header-content .ax-header-fixed-columns{pointer-events:none;position:absolute;z-index:10}ax-infinite-scroll-data-table .ax-header-content .ax-header-fixed-columns th.ax-column-fixed{pointer-events:auto}ax-infinite-scroll-data-table .ax-header-content .ax-header-fixed-columns th:not(.ax-column-fixed){visibility:hidden;background-color:transparent}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns{height:100%}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table{height:100%;overflow:hidden;border-start-end-radius:var(--ax-rounded-border-default);border-start-start-radius:var(--ax-rounded-border-default)}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th{border-bottom-width:1px;border-inline-end-width:1px;border-style:solid;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-on-surface));padding:.75rem 1rem;text-align:start;font-weight:500;text-transform:uppercase;position:relative}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th.ax-interactive{cursor:pointer}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th.ax-interactive:hover{background-color:rgba(var(--ax-color-neutral-200))}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th .ax-resize-handle{position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;background:transparent}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th .ax-resize-handle:hover{background-color:rgba(var(--ax-color-neutral-300))}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th .ax-caption{display:flex;align-items:center;gap:.5rem}ax-infinite-scroll-data-table .ax-header-content .ax-header-columns>table th:last-child{border-inline-end-width:0px}ax-infinite-scroll-data-table .ax-body-content{position:relative}ax-infinite-scroll-data-table .ax-body-content .ax-body-fixed-columns{pointer-events:none;position:absolute;z-index:10}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns{height:100%}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table{border-collapse:collapse}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr:nth-child(2n) td{background-color:rgba(var(--ax-color-on-surface))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr:nth-child(2n) ax-skeleton{width:25%}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr{height:2.5rem}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr.ax-state-focused td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200));color:rgba(var(--ax-color-primary-fore-tint))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr.ax-state-focused:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-300))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr.ax-state-selected td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-300));color:rgba(var(--ax-color-primary-fore-tint))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table tr.ax-state-selected:hover td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-400));color:rgba(var(--ax-color-primary-fore))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td{position:relative;min-width:2rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-bottom-width:1px;border-inline-end-width:1px;border-color:rgba(var(--ax-color-border-default));background-color:rgba(var(--ax-color-surface));padding:.5rem 1rem;vertical-align:middle}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-index-column{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:rgba(var(--ax-color-on-surface));text-align:center}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button.ax-state-disabled{position:relative!important;cursor:not-allowed!important;opacity:.5!important}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column>div{position:absolute;inset-inline-start:0px;top:50%;display:flex;width:100%;transform:translateY(-50%);align-items:center;justify-content:center}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button{position:relative;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:var(--ax-rounded-border-default);border-style:none;border-color:rgba(var(--ax-color-border-default));background-color:transparent;padding:.25rem;line-height:1;color:rgba(var(--ax-color-ghost-fore))}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:hover:not(ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:hover.ax-state-selected,ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:hover.ax-state-disabled){opacity:.75}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button:active{opacity:1}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td.ax-command-column button .ax-ripple{background-color:rgba(var(--ax-color-ghost-fore),.05)}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td:last-child{border-inline-end-width:0px}ax-infinite-scroll-data-table .ax-body-content .ax-body-columns table td ax-skeleton{height:.875rem;width:33.333333%;border-radius:.375rem}ax-infinite-scroll-data-table .ax-table-footer{border-collapse:collapse;overflow:hidden;border-top-width:1px;border-color:rgba(var(--ax-color-border-default));padding:.5rem .875rem}ax-infinite-scroll-data-table .ax-table-footer .ax-table-info{display:flex;flex:1 1 0%;align-items:center;justify-content:space-between}\n"] }]
|
1012
|
+
}], propDecorators: { columns: [{
|
1013
|
+
type: ContentChildren,
|
1014
|
+
args: [AXDataTableColumnComponent]
|
1015
|
+
}], onPageChanged: [{
|
1016
|
+
type: Output
|
1017
|
+
}], onRowClick: [{
|
1018
|
+
type: Output
|
1019
|
+
}], onRowDbClick: [{
|
1020
|
+
type: Output
|
1021
|
+
}], rowTemplate: [{
|
1022
|
+
type: Input
|
1023
|
+
}], emptyTemplate: [{
|
1024
|
+
type: Input
|
1025
|
+
}], showHeader: [{
|
1026
|
+
type: Input
|
1027
|
+
}], fetchDataMode: [{
|
1028
|
+
type: Input
|
1029
|
+
}], loading: [{
|
1030
|
+
type: Input
|
1031
|
+
}], focusedRowChange: [{
|
1032
|
+
type: Output
|
1033
|
+
}], focusedRow: [{
|
1034
|
+
type: Input
|
1035
|
+
}], itemHeight: [{
|
1036
|
+
type: Input
|
1037
|
+
}], viewport: [{
|
1038
|
+
type: ViewChild,
|
1039
|
+
args: [CdkVirtualScrollViewport, { static: true }]
|
1040
|
+
}], onScrolledIndexChanged: [{
|
1041
|
+
type: Output
|
1042
|
+
}], headerContainer: [{
|
1043
|
+
type: ViewChild,
|
1044
|
+
args: ['headerContainer']
|
1045
|
+
}], footerContainer: [{
|
1046
|
+
type: ViewChild,
|
1047
|
+
args: ['footerContainer']
|
1048
|
+
}], scrollableContainer: [{
|
1049
|
+
type: ViewChild,
|
1050
|
+
args: ['scrolling', { static: true }]
|
851
1051
|
}] } });
|
852
1052
|
|
853
1053
|
const COMPONENT = [
|
1054
|
+
AXInfiniteScrollDataTableComponent,
|
854
1055
|
AXDataTableComponent,
|
855
1056
|
AXDataTableTextColumnComponent,
|
856
1057
|
AXRowIndexColumnComponent,
|
@@ -872,10 +1073,16 @@ const MODULES = [
|
|
872
1073
|
AXDropdownModule,
|
873
1074
|
AXFormatModule,
|
874
1075
|
AXRippleDirective,
|
1076
|
+
AXDataPagerModule,
|
1077
|
+
CdkDropList,
|
1078
|
+
CdkDrag,
|
1079
|
+
CdkDragPlaceholder,
|
1080
|
+
CdkDragHandle,
|
875
1081
|
];
|
876
1082
|
class AXDataTableModule {
|
877
1083
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXDataTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
878
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: AXDataTableModule, declarations: [
|
1084
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: AXDataTableModule, declarations: [AXInfiniteScrollDataTableComponent,
|
1085
|
+
AXDataTableComponent,
|
879
1086
|
AXDataTableTextColumnComponent,
|
880
1087
|
AXRowIndexColumnComponent,
|
881
1088
|
AXRowSelectColumnComponent,
|
@@ -892,7 +1099,13 @@ class AXDataTableModule {
|
|
892
1099
|
AXButtonModule,
|
893
1100
|
AXDropdownModule,
|
894
1101
|
AXFormatModule,
|
895
|
-
AXRippleDirective
|
1102
|
+
AXRippleDirective,
|
1103
|
+
AXDataPagerModule,
|
1104
|
+
CdkDropList,
|
1105
|
+
CdkDrag,
|
1106
|
+
CdkDragPlaceholder,
|
1107
|
+
CdkDragHandle], exports: [AXInfiniteScrollDataTableComponent,
|
1108
|
+
AXDataTableComponent,
|
896
1109
|
AXDataTableTextColumnComponent,
|
897
1110
|
AXRowIndexColumnComponent,
|
898
1111
|
AXRowSelectColumnComponent,
|
@@ -909,7 +1122,8 @@ class AXDataTableModule {
|
|
909
1122
|
AXSkeletonModule,
|
910
1123
|
AXButtonModule,
|
911
1124
|
AXDropdownModule,
|
912
|
-
AXFormatModule
|
1125
|
+
AXFormatModule,
|
1126
|
+
AXDataPagerModule] }); }
|
913
1127
|
}
|
914
1128
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXDataTableModule, decorators: [{
|
915
1129
|
type: NgModule,
|
@@ -925,5 +1139,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
925
1139
|
* Generated bundle index. Do not edit.
|
926
1140
|
*/
|
927
1141
|
|
928
|
-
export { AXBaseRowCommandColumnComponent, AXDataTableColumnComponent, AXDataTableColumnResizableDirective, AXDataTableComponent, AXDataTableModule, AXDataTableTextColumnComponent, AXRowCommandColumnComponent, AXRowDropdownCommandColumnComponent, AXRowIndexColumnComponent, AXRowSelectColumnComponent };
|
1142
|
+
export { AXBaseRowCommandColumnComponent, AXDataTableColumnComponent, AXDataTableColumnResizableDirective, AXDataTableComponent, AXDataTableModule, AXDataTableTextColumnComponent, AXInfiniteScrollDataTableComponent, AXRowCommandColumnComponent, AXRowDropdownCommandColumnComponent, AXRowIndexColumnComponent, AXRowSelectColumnComponent };
|
929
1143
|
//# sourceMappingURL=acorex-components-data-table.mjs.map
|