bkui-vue 0.0.1-beta.468 → 0.0.1-beta.469

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