You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
41 lines
1.2 KiB
|
2 years ago
|
import '../../../../hooks/index.mjs';
|
||
|
|
import { getFixedColumnsClass, getFixedColumnOffset, ensurePosition } from '../util.mjs';
|
||
|
|
import useMapState from './mapState-helper.mjs';
|
||
|
|
import { useNamespace } from '../../../../hooks/use-namespace/index.mjs';
|
||
|
|
|
||
|
|
function useStyle(props) {
|
||
|
|
const { columns } = useMapState();
|
||
|
|
const ns = useNamespace("table");
|
||
|
|
const getCellClasses = (columns2, cellIndex) => {
|
||
|
|
const column = columns2[cellIndex];
|
||
|
|
const classes = [
|
||
|
|
ns.e("cell"),
|
||
|
|
column.id,
|
||
|
|
column.align,
|
||
|
|
column.labelClassName,
|
||
|
|
...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
|
||
|
|
];
|
||
|
|
if (column.className) {
|
||
|
|
classes.push(column.className);
|
||
|
|
}
|
||
|
|
if (!column.children) {
|
||
|
|
classes.push(ns.is("leaf"));
|
||
|
|
}
|
||
|
|
return classes;
|
||
|
|
};
|
||
|
|
const getCellStyles = (column, cellIndex) => {
|
||
|
|
const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
|
||
|
|
ensurePosition(fixedStyle, "left");
|
||
|
|
ensurePosition(fixedStyle, "right");
|
||
|
|
return fixedStyle;
|
||
|
|
};
|
||
|
|
return {
|
||
|
|
getCellClasses,
|
||
|
|
getCellStyles,
|
||
|
|
columns
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
export { useStyle as default };
|
||
|
|
//# sourceMappingURL=style-helper.mjs.map
|