Skip to content

Commit 0a90dd3

Browse files
committed
feat(projects): useTable adds expand to display
1 parent 60f3b14 commit 0a90dd3

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

src/hooks/common/table.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export function useTable<A extends NaiveUI.TableApiFn>(config: NaiveUI.NaiveTabl
2020

2121
const SELECTION_KEY = '__selection__';
2222

23+
const EXPAND_KEY = '__expand__';
24+
2325
const {
2426
loading,
2527
empty,
@@ -68,6 +70,12 @@ export function useTable<A extends NaiveUI.TableApiFn>(config: NaiveUI.NaiveTabl
6870
title: $t('common.check'),
6971
checked: true
7072
});
73+
} else if (column.type === 'expand') {
74+
checks.push({
75+
key: EXPAND_KEY,
76+
title: $t('common.expandColumn'),
77+
checked: true
78+
});
7179
}
7280
});
7381

@@ -81,6 +89,8 @@ export function useTable<A extends NaiveUI.TableApiFn>(config: NaiveUI.NaiveTabl
8189
columnMap.set(column.key as string, column);
8290
} else if (column.type === 'selection') {
8391
columnMap.set(SELECTION_KEY, column);
92+
} else if (column.type === 'expand') {
93+
columnMap.set(EXPAND_KEY, column);
8494
}
8595
});
8696

src/locales/langs/en-us.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const local: App.I18n.Schema = {
1111
cancel: 'Cancel',
1212
close: 'Close',
1313
check: 'Check',
14+
expandColumn: 'Expand Column',
1415
columnSetting: 'Column Setting',
1516
config: 'Config',
1617
confirm: 'Confirm',

src/locales/langs/zh-cn.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const local: App.I18n.Schema = {
1111
cancel: '取消',
1212
close: '关闭',
1313
check: '勾选',
14+
expandColumn: '展开列',
1415
columnSetting: '列设置',
1516
config: '配置',
1617
confirm: '确认',

src/typings/app.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ declare namespace App {
261261
cancel: string;
262262
close: string;
263263
check: string;
264+
expandColumn: string;
264265
columnSetting: string;
265266
config: string;
266267
confirm: string;

0 commit comments

Comments
 (0)