fix: fix known issues with the form (#4696)
* fix: fix known issues with the form * chore: typo * chore: typopull/48/MERGE
							parent
							
								
									93b48ef244
								
							
						
					
					
						commit
						d262b7b6c0
					
				|  | @ -16,7 +16,7 @@ categories: | ||||||
|   - title: '🐞 Bug Fixes' |   - title: '🐞 Bug Fixes' | ||||||
|     labels: |     labels: | ||||||
|       - 'bug' |       - 'bug' | ||||||
|   - title: '📈 Performance' |   - title: '📈 Performance & Enhancement' | ||||||
|     labels: |     labels: | ||||||
|       - 'perf' |       - 'perf' | ||||||
|       - 'enhancement' |       - 'enhancement' | ||||||
|  |  | ||||||
|  | @ -46,7 +46,7 @@ const formSchema = computed((): VbenFormSchema[] => { | ||||||
|         rules(values) { |         rules(values) { | ||||||
|           const { password } = values; |           const { password } = values; | ||||||
|           return z |           return z | ||||||
|             .string() |             .string({ required_error: $t('authentication.passwordTip') }) | ||||||
|             .min(1, { message: $t('authentication.passwordTip') }) |             .min(1, { message: $t('authentication.passwordTip') }) | ||||||
|             .refine((value) => value === password, { |             .refine((value) => value === password, { | ||||||
|               message: $t('authentication.confirmPasswordTip'), |               message: $t('authentication.confirmPasswordTip'), | ||||||
|  | @ -56,7 +56,6 @@ const formSchema = computed((): VbenFormSchema[] => { | ||||||
|       }, |       }, | ||||||
|       fieldName: 'confirmPassword', |       fieldName: 'confirmPassword', | ||||||
|       label: $t('authentication.confirmPassword'), |       label: $t('authentication.confirmPassword'), | ||||||
|       rules: z.string().min(1, { message: $t('authentication.passwordTip') }), |  | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       component: 'VbenCheckbox', |       component: 'VbenCheckbox', | ||||||
|  | @ -68,15 +67,10 @@ const formSchema = computed((): VbenFormSchema[] => { | ||||||
|             h( |             h( | ||||||
|               'a', |               'a', | ||||||
|               { |               { | ||||||
|                 class: |                 class: 'vben-link ml-1 ', | ||||||
|                   'cursor-pointer text-primary ml-1 hover:text-primary-hover', |  | ||||||
|                 href: '', |                 href: '', | ||||||
|               }, |               }, | ||||||
|               [ |               `${$t('authentication.privacyPolicy')} & ${$t('authentication.terms')}`, | ||||||
|                 $t('authentication.privacyPolicy'), |  | ||||||
|                 '&', |  | ||||||
|                 $t('authentication.terms'), |  | ||||||
|               ], |  | ||||||
|             ), |             ), | ||||||
|           ]), |           ]), | ||||||
|       }), |       }), | ||||||
|  |  | ||||||
|  | @ -46,7 +46,7 @@ const formSchema = computed((): VbenFormSchema[] => { | ||||||
|         rules(values) { |         rules(values) { | ||||||
|           const { password } = values; |           const { password } = values; | ||||||
|           return z |           return z | ||||||
|             .string() |             .string({ required_error: $t('authentication.passwordTip') }) | ||||||
|             .min(1, { message: $t('authentication.passwordTip') }) |             .min(1, { message: $t('authentication.passwordTip') }) | ||||||
|             .refine((value) => value === password, { |             .refine((value) => value === password, { | ||||||
|               message: $t('authentication.confirmPasswordTip'), |               message: $t('authentication.confirmPasswordTip'), | ||||||
|  | @ -56,7 +56,6 @@ const formSchema = computed((): VbenFormSchema[] => { | ||||||
|       }, |       }, | ||||||
|       fieldName: 'confirmPassword', |       fieldName: 'confirmPassword', | ||||||
|       label: $t('authentication.confirmPassword'), |       label: $t('authentication.confirmPassword'), | ||||||
|       rules: z.string().min(1, { message: $t('authentication.passwordTip') }), |  | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       component: 'VbenCheckbox', |       component: 'VbenCheckbox', | ||||||
|  | @ -68,15 +67,10 @@ const formSchema = computed((): VbenFormSchema[] => { | ||||||
|             h( |             h( | ||||||
|               'a', |               'a', | ||||||
|               { |               { | ||||||
|                 class: |                 class: 'vben-link ml-1 ', | ||||||
|                   'cursor-pointer text-primary ml-1 hover:text-primary-hover', |  | ||||||
|                 href: '', |                 href: '', | ||||||
|               }, |               }, | ||||||
|               [ |               `${$t('authentication.privacyPolicy')} & ${$t('authentication.terms')}`, | ||||||
|                 $t('authentication.privacyPolicy'), |  | ||||||
|                 '&', |  | ||||||
|                 $t('authentication.terms'), |  | ||||||
|               ], |  | ||||||
|             ), |             ), | ||||||
|           ]), |           ]), | ||||||
|       }), |       }), | ||||||
|  |  | ||||||
|  | @ -46,7 +46,7 @@ const formSchema = computed((): VbenFormSchema[] => { | ||||||
|         rules(values) { |         rules(values) { | ||||||
|           const { password } = values; |           const { password } = values; | ||||||
|           return z |           return z | ||||||
|             .string() |             .string({ required_error: $t('authentication.passwordTip') }) | ||||||
|             .min(1, { message: $t('authentication.passwordTip') }) |             .min(1, { message: $t('authentication.passwordTip') }) | ||||||
|             .refine((value) => value === password, { |             .refine((value) => value === password, { | ||||||
|               message: $t('authentication.confirmPasswordTip'), |               message: $t('authentication.confirmPasswordTip'), | ||||||
|  | @ -56,7 +56,6 @@ const formSchema = computed((): VbenFormSchema[] => { | ||||||
|       }, |       }, | ||||||
|       fieldName: 'confirmPassword', |       fieldName: 'confirmPassword', | ||||||
|       label: $t('authentication.confirmPassword'), |       label: $t('authentication.confirmPassword'), | ||||||
|       rules: z.string().min(1, { message: $t('authentication.passwordTip') }), |  | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       component: 'VbenCheckbox', |       component: 'VbenCheckbox', | ||||||
|  | @ -68,15 +67,10 @@ const formSchema = computed((): VbenFormSchema[] => { | ||||||
|             h( |             h( | ||||||
|               'a', |               'a', | ||||||
|               { |               { | ||||||
|                 class: |                 class: 'vben-link ml-1', | ||||||
|                   'cursor-pointer text-primary ml-1 hover:text-primary-hover', |  | ||||||
|                 href: '', |                 href: '', | ||||||
|               }, |               }, | ||||||
|               [ |               `${$t('authentication.privacyPolicy')} & ${$t('authentication.terms')}`, | ||||||
|                 $t('authentication.privacyPolicy'), |  | ||||||
|                 '&', |  | ||||||
|                 $t('authentication.terms'), |  | ||||||
|               ], |  | ||||||
|             ), |             ), | ||||||
|           ]), |           ]), | ||||||
|       }), |       }), | ||||||
|  |  | ||||||
|  | @ -142,6 +142,10 @@ | ||||||
|     @apply outline-primary left-0 top-0 h-full w-full p-1 opacity-100; |     @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 { |   .card-box { | ||||||
|     @apply bg-card text-card-foreground border-border rounded-xl border; |     @apply bg-card text-card-foreground border-border rounded-xl border; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | @ -22,6 +22,7 @@ export function useExpandable(props: FormRenderProps) { | ||||||
|     for (let index = 1; index <= rows; index++) { |     for (let index = 1; index <= rows; index++) { | ||||||
|       maxItem += mapping?.[index] ?? 0; |       maxItem += mapping?.[index] ?? 0; | ||||||
|     } |     } | ||||||
|  |     // 保持一行
 | ||||||
|     return maxItem - 1 || 1; |     return maxItem - 1 || 1; | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|  | @ -35,6 +36,7 @@ export function useExpandable(props: FormRenderProps) { | ||||||
|       if (val) { |       if (val) { | ||||||
|         await nextTick(); |         await nextTick(); | ||||||
|         rowMapping.value = {}; |         rowMapping.value = {}; | ||||||
|  |         isCalculated.value = false; | ||||||
|         await calculateRowMapping(); |         await calculateRowMapping(); | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|  | @ -279,7 +279,7 @@ function autofocus() { | ||||||
|             'flex leading-6', |             'flex leading-6', | ||||||
|             { |             { | ||||||
|               'mr-2 flex-shrink-0 justify-end': !isVertical, |               'mr-2 flex-shrink-0 justify-end': !isVertical, | ||||||
|               'flex-row': isVertical, |               'mb-1 flex-row': isVertical, | ||||||
|             }, |             }, | ||||||
|             labelClass, |             labelClass, | ||||||
|           ) |           ) | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ const props = defineProps<Props>(); | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
| <template> | <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> |     <span v-if="required" class="text-destructive mr-[2px]">*</span> | ||||||
|     <slot></slot> |     <slot></slot> | ||||||
|     <VbenHelpTooltip v-if="help" trigger-class="size-3.5 ml-1"> |     <VbenHelpTooltip v-if="help" trigger-class="size-3.5 ml-1"> | ||||||
|  |  | ||||||
|  | @ -12,12 +12,7 @@ const collapsed = defineModel({ default: false }); | ||||||
| 
 | 
 | ||||||
| <template> | <template> | ||||||
|   <div |   <div | ||||||
|     :class=" |     :class="cn('vben-link inline-flex items-center', props.class)" | ||||||
|       cn( |  | ||||||
|         'text-primary hover:text-primary-hover inline-flex cursor-pointer items-center', |  | ||||||
|         props.class, |  | ||||||
|       ) |  | ||||||
|     " |  | ||||||
|     @click="collapsed = !collapsed" |     @click="collapsed = !collapsed" | ||||||
|   > |   > | ||||||
|     <slot :is-expanded="collapsed"> |     <slot :is-expanded="collapsed"> | ||||||
|  |  | ||||||
|  | @ -44,7 +44,7 @@ declare global { | ||||||
| const renderLink = (href: string, text: string) => | const renderLink = (href: string, text: string) => | ||||||
|   h( |   h( | ||||||
|     'a', |     'a', | ||||||
|     { href, target: '_blank', class: 'text-primary hover:text-primary-hover' }, |     { href, target: '_blank', class: 'vben-link' }, | ||||||
|     { default: () => text }, |     { default: () => text }, | ||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
|  | @ -114,11 +114,7 @@ const devDependenciesItems = Object.keys(devDependencies).map((key) => ({ | ||||||
|   <Page :title="title"> |   <Page :title="title"> | ||||||
|     <template #description> |     <template #description> | ||||||
|       <p class="text-foreground mt-3 text-sm leading-6"> |       <p class="text-foreground mt-3 text-sm leading-6"> | ||||||
|         <a |         <a :href="VBEN_GITHUB_URL" class="vben-link" target="_blank"> | ||||||
|           :href="VBEN_GITHUB_URL" |  | ||||||
|           class="text-primary hover:text-primary-hover" |  | ||||||
|           target="_blank" |  | ||||||
|         > |  | ||||||
|           {{ name }} |           {{ name }} | ||||||
|         </a> |         </a> | ||||||
|         {{ description }} |         {{ description }} | ||||||
|  |  | ||||||
|  | @ -120,7 +120,7 @@ onMounted(() => { | ||||||
| 
 | 
 | ||||||
|       <span |       <span | ||||||
|         v-if="showForgetPassword" |         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)" |         @click="handleGo(forgetPasswordPath)" | ||||||
|       > |       > | ||||||
|         {{ $t('authentication.forgetPassword') }} |         {{ $t('authentication.forgetPassword') }} | ||||||
|  | @ -169,7 +169,7 @@ onMounted(() => { | ||||||
|       <div v-if="showRegister" class="mt-3 text-center text-sm"> |       <div v-if="showRegister" class="mt-3 text-center text-sm"> | ||||||
|         {{ $t('authentication.accountTip') }} |         {{ $t('authentication.accountTip') }} | ||||||
|         <span |         <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)" |           @click="handleGo(registerPath)" | ||||||
|         > |         > | ||||||
|           {{ $t('authentication.createAccount') }} |           {{ $t('authentication.createAccount') }} | ||||||
|  |  | ||||||
|  | @ -107,10 +107,7 @@ function goToLogin() { | ||||||
|     </VbenButton> |     </VbenButton> | ||||||
|     <div class="mt-4 text-center text-sm"> |     <div class="mt-4 text-center text-sm"> | ||||||
|       {{ $t('authentication.alreadyHaveAccount') }} |       {{ $t('authentication.alreadyHaveAccount') }} | ||||||
|       <span |       <span class="vben-link text-sm font-normal" @click="goToLogin()"> | ||||||
|         class="text-primary hover:text-primary-hover cursor-pointer text-sm font-normal" |  | ||||||
|         @click="goToLogin()" |  | ||||||
|       > |  | ||||||
|         {{ $t('authentication.goToLogin') }} |         {{ $t('authentication.goToLogin') }} | ||||||
|       </span> |       </span> | ||||||
|     </div> |     </div> | ||||||
|  |  | ||||||
|  | @ -15,33 +15,6 @@ const routes: RouteRecordRaw[] = [ | ||||||
|     name: 'Examples', |     name: 'Examples', | ||||||
|     path: '/examples', |     path: '/examples', | ||||||
|     children: [ |     children: [ | ||||||
|       { |  | ||||||
|         name: 'ModalExample', |  | ||||||
|         path: '/examples/modal', |  | ||||||
|         component: () => import('#/views/examples/modal/index.vue'), |  | ||||||
|         meta: { |  | ||||||
|           icon: 'system-uicons:window-content', |  | ||||||
|           title: $t('examples.modal.title'), |  | ||||||
|         }, |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         name: 'DrawerExample', |  | ||||||
|         path: '/examples/drawer', |  | ||||||
|         component: () => import('#/views/examples/drawer/index.vue'), |  | ||||||
|         meta: { |  | ||||||
|           icon: 'iconoir:drawer', |  | ||||||
|           title: $t('examples.drawer.title'), |  | ||||||
|         }, |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         name: 'EllipsisExample', |  | ||||||
|         path: '/examples/ellipsis', |  | ||||||
|         component: () => import('#/views/examples/ellipsis/index.vue'), |  | ||||||
|         meta: { |  | ||||||
|           icon: 'ion:ellipsis-horizontal', |  | ||||||
|           title: $t('examples.ellipsis.title'), |  | ||||||
|         }, |  | ||||||
|       }, |  | ||||||
|       { |       { | ||||||
|         name: 'FormExample', |         name: 'FormExample', | ||||||
|         path: '/examples/form', |         path: '/examples/form', | ||||||
|  | @ -228,6 +201,33 @@ const routes: RouteRecordRaw[] = [ | ||||||
|           }, |           }, | ||||||
|         ], |         ], | ||||||
|       }, |       }, | ||||||
|  |       { | ||||||
|  |         name: 'ModalExample', | ||||||
|  |         path: '/examples/modal', | ||||||
|  |         component: () => import('#/views/examples/modal/index.vue'), | ||||||
|  |         meta: { | ||||||
|  |           icon: 'system-uicons:window-content', | ||||||
|  |           title: $t('examples.modal.title'), | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         name: 'DrawerExample', | ||||||
|  |         path: '/examples/drawer', | ||||||
|  |         component: () => import('#/views/examples/drawer/index.vue'), | ||||||
|  |         meta: { | ||||||
|  |           icon: 'iconoir:drawer', | ||||||
|  |           title: $t('examples.drawer.title'), | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         name: 'EllipsisExample', | ||||||
|  |         path: '/examples/ellipsis', | ||||||
|  |         component: () => import('#/views/examples/ellipsis/index.vue'), | ||||||
|  |         meta: { | ||||||
|  |           icon: 'ion:ellipsis-horizontal', | ||||||
|  |           title: $t('examples.ellipsis.title'), | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|     ], |     ], | ||||||
|   }, |   }, | ||||||
| ]; | ]; | ||||||
|  |  | ||||||
|  | @ -46,7 +46,7 @@ const formSchema = computed((): VbenFormSchema[] => { | ||||||
|         rules(values) { |         rules(values) { | ||||||
|           const { password } = values; |           const { password } = values; | ||||||
|           return z |           return z | ||||||
|             .string() |             .string({ required_error: $t('authentication.passwordTip') }) | ||||||
|             .min(1, { message: $t('authentication.passwordTip') }) |             .min(1, { message: $t('authentication.passwordTip') }) | ||||||
|             .refine((value) => value === password, { |             .refine((value) => value === password, { | ||||||
|               message: $t('authentication.confirmPasswordTip'), |               message: $t('authentication.confirmPasswordTip'), | ||||||
|  | @ -56,7 +56,6 @@ const formSchema = computed((): VbenFormSchema[] => { | ||||||
|       }, |       }, | ||||||
|       fieldName: 'confirmPassword', |       fieldName: 'confirmPassword', | ||||||
|       label: $t('authentication.confirmPassword'), |       label: $t('authentication.confirmPassword'), | ||||||
|       rules: z.string().min(1, { message: $t('authentication.passwordTip') }), |  | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       component: 'VbenCheckbox', |       component: 'VbenCheckbox', | ||||||
|  | @ -68,15 +67,10 @@ const formSchema = computed((): VbenFormSchema[] => { | ||||||
|             h( |             h( | ||||||
|               'a', |               'a', | ||||||
|               { |               { | ||||||
|                 class: |                 class: 'vben-link ml-1 ', | ||||||
|                   'cursor-pointer text-primary ml-1 hover:text-primary-hover', |  | ||||||
|                 href: '', |                 href: '', | ||||||
|               }, |               }, | ||||||
|               [ |               `${$t('authentication.privacyPolicy')} & ${$t('authentication.terms')}`, | ||||||
|                 $t('authentication.privacyPolicy'), |  | ||||||
|                 '&', |  | ||||||
|                 $t('authentication.terms'), |  | ||||||
|               ], |  | ||||||
|             ), |             ), | ||||||
|           ]), |           ]), | ||||||
|       }), |       }), | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Vben
						Vben