fangguo-component 1.1.0 → 1.1.2
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/CHANGELOG.md +36 -1
- package/README.md +13 -11
- package/dist/{CustomInputV2-DYEcbu5_.js → CustomInputV2-uARhbFc8.js} +12 -12
- package/dist/CustomInputV2.css +1 -1
- package/dist/DragResizable.css +1 -1
- package/dist/DragResizable.vue_vue_type_style_index_0_lang-CHv0gJmo.js +179 -0
- package/dist/FgCascader.css +1 -1
- package/dist/FgCascader.vue_vue_type_style_index_0_lang-BUZDDcVn.js +1656 -0
- package/dist/{HSelect-Bqz2yTMf.js → HSelect-Drf6YBwO.js} +69 -69
- package/dist/{HSelectAll.vue_vue_type_script_setup_true_lang-C8i6LF_k.js → HSelectAll.vue_vue_type_script_setup_true_lang-Blq9xpfa.js} +1 -1
- package/dist/{HSelectSJ-BieRp2gG.js → HSelectSJ-D3GrXmvj.js} +104 -104
- package/dist/SelectTree-Dm5259kY.js +911 -0
- package/dist/SelectTree.css +1 -1
- package/dist/TextCopy-hOj-Wj2H.js +41 -0
- package/dist/TextCopy.css +1 -0
- package/dist/VirtualTable-BWugJiQ5.js +349 -0
- package/dist/VirtualTable.css +1 -1
- package/dist/components/VirtualTable/VirtualTable.vue.d.ts +3 -3
- package/dist/components/VirtualTable/index.d.ts +1 -0
- package/dist/components/VirtualTable/index.js +1 -1
- package/dist/components/cascader/cascader/ElCascader.vue.d.ts +3 -0
- package/dist/components/cascader/cascader/FgCascader.vue.d.ts +16 -4
- package/dist/components/cascader/cascader/cascader.d.ts +1 -0
- package/dist/components/cascader/index.js +1 -1
- package/dist/components/citySelect/demos/mockAddressTree.d.ts +8 -0
- package/dist/components/customInputV2/CustomInputV2.vue.d.ts +1 -1
- package/dist/components/customInputV2/index.js +1 -1
- package/dist/components/dragResizable/DragResizable.vue.d.ts +2 -0
- package/dist/components/dragResizable/index.js +1 -1
- package/dist/components/hSelect/demos/mockApi.d.ts +12 -0
- package/dist/components/hSelect/index.js +1 -1
- package/dist/components/hSelectAll/demos/mockApi.d.ts +10 -0
- package/dist/components/hSelectAll/index.js +1 -1
- package/dist/components/hSelectSJ/demos/mockApi.d.ts +11 -0
- package/dist/components/hSelectSJ/index.js +1 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.js +42 -46
- package/dist/components/selectAddress/demos/mockAddressTree.d.ts +7 -0
- package/dist/components/selectTimePicker/SelectTimePicker.vue.d.ts +1 -1
- package/dist/components/selectTree/demos/treeData.d.ts +9 -0
- package/dist/components/selectTree/index.js +1 -1
- package/dist/components/textCopy/index.js +1 -1
- package/dist/index-BRcBDlVs.js +68 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +145 -149
- package/dist/vue-virtual-scroller.esm-CH-jx4ri.js +1051 -0
- package/package.json +8 -8
- package/dist/DragResizable.vue_vue_type_style_index_0_lang-DYL6TUPE.js +0 -167
- package/dist/FgCascader.vue_vue_type_style_index_0_lang-OnqaEAao.js +0 -1807
- package/dist/SelectTree-C7lBZnZH.js +0 -306
- package/dist/SortTransfer.css +0 -1
- package/dist/SortTransfer.vue_vue_type_style_index_0_lang-C5OmBF3s.js +0 -153
- package/dist/TextCopy.vue_vue_type_script_setup_true_lang-DbhZGH_z.js +0 -29
- package/dist/TipInput-CIskitOV.js +0 -117
- package/dist/TipInput.css +0 -1
- package/dist/VirtualTable-BYTfwDC1.js +0 -353
- package/dist/components/sortTransfer/SortTransfer.vue.d.ts +0 -97
- package/dist/components/sortTransfer/index.d.ts +0 -1
- package/dist/components/sortTransfer/index.js +0 -4
- package/dist/components/tipInput/TipInput.vue.d.ts +0 -56
- package/dist/components/tipInput/index.d.ts +0 -1
- package/dist/components/tipInput/index.js +0 -4
- package/dist/debounce-BLrZUqsA.js +0 -84
- package/dist/index-BKzmtfeu.js +0 -72
- package/dist/isEqual-qYQTJBU6.js +0 -506
- package/dist/isObject-CO569sPG.js +0 -35
|
@@ -0,0 +1,1051 @@
|
|
|
1
|
+
var fe = Object.defineProperty, me = Object.defineProperties;
|
|
2
|
+
var pe = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var X = Object.getOwnPropertySymbols;
|
|
4
|
+
var ve = Object.prototype.hasOwnProperty, ye = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var G = (e, t, i) => t in e ? fe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i, C = (e, t) => {
|
|
6
|
+
for (var i in t || (t = {}))
|
|
7
|
+
ve.call(t, i) && G(e, i, t[i]);
|
|
8
|
+
if (X)
|
|
9
|
+
for (var i of X(t))
|
|
10
|
+
ye.call(t, i) && G(e, i, t[i]);
|
|
11
|
+
return e;
|
|
12
|
+
}, E = (e, t) => me(e, pe(t));
|
|
13
|
+
import { nextTick as ie, pushScopeId as be, popScopeId as ge, openBlock as _, createBlock as U, withScopeId as ze, markRaw as Se, shallowReactive as $e, h as _e, resolveComponent as se, resolveDirective as we, withDirectives as Ie, createElementBlock as x, normalizeClass as J, renderSlot as w, createCommentVNode as Q, resolveDynamicComponent as Z, normalizeStyle as Oe, withCtx as T, Fragment as Te, renderList as Re, mergeProps as re, toHandlers as Ve, createVNode as De, normalizeProps as ke, guardReactiveProps as Ae } from "vue";
|
|
14
|
+
function xe() {
|
|
15
|
+
var e = window.navigator.userAgent, t = e.indexOf("MSIE ");
|
|
16
|
+
if (t > 0)
|
|
17
|
+
return parseInt(e.substring(t + 5, e.indexOf(".", t)), 10);
|
|
18
|
+
var i = e.indexOf("Trident/");
|
|
19
|
+
if (i > 0) {
|
|
20
|
+
var s = e.indexOf("rv:");
|
|
21
|
+
return parseInt(e.substring(s + 3, e.indexOf(".", s)), 10);
|
|
22
|
+
}
|
|
23
|
+
var r = e.indexOf("Edge/");
|
|
24
|
+
return r > 0 ? parseInt(e.substring(r + 5, e.indexOf(".", r)), 10) : -1;
|
|
25
|
+
}
|
|
26
|
+
let M;
|
|
27
|
+
function N() {
|
|
28
|
+
N.init || (N.init = !0, M = xe() !== -1);
|
|
29
|
+
}
|
|
30
|
+
var H = {
|
|
31
|
+
name: "ResizeObserver",
|
|
32
|
+
props: {
|
|
33
|
+
emitOnMount: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: !1
|
|
36
|
+
},
|
|
37
|
+
ignoreWidth: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: !1
|
|
40
|
+
},
|
|
41
|
+
ignoreHeight: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !1
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
emits: [
|
|
47
|
+
"notify"
|
|
48
|
+
],
|
|
49
|
+
mounted() {
|
|
50
|
+
N(), ie(() => {
|
|
51
|
+
this._w = this.$el.offsetWidth, this._h = this.$el.offsetHeight, this.emitOnMount && this.emitSize();
|
|
52
|
+
});
|
|
53
|
+
const e = document.createElement("object");
|
|
54
|
+
this._resizeObject = e, e.setAttribute("aria-hidden", "true"), e.setAttribute("tabindex", -1), e.onload = this.addResizeHandlers, e.type = "text/html", M && this.$el.appendChild(e), e.data = "about:blank", M || this.$el.appendChild(e);
|
|
55
|
+
},
|
|
56
|
+
beforeUnmount() {
|
|
57
|
+
this.removeResizeHandlers();
|
|
58
|
+
},
|
|
59
|
+
methods: {
|
|
60
|
+
compareAndNotify() {
|
|
61
|
+
(!this.ignoreWidth && this._w !== this.$el.offsetWidth || !this.ignoreHeight && this._h !== this.$el.offsetHeight) && (this._w = this.$el.offsetWidth, this._h = this.$el.offsetHeight, this.emitSize());
|
|
62
|
+
},
|
|
63
|
+
emitSize() {
|
|
64
|
+
this.$emit("notify", {
|
|
65
|
+
width: this._w,
|
|
66
|
+
height: this._h
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
addResizeHandlers() {
|
|
70
|
+
this._resizeObject.contentDocument.defaultView.addEventListener("resize", this.compareAndNotify), this.compareAndNotify();
|
|
71
|
+
},
|
|
72
|
+
removeResizeHandlers() {
|
|
73
|
+
this._resizeObject && this._resizeObject.onload && (!M && this._resizeObject.contentDocument && this._resizeObject.contentDocument.defaultView.removeEventListener("resize", this.compareAndNotify), this.$el.removeChild(this._resizeObject), this._resizeObject.onload = null, this._resizeObject = null);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const Me = /* @__PURE__ */ ze("data-v-b329ee4c");
|
|
78
|
+
be("data-v-b329ee4c");
|
|
79
|
+
const Pe = {
|
|
80
|
+
class: "resize-observer",
|
|
81
|
+
tabindex: "-1"
|
|
82
|
+
};
|
|
83
|
+
ge();
|
|
84
|
+
const Ue = /* @__PURE__ */ Me((e, t, i, s, r, a) => (_(), U("div", Pe)));
|
|
85
|
+
H.render = Ue;
|
|
86
|
+
H.__scopeId = "data-v-b329ee4c";
|
|
87
|
+
H.__file = "src/components/ResizeObserver.vue";
|
|
88
|
+
function P(e) {
|
|
89
|
+
"@babel/helpers - typeof";
|
|
90
|
+
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? P = function(t) {
|
|
91
|
+
return typeof t;
|
|
92
|
+
} : P = function(t) {
|
|
93
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
94
|
+
}, P(e);
|
|
95
|
+
}
|
|
96
|
+
function He(e, t) {
|
|
97
|
+
if (!(e instanceof t))
|
|
98
|
+
throw new TypeError("Cannot call a class as a function");
|
|
99
|
+
}
|
|
100
|
+
function Ce(e, t) {
|
|
101
|
+
for (var i = 0; i < t.length; i++) {
|
|
102
|
+
var s = t[i];
|
|
103
|
+
s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(e, s.key, s);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function Ee(e, t, i) {
|
|
107
|
+
return t && Ce(e.prototype, t), e;
|
|
108
|
+
}
|
|
109
|
+
function ee(e) {
|
|
110
|
+
return Fe(e) || Ne(e) || Be(e) || Le();
|
|
111
|
+
}
|
|
112
|
+
function Fe(e) {
|
|
113
|
+
if (Array.isArray(e)) return B(e);
|
|
114
|
+
}
|
|
115
|
+
function Ne(e) {
|
|
116
|
+
if (typeof Symbol != "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
|
|
117
|
+
}
|
|
118
|
+
function Be(e, t) {
|
|
119
|
+
if (e) {
|
|
120
|
+
if (typeof e == "string") return B(e, t);
|
|
121
|
+
var i = Object.prototype.toString.call(e).slice(8, -1);
|
|
122
|
+
if (i === "Object" && e.constructor && (i = e.constructor.name), i === "Map" || i === "Set") return Array.from(e);
|
|
123
|
+
if (i === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)) return B(e, t);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function B(e, t) {
|
|
127
|
+
(t == null || t > e.length) && (t = e.length);
|
|
128
|
+
for (var i = 0, s = new Array(t); i < t; i++) s[i] = e[i];
|
|
129
|
+
return s;
|
|
130
|
+
}
|
|
131
|
+
function Le() {
|
|
132
|
+
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
133
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
134
|
+
}
|
|
135
|
+
function We(e) {
|
|
136
|
+
var t;
|
|
137
|
+
return typeof e == "function" ? t = {
|
|
138
|
+
callback: e
|
|
139
|
+
} : t = e, t;
|
|
140
|
+
}
|
|
141
|
+
function je(e, t) {
|
|
142
|
+
var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s, r, a, l = function(n) {
|
|
143
|
+
for (var h = arguments.length, p = new Array(h > 1 ? h - 1 : 0), z = 1; z < h; z++)
|
|
144
|
+
p[z - 1] = arguments[z];
|
|
145
|
+
if (a = p, !(s && n === r)) {
|
|
146
|
+
var I = i.leading;
|
|
147
|
+
typeof I == "function" && (I = I(n, r)), (!s || n !== r) && I && e.apply(void 0, [n].concat(ee(a))), r = n, clearTimeout(s), s = setTimeout(function() {
|
|
148
|
+
e.apply(void 0, [n].concat(ee(a))), s = 0;
|
|
149
|
+
}, t);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
return l._clear = function() {
|
|
153
|
+
clearTimeout(s), s = null;
|
|
154
|
+
}, l;
|
|
155
|
+
}
|
|
156
|
+
function ne(e, t) {
|
|
157
|
+
if (e === t) return !0;
|
|
158
|
+
if (P(e) === "object") {
|
|
159
|
+
for (var i in e)
|
|
160
|
+
if (!ne(e[i], t[i]))
|
|
161
|
+
return !1;
|
|
162
|
+
return !0;
|
|
163
|
+
}
|
|
164
|
+
return !1;
|
|
165
|
+
}
|
|
166
|
+
var qe = /* @__PURE__ */ (function() {
|
|
167
|
+
function e(t, i, s) {
|
|
168
|
+
He(this, e), this.el = t, this.observer = null, this.frozen = !1, this.createObserver(i, s);
|
|
169
|
+
}
|
|
170
|
+
return Ee(e, [{
|
|
171
|
+
key: "createObserver",
|
|
172
|
+
value: function(i, s) {
|
|
173
|
+
var r = this;
|
|
174
|
+
if (this.observer && this.destroyObserver(), !this.frozen) {
|
|
175
|
+
if (this.options = We(i), this.callback = function(o, n) {
|
|
176
|
+
r.options.callback(o, n), o && r.options.once && (r.frozen = !0, r.destroyObserver());
|
|
177
|
+
}, this.callback && this.options.throttle) {
|
|
178
|
+
var a = this.options.throttleOptions || {}, l = a.leading;
|
|
179
|
+
this.callback = je(this.callback, this.options.throttle, {
|
|
180
|
+
leading: function(n) {
|
|
181
|
+
return l === "both" || l === "visible" && n || l === "hidden" && !n;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
this.oldResult = void 0, this.observer = new IntersectionObserver(function(o) {
|
|
186
|
+
var n = o[0];
|
|
187
|
+
if (o.length > 1) {
|
|
188
|
+
var h = o.find(function(z) {
|
|
189
|
+
return z.isIntersecting;
|
|
190
|
+
});
|
|
191
|
+
h && (n = h);
|
|
192
|
+
}
|
|
193
|
+
if (r.callback) {
|
|
194
|
+
var p = n.isIntersecting && n.intersectionRatio >= r.threshold;
|
|
195
|
+
if (p === r.oldResult) return;
|
|
196
|
+
r.oldResult = p, r.callback(p, n);
|
|
197
|
+
}
|
|
198
|
+
}, this.options.intersection), ie(function() {
|
|
199
|
+
r.observer && r.observer.observe(r.el);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
key: "destroyObserver",
|
|
205
|
+
value: function() {
|
|
206
|
+
this.observer && (this.observer.disconnect(), this.observer = null), this.callback && this.callback._clear && (this.callback._clear(), this.callback = null);
|
|
207
|
+
}
|
|
208
|
+
}, {
|
|
209
|
+
key: "threshold",
|
|
210
|
+
get: function() {
|
|
211
|
+
return this.options.intersection && typeof this.options.intersection.threshold == "number" ? this.options.intersection.threshold : 0;
|
|
212
|
+
}
|
|
213
|
+
}]), e;
|
|
214
|
+
})();
|
|
215
|
+
function le(e, t, i) {
|
|
216
|
+
var s = t.value;
|
|
217
|
+
if (s)
|
|
218
|
+
if (typeof IntersectionObserver == "undefined")
|
|
219
|
+
console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill");
|
|
220
|
+
else {
|
|
221
|
+
var r = new qe(e, s, i);
|
|
222
|
+
e._vue_visibilityState = r;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function Ke(e, t, i) {
|
|
226
|
+
var s = t.value, r = t.oldValue;
|
|
227
|
+
if (!ne(s, r)) {
|
|
228
|
+
var a = e._vue_visibilityState;
|
|
229
|
+
if (!s) {
|
|
230
|
+
oe(e);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
a ? a.createObserver(s, i) : le(e, {
|
|
234
|
+
value: s
|
|
235
|
+
}, i);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function oe(e) {
|
|
239
|
+
var t = e._vue_visibilityState;
|
|
240
|
+
t && (t.destroyObserver(), delete e._vue_visibilityState);
|
|
241
|
+
}
|
|
242
|
+
var Ye = {
|
|
243
|
+
beforeMount: le,
|
|
244
|
+
updated: Ke,
|
|
245
|
+
unmounted: oe
|
|
246
|
+
};
|
|
247
|
+
function Xe(e) {
|
|
248
|
+
return { all: e = e || /* @__PURE__ */ new Map(), on: function(t, i) {
|
|
249
|
+
var s = e.get(t);
|
|
250
|
+
s && s.push(i) || e.set(t, [i]);
|
|
251
|
+
}, off: function(t, i) {
|
|
252
|
+
var s = e.get(t);
|
|
253
|
+
s && s.splice(s.indexOf(i) >>> 0, 1);
|
|
254
|
+
}, emit: function(t, i) {
|
|
255
|
+
(e.get(t) || []).slice().map(function(s) {
|
|
256
|
+
s(i);
|
|
257
|
+
}), (e.get("*") || []).slice().map(function(s) {
|
|
258
|
+
s(t, i);
|
|
259
|
+
});
|
|
260
|
+
} };
|
|
261
|
+
}
|
|
262
|
+
var Ge = {
|
|
263
|
+
itemsLimit: 1e3
|
|
264
|
+
}, Je = /(auto|scroll)/;
|
|
265
|
+
function ae(e, t) {
|
|
266
|
+
return e.parentNode === null ? t : ae(e.parentNode, t.concat([e]));
|
|
267
|
+
}
|
|
268
|
+
var F = function(t, i) {
|
|
269
|
+
return getComputedStyle(t, null).getPropertyValue(i);
|
|
270
|
+
}, Qe = function(t) {
|
|
271
|
+
return F(t, "overflow") + F(t, "overflow-y") + F(t, "overflow-x");
|
|
272
|
+
}, Ze = function(t) {
|
|
273
|
+
return Je.test(Qe(t));
|
|
274
|
+
};
|
|
275
|
+
function te(e) {
|
|
276
|
+
if (e instanceof HTMLElement || e instanceof SVGElement) {
|
|
277
|
+
for (var t = ae(e.parentNode, []), i = 0; i < t.length; i += 1)
|
|
278
|
+
if (Ze(t[i]))
|
|
279
|
+
return t[i];
|
|
280
|
+
return document.scrollingElement || document.documentElement;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function L(e) {
|
|
284
|
+
"@babel/helpers - typeof";
|
|
285
|
+
return L = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
286
|
+
return typeof t;
|
|
287
|
+
} : function(t) {
|
|
288
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
289
|
+
}, L(e);
|
|
290
|
+
}
|
|
291
|
+
var ce = {
|
|
292
|
+
items: {
|
|
293
|
+
type: Array,
|
|
294
|
+
required: !0
|
|
295
|
+
},
|
|
296
|
+
keyField: {
|
|
297
|
+
type: String,
|
|
298
|
+
default: "id"
|
|
299
|
+
},
|
|
300
|
+
direction: {
|
|
301
|
+
type: String,
|
|
302
|
+
default: "vertical",
|
|
303
|
+
validator: function(t) {
|
|
304
|
+
return ["vertical", "horizontal"].includes(t);
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
listTag: {
|
|
308
|
+
type: String,
|
|
309
|
+
default: "div"
|
|
310
|
+
},
|
|
311
|
+
itemTag: {
|
|
312
|
+
type: String,
|
|
313
|
+
default: "div"
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
function de() {
|
|
317
|
+
return this.items.length && L(this.items[0]) !== "object";
|
|
318
|
+
}
|
|
319
|
+
var W = !1;
|
|
320
|
+
if (typeof window != "undefined") {
|
|
321
|
+
W = !1;
|
|
322
|
+
try {
|
|
323
|
+
var et = Object.defineProperty({}, "passive", {
|
|
324
|
+
get: function() {
|
|
325
|
+
W = !0;
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
window.addEventListener("test", null, et);
|
|
329
|
+
} catch (e) {
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
let tt = 0;
|
|
333
|
+
var j = {
|
|
334
|
+
name: "RecycleScroller",
|
|
335
|
+
components: {
|
|
336
|
+
ResizeObserver: H
|
|
337
|
+
},
|
|
338
|
+
directives: {
|
|
339
|
+
ObserveVisibility: Ye
|
|
340
|
+
},
|
|
341
|
+
props: E(C({}, ce), {
|
|
342
|
+
itemSize: {
|
|
343
|
+
type: Number,
|
|
344
|
+
default: null
|
|
345
|
+
},
|
|
346
|
+
gridItems: {
|
|
347
|
+
type: Number,
|
|
348
|
+
default: void 0
|
|
349
|
+
},
|
|
350
|
+
itemSecondarySize: {
|
|
351
|
+
type: Number,
|
|
352
|
+
default: void 0
|
|
353
|
+
},
|
|
354
|
+
minItemSize: {
|
|
355
|
+
type: [Number, String],
|
|
356
|
+
default: null
|
|
357
|
+
},
|
|
358
|
+
sizeField: {
|
|
359
|
+
type: String,
|
|
360
|
+
default: "size"
|
|
361
|
+
},
|
|
362
|
+
typeField: {
|
|
363
|
+
type: String,
|
|
364
|
+
default: "type"
|
|
365
|
+
},
|
|
366
|
+
buffer: {
|
|
367
|
+
type: Number,
|
|
368
|
+
default: 200
|
|
369
|
+
},
|
|
370
|
+
pageMode: {
|
|
371
|
+
type: Boolean,
|
|
372
|
+
default: !1
|
|
373
|
+
},
|
|
374
|
+
prerender: {
|
|
375
|
+
type: Number,
|
|
376
|
+
default: 0
|
|
377
|
+
},
|
|
378
|
+
emitUpdate: {
|
|
379
|
+
type: Boolean,
|
|
380
|
+
default: !1
|
|
381
|
+
},
|
|
382
|
+
updateInterval: {
|
|
383
|
+
type: Number,
|
|
384
|
+
default: 0
|
|
385
|
+
},
|
|
386
|
+
skipHover: {
|
|
387
|
+
type: Boolean,
|
|
388
|
+
default: !1
|
|
389
|
+
},
|
|
390
|
+
listTag: {
|
|
391
|
+
type: String,
|
|
392
|
+
default: "div"
|
|
393
|
+
},
|
|
394
|
+
itemTag: {
|
|
395
|
+
type: String,
|
|
396
|
+
default: "div"
|
|
397
|
+
},
|
|
398
|
+
listClass: {
|
|
399
|
+
type: [String, Object, Array],
|
|
400
|
+
default: ""
|
|
401
|
+
},
|
|
402
|
+
itemClass: {
|
|
403
|
+
type: [String, Object, Array],
|
|
404
|
+
default: ""
|
|
405
|
+
}
|
|
406
|
+
}),
|
|
407
|
+
emits: [
|
|
408
|
+
"resize",
|
|
409
|
+
"visible",
|
|
410
|
+
"hidden",
|
|
411
|
+
"update",
|
|
412
|
+
"scroll-start",
|
|
413
|
+
"scroll-end"
|
|
414
|
+
],
|
|
415
|
+
data() {
|
|
416
|
+
return {
|
|
417
|
+
pool: [],
|
|
418
|
+
totalSize: 0,
|
|
419
|
+
ready: !1,
|
|
420
|
+
hoverKey: null
|
|
421
|
+
};
|
|
422
|
+
},
|
|
423
|
+
computed: {
|
|
424
|
+
sizes() {
|
|
425
|
+
if (this.itemSize === null) {
|
|
426
|
+
const e = {
|
|
427
|
+
"-1": { accumulator: 0 }
|
|
428
|
+
}, t = this.items, i = this.sizeField, s = this.minItemSize;
|
|
429
|
+
let r = 1e4, a = 0, l;
|
|
430
|
+
for (let o = 0, n = t.length; o < n; o++)
|
|
431
|
+
l = t[o][i] || s, l < r && (r = l), a += l, e[o] = { accumulator: a, size: l };
|
|
432
|
+
return this.$_computedMinItemSize = r, e;
|
|
433
|
+
}
|
|
434
|
+
return [];
|
|
435
|
+
},
|
|
436
|
+
simpleArray: de,
|
|
437
|
+
itemIndexByKey() {
|
|
438
|
+
const { keyField: e, items: t } = this, i = {};
|
|
439
|
+
for (let s = 0, r = t.length; s < r; s++)
|
|
440
|
+
i[t[s][e]] = s;
|
|
441
|
+
return i;
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
watch: {
|
|
445
|
+
items() {
|
|
446
|
+
this.updateVisibleItems(!0);
|
|
447
|
+
},
|
|
448
|
+
pageMode() {
|
|
449
|
+
this.applyPageMode(), this.updateVisibleItems(!1);
|
|
450
|
+
},
|
|
451
|
+
sizes: {
|
|
452
|
+
handler() {
|
|
453
|
+
this.updateVisibleItems(!1);
|
|
454
|
+
},
|
|
455
|
+
deep: !0
|
|
456
|
+
},
|
|
457
|
+
gridItems() {
|
|
458
|
+
this.updateVisibleItems(!0);
|
|
459
|
+
},
|
|
460
|
+
itemSecondarySize() {
|
|
461
|
+
this.updateVisibleItems(!0);
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
created() {
|
|
465
|
+
this.$_startIndex = 0, this.$_endIndex = 0, this.$_views = /* @__PURE__ */ new Map(), this.$_unusedViews = /* @__PURE__ */ new Map(), this.$_scrollDirty = !1, this.$_lastUpdateScrollPosition = 0, this.prerender && (this.$_prerender = !0, this.updateVisibleItems(!1)), this.gridItems && !this.itemSize && console.error("[vue-recycle-scroller] You must provide an itemSize when using gridItems");
|
|
466
|
+
},
|
|
467
|
+
mounted() {
|
|
468
|
+
this.applyPageMode(), this.$nextTick(() => {
|
|
469
|
+
this.$_prerender = !1, this.updateVisibleItems(!0), this.ready = !0;
|
|
470
|
+
});
|
|
471
|
+
},
|
|
472
|
+
activated() {
|
|
473
|
+
const e = this.$_lastUpdateScrollPosition;
|
|
474
|
+
typeof e == "number" && this.$nextTick(() => {
|
|
475
|
+
this.scrollToPosition(e);
|
|
476
|
+
});
|
|
477
|
+
},
|
|
478
|
+
beforeUnmount() {
|
|
479
|
+
this.removeListeners();
|
|
480
|
+
},
|
|
481
|
+
methods: {
|
|
482
|
+
addView(e, t, i, s, r) {
|
|
483
|
+
const a = Se({
|
|
484
|
+
id: tt++,
|
|
485
|
+
index: t,
|
|
486
|
+
used: !0,
|
|
487
|
+
key: s,
|
|
488
|
+
type: r
|
|
489
|
+
}), l = $e({
|
|
490
|
+
item: i,
|
|
491
|
+
position: 0,
|
|
492
|
+
nr: a
|
|
493
|
+
});
|
|
494
|
+
return e.push(l), l;
|
|
495
|
+
},
|
|
496
|
+
unuseView(e, t = !1) {
|
|
497
|
+
const i = this.$_unusedViews, s = e.nr.type;
|
|
498
|
+
let r = i.get(s);
|
|
499
|
+
r || (r = [], i.set(s, r)), r.push(e), t || (e.nr.used = !1, e.position = -9999);
|
|
500
|
+
},
|
|
501
|
+
handleResize() {
|
|
502
|
+
this.$emit("resize"), this.ready && this.updateVisibleItems(!1);
|
|
503
|
+
},
|
|
504
|
+
handleScroll(e) {
|
|
505
|
+
if (!this.$_scrollDirty) {
|
|
506
|
+
if (this.$_scrollDirty = !0, this.$_updateTimeout) return;
|
|
507
|
+
const t = () => requestAnimationFrame(() => {
|
|
508
|
+
this.$_scrollDirty = !1;
|
|
509
|
+
const { continuous: i } = this.updateVisibleItems(!1, !0);
|
|
510
|
+
i || (clearTimeout(this.$_refreshTimout), this.$_refreshTimout = setTimeout(this.handleScroll, this.updateInterval + 100));
|
|
511
|
+
});
|
|
512
|
+
t(), this.updateInterval && (this.$_updateTimeout = setTimeout(() => {
|
|
513
|
+
this.$_updateTimeout = 0, this.$_scrollDirty && t();
|
|
514
|
+
}, this.updateInterval));
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
handleVisibilityChange(e, t) {
|
|
518
|
+
this.ready && (e || t.boundingClientRect.width !== 0 || t.boundingClientRect.height !== 0 ? (this.$emit("visible"), requestAnimationFrame(() => {
|
|
519
|
+
this.updateVisibleItems(!1);
|
|
520
|
+
})) : this.$emit("hidden"));
|
|
521
|
+
},
|
|
522
|
+
updateVisibleItems(e, t = !1) {
|
|
523
|
+
const i = this.itemSize, s = this.gridItems || 1, r = this.itemSecondarySize || i, a = this.$_computedMinItemSize, l = this.typeField, o = this.simpleArray ? null : this.keyField, n = this.items, h = n.length, p = this.sizes, z = this.$_views, I = this.$_unusedViews, D = this.pool, ue = this.itemIndexByKey;
|
|
524
|
+
let v, u, R, g, S;
|
|
525
|
+
if (!h)
|
|
526
|
+
v = u = g = S = R = 0;
|
|
527
|
+
else if (this.$_prerender)
|
|
528
|
+
v = g = 0, u = S = Math.min(this.prerender, n.length), R = null;
|
|
529
|
+
else {
|
|
530
|
+
const c = this.getScroll();
|
|
531
|
+
if (t) {
|
|
532
|
+
let m = c.start - this.$_lastUpdateScrollPosition;
|
|
533
|
+
if (m < 0 && (m = -m), i === null && m < a || m < i)
|
|
534
|
+
return {
|
|
535
|
+
continuous: !0
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
this.$_lastUpdateScrollPosition = c.start;
|
|
539
|
+
const y = this.buffer;
|
|
540
|
+
c.start -= y, c.end += y;
|
|
541
|
+
let f = 0;
|
|
542
|
+
if (this.$refs.before && (f = this.$refs.before.scrollHeight, c.start -= f), this.$refs.after) {
|
|
543
|
+
const m = this.$refs.after.scrollHeight;
|
|
544
|
+
c.end += m;
|
|
545
|
+
}
|
|
546
|
+
if (i === null) {
|
|
547
|
+
let m, V = 0, K = h - 1, b = ~~(h / 2), Y;
|
|
548
|
+
do
|
|
549
|
+
Y = b, m = p[b].accumulator, m < c.start ? V = b : b < h - 1 && p[b + 1].accumulator > c.start && (K = b), b = ~~((V + K) / 2);
|
|
550
|
+
while (b !== Y);
|
|
551
|
+
for (b < 0 && (b = 0), v = b, R = p[h - 1].accumulator, u = b; u < h && p[u].accumulator < c.end; u++) ;
|
|
552
|
+
for (u === -1 ? u = n.length - 1 : (u++, u > h && (u = h)), g = v; g < h && f + p[g].accumulator < c.start; g++) ;
|
|
553
|
+
for (S = g; S < h && f + p[S].accumulator < c.end; S++) ;
|
|
554
|
+
} else {
|
|
555
|
+
v = ~~(c.start / i * s);
|
|
556
|
+
const m = v % s;
|
|
557
|
+
v -= m, u = Math.ceil(c.end / i * s), g = Math.max(0, Math.floor((c.start - f) / i * s)), S = Math.floor((c.end - f) / i * s), v < 0 && (v = 0), u > h && (u = h), g < 0 && (g = 0), S > h && (S = h), R = Math.ceil(h / s) * i;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
u - v > Ge.itemsLimit && this.itemsLimitError(), this.totalSize = R;
|
|
561
|
+
let d;
|
|
562
|
+
const k = v <= this.$_endIndex && u >= this.$_startIndex;
|
|
563
|
+
if (k)
|
|
564
|
+
for (let c = 0, y = D.length; c < y; c++)
|
|
565
|
+
d = D[c], d.nr.used && (e && (d.nr.index = ue[d.item[o]]), (d.nr.index == null || d.nr.index < v || d.nr.index >= u) && this.unuseView(d));
|
|
566
|
+
const q = k ? null : /* @__PURE__ */ new Map();
|
|
567
|
+
let O, $, A;
|
|
568
|
+
for (let c = v; c < u; c++) {
|
|
569
|
+
O = n[c];
|
|
570
|
+
const y = o ? O[o] : O;
|
|
571
|
+
if (y == null)
|
|
572
|
+
throw new Error(`Key is ${y} on item (keyField is '${o}')`);
|
|
573
|
+
if (d = z.get(y), !i && !p[c].size) {
|
|
574
|
+
d && this.unuseView(d);
|
|
575
|
+
continue;
|
|
576
|
+
}
|
|
577
|
+
$ = O[l];
|
|
578
|
+
let f = I.get($), m = !1;
|
|
579
|
+
if (!d)
|
|
580
|
+
k ? f && f.length ? d = f.pop() : d = this.addView(D, c, O, y, $) : (A = q.get($) || 0, (!f || A >= f.length) && (d = this.addView(D, c, O, y, $), this.unuseView(d, !0), f = I.get($)), d = f[A], q.set($, A + 1)), z.delete(d.nr.key), d.nr.used = !0, d.nr.index = c, d.nr.key = y, d.nr.type = $, z.set(y, d), m = !0;
|
|
581
|
+
else if (!d.nr.used && (d.nr.used = !0, m = !0, f)) {
|
|
582
|
+
const V = f.indexOf(d);
|
|
583
|
+
V !== -1 && f.splice(V, 1);
|
|
584
|
+
}
|
|
585
|
+
d.item = O, m && (c === n.length - 1 && this.$emit("scroll-end"), c === 0 && this.$emit("scroll-start")), i === null ? (d.position = p[c - 1].accumulator, d.offset = 0) : (d.position = Math.floor(c / s) * i, d.offset = c % s * r);
|
|
586
|
+
}
|
|
587
|
+
return this.$_startIndex = v, this.$_endIndex = u, this.emitUpdate && this.$emit("update", v, u, g, S), clearTimeout(this.$_sortTimer), this.$_sortTimer = setTimeout(this.sortViews, this.updateInterval + 300), {
|
|
588
|
+
continuous: k
|
|
589
|
+
};
|
|
590
|
+
},
|
|
591
|
+
getListenerTarget() {
|
|
592
|
+
let e = te(this.$el);
|
|
593
|
+
return window.document && (e === window.document.documentElement || e === window.document.body) && (e = window), e;
|
|
594
|
+
},
|
|
595
|
+
getScroll() {
|
|
596
|
+
const { $el: e, direction: t } = this, i = t === "vertical";
|
|
597
|
+
let s;
|
|
598
|
+
if (this.pageMode) {
|
|
599
|
+
const r = e.getBoundingClientRect(), a = i ? r.height : r.width;
|
|
600
|
+
let l = -(i ? r.top : r.left), o = i ? window.innerHeight : window.innerWidth;
|
|
601
|
+
l < 0 && (o += l, l = 0), l + o > a && (o = a - l), s = {
|
|
602
|
+
start: l,
|
|
603
|
+
end: l + o
|
|
604
|
+
};
|
|
605
|
+
} else i ? s = {
|
|
606
|
+
start: e.scrollTop,
|
|
607
|
+
end: e.scrollTop + e.clientHeight
|
|
608
|
+
} : s = {
|
|
609
|
+
start: e.scrollLeft,
|
|
610
|
+
end: e.scrollLeft + e.clientWidth
|
|
611
|
+
};
|
|
612
|
+
return s;
|
|
613
|
+
},
|
|
614
|
+
applyPageMode() {
|
|
615
|
+
this.pageMode ? this.addListeners() : this.removeListeners();
|
|
616
|
+
},
|
|
617
|
+
addListeners() {
|
|
618
|
+
this.listenerTarget = this.getListenerTarget(), this.listenerTarget.addEventListener("scroll", this.handleScroll, W ? {
|
|
619
|
+
passive: !0
|
|
620
|
+
} : !1), this.listenerTarget.addEventListener("resize", this.handleResize);
|
|
621
|
+
},
|
|
622
|
+
removeListeners() {
|
|
623
|
+
this.listenerTarget && (this.listenerTarget.removeEventListener("scroll", this.handleScroll), this.listenerTarget.removeEventListener("resize", this.handleResize), this.listenerTarget = null);
|
|
624
|
+
},
|
|
625
|
+
scrollToItem(e) {
|
|
626
|
+
let t;
|
|
627
|
+
const i = this.gridItems || 1;
|
|
628
|
+
this.itemSize === null ? t = e > 0 ? this.sizes[e - 1].accumulator : 0 : t = Math.floor(e / i) * this.itemSize, this.scrollToPosition(t);
|
|
629
|
+
},
|
|
630
|
+
scrollToPosition(e) {
|
|
631
|
+
const t = this.direction === "vertical" ? { scroll: "scrollTop", start: "top" } : { scroll: "scrollLeft", start: "left" };
|
|
632
|
+
let i, s, r;
|
|
633
|
+
if (this.pageMode) {
|
|
634
|
+
const a = te(this.$el), l = a.tagName === "HTML" ? 0 : a[t.scroll], o = a.getBoundingClientRect(), h = this.$el.getBoundingClientRect()[t.start] - o[t.start];
|
|
635
|
+
i = a, s = t.scroll, r = e + l + h;
|
|
636
|
+
} else
|
|
637
|
+
i = this.$el, s = t.scroll, r = e;
|
|
638
|
+
i[s] = r;
|
|
639
|
+
},
|
|
640
|
+
itemsLimitError() {
|
|
641
|
+
throw setTimeout(() => {
|
|
642
|
+
console.log("It seems the scroller element isn't scrolling, so it tries to render all the items at once.", "Scroller:", this.$el), console.log("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.");
|
|
643
|
+
}), new Error("Rendered items limit reached");
|
|
644
|
+
},
|
|
645
|
+
sortViews() {
|
|
646
|
+
this.pool.sort((e, t) => e.nr.index - t.nr.index);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
const it = {
|
|
651
|
+
key: 0,
|
|
652
|
+
ref: "before",
|
|
653
|
+
class: "vue-recycle-scroller__slot"
|
|
654
|
+
}, st = {
|
|
655
|
+
key: 1,
|
|
656
|
+
ref: "after",
|
|
657
|
+
class: "vue-recycle-scroller__slot"
|
|
658
|
+
};
|
|
659
|
+
function rt(e, t, i, s, r, a) {
|
|
660
|
+
const l = se("ResizeObserver"), o = we("observe-visibility");
|
|
661
|
+
return Ie((_(), x(
|
|
662
|
+
"div",
|
|
663
|
+
{
|
|
664
|
+
class: J(["vue-recycle-scroller", {
|
|
665
|
+
ready: r.ready,
|
|
666
|
+
"page-mode": i.pageMode,
|
|
667
|
+
[`direction-${e.direction}`]: !0
|
|
668
|
+
}]),
|
|
669
|
+
onScrollPassive: t[0] || (t[0] = (...n) => a.handleScroll && a.handleScroll(...n))
|
|
670
|
+
},
|
|
671
|
+
[
|
|
672
|
+
e.$slots.before ? (_(), x(
|
|
673
|
+
"div",
|
|
674
|
+
it,
|
|
675
|
+
[
|
|
676
|
+
w(e.$slots, "before")
|
|
677
|
+
],
|
|
678
|
+
512
|
|
679
|
+
/* NEED_PATCH */
|
|
680
|
+
)) : Q("v-if", !0),
|
|
681
|
+
(_(), U(Z(i.listTag), {
|
|
682
|
+
ref: "wrapper",
|
|
683
|
+
style: Oe({ [e.direction === "vertical" ? "minHeight" : "minWidth"]: r.totalSize + "px" }),
|
|
684
|
+
class: J(["vue-recycle-scroller__item-wrapper", i.listClass])
|
|
685
|
+
}, {
|
|
686
|
+
default: T(() => [
|
|
687
|
+
(_(!0), x(
|
|
688
|
+
Te,
|
|
689
|
+
null,
|
|
690
|
+
Re(r.pool, (n) => (_(), U(Z(i.itemTag), re({
|
|
691
|
+
key: n.nr.id,
|
|
692
|
+
style: r.ready ? {
|
|
693
|
+
transform: `translate${e.direction === "vertical" ? "Y" : "X"}(${n.position}px) translate${e.direction === "vertical" ? "X" : "Y"}(${n.offset}px)`,
|
|
694
|
+
width: i.gridItems ? `${e.direction === "vertical" && i.itemSecondarySize || i.itemSize}px` : void 0,
|
|
695
|
+
height: i.gridItems ? `${e.direction === "horizontal" && i.itemSecondarySize || i.itemSize}px` : void 0
|
|
696
|
+
} : null,
|
|
697
|
+
class: ["vue-recycle-scroller__item-view", [
|
|
698
|
+
i.itemClass,
|
|
699
|
+
{
|
|
700
|
+
hover: !i.skipHover && r.hoverKey === n.nr.key
|
|
701
|
+
}
|
|
702
|
+
]]
|
|
703
|
+
}, Ve(i.skipHover ? {} : {
|
|
704
|
+
mouseenter: () => {
|
|
705
|
+
r.hoverKey = n.nr.key;
|
|
706
|
+
},
|
|
707
|
+
mouseleave: () => {
|
|
708
|
+
r.hoverKey = null;
|
|
709
|
+
}
|
|
710
|
+
})), {
|
|
711
|
+
default: T(() => [
|
|
712
|
+
w(e.$slots, "default", {
|
|
713
|
+
item: n.item,
|
|
714
|
+
index: n.nr.index,
|
|
715
|
+
active: n.nr.used
|
|
716
|
+
})
|
|
717
|
+
]),
|
|
718
|
+
_: 2
|
|
719
|
+
/* DYNAMIC */
|
|
720
|
+
}, 1040, ["style", "class"]))),
|
|
721
|
+
128
|
|
722
|
+
/* KEYED_FRAGMENT */
|
|
723
|
+
)),
|
|
724
|
+
w(e.$slots, "empty")
|
|
725
|
+
]),
|
|
726
|
+
_: 3
|
|
727
|
+
/* FORWARDED */
|
|
728
|
+
}, 8, ["style", "class"])),
|
|
729
|
+
e.$slots.after ? (_(), x(
|
|
730
|
+
"div",
|
|
731
|
+
st,
|
|
732
|
+
[
|
|
733
|
+
w(e.$slots, "after")
|
|
734
|
+
],
|
|
735
|
+
512
|
|
736
|
+
/* NEED_PATCH */
|
|
737
|
+
)) : Q("v-if", !0),
|
|
738
|
+
De(l, { onNotify: a.handleResize }, null, 8, ["onNotify"])
|
|
739
|
+
],
|
|
740
|
+
34
|
|
741
|
+
/* CLASS, HYDRATE_EVENTS */
|
|
742
|
+
)), [
|
|
743
|
+
[o, a.handleVisibilityChange]
|
|
744
|
+
]);
|
|
745
|
+
}
|
|
746
|
+
j.render = rt;
|
|
747
|
+
j.__file = "src/components/RecycleScroller.vue";
|
|
748
|
+
var he = {
|
|
749
|
+
name: "DynamicScroller",
|
|
750
|
+
components: {
|
|
751
|
+
RecycleScroller: j
|
|
752
|
+
},
|
|
753
|
+
provide() {
|
|
754
|
+
return typeof ResizeObserver != "undefined" && (this.$_resizeObserver = new ResizeObserver((e) => {
|
|
755
|
+
requestAnimationFrame(() => {
|
|
756
|
+
if (Array.isArray(e)) {
|
|
757
|
+
for (const t of e)
|
|
758
|
+
if (t.target && t.target.$_vs_onResize) {
|
|
759
|
+
let i, s;
|
|
760
|
+
if (t.borderBoxSize) {
|
|
761
|
+
const r = t.borderBoxSize[0];
|
|
762
|
+
i = r.inlineSize, s = r.blockSize;
|
|
763
|
+
} else
|
|
764
|
+
i = t.contentRect.width, s = t.contentRect.height;
|
|
765
|
+
t.target.$_vs_onResize(t.target.$_vs_id, i, s);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
})), {
|
|
770
|
+
vscrollData: this.vscrollData,
|
|
771
|
+
vscrollParent: this,
|
|
772
|
+
vscrollResizeObserver: this.$_resizeObserver
|
|
773
|
+
};
|
|
774
|
+
},
|
|
775
|
+
inheritAttrs: !1,
|
|
776
|
+
props: E(C({}, ce), {
|
|
777
|
+
minItemSize: {
|
|
778
|
+
type: [Number, String],
|
|
779
|
+
required: !0
|
|
780
|
+
}
|
|
781
|
+
}),
|
|
782
|
+
emits: [
|
|
783
|
+
"resize",
|
|
784
|
+
"visible"
|
|
785
|
+
],
|
|
786
|
+
data() {
|
|
787
|
+
return {
|
|
788
|
+
vscrollData: {
|
|
789
|
+
active: !0,
|
|
790
|
+
sizes: {},
|
|
791
|
+
keyField: this.keyField,
|
|
792
|
+
simpleArray: !1
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
},
|
|
796
|
+
computed: {
|
|
797
|
+
simpleArray: de,
|
|
798
|
+
itemsWithSize() {
|
|
799
|
+
const e = [], { items: t, keyField: i, simpleArray: s } = this, r = this.vscrollData.sizes, a = t.length;
|
|
800
|
+
for (let l = 0; l < a; l++) {
|
|
801
|
+
const o = t[l], n = s ? l : o[i];
|
|
802
|
+
let h = r[n];
|
|
803
|
+
typeof h == "undefined" && !this.$_undefinedMap[n] && (h = 0), e.push({
|
|
804
|
+
item: o,
|
|
805
|
+
id: n,
|
|
806
|
+
size: h
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
return e;
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
watch: {
|
|
813
|
+
items() {
|
|
814
|
+
this.forceUpdate();
|
|
815
|
+
},
|
|
816
|
+
simpleArray: {
|
|
817
|
+
handler(e) {
|
|
818
|
+
this.vscrollData.simpleArray = e;
|
|
819
|
+
},
|
|
820
|
+
immediate: !0
|
|
821
|
+
},
|
|
822
|
+
direction(e) {
|
|
823
|
+
this.forceUpdate(!0);
|
|
824
|
+
},
|
|
825
|
+
itemsWithSize(e, t) {
|
|
826
|
+
const i = this.$el.scrollTop;
|
|
827
|
+
let s = 0, r = 0;
|
|
828
|
+
const a = Math.min(e.length, t.length);
|
|
829
|
+
for (let o = 0; o < a && !(s >= i); o++)
|
|
830
|
+
s += t[o].size || this.minItemSize, r += e[o].size || this.minItemSize;
|
|
831
|
+
const l = r - s;
|
|
832
|
+
l !== 0 && (this.$el.scrollTop += l);
|
|
833
|
+
}
|
|
834
|
+
},
|
|
835
|
+
beforeCreate() {
|
|
836
|
+
this.$_updates = [], this.$_undefinedSizes = 0, this.$_undefinedMap = {}, this.$_events = Xe();
|
|
837
|
+
},
|
|
838
|
+
activated() {
|
|
839
|
+
this.vscrollData.active = !0;
|
|
840
|
+
},
|
|
841
|
+
deactivated() {
|
|
842
|
+
this.vscrollData.active = !1;
|
|
843
|
+
},
|
|
844
|
+
unmounted() {
|
|
845
|
+
this.$_events.all.clear();
|
|
846
|
+
},
|
|
847
|
+
methods: {
|
|
848
|
+
onScrollerResize() {
|
|
849
|
+
this.$refs.scroller && this.forceUpdate(), this.$emit("resize");
|
|
850
|
+
},
|
|
851
|
+
onScrollerVisible() {
|
|
852
|
+
this.$_events.emit("vscroll:update", { force: !1 }), this.$emit("visible");
|
|
853
|
+
},
|
|
854
|
+
forceUpdate(e = !1) {
|
|
855
|
+
(e || this.simpleArray) && (this.vscrollData.sizes = {}), this.$_events.emit("vscroll:update", { force: !0 });
|
|
856
|
+
},
|
|
857
|
+
scrollToItem(e) {
|
|
858
|
+
const t = this.$refs.scroller;
|
|
859
|
+
t && t.scrollToItem(e);
|
|
860
|
+
},
|
|
861
|
+
getItemSize(e, t = void 0) {
|
|
862
|
+
const i = this.simpleArray ? t != null ? t : this.items.indexOf(e) : e[this.keyField];
|
|
863
|
+
return this.vscrollData.sizes[i] || 0;
|
|
864
|
+
},
|
|
865
|
+
scrollToBottom() {
|
|
866
|
+
if (this.$_scrollingToBottom) return;
|
|
867
|
+
this.$_scrollingToBottom = !0;
|
|
868
|
+
const e = this.$el;
|
|
869
|
+
this.$nextTick(() => {
|
|
870
|
+
e.scrollTop = e.scrollHeight + 5e3;
|
|
871
|
+
const t = () => {
|
|
872
|
+
e.scrollTop = e.scrollHeight + 5e3, requestAnimationFrame(() => {
|
|
873
|
+
e.scrollTop = e.scrollHeight + 5e3, this.$_undefinedSizes === 0 ? this.$_scrollingToBottom = !1 : requestAnimationFrame(t);
|
|
874
|
+
});
|
|
875
|
+
};
|
|
876
|
+
requestAnimationFrame(t);
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
function nt(e, t, i, s, r, a) {
|
|
882
|
+
const l = se("RecycleScroller");
|
|
883
|
+
return _(), U(l, re({
|
|
884
|
+
ref: "scroller",
|
|
885
|
+
items: a.itemsWithSize,
|
|
886
|
+
"min-item-size": i.minItemSize,
|
|
887
|
+
direction: e.direction,
|
|
888
|
+
"key-field": "id",
|
|
889
|
+
"list-tag": e.listTag,
|
|
890
|
+
"item-tag": e.itemTag
|
|
891
|
+
}, e.$attrs, {
|
|
892
|
+
onResize: a.onScrollerResize,
|
|
893
|
+
onVisible: a.onScrollerVisible
|
|
894
|
+
}), {
|
|
895
|
+
default: T(({ item: o, index: n, active: h }) => [
|
|
896
|
+
w(e.$slots, "default", ke(Ae({
|
|
897
|
+
item: o.item,
|
|
898
|
+
index: n,
|
|
899
|
+
active: h,
|
|
900
|
+
itemWithSize: o
|
|
901
|
+
})))
|
|
902
|
+
]),
|
|
903
|
+
before: T(() => [
|
|
904
|
+
w(e.$slots, "before")
|
|
905
|
+
]),
|
|
906
|
+
after: T(() => [
|
|
907
|
+
w(e.$slots, "after")
|
|
908
|
+
]),
|
|
909
|
+
empty: T(() => [
|
|
910
|
+
w(e.$slots, "empty")
|
|
911
|
+
]),
|
|
912
|
+
_: 3
|
|
913
|
+
/* FORWARDED */
|
|
914
|
+
}, 16, ["items", "min-item-size", "direction", "list-tag", "item-tag", "onResize", "onVisible"]);
|
|
915
|
+
}
|
|
916
|
+
he.render = nt;
|
|
917
|
+
he.__file = "src/components/DynamicScroller.vue";
|
|
918
|
+
var lt = {
|
|
919
|
+
name: "DynamicScrollerItem",
|
|
920
|
+
inject: [
|
|
921
|
+
"vscrollData",
|
|
922
|
+
"vscrollParent",
|
|
923
|
+
"vscrollResizeObserver"
|
|
924
|
+
],
|
|
925
|
+
props: {
|
|
926
|
+
// eslint-disable-next-line vue/require-prop-types
|
|
927
|
+
item: {
|
|
928
|
+
required: !0
|
|
929
|
+
},
|
|
930
|
+
watchData: {
|
|
931
|
+
type: Boolean,
|
|
932
|
+
default: !1
|
|
933
|
+
},
|
|
934
|
+
/**
|
|
935
|
+
* Indicates if the view is actively used to display an item.
|
|
936
|
+
*/
|
|
937
|
+
active: {
|
|
938
|
+
type: Boolean,
|
|
939
|
+
required: !0
|
|
940
|
+
},
|
|
941
|
+
index: {
|
|
942
|
+
type: Number,
|
|
943
|
+
default: void 0
|
|
944
|
+
},
|
|
945
|
+
sizeDependencies: {
|
|
946
|
+
type: [Array, Object],
|
|
947
|
+
default: null
|
|
948
|
+
},
|
|
949
|
+
emitResize: {
|
|
950
|
+
type: Boolean,
|
|
951
|
+
default: !1
|
|
952
|
+
},
|
|
953
|
+
tag: {
|
|
954
|
+
type: String,
|
|
955
|
+
default: "div"
|
|
956
|
+
}
|
|
957
|
+
},
|
|
958
|
+
emits: [
|
|
959
|
+
"resize"
|
|
960
|
+
],
|
|
961
|
+
computed: {
|
|
962
|
+
id() {
|
|
963
|
+
if (this.vscrollData.simpleArray) return this.index;
|
|
964
|
+
if (this.vscrollData.keyField in this.item) return this.item[this.vscrollData.keyField];
|
|
965
|
+
throw new Error(`keyField '${this.vscrollData.keyField}' not found in your item. You should set a valid keyField prop on your Scroller`);
|
|
966
|
+
},
|
|
967
|
+
size() {
|
|
968
|
+
return this.vscrollData.sizes[this.id] || 0;
|
|
969
|
+
},
|
|
970
|
+
finalActive() {
|
|
971
|
+
return this.active && this.vscrollData.active;
|
|
972
|
+
}
|
|
973
|
+
},
|
|
974
|
+
watch: {
|
|
975
|
+
watchData: "updateWatchData",
|
|
976
|
+
id(e, t) {
|
|
977
|
+
if (this.$el.$_vs_id = this.id, this.size || this.onDataUpdate(), this.$_sizeObserved) {
|
|
978
|
+
const i = this.vscrollData.sizes[t], s = this.vscrollData.sizes[e];
|
|
979
|
+
i != null && i !== s && this.applySize(i);
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
finalActive(e) {
|
|
983
|
+
this.size || (e ? this.vscrollParent.$_undefinedMap[this.id] || (this.vscrollParent.$_undefinedSizes++, this.vscrollParent.$_undefinedMap[this.id] = !0) : this.vscrollParent.$_undefinedMap[this.id] && (this.vscrollParent.$_undefinedSizes--, this.vscrollParent.$_undefinedMap[this.id] = !1)), this.vscrollResizeObserver ? e ? this.observeSize() : this.unobserveSize() : e && this.$_pendingVScrollUpdate === this.id && this.updateSize();
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
created() {
|
|
987
|
+
if (!this.$isServer && (this.$_forceNextVScrollUpdate = null, this.updateWatchData(), !this.vscrollResizeObserver)) {
|
|
988
|
+
for (const e in this.sizeDependencies)
|
|
989
|
+
this.$watch(() => this.sizeDependencies[e], this.onDataUpdate);
|
|
990
|
+
this.vscrollParent.$_events.on("vscroll:update", this.onVscrollUpdate);
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
mounted() {
|
|
994
|
+
this.finalActive && (this.updateSize(), this.observeSize());
|
|
995
|
+
},
|
|
996
|
+
beforeUnmount() {
|
|
997
|
+
this.vscrollParent.$_events.off("vscroll:update", this.onVscrollUpdate), this.unobserveSize();
|
|
998
|
+
},
|
|
999
|
+
methods: {
|
|
1000
|
+
updateSize() {
|
|
1001
|
+
this.finalActive ? this.$_pendingSizeUpdate !== this.id && (this.$_pendingSizeUpdate = this.id, this.$_forceNextVScrollUpdate = null, this.$_pendingVScrollUpdate = null, this.computeSize(this.id)) : this.$_forceNextVScrollUpdate = this.id;
|
|
1002
|
+
},
|
|
1003
|
+
updateWatchData() {
|
|
1004
|
+
this.watchData && !this.vscrollResizeObserver ? this.$_watchData = this.$watch("item", () => {
|
|
1005
|
+
this.onDataUpdate();
|
|
1006
|
+
}, {
|
|
1007
|
+
deep: !0
|
|
1008
|
+
}) : this.$_watchData && (this.$_watchData(), this.$_watchData = null);
|
|
1009
|
+
},
|
|
1010
|
+
onVscrollUpdate({ force: e }) {
|
|
1011
|
+
!this.finalActive && e && (this.$_pendingVScrollUpdate = this.id), (this.$_forceNextVScrollUpdate === this.id || e || !this.size) && this.updateSize();
|
|
1012
|
+
},
|
|
1013
|
+
onDataUpdate() {
|
|
1014
|
+
this.updateSize();
|
|
1015
|
+
},
|
|
1016
|
+
computeSize(e) {
|
|
1017
|
+
this.$nextTick(() => {
|
|
1018
|
+
if (this.id === e) {
|
|
1019
|
+
const t = this.$el.offsetWidth, i = this.$el.offsetHeight;
|
|
1020
|
+
this.applyWidthHeight(t, i);
|
|
1021
|
+
}
|
|
1022
|
+
this.$_pendingSizeUpdate = null;
|
|
1023
|
+
});
|
|
1024
|
+
},
|
|
1025
|
+
applyWidthHeight(e, t) {
|
|
1026
|
+
const i = ~~(this.vscrollParent.direction === "vertical" ? t : e);
|
|
1027
|
+
i && this.size !== i && this.applySize(i);
|
|
1028
|
+
},
|
|
1029
|
+
applySize(e) {
|
|
1030
|
+
this.vscrollParent.$_undefinedMap[this.id] && (this.vscrollParent.$_undefinedSizes--, this.vscrollParent.$_undefinedMap[this.id] = void 0), this.vscrollData.sizes[this.id] = e, this.emitResize && this.$emit("resize", this.id);
|
|
1031
|
+
},
|
|
1032
|
+
observeSize() {
|
|
1033
|
+
this.vscrollResizeObserver && (this.$_sizeObserved || (this.vscrollResizeObserver.observe(this.$el), this.$el.$_vs_id = this.id, this.$el.$_vs_onResize = this.onResize, this.$_sizeObserved = !0));
|
|
1034
|
+
},
|
|
1035
|
+
unobserveSize() {
|
|
1036
|
+
this.vscrollResizeObserver && this.$_sizeObserved && (this.vscrollResizeObserver.unobserve(this.$el), this.$el.$_vs_onResize = void 0, this.$_sizeObserved = !1);
|
|
1037
|
+
},
|
|
1038
|
+
onResize(e, t, i) {
|
|
1039
|
+
this.id === e && this.applyWidthHeight(t, i);
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
render() {
|
|
1043
|
+
return _e(this.tag, this.$slots.default());
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
lt.__file = "src/components/DynamicScrollerItem.vue";
|
|
1047
|
+
export {
|
|
1048
|
+
lt as a,
|
|
1049
|
+
j as b,
|
|
1050
|
+
he as s
|
|
1051
|
+
};
|