@uxland/primary-shell 8.3.4 → 8.3.6

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 (157) hide show
  1. package/README.md +18 -1
  2. package/dist/{component-Dv2Cw4dX.js → component-B4xPOzaR.js} +2 -2
  3. package/dist/{component-Dv2Cw4dX.js.map → component-B4xPOzaR.js.map} +1 -1
  4. package/dist/{index-CCC4rQo1.js → index-DsKLmCZe.js} +388 -388
  5. package/dist/index-DsKLmCZe.js.map +1 -0
  6. package/dist/index.js +1 -1
  7. package/dist/{plugin-D3sg1ev9.js → plugin-CRWxCmf1.js} +1058 -1055
  8. package/dist/plugin-CRWxCmf1.js.map +1 -0
  9. package/dist/primary/shell/src/api/import-data-manager/import-data-manager-impl.d.ts +3 -2
  10. package/dist/primary/shell/src/api/import-data-manager/import-data-manager.d.ts +6 -4
  11. package/package.json +6 -14
  12. package/dist/index-CCC4rQo1.js.map +0 -1
  13. package/dist/plugin-D3sg1ev9.js.map +0 -1
  14. package/src/UI/bootstrapper.ts +0 -14
  15. package/src/UI/components/bootstrapper.ts +0 -25
  16. package/src/UI/components/clinical-pathways-action-menu/clinical-pathways-action-menu.ts +0 -13
  17. package/src/UI/components/communication-action-menu/communication-action-menu.ts +0 -13
  18. package/src/UI/components/error-view/component.ts +0 -17
  19. package/src/UI/components/error-view/styles.css +0 -27
  20. package/src/UI/components/error-view/template.ts +0 -12
  21. package/src/UI/components/nav-divider/nav-divider.ts +0 -41
  22. package/src/UI/components/nav-divider/styles.css +0 -21
  23. package/src/UI/components/nav-divider/template.ts +0 -8
  24. package/src/UI/components/petitioner-action-menu/petitioner-action-menu.ts +0 -13
  25. package/src/UI/components/primaria-accordion/primaria-accordion.ts +0 -45
  26. package/src/UI/components/primaria-shell/constants.ts +0 -4
  27. package/src/UI/components/primaria-shell/primaria-shell.ts +0 -105
  28. package/src/UI/components/primaria-shell/shell-header/header-divider/header-divider.ts +0 -13
  29. package/src/UI/components/primaria-shell/shell-header/header-divider/styles.css +0 -5
  30. package/src/UI/components/primaria-shell/shell-header/header-divider/template.ts +0 -8
  31. package/src/UI/components/primaria-shell/shell-header/shell-header.ts +0 -71
  32. package/src/UI/components/primaria-shell/shell-header/styles.css +0 -45
  33. package/src/UI/components/primaria-shell/shell-header/template.ts +0 -37
  34. package/src/UI/components/primaria-shell/styles.css +0 -185
  35. package/src/UI/components/primaria-shell/template.ts +0 -72
  36. package/src/UI/components/sidenav-action-menu/sidenav-action-menu.ts +0 -62
  37. package/src/UI/components/sidenav-action-menu/styles.css +0 -25
  38. package/src/UI/components/sidenav-action-menu/template.ts +0 -24
  39. package/src/UI/fonts/fonts.css +0 -48
  40. package/src/UI/fonts/open-sans-v40-latin-300.woff2 +0 -0
  41. package/src/UI/fonts/open-sans-v40-latin-500.woff2 +0 -0
  42. package/src/UI/fonts/open-sans-v40-latin-600.woff2 +0 -0
  43. package/src/UI/fonts/open-sans-v40-latin-700.woff2 +0 -0
  44. package/src/UI/fonts/open-sans-v40-latin-800.woff2 +0 -0
  45. package/src/UI/fonts/open-sans-v40-latin-regular.woff2 +0 -0
  46. package/src/UI/images/Gencat_Logotip.svg +0 -70
  47. package/src/UI/images/Salut_Logotip.svg +0 -8
  48. package/src/UI/index.ts +0 -1
  49. package/src/UI/internal-views/administrative-nav-menu.ts +0 -302
  50. package/src/UI/internal-views/common-nav-menu.ts +0 -94
  51. package/src/UI/internal-views/doctor-nav-menu.ts +0 -297
  52. package/src/UI/internal-views/doctor-quick-action-menu.ts +0 -16
  53. package/src/UI/internal-views/handle-views.ts +0 -24
  54. package/src/UI/shared-components/bootstrapper.ts +0 -18
  55. package/src/UI/shared-components/index.ts +0 -1
  56. package/src/UI/shared-components/primaria-character-limit-badge/primaria-character-limit-badge.ts +0 -27
  57. package/src/UI/shared-components/primaria-character-limit-badge/styles.css +0 -8
  58. package/src/UI/shared-components/primaria-content-switcher/primaria-content-switcher.ts +0 -78
  59. package/src/UI/shared-components/primaria-nav-item/primaria-nav-item.ts +0 -71
  60. package/src/UI/shared-components/primaria-nav-item/styles.css +0 -25
  61. package/src/UI/shared-components/primaria-nav-item/template.ts +0 -27
  62. package/src/UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu.ts +0 -41
  63. package/src/UI/shared-components/primaria-nav-tree-menu/styles.css +0 -11
  64. package/src/UI/shared-components/primaria-nav-tree-menu/template.ts +0 -46
  65. package/src/UI/shared-components/primaria-region/index.ts +0 -1
  66. package/src/UI/shared-components/primaria-region/primaria-region.ts +0 -199
  67. package/src/UI/shared-components/primaria-text-editor/primaria-rich-text-editor.ts +0 -261
  68. package/src/UI/shared-components/primaria-text-editor/styles.css +0 -966
  69. package/src/UI/shared-components/primaria-text-editor/template.ts +0 -8
  70. package/src/UI/shared-components/primaria-text-editor/utils.ts +0 -39
  71. package/src/UI/shared-components/quick-action-item/quick-action-item.ts +0 -21
  72. package/src/UI/shared-components/quick-action-item/template.ts +0 -8
  73. package/src/UI/shared-components/typings.ts +0 -19
  74. package/src/api/activity-monitor/activity-monitor.test.ts +0 -67
  75. package/src/api/activity-monitor/activity-monitor.ts +0 -26
  76. package/src/api/api.test.ts +0 -37
  77. package/src/api/api.ts +0 -119
  78. package/src/api/broker/broker-events.ts +0 -39
  79. package/src/api/broker/broker-requests.ts +0 -20
  80. package/src/api/broker/factory.test.ts +0 -378
  81. package/src/api/broker/factory.ts +0 -151
  82. package/src/api/broker/primaria-broker.ts +0 -20
  83. package/src/api/context-manager/context-manager.test.ts +0 -86
  84. package/src/api/context-manager/context-manager.ts +0 -42
  85. package/src/api/ecap-event-manager/ecap-event-manager.test.ts +0 -100
  86. package/src/api/ecap-event-manager/ecap-event-manager.ts +0 -58
  87. package/src/api/ecap-event-manager/typings.ts +0 -6
  88. package/src/api/exit-guard-manager/exit-guard-manager.test.ts +0 -75
  89. package/src/api/exit-guard-manager/exit-guard-manager.ts +0 -31
  90. package/src/api/global-state/global-state.test.ts +0 -45
  91. package/src/api/global-state/global-state.ts +0 -38
  92. package/src/api/http-client/http-client.test.ts +0 -196
  93. package/src/api/http-client/http-client.ts +0 -97
  94. package/src/api/import-data-manager/component/component.ts +0 -29
  95. package/src/api/import-data-manager/component/styles.css +0 -79
  96. package/src/api/import-data-manager/component/template.ts +0 -49
  97. package/src/api/import-data-manager/import-data-manager-impl.test.ts +0 -364
  98. package/src/api/import-data-manager/import-data-manager-impl.ts +0 -121
  99. package/src/api/import-data-manager/import-data-manager.ts +0 -42
  100. package/src/api/import-data-manager/index.ts +0 -2
  101. package/src/api/interaction-service/confirmation-message.tsx +0 -5
  102. package/src/api/interaction-service/index.ts +0 -1
  103. package/src/api/interaction-service/interaction-service-impl.tsx +0 -260
  104. package/src/api/interaction-service/interaction-service.ts +0 -52
  105. package/src/api/interaction-service/modal-styles.css +0 -97
  106. package/src/api/localization/localization.test.ts +0 -61
  107. package/src/api/localization/localization.ts +0 -58
  108. package/src/api/notification-service/notification-service-impl.test.ts +0 -84
  109. package/src/api/notification-service/notification-service.ts +0 -6
  110. package/src/api/notification-service/notification.service-impl.ts +0 -67
  111. package/src/api/pdf-viewer-manager/constants.ts +0 -1
  112. package/src/api/pdf-viewer-manager/events.ts +0 -5
  113. package/src/api/pdf-viewer-manager/handle-views.ts +0 -32
  114. package/src/api/pdf-viewer-manager/pdf-viewer-manager.test.ts +0 -126
  115. package/src/api/pdf-viewer-manager/pdf-viewer-manager.ts +0 -96
  116. package/src/api/pdf-viewer-manager/pdf-visor/pdf-selector/pdf-selector.ts +0 -39
  117. package/src/api/pdf-viewer-manager/pdf-visor/pdf-selector/styles.css +0 -45
  118. package/src/api/pdf-viewer-manager/pdf-visor/pdf-selector/template.ts +0 -32
  119. package/src/api/pdf-viewer-manager/pdf-visor/pdf-visor.ts +0 -122
  120. package/src/api/pdf-viewer-manager/pdf-visor/styles.css +0 -29
  121. package/src/api/pdf-viewer-manager/pdf-visor/utils.ts +0 -16
  122. package/src/api/quick-action-busy-manager/quick-action-busy-manager.test.ts +0 -61
  123. package/src/api/quick-action-busy-manager/quick-action-busy-manager.ts +0 -45
  124. package/src/api/region-manager/region-manager.test.ts +0 -239
  125. package/src/api/region-manager/region-manager.ts +0 -263
  126. package/src/api/region-manager/regions.ts +0 -30
  127. package/src/api/region-manager/remove-view-idempotency.test.ts +0 -98
  128. package/src/api/session-refresh-timer/session-refresh-timer.test.ts +0 -102
  129. package/src/api/session-refresh-timer/session-refresh-timer.ts +0 -75
  130. package/src/api/token-manager/token-manager.test.ts +0 -146
  131. package/src/api/token-manager/token-manager.ts +0 -70
  132. package/src/api/user-manager/user-manager.ts +0 -79
  133. package/src/bootstrapper.ts +0 -41
  134. package/src/constants.ts +0 -1
  135. package/src/disposer.ts +0 -19
  136. package/src/features/bootstrapper.ts +0 -21
  137. package/src/features/exit/bootstrapper.ts +0 -17
  138. package/src/features/exit/handler.test.ts +0 -187
  139. package/src/features/exit/handler.ts +0 -58
  140. package/src/features/exit/request.ts +0 -10
  141. package/src/features/get-patient-cip/action.ts +0 -5
  142. package/src/features/get-user-info/backend-adapter.ts +0 -48
  143. package/src/features/get-user-info/bootstrapper.ts +0 -20
  144. package/src/features/get-user-info/handler.test.ts +0 -66
  145. package/src/features/get-user-info/handler.ts +0 -23
  146. package/src/features/get-user-info/model.ts +0 -10
  147. package/src/features/get-user-info/pds-token.ts +0 -28
  148. package/src/features/get-user-info/request.ts +0 -4
  149. package/src/features/get-visi-id/action.ts +0 -11
  150. package/src/features/navigate-to-ecap/navigate-to-ecap.ts +0 -21
  151. package/src/features/utils.ts +0 -27
  152. package/src/handle-plugins.ts +0 -82
  153. package/src/index.ts +0 -101
  154. package/src/infrastructure/ioc/container.ts +0 -14
  155. package/src/infrastructure/ioc/types.ts +0 -5
  156. package/src/locales.ts +0 -70
  157. package/src/types/custom.d.ts +0 -30
@@ -1,24 +0,0 @@
1
- import { shellApi } from "../../api/api";
2
- import { registerPDFVisorMainView, registerPdfViewerNavItem } from "../../api/pdf-viewer-manager/handle-views";
3
- import { registerAdministrativeNavMenuViews } from "./administrative-nav-menu";
4
- import { registerDoctorNavMenuViews } from "./doctor-nav-menu";
5
- import { registerDoctorQuickActionViews } from "./doctor-quick-action-menu";
6
-
7
- const registerMainViews = () => {
8
- registerPDFVisorMainView();
9
- };
10
-
11
- const registerPdfViewerNavButton = () => {
12
- registerPdfViewerNavItem();
13
- };
14
-
15
- export const useInternalViews = () => {
16
- registerMainViews();
17
- registerPdfViewerNavButton();
18
- const isUserRoleAdministrative = shellApi.userManager.isUserRoleAdministrative();
19
- if (isUserRoleAdministrative) registerAdministrativeNavMenuViews();
20
- else {
21
- registerDoctorNavMenuViews();
22
- registerDoctorQuickActionViews();
23
- }
24
- };
@@ -1,18 +0,0 @@
1
- import { customElement } from "lit/decorators.js";
2
- import { PrimariaContentSwitcher } from "./primaria-content-switcher/primaria-content-switcher";
3
- import { PrimariaNavItem } from "./primaria-nav-item/primaria-nav-item";
4
- import { PrimariaNavTreeMenu } from "./primaria-nav-tree-menu/primaria-nav-tree-menu";
5
- import { PrimariaRichTextEditor } from "./primaria-text-editor/primaria-rich-text-editor";
6
- import { PrimariaCharacterLimitBadge } from "./primaria-character-limit-badge/primaria-character-limit-badge";
7
- import { PrimariaRegion } from "./primaria-region";
8
-
9
- export const useSharedUI = () => {
10
- customElement("primaria-content-switcher")(PrimariaContentSwitcher);
11
- customElement("primaria-nav-item")(PrimariaNavItem);
12
- customElement("primaria-rich-text-editor")(PrimariaRichTextEditor);
13
- customElement("primaria-nav-tree-menu")(PrimariaNavTreeMenu);
14
- customElement("primaria-character-limit-badge")(PrimariaCharacterLimitBadge);
15
- // @ts-ignore: `PrimariaRegion` estén el mixin `PrimariaRegionHost`, que està tipat com a
16
- // `any`, així que TypeScript no el reconeix com a `CustomElementClass`.
17
- customElement("primaria-region")(PrimariaRegion);
18
- };
@@ -1 +0,0 @@
1
- export { PrimariaContentSwitcher } from "./primaria-content-switcher/primaria-content-switcher";
@@ -1,27 +0,0 @@
1
- import { LitElement, html, nothing, css, unsafeCSS } from "lit";
2
- import { property } from "lit/decorators.js";
3
- import styles from "./styles.css?inline";
4
-
5
- export class PrimariaCharacterLimitBadge extends LitElement {
6
- @property({ type: Number }) characterCount = 0;
7
- @property({ type: Number }) characterLimit = 0;
8
- @property({ type: String }) label = "";
9
-
10
- static styles = css`
11
- ${unsafeCSS(styles)}
12
- `;
13
-
14
- render() {
15
- if (this.characterCount > this.characterLimit) {
16
- return html`
17
- <dss-alert
18
- class="limit-alert"
19
- status="warning"
20
- size="md"
21
- titleText="${this.label} ${this.characterCount}/${this.characterLimit}"
22
- ></dss-alert>
23
- `;
24
- }
25
- return nothing;
26
- }
27
- }
@@ -1,8 +0,0 @@
1
- :host{
2
- margin: 0 auto;
3
- }
4
-
5
- .limit-alert {
6
- padding-top: 8px;
7
- padding-bottom: 8px;
8
- }
@@ -1,78 +0,0 @@
1
- import { LitElement, css, html } from "lit";
2
- import { property } from "lit/decorators.js";
3
- const isSelected = (item: HTMLElement, attrForSelected: string, selection: string) =>
4
- item[attrForSelected] === selection ||
5
- Array.from(item.attributes).some(
6
- (attr) => attr.name === attrForSelected && attr.value === selection,
7
- );
8
-
9
- export class PrimariaContentSwitcher extends LitElement {
10
- render() {
11
- return html` <slot></slot> `;
12
- }
13
-
14
- static styles = css`
15
- :host {
16
- display: flex;
17
- flex: 1;
18
- }
19
- :host > ::slotted(:not(slot):not(.selected)) {
20
- display: none !important;
21
- }
22
- `;
23
-
24
- @property()
25
- selected: any;
26
-
27
- @property()
28
- attrForSelected: string;
29
-
30
- @property()
31
- animation = "fade";
32
-
33
- updated(props): any {
34
- this.select();
35
- }
36
-
37
- get items(): HTMLCollection {
38
- return this.children;
39
- }
40
-
41
- selectIndex() {
42
- return this.selected || this.selected === 0
43
- ? this.attrForSelected
44
- ? Array.from(this.items).findIndex((item: any) =>
45
- isSelected(item, this.attrForSelected, this.selected),
46
- )
47
- : Number.parseInt(this.selected)
48
- : -1;
49
- }
50
-
51
- select() {
52
- if (this.items.length) {
53
- const index = this.selectIndex();
54
- if (index !== -1) {
55
- const items = Array.from(this.items);
56
- items.forEach((i) => i.classList.remove("selected"));
57
- items[index]?.classList.add("selected");
58
- }
59
- }
60
- }
61
-
62
- doAnimation(item) {
63
- switch (this.animation) {
64
- case "fade":
65
- return item?.classList.add("fade-in");
66
- case "slideDown":
67
- return item?.classList.add("slide-down");
68
- case "slideLeft":
69
- return item?.classList.add("slide-left");
70
- case "slideRight":
71
- return item?.classList.add("slide-right");
72
- case "disabled":
73
- return;
74
- default:
75
- return item?.classList.add("fade-in");
76
- }
77
- }
78
- }
@@ -1,71 +0,0 @@
1
- import { regionView } from "@uxland/regions";
2
- import { LitElement, PropertyValues, css, html, unsafeCSS } from "lit";
3
- import { property, state } from "lit/decorators.js";
4
- import { shellApi } from "../../../api/api";
5
- import { BROKER_EVENTS } from "../../../api/broker/broker-events";
6
- import { PrimariaNavItemConfig } from "../typings";
7
- import styles from "./styles.css?inline";
8
- import { template } from "./template";
9
- import { BrokerDisposableHandler } from "@uxland/harmonix";
10
-
11
- export class PrimariaNavItem extends regionView(LitElement) {
12
- static styles = css`
13
- ${unsafeCSS(styles)}
14
- `;
15
-
16
- constructor(config: PrimariaNavItemConfig) {
17
- super();
18
- this.config = config;
19
- }
20
-
21
- private subscriptions: BrokerDisposableHandler[] = [];
22
-
23
- connectedCallback(): void {
24
- super.connectedCallback();
25
- this._subscribeEvents();
26
- }
27
-
28
- disconnectedCallback(): void {
29
- this._unsubscribeEvents();
30
- }
31
-
32
- firstUpdated(_changedProps: PropertyValues<PrimariaNavItem>) {
33
- super.firstUpdated(_changedProps);
34
- this.observeHostResize();
35
- }
36
-
37
- observeHostResize() {
38
- const parentElement = this.parentElement;
39
- const observer = new ResizeObserver((entries) => {
40
- for (const entry of entries) {
41
- const width = entry.target.clientWidth; // Obtenemos el ancho del host
42
- this.showText = width > 100; // Mostrar texto si el ancho del host es mayor que 150px
43
- }
44
- });
45
-
46
- observer.observe(parentElement as HTMLElement);
47
- }
48
-
49
- _subscribeEvents() {
50
- const subscription = shellApi.broker.subscribe(BROKER_EVENTS.shell.mainViewChanged, (payload: { viewId: string }) => {
51
- // `ViewDefinition` de @uxland/regions no declara `id`, però el shell només hi registra
52
- // vistes que en porten.
53
- this.isActive = payload.viewId === (this.view as { id?: string } | undefined)?.id;
54
- });
55
- this.subscriptions.push(subscription);
56
- }
57
-
58
- _unsubscribeEvents() {
59
- this.subscriptions.forEach((s) => s.dispose());
60
- }
61
-
62
- render() {
63
- return html`${template(this)}`;
64
- }
65
-
66
- @property({ type: Number }) containerWidth = 0;
67
- @state() showText = false;
68
- @state() isActive = false;
69
-
70
- @property({ type: Object }) config: PrimariaNavItemConfig;
71
- }
@@ -1,25 +0,0 @@
1
- .item {
2
- display: flex;
3
- cursor: pointer;
4
- border-radius: 8px;
5
- padding: 8px;
6
- justify-content: center;
7
- transition: background-color 0.3s ease;
8
- &[expanded] {
9
- justify-content: space-between;
10
- }
11
- &:hover {
12
- background-color: var(--color-primary-900);
13
- color: white;
14
- }
15
- .icon-label {
16
- display: flex;
17
- gap: 8px;
18
- transition: background-color 0.3s;
19
- }
20
- }
21
-
22
- .item.active{
23
- outline: 2px solid white;
24
- outline-offset: -2px;
25
- }
@@ -1,27 +0,0 @@
1
- import { html, nothing } from "lit";
2
- import { PrimariaNavItem } from "./primaria-nav-item";
3
- import { classMap } from "lit/directives/class-map.js";
4
-
5
- export const template = (props: PrimariaNavItem) => {
6
- return html`
7
- <div
8
- class=${classMap({ item: true, active: props.isActive })}
9
- ?expanded=${props.showText}
10
- @click=${props.config.callbackFn}
11
- >
12
- <div class="icon-label">
13
- <dss-icon icon=${props.config.icon} size="md" ?fill=${props.config.fill} style=${props.config.rotateIcon ? "transform: rotate(180deg);" : ""}></dss-icon>
14
- ${props.showText ? html`<span>${props.config.label}</span>` : ""}
15
- </div>
16
- ${props.showText && props.config.showArrow ? html`<dss-icon icon="chevron_right" size="md"></dss-icon>` : ""}
17
- ${
18
- !props.showText
19
- ? html`
20
- <dss-tooltip position="right">
21
- ${props.config.label}
22
- </dss-tooltip>`
23
- : nothing
24
- }
25
- </div>
26
- `;
27
- };
@@ -1,41 +0,0 @@
1
- import { LitElement, css, html, unsafeCSS } from "lit";
2
- import { property, state } from "lit/decorators.js";
3
- import { PrimariaNavItemConfig, PrimariaNavTreeMenuConfig } from "../typings";
4
- import styles from "./styles.css?inline";
5
- import { template } from "./template";
6
-
7
- export class PrimariaNavTreeMenu extends LitElement {
8
- static styles = css`
9
- ${unsafeCSS(styles)}
10
- `;
11
-
12
- @property({ type: Object }) config: PrimariaNavTreeMenuConfig;
13
-
14
- @state() showActionMenu = false;
15
-
16
- constructor(config: PrimariaNavTreeMenuConfig) {
17
- super();
18
- this.config = config;
19
- }
20
-
21
- get primariaNavItemConfig(): PrimariaNavItemConfig {
22
- return {
23
- icon: this.config.icon,
24
- label: this.config.label,
25
- showArrow: true,
26
- callbackFn: this.handleItemClick,
27
- };
28
- }
29
-
30
- handleItemClick = () => {
31
- this.showActionMenu = true;
32
- };
33
-
34
- handleCloseMenu = () => {
35
- this.showActionMenu = false;
36
- };
37
-
38
- render() {
39
- return html`${template(this)}`;
40
- }
41
- }
@@ -1,11 +0,0 @@
1
- .wrapper {
2
- display: flex;
3
- flex-direction: column;
4
- gap: 8px;
5
- }
6
-
7
- .menu-active {
8
- background-color: var(--color-primary-900);
9
- color: white;
10
- border-radius: 8px;
11
- }
@@ -1,46 +0,0 @@
1
- import { html } from "lit";
2
- import { PrimariaNavTreeMenu } from "./primaria-nav-tree-menu";
3
- import { classMap } from "lit/directives/class-map.js";
4
-
5
- export const template = (props: PrimariaNavTreeMenu) => html`
6
- <div class="wrapper">
7
- <primaria-nav-item
8
- .config=${props.primariaNavItemConfig}
9
- class="${classMap({ "menu-active": props.showActionMenu })}"
10
- ></primaria-nav-item>
11
- <dss-action-menu
12
- @close=${props.handleCloseMenu}
13
- ?hidden=${!props.showActionMenu}
14
- >
15
- ${props.config.actionMenuItems?.map((item) =>
16
- item.hasNestedMenu
17
- ? html`
18
- <dss-action-menu-item
19
- righticon=${item.icon}
20
- .label=${item.label}
21
- hasnestedmenu
22
- >
23
- <dss-action-menu>
24
- ${item.nestedMenuItems?.map(
25
- (nestedItem) => html`
26
- <dss-action-menu-item
27
- righticon=${nestedItem.icon}
28
- .label=${nestedItem.label}
29
- @click=${nestedItem.callbackFn}
30
- ></dss-action-menu-item>
31
- `,
32
- )}
33
- </dss-action-menu>
34
- </dss-action-menu-item>
35
- `
36
- : html`
37
- <dss-action-menu-item
38
- righticon=${item.icon}
39
- .label=${item.label}
40
- @click=${item.callbackFn}
41
- ></dss-action-menu-item>
42
- `,
43
- )}
44
- </dss-action-menu>
45
- </div>
46
- `;
@@ -1 +0,0 @@
1
- export { PrimariaRegion } from "./primaria-region";
@@ -1,199 +0,0 @@
1
- import { LitElement, html } from "lit";
2
- import { property } from "lit/decorators.js";
3
- import { IRegion, regionManager } from "@uxland/regions";
4
- import { PrimariaRegionHost } from "../../../api/api";
5
- import { regionsProperty } from "@uxland/regions/region-decorator";
6
-
7
- /**
8
- * PrimariaRegion Web Component
9
- *
10
- * A plug-and-play region component that allows dynamic region creation without
11
- * needing to extend PrimariaRegionHost or use the @region decorator manually.
12
- *
13
- * Renders in light DOM (no shadow-root) to allow region content to be properly
14
- * displayed in the parent's DOM tree.
15
- *
16
- * @example
17
- * ```html
18
- * <primaria-region name="diagnostics-region"></primaria-region>
19
- * ```
20
- *
21
- * This component internally handles:
22
- * - Creating a container with the appropriate ID
23
- * - Setting up the region definition
24
- * - Managing the region lifecycle
25
- */
26
- export class PrimariaRegion extends PrimariaRegionHost(LitElement) {
27
- /**
28
- * The name of the region to create.
29
- * This will be used both as the region name in the region manager
30
- * and to generate the container ID.
31
- */
32
- @property({ type: String })
33
- name = "";
34
- /**
35
- * Rendering mode for the region.
36
- * - "multi" (default): all registered views are shown simultaneously (MultipleActiveAdapter).
37
- * - "single": only one view is shown at a time (SelectableAdapter via primaria-content-switcher).
38
- * Each plugin activates its own view; the adapter deactivates the rest automatically.
39
- */
40
- @property({ type: String })
41
- mode: "multi" | "single" = "multi";
42
- /**
43
- * Render in light DOM instead of shadow DOM.
44
- * This allows the region content to be visible in the parent's DOM tree.
45
- */
46
- createRenderRoot() {
47
- return this;
48
- }
49
-
50
- /**
51
- * Override shadowRoot getter to return this (light DOM) instead of null.
52
- * The region mixin tries to find elements using shadowRoot.querySelector(),
53
- * so we need to make it work with light DOM.
54
- */
55
- get shadowRoot(): ShadowRoot | null {
56
- return this as any;
57
- }
58
-
59
- /**
60
- * The region instance created by the region host mixin.
61
- * Plugins can inject content into this region using the region manager.
62
- */
63
- region: IRegion | undefined;
64
-
65
- /**
66
- * Virtual constructor for this instance to hold its own region definition.
67
- * This prevents conflicts when multiple primaria-region instances exist.
68
- */
69
- private _instanceConstructor: any;
70
-
71
- constructor() {
72
- super();
73
-
74
- // Create a unique constructor object for this instance
75
- // This allows each instance to have its own region definition
76
- // without affecting other instances of the same component
77
- this._instanceConstructor = Object.create(this.constructor);
78
-
79
- // Override the constructor property to return our instance constructor
80
- Object.defineProperty(this, "constructor", {
81
- get: () => this._instanceConstructor,
82
- configurable: true,
83
- });
84
- }
85
-
86
- /**
87
- * Called when the component is connected to the DOM.
88
- * Sets up the region definition before the parent connectedCallback runs.
89
- */
90
- connectedCallback(): void {
91
- // First, call the base LitElement connectedCallback but NOT the mixin yet
92
- // We need to do this in a special order
93
- LitElement.prototype.connectedCallback.call(this);
94
-
95
- if (this.name) {
96
- const targetId = `${this.name}-container`;
97
-
98
- // Create the container element based on mode.
99
- // "single" uses primaria-content-switcher so the region mixin picks up
100
- // selectableAdapterFactory (already registered in UI bootstrapper), giving
101
- // SingleActiveAdapter behaviour: activating one view auto-deactivates the rest.
102
- const container =
103
- this.mode === "single" ? document.createElement("primaria-content-switcher") : document.createElement("div");
104
- container.id = targetId;
105
- if (this.mode !== "single") {
106
- (container as HTMLElement).style.cssText = "width: 100%; height: 100%; min-height: 1px";
107
- }
108
- this.appendChild(container);
109
-
110
- // Set the region metadata directly on the instance constructor
111
- this._instanceConstructor[regionsProperty] = {
112
- ...this._instanceConstructor[regionsProperty],
113
- region: { targetId, name: this.name },
114
- };
115
-
116
- // The mixin creates regions in the `updated()` lifecycle, not in connectedCallback
117
- // So we need to trigger the updated lifecycle or call createRegions directly
118
- // Let's check if the component has the create method from the mixin
119
- if ((this as any).create) {
120
- (this as any).create();
121
- }
122
-
123
- // Also manually call the mixin's connectedCallback if it exists
124
- const litProto = Object.getPrototypeOf(this);
125
- const mixinProto = Object.getPrototypeOf(litProto);
126
-
127
- if (mixinProto.connectedCallback) {
128
- mixinProto.connectedCallback.call(this);
129
- }
130
- }
131
- }
132
-
133
- /**
134
- * Mixin hook fired after `createRegions` finishes.
135
- *
136
- * Hydrates the freshly-created region with every view that has already been
137
- * registered for this region name via `regionManager.registerViewWithRegion`.
138
- * `registerViewWithRegion` only forwards to regions that exist at the moment
139
- * of the call, so a plugin that registers once at `initialize` would lose
140
- * its view every time the region is destroyed and re-created (e.g. when a
141
- * drawer that hosts the region is closed and reopened). Pulling from the
142
- * registry here makes injection transparent: any plugin can register once
143
- * and any region with that name auto-populates.
144
- */
145
- regionsCreated(_regions: unknown): void {
146
- if (!this.region || !this.name) return;
147
- const registered = regionManager.getRegisteredViews(this.name) ?? [];
148
- for (const { key, view } of registered) {
149
- if (this.region.containsView(key)) continue;
150
- this.region.addView(key, view).catch((e) => {
151
- console.warn(`primaria-region(${this.name}): failed to addView "${key}"`, e);
152
- });
153
- }
154
- }
155
-
156
- /**
157
- * Called when the component is removed from the DOM.
158
- *
159
- * The base mixin's `disconnectedCallback` removes the region from the manager
160
- * but does NOT clear `this.region`, so on a later reconnect the mixin's
161
- * `createRegions` sees `isNil(this.region) === false` and skips re-creating
162
- * the region. That breaks the "drawer opens, closes, opens again" flow:
163
- * the second open would render the host but never receive the plugin's
164
- * view. Clear the reference (and drop the orphan container) so the next
165
- * connect rebuilds everything from scratch.
166
- */
167
- disconnectedCallback(): void {
168
- super.disconnectedCallback();
169
- this.region = undefined;
170
- const targetId = `${this.name}-container`;
171
- this.querySelector(`#${targetId}`)?.remove();
172
- }
173
-
174
- /**
175
- * Called before the component updates.
176
- * Updates the region definition if the name changes.
177
- */
178
- protected willUpdate(changedProperties: Map<PropertyKey, unknown>): void {
179
- super.willUpdate(changedProperties);
180
-
181
- // If the name changed after connection, update the region definition
182
- if (this.name && changedProperties.has("name")) {
183
- const targetId = `${this.name}-container`;
184
- this._instanceConstructor[regionsProperty] = {
185
- ...this._instanceConstructor[regionsProperty],
186
- region: { targetId, name: this.name },
187
- };
188
- }
189
- }
190
-
191
- /**
192
- * Renders nothing because we create the container div manually in connectedCallback.
193
- * This is necessary because the mixin needs the div to exist before it tries to create the region.
194
- */
195
- render() {
196
- // Don't render anything - the container is created in connectedCallback
197
- return html``;
198
- }
199
- }