Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin
This commit is contained in:
@@ -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();
|
||||
}
|
||||
},
|
||||
|
@@ -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,
|
||||
)
|
||||
|
@@ -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">
|
||||
|
@@ -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"
|
||||
|
Reference in New Issue
Block a user