@done-coding/admin-core 0.6.1-alpha.0 → 0.7.1-alpha.0

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 (39) hide show
  1. package/es/components/display/ActionBtnGroup.vue.mjs +1 -1
  2. package/es/components/{misc → display}/ActionConfirm.vue.mjs +2 -2
  3. package/es/components/form/FormMain.vue.mjs +47 -44
  4. package/es/components/form/FormSearch.vue.mjs +2 -2
  5. package/es/components/form/FormSearch.vue2.mjs +47 -46
  6. package/es/components/form/FormSubmitBtn.vue.mjs +66 -0
  7. package/es/components/form/FormSubmitBtn.vue2.mjs +4 -0
  8. package/es/components/form/FormSubmitPanel.vue.mjs +7 -0
  9. package/es/components/form/FormSubmitPanel.vue2.mjs +112 -0
  10. package/es/components/panel/PanelEditSwitch.vue.mjs +1 -1
  11. package/es/components/panel/PanelEditSwitch.vue2.mjs +67 -71
  12. package/es/components/panel/PanelItem.vue.mjs +72 -42
  13. package/es/components/panel/PanelMain.vue.mjs +5 -78
  14. package/es/components/panel/PanelMain.vue2.mjs +99 -2
  15. package/es/index.mjs +92 -88
  16. package/es/style.css +1 -1
  17. package/package.json +4 -2
  18. package/types/components/display/index.d.ts +12 -0
  19. package/types/components/display/types.d.ts +87 -1
  20. package/types/components/form/FormItem.vue.d.ts +2 -2
  21. package/types/components/form/FormMain.vue.d.ts +1 -1
  22. package/types/components/form/FormSearch.vue.d.ts +1 -1
  23. package/types/components/form/FormSubmitBtn.vue.d.ts +20 -0
  24. package/types/components/form/FormSubmitPanel.vue.d.ts +46 -0
  25. package/types/components/form/index.d.ts +3 -1
  26. package/types/components/form/types.d.ts +68 -3
  27. package/types/components/list-page/ListPage.vue.d.ts +1 -1
  28. package/types/components/list-page/types.d.ts +1 -1
  29. package/types/components/misc/index.d.ts +1 -3
  30. package/types/components/misc/types.d.ts +0 -88
  31. package/types/components/panel/PanelItem.vue.d.ts +18 -10
  32. package/types/components/panel/PanelMain.vue.d.ts +3 -5
  33. package/types/components/panel/types.d.ts +64 -33
  34. package/types/components/panel/PanelEditSwitch.vue.d.ts +0 -28
  35. /package/es/components/{misc → display}/ActionBtn.vue.mjs +0 -0
  36. /package/es/components/{misc → display}/ActionBtn.vue2.mjs +0 -0
  37. /package/es/components/{misc → display}/ActionConfirm.vue2.mjs +0 -0
  38. /package/types/components/{misc → display}/ActionBtn.vue.d.ts +0 -0
  39. /package/types/components/{misc → display}/ActionConfirm.vue.d.ts +0 -0
@@ -1,93 +1,89 @@
1
- import { ElButton as E } from "element-plus/es";
1
+ import { ElButton as C } from "element-plus/es";
2
2
  import "element-plus/es/components/base/style/css";
3
3
  import "element-plus/es/components/button/style/css";
4
- import { defineComponent as h, ref as d, watch as B, openBlock as u, createElementBlock as f, unref as m, createBlock as C, withCtx as c, createTextVNode as p, createCommentVNode as S, renderSlot as v, Fragment as N, createElementVNode as P, createVNode as g } from "vue";
5
- import V from "lodash/cloneDeep";
6
- const $ = { class: "panel-edit-switch-actions" }, j = /* @__PURE__ */ h({
4
+ import { defineComponent as w, useModel as F, ref as h, computed as B, watch as u, openBlock as r, createElementBlock as d, createBlock as c, withCtx as E, createTextVNode as P, createCommentVNode as M, renderSlot as l, Fragment as $, unref as o, mergeModels as m } from "vue";
5
+ import N from "lodash/cloneDeep";
6
+ import T from "../form/FormSubmitPanel.vue.mjs";
7
+ const V = { class: "panel-edit-switch" }, A = /* @__PURE__ */ w({
7
8
  name: "PanelEditSwitch",
8
9
  __name: "PanelEditSwitch",
9
- props: {
10
+ props: /* @__PURE__ */ m({
10
11
  data: {},
11
- editing: { type: Boolean },
12
+ config: {},
13
+ editable: { type: Boolean },
12
14
  submitFn: { type: Function }
13
- },
14
- emits: ["update:editing", "submitFinish"],
15
- setup(a, { emit: b }) {
16
- const o = a, i = b, s = d(!1), l = d(!1), n = d({});
17
- B(
18
- () => o.editing,
19
- (t, e) => {
20
- t && !e && (n.value = V(o.data));
15
+ }, {
16
+ editing: { type: Boolean, default: !1 },
17
+ editingModifiers: {}
18
+ }),
19
+ emits: /* @__PURE__ */ m(["submitSuccess"], ["update:editing"]),
20
+ setup(i, { emit: f }) {
21
+ const n = i, g = f, e = F(i, "editing"), a = h(
22
+ {}
23
+ ), y = B(() => [n.config.editorConfig]), p = (t) => t, b = () => {
24
+ e.value = !0;
25
+ }, k = () => {
26
+ e.value = !1;
27
+ }, v = (t) => {
28
+ if (!n.submitFn)
29
+ throw new Error("可编辑 那么必须提供 submitFn");
30
+ return n.submitFn(t);
31
+ }, D = (t) => {
32
+ e.value = !1, g("submitSuccess", t);
33
+ };
34
+ return u(
35
+ e,
36
+ (t, s) => {
37
+ t && !s && (a.value = N(n.data));
21
38
  },
22
39
  { immediate: !0 }
23
- );
24
- const y = () => {
25
- i("update:editing", !0);
26
- }, k = () => {
27
- i("update:editing", !1);
28
- }, w = async () => {
29
- if (!o.submitFn) {
30
- console.error("[PanelEditSwitch] editable 项缺少 submitFn,无法提交");
31
- return;
32
- }
33
- l.value = !0;
34
- try {
35
- await o.submitFn(n.value), i("submitFinish", !0, n.value), i("update:editing", !1);
36
- } catch (t) {
37
- console.error("[PanelEditSwitch] submitFn 失败", t), i("submitFinish", !1, n.value);
38
- } finally {
39
- l.value = !1;
40
+ ), u(
41
+ () => n.editable,
42
+ (t) => {
43
+ t || (e.value = !1);
44
+ },
45
+ {
46
+ immediate: !0
40
47
  }
41
- };
42
- return (t, e) => {
43
- const r = E;
44
- return u(), f("div", {
45
- class: "panel-edit-switch",
46
- onMouseenter: e[0] || (e[0] = (F) => s.value = !0),
47
- onMouseleave: e[1] || (e[1] = (F) => s.value = !1)
48
- }, [
49
- !a.editing && m(s) ? (u(), C(r, {
48
+ ), (t, s) => {
49
+ const S = C;
50
+ return r(), d("div", V, [
51
+ i.editable && !e.value ? (r(), c(S, {
50
52
  key: 0,
51
53
  class: "panel-edit-switch-edit-btn",
52
54
  type: "primary",
53
55
  link: "",
54
56
  size: "small",
55
- onClick: y
57
+ onClick: b
56
58
  }, {
57
- default: c(() => [...e[2] || (e[2] = [
58
- p("编辑", -1)
59
+ default: E(() => [...s[0] || (s[0] = [
60
+ P(" 编辑", -1)
59
61
  ])]),
60
62
  _: 1
61
- })) : S("", !0),
62
- a.editing ? (u(), f(N, { key: 2 }, [
63
- v(t.$slots, "editor", { data: m(n) }, void 0, !0),
64
- P("div", $, [
65
- g(r, {
66
- size: "small",
67
- onClick: k
68
- }, {
69
- default: c(() => [...e[3] || (e[3] = [
70
- p("取消", -1)
71
- ])]),
72
- _: 1
73
- }),
74
- g(r, {
75
- type: "primary",
76
- size: "small",
77
- loading: m(l),
78
- onClick: w
79
- }, {
80
- default: c(() => [...e[4] || (e[4] = [
81
- p("提交", -1)
82
- ])]),
83
- _: 1
84
- }, 8, ["loading"])
85
- ])
86
- ], 64)) : v(t.$slots, "default", { key: 1 }, void 0, !0)
87
- ], 32);
63
+ })) : M("", !0),
64
+ e.value ? (r(), d($, { key: 2 }, [
65
+ i.config.editorRender ? l(t.$slots, "editor", {
66
+ key: 0,
67
+ stringifyDraftData: o(a)
68
+ }, void 0, !0) : i.config.editorConfig ? (r(), c(o(T), {
69
+ key: 1,
70
+ list: o(y),
71
+ "stringify-data": p(o(a)),
72
+ "submit-fn": v,
73
+ onCancel: k,
74
+ onSuccess: D
75
+ }, null, 8, ["list", "stringify-data"])) : l(t.$slots, "default", {
76
+ key: 2,
77
+ stringifyDraftData: o(a)
78
+ }, void 0, !0)
79
+ ], 64)) : l(t.$slots, "default", {
80
+ key: 1,
81
+ stringifyDraftData: i.data
82
+ }, void 0, !0)
83
+ ]);
88
84
  };
89
85
  }
90
86
  });
91
87
  export {
92
- j as default
88
+ A as default
93
89
  };
@@ -1,54 +1,84 @@
1
- import { defineComponent as P, computed as c, unref as r, openBlock as n, createElementBlock as f, Fragment as w, toDisplayString as k, createBlock as l, resolveDynamicComponent as u, normalizeProps as g, mergeProps as m, withCtx as h } from "vue";
2
- import S from "./PanelEditSwitch.vue.mjs";
3
- const x = { key: 0 }, C = { key: 0 }, E = { key: 0 }, I = /* @__PURE__ */ P({
1
+ import { defineComponent as P, useModel as h, computed as u, openBlock as r, createBlock as d, withCtx as g, resolveDynamicComponent as m, normalizeProps as v, guardReactiveProps as E, createElementBlock as x, toDisplayString as D, mergeProps as I, mergeModels as p } from "vue";
2
+ import M from "./PanelEditSwitch.vue.mjs";
3
+ import { parseFormData as R } from "../form/utils.mjs";
4
+ const w = { key: 0 }, j = /* @__PURE__ */ P({
4
5
  name: "PanelItem",
5
6
  __name: "PanelItem",
6
- props: {
7
+ props: /* @__PURE__ */ p({
7
8
  data: {},
8
9
  config: {},
9
- editing: { type: Boolean }
10
- },
11
- emits: ["update:editing", "submitFinish", "refresh"],
12
- setup(e, { emit: b }) {
13
- const t = e, o = b, a = c(() => ({
14
- data: t.data,
15
- value: t.data[t.config.key],
16
- config: t.config,
17
- refresh: () => o("refresh")
18
- })), p = c(() => {
19
- const { editable: i } = t.config;
20
- return typeof i == "function" ? !!i(a.value) : !!i;
21
- }), v = c(() => String(a.value.value ?? "")), y = c(() => ({
22
- data: a.value.data,
23
- value: a.value.value,
24
- config: a.value.config,
25
- refresh: () => o("refresh"),
26
- onRefresh: () => o("refresh")
27
- })), B = (i) => ({
28
- data: i,
29
- value: i[t.config.key],
30
- config: t.config
31
- });
32
- return (i, s) => r(p) ? (n(), l(S, {
33
- key: 1,
34
- data: e.data,
35
- editing: e.editing,
36
- "submit-fn": e.config.submitFn,
37
- "onUpdate:editing": s[0] || (s[0] = (d) => o("update:editing", d)),
38
- onSubmitFinish: s[1] || (s[1] = (d, F) => o("submitFinish", d, F))
10
+ refreshFn: { type: Function }
11
+ }, {
12
+ editing: { type: Boolean, default: !1 },
13
+ editingModifiers: {}
14
+ }),
15
+ emits: /* @__PURE__ */ p(["submitSuccess"], ["update:editing"]),
16
+ setup(o, { emit: b }) {
17
+ const t = o, y = b, a = h(o, "editing"), l = (e) => {
18
+ const { config: n } = t;
19
+ return {
20
+ data: e,
21
+ value: e[n.key],
22
+ config: n
23
+ };
24
+ }, S = u(() => l(t.data)), f = u(() => {
25
+ const { editable: e } = t.config;
26
+ return typeof e == "function" ? !!e(S.value) : !!e;
27
+ }), k = (e) => {
28
+ const {
29
+ config: { key: n, label: i }
30
+ } = t;
31
+ if (e)
32
+ return {
33
+ ...e,
34
+ key: n,
35
+ label: i,
36
+ layoutHide: !0,
37
+ layout: { span: 24 }
38
+ };
39
+ }, s = u(() => {
40
+ const {
41
+ config: { editorConfig: e, ...n }
42
+ } = t;
43
+ return {
44
+ ...n,
45
+ ...k(e) ?? {}
46
+ };
47
+ }), C = () => {
48
+ var e;
49
+ return (e = t.refreshFn) == null ? void 0 : e.call(t, {
50
+ stringifyData: t.data,
51
+ parseData: f.value && s.value.editorConfig ? R(t.data, [s.value.editorConfig]) : t.data
52
+ });
53
+ }, F = () => {
54
+ a.value = !1;
55
+ }, c = (e) => ({
56
+ ...l(e),
57
+ editing: a.value,
58
+ refresh: C,
59
+ closeEdit: F
60
+ }), B = (e) => {
61
+ y("submitSuccess", e);
62
+ };
63
+ return (e, n) => (r(), d(M, {
64
+ editing: a.value,
65
+ "onUpdate:editing": n[0] || (n[0] = (i) => a.value = i),
66
+ config: s.value,
67
+ editable: f.value,
68
+ data: o.data,
69
+ "submit-fn": o.config.submitFn,
70
+ onSubmitSuccess: B
39
71
  }, {
40
- editor: h(({ data: d }) => [
41
- e.config.editorRender === void 0 ? (n(), f("span", E)) : (n(), l(u(e.config.editorRender), g(m({ key: 1 }, B(d))), null, 16))
72
+ default: g(({ stringifyDraftData: i }) => [
73
+ o.config.render === void 0 ? (r(), x("span", w, D(c(i).value), 1)) : (r(), d(m(o.config.render), v(I({ key: 1 }, c(i))), null, 16))
42
74
  ]),
43
- default: h(() => [
44
- e.config.render === void 0 ? (n(), f("span", C, k(r(v)), 1)) : (n(), l(u(e.config.render), g(m({ key: 1 }, r(y))), null, 16))
75
+ editor: g(({ stringifyDraftData: i }) => [
76
+ (r(), d(m(o.config.editorRender), v(E(c(i))), null, 16))
45
77
  ]),
46
78
  _: 1
47
- }, 8, ["data", "editing", "submit-fn"])) : (n(), f(w, { key: 0 }, [
48
- e.config.render === void 0 ? (n(), f("span", x, k(r(v)), 1)) : (n(), l(u(e.config.render), g(m({ key: 1 }, r(y))), null, 16))
49
- ], 64));
79
+ }, 8, ["editing", "config", "editable", "data", "submit-fn"]));
50
80
  }
51
81
  });
52
82
  export {
53
- I as default
83
+ j as default
54
84
  };
@@ -1,80 +1,7 @@
1
- import { ElRow as x, ElCol as R } from "element-plus/es";
2
- import "element-plus/es/components/base/style/css";
3
- import "element-plus/es/components/row/style/css";
4
- import "element-plus/es/components/col/style/css";
5
- import { defineComponent as L, ref as B, computed as F, watch as M, openBlock as s, createBlock as f, withCtx as l, createElementBlock as P, Fragment as b, renderList as D, unref as u, withDirectives as S, mergeProps as U, createVNode as j, vShow as H } from "vue";
6
- import N from "./PanelItem.vue.mjs";
7
- import { resolveFormLayout as m } from "../form/utils.mjs";
8
- const I = /* @__PURE__ */ L({
9
- name: "PanelMain",
10
- __name: "PanelMain",
11
- props: {
12
- data: {},
13
- layout: { default: () => ({ span: 24 }) },
14
- list: {}
15
- },
16
- emits: ["refresh"],
17
- setup(c, { emit: p }) {
18
- const n = c, d = p, g = (e) => e, h = (e) => e, a = B({}), y = F(
19
- () => n.list.map((e, t) => ({ config: e, index: t })).sort((e, t) => {
20
- const o = e.config.order ?? e.index, i = t.config.order ?? t.index;
21
- return o - i;
22
- })
23
- ), _ = (e) => {
24
- const { hide: t } = e;
25
- if (typeof t == "function") {
26
- const o = {
27
- data: n.data,
28
- value: n.data[e.key],
29
- config: e
30
- };
31
- return !!t(o);
32
- }
33
- return !!t;
34
- }, k = (e) => ({
35
- ...m(n.layout),
36
- ...m(e)
37
- }), v = (e, t) => {
38
- a.value = {}, t && (a.value[e] = t);
39
- }, E = (e, t) => {
40
- e && d("refresh", t);
41
- }, w = () => d("refresh", n.data);
42
- return M(
43
- () => n.list,
44
- (e) => {
45
- const t = e.map((o) => o.key);
46
- Object.keys(a.value).forEach((o) => {
47
- t.includes(o) || delete a.value[o];
48
- });
49
- },
50
- { immediate: !0 }
51
- ), (e, t) => {
52
- const o = R, i = x;
53
- return s(), f(i, null, {
54
- default: l(() => [
55
- (s(!0), P(b, null, D(u(y), (r) => S((s(), f(o, U({
56
- key: r.config.key
57
- }, { ref_for: !0 }, k(r.config.layout)), {
58
- default: l(() => [
59
- j(N, {
60
- data: g(c.data),
61
- config: h(r.config),
62
- editing: u(a)[r.config.key] ?? !1,
63
- "onUpdate:editing": (C) => v(r.config.key, C),
64
- onSubmitFinish: E,
65
- onRefresh: w
66
- }, null, 8, ["data", "config", "editing", "onUpdate:editing"])
67
- ]),
68
- _: 2
69
- }, 1040)), [
70
- [H, !_(r.config)]
71
- ])), 128))
72
- ]),
73
- _: 1
74
- });
75
- };
76
- }
77
- });
1
+ import o from "./PanelMain.vue2.mjs";
2
+ /* empty css */
3
+ import t from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5cd9d7e4"]]);
78
5
  export {
79
- I as default
6
+ m as default
80
7
  };
@@ -1,4 +1,101 @@
1
- import f from "./PanelMain.vue.mjs";
1
+ import { ElRow as E, ElCol as x } from "element-plus/es";
2
+ import "element-plus/es/components/base/style/css";
3
+ import "element-plus/es/components/row/style/css";
4
+ import "element-plus/es/components/col/style/css";
5
+ import { defineComponent as M, useCssVars as b, unref as i, ref as L, computed as c, watch as F, openBlock as s, createBlock as m, withCtx as u, createElementBlock as j, Fragment as P, renderList as S, withDirectives as D, mergeProps as G, resolveDynamicComponent as O, normalizeClass as R, createVNode as U, vShow as V } from "vue";
6
+ import W from "./PanelItem.vue.mjs";
7
+ import { ElCard as g } from "element-plus";
8
+ import { resolveFormLayout as y } from "../form/utils.mjs";
9
+ const J = /* @__PURE__ */ M({
10
+ name: "PanelMain",
11
+ __name: "PanelMain",
12
+ props: {
13
+ data: {},
14
+ rowGutter: { default: 8 },
15
+ layout: { default: () => ({ span: 24 }) },
16
+ list: {},
17
+ itemCard: { type: [Boolean, Object], default: () => ({ lastMarginBottom: "8px" }) },
18
+ refreshFn: {}
19
+ },
20
+ setup(l) {
21
+ b((t) => ({
22
+ v855b420c: i(h)
23
+ }));
24
+ const a = l, r = L({}), C = c(
25
+ () => a.list.map((t, e) => ({ config: t, index: e })).sort((t, e) => {
26
+ const o = t.config.order ?? t.index, d = e.config.order ?? e.index;
27
+ return o - d;
28
+ })
29
+ ), f = c(() => a.itemCard ? g : "span"), _ = c(
30
+ () => `panel-main-item-col-wrap_${f.value === g ? "card" : "span"}`
31
+ ), h = c(
32
+ () => typeof a.itemCard == "object" && a.itemCard.lastMarginBottom ? a.itemCard.lastMarginBottom : 0
33
+ ), k = (t) => {
34
+ const { hide: e } = t;
35
+ if (typeof e == "function") {
36
+ const o = {
37
+ data: a.data,
38
+ value: a.data[t.key],
39
+ config: t
40
+ };
41
+ return !!e(o);
42
+ }
43
+ return !!e;
44
+ }, v = (t) => ({
45
+ ...y(a.layout),
46
+ ...y(t)
47
+ }), w = (t, e) => {
48
+ r.value = {}, e && (r.value[t] = e);
49
+ }, p = ({
50
+ stringifyData: t,
51
+ parseData: e
52
+ }) => {
53
+ var o;
54
+ (o = a.refreshFn) == null || o.call(a, t, e);
55
+ };
56
+ return F(
57
+ () => a.list,
58
+ (t) => {
59
+ const e = t.map((o) => o.key);
60
+ Object.keys(r.value).forEach((o) => {
61
+ e.includes(o) || delete r.value[o];
62
+ });
63
+ },
64
+ { immediate: !0 }
65
+ ), (t, e) => {
66
+ const o = x, d = E;
67
+ return s(), m(d, { gutter: l.rowGutter }, {
68
+ default: u(() => [
69
+ (s(!0), j(P, null, S(i(C), (n) => D((s(), m(o, G({
70
+ key: n.config.key
71
+ }, { ref_for: !0 }, v(n.config.layout), { class: "panel-main-item-col" }), {
72
+ default: u(() => [
73
+ (s(), m(O(i(f)), {
74
+ class: R(i(_))
75
+ }, {
76
+ default: u(() => [
77
+ U(W, {
78
+ data: l.data,
79
+ config: n.config,
80
+ editing: i(r)[n.config.key] ?? !1,
81
+ "refresh-fn": p,
82
+ "onUpdate:editing": (B) => w(n.config.key, B),
83
+ onSubmitSuccess: p
84
+ }, null, 8, ["data", "config", "editing", "onUpdate:editing"])
85
+ ]),
86
+ _: 2
87
+ }, 1032, ["class"]))
88
+ ]),
89
+ _: 2
90
+ }, 1040)), [
91
+ [V, !k(n.config)]
92
+ ])), 128))
93
+ ]),
94
+ _: 1
95
+ }, 8, ["gutter"]);
96
+ };
97
+ }
98
+ });
2
99
  export {
3
- f as default
100
+ J as default
4
101
  };