关联勾选左侧默认值

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

View File

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

View File

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