@dazhicheng/ui 1.5.73 → 1.5.75
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/plugins/index.d.ts
CHANGED
package/dist/plugins.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ElSwitch as
|
|
2
|
-
import { omit as
|
|
3
|
-
import { h, defineComponent as
|
|
1
|
+
import { ElSwitch as S, ElMessage as T } from "element-plus";
|
|
2
|
+
import { omit as A } from "lodash-es";
|
|
3
|
+
import { h as d, defineComponent as F, ref as U, shallowRef as _, onMounted as j } from "vue";
|
|
4
4
|
import "axios";
|
|
5
|
-
import { b as
|
|
5
|
+
import { b as m, j as x } from "./index.modern-xkd4Z3Qx.js";
|
|
6
6
|
import "xe-utils";
|
|
7
|
-
function
|
|
8
|
-
return
|
|
7
|
+
function y(n) {
|
|
8
|
+
return n.split("-").filter(Boolean).map((t, i) => i === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)).join("");
|
|
9
9
|
}
|
|
10
|
-
const
|
|
10
|
+
const D = [
|
|
11
11
|
"modelValue",
|
|
12
12
|
"onUpdate:modelValue",
|
|
13
13
|
"loading",
|
|
@@ -16,54 +16,54 @@ const _ = [
|
|
|
16
16
|
"afterFetch",
|
|
17
17
|
"beforeChange"
|
|
18
18
|
];
|
|
19
|
-
function
|
|
20
|
-
return Object.fromEntries(Object.entries(
|
|
19
|
+
function g(n) {
|
|
20
|
+
return Object.fromEntries(Object.entries(n).map(([t, i]) => [y(t), i]));
|
|
21
21
|
}
|
|
22
22
|
const I = "1", L = "0";
|
|
23
|
-
function
|
|
24
|
-
const t =
|
|
23
|
+
function R(n) {
|
|
24
|
+
const t = g(n);
|
|
25
25
|
return {
|
|
26
26
|
active: t.activeValue ?? I,
|
|
27
27
|
inactive: t.inactiveValue ?? L
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Y() {
|
|
31
31
|
return {
|
|
32
|
-
install(
|
|
33
|
-
|
|
34
|
-
renderTableDefault(t,
|
|
35
|
-
const { row:
|
|
36
|
-
return
|
|
37
|
-
|
|
32
|
+
install(n) {
|
|
33
|
+
n.renderer.add("switchStatus", {
|
|
34
|
+
renderTableDefault(t, i) {
|
|
35
|
+
const { row: r, column: a } = i, e = t.props ?? {}, C = A(e, [...D]), o = g(C);
|
|
36
|
+
return d(
|
|
37
|
+
F({
|
|
38
38
|
name: "TtVxeSwitchCell",
|
|
39
39
|
setup: () => {
|
|
40
|
-
const s =
|
|
41
|
-
return () =>
|
|
40
|
+
const s = U(!1), { active: c, inactive: f } = R(e);
|
|
41
|
+
return () => d(S, {
|
|
42
42
|
activeValue: c,
|
|
43
43
|
inactiveValue: f,
|
|
44
|
-
...
|
|
45
|
-
modelValue:
|
|
44
|
+
...o,
|
|
45
|
+
modelValue: r[a.field],
|
|
46
46
|
loading: s.value,
|
|
47
|
-
"onUpdate:modelValue": (
|
|
48
|
-
|
|
47
|
+
"onUpdate:modelValue": (l) => {
|
|
48
|
+
r[a.field] = l;
|
|
49
49
|
},
|
|
50
50
|
beforeChange: async () => {
|
|
51
|
-
var
|
|
52
|
-
const
|
|
53
|
-
if ((
|
|
54
|
-
const
|
|
55
|
-
let
|
|
56
|
-
if (s.value = !0,
|
|
57
|
-
const E = await ((
|
|
58
|
-
|
|
59
|
-
...
|
|
51
|
+
var v, V, w;
|
|
52
|
+
const l = r[a.field];
|
|
53
|
+
if ((m(e.beforeChange) ? await ((v = e.beforeChange) == null ? void 0 : v.call(e, l)) : !0) === !1 || !m(e.api)) return !1;
|
|
54
|
+
const h = l === c ? f : c;
|
|
55
|
+
let u = { [a.field]: h, id: r.id };
|
|
56
|
+
if (s.value = !0, m(e.beforeFetch)) {
|
|
57
|
+
const E = await ((V = e.beforeFetch) == null ? void 0 : V.call(e, u, r, a));
|
|
58
|
+
u = {
|
|
59
|
+
...u,
|
|
60
60
|
...E
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const b = await e.api(u).finally(() => {
|
|
64
64
|
s.value = !1;
|
|
65
65
|
});
|
|
66
|
-
return (
|
|
66
|
+
return (w = e.afterFetch) == null || w.call(e, b), T.success(l === c ? "禁用成功" : "启用成功"), !0;
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
}
|
|
@@ -74,6 +74,37 @@ function K() {
|
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
+
function q() {
|
|
78
|
+
return {
|
|
79
|
+
install(n) {
|
|
80
|
+
n.renderer.add("renderCellContent", {
|
|
81
|
+
renderTableDefault(t, i) {
|
|
82
|
+
const { row: r, column: a } = i, e = t.props ?? {}, C = F({
|
|
83
|
+
name: "RenderCellContent",
|
|
84
|
+
setup() {
|
|
85
|
+
const o = _(null);
|
|
86
|
+
async function s() {
|
|
87
|
+
var p, h;
|
|
88
|
+
let c = {};
|
|
89
|
+
m(e.beforeFetch) && (c = await ((p = e.beforeFetch) == null ? void 0 : p.call(e, r, a)));
|
|
90
|
+
const f = await ((h = e.api) == null ? void 0 : h.call(e, c));
|
|
91
|
+
if (m(e.afterFetch)) {
|
|
92
|
+
o.value = e.afterFetch(f || [], r, a);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const l = (f || []).find((u) => u[e.valueField] === a.field);
|
|
96
|
+
o.value = (l == null ? void 0 : l[e.labelField]) ?? "";
|
|
97
|
+
}
|
|
98
|
+
return j(s), () => x(o.value) ? d("div", o.value) : o.value ?? d("div");
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return d(C);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
77
107
|
export {
|
|
78
|
-
|
|
108
|
+
q as createVxePluginRenderCellContent,
|
|
109
|
+
Y as createVxePluginSwitchStatus
|
|
79
110
|
};
|