@seanyeh77/ui 0.51.0 → 0.52.0

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.
@@ -2,7 +2,7 @@
2
2
  import { Button } from "../Button/Button.js";
3
3
  import { SearchField } from "../SearchField/SearchField.js";
4
4
  import { Tabs } from "../Tabs/Tabs.js";
5
- import { format } from "../../format.js";
5
+ import { format, plainMinus } from "../../format.js";
6
6
  import { tr, unitFor } from "../../i18n.js";
7
7
  import { Icon } from "../../icons/Icon.js";
8
8
  import { TOUCH_ONLY, copyText, cssZoom, cx, idPart, monoNums, reduced, resizeObserver, seenOnly, useMedia, useNarrow } from "../../internal/util.js";
@@ -1019,7 +1019,7 @@ function DataTable(p) {
1019
1019
  const [copied, setCopied] = React.useState(false);
1020
1020
  const copiedTimer = React.useRef(void 0);
1021
1021
  React.useEffect(() => () => clearTimeout(copiedTimer.current), []);
1022
- const doCopy = () => copyText(copyMarkdown()).then(() => {
1022
+ const doCopy = () => copyText(plainMinus(copyMarkdown())).then(() => {
1023
1023
  setCopied(true);
1024
1024
  announce(tr("已複製"));
1025
1025
  clearTimeout(copiedTimer.current);
@@ -1499,6 +1499,12 @@ function DataTable(p) {
1499
1499
  ref: rootRef,
1500
1500
  className: cx("ui-dt", search === false && "is-nosearch", selIds.length && "has-sel", hasAct && "has-acts", p.className),
1501
1501
  style: hasAct ? { "--dt-acts-w": (p.actionsWidth ?? actsW ?? 72) + "px" } : void 0,
1502
+ onCopy: (e) => {
1503
+ const text = typeof window !== "undefined" ? window.getSelection()?.toString() ?? "" : "";
1504
+ if (!text.includes("−") || !e.clipboardData) return;
1505
+ e.preventDefault();
1506
+ e.clipboardData.setData("text/plain", plainMinus(text));
1507
+ },
1502
1508
  children: [
1503
1509
  p.caption && search !== false ? /* @__PURE__ */ jsx("div", {
1504
1510
  className: "ui-dt-caption",