mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
feat(plugin-data-viewer): CB-665 types improvements
This commit is contained in:
@@ -84,7 +84,7 @@ class ComputedMenuItemOptionsWithContext<T> implements IComputedMenuItemOptions
|
||||
onClick?: () => void;
|
||||
// set title or getter
|
||||
title?: TLocalizationToken;
|
||||
titleGetter?: () => TLocalizationToken;
|
||||
titleGetter?: (context: IMenuContext<T>) => TLocalizationToken | undefined;
|
||||
tooltip?: TLocalizationToken;
|
||||
tooltipGetter?: () => TLocalizationToken | undefined;
|
||||
isDisabled?: () => boolean;
|
||||
|
||||
@@ -16,7 +16,7 @@ import type { IMenuContext } from './IMenuContext';
|
||||
*/
|
||||
export interface IContextMenuItem<T> extends IMenuItemOptions {
|
||||
onClick?: (context: IMenuContext<T>) => void;
|
||||
titleGetter?: (context: IMenuContext<T>) => TLocalizationToken;
|
||||
titleGetter?: (context: IMenuContext<T>) => TLocalizationToken | undefined;
|
||||
// if isPresent is false menu item will not be included in resulting context menu
|
||||
isPresent: (context: IMenuContext<T>) => boolean;
|
||||
isDisabled?: (context: IMenuContext<T>) => boolean;
|
||||
|
||||
@@ -15,7 +15,6 @@ import type { IMenuItemOptions, MenuItemType } from './MenuOptionsStore';
|
||||
|
||||
export interface IComputedMenuItemOptions extends IMenuItemOptions {
|
||||
onClick?: () => void;
|
||||
titleGetter?: () => string;
|
||||
isDisabled?: () => boolean;
|
||||
isHidden?: () => boolean;
|
||||
isChecked?: () => boolean;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
import type { TLocalizationToken } from '@cloudbeaver/core-localization';
|
||||
import { OrderedMap } from '@cloudbeaver/core-utils';
|
||||
|
||||
import type { IMenuContext } from '../ContextMenu/IMenuContext';
|
||||
import type { IMenuPanel } from '../IMenuPanel';
|
||||
|
||||
const DEFAULT_ITEM_ORDER = 100;
|
||||
@@ -19,7 +18,7 @@ export interface IMenuItemOptions {
|
||||
id: string;
|
||||
// set title or getter
|
||||
title?: TLocalizationToken;
|
||||
titleGetter?: (...args: any[]) => TLocalizationToken;
|
||||
titleGetter?: (...args: any[]) => TLocalizationToken | undefined;
|
||||
// set icon or getter
|
||||
icon?: string;
|
||||
iconGetter?: () => string | undefined;
|
||||
|
||||
+8
-8
@@ -15,7 +15,7 @@ import { StaticImage, Icon } from '@cloudbeaver/core-blocks';
|
||||
import { useTranslate } from '@cloudbeaver/core-localization';
|
||||
import type { SqlResultSet } from '@cloudbeaver/core-sdk';
|
||||
import { composes, useStyles } from '@cloudbeaver/core-theming';
|
||||
import { getNextSortMode, ResultSetSortAction } from '@cloudbeaver/plugin-data-viewer';
|
||||
import { ESortMode, getNextSortMode, ResultSetSortAction } from '@cloudbeaver/plugin-data-viewer';
|
||||
|
||||
import { DataGridContext } from '../DataGridContext';
|
||||
import { DataGridSelectionContext } from '../DataGridSelection/DataGridSelectionContext';
|
||||
@@ -136,17 +136,17 @@ export const TableColumnHeader: React.FC<HeaderRendererProps<any>> = observer(fu
|
||||
};
|
||||
|
||||
return styled(headerStyles)(
|
||||
<table-header as="div" onClick={handleColumnSelection}>
|
||||
<shrink-container as='div' title={columnTooltip}>
|
||||
<icon as="div">
|
||||
<table-header onClick={handleColumnSelection}>
|
||||
<shrink-container title={columnTooltip}>
|
||||
<icon>
|
||||
<StaticImage icon={column?.icon} />
|
||||
</icon>
|
||||
<name as="div">{columnName}</name>
|
||||
<name>{columnName}</name>
|
||||
</shrink-container>
|
||||
{sortable && (
|
||||
<sort-icons title={translate('data_grid_table_tooltip_column_header_sort')} as="div" onClick={handleSort} {...use({ disabled: loading })}>
|
||||
<SortIcon active={currentSortMode === 'asc'} />
|
||||
<SortIcon active={currentSortMode === 'desc'} />
|
||||
<sort-icons title={translate('data_grid_table_tooltip_column_header_sort')} onClick={handleSort} {...use({ disabled: loading })}>
|
||||
<SortIcon active={currentSortMode === ESortMode.asc} />
|
||||
<SortIcon active={currentSortMode === ESortMode.desc} />
|
||||
</sort-icons>
|
||||
)}
|
||||
</table-header>
|
||||
|
||||
Reference in New Issue
Block a user