Skip to content

Commit

Permalink
feat: 地图静态展示支持设置大小
Browse files Browse the repository at this point in the history
  • Loading branch information
jinye authored and CheshireJCat committed Dec 12, 2024
1 parent 176ff1e commit 19cdd57
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/zh-CN/components/form/location-picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ order: 30
| staticSchema.embed | `boolean` | false | 是否内嵌地图展示地理位置 |
| staticSchema.showAddress | `boolean` | true | 内嵌模式是否展示文字地址 |
| staticSchema.showGeoLoc | `boolean` | false | 内嵌模式是否展示定位当当前控件 |
| staticSchema.mapStyle | `object` | | 内嵌模式地图的样式,可以传宽高控制大小 |

### 坐标系说明

Expand Down
4 changes: 3 additions & 1 deletion packages/amis-ui/src/components/BaiduMapPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ interface MapPickerProps {
onlySelectCurrentLoc?: boolean;
showSug?: boolean;
showGeoLoc?: boolean;
mapStyle?: React.CSSProperties;
}

interface LocationItem {
Expand Down Expand Up @@ -346,7 +347,7 @@ export class BaiduMapPicker extends React.Component<
}

render() {
const {classnames: cx} = this.props;
const {classnames: cx, mapStyle} = this.props;
const onlySelectCurrentLoc = this.props.onlySelectCurrentLoc ?? false;
const {locIndex, locs, inputValue, sugs} = this.state;
const showSug = this.props.showSug ?? true;
Expand All @@ -371,6 +372,7 @@ export class BaiduMapPicker extends React.Component<
className={cx('MapPicker-map', {
invisible: hasSug
})}
style={mapStyle}
/>

{!showSug ? null : (
Expand Down
1 change: 1 addition & 0 deletions packages/amis/src/renderers/Form/LocationPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export class LocationControl extends React.Component<LocationControlProps> {
onlySelectCurrentLoc={true}
showSug={false}
showGeoLoc={staticSchema.showGeoLoc}
mapStyle={staticSchema.mapStyle}
/>
</>
) : (
Expand Down
2 changes: 1 addition & 1 deletion packages/amis/src/renderers/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ export class ImageField extends React.Component<
themeCss: wrapperCustomStyle
})
)}
style={{...style, transform: `scale(${this.state.scale})`}}
style={{transform: `scale(${this.state.scale})`, ...style}}
onClick={this.handleClick}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
Expand Down

0 comments on commit 19cdd57

Please sign in to comment.