Browse Source

fix(gui): save new row even if user set LTAR column first

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5016/head
Pranav C 2 years ago
parent
commit
1b606f99f8
  1. 1
      packages/nc-gui/components/smartsheet/Grid.vue
  2. 4
      packages/nc-gui/components/smartsheet/VirtualCell.vue
  3. 4
      packages/nc-gui/components/virtual-cell/components/ListItems.vue
  4. 1
      packages/nc-gui/context/index.ts

1
packages/nc-gui/components/smartsheet/Grid.vue

@ -867,6 +867,7 @@ const rowHeight = computed(() => {
:row="row"
:read-only="readOnly"
@navigate="onNavigate"
@save="updateOrSaveRow(row, '', state)"
/>
<LazySmartsheetCell

4
packages/nc-gui/components/smartsheet/VirtualCell.vue

@ -3,6 +3,7 @@ import type { ColumnType } from 'nocodb-sdk'
import {
ActiveCellInj,
CellValueInj,
SaveRowInj,
ColumnInj,
IsFormInj,
IsGridInj,
@ -30,7 +31,7 @@ const props = defineProps<{
active?: boolean
}>()
const emit = defineEmits(['update:modelValue', 'navigate'])
const emit = defineEmits(['update:modelValue', 'navigate', 'save'])
const column = toRef(props, 'column')
const active = toRef(props, 'active', false)
@ -40,6 +41,7 @@ provide(ColumnInj, column)
provide(ActiveCellInj, active)
provide(RowInj, row)
provide(CellValueInj, toRef(props, 'modelValue'))
provide(SaveRowInj, () => emit('save'))
const isGrid = inject(IsGridInj, ref(false))

4
packages/nc-gui/components/virtual-cell/components/ListItems.vue

@ -16,6 +16,7 @@ import {
useVModel,
watch,
} from '#imports'
import { SaveRowInj } from '~/context'
const props = defineProps<{ modelValue: boolean }>()
@ -43,11 +44,14 @@ const { addLTARRef, isNew } = useSmartsheetRowStoreOrThrow()
const isPublic = inject(IsPublicInj, ref(false))
const saveRow = inject(SaveRowInj, () => {})
const selectedRowIndex = ref(0)
const linkRow = async (row: Record<string, any>) => {
if (isNew.value) {
addLTARRef(row, column?.value as ColumnType)
saveRow()
} else {
await link(row)
}

1
packages/nc-gui/context/index.ts

@ -33,3 +33,4 @@ export const CellUrlDisableOverlayInj: InjectionKey<Ref<boolean>> = Symbol('cell
export const DropZoneRef: InjectionKey<Ref<Element | undefined>> = Symbol('drop-zone-ref')
export const ToggleDialogInj: InjectionKey<Function> = Symbol('toggle-dialog-injection')
export const CellClickHookInj: InjectionKey<EventHook<MouseEvent> | undefined> = Symbol('cell-click-injection')
export const SaveRowInj: InjectionKey<(() => void) | undefined> = Symbol('save-row-injection')

Loading…
Cancel
Save