Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): add copy from another btn in group by menu

Ramesh Mane4dec15ca4479
diff --git a/packages/nc-gui/components/general/CopyFromAnotherViewActionBtn.vue b/packages/nc-gui/components/general/CopyFromAnotherViewActionBtn.vue
new file mode 100644
index 0000000000..3bd752e13b
--- /dev/null
+++ b/packages/nc-gui/components/general/CopyFromAnotherViewActionBtn.vue
@@ -0,0 +1,14 @@
+<script lang="ts" setup>
+import { ViewSettingOverrideOptions, type ViewType } from 'nocodb-sdk'
+
+interface Props {
+ view: ViewType
+ defaultOptions?: ViewSettingOverrideOptions[]
+}
+
+defineProps<Props>()
+</script>
+
+<template>
+ <NcSpanHidden />
+</template>
diff --git a/packages/nc-gui/components/nc/Modal.vue b/packages/nc-gui/components/nc/Modal.vue
index e0a0c3edc9..9cc50f5d57 100644
--- a/packages/nc-gui/components/nc/Modal.vue
+++ b/packages/nc-gui/components/nc/Modal.vue
@@ -1,4 +1,6 @@
<script lang="ts" setup>
+import type { CSSProperties } from 'vue'
+
export interface NcModalProps {
visible: boolean
width?: string | number
@@ -13,6 +15,7 @@ export interface NcModalProps {
ncModalClassName?: string
stopEventPropogation?: boolean
class?: string
+ maskStyle?: CSSProperties
}
const props = withDefaults(defineProps<NcModalProps>(), {
@@ -138,6 +141,7 @@ if (stopEventPropogation.value) {
:wrap-class-name="newWrapClassName"
:footer="null"
:mask-closable="maskClosable"
+ :mask-style="maskStyle"
:keyboard="keyboard"
:destroy-on-close="destroyOnClose"
@keydown.esc="visible = false"
diff --git a/packages/nc-gui/components/smartsheet/toolbar/GroupByMenu.vue b/packages/nc-gui/components/smartsheet/toolbar/GroupByMenu.vue
index 941ffd94c5..a7909a78d3 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/GroupByMenu.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/GroupByMenu.vue
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
-import { RelationTypes, UITypes, isLinksOrLTAR, isSystemColumn } from 'nocodb-sdk'
+import { RelationTypes, UITypes, isLinksOrLTAR, isSystemColumn, ViewSettingOverrideOptions } from 'nocodb-sdk'
import Draggable from 'vuedraggable'
import { getColumnUidtByID as sortGetColumnUidtByID } from '~/utils/sortUtils'
@@ -245,7 +245,7 @@ const getFieldsToGroupBy = (currentGroup: Group) => {
/>
<div
v-else
- class="flex flex-col bg-white overflow-auto nc-group-by-list menu-filter-dropdown w-100 p-4"
+ class="flex flex-col bg-nc-bg-default overflow-auto nc-group-by-list menu-filter-dropdown w-100 p-4"
data-testid="nc-group-by-menu"
>
<div class="max-h-100" @click.stop>
@@ -339,38 +339,47 @@ const getFieldsToGroupBy = (currentGroup: Group) => {
</template>
</Draggable>
</div>
- <NcDropdown
- v-if="availableColumns.length && fieldsToGroupBy.length > _groupBy.length && _groupBy.length < groupByLimit"
- v-model:visible="showCreateGroupBy"
- :trigger="['click']"
- overlay-class-name="nc-toolbar-dropdown"
- :disabled="isLocked"
- >
- <NcButton
- v-e="['c:group-by:add']"
- type="text"
- size="small"
- style="width: fit-content"
- class="nc-add-group-by-btn mt-2"
- :class="{
- '!text-brand-500': !isLocked,
- }"
+ <div class="flex items-center justify-between children:flex-none mt-2 empty:hidden">
+ <NcDropdown
+ v-if="availableColumns.length && fieldsToGroupBy.length > _groupBy.length && _groupBy.length < groupByLimit"
+ v-model:visible="showCreateGroupBy"
+ :trigger="['click']"
+ overlay-class-name="nc-toolbar-dropdown"
:disabled="isLocked"
- @click.stop="showCreateGroupBy = true"
>
- <div class="flex gap-1 items-center">
- <GeneralIcon icon="plus" />
- {{ $t('activity.addSubGroup') }}
- </div>
- </NcButton>
- <template #overlay>
- <SmartsheetToolbarCreateGroupBy
- :is-parent-open="showCreateGroupBy"
- :columns="fieldsToGroupBy"
- @created="addFieldToGroupBy"
- />
- </template>
- </NcDropdown>
+ <NcButton
+ v-e="['c:group-by:add']"
+ type="text"
+ size="small"
+ style="width: fit-content"
+ class="nc-add-group-by-btn"
+ :class="{
+ '!text-brand-500': !isLocked,
+ }"
+ :disabled="isLocked"
+ @click.stop="showCreateGroupBy = true"
+ >
+ <div class="flex gap-1 items-center">
+ <GeneralIcon icon="plus" />
+ {{ $t('activity.addSubGroup') }}
+ </div>
+ </NcButton>
+ <template #overlay>
+ <SmartsheetToolbarCreateGroupBy
+ :is-parent-open="showCreateGroupBy"
+ :columns="fieldsToGroupBy"
+ @created="addFieldToGroupBy"
+ />
+ </template>
+ </NcDropdown>
+
+ <LazyGeneralCopyFromAnotherViewActionBtn
+ v-if="view"
+ :view="view"
+ :default-options="[ViewSettingOverrideOptions.GROUP]"
+ @open="open = false"
+ />
+ </div>
</div>
<GeneralLockedViewFooter
v-if="isLocked"
diff --git a/packages/nc-gui/components/smartsheet/toolbar/NotAllowedTooltip.vue b/packages/nc-gui/components/smartsheet/toolbar/NotAllowedTooltip.vue
index 30ffefed81..c18f040288 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/NotAllowedTooltip.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/NotAllowedTooltip.vue
@@ -2,15 +2,22 @@
import type { TooltipPlacement } from 'ant-design-vue/es/tooltip'
import type { CSSProperties } from '@vue/runtime-dom'
-defineProps<{
- tooltipStyle?: CSSProperties
- overlayInnerStyle?: CSSProperties
- mouseLeaveDelay?: number
- placement?: TooltipPlacement
- trigger?: 'hover' | 'click'
- message?: string
- enabled?: boolean
-}>()
+withDefaults(
+ defineProps<{
+ tooltipStyle?: CSSProperties
+ overlayInnerStyle?: CSSProperties
+ mouseLeaveDelay?: number
+ placement?: TooltipPlacement
+ trigger?: 'hover' | 'click'
+ message?: string
+ enabled?: boolean
+ }>(),
+ {
+ mouseLeaveDelay: 0.3,
+ placement: 'left',
+ trigger: 'hover',
+ },
+)
</script>
<template>
@@ -18,9 +25,9 @@ defineProps<{
:disabled="!enabled"
:tooltip-style="{ 'min-width': 'max-content' }"
:overlay-inner-style="{ 'min-width': 'max-content' }"
- :mouse-leave-delay="0.3"
- placement="left"
- trigger="hover"
+ :mouse-leave-delay="mouseLeaveDelay"
+ :placement="placement"
+ :trigger="trigger"
>
<template #title>
<slot name="title">
diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json
index 020a19403c..e783f8acaa 100644
--- a/packages/nc-gui/lang/en.json
+++ b/packages/nc-gui/lang/en.json
@@ -666,7 +666,9 @@
"copyConfigurationFromAnotherView": "Copy configuration from another view",
"notSupportedByViewType": "Not supported by {view} view type",
"viewConfigurationCopied": "View configuration copied successfully",
- "errorOccuredWhileCopyingViewConfiguration": "An error occurred while copying view configuration"
+ "errorOccuredWhileCopyingViewConfiguration": "An error occurred while copying view configuration",
+ "copyFromAnotherView": "Copy from another view",
+ "copyFromAView": "Copy from a view"
}
},
"datatype": {