bkui-vue 0.0.1-beta.393 → 0.0.1-beta.395

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/dist/index.cjs.js +36 -36
  2. package/dist/index.esm.js +93 -49
  3. package/dist/index.umd.js +36 -36
  4. package/dist/style.css +1 -1
  5. package/dist/style.variable.css +1 -1
  6. package/lib/affix/index.js +1 -353
  7. package/lib/alert/index.js +1 -251
  8. package/lib/animate-number/index.js +1 -226
  9. package/lib/backtop/index.js +1 -260
  10. package/lib/badge/badge.css +0 -2
  11. package/lib/badge/badge.less +2 -2
  12. package/lib/badge/badge.variable.css +0 -2
  13. package/lib/badge/index.js +1 -274
  14. package/lib/breadcrumb/index.js +1 -329
  15. package/lib/button/index.js +1 -371
  16. package/lib/card/index.js +1 -326
  17. package/lib/cascader/index.js +1 -2168
  18. package/lib/checkbox/index.js +1 -571
  19. package/lib/code-diff/index.js +1 -5520
  20. package/lib/collapse/collapse-panel.d.ts +11 -0
  21. package/lib/collapse/index.d.ts +20 -5
  22. package/lib/collapse/index.js +1 -698
  23. package/lib/collapse/props.d.ts +5 -0
  24. package/lib/color-picker/index.js +1 -2816
  25. package/lib/components.d.ts +2 -0
  26. package/lib/components.js +1 -759
  27. package/lib/container/index.js +1 -369
  28. package/lib/date-picker/index.js +1 -5601
  29. package/lib/dialog/index.js +1 -545
  30. package/lib/directives/index.js +2 -1427
  31. package/lib/directives/index.js.LICENSE.txt +14 -0
  32. package/lib/dist.index.js +1 -166
  33. package/lib/divider/index.js +1 -512
  34. package/lib/dropdown/index.js +1 -414
  35. package/lib/exception/exception.d.ts +13 -0
  36. package/lib/exception/index.d.ts +2 -0
  37. package/lib/exception/index.js +1 -405
  38. package/lib/fixed-navbar/index.js +1 -214
  39. package/lib/form/index.js +1 -986
  40. package/lib/icon/angle-double-down-line.js +1 -426
  41. package/lib/icon/angle-double-left-line.js +1 -426
  42. package/lib/icon/angle-double-left.js +1 -426
  43. package/lib/icon/angle-double-right-line.js +1 -426
  44. package/lib/icon/angle-double-right.js +1 -426
  45. package/lib/icon/angle-double-up-line.js +1 -426
  46. package/lib/icon/angle-down-fill.js +1 -426
  47. package/lib/icon/angle-down-line.js +1 -426
  48. package/lib/icon/angle-down.js +1 -426
  49. package/lib/icon/angle-left.js +1 -426
  50. package/lib/icon/angle-right.js +1 -426
  51. package/lib/icon/angle-up-fill.js +1 -426
  52. package/lib/icon/angle-up.js +1 -426
  53. package/lib/icon/archive-fill.js +1 -426
  54. package/lib/icon/arrows-left.js +1 -426
  55. package/lib/icon/arrows-right.js +1 -426
  56. package/lib/icon/audio-fill.js +1 -426
  57. package/lib/icon/bk.js +1 -426
  58. package/lib/icon/circle.js +1 -426
  59. package/lib/icon/close-line.js +1 -426
  60. package/lib/icon/close.js +1 -426
  61. package/lib/icon/code.js +1 -426
  62. package/lib/icon/cog-shape.js +1 -426
  63. package/lib/icon/collapse-left.js +1 -426
  64. package/lib/icon/copy.js +1 -426
  65. package/lib/icon/data-shape.js +1 -426
  66. package/lib/icon/del.js +1 -426
  67. package/lib/icon/doc-fill.js +1 -426
  68. package/lib/icon/done.js +1 -426
  69. package/lib/icon/down-shape.js +1 -426
  70. package/lib/icon/down-small.js +1 -426
  71. package/lib/icon/edit-line.js +1 -426
  72. package/lib/icon/ellipsis.js +1 -426
  73. package/lib/icon/enlarge-line.js +1 -426
  74. package/lib/icon/error.js +1 -426
  75. package/lib/icon/excel-fill.js +1 -426
  76. package/lib/icon/exclamation-circle-shape.js +1 -426
  77. package/lib/icon/eye.js +1 -426
  78. package/lib/icon/filliscreen-line.js +1 -426
  79. package/lib/icon/folder-open.js +1 -426
  80. package/lib/icon/folder-shape-open.js +1 -426
  81. package/lib/icon/folder-shape.js +1 -426
  82. package/lib/icon/folder.js +1 -426
  83. package/lib/icon/funnel.js +1 -426
  84. package/lib/icon/help-document-fill.js +1 -426
  85. package/lib/icon/help-fill.js +1 -426
  86. package/lib/icon/help.js +1 -426
  87. package/lib/icon/image-fill.js +1 -426
  88. package/lib/icon/img-placehoulder.js +1 -448
  89. package/lib/icon/index.js +1 -2275
  90. package/lib/icon/info-line.js +1 -448
  91. package/lib/icon/info.js +1 -448
  92. package/lib/icon/left-shape.js +1 -448
  93. package/lib/icon/left-turn-line.js +1 -448
  94. package/lib/icon/narrow-line.js +1 -448
  95. package/lib/icon/original.js +1 -448
  96. package/lib/icon/pdf-fill.js +1 -448
  97. package/lib/icon/play-shape.js +1 -448
  98. package/lib/icon/plus.js +1 -448
  99. package/lib/icon/ppt-fill.js +1 -448
  100. package/lib/icon/qq.js +1 -448
  101. package/lib/icon/right-shape.js +1 -448
  102. package/lib/icon/right-turn-line.js +1 -448
  103. package/lib/icon/search.js +1 -448
  104. package/lib/icon/share.js +1 -448
  105. package/lib/icon/spinner.js +1 -448
  106. package/lib/icon/success.js +1 -448
  107. package/lib/icon/switcher-loading.js +1 -448
  108. package/lib/icon/text-file.js +1 -448
  109. package/lib/icon/text-fill.js +1 -448
  110. package/lib/icon/transfer.js +1 -448
  111. package/lib/icon/tree-application-shape.js +1 -448
  112. package/lib/icon/unfull-screen.js +1 -448
  113. package/lib/icon/unvisible.js +1 -448
  114. package/lib/icon/up-shape.js +1 -448
  115. package/lib/icon/upload.js +1 -448
  116. package/lib/icon/video-fill.js +1 -448
  117. package/lib/icon/warn.js +1 -448
  118. package/lib/icon/weixin.js +1 -448
  119. package/lib/image/index.js +1 -873
  120. package/lib/index.js +1 -169
  121. package/lib/info-box/index.js +1 -1784
  122. package/lib/input/index.d.ts +4 -4
  123. package/lib/input/index.js +1 -846
  124. package/lib/input/input.d.ts +1 -1
  125. package/lib/link/index.js +1 -226
  126. package/lib/loading/index.js +1 -309
  127. package/lib/menu/index.js +1 -796
  128. package/lib/message/index.js +1 -401
  129. package/lib/modal/index.js +1 -395
  130. package/lib/navigation/index.js +1 -431
  131. package/lib/notify/index.js +1 -430
  132. package/lib/overflow-title/index.js +1 -512
  133. package/lib/pagination/index.js +1 -1026
  134. package/lib/plugin-popover/index.js +1 -2581
  135. package/lib/plugins/index.js +1 -130
  136. package/lib/popover/index.js +1 -2587
  137. package/lib/popover2/index.js +1 -172
  138. package/lib/preset.js +1 -129
  139. package/lib/process/index.js +1 -1417
  140. package/lib/progress/index.js +1 -479
  141. package/lib/radio/index.js +1 -649
  142. package/lib/rate/index.js +1 -358
  143. package/lib/resize-layout/index.js +1 -495
  144. package/lib/search-select/index.js +1 -3388
  145. package/lib/search-select/search-select.css +1 -1
  146. package/lib/search-select/search-select.less +1 -1
  147. package/lib/search-select/search-select.variable.css +1 -1
  148. package/lib/select/index.d.ts +9 -9
  149. package/lib/select/index.js +1 -2819
  150. package/lib/select/select.css +0 -1
  151. package/lib/select/select.d.ts +3 -3
  152. package/lib/select/select.less +0 -1
  153. package/lib/select/select.variable.css +0 -1
  154. package/lib/select/selectTagInput.d.ts +1 -1
  155. package/lib/shared/index.js +1 -2813
  156. package/lib/shared/vue-types.d.ts +1 -1
  157. package/lib/sideslider/index.js +1 -1362
  158. package/lib/slider/index.js +1 -2060
  159. package/lib/steps/index.js +1 -1504
  160. package/lib/swiper/index.js +1 -374
  161. package/lib/switcher/index.js +1 -308
  162. package/lib/tab/index.d.ts +10 -6
  163. package/lib/tab/index.js +1 -919
  164. package/lib/tab/props.d.ts +6 -0
  165. package/lib/table/index.js +1 -6635
  166. package/lib/table-column/index.js +1 -737
  167. package/lib/tag/index.js +1 -278
  168. package/lib/tag-input/index.js +1 -1897
  169. package/lib/time-picker/index.js +1 -142
  170. package/lib/timeline/index.js +1 -315
  171. package/lib/transfer/index.js +1 -658
  172. package/lib/tree/index.js +1 -2917
  173. package/lib/upload/index.js +1 -3735
  174. package/lib/virtual-render/index.js +1 -825
  175. package/package.json +2 -1
@@ -1,3388 +1 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("../shared"), require("vue"), require("../directives"), require("../icon"), require("../popover"));
4
- else if(typeof define === 'function' && define.amd)
5
- define(["../shared", "vue", "../directives", "../icon", "../popover"], factory);
6
- else {
7
- var a = typeof exports === 'object' ? factory(require("../shared"), require("vue"), require("../directives"), require("../icon"), require("../popover")) : factory(root["../shared"], root["vue"], root["../directives"], root["../icon"], root["../popover"]);
8
- for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
- }
10
- })(self, (__WEBPACK_EXTERNAL_MODULE__4212__, __WEBPACK_EXTERNAL_MODULE__748__, __WEBPACK_EXTERNAL_MODULE__4061__, __WEBPACK_EXTERNAL_MODULE__6870__, __WEBPACK_EXTERNAL_MODULE__5537__) => {
11
- return /******/ (() => { // webpackBootstrap
12
- /******/ var __webpack_modules__ = ({
13
-
14
- /***/ 7162:
15
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16
-
17
- module.exports = __webpack_require__(5047);
18
-
19
-
20
- /***/ }),
21
-
22
- /***/ 5047:
23
- /***/ ((module) => {
24
-
25
- /**
26
- * Copyright (c) 2014-present, Facebook, Inc.
27
- *
28
- * This source code is licensed under the MIT license found in the
29
- * LICENSE file in the root directory of this source tree.
30
- */
31
-
32
- var runtime = (function (exports) {
33
- "use strict";
34
-
35
- var Op = Object.prototype;
36
- var hasOwn = Op.hasOwnProperty;
37
- var undefined; // More compressible than void 0.
38
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
39
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
40
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
41
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
42
-
43
- function define(obj, key, value) {
44
- Object.defineProperty(obj, key, {
45
- value: value,
46
- enumerable: true,
47
- configurable: true,
48
- writable: true
49
- });
50
- return obj[key];
51
- }
52
- try {
53
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
54
- define({}, "");
55
- } catch (err) {
56
- define = function(obj, key, value) {
57
- return obj[key] = value;
58
- };
59
- }
60
-
61
- function wrap(innerFn, outerFn, self, tryLocsList) {
62
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
63
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
64
- var generator = Object.create(protoGenerator.prototype);
65
- var context = new Context(tryLocsList || []);
66
-
67
- // The ._invoke method unifies the implementations of the .next,
68
- // .throw, and .return methods.
69
- generator._invoke = makeInvokeMethod(innerFn, self, context);
70
-
71
- return generator;
72
- }
73
- exports.wrap = wrap;
74
-
75
- // Try/catch helper to minimize deoptimizations. Returns a completion
76
- // record like context.tryEntries[i].completion. This interface could
77
- // have been (and was previously) designed to take a closure to be
78
- // invoked without arguments, but in all the cases we care about we
79
- // already have an existing method we want to call, so there's no need
80
- // to create a new function object. We can even get away with assuming
81
- // the method takes exactly one argument, since that happens to be true
82
- // in every case, so we don't have to touch the arguments object. The
83
- // only additional allocation required is the completion record, which
84
- // has a stable shape and so hopefully should be cheap to allocate.
85
- function tryCatch(fn, obj, arg) {
86
- try {
87
- return { type: "normal", arg: fn.call(obj, arg) };
88
- } catch (err) {
89
- return { type: "throw", arg: err };
90
- }
91
- }
92
-
93
- var GenStateSuspendedStart = "suspendedStart";
94
- var GenStateSuspendedYield = "suspendedYield";
95
- var GenStateExecuting = "executing";
96
- var GenStateCompleted = "completed";
97
-
98
- // Returning this object from the innerFn has the same effect as
99
- // breaking out of the dispatch switch statement.
100
- var ContinueSentinel = {};
101
-
102
- // Dummy constructor functions that we use as the .constructor and
103
- // .constructor.prototype properties for functions that return Generator
104
- // objects. For full spec compliance, you may wish to configure your
105
- // minifier not to mangle the names of these two functions.
106
- function Generator() {}
107
- function GeneratorFunction() {}
108
- function GeneratorFunctionPrototype() {}
109
-
110
- // This is a polyfill for %IteratorPrototype% for environments that
111
- // don't natively support it.
112
- var IteratorPrototype = {};
113
- define(IteratorPrototype, iteratorSymbol, function () {
114
- return this;
115
- });
116
-
117
- var getProto = Object.getPrototypeOf;
118
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
119
- if (NativeIteratorPrototype &&
120
- NativeIteratorPrototype !== Op &&
121
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
122
- // This environment has a native %IteratorPrototype%; use it instead
123
- // of the polyfill.
124
- IteratorPrototype = NativeIteratorPrototype;
125
- }
126
-
127
- var Gp = GeneratorFunctionPrototype.prototype =
128
- Generator.prototype = Object.create(IteratorPrototype);
129
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
130
- define(Gp, "constructor", GeneratorFunctionPrototype);
131
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
132
- GeneratorFunction.displayName = define(
133
- GeneratorFunctionPrototype,
134
- toStringTagSymbol,
135
- "GeneratorFunction"
136
- );
137
-
138
- // Helper for defining the .next, .throw, and .return methods of the
139
- // Iterator interface in terms of a single ._invoke method.
140
- function defineIteratorMethods(prototype) {
141
- ["next", "throw", "return"].forEach(function(method) {
142
- define(prototype, method, function(arg) {
143
- return this._invoke(method, arg);
144
- });
145
- });
146
- }
147
-
148
- exports.isGeneratorFunction = function(genFun) {
149
- var ctor = typeof genFun === "function" && genFun.constructor;
150
- return ctor
151
- ? ctor === GeneratorFunction ||
152
- // For the native GeneratorFunction constructor, the best we can
153
- // do is to check its .name property.
154
- (ctor.displayName || ctor.name) === "GeneratorFunction"
155
- : false;
156
- };
157
-
158
- exports.mark = function(genFun) {
159
- if (Object.setPrototypeOf) {
160
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
161
- } else {
162
- genFun.__proto__ = GeneratorFunctionPrototype;
163
- define(genFun, toStringTagSymbol, "GeneratorFunction");
164
- }
165
- genFun.prototype = Object.create(Gp);
166
- return genFun;
167
- };
168
-
169
- // Within the body of any async function, `await x` is transformed to
170
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
171
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
172
- // meant to be awaited.
173
- exports.awrap = function(arg) {
174
- return { __await: arg };
175
- };
176
-
177
- function AsyncIterator(generator, PromiseImpl) {
178
- function invoke(method, arg, resolve, reject) {
179
- var record = tryCatch(generator[method], generator, arg);
180
- if (record.type === "throw") {
181
- reject(record.arg);
182
- } else {
183
- var result = record.arg;
184
- var value = result.value;
185
- if (value &&
186
- typeof value === "object" &&
187
- hasOwn.call(value, "__await")) {
188
- return PromiseImpl.resolve(value.__await).then(function(value) {
189
- invoke("next", value, resolve, reject);
190
- }, function(err) {
191
- invoke("throw", err, resolve, reject);
192
- });
193
- }
194
-
195
- return PromiseImpl.resolve(value).then(function(unwrapped) {
196
- // When a yielded Promise is resolved, its final value becomes
197
- // the .value of the Promise<{value,done}> result for the
198
- // current iteration.
199
- result.value = unwrapped;
200
- resolve(result);
201
- }, function(error) {
202
- // If a rejected Promise was yielded, throw the rejection back
203
- // into the async generator function so it can be handled there.
204
- return invoke("throw", error, resolve, reject);
205
- });
206
- }
207
- }
208
-
209
- var previousPromise;
210
-
211
- function enqueue(method, arg) {
212
- function callInvokeWithMethodAndArg() {
213
- return new PromiseImpl(function(resolve, reject) {
214
- invoke(method, arg, resolve, reject);
215
- });
216
- }
217
-
218
- return previousPromise =
219
- // If enqueue has been called before, then we want to wait until
220
- // all previous Promises have been resolved before calling invoke,
221
- // so that results are always delivered in the correct order. If
222
- // enqueue has not been called before, then it is important to
223
- // call invoke immediately, without waiting on a callback to fire,
224
- // so that the async generator function has the opportunity to do
225
- // any necessary setup in a predictable way. This predictability
226
- // is why the Promise constructor synchronously invokes its
227
- // executor callback, and why async functions synchronously
228
- // execute code before the first await. Since we implement simple
229
- // async functions in terms of async generators, it is especially
230
- // important to get this right, even though it requires care.
231
- previousPromise ? previousPromise.then(
232
- callInvokeWithMethodAndArg,
233
- // Avoid propagating failures to Promises returned by later
234
- // invocations of the iterator.
235
- callInvokeWithMethodAndArg
236
- ) : callInvokeWithMethodAndArg();
237
- }
238
-
239
- // Define the unified helper method that is used to implement .next,
240
- // .throw, and .return (see defineIteratorMethods).
241
- this._invoke = enqueue;
242
- }
243
-
244
- defineIteratorMethods(AsyncIterator.prototype);
245
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
246
- return this;
247
- });
248
- exports.AsyncIterator = AsyncIterator;
249
-
250
- // Note that simple async functions are implemented on top of
251
- // AsyncIterator objects; they just return a Promise for the value of
252
- // the final result produced by the iterator.
253
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
254
- if (PromiseImpl === void 0) PromiseImpl = Promise;
255
-
256
- var iter = new AsyncIterator(
257
- wrap(innerFn, outerFn, self, tryLocsList),
258
- PromiseImpl
259
- );
260
-
261
- return exports.isGeneratorFunction(outerFn)
262
- ? iter // If outerFn is a generator, return the full iterator.
263
- : iter.next().then(function(result) {
264
- return result.done ? result.value : iter.next();
265
- });
266
- };
267
-
268
- function makeInvokeMethod(innerFn, self, context) {
269
- var state = GenStateSuspendedStart;
270
-
271
- return function invoke(method, arg) {
272
- if (state === GenStateExecuting) {
273
- throw new Error("Generator is already running");
274
- }
275
-
276
- if (state === GenStateCompleted) {
277
- if (method === "throw") {
278
- throw arg;
279
- }
280
-
281
- // Be forgiving, per 25.3.3.3.3 of the spec:
282
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
283
- return doneResult();
284
- }
285
-
286
- context.method = method;
287
- context.arg = arg;
288
-
289
- while (true) {
290
- var delegate = context.delegate;
291
- if (delegate) {
292
- var delegateResult = maybeInvokeDelegate(delegate, context);
293
- if (delegateResult) {
294
- if (delegateResult === ContinueSentinel) continue;
295
- return delegateResult;
296
- }
297
- }
298
-
299
- if (context.method === "next") {
300
- // Setting context._sent for legacy support of Babel's
301
- // function.sent implementation.
302
- context.sent = context._sent = context.arg;
303
-
304
- } else if (context.method === "throw") {
305
- if (state === GenStateSuspendedStart) {
306
- state = GenStateCompleted;
307
- throw context.arg;
308
- }
309
-
310
- context.dispatchException(context.arg);
311
-
312
- } else if (context.method === "return") {
313
- context.abrupt("return", context.arg);
314
- }
315
-
316
- state = GenStateExecuting;
317
-
318
- var record = tryCatch(innerFn, self, context);
319
- if (record.type === "normal") {
320
- // If an exception is thrown from innerFn, we leave state ===
321
- // GenStateExecuting and loop back for another invocation.
322
- state = context.done
323
- ? GenStateCompleted
324
- : GenStateSuspendedYield;
325
-
326
- if (record.arg === ContinueSentinel) {
327
- continue;
328
- }
329
-
330
- return {
331
- value: record.arg,
332
- done: context.done
333
- };
334
-
335
- } else if (record.type === "throw") {
336
- state = GenStateCompleted;
337
- // Dispatch the exception by looping back around to the
338
- // context.dispatchException(context.arg) call above.
339
- context.method = "throw";
340
- context.arg = record.arg;
341
- }
342
- }
343
- };
344
- }
345
-
346
- // Call delegate.iterator[context.method](context.arg) and handle the
347
- // result, either by returning a { value, done } result from the
348
- // delegate iterator, or by modifying context.method and context.arg,
349
- // setting context.delegate to null, and returning the ContinueSentinel.
350
- function maybeInvokeDelegate(delegate, context) {
351
- var method = delegate.iterator[context.method];
352
- if (method === undefined) {
353
- // A .throw or .return when the delegate iterator has no .throw
354
- // method always terminates the yield* loop.
355
- context.delegate = null;
356
-
357
- if (context.method === "throw") {
358
- // Note: ["return"] must be used for ES3 parsing compatibility.
359
- if (delegate.iterator["return"]) {
360
- // If the delegate iterator has a return method, give it a
361
- // chance to clean up.
362
- context.method = "return";
363
- context.arg = undefined;
364
- maybeInvokeDelegate(delegate, context);
365
-
366
- if (context.method === "throw") {
367
- // If maybeInvokeDelegate(context) changed context.method from
368
- // "return" to "throw", let that override the TypeError below.
369
- return ContinueSentinel;
370
- }
371
- }
372
-
373
- context.method = "throw";
374
- context.arg = new TypeError(
375
- "The iterator does not provide a 'throw' method");
376
- }
377
-
378
- return ContinueSentinel;
379
- }
380
-
381
- var record = tryCatch(method, delegate.iterator, context.arg);
382
-
383
- if (record.type === "throw") {
384
- context.method = "throw";
385
- context.arg = record.arg;
386
- context.delegate = null;
387
- return ContinueSentinel;
388
- }
389
-
390
- var info = record.arg;
391
-
392
- if (! info) {
393
- context.method = "throw";
394
- context.arg = new TypeError("iterator result is not an object");
395
- context.delegate = null;
396
- return ContinueSentinel;
397
- }
398
-
399
- if (info.done) {
400
- // Assign the result of the finished delegate to the temporary
401
- // variable specified by delegate.resultName (see delegateYield).
402
- context[delegate.resultName] = info.value;
403
-
404
- // Resume execution at the desired location (see delegateYield).
405
- context.next = delegate.nextLoc;
406
-
407
- // If context.method was "throw" but the delegate handled the
408
- // exception, let the outer generator proceed normally. If
409
- // context.method was "next", forget context.arg since it has been
410
- // "consumed" by the delegate iterator. If context.method was
411
- // "return", allow the original .return call to continue in the
412
- // outer generator.
413
- if (context.method !== "return") {
414
- context.method = "next";
415
- context.arg = undefined;
416
- }
417
-
418
- } else {
419
- // Re-yield the result returned by the delegate method.
420
- return info;
421
- }
422
-
423
- // The delegate iterator is finished, so forget it and continue with
424
- // the outer generator.
425
- context.delegate = null;
426
- return ContinueSentinel;
427
- }
428
-
429
- // Define Generator.prototype.{next,throw,return} in terms of the
430
- // unified ._invoke helper method.
431
- defineIteratorMethods(Gp);
432
-
433
- define(Gp, toStringTagSymbol, "Generator");
434
-
435
- // A Generator should always return itself as the iterator object when the
436
- // @@iterator function is called on it. Some browsers' implementations of the
437
- // iterator prototype chain incorrectly implement this, causing the Generator
438
- // object to not be returned from this call. This ensures that doesn't happen.
439
- // See https://github.com/facebook/regenerator/issues/274 for more details.
440
- define(Gp, iteratorSymbol, function() {
441
- return this;
442
- });
443
-
444
- define(Gp, "toString", function() {
445
- return "[object Generator]";
446
- });
447
-
448
- function pushTryEntry(locs) {
449
- var entry = { tryLoc: locs[0] };
450
-
451
- if (1 in locs) {
452
- entry.catchLoc = locs[1];
453
- }
454
-
455
- if (2 in locs) {
456
- entry.finallyLoc = locs[2];
457
- entry.afterLoc = locs[3];
458
- }
459
-
460
- this.tryEntries.push(entry);
461
- }
462
-
463
- function resetTryEntry(entry) {
464
- var record = entry.completion || {};
465
- record.type = "normal";
466
- delete record.arg;
467
- entry.completion = record;
468
- }
469
-
470
- function Context(tryLocsList) {
471
- // The root entry object (effectively a try statement without a catch
472
- // or a finally block) gives us a place to store values thrown from
473
- // locations where there is no enclosing try statement.
474
- this.tryEntries = [{ tryLoc: "root" }];
475
- tryLocsList.forEach(pushTryEntry, this);
476
- this.reset(true);
477
- }
478
-
479
- exports.keys = function(object) {
480
- var keys = [];
481
- for (var key in object) {
482
- keys.push(key);
483
- }
484
- keys.reverse();
485
-
486
- // Rather than returning an object with a next method, we keep
487
- // things simple and return the next function itself.
488
- return function next() {
489
- while (keys.length) {
490
- var key = keys.pop();
491
- if (key in object) {
492
- next.value = key;
493
- next.done = false;
494
- return next;
495
- }
496
- }
497
-
498
- // To avoid creating an additional object, we just hang the .value
499
- // and .done properties off the next function object itself. This
500
- // also ensures that the minifier will not anonymize the function.
501
- next.done = true;
502
- return next;
503
- };
504
- };
505
-
506
- function values(iterable) {
507
- if (iterable) {
508
- var iteratorMethod = iterable[iteratorSymbol];
509
- if (iteratorMethod) {
510
- return iteratorMethod.call(iterable);
511
- }
512
-
513
- if (typeof iterable.next === "function") {
514
- return iterable;
515
- }
516
-
517
- if (!isNaN(iterable.length)) {
518
- var i = -1, next = function next() {
519
- while (++i < iterable.length) {
520
- if (hasOwn.call(iterable, i)) {
521
- next.value = iterable[i];
522
- next.done = false;
523
- return next;
524
- }
525
- }
526
-
527
- next.value = undefined;
528
- next.done = true;
529
-
530
- return next;
531
- };
532
-
533
- return next.next = next;
534
- }
535
- }
536
-
537
- // Return an iterator with no values.
538
- return { next: doneResult };
539
- }
540
- exports.values = values;
541
-
542
- function doneResult() {
543
- return { value: undefined, done: true };
544
- }
545
-
546
- Context.prototype = {
547
- constructor: Context,
548
-
549
- reset: function(skipTempReset) {
550
- this.prev = 0;
551
- this.next = 0;
552
- // Resetting context._sent for legacy support of Babel's
553
- // function.sent implementation.
554
- this.sent = this._sent = undefined;
555
- this.done = false;
556
- this.delegate = null;
557
-
558
- this.method = "next";
559
- this.arg = undefined;
560
-
561
- this.tryEntries.forEach(resetTryEntry);
562
-
563
- if (!skipTempReset) {
564
- for (var name in this) {
565
- // Not sure about the optimal order of these conditions:
566
- if (name.charAt(0) === "t" &&
567
- hasOwn.call(this, name) &&
568
- !isNaN(+name.slice(1))) {
569
- this[name] = undefined;
570
- }
571
- }
572
- }
573
- },
574
-
575
- stop: function() {
576
- this.done = true;
577
-
578
- var rootEntry = this.tryEntries[0];
579
- var rootRecord = rootEntry.completion;
580
- if (rootRecord.type === "throw") {
581
- throw rootRecord.arg;
582
- }
583
-
584
- return this.rval;
585
- },
586
-
587
- dispatchException: function(exception) {
588
- if (this.done) {
589
- throw exception;
590
- }
591
-
592
- var context = this;
593
- function handle(loc, caught) {
594
- record.type = "throw";
595
- record.arg = exception;
596
- context.next = loc;
597
-
598
- if (caught) {
599
- // If the dispatched exception was caught by a catch block,
600
- // then let that catch block handle the exception normally.
601
- context.method = "next";
602
- context.arg = undefined;
603
- }
604
-
605
- return !! caught;
606
- }
607
-
608
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
609
- var entry = this.tryEntries[i];
610
- var record = entry.completion;
611
-
612
- if (entry.tryLoc === "root") {
613
- // Exception thrown outside of any try block that could handle
614
- // it, so set the completion value of the entire function to
615
- // throw the exception.
616
- return handle("end");
617
- }
618
-
619
- if (entry.tryLoc <= this.prev) {
620
- var hasCatch = hasOwn.call(entry, "catchLoc");
621
- var hasFinally = hasOwn.call(entry, "finallyLoc");
622
-
623
- if (hasCatch && hasFinally) {
624
- if (this.prev < entry.catchLoc) {
625
- return handle(entry.catchLoc, true);
626
- } else if (this.prev < entry.finallyLoc) {
627
- return handle(entry.finallyLoc);
628
- }
629
-
630
- } else if (hasCatch) {
631
- if (this.prev < entry.catchLoc) {
632
- return handle(entry.catchLoc, true);
633
- }
634
-
635
- } else if (hasFinally) {
636
- if (this.prev < entry.finallyLoc) {
637
- return handle(entry.finallyLoc);
638
- }
639
-
640
- } else {
641
- throw new Error("try statement without catch or finally");
642
- }
643
- }
644
- }
645
- },
646
-
647
- abrupt: function(type, arg) {
648
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
649
- var entry = this.tryEntries[i];
650
- if (entry.tryLoc <= this.prev &&
651
- hasOwn.call(entry, "finallyLoc") &&
652
- this.prev < entry.finallyLoc) {
653
- var finallyEntry = entry;
654
- break;
655
- }
656
- }
657
-
658
- if (finallyEntry &&
659
- (type === "break" ||
660
- type === "continue") &&
661
- finallyEntry.tryLoc <= arg &&
662
- arg <= finallyEntry.finallyLoc) {
663
- // Ignore the finally entry if control is not jumping to a
664
- // location outside the try/catch block.
665
- finallyEntry = null;
666
- }
667
-
668
- var record = finallyEntry ? finallyEntry.completion : {};
669
- record.type = type;
670
- record.arg = arg;
671
-
672
- if (finallyEntry) {
673
- this.method = "next";
674
- this.next = finallyEntry.finallyLoc;
675
- return ContinueSentinel;
676
- }
677
-
678
- return this.complete(record);
679
- },
680
-
681
- complete: function(record, afterLoc) {
682
- if (record.type === "throw") {
683
- throw record.arg;
684
- }
685
-
686
- if (record.type === "break" ||
687
- record.type === "continue") {
688
- this.next = record.arg;
689
- } else if (record.type === "return") {
690
- this.rval = this.arg = record.arg;
691
- this.method = "return";
692
- this.next = "end";
693
- } else if (record.type === "normal" && afterLoc) {
694
- this.next = afterLoc;
695
- }
696
-
697
- return ContinueSentinel;
698
- },
699
-
700
- finish: function(finallyLoc) {
701
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
702
- var entry = this.tryEntries[i];
703
- if (entry.finallyLoc === finallyLoc) {
704
- this.complete(entry.completion, entry.afterLoc);
705
- resetTryEntry(entry);
706
- return ContinueSentinel;
707
- }
708
- }
709
- },
710
-
711
- "catch": function(tryLoc) {
712
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
713
- var entry = this.tryEntries[i];
714
- if (entry.tryLoc === tryLoc) {
715
- var record = entry.completion;
716
- if (record.type === "throw") {
717
- var thrown = record.arg;
718
- resetTryEntry(entry);
719
- }
720
- return thrown;
721
- }
722
- }
723
-
724
- // The context.catch method must only be called with a location
725
- // argument that corresponds to a known catch block.
726
- throw new Error("illegal catch attempt");
727
- },
728
-
729
- delegateYield: function(iterable, resultName, nextLoc) {
730
- this.delegate = {
731
- iterator: values(iterable),
732
- resultName: resultName,
733
- nextLoc: nextLoc
734
- };
735
-
736
- if (this.method === "next") {
737
- // Deliberately forget the last sent value so that we don't
738
- // accidentally pass it on to the delegate.
739
- this.arg = undefined;
740
- }
741
-
742
- return ContinueSentinel;
743
- }
744
- };
745
-
746
- // Regardless of whether this script is executing as a CommonJS module
747
- // or not, return the runtime object so that we can declare the variable
748
- // regeneratorRuntime in the outer scope, which allows this module to be
749
- // injected easily by `bin/regenerator --include-runtime script.js`.
750
- return exports;
751
-
752
- }(
753
- // If this script is executing as a CommonJS module, use module.exports
754
- // as the regeneratorRuntime namespace. Otherwise create a new empty
755
- // object. Either way, the resulting object will be used to initialize
756
- // the regeneratorRuntime variable at the top of this file.
757
- true ? module.exports : 0
758
- ));
759
-
760
- try {
761
- regeneratorRuntime = runtime;
762
- } catch (accidentalStrictMode) {
763
- // This module should not be running in strict mode, so the above
764
- // assignment should always work unless something is misconfigured. Just
765
- // in case runtime.js accidentally runs in strict mode, in modern engines
766
- // we can explicitly access globalThis. In older engines we can escape
767
- // strict mode using a global Function call. This could conceivably fail
768
- // if a Content Security Policy forbids using Function, but in that case
769
- // the proper solution is to fix the accidental strict mode problem. If
770
- // you've misconfigured your bundler to force strict mode and applied a
771
- // CSP to forbid Function, and you're not willing to fix either of those
772
- // problems, please detail your unique predicament in a GitHub issue.
773
- if (typeof globalThis === "object") {
774
- globalThis.regeneratorRuntime = runtime;
775
- } else {
776
- Function("r", "regeneratorRuntime = r")(runtime);
777
- }
778
- }
779
-
780
-
781
- /***/ }),
782
-
783
- /***/ 4061:
784
- /***/ ((module) => {
785
-
786
- "use strict";
787
- module.exports = __WEBPACK_EXTERNAL_MODULE__4061__;
788
-
789
- /***/ }),
790
-
791
- /***/ 6870:
792
- /***/ ((module) => {
793
-
794
- "use strict";
795
- module.exports = __WEBPACK_EXTERNAL_MODULE__6870__;
796
-
797
- /***/ }),
798
-
799
- /***/ 5537:
800
- /***/ ((module) => {
801
-
802
- "use strict";
803
- module.exports = __WEBPACK_EXTERNAL_MODULE__5537__;
804
-
805
- /***/ }),
806
-
807
- /***/ 4212:
808
- /***/ ((module) => {
809
-
810
- "use strict";
811
- module.exports = __WEBPACK_EXTERNAL_MODULE__4212__;
812
-
813
- /***/ }),
814
-
815
- /***/ 748:
816
- /***/ ((module) => {
817
-
818
- "use strict";
819
- module.exports = __WEBPACK_EXTERNAL_MODULE__748__;
820
-
821
- /***/ })
822
-
823
- /******/ });
824
- /************************************************************************/
825
- /******/ // The module cache
826
- /******/ var __webpack_module_cache__ = {};
827
- /******/
828
- /******/ // The require function
829
- /******/ function __webpack_require__(moduleId) {
830
- /******/ // Check if module is in cache
831
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
832
- /******/ if (cachedModule !== undefined) {
833
- /******/ return cachedModule.exports;
834
- /******/ }
835
- /******/ // Create a new module (and put it into the cache)
836
- /******/ var module = __webpack_module_cache__[moduleId] = {
837
- /******/ // no module.id needed
838
- /******/ // no module.loaded needed
839
- /******/ exports: {}
840
- /******/ };
841
- /******/
842
- /******/ // Execute the module function
843
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
844
- /******/
845
- /******/ // Return the exports of the module
846
- /******/ return module.exports;
847
- /******/ }
848
- /******/
849
- /************************************************************************/
850
- /******/ /* webpack/runtime/compat get default export */
851
- /******/ (() => {
852
- /******/ // getDefaultExport function for compatibility with non-harmony modules
853
- /******/ __webpack_require__.n = (module) => {
854
- /******/ var getter = module && module.__esModule ?
855
- /******/ () => (module['default']) :
856
- /******/ () => (module);
857
- /******/ __webpack_require__.d(getter, { a: getter });
858
- /******/ return getter;
859
- /******/ };
860
- /******/ })();
861
- /******/
862
- /******/ /* webpack/runtime/define property getters */
863
- /******/ (() => {
864
- /******/ // define getter functions for harmony exports
865
- /******/ __webpack_require__.d = (exports, definition) => {
866
- /******/ for(var key in definition) {
867
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
868
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
869
- /******/ }
870
- /******/ }
871
- /******/ };
872
- /******/ })();
873
- /******/
874
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
875
- /******/ (() => {
876
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
877
- /******/ })();
878
- /******/
879
- /******/ /* webpack/runtime/make namespace object */
880
- /******/ (() => {
881
- /******/ // define __esModule on exports
882
- /******/ __webpack_require__.r = (exports) => {
883
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
884
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
885
- /******/ }
886
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
887
- /******/ };
888
- /******/ })();
889
- /******/
890
- /************************************************************************/
891
- var __webpack_exports__ = {};
892
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
893
- (() => {
894
- "use strict";
895
- // ESM COMPAT FLAG
896
- __webpack_require__.r(__webpack_exports__);
897
-
898
- // EXPORTS
899
- __webpack_require__.d(__webpack_exports__, {
900
- "BkSearchSelect": () => (/* binding */ BkSearchSelect),
901
- "default": () => (/* binding */ src)
902
- });
903
-
904
- // EXTERNAL MODULE: external "../shared"
905
- var external_shared_ = __webpack_require__(4212);
906
- // EXTERNAL MODULE: external "vue"
907
- var external_vue_ = __webpack_require__(748);
908
- ;// CONCATENATED MODULE: ../../node_modules/resize-detector/esm/index.js
909
- var raf = null;
910
- function requestAnimationFrame (callback) {
911
- if (!raf) {
912
- raf = (
913
- window.requestAnimationFrame ||
914
- window.webkitRequestAnimationFrame ||
915
- window.mozRequestAnimationFrame ||
916
- function (callback) {
917
- return setTimeout(callback, 16)
918
- }
919
- ).bind(window);
920
- }
921
- return raf(callback)
922
- }
923
-
924
- var caf = null;
925
- function cancelAnimationFrame (id) {
926
- if (!caf) {
927
- caf = (
928
- window.cancelAnimationFrame ||
929
- window.webkitCancelAnimationFrame ||
930
- window.mozCancelAnimationFrame ||
931
- function (id) {
932
- clearTimeout(id);
933
- }
934
- ).bind(window);
935
- }
936
-
937
- caf(id);
938
- }
939
-
940
- function createStyles (styleText) {
941
- var style = document.createElement('style');
942
-
943
- if (style.styleSheet) {
944
- style.styleSheet.cssText = styleText;
945
- } else {
946
- style.appendChild(document.createTextNode(styleText));
947
- }
948
- (document.querySelector('head') || document.body).appendChild(style);
949
- return style
950
- }
951
-
952
- function createElement (tagName, props) {
953
- if ( props === void 0 ) props = {};
954
-
955
- var elem = document.createElement(tagName);
956
- Object.keys(props).forEach(function (key) {
957
- elem[key] = props[key];
958
- });
959
- return elem
960
- }
961
-
962
- function getComputedStyle (elem, prop, pseudo) {
963
- // for older versions of Firefox, `getComputedStyle` required
964
- // the second argument and may return `null` for some elements
965
- // when `display: none`
966
- var computedStyle = window.getComputedStyle(elem, pseudo || null) || {
967
- display: 'none'
968
- };
969
-
970
- return computedStyle[prop]
971
- }
972
-
973
- function getRenderInfo (elem) {
974
- if (!document.documentElement.contains(elem)) {
975
- return {
976
- detached: true,
977
- rendered: false
978
- }
979
- }
980
-
981
- var current = elem;
982
- while (current !== document) {
983
- if (getComputedStyle(current, 'display') === 'none') {
984
- return {
985
- detached: false,
986
- rendered: false
987
- }
988
- }
989
- current = current.parentNode;
990
- }
991
-
992
- return {
993
- detached: false,
994
- rendered: true
995
- }
996
- }
997
-
998
- var css_248z = ".resize-triggers{visibility:hidden;opacity:0;pointer-events:none}.resize-contract-trigger,.resize-contract-trigger:before,.resize-expand-trigger,.resize-triggers{content:\"\";position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden}.resize-contract-trigger,.resize-expand-trigger{background:#eee;overflow:auto}.resize-contract-trigger:before{width:200%;height:200%}";
999
-
1000
- var total = 0;
1001
- var style = null;
1002
-
1003
- function addListener (elem, callback) {
1004
- if (!elem.__resize_mutation_handler__) {
1005
- elem.__resize_mutation_handler__ = handleMutation.bind(elem);
1006
- }
1007
-
1008
- var listeners = elem.__resize_listeners__;
1009
-
1010
- if (!listeners) {
1011
- elem.__resize_listeners__ = [];
1012
- if (window.ResizeObserver) {
1013
- var offsetWidth = elem.offsetWidth;
1014
- var offsetHeight = elem.offsetHeight;
1015
- var ro = new ResizeObserver(function () {
1016
- if (!elem.__resize_observer_triggered__) {
1017
- elem.__resize_observer_triggered__ = true;
1018
- if (elem.offsetWidth === offsetWidth && elem.offsetHeight === offsetHeight) {
1019
- return
1020
- }
1021
- }
1022
- runCallbacks(elem);
1023
- });
1024
-
1025
- // initially display none won't trigger ResizeObserver callback
1026
- var ref = getRenderInfo(elem);
1027
- var detached = ref.detached;
1028
- var rendered = ref.rendered;
1029
- elem.__resize_observer_triggered__ = detached === false && rendered === false;
1030
- elem.__resize_observer__ = ro;
1031
- ro.observe(elem);
1032
- } else if (elem.attachEvent && elem.addEventListener) {
1033
- // targeting IE9/10
1034
- elem.__resize_legacy_resize_handler__ = function handleLegacyResize () {
1035
- runCallbacks(elem);
1036
- };
1037
- elem.attachEvent('onresize', elem.__resize_legacy_resize_handler__);
1038
- document.addEventListener('DOMSubtreeModified', elem.__resize_mutation_handler__);
1039
- } else {
1040
- if (!total) {
1041
- style = createStyles(css_248z);
1042
- }
1043
- initTriggers(elem);
1044
-
1045
- elem.__resize_rendered__ = getRenderInfo(elem).rendered;
1046
- if (window.MutationObserver) {
1047
- var mo = new MutationObserver(elem.__resize_mutation_handler__);
1048
- mo.observe(document, {
1049
- attributes: true,
1050
- childList: true,
1051
- characterData: true,
1052
- subtree: true
1053
- });
1054
- elem.__resize_mutation_observer__ = mo;
1055
- }
1056
- }
1057
- }
1058
-
1059
- elem.__resize_listeners__.push(callback);
1060
- total++;
1061
- }
1062
-
1063
- function removeListener (elem, callback) {
1064
- var listeners = elem.__resize_listeners__;
1065
- if (!listeners) {
1066
- return
1067
- }
1068
-
1069
- if (callback) {
1070
- listeners.splice(listeners.indexOf(callback), 1);
1071
- }
1072
-
1073
- // no listeners exist, or removing all listeners
1074
- if (!listeners.length || !callback) {
1075
- // targeting IE9/10
1076
- if (elem.detachEvent && elem.removeEventListener) {
1077
- elem.detachEvent('onresize', elem.__resize_legacy_resize_handler__);
1078
- document.removeEventListener('DOMSubtreeModified', elem.__resize_mutation_handler__);
1079
- return
1080
- }
1081
-
1082
- if (elem.__resize_observer__) {
1083
- elem.__resize_observer__.unobserve(elem);
1084
- elem.__resize_observer__.disconnect();
1085
- elem.__resize_observer__ = null;
1086
- } else {
1087
- if (elem.__resize_mutation_observer__) {
1088
- elem.__resize_mutation_observer__.disconnect();
1089
- elem.__resize_mutation_observer__ = null;
1090
- }
1091
- elem.removeEventListener('scroll', handleScroll);
1092
- elem.removeChild(elem.__resize_triggers__.triggers);
1093
- elem.__resize_triggers__ = null;
1094
- }
1095
- elem.__resize_listeners__ = null;
1096
- }
1097
-
1098
- if (!--total && style) {
1099
- style.parentNode.removeChild(style);
1100
- }
1101
- }
1102
-
1103
- function getUpdatedSize (elem) {
1104
- var ref = elem.__resize_last__;
1105
- var width = ref.width;
1106
- var height = ref.height;
1107
- var offsetWidth = elem.offsetWidth;
1108
- var offsetHeight = elem.offsetHeight;
1109
- if (offsetWidth !== width || offsetHeight !== height) {
1110
- return {
1111
- width: offsetWidth,
1112
- height: offsetHeight
1113
- }
1114
- }
1115
- return null
1116
- }
1117
-
1118
- function handleMutation () {
1119
- // `this` denotes the scrolling element
1120
- var ref = getRenderInfo(this);
1121
- var rendered = ref.rendered;
1122
- var detached = ref.detached;
1123
- if (rendered !== this.__resize_rendered__) {
1124
- if (!detached && this.__resize_triggers__) {
1125
- resetTriggers(this);
1126
- this.addEventListener('scroll', handleScroll, true);
1127
- }
1128
- this.__resize_rendered__ = rendered;
1129
- runCallbacks(this);
1130
- }
1131
- }
1132
-
1133
- function handleScroll () {
1134
- var this$1 = this;
1135
-
1136
- // `this` denotes the scrolling element
1137
- resetTriggers(this);
1138
- if (this.__resize_raf__) {
1139
- cancelAnimationFrame(this.__resize_raf__);
1140
- }
1141
- this.__resize_raf__ = requestAnimationFrame(function () {
1142
- var updated = getUpdatedSize(this$1);
1143
- if (updated) {
1144
- this$1.__resize_last__ = updated;
1145
- runCallbacks(this$1);
1146
- }
1147
- });
1148
- }
1149
-
1150
- function runCallbacks (elem) {
1151
- if (!elem || !elem.__resize_listeners__) {
1152
- return
1153
- }
1154
- elem.__resize_listeners__.forEach(function (callback) {
1155
- callback.call(elem, elem);
1156
- });
1157
- }
1158
-
1159
- function initTriggers (elem) {
1160
- var position = getComputedStyle(elem, 'position');
1161
- if (!position || position === 'static') {
1162
- elem.style.position = 'relative';
1163
- }
1164
-
1165
- elem.__resize_old_position__ = position;
1166
- elem.__resize_last__ = {};
1167
-
1168
- var triggers = createElement('div', {
1169
- className: 'resize-triggers'
1170
- });
1171
- var expand = createElement('div', {
1172
- className: 'resize-expand-trigger'
1173
- });
1174
- var expandChild = createElement('div');
1175
- var contract = createElement('div', {
1176
- className: 'resize-contract-trigger'
1177
- });
1178
- expand.appendChild(expandChild);
1179
- triggers.appendChild(expand);
1180
- triggers.appendChild(contract);
1181
- elem.appendChild(triggers);
1182
-
1183
- elem.__resize_triggers__ = {
1184
- triggers: triggers,
1185
- expand: expand,
1186
- expandChild: expandChild,
1187
- contract: contract
1188
- };
1189
-
1190
- resetTriggers(elem);
1191
- elem.addEventListener('scroll', handleScroll, true);
1192
-
1193
- elem.__resize_last__ = {
1194
- width: elem.offsetWidth,
1195
- height: elem.offsetHeight
1196
- };
1197
- }
1198
-
1199
- function resetTriggers (elem) {
1200
- var ref = elem.__resize_triggers__;
1201
- var expand = ref.expand;
1202
- var expandChild = ref.expandChild;
1203
- var contract = ref.contract;
1204
-
1205
- // batch read
1206
- var csw = contract.scrollWidth;
1207
- var csh = contract.scrollHeight;
1208
- var eow = expand.offsetWidth;
1209
- var eoh = expand.offsetHeight;
1210
- var esw = expand.scrollWidth;
1211
- var esh = expand.scrollHeight;
1212
-
1213
- // batch write
1214
- contract.scrollLeft = csw;
1215
- contract.scrollTop = csh;
1216
- expandChild.style.width = eow + 1 + 'px';
1217
- expandChild.style.height = eoh + 1 + 'px';
1218
- expand.scrollLeft = esw;
1219
- expand.scrollTop = esh;
1220
- }
1221
-
1222
-
1223
-
1224
- // EXTERNAL MODULE: external "../directives"
1225
- var external_directives_ = __webpack_require__(4061);
1226
- // EXTERNAL MODULE: external "../icon"
1227
- var external_icon_ = __webpack_require__(6870);
1228
- // EXTERNAL MODULE: ../../node_modules/@babel/runtime/regenerator/index.js
1229
- var regenerator = __webpack_require__(7162);
1230
- var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
1231
- ;// CONCATENATED MODULE: ../../node_modules/tslib/tslib.es6.js
1232
- /******************************************************************************
1233
- Copyright (c) Microsoft Corporation.
1234
-
1235
- Permission to use, copy, modify, and/or distribute this software for any
1236
- purpose with or without fee is hereby granted.
1237
-
1238
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1239
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1240
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1241
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1242
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1243
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1244
- PERFORMANCE OF THIS SOFTWARE.
1245
- ***************************************************************************** */
1246
- /* global Reflect, Promise */
1247
-
1248
- var extendStatics = function(d, b) {
1249
- extendStatics = Object.setPrototypeOf ||
1250
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
1251
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
1252
- return extendStatics(d, b);
1253
- };
1254
-
1255
- function __extends(d, b) {
1256
- if (typeof b !== "function" && b !== null)
1257
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1258
- extendStatics(d, b);
1259
- function __() { this.constructor = d; }
1260
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1261
- }
1262
-
1263
- var __assign = function() {
1264
- __assign = Object.assign || function __assign(t) {
1265
- for (var s, i = 1, n = arguments.length; i < n; i++) {
1266
- s = arguments[i];
1267
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1268
- }
1269
- return t;
1270
- }
1271
- return __assign.apply(this, arguments);
1272
- }
1273
-
1274
- function __rest(s, e) {
1275
- var t = {};
1276
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1277
- t[p] = s[p];
1278
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
1279
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1280
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1281
- t[p[i]] = s[p[i]];
1282
- }
1283
- return t;
1284
- }
1285
-
1286
- function __decorate(decorators, target, key, desc) {
1287
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1288
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1289
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1290
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1291
- }
1292
-
1293
- function __param(paramIndex, decorator) {
1294
- return function (target, key) { decorator(target, key, paramIndex); }
1295
- }
1296
-
1297
- function __metadata(metadataKey, metadataValue) {
1298
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
1299
- }
1300
-
1301
- function __awaiter(thisArg, _arguments, P, generator) {
1302
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1303
- return new (P || (P = Promise))(function (resolve, reject) {
1304
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1305
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1306
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1307
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1308
- });
1309
- }
1310
-
1311
- function __generator(thisArg, body) {
1312
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1313
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1314
- function verb(n) { return function (v) { return step([n, v]); }; }
1315
- function step(op) {
1316
- if (f) throw new TypeError("Generator is already executing.");
1317
- while (_) try {
1318
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1319
- if (y = 0, t) op = [op[0] & 2, t.value];
1320
- switch (op[0]) {
1321
- case 0: case 1: t = op; break;
1322
- case 4: _.label++; return { value: op[1], done: false };
1323
- case 5: _.label++; y = op[1]; op = [0]; continue;
1324
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
1325
- default:
1326
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
1327
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
1328
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
1329
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
1330
- if (t[2]) _.ops.pop();
1331
- _.trys.pop(); continue;
1332
- }
1333
- op = body.call(thisArg, _);
1334
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
1335
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1336
- }
1337
- }
1338
-
1339
- var __createBinding = Object.create ? (function(o, m, k, k2) {
1340
- if (k2 === undefined) k2 = k;
1341
- var desc = Object.getOwnPropertyDescriptor(m, k);
1342
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1343
- desc = { enumerable: true, get: function() { return m[k]; } };
1344
- }
1345
- Object.defineProperty(o, k2, desc);
1346
- }) : (function(o, m, k, k2) {
1347
- if (k2 === undefined) k2 = k;
1348
- o[k2] = m[k];
1349
- });
1350
-
1351
- function __exportStar(m, o) {
1352
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
1353
- }
1354
-
1355
- function __values(o) {
1356
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
1357
- if (m) return m.call(o);
1358
- if (o && typeof o.length === "number") return {
1359
- next: function () {
1360
- if (o && i >= o.length) o = void 0;
1361
- return { value: o && o[i++], done: !o };
1362
- }
1363
- };
1364
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
1365
- }
1366
-
1367
- function __read(o, n) {
1368
- var m = typeof Symbol === "function" && o[Symbol.iterator];
1369
- if (!m) return o;
1370
- var i = m.call(o), r, ar = [], e;
1371
- try {
1372
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1373
- }
1374
- catch (error) { e = { error: error }; }
1375
- finally {
1376
- try {
1377
- if (r && !r.done && (m = i["return"])) m.call(i);
1378
- }
1379
- finally { if (e) throw e.error; }
1380
- }
1381
- return ar;
1382
- }
1383
-
1384
- /** @deprecated */
1385
- function __spread() {
1386
- for (var ar = [], i = 0; i < arguments.length; i++)
1387
- ar = ar.concat(__read(arguments[i]));
1388
- return ar;
1389
- }
1390
-
1391
- /** @deprecated */
1392
- function __spreadArrays() {
1393
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
1394
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
1395
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
1396
- r[k] = a[j];
1397
- return r;
1398
- }
1399
-
1400
- function __spreadArray(to, from, pack) {
1401
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1402
- if (ar || !(i in from)) {
1403
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1404
- ar[i] = from[i];
1405
- }
1406
- }
1407
- return to.concat(ar || Array.prototype.slice.call(from));
1408
- }
1409
-
1410
- function __await(v) {
1411
- return this instanceof __await ? (this.v = v, this) : new __await(v);
1412
- }
1413
-
1414
- function __asyncGenerator(thisArg, _arguments, generator) {
1415
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1416
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
1417
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
1418
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
1419
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
1420
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
1421
- function fulfill(value) { resume("next", value); }
1422
- function reject(value) { resume("throw", value); }
1423
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
1424
- }
1425
-
1426
- function __asyncDelegator(o) {
1427
- var i, p;
1428
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
1429
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
1430
- }
1431
-
1432
- function __asyncValues(o) {
1433
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1434
- var m = o[Symbol.asyncIterator], i;
1435
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
1436
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
1437
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
1438
- }
1439
-
1440
- function __makeTemplateObject(cooked, raw) {
1441
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
1442
- return cooked;
1443
- };
1444
-
1445
- var __setModuleDefault = Object.create ? (function(o, v) {
1446
- Object.defineProperty(o, "default", { enumerable: true, value: v });
1447
- }) : function(o, v) {
1448
- o["default"] = v;
1449
- };
1450
-
1451
- function __importStar(mod) {
1452
- if (mod && mod.__esModule) return mod;
1453
- var result = {};
1454
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1455
- __setModuleDefault(result, mod);
1456
- return result;
1457
- }
1458
-
1459
- function __importDefault(mod) {
1460
- return (mod && mod.__esModule) ? mod : { default: mod };
1461
- }
1462
-
1463
- function __classPrivateFieldGet(receiver, state, kind, f) {
1464
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1465
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1466
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1467
- }
1468
-
1469
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
1470
- if (kind === "m") throw new TypeError("Private method is not writable");
1471
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1472
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1473
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1474
- }
1475
-
1476
- function __classPrivateFieldIn(state, receiver) {
1477
- if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
1478
- return typeof state === "function" ? receiver === state : state.has(receiver);
1479
- }
1480
-
1481
- // EXTERNAL MODULE: external "../popover"
1482
- var external_popover_ = __webpack_require__(5537);
1483
- var external_popover_default = /*#__PURE__*/__webpack_require__.n(external_popover_);
1484
- ;// CONCATENATED MODULE: ../../packages/search-select/src/menu.tsx
1485
-
1486
-
1487
- /*
1488
- * Tencent is pleased to support the open source community by making
1489
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1490
- *
1491
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1492
- *
1493
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1494
- *
1495
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1496
- *
1497
- * ---------------------------------------------------
1498
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1499
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1500
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1501
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1502
- *
1503
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1504
- * the Software.
1505
- *
1506
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1507
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1508
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1509
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1510
- * IN THE SOFTWARE.
1511
- */
1512
-
1513
-
1514
- ;
1515
- /* harmony default export */ const menu = ((0,external_vue_.defineComponent)({
1516
- name: 'SearchSelectMenu',
1517
- props: {
1518
- list: {
1519
- type: Array
1520
- },
1521
- hoverId: String,
1522
- keyword: {
1523
- type: String,
1524
- "default": ''
1525
- },
1526
- multiple: {
1527
- type: Boolean,
1528
- "default": false
1529
- },
1530
- selected: {
1531
- type: Array,
1532
- "default": function _default() {
1533
- return [];
1534
- }
1535
- },
1536
- conditions: {
1537
- type: Array
1538
- },
1539
- footerBtns: {
1540
- type: Array,
1541
- "default": function _default() {
1542
- return [{
1543
- id: 'confirm',
1544
- name: '确认'
1545
- }, {
1546
- id: 'cancel',
1547
- name: '取消',
1548
- disabled: false
1549
- }];
1550
- }
1551
- }
1552
- },
1553
- emits: ['selectItem', 'selectCondition', 'footerClick'],
1554
- setup: function setup(props, _ref) {
1555
- var emit = _ref.emit;
1556
-
1557
- // events
1558
- function handleClick(item) {
1559
- emit('selectItem', item);
1560
- }
1561
-
1562
- function handleClickCondition(item) {
1563
- emit('selectCondition', item);
1564
- }
1565
-
1566
- function handleClickFooterBtn(item) {
1567
- emit('footerClick', item);
1568
- }
1569
-
1570
- var filterList = (0,external_vue_.computed)(function () {
1571
- var _a, _b;
1572
-
1573
- if (!((_a = props.list) === null || _a === void 0 ? void 0 : _a.length)) return [];
1574
- if (!((_b = props.keyword) === null || _b === void 0 ? void 0 : _b.length)) return props.list;
1575
- return props.list.filter(function (item) {
1576
- return item.name.toLocaleLowerCase().includes(props.keyword.toLocaleLowerCase());
1577
- });
1578
- });
1579
-
1580
- function transformNode(str) {
1581
- if (!str) return str;
1582
- var keyword = props.keyword;
1583
- var len = keyword.length;
1584
- if (!(keyword === null || keyword === void 0 ? void 0 : keyword.trim().length) || !str.toLocaleLowerCase().includes(keyword.toLocaleLowerCase())) return str;
1585
- var list = [];
1586
- var lastIndex = -1;
1587
- keyword = keyword.replace(/([.*/]{1})/gmi, '\\$1');
1588
- str.replace(new RegExp("".concat(keyword), 'igm'), function (key, index) {
1589
- if (list.length === 0 && index !== 0) {
1590
- list.push(str.slice(0, index));
1591
- } else if (lastIndex >= 0) {
1592
- list.push(str.slice(lastIndex + key.length, index));
1593
- }
1594
-
1595
- list.push((0,external_vue_.createVNode)("span", {
1596
- "class": 'is-keyword'
1597
- }, [key]));
1598
- lastIndex = index;
1599
- return key;
1600
- });
1601
-
1602
- if (lastIndex >= 0) {
1603
- list.push(str.slice(lastIndex + len));
1604
- }
1605
-
1606
- return list.length ? list : str;
1607
- }
1608
-
1609
- function getSearchNode(item) {
1610
- var _a;
1611
-
1612
- if (!((_a = item.value) === null || _a === void 0 ? void 0 : _a.name)) return transformNode(item.name);
1613
- return [(0,external_vue_.createVNode)("span", {
1614
- "class": "menu-name"
1615
- }, [item.name, (0,external_vue_.createTextVNode)(":")]), item.value.name];
1616
- }
1617
-
1618
- ;
1619
- return {
1620
- handleClick: handleClick,
1621
- handleClickCondition: handleClickCondition,
1622
- handleClickFooterBtn: handleClickFooterBtn,
1623
- filterList: filterList,
1624
- getSearchNode: getSearchNode
1625
- };
1626
- },
1627
- render: function render() {
1628
- var _this = this;
1629
-
1630
- var _a, _b, _c;
1631
-
1632
- return (0,external_vue_.createVNode)("div", {
1633
- "class": 'bk-search-select-menu'
1634
- }, [!!((_a = this.conditions) === null || _a === void 0 ? void 0 : _a.length) && (0,external_vue_.createVNode)("ul", {
1635
- "class": "menu-header"
1636
- }, [this.conditions.map(function (item) {
1637
- return (0,external_vue_.createVNode)("li", {
1638
- "key": item.id,
1639
- "class": "menu-header-item ".concat(item.disabled ? 'is-disabled' : ''),
1640
- "onClick": function onClick() {
1641
- return !item.disabled && _this.handleClickCondition(item);
1642
- }
1643
- }, [item.name]);
1644
- })]), (0,external_vue_.createVNode)("ul", {
1645
- "class": 'menu-content'
1646
- }, [(_b = this.list) === null || _b === void 0 ? void 0 : _b.map(function (item) {
1647
- return (0,external_vue_.createVNode)("li", {
1648
- "class": "menu-item ".concat(item.disabled ? 'is-disabled' : '', " ").concat(_this.hoverId === item.id && !item.disabled ? 'is-hover' : ''),
1649
- "key": item.id,
1650
- "id": item.id,
1651
- "tabindex": '-1',
1652
- "onClick": function onClick() {
1653
- return !item.disabled && _this.handleClick(item);
1654
- }
1655
- }, [_this.$slots["default"] ? _this.$slots["default"]({
1656
- item: item,
1657
- list: _this.list,
1658
- multiple: !!_this.multiple,
1659
- hoverId: _this.hoverId,
1660
- getSearchNode: _this.getSearchNode
1661
- }) : (0,external_vue_.createVNode)(external_vue_.Fragment, null, [_this.getSearchNode(item), _this.multiple && _this.selected.includes(item.id) && (0,external_vue_.createVNode)(external_icon_.Done, {
1662
- "class": "is-selected"
1663
- }, null)])]);
1664
- })]), this.multiple && ((_c = this.footerBtns) === null || _c === void 0 ? void 0 : _c.length) && (0,external_vue_.createVNode)("div", {
1665
- "class": "menu-footer"
1666
- }, [this.footerBtns.map(function (item) {
1667
- return (0,external_vue_.createVNode)("span", {
1668
- "class": "menu-footer-btn ".concat(item.disabled ? 'is-disabled' : ''),
1669
- "key": item.id,
1670
- "onClick": function onClick() {
1671
- return !item.disabled && _this.handleClickFooterBtn(item);
1672
- }
1673
- }, [item.name]);
1674
- })])]);
1675
- }
1676
- }));
1677
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
1678
- function _classCallCheck(instance, Constructor) {
1679
- if (!(instance instanceof Constructor)) {
1680
- throw new TypeError("Cannot call a class as a function");
1681
- }
1682
- }
1683
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/createClass.js
1684
- function _defineProperties(target, props) {
1685
- for (var i = 0; i < props.length; i++) {
1686
- var descriptor = props[i];
1687
- descriptor.enumerable = descriptor.enumerable || false;
1688
- descriptor.configurable = true;
1689
- if ("value" in descriptor) descriptor.writable = true;
1690
- Object.defineProperty(target, descriptor.key, descriptor);
1691
- }
1692
- }
1693
-
1694
- function _createClass(Constructor, protoProps, staticProps) {
1695
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1696
- if (staticProps) _defineProperties(Constructor, staticProps);
1697
- Object.defineProperty(Constructor, "prototype", {
1698
- writable: false
1699
- });
1700
- return Constructor;
1701
- }
1702
- ;// CONCATENATED MODULE: ../../packages/search-select/src/utils.ts
1703
-
1704
-
1705
-
1706
- /*
1707
- * Tencent is pleased to support the open source community by making
1708
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1709
- *
1710
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1711
- *
1712
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1713
- *
1714
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1715
- *
1716
- * ---------------------------------------------------
1717
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1718
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1719
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1720
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1721
- *
1722
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1723
- * the Software.
1724
- *
1725
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1726
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1727
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1728
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1729
- * IN THE SOFTWARE.
1730
- */
1731
-
1732
- /**
1733
- * @description: 获取menu list方法
1734
- * @param {ISearchItem} item 已选择的key字段 为空则代表当前并未选择key字段
1735
- * @param {string} keyword 已输入的文本
1736
- * @return {*} menu list用于渲染选择弹层列表
1737
- */
1738
-
1739
- var ValueBehavior;
1740
-
1741
- (function (ValueBehavior) {
1742
- ValueBehavior["ALL"] = "all";
1743
- ValueBehavior["NEEDKEY"] = "need-key";
1744
- })(ValueBehavior || (ValueBehavior = {}));
1745
-
1746
- var SEARCH_SLECT_PROVIDER_KEY = Symbol('SEARCH_SLECT_PROVIDER_KEY');
1747
- var useSearchSelectProvider = function useSearchSelectProvider(data) {
1748
- (0,external_vue_.provide)(SEARCH_SLECT_PROVIDER_KEY, data);
1749
- };
1750
- var useSearchSelectInject = function useSearchSelectInject() {
1751
- return (0,external_vue_.inject)(SEARCH_SLECT_PROVIDER_KEY);
1752
- };
1753
- var SearchInputMode;
1754
-
1755
- (function (SearchInputMode) {
1756
- SearchInputMode["DEFAULT"] = "default";
1757
- SearchInputMode["EDIT"] = "edit";
1758
- })(SearchInputMode || (SearchInputMode = {}));
1759
-
1760
- var SelectedItem = /*#__PURE__*/function () {
1761
- function SelectedItem(searchItem) {
1762
- var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
1763
- var splitCode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '|';
1764
-
1765
- _classCallCheck(this, SelectedItem);
1766
-
1767
- this.searchItem = searchItem;
1768
- this.type = type;
1769
- this.splitCode = splitCode;
1770
- this.values = [];
1771
- this.id = searchItem.id;
1772
- this.name = searchItem.name;
1773
- }
1774
-
1775
- _createClass(SelectedItem, [{
1776
- key: "multiple",
1777
- get: function get() {
1778
- return !!this.searchItem.multiple;
1779
- }
1780
- }, {
1781
- key: "placeholder",
1782
- get: function get() {
1783
- return this.searchItem.placeholder || '';
1784
- }
1785
- }, {
1786
- key: "children",
1787
- get: function get() {
1788
- return this.searchItem.children || [];
1789
- }
1790
- }, {
1791
- key: "validate",
1792
- get: function get() {
1793
- return !this.searchItem.noValidate;
1794
- }
1795
- }, {
1796
- key: "inputInnerHtml",
1797
- get: function get() {
1798
- var _a;
1799
-
1800
- if (this.isSpecialType()) return this.name;
1801
- return "".concat(this.keyInnerHtml).concat(((_a = this.values) === null || _a === void 0 ? void 0 : _a.map(function (item) {
1802
- return item.name;
1803
- }).join(this.splitCode)) || '');
1804
- }
1805
- }, {
1806
- key: "inputInnerText",
1807
- get: function get() {
1808
- var _a;
1809
-
1810
- if (this.isSpecialType()) return this.name;
1811
- return "".concat(this.keyInnerText).concat(((_a = this.values) === null || _a === void 0 ? void 0 : _a.map(function (item) {
1812
- return item.name;
1813
- }).join(this.splitCode)) || '');
1814
- }
1815
- }, {
1816
- key: "keyInnerHtml",
1817
- get: function get() {
1818
- if (this.isSpecialType()) return this.name;
1819
- return this.name ? "".concat(this.name, ":\xA0") : '';
1820
- }
1821
- }, {
1822
- key: "keyInnerText",
1823
- get: function get() {
1824
- if (this.isSpecialType()) return this.name;
1825
- return this.name ? "".concat(this.name, ": ") : '';
1826
- }
1827
- }, {
1828
- key: "isSpecialType",
1829
- value: function isSpecialType() {
1830
- return ['text', 'condition'].includes(this.type);
1831
- }
1832
- }, {
1833
- key: "addValue",
1834
- value: function addValue(item) {
1835
- if (this.multiple) {
1836
- var index = this.values.findIndex(function (val) {
1837
- return val.id === item.id;
1838
- });
1839
-
1840
- if (index > -1) {
1841
- this.values.splice(index, 1);
1842
- return;
1843
- }
1844
-
1845
- this.values.push(item);
1846
- return;
1847
- }
1848
-
1849
- this.values = [item];
1850
- }
1851
- }, {
1852
- key: "toValue",
1853
- value: function toValue() {
1854
- var _a;
1855
-
1856
- var value = {
1857
- id: this.id,
1858
- name: this.name
1859
- };
1860
-
1861
- if ((_a = this.values) === null || _a === void 0 ? void 0 : _a.length) {
1862
- value.values = this.values.map(function (item) {
1863
- return {
1864
- id: item.id,
1865
- name: item.name
1866
- };
1867
- });
1868
- }
1869
-
1870
- if (this.type && this.type !== 'default') {
1871
- value.type = this.type;
1872
- }
1873
-
1874
- return value;
1875
- }
1876
- }, {
1877
- key: "toValueKey",
1878
- value: function toValueKey() {
1879
- return JSON.stringify(this.toValue());
1880
- }
1881
- }, {
1882
- key: "isInValueList",
1883
- value: function isInValueList(item) {
1884
- return this.children.some(function (v) {
1885
- return v.id === (item === null || item === void 0 ? void 0 : item.id);
1886
- });
1887
- }
1888
- }]);
1889
-
1890
- return SelectedItem;
1891
- }();
1892
- ;// CONCATENATED MODULE: ../../packages/search-select/src/input.tsx
1893
-
1894
-
1895
-
1896
- /*
1897
- * Tencent is pleased to support the open source community by making
1898
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1899
- *
1900
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1901
- *
1902
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1903
- *
1904
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1905
- *
1906
- * ---------------------------------------------------
1907
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1908
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1909
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1910
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1911
- *
1912
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1913
- * the Software.
1914
- *
1915
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1916
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1917
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1918
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1919
- * IN THE SOFTWARE.
1920
- */
1921
-
1922
-
1923
-
1924
-
1925
-
1926
-
1927
-
1928
- /* harmony default export */ const input = ((0,external_vue_.defineComponent)({
1929
- name: 'SearchSelectInput',
1930
- directives: {
1931
- clickoutside: external_directives_.clickoutside
1932
- },
1933
- props: {
1934
- data: {
1935
- type: Array,
1936
- required: true
1937
- },
1938
- showInputBefore: Boolean,
1939
- showCondition: Boolean,
1940
- clickOutside: Function,
1941
- conditions: {
1942
- type: Array,
1943
- "default": function _default() {
1944
- return [];
1945
- }
1946
- },
1947
- defautUsingItem: Object,
1948
- mode: {
1949
- type: String,
1950
- "default": SearchInputMode.DEFAULT
1951
- },
1952
- getMenuList: Function,
1953
- validateValues: Function,
1954
- valueBehavior: String
1955
- },
1956
- emits: ['focus', 'add', 'delete'],
1957
- setup: function setup(props, _ref) {
1958
- var emit = _ref.emit,
1959
- expose = _ref.expose;
1960
- var inputRef = (0,external_vue_.ref)(null);
1961
- var popoverRef = (0,external_vue_.ref)(null);
1962
- var keyword = (0,external_vue_.ref)('');
1963
- var showNoSelectValueError = (0,external_vue_.ref)(false);
1964
- var isFocus = (0,external_vue_.ref)(false);
1965
- var showPopover = (0,external_vue_.ref)(false);
1966
- var usingItem = (0,external_vue_.ref)(props.defautUsingItem);
1967
- var menuHoverId = (0,external_vue_.ref)('');
1968
- var loading = (0,external_vue_.ref)(false);
1969
- var debounceSetMenuList = (0,external_shared_.debounce)(300, setMenuList); // const selectMenuList = ref<ICommonItem[]>([]);
1970
-
1971
- var isBindEvent = false;
1972
- var remoteMenuList = (0,external_vue_.ref)([]);
1973
- var menuList = (0,external_vue_.ref)([]);
1974
-
1975
- var _useSearchSelectInjec = useSearchSelectInject(),
1976
- editKey = _useSearchSelectInjec.editKey,
1977
- onValidate = _useSearchSelectInjec.onValidate,
1978
- valueSplitCode = _useSearchSelectInjec.valueSplitCode;
1979
-
1980
- (0,external_vue_.watch)(editKey, function () {
1981
- if (props.mode === SearchInputMode.DEFAULT && editKey.value) {
1982
- showPopover.value = false;
1983
- }
1984
- }); // effects
1985
-
1986
- (0,external_vue_.watchEffect)(function () {
1987
- if (!keyword.value) {
1988
- setInputText();
1989
- }
1990
- }, {
1991
- flush: 'pre'
1992
- });
1993
- (0,external_vue_.watch)([menuList, showPopover], function () {
1994
- var _a;
1995
-
1996
- if (((_a = menuList.value) === null || _a === void 0 ? void 0 : _a.some(function (item) {
1997
- return !item.disabled;
1998
- })) && showPopover.value) {
1999
- if (!isBindEvent) {
2000
- if (props.valueBehavior === ValueBehavior.NEEDKEY) {
2001
- menuHoverId.value = menuList.value.find(function (item) {
2002
- return !item.disabled;
2003
- }).id;
2004
- } else {
2005
- menuHoverId.value = '';
2006
- }
2007
-
2008
- isBindEvent = true;
2009
- document.addEventListener('keydown', handleDocumentKeydown);
2010
- }
2011
- } else {
2012
- document.removeEventListener('keydown', handleDocumentKeydown);
2013
- isBindEvent = false;
2014
-
2015
- if (props.valueBehavior !== ValueBehavior.NEEDKEY) {
2016
- menuHoverId.value = '';
2017
- }
2018
- }
2019
- }); // events
2020
-
2021
- function handleDocumentKeydown(e) {
2022
- switch (e.code) {
2023
- case 'ArrowDown':
2024
- case 'ArrowUp':
2025
- documentArrowEvent(e);
2026
- break;
2027
-
2028
- case 'Enter':
2029
- case 'NumpadEnter':
2030
- documentEnterEvent(e);
2031
- break;
2032
- }
2033
- }
2034
-
2035
- function documentArrowEvent(e) {
2036
- var _a;
2037
-
2038
- e.preventDefault();
2039
- (_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.blur();
2040
- var len = menuList.value.length;
2041
- var i = len;
2042
- var index = menuList.value.findIndex(function (set) {
2043
- return set.id === menuHoverId.value;
2044
- });
2045
-
2046
- while (i >= 0) {
2047
- index = e.code === 'ArrowDown' ? index + 1 : index - 1; // eslint-disable-next-line no-nested-ternary
2048
-
2049
- index = index > len - 1 ? 0 : index < 0 ? len - 1 : index;
2050
- var item = menuList.value[index];
2051
-
2052
- if (item && !item.disabled) {
2053
- i = -1;
2054
- var dom = document.getElementById(item.id);
2055
- dom === null || dom === void 0 ? void 0 : dom.focus();
2056
- menuHoverId.value = item.id;
2057
- return;
2058
- }
2059
-
2060
- i -= 1;
2061
- }
2062
- }
2063
-
2064
- function documentEnterEvent(e) {
2065
- if (isBindEvent) {
2066
- e.preventDefault();
2067
- var item = menuList.value.find(function (item) {
2068
- return item.id === menuHoverId.value;
2069
- });
2070
- item && handleSelectItem(item);
2071
- }
2072
- }
2073
-
2074
- function handleClickOutside(e) {
2075
- var _a, _b;
2076
-
2077
- if (!((_a = popoverRef.value) === null || _a === void 0 ? void 0 : _a.contains(e.target)) && ((_b = props.clickOutside) === null || _b === void 0 ? void 0 : _b.call(props, e.target, popoverRef.value))) {
2078
- showPopover.value = false;
2079
- isFocus.value = false;
2080
- emit('focus', isFocus.value);
2081
- }
2082
- }
2083
-
2084
- function handleInputFocus(e) {
2085
- setInputFocus();
2086
- e && setMenuList();
2087
- }
2088
-
2089
- function handleInputChange(event) {
2090
- var _a, _b, _c, _d, _e, _f, _g;
2091
-
2092
- clearInput();
2093
- var text = event.target.innerText;
2094
-
2095
- if (/(\r|\n)/gm.test(text) || /\s{2}/gm.test(text)) {
2096
- event.preventDefault();
2097
- text = text.replace(/(\r|\n)/gm, valueSplitCode.value).replace(/\s{2}/gm, '');
2098
- inputRef.value.innerText = text;
2099
- setInputFocus();
2100
- keyword.value = text.replace(((_a = usingItem.value) === null || _a === void 0 ? void 0 : _a.keyInnerText) || '', '').trim();
2101
- debounceSetMenuList();
2102
- } else if (!keyword.value && text.length < (((_c = (_b = usingItem.value) === null || _b === void 0 ? void 0 : _b.inputInnerText) === null || _c === void 0 ? void 0 : _c.length) || 1)) {
2103
- var outerText = text.replace("\xA0", " ").replace(((_d = usingItem.value) === null || _d === void 0 ? void 0 : _d.keyInnerText.replace("\xA0", " ").trim()) || '', '').trim();
2104
-
2105
- if (outerText || !(text === null || text === void 0 ? void 0 : text.length)) {
2106
- usingItem.value = null;
2107
- }
2108
-
2109
- keyword.value = outerText ? text : '';
2110
- debounceSetMenuList();
2111
- } else if (!((_f = (_e = usingItem.value) === null || _e === void 0 ? void 0 : _e.values) === null || _f === void 0 ? void 0 : _f.length)) {
2112
- keyword.value = text.replace("\xA0", " ").replace(((_g = usingItem.value) === null || _g === void 0 ? void 0 : _g.keyInnerText.replace("\xA0", " ")) || '', '').trim();
2113
- setInputFocus();
2114
- debounceSetMenuList();
2115
- }
2116
- }
2117
-
2118
- function handleInputKeyup(event) {
2119
- switch (event.code) {
2120
- case 'Enter':
2121
- case 'NumpadEnter':
2122
- if (props.valueBehavior === ValueBehavior.NEEDKEY && menuList.value.some(function (item) {
2123
- return item.id === menuHoverId.value;
2124
- })) return;
2125
- handleKeyEnter(event);
2126
- break;
2127
-
2128
- case 'Backspace':
2129
- handleKeyBackspace();
2130
-
2131
- default:
2132
- showNoSelectValueError.value = false;
2133
- break;
2134
- }
2135
- }
2136
-
2137
- function handleKeyEnter(event) {
2138
- var _a;
2139
-
2140
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator_default().mark(function _callee() {
2141
- var value, _res, values, valueList, _res2, _value, _res3, res;
2142
-
2143
- return regenerator_default().wrap(function _callee$(_context) {
2144
- while (1) {
2145
- switch (_context.prev = _context.next) {
2146
- case 0:
2147
- event === null || event === void 0 ? void 0 : event.preventDefault(); // resolve 中文输入时直接按下enter的错误表现
2148
-
2149
- _context.next = 3;
2150
- return new Promise(function (r) {
2151
- return setTimeout(r, 0);
2152
- });
2153
-
2154
- case 3:
2155
- if (usingItem.value) {
2156
- _context.next = 16;
2157
- break;
2158
- }
2159
-
2160
- if (!(!keyword.value || props.valueBehavior === ValueBehavior.NEEDKEY)) {
2161
- _context.next = 6;
2162
- break;
2163
- }
2164
-
2165
- return _context.abrupt("return");
2166
-
2167
- case 6:
2168
- value = {
2169
- id: keyword.value,
2170
- name: keyword.value
2171
- };
2172
- _context.next = 9;
2173
- return validateUsingItemValues(value);
2174
-
2175
- case 9:
2176
- _res = _context.sent;
2177
-
2178
- if (_res) {
2179
- _context.next = 12;
2180
- break;
2181
- }
2182
-
2183
- return _context.abrupt("return");
2184
-
2185
- case 12:
2186
- emit('add', new SelectedItem(value, 'text', valueSplitCode.value));
2187
- keyword.value = '';
2188
- setMenuList();
2189
- return _context.abrupt("return");
2190
-
2191
- case 16:
2192
- values = usingItem.value.values;
2193
-
2194
- if (values === null || values === void 0 ? void 0 : values.length) {
2195
- _context.next = 43;
2196
- break;
2197
- }
2198
-
2199
- if (!((_a = keyword.value) === null || _a === void 0 ? void 0 : _a.length)) {
2200
- _context.next = 41;
2201
- break;
2202
- }
2203
-
2204
- if (!keyword.value.includes(valueSplitCode.value)) {
2205
- _context.next = 29;
2206
- break;
2207
- }
2208
-
2209
- valueList = keyword.value.split(valueSplitCode.value);
2210
- _context.next = 23;
2211
- return validateUsingItemValues({
2212
- id: keyword.value,
2213
- name: keyword.value
2214
- });
2215
-
2216
- case 23:
2217
- _res2 = _context.sent;
2218
-
2219
- if (_res2) {
2220
- _context.next = 26;
2221
- break;
2222
- }
2223
-
2224
- return _context.abrupt("return");
2225
-
2226
- case 26:
2227
- valueList.forEach(function (v) {
2228
- return usingItem.value.addValue({
2229
- id: v,
2230
- name: v
2231
- });
2232
- });
2233
- _context.next = 36;
2234
- break;
2235
-
2236
- case 29:
2237
- _value = {
2238
- id: keyword.value,
2239
- name: keyword.value
2240
- };
2241
- _context.next = 32;
2242
- return validateUsingItemValues(_value);
2243
-
2244
- case 32:
2245
- _res3 = _context.sent;
2246
-
2247
- if (_res3) {
2248
- _context.next = 35;
2249
- break;
2250
- }
2251
-
2252
- return _context.abrupt("return");
2253
-
2254
- case 35:
2255
- usingItem.value.addValue(_value);
2256
-
2257
- case 36:
2258
- emit('add', usingItem.value);
2259
- keyword.value = '';
2260
- usingItem.value = null;
2261
- setInputFocus(true);
2262
- return _context.abrupt("return");
2263
-
2264
- case 41:
2265
- showNoSelectValueError.value = true;
2266
- return _context.abrupt("return");
2267
-
2268
- case 43:
2269
- _context.next = 45;
2270
- return validateUsingItemValues();
2271
-
2272
- case 45:
2273
- res = _context.sent;
2274
-
2275
- if (res) {
2276
- _context.next = 48;
2277
- break;
2278
- }
2279
-
2280
- return _context.abrupt("return");
2281
-
2282
- case 48:
2283
- setSelectedItem();
2284
-
2285
- case 49:
2286
- case "end":
2287
- return _context.stop();
2288
- }
2289
- }
2290
- }, _callee);
2291
- }));
2292
- }
2293
-
2294
- function handleKeyBackspace() {
2295
- var _a, _b; // 删除已选择项
2296
-
2297
-
2298
- if (!usingItem.value && !keyword.value) {
2299
- emit('delete'); // eslint-disable-next-line @typescript-eslint/no-misused-promises
2300
-
2301
- (0,external_vue_.nextTick)(setMenuList);
2302
- return;
2303
- }
2304
-
2305
- if ((_a = usingItem.value) === null || _a === void 0 ? void 0 : _a.values.length) {
2306
- // 删除选项
2307
- if (((_b = usingItem.value) === null || _b === void 0 ? void 0 : _b.multiple) || usingItem.value.isInValueList(usingItem.value.values[0])) {
2308
- usingItem.value.values.splice(-1, 1);
2309
- keyword.value = '';
2310
- setInputFocus();
2311
- return;
2312
- }
2313
- } else if (!keyword.value) {
2314
- usingItem.value = null;
2315
- keyword.value = '';
2316
- setMenuList();
2317
- }
2318
-
2319
- onValidate('');
2320
- }
2321
-
2322
- function handleSelectItem(item, type) {
2323
- var _a, _b, _c, _d;
2324
-
2325
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator_default().mark(function _callee2() {
2326
- var seleted, isCondition, res;
2327
- return regenerator_default().wrap(function _callee2$(_context2) {
2328
- while (1) {
2329
- switch (_context2.prev = _context2.next) {
2330
- case 0:
2331
- if (!((_a = item.value) === null || _a === void 0 ? void 0 : _a.id)) {
2332
- _context2.next = 8;
2333
- break;
2334
- }
2335
-
2336
- if (!(props.valueBehavior === ValueBehavior.NEEDKEY && item.value || !props.validateValues)) {
2337
- _context2.next = 8;
2338
- break;
2339
- }
2340
-
2341
- seleted = new SelectedItem(Object.assign(Object.assign({}, item), {
2342
- id: (_b = item.realId) !== null && _b !== void 0 ? _b : item.id
2343
- }), type, valueSplitCode.value);
2344
- seleted.addValue(item.value);
2345
- setSelectedItem(seleted);
2346
-
2347
- if (props.valueBehavior === ValueBehavior.NEEDKEY && menuHoverId.value) {
2348
- setInputFocus(true);
2349
- }
2350
-
2351
- menuHoverId.value = '';
2352
- return _context2.abrupt("return");
2353
-
2354
- case 8:
2355
- if (!(!usingItem.value || !((_c = inputRef === null || inputRef === void 0 ? void 0 : inputRef.value) === null || _c === void 0 ? void 0 : _c.innerText))) {
2356
- _context2.next = 16;
2357
- break;
2358
- }
2359
-
2360
- usingItem.value = new SelectedItem(item, type, valueSplitCode.value);
2361
- keyword.value = '';
2362
- isCondition = type === 'condition';
2363
- isCondition && setSelectedItem();
2364
- showPopover.value = isCondition || !!usingItem.value.children.length;
2365
- setInputFocus(props.valueBehavior === ValueBehavior.NEEDKEY && !!menuHoverId.value);
2366
- return _context2.abrupt("return");
2367
-
2368
- case 16:
2369
- if (!(((_d = usingItem.value) === null || _d === void 0 ? void 0 : _d.type) === 'condition')) {
2370
- _context2.next = 20;
2371
- break;
2372
- }
2373
-
2374
- usingItem.value = new SelectedItem(item, type, valueSplitCode.value);
2375
- setSelectedItem();
2376
- return _context2.abrupt("return");
2377
-
2378
- case 20:
2379
- usingItem.value.addValue(item);
2380
- _context2.next = 23;
2381
- return validateUsingItemValues(item);
2382
-
2383
- case 23:
2384
- res = _context2.sent;
2385
-
2386
- if (res) {
2387
- _context2.next = 26;
2388
- break;
2389
- }
2390
-
2391
- return _context2.abrupt("return");
2392
-
2393
- case 26:
2394
- if (!usingItem.value.multiple) setSelectedItem();
2395
-
2396
- if (props.valueBehavior === ValueBehavior.NEEDKEY && usingItem.value.multiple) {
2397
- setInputFocus();
2398
- }
2399
-
2400
- case 28:
2401
- case "end":
2402
- return _context2.stop();
2403
- }
2404
- }
2405
- }, _callee2);
2406
- }));
2407
- }
2408
-
2409
- function handleSelectCondtionItem(item) {
2410
- handleSelectItem(item, 'condition');
2411
- }
2412
-
2413
- function handleMenuFooterClick(item) {
2414
- switch (item.id) {
2415
- case 'confirm':
2416
- handleKeyEnter();
2417
- break;
2418
-
2419
- case 'cancel':
2420
- usingItem.value.values = [];
2421
- showPopover.value = false;
2422
- break;
2423
- }
2424
- } // functions
2425
-
2426
-
2427
- function validateUsingItemValues(value) {
2428
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator_default().mark(function _callee3() {
2429
- var _usingItem$value, searchItem, validate, values;
2430
-
2431
- return regenerator_default().wrap(function _callee3$(_context3) {
2432
- while (1) {
2433
- switch (_context3.prev = _context3.next) {
2434
- case 0:
2435
- if (usingItem.value) {
2436
- _context3.next = 4;
2437
- break;
2438
- }
2439
-
2440
- _context3.next = 3;
2441
- return validateValues(null, [value]);
2442
-
2443
- case 3:
2444
- return _context3.abrupt("return", _context3.sent);
2445
-
2446
- case 4:
2447
- _usingItem$value = usingItem.value, searchItem = _usingItem$value.searchItem, validate = _usingItem$value.validate, values = _usingItem$value.values;
2448
-
2449
- if (!(validate && typeof props.validateValues === 'function')) {
2450
- _context3.next = 9;
2451
- break;
2452
- }
2453
-
2454
- _context3.next = 8;
2455
- return validateValues(searchItem, value ? [value] : values);
2456
-
2457
- case 8:
2458
- return _context3.abrupt("return", _context3.sent);
2459
-
2460
- case 9:
2461
- onValidate('');
2462
- return _context3.abrupt("return", true);
2463
-
2464
- case 11:
2465
- case "end":
2466
- return _context3.stop();
2467
- }
2468
- }
2469
- }, _callee3);
2470
- }));
2471
- }
2472
-
2473
- function validateValues(searchItem, value) {
2474
- var _a;
2475
-
2476
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator_default().mark(function _callee4() {
2477
- var validateStr;
2478
- return regenerator_default().wrap(function _callee4$(_context4) {
2479
- while (1) {
2480
- switch (_context4.prev = _context4.next) {
2481
- case 0:
2482
- _context4.next = 2;
2483
- return (_a = props.validateValues) === null || _a === void 0 ? void 0 : _a.call(props, searchItem !== null && searchItem !== void 0 ? searchItem : null, value)["catch"](function () {
2484
- return false;
2485
- });
2486
-
2487
- case 2:
2488
- validateStr = _context4.sent;
2489
-
2490
- if (!(typeof validateStr === 'string' || validateStr === false)) {
2491
- _context4.next = 6;
2492
- break;
2493
- }
2494
-
2495
- onValidate(validateStr || '校验错误');
2496
- return _context4.abrupt("return", false);
2497
-
2498
- case 6:
2499
- onValidate('');
2500
- return _context4.abrupt("return", true);
2501
-
2502
- case 8:
2503
- case "end":
2504
- return _context4.stop();
2505
- }
2506
- }
2507
- }, _callee4);
2508
- }));
2509
- }
2510
-
2511
- function setInputFocus() {
2512
- var refleshMenuList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2513
-
2514
- if (refleshMenuList) {
2515
- (0,external_vue_.nextTick)().then(function () {
2516
- setMenuList();
2517
- });
2518
- }
2519
-
2520
- isFocus.value = true;
2521
- showPopover.value = true;
2522
- showNoSelectValueError.value = false;
2523
- var timer = setTimeout(function () {
2524
- if (inputRef.value) {
2525
- inputRef.value.focus(); // 光标移至最后
2526
-
2527
- var selection = window.getSelection();
2528
-
2529
- if (selection.focusOffset === 0) {
2530
- selection.selectAllChildren(inputRef.value);
2531
- selection.collapseToEnd();
2532
- }
2533
- }
2534
-
2535
- window.clearTimeout(timer);
2536
- }, 0);
2537
- emit('focus', isFocus.value);
2538
- }
2539
-
2540
- function setMenuList() {
2541
- var _a, _b, _c, _d, _e;
2542
-
2543
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator_default().mark(function _callee5() {
2544
- var list, hoverItem;
2545
- return regenerator_default().wrap(function _callee5$(_context5) {
2546
- while (1) {
2547
- switch (_context5.prev = _context5.next) {
2548
- case 0:
2549
- list = [];
2550
-
2551
- if (!(typeof props.getMenuList === 'function' && (typeof ((_b = (_a = usingItem.value) === null || _a === void 0 ? void 0 : _a.searchItem) === null || _b === void 0 ? void 0 : _b.async) === 'undefined' || usingItem.value.searchItem.async === true))) {
2552
- _context5.next = 9;
2553
- break;
2554
- }
2555
-
2556
- loading.value = true;
2557
- _context5.next = 5;
2558
- return props.getMenuList((_c = usingItem.value) === null || _c === void 0 ? void 0 : _c.searchItem, keyword.value)["catch"](function () {
2559
- return [];
2560
- });
2561
-
2562
- case 5:
2563
- list = _context5.sent;
2564
- loading.value = false;
2565
- _context5.next = 10;
2566
- break;
2567
-
2568
- case 9:
2569
- if (!(usingItem === null || usingItem === void 0 ? void 0 : usingItem.value)) {
2570
- if (!((_d = keyword.value) === null || _d === void 0 ? void 0 : _d.length)) {
2571
- list = props.data.filter(function (item) {
2572
- return !item.isSelected;
2573
- }).slice();
2574
- } else props.data.filter(function (item) {
2575
- return !item.isSelected;
2576
- }).forEach(function (item) {
2577
- var _a, _b;
2578
-
2579
- var isMatched = item.name.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase());
2580
-
2581
- if (isMatched) {
2582
- list.push(item);
2583
- (_a = item.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
2584
- list.push(Object.assign(Object.assign({}, item), {
2585
- realId: item.id,
2586
- id: (0,external_shared_.random)(10),
2587
- value: child
2588
- }));
2589
- });
2590
- list.push(Object.assign(Object.assign({}, item), {
2591
- realId: item.id,
2592
- id: (0,external_shared_.random)(10),
2593
- value: {
2594
- id: keyword.value,
2595
- name: keyword.value
2596
- }
2597
- }));
2598
- } else {
2599
- (_b = item.children) === null || _b === void 0 ? void 0 : _b.forEach(function (child) {
2600
- if (child.name.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase())) {
2601
- list.push(Object.assign(Object.assign({}, item), {
2602
- realId: item.id,
2603
- id: (0,external_shared_.random)(10),
2604
- value: child
2605
- }));
2606
- }
2607
- });
2608
- list.push(Object.assign(Object.assign({}, item), {
2609
- value: {
2610
- id: keyword.value,
2611
- name: keyword.value
2612
- }
2613
- }));
2614
- }
2615
- });
2616
- } else if (usingItem.value.type === 'condition') {
2617
- list = props.conditions;
2618
- } else if (!((_e = usingItem.value.values) === null || _e === void 0 ? void 0 : _e.length) || usingItem.value.multiple || props.mode === SearchInputMode.EDIT) {
2619
- list = usingItem.value.children.filter(function (item) {
2620
- return item.name.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase());
2621
- });
2622
- }
2623
-
2624
- case 10:
2625
- menuList.value = list;
2626
-
2627
- if (props.valueBehavior === ValueBehavior.NEEDKEY) {
2628
- hoverItem = list.find(function (item) {
2629
- return !item.disabled;
2630
- });
2631
-
2632
- if (hoverItem && (!menuHoverId.value || menuHoverId.value && !list.some(function (item) {
2633
- return item.id === menuHoverId.value;
2634
- }))) {
2635
- menuHoverId.value = hoverItem.id;
2636
- }
2637
- }
2638
-
2639
- case 12:
2640
- case "end":
2641
- return _context5.stop();
2642
- }
2643
- }
2644
- }, _callee5);
2645
- }));
2646
- }
2647
-
2648
- function setSelectedItem(item) {
2649
- emit('add', item !== null && item !== void 0 ? item : usingItem.value);
2650
- usingItem.value = null;
2651
- keyword.value = '';
2652
- setInputFocus(props.valueBehavior === ValueBehavior.NEEDKEY);
2653
- }
2654
-
2655
- function clearInput() {
2656
- var text = inputRef.value.innerText;
2657
-
2658
- if (text[text.length - 1] === '\n' || text[0] === '\r') {
2659
- setInputText(text.slice(0, -1));
2660
- clearInput();
2661
- } else if (text[0] === '\n' || text[0] === '\r') {
2662
- setInputText(text.slice(1));
2663
- clearInput();
2664
- }
2665
- }
2666
-
2667
- function setInputText() {
2668
- var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
2669
-
2670
- var _a;
2671
-
2672
- if (inputRef.value) {
2673
- inputRef.value.innerHTML = text || ((_a = usingItem.value) === null || _a === void 0 ? void 0 : _a.inputInnerHtml) || '';
2674
- }
2675
- } // expose
2676
-
2677
-
2678
- expose({
2679
- handleInputFocus: handleInputFocus,
2680
- isFocus: isFocus
2681
- });
2682
- return {
2683
- popoverRef: popoverRef,
2684
- inputRef: inputRef,
2685
- keyword: keyword,
2686
- loading: loading,
2687
- remoteMenuList: remoteMenuList,
2688
- menuList: menuList,
2689
- menuHoverId: menuHoverId,
2690
- isFocus: isFocus,
2691
- usingItem: usingItem,
2692
- showPopover: showPopover,
2693
- showNoSelectValueError: showNoSelectValueError,
2694
- debounceSetMenuList: debounceSetMenuList,
2695
- documentArrowEvent: documentArrowEvent,
2696
- handleClickOutside: handleClickOutside,
2697
- handleInputFocus: handleInputFocus,
2698
- handleInputChange: handleInputChange,
2699
- handleInputKeyup: handleInputKeyup,
2700
- handleSelectItem: handleSelectItem,
2701
- handleSelectCondtionItem: handleSelectCondtionItem,
2702
- handleMenuFooterClick: handleMenuFooterClick
2703
- };
2704
- },
2705
- render: function render() {
2706
- var _this = this;
2707
-
2708
- var _a, _b;
2709
-
2710
- var _ref2 = this.usingItem || {},
2711
- multiple = _ref2.multiple,
2712
- values = _ref2.values,
2713
- placeholder = _ref2.placeholder,
2714
- inputInnerHtml = _ref2.inputInnerHtml;
2715
-
2716
- var showInputAfter = !((_a = this.keyword) === null || _a === void 0 ? void 0 : _a.length) && !(values === null || values === void 0 ? void 0 : values.length) && placeholder;
2717
- var showPopover = this.loading || this.showNoSelectValueError || this.showPopover && !!((_b = this.menuList) === null || _b === void 0 ? void 0 : _b.length);
2718
- var showCondition = !this.usingItem && this.showCondition;
2719
- var menuSlots = Object.assign({}, this.$slots.menu ? {
2720
- "default": function _default(data) {
2721
- var _a, _b;
2722
-
2723
- return (_b = (_a = _this.$slots).menu) === null || _b === void 0 ? void 0 : _b.call(_a, data);
2724
- }
2725
- } : {});
2726
-
2727
- var inputContent = function inputContent() {
2728
- var _a;
2729
-
2730
- return (0,external_vue_.withDirectives)((0,external_vue_.createVNode)("div", {
2731
- "ref": "inputRef",
2732
- "class": {
2733
- 'div-input': true,
2734
- 'input-before': _this.showInputBefore && !((_a = _this.keyword) === null || _a === void 0 ? void 0 : _a.length),
2735
- 'input-after': showInputAfter
2736
- },
2737
- "contenteditable": true,
2738
- "data-placeholder": !inputInnerHtml && !_this.keyword ? '请选择' : '',
2739
- "data-tips": placeholder || '',
2740
- "spellcheck": "false",
2741
- "onFocus": _this.handleInputFocus,
2742
- "onInput": _this.handleInputChange,
2743
- "onKeydown": _this.handleInputKeyup
2744
- }, null), [[(0,external_vue_.resolveDirective)("clickoutside"), _this.handleClickOutside]]);
2745
- };
2746
-
2747
- var popoverContent = function popoverContent() {
2748
- var _a;
2749
-
2750
- if (_this.loading) {
2751
- return (0,external_vue_.createVNode)("div", null, [(0,external_vue_.createTextVNode)("\u52A0\u8F7D\u4E2D...")]);
2752
- }
2753
-
2754
- if (_this.showNoSelectValueError) {
2755
- return (0,external_vue_.createVNode)("div", null, [(0,external_vue_.createTextVNode)("\u5305\u542B\u952E\u503C\u7684\u8FC7\u6EE4\u67E5\u8BE2\u5FC5\u987B\u6709\u4E00\u4E2A\u503C")]);
2756
- }
2757
-
2758
- return ((_a = _this.menuList) === null || _a === void 0 ? void 0 : _a.length) ? (0,external_vue_.createVNode)("div", {
2759
- "ref": "popoverRef",
2760
- "class": "bk-search-select-popover"
2761
- }, [(0,external_vue_.createVNode)(menu, {
2762
- "list": _this.menuList,
2763
- "keyword": _this.keyword,
2764
- "multiple": !!multiple,
2765
- "hoverId": _this.menuHoverId,
2766
- "selected": (values === null || values === void 0 ? void 0 : values.map(function (item) {
2767
- return item.id;
2768
- })) || [],
2769
- "conditions": showCondition ? _this.conditions : [],
2770
- "onSelectItem": _this.handleSelectItem,
2771
- "onSelectCondition": _this.handleSelectCondtionItem,
2772
- "onFooterClick": _this.handleMenuFooterClick
2773
- }, Object.assign({}, menuSlots))]) : undefined;
2774
- };
2775
-
2776
- return (0,external_vue_.createVNode)((external_popover_default()), {
2777
- "trigger": 'manual',
2778
- "theme": 'light',
2779
- "placement": 'bottom-start',
2780
- "arrow": false,
2781
- "disableOutsideClick": true,
2782
- "isShow": showPopover
2783
- }, {
2784
- "default": inputContent,
2785
- content: popoverContent
2786
- });
2787
- }
2788
- }));
2789
- ;// CONCATENATED MODULE: ../../packages/search-select/src/selected.tsx
2790
-
2791
-
2792
- /*
2793
- * Tencent is pleased to support the open source community by making
2794
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2795
- *
2796
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2797
- *
2798
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2799
- *
2800
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2801
- *
2802
- * ---------------------------------------------------
2803
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2804
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2805
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2806
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2807
- *
2808
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2809
- * the Software.
2810
- *
2811
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2812
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2813
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2814
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2815
- * IN THE SOFTWARE.
2816
- */
2817
-
2818
-
2819
-
2820
-
2821
- ;
2822
- /* harmony default export */ const selected = ((0,external_vue_.defineComponent)({
2823
- name: 'SearchSelected',
2824
- props: {
2825
- data: {
2826
- type: Array,
2827
- required: true
2828
- },
2829
- selectedList: {
2830
- type: Array,
2831
- required: true
2832
- },
2833
- overflowIndex: {
2834
- type: Number,
2835
- "default": -1
2836
- },
2837
- conditions: {
2838
- type: Array,
2839
- "default": function _default() {
2840
- return [];
2841
- }
2842
- },
2843
- getMenuList: Function,
2844
- validateValues: Function,
2845
- valueBehavior: String
2846
- },
2847
- emits: ['delete'],
2848
- setup: function setup(_props, _ref) {
2849
- var emit = _ref.emit;
2850
- var inputRef = (0,external_vue_.ref)(null);
2851
-
2852
- var _useSearchSelectInjec = useSearchSelectInject(),
2853
- onEditClick = _useSearchSelectInjec.onEditClick,
2854
- onEditEnter = _useSearchSelectInjec.onEditEnter,
2855
- onEditBlur = _useSearchSelectInjec.onEditBlur,
2856
- editKey = _useSearchSelectInjec.editKey,
2857
- valueSplitCode = _useSearchSelectInjec.valueSplitCode;
2858
-
2859
- function handleDeleteSelected(index) {
2860
- emit('delete', index);
2861
- }
2862
-
2863
- function handleEditSeleted(e, item, index) {
2864
- e.preventDefault();
2865
- e.stopPropagation();
2866
- onEditClick(item, index); // magic code
2867
-
2868
- setTimeout(function () {
2869
- return inputRef.value.handleInputFocus();
2870
- }, 200);
2871
- }
2872
-
2873
- ;
2874
-
2875
- function handleAddSelected(item, index) {
2876
- onEditEnter(item, index);
2877
- }
2878
-
2879
- function handleInputFocus(isFocus) {
2880
- if (isFocus) return;
2881
- onEditBlur();
2882
- }
2883
-
2884
- function handleInputOutside() {
2885
- return true;
2886
- }
2887
-
2888
- function copySeletedItem(item) {
2889
- var newItem = new SelectedItem(item.searchItem, item.type, valueSplitCode.value);
2890
- newItem.values = item.values.slice();
2891
- return newItem;
2892
- }
2893
-
2894
- return {
2895
- inputRef: inputRef,
2896
- editKey: editKey,
2897
- copySeletedItem: copySeletedItem,
2898
- handleDeleteSelected: handleDeleteSelected,
2899
- handleEditSeleted: handleEditSeleted,
2900
- handleInputOutside: handleInputOutside,
2901
- handleAddSelected: handleAddSelected,
2902
- handleInputFocus: handleInputFocus
2903
- };
2904
- },
2905
- render: function render() {
2906
- var _this = this;
2907
-
2908
- var contentComponent = function contentComponent(item, index) {
2909
- return _this.editKey === "".concat(item.id, "_").concat(index) ? (0,external_vue_.createVNode)("div", {
2910
- "class": "selected-input",
2911
- "key": _this.editKey.toString()
2912
- }, [(0,external_vue_.createVNode)(input, {
2913
- "ref": "inputRef",
2914
- "key": _this.editKey.toString(),
2915
- "mode": SearchInputMode.EDIT,
2916
- "data": _this.data,
2917
- "showCondition": false,
2918
- "conditions": _this.conditions,
2919
- "defautUsingItem": _this.copySeletedItem(item),
2920
- "clickOutside": _this.handleInputOutside,
2921
- "getMenuList": _this.getMenuList,
2922
- "validateValues": _this.validateValues,
2923
- "valueBehavior": _this.valueBehavior,
2924
- "onAdd": function onAdd(v) {
2925
- return _this.handleAddSelected(v, index);
2926
- },
2927
- "onFocus": _this.handleInputFocus
2928
- }, null)]) : (0,external_vue_.createVNode)("li", {
2929
- "class": "search-container-selected ".concat(!(_this.overflowIndex >= 0 ? index < _this.overflowIndex : index >= 0) ? 'hidden-selected' : ''),
2930
- "key": "".concat(item.id, "_").concat(index)
2931
- }, [(0,external_vue_.createVNode)("span", {
2932
- "class": "selected-name",
2933
- "onClick": function onClick(e) {
2934
- return _this.handleEditSeleted(e, item, index);
2935
- }
2936
- }, [item.inputInnerText]), (0,external_vue_.createVNode)(external_icon_.Error, {
2937
- "class": "selected-clear",
2938
- "onClick": function onClick() {
2939
- return _this.handleDeleteSelected(index);
2940
- }
2941
- }, null)]);
2942
- };
2943
-
2944
- return (0,external_vue_.createVNode)(external_vue_.Fragment, null, [this.selectedList.map(function (item, index) {
2945
- return [_this.overflowIndex >= 0 && index === _this.overflowIndex && (0,external_vue_.createVNode)("div", {
2946
- "class": "search-container-selected overflow-selected"
2947
- }, [(0,external_vue_.createTextVNode)("+"), _this.selectedList.length - _this.overflowIndex]), contentComponent(item, index)];
2948
- })]);
2949
- }
2950
- }));
2951
- ;// CONCATENATED MODULE: ../../packages/search-select/src/search-select.tsx
2952
-
2953
-
2954
- /*
2955
- * Tencent is pleased to support the open source community by making
2956
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2957
- *
2958
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2959
- *
2960
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2961
- *
2962
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2963
- *
2964
- * ---------------------------------------------------
2965
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2966
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2967
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2968
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2969
- *
2970
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2971
- * the Software.
2972
- *
2973
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2974
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2975
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2976
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2977
- * IN THE SOFTWARE.
2978
- */
2979
-
2980
-
2981
-
2982
-
2983
-
2984
-
2985
-
2986
-
2987
- var INPUT_PADDING_WIDTH = 40;
2988
- var SELETED_MARGING_RIGHT = 6;
2989
- var SearchSelectProps = {
2990
- data: {
2991
- type: Array,
2992
- "default": function _default() {
2993
- return [];
2994
- }
2995
- },
2996
- modelValue: {
2997
- type: Array,
2998
- "default": function _default() {
2999
- return [];
3000
- }
3001
- },
3002
- shrink: {
3003
- type: Boolean,
3004
- "default": true
3005
- },
3006
- maxHeight: {
3007
- type: Number,
3008
- "default": 120
3009
- },
3010
- minHeight: {
3011
- type: Number,
3012
- "default": 26
3013
- },
3014
- conditions: {
3015
- type: Array,
3016
- "default": function _default() {
3017
- return [{
3018
- id: 'or',
3019
- name: '或'
3020
- }, {
3021
- id: 'and',
3022
- name: '且'
3023
- }];
3024
- }
3025
- },
3026
- clearable: {
3027
- type: Boolean,
3028
- "default": true
3029
- },
3030
- getMenuList: Function,
3031
- validateValues: Function,
3032
- valueSplitCode: {
3033
- type: String,
3034
- "default": '|'
3035
- },
3036
- uniqueSelect: {
3037
- type: Boolean,
3038
- "default": false
3039
- },
3040
- valueBehavior: {
3041
- type: String,
3042
- "default": ValueBehavior.ALL,
3043
- validator: function validator(v) {
3044
- return [ValueBehavior.ALL, ValueBehavior.NEEDKEY].includes(v);
3045
- }
3046
- }
3047
- };
3048
- /* harmony default export */ const search_select = ((0,external_vue_.defineComponent)({
3049
- name: 'SearchSelect',
3050
- directives: {
3051
- clickoutside: external_directives_.clickoutside
3052
- },
3053
- props: SearchSelectProps,
3054
- emits: ['update:modelValue'],
3055
- setup: function setup(props, _ref) {
3056
- var emit = _ref.emit;
3057
- // refs
3058
- var inputRef = (0,external_vue_.ref)(null);
3059
- var wrapRef = (0,external_vue_.ref)(null); // vars
3060
-
3061
- var isFocus = (0,external_vue_.ref)(false);
3062
- var selectedList = (0,external_vue_.ref)([]);
3063
- var overflowIndex = (0,external_vue_.ref)(-1);
3064
- var debounceResize = (0,external_shared_.debounce)(32, handleResize);
3065
- var editKey = (0,external_vue_.ref)('');
3066
- var validateStr = (0,external_vue_.ref)('');
3067
- var splitCode = (0,external_vue_.computed)(function () {
3068
- return props.valueSplitCode;
3069
- });
3070
- var copyData = (0,external_vue_.shallowRef)([]);
3071
- (0,external_vue_.watch)(function () {
3072
- return props.data;
3073
- }, function () {
3074
- var _a;
3075
-
3076
- copyData.value = JSON.parse(JSON.stringify(props.data));
3077
- (_a = copyData.value) === null || _a === void 0 ? void 0 : _a.forEach(function (item) {
3078
- item.isSelected = props.uniqueSelect && !!props.modelValue.some(function (set) {
3079
- return set.id === item.id;
3080
- });
3081
- });
3082
- }, {
3083
- immediate: true
3084
- }); // effects
3085
-
3086
- (0,external_vue_.watch)(function () {
3087
- return props.modelValue;
3088
- }, function (v) {
3089
- var _a, _b;
3090
-
3091
- if (!(v === null || v === void 0 ? void 0 : v.length)) {
3092
- selectedList.value = [];
3093
- (_a = copyData.value) === null || _a === void 0 ? void 0 : _a.forEach(function (item) {
3094
- item.isSelected = false;
3095
- });
3096
- return;
3097
- }
3098
-
3099
- var list = [];
3100
- v.forEach(function (item) {
3101
- var _a;
3102
-
3103
- var seleted = selectedList.value.find(function (set) {
3104
- return set.id === item.id && set.name === item.name;
3105
- });
3106
-
3107
- if ((seleted === null || seleted === void 0 ? void 0 : seleted.toValueKey()) === JSON.stringify(item)) {
3108
- seleted.values = item.values || [];
3109
- list.push(seleted);
3110
- } else {
3111
- var searchItem = props.data.find(function (set) {
3112
- return set.id === item.id;
3113
- });
3114
- var searchType = 'default';
3115
-
3116
- if (!searchItem) {
3117
- searchItem = props.conditions.find(function (set) {
3118
- return set.id === item.id;
3119
- });
3120
- searchItem && (searchType = 'condition');
3121
- }
3122
-
3123
- if (!searchItem && !((_a = item.values) === null || _a === void 0 ? void 0 : _a.length)) {
3124
- searchType = 'text';
3125
- }
3126
-
3127
- var newSelected = new SelectedItem(searchItem || item, searchType, splitCode.value);
3128
- newSelected.values = item.values || [];
3129
- list.push(newSelected);
3130
- }
3131
- });
3132
- selectedList.value = list;
3133
- (_b = copyData.value) === null || _b === void 0 ? void 0 : _b.forEach(function (item) {
3134
- item.isSelected = props.uniqueSelect && !!list.some(function (set) {
3135
- return set.id === item.id;
3136
- });
3137
- });
3138
- }, {
3139
- immediate: true,
3140
- deep: true
3141
- }); // life hooks
3142
-
3143
- (0,external_vue_.onMounted)(function () {
3144
- addListener(wrapRef.value.querySelector('.bk-search-select-container'), debounceResize);
3145
- });
3146
- (0,external_vue_.onBeforeUnmount)(function () {
3147
- removeListener(wrapRef.value.querySelector('.bk-search-select-container'), debounceResize);
3148
- }); // edit item
3149
-
3150
- useSearchSelectProvider({
3151
- onEditClick: onEditClick,
3152
- onEditEnter: onEditEnter,
3153
- onEditBlur: onEditBlur,
3154
- onValidate: onValidate,
3155
- editKey: editKey,
3156
- valueSplitCode: splitCode
3157
- });
3158
-
3159
- function onEditClick(item, index) {
3160
- editKey.value = "".concat(item.id, "_").concat(index);
3161
- }
3162
-
3163
- function onEditEnter(item, index) {
3164
- var list = selectedList.value.slice();
3165
- list.splice(index, 1, item);
3166
- emit('update:modelValue', list.map(function (item) {
3167
- return item.toValue();
3168
- }));
3169
- editKey.value = '';
3170
- }
3171
-
3172
- function onEditBlur() {
3173
- editKey.value = '';
3174
- onValidate('');
3175
- }
3176
-
3177
- function onValidate(str) {
3178
- validateStr.value = str || '';
3179
- } // events
3180
-
3181
-
3182
- function handleResize() {
3183
- if (isFocus.value || selectedList.value.length < 1) {
3184
- overflowIndex.value = -1;
3185
- return;
3186
- }
3187
-
3188
- var inputEl = wrapRef.value.querySelector('.bk-search-select-container');
3189
- var maxWidth = wrapRef.value.querySelector('.search-container').clientWidth - SELETED_MARGING_RIGHT - 2;
3190
- var tagList = inputEl.querySelectorAll('.search-container-selected:not(.overflow-selected)');
3191
- var width = 0;
3192
- var index = 0;
3193
- var i = 0;
3194
-
3195
- while (index === 0 && width <= maxWidth - INPUT_PADDING_WIDTH && i <= tagList.length - 1) {
3196
- var el = tagList[i];
3197
-
3198
- if (el.clientHeight > props.minHeight) {
3199
- overflowIndex.value = i;
3200
- return;
3201
- }
3202
-
3203
- width += el ? el.clientWidth + SELETED_MARGING_RIGHT : 0;
3204
-
3205
- if (width >= maxWidth - INPUT_PADDING_WIDTH) {
3206
- index = i;
3207
- }
3208
-
3209
- ;
3210
- i += 1;
3211
- }
3212
-
3213
- if (index === tagList.length - 1 && width <= maxWidth) {
3214
- overflowIndex.value = -1;
3215
- return;
3216
- }
3217
-
3218
- overflowIndex.value = width >= maxWidth - INPUT_PADDING_WIDTH ? index : index - 1;
3219
- }
3220
-
3221
- function handleWrapClick() {
3222
- if (!editKey.value) {
3223
- inputRef.value.handleInputFocus();
3224
- }
3225
- }
3226
-
3227
- function handleClearAll() {
3228
- selectedList.value = [];
3229
- overflowIndex.value = -1;
3230
- emit('update:modelValue', []);
3231
- }
3232
-
3233
- function handleInputOutside(target) {
3234
- var _a;
3235
-
3236
- return !((_a = wrapRef.value) === null || _a === void 0 ? void 0 : _a.contains(target));
3237
- }
3238
-
3239
- function handleAddSelected(item) {
3240
- var list = selectedList.value.slice();
3241
- list.push(item);
3242
- onValidate('');
3243
- emit('update:modelValue', list.map(function (item) {
3244
- return item.toValue();
3245
- }));
3246
- }
3247
-
3248
- function handleDeleteSelected(index) {
3249
- var list = selectedList.value.slice();
3250
- list.splice(typeof index === 'number' ? index : selectedList.value.length - 1, 1);
3251
- onValidate('');
3252
- emit('update:modelValue', list.map(function (item) {
3253
- return item.toValue();
3254
- }));
3255
- }
3256
-
3257
- function handleInputFocus(v) {
3258
- v && (overflowIndex.value = -1);
3259
- isFocus.value = v;
3260
- }
3261
-
3262
- return {
3263
- inputRef: inputRef,
3264
- wrapRef: wrapRef,
3265
- isFocus: isFocus,
3266
- copyData: copyData,
3267
- selectedList: selectedList,
3268
- overflowIndex: overflowIndex,
3269
- validateStr: validateStr,
3270
- splitCode: splitCode,
3271
- onEditClick: onEditClick,
3272
- onEditEnter: onEditEnter,
3273
- handleWrapClick: handleWrapClick,
3274
- handleInputFocus: handleInputFocus,
3275
- handleResize: handleResize,
3276
- handleClearAll: handleClearAll,
3277
- handleInputOutside: handleInputOutside,
3278
- handleAddSelected: handleAddSelected,
3279
- handleDeleteSelected: handleDeleteSelected
3280
- };
3281
- },
3282
- render: function render() {
3283
- var _this = this;
3284
-
3285
- var _a, _b; // vars
3286
-
3287
-
3288
- var maxHeight = "".concat(!this.shrink || this.isFocus ? this.maxHeight : this.minHeight, "px");
3289
- var showCondition = !!this.selectedList.length && this.selectedList.slice(-1)[0].type !== 'condition';
3290
- var menuSlots = Object.assign({}, this.$slots.menu ? {
3291
- menu: function menu(data) {
3292
- var _a, _b;
3293
-
3294
- return (_b = (_a = _this.$slots).menu) === null || _b === void 0 ? void 0 : _b.call(_a, data);
3295
- }
3296
- } : {}); // render
3297
-
3298
- return (0,external_vue_.createVNode)("div", {
3299
- "class": "bk-search-select",
3300
- "ref": "wrapRef"
3301
- }, [(0,external_vue_.createVNode)("div", {
3302
- "class": {
3303
- 'bk-search-select-container': true,
3304
- 'is-focus': this.isFocus
3305
- },
3306
- "onClick": this.handleWrapClick
3307
- }, [(0,external_vue_.createVNode)("div", {
3308
- "class": "search-prefix"
3309
- }, [(_b = (_a = this.$slots).prepend) === null || _b === void 0 ? void 0 : _b.call(_a)]), (0,external_vue_.createVNode)("div", {
3310
- "class": "search-container",
3311
- "style": {
3312
- maxHeight: maxHeight
3313
- }
3314
- }, [(0,external_vue_.createVNode)(selected, {
3315
- "data": this.copyData,
3316
- "conditions": this.conditions,
3317
- "selectedList": this.selectedList,
3318
- "overflowIndex": this.overflowIndex,
3319
- "getMenuList": this.getMenuList,
3320
- "validateValues": this.validateValues,
3321
- "valueBehavior": this.valueBehavior,
3322
- "onDelete": this.handleDeleteSelected
3323
- }, Object.assign({}, menuSlots)), (0,external_vue_.createVNode)("div", {
3324
- "class": "search-container-input"
3325
- }, [(0,external_vue_.createVNode)(input, {
3326
- "ref": "inputRef",
3327
- "data": this.copyData,
3328
- "showInputBefore": !this.selectedList.length,
3329
- "showCondition": showCondition,
3330
- "conditions": this.conditions,
3331
- "clickOutside": this.handleInputOutside,
3332
- "getMenuList": this.getMenuList,
3333
- "validateValues": this.validateValues,
3334
- "valueBehavior": this.valueBehavior,
3335
- "onAdd": this.handleAddSelected,
3336
- "onDelete": this.handleDeleteSelected,
3337
- "onFocus": this.handleInputFocus
3338
- }, Object.assign({}, menuSlots))])]), (0,external_vue_.createVNode)("div", {
3339
- "class": "search-nextfix"
3340
- }, [this.clearable && !!this.selectedList.length && (0,external_vue_.createVNode)(external_icon_.Close, {
3341
- "class": "search-clear",
3342
- "onClick": this.handleClearAll
3343
- }, null), this.$slots.append ? this.$slots.append() : (0,external_vue_.createVNode)(external_icon_.Search, {
3344
- "class": "search-nextfix-icon ".concat(this.isFocus ? 'is-focus' : '')
3345
- }, null)])]), !!this.validateStr.length && (0,external_vue_.createVNode)("div", {
3346
- "class": "bk-search-select-tips"
3347
- }, [this.$slots.validate ? this.$slots.validate() : (0,external_vue_.createVNode)(external_vue_.Fragment, null, [(0,external_vue_.createVNode)(external_icon_.ExclamationCircleShape, {
3348
- "class": "select-tips"
3349
- }, null), this.validateStr || ''])])]);
3350
- }
3351
- }));
3352
- ;// CONCATENATED MODULE: ../../packages/search-select/src/index.ts
3353
- /*
3354
- * Tencent is pleased to support the open source community by making
3355
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
3356
- *
3357
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3358
- *
3359
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
3360
- *
3361
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
3362
- *
3363
- * ---------------------------------------------------
3364
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
3365
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
3366
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
3367
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3368
- *
3369
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
3370
- * the Software.
3371
- *
3372
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
3373
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3374
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
3375
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
3376
- * IN THE SOFTWARE.
3377
- */
3378
-
3379
-
3380
- var BkSearchSelect = (0,external_shared_.withInstall)(search_select);
3381
- /* harmony default export */ const src = (BkSearchSelect);
3382
-
3383
- })();
3384
-
3385
- /******/ return __webpack_exports__;
3386
- /******/ })()
3387
- ;
3388
- });
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("../directives"),require("../icon"),require("../popover"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../directives","../icon","../popover"],t);else{var n="object"==typeof exports?t(require("../shared"),require("vue"),require("../directives"),require("../icon"),require("../popover")):t(e["../shared"],e.vue,e["../directives"],e["../icon"],e["../popover"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,((e,t,n,r,i)=>(()=>{var a={7162:(e,t,n)=>{e.exports=n(5047)},5047:e=>{var t=function(e){"use strict";var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),o=new C(r||[]);return a._invoke=function(e,t,n){var r=d;return function(i,a){if(r===h)throw new Error("Generator is already running");if(r===f){if("throw"===i)throw a;return V()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var l=L(o,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var u=c(e,t,n);if("normal"===u.type){if(r=n.done?f:v,u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=f,n.method="throw",n.arg=u.arg)}}}(e,n,o),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var d="suspendedStart",v="suspendedYield",h="executing",f="completed",p={};function m(){}function g(){}function _(){}var y={};u(y,a,(function(){return this}));var w=Object.getPrototypeOf,b=w&&w(w(N([])));b&&b!==n&&r.call(b,a)&&(y=b);var x=_.prototype=m.prototype=Object.create(y);function k(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(i,a,o,l){var u=c(e[i],e,a);if("throw"!==u.type){var s=u.arg,d=s.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,o,l)}),(function(e){n("throw",e,o,l)})):t.resolve(d).then((function(e){s.value=e,o(s)}),(function(e){return n("throw",e,o,l)}))}l(u.arg)}var i;this._invoke=function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}}function L(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,L(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=c(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function N(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}return{next:V}}function V(){return{value:t,done:!0}}return g.prototype=_,u(x,"constructor",_),u(_,"constructor",g),g.displayName=u(_,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,u(e,l,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},k(E.prototype),u(E.prototype,o,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new E(s(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},k(x),u(x,l,"Generator"),u(x,a,(function(){return this})),u(x,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=N,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return l.type="throw",l.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],l=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(u&&s){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},4061:e=>{"use strict";e.exports=n},6870:e=>{"use strict";e.exports=r},5537:e=>{"use strict";e.exports=i},4212:t=>{"use strict";t.exports=e},748:e=>{"use strict";e.exports=t}},o={};function l(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return a[e](n,n.exports,l),n.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{"use strict";l.r(u),l.d(u,{BkSearchSelect:()=>j,default:()=>D});var e=l(4212),t=l(748),n=null,r=null;function i(e,t){void 0===t&&(t={});var n=document.createElement(e);return Object.keys(t).forEach((function(e){n[e]=t[e]})),n}function a(e,t,n){return(window.getComputedStyle(e,n||null)||{display:"none"})[t]}function o(e){if(!document.documentElement.contains(e))return{detached:!0,rendered:!1};for(var t=e;t!==document;){if("none"===a(t,"display"))return{detached:!1,rendered:!1};t=t.parentNode}return{detached:!1,rendered:!0}}var s=0,c=null;function d(e,t){if(e.__resize_mutation_handler__||(e.__resize_mutation_handler__=v.bind(e)),!e.__resize_listeners__)if(e.__resize_listeners__=[],window.ResizeObserver){var n=e.offsetWidth,r=e.offsetHeight,l=new ResizeObserver((function(){(e.__resize_observer_triggered__||(e.__resize_observer_triggered__=!0,e.offsetWidth!==n||e.offsetHeight!==r))&&f(e)})),u=o(e),d=u.detached,m=u.rendered;e.__resize_observer_triggered__=!1===d&&!1===m,e.__resize_observer__=l,l.observe(e)}else if(e.attachEvent&&e.addEventListener)e.__resize_legacy_resize_handler__=function(){f(e)},e.attachEvent("onresize",e.__resize_legacy_resize_handler__),document.addEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);else if(s||(c=function(e){var t=document.createElement("style");return t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),(document.querySelector("head")||document.body).appendChild(t),t}('.resize-triggers{visibility:hidden;opacity:0;pointer-events:none}.resize-contract-trigger,.resize-contract-trigger:before,.resize-expand-trigger,.resize-triggers{content:"";position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden}.resize-contract-trigger,.resize-expand-trigger{background:#eee;overflow:auto}.resize-contract-trigger:before{width:200%;height:200%}')),function(e){var t=a(e,"position");t&&"static"!==t||(e.style.position="relative"),e.__resize_old_position__=t,e.__resize_last__={};var n=i("div",{className:"resize-triggers"}),r=i("div",{className:"resize-expand-trigger"}),o=i("div"),l=i("div",{className:"resize-contract-trigger"});r.appendChild(o),n.appendChild(r),n.appendChild(l),e.appendChild(n),e.__resize_triggers__={triggers:n,expand:r,expandChild:o,contract:l},p(e),e.addEventListener("scroll",h,!0),e.__resize_last__={width:e.offsetWidth,height:e.offsetHeight}}(e),e.__resize_rendered__=o(e).rendered,window.MutationObserver){var g=new MutationObserver(e.__resize_mutation_handler__);g.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),e.__resize_mutation_observer__=g}e.__resize_listeners__.push(t),s++}function v(){var e=o(this),t=e.rendered,n=e.detached;t!==this.__resize_rendered__&&(!n&&this.__resize_triggers__&&(p(this),this.addEventListener("scroll",h,!0)),this.__resize_rendered__=t,f(this))}function h(){var e,t,i=this;p(this),this.__resize_raf__&&(e=this.__resize_raf__,r||(r=(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}).bind(window)),r(e)),this.__resize_raf__=(t=function(){var e,t,n,r,a,o,l=(n=(t=(e=i).__resize_last__).width,r=t.height,a=e.offsetWidth,o=e.offsetHeight,a!==n||o!==r?{width:a,height:o}:null);l&&(i.__resize_last__=l,f(i))},n||(n=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){return setTimeout(e,16)}).bind(window)),n(t))}function f(e){e&&e.__resize_listeners__&&e.__resize_listeners__.forEach((function(t){t.call(e,e)}))}function p(e){var t=e.__resize_triggers__,n=t.expand,r=t.expandChild,i=t.contract,a=i.scrollWidth,o=i.scrollHeight,l=n.offsetWidth,u=n.offsetHeight,s=n.scrollWidth,c=n.scrollHeight;i.scrollLeft=a,i.scrollTop=o,r.style.width=l+1+"px",r.style.height=u+1+"px",n.scrollLeft=s,n.scrollTop=c}var m=l(4061),g=l(6870),_=l(7162),y=l.n(_);function w(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function l(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,l)}u((r=r.apply(e,t||[])).next())}))}Object.create,Object.create;var b=l(5537),x=l.n(b);const k=(0,t.defineComponent)({name:"SearchSelectMenu",props:{list:{type:Array},hoverId:String,keyword:{type:String,default:""},multiple:{type:Boolean,default:!1},selected:{type:Array,default:function(){return[]}},conditions:{type:Array},footerBtns:{type:Array,default:function(){return[{id:"confirm",name:"确认"},{id:"cancel",name:"取消",disabled:!1}]}}},emits:["selectItem","selectCondition","footerClick"],setup:function(e,n){var r=n.emit;return{handleClick:function(e){r("selectItem",e)},handleClickCondition:function(e){r("selectCondition",e)},handleClickFooterBtn:function(e){r("footerClick",e)},filterList:(0,t.computed)((function(){var t,n;return(null===(t=e.list)||void 0===t?void 0:t.length)?(null===(n=e.keyword)||void 0===n?void 0:n.length)?e.list.filter((function(t){return t.name.toLocaleLowerCase().includes(e.keyword.toLocaleLowerCase())})):e.list:[]})),getSearchNode:function(n){var r;return(null===(r=n.value)||void 0===r?void 0:r.name)?[(0,t.createVNode)("span",{class:"menu-name"},[n.name,(0,t.createTextVNode)(":")]),n.value.name]:function(n){if(!n)return n;var r=e.keyword,i=r.length;if(!(null==r?void 0:r.trim().length)||!n.toLocaleLowerCase().includes(r.toLocaleLowerCase()))return n;var a=[],o=-1;return r=r.replace(/([.*/]{1})/gim,"\\$1"),n.replace(new RegExp("".concat(r),"igm"),(function(e,r){return 0===a.length&&0!==r?a.push(n.slice(0,r)):o>=0&&a.push(n.slice(o+e.length,r)),a.push((0,t.createVNode)("span",{class:"is-keyword"},[e])),o=r,e})),o>=0&&a.push(n.slice(o+i)),a.length?a:n}(n.name)}}},render:function(){var e,n,r,i=this;return(0,t.createVNode)("div",{class:"bk-search-select-menu"},[!!(null===(e=this.conditions)||void 0===e?void 0:e.length)&&(0,t.createVNode)("ul",{class:"menu-header"},[this.conditions.map((function(e){return(0,t.createVNode)("li",{key:e.id,class:"menu-header-item ".concat(e.disabled?"is-disabled":""),onClick:function(){return!e.disabled&&i.handleClickCondition(e)}},[e.name])}))]),(0,t.createVNode)("ul",{class:"menu-content"},[null===(n=this.list)||void 0===n?void 0:n.map((function(e){return(0,t.createVNode)("li",{class:"menu-item ".concat(e.disabled?"is-disabled":""," ").concat(i.hoverId!==e.id||e.disabled?"":"is-hover"),key:e.id,id:e.id,tabindex:"-1",onClick:function(){return!e.disabled&&i.handleClick(e)}},[i.$slots.default?i.$slots.default({item:e,list:i.list,multiple:!!i.multiple,hoverId:i.hoverId,getSearchNode:i.getSearchNode}):(0,t.createVNode)(t.Fragment,null,[i.getSearchNode(e),i.multiple&&i.selected.includes(e.id)&&(0,t.createVNode)(g.Done,{class:"is-selected"},null)])])}))]),this.multiple&&(null===(r=this.footerBtns)||void 0===r?void 0:r.length)&&(0,t.createVNode)("div",{class:"menu-footer"},[this.footerBtns.map((function(e){return(0,t.createVNode)("span",{class:"menu-footer-btn ".concat(e.disabled?"is-disabled":""),key:e.id,onClick:function(){return!e.disabled&&i.handleClickFooterBtn(e)}},[e.name])}))])])}});function E(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var S;!function(e){e.ALL="all",e.NEEDKEY="need-key"}(S||(S={}));var I,C=Symbol("SEARCH_SLECT_PROVIDER_KEY"),N=function(){return(0,t.inject)(C)};!function(e){e.DEFAULT="default",e.EDIT="edit"}(I||(I={}));var V=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"|";E(this,e),this.searchItem=t,this.type=n,this.splitCode=r,this.values=[],this.id=t.id,this.name=t.name}var t,n;return t=e,(n=[{key:"multiple",get:function(){return!!this.searchItem.multiple}},{key:"placeholder",get:function(){return this.searchItem.placeholder||""}},{key:"children",get:function(){return this.searchItem.children||[]}},{key:"validate",get:function(){return!this.searchItem.noValidate}},{key:"inputInnerHtml",get:function(){var e;return this.isSpecialType()?this.name:"".concat(this.keyInnerHtml).concat((null===(e=this.values)||void 0===e?void 0:e.map((function(e){return e.name})).join(this.splitCode))||"")}},{key:"inputInnerText",get:function(){var e;return this.isSpecialType()?this.name:"".concat(this.keyInnerText).concat((null===(e=this.values)||void 0===e?void 0:e.map((function(e){return e.name})).join(this.splitCode))||"")}},{key:"keyInnerHtml",get:function(){return this.isSpecialType()?this.name:this.name?"".concat(this.name,": "):""}},{key:"keyInnerText",get:function(){return this.isSpecialType()?this.name:this.name?"".concat(this.name,": "):""}},{key:"isSpecialType",value:function(){return["text","condition"].includes(this.type)}},{key:"addValue",value:function(e){if(this.multiple){var t=this.values.findIndex((function(t){return t.id===e.id}));return t>-1?void this.values.splice(t,1):void this.values.push(e)}this.values=[e]}},{key:"toValue",value:function(){var e,t={id:this.id,name:this.name};return(null===(e=this.values)||void 0===e?void 0:e.length)&&(t.values=this.values.map((function(e){return{id:e.id,name:e.name}}))),this.type&&"default"!==this.type&&(t.type=this.type),t}},{key:"toValueKey",value:function(){return JSON.stringify(this.toValue())}},{key:"isInValueList",value:function(e){return this.children.some((function(t){return t.id===(null==e?void 0:e.id)}))}}])&&L(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const z=(0,t.defineComponent)({name:"SearchSelectInput",directives:{clickoutside:m.clickoutside},props:{data:{type:Array,required:!0},showInputBefore:Boolean,showCondition:Boolean,clickOutside:Function,conditions:{type:Array,default:function(){return[]}},defautUsingItem:Object,mode:{type:String,default:I.DEFAULT},getMenuList:Function,validateValues:Function,valueBehavior:String},emits:["focus","add","delete"],setup:function(n,r){var i=r.emit,a=r.expose,o=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(""),s=(0,t.ref)(!1),c=(0,t.ref)(!1),d=(0,t.ref)(!1),v=(0,t.ref)(n.defautUsingItem),h=(0,t.ref)(""),f=(0,t.ref)(!1),p=(0,e.debounce)(300,A),m=!1,g=(0,t.ref)([]),_=(0,t.ref)([]),b=N(),x=b.editKey,k=b.onValidate,E=b.valueSplitCode;function L(e){switch(e.code){case"ArrowDown":case"ArrowUp":C(e);break;case"Enter":case"NumpadEnter":!function(e){if(m){e.preventDefault();var t=_.value.find((function(e){return e.id===h.value}));t&&T(t)}}(e)}}function C(e){var t;e.preventDefault(),null===(t=o.value)||void 0===t||t.blur();for(var n=_.value.length,r=n,i=_.value.findIndex((function(e){return e.id===h.value}));r>=0;){i=(i="ArrowDown"===e.code?i+1:i-1)>n-1?0:i<0?n-1:i;var a=_.value[i];if(a&&!a.disabled){r=-1;var l=document.getElementById(a.id);return null==l||l.focus(),void(h.value=a.id)}r-=1}}function z(e){D(),e&&A()}function O(e){var t;return w(this,void 0,void 0,y().mark((function r(){var a,o,l,c;return y().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return null==e||e.preventDefault(),r.next=3,new Promise((function(e){return setTimeout(e,0)}));case 3:if(v.value){r.next=16;break}if(u.value&&n.valueBehavior!==S.NEEDKEY){r.next=6;break}return r.abrupt("return");case 6:return a={id:u.value,name:u.value},r.next=9,F(a);case 9:if(r.sent){r.next=12;break}return r.abrupt("return");case 12:return i("add",new V(a,"text",E.value)),u.value="",A(),r.abrupt("return");case 16:if(null==(o=v.value.values)?void 0:o.length){r.next=43;break}if(!(null===(t=u.value)||void 0===t?void 0:t.length)){r.next=41;break}if(!u.value.includes(E.value)){r.next=29;break}return l=u.value.split(E.value),r.next=23,F({id:u.value,name:u.value});case 23:if(r.sent){r.next=26;break}return r.abrupt("return");case 26:l.forEach((function(e){return v.value.addValue({id:e,name:e})})),r.next=36;break;case 29:return c={id:u.value,name:u.value},r.next=32,F(c);case 32:if(r.sent){r.next=35;break}return r.abrupt("return");case 35:v.value.addValue(c);case 36:return i("add",v.value),u.value="",v.value=null,D(!0),r.abrupt("return");case 41:return s.value=!0,r.abrupt("return");case 43:return r.next=45,F();case 45:if(r.sent){r.next=48;break}return r.abrupt("return");case 48:B();case 49:case"end":return r.stop()}}),r)})))}function T(e,t){var r,i,a,l;return w(this,void 0,void 0,y().mark((function s(){var c,f;return y().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(!(null===(r=e.value)||void 0===r?void 0:r.id)){s.next=8;break}if((n.valueBehavior!==S.NEEDKEY||!e.value)&&n.validateValues){s.next=8;break}return(c=new V(Object.assign(Object.assign({},e),{id:null!==(i=e.realId)&&void 0!==i?i:e.id}),t,E.value)).addValue(e.value),B(c),n.valueBehavior===S.NEEDKEY&&h.value&&D(!0),h.value="",s.abrupt("return");case 8:if(v.value&&(null===(a=null==o?void 0:o.value)||void 0===a?void 0:a.innerText)){s.next=16;break}return v.value=new V(e,t,E.value),u.value="",(f="condition"===t)&&B(),d.value=f||!!v.value.children.length,D(n.valueBehavior===S.NEEDKEY&&!!h.value),s.abrupt("return");case 16:if("condition"!==(null===(l=v.value)||void 0===l?void 0:l.type)){s.next=20;break}return v.value=new V(e,t,E.value),B(),s.abrupt("return");case 20:return v.value.addValue(e),s.next=23,F(e);case 23:if(s.sent){s.next=26;break}return s.abrupt("return");case 26:v.value.multiple||B(),n.valueBehavior===S.NEEDKEY&&v.value.multiple&&D();case 28:case"end":return s.stop()}}),s)})))}function F(e){return w(this,void 0,void 0,y().mark((function t(){var r,i,a,o;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(v.value){t.next=4;break}return t.next=3,j(null,[e]);case 3:case 8:return t.abrupt("return",t.sent);case 4:if(r=v.value,i=r.searchItem,a=r.validate,o=r.values,!a||"function"!=typeof n.validateValues){t.next=9;break}return t.next=8,j(i,e?[e]:o);case 9:return k(""),t.abrupt("return",!0);case 11:case"end":return t.stop()}}),t)})))}function j(e,t){var r;return w(this,void 0,void 0,y().mark((function i(){var a;return y().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,null===(r=n.validateValues)||void 0===r?void 0:r.call(n,null!=e?e:null,t).catch((function(){return!1}));case 2:if("string"!=typeof(a=i.sent)&&!1!==a){i.next=6;break}return k(a||"校验错误"),i.abrupt("return",!1);case 6:return k(""),i.abrupt("return",!0);case 8:case"end":return i.stop()}}),i)})))}function D(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&(0,t.nextTick)().then((function(){A()})),c.value=!0,d.value=!0,s.value=!1;var n=setTimeout((function(){if(o.value){o.value.focus();var e=window.getSelection();0===e.focusOffset&&(e.selectAllChildren(o.value),e.collapseToEnd())}window.clearTimeout(n)}),0);i("focus",c.value)}function A(){var t,r,i,a,o;return w(this,void 0,void 0,y().mark((function l(){var s,c;return y().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(s=[],"function"!=typeof n.getMenuList||void 0!==(null===(r=null===(t=v.value)||void 0===t?void 0:t.searchItem)||void 0===r?void 0:r.async)&&!0!==v.value.searchItem.async){l.next=9;break}return f.value=!0,l.next=5,n.getMenuList(null===(i=v.value)||void 0===i?void 0:i.searchItem,u.value).catch((function(){return[]}));case 5:s=l.sent,f.value=!1,l.next=10;break;case 9:(null==v?void 0:v.value)?"condition"===v.value.type?s=n.conditions:(null===(o=v.value.values)||void 0===o?void 0:o.length)&&!v.value.multiple&&n.mode!==I.EDIT||(s=v.value.children.filter((function(e){return e.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())}))):(null===(a=u.value)||void 0===a?void 0:a.length)?n.data.filter((function(e){return!e.isSelected})).forEach((function(t){var n,r;t.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())?(s.push(t),null===(n=t.children)||void 0===n||n.forEach((function(n){s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:{id:u.value,name:u.value}}))):(null===(r=t.children)||void 0===r||r.forEach((function(n){n.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())&&s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),s.push(Object.assign(Object.assign({},t),{value:{id:u.value,name:u.value}})))})):s=n.data.filter((function(e){return!e.isSelected})).slice();case 10:_.value=s,n.valueBehavior===S.NEEDKEY&&(c=s.find((function(e){return!e.disabled})))&&(!h.value||h.value&&!s.some((function(e){return e.id===h.value})))&&(h.value=c.id);case 12:case"end":return l.stop()}}),l)})))}function B(e){i("add",null!=e?e:v.value),v.value=null,u.value="",D(n.valueBehavior===S.NEEDKEY)}function M(){var e=o.value.innerText;"\n"===e[e.length-1]||"\r"===e[0]?(q(e.slice(0,-1)),M()):"\n"!==e[0]&&"\r"!==e[0]||(q(e.slice(1)),M())}function q(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";o.value&&(o.value.innerHTML=t||(null===(e=v.value)||void 0===e?void 0:e.inputInnerHtml)||"")}return(0,t.watch)(x,(function(){n.mode===I.DEFAULT&&x.value&&(d.value=!1)})),(0,t.watchEffect)((function(){u.value||q()}),{flush:"pre"}),(0,t.watch)([_,d],(function(){var e;(null===(e=_.value)||void 0===e?void 0:e.some((function(e){return!e.disabled})))&&d.value?m||(n.valueBehavior===S.NEEDKEY?h.value=_.value.find((function(e){return!e.disabled})).id:h.value="",m=!0,document.addEventListener("keydown",L)):(document.removeEventListener("keydown",L),m=!1,n.valueBehavior!==S.NEEDKEY&&(h.value=""))})),a({handleInputFocus:z,isFocus:c}),{popoverRef:l,inputRef:o,keyword:u,loading:f,remoteMenuList:g,menuList:_,menuHoverId:h,isFocus:c,usingItem:v,showPopover:d,showNoSelectValueError:s,debounceSetMenuList:p,documentArrowEvent:C,handleClickOutside:function(e){var t,r;!(null===(t=l.value)||void 0===t?void 0:t.contains(e.target))&&(null===(r=n.clickOutside)||void 0===r?void 0:r.call(n,e.target,l.value))&&(d.value=!1,c.value=!1,i("focus",c.value))},handleInputFocus:z,handleInputChange:function(e){var t,n,r,i,a,l,s;M();var c=e.target.innerText;if(/(\r|\n)/gm.test(c)||/\s{2}/gm.test(c))e.preventDefault(),c=c.replace(/(\r|\n)/gm,E.value).replace(/\s{2}/gm,""),o.value.innerText=c,D(),u.value=c.replace((null===(t=v.value)||void 0===t?void 0:t.keyInnerText)||"","").trim(),p();else if(!u.value&&c.length<((null===(r=null===(n=v.value)||void 0===n?void 0:n.inputInnerText)||void 0===r?void 0:r.length)||1)){var d=c.replace(" "," ").replace((null===(i=v.value)||void 0===i?void 0:i.keyInnerText.replace(" "," ").trim())||"","").trim();!d&&(null==c?void 0:c.length)||(v.value=null),u.value=d?c:"",p()}else(null===(l=null===(a=v.value)||void 0===a?void 0:a.values)||void 0===l?void 0:l.length)||(u.value=c.replace(" "," ").replace((null===(s=v.value)||void 0===s?void 0:s.keyInnerText.replace(" "," "))||"","").trim(),D(),p())},handleInputKeyup:function(e){switch(e.code){case"Enter":case"NumpadEnter":if(n.valueBehavior===S.NEEDKEY&&_.value.some((function(e){return e.id===h.value})))return;O(e);break;case"Backspace":!function(){var e,n;if(!v.value&&!u.value)return i("delete"),void(0,t.nextTick)(A);if(null===(e=v.value)||void 0===e?void 0:e.values.length){if((null===(n=v.value)||void 0===n?void 0:n.multiple)||v.value.isInValueList(v.value.values[0]))return v.value.values.splice(-1,1),u.value="",void D()}else u.value||(v.value=null,u.value="",A());k("")}();default:s.value=!1}},handleSelectItem:T,handleSelectCondtionItem:function(e){T(e,"condition")},handleMenuFooterClick:function(e){switch(e.id){case"confirm":O();break;case"cancel":v.value.values=[],d.value=!1}}}},render:function(){var e,n,r=this,i=this.usingItem||{},a=i.multiple,o=i.values,l=i.placeholder,u=i.inputInnerHtml,s=!(null===(e=this.keyword)||void 0===e?void 0:e.length)&&!(null==o?void 0:o.length)&&l,c=this.loading||this.showNoSelectValueError||this.showPopover&&!!(null===(n=this.menuList)||void 0===n?void 0:n.length),d=!this.usingItem&&this.showCondition,v=Object.assign({},this.$slots.menu?{default:function(e){var t,n;return null===(n=(t=r.$slots).menu)||void 0===n?void 0:n.call(t,e)}}:{});return(0,t.createVNode)(x(),{trigger:"manual",theme:"light",placement:"bottom-start",arrow:!1,disableOutsideClick:!0,isShow:c},{default:function(){var e;return(0,t.withDirectives)((0,t.createVNode)("div",{ref:"inputRef",class:{"div-input":!0,"input-before":r.showInputBefore&&!(null===(e=r.keyword)||void 0===e?void 0:e.length),"input-after":s},contenteditable:!0,"data-placeholder":u||r.keyword?"":"请选择","data-tips":l||"",spellcheck:"false",onFocus:r.handleInputFocus,onInput:r.handleInputChange,onKeydown:r.handleInputKeyup},null),[[(0,t.resolveDirective)("clickoutside"),r.handleClickOutside]])},content:function(){var e;return r.loading?(0,t.createVNode)("div",null,[(0,t.createTextVNode)("加载中...")]):r.showNoSelectValueError?(0,t.createVNode)("div",null,[(0,t.createTextVNode)("包含键值的过滤查询必须有一个值")]):(null===(e=r.menuList)||void 0===e?void 0:e.length)?(0,t.createVNode)("div",{ref:"popoverRef",class:"bk-search-select-popover"},[(0,t.createVNode)(k,{list:r.menuList,keyword:r.keyword,multiple:!!a,hoverId:r.menuHoverId,selected:(null==o?void 0:o.map((function(e){return e.id})))||[],conditions:d?r.conditions:[],onSelectItem:r.handleSelectItem,onSelectCondition:r.handleSelectCondtionItem,onFooterClick:r.handleMenuFooterClick},Object.assign({},v))]):void 0}})}}),O=(0,t.defineComponent)({name:"SearchSelected",props:{data:{type:Array,required:!0},selectedList:{type:Array,required:!0},overflowIndex:{type:Number,default:-1},conditions:{type:Array,default:function(){return[]}},getMenuList:Function,validateValues:Function,valueBehavior:String},emits:["delete"],setup:function(e,n){var r=n.emit,i=(0,t.ref)(null),a=N(),o=a.onEditClick,l=a.onEditEnter,u=a.onEditBlur,s=a.editKey,c=a.valueSplitCode;return{inputRef:i,editKey:s,copySeletedItem:function(e){var t=new V(e.searchItem,e.type,c.value);return t.values=e.values.slice(),t},handleDeleteSelected:function(e){r("delete",e)},handleEditSeleted:function(e,t,n){e.preventDefault(),e.stopPropagation(),o(t,n),setTimeout((function(){return i.value.handleInputFocus()}),200)},handleInputOutside:function(){return!0},handleAddSelected:function(e,t){l(e,t)},handleInputFocus:function(e){e||u()}}},render:function(){var e=this,n=function(n,r){return e.editKey==="".concat(n.id,"_").concat(r)?(0,t.createVNode)("div",{class:"selected-input",key:e.editKey.toString()},[(0,t.createVNode)(z,{ref:"inputRef",key:e.editKey.toString(),mode:I.EDIT,data:e.data,showCondition:!1,conditions:e.conditions,defautUsingItem:e.copySeletedItem(n),clickOutside:e.handleInputOutside,getMenuList:e.getMenuList,validateValues:e.validateValues,valueBehavior:e.valueBehavior,onAdd:function(t){return e.handleAddSelected(t,r)},onFocus:e.handleInputFocus},null)]):(0,t.createVNode)("li",{class:"search-container-selected ".concat((e.overflowIndex>=0?r<e.overflowIndex:r>=0)?"":"hidden-selected"),key:"".concat(n.id,"_").concat(r)},[(0,t.createVNode)("span",{class:"selected-name",onClick:function(t){return e.handleEditSeleted(t,n,r)}},[n.inputInnerText]),(0,t.createVNode)(g.Error,{class:"selected-clear",onClick:function(){return e.handleDeleteSelected(r)}},null)])};return(0,t.createVNode)(t.Fragment,null,[this.selectedList.map((function(r,i){return[e.overflowIndex>=0&&i===e.overflowIndex&&(0,t.createVNode)("div",{class:"search-container-selected overflow-selected"},[(0,t.createTextVNode)("+"),e.selectedList.length-e.overflowIndex]),n(r,i)]}))])}});var T={data:{type:Array,default:function(){return[]}},modelValue:{type:Array,default:function(){return[]}},shrink:{type:Boolean,default:!0},maxHeight:{type:Number,default:120},minHeight:{type:Number,default:26},conditions:{type:Array,default:function(){return[{id:"or",name:"或"},{id:"and",name:"且"}]}},clearable:{type:Boolean,default:!0},getMenuList:Function,validateValues:Function,valueSplitCode:{type:String,default:"|"},uniqueSelect:{type:Boolean,default:!1},valueBehavior:{type:String,default:S.ALL,validator:function(e){return[S.ALL,S.NEEDKEY].includes(e)}}};const F=(0,t.defineComponent)({name:"SearchSelect",directives:{clickoutside:m.clickoutside},props:T,emits:["update:modelValue"],setup:function(n,r){var i,a=r.emit,o=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(!1),v=(0,t.ref)([]),f=(0,t.ref)(-1),p=(0,e.debounce)(32,k),m=(0,t.ref)(""),g=(0,t.ref)(""),_=(0,t.computed)((function(){return n.valueSplitCode})),y=(0,t.shallowRef)([]);function w(e,t){m.value="".concat(e.id,"_").concat(t)}function b(e,t){var n=v.value.slice();n.splice(t,1,e),a("update:modelValue",n.map((function(e){return e.toValue()}))),m.value=""}function x(e){g.value=e||""}function k(){if(u.value||v.value.length<1)f.value=-1;else{for(var e=l.value.querySelector(".bk-search-select-container"),t=l.value.querySelector(".search-container").clientWidth-6-2,r=e.querySelectorAll(".search-container-selected:not(.overflow-selected)"),i=0,a=0,o=0;0===a&&i<=t-40&&o<=r.length-1;){var s=r[o];if(s.clientHeight>n.minHeight)return void(f.value=o);(i+=s?s.clientWidth+6:0)>=t-40&&(a=o),o+=1}a===r.length-1&&i<=t?f.value=-1:f.value=i>=t-40?a:a-1}}return(0,t.watch)((function(){return n.data}),(function(){var e;y.value=JSON.parse(JSON.stringify(n.data)),null===(e=y.value)||void 0===e||e.forEach((function(e){e.isSelected=n.uniqueSelect&&!!n.modelValue.some((function(t){return t.id===e.id}))}))}),{immediate:!0}),(0,t.watch)((function(){return n.modelValue}),(function(e){var t,r;if(!(null==e?void 0:e.length))return v.value=[],void(null===(t=y.value)||void 0===t||t.forEach((function(e){e.isSelected=!1})));var i=[];e.forEach((function(e){var t,r=v.value.find((function(t){return t.id===e.id&&t.name===e.name}));if((null==r?void 0:r.toValueKey())===JSON.stringify(e))r.values=e.values||[],i.push(r);else{var a=n.data.find((function(t){return t.id===e.id})),o="default";a||(a=n.conditions.find((function(t){return t.id===e.id})))&&(o="condition"),a||(null===(t=e.values)||void 0===t?void 0:t.length)||(o="text");var l=new V(a||e,o,_.value);l.values=e.values||[],i.push(l)}})),v.value=i,null===(r=y.value)||void 0===r||r.forEach((function(e){e.isSelected=n.uniqueSelect&&!!i.some((function(t){return t.id===e.id}))}))}),{immediate:!0,deep:!0}),(0,t.onMounted)((function(){d(l.value.querySelector(".bk-search-select-container"),p)})),(0,t.onBeforeUnmount)((function(){!function(e,t){var n=e.__resize_listeners__;if(n){if(t&&n.splice(n.indexOf(t),1),!n.length||!t){if(e.detachEvent&&e.removeEventListener)return e.detachEvent("onresize",e.__resize_legacy_resize_handler__),void document.removeEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);e.__resize_observer__?(e.__resize_observer__.unobserve(e),e.__resize_observer__.disconnect(),e.__resize_observer__=null):(e.__resize_mutation_observer__&&(e.__resize_mutation_observer__.disconnect(),e.__resize_mutation_observer__=null),e.removeEventListener("scroll",h),e.removeChild(e.__resize_triggers__.triggers),e.__resize_triggers__=null),e.__resize_listeners__=null}!--s&&c&&c.parentNode.removeChild(c)}}(l.value.querySelector(".bk-search-select-container"),p)})),i={onEditClick:w,onEditEnter:b,onEditBlur:function(){m.value="",x("")},onValidate:x,editKey:m,valueSplitCode:_},(0,t.provide)(C,i),{inputRef:o,wrapRef:l,isFocus:u,copyData:y,selectedList:v,overflowIndex:f,validateStr:g,splitCode:_,onEditClick:w,onEditEnter:b,handleWrapClick:function(){m.value||o.value.handleInputFocus()},handleInputFocus:function(e){e&&(f.value=-1),u.value=e},handleResize:k,handleClearAll:function(){v.value=[],f.value=-1,a("update:modelValue",[])},handleInputOutside:function(e){var t;return!(null===(t=l.value)||void 0===t?void 0:t.contains(e))},handleAddSelected:function(e){var t=v.value.slice();t.push(e),x(""),a("update:modelValue",t.map((function(e){return e.toValue()})))},handleDeleteSelected:function(e){var t=v.value.slice();t.splice("number"==typeof e?e:v.value.length-1,1),x(""),a("update:modelValue",t.map((function(e){return e.toValue()})))}}},render:function(){var e,n,r=this,i="".concat(!this.shrink||this.isFocus?this.maxHeight:this.minHeight,"px"),a=!!this.selectedList.length&&"condition"!==this.selectedList.slice(-1)[0].type,o=Object.assign({},this.$slots.menu?{menu:function(e){var t,n;return null===(n=(t=r.$slots).menu)||void 0===n?void 0:n.call(t,e)}}:{});return(0,t.createVNode)("div",{class:"bk-search-select",ref:"wrapRef"},[(0,t.createVNode)("div",{class:{"bk-search-select-container":!0,"is-focus":this.isFocus},onClick:this.handleWrapClick},[(0,t.createVNode)("div",{class:"search-prefix"},[null===(n=(e=this.$slots).prepend)||void 0===n?void 0:n.call(e)]),(0,t.createVNode)("div",{class:"search-container",style:{maxHeight:i}},[(0,t.createVNode)(O,{data:this.copyData,conditions:this.conditions,selectedList:this.selectedList,overflowIndex:this.overflowIndex,getMenuList:this.getMenuList,validateValues:this.validateValues,valueBehavior:this.valueBehavior,onDelete:this.handleDeleteSelected},Object.assign({},o)),(0,t.createVNode)("div",{class:"search-container-input"},[(0,t.createVNode)(z,{ref:"inputRef",data:this.copyData,showInputBefore:!this.selectedList.length,showCondition:a,conditions:this.conditions,clickOutside:this.handleInputOutside,getMenuList:this.getMenuList,validateValues:this.validateValues,valueBehavior:this.valueBehavior,onAdd:this.handleAddSelected,onDelete:this.handleDeleteSelected,onFocus:this.handleInputFocus},Object.assign({},o))])]),(0,t.createVNode)("div",{class:"search-nextfix"},[this.clearable&&!!this.selectedList.length&&(0,t.createVNode)(g.Close,{class:"search-clear",onClick:this.handleClearAll},null),this.$slots.append?this.$slots.append():(0,t.createVNode)(g.Search,{class:"search-nextfix-icon ".concat(this.isFocus?"is-focus":"")},null)])]),!!this.validateStr.length&&(0,t.createVNode)("div",{class:"bk-search-select-tips"},[this.$slots.validate?this.$slots.validate():(0,t.createVNode)(t.Fragment,null,[(0,t.createVNode)(g.ExclamationCircleShape,{class:"select-tips"},null),this.validateStr||""])])])}});var j=(0,e.withInstall)(F);const D=j})(),u})()));