@antv/s2-react
Version:
use S2 with react
25 lines • 1.16 kB
JavaScript
import { __rest } from "tslib";
import { customMerge } from '@antv/s2';
import React from 'react';
import { BaseSheet } from '../base-sheet';
import { GridAnalysisSheetDataCell } from './custom-cell';
import { GridAnalysisTheme } from './theme';
export const GridAnalysisSheet = React.memo((props) => {
const { options: defaultOptions, themeCfg } = props, restProps = __rest(props, ["options", "themeCfg"]);
const s2Options = React.useMemo(() => {
const options = {
dataCell: (viewMeta, spreadsheet) => new GridAnalysisSheetDataCell(viewMeta, spreadsheet),
showDefaultHeaderActionIcon: false,
style: {
colCell: {
hideValue: true,
},
},
};
return customMerge(defaultOptions, options);
}, [defaultOptions]);
const s2ThemeCfg = React.useMemo(() => customMerge(themeCfg, { theme: GridAnalysisTheme }), [themeCfg]);
return (React.createElement(BaseSheet, Object.assign({ options: s2Options, themeCfg: s2ThemeCfg }, restProps)));
});
GridAnalysisSheet.displayName = 'GridAnalysisSheet';
//# sourceMappingURL=index.js.map