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