import React from "react"; import { DataEditorAll as DataEditor } from "../../data-editor-all.js"; import { BeautifulWrapper, Description, PropName, useMockDataGenerator, defaultProps, } from "../../data-editor/stories/utils.js"; import { SimpleThemeWrapper } from "../../stories/story-utils.js"; export default { title: "Glide-Data-Grid/DataEditor Demos", decorators: [ (Story: React.ComponentType) => ( Columns in the data grid may be set to grow to fill space by setting the{" "} grow prop. }> ), ], }; export const StretchColumnSize: React.VFC = () => { const { cols, getCellContent, onColumnResize } = useMockDataGenerator(5, true, true); const hasResized = React.useRef(new Set()); const columns = React.useMemo(() => { return cols.map((x, i) => ({ ...x, grow: hasResized.current.has(i) ? undefined : (5 + i) / 5 })); }, [cols]); return ( { hasResized.current.add(colIndex); onColumnResize(col, newSizeWithGrow); }} rowMarkers="both" /> ); };