This commit is contained in:
dap
2024-10-21 07:58:31 +08:00
77 changed files with 188 additions and 223 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@vben-core/design",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -142,6 +142,10 @@
@apply outline-primary left-0 top-0 h-full w-full p-1 opacity-100;
}
.vben-link {
@apply text-primary hover:text-primary-hover active:text-primary-active cursor-pointer;
}
.card-box {
@apply bg-card text-card-foreground border-border rounded-xl border;
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vben-core/icons",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben-core/shared",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben-core/typings",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben-core/composables",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben-core/preferences",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -22,6 +22,7 @@ export function useExpandable(props: FormRenderProps) {
for (let index = 1; index <= rows; index++) {
maxItem += mapping?.[index] ?? 0;
}
// 保持一行
return maxItem - 1 || 1;
});
@@ -35,6 +36,7 @@ export function useExpandable(props: FormRenderProps) {
if (val) {
await nextTick();
rowMapping.value = {};
isCalculated.value = false;
await calculateRowMapping();
}
},

View File

@@ -279,7 +279,7 @@ function autofocus() {
'flex leading-6',
{
'mr-2 flex-shrink-0 justify-end': !isVertical,
'flex-row': isVertical,
'mb-1 flex-row': isVertical,
},
labelClass,
)

View File

@@ -12,7 +12,7 @@ const props = defineProps<Props>();
</script>
<template>
<FormLabel :class="cn('mb-1 flex items-center', props.class)">
<FormLabel :class="cn('flex items-center', props.class)">
<span v-if="required" class="text-destructive mr-[2px]">*</span>
<slot></slot>
<VbenHelpTooltip v-if="help" trigger-class="size-3.5 ml-1">

View File

@@ -39,7 +39,14 @@ const handleUpdateCollapsed = (value: boolean) => {
props.formApi?.setState({ collapsed: !!value });
};
function handleKeyDownEnter() {
function handleKeyDownEnter(event: KeyboardEvent) {
// 如果是 textarea 不阻止默认行为,否则会导致无法换行。
// 跳过 textarea 的回车提交处理
if (event.target instanceof HTMLTextAreaElement) {
return;
}
event.preventDefault();
if (!state.value.submitOnEnter || !formActionsRef.value) {
return;
}
@@ -49,7 +56,7 @@ function handleKeyDownEnter() {
<template>
<Form
@keydown.enter.prevent="handleKeyDownEnter"
@keydown.enter="handleKeyDownEnter"
v-bind="forward"
:collapsed="state.collapsed"
:component-bind-event-map="COMPONENT_BIND_EVENT_MAP"

View File

@@ -1,6 +1,6 @@
{
"name": "@vben-core/layout-ui",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben-core/menu-ui",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben-core/shadcn-ui",
"version": "5.4.1",
"version": "5.4.2",
"#main": "./dist/index.mjs",
"#module": "./dist/index.mjs",
"homepage": "https://github.com/vbenjs/vue-vben-admin",

View File

@@ -12,12 +12,7 @@ const collapsed = defineModel({ default: false });
<template>
<div
:class="
cn(
'text-primary hover:text-primary-hover inline-flex cursor-pointer items-center',
props.class,
)
"
:class="cn('vben-link inline-flex items-center', props.class)"
@click="collapsed = !collapsed"
>
<slot :is-expanded="collapsed">

View File

@@ -1,6 +1,6 @@
{
"name": "@vben-core/tabs-ui",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/constants",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,5 +1,5 @@
/**
* @zh_CN 登页面 url 地址
* @zh_CN 登页面 url 地址
*/
export const LOGIN_PATH = '/auth/login';

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/access",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/common-ui",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -44,7 +44,7 @@ declare global {
const renderLink = (href: string, text: string) =>
h(
'a',
{ href, target: '_blank', class: 'text-primary hover:text-primary-hover' },
{ href, target: '_blank', class: 'vben-link' },
{ default: () => text },
);
@@ -114,11 +114,7 @@ const devDependenciesItems = Object.keys(devDependencies).map((key) => ({
<Page :title="title">
<template #description>
<p class="text-foreground mt-3 text-sm leading-6">
<a
:href="VBEN_GITHUB_URL"
class="text-primary hover:text-primary-hover"
target="_blank"
>
<a :href="VBEN_GITHUB_URL" class="vben-link" target="_blank">
{{ name }}
</a>
{{ description }}

View File

@@ -1,8 +1,6 @@
<script setup lang="ts">
import type { VbenFormSchema } from '@vben-core/form-ui';
import type { LoginCodeEmits } from './types';
import { computed, reactive } from 'vue';
import { useRouter } from 'vue-router';
@@ -19,7 +17,7 @@ interface Props {
*/
loading?: boolean;
/**
* @zh_CN 登路径
* @zh_CN 登路径
*/
loginPath?: string;
/**
@@ -49,12 +47,12 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
submit: LoginCodeEmits['submit'];
submit: [{ code: string; phoneNumber: string; tenantId: string }];
}>();
const router = useRouter();
const [Form, { validate, setFieldValue }] = useVbenForm(
const [Form, { validate, setFieldValue, getValues }] = useVbenForm(
reactive({
commonConfig: {
hideLabel: true,
@@ -66,8 +64,8 @@ const [Form, { validate, setFieldValue }] = useVbenForm(
);
async function handleSubmit() {
const { valid, values } = await validate();
const { valid } = await validate();
const values = await getValues();
if (valid) {
emit('submit', {
tenantId: values?.tenantId,

View File

@@ -17,7 +17,7 @@ interface Props {
*/
loading?: boolean;
/**
* @zh_CN 登路径
* @zh_CN 登路径
*/
loginPath?: string;
/**
@@ -47,10 +47,10 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
submit: [string];
submit: [Record<string, any>];
}>();
const [Form, { validate }] = useVbenForm(
const [Form, { validate, getValues }] = useVbenForm(
reactive({
commonConfig: {
hideLabel: true,
@@ -64,10 +64,10 @@ const [Form, { validate }] = useVbenForm(
const router = useRouter();
async function handleSubmit() {
const { valid, values } = await validate();
const { valid } = await validate();
const values = await getValues();
if (valid) {
emit('submit', values?.email);
emit('submit', values);
}
}

View File

@@ -1,11 +1,7 @@
<script setup lang="ts">
import type { VbenFormSchema } from '@vben-core/form-ui';
import type {
AuthenticationProps,
LoginAndRegisterParams,
LoginEmits,
} from './types';
import type { AuthenticationProps, LoginAndRegisterParams } from './types';
import { computed, onMounted, reactive, ref } from 'vue';
import { useRouter } from 'vue-router';
@@ -13,6 +9,7 @@ import { useRouter } from 'vue-router';
import { $t } from '@vben/locales';
import { useVbenForm } from '@vben-core/form-ui';
import { VbenButton, VbenCheckbox } from '@vben-core/shadcn-ui';
import { cloneDeep } from '@vben-core/shared/utils';
import Title from './auth-title.vue';
import ThirdPartyLogin from './third-party-login.vue';
@@ -44,10 +41,10 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
submit: LoginEmits['submit'];
submit: [LoginAndRegisterParams];
}>();
const [Form, { setFieldValue, validate }] = useVbenForm(
const [Form, { setFieldValue, validate, getValues }] = useVbenForm(
reactive({
commonConfig: {
hideLabel: true,
@@ -66,7 +63,8 @@ const localUsername = localStorage.getItem(REMEMBER_ME_KEY) || '';
const rememberMe = ref(!!localUsername);
async function handleSubmit() {
const { valid, values } = await validate();
const { valid } = await validate();
const values = cloneDeep(await getValues());
if (valid) {
localStorage.setItem(
REMEMBER_ME_KEY,
@@ -126,7 +124,7 @@ defineExpose({ setFieldValue });
<span
v-if="showForgetPassword"
class="text-primary hover:text-primary-hover active:text-primary-active cursor-pointer text-sm font-normal"
class="vben-link text-sm font-normal"
@click="handleGo(forgetPasswordPath)"
>
{{ $t('authentication.forgetPassword') }}
@@ -175,7 +173,7 @@ defineExpose({ setFieldValue });
<div v-if="showRegister" class="mt-3 text-center text-sm">
{{ $t('authentication.accountTip') }}
<span
class="text-primary hover:text-primary-hover active:text-primary-active cursor-pointer text-sm font-normal"
class="vben-link text-sm font-normal"
@click="handleGo(registerPath)"
>
{{ $t('authentication.createAccount') }}

View File

@@ -15,7 +15,7 @@ interface Props {
*/
loading?: boolean;
/**
* @zh_CN 登路径
* @zh_CN 登路径
*/
loginPath?: string;
/**

View File

@@ -1,8 +1,7 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types';
import type { VbenFormSchema } from '@vben-core/form-ui';
import type { RegisterEmits } from './types';
import { computed, reactive } from 'vue';
import { useRouter } from 'vue-router';
@@ -19,7 +18,7 @@ interface Props {
*/
loading?: boolean;
/**
* @zh_CN 登路径
* @zh_CN 登路径
*/
loginPath?: string;
/**
@@ -50,10 +49,10 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
submit: RegisterEmits['submit'];
submit: [Recordable<any>];
}>();
const [Form, { validate }] = useVbenForm(
const [Form, { validate, getValues }] = useVbenForm(
reactive({
commonConfig: {
hideLabel: true,
@@ -67,7 +66,8 @@ const [Form, { validate }] = useVbenForm(
const router = useRouter();
async function handleSubmit() {
const { valid, values } = await validate();
const { valid } = await validate();
const values = await getValues();
if (valid) {
emit('submit', values as { password: string; username: string });
}
@@ -107,10 +107,7 @@ function goToLogin() {
</VbenButton>
<div class="mt-4 text-center text-sm">
{{ $t('authentication.alreadyHaveAccount') }}
<span
class="text-primary hover:text-primary-hover cursor-pointer text-sm font-normal"
@click="goToLogin()"
>
<span class="vben-link text-sm font-normal" @click="goToLogin()">
{{ $t('authentication.goToLogin') }}
</span>
</div>

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/hooks",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/layouts",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,4 +1,6 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types';
import { computed, reactive } from 'vue';
import { $t } from '@vben/locales';
@@ -11,14 +13,6 @@ interface Props {
text?: string;
}
interface LockAndRegisterParams {
lockScreenPassword: string;
}
interface RegisterEmits {
submit: [LockAndRegisterParams];
}
defineOptions({
name: 'LockScreenModal',
});
@@ -29,10 +23,10 @@ withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
submit: RegisterEmits['submit'];
submit: [Recordable<any>];
}>();
const [Form, { resetForm, validate }] = useVbenForm(
const [Form, { resetForm, validate, getValues }] = useVbenForm(
reactive({
commonConfig: {
hideLabel: true,
@@ -68,7 +62,8 @@ const [Modal] = useVbenModal({
});
async function handleSubmit() {
const { valid, values } = await validate();
const { valid } = await validate();
const values = await getValues();
if (valid) {
emit('submit', values?.lockScreenPassword);
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/plugins",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/request",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/icons",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/locales",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/preferences",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/stores",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/styles",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/types",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/utils",
"version": "5.4.1",
"version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {