@aplus-frontend/ui 0.4.14 → 0.4.15
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/es/src/ap-table/ap-table.vue2.mjs +206 -181
- package/es/src/ap-upload/apUpload.vue.d.ts +9 -0
- package/es/src/ap-upload/apUpload.vue.mjs +22 -18
- package/es/src/ap-upload/components/MultipleFile.vue2.mjs +66 -66
- package/es/src/ap-upload/components/Picture.vue2.mjs +82 -82
- package/es/src/ap-upload/components/SingleFile.vue2.mjs +114 -114
- package/es/src/config-provider/config-provider.d.ts +3 -0
- package/es/src/config-provider/css-var.d.ts +3 -0
- package/es/src/config-provider/css-var.mjs +21 -14
- package/es/src/config-provider/index.d.ts +15 -0
- package/es/src/scroll-bar/index.vue.d.ts +1 -0
- package/es/src/scroll-bar/index.vue.mjs +31 -30
- package/es/src/scroll-bar/interface.d.ts +3 -1
- package/es/src/theme/antd-global-overwrite/admin/index.css +24 -2
- package/es/src/theme/antd-global-overwrite/admin/table.css +24 -2
- package/es/src/theme/antd-global-overwrite/aplus/index.css +24 -2
- package/es/src/theme/antd-global-overwrite/aplus/table.css +24 -2
- package/es/src/utils/index.d.ts +1 -0
- package/es/src/utils/index.mjs +40 -30
- package/lib/src/ap-table/ap-table.vue2.js +1 -1
- package/lib/src/ap-upload/apUpload.vue.d.ts +9 -0
- package/lib/src/ap-upload/apUpload.vue.js +1 -1
- package/lib/src/ap-upload/components/MultipleFile.vue2.js +1 -1
- package/lib/src/ap-upload/components/Picture.vue2.js +1 -1
- package/lib/src/ap-upload/components/SingleFile.vue2.js +1 -1
- package/lib/src/config-provider/config-provider.d.ts +3 -0
- package/lib/src/config-provider/css-var.d.ts +3 -0
- package/lib/src/config-provider/css-var.js +1 -1
- package/lib/src/config-provider/index.d.ts +15 -0
- package/lib/src/scroll-bar/index.vue.d.ts +1 -0
- package/lib/src/scroll-bar/index.vue.js +1 -1
- package/lib/src/scroll-bar/interface.d.ts +3 -1
- package/lib/src/theme/antd-global-overwrite/admin/index.css +24 -2
- package/lib/src/theme/antd-global-overwrite/admin/table.css +24 -2
- package/lib/src/theme/antd-global-overwrite/aplus/index.css +24 -2
- package/lib/src/theme/antd-global-overwrite/aplus/table.css +24 -2
- package/lib/src/utils/index.d.ts +1 -0
- package/lib/src/utils/index.js +1 -1
- package/package.json +1 -1
- package/theme/antd-global-overwrite/admin/index.css +24 -2
- package/theme/antd-global-overwrite/admin/table.css +24 -2
- package/theme/antd-global-overwrite/admin/table.less +8 -2
- package/theme/antd-global-overwrite/aplus/index.css +24 -2
- package/theme/antd-global-overwrite/aplus/table.css +24 -2
- package/theme/antd-global-overwrite/aplus/table.less +7 -2
- package/theme/ap-table/ap-table.css +7 -0
- package/theme/ap-table/ap-table.less +10 -8
- package/theme/ap-table-modal/index.css +7 -0
- package/theme/index.css +7 -0
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as oe, inject as o, ref as _, watch as le, computed as se, openBlock as k, createElementBlock as z, normalizeClass as re, unref as a, createElementVNode as i, toDisplayString as A, createCommentVNode as b, normalizeStyle as ie, createBlock as ce, withModifiers as ue, createVNode as pe } from "vue";
|
|
2
2
|
import "../../config-provider/index.mjs";
|
|
3
|
-
import { getName as
|
|
4
|
-
import { useOss as
|
|
5
|
-
import { fileMatchesAccept as
|
|
6
|
-
import { message as u, Progress as
|
|
7
|
-
import { DeleteOutlined as
|
|
8
|
-
import
|
|
9
|
-
import { useLocale as
|
|
10
|
-
import { useNamespace as
|
|
11
|
-
const
|
|
3
|
+
import { getName as ve, getReturnData as I } from "../utils/returnData.mjs";
|
|
4
|
+
import { useOss as de, useOssInit as fe } from "../hooks/useOss.mjs";
|
|
5
|
+
import { fileMatchesAccept as me, getAcceptText as ge } from "../utils/accept.mjs";
|
|
6
|
+
import { message as u, Progress as he } from "@aplus-frontend/antdv";
|
|
7
|
+
import { DeleteOutlined as _e } from "@ant-design/icons-vue";
|
|
8
|
+
import j from "../assets/single-file-icon.png.mjs";
|
|
9
|
+
import { useLocale as ke } from "../../config-provider/hooks/use-locale.mjs";
|
|
10
|
+
import { useNamespace as ye } from "../../config-provider/hooks/use-namespace.mjs";
|
|
11
|
+
const we = ["accept"], De = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "state-un"
|
|
14
|
-
},
|
|
14
|
+
}, Ue = ["src"], Fe = { class: "state-un-title" }, Ce = { class: "state-un-subtitle" }, Ee = {
|
|
15
15
|
key: 1,
|
|
16
16
|
class: "state-ing"
|
|
17
|
-
},
|
|
17
|
+
}, Se = { class: "left" }, Ne = ["src"], xe = { class: "center" }, ze = { class: "center-progress" }, Ie = /* @__PURE__ */ oe({
|
|
18
18
|
__name: "SingleFile",
|
|
19
|
-
setup(
|
|
20
|
-
const { t: r } =
|
|
21
|
-
|
|
22
|
-
() =>
|
|
19
|
+
setup(Ae, { expose: G }) {
|
|
20
|
+
const { t: r } = ke(), { b: y } = ye("ap-upload-single-file"), { put: W, client: B } = de(), w = o("theme"), H = o("dirName"), D = o("accept") || "*", U = o("maxSize") ?? 500, J = o("title") || r("ap.apUpload.clickOrDragUpload"), F = o("subTitle"), l = o("value"), C = o("needName"), p = o("uploadingCount"), R = o("beforeUpload"), M = o("customRequest"), K = o("getOssAccess"), Q = o("maxSizeErrorMsg"), X = o("acceptErrorMsg"), f = o("onRemove"), n = _(null);
|
|
21
|
+
le(
|
|
22
|
+
() => l == null ? void 0 : l.value,
|
|
23
23
|
function(e) {
|
|
24
|
-
|
|
24
|
+
n.value === null && e && O(e);
|
|
25
25
|
},
|
|
26
26
|
{ immediate: !0 }
|
|
27
27
|
);
|
|
28
|
-
function
|
|
28
|
+
function O(e) {
|
|
29
29
|
e ? setTimeout(() => {
|
|
30
|
-
const t =
|
|
31
|
-
|
|
32
|
-
}) : (
|
|
30
|
+
const t = ve(C, e);
|
|
31
|
+
s.value = 3, n.value = new File([e], t, {}), l.value = e;
|
|
32
|
+
}) : (s.value = 1, n.value = null, l.value = void 0);
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
function
|
|
34
|
+
G({ setValue: O });
|
|
35
|
+
const s = _(1), m = _(0), g = _(null), P = se(() => n.value && (l == null ? void 0 : l.value));
|
|
36
|
+
function Y() {
|
|
37
37
|
var e;
|
|
38
|
-
|
|
38
|
+
s.value === 1 && ((e = g.value) == null || e.click());
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function T(e) {
|
|
41
41
|
e.preventDefault(), e.stopPropagation();
|
|
42
42
|
}
|
|
43
|
-
function Y(e) {
|
|
44
|
-
e.dataTransfer.dropEffect = "copy", e.preventDefault(), e.stopPropagation();
|
|
45
|
-
}
|
|
46
43
|
function Z(e) {
|
|
47
|
-
|
|
44
|
+
e.dataTransfer.dropEffect = "copy", e.preventDefault(), e.stopPropagation();
|
|
48
45
|
}
|
|
49
46
|
function V(e) {
|
|
50
|
-
|
|
47
|
+
L(e);
|
|
48
|
+
}
|
|
49
|
+
function ee(e) {
|
|
50
|
+
if (e.preventDefault(), e.stopPropagation(), s.value !== 1)
|
|
51
51
|
return;
|
|
52
|
-
var t = e.dataTransfer, c = [],
|
|
52
|
+
var t = e.dataTransfer, c = [], $ = 0, q = t.files.length;
|
|
53
53
|
function v() {
|
|
54
|
-
|
|
54
|
+
$ === q - 1 && V(c), $++;
|
|
55
55
|
}
|
|
56
56
|
if (t.items !== void 0)
|
|
57
|
-
for (var
|
|
58
|
-
var
|
|
59
|
-
if (
|
|
60
|
-
var
|
|
61
|
-
c.push(
|
|
57
|
+
for (var E = 0; E < t.items.length; E++) {
|
|
58
|
+
var S = t.items[E];
|
|
59
|
+
if (S.kind === "file" && S.webkitGetAsEntry().isFile) {
|
|
60
|
+
var ne = S.getAsFile();
|
|
61
|
+
c.push(ne), v();
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
else
|
|
65
|
-
for (let
|
|
66
|
-
var
|
|
67
|
-
if (
|
|
68
|
-
c.push(
|
|
65
|
+
for (let x = 0; x < q; x++) {
|
|
66
|
+
var h = t.files[x];
|
|
67
|
+
if (h.type)
|
|
68
|
+
c.push(h), v();
|
|
69
69
|
else
|
|
70
70
|
try {
|
|
71
|
-
var
|
|
72
|
-
|
|
71
|
+
var N = new FileReader();
|
|
72
|
+
N.readAsDataURL(h.slice(0, 3)), N.addEventListener(
|
|
73
73
|
"load",
|
|
74
74
|
function(d) {
|
|
75
|
-
console.warn(d, "load"), c.push(
|
|
75
|
+
console.warn(d, "load"), c.push(h), v();
|
|
76
76
|
},
|
|
77
77
|
!1
|
|
78
|
-
),
|
|
78
|
+
), N.addEventListener(
|
|
79
79
|
"error",
|
|
80
80
|
function(d) {
|
|
81
81
|
console.warn(d, "error"), u.warning(r("ap.apUpload.foldersNotSupported")), v();
|
|
@@ -87,143 +87,143 @@ const ye = ["accept"], we = {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
async function
|
|
90
|
+
async function te(e) {
|
|
91
91
|
const t = e.target;
|
|
92
|
-
await
|
|
92
|
+
await L(t == null ? void 0 : t.files), g.value && (g.value.value = "");
|
|
93
93
|
}
|
|
94
|
-
async function
|
|
94
|
+
async function L(e) {
|
|
95
95
|
if (e != null && e.length) {
|
|
96
|
-
if (e[0].size >
|
|
96
|
+
if (e[0].size > U * 1024 * 1024) {
|
|
97
97
|
u.warning(
|
|
98
|
-
|
|
99
|
-
maxSize:
|
|
98
|
+
Q || r("ap.apUpload.maxUploadFileSize", {
|
|
99
|
+
maxSize: U
|
|
100
100
|
})
|
|
101
101
|
);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
if (!
|
|
104
|
+
if (!me(e[0], D)) {
|
|
105
105
|
u.warning(
|
|
106
|
-
|
|
106
|
+
X || r("ap.apUpload.fileFormatNotSupported")
|
|
107
107
|
);
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
if (typeof
|
|
110
|
+
if (typeof R == "function" && await R(e[0]) === !1)
|
|
111
111
|
return;
|
|
112
|
-
if (
|
|
113
|
-
|
|
112
|
+
if (n.value = e[0], s.value = 2, m.value = 0, p.value++, typeof M == "function") {
|
|
113
|
+
M({
|
|
114
114
|
onProgress: (t) => {
|
|
115
|
-
|
|
115
|
+
m.value = t;
|
|
116
116
|
},
|
|
117
117
|
onError: (t) => {
|
|
118
|
-
u.warning(t || r("ap.apUpload.networkAnomaly")),
|
|
118
|
+
u.warning(t || r("ap.apUpload.networkAnomaly")), s.value = 1, n.value = null, p.value--;
|
|
119
119
|
},
|
|
120
120
|
onSuccess: (t) => {
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
l.value = I(
|
|
122
|
+
C,
|
|
123
123
|
t,
|
|
124
|
-
|
|
125
|
-
),
|
|
124
|
+
n.value.name
|
|
125
|
+
), s.value = 3, p.value--;
|
|
126
126
|
},
|
|
127
127
|
file: e[0]
|
|
128
128
|
});
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
131
131
|
try {
|
|
132
|
-
await
|
|
133
|
-
file:
|
|
134
|
-
dirName:
|
|
135
|
-
oss:
|
|
132
|
+
await fe(K), W({
|
|
133
|
+
file: n.value,
|
|
134
|
+
dirName: H,
|
|
135
|
+
oss: B,
|
|
136
136
|
successCallBack(t) {
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
l.value = I(
|
|
138
|
+
C,
|
|
139
139
|
t,
|
|
140
|
-
|
|
141
|
-
),
|
|
140
|
+
n.value.name
|
|
141
|
+
), s.value = 3, p.value--;
|
|
142
142
|
},
|
|
143
143
|
errorCallBack(t) {
|
|
144
|
-
u.warning(t || r("ap.apUpload.networkAnomaly")),
|
|
144
|
+
u.warning(t || r("ap.apUpload.networkAnomaly")), s.value = 1, n.value = null, p.value--;
|
|
145
145
|
},
|
|
146
146
|
progressCallBack(t) {
|
|
147
|
-
|
|
147
|
+
m.value = t;
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
150
|
} catch (t) {
|
|
151
151
|
u.warning(
|
|
152
152
|
typeof (t == null ? void 0 : t.message) == "string" ? t.message : r("ap.apUpload.networkAnomaly")
|
|
153
|
-
),
|
|
153
|
+
), s.value = 1, n.value = null, p.value--;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
|
|
157
|
+
function ae() {
|
|
158
|
+
f && (f == null || f(n.value)), n.value && !(l != null && l.value) && B.pauseUpload(), s.value = 1, n.value = null, l.value = void 0;
|
|
159
159
|
}
|
|
160
160
|
return (e, t) => {
|
|
161
161
|
var c;
|
|
162
|
-
return
|
|
163
|
-
class:
|
|
164
|
-
[a(
|
|
165
|
-
[a(
|
|
166
|
-
[a(
|
|
162
|
+
return k(), z("div", {
|
|
163
|
+
class: re({
|
|
164
|
+
[a(y)()]: !0,
|
|
165
|
+
[a(y)("admin")]: a(w) === "admin",
|
|
166
|
+
[a(y)("un")]: s.value === 1
|
|
167
167
|
}),
|
|
168
|
-
onClick:
|
|
169
|
-
onDragenter:
|
|
170
|
-
onDragover:
|
|
171
|
-
onDragleave:
|
|
172
|
-
onDrop:
|
|
168
|
+
onClick: Y,
|
|
169
|
+
onDragenter: T,
|
|
170
|
+
onDragover: Z,
|
|
171
|
+
onDragleave: T,
|
|
172
|
+
onDrop: ee
|
|
173
173
|
}, [
|
|
174
174
|
i("input", {
|
|
175
175
|
ref_key: "fileRef",
|
|
176
|
-
ref:
|
|
176
|
+
ref: g,
|
|
177
177
|
style: { display: "none" },
|
|
178
178
|
type: "file",
|
|
179
|
-
accept: a(
|
|
180
|
-
onChange:
|
|
181
|
-
}, null, 40,
|
|
182
|
-
|
|
179
|
+
accept: a(D),
|
|
180
|
+
onChange: te
|
|
181
|
+
}, null, 40, we),
|
|
182
|
+
s.value === 1 ? (k(), z("div", De, [
|
|
183
183
|
i("img", {
|
|
184
184
|
class: "state-un-icon",
|
|
185
|
-
src: a(
|
|
186
|
-
}, null, 8,
|
|
187
|
-
i("div",
|
|
188
|
-
i("div",
|
|
189
|
-
a(
|
|
185
|
+
src: a(j)
|
|
186
|
+
}, null, 8, Ue),
|
|
187
|
+
i("div", Fe, A(a(J)), 1),
|
|
188
|
+
i("div", Ce, A(typeof a(F) == "string" && a(F).length > 0 ? a(F) : `${a(r)("ap.apUpload.supportExtension")}:${a(ge)(
|
|
189
|
+
a(D)
|
|
190
190
|
)},${a(r)("ap.apUpload.maxWarnUploadFileSize", {
|
|
191
|
-
maxSize: a(
|
|
191
|
+
maxSize: a(U)
|
|
192
192
|
})}`), 1)
|
|
193
|
-
])) :
|
|
194
|
-
[2, 3].includes(
|
|
195
|
-
i("div",
|
|
196
|
-
i("img", { src: a(
|
|
193
|
+
])) : b("", !0),
|
|
194
|
+
[2, 3].includes(s.value) ? (k(), z("div", Ee, [
|
|
195
|
+
i("div", Se, [
|
|
196
|
+
i("img", { src: a(j) }, null, 8, Ne)
|
|
197
197
|
]),
|
|
198
|
-
i("div",
|
|
198
|
+
i("div", xe, [
|
|
199
199
|
i("div", {
|
|
200
200
|
class: "center-title",
|
|
201
|
-
style:
|
|
202
|
-
color:
|
|
201
|
+
style: ie({
|
|
202
|
+
color: P.value ? "#0070FF" : "#182948"
|
|
203
203
|
})
|
|
204
|
-
},
|
|
205
|
-
i("div",
|
|
206
|
-
|
|
204
|
+
}, A((c = n.value) == null ? void 0 : c.name), 5),
|
|
205
|
+
i("div", ze, [
|
|
206
|
+
P.value ? b("", !0) : (k(), ce(a(he), {
|
|
207
207
|
key: 0,
|
|
208
|
-
percent:
|
|
208
|
+
percent: m.value,
|
|
209
209
|
size: 4,
|
|
210
210
|
"show-info": !1,
|
|
211
|
-
"trail-color": a(
|
|
212
|
-
"stroke-color": a(
|
|
211
|
+
"trail-color": a(w) === "admin" ? "#D9D9D9" : "#DEE4ED",
|
|
212
|
+
"stroke-color": a(w) === "admin" ? "#34B77C" : "#0070FF"
|
|
213
213
|
}, null, 8, ["percent", "trail-color", "stroke-color"]))
|
|
214
214
|
])
|
|
215
215
|
]),
|
|
216
216
|
i("div", {
|
|
217
217
|
class: "right",
|
|
218
|
-
onClick:
|
|
218
|
+
onClick: ue(ae, ["stop"])
|
|
219
219
|
}, [
|
|
220
|
-
|
|
220
|
+
pe(a(_e))
|
|
221
221
|
])
|
|
222
|
-
])) :
|
|
222
|
+
])) : b("", !0)
|
|
223
223
|
], 34);
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
226
|
});
|
|
227
227
|
export {
|
|
228
|
-
|
|
228
|
+
Ie as default
|
|
229
229
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { getScrollbarSize as F } from "../utils/index.mjs";
|
|
2
|
+
const l = F(), p = {
|
|
2
3
|
"ap-form": {
|
|
3
4
|
bordered: {
|
|
4
5
|
"border-color": {
|
|
@@ -64,6 +65,9 @@ const F = {
|
|
|
64
65
|
basic: {
|
|
65
66
|
color: {
|
|
66
67
|
primary: "#0070ff"
|
|
68
|
+
},
|
|
69
|
+
scrollbar: {
|
|
70
|
+
size: `${l}px`
|
|
67
71
|
}
|
|
68
72
|
},
|
|
69
73
|
"ap-descriptions": {
|
|
@@ -100,7 +104,7 @@ const F = {
|
|
|
100
104
|
"color-disabled": "rgba(24, 41, 72, 0.25)"
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
|
-
},
|
|
107
|
+
}, d = {
|
|
104
108
|
"ap-form": {
|
|
105
109
|
bordered: {
|
|
106
110
|
"border-color": {
|
|
@@ -166,6 +170,9 @@ const F = {
|
|
|
166
170
|
basic: {
|
|
167
171
|
color: {
|
|
168
172
|
primary: "#34b77c"
|
|
173
|
+
},
|
|
174
|
+
scrollbar: {
|
|
175
|
+
size: `${l}px`
|
|
169
176
|
}
|
|
170
177
|
},
|
|
171
178
|
"ap-descriptions": {
|
|
@@ -203,26 +210,26 @@ const F = {
|
|
|
203
210
|
}
|
|
204
211
|
}
|
|
205
212
|
};
|
|
206
|
-
function
|
|
213
|
+
function n(t) {
|
|
207
214
|
const o = {};
|
|
208
|
-
function r(a,
|
|
209
|
-
const
|
|
210
|
-
for (const c of
|
|
211
|
-
const e = a[c],
|
|
212
|
-
e !== null && typeof e == "object" ? r(e,
|
|
215
|
+
function r(a, s) {
|
|
216
|
+
const b = Object.keys(a);
|
|
217
|
+
for (const c of b) {
|
|
218
|
+
const e = a[c], i = [...s, c];
|
|
219
|
+
e !== null && typeof e == "object" ? r(e, i) : o[`--${i.join("-")}`] = e;
|
|
213
220
|
}
|
|
214
221
|
}
|
|
215
222
|
return r(t, []), o;
|
|
216
223
|
}
|
|
217
|
-
const
|
|
218
|
-
function
|
|
224
|
+
const g = n(p), m = n(d);
|
|
225
|
+
function D(t) {
|
|
219
226
|
Object.entries(t).forEach(([o, r]) => {
|
|
220
227
|
document.documentElement.style.setProperty(o, r);
|
|
221
228
|
});
|
|
222
229
|
}
|
|
223
230
|
export {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
231
|
+
m as adminCssVar,
|
|
232
|
+
g as aplusCssVar,
|
|
233
|
+
n as generateCssVar,
|
|
234
|
+
D as setCSSVariables
|
|
228
235
|
};
|
|
@@ -228,6 +228,9 @@ export declare const APConfigProvider: {
|
|
|
228
228
|
color: {
|
|
229
229
|
primary: string;
|
|
230
230
|
};
|
|
231
|
+
scrollbar: {
|
|
232
|
+
size: string;
|
|
233
|
+
};
|
|
231
234
|
};
|
|
232
235
|
'ap-descriptions': {
|
|
233
236
|
item: {
|
|
@@ -374,6 +377,9 @@ export declare const APConfigProvider: {
|
|
|
374
377
|
color: {
|
|
375
378
|
primary: string;
|
|
376
379
|
};
|
|
380
|
+
scrollbar: {
|
|
381
|
+
size: string;
|
|
382
|
+
};
|
|
377
383
|
};
|
|
378
384
|
'ap-descriptions': {
|
|
379
385
|
item: {
|
|
@@ -628,6 +634,9 @@ export declare const APConfigProvider: {
|
|
|
628
634
|
color: {
|
|
629
635
|
primary: string;
|
|
630
636
|
};
|
|
637
|
+
scrollbar: {
|
|
638
|
+
size: string;
|
|
639
|
+
};
|
|
631
640
|
};
|
|
632
641
|
'ap-descriptions': {
|
|
633
642
|
item: {
|
|
@@ -774,6 +783,9 @@ export declare const APConfigProvider: {
|
|
|
774
783
|
color: {
|
|
775
784
|
primary: string;
|
|
776
785
|
};
|
|
786
|
+
scrollbar: {
|
|
787
|
+
size: string;
|
|
788
|
+
};
|
|
777
789
|
};
|
|
778
790
|
'ap-descriptions': {
|
|
779
791
|
item: {
|
|
@@ -1069,6 +1081,9 @@ export declare const APConfigProvider: {
|
|
|
1069
1081
|
color: {
|
|
1070
1082
|
primary: string;
|
|
1071
1083
|
};
|
|
1084
|
+
scrollbar: {
|
|
1085
|
+
size: string;
|
|
1086
|
+
};
|
|
1072
1087
|
};
|
|
1073
1088
|
'ap-descriptions': {
|
|
1074
1089
|
item: {
|
|
@@ -3,6 +3,7 @@ import { DefineComponent, ComputedRef, ComponentOptionsMixin, PublicProps, Compo
|
|
|
3
3
|
declare const _default: DefineComponent<ScrollBarProps, {
|
|
4
4
|
currentScroll: ComputedRef<number | undefined>;
|
|
5
5
|
scroll: ((percent: number) => void) | undefined;
|
|
6
|
+
visible: ComputedRef<boolean>;
|
|
6
7
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ScrollBarProps> & Readonly<{}>, {
|
|
7
8
|
disabled: boolean;
|
|
8
9
|
direction: ScrollBarDirection;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as g, toRef as x, ref as d, watchEffect as _, unref as i, watch as k, computed as p, openBlock as C, createBlock as B, mergeProps as L, createCommentVNode as R } from "vue";
|
|
2
2
|
import "./internal.vue2.mjs";
|
|
3
3
|
import { omit as w } from "lodash-unified";
|
|
4
4
|
import { getScrollable as s, ensureRangeValue as y } from "./utils/index.mjs";
|
|
5
5
|
import { useResizeObserver as E } from "@vueuse/core";
|
|
6
6
|
import N from "./internal.vue.mjs";
|
|
7
|
-
const
|
|
7
|
+
const j = /* @__PURE__ */ g({
|
|
8
8
|
name: "ScrollBar",
|
|
9
9
|
__name: "index",
|
|
10
10
|
props: {
|
|
@@ -24,67 +24,68 @@ const W = /* @__PURE__ */ z({
|
|
|
24
24
|
onScroll: {},
|
|
25
25
|
onScrollEnd: {}
|
|
26
26
|
},
|
|
27
|
-
setup(
|
|
27
|
+
setup(S, { expose: m }) {
|
|
28
28
|
var f;
|
|
29
|
-
const r =
|
|
30
|
-
function
|
|
29
|
+
const r = S, o = x(r, "scrollContainer"), l = d(), n = d(r.barLength);
|
|
30
|
+
function v() {
|
|
31
31
|
if (!o.value || !l.value) return;
|
|
32
|
-
const { totalSize: e, visibleSize: t, distance:
|
|
32
|
+
const { totalSize: e, visibleSize: t, distance: a } = s(
|
|
33
33
|
o.value,
|
|
34
34
|
r.direction
|
|
35
|
-
),
|
|
36
|
-
l.value.scroll(
|
|
35
|
+
), c = a / (e + r.extraSize - t || 1) * 100;
|
|
36
|
+
l.value.scroll(c);
|
|
37
37
|
}
|
|
38
38
|
function u() {
|
|
39
39
|
const { visibleSize: e, totalSize: t } = s(
|
|
40
40
|
o.value,
|
|
41
41
|
r.direction
|
|
42
42
|
);
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
n.value = y(
|
|
44
|
+
e / (t + r.extraSize || 1) * 100
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
E(o, () => {
|
|
48
48
|
u();
|
|
49
|
-
}),
|
|
49
|
+
}), _(
|
|
50
50
|
() => {
|
|
51
|
-
const e =
|
|
52
|
-
e && (u(), e.addEventListener("scroll",
|
|
51
|
+
const e = i(o.value);
|
|
52
|
+
e && (u(), e.addEventListener("scroll", v));
|
|
53
53
|
},
|
|
54
54
|
{ flush: "post" }
|
|
55
|
-
),
|
|
55
|
+
), k(
|
|
56
56
|
() => r.barLength,
|
|
57
57
|
(e) => {
|
|
58
|
-
|
|
58
|
+
n.value = e;
|
|
59
59
|
}
|
|
60
60
|
);
|
|
61
|
-
function
|
|
62
|
-
const t =
|
|
61
|
+
function b(e) {
|
|
62
|
+
const t = i(o);
|
|
63
63
|
if (!t) return;
|
|
64
|
-
const { totalSize:
|
|
64
|
+
const { totalSize: a, visibleSize: c, topOrLeft: h } = s(
|
|
65
65
|
t,
|
|
66
66
|
r.direction
|
|
67
67
|
);
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
t[
|
|
68
|
+
if (a <= c) return;
|
|
69
|
+
const z = `scroll${h}`;
|
|
70
|
+
t[z] = e * (a + r.extraSize - c) / 100;
|
|
71
71
|
}
|
|
72
|
-
return
|
|
73
|
-
currentScroll:
|
|
72
|
+
return m({
|
|
73
|
+
currentScroll: p(() => {
|
|
74
74
|
var e;
|
|
75
|
-
return
|
|
75
|
+
return i((e = l.value) == null ? void 0 : e.currentScroll);
|
|
76
76
|
}),
|
|
77
|
-
scroll: (f = l.value) == null ? void 0 : f.scroll
|
|
78
|
-
|
|
77
|
+
scroll: (f = l.value) == null ? void 0 : f.scroll,
|
|
78
|
+
visible: p(() => n.value < 100)
|
|
79
|
+
}), (e, t) => n.value !== 100 ? (C(), B(N, L({
|
|
79
80
|
key: 0,
|
|
80
81
|
ref_key: "barRef",
|
|
81
82
|
ref: l
|
|
82
|
-
},
|
|
83
|
-
"bar-length":
|
|
84
|
-
onScroll:
|
|
83
|
+
}, i(w)(r, ["onScroll", "extraSize", "scrollContainer"]), {
|
|
84
|
+
"bar-length": n.value,
|
|
85
|
+
onScroll: b
|
|
85
86
|
}), null, 16, ["bar-length"])) : R("", !0);
|
|
86
87
|
}
|
|
87
88
|
});
|
|
88
89
|
export {
|
|
89
|
-
|
|
90
|
+
j as default
|
|
90
91
|
};
|
|
@@ -63,4 +63,6 @@ export interface InternalScrollBarExpose {
|
|
|
63
63
|
bar: Ref<HTMLElement>;
|
|
64
64
|
scroll: (percent: number) => void;
|
|
65
65
|
}
|
|
66
|
-
export type ScrollBarExpose = Pick<InternalScrollBarExpose, 'scroll' | 'currentScroll'
|
|
66
|
+
export type ScrollBarExpose = Pick<InternalScrollBarExpose, 'scroll' | 'currentScroll'> & {
|
|
67
|
+
visible?: Ref<boolean>;
|
|
68
|
+
};
|