Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/shared/components/ncTable/mixins/cellEditMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export default {
return false
}

// Prevent editing for readonly columns
if (this.isView && this.column?.viewColumnInformation?.readonly) {
return false
}

return true
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="cell-datetime">
<div class="cell-datetime" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">

@silverkszlo silverkszlo Sep 11, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a title would be great here and in the other divs with similar functionality: :title="!canEditCell() ? t('tables', 'Read only') : ''"

<div v-if="!isEditing" class="non-edit-mode" role="button" aria-label="Edit date/time"
tabindex="0"
@click="handleStartEditing">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="cell-editor">
<div class="cell-editor" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
<div v-if="!isEditing" @click="handleStartEditing">
<NcEditor v-if="value && value.trim()"
:can-edit="false"
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/ncTable/partials/TableCellHtml.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="cell-editor tables-tiptap-wrapper">
<div class="cell-editor tables-tiptap-wrapper" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
<div v-if="!isEditing" @click="handleStartEditing">
<EditorContent :editor="editor" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="cell-multi-selection">
<div class="cell-multi-selection" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
<div v-if="!isEditing" class="non-edit-mode" @click="handleStartEditing">
<ul>
<li v-for="v in getObjects()" :key="v.id">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="cell-number">
<div class="cell-number" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
<div v-if="!isEditing" class="number-display" @click="startEditing">
{{ column.numberPrefix }}{{ getValue }}{{ column.numberSuffix }}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="cell-progress" @click="startEditingProgress">
<div class="cell-progress" :style="{ opacity: !canEditCell() ? 0.6 : 1 }" @click="startEditingProgress">
<div v-if="!isEditing" class="progress-display">
<NcProgressBar :value="getValue" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="cell-stars">
<div class="cell-stars" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
<div v-if="!isEditing" @click="startEditing">
<div class="stars-display">
{{ getValue }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="cell-text-line">
<div class="cell-text-line" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
<div v-if="!isEditing" @click="startEditing">
{{ value || '' }}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="cell-usergroup">
<div class="cell-usergroup" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
<div v-if="!isEditing" class="non-edit-mode" @click="handleStartEditing">
<div v-if="value" class="table-cell-usergroup">
<div v-for="item in value" :key="item.id" class="inline usergroup-entry">
Expand Down
15 changes: 13 additions & 2 deletions src/shared/components/ncTable/partials/TableCellYesNo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="inline-editing-container">
<NcCheckboxRadioSwitch v-model="localValue" :loading="localLoading" type="switch" @update:modelValue="onToggle" />
<div class="inline-editing-container" :class="{ 'readonly': !canEditCell() }" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
<NcCheckboxRadioSwitch
v-model="localValue"
:loading="localLoading"
:disabled="!canEditCell()"
type="switch"
@update:modelValue="onToggle" />
</div>
</template>

Expand Down Expand Up @@ -41,6 +46,12 @@ export default {

methods: {
async onToggle() {
// Prevent changes if column is readonly
if (!this.canEditCell()) {
this.localValue = !this.localValue // revert the change
return
}

const response = await this.updateCellValue(this.localValue)
if (!response) {
this.localValue = !this.localValue // revert to previous value
Expand Down
Loading