File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed
apps/kitchen-sink/src/ensemble/screens
packages/runtime/src/widgets/DataGrid Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @ensembleui/react-kitchen-sink " : patch
3+ " @ensembleui/react-runtime " : patch
4+ ---
5+
6+ feat: add selection column width property to DataGrid
Original file line number Diff line number Diff line change @@ -290,6 +290,7 @@ View:
290290 executeCode : |
291291 console.log("data", selectedRows, selectedRowKeys);
292292 allowSelection : ${1===1}
293+ selectionColWidth : ${20+30}
293294 selectionType : ' ${1===10 ? "checkbox" : "radio"}'
294295 allowResizableColumns : true
295296 defaultSelectedRowKeys : ["2"]
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ export interface DataGridScrollable {
9191export type GridProps = {
9292 allowSelection ?: boolean ;
9393 selectionType ?: "checkbox" | "radio" ;
94+ selectionColWidth ?: number ;
9495 allowResizableColumns ?: boolean ;
9596 onRowsSelected ?: EnsembleAction ;
9697 defaultSelectedRowKeys ?: string [ ] ;
@@ -178,6 +179,7 @@ export const DataGrid: React.FC<GridProps> = (props) => {
178179 const [ selectionType , setSelectionType ] = useState < "checkbox" | "radio" > (
179180 props . selectionType ? props . selectionType : "checkbox" ,
180181 ) ;
182+ const selectionColWidth = props . selectionColWidth || 50 ;
181183 const containerRef = useRef < HTMLDivElement > ( null ) ;
182184 const { namedData } = useTemplateData ( { ...itemTemplate } ) ;
183185 const components = {
@@ -314,6 +316,7 @@ export const DataGrid: React.FC<GridProps> = (props) => {
314316 rowsSelected,
315317 selectionType,
316318 allowSelection,
319+ selectionColWidth,
317320 pageSize,
318321 curPage,
319322 widgetName,
@@ -474,6 +477,7 @@ export const DataGrid: React.FC<GridProps> = (props) => {
474477 rowSelection = {
475478 allowSelection
476479 ? {
480+ columnWidth : values ?. selectionColWidth ,
477481 type : selectionType ,
478482 onChange : ( selectedRowKeys , selectedRows ) : void => {
479483 setRowsKey ( selectedRowKeys ) ;
You can’t perform that action at this time.
0 commit comments