From 54a006bfab72b3a1abc34bfc2393a2489b89fbcd Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 16 Aug 2022 11:44:45 +0530 Subject: [PATCH] chore(gui-v2): lint Signed-off-by: Pranav C --- .../nc-gui-v2/components/smartsheet/Form.vue | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/packages/nc-gui-v2/components/smartsheet/Form.vue b/packages/nc-gui-v2/components/smartsheet/Form.vue index 4c1271cd7f..79cf0d1d8f 100644 --- a/packages/nc-gui-v2/components/smartsheet/Form.vue +++ b/packages/nc-gui-v2/components/smartsheet/Form.vue @@ -5,6 +5,7 @@ import { message } from 'ant-design-vue' import type { Permission } from '~/composables/useUIPermission/rolePermissions' import { ActiveViewInj, + EditModeInj, IsFormInj, MetaInj, computed, @@ -22,7 +23,6 @@ import { useViewData, watch, } from '#imports' -import { EditModeInj } from '~/context' provide(IsFormInj, ref(true)) @@ -45,7 +45,7 @@ const secondsRemain = ref(0) const isEditable = isUIAllowed('editFormView' as Permission) -const meta = inject(MetaInj) +const meta = inject(MetaInj)! const view = inject(ActiveViewInj) @@ -56,12 +56,14 @@ const { showAll, hideAll, saveOrUpdate } = useViewColumns(view, meta as any, fal setFormData() }) - -const { syncLTARRefs } = useProvideSmartsheetRowStore(meta!, ref({ - row: formState, - oldRow: {}, - rowMeta: { new: true }, -})) +const { syncLTARRefs } = useProvideSmartsheetRowStore( + meta, + ref({ + row: formState, + oldRow: {}, + rowMeta: { new: true }, + }), +) const columns = computed(() => meta?.value?.columns || []) @@ -133,7 +135,10 @@ function isDbRequired(column: Record) { // primary column (column.pk && !column.ai && !column.cdf) if (column.uidt === UITypes.LinkToAnotherRecord && column.colOptions.type === RelationTypes.BELONGS_TO) { - const col = columns.value.find((c: Record) => c.id === column.colOptions.fk_child_column_id) as Record + const col = columns.value.find((c: Record) => c.id === column.colOptions.fk_child_column_id) as Record< + string, + any + > if (col.rqd && !col.default) { isRequired = true } @@ -170,7 +175,7 @@ function onMove(event: any) { function hideColumn(idx: number) { if (isDbRequired(localColumns.value[idx]) || localColumns.value[idx].required) { - message.info('Required field can\'t be moved') + message.info("Required field can't be moved") return } @@ -268,8 +273,10 @@ function isRequired(_columnObj: Record, required = false) { columnObj.colOptions && columnObj.colOptions.type === RelationTypes.BELONGS_TO ) { - columnObj = columns.value.find((c: Record) => c.id === columnObj.colOptions.fk_child_column_id) as Record + columnObj = columns.value.find((c: Record) => c.id === columnObj.colOptions.fk_child_column_id) as Record< + string, + any + > } return required || (columnObj && columnObj.rqd && !columnObj.cdf) @@ -413,8 +420,7 @@ onMounted(async () => {