@sia.soul/sia-react-ui 0.1.144 → 0.1.146
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/dist/chart.cjs +2 -0
- package/dist/chart.js +5 -5
- package/dist/{chunk-F52O2MOV.js → chunk-DEA5BI3R.js} +3 -3
- package/dist/{chunk-JRXYM5YH.js → chunk-HDN7EEGA.js} +2 -2
- package/dist/{chunk-566S64IP.js → chunk-HPPF5JGF.js} +4 -4
- package/dist/{chunk-ORSQAJ22.js → chunk-KDG2P3JA.js} +5 -5
- package/dist/{chunk-WCYVBO2N.js → chunk-KSXTC3PD.js} +4 -4
- package/dist/{chunk-MD4CGSOR.js → chunk-LY73KGUH.js} +6 -6
- package/dist/{chunk-LKLPCYEP.js → chunk-NRLIOMXY.js} +2 -2
- package/dist/{chunk-7SEGBB6V.js → chunk-OTVK3HGP.js} +1 -1
- package/dist/{chunk-4TYHSAR3.js → chunk-ROV3QYE6.js} +5 -5
- package/dist/{chunk-4OHS7RXE.js → chunk-SRWUDTCS.js} +2 -0
- package/dist/{chunk-PD3K5U5Y.js → chunk-XXFYFLZA.js} +2 -2
- package/dist/{chunk-ETQJ2DQ2.js → chunk-YO5OJQEH.js} +1 -1
- package/dist/{core-COaZfusa.d.cts → core-8jfdF5IF.d.cts} +3 -3
- package/dist/{core-CvfsQGuT.d.ts → core-BbgdopTV.d.ts} +3 -3
- package/dist/core.cjs +2 -0
- package/dist/core.css +94 -34
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +8 -8
- package/dist/game.cjs +2 -0
- package/dist/game.css +94 -34
- package/dist/game.js +3 -3
- package/dist/index.cjs +1638 -1369
- package/dist/index.css +104 -34
- package/dist/index.d.cts +54 -8
- package/dist/index.d.ts +54 -8
- package/dist/index.js +402 -137
- package/dist/markdown-editor.cjs +2 -0
- package/dist/markdown-editor.js +3 -3
- package/dist/rich-text-editor.cjs +2 -0
- package/dist/rich-text-editor.js +7 -7
- package/dist/select-date-range.cjs +2 -0
- package/dist/select-date-range.js +8 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
smoothSvgPath,
|
|
57
57
|
svgArcPath,
|
|
58
58
|
transferCompositeValue
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-DEA5BI3R.js";
|
|
60
60
|
import {
|
|
61
61
|
Badge,
|
|
62
62
|
Breadcrumb,
|
|
@@ -82,20 +82,20 @@ import {
|
|
|
82
82
|
Watermark,
|
|
83
83
|
message,
|
|
84
84
|
notification
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-LY73KGUH.js";
|
|
86
86
|
import "./chunk-RX242MUO.js";
|
|
87
87
|
import {
|
|
88
88
|
MarkdownEditor
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-XXFYFLZA.js";
|
|
90
90
|
import {
|
|
91
91
|
RichTextContent,
|
|
92
92
|
RichTextEditor
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-ROV3QYE6.js";
|
|
94
94
|
import {
|
|
95
95
|
DatePicker,
|
|
96
96
|
SelectDateRange,
|
|
97
97
|
TimePanel
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-HPPF5JGF.js";
|
|
99
99
|
import {
|
|
100
100
|
Checkbox,
|
|
101
101
|
OverflowTags,
|
|
@@ -107,17 +107,17 @@ import {
|
|
|
107
107
|
Tree,
|
|
108
108
|
normalizeSelectionValues,
|
|
109
109
|
usePressFeedback
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-KDG2P3JA.js";
|
|
111
111
|
import {
|
|
112
112
|
Dropdown,
|
|
113
113
|
Input,
|
|
114
114
|
Menu,
|
|
115
115
|
Segmented,
|
|
116
116
|
Steps
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-KSXTC3PD.js";
|
|
118
118
|
import {
|
|
119
119
|
TextArea
|
|
120
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-NRLIOMXY.js";
|
|
121
121
|
import {
|
|
122
122
|
FILLED_ICON_NAMES,
|
|
123
123
|
ICON_NAMES,
|
|
@@ -128,13 +128,13 @@ import {
|
|
|
128
128
|
Skeleton,
|
|
129
129
|
useOverlayExitPlaceholder,
|
|
130
130
|
useOverlayLifecycle
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-HDN7EEGA.js";
|
|
132
132
|
import {
|
|
133
133
|
Button
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-OTVK3HGP.js";
|
|
135
135
|
import {
|
|
136
136
|
useFloatingPlaceholder
|
|
137
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-YO5OJQEH.js";
|
|
138
138
|
import {
|
|
139
139
|
ControlSizeContext,
|
|
140
140
|
FloatingScrollbarProvider,
|
|
@@ -147,7 +147,7 @@ import {
|
|
|
147
147
|
usePlaceholderMode,
|
|
148
148
|
useScrollbarProximity,
|
|
149
149
|
withTitleTooltip
|
|
150
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-SRWUDTCS.js";
|
|
151
151
|
|
|
152
152
|
// src/components/CursorPreview.tsx
|
|
153
153
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
@@ -310,84 +310,243 @@ function FloatingPanel({ open, title, children, placement = "bottomRight" }) {
|
|
|
310
310
|
] }), document.body);
|
|
311
311
|
}
|
|
312
312
|
function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", disabled = false, handlePlacement = "before", handleContent }) {
|
|
313
|
-
const
|
|
314
|
-
const
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
};
|
|
319
|
-
const
|
|
320
|
-
const from = items.indexOf(key);
|
|
321
|
-
if (disabled || from < 0) return;
|
|
322
|
-
const to = Math.max(0, Math.min(items.length - 1, insertion > from ? insertion - 1 : insertion));
|
|
323
|
-
if (to === from) return;
|
|
324
|
-
const next = [...items];
|
|
325
|
-
next.splice(from, 1);
|
|
326
|
-
next.splice(to, 0, key);
|
|
327
|
-
onOrderChange(next);
|
|
328
|
-
};
|
|
313
|
+
const rootRef = useRef2(null);
|
|
314
|
+
const placeholderRef = useRef2(null);
|
|
315
|
+
const latest = useRef2({ items, onOrderChange });
|
|
316
|
+
latest.current = { items, onOrderChange };
|
|
317
|
+
const startRef = useRef2(() => {
|
|
318
|
+
});
|
|
319
|
+
const signature = JSON.stringify(items);
|
|
329
320
|
useEffect2(() => {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
321
|
+
const root = rootRef.current;
|
|
322
|
+
if (!root) return;
|
|
323
|
+
const horizontal = direction === "horizontal";
|
|
324
|
+
let session = null;
|
|
325
|
+
let frame = 0;
|
|
326
|
+
let settling = null;
|
|
327
|
+
const reduced = () => window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
328
|
+
const clear = () => {
|
|
329
|
+
cancelAnimationFrame(frame);
|
|
330
|
+
settling?.cancel();
|
|
331
|
+
settling = null;
|
|
332
|
+
const previous = session;
|
|
333
|
+
session = null;
|
|
334
|
+
root.classList.remove("is-sorting");
|
|
335
|
+
previous?.nodes.forEach((node) => {
|
|
336
|
+
node.classList.remove("is-dragging");
|
|
337
|
+
node.style.removeProperty("transform");
|
|
338
|
+
node.style.removeProperty("transition");
|
|
339
|
+
});
|
|
340
|
+
if (placeholderRef.current) placeholderRef.current.hidden = true;
|
|
341
|
+
if (previous?.handle.hasPointerCapture(previous.pointer)) previous.handle.releasePointerCapture(previous.pointer);
|
|
342
|
+
};
|
|
343
|
+
const displacement = (s) => {
|
|
344
|
+
const start = (r) => horizontal ? r.left : r.top;
|
|
345
|
+
const length = (r) => horizontal ? r.width : r.height;
|
|
346
|
+
const indices = s.keys.map((_, index) => index);
|
|
347
|
+
indices.splice(s.from, 1);
|
|
348
|
+
indices.splice(s.to, 0, s.from);
|
|
349
|
+
const gap = Number.parseFloat(getComputedStyle(root).gap) || 0;
|
|
350
|
+
let cursor = start(s.rects[0]);
|
|
351
|
+
const offsets = s.rects.map(() => 0);
|
|
352
|
+
indices.forEach((index) => {
|
|
353
|
+
offsets[index] = cursor - start(s.rects[index]);
|
|
354
|
+
cursor += length(s.rects[index]) + gap;
|
|
355
|
+
});
|
|
356
|
+
return offsets;
|
|
357
|
+
};
|
|
358
|
+
const transform = (offset) => horizontal ? `translate3d(${offset}px, 0, 0)` : `translate3d(0, ${offset}px, 0)`;
|
|
359
|
+
const paint = () => {
|
|
360
|
+
const s = session;
|
|
361
|
+
if (!s || !s.active || settling) return;
|
|
362
|
+
const bounds = root.getBoundingClientRect();
|
|
363
|
+
const coordinate = horizontal ? s.clientX : s.clientY;
|
|
364
|
+
const scroll = horizontal ? root.scrollLeft : root.scrollTop;
|
|
365
|
+
const origin = s.rects[s.from];
|
|
366
|
+
const first = s.rects[0];
|
|
367
|
+
const last = s.rects[s.rects.length - 1];
|
|
368
|
+
const minimum = horizontal ? first.left - origin.left : first.top - origin.top;
|
|
369
|
+
const maximum = horizontal ? last.right - origin.right : last.bottom - origin.bottom;
|
|
370
|
+
const delta = Math.max(minimum, Math.min(maximum, coordinate - s.start + scroll - s.scroll));
|
|
371
|
+
const center = (horizontal ? origin.left + origin.width / 2 : origin.top + origin.height / 2) + delta;
|
|
372
|
+
s.to = s.rects.filter((rect, index) => index !== s.from && center > (horizontal ? rect.left + rect.width / 2 : rect.top + rect.height / 2)).length;
|
|
373
|
+
const offsets = displacement(s);
|
|
374
|
+
s.nodes.forEach((node, index) => {
|
|
375
|
+
node.style.transform = transform(index === s.from ? delta : offsets[index]);
|
|
376
|
+
});
|
|
377
|
+
const preview = placeholderRef.current;
|
|
378
|
+
if (preview) {
|
|
379
|
+
preview.hidden = false;
|
|
380
|
+
preview.style.width = `${origin.width}px`;
|
|
381
|
+
preview.style.height = `${origin.height}px`;
|
|
382
|
+
preview.style.left = `${origin.left - bounds.left + root.scrollLeft - (horizontal ? scroll - s.scroll : 0) + (horizontal ? offsets[s.from] : 0)}px`;
|
|
383
|
+
preview.style.top = `${origin.top - bounds.top + root.scrollTop - (!horizontal ? scroll - s.scroll : 0) + (!horizontal ? offsets[s.from] : 0)}px`;
|
|
363
384
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
385
|
+
};
|
|
386
|
+
let lastTime = 0;
|
|
387
|
+
const tick = (time) => {
|
|
388
|
+
const s = session;
|
|
389
|
+
if (!s || !s.active || settling) return;
|
|
390
|
+
const bounds = root.getBoundingClientRect();
|
|
391
|
+
const point = horizontal ? s.clientX : s.clientY;
|
|
392
|
+
const start = horizontal ? bounds.left : bounds.top;
|
|
393
|
+
const end = horizontal ? bounds.right : bounds.bottom;
|
|
394
|
+
const crossInside = horizontal ? s.clientY >= bounds.top && s.clientY <= bounds.bottom : s.clientX >= bounds.left && s.clientX <= bounds.right;
|
|
395
|
+
const edge = 44;
|
|
396
|
+
const speed = !crossInside || point < start || point > end ? 0 : point < start + edge ? -Math.min(1, (start + edge - point) / edge) : point > end - edge ? Math.min(1, (point - end + edge) / edge) : 0;
|
|
397
|
+
const distance = speed * Math.min(32, time - (lastTime || time)) * 0.65;
|
|
398
|
+
lastTime = time;
|
|
399
|
+
if (horizontal) root.scrollLeft += distance;
|
|
400
|
+
else root.scrollTop += distance;
|
|
401
|
+
paint();
|
|
402
|
+
frame = requestAnimationFrame(tick);
|
|
403
|
+
};
|
|
404
|
+
startRef.current = (event, key, handle) => {
|
|
405
|
+
if (disabled || event.button !== 0 || !event.isPrimary || session || settling) return;
|
|
406
|
+
const keys = [...latest.current.items];
|
|
407
|
+
const from = keys.indexOf(key);
|
|
408
|
+
if (from < 0) return;
|
|
409
|
+
const nodes = Array.from(root.children).filter((node) => node.getAttribute("role") === "listitem");
|
|
410
|
+
session = {
|
|
411
|
+
key,
|
|
412
|
+
pointer: event.pointerId,
|
|
413
|
+
handle,
|
|
414
|
+
keys,
|
|
415
|
+
nodes,
|
|
416
|
+
rects: nodes.map((node) => node.getBoundingClientRect()),
|
|
417
|
+
from,
|
|
418
|
+
to: from,
|
|
419
|
+
start: horizontal ? event.clientX : event.clientY,
|
|
420
|
+
clientX: event.clientX,
|
|
421
|
+
clientY: event.clientY,
|
|
422
|
+
scroll: horizontal ? root.scrollLeft : root.scrollTop,
|
|
423
|
+
active: false
|
|
424
|
+
};
|
|
425
|
+
handle.setPointerCapture(event.pointerId);
|
|
426
|
+
};
|
|
427
|
+
const pointerMove = (event) => {
|
|
428
|
+
const s = session;
|
|
429
|
+
if (!s || settling || event.pointerId !== s.pointer) return;
|
|
430
|
+
s.clientX = event.clientX;
|
|
431
|
+
s.clientY = event.clientY;
|
|
432
|
+
if (!s.active && Math.abs((horizontal ? event.clientX : event.clientY) - s.start) >= 4) {
|
|
433
|
+
s.active = true;
|
|
434
|
+
root.classList.add("is-sorting");
|
|
435
|
+
s.nodes[s.from].classList.add("is-dragging");
|
|
436
|
+
s.nodes.forEach((node, index) => {
|
|
437
|
+
node.style.transition = index === s.from || reduced() ? "none" : "transform 180ms cubic-bezier(.2,.8,.2,1)";
|
|
438
|
+
});
|
|
439
|
+
lastTime = 0;
|
|
440
|
+
frame = requestAnimationFrame(tick);
|
|
441
|
+
}
|
|
442
|
+
if (s.active) {
|
|
443
|
+
event.preventDefault();
|
|
444
|
+
paint();
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
const pointerUp = (event) => {
|
|
448
|
+
const s = session;
|
|
449
|
+
if (!s || settling || event.pointerId !== s.pointer) return;
|
|
450
|
+
const bounds = root.getBoundingClientRect();
|
|
451
|
+
if (!s.active || event.clientX < bounds.left || event.clientX > bounds.right || event.clientY < bounds.top || event.clientY > bounds.bottom) {
|
|
452
|
+
clear();
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
s.clientX = event.clientX;
|
|
456
|
+
s.clientY = event.clientY;
|
|
457
|
+
paint();
|
|
458
|
+
cancelAnimationFrame(frame);
|
|
459
|
+
const finish = () => {
|
|
460
|
+
if (session !== s) return;
|
|
461
|
+
const next = [...s.keys];
|
|
462
|
+
next.splice(s.from, 1);
|
|
463
|
+
next.splice(s.to, 0, s.key);
|
|
464
|
+
const changed = s.from !== s.to;
|
|
465
|
+
clear();
|
|
466
|
+
if (changed) latest.current.onOrderChange(next);
|
|
467
|
+
};
|
|
468
|
+
if (reduced()) {
|
|
469
|
+
finish();
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
const node = s.nodes[s.from];
|
|
473
|
+
settling = node.animate([{ transform: node.style.transform }, { transform: transform(displacement(s)[s.from]) }], { duration: 160, easing: "cubic-bezier(.2,.8,.2,1)", fill: "forwards" });
|
|
474
|
+
settling.finished.then(finish, () => {
|
|
475
|
+
});
|
|
476
|
+
};
|
|
477
|
+
const escape = (event) => {
|
|
478
|
+
if (event.key === "Escape" && session) {
|
|
479
|
+
event.preventDefault();
|
|
480
|
+
event.stopPropagation();
|
|
481
|
+
clear();
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
const cancelPointer = (event) => {
|
|
485
|
+
if (event.pointerId === session?.pointer && !settling) clear();
|
|
486
|
+
};
|
|
487
|
+
const cancelClick = (event) => {
|
|
488
|
+
if (session?.active || settling) {
|
|
489
|
+
event.preventDefault();
|
|
490
|
+
event.stopPropagation();
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
window.addEventListener("pointermove", pointerMove, { passive: false });
|
|
494
|
+
window.addEventListener("pointerup", pointerUp);
|
|
495
|
+
window.addEventListener("pointercancel", cancelPointer);
|
|
496
|
+
window.addEventListener("keydown", escape, true);
|
|
497
|
+
window.addEventListener("blur", clear);
|
|
498
|
+
window.addEventListener("resize", clear);
|
|
499
|
+
root.addEventListener("lostpointercapture", cancelPointer);
|
|
500
|
+
root.addEventListener("click", cancelClick, true);
|
|
501
|
+
return () => {
|
|
502
|
+
clear();
|
|
503
|
+
startRef.current = () => {
|
|
504
|
+
};
|
|
505
|
+
window.removeEventListener("pointermove", pointerMove);
|
|
506
|
+
window.removeEventListener("pointerup", pointerUp);
|
|
507
|
+
window.removeEventListener("pointercancel", cancelPointer);
|
|
508
|
+
window.removeEventListener("keydown", escape, true);
|
|
509
|
+
window.removeEventListener("blur", clear);
|
|
510
|
+
window.removeEventListener("resize", clear);
|
|
511
|
+
root.removeEventListener("lostpointercapture", cancelPointer);
|
|
512
|
+
root.removeEventListener("click", cancelClick, true);
|
|
513
|
+
};
|
|
514
|
+
}, [disabled, direction, signature]);
|
|
515
|
+
return /* @__PURE__ */ jsxs2("div", { ref: rootRef, className: `sia-sortable-list sia-sortable-list--${direction}`, role: "list", children: [
|
|
516
|
+
/* @__PURE__ */ jsx2("div", { ref: placeholderRef, className: "sia-sortable-list__placeholder", "aria-hidden": "true", hidden: true }),
|
|
517
|
+
items.map((key, index) => {
|
|
518
|
+
const handle = /* @__PURE__ */ jsx2(
|
|
519
|
+
"button",
|
|
520
|
+
{
|
|
521
|
+
type: "button",
|
|
522
|
+
className: `sia-sortable-list__handle${handlePlacement === "custom" ? " sia-sortable-list__handle--custom" : ""}`,
|
|
523
|
+
disabled,
|
|
524
|
+
"aria-label": `\u8C03\u6574\u7B2C ${index + 1} \u9879\u987A\u5E8F`,
|
|
525
|
+
title: "\u62D6\u52A8\u6392\u5E8F\uFF0C\u6216\u4F7F\u7528\u65B9\u5411\u952E\u79FB\u52A8",
|
|
526
|
+
onPointerDown: (event) => startRef.current(event.nativeEvent, key, event.currentTarget),
|
|
527
|
+
onDragStart: (event) => event.preventDefault(),
|
|
528
|
+
onKeyDown: (event) => {
|
|
529
|
+
if (rootRef.current?.classList.contains("is-sorting")) return;
|
|
530
|
+
const previous = direction === "horizontal" ? "ArrowLeft" : "ArrowUp";
|
|
531
|
+
const next = direction === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
532
|
+
if (event.key !== previous && event.key !== next) return;
|
|
533
|
+
event.preventDefault();
|
|
534
|
+
const to = index + (event.key === previous ? -1 : 1);
|
|
535
|
+
if (disabled || to < 0 || to >= items.length) return;
|
|
536
|
+
const order = [...items];
|
|
537
|
+
order.splice(index, 1);
|
|
538
|
+
order.splice(to, 0, key);
|
|
539
|
+
onOrderChange(order);
|
|
540
|
+
},
|
|
541
|
+
children: handleContent ? handleContent(key, index) : /* @__PURE__ */ jsx2(Icon, { name: "menu", size: 16 })
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
return /* @__PURE__ */ jsxs2("div", { role: "listitem", className: "sia-sortable-list__item", children: [
|
|
545
|
+
handlePlacement === "before" ? handle : null,
|
|
546
|
+
renderItem(key, index, handle)
|
|
547
|
+
] }, key);
|
|
548
|
+
})
|
|
549
|
+
] });
|
|
391
550
|
}
|
|
392
551
|
|
|
393
552
|
// src/components/Alert.tsx
|
|
@@ -10160,10 +10319,17 @@ function createWorksheetPlugin(options) {
|
|
|
10160
10319
|
};
|
|
10161
10320
|
}
|
|
10162
10321
|
|
|
10322
|
+
// src/components/Video.tsx
|
|
10323
|
+
import { forwardRef as forwardRef7 } from "react";
|
|
10324
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
10325
|
+
var Video = forwardRef7(function Video2({ controls = true, muted = false, playsInline = true, className = "", ...props }, ref) {
|
|
10326
|
+
return /* @__PURE__ */ jsx29("video", { ...props, ref, controls, muted, playsInline, className: `sia-video ${className}`.trim() });
|
|
10327
|
+
});
|
|
10328
|
+
|
|
10163
10329
|
// src/components/InputSelect.tsx
|
|
10164
|
-
import { forwardRef as
|
|
10165
|
-
import { jsx as
|
|
10166
|
-
var InputSelect =
|
|
10330
|
+
import { forwardRef as forwardRef8, useEffect as useEffect16, useRef as useRef23, useState as useState24 } from "react";
|
|
10331
|
+
import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
10332
|
+
var InputSelect = forwardRef8(function InputSelect2({
|
|
10167
10333
|
options,
|
|
10168
10334
|
value,
|
|
10169
10335
|
defaultValue,
|
|
@@ -10252,7 +10418,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
10252
10418
|
inputRef.current?.focus();
|
|
10253
10419
|
}
|
|
10254
10420
|
}, children: [
|
|
10255
|
-
/* @__PURE__ */
|
|
10421
|
+
/* @__PURE__ */ jsx30(
|
|
10256
10422
|
Input,
|
|
10257
10423
|
{
|
|
10258
10424
|
...inputProps,
|
|
@@ -10290,25 +10456,25 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
10290
10456
|
changeOpen(true);
|
|
10291
10457
|
},
|
|
10292
10458
|
suffix: /* @__PURE__ */ jsxs26("span", { className: "sia-input-select__suffix", children: [
|
|
10293
|
-
allowClear && draft && !disabled && /* @__PURE__ */
|
|
10459
|
+
allowClear && draft && !disabled && /* @__PURE__ */ jsx30(Button, { className: "sia-input-select__clear", variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
|
|
10294
10460
|
event.stopPropagation();
|
|
10295
10461
|
setDraft("");
|
|
10296
10462
|
emit(multiple ? [] : void 0);
|
|
10297
10463
|
inputRef.current?.focus();
|
|
10298
10464
|
}, children: "\xD7" }),
|
|
10299
10465
|
suffix,
|
|
10300
|
-
enableModal && /* @__PURE__ */
|
|
10466
|
+
enableModal && /* @__PURE__ */ jsx30(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
10301
10467
|
event.stopPropagation();
|
|
10302
10468
|
openModal();
|
|
10303
10469
|
}, children: "\u2026" }),
|
|
10304
|
-
/* @__PURE__ */
|
|
10470
|
+
/* @__PURE__ */ jsx30(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
10305
10471
|
event.stopPropagation();
|
|
10306
10472
|
changeOpen(!open);
|
|
10307
|
-
}, children: /* @__PURE__ */
|
|
10473
|
+
}, children: /* @__PURE__ */ jsx30(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
10308
10474
|
] })
|
|
10309
10475
|
}
|
|
10310
10476
|
),
|
|
10311
|
-
/* @__PURE__ */
|
|
10477
|
+
/* @__PURE__ */ jsx30(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx30(
|
|
10312
10478
|
SelectionPanel,
|
|
10313
10479
|
{
|
|
10314
10480
|
options,
|
|
@@ -10337,14 +10503,14 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
10337
10503
|
},
|
|
10338
10504
|
children: [
|
|
10339
10505
|
/* @__PURE__ */ jsxs26("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
10340
|
-
/* @__PURE__ */
|
|
10506
|
+
/* @__PURE__ */ jsx30(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
10341
10507
|
/* @__PURE__ */ jsxs26(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
|
|
10342
10508
|
"\u5DF2\u9009\u9879(",
|
|
10343
10509
|
modalValues.length,
|
|
10344
10510
|
")"
|
|
10345
10511
|
] })
|
|
10346
10512
|
] }),
|
|
10347
|
-
modalOpen && /* @__PURE__ */
|
|
10513
|
+
modalOpen && /* @__PURE__ */ jsx30(
|
|
10348
10514
|
SelectionPanel,
|
|
10349
10515
|
{
|
|
10350
10516
|
options,
|
|
@@ -10643,7 +10809,7 @@ function countQueryFieldRows(centers) {
|
|
|
10643
10809
|
}
|
|
10644
10810
|
|
|
10645
10811
|
// src/components/QueryFormSettings.tsx
|
|
10646
|
-
import { Fragment as Fragment11, jsx as
|
|
10812
|
+
import { Fragment as Fragment11, jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
10647
10813
|
function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
|
|
10648
10814
|
const [snapshot, setSnapshot] = useState26();
|
|
10649
10815
|
const [draft, setDraft] = useState26({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
|
|
@@ -10738,7 +10904,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10738
10904
|
const items = new Map(visibleDraft.map((item) => [item.key, item]));
|
|
10739
10905
|
setDraft((current) => ({ ...current, fields: keys.map((key, order) => ({ ...items.get(key), order })) }));
|
|
10740
10906
|
});
|
|
10741
|
-
const control = config ? /* @__PURE__ */
|
|
10907
|
+
const control = config ? /* @__PURE__ */ jsx31(
|
|
10742
10908
|
Button,
|
|
10743
10909
|
{
|
|
10744
10910
|
type: "button",
|
|
@@ -10747,7 +10913,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10747
10913
|
"aria-label": "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
10748
10914
|
disabled: disabled || saving,
|
|
10749
10915
|
loading: loading && !open,
|
|
10750
|
-
icon: /* @__PURE__ */
|
|
10916
|
+
icon: /* @__PURE__ */ jsx31(Icon, { name: "more-vertical" }),
|
|
10751
10917
|
onClick: () => {
|
|
10752
10918
|
setOpen(true);
|
|
10753
10919
|
void load(true);
|
|
@@ -10755,8 +10921,8 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10755
10921
|
}
|
|
10756
10922
|
) : null;
|
|
10757
10923
|
const panel = config ? /* @__PURE__ */ jsxs27(Fragment11, { children: [
|
|
10758
|
-
!open && error ? /* @__PURE__ */
|
|
10759
|
-
/* @__PURE__ */
|
|
10924
|
+
!open && error ? /* @__PURE__ */ jsx31("span", { className: "sia-query-form__error", role: "alert", children: "\u67E5\u8BE2\u8BBE\u7F6E\u8BFB\u53D6\u5931\u8D25\uFF0C\u8BF7\u6253\u5F00\u8BBE\u7F6E\u91CD\u8BD5" }) : null,
|
|
10925
|
+
/* @__PURE__ */ jsx31(
|
|
10760
10926
|
Modal,
|
|
10761
10927
|
{
|
|
10762
10928
|
title: "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
@@ -10770,14 +10936,14 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10770
10936
|
if (!saveLock.current) setOpen(next);
|
|
10771
10937
|
},
|
|
10772
10938
|
children: /* @__PURE__ */ jsxs27("div", { className: "sia-query-settings", children: [
|
|
10773
|
-
loading ? /* @__PURE__ */
|
|
10939
|
+
loading ? /* @__PURE__ */ jsx31("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
|
|
10774
10940
|
error ? /* @__PURE__ */ jsxs27("div", { role: "alert", className: "sia-query-form__error", children: [
|
|
10775
10941
|
error,
|
|
10776
|
-
loadFailed ? /* @__PURE__ */
|
|
10942
|
+
loadFailed ? /* @__PURE__ */ jsx31(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
|
|
10777
10943
|
] }) : null,
|
|
10778
|
-
/* @__PURE__ */
|
|
10779
|
-
/* @__PURE__ */
|
|
10780
|
-
/* @__PURE__ */
|
|
10944
|
+
/* @__PURE__ */ jsx31(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
|
|
10945
|
+
/* @__PURE__ */ jsx31("p", { className: "sia-query-settings__hint", children: "\u52FE\u9009\u9700\u8981\u663E\u793A\u7684\u6761\u4EF6\uFF0C\u62D6\u52A8\u6216\u4F7F\u7528\u4E0A\u4E0B\u6309\u94AE\u8C03\u6574\u987A\u5E8F\u3002" }),
|
|
10946
|
+
/* @__PURE__ */ jsx31("div", { ref: sort.listRef, className: `sia-query-settings__list${sort.preview ? " is-sorting" : ""}`, children: visibleDraft.map((item, index) => /* @__PURE__ */ jsxs27(
|
|
10781
10947
|
"div",
|
|
10782
10948
|
{
|
|
10783
10949
|
"data-query-field-key": item.key,
|
|
@@ -10785,18 +10951,18 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10785
10951
|
style: sort.preview ? { transform: `translateY(${sort.preview.offsets[item.key] ?? 0}px)` } : void 0,
|
|
10786
10952
|
onPointerDown: (event) => sort.start(event, item.key),
|
|
10787
10953
|
children: [
|
|
10788
|
-
/* @__PURE__ */
|
|
10789
|
-
/* @__PURE__ */
|
|
10790
|
-
/* @__PURE__ */
|
|
10954
|
+
/* @__PURE__ */ jsx31(Icon, { name: "menu", size: 15 }),
|
|
10955
|
+
/* @__PURE__ */ jsx31(Checkbox, { "aria-label": `\u663E\u793A ${item.key}`, checked: item.visible, disabled: locked || hideDisabledKeys.has(item.key), onChange: (checked) => setDraft((current) => ({ ...current, fields: visibleDraft.map((field) => field.key === item.key ? { ...field, visible: checked } : field) })) }),
|
|
10956
|
+
/* @__PURE__ */ jsx31("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
|
|
10791
10957
|
/* @__PURE__ */ jsxs27("div", { className: "sia-query-settings__order", children: [
|
|
10792
|
-
/* @__PURE__ */
|
|
10793
|
-
/* @__PURE__ */
|
|
10958
|
+
/* @__PURE__ */ jsx31(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0A\u79FB ${item.key}`, disabled: locked || index === 0, icon: /* @__PURE__ */ jsx31(Icon, { name: "chevron-up" }), onClick: () => move(index, index - 1) }),
|
|
10959
|
+
/* @__PURE__ */ jsx31(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0B\u79FB ${item.key}`, disabled: locked || index === visibleDraft.length - 1, icon: /* @__PURE__ */ jsx31(Icon, { name: "chevron-down" }), onClick: () => move(index, index + 1) })
|
|
10794
10960
|
] })
|
|
10795
10961
|
]
|
|
10796
10962
|
},
|
|
10797
10963
|
item.key
|
|
10798
10964
|
)) }),
|
|
10799
|
-
/* @__PURE__ */
|
|
10965
|
+
/* @__PURE__ */ jsx31(Button, { type: "button", disabled: locked, onClick: () => setDraft({ fields: reconcileQueryFields(fields.map((field) => field.key)), defaultCollapsed: defaultCollapsed ?? false }), children: "\u6062\u590D\u9ED8\u8BA4" })
|
|
10800
10966
|
] })
|
|
10801
10967
|
}
|
|
10802
10968
|
)
|
|
@@ -10805,7 +10971,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10805
10971
|
}
|
|
10806
10972
|
|
|
10807
10973
|
// src/components/QueryForm.tsx
|
|
10808
|
-
import { jsx as
|
|
10974
|
+
import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
10809
10975
|
function QueryForm({
|
|
10810
10976
|
fields,
|
|
10811
10977
|
settings,
|
|
@@ -10868,7 +11034,7 @@ function QueryForm({
|
|
|
10868
11034
|
width,
|
|
10869
11035
|
hideDisabled: settingsHideDisabled,
|
|
10870
11036
|
label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
|
|
10871
|
-
content: /* @__PURE__ */
|
|
11037
|
+
content: /* @__PURE__ */ jsx32(Form.Item, { noStyle: true, ...item })
|
|
10872
11038
|
})) : Children4.toArray(children).map((content, index) => ({
|
|
10873
11039
|
key: isValidElement5(content) && content.key != null ? String(content.key) : String(index),
|
|
10874
11040
|
width: void 0,
|
|
@@ -11072,7 +11238,7 @@ function QueryForm({
|
|
|
11072
11238
|
},
|
|
11073
11239
|
children: [
|
|
11074
11240
|
quickQueries.length ? /* @__PURE__ */ jsxs28("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
11075
|
-
quickQueries.map((query) => /* @__PURE__ */
|
|
11241
|
+
quickQueries.map((query) => /* @__PURE__ */ jsx32(
|
|
11076
11242
|
Badge,
|
|
11077
11243
|
{
|
|
11078
11244
|
className: "sia-query-form__quick-badge",
|
|
@@ -11081,7 +11247,7 @@ function QueryForm({
|
|
|
11081
11247
|
title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`,
|
|
11082
11248
|
...query.badgeProps,
|
|
11083
11249
|
count: query.count,
|
|
11084
|
-
children: /* @__PURE__ */
|
|
11250
|
+
children: /* @__PURE__ */ jsx32(
|
|
11085
11251
|
Button,
|
|
11086
11252
|
{
|
|
11087
11253
|
size: query.size ?? quickQuerySize,
|
|
@@ -11097,7 +11263,7 @@ function QueryForm({
|
|
|
11097
11263
|
)),
|
|
11098
11264
|
" "
|
|
11099
11265
|
] }) : null,
|
|
11100
|
-
/* @__PURE__ */
|
|
11266
|
+
/* @__PURE__ */ jsx32("div", { className: "sia-query-form__motion", children: /* @__PURE__ */ jsxs28(
|
|
11101
11267
|
"div",
|
|
11102
11268
|
{
|
|
11103
11269
|
ref: rowRef,
|
|
@@ -11106,7 +11272,7 @@ function QueryForm({
|
|
|
11106
11272
|
"--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth
|
|
11107
11273
|
},
|
|
11108
11274
|
children: [
|
|
11109
|
-
entries.map((entry) => /* @__PURE__ */
|
|
11275
|
+
entries.map((entry) => /* @__PURE__ */ jsx32(
|
|
11110
11276
|
"div",
|
|
11111
11277
|
{
|
|
11112
11278
|
className: "sia-query-form__field",
|
|
@@ -11122,7 +11288,7 @@ function QueryForm({
|
|
|
11122
11288
|
)),
|
|
11123
11289
|
/* @__PURE__ */ jsxs28("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
|
|
11124
11290
|
/* @__PURE__ */ jsxs28(Space.Compact, { children: [
|
|
11125
|
-
/* @__PURE__ */
|
|
11291
|
+
/* @__PURE__ */ jsx32(
|
|
11126
11292
|
Button,
|
|
11127
11293
|
{
|
|
11128
11294
|
type: "submit",
|
|
@@ -11132,8 +11298,8 @@ function QueryForm({
|
|
|
11132
11298
|
children: searchText
|
|
11133
11299
|
}
|
|
11134
11300
|
),
|
|
11135
|
-
/* @__PURE__ */
|
|
11136
|
-
onSaveQuery ? /* @__PURE__ */
|
|
11301
|
+
/* @__PURE__ */ jsx32(Button, { disabled: busy, onClick: reset, children: resetText }),
|
|
11302
|
+
onSaveQuery ? /* @__PURE__ */ jsx32(
|
|
11137
11303
|
Button,
|
|
11138
11304
|
{
|
|
11139
11305
|
disabled: shortcutBusy,
|
|
@@ -11148,12 +11314,12 @@ function QueryForm({
|
|
|
11148
11314
|
) : null,
|
|
11149
11315
|
showSettings ?? settingsRows > 2 ? cloudSettings.control : null
|
|
11150
11316
|
] }),
|
|
11151
|
-
collapsible && entries.length > 0 ? /* @__PURE__ */
|
|
11317
|
+
collapsible && entries.length > 0 ? /* @__PURE__ */ jsx32("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx32(
|
|
11152
11318
|
Button,
|
|
11153
11319
|
{
|
|
11154
11320
|
variant: "link",
|
|
11155
11321
|
"aria-expanded": !collapsed,
|
|
11156
|
-
icon: /* @__PURE__ */
|
|
11322
|
+
icon: /* @__PURE__ */ jsx32(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
|
|
11157
11323
|
iconPosition: "end",
|
|
11158
11324
|
onClick: () => {
|
|
11159
11325
|
setInternalCollapsed(!collapsed);
|
|
@@ -11169,7 +11335,7 @@ function QueryForm({
|
|
|
11169
11335
|
}
|
|
11170
11336
|
) }),
|
|
11171
11337
|
savedQueries.length ? /* @__PURE__ */ jsxs28("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
11172
|
-
savedQueries.map((query, index) => /* @__PURE__ */
|
|
11338
|
+
savedQueries.map((query, index) => /* @__PURE__ */ jsx32(
|
|
11173
11339
|
Tag,
|
|
11174
11340
|
{
|
|
11175
11341
|
status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
|
|
@@ -11195,7 +11361,7 @@ function QueryForm({
|
|
|
11195
11361
|
)),
|
|
11196
11362
|
" "
|
|
11197
11363
|
] }) : null,
|
|
11198
|
-
error ? /* @__PURE__ */
|
|
11364
|
+
error ? /* @__PURE__ */ jsx32("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
|
|
11199
11365
|
]
|
|
11200
11366
|
}
|
|
11201
11367
|
),
|
|
@@ -11211,7 +11377,7 @@ function QueryForm({
|
|
|
11211
11377
|
if (!saveLock.current) setSaveOpen(next);
|
|
11212
11378
|
},
|
|
11213
11379
|
children: [
|
|
11214
|
-
/* @__PURE__ */
|
|
11380
|
+
/* @__PURE__ */ jsx32(
|
|
11215
11381
|
Input,
|
|
11216
11382
|
{
|
|
11217
11383
|
autoFocus: true,
|
|
@@ -11230,7 +11396,7 @@ function QueryForm({
|
|
|
11230
11396
|
}
|
|
11231
11397
|
}
|
|
11232
11398
|
),
|
|
11233
|
-
saveError ? /* @__PURE__ */
|
|
11399
|
+
saveError ? /* @__PURE__ */ jsx32("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
|
|
11234
11400
|
]
|
|
11235
11401
|
}
|
|
11236
11402
|
)
|
|
@@ -11238,9 +11404,9 @@ function QueryForm({
|
|
|
11238
11404
|
}
|
|
11239
11405
|
|
|
11240
11406
|
// src/components/NumberRange.tsx
|
|
11241
|
-
import { forwardRef as
|
|
11242
|
-
import { jsx as
|
|
11243
|
-
var NumberRange =
|
|
11407
|
+
import { forwardRef as forwardRef9 } from "react";
|
|
11408
|
+
import { jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
11409
|
+
var NumberRange = forwardRef9(function NumberRange2({
|
|
11244
11410
|
value,
|
|
11245
11411
|
defaultValue = [null, null],
|
|
11246
11412
|
onChange,
|
|
@@ -11277,7 +11443,7 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
11277
11443
|
"aria-disabled": disabled || void 0,
|
|
11278
11444
|
className: `sia-number-range sia-number-range--${size} sia-number-range--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
11279
11445
|
children: [
|
|
11280
|
-
/* @__PURE__ */
|
|
11446
|
+
/* @__PURE__ */ jsx33(
|
|
11281
11447
|
InputNumber,
|
|
11282
11448
|
{
|
|
11283
11449
|
...inputProps,
|
|
@@ -11289,8 +11455,8 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
11289
11455
|
onChange: (next) => change(0, next)
|
|
11290
11456
|
}
|
|
11291
11457
|
),
|
|
11292
|
-
/* @__PURE__ */
|
|
11293
|
-
/* @__PURE__ */
|
|
11458
|
+
/* @__PURE__ */ jsx33(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
11459
|
+
/* @__PURE__ */ jsx33(
|
|
11294
11460
|
InputNumber,
|
|
11295
11461
|
{
|
|
11296
11462
|
...inputProps,
|
|
@@ -11302,12 +11468,109 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
11302
11468
|
onChange: (next) => change(1, next)
|
|
11303
11469
|
}
|
|
11304
11470
|
),
|
|
11305
|
-
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */
|
|
11471
|
+
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */ jsx33("button", { type: "button", className: "sia-number-range__clear", "aria-label": "\u6E05\u9664\u6570\u5B57\u533A\u95F4", onClick: () => setValue2([null, null]), children: /* @__PURE__ */ jsx33(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
|
|
11306
11472
|
]
|
|
11307
11473
|
}
|
|
11308
11474
|
);
|
|
11309
11475
|
});
|
|
11310
11476
|
|
|
11477
|
+
// src/components/VirtualGrid.tsx
|
|
11478
|
+
import { useEffect as useEffect19, useLayoutEffect as useLayoutEffect10, useRef as useRef28, useState as useState28 } from "react";
|
|
11479
|
+
import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
11480
|
+
function VirtualGrid({
|
|
11481
|
+
items,
|
|
11482
|
+
itemKey,
|
|
11483
|
+
renderItem,
|
|
11484
|
+
rowHeight,
|
|
11485
|
+
minColumnWidth = 200,
|
|
11486
|
+
gap = 8,
|
|
11487
|
+
overscan = 2,
|
|
11488
|
+
hasMore = false,
|
|
11489
|
+
loading = false,
|
|
11490
|
+
loadMoreThreshold = 120,
|
|
11491
|
+
onLoadMore,
|
|
11492
|
+
empty,
|
|
11493
|
+
className = "",
|
|
11494
|
+
onScroll,
|
|
11495
|
+
tabIndex = 0,
|
|
11496
|
+
...props
|
|
11497
|
+
}) {
|
|
11498
|
+
const viewport = useRef28(null);
|
|
11499
|
+
const [size, setSize] = useState28({ width: 0, height: 0 });
|
|
11500
|
+
const [scrollTop, setScrollTop] = useState28(0);
|
|
11501
|
+
const frame = useRef28();
|
|
11502
|
+
const requestedLength = useRef28();
|
|
11503
|
+
const height = Math.max(1, rowHeight);
|
|
11504
|
+
const spacing = Math.max(0, gap);
|
|
11505
|
+
const columns = Math.max(1, Math.floor((size.width + spacing) / (Math.max(1, minColumnWidth) + spacing)));
|
|
11506
|
+
const rowCount = Math.ceil(items.length / columns);
|
|
11507
|
+
const stride = height + spacing;
|
|
11508
|
+
const totalHeight = Math.max(0, rowCount * stride - spacing);
|
|
11509
|
+
const paddingRows = Math.max(0, Math.floor(overscan));
|
|
11510
|
+
const startRow = Math.max(0, Math.min(rowCount - 1, Math.floor(scrollTop / stride)) - paddingRows);
|
|
11511
|
+
const endRow = Math.min(rowCount, Math.ceil((scrollTop + size.height) / stride) + paddingRows);
|
|
11512
|
+
useLayoutEffect10(() => {
|
|
11513
|
+
const el = viewport.current;
|
|
11514
|
+
if (!el) return;
|
|
11515
|
+
const measure = () => setSize((previous) => previous.width === el.clientWidth && previous.height === el.clientHeight ? previous : { width: el.clientWidth, height: el.clientHeight });
|
|
11516
|
+
measure();
|
|
11517
|
+
const observer = new ResizeObserver(measure);
|
|
11518
|
+
observer.observe(el);
|
|
11519
|
+
return () => {
|
|
11520
|
+
observer.disconnect();
|
|
11521
|
+
if (frame.current !== void 0) cancelAnimationFrame(frame.current);
|
|
11522
|
+
};
|
|
11523
|
+
}, []);
|
|
11524
|
+
useLayoutEffect10(() => {
|
|
11525
|
+
const el = viewport.current;
|
|
11526
|
+
if (!el) return;
|
|
11527
|
+
const next = Math.min(el.scrollTop, Math.max(0, totalHeight - size.height));
|
|
11528
|
+
if (el.scrollTop !== next) el.scrollTop = next;
|
|
11529
|
+
setScrollTop(next);
|
|
11530
|
+
}, [totalHeight, size.height]);
|
|
11531
|
+
useEffect19(() => {
|
|
11532
|
+
if (!onLoadMore || !hasMore || loading || size.height <= 0) return;
|
|
11533
|
+
if (totalHeight - scrollTop - size.height > Math.max(0, loadMoreThreshold)) return;
|
|
11534
|
+
if (requestedLength.current === items.length) return;
|
|
11535
|
+
requestedLength.current = items.length;
|
|
11536
|
+
onLoadMore();
|
|
11537
|
+
}, [items.length, hasMore, loading, size.height, scrollTop, totalHeight, loadMoreThreshold, onLoadMore]);
|
|
11538
|
+
return /* @__PURE__ */ jsxs30(
|
|
11539
|
+
"div",
|
|
11540
|
+
{
|
|
11541
|
+
...props,
|
|
11542
|
+
ref: viewport,
|
|
11543
|
+
className: `sia-virtual-grid ${className}`.trim(),
|
|
11544
|
+
role: props.role ?? "list",
|
|
11545
|
+
tabIndex,
|
|
11546
|
+
"aria-busy": loading,
|
|
11547
|
+
onScroll: (event) => {
|
|
11548
|
+
onScroll?.(event);
|
|
11549
|
+
if (frame.current !== void 0) return;
|
|
11550
|
+
frame.current = requestAnimationFrame(() => {
|
|
11551
|
+
frame.current = void 0;
|
|
11552
|
+
setScrollTop(viewport.current?.scrollTop ?? 0);
|
|
11553
|
+
});
|
|
11554
|
+
},
|
|
11555
|
+
children: [
|
|
11556
|
+
/* @__PURE__ */ jsx34("div", { className: "sia-virtual-grid__spacer", style: { height: totalHeight }, children: Array.from({ length: Math.max(0, endRow - startRow) }, (_, offset) => {
|
|
11557
|
+
const row = startRow + offset;
|
|
11558
|
+
return /* @__PURE__ */ jsx34("div", { className: "sia-virtual-grid__row", role: "presentation", style: {
|
|
11559
|
+
top: row * stride,
|
|
11560
|
+
height,
|
|
11561
|
+
columnGap: spacing,
|
|
11562
|
+
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
|
|
11563
|
+
}, children: items.slice(row * columns, (row + 1) * columns).map((item, column) => {
|
|
11564
|
+
const index = row * columns + column;
|
|
11565
|
+
return /* @__PURE__ */ jsx34("div", { className: "sia-virtual-grid__item", role: "listitem", "aria-posinset": index + 1, "aria-setsize": hasMore ? -1 : items.length, children: renderItem(item, index) }, itemKey(item, index));
|
|
11566
|
+
}) }, row);
|
|
11567
|
+
}) }),
|
|
11568
|
+
!items.length && !loading ? empty : null
|
|
11569
|
+
]
|
|
11570
|
+
}
|
|
11571
|
+
);
|
|
11572
|
+
}
|
|
11573
|
+
|
|
11311
11574
|
// src/index.ts
|
|
11312
11575
|
initializeDefaultScrollbars();
|
|
11313
11576
|
export {
|
|
@@ -11431,6 +11694,8 @@ export {
|
|
|
11431
11694
|
Typography,
|
|
11432
11695
|
Upload,
|
|
11433
11696
|
VennChart,
|
|
11697
|
+
Video,
|
|
11698
|
+
VirtualGrid,
|
|
11434
11699
|
Watermark,
|
|
11435
11700
|
WindowControls,
|
|
11436
11701
|
WindowFrame,
|