@uxland/primary-shell 3.4.1 → 3.5.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.
Files changed (113) hide show
  1. package/dist/index.js +11640 -13451
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.umd.cjs +795 -1064
  4. package/dist/index.umd.cjs.map +1 -1
  5. package/dist/primary/shell/src/UI/components/primaria-error-view/component.d.ts +9 -0
  6. package/dist/primary/shell/src/UI/components/primaria-error-view/template.d.ts +3 -0
  7. package/dist/primary/shell/src/UI/components/primaria-shell/constants.d.ts +4 -0
  8. package/dist/primary/shell/src/UI/components/primaria-shell/primaria-shell.d.ts +10 -0
  9. 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
  10. package/dist/primary/shell/src/UI/components/quick-actions-menu/template.d.ts +3 -0
  11. package/dist/primary/shell/src/UI/shared-components/primaria-nav-item/template.d.ts +3 -0
  12. package/dist/primary/shell/src/UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu.d.ts +13 -0
  13. package/dist/primary/shell/src/UI/shared-components/primaria-nav-tree-menu/template.d.ts +3 -0
  14. package/dist/primary/shell/src/UI/shared-components/typings.d.ts +16 -0
  15. package/dist/primary/shell/src/api/broker/primaria-broker.d.ts +1 -0
  16. package/dist/primary/shell/src/api/region-manager/region-manager.d.ts +3 -2
  17. package/dist/primary/shell/src/bootstrapper.d.ts +2 -0
  18. package/dist/primary/shell/src/constants.d.ts +1 -0
  19. package/dist/primary/shell/src/disposer.d.ts +2 -0
  20. package/dist/primary/shell/src/events.d.ts +2 -0
  21. package/dist/primary/shell/src/features/bootstrapper.d.ts +1 -1
  22. package/dist/primary/shell/src/features/utils.d.ts +3 -2
  23. package/dist/primary/shell/src/{plugin.d.ts → handle-plugins.d.ts} +2 -1
  24. package/dist/primary/shell/src/handle-views.d.ts +2 -0
  25. package/dist/primary/shell/src/index.d.ts +5 -3
  26. 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
  27. package/dist/primary/shell/src/internal-plugins/activity-history/components/activity-history/activity-history-search-header/template.d.ts +3 -0
  28. package/dist/primary/shell/src/internal-plugins/activity-history/components/activity-history/activity-history-timeline/activity-history-timeline.d.ts +6 -0
  29. package/dist/primary/shell/src/internal-plugins/activity-history/components/activity-history/activity-history.d.ts +4 -3
  30. package/dist/primary/shell/src/internal-plugins/activity-history/constants.d.ts +3 -0
  31. package/dist/primary/shell/src/internal-plugins/activity-history/domain/is-valid-history-item/is-valid-history-item.d.ts +1 -0
  32. package/dist/primary/shell/src/internal-plugins/activity-history/features/search-items/handler.d.ts +3 -1
  33. package/dist/primary/shell/src/internal-plugins/activity-history/localization.d.ts +2 -0
  34. package/dist/primary/shell/src/locales.d.ts +14 -3
  35. package/dist/style.css +1 -1
  36. package/package.json +2 -3
  37. package/src/UI/components/index.ts +1 -0
  38. package/src/UI/components/primaria-error-view/component.ts +18 -0
  39. package/src/UI/components/primaria-error-view/styles.css +27 -0
  40. package/src/UI/components/primaria-error-view/template.ts +12 -0
  41. package/src/UI/components/primaria-shell/constants.ts +4 -0
  42. package/src/UI/components/primaria-shell/primaria-shell.ts +38 -1
  43. package/src/UI/components/primaria-shell/styles.css +24 -54
  44. package/src/UI/components/primaria-shell/template.ts +43 -50
  45. package/src/UI/{shared-components/primaria-menu/primaria-menu.ts → components/quick-actions-menu/quick-actions-menu.ts} +3 -3
  46. package/src/UI/components/quick-actions-menu/template.ts +10 -0
  47. package/src/UI/images/not-found.svg +9 -0
  48. package/src/UI/shared-components/index.ts +1 -3
  49. package/src/UI/shared-components/primaria-nav-item/primaria-nav-item.ts +54 -0
  50. package/src/UI/shared-components/{primaria-menu-item → primaria-nav-item}/styles.css +4 -0
  51. package/src/UI/shared-components/primaria-nav-item/template.ts +27 -0
  52. package/src/UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu.ts +41 -0
  53. package/src/UI/shared-components/primaria-nav-tree-menu/styles.css +11 -0
  54. package/src/UI/shared-components/primaria-nav-tree-menu/template.ts +30 -0
  55. package/src/UI/shared-components/typings.ts +17 -0
  56. package/src/api/api.ts +1 -1
  57. package/src/api/broker/factory.ts +29 -12
  58. package/src/api/broker/primaria-broker.ts +2 -0
  59. package/src/api/ecap-event-manager/ecap-event-manager.ts +1 -1
  60. package/src/api/region-manager/region-manager.ts +12 -2
  61. package/src/api/token-manager/token-manager.test.ts +1 -1
  62. package/src/bootstrapper.ts +16 -0
  63. package/src/constants.ts +1 -0
  64. package/src/disposer.ts +10 -0
  65. package/src/events.ts +2 -0
  66. package/src/features/bootstrapper.ts +4 -1
  67. package/src/features/get-user-info/bootstrapper.ts +6 -3
  68. package/src/features/utils.ts +7 -5
  69. package/src/{plugin.ts → handle-plugins.ts} +8 -3
  70. package/src/handle-views.ts +279 -0
  71. package/src/index.ts +5 -3
  72. package/src/internal-plugins/activity-history/components/activity-history/activity-history-search-header/activity-history-search-header.ts +20 -0
  73. package/src/internal-plugins/activity-history/components/activity-history/activity-history-search-header/styles.css +14 -0
  74. package/src/internal-plugins/activity-history/components/activity-history/activity-history-search-header/template.ts +8 -0
  75. package/src/internal-plugins/activity-history/components/activity-history/activity-history-timeline/activity-history-timeline.ts +27 -1
  76. package/src/internal-plugins/activity-history/components/activity-history/activity-history-timeline/styles.css +21 -2
  77. package/src/internal-plugins/activity-history/components/activity-history/activity-history-timeline/template.ts +38 -19
  78. package/src/internal-plugins/activity-history/components/activity-history/activity-history.ts +17 -26
  79. package/src/internal-plugins/activity-history/components/activity-history/styles.css +2 -24
  80. package/src/internal-plugins/activity-history/components/activity-history/template.ts +37 -69
  81. package/src/internal-plugins/activity-history/constants.ts +3 -0
  82. package/src/internal-plugins/activity-history/domain/filter-by-search-string/filter-by-search-string.ts +6 -1
  83. package/src/internal-plugins/activity-history/domain/is-valid-history-item/is-valid-history-item.ts +19 -5
  84. package/src/internal-plugins/activity-history/features/add-history-item/bootstrapper.ts +5 -2
  85. package/src/internal-plugins/activity-history/features/add-history-items/bootstrapper.ts +5 -2
  86. package/src/internal-plugins/activity-history/features/export-to-pdf/bootstrapper.ts +5 -2
  87. package/src/internal-plugins/activity-history/features/inject-async-history-items/bootstrapper.ts +5 -2
  88. package/src/internal-plugins/activity-history/features/inject-async-history-items/handler.ts +3 -3
  89. package/src/internal-plugins/activity-history/features/search-items/bootstrapper.ts +5 -2
  90. package/src/internal-plugins/activity-history/features/search-items/handler.ts +9 -1
  91. package/src/internal-plugins/activity-history/features/update-history-item/bootstrapper.ts +5 -2
  92. package/src/internal-plugins/activity-history/localization.ts +2 -0
  93. package/src/locales.ts +25 -5
  94. package/dist/primary/shell/src/UI/shared-components/primaria-menu/template.d.ts +0 -3
  95. package/dist/primary/shell/src/UI/shared-components/primaria-menu-item/primaria-menu-item.d.ts +0 -15
  96. package/dist/primary/shell/src/UI/shared-components/primaria-menu-item/template.d.ts +0 -3
  97. package/dist/primary/shell/src/UI/shared-components/primaria-nav-menu/primaria-nav-menu.d.ts +0 -26
  98. package/dist/primary/shell/src/UI/shared-components/primaria-nav-menu/template.d.ts +0 -3
  99. package/dist/primary/shell/src/UI/shared-components/primaria-wrapper-menu/primaria-wrapper-menu.d.ts +0 -19
  100. package/dist/primary/shell/src/UI/shared-components/primaria-wrapper-menu/template.d.ts +0 -3
  101. package/dist/primary/shell/src/initializer.d.ts +0 -1
  102. package/src/UI/shared-components/dss-container/dss-container.ts +0 -32
  103. package/src/UI/shared-components/dss-container/styles.css +0 -23
  104. package/src/UI/shared-components/primaria-menu/template.ts +0 -9
  105. package/src/UI/shared-components/primaria-menu-item/primaria-menu-item.ts +0 -51
  106. package/src/UI/shared-components/primaria-menu-item/template.ts +0 -11
  107. package/src/UI/shared-components/primaria-nav-menu/primaria-nav-menu.ts +0 -66
  108. package/src/UI/shared-components/primaria-nav-menu/styles.css +0 -26
  109. package/src/UI/shared-components/primaria-nav-menu/template.ts +0 -30
  110. package/src/UI/shared-components/primaria-wrapper-menu/primaria-wrapper-menu.ts +0 -41
  111. package/src/UI/shared-components/primaria-wrapper-menu/styles.css +0 -5
  112. package/src/UI/shared-components/primaria-wrapper-menu/template.ts +0 -28
  113. package/src/initializer.ts +0 -327
@@ -1,9 +1,21 @@
1
- import { HarmonixBroker, IEvent, IEventClass, IRequest, IRequestClass } from "@uxland/harmonix";
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
- ): HarmonixBroker;
45
- subscribe<TPayload>(eventName: string, handler: (message: TPayload) => void): HarmonixBroker;
46
- subscribe(event: string | IEventClass, handler: messageHandler): HarmonixBroker {
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
- notificationHandler(eventType)(createDynamicEventHandler(handler));
49
- return this;
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
- ): HarmonixBroker;
70
+ ): BrokerDisposableHandler;
55
71
  registerRequest<TPayload, TResponse>(
56
72
  requestName: string,
57
73
  handler: (message: TPayload) => TResponse,
58
- ): HarmonixBroker;
74
+ ): BrokerDisposableHandler;
59
75
  registerRequest(
60
76
  request: string | IRequestClass<unknown>,
61
77
  handler: messageHandler,
62
- ): HarmonixBroker {
78
+ ): BrokerDisposableHandler {
63
79
  const requestType =
64
80
  typeof request === "function" ? request : this.getRequestType(request as string);
65
- requestHandler(requestType)(createDynamicRequestHandler(handler));
66
- return this;
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 {
@@ -9,3 +9,5 @@ export type {
9
9
  IRequest,
10
10
  IRequestClass,
11
11
  } from "@uxland/harmonix";
12
+
13
+ export type { BrokerDisposableHandler } from "@uxland/harmonix";
@@ -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("metod", JSON.stringify(ecapEvent));
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 "../../plugin";
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
- ): PrimariaRegionManager => new RegionManagerProxy(pluginInfo, regionManager);
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 initializeShell = (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
@@ -1,2 +1,3 @@
1
1
  export const primariaShellId = "primaria-shell";
2
2
  export const clinicalMonitoringId = "clinical-monitoring";
3
+ export const pocTestEventsId = "poc-events-ecap";
@@ -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,3 +1,5 @@
1
1
  export const shellEvents = {
2
2
  openClinicalMonitoringRequested: "openClinicalMonitoringRequested",
3
+ appCrashed: "appCrashed",
4
+ mainViewChanged: "mainViewChanged",
3
5
  };
@@ -1,13 +1,16 @@
1
- import { PrimariaApi } from "@uxland/primary-shell";
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, unregisterRequest } from "../utils";
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
- unregisterRequest(container)(GetUserInfoHandler);
18
+ request?.dispose();
16
19
  unregisterDep(GetUserInfoBackendAdapter);
17
20
  };
@@ -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,279 @@
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
+ });
230
+ return Promise.resolve(menuItem);
231
+ },
232
+ });
233
+ };
234
+
235
+ const registerLowerNavMenuViews = () => {
236
+ shellApi.regionManager.registerView(shellRegions.navigationLowerLeftMenu, {
237
+ id: "configuration-center",
238
+ factory: () => {
239
+ const menuItem = new PrimariaNavItem({
240
+ icon: "add_box",
241
+ label: "Centre de configuració",
242
+ callbackFn: () => {
243
+ // shellApi.regionManager.activateView(shellRegions.main, "");
244
+ },
245
+ });
246
+ return Promise.resolve(menuItem);
247
+ },
248
+ });
249
+ };
250
+
251
+ const registerMainViews = () => {
252
+ shellApi.regionManager.registerMainView({
253
+ id: clinicalMonitoringId,
254
+ factory: () => {
255
+ const mainItem = new ClinicalMonitoring();
256
+ return Promise.resolve(mainItem as unknown as HTMLElement);
257
+ },
258
+ options: {
259
+ isDefault: true,
260
+ },
261
+ });
262
+ shellApi.regionManager.registerMainView({
263
+ id: pocTestEventsId,
264
+ factory: () => {
265
+ const mainItem = new PocEventsEcap();
266
+ return Promise.resolve(mainItem as unknown as HTMLElement);
267
+ },
268
+ });
269
+ };
270
+
271
+ export const registerInternalViews = () => {
272
+ registerMainViews();
273
+ registerUpperNavMenuViews();
274
+ registerLowerNavMenuViews();
275
+ };
276
+
277
+ export const activateDefaultView = () => {
278
+ shellApi.regionManager.activateMainView(clinicalMonitoringId);
279
+ };
package/src/index.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import "reflect-metadata";
2
- export * from "./initializer";
2
+ export * from "./bootstrapper";
3
+ export * from "./disposer";
3
4
  export * from "./api/region-manager/regions";
4
- export * from "./plugin";
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 { PrimariaMenuItem } from "./UI/shared-components/primaria-menu-item/primaria-menu-item";
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 { activityHistoryGroupedItems } from "../../../infrastructure/state/selectors";
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
  }