PluginAPI
expose / use / debug — 另见 Export & expose APIs。
- Methods: expose(plugin, name, value), use(plugin, name), debug()
- Expose real implementations in register(); consumers call use() or published wrappers
TSXprovider — expose in register()
1import { PluginAPI } from "@quan-erp/shared-frontend-core";
2import type { AppRegistryState, PluginModule } from "@quan-erp/shared-types";
3import metadata from "../module.metadata.json" with { type: "json" };
4import { ProductDropdown } from "./page/product/product-dropdown";
5
6const Plugin: PluginModule = {
7 register(_AppRegistry: AppRegistryState) {
8 PluginAPI.expose(
9 metadata.name,
10 "product-dropdown",
11 ProductDropdown, // real implementation — not a PluginAPI.use wrapper
12 );
13 },
14};
15
16export default Plugin;TSXconsumer — use / debug
1import { PluginAPI } from "@quan-erp/shared-frontend-core";
2
3const ProductDropdown = PluginAPI.use("products", "product-dropdown");
4
5export function OrderForm() {
6 return <ProductDropdown value={null} setValue={() => {}} />;
7}
8
9// Optional: inspect registry while developing
10PluginAPI.debug();