@uxland/primary-shell 7.38.0 → 7.38.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/dist/{component-BnGIF_Io.js → component-CWibLJ86.js} +2 -2
- package/dist/{component-BnGIF_Io.js.map → component-CWibLJ86.js.map} +1 -1
- package/dist/{index-CqHIFgjZ.js → index-kl9Zgtus.js} +24 -6
- package/dist/{index-CqHIFgjZ.js.map → index-kl9Zgtus.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +2 -2
- package/dist/index.umd.cjs.map +1 -1
- package/dist/primary/shell/src/UI/shared-components/primaria-region/primaria-region.d.ts +7 -0
- package/package.json +1 -1
- package/src/UI/shared-components/primaria-region/primaria-region.ts +17 -4
- package/src/api/region-manager/region-manager.ts +24 -1
|
@@ -26,6 +26,13 @@ export declare class PrimariaRegion extends PrimariaRegion_base {
|
|
|
26
26
|
* and to generate the container ID.
|
|
27
27
|
*/
|
|
28
28
|
name: string;
|
|
29
|
+
/**
|
|
30
|
+
* Rendering mode for the region.
|
|
31
|
+
* - "multi" (default): all registered views are shown simultaneously (MultipleActiveAdapter).
|
|
32
|
+
* - "single": only one view is shown at a time (SelectableAdapter via primaria-content-switcher).
|
|
33
|
+
* Each plugin activates its own view; the adapter deactivates the rest automatically.
|
|
34
|
+
*/
|
|
35
|
+
mode: "multi" | "single";
|
|
29
36
|
/**
|
|
30
37
|
* Render in light DOM instead of shadow DOM.
|
|
31
38
|
* This allows the region content to be visible in the parent's DOM tree.
|
package/package.json
CHANGED
|
@@ -31,7 +31,14 @@ export class PrimariaRegion extends PrimariaRegionHost(LitElement) {
|
|
|
31
31
|
*/
|
|
32
32
|
@property({ type: String })
|
|
33
33
|
name = "";
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Rendering mode for the region.
|
|
36
|
+
* - "multi" (default): all registered views are shown simultaneously (MultipleActiveAdapter).
|
|
37
|
+
* - "single": only one view is shown at a time (SelectableAdapter via primaria-content-switcher).
|
|
38
|
+
* Each plugin activates its own view; the adapter deactivates the rest automatically.
|
|
39
|
+
*/
|
|
40
|
+
@property({ type: String })
|
|
41
|
+
mode: "multi" | "single" = "multi";
|
|
35
42
|
/**
|
|
36
43
|
* Render in light DOM instead of shadow DOM.
|
|
37
44
|
* This allows the region content to be visible in the parent's DOM tree.
|
|
@@ -88,10 +95,16 @@ export class PrimariaRegion extends PrimariaRegionHost(LitElement) {
|
|
|
88
95
|
if (this.name) {
|
|
89
96
|
const targetId = `${this.name}-container`;
|
|
90
97
|
|
|
91
|
-
// Create the container
|
|
92
|
-
|
|
98
|
+
// Create the container element based on mode.
|
|
99
|
+
// "single" uses primaria-content-switcher so the region mixin picks up
|
|
100
|
+
// selectableAdapterFactory (already registered in UI bootstrapper), giving
|
|
101
|
+
// SingleActiveAdapter behaviour: activating one view auto-deactivates the rest.
|
|
102
|
+
const container =
|
|
103
|
+
this.mode === "single" ? document.createElement("primaria-content-switcher") : document.createElement("div");
|
|
93
104
|
container.id = targetId;
|
|
94
|
-
|
|
105
|
+
if (this.mode !== "single") {
|
|
106
|
+
(container as HTMLElement).style.cssText = "width: 100%; height: 100%; min-height: 1px";
|
|
107
|
+
}
|
|
95
108
|
this.appendChild(container);
|
|
96
109
|
|
|
97
110
|
// Set the region metadata directly on the instance constructor
|
|
@@ -39,7 +39,10 @@ class RegionManagerProxy implements PrimariaRegionManager {
|
|
|
39
39
|
* @return {Promise<void>} A promise that resolves when the view is successfully registered.
|
|
40
40
|
*/
|
|
41
41
|
registerView(regionName: string, view: HarmonixViewDefinition): Promise<void> {
|
|
42
|
-
|
|
42
|
+
const key = `${this.pluginInfo.pluginId}::${view.id}`;
|
|
43
|
+
|
|
44
|
+
this.regionManager.registerViewWithRegion(regionName, key, view);
|
|
45
|
+
this.activateIfDefault(regionName, key, view);
|
|
43
46
|
return Promise.resolve();
|
|
44
47
|
}
|
|
45
48
|
/**
|
|
@@ -131,6 +134,26 @@ class RegionManagerProxy implements PrimariaRegionManager {
|
|
|
131
134
|
return mainView?.id;
|
|
132
135
|
}
|
|
133
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Activates a view if it is marked as default and the region currently has no active views.
|
|
139
|
+
*
|
|
140
|
+
* @param {string} regionName - The name of the region to activate the view in.
|
|
141
|
+
* @param {string} key - The key of the view to activate.
|
|
142
|
+
* @param {HarmonixViewDefinition} view - The view to activate.
|
|
143
|
+
* @return {void}
|
|
144
|
+
*/
|
|
145
|
+
activateIfDefault(regionName: string, key: string, view: HarmonixViewDefinition) {
|
|
146
|
+
if (!(view as any).isDefault) return;
|
|
147
|
+
|
|
148
|
+
const region = this.regionManager.getRegion(regionName);
|
|
149
|
+
if (!region || typeof (region as any).activate !== "function") return;
|
|
150
|
+
|
|
151
|
+
const hasActiveView = region.currentActiveViews?.length > 0;
|
|
152
|
+
if (!hasActiveView) {
|
|
153
|
+
(region as any).activate(key);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
134
157
|
_notifyMainViewChanged(viewId: string) {
|
|
135
158
|
this.broker.publish(BROKER_EVENTS.shell.mainViewChanged, { viewId });
|
|
136
159
|
}
|