@aplus-frontend/ui 7.15.5 → 7.15.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.
- package/es/src/ap-modal/utils/createModal.mjs +24 -21
- package/es/src/scroll-view/index.vue.mjs +100 -96
- package/es/src/scroll-view/interface.d.ts +2 -0
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ap-modal/utils/createModal.js +1 -1
- package/lib/src/scroll-view/index.vue.js +1 -1
- package/lib/src/scroll-view/interface.d.ts +2 -0
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { render as m, defineComponent as P, createVNode as
|
|
1
|
+
import { render as m, defineComponent as P, createVNode as p, mergeProps as k, h as N } from "vue";
|
|
2
2
|
import { Modal as $ } from "@aplus-frontend/antdv";
|
|
3
3
|
import { isNumeric as h } from "@aplus-frontend/utils";
|
|
4
4
|
import { omit as E } from "lodash-unified";
|
|
@@ -7,12 +7,12 @@ import { globalConfigCached as s, ConfigProvider as L } from "../../config-provi
|
|
|
7
7
|
import { getContainerDom as C, getModalGlobalAppContext as M } from "./util.mjs";
|
|
8
8
|
const W = (t) => {
|
|
9
9
|
let n, r;
|
|
10
|
-
const
|
|
10
|
+
const i = (e) => e ? `${s.value.namespace}-ap-modal-${e}` : `${s.value.namespace}-ap-modal`, {
|
|
11
11
|
destroyOnClose: d = !0,
|
|
12
12
|
wrapperOffset: o = !1,
|
|
13
|
-
wrapperFullHeight:
|
|
13
|
+
wrapperFullHeight: c = !1
|
|
14
14
|
} = t;
|
|
15
|
-
function
|
|
15
|
+
function l() {
|
|
16
16
|
n && n(!1), setTimeout(() => {
|
|
17
17
|
m(null, a), a.parentElement?.removeChild(a);
|
|
18
18
|
}, 500);
|
|
@@ -20,7 +20,7 @@ const W = (t) => {
|
|
|
20
20
|
function g() {
|
|
21
21
|
n && n(!0);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function f() {
|
|
24
24
|
n && n(!1);
|
|
25
25
|
}
|
|
26
26
|
function v(e) {
|
|
@@ -49,7 +49,7 @@ const W = (t) => {
|
|
|
49
49
|
const e = this.props?.content?.component?.exposed ?? void 0;
|
|
50
50
|
await this.props?.onCancel(e);
|
|
51
51
|
}
|
|
52
|
-
d ?
|
|
52
|
+
d ? l() : f();
|
|
53
53
|
},
|
|
54
54
|
async handleOk() {
|
|
55
55
|
try {
|
|
@@ -61,7 +61,7 @@ const W = (t) => {
|
|
|
61
61
|
}
|
|
62
62
|
r({
|
|
63
63
|
confirmLoading: !1
|
|
64
|
-
}), d ?
|
|
64
|
+
}), d ? l() : f();
|
|
65
65
|
} catch {
|
|
66
66
|
r({
|
|
67
67
|
confirmLoading: !1
|
|
@@ -77,11 +77,11 @@ const W = (t) => {
|
|
|
77
77
|
},
|
|
78
78
|
render() {
|
|
79
79
|
const e = E(this.props, ["onCancel", "onOk", "open", "onUpdate:open", "getContainer", "icon", "footer"]);
|
|
80
|
-
return
|
|
81
|
-
default: () => [
|
|
80
|
+
return p(L, s.value, {
|
|
81
|
+
default: () => [p($, k({
|
|
82
82
|
class: {
|
|
83
|
-
[
|
|
84
|
-
[
|
|
83
|
+
[i()]: !0,
|
|
84
|
+
[i("wrapper")]: o
|
|
85
85
|
},
|
|
86
86
|
centered: !0
|
|
87
87
|
}, e, {
|
|
@@ -90,29 +90,32 @@ const W = (t) => {
|
|
|
90
90
|
onOk: this.handleOk,
|
|
91
91
|
footer: this?.handleFooter
|
|
92
92
|
}), {
|
|
93
|
-
default: () => [
|
|
93
|
+
default: () => [p("div", {
|
|
94
94
|
class: {
|
|
95
|
-
[
|
|
95
|
+
[i("body-wrapper")]: o
|
|
96
96
|
},
|
|
97
97
|
style: {
|
|
98
98
|
maxHeight: o !== !1 ? `calc(100vh - ${(o === !0 ? 100 : h(o) ? Number(o) : 100) * 2}px)` : void 0,
|
|
99
|
-
height:
|
|
100
|
-
overflowY: o !== !1 ||
|
|
99
|
+
height: c === !0 ? `calc(100vh - ${(o === !0 ? 100 : h(o) ? Number(o) : 100) * 2}px)` : void 0,
|
|
100
|
+
overflowY: o !== !1 || c === !0 ? "auto" : void 0
|
|
101
|
+
}
|
|
102
|
+
}, [p("div", {
|
|
103
|
+
class: i("body-wrapper-content"),
|
|
104
|
+
style: {
|
|
105
|
+
height: c === !0 ? "100%" : void 0
|
|
101
106
|
}
|
|
102
|
-
}, [i("div", {
|
|
103
|
-
class: p("body-wrapper-content")
|
|
104
107
|
}, [this.props?.content])])]
|
|
105
108
|
})]
|
|
106
109
|
});
|
|
107
110
|
}
|
|
108
111
|
}), y = C(s?.value?.getPopupContainer), w = C(t.getContainer), O = y || w || F().document.body, a = document.createElement("div");
|
|
109
112
|
O.appendChild(a);
|
|
110
|
-
const
|
|
111
|
-
return
|
|
112
|
-
destroy:
|
|
113
|
+
const u = N(x), b = M();
|
|
114
|
+
return u.appContext = t.appContext || b || u.appContext, m(u, a), {
|
|
115
|
+
destroy: l,
|
|
113
116
|
update: v,
|
|
114
117
|
open: g,
|
|
115
|
-
close:
|
|
118
|
+
close: f
|
|
116
119
|
};
|
|
117
120
|
};
|
|
118
121
|
export {
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { wait as
|
|
3
|
-
import { useElementSize as T, useRafFn as
|
|
1
|
+
import { defineComponent as pe, ref as me, reactive as ye, computed as f, unref as a, watchEffect as M, watch as de, createElementBlock as ve, openBlock as z, withModifiers as A, normalizeStyle as L, normalizeClass as w, createElementVNode as k, renderSlot as xe, createBlock as O, createCommentVNode as H, mergeProps as I } from "vue";
|
|
2
|
+
import { wait as W } from "@aplus-frontend/utils";
|
|
3
|
+
import { useElementSize as T, useRafFn as ge } from "@vueuse/core";
|
|
4
4
|
import { isString as j } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
6
|
import "../scroll-bar/index.mjs";
|
|
7
7
|
import { ensureRangeValue as n, getScrollable as R } from "../scroll-bar/utils/index.mjs";
|
|
8
8
|
import "../utils/index.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
9
|
+
import { useDevWarning as we } from "../utils/warning.mjs";
|
|
10
|
+
import { useScrollBack as Be } from "./hooks/use-scroll-back.mjs";
|
|
11
|
+
import { useScrollSmooth as Se } from "./hooks/use-scroll-smooth.mjs";
|
|
12
|
+
import be from "./hooks/use-scroll-wrapper.mjs";
|
|
13
|
+
import Pe from "./style/index.mjs";
|
|
14
|
+
import { getElementScrollOffset as ze } from "./utils/index.mjs";
|
|
15
|
+
import { useNamespace as ke } from "../config-provider/hooks/use-namespace.mjs";
|
|
16
|
+
import { isDef as u } from "../utils/is.mjs";
|
|
16
17
|
import F from "../scroll-bar/internal.vue.mjs";
|
|
17
|
-
const
|
|
18
|
+
const Te = /* @__PURE__ */ pe({
|
|
18
19
|
name: "ScrollView",
|
|
19
20
|
__name: "index",
|
|
20
21
|
props: {
|
|
21
22
|
width: {},
|
|
22
23
|
heigth: {},
|
|
24
|
+
height: {},
|
|
23
25
|
showXBar: { type: Boolean, default: !0 },
|
|
24
26
|
showYBar: { type: Boolean, default: !0 },
|
|
25
27
|
autoPlay: { type: [Boolean, Object] },
|
|
@@ -27,83 +29,85 @@ const Le = /* @__PURE__ */ ue({
|
|
|
27
29
|
yBarProps: { default: () => ({}) },
|
|
28
30
|
onWheel: {}
|
|
29
31
|
},
|
|
30
|
-
setup(
|
|
31
|
-
const o =
|
|
32
|
+
setup(q, { expose: G }) {
|
|
33
|
+
const o = q, { deprecated: J } = we("ScrollView");
|
|
34
|
+
J(o.heigth === void 0, "heigth", "height");
|
|
35
|
+
const K = {
|
|
32
36
|
direction: "vertical",
|
|
33
37
|
rate: 1,
|
|
34
38
|
repeat: !0
|
|
35
|
-
}, { b:
|
|
39
|
+
}, { b: Q, e: B, em: N } = ke("scroll-view"), U = Pe("scroll-view"), h = me(), c = ye({ x: 30, y: 30 });
|
|
36
40
|
let S = !1;
|
|
37
41
|
const {
|
|
38
42
|
scrollOffset: r,
|
|
39
43
|
maxScrollDistance: i,
|
|
40
|
-
xBarRef:
|
|
41
|
-
yBarRef:
|
|
44
|
+
xBarRef: Z,
|
|
45
|
+
yBarRef: ee,
|
|
42
46
|
containerRef: s,
|
|
43
|
-
scrollYBar:
|
|
44
|
-
scrollXBar:
|
|
45
|
-
updateMaxScrollDistance:
|
|
46
|
-
} =
|
|
47
|
+
scrollYBar: p,
|
|
48
|
+
scrollXBar: m,
|
|
49
|
+
updateMaxScrollDistance: te
|
|
50
|
+
} = be(), { width: re, height: oe } = T(h), { width: ae, height: le } = T(s), { start: V } = Be({
|
|
47
51
|
scrollOffset: r,
|
|
48
52
|
maxScrollDistance: i,
|
|
49
53
|
onScroll: (e) => {
|
|
50
|
-
e === "horizontal" ?
|
|
54
|
+
e === "horizontal" ? m() : p();
|
|
51
55
|
},
|
|
52
56
|
async onScrollEnd() {
|
|
53
|
-
await
|
|
57
|
+
await W(200), b();
|
|
54
58
|
}
|
|
55
|
-
}), { start: $ } =
|
|
59
|
+
}), { start: $ } = Se({
|
|
56
60
|
scrollOffset: r,
|
|
57
61
|
maxScrollDistance: i,
|
|
58
62
|
onScroll(e, t) {
|
|
59
|
-
|
|
63
|
+
E.value && (y(), S = !0), e && m(), t && p();
|
|
60
64
|
},
|
|
61
65
|
async onScrollEnd() {
|
|
62
|
-
S && (await
|
|
66
|
+
S && (await W(200), b(), S = !1);
|
|
63
67
|
}
|
|
64
|
-
}), { resume:
|
|
68
|
+
}), { resume: b, pause: y, isActive: E } = ge(
|
|
65
69
|
() => {
|
|
66
70
|
if (!o.autoPlay) {
|
|
67
71
|
y();
|
|
68
72
|
return;
|
|
69
73
|
}
|
|
70
74
|
const e = o.autoPlay === !0 ? {} : o.autoPlay, t = {
|
|
71
|
-
...
|
|
75
|
+
...K,
|
|
72
76
|
...e
|
|
73
77
|
};
|
|
74
78
|
if (t.direction === "horizontal") {
|
|
75
79
|
if (r.x === i.x) {
|
|
76
|
-
y(), t.repeat &&
|
|
80
|
+
y(), t.repeat && V("horizontal");
|
|
77
81
|
return;
|
|
78
82
|
}
|
|
79
83
|
r.x = n(
|
|
80
84
|
r.x + t.rate,
|
|
81
85
|
0,
|
|
82
86
|
i.x
|
|
83
|
-
),
|
|
87
|
+
), m();
|
|
84
88
|
} else {
|
|
85
89
|
if (r.y === i.y) {
|
|
86
|
-
y(), t.repeat &&
|
|
90
|
+
y(), t.repeat && V("vertical");
|
|
87
91
|
return;
|
|
88
92
|
}
|
|
89
93
|
r.y = n(
|
|
90
94
|
r.y + t.rate,
|
|
91
95
|
0,
|
|
92
96
|
i.y
|
|
93
|
-
),
|
|
97
|
+
), p();
|
|
94
98
|
}
|
|
95
99
|
},
|
|
96
100
|
{ immediate: !0 }
|
|
97
|
-
),
|
|
98
|
-
width:
|
|
99
|
-
height:
|
|
101
|
+
), d = f(() => o.showXBar && c.x !== 100), g = f(() => o.showYBar && c.y !== 100), v = f(() => o.heigth ?? o.height), ie = f(() => ({
|
|
102
|
+
width: u(o.width) ? j(o.width) ? o.width : Number.isNaN(o.width) ? void 0 : `${o.width}px` : void 0,
|
|
103
|
+
height: u(v.value) ? j(v.value) ? v.value : Number.isNaN(v.value) ? void 0 : `${v.value}px` : void 0,
|
|
100
104
|
padding: `${o.xBarProps.trackWidth || 10}px ${o.yBarProps.trackWidth || 10}px`
|
|
101
105
|
}));
|
|
102
|
-
async function
|
|
103
|
-
|
|
106
|
+
async function P() {
|
|
107
|
+
E.value && (y(), await W(500), b());
|
|
104
108
|
}
|
|
105
|
-
async function
|
|
106
|
-
if (a(
|
|
109
|
+
async function ne(e) {
|
|
110
|
+
if (a(g))
|
|
107
111
|
e.preventDefault(), e.stopPropagation();
|
|
108
112
|
else
|
|
109
113
|
return;
|
|
@@ -111,10 +115,10 @@ const Le = /* @__PURE__ */ ue({
|
|
|
111
115
|
r.y + e.deltaY,
|
|
112
116
|
0,
|
|
113
117
|
i.y
|
|
114
|
-
),
|
|
118
|
+
), p(), o.onWheel?.("vertical", r.y), P();
|
|
115
119
|
}
|
|
116
|
-
function
|
|
117
|
-
if (a(
|
|
120
|
+
function se(e) {
|
|
121
|
+
if (a(d))
|
|
118
122
|
e.preventDefault(), e.stopPropagation();
|
|
119
123
|
else
|
|
120
124
|
return;
|
|
@@ -122,9 +126,9 @@ const Le = /* @__PURE__ */ ue({
|
|
|
122
126
|
r.x + e.deltaX,
|
|
123
127
|
0,
|
|
124
128
|
i.x
|
|
125
|
-
),
|
|
129
|
+
), m(), o.onWheel?.("horizontal", r.x), P();
|
|
126
130
|
}
|
|
127
|
-
function
|
|
131
|
+
function D() {
|
|
128
132
|
if (o.showYBar) {
|
|
129
133
|
const { visibleSize: e, totalSize: t } = R(
|
|
130
134
|
s.value,
|
|
@@ -145,109 +149,109 @@ const Le = /* @__PURE__ */ ue({
|
|
|
145
149
|
}
|
|
146
150
|
}
|
|
147
151
|
function X(e, t) {
|
|
148
|
-
const l = a(s),
|
|
149
|
-
if (!l || !
|
|
150
|
-
const { visibleSize: C, totalSize:
|
|
151
|
-
if (
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
r.y =
|
|
152
|
+
const l = a(s), x = a(h);
|
|
153
|
+
if (!l || !x) return;
|
|
154
|
+
const { visibleSize: C, totalSize: Y } = R(l, t);
|
|
155
|
+
if (Y <= C) return;
|
|
156
|
+
const _ = (Y - C) * e / 100, he = t === "vertical";
|
|
157
|
+
if (P(), he) {
|
|
158
|
+
r.y = _;
|
|
155
159
|
return;
|
|
156
160
|
}
|
|
157
|
-
r.x =
|
|
161
|
+
r.x = _;
|
|
158
162
|
}
|
|
159
|
-
|
|
163
|
+
M(
|
|
160
164
|
() => {
|
|
161
|
-
a(s.value) &&
|
|
165
|
+
a(s.value) && D();
|
|
162
166
|
},
|
|
163
167
|
{ flush: "post" }
|
|
164
|
-
),
|
|
168
|
+
), de(
|
|
165
169
|
() => [
|
|
166
|
-
ee.value,
|
|
167
|
-
te.value,
|
|
168
170
|
re.value,
|
|
169
|
-
oe.value
|
|
171
|
+
oe.value,
|
|
172
|
+
ae.value,
|
|
173
|
+
le.value
|
|
170
174
|
],
|
|
171
175
|
() => {
|
|
172
|
-
|
|
176
|
+
D(), te();
|
|
173
177
|
}
|
|
174
|
-
),
|
|
175
|
-
|
|
178
|
+
), M(() => {
|
|
179
|
+
h.value && (h.value.style.transform = `translate3d(-${r.x}px, -${r.y}px, 0px)`);
|
|
176
180
|
});
|
|
177
|
-
function
|
|
178
|
-
|
|
181
|
+
function ce(e, t) {
|
|
182
|
+
u(e) && d.value && (r.x = n(e, 0, i.x), m()), u(t) && g.value && (r.y = n(t, 0, i.y), p());
|
|
179
183
|
}
|
|
180
|
-
function
|
|
181
|
-
e ? $({ x: t, y: l }) : (
|
|
184
|
+
function fe({ smooth: e, left: t, top: l }) {
|
|
185
|
+
e ? $({ x: t, y: l }) : (u(t) && (r.x = t), u(l) && (r.y = l));
|
|
182
186
|
}
|
|
183
|
-
function
|
|
184
|
-
const l =
|
|
187
|
+
function ue(e, t = "start") {
|
|
188
|
+
const l = ze(
|
|
185
189
|
s.value,
|
|
186
190
|
e,
|
|
187
191
|
t
|
|
188
|
-
),
|
|
189
|
-
|
|
192
|
+
), x = {};
|
|
193
|
+
d.value && (x.x = n(
|
|
190
194
|
r.x + l.x,
|
|
191
195
|
0,
|
|
192
196
|
i.x
|
|
193
|
-
)),
|
|
197
|
+
)), g.value && (x.y = n(
|
|
194
198
|
r.y + l.y,
|
|
195
199
|
0,
|
|
196
200
|
i.y
|
|
197
|
-
)), $(
|
|
201
|
+
)), $(x);
|
|
198
202
|
}
|
|
199
|
-
return
|
|
200
|
-
scrollTop:
|
|
201
|
-
scrollLeft:
|
|
202
|
-
scroll:
|
|
203
|
-
scrollTo:
|
|
204
|
-
scrollIntoView:
|
|
205
|
-
}), (e, t) => (
|
|
203
|
+
return G({
|
|
204
|
+
scrollTop: f(() => r.y),
|
|
205
|
+
scrollLeft: f(() => r.x),
|
|
206
|
+
scroll: ce,
|
|
207
|
+
scrollTo: fe,
|
|
208
|
+
scrollIntoView: ue
|
|
209
|
+
}), (e, t) => (z(), ve("div", {
|
|
206
210
|
ref_key: "containerRef",
|
|
207
211
|
ref: s,
|
|
208
|
-
class: w([a(
|
|
209
|
-
style:
|
|
212
|
+
class: w([a(Q)(), a(U)]),
|
|
213
|
+
style: L(ie.value),
|
|
210
214
|
onWheel: [
|
|
211
|
-
|
|
212
|
-
|
|
215
|
+
A(ne, ["exact"]),
|
|
216
|
+
A(se, ["shift"])
|
|
213
217
|
]
|
|
214
218
|
}, [
|
|
215
|
-
|
|
219
|
+
k("div", {
|
|
216
220
|
ref_key: "contentRef",
|
|
217
|
-
ref:
|
|
221
|
+
ref: h,
|
|
218
222
|
class: w(a(B)("content"))
|
|
219
223
|
}, [
|
|
220
|
-
|
|
224
|
+
xe(e.$slots, "default")
|
|
221
225
|
], 2),
|
|
222
|
-
|
|
223
|
-
class: w([a(B)("bar-wrapper"), a(
|
|
224
|
-
style:
|
|
226
|
+
k("div", {
|
|
227
|
+
class: w([a(B)("bar-wrapper"), a(N)("bar-wrapper", "vertical")]),
|
|
228
|
+
style: L(`height: calc(100% - ${d.value ? e.xBarProps.trackWidth || 10 : 0}px)`)
|
|
225
229
|
}, [
|
|
226
|
-
|
|
230
|
+
g.value ? (z(), O(a(F), I({
|
|
227
231
|
key: 0,
|
|
228
232
|
ref_key: "yBarRef",
|
|
229
|
-
ref:
|
|
233
|
+
ref: ee
|
|
230
234
|
}, e.yBarProps, {
|
|
231
235
|
"bar-length": c.y,
|
|
232
236
|
onScroll: t[0] || (t[0] = (l) => X(l, "vertical"))
|
|
233
|
-
}), null, 16, ["bar-length"])) :
|
|
237
|
+
}), null, 16, ["bar-length"])) : H("", !0)
|
|
234
238
|
], 6),
|
|
235
|
-
|
|
236
|
-
class: w([a(B)("bar-wrapper"), a(
|
|
239
|
+
k("div", {
|
|
240
|
+
class: w([a(B)("bar-wrapper"), a(N)("bar-wrapper", "horizontal")])
|
|
237
241
|
}, [
|
|
238
|
-
|
|
242
|
+
d.value ? (z(), O(a(F), I({
|
|
239
243
|
key: 0,
|
|
240
244
|
ref_key: "xBarRef",
|
|
241
|
-
ref:
|
|
245
|
+
ref: Z
|
|
242
246
|
}, e.xBarProps, {
|
|
243
247
|
direction: "horizontal",
|
|
244
248
|
"bar-length": c.x,
|
|
245
249
|
onScroll: t[1] || (t[1] = (l) => X(l, "horizontal"))
|
|
246
|
-
}), null, 16, ["bar-length"])) :
|
|
250
|
+
}), null, 16, ["bar-length"])) : H("", !0)
|
|
247
251
|
], 2)
|
|
248
252
|
], 38));
|
|
249
253
|
}
|
|
250
254
|
});
|
|
251
255
|
export {
|
|
252
|
-
|
|
256
|
+
Te as default
|
|
253
257
|
};
|
package/es/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.15.
|
|
1
|
+
declare const _default: "7.15.6";
|
|
2
2
|
export default _default;
|
package/es/src/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),w=require("@aplus-frontend/antdv"),C=require("@aplus-frontend/utils"),N=require("lodash-unified"),P=require("../../utils/index.js"),s=require("../../config-provider/config-provider.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),w=require("@aplus-frontend/antdv"),C=require("@aplus-frontend/utils"),N=require("lodash-unified"),P=require("../../utils/index.js"),s=require("../../config-provider/config-provider.js"),h=require("./util.js"),q=t=>{let r,a;const d=e=>e?`${s.globalConfigCached.value.namespace}-ap-modal-${e}`:`${s.globalConfigCached.value.namespace}-ap-modal`,{destroyOnClose:c=!0,wrapperOffset:n=!1,wrapperFullHeight:l=!1}=t;function p(){r&&r(!1),setTimeout(()=>{o.render(null,i),i.parentElement?.removeChild(i)},500)}function g(){r&&r(!0)}function u(){r&&r(!1)}function m(e){a&&a(e)}const v=o.defineComponent({data(){return{open:c,props:t}},created(){r=e=>{this.open=e},a=e=>{this.props={...this.props,...e}}},methods:{async handleCancel(){if(this.props?.onCancel){const e=this.props?.content?.component?.exposed??void 0;await this.props?.onCancel(e)}c?p():u()},async handleOk(){try{if(a({confirmLoading:!0}),this.props?.onOk){const e=this.props?.content?.component?.exposed??void 0;await this.props.onOk(e)}a({confirmLoading:!1}),c?p():u()}catch{a({confirmLoading:!1})}},handleFooter(e){return t?.footer!==void 0?typeof t.footer=="function"?t.footer({...e,contentExposed:this.props?.content?.component?.exposed??void 0}):t.footer:e?.originNode}},render(){const e=N.omit(this.props,["onCancel","onOk","open","onUpdate:open","getContainer","icon","footer"]);return o.createVNode(s.ConfigProvider,s.globalConfigCached.value,{default:()=>[o.createVNode(w.Modal,o.mergeProps({class:{[d()]:!0,[d("wrapper")]:n},centered:!0},e,{open:this.open,onCancel:this.handleCancel,onOk:this.handleOk,footer:this?.handleFooter}),{default:()=>[o.createVNode("div",{class:{[d("body-wrapper")]:n},style:{maxHeight:n!==!1?`calc(100vh - ${(n===!0?100:C.isNumeric(n)?Number(n):100)*2}px)`:void 0,height:l===!0?`calc(100vh - ${(n===!0?100:C.isNumeric(n)?Number(n):100)*2}px)`:void 0,overflowY:n!==!1||l===!0?"auto":void 0}},[o.createVNode("div",{class:d("body-wrapper-content"),style:{height:l===!0?"100%":void 0}},[this.props?.content])])]})]})}}),x=h.getContainerDom(s.globalConfigCached?.value?.getPopupContainer),b=h.getContainerDom(t.getContainer),y=x||b||P.getTopWindow().document.body,i=document.createElement("div");y.appendChild(i);const f=o.h(v),O=h.getModalGlobalAppContext();return f.appContext=t.appContext||O||f.appContext,o.render(f,i),{destroy:p,update:m,open:g,close:u}};exports.createModal=q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),b=require("@aplus-frontend/utils"),z=require("@vueuse/core"),E=require("lodash-unified");require("../config-provider/index.js");require("../scroll-bar/index.js");const l=require("../scroll-bar/utils/index.js");require("../utils/index.js");const re=require("../utils/warning.js"),ae=require("./hooks/use-scroll-back.js"),ne=require("./hooks/use-scroll-smooth.js"),oe=require("./hooks/use-scroll-wrapper.js"),le=require("./style/index.js"),ie=require("./utils/index.js"),se=require("../config-provider/hooks/use-namespace.js"),c=require("../utils/is.js"),$=require("../scroll-bar/internal.vue.js"),ue=e.defineComponent({name:"ScrollView",__name:"index",props:{width:{},heigth:{},height:{},showXBar:{type:Boolean,default:!0},showYBar:{type:Boolean,default:!0},autoPlay:{type:[Boolean,Object]},xBarProps:{default:()=>({})},yBarProps:{default:()=>({})},onWheel:{}},setup(C,{expose:M}){const n=C,{deprecated:X}=re.useDevWarning("ScrollView");X(n.heigth===void 0,"heigth","height");const Y={direction:"vertical",rate:1,repeat:!0},{b:O,e:x,em:P}=se.useNamespace("scroll-view"),A=le.default("scroll-view"),f=e.ref(),u=e.reactive({x:30,y:30});let S=!1;const{scrollOffset:a,maxScrollDistance:i,xBarRef:L,yBarRef:T,containerRef:s,scrollYBar:d,scrollXBar:h,updateMaxScrollDistance:j}=oe.default(),{width:H,height:I}=z.useElementSize(f),{width:F,height:U}=z.useElementSize(s),{start:V}=ae.useScrollBack({scrollOffset:a,maxScrollDistance:i,onScroll:t=>{t==="horizontal"?h():d()},async onScrollEnd(){await b.wait(200),w()}}),{start:R}=ne.useScrollSmooth({scrollOffset:a,maxScrollDistance:i,onScroll(t,r){k.value&&(p(),S=!0),t&&h(),r&&d()},async onScrollEnd(){S&&(await b.wait(200),w(),S=!1)}}),{resume:w,pause:p,isActive:k}=z.useRafFn(()=>{if(!n.autoPlay){p();return}const t=n.autoPlay===!0?{}:n.autoPlay,r={...Y,...t};if(r.direction==="horizontal"){if(a.x===i.x){p(),r.repeat&&V("horizontal");return}a.x=l.ensureRangeValue(a.x+r.rate,0,i.x),h()}else{if(a.y===i.y){p(),r.repeat&&V("vertical");return}a.y=l.ensureRangeValue(a.y+r.rate,0,i.y),d()}},{immediate:!0}),y=e.computed(()=>n.showXBar&&u.x!==100),m=e.computed(()=>n.showYBar&&u.y!==100),v=e.computed(()=>n.heigth??n.height),G=e.computed(()=>({width:c.isDef(n.width)?E.isString(n.width)?n.width:Number.isNaN(n.width)?void 0:`${n.width}px`:void 0,height:c.isDef(v.value)?E.isString(v.value)?v.value:Number.isNaN(v.value)?void 0:`${v.value}px`:void 0,padding:`${n.xBarProps.trackWidth||10}px ${n.yBarProps.trackWidth||10}px`}));async function B(){k.value&&(p(),await b.wait(500),w())}async function J(t){if(e.unref(m))t.preventDefault(),t.stopPropagation();else return;a.y=l.ensureRangeValue(a.y+t.deltaY,0,i.y),d(),n.onWheel?.("vertical",a.y),B()}function K(t){if(e.unref(y))t.preventDefault(),t.stopPropagation();else return;a.x=l.ensureRangeValue(a.x+t.deltaX,0,i.x),h(),n.onWheel?.("horizontal",a.x),B()}function q(){if(n.showYBar){const{visibleSize:t,totalSize:r}=l.getScrollable(s.value,"vertical");u.y=l.ensureRangeValue(Math.min(t/(r||1)*100))}if(n.showXBar){const{visibleSize:t,totalSize:r}=l.getScrollable(s.value,"horizontal");u.x=l.ensureRangeValue(Math.min(t/(r||1)*100))}}function N(t,r){const o=e.unref(s),g=e.unref(f);if(!o||!g)return;const{visibleSize:W,totalSize:_}=l.getScrollable(o,r);if(_<=W)return;const D=(_-W)*t/100,te=r==="vertical";if(B(),te){a.y=D;return}a.x=D}e.watchEffect(()=>{e.unref(s.value)&&q()},{flush:"post"}),e.watch(()=>[H.value,I.value,F.value,U.value],()=>{q(),j()}),e.watchEffect(()=>{f.value&&(f.value.style.transform=`translate3d(-${a.x}px, -${a.y}px, 0px)`)});function Q(t,r){c.isDef(t)&&y.value&&(a.x=l.ensureRangeValue(t,0,i.x),h()),c.isDef(r)&&m.value&&(a.y=l.ensureRangeValue(r,0,i.y),d())}function Z({smooth:t,left:r,top:o}){t?R({x:r,y:o}):(c.isDef(r)&&(a.x=r),c.isDef(o)&&(a.y=o))}function ee(t,r="start"){const o=ie.getElementScrollOffset(s.value,t,r),g={};y.value&&(g.x=l.ensureRangeValue(a.x+o.x,0,i.x)),m.value&&(g.y=l.ensureRangeValue(a.y+o.y,0,i.y)),R(g)}return M({scrollTop:e.computed(()=>a.y),scrollLeft:e.computed(()=>a.x),scroll:Q,scrollTo:Z,scrollIntoView:ee}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"containerRef",ref:s,class:e.normalizeClass([e.unref(O)(),e.unref(A)]),style:e.normalizeStyle(G.value),onWheel:[e.withModifiers(J,["exact"]),e.withModifiers(K,["shift"])]},[e.createElementVNode("div",{ref_key:"contentRef",ref:f,class:e.normalizeClass(e.unref(x)("content"))},[e.renderSlot(t.$slots,"default")],2),e.createElementVNode("div",{class:e.normalizeClass([e.unref(x)("bar-wrapper"),e.unref(P)("bar-wrapper","vertical")]),style:e.normalizeStyle(`height: calc(100% - ${y.value?t.xBarProps.trackWidth||10:0}px)`)},[m.value?(e.openBlock(),e.createBlock(e.unref($.default),e.mergeProps({key:0,ref_key:"yBarRef",ref:T},t.yBarProps,{"bar-length":u.y,onScroll:r[0]||(r[0]=o=>N(o,"vertical"))}),null,16,["bar-length"])):e.createCommentVNode("",!0)],6),e.createElementVNode("div",{class:e.normalizeClass([e.unref(x)("bar-wrapper"),e.unref(P)("bar-wrapper","horizontal")])},[y.value?(e.openBlock(),e.createBlock(e.unref($.default),e.mergeProps({key:0,ref_key:"xBarRef",ref:L},t.xBarProps,{direction:"horizontal","bar-length":u.x,onScroll:r[1]||(r[1]=o=>N(o,"horizontal"))}),null,16,["bar-length"])):e.createCommentVNode("",!0)],2)],38))}});exports.default=ue;
|
package/lib/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.15.
|
|
1
|
+
declare const _default: "7.15.6";
|
|
2
2
|
export default _default;
|
package/lib/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.15.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.15.6";exports.default=e;
|