From 6a1e4fa595923d19aa7689c9bc0ea9f20a11b8f2 Mon Sep 17 00:00:00 2001 From: Ma ke <33743617+jiatianqi@users.noreply.github.com> Date: Thu, 19 May 2022 15:51:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dselect=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=9C=A8=E9=9D=9E=E5=8F=AF=E5=A4=9A=E9=80=89=E6=83=85=E5=86=B5?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E9=85=8D=E7=BD=AEcheckAll:true=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E5=80=BC=E7=9A=84=E9=97=AE=E9=A2=98=20(#4393)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ”jiatianqi“ <”jiatianqi@baidu.com“> --- src/components/Select.tsx | 6 ++---- src/renderers/Form/Select.tsx | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/components/Select.tsx b/src/components/Select.tsx index 83ce248c0..60aff01b4 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -1124,10 +1124,8 @@ export class Select extends React.Component { isOpen={this.state.isOpen} inputValue={inputValue} onChange={ - /*展示 Checkbox 的时候,会出发多次 onChange 原因待查*/ multiple || - checkAll - ? noop - : this.handleChange + /*展示 Checkbox 的时候,会出发多次 onChange 原因待查*/ + multiple ? noop : this.handleChange } onStateChange={this.handleStateChange} itemToString={item => (item ? `${item[labelField]}` : '')} diff --git a/src/renderers/Form/Select.tsx b/src/renderers/Form/Select.tsx index 98ac8be29..3e71fc282 100644 --- a/src/renderers/Form/Select.tsx +++ b/src/renderers/Form/Select.tsx @@ -85,6 +85,18 @@ export interface SelectControlSchema extends FormOptionsControl { * 搜索 API */ searchApi?: SchemaApi; + /** + * 可多选条件下,是否可全选 + */ + checkAll?: boolean; + /** + * 可多选条件下,是否默认全选中所有值 + */ + defaultCheckAll?: boolean; + /** + * 可多选条件下,全选项文案,默认 ”全选“ + */ + checkAllLabel?: string; } export interface SelectProps extends OptionsControlProps { @@ -412,9 +424,7 @@ export default class SelectControl extends React.Component { onFocus={(e: any) => this.dispatchEvent('focus', e)} onAdd={() => this.dispatchEvent('add')} onEdit={(item: any) => this.dispatchEvent('edit', item)} - onDelete={(item: any) => - this.dispatchEvent('delete', item) - } + onDelete={(item: any) => this.dispatchEvent('delete', item)} loading={loading} noResultsText={noResultsText} renderMenu={menuTpl ? this.renderMenu : undefined}