@24city/web-console 0.3.10 → 0.3.11

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.
@@ -1,210 +0,0 @@
1
- import { jsx as t, jsxs as c, Fragment as H } from "react/jsx-runtime";
2
- import { useState as z, useEffect as $ } from "react";
3
- import { Layout as g, Button as v, Typography as O, Space as F, Nav as S } from "@douyinfe/semi-ui";
4
- import { IconSidebar as T } from "@douyinfe/semi-icons";
5
- import { useLocation as Q, useNavigate as Y, Outlet as q } from "react-router";
6
- import { h as D, B as J, o as V, e as X, W as Z, b as ee } from "./wallet-badge-COpdEDYI.js";
7
- import { u as P, b as te, a as ne } from "./context-CaVim6ZO.js";
8
- import { u as ae } from "./use-media-query-DvyinWNg.js";
9
- import { a as oe } from "./scale-smFifpMm.js";
10
- const se = "_layout_1vz0g_6", le = "_header_1vz0g_13", re = "_headerLeft_1vz0g_34", ce = "_logo_1vz0g_43", ie = "_logoMark_1vz0g_58", de = "_logoText_1vz0g_65", ue = "_modules_1vz0g_75", me = "_module_1vz0g_75", _e = "_moduleText_1vz0g_123", pe = "_moduleIcon_1vz0g_143", he = "_moduleInk_1vz0g_147", ge = "_headerRight_1vz0g_167", ve = "_walletSlot_1vz0g_172", fe = "_body_1vz0g_180", ye = "_sider_1vz0g_186", ke = "_siderInner_1vz0g_200", Ne = "_panel_1vz0g_207", ze = "_expandButton_1vz0g_244", be = "_menu_1vz0g_260", Ie = "_menuGroup_1vz0g_271", we = "_menuGroupPlain_1vz0g_280", xe = "_menuGroupTitle_1vz0g_285", Ce = "_menuList_1vz0g_296", Me = "_collapseButton_1vz0g_419", Be = "_mask_1vz0g_440", Le = "_content_1vz0g_449", Ge = "_contentCentered_1vz0g_455", Se = "_contentInner_1vz0g_467", Te = "_letterMark_1vz0g_520", e = {
11
- layout: se,
12
- header: le,
13
- headerLeft: re,
14
- logo: ce,
15
- logoMark: ie,
16
- logoText: de,
17
- modules: ue,
18
- module: me,
19
- moduleText: _e,
20
- moduleIcon: pe,
21
- moduleInk: he,
22
- headerRight: ge,
23
- walletSlot: ve,
24
- body: fe,
25
- sider: ye,
26
- siderInner: ke,
27
- panel: Ne,
28
- expandButton: ze,
29
- menu: be,
30
- menuGroup: Ie,
31
- menuGroupPlain: we,
32
- menuGroupTitle: xe,
33
- menuList: Ce,
34
- collapseButton: Me,
35
- mask: Be,
36
- content: Le,
37
- contentCentered: Ge,
38
- contentInner: Se,
39
- letterMark: Te
40
- }, $e = (a, l) => a === l || a.startsWith(`${l}/`), Pe = (a, l) => a.flatMap((o) => o.items).find((o) => new URL(o.to, "http://console.local").pathname === l), Re = (a, l) => {
41
- var o;
42
- return (o = [...a].map((r) => ({ module: r, path: new URL(r.to, "http://console.local").pathname })).filter(({ path: r }) => $e(l, r)).sort((r, u) => u.path.length - r.path.length)[0]) == null ? void 0 : o.module;
43
- }, Ue = () => {
44
- const [a, l] = z(!1);
45
- return $(() => {
46
- const o = () => l(window.scrollY > 0);
47
- return o(), window.addEventListener("scroll", o, { passive: !0 }), () => window.removeEventListener("scroll", o);
48
- }, []), a;
49
- }, Ae = ({ size: a = 30, className: l }) => {
50
- const o = P(), r = (u) => l ? `${u} ${l}` : u;
51
- return o.markUrl ? /* @__PURE__ */ t(
52
- "span",
53
- {
54
- className: r(e.logoMark),
55
- style: { width: a, height: a, backgroundImage: `url("${o.markUrl}")` },
56
- "aria-hidden": "true"
57
- }
58
- ) : /* @__PURE__ */ t("span", { className: r(e.letterMark), style: { width: a, height: a }, "aria-hidden": "true", children: Array.from(o.mark).slice(0, 2).join("") });
59
- }, qe = ({
60
- modules: a = [],
61
- activeModuleKey: l,
62
- moduleTarget: o,
63
- sidebar: r = [],
64
- selectedKey: u,
65
- renderItemLabel: b,
66
- headerRight: R,
67
- menuLabel: U = "工作台菜单",
68
- children: A,
69
- extra: E
70
- }) => {
71
- var G;
72
- const { config: I } = te(), w = P(), f = Q(), y = Y(), x = I.routes.app, p = D(x, J(ne())), C = V(x, f.pathname), h = C ? [] : r ?? [], M = h.length > 0, K = l ?? ((G = Re(a, f.pathname)) == null ? void 0 : G.key), m = Pe([...h, p], f.pathname), B = u ?? (m == null ? void 0 : m.key), i = ae(oe("desktop")), W = Ue(), [_, k] = z(!i), [N, d] = z(!1), j = new Map([...h, p].flatMap((n) => n.items.map((s) => [s.key, s])));
73
- $(() => {
74
- k(!i), d(!1);
75
- }, [i]);
76
- const L = (n) => {
77
- const s = j.get(n);
78
- s && y(s.to), d(!1);
79
- };
80
- return /* @__PURE__ */ c(g, { className: e.layout, children: [
81
- /* @__PURE__ */ c(g.Header, { className: e.header, "data-scrolled": W ? "true" : "false", children: [
82
- /* @__PURE__ */ c("div", { className: e.headerLeft, children: [
83
- /* @__PURE__ */ c(
84
- v,
85
- {
86
- theme: "borderless",
87
- type: "tertiary",
88
- className: e.logo,
89
- "aria-label": `${w.shortName} 首页`,
90
- onClick: () => y(I.routes.publicHome),
91
- children: [
92
- /* @__PURE__ */ t(Ae, {}),
93
- /* @__PURE__ */ t(O.Text, { className: e.logoText, children: w.shortName })
94
- ]
95
- }
96
- ),
97
- a.length ? /* @__PURE__ */ t("div", { className: e.modules, role: "navigation", "aria-label": "产品模块", children: a.map((n) => /* @__PURE__ */ c(
98
- v,
99
- {
100
- theme: "borderless",
101
- type: "tertiary",
102
- className: e.module,
103
- "aria-current": K === n.key ? "page" : void 0,
104
- onClick: () => y(o ? o(n) : n.to),
105
- children: [
106
- /* @__PURE__ */ c("span", { className: e.moduleText, children: [
107
- n.icon ? /* @__PURE__ */ t("span", { className: e.moduleIcon, children: /* @__PURE__ */ t(n.icon, {}) }) : null,
108
- n.label
109
- ] }),
110
- /* @__PURE__ */ t("span", { className: e.moduleInk, "aria-hidden": "true" })
111
- ]
112
- },
113
- n.key
114
- )) }) : null
115
- ] }),
116
- /* @__PURE__ */ t(F, { spacing: 10, className: e.headerRight, children: R ?? /* @__PURE__ */ c(H, { children: [
117
- /* @__PURE__ */ t(X, {}),
118
- /* @__PURE__ */ t("span", { className: e.walletSlot, children: /* @__PURE__ */ t(Z, {}) }),
119
- /* @__PURE__ */ t(ee, { personal: p, selectedKey: m && p.items.includes(m) ? m.key : void 0, onOpen: L })
120
- ] }) })
121
- ] }),
122
- /* @__PURE__ */ c(g, { className: e.body, children: [
123
- M ? /* @__PURE__ */ t("aside", { className: e.sider, "data-collapsed": _ ? "true" : "false", children: /* @__PURE__ */ c(
124
- "div",
125
- {
126
- className: e.siderInner,
127
- "data-collapsed": _ ? "true" : "false",
128
- "data-peek": N ? "true" : "false",
129
- onMouseEnter: () => {
130
- _ && i && d(!0);
131
- },
132
- onMouseLeave: () => {
133
- i && d(!1);
134
- },
135
- children: [
136
- _ ? /* @__PURE__ */ t(
137
- v,
138
- {
139
- theme: "light",
140
- type: "tertiary",
141
- className: e.expandButton,
142
- icon: /* @__PURE__ */ t(T, { "aria-hidden": "true" }),
143
- "aria-label": "展开侧边栏",
144
- "aria-expanded": N,
145
- onClick: () => {
146
- i ? (k(!1), d(!1)) : d((n) => !n);
147
- }
148
- }
149
- ) : null,
150
- /* @__PURE__ */ c("div", { className: e.panel, children: [
151
- /* @__PURE__ */ t("nav", { className: e.menu, "aria-label": U, children: h.map((n) => /* @__PURE__ */ c(
152
- "div",
153
- {
154
- className: n.label ? e.menuGroup : `${e.menuGroup} ${e.menuGroupPlain}`,
155
- role: "group",
156
- "aria-label": n.label || void 0,
157
- children: [
158
- n.label ? /* @__PURE__ */ t("div", { className: e.menuGroupTitle, children: n.label }) : null,
159
- /* @__PURE__ */ t(
160
- S,
161
- {
162
- mode: "vertical",
163
- className: e.menuList,
164
- selectedKeys: B ? [B] : [],
165
- onSelect: ({ itemKey: s }) => L(String(s)),
166
- children: n.items.map((s) => /* @__PURE__ */ t(
167
- S.Item,
168
- {
169
- itemKey: s.key,
170
- icon: s.icon ? /* @__PURE__ */ t(s.icon, {}) : void 0,
171
- text: b ? b(s) : s.label
172
- },
173
- s.key
174
- ))
175
- }
176
- )
177
- ]
178
- },
179
- n.key
180
- )) }),
181
- i ? /* @__PURE__ */ t(
182
- v,
183
- {
184
- theme: "borderless",
185
- type: "tertiary",
186
- className: e.collapseButton,
187
- icon: /* @__PURE__ */ t(T, { "aria-hidden": "true" }),
188
- onClick: () => {
189
- k((n) => !n), d(!1);
190
- },
191
- children: _ ? "固定侧边栏" : "收起侧边栏"
192
- }
193
- ) : null
194
- ] })
195
- ]
196
- }
197
- ) }) : null,
198
- N && !i && M ? /* @__PURE__ */ t("div", { className: e.mask, "aria-hidden": "true", onClick: () => d(!1) }) : null,
199
- /* @__PURE__ */ t(g.Content, { className: C ? `${e.content} ${e.contentCentered}` : e.content, children: /* @__PURE__ */ t("div", { className: e.contentInner, children: A ?? /* @__PURE__ */ t(q, {}) }) })
200
- ] }),
201
- E
202
- ] });
203
- };
204
- export {
205
- Ae as B,
206
- qe as C,
207
- Pe as a,
208
- Re as f,
209
- $e as i
210
- };