@duxweb/dvha-core 1.1.30 → 1.2.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.
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/cjs/components/auth/can.cjs +1 -1
- package/dist/cjs/components/auth/index.cjs +1 -0
- package/dist/cjs/components/common/icon.cjs +1 -1
- package/dist/cjs/components/common/index.cjs +1 -0
- package/dist/cjs/components/common/logo.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -0
- package/dist/cjs/components/loader/iframe.cjs +1 -1
- package/dist/cjs/components/loader/index.cjs +1 -0
- package/dist/cjs/components/loader/loader.cjs +1 -1
- package/dist/cjs/components/loader/remote/index.cjs +1 -0
- package/dist/cjs/components/loader/remote/loader.cjs +1 -1
- package/dist/cjs/components/loader/remote/render.cjs +1 -1
- package/dist/cjs/components/overlay/index.cjs +1 -0
- package/dist/cjs/components/overlay/overlay.cjs +1 -1
- package/dist/cjs/components/status/error.cjs +1 -1
- package/dist/cjs/components/status/exception.cjs +1 -1
- package/dist/cjs/components/status/index.cjs +1 -0
- package/dist/cjs/components/status/notAuthorized.cjs +1 -1
- package/dist/cjs/components/status/notFound.cjs +1 -1
- package/dist/cjs/config/color.cjs +1 -1
- package/dist/cjs/directive/index.cjs +1 -0
- package/dist/cjs/directive/permission.cjs +1 -1
- package/dist/cjs/hooks/auth.cjs +1 -1
- package/dist/cjs/hooks/config.cjs +1 -1
- package/dist/cjs/hooks/data.cjs +1 -1
- package/dist/cjs/hooks/export.cjs +1 -1
- package/dist/cjs/hooks/exportCsv.cjs +2 -2
- package/dist/cjs/hooks/form.cjs +1 -1
- package/dist/cjs/hooks/formExtend.cjs +1 -1
- package/dist/cjs/hooks/formValidate.cjs +1 -1
- package/dist/cjs/hooks/i18n.cjs +1 -1
- package/dist/cjs/hooks/import.cjs +1 -1
- package/dist/cjs/hooks/importCsv.cjs +2 -2
- package/dist/cjs/hooks/index.cjs +1 -0
- package/dist/cjs/hooks/json/index.cjs +1 -1
- package/dist/cjs/hooks/json/utils/contextManager.cjs +1 -1
- package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -1
- package/dist/cjs/hooks/json/vFor.cjs +1 -1
- package/dist/cjs/hooks/json/vIf.cjs +1 -1
- package/dist/cjs/hooks/json/vModel.cjs +1 -1
- package/dist/cjs/hooks/json/vOn.cjs +1 -1
- package/dist/cjs/hooks/json/vShow.cjs +1 -1
- package/dist/cjs/hooks/json/vText.cjs +1 -1
- package/dist/cjs/hooks/json.cjs +1 -1
- package/dist/cjs/hooks/list.cjs +1 -1
- package/dist/cjs/hooks/manage.cjs +1 -1
- package/dist/cjs/hooks/menu.cjs +1 -1
- package/dist/cjs/hooks/overlay.cjs +1 -1
- package/dist/cjs/hooks/select.cjs +1 -1
- package/dist/cjs/hooks/theme.cjs +4 -8
- package/dist/cjs/hooks/tree.cjs +1 -1
- package/dist/cjs/hooks/upload/index.cjs +1 -0
- package/dist/cjs/hooks/upload/local.cjs +1 -1
- package/dist/cjs/hooks/upload/s3.cjs +1 -1
- package/dist/cjs/hooks/upload.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/main.cjs +1 -1
- package/dist/cjs/preset/authProvider.cjs +1 -1
- package/dist/cjs/preset/dataProvider.cjs +1 -1
- package/dist/cjs/preset/i18nProvider.cjs +1 -1
- package/dist/cjs/preset/index.cjs +1 -0
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/provider/index.cjs +1 -0
- package/dist/cjs/provider/tab.cjs +1 -1
- package/dist/cjs/router/index.cjs +1 -0
- package/dist/cjs/router/route.cjs +1 -1
- package/dist/cjs/stores/auth.cjs +1 -1
- package/dist/cjs/stores/i18n.cjs +1 -1
- package/dist/cjs/stores/index.cjs +1 -0
- package/dist/cjs/stores/jsonSchema.cjs +1 -1
- package/dist/cjs/stores/manage.cjs +1 -1
- package/dist/cjs/stores/route.cjs +1 -1
- package/dist/cjs/stores/tab.cjs +1 -1
- package/dist/cjs/stores/theme.cjs +1 -1
- package/dist/cjs/utils/bus.cjs +1 -1
- package/dist/cjs/utils/index.cjs +1 -0
- package/dist/cjs/utils/theme.cjs +8 -8
- package/dist/cjs/utils/tree.cjs +1 -1
- package/dist/esm/_virtual/_rolldown/runtime.js +9 -0
- package/dist/esm/components/auth/can.js +17 -36
- package/dist/esm/components/auth/index.js +1 -0
- package/dist/esm/components/common/icon.js +16 -24
- package/dist/esm/components/common/index.js +2 -0
- package/dist/esm/components/common/logo.js +50 -49
- package/dist/esm/components/index.js +14 -0
- package/dist/esm/components/loader/iframe.js +16 -18
- package/dist/esm/components/loader/index.js +1 -0
- package/dist/esm/components/loader/loader.js +11 -40
- package/dist/esm/components/loader/remote/index.js +2 -0
- package/dist/esm/components/loader/remote/loader.js +118 -156
- package/dist/esm/components/loader/remote/render.js +12 -17
- package/dist/esm/components/overlay/index.js +1 -0
- package/dist/esm/components/overlay/overlay.js +54 -70
- package/dist/esm/components/status/error.js +7 -9
- package/dist/esm/components/status/exception.js +21 -37
- package/dist/esm/components/status/index.js +4 -0
- package/dist/esm/components/status/notAuthorized.js +7 -9
- package/dist/esm/components/status/notFound.js +7 -9
- package/dist/esm/config/color.js +288 -290
- package/dist/esm/directive/index.js +1 -0
- package/dist/esm/directive/permission.js +7 -27
- package/dist/esm/hooks/auth.js +154 -120
- package/dist/esm/hooks/config.js +11 -9
- package/dist/esm/hooks/data.js +416 -415
- package/dist/esm/hooks/export.js +32 -36
- package/dist/esm/hooks/exportCsv.js +42 -46
- package/dist/esm/hooks/form.js +86 -95
- package/dist/esm/hooks/formExtend.js +36 -40
- package/dist/esm/hooks/formValidate.js +22 -25
- package/dist/esm/hooks/i18n.js +14 -18
- package/dist/esm/hooks/import.js +45 -54
- package/dist/esm/hooks/importCsv.js +90 -83
- package/dist/esm/hooks/index.js +31 -0
- package/dist/esm/hooks/json/index.js +14 -22
- package/dist/esm/hooks/json/utils/contextManager.js +35 -26
- package/dist/esm/hooks/json/utils/expressionParser.js +100 -123
- package/dist/esm/hooks/json/vFor.js +50 -55
- package/dist/esm/hooks/json/vIf.js +17 -16
- package/dist/esm/hooks/json/vModel.js +96 -106
- package/dist/esm/hooks/json/vOn.js +30 -32
- package/dist/esm/hooks/json/vShow.js +20 -22
- package/dist/esm/hooks/json/vText.js +44 -51
- package/dist/esm/hooks/json.js +131 -132
- package/dist/esm/hooks/list.js +150 -184
- package/dist/esm/hooks/manage.js +25 -22
- package/dist/esm/hooks/menu.js +57 -61
- package/dist/esm/hooks/overlay.js +6 -23
- package/dist/esm/hooks/select.js +84 -94
- package/dist/esm/hooks/theme.js +289 -219
- package/dist/esm/hooks/tree.js +43 -47
- package/dist/esm/hooks/upload/index.js +2 -0
- package/dist/esm/hooks/upload/local.js +24 -30
- package/dist/esm/hooks/upload/s3.js +70 -80
- package/dist/esm/hooks/upload.js +256 -272
- package/dist/esm/index.js +150 -141
- package/dist/esm/main.js +24 -45
- package/dist/esm/preset/authProvider.js +62 -68
- package/dist/esm/preset/dataProvider.js +154 -180
- package/dist/esm/preset/i18nProvider.js +28 -30
- package/dist/esm/preset/index.js +3 -0
- package/dist/esm/provider/app.js +124 -151
- package/dist/esm/provider/index.js +2 -0
- package/dist/esm/provider/tab.js +49 -66
- package/dist/esm/router/index.js +1 -0
- package/dist/esm/router/route.js +39 -46
- package/dist/esm/stores/auth.js +51 -46
- package/dist/esm/stores/i18n.js +32 -29
- package/dist/esm/stores/index.js +7 -0
- package/dist/esm/stores/jsonSchema.js +47 -34
- package/dist/esm/stores/manage.js +63 -48
- package/dist/esm/stores/route.js +60 -56
- package/dist/esm/stores/tab.js +55 -60
- package/dist/esm/stores/theme.js +48 -55
- package/dist/esm/utils/bus.js +3 -5
- package/dist/esm/utils/index.js +3 -0
- package/dist/esm/utils/theme.js +110 -93
- package/dist/esm/utils/tree.js +28 -37
- package/package.json +1 -1
|
@@ -1,84 +1,91 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
import { useImport as e } from "./import.js";
|
|
2
|
+
import { computed as t } from "vue";
|
|
3
|
+
import { csv2json as n } from "json-2-csv";
|
|
4
|
+
import { useFileDialog as r } from "@vueuse/core";
|
|
5
|
+
function i(i) {
|
|
6
|
+
let a = t(() => {
|
|
7
|
+
let { csvOptions: e, ...t } = i;
|
|
8
|
+
return t;
|
|
9
|
+
}), o = t(() => {
|
|
10
|
+
let e = i.csvOptions || {};
|
|
11
|
+
return {
|
|
12
|
+
delimiter: {
|
|
13
|
+
field: e.delimiter || ",",
|
|
14
|
+
wrap: e.wrap || "\"",
|
|
15
|
+
eol: e.eol || "\n"
|
|
16
|
+
},
|
|
17
|
+
excelBOM: e.excelBOM || !1,
|
|
18
|
+
headerFields: e.headerFields,
|
|
19
|
+
keys: e.keys,
|
|
20
|
+
trimHeaderFields: e.trimHeaderFields || !1,
|
|
21
|
+
trimFieldValues: e.trimFieldValues || !1
|
|
22
|
+
};
|
|
23
|
+
}), s = e({ ...a.value }), c = async (e) => {
|
|
24
|
+
let t = await e.arrayBuffer(), n = new Uint8Array(t), r = n.length >= 3 && n[0] === 239 && n[1] === 187 && n[2] === 191, a = n.length >= 2 && n[0] === 255 && n[1] === 254, o = n.length >= 2 && n[0] === 254 && n[1] === 255, s = i.encoding || "auto", c = (e, t) => {
|
|
25
|
+
try {
|
|
26
|
+
return new TextDecoder(e, { fatal: !1 }).decode(t || n);
|
|
27
|
+
} catch {
|
|
28
|
+
return "";
|
|
29
|
+
}
|
|
30
|
+
}, l = (e) => {
|
|
31
|
+
if (!e) return {
|
|
32
|
+
rep: 2 ** 53 - 1,
|
|
33
|
+
ctrl: 2 ** 53 - 1
|
|
34
|
+
};
|
|
35
|
+
let t = 0, n = 0;
|
|
36
|
+
for (let r = 0; r < e.length; r++) {
|
|
37
|
+
let i = e.charCodeAt(r);
|
|
38
|
+
i === 65533 && t++, i < 32 && i !== 9 && i !== 10 && i !== 13 && n++;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
rep: t,
|
|
42
|
+
ctrl: n
|
|
43
|
+
};
|
|
44
|
+
}, u = (e) => e.replace(/^\ufeff/, "");
|
|
45
|
+
if (r) return u(c("utf-8"));
|
|
46
|
+
if (a) return u(c("utf-16le"));
|
|
47
|
+
if (o) return u(c("utf-16be"));
|
|
48
|
+
if (s !== "auto") return u(c(s));
|
|
49
|
+
let d = [
|
|
50
|
+
"utf-8",
|
|
51
|
+
"gb18030",
|
|
52
|
+
"gbk"
|
|
53
|
+
].map((e) => {
|
|
54
|
+
let t = c(e);
|
|
55
|
+
return {
|
|
56
|
+
enc: e,
|
|
57
|
+
text: t,
|
|
58
|
+
sc: l(t)
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
return d.sort((e, t) => e.sc.rep - t.sc.rep || e.sc.ctrl - t.sc.ctrl), u(d[0].text);
|
|
62
|
+
}, l = async (e) => {
|
|
63
|
+
try {
|
|
64
|
+
let t = await n(await c(e), o.value);
|
|
65
|
+
t && t.length > 0 ? await s.trigger(t) : i.onError?.({
|
|
66
|
+
message: "CSV 文件为空或格式不正确",
|
|
67
|
+
status: 400
|
|
68
|
+
});
|
|
69
|
+
} catch (e) {
|
|
70
|
+
i.onError?.({
|
|
71
|
+
message: `CSV 解析错误: ${e}`,
|
|
72
|
+
status: 500
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}, { open: u, reset: d, onChange: f } = r({
|
|
76
|
+
accept: ".csv",
|
|
77
|
+
multiple: !1
|
|
78
|
+
});
|
|
79
|
+
f((e) => {
|
|
80
|
+
e && e.length > 0 && l(e[0]);
|
|
81
|
+
});
|
|
82
|
+
let p = () => {
|
|
83
|
+
d(), u();
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
...s,
|
|
87
|
+
open: p,
|
|
88
|
+
readFile: l
|
|
89
|
+
};
|
|
81
90
|
}
|
|
82
|
-
export {
|
|
83
|
-
V as useImportCsv
|
|
84
|
-
};
|
|
91
|
+
export { i as useImportCsv };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "../config/color.js";
|
|
2
|
+
import "./manage.js";
|
|
3
|
+
import "./auth.js";
|
|
4
|
+
import "./config.js";
|
|
5
|
+
import "./data.js";
|
|
6
|
+
import "./export.js";
|
|
7
|
+
import "./exportCsv.js";
|
|
8
|
+
import "./form.js";
|
|
9
|
+
import "./formValidate.js";
|
|
10
|
+
import "./formExtend.js";
|
|
11
|
+
import "./i18n.js";
|
|
12
|
+
import "./import.js";
|
|
13
|
+
import "./importCsv.js";
|
|
14
|
+
import "./json/vFor.js";
|
|
15
|
+
import "./json/vIf.js";
|
|
16
|
+
import "./json/vModel.js";
|
|
17
|
+
import "./json/vOn.js";
|
|
18
|
+
import "./json/vShow.js";
|
|
19
|
+
import "./json/vText.js";
|
|
20
|
+
import "./json/index.js";
|
|
21
|
+
import "./json.js";
|
|
22
|
+
import "./list.js";
|
|
23
|
+
import "./menu.js";
|
|
24
|
+
import "./overlay.js";
|
|
25
|
+
import "./select.js";
|
|
26
|
+
import "./theme.js";
|
|
27
|
+
import "./tree.js";
|
|
28
|
+
import "./upload/local.js";
|
|
29
|
+
import "./upload.js";
|
|
30
|
+
import "./upload/s3.js";
|
|
31
|
+
import "./upload/index.js";
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
import { vForAdaptor as
|
|
2
|
-
import { vIfAdaptor as
|
|
3
|
-
import { vModelAdaptor as
|
|
4
|
-
import { vOnAdaptor as
|
|
5
|
-
import { vShowAdaptor as
|
|
1
|
+
import { vForAdaptor as e } from "./vFor.js";
|
|
2
|
+
import { vIfAdaptor as t } from "./vIf.js";
|
|
3
|
+
import { vModelAdaptor as n } from "./vModel.js";
|
|
4
|
+
import { vOnAdaptor as r } from "./vOn.js";
|
|
5
|
+
import { vShowAdaptor as i } from "./vShow.js";
|
|
6
6
|
import { vTextAdaptor as a } from "./vText.js";
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
].sort((
|
|
15
|
-
export {
|
|
16
|
-
n as defaultAdaptors,
|
|
17
|
-
t as vForAdaptor,
|
|
18
|
-
p as vIfAdaptor,
|
|
19
|
-
m as vModelAdaptor,
|
|
20
|
-
i as vOnAdaptor,
|
|
21
|
-
d as vShowAdaptor,
|
|
22
|
-
a as vTextAdaptor
|
|
23
|
-
};
|
|
7
|
+
const o = [
|
|
8
|
+
t,
|
|
9
|
+
i,
|
|
10
|
+
e,
|
|
11
|
+
n,
|
|
12
|
+
r,
|
|
13
|
+
a
|
|
14
|
+
].sort((e, t) => t.priority - e.priority);
|
|
15
|
+
export { o as defaultAdaptors };
|
|
@@ -1,31 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 从属性中提取上下文
|
|
3
|
+
*/
|
|
4
|
+
function e(e) {
|
|
5
|
+
return e._context || {};
|
|
3
6
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* 注入上下文到属性
|
|
9
|
+
*/
|
|
10
|
+
function t(e, t) {
|
|
11
|
+
return Object.keys(t).length === 0 ? e : {
|
|
12
|
+
...e,
|
|
13
|
+
_context: t
|
|
14
|
+
};
|
|
9
15
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
/**
|
|
17
|
+
* 清理属性中的内部字段
|
|
18
|
+
*/
|
|
19
|
+
function n(e) {
|
|
20
|
+
let { _context: t, ...n } = e;
|
|
21
|
+
return n;
|
|
13
22
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
/**
|
|
24
|
+
* 创建适配器处理结果
|
|
25
|
+
*/
|
|
26
|
+
function r(e, t = {}) {
|
|
27
|
+
let n = { ...e };
|
|
28
|
+
return t.cleanKeys && t.cleanKeys.forEach((e) => delete n[e]), {
|
|
29
|
+
props: n,
|
|
30
|
+
skip: t.skip,
|
|
31
|
+
nodes: t.nodes
|
|
32
|
+
};
|
|
21
33
|
}
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
/**
|
|
35
|
+
* 通用条件求值函数
|
|
36
|
+
*/
|
|
37
|
+
function i(e, t, n) {
|
|
38
|
+
return typeof e == "string" ? !!n(e, t) : !!e;
|
|
24
39
|
}
|
|
25
|
-
export {
|
|
26
|
-
u as cleanProps,
|
|
27
|
-
a as createAdaptorResult,
|
|
28
|
-
i as evaluateCondition,
|
|
29
|
-
o as extractContext,
|
|
30
|
-
c as injectContext
|
|
31
|
-
};
|
|
40
|
+
export { n as cleanProps, r as createAdaptorResult, i as evaluateCondition, e as extractContext, t as injectContext };
|
|
@@ -1,128 +1,105 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
1
|
+
import { unref as e } from "vue";
|
|
2
|
+
import t from "jsep";
|
|
3
|
+
t.addIdentifierChar("$"), t.addIdentifierChar("@");
|
|
4
|
+
function n(e) {
|
|
5
|
+
try {
|
|
6
|
+
return t(e);
|
|
7
|
+
} catch (t) {
|
|
8
|
+
return console.warn(`Expression parsing failed: ${e}`, t), null;
|
|
9
|
+
}
|
|
11
10
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return i(t, e);
|
|
11
|
+
function r(e, t) {
|
|
12
|
+
let r = n(e);
|
|
13
|
+
if (r) return i(r, t);
|
|
16
14
|
}
|
|
17
|
-
function i(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
return s.apply(a, u);
|
|
78
|
-
} catch (a) {
|
|
79
|
-
console.warn("Function call error:", a);
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
case "ArrayExpression":
|
|
84
|
-
return Array.isArray(r.elements) ? r.elements.map((t) => {
|
|
85
|
-
if (!t)
|
|
86
|
-
return;
|
|
87
|
-
const s = i(t, e);
|
|
88
|
-
return n(s);
|
|
89
|
-
}) : [];
|
|
90
|
-
default:
|
|
91
|
-
console.warn(`Unsupported expression type: ${r.type}`);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
15
|
+
function i(t, n) {
|
|
16
|
+
if (!(!t || typeof t != "object")) switch (t.type) {
|
|
17
|
+
case "Literal": return t.value;
|
|
18
|
+
case "Identifier": return a(n, t.name);
|
|
19
|
+
case "MemberExpression": {
|
|
20
|
+
let r = i(t.object, n);
|
|
21
|
+
if (r == null) return;
|
|
22
|
+
let a = t.computed ? i(t.property, n) : t.property?.name;
|
|
23
|
+
return e(r)?.[a];
|
|
24
|
+
}
|
|
25
|
+
case "BinaryExpression": {
|
|
26
|
+
let e = i(t.left, n), r = i(t.right, n);
|
|
27
|
+
return {
|
|
28
|
+
"+": () => e + r,
|
|
29
|
+
"-": () => e - r,
|
|
30
|
+
"*": () => e * r,
|
|
31
|
+
"/": () => e / r,
|
|
32
|
+
"%": () => e % r,
|
|
33
|
+
"==": () => e === r,
|
|
34
|
+
"===": () => e === r,
|
|
35
|
+
"!=": () => e !== r,
|
|
36
|
+
"!==": () => e !== r,
|
|
37
|
+
"<": () => e < r,
|
|
38
|
+
">": () => e > r,
|
|
39
|
+
"<=": () => e <= r,
|
|
40
|
+
">=": () => e >= r
|
|
41
|
+
}[t.operator]?.() ?? void 0;
|
|
42
|
+
}
|
|
43
|
+
case "LogicalExpression": {
|
|
44
|
+
let e = i(t.left, n);
|
|
45
|
+
return t.operator === "&&" ? e && i(t.right, n) : t.operator === "||" ? e || i(t.right, n) : t.operator === "??" ? e ?? i(t.right, n) : void 0;
|
|
46
|
+
}
|
|
47
|
+
case "UnaryExpression": {
|
|
48
|
+
let e = i(t.argument, n);
|
|
49
|
+
return t.operator === "!" ? !e : t.operator === "-" ? -e : t.operator === "+" ? +e : void 0;
|
|
50
|
+
}
|
|
51
|
+
case "ConditionalExpression": return i(t.test, n) ? i(t.consequent, n) : i(t.alternate, n);
|
|
52
|
+
case "CallExpression": {
|
|
53
|
+
let r = e(i(t.callee, n));
|
|
54
|
+
if (typeof r != "function") {
|
|
55
|
+
console.warn("Attempting to call non-function value:", r);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
let a = Array.isArray(t.arguments) ? t.arguments.map((t) => e(i(t, n))) : [];
|
|
59
|
+
try {
|
|
60
|
+
let o;
|
|
61
|
+
return t.callee.type === "MemberExpression" && (o = e(i(t.callee.object, n))), r.apply(o, a);
|
|
62
|
+
} catch (e) {
|
|
63
|
+
console.warn("Function call error:", e);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
case "ArrayExpression": return Array.isArray(t.elements) ? t.elements.map((t) => {
|
|
68
|
+
if (t) return e(i(t, n));
|
|
69
|
+
}) : [];
|
|
70
|
+
default:
|
|
71
|
+
console.warn(`Unsupported expression type: ${t.type}`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
94
74
|
}
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
75
|
+
function a(t, n) {
|
|
76
|
+
if (!(!n || !t)) try {
|
|
77
|
+
return n.split(".").reduce((t, n) => {
|
|
78
|
+
if (t != null) return e(t)?.[n];
|
|
79
|
+
}, t);
|
|
80
|
+
} catch {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
102
83
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
84
|
+
function o(t, n) {
|
|
85
|
+
let i = t.trim(), a = i.match(/^\((\w+),\s*(\w+)\) in (.+)$/);
|
|
86
|
+
if (a) {
|
|
87
|
+
let [, t, i, o] = a, s = e(r(o, n));
|
|
88
|
+
return {
|
|
89
|
+
items: Array.isArray(s) ? s : [],
|
|
90
|
+
itemName: t,
|
|
91
|
+
indexName: i
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
let o = i.match(/^(\w+) in (.+)$/);
|
|
95
|
+
if (o) {
|
|
96
|
+
let [, t, i] = o, a = e(r(i, n));
|
|
97
|
+
return {
|
|
98
|
+
items: Array.isArray(a) ? a : [],
|
|
99
|
+
itemName: t,
|
|
100
|
+
indexName: "index"
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
throw Error(`Invalid v-for expression: ${t}`);
|
|
123
104
|
}
|
|
124
|
-
export {
|
|
125
|
-
m as evaluateExpression,
|
|
126
|
-
y as parseExpression,
|
|
127
|
-
E as parseVForExpression
|
|
128
|
-
};
|
|
105
|
+
export { r as evaluateExpression, o as parseVForExpression };
|
|
@@ -1,56 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { parseVForExpression as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
nodes: m
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
export {
|
|
55
|
-
y as vForAdaptor
|
|
1
|
+
import { cleanProps as e, extractContext as t, injectContext as n } from "./utils/contextManager.js";
|
|
2
|
+
import { parseVForExpression as r } from "./utils/expressionParser.js";
|
|
3
|
+
const i = {
|
|
4
|
+
name: "v-for",
|
|
5
|
+
priority: 90,
|
|
6
|
+
process(i, a) {
|
|
7
|
+
let o = i.attrs?.["v-for"] || i.attrs?.vFor;
|
|
8
|
+
if (!o) return null;
|
|
9
|
+
let s = { ...i.attrs };
|
|
10
|
+
delete s["v-for"], delete s.vFor;
|
|
11
|
+
let c = t(a), l;
|
|
12
|
+
try {
|
|
13
|
+
if (Array.isArray(o)) l = {
|
|
14
|
+
items: o,
|
|
15
|
+
itemName: "item",
|
|
16
|
+
indexName: "index"
|
|
17
|
+
};
|
|
18
|
+
else if (typeof o == "object" && o.list) l = {
|
|
19
|
+
items: Array.isArray(o.list) ? o.list : [],
|
|
20
|
+
itemName: o.item || "item",
|
|
21
|
+
indexName: o.index || "index"
|
|
22
|
+
};
|
|
23
|
+
else if (typeof o == "string") l = r(o, c);
|
|
24
|
+
else return console.warn("Unsupported v-for format:", o), null;
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return console.warn("v-for parsing failed:", e), null;
|
|
27
|
+
}
|
|
28
|
+
let u = l.items.map((e, t) => {
|
|
29
|
+
let r = {
|
|
30
|
+
[l.itemName]: e,
|
|
31
|
+
[l.indexName]: t
|
|
32
|
+
}, a = {
|
|
33
|
+
...c,
|
|
34
|
+
...r
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
...i,
|
|
38
|
+
attrs: {
|
|
39
|
+
...s,
|
|
40
|
+
key: `${l.itemName}_${t}`,
|
|
41
|
+
...n({}, a)
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
props: e(a),
|
|
47
|
+
nodes: u
|
|
48
|
+
};
|
|
49
|
+
}
|
|
56
50
|
};
|
|
51
|
+
export { i as vForAdaptor };
|