x-next 1.6.0 → 1.8.0
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/AI_USAGE.md +182 -4
- package/CHANGELOG.md +74 -0
- package/dist/_hooks/use-chart-size.d.ts +25 -0
- package/dist/_utils/chart/index.d.ts +6 -0
- package/dist/_utils/chart/padding.d.ts +15 -0
- package/dist/_utils/chart/path.d.ts +34 -0
- package/dist/_utils/chart/scale.d.ts +55 -0
- package/dist/components/_components/chart/ChartAxis.d.ts +85 -0
- package/dist/components/_components/chart/ChartLegend.d.ts +26 -0
- package/dist/components/_components/chart/ChartTooltip.d.ts +76 -0
- package/dist/components/_components/chart/colors.d.ts +10 -0
- package/dist/components/_components/chart/interface.d.ts +38 -0
- package/dist/components/bar-chart/BarChart.d.ts +278 -0
- package/dist/components/bar-chart/helpers/layout.d.ts +55 -0
- package/dist/components/bar-chart/index.d.ts +600 -0
- package/dist/components/bar-chart/interface.d.ts +74 -0
- package/dist/components/bar-chart/props.d.ts +145 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +3 -3
- package/dist/components/date-picker/index.d.ts +6 -6
- package/dist/components/draggable/Draggable.d.ts +1 -1
- package/dist/components/draggable/index.d.ts +2 -2
- package/dist/components/drawer/index.d.ts +6 -6
- package/dist/components/drawer/src/Drawer.vue.d.ts +3 -3
- package/dist/components/dropdown/Dropdown.vue.d.ts +4 -4
- package/dist/components/dropdown/DropdownButton.vue.d.ts +5 -5
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +4 -4
- package/dist/components/dropdown/index.d.ts +29 -29
- package/dist/components/form/FormItem.vue.d.ts +12 -12
- package/dist/components/form/form-item-label.vue.d.ts +3 -3
- package/dist/components/form/index.d.ts +24 -24
- package/dist/components/form-select/Select.d.ts +3 -3
- package/dist/components/form-select/index.d.ts +6 -6
- package/dist/components/form-slider/Slider.vue.d.ts +3 -3
- package/dist/components/form-slider/index.d.ts +6 -6
- package/dist/components/form-slider/slider-button.vue.d.ts +3 -3
- package/dist/components/grid/Row.vue.d.ts +3 -3
- package/dist/components/grid/index.d.ts +9 -9
- package/dist/components/heatmap/Heatmap.d.ts +10 -0
- package/dist/components/heatmap/index.d.ts +30 -0
- package/dist/components/image/Image.vue.d.ts +125 -17
- package/dist/components/image/ImagePreview.vue.d.ts +97 -7
- package/dist/components/image/ImagePreviewAction.d.ts +3 -3
- package/dist/components/image/ImagePreviewGroup.vue.d.ts +100 -7
- package/dist/components/image/hooks/use-image-drag.d.ts +2 -2
- package/dist/components/image/index.d.ts +712 -124
- package/dist/components/image/interface.d.ts +9 -1
- package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
- package/dist/components/index.d.ts +4 -0
- package/dist/components/line-chart/LineChart.d.ts +295 -0
- package/dist/components/line-chart/helpers/layout.d.ts +74 -0
- package/dist/components/line-chart/index.d.ts +614 -0
- package/dist/components/line-chart/interface.d.ts +76 -0
- package/dist/components/line-chart/props.d.ts +173 -0
- package/dist/components/menu/sub-menu-pop.vue.d.ts +3 -3
- package/dist/components/pagination/page-options.vue.d.ts +6 -6
- package/dist/components/pie-chart/PieChart.d.ts +219 -0
- package/dist/components/pie-chart/index.d.ts +470 -0
- package/dist/components/pie-chart/interface.d.ts +58 -0
- package/dist/components/pie-chart/props.d.ts +107 -0
- package/dist/components/popconfirm/src/popup.vue.d.ts +3 -3
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/index.d.ts +3 -3
- package/dist/components/popup/Popup.d.ts +1 -1
- package/dist/components/popup/index.d.ts +3 -3
- package/dist/components/space/Space.d.ts +1 -1
- package/dist/components/space/index.d.ts +3 -3
- package/dist/components/tabs/Tabs.d.ts +1 -1
- package/dist/components/tabs/index.d.ts +3 -3
- package/dist/components/time-picker/TimePicker.vue.d.ts +3 -3
- package/dist/components/time-picker/index.d.ts +6 -6
- package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
- package/dist/components/tooltip/index.d.ts +3 -3
- package/dist/components/trend-chart/components/TrendChart.d.ts +19 -96
- package/dist/components/trend-chart/index.d.ts +33 -187
- package/dist/components/trend-chart/props.d.ts +9 -78
- package/dist/components/trend-chart/themes.d.ts +0 -1
- package/dist/components/trigger/Trigger.d.ts +1 -1
- package/dist/components/trigger/index.d.ts +3 -3
- package/dist/components/upload/Upload.d.ts +372 -0
- package/dist/components/upload/context.d.ts +28 -0
- package/dist/components/upload/index.d.ts +656 -0
- package/dist/components/upload/interface.d.ts +110 -0
- package/dist/components/upload/props.d.ts +321 -0
- package/dist/components/upload/upload-list-item.d.ts +15 -0
- package/dist/components/upload/upload-list.d.ts +11 -0
- package/dist/components/upload/upload-picture-item.d.ts +20 -0
- package/dist/components/upload/upload-trigger.d.ts +8 -0
- package/dist/components/upload/utils.d.ts +48 -0
- package/dist/es/_hooks/use-chart-size.js +25 -0
- package/dist/es/_styles/palette-aliases.js +7 -4
- package/dist/es/_utils/chart/padding.js +22 -0
- package/dist/es/_utils/chart/path.js +69 -0
- package/dist/es/_utils/chart/scale.js +77 -0
- package/dist/es/components/_components/chart/ChartAxis.js +79 -0
- package/dist/es/components/_components/chart/ChartLegend.js +53 -0
- package/dist/es/components/_components/chart/ChartTooltip.js +64 -0
- package/dist/es/components/_components/chart/colors.js +12 -0
- package/dist/es/components/bar-chart/BarChart.js +470 -0
- package/dist/es/components/bar-chart/helpers/layout.js +53 -0
- package/dist/es/components/bar-chart/index.js +8 -0
- package/dist/es/components/bar-chart/props.js +148 -0
- package/dist/es/components/heatmap/Heatmap.js +244 -169
- package/dist/es/components/image/Image.vue.js +55 -45
- package/dist/es/components/image/Image.vue2.js +113 -92
- package/dist/es/components/image/ImagePreview.vue.js +66 -53
- package/dist/es/components/image/ImagePreview.vue2.js +219 -171
- package/dist/es/components/image/ImagePreviewAction.js +12 -15
- package/dist/es/components/image/ImagePreviewGroup.vue.js +21 -20
- package/dist/es/components/image/ImagePreviewGroup.vue2.js +45 -39
- package/dist/es/components/image/hooks/use-image-drag.js +16 -14
- package/dist/es/components/index.js +136 -128
- package/dist/es/components/line-chart/LineChart.js +532 -0
- package/dist/es/components/line-chart/helpers/layout.js +80 -0
- package/dist/es/components/line-chart/index.js +8 -0
- package/dist/es/components/line-chart/props.js +178 -0
- package/dist/es/components/pie-chart/PieChart.js +397 -0
- package/dist/es/components/pie-chart/index.js +8 -0
- package/dist/es/components/pie-chart/props.js +104 -0
- package/dist/es/components/trend-chart/components/TrendChart.js +143 -183
- package/dist/es/components/trend-chart/components/trend-chart-curve.js +85 -81
- package/dist/es/components/trend-chart/props.js +28 -74
- package/dist/es/components/trend-chart/themes.js +30 -31
- package/dist/es/components/upload/Upload.js +420 -0
- package/dist/es/components/upload/context.js +4 -0
- package/dist/es/components/upload/index.js +8 -0
- package/dist/es/components/upload/props.js +321 -0
- package/dist/es/components/upload/upload-list-item.js +138 -0
- package/dist/es/components/upload/upload-list.js +48 -0
- package/dist/es/components/upload/upload-picture-item.js +109 -0
- package/dist/es/components/upload/upload-trigger.js +89 -0
- package/dist/es/components/upload/utils.js +195 -0
- package/dist/es/icons/_self/upload-icons.js +103 -0
- package/dist/es/index.js +197 -189
- package/dist/es/locale/en-US.js +30 -1
- package/dist/es/locale/zh-CN.js +30 -1
- package/dist/es/style.css +1 -1
- package/dist/icons/_self/upload-icons.d.ts +523 -0
- package/dist/index.cjs +4 -4
- package/dist/index.umd.js +4 -4
- package/dist/locale/interface.d.ts +45 -0
- package/dist/style/bar-chart.css +1 -0
- package/dist/style/bar-chart.js +2 -0
- package/dist/style/base.css +1 -1
- package/dist/style/heatmap.css +1 -1
- package/dist/style/image.css +1 -1
- package/dist/style/line-chart.css +1 -0
- package/dist/style/line-chart.js +2 -0
- package/dist/style/pie-chart.css +1 -0
- package/dist/style/pie-chart.js +2 -0
- package/dist/style/upload.css +1 -0
- package/dist/style/upload.js +2 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
- package/volar.d.ts +4 -0
- package/dist/components/trend-chart/components/trend-chart-grid.d.ts +0 -55
- package/dist/components/trend-chart/components/trend-chart-labels.d.ts +0 -26
- package/dist/components/trend-chart/helpers/genPath.d.ts +0 -8
- package/dist/components/trend-chart/helpers/getPadding.d.ts +0 -8
- package/dist/components/trend-chart/helpers/validatePadding.d.ts +0 -2
- package/dist/es/_hooks/use-popup-overflow-hidden.js +0 -29
- package/dist/es/components/trend-chart/components/trend-chart-grid.js +0 -62
- package/dist/es/components/trend-chart/components/trend-chart-labels.js +0 -75
- package/dist/es/components/trend-chart/helpers/genPath.js +0 -22
- package/dist/es/components/trend-chart/helpers/getPadding.js +0 -21
- package/dist/es/components/trend-chart/helpers/validatePadding.js +0 -7
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { defineComponent as I, inject as L, computed as n, watch as P, createVNode as l, mergeProps as v } from "vue";
|
|
2
|
+
import { getClassNameMixin as E } from "../../_utils/config.js";
|
|
3
|
+
import { useLocale as K } from "../../locale/index.js";
|
|
4
|
+
import { IconUploadCloud as N } from "../../icons/_self/upload-icons.js";
|
|
5
|
+
import { uploadInjectionKey as U } from "./context.js";
|
|
6
|
+
import { useFormItem as j, useFormItemControl as A } from "../../_hooks/use-form-item.js";
|
|
7
|
+
const S = /* @__PURE__ */ I({
|
|
8
|
+
name: "UploadTrigger",
|
|
9
|
+
setup() {
|
|
10
|
+
const e = L(U);
|
|
11
|
+
if (!e) return () => null;
|
|
12
|
+
const {
|
|
13
|
+
t: o
|
|
14
|
+
} = K(), r = E("upload"), {
|
|
15
|
+
formItemCtx: m,
|
|
16
|
+
eventHandlers: b
|
|
17
|
+
} = j(), d = A(m, () => ({
|
|
18
|
+
...e.getTriggerAttrs(),
|
|
19
|
+
...e.props.ariaLabel ? {
|
|
20
|
+
"aria-label": e.props.ariaLabel
|
|
21
|
+
} : {}
|
|
22
|
+
}), {
|
|
23
|
+
labelable: !1
|
|
24
|
+
}), t = n(() => e.props.draggable), c = n(() => e.listType.value === "picture-card"), y = n(() => e.props.ariaLabel || o("upload.trigger")), D = n(() => [r.element("trigger"), t.value && r.element("dragger"), t.value && e.dragging.value && r.is("dragging"), e.listType.value === "picture-card" && r.element("picture-trigger"), e.disabled.value && r.is("disabled")]), T = n(() => e.dragging.value ? o("upload.dragHover") : t.value ? o("upload.drag") : o("upload.buttonText"));
|
|
25
|
+
P(e.disabled, (a) => {
|
|
26
|
+
a && (e.dragging.value = !1);
|
|
27
|
+
});
|
|
28
|
+
const g = () => {
|
|
29
|
+
e.disabled.value || e.openFileDialog();
|
|
30
|
+
}, C = (a) => {
|
|
31
|
+
a.key !== "Enter" && a.key !== " " || (a.preventDefault(), g());
|
|
32
|
+
}, h = (a) => {
|
|
33
|
+
t.value && (a.preventDefault(), !e.disabled.value && (e.dragging.value = !0));
|
|
34
|
+
}, x = (a) => {
|
|
35
|
+
t.value && (a.preventDefault(), a.dataTransfer && (a.dataTransfer.dropEffect = e.disabled.value ? "none" : "copy"), !e.disabled.value && (e.dragging.value = !0));
|
|
36
|
+
}, k = (a) => {
|
|
37
|
+
if (e.disabled.value || !t.value) return;
|
|
38
|
+
const i = a.currentTarget, s = a.relatedTarget;
|
|
39
|
+
s && i.contains(s) || (e.dragging.value = !1);
|
|
40
|
+
}, F = (a) => {
|
|
41
|
+
t.value && (a.preventDefault(), e.dragging.value = !1, !e.disabled.value && e.onDropFiles(a));
|
|
42
|
+
};
|
|
43
|
+
return () => {
|
|
44
|
+
const a = {
|
|
45
|
+
type: "file",
|
|
46
|
+
class: r.element("input"),
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
tabindex: -1
|
|
49
|
+
};
|
|
50
|
+
e.props.accept && (a.accept = e.props.accept), (e.props.multiple || e.props.directory) && (a.multiple = !0), a.disabled = e.disabled.value, e.props.directory && (a.directory = "", a.webkitdirectory = ""), e.props.capture !== void 0 && e.props.capture !== !1 && (a.capture = e.props.capture === !0 ? "" : e.props.capture);
|
|
51
|
+
const i = e.slots["upload-button"] ?? e.slots.default, s = i ? i() : [l("span", {
|
|
52
|
+
class: r.element("trigger-icon"),
|
|
53
|
+
key: "icon"
|
|
54
|
+
}, [l(N, {
|
|
55
|
+
size: t.value ? 40 : c.value ? 20 : 16
|
|
56
|
+
}, null)]), l("span", {
|
|
57
|
+
class: r.element("trigger-text"),
|
|
58
|
+
key: "text"
|
|
59
|
+
}, [T.value])], w = !!e.props.tip && !c.value;
|
|
60
|
+
return l("div", v(d.value, {
|
|
61
|
+
class: D.value,
|
|
62
|
+
role: "button",
|
|
63
|
+
tabindex: e.disabled.value ? void 0 : 0,
|
|
64
|
+
"aria-disabled": e.disabled.value || void 0,
|
|
65
|
+
"aria-label": d.value["aria-label"] || (d.value["aria-labelledby"] ? void 0 : y.value),
|
|
66
|
+
onClick: g,
|
|
67
|
+
onKeydown: C,
|
|
68
|
+
onDragenter: h,
|
|
69
|
+
onDragover: x,
|
|
70
|
+
onDragleave: k,
|
|
71
|
+
onDrop: F,
|
|
72
|
+
onFocusout: (u) => {
|
|
73
|
+
var p, f;
|
|
74
|
+
u.currentTarget.contains(u.relatedTarget) || (f = (p = b.value) == null ? void 0 : p.onBlur) == null || f.call(p);
|
|
75
|
+
}
|
|
76
|
+
}), [l("input", v({
|
|
77
|
+
ref: e.inputRef
|
|
78
|
+
}, a, {
|
|
79
|
+
onChange: e.onFileChange,
|
|
80
|
+
onClick: (u) => u.stopPropagation()
|
|
81
|
+
}), null), s, w && l("span", {
|
|
82
|
+
class: r.element("tip")
|
|
83
|
+
}, [e.props.tip])]);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
export {
|
|
88
|
+
S as default
|
|
89
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { isFunction as j } from "../../_utils/is.js";
|
|
2
|
+
const u = [
|
|
3
|
+
"avif",
|
|
4
|
+
"bmp",
|
|
5
|
+
"dpg",
|
|
6
|
+
"gif",
|
|
7
|
+
"heic",
|
|
8
|
+
"heif",
|
|
9
|
+
"ico",
|
|
10
|
+
"jfif",
|
|
11
|
+
"jpeg",
|
|
12
|
+
"jpg",
|
|
13
|
+
"png",
|
|
14
|
+
"svg",
|
|
15
|
+
"tif",
|
|
16
|
+
"tiff",
|
|
17
|
+
"webp"
|
|
18
|
+
], E = {
|
|
19
|
+
"audio/mp3": "audio/mpeg",
|
|
20
|
+
"image/jpg": "image/jpeg",
|
|
21
|
+
"text/xml": "application/xml"
|
|
22
|
+
}, R = {
|
|
23
|
+
jpeg: ["jpeg", "jpg"],
|
|
24
|
+
jpg: ["jpeg", "jpg"],
|
|
25
|
+
tif: ["tif", "tiff"],
|
|
26
|
+
tiff: ["tif", "tiff"]
|
|
27
|
+
};
|
|
28
|
+
let x = 0;
|
|
29
|
+
const L = () => `${Date.now().toString(36)}-${(x++).toString(36)}`, d = (t) => {
|
|
30
|
+
const e = (t ?? "").toLowerCase().split(";")[0].trim();
|
|
31
|
+
return E[e] ?? e;
|
|
32
|
+
}, a = (t) => {
|
|
33
|
+
const e = t.lastIndexOf(".");
|
|
34
|
+
return e >= 0 ? t.slice(e + 1).toLowerCase() : "";
|
|
35
|
+
}, p = (t, e) => (R[t] ?? [t]).includes(e), P = (t, e) => {
|
|
36
|
+
const r = (e ?? "").split(",").map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
37
|
+
if (!r.length) return !0;
|
|
38
|
+
const n = d(t.type), o = a(t.name);
|
|
39
|
+
return r.some((s) => {
|
|
40
|
+
if (s === "*" || s === "*/*") return !0;
|
|
41
|
+
if (s.startsWith("."))
|
|
42
|
+
return p(s.slice(1), o);
|
|
43
|
+
if (s.endsWith("/*"))
|
|
44
|
+
return n.startsWith(s.slice(0, -1));
|
|
45
|
+
const i = d(s);
|
|
46
|
+
if (n && i === n) return !0;
|
|
47
|
+
if (n) return !1;
|
|
48
|
+
const c = i.lastIndexOf("/");
|
|
49
|
+
return c >= 0 && p(i.slice(c + 1), o);
|
|
50
|
+
});
|
|
51
|
+
}, h = (t) => d(t).startsWith("image/"), S = (t) => h(t.type) || !t.type && u.includes(a(t.name)), $ = (t) => {
|
|
52
|
+
if (t.type) return h(t.type);
|
|
53
|
+
const e = t.url || t.thumbUrl || t.name;
|
|
54
|
+
return e.startsWith("data:image/") ? !0 : u.includes(a(e.split(/[?#]/)[0])) || u.includes(a(t.name));
|
|
55
|
+
}, m = /* @__PURE__ */ new WeakMap(), A = (t) => {
|
|
56
|
+
const e = m.get(t), r = t.uid || e || L();
|
|
57
|
+
!t.uid && !e && m.set(t, r);
|
|
58
|
+
const n = t.status ?? "done";
|
|
59
|
+
return {
|
|
60
|
+
...t,
|
|
61
|
+
uid: r,
|
|
62
|
+
status: n,
|
|
63
|
+
percent: t.percent ?? (n === "done" ? 1 : 0)
|
|
64
|
+
};
|
|
65
|
+
}, q = (t) => (t ?? []).map(A), g = /* @__PURE__ */ new Set(), C = (t) => {
|
|
66
|
+
if (!S(t) || typeof URL > "u" || typeof URL.createObjectURL != "function") return;
|
|
67
|
+
const e = URL.createObjectURL(t);
|
|
68
|
+
return g.add(e), e;
|
|
69
|
+
}, N = (t) => {
|
|
70
|
+
if (!(!t || !g.delete(t)))
|
|
71
|
+
try {
|
|
72
|
+
URL.revokeObjectURL(t);
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
75
|
+
}, U = (t) => {
|
|
76
|
+
const e = t.responseText ?? "";
|
|
77
|
+
if ((t.getResponseHeader("content-type") ?? "").includes("json"))
|
|
78
|
+
try {
|
|
79
|
+
return JSON.parse(e || "null");
|
|
80
|
+
} catch {
|
|
81
|
+
return e;
|
|
82
|
+
}
|
|
83
|
+
return t.response ?? e;
|
|
84
|
+
}, W = (t) => t === null || typeof t != "object" && typeof t != "function" ? !1 : typeof t.then == "function", T = (t) => {
|
|
85
|
+
if (t === null || typeof t != "object") return;
|
|
86
|
+
const e = t.abort;
|
|
87
|
+
return j(e) ? () => e.call(t) : void 0;
|
|
88
|
+
}, I = (t) => {
|
|
89
|
+
if (t === null || typeof t != "object") return !1;
|
|
90
|
+
const e = t;
|
|
91
|
+
return typeof e.ok == "boolean" && typeof e.status == "number" && typeof e.text == "function" && typeof e.json == "function";
|
|
92
|
+
}, z = async (t) => {
|
|
93
|
+
var r, n;
|
|
94
|
+
if (!I(t)) return t;
|
|
95
|
+
if (!t.ok) {
|
|
96
|
+
const o = new Error(`Request failed with status ${t.status}`);
|
|
97
|
+
throw o.status = t.status, o.response = t, o;
|
|
98
|
+
}
|
|
99
|
+
const e = ((n = (r = t.headers) == null ? void 0 : r.get) == null ? void 0 : n.call(r, "content-type")) ?? "";
|
|
100
|
+
if (e.includes("json")) {
|
|
101
|
+
const o = await t.text();
|
|
102
|
+
if (!o) return;
|
|
103
|
+
try {
|
|
104
|
+
return JSON.parse(o);
|
|
105
|
+
} catch {
|
|
106
|
+
return o;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return e.startsWith("text/") ? t.text() : t;
|
|
110
|
+
}, f = (t, e) => {
|
|
111
|
+
const r = new Error(e);
|
|
112
|
+
return r.status = t.status, r;
|
|
113
|
+
}, y = (t, e, r) => {
|
|
114
|
+
if (r != null) {
|
|
115
|
+
if (Array.isArray(r)) {
|
|
116
|
+
r.forEach((n) => y(t, `${e}[]`, n));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (typeof Blob < "u" && r instanceof Blob) {
|
|
120
|
+
t.append(e, r);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
t.append(e, String(r));
|
|
124
|
+
}
|
|
125
|
+
}, B = (t) => {
|
|
126
|
+
const e = new XMLHttpRequest();
|
|
127
|
+
e.open(t.method.toUpperCase(), t.action || "", !0), t.withCredentials && (e.withCredentials = !0), t.timeout > 0 && (e.timeout = t.timeout), Object.entries(t.headers ?? {}).forEach(([n, o]) => {
|
|
128
|
+
o != null && e.setRequestHeader(n, String(o));
|
|
129
|
+
}), e.upload.onprogress = (n) => {
|
|
130
|
+
t.onProgress(n.total > 0 ? Math.min(1, n.loaded / n.total) : 0, n);
|
|
131
|
+
}, e.onload = () => {
|
|
132
|
+
if (e.status >= 200 && e.status < 300) {
|
|
133
|
+
t.onSuccess(U(e));
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
t.onError(f(e, `Request failed with status ${e.status}`));
|
|
137
|
+
}, e.onerror = () => t.onError(f(e, "Network error")), e.ontimeout = () => t.onError(f(e, "Request timeout")), e.onabort = () => {
|
|
138
|
+
};
|
|
139
|
+
const r = new FormData();
|
|
140
|
+
return Object.entries(t.data ?? {}).forEach(([n, o]) => y(r, n, o)), r.append(t.name || "file", t.file, t.file.name), e.send(r), {
|
|
141
|
+
abort: () => e.abort()
|
|
142
|
+
};
|
|
143
|
+
}, O = (t) => new Promise((e, r) => {
|
|
144
|
+
t.readEntries(e, r);
|
|
145
|
+
}), F = async (t) => {
|
|
146
|
+
const e = [];
|
|
147
|
+
for (; ; ) {
|
|
148
|
+
const r = await O(t);
|
|
149
|
+
if (!r.length) break;
|
|
150
|
+
e.push(...r);
|
|
151
|
+
}
|
|
152
|
+
return e;
|
|
153
|
+
}, M = (t) => new Promise((e, r) => {
|
|
154
|
+
t.file(e, r);
|
|
155
|
+
}), H = async (t) => {
|
|
156
|
+
const r = (t.items ? Array.from(t.items) : []).map((s) => {
|
|
157
|
+
var i;
|
|
158
|
+
return (i = s.webkitGetAsEntry) == null ? void 0 : i.call(s);
|
|
159
|
+
}).filter((s) => !!s);
|
|
160
|
+
if (!r.length) return Array.from(t.files ?? []);
|
|
161
|
+
const n = [], o = async (s, i) => {
|
|
162
|
+
if (s.isFile) {
|
|
163
|
+
const c = await M(s);
|
|
164
|
+
i && Object.defineProperty(c, "webkitRelativePath", { value: i, configurable: !0 }), n.push(c);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (s.isDirectory) {
|
|
168
|
+
const c = s.createReader(), b = await F(c), w = i ? `${i}/` : "";
|
|
169
|
+
for (const l of b)
|
|
170
|
+
await o(l, `${w}${l.name}`);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
for (const s of r)
|
|
174
|
+
await o(s, s.name);
|
|
175
|
+
return n;
|
|
176
|
+
}, D = (t) => t ? Array.from(t.files ?? []) : [];
|
|
177
|
+
export {
|
|
178
|
+
H as collectDropFiles,
|
|
179
|
+
D as collectPasteFiles,
|
|
180
|
+
C as createThumbUrl,
|
|
181
|
+
L as genUid,
|
|
182
|
+
a as getExtension,
|
|
183
|
+
S as isImageFile,
|
|
184
|
+
$ as isImageItem,
|
|
185
|
+
h as isImageMime,
|
|
186
|
+
W as isPromiseLike,
|
|
187
|
+
P as matchAccept,
|
|
188
|
+
A as normalizeFile,
|
|
189
|
+
q as normalizeFileList,
|
|
190
|
+
d as normalizeMime,
|
|
191
|
+
z as normalizePromiseResponse,
|
|
192
|
+
T as resolveAbortHandle,
|
|
193
|
+
N as revokeThumbUrl,
|
|
194
|
+
B as uploadRequest
|
|
195
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { h as t, createVNode as o } from "vue";
|
|
2
|
+
import { generateIcon as l } from "../icon.js";
|
|
3
|
+
const r = l("UploadCloud", t(o("svg", {
|
|
4
|
+
viewBox: "0 0 48 48",
|
|
5
|
+
fill: "none",
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
stroke: "currentColor",
|
|
8
|
+
"stroke-width": "4",
|
|
9
|
+
"stroke-linecap": "butt",
|
|
10
|
+
"stroke-linejoin": "miter"
|
|
11
|
+
}, [o("path", {
|
|
12
|
+
d: "M32 34h4a7 7 0 0 0 1.2-13.9A9 9 0 0 0 20.7 17 7 7 0 0 0 12 34h4"
|
|
13
|
+
}, null), o("path", {
|
|
14
|
+
d: "M24 40V22"
|
|
15
|
+
}, null), o("path", {
|
|
16
|
+
d: "m17 29 7-7 7 7"
|
|
17
|
+
}, null)]))), a = l("UploadFile", t(o("svg", {
|
|
18
|
+
viewBox: "0 0 48 48",
|
|
19
|
+
fill: "none",
|
|
20
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21
|
+
stroke: "currentColor",
|
|
22
|
+
"stroke-width": "4",
|
|
23
|
+
"stroke-linecap": "butt",
|
|
24
|
+
"stroke-linejoin": "miter"
|
|
25
|
+
}, [o("path", {
|
|
26
|
+
d: "M28 6H16a4 4 0 0 0-4 4v28a4 4 0 0 0 4 4h16a4 4 0 0 0 4-4V14Z"
|
|
27
|
+
}, null), o("path", {
|
|
28
|
+
d: "M28 6v8h8"
|
|
29
|
+
}, null)]))), s = l("UploadImage", t(o("svg", {
|
|
30
|
+
viewBox: "0 0 48 48",
|
|
31
|
+
fill: "none",
|
|
32
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
33
|
+
stroke: "currentColor",
|
|
34
|
+
"stroke-width": "4",
|
|
35
|
+
"stroke-linecap": "butt",
|
|
36
|
+
"stroke-linejoin": "miter"
|
|
37
|
+
}, [o("rect", {
|
|
38
|
+
x: "7",
|
|
39
|
+
y: "9",
|
|
40
|
+
width: "34",
|
|
41
|
+
height: "30",
|
|
42
|
+
rx: "4"
|
|
43
|
+
}, null), o("circle", {
|
|
44
|
+
cx: "17.5",
|
|
45
|
+
cy: "19.5",
|
|
46
|
+
r: "3.5"
|
|
47
|
+
}, null), o("path", {
|
|
48
|
+
d: "m12 35 9-9 6 6 4-4 6 6"
|
|
49
|
+
}, null)]))), i = l("UploadTrash", t(o("svg", {
|
|
50
|
+
viewBox: "0 0 48 48",
|
|
51
|
+
fill: "none",
|
|
52
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
53
|
+
stroke: "currentColor",
|
|
54
|
+
"stroke-width": "4",
|
|
55
|
+
"stroke-linecap": "butt",
|
|
56
|
+
"stroke-linejoin": "miter"
|
|
57
|
+
}, [o("path", {
|
|
58
|
+
d: "M9 14h30"
|
|
59
|
+
}, null), o("path", {
|
|
60
|
+
d: "M20 14V9a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v5"
|
|
61
|
+
}, null), o("path", {
|
|
62
|
+
d: "M13 14v24a4 4 0 0 0 4 4h14a4 4 0 0 0 4-4V14"
|
|
63
|
+
}, null), o("path", {
|
|
64
|
+
d: "M20 22v12M28 22v12"
|
|
65
|
+
}, null)]))), h = l("UploadRefresh", t(o("svg", {
|
|
66
|
+
viewBox: "0 0 48 48",
|
|
67
|
+
fill: "none",
|
|
68
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
69
|
+
stroke: "currentColor",
|
|
70
|
+
"stroke-width": "4",
|
|
71
|
+
"stroke-linecap": "butt",
|
|
72
|
+
"stroke-linejoin": "miter"
|
|
73
|
+
}, [o("path", {
|
|
74
|
+
d: "M41 10v10H31"
|
|
75
|
+
}, null), o("path", {
|
|
76
|
+
d: "M10.8 16A15 15 0 0 1 38.6 13.4L41 20"
|
|
77
|
+
}, null), o("path", {
|
|
78
|
+
d: "M7 38V28h10"
|
|
79
|
+
}, null), o("path", {
|
|
80
|
+
d: "M37.2 32A15 15 0 0 1 9.4 34.6L7 28"
|
|
81
|
+
}, null)]))), p = l("UploadDownload", t(o("svg", {
|
|
82
|
+
viewBox: "0 0 48 48",
|
|
83
|
+
fill: "none",
|
|
84
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
85
|
+
stroke: "currentColor",
|
|
86
|
+
"stroke-width": "4",
|
|
87
|
+
"stroke-linecap": "butt",
|
|
88
|
+
"stroke-linejoin": "miter"
|
|
89
|
+
}, [o("path", {
|
|
90
|
+
d: "M24 8v22"
|
|
91
|
+
}, null), o("path", {
|
|
92
|
+
d: "m15 23 9 9 9-9"
|
|
93
|
+
}, null), o("path", {
|
|
94
|
+
d: "M9 32v4a6 6 0 0 0 6 6h18a6 6 0 0 0 6-6v-4"
|
|
95
|
+
}, null)])));
|
|
96
|
+
export {
|
|
97
|
+
r as IconUploadCloud,
|
|
98
|
+
p as IconUploadDownload,
|
|
99
|
+
a as IconUploadFile,
|
|
100
|
+
s as IconUploadImage,
|
|
101
|
+
h as IconUploadRefresh,
|
|
102
|
+
i as IconUploadTrash
|
|
103
|
+
};
|