@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.
@@ -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.
@@ -1293,6 +1293,13 @@
1293
1293
  });
1294
1294
  // get table element
1295
1295
  var tableElement_1 = jQuery(this.table.nativeElement);
1296
+ jQuery(window).on('resize', function () {
1297
+ setTimeout(function () {
1298
+ if (_this.dataTable) {
1299
+ _this.dataTable.columns.adjust();
1300
+ }
1301
+ }, 1);
1302
+ });
1296
1303
  // tslint:disable-next-line: no-shadowed-variable
1297
1304
  tableElement_1.on('processing.dt', function (event, settings, processing) {
1298
1305
  if (processing) {
@@ -1833,6 +1840,7 @@
1833
1840
  this._http.get(changes.configSrc.currentValue).toPromise().then(function (config) {
1834
1841
  // set configuration
1835
1842
  _this.config = config;
1843
+ _this.destroy();
1836
1844
  // fetch and redraw
1837
1845
  _this.fetch();
1838
1846
  }).catch(function (err) {
@@ -1843,6 +1851,12 @@
1843
1851
  }
1844
1852
  }
1845
1853
  };
1854
+ AdvancedTableComponent.prototype.reset = function (load) {
1855
+ this.query = null;
1856
+ this.destroy();
1857
+ this.autoLoad = !!load;
1858
+ this.ngOnInit();
1859
+ };
1846
1860
  AdvancedTableComponent.decorators = [
1847
1861
  { type: i0.Component, args: [{
1848
1862
  // tslint:disable-next-line: component-selector
@@ -5002,19 +5016,23 @@
5002
5016
  // set auto load to false
5003
5017
  this.search.table.autoLoad = false;
5004
5018
  // handle filtering
5005
- this.search.filterChange.subscribe(function (filter) {
5019
+ this.filterChangeSubscription = this.search.filterChange.subscribe(function (filter) {
5006
5020
  _this.onSearchFilter(filter);
5007
5021
  });
5008
- // handle table state (via directive)
5009
- var tableState = new AdvancedTableState(this.search.table, this.store);
5010
- tableState.tableState = this.searchState;
5011
- tableState.ngOnInit();
5022
+ // apply table state
5023
+ this.applyTableState();
5012
5024
  // handle table init
5013
- this.search.table.init.subscribe(function () {
5025
+ this.tableInitSubscription = this.search.table.init.subscribe(function () {
5014
5026
  return _this.onTableInit();
5015
5027
  });
5016
5028
  }
5017
5029
  };
5030
+ AdvancedSearchState.prototype.applyTableState = function () {
5031
+ // handle table state (via directive)
5032
+ var tableState = new AdvancedTableState(this.search.table, this.store);
5033
+ tableState.tableState = this.searchState;
5034
+ tableState.ngOnInit();
5035
+ };
5018
5036
  AdvancedSearchState.prototype.onTableInit = function () {
5019
5037
  var _this = this;
5020
5038
  this.store.pipe(store.select(selectTable, { id: this.searchState }), operators.first()).subscribe(function (state) {
@@ -5037,8 +5055,16 @@
5037
5055
  return _this.search.search();
5038
5056
  }
5039
5057
  if (state.filter) {
5040
- _this.search.filter = state.filter;
5058
+ if (Object.keys(state.filter).length) {
5059
+ // set collapsed to false (advanced search)
5060
+ _this.search.collapsed = false;
5061
+ _this.search.filter = state.filter;
5062
+ return _this.search.search();
5063
+ }
5041
5064
  }
5065
+ // ensure empty filter at this moment
5066
+ // because search() function triggers a store dispatch
5067
+ _this.search.filter = {};
5042
5068
  return _this.search.search();
5043
5069
  }
5044
5070
  });
@@ -5046,6 +5072,14 @@
5046
5072
  AdvancedSearchState.prototype.onSearchFilter = function (filter) {
5047
5073
  this.store.dispatch(new AppendFilter(this.searchState, filter));
5048
5074
  };
5075
+ AdvancedSearchState.prototype.ngOnDestroy = function () {
5076
+ if (this.filterChangeSubscription) {
5077
+ this.filterChangeSubscription.unsubscribe();
5078
+ }
5079
+ if (this.tableInitSubscription) {
5080
+ this.tableInitSubscription.unsubscribe();
5081
+ }
5082
+ };
5049
5083
  AdvancedSearchState.decorators = [
5050
5084
  { type: i0.Directive, args: [{
5051
5085
  // tslint:disable-next-line: directive-selector
@@ -5065,6 +5099,70 @@
5065
5099
  return AdvancedSearchState;
5066
5100
  }());
5067
5101
 
5102
+ var AdvancedSearchRouterState = /** @class */ (function (_super) {
5103
+ __extends(AdvancedSearchRouterState, _super);
5104
+ function AdvancedSearchRouterState(search, store$$1, _router) {
5105
+ var _this =
5106
+ // call super constructor
5107
+ _super.call(this, search, store$$1) || this;
5108
+ _this.search = search;
5109
+ _this.store = store$$1;
5110
+ _this._router = _router;
5111
+ _this._enteringState = true;
5112
+ _this._applyState = false;
5113
+ // set search state dynamically according to route
5114
+ _this._routerSubscription = _this._router.events
5115
+ .pipe(operators.filter(function (event) {
5116
+ return event instanceof i1$1.NavigationStart || event instanceof i1$1.NavigationEnd;
5117
+ }))
5118
+ .subscribe(function (event) {
5119
+ // capture urls regarding tab changing while the component is active
5120
+ if (event instanceof i1$1.NavigationStart && !_this._enteringState) {
5121
+ // set search state
5122
+ _this.searchState = event.url;
5123
+ // toogle applyState
5124
+ _this._applyState = true;
5125
+ }
5126
+ // capture url of the first activation of the component (e.g. coming from another route)
5127
+ if (event instanceof i1$1.NavigationEnd && _this._enteringState) {
5128
+ // set search state
5129
+ _this.searchState = event.urlAfterRedirects;
5130
+ // toggle enteringState
5131
+ _this._enteringState = false;
5132
+ }
5133
+ if (_this._applyState) {
5134
+ // apply new table state
5135
+ _super.prototype.applyTableState.call(_this);
5136
+ _this._applyState = false;
5137
+ }
5138
+ });
5139
+ return _this;
5140
+ }
5141
+ AdvancedSearchRouterState.prototype.ngOnDestroy = function () {
5142
+ // destroy own subscriptions
5143
+ if (this._routerSubscription) {
5144
+ this._routerSubscription.unsubscribe();
5145
+ }
5146
+ // destroy parent subscriptions
5147
+ return _super.prototype.ngOnDestroy.call(this);
5148
+ };
5149
+ AdvancedSearchRouterState.decorators = [
5150
+ { type: i0.Directive, args: [{
5151
+ // tslint:disable-next-line: directive-selector
5152
+ selector: "[routerSearchState]",
5153
+ },] }
5154
+ ];
5155
+ /** @nocollapse */
5156
+ AdvancedSearchRouterState.ctorParameters = function () {
5157
+ return [
5158
+ { type: AdvancedTableSearchComponent },
5159
+ { type: store.Store, decorators: [{ type: i0.Optional }] },
5160
+ { type: i1$1.Router }
5161
+ ];
5162
+ };
5163
+ return AdvancedSearchRouterState;
5164
+ }(AdvancedSearchState));
5165
+
5068
5166
  var ɵ0 = FORMATTERS;
5069
5167
  var TablesModule = /** @class */ (function () {
5070
5168
  function TablesModule(_translateService) {
@@ -5130,7 +5228,8 @@
5130
5228
  ParseTitlePipe,
5131
5229
  AddItemsComponent,
5132
5230
  AdvancedSearchState,
5133
- AdvancedTableState
5231
+ AdvancedTableState,
5232
+ AdvancedSearchRouterState
5134
5233
  ],
5135
5234
  exports: [
5136
5235
  AdvancedTableComponent,
@@ -5148,7 +5247,8 @@
5148
5247
  AdvancedAggregatorListComponent,
5149
5248
  AddItemsComponent,
5150
5249
  AdvancedSearchState,
5151
- AdvancedTableState
5250
+ AdvancedTableState,
5251
+ AdvancedSearchRouterState
5152
5252
  ],
5153
5253
  entryComponents: [
5154
5254
  AdvancedTableModalBaseComponent,
@@ -5179,6 +5279,7 @@
5179
5279
 
5180
5280
  exports.ɵa = AdvancedSearchState;
5181
5281
  exports.ɵc = AdvancedTableState;
5282
+ exports.ɵd = AdvancedSearchRouterState;
5182
5283
  exports.AdvancedListComponent = AdvancedListComponent;
5183
5284
  exports.AdvancedRowActionComponent = AdvancedRowActionComponent;
5184
5285
  exports.AdvancedSearchFormComponent = AdvancedSearchFormComponent;