mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 22:36:01 +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 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>
|
||||
|
||||
<textarea
|
||||
class="flex1"
|
||||
{wrap}
|
||||
readonly
|
||||
readonly={!editable}
|
||||
value={selection
|
||||
.map(cell => {
|
||||
const { value } = cell;
|
||||
@@ -16,4 +25,5 @@
|
||||
return cell.value;
|
||||
})
|
||||
.join('\n')}
|
||||
on:input={e => setCellValue(e.target['value'])}
|
||||
/>
|
||||
|
||||
@@ -221,5 +221,6 @@
|
||||
<ToolStripExportButton {quickExportHandlerRef} command="collectionDataGrid.export" />
|
||||
<ToolStripCommandButton command="collectionJsonView.expandAll" hideDisabled />
|
||||
<ToolStripCommandButton command="collectionJsonView.collapseAll" hideDisabled />
|
||||
<ToolStripCommandButton command="dataGrid.toggleCellDataView" hideDisabled />
|
||||
</svelte:fragment>
|
||||
</ToolStripContainer>
|
||||
|
||||
@@ -129,6 +129,7 @@
|
||||
|
||||
<ToolStripCommandButton command="dataGrid.refresh" />
|
||||
<ToolStripExportButton {quickExportHandlerRef} />
|
||||
<ToolStripCommandButton command="dataGrid.toggleCellDataView" hideDisabled />
|
||||
</svelte:fragment>
|
||||
</ToolStripContainer>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user