@done-coding/admin-core 0.16.1-alpha.0 → 0.17.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 (53) hide show
  1. package/es/components/app-layout/AppBody.vue.mjs +2 -2
  2. package/es/components/app-layout/AppBody.vue2.mjs +53 -54
  3. package/es/components/app-layout/keep-alive.mjs +22 -0
  4. package/es/components/data-view/DataListView.vue.mjs +2 -2
  5. package/es/components/data-view/DataListView.vue2.mjs +55 -53
  6. package/es/components/display/ActionConfirm.vue.mjs +2 -2
  7. package/es/components/display/ActionConfirm.vue2.mjs +1 -1
  8. package/es/components/display/TabsRefineFlow.vue.mjs +34 -32
  9. package/es/components/list-page/ListPage.vue.mjs +2 -2
  10. package/es/components/list-page/ListPage.vue2.mjs +74 -75
  11. package/es/components/misc/AutoRefreshGroup.vue.mjs +2 -2
  12. package/es/components/misc/AutoRefreshGroup.vue2.mjs +42 -35
  13. package/es/components/modal/{ConfirmModal.vue.mjs → ModalConfirm.vue.mjs} +3 -3
  14. package/es/components/modal/{ConfirmModal.vue2.mjs → ModalConfirm.vue2.mjs} +34 -34
  15. package/es/components/modal/ModalDetail.vue.mjs +63 -0
  16. package/es/components/modal/ModalDetail.vue2.mjs +4 -0
  17. package/es/components/modal/ModalForm.vue.mjs +75 -0
  18. package/es/components/modal/ModalForm.vue2.mjs +4 -0
  19. package/es/components/panel/PanelItem.vue.mjs +5 -81
  20. package/es/components/panel/PanelItem.vue2.mjs +93 -2
  21. package/es/components/panel/PanelMain.vue2.mjs +14 -14
  22. package/es/components/table/TableMain.vue.mjs +2 -2
  23. package/es/components/table/TableMain.vue2.mjs +210 -174
  24. package/es/components/table/TableSkeleton.vue.mjs +7 -0
  25. package/es/components/table/TableSkeleton.vue2.mjs +89 -0
  26. package/es/components/table/TableToolbar.vue.mjs +2 -2
  27. package/es/components/table/TableToolbar.vue2.mjs +22 -21
  28. package/es/components/table/use-fill-height.mjs +14 -0
  29. package/es/components/table/use-table-skeleton.mjs +19 -0
  30. package/es/index.mjs +230 -223
  31. package/es/router/group-redirect.mjs +20 -0
  32. package/es/style.css +1 -1
  33. package/package.json +2 -2
  34. package/types/components/app-layout/keep-alive.d.ts +14 -0
  35. package/types/components/data-view/types.d.ts +1 -0
  36. package/types/components/misc/AutoRefreshGroup.vue.d.ts +2 -1
  37. package/types/components/misc/types.d.ts +1 -0
  38. package/types/components/modal/{ConfirmModal.vue.d.ts → ModalConfirm.vue.d.ts} +1 -1
  39. package/types/components/modal/{DetailModal.vue.d.ts → ModalDetail.vue.d.ts} +2 -2
  40. package/types/components/modal/ModalForm.vue.d.ts +24 -0
  41. package/types/components/modal/index.d.ts +4 -3
  42. package/types/components/modal/types.d.ts +26 -2
  43. package/types/components/panel/PanelItem.vue.d.ts +1 -1
  44. package/types/components/panel/types.d.ts +4 -1
  45. package/types/components/table/TableSkeleton.vue.d.ts +7 -0
  46. package/types/components/table/types.d.ts +10 -0
  47. package/types/components/table/use-fill-height.d.ts +11 -0
  48. package/types/components/table/use-table-skeleton.d.ts +17 -0
  49. package/types/injectInfo.json.d.ts +1 -1
  50. package/types/router/group-redirect.d.ts +5 -0
  51. package/types/router/index.d.ts +1 -0
  52. package/es/components/modal/DetailModal.vue.mjs +0 -74
  53. package/es/components/modal/DetailModal.vue2.mjs +0 -4
@@ -1,15 +1,15 @@
1
- import { defineComponent as He, useCssVars as Re, unref as i, useSlots as Ve, computed as s, useModel as C, ref as u, shallowRef as q, watch as Ie, withDirectives as Ae, openBlock as k, createBlock as H, normalizeClass as Be, withCtx as n, createVNode as N, mergeProps as R, createSlots as E, renderSlot as f, normalizeProps as V, guardReactiveProps as I, renderList as A, createCommentVNode as U, mergeModels as J } from "vue";
2
- import { vLoading as Me } from "element-plus";
3
- import $e from "../form/FormSearch.vue.mjs";
4
- import { generateFormData as Fe, stringifyFormData as Pe } from "../form/utils.mjs";
5
- import { useListPageSticky as je } from "./use-sticky.mjs";
1
+ import { defineComponent as Re, useCssVars as Ve, unref as i, useSlots as Ie, computed as s, useModel as C, ref as u, shallowRef as q, watch as Ae, withDirectives as Me, openBlock as k, createBlock as H, normalizeClass as Be, withCtx as n, createVNode as N, mergeProps as R, createSlots as E, renderSlot as f, normalizeProps as V, guardReactiveProps as I, renderList as A, createCommentVNode as U, mergeModels as J } from "vue";
2
+ import { vLoading as $e } from "element-plus";
3
+ import Fe from "../form/FormSearch.vue.mjs";
4
+ import { generateFormData as Pe, stringifyFormData as je } from "../form/utils.mjs";
5
+ import { useListPageSticky as ze } from "./use-sticky.mjs";
6
6
  import Q from "../display/WatchSize.vue.mjs";
7
- import ze from "../table/TableMain.vue.mjs";
8
- import De from "../slot-layout/SlotLayoutFlowAside.vue.mjs";
9
- import Oe from "lodash/pick";
10
- import xe from "lodash/cloneDeep";
7
+ import De from "../table/TableMain.vue.mjs";
8
+ import Oe from "../slot-layout/SlotLayoutFlowAside.vue.mjs";
9
+ import xe from "lodash/pick";
10
+ import Le from "lodash/cloneDeep";
11
11
  import { useChannelViewportHeight as Te } from "../../hooks/use-channel-viewport-height.mjs";
12
- const Ye = /* @__PURE__ */ He({
12
+ const Ze = /* @__PURE__ */ Re({
13
13
  __name: "ListPage",
14
14
  props: /* @__PURE__ */ J({
15
15
  staticQuery: { default: () => ({}) },
@@ -46,61 +46,61 @@ const Ye = /* @__PURE__ */ He({
46
46
  }),
47
47
  emits: /* @__PURE__ */ J(["dataChange", "pageInfoChange"], ["update:isAutoRefresh", "update:refreshInterval", "update:customView"]),
48
48
  setup(a, { expose: W, emit: G }) {
49
- Re((e) => ({
50
- v41370796: ne.value,
51
- v561cdcbe: i(re),
52
- v176bdd58: i(oe),
53
- v3cef8d58: i(se)
49
+ Ve((e) => ({
50
+ v9b019db8: ue.value,
51
+ v676bd8af: i(oe),
52
+ v9dcea7f4: i(se),
53
+ v82e6163c: i(ie)
54
54
  }));
55
- const o = a, B = G, M = Ve(), $ = s(() => !!M.header), F = s(() => !!M.operation), m = C(a, "isAutoRefresh"), P = C(a, "refreshInterval"), j = C(a, "customView"), y = u({}), S = u(
55
+ const o = a, M = G, B = Ie(), $ = s(() => !!B.header), F = s(() => !!B.operation), m = C(a, "isAutoRefresh"), P = C(a, "refreshInterval"), j = C(a, "customView"), y = u({}), S = u(
56
56
  {}
57
- ), z = u(!1), l = q(), c = q(), { viewportHeightFinal: X } = Te(o), w = u(0), D = u(0), O = u(0), Y = s(() => ({
57
+ ), z = u(!1), X = s(() => !m.value && z.value), l = q(), c = q(), { viewportHeightFinal: Y } = Te(o), w = u(0), D = u(0), O = u(0), Z = s(() => ({
58
58
  ...S.value,
59
59
  ...o.staticQuery
60
- })), b = u(!1), Z = s(() => b.value ? w.value + 10 : 0), {
61
- layoutRoot: _,
62
- searchStickyActive: ee,
63
- toolbarStickyActive: te,
64
- pagerStickyActive: ae,
65
- searchStickyTop: re,
66
- toolbarStickyTop: oe,
67
- pagerStickyBottom: se
68
- } = je({
60
+ })), b = u(!1), _ = s(() => b.value ? w.value + 10 : 0), {
61
+ layoutRoot: ee,
62
+ searchStickyActive: te,
63
+ toolbarStickyActive: ae,
64
+ pagerStickyActive: re,
65
+ searchStickyTop: oe,
66
+ toolbarStickyTop: se,
67
+ pagerStickyBottom: ie
68
+ } = ze({
69
69
  searchSticky: () => o.searchSticky,
70
70
  toolbarSticky: () => o.toolbarSticky,
71
71
  pagerSticky: () => o.pagerSticky,
72
72
  separateSearch: () => o.separateSearch,
73
73
  searchHeight: () => w.value,
74
74
  showSearch: () => b.value
75
- }), ie = s(() => F.value ? D.value + 10 : 0), le = s(() => $.value ? O.value + 10 : 0), p = s(() => X.value - o.refineReduceHeight), ne = s(() => o.refine ? `${p.value}px` : "auto"), ue = s(() => {
75
+ }), le = s(() => F.value ? D.value + 10 : 0), ne = s(() => $.value ? O.value + 10 : 0), p = s(() => Y.value - o.refineReduceHeight), ue = s(() => o.refine ? `${p.value}px` : "auto"), ce = s(() => {
76
76
  if (o.refine)
77
- return o.separateSearch ? p.value : p.value - Z.value - ie.value - le.value;
78
- }), ce = s(
77
+ return o.separateSearch ? p.value : p.value - _.value - le.value - ne.value;
78
+ }), he = s(
79
79
  () => o.refine ? `${p.value}px` : "100vh"
80
80
  ), x = (e, t = "search") => {
81
- var g, v, r;
81
+ var v, g, r;
82
82
  let h = e;
83
83
  if (o.beforeSearch && (h = o.beforeSearch(
84
- xe(e),
84
+ Le(e),
85
85
  t
86
- )), t === "reset" && o.clearTableFilterOnReset && ((v = (g = c.value) == null ? void 0 : g.getTableInstance()) == null || v.clearFilter()), JSON.stringify(h) === JSON.stringify(S.value))
86
+ )), t === "reset" && o.clearTableFilterOnReset && ((g = (v = c.value) == null ? void 0 : v.getTableInstance()) == null || g.clearFilter()), JSON.stringify(h) === JSON.stringify(S.value))
87
87
  return ["reset", "search"].includes(t) ? (r = c.value) == null ? void 0 : r.reload() : void 0;
88
88
  S.value = {
89
89
  ...h
90
90
  };
91
- }, he = (e) => {
92
- B("dataChange", e);
93
91
  }, fe = (e) => {
94
- B("pageInfoChange", e);
92
+ M("dataChange", e);
93
+ }, ve = (e) => {
94
+ M("pageInfoChange", e);
95
95
  }, ge = (e) => {
96
96
  z.value = e;
97
- }, ve = (e) => {
98
- w.value = e;
99
97
  }, de = (e) => {
100
- D.value = e;
98
+ w.value = e;
101
99
  }, pe = (e) => {
100
+ D.value = e;
101
+ }, me = (e) => {
102
102
  O.value = e;
103
- }, me = s(() => o.list), ye = s(() => o.rowKey), T = s(() => y.value), L = {
103
+ }, ye = s(() => o.list), Se = s(() => o.rowKey), L = s(() => y.value), T = {
104
104
  refresh: async (e = !1) => {
105
105
  var t;
106
106
  return (t = c.value) == null ? void 0 : t.refresh(e);
@@ -145,8 +145,8 @@ const Ye = /* @__PURE__ */ He({
145
145
  update: (e, t) => {
146
146
  y.value[e] = t;
147
147
  }
148
- }, Se = s(() => {
149
- const e = Oe(L, [
148
+ }, we = s(() => {
149
+ const e = xe(T, [
150
150
  "triggerReset",
151
151
  "triggerSearch",
152
152
  "update"
@@ -155,57 +155,56 @@ const Ye = /* @__PURE__ */ He({
155
155
  ...o.injectInfo || {},
156
156
  ...e
157
157
  };
158
- }), we = (e) => e, be = (e) => e, Ce = (e) => e, ke = (e) => {
158
+ }), be = (e) => e, Ce = (e) => e, ke = (e) => e, He = (e) => {
159
159
  b.value = e;
160
160
  };
161
- return W(L), Ie(
161
+ return W(T), Ae(
162
162
  () => o.list,
163
163
  (e) => {
164
- const t = Fe(e);
165
- y.value = t, x(Pe(t, e));
164
+ const t = Pe(e);
165
+ y.value = t, x(je(t, e));
166
166
  },
167
167
  {
168
168
  immediate: !0
169
169
  }
170
170
  ), (e, t) => {
171
- var h, g, v;
172
- return Ae((k(), H(i(De), {
171
+ var h, v, g;
172
+ return Me((k(), H(i(Oe), {
173
173
  ref_key: "layoutRoot",
174
- ref: _,
175
- "element-loading-background": "rgba(122, 122, 122, 0.5)",
174
+ ref: ee,
176
175
  class: Be(["dc-list-page list-page", {
177
- "list-page_search-sticky": i(ee),
178
- "list-page_toolbar-sticky": i(te),
179
- "list-page_pager-sticky": i(ae)
176
+ "list-page_search-sticky": i(te),
177
+ "list-page_toolbar-sticky": i(ae),
178
+ "list-page_pager-sticky": i(re)
180
179
  }]),
181
180
  separate: a.separateSearch,
182
181
  type: (h = a.separateSearchConfig) == null ? void 0 : h.type,
183
- gap: (g = a.separateSearchConfig) == null ? void 0 : g.gap,
184
- "aside-width": (v = a.separateSearchConfig) == null ? void 0 : v.asideWidth,
185
- "aside-max-height": ce.value
182
+ gap: (v = a.separateSearchConfig) == null ? void 0 : v.gap,
183
+ "aside-width": (g = a.separateSearchConfig) == null ? void 0 : g.asideWidth,
184
+ "aside-max-height": he.value
186
185
  }, {
187
186
  aside: n(() => [
188
187
  $.value ? (k(), H(i(Q), {
189
188
  key: 0,
190
189
  class: "list-page-header",
191
190
  "observe-resize": a.headerObserveResize,
192
- onHeightChange: pe
191
+ onHeightChange: me
193
192
  }, {
194
193
  default: n(() => [
195
194
  f(e.$slots, "header", {}, void 0, !0)
196
195
  ]),
197
196
  _: 3
198
197
  }, 8, ["observe-resize"])) : U("", !0),
199
- N(i($e), R({
198
+ N(i(Fe), R({
200
199
  ref_key: "formSearch",
201
200
  ref: l,
202
- list: me.value,
203
- data: T.value
201
+ list: ye.value,
202
+ data: L.value
204
203
  }, a.formSearchProps, {
205
204
  compact: a.separateSearch,
206
205
  onSearch: x,
207
- onHeightChange: ve,
208
- onVisibleChange: ke
206
+ onHeightChange: de,
207
+ onVisibleChange: He
209
208
  }), E({ _: 2 }, [
210
209
  A(a.list, (r) => ({
211
210
  name: r.key,
@@ -218,7 +217,7 @@ const Ye = /* @__PURE__ */ He({
218
217
  key: 1,
219
218
  class: "list-page-operation",
220
219
  "observe-resize": a.operationObserveResize,
221
- onHeightChange: de
220
+ onHeightChange: pe
222
221
  }, {
223
222
  default: n(() => [
224
223
  f(e.$slots, "operation", {}, void 0, !0)
@@ -227,7 +226,7 @@ const Ye = /* @__PURE__ */ He({
227
226
  }, 8, ["observe-resize"])) : U("", !0)
228
227
  ]),
229
228
  default: n(() => [
230
- N(i(ze), R({
229
+ N(i(De), R({
231
230
  ref_key: "tableMain",
232
231
  ref: c,
233
232
  "is-auto-refresh": m.value,
@@ -238,27 +237,27 @@ const Ye = /* @__PURE__ */ He({
238
237
  "onUpdate:customView": t[2] || (t[2] = (r) => j.value = r),
239
238
  api: a.api,
240
239
  columns: a.columns,
241
- query: Y.value,
242
- maxHeight: ue.value,
243
- rowKey: ye.value,
240
+ query: Z.value,
241
+ maxHeight: ce.value,
242
+ rowKey: Se.value,
244
243
  toolbar: a.toolbar,
245
244
  showSwitchView: a.showSwitchView
246
245
  }, a.tableMainProps, {
247
246
  refine: !1,
248
- injectInfo: Se.value,
247
+ injectInfo: we.value,
249
248
  onLoadingChange: ge,
250
- onDataChange: he,
251
- onPageInfoChange: fe
249
+ onDataChange: fe,
250
+ onPageInfoChange: ve
252
251
  }), E({
253
252
  "custom-view-item": n((r) => [
254
- f(e.$slots, "custom-view-item", V(I(Ce(r))), void 0, !0)
253
+ f(e.$slots, "custom-view-item", V(I(ke(r))), void 0, !0)
255
254
  ]),
256
255
  _: 2
257
256
  }, [
258
257
  A(a.columns, (r) => ({
259
258
  name: r.prop,
260
259
  fn: n((d) => [
261
- f(e.$slots, `table-${r.prop}`, V(I(we(d))), void 0, !0)
260
+ f(e.$slots, `table-${r.prop}`, V(I(be(d))), void 0, !0)
262
261
  ])
263
262
  })),
264
263
  A(a.columns, (r) => ({
@@ -266,8 +265,8 @@ const Ye = /* @__PURE__ */ He({
266
265
  fn: n((d) => {
267
266
  var K;
268
267
  return [
269
- f(e.$slots, `table-header-${r.columnKey || r.prop}`, R(be(d), {
270
- searchFormData: T.value,
268
+ f(e.$slots, `table-header-${r.columnKey || r.prop}`, R(Ce(d), {
269
+ searchFormData: L.value,
271
270
  triggerSearch: (K = l.value) == null ? void 0 : K.triggerSearch
272
271
  }), void 0, !0)
273
272
  ];
@@ -277,11 +276,11 @@ const Ye = /* @__PURE__ */ He({
277
276
  ]),
278
277
  _: 3
279
278
  }, 8, ["class", "separate", "type", "gap", "aside-width", "aside-max-height"])), [
280
- [i(Me), !m.value && z.value]
279
+ [i($e), X.value]
281
280
  ]);
282
281
  };
283
282
  }
284
283
  });
285
284
  export {
286
- Ye as default
285
+ Ze as default
287
286
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./AutoRefreshGroup.vue2.mjs";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-e608ff06"]]);
4
+ const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-b4bb0cd5"]]);
5
5
  export {
6
- p as default
6
+ f as default
7
7
  };
@@ -1,13 +1,15 @@
1
- import { defineComponent as m, useModel as s, openBlock as o, createElementBlock as h, Fragment as v, createBlock as u, createCommentVNode as i, unref as l, withCtx as f, createVNode as d, normalizeClass as R, mergeModels as c } from "vue";
2
- import A from "./AutoRefresh.vue.mjs";
3
- import { ElButton as B, ElIcon as g } from "element-plus";
4
- import { Refresh as k } from "@element-plus/icons-vue";
1
+ import { defineComponent as m, useModel as i, openBlock as l, createBlock as a, unref as r, withCtx as n, createCommentVNode as f, createVNode as d, normalizeClass as h, mergeModels as R } from "vue";
2
+ import v from "./AutoRefresh.vue.mjs";
3
+ import { ElButton as A, ElIcon as c } from "element-plus";
4
+ import { Refresh as B } from "@element-plus/icons-vue";
5
+ import y from "../slot-layout/SlotLayoutTemplate.vue.mjs";
5
6
  const V = /* @__PURE__ */ m({
6
7
  __name: "AutoRefreshGroup",
7
- props: /* @__PURE__ */ c({
8
+ props: /* @__PURE__ */ R({
8
9
  showAutoRefresh: { type: Boolean, default: !0 },
9
10
  showRefresh: { type: Boolean, default: !0 },
10
11
  loading: { type: Boolean },
12
+ needRootNode: { type: Boolean, default: !0 },
11
13
  refreshFn: {}
12
14
  }, {
13
15
  isAutoRefresh: { type: Boolean },
@@ -17,36 +19,41 @@ const V = /* @__PURE__ */ m({
17
19
  }),
18
20
  emits: ["update:isAutoRefresh", "update:interval"],
19
21
  setup(e) {
20
- const n = s(e, "isAutoRefresh"), a = s(e, "interval");
21
- return (p, t) => (o(), h(v, null, [
22
- e.showAutoRefresh ? (o(), u(A, {
23
- key: 0,
24
- modelValue: n.value,
25
- "onUpdate:modelValue": t[0] || (t[0] = (r) => n.value = r),
26
- interval: a.value,
27
- "onUpdate:interval": t[1] || (t[1] = (r) => a.value = r),
28
- refreshFn: e.refreshFn,
29
- disabled: e.loading
30
- }, null, 8, ["modelValue", "interval", "refreshFn", "disabled"])) : i("", !0),
31
- e.showRefresh ? (o(), u(l(B), {
32
- key: 1,
33
- size: "small",
34
- circle: "",
35
- onClick: t[2] || (t[2] = (r) => e.refreshFn())
36
- }, {
37
- default: f(() => [
38
- d(l(g), {
39
- class: R({ "auto-refresh-group-icon--rotating": e.loading })
40
- }, {
41
- default: f(() => [
42
- d(l(k))
43
- ]),
44
- _: 1
45
- }, 8, ["class"])
46
- ]),
47
- _: 1
48
- })) : i("", !0)
49
- ], 64));
22
+ const s = i(e, "isAutoRefresh"), u = i(e, "interval");
23
+ return (g, t) => (l(), a(r(y), {
24
+ disabled: !e.needRootNode
25
+ }, {
26
+ default: n(() => [
27
+ e.showAutoRefresh ? (l(), a(v, {
28
+ key: 0,
29
+ modelValue: s.value,
30
+ "onUpdate:modelValue": t[0] || (t[0] = (o) => s.value = o),
31
+ interval: u.value,
32
+ "onUpdate:interval": t[1] || (t[1] = (o) => u.value = o),
33
+ refreshFn: e.refreshFn,
34
+ disabled: e.loading
35
+ }, null, 8, ["modelValue", "interval", "refreshFn", "disabled"])) : f("", !0),
36
+ e.showRefresh ? (l(), a(r(A), {
37
+ key: 1,
38
+ size: "small",
39
+ circle: "",
40
+ onClick: t[2] || (t[2] = (o) => e.refreshFn())
41
+ }, {
42
+ default: n(() => [
43
+ d(r(c), {
44
+ class: h({ "auto-refresh-group-icon--rotating": e.loading })
45
+ }, {
46
+ default: n(() => [
47
+ d(r(B))
48
+ ]),
49
+ _: 1
50
+ }, 8, ["class"])
51
+ ]),
52
+ _: 1
53
+ })) : f("", !0)
54
+ ]),
55
+ _: 1
56
+ }, 8, ["disabled"]));
50
57
  }
51
58
  });
52
59
  export {
@@ -1,8 +1,8 @@
1
- import o from "./ConfirmModal.vue2.mjs";
1
+ import o from "./ModalConfirm.vue2.mjs";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  import r from "../../_virtual/_plugin-vue_export-helper.mjs";
5
- const c = /* @__PURE__ */ r(o, [["__scopeId", "data-v-64018cc0"]]);
5
+ const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-3d9e58a4"]]);
6
6
  export {
7
- c as default
7
+ f as default
8
8
  };
@@ -1,11 +1,11 @@
1
- import { defineComponent as L, computed as l, shallowRef as A, ref as w, inject as b, provide as D, openBlock as i, createBlock as s, resolveDynamicComponent as C, mergeProps as p, withCtx as r, createElementVNode as g, normalizeClass as F, renderSlot as c, createElementBlock as O, Fragment as x, createTextVNode as f, toDisplayString as u, unref as R, createCommentVNode as W, createVNode as G } from "vue";
2
- import { ElDrawer as j, ElDialog as X, ElButton as M } from "element-plus";
3
- import { BODY_CONTENT_VIEWPORT_HEIGHT as z, SCOPE_VIEWPORT_MAX_HEIGHT as Y } from "../../inject/key.mjs";
4
- import { useActivated as q } from "../../hooks/activated.mjs";
5
- import { useObserveSize as J } from "../../hooks/use-observe-size.mjs";
6
- const K = { class: "confirm-modal__title" }, Q = ["reverse"], oe = /* @__PURE__ */ L({
1
+ import { defineComponent as A, computed as l, shallowRef as F, ref as w, inject as b, provide as D, openBlock as i, createBlock as s, resolveDynamicComponent as C, mergeProps as W, withCtx as r, createElementVNode as g, normalizeClass as G, renderSlot as c, createElementBlock as O, Fragment as x, createTextVNode as f, toDisplayString as u, unref as R, createCommentVNode as j, createVNode as X } from "vue";
2
+ import { ElDrawer as Y, ElDialog as q, ElButton as M } from "element-plus";
3
+ import { BODY_CONTENT_VIEWPORT_HEIGHT as p, SCOPE_VIEWPORT_MAX_HEIGHT as J } from "../../inject/key.mjs";
4
+ import { useActivated as K } from "../../hooks/activated.mjs";
5
+ import { useObserveSize as Q } from "../../hooks/use-observe-size.mjs";
6
+ const U = { class: "confirm-modal__title" }, Z = ["reverse"], ae = /* @__PURE__ */ A({
7
7
  inheritAttrs: !1,
8
- __name: "ConfirmModal",
8
+ __name: "ModalConfirm",
9
9
  props: {
10
10
  show: { type: Boolean },
11
11
  showClose: { type: Boolean, default: !0 },
@@ -25,30 +25,30 @@ const K = { class: "confirm-modal__title" }, Q = ["reverse"], oe = /* @__PURE__
25
25
  type: { default: "primary" },
26
26
  layerType: { default: "modal" },
27
27
  direction: { default: "rtl" },
28
- headerDivider: { type: Boolean, default: !0 },
29
- footerDivider: { type: Boolean, default: !0 },
28
+ headerDivider: { type: Boolean, default: void 0 },
29
+ footerDivider: { type: Boolean, default: void 0 },
30
30
  modalReserve: { default: 200 }
31
31
  },
32
32
  emits: ["update:show"],
33
- setup(e, { emit: N }) {
34
- const o = e, P = N, n = l(() => o.layerType === "drawer"), T = A(), m = w(0), v = b(z, void 0), S = l(
33
+ setup(e, { emit: z }) {
34
+ const o = e, N = z, n = l(() => o.layerType === "drawer"), P = l(() => o.headerDivider ?? n.value), S = l(() => o.footerDivider ?? n.value), T = F(), m = w(0), v = b(p, void 0), V = l(
35
35
  () => n.value ? m.value : (v == null ? void 0 : v.value) ?? 0
36
36
  );
37
- D(z, S);
37
+ D(p, V);
38
38
  const B = w(
39
39
  typeof window > "u" ? 0 : window.innerHeight
40
- ), y = () => {
40
+ ), h = () => {
41
41
  B.value = window.innerHeight;
42
42
  };
43
- q((t) => {
44
- t.isActivated ? (y(), window.addEventListener("resize", y)) : window.removeEventListener("resize", y);
45
- }), D(Y, {
43
+ K((t) => {
44
+ t.isActivated ? (h(), window.addEventListener("resize", h)) : window.removeEventListener("resize", h);
45
+ }), D(J, {
46
46
  scope: void 0,
47
47
  viewportMaxHeight: l(
48
48
  () => n.value ? m.value : Math.max(0, B.value - o.modalReserve)
49
49
  ),
50
50
  parent: void 0
51
- }), J({
51
+ }), Q({
52
52
  getTarget: () => {
53
53
  var t;
54
54
  return (t = T.value) == null ? void 0 : t.parentElement;
@@ -60,45 +60,45 @@ const K = { class: "confirm-modal__title" }, Q = ["reverse"], oe = /* @__PURE__
60
60
  // 用 hook 默认 100ms 防抖:抽屉开合动画 / 视口变化时 RO 每帧回调写 drawerBodyHeight →
61
61
  // provide computed 链 + 插槽内列表重算,防抖合并高频帧(leading 首帧即时给出可用高、不闪)。
62
62
  });
63
- const V = l(() => n.value ? j : X), $ = l(
63
+ const $ = l(() => n.value ? Y : q), I = l(
64
64
  () => n.value ? { size: o.width, direction: o.direction } : { width: o.width, alignCenter: !0 }
65
- ), d = w(!1), E = l(() => o.useLoading && d.value), h = (t) => {
65
+ ), d = w(!1), E = l(() => o.useLoading && d.value), y = (t) => {
66
66
  var a;
67
- P("update:show", !1), (a = o.onClose) == null || a.call(o, t);
67
+ N("update:show", !1), (a = o.onClose) == null || a.call(o, t);
68
68
  }, k = async () => {
69
69
  var a;
70
- await ((a = o.onCancel) == null ? void 0 : a.call(o)) !== !1 && h(!1);
70
+ await ((a = o.onCancel) == null ? void 0 : a.call(o)) !== !1 && y(!1);
71
71
  }, H = async () => {
72
72
  var t;
73
73
  d.value = !0;
74
74
  try {
75
75
  const a = await ((t = o.onConfirm) == null ? void 0 : t.call(o));
76
76
  if (d.value = !1, a === !1) return;
77
- h(!0);
77
+ y(!0);
78
78
  } catch {
79
79
  d.value = !1;
80
80
  }
81
- }, I = () => {
82
- h(!1);
81
+ }, L = () => {
82
+ y(!1);
83
83
  };
84
- return (t, a) => (i(), s(C(V.value), p({ ...t.$attrs, ...$.value }, {
84
+ return (t, a) => (i(), s(C($.value), W({ ...t.$attrs, ...I.value }, {
85
85
  "model-value": e.show,
86
86
  class: [
87
87
  "dc-confirm-modal",
88
88
  "confirm-modal",
89
89
  {
90
- "confirm-modal_header-divider": n.value && e.headerDivider,
91
- "confirm-modal_footer-divider": n.value && e.footerDivider
90
+ "confirm-modal_header-divider": P.value,
91
+ "confirm-modal_footer-divider": S.value
92
92
  }
93
93
  ],
94
94
  "show-close": e.showClose,
95
95
  "append-to-body": "",
96
96
  "close-on-click-modal": e.closeOnClickModal,
97
97
  "close-on-press-escape": e.closeOnPressEscape,
98
- onClose: I
98
+ onClose: L
99
99
  }), {
100
100
  header: r(() => [
101
- g("div", K, [
101
+ g("div", U, [
102
102
  c(t.$slots, "title", {}, () => [
103
103
  typeof e.title == "function" ? (i(), s(C(e.title), { key: 0 })) : (i(), O(x, { key: 1 }, [
104
104
  f(u(e.title), 1)
@@ -116,7 +116,7 @@ const K = { class: "confirm-modal__title" }, Q = ["reverse"], oe = /* @__PURE__
116
116
  confirmHandler: H,
117
117
  loading: E.value
118
118
  }, () => [
119
- e.hiddenCancel ? W("", !0) : (i(), s(R(M), {
119
+ e.hiddenCancel ? j("", !0) : (i(), s(R(M), {
120
120
  key: 0,
121
121
  class: "confirm-modal__cancel",
122
122
  onClick: k
@@ -126,7 +126,7 @@ const K = { class: "confirm-modal__title" }, Q = ["reverse"], oe = /* @__PURE__
126
126
  ]),
127
127
  _: 1
128
128
  })),
129
- G(R(M), {
129
+ X(R(M), {
130
130
  class: "confirm-modal__confirm",
131
131
  type: e.type,
132
132
  loading: E.value,
@@ -138,13 +138,13 @@ const K = { class: "confirm-modal__title" }, Q = ["reverse"], oe = /* @__PURE__
138
138
  _: 1
139
139
  }, 8, ["type", "loading"])
140
140
  ], !0)
141
- ], 8, Q)
141
+ ], 8, Z)
142
142
  ]),
143
143
  default: r(() => [
144
144
  g("div", {
145
145
  ref_key: "contentRef",
146
146
  ref: T,
147
- class: F(["confirm-modal__content", { "confirm-modal__content_drawer": n.value }])
147
+ class: G(["confirm-modal__content", { "confirm-modal__content_drawer": n.value }])
148
148
  }, [
149
149
  c(t.$slots, "main-header", {}, void 0, !0),
150
150
  c(t.$slots, "default", {}, () => [
@@ -160,5 +160,5 @@ const K = { class: "confirm-modal__title" }, Q = ["reverse"], oe = /* @__PURE__
160
160
  }
161
161
  });
162
162
  export {
163
- oe as default
163
+ ae as default
164
164
  };
@@ -0,0 +1,63 @@
1
+ import { defineComponent as w, computed as i, openBlock as y, createBlock as p, withCtx as r, renderSlot as l } from "vue";
2
+ import b from "./ModalForm.vue.mjs";
3
+ const T = /* @__PURE__ */ w({
4
+ __name: "ModalDetail",
5
+ props: {
6
+ data: {},
7
+ list: {},
8
+ type: {},
9
+ title: {},
10
+ subTitle: {},
11
+ show: { type: Boolean },
12
+ addApi: {},
13
+ editApi: {},
14
+ width: { default: 600 },
15
+ formLayout: { default: () => ({ span: 24 }) },
16
+ formProps: {},
17
+ formRowGutter: {},
18
+ labelWidth: { default: "auto" },
19
+ layerType: {},
20
+ direction: {}
21
+ },
22
+ emits: ["update:show", "afterAdd", "afterEdit"],
23
+ setup(t, { emit: s }) {
24
+ const e = t, d = s, n = i(() => e.data), f = i(() => `${e.type === "add" ? "新增" : "编辑"}${e.subTitle || ""}`), u = i(() => e.title ?? f.value), m = (o) => {
25
+ const a = e.type === "add" ? e.addApi : e.editApi;
26
+ return (a == null ? void 0 : a(o)) ?? Promise.resolve();
27
+ }, c = (o) => {
28
+ d("update:show", o);
29
+ }, h = (o) => {
30
+ d(e.type === "add" ? "afterAdd" : "afterEdit", o);
31
+ };
32
+ return (o, a) => (y(), p(b, {
33
+ class: "dc-detail-modal",
34
+ title: u.value,
35
+ show: t.show,
36
+ list: t.list,
37
+ data: n.value,
38
+ submitFn: m,
39
+ width: t.width,
40
+ layerType: t.layerType,
41
+ direction: t.direction,
42
+ formLayout: t.formLayout,
43
+ labelWidth: t.labelWidth,
44
+ formRowGutter: t.formRowGutter,
45
+ formProps: t.formProps,
46
+ headerDivider: !1,
47
+ footerDivider: !1,
48
+ "onUpdate:show": c,
49
+ onSubmitSuccess: h
50
+ }, {
51
+ header: r(() => [
52
+ l(o.$slots, "header")
53
+ ]),
54
+ footer: r(() => [
55
+ l(o.$slots, "footer")
56
+ ]),
57
+ _: 3
58
+ }, 8, ["title", "show", "list", "data", "width", "layerType", "direction", "formLayout", "labelWidth", "formRowGutter", "formProps"]));
59
+ }
60
+ });
61
+ export {
62
+ T as default
63
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ModalDetail.vue.mjs";
2
+ export {
3
+ f as default
4
+ };