@flusys/ng-shared 5.0.3 → 5.0.4

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/README.md CHANGED
@@ -20,17 +20,24 @@ npm install @flusys/ng-shared @flusys/ng-core
20
20
  Extend this class to get a reactive list resource backed by `resource()`, with pagination, search, and all standard POST-only RPC endpoints.
21
21
 
22
22
  ```typescript
23
- import { Injectable, inject } from '@angular/core';
24
- import { HttpClient } from '@angular/common/http';
25
- import { ApiResourceService } from '@flusys/ng-shared';
26
-
27
- export interface IProduct { id: string; name: string; price: number; }
28
- export interface IProductDto { name: string; price: number; }
23
+ import { Injectable, inject } from "@angular/core";
24
+ import { HttpClient } from "@angular/common/http";
25
+ import { ApiResourceService } from "@flusys/ng-shared";
26
+
27
+ export interface IProduct {
28
+ id: string;
29
+ name: string;
30
+ price: number;
31
+ }
32
+ export interface IProductDto {
33
+ name: string;
34
+ price: number;
35
+ }
29
36
 
30
- @Injectable({ providedIn: 'root' })
37
+ @Injectable({ providedIn: "root" })
31
38
  export class ProductService extends ApiResourceService<IProductDto, IProduct> {
32
39
  constructor() {
33
- super('products', inject(HttpClient), 'administration'); // moduleApiName, http, serviceName (key in APP_CONFIG.services)
40
+ super("products", "administration"); // moduleApiName, http, serviceName (key in APP_CONFIG.services)
34
41
  }
35
42
  }
36
43
  ```
@@ -107,9 +114,9 @@ export class AvatarComponent {
107
114
  ```typescript
108
115
  const pv = inject(PermissionValidatorService);
109
116
 
110
- pv.hasPermission('user.create'); // true
111
- pv.hasPermission('report.export'); // true — wildcard match
112
- pv.isPermissionsLoaded(); // boolean
117
+ pv.hasPermission("user.create"); // true
118
+ pv.hasPermission("report.export"); // true — wildcard match
119
+ pv.isPermissionsLoaded(); // boolean
113
120
  ```
114
121
 
115
122
  ```html
@@ -122,23 +129,23 @@ pv.isPermissionsLoaded(); // boolean
122
129
  ## 4. Permission Guards
123
130
 
124
131
  ```typescript
125
- import { permissionGuard, anyPermissionGuard, allPermissionsGuard } from '@flusys/ng-shared';
132
+ import { permissionGuard, anyPermissionGuard, allPermissionsGuard } from "@flusys/ng-shared";
126
133
 
127
134
  export const routes: Routes = [
128
135
  {
129
- path: 'users',
130
- canActivate: [permissionGuard('user.view')], // single
131
- loadComponent: () => import('./user-list.component'),
136
+ path: "users",
137
+ canActivate: [permissionGuard("user.view")], // single
138
+ loadComponent: () => import("./user-list.component"),
132
139
  },
133
140
  {
134
- path: 'reports',
135
- canActivate: [anyPermissionGuard(['report.view', 'report.export'])], // OR
136
- loadComponent: () => import('./reports.component'),
141
+ path: "reports",
142
+ canActivate: [anyPermissionGuard(["report.view", "report.export"])], // OR
143
+ loadComponent: () => import("./reports.component"),
137
144
  },
138
145
  {
139
- path: 'admin',
140
- canActivate: [allPermissionsGuard(['admin.view', 'admin.manage'])], // AND
141
- loadComponent: () => import('./admin.component'),
146
+ path: "admin",
147
+ canActivate: [allPermissionsGuard(["admin.view", "admin.manage"])], // AND
148
+ loadComponent: () => import("./admin.component"),
142
149
  },
143
150
  ];
144
151
  ```
@@ -150,12 +157,9 @@ All three guards redirect to `/` by default. Pass a second argument to change it
150
157
  ## 5. TranslatePipe
151
158
 
152
159
  ```html
153
- {{ 'shared.save' | translate }}
154
-
155
- {{ 'pagination.showing' | translate: { from: 1, to: 10 } }}
160
+ {{ 'shared.save' | translate }} {{ 'pagination.showing' | translate: { from: 1, to: 10 } }}
156
161
  ```
157
162
 
158
-
159
163
  ## License
160
164
 
161
165
  MIT © FLUSYS