From 5290ed5cdcb4d76d7394b32615b2461324ccb4c1 Mon Sep 17 00:00:00 2001
From: gimmyhehe <975402925@qq.com>
Date: Wed, 10 Sep 2025 10:51:28 +0800
Subject: [PATCH] docs(grid): add grid customs doc and demo
---
examples/sites/demos/apis/grid.js | 26 +++++++
.../default-customs-composition-api.vue | 66 ++++++++++++++++
.../app/grid/custom/default-customs.spec.ts | 9 +++
.../pc/app/grid/custom/default-customs.vue | 75 +++++++++++++++++++
.../demos/pc/app/grid/webdoc/grid-custom.js | 11 +++
.../demos/pc/app/grid/webdoc/grid-editor.js | 4 +-
6 files changed, 189 insertions(+), 2 deletions(-)
create mode 100644 examples/sites/demos/pc/app/grid/custom/default-customs-composition-api.vue
create mode 100644 examples/sites/demos/pc/app/grid/custom/default-customs.spec.ts
create mode 100644 examples/sites/demos/pc/app/grid/custom/default-customs.vue
diff --git a/examples/sites/demos/apis/grid.js b/examples/sites/demos/apis/grid.js
index f1b60b399c..1856024f71 100644
--- a/examples/sites/demos/apis/grid.js
+++ b/examples/sites/demos/apis/grid.js
@@ -159,6 +159,19 @@ export default {
mode: ['pc', 'mobile-first'],
pcDemo: 'grid-faq#custom-column'
},
+ {
+ name: 'customs',
+ typeAnchorName: 'ICustomConfig',
+ type: 'ICustomConfig[]',
+ defaultValue: '',
+ desc: {
+ 'zh-CN': '表格的初始化个性配置,可以控制表格列是否隐藏,设置列宽。优先级高于grid-column上的配置。',
+ 'en-US':
+ 'Initialize the table personalized configuration to control whether the table columns are hidden and set the column width. It takes precedence over the configuration on grid-column.'
+ },
+ mode: ['pc', 'mobile-first'],
+ pcDemo: 'grid-faq#custom-column'
+ },
{
name: 'data',
typeAnchorName: 'IRow',
@@ -4212,6 +4225,19 @@ interface ICellClassNameArgs {
// 单元格所在行的序号
seq: number
$seq: string // 已弃用
+}`
+ },
+ {
+ name: 'ICustomConfig',
+ type: 'type',
+ code: `
+interface ICustomConfig {
+ // 表格列字段
+ property: string
+ // 是否显示
+ visible?: boolean
+ // 列宽
+ width?: number | string
}`
}
]
diff --git a/examples/sites/demos/pc/app/grid/custom/default-customs-composition-api.vue b/examples/sites/demos/pc/app/grid/custom/default-customs-composition-api.vue
new file mode 100644
index 0000000000..d990b18de9
--- /dev/null
+++ b/examples/sites/demos/pc/app/grid/custom/default-customs-composition-api.vue
@@ -0,0 +1,66 @@
+
+
在 grid 标签上配置 customs 可以设置表格的初始化个性配置,可以控制表格列的隐藏,列宽等。
Configure resizable="true" on the grid tag to adjust the column width, and configure resizable="{storage: true}" on the toolbar tag to save the column width in localStorage on the local host. The column width of the table on the refreshed page is displayed based on the column width after being dragged.
通过在 grid 标签上配置 edit-config。在 grid-column 列配置 editor 对象, component 渲染内置编辑组件, events 配置组件事件。
通过在 grid 标签上配置 edit-config。在 grid-column 列配置 editor 对象, component 渲染内置编辑组件,attrs配置组件的属性, events 配置组件事件。
特别说明:
内置编辑器只支持 Input 和 Select 组件且均为浏览器原生组件并非 TinyVue 组件,需要使用其他组件可参考自定义编辑器。
grid 标签上配置 edit-config。\n在 grid-column 列配置 editor 对象, component 渲染自定义编辑组件或者 TinyVue 提供的组件。
grid 标签上配置 edit-config。\n在 grid-column 列配置 editor 对象, component 渲染自定义编辑组件或者 TinyVue 提供的组件。attrs配置组件的属性, events 配置组件事件。
Introduces the TinyVue Select component through attribute configuration.