@done-coding/admin-core 0.3.0 → 0.3.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/bridge/index.mjs +24 -40
- package/es/components/display/HeightProvider.vue.mjs +26 -26
- package/es/components/display/TabsHeader.vue.mjs +7 -0
- package/es/components/display/TabsHeader.vue2.mjs +76 -0
- package/es/components/display/TabsMain.vue.mjs +100 -5
- package/es/components/display/TabsMain.vue2.mjs +2 -95
- package/es/components/display/TabsNaturalFlow.vue.mjs +17 -0
- package/es/components/display/TabsNaturalFlow.vue2.mjs +4 -0
- package/es/components/display/TabsRefineFlow.vue.mjs +62 -0
- package/es/components/display/TabsRefineFlow.vue2.mjs +4 -0
- package/es/components/display/index.mjs +11 -11
- package/es/components/form/FormSearch.vue.mjs +2 -2
- package/es/components/form/FormSearch.vue2.mjs +107 -63
- package/es/components/form/form-search-utils.mjs +25 -0
- package/es/components/list-page/ListPage.vue.mjs +2 -2
- package/es/components/list-page/ListPage.vue2.mjs +82 -76
- package/es/components/table/TableMain.vue.mjs +3 -3
- package/es/components/table/TableMain.vue2.mjs +103 -102
- package/es/hooks/use-breakpoint.mjs +40 -0
- package/es/hooks/use-channel-viewport-height.mjs +18 -0
- package/es/index.mjs +88 -84
- package/es/inject/key.mjs +7 -6
- package/es/style.css +1 -1
- package/package.json +3 -2
- package/types/bridge/index.d.ts +23 -23
- package/types/components/display/HeightProvider.vue.d.ts +10 -6
- package/types/components/display/TabsHeader.vue.d.ts +42 -0
- package/types/components/display/TabsMain.vue.d.ts +49 -7
- package/types/components/display/TabsNaturalFlow.vue.d.ts +16 -0
- package/types/components/display/TabsRefineFlow.vue.d.ts +53 -0
- package/types/components/display/index.d.ts +6 -12
- package/types/components/display/types.d.ts +46 -31
- package/types/components/form/form-search-utils.d.ts +24 -0
- package/types/components/form/types.d.ts +7 -1
- package/types/components/list-page/types.d.ts +1 -1
- package/types/components/misc/index.d.ts +10 -1
- package/types/components/modal/ConfirmModal.vue.d.ts +2 -2
- package/types/components/table/TableToolbar.vue.d.ts +8 -8
- package/types/components/table/types.d.ts +4 -0
- package/types/hooks/index.d.ts +2 -0
- package/types/hooks/use-breakpoint.d.ts +4 -0
- package/types/hooks/use-channel-viewport-height.d.ts +28 -0
- package/types/inject/key.d.ts +11 -11
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ElTable as he, ElTableColumn as
|
|
1
|
+
import { ElTable as he, ElTableColumn as ve, ElEmpty as ye, ElPagination as Ce } from "element-plus/es";
|
|
2
2
|
import "element-plus/es/components/base/style/css";
|
|
3
3
|
import "element-plus/es/components/pagination/style/css";
|
|
4
4
|
import "element-plus/es/components/table/style/css";
|
|
5
5
|
import "element-plus/es/components/empty/style/css";
|
|
6
6
|
import "element-plus/es/components/table-column/style/css";
|
|
7
|
-
import { defineComponent as Se, useCssVars as be, useModel as we, useAttrs as xe, ref as
|
|
8
|
-
import
|
|
7
|
+
import { defineComponent as Se, useCssVars as be, useModel as we, useAttrs as xe, ref as c, computed as g, shallowRef as Y, onMounted as Ee, onActivated as Pe, watch as m, openBlock as i, createElementBlock as b, createBlock as p, unref as r, withCtx as h, createVNode as F, mergeProps as d, createCommentVNode as ke, Fragment as k, renderList as He, createSlots as Te, renderSlot as V, resolveDynamicComponent as G, createTextVNode as I, toDisplayString as U, normalizeProps as ze, guardReactiveProps as Re, withDirectives as Ve, createElementVNode as Ie, isRef as Z, vShow as _e, mergeModels as Q } from "vue";
|
|
8
|
+
import W from "lodash/cloneDeep";
|
|
9
9
|
import X from "lodash/omit";
|
|
10
10
|
import ee from "lodash/set";
|
|
11
11
|
import te from "lodash/get";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { pickExportColumns as
|
|
16
|
-
import {
|
|
12
|
+
import Ae from "./TableToolbar.vue.mjs";
|
|
13
|
+
import Le from "../display/WatchSize.vue.mjs";
|
|
14
|
+
import Ke from "../data-view/DataListView.vue.mjs";
|
|
15
|
+
import { pickExportColumns as Ne } from "../../utils/export.mjs";
|
|
16
|
+
import { useChannelViewportHeight as Me } from "../../hooks/use-channel-viewport-height.mjs";
|
|
17
17
|
import { APP_API_LIST_MODEL_KEY_CONFIG as H } from "../../config/list-model.mjs";
|
|
18
|
-
const
|
|
18
|
+
const Oe = { class: "table-main" }, Be = { class: "table-main-pagination" }, nt = /* @__PURE__ */ Se({
|
|
19
19
|
__name: "TableMain",
|
|
20
|
-
props: /* @__PURE__ */
|
|
20
|
+
props: /* @__PURE__ */ Q({
|
|
21
21
|
showPager: { type: Boolean, default: !0 },
|
|
22
22
|
customView: { type: Boolean, default: !1 },
|
|
23
23
|
showToolbar: { type: Boolean, default: !0 },
|
|
@@ -35,53 +35,54 @@ const Be = { class: "table-main" }, je = { class: "table-main-pagination" }, rt
|
|
|
35
35
|
refine: { type: Boolean, default: !0 },
|
|
36
36
|
refineReduceHeight: { default: 0 },
|
|
37
37
|
injectInfo: {},
|
|
38
|
-
dataViewMaxHeightMinValue: { default: 500 }
|
|
38
|
+
dataViewMaxHeightMinValue: { default: 500 },
|
|
39
|
+
viewportHeight: {},
|
|
40
|
+
parentChannel: {}
|
|
39
41
|
}, {
|
|
40
42
|
isAutoRefresh: { type: Boolean },
|
|
41
43
|
isAutoRefreshModifiers: {}
|
|
42
44
|
}),
|
|
43
|
-
emits: /* @__PURE__ */
|
|
45
|
+
emits: /* @__PURE__ */ Q(["pageChange", "pageSizeChange", "dataChange", "loadingChange", "pageInfoChange"], ["update:isAutoRefresh"]),
|
|
44
46
|
setup(l, { expose: ae, emit: oe }) {
|
|
45
47
|
be((e) => ({
|
|
46
|
-
|
|
48
|
+
v028010cb: e.headerColor
|
|
47
49
|
}));
|
|
48
|
-
const o = l,
|
|
49
|
-
columns:
|
|
50
|
-
selectedList:
|
|
51
|
-
currentPageList:
|
|
50
|
+
const o = l, v = oe, _ = we(l, "isAutoRefresh"), ne = xe(), y = c([]), w = c(0), u = c(0), s = c(1), C = c(!1), T = c(!1), z = c([]), re = g(() => ({
|
|
51
|
+
columns: Ne(o.columns),
|
|
52
|
+
selectedList: z.value,
|
|
53
|
+
currentPageList: y.value,
|
|
52
54
|
api: o.api,
|
|
53
55
|
query: o.query || {},
|
|
54
56
|
total: w.value,
|
|
55
57
|
hasSelection: o.columns.some((e) => e.type === "selection")
|
|
56
|
-
})),
|
|
57
|
-
|
|
58
|
-
},
|
|
58
|
+
})), A = c(0), le = (e) => {
|
|
59
|
+
A.value = e;
|
|
60
|
+
}, R = Y(), L = Y(), ie = g(
|
|
59
61
|
() => o.columns.some((e) => e.type === "selection")
|
|
60
62
|
), se = (e) => {
|
|
61
63
|
var t, n;
|
|
62
|
-
|
|
63
|
-
}, ue =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
), K = g(() => {
|
|
64
|
+
z.value = e, (n = (t = o.tableProps) == null ? void 0 : t.onSelectionChange) == null || n.call(t, e);
|
|
65
|
+
}, { viewportHeightFinal: ue } = Me(o, {
|
|
66
|
+
fallback: 500
|
|
67
|
+
}), K = g(() => o.showPager ? 35 : 0), N = g(
|
|
68
|
+
() => o.showToolbar ? A.value : 0
|
|
69
|
+
), M = g(() => {
|
|
69
70
|
const { maxHeight: e, refine: t, dataViewMaxHeightMinValue: n } = o;
|
|
70
71
|
return e ? Math.max(
|
|
71
|
-
e -
|
|
72
|
+
e - K.value - N.value,
|
|
72
73
|
n
|
|
73
74
|
) : t ? Math.max(
|
|
74
|
-
ue.value -
|
|
75
|
+
ue.value - K.value - N.value - o.refineReduceHeight,
|
|
75
76
|
n
|
|
76
77
|
) : void 0;
|
|
77
78
|
}), x = g(() => {
|
|
78
|
-
const e =
|
|
79
|
+
const e = W(o.query || {});
|
|
79
80
|
return ee(e, H.PAGE_SIZE_KEY, u.value), ee(
|
|
80
81
|
e,
|
|
81
82
|
H.CURRENT_PAGE_KEY,
|
|
82
83
|
s.value
|
|
83
84
|
), e;
|
|
84
|
-
}),
|
|
85
|
+
}), ce = g(() => {
|
|
85
86
|
var t;
|
|
86
87
|
const e = (t = o.tableProps) == null ? void 0 : t.onSelectionChange;
|
|
87
88
|
return {
|
|
@@ -89,10 +90,10 @@ const Be = { class: "table-main" }, je = { class: "table-main-pagination" }, rt
|
|
|
89
90
|
...ne,
|
|
90
91
|
/** 合并内部选中存储与外部 onSelectionChange */
|
|
91
92
|
onSelectionChange: (n) => {
|
|
92
|
-
|
|
93
|
+
z.value = n, e == null || e(n);
|
|
93
94
|
}
|
|
94
95
|
};
|
|
95
|
-
}),
|
|
96
|
+
}), O = (e, t = !0) => {
|
|
96
97
|
const n = JSON.stringify(e) === JSON.stringify(x.value);
|
|
97
98
|
return !n && t && console.warn(
|
|
98
99
|
`同一地方 并发请求 参数冰花 当前不是最新的参数 丢弃结果 ${JSON.stringify(
|
|
@@ -102,54 +103,54 @@ const Be = { class: "table-main" }, je = { class: "table-main-pagination" }, rt
|
|
|
102
103
|
}, B = (e = !1) => {
|
|
103
104
|
var n, E;
|
|
104
105
|
if (!u.value) return;
|
|
105
|
-
C.value ? console.warn("请求并发") : C.value = !0, e || (
|
|
106
|
-
const t =
|
|
106
|
+
C.value ? console.warn("请求并发") : C.value = !0, e || (T.value = !0), o.customView ? (n = L.value) == null || n.clearSelection() : (E = R.value) == null || E.clearSelection();
|
|
107
|
+
const t = W(x.value);
|
|
107
108
|
return o.api(t).then((P) => {
|
|
108
|
-
|
|
109
|
+
O(t, !1) && (y.value = te(
|
|
109
110
|
P,
|
|
110
111
|
H.LIST_KEY
|
|
111
112
|
), w.value = te(
|
|
112
113
|
P,
|
|
113
114
|
H.TOTAL_KEY
|
|
114
|
-
),
|
|
115
|
+
), v("pageInfoChange", {
|
|
115
116
|
pageSize: u.value,
|
|
116
117
|
currentPage: s.value,
|
|
117
118
|
total: w.value
|
|
118
119
|
}));
|
|
119
120
|
}).finally(() => {
|
|
120
|
-
|
|
121
|
+
O(t) && (C.value = !1, T.value = !1);
|
|
121
122
|
});
|
|
122
|
-
},
|
|
123
|
+
}, $ = async (e = !1) => {
|
|
123
124
|
var t;
|
|
124
125
|
return (t = B(e)) == null ? void 0 : t.catch(() => {
|
|
125
126
|
});
|
|
126
|
-
},
|
|
127
|
+
}, fe = async (e = !1) => {
|
|
127
128
|
if (s.value === 1)
|
|
128
|
-
return
|
|
129
|
+
return $(e);
|
|
129
130
|
s.value = 1;
|
|
130
|
-
},
|
|
131
|
-
refresh:
|
|
132
|
-
reload:
|
|
133
|
-
getTableInstance: () =>
|
|
131
|
+
}, j = (e) => e, ge = (e) => e, pe = (e) => e, S = {
|
|
132
|
+
refresh: $,
|
|
133
|
+
reload: fe,
|
|
134
|
+
getTableInstance: () => R.value
|
|
134
135
|
}, J = (e, t = []) => ({
|
|
135
136
|
...X(e, ["render", "headerRender"].concat(t)),
|
|
136
137
|
injectInfo: o.injectInfo || {},
|
|
137
138
|
exposeInfo: S
|
|
138
|
-
}),
|
|
139
|
+
}), q = (e) => ({
|
|
139
140
|
...X(e, ["render", "headerRender"]),
|
|
140
141
|
injectInfo: o.injectInfo || {},
|
|
141
142
|
exposeInfo: S
|
|
142
143
|
});
|
|
143
144
|
ae(S);
|
|
144
|
-
const
|
|
145
|
+
const de = (e) => {
|
|
145
146
|
u.value = e, s.value = 1;
|
|
146
|
-
},
|
|
147
|
-
return
|
|
148
|
-
u.value = o.pageSizeInit,
|
|
147
|
+
}, D = (e) => !e || e === "expand";
|
|
148
|
+
return Ee(() => {
|
|
149
|
+
u.value = o.pageSizeInit, Pe(() => {
|
|
149
150
|
S.refresh();
|
|
150
151
|
});
|
|
151
|
-
}), m(
|
|
152
|
-
|
|
152
|
+
}), m(y, (e) => {
|
|
153
|
+
v("dataChange", e);
|
|
153
154
|
}), m(
|
|
154
155
|
() => o.query,
|
|
155
156
|
(e, t) => {
|
|
@@ -163,23 +164,23 @@ const Be = { class: "table-main" }, je = { class: "table-main-pagination" }, rt
|
|
|
163
164
|
{
|
|
164
165
|
immediate: !0
|
|
165
166
|
}
|
|
166
|
-
), m(
|
|
167
|
-
|
|
167
|
+
), m(T, (e) => {
|
|
168
|
+
v("loadingChange", e);
|
|
168
169
|
}), m(u, (e) => {
|
|
169
|
-
|
|
170
|
+
v("pageSizeChange", e);
|
|
170
171
|
}), m(s, (e) => {
|
|
171
|
-
|
|
172
|
+
v("pageChange", e);
|
|
172
173
|
}), (e, t) => {
|
|
173
|
-
const n =
|
|
174
|
-
return i(), b("div",
|
|
175
|
-
l.showToolbar ? (i(),
|
|
174
|
+
const n = ve, E = ye, P = he, me = Ce;
|
|
175
|
+
return i(), b("div", Oe, [
|
|
176
|
+
l.showToolbar ? (i(), p(r(Le), {
|
|
176
177
|
key: 0,
|
|
177
178
|
onHeightChange: le
|
|
178
179
|
}, {
|
|
179
180
|
default: h(() => [
|
|
180
|
-
|
|
181
|
-
"is-auto-refresh":
|
|
182
|
-
"onUpdate:isAutoRefresh": t[0] || (t[0] = (a) =>
|
|
181
|
+
F(Ae, d({
|
|
182
|
+
"is-auto-refresh": _.value,
|
|
183
|
+
"onUpdate:isAutoRefresh": t[0] || (t[0] = (a) => _.value = a),
|
|
183
184
|
tableExpose: S,
|
|
184
185
|
loading: r(C),
|
|
185
186
|
exportContext: r(re),
|
|
@@ -188,69 +189,69 @@ const Be = { class: "table-main" }, je = { class: "table-main-pagination" }, rt
|
|
|
188
189
|
}, l.toolbar), null, 16, ["is-auto-refresh", "loading", "exportContext", "currentPage", "pageSize"])
|
|
189
190
|
]),
|
|
190
191
|
_: 1
|
|
191
|
-
})) :
|
|
192
|
-
l.customView ? (i(),
|
|
192
|
+
})) : ke("", !0),
|
|
193
|
+
l.customView ? (i(), p(r(Ke), {
|
|
193
194
|
key: 2,
|
|
194
195
|
ref_key: "dataListView",
|
|
195
|
-
ref:
|
|
196
|
-
data: ge(r(
|
|
197
|
-
columns:
|
|
198
|
-
rowKey:
|
|
199
|
-
maxHeight: r(
|
|
196
|
+
ref: L,
|
|
197
|
+
data: ge(r(y)),
|
|
198
|
+
columns: pe(l.columns),
|
|
199
|
+
rowKey: j(l.rowKey),
|
|
200
|
+
maxHeight: r(M),
|
|
200
201
|
selectable: r(ie),
|
|
201
202
|
onSelectionChange: se
|
|
202
203
|
}, {
|
|
203
204
|
item: h((a) => [
|
|
204
|
-
|
|
205
|
+
V(e.$slots, "custom-view-item", ze(Re(a)), void 0, !0)
|
|
205
206
|
]),
|
|
206
207
|
_: 3
|
|
207
|
-
}, 8, ["data", "columns", "rowKey", "maxHeight", "selectable"])) : (i(),
|
|
208
|
+
}, 8, ["data", "columns", "rowKey", "maxHeight", "selectable"])) : (i(), p(P, d({
|
|
208
209
|
key: 1,
|
|
209
210
|
ref_key: "elTable",
|
|
210
|
-
ref:
|
|
211
|
+
ref: R,
|
|
211
212
|
class: "table-main-table",
|
|
212
213
|
stripe: "",
|
|
213
214
|
border: "",
|
|
214
215
|
highlightCurrentRow: ""
|
|
215
|
-
}, r(
|
|
216
|
-
maxHeight: r(
|
|
217
|
-
data: r(
|
|
218
|
-
rowKey:
|
|
216
|
+
}, r(ce), {
|
|
217
|
+
maxHeight: r(M),
|
|
218
|
+
data: r(y),
|
|
219
|
+
rowKey: j(l.rowKey)
|
|
219
220
|
}), {
|
|
220
221
|
empty: h(() => [
|
|
221
|
-
r(C) ? (i(), b(
|
|
222
|
-
|
|
223
|
-
], 64)) : (i(),
|
|
222
|
+
r(C) ? (i(), b(k, { key: 0 }, [
|
|
223
|
+
I("加载中...")
|
|
224
|
+
], 64)) : (i(), p(E, { key: 1 }))
|
|
224
225
|
]),
|
|
225
226
|
default: h(() => [
|
|
226
|
-
(i(!0), b(
|
|
227
|
+
(i(!0), b(k, null, He(l.columns, (a) => (i(), p(n, d({
|
|
227
228
|
key: a.columnKey || a.prop
|
|
228
|
-
}, { ref_for: !0 }, a),
|
|
229
|
-
|
|
229
|
+
}, { ref_for: !0 }, a), Te({ _: 2 }, [
|
|
230
|
+
D(a.type) ? {
|
|
230
231
|
name: "default",
|
|
231
|
-
fn: h((
|
|
232
|
-
|
|
233
|
-
a.render ? (i(),
|
|
232
|
+
fn: h((f) => [
|
|
233
|
+
V(e.$slots, a.prop, d({ ref_for: !0 }, J(f)), () => [
|
|
234
|
+
a.render ? (i(), p(G(a.render), d({
|
|
234
235
|
key: 0,
|
|
235
236
|
ref_for: !0
|
|
236
|
-
}, J(
|
|
237
|
-
_index:
|
|
238
|
-
}), null, 16, ["_index"])) : (i(), b(
|
|
239
|
-
|
|
237
|
+
}, J(f, ["$index"]), {
|
|
238
|
+
_index: f.$index
|
|
239
|
+
}), null, 16, ["_index"])) : (i(), b(k, { key: 1 }, [
|
|
240
|
+
I(U(f.row[a.prop]), 1)
|
|
240
241
|
], 64))
|
|
241
242
|
], !0)
|
|
242
243
|
]),
|
|
243
244
|
key: "0"
|
|
244
245
|
} : void 0,
|
|
245
|
-
|
|
246
|
+
D(a.type) ? {
|
|
246
247
|
name: "header",
|
|
247
|
-
fn: h((
|
|
248
|
-
|
|
249
|
-
a.headerRender ? (i(),
|
|
248
|
+
fn: h((f) => [
|
|
249
|
+
V(e.$slots, `header-${a.prop}`, d({ ref_for: !0 }, q(f)), () => [
|
|
250
|
+
a.headerRender ? (i(), p(G(a.headerRender), d({
|
|
250
251
|
key: 0,
|
|
251
252
|
ref_for: !0
|
|
252
|
-
},
|
|
253
|
-
|
|
253
|
+
}, q(f)), null, 16)) : (i(), b(k, { key: 1 }, [
|
|
254
|
+
I(U(a.label), 1)
|
|
254
255
|
], 64))
|
|
255
256
|
], !0)
|
|
256
257
|
]),
|
|
@@ -260,26 +261,26 @@ const Be = { class: "table-main" }, je = { class: "table-main-pagination" }, rt
|
|
|
260
261
|
]),
|
|
261
262
|
_: 3
|
|
262
263
|
}, 16, ["maxHeight", "data", "rowKey"])),
|
|
263
|
-
|
|
264
|
-
|
|
264
|
+
Ve(Ie("div", Be, [
|
|
265
|
+
F(me, {
|
|
265
266
|
"current-page": r(s),
|
|
266
|
-
"onUpdate:currentPage": t[1] || (t[1] = (a) =>
|
|
267
|
+
"onUpdate:currentPage": t[1] || (t[1] = (a) => Z(s) ? s.value = a : null),
|
|
267
268
|
"page-size": r(u),
|
|
268
|
-
"onUpdate:pageSize": t[2] || (t[2] = (a) =>
|
|
269
|
+
"onUpdate:pageSize": t[2] || (t[2] = (a) => Z(u) ? u.value = a : null),
|
|
269
270
|
"page-sizes": l.pageSizeOptions,
|
|
270
271
|
size: "small",
|
|
271
272
|
background: "",
|
|
272
273
|
layout: l.pageLayout,
|
|
273
274
|
total: r(w),
|
|
274
|
-
onSizeChange:
|
|
275
|
+
onSizeChange: de
|
|
275
276
|
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])
|
|
276
277
|
], 512), [
|
|
277
|
-
[
|
|
278
|
+
[_e, l.showPager]
|
|
278
279
|
])
|
|
279
280
|
]);
|
|
280
281
|
};
|
|
281
282
|
}
|
|
282
283
|
});
|
|
283
284
|
export {
|
|
284
|
-
|
|
285
|
+
nt as default
|
|
285
286
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ref as s, watch as a, readonly as m } from "vue";
|
|
2
|
+
import { useActivated as c } from "./activated.mjs";
|
|
3
|
+
const i = [], d = ["xl", "lg", "md", "sm"], f = () => {
|
|
4
|
+
if (i.length || typeof window > "u" || typeof window.matchMedia != "function")
|
|
5
|
+
return;
|
|
6
|
+
const e = {
|
|
7
|
+
xl: "(min-width: 1920px)",
|
|
8
|
+
lg: "(min-width: 1200px)",
|
|
9
|
+
md: "(min-width: 992px)",
|
|
10
|
+
sm: "(min-width: 768px)",
|
|
11
|
+
xs: "(max-width: 767px)"
|
|
12
|
+
};
|
|
13
|
+
for (const t of d)
|
|
14
|
+
i.push({ key: t, mql: window.matchMedia(e[t]) });
|
|
15
|
+
}, u = () => {
|
|
16
|
+
const e = s("lg"), t = () => {
|
|
17
|
+
for (const { key: o, mql: n } of i)
|
|
18
|
+
if (n.matches) {
|
|
19
|
+
e.value = o;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
e.value = "xs";
|
|
23
|
+
}, { isActivated: r } = c();
|
|
24
|
+
return a(
|
|
25
|
+
r,
|
|
26
|
+
(o) => {
|
|
27
|
+
if (o) {
|
|
28
|
+
f(), t();
|
|
29
|
+
for (const { mql: n } of i)
|
|
30
|
+
n.addEventListener("change", t);
|
|
31
|
+
} else
|
|
32
|
+
for (const { mql: n } of i)
|
|
33
|
+
n.removeEventListener("change", t);
|
|
34
|
+
},
|
|
35
|
+
{ immediate: !0 }
|
|
36
|
+
), { activeBreakpoint: m(e) };
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
u as useBreakpoint
|
|
40
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { inject as i, computed as o, watch as v } from "vue";
|
|
2
|
+
import { BODY_CONTENT_VIEWPORT_HEIGHT as p } from "../inject/key.mjs";
|
|
3
|
+
const f = (e, l = {}) => {
|
|
4
|
+
const h = l.fallback ?? 0, n = e.parentChannel ? Symbol.for(e.parentChannel) : void 0, t = n ? i(n, void 0) : void 0, r = i(
|
|
5
|
+
p,
|
|
6
|
+
void 0
|
|
7
|
+
), a = o(() => t ? t.viewportHeight.value : e.viewportHeight !== void 0 ? e.viewportHeight : r ? r.value : h), c = o(() => (t == null ? void 0 : t.level) ?? 0);
|
|
8
|
+
return v(
|
|
9
|
+
// eslint-disable-next-line vue/no-setup-props-destructure
|
|
10
|
+
() => e.parentChannel,
|
|
11
|
+
() => console.error(
|
|
12
|
+
"[useChannelViewportHeight] parentChannel 不支持响应式变更,当前值已忽略。"
|
|
13
|
+
)
|
|
14
|
+
), { viewportHeightFinal: a, parentLevel: c };
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
f as useChannelViewportHeight
|
|
18
|
+
};
|