@apia/api 4.0.1 → 4.0.6

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
@@ -388,8 +388,9 @@ declare class FilterTypes {
388
388
  conditions: TFilterTypesElementConditions[];
389
389
  constructor();
390
390
  protected getFilterTypes(): Promise<void>;
391
- protected initialLoad(): Promise<void>;
392
391
  Component: () => React$1.JSX.Element;
392
+ initialLoad(): Promise<void>;
393
+ setFilterOptions(): Promise<void>;
393
394
  }
394
395
 
395
396
  declare class TableController {
package/dist/index.js CHANGED
@@ -3235,11 +3235,12 @@ const AdditionalFiltersComponent = ({
3235
3235
  const hasSortable = !![...tableController.state.columns.values()].find(
3236
3236
  (c) => c.allowSorting
3237
3237
  );
3238
- return /* @__PURE__ */ jsx(TableContextReproducer, { tableName: tableController.getTableName(), children: /* @__PURE__ */ jsxs(Accordion, { className: "additionalFiltersContent", children: [
3238
+ return /* @__PURE__ */ jsx(TableContextReproducer, { tableName: tableController.getTableName(), children: /* @__PURE__ */ jsxs(Accordion, { className: "additionalFiltersContent", singleExpand: true, children: [
3239
3239
  hasFilters && /* @__PURE__ */ jsx(
3240
3240
  AccordionItem,
3241
3241
  {
3242
3242
  id: "Responsive",
3243
+ defaultExpanded: true,
3243
3244
  buttonProps: { ariaLabel: filterTitle, label: filterTitle },
3244
3245
  children: /* @__PURE__ */ jsx(Responsive, {})
3245
3246
  }
@@ -3327,6 +3328,7 @@ class AdditionalFiltersModal {
3327
3328
  };
3328
3329
  }
3329
3330
  async openModal(properties) {
3331
+ this.queryController.tableController.filterTypes.initialLoad();
3330
3332
  this.modalHandler = ApiaUtil.instance.modals.open({
3331
3333
  ...this.getModalDefinition(),
3332
3334
  ...properties
@@ -3456,6 +3458,7 @@ const FilterTypesComponent = observer(
3456
3458
  onChange: (ev) => {
3457
3459
  const selectedValue = ev.target.value;
3458
3460
  filterTypes.conditions[idx].value = selectedValue;
3461
+ filterTypes.setFilterOptions();
3459
3462
  },
3460
3463
  disabled: f.readonly || f.disabled,
3461
3464
  value: f.value,
@@ -3482,7 +3485,6 @@ class FilterTypes {
3482
3485
  makeObservable(this, {
3483
3486
  conditions: observable
3484
3487
  });
3485
- this.initialLoad();
3486
3488
  }
3487
3489
  async getFilterTypes() {
3488
3490
  const result = await ApiaApi$1.post(
@@ -3498,6 +3500,23 @@ class FilterTypes {
3498
3500
  async initialLoad() {
3499
3501
  await this.getFilterTypes();
3500
3502
  }
3503
+ async setFilterOptions() {
3504
+ const result = await ApiaApi$1.post(
3505
+ makeApiaUrl({
3506
+ ajaxUrl: "apia.query.ModalAction.run?",
3507
+ action: "setFilterOptions"
3508
+ }),
3509
+ {
3510
+ postData: this.conditions.reduce((acc, c) => {
3511
+ acc[c.id] = c.value;
3512
+ return acc;
3513
+ }, {}),
3514
+ postDataTreatement: "stringify"
3515
+ }
3516
+ );
3517
+ if (!result)
3518
+ return;
3519
+ }
3501
3520
  }
3502
3521
 
3503
3522
  var __defProp$2 = Object.defineProperty;
@@ -3918,9 +3937,13 @@ class QueryController {
3918
3937
  return this.executeRefresh();
3919
3938
  }
3920
3939
  async sort(column) {
3921
- await ApiaApi$1.post(
3940
+ const result = await ApiaApi$1.post(
3922
3941
  makeApiaUrl({ ...this.getSortParameters(), orderBy: column })
3923
3942
  );
3943
+ if (result?.data) {
3944
+ const structure = this.parseLoadStructureResponse(result.data);
3945
+ this.parseStructure(structure);
3946
+ }
3924
3947
  this.refresh();
3925
3948
  }
3926
3949
  }