@flusys/ng-shared 8.1.5 → 9.0.0
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 +42 -1
- package/fesm2022/flusys-ng-shared.mjs +451 -110
- package/fesm2022/flusys-ng-shared.mjs.map +1 -1
- package/package.json +4 -3
- package/types/flusys-ng-shared.d.ts +122 -5
package/README.md
CHANGED
|
@@ -77,6 +77,29 @@ Available CRUD methods: `insert`, `insertMany`, `findById`, `findByIds`, `getAll
|
|
|
77
77
|
|
|
78
78
|
---
|
|
79
79
|
|
|
80
|
+
A subclass that needs its own endpoint on the same controller calls the protected `post<R>(endpoint, body)`
|
|
81
|
+
helper, which adds the base URL and the loader tag:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
publish(id: string): Promise<ISingleResponse<IProduct>> {
|
|
85
|
+
return this.post('publish', { id });
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Error toasts
|
|
90
|
+
|
|
91
|
+
`errorCatchingInterceptor` shows every failed request as a toast (skipping 401, 403, `check-login` and
|
|
92
|
+
requests sent with `SKIP_ERROR_TOAST`). The message is translated with `translateRef`, so a
|
|
93
|
+
`messageVariables` entry that is itself a message ref (`{ problem: { messageKey, messageVariables } }`)
|
|
94
|
+
is translated too. A catch block that wants its own message only for failures the user has not seen
|
|
95
|
+
yet uses `isErrorToastShown(error)`:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
} catch (error) {
|
|
99
|
+
if (!isErrorToastShown(error)) this.messages.add({ severity: 'error', summary: this.translate.translate('x.save.failed') });
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
80
103
|
## 2. FileUrlService — Presigned URL Fetching
|
|
81
104
|
|
|
82
105
|
Never construct file URLs manually. `FileUrlService` handles S3/Azure presigned URLs, caching, and deduplication.
|
|
@@ -154,12 +177,30 @@ All three guards redirect to `/` by default. Pass a second argument to change it
|
|
|
154
177
|
|
|
155
178
|
---
|
|
156
179
|
|
|
157
|
-
## 5.
|
|
180
|
+
## 5. Action pickers + ACTION_PROVIDER
|
|
181
|
+
|
|
182
|
+
`<lib-action-select>` (one code) and `<lib-action-multi-select>` (a list of codes) pick permission action codes for any "permission required" field, so feature packages never hand-type codes or import ng-iam.
|
|
183
|
+
|
|
184
|
+
```html
|
|
185
|
+
<lib-action-select inputId="permission" [(value)]="permissionCode" [placeholder]="defaultCode" />
|
|
186
|
+
<lib-action-multi-select inputId="actionGroups" [(value)]="actionGroups" />
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
- Lists actions from the optional `ACTION_PROVIDER` token (`IActionProvider.getActions()` → flat `IActionBasicInfo[]` with `parentId` / `serial`); `provideIamProviders()` from `@flusys/ng-iam` wires it.
|
|
190
|
+
- Both render an `f-treeselect` of the action hierarchy, ordered by `serial` then name. Actions without a `code` are groups: they expand but can't be picked, and a group with nothing pickable under it is hidden. The multi picker uses checkboxes that do not cascade, so ticking a node picks only that code. Search matches name or code.
|
|
191
|
+
- Without a provider (IAM not installed) they fall back to typing codes: a text input, or chips added with Enter for the multi picker.
|
|
192
|
+
- A saved code that is not an action stays selectable, so older or default codes still show.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 6. TranslatePipe
|
|
158
197
|
|
|
159
198
|
```html
|
|
160
199
|
{{ 'shared.save' | translate }} {{ 'pagination.showing' | translate: { from: 1, to: 10 } }}
|
|
161
200
|
```
|
|
162
201
|
|
|
202
|
+
The pipe also accepts a backend message reference (`IMessageRef`: `{ messageKey, messageVariables? }`), e.g. `{{ plan.warnings[0] | translate }}`. `TranslateService.translateRef(ref)` does the same in code and translates variables that are themselves references first. `errorToMessageRef(error, fallbackKey?)` (`@flusys/ng-shared`) turns a failed HTTP call into a reference from the response's `messageKey`/`messageVariables`.
|
|
203
|
+
|
|
163
204
|
## License
|
|
164
205
|
|
|
165
206
|
MIT © FLUSYS
|