feat:PickerContainer支持隐藏footer&export VariableList and PickerContainer (#4466)

This commit is contained in:
hsm-lv 2022-05-26 23:07:52 +08:00 committed by GitHub
parent 023c61e524
commit d2b097c86a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 8 deletions

View File

@ -11,6 +11,7 @@ import Button from './Button';
export interface PickerContainerProps extends ThemeProps, LocaleProps { export interface PickerContainerProps extends ThemeProps, LocaleProps {
title?: string; title?: string;
showTitle?: boolean; showTitle?: boolean;
showFooter?: boolean;
headerClassName?: string; headerClassName?: string;
children: (props: { children: (props: {
onClick: (e: React.MouseEvent) => void; onClick: (e: React.MouseEvent) => void;
@ -131,7 +132,8 @@ export class PickerContainer extends React.Component<
showTitle, showTitle,
headerClassName, headerClassName,
translate: __, translate: __,
size size,
showFooter
} = this.props; } = this.props;
return ( return (
<> <>
@ -158,15 +160,18 @@ export class PickerContainer extends React.Component<
ref: this.bodyRef, ref: this.bodyRef,
setState: this.updateState, setState: this.updateState,
onClose: this.close, onClose: this.close,
onChange: this.handleChange onChange: this.handleChange,
onConfirm: this.confirm
})} })}
</Modal.Body> </Modal.Body>
<Modal.Footer> {showFooter ?? true ? (
<Button onClick={this.close}>{__('cancel')}</Button> <Modal.Footer>
<Button onClick={this.confirm} level="primary"> <Button onClick={this.close}>{__('cancel')}</Button>
{__('confirm')} <Button onClick={this.confirm} level="primary">
</Button> {__('confirm')}
</Modal.Footer> </Button>
</Modal.Footer>
) : null}
</Modal> </Modal>
</> </>
); );

View File

@ -61,7 +61,9 @@ import PullRefresh from './PullRefresh';
import Table from './table'; import Table from './table';
import SchemaVariableListPicker from './schema-editor/SchemaVariableListPicker'; import SchemaVariableListPicker from './schema-editor/SchemaVariableListPicker';
import SchemaVariableList from './schema-editor/SchemaVariableList'; import SchemaVariableList from './schema-editor/SchemaVariableList';
import VariableList from './formula/VariableList';
import FormulaPicker from './formula/Picker'; import FormulaPicker from './formula/Picker';
import PickerContainer from './PickerContainer';
import InputJSONSchema from './json-schema'; import InputJSONSchema from './json-schema';
export { export {
@ -128,6 +130,8 @@ export {
Table, Table,
SchemaVariableListPicker, SchemaVariableListPicker,
SchemaVariableList, SchemaVariableList,
VariableList,
PickerContainer,
FormulaPicker, FormulaPicker,
InputJSONSchema InputJSONSchema
}; };