@soei/flyweight 0.3.12 → 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 +239 -212
- 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 +187 -167
- package/vue2/style.css +1 -1
package/vue2/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { runer as
|
|
2
|
-
import { runer as
|
|
3
|
-
import
|
|
4
|
-
let
|
|
1
|
+
import { runer as b, merge as H, isArray as it, each as R, picker as M, isEmpty as st, isSimplyType as D, isString as ut } from "@soei/util";
|
|
2
|
+
import { runer as _, isNil as ft, each as G } from "@soei/tools";
|
|
3
|
+
import dt from "@soei/picker";
|
|
4
|
+
let pt = /(\d+|[+\-\*/]|%)/g, q = {
|
|
5
5
|
"+": (t, e) => t + e,
|
|
6
6
|
"-": (t, e) => t - e,
|
|
7
7
|
"*": (t, e) => t * e,
|
|
8
8
|
"/": (t, e) => t / e,
|
|
9
9
|
"%": (t, e, i) => parseFloat(t) / 100 * i
|
|
10
|
-
},
|
|
10
|
+
}, V = (t, e) => {
|
|
11
11
|
let i;
|
|
12
|
-
if (i =
|
|
12
|
+
if (i = b("match", t, pt)) {
|
|
13
13
|
let s = i.length, l, a = 0, n, h = [];
|
|
14
14
|
for (; s--; )
|
|
15
15
|
a = i.shift(), a in q ? (l && h.push(l), a === "%" && (h.length = 2), n = a) : +a && h.push(+a), h.length == 2 && (h.push(e), l = q[n].apply(null, h), h.length = 0);
|
|
16
16
|
+l || (l = +h.pop()), t = l >> 0;
|
|
17
17
|
}
|
|
18
18
|
return t;
|
|
19
|
-
},
|
|
19
|
+
}, Y = {}, v = (t, e) => (t + "").replace(
|
|
20
20
|
/\w+\((.*)\)/g,
|
|
21
21
|
"$1"
|
|
22
22
|
).replace(
|
|
23
|
-
|
|
23
|
+
Y[e] || (Y[e] = new RegExp("(?=\\s+|^)(\\d+)(?:\\.\\d{1,})?(?!(?:\\.)*\\d|%|\\w)", "g")),
|
|
24
24
|
"$1px"
|
|
25
25
|
);
|
|
26
|
-
function
|
|
26
|
+
function L(t, e, i, s, l, a, n, h) {
|
|
27
27
|
var r = typeof t == "function" ? t.options : t;
|
|
28
28
|
e && (r.render = e, r.staticRenderFns = i, r._compiled = !0), s && (r.functional = !0), a && (r._scopeId = "data-v-" + a);
|
|
29
29
|
var o;
|
|
@@ -39,9 +39,9 @@ function W(t, e, i, s, l, a, n, h) {
|
|
|
39
39
|
} : l), o)
|
|
40
40
|
if (r.functional) {
|
|
41
41
|
r._injectStyles = o;
|
|
42
|
-
var
|
|
43
|
-
r.render = function(
|
|
44
|
-
return o.call(p), u
|
|
42
|
+
var f = r.render;
|
|
43
|
+
r.render = function(u, p) {
|
|
44
|
+
return o.call(p), f(u, p);
|
|
45
45
|
};
|
|
46
46
|
} else {
|
|
47
47
|
var d = r.beforeCreate;
|
|
@@ -52,7 +52,7 @@ function W(t, e, i, s, l, a, n, h) {
|
|
|
52
52
|
options: r
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
let
|
|
55
|
+
let J = (t) => t == null || t == null, _t = (...t) => {
|
|
56
56
|
console.info("::::FLYWEIGHT", ...t);
|
|
57
57
|
};
|
|
58
58
|
const gt = {
|
|
@@ -119,14 +119,14 @@ const gt = {
|
|
|
119
119
|
},
|
|
120
120
|
style() {
|
|
121
121
|
var t = this.w, e = this.h, i = this.Size, s = {};
|
|
122
|
-
return
|
|
123
|
-
"--width":
|
|
124
|
-
"--height":
|
|
125
|
-
"--flyweight-content":
|
|
122
|
+
return H(s, {
|
|
123
|
+
"--width": v(this.realW),
|
|
124
|
+
"--height": v(this.realH),
|
|
125
|
+
"--flyweight-content": v(i)
|
|
126
126
|
}, e && {
|
|
127
|
-
"--flyweight-h":
|
|
127
|
+
"--flyweight-h": v(e)
|
|
128
128
|
}, t && s, {
|
|
129
|
-
"--flyweight-w":
|
|
129
|
+
"--flyweight-w": v(t)
|
|
130
130
|
}, "mix"), s;
|
|
131
131
|
}
|
|
132
132
|
},
|
|
@@ -178,17 +178,17 @@ const gt = {
|
|
|
178
178
|
this.rebuild(), this.$emit("resize");
|
|
179
179
|
}).observe(this.flyweight);
|
|
180
180
|
} catch (t) {
|
|
181
|
-
|
|
181
|
+
_t(t);
|
|
182
182
|
}
|
|
183
|
-
this.scrollx =
|
|
183
|
+
this.scrollx = b("hasAttribute", this.flyweight, "scroll-x"), this.BoxRule = /* this.scrollx ? 'clientHeight=>width,clientWidth=>height' : */
|
|
184
184
|
"clientHeight=>height,clientWidth=>width", this.direction = this.scrollx ? "scrollLeft" : "scrollTop";
|
|
185
185
|
},
|
|
186
186
|
methods: {
|
|
187
|
-
exec:
|
|
187
|
+
exec: v,
|
|
188
188
|
trigger(t, e) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
this.$emit(s[0],
|
|
189
|
+
it(t) || (t = t && e ? [[t, e]] : []), t.length && this.lazyrun(() => {
|
|
190
|
+
R(t, (i, s) => {
|
|
191
|
+
this.$emit(s[0], J(s[1]) ? !0 : s[1]);
|
|
192
192
|
});
|
|
193
193
|
});
|
|
194
194
|
},
|
|
@@ -197,17 +197,17 @@ const gt = {
|
|
|
197
197
|
return t && this.task.push(t), !0;
|
|
198
198
|
},
|
|
199
199
|
setview(t) {
|
|
200
|
-
|
|
200
|
+
b([this.cheackflys, (e) => {
|
|
201
201
|
e = e || {};
|
|
202
|
-
let i = e.index ||
|
|
202
|
+
let i = e.index || R(this.flys, (s, l, a, n) => {
|
|
203
203
|
if (l[a] == n)
|
|
204
204
|
return s;
|
|
205
205
|
}, e.picker, e.id);
|
|
206
|
-
|
|
206
|
+
J(i) || this.setindex(i);
|
|
207
207
|
}], this, t);
|
|
208
208
|
},
|
|
209
209
|
setindex(t) {
|
|
210
|
-
|
|
210
|
+
b([this.cheackflys, ({ index: e }) => {
|
|
211
211
|
this.selectIndex = e, this.$nextTick(() => {
|
|
212
212
|
let i = e / this.column >> 0, s = this.expand;
|
|
213
213
|
(this.flyweight[this.direction] / s >> 0) + this.row - i - 1 > 0 || (this.flyweight[this.direction] = i * s, this.scroll());
|
|
@@ -216,11 +216,11 @@ const gt = {
|
|
|
216
216
|
},
|
|
217
217
|
lazyrun(t, e) {
|
|
218
218
|
clearTimeout(this.time), this.time = setTimeout(() => {
|
|
219
|
-
|
|
219
|
+
b(t);
|
|
220
220
|
}, e || this.lazy);
|
|
221
221
|
},
|
|
222
222
|
run(t) {
|
|
223
|
-
let e = [], i =
|
|
223
|
+
let e = [], i = b(this.direction, t.target), s = {
|
|
224
224
|
// ...this
|
|
225
225
|
offset: i,
|
|
226
226
|
top: i,
|
|
@@ -229,17 +229,17 @@ const gt = {
|
|
|
229
229
|
/* 显示区域第一行的索引 */
|
|
230
230
|
index: i / this.expand >> 0
|
|
231
231
|
};
|
|
232
|
-
|
|
232
|
+
H(s, this.space), t.from || e.push(["onscroll", s]);
|
|
233
233
|
let l = !1;
|
|
234
|
-
|
|
234
|
+
R(
|
|
235
235
|
this.flyweights,
|
|
236
|
-
(a, n, h, r, o,
|
|
236
|
+
(a, n, h, r, o, f, d, c, u) => {
|
|
237
237
|
if (h = a / o >> 0, c = h + r * /* 偏移量, 如果超出顶部 + 1轮,排列到列队后, 否则保持在当前*/
|
|
238
|
-
(+(h <
|
|
238
|
+
(+(h < f % r) + (f / r >> 0)), u = c * o + a % o, u >= this.count) {
|
|
239
239
|
l || (e.push(["onend"]), l = !0);
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
|
-
n.index = c, n.i =
|
|
242
|
+
n.index = c, n.i = u, n.data = this.flys[u];
|
|
243
243
|
let p = [
|
|
244
244
|
/* top */
|
|
245
245
|
c * this.expand + n.x,
|
|
@@ -264,40 +264,40 @@ const gt = {
|
|
|
264
264
|
if (!t)
|
|
265
265
|
return e.length = t;
|
|
266
266
|
this.count = t;
|
|
267
|
-
let i = this.scrollx, s = this.flyweight, l =
|
|
267
|
+
let i = this.scrollx, s = this.flyweight, l = M(s, this.BoxRule);
|
|
268
268
|
this.$nextTick(() => {
|
|
269
|
-
let a = /true/.test(this.auto), [n, h] = this.offset, r = l.width, o = l.height,
|
|
269
|
+
let a = /true/.test(this.auto), [n, h] = this.offset, r = l.width, o = l.height, f = (V(this.width, r) || r) + n, d = V(this.height, o) + h, c = [r / f >> 0 || 1, o / d >> 0 || 1];
|
|
270
270
|
i && c.reverse();
|
|
271
|
-
let [
|
|
272
|
-
i ? (
|
|
271
|
+
let [u, p] = c, x = this.padding, z, S = 0, g, y;
|
|
272
|
+
i ? (g = f, f -= n, y = ($) => (
|
|
273
273
|
/* 计算top偏移量 */
|
|
274
|
-
|
|
275
|
-
)) : (a ? (
|
|
276
|
-
let
|
|
277
|
-
for (;
|
|
278
|
-
|
|
274
|
+
$ * (d - h) + ($ + 1) * h
|
|
275
|
+
)) : (a ? (f = (r - n * (u + 2 * x - 1)) / u, z = !x * n, S = x * n) : (z = 0, S = (r % f + n * u) / (u + 1) >> 0, f -= n), y = ($) => $ * (f + z) + ($ + 1) * S, g = d), this.row = p + 2, this.column = u, this.realH = d - h, this.realW = f, this.expand = g, this.Size = Math.ceil(t / u) * g;
|
|
276
|
+
let w = Math.min(t, u * this.row), m = w - 1, N;
|
|
277
|
+
for (; w-- > 0; )
|
|
278
|
+
N = m - w, this.$set(e, N, {
|
|
279
279
|
x: n,
|
|
280
280
|
y: h,
|
|
281
|
-
width:
|
|
281
|
+
width: f,
|
|
282
282
|
height: d - h,
|
|
283
|
-
space: y(
|
|
283
|
+
space: y(N % u),
|
|
284
284
|
data: {}
|
|
285
285
|
});
|
|
286
286
|
e.length = m + 1;
|
|
287
|
-
let
|
|
288
|
-
o /
|
|
287
|
+
let T = [];
|
|
288
|
+
o / g > m / u && T.push(["onend"]), this.flyweight && (this.flyweight[this.direction] = 0), this.$nextTick(() => {
|
|
289
289
|
this.setindex(this.selectIndex || 0), this.scroll();
|
|
290
|
-
}),
|
|
291
|
-
row: (m /
|
|
292
|
-
column:
|
|
290
|
+
}), T.push(["update:space", {
|
|
291
|
+
row: (m / u >> 0) + 1,
|
|
292
|
+
column: u,
|
|
293
293
|
showrow: this.row,
|
|
294
294
|
showcolumn: this.column
|
|
295
|
-
}]), this.trigger(
|
|
295
|
+
}]), this.trigger(T);
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
|
-
var
|
|
300
|
+
var mt = function() {
|
|
301
301
|
var e = this, i = e._self._c;
|
|
302
302
|
return i("div", { ref: "flyweight", staticClass: "flyweight", class: {
|
|
303
303
|
"flyweight-active": e.actice
|
|
@@ -307,21 +307,21 @@ var _t = function() {
|
|
|
307
307
|
left: s.left + "px"
|
|
308
308
|
} }, [e._t("default", null, null, s)], 2);
|
|
309
309
|
}), 0), e.flyweights.length ? e._t("end") : e._e()], 2);
|
|
310
|
-
},
|
|
310
|
+
}, yt = [], wt = /* @__PURE__ */ L(
|
|
311
311
|
gt,
|
|
312
|
-
_t,
|
|
313
312
|
mt,
|
|
313
|
+
yt,
|
|
314
314
|
!1,
|
|
315
315
|
null,
|
|
316
316
|
"d5f1cd63",
|
|
317
317
|
null,
|
|
318
318
|
null
|
|
319
319
|
);
|
|
320
|
-
const vt =
|
|
321
|
-
function
|
|
320
|
+
const vt = wt.exports;
|
|
321
|
+
function F(t, e) {
|
|
322
322
|
return e && (t = t.replace(/[a-z]/g, "")), t.toLowerCase();
|
|
323
323
|
}
|
|
324
|
-
let
|
|
324
|
+
let rt = {
|
|
325
325
|
close: {
|
|
326
326
|
handler(t) {
|
|
327
327
|
this.change(t);
|
|
@@ -334,7 +334,7 @@ let st = {
|
|
|
334
334
|
},
|
|
335
335
|
deep: !0
|
|
336
336
|
}
|
|
337
|
-
},
|
|
337
|
+
}, bt = [
|
|
338
338
|
"BackGround",
|
|
339
339
|
"BordeR",
|
|
340
340
|
"Height",
|
|
@@ -343,17 +343,17 @@ let st = {
|
|
|
343
343
|
"Right",
|
|
344
344
|
"Bottom",
|
|
345
345
|
"Left"
|
|
346
|
-
],
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
], nt = {};
|
|
347
|
+
R(
|
|
348
|
+
bt,
|
|
349
349
|
(t, e, i) => {
|
|
350
|
-
t =
|
|
350
|
+
t = F(e), nt["--" + F(e, !0)] = t, i[t] = function() {
|
|
351
351
|
this.trigger++;
|
|
352
352
|
};
|
|
353
353
|
},
|
|
354
|
-
|
|
354
|
+
rt
|
|
355
355
|
);
|
|
356
|
-
const
|
|
356
|
+
const xt = {
|
|
357
357
|
name: "Card",
|
|
358
358
|
// inheritAttrs: false,
|
|
359
359
|
props: {
|
|
@@ -410,35 +410,43 @@ const bt = {
|
|
|
410
410
|
computed: {
|
|
411
411
|
style() {
|
|
412
412
|
return this.tr();
|
|
413
|
+
},
|
|
414
|
+
sub() {
|
|
415
|
+
return this.show || this.title;
|
|
416
|
+
},
|
|
417
|
+
tips() {
|
|
418
|
+
return b("tips", this.close || {}) || "关闭[" + this.sub + "]";
|
|
413
419
|
}
|
|
414
420
|
},
|
|
415
|
-
watch:
|
|
421
|
+
watch: rt,
|
|
416
422
|
methods: {
|
|
417
|
-
exec:
|
|
418
|
-
isEmpty:
|
|
419
|
-
|
|
423
|
+
exec: v,
|
|
424
|
+
isEmpty: st,
|
|
425
|
+
picker: M,
|
|
426
|
+
runer: b,
|
|
427
|
+
isSimplyType: D,
|
|
420
428
|
tr() {
|
|
421
429
|
let t = {};
|
|
422
|
-
return this.margin(this.offset),
|
|
430
|
+
return this.margin(this.offset), R(nt, (e, i) => {
|
|
423
431
|
this.css(t, e, i);
|
|
424
432
|
}), t;
|
|
425
433
|
},
|
|
426
|
-
tolower:
|
|
434
|
+
tolower: F,
|
|
427
435
|
css(t, e, i) {
|
|
428
436
|
let s = this[i] || this.default[i];
|
|
429
|
-
!s || this.default[i] == s || (t[e] =
|
|
437
|
+
!s || this.default[i] == s || (t[e] = v(s));
|
|
430
438
|
},
|
|
431
439
|
change(t) {
|
|
432
|
-
|
|
440
|
+
D(t) || (this.closecss = M(
|
|
433
441
|
t,
|
|
434
442
|
"color=>--s-card-close-color,size=>--s-close-width,bold=>--s-close-height,*"
|
|
435
443
|
));
|
|
436
444
|
},
|
|
437
445
|
margin(t) {
|
|
438
|
-
|
|
446
|
+
H(
|
|
439
447
|
this,
|
|
440
|
-
|
|
441
|
-
|
|
448
|
+
M(
|
|
449
|
+
ut(t) ? t.split(/\s*(?:,|\s+)\s*/) : t,
|
|
442
450
|
"0=>top,1|0=>right,2|0=>bottom,3|1|0=>left",
|
|
443
451
|
!0
|
|
444
452
|
),
|
|
@@ -450,29 +458,30 @@ const bt = {
|
|
|
450
458
|
this.change(this.close);
|
|
451
459
|
}
|
|
452
460
|
};
|
|
453
|
-
var
|
|
461
|
+
var St = function() {
|
|
454
462
|
var e = this, i = e._self._c;
|
|
455
463
|
return i("div", { key: e.trigger, staticClass: "card", style: e.isEmpty(e.style) ? e.tr() : e.style }, [e._t("default", function() {
|
|
456
464
|
return [e._t("title", function() {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
465
|
+
return [i("div", { staticClass: "card-title", attrs: { space: "" } }, [e._v(" " + e._s(e.sub) + " "), e._t("icons", function() {
|
|
466
|
+
return [i("div", { staticClass: "card-ico-items", attrs: { flex: "", vcenter: "" } }, [e._t("icon", null, null, { el: e.$el, picker: e.picker, runer: e.runer }), i("div", { staticClass: "card-close", class: { hide: e.isSimplyType(e.close) ? !e.close : !1 }, style: e.closecss, attrs: { title: e.tips }, on: { click: function(s) {
|
|
467
|
+
return e.$emit("close");
|
|
468
|
+
} } })], 2)];
|
|
469
|
+
})], 2)];
|
|
461
470
|
}), e._t("content", function() {
|
|
462
471
|
return [i("div", { staticClass: "card-content" }, [e._t("inner")], 2)];
|
|
463
472
|
})];
|
|
464
473
|
})], 2);
|
|
465
|
-
},
|
|
466
|
-
bt,
|
|
474
|
+
}, $t = [], Nt = /* @__PURE__ */ L(
|
|
467
475
|
xt,
|
|
468
476
|
St,
|
|
477
|
+
$t,
|
|
469
478
|
!1,
|
|
470
479
|
null,
|
|
471
|
-
"
|
|
480
|
+
"b1e09a6c",
|
|
472
481
|
null,
|
|
473
482
|
null
|
|
474
483
|
);
|
|
475
|
-
const
|
|
484
|
+
const Tt = Nt.exports, zt = {
|
|
476
485
|
name: "Stream",
|
|
477
486
|
computed: {
|
|
478
487
|
component() {
|
|
@@ -480,7 +489,7 @@ const Nt = $t.exports, zt = {
|
|
|
480
489
|
},
|
|
481
490
|
column() {
|
|
482
491
|
let { columns: t, T: e } = this, i = t || e;
|
|
483
|
-
return
|
|
492
|
+
return st(i) ? [] : it(i) ? i : [i];
|
|
484
493
|
}
|
|
485
494
|
},
|
|
486
495
|
props: {
|
|
@@ -503,7 +512,7 @@ const Nt = $t.exports, zt = {
|
|
|
503
512
|
}
|
|
504
513
|
},
|
|
505
514
|
mounted() {
|
|
506
|
-
this.$.vnode.ref &&
|
|
515
|
+
this.$.vnode.ref && H(this, { ...this.component });
|
|
507
516
|
},
|
|
508
517
|
methods: {
|
|
509
518
|
__trigger(t) {
|
|
@@ -512,30 +521,30 @@ const Nt = $t.exports, zt = {
|
|
|
512
521
|
}
|
|
513
522
|
}
|
|
514
523
|
};
|
|
515
|
-
var
|
|
524
|
+
var Ct = function() {
|
|
516
525
|
var e = this, i = e._self._c;
|
|
517
526
|
return i(e.type, e._b({ ref: "component", tag: "component" }, "component", e.$attrs, !1), [e._l(e.column, function(s) {
|
|
518
527
|
return e._t(e.__trigger(s), null, null, s);
|
|
519
528
|
})], 2);
|
|
520
|
-
},
|
|
529
|
+
}, kt = [], Rt = /* @__PURE__ */ L(
|
|
521
530
|
zt,
|
|
522
|
-
Tt,
|
|
523
531
|
Ct,
|
|
532
|
+
kt,
|
|
524
533
|
!1,
|
|
525
534
|
null,
|
|
526
535
|
null,
|
|
527
536
|
null,
|
|
528
537
|
null
|
|
529
538
|
);
|
|
530
|
-
const
|
|
531
|
-
let
|
|
532
|
-
const
|
|
533
|
-
var
|
|
539
|
+
const Mt = Rt.exports, K = /(?:\,|\|{2})/, Q = "px", Z = "";
|
|
540
|
+
let lt = document.documentElement, tt, et = ["s-left", "s-top", "s-right", "s-bottom"], Ht = { left: 0, top: 1, right: 2, bottom: 3 };
|
|
541
|
+
const P = [];
|
|
542
|
+
var Et = dt(
|
|
534
543
|
window,
|
|
535
544
|
"Reflect.defineProperty|Object.defineProperty=>Proxy"
|
|
536
545
|
).Proxy;
|
|
537
|
-
let
|
|
538
|
-
|
|
546
|
+
let B = {}, ot = null;
|
|
547
|
+
Et(B, "delay", {
|
|
539
548
|
/**
|
|
540
549
|
* 获取延迟时间值
|
|
541
550
|
* @returns {number} 返回当前实例的延迟时间属性值
|
|
@@ -544,79 +553,83 @@ Ht(P, "delay", {
|
|
|
544
553
|
return this._delay;
|
|
545
554
|
},
|
|
546
555
|
set(t) {
|
|
547
|
-
|
|
548
|
-
|
|
556
|
+
ot = Wt(() => {
|
|
557
|
+
_(P);
|
|
549
558
|
}, t), this._delay = t;
|
|
550
559
|
}
|
|
551
560
|
});
|
|
552
|
-
|
|
553
|
-
function
|
|
561
|
+
B.delay = 60;
|
|
562
|
+
function Wt(t, e) {
|
|
554
563
|
let i = 0;
|
|
555
564
|
return function() {
|
|
556
565
|
const s = Date.now();
|
|
557
|
-
s - i >= e && (i = s,
|
|
566
|
+
s - i >= e && (i = s, _(t, this, arguments));
|
|
558
567
|
};
|
|
559
568
|
}
|
|
560
|
-
const
|
|
561
|
-
|
|
569
|
+
const W = () => {
|
|
570
|
+
ot();
|
|
562
571
|
};
|
|
563
572
|
function Lt(t) {
|
|
564
|
-
|
|
573
|
+
P.push(t);
|
|
565
574
|
}
|
|
566
|
-
const
|
|
567
|
-
|
|
568
|
-
function
|
|
569
|
-
t.onresize || (
|
|
570
|
-
var e =
|
|
575
|
+
const k = new ResizeObserver(W);
|
|
576
|
+
k.observe(lt);
|
|
577
|
+
function ht(t) {
|
|
578
|
+
t.onresize || (P.push([ht, null, t]), t.onresize = !0);
|
|
579
|
+
var e = lt, i = e.clientHeight, s = ft(t.offset) ? 15 : t.offset, l = t.target, a = t.room, n = t.index, h = t.position, r = l.getBoundingClientRect(), o = a.offsetHeight + s, f = a.offsetWidth + s, d = "3,0,2,1".split(K), c, u = (r.height == tt ? r.bottom - r.top : r.height) >> 0, p = (r.width == tt ? r.right - r.left : r.width) >> 0, x = e.clientWidth - f, z = i - o, S = [
|
|
571
580
|
/* left: 0 */
|
|
572
|
-
r.left -
|
|
581
|
+
r.left - f,
|
|
573
582
|
/* top: 1 */
|
|
574
583
|
r.top - o,
|
|
575
584
|
/* right: 2 */
|
|
576
|
-
|
|
585
|
+
x - r.right,
|
|
577
586
|
/* bottom: 3 */
|
|
578
|
-
|
|
587
|
+
z - r.bottom
|
|
579
588
|
];
|
|
580
589
|
h && (G(
|
|
581
|
-
h.split(
|
|
582
|
-
function(
|
|
583
|
-
|
|
590
|
+
h.split(K),
|
|
591
|
+
function(at, E, O, ct) {
|
|
592
|
+
ct.push(O[E]);
|
|
584
593
|
},
|
|
585
|
-
|
|
594
|
+
Ht,
|
|
586
595
|
c = []
|
|
587
596
|
), d.unshift.apply(d, c)), n = G(
|
|
588
597
|
d,
|
|
589
|
-
function(
|
|
590
|
-
if (O[
|
|
591
|
-
return
|
|
598
|
+
function(at, E, O) {
|
|
599
|
+
if (O[E] > 0)
|
|
600
|
+
return E;
|
|
592
601
|
},
|
|
593
|
-
|
|
602
|
+
S
|
|
594
603
|
);
|
|
595
|
-
var
|
|
604
|
+
var g = 0, y = 0, w = 0;
|
|
596
605
|
if (n != null) {
|
|
597
|
-
var m = n == 0 || n == 2,
|
|
598
|
-
|
|
599
|
-
var
|
|
606
|
+
var m = n == 0 || n == 2, N = n == 3 || n == 1;
|
|
607
|
+
g = N ? Math.min(r.left, x) : n == 2 ? r.right + s : S[0], o -= s * +m;
|
|
608
|
+
var T = Math.max(r.top, 0), $ = Math.min(
|
|
600
609
|
r.bottom,
|
|
601
610
|
i
|
|
602
|
-
),
|
|
611
|
+
), I = ($ - o + Math.min(i - o, T)) / 2;
|
|
603
612
|
y = Math.max(
|
|
604
|
-
m ?
|
|
613
|
+
m ? I : n == 3 ? r.top + u + s : Math.min(I, S[1]),
|
|
605
614
|
0
|
|
606
|
-
),
|
|
615
|
+
), N && r.left > x && (w = r.left - g - s + p / 2);
|
|
607
616
|
}
|
|
608
|
-
let
|
|
609
|
-
|
|
610
|
-
let
|
|
617
|
+
let j = a.classList, C = t.css;
|
|
618
|
+
j.remove(...et), j.add(et[n]), t.index = n, C.left = g + Q, C.top = y + Q;
|
|
619
|
+
let U = C["--tips-arrow-top"] = m ? Math.min(
|
|
611
620
|
/* 底边距 */
|
|
612
|
-
Math.max(y,
|
|
621
|
+
Math.max(y, T) - y,
|
|
613
622
|
o - s
|
|
614
|
-
) :
|
|
615
|
-
C["--tips-arrow"] =
|
|
623
|
+
) : Z, X = f - 3 * s;
|
|
624
|
+
C["--tips-arrow"] = w > X - 10 || m && (U + (o > 50 ? 15 : 0) > o || !U) ? "hidden" : "visible", C["--tips-arrow-left"] = w ? Math.min(w, X) : Z;
|
|
616
625
|
}
|
|
617
|
-
const
|
|
626
|
+
const A = "data-tips-scroll", Ot = {
|
|
618
627
|
name: "Tips",
|
|
619
628
|
props: {
|
|
629
|
+
/* 目标对象 */
|
|
630
|
+
target: {
|
|
631
|
+
type: [HTMLElement]
|
|
632
|
+
},
|
|
620
633
|
/* 是否显示 */
|
|
621
634
|
visible: {
|
|
622
635
|
type: [Boolean, String, Number],
|
|
@@ -690,13 +703,13 @@ const Wt = {
|
|
|
690
703
|
};
|
|
691
704
|
},
|
|
692
705
|
methods: {
|
|
693
|
-
|
|
706
|
+
__parent(t) {
|
|
694
707
|
let e = this.$el, i;
|
|
695
|
-
for (; e && (e = e.parentNode, e && e.nodeType == 1 || (e = window, i = !0),
|
|
708
|
+
for (; e && (e = e.parentNode, e && e.nodeType == 1 || (e = window, i = !0), _(t, null, e, i), !i); )
|
|
696
709
|
;
|
|
697
710
|
},
|
|
698
|
-
|
|
699
|
-
return
|
|
711
|
+
__attr(t, e, i) {
|
|
712
|
+
return _(
|
|
700
713
|
t[i === void 0 ? "getAttribute" : "setAttribute"],
|
|
701
714
|
t,
|
|
702
715
|
e,
|
|
@@ -705,12 +718,13 @@ const Wt = {
|
|
|
705
718
|
},
|
|
706
719
|
/* 初始化 */
|
|
707
720
|
init() {
|
|
708
|
-
this.$el
|
|
721
|
+
let t = this.$el;
|
|
722
|
+
t.nodeName != "#comment" && ht({
|
|
709
723
|
onresize: !1,
|
|
710
724
|
/* 监控的目标 */
|
|
711
|
-
target:
|
|
725
|
+
target: t.parentNode,
|
|
712
726
|
/* 显示的元素 */
|
|
713
|
-
room:
|
|
727
|
+
room: t,
|
|
714
728
|
/* 显示位置 */
|
|
715
729
|
position: this.position,
|
|
716
730
|
/* CSS样式集合 */
|
|
@@ -719,59 +733,65 @@ const Wt = {
|
|
|
719
733
|
offset: +this.offset >> 0
|
|
720
734
|
});
|
|
721
735
|
},
|
|
722
|
-
|
|
723
|
-
this.static || this.
|
|
724
|
-
e ?
|
|
736
|
+
__2listener() {
|
|
737
|
+
this.static || this.__parent((t, e, i) => {
|
|
738
|
+
e ? _(t.addEventListener, t, "scroll", W) : (_(k.observe, k, t), (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && (i = this.__attr(t, A), i || (_(t.addEventListener, t, "scroll", W), this.__attr(t, A, "true"))));
|
|
725
739
|
});
|
|
740
|
+
},
|
|
741
|
+
__css() {
|
|
742
|
+
let t = {}, e;
|
|
743
|
+
return this.target ? e = {
|
|
744
|
+
[this.position]: this.offset + "px"
|
|
745
|
+
} : (e = M(
|
|
746
|
+
this.$props,
|
|
747
|
+
"color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size,borderRadius=>--tips-border-radius"
|
|
748
|
+
), t["--arrow-size"] = Math.sqrt(2 * Math.pow((this.border || 3) * 2 + 2, 2)) / 2 >> 0), H(t, e), t;
|
|
749
|
+
},
|
|
750
|
+
__2next() {
|
|
751
|
+
this.target || (this.init(), B.delay = +this.delay, Lt((t) => {
|
|
752
|
+
this.__2listener();
|
|
753
|
+
}), this.__2listener());
|
|
726
754
|
}
|
|
727
755
|
},
|
|
728
756
|
mounted() {
|
|
729
|
-
|
|
730
|
-
this.css,
|
|
731
|
-
L(
|
|
732
|
-
this.$props,
|
|
733
|
-
"color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size,borderRadius=>--tips-border-radius"
|
|
734
|
-
)
|
|
735
|
-
), this.css["--arrow-size"] = Math.sqrt(2 * Math.pow((this.border || 3) * 2 + 2, 2)) / 2 >> 0, this.init(), P.delay = +this.delay, Lt((t) => {
|
|
736
|
-
this.scrollListener();
|
|
737
|
-
}), this.scrollListener();
|
|
757
|
+
this.css = this.__css(), this.__2next();
|
|
738
758
|
},
|
|
739
759
|
unmounted() {
|
|
740
|
-
this.
|
|
741
|
-
|
|
760
|
+
this.__parent(function(t, e) {
|
|
761
|
+
_(t.removeEventListener, t, "scroll", W), _(t.removeAttribute, t, A, void 0), e || _(k.unobserve, k, t);
|
|
742
762
|
});
|
|
743
763
|
}
|
|
744
764
|
};
|
|
745
|
-
var
|
|
765
|
+
var At = function() {
|
|
746
766
|
var e = this, i = e._self._c;
|
|
747
|
-
return e.visible ? i("div", e._b({ staticClass: "tips", style: e.static ? null : e.css, attrs: { static: e.static ? "" : null } }, "div", e.$attrs, !1), [e._t("default", function() {
|
|
767
|
+
return e.visible ? i("div", e._b({ staticClass: "tips", class: e.target ? "tips-" + e.position : "", style: e.static ? null : e.css, attrs: { static: e.static ? "" : null } }, "div", e.$attrs, !1), [e._t("default", function() {
|
|
748
768
|
return [e._t("title", function() {
|
|
749
769
|
return [i("div", { staticClass: "tips-title" }, [e._v(e._s(e.title))])];
|
|
750
770
|
}), e._t("content", function() {
|
|
751
771
|
return [e._v(e._s(e.content))];
|
|
752
772
|
})];
|
|
753
773
|
})], 2) : e._e();
|
|
754
|
-
},
|
|
755
|
-
Wt,
|
|
774
|
+
}, Ft = [], Pt = /* @__PURE__ */ L(
|
|
756
775
|
Ot,
|
|
757
776
|
At,
|
|
777
|
+
Ft,
|
|
758
778
|
!1,
|
|
759
779
|
null,
|
|
760
|
-
"
|
|
780
|
+
"f2043d4b",
|
|
761
781
|
null,
|
|
762
782
|
null
|
|
763
783
|
);
|
|
764
|
-
const
|
|
784
|
+
const Bt = Pt.exports, It = [vt, Tt, Mt, Bt], Dt = {
|
|
765
785
|
install(t) {
|
|
766
|
-
|
|
786
|
+
It.forEach((e) => {
|
|
767
787
|
t.component("S" + e.name, e), t.component(e.name + "S", e);
|
|
768
788
|
});
|
|
769
789
|
}
|
|
770
790
|
};
|
|
771
791
|
export {
|
|
772
|
-
|
|
792
|
+
Tt as Card,
|
|
773
793
|
vt as Flyweight,
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
794
|
+
Mt as Stream,
|
|
795
|
+
Bt as Tips,
|
|
796
|
+
Dt as default
|
|
777
797
|
};
|