@universis/ngx-tables 0.7.6 → 0.7.7
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 +100 -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/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/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 +109 -31
- package/fesm2015/universis-ngx-tables.js.map +1 -1
- package/fesm5/universis-ngx-tables.js +115 -31
- package/fesm5/universis-ngx-tables.js.map +1 -1
- 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
|
@@ -16,13 +16,13 @@ import { TemplatePipe, LoadingService, ErrorService, DIALOG_BUTTONS, ModalServic
|
|
|
16
16
|
import { RouterModalOkCancel, RouterModalModule } from '@universis/common/routing';
|
|
17
17
|
import { ServiceUrlPreProcessor, TranslatePreProcessor, AdvancedFormsModule } from '@universis/forms';
|
|
18
18
|
import { FormioModule } from 'angular-formio';
|
|
19
|
-
import { ActivatedRoute, Router, NavigationStart, RouterModule } from '@angular/router';
|
|
20
19
|
import { BsModalRef, BsModalService, ModalModule } from 'ngx-bootstrap/modal';
|
|
21
20
|
import { ProgressbarModule } from 'ngx-bootstrap/progressbar';
|
|
22
21
|
import { GroupByPipe, NgPipesModule } from 'ngx-pipes';
|
|
23
22
|
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';
|
|
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
|
class AdvancedColumnFormatter {
|
|
28
28
|
static template(expr) {
|
|
@@ -445,15 +445,15 @@ class AdvancedFilterValueProvider {
|
|
|
445
445
|
this.values = {};
|
|
446
446
|
this._template = new TemplatePipe();
|
|
447
447
|
}
|
|
448
|
-
buildFilter(filter) {
|
|
449
|
-
if (filter) {
|
|
450
|
-
return this._template.transform(filter, this.values);
|
|
448
|
+
buildFilter(filter$$1) {
|
|
449
|
+
if (filter$$1) {
|
|
450
|
+
return this._template.transform(filter$$1, this.values);
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
asyncBuildFilter(filter) {
|
|
453
|
+
asyncBuildFilter(filter$$1) {
|
|
454
454
|
return __awaiter(this, void 0, void 0, function* () {
|
|
455
|
-
if (filter) {
|
|
456
|
-
return this._template.transform(filter, yield this.getValues());
|
|
455
|
+
if (filter$$1) {
|
|
456
|
+
return this._template.transform(filter$$1, yield this.getValues());
|
|
457
457
|
}
|
|
458
458
|
});
|
|
459
459
|
}
|
|
@@ -686,13 +686,13 @@ class AdvancedTableComponent {
|
|
|
686
686
|
// try to split words
|
|
687
687
|
const words = searchText.split(' ');
|
|
688
688
|
// join words to a single filter
|
|
689
|
-
const filter = words.map((word) => {
|
|
689
|
+
const filter$$1 = words.map((word) => {
|
|
690
690
|
return this._template.transform(this.config.searchExpression, {
|
|
691
691
|
text: word,
|
|
692
692
|
});
|
|
693
693
|
}).join(' and ');
|
|
694
694
|
// set filter
|
|
695
|
-
this.query.setParam('$filter', filter);
|
|
695
|
+
this.query.setParam('$filter', filter$$1);
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
698
|
else {
|
|
@@ -2070,8 +2070,8 @@ class AdvancedSearchFormComponent extends AdvancedTableSearchBaseComponent {
|
|
|
2070
2070
|
form: this.form
|
|
2071
2071
|
});
|
|
2072
2072
|
this.loading = false;
|
|
2073
|
-
this.filterSubscription = this.filterChange.subscribe(filter => {
|
|
2074
|
-
this.submission.data = filter;
|
|
2073
|
+
this.filterSubscription = this.filterChange.subscribe(filter$$1 => {
|
|
2074
|
+
this.submission.data = filter$$1;
|
|
2075
2075
|
this.refreshForm.emit({
|
|
2076
2076
|
submission: this.submission
|
|
2077
2077
|
});
|
|
@@ -2447,7 +2447,7 @@ class AdvancedTableModalBaseComponent extends RouterModalOkCancel {
|
|
|
2447
2447
|
* @param {object} filter The filter to use in the search
|
|
2448
2448
|
*
|
|
2449
2449
|
*/
|
|
2450
|
-
advancedSearch(filter) {
|
|
2450
|
+
advancedSearch(filter$$1) {
|
|
2451
2451
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2452
2452
|
// Do nothing in absence of configuration.
|
|
2453
2453
|
if (!this.tableConfig && !Array.isArray(this.tableConfig.criteria)) {
|
|
@@ -2464,9 +2464,9 @@ class AdvancedTableModalBaseComponent extends RouterModalOkCancel {
|
|
|
2464
2464
|
}
|
|
2465
2465
|
const expressions = [];
|
|
2466
2466
|
let predefinedCriteria;
|
|
2467
|
-
if (filter) {
|
|
2468
|
-
this.defaultFilter = filter;
|
|
2469
|
-
predefinedCriteria = this.getFilters(this.tableConfig, defaultFilterValues, filter);
|
|
2467
|
+
if (filter$$1) {
|
|
2468
|
+
this.defaultFilter = filter$$1;
|
|
2469
|
+
predefinedCriteria = this.getFilters(this.tableConfig, defaultFilterValues, filter$$1);
|
|
2470
2470
|
}
|
|
2471
2471
|
else {
|
|
2472
2472
|
// Empty a falsy filter resets the results
|
|
@@ -4408,9 +4408,9 @@ var TableActionTypes;
|
|
|
4408
4408
|
TableActionTypes["AppendState"] = "[Table] Append State";
|
|
4409
4409
|
})(TableActionTypes || (TableActionTypes = {}));
|
|
4410
4410
|
class AppendFilter {
|
|
4411
|
-
constructor(id, filter) {
|
|
4411
|
+
constructor(id, filter$$1) {
|
|
4412
4412
|
this.id = id;
|
|
4413
|
-
this.filter = filter;
|
|
4413
|
+
this.filter = filter$$1;
|
|
4414
4414
|
this.type = TableActionTypes.AppendFilter;
|
|
4415
4415
|
}
|
|
4416
4416
|
}
|
|
@@ -4523,19 +4523,23 @@ class AdvancedSearchState {
|
|
|
4523
4523
|
// set auto load to false
|
|
4524
4524
|
this.search.table.autoLoad = false;
|
|
4525
4525
|
// handle filtering
|
|
4526
|
-
this.search.filterChange.subscribe((filter) => {
|
|
4527
|
-
this.onSearchFilter(filter);
|
|
4526
|
+
this.filterChangeSubscription = this.search.filterChange.subscribe((filter$$1) => {
|
|
4527
|
+
this.onSearchFilter(filter$$1);
|
|
4528
4528
|
});
|
|
4529
|
-
//
|
|
4530
|
-
|
|
4531
|
-
tableState.tableState = this.searchState;
|
|
4532
|
-
tableState.ngOnInit();
|
|
4529
|
+
// apply table state
|
|
4530
|
+
this.applyTableState();
|
|
4533
4531
|
// handle table init
|
|
4534
|
-
this.search.table.init.subscribe(() => {
|
|
4532
|
+
this.tableInitSubscription = this.search.table.init.subscribe(() => {
|
|
4535
4533
|
return this.onTableInit();
|
|
4536
4534
|
});
|
|
4537
4535
|
}
|
|
4538
4536
|
}
|
|
4537
|
+
applyTableState() {
|
|
4538
|
+
// handle table state (via directive)
|
|
4539
|
+
const tableState = new AdvancedTableState(this.search.table, this.store);
|
|
4540
|
+
tableState.tableState = this.searchState;
|
|
4541
|
+
tableState.ngOnInit();
|
|
4542
|
+
}
|
|
4539
4543
|
onTableInit() {
|
|
4540
4544
|
this.store.pipe(select(selectTable, { id: this.searchState }), first()).subscribe((state) => {
|
|
4541
4545
|
// use order
|
|
@@ -4557,14 +4561,30 @@ class AdvancedSearchState {
|
|
|
4557
4561
|
return this.search.search();
|
|
4558
4562
|
}
|
|
4559
4563
|
if (state.filter) {
|
|
4560
|
-
|
|
4564
|
+
if (Object.keys(state.filter).length) {
|
|
4565
|
+
// set collapsed to false (advanced search)
|
|
4566
|
+
this.search.collapsed = false;
|
|
4567
|
+
this.search.filter = state.filter;
|
|
4568
|
+
return this.search.search();
|
|
4569
|
+
}
|
|
4561
4570
|
}
|
|
4571
|
+
// ensure empty filter at this moment
|
|
4572
|
+
// because search() function triggers a store dispatch
|
|
4573
|
+
this.search.filter = {};
|
|
4562
4574
|
return this.search.search();
|
|
4563
4575
|
}
|
|
4564
4576
|
});
|
|
4565
4577
|
}
|
|
4566
|
-
onSearchFilter(filter) {
|
|
4567
|
-
this.store.dispatch(new AppendFilter(this.searchState, filter));
|
|
4578
|
+
onSearchFilter(filter$$1) {
|
|
4579
|
+
this.store.dispatch(new AppendFilter(this.searchState, filter$$1));
|
|
4580
|
+
}
|
|
4581
|
+
ngOnDestroy() {
|
|
4582
|
+
if (this.filterChangeSubscription) {
|
|
4583
|
+
this.filterChangeSubscription.unsubscribe();
|
|
4584
|
+
}
|
|
4585
|
+
if (this.tableInitSubscription) {
|
|
4586
|
+
this.tableInitSubscription.unsubscribe();
|
|
4587
|
+
}
|
|
4568
4588
|
}
|
|
4569
4589
|
}
|
|
4570
4590
|
AdvancedSearchState.decorators = [
|
|
@@ -4582,6 +4602,62 @@ AdvancedSearchState.propDecorators = {
|
|
|
4582
4602
|
searchState: [{ type: Input }]
|
|
4583
4603
|
};
|
|
4584
4604
|
|
|
4605
|
+
class AdvancedSearchRouterState extends AdvancedSearchState {
|
|
4606
|
+
constructor(search, store, _router) {
|
|
4607
|
+
// call super constructor
|
|
4608
|
+
super(search, store);
|
|
4609
|
+
this.search = search;
|
|
4610
|
+
this.store = store;
|
|
4611
|
+
this._router = _router;
|
|
4612
|
+
this._enteringState = true;
|
|
4613
|
+
this._applyState = false;
|
|
4614
|
+
// set search state dynamically according to route
|
|
4615
|
+
this._routerSubscription = this._router.events
|
|
4616
|
+
.pipe(filter((event) => event instanceof NavigationStart || event instanceof NavigationEnd))
|
|
4617
|
+
.subscribe((event) => {
|
|
4618
|
+
// capture urls regarding tab changing while the component is active
|
|
4619
|
+
if (event instanceof NavigationStart && !this._enteringState) {
|
|
4620
|
+
// set search state
|
|
4621
|
+
this.searchState = event.url;
|
|
4622
|
+
// toogle applyState
|
|
4623
|
+
this._applyState = true;
|
|
4624
|
+
}
|
|
4625
|
+
// capture url of the first activation of the component (e.g. coming from another route)
|
|
4626
|
+
if (event instanceof NavigationEnd && this._enteringState) {
|
|
4627
|
+
// set search state
|
|
4628
|
+
this.searchState = event.urlAfterRedirects;
|
|
4629
|
+
// toggle enteringState
|
|
4630
|
+
this._enteringState = false;
|
|
4631
|
+
}
|
|
4632
|
+
if (this._applyState) {
|
|
4633
|
+
// apply new table state
|
|
4634
|
+
super.applyTableState();
|
|
4635
|
+
this._applyState = false;
|
|
4636
|
+
}
|
|
4637
|
+
});
|
|
4638
|
+
}
|
|
4639
|
+
ngOnDestroy() {
|
|
4640
|
+
// destroy own subscriptions
|
|
4641
|
+
if (this._routerSubscription) {
|
|
4642
|
+
this._routerSubscription.unsubscribe();
|
|
4643
|
+
}
|
|
4644
|
+
// destroy parent subscriptions
|
|
4645
|
+
return super.ngOnDestroy();
|
|
4646
|
+
}
|
|
4647
|
+
}
|
|
4648
|
+
AdvancedSearchRouterState.decorators = [
|
|
4649
|
+
{ type: Directive, args: [{
|
|
4650
|
+
// tslint:disable-next-line: directive-selector
|
|
4651
|
+
selector: "[routerSearchState]",
|
|
4652
|
+
},] }
|
|
4653
|
+
];
|
|
4654
|
+
/** @nocollapse */
|
|
4655
|
+
AdvancedSearchRouterState.ctorParameters = () => [
|
|
4656
|
+
{ type: AdvancedTableSearchComponent },
|
|
4657
|
+
{ type: Store, decorators: [{ type: Optional }] },
|
|
4658
|
+
{ type: Router }
|
|
4659
|
+
];
|
|
4660
|
+
|
|
4585
4661
|
const ɵ0 = FORMATTERS;
|
|
4586
4662
|
class TablesModule {
|
|
4587
4663
|
constructor(_translateService) {
|
|
@@ -4645,7 +4721,8 @@ TablesModule.decorators = [
|
|
|
4645
4721
|
ParseTitlePipe,
|
|
4646
4722
|
AddItemsComponent,
|
|
4647
4723
|
AdvancedSearchState,
|
|
4648
|
-
AdvancedTableState
|
|
4724
|
+
AdvancedTableState,
|
|
4725
|
+
AdvancedSearchRouterState
|
|
4649
4726
|
],
|
|
4650
4727
|
exports: [
|
|
4651
4728
|
AdvancedTableComponent,
|
|
@@ -4663,7 +4740,8 @@ TablesModule.decorators = [
|
|
|
4663
4740
|
AdvancedAggregatorListComponent,
|
|
4664
4741
|
AddItemsComponent,
|
|
4665
4742
|
AdvancedSearchState,
|
|
4666
|
-
AdvancedTableState
|
|
4743
|
+
AdvancedTableState,
|
|
4744
|
+
AdvancedSearchRouterState
|
|
4667
4745
|
],
|
|
4668
4746
|
entryComponents: [
|
|
4669
4747
|
AdvancedTableModalBaseComponent,
|
|
@@ -4688,6 +4766,6 @@ TablesModule.ctorParameters = () => [
|
|
|
4688
4766
|
* Generated bundle index. Do not edit.
|
|
4689
4767
|
*/
|
|
4690
4768
|
|
|
4691
|
-
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 };
|
|
4769
|
+
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 };
|
|
4692
4770
|
|
|
4693
4771
|
//# sourceMappingURL=universis-ngx-tables.js.map
|