@kuzntsv/uikit 1.0.59 → 1.0.61
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Directive, ElementRef, HostListener, Injectable, InjectionToken, NgZone, Pipe, computed, effect, inject, input, linkedSignal, makeEnvironmentProviders, model, output, signal, viewChild } from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Directive, ElementRef, HostListener, Injectable, InjectionToken, Injector, NgZone, Pipe, computed, effect, inject, input, linkedSignal, makeEnvironmentProviders, model, output, runInInjectionContext, signal, viewChild } from "@angular/core";
|
|
3
3
|
import { Router, RouterLink } from "@angular/router";
|
|
4
4
|
import { ReplaySubject, Subject, Subscription, filter, finalize, forkJoin, map, of, startWith, switchMap, take, tap } from "rxjs";
|
|
5
5
|
import { API_NAME, AuthService, HIDE_ROLE_MARKER, NotificationService, RoleService, UIKIT_NOTIFICATION_TOKEN } from "@kuzntsv/uikit";
|
|
@@ -2736,6 +2736,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2736
2736
|
});
|
|
2737
2737
|
var BaseSignalPageClass = class BaseSignalPageClass {
|
|
2738
2738
|
dialog = inject(MatDialog);
|
|
2739
|
+
injector = inject(Injector);
|
|
2739
2740
|
entityService;
|
|
2740
2741
|
entityEditComponent;
|
|
2741
2742
|
extraData;
|
|
@@ -2763,13 +2764,13 @@ var BaseSignalPageClass = class BaseSignalPageClass {
|
|
|
2763
2764
|
allowMultiSelect = false;
|
|
2764
2765
|
selected = [];
|
|
2765
2766
|
dataResource = computed(() => {
|
|
2766
|
-
this.tableState();
|
|
2767
|
-
this.filters();
|
|
2768
|
-
return this.fnGetData();
|
|
2767
|
+
const currentState = this.tableState();
|
|
2768
|
+
const currentFilters = this.filters();
|
|
2769
|
+
return runInInjectionContext(this.injector, () => this.fnGetData(currentState, currentFilters));
|
|
2769
2770
|
}, ...ngDevMode ? [{ debugName: "dataResource" }] : /* istanbul ignore next */ []);
|
|
2770
2771
|
countResource = computed(() => {
|
|
2771
|
-
this.filters();
|
|
2772
|
-
return this.fnGetCount();
|
|
2772
|
+
const currentFilters = this.filters();
|
|
2773
|
+
return runInInjectionContext(this.injector, () => this.fnGetCount(currentFilters));
|
|
2773
2774
|
}, ...ngDevMode ? [{ debugName: "countResource" }] : /* istanbul ignore next */ []);
|
|
2774
2775
|
data = computed(() => {
|
|
2775
2776
|
const rawData = this.dataResource()?.value() || [];
|
|
@@ -3179,17 +3180,12 @@ var BaseSignalServiceClass = class BaseSignalServiceClass {
|
|
|
3179
3180
|
parse: (data) => z.coerce.number().parse(data)
|
|
3180
3181
|
});
|
|
3181
3182
|
}
|
|
3182
|
-
getObjectsByPaging(
|
|
3183
|
+
getObjectsByPaging(tableState) {
|
|
3183
3184
|
return httpResource(() => {
|
|
3184
3185
|
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
3186
|
return {
|
|
3191
3187
|
url: this.baseRoute,
|
|
3192
|
-
params:
|
|
3188
|
+
params: this.buildTableParams(tableState)
|
|
3193
3189
|
};
|
|
3194
3190
|
}, {
|
|
3195
3191
|
...this.getHttpContext(),
|
|
@@ -3200,17 +3196,17 @@ var BaseSignalServiceClass = class BaseSignalServiceClass {
|
|
|
3200
3196
|
}
|
|
3201
3197
|
});
|
|
3202
3198
|
}
|
|
3203
|
-
getObjectsByFilterPaging(
|
|
3199
|
+
getObjectsByFilterPaging(tableState, filters) {
|
|
3204
3200
|
return httpResource(() => {
|
|
3205
3201
|
this._refreshTrigger();
|
|
3206
|
-
const
|
|
3207
|
-
|
|
3208
|
-
if (pageSize) queryParams[this.pageSizeParam] = pageSize;
|
|
3209
|
-
if (sortColumn) queryParams[this.sortColumnParam] = sortColumn;
|
|
3210
|
-
if (direction) queryParams[this.directionParam] = direction;
|
|
3202
|
+
const cleanFields = cleanFilterParams(filters);
|
|
3203
|
+
const tableParams = this.buildTableParams(tableState);
|
|
3211
3204
|
return {
|
|
3212
3205
|
url: this.baseRoute,
|
|
3213
|
-
params:
|
|
3206
|
+
params: {
|
|
3207
|
+
...cleanFields,
|
|
3208
|
+
...tableParams
|
|
3209
|
+
}
|
|
3214
3210
|
};
|
|
3215
3211
|
}, {
|
|
3216
3212
|
...this.getHttpContext(),
|
|
@@ -3235,6 +3231,15 @@ var BaseSignalServiceClass = class BaseSignalServiceClass {
|
|
|
3235
3231
|
parse: (data) => z.coerce.number().parse(data)
|
|
3236
3232
|
});
|
|
3237
3233
|
}
|
|
3234
|
+
buildTableParams(tableState) {
|
|
3235
|
+
const queryParams = {};
|
|
3236
|
+
const { pageIndex, pageSize, sortActive, sortDirection } = tableState;
|
|
3237
|
+
if (pageIndex + 1) queryParams[this.pageIndexParam] = pageIndex + 1;
|
|
3238
|
+
if (pageSize) queryParams[this.pageSizeParam] = pageSize;
|
|
3239
|
+
if (sortActive) queryParams[this.sortColumnParam] = sortActive;
|
|
3240
|
+
if (sortDirection) queryParams[this.directionParam] = sortDirection;
|
|
3241
|
+
return queryParams;
|
|
3242
|
+
}
|
|
3238
3243
|
newObject(entity) {
|
|
3239
3244
|
return this.http.post(this.baseRoute, entity, this.getHttpContext());
|
|
3240
3245
|
}
|
|
@@ -4367,6 +4372,16 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
4367
4372
|
}]
|
|
4368
4373
|
}
|
|
4369
4374
|
});
|
|
4375
|
+
const SortDirectionSchema = z.custom((val) => val === "asc" || val === "desc" || val === "", { message: "Допустимы только значения 'asc', 'desc' или ''" });
|
|
4376
|
+
const SortStateSchema = z.object({
|
|
4377
|
+
sortActive: z.string(),
|
|
4378
|
+
sortDirection: SortDirectionSchema
|
|
4379
|
+
});
|
|
4380
|
+
const PageStateSchema = z.object({
|
|
4381
|
+
pageIndex: z.number().int().min(0),
|
|
4382
|
+
pageSize: z.number().int().positive()
|
|
4383
|
+
});
|
|
4384
|
+
const TableStateSchema = SortStateSchema.merge(PageStateSchema);
|
|
4370
4385
|
var TableComponent = class TableComponent {
|
|
4371
4386
|
data = input([], ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
4372
4387
|
length = input(0, ...ngDevMode ? [{ debugName: "length" }] : /* istanbul ignore next */ []);
|
|
@@ -5627,6 +5642,6 @@ const secUserSchema = z.object({
|
|
|
5627
5642
|
tabnum: z.number().default(0),
|
|
5628
5643
|
userView: secUserViewSchema.optional()
|
|
5629
5644
|
});
|
|
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 };
|
|
5645
|
+
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
5646
|
|
|
5632
5647
|
//# sourceMappingURL=kuzntsv-uikit-ui.mjs.map
|