Browse Source

fix: Added readonly mode to expanded form cells

pull/7089/head
Muhammed Mustafa 10 months ago
parent
commit
4123ff0d12
  1. 7
      packages/nc-gui/components/smartsheet/VirtualCell.vue
  2. 8
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  3. 3
      packages/nc-gui/components/virtual-cell/Links.vue

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

@ -31,6 +31,7 @@ const props = defineProps<{
modelValue: any modelValue: any
row?: Row row?: Row
active?: boolean active?: boolean
readOnly?: boolean
}>() }>()
const emit = defineEmits(['update:modelValue', 'navigate', 'save']) const emit = defineEmits(['update:modelValue', 'navigate', 'save'])
@ -38,12 +39,14 @@ const emit = defineEmits(['update:modelValue', 'navigate', 'save'])
const column = toRef(props, 'column') const column = toRef(props, 'column')
const active = toRef(props, 'active', false) const active = toRef(props, 'active', false)
const row = toRef(props, 'row') const row = toRef(props, 'row')
const readOnly = toRef(props, 'readOnly', false)
provide(ColumnInj, column) provide(ColumnInj, column)
provide(ActiveCellInj, active) provide(ActiveCellInj, active)
provide(RowInj, row) provide(RowInj, row)
provide(CellValueInj, toRef(props, 'modelValue')) provide(CellValueInj, toRef(props, 'modelValue'))
provide(SaveRowInj, () => emit('save')) provide(SaveRowInj, () => emit('save'))
provide(ReadonlyInj, readOnly)
const isGrid = inject(IsGridInj, ref(false)) const isGrid = inject(IsGridInj, ref(false))
@ -94,7 +97,9 @@ onUnmounted(() => {
<div <div
ref="elementToObserve" ref="elementToObserve"
class="nc-virtual-cell w-full flex items-center" class="nc-virtual-cell w-full flex items-center"
:class="{ 'text-right justify-end': isGrid && !isForm && isRollup(column) && !isExpandedForm }" :class="{
'text-right justify-end': isGrid && !isForm && isRollup(column) && !isExpandedForm,
}"
@keydown.enter.exact="onNavigate(NavigateDir.NEXT, $event)" @keydown.enter.exact="onNavigate(NavigateDir.NEXT, $event)"
@keydown.shift.enter.exact="onNavigate(NavigateDir.PREV, $event)" @keydown.shift.enter.exact="onNavigate(NavigateDir.PREV, $event)"
> >

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

@ -88,6 +88,8 @@ const isRecordLinkCopied = ref(false)
const { isUIAllowed } = useRoles() const { isUIAllowed } = useRoles()
const readOnly = computed(() => !isUIAllowed('dataEdit') || isPublic.value)
const reloadTrigger = inject(ReloadRowDataHookInj, createEventHook()) const reloadTrigger = inject(ReloadRowDataHookInj, createEventHook())
const { addOrEditStackRow } = useKanbanViewStoreOrThrow() const { addOrEditStackRow } = useKanbanViewStoreOrThrow()
@ -669,6 +671,7 @@ export default {
:class="{ :class="{
'px-1': isReadOnlyVirtualCell(col), 'px-1': isReadOnlyVirtualCell(col),
}" }"
:read-only="readOnly"
/> />
<LazySmartsheetCell <LazySmartsheetCell
@ -677,7 +680,7 @@ export default {
:column="col" :column="col"
:edit-enabled="true" :edit-enabled="true"
:active="true" :active="true"
:read-only="isPublic" :read-only="readOnly"
@update:model-value="changedColumns.add(col.title)" @update:model-value="changedColumns.add(col.title)"
/> />
</SmartsheetDivDataCell> </SmartsheetDivDataCell>
@ -737,6 +740,7 @@ export default {
v-model="_row.row[col.title]" v-model="_row.row[col.title]"
:row="_row" :row="_row"
:column="col" :column="col"
:read-only="readOnly"
/> />
<LazySmartsheetCell <LazySmartsheetCell
@ -745,7 +749,7 @@ export default {
:column="col" :column="col"
:edit-enabled="true" :edit-enabled="true"
:active="true" :active="true"
:read-only="isPublic" :read-only="readOnly"
@update:model-value="changedColumns.add(col.title)" @update:model-value="changedColumns.add(col.title)"
/> />
</LazySmartsheetDivDataCell> </LazySmartsheetDivDataCell>

3
packages/nc-gui/components/virtual-cell/Links.vue

@ -112,7 +112,7 @@ const openListDlg = () => {
v-e="['c:cell:links:modal:open']" v-e="['c:cell:links:modal:open']"
:title="textVal" :title="textVal"
class="text-center nc-datatype-link underline-transparent" class="text-center nc-datatype-link underline-transparent"
:class="{ '!text-gray-300': !textVal }" :class="{ '!text-gray-300': !textVal, 'pointer-events-none': readOnly }"
@click.stop.prevent="openChildList" @click.stop.prevent="openChildList"
> >
{{ textVal }} {{ textVal }}
@ -127,7 +127,6 @@ const openListDlg = () => {
@click.stop="openListDlg" @click.stop="openListDlg"
/> />
</div> </div>
<LazyVirtualCellComponentsListItems <LazyVirtualCellComponentsListItems
v-if="listItemsDlg || childListDlg" v-if="listItemsDlg || childListDlg"
v-model="listItemsDlg" v-model="listItemsDlg"

Loading…
Cancel
Save