@dazhicheng/ui 1.5.73 → 1.5.75

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 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";
4
4
  import "axios";
5
- import { b as u } from "./index.modern-xkd4Z3Qx.js";
5
+ import { b as m, j as x } 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 y(n) {
8
+ return n.split("-").filter(Boolean).map((t, i) => i === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)).join("");
9
9
  }
10
- const _ = [
10
+ const D = [
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 g(n) {
20
+ return Object.fromEntries(Object.entries(n).map(([t, i]) => [y(t), i]));
21
21
  }
22
22
  const I = "1", L = "0";
23
- function j(a) {
24
- const t = V(a);
23
+ function R(n) {
24
+ const t = g(n);
25
25
  return {
26
26
  active: t.activeValue ?? I,
27
27
  inactive: t.inactiveValue ?? L
28
28
  };
29
29
  }
30
- function K() {
30
+ function Y() {
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(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({
38
38
  name: "TtVxeSwitchCell",
39
39
  setup: () => {
40
- const s = A(!1), { active: c, inactive: f } = j(e);
41
- return () => h(b, {
40
+ const s = U(!1), { active: c, inactive: f } = R(e);
41
+ return () => d(S, {
42
42
  activeValue: c,
43
43
  inactiveValue: f,
44
- ...g,
45
- modelValue: i[r.field],
44
+ ...o,
45
+ modelValue: r[a.field],
46
46
  loading: s.value,
47
- "onUpdate:modelValue": (o) => {
48
- i[r.field] = o;
47
+ "onUpdate:modelValue": (l) => {
48
+ r[a.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,
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
60
  ...E
61
61
  };
62
62
  }
63
- const w = await e.api(l).finally(() => {
63
+ const b = await e.api(u).finally(() => {
64
64
  s.value = !1;
65
65
  });
66
- return (p = e.afterFetch) == null || p.call(e, w), F.success(o === c ? "禁用成功" : "启用成功"), !0;
66
+ return (w = e.afterFetch) == null || w.call(e, b), T.success(l === c ? "禁用成功" : "启用成功"), !0;
67
67
  }
68
68
  });
69
69
  }
@@ -74,6 +74,37 @@ function K() {
74
74
  }
75
75
  };
76
76
  }
77
+ function q() {
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({
83
+ name: "RenderCellContent",
84
+ 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]) ?? "";
97
+ }
98
+ return j(s), () => x(o.value) ? d("div", o.value) : o.value ?? d("div");
99
+ }
100
+ });
101
+ return d(C);
102
+ }
103
+ });
104
+ }
105
+ };
106
+ }
77
107
  export {
78
- K as createVxePluginSwitchStatus
108
+ q as createVxePluginRenderCellContent,
109
+ Y as createVxePluginSwitchStatus
79
110
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.5.73",
3
+ "version": "1.5.75",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",