feat: checkboxs允许配置全选/不选文案 (#7408)

* perf: checkboxs允许配置全选/不选文案

* perf: checkboxs允许配置全选/不选文案

---------

Co-authored-by: yanglu19 <yanglu19@baidu.com>
This commit is contained in:
Dora 2023-07-10 10:36:09 +08:00 committed by GitHub
parent c625db7b44
commit 5638927871
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -141,6 +141,7 @@ export class CheckboxesControlPlugin extends BasePlugin {
if (!value) { if (!value) {
// 可全选关闭时,默认全选也需联动关闭 // 可全选关闭时,默认全选也需联动关闭
form.setValueByName('defaultCheckAll', false); form.setValueByName('defaultCheckAll', false);
form.setValueByName('checkAllText', undefined);
} }
} }
}), }),
@ -153,7 +154,12 @@ export class CheckboxesControlPlugin extends BasePlugin {
label: '默认全选', label: '默认全选',
name: 'defaultCheckAll', name: 'defaultCheckAll',
value: false value: false
}) }),
{
type: 'input-text',
label: '全选文本',
name: 'checkAllText'
}
] ]
} }
], ],

View File

@ -30,6 +30,10 @@ export interface CheckboxesControlSchema extends FormOptionsSchema {
*/ */
defaultCheckAll?: boolean; defaultCheckAll?: boolean;
/**
* /
*/
checkAllText?: string;
/** /**
* *
*/ */
@ -337,6 +341,7 @@ export default class CheckboxesControl extends React.Component<
onToggle, onToggle,
onToggleAll, onToggleAll,
checkAll, checkAll,
checkAllText,
classnames: cx, classnames: cx,
itemClassName, itemClassName,
labelClassName, labelClassName,
@ -369,7 +374,7 @@ export default class CheckboxesControl extends React.Component<
inline={inline} inline={inline}
labelClassName={labelClassName} labelClassName={labelClassName}
> >
{__('Checkboxes.selectAll')} {checkAllText ?? __('Checkboxes.selectAll')}
</Checkbox> </Checkbox>
); );
} }