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