@canvas-components/react-list-table 0.3.23 → 0.3.25

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/index.js CHANGED
@@ -571,6 +571,11 @@ function ReactTableContextMenuView(props) {
571
571
  key: "auto-fit-all",
572
572
  label: "\u5168\u90E8\u5217",
573
573
  onClick: request.onAutoFitAllColumns
574
+ },
575
+ {
576
+ key: "auto-fit-fill-container",
577
+ label: "\u81EA\u52A8\u94FA\u6EE1\u5BB9\u5668",
578
+ onClick: request.onAutoFitFillContainer
574
579
  }
575
580
  ]
576
581
  }
@@ -3799,6 +3804,14 @@ function ReactTableDangerConfirmView(props) {
3799
3804
  }
3800
3805
  function ReactTableTooltipView(props) {
3801
3806
  const { request } = props;
3807
+ const tooltipRef = useRef(null);
3808
+ useLayoutEffect(() => {
3809
+ const tooltip = tooltipRef.current;
3810
+ if (!tooltip || !request || typeof window === "undefined") return;
3811
+ const width = tooltip.getBoundingClientRect().width;
3812
+ const viewportWidth = window.innerWidth;
3813
+ tooltip.style.left = `${Math.max(8, Math.min(request.x - width / 2, viewportWidth - width - 8))}px`;
3814
+ }, [request]);
3802
3815
  if (!request) {
3803
3816
  return null;
3804
3817
  }
@@ -3812,8 +3825,7 @@ function ReactTableTooltipView(props) {
3812
3825
  position: "fixed",
3813
3826
  left: request.x,
3814
3827
  top: request.y,
3815
- transform: "translate(-50%, 0)",
3816
- maxWidth,
3828
+ maxWidth: request.variant === "resize" ? "calc(100vw - 16px)" : `min(${maxWidth}px, calc(100vw - 16px))`,
3817
3829
  padding: `${paddingBlock}px ${paddingInline}px`,
3818
3830
  borderRadius,
3819
3831
  background: request.variant === "error" ? "#ffffff" : "rgba(17, 24, 39, 0.92)",
@@ -3824,10 +3836,12 @@ function ReactTableTooltipView(props) {
3824
3836
  border: request.variant === "error" ? "1px solid rgba(255, 77, 79, 0.2)" : "none",
3825
3837
  pointerEvents: "none",
3826
3838
  zIndex: 1200,
3827
- whiteSpace: "pre-wrap",
3828
- wordBreak: "break-word"
3839
+ whiteSpace: request.variant === "resize" ? "nowrap" : "pre-wrap",
3840
+ wordBreak: "break-word",
3841
+ overflow: "hidden",
3842
+ textOverflow: request.variant === "resize" ? "ellipsis" : void 0
3829
3843
  };
3830
- return /* @__PURE__ */ jsx("div", { style, children: request.content });
3844
+ return /* @__PURE__ */ jsx("div", { ref: tooltipRef, style, children: request.content });
3831
3845
  }
3832
3846
  function ToolbarIcon(props) {
3833
3847
  const { path, ...svgProps } = props;