@recursyve/nice-data-filter-kit 13.1.4 → 13.1.5

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.
@@ -125,8 +125,8 @@ class NiceFilterApi {
125
125
  this.path = path;
126
126
  this.http = http;
127
127
  }
128
- filter(queryModel) {
129
- return this.http.post(this.url("filter"), queryModel);
128
+ filter(queryModel, option = {}) {
129
+ return this.http.post(this.url("filter"), queryModel, option);
130
130
  }
131
131
  filterCount(queryModel) {
132
132
  return this.http.post(this.url("filter-count"), queryModel);
@@ -525,8 +525,8 @@ class NiceFilterService {
525
525
  constructor(api) {
526
526
  this.api = api;
527
527
  }
528
- filter(params) {
529
- return this.api?.filter(FilterUtils.parametersToRequest(params));
528
+ filter(params, option = {}) {
529
+ return this.api?.filter(FilterUtils.parametersToRequest(params), option);
530
530
  }
531
531
  getFile(type, parameters) {
532
532
  return this.api?.downloadData(type, FilterUtils.parametersToRequest(parameters));
@@ -651,7 +651,8 @@ const initialBaseListState = {
651
651
  },
652
652
  filterConfig: [],
653
653
  showQueryBuilder: false,
654
- defaultRules: []
654
+ defaultRules: [],
655
+ queryParams: {}
655
656
  };
656
657
  let NiceBaseListStore = class NiceBaseListStore extends Store {
657
658
  constructor(parameters, defaultRules) {
@@ -935,6 +936,9 @@ class NiceBaseListService {
935
936
  mergePageResults: mode === "infinite-scroll"
936
937
  });
937
938
  }
939
+ setQueryParams(queryParams) {
940
+ this.store.update({ queryParams });
941
+ }
938
942
  loadQueryParams(autoLoad) {
939
943
  this.activatedRoute?.queryParams
940
944
  .pipe(takeUntil(this.unsubscribeAll$), map((params) => {
@@ -963,7 +967,7 @@ class NiceBaseListService {
963
967
  return this.loadData(parameters, updateQueryParams, true);
964
968
  }
965
969
  async loadData(parameters, updateQueryParams = true, reset = false) {
966
- const { disabled } = this.store.getValue();
970
+ const { disabled, queryParams } = this.store.getValue();
967
971
  try {
968
972
  const filterParameters = this.mergeParameters(parameters);
969
973
  if (filterParameters) {
@@ -972,7 +976,9 @@ class NiceBaseListService {
972
976
  if (!disabled) {
973
977
  this.store.setLoading(true);
974
978
  this.loadingData = true;
975
- const result = await firstValueFrom(this.filterService.filter(this.getParameters(filterParameters)));
979
+ const result = await firstValueFrom(this.filterService.filter(this.getParameters(filterParameters), {
980
+ params: queryParams
981
+ }));
976
982
  this.store.setResult(result, reset);
977
983
  }
978
984
  }
@@ -1166,16 +1172,6 @@ class NiceBaseListService {
1166
1172
  }
1167
1173
  });
1168
1174
  }
1169
- async updateQueryParams(queryParams) {
1170
- if (!this.activatedRoute) {
1171
- return;
1172
- }
1173
- await this.router.navigate([], {
1174
- relativeTo: this.activatedRoute,
1175
- queryParams,
1176
- queryParamsHandling: "merge"
1177
- });
1178
- }
1179
1175
  getParameters(filterParameters) {
1180
1176
  const { defaultRules } = this.store.getValue();
1181
1177
  const parameters = {
@@ -1190,6 +1186,16 @@ class NiceBaseListService {
1190
1186
  }
1191
1187
  return parameters;
1192
1188
  }
1189
+ async updateQueryParams(queryParams) {
1190
+ if (!this.activatedRoute) {
1191
+ return;
1192
+ }
1193
+ await this.router.navigate([], {
1194
+ relativeTo: this.activatedRoute,
1195
+ queryParams,
1196
+ queryParamsHandling: "merge"
1197
+ });
1198
+ }
1193
1199
  mergeParameters(parameters) {
1194
1200
  const { filterParameters } = this.store.getValue();
1195
1201
  if (!parameters) {
@@ -1770,6 +1776,7 @@ class NiceBaseListComponent {
1770
1776
  this.canExport = true;
1771
1777
  this.disableRouting = false;
1772
1778
  this.customExport = [];
1779
+ this.queryParams = {};
1773
1780
  this.newPage = new EventEmitter();
1774
1781
  this.defaultPageSizeOptions = [10, 25, 50, 100];
1775
1782
  this.columnNames = [];
@@ -1841,6 +1848,9 @@ class NiceBaseListComponent {
1841
1848
  if ("mode" in changes) {
1842
1849
  this.service.setMode(changes.mode.currentValue);
1843
1850
  }
1851
+ if ("queryParams" in changes) {
1852
+ this.service.setQueryParams(changes.queryParams.currentValue);
1853
+ }
1844
1854
  }
1845
1855
  setLoading(loading) {
1846
1856
  this.service.setLoading(loading);
@@ -1957,7 +1967,7 @@ class NiceBaseListComponent {
1957
1967
  }
1958
1968
  }
1959
1969
  NiceBaseListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListComponent, deps: [{ token: ENABLE_QUERY_BUILDER, optional: true }, { token: BASE_LIST_ICONS }, { token: BASE_LIST_LAYOUT }, { token: TABLE_COLUMNS }, { token: EXPORTS_SETTINGS }, { token: NiceBaseListQuery }, { token: NiceBaseListService }, { token: i2.ActivatedRoute }, { token: i4$1.MatBottomSheet }, { token: i2.Router }, { token: i5.NiceMediaWatcherService }], target: i0.ɵɵFactoryTarget.Component });
1960
- NiceBaseListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: NiceBaseListComponent, selector: "nice-base-list", inputs: { mode: "mode", layout: "layout", layoutContent: "layoutContent", autoChangeLayout: "autoChangeLayout", baseRoute: "baseRoute", routeFn: "routeFn", navigateFn: "navigateFn", autoLoad: "autoLoad", pageTitle: "pageTitle", canExport: "canExport", disableRouting: "disableRouting", customExport: "customExport" }, outputs: { newPage: "newPage" }, providers: [
1970
+ NiceBaseListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: NiceBaseListComponent, selector: "nice-base-list", inputs: { mode: "mode", layout: "layout", layoutContent: "layoutContent", autoChangeLayout: "autoChangeLayout", baseRoute: "baseRoute", routeFn: "routeFn", navigateFn: "navigateFn", autoLoad: "autoLoad", pageTitle: "pageTitle", canExport: "canExport", disableRouting: "disableRouting", customExport: "customExport", queryParams: "queryParams" }, outputs: { newPage: "newPage" }, providers: [
1961
1971
  NiceBaseListQuery,
1962
1972
  NiceBaseListService,
1963
1973
  NiceBaseListStore
@@ -2031,6 +2041,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
2031
2041
  type: Input
2032
2042
  }], customExport: [{
2033
2043
  type: Input
2044
+ }], queryParams: [{
2045
+ type: Input
2034
2046
  }], newPage: [{
2035
2047
  type: Output
2036
2048
  }] } });