@universis/ngx-tables 0.6.20 → 0.7.2
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 +291 -22
- 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-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-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 +276 -26
- package/fesm2015/universis-ngx-tables.js.map +1 -1
- package/fesm5/universis-ngx-tables.js +285 -25
- 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 +10 -7
- package/universis-ngx-tables.d.ts +3 -0
- package/universis-ngx-tables.metadata.json +1 -1
|
@@ -8,8 +8,6 @@ import { HttpClient } from '@angular/common/http';
|
|
|
8
8
|
import { ClientDataQueryable, ResponseError, TextUtils } from '@themost/client';
|
|
9
9
|
import { BehaviorSubject } from 'rxjs';
|
|
10
10
|
import { AngularDataContext } from '@themost/angular';
|
|
11
|
-
import { __awaiter, __generator, __extends, __values, __assign, __spread } from 'tslib';
|
|
12
|
-
import { Injectable, Pipe, Component, ElementRef, Input, ViewChild, ViewEncapsulation, EventEmitter, Output, NgModule, CUSTOM_ELEMENTS_SCHEMA, defineInjectable, inject, Directive, HostListener, ChangeDetectorRef, InjectionToken, Inject, Injector, ChangeDetectionStrategy } from '@angular/core';
|
|
13
11
|
import { DatePipe, CommonModule } from '@angular/common';
|
|
14
12
|
import { TranslateService, TranslatePipe, TranslateModule } from '@ngx-translate/core';
|
|
15
13
|
import { FormArray, FormBuilder, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
@@ -21,6 +19,10 @@ import { ActivatedRoute, Router, NavigationStart, RouterModule } from '@angular/
|
|
|
21
19
|
import { BsModalRef, BsModalService, ModalModule } from 'ngx-bootstrap/modal';
|
|
22
20
|
import { ProgressbarModule } from 'ngx-bootstrap/progressbar';
|
|
23
21
|
import { GroupByPipe, NgPipesModule } from 'ngx-pipes';
|
|
22
|
+
import { __extends, __assign, __awaiter, __generator, __values, __spread } from 'tslib';
|
|
23
|
+
import { Injectable, Directive, Optional, Input, Pipe, Component, ElementRef, ViewChild, ViewEncapsulation, EventEmitter, Output, NgModule, CUSTOM_ELEMENTS_SCHEMA, defineInjectable, inject, HostListener, ChangeDetectorRef, InjectionToken, Inject, Injector, ChangeDetectionStrategy } from '@angular/core';
|
|
24
|
+
import { createFeatureSelector, createSelector, select, Store, StoreModule } from '@ngrx/store';
|
|
25
|
+
import { first } from 'rxjs/operators';
|
|
24
26
|
|
|
25
27
|
var AdvancedColumnFormatter = /** @class */ (function () {
|
|
26
28
|
function AdvancedColumnFormatter() {
|
|
@@ -600,12 +602,17 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
600
602
|
this.init = new EventEmitter();
|
|
601
603
|
this.reload = new EventEmitter();
|
|
602
604
|
this.select = new EventEmitter();
|
|
605
|
+
this.draw = new EventEmitter();
|
|
606
|
+
this.page = new EventEmitter();
|
|
607
|
+
this.order = new EventEmitter();
|
|
608
|
+
this.scroll = new EventEmitter();
|
|
603
609
|
this.selectedItems = new EventEmitter();
|
|
604
610
|
this.scrollable = true;
|
|
605
611
|
this.serverSide = true;
|
|
606
612
|
this.lengthMenu = [50, 100, 200, 500];
|
|
607
613
|
this.paging = true;
|
|
608
614
|
this.pageLength = 25;
|
|
615
|
+
this.stateSave = false;
|
|
609
616
|
this.scrollY = 800;
|
|
610
617
|
this.scrollX = true;
|
|
611
618
|
/**
|
|
@@ -1124,6 +1131,27 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
1124
1131
|
}, 0);
|
|
1125
1132
|
}
|
|
1126
1133
|
});
|
|
1134
|
+
tableElement_1.on('order.dt', function (event) {
|
|
1135
|
+
if (_this.dataTable) {
|
|
1136
|
+
var order = _this.dataTable.order();
|
|
1137
|
+
if (order && order.length) {
|
|
1138
|
+
_this.order.emit(order);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}).on('draw.dt', function (event) {
|
|
1142
|
+
_this.draw.emit();
|
|
1143
|
+
if (_this.dataTable) {
|
|
1144
|
+
var info = _this.dataTable.page.info();
|
|
1145
|
+
_this.page.emit(info);
|
|
1146
|
+
try {
|
|
1147
|
+
_this.dataTable.columns.adjust();
|
|
1148
|
+
}
|
|
1149
|
+
catch (err) {
|
|
1150
|
+
console.error('ERROR', 'An error occurred while adjusting table columns');
|
|
1151
|
+
console.error(err);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1127
1155
|
// allow selection
|
|
1128
1156
|
if (this.selectable) {
|
|
1129
1157
|
// get first column (as row primary key)
|
|
@@ -1148,10 +1176,6 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
1148
1176
|
// user interface additions
|
|
1149
1177
|
// handle page change event (a trick for firing draw.dt events)
|
|
1150
1178
|
tableElement_1
|
|
1151
|
-
// for each page
|
|
1152
|
-
.on('page.dt', function ($event) {
|
|
1153
|
-
var info = _this.dataTable.page.info();
|
|
1154
|
-
})
|
|
1155
1179
|
// handle draw events
|
|
1156
1180
|
.on('draw.dt', function () {
|
|
1157
1181
|
if (_this.customSelect) {
|
|
@@ -1256,7 +1280,7 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
1256
1280
|
// get page size param
|
|
1257
1281
|
var top = aoData[4].value;
|
|
1258
1282
|
// get search value
|
|
1259
|
-
var
|
|
1283
|
+
var search = aoData[5].value;
|
|
1260
1284
|
// get data queryable
|
|
1261
1285
|
var q = self._query instanceof ClientDataQueryable ? self._query : self._context.model(self.config.model).asQueryable();
|
|
1262
1286
|
// apply paging params
|
|
@@ -1273,7 +1297,7 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
1273
1297
|
q.setParam('$orderby', orderByStr);
|
|
1274
1298
|
}
|
|
1275
1299
|
// configure $select parameter
|
|
1276
|
-
var select = self.config.columns.filter(function (column) {
|
|
1300
|
+
var select$$1 = self.config.columns.filter(function (column) {
|
|
1277
1301
|
if (column.virtual === true) {
|
|
1278
1302
|
return false;
|
|
1279
1303
|
}
|
|
@@ -1286,7 +1310,7 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
1286
1310
|
return column.name;
|
|
1287
1311
|
}
|
|
1288
1312
|
});
|
|
1289
|
-
q.select.apply(q, select);
|
|
1313
|
+
q.select.apply(q, select$$1);
|
|
1290
1314
|
// configure $filter
|
|
1291
1315
|
if (queryParams.$filter && queryParams.$filter.length) {
|
|
1292
1316
|
// set route filter
|
|
@@ -1363,6 +1387,20 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
1363
1387
|
},
|
|
1364
1388
|
language: Object.assign({}, self.translator.transform('Tables.DataTable'), { emptyTable: ' ' }),
|
|
1365
1389
|
};
|
|
1390
|
+
var stateSettings = {
|
|
1391
|
+
stateSave: this.stateSave
|
|
1392
|
+
};
|
|
1393
|
+
if (this.stateLoadCallback) {
|
|
1394
|
+
Object.assign(stateSettings, {
|
|
1395
|
+
stateLoadCallback: this.stateLoadCallback
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
if (this.stateSaveCallback) {
|
|
1399
|
+
Object.assign(stateSettings, {
|
|
1400
|
+
stateSaveCallback: this.stateSaveCallback
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
Object.assign(settings, stateSettings);
|
|
1366
1404
|
if (this.scrollable) {
|
|
1367
1405
|
// set continuous scrolling
|
|
1368
1406
|
Object.assign(settings, {
|
|
@@ -1383,15 +1421,22 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
1383
1421
|
}
|
|
1384
1422
|
if (this.selectable) ;
|
|
1385
1423
|
// handle init.dt event and emit local event
|
|
1386
|
-
this.dataTable = tableElement_1.
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1424
|
+
this.dataTable = tableElement_1.on('init.dt', function (event) {
|
|
1425
|
+
var scroller = jQuery(event.target).parent();
|
|
1426
|
+
// handle scrolling
|
|
1427
|
+
scroller.on('scroll', function (scrollEvent) {
|
|
1428
|
+
var target = jQuery(scrollEvent.target);
|
|
1429
|
+
var top = target.scrollTop();
|
|
1430
|
+
var left = target.scrollLeft();
|
|
1431
|
+
if (_this.dataTable) {
|
|
1432
|
+
_this.scroll.emit({
|
|
1433
|
+
top: top,
|
|
1434
|
+
left: left
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1438
|
+
}).DataTable(settings);
|
|
1439
|
+
this.init.emit();
|
|
1395
1440
|
// show or hide header
|
|
1396
1441
|
if (!this.showHeader) {
|
|
1397
1442
|
this._element.nativeElement
|
|
@@ -1410,6 +1455,16 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
1410
1455
|
}
|
|
1411
1456
|
}
|
|
1412
1457
|
};
|
|
1458
|
+
AdvancedTableComponent.prototype.scrollTop = function (value) {
|
|
1459
|
+
if (this.dataTable) {
|
|
1460
|
+
this.dataTable.parent().scrollTop(value);
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
AdvancedTableComponent.prototype.scrollLeft = function (value) {
|
|
1464
|
+
if (this.dataTable) {
|
|
1465
|
+
this.dataTable.parent().scrollLeft(value);
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1413
1468
|
Object.defineProperty(AdvancedTableComponent.prototype, "lastQuery", {
|
|
1414
1469
|
get: function () {
|
|
1415
1470
|
var _this = this;
|
|
@@ -1640,12 +1695,19 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
1640
1695
|
init: [{ type: Output, args: ['init',] }],
|
|
1641
1696
|
reload: [{ type: Input, args: ['reload',] }],
|
|
1642
1697
|
select: [{ type: Output, args: ['select',] }],
|
|
1698
|
+
draw: [{ type: Output, args: ['draw',] }],
|
|
1699
|
+
page: [{ type: Output, args: ['page',] }],
|
|
1700
|
+
order: [{ type: Output, args: ['order',] }],
|
|
1701
|
+
scroll: [{ type: Output, args: ['scroll',] }],
|
|
1643
1702
|
selectedItems: [{ type: Output, args: ['selectedItems',] }],
|
|
1644
1703
|
scrollable: [{ type: Input }],
|
|
1645
1704
|
serverSide: [{ type: Input }],
|
|
1646
1705
|
lengthMenu: [{ type: Input }],
|
|
1647
1706
|
paging: [{ type: Input }],
|
|
1648
1707
|
pageLength: [{ type: Input }],
|
|
1708
|
+
stateSave: [{ type: Input }],
|
|
1709
|
+
stateLoadCallback: [{ type: Input }],
|
|
1710
|
+
stateSaveCallback: [{ type: Input }],
|
|
1649
1711
|
scrollY: [{ type: Input }],
|
|
1650
1712
|
scrollX: [{ type: Input }],
|
|
1651
1713
|
selectable: [{ type: Input }],
|
|
@@ -2743,6 +2805,7 @@ var AdvancedTableSearchComponent = /** @class */ (function (_super) {
|
|
|
2743
2805
|
_this.showMore = true;
|
|
2744
2806
|
_this.mergeQueryParams = false;
|
|
2745
2807
|
_this.viewChange = new EventEmitter();
|
|
2808
|
+
_this.listChange = new EventEmitter();
|
|
2746
2809
|
_this.userSearchList = [];
|
|
2747
2810
|
_this.selectedList = null;
|
|
2748
2811
|
return _this;
|
|
@@ -2897,6 +2960,9 @@ var AdvancedTableSearchComponent = /** @class */ (function (_super) {
|
|
|
2897
2960
|
queryParamsHandling: 'merge',
|
|
2898
2961
|
});
|
|
2899
2962
|
}
|
|
2963
|
+
this.filterChange.emit({
|
|
2964
|
+
q: searchText
|
|
2965
|
+
});
|
|
2900
2966
|
// otherwise do search
|
|
2901
2967
|
this.table.search(searchText);
|
|
2902
2968
|
return false;
|
|
@@ -3115,6 +3181,7 @@ var AdvancedTableSearchComponent = /** @class */ (function (_super) {
|
|
|
3115
3181
|
else {
|
|
3116
3182
|
this.table.query = query;
|
|
3117
3183
|
}
|
|
3184
|
+
this.filterChange.emit(this.filter);
|
|
3118
3185
|
this.table.fetch();
|
|
3119
3186
|
_a.label = 2;
|
|
3120
3187
|
case 2: return [2 /*return*/];
|
|
@@ -3261,7 +3328,8 @@ var AdvancedTableSearchComponent = /** @class */ (function (_super) {
|
|
|
3261
3328
|
showMore: [{ type: Input }],
|
|
3262
3329
|
mergeQueryParams: [{ type: Input }],
|
|
3263
3330
|
searchText: [{ type: ViewChild, args: ['searchText',] }],
|
|
3264
|
-
viewChange: [{ type: Output, args: ['viewChange',] }]
|
|
3331
|
+
viewChange: [{ type: Output, args: ['viewChange',] }],
|
|
3332
|
+
listChange: [{ type: Output, args: ['listChange',] }]
|
|
3265
3333
|
};
|
|
3266
3334
|
return AdvancedTableSearchComponent;
|
|
3267
3335
|
}(AdvancedTableSearchBaseComponent));
|
|
@@ -3609,9 +3677,9 @@ var BtnExpDirective = /** @class */ (function () {
|
|
|
3609
3677
|
var _this = this;
|
|
3610
3678
|
var selectQuery = query.getParams().$select;
|
|
3611
3679
|
var selectQueryArray = selectQuery.split(',');
|
|
3612
|
-
selectQueryArray = selectQueryArray.map(function (select) {
|
|
3680
|
+
selectQueryArray = selectQueryArray.map(function (select$$1) {
|
|
3613
3681
|
var e_1, _a, e_2, _b;
|
|
3614
|
-
var words = select.split(' ');
|
|
3682
|
+
var words = select$$1.split(' ');
|
|
3615
3683
|
if (words.length === 3) {
|
|
3616
3684
|
if (tableConfig && tableConfig.columns) {
|
|
3617
3685
|
try {
|
|
@@ -4537,6 +4605,193 @@ var TABLES_EN = {
|
|
|
4537
4605
|
}
|
|
4538
4606
|
};
|
|
4539
4607
|
|
|
4608
|
+
var TableActionTypes;
|
|
4609
|
+
(function (TableActionTypes) {
|
|
4610
|
+
TableActionTypes["LoadFilter"] = "[Table] Load Filter";
|
|
4611
|
+
TableActionTypes["AppendFilter"] = "[Table] Append Filter";
|
|
4612
|
+
TableActionTypes["AppendState"] = "[Table] Append State";
|
|
4613
|
+
})(TableActionTypes || (TableActionTypes = {}));
|
|
4614
|
+
var AppendFilter = /** @class */ (function () {
|
|
4615
|
+
function AppendFilter(id, filter) {
|
|
4616
|
+
this.id = id;
|
|
4617
|
+
this.filter = filter;
|
|
4618
|
+
this.type = TableActionTypes.AppendFilter;
|
|
4619
|
+
}
|
|
4620
|
+
return AppendFilter;
|
|
4621
|
+
}());
|
|
4622
|
+
var AppendState = /** @class */ (function () {
|
|
4623
|
+
function AppendState(id, data) {
|
|
4624
|
+
this.id = id;
|
|
4625
|
+
this.data = data;
|
|
4626
|
+
this.type = TableActionTypes.AppendState;
|
|
4627
|
+
}
|
|
4628
|
+
return AppendState;
|
|
4629
|
+
}());
|
|
4630
|
+
|
|
4631
|
+
var initialState = {};
|
|
4632
|
+
function tableReducer(state, action) {
|
|
4633
|
+
if (state === void 0) { state = initialState; }
|
|
4634
|
+
switch (action.type) {
|
|
4635
|
+
case TableActionTypes.LoadFilter:
|
|
4636
|
+
return state[action.id];
|
|
4637
|
+
case TableActionTypes.AppendFilter:
|
|
4638
|
+
state[action.id] = __assign({}, state[action.id], { filter: action.filter });
|
|
4639
|
+
return state;
|
|
4640
|
+
case TableActionTypes.AppendState:
|
|
4641
|
+
state[action.id] = __assign({}, state[action.id], { table: action.data });
|
|
4642
|
+
return state;
|
|
4643
|
+
default:
|
|
4644
|
+
return state;
|
|
4645
|
+
}
|
|
4646
|
+
}
|
|
4647
|
+
var tableReducers = {
|
|
4648
|
+
tables: tableReducer,
|
|
4649
|
+
};
|
|
4650
|
+
var featureName = 'tables';
|
|
4651
|
+
var getTablesState = createFeatureSelector(featureName);
|
|
4652
|
+
var selectTable = createSelector(getTablesState, function (state, props) {
|
|
4653
|
+
return state.tables[props.id];
|
|
4654
|
+
});
|
|
4655
|
+
|
|
4656
|
+
var AdvancedTableState = /** @class */ (function () {
|
|
4657
|
+
function AdvancedTableState(table, store) {
|
|
4658
|
+
this.table = table;
|
|
4659
|
+
this.store = store;
|
|
4660
|
+
}
|
|
4661
|
+
AdvancedTableState.prototype.ngOnInit = function () {
|
|
4662
|
+
var _this = this;
|
|
4663
|
+
if (this.store == null) {
|
|
4664
|
+
return;
|
|
4665
|
+
}
|
|
4666
|
+
this.table.stateSave = true;
|
|
4667
|
+
this.table.stateLoadCallback = function (settings, callback) {
|
|
4668
|
+
_this.store.pipe(select(selectTable, { id: _this.tableState }), first()).subscribe(function (state) {
|
|
4669
|
+
return callback(state && state.table);
|
|
4670
|
+
});
|
|
4671
|
+
};
|
|
4672
|
+
var firstDraw = true;
|
|
4673
|
+
this.table.draw.subscribe(function () {
|
|
4674
|
+
if (firstDraw === false) {
|
|
4675
|
+
return;
|
|
4676
|
+
}
|
|
4677
|
+
if (_this.table.dataTable == null) {
|
|
4678
|
+
return;
|
|
4679
|
+
}
|
|
4680
|
+
firstDraw = false;
|
|
4681
|
+
var loadeStateSettings = _this.table.dataTable.settings()[0];
|
|
4682
|
+
var scrollerSettings = loadeStateSettings.oSavedState &&
|
|
4683
|
+
loadeStateSettings.oSavedState.scroller;
|
|
4684
|
+
if (scrollerSettings && scrollerSettings.topRow) {
|
|
4685
|
+
var scroller = _this.table.dataTable.scroller();
|
|
4686
|
+
scroller.scrollToRow(scrollerSettings.topRow, true);
|
|
4687
|
+
}
|
|
4688
|
+
});
|
|
4689
|
+
this.table.stateSaveCallback = function (settings, data) {
|
|
4690
|
+
_this.store.dispatch(new AppendState(_this.tableState, data));
|
|
4691
|
+
};
|
|
4692
|
+
};
|
|
4693
|
+
AdvancedTableState.decorators = [
|
|
4694
|
+
{ type: Directive, args: [{
|
|
4695
|
+
// tslint:disable-next-line: directive-selector
|
|
4696
|
+
selector: '[tableState]',
|
|
4697
|
+
},] }
|
|
4698
|
+
];
|
|
4699
|
+
/** @nocollapse */
|
|
4700
|
+
AdvancedTableState.ctorParameters = function () { return [
|
|
4701
|
+
{ type: AdvancedTableComponent },
|
|
4702
|
+
{ type: Store, decorators: [{ type: Optional }] }
|
|
4703
|
+
]; };
|
|
4704
|
+
AdvancedTableState.propDecorators = {
|
|
4705
|
+
tableState: [{ type: Input }]
|
|
4706
|
+
};
|
|
4707
|
+
return AdvancedTableState;
|
|
4708
|
+
}());
|
|
4709
|
+
|
|
4710
|
+
var AdvancedTableSearchComponentNotNull = /** @class */ (function (_super) {
|
|
4711
|
+
__extends(AdvancedTableSearchComponentNotNull, _super);
|
|
4712
|
+
function AdvancedTableSearchComponentNotNull() {
|
|
4713
|
+
return _super.call(this, 'Advanced table search component cannot be empty at this context.') || this;
|
|
4714
|
+
}
|
|
4715
|
+
return AdvancedTableSearchComponentNotNull;
|
|
4716
|
+
}(Error));
|
|
4717
|
+
var AdvancedSearchState = /** @class */ (function () {
|
|
4718
|
+
function AdvancedSearchState(search, store) {
|
|
4719
|
+
this.search = search;
|
|
4720
|
+
this.store = store;
|
|
4721
|
+
}
|
|
4722
|
+
AdvancedSearchState.prototype.ngOnInit = function () {
|
|
4723
|
+
var _this = this;
|
|
4724
|
+
if (this.store == null) {
|
|
4725
|
+
return;
|
|
4726
|
+
}
|
|
4727
|
+
if (this.search == null) {
|
|
4728
|
+
throw new AdvancedTableSearchComponentNotNull();
|
|
4729
|
+
}
|
|
4730
|
+
if (this.search.table) {
|
|
4731
|
+
// set auto load to false
|
|
4732
|
+
this.search.table.autoLoad = false;
|
|
4733
|
+
// handle filtering
|
|
4734
|
+
this.search.filterChange.subscribe(function (filter) {
|
|
4735
|
+
_this.onSearchFilter(filter);
|
|
4736
|
+
});
|
|
4737
|
+
// handle table state (via directive)
|
|
4738
|
+
var tableState = new AdvancedTableState(this.search.table, this.store);
|
|
4739
|
+
tableState.tableState = this.searchState;
|
|
4740
|
+
tableState.ngOnInit();
|
|
4741
|
+
// handle table init
|
|
4742
|
+
this.search.table.init.subscribe(function () {
|
|
4743
|
+
return _this.onTableInit();
|
|
4744
|
+
});
|
|
4745
|
+
}
|
|
4746
|
+
};
|
|
4747
|
+
AdvancedSearchState.prototype.onTableInit = function () {
|
|
4748
|
+
var _this = this;
|
|
4749
|
+
this.store.pipe(select(selectTable, { id: this.searchState }), first()).subscribe(function (state) {
|
|
4750
|
+
// use order
|
|
4751
|
+
if (state) {
|
|
4752
|
+
if (state.order && state.order.length) {
|
|
4753
|
+
_this.search.table.dataTable.order(state.order);
|
|
4754
|
+
}
|
|
4755
|
+
// use text search
|
|
4756
|
+
if (state.filter && state.filter.q) {
|
|
4757
|
+
_this.search.text = state.filter.q;
|
|
4758
|
+
_this.search.collapsed = true;
|
|
4759
|
+
return _this.search.table.search(_this.search.text);
|
|
4760
|
+
}
|
|
4761
|
+
// use predefined search
|
|
4762
|
+
if (state.filter && state.filter.s) {
|
|
4763
|
+
_this.search.selectedList = _this.search.userSearchList.find(function (item) {
|
|
4764
|
+
return item.name === state.filter.s;
|
|
4765
|
+
});
|
|
4766
|
+
return _this.search.search();
|
|
4767
|
+
}
|
|
4768
|
+
if (state.filter) {
|
|
4769
|
+
_this.search.filter = state.filter;
|
|
4770
|
+
}
|
|
4771
|
+
return _this.search.search();
|
|
4772
|
+
}
|
|
4773
|
+
});
|
|
4774
|
+
};
|
|
4775
|
+
AdvancedSearchState.prototype.onSearchFilter = function (filter) {
|
|
4776
|
+
this.store.dispatch(new AppendFilter(this.searchState, filter));
|
|
4777
|
+
};
|
|
4778
|
+
AdvancedSearchState.decorators = [
|
|
4779
|
+
{ type: Directive, args: [{
|
|
4780
|
+
// tslint:disable-next-line: directive-selector
|
|
4781
|
+
selector: '[searchState]',
|
|
4782
|
+
},] }
|
|
4783
|
+
];
|
|
4784
|
+
/** @nocollapse */
|
|
4785
|
+
AdvancedSearchState.ctorParameters = function () { return [
|
|
4786
|
+
{ type: AdvancedTableSearchComponent },
|
|
4787
|
+
{ type: Store, decorators: [{ type: Optional }] }
|
|
4788
|
+
]; };
|
|
4789
|
+
AdvancedSearchState.propDecorators = {
|
|
4790
|
+
searchState: [{ type: Input }]
|
|
4791
|
+
};
|
|
4792
|
+
return AdvancedSearchState;
|
|
4793
|
+
}());
|
|
4794
|
+
|
|
4540
4795
|
var ɵ0 = FORMATTERS;
|
|
4541
4796
|
var TablesModule = /** @class */ (function () {
|
|
4542
4797
|
function TablesModule(_translateService) {
|
|
@@ -4570,7 +4825,8 @@ var TablesModule = /** @class */ (function () {
|
|
|
4570
4825
|
SharedModule,
|
|
4571
4826
|
ModalModule,
|
|
4572
4827
|
ProgressbarModule,
|
|
4573
|
-
NgPipesModule
|
|
4828
|
+
NgPipesModule,
|
|
4829
|
+
StoreModule.forFeature(featureName, tableReducers)
|
|
4574
4830
|
],
|
|
4575
4831
|
providers: [DatePipe, TemplatePipe,
|
|
4576
4832
|
{
|
|
@@ -4600,7 +4856,9 @@ var TablesModule = /** @class */ (function () {
|
|
|
4600
4856
|
AdvancedAggregatorListComponent,
|
|
4601
4857
|
AdvancedAggregatorPipe,
|
|
4602
4858
|
ParseTitlePipe,
|
|
4603
|
-
AddItemsComponent
|
|
4859
|
+
AddItemsComponent,
|
|
4860
|
+
AdvancedSearchState,
|
|
4861
|
+
AdvancedTableState
|
|
4604
4862
|
],
|
|
4605
4863
|
exports: [
|
|
4606
4864
|
AdvancedTableComponent,
|
|
@@ -4616,7 +4874,9 @@ var TablesModule = /** @class */ (function () {
|
|
|
4616
4874
|
AdvancedTableEditorDirective,
|
|
4617
4875
|
AdvancedAggregatorComponent,
|
|
4618
4876
|
AdvancedAggregatorListComponent,
|
|
4619
|
-
AddItemsComponent
|
|
4877
|
+
AddItemsComponent,
|
|
4878
|
+
AdvancedSearchState,
|
|
4879
|
+
AdvancedTableState
|
|
4620
4880
|
],
|
|
4621
4881
|
entryComponents: [
|
|
4622
4882
|
AdvancedTableModalBaseComponent,
|
|
@@ -4643,6 +4903,6 @@ var TablesModule = /** @class */ (function () {
|
|
|
4643
4903
|
* Generated bundle index. Do not edit.
|
|
4644
4904
|
*/
|
|
4645
4905
|
|
|
4646
|
-
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 };
|
|
4906
|
+
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 };
|
|
4647
4907
|
|
|
4648
4908
|
//# sourceMappingURL=universis-ngx-tables.js.map
|