@uxland/primary-shell 4.3.0 → 5.0.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.
Files changed (75) hide show
  1. package/dist/index.js +19094 -19009
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.umd.cjs +1673 -1567
  4. package/dist/index.umd.cjs.map +1 -1
  5. package/dist/primary/shell/src/UI/components/primaria-shell/primaria-shell.d.ts +3 -0
  6. package/dist/primary/shell/src/UI/components/quick-actions-menu/quick-actions-menu.d.ts +1 -0
  7. package/dist/primary/shell/src/UI/shared-components/index.d.ts +0 -1
  8. package/dist/primary/shell/src/api/api.d.ts +4 -2
  9. package/dist/primary/shell/src/api/http-client/http-client.d.ts +7 -1
  10. package/dist/primary/shell/src/api/interaction-service/confirmation-message.d.ts +3 -0
  11. package/dist/primary/shell/src/api/interaction-service/index.d.ts +1 -0
  12. package/dist/primary/shell/src/api/interaction-service/interaction-service-impl.d.ts +7 -0
  13. package/dist/primary/shell/src/api/interaction-service/interaction-service.d.ts +32 -0
  14. package/dist/primary/shell/src/api/notification-service/notification-service.d.ts +6 -0
  15. package/dist/primary/shell/src/api/notification-service/notification.service-impl.d.ts +9 -0
  16. package/dist/primary/shell/src/api/plugin-busy-manager/plugin-busy-list/component.d.ts +2 -4
  17. package/dist/primary/shell/src/api/region-manager/region-manager.d.ts +1 -0
  18. package/dist/primary/shell/src/events.d.ts +1 -0
  19. package/dist/primary/shell/src/features/bootstrapper.d.ts +1 -1
  20. package/dist/primary/shell/src/index.d.ts +1 -2
  21. package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/export-to-pdf/export-pdf-modal/export-pdf-modal.d.ts +1 -5
  22. package/dist/primary/shell/src/internal-plugins/activity-history/localization.d.ts +0 -1
  23. package/dist/primary/shell/src/locales.d.ts +4 -0
  24. package/dist/style.css +1 -1
  25. package/package.json +5 -2
  26. package/src/UI/components/primaria-shell/primaria-shell.ts +24 -7
  27. package/src/UI/components/quick-actions-menu/quick-actions-menu.ts +13 -3
  28. package/src/UI/shared-components/index.ts +0 -1
  29. package/src/api/api.ts +11 -8
  30. package/src/api/http-client/http-client.test.ts +188 -76
  31. package/src/api/http-client/http-client.ts +62 -11
  32. package/src/api/interaction-service/confirmation-message.tsx +5 -0
  33. package/src/api/interaction-service/index.ts +1 -0
  34. package/src/api/interaction-service/interaction-service-impl.tsx +225 -0
  35. package/src/api/interaction-service/interaction-service.ts +46 -0
  36. package/src/api/notification-service/notification-service.ts +6 -0
  37. package/src/api/notification-service/notification.service-impl.ts +45 -0
  38. package/src/api/plugin-busy-manager/plugin-busy-list/component.ts +3 -4
  39. package/src/api/plugin-busy-manager/plugin-busy-list/template.ts +1 -1
  40. package/src/api/region-manager/region-manager.ts +5 -0
  41. package/src/disposer.ts +1 -1
  42. package/src/events.ts +1 -0
  43. package/src/features/bootstrapper.ts +6 -3
  44. package/src/features/exit/handler.ts +8 -11
  45. package/src/features/get-user-info/handler.ts +3 -4
  46. package/src/index.ts +1 -2
  47. package/src/internal-plugins/activity-history/activity-history-item/export-to-pdf/export-pdf-modal/export-pdf-modal.ts +1 -10
  48. package/src/internal-plugins/activity-history/activity-history-item/export-to-pdf/export-pdf-modal/template.ts +0 -7
  49. package/src/internal-plugins/activity-history/activity-history-item/export-to-pdf/handler.ts +8 -8
  50. package/src/internal-plugins/activity-history/activity-history-item/list/UI/main-view/template.ts +1 -1
  51. package/src/internal-plugins/activity-history/activity-history-item/search/handler.ts +5 -3
  52. package/src/internal-plugins/activity-history/localization.ts +0 -1
  53. package/src/locales.ts +5 -0
  54. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/components/dialog-component.d.ts +0 -19
  55. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/components/notifier-component.d.ts +0 -12
  56. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/confirm-mixin.d.ts +0 -11
  57. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/confirm.d.ts +0 -3
  58. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/index.d.ts +0 -5
  59. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/notify.d.ts +0 -4
  60. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/open-dialog.d.ts +0 -3
  61. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/shared.d.ts +0 -3
  62. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/typings.d.ts +0 -40
  63. package/dist/primary/shell/src/api/interaction-manager/interaction.d.ts +0 -9
  64. package/src/UI/shared-components/primaria-interaction/components/dialog-component-styles.css +0 -104
  65. package/src/UI/shared-components/primaria-interaction/components/dialog-component.ts +0 -138
  66. package/src/UI/shared-components/primaria-interaction/components/notifier-component-styles.css +0 -136
  67. package/src/UI/shared-components/primaria-interaction/components/notifier-component.ts +0 -69
  68. package/src/UI/shared-components/primaria-interaction/confirm-mixin.ts +0 -35
  69. package/src/UI/shared-components/primaria-interaction/confirm.ts +0 -9
  70. package/src/UI/shared-components/primaria-interaction/index.ts +0 -5
  71. package/src/UI/shared-components/primaria-interaction/notify.ts +0 -153
  72. package/src/UI/shared-components/primaria-interaction/open-dialog.ts +0 -8
  73. package/src/UI/shared-components/primaria-interaction/shared.ts +0 -29
  74. package/src/UI/shared-components/primaria-interaction/typings.ts +0 -46
  75. package/src/api/interaction-manager/interaction.ts +0 -26
@@ -0,0 +1,225 @@
1
+ import {
2
+ ConfirmationContentProps,
3
+ ConfirmationOptions,
4
+ ConfirmationResult,
5
+ ConfirmationWithResultContentProps,
6
+ PrimariaInteractionService,
7
+ } from "./interaction-service";
8
+ import * as React from "react";
9
+ import { useEffect, useState, useRef } from "react";
10
+ import { createRoot } from "react-dom/client";
11
+ import { ConfirmationMessage } from "./confirmation-message.tsx";
12
+
13
+ const defaultOptions: ConfirmationOptions = {
14
+ title: "Confirmació",
15
+ showConfirmButton: true,
16
+ showCancelButton: true,
17
+ confirmButtonText: "Acceptar",
18
+ cancelButtonText: "Cancel·lar",
19
+ showCloseButton: true,
20
+ fullWidth: false,
21
+ fullCustomization: false,
22
+ };
23
+
24
+ export class ParimariaInteractionServiceImpl extends PrimariaInteractionService {
25
+ confirm<TData = undefined, TResult = undefined>(
26
+ data: TData | undefined,
27
+ DialogComponent:
28
+ | React.ComponentType<ConfirmationContentProps<TData, TResult> | ConfirmationWithResultContentProps<TData, TResult>>
29
+ | (new () => HTMLElement),
30
+ options?: ConfirmationOptions | undefined,
31
+ ): Promise<ConfirmationResult<TResult | undefined>> {
32
+ const finalOptions: ConfirmationOptions = { ...defaultOptions, ...(options || {}) };
33
+ return new Promise((resolve) => {
34
+ const div = document.createElement("div");
35
+ const shadowRoot = div.attachShadow({ mode: "open" });
36
+
37
+ document.body.appendChild(div);
38
+
39
+ const DialogWrapper = () => {
40
+ const [open, setOpen] = useState(true);
41
+ const [result, setResult] = useState<ConfirmationResult<TResult | undefined>>();
42
+ const [isValid, setIsValid] = useState(true);
43
+ const dssModalComponentRef = useRef(null);
44
+ const dialogComponentRef = useRef(null);
45
+
46
+ const isWebComponent =
47
+ typeof DialogComponent === "function" && DialogComponent.prototype instanceof HTMLElement;
48
+
49
+ useEffect(() => {
50
+ const dssModalComponent = dssModalComponentRef.current;
51
+ const handleCloseDialog = (e: Event) => {
52
+ e.preventDefault();
53
+ handleClose(false);
54
+ };
55
+ dssModalComponent?.addEventListener("onModalClosed", handleCloseDialog);
56
+ return () => {
57
+ document.body.removeChild(div);
58
+ };
59
+ }, []);
60
+
61
+ useEffect(() => {
62
+ if (isWebComponent && dialogComponentRef.current) {
63
+ const parent = dialogComponentRef.current;
64
+
65
+ // ⚠ Aquí creamos la instancia del Web Component manualmente
66
+ const wcElement = new (DialogComponent as any)();
67
+
68
+ // Asignar propiedades manualmente
69
+ (wcElement as any).data = data;
70
+ (wcElement as any).setResult = setResult;
71
+ (wcElement as any).setIsValid = setIsValid;
72
+ (wcElement as any).confirm = () => isValid && handleClose(true);
73
+ (wcElement as any).confirmResult = (result) => isValid && handleCloseWithResult(result);
74
+ (wcElement as any).cancel = () => handleClose(false);
75
+
76
+ // Agregar el Web Component al DOM
77
+ parent.appendChild(wcElement);
78
+
79
+ return () => {
80
+ parent.removeChild(wcElement);
81
+ };
82
+ }
83
+ }, [DialogComponent, data]);
84
+
85
+ const handleClose = (confirmed: boolean) => {
86
+ resolvePromise(result, confirmed);
87
+ };
88
+
89
+ const handleCloseWithResult = (finalResult: TResult) => {
90
+ resolvePromise(finalResult, true);
91
+ };
92
+
93
+ const resolvePromise = (finalResult: TResult, confirmed: boolean) => {
94
+ setOpen(false);
95
+ setTimeout(() => {
96
+ const confirmationResult = {
97
+ result: confirmed ? finalResult : undefined,
98
+ confirmed: confirmed,
99
+ };
100
+ resolve(confirmationResult);
101
+ document.body.removeChild(div);
102
+ }, 300);
103
+ };
104
+
105
+ const getConfirmButtonVariant = () => {
106
+ if (finalOptions.state === "error") return "error";
107
+ if (finalOptions.state === "success") return "success";
108
+ if (finalOptions.state === "info") return "primary";
109
+ if (finalOptions.state === "alert") return "warning";
110
+ return "primary";
111
+ };
112
+
113
+ const getCancelButtonVariant = () => {
114
+ if (finalOptions.state) return "alternative-dark";
115
+ return "secondary";
116
+ };
117
+
118
+ const _renderContent = () => {
119
+ return isWebComponent ? (
120
+ <div ref={dialogComponentRef} />
121
+ ) : (
122
+ <DialogComponent
123
+ {...{
124
+ data,
125
+ setResult,
126
+ setIsValid,
127
+ confirm: () => isValid && handleClose(true),
128
+ cancel: () => handleClose(false),
129
+ }}
130
+ />
131
+ );
132
+ };
133
+
134
+ if (finalOptions.fullCustomization) {
135
+ return (
136
+ <div className="modal" hidden={!open}>
137
+ <div className="dialog">{_renderContent()}</div>
138
+ </div>
139
+ );
140
+ }
141
+ return (
142
+ <dss-modal
143
+ modalTitle={finalOptions.title}
144
+ open={open}
145
+ fullWidth={finalOptions.fullWidth}
146
+ ref={dssModalComponentRef}
147
+ hideCloseIcon={!finalOptions.showCloseButton}
148
+ modalStyle="padding:0px;"
149
+ >
150
+ <div slot="body">{_renderContent()}</div>
151
+ <div
152
+ className="dss-modal-footer"
153
+ slot="footer"
154
+ hidden={!finalOptions.showCancelButton && !finalOptions.showConfirmButton}
155
+ >
156
+ {finalOptions.showCancelButton && (
157
+ <dss-button
158
+ label={finalOptions.cancelButtonText}
159
+ onClick={() => handleClose(false)}
160
+ size="md"
161
+ variant={getCancelButtonVariant()}
162
+ />
163
+ )}
164
+ {finalOptions.showConfirmButton && (
165
+ <dss-button
166
+ onClick={() => isValid && handleClose(true)}
167
+ label={finalOptions.confirmButtonText}
168
+ disabled={!isValid}
169
+ size="md"
170
+ variant={getConfirmButtonVariant()}
171
+ />
172
+ )}
173
+ </div>
174
+ </dss-modal>
175
+ );
176
+ };
177
+
178
+ // Agregar estilos al Shadow DOM
179
+ const style = document.createElement("style");
180
+ style.textContent = `
181
+ .modal {
182
+ font-family: "Open Sans";
183
+ display: block;
184
+ position: fixed;
185
+ z-index: 400;
186
+ left: 0;
187
+ top: 0;
188
+ width: 100%;
189
+ height: 100%;
190
+ background-color: rgba(0, 0, 0, 0.65);
191
+
192
+ .dialog {
193
+ display: flex;
194
+ flex-direction: column;
195
+ position: absolute;
196
+ top: 50%;
197
+ left: 50%;
198
+ transform: translate(-50%, -50%);
199
+ z-index: 21;
200
+ background: #fff;
201
+ border-radius: 16px;
202
+ width: auto;
203
+ height: auto;
204
+ max-height: 95%;
205
+ min-width: 400px;
206
+ box-shadow:
207
+ 0px 0px 14px rgb(0 0 0 / 25%),
208
+ 0px 1px 10px rgb(0 0 0 / 22%);
209
+ }
210
+ }
211
+ `;
212
+
213
+ shadowRoot.appendChild(style);
214
+ const root = createRoot(shadowRoot);
215
+ root.render(<DialogWrapper />);
216
+ });
217
+ }
218
+
219
+ confirmMessage(
220
+ message: string,
221
+ options?: ConfirmationOptions | undefined,
222
+ ): Promise<ConfirmationResult> {
223
+ return this.confirm(message, ConfirmationMessage, options);
224
+ }
225
+ }
@@ -0,0 +1,46 @@
1
+ import * as React from "react";
2
+
3
+ export interface ConfirmationResult<T = undefined> {
4
+ confirmed: boolean;
5
+ result: T | undefined;
6
+ }
7
+
8
+ export interface ConfirmationContentProps<TData, TResult = undefined> {
9
+ data: TData | undefined;
10
+ setResult: (result: TResult) => void;
11
+ setIsValid: (isValid: boolean) => void;
12
+ confirm: () => void;
13
+ cancel: () => void;
14
+ }
15
+
16
+ export interface ConfirmationWithResultContentProps<TData, TResult = undefined> {
17
+ data: TData | undefined;
18
+ confirmResult: (result: TResult) => void;
19
+ cancel: () => void;
20
+ }
21
+
22
+ export interface ConfirmationOptions {
23
+ title?: string | undefined;
24
+ showConfirmButton?: boolean | undefined;
25
+ showCancelButton?: boolean | undefined;
26
+ confirmButtonText?: string | undefined;
27
+ cancelButtonText?: string | undefined;
28
+ showCloseButton?: boolean | undefined;
29
+ fullWidth?: boolean | undefined;
30
+ fullCustomization?: boolean | undefined;
31
+ state?: "success" | "info" | "alert" | "error";
32
+ }
33
+
34
+ export abstract class PrimariaInteractionService {
35
+ abstract confirm<TData = undefined, TResult = undefined>(
36
+ data: TData | undefined,
37
+ dialogComponent:
38
+ | React.ComponentType<ConfirmationContentProps<TData, TResult> | ConfirmationWithResultContentProps<TData, TResult>>
39
+ | (new () => HTMLElement),
40
+ options?: ConfirmationOptions | undefined,
41
+ ): Promise<ConfirmationResult<TResult | undefined>>;
42
+ abstract confirmMessage(
43
+ message: string,
44
+ options?: ConfirmationOptions | undefined,
45
+ ): Promise<ConfirmationResult>;
46
+ }
@@ -0,0 +1,6 @@
1
+ export abstract class PrimariaNotificationService {
2
+ abstract info(message: string): void;
3
+ abstract warning(message: string): void;
4
+ abstract error(message: string): void;
5
+ abstract success(message: string): void;
6
+ }
@@ -0,0 +1,45 @@
1
+ import { PrimariaNotificationService } from "./notification-service";
2
+
3
+ export class PrimariaNotificationServiceImpl extends PrimariaNotificationService {
4
+ private notify(
5
+ message: string,
6
+ state: "info" | "warning" | "error" | "success",
7
+ duration = 3000,
8
+ ): void {
9
+ // Crear el Web Component
10
+ const toast = document.createElement("dss-toast");
11
+ toast.setAttribute("isshow", "true");
12
+ toast.setAttribute("state", state);
13
+ toast.setAttribute("position", "bottom-left");
14
+ toast.setAttribute("text", message);
15
+ toast.setAttribute("hasicon", "true");
16
+ toast.setAttribute("duration", duration.toString());
17
+
18
+ // Agregar al body
19
+ document.body.appendChild(toast);
20
+
21
+ // Remover después del tiempo de duración
22
+ setTimeout(() => {
23
+ toast.setAttribute("isshow", "false");
24
+ setTimeout(() => {
25
+ toast.remove();
26
+ }, 300); // Espera un poco para animación de salida (ajustable)
27
+ }, duration);
28
+ }
29
+
30
+ info(message: string, duration?: number): void {
31
+ this.notify(message, "info", duration);
32
+ }
33
+
34
+ warning(message: string, duration?: number): void {
35
+ this.notify(message, "warning", duration);
36
+ }
37
+
38
+ error(message: string, duration?: number): void {
39
+ this.notify(message, "error", duration);
40
+ }
41
+
42
+ success(message: string, duration?: number): void {
43
+ this.notify(message, "success", duration);
44
+ }
45
+ }
@@ -1,12 +1,11 @@
1
1
  import { LitElement, css, html, unsafeCSS } from "lit";
2
2
  import { customElement } from "lit/decorators.js";
3
+ import { PluginBusyTask } from "../plugin-busy-manager";
3
4
  import styles from "./styles.css?inline";
4
5
  import { template } from "./template";
5
- import { confirmMixin } from "../../../UI/shared-components/primaria-interaction/confirm-mixin";
6
- import { PluginBusyTask } from "../plugin-busy-manager";
7
6
 
8
7
  @customElement("plugin-busy-list")
9
- export class PluginBusyList extends confirmMixin(LitElement) {
8
+ export class PluginBusyList extends LitElement {
10
9
  static styles = css`
11
10
  ${unsafeCSS(styles)}
12
11
  `;
@@ -15,5 +14,5 @@ export class PluginBusyList extends confirmMixin(LitElement) {
15
14
  return html`${template(this)}`;
16
15
  }
17
16
 
18
- model: { busyTasks: PluginBusyTask[] };
17
+ data: { busyTasks: PluginBusyTask[] };
19
18
  }
@@ -7,7 +7,7 @@ export const template = (props: PluginBusyList) => html`
7
7
  <div class="container">
8
8
  <div class="title">${translate("busyManager.title")}</div>
9
9
  <div class="list">
10
- ${props.model?.busyTasks?.map((item: PluginBusyTask) => html`<div class="plugin-busy-item">${item.taskDescription}</div>`)}
10
+ ${props.data?.busyTasks?.map((item: PluginBusyTask) => html`<div class="plugin-busy-item">${item.taskDescription}</div>`)}
11
11
  </div>
12
12
  </div>
13
13
  `;
@@ -11,6 +11,7 @@ export interface PrimariaRegionManager extends HarmonixRegionManager {
11
11
  registerMainView(view: HarmonixViewDefinition): Promise<void>;
12
12
  activateMainView(viewId: string): Promise<void>;
13
13
  getCurrentMainViewActive(): string | undefined;
14
+ _destroy(): void;
14
15
  }
15
16
 
16
17
  class RegionManagerProxy implements PrimariaRegionManager {
@@ -140,6 +141,10 @@ class RegionManagerProxy implements PrimariaRegionManager {
140
141
  _notifyMainViewChanged(viewId: string) {
141
142
  this.broker.publish(shellEvents.mainViewChanged, { viewId });
142
143
  }
144
+
145
+ _destroy() {
146
+ this.regionManager.destroy();
147
+ }
143
148
  }
144
149
 
145
150
  /**
package/src/disposer.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { shellApi } from "./api/api";
2
2
  import { teardownFeatures } from "./features/bootstrapper";
3
3
  export const disposeShell = () => {
4
- teardownFeatures();
4
+ teardownFeatures(shellApi);
5
5
  };
6
6
 
7
7
  export const raiseCloseEvent = () => {
package/src/events.ts CHANGED
@@ -3,4 +3,5 @@ export const shellEvents = {
3
3
  appCrashed: "appCrashed",
4
4
  mainViewChanged: "mainViewChanged",
5
5
  refreshTokenFailed: "refreshTokenFailed",
6
+ mpidHeaderInvalid: "mpidHeaderInvalid",
6
7
  };
@@ -1,4 +1,5 @@
1
- import { PrimariaApi, shellApi } from "../api/api";
1
+ import { mediatorSettings } from "mediatr-ts";
2
+ import { PrimariaApi } from "../api/api";
2
3
  import { container } from "../infrastructure/ioc/container";
3
4
  import { TYPES } from "../infrastructure/ioc/types";
4
5
  import { bootstrapExitShell, teardownExitShell } from "./exit/bootstrapper";
@@ -9,11 +10,13 @@ export const bootstrapFeatures = (api: PrimariaApi) => {
9
10
  container.bind(TYPES.primaryApi).toConstantValue(api);
10
11
  bootstrapGetUserInfo();
11
12
  bootstrapExitShell();
12
- shellApi.broker.send(new GetUserInfo());
13
+ api.broker.send(new GetUserInfo());
13
14
  };
14
15
 
15
- export const teardownFeatures = () => {
16
+ export const teardownFeatures = (api: PrimariaApi) => {
16
17
  teardownGetUserInfo();
17
18
  teardownExitShell();
18
19
  container.unbindAll();
20
+ api.regionManager._destroy();
21
+ mediatorSettings.resolver.clear();
19
22
  };
@@ -27,22 +27,19 @@ export class ExitShellHandler {
27
27
 
28
28
  raiseCloseEvent();
29
29
  } catch (error) {
30
- this.api.interactionManager.notify({
31
- type: "error",
32
- message: error.message,
33
- });
30
+ this.api.notificationService.error(
31
+ error.message,
32
+ );
34
33
  }
35
34
  }
36
35
 
37
36
  private askForClose(busyTasks: PluginBusyTask[]) {
38
- return this.api.interactionManager.customConfirm({
37
+ return this.api.interactionService.confirm({ busyTasks }, PluginBusyList, {
39
38
  title: translate("actions.askExit"),
40
- componentConstructor: PluginBusyList,
41
- type: "danger",
42
- model: { busyTasks },
43
- acceptLabel: "Si",
44
- cancelLabel: "No",
45
- } as CustomConfirmOptions<{ busyTasks: PluginBusyTask[] }>);
39
+ state: "error",
40
+ confirmButtonText: "",
41
+ cancelButtonText: "No",
42
+ });
46
43
  }
47
44
 
48
45
  private timeout(ms: number) {
@@ -17,10 +17,9 @@ export class GetUserInfoHandler {
17
17
  this.api.globalStateManager.setData("userInfo", userInfo);
18
18
  return userInfo;
19
19
  } catch (error) {
20
- this.api.interactionManager.notify({
21
- type: "error",
22
- message: error.message,
23
- });
20
+ this.api.notificationService.error(
21
+ error.message,
22
+ );
24
23
  }
25
24
  }
26
25
  }
package/src/index.ts CHANGED
@@ -7,8 +7,6 @@ export * from "./api/api";
7
7
  export * from "./api/broker/primaria-broker";
8
8
  export * from "./UI/index";
9
9
  export { PrimariaNavItem } from "./UI/shared-components/primaria-nav-item/primaria-nav-item";
10
- export { confirmMixin } from "./UI/shared-components/primaria-interaction";
11
- export type { CustomConfirmOptions } from "./UI/shared-components/primaria-interaction";
12
10
  export {
13
11
  EcapEventManager,
14
12
  createEcapEventManager,
@@ -17,3 +15,4 @@ export type { IEcapEvent } from "./api/ecap-event-manager/typings";
17
15
  export * from "./internal-plugins";
18
16
  export * from "@uxland/harmonix-adapters";
19
17
  export * from "./events";
18
+ export * from "./api/interaction-service";
@@ -2,10 +2,9 @@ import { LitElement, css, html, unsafeCSS } from "lit";
2
2
  import { customElement, property } from "lit/decorators.js";
3
3
  import styles from "./export-pdf-modal.css?inline";
4
4
  import { template } from "./template";
5
- import { confirmMixin } from "../../../../../UI/shared-components/primaria-interaction/confirm-mixin";
6
5
 
7
6
  @customElement("export-pdf-modal")
8
- export class ExportPdfModal extends confirmMixin(LitElement) {
7
+ export class ExportPdfModal extends LitElement {
9
8
  render() {
10
9
  return html`
11
10
  ${template(this)}
@@ -38,14 +37,6 @@ export class ExportPdfModal extends confirmMixin(LitElement) {
38
37
  { label: "Element 4", value: "4" },
39
38
  ];
40
39
 
41
- _accept() {
42
- this.close({ confirmed: true, outputModel: this.outputModel });
43
- }
44
-
45
- _cancel() {
46
- this.close({ confirmed: false, outputModel: this.outputModel });
47
- }
48
-
49
40
  handleTest() {
50
41
  console.log(
51
42
  // this.selectedVisibilityLevelElement,
@@ -14,7 +14,6 @@ export const template = (props: ExportPdfModal) => {
14
14
  <input id="dropdown1" slot="input" type="text" class="dss-input" />
15
15
  </dss-input-dropdown> -->
16
16
  <div class="content-options">
17
- <span>${translate("modal.selectExportOption")}</span>
18
17
  <div class="selector-options">
19
18
  <dss-radio-button>
20
19
  <input slot="input" id="radioButton1" type="radio" name="exportOption" @change=${() => {
@@ -47,11 +46,5 @@ export const template = (props: ExportPdfModal) => {
47
46
  </div>`
48
47
  : nothing
49
48
  }
50
- <div class="actions">
51
- <dss-button @click="${props._cancel}" id="cancel-btn" label="${translate("modal.cancel")}" size="md" variant="secondary"></dss-button>
52
- <dss-button @click="${props._accept}" ?disabled="${!props.selectedRadioOption}" id="accept-btn" label="${translate("modal.export")}" size="md"></dss-button>
53
- </div>
54
- <!-- Button to test
55
- <button @click=${() => props.handleTest()}>Console log</button> -->
56
49
  </div>`;
57
50
  };
@@ -1,13 +1,14 @@
1
1
  import { ApiBaseHandler } from "../../infrastructure/base-handlers";
2
+ import { translate } from "../../localization";
2
3
  import { ExportPdfModal } from "./export-pdf-modal/export-pdf-modal";
3
4
 
4
5
  export class ExportToPdfHandler extends ApiBaseHandler {
5
6
  async handle() {
6
7
  try {
7
- this.api.interactionManager.customConfirm({
8
- title: "Exportar a PDF",
9
- componentConstructor: ExportPdfModal,
10
- type: "info",
8
+ this.api.interactionService.confirm(undefined, ExportPdfModal, {
9
+ title: translate("modal.selectExportOption"),
10
+ confirmButtonText: "Exportar",
11
+ cancelButtonText: "Cancelar",
11
12
  });
12
13
  } catch (error) {
13
14
  this._notifyError(error.message);
@@ -15,9 +16,8 @@ export class ExportToPdfHandler extends ApiBaseHandler {
15
16
  }
16
17
 
17
18
  _notifyError(errorMessage?: string) {
18
- this.api.interactionManager.notify({
19
- type: "error",
20
- message: errorMessage || "actions.delete.error",
21
- });
19
+ this.api.notificationService.error(
20
+ errorMessage || "actions.delete.error",
21
+ );
22
22
  }
23
23
  }
@@ -25,7 +25,7 @@ export const template = (props: ActivityHistoryMain) =>
25
25
  <dss-action-menu position="bottom-start">
26
26
  <dss-action-menu-item lefticon="view_timeline" label=${translate("actions.cronogram")} @click=${props._raiseEcapCronogramEvent}></dss-action-menu-item>
27
27
  <dss-action-menu-item lefticon="file_download" label=${translate("actions.exportPdf")} @click=${() => props.api.broker.send(new ExportPdf())}></dss-action-menu-item>
28
- <dss-action-menu-item label=${translate("actions.noteLegend")}></dss-action-menu-item>
28
+ <dss-action-menu-item lefticon="info" label=${translate("actions.entryLegend")}></dss-action-menu-item>
29
29
  </dss-action-menu>
30
30
  </div>
31
31
  </div>`
@@ -7,9 +7,11 @@ export class SearchItemsHandler extends BaseHandler {
7
7
  async handle(request: SearchActivityHistoryItems) {
8
8
  try {
9
9
  this.store.dispatch(setSearchString(request.searchString));
10
- this.api.broker.publish(events.activityHistorySearched, {
11
- searchQuery: request.searchString,
12
- });
10
+ setTimeout(() => {
11
+ this.api.broker.publish(events.activityHistorySearched, {
12
+ searchQuery: request.searchString,
13
+ });
14
+ }, 300);
13
15
  } catch (e) {
14
16
  console.log(e.message);
15
17
  }
@@ -40,7 +40,6 @@ export const locales = {
40
40
  actions: {
41
41
  cronogram: "Cronograma",
42
42
  exportPdf: "Exportar PDF",
43
- noteLegend: "Llegenda notes",
44
43
  moreOptions: "Més opcions",
45
44
  entryLegend: "Llegenda entrades",
46
45
  maximizeButton: "Botó maximitzar",
package/src/locales.ts CHANGED
@@ -40,6 +40,11 @@ export const locales = {
40
40
  clinicalMonitoring: {
41
41
  title: "Seguiment clínic",
42
42
  },
43
+ errors: {
44
+ session: "Hi ha hagut un error amb la sessió. Siusplau, tanca i torna a obrir l'aplicació.",
45
+ invalidPatient:
46
+ "El pacient actual no és vàlid. Siusplau, tanca i torna a obrir l'aplicació.",
47
+ },
43
48
  header: {
44
49
  workCenter: "Centre treball",
45
50
  role: "Rol",
@@ -1,19 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import { ConfirmOptions, ConfirmResult, CustomConfirmOptions } from '../typings';
3
-
4
- export declare class DialogComponent extends LitElement {
5
- render(): import('lit').TemplateResult<1>;
6
- static get styles(): import('lit').CSSResult;
7
- options: ConfirmOptions & CustomConfirmOptions;
8
- modal: any;
9
- _cancel(e: any): void;
10
- _accept(e: any): void;
11
- componentCloseRequest(e: CustomEvent): void;
12
- close(result: ConfirmResult): Promise<void>;
13
- getCustomComponent(): any;
14
- acceptButton: HTMLElement;
15
- actionsContainer: HTMLElement;
16
- header: HTMLElement;
17
- content: HTMLElement;
18
- show(): void;
19
- }
@@ -1,12 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import { NotifyOptions } from '../typings';
3
-
4
- export declare class NotifierComponent extends LitElement {
5
- render(): import('lit').TemplateResult<1>;
6
- static get styles(): import('lit').CSSResult;
7
- options: NotifyOptions;
8
- snackbar: HTMLElement;
9
- show(): void;
10
- clearAndUpdateOrder(order: string): void;
11
- close(): void;
12
- }
@@ -1,11 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import { ConfirmResult, Constructor } from './typings';
3
-
4
- export declare class ConfirmMixinBase {
5
- model: any;
6
- outputModel: any;
7
- close(result: ConfirmResult): void;
8
- canAccept(): Promise<boolean> | boolean;
9
- accept(result: ConfirmResult): Promise<ConfirmResult>;
10
- }
11
- export declare function confirmMixin<T extends Constructor<LitElement>>(superClass: T): Constructor<ConfirmMixinBase> & T;
@@ -1,3 +0,0 @@
1
- import { ConfirmOptions, ConfirmResult, CustomConfirmOptions } from './typings';
2
-
3
- export declare const confirm: (options: (ConfirmOptions & CustomConfirmOptions) | any) => Promise<ConfirmResult>;
@@ -1,5 +0,0 @@
1
- export * from './confirm';
2
- export * from './notify';
3
- export * from './open-dialog';
4
- export * from './confirm-mixin';
5
- export * from './typings';