feat(form,form-schema): group list支持配置默认展开数量

This commit is contained in:
roymondchen 2025-06-06 20:13:34 +08:00
parent b72f4dae28
commit 6b4ca4b83a
2 changed files with 9 additions and 1 deletions

View File

@ -720,6 +720,12 @@ export interface GroupListConfig extends FormItem {
title?: string | FilterFunction<string>;
itemExtra?: string | FilterFunction<string>;
expandAll?: boolean;
/**
*
*
*
*/
defaultExpandQuantity?: number;
addable?: (mForm: FormState | undefined, data: any) => boolean | 'undefined' | boolean;
defaultAdd?: (mForm: FormState | undefined, data: any) => any;
delete?: (model: any, index: number | string | symbol, values: any) => boolean | boolean;

View File

@ -133,7 +133,9 @@ const props = defineProps<{
const emit = defineEmits(['swap-item', 'remove-item', 'change', 'addDiffCount', 'copy-item']);
const mForm = inject<FormState | undefined>('mForm');
const expand = ref(props.config.expandAll || !props.index);
const defaultExpandQuantity = props.config.defaultExpandQuantity ?? 7;
const expand = ref(props.config.expandAll || defaultExpandQuantity > props.index);
const rowConfig = computed(() => ({
type: 'row',