Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(projects): useTable adds expand to display #421

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/hooks/common/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export function useTable<A extends NaiveUI.TableApiFn>(config: NaiveUI.NaiveTabl

const SELECTION_KEY = '__selection__';

const EXPAND_KEY = '__expand__';

const {
loading,
empty,
Expand Down Expand Up @@ -68,6 +70,12 @@ export function useTable<A extends NaiveUI.TableApiFn>(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
});
}
});

Expand All @@ -81,6 +89,8 @@ export function useTable<A extends NaiveUI.TableApiFn>(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);
}
});

Expand Down
1 change: 1 addition & 0 deletions src/locales/langs/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions src/locales/langs/zh-cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const local: App.I18n.Schema = {
cancel: '取消',
close: '关闭',
check: '勾选',
expandColumn: '展开列',
columnSetting: '列设置',
config: '配置',
confirm: '确认',
Expand Down
1 change: 1 addition & 0 deletions src/typings/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ declare namespace App {
cancel: string;
close: string;
check: string;
expandColumn: string;
columnSetting: string;
config: string;
confirm: string;
Expand Down
Loading