sprintify-ui 0.0.192 → 0.0.194
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/dist/sprintify-ui.es.js +2328 -2327
- package/dist/style.css +1 -1
- package/dist/tailwindcss/index.js +35 -35
- package/dist/types/src/components/BaseMenu.vue.d.ts +9 -0
- package/package.json +1 -1
- package/src/assets/main.css +11 -5
- package/src/components/BaseDataTable.vue +3 -11
- package/src/components/BaseMediaLibrary.vue +11 -10
- package/src/components/BaseMenu.vue +6 -2
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
</BaseFileUploader>
|
|
54
54
|
|
|
55
55
|
<div
|
|
56
|
-
v-if="
|
|
56
|
+
v-if="filteredCurrentMedia.length + normalizedModelValue.to_add.length"
|
|
57
57
|
class="mt-5"
|
|
58
58
|
>
|
|
59
59
|
<div class="-m-1 flex flex-wrap">
|
|
60
60
|
<div
|
|
61
|
-
v-for="(media, index) in
|
|
61
|
+
v-for="(media, index) in filteredCurrentMedia"
|
|
62
62
|
:key="media.id"
|
|
63
63
|
class="min-w-[220px] flex-1 p-1"
|
|
64
64
|
>
|
|
@@ -173,6 +173,12 @@ const emit = defineEmits([
|
|
|
173
173
|
'upload:end',
|
|
174
174
|
]);
|
|
175
175
|
|
|
176
|
+
const filteredCurrentMedia = computed(() => {
|
|
177
|
+
return props.currentMedia.filter((media) => {
|
|
178
|
+
return !normalizedModelValue.value.to_remove.includes(media.id);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
|
|
176
182
|
const { emitUpdate, enableForm, disableForm } = useField({
|
|
177
183
|
name: computed(() => props.name),
|
|
178
184
|
required: computed(() => false),
|
|
@@ -189,8 +195,6 @@ const normalizedMax = computed(() => {
|
|
|
189
195
|
return props.max;
|
|
190
196
|
});
|
|
191
197
|
|
|
192
|
-
const currentMediaInternal = ref(cloneDeep(props.currentMedia));
|
|
193
|
-
|
|
194
198
|
const normalizedModelValue = computed(() => {
|
|
195
199
|
if (
|
|
196
200
|
props.modelValue &&
|
|
@@ -209,7 +213,7 @@ const normalizedModelValue = computed(() => {
|
|
|
209
213
|
|
|
210
214
|
const numberOfFiles = computed((): number => {
|
|
211
215
|
return (
|
|
212
|
-
|
|
216
|
+
props.currentMedia.length +
|
|
213
217
|
(props.modelValue?.to_add.length ?? 0) -
|
|
214
218
|
(props.modelValue?.to_remove.length ?? 0)
|
|
215
219
|
);
|
|
@@ -241,9 +245,8 @@ function onUploadSuccess(file: UploadedFile) {
|
|
|
241
245
|
|
|
242
246
|
if (normalizedMax.value == 1) {
|
|
243
247
|
// Remove everything...
|
|
244
|
-
modelValue.to_remove.push(...
|
|
248
|
+
modelValue.to_remove.push(...props.currentMedia.map((m) => m.id));
|
|
245
249
|
modelValue.to_add = [];
|
|
246
|
-
currentMediaInternal.value = [];
|
|
247
250
|
}
|
|
248
251
|
|
|
249
252
|
modelValue.to_add.push(file);
|
|
@@ -284,7 +287,7 @@ function removeUploadedFile(index: number, length = 1) {
|
|
|
284
287
|
}
|
|
285
288
|
|
|
286
289
|
function removeMedia(index: number) {
|
|
287
|
-
const media =
|
|
290
|
+
const media = props.currentMedia[index];
|
|
288
291
|
|
|
289
292
|
if (media) {
|
|
290
293
|
const modelValue = cloneDeep(normalizedModelValue.value);
|
|
@@ -292,8 +295,6 @@ function removeMedia(index: number) {
|
|
|
292
295
|
modelValue.to_remove.push(media.id);
|
|
293
296
|
|
|
294
297
|
sync(modelValue);
|
|
295
|
-
|
|
296
|
-
currentMediaInternal.value.splice(index, 1);
|
|
297
298
|
}
|
|
298
299
|
}
|
|
299
300
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:class="[position == 'custom' ? 'static' : 'relative']"
|
|
7
7
|
>
|
|
8
8
|
<div>
|
|
9
|
-
<MenuButton class="
|
|
9
|
+
<MenuButton :class="buttonClass">
|
|
10
10
|
<slot name="button" :open="open" />
|
|
11
11
|
</MenuButton>
|
|
12
12
|
</div>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
>
|
|
22
22
|
<MenuItems
|
|
23
23
|
:class="[menuClass, menuPositionClass]"
|
|
24
|
-
class="absolute z-menu mt-2 rounded-md bg-white p-1 shadow-lg ring-1 ring-black ring-opacity-10 focus:outline-none"
|
|
24
|
+
class="absolute z-menu mt-2 rounded-md bg-white p-1 shadow-lg outline-none ring-1 ring-black ring-opacity-10 focus:outline-none"
|
|
25
25
|
>
|
|
26
26
|
<slot name="items" :items="items">
|
|
27
27
|
<template v-for="item in items" :key="item.label + 'link'">
|
|
@@ -119,6 +119,10 @@ const props = defineProps({
|
|
|
119
119
|
default: 'sm',
|
|
120
120
|
type: String as PropType<'xs' | 'sm' | 'md'>,
|
|
121
121
|
},
|
|
122
|
+
buttonClass: {
|
|
123
|
+
default: 'flex',
|
|
124
|
+
type: [String, Array, Object],
|
|
125
|
+
},
|
|
122
126
|
});
|
|
123
127
|
|
|
124
128
|
const menuPositionClass = computed(() => {
|