Browse Source

Merge pull request #5016 from nocodb/fix/4978-new-rowsave

fix(gui): save new row even if user set LTAR column first
pull/5025/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
4743b6e1f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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

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

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

@ -7,6 +7,7 @@ import {
IsFormInj,
IsGridInj,
RowInj,
SaveRowInj,
inject,
isBarcode,
isBt,
@ -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

@ -6,6 +6,7 @@ import {
ColumnInj,
Empty,
IsPublicInj,
SaveRowInj,
computed,
inject,
isDrawerExist,
@ -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