@sia.soul/sia-react-ui 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/{Select-CJJ5LQap.d.ts → Select-GiTHMScg.d.cts} +4 -5
  2. package/dist/{Select-CJJ5LQap.d.cts → Select-rtDktLYY.d.ts} +4 -5
  3. package/dist/chart.cjs +731 -707
  4. package/dist/chart.css +1 -1
  5. package/dist/chart.js +3 -2
  6. package/dist/{chunk-6VXOLMKZ.js → chunk-5ZTWY3PG.js} +18 -1
  7. package/dist/{chunk-2RRTDU3N.js → chunk-EJ23MVR6.js} +3 -18
  8. package/dist/chunk-EJDPRAU2.js +36 -0
  9. package/dist/{chunk-IMZT6VCU.js → chunk-IHTODT53.js} +8 -5
  10. package/dist/{chunk-R4OWKIXJ.js → chunk-MJUTLEEE.js} +20 -8
  11. package/dist/{chunk-OQLDEVCF.js → chunk-PX6BOFTW.js} +10 -3
  12. package/dist/{chunk-OAC7BSUR.js → chunk-R7BVDN3Q.js} +91 -43
  13. package/dist/{chunk-Q4XNFMUH.js → chunk-S2JAJCLN.js} +6 -4
  14. package/dist/{chunk-NZAT2RUM.js → chunk-WHARTF2I.js} +10 -1
  15. package/dist/{chunk-I342FGQY.js → chunk-Z3T6RDQP.js} +1 -1
  16. package/dist/{core-DFYheaoJ.d.ts → core-CBtbeAms.d.cts} +2 -1
  17. package/dist/{core-De2pRX5w.d.cts → core-D8BSMfHD.d.ts} +2 -1
  18. package/dist/core.cjs +275 -210
  19. package/dist/core.css +294 -41
  20. package/dist/core.d.cts +3 -2
  21. package/dist/core.d.ts +3 -2
  22. package/dist/core.js +6 -5
  23. package/dist/index.cjs +2709 -2434
  24. package/dist/index.css +295 -42
  25. package/dist/index.d.cts +23 -9
  26. package/dist/index.d.ts +23 -9
  27. package/dist/index.js +414 -224
  28. package/dist/markdown-editor.cjs +52 -20
  29. package/dist/markdown-editor.d.cts +3 -1
  30. package/dist/markdown-editor.d.ts +3 -1
  31. package/dist/markdown-editor.js +2 -1
  32. package/dist/rich-text-editor.cjs +884 -864
  33. package/dist/rich-text-editor.d.cts +3 -1
  34. package/dist/rich-text-editor.d.ts +3 -1
  35. package/dist/rich-text-editor.js +4 -3
  36. package/dist/{select-date-range-DOyG1DGp.d.ts → select-date-range-CQ1vmze_.d.ts} +7 -4
  37. package/dist/{select-date-range-UyYrHex6.d.cts → select-date-range-DRmGaEzP.d.cts} +7 -4
  38. package/dist/select-date-range.cjs +972 -903
  39. package/dist/select-date-range.d.cts +3 -2
  40. package/dist/select-date-range.d.ts +3 -2
  41. package/dist/select-date-range.js +4 -3
  42. package/dist/shared-DAYZvZVu.d.cts +5 -0
  43. package/dist/shared-DAYZvZVu.d.ts +5 -0
  44. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -56,7 +56,7 @@ import {
56
56
  smoothSvgPath,
57
57
  svgArcPath,
58
58
  transferCompositeValue
59
- } from "./chunk-I342FGQY.js";
59
+ } from "./chunk-Z3T6RDQP.js";
60
60
  import {
61
61
  Badge,
62
62
  Breadcrumb,
@@ -87,24 +87,24 @@ import {
87
87
  message,
88
88
  notification,
89
89
  useOverlayLifecycle
90
- } from "./chunk-Q4XNFMUH.js";
90
+ } from "./chunk-S2JAJCLN.js";
91
91
  import {
92
92
  TextArea
93
- } from "./chunk-NZAT2RUM.js";
93
+ } from "./chunk-WHARTF2I.js";
94
94
  import {
95
95
  MarkdownEditor
96
- } from "./chunk-6VXOLMKZ.js";
96
+ } from "./chunk-5ZTWY3PG.js";
97
97
  import {
98
98
  RichTextContent,
99
99
  RichTextEditor
100
- } from "./chunk-OQLDEVCF.js";
100
+ } from "./chunk-PX6BOFTW.js";
101
101
  import {
102
102
  Dropdown,
103
103
  Input,
104
104
  Menu,
105
105
  Segmented,
106
106
  Steps
107
- } from "./chunk-IMZT6VCU.js";
107
+ } from "./chunk-IHTODT53.js";
108
108
  import {
109
109
  Button
110
110
  } from "./chunk-MBS2HXLZ.js";
@@ -112,17 +112,23 @@ import {
112
112
  DatePicker,
113
113
  SelectDateRange,
114
114
  TimePanel
115
- } from "./chunk-R4OWKIXJ.js";
115
+ } from "./chunk-MJUTLEEE.js";
116
116
  import {
117
+ OverflowTags,
117
118
  Select
118
- } from "./chunk-OAC7BSUR.js";
119
+ } from "./chunk-R7BVDN3Q.js";
119
120
  import {
120
121
  FILLED_ICON_NAMES,
121
122
  ICON_NAMES,
122
123
  Icon,
123
- PopupPortal,
124
- useControllableState
125
- } from "./chunk-2RRTDU3N.js";
124
+ PopupPortal
125
+ } from "./chunk-EJ23MVR6.js";
126
+ import {
127
+ PlaceholderModeContext,
128
+ useControllableState,
129
+ useFloatingPlaceholder,
130
+ usePlaceholderMode
131
+ } from "./chunk-EJDPRAU2.js";
126
132
 
127
133
  // src/components/Alert.tsx
128
134
  import { useState } from "react";
@@ -316,6 +322,7 @@ function Cascader({
316
322
  changeOnSelect = false,
317
323
  expandTrigger = "click",
318
324
  placeholder = "\u8BF7\u9009\u62E9",
325
+ placeholderMode,
319
326
  disabled = false,
320
327
  fieldNames,
321
328
  displayRender,
@@ -335,7 +342,7 @@ function Cascader({
335
342
  const [active, setActive] = useState3([]);
336
343
  const [search, setSearch] = useState3("");
337
344
  const [loadingKey, setLoadingKey] = useState3("");
338
- const selectedPaths = multiple ? current ?? [] : current?.length && !Array.isArray(current[0]) ? [current] : [];
345
+ const selectedPaths = multiple ? Array.isArray(current) ? current : [] : current?.length && !Array.isArray(current[0]) ? [current] : [];
339
346
  const selectedKeys = new Set(selectedPaths.map(pathKey));
340
347
  const selectedPathSignature = selectedPaths.map(pathKey).join("");
341
348
  const searchPaths = useMemo(() => search ? leafPaths(options, fields).filter((path) => path.some((option) => String(optionLabel(option, fields)).toLowerCase().includes(search.toLowerCase()))) : [], [fields, options, search]);
@@ -411,13 +418,15 @@ function Cascader({
411
418
  const children = optionChildren(option, fields);
412
419
  if (children?.length) columns.push(children);
413
420
  });
421
+ const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: selectedPaths.length > 0, active: open });
414
422
  return /* @__PURE__ */ jsxs3("div", { ref: rootRef, className: `sia-cascader${open ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...props, children: [
415
- /* @__PURE__ */ jsxs3("button", { type: "button", className: "sia-cascader__trigger", disabled, "aria-haspopup": "listbox", "aria-expanded": open, onClick: toggleOpen, children: [
423
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: `sia-cascader__trigger${floating.className}`, disabled, "aria-haspopup": "listbox", "aria-expanded": open, onClick: toggleOpen, children: [
416
424
  /* @__PURE__ */ jsx3("span", { className: "sia-cascader__value", children: display ? multiple && Array.isArray(display) ? display.map((label, index) => /* @__PURE__ */ jsx3("span", { className: "sia-cascader__tag", children: label }, pathKey(selectedPaths[index] ?? []))) : display : /* @__PURE__ */ jsx3("span", { className: "sia-cascader__placeholder", children: placeholder }) }),
417
425
  allowClear && selectedPaths.length ? /* @__PURE__ */ jsx3("span", { className: "sia-cascader__clear", role: "button", "aria-label": "\u6E05\u9664\u9009\u62E9", onClick: (event) => {
418
426
  event.stopPropagation();
419
427
  clearSelection();
420
428
  }, children: /* @__PURE__ */ jsx3(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
429
+ floating.label,
421
430
  /* @__PURE__ */ jsx3(Icon, { name: open ? "chevron-up" : "chevron-down", size: 14 })
422
431
  ] }),
423
432
  /* @__PURE__ */ jsxs3(PopupPortal, { ref: popupRef, anchorRef: rootRef, open, className: "sia-cascader__popup", children: [
@@ -1250,7 +1259,7 @@ function openDrawer(config) {
1250
1259
  let currentOpen = true;
1251
1260
  let destroyed = false;
1252
1261
  let cleanupTimer;
1253
- function cleanup() {
1262
+ function cleanup2() {
1254
1263
  if (destroyed) return;
1255
1264
  destroyed = true;
1256
1265
  if (cleanupTimer !== void 0) window.clearTimeout(cleanupTimer);
@@ -1262,7 +1271,7 @@ function openDrawer(config) {
1262
1271
  if (destroyed || !currentOpen) return;
1263
1272
  currentOpen = false;
1264
1273
  render();
1265
- cleanupTimer = window.setTimeout(cleanup, DRAWER_MOTION_DURATION + 100);
1274
+ cleanupTimer = window.setTimeout(cleanup2, DRAWER_MOTION_DURATION + 100);
1266
1275
  }
1267
1276
  function render() {
1268
1277
  root.render(/* @__PURE__ */ jsx8(
@@ -1277,7 +1286,7 @@ function openDrawer(config) {
1277
1286
  afterOpen: () => currentConfig.afterOpen?.(),
1278
1287
  afterClose: () => {
1279
1288
  currentConfig.afterClose?.();
1280
- cleanup();
1289
+ cleanup2();
1281
1290
  }
1282
1291
  }
1283
1292
  ));
@@ -1530,6 +1539,7 @@ function FormRoot({
1530
1539
  form,
1531
1540
  initialValues,
1532
1541
  layout = "horizontal",
1542
+ placeholderMode,
1533
1543
  disabled = false,
1534
1544
  requiredMark = true,
1535
1545
  className = "",
@@ -1539,11 +1549,12 @@ function FormRoot({
1539
1549
  children,
1540
1550
  ...props
1541
1551
  }) {
1552
+ const resolvedPlaceholderMode = usePlaceholderMode(placeholderMode);
1542
1553
  const [internalForm] = useForm(form);
1543
1554
  const instance = internalForm;
1544
1555
  instance.configure(initialValues, { onFinish, onFinishFailed, onValuesChange });
1545
1556
  const context = useMemo4(() => instance, [instance]);
1546
- return /* @__PURE__ */ jsx9(FormContext.Provider, { value: context, children: /* @__PURE__ */ jsx9(
1557
+ return /* @__PURE__ */ jsx9(FormContext.Provider, { value: context, children: /* @__PURE__ */ jsx9(PlaceholderModeContext.Provider, { value: resolvedPlaceholderMode, children: /* @__PURE__ */ jsx9(
1547
1558
  "form",
1548
1559
  {
1549
1560
  ...props,
@@ -1555,7 +1566,7 @@ function FormRoot({
1555
1566
  },
1556
1567
  children: /* @__PURE__ */ jsx9("fieldset", { disabled, children })
1557
1568
  }
1558
- ) });
1569
+ ) }) });
1559
1570
  }
1560
1571
  function defaultEventValue(valuePropName, args) {
1561
1572
  const first = args[0];
@@ -2229,6 +2240,7 @@ function TimePicker({
2229
2240
  onChange,
2230
2241
  onOpenChange,
2231
2242
  placeholder = "\u8BF7\u9009\u62E9\u65F6\u95F4",
2243
+ placeholderMode,
2232
2244
  min,
2233
2245
  max,
2234
2246
  step,
@@ -2283,7 +2295,8 @@ function TimePicker({
2283
2295
  changeOpen(false);
2284
2296
  inputRef.current?.focus();
2285
2297
  }
2286
- return /* @__PURE__ */ jsxs13("span", { ref: rootRef, style, className: `sia-picker sia-time-picker sia-picker--${size} sia-picker--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
2298
+ const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: Boolean(display), active: open });
2299
+ return /* @__PURE__ */ jsxs13("span", { ref: rootRef, style, className: `sia-picker sia-time-picker${floating.className} sia-picker--${size} sia-picker--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
2287
2300
  /* @__PURE__ */ jsx13(
2288
2301
  "input",
2289
2302
  {
@@ -2320,6 +2333,7 @@ function TimePicker({
2320
2333
  }
2321
2334
  }
2322
2335
  ),
2336
+ floating.label,
2323
2337
  allowClear && currentValue && !disabled && !readOnly ? /* @__PURE__ */ jsx13("button", { type: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65F6\u95F4", onMouseDown: (event) => event.preventDefault(), onClick: () => {
2324
2338
  setValue2("");
2325
2339
  changeOpen(false);
@@ -2358,7 +2372,7 @@ function TimePicker({
2358
2372
  ] });
2359
2373
  }
2360
2374
  function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F00\u59CB\u65F6\u95F4", "\u7ED3\u675F\u65F6\u95F4"], separator = "\u2192", onChange, className = "", style, ...props }) {
2361
- const [currentValue, setValue2] = useControllableState({ value, defaultValue, onChange });
2375
+ const [currentValue, setValue2] = useControllableState({ value: value === void 0 ? void 0 : Array.isArray(value) ? value : ["", ""], defaultValue, onChange });
2362
2376
  function update(index, next) {
2363
2377
  const pair = [currentValue[0], currentValue[1]];
2364
2378
  pair[index] = next;
@@ -2406,6 +2420,7 @@ function TreeSelect({
2406
2420
  allowClear = false,
2407
2421
  treeDefaultExpandAll = false,
2408
2422
  placeholder = "\u8BF7\u9009\u62E9",
2423
+ placeholderMode,
2409
2424
  searchPlaceholder = "\u641C\u7D22\u8282\u70B9",
2410
2425
  maxTagCount = 3,
2411
2426
  disabled = false,
@@ -2469,7 +2484,7 @@ function TreeSelect({
2469
2484
  collect(treeData);
2470
2485
  return new Set(values);
2471
2486
  });
2472
- const selectedValues = Array.isArray(currentValue) ? [...currentValue] : currentValue === void 0 ? [] : [currentValue];
2487
+ const selectedValues = Array.isArray(currentValue) ? [...currentValue] : currentValue === void 0 || currentValue === "" && !nodeIndex.has("") ? [] : [currentValue];
2473
2488
  const expandedSet = treeExpandedKeys ? new Set(treeExpandedKeys) : expanded;
2474
2489
  const selectedNodes = resolveNodes(selectedValues);
2475
2490
  const visibleNodes = flattenTree(treeData, expandedSet, search, filterTreeNode);
@@ -2584,6 +2599,7 @@ function TreeSelect({
2584
2599
  changeOpen(false);
2585
2600
  }
2586
2601
  }
2602
+ const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: selectedNodes.length > 0, active: open });
2587
2603
  return /* @__PURE__ */ jsxs14(
2588
2604
  "div",
2589
2605
  {
@@ -2603,7 +2619,7 @@ function TreeSelect({
2603
2619
  "button",
2604
2620
  {
2605
2621
  type: "button",
2606
- className: "sia-tree-select__trigger",
2622
+ className: `sia-tree-select__trigger${floating.className}`,
2607
2623
  disabled,
2608
2624
  "aria-haspopup": "tree",
2609
2625
  "aria-expanded": open,
@@ -2617,13 +2633,8 @@ function TreeSelect({
2617
2633
  if (event.key === "Escape") changeOpen(false);
2618
2634
  },
2619
2635
  children: [
2620
- /* @__PURE__ */ jsx14("span", { className: "sia-tree-select__value", children: selectedNodes.length ? displayRender ? displayRender(selectedNodes) : multi ? /* @__PURE__ */ jsxs14(Fragment4, { children: [
2621
- selectedNodes.slice(0, maxTagCount).map((node) => /* @__PURE__ */ jsx14("span", { className: "sia-tree-select__tag", children: node.title }, node.value)),
2622
- selectedNodes.length > maxTagCount ? /* @__PURE__ */ jsxs14("span", { className: "sia-tree-select__tag", children: [
2623
- "+",
2624
- selectedNodes.length - maxTagCount
2625
- ] }) : null
2626
- ] }) : selectedNodes[0]?.title : /* @__PURE__ */ jsx14("span", { className: "sia-tree-select__placeholder", children: placeholder }) }),
2636
+ /* @__PURE__ */ jsx14("span", { className: "sia-tree-select__value", children: selectedNodes.length ? displayRender ? displayRender(selectedNodes) : multi ? /* @__PURE__ */ jsx14(OverflowTags, { tagClassName: "sia-tree-select__tag", maxCount: maxTagCount, items: selectedNodes.map((node) => ({ key: node.value, label: node.title })) }) : selectedNodes[0]?.title : /* @__PURE__ */ jsx14("span", { className: "sia-tree-select__placeholder", children: placeholder }) }),
2637
+ floating.label,
2627
2638
  /* @__PURE__ */ jsx14(Icon, { name: open ? "chevron-up" : "chevron-down", size: 14 })
2628
2639
  ]
2629
2640
  }
@@ -3795,7 +3806,7 @@ function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", r
3795
3806
  });
3796
3807
  return () => {
3797
3808
  cancelled = true;
3798
- cleanups.forEach((cleanup) => cleanup());
3809
+ cleanups.forEach((cleanup2) => cleanup2());
3799
3810
  };
3800
3811
  }, [html, imagePreview, resolveImageSrc]);
3801
3812
  function openImagePreview(target) {
@@ -3842,7 +3853,7 @@ var InputNumber = forwardRef4(function InputNumber2({
3842
3853
  prefix,
3843
3854
  suffix,
3844
3855
  controls = true,
3845
- placeholderMode = "default",
3856
+ placeholderMode,
3846
3857
  placeholder,
3847
3858
  disabled,
3848
3859
  readOnly,
@@ -3911,7 +3922,7 @@ var InputNumber = forwardRef4(function InputNumber2({
3911
3922
  }
3912
3923
  const increaseDisabled = disabled || readOnly || max !== void 0 && currentValue !== null && currentValue >= max;
3913
3924
  const decreaseDisabled = disabled || readOnly || min !== void 0 && currentValue !== null && currentValue <= min;
3914
- const floatingPlaceholder = placeholderMode === "floating" && Boolean(placeholder);
3925
+ const floatingPlaceholder = usePlaceholderMode(placeholderMode) === "floating" && Boolean(placeholder);
3915
3926
  const input = /* @__PURE__ */ jsx17(
3916
3927
  "input",
3917
3928
  {
@@ -4387,11 +4398,93 @@ function Treemap({
4387
4398
  );
4388
4399
  }
4389
4400
 
4401
+ // src/components/useScrollbarProximity.ts
4402
+ import { useEffect as useEffect11 } from "react";
4403
+ var users = 0;
4404
+ var cleanup;
4405
+ function useScrollbarProximity() {
4406
+ useEffect11(() => {
4407
+ if (users++ === 0) {
4408
+ let frame = 0;
4409
+ let x = -Infinity;
4410
+ let y = -Infinity;
4411
+ const nearby = /* @__PURE__ */ new Set();
4412
+ const clear = () => {
4413
+ nearby.forEach((track) => track.removeAttribute("data-scrollbar-near"));
4414
+ nearby.clear();
4415
+ };
4416
+ const update = () => {
4417
+ frame = 0;
4418
+ const next = /* @__PURE__ */ new Set();
4419
+ document.querySelectorAll(".sia-scrollbar-track").forEach((track) => {
4420
+ const rect = track.getBoundingClientRect();
4421
+ const proximity = Number.parseFloat(getComputedStyle(track).getPropertyValue("--sia-scrollbar-proximity")) || 16;
4422
+ if (rect.width && rect.height && x >= rect.left - proximity && x <= rect.right + proximity && y >= rect.top - proximity && y <= rect.bottom + proximity) {
4423
+ next.add(track);
4424
+ if (!nearby.has(track)) track.setAttribute("data-scrollbar-near", "true");
4425
+ }
4426
+ });
4427
+ nearby.forEach((track) => {
4428
+ if (!next.has(track)) track.removeAttribute("data-scrollbar-near");
4429
+ });
4430
+ nearby.clear();
4431
+ next.forEach((track) => nearby.add(track));
4432
+ };
4433
+ const move = (event) => {
4434
+ if (event.pointerType === "touch") return;
4435
+ x = event.clientX;
4436
+ y = event.clientY;
4437
+ if (!frame) frame = requestAnimationFrame(update);
4438
+ };
4439
+ const leave = () => {
4440
+ x = y = -Infinity;
4441
+ clear();
4442
+ };
4443
+ document.addEventListener("pointermove", move, { passive: true });
4444
+ document.documentElement.addEventListener("pointerleave", leave);
4445
+ window.addEventListener("blur", leave);
4446
+ cleanup = () => {
4447
+ if (frame) cancelAnimationFrame(frame);
4448
+ document.removeEventListener("pointermove", move);
4449
+ document.documentElement.removeEventListener("pointerleave", leave);
4450
+ window.removeEventListener("blur", leave);
4451
+ clear();
4452
+ };
4453
+ }
4454
+ return () => {
4455
+ if (--users === 0) {
4456
+ cleanup?.();
4457
+ cleanup = void 0;
4458
+ }
4459
+ };
4460
+ }, []);
4461
+ }
4462
+
4463
+ // src/components/Table/TableCellContent.tsx
4464
+ import { useLayoutEffect, useRef as useRef12, useState as useState15 } from "react";
4465
+ import { jsx as jsx19 } from "react/jsx-runtime";
4466
+ function TableCellContent({ children, ellipsis, title }) {
4467
+ const ref = useRef12(null);
4468
+ const [overflowing, setOverflowing] = useState15(false);
4469
+ const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
4470
+ useLayoutEffect(() => {
4471
+ const element = ref.current;
4472
+ if (!element || !ellipsis || !customContent) return;
4473
+ const update = () => setOverflowing(element.scrollWidth > element.clientWidth + 1);
4474
+ update();
4475
+ const observer = new ResizeObserver(update);
4476
+ observer.observe(element);
4477
+ for (const child of element.children) observer.observe(child);
4478
+ return () => observer.disconnect();
4479
+ }, [children, ellipsis, customContent]);
4480
+ return /* @__PURE__ */ jsx19("div", { ref, className: "sia-table__cell-content", title, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children });
4481
+ }
4482
+
4390
4483
  // src/components/Table/Table.tsx
4391
- import { Fragment as Fragment7, forwardRef as forwardRef5, memo, useCallback as useCallback2, useEffect as useEffect12, useImperativeHandle, useMemo as useMemo9, useRef as useRef13, useState as useState16 } from "react";
4484
+ import { Fragment as Fragment7, forwardRef as forwardRef5, memo, useCallback as useCallback2, useEffect as useEffect13, useImperativeHandle, useMemo as useMemo9, useRef as useRef14, useState as useState17 } from "react";
4392
4485
 
4393
4486
  // src/components/Table/plugins.tsx
4394
- import { isValidElement as isValidElement3, useEffect as useEffect11, useRef as useRef12, useState as useState15 } from "react";
4487
+ import { isValidElement as isValidElement3, useEffect as useEffect12, useRef as useRef13, useState as useState16 } from "react";
4395
4488
 
4396
4489
  // src/components/Table/utils.ts
4397
4490
  var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
@@ -4444,9 +4537,9 @@ function toTablePageParams(current, pageSize) {
4444
4537
  }
4445
4538
 
4446
4539
  // src/components/Table/plugins.tsx
4447
- import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
4540
+ import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
4448
4541
  function TableCheckbox({ checked, indeterminate, disabled, label, onChange }) {
4449
- return /* @__PURE__ */ jsx19(Checkbox, { className: "sia-table__checkbox", "aria-label": label, checked, indeterminate, disabled, onClick: (event) => event.stopPropagation(), onChange });
4542
+ return /* @__PURE__ */ jsx20(Checkbox, { className: "sia-table__checkbox", "aria-label": label, checked, indeterminate, disabled, onClick: (event) => event.stopPropagation(), onChange });
4450
4543
  }
4451
4544
  function flattenRecords(data, childrenColumnName) {
4452
4545
  const result = [];
@@ -4898,7 +4991,7 @@ function TableSelectedItemsPanel({
4898
4991
  onRemove,
4899
4992
  onClear
4900
4993
  }) {
4901
- const [showAll, setShowAll] = useState15(false);
4994
+ const [showAll, setShowAll] = useState16(false);
4902
4995
  const visibleEntries = showAll ? entries : entries.slice(0, maxCount);
4903
4996
  const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
4904
4997
  const baseColumnMap = new Map(flattenTableColumns(baseColumns).map((column) => [column.key, column]));
@@ -4906,33 +4999,33 @@ function TableSelectedItemsPanel({
4906
4999
  /* @__PURE__ */ jsxs19("div", { className: "sia-table-selection-panel__header", children: [
4907
5000
  /* @__PURE__ */ jsxs19("strong", { children: [
4908
5001
  "\u5DF2\u9009 ",
4909
- /* @__PURE__ */ jsx19("span", { children: entries.length }),
5002
+ /* @__PURE__ */ jsx20("span", { children: entries.length }),
4910
5003
  " \u9879"
4911
5004
  ] }),
4912
- /* @__PURE__ */ jsx19(Button, { size: "small", variant: "link", disabled: entries.length === 0, onClick: onClear, children: "\u6E05\u7A7A" })
5005
+ /* @__PURE__ */ jsx20(Button, { size: "small", variant: "link", disabled: entries.length === 0, onClick: onClear, children: "\u6E05\u7A7A" })
4913
5006
  ] }),
4914
- /* @__PURE__ */ jsx19("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs19("table", { children: [
4915
- /* @__PURE__ */ jsx19("thead", { children: /* @__PURE__ */ jsxs19("tr", { children: [
4916
- columns.map((column) => /* @__PURE__ */ jsx19("th", { children: getColumnLabel(column) }, column.key)),
4917
- /* @__PURE__ */ jsx19("th", { "aria-label": "\u64CD\u4F5C" })
5007
+ /* @__PURE__ */ jsx20("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs19("table", { children: [
5008
+ /* @__PURE__ */ jsx20("thead", { children: /* @__PURE__ */ jsxs19("tr", { children: [
5009
+ columns.map((column) => /* @__PURE__ */ jsx20("th", { children: getColumnLabel(column) }, column.key)),
5010
+ /* @__PURE__ */ jsx20("th", { "aria-label": "\u64CD\u4F5C" })
4918
5011
  ] }) }),
4919
- /* @__PURE__ */ jsx19("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs19("tr", { children: [
5012
+ /* @__PURE__ */ jsx20("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs19("tr", { children: [
4920
5013
  columns.map((column) => {
4921
- if (column.meta?.plugin === "index") return /* @__PURE__ */ jsx19("td", { children: entry.sourceIndex + 1 }, column.key);
5014
+ if (column.meta?.plugin === "index") return /* @__PURE__ */ jsx20("td", { children: entry.sourceIndex + 1 }, column.key);
4922
5015
  const baseColumn = baseColumnMap.get(column.key) ?? column;
4923
5016
  const value = getTableValue(entry.record, baseColumn.dataIndex, baseColumn.code ?? baseColumn.key);
4924
5017
  const row = { key: entry.key, record: entry.record, sourceIndex: entry.sourceIndex, depth: 0, meta: {} };
4925
5018
  const content = baseColumn.render?.(value, entry.record, entry.sourceIndex, { row, rowIndex: entry.sourceIndex, column: baseColumn }) ?? value;
4926
- return /* @__PURE__ */ jsx19("td", { children: content }, column.key);
5019
+ return /* @__PURE__ */ jsx20("td", { children: content }, column.key);
4927
5020
  }),
4928
- /* @__PURE__ */ jsx19("td", { children: /* @__PURE__ */ jsx19(Button, { size: "small", variant: "link", onClick: () => onRemove(entry.key), children: "\u53D6\u6D88" }) })
5021
+ /* @__PURE__ */ jsx20("td", { children: /* @__PURE__ */ jsx20(Button, { size: "small", variant: "link", onClick: () => onRemove(entry.key), children: "\u53D6\u6D88" }) })
4929
5022
  ] }, entry.key)) })
4930
5023
  ] }) }),
4931
5024
  hiddenCount > 0 ? /* @__PURE__ */ jsxs19("div", { className: "sia-table-selection-panel__more", children: [
4932
5025
  "\u8FD8\u6709 ",
4933
5026
  hiddenCount,
4934
5027
  " \u9879\u672A\u5C55\u793A",
4935
- /* @__PURE__ */ jsx19(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
5028
+ /* @__PURE__ */ jsx20(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
4936
5029
  ] }) : null
4937
5030
  ] });
4938
5031
  }
@@ -5010,12 +5103,12 @@ function createSelectionPlugin(options = {}) {
5010
5103
  const keys = selected(context);
5011
5104
  const allChecked = enabledRows.length > 0 && enabledRows.every((row) => keys.includes(row.key));
5012
5105
  const someChecked = enabledRows.some((row) => keys.includes(row.key));
5013
- return /* @__PURE__ */ jsx19(TableCheckbox, { label: "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C", checked: allChecked, indeterminate: !allChecked && someChecked, onChange: (checked) => {
5106
+ return /* @__PURE__ */ jsx20(TableCheckbox, { label: "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C", checked: allChecked, indeterminate: !allChecked && someChecked, onChange: (checked) => {
5014
5107
  const pageKeys = enabledRows.map((row) => row.key);
5015
5108
  setKeys(checked ? [.../* @__PURE__ */ new Set([...keys, ...pageKeys])] : keys.filter((key) => !pageKeys.includes(key)), context);
5016
5109
  } });
5017
5110
  },
5018
- render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx19(Radio2, { className: "sia-table__checkbox", value: String(info.row.key), "aria-label": `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`, checked: selected(context).includes(info.row.key), disabled: options.getCheckboxDisabled?.(record), onClick: (event) => event.stopPropagation(), onChange: () => toggle(info.row.key, record, context) }) : /* @__PURE__ */ jsx19(TableCheckbox, { label: `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`, checked: selected(context).includes(info.row.key), disabled: options.getCheckboxDisabled?.(record), onChange: (checked) => toggle(info.row.key, record, context, checked) })
5111
+ render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx20(Radio2, { className: "sia-table__checkbox", value: String(info.row.key), "aria-label": `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`, checked: selected(context).includes(info.row.key), disabled: options.getCheckboxDisabled?.(record), onClick: (event) => event.stopPropagation(), onChange: () => toggle(info.row.key, record, context) }) : /* @__PURE__ */ jsx20(TableCheckbox, { label: `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`, checked: selected(context).includes(info.row.key), disabled: options.getCheckboxDisabled?.(record), onChange: (checked) => toggle(info.row.key, record, context, checked) })
5019
5112
  };
5020
5113
  return [selectionColumn, ...columns];
5021
5114
  },
@@ -5043,7 +5136,7 @@ function createSelectionPlugin(options = {}) {
5043
5136
  const entries = entriesForKeys(keys, context);
5044
5137
  const columns = flattenTableColumns(context.columns).filter((column) => !column.hidden && column.meta?.plugin !== "selection").slice(0, Math.max(1, options.selectionPanelColumnCount ?? 4));
5045
5138
  return /* @__PURE__ */ jsxs19("span", { className: "sia-table__selection-footer", children: [
5046
- /* @__PURE__ */ jsx19(
5139
+ /* @__PURE__ */ jsx20(
5047
5140
  Popover,
5048
5141
  {
5049
5142
  placement: "top-start",
@@ -5051,7 +5144,7 @@ function createSelectionPlugin(options = {}) {
5051
5144
  open: context.state.panelOpen && entries.length > 0,
5052
5145
  onOpenChange: (panelOpen) => context.setState((state) => ({ ...state, panelOpen })),
5053
5146
  overlayClassName: "sia-table-selection-popover",
5054
- content: /* @__PURE__ */ jsx19(TableSelectedItemsPanel, { entries, columns, baseColumns: context.baseColumns, maxCount: Math.max(1, options.selectionPanelMaxCount ?? 100), onRemove: (key) => {
5147
+ content: /* @__PURE__ */ jsx20(TableSelectedItemsPanel, { entries, columns, baseColumns: context.baseColumns, maxCount: Math.max(1, options.selectionPanelMaxCount ?? 100), onRemove: (key) => {
5055
5148
  setKeys(keys.filter((item) => item !== key), context);
5056
5149
  }, onClear: () => setKeys([], context) }),
5057
5150
  children: /* @__PURE__ */ jsxs19(Button, { className: "sia-table__selected-trigger", size: "small", variant: "link", disabled: entries.length === 0, children: [
@@ -5061,7 +5154,7 @@ function createSelectionPlugin(options = {}) {
5061
5154
  ] })
5062
5155
  }
5063
5156
  ),
5064
- mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx19(Checkbox, { checked: preserving(context), onChange: (checked) => setPreserving(checked, context), children: "\u8DE8\u9875\u4FDD\u7559\u52FE\u9009" }) : null
5157
+ mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx20(Checkbox, { checked: preserving(context), onChange: (checked) => setPreserving(checked, context), children: "\u8DE8\u9875\u4FDD\u7559\u52FE\u9009" }) : null
5065
5158
  ] });
5066
5159
  },
5067
5160
  getApi(context) {
@@ -5106,13 +5199,13 @@ function createSortPlugin(options = {}) {
5106
5199
  return { ...column, renderHeader: (currentColumn, coreContext) => {
5107
5200
  const info = current(context);
5108
5201
  return /* @__PURE__ */ jsxs19("span", { className: "sia-table__sortable-header", children: [
5109
- /* @__PURE__ */ jsx19("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
5202
+ /* @__PURE__ */ jsx20("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
5110
5203
  /* @__PURE__ */ jsxs19("button", { type: "button", className: "sia-table__sort-button", "aria-label": `\u5207\u6362${getColumnLabel(currentColumn)}\u6392\u5E8F`, onClick: (event) => {
5111
5204
  event.stopPropagation();
5112
5205
  cycle(field, context);
5113
5206
  }, children: [
5114
- /* @__PURE__ */ jsx19(Icon, { name: "chevron-up", size: 11, className: info?.field === field && info.order === "ascend" ? "is-active" : "" }),
5115
- /* @__PURE__ */ jsx19(Icon, { name: "chevron-down", size: 11, className: info?.field === field && info.order === "descend" ? "is-active" : "" })
5207
+ /* @__PURE__ */ jsx20(Icon, { name: "chevron-up", size: 11, className: info?.field === field && info.order === "ascend" ? "is-active" : "" }),
5208
+ /* @__PURE__ */ jsx20(Icon, { name: "chevron-down", size: 11, className: info?.field === field && info.order === "descend" ? "is-active" : "" })
5116
5209
  ] })
5117
5210
  ] });
5118
5211
  } };
@@ -5138,10 +5231,10 @@ function TableFilterControl({
5138
5231
  placeholder,
5139
5232
  onApply
5140
5233
  }) {
5141
- const [open, setOpen] = useState15(false);
5142
- const [draft, setDraft] = useState15(value);
5234
+ const [open, setOpen] = useState16(false);
5235
+ const [draft, setDraft] = useState16(value);
5143
5236
  const label = getColumnLabel(column);
5144
- useEffect11(() => {
5237
+ useEffect12(() => {
5145
5238
  if (open) setDraft(value);
5146
5239
  }, [open, value]);
5147
5240
  const apply = (nextValue) => {
@@ -5149,8 +5242,8 @@ function TableFilterControl({
5149
5242
  setOpen(false);
5150
5243
  };
5151
5244
  return /* @__PURE__ */ jsxs19("span", { className: "sia-table__filter-header", children: [
5152
- /* @__PURE__ */ jsx19("span", { children: column.title ?? column.name ?? column.key }),
5153
- /* @__PURE__ */ jsx19(
5245
+ /* @__PURE__ */ jsx20("span", { children: column.title ?? column.name ?? column.key }),
5246
+ /* @__PURE__ */ jsx20(
5154
5247
  Popover,
5155
5248
  {
5156
5249
  open,
@@ -5158,7 +5251,7 @@ function TableFilterControl({
5158
5251
  placement: "bottom-end",
5159
5252
  overlayClassName: "sia-table-filter-popover",
5160
5253
  content: /* @__PURE__ */ jsxs19("div", { className: "sia-table-filter-panel", children: [
5161
- /* @__PURE__ */ jsx19(
5254
+ /* @__PURE__ */ jsx20(
5162
5255
  Input,
5163
5256
  {
5164
5257
  size: "small",
@@ -5173,14 +5266,14 @@ function TableFilterControl({
5173
5266
  }
5174
5267
  ),
5175
5268
  /* @__PURE__ */ jsxs19("div", { className: "sia-table-filter-panel__actions", children: [
5176
- /* @__PURE__ */ jsx19(Button, { size: "small", disabled: !value && !draft, onClick: () => {
5269
+ /* @__PURE__ */ jsx20(Button, { size: "small", disabled: !value && !draft, onClick: () => {
5177
5270
  setDraft("");
5178
5271
  apply("");
5179
5272
  }, children: "\u6E05\u9664" }),
5180
- /* @__PURE__ */ jsx19(Button, { size: "small", variant: "primary", onClick: () => apply(draft), children: "\u5E94\u7528" })
5273
+ /* @__PURE__ */ jsx20(Button, { size: "small", variant: "primary", onClick: () => apply(draft), children: "\u5E94\u7528" })
5181
5274
  ] })
5182
5275
  ] }),
5183
- children: /* @__PURE__ */ jsx19(
5276
+ children: /* @__PURE__ */ jsx20(
5184
5277
  "button",
5185
5278
  {
5186
5279
  type: "button",
@@ -5188,7 +5281,7 @@ function TableFilterControl({
5188
5281
  "aria-label": `\u7B5B\u9009${label}`,
5189
5282
  "aria-pressed": Boolean(value),
5190
5283
  onClick: (event) => event.stopPropagation(),
5191
- children: /* @__PURE__ */ jsx19(Icon, { name: "search", size: 13 })
5284
+ children: /* @__PURE__ */ jsx20(Icon, { name: "search", size: 13 })
5192
5285
  }
5193
5286
  )
5194
5287
  }
@@ -5229,7 +5322,7 @@ function createFilterPlugin(options = {}) {
5229
5322
  return { ...column, renderHeader: (currentColumn, coreContext) => {
5230
5323
  const renderedColumn = { ...currentColumn, title: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title };
5231
5324
  const placeholder = typeof options.placeholder === "function" ? options.placeholder(currentColumn) : options.placeholder ?? `\u8F93\u5165${getColumnLabel(currentColumn)}\u7B5B\u9009`;
5232
- return /* @__PURE__ */ jsx19(TableFilterControl, { column: renderedColumn, value: current(context)[column.key] ?? "", placeholder, onApply: (value) => update({ ...current(context), [column.key]: value }, context) });
5325
+ return /* @__PURE__ */ jsx20(TableFilterControl, { column: renderedColumn, value: current(context)[column.key] ?? "", placeholder, onApply: (value) => update({ ...current(context), [column.key]: value }, context) });
5233
5326
  } };
5234
5327
  });
5235
5328
  },
@@ -5282,7 +5375,7 @@ function createPaginationPlugin(options = {}) {
5282
5375
  const page = currentPage(context);
5283
5376
  const filteredCount = context.getPluginApi("filter")?.getFilteredRows().length;
5284
5377
  const totalRecords = options.totalCount ?? filteredCount ?? context.sourceData.length;
5285
- return /* @__PURE__ */ jsx19(
5378
+ return /* @__PURE__ */ jsx20(
5286
5379
  Pagination,
5287
5380
  {
5288
5381
  className: "sia-table__pagination",
@@ -5371,10 +5464,10 @@ function createTreePlugin(options = {}) {
5371
5464
  wrapped = true;
5372
5465
  const previousRender = column.render;
5373
5466
  return { ...column, render: (value, record, index, info) => /* @__PURE__ */ jsxs19("span", { className: "sia-table__tree-cell", style: { paddingLeft: info.row.depth * 18 }, children: [
5374
- info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx19("button", { type: "button", className: "sia-table__tree-toggle", "aria-label": current(context).includes(info.row.key) ? "\u6536\u8D77\u5B50\u8282\u70B9" : "\u5C55\u5F00\u5B50\u8282\u70B9", "aria-expanded": current(context).includes(info.row.key), onClick: (event) => {
5467
+ info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx20("button", { type: "button", className: "sia-table__tree-toggle", "aria-label": current(context).includes(info.row.key) ? "\u6536\u8D77\u5B50\u8282\u70B9" : "\u5C55\u5F00\u5B50\u8282\u70B9", "aria-expanded": current(context).includes(info.row.key), onClick: (event) => {
5375
5468
  event.stopPropagation();
5376
5469
  toggle(info.row.key, context);
5377
- }, children: /* @__PURE__ */ jsx19(Icon, { name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right", size: 13 }) }) : /* @__PURE__ */ jsx19("span", { className: "sia-table__tree-placeholder" }),
5470
+ }, children: /* @__PURE__ */ jsx20(Icon, { name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right", size: 13 }) }) : /* @__PURE__ */ jsx20("span", { className: "sia-table__tree-placeholder" }),
5378
5471
  previousRender ? previousRender(value, record, index, info) : value
5379
5472
  ] }) };
5380
5473
  });
@@ -5406,15 +5499,15 @@ function EditableTableCell({
5406
5499
  trigger
5407
5500
  }) {
5408
5501
  const config = typeof editable === "object" ? editable : { type: "input" };
5409
- const [editValue, setEditValue] = useState15(value);
5410
- const [saving, setSaving] = useState15(false);
5411
- const inputRef = useRef12(null);
5412
- const editorRef = useRef12(null);
5413
- const editValueRef = useRef12(value);
5414
- const savingRef = useRef12(false);
5415
- const saveRef = useRef12(async () => {
5502
+ const [editValue, setEditValue] = useState16(value);
5503
+ const [saving, setSaving] = useState16(false);
5504
+ const inputRef = useRef13(null);
5505
+ const editorRef = useRef13(null);
5506
+ const editValueRef = useRef13(value);
5507
+ const savingRef = useRef13(false);
5508
+ const saveRef = useRef13(async () => {
5416
5509
  });
5417
- useEffect11(() => {
5510
+ useEffect12(() => {
5418
5511
  if (!active) return;
5419
5512
  editValueRef.current = value;
5420
5513
  setEditValue(value);
@@ -5445,7 +5538,7 @@ function EditableTableCell({
5445
5538
  }
5446
5539
  }
5447
5540
  saveRef.current = save;
5448
- useEffect11(() => {
5541
+ useEffect12(() => {
5449
5542
  if (!active || config.type === "select" || config.type === "custom") return;
5450
5543
  const handleOutsidePointerDown = (event) => {
5451
5544
  const target = event.target;
@@ -5456,14 +5549,14 @@ function EditableTableCell({
5456
5549
  return () => document.removeEventListener("pointerdown", handleOutsidePointerDown, true);
5457
5550
  }, [active, config.type]);
5458
5551
  if (!active) return /* @__PURE__ */ jsxs19("div", { className: "sia-table__editable-display", onClick: trigger === "click" ? onStart : void 0, onDoubleClick: trigger === "doubleClick" ? onStart : void 0, children: [
5459
- /* @__PURE__ */ jsx19("span", { children: content }),
5460
- /* @__PURE__ */ jsx19(Icon, { name: "edit", size: 13 })
5552
+ /* @__PURE__ */ jsx20("span", { children: content }),
5553
+ /* @__PURE__ */ jsx20(Icon, { name: "edit", size: 13 })
5461
5554
  ] });
5462
5555
  let editor;
5463
5556
  if (config.type === "custom" && config.editRender) {
5464
5557
  editor = config.editRender(record, (next) => void save(next), onCancel);
5465
5558
  } else if (config.type === "inputNumber") {
5466
- editor = /* @__PURE__ */ jsx19(InputNumber, { ref: inputRef, size: "small", value: typeof editValue === "number" ? editValue : null, onChange: updateEditValue, disabled: saving, onBlur: () => void save(), onKeyDown: (event) => {
5559
+ editor = /* @__PURE__ */ jsx20(InputNumber, { ref: inputRef, size: "small", value: typeof editValue === "number" ? editValue : null, onChange: updateEditValue, disabled: saving, onBlur: () => void save(), onKeyDown: (event) => {
5467
5560
  if (event.key === "Enter") {
5468
5561
  const rawValue = event.currentTarget.value.trim();
5469
5562
  const nextValue = rawValue === "" ? null : Number(rawValue);
@@ -5472,17 +5565,17 @@ function EditableTableCell({
5472
5565
  if (event.key === "Escape") onCancel();
5473
5566
  } });
5474
5567
  } else if (config.type === "select") {
5475
- editor = /* @__PURE__ */ jsx19(Select, { size: "small", value: editValue, options: config.options ?? [], disabled: saving, onChange: (next) => {
5568
+ editor = /* @__PURE__ */ jsx20(Select, { size: "small", value: editValue, options: config.options ?? [], disabled: saving, onChange: (next) => {
5476
5569
  updateEditValue(next);
5477
5570
  void save(next);
5478
5571
  } });
5479
5572
  } else {
5480
- editor = /* @__PURE__ */ jsx19(Input, { ref: inputRef, size: "small", value: String(editValue ?? ""), disabled: saving, suffix: saving ? /* @__PURE__ */ jsx19(Icon, { name: "loader", size: 13, spin: true }) : null, onChange: (event) => updateEditValue(event.target.value), onBlur: () => void save(), onKeyDown: (event) => {
5573
+ editor = /* @__PURE__ */ jsx20(Input, { ref: inputRef, size: "small", value: String(editValue ?? ""), disabled: saving, suffix: saving ? /* @__PURE__ */ jsx20(Icon, { name: "loader", size: 13, spin: true }) : null, onChange: (event) => updateEditValue(event.target.value), onBlur: () => void save(), onKeyDown: (event) => {
5481
5574
  if (event.key === "Enter") void save();
5482
5575
  if (event.key === "Escape") onCancel();
5483
5576
  } });
5484
5577
  }
5485
- return /* @__PURE__ */ jsx19("div", { ref: editorRef, className: "sia-table__editor", children: editor });
5578
+ return /* @__PURE__ */ jsx20("div", { ref: editorRef, className: "sia-table__editor", children: editor });
5486
5579
  }
5487
5580
  function createEditablePlugin(options = {}) {
5488
5581
  const trigger = options.trigger ?? "click";
@@ -5500,7 +5593,7 @@ function createEditablePlugin(options = {}) {
5500
5593
  const active = canEdit && context.state.editing?.rowKey === info.row.key && context.state.editing.columnKey === column.key;
5501
5594
  const content = previousRender ? previousRender(value, record, index, info) : value;
5502
5595
  if (!canEdit) return content;
5503
- return /* @__PURE__ */ jsx19(EditableTableCell, { active, editable: column.editable, value, record, content, trigger, onStart: () => context.setState({ editing: { rowKey: info.row.key, columnKey: column.key } }), onCancel: () => context.setState((state) => state.editing?.rowKey === info.row.key && state.editing.columnKey === column.key ? { editing: null } : state), onSave: async (nextValue) => await options.onCellChange?.(column.key, record, nextValue) !== false });
5596
+ return /* @__PURE__ */ jsx20(EditableTableCell, { active, editable: column.editable, value, record, content, trigger, onStart: () => context.setState({ editing: { rowKey: info.row.key, columnKey: column.key } }), onCancel: () => context.setState((state) => state.editing?.rowKey === info.row.key && state.editing.columnKey === column.key ? { editing: null } : state), onSave: async (nextValue) => await options.onCellChange?.(column.key, record, nextValue) !== false });
5504
5597
  } };
5505
5598
  });
5506
5599
  },
@@ -5528,8 +5621,8 @@ function createResizePlugin(options = {}) {
5528
5621
  const width = configuredWidth ?? (autoWidth ? void 0 : 160);
5529
5622
  const previousHeader = column.renderHeader;
5530
5623
  return { ...column, autoWidth, width, renderHeader: (currentColumn, coreContext) => /* @__PURE__ */ jsxs19("span", { className: "sia-table__resizable-header", children: [
5531
- /* @__PURE__ */ jsx19("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
5532
- /* @__PURE__ */ jsx19("span", { className: "sia-table__resize-handle", role: "separator", "aria-label": `\u8C03\u6574${getColumnLabel(currentColumn)}\u5217\u5BBD`, onMouseDown: (event) => {
5624
+ /* @__PURE__ */ jsx20("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
5625
+ /* @__PURE__ */ jsx20("span", { className: "sia-table__resize-handle", role: "separator", "aria-label": `\u8C03\u6574${getColumnLabel(currentColumn)}\u5217\u5BBD`, onMouseDown: (event) => {
5533
5626
  if (event.button !== 0) return;
5534
5627
  event.preventDefault();
5535
5628
  event.stopPropagation();
@@ -5604,9 +5697,9 @@ function applyColumnSettingsToTree(columns, items) {
5604
5697
  return walk(columns).map((entry) => entry.column);
5605
5698
  }
5606
5699
  function ColumnSettingPanel({ open, items, columns, onClose, onApply }) {
5607
- const [draft, setDraft] = useState15(items);
5608
- const dragIndex = useRef12(null);
5609
- useEffect11(() => {
5700
+ const [draft, setDraft] = useState16(items);
5701
+ const dragIndex = useRef13(null);
5702
+ useEffect12(() => {
5610
5703
  if (open) setDraft(items);
5611
5704
  }, [items, open]);
5612
5705
  const labels = new Map(flattenTableColumns(columns).map((column) => [column.key, getColumnLabel(column)]));
@@ -5625,11 +5718,11 @@ function ColumnSettingPanel({ open, items, columns, onClose, onApply }) {
5625
5718
  return /* @__PURE__ */ jsxs19(Drawer2, { open, title: "\u5217\u8BBE\u7F6E", size: 440, onOpenChange: (next) => {
5626
5719
  if (!next) onClose();
5627
5720
  }, footer: /* @__PURE__ */ jsxs19(Fragment6, { children: [
5628
- /* @__PURE__ */ jsx19(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
5629
- /* @__PURE__ */ jsx19(Button, { variant: "primary", onClick: () => onApply(draft), children: "\u5E94\u7528" })
5721
+ /* @__PURE__ */ jsx20(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
5722
+ /* @__PURE__ */ jsx20(Button, { variant: "primary", onClick: () => onApply(draft), children: "\u5E94\u7528" })
5630
5723
  ] }), children: [
5631
5724
  /* @__PURE__ */ jsxs19("label", { className: "sia-table-settings__all", children: [
5632
- /* @__PURE__ */ jsx19(TableCheckbox, { label: "\u5168\u9009\u5217", checked: visibleCount === draft.length && draft.length > 0, indeterminate: visibleCount > 0 && visibleCount < draft.length, onChange: (checked) => setDraft((previous) => previous.map((item) => ({ ...item, visible: checked }))) }),
5725
+ /* @__PURE__ */ jsx20(TableCheckbox, { label: "\u5168\u9009\u5217", checked: visibleCount === draft.length && draft.length > 0, indeterminate: visibleCount > 0 && visibleCount < draft.length, onChange: (checked) => setDraft((previous) => previous.map((item) => ({ ...item, visible: checked }))) }),
5633
5726
  /* @__PURE__ */ jsxs19("span", { children: [
5634
5727
  "\u5168\u9009\uFF08",
5635
5728
  visibleCount,
@@ -5638,7 +5731,7 @@ function ColumnSettingPanel({ open, items, columns, onClose, onApply }) {
5638
5731
  "\uFF09"
5639
5732
  ] })
5640
5733
  ] }),
5641
- /* @__PURE__ */ jsx19("div", { className: "sia-table-settings__list", children: draft.map((item, index) => /* @__PURE__ */ jsxs19("div", { className: "sia-table-settings__item", draggable: true, onDragStart: () => {
5734
+ /* @__PURE__ */ jsx20("div", { className: "sia-table-settings__list", children: draft.map((item, index) => /* @__PURE__ */ jsxs19("div", { className: "sia-table-settings__item", draggable: true, onDragStart: () => {
5642
5735
  dragIndex.current = index;
5643
5736
  }, onDragOver: (event) => event.preventDefault(), onDrop: () => {
5644
5737
  if (dragIndex.current == null || dragIndex.current === index) return;
@@ -5648,14 +5741,14 @@ function ColumnSettingPanel({ open, items, columns, onClose, onApply }) {
5648
5741
  setDraft(next.map((entry, order) => ({ ...entry, order })));
5649
5742
  dragIndex.current = null;
5650
5743
  }, children: [
5651
- /* @__PURE__ */ jsx19(Icon, { name: "menu", size: 15 }),
5652
- /* @__PURE__ */ jsx19(TableCheckbox, { label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`, checked: item.visible, onChange: (checked) => setDraft((previous) => previous.map((entry) => entry.key === item.key ? { ...entry, visible: checked } : entry)) }),
5653
- /* @__PURE__ */ jsx19("span", { className: "sia-table-settings__name", title: labels.get(item.key) ?? item.key, children: labels.get(item.key) ?? item.key }),
5744
+ /* @__PURE__ */ jsx20(Icon, { name: "menu", size: 15 }),
5745
+ /* @__PURE__ */ jsx20(TableCheckbox, { label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`, checked: item.visible, onChange: (checked) => setDraft((previous) => previous.map((entry) => entry.key === item.key ? { ...entry, visible: checked } : entry)) }),
5746
+ /* @__PURE__ */ jsx20("span", { className: "sia-table-settings__name", title: labels.get(item.key) ?? item.key, children: labels.get(item.key) ?? item.key }),
5654
5747
  /* @__PURE__ */ jsxs19("div", { className: "sia-table-settings__actions", children: [
5655
- /* @__PURE__ */ jsx19(Button, { size: "small", variant: "text", icon: /* @__PURE__ */ jsx19(Icon, { name: "arrow-up", size: 13 }), "aria-label": "\u4E0A\u79FB", disabled: index === 0, onClick: () => move(index, -1) }),
5656
- /* @__PURE__ */ jsx19(Button, { size: "small", variant: "text", icon: /* @__PURE__ */ jsx19(Icon, { name: "arrow-down", size: 13 }), "aria-label": "\u4E0B\u79FB", disabled: index === draft.length - 1, onClick: () => move(index, 1) }),
5657
- /* @__PURE__ */ jsx19(Button, { size: "small", variant: item.fixed === "left" ? "primary" : "text", "aria-label": "\u5DE6\u56FA\u5B9A", onClick: () => setFixed(item.key, item.fixed === "left" ? void 0 : "left"), children: "\u5DE6" }),
5658
- /* @__PURE__ */ jsx19(Button, { size: "small", variant: item.fixed === "right" ? "primary" : "text", "aria-label": "\u53F3\u56FA\u5B9A", onClick: () => setFixed(item.key, item.fixed === "right" ? void 0 : "right"), children: "\u53F3" })
5748
+ /* @__PURE__ */ jsx20(Button, { size: "small", variant: "text", icon: /* @__PURE__ */ jsx20(Icon, { name: "arrow-up", size: 13 }), "aria-label": "\u4E0A\u79FB", disabled: index === 0, onClick: () => move(index, -1) }),
5749
+ /* @__PURE__ */ jsx20(Button, { size: "small", variant: "text", icon: /* @__PURE__ */ jsx20(Icon, { name: "arrow-down", size: 13 }), "aria-label": "\u4E0B\u79FB", disabled: index === draft.length - 1, onClick: () => move(index, 1) }),
5750
+ /* @__PURE__ */ jsx20(Button, { size: "small", variant: item.fixed === "left" ? "primary" : "text", "aria-label": "\u5DE6\u56FA\u5B9A", onClick: () => setFixed(item.key, item.fixed === "left" ? void 0 : "left"), children: "\u5DE6" }),
5751
+ /* @__PURE__ */ jsx20(Button, { size: "small", variant: item.fixed === "right" ? "primary" : "text", "aria-label": "\u53F3\u56FA\u5B9A", onClick: () => setFixed(item.key, item.fixed === "right" ? void 0 : "right"), children: "\u53F3" })
5659
5752
  ] })
5660
5753
  ] }, item.key)) })
5661
5754
  ] });
@@ -5701,8 +5794,31 @@ function createColumnSettingPlugin(options = {}) {
5701
5794
  void save({ columns: currentItems(context), pageSize, version: 1 });
5702
5795
  }
5703
5796
  },
5704
- renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx19(Button, { size: "small", variant: "text", className: "sia-table__toolbar-icon", icon: /* @__PURE__ */ jsx19(Icon, { name: "settings", size: 16 }), "aria-label": "\u6253\u5F00\u5217\u8BBE\u7F6E", title: "\u5217\u8BBE\u7F6E", onClick: () => context.setState((state) => ({ ...state, open: true })) }),
5705
- renderOverlay: (context) => /* @__PURE__ */ jsx19(ColumnSettingPanel, { open: context.state.open, items: currentItems(context), columns: context.baseColumns, onClose: () => context.setState((state) => ({ ...state, open: false })), onApply: (items) => apply(items, context) }),
5797
+ renderToolbarEnd: options.showButton === false ? void 0 : (context) => {
5798
+ const exportApi = () => context.getPluginApi("export") ?? createExportPlugin().getApi({ ...context, state: void 0, setState: () => {
5799
+ } });
5800
+ const customItems = (options.menuItems ?? []).filter((item) => !(item.hidden === true || typeof item.hidden === "function" && item.hidden(context)));
5801
+ const items = [
5802
+ ...options.showExport === false ? [] : [
5803
+ { key: "builtin:export", label: "\u8868\u683C\u5BFC\u51FA", icon: /* @__PURE__ */ jsx20(Icon, { name: "download", size: 18 }), disabled: exportApi().getRows().length === 0 },
5804
+ { key: "builtin:divider", type: "divider" }
5805
+ ],
5806
+ { key: "builtin:columns", label: "\u5217\u8BBE\u7F6E", icon: /* @__PURE__ */ jsx20(Icon, { name: "settings", size: 18 }) },
5807
+ ...customItems.map((item) => ({
5808
+ key: "custom:" + item.key,
5809
+ label: item.label,
5810
+ icon: item.icon,
5811
+ danger: item.danger,
5812
+ disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
5813
+ }))
5814
+ ];
5815
+ return /* @__PURE__ */ jsx20(Dropdown, { trigger: ["hover", "click"], placement: "bottomRight", popupClassName: "sia-table__settings-dropdown", menu: { items, onClick: ({ key }) => {
5816
+ if (key === "builtin:export") void exportApi().download();
5817
+ else if (key === "builtin:columns") context.setState((state) => ({ ...state, open: true }));
5818
+ else void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
5819
+ } }, children: /* @__PURE__ */ jsx20(Button, { size: "small", variant: "text", className: "sia-table__toolbar-icon", icon: /* @__PURE__ */ jsx20(Icon, { name: "settings", size: 16 }), "aria-label": "\u8868\u683C\u8BBE\u7F6E" }) });
5820
+ },
5821
+ renderOverlay: (context) => /* @__PURE__ */ jsx20(ColumnSettingPanel, { open: context.state.open, items: currentItems(context), columns: context.baseColumns, onClose: () => context.setState((state) => ({ ...state, open: false })), onApply: (items) => apply(items, context) }),
5706
5822
  getApi: (context) => ({ open: () => context.setState((state) => ({ ...state, open: true })), close: () => context.setState((state) => ({ ...state, open: false })), getSettings: () => currentItems(context), apply: (items) => apply(items, context) })
5707
5823
  };
5708
5824
  }
@@ -5725,10 +5841,10 @@ function createLocalStorageTableSettingsAdapter(prefix = "sia-table") {
5725
5841
  };
5726
5842
  }
5727
5843
  function ToolbarItems({ items, context }) {
5728
- return /* @__PURE__ */ jsx19(Fragment6, { children: items.map((item) => {
5844
+ return /* @__PURE__ */ jsx20(Fragment6, { children: items.map((item) => {
5729
5845
  if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context)) return null;
5730
5846
  const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
5731
- return /* @__PURE__ */ jsx19(Button, { size: "small", danger: item.danger, icon: item.icon, disabled, title: typeof item.label === "string" ? item.label : void 0, onClick: () => void item.onClick?.(context), children: item.label }, item.key);
5847
+ return /* @__PURE__ */ jsx20(Button, { size: "small", danger: item.danger, icon: item.icon, disabled, title: typeof item.label === "string" ? item.label : void 0, onClick: () => void item.onClick?.(context), children: item.label }, item.key);
5732
5848
  }) });
5733
5849
  }
5734
5850
  function createToolbarPlugin(options) {
@@ -5739,14 +5855,14 @@ function createToolbarPlugin(options) {
5739
5855
  order: 5,
5740
5856
  renderToolbarStart: (context) => /* @__PURE__ */ jsxs19(Fragment6, { children: [
5741
5857
  options.start,
5742
- /* @__PURE__ */ jsx19(ToolbarItems, { items: items("start"), context })
5858
+ /* @__PURE__ */ jsx20(ToolbarItems, { items: items("start"), context })
5743
5859
  ] }),
5744
5860
  renderToolbarEnd: (context) => /* @__PURE__ */ jsxs19(Fragment6, { children: [
5745
5861
  options.end,
5746
- /* @__PURE__ */ jsx19(ToolbarItems, { items: items("end"), context }),
5862
+ /* @__PURE__ */ jsx20(ToolbarItems, { items: items("end"), context }),
5747
5863
  items("end", true).length > 0 ? /* @__PURE__ */ jsxs19("details", { className: "sia-table__toolbar-menu", children: [
5748
- /* @__PURE__ */ jsx19("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx19(Icon, { name: "more-horizontal", size: 16 }) }),
5749
- /* @__PURE__ */ jsx19("div", { children: /* @__PURE__ */ jsx19(ToolbarItems, { items: items("end", true), context }) })
5864
+ /* @__PURE__ */ jsx20("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx20(Icon, { name: "more-horizontal", size: 16 }) }),
5865
+ /* @__PURE__ */ jsx20("div", { children: /* @__PURE__ */ jsx20(ToolbarItems, { items: items("end", true), context }) })
5750
5866
  ] }) : null
5751
5867
  ] })
5752
5868
  };
@@ -5816,11 +5932,11 @@ function createExportPlugin(options = {}) {
5816
5932
  return {
5817
5933
  id: "export",
5818
5934
  order: 95,
5819
- renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx19(
5935
+ renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx20(
5820
5936
  Button,
5821
5937
  {
5822
5938
  size: "small",
5823
- icon: /* @__PURE__ */ jsx19(Icon, { name: "download", size: 14 }),
5939
+ icon: /* @__PURE__ */ jsx20(Icon, { name: "download", size: 14 }),
5824
5940
  disabled: getRows(context).length === 0,
5825
5941
  onClick: () => void download(context),
5826
5942
  children: options.buttonLabel ?? "\u5BFC\u51FA"
@@ -5835,7 +5951,7 @@ function createExportPlugin(options = {}) {
5835
5951
  }
5836
5952
 
5837
5953
  // src/components/Table/Table.tsx
5838
- import { jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
5954
+ import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
5839
5955
  var EMPTY_DATA = [];
5840
5956
  var EMPTY_COLUMNS = [];
5841
5957
  var EMPTY_PLUGINS = [];
@@ -5927,7 +6043,7 @@ var TableBodyRow = memo(function TableBodyRow2({
5927
6043
  onCellPointerDown,
5928
6044
  onCellPointerMove
5929
6045
  }) {
5930
- return /* @__PURE__ */ jsx20(
6046
+ return /* @__PURE__ */ jsx21(
5931
6047
  "tr",
5932
6048
  {
5933
6049
  className: `sia-table__row${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
@@ -5945,7 +6061,7 @@ var TableBodyRow = memo(function TableBodyRow2({
5945
6061
  const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
5946
6062
  const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
5947
6063
  const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
5948
- return /* @__PURE__ */ jsx20(
6064
+ return /* @__PURE__ */ jsx21(
5949
6065
  "td",
5950
6066
  {
5951
6067
  "data-column-key": column.key,
@@ -5959,10 +6075,10 @@ var TableBodyRow = memo(function TableBodyRow2({
5959
6075
  onContextMenu: (event) => onCellContextMenu(column, event),
5960
6076
  onPointerDown: (event) => onCellPointerDown(column, event),
5961
6077
  onPointerMove: (event) => onCellPointerMove(column, event),
5962
- children: /* @__PURE__ */ jsx20(
5963
- "div",
6078
+ children: /* @__PURE__ */ jsx21(
6079
+ TableCellContent,
5964
6080
  {
5965
- className: "sia-table__cell-content",
6081
+ ellipsis: column.ellipsis !== false,
5966
6082
  title: column.showTitle !== false && column.ellipsis !== false && typeof value === "string" ? value : void 0,
5967
6083
  children: pluginCellProps.content !== void 0 ? pluginCellProps.content : column.render ? column.render(value, row.record, row.sourceIndex, { row, rowIndex, column }) : value
5968
6084
  }
@@ -5986,6 +6102,7 @@ function TableInner(props, ref) {
5986
6102
  tableHeight,
5987
6103
  size = "medium",
5988
6104
  bordered = true,
6105
+ toolbarBordered = false,
5989
6106
  striped = true,
5990
6107
  virtual,
5991
6108
  virtualThreshold = 100,
@@ -6002,15 +6119,16 @@ function TableInner(props, ref) {
6002
6119
  style,
6003
6120
  ...htmlProps
6004
6121
  } = props;
6005
- const rootRef = useRef13(null);
6006
- const scrollRef = useRef13(null);
6007
- const tableRef = useRef13(null);
6008
- const scrollbarDragRef = useRef13(null);
6009
- const [internalLoading, setInternalLoading] = useState16(false);
6010
- const [scrollTop, setScrollTop] = useState16(0);
6011
- const [viewportHeight, setViewportHeight] = useState16(420);
6012
- const [viewportWidth, setViewportWidth] = useState16(0);
6013
- const [autoColumnWidths, setAutoColumnWidths] = useState16({});
6122
+ const rootRef = useRef14(null);
6123
+ const scrollRef = useRef14(null);
6124
+ const tableRef = useRef14(null);
6125
+ useScrollbarProximity();
6126
+ const scrollbarDragRef = useRef14(null);
6127
+ const [internalLoading, setInternalLoading] = useState17(false);
6128
+ const [scrollTop, setScrollTop] = useState17(0);
6129
+ const [viewportHeight, setViewportHeight] = useState17(420);
6130
+ const [viewportWidth, setViewportWidth] = useState17(0);
6131
+ const [autoColumnWidths, setAutoColumnWidths] = useState17({});
6014
6132
  const getRowKey = useCallback2((record, index) => typeof rowKey === "function" ? rowKey(record, index) : record[String(rowKey)] ?? index, [rowKey]);
6015
6133
  const builtInResizePlugin = useMemo9(() => createResizePlugin(), []);
6016
6134
  const builtInHighlightPlugin = useMemo9(() => createHighlightPlugin(), []);
@@ -6021,14 +6139,14 @@ function TableInner(props, ref) {
6021
6139
  return plugins;
6022
6140
  }, [builtInHighlightPlugin, builtInResizePlugin, providedPlugins, resizable]);
6023
6141
  const sortedPlugins = useMemo9(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
6024
- const pluginsByIdRef = useRef13(/* @__PURE__ */ new Map());
6142
+ const pluginsByIdRef = useRef14(/* @__PURE__ */ new Map());
6025
6143
  pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
6026
- const [pluginStates, setPluginStates] = useState16(() => Object.fromEntries(
6144
+ const [pluginStates, setPluginStates] = useState17(() => Object.fromEntries(
6027
6145
  sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
6028
6146
  ));
6029
- const pluginApisRef = useRef13({});
6030
- const contextsRef = useRef13(/* @__PURE__ */ new Map());
6031
- const mountedPluginsRef = useRef13(/* @__PURE__ */ new Map());
6147
+ const pluginApisRef = useRef14({});
6148
+ const contextsRef = useRef14(/* @__PURE__ */ new Map());
6149
+ const mountedPluginsRef = useRef14(/* @__PURE__ */ new Map());
6032
6150
  const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
6033
6151
  const nextApis = {};
6034
6152
  const contexts = /* @__PURE__ */ new Map();
@@ -6085,7 +6203,7 @@ function TableInner(props, ref) {
6085
6203
  });
6086
6204
  pluginApisRef.current = nextApis;
6087
6205
  contextsRef.current = contexts;
6088
- useEffect12(() => {
6206
+ useEffect13(() => {
6089
6207
  const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
6090
6208
  for (const [pluginId, mounted] of mountedPluginsRef.current) {
6091
6209
  if (activePlugins2.get(pluginId) === mounted.plugin) continue;
@@ -6097,7 +6215,7 @@ function TableInner(props, ref) {
6097
6215
  mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
6098
6216
  }
6099
6217
  }, [sortedPlugins]);
6100
- useEffect12(() => () => {
6218
+ useEffect13(() => () => {
6101
6219
  for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
6102
6220
  mountedPluginsRef.current.clear();
6103
6221
  }, []);
@@ -6109,8 +6227,10 @@ function TableInner(props, ref) {
6109
6227
  if (element.scrollLeft > maxLeft) element.scrollLeft = maxLeft > 1 ? maxLeft : 0;
6110
6228
  const logicalScrollLeft = Math.min(element.scrollLeft, maxLeft);
6111
6229
  const maxTop = Math.max(0, element.scrollHeight - element.clientHeight);
6112
- const horizontalTrack = Math.max(0, element.clientWidth - 8);
6113
- const verticalTrack = Math.max(0, element.clientHeight - 8);
6230
+ root.dataset.overflowX = String(maxLeft > 1);
6231
+ root.dataset.overflowY = String(maxTop > 1);
6232
+ const horizontalTrack = root.querySelector(".sia-table__scrollbar--horizontal")?.clientWidth ?? 0;
6233
+ const verticalTrack = root.querySelector(".sia-table__scrollbar--vertical")?.clientHeight ?? 0;
6114
6234
  const horizontalThumb = maxLeft > 1 ? Math.min(horizontalTrack, Math.max(36, horizontalTrack * element.clientWidth / horizontalContentWidth)) : 0;
6115
6235
  const verticalThumb = maxTop > 1 ? Math.min(verticalTrack, Math.max(36, verticalTrack * element.clientHeight / element.scrollHeight)) : 0;
6116
6236
  const horizontalPosition = maxLeft > 0 ? logicalScrollLeft / maxLeft * Math.max(0, horizontalTrack - horizontalThumb) : 0;
@@ -6135,7 +6255,7 @@ function TableInner(props, ref) {
6135
6255
  root.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
6136
6256
  root.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
6137
6257
  }, []);
6138
- useEffect12(() => {
6258
+ useEffect13(() => {
6139
6259
  const element = scrollRef.current;
6140
6260
  if (!element || typeof ResizeObserver === "undefined") return;
6141
6261
  const observer = new ResizeObserver(() => {
@@ -6148,13 +6268,13 @@ function TableInner(props, ref) {
6148
6268
  updateScrollMetrics();
6149
6269
  return () => observer.disconnect();
6150
6270
  }, [updateScrollMetrics]);
6151
- useEffect12(() => {
6271
+ useEffect13(() => {
6152
6272
  updateScrollMetrics();
6153
6273
  });
6154
6274
  const orderedColumns = useMemo9(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
6155
6275
  const leafColumns = useMemo9(() => flattenTableColumns(orderedColumns), [orderedColumns]);
6156
6276
  const headerRows = useMemo9(() => buildHeaderRows(orderedColumns), [orderedColumns]);
6157
- useEffect12(() => {
6277
+ useEffect13(() => {
6158
6278
  const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
6159
6279
  const root = rootRef.current;
6160
6280
  if (!root || autoWidthColumns.length === 0) return;
@@ -6224,20 +6344,20 @@ function TableInner(props, ref) {
6224
6344
  const bottomSpacer = shouldVirtualize ? Math.max(0, (pipeline.rows.length - endIndex) * rowHeight) : 0;
6225
6345
  const toolbarStart = sortedPlugins.map((plugin) => {
6226
6346
  const content = plugin.renderToolbarStart?.(getContext(plugin));
6227
- return content ? /* @__PURE__ */ jsx20(Fragment7, { children: content }, `toolbar-start-${plugin.id}`) : null;
6347
+ return content ? /* @__PURE__ */ jsx21(Fragment7, { children: content }, `toolbar-start-${plugin.id}`) : null;
6228
6348
  }).filter(Boolean);
6229
6349
  const toolbarEnd = sortedPlugins.map((plugin) => {
6230
6350
  const content = plugin.renderToolbarEnd?.(getContext(plugin));
6231
- return content ? /* @__PURE__ */ jsx20(Fragment7, { children: content }, `toolbar-end-${plugin.id}`) : null;
6351
+ return content ? /* @__PURE__ */ jsx21(Fragment7, { children: content }, `toolbar-end-${plugin.id}`) : null;
6232
6352
  }).filter(Boolean);
6233
6353
  const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
6234
6354
  const footers = sortedPlugins.map((plugin) => {
6235
6355
  const content = plugin.renderFooter?.(getContext(plugin));
6236
- return content ? /* @__PURE__ */ jsx20(Fragment7, { children: content }, `footer-${plugin.id}`) : null;
6356
+ return content ? /* @__PURE__ */ jsx21(Fragment7, { children: content }, `footer-${plugin.id}`) : null;
6237
6357
  }).filter(Boolean);
6238
6358
  const overlays = sortedPlugins.map((plugin) => {
6239
6359
  const content = plugin.renderOverlay?.(getContext(plugin));
6240
- return content ? /* @__PURE__ */ jsx20(Fragment7, { children: content }, `overlay-${plugin.id}`) : null;
6360
+ return content ? /* @__PURE__ */ jsx21(Fragment7, { children: content }, `overlay-${plugin.id}`) : null;
6241
6361
  }).filter(Boolean);
6242
6362
  const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
6243
6363
  const effectiveHeight = height ?? tableHeight ?? (shouldVirtualize ? 420 : void 0);
@@ -6251,16 +6371,26 @@ function TableInner(props, ref) {
6251
6371
  if (shouldVirtualize) setScrollTop(element.scrollTop);
6252
6372
  updateScrollMetrics();
6253
6373
  }, [shouldVirtualize, updateScrollMetrics]);
6254
- const handleScrollbarPointerDown = useCallback2((axis, event) => {
6374
+ const handleScrollbarPointerDown = useCallback2((axis, event, track = event.currentTarget) => {
6255
6375
  const element = scrollRef.current;
6256
- const track = event.currentTarget.parentElement;
6257
- if (!element || !track) return;
6376
+ const thumb = track.firstElementChild;
6377
+ if (!element || !thumb || event.button !== 0) return;
6258
6378
  event.preventDefault();
6259
6379
  event.stopPropagation();
6260
- event.currentTarget.setPointerCapture(event.pointerId);
6380
+ track.setPointerCapture(event.pointerId);
6261
6381
  const trackLength = axis === "x" ? track.clientWidth : track.clientHeight;
6262
- const thumbLength = axis === "x" ? event.currentTarget.offsetWidth : event.currentTarget.offsetHeight;
6382
+ const thumbLength = axis === "x" ? thumb.offsetWidth : thumb.offsetHeight;
6263
6383
  const maxScroll = axis === "x" ? getTableHorizontalMetrics(element, tableRef.current).maxLeft : element.scrollHeight - element.clientHeight;
6384
+ const thumbRect = thumb.getBoundingClientRect();
6385
+ const coordinate = axis === "x" ? event.clientX : event.clientY;
6386
+ const thumbStart = axis === "x" ? thumbRect.left : thumbRect.top;
6387
+ if (coordinate < thumbStart || coordinate > thumbStart + thumbLength) {
6388
+ const trackRect = track.getBoundingClientRect();
6389
+ const trackStart = axis === "x" ? trackRect.left : trackRect.top;
6390
+ const ratio = Math.max(0, Math.min(1, (coordinate - trackStart - thumbLength / 2) / Math.max(1, trackLength - thumbLength)));
6391
+ if (axis === "x") element.scrollLeft = ratio * maxScroll;
6392
+ else element.scrollTop = ratio * maxScroll;
6393
+ }
6264
6394
  scrollbarDragRef.current = {
6265
6395
  axis,
6266
6396
  pointerId: event.pointerId,
@@ -6324,8 +6454,8 @@ function TableInner(props, ref) {
6324
6454
  function renderHeaderContent(column, content) {
6325
6455
  if (column.description === void 0 || column.description === null) return content;
6326
6456
  return /* @__PURE__ */ jsxs20("span", { className: "sia-table__header-label", children: [
6327
- /* @__PURE__ */ jsx20("span", { className: "sia-table__header-label-content", children: content }),
6328
- /* @__PURE__ */ jsx20(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx20("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx20(Icon, { name: "info", size: 14 }) }) })
6457
+ /* @__PURE__ */ jsx21("span", { className: "sia-table__header-label-content", children: content }),
6458
+ /* @__PURE__ */ jsx21(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx21("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx21(Icon, { name: "info", size: 14 }) }) })
6329
6459
  ] });
6330
6460
  }
6331
6461
  function getPluginCellProps(row, column) {
@@ -6353,45 +6483,94 @@ function TableInner(props, ref) {
6353
6483
  };
6354
6484
  }, {});
6355
6485
  }
6486
+ function scrollbarAtPoint(event) {
6487
+ const tracks = rootRef.current?.querySelectorAll(".sia-table__scrollbar");
6488
+ for (const track of tracks ?? []) {
6489
+ if (track.closest(".sia-table") !== rootRef.current) continue;
6490
+ const rect = track.getBoundingClientRect();
6491
+ if (rect.width > 0 && rect.height > 0 && event.clientX >= rect.left && event.clientX < rect.right && event.clientY >= rect.top && event.clientY < rect.bottom) {
6492
+ return { track, axis: track.classList.contains("sia-table__scrollbar--vertical") ? "y" : "x" };
6493
+ }
6494
+ }
6495
+ }
6356
6496
  function renderSummaryRow(summary) {
6357
6497
  let labelRendered = false;
6358
- return /* @__PURE__ */ jsx20("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
6498
+ return /* @__PURE__ */ jsx21("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
6359
6499
  const value = summary.values[column.key];
6360
6500
  const content = value !== void 0 ? value : !labelRendered && summary.label !== void 0 ? (labelRendered = true, summary.label) : null;
6361
6501
  const fixed = normalizeFixed(column.fixed);
6362
6502
  const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
6363
6503
  const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
6364
- return /* @__PURE__ */ jsx20("td", { "data-column-key": column.key, className: `sia-table__cell sia-table__summary-cell${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}`, style: getFixedStyle(column), children: content }, column.key);
6504
+ return /* @__PURE__ */ jsx21("td", { "data-column-key": column.key, className: `sia-table__cell sia-table__summary-cell${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}`, style: getFixedStyle(column), children: content }, column.key);
6365
6505
  }) }, summary.key);
6366
6506
  }
6367
6507
  return /* @__PURE__ */ jsxs20(
6368
6508
  "div",
6369
6509
  {
6370
6510
  ref: rootRef,
6371
- className: `sia-table sia-table--${size}${bordered ? " sia-table--bordered" : ""} ${className}`.trim(),
6511
+ className: `sia-table sia-table--${size}${bordered ? " sia-table--bordered" : ""}${hasToolbar && !toolbarBordered ? " sia-table--borderless-toolbar" : ""} ${className}`.trim(),
6372
6512
  style: rootStyle,
6373
6513
  "data-has-fixed-left": left > 0,
6374
6514
  "data-has-fixed-right": right > 0,
6375
6515
  "data-scrolled-left": "false",
6376
6516
  "data-scrolled-right": "true",
6377
6517
  ...htmlProps,
6518
+ onPointerDownCapture: (event) => {
6519
+ htmlProps.onPointerDownCapture?.(event);
6520
+ if (event.defaultPrevented || loading || internalLoading) return;
6521
+ const hit = scrollbarAtPoint(event);
6522
+ if (hit) handleScrollbarPointerDown(hit.axis, event, hit.track);
6523
+ },
6524
+ onPointerMoveCapture: (event) => {
6525
+ htmlProps.onPointerMoveCapture?.(event);
6526
+ const hit = scrollbarAtPoint(event);
6527
+ rootRef.current?.querySelectorAll(".sia-table__scrollbar").forEach((track) => {
6528
+ const hovered = track === hit?.track;
6529
+ if (hovered !== track.hasAttribute("data-pointer-hover")) track.toggleAttribute("data-pointer-hover", hovered);
6530
+ });
6531
+ if (hit || scrollbarDragRef.current) {
6532
+ handleScrollbarPointerMove(event);
6533
+ event.stopPropagation();
6534
+ }
6535
+ },
6536
+ onPointerLeave: (event) => {
6537
+ htmlProps.onPointerLeave?.(event);
6538
+ rootRef.current?.querySelectorAll("[data-pointer-hover]").forEach((track) => track.removeAttribute("data-pointer-hover"));
6539
+ },
6540
+ onClickCapture: (event) => {
6541
+ if (scrollbarAtPoint(event)) {
6542
+ event.preventDefault();
6543
+ event.stopPropagation();
6544
+ return;
6545
+ }
6546
+ htmlProps.onClickCapture?.(event);
6547
+ },
6548
+ onDoubleClickCapture: (event) => {
6549
+ if (scrollbarAtPoint(event)) {
6550
+ event.preventDefault();
6551
+ event.stopPropagation();
6552
+ return;
6553
+ }
6554
+ htmlProps.onDoubleClickCapture?.(event);
6555
+ },
6378
6556
  children: [
6379
6557
  hasToolbar ? /* @__PURE__ */ jsxs20("div", { className: "sia-table__toolbar", children: [
6380
- /* @__PURE__ */ jsx20("div", { children: toolbarStart }),
6381
- /* @__PURE__ */ jsx20("div", { children: toolbarEnd })
6558
+ /* @__PURE__ */ jsx21("div", { children: toolbarStart }),
6559
+ /* @__PURE__ */ jsx21("div", { children: toolbarEnd })
6382
6560
  ] }) : null,
6383
6561
  /* @__PURE__ */ jsxs20("div", { className: "sia-table__viewport-wrap", children: [
6384
- /* @__PURE__ */ jsx20("div", { className: "sia-table__viewport", ref: scrollRef, onScroll: handleScroll, children: /* @__PURE__ */ jsxs20("table", { ref: tableRef, className: "sia-table__element", style: { width: Math.max(totalWidth, 1), ...manualColumnLayout ? { minWidth: 0 } : {}, ...tableStyle }, children: [
6385
- /* @__PURE__ */ jsx20("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx20("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
6386
- /* @__PURE__ */ jsx20("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx20("tr", { children: headerRow.map((cell) => {
6562
+ /* @__PURE__ */ jsx21("div", { className: "sia-table__viewport", ref: scrollRef, onScroll: handleScroll, children: /* @__PURE__ */ jsxs20("table", { ref: tableRef, className: "sia-table__element", style: { width: Math.max(totalWidth, 1), ...manualColumnLayout ? { minWidth: 0 } : {}, ...tableStyle }, children: [
6563
+ /* @__PURE__ */ jsx21("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx21("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
6564
+ /* @__PURE__ */ jsx21("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx21("tr", { children: headerRow.map((cell) => {
6387
6565
  const fixed = cell.leaf ? normalizeFixed(cell.column.fixed) : void 0;
6388
6566
  const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
6389
6567
  const fixedEdgeClass = fixed === "left" && cell.column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && cell.column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
6390
6568
  const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
6391
- return /* @__PURE__ */ jsx20(
6569
+ return /* @__PURE__ */ jsx21(
6392
6570
  "th",
6393
6571
  {
6394
6572
  "data-column-key": cell.column.key,
6573
+ "data-last-leaf-column": cell.leaf && cell.column.key === leafColumns[leafColumns.length - 1]?.key || void 0,
6395
6574
  colSpan: cell.colSpan,
6396
6575
  rowSpan: cell.rowSpan,
6397
6576
  className: `sia-table__header-cell sia-table__cell--${cell.column.align ?? "left"}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass} ${cell.column.headerClassName ?? ""} ${pluginHeaderProps.className ?? ""}`.trim(),
@@ -6409,12 +6588,12 @@ function TableInner(props, ref) {
6409
6588
  );
6410
6589
  }) }, depth)) }),
6411
6590
  /* @__PURE__ */ jsxs20("tbody", { children: [
6412
- topSpacer > 0 ? /* @__PURE__ */ jsx20("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx20("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
6591
+ topSpacer > 0 ? /* @__PURE__ */ jsx21("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx21("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
6413
6592
  renderedRows.map((row, offset) => {
6414
6593
  const rowIndex = startIndex + offset;
6415
6594
  const pluginClasses = sortedPlugins.map((plugin) => plugin.getRowClassName?.(row, getContext(plugin))).filter(Boolean).join(" ");
6416
6595
  const customClass = typeof rowClassName === "function" ? rowClassName(row.record, row.sourceIndex) : rowClassName ?? "";
6417
- return /* @__PURE__ */ jsx20(
6596
+ return /* @__PURE__ */ jsx21(
6418
6597
  TableBodyRow,
6419
6598
  {
6420
6599
  row,
@@ -6461,36 +6640,44 @@ function TableInner(props, ref) {
6461
6640
  row.key
6462
6641
  );
6463
6642
  }),
6464
- bottomSpacer > 0 ? /* @__PURE__ */ jsx20("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx20("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
6643
+ bottomSpacer > 0 ? /* @__PURE__ */ jsx21("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx21("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
6465
6644
  ] }),
6466
- summaries.length > 0 ? /* @__PURE__ */ jsx20("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
6645
+ summaries.length > 0 ? /* @__PURE__ */ jsx21("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
6467
6646
  ] }) }),
6468
- pipeline.rows.length === 0 ? /* @__PURE__ */ jsx20("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
6469
- /* @__PURE__ */ jsx20("div", { className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(
6647
+ pipeline.rows.length === 0 ? /* @__PURE__ */ jsx21("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
6648
+ /* @__PURE__ */ jsx21(
6470
6649
  "div",
6471
6650
  {
6472
- className: "sia-table__scrollbar-thumb",
6651
+ className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
6652
+ "aria-hidden": "true",
6473
6653
  onPointerDown: (event) => handleScrollbarPointerDown("x", event),
6654
+ onClick: (event) => event.stopPropagation(),
6655
+ onDoubleClick: (event) => event.stopPropagation(),
6474
6656
  onPointerMove: handleScrollbarPointerMove,
6475
6657
  onPointerUp: handleScrollbarPointerEnd,
6476
- onPointerCancel: handleScrollbarPointerEnd
6658
+ onPointerCancel: handleScrollbarPointerEnd,
6659
+ children: /* @__PURE__ */ jsx21("div", { className: "sia-table__scrollbar-thumb" })
6477
6660
  }
6478
- ) }),
6479
- /* @__PURE__ */ jsx20("div", { className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(
6661
+ ),
6662
+ /* @__PURE__ */ jsx21(
6480
6663
  "div",
6481
6664
  {
6482
- className: "sia-table__scrollbar-thumb",
6665
+ className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
6666
+ "aria-hidden": "true",
6483
6667
  onPointerDown: (event) => handleScrollbarPointerDown("y", event),
6668
+ onClick: (event) => event.stopPropagation(),
6669
+ onDoubleClick: (event) => event.stopPropagation(),
6484
6670
  onPointerMove: handleScrollbarPointerMove,
6485
6671
  onPointerUp: handleScrollbarPointerEnd,
6486
- onPointerCancel: handleScrollbarPointerEnd
6672
+ onPointerCancel: handleScrollbarPointerEnd,
6673
+ children: /* @__PURE__ */ jsx21("div", { className: "sia-table__scrollbar-thumb" })
6487
6674
  }
6488
- ) })
6675
+ )
6489
6676
  ] }),
6490
- footers.length > 0 ? /* @__PURE__ */ jsx20("div", { className: "sia-table__footer", children: footers }) : null,
6677
+ footers.length > 0 ? /* @__PURE__ */ jsx21("div", { className: "sia-table__footer", children: footers }) : null,
6491
6678
  loading || internalLoading ? /* @__PURE__ */ jsxs20("div", { className: "sia-table__loading", role: "status", children: [
6492
- /* @__PURE__ */ jsx20(Icon, { name: "loader", size: 22, spin: true }),
6493
- /* @__PURE__ */ jsx20("span", { children: "\u52A0\u8F7D\u4E2D" })
6679
+ /* @__PURE__ */ jsx21(Icon, { name: "loader", size: 22, spin: true }),
6680
+ /* @__PURE__ */ jsx21("span", { children: "\u52A0\u8F7D\u4E2D" })
6494
6681
  ] }) : null,
6495
6682
  overlays
6496
6683
  ]
@@ -6501,7 +6688,7 @@ var Table = forwardRef5(TableInner);
6501
6688
 
6502
6689
  // src/components/ThemeSwitch.tsx
6503
6690
  import { forwardRef as forwardRef6 } from "react";
6504
- import { jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
6691
+ import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
6505
6692
  var ThemeSwitch = forwardRef6(function ThemeSwitch2({
6506
6693
  checked,
6507
6694
  onCheckedChange,
@@ -6527,19 +6714,19 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
6527
6714
  onClick: handleClick,
6528
6715
  ...props,
6529
6716
  children: [
6530
- /* @__PURE__ */ jsx21("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
6531
- /* @__PURE__ */ jsx21("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs21("svg", { viewBox: "0 0 24 24", children: [
6532
- /* @__PURE__ */ jsx21("circle", { cx: "12", cy: "12", r: "3.5" }),
6533
- /* @__PURE__ */ jsx21("path", { d: "M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4" })
6717
+ /* @__PURE__ */ jsx22("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
6718
+ /* @__PURE__ */ jsx22("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs21("svg", { viewBox: "0 0 24 24", children: [
6719
+ /* @__PURE__ */ jsx22("circle", { cx: "12", cy: "12", r: "3.5" }),
6720
+ /* @__PURE__ */ jsx22("path", { d: "M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4" })
6534
6721
  ] }) }),
6535
- /* @__PURE__ */ jsx21("span", { className: `sia-theme-switch__icon${checked ? " is-active" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx21("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx21("path", { d: "M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z" }) }) })
6722
+ /* @__PURE__ */ jsx22("span", { className: `sia-theme-switch__icon${checked ? " is-active" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx22("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx22("path", { d: "M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z" }) }) })
6536
6723
  ]
6537
6724
  }
6538
6725
  );
6539
6726
  });
6540
6727
 
6541
6728
  // src/components/FloatingScrollbarProvider.tsx
6542
- import { useEffect as useEffect13 } from "react";
6729
+ import { useEffect as useEffect14 } from "react";
6543
6730
  var scrollableOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]);
6544
6731
  var clippingOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay", "hidden", "clip"]);
6545
6732
  function isRootScroller(target) {
@@ -6602,7 +6789,8 @@ function createTrack(axis) {
6602
6789
  return { track, thumb };
6603
6790
  }
6604
6791
  function FloatingScrollbarProvider({ disabled = false }) {
6605
- useEffect13(() => {
6792
+ useScrollbarProximity();
6793
+ useEffect14(() => {
6606
6794
  if (disabled) return;
6607
6795
  const layer = document.createElement("div");
6608
6796
  layer.className = "sia-floating-scrollbar-layer";
@@ -6632,7 +6820,7 @@ function FloatingScrollbarProvider({ disabled = false }) {
6632
6820
  const hasHorizontal = canScroll(target, "horizontal");
6633
6821
  const hasVertical = canScroll(target, "vertical");
6634
6822
  const rect = visibleRect(target);
6635
- const thickness = 8;
6823
+ const thickness = 10;
6636
6824
  horizontalTrack.hidden = !hasHorizontal || rect.width <= thickness || rect.height <= 0;
6637
6825
  verticalTrack.hidden = !hasVertical || rect.height <= thickness || rect.width <= 0;
6638
6826
  if (!horizontalTrack.hidden) {
@@ -6871,8 +7059,8 @@ function applySiaTheme(mode, target = document.documentElement) {
6871
7059
  }
6872
7060
 
6873
7061
  // src/components/SelectionPanel.tsx
6874
- import { useEffect as useEffect14, useId as useId7, useMemo as useMemo10, useRef as useRef14, useState as useState17 } from "react";
6875
- import { jsx as jsx22, jsxs as jsxs22 } from "react/jsx-runtime";
7062
+ import { useEffect as useEffect15, useId as useId7, useMemo as useMemo10, useRef as useRef15, useState as useState18 } from "react";
7063
+ import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
6876
7064
  function SelectionPanel({
6877
7065
  options,
6878
7066
  value,
@@ -6890,11 +7078,11 @@ function SelectionPanel({
6890
7078
  maxHeight = 250,
6891
7079
  autoFocusSearch = false
6892
7080
  }) {
6893
- const [localSearch, setLocalSearch] = useState17("");
7081
+ const [localSearch, setLocalSearch] = useState18("");
6894
7082
  const search = searchValue ?? localSearch;
6895
- const [scrollTop, setScrollTop] = useState17(0);
6896
- const [active, setActive] = useState17();
6897
- const listRef = useRef14(null);
7083
+ const [scrollTop, setScrollTop] = useState18(0);
7084
+ const [active, setActive] = useState18();
7085
+ const listRef = useRef15(null);
6898
7086
  const id = useId7();
6899
7087
  const selected = useMemo10(() => new Set(value), [value]);
6900
7088
  const count = Math.max(1, Math.floor(columns));
@@ -6932,7 +7120,7 @@ function SelectionPanel({
6932
7120
  const virtual = filtered.length > 100;
6933
7121
  const renderedRows = virtual ? rows.filter((row) => row.top + row.height >= scrollTop - 100 && row.top <= scrollTop + maxHeight + 100) : rows;
6934
7122
  const enabled = filtered.filter((option) => !option.disabled && option.optionType !== "divider");
6935
- useEffect14(() => {
7123
+ useEffect15(() => {
6936
7124
  setScrollTop(0);
6937
7125
  if (listRef.current) listRef.current.scrollTop = 0;
6938
7126
  setActive(void 0);
@@ -6954,7 +7142,7 @@ function SelectionPanel({
6954
7142
  onChange([...retained, ...add]);
6955
7143
  }
6956
7144
  return /* @__PURE__ */ jsxs22("div", { className: "sia-selection-panel", children: [
6957
- showSearch && /* @__PURE__ */ jsx22(
7145
+ showSearch && /* @__PURE__ */ jsx23(
6958
7146
  Input,
6959
7147
  {
6960
7148
  "aria-label": "\u641C\u7D22\u9009\u9879",
@@ -6969,16 +7157,16 @@ function SelectionPanel({
6969
7157
  }
6970
7158
  ),
6971
7159
  multiple && /* @__PURE__ */ jsxs22("div", { className: "sia-selection-panel__actions", children: [
6972
- /* @__PURE__ */ jsx22(Button, { variant: "link", size: "small", disabled: disabled || loading || !enabled.length, onClick: () => batch("all"), children: "\u5168\u9009" }),
6973
- /* @__PURE__ */ jsx22(Button, { variant: "link", size: "small", disabled: disabled || loading || !enabled.length, onClick: () => batch("invert"), children: "\u53CD\u9009" }),
6974
- /* @__PURE__ */ jsx22(Button, { variant: "link", size: "small", disabled: disabled || loading || !value.length, onClick: () => batch("clear"), children: "\u6E05\u7A7A" }),
7160
+ /* @__PURE__ */ jsx23(Button, { variant: "link", size: "small", disabled: disabled || loading || !enabled.length, onClick: () => batch("all"), children: "\u5168\u9009" }),
7161
+ /* @__PURE__ */ jsx23(Button, { variant: "link", size: "small", disabled: disabled || loading || !enabled.length, onClick: () => batch("invert"), children: "\u53CD\u9009" }),
7162
+ /* @__PURE__ */ jsx23(Button, { variant: "link", size: "small", disabled: disabled || loading || !value.length, onClick: () => batch("clear"), children: "\u6E05\u7A7A" }),
6975
7163
  /* @__PURE__ */ jsxs22("span", { children: [
6976
7164
  "\u5DF2\u9009 ",
6977
7165
  value.length,
6978
7166
  " \u9879"
6979
7167
  ] })
6980
7168
  ] }),
6981
- /* @__PURE__ */ jsx22(
7169
+ /* @__PURE__ */ jsx23(
6982
7170
  "div",
6983
7171
  {
6984
7172
  ref: listRef,
@@ -7008,12 +7196,12 @@ function SelectionPanel({
7008
7196
  toggle(enabled[index]);
7009
7197
  }
7010
7198
  },
7011
- children: loading ? /* @__PURE__ */ jsx22("div", { role: "status", children: "\u52A0\u8F7D\u4E2D\u2026" }) : !rows.length ? /* @__PURE__ */ jsx22("div", { className: "sia-selection-panel__empty", children: "\u6682\u65E0\u5339\u914D\u9009\u9879" }) : /* @__PURE__ */ jsx22("div", { style: { height: totalHeight, position: "relative" }, children: renderedRows.map((row) => /* @__PURE__ */ jsx22(
7199
+ children: loading ? /* @__PURE__ */ jsx23("div", { role: "status", children: "\u52A0\u8F7D\u4E2D\u2026" }) : !rows.length ? /* @__PURE__ */ jsx23("div", { className: "sia-selection-panel__empty", children: "\u6682\u65E0\u5339\u914D\u9009\u9879" }) : /* @__PURE__ */ jsx23("div", { style: { height: totalHeight, position: "relative" }, children: renderedRows.map((row) => /* @__PURE__ */ jsx23(
7012
7200
  "div",
7013
7201
  {
7014
7202
  className: row.title !== void 0 ? "sia-selection-panel__group" : "sia-selection-panel__row",
7015
7203
  style: { position: "absolute", top: row.top, height: row.height, width: "100%", gridTemplateColumns: `repeat(${count}, minmax(0, 1fr))` },
7016
- children: row.title ?? row.items?.map((option, index) => option.optionType === "divider" ? /* @__PURE__ */ jsx22("div", { role: "separator", className: "sia-selection-panel__divider" }, `divider-${index}`) : /* @__PURE__ */ jsx22(Tooltip, { title: option.disabled ? option.disabledTip : void 0, placement: "right", children: /* @__PURE__ */ jsxs22(
7204
+ children: row.title ?? row.items?.map((option, index) => option.optionType === "divider" ? /* @__PURE__ */ jsx23("div", { role: "separator", className: "sia-selection-panel__divider" }, `divider-${index}`) : /* @__PURE__ */ jsx23(Tooltip, { title: option.disabled ? option.disabledTip : void 0, placement: "right", children: /* @__PURE__ */ jsxs22(
7017
7205
  "button",
7018
7206
  {
7019
7207
  type: "button",
@@ -7025,10 +7213,10 @@ function SelectionPanel({
7025
7213
  className: `sia-selection-panel__option${active === option.value ? " is-active" : ""}`,
7026
7214
  onClick: () => toggle(option),
7027
7215
  children: [
7028
- multiple && /* @__PURE__ */ jsx22("span", { "aria-hidden": "true", className: "sia-selection-panel__check", children: selected.has(option.value) ? "\u2713" : "" }),
7216
+ multiple && /* @__PURE__ */ jsx23("span", { "aria-hidden": "true", className: "sia-selection-panel__check", children: selected.has(option.value) ? "\u2713" : "" }),
7029
7217
  /* @__PURE__ */ jsxs22("span", { className: "sia-selection-panel__text", children: [
7030
7218
  showValue || displayField === "label" ? option.label : String(option.value),
7031
- showValue && /* @__PURE__ */ jsx22("small", { children: String(option.value) })
7219
+ showValue && /* @__PURE__ */ jsx23("small", { children: String(option.value) })
7032
7220
  ] })
7033
7221
  ]
7034
7222
  }
@@ -7042,8 +7230,8 @@ function SelectionPanel({
7042
7230
  }
7043
7231
 
7044
7232
  // src/components/InputSelect.tsx
7045
- import { forwardRef as forwardRef7, useEffect as useEffect15, useRef as useRef15, useState as useState18 } from "react";
7046
- import { jsx as jsx23, jsxs as jsxs23 } from "react/jsx-runtime";
7233
+ import { forwardRef as forwardRef7, useEffect as useEffect16, useRef as useRef16, useState as useState19 } from "react";
7234
+ import { jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
7047
7235
  var InputSelect = forwardRef7(function InputSelect2({
7048
7236
  options,
7049
7237
  value,
@@ -7053,6 +7241,7 @@ var InputSelect = forwardRef7(function InputSelect2({
7053
7241
  displayField = "label",
7054
7242
  showValue = false,
7055
7243
  placeholder = "\u8BF7\u9009\u62E9",
7244
+ placeholderMode,
7056
7245
  size = "medium",
7057
7246
  status,
7058
7247
  disabled = false,
@@ -7068,22 +7257,22 @@ var InputSelect = forwardRef7(function InputSelect2({
7068
7257
  onOpenChange,
7069
7258
  ...inputProps
7070
7259
  }, forwardedRef) {
7071
- const [internal, setInternal] = useState18(defaultValue);
7260
+ const [internal, setInternal] = useState19(defaultValue);
7072
7261
  const current = value !== void 0 ? value : internal;
7073
7262
  const values = current == null ? [] : Array.isArray(current) ? current : [current];
7074
7263
  const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
7075
- const [draft, setDraft] = useState18(text);
7076
- useEffect15(() => {
7264
+ const [draft, setDraft] = useState19(text);
7265
+ useEffect16(() => {
7077
7266
  setDraft(text);
7078
7267
  }, [text, current]);
7079
- const [open, setOpen] = useState18(false);
7080
- const [search, setSearch] = useState18("");
7081
- const [modalOpen, setModalOpen] = useState18(false);
7082
- const [modalValues, setModalValues] = useState18([]);
7083
- const [selectedOnly, setSelectedOnly] = useState18(false);
7084
- const rootRef = useRef15(null);
7085
- const popupRef = useRef15(null);
7086
- const inputRef = useRef15(null);
7268
+ const [open, setOpen] = useState19(false);
7269
+ const [search, setSearch] = useState19("");
7270
+ const [modalOpen, setModalOpen] = useState19(false);
7271
+ const [modalValues, setModalValues] = useState19([]);
7272
+ const [selectedOnly, setSelectedOnly] = useState19(false);
7273
+ const rootRef = useRef16(null);
7274
+ const popupRef = useRef16(null);
7275
+ const inputRef = useRef16(null);
7087
7276
  const config = typeof enableModal === "object" ? enableModal : {};
7088
7277
  function changeOpen(next) {
7089
7278
  if (next && (disabled || loading)) return;
@@ -7103,7 +7292,7 @@ var InputSelect = forwardRef7(function InputSelect2({
7103
7292
  inputRef.current?.focus();
7104
7293
  }
7105
7294
  }
7106
- useEffect15(() => {
7295
+ useEffect16(() => {
7107
7296
  if (!open) return;
7108
7297
  const outside = (event) => {
7109
7298
  if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
@@ -7111,7 +7300,7 @@ var InputSelect = forwardRef7(function InputSelect2({
7111
7300
  document.addEventListener("pointerdown", outside);
7112
7301
  return () => document.removeEventListener("pointerdown", outside);
7113
7302
  }, [open, onOpenChange]);
7114
- useEffect15(() => {
7303
+ useEffect16(() => {
7115
7304
  if (disabled || loading) {
7116
7305
  changeOpen(false);
7117
7306
  setModalOpen(false);
@@ -7124,14 +7313,14 @@ var InputSelect = forwardRef7(function InputSelect2({
7124
7313
  setSelectedOnly(false);
7125
7314
  setModalOpen(true);
7126
7315
  }
7127
- return /* @__PURE__ */ jsxs23("div", { ref: rootRef, style, className: `sia-input-select ${className}`, onKeyDown: (event) => {
7316
+ return /* @__PURE__ */ jsxs23("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
7128
7317
  if (event.key === "Escape" && open) {
7129
7318
  event.stopPropagation();
7130
7319
  changeOpen(false);
7131
7320
  inputRef.current?.focus();
7132
7321
  }
7133
7322
  }, children: [
7134
- /* @__PURE__ */ jsx23(
7323
+ /* @__PURE__ */ jsx24(
7135
7324
  Input,
7136
7325
  {
7137
7326
  ...inputProps,
@@ -7149,6 +7338,7 @@ var InputSelect = forwardRef7(function InputSelect2({
7149
7338
  disabled,
7150
7339
  readOnly: displayField === "label" || loading,
7151
7340
  placeholder,
7341
+ placeholderMode,
7152
7342
  value: draft,
7153
7343
  maxLength: inputMaxLength && inputMaxLength > 0 ? inputMaxLength : void 0,
7154
7344
  showCount: !!inputMaxLength && inputMaxLength > 0,
@@ -7168,25 +7358,25 @@ var InputSelect = forwardRef7(function InputSelect2({
7168
7358
  changeOpen(true);
7169
7359
  },
7170
7360
  suffix: /* @__PURE__ */ jsxs23("span", { className: "sia-input-select__suffix", children: [
7171
- allowClear && draft && !disabled && /* @__PURE__ */ jsx23(Button, { variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
7361
+ allowClear && draft && !disabled && /* @__PURE__ */ jsx24(Button, { variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
7172
7362
  event.stopPropagation();
7173
7363
  setDraft("");
7174
7364
  emit(multiple ? [] : void 0);
7175
7365
  inputRef.current?.focus();
7176
7366
  }, children: "\xD7" }),
7177
7367
  suffix,
7178
- enableModal && /* @__PURE__ */ jsx23(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
7368
+ enableModal && /* @__PURE__ */ jsx24(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
7179
7369
  event.stopPropagation();
7180
7370
  openModal();
7181
7371
  }, children: "\u2026" }),
7182
- /* @__PURE__ */ jsx23(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
7372
+ /* @__PURE__ */ jsx24(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
7183
7373
  event.stopPropagation();
7184
7374
  changeOpen(!open);
7185
- }, children: /* @__PURE__ */ jsx23(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
7375
+ }, children: /* @__PURE__ */ jsx24(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
7186
7376
  ] })
7187
7377
  }
7188
7378
  ),
7189
- /* @__PURE__ */ jsx23(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx23(
7379
+ /* @__PURE__ */ jsx24(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx24(
7190
7380
  SelectionPanel,
7191
7381
  {
7192
7382
  options,
@@ -7215,14 +7405,14 @@ var InputSelect = forwardRef7(function InputSelect2({
7215
7405
  },
7216
7406
  children: [
7217
7407
  /* @__PURE__ */ jsxs23("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
7218
- /* @__PURE__ */ jsx23(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
7408
+ /* @__PURE__ */ jsx24(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
7219
7409
  /* @__PURE__ */ jsxs23(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
7220
7410
  "\u5DF2\u9009\u9879(",
7221
7411
  modalValues.length,
7222
7412
  ")"
7223
7413
  ] })
7224
7414
  ] }),
7225
- modalOpen && /* @__PURE__ */ jsx23(
7415
+ modalOpen && /* @__PURE__ */ jsx24(
7226
7416
  SelectionPanel,
7227
7417
  {
7228
7418
  options,