Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 地图静态展示支持设置大小 #11367

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading