@universis/ngx-tables 6.13.6 → 6.13.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.
@@ -22,7 +22,7 @@ import { BsModalRef, BsModalService, ModalModule } from 'ngx-bootstrap/modal';
22
22
  import { ProgressbarModule } from 'ngx-bootstrap/progressbar';
23
23
  import { GroupByPipe, NgPipesModule } from 'ngx-pipes';
24
24
  import { template, at, cloneDeep, isEmpty } from 'lodash';
25
- import { __extends, __awaiter, __generator, __values, __spread, __assign } from 'tslib';
25
+ import { __extends, __awaiter, __generator, __values, __assign, __spread } from 'tslib';
26
26
  import { Injectable, Directive, Optional, Input, Component, ElementRef, ViewChild, ViewEncapsulation, EventEmitter, Output, Pipe, NgModule, CUSTOM_ELEMENTS_SCHEMA, defineInjectable, inject, HostListener, ChangeDetectorRef, InjectionToken, Inject, Injector, ViewContainerRef, ChangeDetectionStrategy } from '@angular/core';
27
27
  import { ActivatedRoute, Router, NavigationStart, NavigationEnd, RouterModule } from '@angular/router';
28
28
  import { createFeatureSelector, createSelector, select, Store } from '@ngrx/store';
@@ -5941,7 +5941,7 @@ var AdvancedTableSearchComponent = /** @class */ (function (_super) {
5941
5941
  */
5942
5942
  function (event) {
5943
5943
  return __awaiter(this, void 0, void 0, function () {
5944
- var query, queryParams_3;
5944
+ var query, queryParams_3, queryParams;
5945
5945
  return __generator(this, function (_a) {
5946
5946
  switch (_a.label) {
5947
5947
  case 0:
@@ -5971,7 +5971,9 @@ var AdvancedTableSearchComponent = /** @class */ (function (_super) {
5971
5971
  })];
5972
5972
  }
5973
5973
  if (this.table.query && query && query.getParams()['$filter']) {
5974
- this.table.query.setParam('$filter', query.getParams()['$filter']);
5974
+ queryParams = Object.assign({}, this.table.query.getParams(), query.getParams());
5975
+ query.setQueryParams(queryParams);
5976
+ this.table.query = query;
5975
5977
  }
5976
5978
  else {
5977
5979
  this.table.query = query;
@@ -6003,7 +6005,7 @@ var AdvancedTableSearchComponent = /** @class */ (function (_super) {
6003
6005
  */
6004
6006
  function () {
6005
6007
  return __awaiter(this, void 0, void 0, function () {
6006
- var expressions_1, values_1, query;
6008
+ var expressions_1, values_1, queryParams_4, query_1, param, modelName;
6007
6009
  var _this = this;
6008
6010
  return __generator(this, function (_a) {
6009
6011
  switch (_a.label) {
@@ -6017,6 +6019,7 @@ var AdvancedTableSearchComponent = /** @class */ (function (_super) {
6017
6019
  return [4 /*yield*/, this._advancedSearchValueProvider.getValues()];
6018
6020
  case 1:
6019
6021
  values_1 = _a.sent();
6022
+ queryParams_4 = [];
6020
6023
  this.table.config.criteria.forEach(function (x) {
6021
6024
  if (Object.prototype.hasOwnProperty.call(_this.filter, x.name)) {
6022
6025
  /** @type {?} */
@@ -6029,22 +6032,39 @@ var AdvancedTableSearchComponent = /** @class */ (function (_super) {
6029
6032
  }));
6030
6033
  }
6031
6034
  else if (_this.filter[x.name] !== 'undefined') {
6032
- expressions_1.push(_this._template.transform(x.filter, Object.assign({
6033
- value: _this.filter[x.name],
6034
- }, values_1)));
6035
+ if (x.type !== 'queryParam') {
6036
+ expressions_1.push(_this._template.transform(x.filter, Object.assign({
6037
+ value: _this.filter[x.name],
6038
+ }, values_1)));
6039
+ }
6040
+ else {
6041
+ /** @type {?} */
6042
+ var value = _this.filter[x.name];
6043
+ if (value) {
6044
+ queryParams_4.push(Object.assign(x, { value: value }));
6045
+ }
6046
+ }
6035
6047
  }
6036
6048
  }
6037
6049
  });
6038
- query = void 0;
6050
+ query_1 = void 0;
6051
+ query_1 = this._context.model(this.table.config.model).asQueryable();
6052
+ if (queryParams_4 && queryParams_4.length) {
6053
+ param = queryParams_4.find(function (x) {
6054
+ return x.model !== null;
6055
+ });
6056
+ modelName = param ? param.model : this.table.config.model;
6057
+ query_1 = this._context.model(modelName).asQueryable();
6058
+ queryParams_4.forEach(function (queryParam) {
6059
+ query_1.setParam(queryParam.queryParam, queryParam.value);
6060
+ });
6061
+ }
6039
6062
  if (expressions_1 && expressions_1.length) {
6040
6063
  // create client query
6041
- query = this._context.model(this.table.config.model).asQueryable();
6042
- query.setParam('filter', expressions_1.join(' and '));
6043
- }
6044
- else {
6045
- query = this._context.model(this.table.config.model).asQueryable();
6064
+ // create client query
6065
+ query_1.setParam('filter', expressions_1.join(' and '));
6046
6066
  }
6047
- return [2 /*return*/, query];
6067
+ return [2 /*return*/, query_1];
6048
6068
  case 2: return [2 /*return*/];
6049
6069
  }
6050
6070
  });
@@ -6071,12 +6091,12 @@ var AdvancedTableSearchComponent = /** @class */ (function (_super) {
6071
6091
  if (this.mergeQueryParams && this.table) {
6072
6092
  this.selectedList = null;
6073
6093
  /** @type {?} */
6074
- var queryParams_4 = { q: null, s: null };
6094
+ var queryParams_5 = { q: null, s: null };
6075
6095
  // enumerate criteria
6076
6096
  this.table.config.criteria.forEach(function (item) {
6077
- if (Object.prototype.hasOwnProperty.call(queryParams_4, item.name) === false) {
6097
+ if (Object.prototype.hasOwnProperty.call(queryParams_5, item.name) === false) {
6078
6098
  // set null value
6079
- Object.defineProperty(queryParams_4, item.name, {
6099
+ Object.defineProperty(queryParams_5, item.name, {
6080
6100
  configurable: true,
6081
6101
  enumerable: true,
6082
6102
  writable: true,
@@ -6086,7 +6106,7 @@ var AdvancedTableSearchComponent = /** @class */ (function (_super) {
6086
6106
  });
6087
6107
  return this._router.navigate([], {
6088
6108
  relativeTo: this._activatedRoute,
6089
- queryParams: queryParams_4,
6109
+ queryParams: queryParams_5,
6090
6110
  queryParamsHandling: 'merge',
6091
6111
  });
6092
6112
  }