@done-coding/admin-core 0.1.1-alpha.2 → 0.1.1-alpha.4

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 (36) hide show
  1. package/es/components/form/FormDatePicker.vue.mjs +7 -0
  2. package/es/components/form/FormDatePicker.vue2.mjs +50 -0
  3. package/es/components/form/index.mjs +19 -19
  4. package/es/components/form/utils.mjs +82 -61
  5. package/es/components/misc/ActionButton.vue.mjs +52 -0
  6. package/es/components/misc/ActionButton.vue2.mjs +4 -0
  7. package/es/components/misc/ActionButtonDanger.vue.mjs +32 -0
  8. package/es/components/misc/ActionButtonDanger.vue2.mjs +4 -0
  9. package/es/components/misc/ActionButtonWarn.vue.mjs +32 -0
  10. package/es/components/misc/ActionButtonWarn.vue2.mjs +4 -0
  11. package/es/components/misc/index.mjs +21 -9
  12. package/es/components/table/TableMain.vue.mjs +1 -1
  13. package/es/components/table/TableMain.vue2.mjs +148 -133
  14. package/es/components/table/TableToolbar.vue.mjs +3 -3
  15. package/es/components/table/TableToolbar.vue2.mjs +154 -70
  16. package/es/components/table/ToolbarButtons.vue.mjs +49 -0
  17. package/es/components/table/ToolbarButtons.vue2.mjs +4 -0
  18. package/es/helpers/list-helper.mjs +29 -33
  19. package/es/index.mjs +104 -92
  20. package/es/style.css +1 -1
  21. package/es/utils/export.mjs +23 -0
  22. package/package.json +2 -2
  23. package/types/components/form/{FormDateTimeRange.vue.d.ts → FormDatePicker.vue.d.ts} +2 -2
  24. package/types/components/form/index.d.ts +2 -2
  25. package/types/components/form/utils.d.ts +3 -1
  26. package/types/components/misc/ActionButton.vue.d.ts +24 -0
  27. package/types/components/misc/ActionButtonDanger.vue.d.ts +19 -0
  28. package/types/components/misc/ActionButtonWarn.vue.d.ts +19 -0
  29. package/types/components/misc/index.d.ts +4 -1
  30. package/types/components/table/TableToolbar.vue.d.ts +66 -9
  31. package/types/components/table/ToolbarButtons.vue.d.ts +19 -0
  32. package/types/components/table/types.d.ts +64 -17
  33. package/types/utils/export.d.ts +30 -0
  34. package/types/utils/index.d.ts +1 -0
  35. package/es/components/form/FormDateTimeRange.vue.mjs +0 -46
  36. package/es/components/form/FormDateTimeRange.vue2.mjs +0 -4
@@ -0,0 +1,7 @@
1
+ import o from "./FormDatePicker.vue2.mjs";
2
+ /* empty css */
3
+ import r from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const a = /* @__PURE__ */ r(o, [["__scopeId", "data-v-cefb4529"]]);
5
+ export {
6
+ a as default
7
+ };
@@ -0,0 +1,50 @@
1
+ import { ElDatePicker as d, ElButton as u } from "element-plus/es";
2
+ import "element-plus/es/components/base/style/css";
3
+ import "element-plus/es/components/button/style/css";
4
+ import "element-plus/es/components/date-picker/style/css";
5
+ import { defineComponent as p, useModel as f, useAttrs as k, openBlock as o, createElementBlock as a, createVNode as _, mergeProps as V, unref as y, createElementVNode as g, Fragment as w, renderList as D, createBlock as E, withCtx as P, createTextVNode as B, toDisplayString as C, mergeModels as h } from "vue";
6
+ import { getDatePickerSwiftOptions as v } from "./utils.mjs";
7
+ const x = { class: "form-date-picker" }, F = { class: "form-date-picker-swift" }, U = /* @__PURE__ */ p({
8
+ name: "FormDatePicker",
9
+ inheritAttrs: !1,
10
+ __name: "FormDatePicker",
11
+ props: /* @__PURE__ */ h({
12
+ swiftOptions: { default: () => v() }
13
+ }, {
14
+ modelValue: { default: null },
15
+ modelModifiers: {}
16
+ }),
17
+ emits: ["update:modelValue"],
18
+ setup(r) {
19
+ const t = f(r, "modelValue"), i = k(), s = (l) => {
20
+ t.value = l.set();
21
+ };
22
+ return (l, n) => {
23
+ const m = d, c = u;
24
+ return o(), a("span", x, [
25
+ _(m, V({
26
+ modelValue: t.value,
27
+ "onUpdate:modelValue": n[0] || (n[0] = (e) => t.value = e),
28
+ type: "datetimerange",
29
+ class: "form-date-picker-input"
30
+ }, y(i)), null, 16, ["modelValue"]),
31
+ g("span", F, [
32
+ (o(!0), a(w, null, D(r.swiftOptions, (e) => (o(), E(c, {
33
+ key: e.key,
34
+ type: "primary",
35
+ link: "",
36
+ onClick: (M) => s(e)
37
+ }, {
38
+ default: P(() => [
39
+ B(C(e.key), 1)
40
+ ]),
41
+ _: 2
42
+ }, 1032, ["onClick"]))), 128))
43
+ ])
44
+ ]);
45
+ };
46
+ }
47
+ });
48
+ export {
49
+ U as default
50
+ };
@@ -1,38 +1,38 @@
1
- import a from "./FormMain.vue.mjs";
2
- import i from "./FormSelect.vue.mjs";
1
+ import i from "./FormMain.vue.mjs";
2
+ import a from "./FormSelect.vue.mjs";
3
3
  import e from "./FormRadioGroup.vue.mjs";
4
4
  import t from "./FormRadio.vue.mjs";
5
5
  import f from "./FormTree.vue.mjs";
6
- import n from "./FormSearch.vue.mjs";
7
- import s from "./FormVerifyImage.vue.mjs";
6
+ import s from "./FormSearch.vue.mjs";
7
+ import n from "./FormVerifyImage.vue.mjs";
8
8
  import c from "./FormVerifyCode.vue.mjs";
9
- import F from "./FormDateTimeRange.vue.mjs";
9
+ import F from "./FormDatePicker.vue.mjs";
10
10
  const p = {
11
- FormMain: a,
12
- FormSelect: i,
11
+ FormMain: i,
12
+ FormSelect: a,
13
13
  FormRadioGroup: e,
14
14
  FormRadio: t,
15
15
  FormTree: f,
16
- FormSearch: n,
17
- FormVerifyImage: s,
16
+ FormSearch: s,
17
+ FormVerifyImage: n,
18
18
  FormVerifyCode: c,
19
- FormDateTimeRange: F
20
- }, V = {
19
+ FormDatePicker: F
20
+ }, u = {
21
21
  install(o) {
22
- Object.entries(p).forEach(([m, r]) => {
23
- o.component(m, r);
22
+ Object.entries(p).forEach(([r, m]) => {
23
+ o.component(r, m);
24
24
  });
25
25
  }
26
26
  };
27
27
  export {
28
- F as FormDateTimeRange,
29
- a as FormMain,
28
+ F as FormDatePicker,
29
+ i as FormMain,
30
30
  t as FormRadio,
31
31
  e as FormRadioGroup,
32
- n as FormSearch,
33
- i as FormSelect,
32
+ s as FormSearch,
33
+ a as FormSelect,
34
34
  f as FormTree,
35
35
  c as FormVerifyCode,
36
- s as FormVerifyImage,
37
- V as formInstall
36
+ n as FormVerifyImage,
37
+ u as formInstall
38
38
  };
@@ -1,111 +1,131 @@
1
- import p from "lodash/cloneDeep";
2
- const u = (t) => {
1
+ import f from "lodash/cloneDeep";
2
+ const k = () => {
3
+ const t = /* @__PURE__ */ new Date(), r = new Date(
4
+ t.getFullYear(),
5
+ t.getMonth(),
6
+ t.getDate()
7
+ ), e = new Date(r.getTime() + 864e5 - 1), s = new Date(r.getTime() - 864e5), n = new Date(r.getTime() - 1), i = new Date(r.getTime() - 6 * 864e5);
8
+ return [
9
+ {
10
+ key: "今日",
11
+ set: () => [r, e]
12
+ },
13
+ {
14
+ key: "昨日",
15
+ set: () => [s, n]
16
+ },
17
+ {
18
+ key: "近7日",
19
+ set: () => [i, e]
20
+ }
21
+ ];
22
+ }, u = (t) => {
3
23
  const { ignore: r, key: e } = t;
4
24
  return r || e.startsWith("__") && e.toUpperCase() === e;
5
- }, m = (t) => typeof t == "function", I = (t) => t.reduce(
25
+ }, g = (t) => typeof t == "function", D = (t) => t.reduce(
6
26
  (r, e) => (u(e) || (typeof e.init == "object" && console.error(
7
27
  `表单项${e.label}的初始值不能为对象 请设置为返回值的形式`
8
- ), r[e.key] = m(e.init) ? e.init() : e.init), r),
28
+ ), r[e.key] = g(e.init) ? e.init() : e.init), r),
9
29
  {}
10
- ), S = (t, r) => {
11
- const e = p(t);
30
+ ), O = (t, r) => {
31
+ const e = f(t);
12
32
  return r.reduce(
13
- (i, n) => {
14
- if (u(n)) return i;
33
+ (s, n) => {
34
+ if (u(n)) return s;
15
35
  if (n.parse) {
16
- const s = n.parse(
36
+ const i = n.parse(
17
37
  t[n.key],
18
- i,
38
+ s,
19
39
  e
20
40
  );
21
- s !== void 0 && (i[n.key] = s);
41
+ i !== void 0 && (s[n.key] = i);
22
42
  } else
23
- i[n.key] = t[n.key];
24
- return i;
43
+ s[n.key] = t[n.key];
44
+ return s;
25
45
  },
26
46
  {}
27
47
  );
28
- }, d = (t, r) => {
29
- const e = p(t);
48
+ }, c = (t, r) => {
49
+ const e = f(t);
30
50
  return r.reduce(
31
- (i, n) => {
32
- if (u(n)) return i;
51
+ (s, n) => {
52
+ if (u(n)) return s;
33
53
  if (n.stringify) {
34
- const s = n.stringify(
54
+ const i = n.stringify(
35
55
  t[n.key],
36
- i,
56
+ s,
37
57
  e
38
58
  );
39
- s !== void 0 && (i[n.key] = s);
59
+ i !== void 0 && (s[n.key] = i);
40
60
  } else
41
- i[n.key] = t[n.key];
42
- return i;
61
+ s[n.key] = t[n.key];
62
+ return s;
43
63
  },
44
64
  {}
45
65
  );
46
- }, C = ({
66
+ }, b = ({
47
67
  modelValueKey: t = "modelValue",
48
68
  config: r,
49
69
  data: e,
50
- updateData: i = (n) => {
70
+ updateData: s = (n) => {
51
71
  e[r.key] = n;
52
72
  }
53
73
  }) => ({
54
74
  [t]: e[r.key],
55
75
  [`onUpdate:${t}`]: (n) => {
56
- i(n);
76
+ s(n);
57
77
  }
58
- }), _ = (t) => {
78
+ }), S = (t) => {
59
79
  var r, e;
60
80
  return (r = t.extra) != null && r.isInput ? {
61
81
  placeholder: `请输入${t.label}`
62
82
  } : (e = t.extra) != null && e.isSelect ? {
63
83
  placeholder: `请选择${t.label}`
64
84
  } : {};
65
- }, O = (t, r) => {
85
+ }, I = (t, r) => {
66
86
  const { extra: e } = t;
67
87
  if (e != null && e.enterSubmit)
68
88
  return {
69
- onKeyup: (i) => {
70
- var n, s;
71
- i.key === "Enter" && (r(), (s = (n = i.target) == null ? void 0 : n.blur) == null || s.call(n));
89
+ onKeyup: (s) => {
90
+ var n, i;
91
+ s.key === "Enter" && (r(), (i = (n = s.target) == null ? void 0 : n.blur) == null || i.call(n));
72
92
  }
73
93
  };
74
- }, h = (t, r) => {
94
+ }, C = (t, r) => {
75
95
  const { extra: e } = t;
76
96
  if (e != null && e.isInput && ((e == null ? void 0 : e.blurSubmit) ?? !0))
77
97
  return {
78
98
  onBlur: r
79
99
  };
80
- }, E = (t, r) => {
100
+ }, T = (t, r) => {
81
101
  const { extra: e } = t;
82
102
  if (e != null && e.isSelect && ((e == null ? void 0 : e.changeSubmit) ?? !0))
83
103
  return {
84
104
  onChange: r
85
105
  };
86
- }, N = Symbol("FORM_ITEM_CHANGE_LOADING"), k = (t) => t.required === !0, f = [], y = [], a = (t) => {
87
- f.push(...t);
88
- }, c = (t) => {
106
+ }, _ = Symbol("FORM_ITEM_CHANGE_LOADING"), m = (t) => t.required === !0, y = [], p = [], h = (t) => {
89
107
  y.push(...t);
90
- }, D = (t) => {
91
- const { label: r, type: e, ...i } = t;
108
+ }, w = (t) => {
109
+ p.push(...t);
110
+ }, E = (t) => {
111
+ const { label: r, type: e, ...s } = t;
92
112
  let n;
93
113
  if (e)
94
114
  n = e;
95
115
  else {
96
116
  const { render: o } = t;
97
- o && (f.includes(o) ? n = "input" : y.includes(o) && (n = "select"));
117
+ o && (y.includes(o) ? n = "input" : p.includes(o) && (n = "select"));
98
118
  }
99
- let s;
100
- n === "input" && (s = {
101
- ...i.extra || {},
119
+ let i;
120
+ n === "input" && (i = {
121
+ ...s.extra || {},
102
122
  isInput: !0
103
- }), n === "select" && (s = {
104
- ...i.extra || {},
123
+ }), n === "select" && (i = {
124
+ ...s.extra || {},
105
125
  isSelect: !0
106
126
  });
107
127
  let l;
108
- if (k(t)) {
128
+ if (m(t)) {
109
129
  l = [
110
130
  {
111
131
  required: !0,
@@ -117,31 +137,32 @@ const u = (t) => {
117
137
  trigger: "blur"
118
138
  }
119
139
  ];
120
- const { required: o, ...g } = i;
140
+ const { required: o, ...a } = s;
121
141
  return {
122
142
  label: r,
123
- extra: s,
143
+ extra: i,
124
144
  rules: l,
125
- ...g
145
+ ...a
126
146
  };
127
147
  } else
128
148
  return {
129
149
  label: r,
130
- extra: s,
131
- ...i
150
+ extra: i,
151
+ ...s
132
152
  };
133
153
  };
134
154
  export {
135
- N as FORM_ITEM_CHANGE_LOADING,
136
- I as generateFormData,
137
- h as getBlurSubmit,
138
- E as getChangeSubmit,
139
- O as getEnterSubmit,
140
- _ as getPlaceholder,
141
- C as getVModelSugar,
142
- S as parseFormData,
143
- a as setInputComponent,
144
- c as setSelectComponent,
145
- d as stringifyFormData,
146
- D as swiftFormItemConfig
155
+ _ as FORM_ITEM_CHANGE_LOADING,
156
+ D as generateFormData,
157
+ C as getBlurSubmit,
158
+ T as getChangeSubmit,
159
+ k as getDatePickerSwiftOptions,
160
+ I as getEnterSubmit,
161
+ S as getPlaceholder,
162
+ b as getVModelSugar,
163
+ O as parseFormData,
164
+ h as setInputComponent,
165
+ w as setSelectComponent,
166
+ c as stringifyFormData,
167
+ E as swiftFormItemConfig
147
168
  };
@@ -0,0 +1,52 @@
1
+ import { ElPopconfirm as d, ElButton as v } from "element-plus/es";
2
+ import "element-plus/es/components/base/style/css";
3
+ import "element-plus/es/components/popconfirm/style/css";
4
+ import "element-plus/es/components/button/style/css";
5
+ import { defineComponent as b, useModel as y, computed as C, openBlock as B, createBlock as E, withCtx as i, createVNode as k, renderSlot as x, mergeModels as l } from "vue";
6
+ const z = /* @__PURE__ */ b({
7
+ __name: "ActionButton",
8
+ props: /* @__PURE__ */ l({
9
+ data: {},
10
+ type: { default: "danger" },
11
+ tipContent: {}
12
+ }, {
13
+ visible: { type: Boolean, default: !1 },
14
+ visibleModifiers: {}
15
+ }),
16
+ emits: /* @__PURE__ */ l(["confirm"], ["update:visible"]),
17
+ setup(e, { emit: r }) {
18
+ const t = e, p = r, o = y(e, "visible"), s = C(
19
+ () => typeof t.tipContent == "function" ? t.tipContent(t.data) : t.tipContent
20
+ ), m = () => {
21
+ p("confirm", t.data);
22
+ };
23
+ return (a, n) => {
24
+ const c = v, f = d;
25
+ return B(), E(f, {
26
+ visible: o.value,
27
+ "onUpdate:visible": n[0] || (n[0] = (u) => o.value = u),
28
+ title: s.value,
29
+ "confirm-button-text": "确定",
30
+ "confirm-button-type": e.type,
31
+ onConfirm: m
32
+ }, {
33
+ reference: i(() => [
34
+ k(c, {
35
+ type: e.type,
36
+ link: "",
37
+ size: "small"
38
+ }, {
39
+ default: i(() => [
40
+ x(a.$slots, "default")
41
+ ]),
42
+ _: 3
43
+ }, 8, ["type"])
44
+ ]),
45
+ _: 3
46
+ }, 8, ["visible", "title", "confirm-button-type"]);
47
+ };
48
+ }
49
+ });
50
+ export {
51
+ z as default
52
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ActionButton.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,32 @@
1
+ import { defineComponent as c, useModel as f, computed as a, openBlock as v, createBlock as b, withCtx as C, renderSlot as y, mergeModels as s } from "vue";
2
+ import g from "./ActionButton.vue.mjs";
3
+ const A = /* @__PURE__ */ c({
4
+ __name: "ActionButtonDanger",
5
+ props: /* @__PURE__ */ s({
6
+ data: {},
7
+ tipContent: { type: [String, Function] }
8
+ }, {
9
+ visible: { type: Boolean, default: !1 },
10
+ visibleModifiers: {}
11
+ }),
12
+ emits: /* @__PURE__ */ s(["confirm"], ["update:visible"]),
13
+ setup(e, { emit: l }) {
14
+ const n = e, r = l, o = f(e, "visible"), p = a(() => n.data), d = a(() => n.tipContent), m = (t) => r("confirm", t);
15
+ return (t, i) => (v(), b(g, {
16
+ visible: o.value,
17
+ "onUpdate:visible": i[0] || (i[0] = (u) => o.value = u),
18
+ type: "danger",
19
+ data: p.value,
20
+ tipContent: d.value,
21
+ onConfirm: m
22
+ }, {
23
+ default: C(() => [
24
+ y(t.$slots, "default")
25
+ ]),
26
+ _: 3
27
+ }, 8, ["visible", "data", "tipContent"]));
28
+ }
29
+ });
30
+ export {
31
+ A as default
32
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ActionButtonDanger.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,32 @@
1
+ import { defineComponent as c, useModel as f, computed as a, openBlock as v, createBlock as b, withCtx as C, renderSlot as y, mergeModels as s } from "vue";
2
+ import B from "./ActionButton.vue.mjs";
3
+ const A = /* @__PURE__ */ c({
4
+ __name: "ActionButtonWarn",
5
+ props: /* @__PURE__ */ s({
6
+ data: {},
7
+ tipContent: { type: [String, Function] }
8
+ }, {
9
+ visible: { type: Boolean, default: !1 },
10
+ visibleModifiers: {}
11
+ }),
12
+ emits: /* @__PURE__ */ s(["confirm"], ["update:visible"]),
13
+ setup(e, { emit: l }) {
14
+ const n = e, r = l, i = f(e, "visible"), p = a(() => n.data), d = a(() => n.tipContent), m = (t) => r("confirm", t);
15
+ return (t, o) => (v(), b(B, {
16
+ visible: i.value,
17
+ "onUpdate:visible": o[0] || (o[0] = (u) => i.value = u),
18
+ type: "warning",
19
+ data: p.value,
20
+ tipContent: d.value,
21
+ onConfirm: m
22
+ }, {
23
+ default: C(() => [
24
+ y(t.$slots, "default")
25
+ ]),
26
+ _: 3
27
+ }, 8, ["visible", "data", "tipContent"]));
28
+ }
29
+ });
30
+ export {
31
+ A as default
32
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ActionButtonWarn.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -1,14 +1,26 @@
1
- import e from "./TriggerAutoImport.vue.mjs";
2
- import m from "./AutoRefresh.vue.mjs";
3
- const n = { TriggerAutoImport: e, AutoRefresh: m }, i = {
4
- install(o) {
5
- Object.entries(n).forEach(([t, r]) => {
6
- o.component(t, r);
1
+ import r from "./TriggerAutoImport.vue.mjs";
2
+ import i from "./AutoRefresh.vue.mjs";
3
+ import m from "./ActionButton.vue.mjs";
4
+ import c from "./ActionButtonDanger.vue.mjs";
5
+ import s from "./ActionButtonWarn.vue.mjs";
6
+ const a = {
7
+ TriggerAutoImport: r,
8
+ AutoRefresh: i,
9
+ ActionButton: m,
10
+ ActionButtonDanger: c,
11
+ ActionButtonWarn: s
12
+ }, _ = {
13
+ install(t) {
14
+ Object.entries(a).forEach(([o, n]) => {
15
+ t.component(o, n);
7
16
  });
8
17
  }
9
18
  };
10
19
  export {
11
- m as AutoRefresh,
12
- e as TriggerAutoImport,
13
- i as miscInstall
20
+ m as ActionButton,
21
+ c as ActionButtonDanger,
22
+ s as ActionButtonWarn,
23
+ i as AutoRefresh,
24
+ r as TriggerAutoImport,
25
+ _ as miscInstall
14
26
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./TableMain.vue2.mjs";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-643017c3"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-3d9833b8"]]);
5
5
  export {
6
6
  p as default
7
7
  };