@done-coding/admin-core 0.10.1-alpha.0 → 0.12.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 +51 -45
- package/es/bridge/theme/index.mjs +88 -74
- package/es/components/app-layout/AppLayout.vue.mjs +2 -2
- package/es/components/app-layout/AppLayout.vue2.mjs +49 -45
- package/es/components/app-layout/AppTheme.vue.mjs +3 -3
- package/es/components/app-layout/AppTheme.vue2.mjs +15 -15
- package/es/components/display/ActionBtn.vue.mjs +22 -19
- package/es/components/display/TabsMain.vue.mjs +5 -5
- package/es/components/form/FormMain.vue.mjs +1 -1
- package/es/components/form/FormMain.vue2.mjs +1 -0
- package/es/components/list-page/ListPage.vue.mjs +2 -2
- package/es/components/list-page/ListPage.vue2.mjs +2 -2
- package/es/components/menu/MenuItemSub.vue.mjs +10 -9
- package/es/components/menu/MenuTree.vue.mjs +1 -0
- package/es/components/modal/ConfirmModal.vue.mjs +3 -3
- package/es/components/modal/ConfirmModal.vue2.mjs +15 -15
- package/es/components/modal/DetailModal.vue.mjs +18 -17
- package/es/components/panel/PanelMain.vue.mjs +2 -2
- package/es/components/panel/PanelMain.vue2.mjs +21 -18
- package/es/components/table/TableMain.vue.mjs +2 -2
- package/es/components/table/TableMain.vue2.mjs +48 -48
- package/es/hooks/use-admin-theme-apply.mjs +167 -39
- package/es/index.mjs +87 -85
- package/es/style.css +1 -1
- package/es/utils/theme-scale.mjs +29 -23
- package/package.json +6 -4
- package/types/bridge/index.d.ts +26 -2
- package/types/bridge/theme/index.d.ts +1 -1
- package/types/bridge/theme/types.d.ts +78 -0
- package/types/components/app-layout/AppLayout.vue.d.ts +1 -1
- package/types/components/app-layout/types.d.ts +1 -1
- package/types/hooks/use-admin-theme-apply.d.ts +18 -1
- package/types/utils/theme-scale.d.ts +8 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as pe, useModel as z, useAttrs as
|
|
1
|
+
import { defineComponent as pe, useModel as z, useAttrs as me, ref as u, computed as f, markRaw as q, 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 D, mergeProps as c, createCommentVNode as ye, resolveDynamicComponent as E, Fragment as I, renderList as Se, createSlots as be, renderSlot as T, createTextVNode as k, toDisplayString as F, normalizeProps as Ce, guardReactiveProps as xe, withDirectives as Ie, createElementVNode as Pe, vShow as Ve, mergeModels as Y } from "vue";
|
|
2
2
|
import G from "lodash/cloneDeep";
|
|
3
3
|
import _ from "lodash/omit";
|
|
4
4
|
import Z from "lodash/set";
|
|
@@ -10,7 +10,7 @@ import { ElTable as Te, ElTableColumn as ke, ElEmpty as He, ElPagination as Ae }
|
|
|
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: "table-main" }, Oe = { class: "table-main-pagination" }, Ze = /* @__PURE__ */ pe({
|
|
13
|
+
const Le = { class: "dc-table-main table-main" }, Oe = { class: "table-main-pagination" }, Ze = /* @__PURE__ */ pe({
|
|
14
14
|
__name: "TableMain",
|
|
15
15
|
props: /* @__PURE__ */ Y({
|
|
16
16
|
showPager: { type: Boolean, default: !0 },
|
|
@@ -43,21 +43,21 @@ const Le = { class: "table-main" }, Oe = { class: "table-main-pagination" }, Ze
|
|
|
43
43
|
}),
|
|
44
44
|
emits: /* @__PURE__ */ Y(["pageChange", "pageSizeChange", "dataChange", "loadingChange", "pageInfoChange"], ["update:isAutoRefresh", "update:refreshInterval", "update:customView"]),
|
|
45
45
|
setup(o, { expose: W, emit: X }) {
|
|
46
|
-
const r = o,
|
|
46
|
+
const r = o, v = X, H = 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,
|
|
50
50
|
currentPageList: S.value,
|
|
51
51
|
api: r.api,
|
|
52
52
|
query: r.query,
|
|
53
|
-
total:
|
|
53
|
+
total: b.value,
|
|
54
54
|
hasSelection: r.columns.some((e) => e.type === "selection")
|
|
55
55
|
})
|
|
56
56
|
), N = u(0), ae = (e) => {
|
|
57
57
|
N.value = e;
|
|
58
58
|
}, re = f(
|
|
59
59
|
() => y.value ? q(Ee) : q(Te)
|
|
60
|
-
), R =
|
|
60
|
+
), R = ve(), oe = f(
|
|
61
61
|
() => r.columns.some((e) => e.type === "selection")
|
|
62
62
|
), { viewportHeightFinal: ne } = Ne(r, {
|
|
63
63
|
fallback: 500
|
|
@@ -72,52 +72,52 @@ const Le = { class: "table-main" }, Oe = { class: "table-main-pagination" }, Ze
|
|
|
72
72
|
ne.value - L.value - O.value - r.refineReduceHeight,
|
|
73
73
|
t
|
|
74
74
|
) : void 0;
|
|
75
|
-
}),
|
|
75
|
+
}), C = f(() => {
|
|
76
76
|
const e = G(r.query || {});
|
|
77
|
-
return Z(e, P.PAGE_SIZE_KEY,
|
|
77
|
+
return Z(e, P.PAGE_SIZE_KEY, s.value), Z(
|
|
78
78
|
e,
|
|
79
79
|
P.CURRENT_PAGE_KEY,
|
|
80
80
|
l.value
|
|
81
81
|
), e;
|
|
82
|
-
}),
|
|
82
|
+
}), ie = () => ({
|
|
83
83
|
injectInfo: r.injectInfo,
|
|
84
84
|
exposeInfo: g
|
|
85
|
-
}),
|
|
85
|
+
}), se = f(() => ({
|
|
86
86
|
...r.tableProps,
|
|
87
87
|
...ee,
|
|
88
88
|
// customView 下,需要手动处理 selectable
|
|
89
89
|
...y.value ? {
|
|
90
90
|
selectable: oe.value,
|
|
91
91
|
columns: r.columns,
|
|
92
|
-
getRenderCtxParams:
|
|
92
|
+
getRenderCtxParams: ie
|
|
93
93
|
} : {}
|
|
94
94
|
})), ue = (e) => {
|
|
95
95
|
var t;
|
|
96
96
|
const a = (t = r.tableProps) == null ? void 0 : t.onSelectionChange;
|
|
97
97
|
M.value = e, a == null || a(e);
|
|
98
98
|
}, K = (e, a = !0) => {
|
|
99
|
-
const t = JSON.stringify(e) === JSON.stringify(
|
|
99
|
+
const t = JSON.stringify(e) === JSON.stringify(C.value);
|
|
100
100
|
return !t && a && console.warn(
|
|
101
101
|
`同一地方 并发请求 参数冰花 当前不是最新的参数 丢弃结果 ${JSON.stringify(
|
|
102
102
|
e
|
|
103
|
-
)} => ${JSON.stringify(
|
|
103
|
+
)} => ${JSON.stringify(C.value)}`
|
|
104
104
|
), t;
|
|
105
105
|
}, j = (e = !1) => {
|
|
106
106
|
var t;
|
|
107
|
-
if (!
|
|
107
|
+
if (!s.value) return;
|
|
108
108
|
h.value ? console.warn("请求并发") : h.value = !0, e || (V.value = !0), (t = R.value) == null || t.clearSelection();
|
|
109
|
-
const a = G(
|
|
110
|
-
return r.api(a).then((
|
|
109
|
+
const a = G(C.value);
|
|
110
|
+
return r.api(a).then((i) => {
|
|
111
111
|
K(a, !1) && (S.value = Q(
|
|
112
|
-
|
|
112
|
+
i,
|
|
113
113
|
P.LIST_KEY
|
|
114
|
-
),
|
|
115
|
-
|
|
114
|
+
), b.value = Q(
|
|
115
|
+
i,
|
|
116
116
|
P.TOTAL_KEY
|
|
117
|
-
),
|
|
118
|
-
pageSize:
|
|
117
|
+
), v("pageInfoChange", {
|
|
118
|
+
pageSize: s.value,
|
|
119
119
|
currentPage: l.value,
|
|
120
|
-
total:
|
|
120
|
+
total: b.value
|
|
121
121
|
}));
|
|
122
122
|
}).finally(() => {
|
|
123
123
|
K(a) && (h.value = !1, V.value = !1);
|
|
@@ -145,21 +145,21 @@ const Le = { class: "table-main" }, Oe = { class: "table-main-pagination" }, Ze
|
|
|
145
145
|
}), ge = (e) => e;
|
|
146
146
|
W(g);
|
|
147
147
|
const de = (e) => {
|
|
148
|
-
|
|
148
|
+
s.value = e, l.value = 1;
|
|
149
149
|
}, U = (e) => !e || e === "expand";
|
|
150
150
|
return he(() => {
|
|
151
|
-
|
|
151
|
+
s.value = r.pageSizeInit, we(() => {
|
|
152
152
|
g.refresh();
|
|
153
153
|
});
|
|
154
154
|
}), d(S, (e) => {
|
|
155
|
-
|
|
155
|
+
v("dataChange", e);
|
|
156
156
|
}), d(
|
|
157
157
|
() => r.query,
|
|
158
158
|
(e, a) => {
|
|
159
159
|
JSON.stringify(e) !== JSON.stringify(a) && (l.value = 1);
|
|
160
160
|
}
|
|
161
161
|
), d(
|
|
162
|
-
|
|
162
|
+
C,
|
|
163
163
|
(e, a) => {
|
|
164
164
|
JSON.stringify(e) !== JSON.stringify(a) && j();
|
|
165
165
|
},
|
|
@@ -167,17 +167,17 @@ const Le = { class: "table-main" }, Oe = { class: "table-main-pagination" }, Ze
|
|
|
167
167
|
immediate: !0
|
|
168
168
|
}
|
|
169
169
|
), d(V, (e) => {
|
|
170
|
-
|
|
171
|
-
}), d(
|
|
172
|
-
|
|
170
|
+
v("loadingChange", e);
|
|
171
|
+
}), d(s, (e) => {
|
|
172
|
+
v("pageSizeChange", e);
|
|
173
173
|
}), d(l, (e) => {
|
|
174
|
-
|
|
174
|
+
v("pageChange", e);
|
|
175
175
|
}), (e, a) => (n(), w("div", Le, [
|
|
176
176
|
o.showToolbar ? (n(), p(x(ze), {
|
|
177
177
|
key: 0,
|
|
178
178
|
onHeightChange: ae
|
|
179
179
|
}, {
|
|
180
|
-
default:
|
|
180
|
+
default: m(() => [
|
|
181
181
|
D(Re, c({
|
|
182
182
|
"is-auto-refresh": H.value,
|
|
183
183
|
"onUpdate:isAutoRefresh": a[0] || (a[0] = (t) => H.value = t),
|
|
@@ -190,7 +190,7 @@ const Le = { class: "table-main" }, Oe = { class: "table-main-pagination" }, Ze
|
|
|
190
190
|
exportContext: te.value,
|
|
191
191
|
showSwitchView: o.showSwitchView,
|
|
192
192
|
currentPage: l.value,
|
|
193
|
-
pageSize:
|
|
193
|
+
pageSize: s.value
|
|
194
194
|
}, o.toolbar), null, 16, ["is-auto-refresh", "refresh-interval", "custom-view", "loading", "exportContext", "showSwitchView", "currentPage", "pageSize"])
|
|
195
195
|
]),
|
|
196
196
|
_: 1
|
|
@@ -202,35 +202,35 @@ const Le = { class: "table-main" }, Oe = { class: "table-main-pagination" }, Ze
|
|
|
202
202
|
stripe: "",
|
|
203
203
|
border: "",
|
|
204
204
|
highlightCurrentRow: ""
|
|
205
|
-
},
|
|
205
|
+
}, se.value, {
|
|
206
206
|
maxHeight: le.value,
|
|
207
207
|
data: S.value,
|
|
208
208
|
rowKey: ce(o.rowKey),
|
|
209
209
|
onSelectionChange: ue
|
|
210
210
|
}), {
|
|
211
|
-
item:
|
|
212
|
-
T(e.$slots, "custom-view-item",
|
|
211
|
+
item: m((t) => [
|
|
212
|
+
T(e.$slots, "custom-view-item", Ce(xe(ge(t))), void 0, !0)
|
|
213
213
|
]),
|
|
214
|
-
empty:
|
|
214
|
+
empty: m(() => [
|
|
215
215
|
h.value ? (n(), w(I, { key: 0 }, [
|
|
216
216
|
k("加载中...")
|
|
217
217
|
], 64)) : (n(), p(x(He), { key: 1 }))
|
|
218
218
|
]),
|
|
219
|
-
default:
|
|
219
|
+
default: m(() => [
|
|
220
220
|
(n(!0), w(I, null, Se(o.columns, (t) => (n(), p(x(ke), c({
|
|
221
221
|
key: t.columnKey || t.prop
|
|
222
|
-
}, { ref_for: !0 }, t),
|
|
222
|
+
}, { ref_for: !0 }, t), be({ _: 2 }, [
|
|
223
223
|
U(t.type) ? {
|
|
224
224
|
name: "default",
|
|
225
|
-
fn:
|
|
226
|
-
T(e.$slots, t.prop, c({ ref_for: !0 }, $(
|
|
225
|
+
fn: m((i) => [
|
|
226
|
+
T(e.$slots, t.prop, c({ ref_for: !0 }, $(i)), () => [
|
|
227
227
|
t.render ? (n(), p(E(t.render), c({
|
|
228
228
|
key: 0,
|
|
229
229
|
ref_for: !0
|
|
230
|
-
}, $(
|
|
231
|
-
_index:
|
|
230
|
+
}, $(i, ["$index"]), {
|
|
231
|
+
_index: i.$index
|
|
232
232
|
}), null, 16, ["_index"])) : (n(), w(I, { key: 1 }, [
|
|
233
|
-
k(F(
|
|
233
|
+
k(F(i.row[t.prop]), 1)
|
|
234
234
|
], 64))
|
|
235
235
|
], !0)
|
|
236
236
|
]),
|
|
@@ -238,12 +238,12 @@ const Le = { class: "table-main" }, Oe = { class: "table-main-pagination" }, Ze
|
|
|
238
238
|
} : void 0,
|
|
239
239
|
U(t.type) ? {
|
|
240
240
|
name: "header",
|
|
241
|
-
fn:
|
|
242
|
-
T(e.$slots, `header-${t.prop}`, c({ ref_for: !0 }, J(
|
|
241
|
+
fn: m((i) => [
|
|
242
|
+
T(e.$slots, `header-${t.prop}`, c({ ref_for: !0 }, J(i)), () => [
|
|
243
243
|
t.headerRender ? (n(), p(E(t.headerRender), c({
|
|
244
244
|
key: 0,
|
|
245
245
|
ref_for: !0
|
|
246
|
-
}, J(
|
|
246
|
+
}, J(i)), null, 16)) : (n(), w(I, { key: 1 }, [
|
|
247
247
|
k(F(t.label), 1)
|
|
248
248
|
], 64))
|
|
249
249
|
], !0)
|
|
@@ -258,13 +258,13 @@ const Le = { class: "table-main" }, Oe = { class: "table-main-pagination" }, Ze
|
|
|
258
258
|
D(x(Ae), {
|
|
259
259
|
"current-page": l.value,
|
|
260
260
|
"onUpdate:currentPage": a[3] || (a[3] = (t) => l.value = t),
|
|
261
|
-
"page-size":
|
|
262
|
-
"onUpdate:pageSize": a[4] || (a[4] = (t) =>
|
|
261
|
+
"page-size": s.value,
|
|
262
|
+
"onUpdate:pageSize": a[4] || (a[4] = (t) => s.value = t),
|
|
263
263
|
"page-sizes": o.pageSizeOptions,
|
|
264
264
|
size: "small",
|
|
265
265
|
background: "",
|
|
266
266
|
layout: o.pageLayout,
|
|
267
|
-
total:
|
|
267
|
+
total: b.value,
|
|
268
268
|
onSizeChange: de
|
|
269
269
|
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])
|
|
270
270
|
], 512), [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { watch as
|
|
2
|
-
import { themeScaleDerive as
|
|
3
|
-
const
|
|
1
|
+
import { watch as s } from "vue";
|
|
2
|
+
import { themeScaleDerive as x } from "../utils/theme-scale.mjs";
|
|
3
|
+
const p = "admin-core-theme", $ = [
|
|
4
4
|
["primaryColor", { scale: !0, el: "--el-color-primary" }],
|
|
5
5
|
["successColor", { scale: !0, el: "--el-color-success" }],
|
|
6
6
|
["warningColor", { scale: !0, el: "--el-color-warning" }],
|
|
@@ -18,68 +18,196 @@ const m = "admin-core-theme", p = [
|
|
|
18
18
|
["blur", {}],
|
|
19
19
|
["focusRing", {}],
|
|
20
20
|
["surface", {}]
|
|
21
|
-
],
|
|
21
|
+
], u = [
|
|
22
22
|
"light-3",
|
|
23
23
|
"light-5",
|
|
24
24
|
"light-7",
|
|
25
25
|
"light-8",
|
|
26
26
|
"light-9",
|
|
27
27
|
"dark-2"
|
|
28
|
-
],
|
|
29
|
-
const
|
|
30
|
-
for (const [
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
for (const
|
|
38
|
-
|
|
39
|
-
for (const
|
|
40
|
-
|
|
41
|
-
for (const
|
|
42
|
-
|
|
28
|
+
], b = (r) => r.replace(/([A-Z])/g, "-$1").toLowerCase(), g = (r, t) => {
|
|
29
|
+
const e = [];
|
|
30
|
+
for (const [l, i] of $) {
|
|
31
|
+
const o = r[l];
|
|
32
|
+
if (o === void 0 || o === "") continue;
|
|
33
|
+
const n = `--admin-core-${b(l)}`, c = i.el === void 0 ? [] : Array.isArray(i.el) ? i.el : [i.el];
|
|
34
|
+
if (i.scale) {
|
|
35
|
+
const d = x(o, t);
|
|
36
|
+
e.push(`${n}: ${o};`);
|
|
37
|
+
for (const a of u)
|
|
38
|
+
e.push(`${n}-${a}: ${d[a]};`);
|
|
39
|
+
for (const a of c) {
|
|
40
|
+
e.push(`${a}: ${o};`);
|
|
41
|
+
for (const m of u)
|
|
42
|
+
e.push(`${a}-${m}: ${d[m]};`);
|
|
43
43
|
}
|
|
44
44
|
} else {
|
|
45
|
-
|
|
46
|
-
for (const
|
|
45
|
+
e.push(`${n}: ${o};`);
|
|
46
|
+
for (const d of c) e.push(`${d}: ${o};`);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
return
|
|
49
|
+
return e.join(`
|
|
50
50
|
`);
|
|
51
|
-
},
|
|
52
|
-
const
|
|
51
|
+
}, E = (r) => {
|
|
52
|
+
const t = g(r.light, "light"), e = g(r.dark, "dark");
|
|
53
53
|
return `:root {
|
|
54
|
-
${
|
|
54
|
+
${t}
|
|
55
55
|
color: var(--admin-core-base-color);
|
|
56
56
|
}
|
|
57
57
|
:root.dark {
|
|
58
|
-
${
|
|
58
|
+
${e}
|
|
59
59
|
}
|
|
60
60
|
`;
|
|
61
|
+
}, f = "admin-core-rhythm", h = "admin-core-ep-bridge", y = [
|
|
62
|
+
// T1 必纳:表格行密度(垂直经 td padding,水平经 .cell padding)
|
|
63
|
+
".el-table .el-table__cell {",
|
|
64
|
+
" padding-top: var(--admin-core-cell-padding-y, 8px);",
|
|
65
|
+
" padding-bottom: var(--admin-core-cell-padding-y, 8px);",
|
|
66
|
+
"}",
|
|
67
|
+
".el-table .cell {",
|
|
68
|
+
" padding-left: var(--admin-core-cell-padding-x, 12px);",
|
|
69
|
+
" padding-right: var(--admin-core-cell-padding-x, 12px);",
|
|
70
|
+
"}",
|
|
71
|
+
// T1 必纳:表单项间距
|
|
72
|
+
".el-form-item {",
|
|
73
|
+
" margin-bottom: var(--admin-core-form-item-gap, 18px);",
|
|
74
|
+
"}"
|
|
75
|
+
// 注:dialog/card 内距撤到期二——其 EP 原生值(dialog 16 / card 20)与单一
|
|
76
|
+
// content-gap 无法同时对齐,本期纳入会破"默认档零漂移";期二用专属 var 补。
|
|
77
|
+
].join(`
|
|
78
|
+
`), S = {
|
|
79
|
+
compact: {
|
|
80
|
+
spaceUnit: "4px",
|
|
81
|
+
gap: "8px",
|
|
82
|
+
controlHeight: "28px",
|
|
83
|
+
cellPaddingY: "6px",
|
|
84
|
+
cellPaddingX: "12px",
|
|
85
|
+
formItemGap: "12px",
|
|
86
|
+
fontSizeBase: "13px",
|
|
87
|
+
fontScale: "1.15"
|
|
88
|
+
},
|
|
89
|
+
cozy: {
|
|
90
|
+
// cozy = 默认档:取值 [MUST] 与 EP 原生对齐(控件 32 / 字号 14 / 行垂距 8 /
|
|
91
|
+
// 横距 12 / form-item 18),保证未 opt-in 的存量应用零视觉漂移。
|
|
92
|
+
spaceUnit: "4px",
|
|
93
|
+
gap: "12px",
|
|
94
|
+
controlHeight: "32px",
|
|
95
|
+
cellPaddingY: "8px",
|
|
96
|
+
cellPaddingX: "12px",
|
|
97
|
+
formItemGap: "18px",
|
|
98
|
+
fontSizeBase: "14px",
|
|
99
|
+
fontScale: "1.2"
|
|
100
|
+
},
|
|
101
|
+
comfortable: {
|
|
102
|
+
spaceUnit: "4px",
|
|
103
|
+
gap: "20px",
|
|
104
|
+
controlHeight: "40px",
|
|
105
|
+
cellPaddingY: "14px",
|
|
106
|
+
cellPaddingX: "12px",
|
|
107
|
+
formItemGap: "26px",
|
|
108
|
+
fontSizeBase: "15px",
|
|
109
|
+
fontScale: "1.25"
|
|
110
|
+
}
|
|
111
|
+
}, C = {
|
|
112
|
+
snappy: {
|
|
113
|
+
duration: "120ms",
|
|
114
|
+
durationSlow: "180ms",
|
|
115
|
+
easing: "cubic-bezier(0.4, 0, 0.2, 1)"
|
|
116
|
+
},
|
|
117
|
+
standard: {
|
|
118
|
+
// standard = 默认档:duration 200 / durationSlow 300 对齐 EP 原生
|
|
119
|
+
// (--el-transition-duration-fast .2s / --el-transition-duration .3s),默认零漂移。
|
|
120
|
+
duration: "200ms",
|
|
121
|
+
durationSlow: "300ms",
|
|
122
|
+
easing: "cubic-bezier(0.25, 0.1, 0.25, 1)"
|
|
123
|
+
},
|
|
124
|
+
calm: {
|
|
125
|
+
duration: "320ms",
|
|
126
|
+
durationSlow: "420ms",
|
|
127
|
+
easing: "cubic-bezier(0.22, 0.61, 0.36, 1)"
|
|
128
|
+
}
|
|
61
129
|
};
|
|
62
|
-
function
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
130
|
+
function _(r, t) {
|
|
131
|
+
const e = S[r], l = C[t], i = [
|
|
132
|
+
`--admin-core-space-unit: ${e.spaceUnit};`,
|
|
133
|
+
`--admin-core-content-gap: ${e.gap};`,
|
|
134
|
+
`--admin-core-control-height: ${e.controlHeight};`,
|
|
135
|
+
`--el-component-size: ${e.controlHeight};`,
|
|
136
|
+
`--admin-core-cell-padding-y: ${e.cellPaddingY};`,
|
|
137
|
+
`--admin-core-cell-padding-x: ${e.cellPaddingX};`,
|
|
138
|
+
`--admin-core-form-item-gap: ${e.formItemGap};`,
|
|
139
|
+
`--admin-core-font-size-base: ${e.fontSizeBase};`,
|
|
140
|
+
`--el-font-size-base: ${e.fontSizeBase};`,
|
|
141
|
+
`--admin-core-font-scale: ${e.fontScale};`,
|
|
142
|
+
`--admin-core-motion-duration: ${l.duration};`,
|
|
143
|
+
`--el-transition-duration-fast: ${l.duration};`,
|
|
144
|
+
`--admin-core-motion-duration-slow: ${l.durationSlow};`,
|
|
145
|
+
`--el-transition-duration: ${l.durationSlow};`,
|
|
146
|
+
// easing 仅挂 admin-core,[MUST NOT] dual-write 覆盖 EP 两条 bezier——
|
|
147
|
+
// EP ease-in-out / fast 曲线各异,覆盖会让默认档动画曲线漂移;motion 档对 EP 只经 duration 生效。
|
|
148
|
+
`--admin-core-motion-easing: ${l.easing};`
|
|
149
|
+
], o = [
|
|
150
|
+
"--admin-core-motion-duration: 0.01ms;",
|
|
151
|
+
"--admin-core-motion-duration-slow: 0.01ms;",
|
|
152
|
+
"--el-transition-duration: 0.01ms;",
|
|
153
|
+
"--el-transition-duration-fast: 0.01ms;"
|
|
154
|
+
];
|
|
155
|
+
return `:root {
|
|
156
|
+
${i.join(`
|
|
157
|
+
`)}
|
|
158
|
+
}
|
|
159
|
+
@media (prefers-reduced-motion: reduce) {
|
|
160
|
+
:root {
|
|
161
|
+
${o.join(
|
|
162
|
+
`
|
|
163
|
+
`
|
|
164
|
+
)}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
`;
|
|
168
|
+
}
|
|
169
|
+
function T(r) {
|
|
170
|
+
const t = r.document ?? (typeof document < "u" ? document : void 0);
|
|
171
|
+
if (!t) return;
|
|
172
|
+
const e = () => {
|
|
173
|
+
let o = t.getElementById(p);
|
|
174
|
+
return o || (o = t.createElement("style"), o.id = p, t.head.appendChild(o)), o;
|
|
68
175
|
};
|
|
69
|
-
|
|
176
|
+
s(
|
|
70
177
|
r.getThemeConfig,
|
|
71
|
-
(
|
|
72
|
-
|
|
178
|
+
(o) => {
|
|
179
|
+
e().textContent = E(o);
|
|
73
180
|
},
|
|
74
181
|
{ deep: !0, immediate: !0 }
|
|
75
|
-
),
|
|
182
|
+
), s(
|
|
76
183
|
r.getThemeIsDark,
|
|
77
|
-
(
|
|
78
|
-
|
|
184
|
+
(o) => {
|
|
185
|
+
t.documentElement.classList.toggle("dark", o);
|
|
79
186
|
},
|
|
80
187
|
{ immediate: !0 }
|
|
81
188
|
);
|
|
189
|
+
const { getThemeDensity: l, getThemeMotion: i } = r;
|
|
190
|
+
if (l && i) {
|
|
191
|
+
if (!t.getElementById(h)) {
|
|
192
|
+
const n = t.createElement("style");
|
|
193
|
+
n.id = h, n.textContent = y, t.head.appendChild(n);
|
|
194
|
+
}
|
|
195
|
+
const o = () => {
|
|
196
|
+
let n = t.getElementById(
|
|
197
|
+
f
|
|
198
|
+
);
|
|
199
|
+
return n || (n = t.createElement("style"), n.id = f, t.head.appendChild(n)), n;
|
|
200
|
+
};
|
|
201
|
+
s(
|
|
202
|
+
() => [l(), i()],
|
|
203
|
+
([n, c]) => {
|
|
204
|
+
o().textContent = _(n, c);
|
|
205
|
+
},
|
|
206
|
+
{ immediate: !0 }
|
|
207
|
+
);
|
|
208
|
+
}
|
|
82
209
|
}
|
|
83
210
|
export {
|
|
84
|
-
|
|
211
|
+
_ as buildRhythmCss,
|
|
212
|
+
T as useAdminThemeApply
|
|
85
213
|
};
|