@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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('iso-639-1/build'), require('rxjs'), require('jquery'), require('datatables.net'), require('lodash'), require('datatables.net-scroller'), require('rxjs/add/observable/combineLatest'), require('@angular/common/http'), require('@themost/client'), require('@themost/angular'), require('@angular/common'), require('@ngx-translate/core'), require('@angular/forms'), require('@universis/common'), require('@universis/common/routing'), require('@universis/forms'), require('angular-formio'), require('@angular/router'), require('ngx-bootstrap/modal'), require('ngx-bootstrap/progressbar'), require('ngx-pipes'), require('@angular/core'), require('@ngrx/store'), require('rxjs/operators')) :
3
- typeof define === 'function' && define.amd ? define('@universis/ngx-tables', ['exports', 'iso-639-1/build', 'rxjs', 'jquery', 'datatables.net', 'lodash', 'datatables.net-scroller', 'rxjs/add/observable/combineLatest', '@angular/common/http', '@themost/client', '@themost/angular', '@angular/common', '@ngx-translate/core', '@angular/forms', '@universis/common', '@universis/common/routing', '@universis/forms', 'angular-formio', '@angular/router', 'ngx-bootstrap/modal', 'ngx-bootstrap/progressbar', 'ngx-pipes', '@angular/core', '@ngrx/store', 'rxjs/operators'], factory) :
4
- (factory((global.universis = global.universis || {}, global.universis['ngx-tables'] = {}),global.ISO6391,global.rxjs,global.jQuery_,null,global.lodash,null,global.rxjs['add/observable/combineLatest'],global.ng.common.http,global.client,global.i1,global.ng.common,global.core,global.ng.forms,global.i2,global.routing,global.forms$1,global.angularFormio,global.ng.router,global.modal,global.progressbar,global.ngxPipes,global.ng.core,global.store,global.rxjs.operators));
5
- }(this, (function (exports,ISO6391,rxjs,jQuery_,datatables_net,lodash,datatables_netScroller,combineLatest,http,client,i1,common,core,forms,i2,routing,forms$1,angularFormio,i1$1,modal,progressbar,ngxPipes,i0,store,operators) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('iso-639-1/build'), require('rxjs'), require('jquery'), require('datatables.net'), require('lodash'), require('datatables.net-scroller'), require('rxjs/add/observable/combineLatest'), require('@angular/common/http'), require('@themost/client'), require('@themost/angular'), require('@angular/common'), require('@ngx-translate/core'), require('@angular/forms'), require('@universis/common'), require('@universis/common/routing'), require('@universis/forms'), require('angular-formio'), require('ngx-bootstrap/modal'), require('ngx-bootstrap/progressbar'), require('ngx-pipes'), require('@angular/core'), require('@angular/router'), require('@ngrx/store'), require('rxjs/operators')) :
3
+ typeof define === 'function' && define.amd ? define('@universis/ngx-tables', ['exports', 'iso-639-1/build', 'rxjs', 'jquery', 'datatables.net', 'lodash', 'datatables.net-scroller', 'rxjs/add/observable/combineLatest', '@angular/common/http', '@themost/client', '@themost/angular', '@angular/common', '@ngx-translate/core', '@angular/forms', '@universis/common', '@universis/common/routing', '@universis/forms', 'angular-formio', 'ngx-bootstrap/modal', 'ngx-bootstrap/progressbar', 'ngx-pipes', '@angular/core', '@angular/router', '@ngrx/store', 'rxjs/operators'], factory) :
4
+ (factory((global.universis = global.universis || {}, global.universis['ngx-tables'] = {}),global.ISO6391,global.rxjs,global.jQuery_,null,global.lodash,null,global.rxjs['add/observable/combineLatest'],global.ng.common.http,global.client,global.i1,global.ng.common,global.core,global.ng.forms,global.i2,global.routing,global.forms$1,global.angularFormio,global.modal,global.progressbar,global.ngxPipes,global.ng.core,global.ng.router,global.store,global.rxjs.operators));
5
+ }(this, (function (exports,ISO6391,rxjs,jQuery_,datatables_net,lodash,datatables_netScroller,combineLatest,http,client,i1,common,core,forms,i2,routing,forms$1,angularFormio,modal,progressbar,ngxPipes,i0,i1$1,store,operators) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -5009,19 +5009,23 @@
5009
5009
  // set auto load to false
5010
5010
  this.search.table.autoLoad = false;
5011
5011
  // handle filtering
5012
- this.search.filterChange.subscribe(function (filter) {
5012
+ this.filterChangeSubscription = this.search.filterChange.subscribe(function (filter) {
5013
5013
  _this.onSearchFilter(filter);
5014
5014
  });
5015
- // handle table state (via directive)
5016
- var tableState = new AdvancedTableState(this.search.table, this.store);
5017
- tableState.tableState = this.searchState;
5018
- tableState.ngOnInit();
5015
+ // apply table state
5016
+ this.applyTableState();
5019
5017
  // handle table init
5020
- this.search.table.init.subscribe(function () {
5018
+ this.tableInitSubscription = this.search.table.init.subscribe(function () {
5021
5019
  return _this.onTableInit();
5022
5020
  });
5023
5021
  }
5024
5022
  };
5023
+ AdvancedSearchState.prototype.applyTableState = function () {
5024
+ // handle table state (via directive)
5025
+ var tableState = new AdvancedTableState(this.search.table, this.store);
5026
+ tableState.tableState = this.searchState;
5027
+ tableState.ngOnInit();
5028
+ };
5025
5029
  AdvancedSearchState.prototype.onTableInit = function () {
5026
5030
  var _this = this;
5027
5031
  this.store.pipe(store.select(selectTable, { id: this.searchState }), operators.first()).subscribe(function (state) {
@@ -5044,8 +5048,16 @@
5044
5048
  return _this.search.search();
5045
5049
  }
5046
5050
  if (state.filter) {
5047
- _this.search.filter = state.filter;
5051
+ if (Object.keys(state.filter).length) {
5052
+ // set collapsed to false (advanced search)
5053
+ _this.search.collapsed = false;
5054
+ _this.search.filter = state.filter;
5055
+ return _this.search.search();
5056
+ }
5048
5057
  }
5058
+ // ensure empty filter at this moment
5059
+ // because search() function triggers a store dispatch
5060
+ _this.search.filter = {};
5049
5061
  return _this.search.search();
5050
5062
  }
5051
5063
  });
@@ -5053,6 +5065,14 @@
5053
5065
  AdvancedSearchState.prototype.onSearchFilter = function (filter) {
5054
5066
  this.store.dispatch(new AppendFilter(this.searchState, filter));
5055
5067
  };
5068
+ AdvancedSearchState.prototype.ngOnDestroy = function () {
5069
+ if (this.filterChangeSubscription) {
5070
+ this.filterChangeSubscription.unsubscribe();
5071
+ }
5072
+ if (this.tableInitSubscription) {
5073
+ this.tableInitSubscription.unsubscribe();
5074
+ }
5075
+ };
5056
5076
  AdvancedSearchState.decorators = [
5057
5077
  { type: i0.Directive, args: [{
5058
5078
  // tslint:disable-next-line: directive-selector
@@ -5072,6 +5092,70 @@
5072
5092
  return AdvancedSearchState;
5073
5093
  }());
5074
5094
 
5095
+ var AdvancedSearchRouterState = /** @class */ (function (_super) {
5096
+ __extends(AdvancedSearchRouterState, _super);
5097
+ function AdvancedSearchRouterState(search, store$$1, _router) {
5098
+ var _this =
5099
+ // call super constructor
5100
+ _super.call(this, search, store$$1) || this;
5101
+ _this.search = search;
5102
+ _this.store = store$$1;
5103
+ _this._router = _router;
5104
+ _this._enteringState = true;
5105
+ _this._applyState = false;
5106
+ // set search state dynamically according to route
5107
+ _this._routerSubscription = _this._router.events
5108
+ .pipe(operators.filter(function (event) {
5109
+ return event instanceof i1$1.NavigationStart || event instanceof i1$1.NavigationEnd;
5110
+ }))
5111
+ .subscribe(function (event) {
5112
+ // capture urls regarding tab changing while the component is active
5113
+ if (event instanceof i1$1.NavigationStart && !_this._enteringState) {
5114
+ // set search state
5115
+ _this.searchState = event.url;
5116
+ // toogle applyState
5117
+ _this._applyState = true;
5118
+ }
5119
+ // capture url of the first activation of the component (e.g. coming from another route)
5120
+ if (event instanceof i1$1.NavigationEnd && _this._enteringState) {
5121
+ // set search state
5122
+ _this.searchState = event.urlAfterRedirects;
5123
+ // toggle enteringState
5124
+ _this._enteringState = false;
5125
+ }
5126
+ if (_this._applyState) {
5127
+ // apply new table state
5128
+ _super.prototype.applyTableState.call(_this);
5129
+ _this._applyState = false;
5130
+ }
5131
+ });
5132
+ return _this;
5133
+ }
5134
+ AdvancedSearchRouterState.prototype.ngOnDestroy = function () {
5135
+ // destroy own subscriptions
5136
+ if (this._routerSubscription) {
5137
+ this._routerSubscription.unsubscribe();
5138
+ }
5139
+ // destroy parent subscriptions
5140
+ return _super.prototype.ngOnDestroy.call(this);
5141
+ };
5142
+ AdvancedSearchRouterState.decorators = [
5143
+ { type: i0.Directive, args: [{
5144
+ // tslint:disable-next-line: directive-selector
5145
+ selector: "[routerSearchState]",
5146
+ },] }
5147
+ ];
5148
+ /** @nocollapse */
5149
+ AdvancedSearchRouterState.ctorParameters = function () {
5150
+ return [
5151
+ { type: AdvancedTableSearchComponent },
5152
+ { type: store.Store, decorators: [{ type: i0.Optional }] },
5153
+ { type: i1$1.Router }
5154
+ ];
5155
+ };
5156
+ return AdvancedSearchRouterState;
5157
+ }(AdvancedSearchState));
5158
+
5075
5159
  var ɵ0 = FORMATTERS;
5076
5160
  var TablesModule = /** @class */ (function () {
5077
5161
  function TablesModule(_translateService) {
@@ -5137,7 +5221,8 @@
5137
5221
  ParseTitlePipe,
5138
5222
  AddItemsComponent,
5139
5223
  AdvancedSearchState,
5140
- AdvancedTableState
5224
+ AdvancedTableState,
5225
+ AdvancedSearchRouterState
5141
5226
  ],
5142
5227
  exports: [
5143
5228
  AdvancedTableComponent,
@@ -5155,7 +5240,8 @@
5155
5240
  AdvancedAggregatorListComponent,
5156
5241
  AddItemsComponent,
5157
5242
  AdvancedSearchState,
5158
- AdvancedTableState
5243
+ AdvancedTableState,
5244
+ AdvancedSearchRouterState
5159
5245
  ],
5160
5246
  entryComponents: [
5161
5247
  AdvancedTableModalBaseComponent,
@@ -5186,6 +5272,7 @@
5186
5272
 
5187
5273
  exports.ɵa = AdvancedSearchState;
5188
5274
  exports.ɵc = AdvancedTableState;
5275
+ exports.ɵd = AdvancedSearchRouterState;
5189
5276
  exports.AdvancedListComponent = AdvancedListComponent;
5190
5277
  exports.AdvancedRowActionComponent = AdvancedRowActionComponent;
5191
5278
  exports.AdvancedSearchFormComponent = AdvancedSearchFormComponent;