This commit is contained in:
2026-05-25 17:08:18 +08:00
parent df501f6151
commit f1259b71b5
9178 changed files with 1626125 additions and 0 deletions
@@ -0,0 +1,47 @@
import * as React from 'react';
import { clsx } from 'clsx';
export function renderExpandIcon({
prefixCls,
record,
onExpand,
expanded,
expandable
}) {
const expandClassName = `${prefixCls}-row-expand-icon`;
if (!expandable) {
return /*#__PURE__*/React.createElement("span", {
className: clsx(expandClassName, `${prefixCls}-row-spaced`)
});
}
const onClick = event => {
onExpand(record, event);
event.stopPropagation();
};
return /*#__PURE__*/React.createElement("span", {
className: clsx(expandClassName, {
[`${prefixCls}-row-expanded`]: expanded,
[`${prefixCls}-row-collapsed`]: !expanded
}),
onClick: onClick
});
}
export function findAllChildrenKeys(data, getRowKey, childrenColumnName) {
const keys = [];
function dig(list) {
(list || []).forEach((item, index) => {
keys.push(getRowKey(item, index));
dig(item[childrenColumnName]);
});
}
dig(data);
return keys;
}
export function computedExpandedClassName(cls, record, index, indent) {
if (typeof cls === 'string') {
return cls;
}
if (typeof cls === 'function') {
return cls(record, index, indent);
}
return '';
}