@blueking/bkflow-canvas-editor 1.2.0-beta.2 → 1.2.0-beta.3

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.
@@ -1,3543 +0,0 @@
1
- import { defineComponent as hn, h as jn, openBlock as W, createElementBlock as oe, normalizeStyle as dn, normalizeClass as vt, createCommentVNode as ie, createVNode as gt, withCtx as Qe, withDirectives as Gt, createElementVNode as Ce, withModifiers as Pe, vModelText as In, Fragment as zt, renderList as Kt, mergeProps as ar, vShow as ir, createBlock as Tt, createTextVNode as Nr, toDisplayString as xt, ref as te, computed as V, watch as Xe, nextTick as Ae, onBeforeMount as cr, onMounted as Fr, onUnmounted as fr, provide as Lr, toValue as ne, renderSlot as qr, unref as Gr } from "vue";
2
- import { provideGlobalConfig as jr, Tag as hr, Popover as pr, PopConfirm as zr, Message as or, Loading as Kr } from "bkui-vue";
3
- var Hr = Object.create, gr = Object.defineProperty, Vr = Object.getOwnPropertyDescriptor, Wr = Object.getOwnPropertyNames, Yr = Object.getPrototypeOf, Xr = Object.prototype.hasOwnProperty, Qr = (s, c) => () => (c || s((c = { exports: {} }).exports, c), c.exports), Zr = (s, c, u, a) => {
4
- if (c && typeof c == "object" || typeof c == "function") for (var o = Wr(c), g = 0, p = o.length, b; g < p; g++)
5
- b = o[g], !Xr.call(s, b) && b !== u && gr(s, b, {
6
- get: ((C) => c[C]).bind(null, b),
7
- enumerable: !(a = Vr(c, b)) || a.enumerable
8
- });
9
- return s;
10
- }, Jr = (s, c, u) => (u = s != null ? Hr(Yr(s)) : {}, Zr(!s || !s.__esModule ? gr(u, "default", {
11
- value: s,
12
- enumerable: !0
13
- }) : u, s)), $r = /* @__PURE__ */ Jr((/* @__PURE__ */ Qr(((s, c) => {
14
- (function(u, a) {
15
- typeof s == "object" && typeof c < "u" ? c.exports = a() : typeof define == "function" && define.amd ? define(a) : (u = u || self, u.Sortable = a());
16
- })(s, (function() {
17
- function u(r, e) {
18
- var t = Object.keys(r);
19
- if (Object.getOwnPropertySymbols) {
20
- var n = Object.getOwnPropertySymbols(r);
21
- e && (n = n.filter(function(i) {
22
- return Object.getOwnPropertyDescriptor(r, i).enumerable;
23
- })), t.push.apply(t, n);
24
- }
25
- return t;
26
- }
27
- function a(r) {
28
- for (var e = 1; e < arguments.length; e++) {
29
- var t = arguments[e] != null ? arguments[e] : {};
30
- e % 2 ? u(Object(t), !0).forEach(function(n) {
31
- g(r, n, t[n]);
32
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) : u(Object(t)).forEach(function(n) {
33
- Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(t, n));
34
- });
35
- }
36
- return r;
37
- }
38
- function o(r) {
39
- "@babel/helpers - typeof";
40
- return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? o = function(e) {
41
- return typeof e;
42
- } : o = function(e) {
43
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
44
- }, o(r);
45
- }
46
- function g(r, e, t) {
47
- return e in r ? Object.defineProperty(r, e, {
48
- value: t,
49
- enumerable: !0,
50
- configurable: !0,
51
- writable: !0
52
- }) : r[e] = t, r;
53
- }
54
- function p() {
55
- return p = Object.assign || function(r) {
56
- for (var e = 1; e < arguments.length; e++) {
57
- var t = arguments[e];
58
- for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (r[n] = t[n]);
59
- }
60
- return r;
61
- }, p.apply(this, arguments);
62
- }
63
- function b(r, e) {
64
- if (r == null) return {};
65
- var t = {}, n = Object.keys(r), i, l;
66
- for (l = 0; l < n.length; l++)
67
- i = n[l], !(e.indexOf(i) >= 0) && (t[i] = r[i]);
68
- return t;
69
- }
70
- function C(r, e) {
71
- if (r == null) return {};
72
- var t = b(r, e), n, i;
73
- if (Object.getOwnPropertySymbols) {
74
- var l = Object.getOwnPropertySymbols(r);
75
- for (i = 0; i < l.length; i++)
76
- n = l[i], !(e.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(r, n) && (t[n] = r[n]);
77
- }
78
- return t;
79
- }
80
- function B(r) {
81
- return j(r) || A(r) || F(r) || le();
82
- }
83
- function j(r) {
84
- if (Array.isArray(r)) return L(r);
85
- }
86
- function A(r) {
87
- if (typeof Symbol < "u" && r[Symbol.iterator] != null || r["@@iterator"] != null) return Array.from(r);
88
- }
89
- function F(r, e) {
90
- if (r) {
91
- if (typeof r == "string") return L(r, e);
92
- var t = Object.prototype.toString.call(r).slice(8, -1);
93
- if (t === "Object" && r.constructor && (t = r.constructor.name), t === "Map" || t === "Set") return Array.from(r);
94
- if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return L(r, e);
95
- }
96
- }
97
- function L(r, e) {
98
- (e == null || e > r.length) && (e = r.length);
99
- for (var t = 0, n = new Array(e); t < e; t++) n[t] = r[t];
100
- return n;
101
- }
102
- function le() {
103
- throw new TypeError(`Invalid attempt to spread non-iterable instance.
104
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
105
- }
106
- var Be = "1.15.6";
107
- function se(r) {
108
- if (typeof window < "u" && window.navigator) return !!/* @__PURE__ */ navigator.userAgent.match(r);
109
- }
110
- var P = se(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), X = se(/Edge/i), Se = se(/firefox/i), Ue = se(/safari/i) && !se(/chrome/i) && !se(/android/i), ye = se(/iP(ad|od|hone)/i), R = se(/chrome/i) && se(/android/i), Ke = {
111
- capture: !1,
112
- passive: !1
113
- };
114
- function O(r, e, t) {
115
- r.addEventListener(e, t, !P && Ke);
116
- }
117
- function T(r, e, t) {
118
- r.removeEventListener(e, t, !P && Ke);
119
- }
120
- function ae(r, e) {
121
- if (e) {
122
- if (e[0] === ">" && (e = e.substring(1)), r) try {
123
- if (r.matches) return r.matches(e);
124
- if (r.msMatchesSelector) return r.msMatchesSelector(e);
125
- if (r.webkitMatchesSelector) return r.webkitMatchesSelector(e);
126
- } catch {
127
- return !1;
128
- }
129
- return !1;
130
- }
131
- }
132
- function he(r) {
133
- return r.host && r !== document && r.host.nodeType ? r.host : r.parentNode;
134
- }
135
- function Q(r, e, t, n) {
136
- if (r) {
137
- t = t || document;
138
- do {
139
- if (e != null && (e[0] === ">" ? r.parentNode === t && ae(r, e) : ae(r, e)) || n && r === t) return r;
140
- if (r === t) break;
141
- } while (r = he(r));
142
- }
143
- return null;
144
- }
145
- var Fe = /\s+/g;
146
- function S(r, e, t) {
147
- r && e && (r.classList ? r.classList[t ? "add" : "remove"](e) : r.className = ((" " + r.className + " ").replace(Fe, " ").replace(" " + e + " ", " ") + (t ? " " + e : "")).replace(Fe, " "));
148
- }
149
- function U(r, e, t) {
150
- var n = r && r.style;
151
- if (n) {
152
- if (t === void 0)
153
- return document.defaultView && document.defaultView.getComputedStyle ? t = document.defaultView.getComputedStyle(r, "") : r.currentStyle && (t = r.currentStyle), e === void 0 ? t : t[e];
154
- !(e in n) && e.indexOf("webkit") === -1 && (e = "-webkit-" + e), n[e] = t + (typeof t == "string" ? "" : "px");
155
- }
156
- }
157
- function Ze(r, e) {
158
- var t = "";
159
- if (typeof r == "string") t = r;
160
- else do {
161
- var n = U(r, "transform");
162
- n && n !== "none" && (t = n + " " + t);
163
- } while (!e && (r = r.parentNode));
164
- var i = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
165
- return i && new i(t);
166
- }
167
- function Ot(r, e, t) {
168
- if (r) {
169
- var n = r.getElementsByTagName(e), i = 0, l = n.length;
170
- if (t) for (; i < l; i++) t(n[i], i);
171
- return n;
172
- }
173
- return [];
174
- }
175
- function we() {
176
- var r = document.scrollingElement;
177
- return r || document.documentElement;
178
- }
179
- function Y(r, e, t, n, i) {
180
- if (!(!r.getBoundingClientRect && r !== window)) {
181
- var l, d, h, v, m, E, _;
182
- if (r !== window && r.parentNode && r !== we() ? (l = r.getBoundingClientRect(), d = l.top, h = l.left, v = l.bottom, m = l.right, E = l.height, _ = l.width) : (d = 0, h = 0, v = window.innerHeight, m = window.innerWidth, E = window.innerHeight, _ = window.innerWidth), (e || t) && r !== window && (i = i || r.parentNode, !P))
183
- do
184
- if (i && i.getBoundingClientRect && (U(i, "transform") !== "none" || t && U(i, "position") !== "static")) {
185
- var D = i.getBoundingClientRect();
186
- d -= D.top + parseInt(U(i, "border-top-width")), h -= D.left + parseInt(U(i, "border-left-width")), v = d + l.height, m = h + l.width;
187
- break;
188
- }
189
- while (i = i.parentNode);
190
- if (n && r !== window) {
191
- var G = Ze(i || r), N = G && G.a, z = G && G.d;
192
- G && (d /= z, h /= N, _ /= N, E /= z, v = d + E, m = h + _);
193
- }
194
- return {
195
- top: d,
196
- left: h,
197
- bottom: v,
198
- right: m,
199
- width: _,
200
- height: E
201
- };
202
- }
203
- }
204
- function Je(r, e, t) {
205
- for (var n = He(r, !0), i = Y(r)[e]; n; ) {
206
- var l = Y(n)[t], d = void 0;
207
- if (d = i >= l, !d) return n;
208
- if (n === we()) break;
209
- n = He(n, !1);
210
- }
211
- return !1;
212
- }
213
- function ot(r, e, t, n) {
214
- for (var i = 0, l = 0, d = r.children; l < d.length; ) {
215
- if (d[l].style.display !== "none" && d[l] !== x.ghost && (n || d[l] !== x.dragged) && Q(d[l], t.draggable, r, !1)) {
216
- if (i === e) return d[l];
217
- i++;
218
- }
219
- l++;
220
- }
221
- return null;
222
- }
223
- function Ht(r, e) {
224
- for (var t = r.lastElementChild; t && (t === x.ghost || U(t, "display") === "none" || e && !ae(t, e)); ) t = t.previousElementSibling;
225
- return t || null;
226
- }
227
- function Z(r, e) {
228
- var t = 0;
229
- if (!r || !r.parentNode) return -1;
230
- for (; r = r.previousElementSibling; ) r.nodeName.toUpperCase() !== "TEMPLATE" && r !== x.clone && (!e || ae(r, e)) && t++;
231
- return t;
232
- }
233
- function kt(r) {
234
- var e = 0, t = 0, n = we();
235
- if (r) do {
236
- var i = Ze(r), l = i.a, d = i.d;
237
- e += r.scrollLeft * l, t += r.scrollTop * d;
238
- } while (r !== n && (r = r.parentNode));
239
- return [e, t];
240
- }
241
- function lt(r, e) {
242
- for (var t in r)
243
- if (r.hasOwnProperty(t)) {
244
- for (var n in e) if (e.hasOwnProperty(n) && e[n] === r[t][n]) return Number(t);
245
- }
246
- return -1;
247
- }
248
- function He(r, e) {
249
- if (!r || !r.getBoundingClientRect) return we();
250
- var t = r, n = !1;
251
- do
252
- if (t.clientWidth < t.scrollWidth || t.clientHeight < t.scrollHeight) {
253
- var i = U(t);
254
- if (t.clientWidth < t.scrollWidth && (i.overflowX == "auto" || i.overflowX == "scroll") || t.clientHeight < t.scrollHeight && (i.overflowY == "auto" || i.overflowY == "scroll")) {
255
- if (!t.getBoundingClientRect || t === document.body) return we();
256
- if (n || e) return t;
257
- n = !0;
258
- }
259
- }
260
- while (t = t.parentNode);
261
- return we();
262
- }
263
- function kn(r, e) {
264
- if (r && e)
265
- for (var t in e) e.hasOwnProperty(t) && (r[t] = e[t]);
266
- return r;
267
- }
268
- function Vt(r, e) {
269
- return Math.round(r.top) === Math.round(e.top) && Math.round(r.left) === Math.round(e.left) && Math.round(r.height) === Math.round(e.height) && Math.round(r.width) === Math.round(e.width);
270
- }
271
- var mt;
272
- function st(r, e) {
273
- return function() {
274
- if (!mt) {
275
- var t = arguments, n = this;
276
- t.length === 1 ? r.call(n, t[0]) : r.apply(n, t), mt = setTimeout(function() {
277
- mt = void 0;
278
- }, e);
279
- }
280
- };
281
- }
282
- function bt() {
283
- clearTimeout(mt), mt = void 0;
284
- }
285
- function Mt(r, e, t) {
286
- r.scrollLeft += e, r.scrollTop += t;
287
- }
288
- function Wt(r) {
289
- var e = window.Polymer, t = window.jQuery || window.Zepto;
290
- return e && e.dom ? e.dom(r).cloneNode(!0) : t ? t(r).clone(!0)[0] : r.cloneNode(!0);
291
- }
292
- function pn(r, e) {
293
- U(r, "position", "absolute"), U(r, "top", e.top), U(r, "left", e.left), U(r, "width", e.width), U(r, "height", e.height);
294
- }
295
- function Pt(r) {
296
- U(r, "position", ""), U(r, "top", ""), U(r, "left", ""), U(r, "width", ""), U(r, "height", "");
297
- }
298
- function ut(r, e, t) {
299
- var n = {};
300
- return Array.from(r.children).forEach(function(i) {
301
- var l, d, h, v;
302
- if (!(!Q(i, e.draggable, r, !1) || i.animated || i === t)) {
303
- var m = Y(i);
304
- n.left = Math.min((l = n.left) !== null && l !== void 0 ? l : 1 / 0, m.left), n.top = Math.min((d = n.top) !== null && d !== void 0 ? d : 1 / 0, m.top), n.right = Math.max((h = n.right) !== null && h !== void 0 ? h : -1 / 0, m.right), n.bottom = Math.max((v = n.bottom) !== null && v !== void 0 ? v : -1 / 0, m.bottom);
305
- }
306
- }), n.width = n.right - n.left, n.height = n.bottom - n.top, n.x = n.left, n.y = n.top, n;
307
- }
308
- var ue = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
309
- function Bt() {
310
- var r = [], e;
311
- return {
312
- captureAnimationState: function() {
313
- r = [], this.options.animation && [].slice.call(this.el.children).forEach(function(n) {
314
- if (!(U(n, "display") === "none" || n === x.ghost)) {
315
- r.push({
316
- target: n,
317
- rect: Y(n)
318
- });
319
- var i = a({}, r[r.length - 1].rect);
320
- if (n.thisAnimationDuration) {
321
- var l = Ze(n, !0);
322
- l && (i.top -= l.f, i.left -= l.e);
323
- }
324
- n.fromRect = i;
325
- }
326
- });
327
- },
328
- addAnimationState: function(n) {
329
- r.push(n);
330
- },
331
- removeAnimationState: function(n) {
332
- r.splice(lt(r, { target: n }), 1);
333
- },
334
- animateAll: function(n) {
335
- var i = this;
336
- if (!this.options.animation) {
337
- clearTimeout(e), typeof n == "function" && n();
338
- return;
339
- }
340
- var l = !1, d = 0;
341
- r.forEach(function(h) {
342
- var v = 0, m = h.target, E = m.fromRect, _ = Y(m), D = m.prevFromRect, G = m.prevToRect, N = h.rect, z = Ze(m, !0);
343
- z && (_.top -= z.f, _.left -= z.e), m.toRect = _, m.thisAnimationDuration && Vt(D, _) && !Vt(E, _) && (N.top - _.top) / (N.left - _.left) === (E.top - _.top) / (E.left - _.left) && (v = Yt(N, D, G, i.options)), Vt(_, E) || (m.prevFromRect = E, m.prevToRect = _, v || (v = i.options.animation), i.animate(m, N, _, v)), v && (l = !0, d = Math.max(d, v), clearTimeout(m.animationResetTimer), m.animationResetTimer = setTimeout(function() {
344
- m.animationTime = 0, m.prevFromRect = null, m.fromRect = null, m.prevToRect = null, m.thisAnimationDuration = null;
345
- }, v), m.thisAnimationDuration = v);
346
- }), clearTimeout(e), l ? e = setTimeout(function() {
347
- typeof n == "function" && n();
348
- }, d) : typeof n == "function" && n(), r = [];
349
- },
350
- animate: function(n, i, l, d) {
351
- if (d) {
352
- U(n, "transition", ""), U(n, "transform", "");
353
- var h = Ze(this.el), v = h && h.a, m = h && h.d, E = (i.left - l.left) / (v || 1), _ = (i.top - l.top) / (m || 1);
354
- n.animatingX = !!E, n.animatingY = !!_, U(n, "transform", "translate3d(" + E + "px," + _ + "px,0)"), this.forRepaintDummy = Rt(n), U(n, "transition", "transform " + d + "ms" + (this.options.easing ? " " + this.options.easing : "")), U(n, "transform", "translate3d(0,0,0)"), typeof n.animated == "number" && clearTimeout(n.animated), n.animated = setTimeout(function() {
355
- U(n, "transition", ""), U(n, "transform", ""), n.animated = !1, n.animatingX = !1, n.animatingY = !1;
356
- }, d);
357
- }
358
- }
359
- };
360
- }
361
- function Rt(r) {
362
- return r.offsetWidth;
363
- }
364
- function Yt(r, e, t, n) {
365
- return Math.sqrt(Math.pow(e.top - r.top, 2) + Math.pow(e.left - r.left, 2)) / Math.sqrt(Math.pow(e.top - t.top, 2) + Math.pow(e.left - t.left, 2)) * n.animation;
366
- }
367
- var Le = [], Xt = { initializeByDefault: !0 }, yt = {
368
- mount: function(e) {
369
- for (var t in Xt) Xt.hasOwnProperty(t) && !(t in e) && (e[t] = Xt[t]);
370
- Le.forEach(function(n) {
371
- if (n.pluginName === e.pluginName) throw "Sortable: Cannot mount plugin ".concat(e.pluginName, " more than once");
372
- }), Le.push(e);
373
- },
374
- pluginEvent: function(e, t, n) {
375
- var i = this;
376
- this.eventCanceled = !1, n.cancel = function() {
377
- i.eventCanceled = !0;
378
- };
379
- var l = e + "Global";
380
- Le.forEach(function(d) {
381
- t[d.pluginName] && (t[d.pluginName][l] && t[d.pluginName][l](a({ sortable: t }, n)), t.options[d.pluginName] && t[d.pluginName][e] && t[d.pluginName][e](a({ sortable: t }, n)));
382
- });
383
- },
384
- initializePlugins: function(e, t, n, i) {
385
- Le.forEach(function(h) {
386
- var v = h.pluginName;
387
- if (!(!e.options[v] && !h.initializeByDefault)) {
388
- var m = new h(e, t, e.options);
389
- m.sortable = e, m.options = e.options, e[v] = m, p(n, m.defaults);
390
- }
391
- });
392
- for (var l in e.options)
393
- if (e.options.hasOwnProperty(l)) {
394
- var d = this.modifyOption(e, l, e.options[l]);
395
- typeof d < "u" && (e.options[l] = d);
396
- }
397
- },
398
- getEventProperties: function(e, t) {
399
- var n = {};
400
- return Le.forEach(function(i) {
401
- typeof i.eventProperties == "function" && p(n, i.eventProperties.call(t[i.pluginName], e));
402
- }), n;
403
- },
404
- modifyOption: function(e, t, n) {
405
- var i;
406
- return Le.forEach(function(l) {
407
- e[l.pluginName] && l.optionListeners && typeof l.optionListeners[t] == "function" && (i = l.optionListeners[t].call(e[l.pluginName], n));
408
- }), i;
409
- }
410
- };
411
- function $e(r) {
412
- var e = r.sortable, t = r.rootEl, n = r.name, i = r.targetEl, l = r.cloneEl, d = r.toEl, h = r.fromEl, v = r.oldIndex, m = r.newIndex, E = r.oldDraggableIndex, _ = r.newDraggableIndex, D = r.originalEvent, G = r.putSortable, N = r.extraEventProperties;
413
- if (e = e || t && t[ue], !!e) {
414
- var z, De = e.options, Ne = "on" + n.charAt(0).toUpperCase() + n.substr(1);
415
- window.CustomEvent && !P && !X ? z = new CustomEvent(n, {
416
- bubbles: !0,
417
- cancelable: !0
418
- }) : (z = document.createEvent("Event"), z.initEvent(n, !0, !0)), z.to = d || t, z.from = h || t, z.item = i || t, z.clone = l, z.oldIndex = v, z.newIndex = m, z.oldDraggableIndex = E, z.newDraggableIndex = _, z.originalEvent = D, z.pullMode = G ? G.lastPutMode : void 0;
419
- var q = a(a({}, N), yt.getEventProperties(n, e));
420
- for (var ee in q) z[ee] = q[ee];
421
- t && t.dispatchEvent(z), De[Ne] && De[Ne].call(e, z);
422
- }
423
- }
424
- var gn = ["evt"], pe = function(e, t) {
425
- var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = n.evt, l = C(n, gn);
426
- yt.pluginEvent.bind(x)(e, t, a({
427
- dragEl: y,
428
- parentEl: re,
429
- ghostEl: k,
430
- rootEl: J,
431
- nextEl: qe,
432
- lastDownEl: et,
433
- cloneEl: K,
434
- cloneHidden: Ve,
435
- dragStarted: wt,
436
- putSortable: de,
437
- activeSortable: x.active,
438
- originalEvent: i,
439
- oldIndex: Ge,
440
- oldDraggableIndex: _e,
441
- newIndex: be,
442
- newDraggableIndex: xe,
443
- hideGhostForTarget: mn,
444
- unhideGhostForTarget: $n,
445
- cloneNowHidden: function() {
446
- Ve = !0;
447
- },
448
- cloneNowShown: function() {
449
- Ve = !1;
450
- },
451
- dispatchSortableEvent: function(h) {
452
- ge({
453
- sortable: t,
454
- name: h,
455
- originalEvent: i
456
- });
457
- }
458
- }, l));
459
- };
460
- function ge(r) {
461
- $e(a({
462
- putSortable: de,
463
- cloneEl: K,
464
- targetEl: y,
465
- rootEl: J,
466
- oldIndex: Ge,
467
- oldDraggableIndex: _e,
468
- newIndex: be,
469
- newDraggableIndex: xe
470
- }, r));
471
- }
472
- var y, re, k, J, qe, et, K, Ve, Ge, be, _e, xe, dt, de, We = !1, tt = !1, ct = [], Ie, Ee, Qt, Zt, Oe, vn, wt, ft, _t, Ct = !1, Nt = !1, nt, ve, Jt = [], Ft = !1, Lt = [], rt = typeof document < "u", St = ye, f = X || P ? "cssFloat" : "float", w = rt && !R && !ye && "draggable" in document.createElement("div"), I = (function() {
473
- if (rt) {
474
- if (P) return !1;
475
- var r = document.createElement("x");
476
- return r.style.cssText = "pointer-events:auto", r.style.pointerEvents === "auto";
477
- }
478
- })(), H = function(e, t) {
479
- var n = U(e), i = parseInt(n.width) - parseInt(n.paddingLeft) - parseInt(n.paddingRight) - parseInt(n.borderLeftWidth) - parseInt(n.borderRightWidth), l = ot(e, 0, t), d = ot(e, 1, t), h = l && U(l), v = d && U(d), m = h && parseInt(h.marginLeft) + parseInt(h.marginRight) + Y(l).width, E = v && parseInt(v.marginLeft) + parseInt(v.marginRight) + Y(d).width;
480
- if (n.display === "flex") return n.flexDirection === "column" || n.flexDirection === "column-reverse" ? "vertical" : "horizontal";
481
- if (n.display === "grid") return n.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
482
- if (l && h.float && h.float !== "none") {
483
- var _ = h.float === "left" ? "left" : "right";
484
- return d && (v.clear === "both" || v.clear === _) ? "vertical" : "horizontal";
485
- }
486
- return l && (h.display === "block" || h.display === "flex" || h.display === "table" || h.display === "grid" || m >= i && n[f] === "none" || d && n[f] === "none" && m + E > i) ? "vertical" : "horizontal";
487
- }, ce = function(e, t, n) {
488
- var i = n ? e.left : e.top, l = n ? e.right : e.bottom, d = n ? e.width : e.height, h = n ? t.left : t.top, v = n ? t.right : t.bottom, m = n ? t.width : t.height;
489
- return i === h || l === v || i + d / 2 === h + m / 2;
490
- }, Ut = function(e, t) {
491
- var n;
492
- return ct.some(function(i) {
493
- var l = i[ue].options.emptyInsertThreshold;
494
- if (!(!l || Ht(i))) {
495
- var d = Y(i), h = e >= d.left - l && e <= d.right + l, v = t >= d.top - l && t <= d.bottom + l;
496
- if (h && v) return n = i;
497
- }
498
- }), n;
499
- }, It = function(e) {
500
- function t(l, d) {
501
- return function(h, v, m, E) {
502
- var _ = h.options.group.name && v.options.group.name && h.options.group.name === v.options.group.name;
503
- if (l == null && (d || _)) return !0;
504
- if (l == null || l === !1) return !1;
505
- if (d && l === "clone") return l;
506
- if (typeof l == "function") return t(l(h, v, m, E), d)(h, v, m, E);
507
- var D = (d ? h : v).options.group.name;
508
- return l === !0 || typeof l == "string" && l === D || l.join && l.indexOf(D) > -1;
509
- };
510
- }
511
- var n = {}, i = e.group;
512
- (!i || o(i) != "object") && (i = { name: i }), n.name = i.name, n.checkPull = t(i.pull, !0), n.checkPut = t(i.put), n.revertClone = i.revertClone, e.group = n;
513
- }, mn = function() {
514
- !I && k && U(k, "display", "none");
515
- }, $n = function() {
516
- !I && k && U(k, "display", "");
517
- };
518
- rt && !R && document.addEventListener("click", function(r) {
519
- if (tt)
520
- return r.preventDefault(), r.stopPropagation && r.stopPropagation(), r.stopImmediatePropagation && r.stopImmediatePropagation(), tt = !1, !1;
521
- }, !0);
522
- var Et = function(e) {
523
- if (y) {
524
- e = e.touches ? e.touches[0] : e;
525
- var t = Ut(e.clientX, e.clientY);
526
- if (t) {
527
- var n = {};
528
- for (var i in e) e.hasOwnProperty(i) && (n[i] = e[i]);
529
- n.target = n.rootEl = t, n.preventDefault = void 0, n.stopPropagation = void 0, t[ue]._onDragOver(n);
530
- }
531
- }
532
- }, _r = function(e) {
533
- y && y.parentNode[ue]._isOutsideThisEl(e.target);
534
- };
535
- function x(r, e) {
536
- if (!(r && r.nodeType && r.nodeType === 1)) throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(r));
537
- this.el = r, this.options = e = p({}, e), r[ue] = this;
538
- var t = {
539
- group: null,
540
- sort: !0,
541
- disabled: !1,
542
- store: null,
543
- handle: null,
544
- draggable: /^[uo]l$/i.test(r.nodeName) ? ">li" : ">*",
545
- swapThreshold: 1,
546
- invertSwap: !1,
547
- invertedSwapThreshold: null,
548
- removeCloneOnHide: !0,
549
- direction: function() {
550
- return H(r, this.options);
551
- },
552
- ghostClass: "sortable-ghost",
553
- chosenClass: "sortable-chosen",
554
- dragClass: "sortable-drag",
555
- ignore: "a, img",
556
- filter: null,
557
- preventOnFilter: !0,
558
- animation: 0,
559
- easing: null,
560
- setData: function(d, h) {
561
- d.setData("Text", h.textContent);
562
- },
563
- dropBubble: !1,
564
- dragoverBubble: !1,
565
- dataIdAttr: "data-id",
566
- delay: 0,
567
- delayOnTouchOnly: !1,
568
- touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
569
- forceFallback: !1,
570
- fallbackClass: "sortable-fallback",
571
- fallbackOnBody: !1,
572
- fallbackTolerance: 0,
573
- fallbackOffset: {
574
- x: 0,
575
- y: 0
576
- },
577
- supportPointer: x.supportPointer !== !1 && "PointerEvent" in window && (!Ue || ye),
578
- emptyInsertThreshold: 5
579
- };
580
- yt.initializePlugins(this, r, t);
581
- for (var n in t) !(n in e) && (e[n] = t[n]);
582
- It(e);
583
- for (var i in this) i.charAt(0) === "_" && typeof this[i] == "function" && (this[i] = this[i].bind(this));
584
- this.nativeDraggable = e.forceFallback ? !1 : w, this.nativeDraggable && (this.options.touchStartThreshold = 1), e.supportPointer ? O(r, "pointerdown", this._onTapStart) : (O(r, "mousedown", this._onTapStart), O(r, "touchstart", this._onTapStart)), this.nativeDraggable && (O(r, "dragover", this), O(r, "dragenter", this)), ct.push(this.el), e.store && e.store.get && this.sort(e.store.get(this) || []), p(this, Bt());
585
- }
586
- x.prototype = /** @lends Sortable.prototype */
587
- {
588
- constructor: x,
589
- _isOutsideThisEl: function(e) {
590
- !this.el.contains(e) && e !== this.el && (ft = null);
591
- },
592
- _getDirection: function(e, t) {
593
- return typeof this.options.direction == "function" ? this.options.direction.call(this, e, t, y) : this.options.direction;
594
- },
595
- _onTapStart: function(e) {
596
- if (e.cancelable) {
597
- var t = this, n = this.el, i = this.options, l = i.preventOnFilter, d = e.type, h = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, v = (h || e).target, m = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || v, E = i.filter;
598
- if (Tr(n), !y && !(/mousedown|pointerdown/.test(d) && e.button !== 0 || i.disabled) && !m.isContentEditable && !(!this.nativeDraggable && Ue && v && v.tagName.toUpperCase() === "SELECT") && (v = Q(v, i.draggable, n, !1), !(v && v.animated) && et !== v)) {
599
- if (Ge = Z(v), _e = Z(v, i.draggable), typeof E == "function") {
600
- if (E.call(this, e, v, this)) {
601
- ge({
602
- sortable: t,
603
- rootEl: m,
604
- name: "filter",
605
- targetEl: v,
606
- toEl: n,
607
- fromEl: n
608
- }), pe("filter", t, { evt: e }), l && e.preventDefault();
609
- return;
610
- }
611
- } else if (E && (E = E.split(",").some(function(_) {
612
- if (_ = Q(m, _.trim(), n, !1), _)
613
- return ge({
614
- sortable: t,
615
- rootEl: _,
616
- name: "filter",
617
- targetEl: v,
618
- fromEl: n,
619
- toEl: n
620
- }), pe("filter", t, { evt: e }), !0;
621
- }), E)) {
622
- l && e.preventDefault();
623
- return;
624
- }
625
- i.handle && !Q(m, i.handle, n, !1) || this._prepareDragStart(e, h, v);
626
- }
627
- }
628
- },
629
- _prepareDragStart: function(e, t, n) {
630
- var i = this, l = i.el, d = i.options, h = l.ownerDocument, v;
631
- if (n && !y && n.parentNode === l) {
632
- var m = Y(n);
633
- if (J = l, y = n, re = y.parentNode, qe = y.nextSibling, et = n, dt = d.group, x.dragged = y, Ie = {
634
- target: y,
635
- clientX: (t || e).clientX,
636
- clientY: (t || e).clientY
637
- }, Oe = Ie.clientX - m.left, vn = Ie.clientY - m.top, this._lastX = (t || e).clientX, this._lastY = (t || e).clientY, y.style["will-change"] = "all", v = function() {
638
- if (pe("delayEnded", i, { evt: e }), x.eventCanceled) {
639
- i._onDrop();
640
- return;
641
- }
642
- i._disableDelayedDragEvents(), !Se && i.nativeDraggable && (y.draggable = !0), i._triggerDragStart(e, t), ge({
643
- sortable: i,
644
- name: "choose",
645
- originalEvent: e
646
- }), S(y, d.chosenClass, !0);
647
- }, d.ignore.split(",").forEach(function(E) {
648
- Ot(y, E.trim(), Mn);
649
- }), O(h, "dragover", Et), O(h, "mousemove", Et), O(h, "touchmove", Et), d.supportPointer ? (O(h, "pointerup", i._onDrop), !this.nativeDraggable && O(h, "pointercancel", i._onDrop)) : (O(h, "mouseup", i._onDrop), O(h, "touchend", i._onDrop), O(h, "touchcancel", i._onDrop)), Se && this.nativeDraggable && (this.options.touchStartThreshold = 4, y.draggable = !0), pe("delayStart", this, { evt: e }), d.delay && (!d.delayOnTouchOnly || t) && (!this.nativeDraggable || !(X || P))) {
650
- if (x.eventCanceled) {
651
- this._onDrop();
652
- return;
653
- }
654
- d.supportPointer ? (O(h, "pointerup", i._disableDelayedDrag), O(h, "pointercancel", i._disableDelayedDrag)) : (O(h, "mouseup", i._disableDelayedDrag), O(h, "touchend", i._disableDelayedDrag), O(h, "touchcancel", i._disableDelayedDrag)), O(h, "mousemove", i._delayedDragTouchMoveHandler), O(h, "touchmove", i._delayedDragTouchMoveHandler), d.supportPointer && O(h, "pointermove", i._delayedDragTouchMoveHandler), i._dragStartTimer = setTimeout(v, d.delay);
655
- } else v();
656
- }
657
- },
658
- _delayedDragTouchMoveHandler: function(e) {
659
- var t = e.touches ? e.touches[0] : e;
660
- Math.max(Math.abs(t.clientX - this._lastX), Math.abs(t.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1)) && this._disableDelayedDrag();
661
- },
662
- _disableDelayedDrag: function() {
663
- y && Mn(y), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
664
- },
665
- _disableDelayedDragEvents: function() {
666
- var e = this.el.ownerDocument;
667
- T(e, "mouseup", this._disableDelayedDrag), T(e, "touchend", this._disableDelayedDrag), T(e, "touchcancel", this._disableDelayedDrag), T(e, "pointerup", this._disableDelayedDrag), T(e, "pointercancel", this._disableDelayedDrag), T(e, "mousemove", this._delayedDragTouchMoveHandler), T(e, "touchmove", this._delayedDragTouchMoveHandler), T(e, "pointermove", this._delayedDragTouchMoveHandler);
668
- },
669
- _triggerDragStart: function(e, t) {
670
- t = t || e.pointerType == "touch" && e, !this.nativeDraggable || t ? this.options.supportPointer ? O(document, "pointermove", this._onTouchMove) : t ? O(document, "touchmove", this._onTouchMove) : O(document, "mousemove", this._onTouchMove) : (O(y, "dragend", this), O(J, "dragstart", this._onDragStart));
671
- try {
672
- document.selection ? yn(function() {
673
- document.selection.empty();
674
- }) : window.getSelection().removeAllRanges();
675
- } catch {
676
- }
677
- },
678
- _dragStarted: function(e, t) {
679
- if (We = !1, J && y) {
680
- pe("dragStarted", this, { evt: t }), this.nativeDraggable && O(document, "dragover", _r);
681
- var n = this.options;
682
- !e && S(y, n.dragClass, !1), S(y, n.ghostClass, !0), x.active = this, e && this._appendGhost(), ge({
683
- sortable: this,
684
- name: "start",
685
- originalEvent: t
686
- });
687
- } else this._nulling();
688
- },
689
- _emulateDragOver: function() {
690
- if (Ee) {
691
- this._lastX = Ee.clientX, this._lastY = Ee.clientY, mn();
692
- for (var e = document.elementFromPoint(Ee.clientX, Ee.clientY), t = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(Ee.clientX, Ee.clientY), e !== t); )
693
- t = e;
694
- if (y.parentNode[ue]._isOutsideThisEl(e), t) do {
695
- if (t[ue]) {
696
- var n = void 0;
697
- if (n = t[ue]._onDragOver({
698
- clientX: Ee.clientX,
699
- clientY: Ee.clientY,
700
- target: e,
701
- rootEl: t
702
- }), n && !this.options.dragoverBubble) break;
703
- }
704
- e = t;
705
- } while (t = he(t));
706
- $n();
707
- }
708
- },
709
- _onTouchMove: function(e) {
710
- if (Ie) {
711
- var t = this.options, n = t.fallbackTolerance, i = t.fallbackOffset, l = e.touches ? e.touches[0] : e, d = k && Ze(k, !0), h = k && d && d.a, v = k && d && d.d, m = St && ve && kt(ve), E = (l.clientX - Ie.clientX + i.x) / (h || 1) + (m ? m[0] - Jt[0] : 0) / (h || 1), _ = (l.clientY - Ie.clientY + i.y) / (v || 1) + (m ? m[1] - Jt[1] : 0) / (v || 1);
712
- if (!x.active && !We) {
713
- if (n && Math.max(Math.abs(l.clientX - this._lastX), Math.abs(l.clientY - this._lastY)) < n) return;
714
- this._onDragStart(e, !0);
715
- }
716
- if (k) {
717
- d ? (d.e += E - (Qt || 0), d.f += _ - (Zt || 0)) : d = {
718
- a: 1,
719
- b: 0,
720
- c: 0,
721
- d: 1,
722
- e: E,
723
- f: _
724
- };
725
- var D = "matrix(".concat(d.a, ",").concat(d.b, ",").concat(d.c, ",").concat(d.d, ",").concat(d.e, ",").concat(d.f, ")");
726
- U(k, "webkitTransform", D), U(k, "mozTransform", D), U(k, "msTransform", D), U(k, "transform", D), Qt = E, Zt = _, Ee = l;
727
- }
728
- e.cancelable && e.preventDefault();
729
- }
730
- },
731
- _appendGhost: function() {
732
- if (!k) {
733
- var e = this.options.fallbackOnBody ? document.body : J, t = Y(y, !0, St, !0, e), n = this.options;
734
- if (St) {
735
- for (ve = e; U(ve, "position") === "static" && U(ve, "transform") === "none" && ve !== document; ) ve = ve.parentNode;
736
- ve !== document.body && ve !== document.documentElement ? (ve === document && (ve = we()), t.top += ve.scrollTop, t.left += ve.scrollLeft) : ve = we(), Jt = kt(ve);
737
- }
738
- k = y.cloneNode(!0), S(k, n.ghostClass, !1), S(k, n.fallbackClass, !0), S(k, n.dragClass, !0), U(k, "transition", ""), U(k, "transform", ""), U(k, "box-sizing", "border-box"), U(k, "margin", 0), U(k, "top", t.top), U(k, "left", t.left), U(k, "width", t.width), U(k, "height", t.height), U(k, "opacity", "0.8"), U(k, "position", St ? "absolute" : "fixed"), U(k, "zIndex", "100000"), U(k, "pointerEvents", "none"), x.ghost = k, e.appendChild(k), U(k, "transform-origin", Oe / parseInt(k.style.width) * 100 + "% " + vn / parseInt(k.style.height) * 100 + "%");
739
- }
740
- },
741
- _onDragStart: function(e, t) {
742
- var n = this, i = e.dataTransfer, l = n.options;
743
- if (pe("dragStart", this, { evt: e }), x.eventCanceled) {
744
- this._onDrop();
745
- return;
746
- }
747
- pe("setupClone", this), x.eventCanceled || (K = Wt(y), K.removeAttribute("id"), K.draggable = !1, K.style["will-change"] = "", this._hideClone(), S(K, this.options.chosenClass, !1), x.clone = K), n.cloneId = yn(function() {
748
- pe("clone", n), !x.eventCanceled && (n.options.removeCloneOnHide || J.insertBefore(K, y), n._hideClone(), ge({
749
- sortable: n,
750
- name: "clone"
751
- }));
752
- }), !t && S(y, l.dragClass, !0), t ? (tt = !0, n._loopId = setInterval(n._emulateDragOver, 50)) : (T(document, "mouseup", n._onDrop), T(document, "touchend", n._onDrop), T(document, "touchcancel", n._onDrop), i && (i.effectAllowed = "move", l.setData && l.setData.call(n, i, y)), O(document, "drop", n), U(y, "transform", "translateZ(0)")), We = !0, n._dragStartId = yn(n._dragStarted.bind(n, t, e)), O(document, "selectstart", n), wt = !0, window.getSelection().removeAllRanges(), Ue && U(document.body, "user-select", "none");
753
- },
754
- _onDragOver: function(e) {
755
- var t = this.el, n = e.target, i, l, d, h = this.options, v = h.group, m = x.active, E = dt === v, _ = h.sort, D = de || m, G, N = this, z = !1;
756
- if (Ft) return;
757
- function De(un, Br) {
758
- pe(un, N, a({
759
- evt: e,
760
- isOwner: E,
761
- axis: G ? "vertical" : "horizontal",
762
- revert: d,
763
- dragRect: i,
764
- targetRect: l,
765
- canSort: _,
766
- fromSortable: D,
767
- target: n,
768
- completed: q,
769
- onMove: function(rr, Rr) {
770
- return bn(J, t, y, i, rr, Y(rr), e, Rr);
771
- },
772
- changed: ee
773
- }, Br));
774
- }
775
- function Ne() {
776
- De("dragOverAnimationCapture"), N.captureAnimationState(), N !== D && D.captureAnimationState();
777
- }
778
- function q(un) {
779
- return De("dragOverCompleted", { insertion: un }), un && (E ? m._hideClone() : m._showClone(N), N !== D && (S(y, de ? de.options.ghostClass : m.options.ghostClass, !1), S(y, h.ghostClass, !0)), de !== N && N !== x.active ? de = N : N === x.active && de && (de = null), D === N && (N._ignoreWhileAnimating = n), N.animateAll(function() {
780
- De("dragOverAnimationComplete"), N._ignoreWhileAnimating = null;
781
- }), N !== D && (D.animateAll(), D._ignoreWhileAnimating = null)), (n === y && !y.animated || n === t && !n.animated) && (ft = null), !h.dragoverBubble && !e.rootEl && n !== document && (y.parentNode[ue]._isOutsideThisEl(e.target), !un && Et(e)), !h.dragoverBubble && e.stopPropagation && e.stopPropagation(), z = !0;
782
- }
783
- function ee() {
784
- be = Z(y), xe = Z(y, h.draggable), ge({
785
- sortable: N,
786
- name: "change",
787
- toEl: t,
788
- newIndex: be,
789
- newDraggableIndex: xe,
790
- originalEvent: e
791
- });
792
- }
793
- if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), n = Q(n, h.draggable, t, !0), De("dragOver"), x.eventCanceled) return z;
794
- if (y.contains(e.target) || n.animated && n.animatingX && n.animatingY || N._ignoreWhileAnimating === n) return q(!1);
795
- if (tt = !1, m && !h.disabled && (E ? _ || (d = re !== J) : de === this || (this.lastPutMode = dt.checkPull(this, m, y, e)) && v.checkPut(this, m, y, e))) {
796
- if (G = this._getDirection(e, n) === "vertical", i = Y(y), De("dragOverValid"), x.eventCanceled) return z;
797
- if (d)
798
- return re = J, Ne(), this._hideClone(), De("revert"), x.eventCanceled || (qe ? J.insertBefore(y, qe) : J.appendChild(y)), q(!0);
799
- var me = Ht(t, h.draggable);
800
- if (!me || Ir(e, G, this) && !me.animated) {
801
- if (me === y) return q(!1);
802
- if (me && t === e.target && (n = me), n && (l = Y(n)), bn(J, t, y, i, n, l, e, !!n) !== !1)
803
- return Ne(), me && me.nextSibling ? t.insertBefore(y, me.nextSibling) : t.appendChild(y), re = t, ee(), q(!0);
804
- } else if (me && Ur(e, G, this)) {
805
- var at = ot(t, 0, h, !0);
806
- if (at === y) return q(!1);
807
- if (n = at, l = Y(n), bn(J, t, y, i, n, l, e, !1) !== !1)
808
- return Ne(), t.insertBefore(y, at), re = t, ee(), q(!0);
809
- } else if (n.parentNode === t) {
810
- l = Y(n);
811
- var Ye = 0, Dt, an = y.parentNode !== t, Me = !ce(y.animated && y.toRect || i, n.animated && n.toRect || l, G), on = G ? "top" : "left", ht = Je(n, "top", "top") || Je(y, "top", "top"), ln = ht ? ht.scrollTop : void 0;
812
- ft !== n && (Dt = l[on], Ct = !1, Nt = !Me && h.invertSwap || an), Ye = Er(e, n, l, G, Me ? 1 : h.swapThreshold, h.invertedSwapThreshold == null ? h.swapThreshold : h.invertedSwapThreshold, Nt, ft === n);
813
- var it;
814
- if (Ye !== 0) {
815
- var At = Z(y);
816
- do
817
- At -= Ye, it = re.children[At];
818
- while (it && (U(it, "display") === "none" || it === k));
819
- }
820
- if (Ye === 0 || it === n) return q(!1);
821
- ft = n, _t = Ye;
822
- var sn = n.nextElementSibling, pt = !1;
823
- pt = Ye === 1;
824
- var Un = bn(J, t, y, i, n, l, e, pt);
825
- if (Un !== !1)
826
- return (Un === 1 || Un === -1) && (pt = Un === 1), Ft = !0, setTimeout(Sr, 30), Ne(), pt && !sn ? t.appendChild(y) : n.parentNode.insertBefore(y, pt ? sn : n), ht && Mt(ht, 0, ln - ht.scrollTop), re = y.parentNode, Dt !== void 0 && !Nt && (nt = Math.abs(Dt - Y(n)[on])), ee(), q(!0);
827
- }
828
- if (t.contains(y)) return q(!1);
829
- }
830
- return !1;
831
- },
832
- _ignoreWhileAnimating: null,
833
- _offMoveEvents: function() {
834
- T(document, "mousemove", this._onTouchMove), T(document, "touchmove", this._onTouchMove), T(document, "pointermove", this._onTouchMove), T(document, "dragover", Et), T(document, "mousemove", Et), T(document, "touchmove", Et);
835
- },
836
- _offUpEvents: function() {
837
- var e = this.el.ownerDocument;
838
- T(e, "mouseup", this._onDrop), T(e, "touchend", this._onDrop), T(e, "pointerup", this._onDrop), T(e, "pointercancel", this._onDrop), T(e, "touchcancel", this._onDrop), T(document, "selectstart", this);
839
- },
840
- _onDrop: function(e) {
841
- var t = this.el, n = this.options;
842
- if (be = Z(y), xe = Z(y, n.draggable), pe("drop", this, { evt: e }), re = y && y.parentNode, be = Z(y), xe = Z(y, n.draggable), x.eventCanceled) {
843
- this._nulling();
844
- return;
845
- }
846
- We = !1, Nt = !1, Ct = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), Pn(this.cloneId), Pn(this._dragStartId), this.nativeDraggable && (T(document, "drop", this), T(t, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), Ue && U(document.body, "user-select", ""), U(y, "transform", ""), e && (wt && (e.cancelable && e.preventDefault(), !n.dropBubble && e.stopPropagation()), k && k.parentNode && k.parentNode.removeChild(k), (J === re || de && de.lastPutMode !== "clone") && K && K.parentNode && K.parentNode.removeChild(K), y && (this.nativeDraggable && T(y, "dragend", this), Mn(y), y.style["will-change"] = "", wt && !We && S(y, de ? de.options.ghostClass : this.options.ghostClass, !1), S(y, this.options.chosenClass, !1), ge({
847
- sortable: this,
848
- name: "unchoose",
849
- toEl: re,
850
- newIndex: null,
851
- newDraggableIndex: null,
852
- originalEvent: e
853
- }), J !== re ? (be >= 0 && (ge({
854
- rootEl: re,
855
- name: "add",
856
- toEl: re,
857
- fromEl: J,
858
- originalEvent: e
859
- }), ge({
860
- sortable: this,
861
- name: "remove",
862
- toEl: re,
863
- originalEvent: e
864
- }), ge({
865
- rootEl: re,
866
- name: "sort",
867
- toEl: re,
868
- fromEl: J,
869
- originalEvent: e
870
- }), ge({
871
- sortable: this,
872
- name: "sort",
873
- toEl: re,
874
- originalEvent: e
875
- })), de && de.save()) : be !== Ge && be >= 0 && (ge({
876
- sortable: this,
877
- name: "update",
878
- toEl: re,
879
- originalEvent: e
880
- }), ge({
881
- sortable: this,
882
- name: "sort",
883
- toEl: re,
884
- originalEvent: e
885
- })), x.active && ((be == null || be === -1) && (be = Ge, xe = _e), ge({
886
- sortable: this,
887
- name: "end",
888
- toEl: re,
889
- originalEvent: e
890
- }), this.save()))), this._nulling();
891
- },
892
- _nulling: function() {
893
- pe("nulling", this), J = y = re = k = qe = K = et = Ve = Ie = Ee = wt = be = xe = Ge = _e = ft = _t = de = dt = x.dragged = x.ghost = x.clone = x.active = null, Lt.forEach(function(e) {
894
- e.checked = !0;
895
- }), Lt.length = Qt = Zt = 0;
896
- },
897
- handleEvent: function(e) {
898
- switch (e.type) {
899
- case "drop":
900
- case "dragend":
901
- this._onDrop(e);
902
- break;
903
- case "dragenter":
904
- case "dragover":
905
- y && (this._onDragOver(e), Cr(e));
906
- break;
907
- case "selectstart":
908
- e.preventDefault();
909
- break;
910
- }
911
- },
912
- toArray: function() {
913
- for (var e = [], t, n = this.el.children, i = 0, l = n.length, d = this.options; i < l; i++)
914
- t = n[i], Q(t, d.draggable, this.el, !1) && e.push(t.getAttribute(d.dataIdAttr) || Ar(t));
915
- return e;
916
- },
917
- sort: function(e, t) {
918
- var n = {}, i = this.el;
919
- this.toArray().forEach(function(l, d) {
920
- var h = i.children[d];
921
- Q(h, this.options.draggable, i, !1) && (n[l] = h);
922
- }, this), t && this.captureAnimationState(), e.forEach(function(l) {
923
- n[l] && (i.removeChild(n[l]), i.appendChild(n[l]));
924
- }), t && this.animateAll();
925
- },
926
- save: function() {
927
- var e = this.options.store;
928
- e && e.set && e.set(this);
929
- },
930
- closest: function(e, t) {
931
- return Q(e, t || this.options.draggable, this.el, !1);
932
- },
933
- option: function(e, t) {
934
- var n = this.options;
935
- if (t === void 0) return n[e];
936
- var i = yt.modifyOption(this, e, t);
937
- typeof i < "u" ? n[e] = i : n[e] = t, e === "group" && It(n);
938
- },
939
- destroy: function() {
940
- pe("destroy", this);
941
- var e = this.el;
942
- e[ue] = null, T(e, "mousedown", this._onTapStart), T(e, "touchstart", this._onTapStart), T(e, "pointerdown", this._onTapStart), this.nativeDraggable && (T(e, "dragover", this), T(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(t) {
943
- t.removeAttribute("draggable");
944
- }), this._onDrop(), this._disableDelayedDragEvents(), ct.splice(ct.indexOf(this.el), 1), this.el = e = null;
945
- },
946
- _hideClone: function() {
947
- if (!Ve) {
948
- if (pe("hideClone", this), x.eventCanceled) return;
949
- U(K, "display", "none"), this.options.removeCloneOnHide && K.parentNode && K.parentNode.removeChild(K), Ve = !0;
950
- }
951
- },
952
- _showClone: function(e) {
953
- if (e.lastPutMode !== "clone") {
954
- this._hideClone();
955
- return;
956
- }
957
- if (Ve) {
958
- if (pe("showClone", this), x.eventCanceled) return;
959
- y.parentNode == J && !this.options.group.revertClone ? J.insertBefore(K, y) : qe ? J.insertBefore(K, qe) : J.appendChild(K), this.options.group.revertClone && this.animate(y, K), U(K, "display", ""), Ve = !1;
960
- }
961
- }
962
- };
963
- function Cr(r) {
964
- r.dataTransfer && (r.dataTransfer.dropEffect = "move"), r.cancelable && r.preventDefault();
965
- }
966
- function bn(r, e, t, n, i, l, d, h) {
967
- var v, m = r[ue], E = m.options.onMove, _;
968
- return window.CustomEvent && !P && !X ? v = new CustomEvent("move", {
969
- bubbles: !0,
970
- cancelable: !0
971
- }) : (v = document.createEvent("Event"), v.initEvent("move", !0, !0)), v.to = e, v.from = r, v.dragged = t, v.draggedRect = n, v.related = i || e, v.relatedRect = l || Y(e), v.willInsertAfter = h, v.originalEvent = d, r.dispatchEvent(v), E && (_ = E.call(m, v, d)), _;
972
- }
973
- function Mn(r) {
974
- r.draggable = !1;
975
- }
976
- function Sr() {
977
- Ft = !1;
978
- }
979
- function Ur(r, e, t) {
980
- var n = Y(ot(t.el, 0, t.options, !0)), i = ut(t.el, t.options, k), l = 10;
981
- return e ? r.clientX < i.left - l || r.clientY < n.top && r.clientX < n.right : r.clientY < i.top - l || r.clientY < n.bottom && r.clientX < n.left;
982
- }
983
- function Ir(r, e, t) {
984
- var n = Y(Ht(t.el, t.options.draggable)), i = ut(t.el, t.options, k), l = 10;
985
- return e ? r.clientX > i.right + l || r.clientY > n.bottom && r.clientX > n.left : r.clientY > i.bottom + l || r.clientX > n.right && r.clientY > n.top;
986
- }
987
- function Er(r, e, t, n, i, l, d, h) {
988
- var v = n ? r.clientY : r.clientX, m = n ? t.height : t.width, E = n ? t.top : t.left, _ = n ? t.bottom : t.right, D = !1;
989
- if (!d) {
990
- if (h && nt < m * i) {
991
- if (!Ct && (_t === 1 ? v > E + m * l / 2 : v < _ - m * l / 2) && (Ct = !0), Ct)
992
- D = !0;
993
- else if (_t === 1 ? v < E + nt : v > _ - nt) return -_t;
994
- } else if (v > E + m * (1 - i) / 2 && v < _ - m * (1 - i) / 2) return Dr(e);
995
- }
996
- return D = D || d, D && (v < E + m * l / 2 || v > _ - m * l / 2) ? v > E + m / 2 ? 1 : -1 : 0;
997
- }
998
- function Dr(r) {
999
- return Z(y) < Z(r) ? 1 : -1;
1000
- }
1001
- function Ar(r) {
1002
- for (var e = r.tagName + r.className + r.src + r.href + r.textContent, t = e.length, n = 0; t--; ) n += e.charCodeAt(t);
1003
- return n.toString(36);
1004
- }
1005
- function Tr(r) {
1006
- Lt.length = 0;
1007
- for (var e = r.getElementsByTagName("input"), t = e.length; t--; ) {
1008
- var n = e[t];
1009
- n.checked && Lt.push(n);
1010
- }
1011
- }
1012
- function yn(r) {
1013
- return setTimeout(r, 0);
1014
- }
1015
- function Pn(r) {
1016
- return clearTimeout(r);
1017
- }
1018
- rt && O(document, "touchmove", function(r) {
1019
- (x.active || We) && r.cancelable && r.preventDefault();
1020
- }), x.utils = {
1021
- on: O,
1022
- off: T,
1023
- css: U,
1024
- find: Ot,
1025
- is: function(e, t) {
1026
- return !!Q(e, t, e, !1);
1027
- },
1028
- extend: kn,
1029
- throttle: st,
1030
- closest: Q,
1031
- toggleClass: S,
1032
- clone: Wt,
1033
- index: Z,
1034
- nextTick: yn,
1035
- cancelNextTick: Pn,
1036
- detectDirection: H,
1037
- getChild: ot,
1038
- expando: ue
1039
- }, x.get = function(r) {
1040
- return r[ue];
1041
- }, x.mount = function() {
1042
- for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++) e[t] = arguments[t];
1043
- e[0].constructor === Array && (e = e[0]), e.forEach(function(n) {
1044
- if (!n.prototype || !n.prototype.constructor) throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(n));
1045
- n.utils && (x.utils = a(a({}, x.utils), n.utils)), yt.mount(n);
1046
- });
1047
- }, x.create = function(r, e) {
1048
- return new x(r, e);
1049
- }, x.version = Be;
1050
- var fe = [], $t, Bn, Rn = !1, Nn, Fn, wn, en;
1051
- function xr() {
1052
- function r() {
1053
- this.defaults = {
1054
- scroll: !0,
1055
- forceAutoScrollFallback: !1,
1056
- scrollSensitivity: 30,
1057
- scrollSpeed: 10,
1058
- bubbleScroll: !0
1059
- };
1060
- for (var e in this) e.charAt(0) === "_" && typeof this[e] == "function" && (this[e] = this[e].bind(this));
1061
- }
1062
- return r.prototype = {
1063
- dragStarted: function(t) {
1064
- var n = t.originalEvent;
1065
- this.sortable.nativeDraggable ? O(document, "dragover", this._handleAutoScroll) : this.options.supportPointer ? O(document, "pointermove", this._handleFallbackAutoScroll) : n.touches ? O(document, "touchmove", this._handleFallbackAutoScroll) : O(document, "mousemove", this._handleFallbackAutoScroll);
1066
- },
1067
- dragOverCompleted: function(t) {
1068
- var n = t.originalEvent;
1069
- !this.options.dragOverBubble && !n.rootEl && this._handleAutoScroll(n);
1070
- },
1071
- drop: function() {
1072
- this.sortable.nativeDraggable ? T(document, "dragover", this._handleAutoScroll) : (T(document, "pointermove", this._handleFallbackAutoScroll), T(document, "touchmove", this._handleFallbackAutoScroll), T(document, "mousemove", this._handleFallbackAutoScroll)), er(), _n(), bt();
1073
- },
1074
- nulling: function() {
1075
- wn = Bn = $t = Rn = en = Nn = Fn = null, fe.length = 0;
1076
- },
1077
- _handleFallbackAutoScroll: function(t) {
1078
- this._handleAutoScroll(t, !0);
1079
- },
1080
- _handleAutoScroll: function(t, n) {
1081
- var i = this, l = (t.touches ? t.touches[0] : t).clientX, d = (t.touches ? t.touches[0] : t).clientY, h = document.elementFromPoint(l, d);
1082
- if (wn = t, n || this.options.forceAutoScrollFallback || X || P || Ue) {
1083
- Ln(t, this.options, h, n);
1084
- var v = He(h, !0);
1085
- Rn && (!en || l !== Nn || d !== Fn) && (en && er(), en = setInterval(function() {
1086
- var m = He(document.elementFromPoint(l, d), !0);
1087
- m !== v && (v = m, _n()), Ln(t, i.options, m, n);
1088
- }, 10), Nn = l, Fn = d);
1089
- } else {
1090
- if (!this.options.bubbleScroll || He(h, !0) === we()) {
1091
- _n();
1092
- return;
1093
- }
1094
- Ln(t, this.options, He(h, !1), !1);
1095
- }
1096
- }
1097
- }, p(r, {
1098
- pluginName: "scroll",
1099
- initializeByDefault: !0
1100
- });
1101
- }
1102
- function _n() {
1103
- fe.forEach(function(r) {
1104
- clearInterval(r.pid);
1105
- }), fe = [];
1106
- }
1107
- function er() {
1108
- clearInterval(en);
1109
- }
1110
- var Ln = st(function(r, e, t, n) {
1111
- if (e.scroll) {
1112
- var i = (r.touches ? r.touches[0] : r).clientX, l = (r.touches ? r.touches[0] : r).clientY, d = e.scrollSensitivity, h = e.scrollSpeed, v = we(), m = !1, E;
1113
- Bn !== t && (Bn = t, _n(), $t = e.scroll, E = e.scrollFn, $t === !0 && ($t = He(t, !0)));
1114
- var _ = 0, D = $t;
1115
- do {
1116
- var G = D, N = Y(G), z = N.top, De = N.bottom, Ne = N.left, q = N.right, ee = N.width, me = N.height, at = void 0, Ye = void 0, Dt = G.scrollWidth, an = G.scrollHeight, Me = U(G), on = G.scrollLeft, ht = G.scrollTop;
1117
- G === v ? (at = ee < Dt && (Me.overflowX === "auto" || Me.overflowX === "scroll" || Me.overflowX === "visible"), Ye = me < an && (Me.overflowY === "auto" || Me.overflowY === "scroll" || Me.overflowY === "visible")) : (at = ee < Dt && (Me.overflowX === "auto" || Me.overflowX === "scroll"), Ye = me < an && (Me.overflowY === "auto" || Me.overflowY === "scroll"));
1118
- var ln = at && (Math.abs(q - i) <= d && on + ee < Dt) - (Math.abs(Ne - i) <= d && !!on), it = Ye && (Math.abs(De - l) <= d && ht + me < an) - (Math.abs(z - l) <= d && !!ht);
1119
- if (!fe[_])
1120
- for (var At = 0; At <= _; At++) fe[At] || (fe[At] = {});
1121
- (fe[_].vx != ln || fe[_].vy != it || fe[_].el !== G) && (fe[_].el = G, fe[_].vx = ln, fe[_].vy = it, clearInterval(fe[_].pid), (ln != 0 || it != 0) && (m = !0, fe[_].pid = setInterval((function() {
1122
- n && this.layer === 0 && x.active._onTouchMove(wn);
1123
- var sn = fe[this.layer].vy ? fe[this.layer].vy * h : 0, pt = fe[this.layer].vx ? fe[this.layer].vx * h : 0;
1124
- typeof E == "function" && E.call(x.dragged.parentNode[ue], pt, sn, r, wn, fe[this.layer].el) !== "continue" || Mt(fe[this.layer].el, pt, sn);
1125
- }).bind({ layer: _ }), 24))), _++;
1126
- } while (e.bubbleScroll && D !== v && (D = He(D, !1)));
1127
- Rn = m;
1128
- }
1129
- }, 30), tr = function(e) {
1130
- var t = e.originalEvent, n = e.putSortable, i = e.dragEl, l = e.activeSortable, d = e.dispatchSortableEvent, h = e.hideGhostForTarget, v = e.unhideGhostForTarget;
1131
- if (t) {
1132
- var m = n || l;
1133
- h();
1134
- var E = t.changedTouches && t.changedTouches.length ? t.changedTouches[0] : t, _ = document.elementFromPoint(E.clientX, E.clientY);
1135
- v(), m && !m.el.contains(_) && (d("spill"), this.onSpill({
1136
- dragEl: i,
1137
- putSortable: n
1138
- }));
1139
- }
1140
- };
1141
- function qn() {
1142
- }
1143
- qn.prototype = {
1144
- startIndex: null,
1145
- dragStart: function(e) {
1146
- this.startIndex = e.oldDraggableIndex;
1147
- },
1148
- onSpill: function(e) {
1149
- var t = e.dragEl, n = e.putSortable;
1150
- this.sortable.captureAnimationState(), n && n.captureAnimationState();
1151
- var i = ot(this.sortable.el, this.startIndex, this.options);
1152
- i ? this.sortable.el.insertBefore(t, i) : this.sortable.el.appendChild(t), this.sortable.animateAll(), n && n.animateAll();
1153
- },
1154
- drop: tr
1155
- }, p(qn, { pluginName: "revertOnSpill" });
1156
- function Gn() {
1157
- }
1158
- Gn.prototype = {
1159
- onSpill: function(e) {
1160
- var t = e.dragEl, n = e.putSortable || this.sortable;
1161
- n.captureAnimationState(), t.parentNode && t.parentNode.removeChild(t), n.animateAll();
1162
- },
1163
- drop: tr
1164
- }, p(Gn, { pluginName: "removeOnSpill" });
1165
- var Re;
1166
- function Or() {
1167
- function r() {
1168
- this.defaults = { swapClass: "sortable-swap-highlight" };
1169
- }
1170
- return r.prototype = {
1171
- dragStart: function(t) {
1172
- Re = t.dragEl;
1173
- },
1174
- dragOverValid: function(t) {
1175
- var n = t.completed, i = t.target, l = t.onMove, d = t.activeSortable, h = t.changed, v = t.cancel;
1176
- if (d.options.swap) {
1177
- var m = this.sortable.el, E = this.options;
1178
- if (i && i !== m) {
1179
- var _ = Re;
1180
- l(i) !== !1 ? (S(i, E.swapClass, !0), Re = i) : Re = null, _ && _ !== Re && S(_, E.swapClass, !1);
1181
- }
1182
- h(), n(!0), v();
1183
- }
1184
- },
1185
- drop: function(t) {
1186
- var n = t.activeSortable, i = t.putSortable, l = t.dragEl, d = i || this.sortable, h = this.options;
1187
- Re && S(Re, h.swapClass, !1), Re && (h.swap || i && i.options.swap) && l !== Re && (d.captureAnimationState(), d !== n && n.captureAnimationState(), kr(l, Re), d.animateAll(), d !== n && n.animateAll());
1188
- },
1189
- nulling: function() {
1190
- Re = null;
1191
- }
1192
- }, p(r, {
1193
- pluginName: "swap",
1194
- eventProperties: function() {
1195
- return { swapItem: Re };
1196
- }
1197
- });
1198
- }
1199
- function kr(r, e) {
1200
- var t = r.parentNode, n = e.parentNode, i, l;
1201
- !t || !n || t.isEqualNode(e) || n.isEqualNode(r) || (i = Z(r), l = Z(e), t.isEqualNode(n) && i < l && l++, t.insertBefore(e, t.children[i]), n.insertBefore(r, n.children[l]));
1202
- }
1203
- var M = [], ke = [], tn, je, nn = !1, Te = !1, qt = !1, $, rn, Cn;
1204
- function Mr() {
1205
- function r(e) {
1206
- for (var t in this) t.charAt(0) === "_" && typeof this[t] == "function" && (this[t] = this[t].bind(this));
1207
- e.options.avoidImplicitDeselect || (e.options.supportPointer ? O(document, "pointerup", this._deselectMultiDrag) : (O(document, "mouseup", this._deselectMultiDrag), O(document, "touchend", this._deselectMultiDrag))), O(document, "keydown", this._checkKeyDown), O(document, "keyup", this._checkKeyUp), this.defaults = {
1208
- selectedClass: "sortable-selected",
1209
- multiDragKey: null,
1210
- avoidImplicitDeselect: !1,
1211
- setData: function(i, l) {
1212
- var d = "";
1213
- M.length && je === e ? M.forEach(function(h, v) {
1214
- d += (v ? ", " : "") + h.textContent;
1215
- }) : d = l.textContent, i.setData("Text", d);
1216
- }
1217
- };
1218
- }
1219
- return r.prototype = {
1220
- multiDragKeyDown: !1,
1221
- isMultiDrag: !1,
1222
- delayStartGlobal: function(t) {
1223
- $ = t.dragEl;
1224
- },
1225
- delayEnded: function() {
1226
- this.isMultiDrag = ~M.indexOf($);
1227
- },
1228
- setupClone: function(t) {
1229
- var n = t.sortable, i = t.cancel;
1230
- if (this.isMultiDrag) {
1231
- for (var l = 0; l < M.length; l++)
1232
- ke.push(Wt(M[l])), ke[l].sortableIndex = M[l].sortableIndex, ke[l].draggable = !1, ke[l].style["will-change"] = "", S(ke[l], this.options.selectedClass, !1), M[l] === $ && S(ke[l], this.options.chosenClass, !1);
1233
- n._hideClone(), i();
1234
- }
1235
- },
1236
- clone: function(t) {
1237
- var n = t.sortable, i = t.rootEl, l = t.dispatchSortableEvent, d = t.cancel;
1238
- this.isMultiDrag && (this.options.removeCloneOnHide || M.length && je === n && (nr(!0, i), l("clone"), d()));
1239
- },
1240
- showClone: function(t) {
1241
- var n = t.cloneNowShown, i = t.rootEl, l = t.cancel;
1242
- this.isMultiDrag && (nr(!1, i), ke.forEach(function(d) {
1243
- U(d, "display", "");
1244
- }), n(), Cn = !1, l());
1245
- },
1246
- hideClone: function(t) {
1247
- var n = this;
1248
- t.sortable;
1249
- var i = t.cloneNowHidden, l = t.cancel;
1250
- this.isMultiDrag && (ke.forEach(function(d) {
1251
- U(d, "display", "none"), n.options.removeCloneOnHide && d.parentNode && d.parentNode.removeChild(d);
1252
- }), i(), Cn = !0, l());
1253
- },
1254
- dragStartGlobal: function(t) {
1255
- t.sortable, !this.isMultiDrag && je && je.multiDrag._deselectMultiDrag(), M.forEach(function(n) {
1256
- n.sortableIndex = Z(n);
1257
- }), M = M.sort(function(n, i) {
1258
- return n.sortableIndex - i.sortableIndex;
1259
- }), qt = !0;
1260
- },
1261
- dragStarted: function(t) {
1262
- var n = this, i = t.sortable;
1263
- if (this.isMultiDrag) {
1264
- if (this.options.sort && (i.captureAnimationState(), this.options.animation)) {
1265
- M.forEach(function(d) {
1266
- d !== $ && U(d, "position", "absolute");
1267
- });
1268
- var l = Y($, !1, !0, !0);
1269
- M.forEach(function(d) {
1270
- d !== $ && pn(d, l);
1271
- }), Te = !0, nn = !0;
1272
- }
1273
- i.animateAll(function() {
1274
- Te = !1, nn = !1, n.options.animation && M.forEach(function(d) {
1275
- Pt(d);
1276
- }), n.options.sort && Sn();
1277
- });
1278
- }
1279
- },
1280
- dragOver: function(t) {
1281
- var n = t.target, i = t.completed, l = t.cancel;
1282
- Te && ~M.indexOf(n) && (i(!1), l());
1283
- },
1284
- revert: function(t) {
1285
- var n = t.fromSortable, i = t.rootEl, l = t.sortable, d = t.dragRect;
1286
- M.length > 1 && (M.forEach(function(h) {
1287
- l.addAnimationState({
1288
- target: h,
1289
- rect: Te ? Y(h) : d
1290
- }), Pt(h), h.fromRect = d, n.removeAnimationState(h);
1291
- }), Te = !1, Pr(!this.options.removeCloneOnHide, i));
1292
- },
1293
- dragOverCompleted: function(t) {
1294
- var n = t.sortable, i = t.isOwner, l = t.insertion, d = t.activeSortable, h = t.parentEl, v = t.putSortable, m = this.options;
1295
- if (l) {
1296
- if (i && d._hideClone(), nn = !1, m.animation && M.length > 1 && (Te || !i && !d.options.sort && !v)) {
1297
- var E = Y($, !1, !0, !0);
1298
- M.forEach(function(D) {
1299
- D !== $ && (pn(D, E), h.appendChild(D));
1300
- }), Te = !0;
1301
- }
1302
- if (!i)
1303
- if (Te || Sn(), M.length > 1) {
1304
- var _ = Cn;
1305
- d._showClone(n), d.options.animation && !Cn && _ && ke.forEach(function(D) {
1306
- d.addAnimationState({
1307
- target: D,
1308
- rect: rn
1309
- }), D.fromRect = rn, D.thisAnimationDuration = null;
1310
- });
1311
- } else d._showClone(n);
1312
- }
1313
- },
1314
- dragOverAnimationCapture: function(t) {
1315
- var n = t.dragRect, i = t.isOwner, l = t.activeSortable;
1316
- if (M.forEach(function(h) {
1317
- h.thisAnimationDuration = null;
1318
- }), l.options.animation && !i && l.multiDrag.isMultiDrag) {
1319
- rn = p({}, n);
1320
- var d = Ze($, !0);
1321
- rn.top -= d.f, rn.left -= d.e;
1322
- }
1323
- },
1324
- dragOverAnimationComplete: function() {
1325
- Te && (Te = !1, Sn());
1326
- },
1327
- drop: function(t) {
1328
- var n = t.originalEvent, i = t.rootEl, l = t.parentEl, d = t.sortable, h = t.dispatchSortableEvent, v = t.oldIndex, m = t.putSortable, E = m || this.sortable;
1329
- if (n) {
1330
- var _ = this.options, D = l.children;
1331
- if (!qt)
1332
- if (_.multiDragKey && !this.multiDragKeyDown && this._deselectMultiDrag(), S($, _.selectedClass, !~M.indexOf($)), ~M.indexOf($))
1333
- M.splice(M.indexOf($), 1), tn = null, $e({
1334
- sortable: d,
1335
- rootEl: i,
1336
- name: "deselect",
1337
- targetEl: $,
1338
- originalEvent: n
1339
- });
1340
- else {
1341
- if (M.push($), $e({
1342
- sortable: d,
1343
- rootEl: i,
1344
- name: "select",
1345
- targetEl: $,
1346
- originalEvent: n
1347
- }), n.shiftKey && tn && d.el.contains(tn)) {
1348
- var G = Z(tn), N = Z($);
1349
- ~G && ~N && G !== N && (function() {
1350
- var q, ee;
1351
- N > G ? (ee = G, q = N) : (ee = N, q = G + 1);
1352
- for (var me = _.filter; ee < q; ee++)
1353
- ~M.indexOf(D[ee]) || Q(D[ee], _.draggable, l, !1) && (me && (typeof me == "function" ? me.call(d, n, D[ee], d) : me.split(",").some(function(at) {
1354
- return Q(D[ee], at.trim(), l, !1);
1355
- })) || (S(D[ee], _.selectedClass, !0), M.push(D[ee]), $e({
1356
- sortable: d,
1357
- rootEl: i,
1358
- name: "select",
1359
- targetEl: D[ee],
1360
- originalEvent: n
1361
- })));
1362
- })();
1363
- } else tn = $;
1364
- je = E;
1365
- }
1366
- if (qt && this.isMultiDrag) {
1367
- if (Te = !1, (l[ue].options.sort || l !== i) && M.length > 1) {
1368
- var z = Y($), De = Z($, ":not(." + this.options.selectedClass + ")");
1369
- if (!nn && _.animation && ($.thisAnimationDuration = null), E.captureAnimationState(), !nn && (_.animation && ($.fromRect = z, M.forEach(function(q) {
1370
- if (q.thisAnimationDuration = null, q !== $) {
1371
- var ee = Te ? Y(q) : z;
1372
- q.fromRect = ee, E.addAnimationState({
1373
- target: q,
1374
- rect: ee
1375
- });
1376
- }
1377
- })), Sn(), M.forEach(function(q) {
1378
- D[De] ? l.insertBefore(q, D[De]) : l.appendChild(q), De++;
1379
- }), v === Z($))) {
1380
- var Ne = !1;
1381
- M.forEach(function(q) {
1382
- if (q.sortableIndex !== Z(q)) {
1383
- Ne = !0;
1384
- return;
1385
- }
1386
- }), Ne && (h("update"), h("sort"));
1387
- }
1388
- M.forEach(function(q) {
1389
- Pt(q);
1390
- }), E.animateAll();
1391
- }
1392
- je = E;
1393
- }
1394
- (i === l || m && m.lastPutMode !== "clone") && ke.forEach(function(q) {
1395
- q.parentNode && q.parentNode.removeChild(q);
1396
- });
1397
- }
1398
- },
1399
- nullingGlobal: function() {
1400
- this.isMultiDrag = qt = !1, ke.length = 0;
1401
- },
1402
- destroyGlobal: function() {
1403
- this._deselectMultiDrag(), T(document, "pointerup", this._deselectMultiDrag), T(document, "mouseup", this._deselectMultiDrag), T(document, "touchend", this._deselectMultiDrag), T(document, "keydown", this._checkKeyDown), T(document, "keyup", this._checkKeyUp);
1404
- },
1405
- _deselectMultiDrag: function(t) {
1406
- if (!(typeof qt < "u" && qt) && je === this.sortable && !(t && Q(t.target, this.options.draggable, this.sortable.el, !1)) && !(t && t.button !== 0))
1407
- for (; M.length; ) {
1408
- var n = M[0];
1409
- S(n, this.options.selectedClass, !1), M.shift(), $e({
1410
- sortable: this.sortable,
1411
- rootEl: this.sortable.el,
1412
- name: "deselect",
1413
- targetEl: n,
1414
- originalEvent: t
1415
- });
1416
- }
1417
- },
1418
- _checkKeyDown: function(t) {
1419
- t.key === this.options.multiDragKey && (this.multiDragKeyDown = !0);
1420
- },
1421
- _checkKeyUp: function(t) {
1422
- t.key === this.options.multiDragKey && (this.multiDragKeyDown = !1);
1423
- }
1424
- }, p(r, {
1425
- pluginName: "multiDrag",
1426
- utils: {
1427
- select: function(t) {
1428
- var n = t.parentNode[ue];
1429
- !n || !n.options.multiDrag || ~M.indexOf(t) || (je && je !== n && (je.multiDrag._deselectMultiDrag(), je = n), S(t, n.options.selectedClass, !0), M.push(t));
1430
- },
1431
- deselect: function(t) {
1432
- var n = t.parentNode[ue], i = M.indexOf(t);
1433
- !n || !n.options.multiDrag || !~i || (S(t, n.options.selectedClass, !1), M.splice(i, 1));
1434
- }
1435
- },
1436
- eventProperties: function() {
1437
- var t = this, n = [], i = [];
1438
- return M.forEach(function(l) {
1439
- n.push({
1440
- multiDragElement: l,
1441
- index: l.sortableIndex
1442
- });
1443
- var d;
1444
- Te && l !== $ ? d = -1 : Te ? d = Z(l, ":not(." + t.options.selectedClass + ")") : d = Z(l), i.push({
1445
- multiDragElement: l,
1446
- index: d
1447
- });
1448
- }), {
1449
- items: B(M),
1450
- clones: [].concat(ke),
1451
- oldIndicies: n,
1452
- newIndicies: i
1453
- };
1454
- },
1455
- optionListeners: { multiDragKey: function(t) {
1456
- return t = t.toLowerCase(), t === "ctrl" ? t = "Control" : t.length > 1 && (t = t.charAt(0).toUpperCase() + t.substr(1)), t;
1457
- } }
1458
- });
1459
- }
1460
- function Pr(r, e) {
1461
- M.forEach(function(t, n) {
1462
- var i = e.children[t.sortableIndex + (r ? Number(n) : 0)];
1463
- i ? e.insertBefore(t, i) : e.appendChild(t);
1464
- });
1465
- }
1466
- function nr(r, e) {
1467
- ke.forEach(function(t, n) {
1468
- var i = e.children[t.sortableIndex + (r ? Number(n) : 0)];
1469
- i ? e.insertBefore(t, i) : e.appendChild(t);
1470
- });
1471
- }
1472
- function Sn() {
1473
- M.forEach(function(r) {
1474
- r !== $ && r.parentNode && r.parentNode.removeChild(r);
1475
- });
1476
- }
1477
- return x.mount(new xr()), x.mount(Gn, qn), x.mount(new Or()), x.mount(new Mr()), x;
1478
- }));
1479
- })))()), jt = "bk_username", ze = {
1480
- USER: "user",
1481
- VIRTUAL: "virtual",
1482
- CUSTOM: "custom",
1483
- USER_GROUP: "userGroup"
1484
- }, ea = /* @__PURE__ */ Symbol("bkUserSelectorApiConfig"), ta = /^[A-Za-z0-9_-]{1,64}$/, zn = {
1485
- apiBaseUrl: "",
1486
- tenantId: "",
1487
- allowedApiOrigins: [],
1488
- allowPrivateApiHost: !1,
1489
- allowCrossOriginCredentials: !1
1490
- }, vr = () => typeof window > "u" || !window.location?.origin ? "http://localhost" : window.location.origin, na = (s) => {
1491
- const c = s.split(".").map(Number);
1492
- if (c.length !== 4 || c.some(Number.isNaN)) return !1;
1493
- const [u, a] = c;
1494
- return u === 10 || u === 127 || u === 172 && a >= 16 && a <= 31 || u === 192 && a === 168 || u === 169 && a === 254 || u === 100 && a >= 64 && a <= 127;
1495
- }, ra = (s) => {
1496
- const c = s.toLowerCase();
1497
- return !!(c === "localhost" || c === "[::1]" || c === "::1" || na(c) || c.startsWith("fc") || c.startsWith("fd"));
1498
- }, mr = (s = []) => {
1499
- const c = vr();
1500
- return Array.from(new Set(s.map((u) => {
1501
- try {
1502
- const a = new URL(u, c);
1503
- return ["http:", "https:"].includes(a.protocol) ? a.origin : "";
1504
- } catch {
1505
- return "";
1506
- }
1507
- }).filter(Boolean)));
1508
- }, br = (s, c = [], u = !1) => {
1509
- if (!s) return "";
1510
- try {
1511
- const a = new URL(s, vr());
1512
- if (!["http:", "https:"].includes(a.protocol))
1513
- return console.warn("[bk-user-selector] apiBaseUrl 仅支持 http/https 协议"), "";
1514
- if (!u && ra(a.hostname))
1515
- return console.warn("[bk-user-selector] apiBaseUrl 指向私网或 localhost,已被安全策略拦截"), "";
1516
- const o = mr(c);
1517
- if (o.length > 0 && !o.includes(a.origin))
1518
- return console.warn("[bk-user-selector] apiBaseUrl 未命中 allowedApiOrigins 白名单,已被安全策略拦截"), "";
1519
- const g = a.pathname.replace(/\/+$/, "");
1520
- return `${a.origin}${g}`;
1521
- } catch {
1522
- return console.warn("[bk-user-selector] apiBaseUrl 格式非法,已被安全策略拦截"), "";
1523
- }
1524
- }, yr = (s) => {
1525
- const c = String(s || "").trim();
1526
- return c ? ta.test(c) ? c : (console.warn("[bk-user-selector] tenantId 格式非法,已被安全策略拦截"), "") : "";
1527
- }, aa = () => zn, ia = (s, c, u = [], a = !1, o = !1, g = {}) => {
1528
- const p = mr(u);
1529
- zn = {
1530
- apiBaseUrl: br(s, p, a),
1531
- tenantId: yr(c),
1532
- allowedApiOrigins: p,
1533
- allowPrivateApiHost: a,
1534
- allowCrossOriginCredentials: o,
1535
- onError: g.onError,
1536
- onUnauthorized: g.onUnauthorized
1537
- }, Lr(ea, zn);
1538
- }, oa = () => `__jsonp_callback_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`, la = (s, c = {}) => new Promise((u, a) => {
1539
- const o = Gr(s), { timeout: g = 1e3 * 60 * 2, params: p } = c, b = oa(), C = document.createElement("script");
1540
- let B = null;
1541
- C.setAttribute("type", "text/javascript");
1542
- const j = () => {
1543
- B && clearTimeout(B), C.parentNode && C.parentNode.removeChild(C), window[b] && delete window[b];
1544
- };
1545
- window[b] = (A) => {
1546
- j(), u(A.data || A);
1547
- }, B = setTimeout(() => {
1548
- j(), a(/* @__PURE__ */ new Error(`JSONP request timeout: ${o}`));
1549
- }, g), C.onerror = () => {
1550
- j(), a(/* @__PURE__ */ new Error(`JSONP request failed: ${o}`));
1551
- }, C.src = `${o}${o.includes("?") ? "&" : "?"}callback=${b}${p ? `&${Object.entries(p).map(([A, F]) => F ? `${A}=${F}` : "").filter(Boolean).join("&")}` : ""}`, document.head.appendChild(C);
1552
- }), cn = "[BkUserSelector]", lr = {
1553
- debug: 0,
1554
- info: 1,
1555
- warn: 2,
1556
- error: 3
1557
- }, sa = {
1558
- level: "warn"
1559
- }, En = (s) => lr[s] >= lr[sa.level], Kn = {
1560
- debug: (s, ...c) => {
1561
- En("debug") && console.debug(`${cn} ${s}`, ...c);
1562
- },
1563
- info: (s, ...c) => {
1564
- En("info") && console.info(`${cn} ${s}`, ...c);
1565
- },
1566
- warn: (s, ...c) => {
1567
- En("warn") && console.warn(`${cn} ${s}`, ...c);
1568
- },
1569
- error: (s, c) => {
1570
- En("error") && console.error(`${cn} ${s}`, c);
1571
- }
1572
- }, sr = (s, c) => {
1573
- if (s)
1574
- try {
1575
- s(c);
1576
- } catch (u) {
1577
- console.error(`${cn} error handler threw:`, u);
1578
- }
1579
- }, ua = (s, c, u, a = !1) => ({
1580
- scene: s,
1581
- cause: c,
1582
- status: u,
1583
- isUnauthorized: a
1584
- }), Tn = (s, c, u, a, o = !1) => {
1585
- o ? Kn.warn(`${s}: 登录态已失效,请重新登录`) : Kn.error(`${s}失败:`, c);
1586
- const g = ua(s, c, a, o);
1587
- o && sr(u?.onUnauthorized, g), sr(u?.onError, g);
1588
- }, Vn = (s, c) => {
1589
- Kn.warn(`${s}需要提供有效的参数: ${c.join(", ")}`);
1590
- }, xn = 401, Wn = (s, c) => {
1591
- if (typeof window > "u" || !window.location?.origin) return "same-origin";
1592
- try {
1593
- return new URL(s, window.location.origin).origin === window.location.origin || c ? "include" : "omit";
1594
- } catch {
1595
- return "same-origin";
1596
- }
1597
- }, Yn = (s, c) => {
1598
- const u = aa(), a = u.allowPrivateApiHost, o = u.allowedApiOrigins;
1599
- return {
1600
- allowCrossOriginCredentials: u.allowCrossOriginCredentials,
1601
- apiBaseUrl: br(u.apiBaseUrl || s, o, a),
1602
- tenantId: yr(u.tenantId || c),
1603
- apiConfig: u
1604
- };
1605
- }, Xn = (s, c, u) => {
1606
- if (!s.ok) {
1607
- if (s.status === xn) {
1608
- const a = /* @__PURE__ */ new Error(`${c}失败: 登录态已失效`);
1609
- throw Tn(c, a, u, s.status, !0), a;
1610
- }
1611
- throw new Error(`${s.status} ${s.statusText}`);
1612
- }
1613
- }, Qn = (s) => {
1614
- if (typeof s == "object" && s !== null && "status" in s) {
1615
- const c = s.status;
1616
- return typeof c == "number" ? c : void 0;
1617
- }
1618
- if (s instanceof Error) {
1619
- const c = /^(\d{3})\s/.exec(s.message);
1620
- if (c) return Number(c[1]);
1621
- }
1622
- }, da = async (s, c) => {
1623
- const u = Yn(s, c);
1624
- if (!u.apiBaseUrl || !u.tenantId)
1625
- return Vn("获取租户信息", ["apiBaseUrl", "tenantId"]), [];
1626
- try {
1627
- const a = `${u.apiBaseUrl}/api/v3/open-web/tenant/data-source-owner-tenants/`, o = Wn(a, u.allowCrossOriginCredentials), g = await fetch(a, {
1628
- method: "GET",
1629
- headers: { "x-bk-tenant-id": u.tenantId },
1630
- credentials: o
1631
- });
1632
- return Xn(g, "获取租户信息", u.apiConfig), (await g.json()).data || [];
1633
- } catch (a) {
1634
- const o = Qn(a);
1635
- return o !== xn && Tn("获取租户信息", a, u.apiConfig, o, !1), [];
1636
- }
1637
- }, ca = async (s) => {
1638
- const { apiBaseUrl: c, tenantId: u, keyword: a, enableMultiTenantMode: o = !0 } = s;
1639
- if (!o) try {
1640
- return await wr(c, {
1641
- keyword: a,
1642
- pageSize: 100,
1643
- page: 1
1644
- });
1645
- } catch {
1646
- return [];
1647
- }
1648
- const g = Yn(c, u);
1649
- if (!a || !g.apiBaseUrl || !g.tenantId)
1650
- return Vn("搜索用户", [
1651
- "apiBaseUrl",
1652
- "tenantId",
1653
- "keyword"
1654
- ]), [];
1655
- try {
1656
- const p = `${g.apiBaseUrl}/api/v3/open-web/tenant/users/-/search/?keyword=${encodeURIComponent(a)}`, b = Wn(p, g.allowCrossOriginCredentials), C = await fetch(p, {
1657
- method: "GET",
1658
- headers: { "x-bk-tenant-id": g.tenantId },
1659
- credentials: b
1660
- });
1661
- return Xn(C, "搜索用户", g.apiConfig), (await C.json()).data || [];
1662
- } catch (p) {
1663
- const b = Qn(p);
1664
- return b !== xn && Tn("搜索用户", p, g.apiConfig, b, !1), [];
1665
- }
1666
- }, An = async (s) => {
1667
- const { apiBaseUrl: c, tenantId: u, exactSearchKey: a = "bk_username", usersList: o = [], enableMultiTenantMode: g = !0 } = s, p = o.filter(Boolean).map((C) => typeof C == "string" ? C.trim() : String(C).trim());
1668
- if (!g) try {
1669
- const C = await wr(c, { userIds: p });
1670
- return p.map((B) => C.find((j) => j.username === B)).filter(Boolean);
1671
- } catch {
1672
- return [];
1673
- }
1674
- const b = Yn(c, u);
1675
- if (p.length === 0 || !b.apiBaseUrl || !b.tenantId)
1676
- return Vn("批量查找用户", [
1677
- "apiBaseUrl",
1678
- "tenantId",
1679
- "usersList"
1680
- ]), [];
1681
- try {
1682
- const C = `${b.apiBaseUrl}/api/v3/open-web/tenant/users/-/lookup/?lookups=${p.join(",")}&lookup_fields=${a}`, B = Wn(C, b.allowCrossOriginCredentials), j = await fetch(C, {
1683
- method: "GET",
1684
- headers: { "x-bk-tenant-id": b.tenantId },
1685
- credentials: B
1686
- });
1687
- return Xn(j, "批量查找用户", b.apiConfig), (await j.json()).data || [];
1688
- } catch (C) {
1689
- const B = Qn(C);
1690
- return B !== xn && Tn("批量查找用户", C, b.apiConfig, B, !1), [];
1691
- }
1692
- }, fn = (s, c = !0) => !s || !Array.isArray(s) ? [] : c ? s.map((u) => ({
1693
- id: u.bk_username,
1694
- name: u.display_name,
1695
- type: u.data_source_type,
1696
- tenantId: u.owner_tenant_id,
1697
- ...u
1698
- })) : s.map((u) => ({
1699
- ...u,
1700
- id: u.username,
1701
- name: `${u.display_name}(${u.username})`,
1702
- type: u.data_source_type,
1703
- tenantId: u.owner_tenant_id
1704
- })), wr = async (s, c) => {
1705
- const { userIds: u, keyword: a, pageSize: o = 20, page: g = 1, appCode: p = "bk-magicbox" } = c;
1706
- return (await la(s, { params: {
1707
- exact_lookups: u?.join(",") || void 0,
1708
- fuzzy_lookups: a || void 0,
1709
- page_size: Math.max(u?.length || 0, 20, Number(o)).toString(),
1710
- page: g.toString(),
1711
- app_code: p
1712
- } }))?.results || [];
1713
- }, fa = (s) => {
1714
- const c = te(!1);
1715
- return {
1716
- loading: c,
1717
- fetchCurrentUser: async () => {
1718
- const a = ne(s.currentUserId);
1719
- if (!a) return null;
1720
- const o = ne(s.enableMultiTenantMode) ?? !0;
1721
- c.value = !0;
1722
- try {
1723
- const g = fn(await An({
1724
- apiBaseUrl: ne(s.apiBaseUrl),
1725
- tenantId: ne(s.tenantId),
1726
- exactSearchKey: ne(s.exactSearchKey) || "bk_username",
1727
- usersList: [a],
1728
- enableMultiTenantMode: o
1729
- }), o);
1730
- return g.length > 0 ? g[0] : null;
1731
- } catch (g) {
1732
- return console.error("获取当前用户信息失败:", g), null;
1733
- } finally {
1734
- c.value = !1;
1735
- }
1736
- }
1737
- };
1738
- };
1739
- function Dn(s) {
1740
- for (var c = 1; c < arguments.length; c++) {
1741
- var u = arguments[c];
1742
- for (var a in u) s[a] = u[a];
1743
- }
1744
- return s;
1745
- }
1746
- var ha = {
1747
- read: function(s) {
1748
- return s[0] === '"' && (s = s.slice(1, -1)), s.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
1749
- },
1750
- write: function(s) {
1751
- return encodeURIComponent(s).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
1752
- }
1753
- };
1754
- function Hn(s, c) {
1755
- function u(o, g, p) {
1756
- if (!(typeof document > "u")) {
1757
- p = Dn({}, c, p), typeof p.expires == "number" && (p.expires = new Date(Date.now() + p.expires * 864e5)), p.expires && (p.expires = p.expires.toUTCString()), o = encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
1758
- var b = "";
1759
- for (var C in p)
1760
- p[C] && (b += "; " + C, p[C] !== !0 && (b += "=" + p[C].split(";")[0]));
1761
- return document.cookie = o + "=" + s.write(g, o) + b;
1762
- }
1763
- }
1764
- function a(o) {
1765
- if (!(typeof document > "u" || arguments.length && !o)) {
1766
- for (var g = document.cookie ? document.cookie.split("; ") : [], p = {}, b = 0; b < g.length; b++) {
1767
- var C = g[b].split("="), B = C.slice(1).join("=");
1768
- try {
1769
- var j = decodeURIComponent(C[0]);
1770
- if (p[j] = s.read(B, j), o === j) break;
1771
- } catch {
1772
- }
1773
- }
1774
- return o ? p[o] : p;
1775
- }
1776
- }
1777
- return Object.create({
1778
- set: u,
1779
- get: a,
1780
- remove: function(o, g) {
1781
- u(o, "", Dn({}, g, { expires: -1 }));
1782
- },
1783
- withAttributes: function(o) {
1784
- return Hn(this.converter, Dn({}, this.attributes, o));
1785
- },
1786
- withConverter: function(o) {
1787
- return Hn(Dn({}, this.converter, o), this.attributes);
1788
- }
1789
- }, {
1790
- attributes: { value: Object.freeze(c) },
1791
- converter: { value: Object.freeze(s) }
1792
- });
1793
- }
1794
- var pa = Hn(ha, { path: "/" }), ga = {
1795
- 我: "Me",
1796
- 请输入人员名称搜索: "Please enter the name of the user to search",
1797
- 最近选择: "Recent selections",
1798
- 用户群组: "User Group",
1799
- 无匹配人员: "No matching users",
1800
- 虚拟账号: "Virtual Account",
1801
- 用户: "User",
1802
- 复制全部: "Copy All",
1803
- 已复制: "Copied",
1804
- 复制失败: "Copy Failed",
1805
- 删除全部: "Delete All",
1806
- "确认删除全部已选人员?": "Delete all selected users?",
1807
- "删除全部后无法撤回,请谨慎确认。": "This action cannot be undone. Please confirm carefully.",
1808
- 取消: "Cancel",
1809
- 删除: "Delete"
1810
- }, va = {
1811
- 我: "我",
1812
- 请输入人员名称搜索: "请输入人员名称搜索",
1813
- 最近选择: "最近选择",
1814
- 用户群组: "用户群组",
1815
- 无匹配人员: "无匹配人员",
1816
- 虚拟账号: "虚拟账号",
1817
- 用户: "用户",
1818
- 复制全部: "复制全部",
1819
- 已复制: "已复制",
1820
- 复制失败: "复制失败",
1821
- 删除全部: "删除全部",
1822
- "确认删除全部已选人员?": "确认删除全部已选人员?",
1823
- "删除全部后无法撤回,请谨慎确认。": "删除全部后无法撤回,请谨慎确认。",
1824
- 取消: "取消",
1825
- 删除: "删除"
1826
- }, ma = "blueking_language", ba = {
1827
- "en-US": ga,
1828
- "zh-CN": va
1829
- }, ya = (s, c, u) => {
1830
- const a = /^\w/.test(c) ? c.split(".") : [c], { length: o } = a;
1831
- let g = s, p = 0;
1832
- for (; p <= o && g; )
1833
- if (typeof g == "string" || (u ? (g = g[a[p]], typeof g == "string" && Object.keys(u).forEach((b) => {
1834
- g = g.replace(`{${b}}`, u[b]);
1835
- })) : g = g[a[p]], p = p + 1, !g)) return g;
1836
- return g;
1837
- }, Zn = () => {
1838
- let s = "zh-CN";
1839
- const c = pa.get(ma);
1840
- c && c.toLowerCase() === "en" && (s = "en-US");
1841
- const u = ba[s];
1842
- return {
1843
- local: s,
1844
- t: (o, g) => {
1845
- const p = ya(u, o, g);
1846
- return p === void 0 && console.warn(`缺少索引 * ${o} *`), p;
1847
- }
1848
- };
1849
- }, wa = (s) => {
1850
- const c = te(!1), u = () => {
1851
- const A = s.onBatchAddUsers, F = ne(s.multiple);
1852
- return {
1853
- apiBaseUrl: ne(s.apiBaseUrl),
1854
- tenantId: ne(s.tenantId),
1855
- searchQuery: s.searchQuery,
1856
- selectedUsers: s.selectedUsers,
1857
- allowCreate: ne(s.allowCreate) ?? !1,
1858
- freePaste: ne(s.freePaste) ?? !1,
1859
- enableMultiTenantMode: ne(s.enableMultiTenantMode) ?? !0,
1860
- maxCount: ne(s.maxCount) ?? 0,
1861
- isUserDisabled: s.isUserDisabled ?? (() => !1),
1862
- onAddUser: s.onAddUser,
1863
- onBatchAddUsers: A,
1864
- shouldBatch: (F ?? !!A) && !!A
1865
- };
1866
- }, a = 100, o = 100, g = (A) => ({
1867
- id: A,
1868
- name: A,
1869
- type: ze.CUSTOM,
1870
- tenantId: "",
1871
- login_name: A
1872
- }), p = (A) => {
1873
- const F = A.split(/[,,;\n\s]+/).filter(Boolean).map((L) => L.trim().replace(/\s*\(.*?\)\s*/, "")).filter(Boolean);
1874
- return Array.from(new Set(F)).slice(0, a);
1875
- }, b = (A, F) => {
1876
- const L = [];
1877
- for (let le = 0; le < A.length; le += F) L.push(A.slice(le, le + F));
1878
- return L;
1879
- }, C = (A, F) => {
1880
- const L = /* @__PURE__ */ new Map();
1881
- for (const le of [...A, ...F]) L.has(le.id) || L.set(le.id, le);
1882
- return Array.from(L.values());
1883
- };
1884
- return {
1885
- isPasting: c,
1886
- parsePastedText: p,
1887
- handleEnterCreate: (A) => {
1888
- const { allowCreate: F, searchQuery: L, selectedUsers: le, isUserDisabled: Be, onAddUser: se } = u();
1889
- if (A.key !== "Enter" || !F || !L.value.trim()) return;
1890
- const P = g(L.value.trim());
1891
- !le.value.some((X) => X.id === P.id) && !Be(P) && se(P);
1892
- },
1893
- handlePaste: async (A) => {
1894
- A.preventDefault();
1895
- const F = A.clipboardData?.getData("text")?.trim();
1896
- if (F) {
1897
- c.value = !0;
1898
- try {
1899
- const L = p(F);
1900
- if (L.length === 0) return;
1901
- const { apiBaseUrl: le, tenantId: Be, enableMultiTenantMode: se, freePaste: P, maxCount: X, isUserDisabled: Se, onAddUser: Ue, onBatchAddUsers: ye, shouldBatch: R, selectedUsers: Ke } = u(), O = b(L, o), T = [];
1902
- for (const he of O) {
1903
- const Q = await An({
1904
- apiBaseUrl: le,
1905
- tenantId: Be,
1906
- exactSearchKey: "login_name",
1907
- usersList: he,
1908
- enableMultiTenantMode: se
1909
- });
1910
- T.push(...Q);
1911
- }
1912
- const ae = fn(T, se).filter((he) => !Se(he));
1913
- if (R) {
1914
- let he = C(Ke.value, ae);
1915
- if (P)
1916
- for (const Q of L) !he.some((Fe) => Fe.login_name === Q || Fe.id === Q) && !Se(Q) && he.push(g(Q));
1917
- X > 0 && he.length > X && (he = he.slice(0, X)), ye?.(he);
1918
- } else ae.length > 0 ? Ue(ae[0]) : P && L.length > 0 && Ue(g(L[0]));
1919
- } catch (L) {
1920
- console.error("精准查找用户失败:", L);
1921
- } finally {
1922
- c.value = !1;
1923
- }
1924
- }
1925
- }
1926
- };
1927
- }, _a = (s, c, u = {}) => {
1928
- const { immediate: a = !0 } = u;
1929
- let o = null;
1930
- const g = () => {
1931
- o && (o.disconnect(), o = null);
1932
- };
1933
- return Xe(s, () => {
1934
- if (g(), !!s.value && (o = new ResizeObserver((b) => {
1935
- for (const C of b) c(C);
1936
- }), o.observe(s.value), a && s.value)) {
1937
- const b = s.value.getBoundingClientRect();
1938
- c({
1939
- target: s.value,
1940
- contentRect: b,
1941
- borderBoxSize: [{
1942
- blockSize: b.height,
1943
- inlineSize: b.width
1944
- }],
1945
- contentBoxSize: [{
1946
- blockSize: b.height,
1947
- inlineSize: b.width
1948
- }],
1949
- devicePixelContentBoxSize: [{
1950
- blockSize: b.height,
1951
- inlineSize: b.width
1952
- }]
1953
- });
1954
- }
1955
- }, { immediate: !0 }), fr(g), g;
1956
- }, Ca = (s, c, u = !0) => {
1957
- const a = te({}), o = te(!1);
1958
- let g = 0;
1959
- const p = async () => {
1960
- const b = ne(s), C = ne(c);
1961
- if (!b || !C) {
1962
- console.warn("获取租户需要提供有效的API基础URL和租户ID");
1963
- return;
1964
- }
1965
- const B = ++g;
1966
- o.value = !0;
1967
- try {
1968
- const j = await da(b, C);
1969
- if (B !== g) return;
1970
- const A = {};
1971
- j.forEach((F) => {
1972
- F.id && F.name && (A[F.id] = F.name);
1973
- }), a.value = A;
1974
- } catch (j) {
1975
- if (B !== g) return;
1976
- console.error("获取租户数据失败:", j);
1977
- } finally {
1978
- B === g && (o.value = !1);
1979
- }
1980
- };
1981
- return cr(() => {
1982
- ne(u) && p();
1983
- }), Xe(() => [
1984
- ne(s),
1985
- ne(c),
1986
- ne(u)
1987
- ], ([, , b]) => {
1988
- b && p();
1989
- }), {
1990
- tenants: a,
1991
- loading: o,
1992
- fetchTenants: p
1993
- };
1994
- }, Sa = (s, c) => {
1995
- let u = null;
1996
- return function(...a) {
1997
- u && clearTimeout(u), u = window.setTimeout(() => {
1998
- s(...a), u = null;
1999
- }, c);
2000
- };
2001
- }, ur = (s, c, u) => {
2002
- if (!s || !c.length) return 0;
2003
- let a = 0, o = 0;
2004
- for (const g of Array.from(c)) {
2005
- const p = g;
2006
- if (!p) continue;
2007
- const b = window.getComputedStyle(p), C = p.offsetWidth, B = parseInt(b.marginLeft, 10) || 0, j = parseInt(b.marginRight, 10) || 0;
2008
- if (a += C + B + j, a > u) break;
2009
- o++;
2010
- }
2011
- return Math.max(1, o);
2012
- }, Ua = (s) => {
2013
- const c = window.getComputedStyle(s), u = parseFloat(c.paddingLeft) || 0, a = parseFloat(c.paddingRight) || 0;
2014
- return Math.max(0, s.clientWidth - u - a);
2015
- }, Ia = (s, c, u) => {
2016
- const a = Ua(s);
2017
- if (ur(s, c, a) >= u) return {
2018
- hiddenCount: 0,
2019
- visibleCount: u
2020
- };
2021
- const o = ur(s, c, a - 48);
2022
- return {
2023
- hiddenCount: Math.max(0, u - o),
2024
- visibleCount: o
2025
- };
2026
- }, Ea = (s, c, u = !0) => {
2027
- const a = te([]), o = te(!1), g = te(""), p = async (j) => {
2028
- if (!j?.length) {
2029
- a.value = [], o.value = !1;
2030
- return;
2031
- }
2032
- const A = ne(s), F = ne(c), L = ne(u);
2033
- if (L && (!A || !F)) {
2034
- console.warn("执行用户搜索需要提供有效的API基础URL和租户ID"), o.value = !1;
2035
- return;
2036
- }
2037
- o.value = !0;
2038
- try {
2039
- a.value = fn(await ca({
2040
- apiBaseUrl: A,
2041
- tenantId: F,
2042
- keyword: j,
2043
- enableMultiTenantMode: L
2044
- }), L);
2045
- } catch (le) {
2046
- console.error("用户搜索失败:", le), a.value = [];
2047
- } finally {
2048
- o.value = !1;
2049
- }
2050
- }, b = Sa(p, 300);
2051
- return {
2052
- searchResults: a,
2053
- loading: o,
2054
- searchQuery: g,
2055
- performSearch: p,
2056
- handleSearchInput: (j) => {
2057
- o.value = !0, g.value = j.trim(), b(g.value);
2058
- },
2059
- clearSearch: () => {
2060
- g.value = "", a.value = [], o.value = !1;
2061
- }
2062
- };
2063
- }, Da = (s) => {
2064
- const { searchQuery: c } = s, u = (b) => ({
2065
- id: b,
2066
- name: b,
2067
- type: ze.CUSTOM,
2068
- tenantId: "",
2069
- login_name: b
2070
- }), a = (b) => ne(s.selectedUserIds).includes(b), o = (b) => {
2071
- const C = ne(s.disabledUserIds) ?? [];
2072
- if (typeof b == "string") return C.includes(b);
2073
- const B = ne(s.disabledUserFields), j = B?.length ? B : ["id"], A = b;
2074
- return j.some((F) => {
2075
- const L = F === "id" ? b.id : A[F];
2076
- return L != null && C.includes(String(L));
2077
- });
2078
- }, g = (b) => {
2079
- const C = ne(s.excludeUserIds) ?? [];
2080
- return b.filter((B) => !a(B.id)).filter((B) => !C.includes(B.id));
2081
- };
2082
- return {
2083
- createCustomUser: u,
2084
- filterNavigableOptions: (b) => g(b).filter((C) => !o(C)),
2085
- isUserSelected: a,
2086
- isUserDisabled: o,
2087
- filterOptions: g,
2088
- filteredUserGroup: V(() => {
2089
- const b = ne(s.userGroup);
2090
- return b?.length ? b.filter((C) => {
2091
- if (!(!a(C.id) && !C.hidden)) return !1;
2092
- const B = c.value.trim();
2093
- return B ? C.id?.includes(B) || C.name?.includes(B) : !0;
2094
- }) : [];
2095
- })
2096
- };
2097
- }, Aa = (s) => typeof s.message == "function" ? s.message() : s.message, dr = async (s, c) => {
2098
- if (!c?.length) return {
2099
- message: "",
2100
- valid: !0
2101
- };
2102
- for (const u of c) {
2103
- let a = !1;
2104
- try {
2105
- a = await u.validator(s);
2106
- } catch {
2107
- a = !1;
2108
- }
2109
- if (!a) return {
2110
- message: Aa(u),
2111
- valid: !1
2112
- };
2113
- }
2114
- return {
2115
- message: "",
2116
- valid: !0
2117
- };
2118
- }, Ta = /* @__PURE__ */ hn({
2119
- name: "MeTag",
2120
- __name: "me-tag",
2121
- props: {
2122
- currentUserId: {
2123
- type: String,
2124
- required: !1,
2125
- default: ""
2126
- },
2127
- isDisabled: {
2128
- type: Boolean,
2129
- required: !1,
2130
- default: !1
2131
- }
2132
- },
2133
- emits: ["click"],
2134
- setup(s, { expose: c, emit: u }) {
2135
- c();
2136
- const { t: a } = Zn(), o = s, g = u, b = {
2137
- t: a,
2138
- props: o,
2139
- emit: g,
2140
- handleClick: () => {
2141
- o.isDisabled || g("click");
2142
- }
2143
- };
2144
- return Object.defineProperty(b, "__isScriptSetup", {
2145
- enumerable: !1,
2146
- value: !0
2147
- }), b;
2148
- }
2149
- }), On = (s, c) => {
2150
- const u = s.__vccOpts || s;
2151
- for (const [a, o] of c) u[a] = o;
2152
- return u;
2153
- };
2154
- function xa(s, c, u, a, o, g) {
2155
- return u.currentUserId ? (W(), oe("div", {
2156
- key: 0,
2157
- class: vt(["me-tag", { disabled: u.isDisabled }]),
2158
- onClick: Pe(a.handleClick, ["stop"])
2159
- }, xt(a.t("我")), 3)) : ie("v-if", !0);
2160
- }
2161
- var Oa = /* @__PURE__ */ On(Ta, [
2162
- ["render", xa],
2163
- ["__scopeId", "data-v-a1054364"],
2164
- ["__file", "/Users/brooklin/project/bkui-monorepo/packages/bk-user-selector/src/components/me-tag.vue"]
2165
- ]), ka = "data:image/svg+xml,%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20style='fill:%20%23A3C5FD;'%3e%3cpath%20fill-rule='evenodd'%20d='M405.7858816%20162.66256256C416.4461344%20160.6535248%20439.8986944%20159.44810208%20457.3815104%20160.25171712%20484.2453504%20161.05533248%20494.052784%20163.4661776%20516.226112%20174.7167888%20567.8217376%20200.43247136%20597.670448%20242.22045568%20606.6250624%20301.28616416%20617.711728%20374.415136%20593.4063488%20443.5260352%20535.8409792%20500.180896%20509.8299584%20525.8965792%20505.565856%20537.5489984%20514.0940608%20557.237568%20521.3430336%20572.9080608%20546.0748224%20586.5695168%20629.2248%20620.3213504%20691.054272%20645.2334208%20760.985536%20687.4232096%20767.8080992%20703.8973216%20774.6306624%20720.3714304%20784.8645056%20752.114224%20791.6870688%20777.4280992%20799.7888608%20807.1618592%20793.3927072%20818.8142784%20761.8383584%20832.4757344%20720.4765728%20850.155264%20669.3073536%20857.3878016%20546.9276416%20862.2094912%20392.9935776%20868.2366048%20227.12002944%20858.5932224%20162.30568672%20840.1100768%20134.5890272%20832.4757344%20108.15159776%20815.1980096%20100.47621504%20799.5275136%2093.6536528%20786.2678656%2094.08006304%20784.2588288%20105.59313696%20746.4889184%20116.67980096%20709.924432%20119.23826176%20705.5045504%20141.41158944%20685.4141728%20143.84821888%20683.2001312%20146.05397248%20681.2036448%20148.2232096%20679.3252416L152.13038144%20676.0501632C159.5946992%20670.0236288%20167.98497088%20664.6722176%20184.94031712%20656.0863296L191.29263904%20652.915344C215.97973152%20640.7492736%20256.51622304%20622.3959904%20329.458464%20589.3821696%20359.7335872%20575.3189056%20371.2466592%20563.6664896%20375.084352%20542.772496%20377.2164032%20530.316464%20374.6579424%20526.7001952%20345.2356416%20496.9664352%20295.34565344%20446.338688%20274.02514592%20396.9163584%20273.59873568%20331.0199232%20273.59873568%20291.24097568%20282.12693888%20265.52529312%20307.71154784%20228.15719168%20332.8697472%20191.19089792%20365.703328%20169.49329056%20405.7858816%20162.66256256ZM668.7713728%20226.60405184C756.683056%20211.50282816%20820.4190272%20263.09867616%20827.0124032%20354.9644544%20831.8475456%20416.6277856%20815.1443264%20461.931456%20770.3093664%20510.1714752%20752.287472%20529.4674848%20747.891888%20536.5986176%20748.3314464%20548.344016%20748.7710048%20555.8946272%20751.4083552%20565.123152%20754.485264%20568.8984576%20757.5621728%20572.2542848%20788.331264%20588.1944672%20823.0563776%20604.1346464%20944.3745024%20659.92528%20966.791984%20682.996592%20958.4403712%20744.6599232%20954.923904%20771.9260224%20956.6821376%20771.0870656%20890.308816%20787.0272448%20867.4517792%20792.8999456%20845.0343008%20798.3531648%20841.0782752%20799.6116%20835.3640128%20801.2895136%20833.1662208%20797.9336864%20830.5288704%20781.5740256%20824.3750528%20739.6261824%20812.0674176%20710.6821696%20790.0894976%20687.6108576%20752.287472%20647.3409248%20703.9360448%20619.6553504%20624.3759712%20593.6476864%20597.5629088%20584.4191616%20560.64%20550.8608864%20560.64%20534.920704%20560.64%20527.7895712%20569.8707264%20514.7857408%20589.6508544%20494.6507744%20620.859504%20461.931456%20639.7605152%20429.631616%20648.5516832%20394.8149056%20655.5846208%20366.7098496%20652.0681504%20283.23364096%20642.837424%20254.7091072%20635.3649312%20231.63779328%20634.4858144%20232.47675008%20668.7713728%20226.60405184Z'%3e%3c/path%3e%3c/svg%3e", Ma = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='32px'%20height='32px'%20viewBox='0%200%2032%2032'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3eIcon/用户%3c/title%3e%3cg%20id='Icon/用户'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='user-(1)'%20transform='translate(3,%202)'%20fill='%23A3C5FD'%20fill-rule='nonzero'%3e%3cpath%20d='M13.0077612,27.9989067%20C10.3002732,27.9989067%207.59285518,28.0018792%204.88515705,27.997455%20C3.95018807,27.9959342%203.05044678,27.8282323%202.22816433,27.3628696%20C0.998627601,26.6672451%200.29953695,25.6114692%200.0864200465,24.2387462%20C-0.0656962495,23.259079%200.0147040645,22.4675755%200.0874005263,21.4879775%20C0.187970957,20.13461%200.423078914,19.3321844%200.863249688,18.0430358%20C1.22365046,16.9873982%201.73014453,16.0067633%202.49702917,15.175719%20C3.42254341,14.1726178%204.6014447,13.7297906%205.9255989,13.6440041%20C6.33292322,13.6073668%206.66741099,13.712025%206.9979768,13.9263185%20C7.58886318,14.3094892%208.17393665,14.7060014%208.79220674,15.0421658%20C10.1097776,15.758321%2011.5447274,16.1099698%2013.0616182,16.0930337%20C14.6806203,16.0750607%2016.2142496,15.63963%2017.592821,14.8169502%20C18.0555431,14.5407189%2018.5150436,14.256538%2018.9569652,13.9491996%20C19.3610679,13.6681294%2019.7808585,13.5749462%2020.274326,13.6337733%20C21.462472,13.7340074%2022.3872158,14.1103345%2023.2340106,14.8851094%20C23.902636,15.496952%2024.3685096,16.2520257%2024.7518119,17.0611566%20C25.272453,18.1598604%2025.5462904,18.7976948%2025.7441396,19.9861253%20C25.9499728,21.2233595%2026.0256808,22.2792045%2025.9924842,23.5308171%20C25.9627193,24.6543374%2025.6405577,25.6840525%2024.8535729,26.5307194%20C24.1686994,27.2671979%2023.3129402,27.7090574%2022.3211027,27.8808379%20C21.9232331,27.9495501%2021.5154185,27.9922014%2021.1120162,27.9935148%20C18.4104811,28.0036073%2015.7090862,27.9989067%2013.0077612,27.9989067%20L13.0077612,27.9989067%20Z%20M5.91775495,6.98479749%20C5.84814002,3.25685016%209.08684454,-0.00255470186%2013.0162355,1.5025268e-06%20C16.9117994,0.00256071584%2020.1304739,3.23452217%2020.1095656,7.04113598%20C20.0884528,10.8082092%2016.8998935,14.015354%2013.0058002,14.0149393%20C9.10134181,14.0145245%205.83322254,10.7695672%205.91775495,6.98479749%20Z'%20id='形状'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/svg%3e", Pa = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='32px'%20height='32px'%20viewBox='0%200%2032%2032'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3eIcon/虚拟icon%3c/title%3e%3cg%20id='Icon/虚拟icon'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M27.4705882,3%20C28.315259,3%2029,3.68474098%2029,4.52941178%20L29,22.4623054%20C29,23.3069762%2028.315259,23.9917172%2027.4705882,23.9917172%20L20.5882353,23.9917172%20L20.5882353,27.0244081%20L24.0294118,27.0244081%20C24.2405794,27.0244081%2024.4117647,27.1955933%2024.4117647,27.406761%20L24.4117647,28.617647%20C24.4117647,28.8288148%2024.2405795,29%2024.0294118,29%20L7.97058824,29%20C7.75942054,29%207.58823529,28.8288148%207.58823529,28.617647%20L7.58823529,27.406761%20C7.58823531,27.1955933%207.75942055,27.0244081%207.97058824,27.0244081%20L11.4117647,27.0244081%20L11.4117647,23.9917172%20L4.52941178,23.9917172%20C3.68474098,23.9917172%203,23.3069762%203,22.4623054%20L3,4.52941178%20C3,3.68474098%203.68474098,3%204.52941178,3%20L27.4705882,3%20Z%20M19,24%20L13,24%20L13,27%20L19,27%20L19,24%20Z%20M23.4117647,7%20L8.58823529,7%20C8.03595054,7%207.58823529,7.44771525%207.58823529,8%20L7.58823529,19%20C7.58823529,19.5522847%208.03595054,20%208.58823529,20%20L23.4117647,20%20C23.9640495,20%2024.4117647,19.5522847%2024.4117647,19%20L24.4117647,8%20C24.4117647,7.44771525%2023.9640495,7%2023.4117647,7%20Z%20M12,10%20C12.5522847,10%2013,10.4477153%2013,11%20L13,13%20C13,13.5522847%2012.5522847,14%2012,14%20C11.4477153,14%2011,13.5522847%2011,13%20L11,11%20C11,10.4477153%2011.4477153,10%2012,10%20Z%20M20,10%20C20.5522847,10%2021,10.4477153%2021,11%20L21,13%20C21,13.5522847%2020.5522847,14%2020,14%20C19.4477153,14%2019,13.5522847%2019,13%20L19,11%20C19,10.4477153%2019.4477153,10%2020,10%20Z%20M26,5%20C25.4477153,5%2025,5.44771525%2025,6%20C25,6.55228475%2025.4477153,7%2026,7%20C26.5522847,7%2027,6.55228475%2027,6%20C27,5.44771525%2026.5522847,5%2026,5%20Z'%20id='蒙版'%20fill='%23A3C5FD'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/svg%3e", Jn = hn({
2166
- name: "UserRender",
2167
- props: {
2168
- user: {
2169
- type: Object,
2170
- required: !0
2171
- },
2172
- tenantId: {
2173
- type: String,
2174
- default: "default"
2175
- },
2176
- tenants: {
2177
- type: Object,
2178
- required: !0
2179
- },
2180
- render: {
2181
- type: Function,
2182
- required: !1
2183
- },
2184
- hasAvatar: {
2185
- type: Boolean,
2186
- default: !1
2187
- },
2188
- avatarBaseUrl: {
2189
- type: String,
2190
- default: ""
2191
- }
2192
- },
2193
- setup(s) {
2194
- const c = (a) => {
2195
- if (a.type === "virtual") return Pa;
2196
- if (a.type === "userGroup") return ka;
2197
- if (!s.avatarBaseUrl) return Ma;
2198
- const o = a.login_name || a.bk_username || a.id;
2199
- return `${s.avatarBaseUrl}${o}.png?default_when_absent=true`;
2200
- }, u = (a, o) => a("div", { style: {
2201
- display: "flex",
2202
- alignItems: "center",
2203
- maxWidth: "100%",
2204
- minWidth: 0,
2205
- overflow: "hidden"
2206
- } }, [
2207
- o.hasAvatar ? a("img", {
2208
- src: c(o.user),
2209
- style: {
2210
- width: "20px",
2211
- height: "20px",
2212
- borderRadius: "50%",
2213
- marginRight: "6px",
2214
- flexShrink: 0
2215
- }
2216
- }) : null,
2217
- a("span", { style: {
2218
- minWidth: 0,
2219
- overflow: "hidden",
2220
- textOverflow: "ellipsis",
2221
- whiteSpace: "nowrap"
2222
- } }, o.user.name),
2223
- o.user.tenantId !== o.tenantId && o.user.tenantId ? a("span", { style: {
2224
- color: "#f59500",
2225
- marginLeft: "4px"
2226
- } }, `@${o.tenants[o.user.tenantId] || o.user.tenantId}`) : null
2227
- ]);
2228
- return () => {
2229
- try {
2230
- return s.render ? s.render(jn, s.user) : u(jn, s);
2231
- } catch (a) {
2232
- return console.error("Error rendering tag:", a), u(jn, s);
2233
- }
2234
- };
2235
- }
2236
- }), Ba = /* @__PURE__ */ hn({
2237
- name: "SelectionPopover",
2238
- __name: "selection-popover",
2239
- props: {
2240
- avatarBaseUrl: {
2241
- type: String,
2242
- required: !1,
2243
- default: ""
2244
- },
2245
- containerWidth: {
2246
- type: [Number, String],
2247
- required: !1,
2248
- default: "auto"
2249
- },
2250
- disabledUserFields: {
2251
- type: Array,
2252
- required: !1,
2253
- default: () => ["id"]
2254
- },
2255
- disabledUserIds: {
2256
- type: Array,
2257
- required: !1,
2258
- default: () => []
2259
- },
2260
- emptyText: {
2261
- type: String,
2262
- required: !1,
2263
- default: ""
2264
- },
2265
- flatOptions: {
2266
- type: Array,
2267
- required: !1,
2268
- default: () => []
2269
- },
2270
- hasAvatar: {
2271
- type: Boolean,
2272
- required: !1,
2273
- default: !1
2274
- },
2275
- highlightedIndex: {
2276
- type: Number,
2277
- required: !1,
2278
- default: -1
2279
- },
2280
- isShow: {
2281
- type: Boolean,
2282
- required: !1,
2283
- default: !1
2284
- },
2285
- loading: {
2286
- type: Boolean,
2287
- required: !1,
2288
- default: !1
2289
- },
2290
- options: {
2291
- type: Array,
2292
- required: !1,
2293
- default: () => []
2294
- },
2295
- recentUsers: {
2296
- type: Array,
2297
- required: !1,
2298
- default: () => []
2299
- },
2300
- recentUsersName: {
2301
- type: String,
2302
- required: !1,
2303
- default: ""
2304
- },
2305
- renderListItem: {
2306
- type: Function,
2307
- required: !1
2308
- },
2309
- searchQuery: {
2310
- type: String,
2311
- required: !1,
2312
- default: ""
2313
- },
2314
- tenantId: {
2315
- type: String,
2316
- required: !1,
2317
- default: "default"
2318
- },
2319
- tenants: {
2320
- type: Object,
2321
- required: !1,
2322
- default: () => ({})
2323
- },
2324
- userGroup: {
2325
- type: Array,
2326
- required: !1,
2327
- default: () => []
2328
- },
2329
- userGroupName: {
2330
- type: String,
2331
- required: !1,
2332
- default: ""
2333
- }
2334
- },
2335
- emits: ["click-outside", "select-user"],
2336
- setup(s, { expose: c, emit: u }) {
2337
- c();
2338
- const { t: a } = Zn(), o = te(null), g = te(null), p = s, b = u, C = V(() => {
2339
- const P = {};
2340
- return Array.isArray(p.userGroup) && p.userGroup.length > 0 && (P[p.userGroupName] = p.userGroup.map((X) => ({
2341
- ...X,
2342
- tenantId: "",
2343
- type: ze.USER_GROUP
2344
- }))), p.options.forEach((X) => {
2345
- const Se = X.data_source_type === ze.VIRTUAL ? a("虚拟账号") : a("用户");
2346
- P[Se] || (P[Se] = []), P[Se].push(X);
2347
- }), P;
2348
- }), B = V(() => Object.values(C.value).some((P) => P.length > 0)), j = V(() => p.recentUsers.length > 0), A = V(() => B.value || j.value), F = (P) => p.highlightedIndex < 0 || !p.flatOptions.length ? !1 : p.flatOptions[p.highlightedIndex] === P, L = (P) => {
2349
- const X = P;
2350
- return p.disabledUserFields.some((Se) => {
2351
- const Ue = Se === "id" ? P.id : X[Se];
2352
- return Ue != null && p.disabledUserIds.includes(String(Ue));
2353
- });
2354
- }, le = (P) => {
2355
- L(P) || b("select-user", P);
2356
- }, Be = ({ event: P }) => {
2357
- const X = P.target;
2358
- o.value?.contains(X) || g.value?.contains(X) || b("click-outside", P);
2359
- };
2360
- Xe(() => p.highlightedIndex, (P) => {
2361
- P < 0 || !g.value || Ae(() => {
2362
- const X = g.value?.querySelector(".user-option.is-highlighted");
2363
- X && X.scrollIntoView({
2364
- block: "nearest",
2365
- inline: "nearest",
2366
- behavior: "auto"
2367
- });
2368
- });
2369
- });
2370
- const se = {
2371
- t: a,
2372
- slotContainerRef: o,
2373
- contentContainerRef: g,
2374
- props: p,
2375
- emit: b,
2376
- groupedUsers: C,
2377
- hasMainOptions: B,
2378
- hasRecentUsers: j,
2379
- hasDropdownOptions: A,
2380
- isHighlighted: F,
2381
- isUserDisabled: L,
2382
- selectUser: le,
2383
- handleClickOutside: Be,
2384
- get Loading() {
2385
- return Kr;
2386
- },
2387
- get Popover() {
2388
- return pr;
2389
- },
2390
- get UserRender() {
2391
- return Jn;
2392
- }
2393
- };
2394
- return Object.defineProperty(se, "__isScriptSetup", {
2395
- enumerable: !1,
2396
- value: !0
2397
- }), se;
2398
- }
2399
- }), Ra = { ref: "contentContainerRef" }, Na = {
2400
- key: 0,
2401
- class: "no-data"
2402
- }, Fa = {
2403
- key: 0,
2404
- class: "dropdown-panel dropdown-panel-main"
2405
- }, La = { class: "group-name" }, qa = { class: "group-count" }, Ga = ["aria-disabled", "onClick"], ja = {
2406
- key: 1,
2407
- class: "dropdown-panel dropdown-panel-recent"
2408
- }, za = { class: "group-name" }, Ka = { class: "group-count" }, Ha = ["aria-disabled", "onClick"], Va = {
2409
- ref: "slotContainerRef",
2410
- class: "selection-trigger"
2411
- };
2412
- function Wa(s, c, u, a, o, g) {
2413
- return W(), Tt(a.Popover, {
2414
- arrow: !1,
2415
- "ext-cls": "bk-user-selector-popover",
2416
- "is-show": u.isShow,
2417
- offset: { mainAxis: 4 },
2418
- placement: "bottom-start",
2419
- theme: "light",
2420
- trigger: "manual",
2421
- width: u.containerWidth,
2422
- onClickoutside: a.handleClickOutside
2423
- }, {
2424
- content: Qe(() => [Ce("div", Ra, [gt(a.Loading, {
2425
- class: "dropdown-content",
2426
- loading: u.loading,
2427
- mode: "spin",
2428
- size: "mini"
2429
- }, {
2430
- default: Qe(() => [a.hasDropdownOptions ? (W(), oe("div", {
2431
- key: 1,
2432
- class: vt(["dropdown-panels", { "is-two-column": a.hasMainOptions && a.hasRecentUsers }])
2433
- }, [a.hasMainOptions ? (W(), oe("div", Fa, [(W(!0), oe(zt, null, Kt(a.groupedUsers, (p, b) => (W(), oe("div", {
2434
- key: b,
2435
- class: "user-group"
2436
- }, [Object.keys(a.groupedUsers).length > 1 || p.some((C) => C.type === "userGroup") ? (W(), oe("div", {
2437
- key: 0,
2438
- class: "group-header",
2439
- onClick: c[0] || (c[0] = Pe(() => {
2440
- }, ["prevent"]))
2441
- }, [Ce("span", La, xt(b), 1), Ce("span", qa, "(" + xt(p.length) + ")", 1)])) : ie("v-if", !0), (W(!0), oe(zt, null, Kt(p, (C) => (W(), oe("div", {
2442
- key: C.id,
2443
- "aria-disabled": a.isUserDisabled(C),
2444
- class: vt(["user-option", {
2445
- "is-highlighted": a.isHighlighted(C),
2446
- "is-disabled": a.isUserDisabled(C)
2447
- }]),
2448
- onClick: Pe((B) => a.selectUser(C), ["prevent"]),
2449
- onMousedown: c[1] || (c[1] = Pe(() => {
2450
- }, ["prevent"]))
2451
- }, [gt(a.UserRender, {
2452
- "avatar-base-url": u.avatarBaseUrl,
2453
- "has-avatar": u.hasAvatar,
2454
- render: u.renderListItem,
2455
- "tenant-id": u.tenantId,
2456
- tenants: u.tenants,
2457
- user: C
2458
- }, null, 8, [
2459
- "avatar-base-url",
2460
- "has-avatar",
2461
- "render",
2462
- "tenant-id",
2463
- "tenants",
2464
- "user"
2465
- ])], 42, Ga))), 128))]))), 128))])) : ie("v-if", !0), a.hasRecentUsers ? (W(), oe("div", ja, [u.recentUsersName ? (W(), oe("div", {
2466
- key: 0,
2467
- class: "group-header",
2468
- onClick: c[2] || (c[2] = Pe(() => {
2469
- }, ["prevent"]))
2470
- }, [Ce("span", za, xt(u.recentUsersName), 1), Ce("span", Ka, "(" + xt(u.recentUsers.length) + ")", 1)])) : ie("v-if", !0), (W(!0), oe(zt, null, Kt(u.recentUsers, (p) => (W(), oe("div", {
2471
- key: p.id,
2472
- "aria-disabled": a.isUserDisabled(p),
2473
- class: vt(["user-option", {
2474
- "is-highlighted": a.isHighlighted(p),
2475
- "is-disabled": a.isUserDisabled(p)
2476
- }]),
2477
- onClick: Pe((b) => a.selectUser(p), ["prevent"]),
2478
- onMousedown: c[3] || (c[3] = Pe(() => {
2479
- }, ["prevent"]))
2480
- }, [gt(a.UserRender, {
2481
- "avatar-base-url": u.avatarBaseUrl,
2482
- "has-avatar": u.hasAvatar,
2483
- render: u.renderListItem,
2484
- "tenant-id": u.tenantId,
2485
- tenants: u.tenants,
2486
- user: p
2487
- }, null, 8, [
2488
- "avatar-base-url",
2489
- "has-avatar",
2490
- "render",
2491
- "tenant-id",
2492
- "tenants",
2493
- "user"
2494
- ])], 42, Ha))), 128))])) : ie("v-if", !0)], 2)) : (W(), oe("div", Na, [Ce("span", null, xt(u.emptyText), 1)]))]),
2495
- _: 1
2496
- }, 8, ["loading"])], 512)]),
2497
- default: Qe(() => [Ce("div", Va, [qr(s.$slots, "default", {}, void 0, !0)], 512)]),
2498
- _: 3
2499
- }, 8, ["is-show", "width"]);
2500
- }
2501
- var Ya = /* @__PURE__ */ On(Ba, [
2502
- ["render", Wa],
2503
- ["__scopeId", "data-v-9173accf"],
2504
- ["__file", "/Users/brooklin/project/bkui-monorepo/packages/bk-user-selector/src/components/selection-popover.vue"]
2505
- ]), Xa = /* @__PURE__ */ hn({
2506
- name: "UserTag",
2507
- __name: "user-tag",
2508
- props: {
2509
- active: {
2510
- type: Boolean,
2511
- required: !1
2512
- },
2513
- avatarBaseUrl: {
2514
- type: String,
2515
- required: !1
2516
- },
2517
- currentTenantId: {
2518
- type: String,
2519
- required: !0
2520
- },
2521
- draggable: {
2522
- type: Boolean,
2523
- required: !1
2524
- },
2525
- hasAvatar: {
2526
- type: Boolean,
2527
- required: !1
2528
- },
2529
- renderTag: {
2530
- type: Function,
2531
- required: !1
2532
- },
2533
- showTenant: {
2534
- type: Boolean,
2535
- required: !1
2536
- },
2537
- tenants: {
2538
- type: Object,
2539
- required: !0
2540
- },
2541
- user: {
2542
- type: Object,
2543
- required: !0
2544
- }
2545
- },
2546
- emits: ["click", "close"],
2547
- setup(s, { expose: c, emit: u }) {
2548
- c();
2549
- const a = u, p = {
2550
- emit: a,
2551
- handleClick: () => {
2552
- a("click");
2553
- },
2554
- handleClose: () => {
2555
- a("close");
2556
- },
2557
- get Tag() {
2558
- return hr;
2559
- },
2560
- get UserRender() {
2561
- return Jn;
2562
- }
2563
- };
2564
- return Object.defineProperty(p, "__isScriptSetup", {
2565
- enumerable: !1,
2566
- value: !0
2567
- }), p;
2568
- }
2569
- });
2570
- function Qa(s, c, u, a, o, g) {
2571
- return W(), Tt(a.Tag, {
2572
- class: vt(["user-tag", {
2573
- draggable: u.draggable,
2574
- active: u.active,
2575
- "is-custom": u.user.type === "custom"
2576
- }]),
2577
- closable: "",
2578
- disabled: "",
2579
- onClick: Pe(a.handleClick, ["stop"]),
2580
- onClose: a.handleClose
2581
- }, {
2582
- default: Qe(() => [gt(a.UserRender, {
2583
- "avatar-base-url": u.avatarBaseUrl,
2584
- "has-avatar": u.hasAvatar,
2585
- render: u.renderTag,
2586
- "tenant-id": u.currentTenantId,
2587
- tenants: u.tenants,
2588
- user: u.user
2589
- }, null, 8, [
2590
- "avatar-base-url",
2591
- "has-avatar",
2592
- "render",
2593
- "tenant-id",
2594
- "tenants",
2595
- "user"
2596
- ])]),
2597
- _: 1
2598
- }, 8, ["class"]);
2599
- }
2600
- var Za = /* @__PURE__ */ On(Xa, [
2601
- ["render", Qa],
2602
- ["__scopeId", "data-v-d1173d20"],
2603
- ["__file", "/Users/brooklin/project/bkui-monorepo/packages/bk-user-selector/src/components/user-tag.vue"]
2604
- ]), Ja = /* @__PURE__ */ hn({
2605
- name: "BkUserSelector",
2606
- __name: "user-selector",
2607
- props: {
2608
- autoFocus: {
2609
- type: Boolean,
2610
- required: !1,
2611
- default: !1
2612
- },
2613
- autoHeight: {
2614
- type: Boolean,
2615
- required: !1,
2616
- default: !1
2617
- },
2618
- draggable: {
2619
- type: Boolean,
2620
- required: !1,
2621
- default: !1
2622
- },
2623
- maxCount: {
2624
- type: Number,
2625
- required: !1,
2626
- default: 0
2627
- },
2628
- mode: {
2629
- type: String,
2630
- required: !1,
2631
- default: "default"
2632
- },
2633
- modelValue: {
2634
- type: [String, Array],
2635
- required: !1,
2636
- default: ""
2637
- },
2638
- multiple: {
2639
- type: Boolean,
2640
- required: !1,
2641
- default: !1
2642
- },
2643
- resize: {
2644
- type: Boolean,
2645
- required: !1,
2646
- default: !0
2647
- },
2648
- rows: {
2649
- type: Number,
2650
- required: !1,
2651
- default: 4
2652
- },
2653
- rules: {
2654
- type: Array,
2655
- required: !1,
2656
- default: () => []
2657
- },
2658
- showCopyAll: {
2659
- type: Boolean,
2660
- required: !1,
2661
- default: !1
2662
- },
2663
- showDeleteAll: {
2664
- type: Boolean,
2665
- required: !1,
2666
- default: !1
2667
- },
2668
- type: {
2669
- type: String,
2670
- required: !1,
2671
- default: "input"
2672
- },
2673
- allowCreate: {
2674
- type: Boolean,
2675
- required: !1,
2676
- default: !1
2677
- },
2678
- allowCrossOriginCredentials: {
2679
- type: Boolean,
2680
- required: !1,
2681
- default: !0
2682
- },
2683
- allowedApiOrigins: {
2684
- type: Array,
2685
- required: !1,
2686
- default: () => []
2687
- },
2688
- allowPrivateApiHost: {
2689
- type: Boolean,
2690
- required: !1,
2691
- default: !0
2692
- },
2693
- apiBaseUrl: {
2694
- type: String,
2695
- required: !0,
2696
- default: ""
2697
- },
2698
- avatarBaseUrl: {
2699
- type: String,
2700
- required: !1,
2701
- default: ""
2702
- },
2703
- currentUserId: {
2704
- type: String,
2705
- required: !1,
2706
- default: ""
2707
- },
2708
- disabled: {
2709
- type: Boolean,
2710
- required: !1,
2711
- default: !1
2712
- },
2713
- disabledUserIds: {
2714
- type: Array,
2715
- required: !1,
2716
- default: () => []
2717
- },
2718
- emptyText: {
2719
- type: String,
2720
- required: !1,
2721
- default: ""
2722
- },
2723
- enableMultiTenantMode: {
2724
- type: Boolean,
2725
- required: !1,
2726
- default: !0
2727
- },
2728
- exactSearchKey: {
2729
- type: String,
2730
- required: !1,
2731
- default: jt
2732
- },
2733
- excludeUserIds: {
2734
- type: Array,
2735
- required: !1,
2736
- default: () => []
2737
- },
2738
- freePaste: {
2739
- type: Boolean,
2740
- required: !1,
2741
- default: !1
2742
- },
2743
- hasAvatar: {
2744
- type: Boolean,
2745
- required: !1,
2746
- default: !1
2747
- },
2748
- placeholder: {
2749
- type: String,
2750
- required: !1,
2751
- default: ""
2752
- },
2753
- recentUserIds: {
2754
- type: Array,
2755
- required: !1,
2756
- default: () => []
2757
- },
2758
- renderListItem: {
2759
- type: Function,
2760
- required: !1
2761
- },
2762
- renderTag: {
2763
- type: Function,
2764
- required: !1
2765
- },
2766
- tenantId: {
2767
- type: String,
2768
- required: !1,
2769
- default: "default"
2770
- },
2771
- userGroup: {
2772
- type: Array,
2773
- required: !1,
2774
- default: () => []
2775
- },
2776
- userGroupName: {
2777
- type: String,
2778
- required: !1,
2779
- default: ""
2780
- }
2781
- },
2782
- emits: [
2783
- "blur",
2784
- "change",
2785
- "dragEnd",
2786
- "dragStart",
2787
- "error",
2788
- "focus",
2789
- "unauthorized",
2790
- "update:modelValue"
2791
- ],
2792
- setup(s, { expose: c, emit: u }) {
2793
- const { t: a } = Zn();
2794
- jr({ prefix: "bk" });
2795
- const o = s, g = u, p = (f) => {
2796
- g("error", f);
2797
- }, b = (f) => {
2798
- g("unauthorized", f);
2799
- };
2800
- ia(o.apiBaseUrl, o.tenantId, o.allowedApiOrigins, o.allowPrivateApiHost, o.allowCrossOriginCredentials, {
2801
- onError: p,
2802
- onUnauthorized: b
2803
- });
2804
- const { tenants: C } = Ca(() => o.apiBaseUrl, () => o.tenantId, () => o.enableMultiTenantMode), { searchResults: B, loading: j, searchQuery: A, clearSearch: F, handleSearchInput: L } = Ea(() => o.apiBaseUrl, () => o.tenantId, () => o.enableMultiTenantMode), { fetchCurrentUser: le } = fa({
2805
- apiBaseUrl: () => o.apiBaseUrl,
2806
- tenantId: () => o.tenantId,
2807
- currentUserId: () => o.currentUserId || "",
2808
- exactSearchKey: () => o.exactSearchKey,
2809
- enableMultiTenantMode: () => o.enableMultiTenantMode
2810
- }), Be = te(null), se = te(null), P = te(null), X = te(null), Se = te(null), Ue = te(null), ye = te(!1), R = te(-1), Ke = te(null), O = te([]), T = te(0), ae = te(-1), he = te([]);
2811
- let Q = 0, Fe = [];
2812
- const S = te([]), U = V(() => o.type === "textarea"), Ze = V(() => o.mode === "cell"), Ot = te(o.rows * 32), we = te({
2813
- message: "",
2814
- valid: !0
2815
- }), Y = V(() => !we.value.valid);
2816
- let Je = 0;
2817
- const ot = V(() => {
2818
- if (U.value)
2819
- return {
2820
- height: `${Ot.value}px`,
2821
- resize: o.resize ? "vertical" : "none",
2822
- overflowY: "auto"
2823
- };
2824
- }), Ht = V(() => U.value ? S.value : O.value), Z = V(() => o.multiple ? Array.isArray(o.modelValue) ? o.modelValue : [] : o.modelValue ? [o.modelValue] : []), kt = () => o.multiple ? Z.value : o.modelValue || "", lt = te(kt()), He = V(() => o.placeholder || a("请输入人员名称搜索")), kn = V(() => o.userGroupName || a("用户群组")), Vt = V(() => o.emptyText || a("无匹配人员")), mt = V(() => a("最近选择")), st = V(() => S.value.map((f) => f.id)), bt = V(() => o.multiple && !o.disabled && S.value.length > 0 && (o.showCopyAll || o.showDeleteAll)), Mt = V(() => Number(bt.value && o.showCopyAll) + Number(bt.value && o.showDeleteAll) + +!!o.currentUserId), Wt = V(() => Mt.value > 0), pn = V(() => {
2825
- const f = Number(bt.value && o.showCopyAll) * 20 + Number(bt.value && o.showDeleteAll) * 20 + +!!o.currentUserId * 24, w = Math.max(0, Mt.value - 1) * 8;
2826
- return `${18 + f + w}px`;
2827
- }), Pt = (f, w) => w ? [
2828
- f.id,
2829
- f.name,
2830
- f.bk_username,
2831
- f.username,
2832
- f.login_name,
2833
- f.display_name,
2834
- f.full_name
2835
- ].some((I) => String(I || "").includes(w)) : !0, ut = (f) => f.split(",").map((w) => w.trim()).filter(Boolean), ue = V(() => [.../* @__PURE__ */ new Set([
2836
- "id",
2837
- ...ut(o.exactSearchKey),
2838
- jt,
2839
- "login_name",
2840
- "username"
2841
- ])]), Bt = (f, w, I) => f.find((H) => {
2842
- if (H.id === w) return !0;
2843
- const ce = H;
2844
- return I.some((Ut) => String(ce[Ut] || "") === w);
2845
- }), Rt = (f, w, I) => w.map((H) => Bt(f, H, I)).filter(Boolean), Yt = async (f) => {
2846
- const w = ut(o.exactSearchKey), I = fn(await An({
2847
- apiBaseUrl: o.apiBaseUrl,
2848
- tenantId: o.tenantId,
2849
- exactSearchKey: o.exactSearchKey,
2850
- usersList: f,
2851
- enableMultiTenantMode: o.enableMultiTenantMode
2852
- }), o.enableMultiTenantMode), H = f.filter((It) => !Bt(I, It, w));
2853
- if (H.length === 0 || o.exactSearchKey === "bk_username") return Rt(I, f, w);
2854
- const ce = fn(await An({
2855
- apiBaseUrl: o.apiBaseUrl,
2856
- tenantId: o.tenantId,
2857
- exactSearchKey: jt,
2858
- usersList: H,
2859
- enableMultiTenantMode: o.enableMultiTenantMode
2860
- }), o.enableMultiTenantMode), Ut = [...I];
2861
- return ce.forEach((It) => {
2862
- Ut.some((mn) => mn.id === It.id) || Ut.push(It);
2863
- }), Rt(Ut, f, [.../* @__PURE__ */ new Set([...w, jt])]);
2864
- }, Le = V(() => !o.maxCount || o.maxCount <= 0 ? !1 : S.value.length >= o.maxCount), Xt = V(() => Le.value || !!o.currentUserId && o.disabledUserIds.includes(o.currentUserId) || !!o.currentUserId && S.value.some((f) => f[o.exactSearchKey] === o.currentUserId)), yt = V(() => ({
2865
- avatarBaseUrl: o.avatarBaseUrl,
2866
- currentTenantId: o.tenantId,
2867
- hasAvatar: o.hasAvatar,
2868
- renderTag: o.renderTag,
2869
- tenants: C.value
2870
- })), { filteredUserGroup: $e, filterOptions: gn, filterNavigableOptions: pe, createCustomUser: ge, isUserDisabled: y } = Da({
2871
- selectedUserIds: st,
2872
- disabledUserFields: ue,
2873
- disabledUserIds: () => o.disabledUserIds,
2874
- excludeUserIds: () => o.excludeUserIds,
2875
- userGroup: () => o.userGroup,
2876
- searchQuery: A
2877
- }), { handlePaste: re } = wa({
2878
- apiBaseUrl: () => o.apiBaseUrl,
2879
- tenantId: () => o.tenantId,
2880
- searchQuery: A,
2881
- selectedUsers: S,
2882
- allowCreate: () => o.allowCreate,
2883
- freePaste: () => o.freePaste,
2884
- enableMultiTenantMode: () => o.enableMultiTenantMode,
2885
- maxCount: () => o.maxCount,
2886
- multiple: () => o.multiple,
2887
- isUserDisabled: y,
2888
- onAddUser: nt,
2889
- onBatchAddUsers: _e
2890
- }), k = V(() => gn(B.value)), J = V(() => {
2891
- const f = pe($e.value.map((ce) => ({
2892
- ...ce,
2893
- tenantId: "",
2894
- type: ze.USER_GROUP
2895
- }))), w = pe(k.value), I = w.filter((ce) => ce.data_source_type !== ze.VIRTUAL), H = w.filter((ce) => ce.data_source_type === ze.VIRTUAL);
2896
- return [
2897
- ...f,
2898
- ...I,
2899
- ...H
2900
- ];
2901
- }), qe = V(() => {
2902
- const f = A.value.trim();
2903
- return he.value.filter((w) => !st.value.includes(w.id)).filter((w) => !o.excludeUserIds.includes(w.id)).filter((w) => Pt(w, f));
2904
- }), et = V(() => ye.value && ($e.value.length > 0 || qe.value.length > 0 || A.value.trim() !== "")), K = V(() => [...J.value, ...pe(qe.value)]), Ve = V(() => {
2905
- const f = A.value;
2906
- if (!f) return "20px";
2907
- const w = f.split("").reduce((I, H) => I + (/[\u4e00-\u9fa5]/.test(H) ? 12 : 8), 0);
2908
- return `${Math.max(20, w + 4)}px`;
2909
- }), Ge = async () => {
2910
- const f = Z.value;
2911
- if (f.length === 0) {
2912
- S.value = [];
2913
- return;
2914
- }
2915
- let w = [];
2916
- o.userGroup.length > 0 && (w = o.userGroup.filter((I) => f.includes(I.id)).map((I) => ({
2917
- ...I,
2918
- tenantId: "",
2919
- type: ze.USER_GROUP
2920
- })));
2921
- try {
2922
- const I = [...w, ...await Yt(f)];
2923
- if (o.allowCreate) {
2924
- const H = [.../* @__PURE__ */ new Set([...ut(o.exactSearchKey), jt])];
2925
- I.push(...f.filter((ce) => !Bt(I, ce, H)).map((ce) => ({
2926
- id: ce,
2927
- name: ce,
2928
- type: ze.CUSTOM,
2929
- tenantId: ""
2930
- })));
2931
- }
2932
- S.value = Rt(I, f, [.../* @__PURE__ */ new Set([...ut(o.exactSearchKey), jt])]);
2933
- } catch (I) {
2934
- console.error("获取选中用户信息失败:", I), S.value = [];
2935
- }
2936
- }, be = async () => {
2937
- const f = o.recentUserIds.filter(Boolean), w = ++Q;
2938
- if (Fe = [...f], f.length === 0) {
2939
- he.value = [];
2940
- return;
2941
- }
2942
- try {
2943
- const I = (await Yt(f)).filter((H) => H.data_source_type !== ze.VIRTUAL && H.type !== ze.USER_GROUP);
2944
- if (w !== Q) return;
2945
- he.value = I;
2946
- } catch (I) {
2947
- if (w !== Q) return;
2948
- console.error("获取最近选择用户信息失败:", I), he.value = [];
2949
- }
2950
- };
2951
- function _e(f) {
2952
- if (S.value = f, o.multiple) {
2953
- const w = f.map((I) => I.id);
2954
- lt.value = w, g("update:modelValue", w), g("change", f), dt(w);
2955
- } else {
2956
- const w = f.length > 0 ? f[0] : null, I = w ? w.id : "";
2957
- lt.value = I, g("update:modelValue", I), g("change", w), dt(I);
2958
- }
2959
- }
2960
- const xe = async () => {
2961
- const f = ++Je, w = await dr(lt.value, o.rules);
2962
- return f === Je && (we.value = w), w.valid;
2963
- }, dt = (f) => {
2964
- if (!Y.value) return;
2965
- const w = ++Je;
2966
- dr(f, o.rules).then((I) => {
2967
- w === Je && (we.value = I);
2968
- });
2969
- }, de = async () => {
2970
- if (!await xe()) throw new Error(we.value.message);
2971
- return lt.value;
2972
- }, We = () => {
2973
- !o.draggable || !o.multiple || !se.value || (Ke.value && Ke.value.destroy(), Ke.value = new $r.default(se.value, {
2974
- animation: 150,
2975
- draggable: ".tag-wrapper",
2976
- onStart: (f) => {
2977
- g("dragStart", f);
2978
- },
2979
- onEnd: (f) => {
2980
- const { oldIndex: w, newIndex: I } = f;
2981
- if (w === I || w === void 0 || I === void 0) return;
2982
- const H = [...S.value], [ce] = H.splice(w, 1);
2983
- H.splice(I, 0, ce), _e(H), g("dragEnd", f);
2984
- }
2985
- }));
2986
- }, tt = () => {
2987
- if (!S.value.length || U.value) {
2988
- O.value = U.value ? [...S.value] : [], T.value = 0;
2989
- return;
2990
- }
2991
- if (!P.value) {
2992
- O.value = [...S.value], T.value = 0;
2993
- return;
2994
- }
2995
- const f = P.value.querySelectorAll(".user-tag");
2996
- if (f.length !== S.value.length) {
2997
- O.value = [...S.value], T.value = 0, Ae(tt);
2998
- return;
2999
- }
3000
- const { hiddenCount: w, visibleCount: I } = Ia(P.value, f, S.value.length);
3001
- O.value = S.value.slice(0, I), T.value = w;
3002
- }, ct = () => {
3003
- ye.value = !0, R.value = S.value.length - 1, Ae(() => Oe());
3004
- }, Ie = () => {
3005
- ye.value || Ae(tt);
3006
- }, Ee = () => {
3007
- ye.value && g("blur"), ye.value = !1, R.value = S.value.length - 1, F(), ae.value = -1, Ie();
3008
- }, Qt = (f) => {
3009
- const w = f.target, I = Be.value;
3010
- I?.contains(w) || I === w || Ee();
3011
- }, Zt = () => {
3012
- R.value = S.value.length - 1, Ae(() => Oe());
3013
- }, Oe = () => {
3014
- R.value === -1 && S.value.length > 0 ? X.value?.focus() : R.value >= S.value.length - 1 ? Ue.value?.focus() : Se.value?.[0]?.focus();
3015
- }, vn = (f) => {
3016
- R.value = f, Ae(() => Oe());
3017
- }, wt = () => {
3018
- g("focus"), ye.value = !0;
3019
- }, ft = () => {
3020
- L(A.value);
3021
- }, _t = async () => {
3022
- if (!o.currentUserId || o.disabledUserIds.includes(o.currentUserId) || S.value.some((w) => w[o.exactSearchKey] === o.currentUserId) || o.multiple && Le.value) return;
3023
- const f = await le();
3024
- if (f) {
3025
- if (y(f)) return;
3026
- o.multiple ? S.value.some((w) => w.id === f.id) || _e([...S.value, f]) : _e([f]), F(), ae.value = -1, ye.value = !0, R.value = S.value.length - 1, Ae(() => Oe());
3027
- }
3028
- }, Ct = async (f) => {
3029
- await re(f), R.value = S.value.length - 1, Ae(() => Oe());
3030
- }, Nt = (f) => {
3031
- const w = f.target;
3032
- if (!(f.isComposing || f.keyCode === 229 || w?.composing)) {
3033
- if (f.key === "Backspace" && !A.value && S.value.length > 0) {
3034
- if (R.value >= 0) {
3035
- const I = S.value[R.value], H = R.value > 0 ? R.value - 1 : -1;
3036
- _e(S.value.filter((ce) => ce.id !== I.id)), R.value = H, Ie(), Ae(() => Oe());
3037
- }
3038
- return;
3039
- }
3040
- if (f.key === "ArrowDown" && et.value && K.value.length > 0) {
3041
- f.preventDefault();
3042
- const I = K.value.length - 1;
3043
- ae.value = Math.min(ae.value + 1, I);
3044
- return;
3045
- }
3046
- if (f.key === "ArrowUp" && et.value && K.value.length > 0) {
3047
- f.preventDefault(), ae.value = Math.max(ae.value - 1, 0);
3048
- return;
3049
- }
3050
- if (f.key === "Enter") {
3051
- o.allowCreate && A.value ? nt(ge(A.value)) : ae.value >= 0 && K.value[ae.value] && nt(K.value[ae.value]);
3052
- return;
3053
- }
3054
- if (f.key === "ArrowLeft" && !A.value && S.value.length > 0) {
3055
- f.preventDefault(), R.value === 0 ? R.value = -1 : R.value > 0 && R.value--, Ae(() => Oe());
3056
- return;
3057
- }
3058
- if (f.key === "ArrowRight" && !A.value && S.value.length > 0) {
3059
- f.preventDefault(), R.value === -1 ? R.value = 0 : R.value < S.value.length - 1 && R.value++, Ae(() => Oe());
3060
- return;
3061
- }
3062
- }
3063
- };
3064
- function nt(f) {
3065
- if (f?.id && !y(f)) {
3066
- if (o.multiple && Le.value) {
3067
- F(), ae.value = -1;
3068
- return;
3069
- }
3070
- if (!o.multiple)
3071
- _e([f]), R.value = 0;
3072
- else if (!S.value.some((w) => w.id === f.id)) {
3073
- let w, I;
3074
- R.value === -1 ? (w = [f, ...S.value], I = 0) : (w = [
3075
- ...S.value.slice(0, R.value + 1),
3076
- f,
3077
- ...S.value.slice(R.value + 1)
3078
- ], I = R.value + 1), _e(w), R.value = I;
3079
- }
3080
- F(), ae.value = -1, ye.value = !0, Ae(() => Oe());
3081
- }
3082
- }
3083
- const ve = (f) => {
3084
- if (!f?.id) return;
3085
- const w = S.value.findIndex((H) => H.id === f.id), I = S.value.filter((H) => H.id !== f.id);
3086
- _e(I), I.length === 0 ? R.value = -1 : R.value > w ? R.value-- : R.value >= I.length && (R.value = I.length - 1), Ie();
3087
- }, Jt = () => {
3088
- S.value.length && (R.value = -1, F(), _e([]), Ie());
3089
- }, Ft = async (f) => {
3090
- if (navigator.clipboard?.writeText) try {
3091
- await navigator.clipboard.writeText(f);
3092
- return;
3093
- } catch {
3094
- }
3095
- const w = document.createElement("textarea");
3096
- w.value = f, w.setAttribute("readonly", ""), w.style.position = "fixed", w.style.opacity = "0", document.body.appendChild(w), w.select();
3097
- const I = document.execCommand("copy");
3098
- if (document.body.removeChild(w), !I) throw new Error("复制失败");
3099
- }, Lt = async () => {
3100
- if (st.value.length)
3101
- try {
3102
- await Ft(st.value.join(";")), or({
3103
- message: a("已复制"),
3104
- theme: "success"
3105
- });
3106
- } catch (f) {
3107
- or({
3108
- message: a("复制失败"),
3109
- theme: "error"
3110
- }), console.error("复制全部用户失败:", f);
3111
- }
3112
- };
3113
- Xe(S, () => {
3114
- Ie();
3115
- }, { deep: !0 }), Xe(ye, (f) => {
3116
- if (U.value) {
3117
- const w = f ? P.value : Be.value?.querySelector(".tags-container.focused");
3118
- w && w.offsetHeight > 0 && (Ot.value = w.offsetHeight);
3119
- }
3120
- f && Ae(() => We());
3121
- }), Xe(K, (f) => {
3122
- f.length > 0 && et.value ? ae.value = 0 : ae.value = -1;
3123
- }), Xe(() => o.userGroup, () => {
3124
- Ge();
3125
- }), Xe(() => o.recentUserIds, () => {
3126
- const f = o.recentUserIds.filter(Boolean);
3127
- Fe.length === f.length && Fe.every((w, I) => w === f[I]) || be();
3128
- }, { deep: !0 }), Xe([() => o.modelValue, () => o.multiple], () => {
3129
- lt.value = kt();
3130
- const f = S.value.map((I) => I.id), w = Z.value;
3131
- (f.length !== w.length || !f.every((I, H) => I === w[H])) && Ge();
3132
- }, { deep: !0 }), Xe(() => o.rules, () => {
3133
- !Y.value && (o.rules?.length ?? 0) > 0 || xe();
3134
- }, { deep: !0 }), _a(Be, () => {
3135
- Ie();
3136
- });
3137
- let rt;
3138
- cr(() => {
3139
- rt = Promise.all([Ge(), be()]).then(() => {
3140
- });
3141
- }), Fr(async () => {
3142
- We(), Ae(tt), o.autoFocus && !o.disabled && (await rt, await Ae(), ct());
3143
- }), fr(() => {
3144
- Ke.value?.destroy();
3145
- }), c({
3146
- focus: ct,
3147
- blur: Ee,
3148
- validate: xe,
3149
- getValue: de
3150
- });
3151
- const St = {
3152
- t: a,
3153
- props: o,
3154
- emit: g,
3155
- handleApiError: p,
3156
- handleApiUnauthorized: b,
3157
- tenants: C,
3158
- searchResults: B,
3159
- searchLoading: j,
3160
- searchQuery: A,
3161
- clearSearch: F,
3162
- handleSearchInput: L,
3163
- fetchCurrentUser: le,
3164
- containerRef: Be,
3165
- sortableContainerRef: se,
3166
- collapsedContainerRef: P,
3167
- frontInputRef: X,
3168
- inlineInputRef: Se,
3169
- lastInputRef: Ue,
3170
- isFocused: ye,
3171
- activeTagIndex: R,
3172
- sortableInstance: Ke,
3173
- visibleUsers: O,
3174
- hiddenCount: T,
3175
- highlightedIndex: ae,
3176
- recentUsers: he,
3177
- get recentUsersRequestId() {
3178
- return Q;
3179
- },
3180
- set recentUsersRequestId(f) {
3181
- Q = f;
3182
- },
3183
- get recentUserIdsSnapshot() {
3184
- return Fe;
3185
- },
3186
- set recentUserIdsSnapshot(f) {
3187
- Fe = f;
3188
- },
3189
- selectedUsers: S,
3190
- isTextareaMode: U,
3191
- isCellMode: Ze,
3192
- textareaHeight: Ot,
3193
- validationState: we,
3194
- isInvalid: Y,
3195
- get validationRequestId() {
3196
- return Je;
3197
- },
3198
- set validationRequestId(f) {
3199
- Je = f;
3200
- },
3201
- textareaStyle: ot,
3202
- collapsedDisplayUsers: Ht,
3203
- modelValueIds: Z,
3204
- getCurrentPropModelValue: kt,
3205
- currentModelValue: lt,
3206
- computedPlaceholder: He,
3207
- computedUserGroupName: kn,
3208
- computedEmptyText: Vt,
3209
- computedRecentUsersName: mt,
3210
- selectedUserIds: st,
3211
- showBatchActions: bt,
3212
- selectorActionCount: Mt,
3213
- showSelectorActions: Wt,
3214
- selectorActionsPadding: pn,
3215
- isUserMatchedByQuery: Pt,
3216
- getLookupFields: ut,
3217
- disabledUserFields: ue,
3218
- findUserByLookupId: Bt,
3219
- sortUsersByLookupIds: Rt,
3220
- lookupFormattedUsersByIds: Yt,
3221
- isMaxCountReached: Le,
3222
- isMeTagDisabled: Xt,
3223
- userTagCommonProps: yt,
3224
- filteredUserGroup: $e,
3225
- filterOptions: gn,
3226
- filterNavigableOptions: pe,
3227
- createCustomUser: ge,
3228
- isUserDisabled: y,
3229
- handlePaste: re,
3230
- displayOptions: k,
3231
- mainNavigableUsers: J,
3232
- filteredRecentUsers: qe,
3233
- showDropdown: et,
3234
- flatOptions: K,
3235
- inputWidth: Ve,
3236
- initSelectedUsers: Ge,
3237
- initRecentUsers: be,
3238
- updateSelectedUsers: _e,
3239
- validate: xe,
3240
- validateAfterInvalid: dt,
3241
- getValue: de,
3242
- initSortable: We,
3243
- calculateVisibleUsers: tt,
3244
- handleFocus: ct,
3245
- scheduleVisibleUsersCalculation: Ie,
3246
- blur: Ee,
3247
- handleClickOutside: Qt,
3248
- handleContainerClick: Zt,
3249
- focusCurrentInput: Oe,
3250
- handleTagClick: vn,
3251
- handleInputFocus: wt,
3252
- handleInput: ft,
3253
- addCurrentUser: _t,
3254
- onPaste: Ct,
3255
- handleKeyDown: Nt,
3256
- addUser: nt,
3257
- removeUser: ve,
3258
- deleteAllUsers: Jt,
3259
- writeClipboardText: Ft,
3260
- copyAllUsers: Lt,
3261
- get initPromise() {
3262
- return rt;
3263
- },
3264
- set initPromise(f) {
3265
- rt = f;
3266
- },
3267
- get PopConfirm() {
3268
- return zr;
3269
- },
3270
- get Popover() {
3271
- return pr;
3272
- },
3273
- get Tag() {
3274
- return hr;
3275
- },
3276
- get RESERVED_SPACE_FOR_OVERFLOW_TAG() {
3277
- return 48;
3278
- },
3279
- MeTag: Oa,
3280
- SelectionPopover: Ya,
3281
- get UserRender() {
3282
- return Jn;
3283
- },
3284
- UserTag: Za
3285
- };
3286
- return Object.defineProperty(St, "__isScriptSetup", {
3287
- enumerable: !1,
3288
- value: !0
3289
- }), St;
3290
- }
3291
- }), $a = {
3292
- ref: "sortableContainerRef",
3293
- class: "tag-list"
3294
- }, ei = ["placeholder"], ti = { class: "hidden-users" }, ni = ["placeholder"], ri = ["aria-label", "title"], ai = ["aria-label", "title"];
3295
- function ii(s, c, u, a, o, g) {
3296
- return W(), oe("div", {
3297
- ref: "containerRef",
3298
- class: vt(["bk-user-selector", {
3299
- "has-selector-actions": a.showSelectorActions,
3300
- "is-auto-height": u.autoHeight,
3301
- "is-cell": a.isCellMode,
3302
- "is-disabled": u.disabled,
3303
- "is-focused": a.isFocused,
3304
- "is-invalid": a.isInvalid,
3305
- "is-textarea": a.isTextareaMode
3306
- }]),
3307
- style: dn({
3308
- "--overflow-tag-reserve": `${a.RESERVED_SPACE_FOR_OVERFLOW_TAG}px`,
3309
- "--selector-actions-padding": a.selectorActionsPadding
3310
- })
3311
- }, [
3312
- ie(" 下拉选项列表 "),
3313
- gt(a.SelectionPopover, {
3314
- "avatar-base-url": u.avatarBaseUrl,
3315
- "container-width": a.containerRef ? a.containerRef.offsetWidth : "auto",
3316
- "disabled-user-fields": a.disabledUserFields,
3317
- "disabled-user-ids": u.disabledUserIds,
3318
- "empty-text": a.computedEmptyText,
3319
- "flat-options": a.flatOptions,
3320
- "has-avatar": u.hasAvatar,
3321
- "highlighted-index": a.highlightedIndex,
3322
- "is-show": a.showDropdown,
3323
- loading: a.searchLoading,
3324
- options: a.displayOptions,
3325
- "recent-users": a.filteredRecentUsers,
3326
- "recent-users-name": a.computedRecentUsersName,
3327
- "render-list-item": u.renderListItem,
3328
- "search-query": a.searchQuery,
3329
- "tenant-id": u.tenantId,
3330
- tenants: a.tenants,
3331
- "user-group": a.filteredUserGroup,
3332
- "user-group-name": a.computedUserGroupName,
3333
- onClickOutside: a.handleClickOutside,
3334
- onSelectUser: a.addUser
3335
- }, {
3336
- default: Qe(() => [
3337
- ie(" 聚焦状态 - 可编辑模式 "),
3338
- Gt(Ce("div", {
3339
- class: vt(["tags-container focused", { "has-selection": a.selectedUsers.length > 0 }]),
3340
- style: dn(a.textareaStyle),
3341
- onClick: Pe(a.handleContainerClick, ["stop"])
3342
- }, [ie(" 用户标签列表 "), Ce("div", $a, [
3343
- ie(" 在第一个标签之前的输入框 "),
3344
- a.activeTagIndex === -1 && a.selectedUsers.length > 0 ? Gt((W(), oe("input", {
3345
- key: 0,
3346
- ref: "frontInputRef",
3347
- "onUpdate:modelValue": c[0] || (c[0] = (p) => a.searchQuery = p),
3348
- autofocus: "",
3349
- class: "search-input input-inline",
3350
- style: dn({ width: a.inputWidth }),
3351
- onFocus: a.handleInputFocus,
3352
- onInput: a.handleInput,
3353
- onKeydown: a.handleKeyDown,
3354
- onPaste: a.onPaste
3355
- }, null, 36)), [[In, a.searchQuery]]) : ie("v-if", !0),
3356
- (W(!0), oe(zt, null, Kt(a.selectedUsers, (p, b) => (W(), oe("div", {
3357
- key: p.id,
3358
- class: "tag-wrapper"
3359
- }, [
3360
- gt(a.UserTag, ar({ ref_for: !0 }, a.userTagCommonProps, {
3361
- active: b === a.activeTagIndex,
3362
- draggable: u.draggable && u.multiple,
3363
- user: p,
3364
- onClick: (C) => a.handleTagClick(b),
3365
- onClose: (C) => a.removeUser(p)
3366
- }), null, 16, [
3367
- "active",
3368
- "draggable",
3369
- "user",
3370
- "onClick",
3371
- "onClose"
3372
- ]),
3373
- ie(" 在当前激活标签后插入输入框 "),
3374
- b === a.activeTagIndex && a.activeTagIndex !== a.selectedUsers.length - 1 ? Gt((W(), oe("input", {
3375
- key: 0,
3376
- ref_for: !0,
3377
- ref: "inlineInputRef",
3378
- "onUpdate:modelValue": c[1] || (c[1] = (C) => a.searchQuery = C),
3379
- autofocus: "",
3380
- class: "search-input input-inline",
3381
- style: dn({ width: a.inputWidth }),
3382
- onFocus: a.handleInputFocus,
3383
- onInput: a.handleInput,
3384
- onKeydown: a.handleKeyDown,
3385
- onPaste: a.onPaste
3386
- }, null, 36)), [[In, a.searchQuery]]) : ie("v-if", !0)
3387
- ]))), 128)),
3388
- ie(" 最后一个输入框(末尾位置或无用户时显示) "),
3389
- a.activeTagIndex >= a.selectedUsers.length - 1 ? Gt((W(), oe("input", {
3390
- key: 1,
3391
- ref: "lastInputRef",
3392
- "onUpdate:modelValue": c[2] || (c[2] = (p) => a.searchQuery = p),
3393
- autofocus: "",
3394
- class: "search-input input-last",
3395
- placeholder: a.selectedUsers.length ? "" : a.computedPlaceholder,
3396
- onFocus: a.handleInputFocus,
3397
- onInput: a.handleInput,
3398
- onKeydown: a.handleKeyDown,
3399
- onPaste: a.onPaste
3400
- }, null, 40, ei)), [[In, a.searchQuery]]) : ie("v-if", !0)
3401
- ], 512)], 6), [[ir, a.isFocused]]),
3402
- ie(" 未聚焦状态 - 只读展示模式 "),
3403
- Gt(Ce("div", {
3404
- ref: "collapsedContainerRef",
3405
- class: vt(["tags-container tags-container-collapsed", {
3406
- "has-overflow": a.hiddenCount > 0,
3407
- "has-selection": a.selectedUsers.length > 0
3408
- }]),
3409
- style: dn(a.textareaStyle),
3410
- onClick: Pe(a.handleFocus, ["stop"])
3411
- }, [
3412
- (W(!0), oe(zt, null, Kt(a.collapsedDisplayUsers, (p) => (W(), Tt(a.UserTag, ar({ key: p.id }, { ref_for: !0 }, a.userTagCommonProps, {
3413
- "show-tenant": !0,
3414
- user: p,
3415
- onClick: a.handleFocus,
3416
- onClose: (b) => a.removeUser(p)
3417
- }), null, 16, ["user", "onClose"]))), 128)),
3418
- ie(" 显示折叠标签数量(textarea 模式下不折叠) "),
3419
- a.hiddenCount > 0 && !a.isTextareaMode ? (W(), Tt(a.Popover, {
3420
- key: 0,
3421
- placement: "top"
3422
- }, {
3423
- content: Qe(() => [Ce("div", ti, [(W(!0), oe(zt, null, Kt(a.selectedUsers.slice(a.visibleUsers.length), (p) => (W(), Tt(a.UserRender, {
3424
- key: p.id,
3425
- "avatar-base-url": u.avatarBaseUrl,
3426
- "has-avatar": u.hasAvatar,
3427
- "tenant-id": u.tenantId,
3428
- tenants: a.tenants,
3429
- user: p
3430
- }, null, 8, [
3431
- "avatar-base-url",
3432
- "has-avatar",
3433
- "tenant-id",
3434
- "tenants",
3435
- "user"
3436
- ]))), 128))])]),
3437
- default: Qe(() => [gt(a.Tag, null, {
3438
- default: Qe(() => [Nr(" +" + xt(a.hiddenCount), 1)]),
3439
- _: 1
3440
- })]),
3441
- _: 1
3442
- })) : ie("v-if", !0),
3443
- ie(" 搜索输入框 "),
3444
- Gt(Ce("input", {
3445
- "onUpdate:modelValue": c[3] || (c[3] = (p) => a.searchQuery = p),
3446
- class: "search-input search-input-collapsed",
3447
- placeholder: a.selectedUsers.length ? "" : a.computedPlaceholder,
3448
- onFocus: a.handleFocus
3449
- }, null, 40, ni), [[In, a.searchQuery]])
3450
- ], 6), [[ir, !a.isFocused]])
3451
- ]),
3452
- _: 1
3453
- }, 8, [
3454
- "avatar-base-url",
3455
- "container-width",
3456
- "disabled-user-fields",
3457
- "disabled-user-ids",
3458
- "empty-text",
3459
- "flat-options",
3460
- "has-avatar",
3461
- "highlighted-index",
3462
- "is-show",
3463
- "loading",
3464
- "options",
3465
- "recent-users",
3466
- "recent-users-name",
3467
- "render-list-item",
3468
- "search-query",
3469
- "tenant-id",
3470
- "tenants",
3471
- "user-group",
3472
- "user-group-name"
3473
- ]),
3474
- ie(' 右侧操作区:"我"、复制全部、删除全部横向并列,避免相互遮挡 '),
3475
- a.showSelectorActions ? (W(), oe("div", {
3476
- key: 0,
3477
- class: "selector-actions",
3478
- onMousedown: c[4] || (c[4] = Pe(() => {
3479
- }, ["prevent"]))
3480
- }, [
3481
- a.showBatchActions && u.showCopyAll ? (W(), oe("button", {
3482
- key: 0,
3483
- class: "batch-action",
3484
- "aria-label": a.t("复制全部"),
3485
- title: a.t("复制全部"),
3486
- type: "button",
3487
- onClick: Pe(a.copyAllUsers, ["stop"])
3488
- }, [...c[6] || (c[6] = [Ce("span", { class: "batch-action-icon copy-all-icon" }, null, -1)])], 8, ri)) : ie("v-if", !0),
3489
- a.showBatchActions && u.showDeleteAll ? (W(), Tt(a.PopConfirm, {
3490
- key: 1,
3491
- "cancel-text": a.t("取消"),
3492
- "confirm-config": { theme: "danger" },
3493
- "confirm-text": a.t("删除"),
3494
- content: a.t("删除全部后无法撤回,请谨慎确认。"),
3495
- "ext-cls": "bk-user-selector-delete-confirm",
3496
- placement: "bottom-end",
3497
- title: a.t("确认删除全部已选人员?"),
3498
- trigger: "click",
3499
- width: 260,
3500
- onConfirm: a.deleteAllUsers
3501
- }, {
3502
- default: Qe(() => [Ce("button", {
3503
- class: "batch-action batch-action-danger",
3504
- "aria-label": a.t("删除全部"),
3505
- title: a.t("删除全部"),
3506
- type: "button"
3507
- }, [...c[7] || (c[7] = [Ce("span", { class: "batch-action-icon delete-all-icon" }, null, -1)])], 8, ai)]),
3508
- _: 1
3509
- }, 8, [
3510
- "cancel-text",
3511
- "confirm-text",
3512
- "content",
3513
- "title"
3514
- ])) : ie("v-if", !0),
3515
- gt(a.MeTag, {
3516
- "current-user-id": u.currentUserId,
3517
- "is-disabled": a.isMeTagDisabled,
3518
- onClick: a.addCurrentUser
3519
- }, null, 8, ["current-user-id", "is-disabled"])
3520
- ], 32)) : ie("v-if", !0),
3521
- a.isInvalid ? (W(), Tt(a.Popover, {
3522
- key: 1,
3523
- content: a.validationState.message,
3524
- placement: "top"
3525
- }, {
3526
- default: Qe(() => [Ce("span", {
3527
- class: "validation-error-icon",
3528
- onClick: c[5] || (c[5] = Pe(() => {
3529
- }, ["stop"]))
3530
- }, " ! ")]),
3531
- _: 1
3532
- }, 8, ["content"])) : ie("v-if", !0)
3533
- ], 6);
3534
- }
3535
- var oi = /* @__PURE__ */ On(Ja, [
3536
- ["render", ii],
3537
- ["__scopeId", "data-v-089550be"],
3538
- ["__file", "/Users/brooklin/project/bkui-monorepo/packages/bk-user-selector/src/components/user-selector.vue"]
3539
- ]), di = oi;
3540
- export {
3541
- oi as BkUserSelector,
3542
- di as default
3543
- };