@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.js CHANGED
@@ -1,37 +1,39 @@
1
- import { runer as y, merge as A, isArray as P, each as b, picker as H, isEmpty as V, isSimplyType as F, isString as J } from "@soei/util";
2
- import { openBlock as m, createElementBlock as S, normalizeClass as D, normalizeStyle as k, createElementVNode as T, Fragment as G, renderList as U, renderSlot as p, mergeProps as X, createCommentVNode as K, createTextVNode as Q, toDisplayString as Z, createBlock as tt, resolveDynamicComponent as et, normalizeProps as st, guardReactiveProps as it, withCtx as lt } from "vue";
3
- let rt = /(\d+|[+\-\*/]|%)/g, I = {
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, s) => parseFloat(t) / 100 * s
9
- }, W = (t, e) => {
10
- let s;
11
- if (s = y("match", t, rt)) {
12
- let l = s.length, h, r = 0, i, n = [];
13
- for (; l--; )
14
- r = s.shift(), r in I ? (h && n.push(h), r === "%" && (n.length = 2), i = r) : +r && n.push(+r), n.length == 2 && (n.push(e), h = I[i].apply(null, n), n.length = 0);
15
- +h || (h = +n.pop()), t = h >> 0;
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
- }, j = {}, u = (t, e) => (t + "").replace(
20
+ }, tt = {}, b = (t, e) => (t + "").replace(
19
21
  /\w+\((.*)\)/g,
20
22
  "$1"
21
23
  ).replace(
22
- j[e] || (j[e] = new RegExp("(?=\\s+|^)(\\d+)(?:\\.\\d{1,})?(?!(?:\\.)*\\d|%|\\w)", "g")),
24
+ tt[e] || (tt[e] = new RegExp("(?=\\s+|^)(\\d+)(?:\\.\\d{1,})?(?!(?:\\.)*\\d|%|\\w)", "g")),
23
25
  "$1px"
24
26
  );
25
- const E = (t, e) => {
26
- const s = t.__vccOpts || t;
27
- for (const [l, h] of e)
28
- s[l] = h;
29
- return s;
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 M = (t) => t == null || t == null, ht = (...t) => {
33
+ let et = (t) => t == null || t == null, Tt = (...t) => {
32
34
  console.info("::::FLYWEIGHT", ...t);
33
35
  };
34
- const nt = {
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: !1
74
+ type: [String, Number],
75
+ default: 0
74
76
  },
75
77
  left: {
76
- type: Number,
77
- default: !1
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, s = this.Size, l = {};
98
- return A(l, {
99
- "--width": u(this.realW),
100
- "--height": u(this.realH),
101
- "--flyweight-content": u(s)
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": u(e)
104
- }, t && l, {
105
- "--flyweight-w": u(t)
106
- }, "mix"), l;
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, s) => {
150
- t[e] = s;
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
- ht(t);
159
+ Tt(t);
158
160
  }
159
- this.scrollx = y("hasAttribute", this.flyweight, "scroll-x"), this.BoxRule = /* this.scrollx ? 'clientHeight=>width,clientWidth=>height' : */
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: u,
165
+ exec: b,
164
166
  trigger(t, e) {
165
- P(t) || (t = t && e ? [[t, e]] : []), t.length && this.lazyrun(() => {
166
- b(t, (s, l) => {
167
- this.$emit(l[0], M(l[1]) ? !0 : l[1]);
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
- y([this.cheackflys, (e) => {
178
+ T([this.cheackflys, (e) => {
177
179
  e = e || {};
178
- let s = e.index || b(this.flys, (l, h, r, i) => {
179
- if (h[r] == i)
180
- return l;
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
- M(s) || this.setindex(s);
184
+ et(i) || this.setindex(i);
183
185
  }], this, t);
184
186
  },
185
187
  setindex(t) {
186
- y([this.cheackflys, ({ index: e }) => {
188
+ T([this.cheackflys, ({ index: e }) => {
187
189
  this.selectIndex = e, this.$nextTick(() => {
188
- let s = e / this.column >> 0, l = this.expand;
189
- (this.flyweight[this.direction] / l >> 0) + this.row - s - 1 > 0 || (this.flyweight[this.direction] = s * l, this.scroll());
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
- y(t);
197
+ T(t);
196
198
  }, e || this.lazy);
197
199
  },
198
200
  run(t) {
199
- let e = [], s = y(this.direction, t.target), l = {
201
+ let e = [], i = T(this.direction, t.target), r = {
200
202
  // ...this
201
- offset: s,
202
- top: s,
203
+ offset: i,
204
+ top: i,
203
205
  width: this.realW,
204
206
  height: this.realH,
205
207
  /* 显示区域第一行的索引 */
206
- index: s / this.expand >> 0
208
+ index: i / this.expand >> 0
207
209
  };
208
- A(l, this.space), t.from || e.push(["onscroll", l]);
209
- let h = !1;
210
- b(
210
+ B(r, this.space), t.from || e.push(["onscroll", r]);
211
+ let n = !1;
212
+ H(
211
213
  this.flyweights,
212
- (r, i, n, c, d, a, f, g, o) => {
213
- if (n = r / d >> 0, g = n + c * /* 偏移量, 如果超出顶部 + 1轮,排列到列队后, 否则保持在当前*/
214
- (+(n < a % c) + (a / c >> 0)), o = g * d + r % d, o >= this.count) {
215
- h || (e.push(["onend"]), h = !0);
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
- i.index = g, i.i = o, i.data = this.flys[o];
219
- let w = [
220
+ s.index = f, s.i = a, s.data = this.flys[a];
221
+ let x = [
220
222
  /* top */
221
- g * this.expand + i.x,
223
+ f * this.expand + s.x,
222
224
  /* left */
223
- i.space
225
+ s.space
224
226
  ];
225
- f && w.reverse(), i.top = w[0], i.left = w[1];
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
- l.index,
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 s = this.scrollx, l = this.flyweight, h = H(l, this.BoxRule);
245
+ let i = this.scrollx, r = this.flyweight, n = O(r, this.BoxRule);
244
246
  this.$nextTick(() => {
245
- let r = /true/.test(this.auto), [i, n] = this.offset, c = h.width, d = h.height, a = (W(this.width, c) || c) + i, f = W(this.height, d) + n, g = [c / a >> 0 || 1, d / f >> 0 || 1];
246
- s && g.reverse();
247
- let [o, w] = g, z = this.padding, v, N = 0, x, B;
248
- s ? (x = a, a -= i, B = (_) => (
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
- _ * (f - n) + (_ + 1) * n
251
- )) : (r ? (a = (c - i * (o + 2 * z - 1)) / o, v = !z * i, N = z * i) : (v = 0, N = (c % a + i * o) / (o + 1) >> 0, a -= i), B = (_) => _ * (a + v) + (_ + 1) * N, x = f), this.row = w + 2, this.column = o, this.realH = f - n, this.realW = a, this.expand = x, this.Size = Math.ceil(t / o) * x;
252
- let C = Math.min(t, o * this.row), $ = C - 1, L;
253
- for (; C-- > 0; )
254
- L = $ - C, this.$set(e, L, {
255
- x: i,
256
- y: n,
257
- width: a,
258
- height: f - n,
259
- space: B(L % o),
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 = $ + 1;
263
- let R = [];
264
- d / x > $ / o && R.push(["onend"]), this.flyweight && (this.flyweight[this.direction] = 0), this.$nextTick(() => {
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
- }), R.push(["update:space", {
267
- row: ($ / o >> 0) + 1,
268
- column: o,
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(R);
273
+ }]), this.trigger(N);
272
274
  });
273
275
  }
274
276
  }
275
- }, ot = { class: "flyweight-all" };
276
- function at(t, e, s, l, h, r) {
277
- return m(), S("div", {
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: D(["flyweight", {
280
- "flyweight-active": h.actice
281
+ class: ht(["flyweight", {
282
+ "flyweight-active": n.actice
281
283
  }]),
282
- style: k(r.style),
283
- onScroll: e[0] || (e[0] = (...i) => r.scroll && r.scroll(...i))
284
+ style: I(l.style),
285
+ onScroll: e[0] || (e[0] = (...s) => l.scroll && l.scroll(...s))
284
286
  }, [
285
- T("div", ot, [
286
- (m(!0), S(G, null, U(h.flyweights, (i, n) => (m(), S("div", {
287
- key: n,
288
- style: k({
289
- top: i.top + "px",
290
- left: i.left + "px"
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
- p(t.$slots, "default", X({ ref_for: !0 }, i), void 0, !0)
295
+ m(t.$slots, "default", U({ ref_for: !0 }, s), void 0, !0)
294
296
  ], 4))), 128))
295
297
  ]),
296
- h.flyweights.length ? p(t.$slots, "end", { key: 0 }, void 0, !0) : K("", !0)
298
+ n.flyweights.length ? m(t.$slots, "end", { key: 0 }, void 0, !0) : ut("", !0)
297
299
  ], 38);
298
300
  }
299
- const ct = /* @__PURE__ */ E(nt, [["render", at], ["__scopeId", "data-v-ae52e0f1"]]);
300
- function O(t, e) {
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 Y = {
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
- }, ut = [
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
- ], q = {};
326
- b(
327
- ut,
328
- (t, e, s) => {
329
- t = O(e), q["--" + O(e, !0)] = t, s[t] = function() {
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
- Y
335
+ ft
334
336
  );
335
- const dt = {
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: Y,
396
+ watch: ft,
395
397
  methods: {
396
- exec: u,
397
- isEmpty: V,
398
- isSimplyType: F,
398
+ exec: b,
399
+ isEmpty: ot,
400
+ isSimplyType: J,
399
401
  tr() {
400
402
  let t = {};
401
- return this.margin(this.offset), b(q, (e, s) => {
402
- this.css(t, e, s);
403
+ return this.margin(this.offset), H(pt, (e, i) => {
404
+ this.css(t, e, i);
403
405
  }), t;
404
406
  },
405
- tolower: O,
406
- css(t, e, s) {
407
- let l = this[s] || this.default[s];
408
- !l || this.default[s] == l || (t[e] = u(l));
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
- F(t) || (this.closecss = H(
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
- A(
419
+ B(
418
420
  this,
419
- H(
420
- J(t) ? t.split(/\s*(?:,|\s+)\s*/) : t,
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
- }, ft = { class: "card-title" }, gt = ["title"], pt = { class: "card-content" };
432
- function yt(t, e, s, l, h, r) {
433
- return m(), S("div", {
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: h.trigger,
436
- style: k(r.isEmpty(r.style) ? r.tr() : r.style)
437
+ key: n.trigger,
438
+ style: I(l.isEmpty(l.style) ? l.tr() : l.style)
437
439
  }, [
438
- p(t.$slots, "default", {}, () => [
439
- p(t.$slots, "title", {}, () => {
440
- var i;
440
+ m(t.$slots, "default", {}, () => [
441
+ m(t.$slots, "title", {}, () => {
442
+ var s;
441
443
  return [
442
- T("div", ft, [
443
- Q(Z(s.show || s.title) + " ", 1),
444
- T("div", {
445
- class: D(["card-close", { hide: r.isSimplyType(s.close) ? !s.close : !1 }]),
446
- style: k(h.closecss),
447
- onClick: e[0] || (e[0] = (n) => t.$emit("close")),
448
- title: (i = s.close) == null ? void 0 : i.tips
449
- }, null, 14, gt)
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
- p(t.$slots, "content", {}, () => [
454
- T("div", pt, [
455
- p(t.$slots, "inner", {}, void 0, !0)
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 mt = /* @__PURE__ */ E(dt, [["render", yt], ["__scopeId", "data-v-c1ad1d74"]]), wt = {
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, s = t || e;
466
- return V(s) ? [] : P(s) ? s : [s];
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 xt(t, e, s, l, h, r) {
500
- return m(), tt(et(s.type), st(it(t.$attrs)), {
501
- default: lt(() => [
502
- (m(!0), S(G, null, U(r.column, (i) => p(t.$slots, r.trigger(i), X({
503
- key: i.type,
504
- ref_for: !0
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 _t = /* @__PURE__ */ E(wt, [["render", xt]]), bt = [ct, mt, _t], Tt = {
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
- bt.forEach((e) => {
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
- mt as Card,
519
- ct as Flyweight,
520
- _t as Stream,
521
- Tt as default
746
+ Ot as Card,
747
+ Ht as Flyweight,
748
+ Ft as Stream,
749
+ Kt as Tips,
750
+ se as default
522
751
  };