Allow optional ComponentOption.displayName (fix #2809)

This commit is contained in:
the1812 2022-01-15 16:21:18 +08:00
parent b8ac07b1f9
commit c58f75163e
2 changed files with 6 additions and 10 deletions

View File

@ -97,7 +97,7 @@ export default {
},
displayName: {
type: String,
required: true,
default: '',
},
option: {
type: Object,

View File

@ -37,25 +37,21 @@ type ComponentOptionValidator<T> = (value: T) => T | undefined | null
*/
export interface ComponentOption {
/** 默认值 */
defaultValue: any
defaultValue: unknown
/** 显示名称 */
displayName: string
/** 如果希望这个选项显示为一个下拉框, 可以用相应的`enum`提供下拉框的选值, 或者也可以传入`string[]` */
dropdownEnum?: any
displayName?: string
/** 如果希望这个选项显示为一个下拉框, 可以用相应的 `enum` 提供下拉框的选值, 或者也可以传入 `string[]` */
dropdownEnum?: unknown
/** 是否不显示在设置面板中(不自动生成选项UI) */
hidden?: boolean
/** 设为`true`时, 将用颜色选取器替代文本框 */
/** 设为 `true` 时, 将用颜色选取器替代文本框 */
color?: boolean
/** 设为`true`时, 表示选项为多个`boolean`开关, 将显示为选择框列表 */
switches?: boolean
/** 设置范围, 可以显示为一个滑动条 */
slider?: {
min?: number
max?: number
step?: number
}
// /** 与`switches`选项配合使用, 设为`true`时, 用<RadioButton>替代<CheckBox>进行单选限制 */
// radio?: boolean
/** `number`, `string`或`Range`类型的选项, 可以添加验证函数来阻止非法输入 */
validator?: ComponentOptionValidator<Range<string>> |
ComponentOptionValidator<string> | ComponentOptionValidator<number>