@done-coding/admin-core 0.15.1-alpha.0 → 0.16.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.
- package/es/components/app-layout/AppBody.vue.mjs +1 -1
- package/es/components/app-layout/AppBody.vue2.mjs +43 -39
- package/es/components/app-layout/AppPage.vue.mjs +2 -2
- package/es/components/app-layout/AppPage.vue2.mjs +114 -105
- package/es/components/display/TabsHeader.vue.mjs +2 -2
- package/es/components/display/TabsHeader.vue2.mjs +31 -32
- package/es/components/display/TabsRefineFlow.vue.mjs +30 -32
- package/es/components/display/TabsTile.vue.mjs +2 -2
- package/es/components/display/WatchSize.vue.mjs +34 -31
- package/es/components/form/FormMain.vue.mjs +2 -2
- package/es/components/form/FormMain.vue2.mjs +80 -75
- package/es/components/form/FormSearch.vue.mjs +1 -1
- package/es/components/form/FormSearch.vue2.mjs +82 -80
- package/es/components/form/FormSubmitPanel.vue2.mjs +11 -10
- package/es/components/form/use-layout-by-container.mjs +20 -0
- package/es/components/list-page/ListPage.vue.mjs +2 -2
- package/es/components/list-page/ListPage.vue2.mjs +167 -137
- package/es/components/list-page/use-sticky.mjs +41 -0
- package/es/components/modal/ConfirmModal.vue.mjs +3 -2
- package/es/components/modal/ConfirmModal.vue2.mjs +104 -55
- package/es/components/modal/DetailModal.vue.mjs +40 -34
- package/es/components/modal/ModalPorter.vue.mjs +20 -23
- package/es/components/table/TableMain.vue.mjs +1 -1
- package/es/components/table/TableMain.vue2.mjs +27 -28
- package/es/hooks/activated.mjs +16 -24
- package/es/hooks/use-breakpoint.mjs +17 -21
- package/es/hooks/use-channel-viewport-height.mjs +26 -8
- package/es/hooks/use-observe-size.mjs +26 -0
- package/es/index.mjs +177 -173
- package/es/inject/key.mjs +18 -15
- package/es/style.css +1 -1
- package/es/utils/dom.mjs +11 -1
- package/package.json +2 -2
- package/types/components/app-layout/AppPage.vue.d.ts +8 -0
- package/types/components/display/TabsTile.vue.d.ts +2 -2
- package/types/components/display/WatchSize.vue.d.ts +4 -0
- package/types/components/display/types.d.ts +1 -5
- package/types/components/form/FormItem.vue.d.ts +8 -8
- package/types/components/form/FormMain.vue.d.ts +1 -12
- package/types/components/form/FormSubmitPanel.vue.d.ts +1 -1
- package/types/components/form/types.d.ts +1 -0
- package/types/components/form/use-layout-by-container.d.ts +11 -0
- package/types/components/list-page/ListPage.vue.d.ts +6 -1
- package/types/components/list-page/types.d.ts +5 -0
- package/types/components/list-page/use-sticky.d.ts +19 -0
- package/types/components/modal/ConfirmModal.vue.d.ts +15 -3
- package/types/components/modal/DetailModal.vue.d.ts +4 -1
- package/types/components/panel/PanelItemNestForm.vue.d.ts +1 -1
- package/types/hooks/index.d.ts +1 -0
- package/types/hooks/use-channel-viewport-height.d.ts +2 -1
- package/types/hooks/use-observe-size.d.ts +7 -0
- package/types/inject/key.d.ts +8 -2
- package/types/injectInfo.json.d.ts +1 -1
- package/types/utils/dom.d.ts +1 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ElDrawer as
|
|
3
|
-
|
|
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({
|
|
4
7
|
inheritAttrs: !1,
|
|
5
8
|
__name: "ConfirmModal",
|
|
6
9
|
props: {
|
|
@@ -21,95 +24,141 @@ const P = { class: "confirm-modal__title" }, b = { class: "confirm-modal__conten
|
|
|
21
24
|
useLoading: { type: Boolean },
|
|
22
25
|
type: { default: "primary" },
|
|
23
26
|
layerType: { default: "modal" },
|
|
24
|
-
direction: { default: "rtl" }
|
|
27
|
+
direction: { default: "rtl" },
|
|
28
|
+
headerDivider: { type: Boolean, default: !0 },
|
|
29
|
+
footerDivider: { type: Boolean, default: !0 },
|
|
30
|
+
modalReserve: { default: 200 }
|
|
25
31
|
},
|
|
26
32
|
emits: ["update:show"],
|
|
27
|
-
setup(e, { emit:
|
|
28
|
-
const
|
|
29
|
-
() =>
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
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(
|
|
35
|
+
() => n.value ? m.value : (v == null ? void 0 : v.value) ?? 0
|
|
36
|
+
);
|
|
37
|
+
D(z, S);
|
|
38
|
+
const B = w(
|
|
39
|
+
typeof window > "u" ? 0 : window.innerHeight
|
|
40
|
+
), y = () => {
|
|
41
|
+
B.value = window.innerHeight;
|
|
42
|
+
};
|
|
43
|
+
q((t) => {
|
|
44
|
+
t.isActivated ? (y(), window.addEventListener("resize", y)) : window.removeEventListener("resize", y);
|
|
45
|
+
}), D(Y, {
|
|
46
|
+
scope: void 0,
|
|
47
|
+
viewportMaxHeight: l(
|
|
48
|
+
() => n.value ? m.value : Math.max(0, B.value - o.modalReserve)
|
|
49
|
+
),
|
|
50
|
+
parent: void 0
|
|
51
|
+
}), J({
|
|
52
|
+
getTarget: () => {
|
|
53
|
+
var t;
|
|
54
|
+
return (t = T.value) == null ? void 0 : t.parentElement;
|
|
55
|
+
},
|
|
56
|
+
onResize: (t) => {
|
|
57
|
+
m.value = Math.max(0, Math.round(t.contentRect.height));
|
|
58
|
+
},
|
|
59
|
+
enabled: () => n.value
|
|
60
|
+
// 用 hook 默认 100ms 防抖:抽屉开合动画 / 视口变化时 RO 每帧回调写 drawerBodyHeight →
|
|
61
|
+
// provide computed 链 + 插槽内列表重算,防抖合并高频帧(leading 首帧即时给出可用高、不闪)。
|
|
62
|
+
});
|
|
63
|
+
const V = l(() => n.value ? j : X), $ = l(
|
|
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) => {
|
|
66
|
+
var a;
|
|
67
|
+
P("update:show", !1), (a = o.onClose) == null || a.call(o, t);
|
|
68
|
+
}, k = async () => {
|
|
69
|
+
var a;
|
|
70
|
+
await ((a = o.onCancel) == null ? void 0 : a.call(o)) !== !1 && h(!1);
|
|
71
|
+
}, H = async () => {
|
|
72
|
+
var t;
|
|
73
|
+
d.value = !0;
|
|
39
74
|
try {
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
|
|
75
|
+
const a = await ((t = o.onConfirm) == null ? void 0 : t.call(o));
|
|
76
|
+
if (d.value = !1, a === !1) return;
|
|
77
|
+
h(!0);
|
|
43
78
|
} catch {
|
|
44
|
-
|
|
79
|
+
d.value = !1;
|
|
45
80
|
}
|
|
46
|
-
},
|
|
47
|
-
|
|
81
|
+
}, I = () => {
|
|
82
|
+
h(!1);
|
|
48
83
|
};
|
|
49
|
-
return (
|
|
84
|
+
return (t, a) => (i(), s(C(V.value), p({ ...t.$attrs, ...$.value }, {
|
|
50
85
|
"model-value": e.show,
|
|
51
|
-
class: [
|
|
86
|
+
class: [
|
|
87
|
+
"dc-confirm-modal",
|
|
88
|
+
"confirm-modal",
|
|
89
|
+
{
|
|
90
|
+
"confirm-modal_header-divider": n.value && e.headerDivider,
|
|
91
|
+
"confirm-modal_footer-divider": n.value && e.footerDivider
|
|
92
|
+
}
|
|
93
|
+
],
|
|
52
94
|
"show-close": e.showClose,
|
|
53
95
|
"append-to-body": "",
|
|
54
96
|
"close-on-click-modal": e.closeOnClickModal,
|
|
55
|
-
"close-on-press-escape": e.closeOnPressEscape
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
97
|
+
"close-on-press-escape": e.closeOnPressEscape,
|
|
98
|
+
onClose: I
|
|
99
|
+
}), {
|
|
100
|
+
header: r(() => [
|
|
101
|
+
g("div", K, [
|
|
102
|
+
c(t.$slots, "title", {}, () => [
|
|
103
|
+
typeof e.title == "function" ? (i(), s(C(e.title), { key: 0 })) : (i(), O(x, { key: 1 }, [
|
|
104
|
+
f(u(e.title), 1)
|
|
62
105
|
], 64))
|
|
63
106
|
], !0)
|
|
64
107
|
])
|
|
65
108
|
]),
|
|
66
|
-
footer:
|
|
67
|
-
|
|
109
|
+
footer: r(() => [
|
|
110
|
+
g("div", {
|
|
68
111
|
class: "confirm-modal__footer",
|
|
69
112
|
reverse: e.reverse
|
|
70
113
|
}, [
|
|
71
|
-
|
|
72
|
-
cancelHandler:
|
|
73
|
-
confirmHandler:
|
|
74
|
-
loading:
|
|
114
|
+
c(t.$slots, "footer", {
|
|
115
|
+
cancelHandler: k,
|
|
116
|
+
confirmHandler: H,
|
|
117
|
+
loading: E.value
|
|
75
118
|
}, () => [
|
|
76
|
-
e.hiddenCancel ?
|
|
119
|
+
e.hiddenCancel ? W("", !0) : (i(), s(R(M), {
|
|
77
120
|
key: 0,
|
|
78
121
|
class: "confirm-modal__cancel",
|
|
79
|
-
onClick:
|
|
122
|
+
onClick: k
|
|
80
123
|
}, {
|
|
81
|
-
default:
|
|
82
|
-
|
|
124
|
+
default: r(() => [
|
|
125
|
+
f(u(typeof e.cancelText == "function" ? e.cancelText() : e.cancelText), 1)
|
|
83
126
|
]),
|
|
84
127
|
_: 1
|
|
85
128
|
})),
|
|
86
|
-
|
|
129
|
+
G(R(M), {
|
|
87
130
|
class: "confirm-modal__confirm",
|
|
88
131
|
type: e.type,
|
|
89
|
-
loading:
|
|
90
|
-
onClick:
|
|
132
|
+
loading: E.value,
|
|
133
|
+
onClick: H
|
|
91
134
|
}, {
|
|
92
|
-
default:
|
|
93
|
-
|
|
135
|
+
default: r(() => [
|
|
136
|
+
f(u(typeof e.confirmText == "function" ? e.confirmText() : e.confirmText), 1)
|
|
94
137
|
]),
|
|
95
138
|
_: 1
|
|
96
139
|
}, 8, ["type", "loading"])
|
|
97
140
|
], !0)
|
|
98
|
-
], 8,
|
|
141
|
+
], 8, Q)
|
|
99
142
|
]),
|
|
100
|
-
default:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
143
|
+
default: r(() => [
|
|
144
|
+
g("div", {
|
|
145
|
+
ref_key: "contentRef",
|
|
146
|
+
ref: T,
|
|
147
|
+
class: F(["confirm-modal__content", { "confirm-modal__content_drawer": n.value }])
|
|
148
|
+
}, [
|
|
149
|
+
c(t.$slots, "main-header", {}, void 0, !0),
|
|
150
|
+
c(t.$slots, "default", {}, () => [
|
|
151
|
+
typeof e.content == "function" ? (i(), s(C(e.content), { key: 0 })) : (i(), O(x, { key: 1 }, [
|
|
152
|
+
f(u(e.content), 1)
|
|
105
153
|
], 64))
|
|
106
|
-
], !0)
|
|
107
|
-
|
|
154
|
+
], !0),
|
|
155
|
+
c(t.$slots, "main-footer", {}, void 0, !0)
|
|
156
|
+
], 2)
|
|
108
157
|
]),
|
|
109
158
|
_: 3
|
|
110
159
|
}, 16, ["model-value", "class", "show-close", "close-on-click-modal", "close-on-press-escape"]));
|
|
111
160
|
}
|
|
112
161
|
});
|
|
113
162
|
export {
|
|
114
|
-
|
|
163
|
+
oe as default
|
|
115
164
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { stringifyFormData as
|
|
1
|
+
import { defineComponent as g, ref as b, computed as s, watch as p, openBlock as A, createBlock as W, withCtx as d, createVNode as v, unref as C, mergeProps as M, renderSlot as f } from "vue";
|
|
2
|
+
import D from "../form/FormMain.vue.mjs";
|
|
3
|
+
import { stringifyFormData as $ } from "../form/utils.mjs";
|
|
4
4
|
import k from "./ConfirmModal.vue.mjs";
|
|
5
|
-
const
|
|
5
|
+
const E = /* @__PURE__ */ g({
|
|
6
6
|
__name: "DetailModal",
|
|
7
7
|
props: {
|
|
8
8
|
data: {},
|
|
@@ -19,50 +19,56 @@ const P = /* @__PURE__ */ w({
|
|
|
19
19
|
labelWidth: { default: "auto" }
|
|
20
20
|
},
|
|
21
21
|
emits: ["update:show", "afterAdd", "afterEdit"],
|
|
22
|
-
setup(
|
|
23
|
-
const t =
|
|
24
|
-
i("update:show",
|
|
25
|
-
},
|
|
26
|
-
var
|
|
27
|
-
return (
|
|
28
|
-
var
|
|
29
|
-
const a =
|
|
30
|
-
console.log("confirm", a), t.type === "add" ? (await ((
|
|
22
|
+
setup(o, { emit: m }) {
|
|
23
|
+
const t = o, i = m, l = b(), u = s(() => t.data), c = s(() => `${t.type === "add" ? "新增" : "编辑"}${t.subTitle || ""}`), h = (e) => {
|
|
24
|
+
i("update:show", e);
|
|
25
|
+
}, w = () => {
|
|
26
|
+
var e;
|
|
27
|
+
return (e = l.value) == null ? void 0 : e.validate().then(async () => {
|
|
28
|
+
var r, n;
|
|
29
|
+
const a = $(t.data, t.list);
|
|
30
|
+
console.log("confirm", a), t.type === "add" ? (await ((r = t.addApi) == null ? void 0 : r.call(t, a)), i("afterAdd", a)) : (await ((n = t.editApi) == null ? void 0 : n.call(t, a)), i("afterEdit", a));
|
|
31
31
|
});
|
|
32
|
-
},
|
|
32
|
+
}, y = () => {
|
|
33
33
|
console.log("cancel");
|
|
34
34
|
};
|
|
35
|
-
return
|
|
35
|
+
return p(
|
|
36
36
|
() => t.show,
|
|
37
|
-
(
|
|
37
|
+
(e) => {
|
|
38
38
|
var a;
|
|
39
|
-
|
|
39
|
+
e || (a = l.value) == null || a.clearValidate();
|
|
40
40
|
}
|
|
41
|
-
), (
|
|
41
|
+
), (e, a) => (A(), W(k, {
|
|
42
42
|
class: "dc-detail-modal",
|
|
43
|
-
title:
|
|
44
|
-
show:
|
|
45
|
-
onConfirm:
|
|
46
|
-
onCancel:
|
|
43
|
+
title: c.value,
|
|
44
|
+
show: o.show,
|
|
45
|
+
onConfirm: w,
|
|
46
|
+
onCancel: y,
|
|
47
47
|
useLoading: "",
|
|
48
|
-
width:
|
|
49
|
-
"onUpdate:show":
|
|
48
|
+
width: o.modalWidth,
|
|
49
|
+
"onUpdate:show": h
|
|
50
50
|
}, {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
"main-header": d(() => [
|
|
52
|
+
f(e.$slots, "header")
|
|
53
|
+
]),
|
|
54
|
+
"main-footer": d(() => [
|
|
55
|
+
f(e.$slots, "footer")
|
|
56
|
+
]),
|
|
57
|
+
default: d(() => [
|
|
58
|
+
v(C(D), M({
|
|
53
59
|
ref_key: "formMain",
|
|
54
60
|
ref: l,
|
|
55
|
-
list:
|
|
56
|
-
data:
|
|
57
|
-
layout:
|
|
58
|
-
labelWidth:
|
|
59
|
-
"row-gutter":
|
|
60
|
-
},
|
|
61
|
+
list: o.list,
|
|
62
|
+
data: u.value,
|
|
63
|
+
layout: o.formLayout,
|
|
64
|
+
labelWidth: o.labelWidth,
|
|
65
|
+
"row-gutter": o.formRowGutter
|
|
66
|
+
}, o.formProps), null, 16, ["list", "data", "layout", "labelWidth", "row-gutter"])
|
|
61
67
|
]),
|
|
62
|
-
_:
|
|
68
|
+
_: 3
|
|
63
69
|
}, 8, ["title", "show", "width"]));
|
|
64
70
|
}
|
|
65
71
|
});
|
|
66
72
|
export {
|
|
67
|
-
|
|
73
|
+
E as default
|
|
68
74
|
};
|
|
@@ -1,50 +1,47 @@
|
|
|
1
1
|
import { defineComponent as S, getCurrentInstance as h, inject as c, renderSlot as v } from "vue";
|
|
2
2
|
import { getModalShelfInjectionKey as u } from "../../inject/key.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { useActivated as y } from "../../hooks/activated.mjs";
|
|
4
4
|
const k = /* @__PURE__ */ S({
|
|
5
5
|
__name: "ModalPorter",
|
|
6
6
|
props: {
|
|
7
7
|
modalList: {}
|
|
8
8
|
},
|
|
9
|
-
setup(
|
|
10
|
-
var
|
|
11
|
-
const
|
|
9
|
+
setup(f, { expose: p }) {
|
|
10
|
+
var i;
|
|
11
|
+
const a = f, d = ((i = h()) == null ? void 0 : i.uid) ?? Math.floor(Math.random() * 1e9), m = {
|
|
12
12
|
app: c(u("app"), null),
|
|
13
13
|
page: c(u("page"), null)
|
|
14
14
|
};
|
|
15
|
-
function
|
|
16
|
-
return `p${
|
|
15
|
+
function s(e) {
|
|
16
|
+
return `p${d}:${e}`;
|
|
17
17
|
}
|
|
18
18
|
function l(e) {
|
|
19
19
|
if (e === "app" || e === "page") {
|
|
20
|
-
const t =
|
|
20
|
+
const t = m[e];
|
|
21
21
|
return t || (console.error(`[ModalPorter] 未找到 level="${e}" 的 ModalShelf`), null);
|
|
22
22
|
}
|
|
23
23
|
return e;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const r =
|
|
25
|
+
function g(e, t) {
|
|
26
|
+
const r = a.modalList.find((o) => o.key === e);
|
|
27
27
|
if (!r)
|
|
28
28
|
return console.error(`[ModalPorter] 未配置的弹窗 key: ${String(e)}`), null;
|
|
29
29
|
const n = l(r.shelf);
|
|
30
|
-
return n ? n.evoke(
|
|
30
|
+
return n ? n.evoke(s(String(e)), r.component, {
|
|
31
31
|
payload: t,
|
|
32
32
|
sameKeyStrategy: r.sameKeyStrategy
|
|
33
33
|
}) : null;
|
|
34
34
|
}
|
|
35
|
-
return y(
|
|
36
|
-
()
|
|
37
|
-
|
|
38
|
-
() => {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}), e.forEach((t, r) => r.remove(t));
|
|
46
|
-
}
|
|
47
|
-
), p({ evoke: m }), (e, t) => v(e.$slots, "default");
|
|
35
|
+
return y((e) => {
|
|
36
|
+
if (e.isActivated) return;
|
|
37
|
+
const t = /* @__PURE__ */ new Map();
|
|
38
|
+
a.modalList.forEach((r) => {
|
|
39
|
+
const n = l(r.shelf);
|
|
40
|
+
if (!n) return;
|
|
41
|
+
const o = t.get(n) ?? [];
|
|
42
|
+
o.push(s(String(r.key))), t.set(n, o);
|
|
43
|
+
}), t.forEach((r, n) => n.remove(r));
|
|
44
|
+
}), p({ evoke: g }), (e, t) => v(e.$slots, "default");
|
|
48
45
|
}
|
|
49
46
|
});
|
|
50
47
|
export {
|
|
@@ -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 m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-fcb4b963"]]);
|
|
5
5
|
export {
|
|
6
6
|
m as default
|
|
7
7
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as pe, useModel as z, useAttrs as me, ref as u, computed as f, markRaw as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent as pe, useModel as z, useAttrs as me, ref as u, computed as f, markRaw as U, shallowRef as ve, onMounted as he, onActivated as we, watch as d, openBlock as n, createElementBlock as w, createBlock as p, unref as x, withCtx as m, createVNode as q, mergeProps as c, createCommentVNode as ye, resolveDynamicComponent as E, Fragment as I, renderList as Se, createSlots as be, renderSlot as T, createTextVNode as H, toDisplayString as D, normalizeProps as Ce, guardReactiveProps as xe, withDirectives as Ie, createElementVNode as Pe, vShow as Ve, mergeModels as F } from "vue";
|
|
2
|
+
import Y from "lodash/cloneDeep";
|
|
3
|
+
import G from "lodash/omit";
|
|
4
4
|
import Z from "lodash/set";
|
|
5
5
|
import Q from "lodash/get";
|
|
6
6
|
import Re from "./TableToolbar.vue.mjs";
|
|
7
7
|
import ze from "../display/WatchSize.vue.mjs";
|
|
8
8
|
import Ee from "../data-view/DataListView.vue.mjs";
|
|
9
|
-
import { ElTable as Te, ElTableColumn as
|
|
9
|
+
import { ElTable as Te, ElTableColumn as He, ElEmpty as ke, ElPagination as Ae } from "element-plus";
|
|
10
10
|
import { pickExportColumns as Me } from "../../utils/export.mjs";
|
|
11
11
|
import { useChannelViewportHeight as Ne } from "../../hooks/use-channel-viewport-height.mjs";
|
|
12
12
|
import { APP_API_LIST_MODEL_KEY_CONFIG as P } from "../../config/list-model.mjs";
|
|
13
|
-
const Le = { class: "dc-table-main table-main" }, Oe = { class: "table-main-pagination" }, Ze = /* @__PURE__ */ pe({
|
|
13
|
+
const Le = { class: "dc-table-main table-main" }, Oe = { class: "dc-table-main__pagination table-main-pagination" }, Ze = /* @__PURE__ */ pe({
|
|
14
14
|
__name: "TableMain",
|
|
15
|
-
props: /* @__PURE__ */
|
|
15
|
+
props: /* @__PURE__ */ F({
|
|
16
16
|
showPager: { type: Boolean, default: !0 },
|
|
17
17
|
showSwitchView: { type: Boolean },
|
|
18
18
|
showToolbar: { type: Boolean, default: !0 },
|
|
@@ -41,9 +41,9 @@ const Le = { class: "dc-table-main table-main" }, Oe = { class: "table-main-pagi
|
|
|
41
41
|
customView: { type: Boolean, default: !1 },
|
|
42
42
|
customViewModifiers: {}
|
|
43
43
|
}),
|
|
44
|
-
emits: /* @__PURE__ */
|
|
44
|
+
emits: /* @__PURE__ */ F(["pageChange", "pageSizeChange", "dataChange", "loadingChange", "pageInfoChange"], ["update:isAutoRefresh", "update:refreshInterval", "update:customView"]),
|
|
45
45
|
setup(o, { expose: W, emit: X }) {
|
|
46
|
-
const r = o, v = X,
|
|
46
|
+
const r = o, v = X, k = z(o, "isAutoRefresh"), A = z(o, "refreshInterval"), y = z(o, "customView"), ee = me(), S = u([]), b = u(0), s = u(0), l = u(1), h = u(!1), V = u(!1), M = u([]), te = f(
|
|
47
47
|
() => ({
|
|
48
48
|
columns: Me(r.columns),
|
|
49
49
|
selectedList: M.value,
|
|
@@ -56,12 +56,10 @@ const Le = { class: "dc-table-main table-main" }, Oe = { class: "table-main-pagi
|
|
|
56
56
|
), N = u(0), ae = (e) => {
|
|
57
57
|
N.value = e;
|
|
58
58
|
}, re = f(
|
|
59
|
-
() => y.value ?
|
|
59
|
+
() => y.value ? U(Ee) : U(Te)
|
|
60
60
|
), R = ve(), oe = f(
|
|
61
61
|
() => r.columns.some((e) => e.type === "selection")
|
|
62
|
-
), { viewportHeightFinal: ne } = Ne(r,
|
|
63
|
-
fallback: 500
|
|
64
|
-
}), L = f(() => r.showPager ? 35 : 0), O = f(
|
|
62
|
+
), { viewportHeightFinal: ne } = Ne(r), L = f(() => r.showPager ? 35 : 0), O = f(
|
|
65
63
|
() => r.showToolbar ? N.value : 0
|
|
66
64
|
), le = f(() => {
|
|
67
65
|
const { maxHeight: e, refine: a, dataViewMaxHeightMinValue: t } = r;
|
|
@@ -73,7 +71,7 @@ const Le = { class: "dc-table-main table-main" }, Oe = { class: "table-main-pagi
|
|
|
73
71
|
t
|
|
74
72
|
) : void 0;
|
|
75
73
|
}), C = f(() => {
|
|
76
|
-
const e =
|
|
74
|
+
const e = Y(r.query || {});
|
|
77
75
|
return Z(e, P.PAGE_SIZE_KEY, s.value), Z(
|
|
78
76
|
e,
|
|
79
77
|
P.CURRENT_PAGE_KEY,
|
|
@@ -106,7 +104,7 @@ const Le = { class: "dc-table-main table-main" }, Oe = { class: "table-main-pagi
|
|
|
106
104
|
var t;
|
|
107
105
|
if (!s.value) return;
|
|
108
106
|
h.value ? console.warn("请求并发") : h.value = !0, e || (V.value = !0), (t = R.value) == null || t.clearSelection();
|
|
109
|
-
const a =
|
|
107
|
+
const a = Y(C.value);
|
|
110
108
|
return r.api(a).then((i) => {
|
|
111
109
|
K(a, !1) && (S.value = Q(
|
|
112
110
|
i,
|
|
@@ -135,18 +133,18 @@ const Le = { class: "dc-table-main table-main" }, Oe = { class: "table-main-pagi
|
|
|
135
133
|
reload: fe,
|
|
136
134
|
getTableInstance: () => R.value
|
|
137
135
|
}, $ = (e, a = []) => ({
|
|
138
|
-
...
|
|
136
|
+
...G(e, ["render", "headerRender"].concat(a)),
|
|
139
137
|
injectInfo: r.injectInfo || {},
|
|
140
138
|
exposeInfo: g
|
|
141
139
|
}), J = (e) => ({
|
|
142
|
-
...
|
|
140
|
+
...G(e, ["render", "headerRender"]),
|
|
143
141
|
injectInfo: r.injectInfo || {},
|
|
144
142
|
exposeInfo: g
|
|
145
143
|
}), ge = (e) => e;
|
|
146
144
|
W(g);
|
|
147
145
|
const de = (e) => {
|
|
148
146
|
s.value = e, l.value = 1;
|
|
149
|
-
},
|
|
147
|
+
}, _ = (e) => !e || e === "expand";
|
|
150
148
|
return he(() => {
|
|
151
149
|
s.value = r.pageSizeInit, we(() => {
|
|
152
150
|
g.refresh();
|
|
@@ -175,12 +173,13 @@ const Le = { class: "dc-table-main table-main" }, Oe = { class: "table-main-pagi
|
|
|
175
173
|
}), (e, a) => (n(), w("div", Le, [
|
|
176
174
|
o.showToolbar ? (n(), p(x(ze), {
|
|
177
175
|
key: 0,
|
|
176
|
+
class: "dc-table-main__toolbar",
|
|
178
177
|
onHeightChange: ae
|
|
179
178
|
}, {
|
|
180
179
|
default: m(() => [
|
|
181
|
-
|
|
182
|
-
"is-auto-refresh":
|
|
183
|
-
"onUpdate:isAutoRefresh": a[0] || (a[0] = (t) =>
|
|
180
|
+
q(Re, c({
|
|
181
|
+
"is-auto-refresh": k.value,
|
|
182
|
+
"onUpdate:isAutoRefresh": a[0] || (a[0] = (t) => k.value = t),
|
|
184
183
|
"refresh-interval": A.value,
|
|
185
184
|
"onUpdate:refreshInterval": a[1] || (a[1] = (t) => A.value = t),
|
|
186
185
|
"custom-view": y.value,
|
|
@@ -213,14 +212,14 @@ const Le = { class: "dc-table-main table-main" }, Oe = { class: "table-main-pagi
|
|
|
213
212
|
]),
|
|
214
213
|
empty: m(() => [
|
|
215
214
|
h.value ? (n(), w(I, { key: 0 }, [
|
|
216
|
-
|
|
217
|
-
], 64)) : (n(), p(x(
|
|
215
|
+
H("加载中...")
|
|
216
|
+
], 64)) : (n(), p(x(ke), { key: 1 }))
|
|
218
217
|
]),
|
|
219
218
|
default: m(() => [
|
|
220
|
-
(n(!0), w(I, null, Se(o.columns, (t) => (n(), p(x(
|
|
219
|
+
(n(!0), w(I, null, Se(o.columns, (t) => (n(), p(x(He), c({
|
|
221
220
|
key: t.columnKey || t.prop
|
|
222
221
|
}, { ref_for: !0 }, t), be({ _: 2 }, [
|
|
223
|
-
|
|
222
|
+
_(t.type) ? {
|
|
224
223
|
name: "default",
|
|
225
224
|
fn: m((i) => [
|
|
226
225
|
T(e.$slots, t.prop, c({ ref_for: !0 }, $(i)), () => [
|
|
@@ -230,13 +229,13 @@ const Le = { class: "dc-table-main table-main" }, Oe = { class: "table-main-pagi
|
|
|
230
229
|
}, $(i, ["$index"]), {
|
|
231
230
|
_index: i.$index
|
|
232
231
|
}), null, 16, ["_index"])) : (n(), w(I, { key: 1 }, [
|
|
233
|
-
|
|
232
|
+
H(D(i.row[t.prop]), 1)
|
|
234
233
|
], 64))
|
|
235
234
|
], !0)
|
|
236
235
|
]),
|
|
237
236
|
key: "0"
|
|
238
237
|
} : void 0,
|
|
239
|
-
|
|
238
|
+
_(t.type) ? {
|
|
240
239
|
name: "header",
|
|
241
240
|
fn: m((i) => [
|
|
242
241
|
T(e.$slots, `header-${t.prop}`, c({ ref_for: !0 }, J(i)), () => [
|
|
@@ -244,7 +243,7 @@ const Le = { class: "dc-table-main table-main" }, Oe = { class: "table-main-pagi
|
|
|
244
243
|
key: 0,
|
|
245
244
|
ref_for: !0
|
|
246
245
|
}, J(i)), null, 16)) : (n(), w(I, { key: 1 }, [
|
|
247
|
-
|
|
246
|
+
H(D(t.label), 1)
|
|
248
247
|
], 64))
|
|
249
248
|
], !0)
|
|
250
249
|
]),
|
|
@@ -255,7 +254,7 @@ const Le = { class: "dc-table-main table-main" }, Oe = { class: "table-main-pagi
|
|
|
255
254
|
_: 3
|
|
256
255
|
}, 16, ["maxHeight", "data", "rowKey"])),
|
|
257
256
|
Ie(Pe("div", Oe, [
|
|
258
|
-
|
|
257
|
+
q(x(Ae), {
|
|
259
258
|
"current-page": l.value,
|
|
260
259
|
"onUpdate:currentPage": a[3] || (a[3] = (t) => l.value = t),
|
|
261
260
|
"page-size": s.value,
|
package/es/hooks/activated.mjs
CHANGED
|
@@ -1,48 +1,40 @@
|
|
|
1
|
-
import { ref as n, computed as
|
|
2
|
-
const s = (
|
|
3
|
-
const
|
|
1
|
+
import { ref as n, computed as o, readonly as r, onMounted as u, onActivated as A, onDeactivated as g, onBeforeUnmount as m, watch as v } from "vue";
|
|
2
|
+
const s = (t) => {
|
|
3
|
+
const e = n({
|
|
4
4
|
isActivated: !1,
|
|
5
5
|
triggerType: "mounted"
|
|
6
|
-
}), i =
|
|
7
|
-
|
|
6
|
+
}), i = o(() => e.value.isActivated), a = o(() => r(e.value)), d = (c) => {
|
|
7
|
+
e.value = c, t == null || t(c);
|
|
8
8
|
};
|
|
9
9
|
return u(() => {
|
|
10
10
|
d({ isActivated: !0, triggerType: "mounted" }), A(() => {
|
|
11
11
|
d({ isActivated: !0, triggerType: "activated" });
|
|
12
12
|
});
|
|
13
|
-
}),
|
|
13
|
+
}), g(() => {
|
|
14
14
|
d({ isActivated: !1, triggerType: "deactivated" });
|
|
15
|
-
}),
|
|
15
|
+
}), m(() => {
|
|
16
16
|
d({ isActivated: !1, triggerType: "unmounted" });
|
|
17
|
-
}),
|
|
18
|
-
t,
|
|
19
|
-
(c) => {
|
|
20
|
-
e == null || e(c);
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
immediate: !0
|
|
24
|
-
}
|
|
25
|
-
), {
|
|
17
|
+
}), {
|
|
26
18
|
isActivated: i,
|
|
27
19
|
activatedInfo: a
|
|
28
20
|
};
|
|
29
|
-
}, l = (
|
|
30
|
-
const { activatedInfo:
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
}, l = (t) => {
|
|
22
|
+
const { activatedInfo: e } = s();
|
|
23
|
+
v(
|
|
24
|
+
e,
|
|
33
25
|
(i) => {
|
|
34
|
-
i.isActivated &&
|
|
26
|
+
i.isActivated && t(i);
|
|
35
27
|
},
|
|
36
28
|
{
|
|
37
29
|
immediate: !0
|
|
38
30
|
}
|
|
39
31
|
);
|
|
40
|
-
}, p = (
|
|
32
|
+
}, p = (t, e) => {
|
|
41
33
|
const { activatedInfo: i } = s();
|
|
42
|
-
|
|
34
|
+
v(
|
|
43
35
|
i,
|
|
44
36
|
(a) => {
|
|
45
|
-
a.isActivated ?
|
|
37
|
+
a.isActivated ? t(a) : e(a);
|
|
46
38
|
},
|
|
47
39
|
{
|
|
48
40
|
immediate: !0
|