From 0a90dd3764b744409a199acc5332f04a0ddd8e68 Mon Sep 17 00:00:00 2001 From: paynezhuang Date: Tue, 7 May 2024 14:53:42 +0800 Subject: [PATCH] feat(projects): useTable adds expand to display --- src/hooks/common/table.ts | 10 ++++++++++ src/locales/langs/en-us.ts | 1 + src/locales/langs/zh-cn.ts | 1 + src/typings/app.d.ts | 1 + 4 files changed, 13 insertions(+) diff --git a/src/hooks/common/table.ts b/src/hooks/common/table.ts index 1a1cc13c5..5ac0e5e6d 100644 --- a/src/hooks/common/table.ts +++ b/src/hooks/common/table.ts @@ -20,6 +20,8 @@ export function useTable(config: NaiveUI.NaiveTabl const SELECTION_KEY = '__selection__'; + const EXPAND_KEY = '__expand__'; + const { loading, empty, @@ -68,6 +70,12 @@ export function useTable(config: NaiveUI.NaiveTabl title: $t('common.check'), checked: true }); + } else if (column.type === 'expand') { + checks.push({ + key: EXPAND_KEY, + title: $t('common.expandColumn'), + checked: true + }); } }); @@ -81,6 +89,8 @@ export function useTable(config: NaiveUI.NaiveTabl columnMap.set(column.key as string, column); } else if (column.type === 'selection') { columnMap.set(SELECTION_KEY, column); + } else if (column.type === 'expand') { + columnMap.set(EXPAND_KEY, column); } }); diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 400567900..81508a56f 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -11,6 +11,7 @@ const local: App.I18n.Schema = { cancel: 'Cancel', close: 'Close', check: 'Check', + expandColumn: 'Expand Column', columnSetting: 'Column Setting', config: 'Config', confirm: 'Confirm', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 71f072144..f5ba30e40 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -11,6 +11,7 @@ const local: App.I18n.Schema = { cancel: '取消', close: '关闭', check: '勾选', + expandColumn: '展开列', columnSetting: '列设置', config: '配置', confirm: '确认', diff --git a/src/typings/app.d.ts b/src/typings/app.d.ts index e0dbe7666..e1b4b1eed 100644 --- a/src/typings/app.d.ts +++ b/src/typings/app.d.ts @@ -261,6 +261,7 @@ declare namespace App { cancel: string; close: string; check: string; + expandColumn: string; columnSetting: string; config: string; confirm: string;