@huaqiu/dsh-hardware-ui 0.7.21 → 0.7.22
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/lib/client.js +2 -3
- package/lib/client.js.map +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +14 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaqiu/dsh-hardware-ui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Hardware Engineering product UI for DSH: five-destination engineering navigation, right-panel artifact viewer, CAD installation settings and contextual native-application actions.",
|
|
6
6
|
"license": "MIT",
|
package/src/client/index.ts
CHANGED
|
@@ -51,12 +51,16 @@ export const HARDWARE_CONFIG_ENTRY = 'hardware-artifacts'
|
|
|
51
51
|
declare global {
|
|
52
52
|
interface Window {
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Desktop's preload surface, reached through `contextBridge` (PO-02).
|
|
55
55
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
56
|
+
* Only the member this plugin needs is declared: Desktop windows run with
|
|
57
|
+
* `contextIsolation: true`, so the plugin cannot publish a callback by
|
|
58
|
+
* assigning a window global — it must hand the callback to preload, which
|
|
59
|
+
* the caption menu then runs.
|
|
58
60
|
*/
|
|
59
|
-
|
|
61
|
+
dshDesktop?: {
|
|
62
|
+
registerPlaceOrder?: (handler: () => boolean) => () => void
|
|
63
|
+
}
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
|
|
@@ -293,14 +297,14 @@ export function apply(ctx: ClientContext): void {
|
|
|
293
297
|
}) ?? (() => {}), 'hardware-ui: place order tab type')
|
|
294
298
|
|
|
295
299
|
// The desktop shell's Place Order menu (PO-02) needs one thing from this
|
|
296
|
-
// plugin: a way to ask for the workflow.
|
|
297
|
-
//
|
|
298
|
-
// menu never reaches into business logic
|
|
300
|
+
// plugin: a way to ask for the workflow. Desktop preload owns the registry
|
|
301
|
+
// (`dshDesktop.registerPlaceOrder`) and the caption entry runs whatever is
|
|
302
|
+
// registered, so the menu never reaches into business logic. Leaving the
|
|
303
|
+
// registration behind when the plugin unloads keeps "not loaded" honest.
|
|
299
304
|
if (typeof window !== 'undefined') {
|
|
300
305
|
effect(() => {
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
return () => { if (window.huaqiu === handle) delete window.huaqiu }
|
|
306
|
+
const unregister = window.dshDesktop?.registerPlaceOrder?.(() => controller.placeOrder())
|
|
307
|
+
return () => { unregister?.() }
|
|
304
308
|
}, 'hardware-ui: place order handle')
|
|
305
309
|
}
|
|
306
310
|
|