mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-03 15:13:57 +00:00
filter focus- fix deadlock (using ref)
This commit is contained in:
@@ -19,15 +19,14 @@
|
|||||||
export let setFilter;
|
export let setFilter;
|
||||||
export let showResizeSplitter = false;
|
export let showResizeSplitter = false;
|
||||||
export let onFocusGrid;
|
export let onFocusGrid;
|
||||||
|
export let onGetReference;
|
||||||
|
|
||||||
let value;
|
let value;
|
||||||
let isError;
|
let isError;
|
||||||
let isOk;
|
let isOk;
|
||||||
let domInput;
|
let domInput;
|
||||||
|
|
||||||
export function focus() {
|
$: if (onGetReference && domInput) onGetReference(domInput);
|
||||||
domInput.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
function openFilterWindow(condition1) {
|
function openFilterWindow(condition1) {
|
||||||
showModal(SetFilterModal, { condition1, filterType, onFilter: setFilter });
|
showModal(SetFilterModal, { condition1, filterType, onFilter: setFilter });
|
||||||
@@ -193,6 +192,7 @@
|
|||||||
|
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<input
|
<input
|
||||||
|
bind:this={domInput}
|
||||||
type="text"
|
type="text"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
readOnly={isReadOnly}
|
readOnly={isReadOnly}
|
||||||
@@ -200,7 +200,6 @@
|
|||||||
on:keydown={handleKeyDown}
|
on:keydown={handleKeyDown}
|
||||||
on:blur={applyFilter}
|
on:blur={applyFilter}
|
||||||
on:paste={handlePaste}
|
on:paste={handlePaste}
|
||||||
bind:this={domInput}
|
|
||||||
class:isError
|
class:isError
|
||||||
class:isOk
|
class:isOk
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -290,7 +290,7 @@
|
|||||||
let shiftDragStartCell = nullCell;
|
let shiftDragStartCell = nullCell;
|
||||||
let autofillDragStartCell = nullCell;
|
let autofillDragStartCell = nullCell;
|
||||||
let autofillSelectedCells = emptyCellArray;
|
let autofillSelectedCells = emptyCellArray;
|
||||||
const domFilterControls = {};
|
const domFilterControlsRef = createRef({});
|
||||||
|
|
||||||
export function refresh() {
|
export function refresh() {
|
||||||
display.reload();
|
display.reload();
|
||||||
@@ -991,7 +991,7 @@
|
|||||||
|
|
||||||
function focusFilterEditor(columnRealIndex) {
|
function focusFilterEditor(columnRealIndex) {
|
||||||
let modelIndex = columnSizes.realToModel(columnRealIndex);
|
let modelIndex = columnSizes.realToModel(columnRealIndex);
|
||||||
const domFilter = domFilterControls[columns[modelIndex].uniqueName];
|
const domFilter = domFilterControlsRef.get()[columns[modelIndex].uniqueName];
|
||||||
if (domFilter) domFilter.focus();
|
if (domFilter) domFilter.focus();
|
||||||
return ['filter', columnRealIndex];
|
return ['filter', columnRealIndex];
|
||||||
}
|
}
|
||||||
@@ -1030,7 +1030,7 @@
|
|||||||
{:else if grider.errors && grider.errors.length > 0}
|
{:else if grider.errors && grider.errors.length > 0}
|
||||||
<div>
|
<div>
|
||||||
{#each grider.errors as err}
|
{#each grider.errors as err}
|
||||||
<ErrorInfo message={err} key={index} isSmall />
|
<ErrorInfo message={err} isSmall />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
@@ -1113,7 +1113,7 @@
|
|||||||
style={`width:${col.width}px; min-width:${col.width}px; max-width:${col.width}px`}
|
style={`width:${col.width}px; min-width:${col.width}px; max-width:${col.width}px`}
|
||||||
>
|
>
|
||||||
<DataFilterControl
|
<DataFilterControl
|
||||||
bind:this={domFilterControls[col.uniqueName]}
|
onGetReference={value => (domFilterControlsRef.get()[col.uniqueName] = value)}
|
||||||
filterType={getFilterType(col.dataType)}
|
filterType={getFilterType(col.dataType)}
|
||||||
filter={display.getFilter(col.uniqueName)}
|
filter={display.getFilter(col.uniqueName)}
|
||||||
setFilter={value => display.setFilter(col.uniqueName, value)}
|
setFilter={value => display.setFilter(col.uniqueName, value)}
|
||||||
|
|||||||
Reference in New Issue
Block a user