Skip to content

Commit 6cfeb69

Browse files
committed
feat(Inline editing): prevent editing read-only values
Signed-off-by: Enjeck C. <patrathewhiz@gmail.com>
1 parent 1cd2e15 commit 6cfeb69

11 files changed

Lines changed: 27 additions & 11 deletions

src/shared/components/ncTable/mixins/cellEditMixin.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ export default {
4747
return false
4848
}
4949

50+
// Prevent editing for readonly columns
51+
if (this.isView && this.column?.viewColumnInformation?.readonly) {
52+
return false
53+
}
54+
5055
return true
5156
},
5257

src/shared/components/ncTable/partials/TableCellDateTime.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>
6-
<div class="cell-datetime">
6+
<div class="cell-datetime" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
77
<div v-if="!isEditing" class="non-edit-mode" role="button" aria-label="Edit date/time"
88
tabindex="0"
99
@click="handleStartEditing">

src/shared/components/ncTable/partials/TableCellEditor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>
6-
<div class="cell-editor">
6+
<div class="cell-editor" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
77
<div v-if="!isEditing" @click="handleStartEditing">
88
<NcEditor v-if="value && value.trim()"
99
:can-edit="false"

src/shared/components/ncTable/partials/TableCellHtml.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>
6-
<div class="cell-editor tables-tiptap-wrapper">
6+
<div class="cell-editor tables-tiptap-wrapper" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
77
<div v-if="!isEditing" @click="handleStartEditing">
88
<EditorContent :editor="editor" />
99
</div>

src/shared/components/ncTable/partials/TableCellMultiSelection.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>
6-
<div class="cell-multi-selection">
6+
<div class="cell-multi-selection" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
77
<div v-if="!isEditing" class="non-edit-mode" @click="handleStartEditing">
88
<ul>
99
<li v-for="v in getObjects()" :key="v.id">

src/shared/components/ncTable/partials/TableCellNumber.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>
6-
<div class="cell-number">
6+
<div class="cell-number" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
77
<div v-if="!isEditing" class="number-display" @click="startEditing">
88
{{ column.numberPrefix }}{{ getValue }}{{ column.numberSuffix }}
99
</div>

src/shared/components/ncTable/partials/TableCellProgress.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>
6-
<div class="cell-progress" @click="startEditingProgress">
6+
<div class="cell-progress" :style="{ opacity: !canEditCell() ? 0.6 : 1 }" @click="startEditingProgress">
77
<div v-if="!isEditing" class="progress-display">
88
<NcProgressBar :value="getValue" />
99
</div>

src/shared/components/ncTable/partials/TableCellStars.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>
6-
<div class="cell-stars">
6+
<div class="cell-stars" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
77
<div v-if="!isEditing" @click="startEditing">
88
<div class="stars-display">
99
{{ getValue }}

src/shared/components/ncTable/partials/TableCellTextLine.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>
6-
<div class="cell-text-line">
6+
<div class="cell-text-line" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
77
<div v-if="!isEditing" @click="startEditing">
88
{{ value || '' }}
99
</div>

src/shared/components/ncTable/partials/TableCellUsergroup.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>
6-
<div class="cell-usergroup">
6+
<div class="cell-usergroup" :style="{ opacity: !canEditCell() ? 0.6 : 1 }">
77
<div v-if="!isEditing" class="non-edit-mode" @click="handleStartEditing">
88
<div v-if="value" class="table-cell-usergroup">
99
<div v-for="item in value" :key="item.id" class="inline usergroup-entry">

0 commit comments

Comments
 (0)