1
0
mirror of synced 2026-02-04 18:47:57 +08:00

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',