@soei/flyweight 0.3.10 → 0.3.11
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 +170 -165
- package/README.md +13 -0
- package/package.json +1 -1
- package/style.css +1 -1
- package/vue2/index.cjs +1 -1
- package/vue2/index.js +160 -155
- package/vue2/style.css +1 -1
package/Flyweight.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { runer as T, merge as B, isArray as
|
|
2
|
-
import { openBlock as z, createElementBlock as M, normalizeClass as
|
|
3
|
-
import { runer as p, each as
|
|
4
|
-
import
|
|
5
|
-
let
|
|
1
|
+
import { runer as T, merge as B, isArray as ht, each as P, picker as C, isEmpty as at, isSimplyType as K, isString as xt } from "@soei/util";
|
|
2
|
+
import { openBlock as z, createElementBlock as M, normalizeClass as dt, normalizeStyle as O, createElementVNode as R, Fragment as ut, renderList as ct, renderSlot as g, mergeProps as G, createCommentVNode as ft, createTextVNode as pt, toDisplayString as F, createBlock as St, resolveDynamicComponent as $t, normalizeProps as zt, guardReactiveProps as Nt, withCtx as kt } from "vue";
|
|
3
|
+
import { runer as p, isNil as Tt, each as Q } from "@soei/tools";
|
|
4
|
+
import Mt from "@soei/picker";
|
|
5
|
+
let Et = /(\d+|[+\-\*/]|%)/g, Z = {
|
|
6
6
|
"+": (t, e) => t + e,
|
|
7
7
|
"-": (t, e) => t - e,
|
|
8
8
|
"*": (t, e) => t * e,
|
|
9
9
|
"/": (t, e) => t / e,
|
|
10
10
|
"%": (t, e, i) => parseFloat(t) / 100 * i
|
|
11
|
-
},
|
|
11
|
+
}, tt = (t, e) => {
|
|
12
12
|
let i;
|
|
13
|
-
if (i = T("match", t,
|
|
13
|
+
if (i = T("match", t, Et)) {
|
|
14
14
|
let r = i.length, n, l = 0, s, h = [];
|
|
15
15
|
for (; r--; )
|
|
16
|
-
l = i.shift(), l in
|
|
16
|
+
l = i.shift(), l in Z ? (n && h.push(n), l === "%" && (h.length = 2), s = l) : +l && h.push(+l), h.length == 2 && (h.push(e), n = Z[s].apply(null, h), h.length = 0);
|
|
17
17
|
+n || (n = +h.pop()), t = n >> 0;
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
|
-
},
|
|
20
|
+
}, et = {}, _ = (t, e) => (t + "").replace(
|
|
21
21
|
/\w+\((.*)\)/g,
|
|
22
22
|
"$1"
|
|
23
23
|
).replace(
|
|
24
|
-
|
|
24
|
+
et[e] || (et[e] = new RegExp("(?=\\s+|^)(\\d+)(?:\\.\\d{1,})?(?!(?:\\.)*\\d|%|\\w)", "g")),
|
|
25
25
|
"$1px"
|
|
26
26
|
);
|
|
27
|
-
const
|
|
27
|
+
const I = (t, e) => {
|
|
28
28
|
const i = t.__vccOpts || t;
|
|
29
29
|
for (const [r, n] of e)
|
|
30
30
|
i[r] = n;
|
|
31
31
|
return i;
|
|
32
32
|
};
|
|
33
|
-
let
|
|
33
|
+
let it = (t) => t == null || t == null, Ht = (...t) => {
|
|
34
34
|
console.info("::::FLYWEIGHT", ...t);
|
|
35
35
|
};
|
|
36
|
-
const
|
|
36
|
+
const Lt = {
|
|
37
37
|
name: "Flyweight",
|
|
38
38
|
props: {
|
|
39
39
|
flys: {
|
|
@@ -156,7 +156,7 @@ const Mt = {
|
|
|
156
156
|
this.rebuild(), this.$emit("resize");
|
|
157
157
|
}).observe(this.flyweight);
|
|
158
158
|
} catch (t) {
|
|
159
|
-
|
|
159
|
+
Ht(t);
|
|
160
160
|
}
|
|
161
161
|
this.scrollx = T("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";
|
|
@@ -164,9 +164,9 @@ const Mt = {
|
|
|
164
164
|
methods: {
|
|
165
165
|
exec: _,
|
|
166
166
|
trigger(t, e) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
this.$emit(r[0],
|
|
167
|
+
ht(t) || (t = t && e ? [[t, e]] : []), t.length && this.lazyrun(() => {
|
|
168
|
+
P(t, (i, r) => {
|
|
169
|
+
this.$emit(r[0], it(r[1]) ? !0 : r[1]);
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
172
|
},
|
|
@@ -177,11 +177,11 @@ const Mt = {
|
|
|
177
177
|
setview(t) {
|
|
178
178
|
T([this.cheackflys, (e) => {
|
|
179
179
|
e = e || {};
|
|
180
|
-
let i = e.index ||
|
|
180
|
+
let i = e.index || P(this.flys, (r, n, l, s) => {
|
|
181
181
|
if (n[l] == s)
|
|
182
182
|
return r;
|
|
183
183
|
}, e.picker, e.id);
|
|
184
|
-
|
|
184
|
+
it(i) || this.setindex(i);
|
|
185
185
|
}], this, t);
|
|
186
186
|
},
|
|
187
187
|
setindex(t) {
|
|
@@ -209,22 +209,22 @@ const Mt = {
|
|
|
209
209
|
};
|
|
210
210
|
B(r, this.space), t.from || e.push(["onscroll", r]);
|
|
211
211
|
let n = !1;
|
|
212
|
-
|
|
212
|
+
P(
|
|
213
213
|
this.flyweights,
|
|
214
|
-
(l, s, h, o, u, c,
|
|
215
|
-
if (h = l /
|
|
216
|
-
(+(h <
|
|
214
|
+
(l, s, h, o, d, u, c, f, a) => {
|
|
215
|
+
if (h = l / d >> 0, f = h + o * /* 偏移量, 如果超出顶部 + 1轮,排列到列队后, 否则保持在当前*/
|
|
216
|
+
(+(h < u % o) + (u / o >> 0)), a = f * d + l % d, a >= this.count) {
|
|
217
217
|
n || (e.push(["onend"]), n = !0);
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
220
|
s.index = f, s.i = a, s.data = this.flys[a];
|
|
221
|
-
let
|
|
221
|
+
let v = [
|
|
222
222
|
/* top */
|
|
223
223
|
f * this.expand + s.x,
|
|
224
224
|
/* left */
|
|
225
225
|
s.space
|
|
226
226
|
];
|
|
227
|
-
|
|
227
|
+
c && v.reverse(), s.top = v[0], s.left = v[1];
|
|
228
228
|
},
|
|
229
229
|
null,
|
|
230
230
|
this.row,
|
|
@@ -242,67 +242,67 @@ const Mt = {
|
|
|
242
242
|
if (!t)
|
|
243
243
|
return e.length = t;
|
|
244
244
|
this.count = t;
|
|
245
|
-
let i = this.scrollx, r = this.flyweight, n =
|
|
245
|
+
let i = this.scrollx, r = this.flyweight, n = C(r, this.BoxRule);
|
|
246
246
|
this.$nextTick(() => {
|
|
247
|
-
let l = /true/.test(this.auto), [s, h] = this.offset, o = n.width,
|
|
247
|
+
let l = /true/.test(this.auto), [s, h] = this.offset, o = n.width, d = n.height, u = (tt(this.width, o) || o) + s, c = tt(this.height, d) + h, f = [o / u >> 0 || 1, d / c >> 0 || 1];
|
|
248
248
|
i && f.reverse();
|
|
249
|
-
let [a,
|
|
250
|
-
i ? (
|
|
249
|
+
let [a, v] = f, x = this.padding, E, S = 0, y, w;
|
|
250
|
+
i ? (y = u, u -= s, w = ($) => (
|
|
251
251
|
/* 计算top偏移量 */
|
|
252
|
-
|
|
253
|
-
)) : (l ? (
|
|
254
|
-
let
|
|
255
|
-
for (;
|
|
256
|
-
|
|
252
|
+
$ * (c - h) + ($ + 1) * h
|
|
253
|
+
)) : (l ? (u = (o - s * (a + 2 * x - 1)) / a, E = !x * s, S = x * s) : (E = 0, S = (o % u + s * a) / (a + 1) >> 0, u -= s), w = ($) => $ * (u + E) + ($ + 1) * S, y = c), this.row = v + 2, this.column = a, this.realH = c - h, this.realW = u, this.expand = y, this.Size = Math.ceil(t / a) * y;
|
|
254
|
+
let b = Math.min(t, a * this.row), m = b - 1, N;
|
|
255
|
+
for (; b-- > 0; )
|
|
256
|
+
N = m - b, this.$set(e, N, {
|
|
257
257
|
x: s,
|
|
258
258
|
y: h,
|
|
259
|
-
width:
|
|
260
|
-
height:
|
|
261
|
-
space:
|
|
259
|
+
width: u,
|
|
260
|
+
height: c - h,
|
|
261
|
+
space: w(N % a),
|
|
262
262
|
data: {}
|
|
263
263
|
});
|
|
264
|
-
e.length =
|
|
265
|
-
let
|
|
266
|
-
|
|
264
|
+
e.length = m + 1;
|
|
265
|
+
let k = [];
|
|
266
|
+
d / y > m / a && k.push(["onend"]), this.flyweight && (this.flyweight[this.direction] = 0), this.$nextTick(() => {
|
|
267
267
|
this.setindex(this.selectIndex || 0), this.scroll();
|
|
268
|
-
}),
|
|
269
|
-
row: (
|
|
268
|
+
}), k.push(["update:space", {
|
|
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(k);
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
},
|
|
278
|
-
function
|
|
277
|
+
}, Pt = { class: "flyweight-all" };
|
|
278
|
+
function Rt(t, e, i, r, n, l) {
|
|
279
279
|
return z(), M("div", {
|
|
280
280
|
ref: "flyweight",
|
|
281
|
-
class:
|
|
281
|
+
class: dt(["flyweight", {
|
|
282
282
|
"flyweight-active": n.actice
|
|
283
283
|
}]),
|
|
284
|
-
style:
|
|
284
|
+
style: O(l.style),
|
|
285
285
|
onScroll: e[0] || (e[0] = (...s) => l.scroll && l.scroll(...s))
|
|
286
286
|
}, [
|
|
287
|
-
|
|
288
|
-
(z(!0), M(
|
|
287
|
+
R("div", Pt, [
|
|
288
|
+
(z(!0), M(ut, null, ct(n.flyweights, (s, h) => (z(), M("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
|
+
g(t.$slots, "default", G({ ref_for: !0 }, s), void 0, !0)
|
|
296
296
|
], 4))), 128))
|
|
297
297
|
]),
|
|
298
|
-
n.flyweights.length ?
|
|
298
|
+
n.flyweights.length ? g(t.$slots, "end", { key: 0 }, void 0, !0) : ft("", !0)
|
|
299
299
|
], 38);
|
|
300
300
|
}
|
|
301
|
-
const
|
|
302
|
-
function
|
|
301
|
+
const Wt = /* @__PURE__ */ I(Lt, [["render", Rt], ["__scopeId", "data-v-35b94e9b"]]);
|
|
302
|
+
function D(t, e) {
|
|
303
303
|
return e && (t = t.replace(/[a-z]/g, "")), t.toLowerCase();
|
|
304
304
|
}
|
|
305
|
-
let
|
|
305
|
+
let gt = {
|
|
306
306
|
close: {
|
|
307
307
|
handler(t) {
|
|
308
308
|
this.change(t);
|
|
@@ -315,7 +315,7 @@ let ft = {
|
|
|
315
315
|
},
|
|
316
316
|
deep: !0
|
|
317
317
|
}
|
|
318
|
-
},
|
|
318
|
+
}, At = [
|
|
319
319
|
"BackGround",
|
|
320
320
|
"BordeR",
|
|
321
321
|
"Height",
|
|
@@ -324,17 +324,17 @@ let ft = {
|
|
|
324
324
|
"Right",
|
|
325
325
|
"Bottom",
|
|
326
326
|
"Left"
|
|
327
|
-
],
|
|
328
|
-
|
|
329
|
-
|
|
327
|
+
], yt = {};
|
|
328
|
+
P(
|
|
329
|
+
At,
|
|
330
330
|
(t, e, i) => {
|
|
331
|
-
t =
|
|
331
|
+
t = D(e), yt["--" + D(e, !0)] = t, i[t] = function() {
|
|
332
332
|
this.trigger++;
|
|
333
333
|
};
|
|
334
334
|
},
|
|
335
|
-
|
|
335
|
+
gt
|
|
336
336
|
);
|
|
337
|
-
const
|
|
337
|
+
const Bt = {
|
|
338
338
|
name: "Card",
|
|
339
339
|
// inheritAttrs: false,
|
|
340
340
|
props: {
|
|
@@ -393,24 +393,24 @@ const Wt = {
|
|
|
393
393
|
return this.tr();
|
|
394
394
|
}
|
|
395
395
|
},
|
|
396
|
-
watch:
|
|
396
|
+
watch: gt,
|
|
397
397
|
methods: {
|
|
398
398
|
exec: _,
|
|
399
|
-
isEmpty:
|
|
400
|
-
isSimplyType:
|
|
399
|
+
isEmpty: at,
|
|
400
|
+
isSimplyType: K,
|
|
401
401
|
tr() {
|
|
402
402
|
let t = {};
|
|
403
|
-
return this.margin(this.offset),
|
|
403
|
+
return this.margin(this.offset), P(yt, (e, i) => {
|
|
404
404
|
this.css(t, e, i);
|
|
405
405
|
}), t;
|
|
406
406
|
},
|
|
407
|
-
tolower:
|
|
407
|
+
tolower: D,
|
|
408
408
|
css(t, e, i) {
|
|
409
409
|
let r = this[i] || this.default[i];
|
|
410
410
|
!r || this.default[i] == r || (t[e] = _(r));
|
|
411
411
|
},
|
|
412
412
|
change(t) {
|
|
413
|
-
|
|
413
|
+
K(t) || (this.closecss = C(
|
|
414
414
|
t,
|
|
415
415
|
"color=>--s-card-close-color,size=>--s-close-width,bold=>--s-close-height,*"
|
|
416
416
|
));
|
|
@@ -418,8 +418,8 @@ const Wt = {
|
|
|
418
418
|
margin(t) {
|
|
419
419
|
B(
|
|
420
420
|
this,
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
C(
|
|
422
|
+
xt(t) ? t.split(/\s*(?:,|\s+)\s*/) : t,
|
|
423
423
|
"0=>top,1|0=>right,2|0=>bottom,3|1|0=>left",
|
|
424
424
|
!0
|
|
425
425
|
),
|
|
@@ -430,42 +430,42 @@ const Wt = {
|
|
|
430
430
|
mounted() {
|
|
431
431
|
this.change(this.close);
|
|
432
432
|
}
|
|
433
|
-
},
|
|
434
|
-
function
|
|
433
|
+
}, Ct = { class: "card-title" }, Ot = ["title"], It = { class: "card-content" };
|
|
434
|
+
function jt(t, e, i, r, n, l) {
|
|
435
435
|
return z(), M("div", {
|
|
436
436
|
class: "card",
|
|
437
437
|
key: n.trigger,
|
|
438
|
-
style:
|
|
438
|
+
style: O(l.isEmpty(l.style) ? l.tr() : l.style)
|
|
439
439
|
}, [
|
|
440
|
-
|
|
441
|
-
|
|
440
|
+
g(t.$slots, "default", {}, () => [
|
|
441
|
+
g(t.$slots, "title", {}, () => {
|
|
442
442
|
var s;
|
|
443
443
|
return [
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
class:
|
|
448
|
-
style:
|
|
444
|
+
R("div", Ct, [
|
|
445
|
+
pt(F(i.show || i.title) + " ", 1),
|
|
446
|
+
R("div", {
|
|
447
|
+
class: dt(["card-close", { hide: l.isSimplyType(i.close) ? !i.close : !1 }]),
|
|
448
|
+
style: O(n.closecss),
|
|
449
449
|
onClick: e[0] || (e[0] = (h) => t.$emit("close")),
|
|
450
450
|
title: (s = i.close) == null ? void 0 : s.tips
|
|
451
|
-
}, null, 14,
|
|
451
|
+
}, null, 14, Ot)
|
|
452
452
|
])
|
|
453
453
|
];
|
|
454
454
|
}, !0),
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
455
|
+
g(t.$slots, "content", {}, () => [
|
|
456
|
+
R("div", It, [
|
|
457
|
+
g(t.$slots, "inner", {}, void 0, !0)
|
|
458
458
|
])
|
|
459
459
|
], !0)
|
|
460
460
|
], !0)
|
|
461
461
|
], 4);
|
|
462
462
|
}
|
|
463
|
-
const
|
|
463
|
+
const Ft = /* @__PURE__ */ I(Bt, [["render", jt], ["__scopeId", "data-v-2008eeb3"]]), Dt = {
|
|
464
464
|
name: "Stream",
|
|
465
465
|
computed: {
|
|
466
466
|
column() {
|
|
467
467
|
let { columns: t, T: e } = this, i = t || e;
|
|
468
|
-
return
|
|
468
|
+
return at(i) ? [] : ht(i) ? i : [i];
|
|
469
469
|
}
|
|
470
470
|
},
|
|
471
471
|
props: {
|
|
@@ -498,25 +498,25 @@ const Ot = /* @__PURE__ */ j(Wt, [["render", Bt], ["__scopeId", "data-v-2008eeb3
|
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
};
|
|
501
|
-
function
|
|
502
|
-
return z(),
|
|
503
|
-
default:
|
|
504
|
-
(z(!0), M(
|
|
501
|
+
function Gt(t, e, i, r, n, l) {
|
|
502
|
+
return z(), St($t(i.type), zt(Nt(t.$attrs)), {
|
|
503
|
+
default: kt(() => [
|
|
504
|
+
(z(!0), M(ut, null, ct(l.column, (s) => g(t.$slots, l.trigger(s), G({
|
|
505
505
|
key: s.type
|
|
506
506
|
}, { ref_for: !0 }, s))), 128))
|
|
507
507
|
]),
|
|
508
508
|
_: 3
|
|
509
509
|
}, 16);
|
|
510
510
|
}
|
|
511
|
-
const
|
|
512
|
-
let
|
|
513
|
-
const
|
|
514
|
-
var
|
|
511
|
+
const Ut = /* @__PURE__ */ I(Dt, [["render", Gt]]), st = /(?:\,|\|{2})/, rt = "px", lt = "";
|
|
512
|
+
let mt = document.documentElement, nt, ot = ["s-left", "s-top", "s-right", "s-bottom"], Vt = { left: 0, top: 1, right: 2, bottom: 3 };
|
|
513
|
+
const U = [];
|
|
514
|
+
var qt = Mt(
|
|
515
515
|
window,
|
|
516
516
|
"Reflect.defineProperty|Object.defineProperty=>Proxy"
|
|
517
517
|
).Proxy;
|
|
518
|
-
let
|
|
519
|
-
|
|
518
|
+
let V = {}, wt = null;
|
|
519
|
+
qt(V, "delay", {
|
|
520
520
|
/**
|
|
521
521
|
* 获取延迟时间值
|
|
522
522
|
* @returns {number} 返回当前实例的延迟时间属性值
|
|
@@ -525,79 +525,77 @@ Gt(X, "delay", {
|
|
|
525
525
|
return this._delay;
|
|
526
526
|
},
|
|
527
527
|
set(t) {
|
|
528
|
-
|
|
529
|
-
p(
|
|
528
|
+
wt = Xt(() => {
|
|
529
|
+
p(U);
|
|
530
530
|
}, t), this._delay = t;
|
|
531
531
|
}
|
|
532
532
|
});
|
|
533
|
-
|
|
534
|
-
function
|
|
533
|
+
V.delay = 60;
|
|
534
|
+
function Xt(t, e) {
|
|
535
535
|
let i = 0;
|
|
536
536
|
return function() {
|
|
537
537
|
const r = Date.now();
|
|
538
538
|
r - i >= e && (i = r, p(t, this, arguments));
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
|
-
const
|
|
542
|
-
|
|
541
|
+
const A = () => {
|
|
542
|
+
wt();
|
|
543
543
|
};
|
|
544
|
-
function
|
|
545
|
-
|
|
544
|
+
function Yt(t) {
|
|
545
|
+
U.push(t);
|
|
546
546
|
}
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
function
|
|
550
|
-
t.onresize || (
|
|
551
|
-
var e =
|
|
547
|
+
const L = new ResizeObserver(A);
|
|
548
|
+
L.observe(mt);
|
|
549
|
+
function bt(t) {
|
|
550
|
+
t.onresize || (U.push([bt, null, t]), t.onresize = !0);
|
|
551
|
+
var e = mt, i = e.clientHeight, r = Tt(t.offset) ? 15 : t.offset, n = t.target, l = t.room, s = t.index, h = t.position, o = n.getBoundingClientRect(), d = l.offsetHeight + r, u = l.offsetWidth + r, c = "3,0,2,1".split(st), f, a = (o.height == nt ? o.bottom - o.top : o.height) >> 0, v = (o.width == nt ? o.right - o.left : o.width) >> 0, x = e.clientWidth - u, E = i - d, S = [
|
|
552
552
|
/* left: 0 */
|
|
553
|
-
o.left -
|
|
553
|
+
o.left - u,
|
|
554
554
|
/* top: 1 */
|
|
555
|
-
o.top -
|
|
555
|
+
o.top - d,
|
|
556
556
|
/* right: 2 */
|
|
557
|
-
|
|
557
|
+
x - o.right,
|
|
558
558
|
/* bottom: 3 */
|
|
559
|
-
|
|
559
|
+
E - o.bottom
|
|
560
560
|
];
|
|
561
|
-
h && (
|
|
562
|
-
h.split(
|
|
563
|
-
function(
|
|
564
|
-
|
|
561
|
+
h && (Q(
|
|
562
|
+
h.split(st),
|
|
563
|
+
function(_t, W, j, vt) {
|
|
564
|
+
vt.push(j[W]);
|
|
565
565
|
},
|
|
566
|
-
|
|
566
|
+
Vt,
|
|
567
567
|
f = []
|
|
568
|
-
),
|
|
569
|
-
|
|
570
|
-
function(
|
|
571
|
-
if (
|
|
572
|
-
return
|
|
568
|
+
), c.unshift.apply(c, f)), s = Q(
|
|
569
|
+
c,
|
|
570
|
+
function(_t, W, j) {
|
|
571
|
+
if (j[W] > 0)
|
|
572
|
+
return W;
|
|
573
573
|
},
|
|
574
574
|
S
|
|
575
575
|
);
|
|
576
|
-
var
|
|
576
|
+
var y = 0, w = 0, b = 0;
|
|
577
577
|
if (s != null) {
|
|
578
|
-
var
|
|
579
|
-
|
|
580
|
-
var
|
|
578
|
+
var m = s == 0 || s == 2, N = s == 3 || s == 1;
|
|
579
|
+
y = N ? Math.min(o.left, x) : s == 2 ? o.right + r : S[0], d -= r * +m;
|
|
580
|
+
var k = Math.max(o.top, 0), $ = Math.min(
|
|
581
581
|
o.bottom,
|
|
582
582
|
i
|
|
583
|
-
),
|
|
584
|
-
|
|
585
|
-
|
|
583
|
+
), q = ($ - d + Math.min(i - d, k)) / 2;
|
|
584
|
+
w = Math.max(
|
|
585
|
+
m ? q : s == 3 ? o.top + a + r : Math.min(q, S[1]),
|
|
586
586
|
0
|
|
587
|
-
),
|
|
587
|
+
), N && o.left > x && (b = o.left - y - r + v / 2);
|
|
588
588
|
}
|
|
589
|
-
let
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
)
|
|
598
|
-
) + C : st, W["--tips-position-left"] = $ ? Math.min($, c - 3 * r) + C : st;
|
|
589
|
+
let X = l.classList, H = t.css;
|
|
590
|
+
X.remove(...ot), X.add(ot[s]), t.index = s, H.left = y + rt, H.top = w + rt;
|
|
591
|
+
let Y = H["--tips-arrow-top"] = m ? Math.min(
|
|
592
|
+
/* 底边距 */
|
|
593
|
+
Math.max(w, k) - w,
|
|
594
|
+
d - r
|
|
595
|
+
) : lt, J = u - 3 * r;
|
|
596
|
+
H["--tips-arrow"] = b > J - 10 || m && (Y + (d > 50 ? 15 : 0) > d || !Y) ? "hidden" : "visible", H["--tips-arrow-left"] = b ? Math.min(b, J) : lt;
|
|
599
597
|
}
|
|
600
|
-
const
|
|
598
|
+
const Jt = {
|
|
601
599
|
name: "Tips",
|
|
602
600
|
props: {
|
|
603
601
|
/* 是否显示 */
|
|
@@ -653,6 +651,11 @@ const Xt = {
|
|
|
653
651
|
delay: {
|
|
654
652
|
type: [String, Number],
|
|
655
653
|
default: 10
|
|
654
|
+
},
|
|
655
|
+
/* 显示箭头 */
|
|
656
|
+
borderRadius: {
|
|
657
|
+
type: [String, Number],
|
|
658
|
+
default: 10
|
|
656
659
|
}
|
|
657
660
|
},
|
|
658
661
|
watch: {
|
|
@@ -683,7 +686,7 @@ const Xt = {
|
|
|
683
686
|
},
|
|
684
687
|
/* 初始化 */
|
|
685
688
|
init() {
|
|
686
|
-
this.$el.nodeName != "#comment" &&
|
|
689
|
+
this.$el.nodeName != "#comment" && bt({
|
|
687
690
|
onresize: !1,
|
|
688
691
|
/* 监控的目标 */
|
|
689
692
|
target: this.$el.parentNode,
|
|
@@ -694,58 +697,60 @@ const Xt = {
|
|
|
694
697
|
/* CSS样式集合 */
|
|
695
698
|
css: this.css,
|
|
696
699
|
/* 偏移量 */
|
|
697
|
-
offset: +this.offset
|
|
700
|
+
offset: +this.offset >> 0
|
|
698
701
|
});
|
|
699
702
|
},
|
|
700
703
|
scrollListener() {
|
|
701
704
|
this.static || this.parent((t, e, i) => {
|
|
702
|
-
e ? p(t.addEventListener, t, "scroll",
|
|
705
|
+
e ? p(t.addEventListener, t, "scroll", A) : (p(L.observe, L, t), (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && (i = this.attr(t, "-tips-scroll"), i || (p(t.addEventListener, t, "scroll", A), this.attr(t, "-tips-scroll", "true"))));
|
|
703
706
|
});
|
|
704
707
|
}
|
|
705
708
|
},
|
|
706
709
|
mounted() {
|
|
707
710
|
B(
|
|
708
711
|
this.css,
|
|
709
|
-
|
|
712
|
+
C(
|
|
710
713
|
this.$props,
|
|
711
|
-
"color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size"
|
|
714
|
+
"color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size,borderRadius=>--tips-border-radius"
|
|
712
715
|
)
|
|
713
|
-
), this.init(),
|
|
716
|
+
), this.css["--arrow-size"] = Math.sqrt(2 * Math.pow((this.border || 3) * 2 + 2, 2)) / 2 >> 0, this.init(), V.delay = +this.delay, Yt((t) => {
|
|
714
717
|
this.scrollListener();
|
|
715
718
|
}), this.scrollListener();
|
|
716
719
|
},
|
|
717
720
|
unmounted() {
|
|
718
721
|
this.parent(function(t, e) {
|
|
719
|
-
p(t.removeEventListener, t, "scroll",
|
|
722
|
+
p(t.removeEventListener, t, "scroll", A), p(t.removeAttribute, t, "-tips-scroll", void 0), e || p(L.unobserve, L, t);
|
|
720
723
|
});
|
|
721
724
|
}
|
|
722
|
-
},
|
|
723
|
-
function
|
|
724
|
-
return i.visible ? (z(), M("div",
|
|
725
|
+
}, Kt = ["static"], Qt = { class: "tips-title" };
|
|
726
|
+
function Zt(t, e, i, r, n, l) {
|
|
727
|
+
return i.visible ? (z(), M("div", G({
|
|
725
728
|
key: 0,
|
|
726
729
|
class: "tips",
|
|
727
730
|
style: i.static ? null : n.css,
|
|
728
731
|
static: i.static ? "" : null
|
|
729
732
|
}, t.$attrs), [
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
733
|
+
g(t.$slots, "default", {}, () => [
|
|
734
|
+
g(t.$slots, "title", {}, () => [
|
|
735
|
+
R("div", Qt, F(i.title), 1)
|
|
736
|
+
], !0),
|
|
737
|
+
g(t.$slots, "content", {}, () => [
|
|
738
|
+
pt(F(i.content), 1)
|
|
739
|
+
], !0)
|
|
735
740
|
], !0)
|
|
736
|
-
], 16,
|
|
741
|
+
], 16, Kt)) : ft("", !0);
|
|
737
742
|
}
|
|
738
|
-
const
|
|
743
|
+
const te = /* @__PURE__ */ I(Jt, [["render", Zt], ["__scopeId", "data-v-8c83dee3"]]), ee = [Wt, Ft, Ut, te], ne = {
|
|
739
744
|
install(t) {
|
|
740
|
-
|
|
745
|
+
ee.forEach((e) => {
|
|
741
746
|
t.component("S" + e.name, e), t.component(e.name + "S", e);
|
|
742
747
|
});
|
|
743
748
|
}
|
|
744
749
|
};
|
|
745
750
|
export {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
+
Ft as Card,
|
|
752
|
+
Wt as Flyweight,
|
|
753
|
+
Ut as Stream,
|
|
754
|
+
te as Tips,
|
|
755
|
+
ne as default
|
|
751
756
|
};
|
package/README.md
CHANGED
|
@@ -6,6 +6,19 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://npmjs.com/package/@soei/flyweight)
|
|
8
8
|
|
|
9
|
+
```html
|
|
10
|
+
<!-- 版本 0.3.10 新增属Tips -->
|
|
11
|
+
<!-- arrow: 显示箭头 -->
|
|
12
|
+
<!-- [notice|warn|simply]: 内置样式, 不喜欢可以background="..." color="..." -->
|
|
13
|
+
<Tips
|
|
14
|
+
class="notice|warn|simply|arrow|animate"
|
|
15
|
+
...
|
|
16
|
+
/>
|
|
17
|
+
<Tips >
|
|
18
|
+
.....
|
|
19
|
+
</Tips>
|
|
20
|
+
```
|
|
21
|
+
|
|
9
22
|
```html
|
|
10
23
|
<!-- 版本 0.3.9 新增属Tips -->
|
|
11
24
|
<Tips
|
package/package.json
CHANGED