@sia.soul/sia-react-ui 0.1.4 → 0.1.5
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/core.css +84 -15
- package/dist/index.cjs +594 -438
- package/dist/index.css +84 -15
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +197 -41
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4323,7 +4323,7 @@ function openDrawer(config) {
|
|
|
4323
4323
|
let currentOpen = true;
|
|
4324
4324
|
let destroyed = false;
|
|
4325
4325
|
let cleanupTimer;
|
|
4326
|
-
function
|
|
4326
|
+
function cleanup2() {
|
|
4327
4327
|
if (destroyed) return;
|
|
4328
4328
|
destroyed = true;
|
|
4329
4329
|
if (cleanupTimer !== void 0) window.clearTimeout(cleanupTimer);
|
|
@@ -4335,7 +4335,7 @@ function openDrawer(config) {
|
|
|
4335
4335
|
if (destroyed || !currentOpen) return;
|
|
4336
4336
|
currentOpen = false;
|
|
4337
4337
|
render();
|
|
4338
|
-
cleanupTimer = window.setTimeout(
|
|
4338
|
+
cleanupTimer = window.setTimeout(cleanup2, DRAWER_MOTION_DURATION + 100);
|
|
4339
4339
|
}
|
|
4340
4340
|
function render() {
|
|
4341
4341
|
root.render(/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
@@ -4350,7 +4350,7 @@ function openDrawer(config) {
|
|
|
4350
4350
|
afterOpen: () => currentConfig.afterOpen?.(),
|
|
4351
4351
|
afterClose: () => {
|
|
4352
4352
|
currentConfig.afterClose?.();
|
|
4353
|
-
|
|
4353
|
+
cleanup2();
|
|
4354
4354
|
}
|
|
4355
4355
|
}
|
|
4356
4356
|
));
|
|
@@ -8691,7 +8691,7 @@ function Markdown2({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9",
|
|
|
8691
8691
|
});
|
|
8692
8692
|
return () => {
|
|
8693
8693
|
cancelled = true;
|
|
8694
|
-
cleanups.forEach((
|
|
8694
|
+
cleanups.forEach((cleanup2) => cleanup2());
|
|
8695
8695
|
};
|
|
8696
8696
|
}, [html, imagePreview, resolveImageSrc]);
|
|
8697
8697
|
function openImagePreview(target) {
|
|
@@ -9102,7 +9102,7 @@ function openModal(config) {
|
|
|
9102
9102
|
let currentOpen = true;
|
|
9103
9103
|
let destroyed = false;
|
|
9104
9104
|
let cleanupTimer;
|
|
9105
|
-
function
|
|
9105
|
+
function cleanup2() {
|
|
9106
9106
|
if (destroyed) return;
|
|
9107
9107
|
destroyed = true;
|
|
9108
9108
|
if (cleanupTimer !== void 0) window.clearTimeout(cleanupTimer);
|
|
@@ -9114,7 +9114,7 @@ function openModal(config) {
|
|
|
9114
9114
|
if (destroyed || !currentOpen) return;
|
|
9115
9115
|
currentOpen = false;
|
|
9116
9116
|
render();
|
|
9117
|
-
cleanupTimer = window.setTimeout(
|
|
9117
|
+
cleanupTimer = window.setTimeout(cleanup2, MODAL_MOTION_DURATION);
|
|
9118
9118
|
}
|
|
9119
9119
|
function render() {
|
|
9120
9120
|
root.render(/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ModalRoot, { ...currentConfig, open: currentOpen, onOpenChange: (nextOpen) => {
|
|
@@ -9797,14 +9797,76 @@ function Treemap({
|
|
|
9797
9797
|
);
|
|
9798
9798
|
}
|
|
9799
9799
|
|
|
9800
|
-
// src/components/
|
|
9800
|
+
// src/components/useScrollbarProximity.ts
|
|
9801
9801
|
var import_react41 = require("react");
|
|
9802
|
+
var users = 0;
|
|
9803
|
+
var cleanup;
|
|
9804
|
+
function useScrollbarProximity() {
|
|
9805
|
+
(0, import_react41.useEffect)(() => {
|
|
9806
|
+
if (users++ === 0) {
|
|
9807
|
+
let frame = 0;
|
|
9808
|
+
let x = -Infinity;
|
|
9809
|
+
let y = -Infinity;
|
|
9810
|
+
const nearby = /* @__PURE__ */ new Set();
|
|
9811
|
+
const clear = () => {
|
|
9812
|
+
nearby.forEach((track) => track.removeAttribute("data-scrollbar-near"));
|
|
9813
|
+
nearby.clear();
|
|
9814
|
+
};
|
|
9815
|
+
const update = () => {
|
|
9816
|
+
frame = 0;
|
|
9817
|
+
const next = /* @__PURE__ */ new Set();
|
|
9818
|
+
document.querySelectorAll(".sia-scrollbar-track").forEach((track) => {
|
|
9819
|
+
const rect = track.getBoundingClientRect();
|
|
9820
|
+
const proximity = Number.parseFloat(getComputedStyle(track).getPropertyValue("--sia-scrollbar-proximity")) || 16;
|
|
9821
|
+
if (rect.width && rect.height && x >= rect.left - proximity && x <= rect.right + proximity && y >= rect.top - proximity && y <= rect.bottom + proximity) {
|
|
9822
|
+
next.add(track);
|
|
9823
|
+
if (!nearby.has(track)) track.setAttribute("data-scrollbar-near", "true");
|
|
9824
|
+
}
|
|
9825
|
+
});
|
|
9826
|
+
nearby.forEach((track) => {
|
|
9827
|
+
if (!next.has(track)) track.removeAttribute("data-scrollbar-near");
|
|
9828
|
+
});
|
|
9829
|
+
nearby.clear();
|
|
9830
|
+
next.forEach((track) => nearby.add(track));
|
|
9831
|
+
};
|
|
9832
|
+
const move = (event) => {
|
|
9833
|
+
if (event.pointerType === "touch") return;
|
|
9834
|
+
x = event.clientX;
|
|
9835
|
+
y = event.clientY;
|
|
9836
|
+
if (!frame) frame = requestAnimationFrame(update);
|
|
9837
|
+
};
|
|
9838
|
+
const leave = () => {
|
|
9839
|
+
x = y = -Infinity;
|
|
9840
|
+
clear();
|
|
9841
|
+
};
|
|
9842
|
+
document.addEventListener("pointermove", move, { passive: true });
|
|
9843
|
+
document.documentElement.addEventListener("pointerleave", leave);
|
|
9844
|
+
window.addEventListener("blur", leave);
|
|
9845
|
+
cleanup = () => {
|
|
9846
|
+
if (frame) cancelAnimationFrame(frame);
|
|
9847
|
+
document.removeEventListener("pointermove", move);
|
|
9848
|
+
document.documentElement.removeEventListener("pointerleave", leave);
|
|
9849
|
+
window.removeEventListener("blur", leave);
|
|
9850
|
+
clear();
|
|
9851
|
+
};
|
|
9852
|
+
}
|
|
9853
|
+
return () => {
|
|
9854
|
+
if (--users === 0) {
|
|
9855
|
+
cleanup?.();
|
|
9856
|
+
cleanup = void 0;
|
|
9857
|
+
}
|
|
9858
|
+
};
|
|
9859
|
+
}, []);
|
|
9860
|
+
}
|
|
9861
|
+
|
|
9862
|
+
// src/components/Table/TableCellContent.tsx
|
|
9863
|
+
var import_react42 = require("react");
|
|
9802
9864
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
9803
9865
|
function TableCellContent({ children, ellipsis, title }) {
|
|
9804
|
-
const ref = (0,
|
|
9805
|
-
const [overflowing, setOverflowing] = (0,
|
|
9866
|
+
const ref = (0, import_react42.useRef)(null);
|
|
9867
|
+
const [overflowing, setOverflowing] = (0, import_react42.useState)(false);
|
|
9806
9868
|
const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
|
|
9807
|
-
(0,
|
|
9869
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
9808
9870
|
const element = ref.current;
|
|
9809
9871
|
if (!element || !ellipsis || !customContent) return;
|
|
9810
9872
|
const update = () => setOverflowing(element.scrollWidth > element.clientWidth + 1);
|
|
@@ -9818,10 +9880,10 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
9818
9880
|
}
|
|
9819
9881
|
|
|
9820
9882
|
// src/components/Table/Table.tsx
|
|
9821
|
-
var
|
|
9883
|
+
var import_react44 = require("react");
|
|
9822
9884
|
|
|
9823
9885
|
// src/components/Table/plugins.tsx
|
|
9824
|
-
var
|
|
9886
|
+
var import_react43 = require("react");
|
|
9825
9887
|
|
|
9826
9888
|
// src/components/Table/utils.ts
|
|
9827
9889
|
var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
|
|
@@ -10328,7 +10390,7 @@ function TableSelectedItemsPanel({
|
|
|
10328
10390
|
onRemove,
|
|
10329
10391
|
onClear
|
|
10330
10392
|
}) {
|
|
10331
|
-
const [showAll, setShowAll] = (0,
|
|
10393
|
+
const [showAll, setShowAll] = (0, import_react43.useState)(false);
|
|
10332
10394
|
const visibleEntries = showAll ? entries : entries.slice(0, maxCount2);
|
|
10333
10395
|
const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
|
|
10334
10396
|
const baseColumnMap = new Map(flattenTableColumns(baseColumns).map((column) => [column.key, column]));
|
|
@@ -10568,10 +10630,10 @@ function TableFilterControl({
|
|
|
10568
10630
|
placeholder,
|
|
10569
10631
|
onApply
|
|
10570
10632
|
}) {
|
|
10571
|
-
const [open, setOpen] = (0,
|
|
10572
|
-
const [draft, setDraft] = (0,
|
|
10633
|
+
const [open, setOpen] = (0, import_react43.useState)(false);
|
|
10634
|
+
const [draft, setDraft] = (0, import_react43.useState)(value);
|
|
10573
10635
|
const label = getColumnLabel(column);
|
|
10574
|
-
(0,
|
|
10636
|
+
(0, import_react43.useEffect)(() => {
|
|
10575
10637
|
if (open) setDraft(value);
|
|
10576
10638
|
}, [open, value]);
|
|
10577
10639
|
const apply = (nextValue) => {
|
|
@@ -10836,15 +10898,15 @@ function EditableTableCell({
|
|
|
10836
10898
|
trigger
|
|
10837
10899
|
}) {
|
|
10838
10900
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
10839
|
-
const [editValue, setEditValue] = (0,
|
|
10840
|
-
const [saving, setSaving] = (0,
|
|
10841
|
-
const inputRef = (0,
|
|
10842
|
-
const editorRef = (0,
|
|
10843
|
-
const editValueRef = (0,
|
|
10844
|
-
const savingRef = (0,
|
|
10845
|
-
const saveRef = (0,
|
|
10901
|
+
const [editValue, setEditValue] = (0, import_react43.useState)(value);
|
|
10902
|
+
const [saving, setSaving] = (0, import_react43.useState)(false);
|
|
10903
|
+
const inputRef = (0, import_react43.useRef)(null);
|
|
10904
|
+
const editorRef = (0, import_react43.useRef)(null);
|
|
10905
|
+
const editValueRef = (0, import_react43.useRef)(value);
|
|
10906
|
+
const savingRef = (0, import_react43.useRef)(false);
|
|
10907
|
+
const saveRef = (0, import_react43.useRef)(async () => {
|
|
10846
10908
|
});
|
|
10847
|
-
(0,
|
|
10909
|
+
(0, import_react43.useEffect)(() => {
|
|
10848
10910
|
if (!active) return;
|
|
10849
10911
|
editValueRef.current = value;
|
|
10850
10912
|
setEditValue(value);
|
|
@@ -10875,7 +10937,7 @@ function EditableTableCell({
|
|
|
10875
10937
|
}
|
|
10876
10938
|
}
|
|
10877
10939
|
saveRef.current = save;
|
|
10878
|
-
(0,
|
|
10940
|
+
(0, import_react43.useEffect)(() => {
|
|
10879
10941
|
if (!active || config.type === "select" || config.type === "custom") return;
|
|
10880
10942
|
const handleOutsidePointerDown = (event) => {
|
|
10881
10943
|
const target = event.target;
|
|
@@ -11034,9 +11096,9 @@ function applyColumnSettingsToTree(columns, items) {
|
|
|
11034
11096
|
return walk(columns).map((entry) => entry.column);
|
|
11035
11097
|
}
|
|
11036
11098
|
function ColumnSettingPanel({ open, items, columns, onClose, onApply }) {
|
|
11037
|
-
const [draft, setDraft] = (0,
|
|
11038
|
-
const dragIndex = (0,
|
|
11039
|
-
(0,
|
|
11099
|
+
const [draft, setDraft] = (0, import_react43.useState)(items);
|
|
11100
|
+
const dragIndex = (0, import_react43.useRef)(null);
|
|
11101
|
+
(0, import_react43.useEffect)(() => {
|
|
11040
11102
|
if (open) setDraft(items);
|
|
11041
11103
|
}, [items, open]);
|
|
11042
11104
|
const labels = new Map(flattenTableColumns(columns).map((column) => [column.key, getColumnLabel(column)]));
|
|
@@ -11131,7 +11193,30 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
11131
11193
|
void save({ columns: currentItems(context), pageSize, version: 1 });
|
|
11132
11194
|
}
|
|
11133
11195
|
},
|
|
11134
|
-
renderToolbarEnd: options.showButton === false ? void 0 : (context) =>
|
|
11196
|
+
renderToolbarEnd: options.showButton === false ? void 0 : (context) => {
|
|
11197
|
+
const exportApi = () => context.getPluginApi("export") ?? createExportPlugin().getApi({ ...context, state: void 0, setState: () => {
|
|
11198
|
+
} });
|
|
11199
|
+
const customItems = (options.menuItems ?? []).filter((item) => !(item.hidden === true || typeof item.hidden === "function" && item.hidden(context)));
|
|
11200
|
+
const items = [
|
|
11201
|
+
...options.showExport === false ? [] : [
|
|
11202
|
+
{ key: "builtin:export", label: "\u8868\u683C\u5BFC\u51FA", icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Icon, { name: "download", size: 18 }), disabled: exportApi().getRows().length === 0 },
|
|
11203
|
+
{ key: "builtin:divider", type: "divider" }
|
|
11204
|
+
],
|
|
11205
|
+
{ key: "builtin:columns", label: "\u5217\u8BBE\u7F6E", icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Icon, { name: "settings", size: 18 }) },
|
|
11206
|
+
...customItems.map((item) => ({
|
|
11207
|
+
key: "custom:" + item.key,
|
|
11208
|
+
label: item.label,
|
|
11209
|
+
icon: item.icon,
|
|
11210
|
+
danger: item.danger,
|
|
11211
|
+
disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
|
|
11212
|
+
}))
|
|
11213
|
+
];
|
|
11214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Dropdown, { trigger: ["hover", "click"], placement: "bottomRight", popupClassName: "sia-table__settings-dropdown", menu: { items, onClick: ({ key }) => {
|
|
11215
|
+
if (key === "builtin:export") void exportApi().download();
|
|
11216
|
+
else if (key === "builtin:columns") context.setState((state) => ({ ...state, open: true }));
|
|
11217
|
+
else void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
|
|
11218
|
+
} }, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Button, { size: "small", variant: "text", className: "sia-table__toolbar-icon", icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Icon, { name: "settings", size: 16 }), "aria-label": "\u8868\u683C\u8BBE\u7F6E" }) });
|
|
11219
|
+
},
|
|
11135
11220
|
renderOverlay: (context) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ColumnSettingPanel, { open: context.state.open, items: currentItems(context), columns: context.baseColumns, onClose: () => context.setState((state) => ({ ...state, open: false })), onApply: (items) => apply(items, context) }),
|
|
11136
11221
|
getApi: (context) => ({ open: () => context.setState((state) => ({ ...state, open: true })), close: () => context.setState((state) => ({ ...state, open: false })), getSettings: () => currentItems(context), apply: (items) => apply(items, context) })
|
|
11137
11222
|
};
|
|
@@ -11185,7 +11270,7 @@ function tableExportText(node) {
|
|
|
11185
11270
|
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
11186
11271
|
if (typeof node === "string" || typeof node === "number" || typeof node === "bigint") return String(node);
|
|
11187
11272
|
if (Array.isArray(node)) return node.map(tableExportText).join("");
|
|
11188
|
-
if ((0,
|
|
11273
|
+
if ((0, import_react43.isValidElement)(node)) return tableExportText(node.props.children);
|
|
11189
11274
|
return "";
|
|
11190
11275
|
}
|
|
11191
11276
|
function tableExportCell(value, sanitizeFormula) {
|
|
@@ -11334,7 +11419,7 @@ function getTableHorizontalMetrics(viewport, table) {
|
|
|
11334
11419
|
const contentWidth = Math.max(viewport.clientWidth, table?.getBoundingClientRect().width ?? viewport.clientWidth);
|
|
11335
11420
|
return { contentWidth, maxLeft: Math.max(0, contentWidth - viewport.clientWidth) };
|
|
11336
11421
|
}
|
|
11337
|
-
var TableBodyRow = (0,
|
|
11422
|
+
var TableBodyRow = (0, import_react44.memo)(function TableBodyRow2({
|
|
11338
11423
|
row,
|
|
11339
11424
|
rowIndex,
|
|
11340
11425
|
columns,
|
|
@@ -11416,6 +11501,7 @@ function TableInner(props, ref) {
|
|
|
11416
11501
|
tableHeight,
|
|
11417
11502
|
size = "medium",
|
|
11418
11503
|
bordered = true,
|
|
11504
|
+
toolbarBordered = false,
|
|
11419
11505
|
striped = true,
|
|
11420
11506
|
virtual,
|
|
11421
11507
|
virtualThreshold = 100,
|
|
@@ -11432,37 +11518,38 @@ function TableInner(props, ref) {
|
|
|
11432
11518
|
style,
|
|
11433
11519
|
...htmlProps
|
|
11434
11520
|
} = props;
|
|
11435
|
-
const rootRef = (0,
|
|
11436
|
-
const scrollRef = (0,
|
|
11437
|
-
const tableRef = (0,
|
|
11438
|
-
|
|
11439
|
-
const
|
|
11440
|
-
const [
|
|
11441
|
-
const [
|
|
11442
|
-
const [
|
|
11443
|
-
const [
|
|
11444
|
-
const
|
|
11445
|
-
const
|
|
11446
|
-
const
|
|
11447
|
-
const
|
|
11521
|
+
const rootRef = (0, import_react44.useRef)(null);
|
|
11522
|
+
const scrollRef = (0, import_react44.useRef)(null);
|
|
11523
|
+
const tableRef = (0, import_react44.useRef)(null);
|
|
11524
|
+
useScrollbarProximity();
|
|
11525
|
+
const scrollbarDragRef = (0, import_react44.useRef)(null);
|
|
11526
|
+
const [internalLoading, setInternalLoading] = (0, import_react44.useState)(false);
|
|
11527
|
+
const [scrollTop, setScrollTop] = (0, import_react44.useState)(0);
|
|
11528
|
+
const [viewportHeight, setViewportHeight] = (0, import_react44.useState)(420);
|
|
11529
|
+
const [viewportWidth, setViewportWidth] = (0, import_react44.useState)(0);
|
|
11530
|
+
const [autoColumnWidths, setAutoColumnWidths] = (0, import_react44.useState)({});
|
|
11531
|
+
const getRowKey = (0, import_react44.useCallback)((record, index) => typeof rowKey === "function" ? rowKey(record, index) : record[String(rowKey)] ?? index, [rowKey]);
|
|
11532
|
+
const builtInResizePlugin = (0, import_react44.useMemo)(() => createResizePlugin(), []);
|
|
11533
|
+
const builtInHighlightPlugin = (0, import_react44.useMemo)(() => createHighlightPlugin(), []);
|
|
11534
|
+
const activePlugins = (0, import_react44.useMemo)(() => {
|
|
11448
11535
|
const plugins = providedPlugins.filter((plugin) => resizable || plugin.id !== "resize");
|
|
11449
11536
|
if (!plugins.some((plugin) => plugin.id === "highlight")) plugins.push(builtInHighlightPlugin);
|
|
11450
11537
|
if (resizable && !plugins.some((plugin) => plugin.id === "resize")) plugins.push(builtInResizePlugin);
|
|
11451
11538
|
return plugins;
|
|
11452
11539
|
}, [builtInHighlightPlugin, builtInResizePlugin, providedPlugins, resizable]);
|
|
11453
|
-
const sortedPlugins = (0,
|
|
11454
|
-
const pluginsByIdRef = (0,
|
|
11540
|
+
const sortedPlugins = (0, import_react44.useMemo)(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
11541
|
+
const pluginsByIdRef = (0, import_react44.useRef)(/* @__PURE__ */ new Map());
|
|
11455
11542
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
11456
|
-
const [pluginStates, setPluginStates] = (0,
|
|
11543
|
+
const [pluginStates, setPluginStates] = (0, import_react44.useState)(() => Object.fromEntries(
|
|
11457
11544
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
11458
11545
|
));
|
|
11459
|
-
const pluginApisRef = (0,
|
|
11460
|
-
const contextsRef = (0,
|
|
11461
|
-
const mountedPluginsRef = (0,
|
|
11546
|
+
const pluginApisRef = (0, import_react44.useRef)({});
|
|
11547
|
+
const contextsRef = (0, import_react44.useRef)(/* @__PURE__ */ new Map());
|
|
11548
|
+
const mountedPluginsRef = (0, import_react44.useRef)(/* @__PURE__ */ new Map());
|
|
11462
11549
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
11463
11550
|
const nextApis = {};
|
|
11464
11551
|
const contexts = /* @__PURE__ */ new Map();
|
|
11465
|
-
const setPluginState = (0,
|
|
11552
|
+
const setPluginState = (0, import_react44.useCallback)((pluginId, next) => {
|
|
11466
11553
|
setPluginStates((previous) => {
|
|
11467
11554
|
const plugin = pluginsByIdRef.current.get(pluginId);
|
|
11468
11555
|
const previousValue = previous[pluginId] !== void 0 ? previous[pluginId] : plugin ? resolveInitialState(plugin) : void 0;
|
|
@@ -11515,7 +11602,7 @@ function TableInner(props, ref) {
|
|
|
11515
11602
|
});
|
|
11516
11603
|
pluginApisRef.current = nextApis;
|
|
11517
11604
|
contextsRef.current = contexts;
|
|
11518
|
-
(0,
|
|
11605
|
+
(0, import_react44.useEffect)(() => {
|
|
11519
11606
|
const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
11520
11607
|
for (const [pluginId, mounted] of mountedPluginsRef.current) {
|
|
11521
11608
|
if (activePlugins2.get(pluginId) === mounted.plugin) continue;
|
|
@@ -11527,11 +11614,11 @@ function TableInner(props, ref) {
|
|
|
11527
11614
|
mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
|
|
11528
11615
|
}
|
|
11529
11616
|
}, [sortedPlugins]);
|
|
11530
|
-
(0,
|
|
11617
|
+
(0, import_react44.useEffect)(() => () => {
|
|
11531
11618
|
for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
|
|
11532
11619
|
mountedPluginsRef.current.clear();
|
|
11533
11620
|
}, []);
|
|
11534
|
-
const updateScrollMetrics = (0,
|
|
11621
|
+
const updateScrollMetrics = (0, import_react44.useCallback)(() => {
|
|
11535
11622
|
const root = rootRef.current;
|
|
11536
11623
|
const element = scrollRef.current;
|
|
11537
11624
|
if (!root || !element) return;
|
|
@@ -11539,8 +11626,10 @@ function TableInner(props, ref) {
|
|
|
11539
11626
|
if (element.scrollLeft > maxLeft) element.scrollLeft = maxLeft > 1 ? maxLeft : 0;
|
|
11540
11627
|
const logicalScrollLeft = Math.min(element.scrollLeft, maxLeft);
|
|
11541
11628
|
const maxTop = Math.max(0, element.scrollHeight - element.clientHeight);
|
|
11542
|
-
|
|
11543
|
-
|
|
11629
|
+
root.dataset.overflowX = String(maxLeft > 1);
|
|
11630
|
+
root.dataset.overflowY = String(maxTop > 1);
|
|
11631
|
+
const horizontalTrack = root.querySelector(".sia-table__scrollbar--horizontal")?.clientWidth ?? 0;
|
|
11632
|
+
const verticalTrack = root.querySelector(".sia-table__scrollbar--vertical")?.clientHeight ?? 0;
|
|
11544
11633
|
const horizontalThumb = maxLeft > 1 ? Math.min(horizontalTrack, Math.max(36, horizontalTrack * element.clientWidth / horizontalContentWidth)) : 0;
|
|
11545
11634
|
const verticalThumb = maxTop > 1 ? Math.min(verticalTrack, Math.max(36, verticalTrack * element.clientHeight / element.scrollHeight)) : 0;
|
|
11546
11635
|
const horizontalPosition = maxLeft > 0 ? logicalScrollLeft / maxLeft * Math.max(0, horizontalTrack - horizontalThumb) : 0;
|
|
@@ -11565,7 +11654,7 @@ function TableInner(props, ref) {
|
|
|
11565
11654
|
root.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
|
|
11566
11655
|
root.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
|
|
11567
11656
|
}, []);
|
|
11568
|
-
(0,
|
|
11657
|
+
(0, import_react44.useEffect)(() => {
|
|
11569
11658
|
const element = scrollRef.current;
|
|
11570
11659
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
11571
11660
|
const observer = new ResizeObserver(() => {
|
|
@@ -11578,13 +11667,13 @@ function TableInner(props, ref) {
|
|
|
11578
11667
|
updateScrollMetrics();
|
|
11579
11668
|
return () => observer.disconnect();
|
|
11580
11669
|
}, [updateScrollMetrics]);
|
|
11581
|
-
(0,
|
|
11670
|
+
(0, import_react44.useEffect)(() => {
|
|
11582
11671
|
updateScrollMetrics();
|
|
11583
11672
|
});
|
|
11584
|
-
const orderedColumns = (0,
|
|
11585
|
-
const leafColumns = (0,
|
|
11586
|
-
const headerRows = (0,
|
|
11587
|
-
(0,
|
|
11673
|
+
const orderedColumns = (0, import_react44.useMemo)(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
11674
|
+
const leafColumns = (0, import_react44.useMemo)(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
11675
|
+
const headerRows = (0, import_react44.useMemo)(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
11676
|
+
(0, import_react44.useEffect)(() => {
|
|
11588
11677
|
const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
|
|
11589
11678
|
const root = rootRef.current;
|
|
11590
11679
|
if (!root || autoWidthColumns.length === 0) return;
|
|
@@ -11654,20 +11743,20 @@ function TableInner(props, ref) {
|
|
|
11654
11743
|
const bottomSpacer = shouldVirtualize ? Math.max(0, (pipeline.rows.length - endIndex) * rowHeight) : 0;
|
|
11655
11744
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
11656
11745
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
11657
|
-
return content ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11746
|
+
return content ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react44.Fragment, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
11658
11747
|
}).filter(Boolean);
|
|
11659
11748
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
11660
11749
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
11661
|
-
return content ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11750
|
+
return content ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react44.Fragment, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
11662
11751
|
}).filter(Boolean);
|
|
11663
11752
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
11664
11753
|
const footers = sortedPlugins.map((plugin) => {
|
|
11665
11754
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
11666
|
-
return content ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11755
|
+
return content ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react44.Fragment, { children: content }, `footer-${plugin.id}`) : null;
|
|
11667
11756
|
}).filter(Boolean);
|
|
11668
11757
|
const overlays = sortedPlugins.map((plugin) => {
|
|
11669
11758
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
11670
|
-
return content ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11759
|
+
return content ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react44.Fragment, { children: content }, `overlay-${plugin.id}`) : null;
|
|
11671
11760
|
}).filter(Boolean);
|
|
11672
11761
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
11673
11762
|
const effectiveHeight = height ?? tableHeight ?? (shouldVirtualize ? 420 : void 0);
|
|
@@ -11676,21 +11765,31 @@ function TableInner(props, ref) {
|
|
|
11676
11765
|
height: effectiveHeight,
|
|
11677
11766
|
"--sia-table-header-height": `${headerRows.length * rowHeight}px`
|
|
11678
11767
|
};
|
|
11679
|
-
const handleScroll = (0,
|
|
11768
|
+
const handleScroll = (0, import_react44.useCallback)((event) => {
|
|
11680
11769
|
const element = event.currentTarget;
|
|
11681
11770
|
if (shouldVirtualize) setScrollTop(element.scrollTop);
|
|
11682
11771
|
updateScrollMetrics();
|
|
11683
11772
|
}, [shouldVirtualize, updateScrollMetrics]);
|
|
11684
|
-
const handleScrollbarPointerDown = (0,
|
|
11773
|
+
const handleScrollbarPointerDown = (0, import_react44.useCallback)((axis, event, track = event.currentTarget) => {
|
|
11685
11774
|
const element = scrollRef.current;
|
|
11686
|
-
const
|
|
11687
|
-
if (!element || !
|
|
11775
|
+
const thumb = track.firstElementChild;
|
|
11776
|
+
if (!element || !thumb || event.button !== 0) return;
|
|
11688
11777
|
event.preventDefault();
|
|
11689
11778
|
event.stopPropagation();
|
|
11690
|
-
|
|
11779
|
+
track.setPointerCapture(event.pointerId);
|
|
11691
11780
|
const trackLength = axis === "x" ? track.clientWidth : track.clientHeight;
|
|
11692
|
-
const thumbLength = axis === "x" ?
|
|
11781
|
+
const thumbLength = axis === "x" ? thumb.offsetWidth : thumb.offsetHeight;
|
|
11693
11782
|
const maxScroll = axis === "x" ? getTableHorizontalMetrics(element, tableRef.current).maxLeft : element.scrollHeight - element.clientHeight;
|
|
11783
|
+
const thumbRect = thumb.getBoundingClientRect();
|
|
11784
|
+
const coordinate = axis === "x" ? event.clientX : event.clientY;
|
|
11785
|
+
const thumbStart = axis === "x" ? thumbRect.left : thumbRect.top;
|
|
11786
|
+
if (coordinate < thumbStart || coordinate > thumbStart + thumbLength) {
|
|
11787
|
+
const trackRect = track.getBoundingClientRect();
|
|
11788
|
+
const trackStart = axis === "x" ? trackRect.left : trackRect.top;
|
|
11789
|
+
const ratio = Math.max(0, Math.min(1, (coordinate - trackStart - thumbLength / 2) / Math.max(1, trackLength - thumbLength)));
|
|
11790
|
+
if (axis === "x") element.scrollLeft = ratio * maxScroll;
|
|
11791
|
+
else element.scrollTop = ratio * maxScroll;
|
|
11792
|
+
}
|
|
11694
11793
|
scrollbarDragRef.current = {
|
|
11695
11794
|
axis,
|
|
11696
11795
|
pointerId: event.pointerId,
|
|
@@ -11700,7 +11799,7 @@ function TableInner(props, ref) {
|
|
|
11700
11799
|
};
|
|
11701
11800
|
if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "true";
|
|
11702
11801
|
}, []);
|
|
11703
|
-
const handleScrollbarPointerMove = (0,
|
|
11802
|
+
const handleScrollbarPointerMove = (0, import_react44.useCallback)((event) => {
|
|
11704
11803
|
const drag = scrollbarDragRef.current;
|
|
11705
11804
|
const element = scrollRef.current;
|
|
11706
11805
|
if (!drag || !element || drag.pointerId !== event.pointerId) return;
|
|
@@ -11709,12 +11808,12 @@ function TableInner(props, ref) {
|
|
|
11709
11808
|
if (drag.axis === "x") element.scrollLeft = nextScroll;
|
|
11710
11809
|
else element.scrollTop = nextScroll;
|
|
11711
11810
|
}, []);
|
|
11712
|
-
const handleScrollbarPointerEnd = (0,
|
|
11811
|
+
const handleScrollbarPointerEnd = (0, import_react44.useCallback)((event) => {
|
|
11713
11812
|
if (scrollbarDragRef.current?.pointerId !== event.pointerId) return;
|
|
11714
11813
|
scrollbarDragRef.current = null;
|
|
11715
11814
|
if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "false";
|
|
11716
11815
|
}, []);
|
|
11717
|
-
(0,
|
|
11816
|
+
(0, import_react44.useImperativeHandle)(ref, () => ({
|
|
11718
11817
|
getRows: () => pipeline.rows.map((row) => row.record),
|
|
11719
11818
|
getColumns: () => pipeline.columns,
|
|
11720
11819
|
getPluginApi: (pluginId) => pluginApisRef.current[pluginId],
|
|
@@ -11783,6 +11882,16 @@ function TableInner(props, ref) {
|
|
|
11783
11882
|
};
|
|
11784
11883
|
}, {});
|
|
11785
11884
|
}
|
|
11885
|
+
function scrollbarAtPoint(event) {
|
|
11886
|
+
const tracks = rootRef.current?.querySelectorAll(".sia-table__scrollbar");
|
|
11887
|
+
for (const track of tracks ?? []) {
|
|
11888
|
+
if (track.closest(".sia-table") !== rootRef.current) continue;
|
|
11889
|
+
const rect = track.getBoundingClientRect();
|
|
11890
|
+
if (rect.width > 0 && rect.height > 0 && event.clientX >= rect.left && event.clientX < rect.right && event.clientY >= rect.top && event.clientY < rect.bottom) {
|
|
11891
|
+
return { track, axis: track.classList.contains("sia-table__scrollbar--vertical") ? "y" : "x" };
|
|
11892
|
+
}
|
|
11893
|
+
}
|
|
11894
|
+
}
|
|
11786
11895
|
function renderSummaryRow(summary) {
|
|
11787
11896
|
let labelRendered = false;
|
|
11788
11897
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
|
|
@@ -11798,13 +11907,51 @@ function TableInner(props, ref) {
|
|
|
11798
11907
|
"div",
|
|
11799
11908
|
{
|
|
11800
11909
|
ref: rootRef,
|
|
11801
|
-
className: `sia-table sia-table--${size}${bordered ? " sia-table--bordered" : ""} ${className}`.trim(),
|
|
11910
|
+
className: `sia-table sia-table--${size}${bordered ? " sia-table--bordered" : ""}${hasToolbar && !toolbarBordered ? " sia-table--borderless-toolbar" : ""} ${className}`.trim(),
|
|
11802
11911
|
style: rootStyle,
|
|
11803
11912
|
"data-has-fixed-left": left > 0,
|
|
11804
11913
|
"data-has-fixed-right": right > 0,
|
|
11805
11914
|
"data-scrolled-left": "false",
|
|
11806
11915
|
"data-scrolled-right": "true",
|
|
11807
11916
|
...htmlProps,
|
|
11917
|
+
onPointerDownCapture: (event) => {
|
|
11918
|
+
htmlProps.onPointerDownCapture?.(event);
|
|
11919
|
+
if (event.defaultPrevented || loading || internalLoading) return;
|
|
11920
|
+
const hit = scrollbarAtPoint(event);
|
|
11921
|
+
if (hit) handleScrollbarPointerDown(hit.axis, event, hit.track);
|
|
11922
|
+
},
|
|
11923
|
+
onPointerMoveCapture: (event) => {
|
|
11924
|
+
htmlProps.onPointerMoveCapture?.(event);
|
|
11925
|
+
const hit = scrollbarAtPoint(event);
|
|
11926
|
+
rootRef.current?.querySelectorAll(".sia-table__scrollbar").forEach((track) => {
|
|
11927
|
+
const hovered = track === hit?.track;
|
|
11928
|
+
if (hovered !== track.hasAttribute("data-pointer-hover")) track.toggleAttribute("data-pointer-hover", hovered);
|
|
11929
|
+
});
|
|
11930
|
+
if (hit || scrollbarDragRef.current) {
|
|
11931
|
+
handleScrollbarPointerMove(event);
|
|
11932
|
+
event.stopPropagation();
|
|
11933
|
+
}
|
|
11934
|
+
},
|
|
11935
|
+
onPointerLeave: (event) => {
|
|
11936
|
+
htmlProps.onPointerLeave?.(event);
|
|
11937
|
+
rootRef.current?.querySelectorAll("[data-pointer-hover]").forEach((track) => track.removeAttribute("data-pointer-hover"));
|
|
11938
|
+
},
|
|
11939
|
+
onClickCapture: (event) => {
|
|
11940
|
+
if (scrollbarAtPoint(event)) {
|
|
11941
|
+
event.preventDefault();
|
|
11942
|
+
event.stopPropagation();
|
|
11943
|
+
return;
|
|
11944
|
+
}
|
|
11945
|
+
htmlProps.onClickCapture?.(event);
|
|
11946
|
+
},
|
|
11947
|
+
onDoubleClickCapture: (event) => {
|
|
11948
|
+
if (scrollbarAtPoint(event)) {
|
|
11949
|
+
event.preventDefault();
|
|
11950
|
+
event.stopPropagation();
|
|
11951
|
+
return;
|
|
11952
|
+
}
|
|
11953
|
+
htmlProps.onDoubleClickCapture?.(event);
|
|
11954
|
+
},
|
|
11808
11955
|
children: [
|
|
11809
11956
|
hasToolbar ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "sia-table__toolbar", children: [
|
|
11810
11957
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { children: toolbarStart }),
|
|
@@ -11897,26 +12044,34 @@ function TableInner(props, ref) {
|
|
|
11897
12044
|
summaries.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
|
|
11898
12045
|
] }) }),
|
|
11899
12046
|
pipeline.rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
|
|
11900
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12047
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11901
12048
|
"div",
|
|
11902
12049
|
{
|
|
11903
|
-
className: "sia-table__scrollbar-
|
|
12050
|
+
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
|
|
12051
|
+
"aria-hidden": "true",
|
|
11904
12052
|
onPointerDown: (event) => handleScrollbarPointerDown("x", event),
|
|
12053
|
+
onClick: (event) => event.stopPropagation(),
|
|
12054
|
+
onDoubleClick: (event) => event.stopPropagation(),
|
|
11905
12055
|
onPointerMove: handleScrollbarPointerMove,
|
|
11906
12056
|
onPointerUp: handleScrollbarPointerEnd,
|
|
11907
|
-
onPointerCancel: handleScrollbarPointerEnd
|
|
12057
|
+
onPointerCancel: handleScrollbarPointerEnd,
|
|
12058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "sia-table__scrollbar-thumb" })
|
|
11908
12059
|
}
|
|
11909
|
-
)
|
|
11910
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12060
|
+
),
|
|
12061
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11911
12062
|
"div",
|
|
11912
12063
|
{
|
|
11913
|
-
className: "sia-table__scrollbar-
|
|
12064
|
+
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
|
|
12065
|
+
"aria-hidden": "true",
|
|
11914
12066
|
onPointerDown: (event) => handleScrollbarPointerDown("y", event),
|
|
12067
|
+
onClick: (event) => event.stopPropagation(),
|
|
12068
|
+
onDoubleClick: (event) => event.stopPropagation(),
|
|
11915
12069
|
onPointerMove: handleScrollbarPointerMove,
|
|
11916
12070
|
onPointerUp: handleScrollbarPointerEnd,
|
|
11917
|
-
onPointerCancel: handleScrollbarPointerEnd
|
|
12071
|
+
onPointerCancel: handleScrollbarPointerEnd,
|
|
12072
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "sia-table__scrollbar-thumb" })
|
|
11918
12073
|
}
|
|
11919
|
-
)
|
|
12074
|
+
)
|
|
11920
12075
|
] }),
|
|
11921
12076
|
footers.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "sia-table__footer", children: footers }) : null,
|
|
11922
12077
|
loading || internalLoading ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "sia-table__loading", role: "status", children: [
|
|
@@ -11928,12 +12083,12 @@ function TableInner(props, ref) {
|
|
|
11928
12083
|
}
|
|
11929
12084
|
);
|
|
11930
12085
|
}
|
|
11931
|
-
var Table2 = (0,
|
|
12086
|
+
var Table2 = (0, import_react44.forwardRef)(TableInner);
|
|
11932
12087
|
|
|
11933
12088
|
// src/components/ThemeSwitch.tsx
|
|
11934
|
-
var
|
|
12089
|
+
var import_react45 = require("react");
|
|
11935
12090
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
11936
|
-
var ThemeSwitch = (0,
|
|
12091
|
+
var ThemeSwitch = (0, import_react45.forwardRef)(function ThemeSwitch2({
|
|
11937
12092
|
checked,
|
|
11938
12093
|
onCheckedChange,
|
|
11939
12094
|
lightLabel = "\u4EAE\u8272\u6A21\u5F0F",
|
|
@@ -11970,7 +12125,7 @@ var ThemeSwitch = (0, import_react44.forwardRef)(function ThemeSwitch2({
|
|
|
11970
12125
|
});
|
|
11971
12126
|
|
|
11972
12127
|
// src/components/FloatingScrollbarProvider.tsx
|
|
11973
|
-
var
|
|
12128
|
+
var import_react46 = require("react");
|
|
11974
12129
|
var scrollableOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]);
|
|
11975
12130
|
var clippingOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay", "hidden", "clip"]);
|
|
11976
12131
|
function isRootScroller(target) {
|
|
@@ -12033,7 +12188,8 @@ function createTrack(axis) {
|
|
|
12033
12188
|
return { track, thumb };
|
|
12034
12189
|
}
|
|
12035
12190
|
function FloatingScrollbarProvider({ disabled = false }) {
|
|
12036
|
-
(
|
|
12191
|
+
useScrollbarProximity();
|
|
12192
|
+
(0, import_react46.useEffect)(() => {
|
|
12037
12193
|
if (disabled) return;
|
|
12038
12194
|
const layer = document.createElement("div");
|
|
12039
12195
|
layer.className = "sia-floating-scrollbar-layer";
|
|
@@ -12063,7 +12219,7 @@ function FloatingScrollbarProvider({ disabled = false }) {
|
|
|
12063
12219
|
const hasHorizontal = canScroll(target, "horizontal");
|
|
12064
12220
|
const hasVertical = canScroll(target, "vertical");
|
|
12065
12221
|
const rect = visibleRect(target);
|
|
12066
|
-
const thickness =
|
|
12222
|
+
const thickness = 10;
|
|
12067
12223
|
horizontalTrack.hidden = !hasHorizontal || rect.width <= thickness || rect.height <= 0;
|
|
12068
12224
|
verticalTrack.hidden = !hasVertical || rect.height <= thickness || rect.width <= 0;
|
|
12069
12225
|
if (!horizontalTrack.hidden) {
|
|
@@ -12323,7 +12479,7 @@ function Breadcrumb({ items, separator = "/", itemRender, className = "", ...pro
|
|
|
12323
12479
|
}
|
|
12324
12480
|
|
|
12325
12481
|
// src/components/Typography.tsx
|
|
12326
|
-
var
|
|
12482
|
+
var import_react47 = require("react");
|
|
12327
12483
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
12328
12484
|
function TypographyContent({
|
|
12329
12485
|
as: Tag2 = "span",
|
|
@@ -12343,26 +12499,26 @@ function TypographyContent({
|
|
|
12343
12499
|
className = "",
|
|
12344
12500
|
...props
|
|
12345
12501
|
}) {
|
|
12346
|
-
const contentRef = (0,
|
|
12347
|
-
const editRef = (0,
|
|
12348
|
-
const timer = (0,
|
|
12349
|
-
const [localText, setLocalText] = (0,
|
|
12350
|
-
const [draft, setDraft] = (0,
|
|
12351
|
-
const [editing, setEditing] = (0,
|
|
12352
|
-
const [copied, setCopied] = (0,
|
|
12353
|
-
const [copyError, setCopyError] = (0,
|
|
12354
|
-
const [expanded, setExpanded] = (0,
|
|
12355
|
-
const [overflow, setOverflow] = (0,
|
|
12502
|
+
const contentRef = (0, import_react47.useRef)(null);
|
|
12503
|
+
const editRef = (0, import_react47.useRef)(null);
|
|
12504
|
+
const timer = (0, import_react47.useRef)();
|
|
12505
|
+
const [localText, setLocalText] = (0, import_react47.useState)();
|
|
12506
|
+
const [draft, setDraft] = (0, import_react47.useState)("");
|
|
12507
|
+
const [editing, setEditing] = (0, import_react47.useState)(false);
|
|
12508
|
+
const [copied, setCopied] = (0, import_react47.useState)(false);
|
|
12509
|
+
const [copyError, setCopyError] = (0, import_react47.useState)(false);
|
|
12510
|
+
const [expanded, setExpanded] = (0, import_react47.useState)(false);
|
|
12511
|
+
const [overflow, setOverflow] = (0, import_react47.useState)(false);
|
|
12356
12512
|
const editConfig = typeof editable === "object" ? editable : void 0;
|
|
12357
12513
|
const content = editConfig?.text ?? localText ?? children;
|
|
12358
12514
|
const requestedRows = typeof ellipsis === "object" ? ellipsis.rows ?? 1 : 1;
|
|
12359
12515
|
const rows = Number.isFinite(requestedRows) ? Math.max(1, Math.floor(requestedRows)) : 1;
|
|
12360
12516
|
const expandable = typeof ellipsis === "object" && ellipsis.expandable;
|
|
12361
|
-
(0,
|
|
12517
|
+
(0, import_react47.useEffect)(() => {
|
|
12362
12518
|
setLocalText(void 0);
|
|
12363
12519
|
}, [children]);
|
|
12364
|
-
(0,
|
|
12365
|
-
(0,
|
|
12520
|
+
(0, import_react47.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
12521
|
+
(0, import_react47.useLayoutEffect)(() => {
|
|
12366
12522
|
const element = contentRef.current;
|
|
12367
12523
|
if (!element || !ellipsis || editing || expanded) return;
|
|
12368
12524
|
const measure = () => setOverflow(element.scrollHeight > element.clientHeight + 1 || element.scrollWidth > element.clientWidth + 1);
|
|
@@ -12471,10 +12627,10 @@ function TypographyRoot({ className = "", ...props }) {
|
|
|
12471
12627
|
var Typography = Object.assign(TypographyRoot, { Title, Text, Paragraph, Link });
|
|
12472
12628
|
|
|
12473
12629
|
// src/components/FloatButton.tsx
|
|
12474
|
-
var
|
|
12630
|
+
var import_react48 = require("react");
|
|
12475
12631
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
12476
|
-
var GroupShape = (0,
|
|
12477
|
-
var FloatButtonRoot = (0,
|
|
12632
|
+
var GroupShape = (0, import_react48.createContext)(void 0);
|
|
12633
|
+
var FloatButtonRoot = (0, import_react48.forwardRef)(function FloatButton({
|
|
12478
12634
|
icon,
|
|
12479
12635
|
description,
|
|
12480
12636
|
tooltip,
|
|
@@ -12487,7 +12643,7 @@ var FloatButtonRoot = (0, import_react47.forwardRef)(function FloatButton({
|
|
|
12487
12643
|
children,
|
|
12488
12644
|
...props
|
|
12489
12645
|
}, ref) {
|
|
12490
|
-
const groupShape = (0,
|
|
12646
|
+
const groupShape = (0, import_react48.useContext)(GroupShape);
|
|
12491
12647
|
const label = props["aria-label"] ?? (typeof tooltip === "string" ? tooltip : typeof description === "string" ? description : "\u60AC\u6D6E\u64CD\u4F5C");
|
|
12492
12648
|
const button = /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12493
12649
|
"button",
|
|
@@ -12525,10 +12681,10 @@ function FloatButtonGroup({
|
|
|
12525
12681
|
...props
|
|
12526
12682
|
}) {
|
|
12527
12683
|
const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
12528
|
-
const rootRef = (0,
|
|
12529
|
-
const triggerRef = (0,
|
|
12530
|
-
const id = (0,
|
|
12531
|
-
(0,
|
|
12684
|
+
const rootRef = (0, import_react48.useRef)(null);
|
|
12685
|
+
const triggerRef = (0, import_react48.useRef)(null);
|
|
12686
|
+
const id = (0, import_react48.useId)();
|
|
12687
|
+
(0, import_react48.useEffect)(() => {
|
|
12532
12688
|
if (!trigger || !visible) return;
|
|
12533
12689
|
const close = (event) => {
|
|
12534
12690
|
if (!rootRef.current?.contains(event.target)) setVisible(false);
|
|
@@ -12582,8 +12738,8 @@ function FloatButtonGroup({
|
|
|
12582
12738
|
) });
|
|
12583
12739
|
}
|
|
12584
12740
|
function FloatButtonBackTop({ target, visibilityHeight = 400, behavior = "smooth", onClick, icon, tooltip = "\u8FD4\u56DE\u9876\u90E8", ...props }) {
|
|
12585
|
-
const [visible, setVisible] = (0,
|
|
12586
|
-
(0,
|
|
12741
|
+
const [visible, setVisible] = (0, import_react48.useState)(false);
|
|
12742
|
+
(0, import_react48.useEffect)(() => {
|
|
12587
12743
|
const element = target ? target() : window;
|
|
12588
12744
|
if (!element) return;
|
|
12589
12745
|
const update = () => setVisible((element === window ? window.scrollY : element.scrollTop) >= visibilityHeight);
|
|
@@ -12602,11 +12758,11 @@ function FloatButtonBackTop({ target, visibilityHeight = 400, behavior = "smooth
|
|
|
12602
12758
|
var FloatButton2 = Object.assign(FloatButtonRoot, { Group: FloatButtonGroup, BackTop: FloatButtonBackTop });
|
|
12603
12759
|
|
|
12604
12760
|
// src/components/ChartWhirlingLoading.tsx
|
|
12605
|
-
var
|
|
12761
|
+
var import_react49 = require("react");
|
|
12606
12762
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
12607
12763
|
function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\u83B7\u53D6\u4E2D", textWidth, frame }) {
|
|
12608
|
-
const [tick, setTick] = (0,
|
|
12609
|
-
(0,
|
|
12764
|
+
const [tick, setTick] = (0, import_react49.useState)(0);
|
|
12765
|
+
(0, import_react49.useEffect)(() => {
|
|
12610
12766
|
if (frame != null) return;
|
|
12611
12767
|
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
12612
12768
|
let timer;
|
|
@@ -12637,20 +12793,20 @@ function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\
|
|
|
12637
12793
|
}
|
|
12638
12794
|
|
|
12639
12795
|
// src/components/SvgMapPlot.tsx
|
|
12640
|
-
var
|
|
12796
|
+
var import_react61 = require("react");
|
|
12641
12797
|
|
|
12642
12798
|
// src/components/ChartBrush.tsx
|
|
12643
|
-
var
|
|
12799
|
+
var import_react50 = require("react");
|
|
12644
12800
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
12645
12801
|
function ChartBrush({ bounds, onSelect, onCancel, selectionShape = "band", selectionStyle, minSelectionSize }) {
|
|
12646
|
-
const [vertical, setVertical] = (0,
|
|
12647
|
-
const startY = (0,
|
|
12802
|
+
const [vertical, setVertical] = (0, import_react50.useState)(null);
|
|
12803
|
+
const startY = (0, import_react50.useRef)(0);
|
|
12648
12804
|
const y = (event) => {
|
|
12649
12805
|
const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
|
|
12650
12806
|
return matrix ? Math.max(bounds.y, Math.min(bounds.y + bounds.height, new DOMPoint(event.clientX, event.clientY).matrixTransform(matrix.inverse()).y)) : bounds.y;
|
|
12651
12807
|
};
|
|
12652
|
-
const drag = (0,
|
|
12653
|
-
const [selection, setSelection] = (0,
|
|
12808
|
+
const drag = (0, import_react50.useRef)(null);
|
|
12809
|
+
const [selection, setSelection] = (0, import_react50.useState)(null);
|
|
12654
12810
|
const x = (event) => {
|
|
12655
12811
|
const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
|
|
12656
12812
|
if (!matrix) return null;
|
|
@@ -12773,7 +12929,7 @@ function appendChartExportHeadings(original, clone, host) {
|
|
|
12773
12929
|
}
|
|
12774
12930
|
|
|
12775
12931
|
// src/components/ChartNodeTimeline.tsx
|
|
12776
|
-
var
|
|
12932
|
+
var import_react52 = require("react");
|
|
12777
12933
|
|
|
12778
12934
|
// src/components/timelinePositions.ts
|
|
12779
12935
|
function timelineRatios(count, dates) {
|
|
@@ -12799,7 +12955,7 @@ function nearestTimelineIndex(ratios, ratio) {
|
|
|
12799
12955
|
}
|
|
12800
12956
|
|
|
12801
12957
|
// src/components/ChartPointMotion.tsx
|
|
12802
|
-
var
|
|
12958
|
+
var import_react51 = require("react");
|
|
12803
12959
|
|
|
12804
12960
|
// src/components/chartMotion.ts
|
|
12805
12961
|
function chartMotionBaseline(points, horizontal = false) {
|
|
@@ -12820,11 +12976,11 @@ function interpolateChartPoints(from, to, progress) {
|
|
|
12820
12976
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
12821
12977
|
function ChartPointMotion({ points, enabled, duration, updateDuration = 500, animateInitial = true, easing = "linear", progress, horizontal = false, origin, children }) {
|
|
12822
12978
|
const baseline = (target) => origin ? target.map(() => origin) : chartMotionBaseline(target, horizontal);
|
|
12823
|
-
const [frame, setFrame] = (0,
|
|
12824
|
-
const displayed = (0,
|
|
12825
|
-
const initialized = (0,
|
|
12979
|
+
const [frame, setFrame] = (0, import_react51.useState)(() => enabled && animateInitial ? baseline(points) : points);
|
|
12980
|
+
const displayed = (0, import_react51.useRef)(frame);
|
|
12981
|
+
const initialized = (0, import_react51.useRef)(!animateInitial);
|
|
12826
12982
|
const signature = JSON.stringify(points);
|
|
12827
|
-
(0,
|
|
12983
|
+
(0, import_react51.useEffect)(() => {
|
|
12828
12984
|
const target = points;
|
|
12829
12985
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
12830
12986
|
if (!enabled || progress != null || reduced.matches) {
|
|
@@ -12863,8 +13019,8 @@ function ChartPointMotion({ points, enabled, duration, updateDuration = 500, ani
|
|
|
12863
13019
|
// src/components/ChartNodeTimeline.tsx
|
|
12864
13020
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
12865
13021
|
function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, x = 80, y = 520, width = 840 }) {
|
|
12866
|
-
const [playing, setPlaying] = (0,
|
|
12867
|
-
const [draft, setDraft] = (0,
|
|
13022
|
+
const [playing, setPlaying] = (0, import_react52.useState)(autoPlay), dragging = (0, import_react52.useRef)();
|
|
13023
|
+
const [draft, setDraft] = (0, import_react52.useState)(), pending = (0, import_react52.useRef)(), draftRef = (0, import_react52.useRef)();
|
|
12868
13024
|
const shown = draft ?? value;
|
|
12869
13025
|
const cancelPending = () => {
|
|
12870
13026
|
clearTimeout(pending.current);
|
|
@@ -12872,8 +13028,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
|
|
|
12872
13028
|
draftRef.current = void 0;
|
|
12873
13029
|
setDraft(void 0);
|
|
12874
13030
|
};
|
|
12875
|
-
(0,
|
|
12876
|
-
(0,
|
|
13031
|
+
(0, import_react52.useEffect)(() => () => clearTimeout(pending.current), []);
|
|
13032
|
+
(0, import_react52.useEffect)(() => {
|
|
12877
13033
|
cancelPending();
|
|
12878
13034
|
}, [value]);
|
|
12879
13035
|
const preview = (index) => {
|
|
@@ -12888,8 +13044,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
|
|
|
12888
13044
|
draftRef.current = void 0;
|
|
12889
13045
|
}, 200);
|
|
12890
13046
|
};
|
|
12891
|
-
(0,
|
|
12892
|
-
(0,
|
|
13047
|
+
(0, import_react52.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
|
|
13048
|
+
(0, import_react52.useEffect)(() => {
|
|
12893
13049
|
if (!playing || labels.length < 2) return;
|
|
12894
13050
|
const timer = window.setTimeout(() => {
|
|
12895
13051
|
if (value + 1 < labels.length) onChange(value + 1);
|
|
@@ -12998,7 +13154,7 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
|
|
|
12998
13154
|
}
|
|
12999
13155
|
|
|
13000
13156
|
// src/components/ChartVerticalRange.tsx
|
|
13001
|
-
var
|
|
13157
|
+
var import_react53 = require("react");
|
|
13002
13158
|
|
|
13003
13159
|
// src/components/chartColorRamp.ts
|
|
13004
13160
|
function chartColorRamp(colors, ratio) {
|
|
@@ -13018,16 +13174,16 @@ function chartColorRamp(colors, ratio) {
|
|
|
13018
13174
|
// src/components/ChartVerticalRange.tsx
|
|
13019
13175
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
13020
13176
|
function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true, readOnly = false }) {
|
|
13021
|
-
const id = (0,
|
|
13022
|
-
const drag = (0,
|
|
13023
|
-
const [draft, setDraft] = (0,
|
|
13024
|
-
const pending = (0,
|
|
13177
|
+
const id = (0, import_react53.useId)().replaceAll(":", "");
|
|
13178
|
+
const drag = (0, import_react53.useRef)();
|
|
13179
|
+
const [draft, setDraft] = (0, import_react53.useState)();
|
|
13180
|
+
const pending = (0, import_react53.useRef)();
|
|
13025
13181
|
const cancel = () => {
|
|
13026
13182
|
drag.current = void 0;
|
|
13027
13183
|
pending.current = void 0;
|
|
13028
13184
|
setDraft(void 0);
|
|
13029
13185
|
};
|
|
13030
|
-
(0,
|
|
13186
|
+
(0, import_react53.useEffect)(() => {
|
|
13031
13187
|
if (!realtime) cancel();
|
|
13032
13188
|
}, [range[0], range[1], min, max, realtime]);
|
|
13033
13189
|
const shown = draft ?? range;
|
|
@@ -13108,18 +13264,18 @@ function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range,
|
|
|
13108
13264
|
}
|
|
13109
13265
|
|
|
13110
13266
|
// src/components/ChartHorizontalRange.tsx
|
|
13111
|
-
var
|
|
13267
|
+
var import_react54 = require("react");
|
|
13112
13268
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
13113
13269
|
function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true }) {
|
|
13114
|
-
const id = (0,
|
|
13115
|
-
const drag = (0,
|
|
13116
|
-
const [draft, setDraft] = (0,
|
|
13270
|
+
const id = (0, import_react54.useId)().replaceAll(":", ""), span = max - min;
|
|
13271
|
+
const drag = (0, import_react54.useRef)();
|
|
13272
|
+
const [draft, setDraft] = (0, import_react54.useState)(), pending = (0, import_react54.useRef)();
|
|
13117
13273
|
const cancel = () => {
|
|
13118
13274
|
drag.current = void 0;
|
|
13119
13275
|
pending.current = void 0;
|
|
13120
13276
|
setDraft(void 0);
|
|
13121
13277
|
};
|
|
13122
|
-
(0,
|
|
13278
|
+
(0, import_react54.useEffect)(() => {
|
|
13123
13279
|
if (!realtime) cancel();
|
|
13124
13280
|
}, [range[0], range[1], min, max, realtime]);
|
|
13125
13281
|
const shown = draft ?? range, low = Math.max(min, Math.min(max, shown[0])), high = Math.max(low, Math.min(max, shown[1]));
|
|
@@ -13197,7 +13353,7 @@ function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range
|
|
|
13197
13353
|
}
|
|
13198
13354
|
|
|
13199
13355
|
// src/components/Chart.tsx
|
|
13200
|
-
var
|
|
13356
|
+
var import_react55 = require("react");
|
|
13201
13357
|
|
|
13202
13358
|
// src/components/chartCompositeExport.ts
|
|
13203
13359
|
function serializeChartComposite(host) {
|
|
@@ -13321,20 +13477,20 @@ var DEFAULT_CHART_PALETTE = [
|
|
|
13321
13477
|
"#2f54eb",
|
|
13322
13478
|
"#a0d911"
|
|
13323
13479
|
];
|
|
13324
|
-
var ChartContext = (0,
|
|
13480
|
+
var ChartContext = (0, import_react55.createContext)(null);
|
|
13325
13481
|
function toCssSize(value, fallback) {
|
|
13326
13482
|
if (typeof value === "number") return `${value}px`;
|
|
13327
13483
|
return value ?? fallback;
|
|
13328
13484
|
}
|
|
13329
|
-
var ChartComposite = (0,
|
|
13330
|
-
const host = (0,
|
|
13331
|
-
(0,
|
|
13485
|
+
var ChartComposite = (0, import_react55.forwardRef)(function ChartComposite2({ layers, width = "100%", height = 320, ariaLabel = "\u7EC4\u5408\u56FE\u8868", className = "", style, ...props }, ref) {
|
|
13486
|
+
const host = (0, import_react55.useRef)(null);
|
|
13487
|
+
(0, import_react55.useImperativeHandle)(ref, () => ({ toSvgString: () => host.current ? serializeChartComposite(host.current) : null, saveAsImage: (filename) => saveCompositeImage(host.current ? serializeChartComposite(host.current) : null, filename) }), []);
|
|
13332
13488
|
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { ...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_runtime58.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)) });
|
|
13333
13489
|
});
|
|
13334
|
-
var useTooltipLayoutEffect = typeof window === "undefined" ?
|
|
13490
|
+
var useTooltipLayoutEffect = typeof window === "undefined" ? import_react55.useEffect : import_react55.useLayoutEffect;
|
|
13335
13491
|
function ChartTooltip({ open, left, top, children, enterable = false, inheritTextStyle = false, placement = "above", className = "", style, ...props }) {
|
|
13336
|
-
const elementRef = (0,
|
|
13337
|
-
const [position, setPosition] = (0,
|
|
13492
|
+
const elementRef = (0, import_react55.useRef)(null);
|
|
13493
|
+
const [position, setPosition] = (0, import_react55.useState)([left, top]);
|
|
13338
13494
|
useTooltipLayoutEffect(() => {
|
|
13339
13495
|
const element = elementRef.current, host = element?.parentElement;
|
|
13340
13496
|
if (!open || placement !== "axis" || !element || !host) return;
|
|
@@ -13458,7 +13614,7 @@ function ChartToolbox({
|
|
|
13458
13614
|
))
|
|
13459
13615
|
] });
|
|
13460
13616
|
}
|
|
13461
|
-
var SiaChart = (0,
|
|
13617
|
+
var SiaChart = (0, import_react55.forwardRef)(function SiaChart2({
|
|
13462
13618
|
children,
|
|
13463
13619
|
width = "100%",
|
|
13464
13620
|
height = 320,
|
|
@@ -13485,19 +13641,19 @@ var SiaChart = (0, import_react54.forwardRef)(function SiaChart2({
|
|
|
13485
13641
|
style,
|
|
13486
13642
|
...rest
|
|
13487
13643
|
}, ref) {
|
|
13488
|
-
const hostRef = (0,
|
|
13489
|
-
const svgRef = (0,
|
|
13490
|
-
const titleId = (0,
|
|
13491
|
-
const descriptionId = (0,
|
|
13492
|
-
const [tooltip, setTooltip] = (0,
|
|
13493
|
-
const tooltipHideTimer = (0,
|
|
13494
|
-
const tooltipHeld = (0,
|
|
13644
|
+
const hostRef = (0, import_react55.useRef)(null);
|
|
13645
|
+
const svgRef = (0, import_react55.useRef)(null);
|
|
13646
|
+
const titleId = (0, import_react55.useId)();
|
|
13647
|
+
const descriptionId = (0, import_react55.useId)();
|
|
13648
|
+
const [tooltip, setTooltip] = (0, import_react55.useState)(null);
|
|
13649
|
+
const tooltipHideTimer = (0, import_react55.useRef)();
|
|
13650
|
+
const tooltipHeld = (0, import_react55.useRef)(false);
|
|
13495
13651
|
const cancelTooltipHide = () => {
|
|
13496
13652
|
clearTimeout(tooltipHideTimer.current);
|
|
13497
13653
|
};
|
|
13498
|
-
(0,
|
|
13499
|
-
const [linkedPosition, setLinkedPosition] = (0,
|
|
13500
|
-
(0,
|
|
13654
|
+
(0, import_react55.useEffect)(() => () => clearTimeout(tooltipHideTimer.current), []);
|
|
13655
|
+
const [linkedPosition, setLinkedPosition] = (0, import_react55.useState)({ left: 0, top: 0 });
|
|
13656
|
+
(0, import_react55.useEffect)(() => {
|
|
13501
13657
|
const host = hostRef.current, svg = svgRef.current;
|
|
13502
13658
|
if (!controlledTooltip || !host || !svg) return;
|
|
13503
13659
|
const position = () => {
|
|
@@ -13512,12 +13668,12 @@ var SiaChart = (0, import_react54.forwardRef)(function SiaChart2({
|
|
|
13512
13668
|
observer.observe(host);
|
|
13513
13669
|
return () => observer.disconnect();
|
|
13514
13670
|
}, [controlledTooltip]);
|
|
13515
|
-
const [dataViewOpen, setDataViewOpen] = (0,
|
|
13516
|
-
const [markMode, setMarkMode] = (0,
|
|
13517
|
-
const [markStart, setMarkStart] = (0,
|
|
13518
|
-
const [userMarks, setUserMarks] = (0,
|
|
13671
|
+
const [dataViewOpen, setDataViewOpen] = (0, import_react55.useState)(false);
|
|
13672
|
+
const [markMode, setMarkMode] = (0, import_react55.useState)(false);
|
|
13673
|
+
const [markStart, setMarkStart] = (0, import_react55.useState)(null);
|
|
13674
|
+
const [userMarks, setUserMarks] = (0, import_react55.useState)([]);
|
|
13519
13675
|
const toolboxOptions = toolbox === true ? {} : toolbox || void 0;
|
|
13520
|
-
const rootStyle = (0,
|
|
13676
|
+
const rootStyle = (0, import_react55.useMemo)(() => ({
|
|
13521
13677
|
...style,
|
|
13522
13678
|
width: toCssSize(width, "100%"),
|
|
13523
13679
|
height: toCssSize(height, "320px"),
|
|
@@ -13575,13 +13731,13 @@ var SiaChart = (0, import_react54.forwardRef)(function SiaChart2({
|
|
|
13575
13731
|
anchor.href = canvas.toDataURL("image/png");
|
|
13576
13732
|
anchor.click();
|
|
13577
13733
|
}
|
|
13578
|
-
(0,
|
|
13734
|
+
(0, import_react55.useImperativeHandle)(ref, () => ({
|
|
13579
13735
|
getElement: () => svgRef.current,
|
|
13580
13736
|
focus: () => svgRef.current?.focus(),
|
|
13581
13737
|
toSvgString: serializeSvg,
|
|
13582
13738
|
toDataUrl: svgDataUrl
|
|
13583
13739
|
}), []);
|
|
13584
|
-
const context = (0,
|
|
13740
|
+
const context = (0, import_react55.useMemo)(() => ({
|
|
13585
13741
|
palette,
|
|
13586
13742
|
showTooltip: (event, content, point) => {
|
|
13587
13743
|
cancelTooltipHide();
|
|
@@ -13768,7 +13924,7 @@ var SiaChart = (0, import_react54.forwardRef)(function SiaChart2({
|
|
|
13768
13924
|
) });
|
|
13769
13925
|
});
|
|
13770
13926
|
function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave, onFocus, onBlur, ...props }) {
|
|
13771
|
-
const context = (0,
|
|
13927
|
+
const context = (0, import_react55.useContext)(ChartContext);
|
|
13772
13928
|
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
13773
13929
|
"g",
|
|
13774
13930
|
{
|
|
@@ -13797,7 +13953,7 @@ function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave
|
|
|
13797
13953
|
);
|
|
13798
13954
|
}
|
|
13799
13955
|
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 }) {
|
|
13800
|
-
const paintId = (0,
|
|
13956
|
+
const paintId = (0, import_react55.useId)().replaceAll(":", "");
|
|
13801
13957
|
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))));
|
|
13802
13958
|
const totalWidth = orientation === "horizontal" ? widths.reduce((sum, value) => sum + value, 0) + Math.max(0, items.length - 1) * itemGap : Math.max(0, ...widths);
|
|
13803
13959
|
const startX = align === "start" ? x : align === "end" ? x - totalWidth : x - totalWidth / 2;
|
|
@@ -13926,7 +14082,7 @@ function ChartAxis({ layer = "all", orientation, x, y, length, labels, positions
|
|
|
13926
14082
|
] });
|
|
13927
14083
|
}
|
|
13928
14084
|
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 }) {
|
|
13929
|
-
const id = (0,
|
|
14085
|
+
const id = (0, import_react55.useId)().replaceAll(":", "");
|
|
13930
14086
|
const vertical = orientation === "vertical";
|
|
13931
14087
|
if (svgHandles && vertical && !calculable && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ChartVerticalRange, { readOnly: true, min, max, x, y, length: width, thickness: height, colors, range: [min, max], endLabels, indicatorValue, onHoverRange });
|
|
13932
14088
|
if (svgHandles && vertical && calculable && range && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ChartVerticalRange, { min, max, x, y, length: width, thickness: height, colors, range, onChange: onRangeChange, endLabels, indicatorValue, onHoverRange, realtime });
|
|
@@ -13954,8 +14110,8 @@ function ChartVisualMap({ min, max, colors = ["#e6f4ff", "#1677ff"], x = 16, y =
|
|
|
13954
14110
|
] });
|
|
13955
14111
|
}
|
|
13956
14112
|
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 }) {
|
|
13957
|
-
const [activeHandle, setActiveHandle] = (0,
|
|
13958
|
-
const pan = (0,
|
|
14113
|
+
const [activeHandle, setActiveHandle] = (0, import_react55.useState)(null);
|
|
14114
|
+
const pan = (0, import_react55.useRef)();
|
|
13959
14115
|
const start = Math.min(value[0], value[1]);
|
|
13960
14116
|
const end = Math.max(value[0], value[1]);
|
|
13961
14117
|
const startPercent = (start - min) / Math.max(1, max - min) * 100;
|
|
@@ -14029,9 +14185,9 @@ function ChartDataZoom({ value, min = 0, max = 100, ariaLabel = "\u56FE\u8868\u5
|
|
|
14029
14185
|
] });
|
|
14030
14186
|
}
|
|
14031
14187
|
function ChartTimeline({ labels, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, className = "", ...props }) {
|
|
14032
|
-
const [playing, setPlaying] = (0,
|
|
14033
|
-
(0,
|
|
14034
|
-
(0,
|
|
14188
|
+
const [playing, setPlaying] = (0, import_react55.useState)(autoPlay);
|
|
14189
|
+
(0, import_react55.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
|
|
14190
|
+
(0, import_react55.useEffect)(() => {
|
|
14035
14191
|
if (!playing || labels.length <= 1) return void 0;
|
|
14036
14192
|
const timer = window.setInterval(() => {
|
|
14037
14193
|
const next = value + 1;
|
|
@@ -14141,7 +14297,7 @@ function parseSvgMapPaths(source) {
|
|
|
14141
14297
|
}
|
|
14142
14298
|
|
|
14143
14299
|
// src/components/useMapRoam.ts
|
|
14144
|
-
var
|
|
14300
|
+
var import_react56 = require("react");
|
|
14145
14301
|
|
|
14146
14302
|
// src/components/chartRoam.ts
|
|
14147
14303
|
function zoomChartViewport(view, factor, point, limit = { min: 0.05, max: 20 }) {
|
|
@@ -14158,14 +14314,14 @@ var initial = { x: 0, y: 0, scale: 1 };
|
|
|
14158
14314
|
function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.12, 0.9]) {
|
|
14159
14315
|
const [zoomIn, zoomOut] = wheelFactors;
|
|
14160
14316
|
const min = scaleLimit?.min, max = scaleLimit?.max, unlimited = scaleLimit === null;
|
|
14161
|
-
const host = (0,
|
|
14162
|
-
const [view, setView] = (0,
|
|
14163
|
-
const drag = (0,
|
|
14317
|
+
const host = (0, import_react56.useRef)(null);
|
|
14318
|
+
const [view, setView] = (0, import_react56.useState)(initial);
|
|
14319
|
+
const drag = (0, import_react56.useRef)();
|
|
14164
14320
|
const local = (x, y) => {
|
|
14165
14321
|
const matrix = host.current?.ownerSVGElement?.getScreenCTM();
|
|
14166
14322
|
return matrix ? new DOMPoint(x, y).matrixTransform(matrix.inverse()) : new DOMPoint(x, y);
|
|
14167
14323
|
};
|
|
14168
|
-
(0,
|
|
14324
|
+
(0, import_react56.useEffect)(() => {
|
|
14169
14325
|
const node = host.current;
|
|
14170
14326
|
if (!node || !mode || mode === "move") return;
|
|
14171
14327
|
const wheel = (event) => {
|
|
@@ -14227,7 +14383,7 @@ function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.
|
|
|
14227
14383
|
}
|
|
14228
14384
|
|
|
14229
14385
|
// src/components/ChartMapLineReveal.tsx
|
|
14230
|
-
var
|
|
14386
|
+
var import_react57 = require("react");
|
|
14231
14387
|
|
|
14232
14388
|
// src/components/mapLineGeometry.ts
|
|
14233
14389
|
function mapLineControl(source, target, curveness) {
|
|
@@ -14244,9 +14400,9 @@ function mapLineDuration(source, target, period) {
|
|
|
14244
14400
|
// src/components/ChartMapLineReveal.tsx
|
|
14245
14401
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
14246
14402
|
function ChartMapLineReveal({ source, control, target, enabled, initialDuration = 2e3, updateDuration = 500, children }) {
|
|
14247
|
-
const signature = JSON.stringify([source, control, target]), initialized = (0,
|
|
14248
|
-
const [frame, setFrame] = (0,
|
|
14249
|
-
(0,
|
|
14403
|
+
const signature = JSON.stringify([source, control, target]), initialized = (0, import_react57.useRef)(false);
|
|
14404
|
+
const [frame, setFrame] = (0, import_react57.useState)({ signature, progress: enabled ? 0 : 1 });
|
|
14405
|
+
(0, import_react57.useEffect)(() => {
|
|
14250
14406
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
14251
14407
|
const duration = Math.max(1, initialized.current ? updateDuration : initialDuration);
|
|
14252
14408
|
if (!enabled || reduced.matches) {
|
|
@@ -14279,15 +14435,15 @@ function ChartMapLineReveal({ source, control, target, enabled, initialDuration
|
|
|
14279
14435
|
}
|
|
14280
14436
|
|
|
14281
14437
|
// src/components/ChartMapLineEffect.tsx
|
|
14282
|
-
var
|
|
14438
|
+
var import_react58 = require("react");
|
|
14283
14439
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
14284
14440
|
function ChartMapLineEffect({ source, control, target, period = 30, color = "#fff", radius = 1, shadowBlur = 10, shadowColor = color, trailAlpha }) {
|
|
14285
|
-
const ref = (0,
|
|
14286
|
-
const trails = (0,
|
|
14441
|
+
const ref = (0, import_react58.useRef)(null);
|
|
14442
|
+
const trails = (0, import_react58.useRef)([]);
|
|
14287
14443
|
const alpha = trailAlpha === void 0 ? 0 : Math.max(0, Math.min(0.999, trailAlpha));
|
|
14288
14444
|
const count = alpha > 0 ? Math.min(240, Math.ceil(Math.log(5e-3) / Math.log(alpha))) : 0;
|
|
14289
14445
|
const duration = mapLineDuration(source, target, period);
|
|
14290
|
-
(0,
|
|
14446
|
+
(0, import_react58.useEffect)(() => {
|
|
14291
14447
|
const started = performance.now();
|
|
14292
14448
|
let frame = 0;
|
|
14293
14449
|
const history = [];
|
|
@@ -14320,7 +14476,7 @@ function ChartMapLineEffect({ source, control, target, period = 30, color = "#ff
|
|
|
14320
14476
|
}
|
|
14321
14477
|
|
|
14322
14478
|
// src/components/ChartMapPointPulse.tsx
|
|
14323
|
-
var
|
|
14479
|
+
var import_react59 = require("react");
|
|
14324
14480
|
|
|
14325
14481
|
// src/components/mapPointPulse.ts
|
|
14326
14482
|
function mapPointPulseDuration(period, random = Math.random) {
|
|
@@ -14330,7 +14486,7 @@ function mapPointPulseDuration(period, random = Math.random) {
|
|
|
14330
14486
|
// src/components/ChartMapPointPulse.tsx
|
|
14331
14487
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
14332
14488
|
function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
|
|
14333
|
-
const [duration] = (0,
|
|
14489
|
+
const [duration] = (0, import_react59.useState)(() => mapPointPulseDuration(period));
|
|
14334
14490
|
return /* @__PURE__ */ (0, import_jsx_runtime61.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: [
|
|
14335
14491
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("animate", { attributeName: "r", values: `${size * scaleSize * 0.1};${size * scaleSize}`, dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" }),
|
|
14336
14492
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("animate", { attributeName: "stroke-width", values: ".1;1", dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" })
|
|
@@ -14338,11 +14494,11 @@ function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
|
|
|
14338
14494
|
}
|
|
14339
14495
|
|
|
14340
14496
|
// src/components/ChartMapPointEntrance.tsx
|
|
14341
|
-
var
|
|
14497
|
+
var import_react60 = require("react");
|
|
14342
14498
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
14343
14499
|
function ChartMapPointEntrance({ enabled, x, y, children }) {
|
|
14344
|
-
const [progress, setProgress] = (0,
|
|
14345
|
-
(0,
|
|
14500
|
+
const [progress, setProgress] = (0, import_react60.useState)(enabled ? 0.01 : 1);
|
|
14501
|
+
(0, import_react60.useEffect)(() => {
|
|
14346
14502
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
14347
14503
|
if (!enabled || reduced.matches) {
|
|
14348
14504
|
setProgress(1);
|
|
@@ -14385,8 +14541,8 @@ function mapLineEndLabel(source, target) {
|
|
|
14385
14541
|
// src/components/SvgMapPlot.tsx
|
|
14386
14542
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
14387
14543
|
function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized, onHover, stroke, strokeWidth, opacity, hoverable = true, showLabel = true, tooltipNameOnly = false }) {
|
|
14388
|
-
const path = (0,
|
|
14389
|
-
(0,
|
|
14544
|
+
const path = (0, import_react61.useRef)(null), [center, setCenter] = (0, import_react61.useState)([0, 0]);
|
|
14545
|
+
(0, import_react61.useLayoutEffect)(() => {
|
|
14390
14546
|
const box = path.current?.getBBox();
|
|
14391
14547
|
if (box) setCenter([box.x + box.width / 2, box.y + box.height / 2]);
|
|
14392
14548
|
}, [d]);
|
|
@@ -14404,9 +14560,9 @@ function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized
|
|
|
14404
14560
|
] }), onPointerMove: () => onHover(true), onPointerLeave: () => onHover(false), onFocus: () => onHover(true), onBlur: () => onHover(false), children: content });
|
|
14405
14561
|
}
|
|
14406
14562
|
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" }) {
|
|
14407
|
-
const map = (0,
|
|
14408
|
-
const [hoveredLine, setHoveredLine] = (0,
|
|
14409
|
-
(0,
|
|
14563
|
+
const map = (0, import_react61.useMemo)(() => parseSvgMapPaths(source), [source]), control = useMapRoam(roam, null, [1.2, 1 / 1.2]), [hovered, setHovered] = (0, import_react61.useState)();
|
|
14564
|
+
const [hoveredLine, setHoveredLine] = (0, import_react61.useState)();
|
|
14565
|
+
(0, import_react61.useEffect)(() => {
|
|
14410
14566
|
control.reset();
|
|
14411
14567
|
setHovered(void 0);
|
|
14412
14568
|
}, [resetKey]);
|
|
@@ -14469,16 +14625,16 @@ function SvgMapPlot({ source, name, data, x, y, width, height, domain, range = d
|
|
|
14469
14625
|
}
|
|
14470
14626
|
|
|
14471
14627
|
// src/components/ChartRoamController.tsx
|
|
14472
|
-
var
|
|
14628
|
+
var import_react62 = require("react");
|
|
14473
14629
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
14474
14630
|
function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
|
|
14475
|
-
const [hovered, setHovered] = (0,
|
|
14476
|
-
const timer = (0,
|
|
14631
|
+
const [hovered, setHovered] = (0, import_react62.useState)(), [focused, setFocused] = (0, import_react62.useState)();
|
|
14632
|
+
const timer = (0, import_react62.useRef)();
|
|
14477
14633
|
const stop = () => {
|
|
14478
14634
|
if (timer.current !== void 0) clearInterval(timer.current);
|
|
14479
14635
|
timer.current = void 0;
|
|
14480
14636
|
};
|
|
14481
|
-
(0,
|
|
14637
|
+
(0, import_react62.useEffect)(() => {
|
|
14482
14638
|
window.addEventListener("blur", stop);
|
|
14483
14639
|
return () => {
|
|
14484
14640
|
stop();
|
|
@@ -14517,13 +14673,13 @@ function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
|
|
|
14517
14673
|
}
|
|
14518
14674
|
|
|
14519
14675
|
// src/components/LineShareChart.tsx
|
|
14520
|
-
var
|
|
14676
|
+
var import_react82 = require("react");
|
|
14521
14677
|
|
|
14522
14678
|
// src/components/Charts.tsx
|
|
14523
|
-
var
|
|
14679
|
+
var import_react80 = require("react");
|
|
14524
14680
|
|
|
14525
14681
|
// src/components/ChartScatterMotion.tsx
|
|
14526
|
-
var
|
|
14682
|
+
var import_react63 = require("react");
|
|
14527
14683
|
|
|
14528
14684
|
// src/components/scatterMotion.ts
|
|
14529
14685
|
function scatterMotionEase(progress) {
|
|
@@ -14535,9 +14691,9 @@ function scatterMotionEase(progress) {
|
|
|
14535
14691
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
14536
14692
|
function ChartScatterMotion({ x, y, radius, enabled, duration = 2e3, updateDuration = 500, progress, children }) {
|
|
14537
14693
|
const target = { x, y, radius };
|
|
14538
|
-
const [frame, setFrame] = (0,
|
|
14539
|
-
const displayed = (0,
|
|
14540
|
-
(0,
|
|
14694
|
+
const [frame, setFrame] = (0, import_react63.useState)(() => ({ ...target, radius: enabled ? radius * 0.01 : radius }));
|
|
14695
|
+
const displayed = (0, import_react63.useRef)(frame), started = (0, import_react63.useRef)(false);
|
|
14696
|
+
(0, import_react63.useEffect)(() => {
|
|
14541
14697
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
14542
14698
|
let request = 0;
|
|
14543
14699
|
const publish = (next) => {
|
|
@@ -14648,12 +14804,12 @@ function layoutEventRiver(series, tailLength, area) {
|
|
|
14648
14804
|
}
|
|
14649
14805
|
|
|
14650
14806
|
// src/components/EventRiverBubble.tsx
|
|
14651
|
-
var
|
|
14807
|
+
var import_react64 = require("react");
|
|
14652
14808
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
14653
14809
|
function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerUp, ...props }) {
|
|
14654
|
-
const [offset, setOffset] = (0,
|
|
14655
|
-
const drag = (0,
|
|
14656
|
-
(0,
|
|
14810
|
+
const [offset, setOffset] = (0, import_react64.useState)(0);
|
|
14811
|
+
const drag = (0, import_react64.useRef)();
|
|
14812
|
+
(0, import_react64.useEffect)(() => {
|
|
14657
14813
|
setOffset(0);
|
|
14658
14814
|
drag.current = void 0;
|
|
14659
14815
|
}, [resetKey]);
|
|
@@ -14704,13 +14860,13 @@ function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerU
|
|
|
14704
14860
|
}
|
|
14705
14861
|
|
|
14706
14862
|
// src/components/EventRiverMotion.tsx
|
|
14707
|
-
var
|
|
14863
|
+
var import_react65 = require("react");
|
|
14708
14864
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
14709
14865
|
function EventRiverMotion({ geometry, enabled = true, duration = 2e3, updateDuration = 500, progress, children }) {
|
|
14710
|
-
const [frame, setFrame] = (0,
|
|
14711
|
-
const displayed = (0,
|
|
14866
|
+
const [frame, setFrame] = (0, import_react65.useState)(() => ({ ...geometry, scale: enabled ? 0.1 : 1 }));
|
|
14867
|
+
const displayed = (0, import_react65.useRef)(frame), started = (0, import_react65.useRef)(false);
|
|
14712
14868
|
const signature = JSON.stringify(geometry);
|
|
14713
|
-
(0,
|
|
14869
|
+
(0, import_react65.useEffect)(() => {
|
|
14714
14870
|
const preference = window.matchMedia("(prefers-reduced-motion: reduce)"), target = { ...geometry, scale: 1 };
|
|
14715
14871
|
const from = started.current ? displayed.current : { ...geometry, scale: 0.1 };
|
|
14716
14872
|
let request = 0;
|
|
@@ -14827,7 +14983,7 @@ function transferPieValue(series, source, target, connector = " & ") {
|
|
|
14827
14983
|
}
|
|
14828
14984
|
|
|
14829
14985
|
// src/components/ChartValueIsland.tsx
|
|
14830
|
-
var
|
|
14986
|
+
var import_react66 = require("react");
|
|
14831
14987
|
|
|
14832
14988
|
// src/components/cartesianTransfer.ts
|
|
14833
14989
|
function addValues(a, b) {
|
|
@@ -14892,13 +15048,13 @@ function findCompositeValueTarget(element, x, y) {
|
|
|
14892
15048
|
// src/components/ChartValueIsland.tsx
|
|
14893
15049
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
14894
15050
|
function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolveTarget = findCompositeValueTarget }) {
|
|
14895
|
-
const drag = (0,
|
|
14896
|
-
const [offset, setOffset] = (0,
|
|
15051
|
+
const drag = (0, import_react66.useRef)(null);
|
|
15052
|
+
const [offset, setOffset] = (0, import_react66.useState)([0, 0]);
|
|
14897
15053
|
const cancel = () => {
|
|
14898
15054
|
drag.current = null;
|
|
14899
15055
|
setOffset([0, 0]);
|
|
14900
15056
|
};
|
|
14901
|
-
(0,
|
|
15057
|
+
(0, import_react66.useEffect)(cancel, [x, y]);
|
|
14902
15058
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
14903
15059
|
ChartMark,
|
|
14904
15060
|
{
|
|
@@ -14951,12 +15107,12 @@ function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolv
|
|
|
14951
15107
|
}
|
|
14952
15108
|
|
|
14953
15109
|
// src/components/ChartPulseRing.tsx
|
|
14954
|
-
var
|
|
15110
|
+
var import_react67 = require("react");
|
|
14955
15111
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
14956
15112
|
function ChartPulseRing({ center, radius, scaleSize = 2, color = "gold", shadowBlur = 10, period = 15, progress, enabled = true }) {
|
|
14957
|
-
const id = (0,
|
|
14958
|
-
const [reduced, setReduced] = (0,
|
|
14959
|
-
(0,
|
|
15113
|
+
const id = (0, import_react67.useId)().replace(/:/g, ""), [phase, setPhase] = (0, import_react67.useState)(0);
|
|
15114
|
+
const [reduced, setReduced] = (0, import_react67.useState)(false);
|
|
15115
|
+
(0, import_react67.useEffect)(() => {
|
|
14960
15116
|
const preference = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
14961
15117
|
setReduced(preference.matches);
|
|
14962
15118
|
let frame = 0;
|
|
@@ -15100,7 +15256,7 @@ function chartMarkerPath(kind, x, y, size) {
|
|
|
15100
15256
|
}
|
|
15101
15257
|
|
|
15102
15258
|
// src/components/ChartLargeMapPointCanvas.tsx
|
|
15103
|
-
var
|
|
15259
|
+
var import_react68 = require("react");
|
|
15104
15260
|
|
|
15105
15261
|
// src/components/largeMapPointPulse.ts
|
|
15106
15262
|
function largeMapPointPulse(elapsed, period, initial3, delay) {
|
|
@@ -15116,8 +15272,8 @@ function largeMapPointSize(size, pulse) {
|
|
|
15116
15272
|
// src/components/ChartLargeMapPointCanvas.tsx
|
|
15117
15273
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
15118
15274
|
function ChartLargeMapPointCanvas({ groups, width, height }) {
|
|
15119
|
-
const canvas = (0,
|
|
15120
|
-
(0,
|
|
15275
|
+
const canvas = (0, import_react68.useRef)(null), key = JSON.stringify(groups);
|
|
15276
|
+
(0, import_react68.useEffect)(() => {
|
|
15121
15277
|
const element = canvas.current, context = element?.getContext("2d");
|
|
15122
15278
|
if (!element || !context) return;
|
|
15123
15279
|
const ratio = window.devicePixelRatio || 1;
|
|
@@ -15176,12 +15332,12 @@ function ChartLargeMapPointCanvas({ groups, width, height }) {
|
|
|
15176
15332
|
}
|
|
15177
15333
|
|
|
15178
15334
|
// src/components/ChartCrosshair.tsx
|
|
15179
|
-
var
|
|
15335
|
+
var import_react69 = require("react");
|
|
15180
15336
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
15181
15337
|
function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY = decimal }) {
|
|
15182
|
-
const ref = (0,
|
|
15183
|
-
const [point, setPoint] = (0,
|
|
15184
|
-
(0,
|
|
15338
|
+
const ref = (0, import_react69.useRef)(null);
|
|
15339
|
+
const [point, setPoint] = (0, import_react69.useState)(null);
|
|
15340
|
+
(0, import_react69.useEffect)(() => {
|
|
15185
15341
|
const svg = ref.current?.ownerSVGElement;
|
|
15186
15342
|
if (!svg) return;
|
|
15187
15343
|
const clear = () => setPoint(null);
|
|
@@ -15201,7 +15357,7 @@ function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY =
|
|
|
15201
15357
|
svg.removeEventListener("pointercancel", clear);
|
|
15202
15358
|
};
|
|
15203
15359
|
}, [bounds.x, bounds.y, bounds.width, bounds.height]);
|
|
15204
|
-
(0,
|
|
15360
|
+
(0, import_react69.useEffect)(() => setPoint(null), [xDomain[0], xDomain[1], yDomain[0], yDomain[1]]);
|
|
15205
15361
|
const x = point ? xDomain[0] + (point.x - bounds.x) / bounds.width * (xDomain[1] - xDomain[0]) : 0;
|
|
15206
15362
|
const y = point ? yDomain[1] - (point.y - bounds.y) / bounds.height * (yDomain[1] - yDomain[0]) : 0;
|
|
15207
15363
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("g", { ref, className: "sia-chart__crosshair", "aria-hidden": "true", children: [
|
|
@@ -15218,7 +15374,7 @@ function decimal(value) {
|
|
|
15218
15374
|
}
|
|
15219
15375
|
|
|
15220
15376
|
// src/components/HeatmapRasterLayer.tsx
|
|
15221
|
-
var
|
|
15377
|
+
var import_react70 = require("react");
|
|
15222
15378
|
|
|
15223
15379
|
// src/components/heatmapRaster.ts
|
|
15224
15380
|
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] }];
|
|
@@ -15265,9 +15421,9 @@ function rasterizeHeatmap(width, height, points, options = {}) {
|
|
|
15265
15421
|
// src/components/HeatmapRasterLayer.tsx
|
|
15266
15422
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
15267
15423
|
function HeatmapRaster({ width, height, points, options }) {
|
|
15268
|
-
const [url, setUrl] = (0,
|
|
15424
|
+
const [url, setUrl] = (0, import_react70.useState)();
|
|
15269
15425
|
const optionsKey = JSON.stringify(options);
|
|
15270
|
-
(0,
|
|
15426
|
+
(0, import_react70.useEffect)(() => {
|
|
15271
15427
|
const canvas = document.createElement("canvas");
|
|
15272
15428
|
canvas.width = width;
|
|
15273
15429
|
canvas.height = height;
|
|
@@ -15367,10 +15523,10 @@ function chordMatrixLayout(matrix, options = {}) {
|
|
|
15367
15523
|
}
|
|
15368
15524
|
|
|
15369
15525
|
// src/components/MatrixChordPlot.tsx
|
|
15370
|
-
var
|
|
15526
|
+
var import_react71 = require("react");
|
|
15371
15527
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
15372
15528
|
function MatrixChordPlot({ names, matrix, series, appearance, showNodeLabels = false, rotateNodeLabels = false, linkLabel, sort, sortSub, padAngle, clockwise, palette, geometry, legacySubSort = false, showScale = false }) {
|
|
15373
|
-
const [hoveredLink, setHoveredLink] = (0,
|
|
15529
|
+
const [hoveredLink, setHoveredLink] = (0, import_react71.useState)(null);
|
|
15374
15530
|
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;
|
|
15375
15531
|
const point = (angle) => [cx + Math.cos(angle) * r, cy + Math.sin(angle) * r];
|
|
15376
15532
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("g", { className: "sia-chart__matrix-chord", children: [
|
|
@@ -15717,13 +15873,13 @@ function transferRadarSeries(panels, source, target, connector = " & ") {
|
|
|
15717
15873
|
}
|
|
15718
15874
|
|
|
15719
15875
|
// src/components/ChartRoamGroup.tsx
|
|
15720
|
-
var
|
|
15876
|
+
var import_react72 = require("react");
|
|
15721
15877
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
15722
15878
|
var initial2 = { x: 0, y: 0, scale: 1 };
|
|
15723
15879
|
function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true, ariaLabel, resetSignal = 0 }) {
|
|
15724
|
-
const group = (0,
|
|
15725
|
-
const [view, setView] = (0,
|
|
15726
|
-
(0,
|
|
15880
|
+
const group = (0, import_react72.useRef)(null), drag = (0, import_react72.useRef)();
|
|
15881
|
+
const [view, setView] = (0, import_react72.useState)(initial2);
|
|
15882
|
+
(0, import_react72.useEffect)(() => {
|
|
15727
15883
|
setView(initial2);
|
|
15728
15884
|
drag.current = void 0;
|
|
15729
15885
|
}, [resetSignal]);
|
|
@@ -15733,7 +15889,7 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
|
|
|
15733
15889
|
const local = new DOMPoint(clientX, clientY).matrixTransform(matrix.inverse());
|
|
15734
15890
|
return [local.x, local.y];
|
|
15735
15891
|
};
|
|
15736
|
-
(0,
|
|
15892
|
+
(0, import_react72.useEffect)(() => {
|
|
15737
15893
|
const target = group.current;
|
|
15738
15894
|
if (!target || !enabled || !zoomEnabled) return;
|
|
15739
15895
|
const wheel = (event) => {
|
|
@@ -15794,11 +15950,11 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
|
|
|
15794
15950
|
}
|
|
15795
15951
|
|
|
15796
15952
|
// src/components/TreeNodeGlyph.tsx
|
|
15797
|
-
var
|
|
15953
|
+
var import_react73 = require("react");
|
|
15798
15954
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
15799
15955
|
function TreeNodeGlyph({ symbol = "circle", x, y, width, height, color, itemStyle }) {
|
|
15800
|
-
const [failed, setFailed] = (0,
|
|
15801
|
-
(0,
|
|
15956
|
+
const [failed, setFailed] = (0, import_react73.useState)(false);
|
|
15957
|
+
(0, import_react73.useEffect)(() => setFailed(false), [symbol]);
|
|
15802
15958
|
const style = { fill: itemStyle.brushType === "stroke" ? "none" : color, stroke: itemStyle.borderColor, strokeWidth: itemStyle.borderWidth };
|
|
15803
15959
|
if (symbol.startsWith("image://")) return failed ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("g", { role: "img", "aria-label": "\u539F\u59CB\u8282\u70B9\u56FE\u7247\u52A0\u8F7D\u5931\u8D25", children: [
|
|
15804
15960
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("rect", { x: x - width / 2, y: y - height / 2, width, height, fill: "none", stroke: "#999", strokeDasharray: "3 3" }),
|
|
@@ -16087,7 +16243,7 @@ function resolveMapRegionAppearance(base, datum, emphasized) {
|
|
|
16087
16243
|
}
|
|
16088
16244
|
|
|
16089
16245
|
// src/components/ChartBundledMapCanvas.tsx
|
|
16090
|
-
var
|
|
16246
|
+
var import_react74 = require("react");
|
|
16091
16247
|
|
|
16092
16248
|
// src/components/edgeBundling.ts
|
|
16093
16249
|
var distance = (a, b) => Math.hypot(a[0] - b[0], a[1] - b[1]);
|
|
@@ -16231,9 +16387,9 @@ function sampleBundledPath(curves, progress) {
|
|
|
16231
16387
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
16232
16388
|
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 }) {
|
|
16233
16389
|
const signature = JSON.stringify(edges), pointKey = JSON.stringify(points), effectKey = JSON.stringify(effect);
|
|
16234
|
-
const paths = (0,
|
|
16235
|
-
const base = (0,
|
|
16236
|
-
(0,
|
|
16390
|
+
const paths = (0, import_react74.useMemo)(() => bundleEdges(JSON.parse(signature)).map((row) => ({ index: row.index, curves: smoothBundledPath(row.points, smoothness) })), [signature, smoothness]);
|
|
16391
|
+
const base = (0, import_react74.useRef)(null), moving = (0, import_react74.useRef)(null);
|
|
16392
|
+
(0, import_react74.useEffect)(() => {
|
|
16237
16393
|
const node = base.current, ctx = node?.getContext("2d");
|
|
16238
16394
|
if (!node || !ctx) return;
|
|
16239
16395
|
const ratio = window.devicePixelRatio || 1;
|
|
@@ -16259,7 +16415,7 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
|
|
|
16259
16415
|
ctx.fill();
|
|
16260
16416
|
}
|
|
16261
16417
|
}, [paths, pointKey, width, height, color, opacity, lineWidth, pointColor, pointRadius]);
|
|
16262
|
-
(0,
|
|
16418
|
+
(0, import_react74.useEffect)(() => {
|
|
16263
16419
|
const node = moving.current, ctx = node?.getContext("2d");
|
|
16264
16420
|
if (!node || !ctx) return;
|
|
16265
16421
|
const ratio = window.devicePixelRatio || 1;
|
|
@@ -16321,11 +16477,11 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
|
|
|
16321
16477
|
}
|
|
16322
16478
|
|
|
16323
16479
|
// src/components/ChartMapEffectCanvas.tsx
|
|
16324
|
-
var
|
|
16480
|
+
var import_react75 = require("react");
|
|
16325
16481
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
16326
16482
|
function ChartMapEffectCanvas({ effects, width, height, alpha = 0.95 }) {
|
|
16327
|
-
const canvas = (0,
|
|
16328
|
-
(0,
|
|
16483
|
+
const canvas = (0, import_react75.useRef)(null), key = JSON.stringify(effects);
|
|
16484
|
+
(0, import_react75.useEffect)(() => {
|
|
16329
16485
|
const element = canvas.current;
|
|
16330
16486
|
if (!element) return;
|
|
16331
16487
|
const context = element.getContext("2d");
|
|
@@ -16471,12 +16627,12 @@ function layoutTreeNodes(root, options = {}) {
|
|
|
16471
16627
|
}
|
|
16472
16628
|
|
|
16473
16629
|
// src/components/ChartDataEditor.tsx
|
|
16474
|
-
var
|
|
16630
|
+
var import_react76 = require("react");
|
|
16475
16631
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
16476
16632
|
function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false }) {
|
|
16477
|
-
const [draft, setDraft] = (0,
|
|
16478
|
-
const [error, setError] = (0,
|
|
16479
|
-
const [applied, setApplied] = (0,
|
|
16633
|
+
const [draft, setDraft] = (0, import_react76.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
|
|
16634
|
+
const [error, setError] = (0, import_react76.useState)("");
|
|
16635
|
+
const [applied, setApplied] = (0, import_react76.useState)(false);
|
|
16480
16636
|
function apply() {
|
|
16481
16637
|
try {
|
|
16482
16638
|
const values = JSON.parse(draft);
|
|
@@ -16507,11 +16663,11 @@ function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false
|
|
|
16507
16663
|
}
|
|
16508
16664
|
|
|
16509
16665
|
// src/components/ChartBarStatistics.tsx
|
|
16510
|
-
var
|
|
16666
|
+
var import_react77 = require("react");
|
|
16511
16667
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
16512
16668
|
function ChartBarStatistics({ values, kinds, project, plot, horizontal, color, gradient, seriesName }) {
|
|
16513
|
-
const id = (0,
|
|
16514
|
-
const [active, setActive] = (0,
|
|
16669
|
+
const id = (0, import_react77.useId)().replaceAll(":", "");
|
|
16670
|
+
const [active, setActive] = (0, import_react77.useState)();
|
|
16515
16671
|
const paint = gradient ? `url(#${id})` : color;
|
|
16516
16672
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("g", { children: [
|
|
16517
16673
|
gradient ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime80.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_runtime80.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
|
|
@@ -16566,7 +16722,7 @@ function lineSegments(points) {
|
|
|
16566
16722
|
}
|
|
16567
16723
|
|
|
16568
16724
|
// src/components/useBarMagicState.ts
|
|
16569
|
-
var
|
|
16725
|
+
var import_react78 = require("react");
|
|
16570
16726
|
|
|
16571
16727
|
// src/components/cartesianMagicState.ts
|
|
16572
16728
|
function changeCartesianMagic(state, action) {
|
|
@@ -16581,8 +16737,8 @@ function changeCartesianMagic(state, action) {
|
|
|
16581
16737
|
function useBarMagicState(toolbox, shape = "bar") {
|
|
16582
16738
|
const initial3 = { shape, layout: "original" };
|
|
16583
16739
|
const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
|
|
16584
|
-
const [state, setState] = (0,
|
|
16585
|
-
(0,
|
|
16740
|
+
const [state, setState] = (0, import_react78.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
|
|
16741
|
+
(0, import_react78.useEffect)(() => {
|
|
16586
16742
|
if (options?.activeMagicType) setState((s) => changeCartesianMagic(s, options.activeMagicType));
|
|
16587
16743
|
}, [options?.activeMagicType]);
|
|
16588
16744
|
const resolved = options ? { ...options, activeMagicType: state.shape, activeMagicTypes: options.activeMagicTypes ?? (state.layout === "original" ? [state.shape] : [state.shape, state.layout]), onMagicTypeChange: (action) => {
|
|
@@ -16596,7 +16752,7 @@ function useBarMagicState(toolbox, shape = "bar") {
|
|
|
16596
16752
|
}
|
|
16597
16753
|
|
|
16598
16754
|
// src/components/useBarValueTransfer.ts
|
|
16599
|
-
var
|
|
16755
|
+
var import_react79 = require("react");
|
|
16600
16756
|
|
|
16601
16757
|
// src/components/barTransfer.ts
|
|
16602
16758
|
function transferBarValue(series, source, target, categories) {
|
|
@@ -16613,10 +16769,10 @@ function transferBarValue(series, source, target, categories) {
|
|
|
16613
16769
|
|
|
16614
16770
|
// src/components/useBarValueTransfer.ts
|
|
16615
16771
|
function useBarValueTransfer(series, initial3, categories, enabled, publish, onError) {
|
|
16616
|
-
const [islands, setIslands] = (0,
|
|
16617
|
-
const drag = (0,
|
|
16618
|
-
const [offset, setOffset] = (0,
|
|
16619
|
-
(0,
|
|
16772
|
+
const [islands, setIslands] = (0, import_react79.useState)([]);
|
|
16773
|
+
const drag = (0, import_react79.useRef)();
|
|
16774
|
+
const [offset, setOffset] = (0, import_react79.useState)();
|
|
16775
|
+
(0, import_react79.useEffect)(() => {
|
|
16620
16776
|
setIslands([]);
|
|
16621
16777
|
drag.current = void 0;
|
|
16622
16778
|
setOffset(void 0);
|
|
@@ -16717,12 +16873,12 @@ function logarithmicValueAt(progress, domain) {
|
|
|
16717
16873
|
|
|
16718
16874
|
// src/components/Charts.tsx
|
|
16719
16875
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
16720
|
-
var
|
|
16876
|
+
var import_react81 = require("react");
|
|
16721
16877
|
var PLOT = { x: 62, y: 48, width: 628, height: 250 };
|
|
16722
16878
|
var PLOT_BOTTOM = PLOT.y + PLOT.height;
|
|
16723
16879
|
function useLegendSelection(names, controlled, onChange) {
|
|
16724
|
-
const [internal, setInternal] = (0,
|
|
16725
|
-
(0,
|
|
16880
|
+
const [internal, setInternal] = (0, import_react80.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
|
|
16881
|
+
(0, import_react80.useEffect)(() => {
|
|
16726
16882
|
setInternal((current) => {
|
|
16727
16883
|
const next = { ...current };
|
|
16728
16884
|
names.forEach((name) => {
|
|
@@ -16822,7 +16978,7 @@ function lineSymbol(type, x, y, size, color, image, strokeWidth = 2) {
|
|
|
16822
16978
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("circle", { cx: x, cy: y, r: size / 2, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 });
|
|
16823
16979
|
}
|
|
16824
16980
|
function useZoom(value, defaultValue, onChange) {
|
|
16825
|
-
const [internal, setInternal] = (0,
|
|
16981
|
+
const [internal, setInternal] = (0, import_react80.useState)([...defaultValue ?? [0, 100]]);
|
|
16826
16982
|
const current = value ?? internal;
|
|
16827
16983
|
const update = (next) => {
|
|
16828
16984
|
if (!value) setInternal(next);
|
|
@@ -16832,8 +16988,8 @@ function useZoom(value, defaultValue, onChange) {
|
|
|
16832
16988
|
}
|
|
16833
16989
|
function useToolboxMagicType(toolbox, fallback) {
|
|
16834
16990
|
const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
|
|
16835
|
-
const [internal, setInternal] = (0,
|
|
16836
|
-
(0,
|
|
16991
|
+
const [internal, setInternal] = (0, import_react80.useState)(options?.activeMagicType ?? fallback);
|
|
16992
|
+
(0, import_react80.useEffect)(() => {
|
|
16837
16993
|
if (options?.activeMagicType) setInternal(options.activeMagicType);
|
|
16838
16994
|
}, [options?.activeMagicType]);
|
|
16839
16995
|
const active = options?.activeMagicType ?? internal;
|
|
@@ -16851,15 +17007,15 @@ function useToolboxMagicType(toolbox, fallback) {
|
|
|
16851
17007
|
} : toolbox;
|
|
16852
17008
|
return [active, resolved];
|
|
16853
17009
|
}
|
|
16854
|
-
var LineChart = (0,
|
|
16855
|
-
const [hoverIndex, setHoverIndex] = (0,
|
|
16856
|
-
const [editableSeries, setEditableSeries] = (0,
|
|
16857
|
-
const [dragPoint, setDragPoint] = (0,
|
|
16858
|
-
const linePaintId = (0,
|
|
16859
|
-
const [hoveredLinePoint, setHoveredLinePoint] = (0,
|
|
16860
|
-
(0,
|
|
17010
|
+
var LineChart = (0, import_react80.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) {
|
|
17011
|
+
const [hoverIndex, setHoverIndex] = (0, import_react80.useState)(null);
|
|
17012
|
+
const [editableSeries, setEditableSeries] = (0, import_react80.useState)(sourceSeries);
|
|
17013
|
+
const [dragPoint, setDragPoint] = (0, import_react80.useState)(null);
|
|
17014
|
+
const linePaintId = (0, import_react80.useId)().replaceAll(":", "");
|
|
17015
|
+
const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react80.useState)();
|
|
17016
|
+
(0, import_react80.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
|
|
16861
17017
|
const series = externalValueTransfer ? sourceSeries : editableSeries;
|
|
16862
|
-
const initialTransferSeries = (0,
|
|
17018
|
+
const initialTransferSeries = (0, import_react80.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
|
|
16863
17019
|
const localTransfer = useBarValueTransfer(series.map((item) => ({ ...item, data: item.data.map(lineValue) })), initialTransferSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (nextBars) => {
|
|
16864
17020
|
const next = series.map((item, row) => ({ ...item, data: item.data.map((datum, index) => {
|
|
16865
17021
|
const value = barDatum(nextBars[row].data[index]).value;
|
|
@@ -16876,8 +17032,8 @@ var LineChart = (0, import_react79.forwardRef)(function LineChart2({ calculableM
|
|
|
16876
17032
|
const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
16877
17033
|
const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
|
|
16878
17034
|
const inlineZoom = dataZoom && zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("foreignObject", { className: "sia-chart__inline-zoom sia-chart__inline-zoom--compact", ...zoomControlBounds, children: /* @__PURE__ */ (0, import_jsx_runtime81.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;
|
|
16879
|
-
const [zoomBrushActive, setZoomBrushActive] = (0,
|
|
16880
|
-
const [zoomHistory, setZoomHistory] = (0,
|
|
17035
|
+
const [zoomBrushActive, setZoomBrushActive] = (0, import_react80.useState)(false);
|
|
17036
|
+
const [zoomHistory, setZoomHistory] = (0, import_react80.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
|
|
16881
17037
|
const zoomBrush = dataZoom && zoomBrushActive ? { minSelectionSize: zoomMinSelectionSize, selectionStyle: zoomSelectionStyle, selectionShape: zoomSelectionShape, bounds: PLOT2, onCancel: () => setZoomBrushActive(false), onSelect: (range) => {
|
|
16882
17038
|
const start = Math.min(...zoomValue), span = Math.max(...zoomValue) - start;
|
|
16883
17039
|
const next = [start + range[0] * span, start + range[1] * span];
|
|
@@ -17264,17 +17420,17 @@ function ChartPin({ point, color, label }) {
|
|
|
17264
17420
|
function barDatum(datum) {
|
|
17265
17421
|
return typeof datum === "number" ? { value: datum } : datum;
|
|
17266
17422
|
}
|
|
17267
|
-
var BarChart = (0,
|
|
17268
|
-
const [editableSeries, setEditableSeries] = (0,
|
|
17269
|
-
const [dragBar, setDragBar] = (0,
|
|
17270
|
-
const [hoveredBar, setHoveredBar] = (0,
|
|
17271
|
-
const barPaintId = (0,
|
|
17423
|
+
var BarChart = (0, import_react80.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) {
|
|
17424
|
+
const [editableSeries, setEditableSeries] = (0, import_react80.useState)(sourceSeries);
|
|
17425
|
+
const [dragBar, setDragBar] = (0, import_react80.useState)(null);
|
|
17426
|
+
const [hoveredBar, setHoveredBar] = (0, import_react80.useState)();
|
|
17427
|
+
const barPaintId = (0, import_react80.useId)().replaceAll(":", "");
|
|
17272
17428
|
const localTransfer = useBarValueTransfer(editableSeries, sourceSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (next) => {
|
|
17273
17429
|
setEditableSeries(next);
|
|
17274
17430
|
onDataChange?.(next);
|
|
17275
17431
|
}, onTransferError);
|
|
17276
17432
|
const transfer = externalValueTransfer ?? localTransfer;
|
|
17277
|
-
(0,
|
|
17433
|
+
(0, import_react80.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
|
|
17278
17434
|
const series = externalValueTransfer ? sourceSeries : editableSeries;
|
|
17279
17435
|
const legacy = appearance === "macarons";
|
|
17280
17436
|
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 };
|
|
@@ -17521,17 +17677,17 @@ var BarChart = (0, import_react79.forwardRef)(function BarChart2({ valueTransfer
|
|
|
17521
17677
|
] }, `bar-island-${index}`)) : null
|
|
17522
17678
|
] });
|
|
17523
17679
|
});
|
|
17524
|
-
var ScatterChart = (0,
|
|
17525
|
-
const [data, setData] = (0,
|
|
17526
|
-
const [emphasizedPoint, setEmphasizedPoint] = (0,
|
|
17527
|
-
const [emphasizedAnnotation, setEmphasizedAnnotation] = (0,
|
|
17528
|
-
(0,
|
|
17680
|
+
var ScatterChart = (0, import_react80.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) {
|
|
17681
|
+
const [data, setData] = (0, import_react80.useState)(initialData);
|
|
17682
|
+
const [emphasizedPoint, setEmphasizedPoint] = (0, import_react80.useState)(null);
|
|
17683
|
+
const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react80.useState)();
|
|
17684
|
+
(0, import_react80.useEffect)(() => setData(initialData), [initialData]);
|
|
17529
17685
|
const plot = plotBounds ?? PLOT, bottom = plot.y + plot.height;
|
|
17530
17686
|
const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
|
|
17531
17687
|
const allCategories = [...new Set(data.map((item) => item.category).filter((value) => Boolean(value)))];
|
|
17532
17688
|
const legend = useLegendSelection(allCategories, legendSelected, onLegendSelectionChange);
|
|
17533
17689
|
const activeData = data.filter((item) => !item.category || legend.isSelected(item.category));
|
|
17534
|
-
const sorted = (0,
|
|
17690
|
+
const sorted = (0, import_react80.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
|
|
17535
17691
|
const startIndex = dataZoom ? Math.floor(Math.min(...zoomValue) / 100 * Math.max(0, sorted.length - 1)) : 0;
|
|
17536
17692
|
const endIndex = dataZoom ? Math.max(startIndex + 1, Math.ceil(Math.max(...zoomValue) / 100 * sorted.length)) : sorted.length;
|
|
17537
17693
|
const categoryWindow = xCategories ? scatterCategoryWindow(xCategories, dataZoom ? zoomValue : [0, 100]) : void 0;
|
|
@@ -17546,10 +17702,10 @@ var ScatterChart = (0, import_react79.forwardRef)(function ScatterChart2({ symbo
|
|
|
17546
17702
|
const visualMinimum = visualMap?.min ?? (visualValues.length ? Math.min(...visualValues) : 0);
|
|
17547
17703
|
const visualMaximum = visualMap?.max ?? (visualValues.length ? Math.max(...visualValues) : 1);
|
|
17548
17704
|
const visualColors = visualMap?.colors ?? ["#e6f4ff", "#1677ff"];
|
|
17549
|
-
const [selectedPieces, setSelectedPieces] = (0,
|
|
17550
|
-
const [visualRange, setVisualRange] = (0,
|
|
17705
|
+
const [selectedPieces, setSelectedPieces] = (0, import_react80.useState)([]);
|
|
17706
|
+
const [visualRange, setVisualRange] = (0, import_react80.useState)();
|
|
17551
17707
|
const piecesKey = JSON.stringify(visualMap?.pieces ?? []);
|
|
17552
|
-
(0,
|
|
17708
|
+
(0, import_react80.useEffect)(() => setSelectedPieces([]), [piecesKey]);
|
|
17553
17709
|
const statistics = scatterStatistics(visibleData, markByCategory);
|
|
17554
17710
|
const plotted = visibleData.map((item, index) => {
|
|
17555
17711
|
const x = linearScale(categoryWindow ? categoryWindow.indexOf(item.x) : item.x, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]);
|
|
@@ -17707,8 +17863,8 @@ var ScatterChart = (0, import_react79.forwardRef)(function ScatterChart2({ symbo
|
|
|
17707
17863
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ChartDataZoom, { value: zoomValue, onChange: setZoomValue })
|
|
17708
17864
|
] }) : content;
|
|
17709
17865
|
});
|
|
17710
|
-
var CandlestickChart = (0,
|
|
17711
|
-
const [data, setData] = (0,
|
|
17866
|
+
var CandlestickChart = (0, import_react80.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) {
|
|
17867
|
+
const [data, setData] = (0, import_react80.useState)(initialData), [internalActive, setInternalActive] = (0, import_react80.useState)(null), [internalVisible, setInternalVisible] = (0, import_react80.useState)(true);
|
|
17712
17868
|
const active = activeIndex === void 0 ? internalActive : activeIndex;
|
|
17713
17869
|
const seriesVisible = controlledVisible ?? internalVisible;
|
|
17714
17870
|
const setActive = (index) => {
|
|
@@ -17719,7 +17875,7 @@ var CandlestickChart = (0, import_react79.forwardRef)(function CandlestickChart2
|
|
|
17719
17875
|
if (controlledVisible === void 0) setInternalVisible(visible);
|
|
17720
17876
|
onSeriesVisibilityChange?.(visible);
|
|
17721
17877
|
};
|
|
17722
|
-
(0,
|
|
17878
|
+
(0, import_react80.useEffect)(() => {
|
|
17723
17879
|
setData(initialData);
|
|
17724
17880
|
}, [initialData]);
|
|
17725
17881
|
const legacy = appearance === "macarons";
|
|
@@ -17810,20 +17966,20 @@ var CandlestickChart = (0, import_react79.forwardRef)(function CandlestickChart2
|
|
|
17810
17966
|
] }) : content;
|
|
17811
17967
|
});
|
|
17812
17968
|
var EMPTY_PIE_DATA = [];
|
|
17813
|
-
var PieChart = (0,
|
|
17814
|
-
const pieGradientId = (0,
|
|
17815
|
-
const [pieIslands, setPieIslands] = (0,
|
|
17816
|
-
const sourceRings = (0,
|
|
17817
|
-
const [editableRings, setEditableRings] = (0,
|
|
17818
|
-
const valueDrag = (0,
|
|
17819
|
-
const [valueOffset, setValueOffset] = (0,
|
|
17820
|
-
(0,
|
|
17969
|
+
var PieChart = (0, import_react80.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) {
|
|
17970
|
+
const pieGradientId = (0, import_react80.useId)().replace(/:/g, "");
|
|
17971
|
+
const [pieIslands, setPieIslands] = (0, import_react80.useState)([]);
|
|
17972
|
+
const sourceRings = (0, import_react80.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
|
|
17973
|
+
const [editableRings, setEditableRings] = (0, import_react80.useState)(sourceRings);
|
|
17974
|
+
const valueDrag = (0, import_react80.useRef)(null);
|
|
17975
|
+
const [valueOffset, setValueOffset] = (0, import_react80.useState)();
|
|
17976
|
+
(0, import_react80.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
|
|
17821
17977
|
const allData = editableRings.flatMap((ring) => ring.data).filter((item) => !item.missing);
|
|
17822
17978
|
const names = [...new Set(allData.map((item) => item.name))];
|
|
17823
17979
|
const legend = useLegendSelection(names, legendSelected, onLegendSelectionChange);
|
|
17824
17980
|
const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u997C\u56FE");
|
|
17825
|
-
const [hovered, setHovered] = (0,
|
|
17826
|
-
const [internalSelected, setInternalSelected] = (0,
|
|
17981
|
+
const [hovered, setHovered] = (0, import_react80.useState)();
|
|
17982
|
+
const [internalSelected, setInternalSelected] = (0, import_react80.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
|
|
17827
17983
|
const selectedNames = selected ?? internalSelected;
|
|
17828
17984
|
const legacy = appearance === "macarons";
|
|
17829
17985
|
const colorNames = [...new Set(allData.filter((item) => item.showInLegend !== false).map((item) => item.name))];
|
|
@@ -18043,15 +18199,15 @@ var PieChart = (0, import_react79.forwardRef)(function PieChart2({ pulseRing, ca
|
|
|
18043
18199
|
});
|
|
18044
18200
|
var EMPTY_RADAR_INDICATORS = [];
|
|
18045
18201
|
var EMPTY_RADAR_SERIES = [];
|
|
18046
|
-
var RadarChart = (0,
|
|
18202
|
+
var RadarChart = (0, import_react80.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) {
|
|
18047
18203
|
const legacy = appearance === "macarons";
|
|
18048
|
-
const initialPanels = (0,
|
|
18049
|
-
const [sourcePanels, setSourcePanels] = (0,
|
|
18050
|
-
const [hoveredRadar, setHoveredRadar] = (0,
|
|
18051
|
-
const radarPaintId = `sia-radar-${(0,
|
|
18052
|
-
const radarDrag = (0,
|
|
18053
|
-
const [radarOffset, setRadarOffset] = (0,
|
|
18054
|
-
(0,
|
|
18204
|
+
const initialPanels = (0, import_react80.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
|
|
18205
|
+
const [sourcePanels, setSourcePanels] = (0, import_react80.useState)(initialPanels);
|
|
18206
|
+
const [hoveredRadar, setHoveredRadar] = (0, import_react80.useState)(null);
|
|
18207
|
+
const radarPaintId = `sia-radar-${(0, import_react80.useId)().replaceAll(":", "")}`;
|
|
18208
|
+
const radarDrag = (0, import_react80.useRef)(null);
|
|
18209
|
+
const [radarOffset, setRadarOffset] = (0, import_react80.useState)(null);
|
|
18210
|
+
(0, import_react80.useEffect)(() => {
|
|
18055
18211
|
setSourcePanels(initialPanels);
|
|
18056
18212
|
radarDrag.current = null;
|
|
18057
18213
|
setRadarOffset(null);
|
|
@@ -18205,7 +18361,7 @@ var RadarChart = (0, import_react79.forwardRef)(function RadarChart2({ indicator
|
|
|
18205
18361
|
})
|
|
18206
18362
|
] });
|
|
18207
18363
|
});
|
|
18208
|
-
var ChordChart = (0,
|
|
18364
|
+
var ChordChart = (0, import_react80.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) {
|
|
18209
18365
|
const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u548C\u5F26");
|
|
18210
18366
|
if (/force|力导向|关系/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
18211
18367
|
GraphChart,
|
|
@@ -18278,11 +18434,11 @@ var ChordChart = (0, import_react79.forwardRef)(function ChordChart2({ nodes, li
|
|
|
18278
18434
|
})
|
|
18279
18435
|
] });
|
|
18280
18436
|
});
|
|
18281
|
-
var GraphChart = (0,
|
|
18437
|
+
var GraphChart = (0, import_react80.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) {
|
|
18282
18438
|
const categories = [...new Set(nodes.map((node) => node.category).filter((value) => Boolean(value)))];
|
|
18283
18439
|
const legend = useLegendSelection(categories, legendSelected, onLegendSelectionChange);
|
|
18284
18440
|
const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, layout === "force" ? "\u529B\u5BFC\u5411" : "\u5173\u7CFB");
|
|
18285
|
-
const [roamReset, setRoamReset] = (0,
|
|
18441
|
+
const [roamReset, setRoamReset] = (0, import_react80.useState)(0);
|
|
18286
18442
|
const chartToolbox = typeof resolvedToolbox === "object" ? {
|
|
18287
18443
|
...resolvedToolbox,
|
|
18288
18444
|
onRestore: () => {
|
|
@@ -18291,23 +18447,23 @@ var GraphChart = (0, import_react79.forwardRef)(function GraphChart2({ nodes, li
|
|
|
18291
18447
|
resolvedToolbox.onRestore?.();
|
|
18292
18448
|
}
|
|
18293
18449
|
} : resolvedToolbox;
|
|
18294
|
-
const activeNodes = (0,
|
|
18295
|
-
const activeLinks = (0,
|
|
18450
|
+
const activeNodes = (0, import_react80.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
|
|
18451
|
+
const activeLinks = (0, import_react80.useMemo)(() => {
|
|
18296
18452
|
const activeIds = new Set(activeNodes.map((node) => node.id));
|
|
18297
18453
|
return links.filter((link) => activeIds.has(link.source) && activeIds.has(link.target));
|
|
18298
18454
|
}, [activeNodes, links]);
|
|
18299
18455
|
const progressive = progressiveForce && layout === "force" && props.animation !== false && !/chord|和弦/i.test(magicType);
|
|
18300
|
-
const calculatedPositions = (0,
|
|
18301
|
-
const [positions, setPositions] = (0,
|
|
18302
|
-
const [dragging, setDragging] = (0,
|
|
18303
|
-
const heldNode = (0,
|
|
18304
|
-
const [forceRestart, setForceRestart] = (0,
|
|
18305
|
-
(0,
|
|
18456
|
+
const calculatedPositions = (0, import_react80.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
|
|
18457
|
+
const [positions, setPositions] = (0, import_react80.useState)(calculatedPositions);
|
|
18458
|
+
const [dragging, setDragging] = (0, import_react80.useState)(null);
|
|
18459
|
+
const heldNode = (0, import_react80.useRef)(null);
|
|
18460
|
+
const [forceRestart, setForceRestart] = (0, import_react80.useState)(0);
|
|
18461
|
+
(0, import_react80.useEffect)(() => {
|
|
18306
18462
|
setPositions(calculatedPositions);
|
|
18307
18463
|
setDragging(null);
|
|
18308
18464
|
heldNode.current = null;
|
|
18309
18465
|
}, [calculatedPositions, roamReset]);
|
|
18310
|
-
(0,
|
|
18466
|
+
(0, import_react80.useEffect)(() => {
|
|
18311
18467
|
if (!progressive || activeNodes.length > (forceOptions?.maxNodes ?? 80)) return;
|
|
18312
18468
|
let frame = 0, remaining = Math.max(0, forceOptions?.iterations ?? 140), previous, carry = 0;
|
|
18313
18469
|
const tick = (time) => {
|
|
@@ -18425,7 +18581,7 @@ var GraphChart = (0, import_react79.forwardRef)(function GraphChart2({ nodes, li
|
|
|
18425
18581
|
] })
|
|
18426
18582
|
] });
|
|
18427
18583
|
});
|
|
18428
|
-
var ForceGraphChart = (0,
|
|
18584
|
+
var ForceGraphChart = (0, import_react80.forwardRef)(function ForceGraphChart2(props, ref) {
|
|
18429
18585
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(GraphChart, { ...props, layout: "force", ref });
|
|
18430
18586
|
});
|
|
18431
18587
|
var ForceChart = ForceGraphChart;
|
|
@@ -18454,12 +18610,12 @@ function colorBetween(start, end, ratio) {
|
|
|
18454
18610
|
const to = read(end);
|
|
18455
18611
|
return `rgb(${from.map((value, index) => Math.round(value + ((to[index] ?? value) - value) * Math.max(0, Math.min(1, ratio)))).join(" ")})`;
|
|
18456
18612
|
}
|
|
18457
|
-
var MapChart = (0,
|
|
18458
|
-
const [internalSelected, setInternalSelected] = (0,
|
|
18613
|
+
var MapChart = (0, import_react80.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) {
|
|
18614
|
+
const [internalSelected, setInternalSelected] = (0, import_react80.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
|
|
18459
18615
|
const selectedNames = selected ?? internalSelected;
|
|
18460
|
-
const [hoveredRegion, setHoveredRegion] = (0,
|
|
18461
|
-
const [hoveredMarkPoint, setHoveredMarkPoint] = (0,
|
|
18462
|
-
const [internalHoveredValueRange, setHoveredValueRange] = (0,
|
|
18616
|
+
const [hoveredRegion, setHoveredRegion] = (0, import_react80.useState)();
|
|
18617
|
+
const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react80.useState)();
|
|
18618
|
+
const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react80.useState)();
|
|
18463
18619
|
const hoveredValueRange = emphasisValueRange ?? internalHoveredValueRange;
|
|
18464
18620
|
const roamControl = useMapRoam(roam, scaleLimit, wheelZoomFactors);
|
|
18465
18621
|
const { view } = roamControl;
|
|
@@ -18474,8 +18630,8 @@ var MapChart = (0, import_react79.forwardRef)(function MapChart2({ overlayProjec
|
|
|
18474
18630
|
const values = data.map((item) => item.value);
|
|
18475
18631
|
const minimum = valueDomain?.[0] ?? (values.length ? Math.min(...values) : 0);
|
|
18476
18632
|
const maximum = valueDomain?.[1] ?? (values.length ? Math.max(...values) : 1);
|
|
18477
|
-
const [internalVisualRange, setInternalVisualRange] = (0,
|
|
18478
|
-
(0,
|
|
18633
|
+
const [internalVisualRange, setInternalVisualRange] = (0, import_react80.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
|
|
18634
|
+
(0, import_react80.useEffect)(() => {
|
|
18479
18635
|
if (!visualRange && !defaultVisualRange) setInternalVisualRange([minimum, maximum]);
|
|
18480
18636
|
}, [defaultVisualRange, maximum, minimum, visualRange]);
|
|
18481
18637
|
const currentVisualRange = visualRange ?? internalVisualRange;
|
|
@@ -18651,7 +18807,7 @@ var MapChart = (0, import_react79.forwardRef)(function MapChart2({ overlayProjec
|
|
|
18651
18807
|
roamController ? /* @__PURE__ */ (0, import_jsx_runtime81.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
|
|
18652
18808
|
] });
|
|
18653
18809
|
});
|
|
18654
|
-
var GaugeChart = (0,
|
|
18810
|
+
var GaugeChart = (0, import_react80.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) {
|
|
18655
18811
|
const count = Math.max(1, data.length);
|
|
18656
18812
|
const legacy = appearance === "macarons";
|
|
18657
18813
|
return /* @__PURE__ */ (0, import_jsx_runtime81.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) => {
|
|
@@ -18734,12 +18890,12 @@ var GaugeChart = (0, import_react79.forwardRef)(function GaugeChart2({ tooltipFo
|
|
|
18734
18890
|
] }, `${item.name}-${index}`);
|
|
18735
18891
|
}) });
|
|
18736
18892
|
});
|
|
18737
|
-
var FunnelChart = (0,
|
|
18893
|
+
var FunnelChart = (0, import_react80.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) {
|
|
18738
18894
|
const legacy = appearance === "macarons";
|
|
18739
|
-
const [activeFunnel, setActiveFunnel] = (0,
|
|
18740
|
-
const initialFunnels = (0,
|
|
18741
|
-
const [sourceFunnels, setSourceFunnels] = (0,
|
|
18742
|
-
(0,
|
|
18895
|
+
const [activeFunnel, setActiveFunnel] = (0, import_react80.useState)(null);
|
|
18896
|
+
const initialFunnels = (0, import_react80.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
|
|
18897
|
+
const [sourceFunnels, setSourceFunnels] = (0, import_react80.useState)(initialFunnels);
|
|
18898
|
+
(0, import_react80.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
|
|
18743
18899
|
const allData = sourceFunnels.flatMap((funnel) => funnel.data);
|
|
18744
18900
|
const legendData = [...new Map(allData.map((item) => [item.name, item])).values()];
|
|
18745
18901
|
const legend = useLegendSelection(legendData.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
@@ -18830,7 +18986,7 @@ var FunnelChart = (0, import_react79.forwardRef)(function FunnelChart2({ data =
|
|
|
18830
18986
|
})
|
|
18831
18987
|
] });
|
|
18832
18988
|
});
|
|
18833
|
-
var HeatmapChart = (0,
|
|
18989
|
+
var HeatmapChart = (0, import_react80.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) {
|
|
18834
18990
|
const pointMode = points.length > 0;
|
|
18835
18991
|
const values = pointMode ? points.map((point) => point.value) : data.flatMap((row) => [...row]);
|
|
18836
18992
|
const minimum = values.length ? Math.min(...values) : 0;
|
|
@@ -18839,7 +18995,7 @@ var HeatmapChart = (0, import_react79.forwardRef)(function HeatmapChart2({ raste
|
|
|
18839
18995
|
const cellHeight = PLOT.height / Math.max(1, yLabels.length);
|
|
18840
18996
|
const pointXDomain = niceChartDomain(points.map((point) => point.x), false);
|
|
18841
18997
|
const pointYDomain = niceChartDomain(points.map((point) => point.y), false);
|
|
18842
|
-
const filterId = `sia-heat-${(0,
|
|
18998
|
+
const filterId = `sia-heat-${(0, import_react80.useId)().replaceAll(":", "")}`;
|
|
18843
18999
|
if (raster) return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(SiaChart, { ...props, ref, empty: !points.length, ariaLabel: props.ariaLabel ?? "\u50CF\u7D20\u70ED\u529B\u56FE", children: [
|
|
18844
19000
|
raster.backgroundImage ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("image", { href: raster.backgroundImage, x: 0, y: 0, width: raster.width, height: raster.height, preserveAspectRatio: "none", pointerEvents: "none" }) : null,
|
|
18845
19001
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(HeatmapRaster, { width: raster.width, height: raster.height, points, options: raster })
|
|
@@ -18875,7 +19031,7 @@ var HeatmapChart = (0, import_react79.forwardRef)(function HeatmapChart2({ raste
|
|
|
18875
19031
|
] })
|
|
18876
19032
|
] });
|
|
18877
19033
|
});
|
|
18878
|
-
var ThemeRiverChart = (0,
|
|
19034
|
+
var ThemeRiverChart = (0, import_react80.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
|
|
18879
19035
|
const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
18880
19036
|
const activeSeries = series.filter((item) => legend.isSelected(item.name));
|
|
18881
19037
|
const totals = categories.map((_, index) => activeSeries.reduce((sum, item) => sum + Math.max(0, item.data[index] ?? 0), 0));
|
|
@@ -18913,8 +19069,8 @@ function eventTime(value) {
|
|
|
18913
19069
|
if (typeof value === "number") return value;
|
|
18914
19070
|
return Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(value) ? value.replace(/-/g, "/") : value);
|
|
18915
19071
|
}
|
|
18916
|
-
var EventRiverChart = (0,
|
|
18917
|
-
const [restoreVersion, setRestoreVersion] = (0,
|
|
19072
|
+
var EventRiverChart = (0, import_react80.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) {
|
|
19073
|
+
const [restoreVersion, setRestoreVersion] = (0, import_react80.useState)(0);
|
|
18918
19074
|
const area = plot;
|
|
18919
19075
|
palette = palette ?? (appearance === "macarons" ? ["#2ec7c9", "#b6a2de"] : void 0);
|
|
18920
19076
|
const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
@@ -18987,9 +19143,9 @@ function vennDistance(radiusA, radiusB, overlap) {
|
|
|
18987
19143
|
}
|
|
18988
19144
|
return (low + high) / 2;
|
|
18989
19145
|
}
|
|
18990
|
-
var VennChart = (0,
|
|
18991
|
-
const [sets, setSets] = (0,
|
|
18992
|
-
(0,
|
|
19146
|
+
var VennChart = (0, import_react80.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
|
|
19147
|
+
const [sets, setSets] = (0, import_react80.useState)(initialSets), [intersection, setIntersection] = (0, import_react80.useState)(initialIntersection), [active, setActive] = (0, import_react80.useState)();
|
|
19148
|
+
(0, import_react80.useEffect)(() => {
|
|
18993
19149
|
setSets(initialSets);
|
|
18994
19150
|
setIntersection(initialIntersection);
|
|
18995
19151
|
}, [initialSets, initialIntersection]);
|
|
@@ -19052,17 +19208,17 @@ function layoutTreemap(nodes, x, y, width, height, gap, maxDepth, depth = 0, see
|
|
|
19052
19208
|
});
|
|
19053
19209
|
return result;
|
|
19054
19210
|
}
|
|
19055
|
-
var TreemapChart = (0,
|
|
19056
|
-
const [path, setPath] = (0,
|
|
19057
|
-
const [sourceData, setSourceData] = (0,
|
|
19058
|
-
const [active, setActive] = (0,
|
|
19059
|
-
(0,
|
|
19211
|
+
var TreemapChart = (0, import_react80.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) {
|
|
19212
|
+
const [path, setPath] = (0, import_react80.useState)([]);
|
|
19213
|
+
const [sourceData, setSourceData] = (0, import_react80.useState)(data);
|
|
19214
|
+
const [active, setActive] = (0, import_react80.useState)();
|
|
19215
|
+
(0, import_react80.useEffect)(() => {
|
|
19060
19216
|
setSourceData(data);
|
|
19061
19217
|
setPath([]);
|
|
19062
19218
|
}, [data]);
|
|
19063
19219
|
const currentData = path.reduce((nodes, name) => nodes.find((node) => node.name === name)?.children ?? nodes, sourceData);
|
|
19064
19220
|
const top = drilldown && showBreadcrumb ? 52 : 28;
|
|
19065
|
-
const rectangles = (0,
|
|
19221
|
+
const rectangles = (0, import_react80.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
|
|
19066
19222
|
const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: currentData.map((node) => ({ name: node.name, data: [treemapValue(node)] })), onApply: (values) => {
|
|
19067
19223
|
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);
|
|
19068
19224
|
setSourceData(update(sourceData, 0));
|
|
@@ -19130,15 +19286,15 @@ function flattenTree2(root, collapsed) {
|
|
|
19130
19286
|
visit(root, 0);
|
|
19131
19287
|
return { nodes, leafCount: Math.max(1, leafOrder), maxDepth: Math.max(0, ...nodes.map((item) => item.depth)) };
|
|
19132
19288
|
}
|
|
19133
|
-
var TreeChart = (0,
|
|
19134
|
-
const [sourceData, setSourceData] = (0,
|
|
19135
|
-
const [roamReset, setRoamReset] = (0,
|
|
19136
|
-
const [active, setActive] = (0,
|
|
19137
|
-
(0,
|
|
19289
|
+
var TreeChart = (0, import_react80.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) {
|
|
19290
|
+
const [sourceData, setSourceData] = (0, import_react80.useState)(data);
|
|
19291
|
+
const [roamReset, setRoamReset] = (0, import_react80.useState)(0);
|
|
19292
|
+
const [active, setActive] = (0, import_react80.useState)();
|
|
19293
|
+
(0, import_react80.useEffect)(() => {
|
|
19138
19294
|
setSourceData(data);
|
|
19139
19295
|
setActive(void 0);
|
|
19140
19296
|
}, [data]);
|
|
19141
|
-
const [collapsed, setCollapsed] = (0,
|
|
19297
|
+
const [collapsed, setCollapsed] = (0, import_react80.useState)(() => {
|
|
19142
19298
|
const result = /* @__PURE__ */ new Set();
|
|
19143
19299
|
const visit = (node) => {
|
|
19144
19300
|
if (node.collapsed) result.add(node.name);
|
|
@@ -19147,8 +19303,8 @@ var TreeChart = (0, import_react79.forwardRef)(function TreeChart2({ data, itemS
|
|
|
19147
19303
|
visit(data);
|
|
19148
19304
|
return result;
|
|
19149
19305
|
});
|
|
19150
|
-
const layout = (0,
|
|
19151
|
-
const fixedLayout = (0,
|
|
19306
|
+
const layout = (0, import_react80.useMemo)(() => flattenTree2(sourceData, collapsed), [collapsed, sourceData]);
|
|
19307
|
+
const fixedLayout = (0, import_react80.useMemo)(() => {
|
|
19152
19308
|
const visible = (node) => ({ ...node, children: collapsed.has(node.name) ? [] : node.children?.map(visible) });
|
|
19153
19309
|
return rootPosition ? layoutTreeNodes(visible(sourceData), { nodeSize, nodePadding, layerPadding, rootPosition, orientation }) : void 0;
|
|
19154
19310
|
}, [sourceData, collapsed, rootPosition, nodeSize, nodePadding, layerPadding, orientation]);
|
|
@@ -19218,15 +19374,15 @@ var TreeChart = (0, import_react79.forwardRef)(function TreeChart2({ data, itemS
|
|
|
19218
19374
|
})
|
|
19219
19375
|
] }) });
|
|
19220
19376
|
});
|
|
19221
|
-
var WordCloudChart = (0,
|
|
19222
|
-
const placements = (0,
|
|
19377
|
+
var WordCloudChart = (0, import_react80.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) {
|
|
19378
|
+
const placements = (0, import_react80.useMemo)(() => {
|
|
19223
19379
|
const context = typeof document === "undefined" ? null : document.createElement("canvas").getContext("2d");
|
|
19224
19380
|
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) => {
|
|
19225
19381
|
context.font = `${word.fontWeight ?? fontWeight} ${size}px ${word.fontFamily ?? fontFamily ?? "Arial"}`;
|
|
19226
19382
|
return context.measureText(word.name).width;
|
|
19227
19383
|
} : void 0 });
|
|
19228
19384
|
}, [data, bounds, autoFit, areaSizing, maxFontSize, minFontSize, padding, rotations, shape, spiralStep, fontFamily, fontWeight]);
|
|
19229
|
-
(0,
|
|
19385
|
+
(0, import_react80.useEffect)(() => {
|
|
19230
19386
|
const present = new Set(placements.map((p) => p.index));
|
|
19231
19387
|
onLayout?.({ placed: placements.length, unplaced: data.filter((_, i) => !present.has(i)).map((item) => item.name) });
|
|
19232
19388
|
}, [placements, data, onLayout]);
|
|
@@ -19235,30 +19391,30 @@ var WordCloudChart = (0, import_react79.forwardRef)(function WordCloudChart2({ d
|
|
|
19235
19391
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ChartMark, { label: `${placement.item.name}\uFF0C${placement.item.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime81.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_runtime81.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}`);
|
|
19236
19392
|
}) });
|
|
19237
19393
|
});
|
|
19238
|
-
var MixedChart = (0,
|
|
19239
|
-
const plotClipId = `sia-mixed-plot-${(0,
|
|
19240
|
-
const [editableSeries, setEditableSeries] = (0,
|
|
19241
|
-
const [geometry, setGeometry] = (0,
|
|
19242
|
-
const [pointerIndex, setPointerIndex] = (0,
|
|
19243
|
-
const [pointerAxisIndex, setPointerAxisIndex] = (0,
|
|
19244
|
-
const [motionRevision, setMotionRevision] = (0,
|
|
19245
|
-
const [stackMode, setStackMode] = (0,
|
|
19246
|
-
const lastPublished = (0,
|
|
19394
|
+
var MixedChart = (0, import_react80.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) {
|
|
19395
|
+
const plotClipId = `sia-mixed-plot-${(0, import_react80.useId)().replaceAll(":", "")}`;
|
|
19396
|
+
const [editableSeries, setEditableSeries] = (0, import_react80.useState)(sourceSeries);
|
|
19397
|
+
const [geometry, setGeometry] = (0, import_react80.useState)();
|
|
19398
|
+
const [pointerIndex, setPointerIndex] = (0, import_react80.useState)(null);
|
|
19399
|
+
const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react80.useState)(0);
|
|
19400
|
+
const [motionRevision, setMotionRevision] = (0, import_react80.useState)(0);
|
|
19401
|
+
const [stackMode, setStackMode] = (0, import_react80.useState)();
|
|
19402
|
+
const lastPublished = (0, import_react80.useRef)(null);
|
|
19247
19403
|
const publishData = (next) => {
|
|
19248
19404
|
lastPublished.current = next;
|
|
19249
19405
|
onDataChange?.(next);
|
|
19250
19406
|
};
|
|
19251
|
-
const [islands, setIslands] = (0,
|
|
19252
|
-
const drag = (0,
|
|
19253
|
-
const [dragOffset, setDragOffset] = (0,
|
|
19254
|
-
(0,
|
|
19407
|
+
const [islands, setIslands] = (0, import_react80.useState)([]);
|
|
19408
|
+
const drag = (0, import_react80.useRef)(null);
|
|
19409
|
+
const [dragOffset, setDragOffset] = (0, import_react80.useState)();
|
|
19410
|
+
(0, import_react80.useEffect)(() => {
|
|
19255
19411
|
if (sourceSeries === lastPublished.current) return;
|
|
19256
19412
|
setEditableSeries(sourceSeries);
|
|
19257
19413
|
setIslands([]);
|
|
19258
19414
|
drag.current = null;
|
|
19259
19415
|
setDragOffset(void 0);
|
|
19260
19416
|
}, [sourceSeries]);
|
|
19261
|
-
const series = (0,
|
|
19417
|
+
const series = (0, import_react80.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
|
|
19262
19418
|
const stacked = stackMode ?? sourceStacked;
|
|
19263
19419
|
const PLOT2 = plotBounds ?? { x: 62, y: 48, width: 628, height: 250 }, PLOT_BOTTOM2 = PLOT2.y + PLOT2.height;
|
|
19264
19420
|
const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
@@ -19422,7 +19578,7 @@ var MixedChart = (0, import_react79.forwardRef)(function MixedChart2({ axisPoint
|
|
|
19422
19578
|
})
|
|
19423
19579
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(CartesianAxes, { categories, domain, band: categoryGap }),
|
|
19424
19580
|
activeIndex != null && activeIndex >= 0 && activeIndex < categories.length ? /* @__PURE__ */ (0, import_jsx_runtime81.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,
|
|
19425
|
-
tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0,
|
|
19581
|
+
tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react81.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_runtime81.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,
|
|
19426
19582
|
calculable ? activeSeries.flatMap((item) => item.data.map((value, index) => value === null ? /* @__PURE__ */ (0, import_jsx_runtime81.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_runtime81.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,
|
|
19427
19583
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("clipPath", { id: plotClipId, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("rect", { x: PLOT2.x, y: PLOT2.y, width: PLOT2.width, height: PLOT2.height }) }) }),
|
|
19428
19584
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("g", { "data-mixed-plot": "", clipPath: clipPlot ? `url(#${plotClipId})` : void 0, children: renderSeries.map((item) => {
|
|
@@ -19461,7 +19617,7 @@ var MixedChart = (0, import_react79.forwardRef)(function MixedChart2({ axisPoint
|
|
|
19461
19617
|
const zero = linearScale(placement.start, [valueDomain[0], valueDomain[1]], [PLOT_BOTTOM2, PLOT2.y]);
|
|
19462
19618
|
const rectY = barSpacing?.pixelAlign ? Math.floor(Math.min(y, zero)) : Math.min(y, zero);
|
|
19463
19619
|
const rectHeight = barSpacing?.pixelAlign ? Math.ceil(Math.abs(zero - y)) : Math.abs(zero - y);
|
|
19464
|
-
return /* @__PURE__ */ (0, import_jsx_runtime81.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,
|
|
19620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.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_react81.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_runtime81.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
|
|
19465
19621
|
if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
|
|
19466
19622
|
} }, /* @__PURE__ */ (0, import_jsx_runtime81.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}`);
|
|
19467
19623
|
})
|
|
@@ -19490,7 +19646,7 @@ var MixedChart = (0, import_react79.forwardRef)(function MixedChart2({ axisPoint
|
|
|
19490
19646
|
if (!placements[index]) return null;
|
|
19491
19647
|
const name = categoryName(index, item.categoryAxisIndex);
|
|
19492
19648
|
const value = item.data[index] ?? 0;
|
|
19493
|
-
return /* @__PURE__ */ (0,
|
|
19649
|
+
return /* @__PURE__ */ (0, import_react81.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_runtime81.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
|
|
19494
19650
|
if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
|
|
19495
19651
|
} }, /* @__PURE__ */ (0, import_jsx_runtime81.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 }));
|
|
19496
19652
|
})
|
|
@@ -19531,9 +19687,9 @@ var KLineChart = CandlestickChart;
|
|
|
19531
19687
|
|
|
19532
19688
|
// src/components/LineShareChart.tsx
|
|
19533
19689
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
19534
|
-
var LineShareChart = (0,
|
|
19535
|
-
const [selected, setSelected] = (0,
|
|
19536
|
-
const [maskHovered, setMaskHovered] = (0,
|
|
19690
|
+
var LineShareChart = (0, import_react82.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
|
|
19691
|
+
const [selected, setSelected] = (0, import_react82.useState)(null);
|
|
19692
|
+
const [maskHovered, setMaskHovered] = (0, import_react82.useState)(false);
|
|
19537
19693
|
const width = props.viewBoxSize?.[0] ?? 900, height = props.viewBoxSize?.[1] ?? 450;
|
|
19538
19694
|
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;
|
|
19539
19695
|
const maximum = data.reduce((best, item2, i) => item2.value >= data[best].value ? i : best, 0);
|
|
@@ -19611,16 +19767,16 @@ function paddedValueExtent(values, padding = 0.05) {
|
|
|
19611
19767
|
}
|
|
19612
19768
|
|
|
19613
19769
|
// src/components/XYChart.tsx
|
|
19614
|
-
var
|
|
19770
|
+
var import_react83 = require("react");
|
|
19615
19771
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
19616
|
-
var XYChart = (0,
|
|
19617
|
-
const [series, setSeries] = (0,
|
|
19618
|
-
const [hidden, setHidden] = (0,
|
|
19619
|
-
const [crosshair, setCrosshair] = (0,
|
|
19620
|
-
const [drag, setDrag] = (0,
|
|
19621
|
-
const [geometry, setGeometry] = (0,
|
|
19622
|
-
const [zoom, setZoom] = (0,
|
|
19623
|
-
(0,
|
|
19772
|
+
var XYChart = (0, import_react83.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
|
|
19773
|
+
const [series, setSeries] = (0, import_react83.useState)(source);
|
|
19774
|
+
const [hidden, setHidden] = (0, import_react83.useState)([]);
|
|
19775
|
+
const [crosshair, setCrosshair] = (0, import_react83.useState)();
|
|
19776
|
+
const [drag, setDrag] = (0, import_react83.useState)();
|
|
19777
|
+
const [geometry, setGeometry] = (0, import_react83.useState)();
|
|
19778
|
+
const [zoom, setZoom] = (0, import_react83.useState)(defaultZoom);
|
|
19779
|
+
(0, import_react83.useEffect)(() => setSeries(source), [source]);
|
|
19624
19780
|
const window2 = dataZoom || xAxisType === "time" ? scatterValueWindow(series.flatMap((item) => item.data.map((point) => point[0])), dataZoom ? zoom : [0, 100]) : void 0;
|
|
19625
19781
|
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 }));
|
|
19626
19782
|
const width = props.viewBoxSize?.[0] ?? 663, height = props.viewBoxSize?.[1] ?? 379;
|
|
@@ -19749,7 +19905,7 @@ var XYChart = (0, import_react82.forwardRef)(function XYChart2({ series: source,
|
|
|
19749
19905
|
});
|
|
19750
19906
|
|
|
19751
19907
|
// src/components/ChartMapOverlay.tsx
|
|
19752
|
-
var
|
|
19908
|
+
var import_react84 = require("react");
|
|
19753
19909
|
|
|
19754
19910
|
// src/components/mapOverlayHost.ts
|
|
19755
19911
|
function observeMapOverlayHost(host, onChange) {
|
|
@@ -19765,9 +19921,9 @@ function observeMapOverlayHost(host, onChange) {
|
|
|
19765
19921
|
if (stopped) return;
|
|
19766
19922
|
stopped = true;
|
|
19767
19923
|
try {
|
|
19768
|
-
for (const
|
|
19924
|
+
for (const cleanup2 of cleanups.splice(0).reverse()) {
|
|
19769
19925
|
try {
|
|
19770
|
-
|
|
19926
|
+
cleanup2();
|
|
19771
19927
|
} catch {
|
|
19772
19928
|
}
|
|
19773
19929
|
}
|
|
@@ -19788,11 +19944,11 @@ function observeMapOverlayHost(host, onChange) {
|
|
|
19788
19944
|
// src/components/ChartMapOverlay.tsx
|
|
19789
19945
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
19790
19946
|
function ChartMapOverlay({ createHost, children, className, style, ariaLabel = "\u5730\u56FE\u53E0\u52A0\u56FE\u8868", onError }) {
|
|
19791
|
-
const container = (0,
|
|
19792
|
-
const errorHandler = (0,
|
|
19947
|
+
const container = (0, import_react84.useRef)(null);
|
|
19948
|
+
const errorHandler = (0, import_react84.useRef)(onError);
|
|
19793
19949
|
errorHandler.current = onError;
|
|
19794
|
-
const [snapshot, setSnapshot] = (0,
|
|
19795
|
-
(0,
|
|
19950
|
+
const [snapshot, setSnapshot] = (0, import_react84.useState)();
|
|
19951
|
+
(0, import_react84.useEffect)(() => {
|
|
19796
19952
|
setSnapshot(void 0);
|
|
19797
19953
|
if (!container.current) return;
|
|
19798
19954
|
try {
|
|
@@ -19869,7 +20025,7 @@ function createBaiduMapHost(element, sdk, options) {
|
|
|
19869
20025
|
}
|
|
19870
20026
|
|
|
19871
20027
|
// src/components/SelectionPanel.tsx
|
|
19872
|
-
var
|
|
20028
|
+
var import_react85 = require("react");
|
|
19873
20029
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
19874
20030
|
function SelectionPanel({
|
|
19875
20031
|
options,
|
|
@@ -19888,23 +20044,23 @@ function SelectionPanel({
|
|
|
19888
20044
|
maxHeight = 250,
|
|
19889
20045
|
autoFocusSearch = false
|
|
19890
20046
|
}) {
|
|
19891
|
-
const [localSearch, setLocalSearch] = (0,
|
|
20047
|
+
const [localSearch, setLocalSearch] = (0, import_react85.useState)("");
|
|
19892
20048
|
const search = searchValue ?? localSearch;
|
|
19893
|
-
const [scrollTop, setScrollTop] = (0,
|
|
19894
|
-
const [active, setActive] = (0,
|
|
19895
|
-
const listRef = (0,
|
|
19896
|
-
const id = (0,
|
|
19897
|
-
const selected = (0,
|
|
20049
|
+
const [scrollTop, setScrollTop] = (0, import_react85.useState)(0);
|
|
20050
|
+
const [active, setActive] = (0, import_react85.useState)();
|
|
20051
|
+
const listRef = (0, import_react85.useRef)(null);
|
|
20052
|
+
const id = (0, import_react85.useId)();
|
|
20053
|
+
const selected = (0, import_react85.useMemo)(() => new Set(value), [value]);
|
|
19898
20054
|
const count = Math.max(1, Math.floor(columns));
|
|
19899
|
-
const allOptions = (0,
|
|
20055
|
+
const allOptions = (0, import_react85.useMemo)(() => {
|
|
19900
20056
|
const known = new Set(options.filter((option) => option.optionType !== "divider").map((option) => option.value));
|
|
19901
20057
|
return [...value.filter((item) => !known.has(item)).map((item) => ({ value: item, label: String(item), group: "\u81EA\u5B9A\u4E49\u503C" })), ...options];
|
|
19902
20058
|
}, [options, value]);
|
|
19903
|
-
const filtered = (0,
|
|
20059
|
+
const filtered = (0, import_react85.useMemo)(
|
|
19904
20060
|
() => allOptions.filter((option) => (!selectedOnly || selected.has(option.value)) && (!search || option.optionType !== "divider" && [option.label, option.value].some((text) => String(text ?? "").toLowerCase().includes(search.toLowerCase())))),
|
|
19905
20061
|
[allOptions, selectedOnly, selected, search]
|
|
19906
20062
|
);
|
|
19907
|
-
const rows = (0,
|
|
20063
|
+
const rows = (0, import_react85.useMemo)(() => {
|
|
19908
20064
|
const groups = /* @__PURE__ */ new Map();
|
|
19909
20065
|
filtered.forEach((option) => {
|
|
19910
20066
|
const items = groups.get(option.group) ?? [];
|
|
@@ -19930,7 +20086,7 @@ function SelectionPanel({
|
|
|
19930
20086
|
const virtual = filtered.length > 100;
|
|
19931
20087
|
const renderedRows = virtual ? rows.filter((row) => row.top + row.height >= scrollTop - 100 && row.top <= scrollTop + maxHeight + 100) : rows;
|
|
19932
20088
|
const enabled = filtered.filter((option) => !option.disabled && option.optionType !== "divider");
|
|
19933
|
-
(0,
|
|
20089
|
+
(0, import_react85.useEffect)(() => {
|
|
19934
20090
|
setScrollTop(0);
|
|
19935
20091
|
if (listRef.current) listRef.current.scrollTop = 0;
|
|
19936
20092
|
setActive(void 0);
|
|
@@ -20040,9 +20196,9 @@ function SelectionPanel({
|
|
|
20040
20196
|
}
|
|
20041
20197
|
|
|
20042
20198
|
// src/components/InputSelect.tsx
|
|
20043
|
-
var
|
|
20199
|
+
var import_react86 = require("react");
|
|
20044
20200
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
20045
|
-
var InputSelect = (0,
|
|
20201
|
+
var InputSelect = (0, import_react86.forwardRef)(function InputSelect2({
|
|
20046
20202
|
options,
|
|
20047
20203
|
value,
|
|
20048
20204
|
defaultValue,
|
|
@@ -20067,22 +20223,22 @@ var InputSelect = (0, import_react85.forwardRef)(function InputSelect2({
|
|
|
20067
20223
|
onOpenChange,
|
|
20068
20224
|
...inputProps
|
|
20069
20225
|
}, forwardedRef) {
|
|
20070
|
-
const [internal, setInternal] = (0,
|
|
20226
|
+
const [internal, setInternal] = (0, import_react86.useState)(defaultValue);
|
|
20071
20227
|
const current = value !== void 0 ? value : internal;
|
|
20072
20228
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|
|
20073
20229
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
20074
|
-
const [draft, setDraft] = (0,
|
|
20075
|
-
(0,
|
|
20230
|
+
const [draft, setDraft] = (0, import_react86.useState)(text);
|
|
20231
|
+
(0, import_react86.useEffect)(() => {
|
|
20076
20232
|
setDraft(text);
|
|
20077
20233
|
}, [text, current]);
|
|
20078
|
-
const [open, setOpen] = (0,
|
|
20079
|
-
const [search, setSearch] = (0,
|
|
20080
|
-
const [modalOpen, setModalOpen] = (0,
|
|
20081
|
-
const [modalValues, setModalValues] = (0,
|
|
20082
|
-
const [selectedOnly, setSelectedOnly] = (0,
|
|
20083
|
-
const rootRef = (0,
|
|
20084
|
-
const popupRef = (0,
|
|
20085
|
-
const inputRef = (0,
|
|
20234
|
+
const [open, setOpen] = (0, import_react86.useState)(false);
|
|
20235
|
+
const [search, setSearch] = (0, import_react86.useState)("");
|
|
20236
|
+
const [modalOpen, setModalOpen] = (0, import_react86.useState)(false);
|
|
20237
|
+
const [modalValues, setModalValues] = (0, import_react86.useState)([]);
|
|
20238
|
+
const [selectedOnly, setSelectedOnly] = (0, import_react86.useState)(false);
|
|
20239
|
+
const rootRef = (0, import_react86.useRef)(null);
|
|
20240
|
+
const popupRef = (0, import_react86.useRef)(null);
|
|
20241
|
+
const inputRef = (0, import_react86.useRef)(null);
|
|
20086
20242
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
20087
20243
|
function changeOpen(next) {
|
|
20088
20244
|
if (next && (disabled || loading)) return;
|
|
@@ -20102,7 +20258,7 @@ var InputSelect = (0, import_react85.forwardRef)(function InputSelect2({
|
|
|
20102
20258
|
inputRef.current?.focus();
|
|
20103
20259
|
}
|
|
20104
20260
|
}
|
|
20105
|
-
(0,
|
|
20261
|
+
(0, import_react86.useEffect)(() => {
|
|
20106
20262
|
if (!open) return;
|
|
20107
20263
|
const outside = (event) => {
|
|
20108
20264
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -20110,7 +20266,7 @@ var InputSelect = (0, import_react85.forwardRef)(function InputSelect2({
|
|
|
20110
20266
|
document.addEventListener("pointerdown", outside);
|
|
20111
20267
|
return () => document.removeEventListener("pointerdown", outside);
|
|
20112
20268
|
}, [open, onOpenChange]);
|
|
20113
|
-
(0,
|
|
20269
|
+
(0, import_react86.useEffect)(() => {
|
|
20114
20270
|
if (disabled || loading) {
|
|
20115
20271
|
changeOpen(false);
|
|
20116
20272
|
setModalOpen(false);
|