@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
@@ -1,4 +0,0 @@
1
- import { NotifyOptions } from './typings';
2
-
3
- export declare function generateId(): string;
4
- export declare const notify: (options: NotifyOptions) => void;
@@ -1,3 +0,0 @@
1
- import { DialogOptions } from './typings';
2
-
3
- export declare const openDialog: (options: DialogOptions | any) => void;
@@ -1,3 +0,0 @@
1
- import { ConfirmOptions, ConfirmResult, CustomConfirmOptions, DialogOptions } from './typings';
2
-
3
- export declare const buildDialogComponent: (options: DialogOptions & ConfirmOptions & CustomConfirmOptions) => Promise<ConfirmResult>;
@@ -1,40 +0,0 @@
1
- import { LitElement } from 'lit';
2
-
3
- export declare type Constructor<T = Record<string, unknown>> = new (...args: any[]) => T;
4
- export interface ConfirmOptions {
5
- title: string;
6
- message: string;
7
- type: ConfirmType;
8
- acceptLabel: string;
9
- cancelLabel: string;
10
- }
11
- export interface CustomConfirmOptions<T = any> {
12
- title: string;
13
- componentConstructor: Constructor<LitElement | any>;
14
- type: ConfirmType;
15
- acceptLabel?: string;
16
- cancelLabel?: string;
17
- model?: T;
18
- fullCustomization?: boolean;
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
- }
27
- export type ConfirmType = "danger" | "warning" | "info" | "success";
28
- export interface NotifyOptions {
29
- message?: string;
30
- type?: NotifyType;
31
- position?: NotifyPosition;
32
- order?: string;
33
- }
34
- export interface ConfirmResult<T = any> {
35
- confirmed: boolean;
36
- outputModel?: T;
37
- }
38
- export type NotifyOrder = "first" | "second" | "third" | "fourth" | "fifth";
39
- export type NotifyPosition = "bottom" | "center" | "top";
40
- export type NotifyType = "warning" | "info" | "success" | "error";
@@ -1,9 +0,0 @@
1
- import { ConfirmOptions, ConfirmResult, CustomConfirmOptions, DialogOptions, NotifyOptions } from '../../UI/shared-components/primaria-interaction';
2
-
3
- export interface PrimariaInteractionManager {
4
- notify(options: NotifyOptions): void;
5
- confirm(options: ConfirmOptions): Promise<ConfirmResult>;
6
- customConfirm(options: CustomConfirmOptions): Promise<ConfirmResult>;
7
- openDialog(options: DialogOptions): void;
8
- }
9
- export declare const createInteractionManager: () => PrimariaInteractionManager;
@@ -1,104 +0,0 @@
1
- *[hidden] {
2
- display: none !important;
3
- }
4
-
5
- .modal {
6
- font-family: "Open Sans";
7
- display: none;
8
- position: fixed;
9
- z-index: 400;
10
- left: 0;
11
- top: 0;
12
- width: 100%;
13
- height: 100%;
14
- background-color: rgba(0, 0, 0, 0.65);
15
-
16
- .dialog {
17
- display: flex;
18
- flex-direction: column;
19
- position: absolute;
20
- top: 50%;
21
- left: 50%;
22
- transform: translate(-50%, -50%);
23
- z-index: 21;
24
- background: #fff;
25
- border-radius: 16px;
26
- width: auto;
27
- height: auto;
28
- max-height: 95%;
29
- min-width: 400px;
30
- box-shadow:
31
- 0px 0px 14px rgb(0 0 0 / 25%),
32
- 0px 1px 10px rgb(0 0 0 / 22%);
33
-
34
- .dialog__header {
35
- display: flex;
36
- flex-direction: row;
37
- justify-content: center;
38
- padding: 24px;
39
- border-top-left-radius: 8px;
40
- border-top-right-radius: 8px;
41
- align-items: center;
42
-
43
- &.with-close{
44
- justify-content: space-between;
45
- }
46
- h2 {
47
- color: var(--color-neutral-900);
48
- padding: 0;
49
- margin: 0;
50
- font-weight: 700;
51
- font-size: 1.286rem;
52
- line-height: 30px;
53
- }
54
- }
55
- .dialog__content {
56
- display: flex;
57
- flex-direction: column;
58
- flex: 1;
59
- align-items: center;
60
-
61
- min-height: 1px;
62
- height: 100%;
63
- padding-inline: 24px;
64
- padding-bottom: 24px;
65
- font-weight: 400;
66
- font-size: 16px;
67
- line-height: 24px;
68
- border-bottom-left-radius: 8px;
69
- border-bottom-right-radius: 8px;
70
-
71
- & > * {
72
- border-bottom-left-radius: 8px;
73
- border-bottom-right-radius: 8px;
74
- }
75
- }
76
- .dialog__actions {
77
- display: flex;
78
- flex-direction: row;
79
- align-items: center;
80
- justify-content: center;
81
- gap: 16px;
82
- padding: 24px 16px;
83
- }
84
- }
85
- }
86
-
87
- /* Animations to fade the snackbar in and out */
88
- @-webkit-keyframes fadein {
89
- from {
90
- opacity: 0;
91
- }
92
- to {
93
- opacity: 1;
94
- }
95
- }
96
-
97
- @keyframes fadein {
98
- from {
99
- opacity: 0;
100
- }
101
- to {
102
- opacity: 1;
103
- }
104
- }
@@ -1,138 +0,0 @@
1
- import { LitElement, css, html, nothing, unsafeCSS } from "lit";
2
- import { when } from "lit/directives/when.js";
3
- import { customElement, property, query } from "lit/decorators.js";
4
- import {
5
- ConfirmOptions,
6
- ConfirmResult,
7
- ConfirmType,
8
- CustomConfirmOptions,
9
- DialogOptions,
10
- } from "../typings";
11
- import styles from "./dialog-component-styles.css?inline";
12
-
13
- const dssToConfirmType = (type: ConfirmType) => {
14
- return type === "danger" ? "error" : type;
15
- };
16
-
17
- const renderActions = (props: DialogComponent) => {
18
- if (!props.options.acceptLabel && !props.options.cancelLabel) return nothing;
19
- const optionsType = dssToConfirmType(props.options.type);
20
-
21
- return html`
22
- <div class="dialog__actions">
23
- <dss-button label=${props.options.cancelLabel} size="lg" variant="secondary" @click="${props._cancel}" ?hidden=${!props.options.cancelLabel} id="cancel-btn"></dss-button>
24
- <dss-button label=${props.options.acceptLabel} size="lg" variant=${optionsType} @click="${props._accept}" ?hidden=${!props.options.acceptLabel} id="accept-btn"></dss-button>
25
- </div>
26
- `;
27
- };
28
-
29
- const renderMessage = (options: ConfirmOptions) =>
30
- html`<div id="message">${options.message || ""}</div>`;
31
-
32
- function renderCustomContent(props: DialogComponent) {
33
- if (props.options.componentConstructor) {
34
- const component = new props.options.componentConstructor() as LitElement;
35
- component.setAttribute("id", "__custom-element__");
36
- component.addEventListener("closed", props.componentCloseRequest.bind(props));
37
- return html`${component}`;
38
- }
39
- return nothing;
40
- }
41
-
42
- function renderDefaultContent(props: DialogComponent) {
43
- const showClose = (props.options as DialogOptions).showCloseButton;
44
- return html`
45
- <div class="dialog__header ${props.options.type} ${showClose ? "with-close" : ""}">
46
- <h2 part="title">${props.options.title || ""}</h2>
47
- ${when(
48
- showClose,
49
- () =>
50
- html`<dss-icon-button size="md" icon="close" @click="${
51
- props._cancel
52
- }"></dss-icon-button>`,
53
- () => nothing,
54
- )}
55
- </div>
56
- <div class="dialog__content">
57
- ${when(
58
- props.options.message,
59
- () => renderMessage(props.options),
60
- () => renderCustomContent(props),
61
- )}
62
- </div>
63
- ${renderActions(props)}
64
- `;
65
- }
66
-
67
- @customElement("dialog-component")
68
- export class DialogComponent extends LitElement {
69
- render() {
70
- return html`
71
- <div class="modal">
72
- <div class="dialog">
73
- ${this.options.fullCustomization ? renderCustomContent(this) : renderDefaultContent(this)}
74
- </div>
75
- </div>
76
- `;
77
- }
78
-
79
- static get styles() {
80
- return css`
81
- ${unsafeCSS(styles)}
82
- `;
83
- }
84
-
85
- @property()
86
- options: ConfirmOptions & CustomConfirmOptions;
87
-
88
- @query(".modal")
89
- modal: any;
90
-
91
- _cancel(e) {
92
- this.close({ confirmed: false });
93
- }
94
-
95
- _accept(e) {
96
- this.close({ confirmed: true });
97
- }
98
-
99
- componentCloseRequest(e: CustomEvent) {
100
- this.close(e.detail);
101
- }
102
-
103
- async close(result: ConfirmResult) {
104
- let finalResult = result;
105
- if (finalResult?.confirmed) {
106
- const component = this.getCustomComponent();
107
- if (component?.canAccept) {
108
- const canAccept = await component.canAccept();
109
- if (!canAccept) return;
110
- }
111
- if (component?.accept) {
112
- finalResult = await component.accept(finalResult);
113
- }
114
- }
115
- this.dispatchEvent(new CustomEvent("closed", { detail: finalResult }));
116
- this.modal.style.display = "none";
117
- }
118
-
119
- getCustomComponent(): any {
120
- return this.shadowRoot?.querySelector("#__custom-element__");
121
- }
122
-
123
- @query("#accept-btn")
124
- acceptButton: HTMLElement;
125
-
126
- @query("#actions")
127
- actionsContainer: HTMLElement;
128
-
129
- @query("#header")
130
- header: HTMLElement;
131
-
132
- @query("#content")
133
- content: HTMLElement;
134
-
135
- show() {
136
- this.modal.style.display = "block";
137
- }
138
- }
@@ -1,136 +0,0 @@
1
- .snackbar {
2
- display: flex;
3
- align-items: center;
4
- flex-direction: row;
5
- justify-content: space-between;
6
- gap: 10px;
7
- visibility: hidden; /* Hidden by default. Visible on click */
8
- min-width: 250px; /* Set a default minimum width */
9
- width: 417px;
10
- height: 56px;
11
- background-color: #333;
12
- color: #fff;
13
- text-align: center;
14
- border-radius: 10px;
15
- font-weight: 500;
16
- padding: 12px 16px;
17
- position: fixed;
18
- z-index: 500;
19
- left: 24px;
20
- box-shadow:
21
- 0 0px 2px rgba(0, 0, 0, 0.16),
22
- 0 0px 5px rgba(0, 0, 0, 0.23);
23
- border: 2px solid;
24
- border-color: transparent;
25
-
26
- .snackbar__message {
27
- text-align: left;
28
- margin-right: 24px;
29
- flex: 1;
30
- }
31
-
32
- &.show {
33
- visibility: visible; /* Show the snackbar */
34
- }
35
- &.success {
36
- background-color: var(--color-green-500);
37
- color: white;
38
- box-shadow:
39
- rgb(67 160 71 / 30%) 0px 0px 2px,
40
- rgb(67 160 71 / 22%) 0px 0px 5px;
41
- }
42
- &.error {
43
- background-color: var(--color-red-500);
44
- color: white;
45
- box-shadow:
46
- rgb(229 57 53 / 30%) 0px 0px 2px,
47
- rgb(229 57 53 / 22%) 0px 0px 5px;
48
- }
49
- &.warning {
50
- background-color: var(--color-yellow-500);
51
- color: black;
52
- box-shadow:
53
- rgb(251 140 0 / 30%) 0px 0px 2px,
54
- rgb(251 140 0 / 22%) 0px 0px 5px;
55
- }
56
- &.info {
57
- background-color: var(--color-primary-500);
58
- color: white;
59
- box-shadow:
60
- rgb(14 80 138 / 30%) 0px 0px 2px,
61
- rgb(14 80 138 / 22%) 0px 0px 5px;
62
- }
63
-
64
- &.notification-1 {
65
- -webkit-animation:
66
- fadein 0.3s,
67
- fadeout 0.55s 6s;
68
- animation:
69
- fadein 0.3s,
70
- fadeout 0.55s 6s;
71
- bottom: 72px;
72
- }
73
-
74
- &.notification-2 {
75
- -webkit-animation:
76
- fadein 0.3s,
77
- fadeout 0.55s 6s;
78
- animation:
79
- fadein 0.3s,
80
- fadeout 0.55s 6s;
81
- bottom: 132px;
82
- }
83
- &.notification-3 {
84
- -webkit-animation:
85
- fadein 0.3s,
86
- fadeout 0.55s 6s;
87
- animation:
88
- fadein 0.3s,
89
- fadeout 0.55s 6s;
90
- bottom: 192px;
91
- }
92
-
93
- @-webkit-keyframes fadein {
94
- from {
95
- bottom: 0;
96
- opacity: 0;
97
- }
98
- to {
99
- opacity: 1;
100
- }
101
- }
102
-
103
- @keyframes fadein {
104
- from {
105
- bottom: 0;
106
- opacity: 0;
107
- }
108
- to {
109
- opacity: 1;
110
- }
111
- }
112
-
113
- @-webkit-keyframes fadeout {
114
- from {
115
- opacity: 1;
116
- }
117
- to {
118
- bottom: 0;
119
- opacity: 0;
120
- }
121
- }
122
-
123
- @keyframes fadeout {
124
- from {
125
- opacity: 1;
126
- }
127
- to {
128
- bottom: 0;
129
- opacity: 0;
130
- }
131
- }
132
-
133
- #close-btn {
134
- cursor: pointer;
135
- }
136
- }
@@ -1,69 +0,0 @@
1
- import { LitElement, css, html, unsafeCSS } from "lit";
2
- import { customElement, property, query } from "lit/decorators.js";
3
- import { ifDefined } from "lit/directives/if-defined.js";
4
- import { NotifyOptions, NotifyType } from "../typings";
5
- import styles from "./notifier-component-styles.css?inline";
6
-
7
- function getIcon(type: NotifyType | undefined) {
8
- if (!type) return;
9
-
10
- const types = new Map<NotifyType, string>([
11
- ["error", "error"],
12
- ["info", "info"],
13
- ["warning", "warning"],
14
- ["success", "check_circle"],
15
- ]);
16
-
17
- return types.get(type) as string;
18
- }
19
-
20
- @customElement("notifier-component")
21
- export class NotifierComponent extends LitElement {
22
- render() {
23
- return html`
24
- <div class="snackbar ${this.options.type}">
25
- <dss-icon icon=${ifDefined(getIcon(this.options.type))} size="md"></dss-icon>
26
- <div class="snackbar__message">${this.options.message ?? ""}</div>
27
- <div class="snackbar__action">
28
- <dss-icon @click="${this.close}" id="close-btn" icon="close" size="md"></dss-icon>
29
- </div>
30
- </div>
31
- `;
32
- }
33
-
34
- static get styles() {
35
- return css`
36
- ${unsafeCSS(styles)}
37
- `;
38
- }
39
-
40
- @property({ type: Object })
41
- options: NotifyOptions;
42
-
43
- @query(".snackbar")
44
- snackbar: HTMLElement;
45
-
46
- show() {
47
- this.snackbar.classList.add("show");
48
- }
49
-
50
- clearAndUpdateOrder(order: string) {
51
- const classListValues = this.snackbar.classList.values();
52
-
53
- for (const singleClass of classListValues) {
54
- if (!singleClass.startsWith("notification")) continue;
55
-
56
- this.snackbar.classList.remove(singleClass);
57
- }
58
-
59
- this.snackbar.classList.add(order);
60
-
61
- this.requestUpdate();
62
- }
63
-
64
- close() {
65
- this.snackbar.classList.remove("show");
66
-
67
- this.dispatchEvent(new CustomEvent("closed"));
68
- }
69
- }
@@ -1,35 +0,0 @@
1
- import { dedupeMixin } from "@uxland/lit-utilities";
2
- import { LitElement } from "lit";
3
- import { property } from "lit/decorators.js";
4
- import { ConfirmResult, Constructor } from "./typings";
5
-
6
- export declare class ConfirmMixinBase {
7
- model: any;
8
- outputModel: any;
9
- close(result: ConfirmResult): void;
10
- canAccept(): Promise<boolean> | boolean;
11
- accept(result: ConfirmResult): Promise<ConfirmResult>;
12
- }
13
-
14
- const ConfirmMixin = dedupeMixin(<T extends Constructor<LitElement>>(superClass: T) => {
15
- class ConfirmMixinClass extends superClass implements ConfirmMixinBase {
16
- @property()
17
- model: T;
18
- @property()
19
- outputModel: T;
20
- close(result: ConfirmResult) {
21
- (this as any).dispatchEvent(new CustomEvent("closed", { detail: result }));
22
- }
23
- canAccept(): Promise<boolean> | boolean {
24
- return Promise.resolve(true);
25
- }
26
- accept(result: ConfirmResult): Promise<ConfirmResult> {
27
- return Promise.resolve(result);
28
- }
29
- }
30
- return ConfirmMixinClass as Constructor<ConfirmMixinBase> & T;
31
- });
32
-
33
- export function confirmMixin<T extends Constructor<LitElement>>(superClass: T) {
34
- return ConfirmMixin(superClass as any) as unknown as Constructor<ConfirmMixinBase> & T;
35
- }
@@ -1,9 +0,0 @@
1
- import "./components/dialog-component";
2
- import { buildDialogComponent } from "./shared";
3
- import { ConfirmOptions, ConfirmResult, CustomConfirmOptions } from "./typings";
4
-
5
- export const confirm = async (
6
- options: (ConfirmOptions & CustomConfirmOptions) | any,
7
- ): Promise<ConfirmResult> => {
8
- return buildDialogComponent(options);
9
- };
@@ -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";