@universis/ngx-tables 0.7.5 → 0.7.8
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 +114 -13
- 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/components/advanced-table/advanced-table.component.js +15 -1
- package/esm2015/lib/directives/advance-search-state.directive.js +29 -9
- package/esm2015/lib/directives/advanced-search-router-state.directive.js +63 -0
- package/esm2015/lib/tables.module.js +6 -3
- package/esm2015/universis-ngx-tables.js +2 -1
- package/esm5/lib/components/advanced-table/advanced-table.component.js +15 -1
- package/esm5/lib/directives/advance-search-state.directive.js +29 -9
- package/esm5/lib/directives/advanced-search-router-state.directive.js +71 -0
- package/esm5/lib/tables.module.js +6 -3
- package/esm5/universis-ngx-tables.js +2 -1
- package/fesm2015/universis-ngx-tables.js +123 -31
- package/fesm2015/universis-ngx-tables.js.map +1 -1
- package/fesm5/universis-ngx-tables.js +129 -31
- package/fesm5/universis-ngx-tables.js.map +1 -1
- package/lib/components/advanced-table/advanced-table.component.d.ts +1 -0
- package/lib/directives/advance-search-state.directive.d.ts +8 -4
- package/lib/directives/advanced-search-router-state.directive.d.ts +16 -0
- package/package.json +1 -1
- package/universis-ngx-tables.d.ts +1 -0
- package/universis-ngx-tables.metadata.json +1 -1
|
@@ -15,14 +15,14 @@ import { TemplatePipe, LoadingService, ErrorService, DIALOG_BUTTONS, ModalServic
|
|
|
15
15
|
import { RouterModalOkCancel, RouterModalModule } from '@universis/common/routing';
|
|
16
16
|
import { ServiceUrlPreProcessor, TranslatePreProcessor, AdvancedFormsModule } from '@universis/forms';
|
|
17
17
|
import { FormioModule } from 'angular-formio';
|
|
18
|
-
import { ActivatedRoute, Router, NavigationStart, RouterModule } from '@angular/router';
|
|
19
18
|
import { BsModalRef, BsModalService, ModalModule } from 'ngx-bootstrap/modal';
|
|
20
19
|
import { ProgressbarModule } from 'ngx-bootstrap/progressbar';
|
|
21
20
|
import { GroupByPipe, NgPipesModule } from 'ngx-pipes';
|
|
22
21
|
import { __extends, __awaiter, __generator, __values, __assign, __spread } from 'tslib';
|
|
23
22
|
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';
|
|
23
|
+
import { ActivatedRoute, Router, NavigationStart, NavigationEnd, RouterModule } from '@angular/router';
|
|
24
24
|
import { createFeatureSelector, createSelector, select, Store } from '@ngrx/store';
|
|
25
|
-
import { first } from 'rxjs/operators';
|
|
25
|
+
import { first, filter } from 'rxjs/operators';
|
|
26
26
|
|
|
27
27
|
var AdvancedColumnFormatter = /** @class */ (function () {
|
|
28
28
|
function AdvancedColumnFormatter() {
|
|
@@ -481,20 +481,20 @@ var AdvancedFilterValueProvider = /** @class */ (function () {
|
|
|
481
481
|
this.values = {};
|
|
482
482
|
this._template = new TemplatePipe();
|
|
483
483
|
}
|
|
484
|
-
AdvancedFilterValueProvider.prototype.buildFilter = function (filter) {
|
|
485
|
-
if (filter) {
|
|
486
|
-
return this._template.transform(filter, this.values);
|
|
484
|
+
AdvancedFilterValueProvider.prototype.buildFilter = function (filter$$1) {
|
|
485
|
+
if (filter$$1) {
|
|
486
|
+
return this._template.transform(filter$$1, this.values);
|
|
487
487
|
}
|
|
488
488
|
};
|
|
489
|
-
AdvancedFilterValueProvider.prototype.asyncBuildFilter = function (filter) {
|
|
489
|
+
AdvancedFilterValueProvider.prototype.asyncBuildFilter = function (filter$$1) {
|
|
490
490
|
return __awaiter(this, void 0, void 0, function () {
|
|
491
491
|
var _a, _b, _c;
|
|
492
492
|
return __generator(this, function (_d) {
|
|
493
493
|
switch (_d.label) {
|
|
494
494
|
case 0:
|
|
495
|
-
if (!filter) return [3 /*break*/, 2];
|
|
495
|
+
if (!filter$$1) return [3 /*break*/, 2];
|
|
496
496
|
_b = (_a = this._template).transform;
|
|
497
|
-
_c = [filter];
|
|
497
|
+
_c = [filter$$1];
|
|
498
498
|
return [4 /*yield*/, this.getValues()];
|
|
499
499
|
case 1: return [2 /*return*/, _b.apply(_a, _c.concat([_d.sent()]))];
|
|
500
500
|
case 2: return [2 /*return*/];
|
|
@@ -767,13 +767,13 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
767
767
|
// try to split words
|
|
768
768
|
var words = searchText.split(' ');
|
|
769
769
|
// join words to a single filter
|
|
770
|
-
var filter = words.map(function (word) {
|
|
770
|
+
var filter$$1 = words.map(function (word) {
|
|
771
771
|
return _this._template.transform(_this.config.searchExpression, {
|
|
772
772
|
text: word,
|
|
773
773
|
});
|
|
774
774
|
}).join(' and ');
|
|
775
775
|
// set filter
|
|
776
|
-
this.query.setParam('$filter', filter);
|
|
776
|
+
this.query.setParam('$filter', filter$$1);
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
779
|
else {
|
|
@@ -1116,6 +1116,13 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
1116
1116
|
});
|
|
1117
1117
|
// get table element
|
|
1118
1118
|
var tableElement_1 = jQuery(this.table.nativeElement);
|
|
1119
|
+
jQuery(window).on('resize', function () {
|
|
1120
|
+
setTimeout(function () {
|
|
1121
|
+
if (_this.dataTable) {
|
|
1122
|
+
_this.dataTable.columns.adjust();
|
|
1123
|
+
}
|
|
1124
|
+
}, 1);
|
|
1125
|
+
});
|
|
1119
1126
|
// tslint:disable-next-line: no-shadowed-variable
|
|
1120
1127
|
tableElement_1.on('processing.dt', function (event, settings, processing) {
|
|
1121
1128
|
if (processing) {
|
|
@@ -1656,6 +1663,7 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
1656
1663
|
this._http.get(changes.configSrc.currentValue).toPromise().then(function (config) {
|
|
1657
1664
|
// set configuration
|
|
1658
1665
|
_this.config = config;
|
|
1666
|
+
_this.destroy();
|
|
1659
1667
|
// fetch and redraw
|
|
1660
1668
|
_this.fetch();
|
|
1661
1669
|
}).catch(function (err) {
|
|
@@ -1666,6 +1674,12 @@ var AdvancedTableComponent = /** @class */ (function () {
|
|
|
1666
1674
|
}
|
|
1667
1675
|
}
|
|
1668
1676
|
};
|
|
1677
|
+
AdvancedTableComponent.prototype.reset = function (load) {
|
|
1678
|
+
this.query = null;
|
|
1679
|
+
this.destroy();
|
|
1680
|
+
this.autoLoad = !!load;
|
|
1681
|
+
this.ngOnInit();
|
|
1682
|
+
};
|
|
1669
1683
|
AdvancedTableComponent.decorators = [
|
|
1670
1684
|
{ type: Component, args: [{
|
|
1671
1685
|
// tslint:disable-next-line: component-selector
|
|
@@ -2162,8 +2176,8 @@ var AdvancedSearchFormComponent = /** @class */ (function (_super) {
|
|
|
2162
2176
|
form: this.form
|
|
2163
2177
|
});
|
|
2164
2178
|
this.loading = false;
|
|
2165
|
-
this.filterSubscription = this.filterChange.subscribe(function (filter) {
|
|
2166
|
-
_this.submission.data = filter;
|
|
2179
|
+
this.filterSubscription = this.filterChange.subscribe(function (filter$$1) {
|
|
2180
|
+
_this.submission.data = filter$$1;
|
|
2167
2181
|
_this.refreshForm.emit({
|
|
2168
2182
|
submission: _this.submission
|
|
2169
2183
|
});
|
|
@@ -2442,7 +2456,7 @@ var AdvancedTableModalBaseComponent = /** @class */ (function (_super) {
|
|
|
2442
2456
|
* @param {object} filter The filter to use in the search
|
|
2443
2457
|
*
|
|
2444
2458
|
*/
|
|
2445
|
-
AdvancedTableModalBaseComponent.prototype.advancedSearch = function (filter) {
|
|
2459
|
+
AdvancedTableModalBaseComponent.prototype.advancedSearch = function (filter$$1) {
|
|
2446
2460
|
return __awaiter(this, void 0, void 0, function () {
|
|
2447
2461
|
var defaultFilterValues, err_1, expressions, predefinedCriteria, query;
|
|
2448
2462
|
return __generator(this, function (_a) {
|
|
@@ -2466,9 +2480,9 @@ var AdvancedTableModalBaseComponent = /** @class */ (function (_super) {
|
|
|
2466
2480
|
return [3 /*break*/, 4];
|
|
2467
2481
|
case 4:
|
|
2468
2482
|
expressions = [];
|
|
2469
|
-
if (filter) {
|
|
2470
|
-
this.defaultFilter = filter;
|
|
2471
|
-
predefinedCriteria = this.getFilters(this.tableConfig, defaultFilterValues, filter);
|
|
2483
|
+
if (filter$$1) {
|
|
2484
|
+
this.defaultFilter = filter$$1;
|
|
2485
|
+
predefinedCriteria = this.getFilters(this.tableConfig, defaultFilterValues, filter$$1);
|
|
2472
2486
|
}
|
|
2473
2487
|
else {
|
|
2474
2488
|
// Empty a falsy filter resets the results
|
|
@@ -4616,9 +4630,9 @@ var TableActionTypes;
|
|
|
4616
4630
|
TableActionTypes["AppendState"] = "[Table] Append State";
|
|
4617
4631
|
})(TableActionTypes || (TableActionTypes = {}));
|
|
4618
4632
|
var AppendFilter = /** @class */ (function () {
|
|
4619
|
-
function AppendFilter(id, filter) {
|
|
4633
|
+
function AppendFilter(id, filter$$1) {
|
|
4620
4634
|
this.id = id;
|
|
4621
|
-
this.filter = filter;
|
|
4635
|
+
this.filter = filter$$1;
|
|
4622
4636
|
this.type = TableActionTypes.AppendFilter;
|
|
4623
4637
|
}
|
|
4624
4638
|
return AppendFilter;
|
|
@@ -4739,19 +4753,23 @@ var AdvancedSearchState = /** @class */ (function () {
|
|
|
4739
4753
|
// set auto load to false
|
|
4740
4754
|
this.search.table.autoLoad = false;
|
|
4741
4755
|
// handle filtering
|
|
4742
|
-
this.search.filterChange.subscribe(function (filter) {
|
|
4743
|
-
_this.onSearchFilter(filter);
|
|
4756
|
+
this.filterChangeSubscription = this.search.filterChange.subscribe(function (filter$$1) {
|
|
4757
|
+
_this.onSearchFilter(filter$$1);
|
|
4744
4758
|
});
|
|
4745
|
-
//
|
|
4746
|
-
|
|
4747
|
-
tableState.tableState = this.searchState;
|
|
4748
|
-
tableState.ngOnInit();
|
|
4759
|
+
// apply table state
|
|
4760
|
+
this.applyTableState();
|
|
4749
4761
|
// handle table init
|
|
4750
|
-
this.search.table.init.subscribe(function () {
|
|
4762
|
+
this.tableInitSubscription = this.search.table.init.subscribe(function () {
|
|
4751
4763
|
return _this.onTableInit();
|
|
4752
4764
|
});
|
|
4753
4765
|
}
|
|
4754
4766
|
};
|
|
4767
|
+
AdvancedSearchState.prototype.applyTableState = function () {
|
|
4768
|
+
// handle table state (via directive)
|
|
4769
|
+
var tableState = new AdvancedTableState(this.search.table, this.store);
|
|
4770
|
+
tableState.tableState = this.searchState;
|
|
4771
|
+
tableState.ngOnInit();
|
|
4772
|
+
};
|
|
4755
4773
|
AdvancedSearchState.prototype.onTableInit = function () {
|
|
4756
4774
|
var _this = this;
|
|
4757
4775
|
this.store.pipe(select(selectTable, { id: this.searchState }), first()).subscribe(function (state) {
|
|
@@ -4774,14 +4792,30 @@ var AdvancedSearchState = /** @class */ (function () {
|
|
|
4774
4792
|
return _this.search.search();
|
|
4775
4793
|
}
|
|
4776
4794
|
if (state.filter) {
|
|
4777
|
-
|
|
4795
|
+
if (Object.keys(state.filter).length) {
|
|
4796
|
+
// set collapsed to false (advanced search)
|
|
4797
|
+
_this.search.collapsed = false;
|
|
4798
|
+
_this.search.filter = state.filter;
|
|
4799
|
+
return _this.search.search();
|
|
4800
|
+
}
|
|
4778
4801
|
}
|
|
4802
|
+
// ensure empty filter at this moment
|
|
4803
|
+
// because search() function triggers a store dispatch
|
|
4804
|
+
_this.search.filter = {};
|
|
4779
4805
|
return _this.search.search();
|
|
4780
4806
|
}
|
|
4781
4807
|
});
|
|
4782
4808
|
};
|
|
4783
|
-
AdvancedSearchState.prototype.onSearchFilter = function (filter) {
|
|
4784
|
-
this.store.dispatch(new AppendFilter(this.searchState, filter));
|
|
4809
|
+
AdvancedSearchState.prototype.onSearchFilter = function (filter$$1) {
|
|
4810
|
+
this.store.dispatch(new AppendFilter(this.searchState, filter$$1));
|
|
4811
|
+
};
|
|
4812
|
+
AdvancedSearchState.prototype.ngOnDestroy = function () {
|
|
4813
|
+
if (this.filterChangeSubscription) {
|
|
4814
|
+
this.filterChangeSubscription.unsubscribe();
|
|
4815
|
+
}
|
|
4816
|
+
if (this.tableInitSubscription) {
|
|
4817
|
+
this.tableInitSubscription.unsubscribe();
|
|
4818
|
+
}
|
|
4785
4819
|
};
|
|
4786
4820
|
AdvancedSearchState.decorators = [
|
|
4787
4821
|
{ type: Directive, args: [{
|
|
@@ -4800,6 +4834,68 @@ var AdvancedSearchState = /** @class */ (function () {
|
|
|
4800
4834
|
return AdvancedSearchState;
|
|
4801
4835
|
}());
|
|
4802
4836
|
|
|
4837
|
+
var AdvancedSearchRouterState = /** @class */ (function (_super) {
|
|
4838
|
+
__extends(AdvancedSearchRouterState, _super);
|
|
4839
|
+
function AdvancedSearchRouterState(search, store, _router) {
|
|
4840
|
+
var _this =
|
|
4841
|
+
// call super constructor
|
|
4842
|
+
_super.call(this, search, store) || this;
|
|
4843
|
+
_this.search = search;
|
|
4844
|
+
_this.store = store;
|
|
4845
|
+
_this._router = _router;
|
|
4846
|
+
_this._enteringState = true;
|
|
4847
|
+
_this._applyState = false;
|
|
4848
|
+
// set search state dynamically according to route
|
|
4849
|
+
_this._routerSubscription = _this._router.events
|
|
4850
|
+
.pipe(filter(function (event) {
|
|
4851
|
+
return event instanceof NavigationStart || event instanceof NavigationEnd;
|
|
4852
|
+
}))
|
|
4853
|
+
.subscribe(function (event) {
|
|
4854
|
+
// capture urls regarding tab changing while the component is active
|
|
4855
|
+
if (event instanceof NavigationStart && !_this._enteringState) {
|
|
4856
|
+
// set search state
|
|
4857
|
+
_this.searchState = event.url;
|
|
4858
|
+
// toogle applyState
|
|
4859
|
+
_this._applyState = true;
|
|
4860
|
+
}
|
|
4861
|
+
// capture url of the first activation of the component (e.g. coming from another route)
|
|
4862
|
+
if (event instanceof NavigationEnd && _this._enteringState) {
|
|
4863
|
+
// set search state
|
|
4864
|
+
_this.searchState = event.urlAfterRedirects;
|
|
4865
|
+
// toggle enteringState
|
|
4866
|
+
_this._enteringState = false;
|
|
4867
|
+
}
|
|
4868
|
+
if (_this._applyState) {
|
|
4869
|
+
// apply new table state
|
|
4870
|
+
_super.prototype.applyTableState.call(_this);
|
|
4871
|
+
_this._applyState = false;
|
|
4872
|
+
}
|
|
4873
|
+
});
|
|
4874
|
+
return _this;
|
|
4875
|
+
}
|
|
4876
|
+
AdvancedSearchRouterState.prototype.ngOnDestroy = function () {
|
|
4877
|
+
// destroy own subscriptions
|
|
4878
|
+
if (this._routerSubscription) {
|
|
4879
|
+
this._routerSubscription.unsubscribe();
|
|
4880
|
+
}
|
|
4881
|
+
// destroy parent subscriptions
|
|
4882
|
+
return _super.prototype.ngOnDestroy.call(this);
|
|
4883
|
+
};
|
|
4884
|
+
AdvancedSearchRouterState.decorators = [
|
|
4885
|
+
{ type: Directive, args: [{
|
|
4886
|
+
// tslint:disable-next-line: directive-selector
|
|
4887
|
+
selector: "[routerSearchState]",
|
|
4888
|
+
},] }
|
|
4889
|
+
];
|
|
4890
|
+
/** @nocollapse */
|
|
4891
|
+
AdvancedSearchRouterState.ctorParameters = function () { return [
|
|
4892
|
+
{ type: AdvancedTableSearchComponent },
|
|
4893
|
+
{ type: Store, decorators: [{ type: Optional }] },
|
|
4894
|
+
{ type: Router }
|
|
4895
|
+
]; };
|
|
4896
|
+
return AdvancedSearchRouterState;
|
|
4897
|
+
}(AdvancedSearchState));
|
|
4898
|
+
|
|
4803
4899
|
var ɵ0 = FORMATTERS;
|
|
4804
4900
|
var TablesModule = /** @class */ (function () {
|
|
4805
4901
|
function TablesModule(_translateService) {
|
|
@@ -4865,7 +4961,8 @@ var TablesModule = /** @class */ (function () {
|
|
|
4865
4961
|
ParseTitlePipe,
|
|
4866
4962
|
AddItemsComponent,
|
|
4867
4963
|
AdvancedSearchState,
|
|
4868
|
-
AdvancedTableState
|
|
4964
|
+
AdvancedTableState,
|
|
4965
|
+
AdvancedSearchRouterState
|
|
4869
4966
|
],
|
|
4870
4967
|
exports: [
|
|
4871
4968
|
AdvancedTableComponent,
|
|
@@ -4883,7 +4980,8 @@ var TablesModule = /** @class */ (function () {
|
|
|
4883
4980
|
AdvancedAggregatorListComponent,
|
|
4884
4981
|
AddItemsComponent,
|
|
4885
4982
|
AdvancedSearchState,
|
|
4886
|
-
AdvancedTableState
|
|
4983
|
+
AdvancedTableState,
|
|
4984
|
+
AdvancedSearchRouterState
|
|
4887
4985
|
],
|
|
4888
4986
|
entryComponents: [
|
|
4889
4987
|
AdvancedTableModalBaseComponent,
|
|
@@ -4910,6 +5008,6 @@ var TablesModule = /** @class */ (function () {
|
|
|
4910
5008
|
* Generated bundle index. Do not edit.
|
|
4911
5009
|
*/
|
|
4912
5010
|
|
|
4913
|
-
export { AdvancedSearchState as ɵa, AdvancedTableState 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, initialState, tableInitialState, tableReducer, tableReducers, featureName, getTablesState, selectTable };
|
|
5011
|
+
export { AdvancedSearchState as ɵa, AdvancedTableState as ɵc, AdvancedSearchRouterState as ɵd, 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, initialState, tableInitialState, tableReducer, tableReducers, featureName, getTablesState, selectTable };
|
|
4914
5012
|
|
|
4915
5013
|
//# sourceMappingURL=universis-ngx-tables.js.map
|