@elite.framework/ng.core 2.0.3 → 2.0.5

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/models/index.d.ts CHANGED
@@ -1,11 +1,17 @@
1
+ import { MenuItem } from 'primeng/api';
1
2
  import { HttpParameterCodec, HttpParams, HttpHeaders } from '@angular/common/http';
3
+ import { ActivatedRouteSnapshot, Route, RouterStateSnapshot, NavigationExtras } from '@angular/router';
2
4
 
3
5
  interface ActionDef<T> {
4
6
  name: string;
5
7
  icon?: string;
6
8
  label?: string;
7
9
  styleClass?: string;
10
+ order?: number;
11
+ permissions?: string[];
8
12
  action?: (item: T) => void | Promise<void>;
13
+ visible?: boolean;
14
+ permission?: string;
9
15
  }
10
16
 
11
17
  declare class AttachmentDto {
@@ -26,8 +32,11 @@ interface ButtonConfig {
26
32
  variant: 'text' | 'outlined' | 'raised' | 'rounded';
27
33
  severity: 'primary' | 'secondary' | 'success' | 'info' | 'warn' | 'danger' | 'help' | 'contrast';
28
34
  size: 'small' | 'normal' | 'large';
29
- actionName?: string;
30
35
  permission?: string;
36
+ visible?: boolean;
37
+ splitActions?: MenuItem[];
38
+ actionName?: string;
39
+ action?: (item: any) => void | Promise<void>;
31
40
  }
32
41
 
33
42
  interface ColumnDef<T> {
@@ -131,5 +140,30 @@ declare namespace Rest {
131
140
  }
132
141
  }
133
142
 
134
- export { AttachmentDto, GeneralResponse, ListResultDto, PagedResultDto, Rest, checkHasProp };
135
- export type { ActionDef, ButtonConfig, ColumnDef, FilterDef, FilterType, PaginatedResult, Root };
143
+ interface NgxPermissionsRouterData {
144
+ only?: string | string[] | OnlyFn | any;
145
+ except?: string | string[] | ExceptFn | any;
146
+ redirectTo?: RedirectTo | RedirectToFn;
147
+ }
148
+ interface NgxRedirectToNavigationParameters {
149
+ navigationCommands: any[] | NavigationCommandsFn;
150
+ navigationExtras?: NavigationExtras | NavigationExtrasFn;
151
+ }
152
+ declare type OnlyFn = (route: ActivatedRouteSnapshot | Route, state?: RouterStateSnapshot) => string | string[];
153
+ declare type ExceptFn = (route: ActivatedRouteSnapshot | Route, state?: RouterStateSnapshot) => string | string[];
154
+ declare type RedirectTo = string | {
155
+ [name: string]: NgxRedirectToNavigationParameters | string | RedirectToFn;
156
+ } | NgxRedirectToNavigationParameters;
157
+ declare type RedirectToFn = (rejectedPermissionName?: string, route?: ActivatedRouteSnapshot | Route, state?: RouterStateSnapshot) => RedirectTo;
158
+ declare type NavigationCommandsFn = (route: ActivatedRouteSnapshot | Route, state?: RouterStateSnapshot) => any[];
159
+ declare type NavigationExtrasFn = (route: ActivatedRouteSnapshot | Route, state?: RouterStateSnapshot) => NavigationExtras;
160
+ declare type ValidationFn = ((name?: string, store?: any) => Promise<void | string | boolean> | boolean | string[]);
161
+ declare const DEFAULT_REDIRECT_KEY = "default";
162
+
163
+ interface NgxPermission {
164
+ name: string;
165
+ validationFunction?: ValidationFn;
166
+ }
167
+
168
+ export { AttachmentDto, DEFAULT_REDIRECT_KEY, GeneralResponse, ListResultDto, PagedResultDto, Rest, checkHasProp };
169
+ export type { ActionDef, ButtonConfig, ColumnDef, ExceptFn, FilterDef, FilterType, NavigationCommandsFn, NavigationExtrasFn, NgxPermission, NgxPermissionsRouterData, NgxRedirectToNavigationParameters, OnlyFn, PaginatedResult, RedirectTo, RedirectToFn, Root, ValidationFn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elite.framework/ng.core",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^20.1.0",
6
6
  "@angular/core": "^20.1.0"
@@ -24,6 +24,10 @@
24
24
  "types": "./models/index.d.ts",
25
25
  "default": "./fesm2022/elite.framework-ng.core-models.mjs"
26
26
  },
27
+ "./interceptors": {
28
+ "types": "./interceptors/index.d.ts",
29
+ "default": "./fesm2022/elite.framework-ng.core-interceptors.mjs"
30
+ },
27
31
  "./pipes": {
28
32
  "types": "./pipes/index.d.ts",
29
33
  "default": "./fesm2022/elite.framework-ng.core-pipes.mjs"
@@ -39,6 +43,10 @@
39
43
  "./tokens": {
40
44
  "types": "./tokens/index.d.ts",
41
45
  "default": "./fesm2022/elite.framework-ng.core-tokens.mjs"
46
+ },
47
+ "./utils": {
48
+ "types": "./utils/index.d.ts",
49
+ "default": "./fesm2022/elite.framework-ng.core-utils.mjs"
42
50
  }
43
51
  },
44
52
  "dependencies": {
@@ -1,13 +1,14 @@
1
1
  import * as rxjs from 'rxjs';
2
2
  import { Observable } from 'rxjs';
3
3
  import { HttpClient, HttpRequest } from '@angular/common/http';
4
- import { Root, Rest, PaginatedResult } from '@elite.framework/ng.core/models';
4
+ import { Root, Rest, PaginatedResult, RedirectTo, RedirectToFn } from '@elite.framework/ng.core/models';
5
5
  import * as i0 from '@angular/core';
6
6
  import { InjectionToken } from '@angular/core';
7
7
  import * as qs from 'qs';
8
8
  import * as express_serve_static_core from 'express-serve-static-core';
9
9
  import { Request } from 'express';
10
10
  import { SweetAlertResult, SweetAlertOptions, SweetAlertIcon } from 'sweetalert2';
11
+ import { CanActivateFn, CanActivateChildFn, CanMatchFn, Router, ActivatedRouteSnapshot, RouterStateSnapshot, Route } from '@angular/router';
11
12
 
12
13
  declare class RestService {
13
14
  protected options: Root;
@@ -246,5 +247,35 @@ declare class SwalService {
246
247
  static ɵprov: i0.ɵɵInjectableDeclaration<SwalService>;
247
248
  }
248
249
 
249
- export { BaseService, GenericService, REQUEST, RestService, SsrCookieService, SwalService, isUndefinedOrEmptyString };
250
- export type { CrudService };
250
+ declare class PermissionsService {
251
+ private _permissions$;
252
+ setPermissions(permissions: string[]): void;
253
+ getPermissions(): string[];
254
+ isGranted(permissionName: string): boolean;
255
+ isGrantedAsync(permissionName: string): Promise<boolean>;
256
+ static ɵfac: i0.ɵɵFactoryDeclaration<PermissionsService, never>;
257
+ static ɵprov: i0.ɵɵInjectableDeclaration<PermissionsService>;
258
+ }
259
+
260
+ interface NgxPermissionsData {
261
+ only?: string | string[];
262
+ except?: string | string[];
263
+ redirectTo?: RedirectTo | RedirectToFn | any;
264
+ }
265
+ declare const ngxPermissionsGuard: CanActivateFn | CanActivateChildFn | CanMatchFn;
266
+ declare class NgxPermissionsGuard {
267
+ private permissions;
268
+ private router;
269
+ constructor(permissions: PermissionsService, router: Router);
270
+ canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean>;
271
+ canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean>;
272
+ canLoad(route: Route): Promise<boolean>;
273
+ canMatch(route: Route): Promise<boolean>;
274
+ hasPermissions(route: ActivatedRouteSnapshot | Route, state?: RouterStateSnapshot): Promise<boolean>;
275
+ private handleRedirect;
276
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxPermissionsGuard, never>;
277
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgxPermissionsGuard>;
278
+ }
279
+
280
+ export { BaseService, GenericService, NgxPermissionsGuard, PermissionsService, REQUEST, RestService, SsrCookieService, SwalService, isUndefinedOrEmptyString, ngxPermissionsGuard };
281
+ export type { CrudService, NgxPermissionsData };
@@ -0,0 +1,3 @@
1
+ # @elite.framework/ng.core/utils
2
+
3
+ Secondary entry point of `@elite.framework/ng.core`. It can be used by importing from `@elite.framework/ng.core/utils`.
@@ -0,0 +1,18 @@
1
+ import * as i0 from '@angular/core';
2
+ import * as i1 from '@angular/common';
3
+
4
+ declare class UtilsModule {
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<UtilsModule, never>;
6
+ static ɵmod: i0.ɵɵNgModuleDeclaration<UtilsModule, never, [typeof i1.CommonModule], never>;
7
+ static ɵinj: i0.ɵɵInjectorDeclaration<UtilsModule>;
8
+ }
9
+
10
+ declare function isFunction<T>(value: any): value is T;
11
+ declare function isPlainObject(value: any): boolean;
12
+ declare function isString(value: any): value is string;
13
+ declare function isBoolean(value: any): value is boolean;
14
+ declare function isPromise(promise: any): boolean;
15
+ declare function notEmptyValue(value: string | string[]): boolean;
16
+ declare function transformStringToArray(value: string | string[]): string[];
17
+
18
+ export { UtilsModule, isBoolean, isFunction, isPlainObject, isPromise, isString, notEmptyValue, transformStringToArray };