diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/CellEditor/CellEditor.tsx b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/CellEditor/CellEditor.tsx index 6263aedf7d..bd6665f0fe 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/CellEditor/CellEditor.tsx +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/CellEditor/CellEditor.tsx @@ -87,22 +87,9 @@ export const CellEditor = observer, 'rowIdx' | 'row' } }); - const value = formatter?.get(row[column.key]); - const numericCell = typeof tableDataContext?.getCellValue(rowIdx, column.key) === 'number'; + const value = formatter?.getText(row[column.key]) ?? ''; - const handleSave = () => { - if (numericCell) { - const editor = dataGridContext.model.source.getEditor(dataGridContext.resultIndex); - let value = editor.getCell(rowIdx, Number(column.key)); - - if (typeof value === 'string') { - value = value.replace(',', '.'); - } - - editor.setCell(rowIdx, Number(column.key), Number(value)); - } - onClose(false); - }; + const handleSave = () => onClose(false); const handleReject = () => { dataGridContext.model.source.getEditor(dataGridContext.resultIndex) .revertCell(rowIdx, Number(column.key)); diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/CellRenderer/CellRenderer.tsx b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/CellRenderer/CellRenderer.tsx index 211d5b547d..062519da18 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/CellRenderer/CellRenderer.tsx +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/CellRenderer/CellRenderer.tsx @@ -40,7 +40,7 @@ export const CellRenderer: React.FC> = observer(function classes.push('rdg-cell-custom-editing'); } - if (editor?.isCellEdited(rowIdx, Number(column.key))) { + if (!tableDataContext?.isIndexColumn(column.key) && editor?.isCellEdited(rowIdx, Number(column.key))) { classes.push('rdg-cell-custom-edited'); } diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuFilter/DataGridContextMenuFilterService.ts b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuFilter/DataGridContextMenuFilterService.ts index 0570be8f92..580ed07e60 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuFilter/DataGridContextMenuFilterService.ts +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuFilter/DataGridContextMenuFilterService.ts @@ -90,7 +90,7 @@ export class DataGridContextMenuFilterService { }, titleGetter() { const val = typeof value === 'function' ? value() : value; - const stringifyValue = format.toString(val); + const stringifyValue = format.toDisplayString(val); const wrappedValue = wrapOperationArgument(operation.id, stringifyValue); const clippeddValue = replaceMiddle(wrappedValue, ' ... ', 8, 30); return `${columnLabel} ${operation.expression} ${clippeddValue}`; @@ -244,7 +244,7 @@ export class DataGridContextMenuFilterService { icon: '/icons/filter_custom.png', onClick: async () => { const isNull = format.isNull(cellValue); - const stringifyCellValue = format.toString(cellValue); + const stringifyCellValue = format.toDisplayString(cellValue); const customValue = await this.commonDialogService.open( FilterCustomValueDialog, { diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/CellFormatter.tsx b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/CellFormatter.tsx index f0eda14236..e0d3d865ba 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/CellFormatter.tsx +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/CellFormatter.tsx @@ -36,7 +36,7 @@ export const CellFormatter: React.FC = observer(function CellFor const rawValue = formatter?.get(row[column.key]) ?? row[column.key]; const classes = getClasses(rawValue); const [menuVisible, setMenuVisible] = useState(false); - const value = formatter?.toString(rawValue) ?? String(rawValue); + const value = formatter?.toDisplayString(rawValue) ?? String(rawValue); const handleClose = useCallback(() => { editingContext?.closeEditor({ idx: column.idx, rowIdx }); diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/IndexFormatter.tsx b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/IndexFormatter.tsx index a18e430c1a..be9f007789 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/IndexFormatter.tsx +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/IndexFormatter.tsx @@ -9,9 +9,5 @@ import type { FormatterProps } from 'react-data-grid'; export const IndexFormatter: React.FC = function IndexFormatter({ rowIdx }) { - return ( - - {rowIdx + 1} - - ); + return
{rowIdx + 1}
; }; diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/RowRenderer/RowRenderer.tsx b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/RowRenderer/RowRenderer.tsx index c716b82b29..bd74d07455 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/RowRenderer/RowRenderer.tsx +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/RowRenderer/RowRenderer.tsx @@ -12,7 +12,5 @@ import { Row } from 'react-data-grid'; import { CellRenderer } from '../CellRenderer/CellRenderer'; export const RowRenderer: React.FC> = function RowRenderer(props) { - return ( - - ); + return ; }; diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/useGridSelectedCellsCopy.ts b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/useGridSelectedCellsCopy.ts index 02cb63fefa..03c3018c37 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/useGridSelectedCellsCopy.ts +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/useGridSelectedCellsCopy.ts @@ -48,7 +48,7 @@ function copyGridSelectedDataToClipboard( if (colIndexes.includes(columnIdx)) { const cell = editor.getCell(rowIdx, columnIdx); - const cellValue = format.get(cell); + const cellValue = format.getText(cell); rowCellsValues.push(cellValue ?? ''); } else { rowCellsValues.push(''); diff --git a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/IDatabaseDataFormatAction.ts b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/IDatabaseDataFormatAction.ts index 2012fffee8..cbb84f1bc4 100644 --- a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/IDatabaseDataFormatAction.ts +++ b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/IDatabaseDataFormatAction.ts @@ -15,5 +15,5 @@ export interface IDatabaseDataFormatAction any; getText: (value: any) => string | null; isNull: (value: any) => boolean; - toString: (value: any) => string; + toDisplayString: (value: any) => string; } diff --git a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/ResultSetFormatAction.ts b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/ResultSetFormatAction.ts index a4f7c8507e..5f5e941a9a 100644 --- a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/ResultSetFormatAction.ts +++ b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/ResultSetFormatAction.ts @@ -16,6 +16,8 @@ import type { IResultSetElementKey } from './IResultSetElementKey'; import { isResultSetContentValue } from './isResultSetContentValue'; import { ResultSetDataAction } from './ResultSetDataAction'; +export type IResultSetValue = string | number | Record | null> | null; + @databaseDataAction() export class ResultSetFormatAction extends DatabaseDataAction implements IDatabaseDataFormatAction { @@ -45,11 +47,11 @@ export class ResultSetFormatAction extends DatabaseDataAction 1000) { return value.split('').map(v => (v.charCodeAt(0) < 32 ? ' ' : v)).join(''); diff --git a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/DatabaseDataEditor.ts b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/DatabaseDataEditor.ts index d6294f6557..25a3b6146e 100644 --- a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/DatabaseDataEditor.ts +++ b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/DatabaseDataEditor.ts @@ -292,8 +292,11 @@ export class DatabaseDataEditor implements } private compareCellValue(valueA: any, valueB: any) { + valueA = valueA ?? ''; + valueB = valueB ?? ''; + if (typeof valueA === 'number' || typeof valueB === 'number') { - return Number(valueA) === Number(valueB); + return String(valueA) === String(valueB); } if (isResultSetContentValue(valueA) && isResultSetContentValue(valueB)) { diff --git a/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/TextValuePresentation.tsx b/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/TextValuePresentation.tsx index 7ec4d96db9..dee91cafda 100644 --- a/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/TextValuePresentation.tsx +++ b/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/TextValuePresentation.tsx @@ -89,14 +89,14 @@ export const TextValuePresentation: TabContainerPanelComponent | undefined; let readonly = true; @@ -106,11 +106,11 @@ export const TextValuePresentation: TabContainerPanelComponent