Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into antdv-next

This commit is contained in:
dap
2026-02-03 10:30:21 +08:00
13 changed files with 62 additions and 47 deletions

View File

@@ -6,12 +6,30 @@ import type {
import { computed, ref, watch } from 'vue';
import { isBoolean, isFunction } from '@vben-core/shared/utils';
import { get, isBoolean, isFunction } from '@vben-core/shared/utils';
import { useFormValues } from 'vee-validate';
import { injectRenderFormProps } from './context';
/**
* 解析Nested Objects对应的字段值
* @param values 表单值
* @param fieldName 字段名
*/
function resolveValueByFieldName(
values: Record<string, any>,
fieldName: string,
) {
// vee-validate[] 表示禁用嵌套
if (fieldName.startsWith('[') && fieldName.endsWith(']')) {
const rawKey = fieldName.slice(1, -1);
return values[rawKey];
}
return get(values, fieldName);
}
export default function useDependencies(
getDependencies: () => FormItemDependencies | undefined,
) {
@@ -37,7 +55,7 @@ export default function useDependencies(
// 该字段可能会被多个字段触发
const triggerFields = getDependencies()?.triggerFields ?? [];
return triggerFields.map((dep) => {
return values.value[dep];
return resolveValueByFieldName(values.value, dep);
});
});

View File

@@ -53,6 +53,7 @@ const wrapperClass = computed(() => {
provideFormRenderProps(props);
// @ts-expect-error unused
const { isCalculated, keepFormItemIndex, wrapperRef } = useExpandable(props);
const shapes = computed(() => {

View File

@@ -26,8 +26,8 @@ interface Props {
const props = withDefaults(defineProps<Props>(), {});
const { contentElement: _contentElement, overlayStyle } =
useLayoutContentStyle();
// @ts-expect-error unused
const { contentElement, overlayStyle } = useLayoutContentStyle();
const style = computed((): CSSProperties => {
const {
@@ -56,11 +56,7 @@ const style = computed((): CSSProperties => {
</script>
<template>
<main
ref="_contentElement"
:style="style"
class="relative bg-background-deep"
>
<main ref="contentElement" :style="style" class="relative bg-background-deep">
<Slot :style="overlayStyle">
<slot name="overlay"></slot>
</Slot>

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { CSSProperties } from 'vue';
import { computed, useSlots, watchEffect } from 'vue';
import { computed, shallowRef, useSlots, watchEffect } from 'vue';
import { VbenScrollbar } from '@vben-core/shadcn-ui';
@@ -114,7 +114,8 @@ const extraVisible = defineModel<boolean>('extraVisible');
const isLocked = useScrollLock(document.body);
const slots = useSlots();
// const asideRef = shallowRef<HTMLDivElement | null>();
// @ts-expect-error unused
const asideRef = shallowRef<HTMLDivElement | null>();
const hiddenSideStyle = computed((): CSSProperties => calcMenuWidthStyle(true));
@@ -290,6 +291,7 @@ function handleMouseleave() {
/>
<div
v-if="isSidebarMixed"
ref="asideRef"
:class="{
'border-l': extraVisible,
}"

View File

@@ -54,7 +54,8 @@ const components = globalShareState.getComponents();
const id = useId();
provide('DISMISSABLE_DRAWER_ID', id);
// const wrapperRef = ref<HTMLElement>();
// @ts-expect-error unused
const wrapperRef = ref<HTMLElement>();
const { $t } = useSimpleLocale();
const { isMobile } = useIsMobile();
@@ -282,6 +283,7 @@ const getForceMount = computed(() => {
</VisuallyHidden>
</template>
<div
ref="wrapperRef"
:class="
cn('relative flex-1 overflow-y-auto p-3', contentClass, {
'pointer-events-none': showLoading || submitting,

View File

@@ -50,10 +50,12 @@ const props = withDefaults(defineProps<Props>(), {
const components = globalShareState.getComponents();
const contentRef = ref();
// const wrapperRef = ref<HTMLElement>();
// @ts-expect-error unused
const wrapperRef = ref<HTMLElement>();
const dialogRef = ref();
const headerRef = ref();
// const footerRef = ref();
// @ts-expect-error unused
const footerRef = ref();
const id = useId();
@@ -306,6 +308,7 @@ function handleClosed() {
</VisuallyHidden>
</DialogHeader>
<div
ref="wrapperRef"
:class="
cn('relative min-h-40 flex-1 overflow-y-auto p-3', contentClass, {
'pointer-events-none': showLoading || submitting,
@@ -325,6 +328,7 @@ function handleClosed() {
</VbenIconButton>
<DialogFooter
ref="footerRef"
v-if="showFooter"
:class="
cn(

View File

@@ -97,6 +97,7 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
mergedOptions.onClosed = () => {
onClosed?.();
if (mergedOptions.destroyOnClose) {
injectData.consumed = false;
injectData.reCreateModal?.();
}
};

View File

@@ -3,7 +3,7 @@ import type { TabDefinition } from '@vben-core/typings';
import type { TabConfig, TabsProps } from '../../types';
import { computed } from 'vue';
import { computed, ref } from 'vue';
import { Pin, X } from '@vben-core/icons';
import { VbenContextMenu, VbenIcon } from '@vben-core/shadcn-ui';
@@ -28,8 +28,10 @@ const emit = defineEmits<{
}>();
const active = defineModel<string>('active');
// const contentRef = ref();
// const tabRef = ref();
// @ts-expect-error unused
const contentRef = ref();
// @ts-expect-error unused
const tabRef = ref();
const style = computed(() => {
const { gap } = props;
@@ -73,6 +75,7 @@ function onMouseDown(e: MouseEvent, tab: TabConfig) {
<template>
<div
ref="contentRef"
:class="contentClass"
:style="style"
class="tabs-chrome !flex h-full w-max overflow-y-hidden pr-6"
@@ -81,6 +84,7 @@ function onMouseDown(e: MouseEvent, tab: TabConfig) {
<div
v-for="(tab, i) in tabsView"
:key="tab.key"
ref="tabRef"
:class="[
{
'is-active': tab.key === active,

View File

@@ -29,7 +29,8 @@ const forward = useForwardPropsEmits(props, emit);
const {
handleScrollAt,
handleWheel,
scrollbarRef: _scrollbarRef,
// @ts-expect-error unused
scrollbarRef,
scrollDirection,
scrollIsAtLeft,
scrollIsAtRight,
@@ -69,7 +70,7 @@ useTabsDrag(props, emit);
class="size-full flex-1 overflow-hidden"
>
<VbenScrollbar
ref="_scrollbarRef"
ref="scrollbarRef"
:shadow-bottom="false"
:shadow-top="false"
class="h-full"