@bootkit/ng0 0.0.0-alpha.50 → 0.0.0-alpha.52
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/components/pagination/index.d.ts +16 -10
- package/components/select/index.d.ts +2 -3
- package/components/table/index.d.ts +89 -83
- package/fesm2022/bootkit-ng0-components-pagination.mjs +17 -15
- package/fesm2022/bootkit-ng0-components-pagination.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-select.mjs +7 -6
- package/fesm2022/bootkit-ng0-components-select.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-table.mjs +93 -92
- package/fesm2022/bootkit-ng0-components-table.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-http.mjs +4 -4
- package/fesm2022/bootkit-ng0-http.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-icons.mjs +22 -0
- package/fesm2022/bootkit-ng0-icons.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-localization-locales.mjs +7 -1
- package/fesm2022/bootkit-ng0-localization-locales.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-localization.mjs +36 -11
- package/fesm2022/bootkit-ng0-localization.mjs.map +1 -1
- package/icons/index.d.ts +11 -0
- package/localization/index.d.ts +5 -1
- package/package.json +5 -1
|
@@ -1,24 +1,36 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, booleanAttribute, model, signal, TemplateRef, ContentChild, Directive, Input,
|
|
2
|
+
import { inject, EnvironmentInjector, input, booleanAttribute, model, signal, TemplateRef, ContentChild, Directive, Input, DestroyRef, numberAttribute, HostBinding, ContentChildren, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
3
|
+
import * as i4 from '@bootkit/ng0/localization';
|
|
4
|
+
import { defaultFormatter, objectFormatterAttribute, LocalizationService, LocalizationModule } from '@bootkit/ng0/localization';
|
|
3
5
|
import * as i1 from '@angular/common';
|
|
4
6
|
import { CommonModule } from '@angular/common';
|
|
5
7
|
import * as i2 from '@angular/forms';
|
|
6
8
|
import { FormsModule } from '@angular/forms';
|
|
7
9
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
8
10
|
import { formatString } from '@bootkit/ng0/common';
|
|
9
|
-
import * as i4 from '@bootkit/ng0/localization';
|
|
10
|
-
import { LocalizationService, LocalizationModule } from '@bootkit/ng0/localization';
|
|
11
11
|
import { dataSourceAttribute, DataRequest } from '@bootkit/ng0/data';
|
|
12
12
|
import { PaginationComponent } from '@bootkit/ng0/components/pagination';
|
|
13
13
|
import * as i3 from '@angular/cdk/overlay';
|
|
14
14
|
import { OverlayModule } from '@angular/cdk/overlay';
|
|
15
15
|
import { NumberDirective } from '@bootkit/ng0/form';
|
|
16
|
+
import { SelectComponent } from '@bootkit/ng0/components/select';
|
|
17
|
+
import { Filter1Icon } from '@bootkit/ng0/icons';
|
|
16
18
|
|
|
17
19
|
class TableColumnDirective {
|
|
20
|
+
_injector = inject(EnvironmentInjector);
|
|
18
21
|
/**
|
|
19
22
|
* The field in the data source to bind to. If not set, the column will not display any data.
|
|
23
|
+
* @deprecated Use formatBy input.
|
|
20
24
|
*/
|
|
21
25
|
field = input(...(ngDevMode ? [undefined, { debugName: "field" }] : []));
|
|
26
|
+
/**
|
|
27
|
+
* A fromatter to convert each item to a string for display.
|
|
28
|
+
* This can be a function, a string (field name), or an array of formatters.
|
|
29
|
+
* If not set, the default formatter will be used, which simply calls toString() on the value.
|
|
30
|
+
*/
|
|
31
|
+
formatBy = input(defaultFormatter, ...(ngDevMode ? [{ debugName: "formatBy", transform: objectFormatterAttribute(this._injector) }] : [{
|
|
32
|
+
transform: objectFormatterAttribute(this._injector)
|
|
33
|
+
}]));
|
|
22
34
|
/**
|
|
23
35
|
* The title of the column. This will be displayed in the header row.
|
|
24
36
|
*/
|
|
@@ -51,11 +63,6 @@ class TableColumnDirective {
|
|
|
51
63
|
* The current filter value of the column.
|
|
52
64
|
*/
|
|
53
65
|
filterValue = model(...(ngDevMode ? [undefined, { debugName: "filterValue" }] : []));
|
|
54
|
-
/**
|
|
55
|
-
* The field to use for filtering. If not set, the `field` property will be used.
|
|
56
|
-
* @deprecated Use `fieldName` instead.
|
|
57
|
-
*/
|
|
58
|
-
filterField = input(...(ngDevMode ? [undefined, { debugName: "filterField" }] : []));
|
|
59
66
|
/**
|
|
60
67
|
* The current filter operator of the column.
|
|
61
68
|
*/
|
|
@@ -126,7 +133,7 @@ class TableColumnDirective {
|
|
|
126
133
|
}
|
|
127
134
|
}
|
|
128
135
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: TableColumnDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
129
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.11", type: TableColumnDirective, isStandalone: true, selector: "ng0-table-col", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null },
|
|
136
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.11", type: TableColumnDirective, isStandalone: true, selector: "ng0-table-col", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, formatBy: { classPropertyName: "formatBy", publicName: "formatBy", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, emptyCellText: { classPropertyName: "emptyCellText", publicName: "emptyCellText", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, cellClass: { classPropertyName: "cellClass", publicName: "cellClass", isSignal: true, isRequired: false, transformFunction: null }, bold: { classPropertyName: "bold", publicName: "bold", isSignal: true, isRequired: false, transformFunction: null }, shrink: { classPropertyName: "shrink", publicName: "shrink", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null }, filterValue: { classPropertyName: "filterValue", publicName: "filterValue", isSignal: true, isRequired: false, transformFunction: null }, filterOperator: { classPropertyName: "filterOperator", publicName: "filterOperator", isSignal: true, isRequired: false, transformFunction: null }, filterOperators: { classPropertyName: "filterOperators", publicName: "filterOperators", isSignal: true, isRequired: false, transformFunction: null }, fieldName: { classPropertyName: "fieldName", publicName: "fieldName", isSignal: true, isRequired: false, transformFunction: null }, sortable: { classPropertyName: "sortable", publicName: "sortable", isSignal: true, isRequired: false, transformFunction: null }, sortDirection: { classPropertyName: "sortDirection", publicName: "sortDirection", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filterValue: "filterValueChange", filterOperator: "filterOperatorChange", sortDirection: "sortDirectionChange" }, queries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0 });
|
|
130
137
|
}
|
|
131
138
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: TableColumnDirective, decorators: [{
|
|
132
139
|
type: Directive,
|
|
@@ -134,7 +141,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImpo
|
|
|
134
141
|
selector: 'ng0-table-col',
|
|
135
142
|
standalone: true,
|
|
136
143
|
}]
|
|
137
|
-
}], ctorParameters: () => [], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }],
|
|
144
|
+
}], ctorParameters: () => [], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }], formatBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatBy", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], emptyCellText: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyCellText", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], cellClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "cellClass", required: false }] }], bold: [{ type: i0.Input, args: [{ isSignal: true, alias: "bold", required: false }] }], shrink: [{ type: i0.Input, args: [{ isSignal: true, alias: "shrink", required: false }] }], filterable: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterable", required: false }] }], filterValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterValue", required: false }] }, { type: i0.Output, args: ["filterValueChange"] }], filterOperator: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterOperator", required: false }] }, { type: i0.Output, args: ["filterOperatorChange"] }], filterOperators: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterOperators", required: false }] }], fieldName: [{ type: i0.Input, args: [{ isSignal: true, alias: "fieldName", required: false }] }], sortable: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortable", required: false }] }], sortDirection: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortDirection", required: false }] }, { type: i0.Output, args: ["sortDirectionChange"] }], template: [{
|
|
138
145
|
type: ContentChild,
|
|
139
146
|
args: [TemplateRef]
|
|
140
147
|
}] } });
|
|
@@ -170,19 +177,16 @@ class TableComponent {
|
|
|
170
177
|
_columns;
|
|
171
178
|
_detailRow;
|
|
172
179
|
_dataResult = signal(undefined, ...(ngDevMode ? [{ debugName: "_dataResult" }] : []));
|
|
173
|
-
|
|
174
|
-
_loadingRequest; // The current data request being processed
|
|
180
|
+
_error = signal(undefined, ...(ngDevMode ? [{ debugName: "_error" }] : []));
|
|
175
181
|
_rowStates = new Map();
|
|
176
182
|
_formatString = formatString;
|
|
177
|
-
_dataSource;
|
|
178
183
|
_pagingFormatter;
|
|
179
|
-
_lastError;
|
|
180
184
|
/**
|
|
181
185
|
* The data source for the table.
|
|
182
186
|
* This can be an array of data, a function that returns an observable of data,
|
|
183
187
|
* or an instance of DataSource.
|
|
184
188
|
*/
|
|
185
|
-
source = input.required(...(ngDevMode ? [{ debugName: "source" }] : []));
|
|
189
|
+
source = input.required(...(ngDevMode ? [{ debugName: "source", transform: dataSourceAttribute }] : [{ transform: dataSourceAttribute }]));
|
|
186
190
|
/**
|
|
187
191
|
* If true, the table will automatically load data when initialized.
|
|
188
192
|
* This is useful for tables that need to display data immediately without user interaction.
|
|
@@ -199,42 +203,58 @@ class TableComponent {
|
|
|
199
203
|
showHeader = input(true, ...(ngDevMode ? [{ debugName: "showHeader", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
200
204
|
/**
|
|
201
205
|
* If true, the table will support pagination.
|
|
202
|
-
* If false, the table will load all records at once.
|
|
203
206
|
*/
|
|
204
|
-
pageable = input(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
207
|
+
pageable = input(false, ...(ngDevMode ? [{ debugName: "pageable", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
208
|
+
/**
|
|
209
|
+
* The currently selected page in the table.
|
|
210
|
+
* @default 0
|
|
211
|
+
*/
|
|
212
|
+
pageIndex = model(0, ...(ngDevMode ? [{ debugName: "pageIndex" }] : []));
|
|
213
|
+
/**
|
|
214
|
+
* The number of records to display per page.
|
|
215
|
+
* @default 10
|
|
216
|
+
*/
|
|
217
|
+
pageSize = model(10, ...(ngDevMode ? [{ debugName: "pageSize" }] : []));
|
|
218
|
+
/**
|
|
219
|
+
* Maximum number of visible pages in the pagination controls.
|
|
220
|
+
* @default 10
|
|
221
|
+
*/
|
|
222
|
+
maxVisiblePages = input(10, ...(ngDevMode ? [{ debugName: "maxVisiblePages", transform: numberAttribute }] : [{ transform: numberAttribute }]));
|
|
223
|
+
/**
|
|
224
|
+
* If true, the table will show pagination controls at the bottom.
|
|
225
|
+
* This will allow users to navigate between pages of data.
|
|
226
|
+
* @default true
|
|
227
|
+
*/
|
|
228
|
+
showPagingControls = input(true, ...(ngDevMode ? [{ debugName: "showPagingControls", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
229
|
+
/**
|
|
230
|
+
* Whether to show the first and last buttons in the pagination controls.
|
|
231
|
+
* @default true
|
|
232
|
+
*/
|
|
233
|
+
showFirstLastButtons = input(false, ...(ngDevMode ? [{ debugName: "showFirstLastButtons", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
234
|
+
/**
|
|
235
|
+
* Whetheer to show the next and previous buttons in the pagination controls.
|
|
236
|
+
* @default true
|
|
237
|
+
*/
|
|
238
|
+
showNextPreviousButtons = input(false, ...(ngDevMode ? [{ debugName: "showNextPreviousButtons", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
239
|
+
/**
|
|
240
|
+
* Array of page size options to display in the page size selector.
|
|
241
|
+
* If not provided, the default page size options will be used.
|
|
242
|
+
* @default true
|
|
243
|
+
*/
|
|
244
|
+
pageSizeOptions = input([10, 25, 50, 100], ...(ngDevMode ? [{ debugName: "pageSizeOptions" }] : []));
|
|
245
|
+
/**
|
|
246
|
+
* Whether to show paging info at the bottom of the table.
|
|
247
|
+
* This will show the number of records displayed and total records.
|
|
248
|
+
* @default true
|
|
249
|
+
*/
|
|
250
|
+
showPagingInfo = input(true, ...(ngDevMode ? [{ debugName: "showPagingInfo", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
231
251
|
/**
|
|
232
252
|
* If true, the table will support sorting.
|
|
233
253
|
* This will add a sort icon to each column header.
|
|
234
254
|
*/
|
|
235
255
|
sortable = input(true, ...(ngDevMode ? [{ debugName: "sortable", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
236
256
|
/**
|
|
237
|
-
* The CSS class to apply to the table element.
|
|
257
|
+
* The CSS class to apply to the internal table element.
|
|
238
258
|
* This can be used to apply custom styles to the table.
|
|
239
259
|
*/
|
|
240
260
|
tableClass = input(...(ngDevMode ? [undefined, { debugName: "tableClass" }] : []));
|
|
@@ -259,40 +279,14 @@ class TableComponent {
|
|
|
259
279
|
/**
|
|
260
280
|
* The indicator to show while the table is loading data for the first time.
|
|
261
281
|
*/
|
|
262
|
-
loadingIndicator = input('spinner', ...(ngDevMode ? [{ debugName: "loadingIndicator"
|
|
263
|
-
if (typeof v === 'boolean') {
|
|
264
|
-
return v ? 'spinner' : 'none';
|
|
265
|
-
}
|
|
266
|
-
return v;
|
|
267
|
-
} }] : [{
|
|
268
|
-
transform: v => {
|
|
269
|
-
if (typeof v === 'boolean') {
|
|
270
|
-
return v ? 'spinner' : 'none';
|
|
271
|
-
}
|
|
272
|
-
return v;
|
|
273
|
-
}
|
|
274
|
-
}]));
|
|
282
|
+
loadingIndicator = input('spinner', ...(ngDevMode ? [{ debugName: "loadingIndicator" }] : []));
|
|
275
283
|
/** If true, the table will show a loading cover while data is being loaded.
|
|
276
284
|
* This can be used to prevent user interaction with the table while loading.
|
|
277
285
|
* This cover is not displayed when the table is loading for the first time.
|
|
278
286
|
* Instead, the table will show a loading based on loadingIndicator settings.
|
|
279
287
|
*/
|
|
280
|
-
loadingCover = input('spinner', ...(ngDevMode ? [{ debugName: "loadingCover"
|
|
281
|
-
if (typeof v === 'boolean') {
|
|
282
|
-
return v ? 'spinner' : 'none';
|
|
283
|
-
}
|
|
284
|
-
return v;
|
|
285
|
-
} }] : [{
|
|
286
|
-
transform: v => {
|
|
287
|
-
if (typeof v === 'boolean') {
|
|
288
|
-
return v ? 'spinner' : 'none';
|
|
289
|
-
}
|
|
290
|
-
return v;
|
|
291
|
-
}
|
|
292
|
-
}]));
|
|
293
|
-
// @Input() rowColor?: (row: any) => BootstrapColor;
|
|
288
|
+
loadingCover = input('spinner', ...(ngDevMode ? [{ debugName: "loadingCover" }] : []));
|
|
294
289
|
ngAfterContentInit() {
|
|
295
|
-
this._dataSource = dataSourceAttribute(this.source());
|
|
296
290
|
const locale = this._ls.get();
|
|
297
291
|
this._pagingFormatter = locale?.definition.components?.table?.pagingInfo ??
|
|
298
292
|
((o) => `Showing ${o.firstRecord}-${o.lastRecord} of ${o.totalRecords} records`);
|
|
@@ -300,28 +294,33 @@ class TableComponent {
|
|
|
300
294
|
// this.reload();
|
|
301
295
|
// });
|
|
302
296
|
if (this.autoLoad()) {
|
|
303
|
-
this.load(
|
|
297
|
+
this.load();
|
|
304
298
|
}
|
|
305
299
|
}
|
|
306
300
|
/**
|
|
307
|
-
*
|
|
308
|
-
*
|
|
301
|
+
* Loads data from the data source based on the current state of the table (pagination, sorting, filtering).
|
|
302
|
+
* This method can be called manually to refresh the data in the table.
|
|
303
|
+
* It will construct a DataRequest object based on the current pagination, sorting, and filtering settings,
|
|
304
|
+
* and then call the load method of the data source with that request.
|
|
309
305
|
*/
|
|
310
306
|
load(pageIndex) {
|
|
311
|
-
let page;
|
|
312
307
|
let filters = [];
|
|
308
|
+
let page;
|
|
313
309
|
let sort;
|
|
314
310
|
if (this.filterable()) {
|
|
315
311
|
this._columns.forEach(col => {
|
|
316
312
|
if (col.filterable() && col.filterValue() != '' && col.filterValue() != undefined) {
|
|
317
|
-
filters.push({ field: col.fieldName() ?? col.
|
|
313
|
+
filters.push({ field: col.fieldName() ?? col.field(), value: col.filterValue(), operator: col.filterOperator() });
|
|
318
314
|
}
|
|
319
315
|
});
|
|
320
316
|
}
|
|
321
317
|
if (this.pageable()) {
|
|
318
|
+
if (pageIndex != undefined) {
|
|
319
|
+
this.pageIndex.set(pageIndex);
|
|
320
|
+
}
|
|
322
321
|
page = {
|
|
323
|
-
index:
|
|
324
|
-
size: this.
|
|
322
|
+
index: this.pageIndex(),
|
|
323
|
+
size: this.pageSize(),
|
|
325
324
|
};
|
|
326
325
|
}
|
|
327
326
|
if (this.sortable()) {
|
|
@@ -333,18 +332,14 @@ class TableComponent {
|
|
|
333
332
|
};
|
|
334
333
|
}
|
|
335
334
|
}
|
|
336
|
-
|
|
337
|
-
this.
|
|
335
|
+
var request = new DataRequest({ page, filters, sort, select: [], computeTotal: true });
|
|
336
|
+
this.source().load(request)
|
|
338
337
|
.pipe(takeUntilDestroyed(this._destroyRef)).subscribe({
|
|
339
338
|
next: result => {
|
|
340
339
|
this._dataResult.set(result);
|
|
341
|
-
this.
|
|
342
|
-
this._loadingRequest = undefined;
|
|
343
|
-
this._lastError = undefined;
|
|
340
|
+
this._error.set(undefined);
|
|
344
341
|
}, error: err => {
|
|
345
|
-
this.
|
|
346
|
-
this._lastRequest = this._loadingRequest;
|
|
347
|
-
this._loadingRequest = undefined;
|
|
342
|
+
this._error.set(err);
|
|
348
343
|
}
|
|
349
344
|
});
|
|
350
345
|
}
|
|
@@ -352,7 +347,7 @@ class TableComponent {
|
|
|
352
347
|
* Determines if the table is currently loading data.
|
|
353
348
|
*/
|
|
354
349
|
get isLoading() {
|
|
355
|
-
return this.
|
|
350
|
+
return this.source().isLoading;
|
|
356
351
|
}
|
|
357
352
|
_getCellValue(row, col) {
|
|
358
353
|
var subFields = col.field().split('.');
|
|
@@ -394,11 +389,15 @@ class TableComponent {
|
|
|
394
389
|
this._columns.forEach(x => x.showFilterOperators.set(false));
|
|
395
390
|
this.load(0);
|
|
396
391
|
}
|
|
392
|
+
_onPageSizeOptionsItemSelect(e) {
|
|
393
|
+
this.pageSize.set(e.value);
|
|
394
|
+
this.load(0);
|
|
395
|
+
}
|
|
397
396
|
ngOnDestroy() {
|
|
398
397
|
this._changeSubscription?.unsubscribe();
|
|
399
398
|
}
|
|
400
399
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
401
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.11", type: TableComponent, isStandalone: true, selector: "ng0-table", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, autoLoad: { classPropertyName: "autoLoad", publicName: "autoLoad", isSignal: true, isRequired: false, transformFunction: null }, showRowNumbers: { classPropertyName: "showRowNumbers", publicName: "showRowNumbers", isSignal: true, isRequired: false, transformFunction: null }, showHeader: { classPropertyName: "showHeader", publicName: "showHeader", isSignal: true, isRequired: false, transformFunction: null }, pageable: { classPropertyName: "pageable", publicName: "pageable", isSignal: true, isRequired: false, transformFunction: null }, sortable: { classPropertyName: "sortable", publicName: "sortable", isSignal: true, isRequired: false, transformFunction: null }, tableClass: { classPropertyName: "tableClass", publicName: "tableClass", isSignal: true, isRequired: false, transformFunction: null }, headerClass: { classPropertyName: "headerClass", publicName: "headerClass", isSignal: true, isRequired: false, transformFunction: null }, caption: { classPropertyName: "caption", publicName: "caption", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null }, loadingIndicator: { classPropertyName: "loadingIndicator", publicName: "loadingIndicator", isSignal: true, isRequired: false, transformFunction: null }, loadingCover: { classPropertyName: "loadingCover", publicName: "loadingCover", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.ng0-loading": "this.isLoading" } }, queries: [{ propertyName: "_detailRow", first: true, predicate: TableDetailRowDirective, descendants: true }, { propertyName: "_columns", predicate: TableColumnDirective }], exportAs: ["ng0Table"], ngImport: i0, template: "@let $dataResult = _dataResult();\n@let $pageable = pageable();\n@let $pageIndex = _lastRequest?.page?.index ?? 1;\n@let $data = $dataResult?.data;\n@let $anyRecords = $data && $data.length > 0;\n@let $totalRecordsCount = $dataResult?.total;\n@let $firstRecord = $pageable ? ($pageable.pageSize! * ($pageIndex - 1) + 1) : 1;\n@let $lastRecord = $data ? $firstRecord + $data.length - 1 : 1;\n@let $isLoading = _dataSource.isLoading();\n@let $isFirstLoad = $dataResult == undefined;\n@let $columnsCount = _columns.length + (showRowNumbers() ? 1 : 0);\n@let $tableLocale = _ls.get()?.definition?.components?.table;\n\n<div class=\"table-responsive\" [style.height]=\"height()\" [class.table-scrollable]=\"height()! > 0\">\n <table class=\"table\" [ngClass]=\"tableClass()\">\n @if (caption()) {\n <caption>{{caption()}}</caption>\n }\n\n @if (showHeader()) {\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n }\n\n @if (filterable()) {\n <ng-container *ngTemplateOutlet=\"filtersTemplate\"></ng-container>\n }\n\n <tbody>\n @if ($isLoading && $isFirstLoad && loadingIndicator()) {\n <tr class=\"ng0-table-loading-row\">\n <td [attr.colspan]=\"$columnsCount\">\n @switch (loadingIndicator()) {\n @case ('spinner') {\n <div class=\"text-center\">\n <div class=\"spinner-border\" role=\"status\"></div>\n </div>\n }\n }\n </td>\n </tr>\n } @else {\n @if ($data) {\n @if ($data.length > 0) {\n <ng-container *ngTemplateOutlet=\"dataRowsTemplate\"></ng-container>\n } @else {\n <tr class=\"ng0-table-no-records-row\">\n <td [attr.colSpan]=\"$columnsCount\" class=\"text-center p-2\">\n {{ $tableLocale?.noRecords ?? 'No Records.' }}\n </td>\n </tr>\n }\n } @else if (_lastError) {\n <ng-container *ngTemplateOutlet=\"nowDataTemplate\"></ng-container>\n }\n }\n </tbody>\n </table>\n</div>\n\n<div class=\"ng0-table-footer d-flex align-items-baseline\">\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\n</div>\n\n@if ($isLoading && !$isFirstLoad && loadingCover()) {\n<div class=\"ng0-table-loading-cover text-center\">\n @if (loadingCover() == 'spinner') {\n <div class=\"spinner-border\" role=\"status\"></div>\n }\n</div>\n}\n\n<ng-template #filtersTemplate>\n <thead>\n <tr>\n @if (_detailRow) {\n <th></th>\n }\n\n @if (showRowNumbers()) {\n <th></th>\n }\n\n @for (col of _columns; track $index) {\n <th>\n @if(col.filterable() && (col.field() || col.filterValue())) {\n\n <div class=\"input-group\">\n @switch (col.type()) {\n @case ('text') {\n <input [name]=\"'filter-' + col.field\"\n type=\"search\"\n [maxlength]=\"50\"\n class=\"form-control form-control-sm\"\n [(ngModel)]=\"col.filterValue\"\n (keydown.enter)=\"load(0)\">\n }\n @case ('number') {\n <input [name]=\"'datatablecol-' + col.field\"\n type=\"search\"\n ng0Number\n class=\"form-control form-control-sm\"\n [(ngModel)]=\"col.filterValue\"\n (keydown.enter)=\"load(0)\">\n }\n }\n\n <button class=\"btn btn-outline-light\"\n style=\"border-color: var(--bs-border-color);\"\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n (click)=\"_onToggleFilterOperator(col)\">\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M19 3H5C3.58579 3 2.87868 3 2.43934 3.4122C2 3.8244 2 4.48782 2 5.81466V6.50448C2 7.54232 2 8.06124 2.2596 8.49142C2.5192 8.9216 2.99347 9.18858 3.94202 9.72255L6.85504 11.3624C7.49146 11.7206 7.80967 11.8998 8.03751 12.0976C8.51199 12.5095 8.80408 12.9935 8.93644 13.5872C9 13.8722 9 14.2058 9 14.8729L9 17.5424C9 18.452 9 18.9067 9.25192 19.2613C9.50385 19.6158 9.95128 19.7907 10.8462 20.1406C12.7248 20.875 13.6641 21.2422 14.3321 20.8244C15 20.4066 15 19.4519 15 17.5424V14.8729C15 14.2058 15 13.8722 15.0636 13.5872C15.1959 12.9935 15.488 12.5095 15.9625 12.0976C16.1903 11.8998 16.5085 11.7206 17.145 11.3624L20.058 9.72255C21.0065 9.18858 21.4808 8.9216 21.7404 8.49142C22 8.06124 22 7.54232 22 6.50448V5.81466C22 4.48782 22 3.8244 21.5607 3.4122C21.1213 3 20.4142 3 19 3Z\"\n stroke=\"#1C274C\" stroke-width=\"1.5\" />\n </svg>\n </button>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"col.showFilterOperators()\"\n (overlayOutsideClick)=\"col.showFilterOperators.set(false)\"\n (detach)=\"col.showFilterOperators.set(false)\">\n <ul class=\"dropdown-menu show\" animate.enter=\"fade-in\">\n @for (item of col.getFilterOperators(); track $index) {\n <li>\n <button class=\"dropdown-item\" [class.active]=\"item == col.filterOperator()\"\n (click)=\"_onSelectFilterOperator(col, item)\">\n {{_ls.get()?.definition?.data?.logicalOperators?.[item] ?? item }}\n </button>\n </li>\n }\n </ul>\n </ng-template>\n }\n </th>\n }\n </tr>\n </thead>\n</ng-template>\n\n<ng-template #headerTemplate>\n <thead [ngClass]=\"headerClass()\">\n <tr>\n @if (_detailRow) {\n <th></th>\n }\n\n @if (showRowNumbers()) {\n <th class=\"row-number text-muted\">#</th>\n }\n\n @for (col of _columns; track $index) {\n <th\n (click)=\"col.toggleSortDirection(); load()\"\n [class.sortable]=\"sortable() && col.sortable()\"\n [ngClass]=\"{ \n 'sort-asc': col.sortDirection() == 'asc', \n 'sort-desc': col.sortDirection() == 'desc',\n 'sort-none': col.sortDirection() == 'none'\n }\">\n {{ col.title() }}\n\n @if(sortable() && col.sortable()) {\n <svg class=\"ng0-table-sort-icon\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\" fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 7L12 16\" stroke=\"currentColor\" stroke-width=\"1\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n <path d=\"M8 13L12 17L16 13\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"\n stroke-linejoin=\"round\" />\n </svg>\n }\n </th>\n }\n </tr>\n </thead>\n</ng-template>\n\n<ng-template #dataRowsTemplate>\n @for (row of $data; track $index) {\n <tr [class.table-active]=\"isRowExpanded(row)\">\n @if (_detailRow) {\n <td class=\"detail-row-expander\">\n @if (_detailRow.showCallback == null || _detailRow.showCallback(row)) {\n <button class=\"btn\" (click)=\"_onToggleRowDetailClick(row)\">\n @if (isRowExpanded(row)) {\n <i class=\"far fa-minus\"></i>\n } @else {\n <i class=\"far fa-plus\"></i>\n }\n </button>\n }\n </td>\n }\n\n @if (showRowNumbers()) {\n <td class=\"ng0-table-row-number\">\n {{ $firstRecord + $index }}\n </td>\n }\n\n @for (col of _columns; track $index) {\n <td\n [ngClass]=\"col.cellClass()\"\n [class.shrinked]=\"col.shrink()\"\n [class.fw-bold]=\"col.bold()\">\n @if (col.template) {\n <ng-container *ngTemplateOutlet=\"col.template; context: { $implicit: row }\">\n </ng-container>\n } @else if (col.field()) {\n @let cellValue = _getCellValue(row, col);\n\n @if ((cellValue === null || cellValue === undefined) && col.emptyCellText()) {\n {{ col.emptyCellText() }}\n } @else {\n @if (col.type()) {\n @let type = $any(col.type());\n\n @if (type == \"date\") {\n {{ cellValue | ng0Date }}\n } @else if (type == \"number\") {\n {{ cellValue | number }}\n } @else if (type == \"currency\") {\n {{ cellValue | currency }}\n } @else if (type.enum) {\n {{ cellValue | ng0TranslateEnum: type.enum.name : type.enum.fallback }}\n } @else if (type.boolean || type == \"boolean\") {\n {{ cellValue | ng0LocalizeBool: type.boolean.false ?? \"false\" : type.boolean.false ?? \"true\" }}\n }@else {\n {{ cellValue }}\n }\n }\n }\n }\n </td>\n }\n </tr>\n\n @if (_detailRow && isRowExpanded(row)) {\n <tr class=\"detail-row\">\n <td\n [attr.colspan]=\"_columns.length + (showRowNumbers() ? 1 : 0) + 1\"\n class=\"ps-2 pb-4\">\n <ng-container\n *ngTemplateOutlet=\"_detailRow.templateRef; context: { $implicit: row }\"></ng-container>\n </td>\n </tr>\n }\n }\n</ng-template>\n\n<ng-template #footerTemplate>\n @if ($pageable && $pageable.showPagingControls && $anyRecords && $totalRecordsCount! > 0) {\n <div class=\"ng0-table-pagination me-2\">\n <ng0-pagination\n class=\"mb-0 d-inline-block\"\n [showFirstLastButtons]=\"$pageable.showFirstLastButtons == true\"\n [showNextPreviousButtons]=\"$pageable.showNextPreviousButtons == true\"\n [totalRecords]=\"$totalRecordsCount!\"\n [pageSize]=\"$pageable.pageSize!\"\n [selectedPage]=\"$pageIndex\"\n (itemClick)=\"_onPageChange($event)\"\n [maxVisiblePages]=\"$pageable.maxVisiblePages!\">\n <ng-container ngProjectAs=\"first\">\n <ng-content select=\"paging-first\">\n {{ \"first\" | ng0Translate }}\n </ng-content>\n </ng-container>\n\n <ng-container ngProjectAs=\"last\">\n <ng-content select=\"paging-last\">\n {{ \"last\" | ng0Translate }}\n </ng-content>\n </ng-container>\n\n <ng-container ngProjectAs=\"next\">\n <ng-content select=\"paging-next\">\n {{ \"next\" | ng0Translate }}\n </ng-content>\n </ng-container>\n\n <ng-container ngProjectAs=\"previous\">\n <ng-content select=\"paging-previous\">\n {{ \"previous\" | ng0Translate }}\n </ng-content>\n </ng-container>\n </ng0-pagination>\n </div>\n\n @if ($pageable.showPageSizeOptions || $pageable.showPageSizeOptions == undefined) {\n <div class=\"ng0-table-paging-options\">\n <select name=\"pageSizeOptions\" class=\"form-select w-auto d-inline-block\">\n <option [ngValue]=\"10\" selected>10</option>\n </select>\n </div>\n }\n\n @if ($pageable.showPagingInfo == undefined || $pageable.showPagingInfo) {\n <div class=\"ng0-table-paging-info ms-auto\">\n <ng-content select=\"paging-info\">\n {{\n _pagingFormatter({firstRecord: $firstRecord, lastRecord: $lastRecord, totalRecords: $totalRecordsCount!,\n currentPage: $pageIndex!})\n }}\n </ng-content>\n </div>\n }\n }\n</ng-template>\n\n<ng-template #nowDataTemplate>\n <tr class=\"ng0-table-error-row\">\n <td [attr.colSpan]=\"$columnsCount\" class=\"p-2\">\n <div class=\"d-flex align-items-baseline\">\n <span>{{ $tableLocale?.loadError ?? 'Error loading data.' }} </span>\n <button (click)=\"load()\" class=\"btn btn-warning ms-auto\">\n {{ \"retry\" | ng0Translate }}\n </button>\n </div>\n </td>\n </tr>\n</ng-template>", styles: [":host{display:flex;flex-direction:column;position:relative}@starting-style{.ng0-table-loading-cover{background-color:#0000}}table{margin-bottom:0}th.sortable{cursor:pointer;-webkit-user-select:none;user-select:none}th.sortable .ng0-table-sort-icon{transition:transform .2s;opacity:0}th.sortable.sort-none:hover .ng0-table-sort-icon{opacity:.4}th.sortable.sort-asc .ng0-table-sort-icon{transform:rotate(0);opacity:1;color:var(--bs-danger)}th.sortable.sort-desc .ng0-table-sort-icon{transform:rotate(180deg);opacity:1;color:var(--bs-primary)}tbody{position:relative}td.row-number{width:0}td.shrinked{width:0;white-space:nowrap}.ng0-table-loading-cover{position:absolute;inset:0;background-color:#0000000d;transition:background-color .2s;z-index:1000;display:flex;align-items:center;justify-content:center}.table-scrollable{overflow-y:auto;direction:ltr;scroll-padding:20px}.table-scrollable::-webkit-scrollbar{width:8px}.table-scrollable::-webkit-scrollbar-track{background-color:#00000008}.table-scrollable::-webkit-scrollbar-thumb{background-color:var(--bs-secondary)}.table-scrollable thead th{position:sticky;top:0}.ng0-table-footer{margin-top:.5rem}.fade-in{animation:fade-in .5s}@keyframes fade-in{0%{opacity:0}to{opacity:1}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: LocalizationModule }, { kind: "component", type: PaginationComponent, selector: "ng0-pagination", inputs: ["totalRecords", "pageSize", "selectedPage", "maxVisiblePages", "showNextPreviousButtons", "showFirstLastButtons"], outputs: ["itemClick"], exportAs: ["ng0Pagination"] }, { kind: "directive", type: NumberDirective, selector: "[ng0Number]", inputs: ["minFractionDigits", "maxFractionDigits", "useGrouping", "numberType"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i3.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i3.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "pipe", type: i1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i4.TranslatePipe, name: "ng0Translate" }, { kind: "pipe", type: i4.TranslateEnumPipe, name: "ng0TranslateEnum" }, { kind: "pipe", type: i4.DatePipe, name: "ng0Date" }, { kind: "pipe", type: i4.LocalizeBooleanPipe, name: "ng0LocalizeBool" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
400
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.11", type: TableComponent, isStandalone: true, selector: "ng0-table", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, autoLoad: { classPropertyName: "autoLoad", publicName: "autoLoad", isSignal: true, isRequired: false, transformFunction: null }, showRowNumbers: { classPropertyName: "showRowNumbers", publicName: "showRowNumbers", isSignal: true, isRequired: false, transformFunction: null }, showHeader: { classPropertyName: "showHeader", publicName: "showHeader", isSignal: true, isRequired: false, transformFunction: null }, pageable: { classPropertyName: "pageable", publicName: "pageable", isSignal: true, isRequired: false, transformFunction: null }, pageIndex: { classPropertyName: "pageIndex", publicName: "pageIndex", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, maxVisiblePages: { classPropertyName: "maxVisiblePages", publicName: "maxVisiblePages", isSignal: true, isRequired: false, transformFunction: null }, showPagingControls: { classPropertyName: "showPagingControls", publicName: "showPagingControls", isSignal: true, isRequired: false, transformFunction: null }, showFirstLastButtons: { classPropertyName: "showFirstLastButtons", publicName: "showFirstLastButtons", isSignal: true, isRequired: false, transformFunction: null }, showNextPreviousButtons: { classPropertyName: "showNextPreviousButtons", publicName: "showNextPreviousButtons", isSignal: true, isRequired: false, transformFunction: null }, pageSizeOptions: { classPropertyName: "pageSizeOptions", publicName: "pageSizeOptions", isSignal: true, isRequired: false, transformFunction: null }, showPagingInfo: { classPropertyName: "showPagingInfo", publicName: "showPagingInfo", isSignal: true, isRequired: false, transformFunction: null }, sortable: { classPropertyName: "sortable", publicName: "sortable", isSignal: true, isRequired: false, transformFunction: null }, tableClass: { classPropertyName: "tableClass", publicName: "tableClass", isSignal: true, isRequired: false, transformFunction: null }, headerClass: { classPropertyName: "headerClass", publicName: "headerClass", isSignal: true, isRequired: false, transformFunction: null }, caption: { classPropertyName: "caption", publicName: "caption", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null }, loadingIndicator: { classPropertyName: "loadingIndicator", publicName: "loadingIndicator", isSignal: true, isRequired: false, transformFunction: null }, loadingCover: { classPropertyName: "loadingCover", publicName: "loadingCover", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pageIndex: "pageIndexChange", pageSize: "pageSizeChange" }, host: { properties: { "class.ng0-loading": "this.isLoading" } }, queries: [{ propertyName: "_detailRow", first: true, predicate: TableDetailRowDirective, descendants: true }, { propertyName: "_columns", predicate: TableColumnDirective }], exportAs: ["ng0Table"], ngImport: i0, template: "@let $dataResult = _dataResult();\n@let $pageable = pageable();\n@let $pageIndex = pageIndex();\n@let $pageSize = pageSize();\n@let $data = $dataResult?.data;\n@let $anyRecords = $data && $data.length > 0;\n@let $totalRecordsCount = $dataResult?.total;\n@let $firstRecordIndex = $pageable ? ($pageSize * $pageIndex) : 0;\n@let $lastRecordIndex = $data ? $firstRecordIndex + $data.length - 1 : 1;\n@let $isFirstLoad = $dataResult == undefined;\n@let $columnsCount = _columns.length + (showRowNumbers() ? 1 : 0);\n@let $tableLocale = _ls.get()?.definition?.components?.table;\n\n<div class=\"table-responsive\" [style.height]=\"height()\" [class.table-scrollable]=\"height()! > 0\">\n <table class=\"table\" [ngClass]=\"tableClass()\">\n @if (caption()) {\n <caption>\n {{caption()}}\n </caption>\n }\n\n @if (showHeader()) {\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n }\n\n @if (filterable()) {\n <ng-container *ngTemplateOutlet=\"filtersTemplate\"></ng-container>\n }\n\n <tbody>\n @if (isLoading() && $isFirstLoad && loadingIndicator()) {\n <tr class=\"ng0-table-loading-row\">\n <td [attr.colspan]=\"$columnsCount\">\n @switch (loadingIndicator()) {\n @case ('spinner') {\n <div class=\"text-center\">\n <div class=\"spinner-border\" role=\"status\"></div>\n </div>\n }\n }\n </td>\n </tr>\n } @else {\n @if ($data) {\n @if ($data.length > 0) {\n <ng-container *ngTemplateOutlet=\"dataRowsTemplate\" />\n } @else {\n <tr class=\"ng0-table-no-records-row\">\n <td [attr.colSpan]=\"$columnsCount\" class=\"text-center p-2\">\n {{ $tableLocale?.noRecords ?? 'No Records.' }}\n </td>\n </tr>\n }\n } @else if (_error()) {\n <ng-container *ngTemplateOutlet=\"nowDataTemplate\"></ng-container>\n }\n }\n </tbody>\n </table>\n</div>\n\n<div class=\"ng0-table-footer d-flex align-items-baseline\">\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\n</div>\n\n@if (isLoading() && !$isFirstLoad && loadingCover()) {\n <div class=\"ng0-table-loading-cover text-center\">\n @if (loadingCover() == 'spinner') {\n <div class=\"spinner-border\" role=\"status\"></div>\n }\n </div>\n}\n\n<ng-template #filtersTemplate>\n <thead>\n <tr>\n @if (_detailRow) {\n <th></th>\n }\n\n @if (showRowNumbers()) {\n <th></th>\n }\n\n @for (col of _columns; track $index) {\n <th>\n @if (col.filterable() && (col.field() || col.filterValue())) {\n <div class=\"input-group\">\n @switch (col.type()) {\n @case ('text') {\n <input\n [name]=\"'filter-' + col.field\"\n type=\"search\"\n [maxlength]=\"50\"\n class=\"form-control form-control-sm\"\n [(ngModel)]=\"col.filterValue\"\n (keydown.enter)=\"load(0)\" />\n }\n @case ('number') {\n <input\n [name]=\"'datatablecol-' + col.field\"\n type=\"search\"\n ng0Number\n class=\"form-control form-control-sm\"\n [(ngModel)]=\"col.filterValue\"\n (keydown.enter)=\"load(0)\" />\n }\n }\n\n <button\n class=\"btn btn-outline-light\"\n style=\"border-color: var(--bs-border-color);\"\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n (click)=\"_onToggleFilterOperator(col)\">\n <ng0-icon-filter1 />\n </button>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"col.showFilterOperators()\"\n (overlayOutsideClick)=\"col.showFilterOperators.set(false)\"\n (detach)=\"col.showFilterOperators.set(false)\">\n <ul class=\"dropdown-menu show\" animate.enter=\"fade-in\">\n @for (item of col.getFilterOperators(); track $index) {\n <li>\n <button\n class=\"dropdown-item\"\n [class.active]=\"item == col.filterOperator()\"\n (click)=\"_onSelectFilterOperator(col, item)\">\n {{_ls.get()?.definition?.data?.logicalOperators?.[item] ?? item }}\n </button>\n </li>\n }\n </ul>\n </ng-template>\n }\n </th>\n }\n </tr>\n </thead>\n</ng-template>\n\n<ng-template #headerTemplate>\n <thead [ngClass]=\"headerClass()\">\n <tr>\n @if (_detailRow) {\n <th></th>\n }\n\n @if (showRowNumbers()) {\n <th class=\"row-number text-muted\">#</th>\n }\n\n @for (col of _columns; track $index) {\n <th\n (click)=\"col.toggleSortDirection(); load()\"\n [class.sortable]=\"sortable() && col.sortable()\"\n [ngClass]=\"{ \n 'sort-asc': col.sortDirection() == 'asc', \n 'sort-desc': col.sortDirection() == 'desc',\n 'sort-none': col.sortDirection() == 'none'\n }\">\n {{ col.title() }}\n\n @if (sortable() && col.sortable()) {\n <svg\n class=\"ng0-table-sort-icon\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M12 7L12 16\"\n stroke=\"currentColor\"\n stroke-width=\"1\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\" />\n <path\n d=\"M8 13L12 17L16 13\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\" />\n </svg>\n }\n </th>\n }\n </tr>\n </thead>\n</ng-template>\n\n<ng-template #dataRowsTemplate>\n @for (row of $data; track $index) {\n <tr [class.table-active]=\"isRowExpanded(row)\">\n @if (_detailRow) {\n <td class=\"detail-row-expander\">\n @if (_detailRow.showCallback == null || _detailRow.showCallback(row)) {\n <button class=\"btn\" (click)=\"_onToggleRowDetailClick(row)\">\n @if (isRowExpanded(row)) {\n <i class=\"far fa-minus\"></i>\n } @else {\n <i class=\"far fa-plus\"></i>\n }\n </button>\n }\n </td>\n }\n\n @if (showRowNumbers()) {\n <td class=\"ng0-table-row-number\">\n {{ $firstRecordIndex + $index + 1}}\n </td>\n }\n\n @for (col of _columns; track $index) {\n <td\n [ngClass]=\"col.cellClass()\"\n [class.shrinked]=\"col.shrink()\"\n [class.fw-bold]=\"col.bold()\">\n @if (col.template) {\n <ng-container *ngTemplateOutlet=\"col.template; context: { $implicit: row }\">\n </ng-container>\n } @else if (col.field()) {\n @let cellValue = _getCellValue(row, col);\n\n @if (\n (cellValue === null || cellValue === undefined) && col.emptyCellText()\n ) {\n {{ col.emptyCellText() }}\n } @else {\n @if (col.type()) {\n @let type = $any(col.type());\n\n @if (type == \"date\") {\n {{ cellValue | ng0Date }}\n } @else if (type == \"number\") {\n {{ cellValue | number }}\n } @else if (type == \"currency\") {\n {{ cellValue | currency }}\n } @else if (type.enum) {\n {{ cellValue | ng0TranslateEnum: type.enum.name : type.enum.fallback }}\n } @else if (type.boolean || type == \"boolean\") {\n {{ cellValue | ng0LocalizeBool: type.boolean.false ?? \"false\" : type.boolean.false ?? \"true\" }}\n } @else {\n {{ cellValue }}\n }\n }\n }\n } @else if(col.formatBy()) {\n {{col.formatBy()(row)}}\n } \n </td>\n }\n </tr>\n\n @if (_detailRow && isRowExpanded(row)) {\n <tr class=\"detail-row\">\n <td\n [attr.colspan]=\"_columns.length + (showRowNumbers() ? 1 : 0) + 1\"\n class=\"ps-2 pb-4\">\n <ng-container\n *ngTemplateOutlet=\"_detailRow.templateRef; context: { $implicit: row }\"></ng-container>\n </td>\n </tr>\n }\n }\n</ng-template>\n\n<ng-template #footerTemplate>\n @if ($pageable && showPagingControls() && $anyRecords && $totalRecordsCount! > 0) {\n <div class=\"ng0-table-pagination me-2\">\n <ng0-pagination\n class=\"mb-0 d-inline-block\"\n [showFirstLastButtons]=\"showFirstLastButtons()\"\n [showNextPreviousButtons]=\"showNextPreviousButtons()\"\n [totalRecords]=\"$totalRecordsCount!\"\n [pageSize]=\"pageSize()\"\n [selectedPage]=\"pageIndex()\"\n (itemClick)=\"_onPageChange($event)\"\n [maxVisiblePages]=\"maxVisiblePages()\">\n <ng-container ngProjectAs=\"first\">\n <ng-content select=\"paging-first\">\n {{ \"first\" | ng0Translate }}\n </ng-content>\n </ng-container>\n\n <ng-container ngProjectAs=\"last\">\n <ng-content select=\"paging-last\">\n {{ \"last\" | ng0Translate }}\n </ng-content>\n </ng-container>\n\n <ng-container ngProjectAs=\"next\">\n <ng-content select=\"paging-next\">\n {{ \"next\" | ng0Translate }}\n </ng-content>\n </ng-container>\n\n <ng-container ngProjectAs=\"previous\">\n <ng-content select=\"paging-previous\">\n {{ \"previous\" | ng0Translate }}\n </ng-content>\n </ng-container>\n </ng0-pagination>\n </div>\n\n @if (pageSizeOptions()) {\n <div class=\"ng0-table-paging-options\">\n <ng0-select\n name=\"pageSize\"\n [source]=\"pageSizeOptions()\"\n [(ngModel)]=\"pageSize\"\n (itemSelect)=\"_onPageSizeOptionsItemSelect($event)\"></ng0-select>\n <!-- <select name=\"pageSizeOptions\" class=\"form-select w-auto d-inline-block\">\n <option [ngValue]=\"10\" selected>10</option>\n </select> -->\n </div>\n }\n\n @if (showPagingInfo()) {\n <div class=\"ng0-table-paging-info ms-auto\">\n <ng-content select=\"paging-info\">\n {{\n _pagingFormatter({firstRecord: $firstRecordIndex + 1, lastRecord: $lastRecordIndex + 1, totalRecords:\n $totalRecordsCount!,\n currentPage: $pageIndex!})\n }}\n </ng-content>\n </div>\n }\n }\n</ng-template>\n\n<ng-template #nowDataTemplate>\n <tr class=\"ng0-table-error-row\">\n <td [attr.colSpan]=\"$columnsCount\" class=\"p-2\">\n <div class=\"d-flex align-items-baseline\">\n <span>{{ $tableLocale?.loadError ?? 'Error loading data.' }} </span>\n <button (click)=\"load()\" class=\"btn btn-warning ms-auto\">\n {{ \"retry\" | ng0Translate }}\n </button>\n </div>\n </td>\n </tr>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;position:relative}@starting-style{.ng0-table-loading-cover{background-color:#0000}}table{margin-bottom:0;height:100%}th.sortable{cursor:pointer;-webkit-user-select:none;user-select:none}th.sortable .ng0-table-sort-icon{transition:transform .2s;opacity:0}th.sortable.sort-none:hover .ng0-table-sort-icon{opacity:.4}th.sortable.sort-asc .ng0-table-sort-icon{transform:rotate(0);opacity:1;color:var(--bs-danger)}th.sortable.sort-desc .ng0-table-sort-icon{transform:rotate(180deg);opacity:1;color:var(--bs-primary)}tbody{position:relative}td.row-number{width:0}td.shrinked{width:0;white-space:nowrap}.ng0-table-loading-cover{position:absolute;inset:0;background-color:#0000000d;transition:background-color .2s;z-index:1000;display:flex;align-items:center;justify-content:center}.table-scrollable{overflow-y:auto;direction:ltr;scroll-padding:20px}.table-scrollable::-webkit-scrollbar{width:8px}.table-scrollable::-webkit-scrollbar-track{background-color:#00000008}.table-scrollable::-webkit-scrollbar-thumb{background-color:var(--bs-secondary)}.table-scrollable thead th{position:sticky;top:0}.ng0-table-footer{margin-top:.5rem}.fade-in{animation:fade-in .5s}@keyframes fade-in{0%{opacity:0}to{opacity:1}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: LocalizationModule }, { kind: "component", type: PaginationComponent, selector: "ng0-pagination", inputs: ["totalRecords", "pageSize", "selectedPage", "maxVisiblePages", "showNextPreviousButtons", "showFirstLastButtons"], outputs: ["itemClick"], exportAs: ["ng0Pagination"] }, { kind: "directive", type: NumberDirective, selector: "[ng0Number]", inputs: ["minFractionDigits", "maxFractionDigits", "useGrouping", "numberType"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i3.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i3.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "component", type: SelectComponent, selector: "ng0-select", inputs: ["source", "multiple", "showSelectionIndicator", "open", "compareBy", "formatBy", "writeBy", "filterable", "filterBy", "filterPlaceholder", "itemClass", "idGenerator"], outputs: ["openChange", "itemSelect"], exportAs: ["ng0Select"] }, { kind: "component", type: Filter1Icon, selector: "ng0-icon-filter1" }, { kind: "pipe", type: i1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i4.TranslatePipe, name: "ng0Translate" }, { kind: "pipe", type: i4.TranslateEnumPipe, name: "ng0TranslateEnum" }, { kind: "pipe", type: i4.DatePipe, name: "ng0Date" }, { kind: "pipe", type: i4.LocalizeBooleanPipe, name: "ng0LocalizeBool" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
402
401
|
}
|
|
403
402
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: TableComponent, decorators: [{
|
|
404
403
|
type: Component,
|
|
@@ -408,15 +407,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImpo
|
|
|
408
407
|
LocalizationModule,
|
|
409
408
|
PaginationComponent,
|
|
410
409
|
NumberDirective,
|
|
411
|
-
OverlayModule
|
|
412
|
-
], template: "@let $dataResult = _dataResult();\n@let $pageable = pageable();\n@let $pageIndex = _lastRequest?.page?.index ?? 1;\n@let $data = $dataResult?.data;\n@let $anyRecords = $data && $data.length > 0;\n@let $totalRecordsCount = $dataResult?.total;\n@let $firstRecord = $pageable ? ($pageable.pageSize! * ($pageIndex - 1) + 1) : 1;\n@let $lastRecord = $data ? $firstRecord + $data.length - 1 : 1;\n@let $isLoading = _dataSource.isLoading();\n@let $isFirstLoad = $dataResult == undefined;\n@let $columnsCount = _columns.length + (showRowNumbers() ? 1 : 0);\n@let $tableLocale = _ls.get()?.definition?.components?.table;\n\n<div class=\"table-responsive\" [style.height]=\"height()\" [class.table-scrollable]=\"height()! > 0\">\n <table class=\"table\" [ngClass]=\"tableClass()\">\n @if (caption()) {\n <caption>{{caption()}}</caption>\n }\n\n @if (showHeader()) {\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n }\n\n @if (filterable()) {\n <ng-container *ngTemplateOutlet=\"filtersTemplate\"></ng-container>\n }\n\n <tbody>\n @if ($isLoading && $isFirstLoad && loadingIndicator()) {\n <tr class=\"ng0-table-loading-row\">\n <td [attr.colspan]=\"$columnsCount\">\n @switch (loadingIndicator()) {\n @case ('spinner') {\n <div class=\"text-center\">\n <div class=\"spinner-border\" role=\"status\"></div>\n </div>\n }\n }\n </td>\n </tr>\n } @else {\n @if ($data) {\n @if ($data.length > 0) {\n <ng-container *ngTemplateOutlet=\"dataRowsTemplate\"></ng-container>\n } @else {\n <tr class=\"ng0-table-no-records-row\">\n <td [attr.colSpan]=\"$columnsCount\" class=\"text-center p-2\">\n {{ $tableLocale?.noRecords ?? 'No Records.' }}\n </td>\n </tr>\n }\n } @else if (_lastError) {\n <ng-container *ngTemplateOutlet=\"nowDataTemplate\"></ng-container>\n }\n }\n </tbody>\n </table>\n</div>\n\n<div class=\"ng0-table-footer d-flex align-items-baseline\">\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\n</div>\n\n@if ($isLoading && !$isFirstLoad && loadingCover()) {\n<div class=\"ng0-table-loading-cover text-center\">\n @if (loadingCover() == 'spinner') {\n <div class=\"spinner-border\" role=\"status\"></div>\n }\n</div>\n}\n\n<ng-template #filtersTemplate>\n <thead>\n <tr>\n @if (_detailRow) {\n <th></th>\n }\n\n @if (showRowNumbers()) {\n <th></th>\n }\n\n @for (col of _columns; track $index) {\n <th>\n @if(col.filterable() && (col.field() || col.filterValue())) {\n\n <div class=\"input-group\">\n @switch (col.type()) {\n @case ('text') {\n <input [name]=\"'filter-' + col.field\"\n type=\"search\"\n [maxlength]=\"50\"\n class=\"form-control form-control-sm\"\n [(ngModel)]=\"col.filterValue\"\n (keydown.enter)=\"load(0)\">\n }\n @case ('number') {\n <input [name]=\"'datatablecol-' + col.field\"\n type=\"search\"\n ng0Number\n class=\"form-control form-control-sm\"\n [(ngModel)]=\"col.filterValue\"\n (keydown.enter)=\"load(0)\">\n }\n }\n\n <button class=\"btn btn-outline-light\"\n style=\"border-color: var(--bs-border-color);\"\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n (click)=\"_onToggleFilterOperator(col)\">\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M19 3H5C3.58579 3 2.87868 3 2.43934 3.4122C2 3.8244 2 4.48782 2 5.81466V6.50448C2 7.54232 2 8.06124 2.2596 8.49142C2.5192 8.9216 2.99347 9.18858 3.94202 9.72255L6.85504 11.3624C7.49146 11.7206 7.80967 11.8998 8.03751 12.0976C8.51199 12.5095 8.80408 12.9935 8.93644 13.5872C9 13.8722 9 14.2058 9 14.8729L9 17.5424C9 18.452 9 18.9067 9.25192 19.2613C9.50385 19.6158 9.95128 19.7907 10.8462 20.1406C12.7248 20.875 13.6641 21.2422 14.3321 20.8244C15 20.4066 15 19.4519 15 17.5424V14.8729C15 14.2058 15 13.8722 15.0636 13.5872C15.1959 12.9935 15.488 12.5095 15.9625 12.0976C16.1903 11.8998 16.5085 11.7206 17.145 11.3624L20.058 9.72255C21.0065 9.18858 21.4808 8.9216 21.7404 8.49142C22 8.06124 22 7.54232 22 6.50448V5.81466C22 4.48782 22 3.8244 21.5607 3.4122C21.1213 3 20.4142 3 19 3Z\"\n stroke=\"#1C274C\" stroke-width=\"1.5\" />\n </svg>\n </button>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"col.showFilterOperators()\"\n (overlayOutsideClick)=\"col.showFilterOperators.set(false)\"\n (detach)=\"col.showFilterOperators.set(false)\">\n <ul class=\"dropdown-menu show\" animate.enter=\"fade-in\">\n @for (item of col.getFilterOperators(); track $index) {\n <li>\n <button class=\"dropdown-item\" [class.active]=\"item == col.filterOperator()\"\n (click)=\"_onSelectFilterOperator(col, item)\">\n {{_ls.get()?.definition?.data?.logicalOperators?.[item] ?? item }}\n </button>\n </li>\n }\n </ul>\n </ng-template>\n }\n </th>\n }\n </tr>\n </thead>\n</ng-template>\n\n<ng-template #headerTemplate>\n <thead [ngClass]=\"headerClass()\">\n <tr>\n @if (_detailRow) {\n <th></th>\n }\n\n @if (showRowNumbers()) {\n <th class=\"row-number text-muted\">#</th>\n }\n\n @for (col of _columns; track $index) {\n <th\n (click)=\"col.toggleSortDirection(); load()\"\n [class.sortable]=\"sortable() && col.sortable()\"\n [ngClass]=\"{ \n 'sort-asc': col.sortDirection() == 'asc', \n 'sort-desc': col.sortDirection() == 'desc',\n 'sort-none': col.sortDirection() == 'none'\n }\">\n {{ col.title() }}\n\n @if(sortable() && col.sortable()) {\n <svg class=\"ng0-table-sort-icon\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\" fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 7L12 16\" stroke=\"currentColor\" stroke-width=\"1\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n <path d=\"M8 13L12 17L16 13\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"\n stroke-linejoin=\"round\" />\n </svg>\n }\n </th>\n }\n </tr>\n </thead>\n</ng-template>\n\n<ng-template #dataRowsTemplate>\n @for (row of $data; track $index) {\n <tr [class.table-active]=\"isRowExpanded(row)\">\n @if (_detailRow) {\n <td class=\"detail-row-expander\">\n @if (_detailRow.showCallback == null || _detailRow.showCallback(row)) {\n <button class=\"btn\" (click)=\"_onToggleRowDetailClick(row)\">\n @if (isRowExpanded(row)) {\n <i class=\"far fa-minus\"></i>\n } @else {\n <i class=\"far fa-plus\"></i>\n }\n </button>\n }\n </td>\n }\n\n @if (showRowNumbers()) {\n <td class=\"ng0-table-row-number\">\n {{ $firstRecord + $index }}\n </td>\n }\n\n @for (col of _columns; track $index) {\n <td\n [ngClass]=\"col.cellClass()\"\n [class.shrinked]=\"col.shrink()\"\n [class.fw-bold]=\"col.bold()\">\n @if (col.template) {\n <ng-container *ngTemplateOutlet=\"col.template; context: { $implicit: row }\">\n </ng-container>\n } @else if (col.field()) {\n @let cellValue = _getCellValue(row, col);\n\n @if ((cellValue === null || cellValue === undefined) && col.emptyCellText()) {\n {{ col.emptyCellText() }}\n } @else {\n @if (col.type()) {\n @let type = $any(col.type());\n\n @if (type == \"date\") {\n {{ cellValue | ng0Date }}\n } @else if (type == \"number\") {\n {{ cellValue | number }}\n } @else if (type == \"currency\") {\n {{ cellValue | currency }}\n } @else if (type.enum) {\n {{ cellValue | ng0TranslateEnum: type.enum.name : type.enum.fallback }}\n } @else if (type.boolean || type == \"boolean\") {\n {{ cellValue | ng0LocalizeBool: type.boolean.false ?? \"false\" : type.boolean.false ?? \"true\" }}\n }@else {\n {{ cellValue }}\n }\n }\n }\n }\n </td>\n }\n </tr>\n\n @if (_detailRow && isRowExpanded(row)) {\n <tr class=\"detail-row\">\n <td\n [attr.colspan]=\"_columns.length + (showRowNumbers() ? 1 : 0) + 1\"\n class=\"ps-2 pb-4\">\n <ng-container\n *ngTemplateOutlet=\"_detailRow.templateRef; context: { $implicit: row }\"></ng-container>\n </td>\n </tr>\n }\n }\n</ng-template>\n\n<ng-template #footerTemplate>\n @if ($pageable && $pageable.showPagingControls && $anyRecords && $totalRecordsCount! > 0) {\n <div class=\"ng0-table-pagination me-2\">\n <ng0-pagination\n class=\"mb-0 d-inline-block\"\n [showFirstLastButtons]=\"$pageable.showFirstLastButtons == true\"\n [showNextPreviousButtons]=\"$pageable.showNextPreviousButtons == true\"\n [totalRecords]=\"$totalRecordsCount!\"\n [pageSize]=\"$pageable.pageSize!\"\n [selectedPage]=\"$pageIndex\"\n (itemClick)=\"_onPageChange($event)\"\n [maxVisiblePages]=\"$pageable.maxVisiblePages!\">\n <ng-container ngProjectAs=\"first\">\n <ng-content select=\"paging-first\">\n {{ \"first\" | ng0Translate }}\n </ng-content>\n </ng-container>\n\n <ng-container ngProjectAs=\"last\">\n <ng-content select=\"paging-last\">\n {{ \"last\" | ng0Translate }}\n </ng-content>\n </ng-container>\n\n <ng-container ngProjectAs=\"next\">\n <ng-content select=\"paging-next\">\n {{ \"next\" | ng0Translate }}\n </ng-content>\n </ng-container>\n\n <ng-container ngProjectAs=\"previous\">\n <ng-content select=\"paging-previous\">\n {{ \"previous\" | ng0Translate }}\n </ng-content>\n </ng-container>\n </ng0-pagination>\n </div>\n\n @if ($pageable.showPageSizeOptions || $pageable.showPageSizeOptions == undefined) {\n <div class=\"ng0-table-paging-options\">\n <select name=\"pageSizeOptions\" class=\"form-select w-auto d-inline-block\">\n <option [ngValue]=\"10\" selected>10</option>\n </select>\n </div>\n }\n\n @if ($pageable.showPagingInfo == undefined || $pageable.showPagingInfo) {\n <div class=\"ng0-table-paging-info ms-auto\">\n <ng-content select=\"paging-info\">\n {{\n _pagingFormatter({firstRecord: $firstRecord, lastRecord: $lastRecord, totalRecords: $totalRecordsCount!,\n currentPage: $pageIndex!})\n }}\n </ng-content>\n </div>\n }\n }\n</ng-template>\n\n<ng-template #nowDataTemplate>\n <tr class=\"ng0-table-error-row\">\n <td [attr.colSpan]=\"$columnsCount\" class=\"p-2\">\n <div class=\"d-flex align-items-baseline\">\n <span>{{ $tableLocale?.loadError ?? 'Error loading data.' }} </span>\n <button (click)=\"load()\" class=\"btn btn-warning ms-auto\">\n {{ \"retry\" | ng0Translate }}\n </button>\n </div>\n </td>\n </tr>\n</ng-template>", styles: [":host{display:flex;flex-direction:column;position:relative}@starting-style{.ng0-table-loading-cover{background-color:#0000}}table{margin-bottom:0}th.sortable{cursor:pointer;-webkit-user-select:none;user-select:none}th.sortable .ng0-table-sort-icon{transition:transform .2s;opacity:0}th.sortable.sort-none:hover .ng0-table-sort-icon{opacity:.4}th.sortable.sort-asc .ng0-table-sort-icon{transform:rotate(0);opacity:1;color:var(--bs-danger)}th.sortable.sort-desc .ng0-table-sort-icon{transform:rotate(180deg);opacity:1;color:var(--bs-primary)}tbody{position:relative}td.row-number{width:0}td.shrinked{width:0;white-space:nowrap}.ng0-table-loading-cover{position:absolute;inset:0;background-color:#0000000d;transition:background-color .2s;z-index:1000;display:flex;align-items:center;justify-content:center}.table-scrollable{overflow-y:auto;direction:ltr;scroll-padding:20px}.table-scrollable::-webkit-scrollbar{width:8px}.table-scrollable::-webkit-scrollbar-track{background-color:#00000008}.table-scrollable::-webkit-scrollbar-thumb{background-color:var(--bs-secondary)}.table-scrollable thead th{position:sticky;top:0}.ng0-table-footer{margin-top:.5rem}.fade-in{animation:fade-in .5s}@keyframes fade-in{0%{opacity:0}to{opacity:1}}\n"] }]
|
|
410
|
+
OverlayModule,
|
|
411
|
+
SelectComponent,
|
|
412
|
+
Filter1Icon
|
|
413
|
+
], template: "@let $dataResult = _dataResult();\n@let $pageable = pageable();\n@let $pageIndex = pageIndex();\n@let $pageSize = pageSize();\n@let $data = $dataResult?.data;\n@let $anyRecords = $data && $data.length > 0;\n@let $totalRecordsCount = $dataResult?.total;\n@let $firstRecordIndex = $pageable ? ($pageSize * $pageIndex) : 0;\n@let $lastRecordIndex = $data ? $firstRecordIndex + $data.length - 1 : 1;\n@let $isFirstLoad = $dataResult == undefined;\n@let $columnsCount = _columns.length + (showRowNumbers() ? 1 : 0);\n@let $tableLocale = _ls.get()?.definition?.components?.table;\n\n<div class=\"table-responsive\" [style.height]=\"height()\" [class.table-scrollable]=\"height()! > 0\">\n <table class=\"table\" [ngClass]=\"tableClass()\">\n @if (caption()) {\n <caption>\n {{caption()}}\n </caption>\n }\n\n @if (showHeader()) {\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n }\n\n @if (filterable()) {\n <ng-container *ngTemplateOutlet=\"filtersTemplate\"></ng-container>\n }\n\n <tbody>\n @if (isLoading() && $isFirstLoad && loadingIndicator()) {\n <tr class=\"ng0-table-loading-row\">\n <td [attr.colspan]=\"$columnsCount\">\n @switch (loadingIndicator()) {\n @case ('spinner') {\n <div class=\"text-center\">\n <div class=\"spinner-border\" role=\"status\"></div>\n </div>\n }\n }\n </td>\n </tr>\n } @else {\n @if ($data) {\n @if ($data.length > 0) {\n <ng-container *ngTemplateOutlet=\"dataRowsTemplate\" />\n } @else {\n <tr class=\"ng0-table-no-records-row\">\n <td [attr.colSpan]=\"$columnsCount\" class=\"text-center p-2\">\n {{ $tableLocale?.noRecords ?? 'No Records.' }}\n </td>\n </tr>\n }\n } @else if (_error()) {\n <ng-container *ngTemplateOutlet=\"nowDataTemplate\"></ng-container>\n }\n }\n </tbody>\n </table>\n</div>\n\n<div class=\"ng0-table-footer d-flex align-items-baseline\">\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\n</div>\n\n@if (isLoading() && !$isFirstLoad && loadingCover()) {\n <div class=\"ng0-table-loading-cover text-center\">\n @if (loadingCover() == 'spinner') {\n <div class=\"spinner-border\" role=\"status\"></div>\n }\n </div>\n}\n\n<ng-template #filtersTemplate>\n <thead>\n <tr>\n @if (_detailRow) {\n <th></th>\n }\n\n @if (showRowNumbers()) {\n <th></th>\n }\n\n @for (col of _columns; track $index) {\n <th>\n @if (col.filterable() && (col.field() || col.filterValue())) {\n <div class=\"input-group\">\n @switch (col.type()) {\n @case ('text') {\n <input\n [name]=\"'filter-' + col.field\"\n type=\"search\"\n [maxlength]=\"50\"\n class=\"form-control form-control-sm\"\n [(ngModel)]=\"col.filterValue\"\n (keydown.enter)=\"load(0)\" />\n }\n @case ('number') {\n <input\n [name]=\"'datatablecol-' + col.field\"\n type=\"search\"\n ng0Number\n class=\"form-control form-control-sm\"\n [(ngModel)]=\"col.filterValue\"\n (keydown.enter)=\"load(0)\" />\n }\n }\n\n <button\n class=\"btn btn-outline-light\"\n style=\"border-color: var(--bs-border-color);\"\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n (click)=\"_onToggleFilterOperator(col)\">\n <ng0-icon-filter1 />\n </button>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"col.showFilterOperators()\"\n (overlayOutsideClick)=\"col.showFilterOperators.set(false)\"\n (detach)=\"col.showFilterOperators.set(false)\">\n <ul class=\"dropdown-menu show\" animate.enter=\"fade-in\">\n @for (item of col.getFilterOperators(); track $index) {\n <li>\n <button\n class=\"dropdown-item\"\n [class.active]=\"item == col.filterOperator()\"\n (click)=\"_onSelectFilterOperator(col, item)\">\n {{_ls.get()?.definition?.data?.logicalOperators?.[item] ?? item }}\n </button>\n </li>\n }\n </ul>\n </ng-template>\n }\n </th>\n }\n </tr>\n </thead>\n</ng-template>\n\n<ng-template #headerTemplate>\n <thead [ngClass]=\"headerClass()\">\n <tr>\n @if (_detailRow) {\n <th></th>\n }\n\n @if (showRowNumbers()) {\n <th class=\"row-number text-muted\">#</th>\n }\n\n @for (col of _columns; track $index) {\n <th\n (click)=\"col.toggleSortDirection(); load()\"\n [class.sortable]=\"sortable() && col.sortable()\"\n [ngClass]=\"{ \n 'sort-asc': col.sortDirection() == 'asc', \n 'sort-desc': col.sortDirection() == 'desc',\n 'sort-none': col.sortDirection() == 'none'\n }\">\n {{ col.title() }}\n\n @if (sortable() && col.sortable()) {\n <svg\n class=\"ng0-table-sort-icon\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M12 7L12 16\"\n stroke=\"currentColor\"\n stroke-width=\"1\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\" />\n <path\n d=\"M8 13L12 17L16 13\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\" />\n </svg>\n }\n </th>\n }\n </tr>\n </thead>\n</ng-template>\n\n<ng-template #dataRowsTemplate>\n @for (row of $data; track $index) {\n <tr [class.table-active]=\"isRowExpanded(row)\">\n @if (_detailRow) {\n <td class=\"detail-row-expander\">\n @if (_detailRow.showCallback == null || _detailRow.showCallback(row)) {\n <button class=\"btn\" (click)=\"_onToggleRowDetailClick(row)\">\n @if (isRowExpanded(row)) {\n <i class=\"far fa-minus\"></i>\n } @else {\n <i class=\"far fa-plus\"></i>\n }\n </button>\n }\n </td>\n }\n\n @if (showRowNumbers()) {\n <td class=\"ng0-table-row-number\">\n {{ $firstRecordIndex + $index + 1}}\n </td>\n }\n\n @for (col of _columns; track $index) {\n <td\n [ngClass]=\"col.cellClass()\"\n [class.shrinked]=\"col.shrink()\"\n [class.fw-bold]=\"col.bold()\">\n @if (col.template) {\n <ng-container *ngTemplateOutlet=\"col.template; context: { $implicit: row }\">\n </ng-container>\n } @else if (col.field()) {\n @let cellValue = _getCellValue(row, col);\n\n @if (\n (cellValue === null || cellValue === undefined) && col.emptyCellText()\n ) {\n {{ col.emptyCellText() }}\n } @else {\n @if (col.type()) {\n @let type = $any(col.type());\n\n @if (type == \"date\") {\n {{ cellValue | ng0Date }}\n } @else if (type == \"number\") {\n {{ cellValue | number }}\n } @else if (type == \"currency\") {\n {{ cellValue | currency }}\n } @else if (type.enum) {\n {{ cellValue | ng0TranslateEnum: type.enum.name : type.enum.fallback }}\n } @else if (type.boolean || type == \"boolean\") {\n {{ cellValue | ng0LocalizeBool: type.boolean.false ?? \"false\" : type.boolean.false ?? \"true\" }}\n } @else {\n {{ cellValue }}\n }\n }\n }\n } @else if(col.formatBy()) {\n {{col.formatBy()(row)}}\n } \n </td>\n }\n </tr>\n\n @if (_detailRow && isRowExpanded(row)) {\n <tr class=\"detail-row\">\n <td\n [attr.colspan]=\"_columns.length + (showRowNumbers() ? 1 : 0) + 1\"\n class=\"ps-2 pb-4\">\n <ng-container\n *ngTemplateOutlet=\"_detailRow.templateRef; context: { $implicit: row }\"></ng-container>\n </td>\n </tr>\n }\n }\n</ng-template>\n\n<ng-template #footerTemplate>\n @if ($pageable && showPagingControls() && $anyRecords && $totalRecordsCount! > 0) {\n <div class=\"ng0-table-pagination me-2\">\n <ng0-pagination\n class=\"mb-0 d-inline-block\"\n [showFirstLastButtons]=\"showFirstLastButtons()\"\n [showNextPreviousButtons]=\"showNextPreviousButtons()\"\n [totalRecords]=\"$totalRecordsCount!\"\n [pageSize]=\"pageSize()\"\n [selectedPage]=\"pageIndex()\"\n (itemClick)=\"_onPageChange($event)\"\n [maxVisiblePages]=\"maxVisiblePages()\">\n <ng-container ngProjectAs=\"first\">\n <ng-content select=\"paging-first\">\n {{ \"first\" | ng0Translate }}\n </ng-content>\n </ng-container>\n\n <ng-container ngProjectAs=\"last\">\n <ng-content select=\"paging-last\">\n {{ \"last\" | ng0Translate }}\n </ng-content>\n </ng-container>\n\n <ng-container ngProjectAs=\"next\">\n <ng-content select=\"paging-next\">\n {{ \"next\" | ng0Translate }}\n </ng-content>\n </ng-container>\n\n <ng-container ngProjectAs=\"previous\">\n <ng-content select=\"paging-previous\">\n {{ \"previous\" | ng0Translate }}\n </ng-content>\n </ng-container>\n </ng0-pagination>\n </div>\n\n @if (pageSizeOptions()) {\n <div class=\"ng0-table-paging-options\">\n <ng0-select\n name=\"pageSize\"\n [source]=\"pageSizeOptions()\"\n [(ngModel)]=\"pageSize\"\n (itemSelect)=\"_onPageSizeOptionsItemSelect($event)\"></ng0-select>\n <!-- <select name=\"pageSizeOptions\" class=\"form-select w-auto d-inline-block\">\n <option [ngValue]=\"10\" selected>10</option>\n </select> -->\n </div>\n }\n\n @if (showPagingInfo()) {\n <div class=\"ng0-table-paging-info ms-auto\">\n <ng-content select=\"paging-info\">\n {{\n _pagingFormatter({firstRecord: $firstRecordIndex + 1, lastRecord: $lastRecordIndex + 1, totalRecords:\n $totalRecordsCount!,\n currentPage: $pageIndex!})\n }}\n </ng-content>\n </div>\n }\n }\n</ng-template>\n\n<ng-template #nowDataTemplate>\n <tr class=\"ng0-table-error-row\">\n <td [attr.colSpan]=\"$columnsCount\" class=\"p-2\">\n <div class=\"d-flex align-items-baseline\">\n <span>{{ $tableLocale?.loadError ?? 'Error loading data.' }} </span>\n <button (click)=\"load()\" class=\"btn btn-warning ms-auto\">\n {{ \"retry\" | ng0Translate }}\n </button>\n </div>\n </td>\n </tr>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;position:relative}@starting-style{.ng0-table-loading-cover{background-color:#0000}}table{margin-bottom:0;height:100%}th.sortable{cursor:pointer;-webkit-user-select:none;user-select:none}th.sortable .ng0-table-sort-icon{transition:transform .2s;opacity:0}th.sortable.sort-none:hover .ng0-table-sort-icon{opacity:.4}th.sortable.sort-asc .ng0-table-sort-icon{transform:rotate(0);opacity:1;color:var(--bs-danger)}th.sortable.sort-desc .ng0-table-sort-icon{transform:rotate(180deg);opacity:1;color:var(--bs-primary)}tbody{position:relative}td.row-number{width:0}td.shrinked{width:0;white-space:nowrap}.ng0-table-loading-cover{position:absolute;inset:0;background-color:#0000000d;transition:background-color .2s;z-index:1000;display:flex;align-items:center;justify-content:center}.table-scrollable{overflow-y:auto;direction:ltr;scroll-padding:20px}.table-scrollable::-webkit-scrollbar{width:8px}.table-scrollable::-webkit-scrollbar-track{background-color:#00000008}.table-scrollable::-webkit-scrollbar-thumb{background-color:var(--bs-secondary)}.table-scrollable thead th{position:sticky;top:0}.ng0-table-footer{margin-top:.5rem}.fade-in{animation:fade-in .5s}@keyframes fade-in{0%{opacity:0}to{opacity:1}}\n"] }]
|
|
413
414
|
}], propDecorators: { _columns: [{
|
|
414
415
|
type: ContentChildren,
|
|
415
416
|
args: [TableColumnDirective]
|
|
416
417
|
}], _detailRow: [{
|
|
417
418
|
type: ContentChild,
|
|
418
419
|
args: [TableDetailRowDirective]
|
|
419
|
-
}], source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: true }] }], autoLoad: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoLoad", required: false }] }], showRowNumbers: [{ type: i0.Input, args: [{ isSignal: true, alias: "showRowNumbers", required: false }] }], showHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHeader", required: false }] }], pageable: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageable", required: false }] }], sortable: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortable", required: false }] }], tableClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableClass", required: false }] }], headerClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "headerClass", required: false }] }], caption: [{ type: i0.Input, args: [{ isSignal: true, alias: "caption", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], filterable: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterable", required: false }] }], loadingIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingIndicator", required: false }] }], loadingCover: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingCover", required: false }] }], isLoading: [{
|
|
420
|
+
}], source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: true }] }], autoLoad: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoLoad", required: false }] }], showRowNumbers: [{ type: i0.Input, args: [{ isSignal: true, alias: "showRowNumbers", required: false }] }], showHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHeader", required: false }] }], pageable: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageable", required: false }] }], pageIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageIndex", required: false }] }, { type: i0.Output, args: ["pageIndexChange"] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }, { type: i0.Output, args: ["pageSizeChange"] }], maxVisiblePages: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxVisiblePages", required: false }] }], showPagingControls: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPagingControls", required: false }] }], showFirstLastButtons: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFirstLastButtons", required: false }] }], showNextPreviousButtons: [{ type: i0.Input, args: [{ isSignal: true, alias: "showNextPreviousButtons", required: false }] }], pageSizeOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizeOptions", required: false }] }], showPagingInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPagingInfo", required: false }] }], sortable: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortable", required: false }] }], tableClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableClass", required: false }] }], headerClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "headerClass", required: false }] }], caption: [{ type: i0.Input, args: [{ isSignal: true, alias: "caption", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], filterable: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterable", required: false }] }], loadingIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingIndicator", required: false }] }], loadingCover: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingCover", required: false }] }], isLoading: [{
|
|
420
421
|
type: HostBinding,
|
|
421
422
|
args: ['class.ng0-loading']
|
|
422
423
|
}] } });
|