From 53212ee47de658398daa8273393778e3d6030845 Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 1 Jan 2021 17:42:24 +0800 Subject: [PATCH] fix: default checkbox for row selection type --- packages/app/src/components/views/SimpleTable.tsx | 2 ++ packages/app/src/components/views/Table.tsx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/app/src/components/views/SimpleTable.tsx b/packages/app/src/components/views/SimpleTable.tsx index 9f47aa518..7dd54432c 100644 --- a/packages/app/src/components/views/SimpleTable.tsx +++ b/packages/app/src/components/views/SimpleTable.tsx @@ -29,6 +29,7 @@ export function SimpleTable(props: SimpleTableProps) { associatedKey, isFieldComponent, onSelected, + multiple = true, selectedRowKeys: srk, } = props; const { rowKey = 'id', name: viewName, actionDefaultParams = {}, fields = [], rowViewName, actions = [], paginated = true, defaultPerPage = 10 } = schema; @@ -78,6 +79,7 @@ export function SimpleTable(props: SimpleTableProps) { const tableProps: any = {}; if (actions.length) { tableProps.rowSelection = { + type: multiple ? 'checkbox' : 'radio', selectedRowKeys, onChange, } diff --git a/packages/app/src/components/views/Table.tsx b/packages/app/src/components/views/Table.tsx index 505700a2c..f48f0ead5 100644 --- a/packages/app/src/components/views/Table.tsx +++ b/packages/app/src/components/views/Table.tsx @@ -27,7 +27,7 @@ export function Table(props: TableProps) { associatedKey, isFieldComponent, onSelected, - multiple, + multiple = true, selectedRowKeys: srk, } = props; const { name: viewName, fields, actionDefaultParams = {}, defaultTabName, rowKey = 'id', actions = [], paginated = true, defaultPerPage = 10 } = schema;