@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.
Files changed (2) hide show
  1. package/dist/plugins.js +85 -63
  2. package/package.json +1 -1
package/dist/plugins.js CHANGED
@@ -1,13 +1,13 @@
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";
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, j as x } from "./index.modern-xkd4Z3Qx.js";
5
+ import { b as m } from "./index.modern-xkd4Z3Qx.js";
6
6
  import "xe-utils";
7
- function y(n) {
8
- return n.split("-").filter(Boolean).map((t, i) => i === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)).join("");
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 D = [
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 g(n) {
20
- return Object.fromEntries(Object.entries(n).map(([t, i]) => [y(t), i]));
19
+ function E(o) {
20
+ return Object.fromEntries(Object.entries(o).map(([r, u]) => [L(r), u]));
21
21
  }
22
- const I = "1", L = "0";
23
- function R(n) {
24
- const t = g(n);
22
+ const x = "1", y = "0";
23
+ function I(o) {
24
+ const r = E(o);
25
25
  return {
26
- active: t.activeValue ?? I,
27
- inactive: t.inactiveValue ?? L
26
+ active: r.activeValue ?? x,
27
+ inactive: r.inactiveValue ?? y
28
28
  };
29
29
  }
30
- function Y() {
30
+ function k() {
31
31
  return {
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({
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 s = U(!1), { active: c, inactive: f } = R(e);
41
- return () => d(S, {
42
- activeValue: c,
43
- inactiveValue: f,
44
- ...o,
45
- modelValue: r[a.field],
46
- loading: s.value,
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
- r[a.field] = l;
48
+ i[n.field] = l;
49
49
  },
50
50
  beforeChange: async () => {
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
- ...E
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 b = await e.api(u).finally(() => {
64
- s.value = !1;
63
+ const v = await e.api(d).finally(() => {
64
+ C.value = !1;
65
65
  });
66
- return (w = e.afterFetch) == null || w.call(e, b), T.success(l === c ? "禁用成功" : "启用成功"), !0;
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 q() {
77
+ function H() {
78
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({
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
- 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]) ?? "";
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
- return j(s), () => x(o.value) ? d("div", o.value) : o.value ?? d("div");
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 d(C);
123
+ return s(C);
102
124
  }
103
125
  });
104
126
  }
105
127
  };
106
128
  }
107
129
  export {
108
- q as createVxePluginRenderCellContent,
109
- Y as createVxePluginSwitchStatus
130
+ H as createVxePluginRenderCellContent,
131
+ k as createVxePluginSwitchStatus
110
132
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.5.75",
3
+ "version": "1.5.76",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",