@soei/flyweight 0.3.13 → 0.4.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/Flyweight.cjs +1 -1
- package/Flyweight.js +203 -176
- package/README.md +62 -10
- package/package.json +1 -1
- package/style.css +1 -1
- package/vue2/index.cjs +1 -1
- package/vue2/index.js +154 -134
- package/vue2/style.css +1 -1
package/Flyweight.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { runer as
|
|
2
|
-
import { openBlock as N, createElementBlock as
|
|
3
|
-
import { runer as
|
|
4
|
-
import
|
|
5
|
-
let
|
|
1
|
+
import { runer as v, merge as W, isArray as at, each as P, picker as R, isEmpty as ut, isSimplyType as Q, isString as St } from "@soei/util";
|
|
2
|
+
import { openBlock as N, createElementBlock as E, normalizeClass as ct, normalizeStyle as O, createElementVNode as M, Fragment as dt, renderList as ft, renderSlot as d, mergeProps as I, createCommentVNode as pt, createTextVNode as gt, toDisplayString as G, normalizeProps as $t, guardReactiveProps as zt, createBlock as Nt, resolveDynamicComponent as kt, withCtx as Tt } from "vue";
|
|
3
|
+
import { runer as g, isNil as Mt, each as Z } from "@soei/tools";
|
|
4
|
+
import Et from "@soei/picker";
|
|
5
|
+
let Ht = /(\d+|[+\-\*/]|%)/g, tt = {
|
|
6
6
|
"+": (t, e) => t + e,
|
|
7
7
|
"-": (t, e) => t - e,
|
|
8
8
|
"*": (t, e) => t * e,
|
|
@@ -10,11 +10,11 @@ let Mt = /(\d+|[+\-\*/]|%)/g, tt = {
|
|
|
10
10
|
"%": (t, e, i) => parseFloat(t) / 100 * i
|
|
11
11
|
}, et = (t, e) => {
|
|
12
12
|
let i;
|
|
13
|
-
if (i =
|
|
14
|
-
let r = i.length,
|
|
13
|
+
if (i = v("match", t, Ht)) {
|
|
14
|
+
let r = i.length, l, n = 0, s, h = [];
|
|
15
15
|
for (; r--; )
|
|
16
|
-
|
|
17
|
-
+
|
|
16
|
+
n = i.shift(), n in tt ? (l && h.push(l), n === "%" && (h.length = 2), s = n) : +n && h.push(+n), h.length == 2 && (h.push(e), l = tt[s].apply(null, h), h.length = 0);
|
|
17
|
+
+l || (l = +h.pop()), t = l >> 0;
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
}, it = {}, b = (t, e) => (t + "").replace(
|
|
@@ -26,14 +26,14 @@ let Mt = /(\d+|[+\-\*/]|%)/g, tt = {
|
|
|
26
26
|
);
|
|
27
27
|
const j = (t, e) => {
|
|
28
28
|
const i = t.__vccOpts || t;
|
|
29
|
-
for (const [r,
|
|
30
|
-
i[r] =
|
|
29
|
+
for (const [r, l] of e)
|
|
30
|
+
i[r] = l;
|
|
31
31
|
return i;
|
|
32
32
|
};
|
|
33
|
-
let st = (t) => t == null || t == null,
|
|
33
|
+
let st = (t) => t == null || t == null, Ct = (...t) => {
|
|
34
34
|
console.info("::::FLYWEIGHT", ...t);
|
|
35
35
|
};
|
|
36
|
-
const
|
|
36
|
+
const Lt = {
|
|
37
37
|
name: "Flyweight",
|
|
38
38
|
props: {
|
|
39
39
|
flys: {
|
|
@@ -97,7 +97,7 @@ const Ht = {
|
|
|
97
97
|
},
|
|
98
98
|
style() {
|
|
99
99
|
var t = this.w, e = this.h, i = this.Size, r = {};
|
|
100
|
-
return
|
|
100
|
+
return W(r, {
|
|
101
101
|
"--width": b(this.realW),
|
|
102
102
|
"--height": b(this.realH),
|
|
103
103
|
"--flyweight-content": b(i)
|
|
@@ -156,16 +156,16 @@ const Ht = {
|
|
|
156
156
|
this.rebuild(), this.$emit("resize");
|
|
157
157
|
}).observe(this.flyweight);
|
|
158
158
|
} catch (t) {
|
|
159
|
-
|
|
159
|
+
Ct(t);
|
|
160
160
|
}
|
|
161
|
-
this.scrollx =
|
|
161
|
+
this.scrollx = v("hasAttribute", this.flyweight, "scroll-x"), this.BoxRule = /* this.scrollx ? 'clientHeight=>width,clientWidth=>height' : */
|
|
162
162
|
"clientHeight=>height,clientWidth=>width", this.direction = this.scrollx ? "scrollLeft" : "scrollTop";
|
|
163
163
|
},
|
|
164
164
|
methods: {
|
|
165
165
|
exec: b,
|
|
166
166
|
trigger(t, e) {
|
|
167
167
|
at(t) || (t = t && e ? [[t, e]] : []), t.length && this.lazyrun(() => {
|
|
168
|
-
|
|
168
|
+
P(t, (i, r) => {
|
|
169
169
|
this.$emit(r[0], st(r[1]) ? !0 : r[1]);
|
|
170
170
|
});
|
|
171
171
|
});
|
|
@@ -175,17 +175,17 @@ const Ht = {
|
|
|
175
175
|
return t && this.task.push(t), !0;
|
|
176
176
|
},
|
|
177
177
|
setview(t) {
|
|
178
|
-
|
|
178
|
+
v([this.cheackflys, (e) => {
|
|
179
179
|
e = e || {};
|
|
180
|
-
let i = e.index ||
|
|
181
|
-
if (n
|
|
180
|
+
let i = e.index || P(this.flys, (r, l, n, s) => {
|
|
181
|
+
if (l[n] == s)
|
|
182
182
|
return r;
|
|
183
183
|
}, e.picker, e.id);
|
|
184
184
|
st(i) || this.setindex(i);
|
|
185
185
|
}], this, t);
|
|
186
186
|
},
|
|
187
187
|
setindex(t) {
|
|
188
|
-
|
|
188
|
+
v([this.cheackflys, ({ index: e }) => {
|
|
189
189
|
this.selectIndex = e, this.$nextTick(() => {
|
|
190
190
|
let i = e / this.column >> 0, r = this.expand;
|
|
191
191
|
(this.flyweight[this.direction] / r >> 0) + this.row - i - 1 > 0 || (this.flyweight[this.direction] = i * r, this.scroll());
|
|
@@ -194,11 +194,11 @@ const Ht = {
|
|
|
194
194
|
},
|
|
195
195
|
lazyrun(t, e) {
|
|
196
196
|
clearTimeout(this.time), this.time = setTimeout(() => {
|
|
197
|
-
|
|
197
|
+
v(t);
|
|
198
198
|
}, e || this.lazy);
|
|
199
199
|
},
|
|
200
200
|
run(t) {
|
|
201
|
-
let e = [], i =
|
|
201
|
+
let e = [], i = v(this.direction, t.target), r = {
|
|
202
202
|
// ...this
|
|
203
203
|
offset: i,
|
|
204
204
|
top: i,
|
|
@@ -207,24 +207,24 @@ const Ht = {
|
|
|
207
207
|
/* 显示区域第一行的索引 */
|
|
208
208
|
index: i / this.expand >> 0
|
|
209
209
|
};
|
|
210
|
-
|
|
211
|
-
let
|
|
212
|
-
|
|
210
|
+
W(r, this.space), t.from || e.push(["onscroll", r]);
|
|
211
|
+
let l = !1;
|
|
212
|
+
P(
|
|
213
213
|
this.flyweights,
|
|
214
|
-
(
|
|
215
|
-
if (h =
|
|
216
|
-
(+(h < c % o) + (c / o >> 0)), a =
|
|
217
|
-
|
|
214
|
+
(n, s, h, o, u, c, f, p, a) => {
|
|
215
|
+
if (h = n / u >> 0, p = h + o * /* 偏移量, 如果超出顶部 + 1轮,排列到列队后, 否则保持在当前*/
|
|
216
|
+
(+(h < c % o) + (c / o >> 0)), a = p * u + n % u, a >= this.count) {
|
|
217
|
+
l || (e.push(["onend"]), l = !0);
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
|
-
s.index =
|
|
221
|
-
let
|
|
220
|
+
s.index = p, s.i = a, s.data = this.flys[a];
|
|
221
|
+
let x = [
|
|
222
222
|
/* top */
|
|
223
|
-
|
|
223
|
+
p * this.expand + s.x,
|
|
224
224
|
/* left */
|
|
225
225
|
s.space
|
|
226
226
|
];
|
|
227
|
-
|
|
227
|
+
f && x.reverse(), s.top = x[0], s.left = x[1];
|
|
228
228
|
},
|
|
229
229
|
null,
|
|
230
230
|
this.row,
|
|
@@ -242,63 +242,63 @@ const Ht = {
|
|
|
242
242
|
if (!t)
|
|
243
243
|
return e.length = t;
|
|
244
244
|
this.count = t;
|
|
245
|
-
let i = this.scrollx, r = this.flyweight,
|
|
245
|
+
let i = this.scrollx, r = this.flyweight, l = R(r, this.BoxRule);
|
|
246
246
|
this.$nextTick(() => {
|
|
247
|
-
let
|
|
248
|
-
i &&
|
|
249
|
-
let [a,
|
|
250
|
-
i ? (y = c, c -= s, _ = (
|
|
247
|
+
let n = /true/.test(this.auto), [s, h] = this.offset, o = l.width, u = l.height, c = (et(this.width, o) || o) + s, f = et(this.height, u) + h, p = [o / c >> 0 || 1, u / f >> 0 || 1];
|
|
248
|
+
i && p.reverse();
|
|
249
|
+
let [a, x] = p, S = this.padding, H, $ = 0, y, _;
|
|
250
|
+
i ? (y = c, c -= s, _ = (z) => (
|
|
251
251
|
/* 计算top偏移量 */
|
|
252
|
-
|
|
253
|
-
)) : (
|
|
254
|
-
let w = Math.min(t, a * this.row), m = w - 1,
|
|
252
|
+
z * (f - h) + (z + 1) * h
|
|
253
|
+
)) : (n ? (c = (o - s * (a + 2 * S - 1)) / a, H = !S * s, $ = S * s) : (H = 0, $ = (o % c + s * a) / (a + 1) >> 0, c -= s), _ = (z) => z * (c + H) + (z + 1) * $, y = f), this.row = x + 2, this.column = a, this.realH = f - h, this.realW = c, this.expand = y, this.Size = Math.ceil(t / a) * y;
|
|
254
|
+
let w = Math.min(t, a * this.row), m = w - 1, k;
|
|
255
255
|
for (; w-- > 0; )
|
|
256
|
-
|
|
256
|
+
k = m - w, this.$set(e, k, {
|
|
257
257
|
x: s,
|
|
258
258
|
y: h,
|
|
259
259
|
width: c,
|
|
260
|
-
height:
|
|
261
|
-
space: _(
|
|
260
|
+
height: f - h,
|
|
261
|
+
space: _(k % a),
|
|
262
262
|
data: {}
|
|
263
263
|
});
|
|
264
264
|
e.length = m + 1;
|
|
265
|
-
let
|
|
266
|
-
|
|
265
|
+
let T = [];
|
|
266
|
+
u / y > m / a && T.push(["onend"]), this.flyweight && (this.flyweight[this.direction] = 0), this.$nextTick(() => {
|
|
267
267
|
this.setindex(this.selectIndex || 0), this.scroll();
|
|
268
|
-
}),
|
|
268
|
+
}), T.push(["update:space", {
|
|
269
269
|
row: (m / a >> 0) + 1,
|
|
270
270
|
column: a,
|
|
271
271
|
showrow: this.row,
|
|
272
272
|
showcolumn: this.column
|
|
273
|
-
}]), this.trigger(
|
|
273
|
+
}]), this.trigger(T);
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
},
|
|
278
|
-
function
|
|
279
|
-
return N(),
|
|
277
|
+
}, Pt = { class: "flyweight-all" };
|
|
278
|
+
function Rt(t, e, i, r, l, n) {
|
|
279
|
+
return N(), E("div", {
|
|
280
280
|
ref: "flyweight",
|
|
281
281
|
class: ct(["flyweight", {
|
|
282
|
-
"flyweight-active":
|
|
282
|
+
"flyweight-active": l.actice
|
|
283
283
|
}]),
|
|
284
|
-
style:
|
|
285
|
-
onScroll: e[0] || (e[0] = (...s) =>
|
|
284
|
+
style: O(n.style),
|
|
285
|
+
onScroll: e[0] || (e[0] = (...s) => n.scroll && n.scroll(...s))
|
|
286
286
|
}, [
|
|
287
|
-
|
|
288
|
-
(N(!0),
|
|
287
|
+
M("div", Pt, [
|
|
288
|
+
(N(!0), E(dt, null, ft(l.flyweights, (s, h) => (N(), E("div", {
|
|
289
289
|
key: h,
|
|
290
|
-
style:
|
|
290
|
+
style: O({
|
|
291
291
|
top: s.top + "px",
|
|
292
292
|
left: s.left + "px"
|
|
293
293
|
})
|
|
294
294
|
}, [
|
|
295
|
-
|
|
295
|
+
d(t.$slots, "default", I({ ref_for: !0 }, s), void 0, !0)
|
|
296
296
|
], 4))), 128))
|
|
297
297
|
]),
|
|
298
|
-
|
|
298
|
+
l.flyweights.length ? d(t.$slots, "end", { key: 0 }, void 0, !0) : pt("", !0)
|
|
299
299
|
], 38);
|
|
300
300
|
}
|
|
301
|
-
const Wt = /* @__PURE__ */ j(
|
|
301
|
+
const Wt = /* @__PURE__ */ j(Lt, [["render", Rt], ["__scopeId", "data-v-35b94e9b"]]);
|
|
302
302
|
function U(t, e) {
|
|
303
303
|
return e && (t = t.replace(/[a-z]/g, "")), t.toLowerCase();
|
|
304
304
|
}
|
|
@@ -325,7 +325,7 @@ let yt = {
|
|
|
325
325
|
"Bottom",
|
|
326
326
|
"Left"
|
|
327
327
|
], mt = {};
|
|
328
|
-
|
|
328
|
+
P(
|
|
329
329
|
Bt,
|
|
330
330
|
(t, e, i) => {
|
|
331
331
|
t = U(e), mt["--" + U(e, !0)] = t, i[t] = function() {
|
|
@@ -334,7 +334,7 @@ C(
|
|
|
334
334
|
},
|
|
335
335
|
yt
|
|
336
336
|
);
|
|
337
|
-
const
|
|
337
|
+
const At = {
|
|
338
338
|
name: "Card",
|
|
339
339
|
// inheritAttrs: false,
|
|
340
340
|
props: {
|
|
@@ -391,16 +391,24 @@ const Rt = {
|
|
|
391
391
|
computed: {
|
|
392
392
|
style() {
|
|
393
393
|
return this.tr();
|
|
394
|
+
},
|
|
395
|
+
sub() {
|
|
396
|
+
return this.show || this.title;
|
|
397
|
+
},
|
|
398
|
+
tips() {
|
|
399
|
+
return v("tips", this.close || {}) || "关闭[" + this.sub + "]";
|
|
394
400
|
}
|
|
395
401
|
},
|
|
396
402
|
watch: yt,
|
|
397
403
|
methods: {
|
|
398
404
|
exec: b,
|
|
399
|
-
isEmpty:
|
|
405
|
+
isEmpty: ut,
|
|
406
|
+
picker: R,
|
|
407
|
+
runer: v,
|
|
400
408
|
isSimplyType: Q,
|
|
401
409
|
tr() {
|
|
402
410
|
let t = {};
|
|
403
|
-
return this.margin(this.offset),
|
|
411
|
+
return this.margin(this.offset), P(mt, (e, i) => {
|
|
404
412
|
this.css(t, e, i);
|
|
405
413
|
}), t;
|
|
406
414
|
},
|
|
@@ -410,15 +418,15 @@ const Rt = {
|
|
|
410
418
|
!r || this.default[i] == r || (t[e] = b(r));
|
|
411
419
|
},
|
|
412
420
|
change(t) {
|
|
413
|
-
Q(t) || (this.closecss =
|
|
421
|
+
Q(t) || (this.closecss = R(
|
|
414
422
|
t,
|
|
415
423
|
"color=>--s-card-close-color,size=>--s-close-width,bold=>--s-close-height,*"
|
|
416
424
|
));
|
|
417
425
|
},
|
|
418
426
|
margin(t) {
|
|
419
|
-
|
|
427
|
+
W(
|
|
420
428
|
this,
|
|
421
|
-
|
|
429
|
+
R(
|
|
422
430
|
St(t) ? t.split(/\s*(?:,|\s+)\s*/) : t,
|
|
423
431
|
"0=>top,1|0=>right,2|0=>bottom,3|1|0=>left",
|
|
424
432
|
!0
|
|
@@ -430,37 +438,46 @@ const Rt = {
|
|
|
430
438
|
mounted() {
|
|
431
439
|
this.change(this.close);
|
|
432
440
|
}
|
|
433
|
-
},
|
|
434
|
-
|
|
435
|
-
|
|
441
|
+
}, Ot = {
|
|
442
|
+
class: "card-title",
|
|
443
|
+
space: ""
|
|
444
|
+
}, It = {
|
|
445
|
+
class: "card-ico-items",
|
|
446
|
+
flex: "",
|
|
447
|
+
vcenter: ""
|
|
448
|
+
}, jt = ["title"], Ft = { class: "card-content" };
|
|
449
|
+
function Dt(t, e, i, r, l, n) {
|
|
450
|
+
return N(), E("div", {
|
|
436
451
|
class: "card",
|
|
437
|
-
key:
|
|
438
|
-
style:
|
|
452
|
+
key: l.trigger,
|
|
453
|
+
style: O(n.isEmpty(n.style) ? n.tr() : n.style)
|
|
439
454
|
}, [
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
455
|
+
d(t.$slots, "default", {}, () => [
|
|
456
|
+
d(t.$slots, "title", {}, () => [
|
|
457
|
+
M("div", Ot, [
|
|
458
|
+
gt(G(n.sub) + " ", 1),
|
|
459
|
+
d(t.$slots, "icons", {}, () => [
|
|
460
|
+
M("div", It, [
|
|
461
|
+
d(t.$slots, "icon", $t(zt({ el: t.$el, picker: n.picker, runer: n.runer })), void 0, !0),
|
|
462
|
+
M("div", {
|
|
463
|
+
class: ct(["card-close", { hide: n.isSimplyType(i.close) ? !i.close : !1 }]),
|
|
464
|
+
style: O(l.closecss),
|
|
465
|
+
onClick: e[0] || (e[0] = (s) => t.$emit("close")),
|
|
466
|
+
title: n.tips
|
|
467
|
+
}, null, 14, jt)
|
|
468
|
+
])
|
|
469
|
+
], !0)
|
|
470
|
+
])
|
|
471
|
+
], !0),
|
|
472
|
+
d(t.$slots, "content", {}, () => [
|
|
473
|
+
M("div", Ft, [
|
|
474
|
+
d(t.$slots, "inner", {}, void 0, !0)
|
|
458
475
|
])
|
|
459
476
|
], !0)
|
|
460
477
|
], !0)
|
|
461
478
|
], 4);
|
|
462
479
|
}
|
|
463
|
-
const
|
|
480
|
+
const Gt = /* @__PURE__ */ j(At, [["render", Dt], ["__scopeId", "data-v-7fa6225c"]]), Ut = {
|
|
464
481
|
name: "Stream",
|
|
465
482
|
computed: {
|
|
466
483
|
component() {
|
|
@@ -468,7 +485,7 @@ const jt = /* @__PURE__ */ j(Rt, [["render", It], ["__scopeId", "data-v-85bce7b7
|
|
|
468
485
|
},
|
|
469
486
|
column() {
|
|
470
487
|
let { columns: t, T: e } = this, i = t || e;
|
|
471
|
-
return
|
|
488
|
+
return ut(i) ? [] : at(i) ? i : [i];
|
|
472
489
|
}
|
|
473
490
|
},
|
|
474
491
|
props: {
|
|
@@ -491,7 +508,7 @@ const jt = /* @__PURE__ */ j(Rt, [["render", It], ["__scopeId", "data-v-85bce7b7
|
|
|
491
508
|
}
|
|
492
509
|
},
|
|
493
510
|
mounted() {
|
|
494
|
-
this.$.vnode.ref &&
|
|
511
|
+
this.$.vnode.ref && W(this, { ...this.component });
|
|
495
512
|
},
|
|
496
513
|
methods: {
|
|
497
514
|
__trigger(t) {
|
|
@@ -500,25 +517,25 @@ const jt = /* @__PURE__ */ j(Rt, [["render", It], ["__scopeId", "data-v-85bce7b7
|
|
|
500
517
|
}
|
|
501
518
|
}
|
|
502
519
|
};
|
|
503
|
-
function
|
|
504
|
-
return N(),
|
|
505
|
-
default:
|
|
506
|
-
(N(!0),
|
|
520
|
+
function Vt(t, e, i, r, l, n) {
|
|
521
|
+
return N(), Nt(kt(i.type), I({ ref: "component" }, t.$attrs), {
|
|
522
|
+
default: Tt(() => [
|
|
523
|
+
(N(!0), E(dt, null, ft(n.column, (s) => d(t.$slots, n.__trigger(s), I({
|
|
507
524
|
key: s.type
|
|
508
525
|
}, { ref_for: !0 }, s))), 128))
|
|
509
526
|
]),
|
|
510
527
|
_: 3
|
|
511
528
|
}, 16);
|
|
512
529
|
}
|
|
513
|
-
const
|
|
514
|
-
let _t = document.documentElement, ot, ht = ["s-left", "s-top", "s-right", "s-bottom"],
|
|
530
|
+
const qt = /* @__PURE__ */ j(Ut, [["render", Vt]]), rt = /(?:\,|\|{2})/, nt = "px", lt = "";
|
|
531
|
+
let _t = document.documentElement, ot, ht = ["s-left", "s-top", "s-right", "s-bottom"], Xt = { left: 0, top: 1, right: 2, bottom: 3 };
|
|
515
532
|
const V = [];
|
|
516
|
-
var
|
|
533
|
+
var Yt = Et(
|
|
517
534
|
window,
|
|
518
535
|
"Reflect.defineProperty|Object.defineProperty=>Proxy"
|
|
519
536
|
).Proxy;
|
|
520
537
|
let q = {}, wt = null;
|
|
521
|
-
|
|
538
|
+
Yt(q, "delay", {
|
|
522
539
|
/**
|
|
523
540
|
* 获取延迟时间值
|
|
524
541
|
* @returns {number} 返回当前实例的延迟时间属性值
|
|
@@ -527,79 +544,83 @@ Vt(q, "delay", {
|
|
|
527
544
|
return this._delay;
|
|
528
545
|
},
|
|
529
546
|
set(t) {
|
|
530
|
-
wt =
|
|
531
|
-
|
|
547
|
+
wt = Jt(() => {
|
|
548
|
+
g(V);
|
|
532
549
|
}, t), this._delay = t;
|
|
533
550
|
}
|
|
534
551
|
});
|
|
535
552
|
q.delay = 60;
|
|
536
|
-
function
|
|
553
|
+
function Jt(t, e) {
|
|
537
554
|
let i = 0;
|
|
538
555
|
return function() {
|
|
539
556
|
const r = Date.now();
|
|
540
|
-
r - i >= e && (i = r,
|
|
557
|
+
r - i >= e && (i = r, g(t, this, arguments));
|
|
541
558
|
};
|
|
542
559
|
}
|
|
543
560
|
const A = () => {
|
|
544
561
|
wt();
|
|
545
562
|
};
|
|
546
|
-
function
|
|
563
|
+
function Kt(t) {
|
|
547
564
|
V.push(t);
|
|
548
565
|
}
|
|
549
566
|
const L = new ResizeObserver(A);
|
|
550
567
|
L.observe(_t);
|
|
551
568
|
function bt(t) {
|
|
552
569
|
t.onresize || (V.push([bt, null, t]), t.onresize = !0);
|
|
553
|
-
var e = _t, i = e.clientHeight, r =
|
|
570
|
+
var e = _t, i = e.clientHeight, r = Mt(t.offset) ? 15 : t.offset, l = t.target, n = t.room, s = t.index, h = t.position, o = l.getBoundingClientRect(), u = n.offsetHeight + r, c = n.offsetWidth + r, f = "3,0,2,1".split(rt), p, a = (o.height == ot ? o.bottom - o.top : o.height) >> 0, x = (o.width == ot ? o.right - o.left : o.width) >> 0, S = e.clientWidth - c, H = i - u, $ = [
|
|
554
571
|
/* left: 0 */
|
|
555
572
|
o.left - c,
|
|
556
573
|
/* top: 1 */
|
|
557
|
-
o.top -
|
|
574
|
+
o.top - u,
|
|
558
575
|
/* right: 2 */
|
|
559
|
-
|
|
576
|
+
S - o.right,
|
|
560
577
|
/* bottom: 3 */
|
|
561
|
-
|
|
578
|
+
H - o.bottom
|
|
562
579
|
];
|
|
563
580
|
h && (Z(
|
|
564
581
|
h.split(rt),
|
|
565
|
-
function(vt,
|
|
566
|
-
xt.push(F[
|
|
567
|
-
},
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
),
|
|
571
|
-
|
|
572
|
-
function(vt,
|
|
573
|
-
if (F[
|
|
574
|
-
return
|
|
575
|
-
},
|
|
576
|
-
|
|
582
|
+
function(vt, B, F, xt) {
|
|
583
|
+
xt.push(F[B]);
|
|
584
|
+
},
|
|
585
|
+
Xt,
|
|
586
|
+
p = []
|
|
587
|
+
), f.unshift.apply(f, p)), s = Z(
|
|
588
|
+
f,
|
|
589
|
+
function(vt, B, F) {
|
|
590
|
+
if (F[B] > 0)
|
|
591
|
+
return B;
|
|
592
|
+
},
|
|
593
|
+
$
|
|
577
594
|
);
|
|
578
595
|
var y = 0, _ = 0, w = 0;
|
|
579
596
|
if (s != null) {
|
|
580
|
-
var m = s == 0 || s == 2,
|
|
581
|
-
y =
|
|
582
|
-
var
|
|
597
|
+
var m = s == 0 || s == 2, k = s == 3 || s == 1;
|
|
598
|
+
y = k ? Math.min(o.left, S) : s == 2 ? o.right + r : $[0], u -= r * +m;
|
|
599
|
+
var T = Math.max(o.top, 0), z = Math.min(
|
|
583
600
|
o.bottom,
|
|
584
601
|
i
|
|
585
|
-
), X = (
|
|
602
|
+
), X = (z - u + Math.min(i - u, T)) / 2;
|
|
586
603
|
_ = Math.max(
|
|
587
|
-
m ? X : s == 3 ? o.top + a + r : Math.min(X,
|
|
604
|
+
m ? X : s == 3 ? o.top + a + r : Math.min(X, $[1]),
|
|
588
605
|
0
|
|
589
|
-
),
|
|
606
|
+
), k && o.left > S && (w = o.left - y - r + x / 2);
|
|
590
607
|
}
|
|
591
|
-
let Y =
|
|
592
|
-
Y.remove(...ht), Y.add(ht[s]), t.index = s,
|
|
593
|
-
let J =
|
|
608
|
+
let Y = n.classList, C = t.css;
|
|
609
|
+
Y.remove(...ht), Y.add(ht[s]), t.index = s, C.left = y + nt, C.top = _ + nt;
|
|
610
|
+
let J = C["--tips-arrow-top"] = m ? Math.min(
|
|
594
611
|
/* 底边距 */
|
|
595
|
-
Math.max(_,
|
|
596
|
-
|
|
597
|
-
) :
|
|
598
|
-
|
|
612
|
+
Math.max(_, T) - _,
|
|
613
|
+
u - r
|
|
614
|
+
) : lt, K = c - 3 * r;
|
|
615
|
+
C["--tips-arrow"] = w > K - 10 || m && (J + (u > 50 ? 15 : 0) > u || !J) ? "hidden" : "visible", C["--tips-arrow-left"] = w ? Math.min(w, K) : lt;
|
|
599
616
|
}
|
|
600
|
-
const D = "data-tips-scroll",
|
|
617
|
+
const D = "data-tips-scroll", Qt = {
|
|
601
618
|
name: "Tips",
|
|
602
619
|
props: {
|
|
620
|
+
/* 目标对象 */
|
|
621
|
+
target: {
|
|
622
|
+
type: [HTMLElement]
|
|
623
|
+
},
|
|
603
624
|
/* 是否显示 */
|
|
604
625
|
visible: {
|
|
605
626
|
type: [Boolean, String, Number],
|
|
@@ -673,13 +694,13 @@ const D = "data-tips-scroll", Yt = {
|
|
|
673
694
|
};
|
|
674
695
|
},
|
|
675
696
|
methods: {
|
|
676
|
-
|
|
697
|
+
__parent(t) {
|
|
677
698
|
let e = this.$el, i;
|
|
678
|
-
for (; e && (e = e.parentNode, e && e.nodeType == 1 || (e = window, i = !0),
|
|
699
|
+
for (; e && (e = e.parentNode, e && e.nodeType == 1 || (e = window, i = !0), g(t, null, e, i), !i); )
|
|
679
700
|
;
|
|
680
701
|
},
|
|
681
|
-
|
|
682
|
-
return
|
|
702
|
+
__attr(t, e, i) {
|
|
703
|
+
return g(
|
|
683
704
|
t[i === void 0 ? "getAttribute" : "setAttribute"],
|
|
684
705
|
t,
|
|
685
706
|
e,
|
|
@@ -688,12 +709,13 @@ const D = "data-tips-scroll", Yt = {
|
|
|
688
709
|
},
|
|
689
710
|
/* 初始化 */
|
|
690
711
|
init() {
|
|
691
|
-
this.$el
|
|
712
|
+
let t = this.$el;
|
|
713
|
+
t.nodeName != "#comment" && bt({
|
|
692
714
|
onresize: !1,
|
|
693
715
|
/* 监控的目标 */
|
|
694
|
-
target:
|
|
716
|
+
target: t.parentNode,
|
|
695
717
|
/* 显示的元素 */
|
|
696
|
-
room:
|
|
718
|
+
room: t,
|
|
697
719
|
/* 显示位置 */
|
|
698
720
|
position: this.position,
|
|
699
721
|
/* CSS样式集合 */
|
|
@@ -702,57 +724,62 @@ const D = "data-tips-scroll", Yt = {
|
|
|
702
724
|
offset: +this.offset >> 0
|
|
703
725
|
});
|
|
704
726
|
},
|
|
705
|
-
|
|
706
|
-
this.static || this.
|
|
707
|
-
e ?
|
|
727
|
+
__2listener() {
|
|
728
|
+
this.static || this.__parent((t, e, i) => {
|
|
729
|
+
e ? g(t.addEventListener, t, "scroll", A) : (g(L.observe, L, t), (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && (i = this.__attr(t, D), i || (g(t.addEventListener, t, "scroll", A), this.__attr(t, D, "true"))));
|
|
708
730
|
});
|
|
731
|
+
},
|
|
732
|
+
__css() {
|
|
733
|
+
let t = {}, e;
|
|
734
|
+
return this.target ? e = {
|
|
735
|
+
[this.position]: this.offset + "px"
|
|
736
|
+
} : (e = R(
|
|
737
|
+
this.$props,
|
|
738
|
+
"color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size,borderRadius=>--tips-border-radius"
|
|
739
|
+
), t["--arrow-size"] = Math.sqrt(2 * Math.pow((this.border || 3) * 2 + 2, 2)) / 2 >> 0), W(t, e), t;
|
|
740
|
+
},
|
|
741
|
+
__2next() {
|
|
742
|
+
this.target || (this.init(), q.delay = +this.delay, Kt((t) => {
|
|
743
|
+
this.__2listener();
|
|
744
|
+
}), this.__2listener());
|
|
709
745
|
}
|
|
710
746
|
},
|
|
711
747
|
mounted() {
|
|
712
|
-
|
|
713
|
-
this.css,
|
|
714
|
-
O(
|
|
715
|
-
this.$props,
|
|
716
|
-
"color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size,borderRadius=>--tips-border-radius"
|
|
717
|
-
)
|
|
718
|
-
), this.css["--arrow-size"] = Math.sqrt(2 * Math.pow((this.border || 3) * 2 + 2, 2)) / 2 >> 0, this.init(), q.delay = +this.delay, Xt((t) => {
|
|
719
|
-
this.scrollListener();
|
|
720
|
-
}), this.scrollListener();
|
|
748
|
+
this.css = this.__css(), this.__2next();
|
|
721
749
|
},
|
|
722
750
|
unmounted() {
|
|
723
|
-
this.
|
|
724
|
-
|
|
751
|
+
this.__parent(function(t, e) {
|
|
752
|
+
g(t.removeEventListener, t, "scroll", A), g(t.removeAttribute, t, D, void 0), e || g(L.unobserve, L, t);
|
|
725
753
|
});
|
|
726
754
|
}
|
|
727
|
-
},
|
|
728
|
-
function
|
|
729
|
-
return i.visible ? (N(),
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
style: i.static ? null : n.css,
|
|
755
|
+
}, Zt = ["static"], te = { class: "tips-title" };
|
|
756
|
+
function ee(t, e, i, r, l, n) {
|
|
757
|
+
return i.visible ? (N(), E("div", I({ key: 0 }, t.$attrs, {
|
|
758
|
+
class: ["tips", i.target ? "tips-" + i.position : ""],
|
|
759
|
+
style: i.static ? null : l.css,
|
|
733
760
|
static: i.static ? "" : null
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
761
|
+
}), [
|
|
762
|
+
d(t.$slots, "default", {}, () => [
|
|
763
|
+
d(t.$slots, "title", {}, () => [
|
|
764
|
+
M("div", te, G(i.title), 1)
|
|
738
765
|
], !0),
|
|
739
|
-
|
|
766
|
+
d(t.$slots, "content", {}, () => [
|
|
740
767
|
gt(G(i.content), 1)
|
|
741
768
|
], !0)
|
|
742
769
|
], !0)
|
|
743
|
-
], 16,
|
|
770
|
+
], 16, Zt)) : pt("", !0);
|
|
744
771
|
}
|
|
745
|
-
const
|
|
772
|
+
const ie = /* @__PURE__ */ j(Qt, [["render", ee], ["__scopeId", "data-v-45afe77c"]]), se = [Wt, Gt, qt, ie], he = {
|
|
746
773
|
install(t) {
|
|
747
|
-
|
|
774
|
+
se.forEach((e) => {
|
|
748
775
|
t.component("S" + e.name, e), t.component(e.name + "S", e);
|
|
749
776
|
});
|
|
750
777
|
}
|
|
751
778
|
};
|
|
752
779
|
export {
|
|
753
|
-
|
|
780
|
+
Gt as Card,
|
|
754
781
|
Wt as Flyweight,
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
782
|
+
qt as Stream,
|
|
783
|
+
ie as Tips,
|
|
784
|
+
he as default
|
|
758
785
|
};
|