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