@chaoswise/business 1.0.0 → 1.0.2

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.
@@ -102,10 +102,21 @@ var customVisitor = /*#__PURE__*/function (_visitor) {
102
102
  break;
103
103
  }
104
104
  } catch (error) {
105
- var _JSON$parse = JSON.parse(error.message),
106
- msg = _JSON$parse.msg,
107
- line = _JSON$parse.line,
108
- column = _JSON$parse.column;
105
+ var geterror = function geterror() {
106
+ try {
107
+ return JSON.parse(error.message);
108
+ } catch (error) {
109
+ return {
110
+ msg: error.message,
111
+ line: '',
112
+ column: ''
113
+ };
114
+ }
115
+ };
116
+ var _geterror = geterror(),
117
+ msg = _geterror.msg,
118
+ line = _geterror.line,
119
+ column = _geterror.column;
109
120
  callback && callback({
110
121
  type: 'error',
111
122
  msg: intl.get('3f52c2a1-892d-47fe-b296-49a35ff8c4ee').d('语法错误') + ':' + msg.replace('<EOF>', intl.get('30a2737a-c786-4f9f-bb22-02ca27a557ff').d('结束')).replace('Error:', '') + '',
@@ -1,9 +1,9 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  import _Dropdown from "@chaoswise/ui/lib/Dropdown";
3
3
  import _Button from "@chaoswise/ui/lib/Button";
4
- import _TooltipText from "@chaoswise/ui/lib/TooltipText";
5
4
  import _message from "@chaoswise/ui/lib/message";
6
5
  import _Spin from "@chaoswise/ui/lib/Spin";
6
+ import _TooltipText from "@chaoswise/ui/lib/TooltipText";
7
7
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
8
8
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
9
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -14,29 +14,32 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
14
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
15
15
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
16
16
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
17
- import React, { useEffect, useState, useMemo, useRef } from 'react';
18
- import { CopyToClipboard } from 'react-copy-to-clipboard';
19
- import ResizeObserver from 'resize-observer-polyfill';
20
- import keyIcon from './assets/key.svg';
21
- import valueIcon from './assets/value.svg';
22
- import timeCircleIcon from './assets/time-circle.svg';
23
- import copyIcon from './assets/copy.svg';
24
- import deleteIcon from './assets/delete.svg';
25
- import combinedIcon from './assets/combined.svg';
26
- import { useIntl } from '../../../locales';
27
- import { DEFAULT_MATCH_OPTION_LIST, DEFAULT_COMBINED_OPTION_LIST } from './config';
28
- import './index.less';
17
+ import React, { useEffect, useState, useMemo, useRef, useCallback } from "react";
18
+ import { CopyToClipboard } from "react-copy-to-clipboard";
19
+ import ResizeObserver from "resize-observer-polyfill";
20
+ import keyIcon from "./assets/key.svg";
21
+ import valueIcon from "./assets/value.svg";
22
+ import timeCircleIcon from "./assets/time-circle.svg";
23
+ import copyIcon from "./assets/copy.svg";
24
+ import deleteIcon from "./assets/delete.svg";
25
+ import combinedIcon from "./assets/combined.svg";
26
+ import { useIntl } from "../../../locales";
27
+ import { debounce } from "@chaoswise/utils";
28
+ import { DEFAULT_MATCH_OPTION_LIST, DEFAULT_COMBINED_OPTION_LIST } from "./config";
29
+ import "./index.less";
29
30
  function judgeNotEmpty(val) {
30
- return val !== null && typeof val !== 'undefined';
31
+ return val !== null && typeof val !== "undefined";
31
32
  }
32
33
 
33
34
  // 搜索高亮
34
- function highLight(text, keyword) {
35
+ function highLight() {
36
+ var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
37
+ var keyword = arguments.length > 1 ? arguments[1] : undefined;
35
38
  return text.split(keyword).flatMap(function (str, index) {
36
39
  return [/*#__PURE__*/React.createElement("span", {
37
40
  key: index,
38
41
  style: {
39
- color: '#FF4D4F'
42
+ color: "#FF4D4F"
40
43
  }
41
44
  }, keyword), str];
42
45
  }).slice(1);
@@ -146,9 +149,9 @@ var DropDown = function DropDown(props) {
146
149
  // 内置 ()
147
150
  onSelect: function onSelect() {}
148
151
  } : _props$combinedOption,
149
- containerWrapperRef = props.containerWrapperRef;
152
+ containerWrapperRef = props.containerWrapperRef,
153
+ debounceWait = props.debounceWait;
150
154
  var intl = useIntl();
151
-
152
155
  // 输入值
153
156
  var keyOptionValue = keyOption.value;
154
157
  var valueOptionValue = valueOption.value;
@@ -219,113 +222,115 @@ var DropDown = function DropDown(props) {
219
222
  };
220
223
  }, []);
221
224
  // key
225
+ var fetchKey = /*#__PURE__*/function () {
226
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(keyOptionValue) {
227
+ var res;
228
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
229
+ while (1) switch (_context5.prev = _context5.next) {
230
+ case 0:
231
+ setKeyLoading(true);
232
+ _context5.next = 3;
233
+ return keyOption === null || keyOption === void 0 ? void 0 : keyOption.fetchFuc(keyOptionValue);
234
+ case 3:
235
+ _context5.t0 = _context5.sent;
236
+ if (_context5.t0) {
237
+ _context5.next = 6;
238
+ break;
239
+ }
240
+ _context5.t0 = [];
241
+ case 6:
242
+ res = _context5.t0;
243
+ setKeyList(res);
244
+ setKeyLoading(false);
245
+ case 9:
246
+ case "end":
247
+ return _context5.stop();
248
+ }
249
+ }, _callee5);
250
+ }));
251
+ return function fetchKey(_x3) {
252
+ return _ref.apply(this, arguments);
253
+ };
254
+ }();
255
+ var fetchValue = /*#__PURE__*/function () {
256
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(valueOptionValue) {
257
+ var res;
258
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
259
+ while (1) switch (_context6.prev = _context6.next) {
260
+ case 0:
261
+ setValueLoading(true);
262
+ _context6.next = 3;
263
+ return valueOption === null || valueOption === void 0 ? void 0 : valueOption.fetchFuc(valueOptionValue);
264
+ case 3:
265
+ _context6.t0 = _context6.sent;
266
+ if (_context6.t0) {
267
+ _context6.next = 6;
268
+ break;
269
+ }
270
+ _context6.t0 = [];
271
+ case 6:
272
+ res = _context6.t0;
273
+ setValueList(res);
274
+ setValueLoading(false);
275
+ case 9:
276
+ case "end":
277
+ return _context6.stop();
278
+ }
279
+ }, _callee6);
280
+ }));
281
+ return function fetchValue(_x4) {
282
+ return _ref2.apply(this, arguments);
283
+ };
284
+ }();
285
+ var fetchHistory = /*#__PURE__*/function () {
286
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(historyOptionValue) {
287
+ var res;
288
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
289
+ while (1) switch (_context7.prev = _context7.next) {
290
+ case 0:
291
+ setHistoryLoading(true);
292
+ _context7.next = 3;
293
+ return historyOption === null || historyOption === void 0 ? void 0 : historyOption.fetchFuc(historyOptionValue);
294
+ case 3:
295
+ _context7.t0 = _context7.sent;
296
+ if (_context7.t0) {
297
+ _context7.next = 6;
298
+ break;
299
+ }
300
+ _context7.t0 = [];
301
+ case 6:
302
+ res = _context7.t0;
303
+ setHistoryList(res);
304
+ setHistoryLoading(false);
305
+ case 9:
306
+ case "end":
307
+ return _context7.stop();
308
+ }
309
+ }, _callee7);
310
+ }));
311
+ return function fetchHistory(_x5) {
312
+ return _ref3.apply(this, arguments);
313
+ };
314
+ }();
315
+ var fetchKeyDebounce = useCallback(debounce(fetchKey, debounceWait), []);
316
+ var fetchValueDebounce = useCallback(debounce(fetchValue, debounceWait), []);
317
+ var fetchHistoryDebounce = useCallback(debounce(fetchHistory, debounceWait), []);
222
318
  useEffect(function () {
223
- var fetchValue = /*#__PURE__*/function () {
224
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
225
- var res;
226
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
227
- while (1) switch (_context5.prev = _context5.next) {
228
- case 0:
229
- setKeyLoading(true);
230
- _context5.next = 3;
231
- return keyOption === null || keyOption === void 0 ? void 0 : keyOption.fetchFuc(keyOptionValue);
232
- case 3:
233
- _context5.t0 = _context5.sent;
234
- if (_context5.t0) {
235
- _context5.next = 6;
236
- break;
237
- }
238
- _context5.t0 = [];
239
- case 6:
240
- res = _context5.t0;
241
- setKeyList(res);
242
- setKeyLoading(false);
243
- case 9:
244
- case "end":
245
- return _context5.stop();
246
- }
247
- }, _callee5);
248
- }));
249
- return function fetchValue() {
250
- return _ref.apply(this, arguments);
251
- };
252
- }();
253
319
  if (visible && judgeNotEmpty(keyOptionValue)) {
254
- fetchValue();
320
+ fetchKeyDebounce(keyOptionValue);
255
321
  }
256
322
  }, [visible, keyOptionValue]);
257
-
258
323
  // value
259
324
  useEffect(function () {
260
- var fetchValue = /*#__PURE__*/function () {
261
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
262
- var res;
263
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
264
- while (1) switch (_context6.prev = _context6.next) {
265
- case 0:
266
- setValueLoading(true);
267
- _context6.next = 3;
268
- return valueOption === null || valueOption === void 0 ? void 0 : valueOption.fetchFuc(valueOptionValue);
269
- case 3:
270
- _context6.t0 = _context6.sent;
271
- if (_context6.t0) {
272
- _context6.next = 6;
273
- break;
274
- }
275
- _context6.t0 = [];
276
- case 6:
277
- res = _context6.t0;
278
- setValueList(res);
279
- setValueLoading(false);
280
- case 9:
281
- case "end":
282
- return _context6.stop();
283
- }
284
- }, _callee6);
285
- }));
286
- return function fetchValue() {
287
- return _ref2.apply(this, arguments);
288
- };
289
- }();
290
325
  if (visible && judgeNotEmpty(valueOptionValue)) {
291
- fetchValue();
326
+ fetchValueDebounce(valueOptionValue);
292
327
  }
293
328
  }, [visible, valueOptionValue]);
294
329
 
295
330
  // history
296
331
  useEffect(function () {
297
- var fetchValue = /*#__PURE__*/function () {
298
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
299
- var res;
300
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
301
- while (1) switch (_context7.prev = _context7.next) {
302
- case 0:
303
- setHistoryLoading(true);
304
- _context7.next = 3;
305
- return historyOption === null || historyOption === void 0 ? void 0 : historyOption.fetchFuc(historyOptionValue);
306
- case 3:
307
- _context7.t0 = _context7.sent;
308
- if (_context7.t0) {
309
- _context7.next = 6;
310
- break;
311
- }
312
- _context7.t0 = [];
313
- case 6:
314
- res = _context7.t0;
315
- setHistoryList(res);
316
- setHistoryLoading(false);
317
- case 9:
318
- case "end":
319
- return _context7.stop();
320
- }
321
- }, _callee7);
322
- }));
323
- return function fetchValue() {
324
- return _ref3.apply(this, arguments);
325
- };
326
- }();
327
332
  if (visible && judgeNotEmpty(historyOptionValue)) {
328
- fetchValue();
333
+ fetchHistoryDebounce(historyOptionValue);
329
334
  }
330
335
  }, [visible, historyOptionValue]);
331
336
 
@@ -356,7 +361,7 @@ var DropDown = function DropDown(props) {
356
361
  }, [historyList]);
357
362
 
358
363
  // 搜索历史列表删除
359
- function historyDelete(_x3, _x4) {
364
+ function historyDelete(_x6, _x7) {
360
365
  return _historyDelete.apply(this, arguments);
361
366
  }
362
367
  function _historyDelete() {
@@ -382,68 +387,82 @@ var DropDown = function DropDown(props) {
382
387
  }));
383
388
  return _historyDelete.apply(this, arguments);
384
389
  }
390
+ var onPreventTooltipEvent = function onPreventTooltipEvent(e) {
391
+ e.stopPropagation();
392
+ };
393
+ var TooltipTextDom = function TooltipTextDom(children) {
394
+ return /*#__PURE__*/React.createElement(_TooltipText, {
395
+ title: /*#__PURE__*/React.createElement("span", {
396
+ onClick: onPreventTooltipEvent
397
+ }, children)
398
+ }, children);
399
+ };
385
400
  var menu = /*#__PURE__*/React.createElement("div", {
386
401
  className: "aggregate-drop-down-wrap",
387
402
  onClick: function onClick(e) {
403
+ var _e$nativeEvent, _e$nativeEvent$stopIm;
388
404
  e.stopPropagation();
405
+ e === null || e === void 0 || (_e$nativeEvent = e.nativeEvent) === null || _e$nativeEvent === void 0 || (_e$nativeEvent$stopIm = _e$nativeEvent.stopImmediatePropagation) === null || _e$nativeEvent$stopIm === void 0 || _e$nativeEvent$stopIm.call(_e$nativeEvent);
389
406
  }
390
407
  }, /*#__PURE__*/React.createElement("div", {
391
408
  className: "aggregate-drop-down"
392
409
  }, keyOptionValueNotEmpty && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
393
410
  className: "list-title"
394
- }, intl.get('4412a02d-d11d-4231-bf91-fd65afd9ea77').d('标签搜索')), /*#__PURE__*/React.createElement(_Spin, {
411
+ }, intl.get("4412a02d-d11d-4231-bf91-fd65afd9ea77").d("标签搜索")), /*#__PURE__*/React.createElement(_Spin, {
395
412
  spinning: keyLoading,
396
- tip: intl.get('51b43939-ce6a-4a41-9038-832b8ab4a175').d('加载中...'),
413
+ tip: intl.get("51b43939-ce6a-4a41-9038-832b8ab4a175").d("加载中..."),
397
414
  size: "small"
398
415
  }, !dropDownKeyListEmpty ? keyList.map(function (record, index) {
399
416
  var value = record.value,
400
417
  des = record.des;
418
+ var highLightText = highLight(value, keyOptionValue);
401
419
  return /*#__PURE__*/React.createElement("div", {
402
420
  key: index,
403
421
  className: "list",
404
422
  onClick: function onClick() {
405
423
  keyOption === null || keyOption === void 0 || keyOption.onSelect(value, record);
406
424
  }
407
- }, /*#__PURE__*/React.createElement("span", {
408
- className: "list-title-target-wrapper"
409
425
  }, /*#__PURE__*/React.createElement("img", {
410
426
  className: "pre-icon",
411
427
  src: keyIcon,
412
428
  alt: ""
413
- }), highLight(value, keyOptionValue)), /*#__PURE__*/React.createElement("span", {
429
+ }), /*#__PURE__*/React.createElement("span", {
430
+ className: "list-title-value-wrapper"
431
+ }, TooltipTextDom(highLightText)), /*#__PURE__*/React.createElement("span", {
414
432
  className: "list-title-des-wrapper"
415
- }, des));
433
+ }, TooltipTextDom(des)));
416
434
  }) : /*#__PURE__*/React.createElement("div", {
417
435
  className: "empty"
418
- }, intl.get('1cd159c8-2a4d-4208-a170-55a34b91f671').d('暂无数据,提交搜索后搜索关键字')))), valueOptionValueNotEmpty && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
436
+ }, intl.get("1cd159c8-2a4d-4208-a170-55a34b91f671").d("暂无数据,提交搜索后搜索关键字")))), valueOptionValueNotEmpty && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
419
437
  className: "list-title"
420
438
  }, "Value"), /*#__PURE__*/React.createElement(_Spin, {
421
439
  spinning: valueLoading,
422
- tip: intl.get('51b43939-ce6a-4a41-9038-832b8ab4a175').d('加载中...'),
440
+ tip: intl.get("51b43939-ce6a-4a41-9038-832b8ab4a175").d("加载中..."),
423
441
  size: "small"
424
442
  }, !dropDownValueListEmpty ? valueList.map(function (record, index) {
425
443
  var value = record.value,
426
444
  des = record.des;
445
+ var highLightText = highLight(value, valueOptionValue === null || valueOptionValue === void 0 ? void 0 : valueOptionValue.value);
427
446
  return /*#__PURE__*/React.createElement("div", {
428
447
  key: index,
429
448
  className: "list",
430
449
  onClick: function onClick() {
431
450
  valueOption === null || valueOption === void 0 || valueOption.onSelect(value, record);
432
451
  }
433
- }, /*#__PURE__*/React.createElement("span", {
434
- className: "list-title-target-wrapper"
435
452
  }, /*#__PURE__*/React.createElement("img", {
436
453
  className: "pre-icon",
437
454
  src: valueIcon,
438
455
  alt: ""
439
- }), highLight(value, valueOptionValue === null || valueOptionValue === void 0 ? void 0 : valueOptionValue.value)), /*#__PURE__*/React.createElement("span", {
456
+ }), /*#__PURE__*/React.createElement("span", {
457
+ className: "list-title-value-wrapper"
458
+ }, TooltipTextDom(highLightText)), /*#__PURE__*/React.createElement("span", {
440
459
  className: "list-title-des-wrapper"
441
- }, des));
460
+ }, TooltipTextDom(des)));
442
461
  }) : /*#__PURE__*/React.createElement("div", {
443
462
  className: "empty"
444
- }, intl.get('1cd159c8-2a4d-4208-a170-55a34b91f671').d('暂无数据,提交搜索后搜索关键字')))), matchOption.isShow && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
463
+ }, intl.get("1cd159c8-2a4d-4208-a170-55a34b91f671").d("暂无数据,提交搜索后搜索关键字")))), matchOption.isShow && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
445
464
  className: "list-title"
446
- }, intl.get('f2447d25-e81c-4656-9e4c-f66741dd8a52').d('匹配方式')), (matchOption.list || DEFAULT_MATCH_OPTION_LIST).map(function (record, index) {
465
+ }, intl.get("f2447d25-e81c-4656-9e4c-f66741dd8a52").d("匹配方式")), (matchOption.list || DEFAULT_MATCH_OPTION_LIST).map(function (record, index) {
447
466
  var value = record.value,
448
467
  des = record.des;
449
468
  return /*#__PURE__*/React.createElement("div", {
@@ -452,18 +471,18 @@ var DropDown = function DropDown(props) {
452
471
  onClick: function onClick() {
453
472
  matchOption === null || matchOption === void 0 || matchOption.onSelect(value, record);
454
473
  }
455
- }, /*#__PURE__*/React.createElement("span", {
456
- className: "list-title-target-wrapper"
457
474
  }, /*#__PURE__*/React.createElement("img", {
458
475
  className: "pre-icon",
459
476
  src: combinedIcon,
460
477
  alt: ""
461
- }), value), /*#__PURE__*/React.createElement("span", {
478
+ }), /*#__PURE__*/React.createElement("span", {
479
+ className: "list-title-value-wrapper"
480
+ }, TooltipTextDom(value)), /*#__PURE__*/React.createElement("span", {
462
481
  className: "list-title-des-wrapper"
463
- }, des));
482
+ }, TooltipTextDom(des)));
464
483
  })), combinedOption.isShow && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
465
484
  className: "list-title"
466
- }, intl.get('2e8bd2b4-57bf-4778-a254-3b577d0241c5').d('组合符号')), (combinedOption.list || DEFAULT_COMBINED_OPTION_LIST).map(function (record, index) {
485
+ }, intl.get("2e8bd2b4-57bf-4778-a254-3b577d0241c5").d("组合符号")), (combinedOption.list || DEFAULT_COMBINED_OPTION_LIST).map(function (record, index) {
467
486
  var value = record.value,
468
487
  des = record.des;
469
488
  return /*#__PURE__*/React.createElement("div", {
@@ -472,46 +491,47 @@ var DropDown = function DropDown(props) {
472
491
  onClick: function onClick() {
473
492
  combinedOption === null || combinedOption === void 0 || combinedOption.onSelect(value, record);
474
493
  }
475
- }, /*#__PURE__*/React.createElement("span", {
476
- className: "list-title-target-wrapper"
477
494
  }, /*#__PURE__*/React.createElement("img", {
478
495
  className: "pre-icon",
479
496
  src: combinedIcon,
480
497
  alt: ""
481
- }), value), /*#__PURE__*/React.createElement("span", {
498
+ }), /*#__PURE__*/React.createElement("span", {
499
+ className: "list-title-value-wrapper"
500
+ }, TooltipTextDom(value)), /*#__PURE__*/React.createElement("span", {
482
501
  className: "list-title-des-wrapper"
483
- }, des));
502
+ }, TooltipTextDom(des)));
484
503
  })), historyOptionValueNotEmpty && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
485
504
  className: "list-title"
486
- }, intl.get('354fbc6d-1abb-4510-81a9-9aa2efa6f482').d('搜索历史')), /*#__PURE__*/React.createElement(_Spin, {
505
+ }, intl.get("354fbc6d-1abb-4510-81a9-9aa2efa6f482").d("搜索历史")), /*#__PURE__*/React.createElement(_Spin, {
487
506
  spinning: historyLoading,
488
- tip: intl.get('51b43939-ce6a-4a41-9038-832b8ab4a175').d('加载中...'),
507
+ tip: intl.get("51b43939-ce6a-4a41-9038-832b8ab4a175").d("加载中..."),
489
508
  size: "small"
490
509
  }, !dropDownListHistoryEmpty ? historyList.map(function (record, index) {
491
510
  var id = record.id,
492
511
  value = record.value,
493
512
  des = record.des;
513
+ var highLightText = highLight(value, historyOptionValue);
494
514
  return /*#__PURE__*/React.createElement("div", {
495
515
  key: index,
496
516
  className: "list",
497
517
  onClick: function onClick() {
498
518
  historyOption === null || historyOption === void 0 || historyOption.onSelect(value, record);
499
519
  }
500
- }, /*#__PURE__*/React.createElement("span", {
501
- className: "list-title-target-wrapper"
502
520
  }, /*#__PURE__*/React.createElement("img", {
503
521
  className: "pre-icon",
504
522
  src: timeCircleIcon,
505
523
  alt: ""
506
- }), highLight(value, historyOptionValue)), /*#__PURE__*/React.createElement("span", {
524
+ }), /*#__PURE__*/React.createElement("span", {
525
+ className: "list-title-value-wrapper"
526
+ }, TooltipTextDom(highLightText)), /*#__PURE__*/React.createElement("span", {
507
527
  className: "list-title-des-wrapper des"
508
- }, des), /*#__PURE__*/React.createElement("span", {
528
+ }, TooltipTextDom(des)), /*#__PURE__*/React.createElement("span", {
509
529
  className: "action"
510
530
  }, /*#__PURE__*/React.createElement(CopyToClipboard, {
511
531
  text: value,
512
532
  onCopy: function onCopy(text) {
513
533
  historyOption === null || historyOption === void 0 || historyOption.onCopy(text);
514
- _message.success(intl.get('15444b85-9196-4bb6-97bd-eb5cd4186cb9').d('搜索条件已复制'));
534
+ _message.success(intl.get("15444b85-9196-4bb6-97bd-eb5cd4186cb9").d("搜索条件已复制"));
515
535
  }
516
536
  }, /*#__PURE__*/React.createElement("img", {
517
537
  onClick: function onClick(e) {
@@ -531,18 +551,18 @@ var DropDown = function DropDown(props) {
531
551
  })));
532
552
  }) : /*#__PURE__*/React.createElement("div", {
533
553
  className: "empty"
534
- }, intl.get('1cd159c8-2a4d-4208-a170-55a34b91f671').d('暂无数据,提交搜索后搜索关键字'))))), /*#__PURE__*/React.createElement("div", {
554
+ }, intl.get("1cd159c8-2a4d-4208-a170-55a34b91f671").d("暂无数据,提交搜索后搜索关键字"))))), /*#__PURE__*/React.createElement("div", {
535
555
  className: "desc"
536
- }, /*#__PURE__*/React.createElement(_TooltipText, null, /*#__PURE__*/React.createElement("span", null, intl.get('be953f09-653f-4715-a3b9-9e0faef199b3').d('全文检索:hello world')), /*#__PURE__*/React.createElement("span", {
556
+ }, /*#__PURE__*/React.createElement(_TooltipText, null, /*#__PURE__*/React.createElement("span", null, intl.get("be953f09-653f-4715-a3b9-9e0faef199b3").d("全文检索:hello world")), /*#__PURE__*/React.createElement("span", {
537
557
  className: "desc-margin-32"
538
- }, intl.get('ff777cfe-21b4-4eb0-bf80-ebd92081fdf5').d('完全匹配:"hello world"')), /*#__PURE__*/React.createElement("span", {
558
+ }, intl.get("ff777cfe-21b4-4eb0-bf80-ebd92081fdf5").d('完全匹配:"hello world"')), /*#__PURE__*/React.createElement("span", {
539
559
  className: "desc-margin-32"
540
- }, intl.get('229e8f35-ce6c-403a-b52e-05346dd8eb0b').d('通配符:*?')), /*#__PURE__*/React.createElement("span", {
560
+ }, intl.get("229e8f35-ce6c-403a-b52e-05346dd8eb0b").d("通配符:*?")), /*#__PURE__*/React.createElement("span", {
541
561
  className: "desc-margin-32"
542
- }, intl.get('e7413527-a5ee-4057-b765-3595cd26c09b').d('关联搜索:status:(error OR warning) AND NOT service:“service_a”'))), /*#__PURE__*/React.createElement(_Button, {
562
+ }, intl.get("e7413527-a5ee-4057-b765-3595cd26c09b").d("关联搜索:status:(error OR warning) AND NOT service:“service_a”"))), /*#__PURE__*/React.createElement(_Button, {
543
563
  type: "link",
544
564
  onClick: onHelpClick
545
- }, intl.get('3431b29b-5fb7-411f-8a1d-8d7676b03264').d('帮助文档'))));
565
+ }, intl.get("3431b29b-5fb7-411f-8a1d-8d7676b03264").d("帮助文档"))));
546
566
  return /*#__PURE__*/React.createElement(_Dropdown, {
547
567
  overlay: menu,
548
568
  visible: visible,
@@ -1,4 +1,3 @@
1
-
2
1
  .aggregate-drop-down-wrap {
3
2
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); // 浮层阴影
4
3
  background: #fff;
@@ -27,10 +26,6 @@
27
26
  left: 0;
28
27
  }
29
28
 
30
- // .ant-spin-dot-spin {
31
- // font-size: 18px;
32
- // }
33
-
34
29
  .@{ant-prefix}-spin-text {
35
30
  width: auto;
36
31
  margin-left: 4px;
@@ -44,17 +39,22 @@
44
39
  padding: 0 10px;
45
40
  color: @text-color-show;
46
41
  }
47
- .list-title-target-wrapper{
48
- display: flex;
49
- align-items: center;
50
- }
51
- .list-title-des-wrapper{
42
+
43
+ .list-title-des-wrapper {
52
44
  color: @text-color-secondary;
45
+ max-width: 100px;
46
+ margin-left: 12px;
53
47
  }
54
48
 
55
- .list-title:not(:first-child){
49
+ .list-title-value-wrapper {
50
+ flex: 1;
51
+ width: 0;
52
+ }
53
+
54
+ .list-title:not(:first-child) {
56
55
  margin-top: 8px;
57
56
  }
57
+
58
58
  .list {
59
59
  &:hover {
60
60
  cursor: pointer;
@@ -72,11 +72,12 @@
72
72
 
73
73
  line-height: 32px;
74
74
  display: flex;
75
- justify-content: space-between;
76
75
  padding: 0 10px;
77
76
  align-items: center;
77
+
78
78
  .action {
79
79
  display: none;
80
+
80
81
  .pre-icon {
81
82
  &:nth-child(2) {
82
83
  margin-right: 0;
@@ -86,8 +87,6 @@
86
87
 
87
88
  .pre-icon {
88
89
  margin-right: 8px;
89
- // height: 16px;
90
- // width: 16px;
91
90
  }
92
91
  }
93
92
 
@@ -107,11 +106,13 @@
107
106
  align-items: center;
108
107
  margin-top: 8px;
109
108
  color: @text-color-show;
110
- .desc-margin-32{
109
+
110
+ .desc-margin-32 {
111
111
  margin-left: 32px;
112
112
  }
113
- .ant-btn-link {
113
+
114
+ .@{ant-prefix}-btn-link {
114
115
  margin-left: 10px;
115
116
  }
116
117
  }
117
- }
118
+ }
@@ -1,17 +1,17 @@
1
1
  import _Tooltip from "@chaoswise/ui/lib/Tooltip";
2
- import React from 'react';
3
- import textIcon from './assets/text-icon.svg';
4
- import tagIcon from './assets/tag-icon.svg';
5
- import { useIntl } from '../../../locales';
6
- import './index.less';
2
+ import React from "react";
3
+ import textIcon from "./assets/text-icon.svg";
4
+ import tagIcon from "./assets/tag-icon.svg";
5
+ import { useIntl } from "../../../locales";
6
+ import "./index.less";
7
7
  var SwitchBtn = function SwitchBtn(_ref) {
8
8
  var mode = _ref.mode,
9
9
  onChange = _ref.onChange;
10
10
  var intl = useIntl();
11
- var icon = mode === 'text' ? textIcon : tagIcon;
12
- var title = mode === 'text' ? intl.get('5faa90fc-6455-499a-a0d5-c7ff9c9867df').d('切换为手写CQL语法模式') : intl.get('1e9cc6b2-f761-4aaa-a216-9f842c6f8fce').d('切换为筛选模式');
11
+ var icon = mode === "text" ? textIcon : tagIcon;
12
+ var title = mode === "text" ? intl.get("1e9cc6b2-f761-4aaa-a216-9f842c6f8fce").d("切换为筛选模式") : intl.get("5faa90fc-6455-499a-a0d5-c7ff9c9867df").d("切换为手写CQL语法模式");
13
13
  var onClick = function onClick() {
14
- onChange(mode === 'text' ? 'tag' : 'text');
14
+ onChange(mode === "text" ? "tag" : "text");
15
15
  };
16
16
  return /*#__PURE__*/React.createElement(_Tooltip, {
17
17
  title: title