@sia.soul/sia-react-ui 0.1.115 → 0.1.116
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/{chunk-KPOK4HIQ.js → chunk-7PPE6DJO.js} +1 -1
- package/dist/{chunk-MDU5EONC.js → chunk-CVIFJLW6.js} +1 -1
- package/dist/{chunk-GNOZYUIH.js → chunk-D2H37DUL.js} +2 -2
- package/dist/{chunk-6XQ2LDGT.js → chunk-MKCU5S77.js} +1 -1
- package/dist/{chunk-SPIQSYWQ.js → chunk-SATXB6X4.js} +27 -1
- package/dist/{core-O6oDXbkG.d.cts → core-CCb4CoSP.d.cts} +9 -2
- package/dist/{core-uVaNwjTO.d.ts → core-CJnRQZkv.d.ts} +9 -2
- package/dist/core.cjs +27 -1
- package/dist/core.css +15 -2
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +3 -3
- package/dist/game.css +13 -0
- package/dist/index.cjs +791 -713
- package/dist/index.css +15 -2
- package/dist/index.d.cts +13 -7
- package/dist/index.d.ts +13 -7
- package/dist/index.js +196 -144
- package/dist/rich-text-editor.cjs +27 -1
- package/dist/rich-text-editor.js +2 -2
- package/dist/select-date-range.js +3 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2136,7 +2136,7 @@ function Image2({ fallback, placeholder, preview = true, rootClassName = "", cla
|
|
|
2136
2136
|
|
|
2137
2137
|
// src/components/CursorPreview.tsx
|
|
2138
2138
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2139
|
-
function CursorPreview({ frames, size = 48, playing = true, followPointer = true, showHotspot = false, height = 180, empty = "\u6682\u65E0\u6307\u9488\u9884\u89C8", alt = "\u9F20\u6807\u6307\u9488\u9884\u89C8", className = "", style, children, onPointerEnter, onPointerMove, onPointerLeave, ...props }) {
|
|
2139
|
+
function CursorPreview({ frames, size = 48, sizeUnit = "css", playing = true, followPointer = true, showHotspot = false, height = 180, empty = "\u6682\u65E0\u6307\u9488\u9884\u89C8", alt = "\u9F20\u6807\u6307\u9488\u9884\u89C8", className = "", style, children, onPointerEnter, onPointerMove, onPointerLeave, ...props }) {
|
|
2140
2140
|
const rootRef = (0, import_react8.useRef)(null);
|
|
2141
2141
|
const [bounds, setBounds] = (0, import_react8.useState)({ width: 0, height: 0 });
|
|
2142
2142
|
const [hovered, setHovered] = (0, import_react8.useState)(false);
|
|
@@ -2144,17 +2144,36 @@ function CursorPreview({ frames, size = 48, playing = true, followPointer = true
|
|
|
2144
2144
|
const [point, setPoint] = (0, import_react8.useState)(null);
|
|
2145
2145
|
const [reduced, setReduced] = (0, import_react8.useState)(false);
|
|
2146
2146
|
const [failed, setFailed] = (0, import_react8.useState)(false);
|
|
2147
|
-
const
|
|
2147
|
+
const [density, setDensity] = (0, import_react8.useState)(() => typeof window === "undefined" ? 1 : window.devicePixelRatio || 1);
|
|
2148
|
+
const scale = sizeUnit === "device" ? density : 1;
|
|
2149
|
+
const safeSize = Math.max(8, Number.isFinite(size) ? size : 48) / scale;
|
|
2150
|
+
(0, import_react8.useEffect)(() => {
|
|
2151
|
+
if (sizeUnit !== "device") return;
|
|
2152
|
+
let media;
|
|
2153
|
+
const update = () => {
|
|
2154
|
+
media?.removeEventListener("change", update);
|
|
2155
|
+
const next = window.devicePixelRatio || 1;
|
|
2156
|
+
setDensity(next);
|
|
2157
|
+
media = window.matchMedia(`(resolution: ${next}dppx)`);
|
|
2158
|
+
media.addEventListener("change", update);
|
|
2159
|
+
};
|
|
2160
|
+
update();
|
|
2161
|
+
window.addEventListener("resize", update);
|
|
2162
|
+
return () => {
|
|
2163
|
+
media.removeEventListener("change", update);
|
|
2164
|
+
window.removeEventListener("resize", update);
|
|
2165
|
+
};
|
|
2166
|
+
}, [sizeUnit]);
|
|
2148
2167
|
const frame = frames[playing && !reduced ? index % Math.max(1, frames.length) : 0];
|
|
2149
2168
|
(0, import_react8.useLayoutEffect)(() => {
|
|
2150
2169
|
const root = rootRef.current;
|
|
2151
|
-
if (!showHotspot || !root) return;
|
|
2170
|
+
if (!showHotspot && sizeUnit !== "device" || !root) return;
|
|
2152
2171
|
const measure = () => setBounds({ width: root.clientWidth, height: root.clientHeight });
|
|
2153
2172
|
measure();
|
|
2154
2173
|
const observer = new ResizeObserver(measure);
|
|
2155
2174
|
observer.observe(root);
|
|
2156
2175
|
return () => observer.disconnect();
|
|
2157
|
-
}, [showHotspot]);
|
|
2176
|
+
}, [showHotspot, sizeUnit]);
|
|
2158
2177
|
(0, import_react8.useEffect)(() => {
|
|
2159
2178
|
setIndex(0);
|
|
2160
2179
|
}, [frames]);
|
|
@@ -2179,8 +2198,12 @@ function CursorPreview({ frames, size = 48, playing = true, followPointer = true
|
|
|
2179
2198
|
}
|
|
2180
2199
|
const following = !!point && followPointer && !!frame && !failed;
|
|
2181
2200
|
const offset = (value) => Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * safeSize;
|
|
2182
|
-
const
|
|
2183
|
-
const
|
|
2201
|
+
const origin = rootRef.current?.getBoundingClientRect();
|
|
2202
|
+
const snap = (value, base) => sizeUnit === "device" ? Math.round((value + base) * density) / density - base : value;
|
|
2203
|
+
const bitmapX = snap(following ? point.x - offset(frame.hotspotX) : (bounds.width - safeSize) / 2, origin?.left ?? 0);
|
|
2204
|
+
const bitmapY = snap(following ? point.y - offset(frame.hotspotY) : (bounds.height - safeSize) / 2, origin?.top ?? 0);
|
|
2205
|
+
const hotspotX = bitmapX + offset(frame?.hotspotX);
|
|
2206
|
+
const hotspotY = bitmapY + offset(frame?.hotspotY);
|
|
2184
2207
|
const direction = bounds.width - hotspotX >= 130 ? 1 : -1;
|
|
2185
2208
|
const lineY = Math.max(18, hotspotY - 42);
|
|
2186
2209
|
const elbowX = hotspotX + direction * 28;
|
|
@@ -2203,7 +2226,7 @@ function CursorPreview({ frames, size = 48, playing = true, followPointer = true
|
|
|
2203
2226
|
onPointerLeave?.(event);
|
|
2204
2227
|
},
|
|
2205
2228
|
children: [
|
|
2206
|
-
frame ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-cursor-preview__bitmap", style: { width: safeSize, height: safeSize, left: following ?
|
|
2229
|
+
frame ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-cursor-preview__bitmap", style: { width: safeSize, height: safeSize, left: sizeUnit === "device" || following ? bitmapX : "50%", top: sizeUnit === "device" || following ? bitmapY : "50%", transform: sizeUnit === "device" || following ? void 0 : "translate(-50%, -50%)" }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Image2, { src: frame.src, width: safeSize, height: safeSize, alt, preview: false, draggable: false, onLoad: () => setFailed(false), onError: () => setFailed(true) }) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-cursor-preview__empty", children: empty }),
|
|
2207
2230
|
showHotspot && !hovered && frame && !failed && bounds.width > 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { className: "sia-cursor-preview__hotspot", width: "100%", height: "100%", role: "img", "aria-label": "\u6307\u9488\u70B9\uFF1A\u9F20\u6807\u70B9\u51FB\u7684\u5B9E\u9645\u4F4D\u7F6E", children: [
|
|
2208
2231
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: `${hotspotX},${hotspotY} ${elbowX},${lineY} ${endX},${lineY}` }),
|
|
2209
2232
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: hotspotX, cy: hotspotY, r: 2.5 }),
|
|
@@ -2428,12 +2451,13 @@ function MenuEntry({
|
|
|
2428
2451
|
...withTitleTooltip({ title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title }),
|
|
2429
2452
|
disabled: item.disabled,
|
|
2430
2453
|
"aria-current": isSelected ? "page" : void 0,
|
|
2454
|
+
"data-menu-key": item.key,
|
|
2431
2455
|
"data-applied": item.applied || void 0,
|
|
2432
2456
|
"aria-expanded": hasChildren ? isOpen : void 0,
|
|
2433
2457
|
onClick: (event) => hasChildren ? props.toggle(item.key) : props.select(item, path, event),
|
|
2434
2458
|
children: [
|
|
2435
2459
|
reserveIcon ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__icon", style: item.iconSize ? { width: item.iconSize, height: item.iconSize, flexBasis: item.iconSize } : void 0, "aria-hidden": !item.icon || void 0, children: item.icon }) : null,
|
|
2436
|
-
item.applied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__applied", role: "img", "aria-label": item.appliedLabel ?? "\u5F53\u524D\u4F7F\u7528", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { name: "circle-check", size: 32 }) }) : null,
|
|
2460
|
+
item.applied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__applied", role: "img", "aria-label": item.appliedLabel ?? "\u5F53\u524D\u4F7F\u7528", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { name: "circle-check", variant: "filled", size: 32 }) }) : null,
|
|
2437
2461
|
!collapsed ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__label", children: item.label }) : null,
|
|
2438
2462
|
!collapsed && item.extra ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__extra", children: item.extra }) : null,
|
|
2439
2463
|
!collapsed && hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { className: "sia-menu__expand-icon", name: "chevron-down", size: 13 }) : null
|
|
@@ -2482,6 +2506,7 @@ function Menu({
|
|
|
2482
2506
|
gridColumns = 2,
|
|
2483
2507
|
theme = "light",
|
|
2484
2508
|
selectedKeys,
|
|
2509
|
+
autoScrollSelected = false,
|
|
2485
2510
|
defaultSelectedKeys = [],
|
|
2486
2511
|
openKeys,
|
|
2487
2512
|
defaultOpenKeys = [],
|
|
@@ -2502,6 +2527,30 @@ function Menu({
|
|
|
2502
2527
|
const rootRef = (0, import_react10.useRef)(null);
|
|
2503
2528
|
const [selected, setSelected] = useControllableState({ value: selectedKeys, defaultValue: defaultSelectedKeys });
|
|
2504
2529
|
const [open, setOpen] = useControllableState({ value: openKeys, defaultValue: defaultOpenKeys, onChange: (next) => onOpenChange?.([...next]) });
|
|
2530
|
+
const revealedKey = (0, import_react10.useRef)();
|
|
2531
|
+
const firstSelected = selected[0];
|
|
2532
|
+
(0, import_react10.useLayoutEffect)(() => {
|
|
2533
|
+
if (!autoScrollSelected || firstSelected === void 0) {
|
|
2534
|
+
revealedKey.current = void 0;
|
|
2535
|
+
return;
|
|
2536
|
+
}
|
|
2537
|
+
const root = rootRef.current;
|
|
2538
|
+
if (!root || revealedKey.current === firstSelected || mode === "horizontal") return;
|
|
2539
|
+
const reveal = () => {
|
|
2540
|
+
if (revealedKey.current === firstSelected || root.clientHeight === 0) return;
|
|
2541
|
+
const target = Array.from(root.querySelectorAll(".sia-menu__item")).find((element) => element.dataset.menuKey === firstSelected && element.getBoundingClientRect().height > 0);
|
|
2542
|
+
if (!target) return;
|
|
2543
|
+
const bounds = root.getBoundingClientRect(), item = target.getBoundingClientRect();
|
|
2544
|
+
const top = bounds.top + root.clientTop, bottom = top + root.clientHeight;
|
|
2545
|
+
if (item.top < top || item.bottom > bottom)
|
|
2546
|
+
root.scrollTop += item.top - top - Math.max(0, (root.clientHeight - item.height) / 2);
|
|
2547
|
+
revealedKey.current = firstSelected;
|
|
2548
|
+
};
|
|
2549
|
+
reveal();
|
|
2550
|
+
const observer = new ResizeObserver(reveal);
|
|
2551
|
+
observer.observe(root);
|
|
2552
|
+
return () => observer.disconnect();
|
|
2553
|
+
}, [autoScrollSelected, firstSelected, items, mode]);
|
|
2505
2554
|
(0, import_react10.useEffect)(() => {
|
|
2506
2555
|
if (mode === "inline" || !open.length) return void 0;
|
|
2507
2556
|
const closeOutside = (event) => {
|
|
@@ -6623,6 +6672,7 @@ function ToolPanel({
|
|
|
6623
6672
|
}
|
|
6624
6673
|
|
|
6625
6674
|
// src/components/WindowFrame.tsx
|
|
6675
|
+
var import_react32 = require("react");
|
|
6626
6676
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
6627
6677
|
var DEFAULT_LABELS = {
|
|
6628
6678
|
minimize: "\u6700\u5C0F\u5316",
|
|
@@ -6746,13 +6796,40 @@ function WindowTitleBar({
|
|
|
6746
6796
|
onMouseDown,
|
|
6747
6797
|
...props
|
|
6748
6798
|
}) {
|
|
6799
|
+
const cancelDrag = (0, import_react32.useRef)(null);
|
|
6800
|
+
(0, import_react32.useEffect)(() => () => cancelDrag.current?.(), [draggable]);
|
|
6749
6801
|
function handleMouseDown(event) {
|
|
6802
|
+
cancelDrag.current?.();
|
|
6750
6803
|
onMouseDown?.(event);
|
|
6751
6804
|
if (event.defaultPrevented || !draggable || !onWindowAction || event.button !== 0) return;
|
|
6752
6805
|
const target = event.target;
|
|
6753
6806
|
if (!(target instanceof Element) || target.closest(NON_DRAG_SELECTOR)) return;
|
|
6754
6807
|
event.preventDefault();
|
|
6755
|
-
|
|
6808
|
+
if (event.detail > 1) {
|
|
6809
|
+
void onWindowAction("toggle-maximize");
|
|
6810
|
+
return;
|
|
6811
|
+
}
|
|
6812
|
+
const origin = { x: event.clientX, y: event.clientY };
|
|
6813
|
+
const run = onWindowAction;
|
|
6814
|
+
function cancel() {
|
|
6815
|
+
document.removeEventListener("mousemove", move);
|
|
6816
|
+
document.removeEventListener("mouseup", cancel, true);
|
|
6817
|
+
window.removeEventListener("blur", cancel);
|
|
6818
|
+
cancelDrag.current = null;
|
|
6819
|
+
}
|
|
6820
|
+
function move(next) {
|
|
6821
|
+
if ((next.buttons & 1) === 0) {
|
|
6822
|
+
cancel();
|
|
6823
|
+
return;
|
|
6824
|
+
}
|
|
6825
|
+
if (Math.hypot(next.clientX - origin.x, next.clientY - origin.y) < 2) return;
|
|
6826
|
+
cancel();
|
|
6827
|
+
void run("start-dragging");
|
|
6828
|
+
}
|
|
6829
|
+
cancelDrag.current = cancel;
|
|
6830
|
+
document.addEventListener("mousemove", move);
|
|
6831
|
+
document.addEventListener("mouseup", cancel, true);
|
|
6832
|
+
window.addEventListener("blur", cancel);
|
|
6756
6833
|
}
|
|
6757
6834
|
const renderedControls = controls === true ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6758
6835
|
WindowControls,
|
|
@@ -6784,20 +6861,20 @@ function WindowTitleBar({
|
|
|
6784
6861
|
}
|
|
6785
6862
|
|
|
6786
6863
|
// src/components/Drawer.tsx
|
|
6787
|
-
var
|
|
6864
|
+
var import_react33 = require("react");
|
|
6788
6865
|
var import_client4 = require("react-dom/client");
|
|
6789
6866
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
6790
6867
|
var drawerHandles = /* @__PURE__ */ new Set();
|
|
6791
6868
|
var DRAWER_MOTION_DURATION = 400;
|
|
6792
6869
|
var DEFAULT_DRAWER_PUSH_DISTANCE = 180;
|
|
6793
|
-
var DrawerStackContext = (0,
|
|
6870
|
+
var DrawerStackContext = (0, import_react33.createContext)(null);
|
|
6794
6871
|
function createPushOffset(distance3, depth, negative) {
|
|
6795
6872
|
if (depth <= 0) return "0px";
|
|
6796
6873
|
if (typeof distance3 === "number") return `${(negative ? -1 : 1) * distance3 * depth}px`;
|
|
6797
6874
|
const operator = negative ? " - " : " + ";
|
|
6798
6875
|
return `calc(0px${operator}${Array.from({ length: depth }, () => distance3).join(operator)})`;
|
|
6799
6876
|
}
|
|
6800
|
-
var DrawerRoot = (0,
|
|
6877
|
+
var DrawerRoot = (0, import_react33.forwardRef)(function Drawer({
|
|
6801
6878
|
open,
|
|
6802
6879
|
title,
|
|
6803
6880
|
children,
|
|
@@ -6820,19 +6897,19 @@ var DrawerRoot = (0, import_react32.forwardRef)(function Drawer({
|
|
|
6820
6897
|
style,
|
|
6821
6898
|
...props
|
|
6822
6899
|
}, forwardedRef) {
|
|
6823
|
-
const localRef = (0,
|
|
6824
|
-
const bodyRef = (0,
|
|
6825
|
-
const titleId = (0,
|
|
6826
|
-
const drawerId = (0,
|
|
6827
|
-
const parentStack = (0,
|
|
6828
|
-
const afterOpenRef = (0,
|
|
6829
|
-
const afterCloseRef = (0,
|
|
6900
|
+
const localRef = (0, import_react33.useRef)(null);
|
|
6901
|
+
const bodyRef = (0, import_react33.useRef)(null);
|
|
6902
|
+
const titleId = (0, import_react33.useId)();
|
|
6903
|
+
const drawerId = (0, import_react33.useId)();
|
|
6904
|
+
const parentStack = (0, import_react33.useContext)(DrawerStackContext);
|
|
6905
|
+
const afterOpenRef = (0, import_react33.useRef)(afterOpen);
|
|
6906
|
+
const afterCloseRef = (0, import_react33.useRef)(afterClose);
|
|
6830
6907
|
afterOpenRef.current = afterOpen;
|
|
6831
6908
|
afterCloseRef.current = afterClose;
|
|
6832
|
-
const [rendered, setRendered] = (0,
|
|
6833
|
-
const [closing, setClosing] = (0,
|
|
6834
|
-
const [openChildIds, setOpenChildIds] = (0,
|
|
6835
|
-
const setChildOpen = (0,
|
|
6909
|
+
const [rendered, setRendered] = (0, import_react33.useState)(open);
|
|
6910
|
+
const [closing, setClosing] = (0, import_react33.useState)(false);
|
|
6911
|
+
const [openChildIds, setOpenChildIds] = (0, import_react33.useState)(() => /* @__PURE__ */ new Set());
|
|
6912
|
+
const setChildOpen = (0, import_react33.useCallback)((id, childOpen) => {
|
|
6836
6913
|
setOpenChildIds((current) => {
|
|
6837
6914
|
const hasId = current.has(id);
|
|
6838
6915
|
if (hasId === childOpen) return current;
|
|
@@ -6842,8 +6919,8 @@ var DrawerRoot = (0, import_react32.forwardRef)(function Drawer({
|
|
|
6842
6919
|
return next;
|
|
6843
6920
|
});
|
|
6844
6921
|
}, []);
|
|
6845
|
-
const stackContextValue = (0,
|
|
6846
|
-
(0,
|
|
6922
|
+
const stackContextValue = (0, import_react33.useMemo)(() => ({ setChildOpen }), [setChildOpen]);
|
|
6923
|
+
(0, import_react33.useEffect)(() => {
|
|
6847
6924
|
if (open) {
|
|
6848
6925
|
setRendered(true);
|
|
6849
6926
|
setClosing(false);
|
|
@@ -6858,12 +6935,12 @@ var DrawerRoot = (0, import_react32.forwardRef)(function Drawer({
|
|
|
6858
6935
|
}, DRAWER_MOTION_DURATION);
|
|
6859
6936
|
return () => window.clearTimeout(timer);
|
|
6860
6937
|
}, [open, rendered]);
|
|
6861
|
-
(0,
|
|
6938
|
+
(0, import_react33.useEffect)(() => {
|
|
6862
6939
|
if (!open || !rendered) return void 0;
|
|
6863
6940
|
const timer = window.setTimeout(() => afterOpenRef.current?.(), DRAWER_MOTION_DURATION);
|
|
6864
6941
|
return () => window.clearTimeout(timer);
|
|
6865
6942
|
}, [open, rendered]);
|
|
6866
|
-
(0,
|
|
6943
|
+
(0, import_react33.useEffect)(() => {
|
|
6867
6944
|
if (!parentStack) return void 0;
|
|
6868
6945
|
parentStack.setChildOpen(drawerId, open);
|
|
6869
6946
|
return () => parentStack.setChildOpen(drawerId, false);
|
|
@@ -6989,9 +7066,9 @@ var Drawer2 = Object.assign(DrawerRoot, {
|
|
|
6989
7066
|
});
|
|
6990
7067
|
|
|
6991
7068
|
// src/components/Form.tsx
|
|
6992
|
-
var
|
|
7069
|
+
var import_react34 = require("react");
|
|
6993
7070
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6994
|
-
var Switch = (0,
|
|
7071
|
+
var Switch = (0, import_react34.forwardRef)(function Switch2({
|
|
6995
7072
|
label,
|
|
6996
7073
|
variant = "standard",
|
|
6997
7074
|
size: sizeProp,
|
|
@@ -7220,9 +7297,9 @@ var FormStore = class {
|
|
|
7220
7297
|
window.requestAnimationFrame(() => focusTarget?.focus({ preventScroll: true }));
|
|
7221
7298
|
};
|
|
7222
7299
|
};
|
|
7223
|
-
var FormContext = (0,
|
|
7300
|
+
var FormContext = (0, import_react34.createContext)(null);
|
|
7224
7301
|
function useForm(form) {
|
|
7225
|
-
const ref = (0,
|
|
7302
|
+
const ref = (0, import_react34.useRef)(form ?? new FormStore());
|
|
7226
7303
|
return [ref.current];
|
|
7227
7304
|
}
|
|
7228
7305
|
function FormRoot({
|
|
@@ -7245,9 +7322,9 @@ function FormRoot({
|
|
|
7245
7322
|
const [internalForm] = useForm(form);
|
|
7246
7323
|
const instance = internalForm;
|
|
7247
7324
|
instance.configure(initialValues, { onFinish, onFinishFailed, onValuesChange });
|
|
7248
|
-
const context = (0,
|
|
7249
|
-
const formRef = (0,
|
|
7250
|
-
(0,
|
|
7325
|
+
const context = (0, import_react34.useMemo)(() => instance, [instance]);
|
|
7326
|
+
const formRef = (0, import_react34.useRef)(null);
|
|
7327
|
+
(0, import_react34.useLayoutEffect)(() => {
|
|
7251
7328
|
const root = formRef.current;
|
|
7252
7329
|
if (!root) return;
|
|
7253
7330
|
let frame = 0;
|
|
@@ -7311,6 +7388,7 @@ function defaultEventValue(valuePropName, args) {
|
|
|
7311
7388
|
function FormItem({
|
|
7312
7389
|
name,
|
|
7313
7390
|
label,
|
|
7391
|
+
align = "start",
|
|
7314
7392
|
rules = [],
|
|
7315
7393
|
required,
|
|
7316
7394
|
extra,
|
|
@@ -7324,11 +7402,11 @@ function FormItem({
|
|
|
7324
7402
|
children,
|
|
7325
7403
|
className = ""
|
|
7326
7404
|
}) {
|
|
7327
|
-
const form = (0,
|
|
7328
|
-
const id = (0,
|
|
7329
|
-
const itemRef = (0,
|
|
7405
|
+
const form = (0, import_react34.useContext)(FormContext);
|
|
7406
|
+
const id = (0, import_react34.useId)();
|
|
7407
|
+
const itemRef = (0, import_react34.useRef)(null);
|
|
7330
7408
|
if (!form) throw new Error("Form.Item \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
|
|
7331
|
-
(0,
|
|
7409
|
+
(0, import_react34.useSyncExternalStore)(form.subscribe, form.getSnapshot, form.getSnapshot);
|
|
7332
7410
|
const path = name === void 0 ? void 0 : pathArray(name);
|
|
7333
7411
|
const key = path ? pathKey2(path) : "";
|
|
7334
7412
|
const ruleRequired = required ?? rules.some((rule) => rule.required);
|
|
@@ -7337,7 +7415,7 @@ function FormItem({
|
|
|
7337
7415
|
const helpContent = help ?? errors[0];
|
|
7338
7416
|
const labelId = label && !noStyle ? `${id}-label` : void 0;
|
|
7339
7417
|
const errorId = `${id}-error`;
|
|
7340
|
-
(0,
|
|
7418
|
+
(0, import_react34.useEffect)(() => {
|
|
7341
7419
|
if (!path) return void 0;
|
|
7342
7420
|
return form.registerField({
|
|
7343
7421
|
name: path,
|
|
@@ -7349,13 +7427,13 @@ function FormItem({
|
|
|
7349
7427
|
if (typeof children === "function") {
|
|
7350
7428
|
content = children(form);
|
|
7351
7429
|
} else {
|
|
7352
|
-
const childArray =
|
|
7353
|
-
const child = childArray.length === 1 && (0,
|
|
7430
|
+
const childArray = import_react34.Children.toArray(children);
|
|
7431
|
+
const child = childArray.length === 1 && (0, import_react34.isValidElement)(childArray[0]) ? childArray[0] : null;
|
|
7354
7432
|
if (child && path) {
|
|
7355
7433
|
const childProps = child.props;
|
|
7356
7434
|
const originalTrigger = childProps[trigger];
|
|
7357
7435
|
const validationEvents = Array.isArray(validateTrigger) ? validateTrigger : [validateTrigger];
|
|
7358
|
-
content = (0,
|
|
7436
|
+
content = (0, import_react34.cloneElement)(child, {
|
|
7359
7437
|
id: childProps.id ?? id,
|
|
7360
7438
|
[valuePropName]: form.getFieldValue(path) ?? (valuePropName === "checked" ? false : ""),
|
|
7361
7439
|
[trigger]: (...args) => {
|
|
@@ -7383,7 +7461,7 @@ function FormItem({
|
|
|
7383
7461
|
if (noStyle) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: content });
|
|
7384
7462
|
const inputWrap = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "sia-form-item__input-wrap", children: content });
|
|
7385
7463
|
const hasError = status === "error" && Boolean(helpContent);
|
|
7386
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ref: itemRef, className: `sia-form-item${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
|
|
7464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ref: itemRef, className: `sia-form-item${align === "center" ? " sia-form-item--align-center" : ""}${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
|
|
7387
7465
|
label ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "sia-form-item__label-content", children: [
|
|
7388
7466
|
ruleRequired ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
|
|
7389
7467
|
label
|
|
@@ -7411,9 +7489,9 @@ function FormItem({
|
|
|
7411
7489
|
] });
|
|
7412
7490
|
}
|
|
7413
7491
|
function FormList({ name, children }) {
|
|
7414
|
-
const form = (0,
|
|
7492
|
+
const form = (0, import_react34.useContext)(FormContext);
|
|
7415
7493
|
if (!form) throw new Error("Form.List \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
|
|
7416
|
-
(0,
|
|
7494
|
+
(0, import_react34.useSyncExternalStore)(form.subscribe, form.getSnapshot, form.getSnapshot);
|
|
7417
7495
|
const current = form.getFieldValue(name);
|
|
7418
7496
|
const values = Array.isArray(current) ? current : [];
|
|
7419
7497
|
const operations = {
|
|
@@ -7450,13 +7528,13 @@ var Form = Object.assign(FormRoot, {
|
|
|
7450
7528
|
});
|
|
7451
7529
|
|
|
7452
7530
|
// src/components/Radio.tsx
|
|
7453
|
-
var
|
|
7531
|
+
var import_react35 = require("react");
|
|
7454
7532
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
7455
|
-
var RadioContext = (0,
|
|
7456
|
-
var RadioRoot = (0,
|
|
7533
|
+
var RadioContext = (0, import_react35.createContext)(null);
|
|
7534
|
+
var RadioRoot = (0, import_react35.forwardRef)(function Radio({ value, size: sizeProp, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
|
|
7457
7535
|
const size = useControlSize(sizeProp);
|
|
7458
|
-
const group = (0,
|
|
7459
|
-
const fallbackId = (0,
|
|
7536
|
+
const group = (0, import_react35.useContext)(RadioContext);
|
|
7537
|
+
const fallbackId = (0, import_react35.useId)();
|
|
7460
7538
|
const grouped = group !== null;
|
|
7461
7539
|
const currentChecked = grouped ? group.value === value : checked;
|
|
7462
7540
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: `sia-radio sia-radio--${size}${button ? " sia-radio--button" : ""}${button && group?.buttonStyle === "solid" ? " sia-radio--solid" : ""}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
@@ -7500,7 +7578,7 @@ function RadioGroup({
|
|
|
7500
7578
|
onChange
|
|
7501
7579
|
}) {
|
|
7502
7580
|
const size = useControlSize(sizeProp);
|
|
7503
|
-
const fallbackName = (0,
|
|
7581
|
+
const fallbackName = (0, import_react35.useId)();
|
|
7504
7582
|
const [currentValue, setValue2] = useControllableState({
|
|
7505
7583
|
value,
|
|
7506
7584
|
defaultValue,
|
|
@@ -7508,7 +7586,7 @@ function RadioGroup({
|
|
|
7508
7586
|
if (next !== void 0) onChange?.(next);
|
|
7509
7587
|
}
|
|
7510
7588
|
});
|
|
7511
|
-
const context = (0,
|
|
7589
|
+
const context = (0, import_react35.useMemo)(() => ({
|
|
7512
7590
|
value: currentValue,
|
|
7513
7591
|
name: name ?? fallbackName,
|
|
7514
7592
|
disabled,
|
|
@@ -7532,7 +7610,7 @@ var Radio2 = Object.assign(RadioRoot, {
|
|
|
7532
7610
|
});
|
|
7533
7611
|
|
|
7534
7612
|
// src/components/Slider.tsx
|
|
7535
|
-
var
|
|
7613
|
+
var import_react36 = require("react");
|
|
7536
7614
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7537
7615
|
function percent(value, min, max) {
|
|
7538
7616
|
return (value - min) / (max - min) * 100;
|
|
@@ -7556,7 +7634,7 @@ function Slider({
|
|
|
7556
7634
|
}) {
|
|
7557
7635
|
const fallback = defaultValue ?? (range ? [min, max] : min);
|
|
7558
7636
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue: fallback, onChange });
|
|
7559
|
-
const [activeThumb, setActiveThumb] = (0,
|
|
7637
|
+
const [activeThumb, setActiveThumb] = (0, import_react36.useState)(null);
|
|
7560
7638
|
const values = Array.isArray(currentValue) ? [...currentValue] : [currentValue];
|
|
7561
7639
|
const start = range ? percent(Math.min(values[0], values[1]), min, max) : 0;
|
|
7562
7640
|
const end = percent(range ? Math.max(values[0], values[1]) : values[0], min, max);
|
|
@@ -7653,7 +7731,7 @@ function Slider({
|
|
|
7653
7731
|
}
|
|
7654
7732
|
|
|
7655
7733
|
// src/components/ColorPicker.tsx
|
|
7656
|
-
var
|
|
7734
|
+
var import_react37 = require("react");
|
|
7657
7735
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
7658
7736
|
var DEFAULT_MODES = ["solid", "gradient"];
|
|
7659
7737
|
var gradientStopSeed = 0;
|
|
@@ -7744,12 +7822,12 @@ function ColorPicker({
|
|
|
7744
7822
|
...props
|
|
7745
7823
|
}) {
|
|
7746
7824
|
const size = useControlSize(sizeProp);
|
|
7747
|
-
const rootRef = (0,
|
|
7748
|
-
const popupRef = (0,
|
|
7749
|
-
const lastEmittedValue = (0,
|
|
7825
|
+
const rootRef = (0, import_react37.useRef)(null);
|
|
7826
|
+
const popupRef = (0, import_react37.useRef)(null);
|
|
7827
|
+
const lastEmittedValue = (0, import_react37.useRef)();
|
|
7750
7828
|
const initialGradient = parseGradient(value ?? defaultValue);
|
|
7751
7829
|
const initialSolid = initialGradient?.stops[0]?.color ?? normalizeHex(value || defaultValue);
|
|
7752
|
-
const [open, setOpen] = (0,
|
|
7830
|
+
const [open, setOpen] = (0, import_react37.useState)(false);
|
|
7753
7831
|
const [color, setColor] = useControllableState({
|
|
7754
7832
|
value,
|
|
7755
7833
|
defaultValue: initialGradient ? formatGradient(initialGradient.angle, initialGradient.stops.map((stop, index) => ({ id: index, ...stop }))) : normalizeHex(defaultValue),
|
|
@@ -7760,17 +7838,17 @@ function ColorPicker({
|
|
|
7760
7838
|
defaultValue: initialGradient ? "gradient" : defaultMode,
|
|
7761
7839
|
onChange: onModeChange
|
|
7762
7840
|
});
|
|
7763
|
-
const [solidColor, setSolidColor] = (0,
|
|
7764
|
-
const [gradientAngle, setGradientAngle] = (0,
|
|
7765
|
-
const [gradientStops, setGradientStops] = (0,
|
|
7766
|
-
const [activeStopId, setActiveStopId] = (0,
|
|
7841
|
+
const [solidColor, setSolidColor] = (0, import_react37.useState)(initialSolid);
|
|
7842
|
+
const [gradientAngle, setGradientAngle] = (0, import_react37.useState)(initialGradient?.angle ?? 90);
|
|
7843
|
+
const [gradientStops, setGradientStops] = (0, import_react37.useState)(() => initialGradient ? initialGradient.stops.map((stop) => createStop(stop.color, stop.position)) : createDefaultStops(initialSolid));
|
|
7844
|
+
const [activeStopId, setActiveStopId] = (0, import_react37.useState)(() => gradientStops[0]?.id ?? 0);
|
|
7767
7845
|
const activeStop = gradientStops.find((stop) => stop.id === activeStopId) ?? gradientStops[0];
|
|
7768
7846
|
const editingColor = currentMode === "gradient" ? activeStop?.color ?? solidColor : solidColor;
|
|
7769
7847
|
const rgba = parseHex(editingColor) ?? parseHex("#1677FF");
|
|
7770
7848
|
const hsv = rgbToHsv(rgba);
|
|
7771
|
-
const [hexDraft, setHexDraft] = (0,
|
|
7849
|
+
const [hexDraft, setHexDraft] = (0, import_react37.useState)(editingColor);
|
|
7772
7850
|
const gradientValue = formatGradient(gradientAngle, gradientStops);
|
|
7773
|
-
(0,
|
|
7851
|
+
(0, import_react37.useEffect)(() => {
|
|
7774
7852
|
if (!open) return void 0;
|
|
7775
7853
|
const close = (event) => {
|
|
7776
7854
|
const target = event.target;
|
|
@@ -7779,10 +7857,10 @@ function ColorPicker({
|
|
|
7779
7857
|
document.addEventListener("pointerdown", close);
|
|
7780
7858
|
return () => document.removeEventListener("pointerdown", close);
|
|
7781
7859
|
}, [open]);
|
|
7782
|
-
(0,
|
|
7860
|
+
(0, import_react37.useEffect)(() => {
|
|
7783
7861
|
setHexDraft(editingColor);
|
|
7784
7862
|
}, [editingColor]);
|
|
7785
|
-
(0,
|
|
7863
|
+
(0, import_react37.useEffect)(() => {
|
|
7786
7864
|
if (value === void 0 || value === lastEmittedValue.current) return;
|
|
7787
7865
|
const parsed = parseGradient(value);
|
|
7788
7866
|
if (parsed) {
|
|
@@ -7969,10 +8047,10 @@ function ColorPicker({
|
|
|
7969
8047
|
}
|
|
7970
8048
|
|
|
7971
8049
|
// src/components/DatePicker.tsx
|
|
7972
|
-
var
|
|
8050
|
+
var import_react39 = require("react");
|
|
7973
8051
|
|
|
7974
8052
|
// src/components/DatePickerPanel.tsx
|
|
7975
|
-
var
|
|
8053
|
+
var import_react38 = require("react");
|
|
7976
8054
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
7977
8055
|
function pad2(value) {
|
|
7978
8056
|
return String(value).padStart(2, "0");
|
|
@@ -8116,12 +8194,12 @@ function TimePanel({
|
|
|
8116
8194
|
onChange
|
|
8117
8195
|
}) {
|
|
8118
8196
|
const [hour = "00", minute = "00", second = "00"] = value.split(":");
|
|
8119
|
-
const columnsRef = (0,
|
|
8120
|
-
const hourRef = (0,
|
|
8121
|
-
const minuteRef = (0,
|
|
8122
|
-
const secondRef = (0,
|
|
8197
|
+
const columnsRef = (0, import_react38.useRef)(null);
|
|
8198
|
+
const hourRef = (0, import_react38.useRef)(null);
|
|
8199
|
+
const minuteRef = (0, import_react38.useRef)(null);
|
|
8200
|
+
const secondRef = (0, import_react38.useRef)(null);
|
|
8123
8201
|
const columnRefs = [hourRef, minuteRef, secondRef];
|
|
8124
|
-
(0,
|
|
8202
|
+
(0, import_react38.useLayoutEffect)(() => {
|
|
8125
8203
|
for (const column of columnsRef.current?.children ?? []) {
|
|
8126
8204
|
const selected = column.querySelector('[aria-selected="true"]');
|
|
8127
8205
|
const first = column.firstElementChild;
|
|
@@ -8262,23 +8340,23 @@ function DatePicker({
|
|
|
8262
8340
|
...props
|
|
8263
8341
|
}) {
|
|
8264
8342
|
const size = useControlSize(sizeProp);
|
|
8265
|
-
const id = (0,
|
|
8266
|
-
const rootRef = (0,
|
|
8267
|
-
const popupRef = (0,
|
|
8343
|
+
const id = (0, import_react39.useId)();
|
|
8344
|
+
const rootRef = (0, import_react39.useRef)(null);
|
|
8345
|
+
const popupRef = (0, import_react39.useRef)(null);
|
|
8268
8346
|
const initialValue = defaultValue ?? (multiple ? [] : "");
|
|
8269
8347
|
const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue: initialValue, onChange });
|
|
8270
8348
|
const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
8271
|
-
const [draftValue, setDraftValue] = (0,
|
|
8349
|
+
const [draftValue, setDraftValue] = (0, import_react39.useState)(currentValue);
|
|
8272
8350
|
const firstCurrent = Array.isArray(currentValue) ? currentValue[0] : currentValue;
|
|
8273
|
-
const [viewMonth, setViewMonth] = (0,
|
|
8274
|
-
const [draftTime, setDraftTime] = (0,
|
|
8351
|
+
const [viewMonth, setViewMonth] = (0, import_react39.useState)(() => startOfMonth(parseDate2(dayFromValue(firstCurrent)) ?? /* @__PURE__ */ new Date()));
|
|
8352
|
+
const [draftTime, setDraftTime] = (0, import_react39.useState)(() => timePart(firstCurrent, defaultTimeFrom(showTime)));
|
|
8275
8353
|
const resolvedNeedConfirm = needConfirm ?? Boolean(showTime);
|
|
8276
8354
|
const showSecond = showSecondFrom(showTime);
|
|
8277
|
-
const selectedDates = (0,
|
|
8355
|
+
const selectedDates = (0, import_react39.useMemo)(() => {
|
|
8278
8356
|
const values = Array.isArray(draftValue) ? draftValue : draftValue ? [draftValue] : [];
|
|
8279
8357
|
return values.map(dayFromValue).filter(Boolean);
|
|
8280
8358
|
}, [draftValue]);
|
|
8281
|
-
(0,
|
|
8359
|
+
(0, import_react39.useEffect)(() => {
|
|
8282
8360
|
if (!visible) return void 0;
|
|
8283
8361
|
const close = (event) => {
|
|
8284
8362
|
const target = event.target;
|
|
@@ -8452,15 +8530,15 @@ function DateRangePicker({
|
|
|
8452
8530
|
...props
|
|
8453
8531
|
}) {
|
|
8454
8532
|
const size = useControlSize(sizeProp);
|
|
8455
|
-
const id = (0,
|
|
8456
|
-
const rootRef = (0,
|
|
8457
|
-
const popupRef = (0,
|
|
8533
|
+
const id = (0, import_react39.useId)();
|
|
8534
|
+
const rootRef = (0, import_react39.useRef)(null);
|
|
8535
|
+
const popupRef = (0, import_react39.useRef)(null);
|
|
8458
8536
|
const [currentValue, setCurrentValue] = useControllableState({ value: value === void 0 ? void 0 : Array.isArray(value) ? value : ["", ""], defaultValue, onChange });
|
|
8459
8537
|
const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
8460
|
-
const [draftValue, setDraftValue] = (0,
|
|
8461
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
8462
|
-
const indicatorRef = (0,
|
|
8463
|
-
(0,
|
|
8538
|
+
const [draftValue, setDraftValue] = (0, import_react39.useState)(currentValue);
|
|
8539
|
+
const [activeIndex, setActiveIndex] = (0, import_react39.useState)(endpointDisabled[0] || currentValue[0] && !currentValue[1] ? 1 : 0);
|
|
8540
|
+
const indicatorRef = (0, import_react39.useRef)(null);
|
|
8541
|
+
(0, import_react39.useLayoutEffect)(() => {
|
|
8464
8542
|
const field = rootRef.current?.querySelector(`[data-range-endpoint="${activeIndex}"]`);
|
|
8465
8543
|
const indicator = indicatorRef.current;
|
|
8466
8544
|
if (!field || !indicator) return;
|
|
@@ -8477,22 +8555,22 @@ function DateRangePicker({
|
|
|
8477
8555
|
}
|
|
8478
8556
|
return () => observer.disconnect();
|
|
8479
8557
|
});
|
|
8480
|
-
const [confirmedIndex, setConfirmedIndex] = (0,
|
|
8481
|
-
const [presetSelected, setPresetSelected] = (0,
|
|
8482
|
-
const [hoverDate, setHoverDate] = (0,
|
|
8483
|
-
const [viewMonth, setViewMonth] = (0,
|
|
8484
|
-
const [endViewMonth, setEndViewMonth] = (0,
|
|
8558
|
+
const [confirmedIndex, setConfirmedIndex] = (0, import_react39.useState)(null);
|
|
8559
|
+
const [presetSelected, setPresetSelected] = (0, import_react39.useState)(false);
|
|
8560
|
+
const [hoverDate, setHoverDate] = (0, import_react39.useState)("");
|
|
8561
|
+
const [viewMonth, setViewMonth] = (0, import_react39.useState)(() => startOfMonth(parseDate2(dayFromValue(currentValue[0] || currentValue[1])) ?? /* @__PURE__ */ new Date()));
|
|
8562
|
+
const [endViewMonth, setEndViewMonth] = (0, import_react39.useState)(() => startOfMonth(parseDate2(dayFromValue(currentValue[1])) ?? addMonths(parseDate2(dayFromValue(currentValue[0])) ?? /* @__PURE__ */ new Date(), 1)));
|
|
8485
8563
|
const showSecond = showSecondFrom(showTime);
|
|
8486
8564
|
const defaultTime = defaultTimeFrom(showTime);
|
|
8487
8565
|
const defaultEndTime = defaultTimeFrom(showTime, 1);
|
|
8488
|
-
const [times, setTimes] = (0,
|
|
8566
|
+
const [times, setTimes] = (0, import_react39.useState)([
|
|
8489
8567
|
timePart(currentValue[0], defaultTime),
|
|
8490
8568
|
timePart(currentValue[1], defaultEndTime)
|
|
8491
8569
|
]);
|
|
8492
8570
|
const resolvedNeedConfirm = needConfirm ?? Boolean(showTime);
|
|
8493
8571
|
const rangeDates = [dayFromValue(draftValue[0]), dayFromValue(draftValue[1])];
|
|
8494
8572
|
const invalidDateTimeRange = Boolean(showTime && draftValue[0] && draftValue[1] && draftValue[0] > draftValue[1]);
|
|
8495
|
-
(0,
|
|
8573
|
+
(0, import_react39.useEffect)(() => {
|
|
8496
8574
|
if (!visible) return void 0;
|
|
8497
8575
|
const close = (event) => {
|
|
8498
8576
|
const target = event.target;
|
|
@@ -8881,7 +8959,7 @@ function SelectDateRange({
|
|
|
8881
8959
|
}
|
|
8882
8960
|
|
|
8883
8961
|
// src/components/TimePicker.tsx
|
|
8884
|
-
var
|
|
8962
|
+
var import_react40 = require("react");
|
|
8885
8963
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
8886
8964
|
function seconds(value) {
|
|
8887
8965
|
const [h = 0, m = 0, s = 0] = value.split(":").map(Number);
|
|
@@ -8911,14 +8989,14 @@ function TimePicker({
|
|
|
8911
8989
|
...props
|
|
8912
8990
|
}) {
|
|
8913
8991
|
const size = useControlSize(sizeProp);
|
|
8914
|
-
const id = (0,
|
|
8915
|
-
const rootRef = (0,
|
|
8916
|
-
const inputRef = (0,
|
|
8917
|
-
const popupRef = (0,
|
|
8918
|
-
const focusPanel = (0,
|
|
8992
|
+
const id = (0, import_react40.useId)();
|
|
8993
|
+
const rootRef = (0, import_react40.useRef)(null);
|
|
8994
|
+
const inputRef = (0, import_react40.useRef)(null);
|
|
8995
|
+
const popupRef = (0, import_react40.useRef)(null);
|
|
8996
|
+
const focusPanel = (0, import_react40.useRef)(false);
|
|
8919
8997
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue, onChange });
|
|
8920
|
-
const [open, setOpen] = (0,
|
|
8921
|
-
const [draft, setDraft] = (0,
|
|
8998
|
+
const [open, setOpen] = (0, import_react40.useState)(false);
|
|
8999
|
+
const [draft, setDraft] = (0, import_react40.useState)("00:00:00");
|
|
8922
9000
|
const normalize = (time) => showSecond ? (time + ":00").slice(0, 8) : time.slice(0, 5);
|
|
8923
9001
|
const unavailable = (time) => {
|
|
8924
9002
|
const normalized = normalize(time);
|
|
@@ -8936,7 +9014,7 @@ function TimePicker({
|
|
|
8936
9014
|
setOpen(next);
|
|
8937
9015
|
onOpenChange?.(next);
|
|
8938
9016
|
}
|
|
8939
|
-
(0,
|
|
9017
|
+
(0, import_react40.useEffect)(() => {
|
|
8940
9018
|
if (!open) return;
|
|
8941
9019
|
if (focusPanel.current) {
|
|
8942
9020
|
popupRef.current?.querySelector('[aria-selected="true"]')?.focus();
|
|
@@ -9055,7 +9133,7 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
|
|
|
9055
9133
|
})(TimePicker || (TimePicker = {}));
|
|
9056
9134
|
|
|
9057
9135
|
// src/components/TreeSelect.tsx
|
|
9058
|
-
var
|
|
9136
|
+
var import_react41 = require("react");
|
|
9059
9137
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
9060
9138
|
function flattenTree(nodes, expanded, search, filter, depth = 0, parents = [], ancestorMatched = false) {
|
|
9061
9139
|
const result = [];
|
|
@@ -9118,9 +9196,9 @@ function TreeSelect({
|
|
|
9118
9196
|
...props
|
|
9119
9197
|
}) {
|
|
9120
9198
|
const size = useControlSize(sizeProp);
|
|
9121
|
-
const rootRef = (0,
|
|
9122
|
-
const popupRef = (0,
|
|
9123
|
-
const nodeIndex = (0,
|
|
9199
|
+
const rootRef = (0, import_react41.useRef)(null);
|
|
9200
|
+
const popupRef = (0, import_react41.useRef)(null);
|
|
9201
|
+
const nodeIndex = (0, import_react41.useMemo)(() => {
|
|
9124
9202
|
const index = /* @__PURE__ */ new Map();
|
|
9125
9203
|
const visit = (nodes) => nodes.forEach((node) => {
|
|
9126
9204
|
index.set(node.value, node);
|
|
@@ -9139,7 +9217,7 @@ function TreeSelect({
|
|
|
9139
9217
|
});
|
|
9140
9218
|
const [open, setOpen] = useControllableState({ value: controlledOpen, defaultValue: defaultOpen, onChange: onDropdownVisibleChange });
|
|
9141
9219
|
const [search, setSearch] = useControllableState({ value: searchValue, defaultValue: "", onChange: onSearch });
|
|
9142
|
-
const [expanded, setExpanded] = (0,
|
|
9220
|
+
const [expanded, setExpanded] = (0, import_react41.useState)(() => {
|
|
9143
9221
|
if (!treeDefaultExpandAll) return new Set(treeDefaultExpandedKeys);
|
|
9144
9222
|
const values = [];
|
|
9145
9223
|
const collect = (nodes) => nodes.forEach((node) => {
|
|
@@ -9155,7 +9233,7 @@ function TreeSelect({
|
|
|
9155
9233
|
const expandedSet = treeExpandedKeys ? new Set(treeExpandedKeys) : expanded;
|
|
9156
9234
|
const selectedNodes = resolveNodes(selectedValues);
|
|
9157
9235
|
const visibleNodes = flattenTree(treeData, expandedSet, search, filterTreeNode);
|
|
9158
|
-
(0,
|
|
9236
|
+
(0, import_react41.useEffect)(() => {
|
|
9159
9237
|
if (!open || treeExpandedKeys) return;
|
|
9160
9238
|
const keys = new Set(expanded);
|
|
9161
9239
|
const walk = (nodes, parents) => nodes.forEach((node) => {
|
|
@@ -9215,7 +9293,7 @@ function TreeSelect({
|
|
|
9215
9293
|
setCurrentValue(multi ? [] : void 0);
|
|
9216
9294
|
onClear?.();
|
|
9217
9295
|
}
|
|
9218
|
-
(0,
|
|
9296
|
+
(0, import_react41.useEffect)(() => {
|
|
9219
9297
|
if (!open) return void 0;
|
|
9220
9298
|
const close = (event) => {
|
|
9221
9299
|
const target = event.target;
|
|
@@ -9374,7 +9452,7 @@ function buildFlatTree(items, options = {}) {
|
|
|
9374
9452
|
}
|
|
9375
9453
|
|
|
9376
9454
|
// src/components/Upload.tsx
|
|
9377
|
-
var
|
|
9455
|
+
var import_react42 = require("react");
|
|
9378
9456
|
|
|
9379
9457
|
// src/components/uploadFiles.ts
|
|
9380
9458
|
function acceptsUploadFile(file, accept) {
|
|
@@ -9613,8 +9691,8 @@ var message = {
|
|
|
9613
9691
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
9614
9692
|
var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
|
|
9615
9693
|
function useThumbnail(file, accept) {
|
|
9616
|
-
const [local, setLocal] = (0,
|
|
9617
|
-
(0,
|
|
9694
|
+
const [local, setLocal] = (0, import_react42.useState)();
|
|
9695
|
+
(0, import_react42.useEffect)(() => {
|
|
9618
9696
|
if (!file?.thumbUrl && file?.originFileObj?.type.startsWith("image/")) {
|
|
9619
9697
|
const url = URL.createObjectURL(file.originFileObj);
|
|
9620
9698
|
setLocal(url);
|
|
@@ -9626,9 +9704,9 @@ function useThumbnail(file, accept) {
|
|
|
9626
9704
|
}
|
|
9627
9705
|
function UploadItem({ file, files, props, actions }) {
|
|
9628
9706
|
const source = useThumbnail(file, props.accept);
|
|
9629
|
-
const [failed, setFailed] = (0,
|
|
9630
|
-
const [downloading, setDownloading] = (0,
|
|
9631
|
-
const downloadingRef = (0,
|
|
9707
|
+
const [failed, setFailed] = (0, import_react42.useState)(false);
|
|
9708
|
+
const [downloading, setDownloading] = (0, import_react42.useState)(false);
|
|
9709
|
+
const downloadingRef = (0, import_react42.useRef)(false);
|
|
9632
9710
|
const canPreview = !!(source || file.url || file.originFileObj || props.onPreview);
|
|
9633
9711
|
const canDownload = !!(file.url || file.originFileObj || props.downloadRequest);
|
|
9634
9712
|
async function download() {
|
|
@@ -9644,7 +9722,7 @@ function UploadItem({ file, files, props, actions }) {
|
|
|
9644
9722
|
setDownloading(false);
|
|
9645
9723
|
}
|
|
9646
9724
|
}
|
|
9647
|
-
(0,
|
|
9725
|
+
(0, import_react42.useEffect)(() => setFailed(false), [source]);
|
|
9648
9726
|
const node = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `sia-upload__item sia-upload__item--${file.status ?? "ready"}`, children: [
|
|
9649
9727
|
props.listType !== "text" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { variant: "text", className: "sia-upload__thumbnail", "aria-label": `\u9884\u89C8\u7F29\u7565\u56FE ${file.name}`, onClick: actions.preview, disabled: !canPreview, children: source && !failed ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("img", { src: source, alt: file.name, onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: file.type?.startsWith("image/") ? "image" : "file", size: 28 }) }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sia-upload__file-icon", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: file.status === "done" ? "circle-check" : "file", size: 24 }) }),
|
|
9650
9728
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sia-upload__name", ...withTitleTooltip({ title: file.relativePath || file.name }), children: file.url ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("a", { href: file.url, target: "_blank", rel: "noreferrer", children: file.name }) : file.name }),
|
|
@@ -9666,7 +9744,7 @@ function UploadItem({ file, files, props, actions }) {
|
|
|
9666
9744
|
] });
|
|
9667
9745
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children: props.itemRender ? props.itemRender(node, file, files, actions) : node });
|
|
9668
9746
|
}
|
|
9669
|
-
var UploadRoot = (0,
|
|
9747
|
+
var UploadRoot = (0, import_react42.forwardRef)(function UploadRoot2({
|
|
9670
9748
|
accept,
|
|
9671
9749
|
multiple = false,
|
|
9672
9750
|
directory = false,
|
|
@@ -9705,19 +9783,19 @@ var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
|
|
|
9705
9783
|
const cardWidth = cardDimension(typeof cardSize === "number" ? cardSize : cardSize?.width);
|
|
9706
9784
|
const cardHeight = cardDimension(typeof cardSize === "number" ? cardSize : cardSize?.height);
|
|
9707
9785
|
const compactCard = listType === "picture-card" && (cardWidth < 88 || cardHeight < 88);
|
|
9708
|
-
const inputRef = (0,
|
|
9709
|
-
const [internalFiles, setInternalFiles] = (0,
|
|
9786
|
+
const inputRef = (0, import_react42.useRef)(null);
|
|
9787
|
+
const [internalFiles, setInternalFiles] = (0, import_react42.useState)(defaultFileList);
|
|
9710
9788
|
const files = fileList ?? internalFiles;
|
|
9711
|
-
const filesRef = (0,
|
|
9789
|
+
const filesRef = (0, import_react42.useRef)(files);
|
|
9712
9790
|
filesRef.current = files;
|
|
9713
|
-
const tasks = (0,
|
|
9714
|
-
const mounted = (0,
|
|
9715
|
-
const [dragging, setDragging] = (0,
|
|
9716
|
-
const [preview, setPreview] = (0,
|
|
9791
|
+
const tasks = (0, import_react42.useRef)(/* @__PURE__ */ new Map());
|
|
9792
|
+
const mounted = (0, import_react42.useRef)(true);
|
|
9793
|
+
const [dragging, setDragging] = (0, import_react42.useState)(false);
|
|
9794
|
+
const [preview, setPreview] = (0, import_react42.useState)();
|
|
9717
9795
|
const previewSource = useThumbnail(preview, accept);
|
|
9718
9796
|
const limit = maxCount2 === void 0 || !Number.isFinite(maxCount2) ? Infinity : Math.max(0, Math.floor(maxCount2));
|
|
9719
9797
|
const full = files.length >= limit;
|
|
9720
|
-
const current = (0,
|
|
9798
|
+
const current = (0, import_react42.useRef)({ disabled, directory, recursive });
|
|
9721
9799
|
current.current = { disabled, directory, recursive };
|
|
9722
9800
|
function cancel(uid) {
|
|
9723
9801
|
const task = tasks.current.get(uid);
|
|
@@ -9729,14 +9807,14 @@ var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
|
|
|
9729
9807
|
}
|
|
9730
9808
|
task?.finish();
|
|
9731
9809
|
}
|
|
9732
|
-
(0,
|
|
9810
|
+
(0, import_react42.useEffect)(() => {
|
|
9733
9811
|
mounted.current = true;
|
|
9734
9812
|
return () => {
|
|
9735
9813
|
mounted.current = false;
|
|
9736
9814
|
[...tasks.current.keys()].forEach(cancel);
|
|
9737
9815
|
};
|
|
9738
9816
|
}, []);
|
|
9739
|
-
(0,
|
|
9817
|
+
(0, import_react42.useEffect)(() => {
|
|
9740
9818
|
for (const uid of tasks.current.keys()) if (!files.some((file) => file.uid === uid)) cancel(uid);
|
|
9741
9819
|
if (preview && !files.some((file) => file.uid === preview.uid)) setPreview(void 0);
|
|
9742
9820
|
}, [files, preview]);
|
|
@@ -9842,7 +9920,7 @@ var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
|
|
|
9842
9920
|
} catch {
|
|
9843
9921
|
}
|
|
9844
9922
|
}
|
|
9845
|
-
(0,
|
|
9923
|
+
(0, import_react42.useImperativeHandle)(ref, () => ({
|
|
9846
9924
|
upload: async (uid) => {
|
|
9847
9925
|
await Promise.all(filesRef.current.filter((file) => (!uid || file.uid === uid) && file.status !== "done").map(start));
|
|
9848
9926
|
},
|
|
@@ -9970,7 +10048,7 @@ var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
|
|
|
9970
10048
|
}
|
|
9971
10049
|
);
|
|
9972
10050
|
});
|
|
9973
|
-
var UploadDragger = (0,
|
|
10051
|
+
var UploadDragger = (0, import_react42.forwardRef)(function UploadDragger2({ hint = "\u652F\u6301\u5355\u4E2A\u6216\u6279\u91CF\u4E0A\u4F20", children, className = "", ...props }, ref) {
|
|
9974
10052
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UploadRoot, { ...props, ref, className: `sia-upload-dragger ${className}`.trim(), children: children ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "sia-upload-dragger__content", children: [
|
|
9975
10053
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: "upload", size: 32 }),
|
|
9976
10054
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("strong", { children: [
|
|
@@ -9990,7 +10068,7 @@ var Upload = Object.assign(UploadRoot, {
|
|
|
9990
10068
|
});
|
|
9991
10069
|
|
|
9992
10070
|
// src/components/RichTextEditor.tsx
|
|
9993
|
-
var
|
|
10071
|
+
var import_react43 = require("react");
|
|
9994
10072
|
var import_dompurify = __toESM(require("dompurify"), 1);
|
|
9995
10073
|
var import_core = require("@tiptap/core");
|
|
9996
10074
|
var import_starter_kit = __toESM(require("@tiptap/starter-kit"), 1);
|
|
@@ -10019,7 +10097,7 @@ function sanitizeContent(value) {
|
|
|
10019
10097
|
}).replace(/<img\b/giu, '<img loading="lazy" decoding="async"');
|
|
10020
10098
|
}
|
|
10021
10099
|
function RichTextContent({ content, emptyText = "\u6682\u65E0\u5185\u5BB9", className = "", ...props }) {
|
|
10022
|
-
const html = (0,
|
|
10100
|
+
const html = (0, import_react43.useMemo)(() => sanitizeContent(content), [content]);
|
|
10023
10101
|
if (!html.trim()) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: `sia-rich-text-content sia-rich-text-content--empty ${className}`.trim(), children: emptyText });
|
|
10024
10102
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("article", { className: `sia-rich-text-content ${className}`.trim(), dangerouslySetInnerHTML: { __html: html }, ...withTitleTooltip(props) });
|
|
10025
10103
|
}
|
|
@@ -10042,31 +10120,31 @@ function RichTextEditor({
|
|
|
10042
10120
|
"aria-label": ariaLabel,
|
|
10043
10121
|
...props
|
|
10044
10122
|
}) {
|
|
10045
|
-
const initialValueRef = (0,
|
|
10046
|
-
const lastEmittedValueRef = (0,
|
|
10047
|
-
const onChangeRef = (0,
|
|
10048
|
-
const onPasteImageRef = (0,
|
|
10049
|
-
const saveShortcutRef = (0,
|
|
10050
|
-
const contentFormatRef = (0,
|
|
10051
|
-
const editorElementRef = (0,
|
|
10052
|
-
const editorRef = (0,
|
|
10053
|
-
const [editor, setEditor] = (0,
|
|
10054
|
-
const [linkEditorOpen, setLinkEditorOpen] = (0,
|
|
10055
|
-
const [linkHref, setLinkHref] = (0,
|
|
10056
|
-
const [, setEditorRevision] = (0,
|
|
10057
|
-
(0,
|
|
10123
|
+
const initialValueRef = (0, import_react43.useRef)(value ?? defaultValue);
|
|
10124
|
+
const lastEmittedValueRef = (0, import_react43.useRef)(value ?? defaultValue);
|
|
10125
|
+
const onChangeRef = (0, import_react43.useRef)(onChange);
|
|
10126
|
+
const onPasteImageRef = (0, import_react43.useRef)(onPasteImage);
|
|
10127
|
+
const saveShortcutRef = (0, import_react43.useRef)(saveShortcut);
|
|
10128
|
+
const contentFormatRef = (0, import_react43.useRef)(contentFormat);
|
|
10129
|
+
const editorElementRef = (0, import_react43.useRef)(null);
|
|
10130
|
+
const editorRef = (0, import_react43.useRef)(null);
|
|
10131
|
+
const [editor, setEditor] = (0, import_react43.useState)(null);
|
|
10132
|
+
const [linkEditorOpen, setLinkEditorOpen] = (0, import_react43.useState)(false);
|
|
10133
|
+
const [linkHref, setLinkHref] = (0, import_react43.useState)("");
|
|
10134
|
+
const [, setEditorRevision] = (0, import_react43.useState)(0);
|
|
10135
|
+
(0, import_react43.useEffect)(() => {
|
|
10058
10136
|
onChangeRef.current = onChange;
|
|
10059
10137
|
}, [onChange]);
|
|
10060
|
-
(0,
|
|
10138
|
+
(0, import_react43.useEffect)(() => {
|
|
10061
10139
|
onPasteImageRef.current = onPasteImage;
|
|
10062
10140
|
}, [onPasteImage]);
|
|
10063
|
-
(0,
|
|
10141
|
+
(0, import_react43.useEffect)(() => {
|
|
10064
10142
|
saveShortcutRef.current = saveShortcut;
|
|
10065
10143
|
}, [saveShortcut]);
|
|
10066
|
-
(0,
|
|
10144
|
+
(0, import_react43.useEffect)(() => {
|
|
10067
10145
|
contentFormatRef.current = contentFormat;
|
|
10068
10146
|
}, [contentFormat]);
|
|
10069
|
-
const extensions = (0,
|
|
10147
|
+
const extensions = (0, import_react43.useMemo)(() => [
|
|
10070
10148
|
import_starter_kit.default.configure({
|
|
10071
10149
|
heading: { levels: [1, 2, 3, 4, 5, 6] },
|
|
10072
10150
|
link: { openOnClick: false, autolink: true, linkOnPaste: true },
|
|
@@ -10082,7 +10160,7 @@ function RichTextEditor({
|
|
|
10082
10160
|
import_extension_task_item.default.configure({ nested: true }),
|
|
10083
10161
|
import_markdown.Markdown.configure({ markedOptions: { gfm: true } })
|
|
10084
10162
|
], [placeholder]);
|
|
10085
|
-
(0,
|
|
10163
|
+
(0, import_react43.useEffect)(() => {
|
|
10086
10164
|
const element = editorElementRef.current;
|
|
10087
10165
|
if (!element) return;
|
|
10088
10166
|
const nextEditor = new import_core.Editor({
|
|
@@ -10139,10 +10217,10 @@ function RichTextEditor({
|
|
|
10139
10217
|
nextEditor.destroy();
|
|
10140
10218
|
};
|
|
10141
10219
|
}, [ariaLabel, extensions]);
|
|
10142
|
-
(0,
|
|
10220
|
+
(0, import_react43.useEffect)(() => {
|
|
10143
10221
|
editor?.setEditable(!disabled);
|
|
10144
10222
|
}, [disabled, editor]);
|
|
10145
|
-
(0,
|
|
10223
|
+
(0, import_react43.useEffect)(() => {
|
|
10146
10224
|
if (!editor || value === void 0 || value === lastEmittedValueRef.current) return;
|
|
10147
10225
|
editor.commands.setContent(value, { emitUpdate: false, contentType: contentFormat });
|
|
10148
10226
|
lastEmittedValueRef.current = value;
|
|
@@ -10277,7 +10355,7 @@ function RichTextEditor({
|
|
|
10277
10355
|
}
|
|
10278
10356
|
|
|
10279
10357
|
// src/components/MarkdownEditor.tsx
|
|
10280
|
-
var
|
|
10358
|
+
var import_react44 = require("react");
|
|
10281
10359
|
var import_dist = require("vditor/dist/index.css");
|
|
10282
10360
|
|
|
10283
10361
|
// src/components/markdownPaste.ts
|
|
@@ -10504,21 +10582,21 @@ function MarkdownEditor({
|
|
|
10504
10582
|
style,
|
|
10505
10583
|
...props
|
|
10506
10584
|
}) {
|
|
10507
|
-
const mountRef = (0,
|
|
10508
|
-
const editorRef = (0,
|
|
10509
|
-
const onChangeRef = (0,
|
|
10510
|
-
const saveShortcutRef = (0,
|
|
10511
|
-
const uploadImageRef = (0,
|
|
10512
|
-
const disabledRef = (0,
|
|
10513
|
-
const smartMarkdownPasteRef = (0,
|
|
10514
|
-
const valueRef = (0,
|
|
10515
|
-
const lastEmittedValueRef = (0,
|
|
10516
|
-
const [hasContent, setHasContent] = (0,
|
|
10585
|
+
const mountRef = (0, import_react44.useRef)(null);
|
|
10586
|
+
const editorRef = (0, import_react44.useRef)(null);
|
|
10587
|
+
const onChangeRef = (0, import_react44.useRef)(onChange);
|
|
10588
|
+
const saveShortcutRef = (0, import_react44.useRef)(saveShortcut);
|
|
10589
|
+
const uploadImageRef = (0, import_react44.useRef)(onUploadImage);
|
|
10590
|
+
const disabledRef = (0, import_react44.useRef)(disabled);
|
|
10591
|
+
const smartMarkdownPasteRef = (0, import_react44.useRef)(smartMarkdownPaste);
|
|
10592
|
+
const valueRef = (0, import_react44.useRef)(value ?? defaultValue);
|
|
10593
|
+
const lastEmittedValueRef = (0, import_react44.useRef)(value ?? defaultValue);
|
|
10594
|
+
const [hasContent, setHasContent] = (0, import_react44.useState)(Boolean((value ?? defaultValue).trim()));
|
|
10517
10595
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: hasContent });
|
|
10518
|
-
const [ready, setReady] = (0,
|
|
10519
|
-
const [loadError, setLoadError] = (0,
|
|
10596
|
+
const [ready, setReady] = (0, import_react44.useState)(false);
|
|
10597
|
+
const [loadError, setLoadError] = (0, import_react44.useState)("");
|
|
10520
10598
|
const hasImageUpload = Boolean(onUploadImage);
|
|
10521
|
-
(0,
|
|
10599
|
+
(0, import_react44.useEffect)(() => {
|
|
10522
10600
|
if (value !== void 0) setHasContent(Boolean(value.trim()));
|
|
10523
10601
|
}, [value]);
|
|
10524
10602
|
onChangeRef.current = onChange;
|
|
@@ -10527,7 +10605,7 @@ function MarkdownEditor({
|
|
|
10527
10605
|
disabledRef.current = disabled;
|
|
10528
10606
|
smartMarkdownPasteRef.current = smartMarkdownPaste;
|
|
10529
10607
|
valueRef.current = value ?? valueRef.current;
|
|
10530
|
-
(0,
|
|
10608
|
+
(0, import_react44.useEffect)(() => {
|
|
10531
10609
|
const mount = mountRef.current;
|
|
10532
10610
|
if (!mount) return;
|
|
10533
10611
|
let disposed = false;
|
|
@@ -10629,14 +10707,14 @@ function MarkdownEditor({
|
|
|
10629
10707
|
if (editorInitialized) createdEditor?.destroy();
|
|
10630
10708
|
};
|
|
10631
10709
|
}, [ariaLabel, assetBaseUrl, hasImageUpload, minHeight, mode, placeholder, floating.enabled]);
|
|
10632
|
-
(0,
|
|
10710
|
+
(0, import_react44.useEffect)(() => {
|
|
10633
10711
|
const editor = editorRef.current;
|
|
10634
10712
|
if (!editor || value === void 0) return;
|
|
10635
10713
|
if (value === lastEmittedValueRef.current || editor.getValue() === value) return;
|
|
10636
10714
|
lastEmittedValueRef.current = value;
|
|
10637
10715
|
editor.setValue(value, true);
|
|
10638
10716
|
}, [ready, value]);
|
|
10639
|
-
(0,
|
|
10717
|
+
(0, import_react44.useEffect)(() => {
|
|
10640
10718
|
const editor = editorRef.current;
|
|
10641
10719
|
if (!editor) return;
|
|
10642
10720
|
if (disabled) editor.disabled();
|
|
@@ -10668,7 +10746,7 @@ function MarkdownEditor({
|
|
|
10668
10746
|
}
|
|
10669
10747
|
|
|
10670
10748
|
// src/components/Editor.tsx
|
|
10671
|
-
var
|
|
10749
|
+
var import_react45 = require("react");
|
|
10672
10750
|
var import_editor_worker = __toESM(require("monaco-editor/editor/editor.worker.js?worker"), 1);
|
|
10673
10751
|
|
|
10674
10752
|
// src/components/jsonLanguage.ts
|
|
@@ -11343,30 +11421,30 @@ function Editor({
|
|
|
11343
11421
|
ariaLabel = "\u4EE3\u7801\u7F16\u8F91\u5668",
|
|
11344
11422
|
loadingText = "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026"
|
|
11345
11423
|
}) {
|
|
11346
|
-
const generatedId = (0,
|
|
11347
|
-
const containerRef = (0,
|
|
11348
|
-
const rangeHighlightRef = (0,
|
|
11349
|
-
const editorRef = (0,
|
|
11350
|
-
const modelRef = (0,
|
|
11351
|
-
const apiRef = (0,
|
|
11352
|
-
const applyingControlledValueRef = (0,
|
|
11353
|
-
const updateHighlightRef = (0,
|
|
11354
|
-
const changeHandlerRef = (0,
|
|
11355
|
-
const readyHandlerRef = (0,
|
|
11356
|
-
const selectionHandlerRef = (0,
|
|
11357
|
-
const keyDownHandlerRef = (0,
|
|
11358
|
-
const highlightRangeRef = (0,
|
|
11359
|
-
const markersRef = (0,
|
|
11360
|
-
const contextMenuItemsRef = (0,
|
|
11361
|
-
const completionProviderRef = (0,
|
|
11362
|
-
const refreshSuggestionOnSpaceRef = (0,
|
|
11363
|
-
const initialValueRef = (0,
|
|
11364
|
-
const initialLanguageRef = (0,
|
|
11365
|
-
const initialPathRef = (0,
|
|
11366
|
-
const initialThemeRef = (0,
|
|
11367
|
-
const initialOptionsRef = (0,
|
|
11368
|
-
const [loading, setLoading] = (0,
|
|
11369
|
-
const [, setSelectionVersion] = (0,
|
|
11424
|
+
const generatedId = (0, import_react45.useId)();
|
|
11425
|
+
const containerRef = (0, import_react45.useRef)(null);
|
|
11426
|
+
const rangeHighlightRef = (0, import_react45.useRef)(null);
|
|
11427
|
+
const editorRef = (0, import_react45.useRef)(null);
|
|
11428
|
+
const modelRef = (0, import_react45.useRef)(null);
|
|
11429
|
+
const apiRef = (0, import_react45.useRef)(null);
|
|
11430
|
+
const applyingControlledValueRef = (0, import_react45.useRef)(false);
|
|
11431
|
+
const updateHighlightRef = (0, import_react45.useRef)(() => void 0);
|
|
11432
|
+
const changeHandlerRef = (0, import_react45.useRef)(onChange);
|
|
11433
|
+
const readyHandlerRef = (0, import_react45.useRef)(onReady);
|
|
11434
|
+
const selectionHandlerRef = (0, import_react45.useRef)(onSelectionChange);
|
|
11435
|
+
const keyDownHandlerRef = (0, import_react45.useRef)(onKeyDown);
|
|
11436
|
+
const highlightRangeRef = (0, import_react45.useRef)(highlightRange);
|
|
11437
|
+
const markersRef = (0, import_react45.useRef)(markers);
|
|
11438
|
+
const contextMenuItemsRef = (0, import_react45.useRef)(contextMenuItems);
|
|
11439
|
+
const completionProviderRef = (0, import_react45.useRef)(completionProvider);
|
|
11440
|
+
const refreshSuggestionOnSpaceRef = (0, import_react45.useRef)(refreshSuggestionOnSpace);
|
|
11441
|
+
const initialValueRef = (0, import_react45.useRef)(value);
|
|
11442
|
+
const initialLanguageRef = (0, import_react45.useRef)(language);
|
|
11443
|
+
const initialPathRef = (0, import_react45.useRef)(path);
|
|
11444
|
+
const initialThemeRef = (0, import_react45.useRef)(theme);
|
|
11445
|
+
const initialOptionsRef = (0, import_react45.useRef)(options);
|
|
11446
|
+
const [loading, setLoading] = (0, import_react45.useState)(true);
|
|
11447
|
+
const [, setSelectionVersion] = (0, import_react45.useState)(0);
|
|
11370
11448
|
initialValueRef.current = value;
|
|
11371
11449
|
initialLanguageRef.current = language;
|
|
11372
11450
|
initialPathRef.current = path;
|
|
@@ -11381,7 +11459,7 @@ function Editor({
|
|
|
11381
11459
|
contextMenuItemsRef.current = contextMenuItems;
|
|
11382
11460
|
completionProviderRef.current = completionProvider;
|
|
11383
11461
|
refreshSuggestionOnSpaceRef.current = refreshSuggestionOnSpace;
|
|
11384
|
-
(0,
|
|
11462
|
+
(0, import_react45.useEffect)(() => {
|
|
11385
11463
|
let disposed = false;
|
|
11386
11464
|
const subscriptions = [];
|
|
11387
11465
|
async function mountEditor() {
|
|
@@ -11725,7 +11803,7 @@ function Editor({
|
|
|
11725
11803
|
updateHighlightRef.current = () => void 0;
|
|
11726
11804
|
};
|
|
11727
11805
|
}, [generatedId]);
|
|
11728
|
-
(0,
|
|
11806
|
+
(0, import_react45.useEffect)(() => {
|
|
11729
11807
|
const model = modelRef.current;
|
|
11730
11808
|
if (!model || model.getValue() === value) return;
|
|
11731
11809
|
applyingControlledValueRef.current = true;
|
|
@@ -11735,7 +11813,7 @@ function Editor({
|
|
|
11735
11813
|
applyingControlledValueRef.current = false;
|
|
11736
11814
|
}
|
|
11737
11815
|
}, [loading, value]);
|
|
11738
|
-
(0,
|
|
11816
|
+
(0, import_react45.useEffect)(() => {
|
|
11739
11817
|
if (loading) return;
|
|
11740
11818
|
void loadMonaco().then((monaco) => {
|
|
11741
11819
|
const model = modelRef.current;
|
|
@@ -11744,7 +11822,7 @@ function Editor({
|
|
|
11744
11822
|
}, [language, loading]);
|
|
11745
11823
|
const completionEnabled = Boolean(completionProvider);
|
|
11746
11824
|
const completionTriggerKey = completionTriggerCharacters.join("\0");
|
|
11747
|
-
(0,
|
|
11825
|
+
(0, import_react45.useEffect)(() => {
|
|
11748
11826
|
if (loading || !completionEnabled) return void 0;
|
|
11749
11827
|
let disposed = false;
|
|
11750
11828
|
let subscription;
|
|
@@ -11818,23 +11896,23 @@ function Editor({
|
|
|
11818
11896
|
subscription?.dispose();
|
|
11819
11897
|
};
|
|
11820
11898
|
}, [completionEnabled, completionTriggerKey, language, loading]);
|
|
11821
|
-
(0,
|
|
11899
|
+
(0, import_react45.useEffect)(() => {
|
|
11822
11900
|
if (loading) return;
|
|
11823
11901
|
void loadMonaco().then((monaco) => {
|
|
11824
11902
|
if (editorRef.current) monaco.editor.setTheme(theme === "dark" ? "vs-dark" : "vs");
|
|
11825
11903
|
});
|
|
11826
11904
|
}, [loading, theme]);
|
|
11827
|
-
(0,
|
|
11905
|
+
(0, import_react45.useEffect)(() => {
|
|
11828
11906
|
if (loading) return;
|
|
11829
11907
|
editorRef.current?.updateOptions({
|
|
11830
11908
|
...options ?? {},
|
|
11831
11909
|
contextmenu: contextMenuItems.length === 0 ? options?.contextmenu ?? true : false
|
|
11832
11910
|
});
|
|
11833
11911
|
}, [contextMenuItems.length, loading, options]);
|
|
11834
|
-
(0,
|
|
11912
|
+
(0, import_react45.useEffect)(() => {
|
|
11835
11913
|
updateHighlightRef.current();
|
|
11836
11914
|
}, [highlightRange]);
|
|
11837
|
-
(0,
|
|
11915
|
+
(0, import_react45.useEffect)(() => {
|
|
11838
11916
|
if (loading) return;
|
|
11839
11917
|
void loadMonaco().then((monaco) => {
|
|
11840
11918
|
const model = modelRef.current;
|
|
@@ -11902,19 +11980,19 @@ function Editor({
|
|
|
11902
11980
|
}
|
|
11903
11981
|
|
|
11904
11982
|
// src/components/Markdown.tsx
|
|
11905
|
-
var
|
|
11983
|
+
var import_react46 = require("react");
|
|
11906
11984
|
var import_dompurify2 = __toESM(require("dompurify"), 1);
|
|
11907
11985
|
var import_marked = require("marked");
|
|
11908
11986
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
11909
11987
|
function Markdown2({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
|
|
11910
|
-
const rootRef = (0,
|
|
11911
|
-
const [previewImage, setPreviewImage] = (0,
|
|
11912
|
-
const html = (0,
|
|
11988
|
+
const rootRef = (0, import_react46.useRef)(null);
|
|
11989
|
+
const [previewImage, setPreviewImage] = (0, import_react46.useState)(null);
|
|
11990
|
+
const html = (0, import_react46.useMemo)(() => {
|
|
11913
11991
|
const rendered = import_marked.marked.parse(content, { breaks: true, gfm: true });
|
|
11914
11992
|
const sanitized = import_dompurify2.default.sanitize(rendered, { USE_PROFILES: { html: true } });
|
|
11915
11993
|
return sanitized.replace(/<img\b/giu, '<img loading="lazy" decoding="async" referrerpolicy="no-referrer"');
|
|
11916
11994
|
}, [content]);
|
|
11917
|
-
(0,
|
|
11995
|
+
(0, import_react46.useEffect)(() => {
|
|
11918
11996
|
const root = rootRef.current;
|
|
11919
11997
|
if (!root) return void 0;
|
|
11920
11998
|
let cancelled = false;
|
|
@@ -11982,13 +12060,13 @@ function Markdown2({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9",
|
|
|
11982
12060
|
}
|
|
11983
12061
|
|
|
11984
12062
|
// src/components/InputNumber.tsx
|
|
11985
|
-
var
|
|
12063
|
+
var import_react47 = require("react");
|
|
11986
12064
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
11987
12065
|
function formatValue(value, precision) {
|
|
11988
12066
|
if (value === null || !Number.isFinite(value)) return "";
|
|
11989
12067
|
return precision === void 0 ? String(value) : value.toFixed(precision);
|
|
11990
12068
|
}
|
|
11991
|
-
var InputNumber = (0,
|
|
12069
|
+
var InputNumber = (0, import_react47.forwardRef)(function InputNumber2({
|
|
11992
12070
|
value,
|
|
11993
12071
|
defaultValue = null,
|
|
11994
12072
|
onChange,
|
|
@@ -12014,16 +12092,16 @@ var InputNumber = (0, import_react46.forwardRef)(function InputNumber2({
|
|
|
12014
12092
|
...props
|
|
12015
12093
|
}, forwardedRef) {
|
|
12016
12094
|
const size = useControlSize(sizeProp);
|
|
12017
|
-
const fallbackId = (0,
|
|
12095
|
+
const fallbackId = (0, import_react47.useId)();
|
|
12018
12096
|
const inputId = id ?? fallbackId;
|
|
12019
|
-
const localRef = (0,
|
|
12097
|
+
const localRef = (0, import_react47.useRef)(null);
|
|
12020
12098
|
const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue, onChange });
|
|
12021
12099
|
const displayValue = (next) => {
|
|
12022
12100
|
const plain = formatValue(next, precision);
|
|
12023
12101
|
return plain && formatter ? formatter(plain) : plain;
|
|
12024
12102
|
};
|
|
12025
|
-
const [text, setText] = (0,
|
|
12026
|
-
(0,
|
|
12103
|
+
const [text, setText] = (0, import_react47.useState)(() => displayValue(currentValue));
|
|
12104
|
+
(0, import_react47.useEffect)(() => {
|
|
12027
12105
|
setText(displayValue(currentValue));
|
|
12028
12106
|
}, [currentValue, precision, formatter]);
|
|
12029
12107
|
function setRef(node) {
|
|
@@ -12129,11 +12207,11 @@ var InputNumber = (0, import_react46.forwardRef)(function InputNumber2({
|
|
|
12129
12207
|
});
|
|
12130
12208
|
|
|
12131
12209
|
// src/components/SelectModal.tsx
|
|
12132
|
-
var
|
|
12210
|
+
var import_react48 = require("react");
|
|
12133
12211
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
12134
12212
|
function SelectModalBody({ config, values, disabled, onChange }) {
|
|
12135
|
-
const [query, setQuery] = (0,
|
|
12136
|
-
const [selectedOnly, setSelectedOnly] = (0,
|
|
12213
|
+
const [query, setQuery] = (0, import_react48.useState)("");
|
|
12214
|
+
const [selectedOnly, setSelectedOnly] = (0, import_react48.useState)(false);
|
|
12137
12215
|
const multiple = config.mode === "multiple";
|
|
12138
12216
|
const search = query.trim();
|
|
12139
12217
|
const filtered = config.options.filter((option) => !search || (config.filterOption ? config.filterOption(search, option) : [option.label, option.value].some((text) => String(text ?? "").toLowerCase().includes(search.toLowerCase()))));
|
|
@@ -12307,9 +12385,9 @@ function Tag({
|
|
|
12307
12385
|
}
|
|
12308
12386
|
|
|
12309
12387
|
// src/components/Tabs.tsx
|
|
12310
|
-
var import_react48 = require("react");
|
|
12311
|
-
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
12312
12388
|
var import_react49 = require("react");
|
|
12389
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
12390
|
+
var import_react50 = require("react");
|
|
12313
12391
|
function Tabs({
|
|
12314
12392
|
items,
|
|
12315
12393
|
activeKey,
|
|
@@ -12334,22 +12412,22 @@ function Tabs({
|
|
|
12334
12412
|
...props
|
|
12335
12413
|
}) {
|
|
12336
12414
|
const firstEnabledKey = items.find((item) => !item.disabled)?.key ?? "";
|
|
12337
|
-
const [internalActiveKey, setInternalActiveKey] = (0,
|
|
12415
|
+
const [internalActiveKey, setInternalActiveKey] = (0, import_react49.useState)(defaultActiveKey ?? firstEnabledKey);
|
|
12338
12416
|
const currentKey = activeKey ?? internalActiveKey;
|
|
12339
12417
|
const selectedKey = items.some((item) => item.key === currentKey && !item.disabled) ? currentKey : firstEnabledKey;
|
|
12340
|
-
const baseId = (0,
|
|
12341
|
-
const enabledItems = (0,
|
|
12418
|
+
const baseId = (0, import_react49.useId)().replace(/:/g, "");
|
|
12419
|
+
const enabledItems = (0, import_react49.useMemo)(() => items.filter((item) => !item.disabled), [items]);
|
|
12342
12420
|
const resolvedPosition = tabPosition ?? (orientation === "vertical" ? "left" : "top");
|
|
12343
12421
|
const resolvedOrientation = resolvedPosition === "left" || resolvedPosition === "right" ? "vertical" : "horizontal";
|
|
12344
12422
|
const sliding = ["capsule", "line", "underline", "tech", "tech-line"].includes(type);
|
|
12345
|
-
const listRef = (0,
|
|
12346
|
-
const indicatorRef = (0,
|
|
12347
|
-
const moreRef = (0,
|
|
12348
|
-
const [overflow, setOverflow] = (0,
|
|
12349
|
-
const [moreOpen, setMoreOpen] = (0,
|
|
12423
|
+
const listRef = (0, import_react49.useRef)(null);
|
|
12424
|
+
const indicatorRef = (0, import_react49.useRef)(null);
|
|
12425
|
+
const moreRef = (0, import_react49.useRef)(null);
|
|
12426
|
+
const [overflow, setOverflow] = (0, import_react49.useState)({ count: items.length, width: 0 });
|
|
12427
|
+
const [moreOpen, setMoreOpen] = (0, import_react49.useState)(false);
|
|
12350
12428
|
const visibleCount = resolvedOrientation === "horizontal" ? overflow.count : items.length;
|
|
12351
12429
|
const hiddenItems = items.slice(visibleCount);
|
|
12352
|
-
(0,
|
|
12430
|
+
(0, import_react49.useLayoutEffect)(() => {
|
|
12353
12431
|
const list = listRef.current;
|
|
12354
12432
|
if (!list || resolvedOrientation !== "horizontal") return;
|
|
12355
12433
|
const entries = Array.from(list.children).filter((node) => node instanceof HTMLElement && node.hasAttribute("data-tab-entry"));
|
|
@@ -12380,13 +12458,13 @@ function Tabs({
|
|
|
12380
12458
|
entries.forEach((entry) => observer.observe(entry));
|
|
12381
12459
|
return () => observer.disconnect();
|
|
12382
12460
|
}, [items, type, size, closable, resolvedOrientation, tabBarTitle, tabBarExtraContent]);
|
|
12383
|
-
const [contentState, setContentState] = (0,
|
|
12384
|
-
const settledKeyRef = (0,
|
|
12385
|
-
const afterChangeRef = (0,
|
|
12386
|
-
(0,
|
|
12461
|
+
const [contentState, setContentState] = (0, import_react49.useState)(() => ({ key: selectedKey, visited: /* @__PURE__ */ new Set([selectedKey]) }));
|
|
12462
|
+
const settledKeyRef = (0, import_react49.useRef)(selectedKey);
|
|
12463
|
+
const afterChangeRef = (0, import_react49.useRef)(onAfterChange);
|
|
12464
|
+
(0, import_react49.useLayoutEffect)(() => {
|
|
12387
12465
|
afterChangeRef.current = onAfterChange;
|
|
12388
12466
|
}, [onAfterChange]);
|
|
12389
|
-
(0,
|
|
12467
|
+
(0, import_react49.useLayoutEffect)(() => {
|
|
12390
12468
|
if (!sliding) return;
|
|
12391
12469
|
const list = listRef.current;
|
|
12392
12470
|
const indicator = indicatorRef.current;
|
|
@@ -12416,7 +12494,7 @@ function Tabs({
|
|
|
12416
12494
|
list.querySelectorAll('[role="tab"]').forEach((tab) => observer.observe(tab));
|
|
12417
12495
|
return () => observer.disconnect();
|
|
12418
12496
|
}, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable, visibleCount]);
|
|
12419
|
-
(0,
|
|
12497
|
+
(0, import_react49.useEffect)(() => {
|
|
12420
12498
|
let cancelled = false;
|
|
12421
12499
|
let frame = 0;
|
|
12422
12500
|
frame = requestAnimationFrame(() => {
|
|
@@ -12483,7 +12561,7 @@ function Tabs({
|
|
|
12483
12561
|
const canClose = item.closable ?? closable;
|
|
12484
12562
|
const contextMenuItems = typeof tabContextMenu === "function" ? tabContextMenu(item) : tabContextMenu;
|
|
12485
12563
|
const entryProps = { "data-tab-entry": "", "data-tab-hidden": index >= visibleCount, "aria-hidden": index >= visibleCount || void 0 };
|
|
12486
|
-
const tabNode = /* @__PURE__ */ (0,
|
|
12564
|
+
const tabNode = /* @__PURE__ */ (0, import_react50.createElement)("span", { ...!contextMenuItems?.length ? entryProps : {}, className: `sia-tabs__tab-wrap${canClose ? " is-closable" : ""}`, key: item.key }, /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
12487
12565
|
"button",
|
|
12488
12566
|
{
|
|
12489
12567
|
id: `${baseId}-tab-${item.key}`,
|
|
@@ -12514,7 +12592,7 @@ function Tabs({
|
|
|
12514
12592
|
}
|
|
12515
12593
|
) : null);
|
|
12516
12594
|
if (!contextMenuItems?.length) return tabNode;
|
|
12517
|
-
return /* @__PURE__ */ (0,
|
|
12595
|
+
return /* @__PURE__ */ (0, import_react50.createElement)(
|
|
12518
12596
|
Dropdown,
|
|
12519
12597
|
{
|
|
12520
12598
|
...entryProps,
|
|
@@ -12577,9 +12655,9 @@ function Tabs({
|
|
|
12577
12655
|
}
|
|
12578
12656
|
|
|
12579
12657
|
// src/components/Treemap.tsx
|
|
12580
|
-
var import_react50 = require("react");
|
|
12581
|
-
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
12582
12658
|
var import_react51 = require("react");
|
|
12659
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
12660
|
+
var import_react52 = require("react");
|
|
12583
12661
|
function positiveValue(value) {
|
|
12584
12662
|
return Number.isFinite(value) && value > 0 ? value : 1;
|
|
12585
12663
|
}
|
|
@@ -12950,19 +13028,19 @@ function Treemap({
|
|
|
12950
13028
|
style,
|
|
12951
13029
|
...props
|
|
12952
13030
|
}) {
|
|
12953
|
-
const containerRef = (0,
|
|
12954
|
-
const [size, setSize] = (0,
|
|
12955
|
-
const [internalExpandedKeys, setInternalExpandedKeys] = (0,
|
|
12956
|
-
const [internalFocusedKey, setInternalFocusedKey] = (0,
|
|
13031
|
+
const containerRef = (0, import_react51.useRef)(null);
|
|
13032
|
+
const [size, setSize] = (0, import_react51.useState)({ width: 0, height: 0 });
|
|
13033
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = (0, import_react51.useState)(() => [...defaultExpandedKeys]);
|
|
13034
|
+
const [internalFocusedKey, setInternalFocusedKey] = (0, import_react51.useState)(defaultFocusedKey);
|
|
12957
13035
|
const currentExpandedKeys = expandedKeys ?? internalExpandedKeys;
|
|
12958
13036
|
const currentFocusedKey = focusedKey === void 0 ? internalFocusedKey : focusedKey;
|
|
12959
|
-
const expandedSet = (0,
|
|
12960
|
-
const focusedNode = (0,
|
|
13037
|
+
const expandedSet = (0, import_react51.useMemo)(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
|
|
13038
|
+
const focusedNode = (0, import_react51.useMemo)(
|
|
12961
13039
|
() => currentFocusedKey ? findNode(data, currentFocusedKey) : null,
|
|
12962
13040
|
[currentFocusedKey, data]
|
|
12963
13041
|
);
|
|
12964
13042
|
const effectiveFocusedNode = focusedNode && expandedSet.has(focusedNode.key) && Boolean(focusedNode.children?.length) ? focusedNode : null;
|
|
12965
|
-
const positions = (0,
|
|
13043
|
+
const positions = (0, import_react51.useMemo)(
|
|
12966
13044
|
() => collectPositions(
|
|
12967
13045
|
effectiveFocusedNode ? [effectiveFocusedNode] : data,
|
|
12968
13046
|
{ x: 0, y: 0, ...size },
|
|
@@ -12978,7 +13056,7 @@ function Treemap({
|
|
|
12978
13056
|
),
|
|
12979
13057
|
[activeKey, aggregateOverflow, data, effectiveFocusedNode, expandedSet, gap, headerHeight, maxVisibleNodes, minTileHeight, minTileWidth, overflowLabel, size]
|
|
12980
13058
|
);
|
|
12981
|
-
(0,
|
|
13059
|
+
(0, import_react51.useEffect)(() => {
|
|
12982
13060
|
const element = containerRef.current;
|
|
12983
13061
|
if (!element) return void 0;
|
|
12984
13062
|
const updateSize = () => {
|
|
@@ -12990,7 +13068,7 @@ function Treemap({
|
|
|
12990
13068
|
observer.observe(element);
|
|
12991
13069
|
return () => observer.disconnect();
|
|
12992
13070
|
}, []);
|
|
12993
|
-
(0,
|
|
13071
|
+
(0, import_react51.useEffect)(() => {
|
|
12994
13072
|
if (!currentFocusedKey || effectiveFocusedNode) return;
|
|
12995
13073
|
if (focusedKey === void 0) setInternalFocusedKey(null);
|
|
12996
13074
|
onFocusedChange?.(null);
|
|
@@ -13038,7 +13116,7 @@ function Treemap({
|
|
|
13038
13116
|
const hasChildren = Boolean(node.hasChildren || node.children?.length);
|
|
13039
13117
|
const title = `${node.label} \xB7 ${String(valueFormatter(node.value, node))}`;
|
|
13040
13118
|
if (expanded) {
|
|
13041
|
-
return /* @__PURE__ */ (0,
|
|
13119
|
+
return /* @__PURE__ */ (0, import_react52.createElement)(
|
|
13042
13120
|
"div",
|
|
13043
13121
|
{
|
|
13044
13122
|
className: `sia-treemap__tile sia-treemap__tile--directory is-expanded${effectiveFocusedNode?.key === node.key ? " is-focused" : ""}${active ? " is-active" : ""}`,
|
|
@@ -13077,7 +13155,7 @@ function Treemap({
|
|
|
13077
13155
|
] })
|
|
13078
13156
|
);
|
|
13079
13157
|
}
|
|
13080
|
-
return /* @__PURE__ */ (0,
|
|
13158
|
+
return /* @__PURE__ */ (0, import_react52.createElement)(
|
|
13081
13159
|
"button",
|
|
13082
13160
|
{
|
|
13083
13161
|
type: "button",
|
|
@@ -13103,7 +13181,7 @@ function Treemap({
|
|
|
13103
13181
|
}
|
|
13104
13182
|
|
|
13105
13183
|
// src/components/Table/TableCellContent.tsx
|
|
13106
|
-
var
|
|
13184
|
+
var import_react53 = require("react");
|
|
13107
13185
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
13108
13186
|
var pendingLayouts = /* @__PURE__ */ new Map();
|
|
13109
13187
|
var layoutFrame;
|
|
@@ -13122,10 +13200,10 @@ function scheduleLayout(element, task) {
|
|
|
13122
13200
|
});
|
|
13123
13201
|
}
|
|
13124
13202
|
function TableCellContent({ children, ellipsis, title }) {
|
|
13125
|
-
const ref = (0,
|
|
13126
|
-
const [overflowing, setOverflowing] = (0,
|
|
13203
|
+
const ref = (0, import_react53.useRef)(null);
|
|
13204
|
+
const [overflowing, setOverflowing] = (0, import_react53.useState)(false);
|
|
13127
13205
|
const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
|
|
13128
|
-
(0,
|
|
13206
|
+
(0, import_react53.useLayoutEffect)(() => {
|
|
13129
13207
|
const element = ref.current;
|
|
13130
13208
|
if (!element || !ellipsis || !customContent) return;
|
|
13131
13209
|
const normalizeLayouts = (parent, layouts) => {
|
|
@@ -13161,14 +13239,14 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
13161
13239
|
}
|
|
13162
13240
|
|
|
13163
13241
|
// src/components/Table/useRemainingHeight.ts
|
|
13164
|
-
var
|
|
13242
|
+
var import_react54 = require("react");
|
|
13165
13243
|
function useRemainingHeight(rootRef, options) {
|
|
13166
|
-
const [height, setHeight] = (0,
|
|
13244
|
+
const [height, setHeight] = (0, import_react54.useState)();
|
|
13167
13245
|
const enabled = !!options;
|
|
13168
13246
|
const container = typeof options === "object" ? options.container : void 0;
|
|
13169
13247
|
const bottomOffset = typeof options === "object" ? options.bottomOffset ?? 0 : 0;
|
|
13170
13248
|
const minHeight = typeof options === "object" ? options.minHeight ?? 0 : 0;
|
|
13171
|
-
(0,
|
|
13249
|
+
(0, import_react54.useLayoutEffect)(() => {
|
|
13172
13250
|
const root = rootRef.current;
|
|
13173
13251
|
if (!enabled || !root) return;
|
|
13174
13252
|
const win = root.ownerDocument.defaultView;
|
|
@@ -13239,7 +13317,7 @@ function useRemainingHeight(rootRef, options) {
|
|
|
13239
13317
|
}
|
|
13240
13318
|
|
|
13241
13319
|
// src/components/Table/TableCanvasLayer.tsx
|
|
13242
|
-
var
|
|
13320
|
+
var import_react55 = require("react");
|
|
13243
13321
|
|
|
13244
13322
|
// src/components/Table/utils.ts
|
|
13245
13323
|
var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
|
|
@@ -13294,8 +13372,8 @@ function toTablePageParams(current, pageSize) {
|
|
|
13294
13372
|
// src/components/Table/TableCanvasLayer.tsx
|
|
13295
13373
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
13296
13374
|
function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
|
|
13297
|
-
const canvasRef = (0,
|
|
13298
|
-
(0,
|
|
13375
|
+
const canvasRef = (0, import_react55.useRef)(null);
|
|
13376
|
+
(0, import_react55.useLayoutEffect)(() => {
|
|
13299
13377
|
const canvas = canvasRef.current;
|
|
13300
13378
|
const scroller = viewport.current;
|
|
13301
13379
|
if (!canvas || !scroller) return;
|
|
@@ -13438,10 +13516,10 @@ function createRowIdentity() {
|
|
|
13438
13516
|
}
|
|
13439
13517
|
|
|
13440
13518
|
// src/components/Table/Table.tsx
|
|
13441
|
-
var
|
|
13519
|
+
var import_react57 = require("react");
|
|
13442
13520
|
|
|
13443
13521
|
// src/components/Table/plugins.tsx
|
|
13444
|
-
var
|
|
13522
|
+
var import_react56 = require("react");
|
|
13445
13523
|
|
|
13446
13524
|
// src/components/Table/columnSettings.ts
|
|
13447
13525
|
function reconcileColumnSettings(columns, defaults, saved) {
|
|
@@ -14154,7 +14232,7 @@ function TableSelectedItemsPanel({
|
|
|
14154
14232
|
onRemove,
|
|
14155
14233
|
onClear
|
|
14156
14234
|
}) {
|
|
14157
|
-
const [showAll, setShowAll] = (0,
|
|
14235
|
+
const [showAll, setShowAll] = (0, import_react56.useState)(false);
|
|
14158
14236
|
const visibleEntries = showAll ? entries : entries.slice(0, maxCount2);
|
|
14159
14237
|
const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
|
|
14160
14238
|
const baseColumnMap = new Map(
|
|
@@ -14560,10 +14638,10 @@ function TableFilterControl({
|
|
|
14560
14638
|
placeholder,
|
|
14561
14639
|
onApply
|
|
14562
14640
|
}) {
|
|
14563
|
-
const [open, setOpen] = (0,
|
|
14564
|
-
const [draft, setDraft] = (0,
|
|
14641
|
+
const [open, setOpen] = (0, import_react56.useState)(false);
|
|
14642
|
+
const [draft, setDraft] = (0, import_react56.useState)(value);
|
|
14565
14643
|
const label = getColumnLabel(column);
|
|
14566
|
-
(0,
|
|
14644
|
+
(0, import_react56.useEffect)(() => {
|
|
14567
14645
|
if (open) setDraft(value);
|
|
14568
14646
|
}, [open, value]);
|
|
14569
14647
|
const apply = (nextValue) => {
|
|
@@ -15001,17 +15079,17 @@ function EditableTableCell({
|
|
|
15001
15079
|
trigger
|
|
15002
15080
|
}) {
|
|
15003
15081
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
15004
|
-
const [editValue, setEditValue] = (0,
|
|
15005
|
-
const [saving, setSaving] = (0,
|
|
15006
|
-
const inputRef = (0,
|
|
15007
|
-
const editorRef = (0,
|
|
15008
|
-
const editValueRef = (0,
|
|
15009
|
-
const savingRef = (0,
|
|
15010
|
-
const saveRef = (0,
|
|
15082
|
+
const [editValue, setEditValue] = (0, import_react56.useState)(value);
|
|
15083
|
+
const [saving, setSaving] = (0, import_react56.useState)(false);
|
|
15084
|
+
const inputRef = (0, import_react56.useRef)(null);
|
|
15085
|
+
const editorRef = (0, import_react56.useRef)(null);
|
|
15086
|
+
const editValueRef = (0, import_react56.useRef)(value);
|
|
15087
|
+
const savingRef = (0, import_react56.useRef)(false);
|
|
15088
|
+
const saveRef = (0, import_react56.useRef)(
|
|
15011
15089
|
async () => {
|
|
15012
15090
|
}
|
|
15013
15091
|
);
|
|
15014
|
-
(0,
|
|
15092
|
+
(0, import_react56.useEffect)(() => {
|
|
15015
15093
|
if (!active) return;
|
|
15016
15094
|
editValueRef.current = value;
|
|
15017
15095
|
setEditValue(value);
|
|
@@ -15042,7 +15120,7 @@ function EditableTableCell({
|
|
|
15042
15120
|
}
|
|
15043
15121
|
}
|
|
15044
15122
|
saveRef.current = save;
|
|
15045
|
-
(0,
|
|
15123
|
+
(0, import_react56.useEffect)(() => {
|
|
15046
15124
|
if (!active || config.type === "select" || config.type === "custom") return;
|
|
15047
15125
|
const handleOutsidePointerDown = (event) => {
|
|
15048
15126
|
const target = event.target;
|
|
@@ -15347,15 +15425,15 @@ function ColumnSettingPanel({
|
|
|
15347
15425
|
onClose,
|
|
15348
15426
|
onApply
|
|
15349
15427
|
}) {
|
|
15350
|
-
const [draft, setDraft] = (0,
|
|
15351
|
-
const listRef = (0,
|
|
15352
|
-
const cancelDrag = (0,
|
|
15353
|
-
const [preview, setPreview] = (0,
|
|
15354
|
-
(0,
|
|
15428
|
+
const [draft, setDraft] = (0, import_react56.useState)(items);
|
|
15429
|
+
const listRef = (0, import_react56.useRef)(null);
|
|
15430
|
+
const cancelDrag = (0, import_react56.useRef)(null);
|
|
15431
|
+
const [preview, setPreview] = (0, import_react56.useState)(null);
|
|
15432
|
+
(0, import_react56.useEffect)(() => {
|
|
15355
15433
|
cancelDrag.current?.();
|
|
15356
15434
|
if (open) setDraft(orderColumnSettings(items));
|
|
15357
15435
|
}, [items, open]);
|
|
15358
|
-
(0,
|
|
15436
|
+
(0, import_react56.useEffect)(() => () => cancelDrag.current?.(), []);
|
|
15359
15437
|
const labels = new Map(
|
|
15360
15438
|
flattenTableColumns(columns).map((column) => [
|
|
15361
15439
|
column.key,
|
|
@@ -15882,7 +15960,7 @@ function tableExportText(node) {
|
|
|
15882
15960
|
if (typeof node === "string" || typeof node === "number" || typeof node === "bigint")
|
|
15883
15961
|
return String(node);
|
|
15884
15962
|
if (Array.isArray(node)) return node.map(tableExportText).join("");
|
|
15885
|
-
if ((0,
|
|
15963
|
+
if ((0, import_react56.isValidElement)(node))
|
|
15886
15964
|
return tableExportText(node.props.children);
|
|
15887
15965
|
return "";
|
|
15888
15966
|
}
|
|
@@ -15981,7 +16059,7 @@ var SIZE_ROW_HEIGHT = { small: 28, medium: 36, large: 46 };
|
|
|
15981
16059
|
function getHeaderTitleText(content) {
|
|
15982
16060
|
if (typeof content === "string" || typeof content === "number") return String(content);
|
|
15983
16061
|
if (Array.isArray(content)) return content.map(getHeaderTitleText).join("");
|
|
15984
|
-
if ((0,
|
|
16062
|
+
if ((0, import_react57.isValidElement)(content)) return getHeaderTitleText(content.props.children);
|
|
15985
16063
|
return "";
|
|
15986
16064
|
}
|
|
15987
16065
|
function getColumnDepth(columns) {
|
|
@@ -16061,7 +16139,7 @@ function getTableHorizontalMetrics(viewport, table) {
|
|
|
16061
16139
|
const contentWidth = Math.max(viewport.clientWidth, table?.getBoundingClientRect().width ?? viewport.clientWidth);
|
|
16062
16140
|
return { contentWidth, maxLeft: Math.max(0, contentWidth - viewport.clientWidth) };
|
|
16063
16141
|
}
|
|
16064
|
-
var TableBodyRow = (0,
|
|
16142
|
+
var TableBodyRow = (0, import_react57.memo)(function TableBodyRow2({
|
|
16065
16143
|
canvas,
|
|
16066
16144
|
visibleColumns,
|
|
16067
16145
|
row,
|
|
@@ -16178,25 +16256,25 @@ function TableInner(props, ref) {
|
|
|
16178
16256
|
style,
|
|
16179
16257
|
...htmlProps
|
|
16180
16258
|
} = props;
|
|
16181
|
-
const rootRef = (0,
|
|
16259
|
+
const rootRef = (0, import_react57.useRef)(null);
|
|
16182
16260
|
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
16183
|
-
const scrollRef = (0,
|
|
16184
|
-
const tableRef = (0,
|
|
16261
|
+
const scrollRef = (0, import_react57.useRef)(null);
|
|
16262
|
+
const tableRef = (0, import_react57.useRef)(null);
|
|
16185
16263
|
useScrollbarProximity();
|
|
16186
|
-
const scrollbarDragRef = (0,
|
|
16187
|
-
const [internalLoading, setInternalLoading] = (0,
|
|
16188
|
-
const [scrollTop, setScrollTop] = (0,
|
|
16189
|
-
const [scrollLeft, setScrollLeft] = (0,
|
|
16190
|
-
const [viewportHeight, setViewportHeight] = (0,
|
|
16191
|
-
const [viewportWidth, setViewportWidth] = (0,
|
|
16192
|
-
const [autoColumnWidths, setAutoColumnWidths] = (0,
|
|
16193
|
-
const [resolveRowIdentity] = (0,
|
|
16194
|
-
const getRowKey = (0,
|
|
16195
|
-
const builtInResizePlugin = (0,
|
|
16196
|
-
const builtInHighlightPlugin = (0,
|
|
16197
|
-
const builtInCellSelectionPlugin = (0,
|
|
16198
|
-
const builtInIndexPlugin = (0,
|
|
16199
|
-
const activePlugins = (0,
|
|
16264
|
+
const scrollbarDragRef = (0, import_react57.useRef)(null);
|
|
16265
|
+
const [internalLoading, setInternalLoading] = (0, import_react57.useState)(false);
|
|
16266
|
+
const [scrollTop, setScrollTop] = (0, import_react57.useState)(0);
|
|
16267
|
+
const [scrollLeft, setScrollLeft] = (0, import_react57.useState)(0);
|
|
16268
|
+
const [viewportHeight, setViewportHeight] = (0, import_react57.useState)(420);
|
|
16269
|
+
const [viewportWidth, setViewportWidth] = (0, import_react57.useState)(0);
|
|
16270
|
+
const [autoColumnWidths, setAutoColumnWidths] = (0, import_react57.useState)({});
|
|
16271
|
+
const [resolveRowIdentity] = (0, import_react57.useState)(createRowIdentity);
|
|
16272
|
+
const getRowKey = (0, import_react57.useCallback)((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
|
|
16273
|
+
const builtInResizePlugin = (0, import_react57.useMemo)(() => createResizePlugin(), []);
|
|
16274
|
+
const builtInHighlightPlugin = (0, import_react57.useMemo)(() => createHighlightPlugin(), []);
|
|
16275
|
+
const builtInCellSelectionPlugin = (0, import_react57.useMemo)(() => createCellSelectionPlugin(), []);
|
|
16276
|
+
const builtInIndexPlugin = (0, import_react57.useMemo)(() => createIndexPlugin(), []);
|
|
16277
|
+
const activePlugins = (0, import_react57.useMemo)(() => {
|
|
16200
16278
|
const plugins = providedPlugins.filter((plugin) => (resizable || plugin.id !== "resize") && (cellSelection || plugin.id !== "cellSelection") && (showIndex || plugin.id !== "index"));
|
|
16201
16279
|
if (!plugins.some((plugin) => plugin.id === "highlight")) plugins.push(builtInHighlightPlugin);
|
|
16202
16280
|
if (resizable && !plugins.some((plugin) => plugin.id === "resize")) plugins.push(builtInResizePlugin);
|
|
@@ -16204,19 +16282,19 @@ function TableInner(props, ref) {
|
|
|
16204
16282
|
if (showIndex && !plugins.some((plugin) => plugin.id === "index")) plugins.push(builtInIndexPlugin);
|
|
16205
16283
|
return plugins;
|
|
16206
16284
|
}, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
|
|
16207
|
-
const sortedPlugins = (0,
|
|
16208
|
-
const pluginsByIdRef = (0,
|
|
16285
|
+
const sortedPlugins = (0, import_react57.useMemo)(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
16286
|
+
const pluginsByIdRef = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
|
|
16209
16287
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
16210
|
-
const [pluginStates, setPluginStates] = (0,
|
|
16288
|
+
const [pluginStates, setPluginStates] = (0, import_react57.useState)(() => Object.fromEntries(
|
|
16211
16289
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
16212
16290
|
));
|
|
16213
|
-
const pluginApisRef = (0,
|
|
16214
|
-
const contextsRef = (0,
|
|
16215
|
-
const mountedPluginsRef = (0,
|
|
16291
|
+
const pluginApisRef = (0, import_react57.useRef)({});
|
|
16292
|
+
const contextsRef = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
|
|
16293
|
+
const mountedPluginsRef = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
|
|
16216
16294
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
16217
16295
|
const nextApis = {};
|
|
16218
16296
|
const contexts = /* @__PURE__ */ new Map();
|
|
16219
|
-
const setPluginState = (0,
|
|
16297
|
+
const setPluginState = (0, import_react57.useCallback)((pluginId, next) => {
|
|
16220
16298
|
setPluginStates((previous) => {
|
|
16221
16299
|
const plugin = pluginsByIdRef.current.get(pluginId);
|
|
16222
16300
|
const previousValue = previous[pluginId] !== void 0 ? previous[pluginId] : plugin ? resolveInitialState(plugin) : void 0;
|
|
@@ -16269,7 +16347,7 @@ function TableInner(props, ref) {
|
|
|
16269
16347
|
});
|
|
16270
16348
|
pluginApisRef.current = nextApis;
|
|
16271
16349
|
contextsRef.current = contexts;
|
|
16272
|
-
(0,
|
|
16350
|
+
(0, import_react57.useEffect)(() => {
|
|
16273
16351
|
const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
16274
16352
|
for (const [pluginId, mounted] of mountedPluginsRef.current) {
|
|
16275
16353
|
if (activePlugins2.get(pluginId) === mounted.plugin) continue;
|
|
@@ -16281,11 +16359,11 @@ function TableInner(props, ref) {
|
|
|
16281
16359
|
mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
|
|
16282
16360
|
}
|
|
16283
16361
|
}, [sortedPlugins]);
|
|
16284
|
-
(0,
|
|
16362
|
+
(0, import_react57.useEffect)(() => () => {
|
|
16285
16363
|
for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
|
|
16286
16364
|
mountedPluginsRef.current.clear();
|
|
16287
16365
|
}, []);
|
|
16288
|
-
const updateScrollMetrics = (0,
|
|
16366
|
+
const updateScrollMetrics = (0, import_react57.useCallback)(() => {
|
|
16289
16367
|
const root = rootRef.current;
|
|
16290
16368
|
const element = scrollRef.current;
|
|
16291
16369
|
if (!root || !element) return;
|
|
@@ -16325,7 +16403,7 @@ function TableInner(props, ref) {
|
|
|
16325
16403
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
|
|
16326
16404
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
|
|
16327
16405
|
}, []);
|
|
16328
|
-
(0,
|
|
16406
|
+
(0, import_react57.useEffect)(() => {
|
|
16329
16407
|
const element = scrollRef.current;
|
|
16330
16408
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
16331
16409
|
const observer = new ResizeObserver(() => {
|
|
@@ -16338,19 +16416,19 @@ function TableInner(props, ref) {
|
|
|
16338
16416
|
updateScrollMetrics();
|
|
16339
16417
|
return () => observer.disconnect();
|
|
16340
16418
|
}, [updateScrollMetrics]);
|
|
16341
|
-
(0,
|
|
16419
|
+
(0, import_react57.useEffect)(() => {
|
|
16342
16420
|
updateScrollMetrics();
|
|
16343
16421
|
});
|
|
16344
|
-
const orderedColumns = (0,
|
|
16345
|
-
const leafColumns = (0,
|
|
16346
|
-
const headerRows = (0,
|
|
16347
|
-
const measuredCells = (0,
|
|
16422
|
+
const orderedColumns = (0, import_react57.useMemo)(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
16423
|
+
const leafColumns = (0, import_react57.useMemo)(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
16424
|
+
const headerRows = (0, import_react57.useMemo)(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
16425
|
+
const measuredCells = (0, import_react57.useRef)(/* @__PURE__ */ new WeakSet());
|
|
16348
16426
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
16349
|
-
(0,
|
|
16427
|
+
(0, import_react57.useEffect)(() => {
|
|
16350
16428
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
16351
16429
|
setAutoColumnWidths({});
|
|
16352
16430
|
}, [dataSource, baseColumns, size, autoWidthSignature]);
|
|
16353
|
-
(0,
|
|
16431
|
+
(0, import_react57.useEffect)(() => {
|
|
16354
16432
|
const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
|
|
16355
16433
|
const root = rootRef.current;
|
|
16356
16434
|
if (!root || autoWidthColumns.length === 0) return;
|
|
@@ -16434,7 +16512,7 @@ function TableInner(props, ref) {
|
|
|
16434
16512
|
}
|
|
16435
16513
|
const topSpacer = shouldVirtualize ? startIndex * rowHeight : 0;
|
|
16436
16514
|
const bottomSpacer = shouldVirtualize ? Math.max(0, (pipeline.rows.length - endIndex) * rowHeight) : 0;
|
|
16437
|
-
const rowElements = (0,
|
|
16515
|
+
const rowElements = (0, import_react57.useMemo)(() => /* @__PURE__ */ new Map(), [
|
|
16438
16516
|
dataSource,
|
|
16439
16517
|
baseColumns,
|
|
16440
16518
|
sortedPlugins,
|
|
@@ -16454,20 +16532,20 @@ function TableInner(props, ref) {
|
|
|
16454
16532
|
]);
|
|
16455
16533
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
16456
16534
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
16457
|
-
return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
16535
|
+
return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react57.Fragment, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
16458
16536
|
}).filter(Boolean);
|
|
16459
16537
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
16460
16538
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
16461
|
-
return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
16539
|
+
return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react57.Fragment, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
16462
16540
|
}).filter(Boolean);
|
|
16463
16541
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
16464
16542
|
const footers = sortedPlugins.map((plugin) => {
|
|
16465
16543
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
16466
|
-
return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
16544
|
+
return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react57.Fragment, { children: content }, `footer-${plugin.id}`) : null;
|
|
16467
16545
|
}).filter(Boolean);
|
|
16468
16546
|
const overlays = sortedPlugins.map((plugin) => {
|
|
16469
16547
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
16470
|
-
return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
16548
|
+
return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react57.Fragment, { children: content }, `overlay-${plugin.id}`) : null;
|
|
16471
16549
|
}).filter(Boolean);
|
|
16472
16550
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
16473
16551
|
const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize ? 420 : void 0);
|
|
@@ -16478,13 +16556,13 @@ function TableInner(props, ref) {
|
|
|
16478
16556
|
// 空态占位只覆盖内容区,必须给仍有业务意义的合计行留出空间。
|
|
16479
16557
|
"--sia-table-summary-height": `${summaries.length * rowHeight}px`
|
|
16480
16558
|
};
|
|
16481
|
-
const handleScroll = (0,
|
|
16559
|
+
const handleScroll = (0, import_react57.useCallback)((event) => {
|
|
16482
16560
|
const element = event.currentTarget;
|
|
16483
16561
|
if (shouldVirtualize) setScrollTop((previous) => Math.floor(previous / rowHeight) === Math.floor(element.scrollTop / rowHeight) ? previous : element.scrollTop);
|
|
16484
16562
|
if (canvas) setScrollLeft(element.scrollLeft);
|
|
16485
16563
|
updateScrollMetrics();
|
|
16486
16564
|
}, [canvas, shouldVirtualize, rowHeight, updateScrollMetrics]);
|
|
16487
|
-
const handleScrollbarPointerDown = (0,
|
|
16565
|
+
const handleScrollbarPointerDown = (0, import_react57.useCallback)((axis, event, track = event.currentTarget) => {
|
|
16488
16566
|
const element = scrollRef.current;
|
|
16489
16567
|
const thumb = track.firstElementChild;
|
|
16490
16568
|
if (!element || !thumb || event.button !== 0) return;
|
|
@@ -16513,7 +16591,7 @@ function TableInner(props, ref) {
|
|
|
16513
16591
|
};
|
|
16514
16592
|
if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "true";
|
|
16515
16593
|
}, []);
|
|
16516
|
-
const handleScrollbarPointerMove = (0,
|
|
16594
|
+
const handleScrollbarPointerMove = (0, import_react57.useCallback)((event) => {
|
|
16517
16595
|
const drag = scrollbarDragRef.current;
|
|
16518
16596
|
const element = scrollRef.current;
|
|
16519
16597
|
if (!drag || !element || drag.pointerId !== event.pointerId) return;
|
|
@@ -16522,12 +16600,12 @@ function TableInner(props, ref) {
|
|
|
16522
16600
|
if (drag.axis === "x") element.scrollLeft = nextScroll;
|
|
16523
16601
|
else element.scrollTop = nextScroll;
|
|
16524
16602
|
}, []);
|
|
16525
|
-
const handleScrollbarPointerEnd = (0,
|
|
16603
|
+
const handleScrollbarPointerEnd = (0, import_react57.useCallback)((event) => {
|
|
16526
16604
|
if (scrollbarDragRef.current?.pointerId !== event.pointerId) return;
|
|
16527
16605
|
scrollbarDragRef.current = null;
|
|
16528
16606
|
if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "false";
|
|
16529
16607
|
}, []);
|
|
16530
|
-
(0,
|
|
16608
|
+
(0, import_react57.useImperativeHandle)(ref, () => ({
|
|
16531
16609
|
getRows: () => pipeline.rows.map((row) => row.record),
|
|
16532
16610
|
getColumns: () => pipeline.columns,
|
|
16533
16611
|
getPluginApi: (pluginId) => pluginApisRef.current[pluginId],
|
|
@@ -16809,12 +16887,12 @@ function TableInner(props, ref) {
|
|
|
16809
16887
|
}
|
|
16810
16888
|
);
|
|
16811
16889
|
}
|
|
16812
|
-
var Table2 = (0,
|
|
16890
|
+
var Table2 = (0, import_react57.forwardRef)(TableInner);
|
|
16813
16891
|
|
|
16814
16892
|
// src/components/ThemeSwitch.tsx
|
|
16815
|
-
var
|
|
16893
|
+
var import_react58 = require("react");
|
|
16816
16894
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
16817
|
-
var ThemeSwitch = (0,
|
|
16895
|
+
var ThemeSwitch = (0, import_react58.forwardRef)(function ThemeSwitch2({
|
|
16818
16896
|
checked,
|
|
16819
16897
|
onCheckedChange,
|
|
16820
16898
|
lightLabel = "\u4EAE\u8272\u6A21\u5F0F",
|
|
@@ -16908,7 +16986,7 @@ function Breadcrumb({ items, separator = "/", itemRender, className = "", ...pro
|
|
|
16908
16986
|
}
|
|
16909
16987
|
|
|
16910
16988
|
// src/components/Typography.tsx
|
|
16911
|
-
var
|
|
16989
|
+
var import_react59 = require("react");
|
|
16912
16990
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
16913
16991
|
function TypographyContent({
|
|
16914
16992
|
as: Tag2 = "span",
|
|
@@ -16928,26 +17006,26 @@ function TypographyContent({
|
|
|
16928
17006
|
className = "",
|
|
16929
17007
|
...props
|
|
16930
17008
|
}) {
|
|
16931
|
-
const contentRef = (0,
|
|
16932
|
-
const editRef = (0,
|
|
16933
|
-
const timer = (0,
|
|
16934
|
-
const [localText, setLocalText] = (0,
|
|
16935
|
-
const [draft, setDraft] = (0,
|
|
16936
|
-
const [editing, setEditing] = (0,
|
|
16937
|
-
const [copied, setCopied] = (0,
|
|
16938
|
-
const [copyError, setCopyError] = (0,
|
|
16939
|
-
const [expanded, setExpanded] = (0,
|
|
16940
|
-
const [overflow, setOverflow] = (0,
|
|
17009
|
+
const contentRef = (0, import_react59.useRef)(null);
|
|
17010
|
+
const editRef = (0, import_react59.useRef)(null);
|
|
17011
|
+
const timer = (0, import_react59.useRef)();
|
|
17012
|
+
const [localText, setLocalText] = (0, import_react59.useState)();
|
|
17013
|
+
const [draft, setDraft] = (0, import_react59.useState)("");
|
|
17014
|
+
const [editing, setEditing] = (0, import_react59.useState)(false);
|
|
17015
|
+
const [copied, setCopied] = (0, import_react59.useState)(false);
|
|
17016
|
+
const [copyError, setCopyError] = (0, import_react59.useState)(false);
|
|
17017
|
+
const [expanded, setExpanded] = (0, import_react59.useState)(false);
|
|
17018
|
+
const [overflow, setOverflow] = (0, import_react59.useState)(false);
|
|
16941
17019
|
const editConfig = typeof editable === "object" ? editable : void 0;
|
|
16942
17020
|
const content = editConfig?.text ?? localText ?? children;
|
|
16943
17021
|
const requestedRows = typeof ellipsis === "object" ? ellipsis.rows ?? 1 : 1;
|
|
16944
17022
|
const rows = Number.isFinite(requestedRows) ? Math.max(1, Math.floor(requestedRows)) : 1;
|
|
16945
17023
|
const expandable = typeof ellipsis === "object" && ellipsis.expandable;
|
|
16946
|
-
(0,
|
|
17024
|
+
(0, import_react59.useEffect)(() => {
|
|
16947
17025
|
setLocalText(void 0);
|
|
16948
17026
|
}, [children]);
|
|
16949
|
-
(0,
|
|
16950
|
-
(0,
|
|
17027
|
+
(0, import_react59.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
17028
|
+
(0, import_react59.useLayoutEffect)(() => {
|
|
16951
17029
|
const element = contentRef.current;
|
|
16952
17030
|
if (!element || !ellipsis || !expandable || editing || expanded) return;
|
|
16953
17031
|
const measure = () => setOverflow(element.scrollHeight > element.clientHeight + 1 || element.scrollWidth > element.clientWidth + 1);
|
|
@@ -17065,10 +17143,10 @@ var Typography = Object.assign(TypographyRoot, {
|
|
|
17065
17143
|
});
|
|
17066
17144
|
|
|
17067
17145
|
// src/components/FloatButton.tsx
|
|
17068
|
-
var
|
|
17146
|
+
var import_react60 = require("react");
|
|
17069
17147
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
17070
|
-
var GroupShape = (0,
|
|
17071
|
-
var FloatButtonRoot = (0,
|
|
17148
|
+
var GroupShape = (0, import_react60.createContext)(void 0);
|
|
17149
|
+
var FloatButtonRoot = (0, import_react60.forwardRef)(function FloatButton({
|
|
17072
17150
|
icon,
|
|
17073
17151
|
description,
|
|
17074
17152
|
tooltip,
|
|
@@ -17081,7 +17159,7 @@ var FloatButtonRoot = (0, import_react59.forwardRef)(function FloatButton({
|
|
|
17081
17159
|
children,
|
|
17082
17160
|
...props
|
|
17083
17161
|
}, ref) {
|
|
17084
|
-
const groupShape = (0,
|
|
17162
|
+
const groupShape = (0, import_react60.useContext)(GroupShape);
|
|
17085
17163
|
const label = props["aria-label"] ?? (typeof tooltip === "string" ? tooltip : typeof description === "string" ? description : "\u60AC\u6D6E\u64CD\u4F5C");
|
|
17086
17164
|
const button = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
17087
17165
|
"button",
|
|
@@ -17119,10 +17197,10 @@ function FloatButtonGroup({
|
|
|
17119
17197
|
...props
|
|
17120
17198
|
}) {
|
|
17121
17199
|
const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
17122
|
-
const rootRef = (0,
|
|
17123
|
-
const triggerRef = (0,
|
|
17124
|
-
const id = (0,
|
|
17125
|
-
(0,
|
|
17200
|
+
const rootRef = (0, import_react60.useRef)(null);
|
|
17201
|
+
const triggerRef = (0, import_react60.useRef)(null);
|
|
17202
|
+
const id = (0, import_react60.useId)();
|
|
17203
|
+
(0, import_react60.useEffect)(() => {
|
|
17126
17204
|
if (!trigger || !visible) return;
|
|
17127
17205
|
const close = (event) => {
|
|
17128
17206
|
if (!rootRef.current?.contains(event.target)) setVisible(false);
|
|
@@ -17176,8 +17254,8 @@ function FloatButtonGroup({
|
|
|
17176
17254
|
) });
|
|
17177
17255
|
}
|
|
17178
17256
|
function FloatButtonBackTop({ target, visibilityHeight = 400, behavior = "smooth", onClick, icon, tooltip = "\u8FD4\u56DE\u9876\u90E8", ...props }) {
|
|
17179
|
-
const [visible, setVisible] = (0,
|
|
17180
|
-
(0,
|
|
17257
|
+
const [visible, setVisible] = (0, import_react60.useState)(false);
|
|
17258
|
+
(0, import_react60.useEffect)(() => {
|
|
17181
17259
|
const element = target ? target() : window;
|
|
17182
17260
|
if (!element) return;
|
|
17183
17261
|
const update = () => setVisible((element === window ? window.scrollY : element.scrollTop) >= visibilityHeight);
|
|
@@ -17201,11 +17279,11 @@ var FloatButton2 = Object.assign(FloatButtonRoot, {
|
|
|
17201
17279
|
});
|
|
17202
17280
|
|
|
17203
17281
|
// src/components/ChartWhirlingLoading.tsx
|
|
17204
|
-
var
|
|
17282
|
+
var import_react61 = require("react");
|
|
17205
17283
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
17206
17284
|
function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\u83B7\u53D6\u4E2D", textWidth, frame }) {
|
|
17207
|
-
const [tick, setTick] = (0,
|
|
17208
|
-
(0,
|
|
17285
|
+
const [tick, setTick] = (0, import_react61.useState)(0);
|
|
17286
|
+
(0, import_react61.useEffect)(() => {
|
|
17209
17287
|
if (frame != null) return;
|
|
17210
17288
|
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
17211
17289
|
let timer;
|
|
@@ -17236,20 +17314,20 @@ function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\
|
|
|
17236
17314
|
}
|
|
17237
17315
|
|
|
17238
17316
|
// src/components/SvgMapPlot.tsx
|
|
17239
|
-
var
|
|
17317
|
+
var import_react73 = require("react");
|
|
17240
17318
|
|
|
17241
17319
|
// src/components/ChartBrush.tsx
|
|
17242
|
-
var
|
|
17320
|
+
var import_react62 = require("react");
|
|
17243
17321
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
17244
17322
|
function ChartBrush({ bounds, onSelect, onCancel, selectionShape = "band", selectionStyle, minSelectionSize }) {
|
|
17245
|
-
const [vertical, setVertical] = (0,
|
|
17246
|
-
const startY = (0,
|
|
17323
|
+
const [vertical, setVertical] = (0, import_react62.useState)(null);
|
|
17324
|
+
const startY = (0, import_react62.useRef)(0);
|
|
17247
17325
|
const y = (event) => {
|
|
17248
17326
|
const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
|
|
17249
17327
|
return matrix ? Math.max(bounds.y, Math.min(bounds.y + bounds.height, new DOMPoint(event.clientX, event.clientY).matrixTransform(matrix.inverse()).y)) : bounds.y;
|
|
17250
17328
|
};
|
|
17251
|
-
const drag = (0,
|
|
17252
|
-
const [selection, setSelection] = (0,
|
|
17329
|
+
const drag = (0, import_react62.useRef)(null);
|
|
17330
|
+
const [selection, setSelection] = (0, import_react62.useState)(null);
|
|
17253
17331
|
const x = (event) => {
|
|
17254
17332
|
const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
|
|
17255
17333
|
if (!matrix) return null;
|
|
@@ -17372,7 +17450,7 @@ function appendChartExportHeadings(original, clone, host) {
|
|
|
17372
17450
|
}
|
|
17373
17451
|
|
|
17374
17452
|
// src/components/ChartNodeTimeline.tsx
|
|
17375
|
-
var
|
|
17453
|
+
var import_react64 = require("react");
|
|
17376
17454
|
|
|
17377
17455
|
// src/components/timelinePositions.ts
|
|
17378
17456
|
function timelineRatios(count, dates) {
|
|
@@ -17398,7 +17476,7 @@ function nearestTimelineIndex(ratios, ratio) {
|
|
|
17398
17476
|
}
|
|
17399
17477
|
|
|
17400
17478
|
// src/components/ChartPointMotion.tsx
|
|
17401
|
-
var
|
|
17479
|
+
var import_react63 = require("react");
|
|
17402
17480
|
|
|
17403
17481
|
// src/components/chartMotion.ts
|
|
17404
17482
|
function chartMotionBaseline(points, horizontal = false) {
|
|
@@ -17419,11 +17497,11 @@ function interpolateChartPoints(from, to, progress) {
|
|
|
17419
17497
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
17420
17498
|
function ChartPointMotion({ points, enabled, duration, updateDuration = 500, animateInitial = true, easing = "linear", progress, horizontal = false, origin, children }) {
|
|
17421
17499
|
const baseline = (target) => origin ? target.map(() => origin) : chartMotionBaseline(target, horizontal);
|
|
17422
|
-
const [frame, setFrame] = (0,
|
|
17423
|
-
const displayed = (0,
|
|
17424
|
-
const initialized = (0,
|
|
17500
|
+
const [frame, setFrame] = (0, import_react63.useState)(() => enabled && animateInitial ? baseline(points) : points);
|
|
17501
|
+
const displayed = (0, import_react63.useRef)(frame);
|
|
17502
|
+
const initialized = (0, import_react63.useRef)(!animateInitial);
|
|
17425
17503
|
const signature = JSON.stringify(points);
|
|
17426
|
-
(0,
|
|
17504
|
+
(0, import_react63.useEffect)(() => {
|
|
17427
17505
|
const target = points;
|
|
17428
17506
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
17429
17507
|
if (!enabled || progress != null || reduced.matches) {
|
|
@@ -17462,8 +17540,8 @@ function ChartPointMotion({ points, enabled, duration, updateDuration = 500, ani
|
|
|
17462
17540
|
// src/components/ChartNodeTimeline.tsx
|
|
17463
17541
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
17464
17542
|
function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, x = 80, y = 520, width = 840 }) {
|
|
17465
|
-
const [playing, setPlaying] = (0,
|
|
17466
|
-
const [draft, setDraft] = (0,
|
|
17543
|
+
const [playing, setPlaying] = (0, import_react64.useState)(autoPlay), dragging = (0, import_react64.useRef)();
|
|
17544
|
+
const [draft, setDraft] = (0, import_react64.useState)(), pending = (0, import_react64.useRef)(), draftRef = (0, import_react64.useRef)();
|
|
17467
17545
|
const shown = draft ?? value;
|
|
17468
17546
|
const cancelPending = () => {
|
|
17469
17547
|
clearTimeout(pending.current);
|
|
@@ -17471,8 +17549,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
|
|
|
17471
17549
|
draftRef.current = void 0;
|
|
17472
17550
|
setDraft(void 0);
|
|
17473
17551
|
};
|
|
17474
|
-
(0,
|
|
17475
|
-
(0,
|
|
17552
|
+
(0, import_react64.useEffect)(() => () => clearTimeout(pending.current), []);
|
|
17553
|
+
(0, import_react64.useEffect)(() => {
|
|
17476
17554
|
cancelPending();
|
|
17477
17555
|
}, [value]);
|
|
17478
17556
|
const preview = (index) => {
|
|
@@ -17487,8 +17565,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
|
|
|
17487
17565
|
draftRef.current = void 0;
|
|
17488
17566
|
}, 200);
|
|
17489
17567
|
};
|
|
17490
|
-
(0,
|
|
17491
|
-
(0,
|
|
17568
|
+
(0, import_react64.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
|
|
17569
|
+
(0, import_react64.useEffect)(() => {
|
|
17492
17570
|
if (!playing || labels.length < 2) return;
|
|
17493
17571
|
const timer = window.setTimeout(() => {
|
|
17494
17572
|
if (value + 1 < labels.length) onChange(value + 1);
|
|
@@ -17597,7 +17675,7 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
|
|
|
17597
17675
|
}
|
|
17598
17676
|
|
|
17599
17677
|
// src/components/ChartVerticalRange.tsx
|
|
17600
|
-
var
|
|
17678
|
+
var import_react65 = require("react");
|
|
17601
17679
|
|
|
17602
17680
|
// src/components/chartColorRamp.ts
|
|
17603
17681
|
function chartColorRamp(colors, ratio) {
|
|
@@ -17617,16 +17695,16 @@ function chartColorRamp(colors, ratio) {
|
|
|
17617
17695
|
// src/components/ChartVerticalRange.tsx
|
|
17618
17696
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
17619
17697
|
function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true, readOnly = false }) {
|
|
17620
|
-
const id = (0,
|
|
17621
|
-
const drag = (0,
|
|
17622
|
-
const [draft, setDraft] = (0,
|
|
17623
|
-
const pending = (0,
|
|
17698
|
+
const id = (0, import_react65.useId)().replaceAll(":", "");
|
|
17699
|
+
const drag = (0, import_react65.useRef)();
|
|
17700
|
+
const [draft, setDraft] = (0, import_react65.useState)();
|
|
17701
|
+
const pending = (0, import_react65.useRef)();
|
|
17624
17702
|
const cancel = () => {
|
|
17625
17703
|
drag.current = void 0;
|
|
17626
17704
|
pending.current = void 0;
|
|
17627
17705
|
setDraft(void 0);
|
|
17628
17706
|
};
|
|
17629
|
-
(0,
|
|
17707
|
+
(0, import_react65.useEffect)(() => {
|
|
17630
17708
|
if (!realtime) cancel();
|
|
17631
17709
|
}, [range[0], range[1], min, max, realtime]);
|
|
17632
17710
|
const shown = draft ?? range;
|
|
@@ -17707,18 +17785,18 @@ function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range,
|
|
|
17707
17785
|
}
|
|
17708
17786
|
|
|
17709
17787
|
// src/components/ChartHorizontalRange.tsx
|
|
17710
|
-
var
|
|
17788
|
+
var import_react66 = require("react");
|
|
17711
17789
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
17712
17790
|
function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true }) {
|
|
17713
|
-
const id = (0,
|
|
17714
|
-
const drag = (0,
|
|
17715
|
-
const [draft, setDraft] = (0,
|
|
17791
|
+
const id = (0, import_react66.useId)().replaceAll(":", ""), span = max - min;
|
|
17792
|
+
const drag = (0, import_react66.useRef)();
|
|
17793
|
+
const [draft, setDraft] = (0, import_react66.useState)(), pending = (0, import_react66.useRef)();
|
|
17716
17794
|
const cancel = () => {
|
|
17717
17795
|
drag.current = void 0;
|
|
17718
17796
|
pending.current = void 0;
|
|
17719
17797
|
setDraft(void 0);
|
|
17720
17798
|
};
|
|
17721
|
-
(0,
|
|
17799
|
+
(0, import_react66.useEffect)(() => {
|
|
17722
17800
|
if (!realtime) cancel();
|
|
17723
17801
|
}, [range[0], range[1], min, max, realtime]);
|
|
17724
17802
|
const shown = draft ?? range, low = Math.max(min, Math.min(max, shown[0])), high = Math.max(low, Math.min(max, shown[1]));
|
|
@@ -17796,7 +17874,7 @@ function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range
|
|
|
17796
17874
|
}
|
|
17797
17875
|
|
|
17798
17876
|
// src/components/Chart.tsx
|
|
17799
|
-
var
|
|
17877
|
+
var import_react67 = require("react");
|
|
17800
17878
|
|
|
17801
17879
|
// src/components/chartCompositeExport.ts
|
|
17802
17880
|
function serializeChartComposite(host) {
|
|
@@ -17920,20 +17998,20 @@ var DEFAULT_CHART_PALETTE = [
|
|
|
17920
17998
|
"#2f54eb",
|
|
17921
17999
|
"#a0d911"
|
|
17922
18000
|
];
|
|
17923
|
-
var ChartContext = (0,
|
|
18001
|
+
var ChartContext = (0, import_react67.createContext)(null);
|
|
17924
18002
|
function toCssSize(value, fallback) {
|
|
17925
18003
|
if (typeof value === "number") return `${value}px`;
|
|
17926
18004
|
return value ?? fallback;
|
|
17927
18005
|
}
|
|
17928
|
-
var ChartComposite = (0,
|
|
17929
|
-
const host = (0,
|
|
17930
|
-
(0,
|
|
18006
|
+
var ChartComposite = (0, import_react67.forwardRef)(function ChartComposite2({ layers, width = "100%", height = 320, ariaLabel = "\u7EC4\u5408\u56FE\u8868", className = "", style, ...props }, ref) {
|
|
18007
|
+
const host = (0, import_react67.useRef)(null);
|
|
18008
|
+
(0, import_react67.useImperativeHandle)(ref, () => ({ toSvgString: () => host.current ? serializeChartComposite(host.current) : null, saveAsImage: (filename) => saveCompositeImage(host.current ? serializeChartComposite(host.current) : null, filename) }), []);
|
|
17931
18009
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { ...withTitleTooltip(props), ref: host, className: `sia-chart-composite${className ? ` ${className}` : ""}`, style: { ...style, width: toCssSize(width, "100%"), height: toCssSize(height, "320px") }, role: "group", "aria-label": ariaLabel, children: layers.map((layer, index) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "sia-chart-composite__layer", style: { left: layer.left ?? 0, top: layer.top ?? 0, width: layer.width ?? "100%", height: layer.height ?? "100%", zIndex: layer.zIndex ?? index, pointerEvents: layer.pointerEvents }, children: layer.content }, layer.key ?? index)) });
|
|
17932
18010
|
});
|
|
17933
|
-
var useTooltipLayoutEffect = typeof window === "undefined" ?
|
|
18011
|
+
var useTooltipLayoutEffect = typeof window === "undefined" ? import_react67.useEffect : import_react67.useLayoutEffect;
|
|
17934
18012
|
function ChartTooltip({ open, left, top, children, enterable = false, inheritTextStyle = false, placement = "above", className = "", style, ...props }) {
|
|
17935
|
-
const elementRef = (0,
|
|
17936
|
-
const [position, setPosition] = (0,
|
|
18013
|
+
const elementRef = (0, import_react67.useRef)(null);
|
|
18014
|
+
const [position, setPosition] = (0, import_react67.useState)([left, top]);
|
|
17937
18015
|
useTooltipLayoutEffect(() => {
|
|
17938
18016
|
const element = elementRef.current, host = element?.parentElement;
|
|
17939
18017
|
if (!open || placement !== "axis" || !element || !host) return;
|
|
@@ -18057,7 +18135,7 @@ function ChartToolbox({
|
|
|
18057
18135
|
))
|
|
18058
18136
|
] });
|
|
18059
18137
|
}
|
|
18060
|
-
var SiaChart = (0,
|
|
18138
|
+
var SiaChart = (0, import_react67.forwardRef)(function SiaChart2({
|
|
18061
18139
|
children,
|
|
18062
18140
|
width = "100%",
|
|
18063
18141
|
height = 320,
|
|
@@ -18084,19 +18162,19 @@ var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
|
|
|
18084
18162
|
style,
|
|
18085
18163
|
...rest
|
|
18086
18164
|
}, ref) {
|
|
18087
|
-
const hostRef = (0,
|
|
18088
|
-
const svgRef = (0,
|
|
18089
|
-
const titleId = (0,
|
|
18090
|
-
const descriptionId = (0,
|
|
18091
|
-
const [tooltip, setTooltip] = (0,
|
|
18092
|
-
const tooltipHideTimer = (0,
|
|
18093
|
-
const tooltipHeld = (0,
|
|
18165
|
+
const hostRef = (0, import_react67.useRef)(null);
|
|
18166
|
+
const svgRef = (0, import_react67.useRef)(null);
|
|
18167
|
+
const titleId = (0, import_react67.useId)();
|
|
18168
|
+
const descriptionId = (0, import_react67.useId)();
|
|
18169
|
+
const [tooltip, setTooltip] = (0, import_react67.useState)(null);
|
|
18170
|
+
const tooltipHideTimer = (0, import_react67.useRef)();
|
|
18171
|
+
const tooltipHeld = (0, import_react67.useRef)(false);
|
|
18094
18172
|
const cancelTooltipHide = () => {
|
|
18095
18173
|
clearTimeout(tooltipHideTimer.current);
|
|
18096
18174
|
};
|
|
18097
|
-
(0,
|
|
18098
|
-
const [linkedPosition, setLinkedPosition] = (0,
|
|
18099
|
-
(0,
|
|
18175
|
+
(0, import_react67.useEffect)(() => () => clearTimeout(tooltipHideTimer.current), []);
|
|
18176
|
+
const [linkedPosition, setLinkedPosition] = (0, import_react67.useState)({ left: 0, top: 0 });
|
|
18177
|
+
(0, import_react67.useEffect)(() => {
|
|
18100
18178
|
const host = hostRef.current, svg = svgRef.current;
|
|
18101
18179
|
if (!controlledTooltip || !host || !svg) return;
|
|
18102
18180
|
const position = () => {
|
|
@@ -18111,12 +18189,12 @@ var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
|
|
|
18111
18189
|
observer.observe(host);
|
|
18112
18190
|
return () => observer.disconnect();
|
|
18113
18191
|
}, [controlledTooltip]);
|
|
18114
|
-
const [dataViewOpen, setDataViewOpen] = (0,
|
|
18115
|
-
const [markMode, setMarkMode] = (0,
|
|
18116
|
-
const [markStart, setMarkStart] = (0,
|
|
18117
|
-
const [userMarks, setUserMarks] = (0,
|
|
18192
|
+
const [dataViewOpen, setDataViewOpen] = (0, import_react67.useState)(false);
|
|
18193
|
+
const [markMode, setMarkMode] = (0, import_react67.useState)(false);
|
|
18194
|
+
const [markStart, setMarkStart] = (0, import_react67.useState)(null);
|
|
18195
|
+
const [userMarks, setUserMarks] = (0, import_react67.useState)([]);
|
|
18118
18196
|
const toolboxOptions = toolbox === true ? {} : toolbox || void 0;
|
|
18119
|
-
const rootStyle = (0,
|
|
18197
|
+
const rootStyle = (0, import_react67.useMemo)(() => ({
|
|
18120
18198
|
...style,
|
|
18121
18199
|
width: toCssSize(width, "100%"),
|
|
18122
18200
|
height: toCssSize(height, "320px"),
|
|
@@ -18174,13 +18252,13 @@ var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
|
|
|
18174
18252
|
anchor.href = canvas.toDataURL("image/png");
|
|
18175
18253
|
anchor.click();
|
|
18176
18254
|
}
|
|
18177
|
-
(0,
|
|
18255
|
+
(0, import_react67.useImperativeHandle)(ref, () => ({
|
|
18178
18256
|
getElement: () => svgRef.current,
|
|
18179
18257
|
focus: () => svgRef.current?.focus(),
|
|
18180
18258
|
toSvgString: serializeSvg,
|
|
18181
18259
|
toDataUrl: svgDataUrl
|
|
18182
18260
|
}), []);
|
|
18183
|
-
const context = (0,
|
|
18261
|
+
const context = (0, import_react67.useMemo)(() => ({
|
|
18184
18262
|
palette,
|
|
18185
18263
|
showTooltip: (event, content, point) => {
|
|
18186
18264
|
cancelTooltipHide();
|
|
@@ -18367,7 +18445,7 @@ var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
|
|
|
18367
18445
|
) });
|
|
18368
18446
|
});
|
|
18369
18447
|
function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave, onFocus, onBlur, ...props }) {
|
|
18370
|
-
const context = (0,
|
|
18448
|
+
const context = (0, import_react67.useContext)(ChartContext);
|
|
18371
18449
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
18372
18450
|
"g",
|
|
18373
18451
|
{
|
|
@@ -18396,7 +18474,7 @@ function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave
|
|
|
18396
18474
|
);
|
|
18397
18475
|
}
|
|
18398
18476
|
function ChartLegend({ items, symbol = "rect", x = CHART_VIEWBOX_WIDTH / 2, y = 20, align = "center", itemGap = 18, orientation = "horizontal", selected, onItemClick, maxWidth, rowGap = 24, iconWidth, iconHeight = 14, textGap = 5, textStyle, inactiveColor, background }) {
|
|
18399
|
-
const paintId = (0,
|
|
18477
|
+
const paintId = (0, import_react67.useId)().replaceAll(":", "");
|
|
18400
18478
|
const widths = items.map((item) => (iconWidth == null ? 18 : iconWidth + textGap) + (item.textWidth ?? Math.max(30, Array.from(item.name).reduce((width, character) => width + (character.charCodeAt(0) > 255 ? 13 : 7), 0))));
|
|
18401
18479
|
const totalWidth = orientation === "horizontal" ? widths.reduce((sum, value) => sum + value, 0) + Math.max(0, items.length - 1) * itemGap : Math.max(0, ...widths);
|
|
18402
18480
|
const startX = align === "start" ? x : align === "end" ? x - totalWidth : x - totalWidth / 2;
|
|
@@ -18525,7 +18603,7 @@ function ChartAxis({ layer = "all", orientation, x, y, length, labels, positions
|
|
|
18525
18603
|
] });
|
|
18526
18604
|
}
|
|
18527
18605
|
function ChartVisualMap({ min, max, colors = ["#e6f4ff", "#1677ff"], x = 16, y = 284, width = 110, height = 9, label, endLabels, indicatorValue, onHoverRange, realtime = true, svgHandles = false, orientation = "horizontal", calculable = false, value = max, onChange, range, onRangeChange, pieces, selectedPieces, onPieceToggle }) {
|
|
18528
|
-
const id = (0,
|
|
18606
|
+
const id = (0, import_react67.useId)().replaceAll(":", "");
|
|
18529
18607
|
const vertical = orientation === "vertical";
|
|
18530
18608
|
if (svgHandles && vertical && !calculable && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartVerticalRange, { readOnly: true, min, max, x, y, length: width, thickness: height, colors, range: [min, max], endLabels, indicatorValue, onHoverRange });
|
|
18531
18609
|
if (svgHandles && vertical && calculable && range && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartVerticalRange, { min, max, x, y, length: width, thickness: height, colors, range, onChange: onRangeChange, endLabels, indicatorValue, onHoverRange, realtime });
|
|
@@ -18553,8 +18631,8 @@ function ChartVisualMap({ min, max, colors = ["#e6f4ff", "#1677ff"], x = 16, y =
|
|
|
18553
18631
|
] });
|
|
18554
18632
|
}
|
|
18555
18633
|
function ChartDataZoom({ value, min = 0, max = 100, ariaLabel = "\u56FE\u8868\u53EF\u89C1\u8303\u56F4", orientation = "horizontal", dataShadow = [], showDetail = false, minSpan = 1, formatter, onChange, panEnabled = false, shadowBounds, handleLabels }) {
|
|
18556
|
-
const [activeHandle, setActiveHandle] = (0,
|
|
18557
|
-
const pan = (0,
|
|
18634
|
+
const [activeHandle, setActiveHandle] = (0, import_react67.useState)(null);
|
|
18635
|
+
const pan = (0, import_react67.useRef)();
|
|
18558
18636
|
const start = Math.min(value[0], value[1]);
|
|
18559
18637
|
const end = Math.max(value[0], value[1]);
|
|
18560
18638
|
const startPercent = (start - min) / Math.max(1, max - min) * 100;
|
|
@@ -18628,9 +18706,9 @@ function ChartDataZoom({ value, min = 0, max = 100, ariaLabel = "\u56FE\u8868\u5
|
|
|
18628
18706
|
] });
|
|
18629
18707
|
}
|
|
18630
18708
|
function ChartTimeline({ labels, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, className = "", ...props }) {
|
|
18631
|
-
const [playing, setPlaying] = (0,
|
|
18632
|
-
(0,
|
|
18633
|
-
(0,
|
|
18709
|
+
const [playing, setPlaying] = (0, import_react67.useState)(autoPlay);
|
|
18710
|
+
(0, import_react67.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
|
|
18711
|
+
(0, import_react67.useEffect)(() => {
|
|
18634
18712
|
if (!playing || labels.length <= 1) return void 0;
|
|
18635
18713
|
const timer = window.setInterval(() => {
|
|
18636
18714
|
const next = value + 1;
|
|
@@ -18740,7 +18818,7 @@ function parseSvgMapPaths(source) {
|
|
|
18740
18818
|
}
|
|
18741
18819
|
|
|
18742
18820
|
// src/components/useMapRoam.ts
|
|
18743
|
-
var
|
|
18821
|
+
var import_react68 = require("react");
|
|
18744
18822
|
|
|
18745
18823
|
// src/components/chartRoam.ts
|
|
18746
18824
|
function zoomChartViewport(view, factor, point, limit = { min: 0.05, max: 20 }) {
|
|
@@ -18757,14 +18835,14 @@ var initial = { x: 0, y: 0, scale: 1 };
|
|
|
18757
18835
|
function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.12, 0.9]) {
|
|
18758
18836
|
const [zoomIn, zoomOut] = wheelFactors;
|
|
18759
18837
|
const min = scaleLimit?.min, max = scaleLimit?.max, unlimited = scaleLimit === null;
|
|
18760
|
-
const host = (0,
|
|
18761
|
-
const [view, setView] = (0,
|
|
18762
|
-
const drag = (0,
|
|
18838
|
+
const host = (0, import_react68.useRef)(null);
|
|
18839
|
+
const [view, setView] = (0, import_react68.useState)(initial);
|
|
18840
|
+
const drag = (0, import_react68.useRef)();
|
|
18763
18841
|
const local = (x, y) => {
|
|
18764
18842
|
const matrix = host.current?.ownerSVGElement?.getScreenCTM();
|
|
18765
18843
|
return matrix ? new DOMPoint(x, y).matrixTransform(matrix.inverse()) : new DOMPoint(x, y);
|
|
18766
18844
|
};
|
|
18767
|
-
(0,
|
|
18845
|
+
(0, import_react68.useEffect)(() => {
|
|
18768
18846
|
const node = host.current;
|
|
18769
18847
|
if (!node || !mode || mode === "move") return;
|
|
18770
18848
|
const wheel = (event) => {
|
|
@@ -18826,7 +18904,7 @@ function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.
|
|
|
18826
18904
|
}
|
|
18827
18905
|
|
|
18828
18906
|
// src/components/ChartMapLineReveal.tsx
|
|
18829
|
-
var
|
|
18907
|
+
var import_react69 = require("react");
|
|
18830
18908
|
|
|
18831
18909
|
// src/components/mapLineGeometry.ts
|
|
18832
18910
|
function mapLineControl(source, target, curveness) {
|
|
@@ -18843,9 +18921,9 @@ function mapLineDuration(source, target, period) {
|
|
|
18843
18921
|
// src/components/ChartMapLineReveal.tsx
|
|
18844
18922
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
18845
18923
|
function ChartMapLineReveal({ source, control, target, enabled, initialDuration = 2e3, updateDuration = 500, children }) {
|
|
18846
|
-
const signature = JSON.stringify([source, control, target]), initialized = (0,
|
|
18847
|
-
const [frame, setFrame] = (0,
|
|
18848
|
-
(0,
|
|
18924
|
+
const signature = JSON.stringify([source, control, target]), initialized = (0, import_react69.useRef)(false);
|
|
18925
|
+
const [frame, setFrame] = (0, import_react69.useState)({ signature, progress: enabled ? 0 : 1 });
|
|
18926
|
+
(0, import_react69.useEffect)(() => {
|
|
18849
18927
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
18850
18928
|
const duration = Math.max(1, initialized.current ? updateDuration : initialDuration);
|
|
18851
18929
|
if (!enabled || reduced.matches) {
|
|
@@ -18878,15 +18956,15 @@ function ChartMapLineReveal({ source, control, target, enabled, initialDuration
|
|
|
18878
18956
|
}
|
|
18879
18957
|
|
|
18880
18958
|
// src/components/ChartMapLineEffect.tsx
|
|
18881
|
-
var
|
|
18959
|
+
var import_react70 = require("react");
|
|
18882
18960
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
18883
18961
|
function ChartMapLineEffect({ source, control, target, period = 30, color = "#fff", radius = 1, shadowBlur = 10, shadowColor = color, trailAlpha }) {
|
|
18884
|
-
const ref = (0,
|
|
18885
|
-
const trails = (0,
|
|
18962
|
+
const ref = (0, import_react70.useRef)(null);
|
|
18963
|
+
const trails = (0, import_react70.useRef)([]);
|
|
18886
18964
|
const alpha = trailAlpha === void 0 ? 0 : Math.max(0, Math.min(0.999, trailAlpha));
|
|
18887
18965
|
const count = alpha > 0 ? Math.min(240, Math.ceil(Math.log(5e-3) / Math.log(alpha))) : 0;
|
|
18888
18966
|
const duration = mapLineDuration(source, target, period);
|
|
18889
|
-
(0,
|
|
18967
|
+
(0, import_react70.useEffect)(() => {
|
|
18890
18968
|
const started = performance.now();
|
|
18891
18969
|
let frame = 0;
|
|
18892
18970
|
const history = [];
|
|
@@ -18919,7 +18997,7 @@ function ChartMapLineEffect({ source, control, target, period = 30, color = "#ff
|
|
|
18919
18997
|
}
|
|
18920
18998
|
|
|
18921
18999
|
// src/components/ChartMapPointPulse.tsx
|
|
18922
|
-
var
|
|
19000
|
+
var import_react71 = require("react");
|
|
18923
19001
|
|
|
18924
19002
|
// src/components/mapPointPulse.ts
|
|
18925
19003
|
function mapPointPulseDuration(period, random = Math.random) {
|
|
@@ -18929,7 +19007,7 @@ function mapPointPulseDuration(period, random = Math.random) {
|
|
|
18929
19007
|
// src/components/ChartMapPointPulse.tsx
|
|
18930
19008
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
18931
19009
|
function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
|
|
18932
|
-
const [duration] = (0,
|
|
19010
|
+
const [duration] = (0, import_react71.useState)(() => mapPointPulseDuration(period));
|
|
18933
19011
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("circle", { "data-svg-map-pulse": duration, cx: x, cy: y, r: size * scaleSize * 0.1, fill: "none", stroke: color, strokeWidth: 0.1, pointerEvents: "none", style: { filter: `drop-shadow(0 0 2px ${color})` }, children: [
|
|
18934
19012
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("animate", { attributeName: "r", values: `${size * scaleSize * 0.1};${size * scaleSize}`, dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" }),
|
|
18935
19013
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("animate", { attributeName: "stroke-width", values: ".1;1", dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" })
|
|
@@ -18937,11 +19015,11 @@ function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
|
|
|
18937
19015
|
}
|
|
18938
19016
|
|
|
18939
19017
|
// src/components/ChartMapPointEntrance.tsx
|
|
18940
|
-
var
|
|
19018
|
+
var import_react72 = require("react");
|
|
18941
19019
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
18942
19020
|
function ChartMapPointEntrance({ enabled, x, y, children }) {
|
|
18943
|
-
const [progress, setProgress] = (0,
|
|
18944
|
-
(0,
|
|
19021
|
+
const [progress, setProgress] = (0, import_react72.useState)(enabled ? 0.01 : 1);
|
|
19022
|
+
(0, import_react72.useEffect)(() => {
|
|
18945
19023
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
18946
19024
|
if (!enabled || reduced.matches) {
|
|
18947
19025
|
setProgress(1);
|
|
@@ -18984,8 +19062,8 @@ function mapLineEndLabel(source, target) {
|
|
|
18984
19062
|
// src/components/SvgMapPlot.tsx
|
|
18985
19063
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
18986
19064
|
function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized, onHover, stroke, strokeWidth, opacity, hoverable = true, showLabel = true, tooltipNameOnly = false }) {
|
|
18987
|
-
const path = (0,
|
|
18988
|
-
(0,
|
|
19065
|
+
const path = (0, import_react73.useRef)(null), [center, setCenter] = (0, import_react73.useState)([0, 0]);
|
|
19066
|
+
(0, import_react73.useLayoutEffect)(() => {
|
|
18989
19067
|
const box = path.current?.getBBox();
|
|
18990
19068
|
if (box) setCenter([box.x + box.width / 2, box.y + box.height / 2]);
|
|
18991
19069
|
}, [d]);
|
|
@@ -19003,9 +19081,9 @@ function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized
|
|
|
19003
19081
|
] }), onPointerMove: () => onHover(true), onPointerLeave: () => onHover(false), onFocus: () => onHover(true), onBlur: () => onHover(false), children: content });
|
|
19004
19082
|
}
|
|
19005
19083
|
function SvgMapPlot({ source, name, data, x, y, width, height, domain, range = domain, colors, labelOffsets, hoverRange, onHoverValue, roam = true, resetKey = 0, children, markPoints = [], markLines = [], lineAnimation = false, tooltipNameOnly = false, showLabels = true, pointAnimation = false, pointEntrance = false, pointAnimationEasing = "linear" }) {
|
|
19006
|
-
const map = (0,
|
|
19007
|
-
const [hoveredLine, setHoveredLine] = (0,
|
|
19008
|
-
(0,
|
|
19084
|
+
const map = (0, import_react73.useMemo)(() => parseSvgMapPaths(source), [source]), control = useMapRoam(roam, null, [1.2, 1 / 1.2]), [hovered, setHovered] = (0, import_react73.useState)();
|
|
19085
|
+
const [hoveredLine, setHoveredLine] = (0, import_react73.useState)();
|
|
19086
|
+
(0, import_react73.useEffect)(() => {
|
|
19009
19087
|
control.reset();
|
|
19010
19088
|
setHovered(void 0);
|
|
19011
19089
|
}, [resetKey]);
|
|
@@ -19068,16 +19146,16 @@ function SvgMapPlot({ source, name, data, x, y, width, height, domain, range = d
|
|
|
19068
19146
|
}
|
|
19069
19147
|
|
|
19070
19148
|
// src/components/ChartRoamController.tsx
|
|
19071
|
-
var
|
|
19149
|
+
var import_react74 = require("react");
|
|
19072
19150
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
19073
19151
|
function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
|
|
19074
|
-
const [hovered, setHovered] = (0,
|
|
19075
|
-
const timer = (0,
|
|
19152
|
+
const [hovered, setHovered] = (0, import_react74.useState)(), [focused, setFocused] = (0, import_react74.useState)();
|
|
19153
|
+
const timer = (0, import_react74.useRef)();
|
|
19076
19154
|
const stop = () => {
|
|
19077
19155
|
if (timer.current !== void 0) clearInterval(timer.current);
|
|
19078
19156
|
timer.current = void 0;
|
|
19079
19157
|
};
|
|
19080
|
-
(0,
|
|
19158
|
+
(0, import_react74.useEffect)(() => {
|
|
19081
19159
|
window.addEventListener("blur", stop);
|
|
19082
19160
|
return () => {
|
|
19083
19161
|
stop();
|
|
@@ -19116,13 +19194,13 @@ function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
|
|
|
19116
19194
|
}
|
|
19117
19195
|
|
|
19118
19196
|
// src/components/LineShareChart.tsx
|
|
19119
|
-
var
|
|
19197
|
+
var import_react94 = require("react");
|
|
19120
19198
|
|
|
19121
19199
|
// src/components/Charts.tsx
|
|
19122
|
-
var
|
|
19200
|
+
var import_react92 = require("react");
|
|
19123
19201
|
|
|
19124
19202
|
// src/components/ChartScatterMotion.tsx
|
|
19125
|
-
var
|
|
19203
|
+
var import_react75 = require("react");
|
|
19126
19204
|
|
|
19127
19205
|
// src/components/scatterMotion.ts
|
|
19128
19206
|
function scatterMotionEase(progress) {
|
|
@@ -19134,9 +19212,9 @@ function scatterMotionEase(progress) {
|
|
|
19134
19212
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
19135
19213
|
function ChartScatterMotion({ x, y, radius, enabled, duration = 2e3, updateDuration = 500, progress, children }) {
|
|
19136
19214
|
const target = { x, y, radius };
|
|
19137
|
-
const [frame, setFrame] = (0,
|
|
19138
|
-
const displayed = (0,
|
|
19139
|
-
(0,
|
|
19215
|
+
const [frame, setFrame] = (0, import_react75.useState)(() => ({ ...target, radius: enabled ? radius * 0.01 : radius }));
|
|
19216
|
+
const displayed = (0, import_react75.useRef)(frame), started = (0, import_react75.useRef)(false);
|
|
19217
|
+
(0, import_react75.useEffect)(() => {
|
|
19140
19218
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
19141
19219
|
let request = 0;
|
|
19142
19220
|
const publish = (next) => {
|
|
@@ -19247,12 +19325,12 @@ function layoutEventRiver(series, tailLength, area) {
|
|
|
19247
19325
|
}
|
|
19248
19326
|
|
|
19249
19327
|
// src/components/EventRiverBubble.tsx
|
|
19250
|
-
var
|
|
19328
|
+
var import_react76 = require("react");
|
|
19251
19329
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
19252
19330
|
function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerUp, ...props }) {
|
|
19253
|
-
const [offset, setOffset] = (0,
|
|
19254
|
-
const drag = (0,
|
|
19255
|
-
(0,
|
|
19331
|
+
const [offset, setOffset] = (0, import_react76.useState)(0);
|
|
19332
|
+
const drag = (0, import_react76.useRef)();
|
|
19333
|
+
(0, import_react76.useEffect)(() => {
|
|
19256
19334
|
setOffset(0);
|
|
19257
19335
|
drag.current = void 0;
|
|
19258
19336
|
}, [resetKey]);
|
|
@@ -19303,13 +19381,13 @@ function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerU
|
|
|
19303
19381
|
}
|
|
19304
19382
|
|
|
19305
19383
|
// src/components/EventRiverMotion.tsx
|
|
19306
|
-
var
|
|
19384
|
+
var import_react77 = require("react");
|
|
19307
19385
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
19308
19386
|
function EventRiverMotion({ geometry, enabled = true, duration = 2e3, updateDuration = 500, progress, children }) {
|
|
19309
|
-
const [frame, setFrame] = (0,
|
|
19310
|
-
const displayed = (0,
|
|
19387
|
+
const [frame, setFrame] = (0, import_react77.useState)(() => ({ ...geometry, scale: enabled ? 0.1 : 1 }));
|
|
19388
|
+
const displayed = (0, import_react77.useRef)(frame), started = (0, import_react77.useRef)(false);
|
|
19311
19389
|
const signature = JSON.stringify(geometry);
|
|
19312
|
-
(0,
|
|
19390
|
+
(0, import_react77.useEffect)(() => {
|
|
19313
19391
|
const preference = window.matchMedia("(prefers-reduced-motion: reduce)"), target = { ...geometry, scale: 1 };
|
|
19314
19392
|
const from = started.current ? displayed.current : { ...geometry, scale: 0.1 };
|
|
19315
19393
|
let request = 0;
|
|
@@ -19427,7 +19505,7 @@ function transferPieValue(series, source, target, connector = " & ") {
|
|
|
19427
19505
|
}
|
|
19428
19506
|
|
|
19429
19507
|
// src/components/ChartValueIsland.tsx
|
|
19430
|
-
var
|
|
19508
|
+
var import_react78 = require("react");
|
|
19431
19509
|
|
|
19432
19510
|
// src/components/cartesianTransfer.ts
|
|
19433
19511
|
function addValues(a, b) {
|
|
@@ -19493,13 +19571,13 @@ function findCompositeValueTarget(element, x, y) {
|
|
|
19493
19571
|
// src/components/ChartValueIsland.tsx
|
|
19494
19572
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
19495
19573
|
function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolveTarget = findCompositeValueTarget }) {
|
|
19496
|
-
const drag = (0,
|
|
19497
|
-
const [offset, setOffset] = (0,
|
|
19574
|
+
const drag = (0, import_react78.useRef)(null);
|
|
19575
|
+
const [offset, setOffset] = (0, import_react78.useState)([0, 0]);
|
|
19498
19576
|
const cancel = () => {
|
|
19499
19577
|
drag.current = null;
|
|
19500
19578
|
setOffset([0, 0]);
|
|
19501
19579
|
};
|
|
19502
|
-
(0,
|
|
19580
|
+
(0, import_react78.useEffect)(cancel, [x, y]);
|
|
19503
19581
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
19504
19582
|
ChartMark,
|
|
19505
19583
|
{
|
|
@@ -19552,12 +19630,12 @@ function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolv
|
|
|
19552
19630
|
}
|
|
19553
19631
|
|
|
19554
19632
|
// src/components/ChartPulseRing.tsx
|
|
19555
|
-
var
|
|
19633
|
+
var import_react79 = require("react");
|
|
19556
19634
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
19557
19635
|
function ChartPulseRing({ center, radius, scaleSize = 2, color = "gold", shadowBlur = 10, period = 15, progress, enabled = true }) {
|
|
19558
|
-
const id = (0,
|
|
19559
|
-
const [reduced, setReduced] = (0,
|
|
19560
|
-
(0,
|
|
19636
|
+
const id = (0, import_react79.useId)().replace(/:/g, ""), [phase, setPhase] = (0, import_react79.useState)(0);
|
|
19637
|
+
const [reduced, setReduced] = (0, import_react79.useState)(false);
|
|
19638
|
+
(0, import_react79.useEffect)(() => {
|
|
19561
19639
|
const preference = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
19562
19640
|
setReduced(preference.matches);
|
|
19563
19641
|
let frame = 0;
|
|
@@ -19701,7 +19779,7 @@ function chartMarkerPath(kind, x, y, size) {
|
|
|
19701
19779
|
}
|
|
19702
19780
|
|
|
19703
19781
|
// src/components/ChartLargeMapPointCanvas.tsx
|
|
19704
|
-
var
|
|
19782
|
+
var import_react80 = require("react");
|
|
19705
19783
|
|
|
19706
19784
|
// src/components/largeMapPointPulse.ts
|
|
19707
19785
|
function largeMapPointPulse(elapsed, period, initial3, delay) {
|
|
@@ -19717,8 +19795,8 @@ function largeMapPointSize(size, pulse) {
|
|
|
19717
19795
|
// src/components/ChartLargeMapPointCanvas.tsx
|
|
19718
19796
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
19719
19797
|
function ChartLargeMapPointCanvas({ groups, width, height }) {
|
|
19720
|
-
const canvas = (0,
|
|
19721
|
-
(0,
|
|
19798
|
+
const canvas = (0, import_react80.useRef)(null), key = JSON.stringify(groups);
|
|
19799
|
+
(0, import_react80.useEffect)(() => {
|
|
19722
19800
|
const element = canvas.current, context = element?.getContext("2d");
|
|
19723
19801
|
if (!element || !context) return;
|
|
19724
19802
|
const ratio = window.devicePixelRatio || 1;
|
|
@@ -19777,12 +19855,12 @@ function ChartLargeMapPointCanvas({ groups, width, height }) {
|
|
|
19777
19855
|
}
|
|
19778
19856
|
|
|
19779
19857
|
// src/components/ChartCrosshair.tsx
|
|
19780
|
-
var
|
|
19858
|
+
var import_react81 = require("react");
|
|
19781
19859
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
19782
19860
|
function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY = decimal }) {
|
|
19783
|
-
const ref = (0,
|
|
19784
|
-
const [point, setPoint] = (0,
|
|
19785
|
-
(0,
|
|
19861
|
+
const ref = (0, import_react81.useRef)(null);
|
|
19862
|
+
const [point, setPoint] = (0, import_react81.useState)(null);
|
|
19863
|
+
(0, import_react81.useEffect)(() => {
|
|
19786
19864
|
const svg = ref.current?.ownerSVGElement;
|
|
19787
19865
|
if (!svg) return;
|
|
19788
19866
|
const clear = () => setPoint(null);
|
|
@@ -19802,7 +19880,7 @@ function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY =
|
|
|
19802
19880
|
svg.removeEventListener("pointercancel", clear);
|
|
19803
19881
|
};
|
|
19804
19882
|
}, [bounds.x, bounds.y, bounds.width, bounds.height]);
|
|
19805
|
-
(0,
|
|
19883
|
+
(0, import_react81.useEffect)(() => setPoint(null), [xDomain[0], xDomain[1], yDomain[0], yDomain[1]]);
|
|
19806
19884
|
const x = point ? xDomain[0] + (point.x - bounds.x) / bounds.width * (xDomain[1] - xDomain[0]) : 0;
|
|
19807
19885
|
const y = point ? yDomain[1] - (point.y - bounds.y) / bounds.height * (yDomain[1] - yDomain[0]) : 0;
|
|
19808
19886
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("g", { ref, className: "sia-chart__crosshair", "aria-hidden": "true", children: [
|
|
@@ -19819,7 +19897,7 @@ function decimal(value) {
|
|
|
19819
19897
|
}
|
|
19820
19898
|
|
|
19821
19899
|
// src/components/HeatmapRasterLayer.tsx
|
|
19822
|
-
var
|
|
19900
|
+
var import_react82 = require("react");
|
|
19823
19901
|
|
|
19824
19902
|
// src/components/heatmapRaster.ts
|
|
19825
19903
|
var defaultGradient = [{ offset: 0.2, color: [0, 0, 255] }, { offset: 0.4, color: [0, 255, 255] }, { offset: 0.6, color: [0, 255, 0] }, { offset: 0.8, color: [255, 255, 0] }, { offset: 1, color: [255, 0, 0] }];
|
|
@@ -19866,9 +19944,9 @@ function rasterizeHeatmap(width, height, points, options = {}) {
|
|
|
19866
19944
|
// src/components/HeatmapRasterLayer.tsx
|
|
19867
19945
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
19868
19946
|
function HeatmapRaster({ width, height, points, options }) {
|
|
19869
|
-
const [url, setUrl] = (0,
|
|
19947
|
+
const [url, setUrl] = (0, import_react82.useState)();
|
|
19870
19948
|
const optionsKey = JSON.stringify(options);
|
|
19871
|
-
(0,
|
|
19949
|
+
(0, import_react82.useEffect)(() => {
|
|
19872
19950
|
const canvas = document.createElement("canvas");
|
|
19873
19951
|
canvas.width = width;
|
|
19874
19952
|
canvas.height = height;
|
|
@@ -19968,10 +20046,10 @@ function chordMatrixLayout(matrix, options = {}) {
|
|
|
19968
20046
|
}
|
|
19969
20047
|
|
|
19970
20048
|
// src/components/MatrixChordPlot.tsx
|
|
19971
|
-
var
|
|
20049
|
+
var import_react83 = require("react");
|
|
19972
20050
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
19973
20051
|
function MatrixChordPlot({ names, matrix, series, appearance, showNodeLabels = false, rotateNodeLabels = false, linkLabel, sort, sortSub, padAngle, clockwise, palette, geometry, legacySubSort = false, showScale = false }) {
|
|
19974
|
-
const [hoveredLink, setHoveredLink] = (0,
|
|
20052
|
+
const [hoveredLink, setHoveredLink] = (0, import_react83.useState)(null);
|
|
19975
20053
|
const layout = series ? chordMultiMatrixLayout(series.map((s) => s.matrix), { padAngle, clockwise, startAngle: geometry?.startAngle }) : chordMatrixLayout(matrix, { sort, sortSub, padAngle, clockwise, legacySubSort, startAngle: geometry?.startAngle }), cx = geometry?.center[0] ?? 360, cy = geometry?.center[1] ?? 182, r = geometry?.innerRadius ?? 108, outer = geometry?.outerRadius ?? 128;
|
|
19976
20054
|
const point = (angle) => [cx + Math.cos(angle) * r, cy + Math.sin(angle) * r];
|
|
19977
20055
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("g", { className: "sia-chart__matrix-chord", children: [
|
|
@@ -20318,13 +20396,13 @@ function transferRadarSeries(panels, source, target, connector = " & ") {
|
|
|
20318
20396
|
}
|
|
20319
20397
|
|
|
20320
20398
|
// src/components/ChartRoamGroup.tsx
|
|
20321
|
-
var
|
|
20399
|
+
var import_react84 = require("react");
|
|
20322
20400
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
20323
20401
|
var initial2 = { x: 0, y: 0, scale: 1 };
|
|
20324
20402
|
function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true, ariaLabel, resetSignal = 0 }) {
|
|
20325
|
-
const group = (0,
|
|
20326
|
-
const [view, setView] = (0,
|
|
20327
|
-
(0,
|
|
20403
|
+
const group = (0, import_react84.useRef)(null), drag = (0, import_react84.useRef)();
|
|
20404
|
+
const [view, setView] = (0, import_react84.useState)(initial2);
|
|
20405
|
+
(0, import_react84.useEffect)(() => {
|
|
20328
20406
|
setView(initial2);
|
|
20329
20407
|
drag.current = void 0;
|
|
20330
20408
|
}, [resetSignal]);
|
|
@@ -20334,7 +20412,7 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
|
|
|
20334
20412
|
const local = new DOMPoint(clientX, clientY).matrixTransform(matrix.inverse());
|
|
20335
20413
|
return [local.x, local.y];
|
|
20336
20414
|
};
|
|
20337
|
-
(0,
|
|
20415
|
+
(0, import_react84.useEffect)(() => {
|
|
20338
20416
|
const target = group.current;
|
|
20339
20417
|
if (!target || !enabled || !zoomEnabled) return;
|
|
20340
20418
|
const wheel = (event) => {
|
|
@@ -20395,11 +20473,11 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
|
|
|
20395
20473
|
}
|
|
20396
20474
|
|
|
20397
20475
|
// src/components/TreeNodeGlyph.tsx
|
|
20398
|
-
var
|
|
20476
|
+
var import_react85 = require("react");
|
|
20399
20477
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
20400
20478
|
function TreeNodeGlyph({ symbol = "circle", x, y, width, height, color, itemStyle }) {
|
|
20401
|
-
const [failed, setFailed] = (0,
|
|
20402
|
-
(0,
|
|
20479
|
+
const [failed, setFailed] = (0, import_react85.useState)(false);
|
|
20480
|
+
(0, import_react85.useEffect)(() => setFailed(false), [symbol]);
|
|
20403
20481
|
const style = { fill: itemStyle.brushType === "stroke" ? "none" : color, stroke: itemStyle.borderColor, strokeWidth: itemStyle.borderWidth };
|
|
20404
20482
|
if (symbol.startsWith("image://")) return failed ? /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("g", { role: "img", "aria-label": "\u539F\u59CB\u8282\u70B9\u56FE\u7247\u52A0\u8F7D\u5931\u8D25", children: [
|
|
20405
20483
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("rect", { x: x - width / 2, y: y - height / 2, width, height, fill: "none", stroke: "#999", strokeDasharray: "3 3" }),
|
|
@@ -20688,7 +20766,7 @@ function resolveMapRegionAppearance(base, datum, emphasized) {
|
|
|
20688
20766
|
}
|
|
20689
20767
|
|
|
20690
20768
|
// src/components/ChartBundledMapCanvas.tsx
|
|
20691
|
-
var
|
|
20769
|
+
var import_react86 = require("react");
|
|
20692
20770
|
|
|
20693
20771
|
// src/components/edgeBundling.ts
|
|
20694
20772
|
var distance = (a, b) => Math.hypot(a[0] - b[0], a[1] - b[1]);
|
|
@@ -20832,9 +20910,9 @@ function sampleBundledPath(curves, progress) {
|
|
|
20832
20910
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
20833
20911
|
function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "rgba(2,166,253,0.05)", opacity = 0.2, lineWidth = 0.5, pointColor = "rgba(255,0,0,0.5)", pointRadius = 1.5, effect, width, height }) {
|
|
20834
20912
|
const signature = JSON.stringify(edges), pointKey = JSON.stringify(points), effectKey = JSON.stringify(effect);
|
|
20835
|
-
const paths = (0,
|
|
20836
|
-
const base = (0,
|
|
20837
|
-
(0,
|
|
20913
|
+
const paths = (0, import_react86.useMemo)(() => bundleEdges(JSON.parse(signature)).map((row) => ({ index: row.index, curves: smoothBundledPath(row.points, smoothness) })), [signature, smoothness]);
|
|
20914
|
+
const base = (0, import_react86.useRef)(null), moving = (0, import_react86.useRef)(null);
|
|
20915
|
+
(0, import_react86.useEffect)(() => {
|
|
20838
20916
|
const node = base.current, ctx = node?.getContext("2d");
|
|
20839
20917
|
if (!node || !ctx) return;
|
|
20840
20918
|
const ratio = window.devicePixelRatio || 1;
|
|
@@ -20860,7 +20938,7 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
|
|
|
20860
20938
|
ctx.fill();
|
|
20861
20939
|
}
|
|
20862
20940
|
}, [paths, pointKey, width, height, color, opacity, lineWidth, pointColor, pointRadius]);
|
|
20863
|
-
(0,
|
|
20941
|
+
(0, import_react86.useEffect)(() => {
|
|
20864
20942
|
const node = moving.current, ctx = node?.getContext("2d");
|
|
20865
20943
|
if (!node || !ctx) return;
|
|
20866
20944
|
const ratio = window.devicePixelRatio || 1;
|
|
@@ -20922,11 +21000,11 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
|
|
|
20922
21000
|
}
|
|
20923
21001
|
|
|
20924
21002
|
// src/components/ChartMapEffectCanvas.tsx
|
|
20925
|
-
var
|
|
21003
|
+
var import_react87 = require("react");
|
|
20926
21004
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
20927
21005
|
function ChartMapEffectCanvas({ effects, width, height, alpha = 0.95 }) {
|
|
20928
|
-
const canvas = (0,
|
|
20929
|
-
(0,
|
|
21006
|
+
const canvas = (0, import_react87.useRef)(null), key = JSON.stringify(effects);
|
|
21007
|
+
(0, import_react87.useEffect)(() => {
|
|
20930
21008
|
const element = canvas.current;
|
|
20931
21009
|
if (!element) return;
|
|
20932
21010
|
const context = element.getContext("2d");
|
|
@@ -21072,12 +21150,12 @@ function layoutTreeNodes(root, options = {}) {
|
|
|
21072
21150
|
}
|
|
21073
21151
|
|
|
21074
21152
|
// src/components/ChartDataEditor.tsx
|
|
21075
|
-
var
|
|
21153
|
+
var import_react88 = require("react");
|
|
21076
21154
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
21077
21155
|
function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false }) {
|
|
21078
|
-
const [draft, setDraft] = (0,
|
|
21079
|
-
const [error, setError] = (0,
|
|
21080
|
-
const [applied, setApplied] = (0,
|
|
21156
|
+
const [draft, setDraft] = (0, import_react88.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
|
|
21157
|
+
const [error, setError] = (0, import_react88.useState)("");
|
|
21158
|
+
const [applied, setApplied] = (0, import_react88.useState)(false);
|
|
21081
21159
|
function apply() {
|
|
21082
21160
|
try {
|
|
21083
21161
|
const values = JSON.parse(draft);
|
|
@@ -21108,11 +21186,11 @@ function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false
|
|
|
21108
21186
|
}
|
|
21109
21187
|
|
|
21110
21188
|
// src/components/ChartBarStatistics.tsx
|
|
21111
|
-
var
|
|
21189
|
+
var import_react89 = require("react");
|
|
21112
21190
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
21113
21191
|
function ChartBarStatistics({ values, kinds, project, plot, horizontal, color, gradient, seriesName }) {
|
|
21114
|
-
const id = (0,
|
|
21115
|
-
const [active, setActive] = (0,
|
|
21192
|
+
const id = (0, import_react89.useId)().replaceAll(":", "");
|
|
21193
|
+
const [active, setActive] = (0, import_react89.useState)();
|
|
21116
21194
|
const paint = gradient ? `url(#${id})` : color;
|
|
21117
21195
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("g", { children: [
|
|
21118
21196
|
gradient ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("linearGradient", { id, gradientUnits: "userSpaceOnUse", x1: gradient.start[0], y1: gradient.start[1], x2: gradient.end[0], y2: gradient.end[1], children: gradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
|
|
@@ -21167,7 +21245,7 @@ function lineSegments(points) {
|
|
|
21167
21245
|
}
|
|
21168
21246
|
|
|
21169
21247
|
// src/components/useBarMagicState.ts
|
|
21170
|
-
var
|
|
21248
|
+
var import_react90 = require("react");
|
|
21171
21249
|
|
|
21172
21250
|
// src/components/cartesianMagicState.ts
|
|
21173
21251
|
function changeCartesianMagic(state, action) {
|
|
@@ -21182,8 +21260,8 @@ function changeCartesianMagic(state, action) {
|
|
|
21182
21260
|
function useBarMagicState(toolbox, shape = "bar") {
|
|
21183
21261
|
const initial3 = { shape, layout: "original" };
|
|
21184
21262
|
const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
|
|
21185
|
-
const [state, setState] = (0,
|
|
21186
|
-
(0,
|
|
21263
|
+
const [state, setState] = (0, import_react90.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
|
|
21264
|
+
(0, import_react90.useEffect)(() => {
|
|
21187
21265
|
if (options?.activeMagicType) setState((s) => changeCartesianMagic(s, options.activeMagicType));
|
|
21188
21266
|
}, [options?.activeMagicType]);
|
|
21189
21267
|
const resolved = options ? { ...options, activeMagicType: state.shape, activeMagicTypes: options.activeMagicTypes ?? (state.layout === "original" ? [state.shape] : [state.shape, state.layout]), onMagicTypeChange: (action) => {
|
|
@@ -21197,7 +21275,7 @@ function useBarMagicState(toolbox, shape = "bar") {
|
|
|
21197
21275
|
}
|
|
21198
21276
|
|
|
21199
21277
|
// src/components/useBarValueTransfer.ts
|
|
21200
|
-
var
|
|
21278
|
+
var import_react91 = require("react");
|
|
21201
21279
|
|
|
21202
21280
|
// src/components/barTransfer.ts
|
|
21203
21281
|
function transferBarValue(series, source, target, categories) {
|
|
@@ -21214,10 +21292,10 @@ function transferBarValue(series, source, target, categories) {
|
|
|
21214
21292
|
|
|
21215
21293
|
// src/components/useBarValueTransfer.ts
|
|
21216
21294
|
function useBarValueTransfer(series, initial3, categories, enabled, publish, onError) {
|
|
21217
|
-
const [islands, setIslands] = (0,
|
|
21218
|
-
const drag = (0,
|
|
21219
|
-
const [offset, setOffset] = (0,
|
|
21220
|
-
(0,
|
|
21295
|
+
const [islands, setIslands] = (0, import_react91.useState)([]);
|
|
21296
|
+
const drag = (0, import_react91.useRef)();
|
|
21297
|
+
const [offset, setOffset] = (0, import_react91.useState)();
|
|
21298
|
+
(0, import_react91.useEffect)(() => {
|
|
21221
21299
|
setIslands([]);
|
|
21222
21300
|
drag.current = void 0;
|
|
21223
21301
|
setOffset(void 0);
|
|
@@ -21318,12 +21396,12 @@ function logarithmicValueAt(progress, domain) {
|
|
|
21318
21396
|
|
|
21319
21397
|
// src/components/Charts.tsx
|
|
21320
21398
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
21321
|
-
var
|
|
21399
|
+
var import_react93 = require("react");
|
|
21322
21400
|
var PLOT = { x: 62, y: 48, width: 628, height: 250 };
|
|
21323
21401
|
var PLOT_BOTTOM = PLOT.y + PLOT.height;
|
|
21324
21402
|
function useLegendSelection(names, controlled, onChange) {
|
|
21325
|
-
const [internal, setInternal] = (0,
|
|
21326
|
-
(0,
|
|
21403
|
+
const [internal, setInternal] = (0, import_react92.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
|
|
21404
|
+
(0, import_react92.useEffect)(() => {
|
|
21327
21405
|
setInternal((current) => {
|
|
21328
21406
|
const next = { ...current };
|
|
21329
21407
|
names.forEach((name) => {
|
|
@@ -21423,7 +21501,7 @@ function lineSymbol(type, x, y, size, color, image, strokeWidth = 2) {
|
|
|
21423
21501
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("circle", { cx: x, cy: y, r: size / 2, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 });
|
|
21424
21502
|
}
|
|
21425
21503
|
function useZoom(value, defaultValue, onChange) {
|
|
21426
|
-
const [internal, setInternal] = (0,
|
|
21504
|
+
const [internal, setInternal] = (0, import_react92.useState)([...defaultValue ?? [0, 100]]);
|
|
21427
21505
|
const current = value ?? internal;
|
|
21428
21506
|
const update = (next) => {
|
|
21429
21507
|
if (!value) setInternal(next);
|
|
@@ -21433,8 +21511,8 @@ function useZoom(value, defaultValue, onChange) {
|
|
|
21433
21511
|
}
|
|
21434
21512
|
function useToolboxMagicType(toolbox, fallback) {
|
|
21435
21513
|
const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
|
|
21436
|
-
const [internal, setInternal] = (0,
|
|
21437
|
-
(0,
|
|
21514
|
+
const [internal, setInternal] = (0, import_react92.useState)(options?.activeMagicType ?? fallback);
|
|
21515
|
+
(0, import_react92.useEffect)(() => {
|
|
21438
21516
|
if (options?.activeMagicType) setInternal(options.activeMagicType);
|
|
21439
21517
|
}, [options?.activeMagicType]);
|
|
21440
21518
|
const active = options?.activeMagicType ?? internal;
|
|
@@ -21452,15 +21530,15 @@ function useToolboxMagicType(toolbox, fallback) {
|
|
|
21452
21530
|
} : toolbox;
|
|
21453
21531
|
return [active, resolved];
|
|
21454
21532
|
}
|
|
21455
|
-
var LineChart = (0,
|
|
21456
|
-
const [hoverIndex, setHoverIndex] = (0,
|
|
21457
|
-
const [editableSeries, setEditableSeries] = (0,
|
|
21458
|
-
const [dragPoint, setDragPoint] = (0,
|
|
21459
|
-
const linePaintId = (0,
|
|
21460
|
-
const [hoveredLinePoint, setHoveredLinePoint] = (0,
|
|
21461
|
-
(0,
|
|
21533
|
+
var LineChart = (0, import_react92.forwardRef)(function LineChart2({ calculableMode = "resize", onTransferError, grid, valueTransfer: externalValueTransfer, categories, series: sourceSeries, appearance = "sia", categoryLabelInterval = 0, boundaryGap = false, showCategorySplitLine = true, categoryAxisName, valueAxisName, legendLayout, logBase = 10, logExponentStep = 1, animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, stacked = false, orientation = "vertical", xAxisType = "category", valueAxisType = "value", valueAxisInverse = false, tooltipTrigger = "item", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, dataZoom = false, zoomIndexMode = "points", zoomPosition = "bottom", zoomControlBounds, zoomPan = false, zoomSelectionShape = "band", zoomSelectionStyle, zoomMinSelectionSize, calculable = false, zoom, defaultZoom, onZoomChange, onDataChange, palette, toolbox, ...props }, ref) {
|
|
21534
|
+
const [hoverIndex, setHoverIndex] = (0, import_react92.useState)(null);
|
|
21535
|
+
const [editableSeries, setEditableSeries] = (0, import_react92.useState)(sourceSeries);
|
|
21536
|
+
const [dragPoint, setDragPoint] = (0, import_react92.useState)(null);
|
|
21537
|
+
const linePaintId = (0, import_react92.useId)().replaceAll(":", "");
|
|
21538
|
+
const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react92.useState)();
|
|
21539
|
+
(0, import_react92.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
|
|
21462
21540
|
const series = externalValueTransfer ? sourceSeries : editableSeries;
|
|
21463
|
-
const initialTransferSeries = (0,
|
|
21541
|
+
const initialTransferSeries = (0, import_react92.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
|
|
21464
21542
|
const localTransfer = useBarValueTransfer(series.map((item) => ({ ...item, data: item.data.map(lineValue) })), initialTransferSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (nextBars) => {
|
|
21465
21543
|
const next = series.map((item, row) => ({ ...item, data: item.data.map((datum, index) => {
|
|
21466
21544
|
const value = barDatum(nextBars[row].data[index]).value;
|
|
@@ -21477,8 +21555,8 @@ var LineChart = (0, import_react91.forwardRef)(function LineChart2({ calculableM
|
|
|
21477
21555
|
const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
21478
21556
|
const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
|
|
21479
21557
|
const inlineZoom = dataZoom && zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("foreignObject", { className: "sia-chart__inline-zoom sia-chart__inline-zoom--compact", ...withTitleTooltip(zoomControlBounds), children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartDataZoom, { handleLabels: [categories[Math.min(categories.length - 1, Math.floor(Math.min(...zoomValue) / 100 * categories.length))] ?? "", categories[Math.max(0, Math.ceil(Math.max(...zoomValue) / 100 * categories.length) - 1)] ?? ""], shadowBounds: zoomControlBounds, panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), onChange: setZoomValue }) }) : null;
|
|
21480
|
-
const [zoomBrushActive, setZoomBrushActive] = (0,
|
|
21481
|
-
const [zoomHistory, setZoomHistory] = (0,
|
|
21558
|
+
const [zoomBrushActive, setZoomBrushActive] = (0, import_react92.useState)(false);
|
|
21559
|
+
const [zoomHistory, setZoomHistory] = (0, import_react92.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
|
|
21482
21560
|
const zoomBrush = dataZoom && zoomBrushActive ? { minSelectionSize: zoomMinSelectionSize, selectionStyle: zoomSelectionStyle, selectionShape: zoomSelectionShape, bounds: PLOT2, onCancel: () => setZoomBrushActive(false), onSelect: (range) => {
|
|
21483
21561
|
const start = Math.min(...zoomValue), span = Math.max(...zoomValue) - start;
|
|
21484
21562
|
const next = [start + range[0] * span, start + range[1] * span];
|
|
@@ -21865,17 +21943,17 @@ function ChartPin({ point, color, label }) {
|
|
|
21865
21943
|
function barDatum(datum) {
|
|
21866
21944
|
return typeof datum === "number" ? { value: datum } : datum;
|
|
21867
21945
|
}
|
|
21868
|
-
var BarChart = (0,
|
|
21869
|
-
const [editableSeries, setEditableSeries] = (0,
|
|
21870
|
-
const [dragBar, setDragBar] = (0,
|
|
21871
|
-
const [hoveredBar, setHoveredBar] = (0,
|
|
21872
|
-
const barPaintId = (0,
|
|
21946
|
+
var BarChart = (0, import_react92.forwardRef)(function BarChart2({ valueTransfer: externalValueTransfer, calculableMode = "resize", onTransferError, categories, series: sourceSeries, appearance = "sia", animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, grid, valueAxisPosition = "bottom", showValueAxis = true, showCategoryAxis = true, showCategorySplitLine = false, tooltipTrigger = "item", tooltipFormatter, stacked = false, orientation = "vertical", minBarSize = 1, calculable = false, onDataChange, showLegend = true, legendOrder, legendLayout, barCategoryGap = 0.2, valuePadding = 0, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
|
|
21947
|
+
const [editableSeries, setEditableSeries] = (0, import_react92.useState)(sourceSeries);
|
|
21948
|
+
const [dragBar, setDragBar] = (0, import_react92.useState)(null);
|
|
21949
|
+
const [hoveredBar, setHoveredBar] = (0, import_react92.useState)();
|
|
21950
|
+
const barPaintId = (0, import_react92.useId)().replaceAll(":", "");
|
|
21873
21951
|
const localTransfer = useBarValueTransfer(editableSeries, sourceSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (next) => {
|
|
21874
21952
|
setEditableSeries(next);
|
|
21875
21953
|
onDataChange?.(next);
|
|
21876
21954
|
}, onTransferError);
|
|
21877
21955
|
const transfer = externalValueTransfer ?? localTransfer;
|
|
21878
|
-
(0,
|
|
21956
|
+
(0, import_react92.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
|
|
21879
21957
|
const series = externalValueTransfer ? sourceSeries : editableSeries;
|
|
21880
21958
|
const legacy = appearance === "macarons";
|
|
21881
21959
|
const PLOT2 = legacy ? { x: grid?.left ?? 80, y: grid?.top ?? 60, width: (props.viewBoxSize?.[0] ?? 720) - (grid?.left ?? 80) - (grid?.right ?? 80), height: (props.viewBoxSize?.[1] ?? 360) - (grid?.top ?? 60) - (grid?.bottom ?? 70) } : { x: 62, y: 48, width: 628, height: 250 };
|
|
@@ -22122,17 +22200,17 @@ var BarChart = (0, import_react91.forwardRef)(function BarChart2({ valueTransfer
|
|
|
22122
22200
|
] }, `bar-island-${index}`)) : null
|
|
22123
22201
|
] });
|
|
22124
22202
|
});
|
|
22125
|
-
var ScatterChart = (0,
|
|
22126
|
-
const [data, setData] = (0,
|
|
22127
|
-
const [emphasizedPoint, setEmphasizedPoint] = (0,
|
|
22128
|
-
const [emphasizedAnnotation, setEmphasizedAnnotation] = (0,
|
|
22129
|
-
(0,
|
|
22203
|
+
var ScatterChart = (0, import_react92.forwardRef)(function ScatterChart2({ symbolAnimation = false, animationProgress, animationDurationUpdate = 500, statisticPoints = [], statisticLines = [], annotations = [], data: initialData, toolbox, showXAxis = true, showXSplitLine = true, showYSplitLine = true, tooltipFormatter, plotBounds, xDomain: fixedXDomain, yDomain: fixedYDomain, showPointLabels = false, yAxisPosition = "left", xCategories, xFormatter, crosshair = false, markColor, xSplitNumber = 5, ySplitNumber = 5, symbolSize, markAppearance = "label", markByCategory = false, xUnit = "", yUnit = "", minSymbolRadius = 5, xLabel, yLabel, xAxisType = "value", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, dataZoom = false, zoom, defaultZoom, onZoomChange, visualMap, markAverage, markExtremes = false, largeThreshold = 1200, onDataClick, palette, ...props }, ref) {
|
|
22204
|
+
const [data, setData] = (0, import_react92.useState)(initialData);
|
|
22205
|
+
const [emphasizedPoint, setEmphasizedPoint] = (0, import_react92.useState)(null);
|
|
22206
|
+
const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react92.useState)();
|
|
22207
|
+
(0, import_react92.useEffect)(() => setData(initialData), [initialData]);
|
|
22130
22208
|
const plot = plotBounds ?? PLOT, bottom = plot.y + plot.height;
|
|
22131
22209
|
const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
|
|
22132
22210
|
const allCategories = [...new Set(data.map((item) => item.category).filter((value) => Boolean(value)))];
|
|
22133
22211
|
const legend = useLegendSelection(allCategories, legendSelected, onLegendSelectionChange);
|
|
22134
22212
|
const activeData = data.filter((item) => !item.category || legend.isSelected(item.category));
|
|
22135
|
-
const sorted = (0,
|
|
22213
|
+
const sorted = (0, import_react92.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
|
|
22136
22214
|
const startIndex = dataZoom ? Math.floor(Math.min(...zoomValue) / 100 * Math.max(0, sorted.length - 1)) : 0;
|
|
22137
22215
|
const endIndex = dataZoom ? Math.max(startIndex + 1, Math.ceil(Math.max(...zoomValue) / 100 * sorted.length)) : sorted.length;
|
|
22138
22216
|
const categoryWindow = xCategories ? scatterCategoryWindow(xCategories, dataZoom ? zoomValue : [0, 100]) : void 0;
|
|
@@ -22147,10 +22225,10 @@ var ScatterChart = (0, import_react91.forwardRef)(function ScatterChart2({ symbo
|
|
|
22147
22225
|
const visualMinimum = visualMap?.min ?? (visualValues.length ? Math.min(...visualValues) : 0);
|
|
22148
22226
|
const visualMaximum = visualMap?.max ?? (visualValues.length ? Math.max(...visualValues) : 1);
|
|
22149
22227
|
const visualColors = visualMap?.colors ?? ["#e6f4ff", "#1677ff"];
|
|
22150
|
-
const [selectedPieces, setSelectedPieces] = (0,
|
|
22151
|
-
const [visualRange, setVisualRange] = (0,
|
|
22228
|
+
const [selectedPieces, setSelectedPieces] = (0, import_react92.useState)([]);
|
|
22229
|
+
const [visualRange, setVisualRange] = (0, import_react92.useState)();
|
|
22152
22230
|
const piecesKey = JSON.stringify(visualMap?.pieces ?? []);
|
|
22153
|
-
(0,
|
|
22231
|
+
(0, import_react92.useEffect)(() => setSelectedPieces([]), [piecesKey]);
|
|
22154
22232
|
const statistics = scatterStatistics(visibleData, markByCategory);
|
|
22155
22233
|
const plotted = visibleData.map((item, index) => {
|
|
22156
22234
|
const x = linearScale(categoryWindow ? categoryWindow.indexOf(item.x) : item.x, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]);
|
|
@@ -22308,8 +22386,8 @@ var ScatterChart = (0, import_react91.forwardRef)(function ScatterChart2({ symbo
|
|
|
22308
22386
|
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartDataZoom, { value: zoomValue, onChange: setZoomValue })
|
|
22309
22387
|
] }) : content;
|
|
22310
22388
|
});
|
|
22311
|
-
var CandlestickChart = (0,
|
|
22312
|
-
const [data, setData] = (0,
|
|
22389
|
+
var CandlestickChart = (0, import_react92.forwardRef)(function CandlestickChart2({ showAxes = true, data: initialData, valueDomain, axisLabelFormatter, activeIndex, onActiveIndexChange, seriesVisible: controlledVisible, onSeriesVisibilityChange, showLegend = true, showCategoryLabels = true, plotBounds, markPoints, seriesName, risingBorderColor, fallingBorderColor, borderWidth = 2, risingEmphasisColor, fallingEmphasisColor, maxBarWidth = 34, appearance = "sia", risingColor = "#f5222d", fallingColor = "#52c41a", hollowRising = false, dataZoom = false, zoom, defaultZoom, onZoomChange, markExtremes = false, onDataClick, toolbox, ...props }, ref) {
|
|
22390
|
+
const [data, setData] = (0, import_react92.useState)(initialData), [internalActive, setInternalActive] = (0, import_react92.useState)(null), [internalVisible, setInternalVisible] = (0, import_react92.useState)(true);
|
|
22313
22391
|
const active = activeIndex === void 0 ? internalActive : activeIndex;
|
|
22314
22392
|
const seriesVisible = controlledVisible ?? internalVisible;
|
|
22315
22393
|
const setActive = (index) => {
|
|
@@ -22320,7 +22398,7 @@ var CandlestickChart = (0, import_react91.forwardRef)(function CandlestickChart2
|
|
|
22320
22398
|
if (controlledVisible === void 0) setInternalVisible(visible);
|
|
22321
22399
|
onSeriesVisibilityChange?.(visible);
|
|
22322
22400
|
};
|
|
22323
|
-
(0,
|
|
22401
|
+
(0, import_react92.useEffect)(() => {
|
|
22324
22402
|
setData(initialData);
|
|
22325
22403
|
}, [initialData]);
|
|
22326
22404
|
const legacy = appearance === "macarons";
|
|
@@ -22411,20 +22489,20 @@ var CandlestickChart = (0, import_react91.forwardRef)(function CandlestickChart2
|
|
|
22411
22489
|
] }) : content;
|
|
22412
22490
|
});
|
|
22413
22491
|
var EMPTY_PIE_DATA = [];
|
|
22414
|
-
var PieChart = (0,
|
|
22415
|
-
const pieGradientId = (0,
|
|
22416
|
-
const [pieIslands, setPieIslands] = (0,
|
|
22417
|
-
const sourceRings = (0,
|
|
22418
|
-
const [editableRings, setEditableRings] = (0,
|
|
22419
|
-
const valueDrag = (0,
|
|
22420
|
-
const [valueOffset, setValueOffset] = (0,
|
|
22421
|
-
(0,
|
|
22492
|
+
var PieChart = (0, import_react92.forwardRef)(function PieChart2({ pulseRing, calculable = false, markPoints = [], data = EMPTY_PIE_DATA, series, innerRadius = 62, outerRadius = 124, rose = false, center = [360, 173], startAngle = -90, clockwise = true, padAngle = 0, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, showLabels = true, showLabelLines = true, centerLabel, selectedMode = false, selected, defaultSelected, selectedOffset = 9, onSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, animationDurationUpdate = 500, legendLayout, showGuideRings = false, onDataChange, transferId, onValueTransfer, onTransferError, onValueDragOut, outsideLabelLayout, ...props }, ref) {
|
|
22493
|
+
const pieGradientId = (0, import_react92.useId)().replace(/:/g, "");
|
|
22494
|
+
const [pieIslands, setPieIslands] = (0, import_react92.useState)([]);
|
|
22495
|
+
const sourceRings = (0, import_react92.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
|
|
22496
|
+
const [editableRings, setEditableRings] = (0, import_react92.useState)(sourceRings);
|
|
22497
|
+
const valueDrag = (0, import_react92.useRef)(null);
|
|
22498
|
+
const [valueOffset, setValueOffset] = (0, import_react92.useState)();
|
|
22499
|
+
(0, import_react92.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
|
|
22422
22500
|
const allData = editableRings.flatMap((ring) => ring.data).filter((item) => !item.missing);
|
|
22423
22501
|
const names = [...new Set(allData.map((item) => item.name))];
|
|
22424
22502
|
const legend = useLegendSelection(names, legendSelected, onLegendSelectionChange);
|
|
22425
22503
|
const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u997C\u56FE");
|
|
22426
|
-
const [hovered, setHovered] = (0,
|
|
22427
|
-
const [internalSelected, setInternalSelected] = (0,
|
|
22504
|
+
const [hovered, setHovered] = (0, import_react92.useState)();
|
|
22505
|
+
const [internalSelected, setInternalSelected] = (0, import_react92.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
|
|
22428
22506
|
const selectedNames = selected ?? internalSelected;
|
|
22429
22507
|
const legacy = appearance === "macarons";
|
|
22430
22508
|
const colorNames = [...new Set(allData.filter((item) => item.showInLegend !== false).map((item) => item.name))];
|
|
@@ -22644,15 +22722,15 @@ var PieChart = (0, import_react91.forwardRef)(function PieChart2({ pulseRing, ca
|
|
|
22644
22722
|
});
|
|
22645
22723
|
var EMPTY_RADAR_INDICATORS = [];
|
|
22646
22724
|
var EMPTY_RADAR_SERIES = [];
|
|
22647
|
-
var RadarChart = (0,
|
|
22725
|
+
var RadarChart = (0, import_react92.forwardRef)(function RadarChart2({ indicators = EMPTY_RADAR_INDICATORS, series = EMPTY_RADAR_SERIES, radars, calculable = false, onTransferError, markers, levels = 5, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
|
|
22648
22726
|
const legacy = appearance === "macarons";
|
|
22649
|
-
const initialPanels = (0,
|
|
22650
|
-
const [sourcePanels, setSourcePanels] = (0,
|
|
22651
|
-
const [hoveredRadar, setHoveredRadar] = (0,
|
|
22652
|
-
const radarPaintId = `sia-radar-${(0,
|
|
22653
|
-
const radarDrag = (0,
|
|
22654
|
-
const [radarOffset, setRadarOffset] = (0,
|
|
22655
|
-
(0,
|
|
22727
|
+
const initialPanels = (0, import_react92.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
|
|
22728
|
+
const [sourcePanels, setSourcePanels] = (0, import_react92.useState)(initialPanels);
|
|
22729
|
+
const [hoveredRadar, setHoveredRadar] = (0, import_react92.useState)(null);
|
|
22730
|
+
const radarPaintId = `sia-radar-${(0, import_react92.useId)().replaceAll(":", "")}`;
|
|
22731
|
+
const radarDrag = (0, import_react92.useRef)(null);
|
|
22732
|
+
const [radarOffset, setRadarOffset] = (0, import_react92.useState)(null);
|
|
22733
|
+
(0, import_react92.useEffect)(() => {
|
|
22656
22734
|
setSourcePanels(initialPanels);
|
|
22657
22735
|
radarDrag.current = null;
|
|
22658
22736
|
setRadarOffset(null);
|
|
@@ -22806,7 +22884,7 @@ var RadarChart = (0, import_react91.forwardRef)(function RadarChart2({ indicator
|
|
|
22806
22884
|
})
|
|
22807
22885
|
] });
|
|
22808
22886
|
});
|
|
22809
|
-
var ChordChart = (0,
|
|
22887
|
+
var ChordChart = (0, import_react92.forwardRef)(function ChordChart2({ nodes, links, nodeGeometry, matrixAppearance, matrix, matrixSeries, showNodeLabels = false, rotateNodeLabels = false, matrixLinkLabel, matrixGeometry, legacySubSort = false, showScale = false, sortSub = "none", padAngle = 0.035, ribbon = true, clockwise = true, sort = "none", onNodeClick, onLinkClick, palette, toolbox, ...props }, ref) {
|
|
22810
22888
|
const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u548C\u5F26");
|
|
22811
22889
|
if (/force|力导向|关系/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
22812
22890
|
GraphChart,
|
|
@@ -22879,11 +22957,11 @@ var ChordChart = (0, import_react91.forwardRef)(function ChordChart2({ nodes, li
|
|
|
22879
22957
|
})
|
|
22880
22958
|
] });
|
|
22881
22959
|
});
|
|
22882
|
-
var GraphChart = (0,
|
|
22960
|
+
var GraphChart = (0, import_react92.forwardRef)(function GraphChart2({ nodes, links, roam = false, chordOptions, forceOptions, progressiveForce = false, layout = "circular", showLabels = true, draggable = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onNodeClick, palette, toolbox, ...props }, ref) {
|
|
22883
22961
|
const categories = [...new Set(nodes.map((node) => node.category).filter((value) => Boolean(value)))];
|
|
22884
22962
|
const legend = useLegendSelection(categories, legendSelected, onLegendSelectionChange);
|
|
22885
22963
|
const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, layout === "force" ? "\u529B\u5BFC\u5411" : "\u5173\u7CFB");
|
|
22886
|
-
const [roamReset, setRoamReset] = (0,
|
|
22964
|
+
const [roamReset, setRoamReset] = (0, import_react92.useState)(0);
|
|
22887
22965
|
const chartToolbox = typeof resolvedToolbox === "object" ? {
|
|
22888
22966
|
...resolvedToolbox,
|
|
22889
22967
|
onRestore: () => {
|
|
@@ -22892,23 +22970,23 @@ var GraphChart = (0, import_react91.forwardRef)(function GraphChart2({ nodes, li
|
|
|
22892
22970
|
resolvedToolbox.onRestore?.();
|
|
22893
22971
|
}
|
|
22894
22972
|
} : resolvedToolbox;
|
|
22895
|
-
const activeNodes = (0,
|
|
22896
|
-
const activeLinks = (0,
|
|
22973
|
+
const activeNodes = (0, import_react92.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
|
|
22974
|
+
const activeLinks = (0, import_react92.useMemo)(() => {
|
|
22897
22975
|
const activeIds = new Set(activeNodes.map((node) => node.id));
|
|
22898
22976
|
return links.filter((link) => activeIds.has(link.source) && activeIds.has(link.target));
|
|
22899
22977
|
}, [activeNodes, links]);
|
|
22900
22978
|
const progressive = progressiveForce && layout === "force" && props.animation !== false && !/chord|和弦/i.test(magicType);
|
|
22901
|
-
const calculatedPositions = (0,
|
|
22902
|
-
const [positions, setPositions] = (0,
|
|
22903
|
-
const [dragging, setDragging] = (0,
|
|
22904
|
-
const heldNode = (0,
|
|
22905
|
-
const [forceRestart, setForceRestart] = (0,
|
|
22906
|
-
(0,
|
|
22979
|
+
const calculatedPositions = (0, import_react92.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
|
|
22980
|
+
const [positions, setPositions] = (0, import_react92.useState)(calculatedPositions);
|
|
22981
|
+
const [dragging, setDragging] = (0, import_react92.useState)(null);
|
|
22982
|
+
const heldNode = (0, import_react92.useRef)(null);
|
|
22983
|
+
const [forceRestart, setForceRestart] = (0, import_react92.useState)(0);
|
|
22984
|
+
(0, import_react92.useEffect)(() => {
|
|
22907
22985
|
setPositions(calculatedPositions);
|
|
22908
22986
|
setDragging(null);
|
|
22909
22987
|
heldNode.current = null;
|
|
22910
22988
|
}, [calculatedPositions, roamReset]);
|
|
22911
|
-
(0,
|
|
22989
|
+
(0, import_react92.useEffect)(() => {
|
|
22912
22990
|
if (!progressive || activeNodes.length > (forceOptions?.maxNodes ?? 80)) return;
|
|
22913
22991
|
let frame = 0, remaining = Math.max(0, forceOptions?.iterations ?? 140), previous, carry = 0;
|
|
22914
22992
|
const tick = (time) => {
|
|
@@ -23026,7 +23104,7 @@ var GraphChart = (0, import_react91.forwardRef)(function GraphChart2({ nodes, li
|
|
|
23026
23104
|
] })
|
|
23027
23105
|
] });
|
|
23028
23106
|
});
|
|
23029
|
-
var ForceGraphChart = (0,
|
|
23107
|
+
var ForceGraphChart = (0, import_react92.forwardRef)(function ForceGraphChart2(props, ref) {
|
|
23030
23108
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(GraphChart, { ...props, layout: "force", ref });
|
|
23031
23109
|
});
|
|
23032
23110
|
var ForceChart = ForceGraphChart;
|
|
@@ -23055,12 +23133,12 @@ function colorBetween(start, end, ratio) {
|
|
|
23055
23133
|
const to = read(end);
|
|
23056
23134
|
return `rgb(${from.map((value, index) => Math.round(value + ((to[index] ?? value) - value) * Math.max(0, Math.min(1, ratio)))).join(" ")})`;
|
|
23057
23135
|
}
|
|
23058
|
-
var MapChart = (0,
|
|
23059
|
-
const [internalSelected, setInternalSelected] = (0,
|
|
23136
|
+
var MapChart = (0, import_react92.forwardRef)(function MapChart2({ overlayProjection, bundledLines, largeMarkPoints, markLineEffectRenderer = "svg", insetStyle, insetLabelStyle, regionHoverable = true, markPointTooltipFormatter, emphasisValueRange, onRegionHover, coordinateTransform, specialAreas, labelCoordinates, labelOffsets, nameMap, wheelZoomFactors, clampVisualValues = false, showMap = true, visualMapLayout, labelStyle, emphasisLabelStyle, regionStyle, emphasisRegionStyle, outOfRangeColor, scaleLimit, roamController = false, map, geoJson, data, colors = ["#e6f4ff", "#1677ff"], nameProperty = "name", showLabels = true, showEmphasisLabels = false, tooltipFormatter, roam = false, selectedMode = false, selected, defaultSelected, onSelectionChange, calculableVisualMap = false, visualRange, defaultVisualRange, onVisualRangeChange, markPoints = [], markLines = [], onRegionClick, toolbox, plotBounds: sourcePlotBounds, longitudeRatio, geographicInsets = [], valueDomain, showVisualMap = true, seriesName, ...props }, ref) {
|
|
23137
|
+
const [internalSelected, setInternalSelected] = (0, import_react92.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
|
|
23060
23138
|
const selectedNames = selected ?? internalSelected;
|
|
23061
|
-
const [hoveredRegion, setHoveredRegion] = (0,
|
|
23062
|
-
const [hoveredMarkPoint, setHoveredMarkPoint] = (0,
|
|
23063
|
-
const [internalHoveredValueRange, setHoveredValueRange] = (0,
|
|
23139
|
+
const [hoveredRegion, setHoveredRegion] = (0, import_react92.useState)();
|
|
23140
|
+
const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react92.useState)();
|
|
23141
|
+
const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react92.useState)();
|
|
23064
23142
|
const hoveredValueRange = emphasisValueRange ?? internalHoveredValueRange;
|
|
23065
23143
|
const roamControl = useMapRoam(roam, scaleLimit, wheelZoomFactors);
|
|
23066
23144
|
const { view } = roamControl;
|
|
@@ -23075,8 +23153,8 @@ var MapChart = (0, import_react91.forwardRef)(function MapChart2({ overlayProjec
|
|
|
23075
23153
|
const values = data.map((item) => item.value);
|
|
23076
23154
|
const minimum = valueDomain?.[0] ?? (values.length ? Math.min(...values) : 0);
|
|
23077
23155
|
const maximum = valueDomain?.[1] ?? (values.length ? Math.max(...values) : 1);
|
|
23078
|
-
const [internalVisualRange, setInternalVisualRange] = (0,
|
|
23079
|
-
(0,
|
|
23156
|
+
const [internalVisualRange, setInternalVisualRange] = (0, import_react92.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
|
|
23157
|
+
(0, import_react92.useEffect)(() => {
|
|
23080
23158
|
if (!visualRange && !defaultVisualRange) setInternalVisualRange([minimum, maximum]);
|
|
23081
23159
|
}, [defaultVisualRange, maximum, minimum, visualRange]);
|
|
23082
23160
|
const currentVisualRange = visualRange ?? internalVisualRange;
|
|
@@ -23252,7 +23330,7 @@ var MapChart = (0, import_react91.forwardRef)(function MapChart2({ overlayProjec
|
|
|
23252
23330
|
roamController ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartRoamController, { x: (props.viewBoxSize?.[0] ?? 720) - 90, y: 5, onPan: roamControl.pan, onZoom: (factor) => roamControl.zoom(factor, [(props.viewBoxSize?.[0] ?? 720) / 2, (props.viewBoxSize?.[1] ?? 360) / 2]) }) : null
|
|
23253
23331
|
] });
|
|
23254
23332
|
});
|
|
23255
|
-
var GaugeChart = (0,
|
|
23333
|
+
var GaugeChart = (0, import_react92.forwardRef)(function GaugeChart2({ tooltipFormatter, data, min = 0, max = 100, startAngle = 210, endAngle = -30, segments, splitNumber = 10, showAxisLabels = true, showProgress = true, detailOffset = 84, valueFormatter, onDataClick, palette, appearance = "sia", animationProgress, ...props }, ref) {
|
|
23256
23334
|
const count = Math.max(1, data.length);
|
|
23257
23335
|
const legacy = appearance === "macarons";
|
|
23258
23336
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, empty: !data.length, ariaLabel: props.ariaLabel ?? "\u4EEA\u8868\u76D8", children: [...data].sort((a, b) => (a.zIndex ?? 0) - (b.zIndex ?? 0)).map((item, index) => {
|
|
@@ -23335,12 +23413,12 @@ var GaugeChart = (0, import_react91.forwardRef)(function GaugeChart2({ tooltipFo
|
|
|
23335
23413
|
] }, `${item.name}-${index}`);
|
|
23336
23414
|
}) });
|
|
23337
23415
|
});
|
|
23338
|
-
var FunnelChart = (0,
|
|
23416
|
+
var FunnelChart = (0, import_react92.forwardRef)(function FunnelChart2({ data = EMPTY_PIE_DATA, series, sort = "descending", gap = 4, align = "center", orientation = "vertical", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
|
|
23339
23417
|
const legacy = appearance === "macarons";
|
|
23340
|
-
const [activeFunnel, setActiveFunnel] = (0,
|
|
23341
|
-
const initialFunnels = (0,
|
|
23342
|
-
const [sourceFunnels, setSourceFunnels] = (0,
|
|
23343
|
-
(0,
|
|
23418
|
+
const [activeFunnel, setActiveFunnel] = (0, import_react92.useState)(null);
|
|
23419
|
+
const initialFunnels = (0, import_react92.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
|
|
23420
|
+
const [sourceFunnels, setSourceFunnels] = (0, import_react92.useState)(initialFunnels);
|
|
23421
|
+
(0, import_react92.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
|
|
23344
23422
|
const allData = sourceFunnels.flatMap((funnel) => funnel.data);
|
|
23345
23423
|
const legendData = [...new Map(allData.map((item) => [item.name, item])).values()];
|
|
23346
23424
|
const legend = useLegendSelection(legendData.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
@@ -23431,7 +23509,7 @@ var FunnelChart = (0, import_react91.forwardRef)(function FunnelChart2({ data =
|
|
|
23431
23509
|
})
|
|
23432
23510
|
] });
|
|
23433
23511
|
});
|
|
23434
|
-
var HeatmapChart = (0,
|
|
23512
|
+
var HeatmapChart = (0, import_react92.forwardRef)(function HeatmapChart2({ raster, xLabels = [], yLabels = [], data = [], points = [], colors = ["#e6f4ff", "#1677ff"], showValues = false, pointRadius = 30, blur = 16, minAlpha = 0.12, maxAlpha = 0.82, valueFormatter, onDataClick, ...props }, ref) {
|
|
23435
23513
|
const pointMode = points.length > 0;
|
|
23436
23514
|
const values = pointMode ? points.map((point) => point.value) : data.flatMap((row) => [...row]);
|
|
23437
23515
|
const minimum = values.length ? Math.min(...values) : 0;
|
|
@@ -23440,7 +23518,7 @@ var HeatmapChart = (0, import_react91.forwardRef)(function HeatmapChart2({ raste
|
|
|
23440
23518
|
const cellHeight = PLOT.height / Math.max(1, yLabels.length);
|
|
23441
23519
|
const pointXDomain = niceChartDomain(points.map((point) => point.x), false);
|
|
23442
23520
|
const pointYDomain = niceChartDomain(points.map((point) => point.y), false);
|
|
23443
|
-
const filterId = `sia-heat-${(0,
|
|
23521
|
+
const filterId = `sia-heat-${(0, import_react92.useId)().replaceAll(":", "")}`;
|
|
23444
23522
|
if (raster) return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(SiaChart, { ...props, ref, empty: !points.length, ariaLabel: props.ariaLabel ?? "\u50CF\u7D20\u70ED\u529B\u56FE", children: [
|
|
23445
23523
|
raster.backgroundImage ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("image", { href: raster.backgroundImage, x: 0, y: 0, width: raster.width, height: raster.height, preserveAspectRatio: "none", pointerEvents: "none" }) : null,
|
|
23446
23524
|
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(HeatmapRaster, { width: raster.width, height: raster.height, points, options: raster })
|
|
@@ -23476,7 +23554,7 @@ var HeatmapChart = (0, import_react91.forwardRef)(function HeatmapChart2({ raste
|
|
|
23476
23554
|
] })
|
|
23477
23555
|
] });
|
|
23478
23556
|
});
|
|
23479
|
-
var ThemeRiverChart = (0,
|
|
23557
|
+
var ThemeRiverChart = (0, import_react92.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
|
|
23480
23558
|
const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
23481
23559
|
const activeSeries = series.filter((item) => legend.isSelected(item.name));
|
|
23482
23560
|
const totals = categories.map((_, index) => activeSeries.reduce((sum, item) => sum + Math.max(0, item.data[index] ?? 0), 0));
|
|
@@ -23514,8 +23592,8 @@ function eventTime(value) {
|
|
|
23514
23592
|
if (typeof value === "number") return value;
|
|
23515
23593
|
return Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(value) ? value.replace(/-/g, "/") : value);
|
|
23516
23594
|
}
|
|
23517
|
-
var EventRiverChart = (0,
|
|
23518
|
-
const [restoreVersion, setRestoreVersion] = (0,
|
|
23595
|
+
var EventRiverChart = (0, import_react92.forwardRef)(function EventRiverChart2({ series, showLabels = true, draggable = true, appearance = "sia", plot = PLOT, animationProgress, boundaryGap = [0.05, 0.1], legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
|
|
23596
|
+
const [restoreVersion, setRestoreVersion] = (0, import_react92.useState)(0);
|
|
23519
23597
|
const area = plot;
|
|
23520
23598
|
palette = palette ?? (appearance === "macarons" ? ["#2ec7c9", "#b6a2de"] : void 0);
|
|
23521
23599
|
const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
@@ -23588,9 +23666,9 @@ function vennDistance(radiusA, radiusB, overlap) {
|
|
|
23588
23666
|
}
|
|
23589
23667
|
return (low + high) / 2;
|
|
23590
23668
|
}
|
|
23591
|
-
var VennChart = (0,
|
|
23592
|
-
const [sets, setSets] = (0,
|
|
23593
|
-
(0,
|
|
23669
|
+
var VennChart = (0, import_react92.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
|
|
23670
|
+
const [sets, setSets] = (0, import_react92.useState)(initialSets), [intersection, setIntersection] = (0, import_react92.useState)(initialIntersection), [active, setActive] = (0, import_react92.useState)();
|
|
23671
|
+
(0, import_react92.useEffect)(() => {
|
|
23594
23672
|
setSets(initialSets);
|
|
23595
23673
|
setIntersection(initialIntersection);
|
|
23596
23674
|
}, [initialSets, initialIntersection]);
|
|
@@ -23653,17 +23731,17 @@ function layoutTreemap(nodes, x, y, width, height, gap, maxDepth, depth = 0, see
|
|
|
23653
23731
|
});
|
|
23654
23732
|
return result;
|
|
23655
23733
|
}
|
|
23656
|
-
var TreemapChart = (0,
|
|
23657
|
-
const [path, setPath] = (0,
|
|
23658
|
-
const [sourceData, setSourceData] = (0,
|
|
23659
|
-
const [active, setActive] = (0,
|
|
23660
|
-
(0,
|
|
23734
|
+
var TreemapChart = (0, import_react92.forwardRef)(function TreemapChart2({ data, gap = 4, maxDepth = 2, drilldown = false, showBreadcrumb = true, bounds, itemStyle, emphasis, cornerRadius = 5, showChildBoundaries = false, breadcrumbPosition = "top", breadcrumbRootName = "\u5168\u90E8", valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
|
|
23735
|
+
const [path, setPath] = (0, import_react92.useState)([]);
|
|
23736
|
+
const [sourceData, setSourceData] = (0, import_react92.useState)(data);
|
|
23737
|
+
const [active, setActive] = (0, import_react92.useState)();
|
|
23738
|
+
(0, import_react92.useEffect)(() => {
|
|
23661
23739
|
setSourceData(data);
|
|
23662
23740
|
setPath([]);
|
|
23663
23741
|
}, [data]);
|
|
23664
23742
|
const currentData = path.reduce((nodes, name) => nodes.find((node) => node.name === name)?.children ?? nodes, sourceData);
|
|
23665
23743
|
const top = drilldown && showBreadcrumb ? 52 : 28;
|
|
23666
|
-
const rectangles = (0,
|
|
23744
|
+
const rectangles = (0, import_react92.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
|
|
23667
23745
|
const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: currentData.map((node) => ({ name: node.name, data: [treemapValue(node)] })), onApply: (values) => {
|
|
23668
23746
|
const update = (nodes, depth) => nodes.map((node, i) => depth === path.length ? { ...node, value: values[i][0] } : node.name === path[depth] ? { ...node, children: update(node.children ?? [], depth + 1) } : node);
|
|
23669
23747
|
setSourceData(update(sourceData, 0));
|
|
@@ -23731,15 +23809,15 @@ function flattenTree2(root, collapsed) {
|
|
|
23731
23809
|
visit(root, 0);
|
|
23732
23810
|
return { nodes, leafCount: Math.max(1, leafOrder), maxDepth: Math.max(0, ...nodes.map((item) => item.depth)) };
|
|
23733
23811
|
}
|
|
23734
|
-
var TreeChart = (0,
|
|
23735
|
-
const [sourceData, setSourceData] = (0,
|
|
23736
|
-
const [roamReset, setRoamReset] = (0,
|
|
23737
|
-
const [active, setActive] = (0,
|
|
23738
|
-
(0,
|
|
23812
|
+
var TreeChart = (0, import_react92.forwardRef)(function TreeChart2({ data, itemStyle, emphasis, orientation = "horizontal", radial = false, nodeSize = 8, rootPosition, nodePadding, layerPadding, showLabels = true, emphasisShowLabels = true, nodeColor, edgeColor, edgeWidth, edgeShadow, roam = false, hoverable = true, labelFontSize, labelColor, linkStyle = "curve", collapsible = false, onToggle, onDataClick, palette, toolbox, ...props }, ref) {
|
|
23813
|
+
const [sourceData, setSourceData] = (0, import_react92.useState)(data);
|
|
23814
|
+
const [roamReset, setRoamReset] = (0, import_react92.useState)(0);
|
|
23815
|
+
const [active, setActive] = (0, import_react92.useState)();
|
|
23816
|
+
(0, import_react92.useEffect)(() => {
|
|
23739
23817
|
setSourceData(data);
|
|
23740
23818
|
setActive(void 0);
|
|
23741
23819
|
}, [data]);
|
|
23742
|
-
const [collapsed, setCollapsed] = (0,
|
|
23820
|
+
const [collapsed, setCollapsed] = (0, import_react92.useState)(() => {
|
|
23743
23821
|
const result = /* @__PURE__ */ new Set();
|
|
23744
23822
|
const visit = (node) => {
|
|
23745
23823
|
if (node.collapsed) result.add(node.name);
|
|
@@ -23748,8 +23826,8 @@ var TreeChart = (0, import_react91.forwardRef)(function TreeChart2({ data, itemS
|
|
|
23748
23826
|
visit(data);
|
|
23749
23827
|
return result;
|
|
23750
23828
|
});
|
|
23751
|
-
const layout = (0,
|
|
23752
|
-
const fixedLayout = (0,
|
|
23829
|
+
const layout = (0, import_react92.useMemo)(() => flattenTree2(sourceData, collapsed), [collapsed, sourceData]);
|
|
23830
|
+
const fixedLayout = (0, import_react92.useMemo)(() => {
|
|
23753
23831
|
const visible = (node) => ({ ...node, children: collapsed.has(node.name) ? [] : node.children?.map(visible) });
|
|
23754
23832
|
return rootPosition ? layoutTreeNodes(visible(sourceData), { nodeSize, nodePadding, layerPadding, rootPosition, orientation }) : void 0;
|
|
23755
23833
|
}, [sourceData, collapsed, rootPosition, nodeSize, nodePadding, layerPadding, orientation]);
|
|
@@ -23819,15 +23897,15 @@ var TreeChart = (0, import_react91.forwardRef)(function TreeChart2({ data, itemS
|
|
|
23819
23897
|
})
|
|
23820
23898
|
] }) });
|
|
23821
23899
|
});
|
|
23822
|
-
var WordCloudChart = (0,
|
|
23823
|
-
const placements = (0,
|
|
23900
|
+
var WordCloudChart = (0, import_react92.forwardRef)(function WordCloudChart2({ data, bounds, areaSizing = false, autoFit = false, onLayout, minFontSize = 14, maxFontSize = 52, rotations = [0, 0, -28, 28, 0], spiralStep = 9, shape = "ellipse", padding = 4, fontFamily, fontWeight = 650, onDataClick, palette, ...props }, ref) {
|
|
23901
|
+
const placements = (0, import_react92.useMemo)(() => {
|
|
23824
23902
|
const context = typeof document === "undefined" ? null : document.createElement("canvas").getContext("2d");
|
|
23825
23903
|
return layoutCloudWords(data, { bounds: bounds ?? { x: 18, y: 18, width: 684, height: 324 }, minFontSize, maxFontSize, rotations, spiralStep, shape, padding, autoFit, areaSizing, measure: context ? (word, size) => {
|
|
23826
23904
|
context.font = `${word.fontWeight ?? fontWeight} ${size}px ${word.fontFamily ?? fontFamily ?? "Arial"}`;
|
|
23827
23905
|
return context.measureText(word.name).width;
|
|
23828
23906
|
} : void 0 });
|
|
23829
23907
|
}, [data, bounds, autoFit, areaSizing, maxFontSize, minFontSize, padding, rotations, shape, spiralStep, fontFamily, fontWeight]);
|
|
23830
|
-
(0,
|
|
23908
|
+
(0, import_react92.useEffect)(() => {
|
|
23831
23909
|
const present = new Set(placements.map((p) => p.index));
|
|
23832
23910
|
onLayout?.({ placed: placements.length, unplaced: data.filter((_, i) => !present.has(i)).map((item) => item.name) });
|
|
23833
23911
|
}, [placements, data, onLayout]);
|
|
@@ -23836,30 +23914,30 @@ var WordCloudChart = (0, import_react91.forwardRef)(function WordCloudChart2({ d
|
|
|
23836
23914
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartMark, { label: `${placement.item.name}\uFF0C${placement.item.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name: placement.item.name, value: placement.item.value }), tooltipPoint: [placement.x, placement.y], transform: `rotate(${placement.rotation} ${placement.x} ${placement.y})`, onPointerUp: (event) => onDataClick?.({ name: placement.item.name, value: placement.item.value, data: placement.item, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("text", { x: placement.x, y: placement.y + placement.fontSize * 0.34, textAnchor: "middle", fill: color, style: { fontSize: placement.fontSize, fontFamily: placement.item.fontFamily ?? fontFamily, fontWeight: placement.item.fontWeight ?? fontWeight }, className: "sia-chart__word", children: placement.item.name }) }, `${placement.item.name}-${placement.index}`);
|
|
23837
23915
|
}) });
|
|
23838
23916
|
});
|
|
23839
|
-
var MixedChart = (0,
|
|
23840
|
-
const plotClipId = `sia-mixed-plot-${(0,
|
|
23841
|
-
const [editableSeries, setEditableSeries] = (0,
|
|
23842
|
-
const [geometry, setGeometry] = (0,
|
|
23843
|
-
const [pointerIndex, setPointerIndex] = (0,
|
|
23844
|
-
const [pointerAxisIndex, setPointerAxisIndex] = (0,
|
|
23845
|
-
const [motionRevision, setMotionRevision] = (0,
|
|
23846
|
-
const [stackMode, setStackMode] = (0,
|
|
23847
|
-
const lastPublished = (0,
|
|
23917
|
+
var MixedChart = (0, import_react92.forwardRef)(function MixedChart2({ axisPointer, categoryAxisLabels, axisLayering = "inline", barSpacing, renderAxes, coordinateAnimation = false, animationProgress, animationDurationUpdate = 500, boundaryGap = true, categories, activeIndex, onActiveIndexChange, showCategoryLabels = true, categoryLabelInterval = 0, clipPlot = false, series: sourceSeries, valueAxes, stacked: sourceStacked = false, plotBounds, tooltipTrigger = "item", calculable = false, onTransferError, onDataChange, transferId, onValueTransfer, toolbox, legendNames, axisTooltipFormatter, legendLayout, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, ...props }, ref) {
|
|
23918
|
+
const plotClipId = `sia-mixed-plot-${(0, import_react92.useId)().replaceAll(":", "")}`;
|
|
23919
|
+
const [editableSeries, setEditableSeries] = (0, import_react92.useState)(sourceSeries);
|
|
23920
|
+
const [geometry, setGeometry] = (0, import_react92.useState)();
|
|
23921
|
+
const [pointerIndex, setPointerIndex] = (0, import_react92.useState)(null);
|
|
23922
|
+
const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react92.useState)(0);
|
|
23923
|
+
const [motionRevision, setMotionRevision] = (0, import_react92.useState)(0);
|
|
23924
|
+
const [stackMode, setStackMode] = (0, import_react92.useState)();
|
|
23925
|
+
const lastPublished = (0, import_react92.useRef)(null);
|
|
23848
23926
|
const publishData = (next) => {
|
|
23849
23927
|
lastPublished.current = next;
|
|
23850
23928
|
onDataChange?.(next);
|
|
23851
23929
|
};
|
|
23852
|
-
const [islands, setIslands] = (0,
|
|
23853
|
-
const drag = (0,
|
|
23854
|
-
const [dragOffset, setDragOffset] = (0,
|
|
23855
|
-
(0,
|
|
23930
|
+
const [islands, setIslands] = (0, import_react92.useState)([]);
|
|
23931
|
+
const drag = (0, import_react92.useRef)(null);
|
|
23932
|
+
const [dragOffset, setDragOffset] = (0, import_react92.useState)();
|
|
23933
|
+
(0, import_react92.useEffect)(() => {
|
|
23856
23934
|
if (sourceSeries === lastPublished.current) return;
|
|
23857
23935
|
setEditableSeries(sourceSeries);
|
|
23858
23936
|
setIslands([]);
|
|
23859
23937
|
drag.current = null;
|
|
23860
23938
|
setDragOffset(void 0);
|
|
23861
23939
|
}, [sourceSeries]);
|
|
23862
|
-
const series = (0,
|
|
23940
|
+
const series = (0, import_react92.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
|
|
23863
23941
|
const stacked = stackMode ?? sourceStacked;
|
|
23864
23942
|
const PLOT2 = plotBounds ?? { x: 62, y: 48, width: 628, height: 250 }, PLOT_BOTTOM2 = PLOT2.y + PLOT2.height;
|
|
23865
23943
|
const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
@@ -24023,7 +24101,7 @@ var MixedChart = (0, import_react91.forwardRef)(function MixedChart2({ axisPoint
|
|
|
24023
24101
|
})
|
|
24024
24102
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(CartesianAxes, { categories, domain, band: categoryGap }),
|
|
24025
24103
|
activeIndex != null && activeIndex >= 0 && activeIndex < categories.length ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { "data-mixed-active-index": activeIndex, x: Math.max(PLOT2.x, categoryAt(activeIndex) - band / 2), y: PLOT2.y, width: Math.min(PLOT2.x + PLOT2.width, categoryAt(activeIndex) + band / 2) - Math.max(PLOT2.x, categoryAt(activeIndex) - band / 2), height: PLOT2.height, fill: "currentColor", opacity: 0.06, pointerEvents: "none" }) : null,
|
|
24026
|
-
tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0,
|
|
24104
|
+
tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react93.createElement)(ChartMark, { ...activeProps(index), key: `axis-${index}`, "data-mixed-axis-tooltip": index, label: `${name.trim()} \u5404\u6307\u6807`, tooltip: axisTooltip(index), tooltipPoint: [categoryAt(index), PLOT2.y + PLOT2.height / 2] }, /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { x: Math.max(PLOT2.x, categoryAt(index) - band / 2), y: PLOT2.y, width: Math.min(PLOT2.x + PLOT2.width, categoryAt(index) + band / 2) - Math.max(PLOT2.x, categoryAt(index) - band / 2), height: PLOT2.height, fill: "transparent" }))) : null,
|
|
24027
24105
|
calculable ? activeSeries.flatMap((item) => item.data.map((value, index) => value === null ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartMark, { ...dragProps(series.indexOf(item), index), label: `${item.name}\uFF0C${categories[index]}\uFF0C\u7A7A\u69FD`, tooltip: "\u62D6\u5165\u6570\u636E\u4EE5\u586B\u5145", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { x: PLOT2.x + index * band + band * activeSeries.indexOf(item) / Math.max(1, activeSeries.length), y: PLOT_BOTTOM2 - 14, width: Math.max(4, band / Math.max(1, activeSeries.length) - 2), height: 14, fill: "transparent", stroke: getColor(series.indexOf(item), item.color, palette), strokeDasharray: "3 2" }) }, `empty-${item.name}-${index}`) : null)) : null,
|
|
24028
24106
|
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("clipPath", { id: plotClipId, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { x: PLOT2.x, y: PLOT2.y, width: PLOT2.width, height: PLOT2.height }) }) }),
|
|
24029
24107
|
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("g", { "data-mixed-plot": "", clipPath: clipPlot ? `url(#${plotClipId})` : void 0, children: renderSeries.map((item) => {
|
|
@@ -24062,7 +24140,7 @@ var MixedChart = (0, import_react91.forwardRef)(function MixedChart2({ axisPoint
|
|
|
24062
24140
|
const zero = linearScale(placement.start, [valueDomain[0], valueDomain[1]], [PLOT_BOTTOM2, PLOT2.y]);
|
|
24063
24141
|
const rectY = barSpacing?.pixelAlign ? Math.floor(Math.min(y, zero)) : Math.min(y, zero);
|
|
24064
24142
|
const rectHeight = barSpacing?.pixelAlign ? Math.ceil(Math.abs(zero - y)) : Math.abs(zero - y);
|
|
24065
|
-
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartPointMotion, { points: [[x, value >= 0 ? rectY + rectHeight : rectY], [x, rectY], [x + width, rectY + rectHeight]], enabled: coordinateAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: coordinateAnimation ? animationProgress : void 0, children: (frame) => /* @__PURE__ */ (0,
|
|
24143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartPointMotion, { points: [[x, value >= 0 ? rectY + rectHeight : rectY], [x, rectY], [x + width, rectY + rectHeight]], enabled: coordinateAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: coordinateAnimation ? animationProgress : void 0, children: (frame) => /* @__PURE__ */ (0, import_react93.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
|
|
24066
24144
|
if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
|
|
24067
24145
|
} }, /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { style: { animation: coordinateAnimation ? "none" : void 0 }, x: frame[1][0], y: Math.min(frame[1][1], frame[2][1]), width: Math.max(0, frame[2][0] - frame[1][0]), height: Math.abs(frame[2][1] - frame[1][1]), rx: item.barRadius ?? 4, fill: item.pointColors?.[index] ?? color, className: "sia-chart__bar" })) }, `${item.name}-${index}-${motionRevision}`);
|
|
24068
24146
|
})
|
|
@@ -24091,7 +24169,7 @@ var MixedChart = (0, import_react91.forwardRef)(function MixedChart2({ axisPoint
|
|
|
24091
24169
|
if (!placements[index]) return null;
|
|
24092
24170
|
const name = categoryName(index, item.categoryAxisIndex);
|
|
24093
24171
|
const value = item.data[index] ?? 0;
|
|
24094
|
-
return /* @__PURE__ */ (0,
|
|
24172
|
+
return /* @__PURE__ */ (0, import_react93.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
|
|
24095
24173
|
if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
|
|
24096
24174
|
} }, /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("circle", { className: item.hollowSymbol ? "sia-chart__mixed-hollow-symbol" : void 0, cx: point[0], cy: point[1], r: Math.max(0, item.symbolSize ?? 9) / 2, fill: item.hollowSymbol ? "#fff" : color, stroke: item.hollowSymbol ? color : "var(--sia-color-surface)", strokeWidth: 2 }));
|
|
24097
24175
|
})
|
|
@@ -24132,9 +24210,9 @@ var KLineChart = CandlestickChart;
|
|
|
24132
24210
|
|
|
24133
24211
|
// src/components/LineShareChart.tsx
|
|
24134
24212
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
24135
|
-
var LineShareChart = (0,
|
|
24136
|
-
const [selected, setSelected] = (0,
|
|
24137
|
-
const [maskHovered, setMaskHovered] = (0,
|
|
24213
|
+
var LineShareChart = (0, import_react94.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
|
|
24214
|
+
const [selected, setSelected] = (0, import_react94.useState)(null);
|
|
24215
|
+
const [maskHovered, setMaskHovered] = (0, import_react94.useState)(false);
|
|
24138
24216
|
const width = props.viewBoxSize?.[0] ?? 900, height = props.viewBoxSize?.[1] ?? 450;
|
|
24139
24217
|
const total = data.reduce((sum, item2) => sum + item2.value, 0), gap = data.length ? Math.round(Math.max(...data.map((item2) => item2.value)) - Math.min(...data.map((item2) => item2.value))) : 0;
|
|
24140
24218
|
const maximum = data.reduce((best, item2, i) => item2.value >= data[best].value ? i : best, 0);
|
|
@@ -24212,16 +24290,16 @@ function paddedValueExtent(values, padding = 0.05) {
|
|
|
24212
24290
|
}
|
|
24213
24291
|
|
|
24214
24292
|
// src/components/XYChart.tsx
|
|
24215
|
-
var
|
|
24293
|
+
var import_react95 = require("react");
|
|
24216
24294
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
24217
|
-
var XYChart = (0,
|
|
24218
|
-
const [series, setSeries] = (0,
|
|
24219
|
-
const [hidden, setHidden] = (0,
|
|
24220
|
-
const [crosshair, setCrosshair] = (0,
|
|
24221
|
-
const [drag, setDrag] = (0,
|
|
24222
|
-
const [geometry, setGeometry] = (0,
|
|
24223
|
-
const [zoom, setZoom] = (0,
|
|
24224
|
-
(0,
|
|
24295
|
+
var XYChart = (0, import_react95.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
|
|
24296
|
+
const [series, setSeries] = (0, import_react95.useState)(source);
|
|
24297
|
+
const [hidden, setHidden] = (0, import_react95.useState)([]);
|
|
24298
|
+
const [crosshair, setCrosshair] = (0, import_react95.useState)();
|
|
24299
|
+
const [drag, setDrag] = (0, import_react95.useState)();
|
|
24300
|
+
const [geometry, setGeometry] = (0, import_react95.useState)();
|
|
24301
|
+
const [zoom, setZoom] = (0, import_react95.useState)(defaultZoom);
|
|
24302
|
+
(0, import_react95.useEffect)(() => setSeries(source), [source]);
|
|
24225
24303
|
const window2 = dataZoom || xAxisType === "time" ? scatterValueWindow(series.flatMap((item) => item.data.map((point) => point[0])), dataZoom ? zoom : [0, 100]) : void 0;
|
|
24226
24304
|
const active = series.filter((item) => !hidden.includes(item.name)).map((item) => ({ ...item, data: window2 ? item.data.filter((point) => point[0] >= window2[0] && point[0] <= window2[1]) : item.data }));
|
|
24227
24305
|
const width = props.viewBoxSize?.[0] ?? 663, height = props.viewBoxSize?.[1] ?? 379;
|
|
@@ -24350,7 +24428,7 @@ var XYChart = (0, import_react94.forwardRef)(function XYChart2({ series: source,
|
|
|
24350
24428
|
});
|
|
24351
24429
|
|
|
24352
24430
|
// src/components/ChartMapOverlay.tsx
|
|
24353
|
-
var
|
|
24431
|
+
var import_react96 = require("react");
|
|
24354
24432
|
|
|
24355
24433
|
// src/components/mapOverlayHost.ts
|
|
24356
24434
|
function observeMapOverlayHost(host, onChange) {
|
|
@@ -24389,11 +24467,11 @@ function observeMapOverlayHost(host, onChange) {
|
|
|
24389
24467
|
// src/components/ChartMapOverlay.tsx
|
|
24390
24468
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
24391
24469
|
function ChartMapOverlay({ createHost, children, className, style, ariaLabel = "\u5730\u56FE\u53E0\u52A0\u56FE\u8868", onError }) {
|
|
24392
|
-
const container = (0,
|
|
24393
|
-
const errorHandler = (0,
|
|
24470
|
+
const container = (0, import_react96.useRef)(null);
|
|
24471
|
+
const errorHandler = (0, import_react96.useRef)(onError);
|
|
24394
24472
|
errorHandler.current = onError;
|
|
24395
|
-
const [snapshot, setSnapshot] = (0,
|
|
24396
|
-
(0,
|
|
24473
|
+
const [snapshot, setSnapshot] = (0, import_react96.useState)();
|
|
24474
|
+
(0, import_react96.useEffect)(() => {
|
|
24397
24475
|
setSnapshot(void 0);
|
|
24398
24476
|
if (!container.current) return;
|
|
24399
24477
|
try {
|
|
@@ -24470,9 +24548,9 @@ function createBaiduMapHost(element, sdk, options) {
|
|
|
24470
24548
|
}
|
|
24471
24549
|
|
|
24472
24550
|
// src/components/InputSelect.tsx
|
|
24473
|
-
var
|
|
24551
|
+
var import_react97 = require("react");
|
|
24474
24552
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
24475
|
-
var InputSelect = (0,
|
|
24553
|
+
var InputSelect = (0, import_react97.forwardRef)(function InputSelect2({
|
|
24476
24554
|
options,
|
|
24477
24555
|
value,
|
|
24478
24556
|
defaultValue,
|
|
@@ -24498,22 +24576,22 @@ var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
|
|
|
24498
24576
|
...inputProps
|
|
24499
24577
|
}, forwardedRef) {
|
|
24500
24578
|
const size = useControlSize(sizeProp);
|
|
24501
|
-
const [internal, setInternal] = (0,
|
|
24579
|
+
const [internal, setInternal] = (0, import_react97.useState)(defaultValue);
|
|
24502
24580
|
const current = value !== void 0 ? value : internal;
|
|
24503
24581
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|
|
24504
24582
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
24505
|
-
const [draft, setDraft] = (0,
|
|
24506
|
-
(0,
|
|
24583
|
+
const [draft, setDraft] = (0, import_react97.useState)(text);
|
|
24584
|
+
(0, import_react97.useEffect)(() => {
|
|
24507
24585
|
setDraft(text);
|
|
24508
24586
|
}, [text, current]);
|
|
24509
|
-
const [open, setOpen] = (0,
|
|
24510
|
-
const [search, setSearch] = (0,
|
|
24511
|
-
const [modalOpen, setModalOpen] = (0,
|
|
24512
|
-
const [modalValues, setModalValues] = (0,
|
|
24513
|
-
const [selectedOnly, setSelectedOnly] = (0,
|
|
24514
|
-
const rootRef = (0,
|
|
24515
|
-
const popupRef = (0,
|
|
24516
|
-
const inputRef = (0,
|
|
24587
|
+
const [open, setOpen] = (0, import_react97.useState)(false);
|
|
24588
|
+
const [search, setSearch] = (0, import_react97.useState)("");
|
|
24589
|
+
const [modalOpen, setModalOpen] = (0, import_react97.useState)(false);
|
|
24590
|
+
const [modalValues, setModalValues] = (0, import_react97.useState)([]);
|
|
24591
|
+
const [selectedOnly, setSelectedOnly] = (0, import_react97.useState)(false);
|
|
24592
|
+
const rootRef = (0, import_react97.useRef)(null);
|
|
24593
|
+
const popupRef = (0, import_react97.useRef)(null);
|
|
24594
|
+
const inputRef = (0, import_react97.useRef)(null);
|
|
24517
24595
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
24518
24596
|
function changeOpen(next) {
|
|
24519
24597
|
if (next && (disabled || loading)) return;
|
|
@@ -24533,7 +24611,7 @@ var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
|
|
|
24533
24611
|
inputRef.current?.focus();
|
|
24534
24612
|
}
|
|
24535
24613
|
}
|
|
24536
|
-
(0,
|
|
24614
|
+
(0, import_react97.useEffect)(() => {
|
|
24537
24615
|
if (!open) return;
|
|
24538
24616
|
const outside = (event) => {
|
|
24539
24617
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -24541,7 +24619,7 @@ var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
|
|
|
24541
24619
|
document.addEventListener("pointerdown", outside);
|
|
24542
24620
|
return () => document.removeEventListener("pointerdown", outside);
|
|
24543
24621
|
}, [open, onOpenChange]);
|
|
24544
|
-
(0,
|
|
24622
|
+
(0, import_react97.useEffect)(() => {
|
|
24545
24623
|
if (disabled || loading) {
|
|
24546
24624
|
changeOpen(false);
|
|
24547
24625
|
setModalOpen(false);
|
|
@@ -24674,13 +24752,13 @@ var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
|
|
|
24674
24752
|
});
|
|
24675
24753
|
|
|
24676
24754
|
// src/components/QueryForm.tsx
|
|
24677
|
-
var
|
|
24755
|
+
var import_react100 = require("react");
|
|
24678
24756
|
|
|
24679
24757
|
// src/components/QueryFormSettings.tsx
|
|
24680
|
-
var
|
|
24758
|
+
var import_react99 = require("react");
|
|
24681
24759
|
|
|
24682
24760
|
// src/components/useQueryFieldSort.ts
|
|
24683
|
-
var
|
|
24761
|
+
var import_react98 = require("react");
|
|
24684
24762
|
function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
24685
24763
|
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
24686
24764
|
const rest = keys.map((_, index) => index).filter((index) => index !== from);
|
|
@@ -24699,13 +24777,13 @@ function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
|
24699
24777
|
return { ordered, offsets };
|
|
24700
24778
|
}
|
|
24701
24779
|
function useQueryFieldSort(keys, enabled, onCommit) {
|
|
24702
|
-
const listRef = (0,
|
|
24703
|
-
const cancelRef = (0,
|
|
24704
|
-
const commitRef = (0,
|
|
24780
|
+
const listRef = (0, import_react98.useRef)(null);
|
|
24781
|
+
const cancelRef = (0, import_react98.useRef)();
|
|
24782
|
+
const commitRef = (0, import_react98.useRef)(onCommit);
|
|
24705
24783
|
commitRef.current = onCommit;
|
|
24706
|
-
const [preview, setPreview] = (0,
|
|
24784
|
+
const [preview, setPreview] = (0, import_react98.useState)();
|
|
24707
24785
|
const signature = JSON.stringify(keys);
|
|
24708
|
-
(0,
|
|
24786
|
+
(0, import_react98.useEffect)(() => {
|
|
24709
24787
|
cancelRef.current?.();
|
|
24710
24788
|
return () => cancelRef.current?.();
|
|
24711
24789
|
}, [enabled, signature]);
|
|
@@ -24830,16 +24908,16 @@ function countQueryFieldRows(centers) {
|
|
|
24830
24908
|
// src/components/QueryFormSettings.tsx
|
|
24831
24909
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
24832
24910
|
function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
|
|
24833
|
-
const [snapshot, setSnapshot] = (0,
|
|
24834
|
-
const [draft, setDraft] = (0,
|
|
24835
|
-
const [open, setOpen] = (0,
|
|
24836
|
-
const [loading, setLoading] = (0,
|
|
24837
|
-
const [saving, setSaving] = (0,
|
|
24838
|
-
const [error, setError] = (0,
|
|
24839
|
-
const [loadFailed, setLoadFailed] = (0,
|
|
24840
|
-
const token = (0,
|
|
24841
|
-
const saveLock = (0,
|
|
24842
|
-
const latest = (0,
|
|
24911
|
+
const [snapshot, setSnapshot] = (0, import_react99.useState)();
|
|
24912
|
+
const [draft, setDraft] = (0, import_react99.useState)({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
|
|
24913
|
+
const [open, setOpen] = (0, import_react99.useState)(false);
|
|
24914
|
+
const [loading, setLoading] = (0, import_react99.useState)(false);
|
|
24915
|
+
const [saving, setSaving] = (0, import_react99.useState)(false);
|
|
24916
|
+
const [error, setError] = (0, import_react99.useState)("");
|
|
24917
|
+
const [loadFailed, setLoadFailed] = (0, import_react99.useState)(false);
|
|
24918
|
+
const token = (0, import_react99.useRef)(0);
|
|
24919
|
+
const saveLock = (0, import_react99.useRef)(false);
|
|
24920
|
+
const latest = (0, import_react99.useRef)({ config, fields, defaultCollapsed, applyCollapsed });
|
|
24843
24921
|
latest.current = { config, fields, defaultCollapsed, applyCollapsed };
|
|
24844
24922
|
const moduleName = config?.scope.moduleName;
|
|
24845
24923
|
const businessKey = config?.scope.businessKey;
|
|
@@ -24867,7 +24945,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
24867
24945
|
if (request === token.current) setLoading(false);
|
|
24868
24946
|
}
|
|
24869
24947
|
}
|
|
24870
|
-
(0,
|
|
24948
|
+
(0, import_react99.useEffect)(() => {
|
|
24871
24949
|
setSnapshot(void 0);
|
|
24872
24950
|
setOpen(false);
|
|
24873
24951
|
setError("");
|
|
@@ -25025,27 +25103,27 @@ function QueryForm({
|
|
|
25025
25103
|
...formProps
|
|
25026
25104
|
}) {
|
|
25027
25105
|
const [form] = useForm(providedForm);
|
|
25028
|
-
const [internalCollapsed, setInternalCollapsed] = (0,
|
|
25029
|
-
const [expandedRows, setExpandedRows] = (0,
|
|
25030
|
-
const [needsCollapse, setNeedsCollapse] = (0,
|
|
25106
|
+
const [internalCollapsed, setInternalCollapsed] = (0, import_react100.useState)(defaultCollapsed);
|
|
25107
|
+
const [expandedRows, setExpandedRows] = (0, import_react100.useState)(0);
|
|
25108
|
+
const [needsCollapse, setNeedsCollapse] = (0, import_react100.useState)(false);
|
|
25031
25109
|
const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed ?? expandedRows >= 3);
|
|
25032
|
-
const [searching, setSearching] = (0,
|
|
25033
|
-
const [saving, setSaving] = (0,
|
|
25034
|
-
const [removing, setRemoving] = (0,
|
|
25035
|
-
const [saveOpen, setSaveOpen] = (0,
|
|
25036
|
-
const [saveName, setSaveName] = (0,
|
|
25037
|
-
const [saveError, setSaveError] = (0,
|
|
25038
|
-
const [error, setError] = (0,
|
|
25039
|
-
const [activeShortcut, setActiveShortcut] = (0,
|
|
25040
|
-
const source = (0,
|
|
25041
|
-
const searchLock = (0,
|
|
25042
|
-
const saveLock = (0,
|
|
25043
|
-
const removeLock = (0,
|
|
25044
|
-
const snapshot = (0,
|
|
25110
|
+
const [searching, setSearching] = (0, import_react100.useState)(false);
|
|
25111
|
+
const [saving, setSaving] = (0, import_react100.useState)(false);
|
|
25112
|
+
const [removing, setRemoving] = (0, import_react100.useState)(false);
|
|
25113
|
+
const [saveOpen, setSaveOpen] = (0, import_react100.useState)(false);
|
|
25114
|
+
const [saveName, setSaveName] = (0, import_react100.useState)("");
|
|
25115
|
+
const [saveError, setSaveError] = (0, import_react100.useState)("");
|
|
25116
|
+
const [error, setError] = (0, import_react100.useState)("");
|
|
25117
|
+
const [activeShortcut, setActiveShortcut] = (0, import_react100.useState)("");
|
|
25118
|
+
const source = (0, import_react100.useRef)({ source: "submit" });
|
|
25119
|
+
const searchLock = (0, import_react100.useRef)(false);
|
|
25120
|
+
const saveLock = (0, import_react100.useRef)(false);
|
|
25121
|
+
const removeLock = (0, import_react100.useRef)(false);
|
|
25122
|
+
const snapshot = (0, import_react100.useRef)();
|
|
25045
25123
|
const busy = disabled || loading || searching;
|
|
25046
25124
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
25047
25125
|
const fieldLabel = (content) => {
|
|
25048
|
-
if (!(0,
|
|
25126
|
+
if (!(0, import_react100.isValidElement)(content)) return void 0;
|
|
25049
25127
|
return content.props.label ?? content.props.placeholder ?? fieldLabel(content.props.children);
|
|
25050
25128
|
};
|
|
25051
25129
|
const sourceEntries = fields ? fields.map(({ key, width, settingsLabel, settingsHideDisabled, ...item }) => ({
|
|
@@ -25054,8 +25132,8 @@ function QueryForm({
|
|
|
25054
25132
|
hideDisabled: settingsHideDisabled,
|
|
25055
25133
|
label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
|
|
25056
25134
|
content: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Form.Item, { noStyle: true, ...item })
|
|
25057
|
-
})) :
|
|
25058
|
-
key: (0,
|
|
25135
|
+
})) : import_react100.Children.toArray(children).map((content, index) => ({
|
|
25136
|
+
key: (0, import_react100.isValidElement)(content) && content.key != null ? String(content.key) : String(index),
|
|
25059
25137
|
width: void 0,
|
|
25060
25138
|
hideDisabled: false,
|
|
25061
25139
|
label: fieldLabel(content) ?? `\u6761\u4EF6 ${index + 1}`,
|
|
@@ -25068,12 +25146,12 @@ function QueryForm({
|
|
|
25068
25146
|
const entries = configured.map((item) => ({ ...entriesByKey.get(item.key), visible: item.visible, visibleIndex: item.visible ? visibleIndex++ : -1 }));
|
|
25069
25147
|
const layoutKey = JSON.stringify(configured);
|
|
25070
25148
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
25071
|
-
const rowRef = (0,
|
|
25072
|
-
const actionsRef = (0,
|
|
25073
|
-
const toggleRef = (0,
|
|
25074
|
-
const [fittingCount, setFittingCount] = (0,
|
|
25075
|
-
const [settingsRows, setSettingsRows] = (0,
|
|
25076
|
-
(0,
|
|
25149
|
+
const rowRef = (0, import_react100.useRef)(null);
|
|
25150
|
+
const actionsRef = (0, import_react100.useRef)(null);
|
|
25151
|
+
const toggleRef = (0, import_react100.useRef)(null);
|
|
25152
|
+
const [fittingCount, setFittingCount] = (0, import_react100.useState)(limit);
|
|
25153
|
+
const [settingsRows, setSettingsRows] = (0, import_react100.useState)(0);
|
|
25154
|
+
(0, import_react100.useLayoutEffect)(() => {
|
|
25077
25155
|
const row = rowRef.current;
|
|
25078
25156
|
const actions = actionsRef.current;
|
|
25079
25157
|
if (!row || !actions) return;
|
|
@@ -25417,9 +25495,9 @@ function QueryForm({
|
|
|
25417
25495
|
}
|
|
25418
25496
|
|
|
25419
25497
|
// src/components/NumberRange.tsx
|
|
25420
|
-
var
|
|
25498
|
+
var import_react101 = require("react");
|
|
25421
25499
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
25422
|
-
var NumberRange = (0,
|
|
25500
|
+
var NumberRange = (0, import_react101.forwardRef)(function NumberRange2({
|
|
25423
25501
|
value,
|
|
25424
25502
|
defaultValue = [null, null],
|
|
25425
25503
|
onChange,
|