@adminide-stack/extension-api 8.5.4-alpha.0 → 9.0.6-alpha.0

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.
@@ -0,0 +1 @@
1
+ export * from './view-component';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface IViewComponent {
3
+ viewId: string;
4
+ visible: boolean;
5
+ elementProps?: any;
6
+ }
7
+ export declare const ViewComponent: (props: IViewComponent) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,27 @@
1
+ import React__default,{useState,useEffect}from'react';import {Subscription}from'rxjs';import {map}from'rxjs/operators/index.js';import {useExtensionController}from'../../useExtensionController.js';import {ContributableViewContainer}from'../../../interfaces/contributions/contribution.js';const ViewComponent = (props) => {
2
+ const [panelView, setPanelView] = useState(null);
3
+ const controller = useExtensionController();
4
+ const subscriptions = new Subscription();
5
+ useEffect(() => {
6
+ subscriptions.add(controller?.services.panelView
7
+ .getPanelViews(ContributableViewContainer.Panel)
8
+ .pipe(map((views) => ({ views })))
9
+ .subscribe((stateUpdate) => {
10
+ const view = stateUpdate.views.find((v) => v.id === props.viewId);
11
+ setPanelView(view);
12
+ }));
13
+ return () => {
14
+ subscriptions.unsubscribe();
15
+ };
16
+ }, [controller?.services, props.viewId]);
17
+ if (!(props.viewId && props.visible && panelView)) {
18
+ return null;
19
+ }
20
+ const { reactElement, id } = panelView;
21
+ return (React__default.createElement("div", { id: id }, reactElement
22
+ ? {
23
+ ...reactElement,
24
+ props: { ...reactElement.props, ...props.elementProps },
25
+ }
26
+ : null));
27
+ };export{ViewComponent};
@@ -0,0 +1 @@
1
+ export * from './ViewComponent';
@@ -0,0 +1,2 @@
1
+ export * from './useExtensionController';
2
+ export * from './components';
@@ -0,0 +1 @@
1
+ export{useExtensionController}from'./useExtensionController.js';export{ViewComponent}from'./components/view-component/ViewComponent.js';
@@ -0,0 +1,2 @@
1
+ import { IController } from '../interfaces/controller';
2
+ export declare function useExtensionController(): IController;
@@ -0,0 +1,11 @@
1
+ import*as React from'react';import {InversifyContext,useInjection}from'@common-stack/client-react';import {IClientContainerService}from'../interfaces/generated-models.js';const isBrowser = typeof document !== 'undefined';
2
+ function useExtensionController() {
3
+ const { container } = React.useContext(InversifyContext);
4
+ const extensionController = container.isBound(IClientContainerService.ExtensionController)
5
+ ? useInjection(IClientContainerService.ExtensionController)
6
+ : null;
7
+ if (!isBrowser) {
8
+ return null;
9
+ }
10
+ return extensionController;
11
+ }export{useExtensionController};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminide-stack/extension-api",
3
- "version": "8.5.4-alpha.0",
3
+ "version": "9.0.6-alpha.0",
4
4
  "description": "Workbench core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -37,11 +37,11 @@
37
37
  }
38
38
  },
39
39
  "dependencies": {
40
- "@adminide-stack/core": "8.5.4-alpha.0",
40
+ "@adminide-stack/core": "9.0.1-alpha.0",
41
41
  "@workbench-stack/core": "3.6.0",
42
42
  "abort-controller": "^2.0.0",
43
43
  "abortable-rx": "^1.0.9",
44
- "cdeops": "8.5.4-alpha.0",
44
+ "cdeops": "9.0.1-alpha.0",
45
45
  "minimatch": "^9.0.0",
46
46
  "queueing-subject": "0.3.4",
47
47
  "utility-types": "^3.10.0",
@@ -60,5 +60,5 @@
60
60
  "typescript": {
61
61
  "definition": "lib/index.d.ts"
62
62
  },
63
- "gitHead": "122637db4ab9cef8e0226a7a8e91352aaff75744"
63
+ "gitHead": "5d4c700cde18365e0981cbf0970ec3318b6b5174"
64
64
  }