@chaoswise/business 1.0.3 → 1.0.5

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 (30) hide show
  1. package/lib/AggregateSearch/CLSPL/CLQLLexer.js +16 -18
  2. package/lib/AggregateSearch/CLSPL/CLQLParser.js +171 -244
  3. package/lib/AggregateSearch/CLSPL/CLQLParserListener.js +14 -16
  4. package/lib/AggregateSearch/CLSPL/CLQLParserVisitor.js +14 -16
  5. package/lib/AggregateSearch/CLSPL/SPLStagy.js +14 -16
  6. package/lib/AggregateSearch/CLSPL/index.js +24 -28
  7. package/lib/AggregateSearch/components/CloseAllIcon/index.js +1 -1
  8. package/lib/AggregateSearch/components/DropDown/index.js +19 -20
  9. package/lib/AggregateSearch/hooks/useDropDown.js +41 -17
  10. package/lib/AggregateSearch/index.js +98 -27
  11. package/lib/AggregateSearch/index.less +29 -17
  12. package/lib/AggregateSearch/utils/index.js +12 -12
  13. package/lib/ContentEditableSearch/components/CloseAllIcon/index.js +1 -1
  14. package/lib/ContentEditableSearch/index.js +8 -8
  15. package/lib/ContentEditableSearch/utils/index.js +6 -6
  16. package/lib/PropertyControlViewer/components/DoAppIcon/CustomIcon/index.js +4 -4
  17. package/lib/PropertyControlViewer/components/DoAppIcon/index.js +3 -3
  18. package/lib/PropertyControlViewer/components/DoCiUnitBitmap.js +3 -3
  19. package/lib/PropertyControlViewer/components/DoCommon.js +1 -1
  20. package/lib/PropertyControlViewer/components/DoImage.js +10 -10
  21. package/lib/PropertyControlViewer/components/DoQuote/components/QuoteView.js +3 -3
  22. package/lib/PropertyControlViewer/components/DoSelect.js +8 -8
  23. package/lib/PropertyControlViewer/components/DoUser.js +1 -1
  24. package/lib/PropertyControlViewer/components/TagShowMoreList/index.js +9 -9
  25. package/lib/PropertyControlViewer/config/utils.js +2 -2
  26. package/lib/PropertyControlViewer/index.js +5 -5
  27. package/lib/Watermark/index.js +17 -16
  28. package/lib/locales/intl.js +10 -11
  29. package/lib/locales/withLocale.js +14 -16
  30. package/package.json +5 -5
@@ -1,19 +1,19 @@
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
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
8
  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."); }
9
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
11
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
13
13
  import React, { useRef, useEffect, useState } from "react";
14
14
  import { getCursorPosition, getCursorNodeAndIndex, setCursorPosition, isObjectEqual } from "../utils";
15
15
  var MATCH_LIST = [">=", "<=", ">", "<", ":"];
16
- var useDropDown = function useDropDown(container, handleValueChange, onChange) {
16
+ var useDropDown = function useDropDown(container, handleValueChange, onChange, onMatchOptionShow, onCombinedOptionShow) {
17
17
  // 记录上一次的tag光标所处的type和value
18
18
  var preTagInfo = useRef({});
19
19
 
@@ -50,6 +50,30 @@ var useDropDown = function useDropDown(container, handleValueChange, onChange) {
50
50
  _useState4 = _slicedToArray(_useState3, 2),
51
51
  dropStatus = _useState4[0],
52
52
  setDropStatus = _useState4[1];
53
+ useEffect(function () {
54
+ var matchShow = dropStatus.match.isShow;
55
+ if (matchShow) {
56
+ var _getCurrentKeyAndValu = getCurrentKeyAndValue(),
57
+ key = _getCurrentKeyAndValu.key,
58
+ value = _getCurrentKeyAndValu.value;
59
+ matchShow && onMatchOptionShow({
60
+ key: key,
61
+ value: value
62
+ });
63
+ }
64
+ }, [dropStatus.match.isShow]);
65
+ useEffect(function () {
66
+ var combinedShow = dropStatus.combined.isShow;
67
+ if (combinedShow) {
68
+ var _getCurrentKeyAndValu2 = getCurrentKeyAndValue(),
69
+ key = _getCurrentKeyAndValu2.key,
70
+ value = _getCurrentKeyAndValu2.value;
71
+ combinedShow && onCombinedOptionShow({
72
+ key: key,
73
+ value: value
74
+ });
75
+ }
76
+ }, [dropStatus.combined.isShow]);
53
77
  var isContainMatch = function isContainMatch(str) {
54
78
  var reg = new RegExp(/(>=|<=|>|<|:)/);
55
79
  if (reg.exec(str)) {
@@ -64,7 +88,7 @@ var useDropDown = function useDropDown(container, handleValueChange, onChange) {
64
88
  var _getCursorNodeAndInde = getCursorNodeAndIndex(container.current, currentPositionIndex.current),
65
89
  targetNode = _getCursorNodeAndInde.targetNode;
66
90
  var targetTag;
67
- var loop = function loop(node) {
91
+ var _loop = function loop(node) {
68
92
  if (!node) {
69
93
  return;
70
94
  }
@@ -74,7 +98,7 @@ var useDropDown = function useDropDown(container, handleValueChange, onChange) {
74
98
  targetTag = node.parentNode;
75
99
  return;
76
100
  } else {
77
- loop(node.parentNode);
101
+ _loop(node.parentNode);
78
102
  }
79
103
  } else {
80
104
  var _node$dataset;
@@ -82,11 +106,11 @@ var useDropDown = function useDropDown(container, handleValueChange, onChange) {
82
106
  targetTag = node;
83
107
  return;
84
108
  } else {
85
- loop(node.parentNode);
109
+ _loop(node.parentNode);
86
110
  }
87
111
  }
88
112
  };
89
- loop(targetNode);
113
+ _loop(targetNode);
90
114
  return targetTag;
91
115
  };
92
116
  var quickSelect = function quickSelect(value, type) {
@@ -160,9 +184,9 @@ var useDropDown = function useDropDown(container, handleValueChange, onChange) {
160
184
 
161
185
  // 控制下拉框状态
162
186
  setTimeout(function () {
163
- var _getCurrentKeyAndValu = getCurrentKeyAndValue(),
164
- key = _getCurrentKeyAndValu.key,
165
- value = _getCurrentKeyAndValu.value;
187
+ var _getCurrentKeyAndValu3 = getCurrentKeyAndValue(),
188
+ key = _getCurrentKeyAndValu3.key,
189
+ value = _getCurrentKeyAndValu3.value;
166
190
  if (type === "match") {
167
191
  setDropStatus(function (pre) {
168
192
  return _objectSpread(_objectSpread({}, pre), {}, {
@@ -285,9 +309,9 @@ var useDropDown = function useDropDown(container, handleValueChange, onChange) {
285
309
  offset: selection.anchorOffset
286
310
  };
287
311
  if (type) {
288
- var _getCurrentKeyAndValu2 = getCurrentKeyAndValue(),
289
- key = _getCurrentKeyAndValu2.key,
290
- value = _getCurrentKeyAndValu2.value;
312
+ var _getCurrentKeyAndValu4 = getCurrentKeyAndValue(),
313
+ key = _getCurrentKeyAndValu4.key,
314
+ value = _getCurrentKeyAndValu4.value;
291
315
  var tagInfo = {
292
316
  type: type,
293
317
  id: curTag.id,
@@ -1,13 +1,13 @@
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
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
3
3
  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."); }
4
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
5
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
6
6
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
- 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; }
9
- 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); } }
10
- 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); }); }; }
7
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
8
+ 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 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 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 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; }
9
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
10
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
11
11
  import React, { useEffect, useRef, useState, forwardRef, useImperativeHandle } from "react";
12
12
  import PropTypes from "prop-types";
13
13
  import { textInit, getCursorPosition, getCursorNodeAndIndex, setCursorPosition, genHtmlAndSyntaxCheckResByString, checkSyntax, cloneDomRemoveCloseBtn } from "./utils";
@@ -22,7 +22,7 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
22
22
  onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
23
23
  value = props.value,
24
24
  _props$fetchKeyList = props.fetchKeyList,
25
- fetchKeyList = _props$fetchKeyList === void 0 ? /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
25
+ fetchKeyList = _props$fetchKeyList === void 0 ? /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
26
26
  return _regeneratorRuntime().wrap(function _callee$(_context) {
27
27
  while (1) switch (_context.prev = _context.next) {
28
28
  case 0:
@@ -34,7 +34,7 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
34
34
  }, _callee);
35
35
  })) : _props$fetchKeyList,
36
36
  _props$fetchValueList = props.fetchValueList,
37
- fetchValueList = _props$fetchValueList === void 0 ? /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
37
+ fetchValueList = _props$fetchValueList === void 0 ? /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
38
38
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
39
39
  while (1) switch (_context2.prev = _context2.next) {
40
40
  case 0:
@@ -46,7 +46,7 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
46
46
  }, _callee2);
47
47
  })) : _props$fetchValueList,
48
48
  _props$fetchHistoryLi = props.fetchHistoryList,
49
- fetchHistoryList = _props$fetchHistoryLi === void 0 ? /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
49
+ fetchHistoryList = _props$fetchHistoryLi === void 0 ? /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
50
50
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
51
51
  while (1) switch (_context3.prev = _context3.next) {
52
52
  case 0:
@@ -58,7 +58,7 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
58
58
  }, _callee3);
59
59
  })) : _props$fetchHistoryLi,
60
60
  _props$onHistoryDelet = props.onHistoryDelete,
61
- onHistoryDelete = _props$onHistoryDelet === void 0 ? /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
61
+ onHistoryDelete = _props$onHistoryDelet === void 0 ? /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
62
62
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
63
63
  while (1) switch (_context4.prev = _context4.next) {
64
64
  case 0:
@@ -81,7 +81,15 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
81
81
  _props$style = props.style,
82
82
  style = _props$style === void 0 ? {} : _props$style,
83
83
  _props$debounceWait = props.debounceWait,
84
- debounceWait = _props$debounceWait === void 0 ? 300 : _props$debounceWait;
84
+ debounceWait = _props$debounceWait === void 0 ? 300 : _props$debounceWait,
85
+ _props$option = props.option,
86
+ _props$option2 = _props$option === void 0 ? {} : _props$option,
87
+ matchOptionList = _props$option2.matchOptionList,
88
+ combinedOptionList = _props$option2.combinedOptionList,
89
+ _props$option2$onMatc = _props$option2.onMatchOptionShow,
90
+ onMatchOptionShow = _props$option2$onMatc === void 0 ? function () {} : _props$option2$onMatc,
91
+ _props$option2$onComb = _props$option2.onCombinedOptionShow,
92
+ onCombinedOptionShow = _props$option2$onComb === void 0 ? function () {} : _props$option2$onComb;
85
93
 
86
94
  // 输入模式
87
95
  var _useState = useState(defaultMode),
@@ -103,6 +111,11 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
103
111
  _useState6 = _slicedToArray(_useState5, 2),
104
112
  contentEditable = _useState6[0],
105
113
  setContentEditable = _useState6[1];
114
+ var _useState7 = useState(null),
115
+ _useState8 = _slicedToArray(_useState7, 2),
116
+ errorDom = _useState8[0],
117
+ setErrorDom = _useState8[1];
118
+ var tooltipDomRef = useRef(null);
106
119
  // 是否正在输入中文
107
120
  var isComposing = useRef(false);
108
121
  useImperativeHandle(ref, function () {
@@ -113,8 +126,8 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
113
126
  };
114
127
  });
115
128
  var handleSyntaxCheck = /*#__PURE__*/function () {
116
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(inputStr) {
117
- var checkRes, column, msg, _getCursorNodeAndInde, errorNode, findParent, errorTag;
129
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(inputStr) {
130
+ var checkRes, column, msg, _getCursorNodeAndInde, errorNode, _findParent, errorTag;
118
131
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
119
132
  while (1) switch (_context5.prev = _context5.next) {
120
133
  case 0:
@@ -123,12 +136,12 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
123
136
  case 2:
124
137
  checkRes = _context5.sent;
125
138
  if (!checkRes) {
126
- _context5.next = 10;
139
+ _context5.next = 11;
127
140
  break;
128
141
  }
129
142
  column = checkRes.column, msg = checkRes.msg; // 找到目标节点,高亮提示错误
130
143
  _getCursorNodeAndInde = getCursorNodeAndIndex(container.current, column), errorNode = _getCursorNodeAndInde.targetNode;
131
- findParent = function findParent(node) {
144
+ _findParent = function findParent(node) {
132
145
  var _node$dataset;
133
146
  if (!node || node === container.current) {
134
147
  var nextSiblingIndex = column > 0 ? column - 1 : column + 1;
@@ -138,23 +151,25 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
138
151
  if (!newErrorNode && (nextSiblingIndex < 0 || nextSiblingIndex > inputStr.length)) {
139
152
  return null;
140
153
  }
141
- return findParent(newErrorNode);
154
+ return _findParent(newErrorNode);
142
155
  }
143
156
  var dataAttr = (_node$dataset = node.dataset) === null || _node$dataset === void 0 ? void 0 : _node$dataset["attr"];
144
157
  if (dataAttr && ["tag-box"].includes(dataAttr)) {
145
158
  return node;
146
159
  }
147
- return findParent(node.parentNode);
160
+ return _findParent(node.parentNode);
148
161
  };
149
- errorTag = findParent(errorNode);
162
+ errorTag = _findParent(errorNode);
150
163
  if (errorTag) {
151
164
  errorTag.classList.add("syntax-error");
152
165
  errorTag.setAttribute("data-error", msg);
153
166
  }
167
+ setErrorDom(errorTag);
154
168
  return _context5.abrupt("return", true);
155
- case 10:
156
- return _context5.abrupt("return", false);
157
169
  case 11:
170
+ setErrorDom(null);
171
+ return _context5.abrupt("return", false);
172
+ case 13:
158
173
  case "end":
159
174
  return _context5.stop();
160
175
  }
@@ -165,7 +180,7 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
165
180
  };
166
181
  }();
167
182
  var handleValueChange = /*#__PURE__*/function () {
168
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(inputStr, mode) {
183
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(inputStr, mode) {
169
184
  var checkRes, planeTextPosition, htmlString, _getCursorNodeAndInde3, targetNode, targetIndex;
170
185
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
171
186
  while (1) switch (_context6.prev = _context6.next) {
@@ -183,9 +198,11 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
183
198
  container.current.innerText = inputStr;
184
199
  }
185
200
  if (checkRes) {
201
+ setErrorDom(containerWrapperRef.current);
186
202
  containerWrapperRef.current.classList.add("syntax-error");
187
203
  containerWrapperRef.current.setAttribute("data-error", checkRes.msg);
188
204
  } else {
205
+ setErrorDom(null);
189
206
  containerWrapperRef.current.classList.remove("syntax-error");
190
207
  containerWrapperRef.current.removeAttribute("data-error");
191
208
  }
@@ -220,7 +237,7 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
220
237
  return _ref6.apply(this, arguments);
221
238
  };
222
239
  }();
223
- var _useDropDown = useDropDown(container, handleValueChange, onChange),
240
+ var _useDropDown = useDropDown(container, handleValueChange, onChange, onMatchOptionShow, onCombinedOptionShow),
224
241
  dropStatus = _useDropDown.dropStatus,
225
242
  visible = _useDropDown.visible,
226
243
  quickSelect = _useDropDown.quickSelect,
@@ -228,7 +245,7 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
228
245
  setVisible = _useDropDown.setVisible,
229
246
  currentPositionIndex = _useDropDown.currentPositionIndex;
230
247
  var onInput = /*#__PURE__*/function () {
231
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(e) {
248
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(e) {
232
249
  var cloneDomRemoveCloseBtnDom;
233
250
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
234
251
  while (1) switch (_context7.prev = _context7.next) {
@@ -290,6 +307,45 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
290
307
  document.removeEventListener("click", handleClick);
291
308
  };
292
309
  }, []);
310
+ var handleMouseEnter = function handleMouseEnter(event) {
311
+ var errorContent = event.target.dataset["error"];
312
+ var rect = event.target.getBoundingClientRect();
313
+ var className = event.target.className;
314
+ var isTagBox = className.includes("tag-box");
315
+ var top = isTagBox ? 26 : 22;
316
+ if (!tooltipDomRef.current) {
317
+ tooltipDomRef.current = document.createElement("div");
318
+ tooltipDomRef.current.classList.add("uniq-aggregateSearch-tooltip");
319
+ document.body.appendChild(tooltipDomRef.current);
320
+ }
321
+ tooltipDomRef.current.style.top = "".concat(rect.top - top, "px");
322
+ tooltipDomRef.current.style.left = "".concat(rect.left, "px");
323
+ tooltipDomRef.current.style.position = "absolute";
324
+ tooltipDomRef.current.innerHTML = errorContent;
325
+ tooltipDomRef.current.style.display = "block";
326
+ };
327
+ var handleMouseLeave = function handleMouseLeave() {
328
+ if (tooltipDomRef.current) {
329
+ tooltipDomRef.current.style.display = "none";
330
+ }
331
+ };
332
+ useEffect(function () {
333
+ if (errorDom) {
334
+ errorDom.addEventListener("mouseenter", handleMouseEnter);
335
+ errorDom.addEventListener("mouseleave", handleMouseLeave);
336
+ } else {
337
+ if (tooltipDomRef.current) {
338
+ document.body.removeChild(tooltipDomRef.current);
339
+ tooltipDomRef.current = null;
340
+ }
341
+ }
342
+ return function () {
343
+ if (errorDom) {
344
+ errorDom.removeEventListener("mouseenter", handleMouseEnter);
345
+ errorDom.removeEventListener("mouseleave", handleMouseLeave);
346
+ }
347
+ };
348
+ }, [errorDom]);
293
349
  var onFocus = function onFocus() {
294
350
  setVisible(true);
295
351
  };
@@ -302,6 +358,9 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
302
358
  // 移除错误提示
303
359
  containerWrapperRef.current.classList.remove("syntax-error");
304
360
  containerWrapperRef.current.removeAttribute("data-error");
361
+ if (tooltipDomRef.current) {
362
+ tooltipDomRef.current.style.display = "none";
363
+ }
305
364
  }
306
365
  handleValueChange(container.current.innerText, mode);
307
366
  };
@@ -346,13 +405,15 @@ var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
346
405
  isShow: dropStatus.match.isShow,
347
406
  onSelect: function onSelect(value) {
348
407
  quickSelect(value, "match");
349
- }
408
+ },
409
+ list: matchOptionList
350
410
  },
351
411
  combinedOption: {
352
412
  isShow: dropStatus.combined.isShow,
353
413
  onSelect: function onSelect(value) {
354
414
  quickSelect(value, "combined");
355
- }
415
+ },
416
+ list: combinedOptionList
356
417
  },
357
418
  containerWrapperRef: containerWrapperRef,
358
419
  debounceWait: debounceWait
@@ -444,6 +505,16 @@ AggregateSearch.propTypes = {
444
505
  /**
445
506
  * 防抖时间默认为300ms
446
507
  */
447
- debounceWait: PropTypes.number
508
+ debounceWait: PropTypes.number,
509
+ /**
510
+ * 配置项:目前有匹配方式和组合模式的配置
511
+ * {
512
+ * matchOptionList, // 匹配方式下拉列表,若不传使用默认的配置项
513
+ * combinedOptionList, // 组合模式下拉列表,若不传使用默认的配置项
514
+ * onMatchOptionShow = () => {}, // 匹配方式下拉列表显示回调
515
+ * onCombinedOptionShow = () => {}, // 组合模式下拉列表显示回调
516
+ * }
517
+ */
518
+ option: PropTypes.object
448
519
  };
449
520
  export default AggregateSearch;
@@ -12,7 +12,19 @@
12
12
  outline: 0;
13
13
  box-shadow: @input-outline-offset @outline-blur-size @outline-width fade(@color, 20%);
14
14
  }
15
-
15
+ // tooltip挂载到body上
16
+ .uniq-aggregateSearch-tooltip{
17
+ white-space: nowrap;
18
+ background: #FFF1F0;
19
+ border: @border-width-base @border-style-base @red-5;
20
+ border-radius: 0 0 2px 2px;
21
+ font-size: 12px;
22
+ color: @red-5;
23
+ padding: 0 10px;
24
+ min-width: 100px;
25
+ height: 20px;
26
+ line-height: 20px;
27
+ }
16
28
  .aggregate-search-wrapper {
17
29
  background: #FFFFFF;
18
30
  border-radius: 2px;
@@ -182,22 +194,22 @@
182
194
  &:hover {
183
195
 
184
196
  // 伪类展示属性值
185
- &:before {
186
- content: attr(data-error);
187
- position: absolute;
188
- white-space: nowrap;
189
- top: -28px;
190
- left: -1px;
191
- height: 20px;
192
- line-height: 20px;
193
- background: #FFF1F0;
194
- border: @border-width-base @border-style-base @red-5;
195
- border-radius: 0 0 2px 2px;
196
- font-size: 12px;
197
- color: @red-5;
198
- padding: 0 10px;
199
- min-width: 100px;
200
- }
197
+ // &:before {
198
+ // content: attr(data-error);
199
+ // position: absolute;
200
+ // white-space: nowrap;
201
+ // top: -28px;
202
+ // left: -1px;
203
+ // height: 20px;
204
+ // line-height: 20px;
205
+ // background: #FFF1F0;
206
+ // border: @border-width-base @border-style-base @red-5;
207
+ // border-radius: 0 0 2px 2px;
208
+ // font-size: 12px;
209
+ // color: @red-5;
210
+ // padding: 0 10px;
211
+ // min-width: 100px;
212
+ // }
201
213
  }
202
214
  &:hover {
203
215
  .tag-box-item-close {
@@ -1,12 +1,12 @@
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
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
3
3
  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."); }
4
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
5
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
6
6
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
8
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
10
10
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
11
  import makeTokenizeFn from "../CLSPL/makeTokenizeFn";
12
12
  import MyGrammarLexer from "../CLSPL/CLQLLexer.js";
@@ -294,7 +294,7 @@ export var getCursorPosition = function getCursorPosition(node) {
294
294
  // 计算纯文本模式下,当前光标所处的位置
295
295
  var positionIndex = 0;
296
296
  var isBreak = false;
297
- var loop = function loop(node) {
297
+ var _loop = function loop(node) {
298
298
  var nodes = node.childNodes;
299
299
  for (var index = 0; index < nodes.length; index++) {
300
300
  if (isBreak) {
@@ -310,11 +310,11 @@ export var getCursorPosition = function getCursorPosition(node) {
310
310
  positionIndex += element.data.length;
311
311
  }
312
312
  } else {
313
- loop(element);
313
+ _loop(element);
314
314
  }
315
315
  }
316
316
  };
317
- loop(node);
317
+ _loop(node);
318
318
  return positionIndex;
319
319
  };
320
320
 
@@ -324,7 +324,7 @@ export var getCursorNodeAndIndex = function getCursorNodeAndIndex(node, position
324
324
  var targetIndex;
325
325
  var sum = 0;
326
326
  var isBreak = false;
327
- var loop = function loop(node) {
327
+ var _loop2 = function loop(node) {
328
328
  var nodes = node.childNodes;
329
329
  for (var index = 0; index < nodes.length; index++) {
330
330
  if (isBreak) {
@@ -343,11 +343,11 @@ export var getCursorNodeAndIndex = function getCursorNodeAndIndex(node, position
343
343
  sum += elementLength;
344
344
  }
345
345
  } else {
346
- loop(element);
346
+ _loop2(element);
347
347
  }
348
348
  }
349
349
  };
350
- loop(node);
350
+ _loop2(node);
351
351
  return {
352
352
  targetNode: targetNode,
353
353
  targetIndex: targetIndex
@@ -1,4 +1,4 @@
1
- import _Icon from "@chaoswise/ui/lib/Antd/Icon";
1
+ import _Icon from "@chaoswise/ui/lib/Icon";
2
2
  import React from "react";
3
3
  import "./index.less";
4
4
  var CloseAllIcon = function CloseAllIcon(_ref) {