@chaoswise/business 1.0.2 → 1.0.4
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.
- package/lib/AggregateSearch/CLSPL/CLQLLexer.js +18 -20
- package/lib/AggregateSearch/CLSPL/CLQLParser.js +171 -244
- package/lib/AggregateSearch/CLSPL/CLQLParserListener.js +14 -16
- package/lib/AggregateSearch/CLSPL/CLQLParserVisitor.js +14 -16
- package/lib/AggregateSearch/CLSPL/SPLStagy.js +14 -16
- package/lib/AggregateSearch/CLSPL/index.js +40 -32
- package/lib/AggregateSearch/components/DropDown/index.js +23 -19
- package/lib/AggregateSearch/hooks/useDropDown.js +47 -20
- package/lib/AggregateSearch/index.js +127 -45
- package/lib/AggregateSearch/index.less +35 -21
- package/lib/AggregateSearch/utils/index.js +12 -12
- package/lib/ContentEditableSearch/index.js +8 -8
- package/lib/ContentEditableSearch/utils/index.js +6 -6
- package/lib/PropertyControlViewer/components/DoAppIcon/CustomIcon/index.js +3 -3
- package/lib/PropertyControlViewer/components/DoAppIcon/index.js +3 -3
- package/lib/PropertyControlViewer/components/DoCiUnitBitmap.js +2 -2
- package/lib/PropertyControlViewer/components/DoImage.js +10 -10
- package/lib/PropertyControlViewer/components/DoSelect.js +7 -7
- package/lib/PropertyControlViewer/components/TagShowMoreList/index.js +7 -7
- package/lib/PropertyControlViewer/config/utils.js +2 -2
- package/lib/PropertyControlViewer/index.js +5 -5
- package/lib/Watermark/index.js +17 -16
- package/lib/locales/intl.js +10 -11
- package/lib/locales/withLocale.js +14 -16
- package/package.json +2 -2
|
@@ -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(
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? 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(
|
|
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(
|
|
10
|
-
function _arrayLikeToArray(
|
|
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(
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
109
|
+
_loop(node.parentNode);
|
|
86
110
|
}
|
|
87
111
|
}
|
|
88
112
|
};
|
|
89
|
-
|
|
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
|
|
164
|
-
key =
|
|
165
|
-
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
|
|
289
|
-
key =
|
|
290
|
-
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,
|
|
@@ -327,8 +351,10 @@ var useDropDown = function useDropDown(container, handleValueChange, onChange) {
|
|
|
327
351
|
},
|
|
328
352
|
value: {
|
|
329
353
|
isShow: true,
|
|
330
|
-
|
|
331
|
-
|
|
354
|
+
value: {
|
|
355
|
+
key: key,
|
|
356
|
+
value: node.innerText
|
|
357
|
+
}
|
|
332
358
|
},
|
|
333
359
|
match: {
|
|
334
360
|
isShow: false
|
|
@@ -395,7 +421,8 @@ var useDropDown = function useDropDown(container, handleValueChange, onChange) {
|
|
|
395
421
|
visible: visible,
|
|
396
422
|
quickSelect: quickSelect,
|
|
397
423
|
onHistorySelect: onHistorySelect,
|
|
398
|
-
setVisible: setVisible
|
|
424
|
+
setVisible: setVisible,
|
|
425
|
+
currentPositionIndex: currentPositionIndex
|
|
399
426
|
};
|
|
400
427
|
};
|
|
401
428
|
export default useDropDown;
|
|
@@ -1,28 +1,28 @@
|
|
|
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(
|
|
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(
|
|
5
|
-
function _arrayLikeToArray(
|
|
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(
|
|
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
|
|
9
|
-
function asyncGeneratorStep(
|
|
10
|
-
function _asyncToGenerator(
|
|
11
|
-
import React, { useEffect, useRef, useState,
|
|
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
|
+
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";
|
|
14
14
|
import SwitchBtn from "./components/SwitchBtn";
|
|
15
15
|
import DropDown from "./components/DropDown";
|
|
16
|
-
import "./index.less";
|
|
17
16
|
import useDropDown from "./hooks/useDropDown";
|
|
18
17
|
import CloseAllIcon from "./components/CloseAllIcon";
|
|
19
18
|
import classnames from "classnames";
|
|
20
|
-
|
|
19
|
+
import "./index.less";
|
|
20
|
+
var AggregateSearch = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
21
21
|
var _props$onChange = props.onChange,
|
|
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(
|
|
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 = function AggregateSearch(props) {
|
|
|
34
34
|
}, _callee);
|
|
35
35
|
})) : _props$fetchKeyList,
|
|
36
36
|
_props$fetchValueList = props.fetchValueList,
|
|
37
|
-
fetchValueList = _props$fetchValueList === void 0 ? /*#__PURE__*/_asyncToGenerator(
|
|
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 = function AggregateSearch(props) {
|
|
|
46
46
|
}, _callee2);
|
|
47
47
|
})) : _props$fetchValueList,
|
|
48
48
|
_props$fetchHistoryLi = props.fetchHistoryList,
|
|
49
|
-
fetchHistoryList = _props$fetchHistoryLi === void 0 ? /*#__PURE__*/_asyncToGenerator(
|
|
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 = function AggregateSearch(props) {
|
|
|
58
58
|
}, _callee3);
|
|
59
59
|
})) : _props$fetchHistoryLi,
|
|
60
60
|
_props$onHistoryDelet = props.onHistoryDelete,
|
|
61
|
-
onHistoryDelete = _props$onHistoryDelet === void 0 ? /*#__PURE__*/_asyncToGenerator(
|
|
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,16 @@ var AggregateSearch = function AggregateSearch(props) {
|
|
|
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;
|
|
93
|
+
|
|
85
94
|
// 输入模式
|
|
86
95
|
var _useState = useState(defaultMode),
|
|
87
96
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -102,11 +111,23 @@ var AggregateSearch = function AggregateSearch(props) {
|
|
|
102
111
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
103
112
|
contentEditable = _useState6[0],
|
|
104
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);
|
|
105
119
|
// 是否正在输入中文
|
|
106
120
|
var isComposing = useRef(false);
|
|
121
|
+
useImperativeHandle(ref, function () {
|
|
122
|
+
return {
|
|
123
|
+
getContainerWrapper: function getContainerWrapper() {
|
|
124
|
+
return containerWrapperRef.current;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
});
|
|
107
128
|
var handleSyntaxCheck = /*#__PURE__*/function () {
|
|
108
|
-
var _ref5 = _asyncToGenerator(
|
|
109
|
-
var checkRes, column, msg, _getCursorNodeAndInde, errorNode,
|
|
129
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(inputStr) {
|
|
130
|
+
var checkRes, column, msg, _getCursorNodeAndInde, errorNode, _findParent, errorTag;
|
|
110
131
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
111
132
|
while (1) switch (_context5.prev = _context5.next) {
|
|
112
133
|
case 0:
|
|
@@ -115,12 +136,12 @@ var AggregateSearch = function AggregateSearch(props) {
|
|
|
115
136
|
case 2:
|
|
116
137
|
checkRes = _context5.sent;
|
|
117
138
|
if (!checkRes) {
|
|
118
|
-
_context5.next =
|
|
139
|
+
_context5.next = 11;
|
|
119
140
|
break;
|
|
120
141
|
}
|
|
121
142
|
column = checkRes.column, msg = checkRes.msg; // 找到目标节点,高亮提示错误
|
|
122
143
|
_getCursorNodeAndInde = getCursorNodeAndIndex(container.current, column), errorNode = _getCursorNodeAndInde.targetNode;
|
|
123
|
-
|
|
144
|
+
_findParent = function findParent(node) {
|
|
124
145
|
var _node$dataset;
|
|
125
146
|
if (!node || node === container.current) {
|
|
126
147
|
var nextSiblingIndex = column > 0 ? column - 1 : column + 1;
|
|
@@ -130,23 +151,25 @@ var AggregateSearch = function AggregateSearch(props) {
|
|
|
130
151
|
if (!newErrorNode && (nextSiblingIndex < 0 || nextSiblingIndex > inputStr.length)) {
|
|
131
152
|
return null;
|
|
132
153
|
}
|
|
133
|
-
return
|
|
154
|
+
return _findParent(newErrorNode);
|
|
134
155
|
}
|
|
135
156
|
var dataAttr = (_node$dataset = node.dataset) === null || _node$dataset === void 0 ? void 0 : _node$dataset["attr"];
|
|
136
157
|
if (dataAttr && ["tag-box"].includes(dataAttr)) {
|
|
137
158
|
return node;
|
|
138
159
|
}
|
|
139
|
-
return
|
|
160
|
+
return _findParent(node.parentNode);
|
|
140
161
|
};
|
|
141
|
-
errorTag =
|
|
162
|
+
errorTag = _findParent(errorNode);
|
|
142
163
|
if (errorTag) {
|
|
143
164
|
errorTag.classList.add("syntax-error");
|
|
144
165
|
errorTag.setAttribute("data-error", msg);
|
|
145
166
|
}
|
|
167
|
+
setErrorDom(errorTag);
|
|
146
168
|
return _context5.abrupt("return", true);
|
|
147
|
-
case 10:
|
|
148
|
-
return _context5.abrupt("return", false);
|
|
149
169
|
case 11:
|
|
170
|
+
setErrorDom(null);
|
|
171
|
+
return _context5.abrupt("return", false);
|
|
172
|
+
case 13:
|
|
150
173
|
case "end":
|
|
151
174
|
return _context5.stop();
|
|
152
175
|
}
|
|
@@ -157,28 +180,34 @@ var AggregateSearch = function AggregateSearch(props) {
|
|
|
157
180
|
};
|
|
158
181
|
}();
|
|
159
182
|
var handleValueChange = /*#__PURE__*/function () {
|
|
160
|
-
var _ref6 = _asyncToGenerator(
|
|
183
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(inputStr, mode) {
|
|
161
184
|
var checkRes, planeTextPosition, htmlString, _getCursorNodeAndInde3, targetNode, targetIndex;
|
|
162
185
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
163
186
|
while (1) switch (_context6.prev = _context6.next) {
|
|
164
187
|
case 0:
|
|
165
188
|
if (!((mode || curMode) === "text")) {
|
|
166
|
-
_context6.next =
|
|
189
|
+
_context6.next = 7;
|
|
167
190
|
break;
|
|
168
191
|
}
|
|
169
192
|
_context6.next = 3;
|
|
170
193
|
return checkSyntax(inputStr);
|
|
171
194
|
case 3:
|
|
172
195
|
checkRes = _context6.sent;
|
|
196
|
+
if (container.current.innerText !== inputStr) {
|
|
197
|
+
// 重复触发container.current.innerText赋值会影响光标位置
|
|
198
|
+
container.current.innerText = inputStr;
|
|
199
|
+
}
|
|
173
200
|
if (checkRes) {
|
|
201
|
+
setErrorDom(containerWrapperRef.current);
|
|
174
202
|
containerWrapperRef.current.classList.add("syntax-error");
|
|
175
203
|
containerWrapperRef.current.setAttribute("data-error", checkRes.msg);
|
|
176
204
|
} else {
|
|
205
|
+
setErrorDom(null);
|
|
177
206
|
containerWrapperRef.current.classList.remove("syntax-error");
|
|
178
207
|
containerWrapperRef.current.removeAttribute("data-error");
|
|
179
208
|
}
|
|
180
209
|
return _context6.abrupt("return");
|
|
181
|
-
case
|
|
210
|
+
case 7:
|
|
182
211
|
// 计算当前光标位置(纯文本模式)
|
|
183
212
|
planeTextPosition = getCursorPosition(container.current); // 将纯文本模式转为html模式(语法解析器)
|
|
184
213
|
htmlString = genHtmlAndSyntaxCheckResByString(inputStr);
|
|
@@ -193,13 +222,12 @@ var AggregateSearch = function AggregateSearch(props) {
|
|
|
193
222
|
_getCursorNodeAndInde3 = getCursorNodeAndIndex(container.current, planeTextPosition), targetNode = _getCursorNodeAndInde3.targetNode, targetIndex = _getCursorNodeAndInde3.targetIndex; // 设置光标位置
|
|
194
223
|
setCursorPosition(targetNode, targetIndex);
|
|
195
224
|
}
|
|
196
|
-
|
|
197
225
|
// 检测语法
|
|
198
|
-
_context6.next =
|
|
226
|
+
_context6.next = 13;
|
|
199
227
|
return handleSyntaxCheck(inputStr);
|
|
200
|
-
case 12:
|
|
201
|
-
setSelValue(container.current.innerText);
|
|
202
228
|
case 13:
|
|
229
|
+
setSelValue(container.current.innerText.replace(/\s{1}$/g, ""));
|
|
230
|
+
case 14:
|
|
203
231
|
case "end":
|
|
204
232
|
return _context6.stop();
|
|
205
233
|
}
|
|
@@ -209,14 +237,15 @@ var AggregateSearch = function AggregateSearch(props) {
|
|
|
209
237
|
return _ref6.apply(this, arguments);
|
|
210
238
|
};
|
|
211
239
|
}();
|
|
212
|
-
var _useDropDown = useDropDown(container, handleValueChange, onChange),
|
|
240
|
+
var _useDropDown = useDropDown(container, handleValueChange, onChange, onMatchOptionShow, onCombinedOptionShow),
|
|
213
241
|
dropStatus = _useDropDown.dropStatus,
|
|
214
242
|
visible = _useDropDown.visible,
|
|
215
243
|
quickSelect = _useDropDown.quickSelect,
|
|
216
244
|
onHistorySelect = _useDropDown.onHistorySelect,
|
|
217
|
-
setVisible = _useDropDown.setVisible
|
|
245
|
+
setVisible = _useDropDown.setVisible,
|
|
246
|
+
currentPositionIndex = _useDropDown.currentPositionIndex;
|
|
218
247
|
var onInput = /*#__PURE__*/function () {
|
|
219
|
-
var _ref7 = _asyncToGenerator(
|
|
248
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(e) {
|
|
220
249
|
var cloneDomRemoveCloseBtnDom;
|
|
221
250
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
222
251
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -268,6 +297,7 @@ var AggregateSearch = function AggregateSearch(props) {
|
|
|
268
297
|
nextSiblingWrappr.nodeValue = nextSiblingWrappr.nodeValue.replace(/(^\s{1})/, "");
|
|
269
298
|
}
|
|
270
299
|
container.current.removeChild(CloseTagWrapper);
|
|
300
|
+
currentPositionIndex.current = 0; // 点击关闭按钮重置当前光标位置
|
|
271
301
|
handleValueChange(container.current.innerText);
|
|
272
302
|
onChange(container.current.innerText);
|
|
273
303
|
}
|
|
@@ -277,17 +307,60 @@ var AggregateSearch = function AggregateSearch(props) {
|
|
|
277
307
|
document.removeEventListener("click", handleClick);
|
|
278
308
|
};
|
|
279
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]);
|
|
280
349
|
var onFocus = function onFocus() {
|
|
281
350
|
setVisible(true);
|
|
282
351
|
};
|
|
283
352
|
var onModeChange = function onModeChange(mode) {
|
|
284
353
|
setSelMode(mode);
|
|
285
354
|
if (mode === "text") {
|
|
286
|
-
container.current.innerText = container.current.innerText;
|
|
355
|
+
// container.current.innerText = container.current.innerText; old sonar扫描过不去
|
|
356
|
+
container.current.innerHTML = container.current.innerText;
|
|
287
357
|
} else {
|
|
288
358
|
// 移除错误提示
|
|
289
359
|
containerWrapperRef.current.classList.remove("syntax-error");
|
|
290
360
|
containerWrapperRef.current.removeAttribute("data-error");
|
|
361
|
+
if (tooltipDomRef.current) {
|
|
362
|
+
tooltipDomRef.current.style.display = "none";
|
|
363
|
+
}
|
|
291
364
|
}
|
|
292
365
|
handleValueChange(container.current.innerText, mode);
|
|
293
366
|
};
|
|
@@ -313,10 +386,7 @@ var AggregateSearch = function AggregateSearch(props) {
|
|
|
313
386
|
}
|
|
314
387
|
},
|
|
315
388
|
valueOption: {
|
|
316
|
-
value: dropStatus.value.isShow ?
|
|
317
|
-
key: dropStatus.value.key,
|
|
318
|
-
value: dropStatus.value.value
|
|
319
|
-
} : null,
|
|
389
|
+
value: dropStatus.value.isShow ? dropStatus.value.value : null,
|
|
320
390
|
fetchFuc: fetchValueList,
|
|
321
391
|
onSelect: function onSelect(value) {
|
|
322
392
|
quickSelect(value, "value");
|
|
@@ -335,13 +405,15 @@ var AggregateSearch = function AggregateSearch(props) {
|
|
|
335
405
|
isShow: dropStatus.match.isShow,
|
|
336
406
|
onSelect: function onSelect(value) {
|
|
337
407
|
quickSelect(value, "match");
|
|
338
|
-
}
|
|
408
|
+
},
|
|
409
|
+
list: matchOptionList
|
|
339
410
|
},
|
|
340
411
|
combinedOption: {
|
|
341
412
|
isShow: dropStatus.combined.isShow,
|
|
342
413
|
onSelect: function onSelect(value) {
|
|
343
414
|
quickSelect(value, "combined");
|
|
344
|
-
}
|
|
415
|
+
},
|
|
416
|
+
list: combinedOptionList
|
|
345
417
|
},
|
|
346
418
|
containerWrapperRef: containerWrapperRef,
|
|
347
419
|
debounceWait: debounceWait
|
|
@@ -384,7 +456,7 @@ var AggregateSearch = function AggregateSearch(props) {
|
|
|
384
456
|
onChange: onModeChange,
|
|
385
457
|
mode: mode || selMode
|
|
386
458
|
})));
|
|
387
|
-
};
|
|
459
|
+
});
|
|
388
460
|
AggregateSearch.propTypes = {
|
|
389
461
|
/**
|
|
390
462
|
* 受控value
|
|
@@ -399,11 +471,11 @@ AggregateSearch.propTypes = {
|
|
|
399
471
|
*/
|
|
400
472
|
onPressEnter: PropTypes.func,
|
|
401
473
|
/**
|
|
402
|
-
* 可生成标签对模式下触发搜索标签key的回调,需要返回promise,async(
|
|
474
|
+
* 可生成标签对模式下触发搜索标签key的回调,需要返回promise,async(key)=>[],参数为当前光标所在标签的key值:需要该值请求下拉列表key值数据
|
|
403
475
|
*/
|
|
404
476
|
fetchKeyList: PropTypes.func,
|
|
405
477
|
/**
|
|
406
|
-
* 可生成标签对模式下触发搜索标签value的回调,需要返回promise,async(value)=>[],参数为当前光标所在标签的value值:需要该值请求下拉列表value值数据
|
|
478
|
+
* 可生成标签对模式下触发搜索标签value的回调,需要返回promise,async({key,value})=>[],参数为当前光标所在标签的key和value值:需要该值请求下拉列表value值数据
|
|
407
479
|
*/
|
|
408
480
|
fetchValueList: PropTypes.func,
|
|
409
481
|
/**
|
|
@@ -433,6 +505,16 @@ AggregateSearch.propTypes = {
|
|
|
433
505
|
/**
|
|
434
506
|
* 防抖时间默认为300ms
|
|
435
507
|
*/
|
|
436
|
-
debounceWait: PropTypes.number
|
|
508
|
+
debounceWait: PropTypes.number,
|
|
509
|
+
/**
|
|
510
|
+
* 配置项:目前有匹配方式和组合模式的配置
|
|
511
|
+
* {
|
|
512
|
+
* matchOptionList, // 匹配方式下拉列表,若不传使用默认的配置项
|
|
513
|
+
* combinedOptionList, // 组合模式下拉列表,若不传使用默认的配置项
|
|
514
|
+
* onMatchOptionShow = () => {}, // 匹配方式下拉列表显示回调
|
|
515
|
+
* onCombinedOptionShow = () => {}, // 组合模式下拉列表显示回调
|
|
516
|
+
* }
|
|
517
|
+
*/
|
|
518
|
+
option: PropTypes.object
|
|
437
519
|
};
|
|
438
520
|
export default AggregateSearch;
|