@universis/ngx-tables 0.6.19 → 0.7.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/bundles/universis-ngx-tables.umd.js +292 -23
- package/bundles/universis-ngx-tables.umd.js.map +1 -1
- package/bundles/universis-ngx-tables.umd.min.js +1 -1
- package/bundles/universis-ngx-tables.umd.min.js.map +1 -1
- package/esm2015/lib/actions/table.actions.js +28 -0
- package/esm2015/lib/components/advanced-aggregator-list/advanced-aggregator-list.component.js +2 -2
- package/esm2015/lib/components/advanced-table/advanced-table-search.component.js +8 -2
- package/esm2015/lib/components/advanced-table/advanced-table.component.js +79 -18
- package/esm2015/lib/directives/advance-search-state.directive.js +88 -0
- package/esm2015/lib/directives/advance-table-state.directive.js +59 -0
- package/esm2015/lib/reducers/index.js +31 -0
- package/esm2015/lib/tables.module.js +13 -4
- package/esm2015/public_api.js +1 -1
- package/esm2015/universis-ngx-tables.js +4 -1
- package/esm5/lib/actions/table.actions.js +34 -0
- package/esm5/lib/components/advanced-aggregator-list/advanced-aggregator-list.component.js +2 -2
- package/esm5/lib/components/advanced-table/advanced-table-search.component.js +8 -2
- package/esm5/lib/components/advanced-table/advanced-table.component.js +77 -16
- package/esm5/lib/directives/advance-search-state.directive.js +96 -0
- package/esm5/lib/directives/advance-table-state.directive.js +62 -0
- package/esm5/lib/reducers/index.js +33 -0
- package/esm5/lib/tables.module.js +13 -4
- package/esm5/public_api.js +1 -1
- package/esm5/universis-ngx-tables.js +4 -1
- package/fesm2015/universis-ngx-tables.js +277 -27
- package/fesm2015/universis-ngx-tables.js.map +1 -1
- package/fesm5/universis-ngx-tables.js +286 -26
- package/fesm5/universis-ngx-tables.js.map +1 -1
- package/lib/actions/table.actions.d.ts +24 -0
- package/lib/components/advanced-table/advanced-table-search.component.d.ts +4 -0
- package/lib/components/advanced-table/advanced-table.component.d.ts +12 -0
- package/lib/directives/advance-search-state.directive.d.ts +16 -0
- package/lib/directives/advance-table-state.directive.d.ts +11 -0
- package/lib/reducers/index.d.ts +23 -0
- package/package.json +4 -1
- package/universis-ngx-tables.d.ts +3 -0
- package/universis-ngx-tables.metadata.json +1 -1
|
@@ -9,7 +9,6 @@ import { ClientDataQueryable, ResponseError, TextUtils } from '@themost/client';
|
|
|
9
9
|
import { BehaviorSubject } from 'rxjs';
|
|
10
10
|
import { AngularDataContext } from '@themost/angular';
|
|
11
11
|
import { __awaiter } from 'tslib';
|
|
12
|
-
import { Injectable, Directive, Output, EventEmitter, Pipe, Component, Input, ViewChild, ViewEncapsulation, ChangeDetectorRef, ElementRef, Inject, InjectionToken, Injector, NgModule, CUSTOM_ELEMENTS_SCHEMA, defineInjectable, inject, HostListener, ChangeDetectionStrategy } from '@angular/core';
|
|
13
12
|
import { DatePipe, CommonModule } from '@angular/common';
|
|
14
13
|
import { TranslateService, TranslatePipe, TranslateModule } from '@ngx-translate/core';
|
|
15
14
|
import { FormArray, FormBuilder, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
@@ -21,6 +20,9 @@ import { ActivatedRoute, Router, NavigationStart, RouterModule } from '@angular/
|
|
|
21
20
|
import { BsModalRef, BsModalService, ModalModule } from 'ngx-bootstrap/modal';
|
|
22
21
|
import { ProgressbarModule } from 'ngx-bootstrap/progressbar';
|
|
23
22
|
import { GroupByPipe, NgPipesModule } from 'ngx-pipes';
|
|
23
|
+
import { Injectable, Directive, Optional, Input, Output, EventEmitter, Pipe, Component, ViewChild, ViewEncapsulation, ChangeDetectorRef, ElementRef, Inject, InjectionToken, Injector, NgModule, CUSTOM_ELEMENTS_SCHEMA, defineInjectable, inject, HostListener, ChangeDetectionStrategy } from '@angular/core';
|
|
24
|
+
import { createFeatureSelector, createSelector, select, Store, StoreModule } from '@ngrx/store';
|
|
25
|
+
import { first } from 'rxjs/operators';
|
|
24
26
|
|
|
25
27
|
class AdvancedColumnFormatter {
|
|
26
28
|
static template(expr) {
|
|
@@ -540,12 +542,17 @@ class AdvancedTableComponent {
|
|
|
540
542
|
this.init = new EventEmitter();
|
|
541
543
|
this.reload = new EventEmitter();
|
|
542
544
|
this.select = new EventEmitter();
|
|
545
|
+
this.draw = new EventEmitter();
|
|
546
|
+
this.page = new EventEmitter();
|
|
547
|
+
this.order = new EventEmitter();
|
|
548
|
+
this.scroll = new EventEmitter();
|
|
543
549
|
this.selectedItems = new EventEmitter();
|
|
544
550
|
this.scrollable = true;
|
|
545
551
|
this.serverSide = true;
|
|
546
552
|
this.lengthMenu = [50, 100, 200, 500];
|
|
547
553
|
this.paging = true;
|
|
548
554
|
this.pageLength = 25;
|
|
555
|
+
this.stateSave = false;
|
|
549
556
|
this.scrollY = 800;
|
|
550
557
|
this.scrollX = true;
|
|
551
558
|
/**
|
|
@@ -1042,6 +1049,27 @@ class AdvancedTableComponent {
|
|
|
1042
1049
|
}, 0);
|
|
1043
1050
|
}
|
|
1044
1051
|
});
|
|
1052
|
+
tableElement.on('order.dt', (event) => {
|
|
1053
|
+
if (this.dataTable) {
|
|
1054
|
+
const order = this.dataTable.order();
|
|
1055
|
+
if (order && order.length) {
|
|
1056
|
+
this.order.emit(order);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
}).on('draw.dt', (event) => {
|
|
1060
|
+
this.draw.emit();
|
|
1061
|
+
if (this.dataTable) {
|
|
1062
|
+
const info = this.dataTable.page.info();
|
|
1063
|
+
this.page.emit(info);
|
|
1064
|
+
try {
|
|
1065
|
+
this.dataTable.columns.adjust();
|
|
1066
|
+
}
|
|
1067
|
+
catch (err) {
|
|
1068
|
+
console.error('ERROR', 'An error occurred while adjusting table columns');
|
|
1069
|
+
console.error(err);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1045
1073
|
// allow selection
|
|
1046
1074
|
if (this.selectable) {
|
|
1047
1075
|
// get first column (as row primary key)
|
|
@@ -1066,10 +1094,6 @@ class AdvancedTableComponent {
|
|
|
1066
1094
|
// user interface additions
|
|
1067
1095
|
// handle page change event (a trick for firing draw.dt events)
|
|
1068
1096
|
tableElement
|
|
1069
|
-
// for each page
|
|
1070
|
-
.on('page.dt', ($event) => {
|
|
1071
|
-
const info = this.dataTable.page.info();
|
|
1072
|
-
})
|
|
1073
1097
|
// handle draw events
|
|
1074
1098
|
.on('draw.dt', () => {
|
|
1075
1099
|
if (this.customSelect) {
|
|
@@ -1170,11 +1194,11 @@ class AdvancedTableComponent {
|
|
|
1170
1194
|
// get order expression
|
|
1171
1195
|
const order = aoData[2].value;
|
|
1172
1196
|
// get skip records param
|
|
1173
|
-
|
|
1197
|
+
let skip = aoData[3].value;
|
|
1174
1198
|
// get page size param
|
|
1175
|
-
|
|
1199
|
+
let top = aoData[4].value;
|
|
1176
1200
|
// get search value
|
|
1177
|
-
const
|
|
1201
|
+
const search = aoData[5].value;
|
|
1178
1202
|
// get data queryable
|
|
1179
1203
|
const q = self._query instanceof ClientDataQueryable ? self._query : self._context.model(self.config.model).asQueryable();
|
|
1180
1204
|
// apply paging params
|
|
@@ -1191,7 +1215,7 @@ class AdvancedTableComponent {
|
|
|
1191
1215
|
q.setParam('$orderby', orderByStr);
|
|
1192
1216
|
}
|
|
1193
1217
|
// configure $select parameter
|
|
1194
|
-
const select = self.config.columns.filter((column) => {
|
|
1218
|
+
const select$$1 = self.config.columns.filter((column) => {
|
|
1195
1219
|
if (column.virtual === true) {
|
|
1196
1220
|
return false;
|
|
1197
1221
|
}
|
|
@@ -1204,7 +1228,7 @@ class AdvancedTableComponent {
|
|
|
1204
1228
|
return column.name;
|
|
1205
1229
|
}
|
|
1206
1230
|
});
|
|
1207
|
-
q.select.apply(q, select);
|
|
1231
|
+
q.select.apply(q, select$$1);
|
|
1208
1232
|
// configure $filter
|
|
1209
1233
|
if (queryParams.$filter && queryParams.$filter.length) {
|
|
1210
1234
|
// set route filter
|
|
@@ -1281,6 +1305,20 @@ class AdvancedTableComponent {
|
|
|
1281
1305
|
},
|
|
1282
1306
|
language: Object.assign({}, self.translator.transform('Tables.DataTable'), { emptyTable: ' ' }),
|
|
1283
1307
|
};
|
|
1308
|
+
const stateSettings = {
|
|
1309
|
+
stateSave: this.stateSave
|
|
1310
|
+
};
|
|
1311
|
+
if (this.stateLoadCallback) {
|
|
1312
|
+
Object.assign(stateSettings, {
|
|
1313
|
+
stateLoadCallback: this.stateLoadCallback
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
if (this.stateSaveCallback) {
|
|
1317
|
+
Object.assign(stateSettings, {
|
|
1318
|
+
stateSaveCallback: this.stateSaveCallback
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
Object.assign(settings, stateSettings);
|
|
1284
1322
|
if (this.scrollable) {
|
|
1285
1323
|
// set continuous scrolling
|
|
1286
1324
|
Object.assign(settings, {
|
|
@@ -1301,15 +1339,22 @@ class AdvancedTableComponent {
|
|
|
1301
1339
|
}
|
|
1302
1340
|
if (this.selectable) ;
|
|
1303
1341
|
// handle init.dt event and emit local event
|
|
1304
|
-
this.dataTable = tableElement.
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1342
|
+
this.dataTable = tableElement.on('init.dt', (event) => {
|
|
1343
|
+
const scroller = jQuery(event.target).parent();
|
|
1344
|
+
// handle scrolling
|
|
1345
|
+
scroller.on('scroll', (scrollEvent) => {
|
|
1346
|
+
const target = jQuery(scrollEvent.target);
|
|
1347
|
+
const top = target.scrollTop();
|
|
1348
|
+
const left = target.scrollLeft();
|
|
1349
|
+
if (this.dataTable) {
|
|
1350
|
+
this.scroll.emit({
|
|
1351
|
+
top,
|
|
1352
|
+
left
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
});
|
|
1356
|
+
}).DataTable(settings);
|
|
1357
|
+
this.init.emit();
|
|
1313
1358
|
// show or hide header
|
|
1314
1359
|
if (!this.showHeader) {
|
|
1315
1360
|
this._element.nativeElement
|
|
@@ -1328,6 +1373,16 @@ class AdvancedTableComponent {
|
|
|
1328
1373
|
}
|
|
1329
1374
|
}
|
|
1330
1375
|
}
|
|
1376
|
+
scrollTop(value) {
|
|
1377
|
+
if (this.dataTable) {
|
|
1378
|
+
this.dataTable.parent().scrollTop(value);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
scrollLeft(value) {
|
|
1382
|
+
if (this.dataTable) {
|
|
1383
|
+
this.dataTable.parent().scrollLeft(value);
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1331
1386
|
get lastQuery() {
|
|
1332
1387
|
if (this.config == null) {
|
|
1333
1388
|
return null;
|
|
@@ -1566,12 +1621,19 @@ AdvancedTableComponent.propDecorators = {
|
|
|
1566
1621
|
init: [{ type: Output, args: ['init',] }],
|
|
1567
1622
|
reload: [{ type: Input, args: ['reload',] }],
|
|
1568
1623
|
select: [{ type: Output, args: ['select',] }],
|
|
1624
|
+
draw: [{ type: Output, args: ['draw',] }],
|
|
1625
|
+
page: [{ type: Output, args: ['page',] }],
|
|
1626
|
+
order: [{ type: Output, args: ['order',] }],
|
|
1627
|
+
scroll: [{ type: Output, args: ['scroll',] }],
|
|
1569
1628
|
selectedItems: [{ type: Output, args: ['selectedItems',] }],
|
|
1570
1629
|
scrollable: [{ type: Input }],
|
|
1571
1630
|
serverSide: [{ type: Input }],
|
|
1572
1631
|
lengthMenu: [{ type: Input }],
|
|
1573
1632
|
paging: [{ type: Input }],
|
|
1574
1633
|
pageLength: [{ type: Input }],
|
|
1634
|
+
stateSave: [{ type: Input }],
|
|
1635
|
+
stateLoadCallback: [{ type: Input }],
|
|
1636
|
+
stateSaveCallback: [{ type: Input }],
|
|
1575
1637
|
scrollY: [{ type: Input }],
|
|
1576
1638
|
scrollX: [{ type: Input }],
|
|
1577
1639
|
selectable: [{ type: Input }],
|
|
@@ -2712,6 +2774,7 @@ class AdvancedTableSearchComponent extends AdvancedTableSearchBaseComponent {
|
|
|
2712
2774
|
this.showMore = true;
|
|
2713
2775
|
this.mergeQueryParams = false;
|
|
2714
2776
|
this.viewChange = new EventEmitter();
|
|
2777
|
+
this.listChange = new EventEmitter();
|
|
2715
2778
|
this.userSearchList = [];
|
|
2716
2779
|
this.selectedList = null;
|
|
2717
2780
|
}
|
|
@@ -2859,6 +2922,9 @@ class AdvancedTableSearchComponent extends AdvancedTableSearchBaseComponent {
|
|
|
2859
2922
|
queryParamsHandling: 'merge',
|
|
2860
2923
|
});
|
|
2861
2924
|
}
|
|
2925
|
+
this.filterChange.emit({
|
|
2926
|
+
q: searchText
|
|
2927
|
+
});
|
|
2862
2928
|
// otherwise do search
|
|
2863
2929
|
this.table.search(searchText);
|
|
2864
2930
|
return false;
|
|
@@ -3069,6 +3135,7 @@ class AdvancedTableSearchComponent extends AdvancedTableSearchBaseComponent {
|
|
|
3069
3135
|
else {
|
|
3070
3136
|
this.table.query = query;
|
|
3071
3137
|
}
|
|
3138
|
+
this.filterChange.emit(this.filter);
|
|
3072
3139
|
this.table.fetch();
|
|
3073
3140
|
}
|
|
3074
3141
|
});
|
|
@@ -3197,7 +3264,8 @@ AdvancedTableSearchComponent.propDecorators = {
|
|
|
3197
3264
|
showMore: [{ type: Input }],
|
|
3198
3265
|
mergeQueryParams: [{ type: Input }],
|
|
3199
3266
|
searchText: [{ type: ViewChild, args: ['searchText',] }],
|
|
3200
|
-
viewChange: [{ type: Output, args: ['viewChange',] }]
|
|
3267
|
+
viewChange: [{ type: Output, args: ['viewChange',] }],
|
|
3268
|
+
listChange: [{ type: Output, args: ['listChange',] }]
|
|
3201
3269
|
};
|
|
3202
3270
|
|
|
3203
3271
|
const FORMATTERS = {
|
|
@@ -3494,8 +3562,8 @@ class BtnExpDirective {
|
|
|
3494
3562
|
constructQueryParam(query, tableConfig) {
|
|
3495
3563
|
let selectQuery = query.getParams().$select;
|
|
3496
3564
|
let selectQueryArray = selectQuery.split(',');
|
|
3497
|
-
selectQueryArray = selectQueryArray.map((select) => {
|
|
3498
|
-
const words = select.split(' ');
|
|
3565
|
+
selectQueryArray = selectQueryArray.map((select$$1) => {
|
|
3566
|
+
const words = select$$1.split(' ');
|
|
3499
3567
|
if (words.length === 3) {
|
|
3500
3568
|
if (tableConfig && tableConfig.columns) {
|
|
3501
3569
|
for (const column of tableConfig.columns) {
|
|
@@ -3894,7 +3962,7 @@ class AdvancedAggregatorListComponent {
|
|
|
3894
3962
|
AdvancedAggregatorListComponent.decorators = [
|
|
3895
3963
|
{ type: Component, args: [{
|
|
3896
3964
|
selector: 'app-advanced-aggregator-list',
|
|
3897
|
-
template: "<div id=\"group-list\" class=\"flex-column\" *ngIf=\"config && config.columns\">\n <ul class=\"sis--list-group sis--list-group-header\">\n <li class=\"sis--list-group-item text-wrap\">\n <div class=\"d-flex justify-content-center align-items-center\" *ngIf=\"body && body.length > 0\">\n <div *ngIf=\"config.actions && config.actions.length > 0\" class=\"sis--list-group-item_sm_column\"></div>\n <div *ngFor=\"let column of config.columns; let i = index\" class=\"text-left\"\n [class]=\"config.columns[i].length\"\n [translate]=\"config.columns[i].type === 'action' ? '' : column.title\" [ngClass]=\"{\n 'd-none': config.columns[i].hidden\n }\"></div>\n </div>\n </li>\n </ul>\n\n <!-- The list of entries -->\n <ul class=\"sis--list-group sis--list-group-body\" *ngIf=\"body && body.length > 0\">\n <li class=\"sis--list-group-item text-wrap\" *ngFor=\"let entry of body | orderBy: config.orderBy\">\n <div class=\"d-flex justify-content-center align-items-center list-color\">\n <!-- The list of actions -->\n <div *ngIf=\"config.actions && config.actions.length > 0\" class=\"sis--list-group-item_sm_column text-left pr-0\">\n <button *ngFor=\"let action of config.actions\" (click)=\"callCallback(action.identifier, entry)\"\n [title]=\"(action.title ? action.title : '') | translate \" class=\"btn btn-default px-0\">\n <i
|
|
3965
|
+
template: "<div id=\"group-list\" class=\"flex-column\" *ngIf=\"config && config.columns\">\n <ul class=\"sis--list-group sis--list-group-header\">\n <li class=\"sis--list-group-item text-wrap\">\n <div class=\"d-flex justify-content-center align-items-center\" *ngIf=\"body && body.length > 0\">\n <div *ngIf=\"config.actions && config.actions.length > 0\" class=\"sis--list-group-item_sm_column\"></div>\n <div *ngFor=\"let column of config.columns; let i = index\" class=\"text-left\"\n [class]=\"config.columns[i].length\"\n [translate]=\"config.columns[i].type === 'action' ? '' : column.title\" [ngClass]=\"{\n 'd-none': config.columns[i].hidden\n }\"></div>\n </div>\n </li>\n </ul>\n\n <!-- The list of entries -->\n <ul class=\"sis--list-group sis--list-group-body\" *ngIf=\"body && body.length > 0\">\n <li class=\"sis--list-group-item text-wrap\" *ngFor=\"let entry of body | orderBy: config.orderBy\">\n <div class=\"d-flex justify-content-center align-items-center list-color\">\n <!-- The list of actions -->\n <div *ngIf=\"config.actions && config.actions.length > 0\" class=\"sis--list-group-item_sm_column text-left pr-0\">\n <button *ngFor=\"let action of config.actions\" (click)=\"callCallback(action.identifier, entry)\"\n [title]=\"(action.title ? action.title : '') | translate \" class=\"btn btn-default px-0\">\n <i class=\"\" [class]=\"'fas text-indigo ml-2 ' + 'fa-' + action.icon\"></i>\n </button>\n <span class=\"px-0\">\n <i class=\"fa fa-fw\"> </i>\n </span>\n\n </div>\n <!-- The list of data -->\n <div *ngFor=\"let column of config.columns; let i=index\" [class]=\"config.columns[i].length\" class=\"text-left\"\n [ngClass]=\"{\n 'text-truncate': config.columns[i].hasOwnProperty('truncate') && config.columns[i].truncate,\n 'd-none': config.columns[i].hidden,\n 'd-md-block': !config.columns[i].hidden\n }\"\n [title]=\"config.columns[i].hasOwnProperty('truncate') && config.columns[i].truncate ? entry[column.name] : ''\">\n <span class=\"text-secondary\"\n *ngIf=\"!config.columns[i].hasOwnProperty('type') || (config.columns[i].hasOwnProperty('type') && config.columns[i].type === 'text')\"\n [ngClass]=\"{\n 'font-xs': config.columns[i].variant !== 'primary',\n 'text-body': config.columns[i].variant === 'primary',\n 'text-success': config.columns[i].variant === 'redGreen' && config.columns[i].hasOwnProperty('condition') && entry[config.columns[i].condition],\n 'text-danger': config.columns[i].variant === 'redGreen' && config.columns[i].hasOwnProperty('condition') && !entry[config.columns[i].condition],\n 'font-lg': config.columns[i].variant === 'redGreen' && entry[column.name] && entry[column.name].length > 3,\n 'font-2xl': config.columns[i].variant === 'redGreen' && entry[column.name] && entry[column.name].length <= 3\n }\">\n {{entry[column.name] || '-'}}\n </span>\n\n <span *ngIf=\"config.columns[i].type === 'boolean'\">\n <i class=\"fa font-lg\" [ngClass]=\"{\n 'fa-check text-success': entry[column.name].toString() === config.columns[i].trueValue,\n 'fa-times text-danger': entry[column.name].toString() !== config.columns[i].trueValue && config.columns[i].variant !== 'checkOrDash'\n }\"></i>\n <span\n *ngIf=\"entry[column.name].toString() !== config.columns[i].trueValue && config.columns[i].variant === 'checkOrDash'\"\n class=\"text-secondary font-xs\">-</span>\n </span>\n </div>\n </div>\n <div *ngIf=\"entry && entry.subitems\">\n <div *ngFor=\"let subitem of entry.subitems\" class=\"d-flex justify-content-center align-items-center list-color\">\n <div *ngIf=\"config.actions && config.actions.length > 0\" class=\"sis--list-group-item_sm_column text-left pr-0\">\n <span class=\"px-0\">\n <i class=\"fa fa-fw\"> </i>\n </span>\n <button *ngFor=\"let action of config.actions\" (click)=\"callCallback(action.identifier, subitem)\"\n [title]=\"(action.title ? action.title : '') | translate \" class=\"btn btn-default px-0\">\n <i *ngIf=\"action.type === 'edit'\" class=\"fas fa-edit text-indigo\"></i>\n </button>\n </div>\n <div class=\"text-left\"></div>\n <div *ngFor=\"let column of config.columns; let i=index\" [class]=\"config.columns[i].length\" class=\"text-left\"\n [ngClass]=\"{\n 'text-truncate': config.columns[i].hasOwnProperty('truncate') && config.columns[i].truncate,\n 'd-none': config.columns[i].hidden,\n 'd-md-block': !config.columns[i].hidden\n }\"\n [title]=\"config.columns[i].hasOwnProperty('truncate') && config.columns[i].truncate ? entry[column.name] : ''\">\n <span class=\"text-secondary\"\n *ngIf=\"!config.columns[i].hasOwnProperty('type') || (config.columns[i].hasOwnProperty('type') && config.columns[i].type === 'text')\"\n [ngClass]=\"{\n 'font-xs': config.columns[i].variant !== 'primary',\n 'text-body': config.columns[i].variant === 'primary',\n 'text-success': config.columns[i].variant === 'redGreen' && config.columns[i].hasOwnProperty('condition') && subitem[config.columns[i].condition],\n 'text-danger': config.columns[i].variant === 'redGreen' && config.columns[i].hasOwnProperty('condition') && !subitem[config.columns[i].condition],\n 'font-lg': config.columns[i].variant === 'redGreen' && subitem[column.name] && subitem[column.name].length > 3,\n 'font-2xl': config.columns[i].variant === 'redGreen' && subitem[column.name] && subitem[column.name].length <= 3\n }\">\n {{subitem[column.name] || '-'}}\n </span>\n <span *ngIf=\"config.columns[i].type === 'boolean'\">\n <i class=\"fa font-lg\" [ngClass]=\"{\n 'fa-check text-success': subitem[column.name].toString() === config.columns[i].trueValue,\n 'fa-times text-danger': subitem[column.name].toString() !== config.columns[i].trueValue && config.columns[i].variant !== 'checkOrDash'\n }\"></i>\n <span\n *ngIf=\"subitem[column.name].toString() !== config.columns[i].trueValue && config.columns[i].variant === 'checkOrDash'\"\n class=\"text-secondary font-xs\">-</span>\n </span>\n </div>\n </div>\n </div>\n </li>\n </ul>\n</div>\n"
|
|
3898
3966
|
}] }
|
|
3899
3967
|
];
|
|
3900
3968
|
/** @nocollapse */
|
|
@@ -4322,6 +4390,183 @@ const TABLES_EN = {
|
|
|
4322
4390
|
}
|
|
4323
4391
|
};
|
|
4324
4392
|
|
|
4393
|
+
var TableActionTypes;
|
|
4394
|
+
(function (TableActionTypes) {
|
|
4395
|
+
TableActionTypes["LoadFilter"] = "[Table] Load Filter";
|
|
4396
|
+
TableActionTypes["AppendFilter"] = "[Table] Append Filter";
|
|
4397
|
+
TableActionTypes["AppendState"] = "[Table] Append State";
|
|
4398
|
+
})(TableActionTypes || (TableActionTypes = {}));
|
|
4399
|
+
class AppendFilter {
|
|
4400
|
+
constructor(id, filter) {
|
|
4401
|
+
this.id = id;
|
|
4402
|
+
this.filter = filter;
|
|
4403
|
+
this.type = TableActionTypes.AppendFilter;
|
|
4404
|
+
}
|
|
4405
|
+
}
|
|
4406
|
+
class AppendState {
|
|
4407
|
+
constructor(id, data) {
|
|
4408
|
+
this.id = id;
|
|
4409
|
+
this.data = data;
|
|
4410
|
+
this.type = TableActionTypes.AppendState;
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
|
|
4414
|
+
const initialState = {};
|
|
4415
|
+
function tableReducer(state = initialState, action) {
|
|
4416
|
+
switch (action.type) {
|
|
4417
|
+
case TableActionTypes.LoadFilter:
|
|
4418
|
+
return state[action.id];
|
|
4419
|
+
case TableActionTypes.AppendFilter:
|
|
4420
|
+
state[action.id] = Object.assign({}, state[action.id], { filter: action.filter });
|
|
4421
|
+
return state;
|
|
4422
|
+
case TableActionTypes.AppendState:
|
|
4423
|
+
state[action.id] = Object.assign({}, state[action.id], { table: action.data });
|
|
4424
|
+
return state;
|
|
4425
|
+
default:
|
|
4426
|
+
return state;
|
|
4427
|
+
}
|
|
4428
|
+
}
|
|
4429
|
+
const tableReducers = {
|
|
4430
|
+
tables: tableReducer,
|
|
4431
|
+
};
|
|
4432
|
+
const featureName = 'tables';
|
|
4433
|
+
const getTablesState = createFeatureSelector(featureName);
|
|
4434
|
+
const selectTable = createSelector(getTablesState, (state, props) => {
|
|
4435
|
+
return state.tables[props.id];
|
|
4436
|
+
});
|
|
4437
|
+
|
|
4438
|
+
class AdvancedTableState {
|
|
4439
|
+
constructor(table, store) {
|
|
4440
|
+
this.table = table;
|
|
4441
|
+
this.store = store;
|
|
4442
|
+
}
|
|
4443
|
+
ngOnInit() {
|
|
4444
|
+
if (this.store == null) {
|
|
4445
|
+
return;
|
|
4446
|
+
}
|
|
4447
|
+
this.table.stateSave = true;
|
|
4448
|
+
this.table.stateLoadCallback = (settings, callback) => {
|
|
4449
|
+
this.store.pipe(select(selectTable, { id: this.tableState }), first()).subscribe((state) => {
|
|
4450
|
+
return callback(state && state.table);
|
|
4451
|
+
});
|
|
4452
|
+
};
|
|
4453
|
+
let firstDraw = true;
|
|
4454
|
+
this.table.draw.subscribe(() => {
|
|
4455
|
+
if (firstDraw === false) {
|
|
4456
|
+
return;
|
|
4457
|
+
}
|
|
4458
|
+
if (this.table.dataTable == null) {
|
|
4459
|
+
return;
|
|
4460
|
+
}
|
|
4461
|
+
firstDraw = false;
|
|
4462
|
+
const loadeStateSettings = this.table.dataTable.settings()[0];
|
|
4463
|
+
const scrollerSettings = loadeStateSettings.oSavedState &&
|
|
4464
|
+
loadeStateSettings.oSavedState.scroller;
|
|
4465
|
+
if (scrollerSettings && scrollerSettings.topRow) {
|
|
4466
|
+
const scroller = this.table.dataTable.scroller();
|
|
4467
|
+
scroller.scrollToRow(scrollerSettings.topRow, true);
|
|
4468
|
+
}
|
|
4469
|
+
});
|
|
4470
|
+
this.table.stateSaveCallback = (settings, data) => {
|
|
4471
|
+
this.store.dispatch(new AppendState(this.tableState, data));
|
|
4472
|
+
};
|
|
4473
|
+
}
|
|
4474
|
+
}
|
|
4475
|
+
AdvancedTableState.decorators = [
|
|
4476
|
+
{ type: Directive, args: [{
|
|
4477
|
+
// tslint:disable-next-line: directive-selector
|
|
4478
|
+
selector: '[tableState]',
|
|
4479
|
+
},] }
|
|
4480
|
+
];
|
|
4481
|
+
/** @nocollapse */
|
|
4482
|
+
AdvancedTableState.ctorParameters = () => [
|
|
4483
|
+
{ type: AdvancedTableComponent },
|
|
4484
|
+
{ type: Store, decorators: [{ type: Optional }] }
|
|
4485
|
+
];
|
|
4486
|
+
AdvancedTableState.propDecorators = {
|
|
4487
|
+
tableState: [{ type: Input }]
|
|
4488
|
+
};
|
|
4489
|
+
|
|
4490
|
+
class AdvancedTableSearchComponentNotNull extends Error {
|
|
4491
|
+
constructor() {
|
|
4492
|
+
super('Advanced table search component cannot be empty at this context.');
|
|
4493
|
+
}
|
|
4494
|
+
}
|
|
4495
|
+
class AdvancedSearchState {
|
|
4496
|
+
constructor(search, store) {
|
|
4497
|
+
this.search = search;
|
|
4498
|
+
this.store = store;
|
|
4499
|
+
}
|
|
4500
|
+
ngOnInit() {
|
|
4501
|
+
if (this.store == null) {
|
|
4502
|
+
return;
|
|
4503
|
+
}
|
|
4504
|
+
if (this.search == null) {
|
|
4505
|
+
throw new AdvancedTableSearchComponentNotNull();
|
|
4506
|
+
}
|
|
4507
|
+
if (this.search.table) {
|
|
4508
|
+
// set auto load to false
|
|
4509
|
+
this.search.table.autoLoad = false;
|
|
4510
|
+
// handle filtering
|
|
4511
|
+
this.search.filterChange.subscribe((filter) => {
|
|
4512
|
+
this.onSearchFilter(filter);
|
|
4513
|
+
});
|
|
4514
|
+
// handle table state (via directive)
|
|
4515
|
+
const tableState = new AdvancedTableState(this.search.table, this.store);
|
|
4516
|
+
tableState.tableState = this.searchState;
|
|
4517
|
+
tableState.ngOnInit();
|
|
4518
|
+
// handle table init
|
|
4519
|
+
this.search.table.init.subscribe(() => {
|
|
4520
|
+
return this.onTableInit();
|
|
4521
|
+
});
|
|
4522
|
+
}
|
|
4523
|
+
}
|
|
4524
|
+
onTableInit() {
|
|
4525
|
+
this.store.pipe(select(selectTable, { id: this.searchState }), first()).subscribe((state) => {
|
|
4526
|
+
// use order
|
|
4527
|
+
if (state) {
|
|
4528
|
+
if (state.order && state.order.length) {
|
|
4529
|
+
this.search.table.dataTable.order(state.order);
|
|
4530
|
+
}
|
|
4531
|
+
// use text search
|
|
4532
|
+
if (state.filter && state.filter.q) {
|
|
4533
|
+
this.search.text = state.filter.q;
|
|
4534
|
+
this.search.collapsed = true;
|
|
4535
|
+
return this.search.table.search(this.search.text);
|
|
4536
|
+
}
|
|
4537
|
+
// use predefined search
|
|
4538
|
+
if (state.filter && state.filter.s) {
|
|
4539
|
+
this.search.selectedList = this.search.userSearchList.find((item) => {
|
|
4540
|
+
return item.name === state.filter.s;
|
|
4541
|
+
});
|
|
4542
|
+
return this.search.search();
|
|
4543
|
+
}
|
|
4544
|
+
if (state.filter) {
|
|
4545
|
+
this.search.filter = state.filter;
|
|
4546
|
+
}
|
|
4547
|
+
return this.search.search();
|
|
4548
|
+
}
|
|
4549
|
+
});
|
|
4550
|
+
}
|
|
4551
|
+
onSearchFilter(filter) {
|
|
4552
|
+
this.store.dispatch(new AppendFilter(this.searchState, filter));
|
|
4553
|
+
}
|
|
4554
|
+
}
|
|
4555
|
+
AdvancedSearchState.decorators = [
|
|
4556
|
+
{ type: Directive, args: [{
|
|
4557
|
+
// tslint:disable-next-line: directive-selector
|
|
4558
|
+
selector: '[searchState]',
|
|
4559
|
+
},] }
|
|
4560
|
+
];
|
|
4561
|
+
/** @nocollapse */
|
|
4562
|
+
AdvancedSearchState.ctorParameters = () => [
|
|
4563
|
+
{ type: AdvancedTableSearchComponent },
|
|
4564
|
+
{ type: Store, decorators: [{ type: Optional }] }
|
|
4565
|
+
];
|
|
4566
|
+
AdvancedSearchState.propDecorators = {
|
|
4567
|
+
searchState: [{ type: Input }]
|
|
4568
|
+
};
|
|
4569
|
+
|
|
4325
4570
|
const ɵ0 = FORMATTERS;
|
|
4326
4571
|
class TablesModule {
|
|
4327
4572
|
constructor(_translateService) {
|
|
@@ -4353,7 +4598,8 @@ TablesModule.decorators = [
|
|
|
4353
4598
|
SharedModule,
|
|
4354
4599
|
ModalModule,
|
|
4355
4600
|
ProgressbarModule,
|
|
4356
|
-
NgPipesModule
|
|
4601
|
+
NgPipesModule,
|
|
4602
|
+
StoreModule.forFeature(featureName, tableReducers)
|
|
4357
4603
|
],
|
|
4358
4604
|
providers: [DatePipe, TemplatePipe,
|
|
4359
4605
|
{
|
|
@@ -4383,7 +4629,9 @@ TablesModule.decorators = [
|
|
|
4383
4629
|
AdvancedAggregatorListComponent,
|
|
4384
4630
|
AdvancedAggregatorPipe,
|
|
4385
4631
|
ParseTitlePipe,
|
|
4386
|
-
AddItemsComponent
|
|
4632
|
+
AddItemsComponent,
|
|
4633
|
+
AdvancedSearchState,
|
|
4634
|
+
AdvancedTableState
|
|
4387
4635
|
],
|
|
4388
4636
|
exports: [
|
|
4389
4637
|
AdvancedTableComponent,
|
|
@@ -4399,7 +4647,9 @@ TablesModule.decorators = [
|
|
|
4399
4647
|
AdvancedTableEditorDirective,
|
|
4400
4648
|
AdvancedAggregatorComponent,
|
|
4401
4649
|
AdvancedAggregatorListComponent,
|
|
4402
|
-
AddItemsComponent
|
|
4650
|
+
AddItemsComponent,
|
|
4651
|
+
AdvancedSearchState,
|
|
4652
|
+
AdvancedTableState
|
|
4403
4653
|
],
|
|
4404
4654
|
entryComponents: [
|
|
4405
4655
|
AdvancedTableModalBaseComponent,
|
|
@@ -4424,6 +4674,6 @@ TablesModule.ctorParameters = () => [
|
|
|
4424
4674
|
* Generated bundle index. Do not edit.
|
|
4425
4675
|
*/
|
|
4426
4676
|
|
|
4427
|
-
export { AdvancedListComponent, AdvancedRowActionComponent, AdvancedSearchFormComponent, AdvancedSelectComponent, AdvancedSelectService, AdvancedTableConfigurationResolver, AdvancedSearchConfigurationResolver, AdvancedColumnFormatter, NestedPropertyFormatter, ButtonFormatter, LinkFormatter, ActionLinkFormatter, ActionButtonFormatter, ActionSplitButtonFormatter, SelectRowFormatter, TemplateFormatter, TrueFalseFormatter, TranslationFormatter, DateTimeFormatter, NgClassFormatter, LanguageFormatter, COLUMN_FORMATTERS, AdvancedTableConfiguration, AdvancedTableComponent, AdvancedTableSettingsComponent, AdvancedTableSearchBaseComponent, AdvancedTableSearchComponent, FORMATTERS, AdvancedFilterValueProvider, AdvancedTableModalBaseTemplate, AdvancedTableModalBaseComponent, SimpleHeaderToolsComponent, TableSimpleHeaderComponent, AdvancedTableNotNullError, AdvancedTableEditorDirective, BtnExpDirective, AdvancedAggregatorComponent, AdvancedAggregatorListComponent, AddItemsComponent, AdvancedAggregatorPipe, ParseTitlePipe, AdvancedAggregatorService, TablesModule, ɵ0, ActivatedTableService };
|
|
4677
|
+
export { AdvancedSearchState as ɵe, AdvancedTableState as ɵf, featureName as ɵd, tableReducer as ɵa, tableReducers as ɵc, AdvancedListComponent, AdvancedRowActionComponent, AdvancedSearchFormComponent, AdvancedSelectComponent, AdvancedSelectService, AdvancedTableConfigurationResolver, AdvancedSearchConfigurationResolver, AdvancedColumnFormatter, NestedPropertyFormatter, ButtonFormatter, LinkFormatter, ActionLinkFormatter, ActionButtonFormatter, ActionSplitButtonFormatter, SelectRowFormatter, TemplateFormatter, TrueFalseFormatter, TranslationFormatter, DateTimeFormatter, NgClassFormatter, LanguageFormatter, COLUMN_FORMATTERS, AdvancedTableConfiguration, AdvancedTableComponent, AdvancedTableSettingsComponent, AdvancedTableSearchBaseComponent, AdvancedTableSearchComponent, FORMATTERS, AdvancedFilterValueProvider, AdvancedTableModalBaseTemplate, AdvancedTableModalBaseComponent, SimpleHeaderToolsComponent, TableSimpleHeaderComponent, AdvancedTableNotNullError, AdvancedTableEditorDirective, BtnExpDirective, AdvancedAggregatorComponent, AdvancedAggregatorListComponent, AddItemsComponent, AdvancedAggregatorPipe, ParseTitlePipe, AdvancedAggregatorService, TablesModule, ɵ0, ActivatedTableService };
|
|
4428
4678
|
|
|
4429
4679
|
//# sourceMappingURL=universis-ngx-tables.js.map
|