@fy-/fws-vue 2.3.85 → 2.3.87
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/components/ui/DefaultGallery.vue +103 -16
- package/package.json +1 -1
|
@@ -101,6 +101,8 @@ const props = withDefaults(
|
|
|
101
101
|
saveOrderText?: string
|
|
102
102
|
onSaveOrder?: Function
|
|
103
103
|
showSaveOrder?: boolean
|
|
104
|
+
getItemPosition?: Function
|
|
105
|
+
onPositionChange?: Function
|
|
104
106
|
}>(),
|
|
105
107
|
{
|
|
106
108
|
modelValue: 0,
|
|
@@ -131,6 +133,8 @@ const props = withDefaults(
|
|
|
131
133
|
saveOrderText: 'Save Order',
|
|
132
134
|
onSaveOrder: undefined,
|
|
133
135
|
showSaveOrder: false,
|
|
136
|
+
getItemPosition: (item: any, index: number) => item.UserIndex ?? index,
|
|
137
|
+
onPositionChange: undefined,
|
|
134
138
|
},
|
|
135
139
|
)
|
|
136
140
|
|
|
@@ -151,6 +155,22 @@ const localEditMode = computed({
|
|
|
151
155
|
set: value => emit('update:editMode', value),
|
|
152
156
|
})
|
|
153
157
|
|
|
158
|
+
// Reorder mode - separate from delete mode
|
|
159
|
+
const localReorderMode = ref(false)
|
|
160
|
+
|
|
161
|
+
function toggleReorderMode() {
|
|
162
|
+
localReorderMode.value = !localReorderMode.value
|
|
163
|
+
if (localReorderMode.value) {
|
|
164
|
+
// Exit delete mode when entering reorder mode
|
|
165
|
+
localEditMode.value = false
|
|
166
|
+
localSelectedItems.value = new Set()
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function exitReorderMode() {
|
|
171
|
+
localReorderMode.value = false
|
|
172
|
+
}
|
|
173
|
+
|
|
154
174
|
const localSelectedItems = computed({
|
|
155
175
|
get: () => props.selectedItems,
|
|
156
176
|
set: value => emit('update:selectedItems', value),
|
|
@@ -159,6 +179,10 @@ const localSelectedItems = computed({
|
|
|
159
179
|
// Edit mode functions
|
|
160
180
|
function toggleEditMode() {
|
|
161
181
|
localEditMode.value = !localEditMode.value
|
|
182
|
+
if (localEditMode.value) {
|
|
183
|
+
// Exit reorder mode when entering delete mode
|
|
184
|
+
localReorderMode.value = false
|
|
185
|
+
}
|
|
162
186
|
if (!localEditMode.value) {
|
|
163
187
|
// Clear selections when exiting edit mode
|
|
164
188
|
localSelectedItems.value = new Set()
|
|
@@ -902,14 +926,21 @@ onUnmounted(() => {
|
|
|
902
926
|
|
|
903
927
|
<!-- Edit Mode Controls (only if editEnabled is true) -->
|
|
904
928
|
<div v-if="editEnabled && images.length > 0 && (mode === 'grid' || mode === 'mason' || mode === 'custom')">
|
|
905
|
-
<!--
|
|
906
|
-
<div v-if="!localEditMode" class="flex justify-end mb-3">
|
|
929
|
+
<!-- Mode Toggle Buttons (only show when not in any edit mode) -->
|
|
930
|
+
<div v-if="!localEditMode && !localReorderMode" class="flex justify-end mb-3 gap-2">
|
|
907
931
|
<button
|
|
908
932
|
class="px-4 py-2 rounded-lg font-medium text-sm transition-colors bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-800 dark:text-gray-200"
|
|
909
933
|
@click="toggleEditMode"
|
|
910
934
|
>
|
|
911
935
|
{{ editButtonText }}
|
|
912
936
|
</button>
|
|
937
|
+
<button
|
|
938
|
+
v-if="showSaveOrder"
|
|
939
|
+
class="px-4 py-2 rounded-lg font-medium text-sm transition-colors bg-blue-600 hover:bg-blue-700 text-white"
|
|
940
|
+
@click="toggleReorderMode"
|
|
941
|
+
>
|
|
942
|
+
{{ saveOrderText }}
|
|
943
|
+
</button>
|
|
913
944
|
</div>
|
|
914
945
|
|
|
915
946
|
<!-- Bulk Actions Bar TOP (shown when in edit mode) -->
|
|
@@ -941,13 +972,6 @@ onUnmounted(() => {
|
|
|
941
972
|
>
|
|
942
973
|
{{ cancelButtonText }}
|
|
943
974
|
</button>
|
|
944
|
-
<button
|
|
945
|
-
v-if="showSaveOrder && onSaveOrder"
|
|
946
|
-
class="px-4 py-1.5 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded-md transition-colors font-medium"
|
|
947
|
-
@click="onSaveOrder()"
|
|
948
|
-
>
|
|
949
|
-
{{ saveOrderText }}
|
|
950
|
-
</button>
|
|
951
975
|
<button
|
|
952
976
|
class="px-4 py-1.5 text-sm bg-red-600 hover:bg-red-700 text-white rounded-md transition-colors font-medium"
|
|
953
977
|
:disabled="localSelectedItems.size === 0"
|
|
@@ -958,6 +982,33 @@ onUnmounted(() => {
|
|
|
958
982
|
</button>
|
|
959
983
|
</div>
|
|
960
984
|
</div>
|
|
985
|
+
|
|
986
|
+
<!-- Reorder Mode Bar TOP (shown when in reorder mode) -->
|
|
987
|
+
<div
|
|
988
|
+
v-if="localReorderMode"
|
|
989
|
+
class="flex flex-wrap items-center justify-between gap-2 p-3 mb-3 bg-blue-50 dark:bg-blue-900/30 rounded-lg border border-blue-300 dark:border-blue-700"
|
|
990
|
+
>
|
|
991
|
+
<div class="flex items-center gap-3">
|
|
992
|
+
<span class="text-sm font-medium text-blue-800 dark:text-blue-200">
|
|
993
|
+
Set position numbers on images (lower = earlier)
|
|
994
|
+
</span>
|
|
995
|
+
</div>
|
|
996
|
+
<div class="flex items-center gap-2">
|
|
997
|
+
<button
|
|
998
|
+
class="px-4 py-1.5 text-sm bg-gray-600 hover:bg-gray-700 text-white rounded-md transition-colors font-medium"
|
|
999
|
+
@click="exitReorderMode"
|
|
1000
|
+
>
|
|
1001
|
+
{{ cancelButtonText }}
|
|
1002
|
+
</button>
|
|
1003
|
+
<button
|
|
1004
|
+
v-if="onSaveOrder"
|
|
1005
|
+
class="px-4 py-1.5 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded-md transition-colors font-medium"
|
|
1006
|
+
@click="onSaveOrder()"
|
|
1007
|
+
>
|
|
1008
|
+
{{ saveOrderText }}
|
|
1009
|
+
</button>
|
|
1010
|
+
</div>
|
|
1011
|
+
</div>
|
|
961
1012
|
</div>
|
|
962
1013
|
|
|
963
1014
|
<!-- Thumbnail Grid/Masonry/Custom Layouts if gallery is not open -->
|
|
@@ -1070,6 +1121,21 @@ onUnmounted(() => {
|
|
|
1070
1121
|
</div>
|
|
1071
1122
|
</div>
|
|
1072
1123
|
|
|
1124
|
+
<!-- Position input for reorder mode -->
|
|
1125
|
+
<div
|
|
1126
|
+
v-if="localReorderMode && onPositionChange"
|
|
1127
|
+
class="absolute top-2 right-2 z-20"
|
|
1128
|
+
>
|
|
1129
|
+
<input
|
|
1130
|
+
type="number"
|
|
1131
|
+
min="0"
|
|
1132
|
+
:value="getItemPosition(images[i - 1], i - 1)"
|
|
1133
|
+
class="w-16 h-7 text-sm text-center rounded border border-blue-400 bg-white/95 dark:bg-black/95 dark:text-white font-medium"
|
|
1134
|
+
@change="(e: Event) => onPositionChange(images[i - 1], parseInt((e.target as HTMLInputElement).value))"
|
|
1135
|
+
@click.stop
|
|
1136
|
+
>
|
|
1137
|
+
</div>
|
|
1138
|
+
|
|
1073
1139
|
<!-- Selection overlay -->
|
|
1074
1140
|
<div
|
|
1075
1141
|
v-if="localEditMode && isItemSelected(images[i - 1], i - 1)"
|
|
@@ -1133,13 +1199,6 @@ onUnmounted(() => {
|
|
|
1133
1199
|
>
|
|
1134
1200
|
{{ cancelButtonText }}
|
|
1135
1201
|
</button>
|
|
1136
|
-
<button
|
|
1137
|
-
v-if="showSaveOrder && onSaveOrder"
|
|
1138
|
-
class="px-4 py-1.5 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded-md transition-colors font-medium"
|
|
1139
|
-
@click="onSaveOrder()"
|
|
1140
|
-
>
|
|
1141
|
-
{{ saveOrderText }}
|
|
1142
|
-
</button>
|
|
1143
1202
|
<button
|
|
1144
1203
|
class="px-4 py-1.5 text-sm bg-red-600 hover:bg-red-700 text-white rounded-md transition-colors font-medium"
|
|
1145
1204
|
:disabled="localSelectedItems.size === 0"
|
|
@@ -1152,6 +1211,34 @@ onUnmounted(() => {
|
|
|
1152
1211
|
</div>
|
|
1153
1212
|
</div>
|
|
1154
1213
|
|
|
1214
|
+
<!-- Reorder Mode Bar BOTTOM -->
|
|
1215
|
+
<div v-if="editEnabled && localReorderMode && images.length > 0 && (mode === 'grid' || mode === 'mason' || mode === 'custom')" class="mt-3">
|
|
1216
|
+
<div
|
|
1217
|
+
class="flex flex-wrap items-center justify-between gap-2 p-3 bg-blue-50 dark:bg-blue-900/30 rounded-lg border border-blue-300 dark:border-blue-700"
|
|
1218
|
+
>
|
|
1219
|
+
<div class="flex items-center gap-3">
|
|
1220
|
+
<span class="text-sm font-medium text-blue-800 dark:text-blue-200">
|
|
1221
|
+
Set position numbers on images (lower = earlier)
|
|
1222
|
+
</span>
|
|
1223
|
+
</div>
|
|
1224
|
+
<div class="flex items-center gap-2">
|
|
1225
|
+
<button
|
|
1226
|
+
class="px-4 py-1.5 text-sm bg-gray-600 hover:bg-gray-700 text-white rounded-md transition-colors font-medium"
|
|
1227
|
+
@click="exitReorderMode"
|
|
1228
|
+
>
|
|
1229
|
+
{{ cancelButtonText }}
|
|
1230
|
+
</button>
|
|
1231
|
+
<button
|
|
1232
|
+
v-if="onSaveOrder"
|
|
1233
|
+
class="px-4 py-1.5 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded-md transition-colors font-medium"
|
|
1234
|
+
@click="onSaveOrder()"
|
|
1235
|
+
>
|
|
1236
|
+
{{ saveOrderText }}
|
|
1237
|
+
</button>
|
|
1238
|
+
</div>
|
|
1239
|
+
</div>
|
|
1240
|
+
</div>
|
|
1241
|
+
|
|
1155
1242
|
<!-- Button Mode -->
|
|
1156
1243
|
<button
|
|
1157
1244
|
v-if="mode === 'button'"
|