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

CB-5052 [2562 FR] Highlight the row where any field is currently selected #2952

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5c20e4a
CB-5052-2562 adds background for selected row
sergeyteleshev Sep 30, 2024
acf7cc0
CB-5052-2562 fixes background for selected row
sergeyteleshev Sep 30, 2024
8bd1469
CB-5052-2562 moves style var
sergeyteleshev Sep 30, 2024
7e720da
Merge branch 'devel' into CB-5052-2562-fr-highlight-the-row-where-any…
Wroud Sep 30, 2024
b00da34
CB-5052 pr fixes
sergeyteleshev Oct 1, 2024
56f5c82
CB-5052 fixes color for selection
sergeyteleshev Oct 1, 2024
b7597d7
CB-5052 fixes color for selection 2
sergeyteleshev Oct 1, 2024
5b18ed8
Merge branch 'devel' into CB-5052-2562-fr-highlight-the-row-where-any…
dariamarutkina Oct 1, 2024
b5d6440
Merge branch 'devel' into CB-5052-2562-fr-highlight-the-row-where-any…
dariamarutkina Oct 1, 2024
6567876
CB-5052 adds themes and fixes actions styles for focused cursor in table
sergeyteleshev Oct 1, 2024
02f96a6
CB-5052 reverts theme for data grid. plus replaces selected row style
sergeyteleshev Oct 2, 2024
8511fd5
CB-5052 cleanup
sergeyteleshev Oct 2, 2024
edc8719
CB-5052 cleanup
sergeyteleshev Oct 2, 2024
2c1bb22
CB-5052 makes selected tab blue
sergeyteleshev Oct 2, 2024
58f1365
CB-5052 reverts refresh button colors
sergeyteleshev Oct 3, 2024
6183a2f
Merge branch 'devel' into CB-5052-2562-fr-highlight-the-row-where-any…
dariamarutkina Oct 7, 2024
7e58c1b
CB-5052 fixes unneeded border left
sergeyteleshev Oct 7, 2024
e73d9eb
Merge branch 'devel' into CB-5052-2562-fr-highlight-the-row-where-any…
dariamarutkina Oct 7, 2024
4bc034d
Merge branch 'devel' into CB-5052-2562-fr-highlight-the-row-where-any…
Wroud Oct 8, 2024
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
2 changes: 2 additions & 0 deletions webapp/packages/plugin-data-spreadsheet-new/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@cloudbeaver/core-localization": "^0",
"@cloudbeaver/core-sdk": "^0",
"@cloudbeaver/core-settings": "^0",
"@cloudbeaver/core-theming": "^0",
"@cloudbeaver/core-ui": "^0",
"@cloudbeaver/core-utils": "^0",
"@cloudbeaver/core-view": "^0",
Expand Down Expand Up @@ -59,6 +60,7 @@
"@cloudbeaver/core-sdk": "^0",
"@cloudbeaver/core-settings": "^0",
"@cloudbeaver/core-storage": "^0",
"@cloudbeaver/core-theming": "^0",
"@cloudbeaver/core-ui": "^0",
"@cloudbeaver/core-view": "^0",
"@cloudbeaver/plugin-data-viewer": "^0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ export const CellRenderer = observer<CellRendererProps<IResultSetRowKey, unknown
{ row, column, rowIdx, isCellSelected },
);

const isDatabaseActionApplied = getComputed(() =>
[DatabaseEditChangeType.add, DatabaseEditChangeType.delete, DatabaseEditChangeType.update].includes(cellContext.editionState!),
);

const classes = getComputed(() =>
clsx({
'rdg-cell-custom-highlighted-row': cellContext.hasFocusedElementInRow,
'rdg-cell-custom-highlighted-row': cellContext.hasFocusedElementInRow && !isDatabaseActionApplied,
'rdg-cell-custom-selected': cellContext.isSelected,
'rdg-cell-custom-editing': cellContext.isEditing,
'rdg-cell-custom-added': cellContext.editionState === DatabaseEditChangeType.add,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
--data-grid-readonly-status-color: #e28835;
--data-grid-cell-selection-background-color: rgba(150, 150, 150, 0.2);
--data-grid-cell-selection-background-color-focus: rgba(0, 145, 234, 0.2);
--data-grid-cell-row-index-color: rgb(111, 165, 198);
--data-grid-cell-row-index-color: var(--data-grid-index-color);
--rdg-selected-row-color: var(--theme-secondary) !important;

composes: theme-typography--caption from global;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {

import { type CellPosition, EditingContext } from '../Editing/EditingContext.js';
import { useEditing } from '../Editing/useEditing.js';
import { DATA_GRID_BASE_STYLES } from '../theme/styles.js';
import { CellRenderer } from './CellRenderer/CellRenderer.js';
import { DataGridContext, type IColumnResizeInfo, type IDataGridContext } from './DataGridContext.js';
import { DataGridSelectionContext } from './DataGridSelection/DataGridSelectionContext.js';
Expand Down Expand Up @@ -62,7 +63,7 @@ const MAX_CELL_TEXT_SIZE = 100 * 1024;

export const DataGridTable = observer<IDataPresentationProps>(function DataGridTable({ model, actions, resultIndex, simple, className, ...rest }) {
const translate = useTranslate();
const styles = useS(classes);
const styles = useS(classes, DATA_GRID_BASE_STYLES);

const clipboardService = useService(ClipboardService);
const gridContainerRef = useRef<HTMLDivElement | null>(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/

@import '@cloudbeaver/core-theming/src/styles/theme-dark';

:global .#{$theme-class} {
Copy link
Member

@devnaumov devnaumov Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We deleted these files on purpose, we dont want to use them anymore. We should define all styles in DataGridTable.module.css. Probably we want to add light-dark() postcss mixin or something like this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rolled back changes, so we don't have a themed data grid. It is not required for now

--data-grid-index-color: #32475e;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
@import '@cloudbeaver/core-theming/src/styles/theme-light';

:global .#{$theme-class} {
--data-grid-index-color: #c2d8ee;
}
28 changes: 28 additions & 0 deletions webapp/packages/plugin-data-spreadsheet-new/src/theme/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import type { ThemeSelector } from '@cloudbeaver/core-theming';

import type Dark from './dark.module.scss';
import type Light from './light.module.scss';

export const DATA_GRID_BASE_STYLES: ThemeSelector = async theme => {
let styles: typeof Light & typeof Dark;
const dark = (await import('./dark.module.scss')).default;
const light = (await import('./light.module.scss')).default;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had preloaded all styles at one time, cause the theme did not apply until <TableGrid> component was fully rerendered (reload page or tab)


switch (theme) {
case 'dark':
styles = dark;
break;
default:
styles = light;
break;
}

return styles;
};