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(modal): 新增自定义zIndex功能 #2849

Merged
merged 3 commits into from
Jun 28, 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
5 changes: 5 additions & 0 deletions .changeset/five-ads-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/hiui": patch
---

feat(modal): 新增自定义 zIndex 功能
5 changes: 5 additions & 0 deletions .changeset/twenty-ligers-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/modal": minor
---

feat: 新增自定义 zIndex 功能
4 changes: 4 additions & 0 deletions packages/ui/modal/src/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ export interface ModalProps extends HiBaseHTMLProps<'div'>, UseModalProps {
* 弹出层高度设置
*/
height?: React.ReactText
/**
* 自定义css展示层级
*/
zIndex?: number
/**
* 是否显示蒙层
*/
Expand Down
4 changes: 4 additions & 0 deletions packages/ui/modal/src/use-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ export const useModal = ({
style.display = 'none'
}

if (Object.prototype.hasOwnProperty.call(props, 'zIndex')) {
style.zIndex = props.zIndex
}

return {
role: 'dialog',
'aria-modal': true,
Expand Down