@uxland/primary-shell 3.4.0 → 3.5.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.
- package/dist/index.js +11579 -13387
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +795 -1064
- package/dist/index.umd.cjs.map +1 -1
- package/dist/primary/shell/src/UI/components/primaria-error-view/component.d.ts +9 -0
- package/dist/primary/shell/src/UI/components/primaria-error-view/template.d.ts +3 -0
- package/dist/primary/shell/src/UI/components/primaria-shell/constants.d.ts +4 -0
- package/dist/primary/shell/src/UI/components/primaria-shell/primaria-shell.d.ts +10 -0
- package/dist/primary/shell/src/UI/{shared-components/primaria-menu/primaria-menu.d.ts → components/quick-actions-menu/quick-actions-menu.d.ts} +1 -1
- package/dist/primary/shell/src/UI/components/quick-actions-menu/template.d.ts +3 -0
- package/dist/primary/shell/src/UI/shared-components/primaria-nav-item/template.d.ts +3 -0
- package/dist/primary/shell/src/UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu.d.ts +13 -0
- package/dist/primary/shell/src/UI/shared-components/primaria-nav-tree-menu/template.d.ts +3 -0
- package/dist/primary/shell/src/UI/shared-components/typings.d.ts +16 -0
- package/dist/primary/shell/src/api/broker/primaria-broker.d.ts +1 -0
- package/dist/primary/shell/src/api/region-manager/region-manager.d.ts +3 -2
- package/dist/primary/shell/src/bootstrapper.d.ts +2 -0
- package/dist/primary/shell/src/constants.d.ts +1 -0
- package/dist/primary/shell/src/disposer.d.ts +2 -0
- package/dist/primary/shell/src/events.d.ts +2 -0
- package/dist/primary/shell/src/features/bootstrapper.d.ts +1 -1
- package/dist/primary/shell/src/features/utils.d.ts +3 -2
- package/dist/primary/shell/src/{plugin.d.ts → handle-plugins.d.ts} +2 -1
- package/dist/primary/shell/src/handle-views.d.ts +2 -0
- package/dist/primary/shell/src/index.d.ts +5 -3
- package/dist/primary/shell/src/{UI/shared-components/dss-container/dss-container.d.ts → internal-plugins/activity-history/components/activity-history/activity-history-search-header/activity-history-search-header.d.ts} +2 -2
- package/dist/primary/shell/src/internal-plugins/activity-history/components/activity-history/activity-history-search-header/template.d.ts +3 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/components/activity-history/activity-history-timeline/activity-history-timeline.d.ts +6 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/components/activity-history/activity-history.d.ts +4 -3
- package/dist/primary/shell/src/internal-plugins/activity-history/constants.d.ts +3 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/domain/is-valid-history-item/is-valid-history-item.d.ts +1 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/features/search-items/handler.d.ts +3 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/localization.d.ts +2 -0
- package/dist/primary/shell/src/locales.d.ts +14 -3
- package/dist/style.css +1 -1
- package/package.json +2 -3
- package/src/UI/components/index.ts +1 -0
- package/src/UI/components/primaria-error-view/component.ts +18 -0
- package/src/UI/components/primaria-error-view/styles.css +27 -0
- package/src/UI/components/primaria-error-view/template.ts +12 -0
- package/src/UI/components/primaria-shell/constants.ts +4 -0
- package/src/UI/components/primaria-shell/primaria-shell.ts +38 -1
- package/src/UI/components/primaria-shell/styles.css +24 -54
- package/src/UI/components/primaria-shell/template.ts +43 -50
- package/src/UI/{shared-components/primaria-menu/primaria-menu.ts → components/quick-actions-menu/quick-actions-menu.ts} +3 -3
- package/src/UI/components/quick-actions-menu/template.ts +10 -0
- package/src/UI/images/not-found.svg +9 -0
- package/src/UI/shared-components/index.ts +1 -3
- package/src/UI/shared-components/primaria-nav-item/primaria-nav-item.ts +54 -0
- package/src/UI/shared-components/{primaria-menu-item → primaria-nav-item}/styles.css +4 -0
- package/src/UI/shared-components/primaria-nav-item/template.ts +27 -0
- package/src/UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu.ts +41 -0
- package/src/UI/shared-components/primaria-nav-tree-menu/styles.css +11 -0
- package/src/UI/shared-components/primaria-nav-tree-menu/template.ts +30 -0
- package/src/UI/shared-components/typings.ts +17 -0
- package/src/api/api.ts +1 -1
- package/src/api/broker/factory.ts +29 -12
- package/src/api/broker/primaria-broker.ts +2 -0
- package/src/api/ecap-event-manager/ecap-event-manager.ts +1 -1
- package/src/api/region-manager/region-manager.ts +12 -2
- package/src/api/token-manager/token-manager.test.ts +1 -1
- package/src/bootstrapper.ts +16 -0
- package/src/constants.ts +1 -0
- package/src/disposer.ts +10 -0
- package/src/events.ts +2 -0
- package/src/features/bootstrapper.ts +4 -1
- package/src/features/get-user-info/bootstrapper.ts +6 -3
- package/src/features/utils.ts +7 -5
- package/src/{plugin.ts → handle-plugins.ts} +8 -3
- package/src/handle-views.ts +284 -0
- package/src/index.ts +5 -3
- package/src/internal-plugins/activity-history/components/activity-history/activity-history-search-header/activity-history-search-header.ts +20 -0
- package/src/internal-plugins/activity-history/components/activity-history/activity-history-search-header/styles.css +14 -0
- package/src/internal-plugins/activity-history/components/activity-history/activity-history-search-header/template.ts +8 -0
- package/src/internal-plugins/activity-history/components/activity-history/activity-history-timeline/activity-history-timeline.ts +27 -1
- package/src/internal-plugins/activity-history/components/activity-history/activity-history-timeline/styles.css +21 -2
- package/src/internal-plugins/activity-history/components/activity-history/activity-history-timeline/template.ts +38 -19
- package/src/internal-plugins/activity-history/components/activity-history/activity-history.ts +17 -26
- package/src/internal-plugins/activity-history/components/activity-history/styles.css +2 -24
- package/src/internal-plugins/activity-history/components/activity-history/template.ts +37 -69
- package/src/internal-plugins/activity-history/constants.ts +3 -0
- package/src/internal-plugins/activity-history/domain/filter-by-search-string/filter-by-search-string.ts +6 -1
- package/src/internal-plugins/activity-history/domain/is-valid-history-item/is-valid-history-item.ts +19 -5
- package/src/internal-plugins/activity-history/features/add-history-item/bootstrapper.ts +5 -2
- package/src/internal-plugins/activity-history/features/add-history-items/bootstrapper.ts +5 -2
- package/src/internal-plugins/activity-history/features/export-to-pdf/bootstrapper.ts +5 -2
- package/src/internal-plugins/activity-history/features/inject-async-history-items/bootstrapper.ts +5 -2
- package/src/internal-plugins/activity-history/features/inject-async-history-items/handler.ts +3 -3
- package/src/internal-plugins/activity-history/features/search-items/bootstrapper.ts +5 -2
- package/src/internal-plugins/activity-history/features/search-items/handler.ts +9 -1
- package/src/internal-plugins/activity-history/features/update-history-item/bootstrapper.ts +5 -2
- package/src/internal-plugins/activity-history/localization.ts +2 -0
- package/src/locales.ts +25 -5
- package/dist/primary/shell/src/UI/shared-components/primaria-menu/template.d.ts +0 -3
- package/dist/primary/shell/src/UI/shared-components/primaria-menu-item/primaria-menu-item.d.ts +0 -15
- package/dist/primary/shell/src/UI/shared-components/primaria-menu-item/template.d.ts +0 -3
- package/dist/primary/shell/src/UI/shared-components/primaria-nav-menu/primaria-nav-menu.d.ts +0 -26
- package/dist/primary/shell/src/UI/shared-components/primaria-nav-menu/template.d.ts +0 -3
- package/dist/primary/shell/src/UI/shared-components/primaria-wrapper-menu/primaria-wrapper-menu.d.ts +0 -19
- package/dist/primary/shell/src/UI/shared-components/primaria-wrapper-menu/template.d.ts +0 -3
- package/dist/primary/shell/src/initializer.d.ts +0 -1
- package/src/UI/shared-components/dss-container/dss-container.ts +0 -32
- package/src/UI/shared-components/dss-container/styles.css +0 -23
- package/src/UI/shared-components/primaria-menu/template.ts +0 -9
- package/src/UI/shared-components/primaria-menu-item/primaria-menu-item.ts +0 -51
- package/src/UI/shared-components/primaria-menu-item/template.ts +0 -11
- package/src/UI/shared-components/primaria-nav-menu/primaria-nav-menu.ts +0 -66
- package/src/UI/shared-components/primaria-nav-menu/styles.css +0 -26
- package/src/UI/shared-components/primaria-nav-menu/template.ts +0 -30
- package/src/UI/shared-components/primaria-wrapper-menu/primaria-wrapper-menu.ts +0 -41
- package/src/UI/shared-components/primaria-wrapper-menu/styles.css +0 -5
- package/src/UI/shared-components/primaria-wrapper-menu/template.ts +0 -28
- package/src/initializer.ts +0 -327
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IEvent, IEventClass, IRequest, IRequestClass } from "@uxland/harmonix";
|
|
2
2
|
import { Mediator, mediatorSettings, notificationHandler, requestHandler } from "mediatr-ts";
|
|
3
|
-
import { PrimariaBroker } from "./primaria-broker";
|
|
3
|
+
import { type PrimariaBroker, type BrokerDisposableHandler } from "./primaria-broker";
|
|
4
4
|
|
|
5
5
|
type messageHandler = (payload: unknown) => unknown | Promise<unknown>;
|
|
6
6
|
|
|
7
|
+
const disposableFactory = (handler: any) => {
|
|
8
|
+
return {
|
|
9
|
+
dispose: () => {
|
|
10
|
+
mediatorSettings.resolver.remove(handler.name);
|
|
11
|
+
const mappingIndex = mediatorSettings.dispatcher.notifications._mappings.findIndex(
|
|
12
|
+
(mapping) => mapping.handler.name === handler.name,
|
|
13
|
+
);
|
|
14
|
+
mappingIndex > -1 &&
|
|
15
|
+
mediatorSettings.dispatcher.notifications._mappings.splice(mappingIndex, 1);
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
};
|
|
7
19
|
class Broker implements PrimariaBroker {
|
|
8
20
|
private mediator: Mediator;
|
|
9
21
|
constructor() {
|
|
@@ -41,29 +53,34 @@ class Broker implements PrimariaBroker {
|
|
|
41
53
|
subscribe<TEvent extends IEvent>(
|
|
42
54
|
event: TEvent,
|
|
43
55
|
handler: (message: TEvent) => void,
|
|
44
|
-
):
|
|
45
|
-
subscribe<TPayload>(
|
|
46
|
-
|
|
56
|
+
): BrokerDisposableHandler;
|
|
57
|
+
subscribe<TPayload>(
|
|
58
|
+
eventName: string,
|
|
59
|
+
handler: (message: TPayload) => void,
|
|
60
|
+
): BrokerDisposableHandler;
|
|
61
|
+
subscribe(event: string | IEventClass, handler: messageHandler): BrokerDisposableHandler {
|
|
47
62
|
const eventType = typeof event === "function" ? event : this.getEventType(event as string);
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
const wrappedHandler = createDynamicEventHandler(handler);
|
|
64
|
+
notificationHandler(eventType)(wrappedHandler);
|
|
65
|
+
return disposableFactory(wrappedHandler);
|
|
50
66
|
}
|
|
51
67
|
registerRequest<TRequest extends IRequest<TResponse>, TResponse>(
|
|
52
68
|
request: TRequest,
|
|
53
69
|
handler: (message: TRequest) => TResponse,
|
|
54
|
-
):
|
|
70
|
+
): BrokerDisposableHandler;
|
|
55
71
|
registerRequest<TPayload, TResponse>(
|
|
56
72
|
requestName: string,
|
|
57
73
|
handler: (message: TPayload) => TResponse,
|
|
58
|
-
):
|
|
74
|
+
): BrokerDisposableHandler;
|
|
59
75
|
registerRequest(
|
|
60
76
|
request: string | IRequestClass<unknown>,
|
|
61
77
|
handler: messageHandler,
|
|
62
|
-
):
|
|
78
|
+
): BrokerDisposableHandler {
|
|
63
79
|
const requestType =
|
|
64
80
|
typeof request === "function" ? request : this.getRequestType(request as string);
|
|
65
|
-
|
|
66
|
-
|
|
81
|
+
const wrappedHandler = createDynamicRequestHandler(handler);
|
|
82
|
+
requestHandler(requestType)(wrappedHandler);
|
|
83
|
+
return disposableFactory(wrappedHandler);
|
|
67
84
|
}
|
|
68
85
|
|
|
69
86
|
private getEvent(eventName: string, payload: unknown): IEvent {
|
|
@@ -25,7 +25,7 @@ class EcapEventManagerImpl implements EcapEventManager {
|
|
|
25
25
|
}
|
|
26
26
|
private raiseEcapEvent(ecapEvent: IEcapEvent) {
|
|
27
27
|
if (window.parent) window.parent.postMessage(JSON.stringify(ecapEvent), "*");
|
|
28
|
-
console.log("
|
|
28
|
+
console.log("method", JSON.stringify(ecapEvent));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { HarmonixRegionManager, IRegionManager, HarmonixViewDefinition } from "@uxland/harmonix";
|
|
2
|
-
import { PluginInfo } from "../../
|
|
2
|
+
import { PluginInfo } from "../../handle-plugins";
|
|
3
3
|
import { IRegion } from "@uxland/regions";
|
|
4
4
|
import { shellRegions } from "./regions";
|
|
5
|
+
import { PrimariaBroker } from "../broker/primaria-broker";
|
|
6
|
+
import { shellEvents } from "../../events";
|
|
5
7
|
|
|
6
8
|
export interface PrimariaRegionManager extends HarmonixRegionManager {
|
|
7
9
|
registerQuickAction(view: HarmonixViewDefinition): Promise<void>;
|
|
@@ -15,6 +17,7 @@ class RegionManagerProxy implements PrimariaRegionManager {
|
|
|
15
17
|
constructor(
|
|
16
18
|
private pluginInfo: PluginInfo,
|
|
17
19
|
private regionManager: IRegionManager,
|
|
20
|
+
private broker: PrimariaBroker,
|
|
18
21
|
) {}
|
|
19
22
|
/**
|
|
20
23
|
* Register a view in a specific region.
|
|
@@ -51,6 +54,7 @@ class RegionManagerProxy implements PrimariaRegionManager {
|
|
|
51
54
|
*/
|
|
52
55
|
activateView(regionName: string, viewId: string): Promise<void> {
|
|
53
56
|
this.regionManager.getRegion(regionName).activate(`${this.pluginInfo.pluginId}::${viewId}`);
|
|
57
|
+
if (regionName === shellRegions.main) this._notifyMainViewChanged(viewId);
|
|
54
58
|
return Promise.resolve();
|
|
55
59
|
}
|
|
56
60
|
/**
|
|
@@ -123,6 +127,7 @@ class RegionManagerProxy implements PrimariaRegionManager {
|
|
|
123
127
|
this.regionManager
|
|
124
128
|
.getRegion(shellRegions.main)
|
|
125
129
|
.activate(`${this.pluginInfo.pluginId}::${viewId}`);
|
|
130
|
+
this._notifyMainViewChanged(viewId);
|
|
126
131
|
return Promise.resolve();
|
|
127
132
|
}
|
|
128
133
|
|
|
@@ -131,6 +136,10 @@ class RegionManagerProxy implements PrimariaRegionManager {
|
|
|
131
136
|
.currentActiveViews[0] as HarmonixViewDefinition;
|
|
132
137
|
return mainView?.id;
|
|
133
138
|
}
|
|
139
|
+
|
|
140
|
+
_notifyMainViewChanged(viewId: string) {
|
|
141
|
+
this.broker.publish(shellEvents.mainViewChanged, { viewId });
|
|
142
|
+
}
|
|
134
143
|
}
|
|
135
144
|
|
|
136
145
|
/**
|
|
@@ -143,4 +152,5 @@ class RegionManagerProxy implements PrimariaRegionManager {
|
|
|
143
152
|
export const createRegionManagerProxy = (
|
|
144
153
|
pluginInfo: PluginInfo,
|
|
145
154
|
regionManager: IRegionManager,
|
|
146
|
-
|
|
155
|
+
broker: PrimariaBroker,
|
|
156
|
+
): PrimariaRegionManager => new RegionManagerProxy(pluginInfo, regionManager, broker);
|
|
@@ -13,7 +13,7 @@ describe("Token Manager test", () => {
|
|
|
13
13
|
it("should return initial token", () => {
|
|
14
14
|
const tokenManager = createTokenManager();
|
|
15
15
|
expect(tokenManager.getToken()).toBe(access_token);
|
|
16
|
-
});
|
|
16
|
+
});
|
|
17
17
|
|
|
18
18
|
it("should refresh token", async () => {
|
|
19
19
|
const tokenManager = createTokenManager();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { selectableAdapterFactory as factory, regionAdapterRegistry } from "@uxland/regions";
|
|
2
|
+
import "./UI/components/primaria-error-view/component";
|
|
3
|
+
import { PrimariaShell } from "./UI/components/primaria-shell/primaria-shell";
|
|
4
|
+
import { shellApi } from "./api/api";
|
|
5
|
+
import { bootstrapFeatures } from "./features/bootstrapper";
|
|
6
|
+
import { registerInternalViews } from "./handle-views";
|
|
7
|
+
import { initializeLocalization } from "./locales";
|
|
8
|
+
|
|
9
|
+
export const bootstrapShell = (hostAppElement: HTMLElement) => {
|
|
10
|
+
initializeLocalization(shellApi);
|
|
11
|
+
regionAdapterRegistry.registerAdapterFactory("primaria-content-switcher", factory);
|
|
12
|
+
const shell = new PrimariaShell();
|
|
13
|
+
hostAppElement.appendChild(shell as any);
|
|
14
|
+
registerInternalViews();
|
|
15
|
+
bootstrapFeatures(shellApi);
|
|
16
|
+
};
|
package/src/constants.ts
CHANGED
package/src/disposer.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { shellApi } from "./api/api";
|
|
2
|
+
import { teardownFeatures } from "./features/bootstrapper";
|
|
3
|
+
export const disposeShell = () => {
|
|
4
|
+
shellApi.ecapEventManager.publish("CLOSE_REQUESTED_RECEIVED", "", {});
|
|
5
|
+
teardownFeatures();
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const raiseCloseEvent = () => {
|
|
9
|
+
shellApi.ecapEventManager.publish("CLOSE_FORM", "", {});
|
|
10
|
+
};
|
package/src/events.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { PrimariaApi } from "
|
|
1
|
+
import { PrimariaApi, shellApi } from "../api/api";
|
|
2
2
|
import { container } from "../infrastructure/ioc/container";
|
|
3
3
|
import { TYPES } from "../infrastructure/ioc/types";
|
|
4
4
|
import { bootstrapGetUserInfo, teardownGetUserInfo } from "./get-user-info/bootstrapper";
|
|
5
|
+
import { GetUserInfo } from "./get-user-info/request";
|
|
5
6
|
|
|
6
7
|
export const bootstrapFeatures = (api: PrimariaApi) => {
|
|
7
8
|
container.bind(TYPES.primaryApi).toConstantValue(api);
|
|
8
9
|
bootstrapGetUserInfo();
|
|
10
|
+
shellApi.broker.send(new GetUserInfo());
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
export const teardownFeatures = () => {
|
|
12
14
|
teardownGetUserInfo();
|
|
15
|
+
container.unbindAll();
|
|
13
16
|
};
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { shellApi } from "../../api/api";
|
|
2
|
+
import { BrokerDisposableHandler } from "../../api/broker/primaria-broker";
|
|
2
3
|
import { container, registerDep, unregisterDep } from "../../infrastructure/ioc/container";
|
|
3
|
-
import { registerRequest
|
|
4
|
+
import { registerRequest } from "../utils";
|
|
4
5
|
import { GetUserInfoBackendAdapter } from "./backend-adapter";
|
|
5
6
|
import { GetUserInfoHandler } from "./handler";
|
|
6
7
|
import { GetUserInfo } from "./request";
|
|
7
8
|
|
|
9
|
+
let request: BrokerDisposableHandler;
|
|
10
|
+
|
|
8
11
|
export const bootstrapGetUserInfo = () => {
|
|
9
12
|
teardownGetUserInfo();
|
|
10
|
-
registerRequest(shellApi, container)(GetUserInfo, GetUserInfoHandler);
|
|
13
|
+
request = registerRequest(shellApi, container)(GetUserInfo, GetUserInfoHandler);
|
|
11
14
|
registerDep(GetUserInfoBackendAdapter);
|
|
12
15
|
};
|
|
13
16
|
|
|
14
17
|
export const teardownGetUserInfo = () => {
|
|
15
|
-
|
|
18
|
+
request?.dispose();
|
|
16
19
|
unregisterDep(GetUserInfoBackendAdapter);
|
|
17
20
|
};
|
package/src/features/utils.ts
CHANGED
|
@@ -9,12 +9,14 @@ export const registerRequest =
|
|
|
9
9
|
(command: IRequestClass<any>, handler: Newable<any>) => {
|
|
10
10
|
container.bind(handler).to(handler).inTransientScope();
|
|
11
11
|
injectable()(handler);
|
|
12
|
-
api.broker.registerRequest(command, (cmd: IRequest<any>) => {
|
|
12
|
+
const disposable = api.broker.registerRequest(command, (cmd: IRequest<any>) => {
|
|
13
13
|
const handlerInstance = container.get(handler);
|
|
14
14
|
return handlerInstance.handle(cmd);
|
|
15
15
|
});
|
|
16
|
+
return {
|
|
17
|
+
dispose: () => {
|
|
18
|
+
container.isBound(handler) && container.unbind(handler);
|
|
19
|
+
disposable.dispose();
|
|
20
|
+
},
|
|
21
|
+
};
|
|
16
22
|
};
|
|
17
|
-
|
|
18
|
-
export const unregisterRequest = (container: Container) => (handler: Newable<any>) => {
|
|
19
|
-
container.isBound(handler) && container.unbind(handler);
|
|
20
|
-
};
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
initialize as activityHistoryInitialize,
|
|
6
6
|
dispose as activityHistoryDispose,
|
|
7
7
|
} from "./internal-plugins/activity-history/main";
|
|
8
|
-
import { PrimariaApi, primariaApiFactory } from "./api/api";
|
|
8
|
+
import { PrimariaApi, primariaApiFactory, shellApi } from "./api/api";
|
|
9
9
|
|
|
10
10
|
const internalPlugins: PluginDefinition[] = [
|
|
11
11
|
{
|
|
@@ -18,9 +18,14 @@ const internalPlugins: PluginDefinition[] = [
|
|
|
18
18
|
},
|
|
19
19
|
];
|
|
20
20
|
|
|
21
|
-
export const bootstrapPlugins = (plugins: PluginDefinition[]) => {
|
|
21
|
+
export const bootstrapPlugins = async (plugins: PluginDefinition[]) => {
|
|
22
22
|
const finalPlugins = internalPlugins.concat(plugins || []);
|
|
23
|
-
pluginBootstrapper(finalPlugins, primariaApiFactory);
|
|
23
|
+
const bootstrappedPlugins = await pluginBootstrapper(finalPlugins, primariaApiFactory);
|
|
24
|
+
return bootstrappedPlugins as Plugin[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const disposePlugins = async (plugins: Plugin[]) => {
|
|
28
|
+
return Promise.all(plugins.map((plugin) => plugin.dispose(shellApi)));
|
|
24
29
|
};
|
|
25
30
|
|
|
26
31
|
export type Plugin = PluginType<PrimariaApi>;
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { shellApi } from "./api/api";
|
|
2
|
+
import { shellRegions } from "./api/region-manager/regions";
|
|
3
|
+
import { clinicalMonitoringId, pocTestEventsId } from "./constants";
|
|
4
|
+
import { shellEvents } from "./events";
|
|
5
|
+
import { ClinicalMonitoring } from "./UI/components/clinical-monitoring/clinical-monitoring";
|
|
6
|
+
import { PocEventsEcap } from "./UI/components/poc-events-ecap/poc-events-ecap";
|
|
7
|
+
import { PrimariaNavItem } from "./UI/shared-components/primaria-nav-item/primaria-nav-item";
|
|
8
|
+
import { PrimariaNavTreeMenu } from "./UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu";
|
|
9
|
+
|
|
10
|
+
const registerUpperNavMenuViews = () => {
|
|
11
|
+
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
12
|
+
id: pocTestEventsId,
|
|
13
|
+
factory: () => {
|
|
14
|
+
const menuItem = new PrimariaNavItem({
|
|
15
|
+
icon: "bolt",
|
|
16
|
+
label: "Prova Events ECAP",
|
|
17
|
+
callbackFn: () => {
|
|
18
|
+
shellApi.regionManager.activateMainView(pocTestEventsId);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
return Promise.resolve(menuItem);
|
|
22
|
+
},
|
|
23
|
+
options: {
|
|
24
|
+
sortHint: "000100",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
28
|
+
id: "communication",
|
|
29
|
+
factory: () => {
|
|
30
|
+
const menuItem = new PrimariaNavTreeMenu({
|
|
31
|
+
icon: "add_box",
|
|
32
|
+
label: "Comunicació",
|
|
33
|
+
actionMenuItems: [
|
|
34
|
+
{
|
|
35
|
+
icon: "open_in_new",
|
|
36
|
+
label: "SMS",
|
|
37
|
+
callbackFn: () => {},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
icon: "open_in_new",
|
|
41
|
+
label: "Econsulta",
|
|
42
|
+
callbackFn: (): void => {},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
icon: "open_in_new",
|
|
46
|
+
label: "Mail",
|
|
47
|
+
callbackFn: (): void => {},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
icon: "open_in_new",
|
|
51
|
+
label: "Veu IP",
|
|
52
|
+
callbackFn: (): void => {},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
icon: "open_in_new",
|
|
56
|
+
label: "Videoconsulta",
|
|
57
|
+
callbackFn: (): void => {},
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
return Promise.resolve(menuItem);
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
65
|
+
id: "visits",
|
|
66
|
+
factory: () => {
|
|
67
|
+
const menuItem = new PrimariaNavItem({
|
|
68
|
+
icon: "add_box",
|
|
69
|
+
label: "Visites",
|
|
70
|
+
callbackFn: () => {
|
|
71
|
+
// shellApi.regionManager.activateView(shellRegions.main, "");
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
return Promise.resolve(menuItem);
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
78
|
+
id: "it",
|
|
79
|
+
factory: () => {
|
|
80
|
+
const menuItem = new PrimariaNavItem({
|
|
81
|
+
icon: "add_box",
|
|
82
|
+
label: "IT",
|
|
83
|
+
callbackFn: async (): Promise<void> => {
|
|
84
|
+
const CIP = (await shellApi.broker.send("get_patient_cip")) as string;
|
|
85
|
+
shellApi.ecapEventManager.publish("CRIDA_DOCS_USU", "NO_TANCAR", {
|
|
86
|
+
CIP: CIP || "",
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
return Promise.resolve(menuItem);
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
94
|
+
id: "unique-petition",
|
|
95
|
+
factory: () => {
|
|
96
|
+
const menuItem = new PrimariaNavTreeMenu({
|
|
97
|
+
icon: "add_box",
|
|
98
|
+
label: "Petitori únic",
|
|
99
|
+
actionMenuItems: [
|
|
100
|
+
{
|
|
101
|
+
icon: "open_in_new",
|
|
102
|
+
label: "Analítiques",
|
|
103
|
+
callbackFn: (): void => {},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
icon: "open_in_new",
|
|
107
|
+
label: "OC",
|
|
108
|
+
callbackFn: (): void => {},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
icon: "open_in_new",
|
|
112
|
+
label: "OC Exprés",
|
|
113
|
+
callbackFn: (): void => {},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
icon: "open_in_new",
|
|
117
|
+
label: "Sol·licitud de trasllat",
|
|
118
|
+
callbackFn: (): void => {},
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
});
|
|
122
|
+
return Promise.resolve(menuItem);
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
126
|
+
id: "results-reports",
|
|
127
|
+
factory: () => {
|
|
128
|
+
const menuItem = new PrimariaNavTreeMenu({
|
|
129
|
+
icon: "add_box",
|
|
130
|
+
label: "Resultats i informes",
|
|
131
|
+
actionMenuItems: [
|
|
132
|
+
{
|
|
133
|
+
icon: "open_in_new",
|
|
134
|
+
label: "Resultats i informes ECAP",
|
|
135
|
+
callbackFn: (): void => {},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
icon: "open_in_new",
|
|
139
|
+
label: "Documents usuari",
|
|
140
|
+
callbackFn: async (): Promise<void> => {
|
|
141
|
+
const CIP = (await shellApi.broker.send("get_patient_cip")) as string;
|
|
142
|
+
|
|
143
|
+
setTimeout(() => {
|
|
144
|
+
shellApi.ecapEventManager.publish("CRIDA_DOCS_USU", "NO_TANCAR", {
|
|
145
|
+
CIP: CIP || "",
|
|
146
|
+
});
|
|
147
|
+
}, 0);
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
});
|
|
152
|
+
return Promise.resolve(menuItem);
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
156
|
+
id: "processes",
|
|
157
|
+
factory: () => {
|
|
158
|
+
const menuItem = new PrimariaNavTreeMenu({
|
|
159
|
+
icon: "add_box",
|
|
160
|
+
label: "Processos",
|
|
161
|
+
actionMenuItems: [
|
|
162
|
+
{
|
|
163
|
+
icon: "open_in_new",
|
|
164
|
+
label: "ARES",
|
|
165
|
+
callbackFn: (): void => {},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
icon: "open_in_new",
|
|
169
|
+
label: "Nen sa",
|
|
170
|
+
callbackFn: (): void => {},
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
icon: "open_in_new",
|
|
174
|
+
label: "Procés Obstètric",
|
|
175
|
+
callbackFn: (): void => {},
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
icon: "open_in_new",
|
|
179
|
+
label: "Odontologia",
|
|
180
|
+
callbackFn: (): void => {},
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
icon: "open_in_new",
|
|
184
|
+
label: "Situació d'especial cura",
|
|
185
|
+
callbackFn: (): void => {},
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
});
|
|
189
|
+
return Promise.resolve(menuItem);
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
193
|
+
id: "variable activities",
|
|
194
|
+
factory: () => {
|
|
195
|
+
const menuItem = new PrimariaNavItem({
|
|
196
|
+
icon: "add_box",
|
|
197
|
+
label: "Activitats variables",
|
|
198
|
+
callbackFn: async () => {
|
|
199
|
+
const CIP = (await shellApi.broker.send("get_patient_cip")) as string;
|
|
200
|
+
shellApi.ecapEventManager.publish("IA_DEV", "NO_TANCAR", {
|
|
201
|
+
CIP: CIP || "",
|
|
202
|
+
});
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
return Promise.resolve(menuItem);
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
209
|
+
id: clinicalMonitoringId,
|
|
210
|
+
factory: () => {
|
|
211
|
+
const menuItem = new PrimariaNavItem({
|
|
212
|
+
icon: "add_box",
|
|
213
|
+
label: "Seguiment clínic",
|
|
214
|
+
callbackFn: () => {
|
|
215
|
+
shellApi.regionManager.activateMainView(clinicalMonitoringId);
|
|
216
|
+
shellApi.broker.publish(shellEvents.openClinicalMonitoringRequested);
|
|
217
|
+
},
|
|
218
|
+
});
|
|
219
|
+
return Promise.resolve(menuItem);
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
223
|
+
id: "landing",
|
|
224
|
+
factory: () => {
|
|
225
|
+
const menuItem = new PrimariaNavItem({
|
|
226
|
+
icon: "add_box",
|
|
227
|
+
label: "Pàgina inici",
|
|
228
|
+
callbackFn: () => {
|
|
229
|
+
shellApi.broker.publish("window_close");
|
|
230
|
+
shellApi.broker.publish(shellEvents.appCrashed, {
|
|
231
|
+
message: "S'ha tancat la finestra",
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
return Promise.resolve(menuItem);
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const registerLowerNavMenuViews = () => {
|
|
241
|
+
shellApi.regionManager.registerView(shellRegions.navigationLowerLeftMenu, {
|
|
242
|
+
id: "configuration-center",
|
|
243
|
+
factory: () => {
|
|
244
|
+
const menuItem = new PrimariaNavItem({
|
|
245
|
+
icon: "add_box",
|
|
246
|
+
label: "Centre de configuració",
|
|
247
|
+
callbackFn: () => {
|
|
248
|
+
// shellApi.regionManager.activateView(shellRegions.main, "");
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
return Promise.resolve(menuItem);
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const registerMainViews = () => {
|
|
257
|
+
shellApi.regionManager.registerMainView({
|
|
258
|
+
id: clinicalMonitoringId,
|
|
259
|
+
factory: () => {
|
|
260
|
+
const mainItem = new ClinicalMonitoring();
|
|
261
|
+
return Promise.resolve(mainItem as unknown as HTMLElement);
|
|
262
|
+
},
|
|
263
|
+
options: {
|
|
264
|
+
isDefault: true,
|
|
265
|
+
},
|
|
266
|
+
});
|
|
267
|
+
shellApi.regionManager.registerMainView({
|
|
268
|
+
id: pocTestEventsId,
|
|
269
|
+
factory: () => {
|
|
270
|
+
const mainItem = new PocEventsEcap();
|
|
271
|
+
return Promise.resolve(mainItem as unknown as HTMLElement);
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export const registerInternalViews = () => {
|
|
277
|
+
registerMainViews();
|
|
278
|
+
registerUpperNavMenuViews();
|
|
279
|
+
registerLowerNavMenuViews();
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export const activateDefaultView = () => {
|
|
283
|
+
shellApi.regionManager.activateMainView(clinicalMonitoringId);
|
|
284
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./bootstrapper";
|
|
3
|
+
export * from "./disposer";
|
|
3
4
|
export * from "./api/region-manager/regions";
|
|
4
|
-
export * from "./
|
|
5
|
+
export * from "./handle-plugins";
|
|
5
6
|
export * from "./api/api";
|
|
6
7
|
export * from "./api/broker/primaria-broker";
|
|
7
8
|
import "./UI/index";
|
|
8
|
-
export {
|
|
9
|
+
export { PrimariaNavItem } from "./UI/shared-components/primaria-nav-item/primaria-nav-item";
|
|
9
10
|
export { confirmMixin } from "./UI/shared-components/primaria-interaction";
|
|
10
11
|
export type { CustomConfirmOptions } from "./UI/shared-components/primaria-interaction";
|
|
11
12
|
export {
|
|
@@ -15,3 +16,4 @@ export {
|
|
|
15
16
|
export type { IEcapEvent } from "./api/ecap-event-manager/typings";
|
|
16
17
|
export * from "./internal-plugins";
|
|
17
18
|
export * from "@uxland/harmonix-adapters";
|
|
19
|
+
export * from "./events";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LitElement, css, html, unsafeCSS } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
import styles from "./styles.css?inline";
|
|
4
|
+
import { template } from "./template";
|
|
5
|
+
|
|
6
|
+
//@ts-ignore
|
|
7
|
+
@customElement("activity-history-search-header")
|
|
8
|
+
export class ActivityHistorySearchHeader extends LitElement {
|
|
9
|
+
render() {
|
|
10
|
+
return html`${template(this)}`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static styles = css`
|
|
14
|
+
${unsafeCSS(styles)}
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
@property()
|
|
18
|
+
searchQuery = "";
|
|
19
|
+
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.search-header {
|
|
2
|
+
padding-inline: 16px;
|
|
3
|
+
padding-top: 12px;
|
|
4
|
+
padding-bottom: 12px;
|
|
5
|
+
gap: var(--dds-spacing-xs);
|
|
6
|
+
border-width: 0px 0px 1px 0px;
|
|
7
|
+
border-style: solid;
|
|
8
|
+
border-color: #D8D8D8;
|
|
9
|
+
background-color: #FFFFFF;
|
|
10
|
+
color: var(--color-neutral-900);
|
|
11
|
+
font-weight: 600;
|
|
12
|
+
font-size: 14px;
|
|
13
|
+
line-height: 24px;
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { ActivityHistorySearchHeader } from "./activity-history-search-header";
|
|
3
|
+
import { translate } from "../../../localization";
|
|
4
|
+
|
|
5
|
+
export const template = (props: ActivityHistorySearchHeader) =>
|
|
6
|
+
html`<div class="search-header">
|
|
7
|
+
${translate("searchBarResults")} “${props.searchQuery}”
|
|
8
|
+
</div>`;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { LitElement, css, html, unsafeCSS } from "lit";
|
|
2
2
|
import { PrimariaRegionHost } from "../../../../../api/api";
|
|
3
3
|
import { customElement } from "lit/decorators.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
activityHistoryGroupedItems,
|
|
6
|
+
activityHistorySearchStringSelector,
|
|
7
|
+
isAnyCollectionLoadingWithoutAnyLoaded,
|
|
8
|
+
isSomeCollectionLoadedAndOtherLoading,
|
|
9
|
+
} from "../../../infrastructure/state/selectors";
|
|
5
10
|
import { connectedProperty } from "../../../infrastructure/state/connected-property";
|
|
6
11
|
import styles from "./styles.css?inline";
|
|
7
12
|
import { template } from "./template";
|
|
@@ -20,4 +25,25 @@ export class ActivityHistoryTimeline extends PrimariaRegionHost(LitElement) {
|
|
|
20
25
|
|
|
21
26
|
@connectedProperty(activityHistoryGroupedItems)
|
|
22
27
|
historyGroups: IActivityHistoryGroup[];
|
|
28
|
+
|
|
29
|
+
@connectedProperty(isAnyCollectionLoadingWithoutAnyLoaded)
|
|
30
|
+
isAnyCollectionLoadingWithoutAnyLoaded: boolean;
|
|
31
|
+
|
|
32
|
+
@connectedProperty(isSomeCollectionLoadedAndOtherLoading)
|
|
33
|
+
isSomeCollectionLoadedAndOtherLoading: boolean;
|
|
34
|
+
|
|
35
|
+
@connectedProperty(activityHistorySearchStringSelector)
|
|
36
|
+
searchString: string;
|
|
37
|
+
|
|
38
|
+
_hasUpdatedOnce = false;
|
|
39
|
+
|
|
40
|
+
firstUpdated() {
|
|
41
|
+
this._hasUpdatedOnce = true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
highlightMatch(text: string, searchString: string): string {
|
|
45
|
+
if (!this.searchString || this.searchString.length < 2) return text;
|
|
46
|
+
const regex = new RegExp(`(${searchString})`, "gi");
|
|
47
|
+
return text.replace(regex, `<span class="highlight">$1</span>`);
|
|
48
|
+
}
|
|
23
49
|
}
|