@chaoswise/business 0.0.9 → 0.0.11
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/components/CloseAllIcon/assets/Close-Circle-Fill.svg +18 -0
- package/lib/AggregateSearch/components/CloseAllIcon/index.js +13 -0
- package/lib/AggregateSearch/components/CloseAllIcon/index.less +11 -0
- package/lib/AggregateSearch/components/DropDown/index.js +47 -17
- package/lib/AggregateSearch/components/DropDown/index.less +30 -15
- package/lib/AggregateSearch/components/SwitchBtn/index.less +9 -4
- package/lib/AggregateSearch/index.js +61 -16
- package/lib/AggregateSearch/index.less +48 -31
- package/lib/AggregateSearch/utils/index.js +10 -6
- package/lib/PropertyControlViewer/assets/doCommon.less +60 -64
- package/lib/PropertyControlViewer/assets/doSelect.less +60 -67
- package/lib/PropertyControlViewer/assets/index.less +114 -114
- package/lib/PropertyControlViewer/components/TagShowMoreList/index.less +84 -82
- package/lib/PropertyControlViewer/index.less +64 -149
- package/lib/Watermark/index.js +38 -8
- package/package.json +3 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>Icon/Fill/Close-Circle-Fill</title>
|
|
4
|
+
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="聚合搜索框" transform="translate(-1278.000000, -2867.000000)">
|
|
6
|
+
<rect fill="#FFFFFF" x="0" y="0" width="1920" height="3346"></rect>
|
|
7
|
+
<g id="7" opacity="0.800000012" transform="translate(120.000000, 2665.000000)">
|
|
8
|
+
<g id="搜索框备份-2" transform="translate(0.000000, 194.000000)">
|
|
9
|
+
<path d="M1214.00697,0.5 C1214.41913,0.5 1214.7922,0.667699564 1215.06223,0.938862019 C1215.33288,1.21063804 1215.5,1.58624721 1215.5,2.00138927 L1215.5,2.00138927 L1215.5,45.9986107 C1215.5,46.4131621 1215.33227,46.7885021 1215.0616,47.0603047 C1214.79133,47.3317133 1214.41826,47.5 1214.00697,47.5 L1214.00697,47.5 L1.99303181,47.5 C1.58086837,47.5 1.20779551,47.3323004 0.937765379,47.061138 C0.667124252,46.789362 0.5,46.4137528 0.5,45.9986107 L0.5,45.9986107 L0.5,2.00138927 C0.5,1.58683787 0.667729281,1.2114979 0.938396858,0.939695326 C1.20867209,0.668286734 1.58174111,0.5 1.99303181,0.5 L1.99303181,0.5 L1214.00697,0.5 Z" id="Rectangle-26-Copy-23备份" stroke="#FF4D4F" fill="#FFFFFF"></path>
|
|
10
|
+
<g id="Icon/Fill/Close-Circle-Fill" transform="translate(1158.000000, 8.000000)" fill="#000000">
|
|
11
|
+
<rect id="矩形" fill-rule="nonzero" opacity="0" x="0" y="0" width="12" height="12"></rect>
|
|
12
|
+
<path d="M6,0.75 C3.10078125,0.75 0.75,3.10078125 0.75,6 C0.75,8.89921875 3.10078125,11.25 6,11.25 C8.89921875,11.25 11.25,8.89921875 11.25,6 C11.25,3.10078125 8.89921875,0.75 6,0.75 Z M7.93828125,7.99453125 L7.16484375,7.99101563 L6,6.60234375 L4.83632812,7.98984375 L4.06171875,7.99335937 C4.01015625,7.99335937 3.96796875,7.95234375 3.96796875,7.89960937 C3.96796875,7.87734375 3.97617188,7.85625 3.99023438,7.83867187 L5.51484375,6.02226562 L3.99023438,4.20703125 C3.97617188,4.18945312 3.96796875,4.16835937 3.96796875,4.14609375 C3.96796875,4.09453125 4.01015625,4.05234375 4.06171875,4.05234375 L4.83632813,4.05585938 L6,5.44453125 L7.16367187,4.05703125 L7.93710937,4.05351563 C7.98867187,4.05351563 8.03085937,4.09453125 8.03085937,4.14726563 C8.03085937,4.16953125 8.02265625,4.190625 8.00859375,4.20820313 L6.48632812,6.0234375 L8.00976562,7.83984375 C8.02382813,7.85742188 8.03203125,7.87851562 8.03203125,7.90078125 C8.03203125,7.95234375 7.98984375,7.99453125 7.93828125,7.99453125 Z" id="形状" fill-opacity="0.25"></path>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _Icon from "@chaoswise/ui/lib/Antd/Icon";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import "./index.less";
|
|
4
|
+
var CloseAllIcon = function CloseAllIcon(_ref) {
|
|
5
|
+
var onClickCloseAll = _ref.onClickCloseAll;
|
|
6
|
+
return /*#__PURE__*/React.createElement(_Icon, {
|
|
7
|
+
type: "close-circle",
|
|
8
|
+
theme: "filled",
|
|
9
|
+
onClick: onClickCloseAll,
|
|
10
|
+
className: "close-all-icon"
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export default CloseAllIcon;
|
|
@@ -411,14 +411,18 @@ var DropDown = function DropDown(props) {
|
|
|
411
411
|
return _historyDelete.apply(this, arguments);
|
|
412
412
|
}
|
|
413
413
|
var menu = /*#__PURE__*/React.createElement("div", {
|
|
414
|
-
className: "aggregate-drop-down-wrap"
|
|
414
|
+
className: "aggregate-drop-down-wrap",
|
|
415
|
+
onClick: function onClick(e) {
|
|
416
|
+
e.stopPropagation();
|
|
417
|
+
}
|
|
415
418
|
}, /*#__PURE__*/React.createElement("div", {
|
|
416
419
|
className: "aggregate-drop-down"
|
|
417
420
|
}, keyOptionValueNotEmpty && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
418
421
|
className: "list-title"
|
|
419
422
|
}, "\u6807\u7B7E\u641C\u7D22"), /*#__PURE__*/React.createElement(_Spin, {
|
|
420
423
|
spinning: keyLoading,
|
|
421
|
-
tip: "\u52A0\u8F7D\u4E2D..."
|
|
424
|
+
tip: "\u52A0\u8F7D\u4E2D...",
|
|
425
|
+
size: "small"
|
|
422
426
|
}, !dropDownKeyListEmpty ? keyList.map(function (record, index) {
|
|
423
427
|
var value = record.value,
|
|
424
428
|
des = record.des;
|
|
@@ -428,18 +432,23 @@ var DropDown = function DropDown(props) {
|
|
|
428
432
|
onClick: function onClick() {
|
|
429
433
|
keyOption === null || keyOption === void 0 || keyOption.onSelect(value, record);
|
|
430
434
|
}
|
|
431
|
-
}, /*#__PURE__*/React.createElement("span",
|
|
435
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
436
|
+
className: "list-title-target-wrapper"
|
|
437
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
432
438
|
className: "pre-icon",
|
|
433
439
|
src: keyIcon,
|
|
434
440
|
alt: ""
|
|
435
|
-
}), highLight(value, keyOptionValue)), /*#__PURE__*/React.createElement("span",
|
|
441
|
+
}), highLight(value, keyOptionValue)), /*#__PURE__*/React.createElement("span", {
|
|
442
|
+
className: "list-title-des-wrapper"
|
|
443
|
+
}, des));
|
|
436
444
|
}) : /*#__PURE__*/React.createElement("div", {
|
|
437
445
|
className: "empty"
|
|
438
446
|
}, "\u6682\u65E0\u6570\u636E\uFF0C\u63D0\u4EA4\u641C\u7D22\u540E\u641C\u7D22\u5173\u952E\u5B57"))), valueOptionValueNotEmpty && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
439
447
|
className: "list-title"
|
|
440
448
|
}, "Value"), /*#__PURE__*/React.createElement(_Spin, {
|
|
441
449
|
spinning: valueLoading,
|
|
442
|
-
tip: "\u52A0\u8F7D\u4E2D..."
|
|
450
|
+
tip: "\u52A0\u8F7D\u4E2D...",
|
|
451
|
+
size: "small"
|
|
443
452
|
}, !dropDownValueListEmpty ? valueList.map(function (record, index) {
|
|
444
453
|
var value = record.value,
|
|
445
454
|
des = record.des;
|
|
@@ -449,11 +458,15 @@ var DropDown = function DropDown(props) {
|
|
|
449
458
|
onClick: function onClick() {
|
|
450
459
|
valueOption === null || valueOption === void 0 || valueOption.onSelect(value, record);
|
|
451
460
|
}
|
|
452
|
-
}, /*#__PURE__*/React.createElement("span",
|
|
461
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
462
|
+
className: "list-title-target-wrapper"
|
|
463
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
453
464
|
className: "pre-icon",
|
|
454
465
|
src: valueIcon,
|
|
455
466
|
alt: ""
|
|
456
|
-
}), highLight(value, valueOptionValue === null || valueOptionValue === void 0 ? void 0 : valueOptionValue.value)), /*#__PURE__*/React.createElement("span",
|
|
467
|
+
}), highLight(value, valueOptionValue === null || valueOptionValue === void 0 ? void 0 : valueOptionValue.value)), /*#__PURE__*/React.createElement("span", {
|
|
468
|
+
className: "list-title-des-wrapper"
|
|
469
|
+
}, des));
|
|
457
470
|
}) : /*#__PURE__*/React.createElement("div", {
|
|
458
471
|
className: "empty"
|
|
459
472
|
}, "\u6682\u65E0\u6570\u636E\uFF0C\u63D0\u4EA4\u641C\u7D22\u540E\u641C\u7D22\u5173\u952E\u5B57"))), matchOption.isShow && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -467,11 +480,15 @@ var DropDown = function DropDown(props) {
|
|
|
467
480
|
onClick: function onClick() {
|
|
468
481
|
matchOption === null || matchOption === void 0 || matchOption.onSelect(value, record);
|
|
469
482
|
}
|
|
470
|
-
}, /*#__PURE__*/React.createElement("span",
|
|
483
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
484
|
+
className: "list-title-target-wrapper"
|
|
485
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
471
486
|
className: "pre-icon",
|
|
472
487
|
src: combinedIcon,
|
|
473
488
|
alt: ""
|
|
474
|
-
}), value), /*#__PURE__*/React.createElement("span",
|
|
489
|
+
}), value), /*#__PURE__*/React.createElement("span", {
|
|
490
|
+
className: "list-title-des-wrapper"
|
|
491
|
+
}, des));
|
|
475
492
|
})), combinedOption.isShow && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
476
493
|
className: "list-title"
|
|
477
494
|
}, "\u7EC4\u5408\u7B26\u53F7"), (combinedOption.list || DEFAULT_COMBINED_OPTION_LIST).map(function (record, index) {
|
|
@@ -483,16 +500,21 @@ var DropDown = function DropDown(props) {
|
|
|
483
500
|
onClick: function onClick() {
|
|
484
501
|
combinedOption === null || combinedOption === void 0 || combinedOption.onSelect(value, record);
|
|
485
502
|
}
|
|
486
|
-
}, /*#__PURE__*/React.createElement("span",
|
|
503
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
504
|
+
className: "list-title-target-wrapper"
|
|
505
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
487
506
|
className: "pre-icon",
|
|
488
507
|
src: combinedIcon,
|
|
489
508
|
alt: ""
|
|
490
|
-
}), value), /*#__PURE__*/React.createElement("span",
|
|
509
|
+
}), value), /*#__PURE__*/React.createElement("span", {
|
|
510
|
+
className: "list-title-des-wrapper"
|
|
511
|
+
}, des));
|
|
491
512
|
})), historyOptionValueNotEmpty && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
492
513
|
className: "list-title"
|
|
493
514
|
}, "\u641C\u7D22\u5386\u53F2"), /*#__PURE__*/React.createElement(_Spin, {
|
|
494
515
|
spinning: historyLoading,
|
|
495
|
-
tip: "\u52A0\u8F7D\u4E2D..."
|
|
516
|
+
tip: "\u52A0\u8F7D\u4E2D...",
|
|
517
|
+
size: "small"
|
|
496
518
|
}, !dropDownListHistoryEmpty ? historyList.map(function (record, index) {
|
|
497
519
|
var id = record.id,
|
|
498
520
|
value = record.value,
|
|
@@ -503,12 +525,14 @@ var DropDown = function DropDown(props) {
|
|
|
503
525
|
onClick: function onClick() {
|
|
504
526
|
historyOption === null || historyOption === void 0 || historyOption.onSelect(value, record);
|
|
505
527
|
}
|
|
506
|
-
}, /*#__PURE__*/React.createElement("span",
|
|
528
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
529
|
+
className: "list-title-target-wrapper"
|
|
530
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
507
531
|
className: "pre-icon",
|
|
508
532
|
src: timeCircleIcon,
|
|
509
533
|
alt: ""
|
|
510
534
|
}), highLight(value, historyOptionValue)), /*#__PURE__*/React.createElement("span", {
|
|
511
|
-
className: "des"
|
|
535
|
+
className: "list-title-des-wrapper des"
|
|
512
536
|
}, des), /*#__PURE__*/React.createElement("span", {
|
|
513
537
|
className: "action"
|
|
514
538
|
}, /*#__PURE__*/React.createElement(CopyToClipboard, {
|
|
@@ -537,7 +561,13 @@ var DropDown = function DropDown(props) {
|
|
|
537
561
|
className: "empty"
|
|
538
562
|
}, "\u6682\u65E0\u6570\u636E\uFF0C\u63D0\u4EA4\u641C\u7D22\u540E\u641C\u7D22\u5173\u952E\u5B57")))), /*#__PURE__*/React.createElement("div", {
|
|
539
563
|
className: "desc"
|
|
540
|
-
}, /*#__PURE__*/React.createElement(_TooltipText, null, "\u5168\u6587\u68C0\u7D22\uFF1Ahello world
|
|
564
|
+
}, /*#__PURE__*/React.createElement(_TooltipText, null, /*#__PURE__*/React.createElement("span", null, "\u5168\u6587\u68C0\u7D22\uFF1Ahello world"), /*#__PURE__*/React.createElement("span", {
|
|
565
|
+
className: "desc-margin-32"
|
|
566
|
+
}, "\u5B8C\u5168\u5339\u914D\uFF1A\"hello world\""), /*#__PURE__*/React.createElement("span", {
|
|
567
|
+
className: "desc-margin-32"
|
|
568
|
+
}, "\u901A\u914D\u7B26\uFF1A*?"), /*#__PURE__*/React.createElement("span", {
|
|
569
|
+
className: "desc-margin-32"
|
|
570
|
+
}, "\u5173\u8054\u641C\u7D22\uFF1Astatus:(error OR warning) AND NOT service:\u201Cservice_a\u201D")), /*#__PURE__*/React.createElement(_Button, {
|
|
541
571
|
type: "link",
|
|
542
572
|
onClick: onHelpClick
|
|
543
573
|
}, "\u5E2E\u52A9\u6587\u6863")));
|
|
@@ -548,9 +578,9 @@ var DropDown = function DropDown(props) {
|
|
|
548
578
|
return node;
|
|
549
579
|
},
|
|
550
580
|
overlayStyle: {
|
|
551
|
-
top: height,
|
|
581
|
+
top: Number(height + 2),
|
|
552
582
|
left: 0
|
|
553
|
-
}
|
|
583
|
+
} // 2是边框高度
|
|
554
584
|
}, children);
|
|
555
585
|
};
|
|
556
586
|
export default DropDown;
|
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
.aggregate-drop-down {
|
|
7
7
|
width: 100%;
|
|
8
8
|
max-height: 380px;
|
|
9
|
-
padding: 4px 0;
|
|
9
|
+
// padding: 4px 0;
|
|
10
10
|
overflow: auto;
|
|
11
11
|
justify-content: center;
|
|
12
12
|
align-items: center;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
.@{ant-prefix}-spin-nested-loading {
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
.@{ant-prefix}-spin {
|
|
17
17
|
display: flex;
|
|
18
18
|
align-items: center;
|
|
19
19
|
justify-content: center;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
.@{ant-prefix}-spin-dot-spin,
|
|
22
|
+
.@{ant-prefix}-spin-text {
|
|
23
23
|
position: relative;
|
|
24
24
|
margin: 0;
|
|
25
25
|
padding: 0;
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
left: 0;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.ant-spin-dot-spin {
|
|
31
|
-
|
|
32
|
-
}
|
|
30
|
+
// .ant-spin-dot-spin {
|
|
31
|
+
// font-size: 18px;
|
|
32
|
+
// }
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
.@{ant-prefix}-spin-text {
|
|
35
35
|
width: auto;
|
|
36
36
|
margin-left: 4px;
|
|
37
37
|
}
|
|
@@ -42,8 +42,19 @@
|
|
|
42
42
|
line-height: 32px;
|
|
43
43
|
background-color: rgba(0, 0, 0, 0.02);
|
|
44
44
|
padding: 0 10px;
|
|
45
|
+
color: @text-color-show;
|
|
46
|
+
}
|
|
47
|
+
.list-title-target-wrapper{
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
}
|
|
51
|
+
.list-title-des-wrapper{
|
|
52
|
+
color: @text-color-secondary;
|
|
45
53
|
}
|
|
46
54
|
|
|
55
|
+
.list-title:not(:first-child){
|
|
56
|
+
margin-top: 8px;
|
|
57
|
+
}
|
|
47
58
|
.list {
|
|
48
59
|
&:hover {
|
|
49
60
|
cursor: pointer;
|
|
@@ -54,7 +65,8 @@
|
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
.action {
|
|
57
|
-
display:
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
58
70
|
}
|
|
59
71
|
}
|
|
60
72
|
|
|
@@ -62,10 +74,9 @@
|
|
|
62
74
|
display: flex;
|
|
63
75
|
justify-content: space-between;
|
|
64
76
|
padding: 0 10px;
|
|
65
|
-
|
|
77
|
+
align-items: center;
|
|
66
78
|
.action {
|
|
67
79
|
display: none;
|
|
68
|
-
|
|
69
80
|
.pre-icon {
|
|
70
81
|
&:nth-child(2) {
|
|
71
82
|
margin-right: 0;
|
|
@@ -75,8 +86,8 @@
|
|
|
75
86
|
|
|
76
87
|
.pre-icon {
|
|
77
88
|
margin-right: 8px;
|
|
78
|
-
height: 16px;
|
|
79
|
-
width: 16px;
|
|
89
|
+
// height: 16px;
|
|
90
|
+
// width: 16px;
|
|
80
91
|
}
|
|
81
92
|
}
|
|
82
93
|
|
|
@@ -94,7 +105,11 @@
|
|
|
94
105
|
display: flex;
|
|
95
106
|
justify-content: space-between;
|
|
96
107
|
align-items: center;
|
|
97
|
-
|
|
108
|
+
margin-top: 8px;
|
|
109
|
+
color: @text-color-show;
|
|
110
|
+
.desc-margin-32{
|
|
111
|
+
margin-left: 32px;
|
|
112
|
+
}
|
|
98
113
|
.ant-btn-link {
|
|
99
114
|
margin-left: 10px;
|
|
100
115
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
.aggregate-search-switch-btn {
|
|
2
|
-
border: @border-width-base @border-style-base @input-border-color;
|
|
3
|
-
border-left: none;
|
|
2
|
+
// border: @border-width-base @border-style-base @input-border-color;
|
|
3
|
+
// border-left: none;
|
|
4
|
+
border-left: @border-width-base @border-style-base @input-border-color;
|
|
4
5
|
min-height: 26px;
|
|
5
6
|
cursor: pointer;
|
|
6
7
|
background: rgba(0, 0, 0, 0.02);
|
|
7
8
|
border-radius: 0 2px 2px 0;
|
|
8
9
|
display: flex;
|
|
9
|
-
padding: 0
|
|
10
|
+
padding: 0 9px;
|
|
10
11
|
align-items: flex-start;
|
|
11
12
|
align-self: stretch; // 使得高度和父元素一致
|
|
13
|
+
width: 35px;
|
|
14
|
+
&:hover{
|
|
15
|
+
border-left-color: @input-hover-border-color;
|
|
16
|
+
}
|
|
12
17
|
img{
|
|
13
|
-
transform: translateY(
|
|
18
|
+
transform: translateY(8px);
|
|
14
19
|
}
|
|
15
20
|
}
|
|
@@ -15,6 +15,8 @@ import SwitchBtn from "./components/SwitchBtn";
|
|
|
15
15
|
import DropDown from "./components/DropDown";
|
|
16
16
|
import "./index.less";
|
|
17
17
|
import useDropDown from "./hooks/useDropDown";
|
|
18
|
+
import CloseAllIcon from "./components/CloseAllIcon";
|
|
19
|
+
import classnames from "classnames";
|
|
18
20
|
var AggregateSearch = function AggregateSearch(_ref) {
|
|
19
21
|
var _ref$onChange = _ref.onChange,
|
|
20
22
|
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
@@ -71,7 +73,8 @@ var AggregateSearch = function AggregateSearch(_ref) {
|
|
|
71
73
|
onHelpClick = _ref$onHelpClick === void 0 ? function () {} : _ref$onHelpClick,
|
|
72
74
|
mode = _ref.mode,
|
|
73
75
|
_ref$defaultMode = _ref.defaultMode,
|
|
74
|
-
defaultMode = _ref$defaultMode === void 0 ? "tag" : _ref$defaultMode
|
|
76
|
+
defaultMode = _ref$defaultMode === void 0 ? "tag" : _ref$defaultMode,
|
|
77
|
+
placeholder = _ref.placeholder;
|
|
75
78
|
// 输入模式
|
|
76
79
|
var _useState = useState(defaultMode),
|
|
77
80
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -87,6 +90,11 @@ var AggregateSearch = function AggregateSearch(_ref) {
|
|
|
87
90
|
setSelValue = _useState4[1];
|
|
88
91
|
var container = useRef(null);
|
|
89
92
|
var containerWrapperRef = useRef(null);
|
|
93
|
+
// 是否可编辑,若点击编辑区域外内容则不可编辑 todo:用于修复聚焦bug
|
|
94
|
+
var _useState5 = useState(true),
|
|
95
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
96
|
+
contentEditable = _useState6[0],
|
|
97
|
+
setContentEditable = _useState6[1];
|
|
90
98
|
// 是否正在输入中文
|
|
91
99
|
var isComposing = useRef(false);
|
|
92
100
|
var handleSyntaxCheck = /*#__PURE__*/function () {
|
|
@@ -156,18 +164,23 @@ var AggregateSearch = function AggregateSearch(_ref) {
|
|
|
156
164
|
case 3:
|
|
157
165
|
checkRes = _context6.sent;
|
|
158
166
|
if (checkRes) {
|
|
159
|
-
|
|
160
|
-
|
|
167
|
+
containerWrapperRef.current.classList.add("syntax-error");
|
|
168
|
+
containerWrapperRef.current.setAttribute("data-error", checkRes.msg);
|
|
161
169
|
} else {
|
|
162
|
-
|
|
163
|
-
|
|
170
|
+
containerWrapperRef.current.classList.remove("syntax-error");
|
|
171
|
+
containerWrapperRef.current.removeAttribute("data-error");
|
|
164
172
|
}
|
|
165
173
|
return _context6.abrupt("return");
|
|
166
174
|
case 6:
|
|
167
175
|
// 计算当前光标位置(纯文本模式)
|
|
168
176
|
planeTextPosition = getCursorPosition(container.current); // 将纯文本模式转为html模式(语法解析器)
|
|
169
177
|
htmlString = genHtmlAndSyntaxCheckResByString(inputStr);
|
|
170
|
-
|
|
178
|
+
if (!htmlString.trim()) {
|
|
179
|
+
// 修复空状态placeholder
|
|
180
|
+
container.current.innerHTML = "";
|
|
181
|
+
} else {
|
|
182
|
+
container.current.innerHTML = htmlString;
|
|
183
|
+
}
|
|
171
184
|
// 找到格式化后的光标位置
|
|
172
185
|
if (planeTextPosition !== null) {
|
|
173
186
|
_getCursorNodeAndInde3 = getCursorNodeAndIndex(container.current, planeTextPosition), targetNode = _getCursorNodeAndInde3.targetNode, targetIndex = _getCursorNodeAndInde3.targetIndex; // 设置光标位置
|
|
@@ -227,8 +240,14 @@ var AggregateSearch = function AggregateSearch(_ref) {
|
|
|
227
240
|
// 监听点击事件(container以外的地方)
|
|
228
241
|
useEffect(function () {
|
|
229
242
|
var handleClick = function handleClick(e) {
|
|
230
|
-
|
|
243
|
+
// 可编辑文本框边框线e.target !== containerWrapperRef.current
|
|
244
|
+
if (container.current && !container.current.contains(e.target) && e.target !== containerWrapperRef.current) {
|
|
231
245
|
setVisible(false);
|
|
246
|
+
setContentEditable(false);
|
|
247
|
+
} else {
|
|
248
|
+
var _container$current;
|
|
249
|
+
setContentEditable(true);
|
|
250
|
+
(_container$current = container.current) === null || _container$current === void 0 || _container$current.focus();
|
|
232
251
|
}
|
|
233
252
|
};
|
|
234
253
|
document.addEventListener("click", handleClick);
|
|
@@ -245,14 +264,23 @@ var AggregateSearch = function AggregateSearch(_ref) {
|
|
|
245
264
|
container.current.innerText = container.current.innerText;
|
|
246
265
|
} else {
|
|
247
266
|
// 移除错误提示
|
|
248
|
-
|
|
249
|
-
|
|
267
|
+
containerWrapperRef.current.classList.remove("syntax-error");
|
|
268
|
+
containerWrapperRef.current.removeAttribute("data-error");
|
|
250
269
|
}
|
|
251
270
|
handleValueChange(container.current.innerText, mode);
|
|
252
271
|
};
|
|
272
|
+
var onKeyDown = function onKeyDown(e) {
|
|
273
|
+
var keyCode = e.keyCode;
|
|
274
|
+
if (keyCode === 13) {
|
|
275
|
+
// 回车阻止默认的换行行为
|
|
276
|
+
e.preventDefault();
|
|
277
|
+
onChange(e.target.innerText);
|
|
278
|
+
setVisible(false);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
253
281
|
return /*#__PURE__*/React.createElement(DropDown, {
|
|
254
282
|
onHelpClick: onHelpClick,
|
|
255
|
-
visible: visible && curMode === "tag",
|
|
283
|
+
visible: contentEditable && visible && curMode === "tag",
|
|
256
284
|
keyOption: {
|
|
257
285
|
value: dropStatus.key.isShow ? dropStatus.key.value : null,
|
|
258
286
|
fetchFuc: fetchKeyList,
|
|
@@ -293,12 +321,17 @@ var AggregateSearch = function AggregateSearch(_ref) {
|
|
|
293
321
|
},
|
|
294
322
|
containerWrapperRef: containerWrapperRef
|
|
295
323
|
}, /*#__PURE__*/React.createElement("div", {
|
|
296
|
-
className: "aggregate-search-wrapper",
|
|
324
|
+
className: classnames("aggregate-search-wrapper", {
|
|
325
|
+
"aggregate-search-text-wrapper": curMode === "text"
|
|
326
|
+
}),
|
|
297
327
|
ref: containerWrapperRef
|
|
298
328
|
}, /*#__PURE__*/React.createElement("div", {
|
|
299
329
|
spellCheck: false,
|
|
300
|
-
onCompositionEnd: function onCompositionEnd() {
|
|
301
|
-
|
|
330
|
+
onCompositionEnd: function onCompositionEnd(e) {
|
|
331
|
+
isComposing.current = false;
|
|
332
|
+
// 输入中文结束再触发一次,保证文本框对应内容与当前返回值一致,选项效果不会丢失
|
|
333
|
+
handleValueChange(e.target.innerText);
|
|
334
|
+
onChange(e.target.innerText);
|
|
302
335
|
},
|
|
303
336
|
onCompositionStart: function onCompositionStart() {
|
|
304
337
|
return isComposing.current = true;
|
|
@@ -306,12 +339,20 @@ var AggregateSearch = function AggregateSearch(_ref) {
|
|
|
306
339
|
className: "aggregate-search-input",
|
|
307
340
|
ref: container,
|
|
308
341
|
"data-attr": "container",
|
|
309
|
-
|
|
342
|
+
"data-placeholder": placeholder,
|
|
343
|
+
contentEditable: contentEditable,
|
|
310
344
|
suppressContentEditableWarning: true,
|
|
311
345
|
onPaste: textInit // 只粘贴纯文本 去除html标签
|
|
312
346
|
,
|
|
313
347
|
onInput: onInput,
|
|
314
|
-
onFocus: onFocus
|
|
348
|
+
onFocus: onFocus,
|
|
349
|
+
onKeyDown: onKeyDown
|
|
350
|
+
}), /*#__PURE__*/React.createElement(CloseAllIcon, {
|
|
351
|
+
onClickCloseAll: function onClickCloseAll() {
|
|
352
|
+
container.current.innerText = "";
|
|
353
|
+
handleValueChange("");
|
|
354
|
+
onChange("");
|
|
355
|
+
}
|
|
315
356
|
}), /*#__PURE__*/React.createElement(SwitchBtn, {
|
|
316
357
|
onChange: onModeChange,
|
|
317
358
|
mode: mode || selMode
|
|
@@ -345,6 +386,10 @@ AggregateSearch.propTypes = {
|
|
|
345
386
|
/**
|
|
346
387
|
* 删除历史记录回调,需要返回promise,async(id)=>Boolean
|
|
347
388
|
*/
|
|
348
|
-
onHistoryDelete: PropTypes.func
|
|
389
|
+
onHistoryDelete: PropTypes.func,
|
|
390
|
+
/**
|
|
391
|
+
* 内容为空提示
|
|
392
|
+
*/
|
|
393
|
+
placeholder: PropTypes.string
|
|
349
394
|
};
|
|
350
395
|
export default AggregateSearch;
|
|
@@ -21,55 +21,60 @@
|
|
|
21
21
|
align-items: flex-start;
|
|
22
22
|
white-space: pre-wrap;
|
|
23
23
|
position: relative;
|
|
24
|
+
border: @border-width-base @border-style-base @input-border-color;
|
|
25
|
+
border-radius: @border-radius-base;
|
|
26
|
+
// 聚焦样式修改
|
|
27
|
+
&:focus-within {
|
|
28
|
+
.active();
|
|
29
|
+
}
|
|
30
|
+
&:hover {
|
|
31
|
+
.hover();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 取消默认聚焦样式
|
|
35
|
+
&:focus-visible {
|
|
36
|
+
outline: none;
|
|
37
|
+
}
|
|
24
38
|
.aggregate-search-input {
|
|
25
39
|
position: relative;
|
|
26
40
|
padding: 0 10px;
|
|
41
|
+
padding-right: 30px;
|
|
27
42
|
flex: 1;
|
|
28
43
|
min-height: 26px;
|
|
29
|
-
line-height:
|
|
30
|
-
border: @border-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// 聚焦样式修改
|
|
34
|
-
&:focus {
|
|
35
|
-
.active();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// 取消默认聚焦样式
|
|
39
|
-
&:focus-visible {
|
|
40
|
-
outline: none;
|
|
41
|
-
}
|
|
42
|
-
|
|
44
|
+
line-height: 26px;
|
|
45
|
+
// border-radius: @border-radius-base 0 0 @border-radius-base;
|
|
46
|
+
outline: none;
|
|
43
47
|
&:empty:before {
|
|
44
|
-
content:
|
|
48
|
+
content: attr(data-placeholder);
|
|
45
49
|
font-size: 12px;
|
|
46
50
|
color: rgba(0, 0, 0, 0.45);
|
|
47
51
|
line-height: 20px;
|
|
48
52
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
&:empty + .close-all-icon{
|
|
54
|
+
display: none;
|
|
55
|
+
}
|
|
56
|
+
&:not(.syntax-error):focus:before { // 需要排除掉syntax-error的样式不然报错内容丢失
|
|
57
|
+
content: ""; // 不能为none,否则placeholder不显示
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
.tag-box {
|
|
55
61
|
position: relative;
|
|
56
62
|
background: #FFFFFF;
|
|
57
|
-
border:
|
|
63
|
+
border: @border-width-base @border-style-base #E3E3E3;
|
|
58
64
|
border-radius: 2px;
|
|
59
|
-
height:
|
|
60
|
-
line-height:
|
|
65
|
+
height: 20px;
|
|
66
|
+
line-height: 18px;
|
|
61
67
|
display: inline-block;
|
|
62
68
|
margin-right: 2px;
|
|
63
|
-
padding-right:
|
|
64
|
-
// margin-top: -1px;
|
|
69
|
+
padding-right: 5px;
|
|
65
70
|
|
|
66
71
|
.tag-con {
|
|
67
72
|
display: inline-block;
|
|
68
|
-
height:
|
|
69
|
-
line-height:
|
|
73
|
+
height: 18px;
|
|
74
|
+
line-height: 18px;
|
|
70
75
|
|
|
71
76
|
&:first-child {
|
|
72
|
-
padding-left:
|
|
77
|
+
padding-left:5px;
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
|
|
@@ -78,7 +83,7 @@
|
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
.tag-con-key-last {
|
|
81
|
-
padding-right:
|
|
86
|
+
padding-right: 2px;
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
.tag-con-keyword {
|
|
@@ -91,16 +96,27 @@
|
|
|
91
96
|
|
|
92
97
|
.tag-con-match {
|
|
93
98
|
color: #FA8C16;
|
|
99
|
+
padding-left: 2px;
|
|
100
|
+
}
|
|
101
|
+
&:not(.syntax-error):has(.tag-con-keyword_AND_OR:only-child){
|
|
102
|
+
border-color: transparent;
|
|
94
103
|
}
|
|
95
104
|
}
|
|
96
105
|
}
|
|
106
|
+
&.aggregate-search-text-wrapper{
|
|
107
|
+
.aggregate-search-input{
|
|
108
|
+
line-height: 20px;
|
|
109
|
+
padding-top: 3px;
|
|
110
|
+
padding-bottom: 3px;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
97
113
|
}
|
|
98
114
|
|
|
99
115
|
|
|
100
116
|
.syntax-error {
|
|
101
117
|
// 语法错误,高亮样式
|
|
102
|
-
border:
|
|
103
|
-
|
|
118
|
+
border: @border-width-base @border-style-base @red-5 !important;
|
|
119
|
+
box-shadow: none !important;
|
|
104
120
|
&:hover {
|
|
105
121
|
|
|
106
122
|
// 伪类展示属性值
|
|
@@ -113,11 +129,12 @@
|
|
|
113
129
|
height: 20px;
|
|
114
130
|
line-height: 20px;
|
|
115
131
|
background: #FFF1F0;
|
|
116
|
-
border:
|
|
132
|
+
border: @border-width-base @border-style-base @red-5;
|
|
117
133
|
border-radius: 0 0 2px 2px;
|
|
118
134
|
font-size: 12px;
|
|
119
|
-
color:
|
|
135
|
+
color: @red-5;
|
|
120
136
|
padding: 0 10px;
|
|
137
|
+
min-width: 100px;
|
|
121
138
|
}
|
|
122
139
|
}
|
|
123
140
|
}
|
|
@@ -122,9 +122,13 @@ export var genHtmlAndSyntaxCheckResByString = function genHtmlAndSyntaxCheckResB
|
|
|
122
122
|
var hasMatch = matchIndex !== -1;
|
|
123
123
|
html = tokenList.map(function (token, index) {
|
|
124
124
|
var genClassName = function genClassName(typeClass) {
|
|
125
|
-
return classNames(
|
|
126
|
-
"tag-con": true
|
|
127
|
-
|
|
125
|
+
return classNames(typeClass, {
|
|
126
|
+
"tag-con": true,
|
|
127
|
+
// [typeClass]: true,
|
|
128
|
+
"tag-con-key": hasMatch ? index < matchIndex : false,
|
|
129
|
+
"tag-con-key-last": matchIndex ? index === matchIndex - 1 : false,
|
|
130
|
+
"tag-con-value": hasMatch ? index > matchIndex : false
|
|
131
|
+
});
|
|
128
132
|
};
|
|
129
133
|
var genDataType = function genDataType(index) {
|
|
130
134
|
if (hasMatch) {
|
|
@@ -139,7 +143,7 @@ export var genHtmlAndSyntaxCheckResByString = function genHtmlAndSyntaxCheckResB
|
|
|
139
143
|
return "key";
|
|
140
144
|
};
|
|
141
145
|
var dataType = genDataType(index);
|
|
142
|
-
var getEleProps = function getEleProps(type) {
|
|
146
|
+
var getEleProps = function getEleProps(type, text) {
|
|
143
147
|
var typeMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, TOKEN_TYPES.MATCH, {
|
|
144
148
|
tagName: "span",
|
|
145
149
|
props: {
|
|
@@ -150,7 +154,7 @@ export var genHtmlAndSyntaxCheckResByString = function genHtmlAndSyntaxCheckResB
|
|
|
150
154
|
}), TOKEN_TYPES.KEYWORD, {
|
|
151
155
|
tagName: "span",
|
|
152
156
|
props: {
|
|
153
|
-
"class": genClassName("tag-con-keyword"),
|
|
157
|
+
"class": genClassName(text === "AND" || text === "OR" ? "tag-con-keyword tag-con-keyword_AND_OR" : "tag-con-keyword"),
|
|
154
158
|
"data-attr": "keyword",
|
|
155
159
|
"data-type": dataType
|
|
156
160
|
}
|
|
@@ -173,7 +177,7 @@ export var genHtmlAndSyntaxCheckResByString = function genHtmlAndSyntaxCheckResB
|
|
|
173
177
|
};
|
|
174
178
|
var type = token.type,
|
|
175
179
|
text = token.text;
|
|
176
|
-
var curProps = getEleProps(type);
|
|
180
|
+
var curProps = getEleProps(type, text);
|
|
177
181
|
var elePropsString = Object.entries(curProps.props).map(function (_ref) {
|
|
178
182
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
179
183
|
key = _ref2[0],
|