SYNC: cell data - allow to edit

This commit is contained in:
SPRINX0\prochazka
2025-12-12 10:48:51 +01:00
committed by Diflow
parent a0b025cf59
commit 078f74db97
3 changed files with 13 additions and 1 deletions

View File

@@ -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'])}
/> />

View File

@@ -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>

View File

@@ -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}