@uxland/primary-shell 3.2.7 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +58 -38
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +16 -17
- package/dist/index.umd.cjs.map +1 -1
- package/dist/primary/shell/src/UI/shared-components/primaria-interaction/components/dialog-component.d.ts +3 -4
- package/dist/primary/shell/src/UI/shared-components/primaria-interaction/confirm-mixin.d.ts +4 -9
- package/dist/primary/shell/src/UI/shared-components/primaria-interaction/confirm.d.ts +2 -2
- package/dist/primary/shell/src/UI/shared-components/primaria-interaction/index.d.ts +1 -0
- package/dist/primary/shell/src/UI/shared-components/primaria-interaction/open-dialog.d.ts +3 -0
- package/dist/primary/shell/src/UI/shared-components/primaria-interaction/shared.d.ts +3 -0
- package/dist/primary/shell/src/UI/shared-components/primaria-interaction/typings.d.ts +11 -2
- package/dist/primary/shell/src/api/interaction-manager/interaction.d.ts +5 -4
- package/dist/primary/shell/src/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/UI/shared-components/primaria-interaction/components/dialog-component-styles.css +5 -2
- package/src/UI/shared-components/primaria-interaction/components/dialog-component.ts +47 -37
- package/src/UI/shared-components/primaria-interaction/confirm-mixin.ts +9 -13
- package/src/UI/shared-components/primaria-interaction/confirm.ts +5 -26
- package/src/UI/shared-components/primaria-interaction/index.ts +1 -0
- package/src/UI/shared-components/primaria-interaction/open-dialog.ts +8 -0
- package/src/UI/shared-components/primaria-interaction/shared.ts +29 -0
- package/src/UI/shared-components/primaria-interaction/typings.ts +13 -2
- package/src/api/interaction-manager/interaction.ts +11 -6
- package/src/index.ts +1 -4
- package/src/internal-plugins/activity-history/features/export-to-pdf/handler.ts +1 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import {
|
|
3
|
-
import { ConfirmOptions, CustomConfirmOptions } from '../typings';
|
|
2
|
+
import { ConfirmOptions, ConfirmResult, CustomConfirmOptions } from '../typings';
|
|
4
3
|
|
|
5
4
|
export declare class DialogComponent extends LitElement {
|
|
6
5
|
render(): import('lit').TemplateResult<1>;
|
|
@@ -10,8 +9,8 @@ export declare class DialogComponent extends LitElement {
|
|
|
10
9
|
_cancel(e: any): void;
|
|
11
10
|
_accept(e: any): void;
|
|
12
11
|
componentCloseRequest(e: CustomEvent): void;
|
|
13
|
-
close(result:
|
|
14
|
-
getCustomComponent():
|
|
12
|
+
close(result: ConfirmResult): Promise<void>;
|
|
13
|
+
getCustomComponent(): any;
|
|
15
14
|
acceptButton: HTMLElement;
|
|
16
15
|
actionsContainer: HTMLElement;
|
|
17
16
|
header: HTMLElement;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import { Constructor } from './typings';
|
|
2
|
+
import { ConfirmResult, Constructor } from './typings';
|
|
3
3
|
|
|
4
|
-
export interface IConfirmMixin {
|
|
5
|
-
model: any;
|
|
6
|
-
close(result: boolean): void;
|
|
7
|
-
canAccept(): Promise<boolean> | boolean;
|
|
8
|
-
accept(): Promise<void> | void;
|
|
9
|
-
}
|
|
10
4
|
export declare class ConfirmMixinBase {
|
|
11
5
|
model: any;
|
|
12
|
-
|
|
6
|
+
outputModel: any;
|
|
7
|
+
close(result: ConfirmResult): void;
|
|
13
8
|
canAccept(): Promise<boolean> | boolean;
|
|
14
|
-
accept(): Promise<
|
|
9
|
+
accept(result: ConfirmResult): Promise<ConfirmResult>;
|
|
15
10
|
}
|
|
16
11
|
export declare function confirmMixin<T extends Constructor<LitElement>>(superClass: T): Constructor<ConfirmMixinBase> & T;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ConfirmOptions, CustomConfirmOptions } from './typings';
|
|
1
|
+
import { ConfirmOptions, ConfirmResult, CustomConfirmOptions } from './typings';
|
|
2
2
|
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const confirm: (options: (ConfirmOptions & CustomConfirmOptions) | any) => Promise<ConfirmResult>;
|
|
@@ -7,18 +7,23 @@ export interface ConfirmOptions {
|
|
|
7
7
|
type: ConfirmType;
|
|
8
8
|
acceptLabel: string;
|
|
9
9
|
cancelLabel: string;
|
|
10
|
-
modal?: boolean;
|
|
11
10
|
}
|
|
12
11
|
export interface CustomConfirmOptions<T = any> {
|
|
13
12
|
title: string;
|
|
14
13
|
componentConstructor: Constructor<LitElement | any>;
|
|
15
14
|
type: ConfirmType;
|
|
16
|
-
modal?: boolean;
|
|
17
15
|
acceptLabel?: string;
|
|
18
16
|
cancelLabel?: string;
|
|
19
17
|
model?: T;
|
|
20
18
|
fullCustomization?: boolean;
|
|
21
19
|
}
|
|
20
|
+
export interface DialogOptions<T = any> {
|
|
21
|
+
title: string;
|
|
22
|
+
componentConstructor: Constructor<LitElement | any>;
|
|
23
|
+
model?: T;
|
|
24
|
+
showCloseButton?: boolean;
|
|
25
|
+
fullCustomization?: boolean;
|
|
26
|
+
}
|
|
22
27
|
export type ConfirmType = "danger" | "warning" | "info" | "success";
|
|
23
28
|
export interface NotifyOptions {
|
|
24
29
|
message?: string;
|
|
@@ -26,6 +31,10 @@ export interface NotifyOptions {
|
|
|
26
31
|
position?: NotifyPosition;
|
|
27
32
|
order?: string;
|
|
28
33
|
}
|
|
34
|
+
export interface ConfirmResult<T = any> {
|
|
35
|
+
confirmed: boolean;
|
|
36
|
+
outputModel?: T;
|
|
37
|
+
}
|
|
29
38
|
export type NotifyOrder = "first" | "second" | "third" | "fourth" | "fifth";
|
|
30
39
|
export type NotifyPosition = "bottom" | "center" | "top";
|
|
31
40
|
export type NotifyType = "danger" | "warning" | "info" | "success" | "error";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ConfirmOptions, CustomConfirmOptions, NotifyOptions } from '../../UI/shared-components/primaria-interaction';
|
|
1
|
+
import { ConfirmOptions, ConfirmResult, CustomConfirmOptions, DialogOptions, NotifyOptions } from '../../UI/shared-components/primaria-interaction';
|
|
2
2
|
|
|
3
3
|
export interface PrimariaInteractionManager {
|
|
4
|
-
notify(options: NotifyOptions):
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
notify(options: NotifyOptions): void;
|
|
5
|
+
confirm(options: ConfirmOptions): Promise<ConfirmResult>;
|
|
6
|
+
customConfirm(options: CustomConfirmOptions): Promise<ConfirmResult>;
|
|
7
|
+
openDialog(options: DialogOptions): void;
|
|
7
8
|
}
|
|
8
9
|
export declare const createInteractionManager: () => PrimariaInteractionManager;
|
|
@@ -6,7 +6,7 @@ export * from './api/api';
|
|
|
6
6
|
export * from './api/broker/primaria-broker';
|
|
7
7
|
export { PrimariaMenuItem } from './UI/shared-components/primaria-menu-item/primaria-menu-item';
|
|
8
8
|
export { confirmMixin } from './UI/shared-components/primaria-interaction';
|
|
9
|
-
export type {
|
|
9
|
+
export type { CustomConfirmOptions } from './UI/shared-components/primaria-interaction';
|
|
10
10
|
export { EcapEventManager, createEcapEventManager, } from './api/ecap-event-manager/ecap-event-manager';
|
|
11
11
|
export type { IEcapEvent } from './api/ecap-event-manager/typings';
|
|
12
12
|
export * from './internal-plugins';
|
package/package.json
CHANGED
package/src/UI/shared-components/primaria-interaction/components/dialog-component-styles.css
CHANGED
|
@@ -34,12 +34,15 @@
|
|
|
34
34
|
.dialog__header {
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: row;
|
|
37
|
-
justify-content:
|
|
37
|
+
justify-content: center;
|
|
38
38
|
padding: 24px;
|
|
39
39
|
border-top-left-radius: 8px;
|
|
40
40
|
border-top-right-radius: 8px;
|
|
41
|
-
justify-content: center;
|
|
42
41
|
align-items: center;
|
|
42
|
+
|
|
43
|
+
&.with-close{
|
|
44
|
+
justify-content: space-between;
|
|
45
|
+
}
|
|
43
46
|
h2 {
|
|
44
47
|
color: var(--color-neutral-900);
|
|
45
48
|
padding: 0;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { LitElement, css, html, nothing, unsafeCSS } from "lit";
|
|
2
|
+
import { when } from "lit/directives/when.js";
|
|
2
3
|
import { customElement, property, query } from "lit/decorators.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
4
|
+
import {
|
|
5
|
+
ConfirmOptions,
|
|
6
|
+
ConfirmResult,
|
|
7
|
+
ConfirmType,
|
|
8
|
+
CustomConfirmOptions,
|
|
9
|
+
DialogOptions,
|
|
10
|
+
} from "../typings";
|
|
5
11
|
import styles from "./dialog-component-styles.css?inline";
|
|
6
12
|
|
|
7
13
|
const dssToConfirmTypeClass = (type: ConfirmType) => {
|
|
@@ -28,9 +34,9 @@ const renderActions = (props: DialogComponent) => {
|
|
|
28
34
|
const renderMessage = (options: ConfirmOptions) =>
|
|
29
35
|
html` <div id="message">${options.message || ""}</div> `;
|
|
30
36
|
|
|
31
|
-
function renderCustomContent(
|
|
32
|
-
if (options.componentConstructor) {
|
|
33
|
-
const component = new options.componentConstructor() as LitElement;
|
|
37
|
+
function renderCustomContent(props: DialogComponent) {
|
|
38
|
+
if (props.options.componentConstructor) {
|
|
39
|
+
const component = new props.options.componentConstructor() as LitElement;
|
|
34
40
|
component.setAttribute("id", "__custom-element__");
|
|
35
41
|
component.addEventListener("closed", props.componentCloseRequest.bind(props));
|
|
36
42
|
return html`${component}`;
|
|
@@ -38,33 +44,36 @@ function renderCustomContent(options: CustomConfirmOptions, props: DialogCompone
|
|
|
38
44
|
return nothing;
|
|
39
45
|
}
|
|
40
46
|
|
|
47
|
+
function renderDefaultContent(props: DialogComponent) {
|
|
48
|
+
const showClose = (props.options as DialogOptions).showCloseButton;
|
|
49
|
+
return html`<div class="dialog__header ${props.options.type} ${showClose ? "with-close" : ""}">
|
|
50
|
+
<h2 part="title">${props.options.title || ""}</h2>
|
|
51
|
+
${when(
|
|
52
|
+
showClose,
|
|
53
|
+
() =>
|
|
54
|
+
html`<dss-icon-button size="md" icon="cancel" @click="${
|
|
55
|
+
props._cancel
|
|
56
|
+
}"></dss-icon-button>`,
|
|
57
|
+
() => nothing,
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
<div class="dialog__content">
|
|
61
|
+
${when(
|
|
62
|
+
props.options.message,
|
|
63
|
+
() => renderMessage(props.options),
|
|
64
|
+
() => renderCustomContent(props),
|
|
65
|
+
)}
|
|
66
|
+
</div>
|
|
67
|
+
${renderActions(props)}`;
|
|
68
|
+
}
|
|
69
|
+
|
|
41
70
|
@customElement("dialog-component")
|
|
42
71
|
export class DialogComponent extends LitElement {
|
|
43
72
|
render() {
|
|
44
73
|
return html`
|
|
45
|
-
<div
|
|
46
|
-
class="
|
|
47
|
-
|
|
48
|
-
>
|
|
49
|
-
<div
|
|
50
|
-
class="dialog"
|
|
51
|
-
>
|
|
52
|
-
${
|
|
53
|
-
this.options.fullCustomization
|
|
54
|
-
? renderCustomContent(this.options, this)
|
|
55
|
-
: html`<div class="dialog__header ${this.options.type}">
|
|
56
|
-
<h2 part="title">${this.options.title || ""}</h2>
|
|
57
|
-
</div>
|
|
58
|
-
<div class="dialog__content">
|
|
59
|
-
${
|
|
60
|
-
this.options.message
|
|
61
|
-
? renderMessage(this.options)
|
|
62
|
-
: renderCustomContent(this.options, this)
|
|
63
|
-
}
|
|
64
|
-
</div>
|
|
65
|
-
${renderActions(this)}`
|
|
66
|
-
}
|
|
67
|
-
|
|
74
|
+
<div class="modal">
|
|
75
|
+
<div class="dialog">
|
|
76
|
+
${this.options.fullCustomization ? renderCustomContent(this) : renderDefaultContent(this)}
|
|
68
77
|
</div>
|
|
69
78
|
</div>
|
|
70
79
|
`;
|
|
@@ -83,33 +92,34 @@ export class DialogComponent extends LitElement {
|
|
|
83
92
|
modal: any;
|
|
84
93
|
|
|
85
94
|
_cancel(e) {
|
|
86
|
-
|
|
87
|
-
this.close(false);
|
|
95
|
+
this.close({ confirmed: false });
|
|
88
96
|
}
|
|
89
97
|
|
|
90
98
|
_accept(e) {
|
|
91
|
-
|
|
92
|
-
this.close(true);
|
|
99
|
+
this.close({ confirmed: true });
|
|
93
100
|
}
|
|
94
101
|
|
|
95
102
|
componentCloseRequest(e: CustomEvent) {
|
|
96
103
|
this.close(e.detail);
|
|
97
104
|
}
|
|
98
105
|
|
|
99
|
-
async close(result:
|
|
100
|
-
|
|
106
|
+
async close(result: ConfirmResult) {
|
|
107
|
+
let finalResult = result;
|
|
108
|
+
if (finalResult?.confirmed) {
|
|
101
109
|
const component = this.getCustomComponent();
|
|
102
110
|
if (component?.canAccept) {
|
|
103
111
|
const canAccept = await component.canAccept();
|
|
104
112
|
if (!canAccept) return;
|
|
105
|
-
|
|
113
|
+
}
|
|
114
|
+
if (component?.accept) {
|
|
115
|
+
finalResult = await component.accept(finalResult);
|
|
106
116
|
}
|
|
107
117
|
}
|
|
118
|
+
this.dispatchEvent(new CustomEvent("closed", { detail: finalResult }));
|
|
108
119
|
this.modal.style.display = "none";
|
|
109
|
-
this.dispatchEvent(new CustomEvent("closed", { detail: result }));
|
|
110
120
|
}
|
|
111
121
|
|
|
112
|
-
getCustomComponent():
|
|
122
|
+
getCustomComponent(): any {
|
|
113
123
|
return this.shadowRoot?.querySelector("#__custom-element__");
|
|
114
124
|
}
|
|
115
125
|
|
|
@@ -1,34 +1,30 @@
|
|
|
1
1
|
import { dedupeMixin } from "@uxland/lit-utilities";
|
|
2
2
|
import { LitElement } from "lit";
|
|
3
3
|
import { property } from "lit/decorators.js";
|
|
4
|
-
import { Constructor } from "./typings";
|
|
5
|
-
|
|
6
|
-
export interface IConfirmMixin {
|
|
7
|
-
model: any;
|
|
8
|
-
close(result: boolean): void;
|
|
9
|
-
canAccept(): Promise<boolean> | boolean;
|
|
10
|
-
accept(): Promise<void> | void;
|
|
11
|
-
}
|
|
4
|
+
import { ConfirmResult, Constructor } from "./typings";
|
|
12
5
|
|
|
13
6
|
export declare class ConfirmMixinBase {
|
|
14
7
|
model: any;
|
|
15
|
-
|
|
8
|
+
outputModel: any;
|
|
9
|
+
close(result: ConfirmResult): void;
|
|
16
10
|
canAccept(): Promise<boolean> | boolean;
|
|
17
|
-
accept(): Promise<
|
|
11
|
+
accept(result: ConfirmResult): Promise<ConfirmResult>;
|
|
18
12
|
}
|
|
19
13
|
|
|
20
14
|
const ConfirmMixin = dedupeMixin(<T extends Constructor<LitElement>>(superClass: T) => {
|
|
21
15
|
class ConfirmMixinClass extends superClass implements ConfirmMixinBase {
|
|
22
16
|
@property()
|
|
23
17
|
model: T;
|
|
24
|
-
|
|
18
|
+
@property()
|
|
19
|
+
outputModel: T;
|
|
20
|
+
close(result: ConfirmResult) {
|
|
25
21
|
(this as any).dispatchEvent(new CustomEvent("closed", { detail: result }));
|
|
26
22
|
}
|
|
27
23
|
canAccept(): Promise<boolean> | boolean {
|
|
28
24
|
return Promise.resolve(true);
|
|
29
25
|
}
|
|
30
|
-
accept(): Promise<
|
|
31
|
-
return Promise.resolve();
|
|
26
|
+
accept(result: ConfirmResult): Promise<ConfirmResult> {
|
|
27
|
+
return Promise.resolve(result);
|
|
32
28
|
}
|
|
33
29
|
}
|
|
34
30
|
return ConfirmMixinClass as Constructor<ConfirmMixinBase> & T;
|
|
@@ -1,30 +1,9 @@
|
|
|
1
1
|
import "./components/dialog-component";
|
|
2
|
-
import {
|
|
2
|
+
import { buildDialogComponent } from "./shared";
|
|
3
|
+
import { ConfirmOptions, ConfirmResult, CustomConfirmOptions } from "./typings";
|
|
3
4
|
|
|
4
|
-
export const
|
|
5
|
+
export const confirm = async (
|
|
5
6
|
options: (ConfirmOptions & CustomConfirmOptions) | any,
|
|
6
|
-
): Promise<
|
|
7
|
-
|
|
8
|
-
throw new Error("message, componentConstructor options properties are required");
|
|
9
|
-
}
|
|
10
|
-
return new Promise((resolve) => {
|
|
11
|
-
const component: any = document.body.appendChild(document.createElement("dialog-component"));
|
|
12
|
-
|
|
13
|
-
component.options = options;
|
|
14
|
-
const result = component.updateComplete;
|
|
15
|
-
|
|
16
|
-
result.then(() => {
|
|
17
|
-
if (options.componentConstructor) {
|
|
18
|
-
const customComponent = component.shadowRoot.querySelector(`#__custom-element__`);
|
|
19
|
-
customComponent.model = options.model;
|
|
20
|
-
}
|
|
21
|
-
component.addEventListener("closed", closeComponent);
|
|
22
|
-
component.options && component.show();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
function closeComponent(e: { detail: any }) {
|
|
26
|
-
component.remove();
|
|
27
|
-
resolve(e.detail);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
7
|
+
): Promise<ConfirmResult> => {
|
|
8
|
+
return buildDialogComponent(options);
|
|
30
9
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "./components/dialog-component";
|
|
2
|
+
import { buildDialogComponent } from "./shared";
|
|
3
|
+
import { DialogOptions } from "./typings";
|
|
4
|
+
|
|
5
|
+
export const openDialog = (options: DialogOptions | any): void => {
|
|
6
|
+
options.showCloseButton = "showCloseButton" in options ? options.showCloseButton : true;
|
|
7
|
+
buildDialogComponent(options);
|
|
8
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ConfirmOptions, ConfirmResult, CustomConfirmOptions, DialogOptions } from "./typings";
|
|
2
|
+
|
|
3
|
+
export const buildDialogComponent = (
|
|
4
|
+
options: DialogOptions & ConfirmOptions & CustomConfirmOptions,
|
|
5
|
+
): Promise<ConfirmResult> => {
|
|
6
|
+
if (!options.message && !options.componentConstructor) {
|
|
7
|
+
throw new Error("message, componentConstructor options properties are required");
|
|
8
|
+
}
|
|
9
|
+
return new Promise((resolve) => {
|
|
10
|
+
const component: any = document.body.appendChild(document.createElement("dialog-component"));
|
|
11
|
+
|
|
12
|
+
component.options = options;
|
|
13
|
+
const result = component.updateComplete;
|
|
14
|
+
|
|
15
|
+
result.then(() => {
|
|
16
|
+
if (options.componentConstructor) {
|
|
17
|
+
const customComponent = component.shadowRoot.querySelector("#__custom-element__");
|
|
18
|
+
customComponent.model = options.model;
|
|
19
|
+
}
|
|
20
|
+
component.addEventListener("closed", closeComponent);
|
|
21
|
+
component.options && component.show();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
function closeComponent(e: { detail: ConfirmResult }) {
|
|
25
|
+
component.remove();
|
|
26
|
+
resolve(e.detail);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -7,20 +7,26 @@ export interface ConfirmOptions {
|
|
|
7
7
|
type: ConfirmType;
|
|
8
8
|
acceptLabel: string;
|
|
9
9
|
cancelLabel: string;
|
|
10
|
-
modal?: boolean;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export interface CustomConfirmOptions<T = any> {
|
|
14
13
|
title: string;
|
|
15
14
|
componentConstructor: Constructor<LitElement | any>;
|
|
16
15
|
type: ConfirmType;
|
|
17
|
-
modal?: boolean;
|
|
18
16
|
acceptLabel?: string;
|
|
19
17
|
cancelLabel?: string;
|
|
20
18
|
model?: T;
|
|
21
19
|
fullCustomization?: boolean;
|
|
22
20
|
}
|
|
23
21
|
|
|
22
|
+
export interface DialogOptions<T = any> {
|
|
23
|
+
title: string;
|
|
24
|
+
componentConstructor: Constructor<LitElement | any>;
|
|
25
|
+
model?: T;
|
|
26
|
+
showCloseButton?: boolean;
|
|
27
|
+
fullCustomization?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
export type ConfirmType = "danger" | "warning" | "info" | "success";
|
|
25
31
|
|
|
26
32
|
export interface NotifyOptions {
|
|
@@ -30,6 +36,11 @@ export interface NotifyOptions {
|
|
|
30
36
|
order?: string;
|
|
31
37
|
}
|
|
32
38
|
|
|
39
|
+
export interface ConfirmResult<T = any> {
|
|
40
|
+
confirmed: boolean;
|
|
41
|
+
outputModel?: T;
|
|
42
|
+
}
|
|
43
|
+
|
|
33
44
|
export type NotifyOrder = "first" | "second" | "third" | "fourth" | "fifth";
|
|
34
45
|
export type NotifyPosition = "bottom" | "center" | "top";
|
|
35
46
|
export type NotifyType = "danger" | "warning" | "info" | "success" | "error";
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConfirmOptions,
|
|
3
|
+
ConfirmResult,
|
|
3
4
|
CustomConfirmOptions,
|
|
5
|
+
DialogOptions,
|
|
4
6
|
NotifyOptions,
|
|
5
|
-
|
|
7
|
+
confirm,
|
|
6
8
|
notify,
|
|
9
|
+
openDialog,
|
|
7
10
|
} from "../../UI/shared-components/primaria-interaction";
|
|
8
11
|
|
|
9
12
|
export interface PrimariaInteractionManager {
|
|
10
|
-
notify(options: NotifyOptions):
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
notify(options: NotifyOptions): void;
|
|
14
|
+
confirm(options: ConfirmOptions): Promise<ConfirmResult>;
|
|
15
|
+
customConfirm(options: CustomConfirmOptions): Promise<ConfirmResult>;
|
|
16
|
+
openDialog(options: DialogOptions): void;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
export const createInteractionManager: () => PrimariaInteractionManager = () => {
|
|
16
20
|
return {
|
|
17
21
|
notify: (options: NotifyOptions) => notify(options),
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
confirm: (options: ConfirmOptions) => confirm(options),
|
|
23
|
+
customConfirm: (options: CustomConfirmOptions) => confirm(options),
|
|
24
|
+
openDialog: (options: DialogOptions) => openDialog(options),
|
|
20
25
|
} as PrimariaInteractionManager;
|
|
21
26
|
};
|
package/src/index.ts
CHANGED
|
@@ -7,10 +7,7 @@ export * from "./api/broker/primaria-broker";
|
|
|
7
7
|
import "./UI/index";
|
|
8
8
|
export { PrimariaMenuItem } from "./UI/shared-components/primaria-menu-item/primaria-menu-item";
|
|
9
9
|
export { confirmMixin } from "./UI/shared-components/primaria-interaction";
|
|
10
|
-
export type {
|
|
11
|
-
IConfirmMixin,
|
|
12
|
-
CustomConfirmOptions,
|
|
13
|
-
} from "./UI/shared-components/primaria-interaction";
|
|
10
|
+
export type { CustomConfirmOptions } from "./UI/shared-components/primaria-interaction";
|
|
14
11
|
export {
|
|
15
12
|
EcapEventManager,
|
|
16
13
|
createEcapEventManager,
|
|
@@ -7,11 +7,10 @@ export class ExportToPdfHandler {
|
|
|
7
7
|
constructor(@inject(TYPES.primaryApi) private api: PrimariaApi) {}
|
|
8
8
|
async handle() {
|
|
9
9
|
try {
|
|
10
|
-
this.api.interactionManager.
|
|
10
|
+
this.api.interactionManager.customConfirm({
|
|
11
11
|
title: "Exportar a PDF",
|
|
12
12
|
componentConstructor: ExportPdfModal,
|
|
13
13
|
type: "info",
|
|
14
|
-
modal: true,
|
|
15
14
|
cancelLabel: "Cancel·lar",
|
|
16
15
|
acceptLabel: "Exportar",
|
|
17
16
|
});
|