From 19a2885cb3f9af52290b2491e642afa7f38e1313 Mon Sep 17 00:00:00 2001 From: Artea Date: Sun, 5 Jan 2025 10:45:12 +0800 Subject: [PATCH 1/3] docs(data-table): merge-cell ts demo Signed-off-by: Artea --- src/data-table/demos/enUS/index.demo-entry.md | 2 +- ...merge-cell.demo.md => merge-cell.demo.vue} | 56 +++++++++++++------ src/data-table/demos/zhCN/index.demo-entry.md | 2 +- ...merge-cell.demo.md => merge-cell.demo.vue} | 54 ++++++++++++------ 4 files changed, 76 insertions(+), 38 deletions(-) rename src/data-table/demos/enUS/{merge-cell.demo.md => merge-cell.demo.vue} (73%) rename src/data-table/demos/zhCN/{merge-cell.demo.md => merge-cell.demo.vue} (75%) diff --git a/src/data-table/demos/enUS/index.demo-entry.md b/src/data-table/demos/enUS/index.demo-entry.md index 87a34fcdc1b..2bb2edbf662 100644 --- a/src/data-table/demos/enUS/index.demo-entry.md +++ b/src/data-table/demos/enUS/index.demo-entry.md @@ -26,7 +26,7 @@ empty.vue border.vue size.vue row-props.vue -merge-cell +merge-cell.vue filter-and-sorter pagination-behavior-on-filter.vue multiple-sorter diff --git a/src/data-table/demos/enUS/merge-cell.demo.md b/src/data-table/demos/enUS/merge-cell.demo.vue similarity index 73% rename from src/data-table/demos/enUS/merge-cell.demo.md rename to src/data-table/demos/enUS/merge-cell.demo.vue index 035d8f11cc6..ebae2217def 100644 --- a/src/data-table/demos/enUS/merge-cell.demo.md +++ b/src/data-table/demos/enUS/merge-cell.demo.vue @@ -1,24 +1,35 @@ + # Merge cell Set colspan and rowspan by setting `colSpan` and `rowSpan` of column object. Set colspan in header by setting `titleColSpan` of column object. + -```html - -``` - -```js + + + diff --git a/src/data-table/demos/zhCN/index.demo-entry.md b/src/data-table/demos/zhCN/index.demo-entry.md index 73978e01842..cc338965178 100644 --- a/src/data-table/demos/zhCN/index.demo-entry.md +++ b/src/data-table/demos/zhCN/index.demo-entry.md @@ -28,7 +28,7 @@ empty.vue border.vue size.vue row-props.vue -merge-cell +merge-cell.vue filter-and-sorter pagination-behavior-on-filter.vue multiple-sorter diff --git a/src/data-table/demos/zhCN/merge-cell.demo.md b/src/data-table/demos/zhCN/merge-cell.demo.vue similarity index 75% rename from src/data-table/demos/zhCN/merge-cell.demo.md rename to src/data-table/demos/zhCN/merge-cell.demo.vue index 8f9afebe4d4..6a74c1731c5 100644 --- a/src/data-table/demos/zhCN/merge-cell.demo.md +++ b/src/data-table/demos/zhCN/merge-cell.demo.vue @@ -1,21 +1,31 @@ + # 合并单元格 设定列的 `colSpan` 和 `rowSpan` 来控制单元格的 `colspan` 和 `rowspan`。设定列的 `titleColSpan` 控制表头的 colspan。 + -```html - -``` - -```js + + + From 049d4d46a34a8f9df84885c0ef9888961db05e24 Mon Sep 17 00:00:00 2001 From: Artea Date: Sun, 5 Jan 2025 15:29:02 +0800 Subject: [PATCH 2/3] docs(data-table): render-header ts demo Signed-off-by: Artea --- src/data-table/demos/enUS/index.demo-entry.md | 2 +- src/data-table/demos/enUS/merge-cell.demo.vue | 10 ++--- ...-header.demo.md => render-header.demo.vue} | 40 +++++++++++++------ src/data-table/demos/zhCN/index.demo-entry.md | 2 +- src/data-table/demos/zhCN/merge-cell.demo.vue | 10 ++--- ...-header.demo.md => render-header.demo.vue} | 40 +++++++++++++------ 6 files changed, 66 insertions(+), 38 deletions(-) rename src/data-table/demos/enUS/{render-header.demo.md => render-header.demo.vue} (60%) rename src/data-table/demos/zhCN/{render-header.demo.md => render-header.demo.vue} (59%) diff --git a/src/data-table/demos/enUS/index.demo-entry.md b/src/data-table/demos/enUS/index.demo-entry.md index 2bb2edbf662..31b33e6f975 100644 --- a/src/data-table/demos/enUS/index.demo-entry.md +++ b/src/data-table/demos/enUS/index.demo-entry.md @@ -45,7 +45,7 @@ summary.vue ellipsis.vue ellipsis-tooltip.vue expand.vue -render-header +render-header.vue custom-style.vue ajax-usage virtual.vue diff --git a/src/data-table/demos/enUS/merge-cell.demo.vue b/src/data-table/demos/enUS/merge-cell.demo.vue index ebae2217def..f4b3bc59957 100644 --- a/src/data-table/demos/enUS/merge-cell.demo.vue +++ b/src/data-table/demos/enUS/merge-cell.demo.vue @@ -9,7 +9,7 @@ import type { DataTableColumns } from 'naive-ui' import { NButton, NTag, useMessage } from 'naive-ui' import { defineComponent, h } from 'vue' -interface RawData { +interface RowData { key: number name: string age: number @@ -18,14 +18,14 @@ interface RawData { } interface SendMail { - (rowData: RawData): void + (rowData: RowData): void } function createColumns({ sendMail }: { sendMail: SendMail -}): DataTableColumns { +}): DataTableColumns { return [ { title: 'Name', @@ -84,7 +84,7 @@ function createColumns({ ] } -function createData(): RawData[] { +function createData(): RowData[] { return [ { key: 0, @@ -113,7 +113,7 @@ function createData(): RawData[] { export default defineComponent({ setup() { const message = useMessage() - function sendMail(rowData: RawData) { + function sendMail(rowData: RowData) { message.info(`send mail to ${rowData.name}`) } return { diff --git a/src/data-table/demos/enUS/render-header.demo.md b/src/data-table/demos/enUS/render-header.demo.vue similarity index 60% rename from src/data-table/demos/enUS/render-header.demo.md rename to src/data-table/demos/enUS/render-header.demo.vue index 27cf20c692c..6dc5796deda 100644 --- a/src/data-table/demos/enUS/render-header.demo.md +++ b/src/data-table/demos/enUS/render-header.demo.vue @@ -1,25 +1,34 @@ + # Customized column header rendering + -```html - -``` - -```js + + + diff --git a/src/data-table/demos/zhCN/index.demo-entry.md b/src/data-table/demos/zhCN/index.demo-entry.md index cc338965178..24dea2407f7 100644 --- a/src/data-table/demos/zhCN/index.demo-entry.md +++ b/src/data-table/demos/zhCN/index.demo-entry.md @@ -47,7 +47,7 @@ summary.vue ellipsis.vue ellipsis-tooltip.vue expand.vue -render-header +render-header.vue custom-style.vue ajax-usage virtual.vue diff --git a/src/data-table/demos/zhCN/merge-cell.demo.vue b/src/data-table/demos/zhCN/merge-cell.demo.vue index 6a74c1731c5..4fc027590ba 100644 --- a/src/data-table/demos/zhCN/merge-cell.demo.vue +++ b/src/data-table/demos/zhCN/merge-cell.demo.vue @@ -9,7 +9,7 @@ import type { DataTableColumns } from 'naive-ui' import { NButton, NTag, useMessage } from 'naive-ui' import { defineComponent, h } from 'vue' -interface RawData { +interface RowData { key: number name: string age: number @@ -18,14 +18,14 @@ interface RawData { } interface SendMail { - (rowData: RawData): void + (rowData: RowData): void } function createColumns({ sendMail }: { sendMail: SendMail -}): DataTableColumns { +}): DataTableColumns { return [ { title: 'Name', @@ -84,7 +84,7 @@ function createColumns({ ] } -function createData(): RawData[] { +function createData(): RowData[] { return [ { key: 0, @@ -113,7 +113,7 @@ function createData(): RawData[] { export default defineComponent({ setup() { const message = useMessage() - function sendMail(rowData: RawData) { + function sendMail(rowData: RowData) { message.info(`send mail to ${rowData.name}`) } return { diff --git a/src/data-table/demos/zhCN/render-header.demo.md b/src/data-table/demos/zhCN/render-header.demo.vue similarity index 59% rename from src/data-table/demos/zhCN/render-header.demo.md rename to src/data-table/demos/zhCN/render-header.demo.vue index ad6e984ca79..f5af0063ba2 100644 --- a/src/data-table/demos/zhCN/render-header.demo.md +++ b/src/data-table/demos/zhCN/render-header.demo.vue @@ -1,25 +1,34 @@ + # 自定义渲染列头 + -```html - -``` - -```js + + + From 923a5d924f169ea867aa2440b208bf06d4baea18 Mon Sep 17 00:00:00 2001 From: Artea Date: Sun, 5 Jan 2025 16:48:49 +0800 Subject: [PATCH 3/3] docs(data-table): switchable-editable ts demo Signed-off-by: Artea --- src/data-table/demos/enUS/index.demo-entry.md | 2 +- ...e.demo.md => switchable-editable.demo.vue} | 72 +++++++++++-------- src/data-table/demos/zhCN/index.demo-entry.md | 2 +- ...e.demo.md => switchable-editable.demo.vue} | 69 +++++++++++------- 4 files changed, 87 insertions(+), 58 deletions(-) rename src/data-table/demos/enUS/{switchable-editable.demo.md => switchable-editable.demo.vue} (67%) rename src/data-table/demos/zhCN/{switchable-editable.demo.md => switchable-editable.demo.vue} (67%) diff --git a/src/data-table/demos/enUS/index.demo-entry.md b/src/data-table/demos/enUS/index.demo-entry.md index 31b33e6f975..4fba767196b 100644 --- a/src/data-table/demos/enUS/index.demo-entry.md +++ b/src/data-table/demos/enUS/index.demo-entry.md @@ -55,7 +55,7 @@ tree.vue flex-height.vue striped.vue simple-editable.vue -switchable-editable +switchable-editable.vue context-menu.vue async-expand.vue render-cell.vue diff --git a/src/data-table/demos/enUS/switchable-editable.demo.md b/src/data-table/demos/enUS/switchable-editable.demo.vue similarity index 67% rename from src/data-table/demos/enUS/switchable-editable.demo.md rename to src/data-table/demos/enUS/switchable-editable.demo.vue index 21e4afbf669..5a9b615ba2f 100644 --- a/src/data-table/demos/enUS/switchable-editable.demo.md +++ b/src/data-table/demos/enUS/switchable-editable.demo.vue @@ -1,20 +1,25 @@ + # Switchable Editable Table + -```html - -``` - -```js + + + diff --git a/src/data-table/demos/zhCN/index.demo-entry.md b/src/data-table/demos/zhCN/index.demo-entry.md index 24dea2407f7..f25af678ec4 100644 --- a/src/data-table/demos/zhCN/index.demo-entry.md +++ b/src/data-table/demos/zhCN/index.demo-entry.md @@ -57,7 +57,7 @@ tree.vue flex-height.vue striped.vue simple-editable.vue -switchable-editable +switchable-editable.vue context-menu.vue async-expand.vue render-cell.vue diff --git a/src/data-table/demos/zhCN/switchable-editable.demo.md b/src/data-table/demos/zhCN/switchable-editable.demo.vue similarity index 67% rename from src/data-table/demos/zhCN/switchable-editable.demo.md rename to src/data-table/demos/zhCN/switchable-editable.demo.vue index 5531dcb092f..39751f22ec0 100644 --- a/src/data-table/demos/zhCN/switchable-editable.demo.md +++ b/src/data-table/demos/zhCN/switchable-editable.demo.vue @@ -1,20 +1,25 @@ + # 可切换的可编辑表格 + -```html - -``` - -```js + + +