diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index db9ce5f061..445bec4897 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/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)" /> () -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)) diff --git a/packages/nc-gui/components/virtual-cell/components/ListItems.vue b/packages/nc-gui/components/virtual-cell/components/ListItems.vue index 448b408b82..2cd3ed1cab 100644 --- a/packages/nc-gui/components/virtual-cell/components/ListItems.vue +++ b/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) => { if (isNew.value) { addLTARRef(row, column?.value as ColumnType) + saveRow() } else { await link(row) } diff --git a/packages/nc-gui/context/index.ts b/packages/nc-gui/context/index.ts index 1b7a53e790..f362ea0c57 100644 --- a/packages/nc-gui/context/index.ts +++ b/packages/nc-gui/context/index.ts @@ -33,3 +33,4 @@ export const CellUrlDisableOverlayInj: InjectionKey> = Symbol('cell export const DropZoneRef: InjectionKey> = Symbol('drop-zone-ref') export const ToggleDialogInj: InjectionKey = Symbol('toggle-dialog-injection') export const CellClickHookInj: InjectionKey | undefined> = Symbol('cell-click-injection') +export const SaveRowInj: InjectionKey<(() => void) | undefined> = Symbol('save-row-injection')