Skip to content

Commit

Permalink
feat(modal): 新增自定义zIndex功能 (#2849)
Browse files Browse the repository at this point in the history
* feat(modal): 新增自定义zIndex功能(#2848)

* chore(modal): 生成变更记录文件

* chore(modal): 代码规范

---------

Co-authored-by: xiamiao <[email protected]>
  • Loading branch information
xiamiao1121 and xiamiao authored Jun 28, 2024
1 parent e37e761 commit 85307a4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
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

0 comments on commit 85307a4

Please sign in to comment.