mhz-ui 1.4.4 → 1.4.6
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_4z663_1{display:flex;gap:16px}._upload_4z663_6{display:flex;flex-direction:column;gap:4px}._addButton_4z663_12{display:flex;flex-direction:column;gap:8px;min-width:200px}._text_4z663_19{font-size:.75rem}._text_4z663_19[data-error=true]{color:var(--color-error)}._input_4z663_26{display:none}._name_4z663_30{flex:1;max-width:136px;overflow:hidden;text-overflow:ellipsis}._file_4z663_37{display:flex;gap:8px;align-items:center}._error_4z663_43{color:var(--color-error)}._uploadButton_4z663_47[data-label=true]{margin-top:28px}.dark ._label_4z663_51,.dark ._text_4z663_19,.dark ._name_4z663_30{color:var(--color-white)}
|
|
@@ -10,6 +10,7 @@ interface IProps {
|
|
|
10
10
|
isSingle?: boolean;
|
|
11
11
|
lang?: TLocale;
|
|
12
12
|
limit?: number;
|
|
13
|
+
uploadButtonText?: string;
|
|
13
14
|
}
|
|
14
15
|
declare const _default: import('vue').DefineComponent<IProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
15
16
|
add: (file: File) => any;
|
|
@@ -27,6 +28,7 @@ declare const _default: import('vue').DefineComponent<IProps, {}, {}, {}, {}, im
|
|
|
27
28
|
extensions: string[];
|
|
28
29
|
files: File[] | never[];
|
|
29
30
|
limit: number;
|
|
31
|
+
uploadButtonText: string;
|
|
30
32
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
31
33
|
input: HTMLInputElement;
|
|
32
34
|
}, HTMLDivElement>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./UiUpload.css";
|
|
2
|
-
import { openBlock as a, createElementBlock as o, createStaticVNode as
|
|
2
|
+
import { openBlock as a, createElementBlock as o, createStaticVNode as C, defineComponent as q, shallowRef as z, computed as w, normalizeClass as i, createElementVNode as d, toDisplayString as s, createCommentVNode as f, createVNode as m, unref as r, withCtx as _, createTextVNode as v, Fragment as M, renderList as I, withDirectives as E, vShow as F } from "vue";
|
|
3
3
|
import y from "../UiButton/UiButton.js";
|
|
4
4
|
import { M as u } from "../index-cvhOyRHT.js";
|
|
5
5
|
import { _ as N } from "../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
@@ -11,13 +11,13 @@ const U = {
|
|
|
11
11
|
};
|
|
12
12
|
function V(g, p) {
|
|
13
13
|
return a(), o("svg", U, [...p[0] || (p[0] = [
|
|
14
|
-
|
|
14
|
+
C('<g fill="currentColor" fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path d="M12.219 0h.875Q15.532.469 16 2.906v.875a3.6 3.6 0 0 1-.766 1.719l-4.546 4.547q-1.536 1.189-3.376.562a3.55 3.55 0 0 1-1.234-.828q-.37-.747.39-1.078a1 1 0 0 1 .438.031q.3.253.625.47 1.09.563 2.125-.095 2.288-2.241 4.547-4.515.928-1.322-.062-2.594-1.287-1.184-2.735-.203a143 143 0 0 1-2.531 2.5q-.72.3-1.016-.422a.8.8 0 0 1 .094-.562L10.531.733A3.6 3.6 0 0 1 12.22 0"></path><path d="M3.781 16h-.875Q.47 15.532 0 13.094v-.875q.151-.96.766-1.719l4.172-4.172Q6.594 5.062 8.53 5.86q.46.227.844.563a.75.75 0 0 1 .266.797q-.274.609-.922.422l-.688-.5q-1.065-.513-2.062.125-2.1 2.053-4.172 4.14-.94 1.35.094 2.625 1.189 1.08 2.578.266l2.281-2.219q.88-.318 1.031.594a.7.7 0 0 1-.11.39Q6.587 14.15 5.5 15.235A3.6 3.6 0 0 1 3.781 16"></path></g><defs><clipPath id="a"><path fill="currentColor" d="M0 0h16v16H0z"></path></clipPath></defs>', 2)
|
|
15
15
|
])]);
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const x = { render: V }, L = 10 * 1024 * 1024;
|
|
18
18
|
new File([""], "file1.png");
|
|
19
19
|
new File([""], "file2.png");
|
|
20
|
-
const Q = ["data-error"],
|
|
20
|
+
const Q = ["data-error"], j = ["accept", "multiple"], A = ["data-label"], R = /* @__PURE__ */ q({
|
|
21
21
|
__name: "UiUpload",
|
|
22
22
|
props: {
|
|
23
23
|
label: { default: void 0 },
|
|
@@ -29,18 +29,19 @@ const Q = ["data-error"], A = ["accept", "multiple"], R = ["data-label"], x = /*
|
|
|
29
29
|
isRequired: { type: Boolean },
|
|
30
30
|
isSingle: { type: Boolean },
|
|
31
31
|
lang: { default: "ru" },
|
|
32
|
-
limit: { default:
|
|
32
|
+
limit: { default: L },
|
|
33
|
+
uploadButtonText: { default: "" }
|
|
33
34
|
},
|
|
34
35
|
emits: ["add", "remove", "upload"],
|
|
35
36
|
setup(g, { emit: p }) {
|
|
36
|
-
const e = g, c = p, b =
|
|
37
|
-
function
|
|
37
|
+
const e = g, c = p, b = z(), h = z(0), B = w(() => e.extensions.map((l) => `.${l}`).join(","));
|
|
38
|
+
function k() {
|
|
38
39
|
b?.value?.click?.();
|
|
39
40
|
}
|
|
40
41
|
async function $(l) {
|
|
41
42
|
l && (c("remove", l), h.value++);
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function D(l) {
|
|
44
45
|
if (e.isSingle) {
|
|
45
46
|
const t = l.files?.[0];
|
|
46
47
|
t?.size && t.size < e.limit && c("add", t);
|
|
@@ -71,10 +72,10 @@ const Q = ["data-error"], A = ["accept", "multiple"], R = ["data-label"], x = /*
|
|
|
71
72
|
class: i(l.$style.addButton)
|
|
72
73
|
}, [
|
|
73
74
|
m(y, {
|
|
74
|
-
onClick:
|
|
75
|
+
onClick: k,
|
|
75
76
|
layout: "secondary",
|
|
76
77
|
isDisabled: e.isDisabled || e.isSingle && e.files.length > 0 || e.isSingle && !!e.file,
|
|
77
|
-
icon: r(
|
|
78
|
+
icon: r(x)
|
|
78
79
|
}, {
|
|
79
80
|
default: _(() => [
|
|
80
81
|
v(s(r(u)[e.lang].add), 1)
|
|
@@ -84,20 +85,20 @@ const Q = ["data-error"], A = ["accept", "multiple"], R = ["data-label"], x = /*
|
|
|
84
85
|
d("div", {
|
|
85
86
|
class: i(l.$style.text),
|
|
86
87
|
"data-error": !!e.error
|
|
87
|
-
}, s(r(u)[e.lang].sizeUpTo) + " " + s(
|
|
88
|
+
}, s(r(u)[e.lang].sizeUpTo) + " " + s(e.limit / (1024 * 1024)) + " Mb, " + s(e.extensions.join(", ")) + ". ", 11, Q)
|
|
88
89
|
], 2),
|
|
89
90
|
(a(), o("input", {
|
|
90
91
|
type: "file",
|
|
91
|
-
onInput: t[0] || (t[0] = (n) =>
|
|
92
|
+
onInput: t[0] || (t[0] = (n) => D(n.target)),
|
|
92
93
|
ref_key: "input",
|
|
93
94
|
ref: b,
|
|
94
95
|
class: i(l.$style.input),
|
|
95
96
|
key: h.value,
|
|
96
|
-
accept:
|
|
97
|
+
accept: B.value,
|
|
97
98
|
multiple: !e.isSingle
|
|
98
|
-
}, null, 42,
|
|
99
|
-
e.files?.length && !e.file ? (a(!0), o(
|
|
100
|
-
key: `${n}-${
|
|
99
|
+
}, null, 42, j)),
|
|
100
|
+
e.files?.length && !e.file ? (a(!0), o(M, { key: 1 }, I(g.files, (n, S) => (a(), o("div", {
|
|
101
|
+
key: `${n}-${S}`,
|
|
101
102
|
class: i(l.$style.file)
|
|
102
103
|
}, [
|
|
103
104
|
d("div", {
|
|
@@ -142,21 +143,21 @@ const Q = ["data-error"], A = ["accept", "multiple"], R = ["data-label"], x = /*
|
|
|
142
143
|
isDisabled: e.isDisabled
|
|
143
144
|
}, {
|
|
144
145
|
default: _(() => [
|
|
145
|
-
v(s(r(u)[e.lang].upload), 1)
|
|
146
|
+
v(s(e.uploadButtonText || r(u)[e.lang].upload), 1)
|
|
146
147
|
]),
|
|
147
148
|
_: 1
|
|
148
149
|
}, 8, ["isDisabled"])
|
|
149
|
-
], 10,
|
|
150
|
+
], 10, A), [
|
|
150
151
|
[F, e.isSingle && e.file || e.files.length > 0]
|
|
151
152
|
])
|
|
152
153
|
], 2));
|
|
153
154
|
}
|
|
154
|
-
}),
|
|
155
|
-
container:
|
|
156
|
-
upload:
|
|
157
|
-
addButton:
|
|
158
|
-
text:
|
|
159
|
-
input:
|
|
155
|
+
}), T = "_container_4z663_1", P = "_upload_4z663_6", G = "_addButton_4z663_12", H = "_text_4z663_19", K = "_input_4z663_26", Z = "_name_4z663_30", J = "_file_4z663_37", O = "_error_4z663_43", W = "_uploadButton_4z663_47", X = "_label_4z663_51", Y = {
|
|
156
|
+
container: T,
|
|
157
|
+
upload: P,
|
|
158
|
+
addButton: G,
|
|
159
|
+
text: H,
|
|
160
|
+
input: K,
|
|
160
161
|
name: Z,
|
|
161
162
|
file: J,
|
|
162
163
|
error: O,
|
|
@@ -164,7 +165,7 @@ const Q = ["data-error"], A = ["accept", "multiple"], R = ["data-label"], x = /*
|
|
|
164
165
|
label: X
|
|
165
166
|
}, ee = {
|
|
166
167
|
$style: Y
|
|
167
|
-
}, ae = /* @__PURE__ */ N(
|
|
168
|
+
}, ae = /* @__PURE__ */ N(R, [["__cssModules", ee]]);
|
|
168
169
|
export {
|
|
169
170
|
ae as default
|
|
170
171
|
};
|