@kuzntsv/uikit 1.0.112 → 1.0.113

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, Component, Directive, ElementRef, Injectable, InjectionToken, Injector, NgZone, Pipe, Service, computed, debounced, effect, inject, input, linkedSignal, makeEnvironmentProviders, model, output, signal, untracked, viewChild } from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, Directive, ElementRef, Injectable, InjectionToken, NgZone, Pipe, Service, computed, debounced, effect, inject, input, linkedSignal, makeEnvironmentProviders, model, output, signal, untracked, viewChild } from "@angular/core";
3
3
  import { Router, RouterLink } from "@angular/router";
4
4
  import { API_NAME, AuthService, HIDE_ROLE_MARKER, LoaderService, NotificationService, RoleService, SignalSelectionModel, UIKIT_NOTIFICATION_TOKEN, X_SKIP_LOADER, X_SKIP_NOTIFICATION, formatZodError } from "@kuzntsv/uikit";
5
5
  import { ReplaySubject, Subject, Subscription, filter, forkJoin, lastValueFrom, map, of, switchMap, take, tap } from "rxjs";
@@ -2208,7 +2208,10 @@ function isEmptyFilterValue(value) {
2208
2208
  }
2209
2209
  var BaseSignalPageClass = class BaseSignalPageClass {
2210
2210
  dialog = inject(MatDialog);
2211
- injector = inject(Injector);
2211
+ router = inject(Router);
2212
+ localStorageService = inject(LocalStorageService);
2213
+ loaderService = inject(LoaderService);
2214
+ notificationService = inject(UIKIT_NOTIFICATION_TOKEN);
2212
2215
  entityService;
2213
2216
  entityEditComponent;
2214
2217
  extraData;
@@ -2221,7 +2224,6 @@ var BaseSignalPageClass = class BaseSignalPageClass {
2221
2224
  defaultPageSize = 10;
2222
2225
  dialogEditWidth = "auto";
2223
2226
  dialogRemoveWidth = "400px";
2224
- routeAddress = "";
2225
2227
  removalMessage = "";
2226
2228
  pageTitle = "";
2227
2229
  beforeOpenDialogOnNewEvent;
@@ -2234,7 +2236,10 @@ var BaseSignalPageClass = class BaseSignalPageClass {
2234
2236
  executeRoles = [];
2235
2237
  hideRoles = [HIDE_ROLE_MARKER];
2236
2238
  allowMultiSelect = false;
2239
+ dblClickedEventEnable = true;
2237
2240
  selected = signal([], ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
2241
+ editBtnDisabled = computed(() => !(this.selected() && this.selected().length === 1), ...ngDevMode ? [{ debugName: "editBtnDisabled" }] : /* istanbul ignore next */ []);
2242
+ removeBtnDisabled = computed(() => !(this.selected() && this.selected().length > 0), ...ngDevMode ? [{ debugName: "removeBtnDisabled" }] : /* istanbul ignore next */ []);
2238
2243
  fnMapEntity;
2239
2244
  dataResource;
2240
2245
  countResource;
@@ -2254,63 +2259,8 @@ var BaseSignalPageClass = class BaseSignalPageClass {
2254
2259
  if (this.dataResource.error() || this.countResource.error()) return false;
2255
2260
  return this.dataResource.isLoading() || this.countResource.isLoading();
2256
2261
  }, ...ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []);
2257
- editBtnDisabled = computed(() => !(this.selected() && this.selected().length === 1), ...ngDevMode ? [{ debugName: "editBtnDisabled" }] : /* istanbul ignore next */ []);
2258
- removeBtnDisabled = computed(() => !(this.selected() && this.selected().length > 0), ...ngDevMode ? [{ debugName: "removeBtnDisabled" }] : /* istanbul ignore next */ []);
2259
- dblClickedEventEnable = true;
2260
2262
  opt = [];
2261
- router = inject(Router);
2262
- localStorageService = inject(LocalStorageService);
2263
- loaderService = inject(LoaderService);
2264
- notificationService = inject(UIKIT_NOTIFICATION_TOKEN);
2265
2263
  subscription = new Subscription();
2266
- getInitialFilters() {
2267
- const saved = this.localStorageService.getData(this.constructor.name + "_Filters");
2268
- return saved ? JSON.parse(saved) : {};
2269
- }
2270
- initFilters() {
2271
- if (!this.filterSchema || !this.defaultFilters) return;
2272
- const initial = { ...this.defaultFilters };
2273
- Object.keys(this.defaultFilters).forEach((key) => {
2274
- const storageKey = `${this.storagePrefix}${key}`;
2275
- const rawValue = this.localStorageService.getData(storageKey);
2276
- if (rawValue !== null && rawValue !== void 0) try {
2277
- initial[key] = JSON.parse(rawValue);
2278
- } catch {
2279
- initial[key] = rawValue;
2280
- }
2281
- });
2282
- const validation = this.filterSchema.safeParse(initial);
2283
- this.filters.set(validation.success ? validation.data : this.defaultFilters);
2284
- }
2285
- getInitialFilters2() {
2286
- const prefix = this.constructor.name + "_Filter_";
2287
- const state = {};
2288
- for (let i = 0; i < localStorage.length; i++) {
2289
- const key = localStorage.key(i);
2290
- if (key && key.startsWith(prefix)) {
2291
- const filterKey = key.replace(prefix, "");
2292
- const rawValue = this.localStorageService.getData(key);
2293
- try {
2294
- state[filterKey] = rawValue ? JSON.parse(rawValue) : rawValue;
2295
- } catch {
2296
- state[filterKey] = rawValue;
2297
- }
2298
- }
2299
- }
2300
- return state;
2301
- }
2302
- clearEvent() {
2303
- if (!this.defaultFilters) return;
2304
- Object.keys(this.defaultFilters).forEach((key) => {
2305
- this.localStorageService.removeData(`${this.storagePrefix}${key}`);
2306
- });
2307
- this.tableState.update((prev) => ({
2308
- ...prev,
2309
- pageIndex: 0
2310
- }));
2311
- this.filters.set({ ...this.defaultFilters });
2312
- this.clearFilters.set({});
2313
- }
2314
2264
  filters = signal({}, ...ngDevMode ? [{ debugName: "filters" }] : /* istanbul ignore next */ []);
2315
2265
  clearFilters = signal(null, ...ngDevMode ? [{ debugName: "clearFilters" }] : /* istanbul ignore next */ []);
2316
2266
  tableState = signal({
@@ -2347,6 +2297,33 @@ var BaseSignalPageClass = class BaseSignalPageClass {
2347
2297
  ngOnDestroy() {
2348
2298
  this.subscription.unsubscribe();
2349
2299
  }
2300
+ initFilters() {
2301
+ if (!this.filterSchema || !this.defaultFilters) return;
2302
+ const initial = { ...this.defaultFilters };
2303
+ Object.keys(this.defaultFilters).forEach((key) => {
2304
+ const storageKey = `${this.storagePrefix}${key}`;
2305
+ const rawValue = this.localStorageService.getData(storageKey);
2306
+ if (rawValue !== null && rawValue !== void 0) try {
2307
+ initial[key] = JSON.parse(rawValue);
2308
+ } catch {
2309
+ initial[key] = rawValue;
2310
+ }
2311
+ });
2312
+ const validation = this.filterSchema.safeParse(initial);
2313
+ this.filters.set(validation.success ? validation.data : this.defaultFilters);
2314
+ }
2315
+ clearEvent() {
2316
+ if (!this.defaultFilters) return;
2317
+ Object.keys(this.defaultFilters).forEach((key) => {
2318
+ this.localStorageService.removeData(`${this.storagePrefix}${key}`);
2319
+ });
2320
+ this.tableState.update((prev) => ({
2321
+ ...prev,
2322
+ pageIndex: 0
2323
+ }));
2324
+ this.filters.set({ ...this.defaultFilters });
2325
+ this.clearFilters.set({});
2326
+ }
2350
2327
  setFilter(key, value) {
2351
2328
  const storageKey = `${this.storagePrefix}${String(key)}`;
2352
2329
  this.tableState.update((prev) => ({
@@ -2411,7 +2388,7 @@ var BaseSignalPageClass = class BaseSignalPageClass {
2411
2388
  this.selected.set(selected);
2412
2389
  }
2413
2390
  onRowDoubleClicked() {
2414
- this.editEvent();
2391
+ if (this.dblClickedEventEnable) this.editEvent();
2415
2392
  }
2416
2393
  newEvent() {
2417
2394
  if (this.entityEditComponent) {