@uxland/primary-shell 7.46.5 → 8.0.0-rc.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/{component-k6kJh8kr.js → component-Bt_gBs5e.js} +2 -2
- package/dist/{component-k6kJh8kr.js.map → component-Bt_gBs5e.js.map} +1 -1
- package/dist/index-8n9_rIYI.js +43971 -0
- package/dist/index-8n9_rIYI.js.map +1 -0
- package/dist/index.js +16 -20
- package/dist/index.umd.cjs +5900 -7599
- package/dist/index.umd.cjs.map +1 -1
- package/dist/{plugin-B_mTXVZ2.js → plugin-B5E6LZ4X.js} +833 -860
- package/dist/{plugin-B_mTXVZ2.js.map → plugin-B5E6LZ4X.js.map} +1 -1
- package/dist/primary/shell/src/api/api.d.ts +0 -2
- package/dist/primary/shell/src/api/interaction-service/interaction-service-impl.d.ts +1 -1
- package/dist/primary/shell/src/api/region-manager/regions.d.ts +0 -1
- package/dist/primary/shell/src/features/exit/handler.d.ts +0 -1
- package/dist/primary/shell/src/index.d.ts +0 -1
- package/dist/primary/shell/src/locales.d.ts +0 -4
- package/dist/styles.css +1 -1
- package/package.json +11 -11
- package/src/UI/components/bootstrapper.ts +0 -2
- package/src/UI/components/primaria-shell/shell-header/template.ts +6 -14
- package/src/UI/components/primaria-shell/template.ts +5 -5
- package/src/UI/shared-components/primaria-character-limit-badge/primaria-character-limit-badge.ts +2 -2
- package/src/UI/shared-components/primaria-nav-tree-menu/template.ts +1 -1
- package/src/api/api.ts +2 -6
- package/src/api/interaction-service/interaction-service-impl.tsx +20 -34
- package/src/api/pdf-viewer-manager/pdf-visor/pdf-selector/template.ts +6 -8
- package/src/api/region-manager/regions.ts +1 -6
- package/src/features/exit/handler.test.ts +0 -60
- package/src/features/exit/handler.ts +0 -23
- package/src/index.ts +2 -1
- package/src/locales.ts +0 -4
- package/dist/index-s-pcmNUD.js +0 -46127
- package/dist/index-s-pcmNUD.js.map +0 -1
- package/dist/primary/shell/src/UI/components/quick-actions-menu/quick-actions-menu.d.ts +0 -8
- package/dist/primary/shell/src/UI/components/quick-actions-menu/template.d.ts +0 -2
- package/dist/primary/shell/src/api/plugin-busy-manager/plugin-busy-list/component.d.ts +0 -9
- package/dist/primary/shell/src/api/plugin-busy-manager/plugin-busy-list/template.d.ts +0 -2
- package/dist/primary/shell/src/api/plugin-busy-manager/plugin-busy-manager.d.ts +0 -26
- package/dist/primary/shell/src/api/plugin-busy-manager/plugin-busy-manager.test.d.ts +0 -1
- package/src/UI/components/quick-actions-menu/quick-actions-menu.ts +0 -54
- package/src/UI/components/quick-actions-menu/template.ts +0 -10
- package/src/api/plugin-busy-manager/plugin-busy-list/component.ts +0 -16
- package/src/api/plugin-busy-manager/plugin-busy-list/styles.css +0 -27
- package/src/api/plugin-busy-manager/plugin-busy-list/template.ts +0 -20
- package/src/api/plugin-busy-manager/plugin-busy-manager.test.ts +0 -72
- package/src/api/plugin-busy-manager/plugin-busy-manager.ts +0 -57
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxland/primary-shell",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-rc.0",
|
|
4
4
|
"description": "Primaria Shell",
|
|
5
5
|
"author": "UXLand <dev@uxland.es>",
|
|
6
6
|
"homepage": "https://github.com/uxland/harmonix/tree/app#readme",
|
|
@@ -21,6 +21,14 @@
|
|
|
21
21
|
"type": "git",
|
|
22
22
|
"url": "git+https://github.com/uxland/harmonix.git"
|
|
23
23
|
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"serve": "vite",
|
|
26
|
+
"start": "ng serve --host 0.0.0.0",
|
|
27
|
+
"build": "vite build",
|
|
28
|
+
"preview": "vite preview",
|
|
29
|
+
"publish-rc": "npm publish --tag rc",
|
|
30
|
+
"test": "vitest"
|
|
31
|
+
},
|
|
24
32
|
"bugs": {
|
|
25
33
|
"url": "https://github.com/uxland/harmonix/issues"
|
|
26
34
|
},
|
|
@@ -30,7 +38,7 @@
|
|
|
30
38
|
},
|
|
31
39
|
"devDependencies": {
|
|
32
40
|
"@primaria/plugins-core": "^1.0.14",
|
|
33
|
-
"@salut/design-system-salut": "../../design-system-salut-
|
|
41
|
+
"@salut/design-system-salut": "../../design-system-salut-3.0.2.tgz",
|
|
34
42
|
"@types/react": "^19.0.12",
|
|
35
43
|
"@uxland/lit-utilities": "^1.0.0",
|
|
36
44
|
"@uxland/localization": "^1.0.3",
|
|
@@ -48,13 +56,5 @@
|
|
|
48
56
|
"tslib": "^2.3.0",
|
|
49
57
|
"uxl-quill": "^1.0.1",
|
|
50
58
|
"vite": "^7.0.0"
|
|
51
|
-
},
|
|
52
|
-
"scripts": {
|
|
53
|
-
"serve": "vite",
|
|
54
|
-
"start": "ng serve --host 0.0.0.0",
|
|
55
|
-
"build": "vite build",
|
|
56
|
-
"preview": "vite preview",
|
|
57
|
-
"publish-rc": "npm publish --tag rc",
|
|
58
|
-
"test": "vitest"
|
|
59
59
|
}
|
|
60
|
-
}
|
|
60
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { customElement } from "lit/decorators.js";
|
|
2
2
|
import { PrimariaShell } from "./primaria-shell/primaria-shell";
|
|
3
3
|
import { PrimariaErrorView } from "./error-view/component";
|
|
4
|
-
import { QuickActionsMenu } from "./quick-actions-menu/quick-actions-menu";
|
|
5
4
|
import { PrimariaShellHeader } from "./primaria-shell/shell-header/shell-header";
|
|
6
5
|
import { PocEventsEcap } from "./poc-events-ecap/poc-events-ecap";
|
|
7
6
|
import { PrimariaAccordion } from "./primaria-accordion/primaria-accordion";
|
|
@@ -16,7 +15,6 @@ export const useComponents = () => {
|
|
|
16
15
|
//@ts-ignore
|
|
17
16
|
customElement("primaria-shell-header")(PrimariaShellHeader);
|
|
18
17
|
customElement("primaria-error-view")(PrimariaErrorView);
|
|
19
|
-
customElement("quick-actions-menu")(QuickActionsMenu);
|
|
20
18
|
customElement('header-divider')(HeaderDivider);
|
|
21
19
|
//@ts-ignore
|
|
22
20
|
customElement("communication-action-menu")(CommunicationActionMenu);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html
|
|
1
|
+
import { html } from "lit";
|
|
2
2
|
import salutLogo from "../../../../UI/images/Salut_Logotip.svg";
|
|
3
3
|
import { PrimariaShellHeader } from "./shell-header";
|
|
4
4
|
import { when } from "lit/directives/when.js";
|
|
@@ -8,6 +8,7 @@ export const template = (props: PrimariaShellHeader) => {
|
|
|
8
8
|
const workCenterElements = [{ label: props.professional?.workCenter, value: "1" }];
|
|
9
9
|
const roleElements = [{ label: props.professional?.role, value: "1" }];
|
|
10
10
|
const specialityElements = [{ label: props.professional?.speciality, value: "1" }];
|
|
11
|
+
const selectedValue = ["1"];
|
|
11
12
|
|
|
12
13
|
return html`
|
|
13
14
|
<div class="header">
|
|
@@ -23,20 +24,11 @@ export const template = (props: PrimariaShellHeader) => {
|
|
|
23
24
|
<header-divider></header-divider>
|
|
24
25
|
${when(
|
|
25
26
|
props.professional,
|
|
26
|
-
() => html`<dss-header-menu-professional
|
|
27
|
+
() => html`<dss-header-menu-professional hideViewDetails @primary-action=${props.logout} name="${props.professional.firstName} ${props.professional?.familyName} ${props.professional?.lastName}" center="${props.professional.workCenter}" collegiate="${props.professional.registrationNumber}">
|
|
27
28
|
<dss-avatar size="xl" name="${props.professional.firstName}" surname="${props.professional?.familyName}" slot="avatar"></dss-avatar>
|
|
28
|
-
<dss-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</dss-input-dropdown>
|
|
32
|
-
<dss-input-dropdown icon="business_center" type="default" .elements=${roleElements} selectedvalue="["1"]">
|
|
33
|
-
<label slot="label" for="preferences2">${translate("header.role")}</label>
|
|
34
|
-
<input id="preferences2" slot="input" type="text" class="dss-input" readonly="">
|
|
35
|
-
</dss-input-dropdown>
|
|
36
|
-
<dss-input-dropdown icon="people_alt" type="default" .elements=${specialityElements} selectedvalue="["1"]">
|
|
37
|
-
<label slot="label" for="preferences3">${translate("header.speciality")}</label>
|
|
38
|
-
<input id="preferences3" slot="input" type="text" class="dss-input" readonly="">
|
|
39
|
-
</dss-input-dropdown>
|
|
29
|
+
<dss-select icon="maps_home_work" label=${translate("header.workCenter")} .elements=${workCenterElements} .selectedValue=${selectedValue} readonly></dss-select>
|
|
30
|
+
<dss-select icon="business_center" label=${translate("header.role")} .elements=${roleElements} .selectedValue=${selectedValue} readonly></dss-select>
|
|
31
|
+
<dss-select icon="people_alt" label=${translate("header.speciality")} .elements=${specialityElements} .selectedValue=${selectedValue} readonly></dss-select>
|
|
40
32
|
</dss-header-menu-professional>`,
|
|
41
33
|
)}
|
|
42
34
|
</div>
|
|
@@ -17,10 +17,10 @@ export const template = (props: PrimariaShell) => html`
|
|
|
17
17
|
<div id="menu-region-container"></div>
|
|
18
18
|
<!-- <primaria-region id="menu-region" name=${shellApi.regionManager.regions.shell.navigationMenu}></primaria-region> -->
|
|
19
19
|
<div class="quick-actions-content">
|
|
20
|
-
<
|
|
21
|
-
<div class="${props.sidebarExpanded ? "create-button-opened" : "create-button-closed"} "
|
|
20
|
+
<span>
|
|
21
|
+
<div class="${props.sidebarExpanded ? "create-button-opened" : "create-button-closed"} ">
|
|
22
22
|
<div class="${props.quickActionBusy ? "create-button-icon-badge" : ""}">
|
|
23
|
-
${props.quickActionBusy ? html`<dss-notification-badge
|
|
23
|
+
${props.quickActionBusy ? html`<dss-notification-badge variant="sidemenu" inverted dot></dss-notification-badge>` : nothing}
|
|
24
24
|
<dss-icon class="${props.sidebarExpanded ? "icon" : ""}" icon="add_circle_outline" size="md"></dss-icon>
|
|
25
25
|
</div>
|
|
26
26
|
${props.sidebarExpanded ? translate("actions.create") : nothing}
|
|
@@ -32,8 +32,8 @@ export const template = (props: PrimariaShell) => html`
|
|
|
32
32
|
: nothing
|
|
33
33
|
}
|
|
34
34
|
</div>
|
|
35
|
-
<dss-action-menu id="quick-actions-region-container"
|
|
36
|
-
</
|
|
35
|
+
<dss-action-menu id="quick-actions-region-container"></dss-action-menu>
|
|
36
|
+
</span>
|
|
37
37
|
</div>
|
|
38
38
|
<div class="bottom-content">
|
|
39
39
|
<div class="bottom-content-first">
|
package/src/UI/shared-components/primaria-character-limit-badge/primaria-character-limit-badge.ts
CHANGED
|
@@ -16,9 +16,9 @@ export class PrimariaCharacterLimitBadge extends LitElement {
|
|
|
16
16
|
return html`
|
|
17
17
|
<dss-alert
|
|
18
18
|
class="limit-alert"
|
|
19
|
-
|
|
19
|
+
status="warning"
|
|
20
20
|
size="md"
|
|
21
|
-
|
|
21
|
+
titleText="${this.label} ${this.characterCount}/${this.characterLimit}"
|
|
22
22
|
></dss-alert>
|
|
23
23
|
`;
|
|
24
24
|
}
|
|
@@ -9,7 +9,7 @@ export const template = (props: PrimariaNavTreeMenu) => html`
|
|
|
9
9
|
class="${classMap({ "menu-active": props.showActionMenu })}"
|
|
10
10
|
></primaria-nav-item>
|
|
11
11
|
<dss-action-menu
|
|
12
|
-
@
|
|
12
|
+
@close=${props.handleCloseMenu}
|
|
13
13
|
?hidden=${!props.showActionMenu}
|
|
14
14
|
>
|
|
15
15
|
${props.config.actionMenuItems?.map((item) =>
|
package/src/api/api.ts
CHANGED
|
@@ -9,12 +9,11 @@ import { createActivityMonitor } from "./activity-monitor/activity-monitor";
|
|
|
9
9
|
import { HttpClient, createHttpClient } from "./http-client/http-client";
|
|
10
10
|
import { PrimariaInteractionService } from "./interaction-service";
|
|
11
11
|
import { createSessionRefreshTimer } from "./session-refresh-timer/session-refresh-timer";
|
|
12
|
-
import {
|
|
12
|
+
import { PrimariaInteractionServiceImpl } from "./interaction-service/interaction-service-impl";
|
|
13
13
|
import { createLocaleManager } from "./localization/localization";
|
|
14
14
|
import { PrimariaNotificationService } from "./notification-service/notification-service";
|
|
15
15
|
import { PrimariaNotificationServiceImpl } from "./notification-service/notification.service-impl";
|
|
16
16
|
import { PdfViewerManager, createPdfViewerManager } from "./pdf-viewer-manager/pdf-viewer-manager";
|
|
17
|
-
import { PluginBusyManager, PluginBusyManagerImpl } from "./plugin-busy-manager/plugin-busy-manager";
|
|
18
17
|
import { QuickActionBusyManager, QuickActionBusyManagerImpl } from "./quick-action-busy-manager/quick-action-busy-manager";
|
|
19
18
|
import { PrimariaRegionManager, createRegionManagerProxy } from "./region-manager/region-manager";
|
|
20
19
|
import { TokenManager, createTokenManager } from "./token-manager/token-manager";
|
|
@@ -35,7 +34,6 @@ export interface PrimariaApi extends HarmonixApi {
|
|
|
35
34
|
tokenManager: TokenManager;
|
|
36
35
|
userManager: UserManager;
|
|
37
36
|
ecapEventManager: EcapEventManager;
|
|
38
|
-
pluginBusyManager: PluginBusyManager;
|
|
39
37
|
exitGuardManager: ExitGuardManager;
|
|
40
38
|
quickActionBusyManager: QuickActionBusyManager;
|
|
41
39
|
pdfViewerManager: PdfViewerManager;
|
|
@@ -50,10 +48,9 @@ export const activityMonitor = createActivityMonitor();
|
|
|
50
48
|
export const sessionRefreshTimer = createSessionRefreshTimer(tokenManager, activityMonitor);
|
|
51
49
|
const globalStateManager: PrimariaGlobalStateManager = createGlobalStateManager(broker);
|
|
52
50
|
const contextManager = createContextManager();
|
|
53
|
-
const pluginBusyManager = new PluginBusyManagerImpl();
|
|
54
51
|
const exitGuardManager = new ExitGuardManagerImpl();
|
|
55
52
|
const quickActionBusyManager = new QuickActionBusyManagerImpl(broker);
|
|
56
|
-
const interactionService = new
|
|
53
|
+
const interactionService = new PrimariaInteractionServiceImpl();
|
|
57
54
|
const notificationService = new PrimariaNotificationServiceImpl();
|
|
58
55
|
const ecapEventManager = createEcapEventManager(globalStateManager);
|
|
59
56
|
const pdfViewerManager = createPdfViewerManager(broker, notificationService);
|
|
@@ -79,7 +76,6 @@ export const primariaApiFactory: ApiFactory<PrimariaApi> = (pluginInfo: PluginIn
|
|
|
79
76
|
tokenManager,
|
|
80
77
|
userManager,
|
|
81
78
|
ecapEventManager,
|
|
82
|
-
pluginBusyManager,
|
|
83
79
|
exitGuardManager,
|
|
84
80
|
quickActionBusyManager,
|
|
85
81
|
interactionService,
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfirmationOptions,
|
|
3
|
-
ConfirmationResult,
|
|
4
|
-
ConfirmComponentUI,
|
|
5
|
-
PrimariaInteractionService,
|
|
6
|
-
} from "./interaction-service";
|
|
1
|
+
import { ConfirmationOptions, ConfirmationResult, ConfirmComponentUI, PrimariaInteractionService } from "./interaction-service";
|
|
7
2
|
import * as React from "react";
|
|
8
3
|
import { useEffect, useState, useRef } from "react";
|
|
9
4
|
import { createRoot } from "react-dom/client";
|
|
10
5
|
import { ConfirmationMessage } from "./confirmation-message.tsx";
|
|
11
|
-
import modalStyles from
|
|
6
|
+
import modalStyles from "./modal-styles.css?raw";
|
|
12
7
|
|
|
13
8
|
const defaultOptions: ConfirmationOptions = {
|
|
14
9
|
title: "Confirmació",
|
|
@@ -19,16 +14,16 @@ const defaultOptions: ConfirmationOptions = {
|
|
|
19
14
|
showCloseButton: true,
|
|
20
15
|
fullCustomization: false,
|
|
21
16
|
closeOnOutsideClick: false,
|
|
22
|
-
hideIcon: false
|
|
17
|
+
hideIcon: false,
|
|
23
18
|
};
|
|
24
19
|
|
|
25
|
-
export class
|
|
20
|
+
export class PrimariaInteractionServiceImpl extends PrimariaInteractionService {
|
|
26
21
|
private readonly openDialogCancellers = new Set<() => void>();
|
|
27
22
|
|
|
28
23
|
confirm<TData = undefined, TResult = undefined>(
|
|
29
24
|
data: TData | undefined,
|
|
30
25
|
componentUI: ConfirmComponentUI<TData, TResult>,
|
|
31
|
-
options?: ConfirmationOptions | undefined
|
|
26
|
+
options?: ConfirmationOptions | undefined,
|
|
32
27
|
): Promise<ConfirmationResult<TResult | undefined>> {
|
|
33
28
|
const finalOptions: ConfirmationOptions = { ...defaultOptions, ...(options || {}) };
|
|
34
29
|
const { openDialogCancellers } = this;
|
|
@@ -42,7 +37,7 @@ export class ParimariaInteractionServiceImpl extends PrimariaInteractionService
|
|
|
42
37
|
const DialogComponent = componentUI.component;
|
|
43
38
|
const DialogComponentStyles = componentUI.styles;
|
|
44
39
|
let componentHeadStyles;
|
|
45
|
-
if(DialogComponentStyles) {
|
|
40
|
+
if (DialogComponentStyles) {
|
|
46
41
|
componentHeadStyles = document.createElement("style");
|
|
47
42
|
componentHeadStyles.textContent = componentUI?.styles;
|
|
48
43
|
document.head.appendChild(componentHeadStyles);
|
|
@@ -55,13 +50,12 @@ export class ParimariaInteractionServiceImpl extends PrimariaInteractionService
|
|
|
55
50
|
const dialogRef = useRef<HTMLDivElement>(null);
|
|
56
51
|
const modalRef = useRef<HTMLDivElement>(null);
|
|
57
52
|
|
|
58
|
-
const isWebComponent =
|
|
59
|
-
typeof DialogComponent === "function" && DialogComponent.prototype instanceof HTMLElement;
|
|
53
|
+
const isWebComponent = typeof DialogComponent === "function" && DialogComponent.prototype instanceof HTMLElement;
|
|
60
54
|
|
|
61
55
|
useEffect(() => {
|
|
62
|
-
window.addEventListener(
|
|
56
|
+
window.addEventListener("keydown", handleKeydown);
|
|
63
57
|
|
|
64
|
-
return () => window.removeEventListener(
|
|
58
|
+
return () => window.removeEventListener("keydown", handleKeydown);
|
|
65
59
|
}, []);
|
|
66
60
|
|
|
67
61
|
useEffect(() => {
|
|
@@ -75,7 +69,7 @@ export class ParimariaInteractionServiceImpl extends PrimariaInteractionService
|
|
|
75
69
|
}, []);
|
|
76
70
|
|
|
77
71
|
const handleKeydown = (event: KeyboardEvent) => {
|
|
78
|
-
if (event.key ===
|
|
72
|
+
if (event.key === "Escape") {
|
|
79
73
|
handleClose(false);
|
|
80
74
|
}
|
|
81
75
|
};
|
|
@@ -132,8 +126,7 @@ export class ParimariaInteractionServiceImpl extends PrimariaInteractionService
|
|
|
132
126
|
root.unmount();
|
|
133
127
|
document.body.removeChild(div);
|
|
134
128
|
document.head.removeChild(wrapperHeadStyles);
|
|
135
|
-
if (DialogComponentStyles)
|
|
136
|
-
document.head.removeChild(componentHeadStyles);
|
|
129
|
+
if (DialogComponentStyles) document.head.removeChild(componentHeadStyles);
|
|
137
130
|
}, 300);
|
|
138
131
|
};
|
|
139
132
|
|
|
@@ -176,7 +169,7 @@ export class ParimariaInteractionServiceImpl extends PrimariaInteractionService
|
|
|
176
169
|
);
|
|
177
170
|
};
|
|
178
171
|
return (
|
|
179
|
-
<div className="modal" ref={modalRef} onClick={handleOutsideClick}
|
|
172
|
+
<div className="modal" ref={modalRef} onClick={handleOutsideClick}>
|
|
180
173
|
<div className="dialog" ref={dialogRef}>
|
|
181
174
|
{!finalOptions.fullCustomization && (
|
|
182
175
|
<div className="dss-dialog-header">
|
|
@@ -195,23 +188,20 @@ export class ParimariaInteractionServiceImpl extends PrimariaInteractionService
|
|
|
195
188
|
</div>
|
|
196
189
|
{finalOptions.showCloseButton && (
|
|
197
190
|
<dss-icon-button
|
|
198
|
-
class="dss-dialog-header-close"
|
|
199
|
-
size="md"
|
|
200
|
-
variant="neutral"
|
|
201
|
-
icon="close"
|
|
191
|
+
class="dss-dialog-header-close"
|
|
192
|
+
size="md"
|
|
193
|
+
variant="neutral"
|
|
194
|
+
icon="close"
|
|
202
195
|
onClick={() => handleClose(false)}
|
|
203
196
|
></dss-icon-button>
|
|
204
197
|
)}
|
|
205
198
|
</div>
|
|
206
199
|
)}
|
|
207
|
-
<div className={`modal-content ${finalOptions.fullCustomization ?
|
|
200
|
+
<div className={`modal-content ${finalOptions.fullCustomization ? "full-customization" : ""}`}>
|
|
208
201
|
{_renderContent()}
|
|
209
202
|
</div>
|
|
210
203
|
{!finalOptions.fullCustomization && (
|
|
211
|
-
<div
|
|
212
|
-
className="dss-modal-footer"
|
|
213
|
-
hidden={!finalOptions.showCancelButton && !finalOptions.showConfirmButton}
|
|
214
|
-
>
|
|
204
|
+
<div className="dss-modal-footer" hidden={!finalOptions.showCancelButton && !finalOptions.showConfirmButton}>
|
|
215
205
|
{finalOptions.showCancelButton && (
|
|
216
206
|
<dss-button
|
|
217
207
|
label={finalOptions.cancelButtonText}
|
|
@@ -238,17 +228,13 @@ export class ParimariaInteractionServiceImpl extends PrimariaInteractionService
|
|
|
238
228
|
);
|
|
239
229
|
};
|
|
240
230
|
|
|
241
|
-
|
|
242
231
|
const root = createRoot(div);
|
|
243
232
|
root.render(<DialogWrapper />);
|
|
244
233
|
});
|
|
245
234
|
}
|
|
246
235
|
|
|
247
|
-
confirmMessage(
|
|
248
|
-
message:
|
|
249
|
-
options?: ConfirmationOptions | undefined,
|
|
250
|
-
): Promise<ConfirmationResult> {
|
|
251
|
-
return this.confirm(message, {component: ConfirmationMessage}, options);
|
|
236
|
+
confirmMessage(message: string, options?: ConfirmationOptions | undefined): Promise<ConfirmationResult> {
|
|
237
|
+
return this.confirm(message, { component: ConfirmationMessage }, options);
|
|
252
238
|
}
|
|
253
239
|
|
|
254
240
|
dispose(): void {
|
|
@@ -7,14 +7,12 @@ export const template = (props: PdfSelector) => {
|
|
|
7
7
|
const pdfitem = (pdf: IPdfDocument) => {
|
|
8
8
|
return html`
|
|
9
9
|
<div class="pdf-item">
|
|
10
|
-
<dss-checkbox
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
>
|
|
17
|
-
</dss-checkbox>
|
|
10
|
+
<dss-checkbox
|
|
11
|
+
hideLabel
|
|
12
|
+
label=${pdf.data.name || "Sense nom"}
|
|
13
|
+
?checked=${props.activePdfs.some((p) => p.id === pdf.id)}
|
|
14
|
+
@change=${() => props.setActivePdf(pdf.id)}
|
|
15
|
+
></dss-checkbox>
|
|
18
16
|
<div class="container">
|
|
19
17
|
<dss-icon-button class="close-button" size="md" variant="error" icon="close" @click=${() => props.removePdf(pdf.id)}></dss-icon-button>
|
|
20
18
|
<div class="data">
|
|
@@ -22,14 +22,9 @@ export const clinicalMonitoringRegions = {
|
|
|
22
22
|
export const activityHistoryRegions = {
|
|
23
23
|
customFilters: "clinical-monitoring-activity-history-filters-region",
|
|
24
24
|
};
|
|
25
|
+
|
|
25
26
|
export const administrativeManagementRegions = {
|
|
26
27
|
widgets: "administrative-management-widgets-region",
|
|
27
28
|
tabs: "administrative-management-tabs-region",
|
|
28
29
|
detail: "administrative-management-detail-region",
|
|
29
30
|
};
|
|
30
|
-
|
|
31
|
-
export type PrimariaRegionNames =
|
|
32
|
-
| (typeof shellRegions)[keyof typeof shellRegions]
|
|
33
|
-
| (typeof clinicalMonitoringRegions)[keyof typeof clinicalMonitoringRegions]
|
|
34
|
-
| (typeof activityHistoryRegions)[keyof typeof activityHistoryRegions]
|
|
35
|
-
| (typeof administrativeManagementRegions)[keyof typeof administrativeManagementRegions];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
2
|
import { PrimariaApi } from "../../api/api";
|
|
3
|
-
import { PluginBusyList } from "../../api/plugin-busy-manager/plugin-busy-list/component";
|
|
4
3
|
import { disposeShell, raiseCloseEvent, raiseCustomCloseEvent } from "../../disposer";
|
|
5
4
|
import { disposePlugins } from "../../handle-plugins";
|
|
6
5
|
import { ExitShellHandler } from "./handler";
|
|
@@ -21,12 +20,6 @@ const createMockApi = (): PrimariaApi =>
|
|
|
21
20
|
exitGuardManager: {
|
|
22
21
|
canExit: vi.fn().mockResolvedValue(true),
|
|
23
22
|
},
|
|
24
|
-
pluginBusyManager: {
|
|
25
|
-
getTasks: vi.fn().mockReturnValue([]),
|
|
26
|
-
},
|
|
27
|
-
interactionService: {
|
|
28
|
-
confirm: vi.fn(),
|
|
29
|
-
},
|
|
30
23
|
notificationService: {
|
|
31
24
|
error: vi.fn(),
|
|
32
25
|
},
|
|
@@ -127,57 +120,4 @@ describe("ExitShellHandler", () => {
|
|
|
127
120
|
expect(raiseCloseEvent).toHaveBeenCalled();
|
|
128
121
|
expect(raiseCustomCloseEvent).not.toHaveBeenCalled();
|
|
129
122
|
});
|
|
130
|
-
|
|
131
|
-
describe("legacy pluginBusyManager fallback", () => {
|
|
132
|
-
it("asks for confirmation when canExit allows but legacy busy tasks exist", async () => {
|
|
133
|
-
const busyTasks = [{ taskId: "t1", taskDescription: "saving draft" }];
|
|
134
|
-
const message = { ecapEvent: {} } as ExitShell;
|
|
135
|
-
(mockApi.exitGuardManager.canExit as any).mockResolvedValue(true);
|
|
136
|
-
(mockApi.pluginBusyManager.getTasks as any).mockReturnValue(busyTasks);
|
|
137
|
-
(mockApi.interactionService.confirm as any).mockResolvedValue({ confirmed: true });
|
|
138
|
-
(disposePlugins as any).mockResolvedValue(undefined);
|
|
139
|
-
|
|
140
|
-
await handler.handle(message);
|
|
141
|
-
|
|
142
|
-
expect(mockApi.interactionService.confirm).toHaveBeenCalledWith(
|
|
143
|
-
{ busyTasks },
|
|
144
|
-
{ component: PluginBusyList },
|
|
145
|
-
{
|
|
146
|
-
title: "actions.askExit",
|
|
147
|
-
state: "error",
|
|
148
|
-
confirmButtonText: "Sí",
|
|
149
|
-
cancelButtonText: "No",
|
|
150
|
-
},
|
|
151
|
-
);
|
|
152
|
-
expect(disposePlugins).toHaveBeenCalled();
|
|
153
|
-
expect(disposeShell).toHaveBeenCalled();
|
|
154
|
-
expect(raiseCustomCloseEvent).toHaveBeenCalledWith(message);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it("aborts the exit when the legacy busy-task confirmation is declined", async () => {
|
|
158
|
-
const busyTasks = [{ taskId: "t1", taskDescription: "saving draft" }];
|
|
159
|
-
const message = { ecapEvent: {} } as ExitShell;
|
|
160
|
-
(mockApi.exitGuardManager.canExit as any).mockResolvedValue(true);
|
|
161
|
-
(mockApi.pluginBusyManager.getTasks as any).mockReturnValue(busyTasks);
|
|
162
|
-
(mockApi.interactionService.confirm as any).mockResolvedValue({ confirmed: false });
|
|
163
|
-
|
|
164
|
-
await handler.handle(message);
|
|
165
|
-
|
|
166
|
-
expect(mockApi.interactionService.confirm).toHaveBeenCalled();
|
|
167
|
-
expect(disposePlugins).not.toHaveBeenCalled();
|
|
168
|
-
expect(disposeShell).not.toHaveBeenCalled();
|
|
169
|
-
expect(raiseCustomCloseEvent).not.toHaveBeenCalled();
|
|
170
|
-
expect(raiseCloseEvent).not.toHaveBeenCalled();
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it("does not consult legacy busy tasks when an ExitGuard already vetoed the exit", async () => {
|
|
174
|
-
const message = { ecapEvent: {} } as ExitShell;
|
|
175
|
-
(mockApi.exitGuardManager.canExit as any).mockResolvedValue(false);
|
|
176
|
-
|
|
177
|
-
await handler.handle(message);
|
|
178
|
-
|
|
179
|
-
expect(mockApi.pluginBusyManager.getTasks).not.toHaveBeenCalled();
|
|
180
|
-
expect(mockApi.interactionService.confirm).not.toHaveBeenCalled();
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
123
|
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { inject } from "inversify";
|
|
2
2
|
import { PrimariaApi } from "../../api/api";
|
|
3
|
-
import { PluginBusyList } from "../../api/plugin-busy-manager/plugin-busy-list/component";
|
|
4
|
-
import { PluginTask } from "../../api/plugin-busy-manager/plugin-busy-manager";
|
|
5
3
|
import { disposeShell, raiseCloseEvent, raiseCustomCloseEvent } from "../../disposer";
|
|
6
4
|
import { disposePlugins } from "../../handle-plugins";
|
|
7
5
|
import { TYPES } from "../../infrastructure/ioc/types";
|
|
@@ -17,14 +15,6 @@ export class ExitShellHandler {
|
|
|
17
15
|
const canExit = await this.api.exitGuardManager.canExit();
|
|
18
16
|
if (!canExit) return;
|
|
19
17
|
|
|
20
|
-
// Backwards-compat: external plugins still using the deprecated pluginBusyManager
|
|
21
|
-
// would otherwise lose their exit-confirmation modal. Remove once all consumers migrate.
|
|
22
|
-
const busyTasks = this.api.pluginBusyManager.getTasks();
|
|
23
|
-
if (busyTasks.length > 0) {
|
|
24
|
-
const { confirmed } = await this.askForClose(busyTasks);
|
|
25
|
-
if (!confirmed) return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
18
|
// Per si un plugin tarda molt en fer dispose, màxim deixarem 5 segons, per no interrompre el tancar infinitament
|
|
29
19
|
await Promise.race([
|
|
30
20
|
disposePlugins(), // S'intenta executar un dispose normal
|
|
@@ -42,19 +32,6 @@ export class ExitShellHandler {
|
|
|
42
32
|
return new Promise<void>((resolve) => setTimeout(resolve, ms));
|
|
43
33
|
}
|
|
44
34
|
|
|
45
|
-
private askForClose(busyTasks: PluginTask[]) {
|
|
46
|
-
return this.api.interactionService.confirm(
|
|
47
|
-
{ busyTasks },
|
|
48
|
-
{ component: PluginBusyList },
|
|
49
|
-
{
|
|
50
|
-
title: translate("actions.askExit"),
|
|
51
|
-
state: "error",
|
|
52
|
-
confirmButtonText: "Sí",
|
|
53
|
-
cancelButtonText: "No",
|
|
54
|
-
},
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
35
|
private emitClose(exitEvent?: ExitShell): void {
|
|
59
36
|
if (exitEvent) {
|
|
60
37
|
raiseCustomCloseEvent(exitEvent);
|
package/src/index.ts
CHANGED
|
@@ -10,10 +10,11 @@ if (typeof document !== "undefined") {
|
|
|
10
10
|
}
|
|
11
11
|
export * from "./bootstrapper";
|
|
12
12
|
export * from "./disposer";
|
|
13
|
-
export * from "./api/region-manager/regions";
|
|
14
13
|
export * from "./handle-plugins";
|
|
15
14
|
// Superfície pública explícita: `primariaApiFactory`, `activityMonitor` i
|
|
16
15
|
// `sessionRefreshTimer` són singletons interns del shell i no s'exposen.
|
|
16
|
+
// Les constants de regió (`shellRegions`, `clinicalMonitoringRegions`...) tampoc:
|
|
17
|
+
// des de la v8 els plugins han d'usar `api.regionManager.regions.*`.
|
|
17
18
|
// `shellApi` es manté només perquè els hosts (app/sandbox) l'usen per arrencar;
|
|
18
19
|
// els plugins han d'usar l'`api` que reben a `initialize(api)`.
|
|
19
20
|
export type { PrimariaApi } from "./api/api";
|
package/src/locales.ts
CHANGED
|
@@ -35,7 +35,6 @@ export const locales = {
|
|
|
35
35
|
create: "Crear",
|
|
36
36
|
toggleMenuClose: "Tancar menú",
|
|
37
37
|
toggleMenuOpen: "Expandir menú",
|
|
38
|
-
askExit: "Atenció, vols sortir igualment?",
|
|
39
38
|
},
|
|
40
39
|
errors: {
|
|
41
40
|
session: "Hi ha hagut un error amb la sessió. Siusplau, tanca i torna a obrir l'aplicació.",
|
|
@@ -47,9 +46,6 @@ export const locales = {
|
|
|
47
46
|
role: "Tipus de profesional",
|
|
48
47
|
speciality: "Àmbit treball",
|
|
49
48
|
},
|
|
50
|
-
busyManager: {
|
|
51
|
-
title: "Tasques pendents:",
|
|
52
|
-
},
|
|
53
49
|
pdfManager: {
|
|
54
50
|
uploaded: "Document disponible al visor de resultats",
|
|
55
51
|
alreadyUploaded: "Ja s'ha carregat un document amb aquest nom",
|