diff --git a/scss/components/form/_image.scss b/scss/components/form/_image.scss index efa03878..39635305 100644 --- a/scss/components/form/_image.scss +++ b/scss/components/form/_image.scss @@ -184,27 +184,30 @@ &-uploadBtn { margin-top: 5px; } -} + &-cropperWrapper { + position: relative; -// todo - -.cropper-wrapper { - position: relative; - - img { - max-width: 100%; - max-height: 400px; + img { + max-width: 100%; + max-height: 400px; + } } - .btn { + &-croperToolbar { + display: inline-flex; + width: 50px; position: absolute; - bottom: 0; right: 0; - } + bottom: 0; + flex-direction: column; + align-items: flex-end; - .btn:nth-child(2n + 1) { - bottom: 40px; - right: 4px; + >a { + color: #fff; + padding: 2px 5px; + cursor: pointer; + font-size: 20px; + } } } \ No newline at end of file diff --git a/src/renderers/Form/Image.tsx b/src/renderers/Form/Image.tsx index 70d144e9..b9a12557 100644 --- a/src/renderers/Form/Image.tsx +++ b/src/renderers/Form/Image.tsx @@ -32,6 +32,12 @@ export interface ImageProps extends FormControlProps { aspectRatio?: number; aspectRatioLabel?: string; }; + crop?: + | boolean + | { + aspectRatio?: number; + [propName: string]: any; + }; accept?: string; btnUploadClassName?: string; btnClassName?: string; @@ -53,7 +59,7 @@ export interface ImageState { maxHeight?: number; }; files: Array; - crop?: object; + crop?: any; error?: string; cropFile?: FileValue; submitOnChange?: boolean; @@ -725,73 +731,6 @@ export default class ImageControl extends React.Component - this.setState({compress: checked})} - disabled={this.props.disabled} - /> - - 开启缩放? - - {this.state.compress && ( -
- - this.setState({ - compressOptions: { - ...this.state.compressOptions, - maxWidth: parseInt(e.currentTarget.value, 10) || 0 - } - }) - } - disabled={this.props.disabled} - /> - - X - - - this.setState({ - compressOptions: { - ...this.state.compressOptions, - maxHeight: parseInt(e.currentTarget.value, 10) || 0 - } - }) - } - disabled={this.props.disabled} - /> -
- )} - - ); - } - render() { const { className, @@ -814,14 +753,26 @@ export default class ImageControl extends React.Component {cropFile ? ( -
+
- - +
) : ( )} - {this.renderCompressOptions()} - {!autoUpload && !hideUploadButton && files.length ? (