@dazhicheng/ui 1.5.82 → 1.5.83

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