@sia.soul/sia-react-ui 0.1.52 → 0.1.54
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 +72 -4
- package/dist/index.cjs +552 -459
- package/dist/index.css +72 -4
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +160 -67
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12004,8 +12004,86 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
12004
12004
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { ref, className: "sia-table__cell-content", "data-custom-content": customContent || void 0, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children: title ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Tooltip, { title, className: "sia-table__cell-tooltip", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children }) }) : children });
|
|
12005
12005
|
}
|
|
12006
12006
|
|
|
12007
|
-
// src/components/Table/
|
|
12007
|
+
// src/components/Table/useRemainingHeight.ts
|
|
12008
12008
|
var import_react50 = require("react");
|
|
12009
|
+
function useRemainingHeight(rootRef, options) {
|
|
12010
|
+
const [height, setHeight] = (0, import_react50.useState)();
|
|
12011
|
+
const enabled = !!options;
|
|
12012
|
+
const container = typeof options === "object" ? options.container : void 0;
|
|
12013
|
+
const bottomOffset = typeof options === "object" ? options.bottomOffset ?? 0 : 0;
|
|
12014
|
+
const minHeight = typeof options === "object" ? options.minHeight ?? 0 : 0;
|
|
12015
|
+
(0, import_react50.useLayoutEffect)(() => {
|
|
12016
|
+
const root = rootRef.current;
|
|
12017
|
+
if (!enabled || !root) return;
|
|
12018
|
+
const win = root.ownerDocument.defaultView;
|
|
12019
|
+
if (!win) return;
|
|
12020
|
+
let frame = 0;
|
|
12021
|
+
let disposed = false;
|
|
12022
|
+
const observed = /* @__PURE__ */ new Set();
|
|
12023
|
+
const observe = (element) => {
|
|
12024
|
+
if (observed.has(element)) return;
|
|
12025
|
+
observed.add(element);
|
|
12026
|
+
resize?.observe(element);
|
|
12027
|
+
};
|
|
12028
|
+
const measure = () => {
|
|
12029
|
+
frame = 0;
|
|
12030
|
+
if (disposed || !root.isConnected || !root.getClientRects().length) return;
|
|
12031
|
+
const target = container?.();
|
|
12032
|
+
if (container && (!target || !target.getClientRects().length)) return;
|
|
12033
|
+
let branch = root;
|
|
12034
|
+
while (branch.parentElement) {
|
|
12035
|
+
const parent = branch.parentElement;
|
|
12036
|
+
observe(parent);
|
|
12037
|
+
for (const sibling of parent.children) if (sibling !== branch) observe(sibling);
|
|
12038
|
+
branch = parent;
|
|
12039
|
+
}
|
|
12040
|
+
if (target) observe(target);
|
|
12041
|
+
const viewport = win.visualViewport;
|
|
12042
|
+
const bottom = target ? target.getBoundingClientRect().top + target.clientTop + target.clientHeight - (parseFloat(win.getComputedStyle(target).paddingBottom) || 0) : viewport ? viewport.offsetTop + viewport.height : win.innerHeight;
|
|
12043
|
+
const next = Math.max(0, minHeight, Math.floor(bottom - root.getBoundingClientRect().top - bottomOffset));
|
|
12044
|
+
setHeight((previous) => previous === next ? previous : next);
|
|
12045
|
+
};
|
|
12046
|
+
const schedule = () => {
|
|
12047
|
+
if (!disposed && !frame) frame = win.requestAnimationFrame(measure);
|
|
12048
|
+
};
|
|
12049
|
+
const onScroll = (event) => {
|
|
12050
|
+
if (event.target instanceof Node && root.contains(event.target)) return;
|
|
12051
|
+
schedule();
|
|
12052
|
+
};
|
|
12053
|
+
const onMotionEnd = (event) => {
|
|
12054
|
+
if (event.target instanceof Element && event.target.contains(root)) schedule();
|
|
12055
|
+
};
|
|
12056
|
+
const resize = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(schedule);
|
|
12057
|
+
const mutation = new MutationObserver(schedule);
|
|
12058
|
+
for (let node = root.parentElement; node; node = node.parentElement) {
|
|
12059
|
+
mutation.observe(node, { attributes: true, attributeFilter: ["style", "class", "hidden"], childList: true });
|
|
12060
|
+
}
|
|
12061
|
+
measure();
|
|
12062
|
+
schedule();
|
|
12063
|
+
win.addEventListener("resize", schedule);
|
|
12064
|
+
win.addEventListener("scroll", onScroll, true);
|
|
12065
|
+
win.addEventListener("transitionend", onMotionEnd, true);
|
|
12066
|
+
win.addEventListener("animationend", onMotionEnd, true);
|
|
12067
|
+
win.visualViewport?.addEventListener("resize", schedule);
|
|
12068
|
+
win.visualViewport?.addEventListener("scroll", schedule);
|
|
12069
|
+
return () => {
|
|
12070
|
+
disposed = true;
|
|
12071
|
+
win.cancelAnimationFrame(frame);
|
|
12072
|
+
resize?.disconnect();
|
|
12073
|
+
mutation.disconnect();
|
|
12074
|
+
win.removeEventListener("resize", schedule);
|
|
12075
|
+
win.removeEventListener("scroll", onScroll, true);
|
|
12076
|
+
win.removeEventListener("transitionend", onMotionEnd, true);
|
|
12077
|
+
win.removeEventListener("animationend", onMotionEnd, true);
|
|
12078
|
+
win.visualViewport?.removeEventListener("resize", schedule);
|
|
12079
|
+
win.visualViewport?.removeEventListener("scroll", schedule);
|
|
12080
|
+
};
|
|
12081
|
+
}, [rootRef, enabled, container, bottomOffset, minHeight]);
|
|
12082
|
+
return enabled ? height : void 0;
|
|
12083
|
+
}
|
|
12084
|
+
|
|
12085
|
+
// src/components/Table/TableCanvasLayer.tsx
|
|
12086
|
+
var import_react51 = require("react");
|
|
12009
12087
|
|
|
12010
12088
|
// src/components/Table/utils.ts
|
|
12011
12089
|
var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
|
|
@@ -12060,8 +12138,8 @@ function toTablePageParams(current, pageSize) {
|
|
|
12060
12138
|
// src/components/Table/TableCanvasLayer.tsx
|
|
12061
12139
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
12062
12140
|
function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
|
|
12063
|
-
const canvasRef = (0,
|
|
12064
|
-
(0,
|
|
12141
|
+
const canvasRef = (0, import_react51.useRef)(null);
|
|
12142
|
+
(0, import_react51.useLayoutEffect)(() => {
|
|
12065
12143
|
const canvas = canvasRef.current;
|
|
12066
12144
|
const scroller = viewport.current;
|
|
12067
12145
|
if (!canvas || !scroller) return;
|
|
@@ -12188,10 +12266,10 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
12188
12266
|
}
|
|
12189
12267
|
|
|
12190
12268
|
// src/components/Table/Table.tsx
|
|
12191
|
-
var
|
|
12269
|
+
var import_react53 = require("react");
|
|
12192
12270
|
|
|
12193
12271
|
// src/components/Table/plugins.tsx
|
|
12194
|
-
var
|
|
12272
|
+
var import_react52 = require("react");
|
|
12195
12273
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
12196
12274
|
function TableCheckbox({
|
|
12197
12275
|
checked,
|
|
@@ -12818,7 +12896,7 @@ function TableSelectedItemsPanel({
|
|
|
12818
12896
|
onRemove,
|
|
12819
12897
|
onClear
|
|
12820
12898
|
}) {
|
|
12821
|
-
const [showAll, setShowAll] = (0,
|
|
12899
|
+
const [showAll, setShowAll] = (0, import_react52.useState)(false);
|
|
12822
12900
|
const visibleEntries = showAll ? entries : entries.slice(0, maxCount2);
|
|
12823
12901
|
const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
|
|
12824
12902
|
const baseColumnMap = new Map(
|
|
@@ -13217,10 +13295,10 @@ function TableFilterControl({
|
|
|
13217
13295
|
placeholder,
|
|
13218
13296
|
onApply
|
|
13219
13297
|
}) {
|
|
13220
|
-
const [open, setOpen] = (0,
|
|
13221
|
-
const [draft, setDraft] = (0,
|
|
13298
|
+
const [open, setOpen] = (0, import_react52.useState)(false);
|
|
13299
|
+
const [draft, setDraft] = (0, import_react52.useState)(value);
|
|
13222
13300
|
const label = getColumnLabel(column);
|
|
13223
|
-
(0,
|
|
13301
|
+
(0, import_react52.useEffect)(() => {
|
|
13224
13302
|
if (open) setDraft(value);
|
|
13225
13303
|
}, [open, value]);
|
|
13226
13304
|
const apply = (nextValue) => {
|
|
@@ -13534,14 +13612,15 @@ function createTreePlugin(options = {}) {
|
|
|
13534
13612
|
transformRows(rows, context) {
|
|
13535
13613
|
if (options.ignoreChildrenColumn ?? true) return rows;
|
|
13536
13614
|
const result = [];
|
|
13537
|
-
const walk = (items, depth) => {
|
|
13538
|
-
for (const row of items) {
|
|
13615
|
+
const walk = (items, depth, guides) => {
|
|
13616
|
+
for (const [rowIndex, row] of items.entries()) {
|
|
13617
|
+
const hasNextSibling = rowIndex < items.length - 1;
|
|
13539
13618
|
const children = row.record[childKey];
|
|
13540
13619
|
const hasChildren = Array.isArray(children) && children.length > 0 && (options.canExpand?.(row.record) ?? true);
|
|
13541
13620
|
result.push({
|
|
13542
13621
|
...row,
|
|
13543
13622
|
depth,
|
|
13544
|
-
meta: { ...row.meta, treeHasChildren: hasChildren }
|
|
13623
|
+
meta: { ...row.meta, treeHasChildren: hasChildren, treeGuides: guides, treeHasNextSibling: hasNextSibling }
|
|
13545
13624
|
});
|
|
13546
13625
|
if (hasChildren && current(context).includes(row.key)) {
|
|
13547
13626
|
walk(
|
|
@@ -13552,12 +13631,13 @@ function createTreePlugin(options = {}) {
|
|
|
13552
13631
|
depth: depth + 1,
|
|
13553
13632
|
meta: {}
|
|
13554
13633
|
})),
|
|
13555
|
-
depth + 1
|
|
13634
|
+
depth + 1,
|
|
13635
|
+
depth > 0 ? [...guides, hasNextSibling] : guides
|
|
13556
13636
|
);
|
|
13557
13637
|
}
|
|
13558
13638
|
}
|
|
13559
13639
|
};
|
|
13560
|
-
walk(rows, 0);
|
|
13640
|
+
walk(rows, 0, []);
|
|
13561
13641
|
return result;
|
|
13562
13642
|
},
|
|
13563
13643
|
transformColumns(columns, context) {
|
|
@@ -13569,32 +13649,40 @@ function createTreePlugin(options = {}) {
|
|
|
13569
13649
|
const previousRender = column.render;
|
|
13570
13650
|
return {
|
|
13571
13651
|
...column,
|
|
13652
|
+
...options.showLine ? { ellipsis: false, meta: { ...column.meta, treeLines: true } } : {},
|
|
13572
13653
|
render: (value, record, index, info) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
13573
13654
|
"span",
|
|
13574
13655
|
{
|
|
13575
|
-
className: "sia-table__tree-cell"
|
|
13576
|
-
style: { paddingLeft: info.row.depth * 18 },
|
|
13656
|
+
className: `sia-table__tree-cell${options.showLine ? " sia-table__tree-cell--lines" : ""}`,
|
|
13657
|
+
style: options.showLine ? void 0 : { paddingLeft: info.row.depth * 18 },
|
|
13577
13658
|
children: [
|
|
13578
|
-
info.row.
|
|
13579
|
-
"
|
|
13580
|
-
{
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13584
|
-
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13589
|
-
|
|
13590
|
-
|
|
13591
|
-
{
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
}
|
|
13595
|
-
|
|
13596
|
-
|
|
13597
|
-
|
|
13659
|
+
options.showLine && info.row.depth > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
13660
|
+
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "aria-hidden": "true", className: `sia-table__tree-guide${continued ? " sia-table__tree-guide--continued" : ""}` }, level)),
|
|
13661
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "aria-hidden": "true", className: `sia-table__tree-guide sia-table__tree-guide--branch${info.row.meta.treeHasNextSibling ? " sia-table__tree-guide--continued" : ""}` })
|
|
13662
|
+
] }),
|
|
13663
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: options.showLine ? "sia-table__tree-node" : void 0, style: options.showLine ? void 0 : { display: "contents" }, children: [
|
|
13664
|
+
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "aria-hidden": "true", className: "sia-table__tree-stem" }),
|
|
13665
|
+
info.row.meta.treeHasChildren ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13666
|
+
"button",
|
|
13667
|
+
{
|
|
13668
|
+
type: "button",
|
|
13669
|
+
className: "sia-table__tree-toggle",
|
|
13670
|
+
"aria-label": current(context).includes(info.row.key) ? "\u6536\u8D77\u5B50\u8282\u70B9" : "\u5C55\u5F00\u5B50\u8282\u70B9",
|
|
13671
|
+
"aria-expanded": current(context).includes(info.row.key),
|
|
13672
|
+
onClick: (event) => {
|
|
13673
|
+
event.stopPropagation();
|
|
13674
|
+
toggle(info.row.key, context);
|
|
13675
|
+
},
|
|
13676
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13677
|
+
Icon,
|
|
13678
|
+
{
|
|
13679
|
+
name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
|
|
13680
|
+
size: 13
|
|
13681
|
+
}
|
|
13682
|
+
)
|
|
13683
|
+
}
|
|
13684
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "sia-table__tree-placeholder" })
|
|
13685
|
+
] }),
|
|
13598
13686
|
previousRender ? previousRender(value, record, index, info) : value
|
|
13599
13687
|
]
|
|
13600
13688
|
}
|
|
@@ -13602,6 +13690,9 @@ function createTreePlugin(options = {}) {
|
|
|
13602
13690
|
};
|
|
13603
13691
|
});
|
|
13604
13692
|
},
|
|
13693
|
+
getCellProps(_row, column) {
|
|
13694
|
+
return column.meta?.treeLines ? { className: "sia-table__cell--tree-lines" } : void 0;
|
|
13695
|
+
},
|
|
13605
13696
|
getApi: (context) => ({
|
|
13606
13697
|
getExpandedKeys: () => current(context),
|
|
13607
13698
|
setExpandedKeys: (keys) => setKeys(keys, context),
|
|
@@ -13645,17 +13736,17 @@ function EditableTableCell({
|
|
|
13645
13736
|
trigger
|
|
13646
13737
|
}) {
|
|
13647
13738
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
13648
|
-
const [editValue, setEditValue] = (0,
|
|
13649
|
-
const [saving, setSaving] = (0,
|
|
13650
|
-
const inputRef = (0,
|
|
13651
|
-
const editorRef = (0,
|
|
13652
|
-
const editValueRef = (0,
|
|
13653
|
-
const savingRef = (0,
|
|
13654
|
-
const saveRef = (0,
|
|
13739
|
+
const [editValue, setEditValue] = (0, import_react52.useState)(value);
|
|
13740
|
+
const [saving, setSaving] = (0, import_react52.useState)(false);
|
|
13741
|
+
const inputRef = (0, import_react52.useRef)(null);
|
|
13742
|
+
const editorRef = (0, import_react52.useRef)(null);
|
|
13743
|
+
const editValueRef = (0, import_react52.useRef)(value);
|
|
13744
|
+
const savingRef = (0, import_react52.useRef)(false);
|
|
13745
|
+
const saveRef = (0, import_react52.useRef)(
|
|
13655
13746
|
async () => {
|
|
13656
13747
|
}
|
|
13657
13748
|
);
|
|
13658
|
-
(0,
|
|
13749
|
+
(0, import_react52.useEffect)(() => {
|
|
13659
13750
|
if (!active) return;
|
|
13660
13751
|
editValueRef.current = value;
|
|
13661
13752
|
setEditValue(value);
|
|
@@ -13686,7 +13777,7 @@ function EditableTableCell({
|
|
|
13686
13777
|
}
|
|
13687
13778
|
}
|
|
13688
13779
|
saveRef.current = save;
|
|
13689
|
-
(0,
|
|
13780
|
+
(0, import_react52.useEffect)(() => {
|
|
13690
13781
|
if (!active || config.type === "select" || config.type === "custom") return;
|
|
13691
13782
|
const handleOutsidePointerDown = (event) => {
|
|
13692
13783
|
const target = event.target;
|
|
@@ -13991,15 +14082,15 @@ function ColumnSettingPanel({
|
|
|
13991
14082
|
onClose,
|
|
13992
14083
|
onApply
|
|
13993
14084
|
}) {
|
|
13994
|
-
const [draft, setDraft] = (0,
|
|
13995
|
-
const listRef = (0,
|
|
13996
|
-
const cancelDrag = (0,
|
|
13997
|
-
const [preview, setPreview] = (0,
|
|
13998
|
-
(0,
|
|
14085
|
+
const [draft, setDraft] = (0, import_react52.useState)(items);
|
|
14086
|
+
const listRef = (0, import_react52.useRef)(null);
|
|
14087
|
+
const cancelDrag = (0, import_react52.useRef)(null);
|
|
14088
|
+
const [preview, setPreview] = (0, import_react52.useState)(null);
|
|
14089
|
+
(0, import_react52.useEffect)(() => {
|
|
13999
14090
|
cancelDrag.current?.();
|
|
14000
14091
|
if (open) setDraft(orderColumnSettings(items));
|
|
14001
14092
|
}, [items, open]);
|
|
14002
|
-
(0,
|
|
14093
|
+
(0, import_react52.useEffect)(() => () => cancelDrag.current?.(), []);
|
|
14003
14094
|
const labels = new Map(
|
|
14004
14095
|
flattenTableColumns(columns).map((column) => [
|
|
14005
14096
|
column.key,
|
|
@@ -14524,7 +14615,7 @@ function tableExportText(node) {
|
|
|
14524
14615
|
if (typeof node === "string" || typeof node === "number" || typeof node === "bigint")
|
|
14525
14616
|
return String(node);
|
|
14526
14617
|
if (Array.isArray(node)) return node.map(tableExportText).join("");
|
|
14527
|
-
if ((0,
|
|
14618
|
+
if ((0, import_react52.isValidElement)(node))
|
|
14528
14619
|
return tableExportText(node.props.children);
|
|
14529
14620
|
return "";
|
|
14530
14621
|
}
|
|
@@ -14623,7 +14714,7 @@ var SIZE_ROW_HEIGHT = { small: 28, medium: 36, large: 46 };
|
|
|
14623
14714
|
function getHeaderTitleText(content) {
|
|
14624
14715
|
if (typeof content === "string" || typeof content === "number") return String(content);
|
|
14625
14716
|
if (Array.isArray(content)) return content.map(getHeaderTitleText).join("");
|
|
14626
|
-
if ((0,
|
|
14717
|
+
if ((0, import_react53.isValidElement)(content)) return getHeaderTitleText(content.props.children);
|
|
14627
14718
|
return "";
|
|
14628
14719
|
}
|
|
14629
14720
|
function getColumnDepth(columns) {
|
|
@@ -14703,7 +14794,7 @@ function getTableHorizontalMetrics(viewport, table) {
|
|
|
14703
14794
|
const contentWidth = Math.max(viewport.clientWidth, table?.getBoundingClientRect().width ?? viewport.clientWidth);
|
|
14704
14795
|
return { contentWidth, maxLeft: Math.max(0, contentWidth - viewport.clientWidth) };
|
|
14705
14796
|
}
|
|
14706
|
-
var TableBodyRow = (0,
|
|
14797
|
+
var TableBodyRow = (0, import_react53.memo)(function TableBodyRow2({
|
|
14707
14798
|
canvas,
|
|
14708
14799
|
visibleColumns,
|
|
14709
14800
|
row,
|
|
@@ -14794,6 +14885,7 @@ function TableInner(props, ref) {
|
|
|
14794
14885
|
emptyText = "\u6682\u65E0\u6570\u636E",
|
|
14795
14886
|
height,
|
|
14796
14887
|
tableHeight,
|
|
14888
|
+
fillRemaining,
|
|
14797
14889
|
size = "medium",
|
|
14798
14890
|
bordered = true,
|
|
14799
14891
|
rowBordered = true,
|
|
@@ -14818,23 +14910,24 @@ function TableInner(props, ref) {
|
|
|
14818
14910
|
style,
|
|
14819
14911
|
...htmlProps
|
|
14820
14912
|
} = props;
|
|
14821
|
-
const rootRef = (0,
|
|
14822
|
-
const
|
|
14823
|
-
const
|
|
14913
|
+
const rootRef = (0, import_react53.useRef)(null);
|
|
14914
|
+
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
14915
|
+
const scrollRef = (0, import_react53.useRef)(null);
|
|
14916
|
+
const tableRef = (0, import_react53.useRef)(null);
|
|
14824
14917
|
useScrollbarProximity();
|
|
14825
|
-
const scrollbarDragRef = (0,
|
|
14826
|
-
const [internalLoading, setInternalLoading] = (0,
|
|
14827
|
-
const [scrollTop, setScrollTop] = (0,
|
|
14828
|
-
const [scrollLeft, setScrollLeft] = (0,
|
|
14829
|
-
const [viewportHeight, setViewportHeight] = (0,
|
|
14830
|
-
const [viewportWidth, setViewportWidth] = (0,
|
|
14831
|
-
const [autoColumnWidths, setAutoColumnWidths] = (0,
|
|
14832
|
-
const getRowKey = (0,
|
|
14833
|
-
const builtInResizePlugin = (0,
|
|
14834
|
-
const builtInHighlightPlugin = (0,
|
|
14835
|
-
const builtInCellSelectionPlugin = (0,
|
|
14836
|
-
const builtInIndexPlugin = (0,
|
|
14837
|
-
const activePlugins = (0,
|
|
14918
|
+
const scrollbarDragRef = (0, import_react53.useRef)(null);
|
|
14919
|
+
const [internalLoading, setInternalLoading] = (0, import_react53.useState)(false);
|
|
14920
|
+
const [scrollTop, setScrollTop] = (0, import_react53.useState)(0);
|
|
14921
|
+
const [scrollLeft, setScrollLeft] = (0, import_react53.useState)(0);
|
|
14922
|
+
const [viewportHeight, setViewportHeight] = (0, import_react53.useState)(420);
|
|
14923
|
+
const [viewportWidth, setViewportWidth] = (0, import_react53.useState)(0);
|
|
14924
|
+
const [autoColumnWidths, setAutoColumnWidths] = (0, import_react53.useState)({});
|
|
14925
|
+
const getRowKey = (0, import_react53.useCallback)((record, index) => typeof rowKey === "function" ? rowKey(record, index) : record[String(rowKey)] ?? index, [rowKey]);
|
|
14926
|
+
const builtInResizePlugin = (0, import_react53.useMemo)(() => createResizePlugin(), []);
|
|
14927
|
+
const builtInHighlightPlugin = (0, import_react53.useMemo)(() => createHighlightPlugin(), []);
|
|
14928
|
+
const builtInCellSelectionPlugin = (0, import_react53.useMemo)(() => createCellSelectionPlugin(), []);
|
|
14929
|
+
const builtInIndexPlugin = (0, import_react53.useMemo)(() => createIndexPlugin(), []);
|
|
14930
|
+
const activePlugins = (0, import_react53.useMemo)(() => {
|
|
14838
14931
|
const plugins = providedPlugins.filter((plugin) => (resizable || plugin.id !== "resize") && (cellSelection || plugin.id !== "cellSelection") && (showIndex || plugin.id !== "index"));
|
|
14839
14932
|
if (!plugins.some((plugin) => plugin.id === "highlight")) plugins.push(builtInHighlightPlugin);
|
|
14840
14933
|
if (resizable && !plugins.some((plugin) => plugin.id === "resize")) plugins.push(builtInResizePlugin);
|
|
@@ -14842,19 +14935,19 @@ function TableInner(props, ref) {
|
|
|
14842
14935
|
if (showIndex && !plugins.some((plugin) => plugin.id === "index")) plugins.push(builtInIndexPlugin);
|
|
14843
14936
|
return plugins;
|
|
14844
14937
|
}, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
|
|
14845
|
-
const sortedPlugins = (0,
|
|
14846
|
-
const pluginsByIdRef = (0,
|
|
14938
|
+
const sortedPlugins = (0, import_react53.useMemo)(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
14939
|
+
const pluginsByIdRef = (0, import_react53.useRef)(/* @__PURE__ */ new Map());
|
|
14847
14940
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
14848
|
-
const [pluginStates, setPluginStates] = (0,
|
|
14941
|
+
const [pluginStates, setPluginStates] = (0, import_react53.useState)(() => Object.fromEntries(
|
|
14849
14942
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
14850
14943
|
));
|
|
14851
|
-
const pluginApisRef = (0,
|
|
14852
|
-
const contextsRef = (0,
|
|
14853
|
-
const mountedPluginsRef = (0,
|
|
14944
|
+
const pluginApisRef = (0, import_react53.useRef)({});
|
|
14945
|
+
const contextsRef = (0, import_react53.useRef)(/* @__PURE__ */ new Map());
|
|
14946
|
+
const mountedPluginsRef = (0, import_react53.useRef)(/* @__PURE__ */ new Map());
|
|
14854
14947
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
14855
14948
|
const nextApis = {};
|
|
14856
14949
|
const contexts = /* @__PURE__ */ new Map();
|
|
14857
|
-
const setPluginState = (0,
|
|
14950
|
+
const setPluginState = (0, import_react53.useCallback)((pluginId, next) => {
|
|
14858
14951
|
setPluginStates((previous) => {
|
|
14859
14952
|
const plugin = pluginsByIdRef.current.get(pluginId);
|
|
14860
14953
|
const previousValue = previous[pluginId] !== void 0 ? previous[pluginId] : plugin ? resolveInitialState(plugin) : void 0;
|
|
@@ -14907,7 +15000,7 @@ function TableInner(props, ref) {
|
|
|
14907
15000
|
});
|
|
14908
15001
|
pluginApisRef.current = nextApis;
|
|
14909
15002
|
contextsRef.current = contexts;
|
|
14910
|
-
(0,
|
|
15003
|
+
(0, import_react53.useEffect)(() => {
|
|
14911
15004
|
const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
14912
15005
|
for (const [pluginId, mounted] of mountedPluginsRef.current) {
|
|
14913
15006
|
if (activePlugins2.get(pluginId) === mounted.plugin) continue;
|
|
@@ -14919,11 +15012,11 @@ function TableInner(props, ref) {
|
|
|
14919
15012
|
mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
|
|
14920
15013
|
}
|
|
14921
15014
|
}, [sortedPlugins]);
|
|
14922
|
-
(0,
|
|
15015
|
+
(0, import_react53.useEffect)(() => () => {
|
|
14923
15016
|
for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
|
|
14924
15017
|
mountedPluginsRef.current.clear();
|
|
14925
15018
|
}, []);
|
|
14926
|
-
const updateScrollMetrics = (0,
|
|
15019
|
+
const updateScrollMetrics = (0, import_react53.useCallback)(() => {
|
|
14927
15020
|
const root = rootRef.current;
|
|
14928
15021
|
const element = scrollRef.current;
|
|
14929
15022
|
if (!root || !element) return;
|
|
@@ -14963,7 +15056,7 @@ function TableInner(props, ref) {
|
|
|
14963
15056
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
|
|
14964
15057
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
|
|
14965
15058
|
}, []);
|
|
14966
|
-
(0,
|
|
15059
|
+
(0, import_react53.useEffect)(() => {
|
|
14967
15060
|
const element = scrollRef.current;
|
|
14968
15061
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
14969
15062
|
const observer = new ResizeObserver(() => {
|
|
@@ -14976,19 +15069,19 @@ function TableInner(props, ref) {
|
|
|
14976
15069
|
updateScrollMetrics();
|
|
14977
15070
|
return () => observer.disconnect();
|
|
14978
15071
|
}, [updateScrollMetrics]);
|
|
14979
|
-
(0,
|
|
15072
|
+
(0, import_react53.useEffect)(() => {
|
|
14980
15073
|
updateScrollMetrics();
|
|
14981
15074
|
});
|
|
14982
|
-
const orderedColumns = (0,
|
|
14983
|
-
const leafColumns = (0,
|
|
14984
|
-
const headerRows = (0,
|
|
14985
|
-
const measuredCells = (0,
|
|
15075
|
+
const orderedColumns = (0, import_react53.useMemo)(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
15076
|
+
const leafColumns = (0, import_react53.useMemo)(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
15077
|
+
const headerRows = (0, import_react53.useMemo)(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
15078
|
+
const measuredCells = (0, import_react53.useRef)(/* @__PURE__ */ new WeakSet());
|
|
14986
15079
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
14987
|
-
(0,
|
|
15080
|
+
(0, import_react53.useEffect)(() => {
|
|
14988
15081
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
14989
15082
|
setAutoColumnWidths({});
|
|
14990
15083
|
}, [dataSource, baseColumns, size, autoWidthSignature]);
|
|
14991
|
-
(0,
|
|
15084
|
+
(0, import_react53.useEffect)(() => {
|
|
14992
15085
|
const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
|
|
14993
15086
|
const root = rootRef.current;
|
|
14994
15087
|
if (!root || autoWidthColumns.length === 0) return;
|
|
@@ -15072,7 +15165,7 @@ function TableInner(props, ref) {
|
|
|
15072
15165
|
}
|
|
15073
15166
|
const topSpacer = shouldVirtualize ? startIndex * rowHeight : 0;
|
|
15074
15167
|
const bottomSpacer = shouldVirtualize ? Math.max(0, (pipeline.rows.length - endIndex) * rowHeight) : 0;
|
|
15075
|
-
const rowElements = (0,
|
|
15168
|
+
const rowElements = (0, import_react53.useMemo)(() => /* @__PURE__ */ new Map(), [
|
|
15076
15169
|
dataSource,
|
|
15077
15170
|
baseColumns,
|
|
15078
15171
|
sortedPlugins,
|
|
@@ -15091,35 +15184,35 @@ function TableInner(props, ref) {
|
|
|
15091
15184
|
]);
|
|
15092
15185
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
15093
15186
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
15094
|
-
return content ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
15187
|
+
return content ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react53.Fragment, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
15095
15188
|
}).filter(Boolean);
|
|
15096
15189
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
15097
15190
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
15098
|
-
return content ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
15191
|
+
return content ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react53.Fragment, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
15099
15192
|
}).filter(Boolean);
|
|
15100
15193
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
15101
15194
|
const footers = sortedPlugins.map((plugin) => {
|
|
15102
15195
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
15103
|
-
return content ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
15196
|
+
return content ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react53.Fragment, { children: content }, `footer-${plugin.id}`) : null;
|
|
15104
15197
|
}).filter(Boolean);
|
|
15105
15198
|
const overlays = sortedPlugins.map((plugin) => {
|
|
15106
15199
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
15107
|
-
return content ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
15200
|
+
return content ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react53.Fragment, { children: content }, `overlay-${plugin.id}`) : null;
|
|
15108
15201
|
}).filter(Boolean);
|
|
15109
15202
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
15110
|
-
const effectiveHeight = height ?? tableHeight ?? (shouldVirtualize ? 420 : void 0);
|
|
15203
|
+
const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize ? 420 : void 0);
|
|
15111
15204
|
const rootStyle = {
|
|
15112
15205
|
...style,
|
|
15113
15206
|
height: effectiveHeight,
|
|
15114
15207
|
"--sia-table-header-height": `${headerRows.length * rowHeight}px`
|
|
15115
15208
|
};
|
|
15116
|
-
const handleScroll = (0,
|
|
15209
|
+
const handleScroll = (0, import_react53.useCallback)((event) => {
|
|
15117
15210
|
const element = event.currentTarget;
|
|
15118
15211
|
if (shouldVirtualize) setScrollTop((previous) => Math.floor(previous / rowHeight) === Math.floor(element.scrollTop / rowHeight) ? previous : element.scrollTop);
|
|
15119
15212
|
if (canvas) setScrollLeft(element.scrollLeft);
|
|
15120
15213
|
updateScrollMetrics();
|
|
15121
15214
|
}, [canvas, shouldVirtualize, rowHeight, updateScrollMetrics]);
|
|
15122
|
-
const handleScrollbarPointerDown = (0,
|
|
15215
|
+
const handleScrollbarPointerDown = (0, import_react53.useCallback)((axis, event, track = event.currentTarget) => {
|
|
15123
15216
|
const element = scrollRef.current;
|
|
15124
15217
|
const thumb = track.firstElementChild;
|
|
15125
15218
|
if (!element || !thumb || event.button !== 0) return;
|
|
@@ -15148,7 +15241,7 @@ function TableInner(props, ref) {
|
|
|
15148
15241
|
};
|
|
15149
15242
|
if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "true";
|
|
15150
15243
|
}, []);
|
|
15151
|
-
const handleScrollbarPointerMove = (0,
|
|
15244
|
+
const handleScrollbarPointerMove = (0, import_react53.useCallback)((event) => {
|
|
15152
15245
|
const drag = scrollbarDragRef.current;
|
|
15153
15246
|
const element = scrollRef.current;
|
|
15154
15247
|
if (!drag || !element || drag.pointerId !== event.pointerId) return;
|
|
@@ -15157,12 +15250,12 @@ function TableInner(props, ref) {
|
|
|
15157
15250
|
if (drag.axis === "x") element.scrollLeft = nextScroll;
|
|
15158
15251
|
else element.scrollTop = nextScroll;
|
|
15159
15252
|
}, []);
|
|
15160
|
-
const handleScrollbarPointerEnd = (0,
|
|
15253
|
+
const handleScrollbarPointerEnd = (0, import_react53.useCallback)((event) => {
|
|
15161
15254
|
if (scrollbarDragRef.current?.pointerId !== event.pointerId) return;
|
|
15162
15255
|
scrollbarDragRef.current = null;
|
|
15163
15256
|
if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "false";
|
|
15164
15257
|
}, []);
|
|
15165
|
-
(0,
|
|
15258
|
+
(0, import_react53.useImperativeHandle)(ref, () => ({
|
|
15166
15259
|
getRows: () => pipeline.rows.map((row) => row.record),
|
|
15167
15260
|
getColumns: () => pipeline.columns,
|
|
15168
15261
|
getPluginApi: (pluginId) => pluginApisRef.current[pluginId],
|
|
@@ -15441,12 +15534,12 @@ function TableInner(props, ref) {
|
|
|
15441
15534
|
}
|
|
15442
15535
|
);
|
|
15443
15536
|
}
|
|
15444
|
-
var Table2 = (0,
|
|
15537
|
+
var Table2 = (0, import_react53.forwardRef)(TableInner);
|
|
15445
15538
|
|
|
15446
15539
|
// src/components/ThemeSwitch.tsx
|
|
15447
|
-
var
|
|
15540
|
+
var import_react54 = require("react");
|
|
15448
15541
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
15449
|
-
var ThemeSwitch = (0,
|
|
15542
|
+
var ThemeSwitch = (0, import_react54.forwardRef)(function ThemeSwitch2({
|
|
15450
15543
|
checked,
|
|
15451
15544
|
onCheckedChange,
|
|
15452
15545
|
lightLabel = "\u4EAE\u8272\u6A21\u5F0F",
|
|
@@ -15540,7 +15633,7 @@ function Breadcrumb({ items, separator = "/", itemRender, className = "", ...pro
|
|
|
15540
15633
|
}
|
|
15541
15634
|
|
|
15542
15635
|
// src/components/Typography.tsx
|
|
15543
|
-
var
|
|
15636
|
+
var import_react55 = require("react");
|
|
15544
15637
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
15545
15638
|
function TypographyContent({
|
|
15546
15639
|
as: Tag2 = "span",
|
|
@@ -15560,26 +15653,26 @@ function TypographyContent({
|
|
|
15560
15653
|
className = "",
|
|
15561
15654
|
...props
|
|
15562
15655
|
}) {
|
|
15563
|
-
const contentRef = (0,
|
|
15564
|
-
const editRef = (0,
|
|
15565
|
-
const timer = (0,
|
|
15566
|
-
const [localText, setLocalText] = (0,
|
|
15567
|
-
const [draft, setDraft] = (0,
|
|
15568
|
-
const [editing, setEditing] = (0,
|
|
15569
|
-
const [copied, setCopied] = (0,
|
|
15570
|
-
const [copyError, setCopyError] = (0,
|
|
15571
|
-
const [expanded, setExpanded] = (0,
|
|
15572
|
-
const [overflow, setOverflow] = (0,
|
|
15656
|
+
const contentRef = (0, import_react55.useRef)(null);
|
|
15657
|
+
const editRef = (0, import_react55.useRef)(null);
|
|
15658
|
+
const timer = (0, import_react55.useRef)();
|
|
15659
|
+
const [localText, setLocalText] = (0, import_react55.useState)();
|
|
15660
|
+
const [draft, setDraft] = (0, import_react55.useState)("");
|
|
15661
|
+
const [editing, setEditing] = (0, import_react55.useState)(false);
|
|
15662
|
+
const [copied, setCopied] = (0, import_react55.useState)(false);
|
|
15663
|
+
const [copyError, setCopyError] = (0, import_react55.useState)(false);
|
|
15664
|
+
const [expanded, setExpanded] = (0, import_react55.useState)(false);
|
|
15665
|
+
const [overflow, setOverflow] = (0, import_react55.useState)(false);
|
|
15573
15666
|
const editConfig = typeof editable === "object" ? editable : void 0;
|
|
15574
15667
|
const content = editConfig?.text ?? localText ?? children;
|
|
15575
15668
|
const requestedRows = typeof ellipsis === "object" ? ellipsis.rows ?? 1 : 1;
|
|
15576
15669
|
const rows = Number.isFinite(requestedRows) ? Math.max(1, Math.floor(requestedRows)) : 1;
|
|
15577
15670
|
const expandable = typeof ellipsis === "object" && ellipsis.expandable;
|
|
15578
|
-
(0,
|
|
15671
|
+
(0, import_react55.useEffect)(() => {
|
|
15579
15672
|
setLocalText(void 0);
|
|
15580
15673
|
}, [children]);
|
|
15581
|
-
(0,
|
|
15582
|
-
(0,
|
|
15674
|
+
(0, import_react55.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
15675
|
+
(0, import_react55.useLayoutEffect)(() => {
|
|
15583
15676
|
const element = contentRef.current;
|
|
15584
15677
|
if (!element || !ellipsis || !expandable || editing || expanded) return;
|
|
15585
15678
|
const measure = () => setOverflow(element.scrollHeight > element.clientHeight + 1 || element.scrollWidth > element.clientWidth + 1);
|
|
@@ -15697,10 +15790,10 @@ var Typography = Object.assign(TypographyRoot, {
|
|
|
15697
15790
|
});
|
|
15698
15791
|
|
|
15699
15792
|
// src/components/FloatButton.tsx
|
|
15700
|
-
var
|
|
15793
|
+
var import_react56 = require("react");
|
|
15701
15794
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
15702
|
-
var GroupShape = (0,
|
|
15703
|
-
var FloatButtonRoot = (0,
|
|
15795
|
+
var GroupShape = (0, import_react56.createContext)(void 0);
|
|
15796
|
+
var FloatButtonRoot = (0, import_react56.forwardRef)(function FloatButton({
|
|
15704
15797
|
icon,
|
|
15705
15798
|
description,
|
|
15706
15799
|
tooltip,
|
|
@@ -15713,7 +15806,7 @@ var FloatButtonRoot = (0, import_react55.forwardRef)(function FloatButton({
|
|
|
15713
15806
|
children,
|
|
15714
15807
|
...props
|
|
15715
15808
|
}, ref) {
|
|
15716
|
-
const groupShape = (0,
|
|
15809
|
+
const groupShape = (0, import_react56.useContext)(GroupShape);
|
|
15717
15810
|
const label = props["aria-label"] ?? (typeof tooltip === "string" ? tooltip : typeof description === "string" ? description : "\u60AC\u6D6E\u64CD\u4F5C");
|
|
15718
15811
|
const button = /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15719
15812
|
"button",
|
|
@@ -15751,10 +15844,10 @@ function FloatButtonGroup({
|
|
|
15751
15844
|
...props
|
|
15752
15845
|
}) {
|
|
15753
15846
|
const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
15754
|
-
const rootRef = (0,
|
|
15755
|
-
const triggerRef = (0,
|
|
15756
|
-
const id = (0,
|
|
15757
|
-
(0,
|
|
15847
|
+
const rootRef = (0, import_react56.useRef)(null);
|
|
15848
|
+
const triggerRef = (0, import_react56.useRef)(null);
|
|
15849
|
+
const id = (0, import_react56.useId)();
|
|
15850
|
+
(0, import_react56.useEffect)(() => {
|
|
15758
15851
|
if (!trigger || !visible) return;
|
|
15759
15852
|
const close = (event) => {
|
|
15760
15853
|
if (!rootRef.current?.contains(event.target)) setVisible(false);
|
|
@@ -15808,8 +15901,8 @@ function FloatButtonGroup({
|
|
|
15808
15901
|
) });
|
|
15809
15902
|
}
|
|
15810
15903
|
function FloatButtonBackTop({ target, visibilityHeight = 400, behavior = "smooth", onClick, icon, tooltip = "\u8FD4\u56DE\u9876\u90E8", ...props }) {
|
|
15811
|
-
const [visible, setVisible] = (0,
|
|
15812
|
-
(0,
|
|
15904
|
+
const [visible, setVisible] = (0, import_react56.useState)(false);
|
|
15905
|
+
(0, import_react56.useEffect)(() => {
|
|
15813
15906
|
const element = target ? target() : window;
|
|
15814
15907
|
if (!element) return;
|
|
15815
15908
|
const update = () => setVisible((element === window ? window.scrollY : element.scrollTop) >= visibilityHeight);
|
|
@@ -15833,11 +15926,11 @@ var FloatButton2 = Object.assign(FloatButtonRoot, {
|
|
|
15833
15926
|
});
|
|
15834
15927
|
|
|
15835
15928
|
// src/components/ChartWhirlingLoading.tsx
|
|
15836
|
-
var
|
|
15929
|
+
var import_react57 = require("react");
|
|
15837
15930
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
15838
15931
|
function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\u83B7\u53D6\u4E2D", textWidth, frame }) {
|
|
15839
|
-
const [tick, setTick] = (0,
|
|
15840
|
-
(0,
|
|
15932
|
+
const [tick, setTick] = (0, import_react57.useState)(0);
|
|
15933
|
+
(0, import_react57.useEffect)(() => {
|
|
15841
15934
|
if (frame != null) return;
|
|
15842
15935
|
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
15843
15936
|
let timer;
|
|
@@ -15868,20 +15961,20 @@ function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\
|
|
|
15868
15961
|
}
|
|
15869
15962
|
|
|
15870
15963
|
// src/components/SvgMapPlot.tsx
|
|
15871
|
-
var
|
|
15964
|
+
var import_react69 = require("react");
|
|
15872
15965
|
|
|
15873
15966
|
// src/components/ChartBrush.tsx
|
|
15874
|
-
var
|
|
15967
|
+
var import_react58 = require("react");
|
|
15875
15968
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
15876
15969
|
function ChartBrush({ bounds, onSelect, onCancel, selectionShape = "band", selectionStyle, minSelectionSize }) {
|
|
15877
|
-
const [vertical, setVertical] = (0,
|
|
15878
|
-
const startY = (0,
|
|
15970
|
+
const [vertical, setVertical] = (0, import_react58.useState)(null);
|
|
15971
|
+
const startY = (0, import_react58.useRef)(0);
|
|
15879
15972
|
const y = (event) => {
|
|
15880
15973
|
const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
|
|
15881
15974
|
return matrix ? Math.max(bounds.y, Math.min(bounds.y + bounds.height, new DOMPoint(event.clientX, event.clientY).matrixTransform(matrix.inverse()).y)) : bounds.y;
|
|
15882
15975
|
};
|
|
15883
|
-
const drag = (0,
|
|
15884
|
-
const [selection, setSelection] = (0,
|
|
15976
|
+
const drag = (0, import_react58.useRef)(null);
|
|
15977
|
+
const [selection, setSelection] = (0, import_react58.useState)(null);
|
|
15885
15978
|
const x = (event) => {
|
|
15886
15979
|
const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
|
|
15887
15980
|
if (!matrix) return null;
|
|
@@ -16004,7 +16097,7 @@ function appendChartExportHeadings(original, clone, host) {
|
|
|
16004
16097
|
}
|
|
16005
16098
|
|
|
16006
16099
|
// src/components/ChartNodeTimeline.tsx
|
|
16007
|
-
var
|
|
16100
|
+
var import_react60 = require("react");
|
|
16008
16101
|
|
|
16009
16102
|
// src/components/timelinePositions.ts
|
|
16010
16103
|
function timelineRatios(count, dates) {
|
|
@@ -16030,7 +16123,7 @@ function nearestTimelineIndex(ratios, ratio) {
|
|
|
16030
16123
|
}
|
|
16031
16124
|
|
|
16032
16125
|
// src/components/ChartPointMotion.tsx
|
|
16033
|
-
var
|
|
16126
|
+
var import_react59 = require("react");
|
|
16034
16127
|
|
|
16035
16128
|
// src/components/chartMotion.ts
|
|
16036
16129
|
function chartMotionBaseline(points, horizontal = false) {
|
|
@@ -16051,11 +16144,11 @@ function interpolateChartPoints(from, to, progress) {
|
|
|
16051
16144
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
16052
16145
|
function ChartPointMotion({ points, enabled, duration, updateDuration = 500, animateInitial = true, easing = "linear", progress, horizontal = false, origin, children }) {
|
|
16053
16146
|
const baseline = (target) => origin ? target.map(() => origin) : chartMotionBaseline(target, horizontal);
|
|
16054
|
-
const [frame, setFrame] = (0,
|
|
16055
|
-
const displayed = (0,
|
|
16056
|
-
const initialized = (0,
|
|
16147
|
+
const [frame, setFrame] = (0, import_react59.useState)(() => enabled && animateInitial ? baseline(points) : points);
|
|
16148
|
+
const displayed = (0, import_react59.useRef)(frame);
|
|
16149
|
+
const initialized = (0, import_react59.useRef)(!animateInitial);
|
|
16057
16150
|
const signature = JSON.stringify(points);
|
|
16058
|
-
(0,
|
|
16151
|
+
(0, import_react59.useEffect)(() => {
|
|
16059
16152
|
const target = points;
|
|
16060
16153
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
16061
16154
|
if (!enabled || progress != null || reduced.matches) {
|
|
@@ -16094,8 +16187,8 @@ function ChartPointMotion({ points, enabled, duration, updateDuration = 500, ani
|
|
|
16094
16187
|
// src/components/ChartNodeTimeline.tsx
|
|
16095
16188
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
16096
16189
|
function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, x = 80, y = 520, width = 840 }) {
|
|
16097
|
-
const [playing, setPlaying] = (0,
|
|
16098
|
-
const [draft, setDraft] = (0,
|
|
16190
|
+
const [playing, setPlaying] = (0, import_react60.useState)(autoPlay), dragging = (0, import_react60.useRef)();
|
|
16191
|
+
const [draft, setDraft] = (0, import_react60.useState)(), pending = (0, import_react60.useRef)(), draftRef = (0, import_react60.useRef)();
|
|
16099
16192
|
const shown = draft ?? value;
|
|
16100
16193
|
const cancelPending = () => {
|
|
16101
16194
|
clearTimeout(pending.current);
|
|
@@ -16103,8 +16196,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
|
|
|
16103
16196
|
draftRef.current = void 0;
|
|
16104
16197
|
setDraft(void 0);
|
|
16105
16198
|
};
|
|
16106
|
-
(0,
|
|
16107
|
-
(0,
|
|
16199
|
+
(0, import_react60.useEffect)(() => () => clearTimeout(pending.current), []);
|
|
16200
|
+
(0, import_react60.useEffect)(() => {
|
|
16108
16201
|
cancelPending();
|
|
16109
16202
|
}, [value]);
|
|
16110
16203
|
const preview = (index) => {
|
|
@@ -16119,8 +16212,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
|
|
|
16119
16212
|
draftRef.current = void 0;
|
|
16120
16213
|
}, 200);
|
|
16121
16214
|
};
|
|
16122
|
-
(0,
|
|
16123
|
-
(0,
|
|
16215
|
+
(0, import_react60.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
|
|
16216
|
+
(0, import_react60.useEffect)(() => {
|
|
16124
16217
|
if (!playing || labels.length < 2) return;
|
|
16125
16218
|
const timer = window.setTimeout(() => {
|
|
16126
16219
|
if (value + 1 < labels.length) onChange(value + 1);
|
|
@@ -16229,7 +16322,7 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
|
|
|
16229
16322
|
}
|
|
16230
16323
|
|
|
16231
16324
|
// src/components/ChartVerticalRange.tsx
|
|
16232
|
-
var
|
|
16325
|
+
var import_react61 = require("react");
|
|
16233
16326
|
|
|
16234
16327
|
// src/components/chartColorRamp.ts
|
|
16235
16328
|
function chartColorRamp(colors, ratio) {
|
|
@@ -16249,16 +16342,16 @@ function chartColorRamp(colors, ratio) {
|
|
|
16249
16342
|
// src/components/ChartVerticalRange.tsx
|
|
16250
16343
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
16251
16344
|
function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true, readOnly = false }) {
|
|
16252
|
-
const id = (0,
|
|
16253
|
-
const drag = (0,
|
|
16254
|
-
const [draft, setDraft] = (0,
|
|
16255
|
-
const pending = (0,
|
|
16345
|
+
const id = (0, import_react61.useId)().replaceAll(":", "");
|
|
16346
|
+
const drag = (0, import_react61.useRef)();
|
|
16347
|
+
const [draft, setDraft] = (0, import_react61.useState)();
|
|
16348
|
+
const pending = (0, import_react61.useRef)();
|
|
16256
16349
|
const cancel = () => {
|
|
16257
16350
|
drag.current = void 0;
|
|
16258
16351
|
pending.current = void 0;
|
|
16259
16352
|
setDraft(void 0);
|
|
16260
16353
|
};
|
|
16261
|
-
(0,
|
|
16354
|
+
(0, import_react61.useEffect)(() => {
|
|
16262
16355
|
if (!realtime) cancel();
|
|
16263
16356
|
}, [range[0], range[1], min, max, realtime]);
|
|
16264
16357
|
const shown = draft ?? range;
|
|
@@ -16339,18 +16432,18 @@ function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range,
|
|
|
16339
16432
|
}
|
|
16340
16433
|
|
|
16341
16434
|
// src/components/ChartHorizontalRange.tsx
|
|
16342
|
-
var
|
|
16435
|
+
var import_react62 = require("react");
|
|
16343
16436
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
16344
16437
|
function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true }) {
|
|
16345
|
-
const id = (0,
|
|
16346
|
-
const drag = (0,
|
|
16347
|
-
const [draft, setDraft] = (0,
|
|
16438
|
+
const id = (0, import_react62.useId)().replaceAll(":", ""), span = max - min;
|
|
16439
|
+
const drag = (0, import_react62.useRef)();
|
|
16440
|
+
const [draft, setDraft] = (0, import_react62.useState)(), pending = (0, import_react62.useRef)();
|
|
16348
16441
|
const cancel = () => {
|
|
16349
16442
|
drag.current = void 0;
|
|
16350
16443
|
pending.current = void 0;
|
|
16351
16444
|
setDraft(void 0);
|
|
16352
16445
|
};
|
|
16353
|
-
(0,
|
|
16446
|
+
(0, import_react62.useEffect)(() => {
|
|
16354
16447
|
if (!realtime) cancel();
|
|
16355
16448
|
}, [range[0], range[1], min, max, realtime]);
|
|
16356
16449
|
const shown = draft ?? range, low = Math.max(min, Math.min(max, shown[0])), high = Math.max(low, Math.min(max, shown[1]));
|
|
@@ -16428,7 +16521,7 @@ function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range
|
|
|
16428
16521
|
}
|
|
16429
16522
|
|
|
16430
16523
|
// src/components/Chart.tsx
|
|
16431
|
-
var
|
|
16524
|
+
var import_react63 = require("react");
|
|
16432
16525
|
|
|
16433
16526
|
// src/components/chartCompositeExport.ts
|
|
16434
16527
|
function serializeChartComposite(host) {
|
|
@@ -16552,20 +16645,20 @@ var DEFAULT_CHART_PALETTE = [
|
|
|
16552
16645
|
"#2f54eb",
|
|
16553
16646
|
"#a0d911"
|
|
16554
16647
|
];
|
|
16555
|
-
var ChartContext = (0,
|
|
16648
|
+
var ChartContext = (0, import_react63.createContext)(null);
|
|
16556
16649
|
function toCssSize(value, fallback) {
|
|
16557
16650
|
if (typeof value === "number") return `${value}px`;
|
|
16558
16651
|
return value ?? fallback;
|
|
16559
16652
|
}
|
|
16560
|
-
var ChartComposite = (0,
|
|
16561
|
-
const host = (0,
|
|
16562
|
-
(0,
|
|
16653
|
+
var ChartComposite = (0, import_react63.forwardRef)(function ChartComposite2({ layers, width = "100%", height = 320, ariaLabel = "\u7EC4\u5408\u56FE\u8868", className = "", style, ...props }, ref) {
|
|
16654
|
+
const host = (0, import_react63.useRef)(null);
|
|
16655
|
+
(0, import_react63.useImperativeHandle)(ref, () => ({ toSvgString: () => host.current ? serializeChartComposite(host.current) : null, saveAsImage: (filename) => saveCompositeImage(host.current ? serializeChartComposite(host.current) : null, filename) }), []);
|
|
16563
16656
|
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { ...withTitleTooltip(props), ref: host, className: `sia-chart-composite${className ? ` ${className}` : ""}`, style: { ...style, width: toCssSize(width, "100%"), height: toCssSize(height, "320px") }, role: "group", "aria-label": ariaLabel, children: layers.map((layer, index) => /* @__PURE__ */ (0, import_jsx_runtime63.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)) });
|
|
16564
16657
|
});
|
|
16565
|
-
var useTooltipLayoutEffect = typeof window === "undefined" ?
|
|
16658
|
+
var useTooltipLayoutEffect = typeof window === "undefined" ? import_react63.useEffect : import_react63.useLayoutEffect;
|
|
16566
16659
|
function ChartTooltip({ open, left, top, children, enterable = false, inheritTextStyle = false, placement = "above", className = "", style, ...props }) {
|
|
16567
|
-
const elementRef = (0,
|
|
16568
|
-
const [position, setPosition] = (0,
|
|
16660
|
+
const elementRef = (0, import_react63.useRef)(null);
|
|
16661
|
+
const [position, setPosition] = (0, import_react63.useState)([left, top]);
|
|
16569
16662
|
useTooltipLayoutEffect(() => {
|
|
16570
16663
|
const element = elementRef.current, host = element?.parentElement;
|
|
16571
16664
|
if (!open || placement !== "axis" || !element || !host) return;
|
|
@@ -16689,7 +16782,7 @@ function ChartToolbox({
|
|
|
16689
16782
|
))
|
|
16690
16783
|
] });
|
|
16691
16784
|
}
|
|
16692
|
-
var SiaChart = (0,
|
|
16785
|
+
var SiaChart = (0, import_react63.forwardRef)(function SiaChart2({
|
|
16693
16786
|
children,
|
|
16694
16787
|
width = "100%",
|
|
16695
16788
|
height = 320,
|
|
@@ -16716,19 +16809,19 @@ var SiaChart = (0, import_react62.forwardRef)(function SiaChart2({
|
|
|
16716
16809
|
style,
|
|
16717
16810
|
...rest
|
|
16718
16811
|
}, ref) {
|
|
16719
|
-
const hostRef = (0,
|
|
16720
|
-
const svgRef = (0,
|
|
16721
|
-
const titleId = (0,
|
|
16722
|
-
const descriptionId = (0,
|
|
16723
|
-
const [tooltip, setTooltip] = (0,
|
|
16724
|
-
const tooltipHideTimer = (0,
|
|
16725
|
-
const tooltipHeld = (0,
|
|
16812
|
+
const hostRef = (0, import_react63.useRef)(null);
|
|
16813
|
+
const svgRef = (0, import_react63.useRef)(null);
|
|
16814
|
+
const titleId = (0, import_react63.useId)();
|
|
16815
|
+
const descriptionId = (0, import_react63.useId)();
|
|
16816
|
+
const [tooltip, setTooltip] = (0, import_react63.useState)(null);
|
|
16817
|
+
const tooltipHideTimer = (0, import_react63.useRef)();
|
|
16818
|
+
const tooltipHeld = (0, import_react63.useRef)(false);
|
|
16726
16819
|
const cancelTooltipHide = () => {
|
|
16727
16820
|
clearTimeout(tooltipHideTimer.current);
|
|
16728
16821
|
};
|
|
16729
|
-
(0,
|
|
16730
|
-
const [linkedPosition, setLinkedPosition] = (0,
|
|
16731
|
-
(0,
|
|
16822
|
+
(0, import_react63.useEffect)(() => () => clearTimeout(tooltipHideTimer.current), []);
|
|
16823
|
+
const [linkedPosition, setLinkedPosition] = (0, import_react63.useState)({ left: 0, top: 0 });
|
|
16824
|
+
(0, import_react63.useEffect)(() => {
|
|
16732
16825
|
const host = hostRef.current, svg = svgRef.current;
|
|
16733
16826
|
if (!controlledTooltip || !host || !svg) return;
|
|
16734
16827
|
const position = () => {
|
|
@@ -16743,12 +16836,12 @@ var SiaChart = (0, import_react62.forwardRef)(function SiaChart2({
|
|
|
16743
16836
|
observer.observe(host);
|
|
16744
16837
|
return () => observer.disconnect();
|
|
16745
16838
|
}, [controlledTooltip]);
|
|
16746
|
-
const [dataViewOpen, setDataViewOpen] = (0,
|
|
16747
|
-
const [markMode, setMarkMode] = (0,
|
|
16748
|
-
const [markStart, setMarkStart] = (0,
|
|
16749
|
-
const [userMarks, setUserMarks] = (0,
|
|
16839
|
+
const [dataViewOpen, setDataViewOpen] = (0, import_react63.useState)(false);
|
|
16840
|
+
const [markMode, setMarkMode] = (0, import_react63.useState)(false);
|
|
16841
|
+
const [markStart, setMarkStart] = (0, import_react63.useState)(null);
|
|
16842
|
+
const [userMarks, setUserMarks] = (0, import_react63.useState)([]);
|
|
16750
16843
|
const toolboxOptions = toolbox === true ? {} : toolbox || void 0;
|
|
16751
|
-
const rootStyle = (0,
|
|
16844
|
+
const rootStyle = (0, import_react63.useMemo)(() => ({
|
|
16752
16845
|
...style,
|
|
16753
16846
|
width: toCssSize(width, "100%"),
|
|
16754
16847
|
height: toCssSize(height, "320px"),
|
|
@@ -16806,13 +16899,13 @@ var SiaChart = (0, import_react62.forwardRef)(function SiaChart2({
|
|
|
16806
16899
|
anchor.href = canvas.toDataURL("image/png");
|
|
16807
16900
|
anchor.click();
|
|
16808
16901
|
}
|
|
16809
|
-
(0,
|
|
16902
|
+
(0, import_react63.useImperativeHandle)(ref, () => ({
|
|
16810
16903
|
getElement: () => svgRef.current,
|
|
16811
16904
|
focus: () => svgRef.current?.focus(),
|
|
16812
16905
|
toSvgString: serializeSvg,
|
|
16813
16906
|
toDataUrl: svgDataUrl
|
|
16814
16907
|
}), []);
|
|
16815
|
-
const context = (0,
|
|
16908
|
+
const context = (0, import_react63.useMemo)(() => ({
|
|
16816
16909
|
palette,
|
|
16817
16910
|
showTooltip: (event, content, point) => {
|
|
16818
16911
|
cancelTooltipHide();
|
|
@@ -16999,7 +17092,7 @@ var SiaChart = (0, import_react62.forwardRef)(function SiaChart2({
|
|
|
16999
17092
|
) });
|
|
17000
17093
|
});
|
|
17001
17094
|
function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave, onFocus, onBlur, ...props }) {
|
|
17002
|
-
const context = (0,
|
|
17095
|
+
const context = (0, import_react63.useContext)(ChartContext);
|
|
17003
17096
|
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
17004
17097
|
"g",
|
|
17005
17098
|
{
|
|
@@ -17028,7 +17121,7 @@ function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave
|
|
|
17028
17121
|
);
|
|
17029
17122
|
}
|
|
17030
17123
|
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 }) {
|
|
17031
|
-
const paintId = (0,
|
|
17124
|
+
const paintId = (0, import_react63.useId)().replaceAll(":", "");
|
|
17032
17125
|
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))));
|
|
17033
17126
|
const totalWidth = orientation === "horizontal" ? widths.reduce((sum, value) => sum + value, 0) + Math.max(0, items.length - 1) * itemGap : Math.max(0, ...widths);
|
|
17034
17127
|
const startX = align === "start" ? x : align === "end" ? x - totalWidth : x - totalWidth / 2;
|
|
@@ -17157,7 +17250,7 @@ function ChartAxis({ layer = "all", orientation, x, y, length, labels, positions
|
|
|
17157
17250
|
] });
|
|
17158
17251
|
}
|
|
17159
17252
|
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 }) {
|
|
17160
|
-
const id = (0,
|
|
17253
|
+
const id = (0, import_react63.useId)().replaceAll(":", "");
|
|
17161
17254
|
const vertical = orientation === "vertical";
|
|
17162
17255
|
if (svgHandles && vertical && !calculable && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ChartVerticalRange, { readOnly: true, min, max, x, y, length: width, thickness: height, colors, range: [min, max], endLabels, indicatorValue, onHoverRange });
|
|
17163
17256
|
if (svgHandles && vertical && calculable && range && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ChartVerticalRange, { min, max, x, y, length: width, thickness: height, colors, range, onChange: onRangeChange, endLabels, indicatorValue, onHoverRange, realtime });
|
|
@@ -17185,8 +17278,8 @@ function ChartVisualMap({ min, max, colors = ["#e6f4ff", "#1677ff"], x = 16, y =
|
|
|
17185
17278
|
] });
|
|
17186
17279
|
}
|
|
17187
17280
|
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 }) {
|
|
17188
|
-
const [activeHandle, setActiveHandle] = (0,
|
|
17189
|
-
const pan = (0,
|
|
17281
|
+
const [activeHandle, setActiveHandle] = (0, import_react63.useState)(null);
|
|
17282
|
+
const pan = (0, import_react63.useRef)();
|
|
17190
17283
|
const start = Math.min(value[0], value[1]);
|
|
17191
17284
|
const end = Math.max(value[0], value[1]);
|
|
17192
17285
|
const startPercent = (start - min) / Math.max(1, max - min) * 100;
|
|
@@ -17260,9 +17353,9 @@ function ChartDataZoom({ value, min = 0, max = 100, ariaLabel = "\u56FE\u8868\u5
|
|
|
17260
17353
|
] });
|
|
17261
17354
|
}
|
|
17262
17355
|
function ChartTimeline({ labels, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, className = "", ...props }) {
|
|
17263
|
-
const [playing, setPlaying] = (0,
|
|
17264
|
-
(0,
|
|
17265
|
-
(0,
|
|
17356
|
+
const [playing, setPlaying] = (0, import_react63.useState)(autoPlay);
|
|
17357
|
+
(0, import_react63.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
|
|
17358
|
+
(0, import_react63.useEffect)(() => {
|
|
17266
17359
|
if (!playing || labels.length <= 1) return void 0;
|
|
17267
17360
|
const timer = window.setInterval(() => {
|
|
17268
17361
|
const next = value + 1;
|
|
@@ -17372,7 +17465,7 @@ function parseSvgMapPaths(source) {
|
|
|
17372
17465
|
}
|
|
17373
17466
|
|
|
17374
17467
|
// src/components/useMapRoam.ts
|
|
17375
|
-
var
|
|
17468
|
+
var import_react64 = require("react");
|
|
17376
17469
|
|
|
17377
17470
|
// src/components/chartRoam.ts
|
|
17378
17471
|
function zoomChartViewport(view, factor, point, limit = { min: 0.05, max: 20 }) {
|
|
@@ -17389,14 +17482,14 @@ var initial = { x: 0, y: 0, scale: 1 };
|
|
|
17389
17482
|
function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.12, 0.9]) {
|
|
17390
17483
|
const [zoomIn, zoomOut] = wheelFactors;
|
|
17391
17484
|
const min = scaleLimit?.min, max = scaleLimit?.max, unlimited = scaleLimit === null;
|
|
17392
|
-
const host = (0,
|
|
17393
|
-
const [view, setView] = (0,
|
|
17394
|
-
const drag = (0,
|
|
17485
|
+
const host = (0, import_react64.useRef)(null);
|
|
17486
|
+
const [view, setView] = (0, import_react64.useState)(initial);
|
|
17487
|
+
const drag = (0, import_react64.useRef)();
|
|
17395
17488
|
const local = (x, y) => {
|
|
17396
17489
|
const matrix = host.current?.ownerSVGElement?.getScreenCTM();
|
|
17397
17490
|
return matrix ? new DOMPoint(x, y).matrixTransform(matrix.inverse()) : new DOMPoint(x, y);
|
|
17398
17491
|
};
|
|
17399
|
-
(0,
|
|
17492
|
+
(0, import_react64.useEffect)(() => {
|
|
17400
17493
|
const node = host.current;
|
|
17401
17494
|
if (!node || !mode || mode === "move") return;
|
|
17402
17495
|
const wheel = (event) => {
|
|
@@ -17458,7 +17551,7 @@ function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.
|
|
|
17458
17551
|
}
|
|
17459
17552
|
|
|
17460
17553
|
// src/components/ChartMapLineReveal.tsx
|
|
17461
|
-
var
|
|
17554
|
+
var import_react65 = require("react");
|
|
17462
17555
|
|
|
17463
17556
|
// src/components/mapLineGeometry.ts
|
|
17464
17557
|
function mapLineControl(source, target, curveness) {
|
|
@@ -17475,9 +17568,9 @@ function mapLineDuration(source, target, period) {
|
|
|
17475
17568
|
// src/components/ChartMapLineReveal.tsx
|
|
17476
17569
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
17477
17570
|
function ChartMapLineReveal({ source, control, target, enabled, initialDuration = 2e3, updateDuration = 500, children }) {
|
|
17478
|
-
const signature = JSON.stringify([source, control, target]), initialized = (0,
|
|
17479
|
-
const [frame, setFrame] = (0,
|
|
17480
|
-
(0,
|
|
17571
|
+
const signature = JSON.stringify([source, control, target]), initialized = (0, import_react65.useRef)(false);
|
|
17572
|
+
const [frame, setFrame] = (0, import_react65.useState)({ signature, progress: enabled ? 0 : 1 });
|
|
17573
|
+
(0, import_react65.useEffect)(() => {
|
|
17481
17574
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
17482
17575
|
const duration = Math.max(1, initialized.current ? updateDuration : initialDuration);
|
|
17483
17576
|
if (!enabled || reduced.matches) {
|
|
@@ -17510,15 +17603,15 @@ function ChartMapLineReveal({ source, control, target, enabled, initialDuration
|
|
|
17510
17603
|
}
|
|
17511
17604
|
|
|
17512
17605
|
// src/components/ChartMapLineEffect.tsx
|
|
17513
|
-
var
|
|
17606
|
+
var import_react66 = require("react");
|
|
17514
17607
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
17515
17608
|
function ChartMapLineEffect({ source, control, target, period = 30, color = "#fff", radius = 1, shadowBlur = 10, shadowColor = color, trailAlpha }) {
|
|
17516
|
-
const ref = (0,
|
|
17517
|
-
const trails = (0,
|
|
17609
|
+
const ref = (0, import_react66.useRef)(null);
|
|
17610
|
+
const trails = (0, import_react66.useRef)([]);
|
|
17518
17611
|
const alpha = trailAlpha === void 0 ? 0 : Math.max(0, Math.min(0.999, trailAlpha));
|
|
17519
17612
|
const count = alpha > 0 ? Math.min(240, Math.ceil(Math.log(5e-3) / Math.log(alpha))) : 0;
|
|
17520
17613
|
const duration = mapLineDuration(source, target, period);
|
|
17521
|
-
(0,
|
|
17614
|
+
(0, import_react66.useEffect)(() => {
|
|
17522
17615
|
const started = performance.now();
|
|
17523
17616
|
let frame = 0;
|
|
17524
17617
|
const history = [];
|
|
@@ -17551,7 +17644,7 @@ function ChartMapLineEffect({ source, control, target, period = 30, color = "#ff
|
|
|
17551
17644
|
}
|
|
17552
17645
|
|
|
17553
17646
|
// src/components/ChartMapPointPulse.tsx
|
|
17554
|
-
var
|
|
17647
|
+
var import_react67 = require("react");
|
|
17555
17648
|
|
|
17556
17649
|
// src/components/mapPointPulse.ts
|
|
17557
17650
|
function mapPointPulseDuration(period, random = Math.random) {
|
|
@@ -17561,7 +17654,7 @@ function mapPointPulseDuration(period, random = Math.random) {
|
|
|
17561
17654
|
// src/components/ChartMapPointPulse.tsx
|
|
17562
17655
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
17563
17656
|
function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
|
|
17564
|
-
const [duration] = (0,
|
|
17657
|
+
const [duration] = (0, import_react67.useState)(() => mapPointPulseDuration(period));
|
|
17565
17658
|
return /* @__PURE__ */ (0, import_jsx_runtime66.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: [
|
|
17566
17659
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("animate", { attributeName: "r", values: `${size * scaleSize * 0.1};${size * scaleSize}`, dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" }),
|
|
17567
17660
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("animate", { attributeName: "stroke-width", values: ".1;1", dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" })
|
|
@@ -17569,11 +17662,11 @@ function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
|
|
|
17569
17662
|
}
|
|
17570
17663
|
|
|
17571
17664
|
// src/components/ChartMapPointEntrance.tsx
|
|
17572
|
-
var
|
|
17665
|
+
var import_react68 = require("react");
|
|
17573
17666
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
17574
17667
|
function ChartMapPointEntrance({ enabled, x, y, children }) {
|
|
17575
|
-
const [progress, setProgress] = (0,
|
|
17576
|
-
(0,
|
|
17668
|
+
const [progress, setProgress] = (0, import_react68.useState)(enabled ? 0.01 : 1);
|
|
17669
|
+
(0, import_react68.useEffect)(() => {
|
|
17577
17670
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
17578
17671
|
if (!enabled || reduced.matches) {
|
|
17579
17672
|
setProgress(1);
|
|
@@ -17616,8 +17709,8 @@ function mapLineEndLabel(source, target) {
|
|
|
17616
17709
|
// src/components/SvgMapPlot.tsx
|
|
17617
17710
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
17618
17711
|
function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized, onHover, stroke, strokeWidth, opacity, hoverable = true, showLabel = true, tooltipNameOnly = false }) {
|
|
17619
|
-
const path = (0,
|
|
17620
|
-
(0,
|
|
17712
|
+
const path = (0, import_react69.useRef)(null), [center, setCenter] = (0, import_react69.useState)([0, 0]);
|
|
17713
|
+
(0, import_react69.useLayoutEffect)(() => {
|
|
17621
17714
|
const box = path.current?.getBBox();
|
|
17622
17715
|
if (box) setCenter([box.x + box.width / 2, box.y + box.height / 2]);
|
|
17623
17716
|
}, [d]);
|
|
@@ -17635,9 +17728,9 @@ function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized
|
|
|
17635
17728
|
] }), onPointerMove: () => onHover(true), onPointerLeave: () => onHover(false), onFocus: () => onHover(true), onBlur: () => onHover(false), children: content });
|
|
17636
17729
|
}
|
|
17637
17730
|
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" }) {
|
|
17638
|
-
const map = (0,
|
|
17639
|
-
const [hoveredLine, setHoveredLine] = (0,
|
|
17640
|
-
(0,
|
|
17731
|
+
const map = (0, import_react69.useMemo)(() => parseSvgMapPaths(source), [source]), control = useMapRoam(roam, null, [1.2, 1 / 1.2]), [hovered, setHovered] = (0, import_react69.useState)();
|
|
17732
|
+
const [hoveredLine, setHoveredLine] = (0, import_react69.useState)();
|
|
17733
|
+
(0, import_react69.useEffect)(() => {
|
|
17641
17734
|
control.reset();
|
|
17642
17735
|
setHovered(void 0);
|
|
17643
17736
|
}, [resetKey]);
|
|
@@ -17700,16 +17793,16 @@ function SvgMapPlot({ source, name, data, x, y, width, height, domain, range = d
|
|
|
17700
17793
|
}
|
|
17701
17794
|
|
|
17702
17795
|
// src/components/ChartRoamController.tsx
|
|
17703
|
-
var
|
|
17796
|
+
var import_react70 = require("react");
|
|
17704
17797
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
17705
17798
|
function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
|
|
17706
|
-
const [hovered, setHovered] = (0,
|
|
17707
|
-
const timer = (0,
|
|
17799
|
+
const [hovered, setHovered] = (0, import_react70.useState)(), [focused, setFocused] = (0, import_react70.useState)();
|
|
17800
|
+
const timer = (0, import_react70.useRef)();
|
|
17708
17801
|
const stop = () => {
|
|
17709
17802
|
if (timer.current !== void 0) clearInterval(timer.current);
|
|
17710
17803
|
timer.current = void 0;
|
|
17711
17804
|
};
|
|
17712
|
-
(0,
|
|
17805
|
+
(0, import_react70.useEffect)(() => {
|
|
17713
17806
|
window.addEventListener("blur", stop);
|
|
17714
17807
|
return () => {
|
|
17715
17808
|
stop();
|
|
@@ -17748,13 +17841,13 @@ function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
|
|
|
17748
17841
|
}
|
|
17749
17842
|
|
|
17750
17843
|
// src/components/LineShareChart.tsx
|
|
17751
|
-
var
|
|
17844
|
+
var import_react90 = require("react");
|
|
17752
17845
|
|
|
17753
17846
|
// src/components/Charts.tsx
|
|
17754
|
-
var
|
|
17847
|
+
var import_react88 = require("react");
|
|
17755
17848
|
|
|
17756
17849
|
// src/components/ChartScatterMotion.tsx
|
|
17757
|
-
var
|
|
17850
|
+
var import_react71 = require("react");
|
|
17758
17851
|
|
|
17759
17852
|
// src/components/scatterMotion.ts
|
|
17760
17853
|
function scatterMotionEase(progress) {
|
|
@@ -17766,9 +17859,9 @@ function scatterMotionEase(progress) {
|
|
|
17766
17859
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
17767
17860
|
function ChartScatterMotion({ x, y, radius, enabled, duration = 2e3, updateDuration = 500, progress, children }) {
|
|
17768
17861
|
const target = { x, y, radius };
|
|
17769
|
-
const [frame, setFrame] = (0,
|
|
17770
|
-
const displayed = (0,
|
|
17771
|
-
(0,
|
|
17862
|
+
const [frame, setFrame] = (0, import_react71.useState)(() => ({ ...target, radius: enabled ? radius * 0.01 : radius }));
|
|
17863
|
+
const displayed = (0, import_react71.useRef)(frame), started = (0, import_react71.useRef)(false);
|
|
17864
|
+
(0, import_react71.useEffect)(() => {
|
|
17772
17865
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
17773
17866
|
let request = 0;
|
|
17774
17867
|
const publish = (next) => {
|
|
@@ -17879,12 +17972,12 @@ function layoutEventRiver(series, tailLength, area) {
|
|
|
17879
17972
|
}
|
|
17880
17973
|
|
|
17881
17974
|
// src/components/EventRiverBubble.tsx
|
|
17882
|
-
var
|
|
17975
|
+
var import_react72 = require("react");
|
|
17883
17976
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
17884
17977
|
function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerUp, ...props }) {
|
|
17885
|
-
const [offset, setOffset] = (0,
|
|
17886
|
-
const drag = (0,
|
|
17887
|
-
(0,
|
|
17978
|
+
const [offset, setOffset] = (0, import_react72.useState)(0);
|
|
17979
|
+
const drag = (0, import_react72.useRef)();
|
|
17980
|
+
(0, import_react72.useEffect)(() => {
|
|
17888
17981
|
setOffset(0);
|
|
17889
17982
|
drag.current = void 0;
|
|
17890
17983
|
}, [resetKey]);
|
|
@@ -17935,13 +18028,13 @@ function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerU
|
|
|
17935
18028
|
}
|
|
17936
18029
|
|
|
17937
18030
|
// src/components/EventRiverMotion.tsx
|
|
17938
|
-
var
|
|
18031
|
+
var import_react73 = require("react");
|
|
17939
18032
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
17940
18033
|
function EventRiverMotion({ geometry, enabled = true, duration = 2e3, updateDuration = 500, progress, children }) {
|
|
17941
|
-
const [frame, setFrame] = (0,
|
|
17942
|
-
const displayed = (0,
|
|
18034
|
+
const [frame, setFrame] = (0, import_react73.useState)(() => ({ ...geometry, scale: enabled ? 0.1 : 1 }));
|
|
18035
|
+
const displayed = (0, import_react73.useRef)(frame), started = (0, import_react73.useRef)(false);
|
|
17943
18036
|
const signature = JSON.stringify(geometry);
|
|
17944
|
-
(0,
|
|
18037
|
+
(0, import_react73.useEffect)(() => {
|
|
17945
18038
|
const preference = window.matchMedia("(prefers-reduced-motion: reduce)"), target = { ...geometry, scale: 1 };
|
|
17946
18039
|
const from = started.current ? displayed.current : { ...geometry, scale: 0.1 };
|
|
17947
18040
|
let request = 0;
|
|
@@ -18058,7 +18151,7 @@ function transferPieValue(series, source, target, connector = " & ") {
|
|
|
18058
18151
|
}
|
|
18059
18152
|
|
|
18060
18153
|
// src/components/ChartValueIsland.tsx
|
|
18061
|
-
var
|
|
18154
|
+
var import_react74 = require("react");
|
|
18062
18155
|
|
|
18063
18156
|
// src/components/cartesianTransfer.ts
|
|
18064
18157
|
function addValues(a, b) {
|
|
@@ -18123,13 +18216,13 @@ function findCompositeValueTarget(element, x, y) {
|
|
|
18123
18216
|
// src/components/ChartValueIsland.tsx
|
|
18124
18217
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
18125
18218
|
function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolveTarget = findCompositeValueTarget }) {
|
|
18126
|
-
const drag = (0,
|
|
18127
|
-
const [offset, setOffset] = (0,
|
|
18219
|
+
const drag = (0, import_react74.useRef)(null);
|
|
18220
|
+
const [offset, setOffset] = (0, import_react74.useState)([0, 0]);
|
|
18128
18221
|
const cancel = () => {
|
|
18129
18222
|
drag.current = null;
|
|
18130
18223
|
setOffset([0, 0]);
|
|
18131
18224
|
};
|
|
18132
|
-
(0,
|
|
18225
|
+
(0, import_react74.useEffect)(cancel, [x, y]);
|
|
18133
18226
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
18134
18227
|
ChartMark,
|
|
18135
18228
|
{
|
|
@@ -18182,12 +18275,12 @@ function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolv
|
|
|
18182
18275
|
}
|
|
18183
18276
|
|
|
18184
18277
|
// src/components/ChartPulseRing.tsx
|
|
18185
|
-
var
|
|
18278
|
+
var import_react75 = require("react");
|
|
18186
18279
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
18187
18280
|
function ChartPulseRing({ center, radius, scaleSize = 2, color = "gold", shadowBlur = 10, period = 15, progress, enabled = true }) {
|
|
18188
|
-
const id = (0,
|
|
18189
|
-
const [reduced, setReduced] = (0,
|
|
18190
|
-
(0,
|
|
18281
|
+
const id = (0, import_react75.useId)().replace(/:/g, ""), [phase, setPhase] = (0, import_react75.useState)(0);
|
|
18282
|
+
const [reduced, setReduced] = (0, import_react75.useState)(false);
|
|
18283
|
+
(0, import_react75.useEffect)(() => {
|
|
18191
18284
|
const preference = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
18192
18285
|
setReduced(preference.matches);
|
|
18193
18286
|
let frame = 0;
|
|
@@ -18331,7 +18424,7 @@ function chartMarkerPath(kind, x, y, size) {
|
|
|
18331
18424
|
}
|
|
18332
18425
|
|
|
18333
18426
|
// src/components/ChartLargeMapPointCanvas.tsx
|
|
18334
|
-
var
|
|
18427
|
+
var import_react76 = require("react");
|
|
18335
18428
|
|
|
18336
18429
|
// src/components/largeMapPointPulse.ts
|
|
18337
18430
|
function largeMapPointPulse(elapsed, period, initial3, delay) {
|
|
@@ -18347,8 +18440,8 @@ function largeMapPointSize(size, pulse) {
|
|
|
18347
18440
|
// src/components/ChartLargeMapPointCanvas.tsx
|
|
18348
18441
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
18349
18442
|
function ChartLargeMapPointCanvas({ groups, width, height }) {
|
|
18350
|
-
const canvas = (0,
|
|
18351
|
-
(0,
|
|
18443
|
+
const canvas = (0, import_react76.useRef)(null), key = JSON.stringify(groups);
|
|
18444
|
+
(0, import_react76.useEffect)(() => {
|
|
18352
18445
|
const element = canvas.current, context = element?.getContext("2d");
|
|
18353
18446
|
if (!element || !context) return;
|
|
18354
18447
|
const ratio = window.devicePixelRatio || 1;
|
|
@@ -18407,12 +18500,12 @@ function ChartLargeMapPointCanvas({ groups, width, height }) {
|
|
|
18407
18500
|
}
|
|
18408
18501
|
|
|
18409
18502
|
// src/components/ChartCrosshair.tsx
|
|
18410
|
-
var
|
|
18503
|
+
var import_react77 = require("react");
|
|
18411
18504
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
18412
18505
|
function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY = decimal }) {
|
|
18413
|
-
const ref = (0,
|
|
18414
|
-
const [point, setPoint] = (0,
|
|
18415
|
-
(0,
|
|
18506
|
+
const ref = (0, import_react77.useRef)(null);
|
|
18507
|
+
const [point, setPoint] = (0, import_react77.useState)(null);
|
|
18508
|
+
(0, import_react77.useEffect)(() => {
|
|
18416
18509
|
const svg = ref.current?.ownerSVGElement;
|
|
18417
18510
|
if (!svg) return;
|
|
18418
18511
|
const clear = () => setPoint(null);
|
|
@@ -18432,7 +18525,7 @@ function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY =
|
|
|
18432
18525
|
svg.removeEventListener("pointercancel", clear);
|
|
18433
18526
|
};
|
|
18434
18527
|
}, [bounds.x, bounds.y, bounds.width, bounds.height]);
|
|
18435
|
-
(0,
|
|
18528
|
+
(0, import_react77.useEffect)(() => setPoint(null), [xDomain[0], xDomain[1], yDomain[0], yDomain[1]]);
|
|
18436
18529
|
const x = point ? xDomain[0] + (point.x - bounds.x) / bounds.width * (xDomain[1] - xDomain[0]) : 0;
|
|
18437
18530
|
const y = point ? yDomain[1] - (point.y - bounds.y) / bounds.height * (yDomain[1] - yDomain[0]) : 0;
|
|
18438
18531
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("g", { ref, className: "sia-chart__crosshair", "aria-hidden": "true", children: [
|
|
@@ -18449,7 +18542,7 @@ function decimal(value) {
|
|
|
18449
18542
|
}
|
|
18450
18543
|
|
|
18451
18544
|
// src/components/HeatmapRasterLayer.tsx
|
|
18452
|
-
var
|
|
18545
|
+
var import_react78 = require("react");
|
|
18453
18546
|
|
|
18454
18547
|
// src/components/heatmapRaster.ts
|
|
18455
18548
|
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] }];
|
|
@@ -18496,9 +18589,9 @@ function rasterizeHeatmap(width, height, points, options = {}) {
|
|
|
18496
18589
|
// src/components/HeatmapRasterLayer.tsx
|
|
18497
18590
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
18498
18591
|
function HeatmapRaster({ width, height, points, options }) {
|
|
18499
|
-
const [url, setUrl] = (0,
|
|
18592
|
+
const [url, setUrl] = (0, import_react78.useState)();
|
|
18500
18593
|
const optionsKey = JSON.stringify(options);
|
|
18501
|
-
(0,
|
|
18594
|
+
(0, import_react78.useEffect)(() => {
|
|
18502
18595
|
const canvas = document.createElement("canvas");
|
|
18503
18596
|
canvas.width = width;
|
|
18504
18597
|
canvas.height = height;
|
|
@@ -18598,10 +18691,10 @@ function chordMatrixLayout(matrix, options = {}) {
|
|
|
18598
18691
|
}
|
|
18599
18692
|
|
|
18600
18693
|
// src/components/MatrixChordPlot.tsx
|
|
18601
|
-
var
|
|
18694
|
+
var import_react79 = require("react");
|
|
18602
18695
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
18603
18696
|
function MatrixChordPlot({ names, matrix, series, appearance, showNodeLabels = false, rotateNodeLabels = false, linkLabel, sort, sortSub, padAngle, clockwise, palette, geometry, legacySubSort = false, showScale = false }) {
|
|
18604
|
-
const [hoveredLink, setHoveredLink] = (0,
|
|
18697
|
+
const [hoveredLink, setHoveredLink] = (0, import_react79.useState)(null);
|
|
18605
18698
|
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;
|
|
18606
18699
|
const point = (angle) => [cx + Math.cos(angle) * r, cy + Math.sin(angle) * r];
|
|
18607
18700
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("g", { className: "sia-chart__matrix-chord", children: [
|
|
@@ -18948,13 +19041,13 @@ function transferRadarSeries(panels, source, target, connector = " & ") {
|
|
|
18948
19041
|
}
|
|
18949
19042
|
|
|
18950
19043
|
// src/components/ChartRoamGroup.tsx
|
|
18951
|
-
var
|
|
19044
|
+
var import_react80 = require("react");
|
|
18952
19045
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
18953
19046
|
var initial2 = { x: 0, y: 0, scale: 1 };
|
|
18954
19047
|
function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true, ariaLabel, resetSignal = 0 }) {
|
|
18955
|
-
const group = (0,
|
|
18956
|
-
const [view, setView] = (0,
|
|
18957
|
-
(0,
|
|
19048
|
+
const group = (0, import_react80.useRef)(null), drag = (0, import_react80.useRef)();
|
|
19049
|
+
const [view, setView] = (0, import_react80.useState)(initial2);
|
|
19050
|
+
(0, import_react80.useEffect)(() => {
|
|
18958
19051
|
setView(initial2);
|
|
18959
19052
|
drag.current = void 0;
|
|
18960
19053
|
}, [resetSignal]);
|
|
@@ -18964,7 +19057,7 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
|
|
|
18964
19057
|
const local = new DOMPoint(clientX, clientY).matrixTransform(matrix.inverse());
|
|
18965
19058
|
return [local.x, local.y];
|
|
18966
19059
|
};
|
|
18967
|
-
(0,
|
|
19060
|
+
(0, import_react80.useEffect)(() => {
|
|
18968
19061
|
const target = group.current;
|
|
18969
19062
|
if (!target || !enabled || !zoomEnabled) return;
|
|
18970
19063
|
const wheel = (event) => {
|
|
@@ -19025,11 +19118,11 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
|
|
|
19025
19118
|
}
|
|
19026
19119
|
|
|
19027
19120
|
// src/components/TreeNodeGlyph.tsx
|
|
19028
|
-
var
|
|
19121
|
+
var import_react81 = require("react");
|
|
19029
19122
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
19030
19123
|
function TreeNodeGlyph({ symbol = "circle", x, y, width, height, color, itemStyle }) {
|
|
19031
|
-
const [failed, setFailed] = (0,
|
|
19032
|
-
(0,
|
|
19124
|
+
const [failed, setFailed] = (0, import_react81.useState)(false);
|
|
19125
|
+
(0, import_react81.useEffect)(() => setFailed(false), [symbol]);
|
|
19033
19126
|
const style = { fill: itemStyle.brushType === "stroke" ? "none" : color, stroke: itemStyle.borderColor, strokeWidth: itemStyle.borderWidth };
|
|
19034
19127
|
if (symbol.startsWith("image://")) return failed ? /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("g", { role: "img", "aria-label": "\u539F\u59CB\u8282\u70B9\u56FE\u7247\u52A0\u8F7D\u5931\u8D25", children: [
|
|
19035
19128
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("rect", { x: x - width / 2, y: y - height / 2, width, height, fill: "none", stroke: "#999", strokeDasharray: "3 3" }),
|
|
@@ -19318,7 +19411,7 @@ function resolveMapRegionAppearance(base, datum, emphasized) {
|
|
|
19318
19411
|
}
|
|
19319
19412
|
|
|
19320
19413
|
// src/components/ChartBundledMapCanvas.tsx
|
|
19321
|
-
var
|
|
19414
|
+
var import_react82 = require("react");
|
|
19322
19415
|
|
|
19323
19416
|
// src/components/edgeBundling.ts
|
|
19324
19417
|
var distance = (a, b) => Math.hypot(a[0] - b[0], a[1] - b[1]);
|
|
@@ -19462,9 +19555,9 @@ function sampleBundledPath(curves, progress) {
|
|
|
19462
19555
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
19463
19556
|
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 }) {
|
|
19464
19557
|
const signature = JSON.stringify(edges), pointKey = JSON.stringify(points), effectKey = JSON.stringify(effect);
|
|
19465
|
-
const paths = (0,
|
|
19466
|
-
const base = (0,
|
|
19467
|
-
(0,
|
|
19558
|
+
const paths = (0, import_react82.useMemo)(() => bundleEdges(JSON.parse(signature)).map((row) => ({ index: row.index, curves: smoothBundledPath(row.points, smoothness) })), [signature, smoothness]);
|
|
19559
|
+
const base = (0, import_react82.useRef)(null), moving = (0, import_react82.useRef)(null);
|
|
19560
|
+
(0, import_react82.useEffect)(() => {
|
|
19468
19561
|
const node = base.current, ctx = node?.getContext("2d");
|
|
19469
19562
|
if (!node || !ctx) return;
|
|
19470
19563
|
const ratio = window.devicePixelRatio || 1;
|
|
@@ -19490,7 +19583,7 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
|
|
|
19490
19583
|
ctx.fill();
|
|
19491
19584
|
}
|
|
19492
19585
|
}, [paths, pointKey, width, height, color, opacity, lineWidth, pointColor, pointRadius]);
|
|
19493
|
-
(0,
|
|
19586
|
+
(0, import_react82.useEffect)(() => {
|
|
19494
19587
|
const node = moving.current, ctx = node?.getContext("2d");
|
|
19495
19588
|
if (!node || !ctx) return;
|
|
19496
19589
|
const ratio = window.devicePixelRatio || 1;
|
|
@@ -19552,11 +19645,11 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
|
|
|
19552
19645
|
}
|
|
19553
19646
|
|
|
19554
19647
|
// src/components/ChartMapEffectCanvas.tsx
|
|
19555
|
-
var
|
|
19648
|
+
var import_react83 = require("react");
|
|
19556
19649
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
19557
19650
|
function ChartMapEffectCanvas({ effects, width, height, alpha = 0.95 }) {
|
|
19558
|
-
const canvas = (0,
|
|
19559
|
-
(0,
|
|
19651
|
+
const canvas = (0, import_react83.useRef)(null), key = JSON.stringify(effects);
|
|
19652
|
+
(0, import_react83.useEffect)(() => {
|
|
19560
19653
|
const element = canvas.current;
|
|
19561
19654
|
if (!element) return;
|
|
19562
19655
|
const context = element.getContext("2d");
|
|
@@ -19702,12 +19795,12 @@ function layoutTreeNodes(root, options = {}) {
|
|
|
19702
19795
|
}
|
|
19703
19796
|
|
|
19704
19797
|
// src/components/ChartDataEditor.tsx
|
|
19705
|
-
var
|
|
19798
|
+
var import_react84 = require("react");
|
|
19706
19799
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
19707
19800
|
function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false }) {
|
|
19708
|
-
const [draft, setDraft] = (0,
|
|
19709
|
-
const [error, setError] = (0,
|
|
19710
|
-
const [applied, setApplied] = (0,
|
|
19801
|
+
const [draft, setDraft] = (0, import_react84.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
|
|
19802
|
+
const [error, setError] = (0, import_react84.useState)("");
|
|
19803
|
+
const [applied, setApplied] = (0, import_react84.useState)(false);
|
|
19711
19804
|
function apply() {
|
|
19712
19805
|
try {
|
|
19713
19806
|
const values = JSON.parse(draft);
|
|
@@ -19738,11 +19831,11 @@ function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false
|
|
|
19738
19831
|
}
|
|
19739
19832
|
|
|
19740
19833
|
// src/components/ChartBarStatistics.tsx
|
|
19741
|
-
var
|
|
19834
|
+
var import_react85 = require("react");
|
|
19742
19835
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
19743
19836
|
function ChartBarStatistics({ values, kinds, project, plot, horizontal, color, gradient, seriesName }) {
|
|
19744
|
-
const id = (0,
|
|
19745
|
-
const [active, setActive] = (0,
|
|
19837
|
+
const id = (0, import_react85.useId)().replaceAll(":", "");
|
|
19838
|
+
const [active, setActive] = (0, import_react85.useState)();
|
|
19746
19839
|
const paint = gradient ? `url(#${id})` : color;
|
|
19747
19840
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("g", { children: [
|
|
19748
19841
|
gradient ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime85.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_runtime85.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
|
|
@@ -19797,7 +19890,7 @@ function lineSegments(points) {
|
|
|
19797
19890
|
}
|
|
19798
19891
|
|
|
19799
19892
|
// src/components/useBarMagicState.ts
|
|
19800
|
-
var
|
|
19893
|
+
var import_react86 = require("react");
|
|
19801
19894
|
|
|
19802
19895
|
// src/components/cartesianMagicState.ts
|
|
19803
19896
|
function changeCartesianMagic(state, action) {
|
|
@@ -19812,8 +19905,8 @@ function changeCartesianMagic(state, action) {
|
|
|
19812
19905
|
function useBarMagicState(toolbox, shape = "bar") {
|
|
19813
19906
|
const initial3 = { shape, layout: "original" };
|
|
19814
19907
|
const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
|
|
19815
|
-
const [state, setState] = (0,
|
|
19816
|
-
(0,
|
|
19908
|
+
const [state, setState] = (0, import_react86.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
|
|
19909
|
+
(0, import_react86.useEffect)(() => {
|
|
19817
19910
|
if (options?.activeMagicType) setState((s) => changeCartesianMagic(s, options.activeMagicType));
|
|
19818
19911
|
}, [options?.activeMagicType]);
|
|
19819
19912
|
const resolved = options ? { ...options, activeMagicType: state.shape, activeMagicTypes: options.activeMagicTypes ?? (state.layout === "original" ? [state.shape] : [state.shape, state.layout]), onMagicTypeChange: (action) => {
|
|
@@ -19827,7 +19920,7 @@ function useBarMagicState(toolbox, shape = "bar") {
|
|
|
19827
19920
|
}
|
|
19828
19921
|
|
|
19829
19922
|
// src/components/useBarValueTransfer.ts
|
|
19830
|
-
var
|
|
19923
|
+
var import_react87 = require("react");
|
|
19831
19924
|
|
|
19832
19925
|
// src/components/barTransfer.ts
|
|
19833
19926
|
function transferBarValue(series, source, target, categories) {
|
|
@@ -19844,10 +19937,10 @@ function transferBarValue(series, source, target, categories) {
|
|
|
19844
19937
|
|
|
19845
19938
|
// src/components/useBarValueTransfer.ts
|
|
19846
19939
|
function useBarValueTransfer(series, initial3, categories, enabled, publish, onError) {
|
|
19847
|
-
const [islands, setIslands] = (0,
|
|
19848
|
-
const drag = (0,
|
|
19849
|
-
const [offset, setOffset] = (0,
|
|
19850
|
-
(0,
|
|
19940
|
+
const [islands, setIslands] = (0, import_react87.useState)([]);
|
|
19941
|
+
const drag = (0, import_react87.useRef)();
|
|
19942
|
+
const [offset, setOffset] = (0, import_react87.useState)();
|
|
19943
|
+
(0, import_react87.useEffect)(() => {
|
|
19851
19944
|
setIslands([]);
|
|
19852
19945
|
drag.current = void 0;
|
|
19853
19946
|
setOffset(void 0);
|
|
@@ -19948,12 +20041,12 @@ function logarithmicValueAt(progress, domain) {
|
|
|
19948
20041
|
|
|
19949
20042
|
// src/components/Charts.tsx
|
|
19950
20043
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
19951
|
-
var
|
|
20044
|
+
var import_react89 = require("react");
|
|
19952
20045
|
var PLOT = { x: 62, y: 48, width: 628, height: 250 };
|
|
19953
20046
|
var PLOT_BOTTOM = PLOT.y + PLOT.height;
|
|
19954
20047
|
function useLegendSelection(names, controlled, onChange) {
|
|
19955
|
-
const [internal, setInternal] = (0,
|
|
19956
|
-
(0,
|
|
20048
|
+
const [internal, setInternal] = (0, import_react88.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
|
|
20049
|
+
(0, import_react88.useEffect)(() => {
|
|
19957
20050
|
setInternal((current) => {
|
|
19958
20051
|
const next = { ...current };
|
|
19959
20052
|
names.forEach((name) => {
|
|
@@ -20053,7 +20146,7 @@ function lineSymbol(type, x, y, size, color, image, strokeWidth = 2) {
|
|
|
20053
20146
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("circle", { cx: x, cy: y, r: size / 2, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 });
|
|
20054
20147
|
}
|
|
20055
20148
|
function useZoom(value, defaultValue, onChange) {
|
|
20056
|
-
const [internal, setInternal] = (0,
|
|
20149
|
+
const [internal, setInternal] = (0, import_react88.useState)([...defaultValue ?? [0, 100]]);
|
|
20057
20150
|
const current = value ?? internal;
|
|
20058
20151
|
const update = (next) => {
|
|
20059
20152
|
if (!value) setInternal(next);
|
|
@@ -20063,8 +20156,8 @@ function useZoom(value, defaultValue, onChange) {
|
|
|
20063
20156
|
}
|
|
20064
20157
|
function useToolboxMagicType(toolbox, fallback) {
|
|
20065
20158
|
const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
|
|
20066
|
-
const [internal, setInternal] = (0,
|
|
20067
|
-
(0,
|
|
20159
|
+
const [internal, setInternal] = (0, import_react88.useState)(options?.activeMagicType ?? fallback);
|
|
20160
|
+
(0, import_react88.useEffect)(() => {
|
|
20068
20161
|
if (options?.activeMagicType) setInternal(options.activeMagicType);
|
|
20069
20162
|
}, [options?.activeMagicType]);
|
|
20070
20163
|
const active = options?.activeMagicType ?? internal;
|
|
@@ -20082,15 +20175,15 @@ function useToolboxMagicType(toolbox, fallback) {
|
|
|
20082
20175
|
} : toolbox;
|
|
20083
20176
|
return [active, resolved];
|
|
20084
20177
|
}
|
|
20085
|
-
var LineChart = (0,
|
|
20086
|
-
const [hoverIndex, setHoverIndex] = (0,
|
|
20087
|
-
const [editableSeries, setEditableSeries] = (0,
|
|
20088
|
-
const [dragPoint, setDragPoint] = (0,
|
|
20089
|
-
const linePaintId = (0,
|
|
20090
|
-
const [hoveredLinePoint, setHoveredLinePoint] = (0,
|
|
20091
|
-
(0,
|
|
20178
|
+
var LineChart = (0, import_react88.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) {
|
|
20179
|
+
const [hoverIndex, setHoverIndex] = (0, import_react88.useState)(null);
|
|
20180
|
+
const [editableSeries, setEditableSeries] = (0, import_react88.useState)(sourceSeries);
|
|
20181
|
+
const [dragPoint, setDragPoint] = (0, import_react88.useState)(null);
|
|
20182
|
+
const linePaintId = (0, import_react88.useId)().replaceAll(":", "");
|
|
20183
|
+
const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react88.useState)();
|
|
20184
|
+
(0, import_react88.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
|
|
20092
20185
|
const series = externalValueTransfer ? sourceSeries : editableSeries;
|
|
20093
|
-
const initialTransferSeries = (0,
|
|
20186
|
+
const initialTransferSeries = (0, import_react88.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
|
|
20094
20187
|
const localTransfer = useBarValueTransfer(series.map((item) => ({ ...item, data: item.data.map(lineValue) })), initialTransferSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (nextBars) => {
|
|
20095
20188
|
const next = series.map((item, row) => ({ ...item, data: item.data.map((datum, index) => {
|
|
20096
20189
|
const value = barDatum(nextBars[row].data[index]).value;
|
|
@@ -20107,8 +20200,8 @@ var LineChart = (0, import_react87.forwardRef)(function LineChart2({ calculableM
|
|
|
20107
20200
|
const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
20108
20201
|
const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
|
|
20109
20202
|
const inlineZoom = dataZoom && zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("foreignObject", { className: "sia-chart__inline-zoom sia-chart__inline-zoom--compact", ...withTitleTooltip(zoomControlBounds), children: /* @__PURE__ */ (0, import_jsx_runtime86.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;
|
|
20110
|
-
const [zoomBrushActive, setZoomBrushActive] = (0,
|
|
20111
|
-
const [zoomHistory, setZoomHistory] = (0,
|
|
20203
|
+
const [zoomBrushActive, setZoomBrushActive] = (0, import_react88.useState)(false);
|
|
20204
|
+
const [zoomHistory, setZoomHistory] = (0, import_react88.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
|
|
20112
20205
|
const zoomBrush = dataZoom && zoomBrushActive ? { minSelectionSize: zoomMinSelectionSize, selectionStyle: zoomSelectionStyle, selectionShape: zoomSelectionShape, bounds: PLOT2, onCancel: () => setZoomBrushActive(false), onSelect: (range) => {
|
|
20113
20206
|
const start = Math.min(...zoomValue), span = Math.max(...zoomValue) - start;
|
|
20114
20207
|
const next = [start + range[0] * span, start + range[1] * span];
|
|
@@ -20495,17 +20588,17 @@ function ChartPin({ point, color, label }) {
|
|
|
20495
20588
|
function barDatum(datum) {
|
|
20496
20589
|
return typeof datum === "number" ? { value: datum } : datum;
|
|
20497
20590
|
}
|
|
20498
|
-
var BarChart = (0,
|
|
20499
|
-
const [editableSeries, setEditableSeries] = (0,
|
|
20500
|
-
const [dragBar, setDragBar] = (0,
|
|
20501
|
-
const [hoveredBar, setHoveredBar] = (0,
|
|
20502
|
-
const barPaintId = (0,
|
|
20591
|
+
var BarChart = (0, import_react88.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) {
|
|
20592
|
+
const [editableSeries, setEditableSeries] = (0, import_react88.useState)(sourceSeries);
|
|
20593
|
+
const [dragBar, setDragBar] = (0, import_react88.useState)(null);
|
|
20594
|
+
const [hoveredBar, setHoveredBar] = (0, import_react88.useState)();
|
|
20595
|
+
const barPaintId = (0, import_react88.useId)().replaceAll(":", "");
|
|
20503
20596
|
const localTransfer = useBarValueTransfer(editableSeries, sourceSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (next) => {
|
|
20504
20597
|
setEditableSeries(next);
|
|
20505
20598
|
onDataChange?.(next);
|
|
20506
20599
|
}, onTransferError);
|
|
20507
20600
|
const transfer = externalValueTransfer ?? localTransfer;
|
|
20508
|
-
(0,
|
|
20601
|
+
(0, import_react88.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
|
|
20509
20602
|
const series = externalValueTransfer ? sourceSeries : editableSeries;
|
|
20510
20603
|
const legacy = appearance === "macarons";
|
|
20511
20604
|
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 };
|
|
@@ -20752,17 +20845,17 @@ var BarChart = (0, import_react87.forwardRef)(function BarChart2({ valueTransfer
|
|
|
20752
20845
|
] }, `bar-island-${index}`)) : null
|
|
20753
20846
|
] });
|
|
20754
20847
|
});
|
|
20755
|
-
var ScatterChart = (0,
|
|
20756
|
-
const [data, setData] = (0,
|
|
20757
|
-
const [emphasizedPoint, setEmphasizedPoint] = (0,
|
|
20758
|
-
const [emphasizedAnnotation, setEmphasizedAnnotation] = (0,
|
|
20759
|
-
(0,
|
|
20848
|
+
var ScatterChart = (0, import_react88.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) {
|
|
20849
|
+
const [data, setData] = (0, import_react88.useState)(initialData);
|
|
20850
|
+
const [emphasizedPoint, setEmphasizedPoint] = (0, import_react88.useState)(null);
|
|
20851
|
+
const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react88.useState)();
|
|
20852
|
+
(0, import_react88.useEffect)(() => setData(initialData), [initialData]);
|
|
20760
20853
|
const plot = plotBounds ?? PLOT, bottom = plot.y + plot.height;
|
|
20761
20854
|
const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
|
|
20762
20855
|
const allCategories = [...new Set(data.map((item) => item.category).filter((value) => Boolean(value)))];
|
|
20763
20856
|
const legend = useLegendSelection(allCategories, legendSelected, onLegendSelectionChange);
|
|
20764
20857
|
const activeData = data.filter((item) => !item.category || legend.isSelected(item.category));
|
|
20765
|
-
const sorted = (0,
|
|
20858
|
+
const sorted = (0, import_react88.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
|
|
20766
20859
|
const startIndex = dataZoom ? Math.floor(Math.min(...zoomValue) / 100 * Math.max(0, sorted.length - 1)) : 0;
|
|
20767
20860
|
const endIndex = dataZoom ? Math.max(startIndex + 1, Math.ceil(Math.max(...zoomValue) / 100 * sorted.length)) : sorted.length;
|
|
20768
20861
|
const categoryWindow = xCategories ? scatterCategoryWindow(xCategories, dataZoom ? zoomValue : [0, 100]) : void 0;
|
|
@@ -20777,10 +20870,10 @@ var ScatterChart = (0, import_react87.forwardRef)(function ScatterChart2({ symbo
|
|
|
20777
20870
|
const visualMinimum = visualMap?.min ?? (visualValues.length ? Math.min(...visualValues) : 0);
|
|
20778
20871
|
const visualMaximum = visualMap?.max ?? (visualValues.length ? Math.max(...visualValues) : 1);
|
|
20779
20872
|
const visualColors = visualMap?.colors ?? ["#e6f4ff", "#1677ff"];
|
|
20780
|
-
const [selectedPieces, setSelectedPieces] = (0,
|
|
20781
|
-
const [visualRange, setVisualRange] = (0,
|
|
20873
|
+
const [selectedPieces, setSelectedPieces] = (0, import_react88.useState)([]);
|
|
20874
|
+
const [visualRange, setVisualRange] = (0, import_react88.useState)();
|
|
20782
20875
|
const piecesKey = JSON.stringify(visualMap?.pieces ?? []);
|
|
20783
|
-
(0,
|
|
20876
|
+
(0, import_react88.useEffect)(() => setSelectedPieces([]), [piecesKey]);
|
|
20784
20877
|
const statistics = scatterStatistics(visibleData, markByCategory);
|
|
20785
20878
|
const plotted = visibleData.map((item, index) => {
|
|
20786
20879
|
const x = linearScale(categoryWindow ? categoryWindow.indexOf(item.x) : item.x, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]);
|
|
@@ -20938,8 +21031,8 @@ var ScatterChart = (0, import_react87.forwardRef)(function ScatterChart2({ symbo
|
|
|
20938
21031
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ChartDataZoom, { value: zoomValue, onChange: setZoomValue })
|
|
20939
21032
|
] }) : content;
|
|
20940
21033
|
});
|
|
20941
|
-
var CandlestickChart = (0,
|
|
20942
|
-
const [data, setData] = (0,
|
|
21034
|
+
var CandlestickChart = (0, import_react88.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) {
|
|
21035
|
+
const [data, setData] = (0, import_react88.useState)(initialData), [internalActive, setInternalActive] = (0, import_react88.useState)(null), [internalVisible, setInternalVisible] = (0, import_react88.useState)(true);
|
|
20943
21036
|
const active = activeIndex === void 0 ? internalActive : activeIndex;
|
|
20944
21037
|
const seriesVisible = controlledVisible ?? internalVisible;
|
|
20945
21038
|
const setActive = (index) => {
|
|
@@ -20950,7 +21043,7 @@ var CandlestickChart = (0, import_react87.forwardRef)(function CandlestickChart2
|
|
|
20950
21043
|
if (controlledVisible === void 0) setInternalVisible(visible);
|
|
20951
21044
|
onSeriesVisibilityChange?.(visible);
|
|
20952
21045
|
};
|
|
20953
|
-
(0,
|
|
21046
|
+
(0, import_react88.useEffect)(() => {
|
|
20954
21047
|
setData(initialData);
|
|
20955
21048
|
}, [initialData]);
|
|
20956
21049
|
const legacy = appearance === "macarons";
|
|
@@ -21041,20 +21134,20 @@ var CandlestickChart = (0, import_react87.forwardRef)(function CandlestickChart2
|
|
|
21041
21134
|
] }) : content;
|
|
21042
21135
|
});
|
|
21043
21136
|
var EMPTY_PIE_DATA = [];
|
|
21044
|
-
var PieChart = (0,
|
|
21045
|
-
const pieGradientId = (0,
|
|
21046
|
-
const [pieIslands, setPieIslands] = (0,
|
|
21047
|
-
const sourceRings = (0,
|
|
21048
|
-
const [editableRings, setEditableRings] = (0,
|
|
21049
|
-
const valueDrag = (0,
|
|
21050
|
-
const [valueOffset, setValueOffset] = (0,
|
|
21051
|
-
(0,
|
|
21137
|
+
var PieChart = (0, import_react88.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) {
|
|
21138
|
+
const pieGradientId = (0, import_react88.useId)().replace(/:/g, "");
|
|
21139
|
+
const [pieIslands, setPieIslands] = (0, import_react88.useState)([]);
|
|
21140
|
+
const sourceRings = (0, import_react88.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
|
|
21141
|
+
const [editableRings, setEditableRings] = (0, import_react88.useState)(sourceRings);
|
|
21142
|
+
const valueDrag = (0, import_react88.useRef)(null);
|
|
21143
|
+
const [valueOffset, setValueOffset] = (0, import_react88.useState)();
|
|
21144
|
+
(0, import_react88.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
|
|
21052
21145
|
const allData = editableRings.flatMap((ring) => ring.data).filter((item) => !item.missing);
|
|
21053
21146
|
const names = [...new Set(allData.map((item) => item.name))];
|
|
21054
21147
|
const legend = useLegendSelection(names, legendSelected, onLegendSelectionChange);
|
|
21055
21148
|
const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u997C\u56FE");
|
|
21056
|
-
const [hovered, setHovered] = (0,
|
|
21057
|
-
const [internalSelected, setInternalSelected] = (0,
|
|
21149
|
+
const [hovered, setHovered] = (0, import_react88.useState)();
|
|
21150
|
+
const [internalSelected, setInternalSelected] = (0, import_react88.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
|
|
21058
21151
|
const selectedNames = selected ?? internalSelected;
|
|
21059
21152
|
const legacy = appearance === "macarons";
|
|
21060
21153
|
const colorNames = [...new Set(allData.filter((item) => item.showInLegend !== false).map((item) => item.name))];
|
|
@@ -21274,15 +21367,15 @@ var PieChart = (0, import_react87.forwardRef)(function PieChart2({ pulseRing, ca
|
|
|
21274
21367
|
});
|
|
21275
21368
|
var EMPTY_RADAR_INDICATORS = [];
|
|
21276
21369
|
var EMPTY_RADAR_SERIES = [];
|
|
21277
|
-
var RadarChart = (0,
|
|
21370
|
+
var RadarChart = (0, import_react88.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) {
|
|
21278
21371
|
const legacy = appearance === "macarons";
|
|
21279
|
-
const initialPanels = (0,
|
|
21280
|
-
const [sourcePanels, setSourcePanels] = (0,
|
|
21281
|
-
const [hoveredRadar, setHoveredRadar] = (0,
|
|
21282
|
-
const radarPaintId = `sia-radar-${(0,
|
|
21283
|
-
const radarDrag = (0,
|
|
21284
|
-
const [radarOffset, setRadarOffset] = (0,
|
|
21285
|
-
(0,
|
|
21372
|
+
const initialPanels = (0, import_react88.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
|
|
21373
|
+
const [sourcePanels, setSourcePanels] = (0, import_react88.useState)(initialPanels);
|
|
21374
|
+
const [hoveredRadar, setHoveredRadar] = (0, import_react88.useState)(null);
|
|
21375
|
+
const radarPaintId = `sia-radar-${(0, import_react88.useId)().replaceAll(":", "")}`;
|
|
21376
|
+
const radarDrag = (0, import_react88.useRef)(null);
|
|
21377
|
+
const [radarOffset, setRadarOffset] = (0, import_react88.useState)(null);
|
|
21378
|
+
(0, import_react88.useEffect)(() => {
|
|
21286
21379
|
setSourcePanels(initialPanels);
|
|
21287
21380
|
radarDrag.current = null;
|
|
21288
21381
|
setRadarOffset(null);
|
|
@@ -21436,7 +21529,7 @@ var RadarChart = (0, import_react87.forwardRef)(function RadarChart2({ indicator
|
|
|
21436
21529
|
})
|
|
21437
21530
|
] });
|
|
21438
21531
|
});
|
|
21439
|
-
var ChordChart = (0,
|
|
21532
|
+
var ChordChart = (0, import_react88.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) {
|
|
21440
21533
|
const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u548C\u5F26");
|
|
21441
21534
|
if (/force|力导向|关系/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
21442
21535
|
GraphChart,
|
|
@@ -21509,11 +21602,11 @@ var ChordChart = (0, import_react87.forwardRef)(function ChordChart2({ nodes, li
|
|
|
21509
21602
|
})
|
|
21510
21603
|
] });
|
|
21511
21604
|
});
|
|
21512
|
-
var GraphChart = (0,
|
|
21605
|
+
var GraphChart = (0, import_react88.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) {
|
|
21513
21606
|
const categories = [...new Set(nodes.map((node) => node.category).filter((value) => Boolean(value)))];
|
|
21514
21607
|
const legend = useLegendSelection(categories, legendSelected, onLegendSelectionChange);
|
|
21515
21608
|
const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, layout === "force" ? "\u529B\u5BFC\u5411" : "\u5173\u7CFB");
|
|
21516
|
-
const [roamReset, setRoamReset] = (0,
|
|
21609
|
+
const [roamReset, setRoamReset] = (0, import_react88.useState)(0);
|
|
21517
21610
|
const chartToolbox = typeof resolvedToolbox === "object" ? {
|
|
21518
21611
|
...resolvedToolbox,
|
|
21519
21612
|
onRestore: () => {
|
|
@@ -21522,23 +21615,23 @@ var GraphChart = (0, import_react87.forwardRef)(function GraphChart2({ nodes, li
|
|
|
21522
21615
|
resolvedToolbox.onRestore?.();
|
|
21523
21616
|
}
|
|
21524
21617
|
} : resolvedToolbox;
|
|
21525
|
-
const activeNodes = (0,
|
|
21526
|
-
const activeLinks = (0,
|
|
21618
|
+
const activeNodes = (0, import_react88.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
|
|
21619
|
+
const activeLinks = (0, import_react88.useMemo)(() => {
|
|
21527
21620
|
const activeIds = new Set(activeNodes.map((node) => node.id));
|
|
21528
21621
|
return links.filter((link) => activeIds.has(link.source) && activeIds.has(link.target));
|
|
21529
21622
|
}, [activeNodes, links]);
|
|
21530
21623
|
const progressive = progressiveForce && layout === "force" && props.animation !== false && !/chord|和弦/i.test(magicType);
|
|
21531
|
-
const calculatedPositions = (0,
|
|
21532
|
-
const [positions, setPositions] = (0,
|
|
21533
|
-
const [dragging, setDragging] = (0,
|
|
21534
|
-
const heldNode = (0,
|
|
21535
|
-
const [forceRestart, setForceRestart] = (0,
|
|
21536
|
-
(0,
|
|
21624
|
+
const calculatedPositions = (0, import_react88.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
|
|
21625
|
+
const [positions, setPositions] = (0, import_react88.useState)(calculatedPositions);
|
|
21626
|
+
const [dragging, setDragging] = (0, import_react88.useState)(null);
|
|
21627
|
+
const heldNode = (0, import_react88.useRef)(null);
|
|
21628
|
+
const [forceRestart, setForceRestart] = (0, import_react88.useState)(0);
|
|
21629
|
+
(0, import_react88.useEffect)(() => {
|
|
21537
21630
|
setPositions(calculatedPositions);
|
|
21538
21631
|
setDragging(null);
|
|
21539
21632
|
heldNode.current = null;
|
|
21540
21633
|
}, [calculatedPositions, roamReset]);
|
|
21541
|
-
(0,
|
|
21634
|
+
(0, import_react88.useEffect)(() => {
|
|
21542
21635
|
if (!progressive || activeNodes.length > (forceOptions?.maxNodes ?? 80)) return;
|
|
21543
21636
|
let frame = 0, remaining = Math.max(0, forceOptions?.iterations ?? 140), previous, carry = 0;
|
|
21544
21637
|
const tick = (time) => {
|
|
@@ -21656,7 +21749,7 @@ var GraphChart = (0, import_react87.forwardRef)(function GraphChart2({ nodes, li
|
|
|
21656
21749
|
] })
|
|
21657
21750
|
] });
|
|
21658
21751
|
});
|
|
21659
|
-
var ForceGraphChart = (0,
|
|
21752
|
+
var ForceGraphChart = (0, import_react88.forwardRef)(function ForceGraphChart2(props, ref) {
|
|
21660
21753
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(GraphChart, { ...props, layout: "force", ref });
|
|
21661
21754
|
});
|
|
21662
21755
|
var ForceChart = ForceGraphChart;
|
|
@@ -21685,12 +21778,12 @@ function colorBetween(start, end, ratio) {
|
|
|
21685
21778
|
const to = read(end);
|
|
21686
21779
|
return `rgb(${from.map((value, index) => Math.round(value + ((to[index] ?? value) - value) * Math.max(0, Math.min(1, ratio)))).join(" ")})`;
|
|
21687
21780
|
}
|
|
21688
|
-
var MapChart = (0,
|
|
21689
|
-
const [internalSelected, setInternalSelected] = (0,
|
|
21781
|
+
var MapChart = (0, import_react88.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) {
|
|
21782
|
+
const [internalSelected, setInternalSelected] = (0, import_react88.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
|
|
21690
21783
|
const selectedNames = selected ?? internalSelected;
|
|
21691
|
-
const [hoveredRegion, setHoveredRegion] = (0,
|
|
21692
|
-
const [hoveredMarkPoint, setHoveredMarkPoint] = (0,
|
|
21693
|
-
const [internalHoveredValueRange, setHoveredValueRange] = (0,
|
|
21784
|
+
const [hoveredRegion, setHoveredRegion] = (0, import_react88.useState)();
|
|
21785
|
+
const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react88.useState)();
|
|
21786
|
+
const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react88.useState)();
|
|
21694
21787
|
const hoveredValueRange = emphasisValueRange ?? internalHoveredValueRange;
|
|
21695
21788
|
const roamControl = useMapRoam(roam, scaleLimit, wheelZoomFactors);
|
|
21696
21789
|
const { view } = roamControl;
|
|
@@ -21705,8 +21798,8 @@ var MapChart = (0, import_react87.forwardRef)(function MapChart2({ overlayProjec
|
|
|
21705
21798
|
const values = data.map((item) => item.value);
|
|
21706
21799
|
const minimum = valueDomain?.[0] ?? (values.length ? Math.min(...values) : 0);
|
|
21707
21800
|
const maximum = valueDomain?.[1] ?? (values.length ? Math.max(...values) : 1);
|
|
21708
|
-
const [internalVisualRange, setInternalVisualRange] = (0,
|
|
21709
|
-
(0,
|
|
21801
|
+
const [internalVisualRange, setInternalVisualRange] = (0, import_react88.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
|
|
21802
|
+
(0, import_react88.useEffect)(() => {
|
|
21710
21803
|
if (!visualRange && !defaultVisualRange) setInternalVisualRange([minimum, maximum]);
|
|
21711
21804
|
}, [defaultVisualRange, maximum, minimum, visualRange]);
|
|
21712
21805
|
const currentVisualRange = visualRange ?? internalVisualRange;
|
|
@@ -21882,7 +21975,7 @@ var MapChart = (0, import_react87.forwardRef)(function MapChart2({ overlayProjec
|
|
|
21882
21975
|
roamController ? /* @__PURE__ */ (0, import_jsx_runtime86.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
|
|
21883
21976
|
] });
|
|
21884
21977
|
});
|
|
21885
|
-
var GaugeChart = (0,
|
|
21978
|
+
var GaugeChart = (0, import_react88.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) {
|
|
21886
21979
|
const count = Math.max(1, data.length);
|
|
21887
21980
|
const legacy = appearance === "macarons";
|
|
21888
21981
|
return /* @__PURE__ */ (0, import_jsx_runtime86.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) => {
|
|
@@ -21965,12 +22058,12 @@ var GaugeChart = (0, import_react87.forwardRef)(function GaugeChart2({ tooltipFo
|
|
|
21965
22058
|
] }, `${item.name}-${index}`);
|
|
21966
22059
|
}) });
|
|
21967
22060
|
});
|
|
21968
|
-
var FunnelChart = (0,
|
|
22061
|
+
var FunnelChart = (0, import_react88.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) {
|
|
21969
22062
|
const legacy = appearance === "macarons";
|
|
21970
|
-
const [activeFunnel, setActiveFunnel] = (0,
|
|
21971
|
-
const initialFunnels = (0,
|
|
21972
|
-
const [sourceFunnels, setSourceFunnels] = (0,
|
|
21973
|
-
(0,
|
|
22063
|
+
const [activeFunnel, setActiveFunnel] = (0, import_react88.useState)(null);
|
|
22064
|
+
const initialFunnels = (0, import_react88.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
|
|
22065
|
+
const [sourceFunnels, setSourceFunnels] = (0, import_react88.useState)(initialFunnels);
|
|
22066
|
+
(0, import_react88.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
|
|
21974
22067
|
const allData = sourceFunnels.flatMap((funnel) => funnel.data);
|
|
21975
22068
|
const legendData = [...new Map(allData.map((item) => [item.name, item])).values()];
|
|
21976
22069
|
const legend = useLegendSelection(legendData.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
@@ -22061,7 +22154,7 @@ var FunnelChart = (0, import_react87.forwardRef)(function FunnelChart2({ data =
|
|
|
22061
22154
|
})
|
|
22062
22155
|
] });
|
|
22063
22156
|
});
|
|
22064
|
-
var HeatmapChart = (0,
|
|
22157
|
+
var HeatmapChart = (0, import_react88.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) {
|
|
22065
22158
|
const pointMode = points.length > 0;
|
|
22066
22159
|
const values = pointMode ? points.map((point) => point.value) : data.flatMap((row) => [...row]);
|
|
22067
22160
|
const minimum = values.length ? Math.min(...values) : 0;
|
|
@@ -22070,7 +22163,7 @@ var HeatmapChart = (0, import_react87.forwardRef)(function HeatmapChart2({ raste
|
|
|
22070
22163
|
const cellHeight = PLOT.height / Math.max(1, yLabels.length);
|
|
22071
22164
|
const pointXDomain = niceChartDomain(points.map((point) => point.x), false);
|
|
22072
22165
|
const pointYDomain = niceChartDomain(points.map((point) => point.y), false);
|
|
22073
|
-
const filterId = `sia-heat-${(0,
|
|
22166
|
+
const filterId = `sia-heat-${(0, import_react88.useId)().replaceAll(":", "")}`;
|
|
22074
22167
|
if (raster) return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(SiaChart, { ...props, ref, empty: !points.length, ariaLabel: props.ariaLabel ?? "\u50CF\u7D20\u70ED\u529B\u56FE", children: [
|
|
22075
22168
|
raster.backgroundImage ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("image", { href: raster.backgroundImage, x: 0, y: 0, width: raster.width, height: raster.height, preserveAspectRatio: "none", pointerEvents: "none" }) : null,
|
|
22076
22169
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(HeatmapRaster, { width: raster.width, height: raster.height, points, options: raster })
|
|
@@ -22106,7 +22199,7 @@ var HeatmapChart = (0, import_react87.forwardRef)(function HeatmapChart2({ raste
|
|
|
22106
22199
|
] })
|
|
22107
22200
|
] });
|
|
22108
22201
|
});
|
|
22109
|
-
var ThemeRiverChart = (0,
|
|
22202
|
+
var ThemeRiverChart = (0, import_react88.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
|
|
22110
22203
|
const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
22111
22204
|
const activeSeries = series.filter((item) => legend.isSelected(item.name));
|
|
22112
22205
|
const totals = categories.map((_, index) => activeSeries.reduce((sum, item) => sum + Math.max(0, item.data[index] ?? 0), 0));
|
|
@@ -22144,8 +22237,8 @@ function eventTime(value) {
|
|
|
22144
22237
|
if (typeof value === "number") return value;
|
|
22145
22238
|
return Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(value) ? value.replace(/-/g, "/") : value);
|
|
22146
22239
|
}
|
|
22147
|
-
var EventRiverChart = (0,
|
|
22148
|
-
const [restoreVersion, setRestoreVersion] = (0,
|
|
22240
|
+
var EventRiverChart = (0, import_react88.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) {
|
|
22241
|
+
const [restoreVersion, setRestoreVersion] = (0, import_react88.useState)(0);
|
|
22149
22242
|
const area = plot;
|
|
22150
22243
|
palette = palette ?? (appearance === "macarons" ? ["#2ec7c9", "#b6a2de"] : void 0);
|
|
22151
22244
|
const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
@@ -22218,9 +22311,9 @@ function vennDistance(radiusA, radiusB, overlap) {
|
|
|
22218
22311
|
}
|
|
22219
22312
|
return (low + high) / 2;
|
|
22220
22313
|
}
|
|
22221
|
-
var VennChart = (0,
|
|
22222
|
-
const [sets, setSets] = (0,
|
|
22223
|
-
(0,
|
|
22314
|
+
var VennChart = (0, import_react88.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
|
|
22315
|
+
const [sets, setSets] = (0, import_react88.useState)(initialSets), [intersection, setIntersection] = (0, import_react88.useState)(initialIntersection), [active, setActive] = (0, import_react88.useState)();
|
|
22316
|
+
(0, import_react88.useEffect)(() => {
|
|
22224
22317
|
setSets(initialSets);
|
|
22225
22318
|
setIntersection(initialIntersection);
|
|
22226
22319
|
}, [initialSets, initialIntersection]);
|
|
@@ -22283,17 +22376,17 @@ function layoutTreemap(nodes, x, y, width, height, gap, maxDepth, depth = 0, see
|
|
|
22283
22376
|
});
|
|
22284
22377
|
return result;
|
|
22285
22378
|
}
|
|
22286
|
-
var TreemapChart = (0,
|
|
22287
|
-
const [path, setPath] = (0,
|
|
22288
|
-
const [sourceData, setSourceData] = (0,
|
|
22289
|
-
const [active, setActive] = (0,
|
|
22290
|
-
(0,
|
|
22379
|
+
var TreemapChart = (0, import_react88.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) {
|
|
22380
|
+
const [path, setPath] = (0, import_react88.useState)([]);
|
|
22381
|
+
const [sourceData, setSourceData] = (0, import_react88.useState)(data);
|
|
22382
|
+
const [active, setActive] = (0, import_react88.useState)();
|
|
22383
|
+
(0, import_react88.useEffect)(() => {
|
|
22291
22384
|
setSourceData(data);
|
|
22292
22385
|
setPath([]);
|
|
22293
22386
|
}, [data]);
|
|
22294
22387
|
const currentData = path.reduce((nodes, name) => nodes.find((node) => node.name === name)?.children ?? nodes, sourceData);
|
|
22295
22388
|
const top = drilldown && showBreadcrumb ? 52 : 28;
|
|
22296
|
-
const rectangles = (0,
|
|
22389
|
+
const rectangles = (0, import_react88.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
|
|
22297
22390
|
const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: currentData.map((node) => ({ name: node.name, data: [treemapValue(node)] })), onApply: (values) => {
|
|
22298
22391
|
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);
|
|
22299
22392
|
setSourceData(update(sourceData, 0));
|
|
@@ -22361,15 +22454,15 @@ function flattenTree2(root, collapsed) {
|
|
|
22361
22454
|
visit(root, 0);
|
|
22362
22455
|
return { nodes, leafCount: Math.max(1, leafOrder), maxDepth: Math.max(0, ...nodes.map((item) => item.depth)) };
|
|
22363
22456
|
}
|
|
22364
|
-
var TreeChart = (0,
|
|
22365
|
-
const [sourceData, setSourceData] = (0,
|
|
22366
|
-
const [roamReset, setRoamReset] = (0,
|
|
22367
|
-
const [active, setActive] = (0,
|
|
22368
|
-
(0,
|
|
22457
|
+
var TreeChart = (0, import_react88.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) {
|
|
22458
|
+
const [sourceData, setSourceData] = (0, import_react88.useState)(data);
|
|
22459
|
+
const [roamReset, setRoamReset] = (0, import_react88.useState)(0);
|
|
22460
|
+
const [active, setActive] = (0, import_react88.useState)();
|
|
22461
|
+
(0, import_react88.useEffect)(() => {
|
|
22369
22462
|
setSourceData(data);
|
|
22370
22463
|
setActive(void 0);
|
|
22371
22464
|
}, [data]);
|
|
22372
|
-
const [collapsed, setCollapsed] = (0,
|
|
22465
|
+
const [collapsed, setCollapsed] = (0, import_react88.useState)(() => {
|
|
22373
22466
|
const result = /* @__PURE__ */ new Set();
|
|
22374
22467
|
const visit = (node) => {
|
|
22375
22468
|
if (node.collapsed) result.add(node.name);
|
|
@@ -22378,8 +22471,8 @@ var TreeChart = (0, import_react87.forwardRef)(function TreeChart2({ data, itemS
|
|
|
22378
22471
|
visit(data);
|
|
22379
22472
|
return result;
|
|
22380
22473
|
});
|
|
22381
|
-
const layout = (0,
|
|
22382
|
-
const fixedLayout = (0,
|
|
22474
|
+
const layout = (0, import_react88.useMemo)(() => flattenTree2(sourceData, collapsed), [collapsed, sourceData]);
|
|
22475
|
+
const fixedLayout = (0, import_react88.useMemo)(() => {
|
|
22383
22476
|
const visible = (node) => ({ ...node, children: collapsed.has(node.name) ? [] : node.children?.map(visible) });
|
|
22384
22477
|
return rootPosition ? layoutTreeNodes(visible(sourceData), { nodeSize, nodePadding, layerPadding, rootPosition, orientation }) : void 0;
|
|
22385
22478
|
}, [sourceData, collapsed, rootPosition, nodeSize, nodePadding, layerPadding, orientation]);
|
|
@@ -22449,15 +22542,15 @@ var TreeChart = (0, import_react87.forwardRef)(function TreeChart2({ data, itemS
|
|
|
22449
22542
|
})
|
|
22450
22543
|
] }) });
|
|
22451
22544
|
});
|
|
22452
|
-
var WordCloudChart = (0,
|
|
22453
|
-
const placements = (0,
|
|
22545
|
+
var WordCloudChart = (0, import_react88.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) {
|
|
22546
|
+
const placements = (0, import_react88.useMemo)(() => {
|
|
22454
22547
|
const context = typeof document === "undefined" ? null : document.createElement("canvas").getContext("2d");
|
|
22455
22548
|
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) => {
|
|
22456
22549
|
context.font = `${word.fontWeight ?? fontWeight} ${size}px ${word.fontFamily ?? fontFamily ?? "Arial"}`;
|
|
22457
22550
|
return context.measureText(word.name).width;
|
|
22458
22551
|
} : void 0 });
|
|
22459
22552
|
}, [data, bounds, autoFit, areaSizing, maxFontSize, minFontSize, padding, rotations, shape, spiralStep, fontFamily, fontWeight]);
|
|
22460
|
-
(0,
|
|
22553
|
+
(0, import_react88.useEffect)(() => {
|
|
22461
22554
|
const present = new Set(placements.map((p) => p.index));
|
|
22462
22555
|
onLayout?.({ placed: placements.length, unplaced: data.filter((_, i) => !present.has(i)).map((item) => item.name) });
|
|
22463
22556
|
}, [placements, data, onLayout]);
|
|
@@ -22466,30 +22559,30 @@ var WordCloudChart = (0, import_react87.forwardRef)(function WordCloudChart2({ d
|
|
|
22466
22559
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ChartMark, { label: `${placement.item.name}\uFF0C${placement.item.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime86.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_runtime86.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}`);
|
|
22467
22560
|
}) });
|
|
22468
22561
|
});
|
|
22469
|
-
var MixedChart = (0,
|
|
22470
|
-
const plotClipId = `sia-mixed-plot-${(0,
|
|
22471
|
-
const [editableSeries, setEditableSeries] = (0,
|
|
22472
|
-
const [geometry, setGeometry] = (0,
|
|
22473
|
-
const [pointerIndex, setPointerIndex] = (0,
|
|
22474
|
-
const [pointerAxisIndex, setPointerAxisIndex] = (0,
|
|
22475
|
-
const [motionRevision, setMotionRevision] = (0,
|
|
22476
|
-
const [stackMode, setStackMode] = (0,
|
|
22477
|
-
const lastPublished = (0,
|
|
22562
|
+
var MixedChart = (0, import_react88.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) {
|
|
22563
|
+
const plotClipId = `sia-mixed-plot-${(0, import_react88.useId)().replaceAll(":", "")}`;
|
|
22564
|
+
const [editableSeries, setEditableSeries] = (0, import_react88.useState)(sourceSeries);
|
|
22565
|
+
const [geometry, setGeometry] = (0, import_react88.useState)();
|
|
22566
|
+
const [pointerIndex, setPointerIndex] = (0, import_react88.useState)(null);
|
|
22567
|
+
const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react88.useState)(0);
|
|
22568
|
+
const [motionRevision, setMotionRevision] = (0, import_react88.useState)(0);
|
|
22569
|
+
const [stackMode, setStackMode] = (0, import_react88.useState)();
|
|
22570
|
+
const lastPublished = (0, import_react88.useRef)(null);
|
|
22478
22571
|
const publishData = (next) => {
|
|
22479
22572
|
lastPublished.current = next;
|
|
22480
22573
|
onDataChange?.(next);
|
|
22481
22574
|
};
|
|
22482
|
-
const [islands, setIslands] = (0,
|
|
22483
|
-
const drag = (0,
|
|
22484
|
-
const [dragOffset, setDragOffset] = (0,
|
|
22485
|
-
(0,
|
|
22575
|
+
const [islands, setIslands] = (0, import_react88.useState)([]);
|
|
22576
|
+
const drag = (0, import_react88.useRef)(null);
|
|
22577
|
+
const [dragOffset, setDragOffset] = (0, import_react88.useState)();
|
|
22578
|
+
(0, import_react88.useEffect)(() => {
|
|
22486
22579
|
if (sourceSeries === lastPublished.current) return;
|
|
22487
22580
|
setEditableSeries(sourceSeries);
|
|
22488
22581
|
setIslands([]);
|
|
22489
22582
|
drag.current = null;
|
|
22490
22583
|
setDragOffset(void 0);
|
|
22491
22584
|
}, [sourceSeries]);
|
|
22492
|
-
const series = (0,
|
|
22585
|
+
const series = (0, import_react88.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
|
|
22493
22586
|
const stacked = stackMode ?? sourceStacked;
|
|
22494
22587
|
const PLOT2 = plotBounds ?? { x: 62, y: 48, width: 628, height: 250 }, PLOT_BOTTOM2 = PLOT2.y + PLOT2.height;
|
|
22495
22588
|
const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
|
|
@@ -22653,7 +22746,7 @@ var MixedChart = (0, import_react87.forwardRef)(function MixedChart2({ axisPoint
|
|
|
22653
22746
|
})
|
|
22654
22747
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CartesianAxes, { categories, domain, band: categoryGap }),
|
|
22655
22748
|
activeIndex != null && activeIndex >= 0 && activeIndex < categories.length ? /* @__PURE__ */ (0, import_jsx_runtime86.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,
|
|
22656
|
-
tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0,
|
|
22749
|
+
tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react89.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_runtime86.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,
|
|
22657
22750
|
calculable ? activeSeries.flatMap((item) => item.data.map((value, index) => value === null ? /* @__PURE__ */ (0, import_jsx_runtime86.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_runtime86.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,
|
|
22658
22751
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("clipPath", { id: plotClipId, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("rect", { x: PLOT2.x, y: PLOT2.y, width: PLOT2.width, height: PLOT2.height }) }) }),
|
|
22659
22752
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("g", { "data-mixed-plot": "", clipPath: clipPlot ? `url(#${plotClipId})` : void 0, children: renderSeries.map((item) => {
|
|
@@ -22692,7 +22785,7 @@ var MixedChart = (0, import_react87.forwardRef)(function MixedChart2({ axisPoint
|
|
|
22692
22785
|
const zero = linearScale(placement.start, [valueDomain[0], valueDomain[1]], [PLOT_BOTTOM2, PLOT2.y]);
|
|
22693
22786
|
const rectY = barSpacing?.pixelAlign ? Math.floor(Math.min(y, zero)) : Math.min(y, zero);
|
|
22694
22787
|
const rectHeight = barSpacing?.pixelAlign ? Math.ceil(Math.abs(zero - y)) : Math.abs(zero - y);
|
|
22695
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.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,
|
|
22788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.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_react89.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_runtime86.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
|
|
22696
22789
|
if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
|
|
22697
22790
|
} }, /* @__PURE__ */ (0, import_jsx_runtime86.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}`);
|
|
22698
22791
|
})
|
|
@@ -22721,7 +22814,7 @@ var MixedChart = (0, import_react87.forwardRef)(function MixedChart2({ axisPoint
|
|
|
22721
22814
|
if (!placements[index]) return null;
|
|
22722
22815
|
const name = categoryName(index, item.categoryAxisIndex);
|
|
22723
22816
|
const value = item.data[index] ?? 0;
|
|
22724
|
-
return /* @__PURE__ */ (0,
|
|
22817
|
+
return /* @__PURE__ */ (0, import_react89.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_runtime86.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
|
|
22725
22818
|
if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
|
|
22726
22819
|
} }, /* @__PURE__ */ (0, import_jsx_runtime86.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 }));
|
|
22727
22820
|
})
|
|
@@ -22762,9 +22855,9 @@ var KLineChart = CandlestickChart;
|
|
|
22762
22855
|
|
|
22763
22856
|
// src/components/LineShareChart.tsx
|
|
22764
22857
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
22765
|
-
var LineShareChart = (0,
|
|
22766
|
-
const [selected, setSelected] = (0,
|
|
22767
|
-
const [maskHovered, setMaskHovered] = (0,
|
|
22858
|
+
var LineShareChart = (0, import_react90.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
|
|
22859
|
+
const [selected, setSelected] = (0, import_react90.useState)(null);
|
|
22860
|
+
const [maskHovered, setMaskHovered] = (0, import_react90.useState)(false);
|
|
22768
22861
|
const width = props.viewBoxSize?.[0] ?? 900, height = props.viewBoxSize?.[1] ?? 450;
|
|
22769
22862
|
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;
|
|
22770
22863
|
const maximum = data.reduce((best, item2, i) => item2.value >= data[best].value ? i : best, 0);
|
|
@@ -22842,16 +22935,16 @@ function paddedValueExtent(values, padding = 0.05) {
|
|
|
22842
22935
|
}
|
|
22843
22936
|
|
|
22844
22937
|
// src/components/XYChart.tsx
|
|
22845
|
-
var
|
|
22938
|
+
var import_react91 = require("react");
|
|
22846
22939
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
22847
|
-
var XYChart = (0,
|
|
22848
|
-
const [series, setSeries] = (0,
|
|
22849
|
-
const [hidden, setHidden] = (0,
|
|
22850
|
-
const [crosshair, setCrosshair] = (0,
|
|
22851
|
-
const [drag, setDrag] = (0,
|
|
22852
|
-
const [geometry, setGeometry] = (0,
|
|
22853
|
-
const [zoom, setZoom] = (0,
|
|
22854
|
-
(0,
|
|
22940
|
+
var XYChart = (0, import_react91.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
|
|
22941
|
+
const [series, setSeries] = (0, import_react91.useState)(source);
|
|
22942
|
+
const [hidden, setHidden] = (0, import_react91.useState)([]);
|
|
22943
|
+
const [crosshair, setCrosshair] = (0, import_react91.useState)();
|
|
22944
|
+
const [drag, setDrag] = (0, import_react91.useState)();
|
|
22945
|
+
const [geometry, setGeometry] = (0, import_react91.useState)();
|
|
22946
|
+
const [zoom, setZoom] = (0, import_react91.useState)(defaultZoom);
|
|
22947
|
+
(0, import_react91.useEffect)(() => setSeries(source), [source]);
|
|
22855
22948
|
const window2 = dataZoom || xAxisType === "time" ? scatterValueWindow(series.flatMap((item) => item.data.map((point) => point[0])), dataZoom ? zoom : [0, 100]) : void 0;
|
|
22856
22949
|
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 }));
|
|
22857
22950
|
const width = props.viewBoxSize?.[0] ?? 663, height = props.viewBoxSize?.[1] ?? 379;
|
|
@@ -22980,7 +23073,7 @@ var XYChart = (0, import_react90.forwardRef)(function XYChart2({ series: source,
|
|
|
22980
23073
|
});
|
|
22981
23074
|
|
|
22982
23075
|
// src/components/ChartMapOverlay.tsx
|
|
22983
|
-
var
|
|
23076
|
+
var import_react92 = require("react");
|
|
22984
23077
|
|
|
22985
23078
|
// src/components/mapOverlayHost.ts
|
|
22986
23079
|
function observeMapOverlayHost(host, onChange) {
|
|
@@ -23019,11 +23112,11 @@ function observeMapOverlayHost(host, onChange) {
|
|
|
23019
23112
|
// src/components/ChartMapOverlay.tsx
|
|
23020
23113
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
23021
23114
|
function ChartMapOverlay({ createHost, children, className, style, ariaLabel = "\u5730\u56FE\u53E0\u52A0\u56FE\u8868", onError }) {
|
|
23022
|
-
const container = (0,
|
|
23023
|
-
const errorHandler = (0,
|
|
23115
|
+
const container = (0, import_react92.useRef)(null);
|
|
23116
|
+
const errorHandler = (0, import_react92.useRef)(onError);
|
|
23024
23117
|
errorHandler.current = onError;
|
|
23025
|
-
const [snapshot, setSnapshot] = (0,
|
|
23026
|
-
(0,
|
|
23118
|
+
const [snapshot, setSnapshot] = (0, import_react92.useState)();
|
|
23119
|
+
(0, import_react92.useEffect)(() => {
|
|
23027
23120
|
setSnapshot(void 0);
|
|
23028
23121
|
if (!container.current) return;
|
|
23029
23122
|
try {
|
|
@@ -23100,9 +23193,9 @@ function createBaiduMapHost(element, sdk, options) {
|
|
|
23100
23193
|
}
|
|
23101
23194
|
|
|
23102
23195
|
// src/components/InputSelect.tsx
|
|
23103
|
-
var
|
|
23196
|
+
var import_react93 = require("react");
|
|
23104
23197
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
23105
|
-
var InputSelect = (0,
|
|
23198
|
+
var InputSelect = (0, import_react93.forwardRef)(function InputSelect2({
|
|
23106
23199
|
options,
|
|
23107
23200
|
value,
|
|
23108
23201
|
defaultValue,
|
|
@@ -23128,22 +23221,22 @@ var InputSelect = (0, import_react92.forwardRef)(function InputSelect2({
|
|
|
23128
23221
|
...inputProps
|
|
23129
23222
|
}, forwardedRef) {
|
|
23130
23223
|
const size = useControlSize(sizeProp);
|
|
23131
|
-
const [internal, setInternal] = (0,
|
|
23224
|
+
const [internal, setInternal] = (0, import_react93.useState)(defaultValue);
|
|
23132
23225
|
const current = value !== void 0 ? value : internal;
|
|
23133
23226
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|
|
23134
23227
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
23135
|
-
const [draft, setDraft] = (0,
|
|
23136
|
-
(0,
|
|
23228
|
+
const [draft, setDraft] = (0, import_react93.useState)(text);
|
|
23229
|
+
(0, import_react93.useEffect)(() => {
|
|
23137
23230
|
setDraft(text);
|
|
23138
23231
|
}, [text, current]);
|
|
23139
|
-
const [open, setOpen] = (0,
|
|
23140
|
-
const [search, setSearch] = (0,
|
|
23141
|
-
const [modalOpen, setModalOpen] = (0,
|
|
23142
|
-
const [modalValues, setModalValues] = (0,
|
|
23143
|
-
const [selectedOnly, setSelectedOnly] = (0,
|
|
23144
|
-
const rootRef = (0,
|
|
23145
|
-
const popupRef = (0,
|
|
23146
|
-
const inputRef = (0,
|
|
23232
|
+
const [open, setOpen] = (0, import_react93.useState)(false);
|
|
23233
|
+
const [search, setSearch] = (0, import_react93.useState)("");
|
|
23234
|
+
const [modalOpen, setModalOpen] = (0, import_react93.useState)(false);
|
|
23235
|
+
const [modalValues, setModalValues] = (0, import_react93.useState)([]);
|
|
23236
|
+
const [selectedOnly, setSelectedOnly] = (0, import_react93.useState)(false);
|
|
23237
|
+
const rootRef = (0, import_react93.useRef)(null);
|
|
23238
|
+
const popupRef = (0, import_react93.useRef)(null);
|
|
23239
|
+
const inputRef = (0, import_react93.useRef)(null);
|
|
23147
23240
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
23148
23241
|
function changeOpen(next) {
|
|
23149
23242
|
if (next && (disabled || loading)) return;
|
|
@@ -23163,7 +23256,7 @@ var InputSelect = (0, import_react92.forwardRef)(function InputSelect2({
|
|
|
23163
23256
|
inputRef.current?.focus();
|
|
23164
23257
|
}
|
|
23165
23258
|
}
|
|
23166
|
-
(0,
|
|
23259
|
+
(0, import_react93.useEffect)(() => {
|
|
23167
23260
|
if (!open) return;
|
|
23168
23261
|
const outside = (event) => {
|
|
23169
23262
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -23171,7 +23264,7 @@ var InputSelect = (0, import_react92.forwardRef)(function InputSelect2({
|
|
|
23171
23264
|
document.addEventListener("pointerdown", outside);
|
|
23172
23265
|
return () => document.removeEventListener("pointerdown", outside);
|
|
23173
23266
|
}, [open, onOpenChange]);
|
|
23174
|
-
(0,
|
|
23267
|
+
(0, import_react93.useEffect)(() => {
|
|
23175
23268
|
if (disabled || loading) {
|
|
23176
23269
|
changeOpen(false);
|
|
23177
23270
|
setModalOpen(false);
|
|
@@ -23304,7 +23397,7 @@ var InputSelect = (0, import_react92.forwardRef)(function InputSelect2({
|
|
|
23304
23397
|
});
|
|
23305
23398
|
|
|
23306
23399
|
// src/components/QueryForm.tsx
|
|
23307
|
-
var
|
|
23400
|
+
var import_react94 = require("react");
|
|
23308
23401
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
23309
23402
|
function QueryForm({
|
|
23310
23403
|
fields,
|
|
@@ -23338,31 +23431,31 @@ function QueryForm({
|
|
|
23338
23431
|
...formProps
|
|
23339
23432
|
}) {
|
|
23340
23433
|
const [form] = useForm(providedForm);
|
|
23341
|
-
const [internalCollapsed, setInternalCollapsed] = (0,
|
|
23342
|
-
const [needsCollapse, setNeedsCollapse] = (0,
|
|
23434
|
+
const [internalCollapsed, setInternalCollapsed] = (0, import_react94.useState)(defaultCollapsed);
|
|
23435
|
+
const [needsCollapse, setNeedsCollapse] = (0, import_react94.useState)(false);
|
|
23343
23436
|
const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed);
|
|
23344
|
-
const [searching, setSearching] = (0,
|
|
23345
|
-
const [saving, setSaving] = (0,
|
|
23346
|
-
const [removing, setRemoving] = (0,
|
|
23347
|
-
const [saveOpen, setSaveOpen] = (0,
|
|
23348
|
-
const [saveName, setSaveName] = (0,
|
|
23349
|
-
const [saveError, setSaveError] = (0,
|
|
23350
|
-
const [error, setError] = (0,
|
|
23351
|
-
const [activeShortcut, setActiveShortcut] = (0,
|
|
23352
|
-
const source = (0,
|
|
23353
|
-
const searchLock = (0,
|
|
23354
|
-
const saveLock = (0,
|
|
23355
|
-
const removeLock = (0,
|
|
23356
|
-
const snapshot = (0,
|
|
23437
|
+
const [searching, setSearching] = (0, import_react94.useState)(false);
|
|
23438
|
+
const [saving, setSaving] = (0, import_react94.useState)(false);
|
|
23439
|
+
const [removing, setRemoving] = (0, import_react94.useState)(false);
|
|
23440
|
+
const [saveOpen, setSaveOpen] = (0, import_react94.useState)(false);
|
|
23441
|
+
const [saveName, setSaveName] = (0, import_react94.useState)("");
|
|
23442
|
+
const [saveError, setSaveError] = (0, import_react94.useState)("");
|
|
23443
|
+
const [error, setError] = (0, import_react94.useState)("");
|
|
23444
|
+
const [activeShortcut, setActiveShortcut] = (0, import_react94.useState)("");
|
|
23445
|
+
const source = (0, import_react94.useRef)({ source: "submit" });
|
|
23446
|
+
const searchLock = (0, import_react94.useRef)(false);
|
|
23447
|
+
const saveLock = (0, import_react94.useRef)(false);
|
|
23448
|
+
const removeLock = (0, import_react94.useRef)(false);
|
|
23449
|
+
const snapshot = (0, import_react94.useRef)();
|
|
23357
23450
|
const busy = disabled || loading || searching;
|
|
23358
23451
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
23359
|
-
const entries = fields ? fields.map(({ key, width, ...item }) => ({ key, width, content: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Form.Item, { noStyle: true, ...item }) })) :
|
|
23452
|
+
const entries = fields ? fields.map(({ key, width, ...item }) => ({ key, width, content: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Form.Item, { noStyle: true, ...item }) })) : import_react94.Children.toArray(children).map((content, index) => ({ key: String(index), width: void 0, content }));
|
|
23360
23453
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
23361
|
-
const rowRef = (0,
|
|
23362
|
-
const actionsRef = (0,
|
|
23363
|
-
const toggleRef = (0,
|
|
23364
|
-
const [fittingCount, setFittingCount] = (0,
|
|
23365
|
-
(0,
|
|
23454
|
+
const rowRef = (0, import_react94.useRef)(null);
|
|
23455
|
+
const actionsRef = (0, import_react94.useRef)(null);
|
|
23456
|
+
const toggleRef = (0, import_react94.useRef)(null);
|
|
23457
|
+
const [fittingCount, setFittingCount] = (0, import_react94.useState)(limit);
|
|
23458
|
+
(0, import_react94.useLayoutEffect)(() => {
|
|
23366
23459
|
const row = rowRef.current;
|
|
23367
23460
|
const actions = actionsRef.current;
|
|
23368
23461
|
if (!row || !actions) return;
|