Skip to content

Commit

Permalink
feat(thema): checkbox supports select all (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
mengshang918 committed May 11, 2022
1 parent e9f700f commit b80e38a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions packages/drip-form-theme-antd/src/CheckboxField/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ const config = {
type: 'switch',
},
},
{
fieldKey: 'needCheckAll',
type: 'boolean',
title: '支持全选',
default: false,
ui: {
type: 'switch',
},
},
{
fieldKey: 'options',
type: 'array',
Expand Down
4 changes: 3 additions & 1 deletion packages/drip-form-theme-antd/src/CheckboxField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ const CheckboxField = ({
<div className="check-all-wrapper">
<Checkbox
indeterminate={
fieldData.length !== 0 && fieldData.length < options.length
fieldData &&
fieldData.length !== 0 &&
fieldData.length < options.length
}
onChange={_onChange.bind(CheckboxField, allCheckboxValue)}
checked={isAllChecked}
Expand Down

0 comments on commit b80e38a

Please sign in to comment.