@sia.soul/sia-react-ui 0.1.81 → 0.1.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/chart.cjs CHANGED
@@ -254,10 +254,18 @@ function installTitleTooltips(doc) {
254
254
  let root;
255
255
  let observer;
256
256
  let tooltipId = "";
257
+ const canShow = (element) => {
258
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
259
+ return [element, ...element.querySelectorAll("*")].some((node) => {
260
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
261
+ const style = doc.defaultView?.getComputedStyle(node);
262
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
263
+ });
264
+ };
257
265
  const candidate = (target) => {
258
266
  if (!(target instanceof Element)) return null;
259
267
  const element = target.closest("[data-sia-title]");
260
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
268
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
261
269
  };
262
270
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
263
271
  const hide = () => {
@@ -275,7 +283,7 @@ function installTitleTooltips(doc) {
275
283
  };
276
284
  const render = () => {
277
285
  const text = active?.getAttribute("data-sia-title");
278
- if (!active?.isConnected || !text) {
286
+ if (!active?.isConnected || !text || !canShow(active)) {
279
287
  hide();
280
288
  return;
281
289
  }
package/dist/chart.js CHANGED
@@ -56,9 +56,9 @@ import {
56
56
  smoothSvgPath,
57
57
  svgArcPath,
58
58
  transferCompositeValue
59
- } from "./chunk-BDS42FR3.js";
60
- import "./chunk-JZWTTSOZ.js";
61
- import "./chunk-H7IAG72O.js";
59
+ } from "./chunk-ZHQ7PCCF.js";
60
+ import "./chunk-SJFT5OSX.js";
61
+ import "./chunk-PUZWLIIJ.js";
62
62
  export {
63
63
  BarChart,
64
64
  CHART_VIEWBOX_HEIGHT,
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  Popover,
3
3
  Tooltip
4
- } from "./chunk-WXERMWTW.js";
4
+ } from "./chunk-V4GGPMKS.js";
5
5
  import {
6
6
  Dropdown,
7
7
  Icon,
8
8
  useOverlayLifecycle
9
- } from "./chunk-XHLIIDD2.js";
9
+ } from "./chunk-CLBWJEID.js";
10
10
  import {
11
11
  Button,
12
12
  TextArea
13
- } from "./chunk-JZWTTSOZ.js";
13
+ } from "./chunk-SJFT5OSX.js";
14
14
  import {
15
15
  useControlSize,
16
16
  useControllableState,
17
17
  withTitleTooltip
18
- } from "./chunk-H7IAG72O.js";
18
+ } from "./chunk-PUZWLIIJ.js";
19
19
 
20
20
  // src/components/Toolbar.tsx
21
21
  import { useLayoutEffect, useRef, useState } from "react";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  Button,
3
3
  TextArea
4
- } from "./chunk-JZWTTSOZ.js";
4
+ } from "./chunk-SJFT5OSX.js";
5
5
  import {
6
6
  PopupPortal,
7
7
  useControlSize,
8
8
  useControllableState,
9
9
  usePlaceholderMode,
10
10
  withTitleTooltip
11
- } from "./chunk-H7IAG72O.js";
11
+ } from "./chunk-PUZWLIIJ.js";
12
12
 
13
13
  // src/components/Icon.tsx
14
14
  import { forwardRef } from "react";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  FloatingScrollbarProvider,
3
3
  Select
4
- } from "./chunk-WXERMWTW.js";
4
+ } from "./chunk-V4GGPMKS.js";
5
5
  import {
6
6
  Icon
7
- } from "./chunk-XHLIIDD2.js";
7
+ } from "./chunk-CLBWJEID.js";
8
8
  import {
9
9
  PopupPortal,
10
10
  useControlSize,
11
11
  useControllableState,
12
12
  useFloatingPlaceholder,
13
13
  withTitleTooltip
14
- } from "./chunk-H7IAG72O.js";
14
+ } from "./chunk-PUZWLIIJ.js";
15
15
 
16
16
  // src/components/DatePicker.tsx
17
17
  import { useEffect, useId, useLayoutEffect as useLayoutEffect2, useMemo, useRef as useRef2, useState } from "react";
@@ -20,10 +20,18 @@ function installTitleTooltips(doc) {
20
20
  let root;
21
21
  let observer;
22
22
  let tooltipId = "";
23
+ const canShow = (element) => {
24
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
25
+ return [element, ...element.querySelectorAll("*")].some((node) => {
26
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
27
+ const style = doc.defaultView?.getComputedStyle(node);
28
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
29
+ });
30
+ };
23
31
  const candidate = (target) => {
24
32
  if (!(target instanceof Element)) return null;
25
33
  const element = target.closest("[data-sia-title]");
26
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
34
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
27
35
  };
28
36
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
29
37
  const hide = () => {
@@ -41,7 +49,7 @@ function installTitleTooltips(doc) {
41
49
  };
42
50
  const render = () => {
43
51
  const text = active?.getAttribute("data-sia-title");
44
- if (!active?.isConnected || !text) {
52
+ if (!active?.isConnected || !text || !canShow(active)) {
45
53
  hide();
46
54
  return;
47
55
  }
@@ -2,14 +2,14 @@ import {
2
2
  Dropdown,
3
3
  Icon,
4
4
  Input
5
- } from "./chunk-XHLIIDD2.js";
5
+ } from "./chunk-CLBWJEID.js";
6
6
  import {
7
7
  Button
8
- } from "./chunk-JZWTTSOZ.js";
8
+ } from "./chunk-SJFT5OSX.js";
9
9
  import {
10
10
  useFloatingPlaceholder,
11
11
  withTitleTooltip
12
- } from "./chunk-H7IAG72O.js";
12
+ } from "./chunk-PUZWLIIJ.js";
13
13
 
14
14
  // src/components/RichTextEditor.tsx
15
15
  import { useEffect, useMemo, useRef, useState } from "react";
@@ -2,7 +2,7 @@ import {
2
2
  useControlSize,
3
3
  useFloatingPlaceholder,
4
4
  withTitleTooltip
5
- } from "./chunk-H7IAG72O.js";
5
+ } from "./chunk-PUZWLIIJ.js";
6
6
 
7
7
  // src/components/Button.tsx
8
8
  import { forwardRef, useRef } from "react";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useFloatingPlaceholder,
3
3
  withTitleTooltip
4
- } from "./chunk-H7IAG72O.js";
4
+ } from "./chunk-PUZWLIIJ.js";
5
5
 
6
6
  // src/components/MarkdownEditor.tsx
7
7
  import { useEffect, useRef, useState } from "react";
@@ -3,10 +3,10 @@ import {
3
3
  Icon,
4
4
  Input,
5
5
  Modal
6
- } from "./chunk-XHLIIDD2.js";
6
+ } from "./chunk-CLBWJEID.js";
7
7
  import {
8
8
  Button
9
- } from "./chunk-JZWTTSOZ.js";
9
+ } from "./chunk-SJFT5OSX.js";
10
10
  import {
11
11
  ControlSizeContext,
12
12
  PopupPortal,
@@ -14,7 +14,7 @@ import {
14
14
  useControllableState,
15
15
  useFloatingPlaceholder,
16
16
  withTitleTooltip
17
- } from "./chunk-H7IAG72O.js";
17
+ } from "./chunk-PUZWLIIJ.js";
18
18
 
19
19
  // src/components/Checkbox.tsx
20
20
  import { createContext, forwardRef, useContext, useEffect, useId, useMemo, useRef } from "react";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Button,
3
3
  TextArea
4
- } from "./chunk-JZWTTSOZ.js";
4
+ } from "./chunk-SJFT5OSX.js";
5
5
  import {
6
6
  withTitleTooltip
7
- } from "./chunk-H7IAG72O.js";
7
+ } from "./chunk-PUZWLIIJ.js";
8
8
 
9
9
  // src/components/ChartWhirlingLoading.tsx
10
10
  import { useEffect, useState } from "react";
package/dist/core.cjs CHANGED
@@ -182,10 +182,18 @@ function installTitleTooltips(doc) {
182
182
  let root;
183
183
  let observer;
184
184
  let tooltipId = "";
185
+ const canShow = (element) => {
186
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
187
+ return [element, ...element.querySelectorAll("*")].some((node) => {
188
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
189
+ const style = doc.defaultView?.getComputedStyle(node);
190
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
191
+ });
192
+ };
185
193
  const candidate = (target) => {
186
194
  if (!(target instanceof Element)) return null;
187
195
  const element = target.closest("[data-sia-title]");
188
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
196
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
189
197
  };
190
198
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
191
199
  const hide = () => {
@@ -203,7 +211,7 @@ function installTitleTooltips(doc) {
203
211
  };
204
212
  const render = () => {
205
213
  const text = active?.getAttribute("data-sia-title");
206
- if (!active?.isConnected || !text) {
214
+ if (!active?.isConnected || !text || !canShow(active)) {
207
215
  hide();
208
216
  return;
209
217
  }
package/dist/core.js CHANGED
@@ -10,20 +10,20 @@ import {
10
10
  Typography,
11
11
  Upload,
12
12
  message
13
- } from "./chunk-ZNJK3IKA.js";
13
+ } from "./chunk-BCOFQJ76.js";
14
14
  import {
15
15
  Select
16
- } from "./chunk-WXERMWTW.js";
16
+ } from "./chunk-V4GGPMKS.js";
17
17
  import {
18
18
  Icon,
19
19
  Input,
20
20
  Modal,
21
21
  Segmented
22
- } from "./chunk-XHLIIDD2.js";
22
+ } from "./chunk-CLBWJEID.js";
23
23
  import {
24
24
  Button
25
- } from "./chunk-JZWTTSOZ.js";
26
- import "./chunk-H7IAG72O.js";
25
+ } from "./chunk-SJFT5OSX.js";
26
+ import "./chunk-PUZWLIIJ.js";
27
27
  export {
28
28
  Breadcrumb,
29
29
  Button,
package/dist/index.cjs CHANGED
@@ -331,10 +331,18 @@ function installTitleTooltips(doc) {
331
331
  let root;
332
332
  let observer;
333
333
  let tooltipId = "";
334
+ const canShow = (element) => {
335
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
336
+ return [element, ...element.querySelectorAll("*")].some((node) => {
337
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
338
+ const style = doc.defaultView?.getComputedStyle(node);
339
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
340
+ });
341
+ };
334
342
  const candidate = (target) => {
335
343
  if (!(target instanceof Element)) return null;
336
344
  const element = target.closest("[data-sia-title]");
337
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
345
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
338
346
  };
339
347
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
340
348
  const hide = () => {
@@ -352,7 +360,7 @@ function installTitleTooltips(doc) {
352
360
  };
353
361
  const render = () => {
354
362
  const text = active?.getAttribute("data-sia-title");
355
- if (!active?.isConnected || !text) {
363
+ if (!active?.isConnected || !text || !canShow(active)) {
356
364
  hide();
357
365
  return;
358
366
  }
@@ -12575,6 +12583,22 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
12575
12583
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("canvas", { ref: canvasRef, "aria-hidden": "true", className: "sia-table__canvas-layer" });
12576
12584
  }
12577
12585
 
12586
+ // src/components/Table/rowIdentity.ts
12587
+ function createRowIdentity() {
12588
+ const keys = /* @__PURE__ */ new WeakMap();
12589
+ let sequence = 0;
12590
+ return (record, index, rowKey) => {
12591
+ const explicit = typeof rowKey === "function" ? rowKey(record, index) : rowKey == null ? void 0 : record[rowKey];
12592
+ if (typeof explicit === "string" || typeof explicit === "bigint" || typeof explicit === "number" && Number.isFinite(explicit)) return explicit;
12593
+ let key = keys.get(record);
12594
+ if (key === void 0) {
12595
+ key = `__sia_internal_row_${++sequence}`;
12596
+ keys.set(record, key);
12597
+ }
12598
+ return key;
12599
+ };
12600
+ }
12601
+
12578
12602
  // src/components/Table/Table.tsx
12579
12603
  var import_react53 = require("react");
12580
12604
 
@@ -15261,7 +15285,7 @@ function TableInner(props, ref) {
15261
15285
  const {
15262
15286
  dataSource = EMPTY_DATA,
15263
15287
  columns: baseColumns = EMPTY_COLUMNS,
15264
- rowKey = "id",
15288
+ rowKey,
15265
15289
  plugins: providedPlugins = EMPTY_PLUGINS,
15266
15290
  loading = false,
15267
15291
  emptyText = "\u6682\u65E0\u6570\u636E",
@@ -15304,7 +15328,8 @@ function TableInner(props, ref) {
15304
15328
  const [viewportHeight, setViewportHeight] = (0, import_react53.useState)(420);
15305
15329
  const [viewportWidth, setViewportWidth] = (0, import_react53.useState)(0);
15306
15330
  const [autoColumnWidths, setAutoColumnWidths] = (0, import_react53.useState)({});
15307
- const getRowKey = (0, import_react53.useCallback)((record, index) => typeof rowKey === "function" ? rowKey(record, index) : record[String(rowKey)] ?? index, [rowKey]);
15331
+ const [resolveRowIdentity] = (0, import_react53.useState)(createRowIdentity);
15332
+ const getRowKey = (0, import_react53.useCallback)((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
15308
15333
  const builtInResizePlugin = (0, import_react53.useMemo)(() => createResizePlugin(), []);
15309
15334
  const builtInHighlightPlugin = (0, import_react53.useMemo)(() => createHighlightPlugin(), []);
15310
15335
  const builtInCellSelectionPlugin = (0, import_react53.useMemo)(() => createCellSelectionPlugin(), []);
@@ -15677,7 +15702,7 @@ function TableInner(props, ref) {
15677
15702
  function renderHeaderContent(column, content) {
15678
15703
  const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
15679
15704
  return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "sia-table__header-label", children: [
15680
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "sia-table__header-label-content", ...withTitleTooltip({ title }), children: content }),
15705
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
15681
15706
  column.description != null && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Icon, { name: "info", size: 14 }) }) })
15682
15707
  ] });
15683
15708
  }
package/dist/index.d.cts CHANGED
@@ -1900,7 +1900,7 @@ interface TableColumn<T = Record<string, unknown>> {
1900
1900
  code?: string;
1901
1901
  /** 名称或字段标识。 */
1902
1902
  name?: string;
1903
- /** 列头内容,可传入文本或 React 节点;默认单行显示,超宽省略,并通过框架 title 提示展示完整文本。节点无法提取文本时使用 name 或 key。 */
1903
+ /** 列头内容,可传入文本或 React 节点;默认单行显示,仅文字实际超宽省略时通过框架 title 提示展示完整文本,完整显示时不提示。节点无法提取文本时使用 name 或 key。 */
1904
1904
  title?: ReactNode;
1905
1905
  /** 补充说明内容。 */
1906
1906
  description?: ReactNode;
@@ -1924,7 +1924,7 @@ interface TableColumn<T = Record<string, unknown>> {
1924
1924
  hidden?: boolean;
1925
1925
  /** 数据单元格默认单行显示并省略溢出内容(含 Space 标签组);设为 false 允许多行,不影响列头始终单行省略。 */
1926
1926
  ellipsis?: boolean;
1927
- /** 数据单元格是否使用 Sia Tooltip 显示完整文本;默认 false,不生成浏览器原生 title。列头始终提供完整标题提示,不受此属性影响。 */
1927
+ /** 数据单元格是否使用 Sia Tooltip 显示完整文本;默认 false,不生成浏览器原生 title。列头仅在文字实际省略时提示完整标题,不受此属性影响。 */
1928
1928
  showTitle?: boolean;
1929
1929
  /** 是否允许该列排序;配合排序插件显示按钮,依次切换升序、降序、未排序,当前排序方向以高亮单箭头显示。 */
1930
1930
  sortable?: boolean;
@@ -2109,7 +2109,7 @@ interface TableProps<T extends Record<string, unknown> = Record<string, unknown>
2109
2109
  dataSource?: readonly T[];
2110
2110
  /** 表格列定义;支持 children 构建分组表头。 */
2111
2111
  columns?: readonly TableColumn<T>[];
2112
- /** 行唯一键字段或计算函数 */
2112
+ /** 行唯一键字段或计算函数,显式提供的值应唯一。未设置、字段不存在或值为 null/undefined 时按数据对象生成内部唯一键,不读取首列或默认 id。同一对象在排序、筛选后保留内部键;重新请求得到的新对象会生成新键,跨请求保留选择须显式设置业务主键。 */
2113
2113
  rowKey?: keyof T | string | ((record: T, index: number) => TableKey);
2114
2114
  /** 默认启用行悬停高亮;传入 createHighlightPlugin({ row: false }) 可关闭。 */
2115
2115
  plugins?: readonly AnyTablePlugin<T>[];
package/dist/index.d.ts CHANGED
@@ -1900,7 +1900,7 @@ interface TableColumn<T = Record<string, unknown>> {
1900
1900
  code?: string;
1901
1901
  /** 名称或字段标识。 */
1902
1902
  name?: string;
1903
- /** 列头内容,可传入文本或 React 节点;默认单行显示,超宽省略,并通过框架 title 提示展示完整文本。节点无法提取文本时使用 name 或 key。 */
1903
+ /** 列头内容,可传入文本或 React 节点;默认单行显示,仅文字实际超宽省略时通过框架 title 提示展示完整文本,完整显示时不提示。节点无法提取文本时使用 name 或 key。 */
1904
1904
  title?: ReactNode;
1905
1905
  /** 补充说明内容。 */
1906
1906
  description?: ReactNode;
@@ -1924,7 +1924,7 @@ interface TableColumn<T = Record<string, unknown>> {
1924
1924
  hidden?: boolean;
1925
1925
  /** 数据单元格默认单行显示并省略溢出内容(含 Space 标签组);设为 false 允许多行,不影响列头始终单行省略。 */
1926
1926
  ellipsis?: boolean;
1927
- /** 数据单元格是否使用 Sia Tooltip 显示完整文本;默认 false,不生成浏览器原生 title。列头始终提供完整标题提示,不受此属性影响。 */
1927
+ /** 数据单元格是否使用 Sia Tooltip 显示完整文本;默认 false,不生成浏览器原生 title。列头仅在文字实际省略时提示完整标题,不受此属性影响。 */
1928
1928
  showTitle?: boolean;
1929
1929
  /** 是否允许该列排序;配合排序插件显示按钮,依次切换升序、降序、未排序,当前排序方向以高亮单箭头显示。 */
1930
1930
  sortable?: boolean;
@@ -2109,7 +2109,7 @@ interface TableProps<T extends Record<string, unknown> = Record<string, unknown>
2109
2109
  dataSource?: readonly T[];
2110
2110
  /** 表格列定义;支持 children 构建分组表头。 */
2111
2111
  columns?: readonly TableColumn<T>[];
2112
- /** 行唯一键字段或计算函数 */
2112
+ /** 行唯一键字段或计算函数,显式提供的值应唯一。未设置、字段不存在或值为 null/undefined 时按数据对象生成内部唯一键,不读取首列或默认 id。同一对象在排序、筛选后保留内部键;重新请求得到的新对象会生成新键,跨请求保留选择须显式设置业务主键。 */
2113
2113
  rowKey?: keyof T | string | ((record: T, index: number) => TableKey);
2114
2114
  /** 默认启用行悬停高亮;传入 createHighlightPlugin({ row: false }) 可关闭。 */
2115
2115
  plugins?: readonly AnyTablePlugin<T>[];
package/dist/index.js CHANGED
@@ -56,7 +56,7 @@ import {
56
56
  smoothSvgPath,
57
57
  svgArcPath,
58
58
  transferCompositeValue
59
- } from "./chunk-BDS42FR3.js";
59
+ } from "./chunk-ZHQ7PCCF.js";
60
60
  import {
61
61
  Badge,
62
62
  Breadcrumb,
@@ -80,19 +80,19 @@ import {
80
80
  Watermark,
81
81
  message,
82
82
  notification
83
- } from "./chunk-ZNJK3IKA.js";
83
+ } from "./chunk-BCOFQJ76.js";
84
84
  import {
85
85
  MarkdownEditor
86
- } from "./chunk-JZPAIZYK.js";
86
+ } from "./chunk-TUXNOSCT.js";
87
87
  import {
88
88
  RichTextContent,
89
89
  RichTextEditor
90
- } from "./chunk-GODBVCIQ.js";
90
+ } from "./chunk-SBNHEETW.js";
91
91
  import {
92
92
  DatePicker,
93
93
  SelectDateRange,
94
94
  TimePanel
95
- } from "./chunk-Y4Y2NVBM.js";
95
+ } from "./chunk-N6DVNCZT.js";
96
96
  import {
97
97
  Checkbox,
98
98
  FloatingScrollbarProvider,
@@ -104,7 +104,7 @@ import {
104
104
  Tooltip,
105
105
  Tree,
106
106
  useScrollbarProximity
107
- } from "./chunk-WXERMWTW.js";
107
+ } from "./chunk-V4GGPMKS.js";
108
108
  import {
109
109
  Dropdown,
110
110
  FILLED_ICON_NAMES,
@@ -117,11 +117,11 @@ import {
117
117
  Segmented,
118
118
  Steps,
119
119
  useOverlayLifecycle
120
- } from "./chunk-XHLIIDD2.js";
120
+ } from "./chunk-CLBWJEID.js";
121
121
  import {
122
122
  Button,
123
123
  TextArea
124
- } from "./chunk-JZWTTSOZ.js";
124
+ } from "./chunk-SJFT5OSX.js";
125
125
  import {
126
126
  ControlSizeContext,
127
127
  PlaceholderModeContext,
@@ -131,7 +131,7 @@ import {
131
131
  useFloatingPlaceholder,
132
132
  usePlaceholderMode,
133
133
  withTitleTooltip
134
- } from "./chunk-H7IAG72O.js";
134
+ } from "./chunk-PUZWLIIJ.js";
135
135
 
136
136
  // src/components/Alert.tsx
137
137
  import { useState } from "react";
@@ -5097,6 +5097,22 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
5097
5097
  return /* @__PURE__ */ jsx21("canvas", { ref: canvasRef, "aria-hidden": "true", className: "sia-table__canvas-layer" });
5098
5098
  }
5099
5099
 
5100
+ // src/components/Table/rowIdentity.ts
5101
+ function createRowIdentity() {
5102
+ const keys = /* @__PURE__ */ new WeakMap();
5103
+ let sequence = 0;
5104
+ return (record, index, rowKey) => {
5105
+ const explicit = typeof rowKey === "function" ? rowKey(record, index) : rowKey == null ? void 0 : record[rowKey];
5106
+ if (typeof explicit === "string" || typeof explicit === "bigint" || typeof explicit === "number" && Number.isFinite(explicit)) return explicit;
5107
+ let key = keys.get(record);
5108
+ if (key === void 0) {
5109
+ key = `__sia_internal_row_${++sequence}`;
5110
+ keys.set(record, key);
5111
+ }
5112
+ return key;
5113
+ };
5114
+ }
5115
+
5100
5116
  // src/components/Table/Table.tsx
5101
5117
  import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect12, useImperativeHandle, useMemo as useMemo9, useRef as useRef16, useState as useState19 } from "react";
5102
5118
 
@@ -7783,7 +7799,7 @@ function TableInner(props, ref) {
7783
7799
  const {
7784
7800
  dataSource = EMPTY_DATA,
7785
7801
  columns: baseColumns = EMPTY_COLUMNS,
7786
- rowKey = "id",
7802
+ rowKey,
7787
7803
  plugins: providedPlugins = EMPTY_PLUGINS,
7788
7804
  loading = false,
7789
7805
  emptyText = "\u6682\u65E0\u6570\u636E",
@@ -7826,7 +7842,8 @@ function TableInner(props, ref) {
7826
7842
  const [viewportHeight, setViewportHeight] = useState19(420);
7827
7843
  const [viewportWidth, setViewportWidth] = useState19(0);
7828
7844
  const [autoColumnWidths, setAutoColumnWidths] = useState19({});
7829
- const getRowKey = useCallback2((record, index) => typeof rowKey === "function" ? rowKey(record, index) : record[String(rowKey)] ?? index, [rowKey]);
7845
+ const [resolveRowIdentity] = useState19(createRowIdentity);
7846
+ const getRowKey = useCallback2((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
7830
7847
  const builtInResizePlugin = useMemo9(() => createResizePlugin(), []);
7831
7848
  const builtInHighlightPlugin = useMemo9(() => createHighlightPlugin(), []);
7832
7849
  const builtInCellSelectionPlugin = useMemo9(() => createCellSelectionPlugin(), []);
@@ -8199,7 +8216,7 @@ function TableInner(props, ref) {
8199
8216
  function renderHeaderContent(column, content) {
8200
8217
  const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
8201
8218
  return /* @__PURE__ */ jsxs21("span", { className: "sia-table__header-label", children: [
8202
- /* @__PURE__ */ jsx23("span", { className: "sia-table__header-label-content", ...withTitleTooltip({ title }), children: content }),
8219
+ /* @__PURE__ */ jsx23("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
8203
8220
  column.description != null && /* @__PURE__ */ jsx23(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx23("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx23(Icon, { name: "info", size: 14 }) }) })
8204
8221
  ] });
8205
8222
  }
@@ -173,10 +173,18 @@ function installTitleTooltips(doc) {
173
173
  let root;
174
174
  let observer;
175
175
  let tooltipId = "";
176
+ const canShow = (element) => {
177
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
178
+ return [element, ...element.querySelectorAll("*")].some((node) => {
179
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
180
+ const style = doc.defaultView?.getComputedStyle(node);
181
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
182
+ });
183
+ };
176
184
  const candidate = (target) => {
177
185
  if (!(target instanceof Element)) return null;
178
186
  const element = target.closest("[data-sia-title]");
179
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
187
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
180
188
  };
181
189
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
182
190
  const hide = () => {
@@ -194,7 +202,7 @@ function installTitleTooltips(doc) {
194
202
  };
195
203
  const render = () => {
196
204
  const text = active?.getAttribute("data-sia-title");
197
- if (!active?.isConnected || !text) {
205
+ if (!active?.isConnected || !text || !canShow(active)) {
198
206
  hide();
199
207
  return;
200
208
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MarkdownEditor
3
- } from "./chunk-JZPAIZYK.js";
4
- import "./chunk-H7IAG72O.js";
3
+ } from "./chunk-TUXNOSCT.js";
4
+ import "./chunk-PUZWLIIJ.js";
5
5
  export {
6
6
  MarkdownEditor
7
7
  };
@@ -174,10 +174,18 @@ function installTitleTooltips(doc) {
174
174
  let root;
175
175
  let observer;
176
176
  let tooltipId = "";
177
+ const canShow = (element) => {
178
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
179
+ return [element, ...element.querySelectorAll("*")].some((node) => {
180
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
181
+ const style = doc.defaultView?.getComputedStyle(node);
182
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
183
+ });
184
+ };
177
185
  const candidate = (target) => {
178
186
  if (!(target instanceof Element)) return null;
179
187
  const element = target.closest("[data-sia-title]");
180
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
188
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
181
189
  };
182
190
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
183
191
  const hide = () => {
@@ -195,7 +203,7 @@ function installTitleTooltips(doc) {
195
203
  };
196
204
  const render = () => {
197
205
  const text = active?.getAttribute("data-sia-title");
198
- if (!active?.isConnected || !text) {
206
+ if (!active?.isConnected || !text || !canShow(active)) {
199
207
  hide();
200
208
  return;
201
209
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  RichTextContent,
3
3
  RichTextEditor
4
- } from "./chunk-GODBVCIQ.js";
5
- import "./chunk-XHLIIDD2.js";
6
- import "./chunk-JZWTTSOZ.js";
7
- import "./chunk-H7IAG72O.js";
4
+ } from "./chunk-SBNHEETW.js";
5
+ import "./chunk-CLBWJEID.js";
6
+ import "./chunk-SJFT5OSX.js";
7
+ import "./chunk-PUZWLIIJ.js";
8
8
  export {
9
9
  RichTextContent,
10
10
  RichTextEditor
@@ -163,10 +163,18 @@ function installTitleTooltips(doc) {
163
163
  let root;
164
164
  let observer;
165
165
  let tooltipId = "";
166
+ const canShow = (element) => {
167
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
168
+ return [element, ...element.querySelectorAll("*")].some((node) => {
169
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
170
+ const style = doc.defaultView?.getComputedStyle(node);
171
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
172
+ });
173
+ };
166
174
  const candidate = (target) => {
167
175
  if (!(target instanceof Element)) return null;
168
176
  const element = target.closest("[data-sia-title]");
169
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
177
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
170
178
  };
171
179
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
172
180
  const hide = () => {
@@ -184,7 +192,7 @@ function installTitleTooltips(doc) {
184
192
  };
185
193
  const render = () => {
186
194
  const text = active?.getAttribute("data-sia-title");
187
- if (!active?.isConnected || !text) {
195
+ if (!active?.isConnected || !text || !canShow(active)) {
188
196
  hide();
189
197
  return;
190
198
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  SelectDateRange
3
- } from "./chunk-Y4Y2NVBM.js";
4
- import "./chunk-WXERMWTW.js";
5
- import "./chunk-XHLIIDD2.js";
6
- import "./chunk-JZWTTSOZ.js";
7
- import "./chunk-H7IAG72O.js";
3
+ } from "./chunk-N6DVNCZT.js";
4
+ import "./chunk-V4GGPMKS.js";
5
+ import "./chunk-CLBWJEID.js";
6
+ import "./chunk-SJFT5OSX.js";
7
+ import "./chunk-PUZWLIIJ.js";
8
8
  export {
9
9
  SelectDateRange
10
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.81",
3
+ "version": "0.1.83",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",