@apia/api 4.0.6 → 4.0.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.
package/dist/index.d.ts CHANGED
@@ -436,6 +436,7 @@ declare abstract class QueryController {
436
436
  private initEvents;
437
437
  protected getLoadStructureParameters(): Record<string, unknown>;
438
438
  protected getClearFiltersParameters(): Record<string, unknown>;
439
+ protected getFiltersValuesMap(): Record<string, unknown>;
439
440
  protected getPageParameters(): Record<string, unknown>;
440
441
  protected getRefreshParameters(): Record<string, unknown>;
441
442
  protected getSortParameters(): Record<string, unknown>;
@@ -449,6 +450,9 @@ declare abstract class QueryController {
449
450
  initialLoad(): Promise<void>;
450
451
  page(num: number): Promise<void>;
451
452
  protected areRequiredFilters(): boolean;
453
+ /**
454
+ * Allows to throttle calls to actual refresh method.
455
+ */
452
456
  protected executeRefresh: lodash.DebouncedFunc<() => Promise<void>>;
453
457
  refresh(): Promise<void | undefined>;
454
458
  sort(column: string): Promise<void>;
package/dist/index.js CHANGED
@@ -3722,11 +3722,19 @@ class QueryController {
3722
3722
  __publicField(this, "initializing", false);
3723
3723
  __publicField(this, "structure", null);
3724
3724
  __publicField(this, "tableController", new TableController());
3725
+ /**
3726
+ * Allows to throttle calls to actual refresh method.
3727
+ */
3725
3728
  __publicField(this, "executeRefresh", throttle(
3726
3729
  async () => {
3727
3730
  if (!this.areRequiredFilters()) {
3728
3731
  const refresh = await ApiaApi$1.post(
3729
- makeApiaUrl(this.getRefreshParameters())
3732
+ makeApiaUrl(this.getRefreshParameters()),
3733
+ {
3734
+ postData: this.getFiltersValuesMap(),
3735
+ postDataTreatement: "stringify",
3736
+ stringifyOptions: { arrayFormat: "repeat" }
3737
+ }
3730
3738
  );
3731
3739
  this.parseRefreshResponse(refresh?.data);
3732
3740
  }
@@ -3773,6 +3781,9 @@ class QueryController {
3773
3781
  action: "clearFilter"
3774
3782
  };
3775
3783
  }
3784
+ getFiltersValuesMap() {
3785
+ return [...this.tableController.state.filters.values()].reduce((r, c) => ({ ...r, [c.filterState.id]: c.filterState.value }), {});
3786
+ }
3776
3787
  getPageParameters() {
3777
3788
  return {
3778
3789
  ajaxUrl: this.ajaxUrl,