mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 00:56:02 +00:00
SYNC: cell data - allow to edit
This commit is contained in:
committed by
Diflow
parent
a0b025cf59
commit
078f74db97
@@ -3,12 +3,21 @@
|
|||||||
|
|
||||||
export let selection;
|
export let selection;
|
||||||
export let wrap;
|
export let wrap;
|
||||||
|
|
||||||
|
$: singleSelection = selection?.length == 1 && selection?.[0];
|
||||||
|
$: grider = singleSelection?.grider;
|
||||||
|
$: editable = grider?.editable ?? false;
|
||||||
|
|
||||||
|
function setCellValue(value) {
|
||||||
|
if (!editable) return;
|
||||||
|
grider.setCellValue(singleSelection.row, singleSelection.column, value);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<textarea
|
<textarea
|
||||||
class="flex1"
|
class="flex1"
|
||||||
{wrap}
|
{wrap}
|
||||||
readonly
|
readonly={!editable}
|
||||||
value={selection
|
value={selection
|
||||||
.map(cell => {
|
.map(cell => {
|
||||||
const { value } = cell;
|
const { value } = cell;
|
||||||
@@ -16,4 +25,5 @@
|
|||||||
return cell.value;
|
return cell.value;
|
||||||
})
|
})
|
||||||
.join('\n')}
|
.join('\n')}
|
||||||
|
on:input={e => setCellValue(e.target['value'])}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -221,5 +221,6 @@
|
|||||||
<ToolStripExportButton {quickExportHandlerRef} command="collectionDataGrid.export" />
|
<ToolStripExportButton {quickExportHandlerRef} command="collectionDataGrid.export" />
|
||||||
<ToolStripCommandButton command="collectionJsonView.expandAll" hideDisabled />
|
<ToolStripCommandButton command="collectionJsonView.expandAll" hideDisabled />
|
||||||
<ToolStripCommandButton command="collectionJsonView.collapseAll" hideDisabled />
|
<ToolStripCommandButton command="collectionJsonView.collapseAll" hideDisabled />
|
||||||
|
<ToolStripCommandButton command="dataGrid.toggleCellDataView" hideDisabled />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ToolStripContainer>
|
</ToolStripContainer>
|
||||||
|
|||||||
@@ -129,6 +129,7 @@
|
|||||||
|
|
||||||
<ToolStripCommandButton command="dataGrid.refresh" />
|
<ToolStripCommandButton command="dataGrid.refresh" />
|
||||||
<ToolStripExportButton {quickExportHandlerRef} />
|
<ToolStripExportButton {quickExportHandlerRef} />
|
||||||
|
<ToolStripCommandButton command="dataGrid.toggleCellDataView" hideDisabled />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ToolStripContainer>
|
</ToolStripContainer>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user