@uiw/react-table
Version:
Table component
27 lines (26 loc) • 609 B
JavaScript
import React, { useState } from 'react';
import { jsx as _jsx } from "react/jsx-runtime";
/**
* 可展开配置
*/
export default function ExpandableComponent(_ref) {
var {
defaultExpand,
onClick: _onClick,
expandIcon
} = _ref;
var [expand, setExpand] = useState(defaultExpand);
return /*#__PURE__*/_jsx("div", {
style: {
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
},
onClick: () => {
setExpand(!expand);
_onClick(expand);
// record: T, index: number, expanded: boolean
},
children: expandIcon(expand)
});
}