Skip to content

Commit

Permalink
Merge pull request #2829 from XiaoMi/hotfix/others
Browse files Browse the repository at this point in the history
fix: 修复示例和类型提示等问题
  • Loading branch information
solarjoker authored May 17, 2024
2 parents a688ddd + 3afbf23 commit f8e502d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-comics-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/env": patch
---

fix: 添加依赖兼容之前组件
5 changes: 5 additions & 0 deletions .changeset/four-ducks-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/hiui": patch
---

fix(env): 添加依赖兼容之前组件
7 changes: 6 additions & 1 deletion packages/ui/form/stories/validate-message.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ export const ValidateMessage = () => {
<h1>ValidateMessage</h1>
<div className="form-validate-message__wrap" style={{ width: 900 }}>
<Card>
<Form placement="horizontal" labelPlacement="right" showValidateMessage={false}>
<Form
initialValues={{}}
placement="horizontal"
labelPlacement="right"
showValidateMessage={false}
>
<FormItem label="商品ID" labelWidth="100" valueType="string">
<Input placeholder={'请输入'} />
</FormItem>
Expand Down
12 changes: 4 additions & 8 deletions packages/ui/preview/src/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export const Preview = forwardRef<HTMLDivElement | null, PreviewProps>(

const [active, setActive] = useUncontrolledState(defaultCurrent || 0, current, onPreviewChange)

const [isLoaded, setIsLoaded] = useState(false)
const [isMoving, setIsMoving] = useState(false)
const [imgTransform, updateImgTransform] = useState(defaultTransform)
const movingPosition = useRef({
Expand All @@ -69,7 +68,7 @@ export const Preview = forwardRef<HTMLDivElement | null, PreviewProps>(
const isMultiple = useMemo(() => Array.isArray(src) && src.length > 1, [src])

// 图片加水印
const [watermarkContainerRef, setWatermarkContainerRef] = useState<HTMLDivElement | null>(null)
const [watermarkContainer, setWatermarkContainer] = useState<HTMLDivElement | null>(null)

const handleContextMenu = useLatestCallback((evt: React.MouseEvent) => {
evt.preventDefault()
Expand Down Expand Up @@ -239,17 +238,14 @@ export const Preview = forwardRef<HTMLDivElement | null, PreviewProps>(
<div
className={`${prefixCls}__img-wrapper`}
ref={(e) => {
setWatermarkContainerRef(e)
setWatermarkContainer(e)
}}
style={{
transform: `scale(${imgTransform.scale}, ${imgTransform.scale}) translate(${imgTransform.translateX}px,${imgTransform.translateY}px) rotate(${imgTransform.rotate}deg)`,
}}
>
<img
ref={imgRef}
onLoad={() => {
setIsLoaded(true)
}}
onError={onError}
onMouseDown={onMoveStart}
onMouseUp={onMoveEnd}
Expand Down Expand Up @@ -304,8 +300,8 @@ export const Preview = forwardRef<HTMLDivElement | null, PreviewProps>(
</>
)}
</div>
{watermarkProps && (
<Watermark {...watermarkProps} container={watermarkContainerRef} />
{watermarkProps && watermarkContainer && (
<Watermark {...watermarkProps} container={watermarkContainer} />
)}
</>
)}
Expand Down
6 changes: 4 additions & 2 deletions packages/utils/env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hi-ui/env",
"version": "4.0.5",
"version": "4.0.6",
"description": "Now I’m the model of a modern major general / The venerated Virginian veteran whose men are all / Lining up, to put me up on a pedestal / Writin’ letters to relatives / Embellishin’ my elegance and eloquence / But the elephant is in the room / The truth is in ya face when ya hear the British cannons go / BOOM",
"keywords": [],
"author": "Flcwl <[email protected]>",
Expand Down Expand Up @@ -36,6 +36,8 @@
},
"homepage": "https://github.com/XiaoMi/hiui#readme",
"dependencies": {
"@hi-ui/style-inject": "^4.0.0"
"@hi-ui/style-inject": "^4.0.0",
"inject-head-style": "^1.0.0",
"style-inject": "^0.3.0"
}
}

0 comments on commit f8e502d

Please sign in to comment.