@dazhicheng/ui 1.5.26 → 1.5.28
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.js +10848 -13896
- package/dist/index.modern-DfItAsVf.js +3069 -0
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/vxeTable/switchStatus.d.ts +7 -0
- package/dist/plugins.d.ts +2 -0
- package/dist/plugins.js +79 -0
- package/package.json +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './vxeTable/switchStatus';
|
package/dist/plugins.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ElSwitch as b, ElMessage as F } from "element-plus";
|
|
2
|
+
import { omit as S } from "lodash-es";
|
|
3
|
+
import { h, defineComponent as T, ref as A } from "vue";
|
|
4
|
+
import "axios";
|
|
5
|
+
import { b as u } from "./index.modern-DfItAsVf.js";
|
|
6
|
+
import "xe-utils";
|
|
7
|
+
function U(a) {
|
|
8
|
+
return a.split("-").filter(Boolean).map((t, n) => n === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)).join("");
|
|
9
|
+
}
|
|
10
|
+
const _ = [
|
|
11
|
+
"modelValue",
|
|
12
|
+
"onUpdate:modelValue",
|
|
13
|
+
"loading",
|
|
14
|
+
"api",
|
|
15
|
+
"beforeFetch",
|
|
16
|
+
"afterFetch",
|
|
17
|
+
"beforeChange"
|
|
18
|
+
];
|
|
19
|
+
function V(a) {
|
|
20
|
+
return Object.fromEntries(Object.entries(a).map(([t, n]) => [U(t), n]));
|
|
21
|
+
}
|
|
22
|
+
const I = "1", L = "0";
|
|
23
|
+
function j(a) {
|
|
24
|
+
const t = V(a);
|
|
25
|
+
return {
|
|
26
|
+
active: t.activeValue ?? I,
|
|
27
|
+
inactive: t.inactiveValue ?? L
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function K() {
|
|
31
|
+
return {
|
|
32
|
+
install(a) {
|
|
33
|
+
a.renderer.add("switchStatus", {
|
|
34
|
+
renderTableDefault(t, n) {
|
|
35
|
+
const { row: i, column: r } = n, e = t.props ?? {}, C = S(e, [..._]), g = V(C);
|
|
36
|
+
return h(
|
|
37
|
+
T({
|
|
38
|
+
name: "TtVxeSwitchCell",
|
|
39
|
+
setup: () => {
|
|
40
|
+
const s = A(!1), { active: c, inactive: f } = j(e);
|
|
41
|
+
return () => h(b, {
|
|
42
|
+
activeValue: c,
|
|
43
|
+
inactiveValue: f,
|
|
44
|
+
...g,
|
|
45
|
+
modelValue: i[r.field],
|
|
46
|
+
loading: s.value,
|
|
47
|
+
"onUpdate:modelValue": (o) => {
|
|
48
|
+
i[r.field] = o;
|
|
49
|
+
},
|
|
50
|
+
beforeChange: async () => {
|
|
51
|
+
var m, d, p;
|
|
52
|
+
const o = i[r.field];
|
|
53
|
+
if ((u(e.beforeChange) ? await ((m = e.beforeChange) == null ? void 0 : m.call(e, o)) : !0) === !1 || !u(e.api)) return !1;
|
|
54
|
+
const v = o === c ? f : c;
|
|
55
|
+
let l = { [r.field]: v, id: i.id };
|
|
56
|
+
if (s.value = !0, u(e.beforeFetch)) {
|
|
57
|
+
const E = await ((d = e.beforeFetch) == null ? void 0 : d.call(e, l, i, r));
|
|
58
|
+
l = {
|
|
59
|
+
...l,
|
|
60
|
+
...E
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const w = await e.api(l).finally(() => {
|
|
64
|
+
s.value = !1;
|
|
65
|
+
});
|
|
66
|
+
return (p = e.afterFetch) == null || p.call(e, w), F.success(o === c ? "禁用成功" : "启用成功"), !0;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
K as createVxePluginSwitchStatus
|
|
79
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dazhicheng/ui",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.28",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.js"
|
|
13
13
|
},
|
|
14
|
+
"./plugins": {
|
|
15
|
+
"types": "./dist/plugins.d.ts",
|
|
16
|
+
"import": "./dist/plugins.js"
|
|
17
|
+
},
|
|
14
18
|
"./style.css": "./dist/style.css",
|
|
15
19
|
"./dist/style.css": "./dist/style.css"
|
|
16
20
|
},
|