sprintify-ui 0.4.0 → 0.4.2
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 +33 -34
- package/dist/types/src/components/BaseForm.vue.d.ts +9 -0
- package/dist/types/src/components/BaseMediaList.vue.d.ts +1 -2
- package/dist/types/src/components/BaseMediaListItem.vue.d.ts +1 -2
- package/package.json +1 -1
- package/src/components/BaseFilePicker.vue +1 -4
- package/src/components/BaseFileUploader.vue +7 -4
- package/src/components/BaseForm.vue +6 -2
- package/src/components/BaseMediaList.vue +1 -2
- package/src/components/BaseMediaListItem.vue +5 -10
package/dist/sprintify-ui.es.js
CHANGED
|
@@ -18811,12 +18811,11 @@ const f1 = ["disabled"], d1 = ["accept", "multiple"], xs = /* @__PURE__ */ Ee({
|
|
|
18811
18811
|
r("start");
|
|
18812
18812
|
let d = [];
|
|
18813
18813
|
try {
|
|
18814
|
-
const f = new FormData();
|
|
18815
18814
|
if (Array.isArray(h))
|
|
18816
|
-
d = await Promise.all(h.map((
|
|
18815
|
+
d = await Promise.all(h.map((f) => c(f)));
|
|
18817
18816
|
else {
|
|
18818
|
-
const
|
|
18819
|
-
d.push(
|
|
18817
|
+
const f = await c(h);
|
|
18818
|
+
d.push(f);
|
|
18820
18819
|
}
|
|
18821
18820
|
r("success", d);
|
|
18822
18821
|
} catch (f) {
|
|
@@ -18829,16 +18828,17 @@ const f1 = ["disabled"], d1 = ["accept", "multiple"], xs = /* @__PURE__ */ Ee({
|
|
|
18829
18828
|
r("end"), s.value = !1;
|
|
18830
18829
|
}
|
|
18831
18830
|
}
|
|
18832
|
-
async function c(h
|
|
18833
|
-
|
|
18834
|
-
|
|
18835
|
-
|
|
18831
|
+
async function c(h) {
|
|
18832
|
+
const d = new FormData();
|
|
18833
|
+
d.append("file", h);
|
|
18834
|
+
const m = (await n.post(e.url ?? Lt.upload_url, d)).data;
|
|
18835
|
+
return m.original_file = h, new Promise((w) => {
|
|
18836
18836
|
const p = new FileReader();
|
|
18837
18837
|
p.onload = (g) => {
|
|
18838
18838
|
m.data_url = g.target.result, w(m);
|
|
18839
18839
|
}, p.onerror = () => {
|
|
18840
18840
|
w(m);
|
|
18841
|
-
}, m.mime_type.includes("image") ? p.readAsDataURL(
|
|
18841
|
+
}, m.mime_type.includes("image") ? p.readAsDataURL(h) : w(m);
|
|
18842
18842
|
});
|
|
18843
18843
|
}
|
|
18844
18844
|
return (h, d) => (P(), G("div", p1, [
|
|
@@ -18963,6 +18963,10 @@ const w1 = { class: "absolute inset-0 flex h-full w-full items-center justify-ce
|
|
|
18963
18963
|
default: "",
|
|
18964
18964
|
type: String
|
|
18965
18965
|
},
|
|
18966
|
+
showLoadingMask: {
|
|
18967
|
+
default: !0,
|
|
18968
|
+
type: Boolean
|
|
18969
|
+
},
|
|
18966
18970
|
showNotificationOnError: {
|
|
18967
18971
|
default: !0,
|
|
18968
18972
|
type: Boolean
|
|
@@ -19079,7 +19083,7 @@ const w1 = { class: "absolute inset-0 flex h-full w-full items-center justify-ce
|
|
|
19079
19083
|
"leave-to-class": "opacity-0"
|
|
19080
19084
|
}, {
|
|
19081
19085
|
default: _e(() => [
|
|
19082
|
-
T(l) ? Be(O.$slots, "loading", { key: 0 }, () => [
|
|
19086
|
+
T(l) && t.showLoadingMask ? Be(O.$slots, "loading", { key: 0 }, () => [
|
|
19083
19087
|
$("div", w1, [
|
|
19084
19088
|
$("div", {
|
|
19085
19089
|
class: pe(["absolute inset-0 h-full w-full", T(Yn)("bg-white opacity-80", t.twLoadingMask)])
|
|
@@ -21448,30 +21452,27 @@ const As = /* @__PURE__ */ Ee({
|
|
|
21448
21452
|
type: Boolean
|
|
21449
21453
|
}
|
|
21450
21454
|
},
|
|
21451
|
-
emits: ["remove", "update"
|
|
21455
|
+
emits: ["remove", "update"],
|
|
21452
21456
|
setup(t, { emit: r }) {
|
|
21453
21457
|
const e = t, n = le(800), o = le();
|
|
21454
21458
|
gr(o, () => {
|
|
21455
|
-
var
|
|
21456
|
-
n.value = ((
|
|
21459
|
+
var w;
|
|
21460
|
+
n.value = ((w = o.value) == null ? void 0 : w.clientWidth) ?? 800;
|
|
21457
21461
|
});
|
|
21458
21462
|
const a = U(() => n.value <= No.xs), l = U(() => No.sm >= n.value && n.value > No.xs), s = le("show"), u = U(() => e.media.name), c = U(() => e.media.file_name), h = U(() => "url" in e.media ? e.media.url : null), d = le();
|
|
21459
21463
|
function f() {
|
|
21460
21464
|
e.disabled || (s.value = "edit", setTimeout(() => {
|
|
21461
|
-
var
|
|
21462
|
-
(
|
|
21465
|
+
var w, p;
|
|
21466
|
+
(w = d.value) == null || w.focus(), (p = d.value) == null || p.select();
|
|
21463
21467
|
}, 100));
|
|
21464
21468
|
}
|
|
21465
|
-
function m(
|
|
21466
|
-
const
|
|
21467
|
-
|
|
21468
|
-
const
|
|
21469
|
-
|
|
21470
|
-
}
|
|
21471
|
-
function w() {
|
|
21472
|
-
s.value = "show", r("save:name");
|
|
21469
|
+
function m() {
|
|
21470
|
+
const w = d.value, p = Nt(e.media);
|
|
21471
|
+
p.name = (w == null ? void 0 : w.value) ?? "";
|
|
21472
|
+
const g = p.file_name.split(".").pop();
|
|
21473
|
+
p.file_name = p.name + "." + g, s.value = "show", r("update", p);
|
|
21473
21474
|
}
|
|
21474
|
-
return (
|
|
21475
|
+
return (w, p) => (P(), G("li", {
|
|
21475
21476
|
ref_key: "itemRef",
|
|
21476
21477
|
ref: o,
|
|
21477
21478
|
class: pe(["group flex h-10 items-center justify-between", [T(a) ? "h-9" : "h-10"]])
|
|
@@ -21494,7 +21495,7 @@ const As = /* @__PURE__ */ Ee({
|
|
|
21494
21495
|
type: "button",
|
|
21495
21496
|
disabled: t.disabled,
|
|
21496
21497
|
class: "flex h-10 items-center overflow-hidden",
|
|
21497
|
-
onClick:
|
|
21498
|
+
onClick: p[0] || (p[0] = (g) => f())
|
|
21498
21499
|
}, [
|
|
21499
21500
|
$("span", {
|
|
21500
21501
|
class: pe(["mr-2 truncate", [(T(a), "text-sm")]])
|
|
@@ -21514,17 +21515,16 @@ const As = /* @__PURE__ */ Ee({
|
|
|
21514
21515
|
type: "text",
|
|
21515
21516
|
value: T(u),
|
|
21516
21517
|
autofocus: "",
|
|
21517
|
-
onInput: m,
|
|
21518
21518
|
onKeydown: [
|
|
21519
|
-
Hi(On(
|
|
21520
|
-
|
|
21519
|
+
Hi(On(m, ["prevent"]), ["enter"]),
|
|
21520
|
+
p[1] || (p[1] = Hi(On((g) => s.value = "show", ["prevent"]), ["escape"]))
|
|
21521
21521
|
]
|
|
21522
21522
|
}, null, 42, Qw),
|
|
21523
21523
|
$("div", Jw, [
|
|
21524
21524
|
$("button", {
|
|
21525
21525
|
type: "button",
|
|
21526
21526
|
class: pe(["h-10 shrink-0 pr-2 pl-3 text-blue-600", [(T(a), "text-sm")]]),
|
|
21527
|
-
onClick:
|
|
21527
|
+
onClick: m
|
|
21528
21528
|
}, Oe(T($e)("sui.save")), 3)
|
|
21529
21529
|
])
|
|
21530
21530
|
])),
|
|
@@ -21534,7 +21534,7 @@ const As = /* @__PURE__ */ Ee({
|
|
|
21534
21534
|
type: "button",
|
|
21535
21535
|
disabled: t.disabled,
|
|
21536
21536
|
class: "shrink-0 text-sm disabled:opacity-50",
|
|
21537
|
-
onClick:
|
|
21537
|
+
onClick: p[2] || (p[2] = (g) => w.$emit("remove"))
|
|
21538
21538
|
}, [
|
|
21539
21539
|
T(l) || T(a) ? (P(), De(T(Xe), {
|
|
21540
21540
|
key: 0,
|
|
@@ -21578,7 +21578,7 @@ const As = /* @__PURE__ */ Ee({
|
|
|
21578
21578
|
type: Boolean
|
|
21579
21579
|
}
|
|
21580
21580
|
},
|
|
21581
|
-
emits: ["update:modelValue", "remove"
|
|
21581
|
+
emits: ["update:modelValue", "remove"],
|
|
21582
21582
|
setup(t, { emit: r }) {
|
|
21583
21583
|
const e = t;
|
|
21584
21584
|
function n(a, l) {
|
|
@@ -21604,9 +21604,8 @@ const As = /* @__PURE__ */ Ee({
|
|
|
21604
21604
|
draggable: t.draggable,
|
|
21605
21605
|
disabled: t.disabled,
|
|
21606
21606
|
onUpdate: (c) => n(u, c),
|
|
21607
|
-
onRemove: (c) => a.$emit("remove", u)
|
|
21608
|
-
|
|
21609
|
-
}, null, 8, ["media", "show-remove", "draggable", "disabled", "onUpdate", "onRemove", "onSave:name"])
|
|
21607
|
+
onRemove: (c) => a.$emit("remove", u)
|
|
21608
|
+
}, null, 8, ["media", "show-remove", "draggable", "disabled", "onUpdate", "onRemove"])
|
|
21610
21609
|
])
|
|
21611
21610
|
]),
|
|
21612
21611
|
_: 1
|
|
@@ -43,6 +43,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
43
43
|
default: string;
|
|
44
44
|
type: StringConstructor;
|
|
45
45
|
};
|
|
46
|
+
showLoadingMask: {
|
|
47
|
+
default: boolean;
|
|
48
|
+
type: BooleanConstructor;
|
|
49
|
+
};
|
|
46
50
|
showNotificationOnError: {
|
|
47
51
|
default: boolean;
|
|
48
52
|
type: BooleanConstructor;
|
|
@@ -97,6 +101,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
97
101
|
default: string;
|
|
98
102
|
type: StringConstructor;
|
|
99
103
|
};
|
|
104
|
+
showLoadingMask: {
|
|
105
|
+
default: boolean;
|
|
106
|
+
type: BooleanConstructor;
|
|
107
|
+
};
|
|
100
108
|
showNotificationOnError: {
|
|
101
109
|
default: boolean;
|
|
102
110
|
type: BooleanConstructor;
|
|
@@ -115,6 +123,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
115
123
|
beforeSubmit: (next: NextFunction) => void;
|
|
116
124
|
successHandler: (response: any) => void;
|
|
117
125
|
twLoadingMask: string;
|
|
126
|
+
showLoadingMask: boolean;
|
|
118
127
|
showNotificationOnError: boolean;
|
|
119
128
|
showNotificationOnSuccess: boolean;
|
|
120
129
|
}, {}>, {
|
|
@@ -18,7 +18,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
18
18
|
default: boolean;
|
|
19
19
|
type: BooleanConstructor;
|
|
20
20
|
};
|
|
21
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "remove"
|
|
21
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "remove")[], "update:modelValue" | "remove", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
22
|
modelValue: {
|
|
23
23
|
required: true;
|
|
24
24
|
type: PropType<(UploadedFile | Media)[]>;
|
|
@@ -38,7 +38,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
38
38
|
}>> & {
|
|
39
39
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
40
40
|
onRemove?: ((...args: any[]) => any) | undefined;
|
|
41
|
-
"onSave:name"?: ((...args: any[]) => any) | undefined;
|
|
42
41
|
}, {
|
|
43
42
|
draggable: boolean;
|
|
44
43
|
disabled: boolean;
|
|
@@ -18,7 +18,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
18
18
|
default: boolean;
|
|
19
19
|
type: BooleanConstructor;
|
|
20
20
|
};
|
|
21
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update" | "remove"
|
|
21
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update" | "remove")[], "update" | "remove", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
22
|
media: {
|
|
23
23
|
required: true;
|
|
24
24
|
type: PropType<UploadedFile | Media>;
|
|
@@ -38,7 +38,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
38
38
|
}>> & {
|
|
39
39
|
onUpdate?: ((...args: any[]) => any) | undefined;
|
|
40
40
|
onRemove?: ((...args: any[]) => any) | undefined;
|
|
41
|
-
"onSave:name"?: ((...args: any[]) => any) | undefined;
|
|
42
41
|
}, {
|
|
43
42
|
draggable: boolean;
|
|
44
43
|
disabled: boolean;
|
package/package.json
CHANGED
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
type="button"
|
|
4
4
|
:class="twButton"
|
|
5
5
|
:disabled="disabled"
|
|
6
|
-
@drop.prevent="
|
|
7
|
-
dragging = false;
|
|
8
|
-
handleDrop($event);
|
|
9
|
-
"
|
|
6
|
+
@drop.prevent="dragging = false; handleDrop($event);"
|
|
10
7
|
@dragleave.prevent="dragging = false"
|
|
11
8
|
@dragover.prevent="dragging = true"
|
|
12
9
|
@dragenter.prevent="dragging = true"
|
|
@@ -120,15 +120,15 @@ async function onFileSelect(files: File | File[]) {
|
|
|
120
120
|
|
|
121
121
|
emit('start');
|
|
122
122
|
|
|
123
|
+
|
|
123
124
|
let payloads = [] as UploadedFile[];
|
|
124
125
|
|
|
125
126
|
try {
|
|
126
|
-
const formData = new FormData();
|
|
127
127
|
|
|
128
128
|
if (Array.isArray(files)) {
|
|
129
|
-
payloads = await Promise.all(files.map(f => processFileUpload(
|
|
129
|
+
payloads = await Promise.all(files.map(f => processFileUpload(f)));
|
|
130
130
|
} else {
|
|
131
|
-
const payload = await processFileUpload(
|
|
131
|
+
const payload = await processFileUpload(files);
|
|
132
132
|
payloads.push(payload);
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -148,7 +148,10 @@ async function onFileSelect(files: File | File[]) {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
async function processFileUpload(
|
|
151
|
+
async function processFileUpload(file: File): Promise<UploadedFile> {
|
|
152
|
+
|
|
153
|
+
const formData = new FormData();
|
|
154
|
+
|
|
152
155
|
formData.append('file', file);
|
|
153
156
|
|
|
154
157
|
const response = await http.post(props.url ?? config.upload_url, formData);
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
leave-to-class="opacity-0"
|
|
21
21
|
>
|
|
22
22
|
<slot
|
|
23
|
-
v-if="loading"
|
|
23
|
+
v-if="loading && showLoadingMask"
|
|
24
24
|
name="loading"
|
|
25
25
|
>
|
|
26
26
|
<div
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<path
|
|
38
38
|
fill="currentColor"
|
|
39
39
|
d="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z"
|
|
40
|
-
|
|
40
|
+
></path>
|
|
41
41
|
</svg>
|
|
42
42
|
</div>
|
|
43
43
|
</slot>
|
|
@@ -106,6 +106,10 @@ const props = defineProps({
|
|
|
106
106
|
default: '',
|
|
107
107
|
type: String,
|
|
108
108
|
},
|
|
109
|
+
showLoadingMask: {
|
|
110
|
+
default: true,
|
|
111
|
+
type: Boolean,
|
|
112
|
+
},
|
|
109
113
|
showNotificationOnError: {
|
|
110
114
|
default: true,
|
|
111
115
|
type: Boolean,
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
:disabled="disabled"
|
|
17
17
|
@update="onItemUpdate(index, $event)"
|
|
18
18
|
@remove="$emit('remove', index)"
|
|
19
|
-
@save:name="$emit('save:name', index, $event)"
|
|
20
19
|
/>
|
|
21
20
|
</div>
|
|
22
21
|
</template>
|
|
@@ -50,7 +49,7 @@ const props = defineProps({
|
|
|
50
49
|
},
|
|
51
50
|
});
|
|
52
51
|
|
|
53
|
-
const emit = defineEmits(['update:modelValue', 'remove'
|
|
52
|
+
const emit = defineEmits(['update:modelValue', 'remove']);
|
|
54
53
|
|
|
55
54
|
function onItemUpdate(index: number, media: Media | UploadedFile) {
|
|
56
55
|
const modelValue = cloneDeep(props.modelValue);
|
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
type="text"
|
|
60
60
|
:value="name"
|
|
61
61
|
autofocus
|
|
62
|
-
@input="onNameChange"
|
|
63
62
|
@keydown.enter.prevent="saveName"
|
|
64
63
|
@keydown.escape.prevent="viewMode = 'show'"
|
|
65
64
|
>
|
|
@@ -132,7 +131,7 @@ import { t } from '@/i18n';
|
|
|
132
131
|
import { useResizeObserver } from '@vueuse/core';
|
|
133
132
|
import breakpoints from '../../config/breakpoints.json';
|
|
134
133
|
|
|
135
|
-
const emit = defineEmits(['remove', 'update'
|
|
134
|
+
const emit = defineEmits(['remove', 'update']);
|
|
136
135
|
|
|
137
136
|
const props = defineProps({
|
|
138
137
|
media: {
|
|
@@ -201,17 +200,13 @@ function editName() {
|
|
|
201
200
|
}, 100);
|
|
202
201
|
}
|
|
203
202
|
|
|
204
|
-
function
|
|
205
|
-
const target =
|
|
203
|
+
function saveName() {
|
|
204
|
+
const target = inputRef.value;
|
|
206
205
|
const media = cloneDeep(props.media);
|
|
207
|
-
media.name = (target
|
|
206
|
+
media.name = (target?.value ?? '') as string;
|
|
208
207
|
const ext = media.file_name.split('.').pop();
|
|
209
208
|
media.file_name = media.name + '.' + ext;
|
|
210
|
-
emit('update', media);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function saveName() {
|
|
214
209
|
viewMode.value = 'show';
|
|
215
|
-
emit('
|
|
210
|
+
emit('update', media);
|
|
216
211
|
}
|
|
217
212
|
</script>
|