fix: select components used in modal pop-ups cannot be selected (#4368)
* fix: select components used in modal pop-ups cannot be selected * chore: update ci * chore: update css
This commit is contained in:
@@ -32,9 +32,13 @@
|
||||
body,
|
||||
html {
|
||||
@apply size-full overscroll-none;
|
||||
|
||||
/* scrollbar-gutter: stable; */
|
||||
}
|
||||
|
||||
body {
|
||||
@apply !pointer-events-auto;
|
||||
|
||||
min-height: 100vh;
|
||||
|
||||
/* overflow: overlay; */
|
||||
@@ -90,6 +94,7 @@
|
||||
}
|
||||
|
||||
/* 只有非mac下才进行调整,mac下使用默认滚动条 */
|
||||
|
||||
html:not([data-platform='macOs']) {
|
||||
::-webkit-scrollbar {
|
||||
@apply h-[10px] w-[10px];
|
||||
|
@@ -41,6 +41,7 @@ export class ModalApi {
|
||||
isOpen: false,
|
||||
loading: false,
|
||||
modal: true,
|
||||
openAutoFocus: false,
|
||||
showCancelButton: true,
|
||||
showConfirmButton: true,
|
||||
title: '',
|
||||
|
@@ -75,6 +75,10 @@ export interface ModalProps {
|
||||
* @default true
|
||||
*/
|
||||
modal?: boolean;
|
||||
/**
|
||||
* 是否自动聚焦
|
||||
*/
|
||||
openAutoFocus?: boolean;
|
||||
/**
|
||||
* 是否显示取消按钮
|
||||
* @default true
|
||||
|
@@ -68,6 +68,7 @@ const {
|
||||
header,
|
||||
loading: showLoading,
|
||||
modal,
|
||||
openAutoFocus,
|
||||
showCancelButton,
|
||||
showConfirmButton,
|
||||
title,
|
||||
@@ -133,6 +134,13 @@ function escapeKeyDown(e: KeyboardEvent) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function handerOpenAutoFocus(e: Event) {
|
||||
if (!openAutoFocus.value) {
|
||||
e?.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
// pointer-down-outside
|
||||
function pointerDownOutside(e: Event) {
|
||||
const target = e.target as HTMLElement;
|
||||
@@ -166,6 +174,7 @@ function pointerDownOutside(e: Event) {
|
||||
close-class="top-3"
|
||||
@escape-key-down="escapeKeyDown"
|
||||
@interact-outside="interactOutside"
|
||||
@open-auto-focus="handerOpenAutoFocus"
|
||||
@pointer-down-outside="pointerDownOutside"
|
||||
>
|
||||
<DialogHeader
|
||||
|
Reference in New Issue
Block a user