@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.cjs +1 -1
- package/Flyweight.js +254 -195
- package/README.md +11 -0
- package/package.json +1 -1
- package/style.css +1 -1
- package/vue2/index.cjs +1 -1
- package/vue2/index.js +173 -117
- package/vue2/style.css +1 -1
package/Flyweight.js
CHANGED
|
@@ -1,31 +1,37 @@
|
|
|
1
|
-
import { runer as
|
|
2
|
-
import { openBlock as
|
|
3
|
-
let
|
|
4
|
-
"+": (
|
|
5
|
-
"-": (
|
|
6
|
-
"*": (
|
|
7
|
-
"/": (
|
|
8
|
-
"%": (
|
|
9
|
-
},
|
|
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 =
|
|
12
|
-
let
|
|
13
|
-
for (;
|
|
14
|
-
r = s.shift(), r in
|
|
15
|
-
+
|
|
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
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
26
|
-
console.info("::::FLYWEIGHT", ...
|
|
31
|
+
let V = (t) => t == null || t == null, lt = (...t) => {
|
|
32
|
+
console.info("::::FLYWEIGHT", ...t);
|
|
27
33
|
};
|
|
28
|
-
const
|
|
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(
|
|
101
|
-
this.count =
|
|
102
|
-
let
|
|
103
|
-
|
|
104
|
-
this.setview(
|
|
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(
|
|
109
|
-
this.setview(
|
|
132
|
+
handler(t) {
|
|
133
|
+
this.setview(t);
|
|
110
134
|
},
|
|
111
135
|
immediate: !0,
|
|
112
136
|
deep: !0
|
|
113
137
|
},
|
|
114
|
-
index(
|
|
115
|
-
this.setindex(
|
|
138
|
+
index(t) {
|
|
139
|
+
this.setindex(t);
|
|
116
140
|
},
|
|
117
|
-
top(
|
|
118
|
-
this.flyweight.scrollTop =
|
|
141
|
+
top(t) {
|
|
142
|
+
this.flyweight.scrollTop = t;
|
|
119
143
|
},
|
|
120
|
-
left(
|
|
121
|
-
this.flyweight.scrollLeft =
|
|
144
|
+
left(t) {
|
|
145
|
+
this.flyweight.scrollLeft = t;
|
|
122
146
|
}
|
|
123
147
|
},
|
|
124
148
|
mounted() {
|
|
125
|
-
this.flyweights = [], this.$set || (this.$set = (
|
|
126
|
-
e
|
|
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 (
|
|
133
|
-
|
|
156
|
+
} catch (t) {
|
|
157
|
+
lt(t);
|
|
134
158
|
}
|
|
135
|
-
this.scrollx =
|
|
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:
|
|
140
|
-
trigger(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this.$emit(
|
|
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(
|
|
171
|
+
cheackflys(t) {
|
|
148
172
|
if (!this.flys.length)
|
|
149
|
-
return
|
|
150
|
-
},
|
|
151
|
-
setview(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
let s =
|
|
155
|
-
if (
|
|
156
|
-
return
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
}], this,
|
|
160
|
-
},
|
|
161
|
-
setindex(
|
|
162
|
-
|
|
163
|
-
this.selectIndex =
|
|
164
|
-
let s =
|
|
165
|
-
(this.flyweight[this.direction] /
|
|
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:
|
|
191
|
+
}], this, { index: t });
|
|
168
192
|
},
|
|
169
|
-
lazyrun(
|
|
193
|
+
lazyrun(t, e) {
|
|
170
194
|
clearTimeout(this.time), this.time = setTimeout(() => {
|
|
171
|
-
|
|
172
|
-
},
|
|
195
|
+
y(t);
|
|
196
|
+
}, e || this.lazy);
|
|
173
197
|
},
|
|
174
|
-
run(
|
|
175
|
-
let
|
|
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
|
-
|
|
185
|
-
let
|
|
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,
|
|
189
|
-
if (n = r /
|
|
190
|
-
(+(n <
|
|
191
|
-
|
|
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 =
|
|
195
|
-
let
|
|
218
|
+
i.index = g, i.i = o, i.data = this.flys[o];
|
|
219
|
+
let w = [
|
|
196
220
|
/* top */
|
|
197
|
-
|
|
221
|
+
g * this.expand + i.x,
|
|
198
222
|
/* left */
|
|
199
223
|
i.space
|
|
200
224
|
];
|
|
201
|
-
|
|
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
|
-
|
|
231
|
+
l.index,
|
|
208
232
|
this.scrollx
|
|
209
|
-
), this.trigger(
|
|
233
|
+
), this.trigger(e), e = null;
|
|
210
234
|
},
|
|
211
|
-
scroll(
|
|
212
|
-
this.run(
|
|
235
|
+
scroll(t) {
|
|
236
|
+
this.run(t || { target: this.flyweight, from: "space" });
|
|
213
237
|
},
|
|
214
238
|
rebuild() {
|
|
215
|
-
let
|
|
216
|
-
if (!
|
|
217
|
-
return
|
|
218
|
-
this.count =
|
|
219
|
-
let s = this.scrollx,
|
|
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,
|
|
222
|
-
s &&
|
|
223
|
-
let [o,
|
|
224
|
-
s ? (
|
|
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
|
-
|
|
227
|
-
)) : (r ? (
|
|
228
|
-
let
|
|
229
|
-
for (;
|
|
230
|
-
|
|
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:
|
|
234
|
-
height:
|
|
235
|
-
space: B(
|
|
257
|
+
width: a,
|
|
258
|
+
height: f - n,
|
|
259
|
+
space: B(L % o),
|
|
236
260
|
data: {}
|
|
237
261
|
});
|
|
238
|
-
|
|
239
|
-
let
|
|
240
|
-
|
|
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
|
-
}),
|
|
243
|
-
row: (
|
|
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(
|
|
271
|
+
}]), this.trigger(A);
|
|
248
272
|
});
|
|
249
273
|
}
|
|
250
274
|
}
|
|
251
|
-
},
|
|
252
|
-
function
|
|
253
|
-
return
|
|
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:
|
|
256
|
-
"flyweight-active":
|
|
279
|
+
class: P(["flyweight", {
|
|
280
|
+
"flyweight-active": h.actice
|
|
257
281
|
}]),
|
|
258
|
-
style: k(
|
|
259
|
-
|
|
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",
|
|
266
|
-
(
|
|
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
|
-
|
|
293
|
+
p(t.$slots, "default", E({ ref_for: !0 }, i), void 0, !0)
|
|
274
294
|
], 4))), 128))
|
|
275
295
|
]),
|
|
276
|
-
|
|
296
|
+
h.flyweights.length ? p(t.$slots, "end", { key: 0 }, void 0, !0) : K("", !0)
|
|
277
297
|
], 38);
|
|
278
298
|
}
|
|
279
|
-
const
|
|
280
|
-
function
|
|
281
|
-
return
|
|
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
|
|
303
|
+
let Y = {
|
|
284
304
|
close: {
|
|
285
|
-
handler(
|
|
286
|
-
this.change(
|
|
305
|
+
handler(t) {
|
|
306
|
+
this.change(t);
|
|
287
307
|
},
|
|
288
308
|
deep: !0
|
|
289
309
|
},
|
|
290
310
|
offset: {
|
|
291
|
-
handler(
|
|
292
|
-
this.margin(
|
|
311
|
+
handler(t) {
|
|
312
|
+
this.margin(t);
|
|
293
313
|
},
|
|
294
314
|
deep: !0
|
|
295
315
|
}
|
|
296
|
-
},
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
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:
|
|
394
|
+
watch: Y,
|
|
362
395
|
methods: {
|
|
363
|
-
exec:
|
|
364
|
-
isEmpty:
|
|
365
|
-
isSimplyType:
|
|
396
|
+
exec: u,
|
|
397
|
+
isEmpty: G,
|
|
398
|
+
isSimplyType: I,
|
|
366
399
|
tr() {
|
|
367
|
-
let
|
|
368
|
-
return this.margin(this.offset),
|
|
369
|
-
this.css(
|
|
370
|
-
}),
|
|
371
|
-
},
|
|
372
|
-
tolower:
|
|
373
|
-
css(
|
|
374
|
-
let
|
|
375
|
-
!
|
|
376
|
-
},
|
|
377
|
-
change(
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
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
|
-
)
|
|
425
|
+
);
|
|
386
426
|
}
|
|
387
427
|
},
|
|
388
428
|
mounted() {
|
|
389
429
|
this.change(this.close);
|
|
390
430
|
}
|
|
391
|
-
},
|
|
392
|
-
function
|
|
393
|
-
return
|
|
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:
|
|
435
|
+
key: h.trigger,
|
|
396
436
|
style: k(r.isEmpty(r.style) ? r.tr() : r.style)
|
|
397
437
|
}, [
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
T("div",
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
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
|
|
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(
|
|
435
|
-
let
|
|
436
|
-
return (this.$scopedSlots || this.$slots)[
|
|
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
|
|
441
|
-
return
|
|
442
|
-
default:
|
|
443
|
-
(
|
|
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
|
|
452
|
-
install(
|
|
453
|
-
|
|
454
|
-
|
|
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
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
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://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>
|