Browse Source

fix(nc-gui): remove `useMetas` from cb fn

pull/4062/head
braks 2 years ago
parent
commit
95f252ba84
  1. 8
      packages/nc-gui/components/smartsheet/Cell.vue
  2. 8
      packages/nc-gui/components/smartsheet/Grid.vue
  3. 9
      packages/nc-gui/composables/useViewData.ts

8
packages/nc-gui/components/smartsheet/Cell.vue

@ -58,10 +58,14 @@ const isLocked = inject(IsLockedInj, ref(false))
const { currentRow } = useSmartsheetRowStoreOrThrow()
const syncValue = useDebounceFn(function () {
const syncValue = useDebounceFn(
() => {
currentRow.value.rowMeta.changed = false
emit('save')
}, 1000)
},
500,
{ maxWait: 2000 },
)
const isAutoSaved = $computed(() => {
return [

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

@ -506,8 +506,8 @@ watch(
class="cell relative cursor-pointer nc-grid-cell"
:class="{
'active':
(isUIAllowed('xcDatatableEditable') && selected.col === colIndex && selected.row === rowIndex) ||
(isUIAllowed('xcDatatableEditable') && selectedRange(rowIndex, colIndex)),
(hasEditPermission && selected.col === colIndex && selected.row === rowIndex) ||
(hasEditPermission && selectedRange(rowIndex, colIndex)),
'nc-required-cell': isColumnRequiredAndNull(columnObj, row.row),
}"
:data-key="rowIndex + columnObj.id"
@ -533,7 +533,9 @@ watch(
v-else
v-model="row.row[columnObj.title]"
:column="columnObj"
:edit-enabled="hasEditPermission && editEnabled && selected.col === colIndex && selected.row === rowIndex"
:edit-enabled="
!!hasEditPermission && !!editEnabled && selected.col === colIndex && selected.row === rowIndex
"
:row-index="rowIndex"
:active="selected.col === colIndex && selected.row === rowIndex"
@update:edit-enabled="editEnabled = false"

9
packages/nc-gui/composables/useViewData.ts

@ -44,6 +44,9 @@ export function useViewData(
const { api, isLoading, error } = useApi()
const { appInfo } = $(useGlobal())
const { getMeta } = useMetas()
const appInfoDefaultLimit = appInfo.defaultLimit || 25
const _paginationData = ref<PaginatedType>({ page: 1, pageSize: appInfoDefaultLimit })
const aggCommentCount = ref<{ row_id: string; count: number }[]>([])
@ -203,8 +206,6 @@ export function useViewData(
{ metaValue = meta.value, viewMetaValue = viewMeta.value }: { metaValue?: TableType; viewMetaValue?: ViewType } = {},
) {
try {
const { getMeta } = useMetas()
const { missingRequiredColumns, insertObj } = await populateInsertObject({
meta: metaValue!,
ltarState,
@ -258,15 +259,13 @@ export function useViewData(
// }
)
// audit
$api.utils
.auditRowUpdate(id, {
$api.utils.auditRowUpdate(id, {
fk_model_id: meta.value?.id as string,
column_name: property,
row_id: id,
value: getHTMLEncodedText(toUpdate.row[property]),
prev_value: getHTMLEncodedText(toUpdate.oldRow[property]),
})
.then(() => {})
/** update row data(to sync formula and other related columns) */
Object.assign(toUpdate.row, updatedRowData)

Loading…
Cancel
Save