Browse Source

Merge pull request #6851 from nocodb/nc-fix/expanded-form-readonly-field

Nc fix/expanded form readonly field
pull/6856/head
Raju Udava 11 months ago committed by GitHub
parent
commit
d4de5530ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      packages/nc-gui/components/smartsheet/column/DefaultValue.vue
  2. 21
      packages/nc-gui/components/smartsheet/expanded-form/index.vue

13
packages/nc-gui/components/smartsheet/column/DefaultValue.vue

@ -24,6 +24,8 @@ useProvideSmartsheetRowStore(meta, rowRef)
const cdfValue = ref<string | null>(null)
const editEnabled = ref(false)
const updateCdfValue = (cdf: string | null) => {
vModel.value.cdf = cdf
cdfValue.value = vModel.value.cdf
@ -37,13 +39,20 @@ onMounted(() => {
<template>
<div class="!my-3 text-xs">{{ $t('placeholder.defaultValue') }}</div>
<div class="flex flex-row gap-2">
<div class="border-1 flex items-center w-full px-3 my-[-4px] border-gray-300 rounded-md">
<div
class="border-1 flex items-center w-full px-3 my-[-4px] border-gray-300 rounded-md"
:class="{
'!border-brand-500': editEnabled,
}"
>
<LazySmartsheetCell
:edit-enabled="true"
:model-value="cdfValue"
:column="vModel"
:edit-enabled="true"
class="!border-none"
@update:cdf="updateCdfValue"
@update:edit-enabled="editEnabled = $event"
@click="editEnabled = true"
/>
<component
:is="iconMap.close"

21
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -1,5 +1,5 @@
<script setup lang="ts">
import type { TableType, ViewType } from 'nocodb-sdk'
import type { ColumnType, TableType, ViewType } from 'nocodb-sdk'
import { ViewTypes, isLinksOrLTAR, isSystemColumn, isVirtualCol } from 'nocodb-sdk'
import type { Ref } from 'vue'
import MdiChevronDown from '~icons/mdi/chevron-down'
@ -432,6 +432,10 @@ const onIsExpandedUpdate = (v: boolean) => {
isExpanded.value = v
}
}
const isReadOnlyVirtualCell = (column: ColumnType) => {
return isRollup(column) || isFormula(column) || isBarcode(column) || isLookup(column) || isQrCode(column)
}
</script>
<script lang="ts">
@ -633,9 +637,20 @@ export default {
<SmartsheetDivDataCell
v-if="col.title"
:ref="i ? null : (el: any) => (cellWrapperEl = el)"
class="!bg-white rounded-lg !w-[20rem] !xs:w-full border-1 border-gray-200 overflow-hidden px-1 sm:min-h-[35px] xs:min-h-13 flex items-center relative"
class="bg-white rounded-lg !w-[20rem] !xs:w-full border-1 border-gray-200 overflow-hidden px-1 sm:min-h-[35px] xs:min-h-13 flex items-center relative"
:class="{
'!bg-gray-50 !px-0 !select-text': isReadOnlyVirtualCell(col),
}"
>
<LazySmartsheetVirtualCell v-if="isVirtualCol(col)" v-model="_row.row[col.title]" :row="_row" :column="col" />
<LazySmartsheetVirtualCell
v-if="isVirtualCol(col)"
v-model="_row.row[col.title]"
:row="_row"
:column="col"
:class="{
'px-1': isReadOnlyVirtualCell(col),
}"
/>
<LazySmartsheetCell
v-else

Loading…
Cancel
Save