tfp
Version:
A Web UI framework for TaskBuilder
591 lines • 13.1 kB
JavaScript
export default {
"name": "DataSet",
"comment": "可编辑表格",
"cssFiles": "style.{bgColorMode}.pc.css",
"attrs": [
{
"name": "dataBindSetting",
"comment": "数据绑定设置",
"type": "group",
"items": [
{
"name": "loadDataService",
"comment": "加载数据服务",
"type": "Service"
},
{
"name": "dataBindingMember",
"comment": "绑定数据成员",
"type": "String"
}
]
},
{
"name": "columns",
"comment": "数据列设置",
"type": "Dataset",
"isPro": true,
"keyCol": "id",
"width": "640px",
"height": "600px",
"columns": [
{
"id": "id",
"name": "列ID",
"type": "String",
"required": true
},
{
"id": "name",
"name": "列名",
"type": "String"
},
{
"id": "type",
"name": "输入项类型",
"type": "Select",
"default": "text",
"options": [
{
"value": "text",
"text": "单行输入框"
},
{
"value": "select",
"text": "下拉列表"
},
{
"value": "switch",
"text": "开关"
},
{
"value": "date",
"text": "日期"
},
{
"value": "datetime",
"text": "日期时间"
},
{
"value": "password",
"text": "密码"
}
]
},
{
"id": "dataType",
"name": "数据类型",
"type": "Select",
"default": "text",
"options": [
{
"value": "text",
"text": "文本"
},
{
"value": "int",
"text": "整数"
},
{
"value": "float",
"text": "小数"
},
{
"value": "money",
"text": "金额"
}
]
},
{
"id": "width",
"name": "宽度",
"type": "Size"
},
{
"id": "readonly",
"name": "只读",
"type": "Switch"
},
{
"id": "required",
"name": "必填",
"type": "Switch"
},
{
"id": "hidden",
"name": "隐藏",
"type": "Switch"
},
{
"id": "default",
"name": "默认值",
"type": "String"
},
{
"id": "options",
"name": "可选值",
"type": "String",
"wrap": true
},
{
"id": "formula",
"name": "自动计算表达式",
"type": "String",
"wrap": true
}
]
},
{
"name": "keyCol",
"comment": "主键列",
"type": "String"
},
{
"name": "showAddButton",
"comment": "显示添加按钮",
"type": "Switch",
"default": true
},
{
"name": "addButtonText",
"comment": "添加按钮文本",
"type": "String",
"default": "添加"
},
{
"name": "showAddFromDialogButton",
"comment": "显示从弹窗选择添加",
"type": "Switch"
},
{
"name": "addFromDialogButtonText",
"comment": "弹窗选择按钮文本",
"type": "String",
"default": "弹窗选择"
},
{
"name": "addFromDialogPath",
"comment": "弹窗页面路径",
"type": "PathPicker",
"fileTypes": ["html", "tfp"]
},
{
"name": "addFromDialogWidth",
"comment": "弹窗宽度",
"type": "Int",
"default": 640
},
{
"name": "addFromDialogHeight",
"comment": "弹窗高度",
"type": "Int",
"default": 480
},
{
"name": "showCheckbox",
"comment": "显示选择框",
"type": "Switch"
},
{
"name": "enableDelete",
"comment": "允许删除",
"type": "Switch",
"default": true
}
],
"styles": ["size", "position", "background", "border", "margin", "other"],
"defaultStyles": {
"width": "100%",
"height": "200px",
"position": "relative",
"left": 0,
"top": 0
},
"events": [
{
"name": "onBeforeAddRow",
"comment": "添加行前",
"isNotHtmlEvent": true,
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int"
},
{
"name": "rowData",
"comment": "行数据",
"type": "Object"
}
]
}, {
"name": "onAfterAddRow",
"comment": "添加行后",
"isNotHtmlEvent": true,
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int"
},
{
"name": "rowData",
"comment": "行数据",
"type": "Object"
}
]
}, {
"name": "onRemoveRow",
"comment": "删除行时",
"isNotHtmlEvent": true,
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int"
}
]
},
{
"name": "onBeforeRemoveRow",
"comment": "删除行前",
"isNotHtmlEvent": true,
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int"
},
{
"name": "rowData",
"comment": "行数据",
"type": "Object"
}
]
},
{
"name": "onAfterRemoveRow",
"comment": "删除行后",
"isNotHtmlEvent": true,
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int"
},
{
"name": "rowData",
"comment": "行数据",
"type": "Object"
}
]
},
{
"name": "onCellDataChange",
"comment": "单元格数据发生变化时",
"isNotHtmlEvent": true,
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int"
},
{
"name": "colIndex",
"comment": "列索引",
"type": "Int"
},
{
"name": "cellData",
"comment": "单元格数据",
"type": "Object"
}
]
},
{
"name": "onCellClick",
"comment": "单击单元格时",
"isNotHtmlEvent": true,
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int"
},
{
"name": "colIndex",
"comment": "列索引",
"type": "Int"
},
{
"name": "cellData",
"comment": "单元格数据",
"type": "Object"
}
]
},
{
"name": "onCellDblClick",
"comment": "双击单元格时",
"isNotHtmlEvent": true,
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int"
},
{
"name": "colIndex",
"comment": "列索引",
"type": "Int"
},
{
"name": "cellData",
"comment": "单元格数据",
"type": "Object"
}
]
},
{
"name": "onCellFocus",
"comment": "单元格获得焦点时",
"isNotHtmlEvent": true,
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int"
},
{
"name": "colIndex",
"comment": "列索引",
"type": "Int"
},
{
"name": "cellData",
"comment": "单元格数据",
"type": "Object"
}
]
},
{
"name": "onCellBlur",
"comment": "单元格失去焦点时",
"isNotHtmlEvent": true,
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int"
},
{
"name": "colIndex",
"comment": "列索引",
"type": "Int"
},
{
"name": "cellData",
"comment": "单元格数据",
"type": "Object"
}
]
},
{
"name": "onCellKeyPress",
"comment": "单元格按键时",
"isNotHtmlEvent": true,
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int"
},
{
"name": "colIndex",
"comment": "列索引",
"type": "Int"
},
{
"name": "cellData",
"comment": "单元格数据",
"type": "Object"
}
]
}
],
"methods": [
{
"name": "addRow",
"comment": "添加行",
"args": [
{
"name": "data",
"comment": "行数据",
"type": "Object"
}
]
},
{
"name": "removeRow",
"comment": "删除行",
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int",
"required": true
}
]
},
{
"name": "checkAll",
"comment": "全选"
},
{
"name": "unCheckAll",
"comment": "取消全选"
},
{
"name": "checkRows",
"comment": "选中指定行",
"args": [
{
"name": "keys",
"comment": "要选中的键值",
"type": "Array",
"required": true
}
]
},
{
"name": "getCheckedRows",
"comment": "获得选中行的数据",
"args": [
{
"name": "cb",
"comment": "回调函数",
"type": "Function"
}
]
},
{
"name": "getRows",
"comment": "获得所有行的数据",
"args": [
{
"name": "options",
"comment": "选项",
"type": "Object"
},
{
"name": "cb",
"comment": "回调函数",
"type": "Function"
}
]
},
{
"name": "getRowDiv",
"comment": "获得指定行的div对象",
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int",
"required": true
}
]
},
{
"name": "setRow",
"comment": "设置行数据",
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int",
"required": true
},
{
"name": "rowData",
"comment": "行数据",
"type": "Object"
}
]
},
{
"name": "getCellData",
"comment": "获得指定单元格的数据",
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int",
"required": true
},
{
"name": "colIndex",
"comment": "列索引",
"type": "Int",
"required": true
}
]
},
{
"name": "getCellDiv",
"comment": "获得指定单元格的div对象",
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int",
"required": true
},
{
"name": "colIndex",
"comment": "列索引",
"type": "Int",
"required": true
}
]
},
{
"name": "setCellData",
"comment": "设置指定单元格的数据",
"args": [
{
"name": "rowIndex",
"comment": "行索引",
"type": "Int",
"required": true
},
{
"name": "colIndex",
"comment": "列索引",
"type": "Int",
"required": true
},
{
"name": "val",
"comment": "单元格数据",
"type": "String"
}
]
},
{
"name": "bindData",
"comment": "绑定数据",
"args": [
{
"name": "data",
"comment": "数据",
"type": "Object"
}
]
},
{
"name": "loadData",
"comment": "加载数据"
}
]
}