@quadrel-enterprise-ui/framework 20.10.0 → 20.10.1-beta.143.1
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/index.d.ts
CHANGED
|
@@ -9051,6 +9051,27 @@ interface QdPageConfigInspect<T extends object = object> extends QdPageConfigBas
|
|
|
9051
9051
|
* @description Information placed in the header of the page. Concerns current shown object.
|
|
9052
9052
|
*/
|
|
9053
9053
|
headerFacets?: QdPageHeaderFacetConfig<T>[];
|
|
9054
|
+
/**
|
|
9055
|
+
* @description Observable to push partial metadata updates for header facets from outside.
|
|
9056
|
+
* Each emission is shallow-merged into the current object data, so only the fields that
|
|
9057
|
+
* changed need to be emitted.
|
|
9058
|
+
*
|
|
9059
|
+
* @example
|
|
9060
|
+
* ```ts
|
|
9061
|
+
* private metadataUpdates$ = new Subject<Partial<MyObject>>();
|
|
9062
|
+
*
|
|
9063
|
+
* pageConfig: QdPageConfig<MyObject> = {
|
|
9064
|
+
* // ...
|
|
9065
|
+
* headerFacets: [...],
|
|
9066
|
+
* metadata$: this.metadataUpdates$
|
|
9067
|
+
* };
|
|
9068
|
+
*
|
|
9069
|
+
* onStatusChange() {
|
|
9070
|
+
* this.metadataUpdates$.next({ status: 'approved' });
|
|
9071
|
+
* }
|
|
9072
|
+
* ```
|
|
9073
|
+
*/
|
|
9074
|
+
metadata$?: Observable<Partial<T>>;
|
|
9054
9075
|
/**
|
|
9055
9076
|
* @description Determines whether the facets in header should be collapsed and custom actions are in a menu. This mode is designed for touch devices and mobile phones only.
|
|
9056
9077
|
*
|
|
@@ -9073,6 +9094,27 @@ interface QdPageConfigCustom<T extends object = object> extends QdPageConfigBase
|
|
|
9073
9094
|
* @description Information placed in the header of the page. Concerns current shown object.
|
|
9074
9095
|
*/
|
|
9075
9096
|
headerFacets?: QdPageHeaderFacetConfig<T>[];
|
|
9097
|
+
/**
|
|
9098
|
+
* @description Observable to push partial metadata updates for header facets from outside.
|
|
9099
|
+
* Each emission is shallow-merged into the current object data, so only the fields that
|
|
9100
|
+
* changed need to be emitted.
|
|
9101
|
+
*
|
|
9102
|
+
* @example
|
|
9103
|
+
* ```ts
|
|
9104
|
+
* private metadataUpdates$ = new Subject<Partial<MyObject>>();
|
|
9105
|
+
*
|
|
9106
|
+
* pageConfig: QdPageConfig<MyObject> = {
|
|
9107
|
+
* // ...
|
|
9108
|
+
* headerFacets: [...],
|
|
9109
|
+
* metadata$: this.metadataUpdates$
|
|
9110
|
+
* };
|
|
9111
|
+
*
|
|
9112
|
+
* onStatusChange() {
|
|
9113
|
+
* this.metadataUpdates$.next({ status: 'approved' });
|
|
9114
|
+
* }
|
|
9115
|
+
* ```
|
|
9116
|
+
*/
|
|
9117
|
+
metadata$?: Observable<Partial<T>>;
|
|
9076
9118
|
/**
|
|
9077
9119
|
* @description Determines whether the facets in header should be collapsed and custom actions are in a menu. This mode is designed for touch devices and mobile phones only.
|
|
9078
9120
|
*
|
|
@@ -9214,11 +9256,17 @@ interface QdPageCustomActionsLabel {
|
|
|
9214
9256
|
*/
|
|
9215
9257
|
type QdInspectOperationMode = 'view' | 'edit';
|
|
9216
9258
|
/**
|
|
9217
|
-
* @description
|
|
9259
|
+
* @description Common shape for all framework-managed commit actions (save, save draft, submit).
|
|
9260
|
+
*
|
|
9261
|
+
* Each commit action is built around a single `handler` whose return value tells the framework how
|
|
9262
|
+
* the action ended (success / planned failure / error), with optional `onSuccess` / `onError` hooks
|
|
9263
|
+
* for consumer-side reactions. Per-action interfaces (`QdPageSaveAction`, `QdPageSaveDraftAction`,
|
|
9264
|
+
* `QdPageCreateSubmitAction`, `QdPageInspectSubmitAction`) extend this base with their action-specific
|
|
9265
|
+
* options.
|
|
9218
9266
|
*/
|
|
9219
|
-
interface
|
|
9267
|
+
interface QdPageCommitAction {
|
|
9220
9268
|
/**
|
|
9221
|
-
* @description Label for the
|
|
9269
|
+
* @description Label for the action, used for translation.
|
|
9222
9270
|
*
|
|
9223
9271
|
* * If no custom translation key is provided, a standard label will be used by default.
|
|
9224
9272
|
*/
|
|
@@ -9226,17 +9274,106 @@ interface QdPageSaveAction {
|
|
|
9226
9274
|
i18n: string;
|
|
9227
9275
|
};
|
|
9228
9276
|
/**
|
|
9229
|
-
* @description Triggered when the
|
|
9277
|
+
* @description Triggered when the action is executed.
|
|
9230
9278
|
*
|
|
9231
9279
|
* Success criteria:
|
|
9232
|
-
* - If the handler returns an Observable<boolean
|
|
9233
|
-
* - **true:** success
|
|
9234
|
-
* - **false:** failure/cancel
|
|
9235
|
-
* - If the handler returns
|
|
9280
|
+
* - If the handler returns an `Observable<boolean>`, only the first emission counts:
|
|
9281
|
+
* - **true:** success — the framework marks the form as saved (the page is no longer dirty).
|
|
9282
|
+
* - **false:** failure/cancel — the form stays dirty.
|
|
9283
|
+
* - If the handler returns `void`, the action is treated as instant success and the form is marked as saved immediately.
|
|
9284
|
+
*
|
|
9285
|
+
* Errors emitted by the Observable trigger the optional `onError` hook, or fall back to `console.error` if
|
|
9286
|
+
* `onError` is not configured. The form stays dirty either way.
|
|
9287
|
+
*
|
|
9288
|
+
* **When to emit `false` vs. let an error fly:**
|
|
9289
|
+
* - `false` = predictable cancel/reject (user aborted, business rule, structured validation response from the backend).
|
|
9290
|
+
* - Error = unexpected (network outage, 5xx, bug).
|
|
9291
|
+
*
|
|
9292
|
+
* Rule of thumb: if the UI can explain the cause to the user, emit `false` (plus a notification). Otherwise let the error propagate.
|
|
9236
9293
|
*
|
|
9237
|
-
*
|
|
9294
|
+
* ---
|
|
9295
|
+
*
|
|
9296
|
+
* **Anti-pattern: do not navigate from inside an async handler pipeline.**
|
|
9297
|
+
*
|
|
9298
|
+
* The framework runs the synchronous handler invocation inside its navigation-bypass window. For
|
|
9299
|
+
* a sync `void` handler that calls `router.navigate(...)` directly, this is fine — the bypass is
|
|
9300
|
+
* active and the form is marked as saved immediately afterwards.
|
|
9301
|
+
*
|
|
9302
|
+
* For an `Observable<boolean>` handler, the bypass window closes as soon as the handler returns
|
|
9303
|
+
* the observable. Side effects wired into `tap` (or any later operator) run **after** the bypass
|
|
9304
|
+
* has already closed AND **before** the framework marks the form as saved on the `true` emission.
|
|
9305
|
+
* Navigating from there raises the unsaved-changes dialog — exactly what the framework is trying
|
|
9306
|
+
* to suppress. Use `onSuccess` for navigation after async commits.
|
|
9238
9307
|
*/
|
|
9239
9308
|
handler: (formValues?: any) => void | Observable<boolean>;
|
|
9309
|
+
/**
|
|
9310
|
+
* @description Optional callback invoked after the framework marks the form as saved on a successful commit.
|
|
9311
|
+
*
|
|
9312
|
+
* * Runs in the framework's navigation-bypass window, so router navigation from this hook does **not**
|
|
9313
|
+
* raise the unsaved-changes dialog.
|
|
9314
|
+
*
|
|
9315
|
+
* * For async handlers (returning `Observable<boolean>`), this hook is the **only** race-free place to
|
|
9316
|
+
* navigate. Side effects in `tap` run *before* the framework marks the form as saved; navigation
|
|
9317
|
+
* from there would still see a dirty form and trigger the dialog.
|
|
9318
|
+
*
|
|
9319
|
+
* @example
|
|
9320
|
+
* ```ts
|
|
9321
|
+
* submit: {
|
|
9322
|
+
* handler: (values) => api.create(values).pipe(map(() => true)),
|
|
9323
|
+
* onSuccess: () => router.navigateByUrl('/')
|
|
9324
|
+
* }
|
|
9325
|
+
* ```
|
|
9326
|
+
*/
|
|
9327
|
+
onSuccess?: () => void;
|
|
9328
|
+
/**
|
|
9329
|
+
* @description Optional callback invoked when the handler observable emits an error.
|
|
9330
|
+
*
|
|
9331
|
+
* * Receives the original error from the observable.
|
|
9332
|
+
*
|
|
9333
|
+
* * **Not** invoked when the handler emits `false` — `false` is a planned outcome, errors are unexpected
|
|
9334
|
+
* (see the `handler` doc for the distinction).
|
|
9335
|
+
*
|
|
9336
|
+
* * **Does not run in the navigation-bypass window.** Navigation from this hook raises the unsaved-changes
|
|
9337
|
+
* dialog, because the form is still dirty after a failed commit — and the user usually wants to keep
|
|
9338
|
+
* their edits. To navigate away unconditionally (e.g. on auth expiry), call
|
|
9339
|
+
* `QdPageComponent.discardUnsavedChanges()` first to reset the form to its last saved state.
|
|
9340
|
+
*
|
|
9341
|
+
* * If `onError` is not configured, the framework falls back to `console.error` so failures never go silent.
|
|
9342
|
+
*
|
|
9343
|
+
* @example
|
|
9344
|
+
* ```ts
|
|
9345
|
+
* submit: {
|
|
9346
|
+
* handler: (values) => api.create(values).pipe(map(() => true)),
|
|
9347
|
+
* onSuccess: () => router.navigateByUrl('/'),
|
|
9348
|
+
* onError: (err) => notifications.error('i18n.create.failed', err)
|
|
9349
|
+
* }
|
|
9350
|
+
* ```
|
|
9351
|
+
*
|
|
9352
|
+
* @example
|
|
9353
|
+
* Navigate away unconditionally from onError (e.g. auth-expiry redirect to login). Call `discardUnsavedChanges()` first to drop the dirty snapshot so the next navigation passes through without the dialog:
|
|
9354
|
+
*
|
|
9355
|
+
* ```ts
|
|
9356
|
+
* @ViewChild(QdPageComponent) pageComponent!: QdPageComponent<MyModel>;
|
|
9357
|
+
*
|
|
9358
|
+
* submit: {
|
|
9359
|
+
* handler: (values) => api.save(values).pipe(map(() => true)),
|
|
9360
|
+
* onError: (err) => {
|
|
9361
|
+
* if (err.status === 401) {
|
|
9362
|
+
* this.pageComponent.discardUnsavedChanges();
|
|
9363
|
+
* this.router.navigateByUrl('/login');
|
|
9364
|
+
* return;
|
|
9365
|
+
* }
|
|
9366
|
+
* this.notifications.error('i18n.save.failed', err);
|
|
9367
|
+
* }
|
|
9368
|
+
* }
|
|
9369
|
+
* ```
|
|
9370
|
+
*/
|
|
9371
|
+
onError?: (err: unknown) => void;
|
|
9372
|
+
}
|
|
9373
|
+
/**
|
|
9374
|
+
* @description Interface for the save action, including optional validation configuration.
|
|
9375
|
+
*/
|
|
9376
|
+
interface QdPageSaveAction extends QdPageCommitAction {
|
|
9240
9377
|
/**
|
|
9241
9378
|
* @description Optional validation flag, defaults to true.
|
|
9242
9379
|
* Determines whether form validation is required before saving and ensures that changes must be present in the form before saving.
|
|
@@ -9250,21 +9387,10 @@ interface QdPageSaveAction {
|
|
|
9250
9387
|
hasValidation?: boolean;
|
|
9251
9388
|
}
|
|
9252
9389
|
/**
|
|
9253
|
-
* @description Interface for the
|
|
9390
|
+
* @description Interface for the save draft action. Inherits the standard commit-action shape
|
|
9391
|
+
* (`label`, `handler`, `onSuccess`, `onError`) without further options.
|
|
9254
9392
|
*/
|
|
9255
|
-
interface QdPageSaveDraftAction {
|
|
9256
|
-
/**
|
|
9257
|
-
* @description Label for the save draft action, used for translation.
|
|
9258
|
-
*
|
|
9259
|
-
* * If no custom translation key is provided, a standard label will be used by default.
|
|
9260
|
-
*/
|
|
9261
|
-
label?: {
|
|
9262
|
-
i18n: string;
|
|
9263
|
-
};
|
|
9264
|
-
/**
|
|
9265
|
-
* @description Handler function that is triggered when the save draft action is executed.
|
|
9266
|
-
*/
|
|
9267
|
-
handler: () => void;
|
|
9393
|
+
interface QdPageSaveDraftAction extends QdPageCommitAction {
|
|
9268
9394
|
}
|
|
9269
9395
|
/**
|
|
9270
9396
|
* @description Interface for the cancel action, including an optional confirmation message.
|
|
@@ -9295,45 +9421,10 @@ interface QdPageCancelAction {
|
|
|
9295
9421
|
};
|
|
9296
9422
|
}
|
|
9297
9423
|
/**
|
|
9298
|
-
* @description Interface for the submit action on create pages.
|
|
9424
|
+
* @description Interface for the submit action on create pages. Inherits the standard commit-action
|
|
9425
|
+
* shape (`label`, `handler`, `onSuccess`, `onError`) without further options.
|
|
9299
9426
|
*/
|
|
9300
|
-
interface QdPageCreateSubmitAction {
|
|
9301
|
-
/**
|
|
9302
|
-
* @description Label for the submit action, used for translation.
|
|
9303
|
-
*
|
|
9304
|
-
* * If no custom translation key is provided, a standard label will be used by default.
|
|
9305
|
-
*/
|
|
9306
|
-
label?: {
|
|
9307
|
-
i18n: string;
|
|
9308
|
-
};
|
|
9309
|
-
/**
|
|
9310
|
-
* @description Handler function that is triggered when the submit action is executed.
|
|
9311
|
-
*/
|
|
9312
|
-
handler: (formValues?: any) => void;
|
|
9313
|
-
}
|
|
9314
|
-
/**
|
|
9315
|
-
* @description Interface for the submit action.
|
|
9316
|
-
*/
|
|
9317
|
-
interface QdPageSubmitAction {
|
|
9318
|
-
/**
|
|
9319
|
-
* @description Label for the submit action, used for translation.
|
|
9320
|
-
*
|
|
9321
|
-
* * If no custom translation key is provided, a standard label will be used by default.
|
|
9322
|
-
*/
|
|
9323
|
-
label?: {
|
|
9324
|
-
i18n: string;
|
|
9325
|
-
};
|
|
9326
|
-
/**
|
|
9327
|
-
* @description Handler function that is triggered when the submit action is executed.
|
|
9328
|
-
*/
|
|
9329
|
-
handler: (formValues?: any) => void;
|
|
9330
|
-
/**
|
|
9331
|
-
* @description By default, the visibility of the submit button depends on the page type and the operation mode.
|
|
9332
|
-
* To completely hide the submit button, you can set this isHidden flag.
|
|
9333
|
-
*
|
|
9334
|
-
* @default false
|
|
9335
|
-
*/
|
|
9336
|
-
isHidden?: boolean;
|
|
9427
|
+
interface QdPageCreateSubmitAction extends QdPageCommitAction {
|
|
9337
9428
|
}
|
|
9338
9429
|
/**
|
|
9339
9430
|
* @description Interface for the edit action.
|
|
@@ -9375,9 +9466,18 @@ interface QdPageArchiveAction {
|
|
|
9375
9466
|
handler: (formValues?: any) => void;
|
|
9376
9467
|
}
|
|
9377
9468
|
/**
|
|
9378
|
-
* @description Inspect-specific submit action configuration.
|
|
9469
|
+
* @description Inspect-specific submit action configuration. Submit on inspect pages is a process
|
|
9470
|
+
* action (status change, approval, workflow transition) and is only visible in **view** mode.
|
|
9379
9471
|
*/
|
|
9380
|
-
interface QdPageInspectSubmitAction extends
|
|
9472
|
+
interface QdPageInspectSubmitAction extends QdPageCommitAction {
|
|
9473
|
+
/**
|
|
9474
|
+
* @description By default, the visibility of the submit button depends on the operation mode
|
|
9475
|
+
* (visible in view mode, hidden in edit mode). Set this flag to hide the button entirely,
|
|
9476
|
+
* regardless of mode.
|
|
9477
|
+
*
|
|
9478
|
+
* @default false
|
|
9479
|
+
*/
|
|
9480
|
+
isHidden?: boolean;
|
|
9381
9481
|
/**
|
|
9382
9482
|
* @description Optional info message shown when submit is disabled on inspect pages for non-validation reasons.
|
|
9383
9483
|
*
|
|
@@ -11716,6 +11816,11 @@ interface QdPageObjectResolver<T extends object> {
|
|
|
11716
11816
|
resolve(): Observable<T>;
|
|
11717
11817
|
/**
|
|
11718
11818
|
* Updates the metadata of the page object model. Can be invoked with an action and accepts a partial metadata object.
|
|
11819
|
+
*
|
|
11820
|
+
* @deprecated Use `QdPageConfig.metadata$` instead. Declare an `Observable<Partial<T>>` (typically a `Subject`)
|
|
11821
|
+
* on the page config and emit partial updates through it — the page header subscribes to it and merges each
|
|
11822
|
+
* emission into the current object data. The `updateMetadata` method is kept for backward compatibility and
|
|
11823
|
+
* will be removed in a future major version.
|
|
11719
11824
|
*/
|
|
11720
11825
|
updateMetadata?(metadata: Partial<T>): void;
|
|
11721
11826
|
}
|
|
@@ -12806,6 +12911,22 @@ declare class QdSectionComponent implements OnInit, AfterViewInit, OnChanges, On
|
|
|
12806
12911
|
*
|
|
12807
12912
|
* Please check the relevant interfaces for each page type: `QdPageConfigOverview`, `QdPageConfigCreate`, `QdPageConfigInspect`, and `QdPageConfigCustom`.
|
|
12808
12913
|
*
|
|
12914
|
+
* #### **Commit Actions**
|
|
12915
|
+
*
|
|
12916
|
+
* Commit actions (`submit`, `save`, `saveDraft`) can either run synchronously (handler returns `void`) or wait on an async result (handler returns `Observable<boolean>`). The framework waits for the first emission, advances the saved-state baseline on `true`, and exposes race-free hooks for side effects so navigation after a successful commit does not trigger the unsaved-changes dialog.
|
|
12917
|
+
*
|
|
12918
|
+
* `onSuccess` runs when the handler emits `true` (after the baseline has advanced), `onError` runs when the handler observable errors — e.g. a failed HTTP request that is not caught inside the pipeline.
|
|
12919
|
+
*
|
|
12920
|
+
* ```ts
|
|
12921
|
+
* submit: {
|
|
12922
|
+
* handler: (formValues) => this.api.create(formValues).pipe(map(() => true)),
|
|
12923
|
+
* onSuccess: () => this.router.navigateByUrl('/'),
|
|
12924
|
+
* onError: (err) => this.notifications.add('', { type: 'critical', i18n: 'i18n.myApp.create.failed' })
|
|
12925
|
+
* }
|
|
12926
|
+
* ```
|
|
12927
|
+
*
|
|
12928
|
+
* The same mechanism applies to `save` and `saveDraft`. For the full contract (success vs. planned `false` vs. error, anti-patterns, `discardUnsavedChanges()`), see `QdPageCommitAction` and its action-specific extensions `QdPageSaveAction`, `QdPageSaveDraftAction`, `QdPageCreateSubmitAction`, and `QdPageInspectSubmitAction`.
|
|
12929
|
+
*
|
|
12809
12930
|
* #### **Validation/Parameterization**
|
|
12810
12931
|
*
|
|
12811
12932
|
* Validation and parameterization are covered in a dedicated chapter in the Storybook. Please check the "Validation" section for more information.
|
|
@@ -12875,7 +12996,15 @@ declare class QdSectionComponent implements OnInit, AfterViewInit, OnChanges, On
|
|
|
12875
12996
|
* handler: () => handleCancel()
|
|
12876
12997
|
* },
|
|
12877
12998
|
* save: {
|
|
12878
|
-
* handler: (
|
|
12999
|
+
* handler: () => saveApi.save(form.value).pipe(
|
|
13000
|
+
* tap(result => notifications.success('Saved')),
|
|
13001
|
+
* map(() => true),
|
|
13002
|
+
* catchError(err => {
|
|
13003
|
+
* notifications.showError(err);
|
|
13004
|
+
* return of(false);
|
|
13005
|
+
* })
|
|
13006
|
+
* ),
|
|
13007
|
+
* onSuccess: () => router.navigate(['/overview'])
|
|
12879
13008
|
* }
|
|
12880
13009
|
* }
|
|
12881
13010
|
* };
|
|
@@ -12884,19 +13013,42 @@ declare class QdSectionComponent implements OnInit, AfterViewInit, OnChanges, On
|
|
|
12884
13013
|
*
|
|
12885
13014
|
* #### **Updating Facets**
|
|
12886
13015
|
*
|
|
12887
|
-
* Typically, the values of the facets on a create or inspect page are set to read-only.
|
|
13016
|
+
* Typically, the values of the facets on a create or inspect page are set to read-only. If a facet value needs to change at runtime — for instance after a status update from a dialog — push the partial update through an observable on the page config. The header subscribes to `QdPageConfig.metadata$` and shallow-merges every emission into the current object data.
|
|
12888
13017
|
*
|
|
12889
13018
|
* **Please note: These values should not be modified directly within a QdPage.**
|
|
12890
13019
|
*
|
|
12891
13020
|
* ```ts
|
|
12892
|
-
* @
|
|
12893
|
-
*
|
|
12894
|
-
*
|
|
12895
|
-
*
|
|
13021
|
+
* @Component({
|
|
13022
|
+
* // ...
|
|
13023
|
+
* providers: [
|
|
13024
|
+
* {
|
|
13025
|
+
* provide: QD_PAGE_OBJECT_RESOLVER_TOKEN,
|
|
13026
|
+
* useClass: MyObjectModelResolver
|
|
13027
|
+
* }
|
|
13028
|
+
* ]
|
|
13029
|
+
* })
|
|
13030
|
+
* class MyPageComponent {
|
|
13031
|
+
* private metadataUpdates$ = new Subject<Partial<MyObjectModel>>();
|
|
13032
|
+
*
|
|
13033
|
+
* pageConfig: QdPageConfig<MyObjectModel> = {
|
|
13034
|
+
* title: { i18n: 'i18n.page.title' },
|
|
13035
|
+
* pageType: 'inspect',
|
|
13036
|
+
* headerFacets: [ /* ... *\/ ],
|
|
13037
|
+
* metadata$: this.metadataUpdates$,
|
|
13038
|
+
* pageTypeConfig: { /* ... *\/ }
|
|
13039
|
+
* };
|
|
13040
|
+
*
|
|
13041
|
+
* updateStatus() {
|
|
13042
|
+
* this.metadataUpdates$.next({ state: 'Updated' });
|
|
12896
13043
|
* }
|
|
13044
|
+
* }
|
|
13045
|
+
* ```
|
|
12897
13046
|
*
|
|
12898
|
-
*
|
|
13047
|
+
* Legacy approach (`@deprecated`): the resolver-level `updateMetadata` method is still wired up for backward compatibility, but prefer `metadata$` on the config for new code.
|
|
12899
13048
|
*
|
|
13049
|
+
* ```ts
|
|
13050
|
+
* @Injectable()
|
|
13051
|
+
* class MyObjectModelResolver implements QdPageObjectResolver<MyObjectModel> {
|
|
12900
13052
|
* resolve(): Observable<MyObjectModel> {
|
|
12901
13053
|
* // your implementation here
|
|
12902
13054
|
* }
|
|
@@ -12906,15 +13058,6 @@ declare class QdSectionComponent implements OnInit, AfterViewInit, OnChanges, On
|
|
|
12906
13058
|
* }
|
|
12907
13059
|
* }
|
|
12908
13060
|
*
|
|
12909
|
-
* @Component({
|
|
12910
|
-
* // ...
|
|
12911
|
-
* providers: [
|
|
12912
|
-
* {
|
|
12913
|
-
* provide: QD_PAGE_OBJECT_RESOLVER_TOKEN,
|
|
12914
|
-
* useClass: MyObjectModelResolver
|
|
12915
|
-
* }
|
|
12916
|
-
* ]
|
|
12917
|
-
* })
|
|
12918
13061
|
* class MyPageComponent {
|
|
12919
13062
|
* constructor(@Inject(QD_PAGE_OBJECT_RESOLVER_TOKEN) private objectResolver: MyObjectModelResolver) {}
|
|
12920
13063
|
*
|
|
@@ -12993,7 +13136,8 @@ declare class QdSectionComponent implements OnInit, AfterViewInit, OnChanges, On
|
|
|
12993
13136
|
* pageType: 'create',
|
|
12994
13137
|
* pageTypeConfig: {
|
|
12995
13138
|
* submit: {
|
|
12996
|
-
* handler: (formValues) =>
|
|
13139
|
+
* handler: (formValues) => createApi.create(formValues).pipe(map(() => true)),
|
|
13140
|
+
* onSuccess: () => router.navigate(['/items'])
|
|
12997
13141
|
* }
|
|
12998
13142
|
* }
|
|
12999
13143
|
* };
|
|
@@ -13086,7 +13230,14 @@ declare class QdSectionComponent implements OnInit, AfterViewInit, OnChanges, On
|
|
|
13086
13230
|
* handler: () => handleCancel()
|
|
13087
13231
|
* },
|
|
13088
13232
|
* save: {
|
|
13089
|
-
* handler: (formValues) =>
|
|
13233
|
+
* handler: (formValues) => saveApi.save(formValues).pipe(
|
|
13234
|
+
* map(() => true),
|
|
13235
|
+
* catchError(err => {
|
|
13236
|
+
* notifications.showError(err);
|
|
13237
|
+
* return of(false);
|
|
13238
|
+
* })
|
|
13239
|
+
* ),
|
|
13240
|
+
* onSuccess: () => router.navigate(['/overview'])
|
|
13090
13241
|
* }
|
|
13091
13242
|
* }
|
|
13092
13243
|
* };
|
|
@@ -13193,12 +13344,38 @@ declare class QdPageComponent<T extends object> implements OnInit, OnChanges, Af
|
|
|
13193
13344
|
ngOnChanges(changes: SimpleChanges): void;
|
|
13194
13345
|
ngAfterViewInit(): void;
|
|
13195
13346
|
ngOnDestroy(): void;
|
|
13347
|
+
/**
|
|
13348
|
+
* @description Resets all registered form groups to their last saved snapshot, marking the page
|
|
13349
|
+
* as no longer dirty.
|
|
13350
|
+
*
|
|
13351
|
+
* Intended for explicit consumer-driven discard scenarios where you want subsequent navigation
|
|
13352
|
+
* to bypass the unsaved-changes dialog — for example inside a commit action's `onError` hook
|
|
13353
|
+
* after an auth-expiry response, where the user must be redirected to the login page regardless
|
|
13354
|
+
* of unsaved edits.
|
|
13355
|
+
*
|
|
13356
|
+
* Prefer this over wiring custom bypass logic; it keeps the discard explicit and auditable in
|
|
13357
|
+
* application code.
|
|
13358
|
+
*
|
|
13359
|
+
* @example
|
|
13360
|
+
* ```ts
|
|
13361
|
+
* save: {
|
|
13362
|
+
* handler: (values) => api.save(values).pipe(map(() => true)),
|
|
13363
|
+
* onError: (err) => {
|
|
13364
|
+
* if (err.status === 401) {
|
|
13365
|
+
* this.pageComponent.discardUnsavedChanges();
|
|
13366
|
+
* this.router.navigateByUrl('/login');
|
|
13367
|
+
* }
|
|
13368
|
+
* }
|
|
13369
|
+
* }
|
|
13370
|
+
* ```
|
|
13371
|
+
*/
|
|
13372
|
+
discardUnsavedChanges(): void;
|
|
13196
13373
|
private checkConfigValidity;
|
|
13197
13374
|
private setupCreatePageFooterActions;
|
|
13198
13375
|
private handleCancelActionWithFormChanges;
|
|
13199
13376
|
private initSaveDraftFooterAction;
|
|
13200
13377
|
private updateInspectPageOperationMode;
|
|
13201
|
-
private
|
|
13378
|
+
private generateCommitActionHandler;
|
|
13202
13379
|
private setupCancelConfirmation;
|
|
13203
13380
|
private initSubmitValidation;
|
|
13204
13381
|
private setupPageDialogCloseContract;
|
|
@@ -13325,6 +13502,7 @@ declare class QdPageStoreService<T extends object> {
|
|
|
13325
13502
|
declare class QdPageObjectHeaderComponent<T extends object> implements OnInit, OnChanges, OnDestroy {
|
|
13326
13503
|
private pageObjectResolver;
|
|
13327
13504
|
private formGroupManagerService;
|
|
13505
|
+
private navigationInterceptor;
|
|
13328
13506
|
private dialogComponent;
|
|
13329
13507
|
private dialog;
|
|
13330
13508
|
private confirmationDialogService;
|
|
@@ -13341,6 +13519,7 @@ declare class QdPageObjectHeaderComponent<T extends object> implements OnInit, O
|
|
|
13341
13519
|
private _isLoadingSubject;
|
|
13342
13520
|
private _customActionsSubject;
|
|
13343
13521
|
private _customActionsSub?;
|
|
13522
|
+
private _metadataSub?;
|
|
13344
13523
|
private _destroyed$;
|
|
13345
13524
|
private _availableContexts;
|
|
13346
13525
|
pageObjectData$: Observable<T>;
|
|
@@ -13387,6 +13566,7 @@ declare class QdPageObjectHeaderComponent<T extends object> implements OnInit, O
|
|
|
13387
13566
|
private setupResolverTrigger;
|
|
13388
13567
|
private initContexts;
|
|
13389
13568
|
private updateCustomActions;
|
|
13569
|
+
private subscribeToMetadataStream;
|
|
13390
13570
|
private subscribeToViewOnlyMode;
|
|
13391
13571
|
private getCustomActionsByMode;
|
|
13392
13572
|
private openCancelDialog;
|