π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix: context menu
DarkPhoenix27048b6f8bd58bb9
diff --git a/packages/nc-gui/components/smartsheet/Gallery.vue b/packages/nc-gui/components/smartsheet/Gallery.vueindex b5c1c949ac..7abf6d8a0a 100644--- a/packages/nc-gui/components/smartsheet/Gallery.vue+++ b/packages/nc-gui/components/smartsheet/Gallery.vue@@ -85,6 +85,13 @@ const contextMenu = computed({})const contextMenuTarget = ref<{ row: RowType; index: number } | null>(null)+const showSendRecordModal = ref(false)++const contextMenuRowId = computed(() => {+ if (!contextMenuTarget.value?.row) return null+ return extractPkFromRow(contextMenuTarget.value.row.row, meta.value?.columns)+})+const showContextMenu = (e: MouseEvent, target?: { row: RowType; index: number }) => {if (isSqlView.value) returne.preventDefault()@@ -422,6 +429,12 @@ const resetPointerEvent = (record: RowType, col: ColumnType) => {{{ $t('activity.expandRecord') }}</div></NcMenuItem>+ <NcMenuItem v-if="contextMenuTarget && contextMenuRowId && !isPublic" @click="showSendRecordModal = true">+ <div class="flex items-center gap-2">+ <GeneralIcon icon="mail" class="flex" />+ {{ $t('activity.sendRecord') }}+ </div>+ </NcMenuItem><NcDivider /><PermissionsTooltipv-if="contextMenuTarget?.index !== undefined"@@ -712,6 +725,14 @@ const resetPointerEvent = (record: RowType, col: ColumnType) => {@prev="navigateToSiblingRow(NavigateDir.PREV)"/></Suspense>++ <DlgSendRecordEmail+ v-if="meta && contextMenuRowId"+ v-model="showSendRecordModal"+ :meta="meta"+ :view="view"+ :row-id="contextMenuRowId"+ /></template><style lang="scss" scoped>diff --git a/packages/nc-gui/components/smartsheet/Kanban.vue b/packages/nc-gui/components/smartsheet/Kanban.vueindex eb5deffbfc..39d9ded342 100644--- a/packages/nc-gui/components/smartsheet/Kanban.vue+++ b/packages/nc-gui/components/smartsheet/Kanban.vue@@ -209,6 +209,13 @@ const contextMenu = computed({const contextMenuTarget = ref<RowType | null>(null)+const showSendRecordModal = ref(false)++const contextMenuRowId = computed(() => {+ if (!contextMenuTarget.value) return null+ return extractPkFromRow(contextMenuTarget.value.row, meta.value?.columns)+})+const showContextMenu = (e: MouseEvent, target?: RowType) => {e.preventDefault()if (target) {@@ -1284,6 +1291,12 @@ const resetPointerEvent = (record: RowType, col: ColumnType) => {{{ $t('activity.expandRecord') }}</div></NcMenuItem>+ <NcMenuItem v-if="contextMenuTarget && contextMenuRowId && !isPublic" @click="showSendRecordModal = true">+ <div class="flex items-center gap-2 nc-kanban-context-menu-item">+ <GeneralIcon icon="mail" class="flex" />+ {{ $t('activity.sendRecord') }}+ </div>+ </NcMenuItem><NcDivider /><PermissionsTooltipv-if="contextMenuTarget"@@ -1356,6 +1369,14 @@ const resetPointerEvent = (record: RowType, col: ColumnType) => {</div></template></GeneralDeleteModal>++ <DlgSendRecordEmail+ v-if="meta && contextMenuRowId"+ v-model="showSendRecordModal"+ :meta="meta"+ :view="view"+ :row-id="contextMenuRowId"+ /></template><style lang="scss" scoped>diff --git a/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue b/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vueindex 0b171f7f3a..84cf57f04f 100644--- a/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue+++ b/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue@@ -438,6 +438,14 @@ const selectedRows = toRef(props, 'selectedRows')const contextMenuClosing = ref(false)const contextMenuTarget = ref<{ row: number; col: number } | null>(null)+const showSendRecordModal = ref(false)++const contextMenuRowId = computed(() => {+ if (!contextMenuTarget.value || contextMenuTarget.value.row === -1) return null+ const row = dataRef.value.get(contextMenuTarget.value.row)+ if (!row) return null+ return extractPkFromRow(row.row, meta.value?.columns)+})const contextMenu = computed({get: () => {@@ -3114,6 +3122,12 @@ const headerFilteredOrSortedClass = (colId: string) => {{{ $t('general.add') }} {{ $t('general.comment').toLowerCase() }}</div></NcMenuItem>+ <NcMenuItem v-if="contextMenuRowId && !isPublicView" class="nc-base-menu-item" @click="showSendRecordModal = true">+ <div class="flex gap-2 items-center">+ <GeneralIcon icon="mail" class="h-4 w-4" />+ {{ $t('activity.sendRecord') }}+ </div>+ </NcMenuItem></template><template v-if="hasEditPermission && !isDataReadOnly">@@ -3263,6 +3277,14 @@ const headerFilteredOrSortedClass = (colId: string) => {:selected-cell-count="selectedRange.cellCount"/></div>++ <DlgSendRecordEmail+ v-if="meta && contextMenuRowId"+ v-model="showSendRecordModal"+ :meta="meta"+ :view="view"+ :row-id="contextMenuRowId"+ /></template><style lang="scss">diff --git a/packages/nc-gui/components/smartsheet/grid/Table.vue b/packages/nc-gui/components/smartsheet/grid/Table.vueindex e9f469b231..85618fad7b 100644--- a/packages/nc-gui/components/smartsheet/grid/Table.vue+++ b/packages/nc-gui/components/smartsheet/grid/Table.vue@@ -212,6 +212,14 @@ const isGridCellMouseDown = ref(false)// #Context Menuconst contextMenuClosing = ref(false)const contextMenuTarget = ref<{ row: number; col: number } | null>(null)+const showSendRecordModal = ref(false)++const contextMenuRowId = computed(() => {+ if (!contextMenuTarget.value || contextMenuTarget.value.row === -1) return null+ const row = dataRef.value[contextMenuTarget.value.row]+ if (!row) return null+ return extractPkFromRow(row.row, meta.value?.columns)+})const _contextMenu = ref(false)@@ -2702,6 +2710,12 @@ onKeyStroke('ArrowDown', onDown){{ $t('general.add') }} {{ $t('general.comment').toLowerCase() }}</div></NcMenuItem>+ <NcMenuItem v-if="contextMenuRowId && !isPublicView" class="nc-base-menu-item" @click="showSendRecordModal = true">+ <div class="flex gap-2 items-center">+ <GeneralIcon icon="mail" class="h-4 w-4" />+ {{ $t('activity.sendRecord') }}+ </div>+ </NcMenuItem></template><template v-if="hasEditPermission && !isDataReadOnly">@@ -2917,6 +2931,14 @@ onKeyStroke('ArrowDown', onDown)</NcDropdown></div></div>++ <DlgSendRecordEmail+ v-if="meta && contextMenuRowId"+ v-model="showSendRecordModal"+ :meta="meta"+ :view="view"+ :row-id="contextMenuRowId"+ /></template><style lang="scss">diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/context/Cell.vue b/packages/nc-gui/components/smartsheet/grid/canvas/context/Cell.vueindex efb5e1eeff..519b06349b 100644--- a/packages/nc-gui/components/smartsheet/grid/canvas/context/Cell.vue+++ b/packages/nc-gui/components/smartsheet/grid/canvas/context/Cell.vue@@ -54,7 +54,7 @@ const props = defineProps<{}>()// Emits-const emits = defineEmits(['bulkUpdateDlg', 'update:selectedAllRecords', 'update:selectedAllRecordsSkipPks'])+const emits = defineEmits(['bulkUpdateDlg', 'update:selectedAllRecords', 'update:selectedAllRecordsSkipPks', 'sendRecord'])const {bulkDeleteAll,@@ -93,6 +93,7 @@ const { isMobileMode } = useGlobal()const { paste } = usePaste()const { meta } = useSmartsheetStoreOrThrow()const metaInj = inject(MetaInj, ref())+const isPublic = inject(IsPublicInj, ref(false))// Computed Statesconst hasEditPermission = computed(() => isUIAllowed('dataEdit'))@@ -114,6 +115,14 @@ const selectedRows = computed(() => {return dataCache.selectedRows.value})+const contextMenuRowId = computed(() => {+ if (contextMenuRow.value === null || !contextMenuPath.value) return null+ const dataCache = getDataCache(contextMenuPath.value)+ const row = dataCache.cachedRows.value.get(contextMenuRow.value)+ if (!row) return null+ return extractPkFromRow(row.row, meta.value?.columns)+})+const disablePasteCell = computed(() => {return (props.isSelectionReadOnly &&@@ -643,6 +652,17 @@ const execBulkAction = async (path: Array<number>) => {{{ $t('general.add') }} {{ $t('general.comment').toLowerCase() }}</div></NcMenuItem>+ <NcMenuItem+ v-if="contextMenuRowId && !isPublic"+ key="send-record"+ class="nc-base-menu-item"+ @click="emits('sendRecord', contextMenuRowId)"+ >+ <div class="flex gap-2 items-center">+ <GeneralIcon icon="mail" class="h-4 w-4" />+ {{ $t('activity.sendRecord') }}+ </div>+ </NcMenuItem></template><template v-if="hasEditPermission && !isDataReadOnly">diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/index.vue b/packages/nc-gui/components/smartsheet/grid/canvas/index.vueindex e0e5dd2764..f077649502 100644--- a/packages/nc-gui/components/smartsheet/grid/canvas/index.vue+++ b/packages/nc-gui/components/smartsheet/grid/canvas/index.vue@@ -2436,6 +2436,14 @@ const bulkUpdataContext = (path: Array<number>) => {emits('bulkUpdateDlg', path)}+const showSendRecordModal = ref(false)+const sendRecordRowId = ref<string | null>(null)++const handleSendRecord = (rowId: string) => {+ sendRecordRowId.value = rowId+ showSendRecordModal.value = true+}+watch([height, width, windowWidth, windowHeight], () => {nextTick(() => {calculateSlices()@@ -2877,6 +2885,7 @@ watch(:clear-selected-range-of-cells="clearSelectedRangeOfCells"@click="isContextMenuOpen = false"@bulk-update-dlg="bulkUpdataContext"+ @send-record="handleSendRecord"/></template></NcDropdown>@@ -3113,6 +3122,14 @@ watch(</PermissionsTooltip></div></div>++ <DlgSendRecordEmail+ v-if="meta && sendRecordRowId"+ v-model="showSendRecordModal"+ :meta="meta"+ :view="view"+ :row-id="sendRecordRowId"+ /></template><style scoped lang="scss">