@zl-ui-kit/components 0.7.2 → 0.8.1
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/README.md +314 -125
- package/dist/components/ZlAction/List.vue.mjs +16 -15
- package/dist/components/ZlAction/types.d.ts +5 -2
- package/dist/components/ZlCardPage/index.vue.d.ts +41 -5
- package/dist/components/ZlCardPage/index.vue.mjs +87 -93
- package/dist/components/ZlDictTag/index.vue.d.ts +5 -0
- package/dist/components/ZlDictTag/index.vue.mjs +20 -19
- package/dist/components/ZlPagination/index.css +1 -1
- package/dist/components/ZlPagination/index.vue.mjs +1 -1
- package/dist/components/ZlPagination/usePagination.d.ts +6 -0
- package/dist/components/ZlPagination/usePagination.mjs +22 -19
- package/dist/components/ZlSearch/index.vue.d.ts +3 -0
- package/dist/components/ZlSearch/index.vue.mjs +81 -78
- package/dist/components/ZlSearchTable/index.vue.d.ts +12 -2
- package/dist/components/ZlUpload/index.css +1 -1
- package/dist/components/ZlUpload/index.vue.d.ts +8 -0
- package/dist/components/ZlUpload/index.vue.mjs +2 -2
- package/dist/components/ZlUpload/index2.vue.mjs +76 -72
- package/package.json +5 -5
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useZlT as
|
|
3
|
-
import { joinFilePrefix as
|
|
4
|
-
import { ElMessage as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as K, computed as n, useModel as T, ref as S, useAttrs as q, resolveComponent as N, resolveDirective as R, withDirectives as Z, openBlock as v, createElementBlock as g, createVNode as w, mergeProps as O, withCtx as B, renderSlot as W, createElementVNode as d, toDisplayString as x, createCommentVNode as V, mergeModels as G } from "vue";
|
|
2
|
+
import { useZlT as H } from "@zl-ui-kit/composables";
|
|
3
|
+
import { joinFilePrefix as J } from "@zl-ui-kit/utils";
|
|
4
|
+
import { ElMessage as z } from "element-plus";
|
|
5
|
+
import U from "../ZlIcon/index.vue.mjs";
|
|
6
|
+
const Q = { class: "zl-upload" }, X = { class: "zl-upload__trigger" }, Y = { class: "zl-upload__item" }, ee = ["src", "onClick"], te = ["title"], oe = ["href", "download"], le = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "zl-upload__tip"
|
|
9
|
-
},
|
|
9
|
+
}, ue = /* @__PURE__ */ K({
|
|
10
10
|
name: "ZlUpload",
|
|
11
11
|
inheritAttrs: !1,
|
|
12
12
|
__name: "index",
|
|
13
|
-
props: /* @__PURE__ */
|
|
13
|
+
props: /* @__PURE__ */ G({
|
|
14
14
|
request: {},
|
|
15
15
|
modelValue: { default: "" },
|
|
16
16
|
accept: {},
|
|
@@ -19,21 +19,25 @@ const H = { class: "zl-upload" }, J = { class: "zl-upload__trigger" }, Q = { cla
|
|
|
19
19
|
tip: {},
|
|
20
20
|
separator: { default: ";" },
|
|
21
21
|
responseUrlKey: { default: "meta" },
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
downloadButtonVisible: { type: Boolean, default: void 0 },
|
|
23
|
+
tipVisible: { type: Boolean, default: void 0 },
|
|
24
|
+
showDownloadButton: { type: Boolean, default: void 0 },
|
|
25
|
+
showTip: { type: Boolean, default: void 0 },
|
|
24
26
|
verifySpace: { type: Boolean, default: !1 }
|
|
25
27
|
}, {
|
|
26
28
|
modelValue: { default: "" },
|
|
27
29
|
modelModifiers: {}
|
|
28
30
|
}),
|
|
29
31
|
emits: ["update:modelValue"],
|
|
30
|
-
setup(
|
|
31
|
-
const { t:
|
|
32
|
-
|
|
32
|
+
setup(h) {
|
|
33
|
+
const { t: u } = H(), t = h, $ = n(
|
|
34
|
+
() => t.downloadButtonVisible ?? t.showDownloadButton ?? !0
|
|
35
|
+
), j = n(() => t.tipVisible ?? t.showTip ?? !0), r = T(h, "modelValue"), m = S([]);
|
|
36
|
+
function C(e) {
|
|
33
37
|
return e.split(t.separator).filter((o) => !!o).map((o) => {
|
|
34
|
-
const
|
|
38
|
+
const s = m.value.filter((a) => a.status === "success").find((a) => a.response?.[t.responseUrlKey] === o);
|
|
35
39
|
return {
|
|
36
|
-
url:
|
|
40
|
+
url: s ? s.url : J(o),
|
|
37
41
|
name: (o.match(/[^/\\]+$/)?.[0] ?? o).split("-").pop() ?? o,
|
|
38
42
|
isImage: /\.(?:jpe?g|png|gif|bmp|webp)$/i.test(o),
|
|
39
43
|
response: {
|
|
@@ -43,111 +47,111 @@ const H = { class: "zl-upload" }, J = { class: "zl-upload__trigger" }, Q = { cla
|
|
|
43
47
|
};
|
|
44
48
|
});
|
|
45
49
|
}
|
|
46
|
-
function
|
|
50
|
+
function F(e) {
|
|
47
51
|
return e.filter((o) => o.status === "success").map((o) => o.response?.[t.responseUrlKey]).filter(Boolean).join(t.separator);
|
|
48
52
|
}
|
|
49
|
-
const
|
|
53
|
+
const b = n({
|
|
50
54
|
get() {
|
|
51
|
-
return typeof
|
|
55
|
+
return typeof r.value == "string" ? [...C(r.value), ...m.value.filter((e) => e.status !== "success")] : r.value;
|
|
52
56
|
},
|
|
53
57
|
set(e) {
|
|
54
|
-
|
|
58
|
+
r.value = typeof r.value == "string" ? F(e) : e, m.value = e;
|
|
55
59
|
}
|
|
56
|
-
}),
|
|
57
|
-
function
|
|
58
|
-
const { file: o, onSuccess:
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
return
|
|
63
|
-
|
|
64
|
-
}).catch((
|
|
65
|
-
a(
|
|
60
|
+
}), k = q(), D = n(() => t.accept ? t.accept.split(",") : []);
|
|
61
|
+
function L(e) {
|
|
62
|
+
const { file: o, onSuccess: s, onError: a, onProgress: l } = e, _ = new AbortController(), E = (i) => {
|
|
63
|
+
const I = i.total > 0 ? i.loaded / i.total * 90 : 0;
|
|
64
|
+
l({ percent: I });
|
|
65
|
+
}, y = new FormData();
|
|
66
|
+
return y.append("file", o), t.request?.(y, { signal: _.signal, onUploadProgress: E }).then((i) => {
|
|
67
|
+
s({ ...i.data });
|
|
68
|
+
}).catch((i) => {
|
|
69
|
+
a(i);
|
|
66
70
|
}), {
|
|
67
71
|
abort() {
|
|
68
|
-
|
|
72
|
+
_.abort();
|
|
69
73
|
}
|
|
70
74
|
};
|
|
71
75
|
}
|
|
72
|
-
const c =
|
|
76
|
+
const c = n(() => {
|
|
73
77
|
const e = {};
|
|
74
|
-
return t.accept && (e.accept =
|
|
75
|
-
}),
|
|
78
|
+
return t.accept && (e.accept = u("zl.upload.accept", `仅支持${t.accept}格式的文件`, { accept: t.accept })), t.limit && (e.limit = u("zl.upload.limit", `最多可上传${t.limit}个`, { limit: t.limit })), t.maxSize && (e.maxSize = u("zl.upload.maxSize", `大小不超过${t.maxSize}MB`, { maxSize: t.maxSize })), e;
|
|
79
|
+
}), f = n(() => {
|
|
76
80
|
const e = [t.tip, ...Object.values(c.value)].filter(Boolean).join(", ");
|
|
77
81
|
return {
|
|
78
82
|
accept: t.accept,
|
|
79
83
|
limit: t.limit,
|
|
80
84
|
multiple: t.limit ? t.limit > 1 : !0,
|
|
81
|
-
httpRequest:
|
|
82
|
-
fileList:
|
|
83
|
-
"onUpdate:fileList": (o) =>
|
|
84
|
-
...
|
|
85
|
+
httpRequest: L,
|
|
86
|
+
fileList: b.value,
|
|
87
|
+
"onUpdate:fileList": (o) => b.value = o,
|
|
88
|
+
...k,
|
|
85
89
|
// tip 不透传 el-upload(无此属性),由组件尾部渲染
|
|
86
90
|
tip: void 0,
|
|
87
|
-
__tip:
|
|
91
|
+
__tip: j.value ? e : ""
|
|
88
92
|
};
|
|
89
93
|
});
|
|
90
|
-
function
|
|
91
|
-
return
|
|
94
|
+
function P(e) {
|
|
95
|
+
return D.value.some((o) => o.includes("/") ? e.type.startsWith(o.replace(/\*$/, "")) : e.name.endsWith(o));
|
|
92
96
|
}
|
|
93
|
-
function
|
|
94
|
-
return t.verifySpace && /\s/.test(e.name) ? (
|
|
97
|
+
function A(e) {
|
|
98
|
+
return t.verifySpace && /\s/.test(e.name) ? (z.warning(u("zl.upload.nameSpace", "文件名中不得包含空格")), !1) : c.value.accept && !P(e) ? (z.warning(c.value.accept), !1) : t.maxSize && e.size > t.maxSize * 1024 * 1024 ? (z.warning(c.value.maxSize), !1) : !0;
|
|
95
99
|
}
|
|
96
|
-
const
|
|
97
|
-
function
|
|
98
|
-
e.status === "success" && (
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
window.open(
|
|
100
|
+
const p = S(!1);
|
|
101
|
+
function M(e) {
|
|
102
|
+
e.status === "success" && (p.value = !0, fetch(e.url ?? "").then((o) => o.blob()).then((o) => {
|
|
103
|
+
p.value = !1;
|
|
104
|
+
const s = URL.createObjectURL(o);
|
|
105
|
+
window.open(s);
|
|
102
106
|
}).catch(() => {
|
|
103
|
-
|
|
107
|
+
p.value = !1;
|
|
104
108
|
}));
|
|
105
109
|
}
|
|
106
110
|
return (e, o) => {
|
|
107
|
-
const
|
|
108
|
-
return
|
|
109
|
-
|
|
110
|
-
"before-upload":
|
|
111
|
+
const s = N("el-upload"), a = R("loading");
|
|
112
|
+
return Z((v(), g("div", Q, [
|
|
113
|
+
w(s, O(f.value, {
|
|
114
|
+
"before-upload": A,
|
|
111
115
|
"list-type": "picture"
|
|
112
116
|
}), {
|
|
113
|
-
file:
|
|
114
|
-
d("div",
|
|
117
|
+
file: B(({ file: l }) => [
|
|
118
|
+
d("div", Y, [
|
|
115
119
|
d("img", {
|
|
116
120
|
class: "zl-upload__item-thumbnail",
|
|
117
|
-
src: (
|
|
118
|
-
onClick: (
|
|
119
|
-
}, null, 8,
|
|
121
|
+
src: (l.isImage !== !1 && /\.(?:jpe?g|png|gif|bmp|webp)$/i.test(l.name), l.url),
|
|
122
|
+
onClick: (_) => M(l)
|
|
123
|
+
}, null, 8, ee),
|
|
120
124
|
d("span", {
|
|
121
125
|
class: "zl-upload__item-name",
|
|
122
|
-
title:
|
|
123
|
-
},
|
|
124
|
-
|
|
126
|
+
title: l.name
|
|
127
|
+
}, x(l.name), 9, te),
|
|
128
|
+
$.value && l.status === "success" && l.url ? (v(), g("a", {
|
|
125
129
|
key: 0,
|
|
126
130
|
class: "zl-upload__item-op",
|
|
127
|
-
href:
|
|
128
|
-
download:
|
|
131
|
+
href: l.url,
|
|
132
|
+
download: l.name
|
|
129
133
|
}, [
|
|
130
|
-
|
|
131
|
-
], 8,
|
|
134
|
+
w(U, { icon: "zl:download" })
|
|
135
|
+
], 8, oe)) : V("", !0)
|
|
132
136
|
])
|
|
133
137
|
]),
|
|
134
|
-
default:
|
|
135
|
-
|
|
136
|
-
d("div",
|
|
137
|
-
|
|
138
|
+
default: B(() => [
|
|
139
|
+
W(e.$slots, "default", {}, () => [
|
|
140
|
+
d("div", X, [
|
|
141
|
+
w(U, { icon: "zl:add" })
|
|
138
142
|
])
|
|
139
143
|
], !0)
|
|
140
144
|
]),
|
|
141
145
|
_: 3
|
|
142
146
|
}, 16),
|
|
143
|
-
|
|
147
|
+
f.value.__tip ? (v(), g("div", le, x(f.value.__tip), 1)) : V("", !0)
|
|
144
148
|
])), [
|
|
145
|
-
[a,
|
|
149
|
+
[a, p.value]
|
|
146
150
|
]);
|
|
147
151
|
};
|
|
148
152
|
}
|
|
149
153
|
});
|
|
150
154
|
export {
|
|
151
|
-
|
|
155
|
+
ue as default
|
|
152
156
|
};
|
|
153
157
|
//# sourceMappingURL=index2.vue.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zl-ui-kit/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ZL UI 业务组件库(Element Plus 体系,Zl 前缀)——首批:Icon/AutoTooltip/Tag/CornerTag/Text/Title/Copy/Empty/Pagination/DictTag",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"file-type": "^20.4.1",
|
|
40
40
|
"dt-sql-parser": "^4.3.1",
|
|
41
41
|
"sql-formatter": "^15.4.2",
|
|
42
|
-
"@zl-ui-kit/
|
|
43
|
-
"@zl-ui-kit/
|
|
44
|
-
"@zl-ui-kit/
|
|
42
|
+
"@zl-ui-kit/icons": "0.8.1",
|
|
43
|
+
"@zl-ui-kit/composables": "0.8.1",
|
|
44
|
+
"@zl-ui-kit/utils": "0.8.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@vueuse/core": "^12.3.0",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"echarts": "^5.6.0",
|
|
101
101
|
"@jichuang/eslint-config": "1.0.0",
|
|
102
102
|
"@jichuang/tsconfig": "1.0.0",
|
|
103
|
-
"@zl-ui-kit/theme": "0.
|
|
103
|
+
"@zl-ui-kit/theme": "0.8.1",
|
|
104
104
|
"@jichuang/vite-config": "1.0.0"
|
|
105
105
|
},
|
|
106
106
|
"repository": {
|