@quadrel-enterprise-ui/framework 20.10.0-beta.140.1 → 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.
|
@@ -11402,7 +11402,7 @@ class QdDatepickerComponent {
|
|
|
11402
11402
|
_onChange = () => { };
|
|
11403
11403
|
_onTouched = () => { };
|
|
11404
11404
|
ngOnInit() {
|
|
11405
|
-
this.language
|
|
11405
|
+
this.language = this.translateService?.currentLang ?? DEFAULT_LANGUAGE;
|
|
11406
11406
|
this.subscribeToLanguageChange();
|
|
11407
11407
|
this.subscribeToActionEmitterEvents();
|
|
11408
11408
|
this.initControl();
|
|
@@ -27075,7 +27075,12 @@ class QdPageCommitActionExecutor {
|
|
|
27075
27075
|
const applySuccess = () => {
|
|
27076
27076
|
formGroupManager.setFormGroupsSnapshot(captured);
|
|
27077
27077
|
navigationInterceptor.executeWithBypass(() => {
|
|
27078
|
-
|
|
27078
|
+
try {
|
|
27079
|
+
onAfterSnapshot?.();
|
|
27080
|
+
}
|
|
27081
|
+
catch (err) {
|
|
27082
|
+
console.error('QD-UI | QdPage - internal onAfterSnapshot hook threw after form was marked as saved.', err);
|
|
27083
|
+
}
|
|
27079
27084
|
try {
|
|
27080
27085
|
action.onSuccess?.();
|
|
27081
27086
|
}
|
|
@@ -27559,6 +27564,7 @@ class QdPageObjectHeaderComponent {
|
|
|
27559
27564
|
_isLoadingSubject = new BehaviorSubject(false);
|
|
27560
27565
|
_customActionsSubject = new BehaviorSubject({ actions: [] });
|
|
27561
27566
|
_customActionsSub;
|
|
27567
|
+
_metadataSub;
|
|
27562
27568
|
_destroyed$ = new Subject();
|
|
27563
27569
|
_availableContexts = 0;
|
|
27564
27570
|
pageObjectData$ = this._pageObjectDataSubject.asObservable();
|
|
@@ -27656,12 +27662,15 @@ class QdPageObjectHeaderComponent {
|
|
|
27656
27662
|
if (this.pageObjectResolver)
|
|
27657
27663
|
this.setupResolverTrigger();
|
|
27658
27664
|
this.updateCustomActions();
|
|
27665
|
+
this.subscribeToMetadataStream();
|
|
27659
27666
|
this.formGroupManagerService.takeFormGroupsSnapshot();
|
|
27660
27667
|
this.initContexts();
|
|
27661
27668
|
}
|
|
27662
27669
|
ngOnChanges(changes) {
|
|
27663
|
-
if (changes['config'] && !changes['config'].firstChange)
|
|
27670
|
+
if (changes['config'] && !changes['config'].firstChange) {
|
|
27664
27671
|
this.updateCustomActions();
|
|
27672
|
+
this.subscribeToMetadataStream();
|
|
27673
|
+
}
|
|
27665
27674
|
}
|
|
27666
27675
|
ngOnDestroy() {
|
|
27667
27676
|
this.pageStoreService.toggleViewonly(false);
|
|
@@ -27766,6 +27775,13 @@ class QdPageObjectHeaderComponent {
|
|
|
27766
27775
|
}
|
|
27767
27776
|
this.subscribeToViewOnlyMode();
|
|
27768
27777
|
}
|
|
27778
|
+
subscribeToMetadataStream() {
|
|
27779
|
+
this._metadataSub?.unsubscribe();
|
|
27780
|
+
const metadata$ = this.config.metadata$;
|
|
27781
|
+
if (!metadata$)
|
|
27782
|
+
return;
|
|
27783
|
+
this._metadataSub = metadata$.pipe(takeUntil(this._destroyed$)).subscribe(partial => this.updateMetadata(partial));
|
|
27784
|
+
}
|
|
27769
27785
|
subscribeToViewOnlyMode() {
|
|
27770
27786
|
this._customActionsSub?.unsubscribe();
|
|
27771
27787
|
this._customActionsSub = this.pageStoreService.isViewonly$
|
|
@@ -28988,19 +29004,42 @@ const SAFE_BOTTOM_OFFSET_PX = 64;
|
|
|
28988
29004
|
*
|
|
28989
29005
|
* #### **Updating Facets**
|
|
28990
29006
|
*
|
|
28991
|
-
* Typically, the values of the facets on a create or inspect page are set to read-only.
|
|
29007
|
+
* 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.
|
|
28992
29008
|
*
|
|
28993
29009
|
* **Please note: These values should not be modified directly within a QdPage.**
|
|
28994
29010
|
*
|
|
28995
29011
|
* ```ts
|
|
28996
|
-
* @
|
|
28997
|
-
*
|
|
28998
|
-
*
|
|
28999
|
-
*
|
|
29012
|
+
* @Component({
|
|
29013
|
+
* // ...
|
|
29014
|
+
* providers: [
|
|
29015
|
+
* {
|
|
29016
|
+
* provide: QD_PAGE_OBJECT_RESOLVER_TOKEN,
|
|
29017
|
+
* useClass: MyObjectModelResolver
|
|
29018
|
+
* }
|
|
29019
|
+
* ]
|
|
29020
|
+
* })
|
|
29021
|
+
* class MyPageComponent {
|
|
29022
|
+
* private metadataUpdates$ = new Subject<Partial<MyObjectModel>>();
|
|
29023
|
+
*
|
|
29024
|
+
* pageConfig: QdPageConfig<MyObjectModel> = {
|
|
29025
|
+
* title: { i18n: 'i18n.page.title' },
|
|
29026
|
+
* pageType: 'inspect',
|
|
29027
|
+
* headerFacets: [ /* ... *\/ ],
|
|
29028
|
+
* metadata$: this.metadataUpdates$,
|
|
29029
|
+
* pageTypeConfig: { /* ... *\/ }
|
|
29030
|
+
* };
|
|
29031
|
+
*
|
|
29032
|
+
* updateStatus() {
|
|
29033
|
+
* this.metadataUpdates$.next({ state: 'Updated' });
|
|
29000
29034
|
* }
|
|
29035
|
+
* }
|
|
29036
|
+
* ```
|
|
29001
29037
|
*
|
|
29002
|
-
*
|
|
29038
|
+
* Legacy approach (`@deprecated`): the resolver-level `updateMetadata` method is still wired up for backward compatibility, but prefer `metadata$` on the config for new code.
|
|
29003
29039
|
*
|
|
29040
|
+
* ```ts
|
|
29041
|
+
* @Injectable()
|
|
29042
|
+
* class MyObjectModelResolver implements QdPageObjectResolver<MyObjectModel> {
|
|
29004
29043
|
* resolve(): Observable<MyObjectModel> {
|
|
29005
29044
|
* // your implementation here
|
|
29006
29045
|
* }
|
|
@@ -29010,15 +29049,6 @@ const SAFE_BOTTOM_OFFSET_PX = 64;
|
|
|
29010
29049
|
* }
|
|
29011
29050
|
* }
|
|
29012
29051
|
*
|
|
29013
|
-
* @Component({
|
|
29014
|
-
* // ...
|
|
29015
|
-
* providers: [
|
|
29016
|
-
* {
|
|
29017
|
-
* provide: QD_PAGE_OBJECT_RESOLVER_TOKEN,
|
|
29018
|
-
* useClass: MyObjectModelResolver
|
|
29019
|
-
* }
|
|
29020
|
-
* ]
|
|
29021
|
-
* })
|
|
29022
29052
|
* class MyPageComponent {
|
|
29023
29053
|
* constructor(@Inject(QD_PAGE_OBJECT_RESOLVER_TOKEN) private objectResolver: MyObjectModelResolver) {}
|
|
29024
29054
|
*
|