@acorex/components 7.11.0 → 7.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/button/lib/button-item-list.component.d.ts +2 -2
- package/circular-progress/README.md +3 -0
- package/circular-progress/index.d.ts +2 -0
- package/circular-progress/lib/circular-progress.component.d.ts +33 -0
- package/circular-progress/lib/circular-progress.module.d.ts +7 -0
- package/common/lib/classes/datalist.class.d.ts +2 -1
- package/common/lib/classes/datasource.class.d.ts +10 -7
- package/common/lib/classes/events.class.d.ts +2 -1
- package/data-table/index.d.ts +6 -2
- package/data-table/lib/columns/data-column.d.ts +18 -0
- package/data-table/lib/columns/data-text-column.component.d.ts +10 -0
- package/data-table/lib/columns/row-command-column.component.d.ts +31 -0
- package/data-table/lib/columns/row-index-column.component.d.ts +12 -0
- package/data-table/lib/columns/row-select-column.component.d.ts +13 -0
- package/data-table/lib/data-table.component.d.ts +42 -27
- package/data-table/lib/data-table.module.d.ts +14 -11
- package/esm2022/alert/lib/alert.component.mjs +2 -2
- package/esm2022/button/lib/button-item-list.component.mjs +5 -4
- package/esm2022/circular-progress/acorex-components-circular-progress.mjs +5 -0
- package/esm2022/circular-progress/index.mjs +3 -0
- package/esm2022/circular-progress/lib/circular-progress.component.mjs +96 -0
- package/esm2022/circular-progress/lib/circular-progress.module.mjs +17 -0
- package/esm2022/common/lib/classes/datalist.class.mjs +6 -3
- package/esm2022/common/lib/classes/datasource.class.mjs +10 -3
- package/esm2022/common/lib/classes/events.class.mjs +2 -2
- package/esm2022/data-table/index.mjs +7 -3
- package/esm2022/data-table/lib/columns/data-column.mjs +35 -0
- package/esm2022/data-table/lib/columns/data-text-column.component.mjs +34 -0
- package/esm2022/data-table/lib/columns/row-command-column.component.mjs +110 -0
- package/esm2022/data-table/lib/columns/row-index-column.component.mjs +41 -0
- package/esm2022/data-table/lib/columns/row-select-column.component.mjs +62 -0
- package/esm2022/data-table/lib/data-table.component.mjs +135 -92
- package/esm2022/data-table/lib/data-table.module.mjs +41 -6
- package/esm2022/dropdown/lib/dropdown-panel.component.mjs +1 -2
- package/esm2022/progress-bar/lib/progress-bar.component.mjs +20 -62
- package/esm2022/skeleton/lib/skeleton.component.mjs +2 -2
- package/esm2022/switch/lib/switch-content.component.mjs +3 -3
- package/esm2022/switch/lib/switch.component.mjs +3 -3
- package/esm2022/uploader/lib/uploader-list.component.mjs +3 -3
- package/fesm2022/acorex-components-alert.mjs +2 -2
- package/fesm2022/acorex-components-alert.mjs.map +1 -1
- package/fesm2022/acorex-components-button.mjs +3 -2
- package/fesm2022/acorex-components-button.mjs.map +1 -1
- package/fesm2022/acorex-components-circular-progress.mjs +117 -0
- package/fesm2022/acorex-components-circular-progress.mjs.map +1 -0
- package/fesm2022/acorex-components-common.mjs +15 -5
- package/fesm2022/acorex-components-common.mjs.map +1 -1
- package/fesm2022/acorex-components-data-table.mjs +353 -161
- package/fesm2022/acorex-components-data-table.mjs.map +1 -1
- package/fesm2022/acorex-components-dropdown.mjs +0 -1
- package/fesm2022/acorex-components-dropdown.mjs.map +1 -1
- package/fesm2022/acorex-components-progress-bar.mjs +18 -60
- package/fesm2022/acorex-components-progress-bar.mjs.map +1 -1
- package/fesm2022/acorex-components-skeleton.mjs +2 -2
- package/fesm2022/acorex-components-skeleton.mjs.map +1 -1
- package/fesm2022/acorex-components-switch.mjs +4 -4
- package/fesm2022/acorex-components-switch.mjs.map +1 -1
- package/fesm2022/acorex-components-uploader.mjs +2 -2
- package/fesm2022/acorex-components-uploader.mjs.map +1 -1
- package/package.json +29 -23
- package/progress-bar/lib/progress-bar.component.d.ts +9 -18
- package/switch/lib/switch-content.component.d.ts +1 -1
- package/switch/lib/switch.component.d.ts +1 -1
- package/data-table/lib/data-column.directive.d.ts +0 -11
- package/data-table/lib/data-table2.component.d.ts +0 -42
- package/esm2022/data-table/lib/data-column.directive.mjs +0 -26
- package/esm2022/data-table/lib/data-table2.component.mjs +0 -130
@@ -1,200 +1,163 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import {
|
3
|
-
import { MXBaseComponent,
|
2
|
+
import { Injectable, Input, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, EventEmitter, ContentChildren, Output, inject, NgModule } from '@angular/core';
|
3
|
+
import { MXBaseComponent, convertArrayToDataSource, AXListDataSource, AXPagedComponent } from '@acorex/components/common';
|
4
|
+
import * as i2 from '@angular/cdk/scrolling';
|
5
|
+
import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
|
6
|
+
import sum from 'lodash-es/sum';
|
4
7
|
import * as i1 from '@angular/common';
|
5
8
|
import { CommonModule } from '@angular/common';
|
6
|
-
import * as
|
9
|
+
import * as i3 from '@acorex/components/result';
|
7
10
|
import { AXResultModule } from '@acorex/components/result';
|
8
|
-
import * as
|
9
|
-
import { AXTranslationModule } from '@acorex/core/translation';
|
10
|
-
import * as i4 from '@acorex/components/decorators';
|
11
|
+
import * as i2$1 from '@acorex/components/decorators';
|
11
12
|
import { AXDecoratorModule } from '@acorex/components/decorators';
|
12
|
-
import { AXLoadingModule } from '@acorex/components/loading';
|
13
|
-
import * as i2$1 from '@angular/cdk/scrolling';
|
14
|
-
import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
|
15
|
-
import _ from 'lodash';
|
16
13
|
import * as i5 from '@acorex/components/skeleton';
|
17
14
|
import { AXSkeletonModule } from '@acorex/components/skeleton';
|
18
|
-
import * as
|
15
|
+
import * as i3$1 from '@acorex/components/button';
|
19
16
|
import { AXButtonModule } from '@acorex/components/button';
|
17
|
+
import * as i7 from '@acorex/core/translation';
|
18
|
+
import { AXTranslationModule } from '@acorex/core/translation';
|
19
|
+
import { of, Observable } from 'rxjs';
|
20
|
+
import * as i4 from '@acorex/components/dropdown';
|
21
|
+
import { AXDropdownModule } from '@acorex/components/dropdown';
|
22
|
+
import { AXLoadingModule } from '@acorex/components/loading';
|
20
23
|
|
21
24
|
class AXDataColumnComponent {
|
22
25
|
constructor() {
|
23
26
|
this.width = 'auto';
|
27
|
+
this.allowSorting = false;
|
28
|
+
this.sortIndex = undefined;
|
29
|
+
this.sortOrder = undefined;
|
30
|
+
}
|
31
|
+
get cssClass() {
|
32
|
+
return null;
|
24
33
|
}
|
25
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXDataColumnComponent, deps: [], target: i0.ɵɵFactoryTarget.
|
26
|
-
static { this.ɵ
|
34
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXDataColumnComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
35
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXDataColumnComponent }); }
|
27
36
|
}
|
28
37
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXDataColumnComponent, decorators: [{
|
29
|
-
type:
|
30
|
-
|
31
|
-
selector: 'ax-data-column',
|
32
|
-
}]
|
33
|
-
}], propDecorators: { headerTemplate: [{
|
34
|
-
type: Input
|
35
|
-
}], cellTemplate: [{
|
36
|
-
type: Input
|
37
|
-
}], valueField: [{
|
38
|
+
type: Injectable
|
39
|
+
}], propDecorators: { dataField: [{
|
38
40
|
type: Input
|
39
41
|
}], caption: [{
|
40
42
|
type: Input
|
41
43
|
}], width: [{
|
42
44
|
type: Input
|
45
|
+
}], allowSorting: [{
|
46
|
+
type: Input
|
47
|
+
}], sortIndex: [{
|
48
|
+
type: Input
|
49
|
+
}], sortOrder: [{
|
50
|
+
type: Input
|
51
|
+
}], headerTemplate: [{
|
52
|
+
type: Input
|
53
|
+
}], cellTemplate: [{
|
54
|
+
type: Input
|
43
55
|
}] } });
|
44
56
|
|
45
|
-
class
|
46
|
-
|
47
|
-
|
48
|
-
this.onPageChanged = new EventEmitter();
|
49
|
-
this.showHeader = true;
|
50
|
-
this._pageSize = 20;
|
51
|
-
this.fetchDataMode = 'auto';
|
52
|
-
this._currentPage = 1;
|
53
|
-
this._loadedItems = [];
|
54
|
-
this._totalItems = 0;
|
55
|
-
this._isLazy = false;
|
56
|
-
this._isLoading = false;
|
57
|
-
this._items = [];
|
57
|
+
class AXDataTextColumnComponent extends AXDataColumnComponent {
|
58
|
+
get template() {
|
59
|
+
return this._template;
|
58
60
|
}
|
59
|
-
get
|
60
|
-
return
|
61
|
+
get skeleton() {
|
62
|
+
return true;
|
61
63
|
}
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
}
|
64
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXDataTextColumnComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
65
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.6", type: AXDataTextColumnComponent, selector: "ax-text-column", inputs: { width: "width", caption: "caption", headerTemplate: "headerTemplate", cellTemplate: "cellTemplate", dataField: "dataField", allowSorting: "allowSorting" }, providers: [{ provide: AXDataColumnComponent, useExisting: AXDataTextColumnComponent }], viewQueries: [{ propertyName: "_template", first: true, predicate: TemplateRef, descendants: true }], usesInheritance: true, ngImport: i0, template: `
|
66
|
+
<ng-template let-row>
|
67
|
+
{{row.data[dataField]}}
|
68
|
+
</ng-template>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
69
|
+
}
|
70
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXDataTextColumnComponent, decorators: [{
|
71
|
+
type: Component,
|
72
|
+
args: [{
|
73
|
+
selector: 'ax-text-column',
|
74
|
+
template: `
|
75
|
+
<ng-template let-row>
|
76
|
+
{{row.data[dataField]}}
|
77
|
+
</ng-template>`,
|
78
|
+
encapsulation: ViewEncapsulation.None,
|
79
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
80
|
+
providers: [{ provide: AXDataColumnComponent, useExisting: AXDataTextColumnComponent }],
|
81
|
+
inputs: ['width', 'caption', 'headerTemplate', 'cellTemplate', 'dataField', 'allowSorting']
|
82
|
+
}]
|
83
|
+
}], propDecorators: { _template: [{
|
84
|
+
type: ViewChild,
|
85
|
+
args: [TemplateRef]
|
86
|
+
}] } });
|
87
|
+
|
88
|
+
class AXRowIndexColumnComponent extends AXDataColumnComponent {
|
89
|
+
constructor() {
|
90
|
+
super(...arguments);
|
91
|
+
this.allowSorting = false;
|
91
92
|
}
|
92
|
-
get
|
93
|
-
|
94
|
-
return (this._items || []);
|
95
|
-
}
|
96
|
-
else if (typeof this._items == 'function') {
|
97
|
-
return this._loadedItems || [];
|
98
|
-
}
|
99
|
-
return [];
|
100
|
-
}
|
101
|
-
ngAfterViewInit() {
|
102
|
-
if (this.fetchDataMode == 'auto')
|
103
|
-
this._fetchData();
|
104
|
-
}
|
105
|
-
_fetchData(opts) {
|
106
|
-
const skip = (this._currentPage - 1) * this.pageSize, take = this.pageSize;
|
107
|
-
if ((this.loadedCount >= this.totalCount && this.totalCount != 0) ||
|
108
|
-
this._isLoading ||
|
109
|
-
!this._isLazy ||
|
110
|
-
skip > this.totalCount) {
|
111
|
-
return;
|
112
|
-
}
|
113
|
-
if (this._items) {
|
114
|
-
this._isLoading = true;
|
115
|
-
this.cdr.markForCheck();
|
116
|
-
const fetchFn = this._items;
|
117
|
-
fetchFn({ skip, take, searchQuery: opts?.searchQuery })
|
118
|
-
.then((c) => {
|
119
|
-
if (Array.isArray(c)) {
|
120
|
-
this._loadedItems = c;
|
121
|
-
this._totalItems = c.length;
|
122
|
-
}
|
123
|
-
else {
|
124
|
-
this._totalItems = c.total || c.items?.length || 0;
|
125
|
-
this._loadedItems = [...new Set(c.items)];
|
126
|
-
}
|
127
|
-
})
|
128
|
-
.finally(() => {
|
129
|
-
this._isLoading = false;
|
130
|
-
this.onPageChanged.next({
|
131
|
-
component: this,
|
132
|
-
isUserInteraction: false,
|
133
|
-
name: 'page',
|
134
|
-
value: this._currentPage,
|
135
|
-
});
|
136
|
-
this.cdr.markForCheck();
|
137
|
-
});
|
138
|
-
}
|
93
|
+
get template() {
|
94
|
+
return this._template;
|
139
95
|
}
|
140
|
-
|
141
|
-
|
142
|
-
this._loadedItems = [];
|
143
|
-
this._fetchData();
|
96
|
+
get cssClass() {
|
97
|
+
return 'ax-index-column';
|
144
98
|
}
|
145
|
-
|
146
|
-
|
147
|
-
this._fetchData();
|
99
|
+
get skeleton() {
|
100
|
+
return false;
|
148
101
|
}
|
149
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type:
|
150
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.6", type:
|
102
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXRowIndexColumnComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
103
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.6", type: AXRowIndexColumnComponent, selector: "ax-index-column", inputs: { width: "width", caption: "caption" }, providers: [{ provide: AXDataColumnComponent, useExisting: AXRowIndexColumnComponent }], viewQueries: [{ propertyName: "_template", first: true, predicate: TemplateRef, descendants: true }], usesInheritance: true, ngImport: i0, template: `
|
104
|
+
<ng-template let-row>
|
105
|
+
<span> {{row.rowIndex + 1}}</span>
|
106
|
+
</ng-template>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
151
107
|
}
|
152
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type:
|
108
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXRowIndexColumnComponent, decorators: [{
|
153
109
|
type: Component,
|
154
|
-
args: [{
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
}], fetchDataMode: [{
|
169
|
-
type: Input
|
170
|
-
}], items: [{
|
171
|
-
type: Input
|
110
|
+
args: [{
|
111
|
+
selector: 'ax-index-column',
|
112
|
+
template: `
|
113
|
+
<ng-template let-row>
|
114
|
+
<span> {{row.rowIndex + 1}}</span>
|
115
|
+
</ng-template>`,
|
116
|
+
encapsulation: ViewEncapsulation.None,
|
117
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
118
|
+
providers: [{ provide: AXDataColumnComponent, useExisting: AXRowIndexColumnComponent }],
|
119
|
+
inputs: ['width', 'caption']
|
120
|
+
}]
|
121
|
+
}], propDecorators: { _template: [{
|
122
|
+
type: ViewChild,
|
123
|
+
args: [TemplateRef]
|
172
124
|
}] } });
|
173
125
|
|
174
|
-
class
|
126
|
+
class AXDataTableComponent extends MXBaseComponent {
|
175
127
|
constructor() {
|
176
128
|
super(...arguments);
|
177
129
|
this.onPageChanged = new EventEmitter();
|
178
130
|
this.showHeader = true;
|
179
|
-
this._pageSize = 20;
|
180
131
|
this.fetchDataMode = 'auto';
|
181
132
|
this.dataSource = convertArrayToDataSource([]);
|
182
133
|
this.isLoading = true;
|
183
134
|
this.hasItems = false;
|
184
135
|
this.totalRows = 0;
|
136
|
+
this.currentPage = 0;
|
137
|
+
this.totalPages = 0;
|
185
138
|
this.startRowIndex = 0;
|
186
|
-
this.endRowIndex = 0;
|
187
139
|
this.lastIndex = 0;
|
140
|
+
this.focusedRowChange = new EventEmitter();
|
141
|
+
this.selectedRowsChange = new EventEmitter();
|
142
|
+
this._selectedRows = [];
|
188
143
|
this.itemHeight = 40;
|
189
144
|
this.width = "100%";
|
190
145
|
this.height = "100%";
|
191
146
|
this.onScrolledIndexChanged = new EventEmitter();
|
192
147
|
}
|
193
|
-
get
|
194
|
-
return this.
|
148
|
+
get focusedRow() {
|
149
|
+
return this._focusedRow;
|
150
|
+
}
|
151
|
+
set focusedRow(v) {
|
152
|
+
this._focusedRow = v;
|
153
|
+
this.focusedRowChange.emit(v);
|
195
154
|
}
|
196
|
-
|
197
|
-
this.
|
155
|
+
get selectedRows() {
|
156
|
+
return this._selectedRows;
|
157
|
+
}
|
158
|
+
set selectedRows(v) {
|
159
|
+
this._selectedRows = v;
|
160
|
+
this.selectedRowsChange.emit(v);
|
198
161
|
}
|
199
162
|
trackByIdx(i) {
|
200
163
|
return i;
|
@@ -234,11 +197,15 @@ class AXDataTable2Component extends MXBaseComponent {
|
|
234
197
|
headerContainer.scrollLeft = left;
|
235
198
|
}
|
236
199
|
if (this.columns && this.columns.length) {
|
237
|
-
const
|
238
|
-
this.width = `${Math.max(
|
200
|
+
const sumPx = sum(this.columns.toArray().map(c => typeof c.width == 'number' ? c.width : Number(c.width.replace('px', ''))));
|
201
|
+
this.width = `${Math.max(sumPx, this.getHostElement().clientWidth - 5)}px`;
|
239
202
|
}
|
240
203
|
this.height = `calc(100% - ${((this.headerContainer?.nativeElement.clientHeight ?? 0) + (this.footerContainer?.nativeElement.clientHeight ?? 0))}px)`;
|
241
|
-
this.startRowIndex =
|
204
|
+
this.startRowIndex = this.lastIndex;
|
205
|
+
if (this.startRowIndex < 1)
|
206
|
+
this.startRowIndex = 1;
|
207
|
+
if (this.startRowIndex > this.totalRows)
|
208
|
+
this.startRowIndex = this.totalRows;
|
242
209
|
}
|
243
210
|
render() {
|
244
211
|
this.viewport.checkViewportSize();
|
@@ -246,14 +213,42 @@ class AXDataTable2Component extends MXBaseComponent {
|
|
246
213
|
this.cdr.markForCheck();
|
247
214
|
}
|
248
215
|
refresh() {
|
216
|
+
this.lastIndex = 0;
|
249
217
|
this.dataSource.refresh();
|
250
218
|
}
|
251
|
-
|
252
|
-
|
219
|
+
handleRowClick(e, item) {
|
220
|
+
if (this.focusedRow == item) {
|
221
|
+
this.focusedRow = null;
|
222
|
+
}
|
223
|
+
else {
|
224
|
+
this.focusedRow = item;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
handleColumnClick(e, column) {
|
228
|
+
const sort = this.dataSource.query.sort.find(c => c.field == column.dataField);
|
229
|
+
if (!sort) {
|
230
|
+
this.dataSource.query.sort.push({ field: column.dataField, dir: 'asc' });
|
231
|
+
}
|
232
|
+
else {
|
233
|
+
if (sort.dir == 'asc') {
|
234
|
+
sort.dir = 'desc';
|
235
|
+
}
|
236
|
+
else {
|
237
|
+
this.dataSource.query.sort = this.dataSource.query.sort.filter(c => c != sort);
|
238
|
+
}
|
239
|
+
}
|
240
|
+
this.refresh();
|
241
|
+
}
|
242
|
+
getSort(column) {
|
243
|
+
const sort = this.dataSource.query.sort.find(c => c.field == column.dataField);
|
244
|
+
return sort ? (sort.dir == 'asc' ? 'ax-icon-arrow-long-down' : 'ax-icon-arrow-long-up') : undefined;
|
245
|
+
}
|
246
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXDataTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
247
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.6", type: AXDataTableComponent, selector: "ax-data-table", inputs: { rowTemplate: "rowTemplate", emptyTemplate: "emptyTemplate", loadingTemplate: "loadingTemplate", showHeader: "showHeader", fetchDataMode: "fetchDataMode", dataSource: "dataSource", focusedRow: "focusedRow", selectedRows: "selectedRows", itemHeight: "itemHeight" }, outputs: { onPageChanged: "onPageChanged", focusedRowChange: "focusedRowChange", selectedRowsChange: "selectedRowsChange", onScrolledIndexChanged: "onScrolledIndexChanged" }, providers: [{ provide: AXPagedComponent, useExisting: AXDataTableComponent }], queries: [{ propertyName: "columns", predicate: AXDataColumnComponent }], viewQueries: [{ propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true }, { propertyName: "headerContainer", first: true, predicate: ["headerContainer"], descendants: true }, { propertyName: "footerContainer", first: true, predicate: ["footerContainer"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"ax-header\">\n</ng-content>\n<div class=\"ax-table-header\" #headerContainer>\n <table tabindex=\"0\" *ngIf=\"showHeader\" [style.width]=\"width\">\n <thead>\n <tr>\n <th *ngFor=\"let c of columns\" [style.width]=\"c.width\" [class.ax-interactive]=\"c.allowSorting\"\n (click)=\"c.allowSorting ? handleColumnClick($event,c) : null\">\n <ng-template [ngIf]=\"c.headerTemplate\" [ngIfElse]=\"captionTpl\">\n <ng-container *ngTemplateOutlet=\"c.headerTemplate\"></ng-container>\n </ng-template>\n <ng-template #captionTpl>\n <div class=\"ax-caption\">\n {{c.caption}}\n <ax-icon *ngIf=\"getSort(c)\" icon=\"ax-icon {{getSort(c)}}\"></ax-icon>\n </div>\n </ng-template>\n </th>\n <th> </th>\n </tr>\n </thead>\n </table>\n</div>\n<div cdkVirtualScrollingElement [style.height]=\"height\">\n <cdk-virtual-scroll-viewport [itemSize]=\"itemHeight\" [style.--item-height]=\"itemHeight+'px'\"\n (scrolledIndexChange)=\"_handleOnscrolledIndexChange($event)\">\n <table tabindex=\"0\" class=\"ax-table-body\" [style.width]=\"width\">\n <tbody>\n <ng-container *cdkVirtualFor=\"let item of listDataSource;let i = index; trackBy: trackByIdx;let rIndex=index;\">\n <ng-template [ngIf]=\"rowTemplate\" [ngIfElse]=\"rowTpl\">\n <ng-container *ngTemplateOutlet=\"rowTemplate;context: { $implicit: {data:item,rowIndex:rIndex} }\">\n </ng-container>\n </ng-template>\n <ng-template #rowTpl>\n <tr [class.ax-state-focused]=\"focusedRow && item===focusedRow\"\n [class.ax-state-selected]=\"selectedRows.includes(item)\" (click)=\"handleRowClick($event,item)\"\n [attr.data.rowIndex]=\"rIndex\">\n <ng-container *ngFor=\"let c of columns\">\n <ng-template [ngIf]=\"c.cellTemplate\" [ngIfElse]=\"cellTpl\">\n <div class=\"ax-content\">\n <ng-container\n *ngTemplateOutlet=\"c.cellTemplate;context: { $implicit: {data:item,rowIndex:rIndex} }\">\n </ng-container>\n </div>\n </ng-template>\n <ng-template #cellTpl>\n <td [attr.data-label]=\"c.caption\" tabindex=\"0\" [style.width]=\"c.width\" [class]=\"c.cssClass\">\n <div class=\"ax-content\">\n <ng-container *ngIf=\"item || !c.skeleton;else loadingTpl\">\n <ng-container\n *ngTemplateOutlet=\"c.template; context: { $implicit: {data:item,rowIndex:rIndex} }\"></ng-container>\n </ng-container>\n </div>\n </td>\n </ng-template>\n </ng-container>\n <td> </td>\n </tr>\n </ng-template>\n </ng-container>\n </tbody>\n </table>\n </cdk-virtual-scroll-viewport>\n</div>\n<div class=\"ax-table-footer\" #footerContainer>\n <div class=\"ax-table-info\">\n <div>\n Showing {{startRowIndex}} of {{totalRows}} items\n </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\">\n </ng-content>\n</div>\n\n<!-- Loading Template -->\n<ng-template #loadingTpl>\n <!-- Custom Loading Template -->\n <ng-container *ngIf=\"loadingTemplate;else defaultLoadingTpl\">\n <ng-container *ngTemplateOutlet=\"loadingTemplate\">\n </ng-container>\n </ng-container>\n <!-- Default Loading Template -->\n <ng-template #defaultLoadingTpl>\n <ax-skeleton [animated]=\"true\"></ax-skeleton>\n </ng-template>\n</ng-template>\n<!-- Empty Template -->\n<ng-template #emptyTpl>\n <tr>\n <td [attr.colspan]=\"columns.length\">\n <ng-template [ngIf]=\"emptyTemplate\" [ngIfElse]=\"defaultEmptyTemplate\">\n <ng-container *ngTemplateOutlet=\"emptyTemplate\"></ng-container>\n </ng-template>\n <ng-template #defaultEmptyTemplate>\n <ax-result type=\"empty\" caption=\" {{'common.no-result-found' | trans }}\"></ax-result>\n </ng-template>\n </td>\n </tr>\n</ng-template>", styles: [".ax-dark ax-data-table .ax-table-body tr:hover td:not(.ax-index-column),.ax-dark ax-data-table .ax-table-body tr.ax-state-focused td:not(.ax-index-column){background-color:#ffffff4d;color:rgba(var(--ax-color-text-default))}.ax-dark ax-data-table .ax-table-body tr.ax-state-selected:not(:hover,.ax-state-focused) td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900),.5);color:rgba(var(--ax-color-primary-fore))}ax-data-table{border-radius:var(--ax-rounded-border-default);border:1px solid;border-color:rgba(var(--ax-color-border-default));height:100%;font-size:.875rem;overflow-y:hidden;overflow-x:hidden}ax-data-table table{table-layout:fixed}ax-data-table .ax-table-header{border-start-start-radius:var(--ax-rounded-border-default);border-start-end-radius:var(--ax-rounded-border-default);background-color:rgba(var(--ax-color-on-surface));border-collapse:collapse;overflow:hidden}ax-data-table .ax-table-header th{text-transform:uppercase;font-weight:500;text-align:start;padding:.875rem 1rem;border-block-end:1px solid;border-inline-end:1px solid;border-color:rgba(var(--ax-color-border-default))}ax-data-table .ax-table-header th.ax-interactive{cursor:pointer}ax-data-table .ax-table-header th.ax-interactive:hover{background-color:#0000001a}ax-data-table .ax-table-header th .ax-caption{display:flex;gap:.5rem;align-items:center}ax-data-table .ax-table-header th:last-child{border-inline-end:0px solid}ax-data-table .ax-table-footer{border-top:1px solid;border-color:rgba(var(--ax-color-border-default));border-collapse:collapse;overflow:hidden;padding:.5rem .875rem}ax-data-table .ax-table-footer .ax-table-info{display:flex;flex:1;flex-direction:row;justify-content:space-between;align-items:center}ax-data-table .ax-table-body{border-collapse:collapse}ax-data-table .ax-table-body tr:nth-child(odd) td{background-color:rgba(var(--ax-color-on-surface),.7)}ax-data-table .ax-table-body tr:nth-child(odd) ax-skeleton{width:25%}ax-data-table .ax-table-body tr:hover td:not(.ax-index-column),ax-data-table .ax-table-body tr.ax-state-focused td:not(.ax-index-column){background-color:#0000001a}ax-data-table .ax-table-body tr.ax-state-selected:not(:hover,.ax-state-focused) td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200));color:rgba(var(--ax-color-primary-fore-lighten))}ax-data-table .ax-table-body td{padding:.5rem 1rem;border-block-end:1px solid;border-inline-end:1px solid;border-color:rgba(var(--ax-color-border-default))}ax-data-table .ax-table-body td.ax-index-column{background-color:rgba(var(--ax-color-on-surface))!important}ax-data-table .ax-table-body td.ax-index-column>.ax-content{justify-content:center}ax-data-table .ax-table-body td.ax-index-column>.ax-content span{text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;width:100%}ax-data-table .ax-table-body td.ax-command-column>.ax-content{justify-content:center}ax-data-table .ax-table-body td.ax-command-column>.ax-content span{text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;width:100%;font-size:1.4rem;cursor:pointer}ax-data-table .ax-table-body td>.ax-content{display:flex;justify-content:flex-start;width:100%}ax-data-table .ax-table-body td:last-child{border-inline-end:0px solid}ax-data-table .ax-table-body td ax-skeleton{height:.875rem;border-radius:calc(var(--ax-rounded-border-default) / 1.5);width:35%}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: i3.AXResultComponent, selector: "ax-result", inputs: ["type", "caption", "description"] }, { kind: "component", type: i2$1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i5.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"] }, { kind: "pipe", type: i7.AXTranslatorPipe, name: "trans" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
253
248
|
}
|
254
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type:
|
249
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXDataTableComponent, decorators: [{
|
255
250
|
type: Component,
|
256
|
-
args: [{ selector: 'ax-data-
|
251
|
+
args: [{ selector: 'ax-data-table', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [{ provide: AXPagedComponent, useExisting: AXDataTableComponent }], template: "<ng-content select=\"ax-header\">\n</ng-content>\n<div class=\"ax-table-header\" #headerContainer>\n <table tabindex=\"0\" *ngIf=\"showHeader\" [style.width]=\"width\">\n <thead>\n <tr>\n <th *ngFor=\"let c of columns\" [style.width]=\"c.width\" [class.ax-interactive]=\"c.allowSorting\"\n (click)=\"c.allowSorting ? handleColumnClick($event,c) : null\">\n <ng-template [ngIf]=\"c.headerTemplate\" [ngIfElse]=\"captionTpl\">\n <ng-container *ngTemplateOutlet=\"c.headerTemplate\"></ng-container>\n </ng-template>\n <ng-template #captionTpl>\n <div class=\"ax-caption\">\n {{c.caption}}\n <ax-icon *ngIf=\"getSort(c)\" icon=\"ax-icon {{getSort(c)}}\"></ax-icon>\n </div>\n </ng-template>\n </th>\n <th> </th>\n </tr>\n </thead>\n </table>\n</div>\n<div cdkVirtualScrollingElement [style.height]=\"height\">\n <cdk-virtual-scroll-viewport [itemSize]=\"itemHeight\" [style.--item-height]=\"itemHeight+'px'\"\n (scrolledIndexChange)=\"_handleOnscrolledIndexChange($event)\">\n <table tabindex=\"0\" class=\"ax-table-body\" [style.width]=\"width\">\n <tbody>\n <ng-container *cdkVirtualFor=\"let item of listDataSource;let i = index; trackBy: trackByIdx;let rIndex=index;\">\n <ng-template [ngIf]=\"rowTemplate\" [ngIfElse]=\"rowTpl\">\n <ng-container *ngTemplateOutlet=\"rowTemplate;context: { $implicit: {data:item,rowIndex:rIndex} }\">\n </ng-container>\n </ng-template>\n <ng-template #rowTpl>\n <tr [class.ax-state-focused]=\"focusedRow && item===focusedRow\"\n [class.ax-state-selected]=\"selectedRows.includes(item)\" (click)=\"handleRowClick($event,item)\"\n [attr.data.rowIndex]=\"rIndex\">\n <ng-container *ngFor=\"let c of columns\">\n <ng-template [ngIf]=\"c.cellTemplate\" [ngIfElse]=\"cellTpl\">\n <div class=\"ax-content\">\n <ng-container\n *ngTemplateOutlet=\"c.cellTemplate;context: { $implicit: {data:item,rowIndex:rIndex} }\">\n </ng-container>\n </div>\n </ng-template>\n <ng-template #cellTpl>\n <td [attr.data-label]=\"c.caption\" tabindex=\"0\" [style.width]=\"c.width\" [class]=\"c.cssClass\">\n <div class=\"ax-content\">\n <ng-container *ngIf=\"item || !c.skeleton;else loadingTpl\">\n <ng-container\n *ngTemplateOutlet=\"c.template; context: { $implicit: {data:item,rowIndex:rIndex} }\"></ng-container>\n </ng-container>\n </div>\n </td>\n </ng-template>\n </ng-container>\n <td> </td>\n </tr>\n </ng-template>\n </ng-container>\n </tbody>\n </table>\n </cdk-virtual-scroll-viewport>\n</div>\n<div class=\"ax-table-footer\" #footerContainer>\n <div class=\"ax-table-info\">\n <div>\n Showing {{startRowIndex}} of {{totalRows}} items\n </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\">\n </ng-content>\n</div>\n\n<!-- Loading Template -->\n<ng-template #loadingTpl>\n <!-- Custom Loading Template -->\n <ng-container *ngIf=\"loadingTemplate;else defaultLoadingTpl\">\n <ng-container *ngTemplateOutlet=\"loadingTemplate\">\n </ng-container>\n </ng-container>\n <!-- Default Loading Template -->\n <ng-template #defaultLoadingTpl>\n <ax-skeleton [animated]=\"true\"></ax-skeleton>\n </ng-template>\n</ng-template>\n<!-- Empty Template -->\n<ng-template #emptyTpl>\n <tr>\n <td [attr.colspan]=\"columns.length\">\n <ng-template [ngIf]=\"emptyTemplate\" [ngIfElse]=\"defaultEmptyTemplate\">\n <ng-container *ngTemplateOutlet=\"emptyTemplate\"></ng-container>\n </ng-template>\n <ng-template #defaultEmptyTemplate>\n <ax-result type=\"empty\" caption=\" {{'common.no-result-found' | trans }}\"></ax-result>\n </ng-template>\n </td>\n </tr>\n</ng-template>", styles: [".ax-dark ax-data-table .ax-table-body tr:hover td:not(.ax-index-column),.ax-dark ax-data-table .ax-table-body tr.ax-state-focused td:not(.ax-index-column){background-color:#ffffff4d;color:rgba(var(--ax-color-text-default))}.ax-dark ax-data-table .ax-table-body tr.ax-state-selected:not(:hover,.ax-state-focused) td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-900),.5);color:rgba(var(--ax-color-primary-fore))}ax-data-table{border-radius:var(--ax-rounded-border-default);border:1px solid;border-color:rgba(var(--ax-color-border-default));height:100%;font-size:.875rem;overflow-y:hidden;overflow-x:hidden}ax-data-table table{table-layout:fixed}ax-data-table .ax-table-header{border-start-start-radius:var(--ax-rounded-border-default);border-start-end-radius:var(--ax-rounded-border-default);background-color:rgba(var(--ax-color-on-surface));border-collapse:collapse;overflow:hidden}ax-data-table .ax-table-header th{text-transform:uppercase;font-weight:500;text-align:start;padding:.875rem 1rem;border-block-end:1px solid;border-inline-end:1px solid;border-color:rgba(var(--ax-color-border-default))}ax-data-table .ax-table-header th.ax-interactive{cursor:pointer}ax-data-table .ax-table-header th.ax-interactive:hover{background-color:#0000001a}ax-data-table .ax-table-header th .ax-caption{display:flex;gap:.5rem;align-items:center}ax-data-table .ax-table-header th:last-child{border-inline-end:0px solid}ax-data-table .ax-table-footer{border-top:1px solid;border-color:rgba(var(--ax-color-border-default));border-collapse:collapse;overflow:hidden;padding:.5rem .875rem}ax-data-table .ax-table-footer .ax-table-info{display:flex;flex:1;flex-direction:row;justify-content:space-between;align-items:center}ax-data-table .ax-table-body{border-collapse:collapse}ax-data-table .ax-table-body tr:nth-child(odd) td{background-color:rgba(var(--ax-color-on-surface),.7)}ax-data-table .ax-table-body tr:nth-child(odd) ax-skeleton{width:25%}ax-data-table .ax-table-body tr:hover td:not(.ax-index-column),ax-data-table .ax-table-body tr.ax-state-focused td:not(.ax-index-column){background-color:#0000001a}ax-data-table .ax-table-body tr.ax-state-selected:not(:hover,.ax-state-focused) td:not(.ax-index-column){background-color:rgba(var(--ax-color-primary-200));color:rgba(var(--ax-color-primary-fore-lighten))}ax-data-table .ax-table-body td{padding:.5rem 1rem;border-block-end:1px solid;border-inline-end:1px solid;border-color:rgba(var(--ax-color-border-default))}ax-data-table .ax-table-body td.ax-index-column{background-color:rgba(var(--ax-color-on-surface))!important}ax-data-table .ax-table-body td.ax-index-column>.ax-content{justify-content:center}ax-data-table .ax-table-body td.ax-index-column>.ax-content span{text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;width:100%}ax-data-table .ax-table-body td.ax-command-column>.ax-content{justify-content:center}ax-data-table .ax-table-body td.ax-command-column>.ax-content span{text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;width:100%;font-size:1.4rem;cursor:pointer}ax-data-table .ax-table-body td>.ax-content{display:flex;justify-content:flex-start;width:100%}ax-data-table .ax-table-body td:last-child{border-inline-end:0px solid}ax-data-table .ax-table-body td ax-skeleton{height:.875rem;border-radius:calc(var(--ax-rounded-border-default) / 1.5);width:35%}\n"] }]
|
257
252
|
}], propDecorators: { columns: [{
|
258
253
|
type: ContentChildren,
|
259
254
|
args: [AXDataColumnComponent]
|
@@ -267,12 +262,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImpor
|
|
267
262
|
type: Input
|
268
263
|
}], showHeader: [{
|
269
264
|
type: Input
|
270
|
-
}], pageSize: [{
|
271
|
-
type: Input
|
272
265
|
}], fetchDataMode: [{
|
273
266
|
type: Input
|
274
267
|
}], dataSource: [{
|
275
268
|
type: Input
|
269
|
+
}], focusedRowChange: [{
|
270
|
+
type: Output
|
271
|
+
}], focusedRow: [{
|
272
|
+
type: Input
|
273
|
+
}], selectedRowsChange: [{
|
274
|
+
type: Output
|
275
|
+
}], selectedRows: [{
|
276
|
+
type: Input
|
276
277
|
}], itemHeight: [{
|
277
278
|
type: Input
|
278
279
|
}], viewport: [{
|
@@ -288,11 +289,202 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImpor
|
|
288
289
|
args: ['footerContainer']
|
289
290
|
}] } });
|
290
291
|
|
291
|
-
|
292
|
-
|
292
|
+
class AXRowSelectColumnComponent extends AXDataColumnComponent {
|
293
|
+
constructor() {
|
294
|
+
super(...arguments);
|
295
|
+
this.grid = inject(AXDataTableComponent);
|
296
|
+
}
|
297
|
+
get template() {
|
298
|
+
return this._template;
|
299
|
+
}
|
300
|
+
isSelected(item) {
|
301
|
+
return item != null && this.grid.selectedRows.includes(item);
|
302
|
+
}
|
303
|
+
handleChange(item) {
|
304
|
+
if (this.isSelected(item)) {
|
305
|
+
this.grid.selectedRows = this.grid.selectedRows.filter(c => c != item);
|
306
|
+
}
|
307
|
+
else {
|
308
|
+
this.grid.selectedRows.push(item);
|
309
|
+
}
|
310
|
+
}
|
311
|
+
get skeleton() {
|
312
|
+
return false;
|
313
|
+
}
|
314
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXRowSelectColumnComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
315
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.6", type: AXRowSelectColumnComponent, selector: "ax-select-column", inputs: { width: "width", caption: "caption" }, providers: [{ provide: AXDataColumnComponent, useExisting: AXRowSelectColumnComponent }], viewQueries: [{ propertyName: "_template", first: true, predicate: TemplateRef, descendants: true }], usesInheritance: true, ngImport: i0, template: `
|
316
|
+
<ng-template let-row>
|
317
|
+
<input
|
318
|
+
class="ax-checkbox"
|
319
|
+
type="checkbox"
|
320
|
+
[disabled]="!row.data"
|
321
|
+
(change)="handleChange(row.data)"
|
322
|
+
[checked]="isSelected(row.data)"
|
323
|
+
/>
|
324
|
+
</ng-template>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
325
|
+
}
|
326
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXRowSelectColumnComponent, decorators: [{
|
327
|
+
type: Component,
|
328
|
+
args: [{
|
329
|
+
selector: 'ax-select-column',
|
330
|
+
template: `
|
331
|
+
<ng-template let-row>
|
332
|
+
<input
|
333
|
+
class="ax-checkbox"
|
334
|
+
type="checkbox"
|
335
|
+
[disabled]="!row.data"
|
336
|
+
(change)="handleChange(row.data)"
|
337
|
+
[checked]="isSelected(row.data)"
|
338
|
+
/>
|
339
|
+
</ng-template>`,
|
340
|
+
encapsulation: ViewEncapsulation.None,
|
341
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
342
|
+
providers: [{ provide: AXDataColumnComponent, useExisting: AXRowSelectColumnComponent }],
|
343
|
+
inputs: ['width', 'caption']
|
344
|
+
}]
|
345
|
+
}], propDecorators: { _template: [{
|
346
|
+
type: ViewChild,
|
347
|
+
args: [TemplateRef]
|
348
|
+
}] } });
|
349
|
+
|
350
|
+
class AXRowCommandColumnComponent extends AXDataColumnComponent {
|
351
|
+
constructor() {
|
352
|
+
super(...arguments);
|
353
|
+
this.grid = inject(AXDataTableComponent);
|
354
|
+
this.allowSorting = false;
|
355
|
+
this._items = [];
|
356
|
+
this.items = [];
|
357
|
+
this.onItemClick = new EventEmitter();
|
358
|
+
}
|
359
|
+
get template() {
|
360
|
+
return this._template;
|
361
|
+
}
|
362
|
+
get skeleton() {
|
363
|
+
return false;
|
364
|
+
}
|
365
|
+
get cssClass() {
|
366
|
+
return 'ax-command-column';
|
367
|
+
}
|
368
|
+
handleOnItemClick(e, data) {
|
369
|
+
this.onItemClick.emit(Object.assign(e, { component: this.grid, data }));
|
370
|
+
}
|
371
|
+
items$(rowData) {
|
372
|
+
if (Array.isArray(this.items)) {
|
373
|
+
return of(this.items);
|
374
|
+
}
|
375
|
+
else
|
376
|
+
(typeof this.items == 'function');
|
377
|
+
{
|
378
|
+
const result = this.items(rowData);
|
379
|
+
if (Array.isArray(result)) {
|
380
|
+
return of(result);
|
381
|
+
}
|
382
|
+
else if (result instanceof Promise) {
|
383
|
+
let subscriber;
|
384
|
+
const observable = new Observable(observer => {
|
385
|
+
subscriber = observer;
|
386
|
+
});
|
387
|
+
result.then(items => {
|
388
|
+
subscriber?.next(items);
|
389
|
+
});
|
390
|
+
return observable;
|
391
|
+
}
|
392
|
+
}
|
393
|
+
return of([]);
|
394
|
+
}
|
395
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXRowCommandColumnComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
396
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.6", type: AXRowCommandColumnComponent, selector: "ax-command-column", inputs: { width: "width", caption: "caption", items: "items" }, outputs: { onItemClick: "onItemClick" }, providers: [{ provide: AXDataColumnComponent, useExisting: AXRowCommandColumnComponent }], viewQueries: [{ propertyName: "_template", first: true, predicate: TemplateRef, descendants: true }], usesInheritance: true, ngImport: i0, template: `
|
397
|
+
<ng-template let-row>
|
398
|
+
<span #btn *ngIf="row.data">
|
399
|
+
<ax-icon icon="ax-icon ax-icon-more-horizontal"></ax-icon>
|
400
|
+
<ax-dropdown-panel >
|
401
|
+
<ax-button-item-list (onItemClick)="handleOnItemClick($event,row.data)">
|
402
|
+
<ng-container *ngFor="let item of items$(row.data) | async">
|
403
|
+
<ax-button-item [text]="item.text" [name]="item.name" [disabled]="item.disabled" [color]="item.color" >
|
404
|
+
<ax-prefix>
|
405
|
+
<ax-icon [icon]="item.icon"></ax-icon>
|
406
|
+
</ax-prefix>
|
407
|
+
</ax-button-item>
|
408
|
+
<ax-divider *ngIf="item.divided"></ax-divider>
|
409
|
+
</ng-container>
|
410
|
+
</ax-button-item-list>
|
411
|
+
</ax-dropdown-panel>
|
412
|
+
</span>
|
413
|
+
</ng-template>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i2$1.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title , ax-sub-title" }, { kind: "component", type: i3$1.AXButtonItemComponent, selector: "ax-button-item", inputs: ["color", "disabled", "text", "selected", "divided", "data", "name"], outputs: ["onClick", "onFocus", "onBlur", "disabledChange"] }, { kind: "component", type: i3$1.AXButtonItemListComponent, selector: "ax-button-item-list", outputs: ["onItemClick"] }, { kind: "component", type: i4.AXDropdownPanelComponent, selector: "ax-dropdown-panel", inputs: ["isOpen", "fitParent", "dropdownWidth", "position", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
414
|
+
}
|
415
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXRowCommandColumnComponent, decorators: [{
|
416
|
+
type: Component,
|
417
|
+
args: [{
|
418
|
+
selector: 'ax-command-column',
|
419
|
+
template: `
|
420
|
+
<ng-template let-row>
|
421
|
+
<span #btn *ngIf="row.data">
|
422
|
+
<ax-icon icon="ax-icon ax-icon-more-horizontal"></ax-icon>
|
423
|
+
<ax-dropdown-panel >
|
424
|
+
<ax-button-item-list (onItemClick)="handleOnItemClick($event,row.data)">
|
425
|
+
<ng-container *ngFor="let item of items$(row.data) | async">
|
426
|
+
<ax-button-item [text]="item.text" [name]="item.name" [disabled]="item.disabled" [color]="item.color" >
|
427
|
+
<ax-prefix>
|
428
|
+
<ax-icon [icon]="item.icon"></ax-icon>
|
429
|
+
</ax-prefix>
|
430
|
+
</ax-button-item>
|
431
|
+
<ax-divider *ngIf="item.divided"></ax-divider>
|
432
|
+
</ng-container>
|
433
|
+
</ax-button-item-list>
|
434
|
+
</ax-dropdown-panel>
|
435
|
+
</span>
|
436
|
+
</ng-template>`,
|
437
|
+
encapsulation: ViewEncapsulation.None,
|
438
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
439
|
+
providers: [{ provide: AXDataColumnComponent, useExisting: AXRowCommandColumnComponent }],
|
440
|
+
inputs: ['width', 'caption']
|
441
|
+
}]
|
442
|
+
}], propDecorators: { _template: [{
|
443
|
+
type: ViewChild,
|
444
|
+
args: [TemplateRef]
|
445
|
+
}], items: [{
|
446
|
+
type: Input
|
447
|
+
}], onItemClick: [{
|
448
|
+
type: Output
|
449
|
+
}] } });
|
450
|
+
|
451
|
+
const COMPONENT = [
|
452
|
+
AXDataTableComponent,
|
453
|
+
AXDataTextColumnComponent,
|
454
|
+
AXRowIndexColumnComponent,
|
455
|
+
AXRowSelectColumnComponent,
|
456
|
+
AXRowCommandColumnComponent
|
457
|
+
];
|
458
|
+
const MODULES = [
|
459
|
+
CommonModule,
|
460
|
+
ScrollingModule,
|
461
|
+
AXTranslationModule,
|
462
|
+
AXResultModule,
|
463
|
+
AXLoadingModule,
|
464
|
+
AXDecoratorModule,
|
465
|
+
AXSkeletonModule,
|
466
|
+
AXButtonModule,
|
467
|
+
AXDropdownModule
|
468
|
+
];
|
293
469
|
class AXDataTableModule {
|
294
470
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXDataTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
295
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.6", ngImport: i0, type: AXDataTableModule, declarations: [AXDataTableComponent,
|
471
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.6", ngImport: i0, type: AXDataTableModule, declarations: [AXDataTableComponent,
|
472
|
+
AXDataTextColumnComponent,
|
473
|
+
AXRowIndexColumnComponent,
|
474
|
+
AXRowSelectColumnComponent,
|
475
|
+
AXRowCommandColumnComponent], imports: [CommonModule,
|
476
|
+
ScrollingModule,
|
477
|
+
AXTranslationModule,
|
478
|
+
AXResultModule,
|
479
|
+
AXLoadingModule,
|
480
|
+
AXDecoratorModule,
|
481
|
+
AXSkeletonModule,
|
482
|
+
AXButtonModule,
|
483
|
+
AXDropdownModule], exports: [AXDataTableComponent,
|
484
|
+
AXDataTextColumnComponent,
|
485
|
+
AXRowIndexColumnComponent,
|
486
|
+
AXRowSelectColumnComponent,
|
487
|
+
AXRowCommandColumnComponent] }); }
|
296
488
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXDataTableModule, imports: [MODULES] }); }
|
297
489
|
}
|
298
490
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: AXDataTableModule, decorators: [{
|
@@ -309,5 +501,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImpor
|
|
309
501
|
* Generated bundle index. Do not edit.
|
310
502
|
*/
|
311
503
|
|
312
|
-
export { AXDataColumnComponent,
|
504
|
+
export { AXDataColumnComponent, AXDataTableComponent, AXDataTableModule, AXDataTextColumnComponent, AXRowCommandColumnComponent, AXRowIndexColumnComponent, AXRowSelectColumnComponent };
|
313
505
|
//# sourceMappingURL=acorex-components-data-table.mjs.map
|