@vc-shell/framework 1.0.320 → 1.0.322

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 (121) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/core/api/platform.ts +694 -471
  3. package/core/composables/useNotifications/index.ts +61 -3
  4. package/core/plugins/modularity/index.ts +23 -4
  5. package/core/plugins/signalR/index.ts +42 -10
  6. package/dist/{azuread-DkJALKeY.js → azuread-BhAhqR2s.js} +2 -2
  7. package/dist/core/api/platform.d.ts +186 -162
  8. package/dist/core/api/platform.d.ts.map +1 -1
  9. package/dist/core/composables/useNotifications/index.d.ts +1 -0
  10. package/dist/core/composables/useNotifications/index.d.ts.map +1 -1
  11. package/dist/core/plugins/modularity/index.d.ts +3 -1
  12. package/dist/core/plugins/modularity/index.d.ts.map +1 -1
  13. package/dist/core/plugins/signalR/index.d.ts +2 -1
  14. package/dist/core/plugins/signalR/index.d.ts.map +1 -1
  15. package/dist/{external-provider-BfhXfWct.js → external-provider-CKRKv1EO.js} +1 -1
  16. package/dist/{external-provider.vue_vue_type_script_setup_true_lang-DnfCYH2u.js → external-provider.vue_vue_type_script_setup_true_lang-pVwhlqSS.js} +1 -1
  17. package/dist/external-providers-BuwRmZS6.js +4 -0
  18. package/dist/framework.js +221 -222
  19. package/dist/{index-C1ubuqpz.js → index-1iQcKZcz.js} +1 -1
  20. package/dist/{index-tIxFQ1Ps.js → index-2VvztI5V.js} +1 -1
  21. package/dist/{index-Rnb_pp-E.js → index-BpeR8MpE.js} +1 -1
  22. package/dist/{index-p2XOxNI9.js → index-BqFdtq0j.js} +1 -1
  23. package/dist/{index-a7HiHYrT.js → index-BscDURbV.js} +1 -1
  24. package/dist/{index-Dkh5IMF7.js → index-C280JcJo.js} +1 -1
  25. package/dist/{index-B93I3Agz.js → index-CWRP_8OR.js} +1 -1
  26. package/dist/{index-DY4Xi8u8.js → index-CbVaCsap.js} +1 -1
  27. package/dist/{index-BFdnt4xk.js → index-CecSOxnk.js} +1 -1
  28. package/dist/{index-DMRj0aJ8.js → index-CkzHOg6W.js} +1 -1
  29. package/dist/{index-Bf_KENtH.js → index-D6rLpqm5.js} +1 -1
  30. package/dist/{index-CuqIbypI.js → index-DfABrHB_.js} +40320 -34452
  31. package/dist/{index-B1dqCnPS.js → index-bZ0IrgAu.js} +1 -1
  32. package/dist/{index-kvc5Uc7s.js → index-fuILXn_w.js} +1 -1
  33. package/dist/{index-BXSEbnel.js → index-h2e4Cdwh.js} +1 -1
  34. package/dist/{index-Cp7h8UBT.js → index-jSMgkZQV.js} +1 -1
  35. package/dist/{index-Byl_hvr6.js → index-osebbY9y.js} +8 -8
  36. package/dist/index.css +1 -1
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
  39. package/dist/shared/components/error-interceptor/index.d.ts +1 -9
  40. package/dist/shared/components/error-interceptor/index.d.ts.map +1 -1
  41. package/dist/shared/components/notification-template/index.d.ts +1 -18
  42. package/dist/shared/components/notification-template/index.d.ts.map +1 -1
  43. package/dist/shared/modules/dynamic/index.d.ts.map +1 -1
  44. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
  45. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +1 -1
  46. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
  47. package/dist/tsconfig.tsbuildinfo +1 -1
  48. package/dist/ui/components/atoms/vc-badge/vc-badge.stories.d.ts +5 -100
  49. package/dist/ui/components/atoms/vc-badge/vc-badge.stories.d.ts.map +1 -1
  50. package/dist/ui/components/atoms/vc-button/vc-button.stories.d.ts +13 -468
  51. package/dist/ui/components/atoms/vc-button/vc-button.stories.d.ts.map +1 -1
  52. package/dist/ui/components/atoms/vc-card/index.d.ts +1 -24
  53. package/dist/ui/components/atoms/vc-card/index.d.ts.map +1 -1
  54. package/dist/ui/components/atoms/vc-card/vc-card.stories.d.ts +12 -223
  55. package/dist/ui/components/atoms/vc-card/vc-card.stories.d.ts.map +1 -1
  56. package/dist/ui/components/atoms/vc-col/vc-col.stories.d.ts +1 -6
  57. package/dist/ui/components/atoms/vc-col/vc-col.stories.d.ts.map +1 -1
  58. package/dist/ui/components/atoms/vc-container/index.d.ts +6 -13
  59. package/dist/ui/components/atoms/vc-container/index.d.ts.map +1 -1
  60. package/dist/ui/components/atoms/vc-container/vc-container.vue.d.ts +3 -0
  61. package/dist/ui/components/atoms/vc-container/vc-container.vue.d.ts.map +1 -1
  62. package/dist/ui/components/atoms/vc-hint/index.d.ts +1 -1
  63. package/dist/ui/components/atoms/vc-hint/vc-hint.stories.d.ts +1 -1
  64. package/dist/ui/components/atoms/vc-label/vc-label.stories.d.ts +1 -15
  65. package/dist/ui/components/atoms/vc-label/vc-label.stories.d.ts.map +1 -1
  66. package/dist/ui/components/atoms/vc-link/index.d.ts +1 -13
  67. package/dist/ui/components/atoms/vc-link/index.d.ts.map +1 -1
  68. package/dist/ui/components/atoms/vc-link/vc-link.stories.d.ts +1 -13
  69. package/dist/ui/components/atoms/vc-link/vc-link.stories.d.ts.map +1 -1
  70. package/dist/ui/components/atoms/vc-progress/index.d.ts +1 -10
  71. package/dist/ui/components/atoms/vc-progress/index.d.ts.map +1 -1
  72. package/dist/ui/components/atoms/vc-progress/vc-progress.stories.d.ts +1 -10
  73. package/dist/ui/components/atoms/vc-progress/vc-progress.stories.d.ts.map +1 -1
  74. package/dist/ui/components/atoms/vc-row/vc-row.stories.d.ts +1 -1
  75. package/dist/ui/components/atoms/vc-status/vc-status.stories.d.ts +1 -13
  76. package/dist/ui/components/atoms/vc-status/vc-status.stories.d.ts.map +1 -1
  77. package/dist/ui/components/molecules/vc-checkbox/index.d.ts +1 -42
  78. package/dist/ui/components/molecules/vc-checkbox/index.d.ts.map +1 -1
  79. package/dist/ui/components/molecules/vc-checkbox/vc-checkbox.stories.d.ts +10 -420
  80. package/dist/ui/components/molecules/vc-checkbox/vc-checkbox.stories.d.ts.map +1 -1
  81. package/dist/ui/components/molecules/vc-editor/vc-editor.stories.d.ts +1 -41
  82. package/dist/ui/components/molecules/vc-editor/vc-editor.stories.d.ts.map +1 -1
  83. package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.stories.d.ts +1 -35
  84. package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.stories.d.ts.map +1 -1
  85. package/dist/ui/components/molecules/vc-form/index.d.ts +1 -1
  86. package/dist/ui/components/molecules/vc-form/vc-form.stories.d.ts +1 -1
  87. package/dist/ui/components/molecules/vc-input/vc-input.stories.d.ts +6 -79
  88. package/dist/ui/components/molecules/vc-input/vc-input.stories.d.ts.map +1 -1
  89. package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts +3 -0
  90. package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts.map +1 -1
  91. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.stories.d.ts +1 -80
  92. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.stories.d.ts.map +1 -1
  93. package/dist/ui/components/molecules/vc-radio-button/vc-radio-button.stories.d.ts +4 -136
  94. package/dist/ui/components/molecules/vc-radio-button/vc-radio-button.stories.d.ts.map +1 -1
  95. package/dist/ui/components/molecules/vc-rating/vc-rating.stories.d.ts +4 -92
  96. package/dist/ui/components/molecules/vc-rating/vc-rating.stories.d.ts.map +1 -1
  97. package/dist/ui/components/molecules/vc-slider/index.d.ts +1 -20
  98. package/dist/ui/components/molecules/vc-slider/index.d.ts.map +1 -1
  99. package/dist/ui/components/molecules/vc-slider/vc-slider.stories.d.ts +1 -20
  100. package/dist/ui/components/molecules/vc-slider/vc-slider.stories.d.ts.map +1 -1
  101. package/dist/ui/components/molecules/vc-textarea/vc-textarea.stories.d.ts +70 -294
  102. package/dist/ui/components/molecules/vc-textarea/vc-textarea.stories.d.ts.map +1 -1
  103. package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts +3 -1
  104. package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts.map +1 -1
  105. package/dist/ui/components/organisms/vc-app/vc-app.stories.d.ts +1 -27
  106. package/dist/ui/components/organisms/vc-app/vc-app.stories.d.ts.map +1 -1
  107. package/dist/ui/components/organisms/vc-blade/vc-blade.stories.d.ts +1 -38
  108. package/dist/ui/components/organisms/vc-blade/vc-blade.stories.d.ts.map +1 -1
  109. package/package.json +4 -4
  110. package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +13 -12
  111. package/shared/modules/dynamic/helpers/override.ts +8 -1
  112. package/shared/modules/dynamic/index.ts +22 -11
  113. package/shared/modules/dynamic/pages/dynamic-blade-form.vue +9 -11
  114. package/shared/modules/dynamic/pages/dynamic-blade-list.vue +0 -17
  115. package/ui/components/atoms/vc-button/vc-button.vue +2 -2
  116. package/ui/components/atoms/vc-container/vc-container.vue +6 -0
  117. package/ui/components/molecules/vc-input/vc-input.vue +6 -0
  118. package/ui/components/molecules/vc-textarea/vc-textarea.vue +8 -0
  119. package/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +2 -2
  120. package/ui/components/organisms/vc-blade/vc-blade.vue +5 -5
  121. package/dist/external-providers-Dd3QYSAe.js +0 -4
@@ -1,5 +1,5 @@
1
1
  import { PushNotification, PushNotificationClient } from "./../../api/platform";
2
- import { computed, ComputedRef, ref } from "vue";
2
+ import { computed, ComputedRef, ref, onUnmounted } from "vue";
3
3
  import * as _ from "lodash-es";
4
4
 
5
5
  const notificationsClient = new PushNotificationClient();
@@ -11,12 +11,43 @@ interface INotifications {
11
11
  addNotification(message: PushNotification): void;
12
12
  markAsRead(message: PushNotification): void;
13
13
  markAllAsRead(): void;
14
+ setNotificationHandler(handler: (notification: PushNotification) => void): void;
14
15
  }
15
16
 
16
17
  const notifications = ref<PushNotification[]>([]);
17
18
  const pushNotifications = ref<PushNotification[]>([]);
18
19
 
20
+ // Global subscribers storage and their handlers
21
+ const subscribers = new Map<
22
+ string,
23
+ {
24
+ id: number;
25
+ handler?: (notification: PushNotification) => void;
26
+ }
27
+ >();
28
+
29
+ let subscriberCounter = 0;
30
+
19
31
  export function useNotifications(notifyType?: string | string[]): INotifications {
32
+ if (notifyType) {
33
+ const types = Array.isArray(notifyType) ? notifyType : [notifyType];
34
+
35
+ // Check existing subscriptions
36
+ types.forEach((type) => {
37
+ if (!subscribers.has(type)) {
38
+ subscribers.set(type, {
39
+ id: ++subscriberCounter,
40
+ });
41
+ }
42
+ });
43
+
44
+ onUnmounted(() => {
45
+ types.forEach((type) => {
46
+ subscribers.delete(type);
47
+ });
48
+ });
49
+ }
50
+
20
51
  async function loadFromHistory(take = 10) {
21
52
  // TODO temporary workaround to get push notifications without base type
22
53
  try {
@@ -41,7 +72,7 @@ export function useNotifications(notifyType?: string | string[]): INotifications
41
72
  function addNotification(message: PushNotification) {
42
73
  if (message.notifyType !== "IndexProgressPushNotification") {
43
74
  const existsNotification = notifications.value.find((x: PushNotification) => x.id == message.id);
44
- const existPushNotification = pushNotifications.value.find((x) => x.id == message.id);
75
+ const existPushNotification = pushNotifications.value.find((x: PushNotification) => x.id == message.id);
45
76
 
46
77
  if (existsNotification) {
47
78
  message.isNew = existsNotification.isNew;
@@ -56,6 +87,14 @@ export function useNotifications(notifyType?: string | string[]): INotifications
56
87
  } else {
57
88
  pushNotifications.value.push(new PushNotification(message));
58
89
  }
90
+
91
+ // Check if there is a handler for this type of notification
92
+ if (message.isNew && message.notifyType && subscribers.has(message.notifyType)) {
93
+ const subscriber = subscribers.get(message.notifyType);
94
+ if (subscriber?.handler) {
95
+ subscriber.handler(message);
96
+ }
97
+ }
59
98
  }
60
99
  }
61
100
 
@@ -87,11 +126,29 @@ export function useNotifications(notifyType?: string | string[]): INotifications
87
126
  }
88
127
  }
89
128
 
129
+ function setNotificationHandler(handler: (notification: PushNotification) => void) {
130
+ if (notifyType) {
131
+ const types = Array.isArray(notifyType) ? notifyType : [notifyType];
132
+ types.forEach((type) => {
133
+ const subscriber = subscribers.get(type);
134
+ if (subscriber) {
135
+ subscriber.handler = handler;
136
+ }
137
+ });
138
+ }
139
+ }
140
+
90
141
  const moduleNotifications = computed(() => {
142
+ if (!notifyType) {
143
+ return [];
144
+ }
145
+
146
+ const types = Array.isArray(notifyType) ? notifyType : [notifyType];
147
+
91
148
  return (
92
149
  pushNotifications.value.filter(
93
150
  (item: PushNotification) =>
94
- item.isNew && !!item.notifyType && !!notifyType && notifyType.includes(item.notifyType),
151
+ item.isNew && item.notifyType && types.includes(item.notifyType) && subscribers.has(item.notifyType),
95
152
  ) ?? []
96
153
  );
97
154
  });
@@ -103,5 +160,6 @@ export function useNotifications(notifyType?: string | string[]): INotifications
103
160
  addNotification,
104
161
  markAsRead,
105
162
  markAllAsRead,
163
+ setNotificationHandler,
106
164
  };
107
165
  }
@@ -1,10 +1,11 @@
1
- import { App, Component, h } from "vue";
1
+ import { App, Component, h, watch } from "vue";
2
2
  import { i18n } from "./../i18n";
3
3
  import { Router } from "vue-router";
4
4
  import { BladeInstanceConstructor, BladeVNode } from "./../../../shared/components/blade-navigation/types";
5
5
  import { kebabToPascal } from "./../../utilities";
6
- import { useMenuService } from "../../composables";
6
+ import { useMenuService, useNotifications } from "../../composables";
7
7
  import * as _ from "lodash-es";
8
+ import { notification } from "../../../shared";
8
9
 
9
10
  export const createModule = (components: { [key: string]: BladeInstanceConstructor }, locales?: unknown) => ({
10
11
  install(app: App): void {
@@ -34,7 +35,7 @@ export const createModule = (components: { [key: string]: BladeInstanceConstruct
34
35
  export const createAppModule = (
35
36
  pages: { [key: string]: BladeInstanceConstructor },
36
37
  locales?: { [key: string]: object },
37
- notificationTemplates?: { [key: string]: Component },
38
+ notificationTemplates?: { [key: string]: Component & { notifyType: string } },
38
39
  moduleComponents?: { [key: string]: Component },
39
40
  ) => {
40
41
  return {
@@ -104,6 +105,24 @@ export const createAppModule = (
104
105
  page.moduleUid = uid;
105
106
  }
106
107
 
108
+ if (page.notifyType) {
109
+ const notifyTypes = Array.isArray(page.notifyType) ? page.notifyType : [page.notifyType];
110
+
111
+ if (notifyTypes.length > 0) {
112
+ const { markAsRead, setNotificationHandler } = useNotifications(notifyTypes);
113
+
114
+ setNotificationHandler((message) => {
115
+ if (message.title) {
116
+ notification(message.title, {
117
+ onClose() {
118
+ markAsRead(message);
119
+ },
120
+ });
121
+ }
122
+ });
123
+ }
124
+ }
125
+
107
126
  // Dynamically add pages to Vue Router
108
127
  if (page.url) {
109
128
  const mainRoute = routerInstance.getRoutes().find((r) => r.meta?.root);
@@ -196,7 +215,7 @@ export const createAppModule = (
196
215
  // Remove existing template if it exists
197
216
  if (app.config.globalProperties.notificationTemplates) {
198
217
  const existingIndex = app.config.globalProperties.notificationTemplates.findIndex(
199
- (t: Component) => t.name === template.name,
218
+ (t: Component & { notifyType: string }) => t.notifyType === template.notifyType,
200
219
  );
201
220
  if (existingIndex !== -1) {
202
221
  app.config.globalProperties.notificationTemplates.splice(existingIndex, 1);
@@ -1,11 +1,31 @@
1
- import { App, watch } from "vue";
2
- import { HubConnectionBuilder, LogLevel } from "@microsoft/signalr";
1
+ import { App, watch, ref, InjectionKey } from "vue";
2
+ import { HubConnection, HubConnectionBuilder, LogLevel } from "@microsoft/signalr";
3
3
  import { PushNotification } from "../../api/platform";
4
4
  import { useNotifications } from "./../../composables/useNotifications";
5
5
  import { useUser } from "../../composables/useUser";
6
6
  import { useCypressSignalRMock } from "cypress-signalr-mock";
7
7
 
8
8
  const { addNotification } = useNotifications();
9
+ const currentCreator = ref<string | undefined>();
10
+
11
+ export const updateSignalRCreatorSymbol = Symbol("updateSignalRCreator") as InjectionKey<
12
+ (creator: string | undefined) => void
13
+ >;
14
+
15
+ function setupSystemEventsHandler(connection: HubConnection, creator?: string) {
16
+ // Unsubscribe from the previous handler if it was
17
+ connection.off("SendSystemEvents");
18
+
19
+ // Subscribe to events with the new creator
20
+ if (creator) {
21
+ console.log("[SignalR] Setup handler for creator: ", creator);
22
+ connection.on("SendSystemEvents", (message: PushNotification) => {
23
+ if (message.creator === creator) {
24
+ addNotification(message);
25
+ }
26
+ });
27
+ }
28
+ }
9
29
 
10
30
  export const signalR = {
11
31
  install(
@@ -14,6 +34,7 @@ export const signalR = {
14
34
  creator?: string;
15
35
  },
16
36
  ) {
37
+ currentCreator.value = options?.creator;
17
38
  const { isAuthenticated } = useUser();
18
39
  let reconnect = false;
19
40
  const connection =
@@ -28,10 +49,11 @@ export const signalR = {
28
49
  connection
29
50
  .start()
30
51
  .then(() => {
31
- console.log("SignalR Connected.");
52
+ console.log("[SignalR] Connected.");
53
+ setupSystemEventsHandler(connection, currentCreator.value);
32
54
  })
33
55
  .catch((err) => {
34
- console.log("SignalR Connection Error: ", err);
56
+ console.log("[SignalR] Connection Error: ", err);
35
57
  setTimeout(() => start(), 5000);
36
58
  });
37
59
  };
@@ -48,13 +70,16 @@ export const signalR = {
48
70
  addNotification(message);
49
71
  });
50
72
 
51
- if (options?.creator) {
52
- connection.on("SendSystemEvents", (message: PushNotification) => {
53
- if (message.creator === options.creator) {
54
- addNotification(message);
73
+ // Watch for changes in the creator
74
+ watch(
75
+ currentCreator,
76
+ (newCreator) => {
77
+ if (newCreator && connection.state === "Connected") {
78
+ setupSystemEventsHandler(connection, newCreator);
55
79
  }
56
- });
57
- }
80
+ },
81
+ { immediate: true },
82
+ );
58
83
 
59
84
  watch(
60
85
  isAuthenticated,
@@ -69,5 +94,12 @@ export const signalR = {
69
94
  },
70
95
  { immediate: true },
71
96
  );
97
+
98
+ app.config.globalProperties.$updateSignalRCreator = (creator: string | undefined) => {
99
+ currentCreator.value = creator;
100
+ };
101
+ app.provide(updateSignalRCreatorSymbol, (creator: string | undefined) => {
102
+ currentCreator.value = creator;
103
+ });
72
104
  },
73
105
  };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as a, openBlock as i, createBlock as r, unref as t } from "vue";
2
- import { _ as p } from "./external-provider.vue_vue_type_script_setup_true_lang-DnfCYH2u.js";
3
- import { u as s } from "./index-CuqIbypI.js";
2
+ import { _ as p } from "./external-provider.vue_vue_type_script_setup_true_lang-pVwhlqSS.js";
3
+ import { u as s } from "./index-DfABrHB_.js";
4
4
  const g = /* @__PURE__ */ a({
5
5
  __name: "azuread",
6
6
  props: {