@soei/flyweight 0.3.2 → 0.3.5

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,31 +1,37 @@
1
- import { runer as p, isArray as X, each as _, merge as V, picker as H, isEmpty as Y, isSimplyType as F, isString as q } from "@soei/util";
2
- import { openBlock as y, createElementBlock as b, normalizeClass as D, normalizeStyle as k, createElementVNode as T, Fragment as G, renderList as M, renderSlot as g, mergeProps as A, createCommentVNode as J, createTextVNode as K, toDisplayString as Q, createBlock as Z, resolveDynamicComponent as ee, withCtx as te } from "vue";
3
- let se = /(\d+|[+\-\*/]|%)/g, I = {
4
- "+": (e, t) => e + t,
5
- "-": (e, t) => e - t,
6
- "*": (e, t) => e * t,
7
- "/": (e, t) => e / t,
8
- "%": (e, t, s) => parseFloat(e) / 100 * s
9
- }, W = (e, t) => {
1
+ import { runer as y, merge as H, isArray as D, each as b, picker as R, isEmpty as G, isSimplyType as I, isString as J } from "@soei/util";
2
+ import { openBlock as m, createElementBlock as S, normalizeClass as P, normalizeStyle as k, createElementVNode as T, Fragment as U, renderList as X, renderSlot as p, mergeProps as E, createCommentVNode as K, createTextVNode as Q, toDisplayString as Z, createBlock as tt, resolveDynamicComponent as et, withCtx as st } from "vue";
3
+ let it = /(\d+|[+\-\*/]|%)/g, W = {
4
+ "+": (t, e) => t + e,
5
+ "-": (t, e) => t - e,
6
+ "*": (t, e) => t * e,
7
+ "/": (t, e) => t / e,
8
+ "%": (t, e, s) => parseFloat(t) / 100 * s
9
+ }, j = (t, e) => {
10
10
  let s;
11
- if (s = p("match", e, se)) {
12
- let h = s.length, l, r = 0, i, n = [];
13
- for (; h--; )
14
- r = s.shift(), r in I ? (l && n.push(l), r === "%" && (n.length = 2), i = r) : +r && n.push(+r), n.length == 2 && (n.push(t), l = I[i].apply(null, n), n.length = 0);
15
- +l || (l = +n.pop()), e = l >> 0;
11
+ if (s = y("match", t, it)) {
12
+ let l = s.length, h, r = 0, i, n = [];
13
+ for (; l--; )
14
+ r = s.shift(), r in W ? (h && n.push(h), r === "%" && (n.length = 2), i = r) : +r && n.push(+r), n.length == 2 && (n.push(e), h = W[i].apply(null, n), n.length = 0);
15
+ +h || (h = +n.pop()), t = h >> 0;
16
16
  }
17
- return e;
18
- }, O = (e) => (e + "").replace(/\w+\((.*)\)/g, "$1").replace(/(?=\s+|^)(\d+(\.\d+)*)(?!(?:\.)*\d|%|\w)/g, "$1px");
19
- const E = (e, t) => {
20
- const s = e.__vccOpts || e;
21
- for (const [h, l] of t)
22
- s[h] = l;
17
+ return t;
18
+ }, M = {}, u = (t, e) => (t + "").replace(
19
+ /\w+\((.*)\)/g,
20
+ "$1"
21
+ ).replace(
22
+ M[e] || (M[e] = new RegExp("(?=\\s+|^)(\\d+)(?:\\.\\d{1,})?(?!(?:\\.)*\\d|%|\\w)", "g")),
23
+ "$1px"
24
+ );
25
+ const F = (t, e) => {
26
+ const s = t.__vccOpts || t;
27
+ for (const [l, h] of e)
28
+ s[l] = h;
23
29
  return s;
24
30
  };
25
- let j = (e) => e == null || e == null, ie = (...e) => {
26
- console.info("::::FLYWEIGHT", ...e);
31
+ let V = (t) => t == null || t == null, lt = (...t) => {
32
+ console.info("::::FLYWEIGHT", ...t);
27
33
  };
28
- const le = {
34
+ const rt = {
29
35
  name: "Flyweight",
30
36
  props: {
31
37
  flys: {
@@ -40,6 +46,12 @@ const le = {
40
46
  type: Number,
41
47
  default: 100
42
48
  },
49
+ w: {
50
+ type: [Number, String]
51
+ },
52
+ h: {
53
+ type: [Number, String]
54
+ },
43
55
  offset: {
44
56
  type: Array,
45
57
  default: () => [0, 0]
@@ -80,6 +92,18 @@ const le = {
80
92
  computed: {
81
93
  flyweight() {
82
94
  return this.$refs.flyweight || "";
95
+ },
96
+ style() {
97
+ var t = this.w, e = this.h, s = this.Size, l = {};
98
+ return H(l, {
99
+ "--width": u(this.realW),
100
+ "--height": u(this.realH),
101
+ "--flyweight-content": u(s)
102
+ }, e && {
103
+ "--flyweight-h": u(e)
104
+ }, t && l, {
105
+ "--flyweight-w": u(t)
106
+ }, "mix"), l;
83
107
  }
84
108
  },
85
109
  data() {
@@ -97,82 +121,82 @@ const le = {
97
121
  };
98
122
  },
99
123
  watch: {
100
- flys(e) {
101
- this.count = e.length, this.rebuild();
102
- let t = this.task.shift();
103
- t && this.$nextTick(() => {
104
- this.setview(t);
124
+ flys(t) {
125
+ this.count = t.length, this.rebuild();
126
+ let e = this.task.shift();
127
+ e && this.$nextTick(() => {
128
+ this.setview(e);
105
129
  });
106
130
  },
107
131
  view: {
108
- handler(e) {
109
- this.setview(e);
132
+ handler(t) {
133
+ this.setview(t);
110
134
  },
111
135
  immediate: !0,
112
136
  deep: !0
113
137
  },
114
- index(e) {
115
- this.setindex(e);
138
+ index(t) {
139
+ this.setindex(t);
116
140
  },
117
- top(e) {
118
- this.flyweight.scrollTop = e;
141
+ top(t) {
142
+ this.flyweight.scrollTop = t;
119
143
  },
120
- left(e) {
121
- this.flyweight.scrollLeft = e;
144
+ left(t) {
145
+ this.flyweight.scrollLeft = t;
122
146
  }
123
147
  },
124
148
  mounted() {
125
- this.flyweights = [], this.$set || (this.$set = (e, t, s) => {
126
- e[t] = s;
149
+ this.flyweights = [], this.$set || (this.$set = (t, e, s) => {
150
+ t[e] = s;
127
151
  }), this.setindex(this.index);
128
152
  try {
129
153
  new ResizeObserver(() => {
130
154
  this.rebuild(), this.$emit("resize");
131
155
  }).observe(this.flyweight);
132
- } catch (e) {
133
- ie(e);
156
+ } catch (t) {
157
+ lt(t);
134
158
  }
135
- this.scrollx = p("hasAttribute", this.flyweight, "scroll-x"), this.BoxRule = /* this.scrollx ? 'clientHeight=>width,clientWidth=>height' : */
159
+ this.scrollx = y("hasAttribute", this.flyweight, "scroll-x"), this.BoxRule = /* this.scrollx ? 'clientHeight=>width,clientWidth=>height' : */
136
160
  "clientHeight=>height,clientWidth=>width", this.direction = this.scrollx ? "scrollLeft" : "scrollTop";
137
161
  },
138
162
  methods: {
139
- exec: O,
140
- trigger(e, t) {
141
- X(e) || (e = e && t ? [[e, t]] : []), e.length && this.lazyrun(() => {
142
- _(e, (s, h) => {
143
- this.$emit(h[0], j(h[1]) ? !0 : h[1]);
163
+ exec: u,
164
+ trigger(t, e) {
165
+ D(t) || (t = t && e ? [[t, e]] : []), t.length && this.lazyrun(() => {
166
+ b(t, (s, l) => {
167
+ this.$emit(l[0], V(l[1]) ? !0 : l[1]);
144
168
  });
145
169
  });
146
170
  },
147
- cheackflys(e) {
171
+ cheackflys(t) {
148
172
  if (!this.flys.length)
149
- return e && this.task.push(e), !0;
150
- },
151
- setview(e) {
152
- p([this.cheackflys, (t) => {
153
- t = t || {};
154
- let s = t.index || _(this.flys, (h, l, r, i) => {
155
- if (l[r] == i)
156
- return h;
157
- }, t.picker, t.id);
158
- j(s) || this.setindex(s);
159
- }], this, e);
160
- },
161
- setindex(e) {
162
- p([this.cheackflys, ({ index: t }) => {
163
- this.selectIndex = t, this.$nextTick(() => {
164
- let s = t / this.column >> 0, h = this.expand;
165
- (this.flyweight[this.direction] / h >> 0) + this.row - s - 1 > 0 || (this.flyweight[this.direction] = s * h, this.scroll());
173
+ return t && this.task.push(t), !0;
174
+ },
175
+ setview(t) {
176
+ y([this.cheackflys, (e) => {
177
+ e = e || {};
178
+ let s = e.index || b(this.flys, (l, h, r, i) => {
179
+ if (h[r] == i)
180
+ return l;
181
+ }, e.picker, e.id);
182
+ V(s) || this.setindex(s);
183
+ }], this, t);
184
+ },
185
+ setindex(t) {
186
+ y([this.cheackflys, ({ index: e }) => {
187
+ 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());
166
190
  });
167
- }], this, { index: e });
191
+ }], this, { index: t });
168
192
  },
169
- lazyrun(e, t) {
193
+ lazyrun(t, e) {
170
194
  clearTimeout(this.time), this.time = setTimeout(() => {
171
- p(e);
172
- }, t || this.lazy);
195
+ y(t);
196
+ }, e || this.lazy);
173
197
  },
174
- run(e) {
175
- let t = [], s = p(this.direction, e.target), h = {
198
+ run(t) {
199
+ let e = [], s = y(this.direction, t.target), l = {
176
200
  // ...this
177
201
  offset: s,
178
202
  top: s,
@@ -181,125 +205,134 @@ const le = {
181
205
  /* 显示区域第一行的索引 */
182
206
  index: s / this.expand >> 0
183
207
  };
184
- V(h, this.space), e.from || t.push(["onscroll", h]);
185
- let l = !1;
186
- _(
208
+ H(l, this.space), t.from || e.push(["onscroll", l]);
209
+ let h = !1;
210
+ b(
187
211
  this.flyweights,
188
- (r, i, n, a, u, c, d, f, o) => {
189
- if (n = r / u >> 0, f = n + a * /* 偏移量, 如果超出顶部 + 1轮,排列到列队后, 否则保持在当前*/
190
- (+(n < c % a) + (c / a >> 0)), o = f * u + r % u, o >= this.count) {
191
- l || (t.push(["onend"]), l = !0);
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);
192
216
  return;
193
217
  }
194
- i.index = f, i.i = o, i.data = this.flys[o];
195
- let m = [
218
+ i.index = g, i.i = o, i.data = this.flys[o];
219
+ let w = [
196
220
  /* top */
197
- f * this.expand + i.x,
221
+ g * this.expand + i.x,
198
222
  /* left */
199
223
  i.space
200
224
  ];
201
- d && m.reverse(), i.top = m[0], i.left = m[1];
225
+ f && w.reverse(), i.top = w[0], i.left = w[1];
202
226
  },
203
227
  null,
204
228
  this.row,
205
229
  this.column,
206
230
  /* 显示区域第一行的索引 */
207
- h.index,
231
+ l.index,
208
232
  this.scrollx
209
- ), this.trigger(t), t = null;
233
+ ), this.trigger(e), e = null;
210
234
  },
211
- scroll(e) {
212
- this.run(e || { target: this.flyweight, from: "space" });
235
+ scroll(t) {
236
+ this.run(t || { target: this.flyweight, from: "space" });
213
237
  },
214
238
  rebuild() {
215
- let e = this.count || this.flys.length, t = this.flyweights;
216
- if (!e)
217
- return t.length = e;
218
- this.count = e;
219
- let s = this.scrollx, h = this.flyweight, l = H(h, this.BoxRule);
239
+ let t = this.count || this.flys.length, e = this.flyweights;
240
+ if (!t)
241
+ return e.length = t;
242
+ this.count = t;
243
+ let s = this.scrollx, l = this.flyweight, h = R(l, this.BoxRule);
220
244
  this.$nextTick(() => {
221
- let r = /true/.test(this.auto), [i, n] = this.offset, a = l.width, u = l.height, c = (W(this.width, a) || a) + i, d = W(this.height, u) + n, f = [a / c >> 0 || 1, u / d >> 0 || 1];
222
- s && f.reverse();
223
- let [o, m] = f, z = this.padding, $, v = 0, w, B;
224
- s ? (w = c, c -= i, B = (x) => (
245
+ let r = /true/.test(this.auto), [i, n] = this.offset, c = h.width, d = h.height, a = (j(this.width, c) || c) + i, f = j(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 = (_) => (
225
249
  /* 计算top偏移量 */
226
- x * (d - n) + (x + 1) * n
227
- )) : (r ? (c = (a - i * (o + 2 * z - 1)) / o, $ = !z * i, v = z * i) : ($ = 0, v = (a % c + i * o) / (o + 1) >> 0, c -= i), B = (x) => x * (c + $) + (x + 1) * v, w = d), this.row = m + 2, this.column = o, this.realH = d - n, this.realW = c, this.expand = w, this.Size = Math.ceil(e / o) * w;
228
- let N = Math.min(e, o * this.row), S = N - 1, C;
229
- for (; N-- > 0; )
230
- C = S - N, this.$set(t, C, {
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, {
231
255
  x: i,
232
256
  y: n,
233
- width: c,
234
- height: d - n,
235
- space: B(C % o),
257
+ width: a,
258
+ height: f - n,
259
+ space: B(L % o),
236
260
  data: {}
237
261
  });
238
- t.length = S + 1;
239
- let L = [];
240
- u / w > S / o && L.push(["onend"]), this.flyweight && (this.flyweight[this.direction] = 0), this.$nextTick(() => {
262
+ e.length = $ + 1;
263
+ let A = [];
264
+ d / x > $ / o && A.push(["onend"]), this.flyweight && (this.flyweight[this.direction] = 0), this.$nextTick(() => {
241
265
  this.setindex(this.selectIndex || 0), this.scroll();
242
- }), L.push(["update:space", {
243
- row: (S / o >> 0) + 1,
266
+ }), A.push(["update:space", {
267
+ row: ($ / o >> 0) + 1,
244
268
  column: o,
245
269
  showrow: this.row,
246
270
  showcolumn: this.column
247
- }]), this.trigger(L);
271
+ }]), this.trigger(A);
248
272
  });
249
273
  }
250
274
  }
251
- }, re = { class: "flyweight-all" };
252
- function he(e, t, s, h, l, r) {
253
- return y(), b("div", {
275
+ }, ht = { class: "flyweight-all" };
276
+ function nt(t, e, s, l, h, r) {
277
+ return m(), S("div", {
254
278
  ref: "flyweight",
255
- class: D(["flyweight", {
256
- "flyweight-active": l.actice
279
+ class: P(["flyweight", {
280
+ "flyweight-active": h.actice
257
281
  }]),
258
- style: k({
259
- "--width": r.exec(l.realW),
260
- "--height": r.exec(l.realH),
261
- "--flyweight-content": r.exec(l.Size)
262
- }),
263
- onScroll: t[0] || (t[0] = (...i) => r.scroll && r.scroll(...i))
282
+ style: k(r.style),
283
+ onScroll: e[0] || (e[0] = (...i) => r.scroll && r.scroll(...i))
264
284
  }, [
265
- T("div", re, [
266
- (y(!0), b(G, null, M(l.flyweights, (i, n) => (y(), b("div", {
285
+ T("div", ht, [
286
+ (m(!0), S(U, null, X(h.flyweights, (i, n) => (m(), S("div", {
267
287
  key: n,
268
288
  style: k({
269
289
  top: i.top + "px",
270
290
  left: i.left + "px"
271
291
  })
272
292
  }, [
273
- g(e.$slots, "default", A({ ref_for: !0 }, i), void 0, !0)
293
+ p(t.$slots, "default", E({ ref_for: !0 }, i), void 0, !0)
274
294
  ], 4))), 128))
275
295
  ]),
276
- l.flyweights.length ? g(e.$slots, "end", { key: 0 }, void 0, !0) : J("", !0)
296
+ h.flyweights.length ? p(t.$slots, "end", { key: 0 }, void 0, !0) : K("", !0)
277
297
  ], 38);
278
298
  }
279
- const ne = /* @__PURE__ */ E(le, [["render", he], ["__scopeId", "data-v-5ecef76b"]]);
280
- function R(e, t) {
281
- return t && (e = e.replace(/[a-z]/g, "")), e.toLowerCase();
299
+ const ot = /* @__PURE__ */ F(rt, [["render", nt], ["__scopeId", "data-v-ae52e0f1"]]);
300
+ function O(t, e) {
301
+ return e && (t = t.replace(/[a-z]/g, "")), t.toLowerCase();
282
302
  }
283
- let P = {
303
+ let Y = {
284
304
  close: {
285
- handler(e) {
286
- this.change(e);
305
+ handler(t) {
306
+ this.change(t);
287
307
  },
288
308
  deep: !0
289
309
  },
290
310
  offset: {
291
- handler(e) {
292
- this.margin(e);
311
+ handler(t) {
312
+ this.margin(t);
293
313
  },
294
314
  deep: !0
295
315
  }
296
- }, oe = ["BackGround", "BordeR", "Height", "Width", "Top", "Right", "Bottom", "Left"], U = {};
297
- _(oe, (e, t, s) => {
298
- e = R(t), U["--" + R(t, !0)] = e, s[e] = function() {
299
- this.trigger++;
300
- };
301
- }, P);
302
- const ce = {
316
+ }, at = [
317
+ "BackGround",
318
+ "BordeR",
319
+ "Height",
320
+ "Width",
321
+ "Top",
322
+ "Right",
323
+ "Bottom",
324
+ "Left"
325
+ ], q = {};
326
+ b(
327
+ at,
328
+ (t, e, s) => {
329
+ t = O(e), q["--" + O(e, !0)] = t, s[t] = function() {
330
+ this.trigger++;
331
+ };
332
+ },
333
+ Y
334
+ );
335
+ const ct = {
303
336
  name: "Card",
304
337
  // inheritAttrs: false,
305
338
  props: {
@@ -358,65 +391,87 @@ const ce = {
358
391
  return this.tr();
359
392
  }
360
393
  },
361
- watch: P,
394
+ watch: Y,
362
395
  methods: {
363
- exec: O,
364
- isEmpty: Y,
365
- isSimplyType: F,
396
+ exec: u,
397
+ isEmpty: G,
398
+ isSimplyType: I,
366
399
  tr() {
367
- let e = {};
368
- return this.margin(this.offset), _(U, (t, s) => {
369
- this.css(e, t, s);
370
- }), e;
371
- },
372
- tolower: R,
373
- css(e, t, s) {
374
- let h = this[s] || this.default[s];
375
- !h || this.default[s] == h || (e[t] = O(h));
376
- },
377
- change(e) {
378
- F(e) || (this.closecss = H(e, "color=>--s-card-close-color,size=>--s-close-width,bold=>--s-close-height,*"));
379
- },
380
- margin(e) {
381
- V(this, H(
382
- q(e) ? e.split(/\s*(?:,|\s+)\s*/) : e,
383
- "0=>top,1|0=>right,2|0=>bottom,3|1|0=>left",
400
+ let t = {};
401
+ return this.margin(this.offset), b(q, (e, s) => {
402
+ this.css(t, e, s);
403
+ }), t;
404
+ },
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));
409
+ },
410
+ change(t) {
411
+ I(t) || (this.closecss = R(
412
+ t,
413
+ "color=>--s-card-close-color,size=>--s-close-width,bold=>--s-close-height,*"
414
+ ));
415
+ },
416
+ margin(t) {
417
+ H(
418
+ this,
419
+ R(
420
+ J(t) ? t.split(/\s*(?:,|\s+)\s*/) : t,
421
+ "0=>top,1|0=>right,2|0=>bottom,3|1|0=>left",
422
+ !0
423
+ ),
384
424
  !0
385
- ), !0);
425
+ );
386
426
  }
387
427
  },
388
428
  mounted() {
389
429
  this.change(this.close);
390
430
  }
391
- }, ae = { class: "card-title" }, ue = { class: "card-content" };
392
- function de(e, t, s, h, l, r) {
393
- return y(), b("div", {
431
+ }, ut = { class: "card-title" }, dt = ["title"], ft = { class: "card-content" };
432
+ function gt(t, e, s, l, h, r) {
433
+ return m(), S("div", {
394
434
  class: "card",
395
- key: l.trigger,
435
+ key: h.trigger,
396
436
  style: k(r.isEmpty(r.style) ? r.tr() : r.style)
397
437
  }, [
398
- g(e.$slots, "default", {}, () => [
399
- g(e.$slots, "title", {}, () => [
400
- T("div", ae, [
401
- K(Q(s.show || s.title) + " ", 1),
402
- T("div", {
403
- class: D(["card-close", { hide: r.isSimplyType(s.close) ? !s.close : !1 }]),
404
- style: k(l.closecss),
405
- onClick: t[0] || (t[0] = (i) => e.$emit("close"))
406
- }, null, 6)
407
- ])
408
- ], !0),
409
- g(e.$slots, "content", {}, () => [
410
- T("div", ue, [
411
- g(e.$slots, "inner", {}, void 0, !0)
438
+ p(t.$slots, "default", {}, () => [
439
+ p(t.$slots, "title", {}, () => {
440
+ var i;
441
+ return [
442
+ T("div", ut, [
443
+ Q(Z(s.show || s.title) + " ", 1),
444
+ T("div", {
445
+ class: P(["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, dt)
450
+ ])
451
+ ];
452
+ }, !0),
453
+ p(t.$slots, "content", {}, () => [
454
+ T("div", ft, [
455
+ p(t.$slots, "inner", {}, void 0, !0)
412
456
  ])
413
457
  ], !0)
414
458
  ], !0)
415
459
  ], 4);
416
460
  }
417
- const fe = /* @__PURE__ */ E(ce, [["render", de], ["__scopeId", "data-v-4c41de24"]]), ge = {
461
+ const pt = /* @__PURE__ */ F(ct, [["render", gt], ["__scopeId", "data-v-c1ad1d74"]]), yt = {
418
462
  name: "Stream",
463
+ computed: {
464
+ column() {
465
+ let { columns: t, T: e } = this, s = t || e;
466
+ return G(s) ? [] : D(s) ? s : [s];
467
+ }
468
+ },
419
469
  props: {
470
+ /* 桥接 指定数据字段为插槽名称 */
471
+ bridge: {
472
+ type: String,
473
+ default: "slot"
474
+ },
420
475
  type: {
421
476
  type: String,
422
477
  default: "div"
@@ -425,22 +480,26 @@ const fe = /* @__PURE__ */ E(ce, [["render", de], ["__scopeId", "data-v-4c41de24
425
480
  type: Array,
426
481
  default: () => []
427
482
  },
483
+ columns: {
484
+ type: Array,
485
+ default: () => null
486
+ },
428
487
  T: {
429
488
  type: Array,
430
- default: () => []
489
+ default: () => null
431
490
  }
432
491
  },
433
492
  methods: {
434
- trigger(e) {
435
- let t = e.slot || e.type;
436
- return (this.$scopedSlots || this.$slots)[t] ? t : "default";
493
+ trigger(t) {
494
+ let e = t[this.bridge] || t.type;
495
+ return (this.$scopedSlots || this.$slots)[e] ? e : "default";
437
496
  }
438
497
  }
439
498
  };
440
- function pe(e, t, s, h, l, r) {
441
- return y(), Z(ee(s.type), A(e.$attrs, { data: s.data }), {
442
- default: te(() => [
443
- (y(!0), b(G, null, M(s.T, (i) => g(e.$slots, r.trigger(i), A({
499
+ function mt(t, e, s, l, h, r) {
500
+ return m(), tt(et(s.type), E(t.$attrs, { data: s.data }), {
501
+ default: st(() => [
502
+ (m(!0), S(U, null, X(r.column, (i) => p(t.$slots, r.trigger(i), E({
444
503
  key: i.type,
445
504
  ref_for: !0
446
505
  }, i))), 128))
@@ -448,16 +507,16 @@ function pe(e, t, s, h, l, r) {
448
507
  _: 3
449
508
  }, 16, ["data"]);
450
509
  }
451
- const ye = /* @__PURE__ */ E(ge, [["render", pe]]), me = [ne, fe, ye], _e = {
452
- install(e) {
453
- me.forEach((t) => {
454
- e.component("S" + t.name, t), e.component(t.name + "S", t);
510
+ const wt = /* @__PURE__ */ F(yt, [["render", mt]]), xt = [ot, pt, wt], St = {
511
+ install(t) {
512
+ xt.forEach((e) => {
513
+ t.component("S" + e.name, e), t.component(e.name + "S", e);
455
514
  });
456
515
  }
457
516
  };
458
517
  export {
459
- fe as Card,
460
- ne as Flyweight,
461
- ye as Stream,
462
- _e as default
518
+ pt as Card,
519
+ ot as Flyweight,
520
+ wt as Stream,
521
+ St as default
463
522
  };
package/README.md CHANGED
@@ -7,6 +7,17 @@
7
7
  [![安装](https://img.shields.io/badge/-@soei-ae8aff?style=flat-square)![NPM Downloads by package author](https://img.shields.io/npm-stat/dw/soeiz?style=flat-square)](https://npmjs.com/package/@soei/flyweight)
8
8
 
9
9
  ```html
10
+ <!-- 版本 0.3.3 新增 属性 w, h, 默认 100% -->
11
+ <s-flyweight
12
+ ...
13
+ h="容器高"
14
+ w="容器宽"
15
+ width="内容宽"
16
+ height="内容高"
17
+ ></s-flyweight>
18
+
19
+ Or
20
+
10
21
  <div style="height:100px;width:300px;">
11
22
  <!-- 确认父容器 宽 高 存在, 依赖父容器 `宽`, `高` 计算 -->
12
23
  <s-flyweight ...></s-flyweight>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@soei/flyweight",
3
3
  "private": false,
4
4
  "description": "Vue组件, 列表de享元模式~减少DOM节点 flyweight, Card, Stream组件",
5
- "version": "0.3.2",
5
+ "version": "0.3.5",
6
6
  "type": "module",
7
7
  "main": "Flyweight.cjs",
8
8
  "module": "Flyweight.js",