Skip to content

Commit

Permalink
feat: 🎸 table add search props
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingyun2010 committed Jan 10, 2022
1 parent 732b015 commit 74ec530
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions components/table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export interface TableSearchProps extends FormProps {
*/
allowTrim?: boolean
addonButtons?: React.ReactNode
disabledSearchBtn?: boolean
disabledSearchBtnAddonAfter?: React.ReactNode // 隐藏搜索按钮之后,替代组件
}

interface TablePaginationName {
Expand Down Expand Up @@ -311,6 +313,8 @@ function Table<RecordType extends object>(
}
const { initialCount = 3, items, addonButtons, ...searchProps } = tableSearchProps

const { disabledSearchBtn, disabledSearchBtnAddonAfter } = searchProps

return (
<>
<Form
Expand Down Expand Up @@ -342,9 +346,13 @@ function Table<RecordType extends object>(
<Form.Item noStyle>
<Row justify="end">
<Space>
<AsyncButton onClick={onClickSearch} type="primary" icon={<SearchOutlined />}>
搜索
</AsyncButton>
{disabledSearchBtn ? (
disabledSearchBtnAddonAfter
) : (
<AsyncButton onClick={onClickSearch} type="primary" icon={<SearchOutlined />}>
搜索
</AsyncButton>
)}
<Button htmlType="reset">重置</Button>
{addonButtons}
{items.length > initialCount && (
Expand Down

0 comments on commit 74ec530

Please sign in to comment.