@kuzntsv/uikit 1.0.59 → 1.0.60

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.
@@ -3179,17 +3179,12 @@ var BaseSignalServiceClass = class BaseSignalServiceClass {
3179
3179
  parse: (data) => z.coerce.number().parse(data)
3180
3180
  });
3181
3181
  }
3182
- getObjectsByPaging(pageIndex, pageSize, sortColumn, direction) {
3182
+ getObjectsByPaging(tableState) {
3183
3183
  return httpResource(() => {
3184
3184
  this._refreshTrigger();
3185
- const queryParams = {};
3186
- if (pageIndex + 1) queryParams[this.pageIndexParam] = pageIndex + 1;
3187
- if (pageSize) queryParams[this.pageSizeParam] = pageSize;
3188
- if (sortColumn) queryParams[this.sortColumnParam] = sortColumn;
3189
- if (direction) queryParams[this.directionParam] = direction;
3190
3185
  return {
3191
3186
  url: this.baseRoute,
3192
- params: queryParams
3187
+ params: this.buildTableParams(tableState)
3193
3188
  };
3194
3189
  }, {
3195
3190
  ...this.getHttpContext(),
@@ -3200,17 +3195,17 @@ var BaseSignalServiceClass = class BaseSignalServiceClass {
3200
3195
  }
3201
3196
  });
3202
3197
  }
3203
- getObjectsByFilterPaging(pageIndex, pageSize, sortColumn, direction, filters) {
3198
+ getObjectsByFilterPaging(tableState, filters) {
3204
3199
  return httpResource(() => {
3205
3200
  this._refreshTrigger();
3206
- const queryParams = { ...cleanFilterParams(filters) };
3207
- if (pageIndex + 1) queryParams[this.pageIndexParam] = pageIndex + 1;
3208
- if (pageSize) queryParams[this.pageSizeParam] = pageSize;
3209
- if (sortColumn) queryParams[this.sortColumnParam] = sortColumn;
3210
- if (direction) queryParams[this.directionParam] = direction;
3201
+ const cleanFields = cleanFilterParams(filters);
3202
+ const tableParams = this.buildTableParams(tableState);
3211
3203
  return {
3212
3204
  url: this.baseRoute,
3213
- params: queryParams
3205
+ params: {
3206
+ ...cleanFields,
3207
+ ...tableParams
3208
+ }
3214
3209
  };
3215
3210
  }, {
3216
3211
  ...this.getHttpContext(),
@@ -3235,6 +3230,15 @@ var BaseSignalServiceClass = class BaseSignalServiceClass {
3235
3230
  parse: (data) => z.coerce.number().parse(data)
3236
3231
  });
3237
3232
  }
3233
+ buildTableParams(tableState) {
3234
+ const queryParams = {};
3235
+ const { pageIndex, pageSize, sortActive, sortDirection } = tableState;
3236
+ if (pageIndex + 1) queryParams[this.pageIndexParam] = pageIndex + 1;
3237
+ if (pageSize) queryParams[this.pageSizeParam] = pageSize;
3238
+ if (sortActive) queryParams[this.sortColumnParam] = sortActive;
3239
+ if (sortDirection) queryParams[this.directionParam] = sortDirection;
3240
+ return queryParams;
3241
+ }
3238
3242
  newObject(entity) {
3239
3243
  return this.http.post(this.baseRoute, entity, this.getHttpContext());
3240
3244
  }
@@ -4367,6 +4371,16 @@ i0.ɵɵngDeclareClassMetadata({
4367
4371
  }]
4368
4372
  }
4369
4373
  });
4374
+ const SortDirectionSchema = z.custom((val) => val === "asc" || val === "desc" || val === "", { message: "Допустимы только значения 'asc', 'desc' или ''" });
4375
+ const SortStateSchema = z.object({
4376
+ sortActive: z.string(),
4377
+ sortDirection: SortDirectionSchema
4378
+ });
4379
+ const PageStateSchema = z.object({
4380
+ pageIndex: z.number().int().min(0),
4381
+ pageSize: z.number().int().positive()
4382
+ });
4383
+ const TableStateSchema = SortStateSchema.merge(PageStateSchema);
4370
4384
  var TableComponent = class TableComponent {
4371
4385
  data = input([], ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
4372
4386
  length = input(0, ...ngDevMode ? [{ debugName: "length" }] : /* istanbul ignore next */ []);
@@ -5627,6 +5641,6 @@ const secUserSchema = z.object({
5627
5641
  tabnum: z.number().default(0),
5628
5642
  userView: secUserViewSchema.optional()
5629
5643
  });
5630
- export { Action, AvatarService, BaseEditClass, BaseFilterClass, BaseMatChipComponent, BaseNavBarMenuClass, BasePageClass, BaseSchema, BaseSelectAutocompleteWithVsComponent, BaseSelectWithGroupComponent, BaseServiceClass, BaseSignalEditClass, BaseSignalFilterClass, BaseSignalPageClass, BaseSignalServiceClass, BaseToolbarComponent, CustomDateAdapter, DateRangeInputComponent, DialogAction, DialogComponent, DisableIfRoleDirective, EmptyComponent, EntityAction, ExportService, HideIfForbiddenRoleDirective, LOGGER_CONFIG, LoaderService, LocalStorageService, LoggerService, LoginPageComponent, MY_NATIVE_FORMATS, NavBarComponent, NotFoundComponent, ProgressSpinnerComponent, SafePipe, SecureImageService, SetValueDirective, SseService, TableComponent, TimePipe, TruncatePipe, authGuard, dateFormat, provideLogger, redirectGuard, roleGuard, secUserSchema };
5644
+ export { Action, AvatarService, BaseEditClass, BaseFilterClass, BaseMatChipComponent, BaseNavBarMenuClass, BasePageClass, BaseSchema, BaseSelectAutocompleteWithVsComponent, BaseSelectWithGroupComponent, BaseServiceClass, BaseSignalEditClass, BaseSignalFilterClass, BaseSignalPageClass, BaseSignalServiceClass, BaseToolbarComponent, CustomDateAdapter, DateRangeInputComponent, DialogAction, DialogComponent, DisableIfRoleDirective, EmptyComponent, EntityAction, ExportService, HideIfForbiddenRoleDirective, LOGGER_CONFIG, LoaderService, LocalStorageService, LoggerService, LoginPageComponent, MY_NATIVE_FORMATS, NavBarComponent, NotFoundComponent, PageStateSchema, ProgressSpinnerComponent, SafePipe, SecureImageService, SetValueDirective, SortDirectionSchema, SortStateSchema, SseService, TableComponent, TableStateSchema, TimePipe, TruncatePipe, authGuard, dateFormat, provideLogger, redirectGuard, roleGuard, secUserSchema };
5631
5645
 
5632
5646
  //# sourceMappingURL=kuzntsv-uikit-ui.mjs.map