@adminforth/list-in-place-edit 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.woodpecker/release.yml +0 -2
- package/build.log +2 -2
- package/custom/InPlaceEdit.vue +14 -4
- package/dist/custom/InPlaceEdit.vue +14 -4
- package/package.json +1 -1
package/.woodpecker/release.yml
CHANGED
package/build.log
CHANGED
package/custom/InPlaceEdit.vue
CHANGED
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
15
|
<!-- Edit mode -->
|
|
16
|
-
<div v-else class="flex items-center
|
|
16
|
+
<div v-else class="flex items-center gap-2 min-w-[200px]">
|
|
17
17
|
<ColumnValueInputWrapper
|
|
18
18
|
ref="input"
|
|
19
|
+
class="flex-grow"
|
|
19
20
|
:source="'edit'"
|
|
20
21
|
:column="column"
|
|
21
22
|
:currentValues="currentValues"
|
|
@@ -27,8 +28,11 @@
|
|
|
27
28
|
<div class="flex gap-1">
|
|
28
29
|
<button
|
|
29
30
|
@click="saveEdit"
|
|
30
|
-
:disabled="saving"
|
|
31
|
-
class="
|
|
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
|
+
]"
|
|
32
36
|
>
|
|
33
37
|
<IconCheckOutline class="w-5 h-5" />
|
|
34
38
|
</button>
|
|
@@ -45,7 +49,7 @@
|
|
|
45
49
|
</template>
|
|
46
50
|
|
|
47
51
|
<script setup lang="ts">
|
|
48
|
-
import { ref } from 'vue';
|
|
52
|
+
import { ref, computed } from 'vue';
|
|
49
53
|
import { IconPenSolid, IconCheckOutline, IconXOutline } from '@iconify-prerendered/vue-flowbite';
|
|
50
54
|
import { callAdminForthApi } from '@/utils';
|
|
51
55
|
import { showErrorTost, showSuccesTost } from '@/composables/useFrontendApi';
|
|
@@ -63,6 +67,12 @@ const columnOptions = ref({});
|
|
|
63
67
|
const mode = ref('edit');
|
|
64
68
|
const currentValues = ref({});
|
|
65
69
|
const 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
|
+
});
|
|
66
76
|
|
|
67
77
|
function startEdit() {
|
|
68
78
|
const value = props.record[props.column.name];
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
15
|
<!-- Edit mode -->
|
|
16
|
-
<div v-else class="flex items-center
|
|
16
|
+
<div v-else class="flex items-center gap-2 min-w-[200px]">
|
|
17
17
|
<ColumnValueInputWrapper
|
|
18
18
|
ref="input"
|
|
19
|
+
class="flex-grow"
|
|
19
20
|
:source="'edit'"
|
|
20
21
|
:column="column"
|
|
21
22
|
:currentValues="currentValues"
|
|
@@ -27,8 +28,11 @@
|
|
|
27
28
|
<div class="flex gap-1">
|
|
28
29
|
<button
|
|
29
30
|
@click="saveEdit"
|
|
30
|
-
:disabled="saving"
|
|
31
|
-
class="
|
|
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
|
+
]"
|
|
32
36
|
>
|
|
33
37
|
<IconCheckOutline class="w-5 h-5" />
|
|
34
38
|
</button>
|
|
@@ -45,7 +49,7 @@
|
|
|
45
49
|
</template>
|
|
46
50
|
|
|
47
51
|
<script setup lang="ts">
|
|
48
|
-
import { ref } from 'vue';
|
|
52
|
+
import { ref, computed } from 'vue';
|
|
49
53
|
import { IconPenSolid, IconCheckOutline, IconXOutline } from '@iconify-prerendered/vue-flowbite';
|
|
50
54
|
import { callAdminForthApi } from '@/utils';
|
|
51
55
|
import { showErrorTost, showSuccesTost } from '@/composables/useFrontendApi';
|
|
@@ -63,6 +67,12 @@ const columnOptions = ref({});
|
|
|
63
67
|
const mode = ref('edit');
|
|
64
68
|
const currentValues = ref({});
|
|
65
69
|
const 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
|
+
});
|
|
66
76
|
|
|
67
77
|
function startEdit() {
|
|
68
78
|
const value = props.record[props.column.name];
|