@g1cloud/open-bluesea-core 1.0.0-alpha.3 → 1.0.0-alpha.5

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.d.ts CHANGED
@@ -27,6 +27,8 @@ export { default as BSContextMenuContainer } from '@/contextmenu/BSContextMenuCo
27
27
  export { default as BSContextMenu } from '@/contextmenu/BSContextMenu.vue';
28
28
  export * from '@/contextmenu/contextMenuPlugin';
29
29
  export type * from '@/contextmenu/contextMenuPlugin';
30
+ export * from '@/notification/notificationPlugin';
31
+ export type * from '@/notification/notificationPlugin';
30
32
  export type { PageInfo } from '@/component/basic/PageNavigation.model';
31
33
  export { default as vTooltip } from '@/directive/vTooltip';
32
34
  export { default as vFocusOnLoad } from '@/directive/vFocusOnLoad';
@@ -91,7 +91,36 @@ const BlueseaPlugin = {
91
91
  }
92
92
  };
93
93
  const notificationEntries = reactive([]);
94
+ let nextEntryId = 0;
95
+ const showNotification = (message, style = "info", durationInMilliSeconds = 3e3) => {
96
+ const entryId = ++nextEntryId;
97
+ notificationEntries.unshift({
98
+ entryId,
99
+ message,
100
+ style,
101
+ duration: durationInMilliSeconds
102
+ });
103
+ setTimeout(() => {
104
+ const index = notificationEntries.findIndex((entry) => entry.entryId === entryId);
105
+ notificationEntries.splice(index, 1);
106
+ }, durationInMilliSeconds);
107
+ };
94
108
  const alarmEntries = reactive([]);
109
+ let nextAlarmEntryId = 0;
110
+ const showAlarm = (component, durationInMilliSeconds = 3e3) => {
111
+ const entryId = ++nextAlarmEntryId;
112
+ alarmEntries.push({
113
+ entryId,
114
+ component: markRaw(component),
115
+ duration: durationInMilliSeconds
116
+ });
117
+ };
118
+ const closeAlarm = (entryId) => {
119
+ const index = alarmEntries.findIndex((entry) => entry.entryId === entryId);
120
+ if (index >= 0) {
121
+ alarmEntries.splice(index, 1);
122
+ }
123
+ };
95
124
  const tooltipEntry = ref();
96
125
  const showTooltip = (content, target) => {
97
126
  tooltipEntry.value = {
@@ -109,6 +138,30 @@ const isTooltipDisplayed = () => {
109
138
  return !!tooltipEntry.value;
110
139
  };
111
140
  const showLoadingIcon = ref(false);
141
+ let showLoadingCount = 0;
142
+ const showLoading = () => {
143
+ showLoadingCount++;
144
+ showLoadingIcon.value = showLoadingCount > 0;
145
+ };
146
+ const hideLoading = () => {
147
+ showLoadingCount = Math.max(0, showLoadingCount - 1);
148
+ showLoadingIcon.value = showLoadingCount > 0;
149
+ };
150
+ const withLoading = async (func) => {
151
+ let shown = false;
152
+ const timeoutId = window.setTimeout(() => {
153
+ showLoading();
154
+ shown = true;
155
+ }, 300);
156
+ try {
157
+ return await func();
158
+ } finally {
159
+ if (shown)
160
+ hideLoading();
161
+ if (timeoutId)
162
+ window.clearTimeout(timeoutId);
163
+ }
164
+ };
112
165
  const DEFAULT_TOOLTIP_SHOW_DELAY = 800;
113
166
  const DEFAULT_TOOLTIP_HIDE_DELAY = 0;
114
167
  const setTooltipParam = (el, param) => {
@@ -4559,12 +4612,24 @@ export {
4559
4612
  BlueseaPlugin,
4560
4613
  ContextMenuPluginKey,
4561
4614
  SavePointImpl,
4615
+ alarmEntries,
4562
4616
  cancelProvidedSavePoint,
4617
+ closeAlarm,
4563
4618
  createContextMenuPlugin,
4564
4619
  debounce,
4620
+ hideLoading,
4621
+ hideTooltip,
4622
+ isTooltipDisplayed,
4565
4623
  notNull,
4624
+ notificationEntries,
4566
4625
  provideFieldContext,
4567
4626
  provideSavePoint,
4627
+ showAlarm,
4628
+ showLoading,
4629
+ showLoadingIcon,
4630
+ showNotification,
4631
+ showTooltip,
4632
+ tooltipEntry,
4568
4633
  tryUntil,
4569
4634
  useContextMenu,
4570
4635
  useContextMenuOptional,
@@ -4574,5 +4639,6 @@ export {
4574
4639
  vFocusOnLoad,
4575
4640
  vTooltip,
4576
4641
  waitDuring,
4577
- waitUntil
4642
+ waitUntil,
4643
+ withLoading
4578
4644
  };
@@ -93,7 +93,36 @@
93
93
  }
94
94
  };
95
95
  const notificationEntries = vue.reactive([]);
96
+ let nextEntryId = 0;
97
+ const showNotification = (message, style = "info", durationInMilliSeconds = 3e3) => {
98
+ const entryId = ++nextEntryId;
99
+ notificationEntries.unshift({
100
+ entryId,
101
+ message,
102
+ style,
103
+ duration: durationInMilliSeconds
104
+ });
105
+ setTimeout(() => {
106
+ const index = notificationEntries.findIndex((entry) => entry.entryId === entryId);
107
+ notificationEntries.splice(index, 1);
108
+ }, durationInMilliSeconds);
109
+ };
96
110
  const alarmEntries = vue.reactive([]);
111
+ let nextAlarmEntryId = 0;
112
+ const showAlarm = (component, durationInMilliSeconds = 3e3) => {
113
+ const entryId = ++nextAlarmEntryId;
114
+ alarmEntries.push({
115
+ entryId,
116
+ component: vue.markRaw(component),
117
+ duration: durationInMilliSeconds
118
+ });
119
+ };
120
+ const closeAlarm = (entryId) => {
121
+ const index = alarmEntries.findIndex((entry) => entry.entryId === entryId);
122
+ if (index >= 0) {
123
+ alarmEntries.splice(index, 1);
124
+ }
125
+ };
97
126
  const tooltipEntry = vue.ref();
98
127
  const showTooltip = (content, target) => {
99
128
  tooltipEntry.value = {
@@ -111,6 +140,30 @@
111
140
  return !!tooltipEntry.value;
112
141
  };
113
142
  const showLoadingIcon = vue.ref(false);
143
+ let showLoadingCount = 0;
144
+ const showLoading = () => {
145
+ showLoadingCount++;
146
+ showLoadingIcon.value = showLoadingCount > 0;
147
+ };
148
+ const hideLoading = () => {
149
+ showLoadingCount = Math.max(0, showLoadingCount - 1);
150
+ showLoadingIcon.value = showLoadingCount > 0;
151
+ };
152
+ const withLoading = async (func) => {
153
+ let shown = false;
154
+ const timeoutId = window.setTimeout(() => {
155
+ showLoading();
156
+ shown = true;
157
+ }, 300);
158
+ try {
159
+ return await func();
160
+ } finally {
161
+ if (shown)
162
+ hideLoading();
163
+ if (timeoutId)
164
+ window.clearTimeout(timeoutId);
165
+ }
166
+ };
114
167
  const DEFAULT_TOOLTIP_SHOW_DELAY = 800;
115
168
  const DEFAULT_TOOLTIP_HIDE_DELAY = 0;
116
169
  const setTooltipParam = (el, param) => {
@@ -4560,12 +4613,24 @@
4560
4613
  exports2.BlueseaPlugin = BlueseaPlugin;
4561
4614
  exports2.ContextMenuPluginKey = ContextMenuPluginKey;
4562
4615
  exports2.SavePointImpl = SavePointImpl;
4616
+ exports2.alarmEntries = alarmEntries;
4563
4617
  exports2.cancelProvidedSavePoint = cancelProvidedSavePoint;
4618
+ exports2.closeAlarm = closeAlarm;
4564
4619
  exports2.createContextMenuPlugin = createContextMenuPlugin;
4565
4620
  exports2.debounce = debounce;
4621
+ exports2.hideLoading = hideLoading;
4622
+ exports2.hideTooltip = hideTooltip;
4623
+ exports2.isTooltipDisplayed = isTooltipDisplayed;
4566
4624
  exports2.notNull = notNull;
4625
+ exports2.notificationEntries = notificationEntries;
4567
4626
  exports2.provideFieldContext = provideFieldContext;
4568
4627
  exports2.provideSavePoint = provideSavePoint;
4628
+ exports2.showAlarm = showAlarm;
4629
+ exports2.showLoading = showLoading;
4630
+ exports2.showLoadingIcon = showLoadingIcon;
4631
+ exports2.showNotification = showNotification;
4632
+ exports2.showTooltip = showTooltip;
4633
+ exports2.tooltipEntry = tooltipEntry;
4569
4634
  exports2.tryUntil = tryUntil;
4570
4635
  exports2.useContextMenu = useContextMenu;
4571
4636
  exports2.useContextMenuOptional = useContextMenuOptional;
@@ -4576,5 +4641,6 @@
4576
4641
  exports2.vTooltip = vTooltip;
4577
4642
  exports2.waitDuring = waitDuring;
4578
4643
  exports2.waitUntil = waitUntil;
4644
+ exports2.withLoading = withLoading;
4579
4645
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
4580
4646
  }));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Vue UI Library for Management Console.",
4
4
  "license": "Proprietary",
5
5
  "private": false,
6
- "version": "1.0.0-alpha.3",
6
+ "version": "1.0.0-alpha.5",
7
7
  "type": "module",
8
8
  "engines": {
9
9
  "node": ">= 24.3.0"
@@ -12,6 +12,15 @@
12
12
  "main": "./dist/open-bluesea-core.umd.js",
13
13
  "module": "./dist/open-bluesea-core.es.js",
14
14
  "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/open-bluesea-core.es.js",
19
+ "require": "./dist/open-bluesea-core.umd.js"
20
+ },
21
+ "./css/*": "./css/*",
22
+ "./dist/*": "./dist/*"
23
+ },
15
24
  "files": [
16
25
  "dist",
17
26
  "css",