1313 </div >
1414
1515 <!-- Edit mode -->
16- <div v-else class =" flex items-center min-w-full max -w-full gap-2 " >
16+ <div v-else class =" flex items-center gap-2 min -w-[200px] " >
1717 <ColumnValueInputWrapper
1818 ref =" input"
19+ class =" flex-grow"
1920 :source =" 'edit'"
2021 :column =" column"
2122 :currentValues =" currentValues"
2728 <div class =" flex gap-1" >
2829 <button
2930 @click =" saveEdit"
30- :disabled =" saving"
31- class =" text-green-600 hover:text-green-700 dark:text-green-500 dark:hover:text-green-400"
31+ :disabled =" !isChanged || saving"
32+ :class =" [
33+ 'text-green-600 dark:text-green-500 hover:text-green-700 dark:hover:text-green-400',
34+ (!isChanged || saving) ? 'opacity-50 cursor-not-allowed pointer-events-none' : ''
35+ ]"
3236 >
3337 <IconCheckOutline class =" w-5 h-5" />
3438 </button >
4549</template >
4650
4751<script setup lang="ts">
48- import { ref } from ' vue' ;
52+ import { ref , computed } from ' vue' ;
4953import { IconPenSolid , IconCheckOutline , IconXOutline } from ' @iconify-prerendered/vue-flowbite' ;
5054import { callAdminForthApi } from ' @/utils' ;
5155import { showErrorTost , showSuccesTost } from ' @/composables/useFrontendApi' ;
@@ -63,6 +67,12 @@ const columnOptions = ref({});
6367const mode = ref (' edit' );
6468const currentValues = ref ({});
6569const unmasked = ref ({});
70+ const isChanged = computed (() => {
71+ const original = props .record [props .column .name ];
72+ const current = currentValues .value [props .column .name ];
73+
74+ return JSON .stringify (original ) !== JSON .stringify (current );
75+ });
6676
6777function startEdit() {
6878 const value = props .record [props .column .name ];
0 commit comments