关联勾选左侧默认值

This commit is contained in:
2betop 2020-05-29 13:24:32 +08:00
parent ae0a1504cc
commit f7e6dbf2be
3 changed files with 9 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import TreeRadios from './TreeRadios';
export interface AssociatedCheckboxesProps extends CheckboxesProps {
leftOptions: Options;
leftDefaultValue?: any;
leftMode?: 'tree' | 'list';
rightMode?: 'table' | 'list' | 'tree' | 'chained';
columns?: Array<any>;
@ -44,7 +45,9 @@ export class AssociatedCheckboxes extends Checkboxes<
AssociatedCheckboxesProps,
AssociatedCheckboxesState
> {
state: AssociatedCheckboxesState = {};
state: AssociatedCheckboxesState = {
leftValue: this.props.leftDefaultValue
};
@autobind
leftOption2Value(option: Option) {

View File

@ -178,6 +178,7 @@ export class TabsTransfer extends React.Component<TabsTransferProps> {
onDeferLoad={onDeferLoad}
leftMode={option.leftMode}
leftOptions={option.leftOptions}
leftDefaultValue={option.leftDefaultValue}
/>
) : (
<ListCheckboxes

View File

@ -38,6 +38,7 @@ export interface TransferProps extends ThemeProps, CheckboxesProps {
) => JSX.Element;
leftOptions?: Array<Option>;
leftMode?: 'tree' | 'list';
leftDefaultValue?: any;
rightMode?: 'table' | 'list' | 'tree' | 'chained';
// search 相关
@ -320,7 +321,8 @@ export class Transfer extends React.Component<TransferProps, TransferState> {
leftOptions,
leftMode,
rightMode,
cellRender
cellRender,
leftDefaultValue
} = this.props;
return selectMode === 'table' ? (
@ -364,6 +366,7 @@ export class Transfer extends React.Component<TransferProps, TransferState> {
leftOptions={leftOptions || []}
leftMode={leftMode}
rightMode={rightMode}
leftDefaultValue={leftDefaultValue}
/>
) : (
<ListCheckboxes