VTable
VTable copied to clipboard
[Feature] 将自定义渲染封装为自定义单元格类型
What problem does this feature solve?
在有的编辑器场景中,columns 配置会交给高级用户自行填写(VTable 已用于开源知识库应用太微 Tiddlywiki 的表格插件)
但标签渲染是一个常用的功能,如果每次都需要用单元格自定义渲染(CustomRender)去配置,会导致复制黏贴很长的配置项。希望我能将定义好的某种自定义渲染,例如标签字段 (如何为 tags 字段绘制标签丸 (圆角矩形)),封装为高级用户开箱即用的单元格类型,类似 link text,高级用户就能直接使用 cellType: 'tags', 了。
What does the proposed API look like?
tableInstance.registerCellType('tags', {
customRender(args) {
// use CustomLayout.Tag ...
}
} satisifies ColumnDefine)
希望与同editor一样的注册机制: VTable.register.cell('custom-cell', CustomCell);
目前我是硬编码了 https://github.com/tiddly-gittly/hyper-table/commit/0e5f89ae1a81af53221c0e7b08e7ebf440b81fba#diff-5057b788c7d0a82b8089b5d4e7f15c391232ed085848734a023f9809f69b2e21
if (column.field === 'tags') {
column.customLayout = (arguments_) => {
要是能注册就不用硬编码了,终端用户自由度更高