zf-dbs 2.0.2 → 2.1.2
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 +3 -0
- package/dist/index.mjs +90 -81
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -145,6 +145,9 @@ declare type ServiceHandleHasParams<Params, Result> = (params: Params, config?:
|
|
|
145
145
|
declare type ServiceHandleNoParams<Result> = (params?: any, config?: Record<string, any>) => Promise<Result>;
|
|
146
146
|
|
|
147
147
|
export declare class Ue extends EventListener_2 {
|
|
148
|
+
__handleDispatchEvent(name: string, ...args: unknown[]): any;
|
|
149
|
+
__handleAddEventListener(name: string): void;
|
|
150
|
+
__handleRemoveEventListener(name: string): void;
|
|
148
151
|
/**
|
|
149
152
|
* 发送事件
|
|
150
153
|
* @param {string} name 事件名称
|
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { z as X, d as Y, u as ee, b as
|
|
1
|
+
import { a as E, g as O, m as A, t as S, _ as q } from "./chunks/qN7meZTV.mjs";
|
|
2
|
+
import { z as X, d as Y, u as ee, b as te } from "./chunks/qN7meZTV.mjs";
|
|
3
3
|
import { _ as j } from "./chunks/Ck0Cdfr_.mjs";
|
|
4
4
|
import { _ as N } from "./chunks/BHHE86vT.mjs";
|
|
5
|
-
import { z as
|
|
6
|
-
import { ref as i, shallowRef as z, onMounted as
|
|
7
|
-
import { ElNotification as
|
|
5
|
+
import { z as oe } from "./chunks/BHHE86vT.mjs";
|
|
6
|
+
import { ref as i, shallowRef as z, onMounted as L, onBeforeUnmount as P } from "vue";
|
|
7
|
+
import { ElNotification as R } from "element-plus";
|
|
8
8
|
import { Z as se } from "./chunks/DbOTUn3A.mjs";
|
|
9
|
-
const
|
|
10
|
-
return
|
|
9
|
+
const B = function(t) {
|
|
10
|
+
return t;
|
|
11
11
|
};
|
|
12
|
-
function
|
|
12
|
+
function T() {
|
|
13
13
|
return {
|
|
14
|
-
delay:
|
|
14
|
+
delay: E.value?.pollingInterval || 3e3,
|
|
15
15
|
immediate: !0,
|
|
16
16
|
leading: !0,
|
|
17
17
|
resetOnExecute: !1,
|
|
@@ -23,171 +23,180 @@ function Z() {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
return new Promise((
|
|
28
|
-
requestAnimationFrame(() =>
|
|
26
|
+
function U() {
|
|
27
|
+
return new Promise((t) => {
|
|
28
|
+
requestAnimationFrame(() => t());
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
const
|
|
31
|
+
function Z(t, e, n) {
|
|
32
|
+
const o = Object.assign(T(), n ?? {}), r = i(0), f = e, p = o.shallow ? z(f) : i(f), d = i(!1), v = i(null), l = i(null), u = i(!0), m = () => {
|
|
33
33
|
l.value !== null && (clearTimeout(l.value), l.value = null);
|
|
34
34
|
}, C = (c) => {
|
|
35
|
-
Object.assign(
|
|
36
|
-
},
|
|
35
|
+
Object.assign(o, c);
|
|
36
|
+
}, h = async (c) => {
|
|
37
37
|
const g = Object.assign(
|
|
38
38
|
{
|
|
39
|
-
resetOnExecute:
|
|
40
|
-
throwError:
|
|
41
|
-
onError:
|
|
42
|
-
onSuccess:
|
|
39
|
+
resetOnExecute: o.resetOnExecute,
|
|
40
|
+
throwError: o.throwError,
|
|
41
|
+
onError: o.onError,
|
|
42
|
+
onSuccess: o.onSuccess
|
|
43
43
|
},
|
|
44
44
|
c ?? {}
|
|
45
45
|
);
|
|
46
46
|
r.value += 1;
|
|
47
|
-
const
|
|
48
|
-
d.value = !0, g.resetOnExecute && (p.value =
|
|
47
|
+
const _ = r.value;
|
|
48
|
+
d.value = !0, g.resetOnExecute && (p.value = e);
|
|
49
49
|
try {
|
|
50
|
-
const s = await Promise.resolve(
|
|
51
|
-
|
|
50
|
+
const s = await Promise.resolve(t());
|
|
51
|
+
_ === r.value && (v.value = null, p.value = s, g.onSuccess?.(s));
|
|
52
52
|
} catch (s) {
|
|
53
|
-
if (
|
|
53
|
+
if (_ === r.value && (v.value = s, g.onError?.(s), g.throwError))
|
|
54
54
|
throw s;
|
|
55
55
|
} finally {
|
|
56
|
-
|
|
56
|
+
_ === r.value && (d.value = !1);
|
|
57
57
|
}
|
|
58
|
-
},
|
|
58
|
+
}, b = () => {
|
|
59
59
|
m(), !u.value && (l.value = setTimeout(async () => {
|
|
60
60
|
if (l.value = null, !u.value)
|
|
61
61
|
try {
|
|
62
|
-
await
|
|
62
|
+
await h();
|
|
63
63
|
} catch {
|
|
64
64
|
} finally {
|
|
65
|
-
await
|
|
65
|
+
await U(), u.value || b();
|
|
66
66
|
}
|
|
67
|
-
},
|
|
68
|
-
},
|
|
67
|
+
}, o.delay));
|
|
68
|
+
}, w = () => {
|
|
69
69
|
u.value = !0, m();
|
|
70
|
-
}, x = (c = { leading:
|
|
71
|
-
u.value = !1, m(), c.leading &&
|
|
72
|
-
}),
|
|
70
|
+
}, x = (c = { leading: o.leading }) => {
|
|
71
|
+
u.value = !1, m(), c.leading && h().catch(() => {
|
|
72
|
+
}), b();
|
|
73
73
|
}, y = () => {
|
|
74
|
-
|
|
74
|
+
w(), r.value = 0, p.value = e, d.value = !1, v.value = null, o.immediate && x();
|
|
75
75
|
};
|
|
76
|
-
return
|
|
76
|
+
return L(() => {
|
|
77
77
|
y();
|
|
78
|
-
}),
|
|
79
|
-
|
|
78
|
+
}), P(() => {
|
|
79
|
+
w();
|
|
80
80
|
}), {
|
|
81
81
|
state: p,
|
|
82
82
|
isLoading: d,
|
|
83
83
|
error: v,
|
|
84
|
-
execute:
|
|
85
|
-
pause:
|
|
84
|
+
execute: h,
|
|
85
|
+
pause: w,
|
|
86
86
|
resume: x,
|
|
87
87
|
reset: y,
|
|
88
88
|
setConfig: C
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
function k(
|
|
92
|
-
return
|
|
91
|
+
function k(t, e, n) {
|
|
92
|
+
return Z(t, e, n).state;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
if (!
|
|
94
|
+
function D() {
|
|
95
|
+
if (!E.value)
|
|
96
96
|
throw new Error("请先调用 defineAppConfig 进行配置");
|
|
97
|
-
return
|
|
97
|
+
return E.value;
|
|
98
98
|
}
|
|
99
|
-
const a = Object.assign(function(
|
|
100
|
-
return
|
|
101
|
-
...
|
|
99
|
+
const a = Object.assign(function(t) {
|
|
100
|
+
return R({
|
|
101
|
+
...t,
|
|
102
102
|
appendTo: O().appViewElement || document.body || void 0
|
|
103
103
|
});
|
|
104
104
|
}, {
|
|
105
|
-
success(
|
|
105
|
+
success(t) {
|
|
106
106
|
return a({
|
|
107
|
-
...
|
|
107
|
+
...t,
|
|
108
108
|
type: "success"
|
|
109
109
|
});
|
|
110
110
|
},
|
|
111
|
-
info(
|
|
111
|
+
info(t) {
|
|
112
112
|
return a({
|
|
113
|
-
...
|
|
113
|
+
...t,
|
|
114
114
|
type: "info"
|
|
115
115
|
});
|
|
116
116
|
},
|
|
117
|
-
warning(
|
|
117
|
+
warning(t) {
|
|
118
118
|
return a({
|
|
119
|
-
...
|
|
119
|
+
...t,
|
|
120
120
|
type: "warning"
|
|
121
121
|
});
|
|
122
122
|
},
|
|
123
|
-
error(
|
|
123
|
+
error(t) {
|
|
124
124
|
return a({
|
|
125
|
-
...
|
|
125
|
+
...t,
|
|
126
126
|
type: "error"
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
}), G = A(() => {
|
|
130
|
-
const
|
|
130
|
+
const t = D();
|
|
131
131
|
return {
|
|
132
|
-
...
|
|
133
|
-
errorHandle(
|
|
134
|
-
if (
|
|
135
|
-
return
|
|
132
|
+
...t.request,
|
|
133
|
+
errorHandle(e, n, o) {
|
|
134
|
+
if (t.request.showErrorMessage && a.error({ message: n }), t.request.errorHandle)
|
|
135
|
+
return t.request.errorHandle(e, n, o);
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
138
|
});
|
|
139
|
-
class
|
|
139
|
+
class H extends S {
|
|
140
|
+
__handleDispatchEvent(e, ...n) {
|
|
141
|
+
return window?.ue?.web?.[e]?.(...n);
|
|
142
|
+
}
|
|
143
|
+
__handleAddEventListener(e) {
|
|
144
|
+
window[e] || (window[e] = this.dispatchEvent.bind(this, e));
|
|
145
|
+
}
|
|
146
|
+
__handleRemoveEventListener(e) {
|
|
147
|
+
this.listeners(e).length || delete window[e];
|
|
148
|
+
}
|
|
140
149
|
/**
|
|
141
150
|
* 发送事件
|
|
142
151
|
* @param {string} name 事件名称
|
|
143
152
|
* @param {unknown[]} args 参数
|
|
144
153
|
*/
|
|
145
|
-
emit(
|
|
146
|
-
return
|
|
154
|
+
emit(e, ...n) {
|
|
155
|
+
return n = n.map((o) => JSON.parse(JSON.stringify(o))), console.log(`%c发送UE事件 %c${e}`, "color: #529b2e; font-weight: bold;", "color: #337ecc", ...n), this.__handleDispatchEvent(e, ...n);
|
|
147
156
|
}
|
|
148
157
|
/**
|
|
149
158
|
* 注册事件
|
|
150
159
|
* @param {string} name 事件名称
|
|
151
160
|
* @param {UnknownFunction} listener 事件处理函数
|
|
152
161
|
*/
|
|
153
|
-
on(
|
|
154
|
-
return console.log(`%c注册UE事件 %c${
|
|
162
|
+
on(e, n) {
|
|
163
|
+
return console.log(`%c注册UE事件 %c${e}`, "color: #b88230; font-weight: bold;", "color: #337ecc"), this.__handleAddEventListener(e), super.on(e, n);
|
|
155
164
|
}
|
|
156
165
|
/**
|
|
157
166
|
* 注销事件
|
|
158
167
|
* @param {string} name 事件名称
|
|
159
168
|
* @param {UnknownFunction} listener 事件处理函数
|
|
160
169
|
*/
|
|
161
|
-
off(
|
|
162
|
-
console.log(`%c注销UE事件 %c${
|
|
163
|
-
const
|
|
164
|
-
return this.listeners(
|
|
170
|
+
off(e, n) {
|
|
171
|
+
console.log(`%c注销UE事件 %c${e}`, "color: #909399; font-weight: bold;", "color: #337ecc");
|
|
172
|
+
const o = super.off(e, n);
|
|
173
|
+
return this.listeners(e).length || this.__handleRemoveEventListener(e), o;
|
|
165
174
|
}
|
|
166
175
|
}
|
|
167
|
-
const K = new
|
|
168
|
-
install(
|
|
169
|
-
Object.entries(/* @__PURE__ */ Object.assign({ "./components/zf-app/index.ts": q, "./components/zf-scale-container/index.ts": j, "./components/zf-tween-number/index.ts": N })).forEach(([
|
|
170
|
-
const r =
|
|
171
|
-
|
|
176
|
+
const K = new H(), Q = {
|
|
177
|
+
install(t) {
|
|
178
|
+
Object.entries(/* @__PURE__ */ Object.assign({ "./components/zf-app/index.ts": q, "./components/zf-scale-container/index.ts": j, "./components/zf-tween-number/index.ts": N })).forEach(([n, o]) => {
|
|
179
|
+
const r = o.default, f = n.split("/")[2];
|
|
180
|
+
t.component(f, r);
|
|
172
181
|
});
|
|
173
182
|
}
|
|
174
183
|
};
|
|
175
184
|
export {
|
|
176
|
-
|
|
185
|
+
H as Ue,
|
|
177
186
|
X as ZfApp,
|
|
178
187
|
se as ZfScaleContainer,
|
|
179
|
-
|
|
188
|
+
oe as ZfTweenNumber,
|
|
180
189
|
Q as default,
|
|
181
190
|
Y as defineAppConfig,
|
|
182
191
|
A as defineRequest,
|
|
183
|
-
|
|
184
|
-
|
|
192
|
+
B as defineService,
|
|
193
|
+
D as getAppConfig,
|
|
185
194
|
O as getAppInfo,
|
|
186
195
|
a as notify,
|
|
187
196
|
G as request,
|
|
188
197
|
K as ue,
|
|
189
198
|
ee as useAppConfig,
|
|
190
|
-
|
|
191
|
-
|
|
199
|
+
te as useAppInfo,
|
|
200
|
+
Z as usePolling,
|
|
192
201
|
k as usePollingRef
|
|
193
202
|
};
|