aibox-custom-component-packages 0.0.21 → 0.0.22

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.
Files changed (118) hide show
  1. package/es/AiboxTabs.mjs +71 -0
  2. package/es/ExampleComponent.mjs +35 -0
  3. package/es/SourcePublish.mjs +1 -1
  4. package/es/assets/AiboxTabs.css +1 -0
  5. package/es/assets/BackBar.css +1 -0
  6. package/es/assets/ExampleComponent.css +1 -0
  7. package/es/assets/SourcePublish.css +1 -1
  8. package/es/assets/index.css +1 -0
  9. package/es/assets/index2.css +1 -0
  10. package/es/assets/index3.css +1 -0
  11. package/es/assets/index4.css +1 -0
  12. package/es/chunks/AiboxTable.CF4T_OCu.js +645 -0
  13. package/es/chunks/BackBar.Bc2NIuzk.js +645 -0
  14. package/es/chunks/{SourcePublish.BjY8OTLS.js → SourcePublish.CjzqOFwj.js} +23 -10
  15. package/es/chunks/_plugin-vue_export-helper.CHgC5LLL.js +9 -0
  16. package/es/chunks/config.8htFF04x.js +325 -0
  17. package/es/chunks/config.BU21Gda2.js +49 -0
  18. package/es/chunks/config.DPkdwjwD.js +49 -0
  19. package/es/chunks/config.gNZ_rT87.js +325 -0
  20. package/es/chunks/enums.CfSBDD6u.js +83 -0
  21. package/es/chunks/enums.WrpwbF4w.js +14 -0
  22. package/es/chunks/field-types.CPnMOjle.js +13 -0
  23. package/es/chunks/files.cduUqjHX.js +16 -0
  24. package/es/chunks/i18n.DmqkiK-h.js +444 -0
  25. package/es/chunks/i18n.k9Q_HVMs.js +443 -0
  26. package/es/chunks/index.BDd6hHiU.js +172 -0
  27. package/es/chunks/index.CF_YHLP5.js +257 -0
  28. package/es/chunks/index.DM3o2YX3.js +398 -0
  29. package/es/chunks/index.Dx-mCS4E.js +1298 -0
  30. package/es/chunks/index.bCzIhWFw.js +7 -0
  31. package/es/chunks/index.ml5i7aB5.js +257 -0
  32. package/es/chunks/layout.CygCXa6s.js +26 -0
  33. package/es/chunks/publish.D6friivo.js +50 -0
  34. package/es/chunks/publish.DlD0o09n.js +50 -0
  35. package/es/chunks/request.24c3shPx.js +5 -0
  36. package/es/chunks/usePreview.BHvXwaNi.js +157 -0
  37. package/es/index.mjs +1 -1
  38. package/lib/AiboxTabs.js +1 -0
  39. package/lib/ExampleComponent.js +1 -0
  40. package/lib/SourcePublish.js +1 -1
  41. package/lib/assets/AiboxTabs.css +1 -0
  42. package/lib/assets/BackBar.css +1 -0
  43. package/lib/assets/ExampleComponent.css +1 -0
  44. package/lib/assets/SourcePublish.css +1 -1
  45. package/lib/assets/index.css +1 -0
  46. package/lib/assets/index2.css +1 -0
  47. package/lib/assets/index3.css +1 -0
  48. package/lib/assets/index4.css +1 -0
  49. package/lib/chunks/AiboxTable.CJOPGJtU.js +1 -0
  50. package/lib/chunks/BackBar.CZsNxoX1.js +1 -0
  51. package/lib/chunks/SourcePublish.eOSEULjP.js +1 -0
  52. package/lib/chunks/_plugin-vue_export-helper.BHFhmbuH.js +1 -0
  53. package/lib/chunks/config.1oaIKLGn.js +1 -0
  54. package/lib/chunks/config.B0XKkp1w.js +1 -0
  55. package/lib/chunks/config.BCAuBVxV.js +1 -0
  56. package/lib/chunks/config.BF7MO0O5.js +1 -0
  57. package/lib/chunks/enums.Dmq4PdUc.js +1 -0
  58. package/lib/chunks/enums.DpU2er5r.js +1 -0
  59. package/lib/chunks/field-types.Ch_2yDfg.js +1 -0
  60. package/lib/chunks/files.B3-8UC0v.js +1 -0
  61. package/lib/chunks/i18n.CL5L6nx6.js +1 -0
  62. package/lib/chunks/i18n.DgOp_D7R.js +1 -0
  63. package/lib/chunks/index.4hFddClT.js +6 -0
  64. package/lib/chunks/index.BNivYbtq.js +1 -0
  65. package/lib/chunks/index.B_keI1Aq.js +1 -0
  66. package/lib/chunks/index.Bk-RwmaH.js +1 -0
  67. package/lib/chunks/index.CJFk1R2u.js +59 -0
  68. package/lib/chunks/index.CkihWzK6.js +1 -0
  69. package/lib/chunks/layout.DbBSbLgm.js +1 -0
  70. package/lib/chunks/publish.3TrK3fZf.js +1 -0
  71. package/lib/chunks/publish.Bw1acrSu.js +1 -0
  72. package/lib/chunks/request.D8T4MgGX.js +1 -0
  73. package/lib/chunks/usePreview.BojIDW7Z.js +1 -0
  74. package/lib/index.js +1 -1
  75. package/package.json +3 -3
  76. package/es/chunks/AddOrEditSupplierDialog.BCiXcUBu.js +0 -721
  77. package/es/chunks/AiboxTable.B_Yli5E8.js +0 -635
  78. package/es/chunks/ApplicationTypeTag.BbJwXyVa.js +0 -47
  79. package/es/chunks/AuthSection.CLi8HcIx.js +0 -201
  80. package/es/chunks/AvailableRangePreview.BgeL_bMq.js +0 -194
  81. package/es/chunks/AvailableRangeSetting.CGJxgfPT.js +0 -229
  82. package/es/chunks/CodeView.CWbewuHs.js +0 -148
  83. package/es/chunks/CommonTagsList.CJdBie2N.js +0 -156
  84. package/es/chunks/CreateMcpForm.C0HqvD-g.js +0 -308
  85. package/es/chunks/DocSyncSelect.DlJXL1lq.js +0 -2290
  86. package/es/chunks/FileUploader.BSIhrd9M.js +0 -216
  87. package/es/chunks/McpFormDialog.CDH31D2Q.js +0 -297
  88. package/es/chunks/McpParamsSet.Bx3aRL9j.js +0 -501
  89. package/es/chunks/MdEditor.Bb9S_hso.js +0 -163
  90. package/es/chunks/ParameterTable.CoRz_932.js +0 -2010
  91. package/es/chunks/PublishRecord.C8h1tu3w.js +0 -133
  92. package/es/chunks/SourcePublish.CebmryAz.js +0 -966
  93. package/es/chunks/SourcePublish.Dk7O9GzI.js +0 -968
  94. package/es/chunks/config.CIQoQGOb.js +0 -35
  95. package/es/chunks/config.lm2B-n0s.js +0 -270
  96. package/es/chunks/i18n.CIhVBbR3.js +0 -418
  97. package/lib/chunks/AddOrEditSupplierDialog.XtPxc5yr.js +0 -1
  98. package/lib/chunks/AiboxTable.DFyqwoGc.js +0 -1
  99. package/lib/chunks/ApplicationTypeTag.CZReMt-9.js +0 -1
  100. package/lib/chunks/AuthSection.CP9c-YTW.js +0 -1
  101. package/lib/chunks/AvailableRangePreview.DvREyHNH.js +0 -1
  102. package/lib/chunks/AvailableRangeSetting.DDHTOLJA.js +0 -1
  103. package/lib/chunks/CodeView.DeBxLqyC.js +0 -1
  104. package/lib/chunks/CommonTagsList.QEP4G-Em.js +0 -1
  105. package/lib/chunks/CreateMcpForm.B2o0Ghjg.js +0 -1
  106. package/lib/chunks/DocSyncSelect.1gaXRzps.js +0 -2
  107. package/lib/chunks/FileUploader.6IW_QL-h.js +0 -1
  108. package/lib/chunks/McpFormDialog.FwXnBBd2.js +0 -6
  109. package/lib/chunks/McpParamsSet.BYrxVvDL.js +0 -1
  110. package/lib/chunks/MdEditor.Cp24y4DJ.js +0 -1
  111. package/lib/chunks/ParameterTable.CeufAEXh.js +0 -1
  112. package/lib/chunks/PublishRecord.BVndvj7F.js +0 -5
  113. package/lib/chunks/SourcePublish.Bz8MaRPm.js +0 -1
  114. package/lib/chunks/SourcePublish.I7ORXPok.js +0 -1
  115. package/lib/chunks/SourcePublish.OeB6i-Iu.js +0 -1
  116. package/lib/chunks/config.B9Di8LtU.js +0 -1
  117. package/lib/chunks/config.CZl1kYtI.js +0 -1
  118. package/lib/chunks/i18n.BGe5gOau.js +0 -1
@@ -1,2290 +0,0 @@
1
- import { r as e, t } from "./chunk.EU29TkMc.js";
2
- import { t as n } from "./withinstall.dLh4K-0g.js";
3
- import { m as r } from "./i18n.CIhVBbR3.js";
4
- import { t as i } from "./_plugin-vue_export-helper.Ct3qlEzt.js";
5
- import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, guardReactiveProps as f, h as p, markRaw as m, mergeProps as h, nextTick as g, normalizeClass as _, normalizeProps as v, normalizeStyle as y, onMounted as b, onUnmounted as x, openBlock as S, popScopeId as C, pushScopeId as w, ref as T, renderList as E, renderSlot as D, resolveComponent as O, resolveDirective as k, resolveDynamicComponent as A, shallowReactive as j, toDisplayString as M, toHandlers as N, unref as P, useAttrs as ee, watch as F, withCtx as I, withDirectives as L, withModifiers as R, withScopeId as z } from "vue";
6
- import { ElAutoResizer as te, ElCheckbox as ne, ElIcon as B, ElInput as re, ElSegmented as V, ElTreeV2 as ie } from "element-plus";
7
- import { CaretRight as ae, Empty as oe, FeishuLocalUploadDoc as H, FeishuLocalUploadImg as se, FeishuLocalUploadPdf as ce, FeishuLocalUploadPpt as U, FeishuLocalUploadTxt as W, FeishuLocalUploadXlsx as G, IconDelete as K, IconFeishuDoc as le, IconFeishuExcel as ue, IconFeishuKnowledge as de, IconFeishuMulitTable as fe, Seach as pe } from "color-message-aibox-vue";
8
- import { IconEmpty as q } from "color-star-custom-components";
9
- import me from "mitt";
10
- import '../assets/DocSyncSelect.css';//#region components/DocSyncSelect/config.js
11
- var J = {
12
- label: "name",
13
- children: "children",
14
- value: "id"
15
- }, Y = {
16
- FRONTEND: "frontend",
17
- BACKEND: "backend"
18
- }, he = [
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
- ], X = {
34
- MY_FILES: "myFiles",
35
- FEISHU_KNOWLEDGE: "feishuKnowledge"
36
- }, Z = /* @__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 && P(he).includes(e.fileType) ? (S(), s(P(B), {
56
- key: 0,
57
- size: e.size
58
- }, {
59
- default: I(() => [e.isLocalFileType ? (S(), l(a, { key: 0 }, [["xlsx", "xls"].includes(e.fileType) ? (S(), s(P(G), { key: 0 })) : ["doc", "docx"].includes(e.fileType) ? (S(), s(P(H), { key: 1 })) : ["pdf"].includes(e.fileType) ? (S(), s(P(ce), { key: 2 })) : ["pptx", "ppt"].includes(e.fileType) ? (S(), s(P(U), { key: 3 })) : ["txt"].includes(e.fileType) ? (S(), s(P(W), { key: 4 })) : [
60
- "png",
61
- "jpg",
62
- "jpeg"
63
- ].includes(e.fileType) ? (S(), s(P(se), { key: 5 })) : c("", !0)], 64)) : (S(), l(a, { key: 1 }, [["sheet"].includes(e.fileType) ? (S(), s(P(ue), { key: 0 })) : ["bitable"].includes(e.fileType) ? (S(), s(P(fe), { key: 1 })) : ["doc", "docx"].includes(e.fileType) ? (S(), s(P(le), { key: 2 })) : ["wiki"].includes(e.fileType) ? (S(), s(P(de), { key: 3 })) : c("", !0)], 64))]),
64
- _: 1
65
- }, 8, ["size"])) : c("", !0);
66
- }
67
- }), ge = { class: "right-wrap" }, _e = { class: "content" }, ve = {
68
- key: 0,
69
- class: "empty-state"
70
- }, ye = {
71
- key: 1,
72
- class: "selected-list"
73
- }, be = ["onClick"], xe = { class: "item-content" }, Se = { class: "item-main" }, Ce = { class: "doc-icon" }, we = { class: "doc-info" }, Te = { class: "doc-name" }, Ee = {
74
- key: 0,
75
- class: "doc-suffix"
76
- }, De = ["onClick"], Oe = /* @__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: () => J
86
- }
87
- },
88
- emits: ["delete-node"],
89
- setup(e, { emit: t }) {
90
- let n = e, r = t, i = T(-1), s = o(() => n.selectedDocuments.filter((e) => he.includes(e.type))), f = (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) => (S(), l("div", ge, [u("div", _e, [s.value.length === 0 ? (S(), l("div", ve, [d(P(q))])) : (S(), l("div", ye, [(S(!0), l(a, null, E(s.value, (t, n) => (S(), l("div", {
96
- key: t[e.treeProps.value],
97
- class: _(["selected-item", { "is-selected": i.value === n }]),
98
- onClick: (e) => f(n)
99
- }, [u("div", xe, [u("div", Se, [u("div", Ce, [d(Z, {
100
- "file-type": t.type,
101
- size: 26,
102
- isLocalFileType: t?.isLocalFileType
103
- }, null, 8, ["file-type", "isLocalFileType"])]), u("div", we, [u("div", Te, M(t[e.treeProps.label]), 1), t.suffix ? (S(), l("div", Ee, M(t.suffix), 1)) : c("", !0)])]), u("div", {
104
- class: "flex items-center",
105
- onClick: R((e) => p(t), ["stop"])
106
- }, [d(P(B), {
107
- size: 14,
108
- color: "var(--neutral-color-5)"
109
- }, {
110
- default: I(() => [d(P(K))]),
111
- _: 1
112
- })], 8, De)])], 10, be))), 128))]))])]));
113
- }
114
- }), [["__scopeId", "data-v-6736cdb6"]]);
115
- //#endregion
116
- //#region ../../../node_modules/.pnpm/element-tree-line@0.2.1_vue@3.5.27_typescript@5.9.3_/node_modules/element-tree-line/dist/index.es.js
117
- function ke(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 Ae(e) {
210
- let t = ke(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
- Ae();
225
- //#endregion
226
- //#region components/DocSyncSelect/utils.js
227
- var je = /* @__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
- })))()), Me = (e) => e && Array.isArray(e) && e.length === 1 && e[0] && typeof e[0] == "object" && e[0].falseChild === !0, Ne = (e) => !e || !e.children ? !0 : !Me(e.children), Pe = (e, t = 800) => (0, je.default)((t) => {
298
- e("search", { keyword: t });
299
- }, t), Fe = (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 = Fe(r[n.children], t, n);
304
- i.length > 0 && e.push({
305
- ...r,
306
- [n.children]: i
307
- });
308
- }
309
- return e;
310
- }, []), Ie = (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(Ie(e, t));
315
- return n;
316
- }, Le = (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
- }, Re = (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
- }, ze = (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
- }, Be = ({ tabKey: e, currentSelectedDocs: t, hasSelectToRightDocList: n, treeData: r, treeProps: i }) => {
346
- let a = Array.isArray(n) ? n : [], o = i?.value, s = ze((r && Array.isArray(r[e]) ? r[e] : []) || [], i), c = a.filter((e) => !s.has(e?.[o]));
347
- return [...t, ...c];
348
- }, Ve = (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
- }, He = (e, t) => {
363
- if (!e) return !1;
364
- let n = t?.children || "children";
365
- if (Me(e[n])) return !0;
366
- let r = e[n];
367
- if (r && Array.isArray(r)) {
368
- for (let e of r) if (He(e, t)) return !0;
369
- }
370
- return !1;
371
- }, Ue = (e, t) => e === X.MY_FILES ? t?.myFilesHasMore || !1 : e === X.FEISHU_KNOWLEDGE && t?.feishuKnowledgeHasMore || !1, We = { class: "w-full h-full flex flex-col overflow-hidden" }, Ge = /* @__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: () => J
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 = Ae(p), i = e, a = n, f = ee(), m = () => p(ae, { style: {
428
- color: "var(--text-color-2)",
429
- fontSize: "16px"
430
- } }), v = i.isMultiple ? 20 : 10, y = i.isMultiple ? 15 : 11, x = T([]), C = T(null), w = T(null), E = o(() => i.treeProps.value), O = o(() => i.treeProps.label), k = o(() => i.treeProps.children), A = T(!1), j = o(() => !i.isMultiple && A.value), N = o(() => typeof i.apiConfig == "function"), L = () => {
431
- let e = C.value?.getCheckedNodes(), t = e.map((e) => e[E.value]), n = [];
432
- return i.includeParentSelected && (n = Re(x.value, t, E.value)), {
433
- selectedNodeValues: t,
434
- selectedNodes: e,
435
- selectedParentNodes: n
436
- };
437
- }, R = (e, t) => {
438
- V(e, t);
439
- }, z = (e) => {
440
- a("node-expand", e);
441
- }, ne = (e, t) => {
442
- i.isMultiple || (A.value = !0, w.value = t.key, a("handleCheck", {
443
- selectedValue: [w.value],
444
- selectedNode: [t.data]
445
- }));
446
- };
447
- T("");
448
- let B = (e, t) => t[O.value].includes(e), re = o(() => Le(x.value, i.treeProps, i.includeParentSelected));
449
- function V(e = null, t = null) {
450
- let { selectedNodeValues: n, selectedNodes: r, selectedParentNodes: i } = L(), o = null;
451
- if (e && t) {
452
- let n = e[E.value];
453
- o = t.checkedKeys.includes(n);
454
- }
455
- a("handleCheck", {
456
- selectedValue: n,
457
- selectedNode: r,
458
- selectedParentNodes: i,
459
- checkedNode: e,
460
- isChecked: o
461
- });
462
- }
463
- let oe = (e, t) => {
464
- C.value?.setChecked(e, t), V();
465
- }, H = () => {
466
- f["default-checked-keys"] && g(() => {
467
- V();
468
- });
469
- }, se = (e) => {
470
- C.value && (!e || e.length === 0 ? C.value?.setCheckedKeys([]) : C.value?.setCheckedKeys(e));
471
- }, ce = (e, t) => {
472
- let n = (r) => {
473
- for (let i = 0; i < r.length; i++) {
474
- let a = r[i];
475
- if (a[E.value] === e) {
476
- let n = U(t);
477
- return a[k.value] = n, a.isLeaf = !t || t.length === 0, console.log("节点更新后:", {
478
- nodeKey: e,
479
- childrenLength: n.length,
480
- isLeaf: a.isLeaf
481
- }), x.value = [...x.value], !0;
482
- }
483
- if (a[k.value] && a[k.value].length > 0 && n(a[k.value])) return !0;
484
- }
485
- return !1;
486
- };
487
- n(x.value);
488
- }, U = (e) => e?.map((e) => ({
489
- ...e,
490
- [k.value]: e[k.value]?.length ? U(e[k.value]) : void 0
491
- })), W = async () => {
492
- N.value ? i.apiConfig(i.reqParams)?.then((e) => {
493
- x.value = U(e?.data?.orgOptionSoList || e?.data || []), H(), K(i.modelValue), a("initFinish", x.value);
494
- }) : G();
495
- }, G = () => {
496
- x.value = U(i.treeList || []), x.value.length && (H(), K(i.modelValue));
497
- }, K = (e) => {
498
- let t = e && e.length && e.map((e) => e[i.treeProps.value]);
499
- g(() => {
500
- C.value?.setCheckedKeys(t);
501
- });
502
- };
503
- return F(() => i.treeList, () => {
504
- G();
505
- }, { deep: !0 }), F(() => i.modelValue, (e) => {
506
- g(() => {
507
- K(e);
508
- });
509
- }, { deep: !0 }), b(() => {
510
- W();
511
- }), t({
512
- allNodeNumbers: re,
513
- loadData: W,
514
- setNodeCheckStatus: oe,
515
- updateNodeChildren: ce,
516
- syncSelectedNodes: se
517
- }), (t, n) => (S(), l("div", We, [u("div", { class: _([e.hasFilter ? "pd-l-8 pd-r-8" : "", "flex-1 overflow-hidden"]) }, [d(P(te), null, {
518
- default: I(({ width: n, height: i }) => [d(P(ie), h({
519
- ref_key: "treeRef",
520
- ref: C,
521
- height: i,
522
- width: n,
523
- "check-strictly": !0,
524
- data: x.value,
525
- props: e.treeProps,
526
- "node-key": E.value,
527
- "show-checkbox": !0,
528
- "item-size": P(34),
529
- indent: P(v),
530
- "highlight-current": j.value,
531
- icon: m,
532
- "filter-method": B,
533
- lazy: "",
534
- load: e.loadNode
535
- }, P(f), {
536
- onNodeClick: ne,
537
- onCheck: R,
538
- onNodeExpand: z,
539
- class: ["hide-false-child-checkbox"]
540
- }), {
541
- default: I(({ node: n }) => [u("div", { class: _(["tree-node-content", { "false-child-node": n.data?.falseChild }]) }, [D(t.$slots, "node", {
542
- node: n,
543
- data: n.data
544
- }, () => [e.hasTreeLine ? (S(), s(P(r), {
545
- key: 0,
546
- node: n,
547
- treeData: x.value,
548
- showLabelLine: !1,
549
- indent: P(y)
550
- }, null, 8, [
551
- "node",
552
- "treeData",
553
- "indent"
554
- ])) : c("", !0), u("span", null, M(n.data[O.value]), 1)], !0)], 2)]),
555
- empty: I(() => [d(P(q))]),
556
- _: 3
557
- }, 16, [
558
- "height",
559
- "width",
560
- "data",
561
- "props",
562
- "node-key",
563
- "item-size",
564
- "indent",
565
- "highlight-current",
566
- "load"
567
- ])]),
568
- _: 3
569
- })], 2)]));
570
- }
571
- }), [["__scopeId", "data-v-258f00ca"]]);
572
- //#endregion
573
- //#region ../../../node_modules/.pnpm/vue-resize@2.0.0-alpha.1_vue@3.5.27_typescript@5.9.3_/node_modules/vue-resize/dist/vue-resize.esm.js
574
- function Ke() {
575
- var e = window.navigator.userAgent, t = e.indexOf("MSIE ");
576
- if (t > 0) return parseInt(e.substring(t + 5, e.indexOf(".", t)), 10);
577
- if (e.indexOf("Trident/") > 0) {
578
- var n = e.indexOf("rv:");
579
- return parseInt(e.substring(n + 3, e.indexOf(".", n)), 10);
580
- }
581
- var r = e.indexOf("Edge/");
582
- return r > 0 ? parseInt(e.substring(r + 5, e.indexOf(".", r)), 10) : -1;
583
- }
584
- var Q;
585
- function qe() {
586
- qe.init || (qe.init = !0, Q = Ke() !== -1);
587
- }
588
- var $ = {
589
- name: "ResizeObserver",
590
- props: {
591
- emitOnMount: {
592
- type: Boolean,
593
- default: !1
594
- },
595
- ignoreWidth: {
596
- type: Boolean,
597
- default: !1
598
- },
599
- ignoreHeight: {
600
- type: Boolean,
601
- default: !1
602
- }
603
- },
604
- emits: ["notify"],
605
- mounted() {
606
- qe(), g(() => {
607
- this._w = this.$el.offsetWidth, this._h = this.$el.offsetHeight, this.emitOnMount && this.emitSize();
608
- });
609
- let e = document.createElement("object");
610
- this._resizeObject = e, e.setAttribute("aria-hidden", "true"), e.setAttribute("tabindex", -1), e.onload = this.addResizeHandlers, e.type = "text/html", Q && this.$el.appendChild(e), e.data = "about:blank", Q || this.$el.appendChild(e);
611
- },
612
- beforeUnmount() {
613
- this.removeResizeHandlers();
614
- },
615
- methods: {
616
- compareAndNotify() {
617
- (!this.ignoreWidth && this._w !== this.$el.offsetWidth || !this.ignoreHeight && this._h !== this.$el.offsetHeight) && (this._w = this.$el.offsetWidth, this._h = this.$el.offsetHeight, this.emitSize());
618
- },
619
- emitSize() {
620
- this.$emit("notify", {
621
- width: this._w,
622
- height: this._h
623
- });
624
- },
625
- addResizeHandlers() {
626
- this._resizeObject.contentDocument.defaultView.addEventListener("resize", this.compareAndNotify), this.compareAndNotify();
627
- },
628
- removeResizeHandlers() {
629
- this._resizeObject && this._resizeObject.onload && (!Q && this._resizeObject.contentDocument && this._resizeObject.contentDocument.defaultView.removeEventListener("resize", this.compareAndNotify), this.$el.removeChild(this._resizeObject), this._resizeObject.onload = null, this._resizeObject = null);
630
- }
631
- }
632
- }, Je = /* @__PURE__ */ z("data-v-b329ee4c");
633
- w("data-v-b329ee4c");
634
- var Ye = {
635
- class: "resize-observer",
636
- tabindex: "-1"
637
- };
638
- C(), $.render = /* @__PURE__ */ Je((e, t, n, r, i, a) => (S(), s("div", Ye))), $.__scopeId = "data-v-b329ee4c", $.__file = "src/components/ResizeObserver.vue";
639
- //#endregion
640
- //#region ../../../node_modules/.pnpm/vue-observe-visibility@2.0.0-alpha.1_vue@3.5.27_typescript@5.9.3_/node_modules/vue-observe-visibility/dist/vue-observe-visibility.esm.js
641
- function Xe(e) {
642
- "@babel/helpers - typeof";
643
- return Xe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
644
- return typeof e;
645
- } : function(e) {
646
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
647
- }, Xe(e);
648
- }
649
- function Ze(e, t) {
650
- if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
651
- }
652
- function Qe(e, t) {
653
- for (var n = 0; n < t.length; n++) {
654
- var r = t[n];
655
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
656
- }
657
- }
658
- function $e(e, t, n) {
659
- return t && Qe(e.prototype, t), n && Qe(e, n), e;
660
- }
661
- function et(e) {
662
- return tt(e) || nt(e) || rt(e) || at();
663
- }
664
- function tt(e) {
665
- if (Array.isArray(e)) return it(e);
666
- }
667
- function nt(e) {
668
- if (typeof Symbol < "u" && Symbol.iterator in Object(e)) return Array.from(e);
669
- }
670
- function rt(e, t) {
671
- if (e) {
672
- if (typeof e == "string") return it(e, t);
673
- var n = Object.prototype.toString.call(e).slice(8, -1);
674
- if (n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set") return Array.from(e);
675
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return it(e, t);
676
- }
677
- }
678
- function it(e, t) {
679
- (t == null || t > e.length) && (t = e.length);
680
- for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
681
- return r;
682
- }
683
- function at() {
684
- throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
685
- }
686
- function ot(e) {
687
- return typeof e == "function" ? { callback: e } : e;
688
- }
689
- function st(e, t) {
690
- var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r, i, a, o = function(o) {
691
- if (a = [...arguments].slice(1), !(r && o === i)) {
692
- var s = n.leading;
693
- typeof s == "function" && (s = s(o, i)), (!r || o !== i) && s && e.apply(void 0, [o].concat(et(a))), i = o, clearTimeout(r), r = setTimeout(function() {
694
- e.apply(void 0, [o].concat(et(a))), r = 0;
695
- }, t);
696
- }
697
- };
698
- return o._clear = function() {
699
- clearTimeout(r), r = null;
700
- }, o;
701
- }
702
- function ct(e, t) {
703
- if (e === t) return !0;
704
- if (Xe(e) === "object") {
705
- for (var n in e) if (!ct(e[n], t[n])) return !1;
706
- return !0;
707
- }
708
- return !1;
709
- }
710
- var lt = /* @__PURE__ */ function() {
711
- function e(t, n, r) {
712
- Ze(this, e), this.el = t, this.observer = null, this.frozen = !1, this.createObserver(n, r);
713
- }
714
- return $e(e, [
715
- {
716
- key: "createObserver",
717
- value: function(e, t) {
718
- var n = this;
719
- if (this.observer && this.destroyObserver(), !this.frozen) {
720
- if (this.options = ot(e), this.callback = function(e, t) {
721
- n.options.callback(e, t), e && n.options.once && (n.frozen = !0, n.destroyObserver());
722
- }, this.callback && this.options.throttle) {
723
- var r = (this.options.throttleOptions || {}).leading;
724
- this.callback = st(this.callback, this.options.throttle, { leading: function(e) {
725
- return r === "both" || r === "visible" && e || r === "hidden" && !e;
726
- } });
727
- }
728
- this.oldResult = void 0, this.observer = new IntersectionObserver(function(e) {
729
- var t = e[0];
730
- if (e.length > 1) {
731
- var r = e.find(function(e) {
732
- return e.isIntersecting;
733
- });
734
- r && (t = r);
735
- }
736
- if (n.callback) {
737
- var i = t.isIntersecting && t.intersectionRatio >= n.threshold;
738
- if (i === n.oldResult) return;
739
- n.oldResult = i, n.callback(i, t);
740
- }
741
- }, this.options.intersection), g(function() {
742
- n.observer && n.observer.observe(n.el);
743
- });
744
- }
745
- }
746
- },
747
- {
748
- key: "destroyObserver",
749
- value: function() {
750
- this.observer &&= (this.observer.disconnect(), null), this.callback && this.callback._clear && (this.callback._clear(), this.callback = null);
751
- }
752
- },
753
- {
754
- key: "threshold",
755
- get: function() {
756
- return this.options.intersection && typeof this.options.intersection.threshold == "number" ? this.options.intersection.threshold : 0;
757
- }
758
- }
759
- ]), e;
760
- }();
761
- function ut(e, t, n) {
762
- var r = t.value;
763
- r && (typeof IntersectionObserver > "u" ? console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill") : e._vue_visibilityState = new lt(e, r, n));
764
- }
765
- function dt(e, t, n) {
766
- var r = t.value, i = t.oldValue;
767
- if (!ct(r, i)) {
768
- var a = e._vue_visibilityState;
769
- if (!r) {
770
- ft(e);
771
- return;
772
- }
773
- a ? a.createObserver(r, n) : ut(e, { value: r }, n);
774
- }
775
- }
776
- function ft(e) {
777
- var t = e._vue_visibilityState;
778
- t && (t.destroyObserver(), delete e._vue_visibilityState);
779
- }
780
- var pt = {
781
- beforeMount: ut,
782
- updated: dt,
783
- unmounted: ft
784
- }, mt = { itemsLimit: 1e3 }, ht = /(auto|scroll)/;
785
- function gt(e, t) {
786
- return e.parentNode === null ? t : gt(e.parentNode, t.concat([e]));
787
- }
788
- var _t = function(e, t) {
789
- return getComputedStyle(e, null).getPropertyValue(t);
790
- }, vt = function(e) {
791
- return _t(e, "overflow") + _t(e, "overflow-y") + _t(e, "overflow-x");
792
- }, yt = function(e) {
793
- return ht.test(vt(e));
794
- };
795
- function bt(e) {
796
- if (e instanceof HTMLElement || e instanceof SVGElement) {
797
- for (var t = gt(e.parentNode, []), n = 0; n < t.length; n += 1) if (yt(t[n])) return t[n];
798
- return document.scrollingElement || document.documentElement;
799
- }
800
- }
801
- function xt(e) {
802
- "@babel/helpers - typeof";
803
- return xt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
804
- return typeof e;
805
- } : function(e) {
806
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
807
- }, xt(e);
808
- }
809
- var St = {
810
- items: {
811
- type: Array,
812
- required: !0
813
- },
814
- keyField: {
815
- type: String,
816
- default: "id"
817
- },
818
- direction: {
819
- type: String,
820
- default: "vertical",
821
- validator: function(e) {
822
- return ["vertical", "horizontal"].includes(e);
823
- }
824
- },
825
- listTag: {
826
- type: String,
827
- default: "div"
828
- },
829
- itemTag: {
830
- type: String,
831
- default: "div"
832
- }
833
- };
834
- function Ct() {
835
- return this.items.length && xt(this.items[0]) !== "object";
836
- }
837
- var wt = !1;
838
- if (typeof window < "u") {
839
- wt = !1;
840
- try {
841
- var Tt = Object.defineProperty({}, "passive", { get: function() {
842
- wt = !0;
843
- } });
844
- window.addEventListener("test", null, Tt);
845
- } catch {}
846
- }
847
- var Et = 0, Dt = {
848
- name: "RecycleScroller",
849
- components: { ResizeObserver: $ },
850
- directives: { ObserveVisibility: pt },
851
- props: {
852
- ...St,
853
- itemSize: {
854
- type: Number,
855
- default: null
856
- },
857
- gridItems: {
858
- type: Number,
859
- default: void 0
860
- },
861
- itemSecondarySize: {
862
- type: Number,
863
- default: void 0
864
- },
865
- minItemSize: {
866
- type: [Number, String],
867
- default: null
868
- },
869
- sizeField: {
870
- type: String,
871
- default: "size"
872
- },
873
- typeField: {
874
- type: String,
875
- default: "type"
876
- },
877
- buffer: {
878
- type: Number,
879
- default: 200
880
- },
881
- pageMode: {
882
- type: Boolean,
883
- default: !1
884
- },
885
- prerender: {
886
- type: Number,
887
- default: 0
888
- },
889
- emitUpdate: {
890
- type: Boolean,
891
- default: !1
892
- },
893
- updateInterval: {
894
- type: Number,
895
- default: 0
896
- },
897
- skipHover: {
898
- type: Boolean,
899
- default: !1
900
- },
901
- listTag: {
902
- type: String,
903
- default: "div"
904
- },
905
- itemTag: {
906
- type: String,
907
- default: "div"
908
- },
909
- listClass: {
910
- type: [
911
- String,
912
- Object,
913
- Array
914
- ],
915
- default: ""
916
- },
917
- itemClass: {
918
- type: [
919
- String,
920
- Object,
921
- Array
922
- ],
923
- default: ""
924
- }
925
- },
926
- emits: [
927
- "resize",
928
- "visible",
929
- "hidden",
930
- "update",
931
- "scroll-start",
932
- "scroll-end"
933
- ],
934
- data() {
935
- return {
936
- pool: [],
937
- totalSize: 0,
938
- ready: !1,
939
- hoverKey: null
940
- };
941
- },
942
- computed: {
943
- sizes() {
944
- if (this.itemSize === null) {
945
- let e = { "-1": { accumulator: 0 } }, t = this.items, n = this.sizeField, r = this.minItemSize, i = 1e4, a = 0, o;
946
- for (let s = 0, c = t.length; s < c; s++) o = t[s][n] || r, o < i && (i = o), a += o, e[s] = {
947
- accumulator: a,
948
- size: o
949
- };
950
- return this.$_computedMinItemSize = i, e;
951
- }
952
- return [];
953
- },
954
- simpleArray: Ct,
955
- itemIndexByKey() {
956
- let { keyField: e, items: t } = this, n = {};
957
- for (let r = 0, i = t.length; r < i; r++) n[t[r][e]] = r;
958
- return n;
959
- }
960
- },
961
- watch: {
962
- items() {
963
- this.updateVisibleItems(!0);
964
- },
965
- pageMode() {
966
- this.applyPageMode(), this.updateVisibleItems(!1);
967
- },
968
- sizes: {
969
- handler() {
970
- this.updateVisibleItems(!1);
971
- },
972
- deep: !0
973
- },
974
- gridItems() {
975
- this.updateVisibleItems(!0);
976
- },
977
- itemSecondarySize() {
978
- this.updateVisibleItems(!0);
979
- }
980
- },
981
- created() {
982
- this.$_startIndex = 0, this.$_endIndex = 0, this.$_views = /* @__PURE__ */ new Map(), this.$_unusedViews = /* @__PURE__ */ new Map(), this.$_scrollDirty = !1, this.$_lastUpdateScrollPosition = 0, this.prerender && (this.$_prerender = !0, this.updateVisibleItems(!1)), this.gridItems && !this.itemSize && console.error("[vue-recycle-scroller] You must provide an itemSize when using gridItems");
983
- },
984
- mounted() {
985
- this.applyPageMode(), this.$nextTick(() => {
986
- this.$_prerender = !1, this.updateVisibleItems(!0), this.ready = !0;
987
- });
988
- },
989
- activated() {
990
- let e = this.$_lastUpdateScrollPosition;
991
- typeof e == "number" && this.$nextTick(() => {
992
- this.scrollToPosition(e);
993
- });
994
- },
995
- beforeUnmount() {
996
- this.removeListeners();
997
- },
998
- methods: {
999
- addView(e, t, n, r, i) {
1000
- let a = j({
1001
- item: n,
1002
- position: 0,
1003
- nr: m({
1004
- id: Et++,
1005
- index: t,
1006
- used: !0,
1007
- key: r,
1008
- type: i
1009
- })
1010
- });
1011
- return e.push(a), a;
1012
- },
1013
- unuseView(e, t = !1) {
1014
- let n = this.$_unusedViews, r = e.nr.type, i = n.get(r);
1015
- i || (i = [], n.set(r, i)), i.push(e), t || (e.nr.used = !1, e.position = -9999);
1016
- },
1017
- handleResize() {
1018
- this.$emit("resize"), this.ready && this.updateVisibleItems(!1);
1019
- },
1020
- handleScroll(e) {
1021
- if (!this.$_scrollDirty) {
1022
- if (this.$_scrollDirty = !0, this.$_updateTimeout) return;
1023
- let e = () => requestAnimationFrame(() => {
1024
- this.$_scrollDirty = !1;
1025
- let { continuous: e } = this.updateVisibleItems(!1, !0);
1026
- e || (clearTimeout(this.$_refreshTimout), this.$_refreshTimout = setTimeout(this.handleScroll, this.updateInterval + 100));
1027
- });
1028
- e(), this.updateInterval && (this.$_updateTimeout = setTimeout(() => {
1029
- this.$_updateTimeout = 0, this.$_scrollDirty && e();
1030
- }, this.updateInterval));
1031
- }
1032
- },
1033
- handleVisibilityChange(e, t) {
1034
- this.ready && (e || t.boundingClientRect.width !== 0 || t.boundingClientRect.height !== 0 ? (this.$emit("visible"), requestAnimationFrame(() => {
1035
- this.updateVisibleItems(!1);
1036
- })) : this.$emit("hidden"));
1037
- },
1038
- updateVisibleItems(e, t = !1) {
1039
- let n = this.itemSize, r = this.gridItems || 1, i = this.itemSecondarySize || n, a = this.$_computedMinItemSize, o = this.typeField, s = this.simpleArray ? null : this.keyField, c = this.items, l = c.length, u = this.sizes, d = this.$_views, f = this.$_unusedViews, p = this.pool, m = this.itemIndexByKey, h, g, _, v, y;
1040
- if (!l) h = g = v = y = _ = 0;
1041
- else if (this.$_prerender) h = v = 0, g = y = Math.min(this.prerender, c.length), _ = null;
1042
- else {
1043
- let e = this.getScroll();
1044
- if (t) {
1045
- let t = e.start - this.$_lastUpdateScrollPosition;
1046
- if (t < 0 && (t = -t), n === null && t < a || t < n) return { continuous: !0 };
1047
- }
1048
- this.$_lastUpdateScrollPosition = e.start;
1049
- let i = this.buffer;
1050
- e.start -= i, e.end += i;
1051
- let o = 0;
1052
- if (this.$refs.before && (o = this.$refs.before.scrollHeight, e.start -= o), this.$refs.after) {
1053
- let t = this.$refs.after.scrollHeight;
1054
- e.end += t;
1055
- }
1056
- if (n === null) {
1057
- let t, n = 0, r = l - 1, i = ~~(l / 2), a;
1058
- do
1059
- a = i, t = u[i].accumulator, t < e.start ? n = i : i < l - 1 && u[i + 1].accumulator > e.start && (r = i), i = ~~((n + r) / 2);
1060
- while (i !== a);
1061
- for (i < 0 && (i = 0), h = i, _ = u[l - 1].accumulator, g = i; g < l && u[g].accumulator < e.end; g++);
1062
- for (g === -1 ? g = c.length - 1 : (g++, g > l && (g = l)), v = h; v < l && o + u[v].accumulator < e.start; v++);
1063
- for (y = v; y < l && o + u[y].accumulator < e.end; y++);
1064
- } else {
1065
- h = ~~(e.start / n * r);
1066
- let t = h % r;
1067
- h -= t, g = Math.ceil(e.end / n * r), v = Math.max(0, Math.floor((e.start - o) / n * r)), y = Math.floor((e.end - o) / n * r), h < 0 && (h = 0), g > l && (g = l), v < 0 && (v = 0), y > l && (y = l), _ = Math.ceil(l / r) * n;
1068
- }
1069
- }
1070
- g - h > mt.itemsLimit && this.itemsLimitError(), this.totalSize = _;
1071
- let b, x = h <= this.$_endIndex && g >= this.$_startIndex;
1072
- if (x) for (let t = 0, n = p.length; t < n; t++) b = p[t], b.nr.used && (e && (b.nr.index = m[b.item[s]]), (b.nr.index == null || b.nr.index < h || b.nr.index >= g) && this.unuseView(b));
1073
- let S = x ? null : /* @__PURE__ */ new Map(), C, w, T;
1074
- for (let e = h; e < g; e++) {
1075
- C = c[e];
1076
- let t = s ? C[s] : C;
1077
- if (t == null) throw Error(`Key is ${t} on item (keyField is '${s}')`);
1078
- if (b = d.get(t), !n && !u[e].size) {
1079
- b && this.unuseView(b);
1080
- continue;
1081
- }
1082
- w = C[o];
1083
- let a = f.get(w), l = !1;
1084
- if (!b) x ? b = a && a.length ? a.pop() : this.addView(p, e, C, t, w) : (T = S.get(w) || 0, (!a || T >= a.length) && (b = this.addView(p, e, C, t, w), this.unuseView(b, !0), a = f.get(w)), b = a[T], S.set(w, T + 1)), d.delete(b.nr.key), b.nr.used = !0, b.nr.index = e, b.nr.key = t, b.nr.type = w, d.set(t, b), l = !0;
1085
- else if (!b.nr.used && (b.nr.used = !0, l = !0, a)) {
1086
- let e = a.indexOf(b);
1087
- e !== -1 && a.splice(e, 1);
1088
- }
1089
- b.item = C, l && (e === c.length - 1 && this.$emit("scroll-end"), e === 0 && this.$emit("scroll-start")), n === null ? (b.position = u[e - 1].accumulator, b.offset = 0) : (b.position = Math.floor(e / r) * n, b.offset = e % r * i);
1090
- }
1091
- return this.$_startIndex = h, this.$_endIndex = g, this.emitUpdate && this.$emit("update", h, g, v, y), clearTimeout(this.$_sortTimer), this.$_sortTimer = setTimeout(this.sortViews, this.updateInterval + 300), { continuous: x };
1092
- },
1093
- getListenerTarget() {
1094
- let e = bt(this.$el);
1095
- return window.document && (e === window.document.documentElement || e === window.document.body) && (e = window), e;
1096
- },
1097
- getScroll() {
1098
- let { $el: e, direction: t } = this, n = t === "vertical", r;
1099
- if (this.pageMode) {
1100
- let t = e.getBoundingClientRect(), i = n ? t.height : t.width, a = -(n ? t.top : t.left), o = n ? window.innerHeight : window.innerWidth;
1101
- a < 0 && (o += a, a = 0), a + o > i && (o = i - a), r = {
1102
- start: a,
1103
- end: a + o
1104
- };
1105
- } else r = n ? {
1106
- start: e.scrollTop,
1107
- end: e.scrollTop + e.clientHeight
1108
- } : {
1109
- start: e.scrollLeft,
1110
- end: e.scrollLeft + e.clientWidth
1111
- };
1112
- return r;
1113
- },
1114
- applyPageMode() {
1115
- this.pageMode ? this.addListeners() : this.removeListeners();
1116
- },
1117
- addListeners() {
1118
- this.listenerTarget = this.getListenerTarget(), this.listenerTarget.addEventListener("scroll", this.handleScroll, wt ? { passive: !0 } : !1), this.listenerTarget.addEventListener("resize", this.handleResize);
1119
- },
1120
- removeListeners() {
1121
- this.listenerTarget &&= (this.listenerTarget.removeEventListener("scroll", this.handleScroll), this.listenerTarget.removeEventListener("resize", this.handleResize), null);
1122
- },
1123
- scrollToItem(e) {
1124
- let t, n = this.gridItems || 1;
1125
- t = this.itemSize === null ? e > 0 ? this.sizes[e - 1].accumulator : 0 : Math.floor(e / n) * this.itemSize, this.scrollToPosition(t);
1126
- },
1127
- scrollToPosition(e) {
1128
- let t = this.direction === "vertical" ? {
1129
- scroll: "scrollTop",
1130
- start: "top"
1131
- } : {
1132
- scroll: "scrollLeft",
1133
- start: "left"
1134
- }, n, r, i;
1135
- if (this.pageMode) {
1136
- let a = bt(this.$el), o = a.tagName === "HTML" ? 0 : a[t.scroll], s = a.getBoundingClientRect(), c = this.$el.getBoundingClientRect()[t.start] - s[t.start];
1137
- n = a, r = t.scroll, i = e + o + c;
1138
- } else n = this.$el, r = t.scroll, i = e;
1139
- n[r] = i;
1140
- },
1141
- itemsLimitError() {
1142
- throw setTimeout(() => {
1143
- console.log("It seems the scroller element isn't scrolling, so it tries to render all the items at once.", "Scroller:", this.$el), console.log("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.");
1144
- }), Error("Rendered items limit reached");
1145
- },
1146
- sortViews() {
1147
- this.pool.sort((e, t) => e.nr.index - t.nr.index);
1148
- }
1149
- }
1150
- }, Ot = {
1151
- key: 0,
1152
- ref: "before",
1153
- class: "vue-recycle-scroller__slot"
1154
- }, kt = {
1155
- key: 1,
1156
- ref: "after",
1157
- class: "vue-recycle-scroller__slot"
1158
- };
1159
- function At(e, t, n, r, i, o) {
1160
- let u = O("ResizeObserver"), f = k("observe-visibility");
1161
- return L((S(), l("div", {
1162
- class: _(["vue-recycle-scroller", {
1163
- ready: i.ready,
1164
- "page-mode": n.pageMode,
1165
- [`direction-${e.direction}`]: !0
1166
- }]),
1167
- onScrollPassive: t[0] ||= (...e) => o.handleScroll && o.handleScroll(...e)
1168
- }, [
1169
- e.$slots.before ? (S(), l("div", Ot, [D(e.$slots, "before")], 512)) : c("v-if", !0),
1170
- (S(), s(A(n.listTag), {
1171
- ref: "wrapper",
1172
- style: y({ [e.direction === "vertical" ? "minHeight" : "minWidth"]: i.totalSize + "px" }),
1173
- class: _(["vue-recycle-scroller__item-wrapper", n.listClass])
1174
- }, {
1175
- default: I(() => [(S(!0), l(a, null, E(i.pool, (t) => (S(), s(A(n.itemTag), h({
1176
- key: t.nr.id,
1177
- style: i.ready ? {
1178
- transform: `translate${e.direction === "vertical" ? "Y" : "X"}(${t.position}px) translate${e.direction === "vertical" ? "X" : "Y"}(${t.offset}px)`,
1179
- width: n.gridItems ? `${e.direction === "vertical" && n.itemSecondarySize || n.itemSize}px` : void 0,
1180
- height: n.gridItems ? `${e.direction === "horizontal" && n.itemSecondarySize || n.itemSize}px` : void 0
1181
- } : null,
1182
- class: ["vue-recycle-scroller__item-view", [n.itemClass, { hover: !n.skipHover && i.hoverKey === t.nr.key }]]
1183
- }, N(n.skipHover ? {} : {
1184
- mouseenter: () => {
1185
- i.hoverKey = t.nr.key;
1186
- },
1187
- mouseleave: () => {
1188
- i.hoverKey = null;
1189
- }
1190
- })), {
1191
- default: I(() => [D(e.$slots, "default", {
1192
- item: t.item,
1193
- index: t.nr.index,
1194
- active: t.nr.used
1195
- })]),
1196
- _: 2
1197
- }, 1040, ["style", "class"]))), 128)), D(e.$slots, "empty")]),
1198
- _: 3
1199
- }, 8, ["style", "class"])),
1200
- e.$slots.after ? (S(), l("div", kt, [D(e.$slots, "after")], 512)) : c("v-if", !0),
1201
- d(u, { onNotify: o.handleResize }, null, 8, ["onNotify"])
1202
- ], 34)), [[f, o.handleVisibilityChange]]);
1203
- }
1204
- Dt.render = At, Dt.__file = "src/components/RecycleScroller.vue";
1205
- var jt = {
1206
- name: "DynamicScroller",
1207
- components: { RecycleScroller: Dt },
1208
- provide() {
1209
- return typeof ResizeObserver < "u" && (this.$_resizeObserver = new ResizeObserver((e) => {
1210
- requestAnimationFrame(() => {
1211
- if (Array.isArray(e)) {
1212
- for (let t of e) if (t.target && t.target.$_vs_onResize) {
1213
- let e, n;
1214
- if (t.borderBoxSize) {
1215
- let r = t.borderBoxSize[0];
1216
- e = r.inlineSize, n = r.blockSize;
1217
- } else e = t.contentRect.width, n = t.contentRect.height;
1218
- t.target.$_vs_onResize(t.target.$_vs_id, e, n);
1219
- }
1220
- }
1221
- });
1222
- })), {
1223
- vscrollData: this.vscrollData,
1224
- vscrollParent: this,
1225
- vscrollResizeObserver: this.$_resizeObserver
1226
- };
1227
- },
1228
- inheritAttrs: !1,
1229
- props: {
1230
- ...St,
1231
- minItemSize: {
1232
- type: [Number, String],
1233
- required: !0
1234
- }
1235
- },
1236
- emits: ["resize", "visible"],
1237
- data() {
1238
- return { vscrollData: {
1239
- active: !0,
1240
- sizes: {},
1241
- keyField: this.keyField,
1242
- simpleArray: !1
1243
- } };
1244
- },
1245
- computed: {
1246
- simpleArray: Ct,
1247
- itemsWithSize() {
1248
- let e = [], { items: t, keyField: n, simpleArray: r } = this, i = this.vscrollData.sizes, a = t.length;
1249
- for (let o = 0; o < a; o++) {
1250
- let a = t[o], s = r ? o : a[n], c = i[s];
1251
- c === void 0 && !this.$_undefinedMap[s] && (c = 0), e.push({
1252
- item: a,
1253
- id: s,
1254
- size: c
1255
- });
1256
- }
1257
- return e;
1258
- }
1259
- },
1260
- watch: {
1261
- items() {
1262
- this.forceUpdate();
1263
- },
1264
- simpleArray: {
1265
- handler(e) {
1266
- this.vscrollData.simpleArray = e;
1267
- },
1268
- immediate: !0
1269
- },
1270
- direction(e) {
1271
- this.forceUpdate(!0);
1272
- },
1273
- itemsWithSize(e, t) {
1274
- let n = this.$el.scrollTop, r = 0, i = 0, a = Math.min(e.length, t.length);
1275
- for (let o = 0; o < a && !(r >= n); o++) r += t[o].size || this.minItemSize, i += e[o].size || this.minItemSize;
1276
- let o = i - r;
1277
- o !== 0 && (this.$el.scrollTop += o);
1278
- }
1279
- },
1280
- beforeCreate() {
1281
- this.$_updates = [], this.$_undefinedSizes = 0, this.$_undefinedMap = {}, this.$_events = me();
1282
- },
1283
- activated() {
1284
- this.vscrollData.active = !0;
1285
- },
1286
- deactivated() {
1287
- this.vscrollData.active = !1;
1288
- },
1289
- unmounted() {
1290
- this.$_events.all.clear();
1291
- },
1292
- methods: {
1293
- onScrollerResize() {
1294
- this.$refs.scroller && this.forceUpdate(), this.$emit("resize");
1295
- },
1296
- onScrollerVisible() {
1297
- this.$_events.emit("vscroll:update", { force: !1 }), this.$emit("visible");
1298
- },
1299
- forceUpdate(e = !1) {
1300
- (e || this.simpleArray) && (this.vscrollData.sizes = {}), this.$_events.emit("vscroll:update", { force: !0 });
1301
- },
1302
- scrollToItem(e) {
1303
- let t = this.$refs.scroller;
1304
- t && t.scrollToItem(e);
1305
- },
1306
- getItemSize(e, t = void 0) {
1307
- let n = this.simpleArray ? t ?? this.items.indexOf(e) : e[this.keyField];
1308
- return this.vscrollData.sizes[n] || 0;
1309
- },
1310
- scrollToBottom() {
1311
- if (this.$_scrollingToBottom) return;
1312
- this.$_scrollingToBottom = !0;
1313
- let e = this.$el;
1314
- this.$nextTick(() => {
1315
- e.scrollTop = e.scrollHeight + 5e3;
1316
- let t = () => {
1317
- e.scrollTop = e.scrollHeight + 5e3, requestAnimationFrame(() => {
1318
- e.scrollTop = e.scrollHeight + 5e3, this.$_undefinedSizes === 0 ? this.$_scrollingToBottom = !1 : requestAnimationFrame(t);
1319
- });
1320
- };
1321
- requestAnimationFrame(t);
1322
- });
1323
- }
1324
- }
1325
- };
1326
- function Mt(e, t, n, r, i, a) {
1327
- let o = O("RecycleScroller");
1328
- return S(), s(o, h({
1329
- ref: "scroller",
1330
- items: a.itemsWithSize,
1331
- "min-item-size": n.minItemSize,
1332
- direction: e.direction,
1333
- "key-field": "id",
1334
- "list-tag": e.listTag,
1335
- "item-tag": e.itemTag
1336
- }, e.$attrs, {
1337
- onResize: a.onScrollerResize,
1338
- onVisible: a.onScrollerVisible
1339
- }), {
1340
- default: I(({ item: t, index: n, active: r }) => [D(e.$slots, "default", v(f({
1341
- item: t.item,
1342
- index: n,
1343
- active: r,
1344
- itemWithSize: t
1345
- })))]),
1346
- before: I(() => [D(e.$slots, "before")]),
1347
- after: I(() => [D(e.$slots, "after")]),
1348
- empty: I(() => [D(e.$slots, "empty")]),
1349
- _: 3
1350
- }, 16, [
1351
- "items",
1352
- "min-item-size",
1353
- "direction",
1354
- "list-tag",
1355
- "item-tag",
1356
- "onResize",
1357
- "onVisible"
1358
- ]);
1359
- }
1360
- jt.render = Mt, jt.__file = "src/components/DynamicScroller.vue";
1361
- var Nt = {
1362
- name: "DynamicScrollerItem",
1363
- inject: [
1364
- "vscrollData",
1365
- "vscrollParent",
1366
- "vscrollResizeObserver"
1367
- ],
1368
- props: {
1369
- item: { required: !0 },
1370
- watchData: {
1371
- type: Boolean,
1372
- default: !1
1373
- },
1374
- active: {
1375
- type: Boolean,
1376
- required: !0
1377
- },
1378
- index: {
1379
- type: Number,
1380
- default: void 0
1381
- },
1382
- sizeDependencies: {
1383
- type: [Array, Object],
1384
- default: null
1385
- },
1386
- emitResize: {
1387
- type: Boolean,
1388
- default: !1
1389
- },
1390
- tag: {
1391
- type: String,
1392
- default: "div"
1393
- }
1394
- },
1395
- emits: ["resize"],
1396
- computed: {
1397
- id() {
1398
- if (this.vscrollData.simpleArray) return this.index;
1399
- if (this.vscrollData.keyField in this.item) return this.item[this.vscrollData.keyField];
1400
- throw Error(`keyField '${this.vscrollData.keyField}' not found in your item. You should set a valid keyField prop on your Scroller`);
1401
- },
1402
- size() {
1403
- return this.vscrollData.sizes[this.id] || 0;
1404
- },
1405
- finalActive() {
1406
- return this.active && this.vscrollData.active;
1407
- }
1408
- },
1409
- watch: {
1410
- watchData: "updateWatchData",
1411
- id(e, t) {
1412
- if (this.$el.$_vs_id = this.id, this.size || this.onDataUpdate(), this.$_sizeObserved) {
1413
- let n = this.vscrollData.sizes[t], r = this.vscrollData.sizes[e];
1414
- n != null && n !== r && this.applySize(n);
1415
- }
1416
- },
1417
- finalActive(e) {
1418
- this.size || (e ? this.vscrollParent.$_undefinedMap[this.id] || (this.vscrollParent.$_undefinedSizes++, this.vscrollParent.$_undefinedMap[this.id] = !0) : this.vscrollParent.$_undefinedMap[this.id] && (this.vscrollParent.$_undefinedSizes--, this.vscrollParent.$_undefinedMap[this.id] = !1)), this.vscrollResizeObserver ? e ? this.observeSize() : this.unobserveSize() : e && this.$_pendingVScrollUpdate === this.id && this.updateSize();
1419
- }
1420
- },
1421
- created() {
1422
- if (!this.$isServer && (this.$_forceNextVScrollUpdate = null, this.updateWatchData(), !this.vscrollResizeObserver)) {
1423
- for (let e in this.sizeDependencies) this.$watch(() => this.sizeDependencies[e], this.onDataUpdate);
1424
- this.vscrollParent.$_events.on("vscroll:update", this.onVscrollUpdate);
1425
- }
1426
- },
1427
- mounted() {
1428
- this.finalActive && (this.updateSize(), this.observeSize());
1429
- },
1430
- beforeUnmount() {
1431
- this.vscrollParent.$_events.off("vscroll:update", this.onVscrollUpdate), this.unobserveSize();
1432
- },
1433
- methods: {
1434
- updateSize() {
1435
- this.finalActive ? this.$_pendingSizeUpdate !== this.id && (this.$_pendingSizeUpdate = this.id, this.$_forceNextVScrollUpdate = null, this.$_pendingVScrollUpdate = null, this.computeSize(this.id)) : this.$_forceNextVScrollUpdate = this.id;
1436
- },
1437
- updateWatchData() {
1438
- this.watchData && !this.vscrollResizeObserver ? this.$_watchData = this.$watch("item", () => {
1439
- this.onDataUpdate();
1440
- }, { deep: !0 }) : this.$_watchData &&= (this.$_watchData(), null);
1441
- },
1442
- onVscrollUpdate({ force: e }) {
1443
- !this.finalActive && e && (this.$_pendingVScrollUpdate = this.id), (this.$_forceNextVScrollUpdate === this.id || e || !this.size) && this.updateSize();
1444
- },
1445
- onDataUpdate() {
1446
- this.updateSize();
1447
- },
1448
- computeSize(e) {
1449
- this.$nextTick(() => {
1450
- if (this.id === e) {
1451
- let e = this.$el.offsetWidth, t = this.$el.offsetHeight;
1452
- this.applyWidthHeight(e, t);
1453
- }
1454
- this.$_pendingSizeUpdate = null;
1455
- });
1456
- },
1457
- applyWidthHeight(e, t) {
1458
- let n = ~~(this.vscrollParent.direction === "vertical" ? t : e);
1459
- n && this.size !== n && this.applySize(n);
1460
- },
1461
- applySize(e) {
1462
- this.vscrollParent.$_undefinedMap[this.id] && (this.vscrollParent.$_undefinedSizes--, this.vscrollParent.$_undefinedMap[this.id] = void 0), this.vscrollData.sizes[this.id] = e, this.emitResize && this.$emit("resize", this.id);
1463
- },
1464
- observeSize() {
1465
- this.vscrollResizeObserver && (this.$_sizeObserved ||= (this.vscrollResizeObserver.observe(this.$el), this.$el.$_vs_id = this.id, this.$el.$_vs_onResize = this.onResize, !0));
1466
- },
1467
- unobserveSize() {
1468
- this.vscrollResizeObserver && (this.$_sizeObserved &&= (this.vscrollResizeObserver.unobserve(this.$el), this.$el.$_vs_onResize = void 0, !1));
1469
- },
1470
- onResize(e, t, n) {
1471
- this.id === e && this.applyWidthHeight(t, n);
1472
- }
1473
- },
1474
- render() {
1475
- return p(this.tag, this.$slots.default());
1476
- }
1477
- };
1478
- Nt.__file = "src/components/DynamicScrollerItem.vue";
1479
- //#endregion
1480
- //#region components/DocSyncSelect/SearchWrap/ScrollList.vue
1481
- var Pt = {
1482
- key: 0,
1483
- class: "loading-indicator"
1484
- }, Ft = { class: "loading-text" }, It = {
1485
- key: 1,
1486
- class: "no-more-tip"
1487
- }, Lt = {
1488
- key: 1,
1489
- class: "empty-state"
1490
- }, Rt = { class: "empty-text" }, zt = /* @__PURE__ */ i({
1491
- __name: "ScrollList",
1492
- props: {
1493
- items: {
1494
- type: Array,
1495
- default: () => []
1496
- },
1497
- loading: {
1498
- type: Boolean,
1499
- default: !1
1500
- },
1501
- hasMore: {
1502
- type: Boolean,
1503
- default: !0
1504
- },
1505
- loadingText: {
1506
- type: String,
1507
- default: "加载中..."
1508
- },
1509
- noMoreText: {
1510
- type: String,
1511
- default: "没有更多了"
1512
- },
1513
- emptyText: {
1514
- type: String,
1515
- default: "暂无数据"
1516
- },
1517
- height: {
1518
- type: String,
1519
- default: "auto"
1520
- },
1521
- minItemSize: {
1522
- type: Number,
1523
- default: 60
1524
- },
1525
- buffer: {
1526
- type: Number,
1527
- default: 200
1528
- },
1529
- threshold: {
1530
- type: Number,
1531
- default: 100
1532
- },
1533
- keyField: {
1534
- type: String,
1535
- default: "id"
1536
- }
1537
- },
1538
- emits: ["load-more", "scroll"],
1539
- setup(e, { expose: t, emit: n }) {
1540
- let r = e, i = n, a = T(null), f = T(null), p = T(!1), m = null, h = o(() => ({ height: r.height })), _ = () => {
1541
- console.log("loadMore triggered----", p.value || !r.hasMore || r.loading), !(p.value || !r.hasMore || r.loading) && (p.value = !0, i("load-more"));
1542
- }, v = () => {
1543
- p.value = !1, C();
1544
- }, C = () => {
1545
- a.value && a.value.scrollToPosition(0);
1546
- }, w = () => {
1547
- if (a.value) {
1548
- let e = a.value.$el;
1549
- e && (e.scrollTop = e.scrollHeight);
1550
- }
1551
- }, E = (e) => {
1552
- a.value && a.value.scrollToItem(e);
1553
- }, k = () => {
1554
- if (!f.value || !a.value) return;
1555
- let e = a.value.$el;
1556
- if (!e) return;
1557
- let t = {
1558
- root: e,
1559
- rootMargin: `${r.threshold}px`,
1560
- threshold: .1
1561
- };
1562
- m = new IntersectionObserver((e) => {
1563
- e.forEach((e) => {
1564
- console.log("Setting up Intersection Observer-----", e.isIntersecting, r.hasMore, !p.value, !r.loading), e.isIntersecting && r.hasMore && !p.value && !r.loading && _();
1565
- });
1566
- }, t), m.observe(f.value);
1567
- }, A = () => {
1568
- m &&= (m.disconnect(), null);
1569
- }, j = (e) => {
1570
- let t = e.target;
1571
- i("scroll", {
1572
- scrollTop: t.scrollTop,
1573
- scrollHeight: t.scrollHeight,
1574
- clientHeight: t.clientHeight
1575
- });
1576
- };
1577
- return F(() => r.loading, (e) => {
1578
- e || (p.value = !1);
1579
- }), F(() => r.items.length, async () => {
1580
- await g(), A(), r.hasMore && k();
1581
- }), b(async () => {
1582
- await g(), r.hasMore && k();
1583
- }), x(() => {
1584
- A();
1585
- }), t({
1586
- reset: v,
1587
- scrollToTop: C,
1588
- scrollToBottom: w,
1589
- scrollToItem: E,
1590
- loadMore: _
1591
- }), (t, n) => {
1592
- let r = O("Loading");
1593
- return S(), l("div", {
1594
- class: "scroll-list",
1595
- style: y(h.value)
1596
- }, [e.items.length > 0 ? (S(), s(P(jt), {
1597
- key: 0,
1598
- ref_key: "scrollerRef",
1599
- ref: a,
1600
- items: e.items,
1601
- "min-item-size": e.minItemSize,
1602
- buffer: e.buffer,
1603
- "key-field": e.keyField,
1604
- class: "scroller",
1605
- onScroll: j
1606
- }, {
1607
- default: I(({ item: e, index: n, active: r }) => [d(P(Nt), {
1608
- item: e,
1609
- active: r,
1610
- "data-index": n,
1611
- "size-dependencies": [e]
1612
- }, {
1613
- default: I(() => [D(t.$slots, "default", {
1614
- item: e,
1615
- index: n,
1616
- active: r
1617
- }, void 0, !0)]),
1618
- _: 2
1619
- }, 1032, [
1620
- "item",
1621
- "active",
1622
- "data-index",
1623
- "size-dependencies"
1624
- ])]),
1625
- after: I(() => [e.hasMore ? (S(), l("div", {
1626
- key: 0,
1627
- ref_key: "loadMoreTriggerRef",
1628
- ref: f,
1629
- class: "load-more-trigger"
1630
- }, [p.value ? (S(), l("div", Pt, [d(P(B), { class: "is-loading" }, {
1631
- default: I(() => [d(r)]),
1632
- _: 1
1633
- }), u("span", Ft, M(e.loadingText), 1)])) : c("", !0)], 512)) : c("", !0), !e.hasMore && e.items.length > 0 ? (S(), l("div", It, M(e.noMoreText), 1)) : c("", !0)]),
1634
- _: 3
1635
- }, 8, [
1636
- "items",
1637
- "min-item-size",
1638
- "buffer",
1639
- "key-field"
1640
- ])) : c("", !0), e.items.length === 0 && !p.value ? (S(), l("div", Lt, [D(t.$slots, "empty", {}, () => [d(P(B), {
1641
- class: "empty-icon",
1642
- size: 80
1643
- }, {
1644
- default: I(() => [d(P(oe))]),
1645
- _: 1
1646
- }), u("div", Rt, M(e.emptyText), 1)], !0)])) : c("", !0)], 4);
1647
- };
1648
- }
1649
- }, [["__scopeId", "data-v-37e01654"]]), Bt = { class: "search-wrap" }, Vt = { class: "list-item" }, Ht = ["onClick"], Ut = { class: "node-info" }, Wt = { class: "node-label" }, Gt = {
1650
- key: 0,
1651
- class: "node-suffix"
1652
- }, Kt = /* @__PURE__ */ i({
1653
- __name: "index",
1654
- props: {
1655
- items: {
1656
- type: Array,
1657
- default: () => []
1658
- },
1659
- loading: {
1660
- type: Boolean,
1661
- default: !1
1662
- },
1663
- hasMore: {
1664
- type: Boolean,
1665
- default: !1
1666
- },
1667
- height: {
1668
- type: String,
1669
- default: "100%"
1670
- },
1671
- minItemSize: {
1672
- type: Number,
1673
- default: 50
1674
- },
1675
- buffer: {
1676
- type: Number,
1677
- default: 100
1678
- },
1679
- treeProps: {
1680
- type: Object,
1681
- default: () => ({
1682
- label: "label",
1683
- value: "value"
1684
- })
1685
- },
1686
- selectedDocuments: {
1687
- type: Array,
1688
- default: () => []
1689
- }
1690
- },
1691
- emits: ["load-more", "item-check"],
1692
- setup(e, { emit: t }) {
1693
- let { t: n } = r(), i = e, a = o(() => i.items.map((e) => {
1694
- let t = (i.selectedDocuments || []).some((t) => t.id === e.id);
1695
- return {
1696
- ...e,
1697
- isSelected: t
1698
- };
1699
- })), s = t, f = (e, t) => {
1700
- s("item-check", e, t);
1701
- }, p = () => {
1702
- s("load-more");
1703
- };
1704
- return (t, r) => (S(), l("div", Bt, [d(zt, {
1705
- items: a.value,
1706
- loading: e.loading,
1707
- "key-field": "id",
1708
- "has-more": e.hasMore,
1709
- "loading-text": P(n)("FEISHU_SEARCH_TEXT.LOADING_TEXT"),
1710
- "no-more-text": P(n)("FEISHU_SEARCH_TEXT.NO_MORE_TEXT"),
1711
- "empty-text": P(n)("FEISHU_SEARCH_TEXT.EMPTY_TEXT"),
1712
- height: e.height,
1713
- "min-item-size": e.minItemSize,
1714
- buffer: e.buffer,
1715
- onLoadMore: p
1716
- }, {
1717
- default: I(({ item: n }) => [u("div", Vt, [D(t.$slots, "default", { item: n }, () => [u("div", {
1718
- class: "search-item",
1719
- onClick: () => f(n, !n.isSelected)
1720
- }, [
1721
- d(P(ne), { "model-value": n.isSelected }, null, 8, ["model-value"]),
1722
- d(Z, {
1723
- "file-type": n.type,
1724
- size: 26,
1725
- isLocalFileType: t.data?.isLocalFileType
1726
- }, null, 8, ["file-type", "isLocalFileType"]),
1727
- u("div", Ut, [u("span", Wt, M(n[e.treeProps.label]), 1), n.suffix ? (S(), l("span", Gt, M(n.suffix), 1)) : c("", !0)])
1728
- ], 8, Ht)], !0)])]),
1729
- _: 3
1730
- }, 8, [
1731
- "items",
1732
- "loading",
1733
- "has-more",
1734
- "loading-text",
1735
- "no-more-text",
1736
- "empty-text",
1737
- "height",
1738
- "min-item-size",
1739
- "buffer"
1740
- ])]));
1741
- }
1742
- }, [["__scopeId", "data-v-9b7f5847"]]), qt = { class: "left-wrap" }, Jt = { class: "content" }, Yt = { class: "input-wrap" }, Xt = { class: "tree-container" }, Zt = { class: "tree-node-content" }, Qt = { class: "node-info" }, $t = { class: "node-label" }, en = {
1743
- key: 0,
1744
- class: "node-suffix"
1745
- }, tn = 15, nn = /* @__PURE__ */ i(/* @__PURE__ */ Object.assign({ name: "LeftLayout" }, {
1746
- __name: "LeftLayout",
1747
- props: {
1748
- tabs: {
1749
- type: Array,
1750
- default: () => []
1751
- },
1752
- treeData: {
1753
- type: Object,
1754
- default: () => ({})
1755
- },
1756
- treeProps: {
1757
- type: Object,
1758
- default: () => J
1759
- },
1760
- selectedDocuments: {
1761
- type: Array,
1762
- default: () => []
1763
- },
1764
- currentTab: {
1765
- type: String,
1766
- default: ""
1767
- },
1768
- searchType: {
1769
- type: String,
1770
- default: Y.FRONTEND,
1771
- validator: (e) => Object.values(Y).includes(e)
1772
- },
1773
- textConfig: {
1774
- type: Object,
1775
- default: () => ({ searchPlaceholder: "" })
1776
- },
1777
- getTabSelectedDocuments: {
1778
- type: Function,
1779
- default: () => () => []
1780
- },
1781
- responseSearchHook: {
1782
- type: Object,
1783
- default: () => {}
1784
- }
1785
- },
1786
- emits: [
1787
- "node-check",
1788
- "tab-change",
1789
- "search",
1790
- "node-expand",
1791
- "load-more",
1792
- "node-check-search"
1793
- ],
1794
- setup(e, { expose: t, emit: n }) {
1795
- let r = e, i = n, f = Ae(p), m = T(), h = T(""), _ = T(r.currentTab || r.tabs[0]?.value || X.MY_FILES), v = T([]), y = T(!1), b = T(!1), x = o(() => r.tabs.map((e) => ({
1796
- label: e.label,
1797
- value: e.value
1798
- }))), C = o(() => r.treeData[_.value] || []);
1799
- F(() => r.responseSearchHook, (e, t) => {
1800
- b.value = Ue(r.currentTab, e), y.value = !1;
1801
- }, {
1802
- deep: !0,
1803
- immediate: !0
1804
- });
1805
- let w = Pe(i, 800), E = o(() => {
1806
- if (r.searchType === Y.BACKEND) return C.value;
1807
- let e = h.value?.trim();
1808
- return e ? Fe(C.value, e, r.treeProps) : C.value;
1809
- }), O = (e) => r.getTabSelectedDocuments(_.value).some((t) => t[r.treeProps.value] === e), k = o(() => {
1810
- if (!h.value?.trim()) return [];
1811
- let e = (t, n = 0) => {
1812
- let i = [];
1813
- return t.forEach((t) => {
1814
- i.push({
1815
- ...t,
1816
- level: n,
1817
- isSelected: O(t[r.treeProps.value])
1818
- }), t[r.treeProps.children] && t[r.treeProps.children].length > 0 && (i = i.concat(e(t[r.treeProps.children], n + 1)));
1819
- }), i;
1820
- };
1821
- return e(E.value);
1822
- }), A = (e) => {
1823
- i("node-check", e);
1824
- }, j = (e, t) => {
1825
- i("node-check-search", {
1826
- selectedNode: r.getTabSelectedDocuments(_.value),
1827
- checkedNode: e,
1828
- isChecked: t
1829
- });
1830
- };
1831
- F(_, (e) => {
1832
- b.value = Ue(e, r.responseSearchHook), i("tab-change", e);
1833
- }), F(() => r.treeData, () => {
1834
- y.value = !1, m.value && m.value.syncSelectedNodes && g(() => {
1835
- let e = (r.selectedDocuments || []).map((e) => e[r.treeProps.value]);
1836
- m.value.syncSelectedNodes(e);
1837
- });
1838
- }, { deep: !0 });
1839
- let N = (e) => {
1840
- Ne(e) || i("node-expand", {
1841
- node: e,
1842
- tabKey: _.value
1843
- });
1844
- }, ee = () => {
1845
- y.value = !0, i("load-more");
1846
- };
1847
- return F(h, (e) => {
1848
- r.searchType === Y.BACKEND ? (e && e.trim() && (y.value = !0), w(e || "")) : y.value = !1;
1849
- }), F(() => r.currentTab, (e) => {
1850
- e && e !== _.value && (_.value = e);
1851
- }, { immediate: !0 }), F(() => r.selectedDocuments, (e) => {
1852
- v.value = e || [];
1853
- }, {
1854
- immediate: !0,
1855
- deep: !0
1856
- }), t({
1857
- setNodeCheckStatus: (e, t) => {
1858
- m.value?.setNodeCheckStatus(e, t);
1859
- },
1860
- updateNodeChildren: (e, t) => {
1861
- m.value && m.value?.updateNodeChildren && m.value.updateNodeChildren(e, t);
1862
- },
1863
- syncSelectedNodes: (e) => {
1864
- m.value?.syncSelectedNodes(e);
1865
- }
1866
- }), (t, n) => (S(), l("div", qt, [u("div", Jt, [
1867
- u("div", Yt, [d(P(re), {
1868
- modelValue: h.value,
1869
- "onUpdate:modelValue": n[0] ||= (e) => h.value = e,
1870
- placeholder: r.textConfig.searchPlaceholder,
1871
- "prefix-icon": P(pe),
1872
- clearable: ""
1873
- }, null, 8, [
1874
- "modelValue",
1875
- "placeholder",
1876
- "prefix-icon"
1877
- ])]),
1878
- d(P(V), {
1879
- modelValue: _.value,
1880
- "onUpdate:modelValue": n[1] ||= (e) => _.value = e,
1881
- options: x.value
1882
- }, null, 8, ["modelValue", "options"]),
1883
- u("div", Xt, [!E.value || E.value.length === 0 ? (S(), s(P(q), { key: 0 })) : (S(), l(a, { key: 1 }, [h.value.trim() === "" ? (S(), s(Ge, {
1884
- key: 1,
1885
- modelValue: v.value,
1886
- "onUpdate:modelValue": n[2] ||= (e) => v.value = e,
1887
- ref_key: "treeSelectRef",
1888
- ref: m,
1889
- "tree-list": E.value,
1890
- "tree-props": e.treeProps,
1891
- "filter-keyword": h.value,
1892
- itemSize: 50,
1893
- hasTreeLine: !0,
1894
- "text-config": e.textConfig,
1895
- includeParentSelected: !0,
1896
- onHandleCheck: A,
1897
- onNodeExpand: N,
1898
- getTabSelectedDocuments: e.getTabSelectedDocuments
1899
- }, {
1900
- node: I(({ node: n, data: r }) => [D(t.$slots, "node", {
1901
- node: n,
1902
- data: r
1903
- }, () => [d(P(f), {
1904
- node: n,
1905
- treeData: E.value,
1906
- showLabelLine: !0,
1907
- indent: tn
1908
- }, {
1909
- default: I(() => [u("div", Zt, [d(Z, {
1910
- "file-type": r.type,
1911
- size: 26,
1912
- isLocalFileType: r?.isLocalFileType
1913
- }, null, 8, ["file-type", "isLocalFileType"]), u("div", Qt, [u("span", $t, M(r[e.treeProps.label]), 1), r.suffix ? (S(), l("span", en, M(r.suffix), 1)) : c("", !0)])])]),
1914
- _: 2
1915
- }, 1032, ["node", "treeData"])], !0)]),
1916
- _: 3
1917
- }, 8, [
1918
- "modelValue",
1919
- "tree-list",
1920
- "tree-props",
1921
- "filter-keyword",
1922
- "text-config",
1923
- "getTabSelectedDocuments"
1924
- ])) : (S(), s(Kt, {
1925
- key: 0,
1926
- items: k.value,
1927
- loading: y.value,
1928
- "has-more": b.value,
1929
- "min-item-size": 50,
1930
- buffer: 100,
1931
- "tree-props": e.treeProps,
1932
- "selected-documents": e.selectedDocuments,
1933
- onItemCheck: j,
1934
- onLoadMore: ee
1935
- }, null, 8, [
1936
- "items",
1937
- "loading",
1938
- "has-more",
1939
- "tree-props",
1940
- "selected-documents"
1941
- ]))], 64))])
1942
- ])]));
1943
- }
1944
- }), [["__scopeId", "data-v-6bf8c501"]]);
1945
- //#endregion
1946
- //#region components/DocSyncSelect/useDocumentSelection.js
1947
- function rn(e = {}) {
1948
- let { valueKey: t = "id" } = e, n = T(/* @__PURE__ */ new Map()), r = o(() => {
1949
- let e = [], r = /* @__PURE__ */ new Set();
1950
- return n.value.forEach((n) => {
1951
- n.forEach((n) => {
1952
- let i = n[t];
1953
- r.has(i) || (e.push(n), r.add(i));
1954
- });
1955
- }), e;
1956
- });
1957
- return {
1958
- allSelectedDocuments: r,
1959
- selectionMap: n,
1960
- getTabSelectedDocuments: (e) => {
1961
- let t = n.value.get(e);
1962
- return t ? Array.from(t.values()) : [];
1963
- },
1964
- updateTabSelection: (e, r = []) => {
1965
- n.value.has(e) || n.value.set(e, /* @__PURE__ */ new Map());
1966
- let i = /* @__PURE__ */ new Map();
1967
- r.forEach((e) => {
1968
- e && e[t] != null && i.set(e[t], e);
1969
- }), n.value.set(e, i), n.value = new Map(n.value);
1970
- },
1971
- removeDocument: (e) => {
1972
- let r = e[t], i = null;
1973
- return n.value.forEach((e, t) => {
1974
- e.has(r) && (e.delete(r), i = t);
1975
- }), i && (n.value = new Map(n.value)), i;
1976
- },
1977
- toggleDocument: (e, r, i) => {
1978
- n.value.has(e) || n.value.set(e, /* @__PURE__ */ new Map());
1979
- let a = n.value.get(e), o = r[t];
1980
- i ? a.set(o, r) : a.delete(o), n.value = new Map(n.value);
1981
- },
1982
- clearTabSelection: (e) => {
1983
- n.value.has(e) && (n.value.get(e).clear(), n.value = new Map(n.value));
1984
- },
1985
- clearAllSelection: () => {
1986
- n.value.clear(), n.value = new Map(n.value);
1987
- },
1988
- isDocumentSelected: (e, t) => {
1989
- let r = n.value.get(e);
1990
- return r ? r.has(t) : !1;
1991
- },
1992
- setAllDocuments: (e = [], r = "") => {
1993
- n.value.clear(), e.forEach((e) => {
1994
- let i = e.tabKey || r;
1995
- i && (n.value.has(i) || n.value.set(i, /* @__PURE__ */ new Map()), n.value.get(i).set(e[t], e));
1996
- }), n.value = new Map(n.value);
1997
- },
1998
- getStatistics: () => {
1999
- let e = {
2000
- total: r.value.length,
2001
- byTab: {}
2002
- };
2003
- return n.value.forEach((t, n) => {
2004
- e.byTab[n] = t.size;
2005
- }), e;
2006
- }
2007
- };
2008
- }
2009
- //#endregion
2010
- //#region components/DocSyncSelect/useAllTabDocList.js
2011
- function an(e = {}) {
2012
- let { valueKey: t = J.value, childrenKey: n = J.children } = e, r = T(/* @__PURE__ */ new Map()), i = T({});
2013
- return {
2014
- allTabDocList: r,
2015
- allTabTreeDataObject: o(() => {
2016
- let e = {};
2017
- return r.value.forEach((t, n) => {
2018
- e[n] = t;
2019
- }), e;
2020
- }),
2021
- responseSearchHook: i,
2022
- setAllTabsTreeData: (e = {}) => {
2023
- let t = /* @__PURE__ */ new Map();
2024
- e && typeof e == "object" && Object.keys(e).forEach((n) => {
2025
- let r = Array.isArray(e[n]) ? e[n] : [];
2026
- t.set(n, r);
2027
- }), r.value = t;
2028
- },
2029
- getTabTreeData: (e) => r.value.get(e) || [],
2030
- setTabTreeData: (e, t = []) => {
2031
- let n = new Map(r.value);
2032
- n.set(e, Array.isArray(t) ? t : []), r.value = n;
2033
- },
2034
- updateNodeChildren: (e, i, a = []) => {
2035
- let o = r.value.get(e);
2036
- if (!o || !Array.isArray(o)) return;
2037
- let s = (e) => e.map((e) => {
2038
- if (e[t] === i) return {
2039
- ...e,
2040
- [n]: a
2041
- };
2042
- let r = e[n];
2043
- return Array.isArray(r) && r.length > 0 ? {
2044
- ...e,
2045
- [n]: s(r)
2046
- } : e;
2047
- }), c = s(o), l = new Map(r.value);
2048
- l.set(e, c), r.value = l;
2049
- },
2050
- setResponseSearchHook: (e) => {
2051
- i.value = e;
2052
- }
2053
- };
2054
- }
2055
- //#endregion
2056
- //#region components/DocSyncSelect/layout.vue
2057
- var on = { class: "doc-sync-select" }, sn = n(/* @__PURE__ */ i(/* @__PURE__ */ Object.assign({ name: "DocSyncSelect" }, {
2058
- __name: "layout",
2059
- props: {
2060
- modelValue: {
2061
- type: Array,
2062
- default: () => []
2063
- },
2064
- treeData: {
2065
- type: Object,
2066
- default: () => ({})
2067
- },
2068
- updateMeta: {
2069
- type: Object,
2070
- default: () => ({
2071
- updateId: "",
2072
- operation: null,
2073
- context: {}
2074
- })
2075
- },
2076
- treeProps: {
2077
- type: Object,
2078
- default: () => J
2079
- },
2080
- tabs: {
2081
- type: Array,
2082
- default: () => []
2083
- },
2084
- searchType: {
2085
- type: String,
2086
- default: Y.FRONTEND,
2087
- validator: (e) => Object.values(Y).includes(e)
2088
- },
2089
- textConfig: {
2090
- type: Object,
2091
- default: () => ({ searchPlaceholder: "" })
2092
- }
2093
- },
2094
- emits: [
2095
- "update:modelValue",
2096
- "change",
2097
- "search",
2098
- "load-node",
2099
- "recursive-load",
2100
- "load-more"
2101
- ],
2102
- setup(e, { expose: t, emit: n }) {
2103
- let r = e, i = n, a = o(() => ({
2104
- ...J,
2105
- ...r.treeProps
2106
- })), s = o(() => a.value.value), c = o(() => a.value.children), u = T(), f = T(r.tabs[0]?.value || ""), { allSelectedDocuments: p, getTabSelectedDocuments: m, updateTabSelection: h, removeDocument: _, setAllDocuments: v, selectionMap: y, getAllSelectedIds: x } = rn({ valueKey: a.value.value }), C = (e = p.value) => {
2107
- i("update:modelValue", e), i("change", e);
2108
- }, { allTabTreeDataObject: w, setAllTabsTreeData: E, updateNodeChildren: D, responseSearchHook: O, setResponseSearchHook: k } = an({
2109
- valueKey: s.value,
2110
- childrenKey: c.value
2111
- });
2112
- F(() => r.treeData, (e) => {
2113
- E(e || {});
2114
- }, {
2115
- deep: !0,
2116
- immediate: !0
2117
- }), F(() => r.updateMeta, (e, t) => {
2118
- if (!e || !e.updateId || e.updateId === (t?.updateId || "")) return;
2119
- let { operation: n, context: r } = e;
2120
- switch (n) {
2121
- case "node-children-update":
2122
- te(r);
2123
- break;
2124
- case "recursive-load":
2125
- ne(r);
2126
- break;
2127
- case "search":
2128
- case "load-more":
2129
- B(r);
2130
- break;
2131
- default: break;
2132
- }
2133
- }, {
2134
- deep: !0,
2135
- immediate: !1
2136
- });
2137
- let A = o(() => m(f.value)), j = (e) => {
2138
- f.value = e;
2139
- let t = m(e);
2140
- u.value && u.value.syncSelectedNodes && g(() => {
2141
- let e = t.map((e) => e[a.value.value]);
2142
- u.value.syncSelectedNodes(e);
2143
- });
2144
- }, M = (e, t, n) => {
2145
- g(() => {
2146
- let r = t || [];
2147
- h(n, [
2148
- ...Ie(e, a.value),
2149
- e,
2150
- ...r
2151
- ]), C();
2152
- });
2153
- }, N = (e) => {
2154
- let { selectedNode: t, checkedNode: n, isChecked: r } = e, i = m(f.value);
2155
- if (t = Be({
2156
- tabKey: f.value,
2157
- currentSelectedDocs: [n],
2158
- treeData: w.value,
2159
- treeProps: a.value,
2160
- hasSelectToRightDocList: i
2161
- }), !r) {
2162
- h(f.value, i.filter((e) => e.id !== n.id)), C();
2163
- return;
2164
- }
2165
- h(f.value, [...i, ...t]), C();
2166
- }, ee = (e) => {
2167
- let { selectedNode: t, checkedNode: n, isChecked: r } = e, i = m(f.value);
2168
- if (t = Be({
2169
- tabKey: f.value,
2170
- currentSelectedDocs: t,
2171
- treeData: w.value,
2172
- treeProps: a.value,
2173
- hasSelectToRightDocList: i
2174
- }), !n?.hasChildren) {
2175
- h(f.value, t), C();
2176
- return;
2177
- }
2178
- if (!r) {
2179
- let e = Ie(n, a.value), t = new Set([n[s.value], ...e.map((e) => e[s.value])]), r = m(f.value).filter((e) => !t.has(e[s.value]));
2180
- h(f.value, r), t.forEach((e) => {
2181
- u.value?.setNodeCheckStatus && u.value.setNodeCheckStatus(e, !1);
2182
- }), C();
2183
- return;
2184
- }
2185
- if (r && n && He(n, a.value)) {
2186
- R(n);
2187
- return;
2188
- } else M(n, t || [], f.value);
2189
- }, I = (e) => {
2190
- let t = a.value.value;
2191
- _(e) === f.value && u.value && u.value.setNodeCheckStatus && u.value.setNodeCheckStatus(e[t], !1), C();
2192
- }, L = ({ node: e, tabKey: t }) => {
2193
- let n = {};
2194
- t === X.FEISHU_KNOWLEDGE ? n = {
2195
- spaceId: e?.spaceId,
2196
- parentNodeToken: e?.nodeToken
2197
- } : t === X.MY_FILES && (n = { folderToken: e?.folderToken }), i("load-node", {
2198
- nodeKey: e[a.value?.value],
2199
- nodeData: e,
2200
- tabKey: t,
2201
- requestParams: n
2202
- });
2203
- }, R = (e) => {
2204
- let t = {};
2205
- f.value === X.FEISHU_KNOWLEDGE ? t = {
2206
- spaceId: e?.spaceId,
2207
- parentNodeToken: e?.nodeToken,
2208
- recursive: !0
2209
- } : f.value === X.MY_FILES && (t = {
2210
- folderToken: e?.folderToken,
2211
- recursive: !0
2212
- }), i("recursive-load", {
2213
- nodeKey: e[a.value?.value],
2214
- nodeData: e,
2215
- tabKey: f.value,
2216
- requestParams: t
2217
- });
2218
- }, z = (e, t) => {
2219
- u.value && u.value.updateNodeChildren && u.value.updateNodeChildren(e, t), f.value && D(f.value, e, t);
2220
- }, te = (e) => {
2221
- let { nodeKey: t, newChildren: n } = e;
2222
- u.value?.updateNodeChildren && u.value.updateNodeChildren(t, n);
2223
- }, ne = (e) => {
2224
- let { nodeKey: t, tabKey: n, newChildren: i, originalNode: o, nodeData: s, error: c } = e;
2225
- if (c) return;
2226
- let l = Ve(r.treeData[n] || [], o?.id || t, a.value);
2227
- l && M(l, m(n || f.value), n || f.value);
2228
- }, B = (e) => {
2229
- let { responseSearch: t } = e;
2230
- k(t);
2231
- }, re = ({ keyword: e }) => {
2232
- i("search", { keyword: e });
2233
- }, V = () => {
2234
- i("load-more", f.value);
2235
- };
2236
- return b(() => {
2237
- r.modelValue && r.modelValue.length > 0 && v(r.modelValue, f.value);
2238
- }), F(() => r.modelValue, (e, t) => {
2239
- if (!e || e.length === 0) {
2240
- t && t.length > 0 && v([]);
2241
- return;
2242
- }
2243
- let n = p.value;
2244
- n.length === e.length && e.every((e) => n.some((t) => t[a.value.value] === e[a.value.value])) || v(e, f.value);
2245
- }, { deep: !0 }), t({
2246
- clearSelection: () => {
2247
- v([]), C([]);
2248
- },
2249
- getSelectedDocuments: () => p.value,
2250
- setSelectedDocuments: (e) => {
2251
- v(e, f.value), C();
2252
- },
2253
- updateNodeChildren: z
2254
- }), (t, n) => (S(), l("div", on, [d(nn, {
2255
- tabs: e.tabs,
2256
- "tree-data": P(w),
2257
- "tree-props": a.value,
2258
- "selected-documents": A.value,
2259
- "current-tab": f.value,
2260
- "search-type": e.searchType,
2261
- "text-config": e.textConfig,
2262
- "response-search-hook": P(O),
2263
- ref_key: "leftLayoutRef",
2264
- ref: u,
2265
- onNodeCheck: ee,
2266
- onNodeCheckSearch: N,
2267
- onTabChange: j,
2268
- onSearch: re,
2269
- onNodeExpand: L,
2270
- onLoadMore: V,
2271
- getTabSelectedDocuments: P(m)
2272
- }, null, 8, [
2273
- "tabs",
2274
- "tree-data",
2275
- "tree-props",
2276
- "selected-documents",
2277
- "current-tab",
2278
- "search-type",
2279
- "text-config",
2280
- "response-search-hook",
2281
- "getTabSelectedDocuments"
2282
- ]), d(Oe, {
2283
- "selected-documents": P(p),
2284
- "tree-props": a.value,
2285
- onDeleteNode: I
2286
- }, null, 8, ["selected-documents", "tree-props"])]));
2287
- }
2288
- }), [["__scopeId", "data-v-c45c2d8e"]])), cn = n(Z);
2289
- //#endregion
2290
- export { cn as n, sn as t };