Files
NapCatQQ/.pnpm-store/v3/files/9e/3b9f2064797fa15aceccdb0d351a478f5ba7b67babf9c589142469a19a902ada502f584aacfd3a3e932aadb064efcdb228822a3e8c04d05189e1346ba3b299
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

51 lines
1.9 KiB
Plaintext

"use client";
// src/table-cell.tsx
import { useMemo } from "react";
import { forwardRef } from "@heroui/system";
import { useDOMRef, filterDOMProps } from "@heroui/react-utils";
import { clsx, dataAttr, mergeProps } from "@heroui/shared-utils";
import { useTableCell } from "@react-aria/table";
import { useFocusRing } from "@react-aria/focus";
import { jsx } from "react/jsx-runtime";
var TableCell = forwardRef((props, ref) => {
var _a, _b, _c;
const { as, className, node, rowKey, slots, state, classNames, ...otherProps } = props;
const Component = as || "td";
const shouldFilterDOMProps = typeof Component === "string";
const domRef = useDOMRef(ref);
const { gridCellProps } = useTableCell({ node }, state, domRef);
const tdStyles = clsx(classNames == null ? void 0 : classNames.td, className, (_a = node.props) == null ? void 0 : _a.className);
const { isFocusVisible, focusProps } = useFocusRing();
const isRowSelected = state.selectionManager.isSelected(rowKey);
const cell = useMemo(() => {
const cellType = typeof node.rendered;
return cellType !== "object" && cellType !== "function" ? /* @__PURE__ */ jsx("span", { children: node.rendered }) : node.rendered;
}, [node.rendered]);
const columnProps = ((_b = node.column) == null ? void 0 : _b.props) || {};
return /* @__PURE__ */ jsx(
Component,
{
ref: domRef,
"data-focus-visible": dataAttr(isFocusVisible),
"data-selected": dataAttr(isRowSelected),
...mergeProps(
gridCellProps,
focusProps,
filterDOMProps(node.props, {
enabled: shouldFilterDOMProps
}),
otherProps
),
className: (_c = slots.td) == null ? void 0 : _c.call(slots, { align: columnProps.align, class: tdStyles }),
children: cell
}
);
});
TableCell.displayName = "HeroUI.TableCell";
var table_cell_default = TableCell;
export {
table_cell_default
};