diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue index 8e5fb89069..f353a425fb 100644 --- a/apps/desktop/src/components/grid/DataGrid.vue +++ b/apps/desktop/src/components/grid/DataGrid.vue @@ -7335,8 +7335,14 @@ function onRowContext(rowId: number, rowIndex: number) { async function prefetchCopyStatements() { await prefetchRowAsInsertStatement(false); + if (isMultiRow.value) { + await prefetchRowAsInsertStatement(false, "row-by-row"); + } if (canCopyRowAsInsertWithoutPrimaryKeys.value) { await prefetchRowAsInsertStatement(true); + if (isMultiRow.value) { + await prefetchRowAsInsertStatement(true, "row-by-row"); + } } if (canCopyRowAsUpdate.value) { await prefetchRowAsUpdateStatement(); @@ -7945,7 +7951,11 @@ function copyRowLabels() { return { row: isMultiRow.value ? t("grid.copyRows", { count }) : t("grid.copyRow"), insert: isMultiRow.value ? t("grid.copyRowsInsert", { count }) : t("grid.copyRowInsert"), + insertMerged: t("grid.copyRowsInsertMerged", { count }), + insertRowByRow: t("grid.copyRowsInsertRowByRow", { count }), insertNoPk: isMultiRow.value ? t("grid.copyRowsInsertWithoutPrimaryKeys", { count }) : t("grid.copyRowInsertWithoutPrimaryKeys"), + insertNoPkMerged: t("grid.copyRowsInsertWithoutPrimaryKeysMerged", { count }), + insertNoPkRowByRow: t("grid.copyRowsInsertWithoutPrimaryKeysRowByRow", { count }), update: isMultiRow.value ? t("grid.copyRowsUpdate", { count }) : t("grid.copyRowUpdate"), }; } @@ -7977,13 +7987,31 @@ function copySubmenu(): ContextMenuItem { items.push({ label: t("grid.copyCell"), action: copyCell }); } items.push({ label: labels.row, action: copyRow }); - items.push({ label: labels.insert, action: copyRowAsInsert, disabled: !canCopyPreparedInsert(false) }); + if (isMultiRow.value) { + items.push({ label: labels.insertMerged, action: () => copyRowAsInsert("merged"), disabled: !canCopyPreparedInsert(false, "merged") }); + items.push({ label: labels.insertRowByRow, action: () => copyRowAsInsert("row-by-row"), disabled: !canCopyPreparedInsert(false, "row-by-row") }); + } else { + items.push({ label: labels.insert, action: () => copyRowAsInsert(), disabled: !canCopyPreparedInsert(false) }); + } if (canCopyRowAsInsertWithoutPrimaryKeys.value) { - items.push({ - label: labels.insertNoPk, - action: copyRowAsInsertWithoutPrimaryKeys, - disabled: !canCopyPreparedInsert(true), - }); + if (isMultiRow.value) { + items.push({ + label: labels.insertNoPkMerged, + action: () => copyRowAsInsertWithoutPrimaryKeys("merged"), + disabled: !canCopyPreparedInsert(true, "merged"), + }); + items.push({ + label: labels.insertNoPkRowByRow, + action: () => copyRowAsInsertWithoutPrimaryKeys("row-by-row"), + disabled: !canCopyPreparedInsert(true, "row-by-row"), + }); + } else { + items.push({ + label: labels.insertNoPk, + action: () => copyRowAsInsertWithoutPrimaryKeys(), + disabled: !canCopyPreparedInsert(true), + }); + } } if (canCopyRowAsUpdate.value) { items.push({ label: labels.update, action: copyRowAsUpdate, disabled: !canCopyPreparedUpdate() }); diff --git a/apps/desktop/src/components/ui/CustomContextMenu.vue b/apps/desktop/src/components/ui/CustomContextMenu.vue index 9c2672d661..aaa7c84765 100644 --- a/apps/desktop/src/components/ui/CustomContextMenu.vue +++ b/apps/desktop/src/components/ui/CustomContextMenu.vue @@ -258,7 +258,7 @@ onBeforeUnmount(() => { -
+