testGBP/types/widgetLibTypes.d.ts

414 lines
9.1 KiB
TypeScript
Raw Normal View History

2025-04-23 11:13:02 +08:00
/**
* ;
*/
type WidgetGroupType =
| 'layout' // 布局: 布局类控件,一般都有插槽
| 'action' // 操作: 操作按钮类控件,也包含按钮发起弹窗类
| 'form' // 表单: 表单类控件; 如editor, formTable
| 'basic' // 基础: 基础常用的控件;如:文本、图片、图标等
| 'chart' // 图表:图表类控件
| 'advanced' // 高级: 不常用的高级控件
/**
* , ;
*/
type CategoryType =
| 'layout' // 布局: 布局类控件,一般都有插槽
| 'action' // 操作: 操作按钮类控件,也包含按钮发起弹窗类
| 'form' // 表单: 表单类控件; 如editor, formTable
| 'basic' // 基础: 基础常用的控件;如:文本、图片、图标等
| 'advanced' // 高级: 不常用的高级控件兼容旧类型normalVue、others流程
/**
*
*/
type PropGroupType = {
type: 'prop' | 'event' // "属性面板" 、"动作面板"
name: string // 分组编码,唯一且不可重复
label: string // 分组展示名称
visiableLabel: boolean // 是否显示该分组名称如果为false则直接显示对应的属性一般只在第一个分组时出现设置为false的情况
}
/**
* 使
*/
type EditorType =
| 'string' // 单行文本输入
| 'date' // 单个日期选择
| 'dateRange' // 日期范围选择
| 'dict' // 字典选择
| 'enum' // Select枚举选择
| 'number' // 数字输入
| 'text' // 多行文本输入
| 'file' // 文件上传
| 'lookup' // 树形下拉选择
| 'numberRange' // 数字范围输入
| 'bool' // 布尔选择
| 'geo' // 地图选择
| 'expr' // 表达式输入
| 'icon' // 图标选择
| 'events' // 事件动作面板
| 'dataSource' // 数据源选择
| 'field' // 字段级联选择
| 'cascader' // 级联选择器
| 'object' // 对象嵌套属性编辑
/**
*
*/
type EventHanderParamType = {
/**
*
*/
name: string
/**
*
*/
label: string
/**
*
*/
description?: string
}
/**
*
*/
type EventsEditorOptionType = {
/**
* click, mouseover等
*/
name: string
/**
*
*/
label: string
/**
*
*/
params?: EventHanderParamType[]
/**
*
*/
description?: string
}
/**
*
*/
type DataSourceType = {
/**
* (DataProvider的name属性)
*/
name: string
/**
*
*/
type: 'doc' | 'ajax' | 'json'
/**
*
*/
queryDef?: {
/**
* url地址
*/
url: string
/**
*
*/
method: string
/**
*
*/
params: object
}
/**
*
*/
initialData?: unknown[]
}
/**
*
*/
type CascaderEditorOptionType = {
/**
*
*/
dataSource: DataSourceType
/**
*
*/
resDataProp?: string
/**
* label和value值
*/
dataOptions?: {
labelKey: string
valueKey: string
}
/**
* desc中其他设定值
*/
propMappings?: {
/**
* key为desc中key值value为接口返回字段key值
*/
[propname: string]: string
}
}
/**
*
*/
type WidgetPropMatchCondition = {
/**
*
*/
propName: string
/**
*
*/
propValue: any
}
/**
*
*/
type OverrideDefaultValueConfig = {
/**
*
*/
condition: WidgetPropMatchCondition[] | null
/**
*
*/
defaultValue: any
}
/**
*
*/
type MatchClosetWidget = {
/**
*
*/
name: string
/**
*
*/
isParent: boolean
/**
*
*/
overridePropConfig: OverrideDefaultValueConfig
}
/**
*
*/
type OverrideDefaultValueInClosestWidgets = {
/**
*
*/
closestWidgets: MatchClosetWidget[]
/**
*
*/
name: string
/**
*
*/
overridePropConfig: object
/**
*
*/
condition?: unknown[]
/**
*
*/
defaultValue?: string | number | boolean | object | null
}
/**
*
*/
type PropType = {
/**
* Vue组件props的属性名
*/
name: string
/**
*
*/
label: string
/**
*
*/
required?: boolean
/**
* 使 type Editor
*/
editorType: EditorType
/**
* enum
*/
editorOptions?:
| object
| any[]
| PropType[]
| CascaderEditorOptionType[]
| EventsEditorOptionType[]
| OverrideDefaultValueInClosestWidgets[]
/**
*
*/
type: 'string' | 'number' | 'boolean' | 'object' | 'function' | 'array' | 'date'
/**
*
*/
defaultValue?: string | number | boolean | object | null
/**
*
*/
description?: string
/**
*
*/
group?: PropGroupType['name']
/**
* ,
*/
visible?: boolean | string
/**
*
*/
readonly?: boolean | string
/**
* applet元数据中
*/
notSaveDesc?: boolean | string
}
/**
*
*/
type SlotType = {
/**
* Vue组件slot名称
*/
name: string
/**
*
*/
acceptCategory: CategoryType[]
/**
*
*/
label: string
/**
*
*/
description?: string
/**
* 使
*/
type?: string
}
/**
*
*/
type WidgetType = {
/**
* Vue组件名
*/
name: string
/**
* './path/to/file'
*/
exposePath: string
/**
*
*/
label: string
/**
* class
*/
icon: string
/**
*
*/
category: CategoryType
/**
* null为所有引擎都适用
*/
matchCores: string[] | null
/**
* null为所有视图都适用category为view时view暂不支持嵌套
*/
matchViews?: string[] | null
/**
*
*/
props?: PropType[]
/**
*
*/
slots?: SlotType[]
/**
*
*/
description?: string
/**
* true 100%
*/
isNoneSibling?: boolean
/**
* type
* 1Vue extends继承父控件的方式开发
* 2props中无须定义父控件的属性
*/
parentName?: string
}
/**
*
*/
export type WidgetLibType = {
/**
*
*/
name: string
/**
* import
*/
packageName: string
/**
* 使
*/
workspace: string
/**
* Map归纳
*/
widgets: {
[group in WidgetGroupType]?: WidgetType[]
}
/**
*
*/
description?: string
/**
*
*/
label?: string
/**
*
*/
url?: string
/**
* group值为basic和advanced的属性group字段的属性不予展示
*/
groups?: PropGroupType[]
}