@nuwatop/code-canvas-runtime 0.5.47 → 0.5.48
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/PageScope.d.ts +13 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +289 -246
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var ie = (t, e, r) => e in t ?
|
|
1
|
+
var ce = Object.defineProperty;
|
|
2
|
+
var ie = (t, e, r) => e in t ? ce(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
3
|
var z = (t, e, r) => ie(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
4
|
import * as se from "@nuwatop/code-canvas-core";
|
|
5
|
-
import { parseAction as
|
|
5
|
+
import { parseAction as ue, useAndStore as y, getCoreConfig as w, useStoreByName as de, createWatchCommands as fe } from "@nuwatop/code-canvas-core";
|
|
6
6
|
export * from "@nuwatop/code-canvas-core";
|
|
7
|
-
import { jsx as
|
|
8
|
-
import
|
|
9
|
-
import { Spin as
|
|
10
|
-
import { create as
|
|
11
|
-
import { produce as
|
|
12
|
-
import { createRoot as
|
|
13
|
-
function
|
|
7
|
+
import { jsx as c, jsxs as T, Fragment as pe } from "react/jsx-runtime";
|
|
8
|
+
import x, { useState as B, useEffect as me, useMemo as P, Suspense as F } from "react";
|
|
9
|
+
import { Spin as Y, ConfigProvider as J, message as he, Modal as ye, Drawer as ge } from "antd";
|
|
10
|
+
import { create as be } from "zustand";
|
|
11
|
+
import { produce as ve } from "immer";
|
|
12
|
+
import { createRoot as X } from "react-dom/client";
|
|
13
|
+
function Ce(t) {
|
|
14
14
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
15
15
|
}
|
|
16
|
-
var A = {},
|
|
16
|
+
var A = {}, Z = { exports: {} };
|
|
17
17
|
(function(t) {
|
|
18
18
|
function e(r) {
|
|
19
19
|
return r && r.__esModule ? r : {
|
|
@@ -21,13 +21,13 @@ var A = {}, X = { exports: {} };
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
t.exports = e, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
24
|
-
})(
|
|
25
|
-
var
|
|
24
|
+
})(Z);
|
|
25
|
+
var q = Z.exports, D = {};
|
|
26
26
|
Object.defineProperty(D, "__esModule", {
|
|
27
27
|
value: !0
|
|
28
28
|
});
|
|
29
29
|
D.default = void 0;
|
|
30
|
-
const
|
|
30
|
+
const we = {
|
|
31
31
|
// Options
|
|
32
32
|
items_per_page: "条/页",
|
|
33
33
|
jump_to: "跳至",
|
|
@@ -42,8 +42,8 @@ const ve = {
|
|
|
42
42
|
next_3: "向后 3 页",
|
|
43
43
|
page_size: "页码"
|
|
44
44
|
};
|
|
45
|
-
D.default =
|
|
46
|
-
var
|
|
45
|
+
D.default = we;
|
|
46
|
+
var M = {}, _ = {}, N = {}, R = {};
|
|
47
47
|
Object.defineProperty(R, "__esModule", {
|
|
48
48
|
value: !0
|
|
49
49
|
});
|
|
@@ -54,11 +54,11 @@ R.commonLocale = {
|
|
|
54
54
|
cellMeridiemFormat: "A",
|
|
55
55
|
monthBeforeYear: !0
|
|
56
56
|
};
|
|
57
|
-
Object.defineProperty(
|
|
57
|
+
Object.defineProperty(N, "__esModule", {
|
|
58
58
|
value: !0
|
|
59
59
|
});
|
|
60
|
-
|
|
61
|
-
var
|
|
60
|
+
N.default = void 0;
|
|
61
|
+
var _e = R;
|
|
62
62
|
function C(t) {
|
|
63
63
|
"@babel/helpers - typeof";
|
|
64
64
|
return C = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
@@ -71,31 +71,31 @@ function Q(t, e) {
|
|
|
71
71
|
var r = Object.keys(t);
|
|
72
72
|
if (Object.getOwnPropertySymbols) {
|
|
73
73
|
var n = Object.getOwnPropertySymbols(t);
|
|
74
|
-
e && (n = n.filter(function(
|
|
75
|
-
return Object.getOwnPropertyDescriptor(t,
|
|
74
|
+
e && (n = n.filter(function(o) {
|
|
75
|
+
return Object.getOwnPropertyDescriptor(t, o).enumerable;
|
|
76
76
|
})), r.push.apply(r, n);
|
|
77
77
|
}
|
|
78
78
|
return r;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function G(t) {
|
|
81
81
|
for (var e = 1; e < arguments.length; e++) {
|
|
82
82
|
var r = arguments[e] != null ? arguments[e] : {};
|
|
83
83
|
e % 2 ? Q(Object(r), !0).forEach(function(n) {
|
|
84
|
-
|
|
84
|
+
$e(t, n, r[n]);
|
|
85
85
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Q(Object(r)).forEach(function(n) {
|
|
86
86
|
Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
return t;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
return e =
|
|
91
|
+
function $e(t, e, r) {
|
|
92
|
+
return e = Se(e), e in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
var e =
|
|
94
|
+
function Se(t) {
|
|
95
|
+
var e = Pe(t, "string");
|
|
96
96
|
return C(e) == "symbol" ? e : String(e);
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function Pe(t, e) {
|
|
99
99
|
if (C(t) != "object" || !t) return t;
|
|
100
100
|
var r = t[Symbol.toPrimitive];
|
|
101
101
|
if (r !== void 0) {
|
|
@@ -105,7 +105,7 @@ function $e(t, e) {
|
|
|
105
105
|
}
|
|
106
106
|
return (e === "string" ? String : Number)(t);
|
|
107
107
|
}
|
|
108
|
-
var xe =
|
|
108
|
+
var xe = G(G({}, _e.commonLocale), {}, {
|
|
109
109
|
locale: "zh_CN",
|
|
110
110
|
today: "今天",
|
|
111
111
|
now: "此刻",
|
|
@@ -133,24 +133,24 @@ var xe = B(B({}, Ce.commonLocale), {}, {
|
|
|
133
133
|
cellDateFormat: "D",
|
|
134
134
|
monthBeforeYear: !1
|
|
135
135
|
});
|
|
136
|
-
|
|
136
|
+
N.default = xe;
|
|
137
137
|
var $ = {};
|
|
138
138
|
Object.defineProperty($, "__esModule", {
|
|
139
139
|
value: !0
|
|
140
140
|
});
|
|
141
141
|
$.default = void 0;
|
|
142
|
-
const
|
|
142
|
+
const Oe = {
|
|
143
143
|
placeholder: "请选择时间",
|
|
144
144
|
rangePlaceholder: ["开始时间", "结束时间"]
|
|
145
145
|
};
|
|
146
|
-
$.default =
|
|
147
|
-
var
|
|
146
|
+
$.default = Oe;
|
|
147
|
+
var K = q.default;
|
|
148
148
|
Object.defineProperty(_, "__esModule", {
|
|
149
149
|
value: !0
|
|
150
150
|
});
|
|
151
151
|
_.default = void 0;
|
|
152
|
-
var
|
|
153
|
-
const
|
|
152
|
+
var je = K(N), Ae = K($);
|
|
153
|
+
const ee = {
|
|
154
154
|
lang: {
|
|
155
155
|
placeholder: "请选择日期",
|
|
156
156
|
yearPlaceholder: "请选择年份",
|
|
@@ -162,33 +162,33 @@ const K = {
|
|
|
162
162
|
rangeMonthPlaceholder: ["开始月份", "结束月份"],
|
|
163
163
|
rangeQuarterPlaceholder: ["开始季度", "结束季度"],
|
|
164
164
|
rangeWeekPlaceholder: ["开始周", "结束周"],
|
|
165
|
-
...
|
|
165
|
+
...je.default
|
|
166
166
|
},
|
|
167
167
|
timePickerLocale: {
|
|
168
|
-
...
|
|
168
|
+
...Ae.default
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
|
-
|
|
172
|
-
_.default =
|
|
173
|
-
var
|
|
174
|
-
Object.defineProperty(
|
|
171
|
+
ee.lang.ok = "确定";
|
|
172
|
+
_.default = ee;
|
|
173
|
+
var De = q.default;
|
|
174
|
+
Object.defineProperty(M, "__esModule", {
|
|
175
175
|
value: !0
|
|
176
176
|
});
|
|
177
|
-
|
|
178
|
-
var
|
|
179
|
-
|
|
180
|
-
var k =
|
|
177
|
+
M.default = void 0;
|
|
178
|
+
var Me = De(_);
|
|
179
|
+
M.default = Me.default;
|
|
180
|
+
var k = q.default;
|
|
181
181
|
Object.defineProperty(A, "__esModule", {
|
|
182
182
|
value: !0
|
|
183
183
|
});
|
|
184
184
|
A.default = void 0;
|
|
185
|
-
var
|
|
186
|
-
const p = "${label}不是一个有效的${type}",
|
|
185
|
+
var Ne = k(D), Re = k(M), ke = k(_), ze = k($);
|
|
186
|
+
const p = "${label}不是一个有效的${type}", Te = {
|
|
187
187
|
locale: "zh-cn",
|
|
188
|
-
Pagination:
|
|
189
|
-
DatePicker:
|
|
190
|
-
TimePicker:
|
|
191
|
-
Calendar:
|
|
188
|
+
Pagination: Ne.default,
|
|
189
|
+
DatePicker: ke.default,
|
|
190
|
+
TimePicker: ze.default,
|
|
191
|
+
Calendar: Re.default,
|
|
192
192
|
// locales for all components
|
|
193
193
|
global: {
|
|
194
194
|
placeholder: "请选择",
|
|
@@ -323,9 +323,9 @@ const p = "${label}不是一个有效的${type}", ke = {
|
|
|
323
323
|
gradientColor: "渐变色"
|
|
324
324
|
}
|
|
325
325
|
};
|
|
326
|
-
A.default =
|
|
327
|
-
var
|
|
328
|
-
const
|
|
326
|
+
A.default = Te;
|
|
327
|
+
var Le = A;
|
|
328
|
+
const U = /* @__PURE__ */ Ce(Le), m = /* @__PURE__ */ new Map(), Ee = () => {
|
|
329
329
|
const t = se;
|
|
330
330
|
Object.keys(t).forEach((e) => {
|
|
331
331
|
if (e.startsWith("And") && typeof t[e] == "function") {
|
|
@@ -334,94 +334,94 @@ const Y = /* @__PURE__ */ be(ze), m = /* @__PURE__ */ new Map(), Te = () => {
|
|
|
334
334
|
}
|
|
335
335
|
});
|
|
336
336
|
};
|
|
337
|
-
|
|
338
|
-
const
|
|
337
|
+
Ee();
|
|
338
|
+
const Fe = (t, e) => {
|
|
339
339
|
m.set(t, e), m.set(t.toLowerCase(), e);
|
|
340
|
-
},
|
|
340
|
+
}, H = (t) => {
|
|
341
341
|
let e = m.get(t);
|
|
342
342
|
return e || (e = m.get(t.toLowerCase()), e) || !t.startsWith("And") && (e = m.get(`And${t}`), e) || t.startsWith("and-") || (e = m.get(`and-${t.toLowerCase()}`)), e;
|
|
343
|
-
},
|
|
344
|
-
register:
|
|
345
|
-
get:
|
|
346
|
-
getAll:
|
|
343
|
+
}, Ye = () => Array.from(m.keys()), ht = {
|
|
344
|
+
register: Fe,
|
|
345
|
+
get: H,
|
|
346
|
+
getAll: Ye,
|
|
347
347
|
has: (t) => m.has(t) || m.has(t.toLowerCase())
|
|
348
|
-
},
|
|
348
|
+
}, qe = (t) => {
|
|
349
349
|
try {
|
|
350
350
|
const e = JSON.parse(t);
|
|
351
|
-
return
|
|
351
|
+
return Ue(e);
|
|
352
352
|
} catch (e) {
|
|
353
353
|
throw new Error(`Failed to parse page config: ${e}`);
|
|
354
354
|
}
|
|
355
|
-
},
|
|
355
|
+
}, Ue = (t) => {
|
|
356
356
|
if (!t)
|
|
357
357
|
throw new Error("Page config is empty");
|
|
358
358
|
return t.html || t.components ? {
|
|
359
359
|
id: t.id,
|
|
360
360
|
title: t.title,
|
|
361
361
|
style: t.style,
|
|
362
|
-
components:
|
|
362
|
+
components: L(t.components || []),
|
|
363
363
|
dataSets: t.dataSets || {},
|
|
364
364
|
actions: t.actions || {}
|
|
365
365
|
} : t;
|
|
366
|
-
},
|
|
366
|
+
}, L = (t) => Array.isArray(t) ? t.map((e) => {
|
|
367
367
|
var r;
|
|
368
368
|
return e.tagName || e["data-gjs-type"] ? {
|
|
369
369
|
id: ((r = e.attributes) == null ? void 0 : r.id) || e.id,
|
|
370
370
|
type: e["data-gjs-type"] || e.tagName || "div",
|
|
371
371
|
props: { ...e.attributes },
|
|
372
|
-
children: e.components ?
|
|
372
|
+
children: e.components ? L(e.components) : void 0,
|
|
373
373
|
style: e.style
|
|
374
374
|
} : {
|
|
375
375
|
id: e.id,
|
|
376
376
|
type: e.type,
|
|
377
377
|
props: e.props || {},
|
|
378
|
-
children: e.children ?
|
|
378
|
+
children: e.children ? L(e.children) : void 0,
|
|
379
379
|
style: e.style
|
|
380
380
|
};
|
|
381
|
-
}) : [],
|
|
381
|
+
}) : [], He = Y, We = J, yt = ({
|
|
382
382
|
pageConfig: t,
|
|
383
383
|
sessionId: e = `runtime_${Date.now()}`,
|
|
384
384
|
develop: r = !1,
|
|
385
385
|
theme: n,
|
|
386
|
-
loading:
|
|
387
|
-
onError:
|
|
386
|
+
loading: o = !1,
|
|
387
|
+
onError: a
|
|
388
388
|
}) => {
|
|
389
|
-
const [
|
|
390
|
-
|
|
389
|
+
const [l, u] = B(null), [s, f] = B(null);
|
|
390
|
+
me(() => {
|
|
391
391
|
try {
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
} catch (
|
|
395
|
-
const
|
|
396
|
-
f(
|
|
392
|
+
const i = typeof t == "string" ? qe(t) : t;
|
|
393
|
+
u(i), f(null);
|
|
394
|
+
} catch (i) {
|
|
395
|
+
const d = i instanceof Error ? i : new Error(String(i));
|
|
396
|
+
f(d), a == null || a(d);
|
|
397
397
|
}
|
|
398
|
-
}, [t,
|
|
399
|
-
const h = (
|
|
400
|
-
var
|
|
401
|
-
const b =
|
|
398
|
+
}, [t, a]);
|
|
399
|
+
const h = (i, d) => {
|
|
400
|
+
var V;
|
|
401
|
+
const b = H(i.type);
|
|
402
402
|
if (!b)
|
|
403
403
|
return r ? /* @__PURE__ */ T("div", { style: { padding: 8, background: "#fff1f0", border: "1px solid #ffa39e", borderRadius: 4 }, children: [
|
|
404
404
|
"未知组件: ",
|
|
405
|
-
|
|
406
|
-
] },
|
|
405
|
+
i.type
|
|
406
|
+
] }, i.id || d) : (console.warn(`Unknown component type: ${i.type}`), null);
|
|
407
407
|
const v = {
|
|
408
|
-
...
|
|
409
|
-
id:
|
|
408
|
+
...i.props,
|
|
409
|
+
id: i.id,
|
|
410
410
|
sessionId: e,
|
|
411
411
|
develop: r,
|
|
412
|
-
key:
|
|
413
|
-
},
|
|
414
|
-
return
|
|
415
|
-
},
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */
|
|
418
|
-
] }) :
|
|
419
|
-
return /* @__PURE__ */
|
|
420
|
-
},
|
|
421
|
-
const
|
|
422
|
-
return e(
|
|
423
|
-
}, t(n.setState, r, n)),
|
|
424
|
-
|
|
412
|
+
key: i.id || d
|
|
413
|
+
}, oe = (V = i.children) == null ? void 0 : V.map((ae, le) => h(ae, le));
|
|
414
|
+
return x.createElement(b, v, oe);
|
|
415
|
+
}, g = P(() => o ? /* @__PURE__ */ c("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", minHeight: 200 }, children: /* @__PURE__ */ c(He, { size: "large" }) }) : s ? /* @__PURE__ */ T("div", { style: { padding: 24, background: "#fff2f0", border: "1px solid #ffccc7", borderRadius: 8 }, children: [
|
|
416
|
+
/* @__PURE__ */ c("h3", { style: { color: "#cf1322" }, children: "渲染错误" }),
|
|
417
|
+
/* @__PURE__ */ c("p", { children: s.message })
|
|
418
|
+
] }) : l ? /* @__PURE__ */ c("div", { className: "runtime-container", style: l.style, children: l.components.map((i, d) => h(i, d)) }) : null, [o, s, l, e, r]);
|
|
419
|
+
return /* @__PURE__ */ c(We, { locale: U, theme: n, children: g });
|
|
420
|
+
}, Ie = (t) => (e, r, n) => (n.setState = (o, a, ...l) => {
|
|
421
|
+
const u = typeof o == "function" ? ve(o) : o;
|
|
422
|
+
return e(u, a, ...l);
|
|
423
|
+
}, t(n.setState, r, n)), Ve = Ie, gt = be()(
|
|
424
|
+
Ve((t) => ({
|
|
425
425
|
currentPageId: null,
|
|
426
426
|
pageConfigs: {},
|
|
427
427
|
loading: !1,
|
|
@@ -442,65 +442,65 @@ const Ee = (t, e) => {
|
|
|
442
442
|
e.pageConfigs = {};
|
|
443
443
|
})
|
|
444
444
|
}))
|
|
445
|
-
),
|
|
446
|
-
|
|
447
|
-
},
|
|
448
|
-
const { actionName: r, arg: n } =
|
|
449
|
-
if (
|
|
450
|
-
return
|
|
451
|
-
const
|
|
452
|
-
return
|
|
445
|
+
), W = /* @__PURE__ */ new Map(), S = (t, e) => {
|
|
446
|
+
W.set(t, e);
|
|
447
|
+
}, Be = async (t, e) => {
|
|
448
|
+
const { actionName: r, arg: n } = ue(t, e.value), o = W.get(r);
|
|
449
|
+
if (o)
|
|
450
|
+
return o(e, n);
|
|
451
|
+
const a = y.getState().addCommand;
|
|
452
|
+
return a(e.sessionId, {
|
|
453
453
|
actionName: r,
|
|
454
454
|
arg: n,
|
|
455
455
|
timestamp: Date.now()
|
|
456
456
|
}), { actionName: r, arg: n };
|
|
457
457
|
};
|
|
458
|
-
|
|
459
|
-
const { setDataSet: r } =
|
|
458
|
+
S("setDataSet", (t, e) => {
|
|
459
|
+
const { setDataSet: r } = y.getState();
|
|
460
460
|
e != null && e.dataSet && (e == null ? void 0 : e.field) !== void 0 && r(e.dataSet, e.field, e.value);
|
|
461
461
|
});
|
|
462
|
-
|
|
462
|
+
S("navigate", (t, e) => {
|
|
463
463
|
typeof window < "u" && (e != null && e.url) && (e.target === "_blank" ? window.open(e.url, "_blank") : window.location.href = e.url);
|
|
464
464
|
});
|
|
465
|
-
|
|
465
|
+
S("alert", (t, e) => {
|
|
466
466
|
typeof window < "u" && window.alert((e == null ? void 0 : e.message) || e);
|
|
467
467
|
});
|
|
468
|
-
|
|
468
|
+
S("console", (t, e) => {
|
|
469
469
|
});
|
|
470
|
-
const
|
|
471
|
-
execute:
|
|
472
|
-
register:
|
|
473
|
-
hasHandler: (t) =>
|
|
474
|
-
},
|
|
470
|
+
const bt = {
|
|
471
|
+
execute: Be,
|
|
472
|
+
register: S,
|
|
473
|
+
hasHandler: (t) => W.has(t)
|
|
474
|
+
}, Qe = Y, vt = ({
|
|
475
475
|
componentName: t,
|
|
476
476
|
componentProps: e = {},
|
|
477
477
|
storePropsKey: r,
|
|
478
478
|
sessionId: n,
|
|
479
|
-
loadingFallback:
|
|
480
|
-
notFoundFallback:
|
|
481
|
-
onError:
|
|
479
|
+
loadingFallback: o,
|
|
480
|
+
notFoundFallback: a,
|
|
481
|
+
onError: l
|
|
482
482
|
}) => {
|
|
483
|
-
const
|
|
483
|
+
const u = y((i) => {
|
|
484
484
|
if (!r) return null;
|
|
485
485
|
const b = r.split(".")[0];
|
|
486
|
-
return
|
|
487
|
-
}),
|
|
488
|
-
if (!r || !
|
|
489
|
-
const
|
|
490
|
-
return
|
|
491
|
-
}, [r,
|
|
492
|
-
...
|
|
486
|
+
return i.dataSets[b];
|
|
487
|
+
}), s = P(() => {
|
|
488
|
+
if (!r || !u) return {};
|
|
489
|
+
const d = r.split(".")[1];
|
|
490
|
+
return d ? u[d] || {} : u;
|
|
491
|
+
}, [r, u]), f = P(() => ({
|
|
492
|
+
...s,
|
|
493
493
|
...e,
|
|
494
494
|
sessionId: n
|
|
495
|
-
}), [
|
|
495
|
+
}), [s, e, n]), h = P(() => {
|
|
496
496
|
try {
|
|
497
|
-
return
|
|
498
|
-
} catch (
|
|
499
|
-
const
|
|
500
|
-
return
|
|
497
|
+
return H(t);
|
|
498
|
+
} catch (i) {
|
|
499
|
+
const d = i instanceof Error ? i : new Error(String(i));
|
|
500
|
+
return l == null || l(d), null;
|
|
501
501
|
}
|
|
502
|
-
}, [t,
|
|
503
|
-
return h ? /* @__PURE__ */
|
|
502
|
+
}, [t, l]), g = /* @__PURE__ */ c("div", { style: { display: "flex", justifyContent: "center", padding: 24 }, children: /* @__PURE__ */ c(Qe, {}) });
|
|
503
|
+
return h ? /* @__PURE__ */ c(F, { fallback: o || g, children: /* @__PURE__ */ c(h, { ...f }) }) : a ? /* @__PURE__ */ c(pe, { children: a }) : /* @__PURE__ */ T("div", { style: {
|
|
504
504
|
padding: 16,
|
|
505
505
|
background: "#fff7e6",
|
|
506
506
|
border: "1px solid #ffd591",
|
|
@@ -511,8 +511,8 @@ const ht = {
|
|
|
511
511
|
"组件未找到: ",
|
|
512
512
|
t
|
|
513
513
|
] });
|
|
514
|
-
},
|
|
515
|
-
class
|
|
514
|
+
}, Ge = ge, Je = ye, O = Y, te = J;
|
|
515
|
+
class Xe {
|
|
516
516
|
constructor() {
|
|
517
517
|
z(this, "drawers", /* @__PURE__ */ new Map());
|
|
518
518
|
z(this, "isSetup", !1);
|
|
@@ -556,17 +556,17 @@ class Ge {
|
|
|
556
556
|
}));
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
|
-
const j = new
|
|
560
|
-
const [n,
|
|
561
|
-
var
|
|
562
|
-
|
|
559
|
+
const j = new Xe(), re = () => `drawer-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, Ze = ({ options: t, onClose: e, Component: r }) => {
|
|
560
|
+
const [n, o] = x.useState(!0), a = w(), l = () => {
|
|
561
|
+
var g;
|
|
562
|
+
o(!1), (g = t.onClose) == null || g.call(t), setTimeout(() => {
|
|
563
563
|
e();
|
|
564
564
|
}, 300);
|
|
565
|
-
}, { component:
|
|
566
|
-
return /* @__PURE__ */
|
|
567
|
-
|
|
565
|
+
}, { component: u, componentName: s, componentProps: f, ...h } = t;
|
|
566
|
+
return /* @__PURE__ */ c(te, { locale: U, theme: a.theme, children: /* @__PURE__ */ c(Ge, { ...h, open: n, onClose: l, destroyOnHidden: !0, children: r ? /* @__PURE__ */ c(
|
|
567
|
+
F,
|
|
568
568
|
{
|
|
569
|
-
fallback: /* @__PURE__ */
|
|
569
|
+
fallback: /* @__PURE__ */ c(
|
|
570
570
|
"div",
|
|
571
571
|
{
|
|
572
572
|
style: {
|
|
@@ -574,12 +574,12 @@ const j = new Ge(), te = () => `drawer-${Date.now()}-${Math.random().toString(36
|
|
|
574
574
|
justifyContent: "center",
|
|
575
575
|
padding: 40
|
|
576
576
|
},
|
|
577
|
-
children: /* @__PURE__ */
|
|
577
|
+
children: /* @__PURE__ */ c(O, {})
|
|
578
578
|
}
|
|
579
579
|
),
|
|
580
|
-
children: /* @__PURE__ */
|
|
580
|
+
children: /* @__PURE__ */ c(r, { ...f || {}, onClose: l })
|
|
581
581
|
}
|
|
582
|
-
) : /* @__PURE__ */
|
|
582
|
+
) : /* @__PURE__ */ c(
|
|
583
583
|
"div",
|
|
584
584
|
{
|
|
585
585
|
style: {
|
|
@@ -588,41 +588,41 @@ const j = new Ge(), te = () => `drawer-${Date.now()}-${Math.random().toString(36
|
|
|
588
588
|
alignItems: "center",
|
|
589
589
|
height: "100%"
|
|
590
590
|
},
|
|
591
|
-
children: /* @__PURE__ */
|
|
591
|
+
children: /* @__PURE__ */ c(O, { tip: "加载中..." })
|
|
592
592
|
}
|
|
593
593
|
) }) });
|
|
594
|
-
},
|
|
595
|
-
const [n,
|
|
594
|
+
}, Ke = ({ options: t, onClose: e, Component: r }) => {
|
|
595
|
+
const [n, o] = x.useState(!0), [a, l] = x.useState(!1), u = w(), s = () => {
|
|
596
596
|
var v;
|
|
597
|
-
|
|
597
|
+
o(!1), (v = t.onClose) == null || v.call(t), setTimeout(() => {
|
|
598
598
|
e();
|
|
599
599
|
}, 300);
|
|
600
600
|
}, f = async () => {
|
|
601
601
|
if (t.onOk) {
|
|
602
|
-
|
|
602
|
+
l(!0);
|
|
603
603
|
try {
|
|
604
|
-
await t.onOk(),
|
|
604
|
+
await t.onOk(), s();
|
|
605
605
|
} catch (v) {
|
|
606
606
|
console.error("Modal onOk error:", v);
|
|
607
607
|
} finally {
|
|
608
|
-
|
|
608
|
+
l(!1);
|
|
609
609
|
}
|
|
610
610
|
} else
|
|
611
|
-
|
|
612
|
-
}, { component: h, componentName:
|
|
613
|
-
return /* @__PURE__ */
|
|
614
|
-
|
|
611
|
+
s();
|
|
612
|
+
}, { component: h, componentName: g, componentProps: i, onOk: d, ...b } = t;
|
|
613
|
+
return /* @__PURE__ */ c(te, { locale: U, theme: u.theme, children: /* @__PURE__ */ c(
|
|
614
|
+
Je,
|
|
615
615
|
{
|
|
616
616
|
...b,
|
|
617
617
|
open: n,
|
|
618
|
-
onCancel:
|
|
618
|
+
onCancel: s,
|
|
619
619
|
onOk: f,
|
|
620
|
-
confirmLoading:
|
|
620
|
+
confirmLoading: a,
|
|
621
621
|
destroyOnHidden: !0,
|
|
622
|
-
children: r ? /* @__PURE__ */
|
|
623
|
-
|
|
622
|
+
children: r ? /* @__PURE__ */ c(
|
|
623
|
+
F,
|
|
624
624
|
{
|
|
625
|
-
fallback: /* @__PURE__ */
|
|
625
|
+
fallback: /* @__PURE__ */ c(
|
|
626
626
|
"div",
|
|
627
627
|
{
|
|
628
628
|
style: {
|
|
@@ -630,12 +630,12 @@ const j = new Ge(), te = () => `drawer-${Date.now()}-${Math.random().toString(36
|
|
|
630
630
|
justifyContent: "center",
|
|
631
631
|
padding: 40
|
|
632
632
|
},
|
|
633
|
-
children: /* @__PURE__ */
|
|
633
|
+
children: /* @__PURE__ */ c(O, {})
|
|
634
634
|
}
|
|
635
635
|
),
|
|
636
|
-
children: /* @__PURE__ */
|
|
636
|
+
children: /* @__PURE__ */ c(r, { ...i || {}, onClose: s })
|
|
637
637
|
}
|
|
638
|
-
) : /* @__PURE__ */
|
|
638
|
+
) : /* @__PURE__ */ c(
|
|
639
639
|
"div",
|
|
640
640
|
{
|
|
641
641
|
style: {
|
|
@@ -644,79 +644,79 @@ const j = new Ge(), te = () => `drawer-${Date.now()}-${Math.random().toString(36
|
|
|
644
644
|
alignItems: "center",
|
|
645
645
|
minHeight: 100
|
|
646
646
|
},
|
|
647
|
-
children: /* @__PURE__ */
|
|
647
|
+
children: /* @__PURE__ */ c(O, { tip: "加载中..." })
|
|
648
648
|
}
|
|
649
649
|
)
|
|
650
650
|
}
|
|
651
651
|
) });
|
|
652
652
|
};
|
|
653
|
-
function
|
|
654
|
-
const e =
|
|
653
|
+
function et(t) {
|
|
654
|
+
const e = re(), r = document.createElement("div");
|
|
655
655
|
r.setAttribute("data-drawer-container", "true"), r.setAttribute("data-drawer-id", e), document.body.appendChild(r);
|
|
656
|
-
const n =
|
|
657
|
-
var
|
|
656
|
+
const n = X(r), o = () => {
|
|
657
|
+
var l;
|
|
658
658
|
try {
|
|
659
|
-
j.remove(e), n.unmount(), r.remove(), (
|
|
660
|
-
} catch (
|
|
661
|
-
console.error("Drawer cleanup failed:",
|
|
659
|
+
j.remove(e), n.unmount(), r.remove(), (l = t.afterClose) == null || l.call(t);
|
|
660
|
+
} catch (u) {
|
|
661
|
+
console.error("Drawer cleanup failed:", u);
|
|
662
662
|
}
|
|
663
663
|
};
|
|
664
|
-
j.add({ id: e, root: n, mountNode: r, cleanup:
|
|
665
|
-
let
|
|
666
|
-
if (!
|
|
667
|
-
const
|
|
668
|
-
|
|
664
|
+
j.add({ id: e, root: n, mountNode: r, cleanup: o });
|
|
665
|
+
let a = t.component || null;
|
|
666
|
+
if (!a && t.componentName) {
|
|
667
|
+
const l = w();
|
|
668
|
+
l.componentResolver ? a = l.componentResolver(t.componentName) : console.warn(
|
|
669
669
|
"[UIUtils.showDrawer] componentResolver not configured. Cannot resolve component:",
|
|
670
670
|
t.componentName
|
|
671
671
|
);
|
|
672
672
|
}
|
|
673
673
|
return n.render(
|
|
674
|
-
/* @__PURE__ */
|
|
675
|
-
),
|
|
674
|
+
/* @__PURE__ */ c(Ze, { options: t, onClose: o, Component: a })
|
|
675
|
+
), o;
|
|
676
676
|
}
|
|
677
|
-
function
|
|
678
|
-
const e =
|
|
677
|
+
function tt(t) {
|
|
678
|
+
const e = re(), r = document.createElement("div");
|
|
679
679
|
r.setAttribute("data-modal-container", "true"), r.setAttribute("data-modal-id", e), document.body.appendChild(r);
|
|
680
|
-
const n =
|
|
680
|
+
const n = X(r), o = () => {
|
|
681
681
|
try {
|
|
682
682
|
n.unmount(), r.remove();
|
|
683
|
-
} catch (
|
|
684
|
-
console.error("Modal cleanup failed:",
|
|
683
|
+
} catch (l) {
|
|
684
|
+
console.error("Modal cleanup failed:", l);
|
|
685
685
|
}
|
|
686
686
|
};
|
|
687
|
-
let
|
|
688
|
-
if (!
|
|
689
|
-
const
|
|
690
|
-
|
|
687
|
+
let a = t.component || null;
|
|
688
|
+
if (!a && t.componentName) {
|
|
689
|
+
const l = w();
|
|
690
|
+
l.componentResolver ? a = l.componentResolver(t.componentName) : console.warn(
|
|
691
691
|
"[UIUtils.showModal] componentResolver not configured. Cannot resolve component:",
|
|
692
692
|
t.componentName
|
|
693
693
|
);
|
|
694
694
|
}
|
|
695
695
|
return n.render(
|
|
696
|
-
/* @__PURE__ */
|
|
697
|
-
),
|
|
696
|
+
/* @__PURE__ */ c(Ke, { options: t, onClose: o, Component: a })
|
|
697
|
+
), o;
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function rt() {
|
|
700
700
|
j.cleanupAll();
|
|
701
701
|
}
|
|
702
|
-
function
|
|
702
|
+
function nt() {
|
|
703
703
|
return j.count;
|
|
704
704
|
}
|
|
705
|
-
function
|
|
706
|
-
|
|
705
|
+
function ot(t, e, r, n) {
|
|
706
|
+
he[t](e, r, n);
|
|
707
707
|
}
|
|
708
|
-
const
|
|
709
|
-
showDrawer:
|
|
710
|
-
showModal:
|
|
711
|
-
cleanupAllDrawers:
|
|
712
|
-
getDrawerCount:
|
|
713
|
-
msg:
|
|
714
|
-
},
|
|
715
|
-
|
|
716
|
-
},
|
|
717
|
-
|
|
718
|
-
},
|
|
719
|
-
r ? r(
|
|
708
|
+
const Ct = {
|
|
709
|
+
showDrawer: et,
|
|
710
|
+
showModal: tt,
|
|
711
|
+
cleanupAllDrawers: rt,
|
|
712
|
+
getDrawerCount: nt,
|
|
713
|
+
msg: ot
|
|
714
|
+
}, I = { module: "Module1" }, ne = { router: void 0 }, wt = (t) => {
|
|
715
|
+
I.module = t;
|
|
716
|
+
}, _t = (t) => {
|
|
717
|
+
ne.router = t;
|
|
718
|
+
}, at = (t, e, r) => {
|
|
719
|
+
r ? r(I.module).then((n) => {
|
|
720
720
|
typeof n[t] == "function" ? n[t](e) : console.error(
|
|
721
721
|
`Action "${t}" does not exist on the module.`
|
|
722
722
|
);
|
|
@@ -725,67 +725,110 @@ const gt = {
|
|
|
725
725
|
}) : console.warn(
|
|
726
726
|
"Module loader not configured. Please provide moduleLoader in initRuntime options."
|
|
727
727
|
);
|
|
728
|
-
},
|
|
729
|
-
const { sessionId: e = "default", utils: r, moduleLoader: n } = t || {},
|
|
730
|
-
let
|
|
731
|
-
return
|
|
732
|
-
const
|
|
733
|
-
if (
|
|
734
|
-
|
|
728
|
+
}, $t = (t) => {
|
|
729
|
+
const { sessionId: e = "default", utils: r, moduleLoader: n } = t || {}, o = w();
|
|
730
|
+
let a = 0;
|
|
731
|
+
return y.subscribe((u) => {
|
|
732
|
+
const s = u.commandQueues[e] ?? [];
|
|
733
|
+
if (s.length <= a) {
|
|
734
|
+
a = s.length;
|
|
735
735
|
return;
|
|
736
736
|
}
|
|
737
|
-
const f =
|
|
738
|
-
!f || typeof f.actionName != "string" || (
|
|
737
|
+
const f = s[s.length - 1];
|
|
738
|
+
!f || typeof f.actionName != "string" || (a = s.length, y.getState().popCommand(e), at(
|
|
739
739
|
f.actionName,
|
|
740
740
|
{
|
|
741
741
|
...f.arg,
|
|
742
|
-
moduleName:
|
|
742
|
+
moduleName: I.module,
|
|
743
743
|
ctx: {
|
|
744
744
|
utils: r,
|
|
745
745
|
useStoreByName: de,
|
|
746
|
-
defHttp:
|
|
746
|
+
defHttp: o.request,
|
|
747
747
|
useValidateWatchStore: void 0,
|
|
748
|
-
router:
|
|
748
|
+
router: ne.router
|
|
749
749
|
}
|
|
750
750
|
},
|
|
751
751
|
n
|
|
752
752
|
));
|
|
753
753
|
});
|
|
754
754
|
};
|
|
755
|
-
function
|
|
755
|
+
function St(t) {
|
|
756
756
|
return t && typeof t == "object" ? Object.values(t).some(
|
|
757
757
|
(e) => typeof e == "string" && e.trim().length > 0
|
|
758
758
|
) : !1;
|
|
759
759
|
}
|
|
760
|
-
function
|
|
761
|
-
|
|
760
|
+
function Pt(t, e) {
|
|
761
|
+
y.getState().addCommand(t, {
|
|
762
762
|
...e,
|
|
763
763
|
timestamp: Date.now()
|
|
764
764
|
});
|
|
765
765
|
}
|
|
766
|
-
function
|
|
767
|
-
return
|
|
766
|
+
function xt(t, e) {
|
|
767
|
+
return y.getState().getValidateResults(t, e) ?? {};
|
|
768
|
+
}
|
|
769
|
+
const E = /* @__PURE__ */ new Map();
|
|
770
|
+
function lt(t) {
|
|
771
|
+
const e = E.get(t);
|
|
772
|
+
if (e) {
|
|
773
|
+
try {
|
|
774
|
+
e();
|
|
775
|
+
} catch (r) {
|
|
776
|
+
console.error("[PageScope] runPageScopeCleanups failed:", t, r);
|
|
777
|
+
}
|
|
778
|
+
E.delete(t);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
function Ot(t) {
|
|
782
|
+
let e = [];
|
|
783
|
+
const r = () => {
|
|
784
|
+
for (; e.length; ) {
|
|
785
|
+
const n = e.pop();
|
|
786
|
+
try {
|
|
787
|
+
n == null || n();
|
|
788
|
+
} catch (o) {
|
|
789
|
+
console.error("[PageScope] cleanup failed:", t, o);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
return {
|
|
794
|
+
sessionId: t,
|
|
795
|
+
setup(n, o) {
|
|
796
|
+
if (!(!t || !n)) {
|
|
797
|
+
if (lt(t), e = [], o != null && o.commands) {
|
|
798
|
+
const a = fe(o.commands)(n, t);
|
|
799
|
+
typeof a == "function" && e.push(a);
|
|
800
|
+
}
|
|
801
|
+
o != null && o.onLeave && e.push(o.onLeave), E.set(t, r);
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
subscribe(n, o) {
|
|
805
|
+
const a = y.subscribe(n, o);
|
|
806
|
+
typeof a == "function" && e.push(a);
|
|
807
|
+
}
|
|
808
|
+
};
|
|
768
809
|
}
|
|
769
810
|
export {
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
wt as
|
|
811
|
+
bt as ActionExecutor,
|
|
812
|
+
ht as ComponentRegistry,
|
|
813
|
+
vt as DynamicContainer,
|
|
814
|
+
yt as RuntimeRenderer,
|
|
815
|
+
Ct as UIUtils,
|
|
816
|
+
Pt as addCommand,
|
|
817
|
+
rt as cleanupAllDrawers,
|
|
818
|
+
Ot as createPageScope,
|
|
819
|
+
H as getComponent,
|
|
820
|
+
nt as getDrawerCount,
|
|
821
|
+
xt as getValidateResults,
|
|
822
|
+
$t as initRuntime,
|
|
823
|
+
ot as msg,
|
|
824
|
+
qe as parsePageConfig,
|
|
825
|
+
Fe as registerComponent,
|
|
826
|
+
lt as runPageScopeCleanups,
|
|
827
|
+
_t as setRoute,
|
|
828
|
+
et as showDrawer,
|
|
829
|
+
tt as showModal,
|
|
830
|
+
wt as useModule,
|
|
831
|
+
gt as useRuntimeStore,
|
|
832
|
+
St as validateFailed
|
|
790
833
|
};
|
|
791
834
|
//# sourceMappingURL=index.esm.js.map
|