@24city/web-console 0.1.3 → 0.2.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/CHANGELOG.md +52 -0
- package/GUIDELINES.md +223 -0
- package/README.md +42 -10
- package/dist/account/index.js +2 -2
- package/dist/chunks/console-layout-DH-aROYp.js +209 -0
- package/dist/chunks/page-YBG0dEN1.js +111 -0
- package/dist/chunks/scale-smFifpMm.js +26 -0
- package/dist/chunks/{stale-build-DUKkQHuu.js → stale-build-DG-Tb2RA.js} +24 -20
- package/dist/chunks/status-tag-BrLUhH6Z.js +87 -0
- package/dist/chunks/text-link-BAKoHe5o.js +64 -0
- package/dist/chunks/unsupported-browser-Dwq1mNRy.js +48 -0
- package/dist/chunks/upgrade-modal-DgChxbLm.js +667 -0
- package/dist/chunks/{wallet-badge-BXu-WxJa.js → wallet-badge-dVrO6py9.js} +136 -136
- package/dist/chunks/waterfall-CQG8aVdx.js +613 -0
- package/dist/data/index.d.ts +2 -0
- package/dist/data/index.js +6 -0
- package/dist/data/metric-card.d.ts +41 -0
- package/dist/data/status-tag.d.ts +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +160 -120
- package/dist/layout/index.js +1 -1
- package/dist/list/choice-cards.d.ts +29 -0
- package/dist/list/content-square.d.ts +50 -0
- package/dist/list/filter-dropdown.d.ts +43 -0
- package/dist/list/filter-panel.d.ts +94 -0
- package/dist/list/index.d.ts +7 -0
- package/dist/list/index.js +27 -0
- package/dist/list/list-toolbar.d.ts +56 -0
- package/dist/list/waterfall-layout.d.ts +11 -0
- package/dist/list/waterfall.d.ts +13 -0
- package/dist/page/index.d.ts +2 -0
- package/dist/page/index.js +19 -15
- package/dist/page/page.d.ts +21 -2
- package/dist/page/select-label.d.ts +11 -0
- package/dist/page/unsupported-browser.d.ts +2 -0
- package/dist/runtime/browser-support.d.ts +6 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +38 -37
- package/dist/runtime/providers.d.ts +1 -1
- package/dist/styles.css +1962 -581
- package/dist/testing/guard.d.ts +20 -0
- package/dist/testing/guard.js +83 -36
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.js +29 -25
- package/dist/theme/scale.d.ts +34 -0
- package/package.json +13 -2
- package/dist/chunks/console-layout-D5YgsZYN.js +0 -208
- package/dist/chunks/error-boundary-D3qiD7ov.js +0 -35
- package/dist/chunks/page-BaitnD--.js +0 -89
- package/dist/chunks/text-link-FTsBp_QU.js +0 -54
- package/dist/chunks/upgrade-modal-J0X79nT2.js +0 -667
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
import { jsx as a, jsxs as u, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { RadioGroup as K, Radio as U, Typography as S, Skeleton as R, Input as M, Button as b, Dropdown as L, Popover as X, InputNumber as z } from "@douyinfe/semi-ui";
|
|
3
|
+
import { useRef as q, useEffect as D, useState as B, forwardRef as j, useLayoutEffect as J } from "react";
|
|
4
|
+
import { IconClose as W, IconSearch as O, IconTick as Q, IconChevronDown as G, IconDelete as Z, IconArrowDown as ee, IconUndo as ae, IconRefresh as re } from "@douyinfe/semi-icons";
|
|
5
|
+
import { B as te } from "./scale-smFifpMm.js";
|
|
6
|
+
const se = "_group_1f0zj_3", le = "_loading_1f0zj_4", ne = "_skeleton_1f0zj_11", oe = "_radio_1f0zj_28", ce = "_card_1f0zj_62", ie = "_title_1f0zj_90", de = "_description_1f0zj_101", C = {
|
|
7
|
+
group: se,
|
|
8
|
+
loading: le,
|
|
9
|
+
skeleton: ne,
|
|
10
|
+
radio: oe,
|
|
11
|
+
card: ce,
|
|
12
|
+
title: ie,
|
|
13
|
+
description: de
|
|
14
|
+
}, H = (e) => ({ "--choice-columns": e }), Ma = ({
|
|
15
|
+
ariaLabel: e,
|
|
16
|
+
value: r,
|
|
17
|
+
options: t,
|
|
18
|
+
onChange: l,
|
|
19
|
+
columns: s = 4
|
|
20
|
+
}) => /* @__PURE__ */ a("div", { role: "radiogroup", "aria-label": e, children: /* @__PURE__ */ a(
|
|
21
|
+
K,
|
|
22
|
+
{
|
|
23
|
+
name: e,
|
|
24
|
+
className: C.group,
|
|
25
|
+
style: H(s),
|
|
26
|
+
value: r,
|
|
27
|
+
onChange: (n) => l(n.target.value),
|
|
28
|
+
children: t.map((n) => {
|
|
29
|
+
const i = n.unavailable ?? n.description, o = n.value === r;
|
|
30
|
+
return /* @__PURE__ */ a(U, { value: n.value, className: C.radio, children: /* @__PURE__ */ u("span", { className: C.card, "data-checked": o ? "true" : "false", "data-unavailable": n.unavailable ? "true" : void 0, children: [
|
|
31
|
+
/* @__PURE__ */ a(S.Text, { className: C.title, children: n.title }),
|
|
32
|
+
i ? /* @__PURE__ */ a(S.Text, { className: C.description, ellipsis: !0, children: i }) : null
|
|
33
|
+
] }) }, n.value || "all");
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
) }), Da = ({ count: e, columns: r = 4 }) => /* @__PURE__ */ a("div", { className: C.loading, style: H(r), "aria-busy": "true", children: Array.from({ length: e }, (t, l) => /* @__PURE__ */ a(R, { loading: !0, active: !0, className: C.skeleton, placeholder: /* @__PURE__ */ a(R.Paragraph, { rows: 2 }) }, l)) }), _e = "_square_no027_7", ue = "_heroTitle_no027_18", me = "_heroAccent_no027_30", he = "_searchBar_no027_35", ge = "_searchBox_no027_49", pe = "_searchInput_no027_55", be = "_searchPrefix_no027_91", fe = "_searchButton_no027_100", ve = "_guide_no027_108", Ne = "_guideLabel_no027_116", ye = "_guideTag_no027_122", we = "_guideClear_no027_142", xe = "_categories_no027_147", Ce = "_panel_no027_152", Te = "_filters_no027_157", ke = "_toolbarStart_no027_172", qe = "_filtersGroup_no027_179", Le = "_results_no027_187", Be = "_footer_no027_196", g = {
|
|
37
|
+
square: _e,
|
|
38
|
+
heroTitle: ue,
|
|
39
|
+
heroAccent: me,
|
|
40
|
+
searchBar: he,
|
|
41
|
+
searchBox: ge,
|
|
42
|
+
searchInput: pe,
|
|
43
|
+
searchPrefix: be,
|
|
44
|
+
searchButton: fe,
|
|
45
|
+
guide: ve,
|
|
46
|
+
guideLabel: Ne,
|
|
47
|
+
guideTag: ye,
|
|
48
|
+
guideClear: we,
|
|
49
|
+
categories: xe,
|
|
50
|
+
panel: Ce,
|
|
51
|
+
filters: Te,
|
|
52
|
+
toolbarStart: ke,
|
|
53
|
+
filtersGroup: qe,
|
|
54
|
+
results: Le,
|
|
55
|
+
footer: Be
|
|
56
|
+
}, Se = (e, r) => {
|
|
57
|
+
D(() => {
|
|
58
|
+
const t = e.current, l = r.current;
|
|
59
|
+
if (!t || !l) return;
|
|
60
|
+
let s = 0;
|
|
61
|
+
const n = () => {
|
|
62
|
+
s = 0;
|
|
63
|
+
const o = Number.parseFloat(getComputedStyle(t).getPropertyValue("--app-header-height")) || 0, c = l.getBoundingClientRect().top + window.scrollY - o, h = c > 0 ? Math.min(1, Math.max(0, window.scrollY / c)) : 1;
|
|
64
|
+
t.style.setProperty("--hero-progress", h.toFixed(3));
|
|
65
|
+
}, i = () => {
|
|
66
|
+
s || (s = window.requestAnimationFrame(n));
|
|
67
|
+
};
|
|
68
|
+
return n(), window.addEventListener("scroll", i, { passive: !0 }), window.addEventListener("resize", i), () => {
|
|
69
|
+
window.removeEventListener("scroll", i), window.removeEventListener("resize", i), window.cancelAnimationFrame(s);
|
|
70
|
+
};
|
|
71
|
+
}, [e, r]);
|
|
72
|
+
}, ja = ({
|
|
73
|
+
ariaLabel: e,
|
|
74
|
+
placeholder: r,
|
|
75
|
+
value: t,
|
|
76
|
+
onChange: l,
|
|
77
|
+
onSearch: s,
|
|
78
|
+
inputRef: n,
|
|
79
|
+
keyShortcut: i,
|
|
80
|
+
guide: o,
|
|
81
|
+
prefix: c
|
|
82
|
+
}) => {
|
|
83
|
+
const h = !t && o && o.items.length > 0;
|
|
84
|
+
return /* @__PURE__ */ a(
|
|
85
|
+
M,
|
|
86
|
+
{
|
|
87
|
+
ref: n,
|
|
88
|
+
className: g.searchInput,
|
|
89
|
+
"aria-label": e,
|
|
90
|
+
"aria-keyshortcuts": i,
|
|
91
|
+
showClear: !0,
|
|
92
|
+
maxLength: 80,
|
|
93
|
+
placeholder: r,
|
|
94
|
+
value: t,
|
|
95
|
+
onChange: l,
|
|
96
|
+
onEnterPress: () => s(t),
|
|
97
|
+
onClear: () => s(""),
|
|
98
|
+
prefix: c ? /* @__PURE__ */ a("span", { className: g.searchPrefix, children: c }) : void 0,
|
|
99
|
+
suffix: /* @__PURE__ */ u(F, { children: [
|
|
100
|
+
h ? /* @__PURE__ */ u("span", { className: g.guide, role: "group", "aria-label": o.label, children: [
|
|
101
|
+
/* @__PURE__ */ a(S.Text, { className: g.guideLabel, children: o.label }),
|
|
102
|
+
o.items.map((m) => /* @__PURE__ */ a(b, { theme: "light", type: "tertiary", size: "small", className: g.guideTag, onClick: () => s(m), children: m }, m)),
|
|
103
|
+
o.onClear ? /* @__PURE__ */ a(
|
|
104
|
+
b,
|
|
105
|
+
{
|
|
106
|
+
theme: "borderless",
|
|
107
|
+
type: "primary",
|
|
108
|
+
size: "small",
|
|
109
|
+
className: g.guideClear,
|
|
110
|
+
icon: /* @__PURE__ */ a(W, { "aria-hidden": "true" }),
|
|
111
|
+
"aria-label": `清空${o.label}`,
|
|
112
|
+
onClick: o.onClear
|
|
113
|
+
}
|
|
114
|
+
) : null
|
|
115
|
+
] }) : null,
|
|
116
|
+
/* @__PURE__ */ a(
|
|
117
|
+
b,
|
|
118
|
+
{
|
|
119
|
+
theme: "solid",
|
|
120
|
+
type: "primary",
|
|
121
|
+
className: g.searchButton,
|
|
122
|
+
icon: /* @__PURE__ */ a(O, { "aria-hidden": "true" }),
|
|
123
|
+
"aria-label": "检索",
|
|
124
|
+
onClick: () => s(t)
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
] })
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}, Wa = ({ children: e }) => /* @__PURE__ */ a("span", { className: g.heroAccent, children: e }), Oa = ({
|
|
131
|
+
testId: e,
|
|
132
|
+
title: r,
|
|
133
|
+
search: t,
|
|
134
|
+
categories: l,
|
|
135
|
+
filters: s,
|
|
136
|
+
toolbarLeft: n,
|
|
137
|
+
toolbarRight: i,
|
|
138
|
+
conditionKey: o,
|
|
139
|
+
children: c
|
|
140
|
+
}) => {
|
|
141
|
+
const h = q(null), m = q(null), N = q(null), v = q(null);
|
|
142
|
+
Se(h, m);
|
|
143
|
+
const y = q(o);
|
|
144
|
+
return D(() => {
|
|
145
|
+
if (y.current === o) return;
|
|
146
|
+
y.current = o;
|
|
147
|
+
const f = v.current, T = N.current;
|
|
148
|
+
if (!f || !T) return;
|
|
149
|
+
const w = f.getBoundingClientRect().top - T.getBoundingClientRect().bottom;
|
|
150
|
+
w < 0 && window.scrollBy({ top: w });
|
|
151
|
+
}, [o]), /* @__PURE__ */ u("section", { ref: h, className: g.square, "data-testid": e, "data-categories": l ? "true" : "false", children: [
|
|
152
|
+
/* @__PURE__ */ a(S.Title, { heading: 1, className: g.heroTitle, children: r }),
|
|
153
|
+
/* @__PURE__ */ a("div", { ref: m, "aria-hidden": "true" }),
|
|
154
|
+
/* @__PURE__ */ a("div", { className: g.searchBar, children: /* @__PURE__ */ a("div", { className: g.searchBox, children: t }) }),
|
|
155
|
+
l ? /* @__PURE__ */ a("div", { className: g.categories, children: l }) : null,
|
|
156
|
+
s ? /* @__PURE__ */ a("div", { className: g.panel, children: s }) : null,
|
|
157
|
+
/* @__PURE__ */ u("div", { ref: N, className: g.filters, role: "toolbar", "aria-label": "排序与视图", children: [
|
|
158
|
+
/* @__PURE__ */ a("div", { className: g.toolbarStart, children: n }),
|
|
159
|
+
/* @__PURE__ */ a("div", { className: g.filtersGroup, children: i })
|
|
160
|
+
] }),
|
|
161
|
+
/* @__PURE__ */ a("div", { ref: v, className: g.results, children: c })
|
|
162
|
+
] });
|
|
163
|
+
}, Ga = ({ children: e, footerRef: r }) => /* @__PURE__ */ a("div", { ref: r, className: g.footer, children: e }), $e = "_trigger_iy209_3", Ae = "_text_iy209_27", Ie = "_prefix_iy209_32", Ee = "_arrow_iy209_50", Fe = "_menu_iy209_60", Pe = "_checkItem_iy209_64", Re = "_check_iy209_64", ze = "_checkHidden_iy209_75", x = {
|
|
164
|
+
trigger: $e,
|
|
165
|
+
text: Ae,
|
|
166
|
+
prefix: Ie,
|
|
167
|
+
arrow: Ee,
|
|
168
|
+
menu: Fe,
|
|
169
|
+
checkItem: Pe,
|
|
170
|
+
check: Re,
|
|
171
|
+
checkHidden: ze
|
|
172
|
+
}, V = j(
|
|
173
|
+
({ text: e, ariaLabel: r, active: t = !1, empty: l = !1, icon: s, arrow: n = !0, pressed: i, onClick: o, ...c }, h) => /* @__PURE__ */ u(
|
|
174
|
+
b,
|
|
175
|
+
{
|
|
176
|
+
theme: "borderless",
|
|
177
|
+
type: "primary",
|
|
178
|
+
...c,
|
|
179
|
+
ref: h,
|
|
180
|
+
className: x.trigger,
|
|
181
|
+
"data-active": t ? "true" : "false",
|
|
182
|
+
"data-empty": l ? "true" : "false",
|
|
183
|
+
"aria-label": r,
|
|
184
|
+
"aria-pressed": i,
|
|
185
|
+
onClick: o,
|
|
186
|
+
children: [
|
|
187
|
+
s ? /* @__PURE__ */ a("span", { className: x.prefix, children: s }) : null,
|
|
188
|
+
/* @__PURE__ */ a("span", { className: x.text, children: e }),
|
|
189
|
+
n ? /* @__PURE__ */ a(G, { className: x.arrow, "aria-hidden": "true" }) : null
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
);
|
|
194
|
+
V.displayName = "FilterTrigger";
|
|
195
|
+
const $ = "__all__", Ha = ({
|
|
196
|
+
label: e,
|
|
197
|
+
placeholder: r,
|
|
198
|
+
value: t,
|
|
199
|
+
options: l,
|
|
200
|
+
onChange: s,
|
|
201
|
+
allLabel: n,
|
|
202
|
+
icon: i,
|
|
203
|
+
arrow: o = !0,
|
|
204
|
+
checkmark: c = !1,
|
|
205
|
+
position: h = "bottomLeft",
|
|
206
|
+
disabled: m = !1,
|
|
207
|
+
highlight: N = !0
|
|
208
|
+
}) => {
|
|
209
|
+
const [v, y] = B(!1), f = l.find((d) => d.value === t), T = n ? [{ value: $, label: n }, ...l] : l, w = t || (n ? $ : "");
|
|
210
|
+
return /* @__PURE__ */ a(
|
|
211
|
+
L,
|
|
212
|
+
{
|
|
213
|
+
trigger: m ? "custom" : "click",
|
|
214
|
+
position: h,
|
|
215
|
+
visible: m ? !1 : v,
|
|
216
|
+
onVisibleChange: y,
|
|
217
|
+
render: /* @__PURE__ */ a(L.Menu, { className: x.menu, children: T.map((d) => /* @__PURE__ */ u(
|
|
218
|
+
L.Item,
|
|
219
|
+
{
|
|
220
|
+
active: d.value === w,
|
|
221
|
+
className: c ? x.checkItem : void 0,
|
|
222
|
+
onClick: () => {
|
|
223
|
+
y(!1), s(d.value === $ ? "" : d.value);
|
|
224
|
+
},
|
|
225
|
+
children: [
|
|
226
|
+
c ? /* @__PURE__ */ a(Q, { className: d.value === w ? x.check : x.checkHidden, "aria-hidden": "true" }) : null,
|
|
227
|
+
d.label
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
d.value
|
|
231
|
+
)) }),
|
|
232
|
+
children: /* @__PURE__ */ a(
|
|
233
|
+
V,
|
|
234
|
+
{
|
|
235
|
+
text: (f == null ? void 0 : f.label) ?? r ?? e,
|
|
236
|
+
ariaLabel: `${e}:${(f == null ? void 0 : f.label) ?? n ?? "未选择"}`,
|
|
237
|
+
active: v,
|
|
238
|
+
empty: !f || !N,
|
|
239
|
+
icon: i,
|
|
240
|
+
arrow: o
|
|
241
|
+
}
|
|
242
|
+
)
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
}, Me = "_panel_br4gq_6", De = "_row_br4gq_17", je = "_rowLabel_br4gq_32", We = "_colon_br4gq_47", Oe = "_rowContent_br4gq_51", Ge = "_rowExtra_br4gq_61", He = "_option_br4gq_71", Ve = "_selectedEmpty_br4gq_103", Ye = "_selectedTag_br4gq_109", Ke = "_selectedText_br4gq_124", Ue = "_selectedRemove_br4gq_131", Xe = "_clearButton_br4gq_145", Je = "_selectText_br4gq_160", Qe = "_selectTextLabel_br4gq_188", Ze = "_selectTextArrow_br4gq_195", ea = "_menu_br4gq_211", aa = "_rangePanel_br4gq_217", ra = "_rangePresets_br4gq_224", ta = "_rangePreset_br4gq_224", sa = "_rangeCustom_br4gq_254", la = "_rangeDash_br4gq_262", na = "_rangeFooter_br4gq_266", oa = "_capsules_br4gq_274", ca = "_capsule_br4gq_274", ia = "_sortBar_br4gq_304", da = "_sortLabel_br4gq_318", _a = "_sortItem_br4gq_326", ua = "_sortArrow_br4gq_349", _ = {
|
|
246
|
+
panel: Me,
|
|
247
|
+
row: De,
|
|
248
|
+
rowLabel: je,
|
|
249
|
+
colon: We,
|
|
250
|
+
rowContent: Oe,
|
|
251
|
+
rowExtra: Ge,
|
|
252
|
+
option: He,
|
|
253
|
+
selectedEmpty: Ve,
|
|
254
|
+
selectedTag: Ye,
|
|
255
|
+
selectedText: Ke,
|
|
256
|
+
selectedRemove: Ue,
|
|
257
|
+
clearButton: Xe,
|
|
258
|
+
selectText: Je,
|
|
259
|
+
selectTextLabel: Qe,
|
|
260
|
+
selectTextArrow: Ze,
|
|
261
|
+
menu: ea,
|
|
262
|
+
rangePanel: aa,
|
|
263
|
+
rangePresets: ra,
|
|
264
|
+
rangePreset: ta,
|
|
265
|
+
rangeCustom: sa,
|
|
266
|
+
rangeDash: la,
|
|
267
|
+
rangeFooter: na,
|
|
268
|
+
capsules: oa,
|
|
269
|
+
capsule: ca,
|
|
270
|
+
sortBar: ia,
|
|
271
|
+
sortLabel: da,
|
|
272
|
+
sortItem: _a,
|
|
273
|
+
sortArrow: ua
|
|
274
|
+
}, Va = ({ children: e, ariaLabel: r = "筛选条件" }) => /* @__PURE__ */ a("div", { className: _.panel, role: "group", "aria-label": r, children: e }), Y = ({ label: e, children: r, extra: t }) => /* @__PURE__ */ u("div", { className: _.row, role: "group", "aria-label": e, children: [
|
|
275
|
+
/* @__PURE__ */ u("div", { className: _.rowLabel, "aria-hidden": "true", children: [
|
|
276
|
+
e,
|
|
277
|
+
/* @__PURE__ */ a("span", { className: _.colon, children: ":" })
|
|
278
|
+
] }),
|
|
279
|
+
/* @__PURE__ */ a("div", { className: _.rowContent, children: r }),
|
|
280
|
+
t ? /* @__PURE__ */ a("div", { className: _.rowExtra, children: t }) : null
|
|
281
|
+
] }), Ya = ({ label: e, value: r, options: t, onChange: l }) => /* @__PURE__ */ a(Y, { label: e, children: t.map((s) => /* @__PURE__ */ a(
|
|
282
|
+
ma,
|
|
283
|
+
{
|
|
284
|
+
label: s.label,
|
|
285
|
+
active: s.value === r,
|
|
286
|
+
onClick: () => l(s.value === r ? "" : s.value)
|
|
287
|
+
},
|
|
288
|
+
s.value
|
|
289
|
+
)) }), ma = ({
|
|
290
|
+
label: e,
|
|
291
|
+
active: r,
|
|
292
|
+
onClick: t
|
|
293
|
+
}) => /* @__PURE__ */ a(
|
|
294
|
+
b,
|
|
295
|
+
{
|
|
296
|
+
theme: "borderless",
|
|
297
|
+
type: "primary",
|
|
298
|
+
className: _.option,
|
|
299
|
+
"data-active": r ? "true" : "false",
|
|
300
|
+
"aria-pressed": r,
|
|
301
|
+
onClick: t,
|
|
302
|
+
children: e
|
|
303
|
+
}
|
|
304
|
+
), Ka = ({
|
|
305
|
+
conditions: e,
|
|
306
|
+
onClear: r
|
|
307
|
+
}) => /* @__PURE__ */ a(Y, { label: "已选条件", children: e.length === 0 ? /* @__PURE__ */ a("span", { className: _.selectedEmpty, children: "未选择,点选下方条件即可筛选" }) : /* @__PURE__ */ u(F, { children: [
|
|
308
|
+
e.map((t) => /* @__PURE__ */ u("span", { className: _.selectedTag, children: [
|
|
309
|
+
/* @__PURE__ */ a("span", { className: _.selectedText, children: t.label }),
|
|
310
|
+
/* @__PURE__ */ a(
|
|
311
|
+
b,
|
|
312
|
+
{
|
|
313
|
+
theme: "borderless",
|
|
314
|
+
type: "primary",
|
|
315
|
+
size: "small",
|
|
316
|
+
className: _.selectedRemove,
|
|
317
|
+
icon: /* @__PURE__ */ a(W, { "aria-hidden": "true" }),
|
|
318
|
+
"aria-label": `移除 ${t.label}`,
|
|
319
|
+
onClick: t.onRemove
|
|
320
|
+
}
|
|
321
|
+
)
|
|
322
|
+
] }, t.key)),
|
|
323
|
+
/* @__PURE__ */ a(b, { theme: "borderless", type: "primary", size: "small", className: _.clearButton, icon: /* @__PURE__ */ a(Z, { "aria-hidden": "true" }), onClick: r, children: "清空" })
|
|
324
|
+
] }) }), A = "__all__", Ua = ({ placeholder: e, label: r, value: t, options: l, onChange: s }) => {
|
|
325
|
+
const [n, i] = B(!1), o = l.find((c) => c.value === t);
|
|
326
|
+
return /* @__PURE__ */ a(
|
|
327
|
+
L,
|
|
328
|
+
{
|
|
329
|
+
trigger: "click",
|
|
330
|
+
position: "bottomLeft",
|
|
331
|
+
visible: n,
|
|
332
|
+
onVisibleChange: i,
|
|
333
|
+
render: /* @__PURE__ */ a(L.Menu, { className: _.menu, children: [{ value: A, label: e }, ...l].map((c) => /* @__PURE__ */ a(
|
|
334
|
+
L.Item,
|
|
335
|
+
{
|
|
336
|
+
active: c.value === (t || A),
|
|
337
|
+
onClick: () => {
|
|
338
|
+
i(!1), s(c.value === A ? "" : c.value);
|
|
339
|
+
},
|
|
340
|
+
children: c.label
|
|
341
|
+
},
|
|
342
|
+
c.value
|
|
343
|
+
)) }),
|
|
344
|
+
children: /* @__PURE__ */ a(
|
|
345
|
+
P,
|
|
346
|
+
{
|
|
347
|
+
text: (o == null ? void 0 : o.label) ?? e,
|
|
348
|
+
ariaLabel: `${r}:${(o == null ? void 0 : o.label) ?? "不限"}`,
|
|
349
|
+
active: !!o,
|
|
350
|
+
open: n
|
|
351
|
+
}
|
|
352
|
+
)
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
}, P = j(
|
|
356
|
+
({ text: e, ariaLabel: r, active: t, open: l, ...s }, n) => /* @__PURE__ */ u(
|
|
357
|
+
b,
|
|
358
|
+
{
|
|
359
|
+
theme: "borderless",
|
|
360
|
+
type: "primary",
|
|
361
|
+
...s,
|
|
362
|
+
ref: n,
|
|
363
|
+
className: _.selectText,
|
|
364
|
+
"data-active": t ? "true" : "false",
|
|
365
|
+
"data-open": l ? "true" : "false",
|
|
366
|
+
"aria-label": r,
|
|
367
|
+
children: [
|
|
368
|
+
/* @__PURE__ */ a("span", { className: _.selectTextLabel, children: e }),
|
|
369
|
+
/* @__PURE__ */ a(G, { className: _.selectTextArrow, "aria-hidden": "true" })
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
)
|
|
373
|
+
);
|
|
374
|
+
P.displayName = "SelectTextTrigger";
|
|
375
|
+
const I = (e, r) => e.min === r.min && e.max === r.max, Xa = ({ label: e, value: r, presets: t, onChange: l, limit: s, unit: n, minOnly: i = !1, format: o }) => {
|
|
376
|
+
const [c, h] = B(!1), [m, N] = B(r), v = r.min !== void 0 || r.max !== void 0, y = v ? o(r) : e, f = (d) => {
|
|
377
|
+
h(!1), l(d);
|
|
378
|
+
}, T = m.min === void 0 && m.max === void 0 || m.min !== void 0 && m.max !== void 0 && m.min > m.max, w = (d) => {
|
|
379
|
+
const k = typeof d == "number" ? d : typeof d == "string" && d.trim() !== "" ? Number(d) : NaN;
|
|
380
|
+
return Number.isFinite(k) ? Math.round(k) : void 0;
|
|
381
|
+
};
|
|
382
|
+
return /* @__PURE__ */ a(
|
|
383
|
+
X,
|
|
384
|
+
{
|
|
385
|
+
trigger: "click",
|
|
386
|
+
position: "bottomLeft",
|
|
387
|
+
visible: c,
|
|
388
|
+
onVisibleChange: (d) => {
|
|
389
|
+
h(d), d && N(r);
|
|
390
|
+
},
|
|
391
|
+
content: /* @__PURE__ */ u("div", { className: _.rangePanel, role: "group", "aria-label": e, children: [
|
|
392
|
+
/* @__PURE__ */ a("div", { className: _.rangePresets, children: t.map((d) => /* @__PURE__ */ a(
|
|
393
|
+
b,
|
|
394
|
+
{
|
|
395
|
+
theme: "borderless",
|
|
396
|
+
type: "primary",
|
|
397
|
+
className: _.rangePreset,
|
|
398
|
+
"data-active": I(d, r) ? "true" : "false",
|
|
399
|
+
"aria-pressed": I(d, r),
|
|
400
|
+
onClick: () => f(I(d, r) ? {} : { min: d.min, max: d.max }),
|
|
401
|
+
children: d.label
|
|
402
|
+
},
|
|
403
|
+
d.label
|
|
404
|
+
)) }),
|
|
405
|
+
/* @__PURE__ */ u("div", { className: _.rangeCustom, children: [
|
|
406
|
+
/* @__PURE__ */ a(
|
|
407
|
+
z,
|
|
408
|
+
{
|
|
409
|
+
size: "small",
|
|
410
|
+
"aria-label": i ? `${e}不低于` : `${e}最小值`,
|
|
411
|
+
placeholder: i ? "不低于" : "最小",
|
|
412
|
+
min: 0,
|
|
413
|
+
max: s,
|
|
414
|
+
precision: 0,
|
|
415
|
+
suffix: n,
|
|
416
|
+
value: m.min,
|
|
417
|
+
onChange: (d) => N((k) => ({ ...k, min: w(d) }))
|
|
418
|
+
}
|
|
419
|
+
),
|
|
420
|
+
i ? null : /* @__PURE__ */ u(F, { children: [
|
|
421
|
+
/* @__PURE__ */ a("span", { className: _.rangeDash, children: "–" }),
|
|
422
|
+
/* @__PURE__ */ a(
|
|
423
|
+
z,
|
|
424
|
+
{
|
|
425
|
+
size: "small",
|
|
426
|
+
"aria-label": `${e}最大值`,
|
|
427
|
+
placeholder: "最大",
|
|
428
|
+
min: 0,
|
|
429
|
+
max: s,
|
|
430
|
+
precision: 0,
|
|
431
|
+
suffix: n,
|
|
432
|
+
value: m.max,
|
|
433
|
+
onChange: (d) => N((k) => ({ ...k, max: w(d) }))
|
|
434
|
+
}
|
|
435
|
+
)
|
|
436
|
+
] })
|
|
437
|
+
] }),
|
|
438
|
+
/* @__PURE__ */ u("div", { className: _.rangeFooter, children: [
|
|
439
|
+
/* @__PURE__ */ a(b, { theme: "light", type: "tertiary", size: "small", disabled: !v, onClick: () => f({}), children: "清除" }),
|
|
440
|
+
/* @__PURE__ */ a(b, { theme: "solid", type: "primary", size: "small", disabled: T, onClick: () => f(m), children: "确定" })
|
|
441
|
+
] })
|
|
442
|
+
] }),
|
|
443
|
+
children: /* @__PURE__ */ a(P, { text: y, ariaLabel: `${e}:${v ? y : "不限"}`, active: v, open: c })
|
|
444
|
+
}
|
|
445
|
+
);
|
|
446
|
+
}, Ja = ({ label: e, value: r, options: t, onChange: l }) => /* @__PURE__ */ a("div", { className: _.capsules, role: "radiogroup", "aria-label": e, children: t.map((s) => {
|
|
447
|
+
const n = s.value === r;
|
|
448
|
+
return /* @__PURE__ */ a(
|
|
449
|
+
b,
|
|
450
|
+
{
|
|
451
|
+
theme: "borderless",
|
|
452
|
+
type: "primary",
|
|
453
|
+
role: "radio",
|
|
454
|
+
"aria-checked": n,
|
|
455
|
+
className: _.capsule,
|
|
456
|
+
"data-active": n ? "true" : "false",
|
|
457
|
+
onClick: () => l(s.value),
|
|
458
|
+
children: s.label
|
|
459
|
+
},
|
|
460
|
+
s.value
|
|
461
|
+
);
|
|
462
|
+
}) }), Qa = ({ value: e, options: r, onChange: t, plain: l = [], disabled: s = !1 }) => /* @__PURE__ */ u("div", { className: _.sortBar, role: "radiogroup", "aria-label": "排序", children: [
|
|
463
|
+
/* @__PURE__ */ a("span", { className: _.sortLabel, "aria-hidden": "true", children: "排序:" }),
|
|
464
|
+
r.map((n) => {
|
|
465
|
+
const i = n.value === e;
|
|
466
|
+
return /* @__PURE__ */ u(
|
|
467
|
+
b,
|
|
468
|
+
{
|
|
469
|
+
theme: "borderless",
|
|
470
|
+
type: "primary",
|
|
471
|
+
role: "radio",
|
|
472
|
+
"aria-checked": i,
|
|
473
|
+
disabled: s,
|
|
474
|
+
className: _.sortItem,
|
|
475
|
+
"data-active": i ? "true" : "false",
|
|
476
|
+
onClick: () => t(n.value),
|
|
477
|
+
children: [
|
|
478
|
+
n.label,
|
|
479
|
+
l.includes(n.value) ? null : /* @__PURE__ */ a(ee, { className: _.sortArrow, "aria-hidden": "true" })
|
|
480
|
+
]
|
|
481
|
+
},
|
|
482
|
+
n.value
|
|
483
|
+
);
|
|
484
|
+
})
|
|
485
|
+
] }), ha = "_toolbar_o0ggg_3", ga = "_row_o0ggg_9", pa = "_controls_o0ggg_17", ba = "_search_o0ggg_25", fa = "_filters_o0ggg_30", va = "_actions_o0ggg_42", Na = "_selection_o0ggg_50", ya = "_selectionMain_o0ggg_59", wa = "_selectionExtra_o0ggg_60", xa = "_selectionCount_o0ggg_67", Ca = "_selectionNumber_o0ggg_72", Ta = "_tableScroll_o0ggg_78", p = {
|
|
486
|
+
toolbar: ha,
|
|
487
|
+
row: ga,
|
|
488
|
+
controls: pa,
|
|
489
|
+
search: ba,
|
|
490
|
+
filters: fa,
|
|
491
|
+
actions: va,
|
|
492
|
+
selection: Na,
|
|
493
|
+
selectionMain: ya,
|
|
494
|
+
selectionExtra: wa,
|
|
495
|
+
selectionCount: xa,
|
|
496
|
+
selectionNumber: Ca,
|
|
497
|
+
tableScroll: Ta
|
|
498
|
+
}, Za = ({ search: e, filters: r, onReset: t, resetDisabled: l = !1, onRefresh: s, refreshing: n = !1, actions: i, extra: o, className: c }) => /* @__PURE__ */ u("div", { className: c ? `${p.toolbar} ${c}` : p.toolbar, children: [
|
|
499
|
+
/* @__PURE__ */ u("div", { className: p.row, role: "toolbar", "aria-label": "搜索与筛选", children: [
|
|
500
|
+
/* @__PURE__ */ u("div", { className: p.controls, children: [
|
|
501
|
+
e ? /* @__PURE__ */ a(
|
|
502
|
+
M,
|
|
503
|
+
{
|
|
504
|
+
className: p.search,
|
|
505
|
+
prefix: /* @__PURE__ */ a(O, { "aria-hidden": "true" }),
|
|
506
|
+
showClear: !0,
|
|
507
|
+
placeholder: e.placeholder ?? "搜索",
|
|
508
|
+
"aria-label": e.ariaLabel ?? e.placeholder ?? "搜索",
|
|
509
|
+
value: e.value,
|
|
510
|
+
onChange: e.onChange,
|
|
511
|
+
onEnterPress: () => {
|
|
512
|
+
var h;
|
|
513
|
+
return (h = e.onSearch) == null ? void 0 : h.call(e, e.value);
|
|
514
|
+
},
|
|
515
|
+
onClear: () => {
|
|
516
|
+
var h;
|
|
517
|
+
return (h = e.onSearch) == null ? void 0 : h.call(e, "");
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
) : null,
|
|
521
|
+
r ? /* @__PURE__ */ a("div", { className: p.filters, children: r }) : null,
|
|
522
|
+
t ? /* @__PURE__ */ a(b, { theme: "light", type: "tertiary", icon: /* @__PURE__ */ a(ae, { "aria-hidden": "true" }), disabled: l, onClick: t, children: "重置" }) : null
|
|
523
|
+
] }),
|
|
524
|
+
s || i ? /* @__PURE__ */ u("div", { className: p.actions, children: [
|
|
525
|
+
s ? /* @__PURE__ */ a(b, { theme: "light", type: "tertiary", icon: /* @__PURE__ */ a(re, { "aria-hidden": "true" }), loading: n, onClick: s, children: "刷新" }) : null,
|
|
526
|
+
i
|
|
527
|
+
] }) : null
|
|
528
|
+
] }),
|
|
529
|
+
o
|
|
530
|
+
] }), er = ({ count: e, unit: r = "项", actions: t, extra: l, className: s }) => /* @__PURE__ */ u("div", { className: s ? `${p.selection} ${s}` : p.selection, children: [
|
|
531
|
+
/* @__PURE__ */ u("div", { className: p.selectionMain, children: [
|
|
532
|
+
/* @__PURE__ */ u("span", { className: p.selectionCount, "aria-live": "polite", children: [
|
|
533
|
+
"已选择 ",
|
|
534
|
+
/* @__PURE__ */ a("span", { className: p.selectionNumber, children: e }),
|
|
535
|
+
" ",
|
|
536
|
+
r
|
|
537
|
+
] }),
|
|
538
|
+
t
|
|
539
|
+
] }),
|
|
540
|
+
l ? /* @__PURE__ */ a("div", { className: p.selectionExtra, children: l }) : null
|
|
541
|
+
] }), ar = ({ minWidth: e, children: r, className: t }) => /* @__PURE__ */ a("div", { className: t ? `${p.tableScroll} ${t}` : p.tableScroll, children: /* @__PURE__ */ a("div", { style: { minWidth: e }, children: r }) }), ka = "_waterfall_3uefs_3", qa = "_column_3uefs_9", La = "_item_3uefs_17", E = {
|
|
542
|
+
waterfall: ka,
|
|
543
|
+
column: qa,
|
|
544
|
+
item: La
|
|
545
|
+
}, Ba = (e, r) => {
|
|
546
|
+
const t = Math.max(1, Math.floor(r)), l = Array.from({ length: t }, () => []), s = new Array(t).fill(0);
|
|
547
|
+
return e.forEach((n, i) => {
|
|
548
|
+
let o = 0;
|
|
549
|
+
for (let c = 1; c < t; c += 1)
|
|
550
|
+
s[c] < s[o] && (o = c);
|
|
551
|
+
l[o].push(i), s[o] += n;
|
|
552
|
+
}), l;
|
|
553
|
+
}, Sa = 5, $a = (e, r) => {
|
|
554
|
+
const t = e <= te.phone ? 10 : 20, l = Math.min(Sa, Math.max(2, Math.floor((e + t) / (r + t))));
|
|
555
|
+
return { columns: l, gap: t, columnWidth: (e - t * (l - 1)) / l };
|
|
556
|
+
}, Aa = 1100, Ia = () => {
|
|
557
|
+
const e = q(null), [r, t] = B(0);
|
|
558
|
+
return J(() => {
|
|
559
|
+
const l = e.current;
|
|
560
|
+
if (!l || (t(l.clientWidth), typeof ResizeObserver > "u")) return;
|
|
561
|
+
const s = new ResizeObserver(([n]) => t(Math.round(n.contentRect.width)));
|
|
562
|
+
return s.observe(l), () => s.disconnect();
|
|
563
|
+
}, []), [e, r];
|
|
564
|
+
}, rr = ({
|
|
565
|
+
items: e,
|
|
566
|
+
getKey: r,
|
|
567
|
+
estimateHeight: t,
|
|
568
|
+
renderItem: l,
|
|
569
|
+
minColumnWidth: s = 184,
|
|
570
|
+
ariaLabel: n
|
|
571
|
+
}) => {
|
|
572
|
+
const [i, o] = Ia(), c = $a(o || Aa, s), h = Ba(
|
|
573
|
+
e.map((m) => t(m, c.columnWidth)),
|
|
574
|
+
c.columns
|
|
575
|
+
);
|
|
576
|
+
return /* @__PURE__ */ a(
|
|
577
|
+
"div",
|
|
578
|
+
{
|
|
579
|
+
ref: i,
|
|
580
|
+
className: E.waterfall,
|
|
581
|
+
role: "list",
|
|
582
|
+
"aria-label": n,
|
|
583
|
+
style: { "--waterfall-gap": `${c.gap}px` },
|
|
584
|
+
children: h.map((m, N) => /* @__PURE__ */ a("div", { className: E.column, children: m.map((v) => /* @__PURE__ */ a("div", { role: "listitem", className: E.item, children: l(e[v]) }, r(e[v]))) }, N))
|
|
585
|
+
}
|
|
586
|
+
);
|
|
587
|
+
};
|
|
588
|
+
export {
|
|
589
|
+
Ma as C,
|
|
590
|
+
Ja as F,
|
|
591
|
+
Za as L,
|
|
592
|
+
Sa as M,
|
|
593
|
+
er as S,
|
|
594
|
+
ar as T,
|
|
595
|
+
rr as W,
|
|
596
|
+
Da as a,
|
|
597
|
+
Oa as b,
|
|
598
|
+
Ha as c,
|
|
599
|
+
ma as d,
|
|
600
|
+
Ya as e,
|
|
601
|
+
Va as f,
|
|
602
|
+
Xa as g,
|
|
603
|
+
Y as h,
|
|
604
|
+
Ua as i,
|
|
605
|
+
Ka as j,
|
|
606
|
+
V as k,
|
|
607
|
+
Qa as l,
|
|
608
|
+
Wa as m,
|
|
609
|
+
Ga as n,
|
|
610
|
+
ja as o,
|
|
611
|
+
Ba as p,
|
|
612
|
+
$a as w
|
|
613
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** 指标的语气:决定数值与环的颜色。品牌色之外只用状态色,不另起颜色。 */
|
|
3
|
+
export type MetricTone = 'brand' | 'success' | 'warning' | 'danger' | 'info' | 'neutral';
|
|
4
|
+
export interface MetricComparison {
|
|
5
|
+
/** 变化量,如 `12`、`'3.5%'`;正负号不显示,方向由 direction 表达;`'-'` 表示没有可比数据 */
|
|
6
|
+
value: string | number;
|
|
7
|
+
/** 与什么比,默认“较上次” */
|
|
8
|
+
label?: string;
|
|
9
|
+
direction?: 'increase' | 'decrease' | 'flat';
|
|
10
|
+
}
|
|
11
|
+
export interface MetricCardProps {
|
|
12
|
+
/** 指标名 */
|
|
13
|
+
label: string;
|
|
14
|
+
/** 指标名前的图标(20px,主色) */
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
/** 数值;写成 `'72%'` 这样的百分比时自动在数值旁画一个进度环 */
|
|
17
|
+
value: string | number;
|
|
18
|
+
/** 指标名旁问号里的解释 */
|
|
19
|
+
tip?: string;
|
|
20
|
+
/** 数值下面的一行说明 */
|
|
21
|
+
helper?: ReactNode;
|
|
22
|
+
/** 数值下面的升降对比;与 helper 同时给时显示对比 */
|
|
23
|
+
comparison?: MetricComparison;
|
|
24
|
+
tone?: MetricTone;
|
|
25
|
+
/** 内容居中(默认)或靠左 */
|
|
26
|
+
align?: 'center' | 'start';
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 指标卡:指标名、一个大数字、下面一行说明或升降对比。数值用数字字体(--app-font-family-number),颜色跟语气走;
|
|
31
|
+
* 百分比数值旁带一个进度环。几张指标卡并排时放进 MetricGrid。
|
|
32
|
+
*/
|
|
33
|
+
export declare const MetricCard: ({ label, icon, value, tip, helper, comparison, tone, align, className }: MetricCardProps) => import("react").JSX.Element;
|
|
34
|
+
export interface MetricGridProps {
|
|
35
|
+
/** 宽屏每行几张,默认 4;平板两张,手机一张 */
|
|
36
|
+
columns?: number;
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/** 指标卡的网格:宽屏按列数排,平板两列,手机一列,间距与页面里卡片之间的间距相同。 */
|
|
41
|
+
export declare const MetricGrid: ({ columns, children, className }: MetricGridProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** 状态的含义;颜色由含义决定,页面不自己挑颜色。 */
|
|
3
|
+
export type StatusTone = 'brand' | 'success' | 'warning' | 'danger' | 'info' | 'neutral';
|
|
4
|
+
export interface StatusTagProps {
|
|
5
|
+
/** success 完成、通过;warning 进行中、待处理、需留意;danger 失败、过期、拒绝;info 提示;brand 产品强调;neutral 中性(默认) */
|
|
6
|
+
tone?: StatusTone;
|
|
7
|
+
/** 文字前显示转圈,用于“生成中”“处理中”这类进行状态 */
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
/** 文字前的图标;loading 时不显示 */
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 状态标签:浅底深字、4px 圆角、24px 高的 Semi Tag,颜色按状态含义固定(成功绿、警示橙、危险红、提示蓝、品牌主色、中性灰)。
|
|
16
|
+
* 任务状态、订单状态、审核结果这类“一个词说明状态”的地方用它,同一种含义在所有产品里是同一个颜色。
|
|
17
|
+
*/
|
|
18
|
+
export declare const StatusTag: ({ tone, loading, icon, className, children }: StatusTagProps) => import("react").JSX.Element;
|