aibox-custom-component-packages 0.0.25 → 0.0.26
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/es/AddOrEditSupplierDialog.mjs +1 -1
- package/es/DocSyncSelect.mjs +1 -1
- package/es/assets/AddOrEditSupplierDialog.css +1 -1
- package/es/assets/DocSyncSelect.css +1 -1
- package/es/chunks/AddOrEditSupplierDialog.CnhMfQwO.js +779 -0
- package/es/chunks/DocSyncSelect.DsxEfNS8.js +2808 -0
- package/es/index.mjs +2 -2
- package/lib/AddOrEditSupplierDialog.js +1 -1
- package/lib/DocSyncSelect.js +1 -1
- package/lib/assets/AddOrEditSupplierDialog.css +1 -1
- package/lib/assets/DocSyncSelect.css +1 -1
- package/lib/chunks/AddOrEditSupplierDialog.C37dgJoc.js +1 -0
- package/lib/chunks/DocSyncSelect.CeXY2dUM.js +1 -0
- package/lib/index.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,2808 @@
|
|
|
1
|
+
import { r as e, t } from "./chunk.Dqa2HsxW.js";
|
|
2
|
+
import { t as n } from "./withinstall.CMngc-br.js";
|
|
3
|
+
import { m as r } from "./i18n.yuai-sb4.js";
|
|
4
|
+
import { t as i } from "./_plugin-vue_export-helper.B3ysoDQm.js";
|
|
5
|
+
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createSlots as d, createVNode as f, defineComponent as p, effectScope as m, guardReactiveProps as h, h as g, inject as _, markRaw as v, mergeProps as y, nextTick as b, normalizeClass as x, normalizeProps as S, normalizeStyle as C, onActivated as w, onBeforeUnmount as T, onDeactivated as E, onMounted as D, onUnmounted as O, openBlock as k, provide as A, reactive as j, ref as M, renderList as N, renderSlot as P, resolveComponent as F, resolveDynamicComponent as I, shallowReactive as L, shallowRef as R, toDisplayString as z, toHandlers as B, toValue as V, unref as H, useAttrs as ee, watch as U, withCtx as W, withDirectives as te, withModifiers as ne } from "vue";
|
|
6
|
+
import { ElAutoResizer as G, ElCheckbox as re, ElIcon as K, ElInput as q, ElSegmented as ie, ElTreeV2 as ae } from "element-plus";
|
|
7
|
+
import { CaretRight as oe, Empty as se, FeishuLocalUploadDoc as J, FeishuLocalUploadImg as ce, FeishuLocalUploadPdf as le, FeishuLocalUploadPpt as Y, FeishuLocalUploadTxt as ue, FeishuLocalUploadXlsx as X, IconDelete as de, IconFeishuDoc as fe, IconFeishuExcel as pe, IconFeishuKnowledge as me, IconFeishuMulitTable as he, Seach as ge } from "color-message-aibox-vue";
|
|
8
|
+
import { IconEmpty as _e } from "color-star-custom-components";
|
|
9
|
+
import ve from "mitt";
|
|
10
|
+
import '../assets/DocSyncSelect.css';//#region components/DocSyncSelect/config.js
|
|
11
|
+
var Z = {
|
|
12
|
+
label: "name",
|
|
13
|
+
children: "children",
|
|
14
|
+
value: "id"
|
|
15
|
+
}, ye = {
|
|
16
|
+
FRONTEND: "frontend",
|
|
17
|
+
BACKEND: "backend"
|
|
18
|
+
}, be = [
|
|
19
|
+
"sheet",
|
|
20
|
+
"bitable",
|
|
21
|
+
"doc",
|
|
22
|
+
"docx",
|
|
23
|
+
"wiki",
|
|
24
|
+
"pdf",
|
|
25
|
+
"pptx",
|
|
26
|
+
"ppt",
|
|
27
|
+
"xlsx",
|
|
28
|
+
"xls",
|
|
29
|
+
"txt",
|
|
30
|
+
"png",
|
|
31
|
+
"jpg",
|
|
32
|
+
"jpeg"
|
|
33
|
+
], Q = {
|
|
34
|
+
MY_FILES: "myFiles",
|
|
35
|
+
FEISHU_KNOWLEDGE: "feishuKnowledge"
|
|
36
|
+
}, xe = /*@__PURE__*/ Object.assign({ name: "FileTypeIcon" }, {
|
|
37
|
+
__name: "FileTypeIcon",
|
|
38
|
+
props: {
|
|
39
|
+
fileType: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: !1,
|
|
42
|
+
default: ""
|
|
43
|
+
},
|
|
44
|
+
isLocalFileType: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
required: !1,
|
|
47
|
+
default: !1
|
|
48
|
+
},
|
|
49
|
+
size: {
|
|
50
|
+
type: Number,
|
|
51
|
+
default: 32
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
setup(e) {
|
|
55
|
+
return (t, n) => e.fileType && H(be).includes(e.fileType) ? (k(), s(H(K), {
|
|
56
|
+
key: 0,
|
|
57
|
+
size: e.size
|
|
58
|
+
}, {
|
|
59
|
+
default: W(() => [e.isLocalFileType ? (k(), l(a, { key: 0 }, [["xlsx", "xls"].includes(e.fileType) ? (k(), s(H(X), { key: 0 })) : ["doc", "docx"].includes(e.fileType) ? (k(), s(H(J), { key: 1 })) : ["pdf"].includes(e.fileType) ? (k(), s(H(le), { key: 2 })) : ["pptx", "ppt"].includes(e.fileType) ? (k(), s(H(Y), { key: 3 })) : ["txt"].includes(e.fileType) ? (k(), s(H(ue), { key: 4 })) : [
|
|
60
|
+
"png",
|
|
61
|
+
"jpg",
|
|
62
|
+
"jpeg"
|
|
63
|
+
].includes(e.fileType) ? (k(), s(H(ce), { key: 5 })) : c("", !0)], 64)) : (k(), l(a, { key: 1 }, [["sheet"].includes(e.fileType) ? (k(), s(H(pe), { key: 0 })) : ["bitable"].includes(e.fileType) ? (k(), s(H(he), { key: 1 })) : ["doc", "docx"].includes(e.fileType) ? (k(), s(H(fe), { key: 2 })) : ["wiki"].includes(e.fileType) ? (k(), s(H(me), { key: 3 })) : c("", !0)], 64))]),
|
|
64
|
+
_: 1
|
|
65
|
+
}, 8, ["size"])) : c("", !0);
|
|
66
|
+
}
|
|
67
|
+
}), Se = { class: "right-wrap" }, $ = { class: "content" }, Ce = {
|
|
68
|
+
key: 0,
|
|
69
|
+
class: "empty-state"
|
|
70
|
+
}, we = {
|
|
71
|
+
key: 1,
|
|
72
|
+
class: "selected-list"
|
|
73
|
+
}, Te = ["onClick"], Ee = { class: "item-content" }, De = { class: "item-main" }, Oe = { class: "doc-icon" }, ke = { class: "doc-info" }, Ae = { class: "doc-name" }, je = {
|
|
74
|
+
key: 0,
|
|
75
|
+
class: "doc-suffix"
|
|
76
|
+
}, Me = ["onClick"], Ne = /*#__PURE__*/ i(/* @__PURE__ */ Object.assign({ name: "RightLayout" }, {
|
|
77
|
+
__name: "RightLayout",
|
|
78
|
+
props: {
|
|
79
|
+
selectedDocuments: {
|
|
80
|
+
type: Array,
|
|
81
|
+
default: () => []
|
|
82
|
+
},
|
|
83
|
+
treeProps: {
|
|
84
|
+
type: Object,
|
|
85
|
+
default: () => Z
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
emits: ["delete-node"],
|
|
89
|
+
setup(e, { emit: t }) {
|
|
90
|
+
let n = e, r = t, i = M(-1), s = o(() => n.selectedDocuments.filter((e) => be.includes(e.type))), d = (e) => {
|
|
91
|
+
i.value = i.value === e ? -1 : e;
|
|
92
|
+
}, p = (e) => {
|
|
93
|
+
r("delete-node", e), i.value = -1;
|
|
94
|
+
};
|
|
95
|
+
return (t, n) => (k(), l("div", Se, [u("div", $, [s.value.length === 0 ? (k(), l("div", Ce, [f(H(_e))])) : (k(), l("div", we, [(k(!0), l(a, null, N(s.value, (t, n) => (k(), l("div", {
|
|
96
|
+
key: t[e.treeProps.value],
|
|
97
|
+
class: x(["selected-item", { "is-selected": i.value === n }]),
|
|
98
|
+
onClick: (e) => d(n)
|
|
99
|
+
}, [u("div", Ee, [u("div", De, [u("div", Oe, [f(xe, {
|
|
100
|
+
"file-type": t.type,
|
|
101
|
+
size: 26,
|
|
102
|
+
isLocalFileType: t?.isLocalFileType
|
|
103
|
+
}, null, 8, ["file-type", "isLocalFileType"])]), u("div", ke, [u("div", Ae, z(t[e.treeProps.label]), 1), t.suffix ? (k(), l("div", je, z(t.suffix), 1)) : c("", !0)])]), u("div", {
|
|
104
|
+
class: "flex items-center",
|
|
105
|
+
onClick: ne((e) => p(t), ["stop"])
|
|
106
|
+
}, [f(H(K), {
|
|
107
|
+
size: 14,
|
|
108
|
+
color: "var(--neutral-color-5)"
|
|
109
|
+
}, {
|
|
110
|
+
default: W(() => [f(H(de))]),
|
|
111
|
+
_: 1
|
|
112
|
+
})], 8, Me)])], 10, Te))), 128))]))])]));
|
|
113
|
+
}
|
|
114
|
+
}), [["__scopeId", "data-v-6736cdb6"]]);
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region ../../../node_modules/.pnpm/element-tree-line@0.2.1_vue@3.5.38_typescript@5.9.3_/node_modules/element-tree-line/dist/index.es.js
|
|
117
|
+
function Pe(e) {
|
|
118
|
+
return {
|
|
119
|
+
name: "element-tree-line",
|
|
120
|
+
props: {
|
|
121
|
+
node: {
|
|
122
|
+
type: Object,
|
|
123
|
+
required: !0
|
|
124
|
+
},
|
|
125
|
+
data: { type: Object },
|
|
126
|
+
treeData: { type: Array },
|
|
127
|
+
indent: {
|
|
128
|
+
type: Number,
|
|
129
|
+
default() {
|
|
130
|
+
return 16;
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
showLabelLine: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
default: !0
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
render(t) {
|
|
139
|
+
let n = e || t, r = this.getScopedSlot("default"), i = this.getScopedSlot("node-label"), a = this.getScopedSlot("after-node-label"), o = r ? this.getScopedSlotValue(r, {
|
|
140
|
+
node: this.node,
|
|
141
|
+
data: this.data
|
|
142
|
+
}) : [
|
|
143
|
+
i ? this.getScopedSlotValue(i, {
|
|
144
|
+
node: this.node,
|
|
145
|
+
data: this.data
|
|
146
|
+
}) : n("span", { class: "element-tree-node-label" }, this.node.label),
|
|
147
|
+
this.showLabelLine ? n("span", { class: "element-tree-node-label-line" }) : null,
|
|
148
|
+
this.getScopedSlotValue(a, {
|
|
149
|
+
node: this.node,
|
|
150
|
+
data: this.data
|
|
151
|
+
})
|
|
152
|
+
], s = [], c = this.node;
|
|
153
|
+
for (; c;) {
|
|
154
|
+
let e = c.parent;
|
|
155
|
+
if (c.level === 1 && !c.parent) {
|
|
156
|
+
if (!this.treeData || !Array.isArray(this.treeData)) throw Error("if you using el-tree-v2 (Virtualized Tree) of element-plus,element-tree-line required data.");
|
|
157
|
+
e = {
|
|
158
|
+
children: Array.isArray(this.treeData) ? this.treeData.map((e) => ({
|
|
159
|
+
...e,
|
|
160
|
+
key: e.id
|
|
161
|
+
})) : [],
|
|
162
|
+
level: 0,
|
|
163
|
+
key: "node-0",
|
|
164
|
+
parent: null
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
if (e) {
|
|
168
|
+
let t = (e.children || e.childNodes).findIndex((e) => (e.key || e.id) === (c.key || c.id));
|
|
169
|
+
s.unshift(t === (e.children || e.childNodes).length - 1);
|
|
170
|
+
}
|
|
171
|
+
c = e;
|
|
172
|
+
}
|
|
173
|
+
let l = [];
|
|
174
|
+
for (let e = 0; e < this.node.level; e++) s[e] && this.node.level - 1 !== e || l.push(n("span", {
|
|
175
|
+
class: {
|
|
176
|
+
"element-tree-node-line-ver": !0,
|
|
177
|
+
"last-node-isLeaf-line": s[e] && this.node.level - 1 === e
|
|
178
|
+
},
|
|
179
|
+
style: { left: this.indent * e + "px" }
|
|
180
|
+
}));
|
|
181
|
+
return n("span", { class: "element-tree-node-label-wrapper" }, [o].concat(l, [n("span", {
|
|
182
|
+
class: "element-tree-node-line-hor",
|
|
183
|
+
style: {
|
|
184
|
+
width: (this.node.isLeaf ? 24 : 8) + "px",
|
|
185
|
+
left: (this.node.level - 1) * this.indent + "px"
|
|
186
|
+
}
|
|
187
|
+
})]));
|
|
188
|
+
},
|
|
189
|
+
methods: {
|
|
190
|
+
getScopedSlot(e) {
|
|
191
|
+
if (!e) return null;
|
|
192
|
+
let t = e.split("||"), n = null;
|
|
193
|
+
for (let e = 0; e < t.length; e++) {
|
|
194
|
+
let r = t[e], i = (this.$slots || {})[r];
|
|
195
|
+
if (i) {
|
|
196
|
+
n = i;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
if (n = (this.$scopedSlots || {})[r], n) break;
|
|
200
|
+
}
|
|
201
|
+
return n;
|
|
202
|
+
},
|
|
203
|
+
getScopedSlotValue(e, t, n = null) {
|
|
204
|
+
return typeof e == "function" ? e(t) || n : e || n;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function Fe(e) {
|
|
210
|
+
let t = Pe(e);
|
|
211
|
+
return e && (t.methods.getScopedSlot = function(e) {
|
|
212
|
+
if (!e) return null;
|
|
213
|
+
let t = e.split("||"), n = null;
|
|
214
|
+
for (let e = 0; e < t.length; e++) {
|
|
215
|
+
let r = t[e], i = (this.$slots || {})[r];
|
|
216
|
+
if (i) {
|
|
217
|
+
n = i;
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return n;
|
|
222
|
+
}), t;
|
|
223
|
+
}
|
|
224
|
+
Fe();
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region components/DocSyncSelect/utils.js
|
|
227
|
+
var Ie = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
|
|
228
|
+
var n = "Expected a function", r = NaN, i = "[object Symbol]", a = /^\s+|\s+$/g, o = /^[-+]0x[0-9a-f]+$/i, s = /^0b[01]+$/i, c = /^0o[0-7]+$/i, l = parseInt, u = typeof global == "object" && global && global.Object === Object && global, d = typeof self == "object" && self && self.Object === Object && self, f = u || d || Function("return this")(), p = Object.prototype.toString, m = Math.max, h = Math.min, g = function() {
|
|
229
|
+
return f.Date.now();
|
|
230
|
+
};
|
|
231
|
+
function _(e, t, r) {
|
|
232
|
+
var i, a, o, s, c, l, u = 0, d = !1, f = !1, p = !0;
|
|
233
|
+
if (typeof e != "function") throw TypeError(n);
|
|
234
|
+
t = x(t) || 0, v(r) && (d = !!r.leading, f = "maxWait" in r, o = f ? m(x(r.maxWait) || 0, t) : o, p = "trailing" in r ? !!r.trailing : p);
|
|
235
|
+
function _(t) {
|
|
236
|
+
var n = i, r = a;
|
|
237
|
+
return i = a = void 0, u = t, s = e.apply(r, n), s;
|
|
238
|
+
}
|
|
239
|
+
function y(e) {
|
|
240
|
+
return u = e, c = setTimeout(C, t), d ? _(e) : s;
|
|
241
|
+
}
|
|
242
|
+
function b(e) {
|
|
243
|
+
var n = e - l, r = e - u, i = t - n;
|
|
244
|
+
return f ? h(i, o - r) : i;
|
|
245
|
+
}
|
|
246
|
+
function S(e) {
|
|
247
|
+
var n = e - l, r = e - u;
|
|
248
|
+
return l === void 0 || n >= t || n < 0 || f && r >= o;
|
|
249
|
+
}
|
|
250
|
+
function C() {
|
|
251
|
+
var e = g();
|
|
252
|
+
if (S(e)) return w(e);
|
|
253
|
+
c = setTimeout(C, b(e));
|
|
254
|
+
}
|
|
255
|
+
function w(e) {
|
|
256
|
+
return c = void 0, p && i ? _(e) : (i = a = void 0, s);
|
|
257
|
+
}
|
|
258
|
+
function T() {
|
|
259
|
+
c !== void 0 && clearTimeout(c), u = 0, i = l = a = c = void 0;
|
|
260
|
+
}
|
|
261
|
+
function E() {
|
|
262
|
+
return c === void 0 ? s : w(g());
|
|
263
|
+
}
|
|
264
|
+
function D() {
|
|
265
|
+
var e = g(), n = S(e);
|
|
266
|
+
if (i = arguments, a = this, l = e, n) {
|
|
267
|
+
if (c === void 0) return y(l);
|
|
268
|
+
if (f) return c = setTimeout(C, t), _(l);
|
|
269
|
+
}
|
|
270
|
+
return c === void 0 && (c = setTimeout(C, t)), s;
|
|
271
|
+
}
|
|
272
|
+
return D.cancel = T, D.flush = E, D;
|
|
273
|
+
}
|
|
274
|
+
function v(e) {
|
|
275
|
+
var t = typeof e;
|
|
276
|
+
return !!e && (t == "object" || t == "function");
|
|
277
|
+
}
|
|
278
|
+
function y(e) {
|
|
279
|
+
return !!e && typeof e == "object";
|
|
280
|
+
}
|
|
281
|
+
function b(e) {
|
|
282
|
+
return typeof e == "symbol" || y(e) && p.call(e) == i;
|
|
283
|
+
}
|
|
284
|
+
function x(e) {
|
|
285
|
+
if (typeof e == "number") return e;
|
|
286
|
+
if (b(e)) return r;
|
|
287
|
+
if (v(e)) {
|
|
288
|
+
var t = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
289
|
+
e = v(t) ? t + "" : t;
|
|
290
|
+
}
|
|
291
|
+
if (typeof e != "string") return e === 0 ? e : +e;
|
|
292
|
+
e = e.replace(a, "");
|
|
293
|
+
var n = s.test(e);
|
|
294
|
+
return n || c.test(e) ? l(e.slice(2), n ? 2 : 8) : o.test(e) ? r : +e;
|
|
295
|
+
}
|
|
296
|
+
t.exports = _;
|
|
297
|
+
})))()), Le = (e) => e && Array.isArray(e) && e.length === 1 && e[0] && typeof e[0] == "object" && e[0].falseChild === !0, Re = (e) => !e || !e.children ? !0 : !Le(e.children), ze = (e, t = 800) => (0, Ie.default)((t) => {
|
|
298
|
+
e("search", { keyword: t });
|
|
299
|
+
}, t), Be = (e, t, n) => !e || !Array.isArray(e) ? [] : e.reduce((e, r) => {
|
|
300
|
+
let i = r[n.label]?.toLowerCase().includes(t.toLowerCase()), a = r.suffix?.toLowerCase().includes(t.toLowerCase());
|
|
301
|
+
if (i || a) e.push({ ...r });
|
|
302
|
+
else if (r[n.children]) {
|
|
303
|
+
let i = Be(r[n.children], t, n);
|
|
304
|
+
i.length > 0 && e.push({
|
|
305
|
+
...r,
|
|
306
|
+
[n.children]: i
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
return e;
|
|
310
|
+
}, []), Ve = (e, t) => {
|
|
311
|
+
let n = [];
|
|
312
|
+
if (!e) return n;
|
|
313
|
+
let r = e[t.children];
|
|
314
|
+
if (r && Array.isArray(r)) for (let e of r) n.push(e), n = n.concat(Ve(e, t));
|
|
315
|
+
return n;
|
|
316
|
+
}, He = (e, t, n = !1) => {
|
|
317
|
+
let r = 0;
|
|
318
|
+
function i(e) {
|
|
319
|
+
for (let a of e) {
|
|
320
|
+
let e = a[t.children] && a[t.children].length > 0;
|
|
321
|
+
n ? r++ : e || r++, e && i(a[t.children]);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return i(e), r;
|
|
325
|
+
}, Ue = (e, t, n) => {
|
|
326
|
+
let r = /* @__PURE__ */ new Map();
|
|
327
|
+
function i(e, a = []) {
|
|
328
|
+
for (let o of e) {
|
|
329
|
+
let e = [...a, o];
|
|
330
|
+
o.children && o.children.length > 0 ? i(o.children, e) : t.includes(o[n]) && a.forEach((e) => {
|
|
331
|
+
r.has(e[n]) || r.set(e[n], { ...e });
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return i(e), Array.from(r.values());
|
|
336
|
+
}, We = (e, t) => {
|
|
337
|
+
let n = t?.value || "id", r = t?.children || "children", i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
338
|
+
if (Array.isArray(e)) for (let t of e) {
|
|
339
|
+
t && t[n] != null && i.add(t[n]);
|
|
340
|
+
let e = t?.[r];
|
|
341
|
+
e && Array.isArray(e) && e.length > 0 && a(e);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
return a(e), i;
|
|
345
|
+
}, Ge = ({ tabKey: e, currentSelectedDocs: t, hasSelectToRightDocList: n, treeData: r, treeProps: i }) => {
|
|
346
|
+
let a = Array.isArray(n) ? n : [], o = i?.value, s = We((r && Array.isArray(r[e]) ? r[e] : []) || [], i), c = a.filter((e) => !s.has(e?.[o]));
|
|
347
|
+
return [...t, ...c];
|
|
348
|
+
}, Ke = (e, t, n) => {
|
|
349
|
+
if (!Array.isArray(e) || t == null) return null;
|
|
350
|
+
let r = n?.value || "id", i = n?.children || "children", a = (e) => {
|
|
351
|
+
for (let n of e) {
|
|
352
|
+
if (n && n[r] === t) return n;
|
|
353
|
+
let e = n?.[i];
|
|
354
|
+
if (Array.isArray(e) && e.length > 0) {
|
|
355
|
+
let t = a(e);
|
|
356
|
+
if (t) return t;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return null;
|
|
360
|
+
};
|
|
361
|
+
return a(e);
|
|
362
|
+
}, qe = (e, t) => {
|
|
363
|
+
if (!e) return !1;
|
|
364
|
+
let n = t?.children || "children";
|
|
365
|
+
if (Le(e[n])) return !0;
|
|
366
|
+
let r = e[n];
|
|
367
|
+
if (r && Array.isArray(r)) {
|
|
368
|
+
for (let e of r) if (qe(e, t)) return !0;
|
|
369
|
+
}
|
|
370
|
+
return !1;
|
|
371
|
+
}, Je = (e, t) => e === Q.MY_FILES ? t?.myFilesHasMore || !1 : e === Q.FEISHU_KNOWLEDGE && t?.feishuKnowledgeHasMore || !1, Ye = { class: "w-full h-full flex flex-col overflow-hidden" }, Xe = /*#__PURE__*/ i(/* @__PURE__ */ Object.assign({ name: "TreeSelectLayout" }, {
|
|
372
|
+
__name: "TreeSelectLayout",
|
|
373
|
+
props: {
|
|
374
|
+
modelValue: {
|
|
375
|
+
type: Object,
|
|
376
|
+
default: () => []
|
|
377
|
+
},
|
|
378
|
+
treeProps: {
|
|
379
|
+
type: Object,
|
|
380
|
+
default: () => Z
|
|
381
|
+
},
|
|
382
|
+
apiConfig: { type: Function },
|
|
383
|
+
loadNode: { type: Function },
|
|
384
|
+
reqParams: {
|
|
385
|
+
type: Object,
|
|
386
|
+
default: () => ({})
|
|
387
|
+
},
|
|
388
|
+
autoLoad: {
|
|
389
|
+
type: Boolean,
|
|
390
|
+
default: !0
|
|
391
|
+
},
|
|
392
|
+
isMultiple: {
|
|
393
|
+
type: Boolean,
|
|
394
|
+
default: !0
|
|
395
|
+
},
|
|
396
|
+
hasFilter: {
|
|
397
|
+
type: Boolean,
|
|
398
|
+
default: !1
|
|
399
|
+
},
|
|
400
|
+
treeList: {
|
|
401
|
+
type: Array,
|
|
402
|
+
default: () => []
|
|
403
|
+
},
|
|
404
|
+
hasTreeLine: {
|
|
405
|
+
type: Boolean,
|
|
406
|
+
default: !0
|
|
407
|
+
},
|
|
408
|
+
includeParentSelected: {
|
|
409
|
+
type: Boolean,
|
|
410
|
+
default: !1
|
|
411
|
+
},
|
|
412
|
+
textConfig: {
|
|
413
|
+
type: Object,
|
|
414
|
+
default: () => ({ searchPlaceholder: "" })
|
|
415
|
+
},
|
|
416
|
+
getTabSelectedDocuments: {
|
|
417
|
+
type: Function,
|
|
418
|
+
default: () => () => []
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
emits: [
|
|
422
|
+
"handleCheck",
|
|
423
|
+
"initFinish",
|
|
424
|
+
"node-expand"
|
|
425
|
+
],
|
|
426
|
+
setup(e, { expose: t, emit: n }) {
|
|
427
|
+
let r = Fe(g), i = e, a = n, d = ee(), p = () => g(oe, { style: {
|
|
428
|
+
color: "var(--text-color-2)",
|
|
429
|
+
fontSize: "16px"
|
|
430
|
+
} }), m = i.isMultiple ? 20 : 10, h = i.isMultiple ? 15 : 11, _ = M([]), v = M(null), S = M(null), C = o(() => i.treeProps.value), w = o(() => i.treeProps.label), T = o(() => i.treeProps.children), E = M(!1), O = o(() => !i.isMultiple && E.value), A = M([]), j = (e) => e?.[C.value] ?? e?.key ?? e?.data?.[C.value], N = (e, t = []) => ((e?.[T.value] || e?.data?.[T.value] || []).forEach((e) => {
|
|
431
|
+
let n = j(e);
|
|
432
|
+
n != null && t.push(n), N(e, t);
|
|
433
|
+
}), t), F = (e, t) => {
|
|
434
|
+
let n = j(e);
|
|
435
|
+
if (n == null) return;
|
|
436
|
+
if (t) {
|
|
437
|
+
if (d.accordion) {
|
|
438
|
+
A.value = [n];
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
A.value.includes(n) || (A.value = [...A.value, n]);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
let r = new Set([n, ...N(e)]);
|
|
445
|
+
A.value = A.value.filter((e) => !r.has(e));
|
|
446
|
+
}, I = () => {
|
|
447
|
+
b(() => {
|
|
448
|
+
v.value?.setExpandedKeys?.(A.value);
|
|
449
|
+
});
|
|
450
|
+
}, L = o(() => typeof i.apiConfig == "function"), R = () => {
|
|
451
|
+
let e = v.value?.getCheckedNodes(), t = e.map((e) => e[C.value]), n = [];
|
|
452
|
+
return i.includeParentSelected && (n = Ue(_.value, t, C.value)), {
|
|
453
|
+
selectedNodeValues: t,
|
|
454
|
+
selectedNodes: e,
|
|
455
|
+
selectedParentNodes: n
|
|
456
|
+
};
|
|
457
|
+
}, B = (e, t) => {
|
|
458
|
+
q(e, t);
|
|
459
|
+
}, V = (e) => {
|
|
460
|
+
F(e, !0), a("node-expand", e);
|
|
461
|
+
}, te = (e) => {
|
|
462
|
+
F(e, !1);
|
|
463
|
+
}, ne = (e, t) => {
|
|
464
|
+
i.isMultiple || (E.value = !0, S.value = t.key, a("handleCheck", {
|
|
465
|
+
selectedValue: [S.value],
|
|
466
|
+
selectedNode: [t.data]
|
|
467
|
+
}));
|
|
468
|
+
};
|
|
469
|
+
M("");
|
|
470
|
+
let re = (e, t) => t[w.value].includes(e), K = o(() => He(_.value, i.treeProps, i.includeParentSelected));
|
|
471
|
+
function q(e = null, t = null) {
|
|
472
|
+
let { selectedNodeValues: n, selectedNodes: r, selectedParentNodes: i } = R(), o = null;
|
|
473
|
+
if (e && t) {
|
|
474
|
+
let n = e[C.value];
|
|
475
|
+
o = t.checkedKeys.includes(n);
|
|
476
|
+
}
|
|
477
|
+
a("handleCheck", {
|
|
478
|
+
selectedValue: n,
|
|
479
|
+
selectedNode: r,
|
|
480
|
+
selectedParentNodes: i,
|
|
481
|
+
checkedNode: e,
|
|
482
|
+
isChecked: o
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
let ie = (e, t) => {
|
|
486
|
+
v.value?.setChecked(e, t), q();
|
|
487
|
+
}, se = () => {
|
|
488
|
+
d["default-checked-keys"] && b(() => {
|
|
489
|
+
q();
|
|
490
|
+
});
|
|
491
|
+
}, J = (e) => {
|
|
492
|
+
v.value && (!e || e.length === 0 ? v.value?.setCheckedKeys([]) : v.value?.setCheckedKeys(e));
|
|
493
|
+
}, ce = (e, t) => {
|
|
494
|
+
let n = (r) => {
|
|
495
|
+
for (let i = 0; i < r.length; i++) {
|
|
496
|
+
let a = r[i];
|
|
497
|
+
if (a[C.value] === e) {
|
|
498
|
+
let n = le(t);
|
|
499
|
+
return a[T.value] = n, a.isLeaf = !t || t.length === 0, console.log("节点更新后:", {
|
|
500
|
+
nodeKey: e,
|
|
501
|
+
childrenLength: n.length,
|
|
502
|
+
isLeaf: a.isLeaf
|
|
503
|
+
}), _.value = [..._.value], I(), !0;
|
|
504
|
+
}
|
|
505
|
+
if (a[T.value] && a[T.value].length > 0 && n(a[T.value])) return !0;
|
|
506
|
+
}
|
|
507
|
+
return !1;
|
|
508
|
+
};
|
|
509
|
+
n(_.value);
|
|
510
|
+
}, le = (e) => e?.map((e) => ({
|
|
511
|
+
...e,
|
|
512
|
+
[T.value]: e[T.value]?.length ? le(e[T.value]) : void 0
|
|
513
|
+
})), Y = async () => {
|
|
514
|
+
L.value ? i.apiConfig(i.reqParams)?.then((e) => {
|
|
515
|
+
_.value = le(e?.data?.orgOptionSoList || e?.data || []), I(), se(), X(i.modelValue), a("initFinish", _.value);
|
|
516
|
+
}) : ue();
|
|
517
|
+
}, ue = () => {
|
|
518
|
+
_.value = le(i.treeList || []), I(), _.value.length && (se(), X(i.modelValue));
|
|
519
|
+
}, X = (e) => {
|
|
520
|
+
let t = e && e.length && e.map((e) => e[i.treeProps.value]);
|
|
521
|
+
b(() => {
|
|
522
|
+
v.value?.setCheckedKeys(t);
|
|
523
|
+
});
|
|
524
|
+
};
|
|
525
|
+
return U(() => i.treeList, () => {
|
|
526
|
+
ue();
|
|
527
|
+
}, { deep: !0 }), U(() => i.modelValue, (e) => {
|
|
528
|
+
b(() => {
|
|
529
|
+
X(e);
|
|
530
|
+
});
|
|
531
|
+
}, { deep: !0 }), D(() => {
|
|
532
|
+
Y();
|
|
533
|
+
}), t({
|
|
534
|
+
allNodeNumbers: K,
|
|
535
|
+
loadData: Y,
|
|
536
|
+
setNodeCheckStatus: ie,
|
|
537
|
+
updateNodeChildren: ce,
|
|
538
|
+
syncSelectedNodes: J
|
|
539
|
+
}), (t, n) => (k(), l("div", Ye, [u("div", { class: x([e.hasFilter ? "pd-l-8 pd-r-8" : "", "flex-1 overflow-hidden"]) }, [f(H(G), null, {
|
|
540
|
+
default: W(({ width: n, height: i }) => [f(H(ae), y({
|
|
541
|
+
ref_key: "treeRef",
|
|
542
|
+
ref: v,
|
|
543
|
+
height: i,
|
|
544
|
+
width: n,
|
|
545
|
+
"check-strictly": !0,
|
|
546
|
+
data: _.value,
|
|
547
|
+
props: e.treeProps,
|
|
548
|
+
"node-key": C.value,
|
|
549
|
+
"show-checkbox": !0,
|
|
550
|
+
"item-size": H(34),
|
|
551
|
+
indent: H(m),
|
|
552
|
+
"highlight-current": O.value,
|
|
553
|
+
icon: p,
|
|
554
|
+
"filter-method": re,
|
|
555
|
+
lazy: "",
|
|
556
|
+
load: e.loadNode
|
|
557
|
+
}, H(d), {
|
|
558
|
+
onNodeClick: ne,
|
|
559
|
+
onCheck: B,
|
|
560
|
+
onNodeExpand: V,
|
|
561
|
+
onNodeCollapse: te,
|
|
562
|
+
class: ["hide-false-child-checkbox"]
|
|
563
|
+
}), {
|
|
564
|
+
default: W(({ node: n }) => [u("div", { class: x(["tree-node-content", { "false-child-node": n.data?.falseChild }]) }, [P(t.$slots, "node", {
|
|
565
|
+
node: n,
|
|
566
|
+
data: n.data
|
|
567
|
+
}, () => [e.hasTreeLine ? (k(), s(H(r), {
|
|
568
|
+
key: 0,
|
|
569
|
+
node: n,
|
|
570
|
+
treeData: _.value,
|
|
571
|
+
showLabelLine: !1,
|
|
572
|
+
indent: H(h)
|
|
573
|
+
}, null, 8, [
|
|
574
|
+
"node",
|
|
575
|
+
"treeData",
|
|
576
|
+
"indent"
|
|
577
|
+
])) : c("", !0), u("span", null, z(n.data[w.value]), 1)], !0)], 2)]),
|
|
578
|
+
empty: W(() => [f(H(_e))]),
|
|
579
|
+
_: 3
|
|
580
|
+
}, 16, [
|
|
581
|
+
"height",
|
|
582
|
+
"width",
|
|
583
|
+
"data",
|
|
584
|
+
"props",
|
|
585
|
+
"node-key",
|
|
586
|
+
"item-size",
|
|
587
|
+
"indent",
|
|
588
|
+
"highlight-current",
|
|
589
|
+
"load"
|
|
590
|
+
])]),
|
|
591
|
+
_: 3
|
|
592
|
+
})], 2)]));
|
|
593
|
+
}
|
|
594
|
+
}), [["__scopeId", "data-v-d92db7bd"]]);
|
|
595
|
+
//#endregion
|
|
596
|
+
//#region ../../../node_modules/.pnpm/vue-virtual-scroller@2.0.1_vue@3.5.38_typescript@5.9.3_/node_modules/vue-virtual-scroller/dist/vue-virtual-scroller.js
|
|
597
|
+
function Ze(e, t, n) {
|
|
598
|
+
if (!n) return t;
|
|
599
|
+
let r = e?.[n];
|
|
600
|
+
if (r == null) throw Error(`Key is ${r} on item (keyField is '${n}')`);
|
|
601
|
+
return r;
|
|
602
|
+
}
|
|
603
|
+
function Qe(e, t) {
|
|
604
|
+
return e.map((e, n) => Ze(e, n, t));
|
|
605
|
+
}
|
|
606
|
+
function $e(e, t, n) {
|
|
607
|
+
let r = [], i = [];
|
|
608
|
+
for (let a = 0; a < e.length; a++) {
|
|
609
|
+
let o = e[a], s = Ze(o, a, t), c = n(o, a, s);
|
|
610
|
+
r.push(s), i.push(typeof c == "number" && c > 0 ? c : null);
|
|
611
|
+
}
|
|
612
|
+
return {
|
|
613
|
+
keys: r,
|
|
614
|
+
sizes: i
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
function et(e, t, n) {
|
|
618
|
+
if (!e || e.keys.length !== t.length || e.sizes.length !== t.length) return !1;
|
|
619
|
+
for (let r = 0; r < t.length; r++) if (e.keys[r] !== Ze(t[r], r, n)) return !1;
|
|
620
|
+
return !0;
|
|
621
|
+
}
|
|
622
|
+
function tt(e, t, n) {
|
|
623
|
+
if (!et(e, t, n)) return {};
|
|
624
|
+
let r = {};
|
|
625
|
+
for (let t = 0; t < e.keys.length; t++) {
|
|
626
|
+
let n = e.sizes[t];
|
|
627
|
+
typeof n == "number" && n > 0 && (r[e.keys[t]] = n);
|
|
628
|
+
}
|
|
629
|
+
return r;
|
|
630
|
+
}
|
|
631
|
+
function nt(e, t) {
|
|
632
|
+
if (!e.length || t.length <= e.length) return 0;
|
|
633
|
+
let n = e[0], r = t.indexOf(n);
|
|
634
|
+
if (r <= 0 || r + e.length < t.length && e.length > t.length - r) return 0;
|
|
635
|
+
for (let n = 0; n < e.length; n++) if (t[r + n] !== e[n]) return 0;
|
|
636
|
+
return r;
|
|
637
|
+
}
|
|
638
|
+
function rt(e, t, n, r, i, a = 0) {
|
|
639
|
+
let o = i ?? "start";
|
|
640
|
+
if (o === "nearest") {
|
|
641
|
+
let i = n + r, o = e + t;
|
|
642
|
+
return e >= n && o <= i ? null : e < n ? e + a : o - r + a;
|
|
643
|
+
}
|
|
644
|
+
return o === "end" ? e + t - r + a : o === "center" ? e + (t - r) / 2 + a : e + a;
|
|
645
|
+
}
|
|
646
|
+
function it(e, t, n, r) {
|
|
647
|
+
let i = null, a = null, s = null, c = !1, l = null, u = [], d = n.resizeObserver ? () => {} : n.onVscrollUpdate(_), f = o(() => {
|
|
648
|
+
let t = V(e);
|
|
649
|
+
if (n.vscrollData.simpleArray) {
|
|
650
|
+
if (t.index == null) throw Error("index is required when using simple-array mode with dynamic item measurement");
|
|
651
|
+
return t.index;
|
|
652
|
+
}
|
|
653
|
+
if (n.vscrollData.keyField in t.item) return t.item[n.vscrollData.keyField];
|
|
654
|
+
throw Error(`keyField '${n.vscrollData.keyField}' not found in your item. You should set a valid keyField prop on your Scroller`);
|
|
655
|
+
}), p = o(() => n.vscrollData.sizes[f.value] || 0), m = o(() => V(e).active && n.vscrollData.active);
|
|
656
|
+
function h() {
|
|
657
|
+
m.value ? a !== f.value && (a = f.value, i = null, s = null, S(f.value)) : i = f.value;
|
|
658
|
+
}
|
|
659
|
+
function g() {
|
|
660
|
+
V(e).watchData && !n.resizeObserver ? l = U(() => V(e).item, () => {
|
|
661
|
+
v();
|
|
662
|
+
}, { deep: !0 }) : l &&= (l(), null);
|
|
663
|
+
}
|
|
664
|
+
function _({ force: e }) {
|
|
665
|
+
!m.value && e && (s = f.value), (i === f.value || e || !p.value) && h();
|
|
666
|
+
}
|
|
667
|
+
function v() {
|
|
668
|
+
h();
|
|
669
|
+
}
|
|
670
|
+
function y(e) {
|
|
671
|
+
n.undefinedMap[e] && n.undefinedSizeCount.value--, n.undefinedMap[e] = void 0;
|
|
672
|
+
}
|
|
673
|
+
function x(e, t) {
|
|
674
|
+
if (n.vscrollData.sizes[e]) {
|
|
675
|
+
y(e);
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
if (t) {
|
|
679
|
+
n.undefinedMap[e] || n.undefinedSizeCount.value++, n.undefinedMap[e] = !0;
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
n.undefinedMap[e] && (n.undefinedSizeCount.value--, n.undefinedMap[e] = !1);
|
|
683
|
+
}
|
|
684
|
+
function S(e) {
|
|
685
|
+
b(() => {
|
|
686
|
+
if (f.value === e) {
|
|
687
|
+
let e = V(t);
|
|
688
|
+
if (!e) return;
|
|
689
|
+
let n = e.offsetWidth, r = e.offsetHeight;
|
|
690
|
+
C(n, r);
|
|
691
|
+
}
|
|
692
|
+
a = null;
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
function C(e, t) {
|
|
696
|
+
let r = ~~(n.direction.value === "vertical" ? t : e);
|
|
697
|
+
r && p.value !== r && w(r);
|
|
698
|
+
}
|
|
699
|
+
function w(t) {
|
|
700
|
+
var i, a;
|
|
701
|
+
y(f.value), n.vscrollData.sizes[f.value] = t, V(e).emitResize && ((a = (i = V(r))?.onResize) == null || a.call(i, f.value));
|
|
702
|
+
}
|
|
703
|
+
function T() {
|
|
704
|
+
if (!n.resizeObserver || c) return;
|
|
705
|
+
let e = V(t);
|
|
706
|
+
e && (n.resizeObserver.observe(e), e.$_vs_id = f.value, e.$_vs_onResize = D, c = !0);
|
|
707
|
+
}
|
|
708
|
+
function E() {
|
|
709
|
+
if (!n.resizeObserver || !c) return;
|
|
710
|
+
let e = V(t);
|
|
711
|
+
e && (n.resizeObserver.unobserve(e), e.$_vs_onResize = void 0, c = !1);
|
|
712
|
+
}
|
|
713
|
+
function D(e, t, n) {
|
|
714
|
+
f.value === e && C(t, n);
|
|
715
|
+
}
|
|
716
|
+
u.push(U(() => V(e).watchData, () => {
|
|
717
|
+
g();
|
|
718
|
+
})), n.resizeObserver || u.push(U(() => V(e).sizeDependencies, () => {
|
|
719
|
+
v();
|
|
720
|
+
}, { deep: !0 })), u.push(U(f, (e, r) => {
|
|
721
|
+
let a = V(t);
|
|
722
|
+
a && (a.$_vs_id = e), y(r), x(e, m.value);
|
|
723
|
+
let o = n.vscrollData.sizes[e];
|
|
724
|
+
if (!o) {
|
|
725
|
+
i = e, v();
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
y(e), c && (n.vscrollData.sizes[e] = o);
|
|
729
|
+
})), u.push(U(m, (e) => {
|
|
730
|
+
x(f.value, e), n.resizeObserver ? e ? T() : E() : e && s === f.value && h();
|
|
731
|
+
})), g();
|
|
732
|
+
function O() {
|
|
733
|
+
m.value && (h(), T());
|
|
734
|
+
}
|
|
735
|
+
function k() {
|
|
736
|
+
d(), E(), y(f.value);
|
|
737
|
+
let e = V(t);
|
|
738
|
+
e && (e.$_vs_id = void 0, e.$_vs_onResize = void 0), l &&= (l(), null);
|
|
739
|
+
for (let e of u) e();
|
|
740
|
+
u.length = 0;
|
|
741
|
+
}
|
|
742
|
+
return {
|
|
743
|
+
id: f,
|
|
744
|
+
size: p,
|
|
745
|
+
finalActive: m,
|
|
746
|
+
updateSize: h,
|
|
747
|
+
mount: O,
|
|
748
|
+
unmount: k
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
var at = { itemsLimit: 1e3 };
|
|
752
|
+
function ot(e) {
|
|
753
|
+
return typeof window < "u" && e === window;
|
|
754
|
+
}
|
|
755
|
+
var st = (() => {
|
|
756
|
+
if (typeof document > "u") return "negative";
|
|
757
|
+
let e = document.createElement("div"), t = document.createElement("div");
|
|
758
|
+
e.style.width = "4px", e.style.height = "1px", e.style.overflow = "auto", e.style.direction = "rtl", t.style.width = "8px", t.style.height = "1px", e.appendChild(t), document.body.appendChild(e), e.scrollLeft = -1;
|
|
759
|
+
let n = e.scrollLeft < 0;
|
|
760
|
+
return document.body.removeChild(e), n ? "negative" : "default";
|
|
761
|
+
})();
|
|
762
|
+
function ct(e, t, n) {
|
|
763
|
+
return t !== "horizontal" || !n || ot(n) || getComputedStyle(n).direction !== "rtl" ? e : st === "negative" ? -e : e;
|
|
764
|
+
}
|
|
765
|
+
function lt(e, t, n) {
|
|
766
|
+
return ct(e, t, n);
|
|
767
|
+
}
|
|
768
|
+
function ut(e, t, n, r) {
|
|
769
|
+
let i = lt(n, t, e), a = !!(r != null && r.smooth);
|
|
770
|
+
if (ot(e)) {
|
|
771
|
+
t === "vertical" ? e.scrollTo({
|
|
772
|
+
top: i,
|
|
773
|
+
behavior: a ? "smooth" : "auto"
|
|
774
|
+
}) : e.scrollTo({
|
|
775
|
+
left: i,
|
|
776
|
+
behavior: a ? "smooth" : "auto"
|
|
777
|
+
});
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
if (typeof e.scrollTo == "function") {
|
|
781
|
+
e.scrollTo(t === "vertical" ? {
|
|
782
|
+
top: i,
|
|
783
|
+
behavior: a ? "smooth" : "auto"
|
|
784
|
+
} : {
|
|
785
|
+
left: i,
|
|
786
|
+
behavior: a ? "smooth" : "auto"
|
|
787
|
+
});
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
t === "vertical" ? e.scrollTop = i : e.scrollLeft = i;
|
|
791
|
+
}
|
|
792
|
+
function dt(e, t, n) {
|
|
793
|
+
return n ? t === "vertical" ? window.innerHeight : window.innerWidth : t === "vertical" ? e.clientHeight : e.clientWidth;
|
|
794
|
+
}
|
|
795
|
+
var ft = /auto|scroll/;
|
|
796
|
+
function pt(e, t) {
|
|
797
|
+
return e.parentNode === null ? t : pt(e.parentNode, [...t, e]);
|
|
798
|
+
}
|
|
799
|
+
function mt(e, t) {
|
|
800
|
+
return getComputedStyle(e, null).getPropertyValue(t);
|
|
801
|
+
}
|
|
802
|
+
function ht(e) {
|
|
803
|
+
return mt(e, "overflow") + mt(e, "overflow-y") + mt(e, "overflow-x");
|
|
804
|
+
}
|
|
805
|
+
function gt(e) {
|
|
806
|
+
return ft.test(ht(e));
|
|
807
|
+
}
|
|
808
|
+
function _t(e) {
|
|
809
|
+
if (!(e instanceof HTMLElement || e instanceof SVGElement)) return;
|
|
810
|
+
let t = pt(e.parentNode, []);
|
|
811
|
+
for (let e = 0; e < t.length; e += 1) if (t[e] instanceof Element && gt(t[e])) return t[e];
|
|
812
|
+
return document.scrollingElement || document.documentElement;
|
|
813
|
+
}
|
|
814
|
+
var vt = !1;
|
|
815
|
+
function yt() {
|
|
816
|
+
return vt;
|
|
817
|
+
}
|
|
818
|
+
if (typeof window < "u") {
|
|
819
|
+
vt = !1;
|
|
820
|
+
try {
|
|
821
|
+
let e = Object.defineProperty({}, "passive", { get() {
|
|
822
|
+
vt = !0;
|
|
823
|
+
} });
|
|
824
|
+
window.addEventListener("test", null, e);
|
|
825
|
+
} catch {}
|
|
826
|
+
}
|
|
827
|
+
var bt = 0;
|
|
828
|
+
function xt(e) {
|
|
829
|
+
let t = e;
|
|
830
|
+
t._vs_styleStamp++;
|
|
831
|
+
}
|
|
832
|
+
function St(e, t, n) {
|
|
833
|
+
let r = e?.[n];
|
|
834
|
+
if (r == null) throw Error(`Key is ${r} on item (keyField is '${n}')`);
|
|
835
|
+
return r;
|
|
836
|
+
}
|
|
837
|
+
function Ct(e, t, n, r, i) {
|
|
838
|
+
let a = M([]), s = M(0), c = M(!1), l = 0, u = 0, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = !1, m = 0, h = 0, g = !1, _ = null, y = null, x = null, S = 0, C = null, E = [], O = null, k = null, A = null, j = !1, N = /* @__PURE__ */ new Set(), P = M({}), F = o(() => {
|
|
839
|
+
let t = V(e);
|
|
840
|
+
return t.items.length > 0 && typeof t.items[0] != "object";
|
|
841
|
+
}), I = o(() => {
|
|
842
|
+
let t = V(e);
|
|
843
|
+
if (t.itemSize === null) {
|
|
844
|
+
let e = { [-1]: { accumulator: 0 } }, n = t.items, r = t.sizeField ?? "size", i = t.minItemSize, a = P.value, o = 1e4, s = 0, c;
|
|
845
|
+
for (let l = 0, u = n.length; l < u; l++) c = a[F.value ? l : St(n[l], l, t.keyField)] || n[l][r] || i, c < o && (o = c), s += c, e[l] = {
|
|
846
|
+
accumulator: s,
|
|
847
|
+
size: c
|
|
848
|
+
};
|
|
849
|
+
return S = o, e;
|
|
850
|
+
}
|
|
851
|
+
return [];
|
|
852
|
+
}), R = o(() => a.value.filter((e) => e.nr.used).sort((e, t) => e.nr.index - t.nr.index)), z = o(() => {
|
|
853
|
+
let t = V(e), n = F.value ? null : t.keyField;
|
|
854
|
+
return $e(t.items, n, (e, n, r) => t.itemSize == null ? P.value[r] || e?.[t.sizeField ?? "size"] || void 0 : t.itemSize);
|
|
855
|
+
});
|
|
856
|
+
function B(t) {
|
|
857
|
+
let n = V(e);
|
|
858
|
+
return P.value = tt(t, n.items, F.value ? null : n.keyField), Object.keys(P.value).length > 0;
|
|
859
|
+
}
|
|
860
|
+
function H(e) {
|
|
861
|
+
let t = f.get(e);
|
|
862
|
+
return t || (t = [], f.set(e, t)), t;
|
|
863
|
+
}
|
|
864
|
+
function ee(e, t, n, r, i) {
|
|
865
|
+
let a = L({
|
|
866
|
+
item: n,
|
|
867
|
+
position: 0,
|
|
868
|
+
offset: 0,
|
|
869
|
+
nr: v({
|
|
870
|
+
id: bt++,
|
|
871
|
+
index: t,
|
|
872
|
+
used: !0,
|
|
873
|
+
key: r,
|
|
874
|
+
type: i
|
|
875
|
+
}),
|
|
876
|
+
_vs_styleStamp: 0
|
|
877
|
+
});
|
|
878
|
+
return e.push(a), a;
|
|
879
|
+
}
|
|
880
|
+
function W(e) {
|
|
881
|
+
let t = H(e);
|
|
882
|
+
if (t && t.length) {
|
|
883
|
+
let e = t.pop();
|
|
884
|
+
return e.nr.used = !0, xt(e), e;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
function te(e) {
|
|
888
|
+
let t = e.nr.type;
|
|
889
|
+
H(t).push(e), e.nr.used = !1, e.position = -9999, xt(e), d.delete(e.nr.key);
|
|
890
|
+
}
|
|
891
|
+
function ne() {
|
|
892
|
+
d.clear(), f.clear();
|
|
893
|
+
for (let e = 0, t = a.value.length; e < t; e++) {
|
|
894
|
+
let t = a.value[e];
|
|
895
|
+
t && te(t);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
function G(e) {
|
|
899
|
+
let t = -1;
|
|
900
|
+
return t = requestAnimationFrame(() => {
|
|
901
|
+
N.delete(t), e();
|
|
902
|
+
}), N.add(t), t;
|
|
903
|
+
}
|
|
904
|
+
function re() {
|
|
905
|
+
for (let e of N) cancelAnimationFrame(e);
|
|
906
|
+
N.clear();
|
|
907
|
+
}
|
|
908
|
+
function K() {
|
|
909
|
+
_ &&= (clearTimeout(_), null), y &&= (clearTimeout(y), null), x &&= (clearTimeout(x), null), k &&= (clearTimeout(k), null), A &&= (clearTimeout(A), null);
|
|
910
|
+
}
|
|
911
|
+
function q() {
|
|
912
|
+
var e;
|
|
913
|
+
(e = i?.onResize) == null || e.call(i), c.value && Z(!1);
|
|
914
|
+
}
|
|
915
|
+
function ie() {
|
|
916
|
+
O && !j && X();
|
|
917
|
+
let t = V(e);
|
|
918
|
+
if (!p) {
|
|
919
|
+
if (p = !0, _) return;
|
|
920
|
+
let e = () => G(() => {
|
|
921
|
+
p = !1;
|
|
922
|
+
let { continuous: e } = Z(!1, !0);
|
|
923
|
+
e || (y && clearTimeout(y), y = setTimeout(ie, t.updateInterval + 100));
|
|
924
|
+
});
|
|
925
|
+
e(), t.updateInterval && (_ = setTimeout(() => {
|
|
926
|
+
_ = null, p && e();
|
|
927
|
+
}, t.updateInterval));
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
function ae(e, t) {
|
|
931
|
+
var n, r;
|
|
932
|
+
c.value && (e || t.boundingClientRect.width !== 0 || t.boundingClientRect.height !== 0 ? ((n = i?.onVisible) == null || n.call(i), G(() => {
|
|
933
|
+
Z(!1);
|
|
934
|
+
})) : (r = i?.onHidden) == null || r.call(i));
|
|
935
|
+
}
|
|
936
|
+
function oe() {
|
|
937
|
+
let e = V(t), n = e ? _t(e) : void 0;
|
|
938
|
+
return window.document && (n === window.document.documentElement || n === window.document.body) ? window : n || window;
|
|
939
|
+
}
|
|
940
|
+
function se() {
|
|
941
|
+
let t = V(n);
|
|
942
|
+
return t ? V(e).direction === "vertical" ? t.scrollHeight : t.scrollWidth : 0;
|
|
943
|
+
}
|
|
944
|
+
function J() {
|
|
945
|
+
let n = V(t);
|
|
946
|
+
if (!n) return {
|
|
947
|
+
start: 0,
|
|
948
|
+
end: 0
|
|
949
|
+
};
|
|
950
|
+
let r = V(e), i = r.direction === "vertical", a;
|
|
951
|
+
if (r.pageMode) {
|
|
952
|
+
let e = n.getBoundingClientRect(), t = i ? e.height : e.width, r = -(i ? e.top : e.left), o = i ? window.innerHeight : window.innerWidth;
|
|
953
|
+
r < 0 && (o += r, r = 0), r + o > t && (o = t - r), a = {
|
|
954
|
+
start: r,
|
|
955
|
+
end: r + o
|
|
956
|
+
};
|
|
957
|
+
} else a = i ? {
|
|
958
|
+
start: n.scrollTop,
|
|
959
|
+
end: n.scrollTop + n.clientHeight
|
|
960
|
+
} : {
|
|
961
|
+
start: ct(n.scrollLeft, r.direction, n),
|
|
962
|
+
end: ct(n.scrollLeft, r.direction, n) + n.clientWidth
|
|
963
|
+
};
|
|
964
|
+
return a;
|
|
965
|
+
}
|
|
966
|
+
function ce() {
|
|
967
|
+
let n = V(t);
|
|
968
|
+
if (!n) return {
|
|
969
|
+
start: 0,
|
|
970
|
+
end: 0
|
|
971
|
+
};
|
|
972
|
+
if (V(e).direction === "vertical") {
|
|
973
|
+
let e = ct(n.scrollLeft, "horizontal", n);
|
|
974
|
+
return {
|
|
975
|
+
start: e,
|
|
976
|
+
end: e + n.clientWidth
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
return {
|
|
980
|
+
start: n.scrollTop,
|
|
981
|
+
end: n.scrollTop + n.clientHeight
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
function le(t) {
|
|
985
|
+
let n = V(e);
|
|
986
|
+
return n.itemSize == null ? I.value[t]?.size || Number(n.minItemSize) || 0 : n.itemSize;
|
|
987
|
+
}
|
|
988
|
+
function Y(t) {
|
|
989
|
+
let n = V(e), r = n.gridItems || 1;
|
|
990
|
+
return t <= 0 ? 0 : n.itemSize == null ? I.value[t - 1]?.accumulator || 0 : Math.floor(t / r) * n.itemSize;
|
|
991
|
+
}
|
|
992
|
+
function ue(t) {
|
|
993
|
+
let n = V(e), r = n.items.length, i = n.gridItems || 1;
|
|
994
|
+
if (!r) return 0;
|
|
995
|
+
if (n.itemSize != null) {
|
|
996
|
+
let e = Math.floor(t / n.itemSize) * i;
|
|
997
|
+
return Math.min(Math.max(e, 0), r - 1);
|
|
998
|
+
}
|
|
999
|
+
let a = 0, o = r - 1, s = 0;
|
|
1000
|
+
for (; a <= o;) {
|
|
1001
|
+
let e = Math.floor((a + o) / 2);
|
|
1002
|
+
Y(e) <= t ? (s = e, a = e + 1) : o = e - 1;
|
|
1003
|
+
}
|
|
1004
|
+
return s;
|
|
1005
|
+
}
|
|
1006
|
+
function X() {
|
|
1007
|
+
k &&= (clearTimeout(k), null), O = null;
|
|
1008
|
+
}
|
|
1009
|
+
function de() {
|
|
1010
|
+
k && clearTimeout(k), k = setTimeout(() => {
|
|
1011
|
+
O = null, k = null;
|
|
1012
|
+
}, 150);
|
|
1013
|
+
}
|
|
1014
|
+
function fe(e, t) {
|
|
1015
|
+
if (!e.length) {
|
|
1016
|
+
X();
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
let n = Math.max(J().start - se(), 0), r = Math.min(ue(n), e.length - 1), i = e[r], a = t ? i?.[t] : r;
|
|
1020
|
+
if (a == null) {
|
|
1021
|
+
X();
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
let o = se() + Y(r);
|
|
1025
|
+
O = {
|
|
1026
|
+
key: a,
|
|
1027
|
+
offset: J().start - o
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
function pe(t) {
|
|
1031
|
+
if (!O) return !1;
|
|
1032
|
+
let n = V(e), r = Qe(t ?? n.items, F.value ? null : n.keyField).indexOf(O.key);
|
|
1033
|
+
if (r === -1) return X(), !1;
|
|
1034
|
+
let i = se() + Y(r) + O.offset, a = J().start;
|
|
1035
|
+
return Math.abs(i - a) < .5 ? !1 : (j = !0, Se(i), G(() => {
|
|
1036
|
+
j = !1;
|
|
1037
|
+
}), !0);
|
|
1038
|
+
}
|
|
1039
|
+
function me() {
|
|
1040
|
+
V(e).pageMode ? he() : ge();
|
|
1041
|
+
}
|
|
1042
|
+
function he() {
|
|
1043
|
+
C = oe(), C.addEventListener("scroll", ie, yt() ? { passive: !0 } : !1), C.addEventListener("resize", q);
|
|
1044
|
+
}
|
|
1045
|
+
function ge() {
|
|
1046
|
+
C &&= (C.removeEventListener("scroll", ie), C.removeEventListener("resize", q), null);
|
|
1047
|
+
}
|
|
1048
|
+
function _e(e, t, n, r, i, a) {
|
|
1049
|
+
let o = Math.ceil(e / t) * n, s = Math.max(0, Math.floor(i.start / n)), c = Math.min(Math.ceil(i.end / n), Math.ceil(e / t)), l = Math.max(0, Math.floor(a.start / r)), u = Math.min(Math.ceil(a.end / r), t), d = [];
|
|
1050
|
+
for (let n = s; n < c; n++) {
|
|
1051
|
+
let r = n * t;
|
|
1052
|
+
for (let t = l; t < u; t++) {
|
|
1053
|
+
let n = r + t;
|
|
1054
|
+
if (n >= e) break;
|
|
1055
|
+
d.push(n);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
let f = d[0] ?? 0, p = d.at(-1) ?? -1;
|
|
1059
|
+
return {
|
|
1060
|
+
renderedIndices: d,
|
|
1061
|
+
startIndex: f,
|
|
1062
|
+
endIndex: p + 1,
|
|
1063
|
+
visibleStartIndex: f,
|
|
1064
|
+
visibleEndIndex: p,
|
|
1065
|
+
totalSize: o
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
1068
|
+
function ve() {
|
|
1069
|
+
let n = V(e);
|
|
1070
|
+
if (!n.gridItems || n.itemSize == null) return !1;
|
|
1071
|
+
let r = V(t);
|
|
1072
|
+
if (!r) return !1;
|
|
1073
|
+
let i = n.itemSecondarySize || n.itemSize, a = n.direction === "vertical" ? r.clientWidth : r.clientHeight;
|
|
1074
|
+
return i * n.gridItems > a;
|
|
1075
|
+
}
|
|
1076
|
+
function Z(t, o = !1) {
|
|
1077
|
+
var c;
|
|
1078
|
+
let f = V(e), p = f.itemSize, _ = f.gridItems || 1, v = f.itemSecondarySize || p, y = S, b = f.typeField, C = F.value ? null : f.keyField, w = f.items, T = w.length, E = I.value, D = d, O = a.value, k = null, A = null, j, M, N, P, L;
|
|
1079
|
+
if (!T) j = M = P = L = N = 0;
|
|
1080
|
+
else if (g) j = P = 0, M = L = Math.min(f.prerender, w.length), N = 0;
|
|
1081
|
+
else {
|
|
1082
|
+
let e = J(), t = ce();
|
|
1083
|
+
if (o) {
|
|
1084
|
+
let n = e.start - m;
|
|
1085
|
+
n < 0 && (n = -n);
|
|
1086
|
+
let r = t.start - h;
|
|
1087
|
+
if (r < 0 && (r = -r), !(p === null && n >= y || p !== null && n >= p) && !(_ > 1 && p != null && r >= v)) return { continuous: !0 };
|
|
1088
|
+
}
|
|
1089
|
+
m = e.start, h = t.start;
|
|
1090
|
+
let i = f.buffer;
|
|
1091
|
+
e.start -= i, e.end += i, t.start -= i, t.end += i;
|
|
1092
|
+
let a = 0, s = V(n);
|
|
1093
|
+
s && (a = s.scrollHeight, e.start -= a);
|
|
1094
|
+
let c = V(r);
|
|
1095
|
+
if (c) {
|
|
1096
|
+
let t = c.scrollHeight;
|
|
1097
|
+
e.end += t;
|
|
1098
|
+
}
|
|
1099
|
+
if (p === null) {
|
|
1100
|
+
let t, n = 0, r = T - 1, i = ~~(T / 2), o;
|
|
1101
|
+
do
|
|
1102
|
+
o = i, t = E[i].accumulator, t < e.start ? n = i : i < T - 1 && E[i + 1].accumulator > e.start && (r = i), i = ~~((n + r) / 2);
|
|
1103
|
+
while (i !== o);
|
|
1104
|
+
for (i < 0 && (i = 0), j = i, N = E[T - 1].accumulator, M = i; M < T && E[M].accumulator < e.end; M++);
|
|
1105
|
+
for (M === -1 ? M = w.length - 1 : (M++, M > T && (M = T)), P = j; P < T && a + E[P].accumulator < e.start; P++);
|
|
1106
|
+
for (L = P; L < T && a + E[L].accumulator < e.end; L++);
|
|
1107
|
+
} else if (_ > 1) {
|
|
1108
|
+
let n = _e(T, _, p, v, e, t);
|
|
1109
|
+
k = n.renderedIndices, A = new Set(k), j = n.startIndex, M = n.endIndex, P = n.visibleStartIndex, L = n.visibleEndIndex, N = n.totalSize;
|
|
1110
|
+
} else {
|
|
1111
|
+
j = ~~(e.start / p * _);
|
|
1112
|
+
let t = j % _;
|
|
1113
|
+
j -= t, M = Math.ceil(e.end / p * _), P = Math.max(0, Math.floor((e.start - a) / p * _)), L = Math.floor((e.end - a) / p * _), j < 0 && (j = 0), M > T && (M = T), P < 0 && (P = 0), L > T && (L = T), N = Math.ceil(T / _) * p;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
M - j > at.itemsLimit && ye(), s.value = N;
|
|
1117
|
+
let R, z = j <= u && M >= l;
|
|
1118
|
+
if (!z || t) ne();
|
|
1119
|
+
else for (let e = 0, t = O.length; e < t; e++) {
|
|
1120
|
+
let t = O[e];
|
|
1121
|
+
if (t && (R = t, R.nr.used)) {
|
|
1122
|
+
let e = A ? A.has(R.nr.index) : R.nr.index >= j && R.nr.index < M, t = p || E[R.nr.index] && E[R.nr.index].size;
|
|
1123
|
+
(!e || !t) && te(R);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
let B, H, U = k ?? Array.from({ length: Math.max(0, M - j) }, (e, t) => j + t);
|
|
1127
|
+
for (let e of U) {
|
|
1128
|
+
if (!(p || E[e] && E[e].size)) continue;
|
|
1129
|
+
B = w[e];
|
|
1130
|
+
let t = C ? B[C] : e;
|
|
1131
|
+
if (t == null) throw Error(`Key is ${t} on item (keyField is '${C}')`);
|
|
1132
|
+
if (R = D.get(t), R) R.item !== B && (R.item = B), R.nr.used || console.warn(`Expected existing view's used flag to be true, got ${R.nr.used}`);
|
|
1133
|
+
else {
|
|
1134
|
+
if (H = B[b], R = W(H), R) {
|
|
1135
|
+
let n = R.nr.index !== e || R.nr.key !== t;
|
|
1136
|
+
R.item = B, R.nr.index = e, R.nr.key = t, R.nr.type !== H && console.warn("Reused view's type does not match pool's type"), n && xt(R);
|
|
1137
|
+
} else R = ee(O, e, B, t, H);
|
|
1138
|
+
D.set(t, R);
|
|
1139
|
+
}
|
|
1140
|
+
p === null ? (R.position = E[e - 1]?.accumulator || 0, R.offset = 0) : (R.position = Math.floor(e / _) * p, R.offset = e % _ * v);
|
|
1141
|
+
}
|
|
1142
|
+
return l = j, u = M, f.emitUpdate && ((c = i?.onUpdate) == null || c.call(i, j, M, P, L)), x && clearTimeout(x), x = setTimeout(Q, f.updateInterval + 300), { continuous: z };
|
|
1143
|
+
}
|
|
1144
|
+
function ye() {
|
|
1145
|
+
throw A = setTimeout(() => {
|
|
1146
|
+
A = null, console.warn("It seems the scroller element isn't scrolling, so it tries to render all the items at once.", "Scroller:", V(t)), console.warn("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.");
|
|
1147
|
+
}), /* @__PURE__ */ Error("Rendered items limit reached");
|
|
1148
|
+
}
|
|
1149
|
+
function be() {
|
|
1150
|
+
if (ve()) return !1;
|
|
1151
|
+
let e = a.value.filter(({ nr: e }) => e.used);
|
|
1152
|
+
for (let t = 1; t < e.length; t++) if (e[t].nr.index !== e[t - 1].nr.index + 1) return !0;
|
|
1153
|
+
return !1;
|
|
1154
|
+
}
|
|
1155
|
+
function Q() {
|
|
1156
|
+
a.value.sort((e, t) => e.nr.index - t.nr.index), be() && (Z(!1), x && clearTimeout(x));
|
|
1157
|
+
}
|
|
1158
|
+
function xe(n, r) {
|
|
1159
|
+
let i = V(e), a = V(t);
|
|
1160
|
+
if (!a) return;
|
|
1161
|
+
let o = Math.max(0, Math.min(n, i.items.length - 1)), s = J().start, c = dt(a, i.direction, i.pageMode), l = rt(Y(o), le(o), s, c, r?.align, r?.offset ?? 0);
|
|
1162
|
+
if (l != null && (Se(l, r), i.gridItems && i.itemSize != null)) {
|
|
1163
|
+
let e = V(t);
|
|
1164
|
+
if (!e) return;
|
|
1165
|
+
let n = i.gridItems, a = i.itemSecondarySize || i.itemSize, s = o % n * a, c = i.direction === "vertical" ? "horizontal" : "vertical", l = rt(s, a, c === "horizontal" ? ct(e.scrollLeft, "horizontal", e) : e.scrollTop, c === "horizontal" ? e.clientWidth : e.clientHeight, r?.align, r?.offset ?? 0);
|
|
1166
|
+
l != null && ut(e, c, l, r);
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
function Se(n, r) {
|
|
1170
|
+
let i = V(e), a = V(t);
|
|
1171
|
+
if (a) if (i.pageMode) {
|
|
1172
|
+
let e = _t(a), t = e.getBoundingClientRect(), o = a.getBoundingClientRect(), s = i.direction === "vertical" ? "top" : "left", c = _t(a) === document.documentElement || _t(a) === document.body ? i.direction === "vertical" ? window.scrollY : window.scrollX : ct(i.direction === "vertical" ? e.scrollTop : e.scrollLeft, i.direction, e), l = o[s] - t[s];
|
|
1173
|
+
ut(e.tagName === "HTML" ? window : e, i.direction, n + c + l, r);
|
|
1174
|
+
} else ut(a, i.direction, n, r);
|
|
1175
|
+
}
|
|
1176
|
+
let $ = V(e);
|
|
1177
|
+
return E = Qe($.items, $.items.length > 0 && typeof $.items[0] != "object" ? null : $.keyField), $.cache && B($.cache), $.prerender && (g = !0, Z(!1)), $.gridItems && !$.itemSize && console.error("[vue-recycle-scroller] You must provide an itemSize when using gridItems"), D(() => {
|
|
1178
|
+
me(), b(() => {
|
|
1179
|
+
g = !1, Z(!0), c.value = !0;
|
|
1180
|
+
});
|
|
1181
|
+
}), w(() => {
|
|
1182
|
+
let e = m;
|
|
1183
|
+
typeof e == "number" && b(() => {
|
|
1184
|
+
Se(e);
|
|
1185
|
+
});
|
|
1186
|
+
}), T(() => {
|
|
1187
|
+
K(), re(), ge();
|
|
1188
|
+
}), U(() => V(e).cache, (e) => {
|
|
1189
|
+
B(e), Z(!0);
|
|
1190
|
+
}), U(() => V(e).items, (t, n) => {
|
|
1191
|
+
let r = V(e), i = F.value ? null : r.keyField, a = Qe(t, i);
|
|
1192
|
+
r.shift && nt(n ? Qe(n, i) : E, a) > 0 ? fe(n ?? [], i) : X(), E = a, pe(t), Z(!0);
|
|
1193
|
+
}), U(() => V(e).pageMode, () => {
|
|
1194
|
+
me(), Z(!1);
|
|
1195
|
+
}), U(I, () => {
|
|
1196
|
+
pe() && de(), Z(!1);
|
|
1197
|
+
}, { deep: !0 }), U(() => V(e).gridItems, () => {
|
|
1198
|
+
Z(!0);
|
|
1199
|
+
}), U(() => V(e).itemSecondarySize, () => {
|
|
1200
|
+
Z(!0);
|
|
1201
|
+
}), {
|
|
1202
|
+
pool: a,
|
|
1203
|
+
visiblePool: R,
|
|
1204
|
+
totalSize: s,
|
|
1205
|
+
ready: c,
|
|
1206
|
+
sizes: I,
|
|
1207
|
+
simpleArray: F,
|
|
1208
|
+
scrollToItem: xe,
|
|
1209
|
+
scrollToPosition: Se,
|
|
1210
|
+
getScroll: J,
|
|
1211
|
+
findItemIndex: ue,
|
|
1212
|
+
getItemOffset: Y,
|
|
1213
|
+
getItemSize: le,
|
|
1214
|
+
cacheSnapshot: z,
|
|
1215
|
+
restoreCache: B,
|
|
1216
|
+
updateVisibleItems: Z,
|
|
1217
|
+
handleScroll: ie,
|
|
1218
|
+
handleResize: q,
|
|
1219
|
+
handleVisibilityChange: ae,
|
|
1220
|
+
sortViews: Q
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
function wt(e) {
|
|
1224
|
+
return e.item;
|
|
1225
|
+
}
|
|
1226
|
+
function Tt(e) {
|
|
1227
|
+
return e._vs_styleStamp ?? 0;
|
|
1228
|
+
}
|
|
1229
|
+
var Et = [
|
|
1230
|
+
"position",
|
|
1231
|
+
"top",
|
|
1232
|
+
"left",
|
|
1233
|
+
"transform",
|
|
1234
|
+
"willChange",
|
|
1235
|
+
"visibility",
|
|
1236
|
+
"pointerEvents"
|
|
1237
|
+
];
|
|
1238
|
+
function Dt(e) {
|
|
1239
|
+
let t = {};
|
|
1240
|
+
for (let n of Et) t[n] = e.style[n];
|
|
1241
|
+
return t;
|
|
1242
|
+
}
|
|
1243
|
+
function Ot(e, t) {
|
|
1244
|
+
for (let n of Et) e.style[n] = t[n] ?? "";
|
|
1245
|
+
}
|
|
1246
|
+
function kt(e, t, n, r) {
|
|
1247
|
+
if (!("view" in t)) {
|
|
1248
|
+
Ot(e, r);
|
|
1249
|
+
return;
|
|
1250
|
+
}
|
|
1251
|
+
let i = n === "vertical", a = e.tagName === "TR", o = i ? `translateY(${t.view.position}px) translateX(${t.view.offset}px)` : `translateX(${t.view.position}px) translateY(${t.view.offset}px)`;
|
|
1252
|
+
e.style.position = "absolute", e.style.top = i && a ? `${t.view.position}px` : "0px", e.style.left = !i && a ? `${t.view.position}px` : "0px", e.style.transform = a ? "" : o, e.style.willChange = a ? "unset" : "transform", e.style.visibility = t.view.nr.used ? "visible" : "hidden", e.style.pointerEvents = t.view.nr.used ? "" : "none";
|
|
1253
|
+
}
|
|
1254
|
+
function At(e) {
|
|
1255
|
+
return "view" in e ? {
|
|
1256
|
+
item: wt(e.view).item,
|
|
1257
|
+
active: e.view.nr.used,
|
|
1258
|
+
index: e.view.nr.index,
|
|
1259
|
+
watchData: e.watchData ?? !1,
|
|
1260
|
+
emitResize: e.emitResize ?? !1,
|
|
1261
|
+
sizeDependencies: e.sizeDependencies ?? null,
|
|
1262
|
+
onResize: e.onResize
|
|
1263
|
+
} : {
|
|
1264
|
+
watchData: !1,
|
|
1265
|
+
emitResize: !1,
|
|
1266
|
+
sizeDependencies: null,
|
|
1267
|
+
...e
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
function jt(e, t, n, r) {
|
|
1271
|
+
return n ? r ?? null : e?.[t] ?? null;
|
|
1272
|
+
}
|
|
1273
|
+
function Mt(e) {
|
|
1274
|
+
let t = 0, n = {}, r = ve(), i = !1, a, s = !1, c = [], l = null, u = null, d = /* @__PURE__ */ new Set(), f = j({
|
|
1275
|
+
active: !0,
|
|
1276
|
+
sizes: {},
|
|
1277
|
+
keyField: V(e).keyField,
|
|
1278
|
+
simpleArray: !1
|
|
1279
|
+
}), p = o(() => V(e).direction), h = o(() => V(V(e).el)), g = o(() => V(V(e).before)), _ = o(() => V(V(e).after)), v = /* @__PURE__ */ new Map();
|
|
1280
|
+
function y(e) {
|
|
1281
|
+
let t = -1;
|
|
1282
|
+
return t = requestAnimationFrame(() => {
|
|
1283
|
+
d.delete(t), e();
|
|
1284
|
+
}), d.add(t), t;
|
|
1285
|
+
}
|
|
1286
|
+
function x() {
|
|
1287
|
+
for (let e of d) cancelAnimationFrame(e);
|
|
1288
|
+
d.clear();
|
|
1289
|
+
}
|
|
1290
|
+
typeof ResizeObserver < "u" && (a = new ResizeObserver((e) => {
|
|
1291
|
+
y(() => {
|
|
1292
|
+
if (Array.isArray(e)) {
|
|
1293
|
+
for (let t of e) if (t.target && t.target.$_vs_onResize) {
|
|
1294
|
+
let e, n;
|
|
1295
|
+
if (t.borderBoxSize) {
|
|
1296
|
+
let r = t.borderBoxSize[0];
|
|
1297
|
+
e = r.inlineSize, n = r.blockSize;
|
|
1298
|
+
} else e = t.contentRect.width, n = t.contentRect.height;
|
|
1299
|
+
t.target.$_vs_onResize(t.target.$_vs_id, e, n);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
}));
|
|
1304
|
+
let S = {
|
|
1305
|
+
vscrollData: f,
|
|
1306
|
+
resizeObserver: a,
|
|
1307
|
+
direction: p,
|
|
1308
|
+
undefinedMap: n,
|
|
1309
|
+
undefinedSizeCount: {
|
|
1310
|
+
get value() {
|
|
1311
|
+
return t;
|
|
1312
|
+
},
|
|
1313
|
+
set value(e) {
|
|
1314
|
+
t = e;
|
|
1315
|
+
}
|
|
1316
|
+
},
|
|
1317
|
+
onVscrollUpdate(e) {
|
|
1318
|
+
let t = (t) => {
|
|
1319
|
+
e(t);
|
|
1320
|
+
};
|
|
1321
|
+
return r.on("vscroll:update", t), () => r.off("vscroll:update", t);
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
A("vscrollData", f), A("vscrollParent", {
|
|
1325
|
+
get $_undefinedSizes() {
|
|
1326
|
+
return t;
|
|
1327
|
+
},
|
|
1328
|
+
set $_undefinedSizes(e) {
|
|
1329
|
+
t = e;
|
|
1330
|
+
},
|
|
1331
|
+
get $_undefinedMap() {
|
|
1332
|
+
return n;
|
|
1333
|
+
},
|
|
1334
|
+
set $_undefinedMap(e) {
|
|
1335
|
+
n = e;
|
|
1336
|
+
},
|
|
1337
|
+
$_events: r,
|
|
1338
|
+
direction: p
|
|
1339
|
+
}), A("vscrollResizeObserver", a), A("vscrollMeasurementContext", S), A("vscrollAnchorRegistry", {
|
|
1340
|
+
delete(e) {
|
|
1341
|
+
v.delete(e);
|
|
1342
|
+
},
|
|
1343
|
+
set(e, t) {
|
|
1344
|
+
v.set(e, t);
|
|
1345
|
+
}
|
|
1346
|
+
});
|
|
1347
|
+
let C = o(() => {
|
|
1348
|
+
let t = V(e);
|
|
1349
|
+
return t.items.length > 0 && typeof t.items[0] != "object";
|
|
1350
|
+
}), T = o(() => {
|
|
1351
|
+
let t = [], { items: r, keyField: i } = V(e), a = C.value, o = f.sizes, s = r.length;
|
|
1352
|
+
for (let e = 0; e < s; e++) {
|
|
1353
|
+
let s = r[e], c = a ? e : s[i], l = o[c];
|
|
1354
|
+
typeof l > "u" && !n[c] && (l = 0), t.push({
|
|
1355
|
+
item: s,
|
|
1356
|
+
id: c,
|
|
1357
|
+
size: l
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1360
|
+
return t;
|
|
1361
|
+
}), D = V(e);
|
|
1362
|
+
c = Qe(D.items, C.value ? null : D.keyField), D.cache && (f.sizes = tt(D.cache, D.items, C.value ? null : D.keyField));
|
|
1363
|
+
let k = o(() => {
|
|
1364
|
+
let t = V(e);
|
|
1365
|
+
return {
|
|
1366
|
+
items: T.value,
|
|
1367
|
+
keyField: "id",
|
|
1368
|
+
direction: t.direction,
|
|
1369
|
+
itemSize: null,
|
|
1370
|
+
gridItems: void 0,
|
|
1371
|
+
itemSecondarySize: void 0,
|
|
1372
|
+
minItemSize: t.minItemSize,
|
|
1373
|
+
sizeField: "size",
|
|
1374
|
+
typeField: "type",
|
|
1375
|
+
buffer: t.buffer ?? 200,
|
|
1376
|
+
pageMode: t.pageMode ?? !1,
|
|
1377
|
+
shift: !1,
|
|
1378
|
+
cache: t.cache,
|
|
1379
|
+
prerender: t.prerender ?? 0,
|
|
1380
|
+
emitUpdate: t.emitUpdate ?? !1,
|
|
1381
|
+
updateInterval: t.updateInterval ?? 0
|
|
1382
|
+
};
|
|
1383
|
+
});
|
|
1384
|
+
function M() {
|
|
1385
|
+
var t, n;
|
|
1386
|
+
G(), (n = (t = V(e)).onResize) == null || n.call(t);
|
|
1387
|
+
}
|
|
1388
|
+
function N() {
|
|
1389
|
+
var t, n;
|
|
1390
|
+
r.emit("vscroll:update", { force: !1 }), (n = (t = V(e)).onVisible) == null || n.call(t);
|
|
1391
|
+
}
|
|
1392
|
+
let P = Ct(k, h, g, _, {
|
|
1393
|
+
onResize: M,
|
|
1394
|
+
onVisible: N,
|
|
1395
|
+
onHidden: () => {
|
|
1396
|
+
var t;
|
|
1397
|
+
return (t = V(e)).onHidden?.call(t);
|
|
1398
|
+
},
|
|
1399
|
+
onUpdate: (t, n, r, i) => {
|
|
1400
|
+
var a;
|
|
1401
|
+
return (a = V(e)).onUpdate?.call(a, t, n, r, i);
|
|
1402
|
+
}
|
|
1403
|
+
}), F = /* @__PURE__ */ new WeakMap();
|
|
1404
|
+
function I() {
|
|
1405
|
+
u != null && (cancelAnimationFrame(u), d.delete(u), u = null);
|
|
1406
|
+
}
|
|
1407
|
+
function L() {
|
|
1408
|
+
I(), l = null;
|
|
1409
|
+
}
|
|
1410
|
+
function z() {
|
|
1411
|
+
l == null || u != null || (u = y(() => {
|
|
1412
|
+
u = null, W();
|
|
1413
|
+
}));
|
|
1414
|
+
}
|
|
1415
|
+
function B() {
|
|
1416
|
+
let e = h.value;
|
|
1417
|
+
if (!e) return null;
|
|
1418
|
+
let t = e.getBoundingClientRect(), n = null;
|
|
1419
|
+
for (let [e, r] of v.entries()) {
|
|
1420
|
+
if (!r.active || getComputedStyle(e).visibility === "hidden") continue;
|
|
1421
|
+
let i = e.getBoundingClientRect();
|
|
1422
|
+
if (i.bottom <= t.top || i.top >= t.bottom) continue;
|
|
1423
|
+
let a = Math.max(i.top, t.top) - t.top;
|
|
1424
|
+
(!n || a < n.score) && (n = {
|
|
1425
|
+
key: r.id,
|
|
1426
|
+
offset: i.top - t.top,
|
|
1427
|
+
score: a
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
return n;
|
|
1431
|
+
}
|
|
1432
|
+
function H(e) {
|
|
1433
|
+
let t = h.value;
|
|
1434
|
+
if (!t) {
|
|
1435
|
+
L();
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
let n = t.scrollTop, r = Math.min(P.findItemIndex(n), e.length - 1), i = e[r];
|
|
1439
|
+
if (i == null) {
|
|
1440
|
+
L();
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
let a = B();
|
|
1444
|
+
l = {
|
|
1445
|
+
logicalKey: i,
|
|
1446
|
+
logicalOffset: n - P.getItemOffset(r),
|
|
1447
|
+
pendingKeys: /* @__PURE__ */ new Set(),
|
|
1448
|
+
stableFrames: 0,
|
|
1449
|
+
visualKey: a?.key ?? null,
|
|
1450
|
+
visualOffset: a?.offset ?? 0
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1453
|
+
function ee(e) {
|
|
1454
|
+
let t = h.value;
|
|
1455
|
+
return !t || Math.abs(t.scrollTop - e) < .5 ? !1 : (s = !0, t.scrollTop = e, t.dispatchEvent(new Event("scroll")), y(() => {
|
|
1456
|
+
s = !1;
|
|
1457
|
+
}), !0);
|
|
1458
|
+
}
|
|
1459
|
+
function W() {
|
|
1460
|
+
let e = l, t = h.value;
|
|
1461
|
+
if (!e || !t) return;
|
|
1462
|
+
let n = T.value.findIndex((t) => t.id === e.logicalKey);
|
|
1463
|
+
if (n === -1) {
|
|
1464
|
+
L();
|
|
1465
|
+
return;
|
|
1466
|
+
}
|
|
1467
|
+
let r = !1;
|
|
1468
|
+
if (r = ee(P.getItemOffset(n) + e.logicalOffset) || r, e.visualKey != null) for (let [n, i] of v.entries()) {
|
|
1469
|
+
if (!i.active || i.id !== e.visualKey || getComputedStyle(n).visibility === "hidden") continue;
|
|
1470
|
+
let a = n.getBoundingClientRect().top - t.getBoundingClientRect().top - e.visualOffset;
|
|
1471
|
+
r = ee(t.scrollTop + a) || r;
|
|
1472
|
+
break;
|
|
1473
|
+
}
|
|
1474
|
+
let i = !0;
|
|
1475
|
+
for (let t of e.pendingKeys) if (!(typeof f.sizes[t] == "number" && f.sizes[t] > 0)) {
|
|
1476
|
+
i = !1;
|
|
1477
|
+
break;
|
|
1478
|
+
}
|
|
1479
|
+
if (!r && i) {
|
|
1480
|
+
if (e.stableFrames++, e.stableFrames >= 2) {
|
|
1481
|
+
L();
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1484
|
+
} else e.stableFrames = 0;
|
|
1485
|
+
z();
|
|
1486
|
+
}
|
|
1487
|
+
function te(t, n, r, i) {
|
|
1488
|
+
let a = m(), o = R(n), s = R(r), c = R({ onResize: r.onResize }), l = R(t), u = a.run(() => (U(() => {
|
|
1489
|
+
let t = o.value;
|
|
1490
|
+
if (!("view" in t)) return {
|
|
1491
|
+
active: s.value.active,
|
|
1492
|
+
direction: p.value,
|
|
1493
|
+
id: jt(s.value.item, V(e).keyField, f.simpleArray, s.value.index),
|
|
1494
|
+
legacy: !0
|
|
1495
|
+
};
|
|
1496
|
+
let { view: n } = t;
|
|
1497
|
+
return {
|
|
1498
|
+
active: n.nr.used,
|
|
1499
|
+
direction: p.value,
|
|
1500
|
+
id: wt(n).id,
|
|
1501
|
+
legacy: !1,
|
|
1502
|
+
position: n.position,
|
|
1503
|
+
offset: n.offset,
|
|
1504
|
+
styleStamp: Tt(n)
|
|
1505
|
+
};
|
|
1506
|
+
}, () => {
|
|
1507
|
+
let t = l.value;
|
|
1508
|
+
if (t) {
|
|
1509
|
+
let n = o.value, r = "view" in n ? wt(n.view).id : jt(s.value.item, V(e).keyField, f.simpleArray, s.value.index);
|
|
1510
|
+
r != null && v.set(t, {
|
|
1511
|
+
active: s.value.active && f.active,
|
|
1512
|
+
id: r
|
|
1513
|
+
}), kt(t, o.value, p.value, i);
|
|
1514
|
+
}
|
|
1515
|
+
}, { immediate: !0 }), it(s, l, S, c)));
|
|
1516
|
+
u.mount(), F.set(t, {
|
|
1517
|
+
binding: o,
|
|
1518
|
+
scope: a,
|
|
1519
|
+
options: s,
|
|
1520
|
+
callbacks: c,
|
|
1521
|
+
el: l,
|
|
1522
|
+
controller: u,
|
|
1523
|
+
restoreStyles: i
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
let ne = {
|
|
1527
|
+
mounted(e, t) {
|
|
1528
|
+
let n = Dt(e);
|
|
1529
|
+
te(e, t.value, At(t.value), n);
|
|
1530
|
+
},
|
|
1531
|
+
updated(e, t) {
|
|
1532
|
+
let n = F.get(e), r = At(t.value);
|
|
1533
|
+
if (!n) {
|
|
1534
|
+
let n = Dt(e);
|
|
1535
|
+
te(e, t.value, r, n);
|
|
1536
|
+
return;
|
|
1537
|
+
}
|
|
1538
|
+
n.binding.value = t.value, n.options.value = r, n.callbacks.value = { onResize: r.onResize }, n.el.value = e, kt(e, t.value, p.value, n.restoreStyles);
|
|
1539
|
+
},
|
|
1540
|
+
unmounted(e) {
|
|
1541
|
+
let t = F.get(e);
|
|
1542
|
+
t && (t.controller.unmount(), t.scope.stop(), Ot(e, t.restoreStyles), v.delete(e), F.delete(e));
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
function G(e = !1) {
|
|
1546
|
+
(e || C.value) && (f.sizes = {}), r.emit("vscroll:update", { force: !0 });
|
|
1547
|
+
}
|
|
1548
|
+
function re(e, t) {
|
|
1549
|
+
P.scrollToItem(e, t);
|
|
1550
|
+
}
|
|
1551
|
+
function K(t) {
|
|
1552
|
+
let n = V(e);
|
|
1553
|
+
return f.sizes = tt(t, n.items, C.value ? null : n.keyField), P.restoreCache(t);
|
|
1554
|
+
}
|
|
1555
|
+
function q(t, n) {
|
|
1556
|
+
let r = V(e), i = C.value ? n ?? r.items.indexOf(t) : t[r.keyField];
|
|
1557
|
+
return f.sizes[i] || 0;
|
|
1558
|
+
}
|
|
1559
|
+
function ie() {
|
|
1560
|
+
let e = h.value;
|
|
1561
|
+
e && (i || (i = !0, b(() => {
|
|
1562
|
+
e.scrollTop = e.scrollHeight + 5e3;
|
|
1563
|
+
let n = () => {
|
|
1564
|
+
e.scrollTop = e.scrollHeight + 5e3, y(() => {
|
|
1565
|
+
e.scrollTop = e.scrollHeight + 5e3, t === 0 ? i = !1 : y(n);
|
|
1566
|
+
});
|
|
1567
|
+
};
|
|
1568
|
+
y(n);
|
|
1569
|
+
})));
|
|
1570
|
+
}
|
|
1571
|
+
function ae() {
|
|
1572
|
+
l && !s && L();
|
|
1573
|
+
}
|
|
1574
|
+
return U(() => V(e).items, (t, n) => {
|
|
1575
|
+
let r = V(e), i = C.value ? null : r.keyField, a = Qe(t, i);
|
|
1576
|
+
if (r.shift) {
|
|
1577
|
+
let e = n ? Qe(n, i) : c, t = nt(e, a);
|
|
1578
|
+
t > 0 ? (H(e), l && (l.pendingKeys = new Set(a.slice(0, t)), l.stableFrames = 0, b(() => {
|
|
1579
|
+
l && W();
|
|
1580
|
+
}))) : L();
|
|
1581
|
+
} else L();
|
|
1582
|
+
c = a, G();
|
|
1583
|
+
}, { flush: "sync" }), U(() => V(e).cache, (e) => {
|
|
1584
|
+
e && K(e);
|
|
1585
|
+
}), U(C, (e) => {
|
|
1586
|
+
f.simpleArray = e;
|
|
1587
|
+
}, { immediate: !0 }), U(() => V(e).direction, () => {
|
|
1588
|
+
L(), G(!0);
|
|
1589
|
+
}), U(h, (e, t) => {
|
|
1590
|
+
t?.removeEventListener("scroll", ae), e?.addEventListener("scroll", ae);
|
|
1591
|
+
}, { immediate: !0 }), U(T, (t, n) => {
|
|
1592
|
+
let r = h.value;
|
|
1593
|
+
if (!r) return;
|
|
1594
|
+
if (l) {
|
|
1595
|
+
W();
|
|
1596
|
+
return;
|
|
1597
|
+
}
|
|
1598
|
+
let i = r.scrollTop, a = V(e), o = 0, s = 0, c = Math.min(t.length, n.length);
|
|
1599
|
+
for (let e = 0; e < c && !(o >= i); e++) o += n[e].size || a.minItemSize, s += t[e].size || a.minItemSize;
|
|
1600
|
+
let u = s - o;
|
|
1601
|
+
u !== 0 && (r.scrollTop += u);
|
|
1602
|
+
}, { flush: "post" }), w(() => {
|
|
1603
|
+
f.active = !0;
|
|
1604
|
+
}), E(() => {
|
|
1605
|
+
f.active = !1;
|
|
1606
|
+
}), O(() => {
|
|
1607
|
+
var e;
|
|
1608
|
+
I(), x(), (e = h.value) == null || e.removeEventListener("scroll", ae), r.all.clear();
|
|
1609
|
+
}), {
|
|
1610
|
+
vscrollData: f,
|
|
1611
|
+
itemsWithSize: T,
|
|
1612
|
+
resizeObserver: a,
|
|
1613
|
+
measurementContext: S,
|
|
1614
|
+
vDynamicScrollerItem: ne,
|
|
1615
|
+
...P,
|
|
1616
|
+
simpleArray: C,
|
|
1617
|
+
forceUpdate: G,
|
|
1618
|
+
scrollToItem: re,
|
|
1619
|
+
restoreCache: K,
|
|
1620
|
+
getItemSize: q,
|
|
1621
|
+
scrollToBottom: ie,
|
|
1622
|
+
onScrollerResize: M,
|
|
1623
|
+
onScrollerVisible: N
|
|
1624
|
+
};
|
|
1625
|
+
}
|
|
1626
|
+
var Nt = /* @__PURE__ */ new WeakMap();
|
|
1627
|
+
function Pt(e) {
|
|
1628
|
+
return typeof e == "function" ? {
|
|
1629
|
+
callback: e,
|
|
1630
|
+
observer: null,
|
|
1631
|
+
intersection: void 0,
|
|
1632
|
+
visible: null
|
|
1633
|
+
} : {
|
|
1634
|
+
callback: e.callback,
|
|
1635
|
+
observer: null,
|
|
1636
|
+
intersection: e.intersection,
|
|
1637
|
+
visible: null
|
|
1638
|
+
};
|
|
1639
|
+
}
|
|
1640
|
+
function Ft(e, t) {
|
|
1641
|
+
It(e);
|
|
1642
|
+
let n = Pt(t.value);
|
|
1643
|
+
if (Nt.set(e, n), typeof IntersectionObserver > "u") {
|
|
1644
|
+
let t = e.getBoundingClientRect();
|
|
1645
|
+
n.visible = !0, n.callback(!0, { boundingClientRect: t });
|
|
1646
|
+
return;
|
|
1647
|
+
}
|
|
1648
|
+
n.observer = new IntersectionObserver((e) => {
|
|
1649
|
+
let t = e[0], r = !!(t != null && t.isIntersecting);
|
|
1650
|
+
n.visible !== null && n.visible === r || (n.visible = r, n.callback(r, t));
|
|
1651
|
+
}, n.intersection), n.observer.observe(e);
|
|
1652
|
+
}
|
|
1653
|
+
function It(e) {
|
|
1654
|
+
let t = Nt.get(e);
|
|
1655
|
+
t != null && t.observer && (t.observer.disconnect(), t.observer = null);
|
|
1656
|
+
}
|
|
1657
|
+
var Lt = {
|
|
1658
|
+
mounted(e, t) {
|
|
1659
|
+
Ft(e, t);
|
|
1660
|
+
},
|
|
1661
|
+
updated(e, t) {
|
|
1662
|
+
t.value !== t.oldValue && Ft(e, t);
|
|
1663
|
+
},
|
|
1664
|
+
unmounted(e) {
|
|
1665
|
+
It(e), Nt.delete(e);
|
|
1666
|
+
}
|
|
1667
|
+
}, Rt = /* @__PURE__ */ p({
|
|
1668
|
+
__name: "ItemView",
|
|
1669
|
+
props: {
|
|
1670
|
+
view: {},
|
|
1671
|
+
itemTag: {}
|
|
1672
|
+
},
|
|
1673
|
+
setup(e) {
|
|
1674
|
+
let t = e;
|
|
1675
|
+
return (e, n) => (k(), s(I(t.itemTag), { class: "vue-recycle-scroller__item-view" }, {
|
|
1676
|
+
default: W(() => [P(e.$slots, "default", {
|
|
1677
|
+
item: t.view.item,
|
|
1678
|
+
index: t.view.nr.index,
|
|
1679
|
+
active: t.view.nr.used
|
|
1680
|
+
})]),
|
|
1681
|
+
_: 3
|
|
1682
|
+
}));
|
|
1683
|
+
}
|
|
1684
|
+
}), zt = /* @__PURE__ */ ((e, t) => {
|
|
1685
|
+
let n = e.__vccOpts || e;
|
|
1686
|
+
for (let [e, r] of t) n[e] = r;
|
|
1687
|
+
return n;
|
|
1688
|
+
})(/* @__PURE__ */ p({
|
|
1689
|
+
__name: "ResizeObserver",
|
|
1690
|
+
emits: ["notify"],
|
|
1691
|
+
setup(e, { emit: t }) {
|
|
1692
|
+
let n = t, r = M(), i = null, a = null;
|
|
1693
|
+
function o() {
|
|
1694
|
+
n("notify");
|
|
1695
|
+
}
|
|
1696
|
+
return D(() => {
|
|
1697
|
+
let e = r.value?.parentElement;
|
|
1698
|
+
if (e) {
|
|
1699
|
+
if (typeof ResizeObserver < "u") {
|
|
1700
|
+
i = new ResizeObserver(() => {
|
|
1701
|
+
o();
|
|
1702
|
+
}), i.observe(e);
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
a = () => o(), window.addEventListener("resize", a);
|
|
1706
|
+
}
|
|
1707
|
+
}), T(() => {
|
|
1708
|
+
i &&= (i.disconnect(), null), a &&= (window.removeEventListener("resize", a), null);
|
|
1709
|
+
}), (e, t) => (k(), l("div", {
|
|
1710
|
+
ref_key: "el",
|
|
1711
|
+
ref: r,
|
|
1712
|
+
class: "vue-recycle-scroller__resize-observer",
|
|
1713
|
+
"aria-hidden": "true"
|
|
1714
|
+
}, null, 512));
|
|
1715
|
+
}
|
|
1716
|
+
}), [["__scopeId", "data-v-08cc04ab"]]), Bt = /* @__PURE__ */ p({
|
|
1717
|
+
__name: "RecycleScroller",
|
|
1718
|
+
props: {
|
|
1719
|
+
items: {},
|
|
1720
|
+
keyField: { default: "id" },
|
|
1721
|
+
direction: { default: "vertical" },
|
|
1722
|
+
listTag: { default: "div" },
|
|
1723
|
+
itemTag: { default: "div" },
|
|
1724
|
+
itemSize: { default: null },
|
|
1725
|
+
gridItems: { default: void 0 },
|
|
1726
|
+
itemSecondarySize: { default: void 0 },
|
|
1727
|
+
minItemSize: { default: null },
|
|
1728
|
+
sizeField: { default: "size" },
|
|
1729
|
+
typeField: { default: "type" },
|
|
1730
|
+
buffer: { default: 200 },
|
|
1731
|
+
pageMode: {
|
|
1732
|
+
type: Boolean,
|
|
1733
|
+
default: !1
|
|
1734
|
+
},
|
|
1735
|
+
shift: {
|
|
1736
|
+
type: Boolean,
|
|
1737
|
+
default: !1
|
|
1738
|
+
},
|
|
1739
|
+
cache: { default: void 0 },
|
|
1740
|
+
prerender: { default: 0 },
|
|
1741
|
+
emitUpdate: {
|
|
1742
|
+
type: Boolean,
|
|
1743
|
+
default: !1
|
|
1744
|
+
},
|
|
1745
|
+
disableTransform: {
|
|
1746
|
+
type: Boolean,
|
|
1747
|
+
default: !1
|
|
1748
|
+
},
|
|
1749
|
+
updateInterval: { default: 0 },
|
|
1750
|
+
skipHover: {
|
|
1751
|
+
type: Boolean,
|
|
1752
|
+
default: !1
|
|
1753
|
+
},
|
|
1754
|
+
listClass: { default: "" },
|
|
1755
|
+
itemClass: { default: "" }
|
|
1756
|
+
},
|
|
1757
|
+
emits: [
|
|
1758
|
+
"resize",
|
|
1759
|
+
"visible",
|
|
1760
|
+
"hidden",
|
|
1761
|
+
"update",
|
|
1762
|
+
"scrollStart",
|
|
1763
|
+
"scrollEnd"
|
|
1764
|
+
],
|
|
1765
|
+
setup(e, { expose: t, emit: n }) {
|
|
1766
|
+
let r = e, i = n, u = Lt, d = M(), p = M(), m = M(), h = M(null), { pool: g, visiblePool: _, totalSize: v, ready: b, scrollToItem: S, scrollToPosition: w, getScroll: T, findItemIndex: E, getItemOffset: D, getItemSize: O, cacheSnapshot: A, restoreCache: j, updateVisibleItems: F, handleScroll: L, handleResize: R, handleVisibilityChange: z } = Ct(r, d, p, m, {
|
|
1767
|
+
onResize: () => i("resize"),
|
|
1768
|
+
onVisible: () => i("visible"),
|
|
1769
|
+
onHidden: () => i("hidden"),
|
|
1770
|
+
onUpdate: (e, t, n, a) => {
|
|
1771
|
+
i("update", e, t, n, a), n <= 0 && i("scrollStart"), a >= r.items.length - 1 && i("scrollEnd");
|
|
1772
|
+
}
|
|
1773
|
+
});
|
|
1774
|
+
function V(e) {
|
|
1775
|
+
h.value = e;
|
|
1776
|
+
}
|
|
1777
|
+
function ee() {
|
|
1778
|
+
h.value = null;
|
|
1779
|
+
}
|
|
1780
|
+
let U = o(() => {
|
|
1781
|
+
let e = { [r.direction === "vertical" ? "minHeight" : "minWidth"]: `${v.value}px` };
|
|
1782
|
+
if (r.gridItems && r.itemSize != null) {
|
|
1783
|
+
let t = (r.itemSecondarySize || r.itemSize) * r.gridItems;
|
|
1784
|
+
e[r.direction === "vertical" ? "minWidth" : "minHeight"] = `${t}px`;
|
|
1785
|
+
}
|
|
1786
|
+
return e;
|
|
1787
|
+
});
|
|
1788
|
+
return t({
|
|
1789
|
+
el: d,
|
|
1790
|
+
visiblePool: _,
|
|
1791
|
+
scrollToItem: S,
|
|
1792
|
+
scrollToPosition: w,
|
|
1793
|
+
getScroll: T,
|
|
1794
|
+
findItemIndex: E,
|
|
1795
|
+
getItemOffset: D,
|
|
1796
|
+
getItemSize: O,
|
|
1797
|
+
cacheSnapshot: A,
|
|
1798
|
+
restoreCache: j,
|
|
1799
|
+
updateVisibleItems: F
|
|
1800
|
+
}), (e, t) => te((k(), l("div", {
|
|
1801
|
+
ref_key: "el",
|
|
1802
|
+
ref: d,
|
|
1803
|
+
class: x(["vue-recycle-scroller", {
|
|
1804
|
+
"grid-mode": r.gridItems,
|
|
1805
|
+
ready: H(b),
|
|
1806
|
+
"page-mode": r.pageMode,
|
|
1807
|
+
[`direction-${r.direction}`]: !0
|
|
1808
|
+
}]),
|
|
1809
|
+
onScrollPassive: t[0] ||= (...e) => H(L) && H(L)(...e)
|
|
1810
|
+
}, [
|
|
1811
|
+
e.$slots.before ? (k(), l("div", {
|
|
1812
|
+
key: 0,
|
|
1813
|
+
ref_key: "before",
|
|
1814
|
+
ref: p,
|
|
1815
|
+
class: "vue-recycle-scroller__slot"
|
|
1816
|
+
}, [P(e.$slots, "before")], 512)) : c("", !0),
|
|
1817
|
+
(k(), s(I(r.listTag), {
|
|
1818
|
+
style: C(U.value),
|
|
1819
|
+
class: x(["vue-recycle-scroller__item-wrapper", r.listClass])
|
|
1820
|
+
}, {
|
|
1821
|
+
default: W(() => [(k(!0), l(a, null, N(H(g), (t) => (k(), s(Rt, y({
|
|
1822
|
+
key: t.nr.id,
|
|
1823
|
+
view: t,
|
|
1824
|
+
"item-tag": r.itemTag,
|
|
1825
|
+
style: H(b) ? [r.disableTransform ? {
|
|
1826
|
+
[r.direction === "vertical" ? "top" : "left"]: `${t.position}px`,
|
|
1827
|
+
willChange: "unset"
|
|
1828
|
+
} : { transform: `translate${r.direction === "vertical" ? "Y" : "X"}(${t.position}px) translate${r.direction === "vertical" ? "X" : "Y"}(${t.offset}px)` }, {
|
|
1829
|
+
width: r.gridItems ? `${r.direction === "vertical" && r.itemSecondarySize || r.itemSize}px` : void 0,
|
|
1830
|
+
height: r.gridItems ? `${r.direction === "horizontal" && r.itemSecondarySize || r.itemSize}px` : void 0,
|
|
1831
|
+
visibility: t.nr.used ? "visible" : "hidden"
|
|
1832
|
+
}] : null,
|
|
1833
|
+
class: ["vue-recycle-scroller__item-view", [r.itemClass, { hover: !r.skipHover && h.value === t.nr.key }]]
|
|
1834
|
+
}, B(r.skipHover ? {} : {
|
|
1835
|
+
mouseenter: () => {
|
|
1836
|
+
V(t.nr.key);
|
|
1837
|
+
},
|
|
1838
|
+
mouseleave: () => {
|
|
1839
|
+
ee();
|
|
1840
|
+
}
|
|
1841
|
+
})), {
|
|
1842
|
+
default: W((t) => [P(e.$slots, "default", y({ ref_for: !0 }, t))]),
|
|
1843
|
+
_: 2
|
|
1844
|
+
}, 1040, [
|
|
1845
|
+
"view",
|
|
1846
|
+
"item-tag",
|
|
1847
|
+
"style",
|
|
1848
|
+
"class"
|
|
1849
|
+
]))), 128)), r.items.length === 0 ? P(e.$slots, "empty", { key: 0 }) : c("", !0)]),
|
|
1850
|
+
_: 3
|
|
1851
|
+
}, 8, ["style", "class"])),
|
|
1852
|
+
e.$slots.after ? (k(), l("div", {
|
|
1853
|
+
key: 1,
|
|
1854
|
+
ref_key: "after",
|
|
1855
|
+
ref: m,
|
|
1856
|
+
class: "vue-recycle-scroller__slot"
|
|
1857
|
+
}, [P(e.$slots, "after")], 512)) : c("", !0),
|
|
1858
|
+
f(zt, { onNotify: H(R) }, null, 8, ["onNotify"])
|
|
1859
|
+
], 34)), [[H(u), H(z)]]);
|
|
1860
|
+
}
|
|
1861
|
+
}), Vt = /* @__PURE__ */ p({
|
|
1862
|
+
inheritAttrs: !1,
|
|
1863
|
+
__name: "DynamicScroller",
|
|
1864
|
+
props: {
|
|
1865
|
+
items: {},
|
|
1866
|
+
keyField: { default: "id" },
|
|
1867
|
+
direction: { default: "vertical" },
|
|
1868
|
+
listTag: { default: "div" },
|
|
1869
|
+
itemTag: { default: "div" },
|
|
1870
|
+
minItemSize: {},
|
|
1871
|
+
shift: {
|
|
1872
|
+
type: Boolean,
|
|
1873
|
+
default: !1
|
|
1874
|
+
},
|
|
1875
|
+
cache: { default: void 0 }
|
|
1876
|
+
},
|
|
1877
|
+
emits: ["resize", "visible"],
|
|
1878
|
+
setup(e, { expose: t, emit: n }) {
|
|
1879
|
+
let r = e, i = n, a = M(), c = o(() => {
|
|
1880
|
+
let e = a.value?.el;
|
|
1881
|
+
return e && typeof e == "object" && "value" in e ? e.value : e;
|
|
1882
|
+
}), { itemsWithSize: l, forceUpdate: u, scrollToItem: f, scrollToPosition: p, findItemIndex: m, getItemOffset: g, getItemSize: _, cacheSnapshot: v, restoreCache: b, scrollToBottom: x, onScrollerResize: C, onScrollerVisible: w } = Mt(o(() => ({
|
|
1883
|
+
items: r.items,
|
|
1884
|
+
keyField: r.keyField,
|
|
1885
|
+
direction: r.direction,
|
|
1886
|
+
minItemSize: r.minItemSize,
|
|
1887
|
+
shift: r.shift,
|
|
1888
|
+
cache: r.cache,
|
|
1889
|
+
el: c.value,
|
|
1890
|
+
onResize: () => i("resize"),
|
|
1891
|
+
onVisible: () => i("visible")
|
|
1892
|
+
})));
|
|
1893
|
+
function T(e, t, n) {
|
|
1894
|
+
return {
|
|
1895
|
+
item: e.item,
|
|
1896
|
+
index: t,
|
|
1897
|
+
active: n,
|
|
1898
|
+
itemWithSize: e
|
|
1899
|
+
};
|
|
1900
|
+
}
|
|
1901
|
+
return t({
|
|
1902
|
+
scrollToItem: f,
|
|
1903
|
+
scrollToPosition: p,
|
|
1904
|
+
findItemIndex: m,
|
|
1905
|
+
getItemOffset: g,
|
|
1906
|
+
scrollToBottom: x,
|
|
1907
|
+
getItemSize: _,
|
|
1908
|
+
cacheSnapshot: v,
|
|
1909
|
+
restoreCache: b,
|
|
1910
|
+
forceUpdate: u
|
|
1911
|
+
}), (e, t) => (k(), s(Bt, y({
|
|
1912
|
+
ref_key: "scroller",
|
|
1913
|
+
ref: a,
|
|
1914
|
+
items: H(l),
|
|
1915
|
+
"min-item-size": r.minItemSize,
|
|
1916
|
+
direction: r.direction,
|
|
1917
|
+
cache: r.cache,
|
|
1918
|
+
"key-field": "id",
|
|
1919
|
+
"list-tag": r.listTag,
|
|
1920
|
+
"item-tag": r.itemTag
|
|
1921
|
+
}, e.$attrs, {
|
|
1922
|
+
onResize: H(C),
|
|
1923
|
+
onVisible: H(w)
|
|
1924
|
+
}), d({
|
|
1925
|
+
default: W(({ item: t, index: n, active: r }) => [P(e.$slots, "default", S(h(T(t, n, r))))]),
|
|
1926
|
+
empty: W(() => [P(e.$slots, "empty")]),
|
|
1927
|
+
_: 2
|
|
1928
|
+
}, [e.$slots.before ? {
|
|
1929
|
+
name: "before",
|
|
1930
|
+
fn: W(() => [P(e.$slots, "before")]),
|
|
1931
|
+
key: "0"
|
|
1932
|
+
} : void 0, e.$slots.after ? {
|
|
1933
|
+
name: "after",
|
|
1934
|
+
fn: W(() => [P(e.$slots, "after")]),
|
|
1935
|
+
key: "1"
|
|
1936
|
+
} : void 0]), 1040, [
|
|
1937
|
+
"items",
|
|
1938
|
+
"min-item-size",
|
|
1939
|
+
"direction",
|
|
1940
|
+
"cache",
|
|
1941
|
+
"list-tag",
|
|
1942
|
+
"item-tag",
|
|
1943
|
+
"onResize",
|
|
1944
|
+
"onVisible"
|
|
1945
|
+
]));
|
|
1946
|
+
}
|
|
1947
|
+
});
|
|
1948
|
+
function Ht(e, t, n) {
|
|
1949
|
+
let r = _("vscrollMeasurementContext"), i = _("vscrollAnchorRegistry", null), a = it(e, t, r, n);
|
|
1950
|
+
return D(() => {
|
|
1951
|
+
a.mount();
|
|
1952
|
+
}), i && U([
|
|
1953
|
+
a.id,
|
|
1954
|
+
a.finalActive,
|
|
1955
|
+
() => V(t)
|
|
1956
|
+
], ([e, t, n], [r, a, o]) => {
|
|
1957
|
+
o && o !== n && i.delete(o), n && i.set(n, {
|
|
1958
|
+
active: t,
|
|
1959
|
+
id: e
|
|
1960
|
+
});
|
|
1961
|
+
}, { immediate: !0 }), T(() => {
|
|
1962
|
+
let e = V(t);
|
|
1963
|
+
i && e && i.delete(e), a.unmount();
|
|
1964
|
+
}), {
|
|
1965
|
+
id: a.id,
|
|
1966
|
+
size: a.size,
|
|
1967
|
+
finalActive: a.finalActive,
|
|
1968
|
+
updateSize: a.updateSize
|
|
1969
|
+
};
|
|
1970
|
+
}
|
|
1971
|
+
var Ut = /* @__PURE__ */ p({
|
|
1972
|
+
__name: "DynamicScrollerItem",
|
|
1973
|
+
props: {
|
|
1974
|
+
item: {},
|
|
1975
|
+
watchData: {
|
|
1976
|
+
type: Boolean,
|
|
1977
|
+
default: !1
|
|
1978
|
+
},
|
|
1979
|
+
active: { type: Boolean },
|
|
1980
|
+
index: { default: void 0 },
|
|
1981
|
+
sizeDependencies: { default: null },
|
|
1982
|
+
emitResize: {
|
|
1983
|
+
type: Boolean,
|
|
1984
|
+
default: !1
|
|
1985
|
+
},
|
|
1986
|
+
tag: { default: "div" }
|
|
1987
|
+
},
|
|
1988
|
+
emits: ["resize"],
|
|
1989
|
+
setup(e, { emit: t }) {
|
|
1990
|
+
let n = e, r = t, i = M();
|
|
1991
|
+
return Ht(n, i, { onResize: (e) => r("resize", e) }), (e, t) => (k(), s(I(n.tag), {
|
|
1992
|
+
ref_key: "el",
|
|
1993
|
+
ref: i
|
|
1994
|
+
}, {
|
|
1995
|
+
default: W(() => [P(e.$slots, "default")]),
|
|
1996
|
+
_: 3
|
|
1997
|
+
}, 512));
|
|
1998
|
+
}
|
|
1999
|
+
}), Wt = {
|
|
2000
|
+
key: 0,
|
|
2001
|
+
class: "loading-indicator"
|
|
2002
|
+
}, Gt = { class: "loading-text" }, Kt = {
|
|
2003
|
+
key: 1,
|
|
2004
|
+
class: "no-more-tip"
|
|
2005
|
+
}, qt = {
|
|
2006
|
+
key: 1,
|
|
2007
|
+
class: "empty-state"
|
|
2008
|
+
}, Jt = { class: "empty-text" }, Yt = /*#__PURE__*/ i({
|
|
2009
|
+
__name: "ScrollList",
|
|
2010
|
+
props: {
|
|
2011
|
+
items: {
|
|
2012
|
+
type: Array,
|
|
2013
|
+
default: () => []
|
|
2014
|
+
},
|
|
2015
|
+
loading: {
|
|
2016
|
+
type: Boolean,
|
|
2017
|
+
default: !1
|
|
2018
|
+
},
|
|
2019
|
+
hasMore: {
|
|
2020
|
+
type: Boolean,
|
|
2021
|
+
default: !0
|
|
2022
|
+
},
|
|
2023
|
+
loadingText: {
|
|
2024
|
+
type: String,
|
|
2025
|
+
default: "加载中..."
|
|
2026
|
+
},
|
|
2027
|
+
noMoreText: {
|
|
2028
|
+
type: String,
|
|
2029
|
+
default: "没有更多了"
|
|
2030
|
+
},
|
|
2031
|
+
emptyText: {
|
|
2032
|
+
type: String,
|
|
2033
|
+
default: "暂无数据"
|
|
2034
|
+
},
|
|
2035
|
+
height: {
|
|
2036
|
+
type: String,
|
|
2037
|
+
default: "auto"
|
|
2038
|
+
},
|
|
2039
|
+
minItemSize: {
|
|
2040
|
+
type: Number,
|
|
2041
|
+
default: 60
|
|
2042
|
+
},
|
|
2043
|
+
buffer: {
|
|
2044
|
+
type: Number,
|
|
2045
|
+
default: 200
|
|
2046
|
+
},
|
|
2047
|
+
threshold: {
|
|
2048
|
+
type: Number,
|
|
2049
|
+
default: 100
|
|
2050
|
+
},
|
|
2051
|
+
keyField: {
|
|
2052
|
+
type: String,
|
|
2053
|
+
default: "id"
|
|
2054
|
+
}
|
|
2055
|
+
},
|
|
2056
|
+
emits: ["load-more", "scroll"],
|
|
2057
|
+
setup(e, { expose: t, emit: n }) {
|
|
2058
|
+
let r = e, i = n, a = M(null), d = M(null), p = M(!1), m = null, h = o(() => ({ height: r.height })), g = () => {
|
|
2059
|
+
console.log("loadMore triggered----", p.value || !r.hasMore || r.loading), !(p.value || !r.hasMore || r.loading) && (p.value = !0, i("load-more"));
|
|
2060
|
+
}, _ = () => {
|
|
2061
|
+
p.value = !1, v();
|
|
2062
|
+
}, v = () => {
|
|
2063
|
+
a.value && a.value.scrollToPosition(0);
|
|
2064
|
+
}, y = () => {
|
|
2065
|
+
if (a.value) {
|
|
2066
|
+
let e = a.value.$el;
|
|
2067
|
+
e && (e.scrollTop = e.scrollHeight);
|
|
2068
|
+
}
|
|
2069
|
+
}, x = (e) => {
|
|
2070
|
+
a.value && a.value.scrollToItem(e);
|
|
2071
|
+
}, S = () => {
|
|
2072
|
+
if (!d.value || !a.value) return;
|
|
2073
|
+
let e = a.value.$el;
|
|
2074
|
+
if (!e) return;
|
|
2075
|
+
let t = {
|
|
2076
|
+
root: e,
|
|
2077
|
+
rootMargin: `${r.threshold}px`,
|
|
2078
|
+
threshold: .1
|
|
2079
|
+
};
|
|
2080
|
+
m = new IntersectionObserver((e) => {
|
|
2081
|
+
e.forEach((e) => {
|
|
2082
|
+
console.log("Setting up Intersection Observer-----", e.isIntersecting, r.hasMore, !p.value, !r.loading), e.isIntersecting && r.hasMore && !p.value && !r.loading && g();
|
|
2083
|
+
});
|
|
2084
|
+
}, t), m.observe(d.value);
|
|
2085
|
+
}, w = () => {
|
|
2086
|
+
m &&= (m.disconnect(), null);
|
|
2087
|
+
}, T = (e) => {
|
|
2088
|
+
let t = e.target;
|
|
2089
|
+
i("scroll", {
|
|
2090
|
+
scrollTop: t.scrollTop,
|
|
2091
|
+
scrollHeight: t.scrollHeight,
|
|
2092
|
+
clientHeight: t.clientHeight
|
|
2093
|
+
});
|
|
2094
|
+
};
|
|
2095
|
+
return U(() => r.loading, (e) => {
|
|
2096
|
+
e || (p.value = !1);
|
|
2097
|
+
}), U(() => r.items.length, async () => {
|
|
2098
|
+
await b(), w(), r.hasMore && S();
|
|
2099
|
+
}), D(async () => {
|
|
2100
|
+
await b(), r.hasMore && S();
|
|
2101
|
+
}), O(() => {
|
|
2102
|
+
w();
|
|
2103
|
+
}), t({
|
|
2104
|
+
reset: _,
|
|
2105
|
+
scrollToTop: v,
|
|
2106
|
+
scrollToBottom: y,
|
|
2107
|
+
scrollToItem: x,
|
|
2108
|
+
loadMore: g
|
|
2109
|
+
}), (t, n) => {
|
|
2110
|
+
let r = F("Loading");
|
|
2111
|
+
return k(), l("div", {
|
|
2112
|
+
class: "scroll-list",
|
|
2113
|
+
style: C(h.value)
|
|
2114
|
+
}, [e.items.length > 0 ? (k(), s(H(Vt), {
|
|
2115
|
+
key: 0,
|
|
2116
|
+
ref_key: "scrollerRef",
|
|
2117
|
+
ref: a,
|
|
2118
|
+
items: e.items,
|
|
2119
|
+
"min-item-size": e.minItemSize,
|
|
2120
|
+
buffer: e.buffer,
|
|
2121
|
+
"key-field": e.keyField,
|
|
2122
|
+
class: "scroller",
|
|
2123
|
+
onScroll: T
|
|
2124
|
+
}, {
|
|
2125
|
+
default: W(({ item: e, index: n, active: r }) => [f(H(Ut), {
|
|
2126
|
+
item: e,
|
|
2127
|
+
active: r,
|
|
2128
|
+
"data-index": n,
|
|
2129
|
+
"size-dependencies": [e]
|
|
2130
|
+
}, {
|
|
2131
|
+
default: W(() => [P(t.$slots, "default", {
|
|
2132
|
+
item: e,
|
|
2133
|
+
index: n,
|
|
2134
|
+
active: r
|
|
2135
|
+
}, void 0, !0)]),
|
|
2136
|
+
_: 2
|
|
2137
|
+
}, 1032, [
|
|
2138
|
+
"item",
|
|
2139
|
+
"active",
|
|
2140
|
+
"data-index",
|
|
2141
|
+
"size-dependencies"
|
|
2142
|
+
])]),
|
|
2143
|
+
after: W(() => [e.hasMore ? (k(), l("div", {
|
|
2144
|
+
key: 0,
|
|
2145
|
+
ref_key: "loadMoreTriggerRef",
|
|
2146
|
+
ref: d,
|
|
2147
|
+
class: "load-more-trigger"
|
|
2148
|
+
}, [p.value ? (k(), l("div", Wt, [f(H(K), { class: "is-loading" }, {
|
|
2149
|
+
default: W(() => [f(r)]),
|
|
2150
|
+
_: 1
|
|
2151
|
+
}), u("span", Gt, z(e.loadingText), 1)])) : c("", !0)], 512)) : c("", !0), !e.hasMore && e.items.length > 0 ? (k(), l("div", Kt, z(e.noMoreText), 1)) : c("", !0)]),
|
|
2152
|
+
_: 3
|
|
2153
|
+
}, 8, [
|
|
2154
|
+
"items",
|
|
2155
|
+
"min-item-size",
|
|
2156
|
+
"buffer",
|
|
2157
|
+
"key-field"
|
|
2158
|
+
])) : c("", !0), e.items.length === 0 && !p.value ? (k(), l("div", qt, [P(t.$slots, "empty", {}, () => [f(H(K), {
|
|
2159
|
+
class: "empty-icon",
|
|
2160
|
+
size: 80
|
|
2161
|
+
}, {
|
|
2162
|
+
default: W(() => [f(H(se))]),
|
|
2163
|
+
_: 1
|
|
2164
|
+
}), u("div", Jt, z(e.emptyText), 1)], !0)])) : c("", !0)], 4);
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
}, [["__scopeId", "data-v-37e01654"]]), Xt = { class: "search-wrap" }, Zt = { class: "list-item" }, Qt = ["onClick"], $t = { class: "node-info" }, en = { class: "node-label" }, tn = {
|
|
2168
|
+
key: 0,
|
|
2169
|
+
class: "node-suffix"
|
|
2170
|
+
}, nn = /*#__PURE__*/ i({
|
|
2171
|
+
__name: "index",
|
|
2172
|
+
props: {
|
|
2173
|
+
items: {
|
|
2174
|
+
type: Array,
|
|
2175
|
+
default: () => []
|
|
2176
|
+
},
|
|
2177
|
+
loading: {
|
|
2178
|
+
type: Boolean,
|
|
2179
|
+
default: !1
|
|
2180
|
+
},
|
|
2181
|
+
hasMore: {
|
|
2182
|
+
type: Boolean,
|
|
2183
|
+
default: !1
|
|
2184
|
+
},
|
|
2185
|
+
height: {
|
|
2186
|
+
type: String,
|
|
2187
|
+
default: "100%"
|
|
2188
|
+
},
|
|
2189
|
+
minItemSize: {
|
|
2190
|
+
type: Number,
|
|
2191
|
+
default: 50
|
|
2192
|
+
},
|
|
2193
|
+
buffer: {
|
|
2194
|
+
type: Number,
|
|
2195
|
+
default: 100
|
|
2196
|
+
},
|
|
2197
|
+
treeProps: {
|
|
2198
|
+
type: Object,
|
|
2199
|
+
default: () => ({
|
|
2200
|
+
label: "label",
|
|
2201
|
+
value: "value"
|
|
2202
|
+
})
|
|
2203
|
+
},
|
|
2204
|
+
selectedDocuments: {
|
|
2205
|
+
type: Array,
|
|
2206
|
+
default: () => []
|
|
2207
|
+
}
|
|
2208
|
+
},
|
|
2209
|
+
emits: ["load-more", "item-check"],
|
|
2210
|
+
setup(e, { emit: t }) {
|
|
2211
|
+
let { t: n } = r(), i = e, a = o(() => i.items.map((e) => {
|
|
2212
|
+
let t = (i.selectedDocuments || []).some((t) => t.id === e.id);
|
|
2213
|
+
return {
|
|
2214
|
+
...e,
|
|
2215
|
+
isSelected: t
|
|
2216
|
+
};
|
|
2217
|
+
})), s = t, d = (e, t) => {
|
|
2218
|
+
s("item-check", e, t);
|
|
2219
|
+
}, p = () => {
|
|
2220
|
+
s("load-more");
|
|
2221
|
+
};
|
|
2222
|
+
return (t, r) => (k(), l("div", Xt, [f(Yt, {
|
|
2223
|
+
items: a.value,
|
|
2224
|
+
loading: e.loading,
|
|
2225
|
+
"key-field": "id",
|
|
2226
|
+
"has-more": e.hasMore,
|
|
2227
|
+
"loading-text": H(n)("FEISHU_SEARCH_TEXT.LOADING_TEXT"),
|
|
2228
|
+
"no-more-text": H(n)("FEISHU_SEARCH_TEXT.NO_MORE_TEXT"),
|
|
2229
|
+
"empty-text": H(n)("FEISHU_SEARCH_TEXT.EMPTY_TEXT"),
|
|
2230
|
+
height: e.height,
|
|
2231
|
+
"min-item-size": e.minItemSize,
|
|
2232
|
+
buffer: e.buffer,
|
|
2233
|
+
onLoadMore: p
|
|
2234
|
+
}, {
|
|
2235
|
+
default: W(({ item: n }) => [u("div", Zt, [P(t.$slots, "default", { item: n }, () => [u("div", {
|
|
2236
|
+
class: "search-item",
|
|
2237
|
+
onClick: () => d(n, !n.isSelected)
|
|
2238
|
+
}, [
|
|
2239
|
+
f(H(re), { "model-value": n.isSelected }, null, 8, ["model-value"]),
|
|
2240
|
+
f(xe, {
|
|
2241
|
+
"file-type": n.type,
|
|
2242
|
+
size: 26,
|
|
2243
|
+
isLocalFileType: n?.isLocalFileType
|
|
2244
|
+
}, null, 8, ["file-type", "isLocalFileType"]),
|
|
2245
|
+
u("div", $t, [u("span", en, z(n[e.treeProps.label]), 1), n.suffix ? (k(), l("span", tn, z(n.suffix), 1)) : c("", !0)])
|
|
2246
|
+
], 8, Qt)], !0)])]),
|
|
2247
|
+
_: 3
|
|
2248
|
+
}, 8, [
|
|
2249
|
+
"items",
|
|
2250
|
+
"loading",
|
|
2251
|
+
"has-more",
|
|
2252
|
+
"loading-text",
|
|
2253
|
+
"no-more-text",
|
|
2254
|
+
"empty-text",
|
|
2255
|
+
"height",
|
|
2256
|
+
"min-item-size",
|
|
2257
|
+
"buffer"
|
|
2258
|
+
])]));
|
|
2259
|
+
}
|
|
2260
|
+
}, [["__scopeId", "data-v-a129f241"]]), rn = { class: "left-wrap" }, an = { class: "content" }, on = { class: "input-wrap" }, sn = { class: "tree-container" }, cn = { class: "tree-node-content" }, ln = { class: "node-info" }, un = { class: "node-label" }, dn = {
|
|
2261
|
+
key: 0,
|
|
2262
|
+
class: "node-suffix"
|
|
2263
|
+
}, fn = 15, pn = /*#__PURE__*/ i(/* @__PURE__ */ Object.assign({ name: "LeftLayout" }, {
|
|
2264
|
+
__name: "LeftLayout",
|
|
2265
|
+
props: {
|
|
2266
|
+
tabs: {
|
|
2267
|
+
type: Array,
|
|
2268
|
+
default: () => []
|
|
2269
|
+
},
|
|
2270
|
+
treeData: {
|
|
2271
|
+
type: Object,
|
|
2272
|
+
default: () => ({})
|
|
2273
|
+
},
|
|
2274
|
+
treeProps: {
|
|
2275
|
+
type: Object,
|
|
2276
|
+
default: () => Z
|
|
2277
|
+
},
|
|
2278
|
+
selectedDocuments: {
|
|
2279
|
+
type: Array,
|
|
2280
|
+
default: () => []
|
|
2281
|
+
},
|
|
2282
|
+
currentTab: {
|
|
2283
|
+
type: String,
|
|
2284
|
+
default: ""
|
|
2285
|
+
},
|
|
2286
|
+
searchType: {
|
|
2287
|
+
type: String,
|
|
2288
|
+
default: ye.FRONTEND,
|
|
2289
|
+
validator: (e) => Object.values(ye).includes(e)
|
|
2290
|
+
},
|
|
2291
|
+
textConfig: {
|
|
2292
|
+
type: Object,
|
|
2293
|
+
default: () => ({ searchPlaceholder: "" })
|
|
2294
|
+
},
|
|
2295
|
+
getTabSelectedDocuments: {
|
|
2296
|
+
type: Function,
|
|
2297
|
+
default: () => () => []
|
|
2298
|
+
},
|
|
2299
|
+
responseSearchHook: {
|
|
2300
|
+
type: Object,
|
|
2301
|
+
default: () => {}
|
|
2302
|
+
}
|
|
2303
|
+
},
|
|
2304
|
+
emits: [
|
|
2305
|
+
"node-check",
|
|
2306
|
+
"tab-change",
|
|
2307
|
+
"search",
|
|
2308
|
+
"node-expand",
|
|
2309
|
+
"load-more",
|
|
2310
|
+
"node-check-search"
|
|
2311
|
+
],
|
|
2312
|
+
setup(e, { expose: t, emit: n }) {
|
|
2313
|
+
let r = e, i = n, d = Fe(g), p = M(), m = M(""), h = M(r.currentTab || r.tabs[0]?.value || Q.MY_FILES), _ = M([]), v = M(!1), y = M(!1), x = o(() => r.tabs.map((e) => ({
|
|
2314
|
+
label: e.label,
|
|
2315
|
+
value: e.value
|
|
2316
|
+
}))), S = o(() => r.treeData[h.value] || []);
|
|
2317
|
+
U(() => r.responseSearchHook, (e, t) => {
|
|
2318
|
+
y.value = Je(r.currentTab, e), v.value = !1;
|
|
2319
|
+
}, {
|
|
2320
|
+
deep: !0,
|
|
2321
|
+
immediate: !0
|
|
2322
|
+
});
|
|
2323
|
+
let C = ze(i, 800), w = o(() => {
|
|
2324
|
+
if (r.searchType === ye.BACKEND) return S.value;
|
|
2325
|
+
let e = m.value?.trim();
|
|
2326
|
+
return e ? Be(S.value, e, r.treeProps) : S.value;
|
|
2327
|
+
}), T = (e) => r.getTabSelectedDocuments(h.value).some((t) => t[r.treeProps.value] === e), E = o(() => {
|
|
2328
|
+
if (!m.value?.trim()) return [];
|
|
2329
|
+
let e = (t, n = 0) => {
|
|
2330
|
+
let i = [];
|
|
2331
|
+
return t.forEach((t) => {
|
|
2332
|
+
i.push({
|
|
2333
|
+
...t,
|
|
2334
|
+
level: n,
|
|
2335
|
+
isSelected: T(t[r.treeProps.value])
|
|
2336
|
+
}), t[r.treeProps.children] && t[r.treeProps.children].length > 0 && (i = i.concat(e(t[r.treeProps.children], n + 1)));
|
|
2337
|
+
}), i;
|
|
2338
|
+
};
|
|
2339
|
+
return e(w.value);
|
|
2340
|
+
}), D = (e) => {
|
|
2341
|
+
i("node-check", e);
|
|
2342
|
+
}, O = (e, t) => {
|
|
2343
|
+
i("node-check-search", {
|
|
2344
|
+
selectedNode: r.getTabSelectedDocuments(h.value),
|
|
2345
|
+
checkedNode: e,
|
|
2346
|
+
isChecked: t
|
|
2347
|
+
});
|
|
2348
|
+
};
|
|
2349
|
+
U(h, (e) => {
|
|
2350
|
+
y.value = Je(e, r.responseSearchHook), i("tab-change", e);
|
|
2351
|
+
}), U(() => r.treeData, () => {
|
|
2352
|
+
v.value = !1, p.value && p.value.syncSelectedNodes && b(() => {
|
|
2353
|
+
let e = (r.selectedDocuments || []).map((e) => e[r.treeProps.value]);
|
|
2354
|
+
p.value.syncSelectedNodes(e);
|
|
2355
|
+
});
|
|
2356
|
+
}, { deep: !0 });
|
|
2357
|
+
let A = (e) => {
|
|
2358
|
+
Re(e) || i("node-expand", {
|
|
2359
|
+
node: e,
|
|
2360
|
+
tabKey: h.value
|
|
2361
|
+
});
|
|
2362
|
+
}, j = () => {
|
|
2363
|
+
v.value = !0, i("load-more");
|
|
2364
|
+
};
|
|
2365
|
+
return U(m, (e) => {
|
|
2366
|
+
r.searchType === ye.BACKEND ? (e && e.trim() && (v.value = !0), C(e || "")) : v.value = !1;
|
|
2367
|
+
}), U(() => r.currentTab, (e) => {
|
|
2368
|
+
e && e !== h.value && (h.value = e);
|
|
2369
|
+
}, { immediate: !0 }), U(() => r.selectedDocuments, (e) => {
|
|
2370
|
+
_.value = e || [];
|
|
2371
|
+
}, {
|
|
2372
|
+
immediate: !0,
|
|
2373
|
+
deep: !0
|
|
2374
|
+
}), t({
|
|
2375
|
+
setNodeCheckStatus: (e, t) => {
|
|
2376
|
+
p.value?.setNodeCheckStatus(e, t);
|
|
2377
|
+
},
|
|
2378
|
+
updateNodeChildren: (e, t) => {
|
|
2379
|
+
p.value && p.value?.updateNodeChildren && p.value.updateNodeChildren(e, t);
|
|
2380
|
+
},
|
|
2381
|
+
syncSelectedNodes: (e) => {
|
|
2382
|
+
p.value?.syncSelectedNodes(e);
|
|
2383
|
+
}
|
|
2384
|
+
}), (t, n) => (k(), l("div", rn, [u("div", an, [
|
|
2385
|
+
u("div", on, [f(H(q), {
|
|
2386
|
+
modelValue: m.value,
|
|
2387
|
+
"onUpdate:modelValue": n[0] ||= (e) => m.value = e,
|
|
2388
|
+
placeholder: r.textConfig.searchPlaceholder,
|
|
2389
|
+
"prefix-icon": H(ge),
|
|
2390
|
+
clearable: ""
|
|
2391
|
+
}, null, 8, [
|
|
2392
|
+
"modelValue",
|
|
2393
|
+
"placeholder",
|
|
2394
|
+
"prefix-icon"
|
|
2395
|
+
])]),
|
|
2396
|
+
f(H(ie), {
|
|
2397
|
+
modelValue: h.value,
|
|
2398
|
+
"onUpdate:modelValue": n[1] ||= (e) => h.value = e,
|
|
2399
|
+
options: x.value
|
|
2400
|
+
}, null, 8, ["modelValue", "options"]),
|
|
2401
|
+
u("div", sn, [!w.value || w.value.length === 0 ? (k(), s(H(_e), { key: 0 })) : (k(), l(a, { key: 1 }, [m.value.trim() === "" ? (k(), s(Xe, {
|
|
2402
|
+
key: 1,
|
|
2403
|
+
modelValue: _.value,
|
|
2404
|
+
"onUpdate:modelValue": n[2] ||= (e) => _.value = e,
|
|
2405
|
+
ref_key: "treeSelectRef",
|
|
2406
|
+
ref: p,
|
|
2407
|
+
"tree-list": w.value,
|
|
2408
|
+
"tree-props": e.treeProps,
|
|
2409
|
+
"filter-keyword": m.value,
|
|
2410
|
+
itemSize: 50,
|
|
2411
|
+
hasTreeLine: !0,
|
|
2412
|
+
"text-config": e.textConfig,
|
|
2413
|
+
includeParentSelected: !0,
|
|
2414
|
+
onHandleCheck: D,
|
|
2415
|
+
onNodeExpand: A,
|
|
2416
|
+
getTabSelectedDocuments: e.getTabSelectedDocuments
|
|
2417
|
+
}, {
|
|
2418
|
+
node: W(({ node: n, data: r }) => [P(t.$slots, "node", {
|
|
2419
|
+
node: n,
|
|
2420
|
+
data: r
|
|
2421
|
+
}, () => [f(H(d), {
|
|
2422
|
+
node: n,
|
|
2423
|
+
treeData: w.value,
|
|
2424
|
+
showLabelLine: !0,
|
|
2425
|
+
indent: fn
|
|
2426
|
+
}, {
|
|
2427
|
+
default: W(() => [u("div", cn, [f(xe, {
|
|
2428
|
+
"file-type": r.type,
|
|
2429
|
+
size: 26,
|
|
2430
|
+
isLocalFileType: r?.isLocalFileType
|
|
2431
|
+
}, null, 8, ["file-type", "isLocalFileType"]), u("div", ln, [u("span", un, z(r[e.treeProps.label]), 1), r.suffix ? (k(), l("span", dn, z(r.suffix), 1)) : c("", !0)])])]),
|
|
2432
|
+
_: 2
|
|
2433
|
+
}, 1032, ["node", "treeData"])], !0)]),
|
|
2434
|
+
_: 3
|
|
2435
|
+
}, 8, [
|
|
2436
|
+
"modelValue",
|
|
2437
|
+
"tree-list",
|
|
2438
|
+
"tree-props",
|
|
2439
|
+
"filter-keyword",
|
|
2440
|
+
"text-config",
|
|
2441
|
+
"getTabSelectedDocuments"
|
|
2442
|
+
])) : (k(), s(nn, {
|
|
2443
|
+
key: 0,
|
|
2444
|
+
items: E.value,
|
|
2445
|
+
loading: v.value,
|
|
2446
|
+
"has-more": y.value,
|
|
2447
|
+
"min-item-size": 50,
|
|
2448
|
+
buffer: 100,
|
|
2449
|
+
"tree-props": e.treeProps,
|
|
2450
|
+
"selected-documents": e.selectedDocuments,
|
|
2451
|
+
onItemCheck: O,
|
|
2452
|
+
onLoadMore: j
|
|
2453
|
+
}, null, 8, [
|
|
2454
|
+
"items",
|
|
2455
|
+
"loading",
|
|
2456
|
+
"has-more",
|
|
2457
|
+
"tree-props",
|
|
2458
|
+
"selected-documents"
|
|
2459
|
+
]))], 64))])
|
|
2460
|
+
])]));
|
|
2461
|
+
}
|
|
2462
|
+
}), [["__scopeId", "data-v-6bf8c501"]]);
|
|
2463
|
+
//#endregion
|
|
2464
|
+
//#region components/DocSyncSelect/useDocumentSelection.js
|
|
2465
|
+
function mn(e = {}) {
|
|
2466
|
+
let { valueKey: t = "id" } = e, n = M(/* @__PURE__ */ new Map()), r = o(() => {
|
|
2467
|
+
let e = [], r = /* @__PURE__ */ new Set();
|
|
2468
|
+
return n.value.forEach((n) => {
|
|
2469
|
+
n.forEach((n) => {
|
|
2470
|
+
let i = n[t];
|
|
2471
|
+
r.has(i) || (e.push(n), r.add(i));
|
|
2472
|
+
});
|
|
2473
|
+
}), e;
|
|
2474
|
+
});
|
|
2475
|
+
return {
|
|
2476
|
+
allSelectedDocuments: r,
|
|
2477
|
+
selectionMap: n,
|
|
2478
|
+
getTabSelectedDocuments: (e) => {
|
|
2479
|
+
let t = n.value.get(e);
|
|
2480
|
+
return t ? Array.from(t.values()) : [];
|
|
2481
|
+
},
|
|
2482
|
+
updateTabSelection: (e, r = []) => {
|
|
2483
|
+
n.value.has(e) || n.value.set(e, /* @__PURE__ */ new Map());
|
|
2484
|
+
let i = /* @__PURE__ */ new Map();
|
|
2485
|
+
r.forEach((e) => {
|
|
2486
|
+
e && e[t] != null && i.set(e[t], e);
|
|
2487
|
+
}), n.value.set(e, i), n.value = new Map(n.value);
|
|
2488
|
+
},
|
|
2489
|
+
removeDocument: (e) => {
|
|
2490
|
+
let r = e[t], i = null;
|
|
2491
|
+
return n.value.forEach((e, t) => {
|
|
2492
|
+
e.has(r) && (e.delete(r), i = t);
|
|
2493
|
+
}), i && (n.value = new Map(n.value)), i;
|
|
2494
|
+
},
|
|
2495
|
+
toggleDocument: (e, r, i) => {
|
|
2496
|
+
n.value.has(e) || n.value.set(e, /* @__PURE__ */ new Map());
|
|
2497
|
+
let a = n.value.get(e), o = r[t];
|
|
2498
|
+
i ? a.set(o, r) : a.delete(o), n.value = new Map(n.value);
|
|
2499
|
+
},
|
|
2500
|
+
clearTabSelection: (e) => {
|
|
2501
|
+
n.value.has(e) && (n.value.get(e).clear(), n.value = new Map(n.value));
|
|
2502
|
+
},
|
|
2503
|
+
clearAllSelection: () => {
|
|
2504
|
+
n.value.clear(), n.value = new Map(n.value);
|
|
2505
|
+
},
|
|
2506
|
+
isDocumentSelected: (e, t) => {
|
|
2507
|
+
let r = n.value.get(e);
|
|
2508
|
+
return r ? r.has(t) : !1;
|
|
2509
|
+
},
|
|
2510
|
+
setAllDocuments: (e = [], r = "") => {
|
|
2511
|
+
n.value.clear(), e.forEach((e) => {
|
|
2512
|
+
let i = e.tabKey || r;
|
|
2513
|
+
i && (n.value.has(i) || n.value.set(i, /* @__PURE__ */ new Map()), n.value.get(i).set(e[t], e));
|
|
2514
|
+
}), n.value = new Map(n.value);
|
|
2515
|
+
},
|
|
2516
|
+
getStatistics: () => {
|
|
2517
|
+
let e = {
|
|
2518
|
+
total: r.value.length,
|
|
2519
|
+
byTab: {}
|
|
2520
|
+
};
|
|
2521
|
+
return n.value.forEach((t, n) => {
|
|
2522
|
+
e.byTab[n] = t.size;
|
|
2523
|
+
}), e;
|
|
2524
|
+
}
|
|
2525
|
+
};
|
|
2526
|
+
}
|
|
2527
|
+
//#endregion
|
|
2528
|
+
//#region components/DocSyncSelect/useAllTabDocList.js
|
|
2529
|
+
function hn(e = {}) {
|
|
2530
|
+
let { valueKey: t = Z.value, childrenKey: n = Z.children } = e, r = M(/* @__PURE__ */ new Map()), i = M({});
|
|
2531
|
+
return {
|
|
2532
|
+
allTabDocList: r,
|
|
2533
|
+
allTabTreeDataObject: o(() => {
|
|
2534
|
+
let e = {};
|
|
2535
|
+
return r.value.forEach((t, n) => {
|
|
2536
|
+
e[n] = t;
|
|
2537
|
+
}), e;
|
|
2538
|
+
}),
|
|
2539
|
+
responseSearchHook: i,
|
|
2540
|
+
setAllTabsTreeData: (e = {}) => {
|
|
2541
|
+
let t = /* @__PURE__ */ new Map();
|
|
2542
|
+
e && typeof e == "object" && Object.keys(e).forEach((n) => {
|
|
2543
|
+
let r = Array.isArray(e[n]) ? e[n] : [];
|
|
2544
|
+
t.set(n, r);
|
|
2545
|
+
}), r.value = t;
|
|
2546
|
+
},
|
|
2547
|
+
getTabTreeData: (e) => r.value.get(e) || [],
|
|
2548
|
+
setTabTreeData: (e, t = []) => {
|
|
2549
|
+
let n = new Map(r.value);
|
|
2550
|
+
n.set(e, Array.isArray(t) ? t : []), r.value = n;
|
|
2551
|
+
},
|
|
2552
|
+
updateNodeChildren: (e, i, a = []) => {
|
|
2553
|
+
let o = r.value.get(e);
|
|
2554
|
+
if (!o || !Array.isArray(o)) return;
|
|
2555
|
+
let s = (e) => e.map((e) => {
|
|
2556
|
+
if (e[t] === i) return {
|
|
2557
|
+
...e,
|
|
2558
|
+
[n]: a
|
|
2559
|
+
};
|
|
2560
|
+
let r = e[n];
|
|
2561
|
+
return Array.isArray(r) && r.length > 0 ? {
|
|
2562
|
+
...e,
|
|
2563
|
+
[n]: s(r)
|
|
2564
|
+
} : e;
|
|
2565
|
+
}), c = s(o), l = new Map(r.value);
|
|
2566
|
+
l.set(e, c), r.value = l;
|
|
2567
|
+
},
|
|
2568
|
+
setResponseSearchHook: (e) => {
|
|
2569
|
+
i.value = e;
|
|
2570
|
+
}
|
|
2571
|
+
};
|
|
2572
|
+
}
|
|
2573
|
+
//#endregion
|
|
2574
|
+
//#region components/DocSyncSelect/layout.vue
|
|
2575
|
+
var gn = { class: "doc-sync-select" }, _n = n(/* @__PURE__ */ i(/* @__PURE__ */ Object.assign({ name: "DocSyncSelect" }, {
|
|
2576
|
+
__name: "layout",
|
|
2577
|
+
props: {
|
|
2578
|
+
modelValue: {
|
|
2579
|
+
type: Array,
|
|
2580
|
+
default: () => []
|
|
2581
|
+
},
|
|
2582
|
+
treeData: {
|
|
2583
|
+
type: Object,
|
|
2584
|
+
default: () => ({})
|
|
2585
|
+
},
|
|
2586
|
+
updateMeta: {
|
|
2587
|
+
type: Object,
|
|
2588
|
+
default: () => ({
|
|
2589
|
+
updateId: "",
|
|
2590
|
+
operation: null,
|
|
2591
|
+
context: {}
|
|
2592
|
+
})
|
|
2593
|
+
},
|
|
2594
|
+
treeProps: {
|
|
2595
|
+
type: Object,
|
|
2596
|
+
default: () => Z
|
|
2597
|
+
},
|
|
2598
|
+
tabs: {
|
|
2599
|
+
type: Array,
|
|
2600
|
+
default: () => []
|
|
2601
|
+
},
|
|
2602
|
+
searchType: {
|
|
2603
|
+
type: String,
|
|
2604
|
+
default: ye.FRONTEND,
|
|
2605
|
+
validator: (e) => Object.values(ye).includes(e)
|
|
2606
|
+
},
|
|
2607
|
+
textConfig: {
|
|
2608
|
+
type: Object,
|
|
2609
|
+
default: () => ({ searchPlaceholder: "" })
|
|
2610
|
+
}
|
|
2611
|
+
},
|
|
2612
|
+
emits: [
|
|
2613
|
+
"update:modelValue",
|
|
2614
|
+
"change",
|
|
2615
|
+
"search",
|
|
2616
|
+
"load-node",
|
|
2617
|
+
"recursive-load",
|
|
2618
|
+
"load-more"
|
|
2619
|
+
],
|
|
2620
|
+
setup(e, { expose: t, emit: n }) {
|
|
2621
|
+
let r = e, i = n, a = o(() => ({
|
|
2622
|
+
...Z,
|
|
2623
|
+
...r.treeProps
|
|
2624
|
+
})), s = o(() => a.value.value), c = o(() => a.value.children), u = M(), d = M(r.tabs[0]?.value || ""), { allSelectedDocuments: p, getTabSelectedDocuments: m, updateTabSelection: h, removeDocument: g, setAllDocuments: _, selectionMap: v, getAllSelectedIds: y } = mn({ valueKey: a.value.value }), x = (e = p.value) => {
|
|
2625
|
+
i("update:modelValue", e), i("change", e);
|
|
2626
|
+
}, { allTabTreeDataObject: S, setAllTabsTreeData: C, updateNodeChildren: w, responseSearchHook: T, setResponseSearchHook: E } = hn({
|
|
2627
|
+
valueKey: s.value,
|
|
2628
|
+
childrenKey: c.value
|
|
2629
|
+
});
|
|
2630
|
+
U(() => r.treeData, (e) => {
|
|
2631
|
+
C(e || {});
|
|
2632
|
+
}, {
|
|
2633
|
+
deep: !0,
|
|
2634
|
+
immediate: !0
|
|
2635
|
+
}), U(() => r.updateMeta, (e, t) => {
|
|
2636
|
+
if (!e || !e.updateId || e.updateId === (t?.updateId || "")) return;
|
|
2637
|
+
let { operation: n, context: r } = e;
|
|
2638
|
+
switch (n) {
|
|
2639
|
+
case "node-children-update":
|
|
2640
|
+
z(r);
|
|
2641
|
+
break;
|
|
2642
|
+
case "recursive-load":
|
|
2643
|
+
B(r);
|
|
2644
|
+
break;
|
|
2645
|
+
case "search":
|
|
2646
|
+
case "load-more":
|
|
2647
|
+
V(r);
|
|
2648
|
+
break;
|
|
2649
|
+
default: break;
|
|
2650
|
+
}
|
|
2651
|
+
}, {
|
|
2652
|
+
deep: !0,
|
|
2653
|
+
immediate: !1
|
|
2654
|
+
});
|
|
2655
|
+
let O = o(() => m(d.value)), A = (e) => {
|
|
2656
|
+
d.value = e;
|
|
2657
|
+
let t = m(e);
|
|
2658
|
+
u.value && u.value.syncSelectedNodes && b(() => {
|
|
2659
|
+
let e = t.map((e) => e[a.value.value]);
|
|
2660
|
+
u.value.syncSelectedNodes(e);
|
|
2661
|
+
});
|
|
2662
|
+
}, j = (e, t, n) => {
|
|
2663
|
+
b(() => {
|
|
2664
|
+
let r = t || [];
|
|
2665
|
+
h(n, [
|
|
2666
|
+
...Ve(e, a.value),
|
|
2667
|
+
e,
|
|
2668
|
+
...r
|
|
2669
|
+
]), x();
|
|
2670
|
+
});
|
|
2671
|
+
}, N = (e) => {
|
|
2672
|
+
let { selectedNode: t, checkedNode: n, isChecked: r } = e, i = m(d.value);
|
|
2673
|
+
if (t = Ge({
|
|
2674
|
+
tabKey: d.value,
|
|
2675
|
+
currentSelectedDocs: [n],
|
|
2676
|
+
treeData: S.value,
|
|
2677
|
+
treeProps: a.value,
|
|
2678
|
+
hasSelectToRightDocList: i
|
|
2679
|
+
}), !r) {
|
|
2680
|
+
h(d.value, i.filter((e) => e.id !== n.id)), x();
|
|
2681
|
+
return;
|
|
2682
|
+
}
|
|
2683
|
+
h(d.value, [...i, ...t]), x();
|
|
2684
|
+
}, P = (e) => {
|
|
2685
|
+
let { selectedNode: t, checkedNode: n, isChecked: r } = e, i = m(d.value);
|
|
2686
|
+
if (t = Ge({
|
|
2687
|
+
tabKey: d.value,
|
|
2688
|
+
currentSelectedDocs: t,
|
|
2689
|
+
treeData: S.value,
|
|
2690
|
+
treeProps: a.value,
|
|
2691
|
+
hasSelectToRightDocList: i
|
|
2692
|
+
}), !n?.hasChildren) {
|
|
2693
|
+
h(d.value, t), x();
|
|
2694
|
+
return;
|
|
2695
|
+
}
|
|
2696
|
+
if (!r) {
|
|
2697
|
+
let e = Ve(n, a.value), t = new Set([n[s.value], ...e.map((e) => e[s.value])]), r = m(d.value).filter((e) => !t.has(e[s.value]));
|
|
2698
|
+
h(d.value, r), t.forEach((e) => {
|
|
2699
|
+
u.value?.setNodeCheckStatus && u.value.setNodeCheckStatus(e, !1);
|
|
2700
|
+
}), x();
|
|
2701
|
+
return;
|
|
2702
|
+
}
|
|
2703
|
+
if (r && n && qe(n, a.value)) {
|
|
2704
|
+
L(n);
|
|
2705
|
+
return;
|
|
2706
|
+
} else j(n, t || [], d.value);
|
|
2707
|
+
}, F = (e) => {
|
|
2708
|
+
let t = a.value.value;
|
|
2709
|
+
g(e) === d.value && u.value && u.value.setNodeCheckStatus && u.value.setNodeCheckStatus(e[t], !1), x();
|
|
2710
|
+
}, I = ({ node: e, tabKey: t }) => {
|
|
2711
|
+
let n = {};
|
|
2712
|
+
t === Q.FEISHU_KNOWLEDGE ? n = {
|
|
2713
|
+
spaceId: e?.spaceId,
|
|
2714
|
+
parentNodeToken: e?.nodeToken
|
|
2715
|
+
} : t === Q.MY_FILES && (n = { folderToken: e?.folderToken }), i("load-node", {
|
|
2716
|
+
nodeKey: e[a.value?.value],
|
|
2717
|
+
nodeData: e,
|
|
2718
|
+
tabKey: t,
|
|
2719
|
+
requestParams: n
|
|
2720
|
+
});
|
|
2721
|
+
}, L = (e) => {
|
|
2722
|
+
let t = {};
|
|
2723
|
+
d.value === Q.FEISHU_KNOWLEDGE ? t = {
|
|
2724
|
+
spaceId: e?.spaceId,
|
|
2725
|
+
parentNodeToken: e?.nodeToken,
|
|
2726
|
+
recursive: !0
|
|
2727
|
+
} : d.value === Q.MY_FILES && (t = {
|
|
2728
|
+
folderToken: e?.folderToken,
|
|
2729
|
+
recursive: !0
|
|
2730
|
+
}), i("recursive-load", {
|
|
2731
|
+
nodeKey: e[a.value?.value],
|
|
2732
|
+
nodeData: e,
|
|
2733
|
+
tabKey: d.value,
|
|
2734
|
+
requestParams: t
|
|
2735
|
+
});
|
|
2736
|
+
}, R = (e, t) => {
|
|
2737
|
+
u.value && u.value.updateNodeChildren && u.value.updateNodeChildren(e, t), d.value && w(d.value, e, t);
|
|
2738
|
+
}, z = (e) => {
|
|
2739
|
+
let { nodeKey: t, newChildren: n } = e;
|
|
2740
|
+
u.value?.updateNodeChildren && u.value.updateNodeChildren(t, n);
|
|
2741
|
+
}, B = (e) => {
|
|
2742
|
+
let { nodeKey: t, tabKey: n, newChildren: i, originalNode: o, nodeData: s, error: c } = e;
|
|
2743
|
+
if (c) return;
|
|
2744
|
+
let l = Ke(r.treeData[n] || [], o?.id || t, a.value);
|
|
2745
|
+
l && j(l, m(n || d.value), n || d.value);
|
|
2746
|
+
}, V = (e) => {
|
|
2747
|
+
let { responseSearch: t } = e;
|
|
2748
|
+
E(t);
|
|
2749
|
+
}, ee = ({ keyword: e }) => {
|
|
2750
|
+
i("search", { keyword: e });
|
|
2751
|
+
}, W = () => {
|
|
2752
|
+
i("load-more", d.value);
|
|
2753
|
+
};
|
|
2754
|
+
return D(() => {
|
|
2755
|
+
r.modelValue && r.modelValue.length > 0 && _(r.modelValue, d.value);
|
|
2756
|
+
}), U(() => r.modelValue, (e, t) => {
|
|
2757
|
+
if (!e || e.length === 0) {
|
|
2758
|
+
t && t.length > 0 && _([]);
|
|
2759
|
+
return;
|
|
2760
|
+
}
|
|
2761
|
+
let n = p.value;
|
|
2762
|
+
n.length === e.length && e.every((e) => n.some((t) => t[a.value.value] === e[a.value.value])) || _(e, d.value);
|
|
2763
|
+
}, { deep: !0 }), t({
|
|
2764
|
+
clearSelection: () => {
|
|
2765
|
+
_([]), x([]);
|
|
2766
|
+
},
|
|
2767
|
+
getSelectedDocuments: () => p.value,
|
|
2768
|
+
setSelectedDocuments: (e) => {
|
|
2769
|
+
_(e, d.value), x();
|
|
2770
|
+
},
|
|
2771
|
+
updateNodeChildren: R
|
|
2772
|
+
}), (t, n) => (k(), l("div", gn, [f(pn, {
|
|
2773
|
+
tabs: e.tabs,
|
|
2774
|
+
"tree-data": H(S),
|
|
2775
|
+
"tree-props": a.value,
|
|
2776
|
+
"selected-documents": O.value,
|
|
2777
|
+
"current-tab": d.value,
|
|
2778
|
+
"search-type": e.searchType,
|
|
2779
|
+
"text-config": e.textConfig,
|
|
2780
|
+
"response-search-hook": H(T),
|
|
2781
|
+
ref_key: "leftLayoutRef",
|
|
2782
|
+
ref: u,
|
|
2783
|
+
onNodeCheck: P,
|
|
2784
|
+
onNodeCheckSearch: N,
|
|
2785
|
+
onTabChange: A,
|
|
2786
|
+
onSearch: ee,
|
|
2787
|
+
onNodeExpand: I,
|
|
2788
|
+
onLoadMore: W,
|
|
2789
|
+
getTabSelectedDocuments: H(m)
|
|
2790
|
+
}, null, 8, [
|
|
2791
|
+
"tabs",
|
|
2792
|
+
"tree-data",
|
|
2793
|
+
"tree-props",
|
|
2794
|
+
"selected-documents",
|
|
2795
|
+
"current-tab",
|
|
2796
|
+
"search-type",
|
|
2797
|
+
"text-config",
|
|
2798
|
+
"response-search-hook",
|
|
2799
|
+
"getTabSelectedDocuments"
|
|
2800
|
+
]), f(Ne, {
|
|
2801
|
+
"selected-documents": H(p),
|
|
2802
|
+
"tree-props": a.value,
|
|
2803
|
+
onDeleteNode: F
|
|
2804
|
+
}, null, 8, ["selected-documents", "tree-props"])]));
|
|
2805
|
+
}
|
|
2806
|
+
}), [["__scopeId", "data-v-c45c2d8e"]])), vn = n(xe);
|
|
2807
|
+
//#endregion
|
|
2808
|
+
export { vn as n, _n as t };
|