You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.9 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System.Collections.Generic;
namespace AI.Models.Form
{
/// <summary>
/// 表单字段定义(通用 schema仅定义不含当前值
/// 类型与常用属性对应number(min,max,step,default), string(maxLength,placeholder,default),
/// boolean(default), select(options[],default), multi-select(options[],default[])。
/// </summary>
public class FormField
{
/// <summary>字段唯一标识,对应参数名</summary>
public string Id { get; set; } = string.Empty;
/// <summary>显示名称</summary>
public string Label { get; set; } = string.Empty;
/// <summary>可选描述/提示</summary>
public string? Description { get; set; }
/// <summary>控件/值类型</summary>
public FormFieldType Type { get; set; }
/// <summary>是否必填</summary>
public bool Required { get; set; }
/// <summary>默认值(可选)</summary>
public object? DefaultValue { get; set; }
// ----- number -----
/// <summary>数值最小值Number</summary>
public double? Min { get; set; }
/// <summary>数值最大值Number</summary>
public double? Max { get; set; }
/// <summary>步长Number</summary>
public double? Step { get; set; }
// ----- string / text -----
/// <summary>最大长度Text/MultiLine</summary>
public int? MaxLength { get; set; }
/// <summary>占位提示Text/MultiLine</summary>
public string? Placeholder { get; set; }
// ----- select / multi-select -----
/// <summary>下拉/单选选项Choice多选选项MultiSelect</summary>
public List<string>? Options { get; set; }
/// <summary>多选默认值MultiSelect</summary>
public List<string>? DefaultValues { get; set; }
}
}