@dazhicheng/ui 1.5.27 → 1.5.29

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 CHANGED
@@ -1,10 +1,13 @@
1
- import { ElSwitch as w, ElMessage as V } from "element-plus";
2
- import { omit as C } from "lodash-es";
3
- import { h as s, defineComponent as F, ref as S } from "vue";
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
4
  import "axios";
5
- import { b as i } from "./pad-pkcs7-DGpLXRzj.js";
5
+ import { b as u } from "./index.modern-DfItAsVf.js";
6
6
  import "xe-utils";
7
- const b = [
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 _ = [
8
11
  "modelValue",
9
12
  "onUpdate:modelValue",
10
13
  "loading",
@@ -13,41 +16,54 @@ const b = [
13
16
  "afterFetch",
14
17
  "beforeChange"
15
18
  ];
16
- function D() {
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() {
17
31
  return {
18
- install(u) {
19
- u.renderer.add("switchStatus", {
20
- renderTableDefault(d, m) {
21
- const { row: t, column: a } = m, e = d.props ?? {};
22
- return s(
23
- F({
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({
24
38
  name: "TtVxeSwitchCell",
25
39
  setup: () => {
26
- const o = S(!1);
27
- return () => s(w, {
28
- ...C(e, [...b]),
29
- modelValue: t[a.field],
30
- loading: o.value,
31
- "onUpdate:modelValue": async (r) => {
32
- t[a.field] = r;
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;
33
49
  },
34
50
  beforeChange: async () => {
35
- var l, f, c;
36
- const r = t[a.field];
37
- if ((i(e.beforeChange) ? await ((l = e.beforeChange) == null ? void 0 : l.call(e, r)) : !0) === !1 || !i(e.api)) return !1;
38
- const h = !r;
39
- let n = { [a.field]: h, id: t.id };
40
- if (o.value = !0, i(e.beforeFetch)) {
41
- const g = await ((f = e.beforeFetch) == null ? void 0 : f.call(e, n, t, a));
42
- n = {
43
- ...n,
44
- ...g
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
45
61
  };
46
62
  }
47
- const p = await e.api(n).finally(() => {
48
- o.value = !1;
63
+ const w = await e.api(l).finally(() => {
64
+ s.value = !1;
49
65
  });
50
- return (c = e.afterFetch) == null || c.call(e, p), V.success(r ? "禁用成功" : "启用成功"), !0;
66
+ return (p = e.afterFetch) == null || p.call(e, w), F.success(o === c ? "禁用成功" : "启用成功"), !0;
51
67
  }
52
68
  });
53
69
  }
@@ -59,5 +75,5 @@ function D() {
59
75
  };
60
76
  }
61
77
  export {
62
- D as createVxePluginSwitchStatus
78
+ K as createVxePluginSwitchStatus
63
79
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.5.27",
3
+ "version": "1.5.29",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",