show focus in data grid

This commit is contained in:
SPRINX0\prochazka
2024-11-19 16:35:55 +01:00
parent af17eceb27
commit 598674a7e0
4 changed files with 25 additions and 2 deletions

View File

@@ -142,6 +142,8 @@
}, },
}); });
} }
let isColumnManagerFocused = false;
</script> </script>
{#if allowChangeChangeSetStructure} {#if allowChangeChangeSetStructure}
@@ -207,9 +209,13 @@
bind:this={domFocusField} bind:this={domFocusField}
on:keydown={handleKeyDown} on:keydown={handleKeyDown}
on:focus={() => { on:focus={() => {
isColumnManagerFocused = true;
// activator.activate(); // activator.activate();
// invalidateCommands(); // invalidateCommands();
}} }}
on:blur={() => {
isColumnManagerFocused = false;
}}
on:copy={copyToClipboard} on:copy={copyToClipboard}
/> />
@@ -224,6 +230,7 @@
{database} {database}
{tableInfo} {tableInfo}
{setTableInfo} {setTableInfo}
{isColumnManagerFocused}
columnInfo={tableInfo?.columns?.[columnIndex]} columnInfo={tableInfo?.columns?.[columnIndex]}
{columnIndex} {columnIndex}
{allowChangeChangeSetStructure} {allowChangeChangeSetStructure}

View File

@@ -22,6 +22,8 @@
export let columnInfo = null; export let columnInfo = null;
export let columnIndex = -1; export let columnIndex = -1;
export let isColumnManagerFocused = false;
export let allowChangeChangeSetStructure = false; export let allowChangeChangeSetStructure = false;
$: addDataCommand = allowChangeChangeSetStructure; $: addDataCommand = allowChangeChangeSetStructure;
@@ -49,6 +51,7 @@
else display.focusColumns([column.uniqueName]); else display.focusColumns([column.uniqueName]);
}} }}
class:isSelected class:isSelected
class:isFocused={isColumnManagerFocused}
on:click on:click
on:mousedown on:mousedown
on:mousemove on:mousemove
@@ -123,6 +126,10 @@
} }
.row.isSelected { .row.isSelected {
background: var(--theme-bg-3);
}
.row.isSelected.isFocused {
background: var(--theme-bg-selected); background: var(--theme-bg-selected);
} }

View File

@@ -173,6 +173,9 @@
background: var(--theme-bg-volcano); background: var(--theme-bg-volcano);
} }
td.isSelected { td.isSelected {
background: var(--theme-bg-3);
}
:global(.data-grid-focused) td.isSelected {
background: var(--theme-bg-selected); background: var(--theme-bg-selected);
} }
td.isDeleted { td.isDeleted {

View File

@@ -492,6 +492,8 @@
let autofillSelectedCells = emptyCellArray; let autofillSelectedCells = emptyCellArray;
const domFilterControlsRef = createRef({}); const domFilterControlsRef = createRef({});
let isGridFocused=false;
const tabid = getContext('tabid'); const tabid = getContext('tabid');
let unsubscribeDbRefresh; let unsubscribeDbRefresh;
@@ -1041,7 +1043,6 @@
return !hideGridLeftColumn; return !hideGridLeftColumn;
} }
$: autofillMarkerCell = $: autofillMarkerCell =
selectedCells && selectedCells.length > 0 && _.uniq(selectedCells.map(x => x[0])).length == 1 selectedCells && selectedCells.length > 0 && _.uniq(selectedCells.map(x => x[0])).length == 1
? [_.max(selectedCells.map(x => x[0])), _.max(selectedCells.map(x => x[1]))] ? [_.max(selectedCells.map(x => x[0])), _.max(selectedCells.map(x => x[1]))]
@@ -1863,6 +1864,7 @@
{:else} {:else}
<div <div
class="container" class="container"
class:data-grid-focused={isGridFocused}
bind:clientWidth={containerWidth} bind:clientWidth={containerWidth}
bind:clientHeight={containerHeight} bind:clientHeight={containerHeight}
use:contextMenu={buildMenu} use:contextMenu={buildMenu}
@@ -1877,10 +1879,14 @@
on:focus={() => { on:focus={() => {
activator.activate(); activator.activate();
invalidateCommands(); invalidateCommands();
isGridFocused = true;
}} }}
on:blur
on:paste={handlePaste} on:paste={handlePaste}
on:copy={copyToClipboard} on:copy={copyToClipboard}
on:blur={handleBlur} on:blur={() => {
isGridFocused = false;
}}
/> />
<table <table
class="table" class="table"