@soei/flyweight 0.3.7 → 0.3.9
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 +396 -167
- package/README.md +24 -1
- package/package.json +2 -1
- package/style.css +1 -1
- package/vue2/index.cjs +1 -1
- package/vue2/index.js +462 -230
- package/vue2/style.css +1 -1
package/Flyweight.js
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
import { runer as
|
|
2
|
-
import { openBlock as
|
|
3
|
-
|
|
1
|
+
import { runer as T, merge as B, isArray as nt, each as H, picker as O, isEmpty as ot, isSimplyType as J, isString as bt } from "@soei/util";
|
|
2
|
+
import { openBlock as z, createElementBlock as M, normalizeClass as ht, normalizeStyle as I, createElementVNode as P, Fragment as at, renderList as ct, renderSlot as m, mergeProps as U, createCommentVNode as ut, createTextVNode as dt, toDisplayString as D, createBlock as xt, resolveDynamicComponent as vt, normalizeProps as St, guardReactiveProps as $t, withCtx as zt } from "vue";
|
|
3
|
+
import { runer as p, each as K } from "@soei/tools";
|
|
4
|
+
import kt from "@soei/picker";
|
|
5
|
+
let Nt = /(\d+|[+\-\*/]|%)/g, Q = {
|
|
4
6
|
"+": (t, e) => t + e,
|
|
5
7
|
"-": (t, e) => t - e,
|
|
6
8
|
"*": (t, e) => t * e,
|
|
7
9
|
"/": (t, e) => t / e,
|
|
8
|
-
"%": (t, e,
|
|
9
|
-
},
|
|
10
|
-
let
|
|
11
|
-
if (
|
|
12
|
-
let
|
|
13
|
-
for (;
|
|
14
|
-
|
|
15
|
-
+
|
|
10
|
+
"%": (t, e, i) => parseFloat(t) / 100 * i
|
|
11
|
+
}, Z = (t, e) => {
|
|
12
|
+
let i;
|
|
13
|
+
if (i = T("match", t, Nt)) {
|
|
14
|
+
let r = i.length, n, l = 0, s, h = [];
|
|
15
|
+
for (; r--; )
|
|
16
|
+
l = i.shift(), l in Q ? (n && h.push(n), l === "%" && (h.length = 2), s = l) : +l && h.push(+l), h.length == 2 && (h.push(e), n = Q[s].apply(null, h), h.length = 0);
|
|
17
|
+
+n || (n = +h.pop()), t = n >> 0;
|
|
16
18
|
}
|
|
17
19
|
return t;
|
|
18
|
-
},
|
|
20
|
+
}, tt = {}, b = (t, e) => (t + "").replace(
|
|
19
21
|
/\w+\((.*)\)/g,
|
|
20
22
|
"$1"
|
|
21
23
|
).replace(
|
|
22
|
-
|
|
24
|
+
tt[e] || (tt[e] = new RegExp("(?=\\s+|^)(\\d+)(?:\\.\\d{1,})?(?!(?:\\.)*\\d|%|\\w)", "g")),
|
|
23
25
|
"$1px"
|
|
24
26
|
);
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
for (const [
|
|
28
|
-
|
|
29
|
-
return
|
|
27
|
+
const j = (t, e) => {
|
|
28
|
+
const i = t.__vccOpts || t;
|
|
29
|
+
for (const [r, n] of e)
|
|
30
|
+
i[r] = n;
|
|
31
|
+
return i;
|
|
30
32
|
};
|
|
31
|
-
let
|
|
33
|
+
let et = (t) => t == null || t == null, Tt = (...t) => {
|
|
32
34
|
console.info("::::FLYWEIGHT", ...t);
|
|
33
35
|
};
|
|
34
|
-
const
|
|
36
|
+
const Mt = {
|
|
35
37
|
name: "Flyweight",
|
|
36
38
|
props: {
|
|
37
39
|
flys: {
|
|
@@ -39,11 +41,11 @@ const nt = {
|
|
|
39
41
|
default: () => []
|
|
40
42
|
},
|
|
41
43
|
width: {
|
|
42
|
-
type: Number,
|
|
44
|
+
type: [String, Number],
|
|
43
45
|
default: 0
|
|
44
46
|
},
|
|
45
47
|
height: {
|
|
46
|
-
type: Number,
|
|
48
|
+
type: [String, Number],
|
|
47
49
|
default: 100
|
|
48
50
|
},
|
|
49
51
|
w: {
|
|
@@ -69,12 +71,12 @@ const nt = {
|
|
|
69
71
|
default: 0
|
|
70
72
|
},
|
|
71
73
|
top: {
|
|
72
|
-
type: Number,
|
|
73
|
-
default:
|
|
74
|
+
type: [String, Number],
|
|
75
|
+
default: 0
|
|
74
76
|
},
|
|
75
77
|
left: {
|
|
76
|
-
type: Number,
|
|
77
|
-
default:
|
|
78
|
+
type: [String, Number],
|
|
79
|
+
default: 0
|
|
78
80
|
},
|
|
79
81
|
auto: {
|
|
80
82
|
type: [Boolean, String],
|
|
@@ -94,16 +96,16 @@ const nt = {
|
|
|
94
96
|
return this.$refs.flyweight || "";
|
|
95
97
|
},
|
|
96
98
|
style() {
|
|
97
|
-
var t = this.w, e = this.h,
|
|
98
|
-
return
|
|
99
|
-
"--width":
|
|
100
|
-
"--height":
|
|
101
|
-
"--flyweight-content":
|
|
99
|
+
var t = this.w, e = this.h, i = this.Size, r = {};
|
|
100
|
+
return B(r, {
|
|
101
|
+
"--width": b(this.realW),
|
|
102
|
+
"--height": b(this.realH),
|
|
103
|
+
"--flyweight-content": b(i)
|
|
102
104
|
}, e && {
|
|
103
|
-
"--flyweight-h":
|
|
104
|
-
}, t &&
|
|
105
|
-
"--flyweight-w":
|
|
106
|
-
}, "mix"),
|
|
105
|
+
"--flyweight-h": b(e)
|
|
106
|
+
}, t && r, {
|
|
107
|
+
"--flyweight-w": b(t)
|
|
108
|
+
}, "mix"), r;
|
|
107
109
|
}
|
|
108
110
|
},
|
|
109
111
|
data() {
|
|
@@ -146,25 +148,25 @@ const nt = {
|
|
|
146
148
|
}
|
|
147
149
|
},
|
|
148
150
|
mounted() {
|
|
149
|
-
this.flyweights = [], this.$set || (this.$set = (t, e,
|
|
150
|
-
t[e] =
|
|
151
|
+
this.flyweights = [], this.$set || (this.$set = (t, e, i) => {
|
|
152
|
+
t[e] = i;
|
|
151
153
|
}), this.setindex(this.index);
|
|
152
154
|
try {
|
|
153
155
|
new ResizeObserver(() => {
|
|
154
156
|
this.rebuild(), this.$emit("resize");
|
|
155
157
|
}).observe(this.flyweight);
|
|
156
158
|
} catch (t) {
|
|
157
|
-
|
|
159
|
+
Tt(t);
|
|
158
160
|
}
|
|
159
|
-
this.scrollx =
|
|
161
|
+
this.scrollx = T("hasAttribute", this.flyweight, "scroll-x"), this.BoxRule = /* this.scrollx ? 'clientHeight=>width,clientWidth=>height' : */
|
|
160
162
|
"clientHeight=>height,clientWidth=>width", this.direction = this.scrollx ? "scrollLeft" : "scrollTop";
|
|
161
163
|
},
|
|
162
164
|
methods: {
|
|
163
|
-
exec:
|
|
165
|
+
exec: b,
|
|
164
166
|
trigger(t, e) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
this.$emit(
|
|
167
|
+
nt(t) || (t = t && e ? [[t, e]] : []), t.length && this.lazyrun(() => {
|
|
168
|
+
H(t, (i, r) => {
|
|
169
|
+
this.$emit(r[0], et(r[1]) ? !0 : r[1]);
|
|
168
170
|
});
|
|
169
171
|
});
|
|
170
172
|
},
|
|
@@ -173,62 +175,62 @@ const nt = {
|
|
|
173
175
|
return t && this.task.push(t), !0;
|
|
174
176
|
},
|
|
175
177
|
setview(t) {
|
|
176
|
-
|
|
178
|
+
T([this.cheackflys, (e) => {
|
|
177
179
|
e = e || {};
|
|
178
|
-
let
|
|
179
|
-
if (
|
|
180
|
-
return
|
|
180
|
+
let i = e.index || H(this.flys, (r, n, l, s) => {
|
|
181
|
+
if (n[l] == s)
|
|
182
|
+
return r;
|
|
181
183
|
}, e.picker, e.id);
|
|
182
|
-
|
|
184
|
+
et(i) || this.setindex(i);
|
|
183
185
|
}], this, t);
|
|
184
186
|
},
|
|
185
187
|
setindex(t) {
|
|
186
|
-
|
|
188
|
+
T([this.cheackflys, ({ index: e }) => {
|
|
187
189
|
this.selectIndex = e, this.$nextTick(() => {
|
|
188
|
-
let
|
|
189
|
-
(this.flyweight[this.direction] /
|
|
190
|
+
let i = e / this.column >> 0, r = this.expand;
|
|
191
|
+
(this.flyweight[this.direction] / r >> 0) + this.row - i - 1 > 0 || (this.flyweight[this.direction] = i * r, this.scroll());
|
|
190
192
|
});
|
|
191
193
|
}], this, { index: t });
|
|
192
194
|
},
|
|
193
195
|
lazyrun(t, e) {
|
|
194
196
|
clearTimeout(this.time), this.time = setTimeout(() => {
|
|
195
|
-
|
|
197
|
+
T(t);
|
|
196
198
|
}, e || this.lazy);
|
|
197
199
|
},
|
|
198
200
|
run(t) {
|
|
199
|
-
let e = [],
|
|
201
|
+
let e = [], i = T(this.direction, t.target), r = {
|
|
200
202
|
// ...this
|
|
201
|
-
offset:
|
|
202
|
-
top:
|
|
203
|
+
offset: i,
|
|
204
|
+
top: i,
|
|
203
205
|
width: this.realW,
|
|
204
206
|
height: this.realH,
|
|
205
207
|
/* 显示区域第一行的索引 */
|
|
206
|
-
index:
|
|
208
|
+
index: i / this.expand >> 0
|
|
207
209
|
};
|
|
208
|
-
|
|
209
|
-
let
|
|
210
|
-
|
|
210
|
+
B(r, this.space), t.from || e.push(["onscroll", r]);
|
|
211
|
+
let n = !1;
|
|
212
|
+
H(
|
|
211
213
|
this.flyweights,
|
|
212
|
-
(
|
|
213
|
-
if (
|
|
214
|
-
(+(
|
|
215
|
-
|
|
214
|
+
(l, s, h, o, u, c, d, f, a) => {
|
|
215
|
+
if (h = l / u >> 0, f = h + o * /* 偏移量, 如果超出顶部 + 1轮,排列到列队后, 否则保持在当前*/
|
|
216
|
+
(+(h < c % o) + (c / o >> 0)), a = f * u + l % u, a >= this.count) {
|
|
217
|
+
n || (e.push(["onend"]), n = !0);
|
|
216
218
|
return;
|
|
217
219
|
}
|
|
218
|
-
|
|
219
|
-
let
|
|
220
|
+
s.index = f, s.i = a, s.data = this.flys[a];
|
|
221
|
+
let x = [
|
|
220
222
|
/* top */
|
|
221
|
-
|
|
223
|
+
f * this.expand + s.x,
|
|
222
224
|
/* left */
|
|
223
|
-
|
|
225
|
+
s.space
|
|
224
226
|
];
|
|
225
|
-
|
|
227
|
+
d && x.reverse(), s.top = x[0], s.left = x[1];
|
|
226
228
|
},
|
|
227
229
|
null,
|
|
228
230
|
this.row,
|
|
229
231
|
this.column,
|
|
230
232
|
/* 显示区域第一行的索引 */
|
|
231
|
-
|
|
233
|
+
r.index,
|
|
232
234
|
this.scrollx
|
|
233
235
|
), this.trigger(e), e = null;
|
|
234
236
|
},
|
|
@@ -240,67 +242,67 @@ const nt = {
|
|
|
240
242
|
if (!t)
|
|
241
243
|
return e.length = t;
|
|
242
244
|
this.count = t;
|
|
243
|
-
let
|
|
245
|
+
let i = this.scrollx, r = this.flyweight, n = O(r, this.BoxRule);
|
|
244
246
|
this.$nextTick(() => {
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
let [
|
|
248
|
-
|
|
247
|
+
let l = /true/.test(this.auto), [s, h] = this.offset, o = n.width, u = n.height, c = (Z(this.width, o) || o) + s, d = Z(this.height, u) + h, f = [o / c >> 0 || 1, u / d >> 0 || 1];
|
|
248
|
+
i && f.reverse();
|
|
249
|
+
let [a, x] = f, v = this.padding, L, S = 0, g, y;
|
|
250
|
+
i ? (g = c, c -= s, y = (_) => (
|
|
249
251
|
/* 计算top偏移量 */
|
|
250
|
-
_ * (
|
|
251
|
-
)) : (
|
|
252
|
-
let
|
|
253
|
-
for (;
|
|
254
|
-
|
|
255
|
-
x:
|
|
256
|
-
y:
|
|
257
|
-
width:
|
|
258
|
-
height:
|
|
259
|
-
space:
|
|
252
|
+
_ * (d - h) + (_ + 1) * h
|
|
253
|
+
)) : (l ? (c = (o - s * (a + 2 * v - 1)) / a, L = !v * s, S = v * s) : (L = 0, S = (o % c + s * a) / (a + 1) >> 0, c -= s), y = (_) => _ * (c + L) + (_ + 1) * S, g = d), this.row = x + 2, this.column = a, this.realH = d - h, this.realW = c, this.expand = g, this.Size = Math.ceil(t / a) * g;
|
|
254
|
+
let $ = Math.min(t, a * this.row), w = $ - 1, k;
|
|
255
|
+
for (; $-- > 0; )
|
|
256
|
+
k = w - $, this.$set(e, k, {
|
|
257
|
+
x: s,
|
|
258
|
+
y: h,
|
|
259
|
+
width: c,
|
|
260
|
+
height: d - h,
|
|
261
|
+
space: y(k % a),
|
|
260
262
|
data: {}
|
|
261
263
|
});
|
|
262
|
-
e.length =
|
|
263
|
-
let
|
|
264
|
-
|
|
264
|
+
e.length = w + 1;
|
|
265
|
+
let N = [];
|
|
266
|
+
u / g > w / a && N.push(["onend"]), this.flyweight && (this.flyweight[this.direction] = 0), this.$nextTick(() => {
|
|
265
267
|
this.setindex(this.selectIndex || 0), this.scroll();
|
|
266
|
-
}),
|
|
267
|
-
row: (
|
|
268
|
-
column:
|
|
268
|
+
}), N.push(["update:space", {
|
|
269
|
+
row: (w / a >> 0) + 1,
|
|
270
|
+
column: a,
|
|
269
271
|
showrow: this.row,
|
|
270
272
|
showcolumn: this.column
|
|
271
|
-
}]), this.trigger(
|
|
273
|
+
}]), this.trigger(N);
|
|
272
274
|
});
|
|
273
275
|
}
|
|
274
276
|
}
|
|
275
|
-
},
|
|
276
|
-
function
|
|
277
|
-
return
|
|
277
|
+
}, Lt = { class: "flyweight-all" };
|
|
278
|
+
function Et(t, e, i, r, n, l) {
|
|
279
|
+
return z(), M("div", {
|
|
278
280
|
ref: "flyweight",
|
|
279
|
-
class:
|
|
280
|
-
"flyweight-active":
|
|
281
|
+
class: ht(["flyweight", {
|
|
282
|
+
"flyweight-active": n.actice
|
|
281
283
|
}]),
|
|
282
|
-
style:
|
|
283
|
-
onScroll: e[0] || (e[0] = (...
|
|
284
|
+
style: I(l.style),
|
|
285
|
+
onScroll: e[0] || (e[0] = (...s) => l.scroll && l.scroll(...s))
|
|
284
286
|
}, [
|
|
285
|
-
|
|
286
|
-
(
|
|
287
|
-
key:
|
|
288
|
-
style:
|
|
289
|
-
top:
|
|
290
|
-
left:
|
|
287
|
+
P("div", Lt, [
|
|
288
|
+
(z(!0), M(at, null, ct(n.flyweights, (s, h) => (z(), M("div", {
|
|
289
|
+
key: h,
|
|
290
|
+
style: I({
|
|
291
|
+
top: s.top + "px",
|
|
292
|
+
left: s.left + "px"
|
|
291
293
|
})
|
|
292
294
|
}, [
|
|
293
|
-
|
|
295
|
+
m(t.$slots, "default", U({ ref_for: !0 }, s), void 0, !0)
|
|
294
296
|
], 4))), 128))
|
|
295
297
|
]),
|
|
296
|
-
|
|
298
|
+
n.flyweights.length ? m(t.$slots, "end", { key: 0 }, void 0, !0) : ut("", !0)
|
|
297
299
|
], 38);
|
|
298
300
|
}
|
|
299
|
-
const
|
|
300
|
-
function
|
|
301
|
+
const Ht = /* @__PURE__ */ j(Mt, [["render", Et], ["__scopeId", "data-v-35b94e9b"]]);
|
|
302
|
+
function G(t, e) {
|
|
301
303
|
return e && (t = t.replace(/[a-z]/g, "")), t.toLowerCase();
|
|
302
304
|
}
|
|
303
|
-
let
|
|
305
|
+
let ft = {
|
|
304
306
|
close: {
|
|
305
307
|
handler(t) {
|
|
306
308
|
this.change(t);
|
|
@@ -313,7 +315,7 @@ let Y = {
|
|
|
313
315
|
},
|
|
314
316
|
deep: !0
|
|
315
317
|
}
|
|
316
|
-
},
|
|
318
|
+
}, Pt = [
|
|
317
319
|
"BackGround",
|
|
318
320
|
"BordeR",
|
|
319
321
|
"Height",
|
|
@@ -322,17 +324,17 @@ let Y = {
|
|
|
322
324
|
"Right",
|
|
323
325
|
"Bottom",
|
|
324
326
|
"Left"
|
|
325
|
-
],
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
(t, e,
|
|
329
|
-
t =
|
|
327
|
+
], pt = {};
|
|
328
|
+
H(
|
|
329
|
+
Pt,
|
|
330
|
+
(t, e, i) => {
|
|
331
|
+
t = G(e), pt["--" + G(e, !0)] = t, i[t] = function() {
|
|
330
332
|
this.trigger++;
|
|
331
333
|
};
|
|
332
334
|
},
|
|
333
|
-
|
|
335
|
+
ft
|
|
334
336
|
);
|
|
335
|
-
const
|
|
337
|
+
const Wt = {
|
|
336
338
|
name: "Card",
|
|
337
339
|
// inheritAttrs: false,
|
|
338
340
|
props: {
|
|
@@ -391,33 +393,33 @@ const dt = {
|
|
|
391
393
|
return this.tr();
|
|
392
394
|
}
|
|
393
395
|
},
|
|
394
|
-
watch:
|
|
396
|
+
watch: ft,
|
|
395
397
|
methods: {
|
|
396
|
-
exec:
|
|
397
|
-
isEmpty:
|
|
398
|
-
isSimplyType:
|
|
398
|
+
exec: b,
|
|
399
|
+
isEmpty: ot,
|
|
400
|
+
isSimplyType: J,
|
|
399
401
|
tr() {
|
|
400
402
|
let t = {};
|
|
401
|
-
return this.margin(this.offset),
|
|
402
|
-
this.css(t, e,
|
|
403
|
+
return this.margin(this.offset), H(pt, (e, i) => {
|
|
404
|
+
this.css(t, e, i);
|
|
403
405
|
}), t;
|
|
404
406
|
},
|
|
405
|
-
tolower:
|
|
406
|
-
css(t, e,
|
|
407
|
-
let
|
|
408
|
-
!
|
|
407
|
+
tolower: G,
|
|
408
|
+
css(t, e, i) {
|
|
409
|
+
let r = this[i] || this.default[i];
|
|
410
|
+
!r || this.default[i] == r || (t[e] = b(r));
|
|
409
411
|
},
|
|
410
412
|
change(t) {
|
|
411
|
-
|
|
413
|
+
J(t) || (this.closecss = O(
|
|
412
414
|
t,
|
|
413
415
|
"color=>--s-card-close-color,size=>--s-close-width,bold=>--s-close-height,*"
|
|
414
416
|
));
|
|
415
417
|
},
|
|
416
418
|
margin(t) {
|
|
417
|
-
|
|
419
|
+
B(
|
|
418
420
|
this,
|
|
419
|
-
|
|
420
|
-
|
|
421
|
+
O(
|
|
422
|
+
bt(t) ? t.split(/\s*(?:,|\s+)\s*/) : t,
|
|
421
423
|
"0=>top,1|0=>right,2|0=>bottom,3|1|0=>left",
|
|
422
424
|
!0
|
|
423
425
|
),
|
|
@@ -428,42 +430,42 @@ const dt = {
|
|
|
428
430
|
mounted() {
|
|
429
431
|
this.change(this.close);
|
|
430
432
|
}
|
|
431
|
-
},
|
|
432
|
-
function
|
|
433
|
-
return
|
|
433
|
+
}, At = { class: "card-title" }, Ct = ["title"], Rt = { class: "card-content" };
|
|
434
|
+
function Bt(t, e, i, r, n, l) {
|
|
435
|
+
return z(), M("div", {
|
|
434
436
|
class: "card",
|
|
435
|
-
key:
|
|
436
|
-
style:
|
|
437
|
+
key: n.trigger,
|
|
438
|
+
style: I(l.isEmpty(l.style) ? l.tr() : l.style)
|
|
437
439
|
}, [
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
var
|
|
440
|
+
m(t.$slots, "default", {}, () => [
|
|
441
|
+
m(t.$slots, "title", {}, () => {
|
|
442
|
+
var s;
|
|
441
443
|
return [
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
class:
|
|
446
|
-
style:
|
|
447
|
-
onClick: e[0] || (e[0] = (
|
|
448
|
-
title: (
|
|
449
|
-
}, null, 14,
|
|
444
|
+
P("div", At, [
|
|
445
|
+
dt(D(i.show || i.title) + " ", 1),
|
|
446
|
+
P("div", {
|
|
447
|
+
class: ht(["card-close", { hide: l.isSimplyType(i.close) ? !i.close : !1 }]),
|
|
448
|
+
style: I(n.closecss),
|
|
449
|
+
onClick: e[0] || (e[0] = (h) => t.$emit("close")),
|
|
450
|
+
title: (s = i.close) == null ? void 0 : s.tips
|
|
451
|
+
}, null, 14, Ct)
|
|
450
452
|
])
|
|
451
453
|
];
|
|
452
454
|
}, !0),
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
455
|
+
m(t.$slots, "content", {}, () => [
|
|
456
|
+
P("div", Rt, [
|
|
457
|
+
m(t.$slots, "inner", {}, void 0, !0)
|
|
456
458
|
])
|
|
457
459
|
], !0)
|
|
458
460
|
], !0)
|
|
459
461
|
], 4);
|
|
460
462
|
}
|
|
461
|
-
const
|
|
463
|
+
const Ot = /* @__PURE__ */ j(Wt, [["render", Bt], ["__scopeId", "data-v-2008eeb3"]]), It = {
|
|
462
464
|
name: "Stream",
|
|
463
465
|
computed: {
|
|
464
466
|
column() {
|
|
465
|
-
let { columns: t, T: e } = this,
|
|
466
|
-
return
|
|
467
|
+
let { columns: t, T: e } = this, i = t || e;
|
|
468
|
+
return ot(i) ? [] : nt(i) ? i : [i];
|
|
467
469
|
}
|
|
468
470
|
},
|
|
469
471
|
props: {
|
|
@@ -485,7 +487,7 @@ const mt = /* @__PURE__ */ E(dt, [["render", yt], ["__scopeId", "data-v-c1ad1d74
|
|
|
485
487
|
default: () => null
|
|
486
488
|
},
|
|
487
489
|
T: {
|
|
488
|
-
type: Array,
|
|
490
|
+
type: [Array, Object],
|
|
489
491
|
default: () => null
|
|
490
492
|
}
|
|
491
493
|
},
|
|
@@ -496,27 +498,254 @@ const mt = /* @__PURE__ */ E(dt, [["render", yt], ["__scopeId", "data-v-c1ad1d74
|
|
|
496
498
|
}
|
|
497
499
|
}
|
|
498
500
|
};
|
|
499
|
-
function
|
|
500
|
-
return
|
|
501
|
-
default:
|
|
502
|
-
(
|
|
503
|
-
key:
|
|
504
|
-
|
|
505
|
-
}, i))), 128))
|
|
501
|
+
function jt(t, e, i, r, n, l) {
|
|
502
|
+
return z(), xt(vt(i.type), St($t(t.$attrs)), {
|
|
503
|
+
default: zt(() => [
|
|
504
|
+
(z(!0), M(at, null, ct(l.column, (s) => m(t.$slots, l.trigger(s), U({
|
|
505
|
+
key: s.type
|
|
506
|
+
}, { ref_for: !0 }, s))), 128))
|
|
506
507
|
]),
|
|
507
508
|
_: 3
|
|
508
509
|
}, 16);
|
|
509
510
|
}
|
|
510
|
-
const
|
|
511
|
+
const Ft = /* @__PURE__ */ j(It, [["render", jt]]), it = /(?:\,|\|{2})/, C = "px", st = "";
|
|
512
|
+
let gt = document.documentElement, rt, lt = ["s-left", "s-top", "s-right", "s-bottom"], Dt = { left: 0, top: 1, right: 2, bottom: 3 };
|
|
513
|
+
const V = [];
|
|
514
|
+
var Gt = kt(
|
|
515
|
+
window,
|
|
516
|
+
"Reflect.defineProperty|Object.defineProperty=>Proxy"
|
|
517
|
+
).Proxy;
|
|
518
|
+
let X = {}, yt = null;
|
|
519
|
+
Gt(X, "delay", {
|
|
520
|
+
/**
|
|
521
|
+
* 获取延迟时间值
|
|
522
|
+
* @returns {number} 返回当前实例的延迟时间属性值
|
|
523
|
+
*/
|
|
524
|
+
get() {
|
|
525
|
+
return this._delay;
|
|
526
|
+
},
|
|
527
|
+
set(t) {
|
|
528
|
+
yt = Ut(() => {
|
|
529
|
+
p(V);
|
|
530
|
+
}, t), this._delay = t;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
X.delay = 60;
|
|
534
|
+
function Ut(t, e) {
|
|
535
|
+
let i = 0;
|
|
536
|
+
return function() {
|
|
537
|
+
const r = Date.now();
|
|
538
|
+
r - i >= e && (i = r, p(t, this, arguments));
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
const R = () => {
|
|
542
|
+
yt();
|
|
543
|
+
};
|
|
544
|
+
function Vt(t) {
|
|
545
|
+
V.push(t);
|
|
546
|
+
}
|
|
547
|
+
const E = new ResizeObserver(R);
|
|
548
|
+
E.observe(gt);
|
|
549
|
+
function mt(t) {
|
|
550
|
+
t.onresize || (V.push([mt, null, t]), t.onresize = !0);
|
|
551
|
+
var e = gt, i = e.clientHeight, r = t.offset || 15, n = t.target, l = t.room, s = t.index, h = t.position, o = n.getBoundingClientRect(), u = l.offsetHeight + r, c = l.offsetWidth + r, d = "3,0,2,1".split(it), f, a = (o.height == rt ? o.bottom - o.top : o.height) >> 0, x = (o.width == rt ? o.right - o.left : o.width) >> 0, v = e.clientWidth - c, L = i - u, S = [
|
|
552
|
+
/* left: 0 */
|
|
553
|
+
o.left - c,
|
|
554
|
+
/* top: 1 */
|
|
555
|
+
o.top - u,
|
|
556
|
+
/* right: 2 */
|
|
557
|
+
v - o.right,
|
|
558
|
+
/* bottom: 3 */
|
|
559
|
+
L - o.bottom
|
|
560
|
+
];
|
|
561
|
+
h && (K(
|
|
562
|
+
h.split(it),
|
|
563
|
+
function(wt, A, F, _t) {
|
|
564
|
+
_t.push(F[A]);
|
|
565
|
+
},
|
|
566
|
+
Dt,
|
|
567
|
+
f = []
|
|
568
|
+
), d.unshift.apply(d, f)), s = K(
|
|
569
|
+
d,
|
|
570
|
+
function(wt, A, F) {
|
|
571
|
+
if (F[A] > 0)
|
|
572
|
+
return A;
|
|
573
|
+
},
|
|
574
|
+
S
|
|
575
|
+
);
|
|
576
|
+
var g = 0, y = 0, $ = 0;
|
|
577
|
+
if (s != null) {
|
|
578
|
+
var w = s == 0 || s == 2, k = s == 3 || s == 1;
|
|
579
|
+
g = k ? Math.min(o.left, v) : s == 2 ? o.right + r : S[0], u -= r * +w;
|
|
580
|
+
var N = Math.max(o.top, 0), _ = Math.min(
|
|
581
|
+
o.bottom,
|
|
582
|
+
i
|
|
583
|
+
), Y = (_ - u + Math.min(i - u, N)) / 2;
|
|
584
|
+
y = Math.max(
|
|
585
|
+
w ? Y : s == 3 ? o.top + a + r : Math.min(Y, S[1]),
|
|
586
|
+
0
|
|
587
|
+
), k && o.left > v && ($ = o.left - g - r + x / 2);
|
|
588
|
+
}
|
|
589
|
+
let q = l.classList, W = t.css;
|
|
590
|
+
q.remove(...lt), q.add(lt[s]), t.index = s, W.left = g + C, W.top = y + C, W["--tips-position-top"] = w ? Math.max(
|
|
591
|
+
r,
|
|
592
|
+
Math.min(
|
|
593
|
+
/* 底边距 */
|
|
594
|
+
(Math.min(y + u, _) + Math.max(y, N)) / 2 - y + r / 2,
|
|
595
|
+
/* 容器高度 - offset / 2 */
|
|
596
|
+
u - 0.5 * r
|
|
597
|
+
)
|
|
598
|
+
) + C : st, W["--tips-position-left"] = $ ? Math.min($, c - 3 * r) + C : st;
|
|
599
|
+
}
|
|
600
|
+
const Xt = {
|
|
601
|
+
name: "Tips",
|
|
602
|
+
props: {
|
|
603
|
+
/* 是否显示 */
|
|
604
|
+
visible: {
|
|
605
|
+
type: [Boolean, String, Number],
|
|
606
|
+
default: !0
|
|
607
|
+
},
|
|
608
|
+
/* 提示内容 */
|
|
609
|
+
content: {
|
|
610
|
+
type: String,
|
|
611
|
+
default: ""
|
|
612
|
+
},
|
|
613
|
+
/* 提示标题 */
|
|
614
|
+
title: {
|
|
615
|
+
type: [String, Number],
|
|
616
|
+
default: ""
|
|
617
|
+
},
|
|
618
|
+
/* 显示位置 */
|
|
619
|
+
position: {
|
|
620
|
+
type: String,
|
|
621
|
+
default: "top"
|
|
622
|
+
},
|
|
623
|
+
/* tips容器的偏移量 */
|
|
624
|
+
offset: {
|
|
625
|
+
type: [String, Number],
|
|
626
|
+
default: void 0
|
|
627
|
+
},
|
|
628
|
+
/* 字体大小 */
|
|
629
|
+
fontSize: {
|
|
630
|
+
type: [String, Number],
|
|
631
|
+
default: void 0
|
|
632
|
+
},
|
|
633
|
+
/* 边框宽度 */
|
|
634
|
+
border: {
|
|
635
|
+
type: [String, Number],
|
|
636
|
+
default: void 0
|
|
637
|
+
},
|
|
638
|
+
/* 边框和颜色 */
|
|
639
|
+
color: {
|
|
640
|
+
type: [String, Number],
|
|
641
|
+
default: void 0
|
|
642
|
+
},
|
|
643
|
+
/* 背景色 */
|
|
644
|
+
background: {
|
|
645
|
+
type: [String, Number],
|
|
646
|
+
default: void 0
|
|
647
|
+
},
|
|
648
|
+
/* 静态显示 */
|
|
649
|
+
static: {
|
|
650
|
+
type: Boolean,
|
|
651
|
+
default: !1
|
|
652
|
+
},
|
|
653
|
+
delay: {
|
|
654
|
+
type: [String, Number],
|
|
655
|
+
default: 10
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
watch: {
|
|
659
|
+
visible: function(t) {
|
|
660
|
+
t && this.$nextTick(() => {
|
|
661
|
+
this.init();
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
data() {
|
|
666
|
+
return {
|
|
667
|
+
css: {}
|
|
668
|
+
};
|
|
669
|
+
},
|
|
670
|
+
methods: {
|
|
671
|
+
parent(t) {
|
|
672
|
+
let e = this.$el, i;
|
|
673
|
+
for (; e && (e = e.parentNode, e && e.nodeType == 1 || (e = window, i = !0), p(t, null, e, i), !i); )
|
|
674
|
+
;
|
|
675
|
+
},
|
|
676
|
+
attr(t, e, i) {
|
|
677
|
+
return p(
|
|
678
|
+
t[i === void 0 ? "getAttribute" : "setAttribute"],
|
|
679
|
+
t,
|
|
680
|
+
e,
|
|
681
|
+
i
|
|
682
|
+
);
|
|
683
|
+
},
|
|
684
|
+
/* 初始化 */
|
|
685
|
+
init() {
|
|
686
|
+
this.$el.nodeName != "#comment" && mt({
|
|
687
|
+
onresize: !1,
|
|
688
|
+
/* 监控的目标 */
|
|
689
|
+
target: this.$el.parentNode,
|
|
690
|
+
/* 显示的元素 */
|
|
691
|
+
room: this.$el,
|
|
692
|
+
/* 显示位置 */
|
|
693
|
+
position: this.position,
|
|
694
|
+
/* CSS样式集合 */
|
|
695
|
+
css: this.css,
|
|
696
|
+
/* 偏移量 */
|
|
697
|
+
offset: +this.offset
|
|
698
|
+
});
|
|
699
|
+
},
|
|
700
|
+
scrollListener() {
|
|
701
|
+
this.static || this.parent((t, e, i) => {
|
|
702
|
+
e ? p(t.addEventListener, t, "scroll", R) : (p(E.observe, E, t), (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && (i = this.attr(t, "-tips-scroll"), i || (p(t.addEventListener, t, "scroll", R), this.attr(t, "-tips-scroll", "true"))));
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
},
|
|
706
|
+
mounted() {
|
|
707
|
+
B(
|
|
708
|
+
this.css,
|
|
709
|
+
O(
|
|
710
|
+
this.$props,
|
|
711
|
+
"color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size"
|
|
712
|
+
)
|
|
713
|
+
), this.init(), X.delay = +this.delay, Vt((t) => {
|
|
714
|
+
this.scrollListener();
|
|
715
|
+
}), this.scrollListener();
|
|
716
|
+
},
|
|
717
|
+
unmounted() {
|
|
718
|
+
this.parent(function(t, e) {
|
|
719
|
+
p(t.removeEventListener, t, "scroll", R), p(t.removeAttribute, t, "-tips-scroll", void 0), e || p(E.unobserve, E, t);
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
}, Yt = ["static"], qt = { class: "tips-title" };
|
|
723
|
+
function Jt(t, e, i, r, n, l) {
|
|
724
|
+
return i.visible ? (z(), M("div", U({
|
|
725
|
+
key: 0,
|
|
726
|
+
class: "tips",
|
|
727
|
+
style: i.static ? null : n.css,
|
|
728
|
+
static: i.static ? "" : null
|
|
729
|
+
}, t.$attrs), [
|
|
730
|
+
m(t.$slots, "title", {}, () => [
|
|
731
|
+
P("div", qt, D(i.title), 1)
|
|
732
|
+
], !0),
|
|
733
|
+
m(t.$slots, "content", {}, () => [
|
|
734
|
+
dt(D(i.content), 1)
|
|
735
|
+
], !0)
|
|
736
|
+
], 16, Yt)) : ut("", !0);
|
|
737
|
+
}
|
|
738
|
+
const Kt = /* @__PURE__ */ j(Xt, [["render", Jt], ["__scopeId", "data-v-660ad090"]]), Qt = [Ht, Ot, Ft, Kt], se = {
|
|
511
739
|
install(t) {
|
|
512
|
-
|
|
740
|
+
Qt.forEach((e) => {
|
|
513
741
|
t.component("S" + e.name, e), t.component(e.name + "S", e);
|
|
514
742
|
});
|
|
515
743
|
}
|
|
516
744
|
};
|
|
517
745
|
export {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
746
|
+
Ot as Card,
|
|
747
|
+
Ht as Flyweight,
|
|
748
|
+
Ft as Stream,
|
|
749
|
+
Kt as Tips,
|
|
750
|
+
se as default
|
|
522
751
|
};
|