@dazhicheng/ui 1.5.73 → 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.
@@ -0,0 +1,7 @@
1
+ import { VxeUIExport } from 'vxe-table';
2
+ /**
3
+ * @description 渲染需要接口回显的数据
4
+ */
5
+ export declare function createVxePluginRenderCellContent(): {
6
+ install(vxetablecore: VxeUIExport): void;
7
+ };
@@ -1 +1,2 @@
1
1
  export { createVxePluginSwitchStatus } from './vxeTable/switchStatus';
2
+ export { createVxePluginRenderCellContent } from './default/renderCellContent';
package/dist/plugins.js CHANGED
@@ -1,13 +1,13 @@
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";
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 u } from "./index.modern-xkd4Z3Qx.js";
5
+ import { b as m } from "./index.modern-xkd4Z3Qx.js";
6
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("");
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 _ = [
16
16
  "afterFetch",
17
17
  "beforeChange"
18
18
  ];
19
- function V(a) {
20
- return Object.fromEntries(Object.entries(a).map(([t, n]) => [U(t), n]));
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 j(a) {
24
- const t = V(a);
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 K() {
30
+ function k() {
31
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({
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 = 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;
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
+ "onUpdate:modelValue": (l) => {
48
+ i[n.field] = l;
49
49
  },
50
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
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 w = await e.api(l).finally(() => {
64
- s.value = !1;
63
+ const v = await e.api(d).finally(() => {
64
+ C.value = !1;
65
65
  });
66
- return (p = e.afterFetch) == null || p.call(e, w), F.success(o === c ? "禁用成功" : "启用成功"), !0;
66
+ return (b = e.afterFetch) == null || b.call(e, v), R.success(l === a ? "禁用成功" : "启用成功"), !0;
67
67
  }
68
68
  });
69
69
  }
@@ -74,6 +74,59 @@ function K() {
74
74
  }
75
75
  };
76
76
  }
77
+ function H() {
78
+ return {
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({
98
+ name: "RenderCellContent",
99
+ setup() {
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);
109
+ }
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]) ?? "");
121
+ }
122
+ });
123
+ return s(C);
124
+ }
125
+ });
126
+ }
127
+ };
128
+ }
77
129
  export {
78
- K as createVxePluginSwitchStatus
130
+ H as createVxePluginRenderCellContent,
131
+ k as createVxePluginSwitchStatus
79
132
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.5.73",
3
+ "version": "1.5.76",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",