@24city/web-console 0.3.8 → 0.3.10

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,752 +0,0 @@
1
- import { jsx as a, jsxs as m, Fragment as D } from "react/jsx-runtime";
2
- import { RadioGroup as Q, Radio as Z, Typography as I, Skeleton as $, Input as W, Button as y, Dropdown as S, Popover as ee, InputNumber as q } from "@douyinfe/semi-ui";
3
- import { useRef as k, useLayoutEffect as O, useEffect as j, useState as A, forwardRef as H } from "react";
4
- import { IconClose as G, IconSearch as z, IconTick as ae, IconChevronDown as V, IconDelete as te, IconArrowDown as re, IconUndo as le, IconRefresh as se } from "@douyinfe/semi-icons";
5
- import { B as ne } from "./scale-smFifpMm.js";
6
- const ce = "_group_1f0zj_3", oe = "_loading_1f0zj_4", ie = "_skeleton_1f0zj_11", de = "_radio_1f0zj_28", ue = "_card_1f0zj_62", _e = "_title_1f0zj_90", me = "_description_1f0zj_101", B = {
7
- group: ce,
8
- loading: oe,
9
- skeleton: ie,
10
- radio: de,
11
- card: ue,
12
- title: _e,
13
- description: me
14
- }, K = (e) => ({ "--choice-columns": e }), lt = ({
15
- ariaLabel: e,
16
- value: r,
17
- options: t,
18
- onChange: n,
19
- columns: s = 4
20
- }) => /* @__PURE__ */ a("div", { role: "radiogroup", "aria-label": e, children: /* @__PURE__ */ a(
21
- Q,
22
- {
23
- name: e,
24
- className: B.group,
25
- style: K(s),
26
- value: r,
27
- onChange: (c) => n(c.target.value),
28
- children: t.map((c) => {
29
- const d = c.unavailable ?? c.description, o = c.value === r;
30
- return /* @__PURE__ */ a(Z, { value: c.value, className: B.radio, children: /* @__PURE__ */ m("span", { className: B.card, "data-checked": o ? "true" : "false", "data-unavailable": c.unavailable ? "true" : void 0, children: [
31
- /* @__PURE__ */ a(I.Text, { className: B.title, children: c.title }),
32
- d ? /* @__PURE__ */ a(I.Text, { className: B.description, ellipsis: !0, children: d }) : null
33
- ] }) }, c.value || "all");
34
- })
35
- }
36
- ) }), st = ({ count: e, columns: r = 4 }) => /* @__PURE__ */ a("div", { className: B.loading, style: K(r), "aria-busy": "true", children: Array.from({ length: e }, (t, n) => /* @__PURE__ */ a($, { loading: !0, active: !0, className: B.skeleton, placeholder: /* @__PURE__ */ a($.Paragraph, { rows: 2 }) }, n)) }), he = "_square_1aeey_8", ge = "_hiddenTitle_1aeey_27", pe = "_heroTitle_1aeey_39", fe = "_heroAccent_1aeey_51", be = "_searchBar_1aeey_59", ye = "_searchBox_1aeey_73", ve = "_searchInput_1aeey_79", Ne = "_searchPrefix_1aeey_115", we = "_searchButton_1aeey_124", Ce = "_guide_1aeey_132", xe = "_guideLabel_1aeey_140", Te = "_guideTag_1aeey_146", ke = "_guideClear_1aeey_166", Le = "_stage_1aeey_173", Be = "_modeTabs_1aeey_180", Ae = "_modeTab_1aeey_180", Se = "_keycap_1aeey_259", Ie = "_searchTextButton_1aeey_274", $e = "_categories_1aeey_282", Fe = "_panel_1aeey_287", Ee = "_nav_1aeey_294", Re = "_filters_1aeey_337", Pe = "_toolbarStart_1aeey_357", ze = "_filtersGroup_1aeey_364", je = "_results_1aeey_372", Me = "_footer_1aeey_381", h = {
37
- square: he,
38
- hiddenTitle: ge,
39
- heroTitle: pe,
40
- heroAccent: fe,
41
- searchBar: be,
42
- searchBox: ye,
43
- searchInput: ve,
44
- searchPrefix: Ne,
45
- searchButton: we,
46
- guide: Ce,
47
- guideLabel: xe,
48
- guideTag: Te,
49
- guideClear: ke,
50
- stage: Le,
51
- modeTabs: Be,
52
- modeTab: Ae,
53
- keycap: Se,
54
- searchTextButton: Ie,
55
- categories: $e,
56
- panel: Fe,
57
- nav: Ee,
58
- filters: Re,
59
- toolbarStart: Pe,
60
- filtersGroup: ze,
61
- results: je,
62
- footer: Me
63
- }, qe = (e, r, t) => {
64
- j(() => {
65
- const n = e.current, s = r.current, c = t.current;
66
- if (!n || !s || !c) return;
67
- let d = 0;
68
- const o = () => {
69
- d = 0;
70
- const u = Number.parseFloat(getComputedStyle(n).getPropertyValue("--app-header-height")) || 0, _ = s.getBoundingClientRect().top, b = _ + window.scrollY - u, p = b > 0 ? Math.min(1, Math.max(0, window.scrollY / b)) : 1;
71
- n.style.setProperty("--hero-progress", p.toFixed(3));
72
- const v = Number.parseFloat(getComputedStyle(c).top);
73
- n.dataset.stuck = Number.isFinite(v) && _ < v - 0.5 ? "true" : "false";
74
- }, l = () => {
75
- d || (d = window.requestAnimationFrame(o));
76
- };
77
- return o(), window.addEventListener("scroll", l, { passive: !0 }), window.addEventListener("resize", l), () => {
78
- window.removeEventListener("scroll", l), window.removeEventListener("resize", l), window.cancelAnimationFrame(d);
79
- };
80
- }, [e, r, t]);
81
- }, nt = ({
82
- ariaLabel: e,
83
- placeholder: r,
84
- value: t,
85
- onChange: n,
86
- onSearch: s,
87
- inputRef: c,
88
- keyShortcut: d,
89
- guide: o,
90
- prefix: l,
91
- modes: u,
92
- buttonText: _
93
- }) => {
94
- var T;
95
- const b = !t && o && o.items.length > 0, p = !!(u || _), v = /* @__PURE__ */ a(
96
- W,
97
- {
98
- ref: c,
99
- className: h.searchInput,
100
- "aria-label": e,
101
- "aria-keyshortcuts": d,
102
- showClear: !0,
103
- maxLength: 80,
104
- placeholder: r,
105
- value: t,
106
- onChange: n,
107
- onEnterPress: () => s(t),
108
- onClear: () => s(""),
109
- prefix: l ? /* @__PURE__ */ a("span", { className: h.searchPrefix, children: l }) : void 0,
110
- suffix: /* @__PURE__ */ m(D, { children: [
111
- b ? /* @__PURE__ */ m("span", { className: h.guide, role: "group", "aria-label": o.label, children: [
112
- /* @__PURE__ */ a(I.Text, { className: h.guideLabel, children: o.label }),
113
- o.items.map((f) => /* @__PURE__ */ a(y, { theme: "light", type: "tertiary", size: "small", className: h.guideTag, onClick: () => s(f), children: f }, f)),
114
- o.onClear ? /* @__PURE__ */ a(
115
- y,
116
- {
117
- theme: "borderless",
118
- type: "primary",
119
- size: "small",
120
- className: h.guideClear,
121
- icon: /* @__PURE__ */ a(G, { "aria-hidden": "true" }),
122
- "aria-label": `清空${o.label}`,
123
- onClick: o.onClear
124
- }
125
- ) : null
126
- ] }) : null,
127
- p && d && !t ? /* @__PURE__ */ a("span", { className: h.keycap, "aria-hidden": "true", children: d }) : null,
128
- _ ? /* @__PURE__ */ a(
129
- y,
130
- {
131
- theme: "solid",
132
- type: "primary",
133
- className: h.searchTextButton,
134
- icon: /* @__PURE__ */ a(z, { "aria-hidden": "true" }),
135
- onClick: () => s(t),
136
- children: _
137
- }
138
- ) : /* @__PURE__ */ a(
139
- y,
140
- {
141
- theme: "solid",
142
- type: "primary",
143
- className: h.searchButton,
144
- icon: /* @__PURE__ */ a(z, { "aria-hidden": "true" }),
145
- "aria-label": "检索",
146
- onClick: () => s(t)
147
- }
148
- )
149
- ] })
150
- }
151
- );
152
- if (!p) return v;
153
- const N = u !== void 0 && ((T = u.options[0]) == null ? void 0 : T.value) === u.value;
154
- return /* @__PURE__ */ m("div", { className: h.stage, "data-first-mode": N ? "true" : void 0, children: [
155
- u ? /* @__PURE__ */ a("div", { className: h.modeTabs, role: "radiogroup", "aria-label": u.label, "data-square-modes": "", children: u.options.map((f) => {
156
- const i = f.value === u.value;
157
- return /* @__PURE__ */ a(
158
- y,
159
- {
160
- theme: "borderless",
161
- type: "tertiary",
162
- role: "radio",
163
- "aria-checked": i,
164
- className: h.modeTab,
165
- "data-active": i ? "true" : "false",
166
- onClick: () => u.onChange(f.value),
167
- children: f.label
168
- },
169
- f.value
170
- );
171
- }) }) : null,
172
- v
173
- ] });
174
- }, ct = ({ children: e }) => /* @__PURE__ */ a("span", { className: h.heroAccent, children: e }), ot = ({
175
- testId: e,
176
- title: r,
177
- nav: t,
178
- search: n,
179
- categories: s,
180
- filters: c,
181
- toolbarLeft: d,
182
- toolbarRight: o,
183
- conditionKey: l,
184
- children: u
185
- }) => {
186
- const _ = k(null), b = k(null), p = k(null), v = k(null), N = k(null);
187
- qe(_, b, p), O(() => {
188
- const f = _.current, i = p.current;
189
- if (!f || !i) return;
190
- const C = i.querySelector("[data-square-modes]") ? "true" : "false";
191
- f.dataset.modes !== C && (f.dataset.modes = C);
192
- });
193
- const T = k(l);
194
- return j(() => {
195
- if (T.current === l) return;
196
- T.current = l;
197
- const f = N.current, i = v.current;
198
- if (!f || !i) return;
199
- const C = f.getBoundingClientRect().top - i.getBoundingClientRect().bottom;
200
- C < 0 && window.scrollBy({ top: C });
201
- }, [l]), /* @__PURE__ */ m(
202
- "section",
203
- {
204
- ref: _,
205
- className: h.square,
206
- "data-testid": e,
207
- "data-categories": s ? "true" : "false",
208
- "data-filters": c ? "true" : "false",
209
- "data-nav": t ? "true" : "false",
210
- children: [
211
- r ? /* @__PURE__ */ a(I.Title, { heading: 1, className: t ? h.hiddenTitle : h.heroTitle, children: r }) : null,
212
- t ? /* @__PURE__ */ a("div", { className: h.nav, children: t }) : null,
213
- /* @__PURE__ */ a("div", { ref: b, "aria-hidden": "true" }),
214
- /* @__PURE__ */ a("div", { ref: p, className: h.searchBar, children: /* @__PURE__ */ a("div", { className: h.searchBox, children: n }) }),
215
- s ? /* @__PURE__ */ a("div", { className: h.categories, children: s }) : null,
216
- c ? /* @__PURE__ */ a("div", { className: h.panel, children: c }) : null,
217
- /* @__PURE__ */ m("div", { ref: v, className: h.filters, role: "toolbar", "aria-label": "排序与视图", children: [
218
- /* @__PURE__ */ a("div", { className: h.toolbarStart, children: d }),
219
- /* @__PURE__ */ a("div", { className: h.filtersGroup, children: o })
220
- ] }),
221
- /* @__PURE__ */ a("div", { ref: N, className: h.results, children: u })
222
- ]
223
- }
224
- );
225
- }, it = ({ children: e, footerRef: r }) => /* @__PURE__ */ a("div", { ref: r, className: h.footer, children: e }), De = "_tabs_6jcnc_6", We = "_tab_6jcnc_6", Oe = "_fan_6jcnc_109", He = "_cover_6jcnc_117", Ge = "_coverImage_6jcnc_150", Ve = "_text_6jcnc_185", Ke = "_label_6jcnc_192", Ye = "_hint_6jcnc_217", Ue = "_skeletonLabel_6jcnc_241", x = {
226
- tabs: De,
227
- tab: We,
228
- fan: Oe,
229
- cover: He,
230
- coverImage: Ge,
231
- text: Ve,
232
- label: Ke,
233
- hint: Ye,
234
- skeletonLabel: Ue
235
- }, Xe = 3, Y = (e) => ({ "--cover-tab-count": e }), Je = ({ src: e }) => {
236
- const [r, t] = A(), [n, s] = A();
237
- return /* @__PURE__ */ a("span", { className: x.cover, "data-loaded": e && r === e ? "true" : void 0, children: e && n !== e ? /* @__PURE__ */ a(
238
- "img",
239
- {
240
- className: x.coverImage,
241
- src: e,
242
- alt: "",
243
- loading: "lazy",
244
- decoding: "async",
245
- draggable: !1,
246
- onLoad: () => t(e),
247
- onError: () => s(e)
248
- }
249
- ) : null });
250
- }, U = ({ covers: e }) => /* @__PURE__ */ a("span", { className: x.fan, "aria-hidden": "true", children: Array.from({ length: Xe }, (r, t) => /* @__PURE__ */ a(Je, { src: e == null ? void 0 : e[t] }, t)) }), dt = ({ ariaLabel: e, value: r, options: t, onChange: n }) => {
251
- var o;
252
- const s = k(null);
253
- j(() => {
254
- const l = s.current, u = l == null ? void 0 : l.querySelector('[aria-selected="true"]');
255
- !l || !u || l.scrollWidth <= l.clientWidth || (l.scrollLeft = u.offsetLeft - (l.clientWidth - u.offsetWidth) / 2);
256
- }, [r]);
257
- const c = t.some((l) => l.value === r) ? r : (o = t[0]) == null ? void 0 : o.value, d = (l, u) => {
258
- var p, v;
259
- const _ = t.length - 1, b = l.key === "ArrowRight" || l.key === "ArrowDown" ? u === _ ? 0 : u + 1 : l.key === "ArrowLeft" || l.key === "ArrowUp" ? u === 0 ? _ : u - 1 : l.key === "Home" ? 0 : l.key === "End" ? _ : -1;
260
- b < 0 || (l.preventDefault(), (v = (p = s.current) == null ? void 0 : p.querySelectorAll('[role="tab"]')[b]) == null || v.focus());
261
- };
262
- return /* @__PURE__ */ a(
263
- "div",
264
- {
265
- ref: s,
266
- role: "tablist",
267
- "aria-label": e,
268
- className: x.tabs,
269
- "data-dense": t.length > 4 ? "true" : void 0,
270
- style: Y(t.length),
271
- children: t.map((l, u) => {
272
- const _ = l.value === r;
273
- return /* @__PURE__ */ m(
274
- y,
275
- {
276
- theme: "borderless",
277
- type: "tertiary",
278
- role: "tab",
279
- "aria-selected": _,
280
- "aria-label": l.unavailable ? `${l.label},${l.unavailable}` : void 0,
281
- tabIndex: l.value === c ? 0 : -1,
282
- className: x.tab,
283
- "data-active": _ ? "true" : "false",
284
- "data-unavailable": l.unavailable ? "true" : void 0,
285
- onClick: () => n(l.value),
286
- onKeyDown: (b) => d(b, u),
287
- children: [
288
- /* @__PURE__ */ a(U, { covers: l.covers }),
289
- /* @__PURE__ */ m("span", { className: x.text, children: [
290
- /* @__PURE__ */ a("span", { className: x.label, children: l.label }),
291
- l.unavailable ? /* @__PURE__ */ a("span", { className: x.hint, children: l.unavailable }) : null
292
- ] })
293
- ]
294
- },
295
- l.value
296
- );
297
- })
298
- }
299
- );
300
- }, ut = ({ count: e, active: r = !0 }) => /* @__PURE__ */ a("div", { className: x.tabs, "data-dense": e > 4 ? "true" : void 0, style: Y(e), "aria-busy": r ? "true" : void 0, children: Array.from({ length: e }, (t, n) => /* @__PURE__ */ m("span", { className: x.tab, "data-skeleton": "true", children: [
301
- /* @__PURE__ */ a(U, {}),
302
- /* @__PURE__ */ a($, { loading: !0, active: r, placeholder: /* @__PURE__ */ a($.Title, { className: x.skeletonLabel }) })
303
- ] }, n)) }), Qe = "_trigger_iy209_3", Ze = "_text_iy209_27", ea = "_prefix_iy209_32", aa = "_arrow_iy209_50", ta = "_menu_iy209_60", ra = "_checkItem_iy209_64", la = "_check_iy209_64", sa = "_checkHidden_iy209_75", L = {
304
- trigger: Qe,
305
- text: Ze,
306
- prefix: ea,
307
- arrow: aa,
308
- menu: ta,
309
- checkItem: ra,
310
- check: la,
311
- checkHidden: sa
312
- }, X = H(
313
- ({ text: e, ariaLabel: r, active: t = !1, empty: n = !1, icon: s, arrow: c = !0, pressed: d, onClick: o, ...l }, u) => /* @__PURE__ */ m(
314
- y,
315
- {
316
- theme: "borderless",
317
- type: "primary",
318
- ...l,
319
- ref: u,
320
- className: L.trigger,
321
- "data-active": t ? "true" : "false",
322
- "data-empty": n ? "true" : "false",
323
- "aria-label": r,
324
- "aria-pressed": d,
325
- onClick: o,
326
- children: [
327
- s ? /* @__PURE__ */ a("span", { className: L.prefix, children: s }) : null,
328
- /* @__PURE__ */ a("span", { className: L.text, children: e }),
329
- c ? /* @__PURE__ */ a(V, { className: L.arrow, "aria-hidden": "true" }) : null
330
- ]
331
- }
332
- )
333
- );
334
- X.displayName = "FilterTrigger";
335
- const F = "__all__", _t = ({
336
- label: e,
337
- placeholder: r,
338
- value: t,
339
- options: n,
340
- onChange: s,
341
- allLabel: c,
342
- icon: d,
343
- arrow: o = !0,
344
- checkmark: l = !1,
345
- position: u = "bottomLeft",
346
- disabled: _ = !1,
347
- highlight: b = !0
348
- }) => {
349
- const [p, v] = A(!1), N = n.find((i) => i.value === t), T = c ? [{ value: F, label: c }, ...n] : n, f = t || (c ? F : "");
350
- return /* @__PURE__ */ a(
351
- S,
352
- {
353
- trigger: _ ? "custom" : "click",
354
- position: u,
355
- visible: _ ? !1 : p,
356
- onVisibleChange: v,
357
- render: /* @__PURE__ */ a(S.Menu, { className: L.menu, children: T.map((i) => /* @__PURE__ */ m(
358
- S.Item,
359
- {
360
- active: i.value === f,
361
- className: l ? L.checkItem : void 0,
362
- onClick: () => {
363
- v(!1), s(i.value === F ? "" : i.value);
364
- },
365
- children: [
366
- l ? /* @__PURE__ */ a(ae, { className: i.value === f ? L.check : L.checkHidden, "aria-hidden": "true" }) : null,
367
- i.label
368
- ]
369
- },
370
- i.value
371
- )) }),
372
- children: /* @__PURE__ */ a(
373
- X,
374
- {
375
- text: (N == null ? void 0 : N.label) ?? r ?? e,
376
- ariaLabel: `${e}:${(N == null ? void 0 : N.label) ?? c ?? "未选择"}`,
377
- active: p,
378
- empty: !N || !b,
379
- icon: d,
380
- arrow: o
381
- }
382
- )
383
- }
384
- );
385
- }, na = "_panel_1rhpy_7", ca = "_row_1rhpy_18", oa = "_rowLabel_1rhpy_27", ia = "_rowContent_1rhpy_38", da = "_rowExtra_1rhpy_48", ua = "_option_1rhpy_58", _a = "_selectedTag_1rhpy_85", ma = "_selectedText_1rhpy_99", ha = "_selectedRemove_1rhpy_106", ga = "_clearButton_1rhpy_120", pa = "_selectText_1rhpy_135", fa = "_selectTextLabel_1rhpy_163", ba = "_selectTextArrow_1rhpy_170", ya = "_menu_1rhpy_186", va = "_rangePanel_1rhpy_192", Na = "_rangePresets_1rhpy_199", wa = "_rangePreset_1rhpy_199", Ca = "_rangeCustom_1rhpy_229", xa = "_rangeDash_1rhpy_237", Ta = "_rangeFooter_1rhpy_241", ka = "_capsules_1rhpy_249", La = "_capsule_1rhpy_249", Ba = "_sortBar_1rhpy_289", Aa = "_sortLabel_1rhpy_303", Sa = "_sortItem_1rhpy_311", Ia = "_sortArrow_1rhpy_334", g = {
386
- panel: na,
387
- row: ca,
388
- rowLabel: oa,
389
- rowContent: ia,
390
- rowExtra: da,
391
- option: ua,
392
- selectedTag: _a,
393
- selectedText: ma,
394
- selectedRemove: ha,
395
- clearButton: ga,
396
- selectText: pa,
397
- selectTextLabel: fa,
398
- selectTextArrow: ba,
399
- menu: ya,
400
- rangePanel: va,
401
- rangePresets: Na,
402
- rangePreset: wa,
403
- rangeCustom: Ca,
404
- rangeDash: xa,
405
- rangeFooter: Ta,
406
- capsules: ka,
407
- capsule: La,
408
- sortBar: Ba,
409
- sortLabel: Aa,
410
- sortItem: Sa,
411
- sortArrow: Ia
412
- }, mt = ({ children: e, ariaLabel: r = "筛选条件" }) => /* @__PURE__ */ a("div", { className: g.panel, role: "group", "aria-label": r, children: e }), J = ({ label: e, children: r, extra: t }) => /* @__PURE__ */ m("div", { className: g.row, role: "group", "aria-label": e, children: [
413
- /* @__PURE__ */ a("div", { className: g.rowLabel, "aria-hidden": "true", children: e }),
414
- /* @__PURE__ */ a("div", { className: g.rowContent, children: r }),
415
- t ? /* @__PURE__ */ a("div", { className: g.rowExtra, children: t }) : null
416
- ] }), ht = ({ label: e, value: r, options: t, onChange: n }) => /* @__PURE__ */ a(J, { label: e, children: t.map((s) => /* @__PURE__ */ a(
417
- $a,
418
- {
419
- label: s.label,
420
- active: s.value === r,
421
- onClick: () => n(s.value === r ? "" : s.value)
422
- },
423
- s.value
424
- )) }), $a = ({
425
- label: e,
426
- active: r,
427
- onClick: t
428
- }) => /* @__PURE__ */ a(
429
- y,
430
- {
431
- theme: "borderless",
432
- type: "primary",
433
- className: g.option,
434
- "data-active": r ? "true" : "false",
435
- "aria-pressed": r,
436
- onClick: t,
437
- children: e
438
- }
439
- ), gt = ({
440
- conditions: e,
441
- onClear: r
442
- }) => e.length === 0 ? null : /* @__PURE__ */ m(J, { label: "已选条件", children: [
443
- e.map((t) => /* @__PURE__ */ m("span", { className: g.selectedTag, children: [
444
- /* @__PURE__ */ a("span", { className: g.selectedText, children: t.label }),
445
- /* @__PURE__ */ a(
446
- y,
447
- {
448
- theme: "borderless",
449
- type: "primary",
450
- size: "small",
451
- className: g.selectedRemove,
452
- icon: /* @__PURE__ */ a(G, { "aria-hidden": "true" }),
453
- "aria-label": `移除 ${t.label}`,
454
- onClick: t.onRemove
455
- }
456
- )
457
- ] }, t.key)),
458
- /* @__PURE__ */ a(y, { theme: "borderless", type: "primary", size: "small", className: g.clearButton, icon: /* @__PURE__ */ a(te, { "aria-hidden": "true" }), onClick: r, children: "清空" })
459
- ] }), E = "__all__", pt = ({ placeholder: e, label: r, value: t, options: n, onChange: s }) => {
460
- const [c, d] = A(!1), o = n.find((l) => l.value === t);
461
- return /* @__PURE__ */ a(
462
- S,
463
- {
464
- trigger: "click",
465
- position: "bottomLeft",
466
- visible: c,
467
- onVisibleChange: d,
468
- render: /* @__PURE__ */ a(S.Menu, { className: g.menu, children: [{ value: E, label: e }, ...n].map((l) => /* @__PURE__ */ a(
469
- S.Item,
470
- {
471
- active: l.value === (t || E),
472
- onClick: () => {
473
- d(!1), s(l.value === E ? "" : l.value);
474
- },
475
- children: l.label
476
- },
477
- l.value
478
- )) }),
479
- children: /* @__PURE__ */ a(
480
- M,
481
- {
482
- text: (o == null ? void 0 : o.label) ?? e,
483
- ariaLabel: `${r}:${(o == null ? void 0 : o.label) ?? "不限"}`,
484
- active: !!o,
485
- open: c
486
- }
487
- )
488
- }
489
- );
490
- }, M = H(
491
- ({ text: e, ariaLabel: r, active: t, open: n, ...s }, c) => /* @__PURE__ */ m(
492
- y,
493
- {
494
- theme: "borderless",
495
- type: "primary",
496
- ...s,
497
- ref: c,
498
- className: g.selectText,
499
- "data-active": t ? "true" : "false",
500
- "data-open": n ? "true" : "false",
501
- "aria-label": r,
502
- children: [
503
- /* @__PURE__ */ a("span", { className: g.selectTextLabel, children: e }),
504
- /* @__PURE__ */ a(V, { className: g.selectTextArrow, "aria-hidden": "true" })
505
- ]
506
- }
507
- )
508
- );
509
- M.displayName = "SelectTextTrigger";
510
- const R = (e, r) => e.min === r.min && e.max === r.max, ft = ({ label: e, value: r, presets: t, onChange: n, limit: s, unit: c, minOnly: d = !1, format: o }) => {
511
- const [l, u] = A(!1), [_, b] = A(r), p = r.min !== void 0 || r.max !== void 0, v = p ? o(r) : e, N = (i) => {
512
- u(!1), n(i);
513
- }, T = _.min === void 0 && _.max === void 0 || _.min !== void 0 && _.max !== void 0 && _.min > _.max, f = (i) => {
514
- const C = typeof i == "number" ? i : typeof i == "string" && i.trim() !== "" ? Number(i) : NaN;
515
- return Number.isFinite(C) ? Math.round(C) : void 0;
516
- };
517
- return /* @__PURE__ */ a(
518
- ee,
519
- {
520
- trigger: "click",
521
- position: "bottomLeft",
522
- visible: l,
523
- onVisibleChange: (i) => {
524
- u(i), i && b(r);
525
- },
526
- content: /* @__PURE__ */ m("div", { className: g.rangePanel, role: "group", "aria-label": e, children: [
527
- /* @__PURE__ */ a("div", { className: g.rangePresets, children: t.map((i) => /* @__PURE__ */ a(
528
- y,
529
- {
530
- theme: "borderless",
531
- type: "primary",
532
- className: g.rangePreset,
533
- "data-active": R(i, r) ? "true" : "false",
534
- "aria-pressed": R(i, r),
535
- onClick: () => N(R(i, r) ? {} : { min: i.min, max: i.max }),
536
- children: i.label
537
- },
538
- i.label
539
- )) }),
540
- /* @__PURE__ */ m("div", { className: g.rangeCustom, children: [
541
- /* @__PURE__ */ a(
542
- q,
543
- {
544
- size: "small",
545
- "aria-label": d ? `${e}不低于` : `${e}最小值`,
546
- placeholder: d ? "不低于" : "最小",
547
- min: 0,
548
- max: s,
549
- precision: 0,
550
- suffix: c,
551
- value: _.min,
552
- onChange: (i) => b((C) => ({ ...C, min: f(i) }))
553
- }
554
- ),
555
- d ? null : /* @__PURE__ */ m(D, { children: [
556
- /* @__PURE__ */ a("span", { className: g.rangeDash, children: "–" }),
557
- /* @__PURE__ */ a(
558
- q,
559
- {
560
- size: "small",
561
- "aria-label": `${e}最大值`,
562
- placeholder: "最大",
563
- min: 0,
564
- max: s,
565
- precision: 0,
566
- suffix: c,
567
- value: _.max,
568
- onChange: (i) => b((C) => ({ ...C, max: f(i) }))
569
- }
570
- )
571
- ] })
572
- ] }),
573
- /* @__PURE__ */ m("div", { className: g.rangeFooter, children: [
574
- /* @__PURE__ */ a(y, { theme: "light", type: "tertiary", size: "small", disabled: !p, onClick: () => N({}), children: "清除" }),
575
- /* @__PURE__ */ a(y, { theme: "solid", type: "primary", size: "small", disabled: T, onClick: () => N(_), children: "确定" })
576
- ] })
577
- ] }),
578
- children: /* @__PURE__ */ a(M, { text: v, ariaLabel: `${e}:${p ? v : "不限"}`, active: p, open: l })
579
- }
580
- );
581
- }, bt = ({ label: e, value: r, options: t, onChange: n, size: s = "default" }) => /* @__PURE__ */ a("div", { className: g.capsules, role: "radiogroup", "aria-label": e, "data-size": s, children: t.map((c) => {
582
- const d = c.value === r;
583
- return /* @__PURE__ */ a(
584
- y,
585
- {
586
- theme: "borderless",
587
- type: "primary",
588
- role: "radio",
589
- "aria-checked": d,
590
- className: g.capsule,
591
- "data-active": d ? "true" : "false",
592
- "data-danger": c.danger ? "true" : void 0,
593
- onClick: () => n(c.value),
594
- children: c.label
595
- },
596
- c.value
597
- );
598
- }) }), yt = ({ value: e, options: r, onChange: t, plain: n = [], disabled: s = !1 }) => /* @__PURE__ */ m("div", { className: g.sortBar, role: "radiogroup", "aria-label": "排序", children: [
599
- /* @__PURE__ */ a("span", { className: g.sortLabel, "aria-hidden": "true", children: "排序:" }),
600
- r.map((c) => {
601
- const d = c.value === e;
602
- return /* @__PURE__ */ m(
603
- y,
604
- {
605
- theme: "borderless",
606
- type: "primary",
607
- role: "radio",
608
- "aria-checked": d,
609
- disabled: s,
610
- className: g.sortItem,
611
- "data-active": d ? "true" : "false",
612
- onClick: () => t(c.value),
613
- children: [
614
- c.label,
615
- n.includes(c.value) ? null : /* @__PURE__ */ a(re, { className: g.sortArrow, "aria-hidden": "true" })
616
- ]
617
- },
618
- c.value
619
- );
620
- })
621
- ] }), Fa = "_toolbar_o0ggg_3", Ea = "_row_o0ggg_9", Ra = "_controls_o0ggg_17", Pa = "_search_o0ggg_25", za = "_filters_o0ggg_30", ja = "_actions_o0ggg_42", Ma = "_selection_o0ggg_50", qa = "_selectionMain_o0ggg_59", Da = "_selectionExtra_o0ggg_60", Wa = "_selectionCount_o0ggg_67", Oa = "_selectionNumber_o0ggg_72", Ha = "_tableScroll_o0ggg_78", w = {
622
- toolbar: Fa,
623
- row: Ea,
624
- controls: Ra,
625
- search: Pa,
626
- filters: za,
627
- actions: ja,
628
- selection: Ma,
629
- selectionMain: qa,
630
- selectionExtra: Da,
631
- selectionCount: Wa,
632
- selectionNumber: Oa,
633
- tableScroll: Ha
634
- }, vt = ({ search: e, filters: r, onReset: t, resetDisabled: n = !1, onRefresh: s, refreshing: c = !1, actions: d, extra: o, className: l }) => /* @__PURE__ */ m("div", { className: l ? `${w.toolbar} ${l}` : w.toolbar, children: [
635
- /* @__PURE__ */ m("div", { className: w.row, role: "toolbar", "aria-label": "搜索与筛选", children: [
636
- /* @__PURE__ */ m("div", { className: w.controls, children: [
637
- e ? /* @__PURE__ */ a(
638
- W,
639
- {
640
- className: w.search,
641
- prefix: /* @__PURE__ */ a(z, { "aria-hidden": "true" }),
642
- showClear: !0,
643
- placeholder: e.placeholder ?? "搜索",
644
- "aria-label": e.ariaLabel ?? e.placeholder ?? "搜索",
645
- value: e.value,
646
- onChange: e.onChange,
647
- onEnterPress: () => {
648
- var u;
649
- return (u = e.onSearch) == null ? void 0 : u.call(e, e.value);
650
- },
651
- onClear: () => {
652
- var u;
653
- return (u = e.onSearch) == null ? void 0 : u.call(e, "");
654
- }
655
- }
656
- ) : null,
657
- r ? /* @__PURE__ */ a("div", { className: w.filters, children: r }) : null,
658
- t ? /* @__PURE__ */ a(y, { theme: "light", type: "tertiary", icon: /* @__PURE__ */ a(le, { "aria-hidden": "true" }), disabled: n, onClick: t, children: "重置" }) : null
659
- ] }),
660
- s || d ? /* @__PURE__ */ m("div", { className: w.actions, children: [
661
- s ? /* @__PURE__ */ a(y, { theme: "light", type: "tertiary", icon: /* @__PURE__ */ a(se, { "aria-hidden": "true" }), loading: c, onClick: s, children: "刷新" }) : null,
662
- d
663
- ] }) : null
664
- ] }),
665
- o
666
- ] }), Nt = ({ count: e, unit: r = "项", actions: t, extra: n, className: s }) => /* @__PURE__ */ m("div", { className: s ? `${w.selection} ${s}` : w.selection, children: [
667
- /* @__PURE__ */ m("div", { className: w.selectionMain, children: [
668
- /* @__PURE__ */ m("span", { className: w.selectionCount, "aria-live": "polite", children: [
669
- "已选择 ",
670
- /* @__PURE__ */ a("span", { className: w.selectionNumber, children: e }),
671
- " ",
672
- r
673
- ] }),
674
- t
675
- ] }),
676
- n ? /* @__PURE__ */ a("div", { className: w.selectionExtra, children: n }) : null
677
- ] }), wt = ({ minWidth: e, children: r, className: t }) => /* @__PURE__ */ a("div", { className: t ? `${w.tableScroll} ${t}` : w.tableScroll, children: /* @__PURE__ */ a("div", { style: { minWidth: e }, children: r }) }), Ga = "_waterfall_3uefs_3", Va = "_column_3uefs_9", Ka = "_item_3uefs_17", P = {
678
- waterfall: Ga,
679
- column: Va,
680
- item: Ka
681
- }, Ya = (e, r) => {
682
- const t = Math.max(1, Math.floor(r)), n = Array.from({ length: t }, () => []), s = new Array(t).fill(0);
683
- return e.forEach((c, d) => {
684
- let o = 0;
685
- for (let l = 1; l < t; l += 1)
686
- s[l] < s[o] && (o = l);
687
- n[o].push(d), s[o] += c;
688
- }), n;
689
- }, Ua = 5, Xa = (e, r) => {
690
- const t = e <= ne.phone ? 10 : 20, n = Math.min(Ua, Math.max(2, Math.floor((e + t) / (r + t))));
691
- return { columns: n, gap: t, columnWidth: (e - t * (n - 1)) / n };
692
- }, Ja = 1100, Qa = () => {
693
- const e = k(null), [r, t] = A(0);
694
- return O(() => {
695
- const n = e.current;
696
- if (!n || (t(n.clientWidth), typeof ResizeObserver > "u")) return;
697
- const s = new ResizeObserver(([c]) => t(Math.round(c.contentRect.width)));
698
- return s.observe(n), () => s.disconnect();
699
- }, []), [e, r];
700
- }, Ct = ({
701
- items: e,
702
- getKey: r,
703
- estimateHeight: t,
704
- renderItem: n,
705
- minColumnWidth: s = 184,
706
- ariaLabel: c
707
- }) => {
708
- const [d, o] = Qa(), l = Xa(o || Ja, s), u = Ya(
709
- e.map((_) => t(_, l.columnWidth)),
710
- l.columns
711
- );
712
- return /* @__PURE__ */ a(
713
- "div",
714
- {
715
- ref: d,
716
- className: P.waterfall,
717
- role: "list",
718
- "aria-label": c,
719
- style: { "--waterfall-gap": `${l.gap}px` },
720
- children: u.map((_, b) => /* @__PURE__ */ a("div", { className: P.column, children: _.map((p) => /* @__PURE__ */ a("div", { role: "listitem", className: P.item, children: n(e[p]) }, r(e[p]))) }, b))
721
- }
722
- );
723
- };
724
- export {
725
- Xe as C,
726
- bt as F,
727
- vt as L,
728
- Ua as M,
729
- Nt as S,
730
- wt as T,
731
- Ct as W,
732
- lt as a,
733
- st as b,
734
- ot as c,
735
- dt as d,
736
- ut as e,
737
- _t as f,
738
- $a as g,
739
- ht as h,
740
- mt as i,
741
- ft as j,
742
- J as k,
743
- pt as l,
744
- gt as m,
745
- X as n,
746
- yt as o,
747
- ct as p,
748
- it as q,
749
- nt as r,
750
- Ya as s,
751
- Xa as w
752
- };