@soei/flyweight 0.3.10 → 0.3.12
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 +173 -166
- package/README.md +20 -0
- package/package.json +1 -1
- package/style.css +1 -1
- package/vue2/index.cjs +1 -1
- package/vue2/index.js +169 -162
- package/vue2/style.css +1 -1
package/Flyweight.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { runer as T, merge as
|
|
2
|
-
import { openBlock as
|
|
3
|
-
import { runer as p, each as
|
|
1
|
+
import { runer as T, merge as C, isArray as ht, each as W, picker as O, isEmpty as at, isSimplyType as K, isString as xt } from "@soei/util";
|
|
2
|
+
import { openBlock as N, createElementBlock as M, normalizeClass as dt, normalizeStyle as P, createElementVNode as B, Fragment as ct, renderList as ut, renderSlot as g, mergeProps as I, createCommentVNode as ft, createTextVNode as pt, toDisplayString as D, createBlock as St, resolveDynamicComponent as $t, withCtx as Nt } from "vue";
|
|
3
|
+
import { runer as p, isNil as zt, each as Q } from "@soei/tools";
|
|
4
4
|
import kt from "@soei/picker";
|
|
5
|
-
let
|
|
5
|
+
let Tt = /(\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, Tt)) {
|
|
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
27
|
const j = (t, e) => {
|
|
@@ -30,10 +30,10 @@ const j = (t, e) => {
|
|
|
30
30
|
i[r] = n;
|
|
31
31
|
return i;
|
|
32
32
|
};
|
|
33
|
-
let
|
|
33
|
+
let it = (t) => t == null || t == null, Mt = (...t) => {
|
|
34
34
|
console.info("::::FLYWEIGHT", ...t);
|
|
35
35
|
};
|
|
36
|
-
const
|
|
36
|
+
const Et = {
|
|
37
37
|
name: "Flyweight",
|
|
38
38
|
props: {
|
|
39
39
|
flys: {
|
|
@@ -97,7 +97,7 @@ const Mt = {
|
|
|
97
97
|
},
|
|
98
98
|
style() {
|
|
99
99
|
var t = this.w, e = this.h, i = this.Size, r = {};
|
|
100
|
-
return
|
|
100
|
+
return C(r, {
|
|
101
101
|
"--width": _(this.realW),
|
|
102
102
|
"--height": _(this.realH),
|
|
103
103
|
"--flyweight-content": _(i)
|
|
@@ -156,7 +156,7 @@ const Mt = {
|
|
|
156
156
|
this.rebuild(), this.$emit("resize");
|
|
157
157
|
}).observe(this.flyweight);
|
|
158
158
|
} catch (t) {
|
|
159
|
-
|
|
159
|
+
Mt(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
|
+
W(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 || W(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) {
|
|
@@ -207,24 +207,24 @@ const Mt = {
|
|
|
207
207
|
/* 显示区域第一行的索引 */
|
|
208
208
|
index: i / this.expand >> 0
|
|
209
209
|
};
|
|
210
|
-
|
|
210
|
+
C(r, this.space), t.from || e.push(["onscroll", r]);
|
|
211
211
|
let n = !1;
|
|
212
|
-
|
|
212
|
+
W(
|
|
213
213
|
this.flyweights,
|
|
214
|
-
(l, s, h, o,
|
|
215
|
-
if (h = l /
|
|
216
|
-
(+(h < c % o) + (c / o >> 0)), a = f *
|
|
214
|
+
(l, s, h, o, d, c, u, f, a) => {
|
|
215
|
+
if (h = l / d >> 0, f = h + o * /* 偏移量, 如果超出顶部 + 1轮,排列到列队后, 否则保持在当前*/
|
|
216
|
+
(+(h < c % o) + (c / 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
|
+
u && v.reverse(), s.top = v[0], s.left = v[1];
|
|
228
228
|
},
|
|
229
229
|
null,
|
|
230
230
|
this.row,
|
|
@@ -244,65 +244,65 @@ const Mt = {
|
|
|
244
244
|
this.count = t;
|
|
245
245
|
let i = this.scrollx, r = this.flyweight, n = O(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, c = (tt(this.width, o) || o) + s, u = tt(this.height, d) + h, f = [o / c >> 0 || 1, d / u >> 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 = c, c -= s, w = ($) => (
|
|
251
251
|
/* 计算top偏移量 */
|
|
252
|
-
|
|
253
|
-
)) : (l ? (c = (o - s * (a + 2 *
|
|
254
|
-
let
|
|
255
|
-
for (;
|
|
256
|
-
|
|
252
|
+
$ * (u - h) + ($ + 1) * h
|
|
253
|
+
)) : (l ? (c = (o - s * (a + 2 * x - 1)) / a, E = !x * s, S = x * s) : (E = 0, S = (o % c + s * a) / (a + 1) >> 0, c -= s), w = ($) => $ * (c + E) + ($ + 1) * S, y = u), this.row = v + 2, this.column = a, this.realH = u - h, this.realW = c, this.expand = y, this.Size = Math.ceil(t / a) * y;
|
|
254
|
+
let b = Math.min(t, a * this.row), m = b - 1, z;
|
|
255
|
+
for (; b-- > 0; )
|
|
256
|
+
z = m - b, this.$set(e, z, {
|
|
257
257
|
x: s,
|
|
258
258
|
y: h,
|
|
259
259
|
width: c,
|
|
260
|
-
height:
|
|
261
|
-
space:
|
|
260
|
+
height: u - h,
|
|
261
|
+
space: w(z % 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
|
|
279
|
-
return
|
|
277
|
+
}, Ht = { class: "flyweight-all" };
|
|
278
|
+
function Lt(t, e, i, r, n, l) {
|
|
279
|
+
return N(), M("div", {
|
|
280
280
|
ref: "flyweight",
|
|
281
|
-
class:
|
|
281
|
+
class: dt(["flyweight", {
|
|
282
282
|
"flyweight-active": n.actice
|
|
283
283
|
}]),
|
|
284
|
-
style:
|
|
284
|
+
style: P(l.style),
|
|
285
285
|
onScroll: e[0] || (e[0] = (...s) => l.scroll && l.scroll(...s))
|
|
286
286
|
}, [
|
|
287
|
-
|
|
288
|
-
(
|
|
287
|
+
B("div", Ht, [
|
|
288
|
+
(N(!0), M(ct, null, ut(n.flyweights, (s, h) => (N(), M("div", {
|
|
289
289
|
key: h,
|
|
290
|
-
style:
|
|
290
|
+
style: P({
|
|
291
291
|
top: s.top + "px",
|
|
292
292
|
left: s.left + "px"
|
|
293
293
|
})
|
|
294
294
|
}, [
|
|
295
|
-
|
|
295
|
+
g(t.$slots, "default", I({ 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
|
|
301
|
+
const Wt = /* @__PURE__ */ j(Et, [["render", Lt], ["__scopeId", "data-v-35b94e9b"]]);
|
|
302
302
|
function G(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
|
+
}, Bt = [
|
|
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
|
+
W(
|
|
329
|
+
Bt,
|
|
330
330
|
(t, e, i) => {
|
|
331
|
-
t = G(e),
|
|
331
|
+
t = G(e), yt["--" + G(e, !0)] = t, i[t] = function() {
|
|
332
332
|
this.trigger++;
|
|
333
333
|
};
|
|
334
334
|
},
|
|
335
|
-
|
|
335
|
+
gt
|
|
336
336
|
);
|
|
337
|
-
const
|
|
337
|
+
const Ct = {
|
|
338
338
|
name: "Card",
|
|
339
339
|
// inheritAttrs: false,
|
|
340
340
|
props: {
|
|
@@ -393,14 +393,14 @@ 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), W(yt, (e, i) => {
|
|
404
404
|
this.css(t, e, i);
|
|
405
405
|
}), t;
|
|
406
406
|
},
|
|
@@ -410,16 +410,16 @@ const Wt = {
|
|
|
410
410
|
!r || this.default[i] == r || (t[e] = _(r));
|
|
411
411
|
},
|
|
412
412
|
change(t) {
|
|
413
|
-
|
|
413
|
+
K(t) || (this.closecss = O(
|
|
414
414
|
t,
|
|
415
415
|
"color=>--s-card-close-color,size=>--s-close-width,bold=>--s-close-height,*"
|
|
416
416
|
));
|
|
417
417
|
},
|
|
418
418
|
margin(t) {
|
|
419
|
-
|
|
419
|
+
C(
|
|
420
420
|
this,
|
|
421
421
|
O(
|
|
422
|
-
|
|
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,45 @@ const Wt = {
|
|
|
430
430
|
mounted() {
|
|
431
431
|
this.change(this.close);
|
|
432
432
|
}
|
|
433
|
-
},
|
|
434
|
-
function
|
|
435
|
-
return
|
|
433
|
+
}, Rt = { class: "card-title" }, At = ["title"], Ot = { class: "card-content" };
|
|
434
|
+
function Pt(t, e, i, r, n, l) {
|
|
435
|
+
return N(), M("div", {
|
|
436
436
|
class: "card",
|
|
437
437
|
key: n.trigger,
|
|
438
|
-
style:
|
|
438
|
+
style: P(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
|
+
B("div", Rt, [
|
|
445
|
+
pt(D(i.show || i.title) + " ", 1),
|
|
446
|
+
B("div", {
|
|
447
|
+
class: dt(["card-close", { hide: l.isSimplyType(i.close) ? !i.close : !1 }]),
|
|
448
|
+
style: P(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, At)
|
|
452
452
|
])
|
|
453
453
|
];
|
|
454
454
|
}, !0),
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
455
|
+
g(t.$slots, "content", {}, () => [
|
|
456
|
+
B("div", Ot, [
|
|
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 It = /* @__PURE__ */ j(Ct, [["render", Pt], ["__scopeId", "data-v-2008eeb3"]]), jt = {
|
|
464
464
|
name: "Stream",
|
|
465
465
|
computed: {
|
|
466
|
+
component() {
|
|
467
|
+
return this.$refs.component;
|
|
468
|
+
},
|
|
466
469
|
column() {
|
|
467
470
|
let { columns: t, T: e } = this, i = t || e;
|
|
468
|
-
return
|
|
471
|
+
return at(i) ? [] : ht(i) ? i : [i];
|
|
469
472
|
}
|
|
470
473
|
},
|
|
471
474
|
props: {
|
|
@@ -478,10 +481,6 @@ const Ot = /* @__PURE__ */ j(Wt, [["render", Bt], ["__scopeId", "data-v-2008eeb3
|
|
|
478
481
|
type: String,
|
|
479
482
|
default: "div"
|
|
480
483
|
},
|
|
481
|
-
data: {
|
|
482
|
-
type: Array,
|
|
483
|
-
default: () => []
|
|
484
|
-
},
|
|
485
484
|
columns: {
|
|
486
485
|
type: [Object, Array],
|
|
487
486
|
default: () => null
|
|
@@ -491,32 +490,35 @@ const Ot = /* @__PURE__ */ j(Wt, [["render", Bt], ["__scopeId", "data-v-2008eeb3
|
|
|
491
490
|
default: () => null
|
|
492
491
|
}
|
|
493
492
|
},
|
|
493
|
+
mounted() {
|
|
494
|
+
this.$.vnode.ref && C(this, { ...this.component });
|
|
495
|
+
},
|
|
494
496
|
methods: {
|
|
495
|
-
|
|
497
|
+
__trigger(t) {
|
|
496
498
|
let e = t[this.bridge] || t.type;
|
|
497
499
|
return (this.$slots || this.$scopedSlots)[e] ? e : "default";
|
|
498
500
|
}
|
|
499
501
|
}
|
|
500
502
|
};
|
|
501
|
-
function
|
|
502
|
-
return
|
|
503
|
-
default:
|
|
504
|
-
(
|
|
503
|
+
function Ft(t, e, i, r, n, l) {
|
|
504
|
+
return N(), St($t(i.type), I({ ref: "component" }, t.$attrs), {
|
|
505
|
+
default: Nt(() => [
|
|
506
|
+
(N(!0), M(ct, null, ut(l.column, (s) => g(t.$slots, l.__trigger(s), I({
|
|
505
507
|
key: s.type
|
|
506
508
|
}, { ref_for: !0 }, s))), 128))
|
|
507
509
|
]),
|
|
508
510
|
_: 3
|
|
509
511
|
}, 16);
|
|
510
512
|
}
|
|
511
|
-
const
|
|
512
|
-
let
|
|
513
|
-
const
|
|
514
|
-
var
|
|
513
|
+
const Dt = /* @__PURE__ */ j(jt, [["render", Ft]]), st = /(?:\,|\|{2})/, rt = "px", lt = "";
|
|
514
|
+
let mt = document.documentElement, nt, ot = ["s-left", "s-top", "s-right", "s-bottom"], Gt = { left: 0, top: 1, right: 2, bottom: 3 };
|
|
515
|
+
const U = [];
|
|
516
|
+
var Ut = kt(
|
|
515
517
|
window,
|
|
516
518
|
"Reflect.defineProperty|Object.defineProperty=>Proxy"
|
|
517
519
|
).Proxy;
|
|
518
|
-
let
|
|
519
|
-
|
|
520
|
+
let V = {}, wt = null;
|
|
521
|
+
Ut(V, "delay", {
|
|
520
522
|
/**
|
|
521
523
|
* 获取延迟时间值
|
|
522
524
|
* @returns {number} 返回当前实例的延迟时间属性值
|
|
@@ -525,77 +527,75 @@ Gt(X, "delay", {
|
|
|
525
527
|
return this._delay;
|
|
526
528
|
},
|
|
527
529
|
set(t) {
|
|
528
|
-
|
|
529
|
-
p(
|
|
530
|
+
wt = Vt(() => {
|
|
531
|
+
p(U);
|
|
530
532
|
}, t), this._delay = t;
|
|
531
533
|
}
|
|
532
534
|
});
|
|
533
|
-
|
|
534
|
-
function
|
|
535
|
+
V.delay = 60;
|
|
536
|
+
function Vt(t, e) {
|
|
535
537
|
let i = 0;
|
|
536
538
|
return function() {
|
|
537
539
|
const r = Date.now();
|
|
538
540
|
r - i >= e && (i = r, p(t, this, arguments));
|
|
539
541
|
};
|
|
540
542
|
}
|
|
541
|
-
const
|
|
542
|
-
|
|
543
|
+
const A = () => {
|
|
544
|
+
wt();
|
|
543
545
|
};
|
|
544
|
-
function
|
|
545
|
-
|
|
546
|
+
function qt(t) {
|
|
547
|
+
U.push(t);
|
|
546
548
|
}
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
function
|
|
550
|
-
t.onresize || (
|
|
551
|
-
var e =
|
|
549
|
+
const L = new ResizeObserver(A);
|
|
550
|
+
L.observe(mt);
|
|
551
|
+
function bt(t) {
|
|
552
|
+
t.onresize || (U.push([bt, null, t]), t.onresize = !0);
|
|
553
|
+
var e = mt, i = e.clientHeight, r = zt(t.offset) ? 15 : t.offset, n = t.target, l = t.room, s = t.index, h = t.position, o = n.getBoundingClientRect(), d = l.offsetHeight + r, c = l.offsetWidth + r, u = "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 - c, E = i - d, S = [
|
|
552
554
|
/* left: 0 */
|
|
553
555
|
o.left - c,
|
|
554
556
|
/* top: 1 */
|
|
555
|
-
o.top -
|
|
557
|
+
o.top - d,
|
|
556
558
|
/* right: 2 */
|
|
557
|
-
|
|
559
|
+
x - o.right,
|
|
558
560
|
/* bottom: 3 */
|
|
559
|
-
|
|
561
|
+
E - o.bottom
|
|
560
562
|
];
|
|
561
|
-
h && (
|
|
562
|
-
h.split(
|
|
563
|
-
function(
|
|
564
|
-
|
|
563
|
+
h && (Q(
|
|
564
|
+
h.split(st),
|
|
565
|
+
function(_t, R, F, vt) {
|
|
566
|
+
vt.push(F[R]);
|
|
565
567
|
},
|
|
566
|
-
|
|
568
|
+
Gt,
|
|
567
569
|
f = []
|
|
568
|
-
),
|
|
569
|
-
|
|
570
|
-
function(
|
|
571
|
-
if (F[
|
|
572
|
-
return
|
|
570
|
+
), u.unshift.apply(u, f)), s = Q(
|
|
571
|
+
u,
|
|
572
|
+
function(_t, R, F) {
|
|
573
|
+
if (F[R] > 0)
|
|
574
|
+
return R;
|
|
573
575
|
},
|
|
574
576
|
S
|
|
575
577
|
);
|
|
576
|
-
var
|
|
578
|
+
var y = 0, w = 0, b = 0;
|
|
577
579
|
if (s != null) {
|
|
578
|
-
var
|
|
579
|
-
|
|
580
|
-
var
|
|
580
|
+
var m = s == 0 || s == 2, z = s == 3 || s == 1;
|
|
581
|
+
y = z ? Math.min(o.left, x) : s == 2 ? o.right + r : S[0], d -= r * +m;
|
|
582
|
+
var k = Math.max(o.top, 0), $ = Math.min(
|
|
581
583
|
o.bottom,
|
|
582
584
|
i
|
|
583
|
-
),
|
|
584
|
-
|
|
585
|
-
|
|
585
|
+
), q = ($ - d + Math.min(i - d, k)) / 2;
|
|
586
|
+
w = Math.max(
|
|
587
|
+
m ? q : s == 3 ? o.top + a + r : Math.min(q, S[1]),
|
|
586
588
|
0
|
|
587
|
-
),
|
|
589
|
+
), z && o.left > x && (b = o.left - y - r + v / 2);
|
|
588
590
|
}
|
|
589
|
-
let
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
)
|
|
598
|
-
) + C : st, W["--tips-position-left"] = $ ? Math.min($, c - 3 * r) + C : st;
|
|
591
|
+
let X = l.classList, H = t.css;
|
|
592
|
+
X.remove(...ot), X.add(ot[s]), t.index = s, H.left = y + rt, H.top = w + rt;
|
|
593
|
+
let Y = H["--tips-arrow-top"] = m ? Math.min(
|
|
594
|
+
/* 底边距 */
|
|
595
|
+
Math.max(w, k) - w,
|
|
596
|
+
d - r
|
|
597
|
+
) : lt, J = c - 3 * r;
|
|
598
|
+
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
599
|
}
|
|
600
600
|
const Xt = {
|
|
601
601
|
name: "Tips",
|
|
@@ -653,6 +653,11 @@ const Xt = {
|
|
|
653
653
|
delay: {
|
|
654
654
|
type: [String, Number],
|
|
655
655
|
default: 10
|
|
656
|
+
},
|
|
657
|
+
/* 显示箭头 */
|
|
658
|
+
borderRadius: {
|
|
659
|
+
type: [String, Number],
|
|
660
|
+
default: 10
|
|
656
661
|
}
|
|
657
662
|
},
|
|
658
663
|
watch: {
|
|
@@ -683,7 +688,7 @@ const Xt = {
|
|
|
683
688
|
},
|
|
684
689
|
/* 初始化 */
|
|
685
690
|
init() {
|
|
686
|
-
this.$el.nodeName != "#comment" &&
|
|
691
|
+
this.$el.nodeName != "#comment" && bt({
|
|
687
692
|
onresize: !1,
|
|
688
693
|
/* 监控的目标 */
|
|
689
694
|
target: this.$el.parentNode,
|
|
@@ -694,58 +699,60 @@ const Xt = {
|
|
|
694
699
|
/* CSS样式集合 */
|
|
695
700
|
css: this.css,
|
|
696
701
|
/* 偏移量 */
|
|
697
|
-
offset: +this.offset
|
|
702
|
+
offset: +this.offset >> 0
|
|
698
703
|
});
|
|
699
704
|
},
|
|
700
705
|
scrollListener() {
|
|
701
706
|
this.static || this.parent((t, e, i) => {
|
|
702
|
-
e ? p(t.addEventListener, t, "scroll",
|
|
707
|
+
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
708
|
});
|
|
704
709
|
}
|
|
705
710
|
},
|
|
706
711
|
mounted() {
|
|
707
|
-
|
|
712
|
+
C(
|
|
708
713
|
this.css,
|
|
709
714
|
O(
|
|
710
715
|
this.$props,
|
|
711
|
-
"color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size"
|
|
716
|
+
"color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size,borderRadius=>--tips-border-radius"
|
|
712
717
|
)
|
|
713
|
-
), this.init(),
|
|
718
|
+
), this.css["--arrow-size"] = Math.sqrt(2 * Math.pow((this.border || 3) * 2 + 2, 2)) / 2 >> 0, this.init(), V.delay = +this.delay, qt((t) => {
|
|
714
719
|
this.scrollListener();
|
|
715
720
|
}), this.scrollListener();
|
|
716
721
|
},
|
|
717
722
|
unmounted() {
|
|
718
723
|
this.parent(function(t, e) {
|
|
719
|
-
p(t.removeEventListener, t, "scroll",
|
|
724
|
+
p(t.removeEventListener, t, "scroll", A), p(t.removeAttribute, t, "-tips-scroll", void 0), e || p(L.unobserve, L, t);
|
|
720
725
|
});
|
|
721
726
|
}
|
|
722
|
-
}, Yt = ["static"],
|
|
723
|
-
function
|
|
724
|
-
return i.visible ? (
|
|
727
|
+
}, Yt = ["static"], Jt = { class: "tips-title" };
|
|
728
|
+
function Kt(t, e, i, r, n, l) {
|
|
729
|
+
return i.visible ? (N(), M("div", I({
|
|
725
730
|
key: 0,
|
|
726
731
|
class: "tips",
|
|
727
732
|
style: i.static ? null : n.css,
|
|
728
733
|
static: i.static ? "" : null
|
|
729
734
|
}, t.$attrs), [
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
+
g(t.$slots, "default", {}, () => [
|
|
736
|
+
g(t.$slots, "title", {}, () => [
|
|
737
|
+
B("div", Jt, D(i.title), 1)
|
|
738
|
+
], !0),
|
|
739
|
+
g(t.$slots, "content", {}, () => [
|
|
740
|
+
pt(D(i.content), 1)
|
|
741
|
+
], !0)
|
|
735
742
|
], !0)
|
|
736
|
-
], 16, Yt)) :
|
|
743
|
+
], 16, Yt)) : ft("", !0);
|
|
737
744
|
}
|
|
738
|
-
const
|
|
745
|
+
const Qt = /* @__PURE__ */ j(Xt, [["render", Kt], ["__scopeId", "data-v-8c83dee3"]]), Zt = [Wt, It, Dt, Qt], re = {
|
|
739
746
|
install(t) {
|
|
740
|
-
|
|
747
|
+
Zt.forEach((e) => {
|
|
741
748
|
t.component("S" + e.name, e), t.component(e.name + "S", e);
|
|
742
749
|
});
|
|
743
750
|
}
|
|
744
751
|
};
|
|
745
752
|
export {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
753
|
+
It as Card,
|
|
754
|
+
Wt as Flyweight,
|
|
755
|
+
Dt as Stream,
|
|
756
|
+
Qt as Tips,
|
|
757
|
+
re as default
|
|
751
758
|
};
|
package/README.md
CHANGED
|
@@ -6,6 +6,26 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://npmjs.com/package/@soei/flyweight)
|
|
8
8
|
|
|
9
|
+
```html
|
|
10
|
+
<!-- 版本 0.3.12 优化 和 部分代码优化-->
|
|
11
|
+
<Card [space|space="around|evenly"|nothing]
|
|
12
|
+
...
|
|
13
|
+
/>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<!-- 版本 0.3.11 新增属Tips -->
|
|
18
|
+
<!-- arrow: 显示箭头 -->
|
|
19
|
+
<!-- [notice|warn|simply]: 内置样式, 不喜欢可以background="..." color="..." -->
|
|
20
|
+
<Tips
|
|
21
|
+
class="notice|warn|simply|arrow|animate"
|
|
22
|
+
...
|
|
23
|
+
/>
|
|
24
|
+
<Tips >
|
|
25
|
+
.....
|
|
26
|
+
</Tips>
|
|
27
|
+
```
|
|
28
|
+
|
|
9
29
|
```html
|
|
10
30
|
<!-- 版本 0.3.9 新增属Tips -->
|
|
11
31
|
<Tips
|