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

fix: select components used in modal pop-ups cannot be selected #4368

Merged
merged 4 commits into from
Sep 11, 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
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ permissions:
jobs:
post-update:
# if: ${{ github.actor == 'dependabot[bot]' }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
# - macos-latest
- windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions packages/@core/base/design/src/css/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@
body,
html {
@apply size-full overscroll-none;

/* scrollbar-gutter: stable; */
}

body {
@apply !pointer-events-auto;

min-height: 100vh;

/* overflow: overlay; */
Expand Down Expand Up @@ -90,6 +94,7 @@
}

/* 只有非mac下才进行调整,mac下使用默认滚动条 */

html:not([data-platform='macOs']) {
::-webkit-scrollbar {
@apply h-[10px] w-[10px];
Expand Down
1 change: 1 addition & 0 deletions packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class ModalApi {
isOpen: false,
loading: false,
modal: true,
openAutoFocus: false,
showCancelButton: true,
showConfirmButton: true,
title: '',
Expand Down
4 changes: 4 additions & 0 deletions packages/@core/ui-kit/popup-ui/src/modal/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export interface ModalProps {
* @default true
*/
modal?: boolean;
/**
* 是否自动聚焦
*/
openAutoFocus?: boolean;
/**
* 是否显示取消按钮
* @default true
Expand Down
9 changes: 9 additions & 0 deletions packages/@core/ui-kit/popup-ui/src/modal/modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const {
header,
loading: showLoading,
modal,
openAutoFocus,
showCancelButton,
showConfirmButton,
title,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
27 changes: 24 additions & 3 deletions packages/effects/common-ui/src/ui/authentication/code-login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ interface Props {
* @zh_CN 登陆路径
*/
loginPath?: string;
/**
* @zh_CN 标题
*/
title?: string;
/**
* @zh_CN 描述
*/
subTitle?: string;
/**
* @zh_CN 按钮文本
*/
submitButtonText?: string;
}

defineOptions({
Expand All @@ -31,6 +43,9 @@ defineOptions({
const props = withDefaults(defineProps<Props>(), {
loading: false,
loginPath: '/auth/login',
submitButtonText: '',
subTitle: '',
title: '',
});

const emit = defineEmits<{
Expand Down Expand Up @@ -69,16 +84,22 @@ function goToLogin() {
<template>
<div>
<Title>
{{ $t('authentication.welcomeBack') }} 📲
<slot name="title">
{{ title || $t('authentication.welcomeBack') }} 📲
</slot>
<template #desc>
<span class="text-muted-foreground">
{{ $t('authentication.codeSubtitle') }}
<slot name="subTitle">
{{ subTitle || $t('authentication.codeSubtitle') }}
</slot>
</span>
</template>
</Title>
<Form />
<VbenButton :loading="loading" class="w-full" @click="handleSubmit">
{{ $t('common.login') }}
<slot name="submitButtonText">
{{ submitButtonText || $t('common.login') }}
</slot>
</VbenButton>
<VbenButton class="mt-4 w-full" variant="outline" @click="goToLogin()">
{{ $t('common.back') }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { VbenButton } from '@vben-core/shadcn-ui';
import Title from './auth-title.vue';

interface Props {
formSchema: VbenFormSchema[];
/**
* @zh_CN 是否处于加载处理状态
*/
Expand All @@ -19,8 +20,18 @@ interface Props {
* @zh_CN 登陆路径
*/
loginPath?: string;

formSchema: VbenFormSchema[];
/**
* @zh_CN 标题
*/
title?: string;
/**
* @zh_CN 描述
*/
subTitle?: string;
/**
* @zh_CN 按钮文本
*/
submitButtonText?: string;
}

defineOptions({
Expand All @@ -30,6 +41,9 @@ defineOptions({
const props = withDefaults(defineProps<Props>(), {
loading: false,
loginPath: '/auth/login',
submitButtonText: '',
subTitle: '',
title: '',
});

const emit = defineEmits<{
Expand Down Expand Up @@ -65,16 +79,22 @@ function goToLogin() {
<template>
<div>
<Title>
{{ $t('authentication.forgetPassword') }} 🤦🏻‍♂️
<slot name="title">
{{ title || $t('authentication.forgetPassword') }} 🤦🏻‍♂️
</slot>
<template #desc>
{{ $t('authentication.forgetPasswordSubtitle') }}
<slot name="subTitle">
{{ subTitle || $t('authentication.forgetPasswordSubtitle') }}
</slot>
</template>
</Title>
<Form />

<div>
<VbenButton class="mt-2 w-full" @click="handleSubmit">
{{ $t('authentication.sendResetLink') }}
<slot name="submitButtonText">
{{ submitButtonText || $t('authentication.sendResetLink') }}
</slot>
</VbenButton>
<VbenButton class="mt-4 w-full" variant="outline" @click="goToLogin()">
{{ $t('common.back') }}
Expand Down
19 changes: 14 additions & 5 deletions packages/effects/common-ui/src/ui/authentication/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const props = withDefaults(defineProps<Props>(), {
showRegister: true,
showRememberMe: true,
showThirdPartyLogin: true,
submitButtonText: '',
subTitle: '',
title: '',
});
Expand Down Expand Up @@ -86,10 +87,14 @@ onMounted(() => {
<div @keydown.enter.prevent="handleSubmit">
<slot name="title">
<Title>
{{ title || `${$t('authentication.welcomeBack')} 👋🏻` }}
<slot name="title">
{{ title || `${$t('authentication.welcomeBack')} 👋🏻` }}
</slot>
<template #desc>
<span class="text-muted-foreground">
{{ subTitle || $t('authentication.loginSubtitle') }}
<slot name="subTitle">
{{ subTitle || $t('authentication.loginSubtitle') }}
</slot>
</span>
</template>
</Title>
Expand All @@ -101,8 +106,12 @@ onMounted(() => {
v-if="showRememberMe || showForgetPassword"
class="mb-6 flex justify-between"
>
<div v-if="showRememberMe" class="flex-center">
<VbenCheckbox v-model:checked="rememberMe" name="rememberMe">
<div class="flex-center">
<VbenCheckbox
v-if="showRememberMe"
v-model:checked="rememberMe"
name="rememberMe"
>
{{ $t('authentication.rememberMe') }}
</VbenCheckbox>
</div>
Expand All @@ -116,7 +125,7 @@ onMounted(() => {
</span>
</div>
<VbenButton :loading="loading" class="w-full" @click="handleSubmit">
{{ $t('common.login') }}
{{ submitButtonText || $t('common.login') }}
</VbenButton>

<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,35 @@ interface Props {
* @zh_CN 登陆路径
*/
loginPath?: string;
/**
* @zh_CN 标题
*/
title?: string;
/**
* @zh_CN 描述
*/
subTitle?: string;
/**
* @zh_CN 按钮文本
*/
submitButtonText?: string;
/**
* @zh_CN 描述
*/
description?: string;
}

defineOptions({
name: 'AuthenticationQrCodeLogin',
});

const props = withDefaults(defineProps<Props>(), {
description: '',
loading: false,
loginPath: '/auth/login',
submitButtonText: '',
subTitle: '',
title: '',
});

const router = useRouter();
Expand All @@ -46,18 +66,24 @@ function goToLogin() {
<template>
<div>
<Title>
{{ $t('authentication.welcomeBack') }} 📱
<slot name="title">
{{ title || $t('authentication.welcomeBack') }} 📱
</slot>
<template #desc>
<span class="text-muted-foreground">
{{ $t('authentication.qrcodeSubtitle') }}
<slot name="subTitle">
{{ subTitle || $t('authentication.qrcodeSubtitle') }}
</slot>
</span>
</template>
</Title>

<div class="flex-col-center mt-6">
<img :src="qrcode" alt="qrcode" class="w-1/2" />
<p class="text-muted-foreground mt-4 text-sm">
{{ $t('authentication.qrcodePrompt') }}
<slot name="description">
{{ description || $t('authentication.qrcodePrompt') }}
</slot>
</p>
</div>

Expand Down
29 changes: 26 additions & 3 deletions packages/effects/common-ui/src/ui/authentication/register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ interface Props {
* @zh_CN 登陆路径
*/
loginPath?: string;
/**
* @zh_CN 标题
*/
title?: string;
/**
* @zh_CN 描述
*/
subTitle?: string;
/**
* @zh_CN 按钮文本
*/
submitButtonText?: string;
}

defineOptions({
Expand All @@ -32,6 +44,9 @@ const props = withDefaults(defineProps<Props>(), {
formSchema: () => [],
loading: false,
loginPath: '/auth/login',
submitButtonText: '',
subTitle: '',
title: '',
});

const emit = defineEmits<{
Expand Down Expand Up @@ -66,13 +81,21 @@ function goToLogin() {
<template>
<div>
<Title>
{{ $t('authentication.createAnAccount') }} 🚀
<template #desc> {{ $t('authentication.signUpSubtitle') }} </template>
<slot name="title">
{{ title || $t('authentication.createAnAccount') }} 🚀
</slot>
<template #desc>
<slot name="subTitle">
{{ subTitle || $t('authentication.signUpSubtitle') }}
</slot>
</template>
</Title>
<Form />

<VbenButton :loading="loading" class="mt-2 w-full" @click="handleSubmit">
{{ $t('authentication.signUp') }}
<slot name="submitButtonText">
{{ submitButtonText || $t('authentication.signUp') }}
</slot>
</VbenButton>
<div class="mt-4 text-center text-sm">
{{ $t('authentication.alreadyHaveAccount') }}
Expand Down
4 changes: 4 additions & 0 deletions packages/effects/common-ui/src/ui/authentication/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ interface AuthenticationProps {
* @zh_CN 登录框标题
*/
title?: string;
/**
* @zh_CN 提交按钮文本
*/
submitButtonText?: string;
}

interface LoginAndRegisterParams {
Expand Down
4 changes: 2 additions & 2 deletions packages/effects/layouts/src/authentication/toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const showTheme = computed(() => props.toolbarList.includes('theme'));
<template>
<div
:class="{
'bg-accent z-10 rounded-3xl px-3 py-1': toolbarList.length > 1,
'bg-accent rounded-3xl px-3 py-1': toolbarList.length > 1,
}"
class="flex-center absolute right-2 top-4"
class="flex-center absolute right-2 top-4 z-10"
>
<!-- Only show on medium and larger screens -->
<div class="hidden md:flex">
Expand Down
Loading