This commit is contained in:
dap
2024-10-19 21:29:20 +08:00
105 changed files with 1512 additions and 1559 deletions

View File

@@ -29,6 +29,7 @@ export class ModalApi {
} = options;
const defaultState: ModalState = {
bordered: false,
centered: false,
class: '',
closeOnClickModal: true,

View File

@@ -3,15 +3,22 @@ import type { ModalApi } from './modal-api';
import type { Component, Ref } from 'vue';
export interface ModalProps {
/**
* 是否显示边框
* @default false
*/
bordered?: boolean;
/**
* 取消按钮文字
*/
cancelText?: string;
/**
* 是否居中
* @default false
*/
centered?: boolean;
class?: string;
/**
* 是否显示右上角的关闭按钮

View File

@@ -52,6 +52,7 @@ const { isMobile } = useIsMobile();
const state = props.modalApi?.useStore?.();
const {
bordered,
cancelText,
centered,
class: modalClass,
@@ -170,9 +171,11 @@ function handleFocusOutside(e: Event) {
ref="contentRef"
:class="
cn(
'border-border left-0 right-0 top-[10vh] mx-auto flex max-h-[80%] w-[520px] flex-col border p-0',
'left-0 right-0 top-[10vh] mx-auto flex max-h-[80%] w-[520px] flex-col p-0 sm:rounded-2xl',
modalClass,
{
'border-border border': bordered,
'shadow-3xl': !bordered,
'left-0 top-0 size-full max-h-full !translate-x-0 !translate-y-0':
shouldFullscreen,
'top-1/2 !-translate-y-1/2': centered && !shouldFullscreen,
@@ -195,8 +198,9 @@ function handleFocusOutside(e: Event) {
ref="headerRef"
:class="
cn(
'border-b px-5 py-4',
'px-5 py-4',
{
'border-b': bordered,
hidden: !header,
'cursor-move select-none': shouldDraggable,
},

View File

@@ -40,7 +40,6 @@
"@vben-core/composables": "workspace:*",
"@vben-core/icons": "workspace:*",
"@vben-core/shadcn-ui": "workspace:*",
"@vben-core/shared": "workspace:*",
"@vben-core/typings": "workspace:*",
"@vueuse/core": "catalog:",
"vue": "catalog:"