@alicloud/console-components-search 0.2.2 → 0.2.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.
- package/README.md +1 -1
- package/demos/demo1.demo.tsx +9 -3
- package/doc-dist/0.js +10 -10
- package/doc-dist/1.js +4 -4
- package/doc-dist/10.js +1 -1
- package/doc-dist/11.js +1 -1
- package/doc-dist/12.js +1 -1
- package/doc-dist/13.js +1 -1
- package/doc-dist/14.js +1 -1
- package/doc-dist/15.js +1 -1
- package/doc-dist/3.js +5 -5
- package/doc-dist/4.js +1 -1
- package/doc-dist/5.js +2 -2
- package/doc-dist/6.js +1 -1
- package/doc-dist/7.js +1 -1
- package/doc-dist/8.js +1 -1
- package/doc-dist/9.js +1 -1
- package/doc-dist/deps/main.css +1 -1
- package/doc-dist/deps/main.js +4 -4
- package/doc-dist/deps/main.os.css +1 -1
- package/doc-dist/index.js +3 -3
- package/doc-dist/log-deps-build.log +1 -1
- package/es/{modeSingleSingle → ComplexSearch}/InputPrefix.js +7 -0
- package/es/{modeSingleSingle/index2.js → ComplexSearch/index.js} +2 -3
- package/es/search.js +1 -1
- package/es/searchTagList/index.js +75 -22
- package/es/style.js +1 -1
- package/lib/{modeSingleSingle → ComplexSearch}/InputPrefix.d.ts +0 -0
- package/lib/{modeSingleSingle → ComplexSearch}/InputPrefix.js +7 -0
- package/lib/{modeSingleSingle/index2.d.ts → ComplexSearch/index.d.ts} +0 -0
- package/lib/{modeSingleSingle/index2.js → ComplexSearch/index.js} +2 -3
- package/lib/search.js +2 -2
- package/lib/searchTagList/index.js +76 -22
- package/lib/style.js +1 -1
- package/lib/types/IRcSearchTagItemProps.type.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
开始构建微应用external依赖...
|
|
2
2
|
BreezrPluginStyledComponentsIsolation The plugin will trying to use the package's name as isolation id of styled-components. This behavior usually occurred on dev mode. And if you were received this warning on publish mode then you should to set `options.styledComponentStyleSheetId` implicitly.
|
|
3
3
|
ℹ Compiling Webpack
|
|
4
|
-
✔ Webpack: Compiled successfully in 12.
|
|
4
|
+
✔ Webpack: Compiled successfully in 12.59s
|
|
5
5
|
WARN asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
|
|
6
6
|
This can impact web performance.
|
|
7
7
|
Assets:
|
|
@@ -22,6 +22,13 @@ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
|
|
|
22
22
|
className: classNames('condition-select'),
|
|
23
23
|
hasBorder: false,
|
|
24
24
|
dataSource: dataSource,
|
|
25
|
+
itemRender: function itemRender(_ref) {
|
|
26
|
+
var label = _ref.label,
|
|
27
|
+
value = _ref.value;
|
|
28
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
29
|
+
"data-value": value
|
|
30
|
+
}, label);
|
|
31
|
+
},
|
|
25
32
|
autoWidth: true
|
|
26
33
|
}, reset)));
|
|
27
34
|
};
|
|
@@ -124,8 +124,7 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
124
124
|
var field = Field.useField();
|
|
125
125
|
var init = field.init,
|
|
126
126
|
getValue = field.getValue,
|
|
127
|
-
reset = field.reset
|
|
128
|
-
getError = field.getError;
|
|
127
|
+
reset = field.reset;
|
|
129
128
|
var focusProps = {
|
|
130
129
|
onFocus: function onFocus() {
|
|
131
130
|
setFocused(true);
|
|
@@ -307,7 +306,7 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
307
306
|
}, /*#__PURE__*/React.createElement("span", {
|
|
308
307
|
className: "".concat(prefix, "input-hint-wrap")
|
|
309
308
|
}, /*#__PURE__*/React.createElement("i", {
|
|
310
|
-
className: "".concat(prefix, "icon ").concat(prefix, "icon-delete-filling ").concat(prefix, "
|
|
309
|
+
className: "".concat(prefix, "icon ").concat(prefix, "icon-delete-filling ").concat(prefix, "input-hint ").concat(prefix, "input-clear-icon"),
|
|
311
310
|
role: "button",
|
|
312
311
|
"aria-label": "\u6E05\u9664",
|
|
313
312
|
onClick: function onClick() {
|
package/es/search.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import ComplexSearch from "./modeSingleSingle/index2";
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import styled from "styled-components";
|
|
5
4
|
import { baseClassName } from './constants';
|
|
5
|
+
import ComplexSearch from "./ComplexSearch/index";
|
|
6
6
|
import LoggerProvider from './provider/LoggerProvider';
|
|
7
7
|
var SearchWrap = styled.div.withConfig({
|
|
8
8
|
componentId: "sc-1szhzw4-0"
|
|
@@ -1,12 +1,32 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
|
|
2
8
|
import React from "react";
|
|
3
9
|
import classNames from 'classnames';
|
|
4
10
|
import { ConfigProvider, Tag } from '@alicloud/console-components';
|
|
5
11
|
import { TagListWrap } from '../style';
|
|
6
12
|
import { baseTagListClassName } from '../constants';
|
|
13
|
+
import isArray from 'lodash/isArray';
|
|
7
14
|
import PureTag from "./PureTag";
|
|
8
15
|
var TagGroup = Tag.Group,
|
|
9
16
|
ClosableTag = Tag.Closeable;
|
|
17
|
+
/**
|
|
18
|
+
* 判断是否是 标签 的数据结构
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
var isTagLikeDataStructure = function isTagLikeDataStructure(value) {
|
|
22
|
+
var isTag = !!value.tagKey;
|
|
23
|
+
|
|
24
|
+
if (isArray(value)) {
|
|
25
|
+
return value[0] && !!value[0].tagKey;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return isTag;
|
|
29
|
+
};
|
|
10
30
|
|
|
11
31
|
var SearchTagList = function SearchTagList(props) {
|
|
12
32
|
var dataSource = props.dataSource,
|
|
@@ -17,7 +37,7 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
17
37
|
_props$prefix = props.prefix,
|
|
18
38
|
prefix = _props$prefix === void 0 ? "next-" : _props$prefix;
|
|
19
39
|
|
|
20
|
-
function
|
|
40
|
+
var onRemoveFilter = function onRemoveFilter(item) {
|
|
21
41
|
var newTagList = _toConsumableArray(dataSource);
|
|
22
42
|
|
|
23
43
|
if (onChange) {
|
|
@@ -27,33 +47,66 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
27
47
|
var deletedTags = newTagList.splice(resFindIndex, 1);
|
|
28
48
|
onChange(deletedTags[0], newTagList);
|
|
29
49
|
}
|
|
30
|
-
}
|
|
50
|
+
};
|
|
31
51
|
|
|
32
|
-
function
|
|
52
|
+
var onRemoveAllFilter = function onRemoveAllFilter() {
|
|
33
53
|
if (onClear) {
|
|
34
54
|
onClear();
|
|
35
55
|
}
|
|
36
|
-
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var onRemoveTag = function onRemoveTag(item, tag) {
|
|
59
|
+
var newDataSource = _toConsumableArray(dataSource);
|
|
60
|
+
|
|
61
|
+
if (onChange) {
|
|
62
|
+
var resFindIndex = item.value.findIndex(function (x) {
|
|
63
|
+
return x.tagKey === tag.tagKey && x.tagValue === tag.tagValue;
|
|
64
|
+
});
|
|
65
|
+
var deletedTags = item.value.splice(resFindIndex, 1);
|
|
66
|
+
onChange(_objectSpread(_objectSpread({}, item), {}, {
|
|
67
|
+
value: deletedTags
|
|
68
|
+
}), newDataSource);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var renderTags = function renderTags(tagItem) {
|
|
73
|
+
var value = tagItem.value;
|
|
74
|
+
|
|
75
|
+
if (isArray(value)) {
|
|
76
|
+
return value.map(function (t) {
|
|
77
|
+
return /*#__PURE__*/React.createElement(PureTag, {
|
|
78
|
+
showLabel: true,
|
|
79
|
+
key: "".concat(t.tagKey, "-").concat(t.tagValue),
|
|
80
|
+
tagKey: t.tagKey,
|
|
81
|
+
tagValue: t.tagValue,
|
|
82
|
+
closable: true,
|
|
83
|
+
onClose: function onClose() {
|
|
84
|
+
onRemoveTag(tagItem, t);
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return /*#__PURE__*/React.createElement(PureTag, {
|
|
92
|
+
showLabel: true,
|
|
93
|
+
tagKey: value.tagKey,
|
|
94
|
+
tagValue: value.tagValue,
|
|
95
|
+
closable: true,
|
|
96
|
+
onClose: function onClose() {
|
|
97
|
+
onRemoveFilter(tagItem);
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
};
|
|
37
102
|
|
|
38
103
|
return /*#__PURE__*/React.createElement(TagListWrap, {
|
|
39
104
|
prefix: prefix,
|
|
40
105
|
className: classNames(baseTagListClassName, className),
|
|
41
106
|
style: style
|
|
42
107
|
}, /*#__PURE__*/React.createElement(TagGroup, null, dataSource && dataSource.length > 0 && dataSource.map(function (tagItem) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (isTag) {
|
|
47
|
-
return /*#__PURE__*/React.createElement(PureTag, {
|
|
48
|
-
showLabel: true,
|
|
49
|
-
tagKey: value.tagKey,
|
|
50
|
-
tagValue: value.tagKey,
|
|
51
|
-
closable: true,
|
|
52
|
-
onClose: function onClose() {
|
|
53
|
-
onRemoveTag(tagItem);
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
108
|
+
if (isTagLikeDataStructure(tagItem.value)) {
|
|
109
|
+
return renderTags(tagItem);
|
|
57
110
|
}
|
|
58
111
|
|
|
59
112
|
return /*#__PURE__*/React.createElement(ClosableTag, {
|
|
@@ -62,15 +115,15 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
62
115
|
type: "normal",
|
|
63
116
|
size: "medium",
|
|
64
117
|
onClose: function onClose() {
|
|
65
|
-
|
|
118
|
+
onRemoveFilter(tagItem);
|
|
66
119
|
return true;
|
|
67
120
|
}
|
|
68
|
-
}, /*#__PURE__*/React.createElement("label", {
|
|
121
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("label", {
|
|
69
122
|
className: "console-tags-tag-label"
|
|
70
|
-
}, tagItem.label), tagItem.
|
|
123
|
+
}, tagItem.label), tagItem.valueLabel || tagItem.value));
|
|
71
124
|
}), dataSource && dataSource.length > 0 && /*#__PURE__*/React.createElement("a", {
|
|
72
125
|
className: "remove-btn",
|
|
73
|
-
onClick:
|
|
126
|
+
onClick: onRemoveAllFilter
|
|
74
127
|
}, "\u6E05\u9664\u7B5B\u9009\u6761\u4EF6")));
|
|
75
128
|
};
|
|
76
129
|
|
package/es/style.js
CHANGED
|
@@ -6,7 +6,7 @@ var prefix = function prefix(props) {
|
|
|
6
6
|
|
|
7
7
|
var SearchWarp = styled.div.withConfig({
|
|
8
8
|
componentId: "sc-1afc1cn-0"
|
|
9
|
-
})(["height:100%;width:100%;display:flex;.left-wrap{flex:1;border-left:1px solid rgba(192,198,204,1);border-bottom:1px solid rgba(192,198,204,1);border-top:1px solid rgba(192,198,204,1);border-right:1px solid rgba(192,198,204,1);display:flex;border-bottom-left-radius:2px;border-top-left-radius:2px;&.focus{border:1px solid #0064c8;border:1px solid var(--input-focus-border-color,#0064c8);;border-right:1px solid rgba(192,198,204,1);}.condition{height:26px;display:inline-block;margin-top:2px;}.condition-item{height:26px;display:inline-block;line-height:26px;background:#EFF3F8;border-radius:2px;background-color:#EFF3F8;padding:0 8px;margin:0 2px;font-size:12px;color:#333;position:relative;&-txt{padding-right:4px;}&:hover{background-color:#E0E4E8;}}.condition-select{width:100%;height:100%;opacity:0;position:absolute;top:0;left:0;min-width:auto;", "select-inner{min-width:auto;}}.forms{flex:1;position:relative;.clear-level1{position:absolute;top:1px;right:1px;height:28px;width:30px;background-color:#fff;z-index:99;color:#333;text-align:center;line-height:28px;font-size:12px;cursor:pointer;padding:6px 0 0 6px;}}.main-input{height:auto;border:none;box-shadow:none;&.single{flex:1;}&.select{width:100%;}&.multi{width:100%;}", "input,", "input{height:auto;box-shadow:none;}}", "input", "medium{height:auto;}}.right-wrap{width:32px;.search-btn{width:32px;padding:0 !important;border-bottom-left-radius:0;border-top-left-radius:0;&.focus{border-color:#0064c8;border-color:var(--input-focus-border-color,#0064c8);}border-left:none;}}"], prefix, prefix, prefix, prefix, prefix);
|
|
9
|
+
})(["height:100%;width:100%;display:flex;.left-wrap{flex:1;border-left:1px solid rgba(192,198,204,1);border-bottom:1px solid rgba(192,198,204,1);border-top:1px solid rgba(192,198,204,1);border-right:1px solid rgba(192,198,204,1);display:flex;border-bottom-left-radius:var(--corner-1,2px);border-top-left-radius:var(--corner-1,2px);&.focus{border:1px solid #0064c8;border:1px solid var(--input-focus-border-color,#0064c8);;border-right:1px solid rgba(192,198,204,1);}.condition{height:26px;display:inline-block;margin-top:2px;}.condition-item{height:26px;display:inline-block;line-height:26px;background:#EFF3F8;border-radius:var(--corner-1,2px);background-color:#EFF3F8;padding:0 8px;margin:0 2px;font-size:12px;color:#333;position:relative;&-txt{padding-right:4px;}&:hover{background-color:#E0E4E8;}}.condition-select{width:100%;height:100%;opacity:0;position:absolute;top:0;left:0;min-width:auto;", "select-inner{min-width:auto;}}.forms{flex:1;position:relative;.clear-level1{position:absolute;top:1px;right:1px;height:28px;width:30px;background-color:#fff;z-index:99;color:#333;text-align:center;line-height:28px;font-size:12px;cursor:pointer;padding:6px 0 0 6px;}}.main-input{height:auto;border:none;box-shadow:none;&.single{flex:1;}&.select{width:100%;}&.multi{width:100%;}", "input,", "input{height:auto;box-shadow:none;}}", "input", "medium{height:auto;}}.right-wrap{width:32px;.search-btn{width:32px;padding:0 !important;border-bottom-left-radius:0;border-top-left-radius:0;&.focus{border-color:#0064c8;border-color:var(--input-focus-border-color,#0064c8);}border-left:none;}}"], prefix, prefix, prefix, prefix, prefix);
|
|
10
10
|
var MenuContentWrap = styled.ul.withConfig({
|
|
11
11
|
componentId: "sc-1afc1cn-1"
|
|
12
12
|
})(["", "tag-small", "tag-closable > ", "tag-close-btn{margin-left:8px;padding-right:4px;padding-top:1px;}", "tag-small", "tag-closable > ", "tag-body{max-width:calc(100% - 8px - 8px - var(--tag-size-m-padding-lr,8px));}", "tag-small", "tag-closable > ", "tag-close-btn ", "icon:before,", "tag-small", "tag-closable > ", "tag-close-btn ", "icon ", "icon-remote{font-size:13px;}&& [class*='-icon-close']:hover::before{color:#181818;}&& [class*='-icon-close']::before{color:#808080;content:var(--icon-content-delete-filling);}"], prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix);
|
|
File without changes
|
|
@@ -35,6 +35,13 @@ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
|
|
|
35
35
|
className: (0, _classnames.default)('condition-select'),
|
|
36
36
|
hasBorder: false,
|
|
37
37
|
dataSource: dataSource,
|
|
38
|
+
itemRender: function itemRender(_ref) {
|
|
39
|
+
var label = _ref.label,
|
|
40
|
+
value = _ref.value;
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
42
|
+
"data-value": value
|
|
43
|
+
}, label);
|
|
44
|
+
},
|
|
38
45
|
autoWidth: true
|
|
39
46
|
}, reset)));
|
|
40
47
|
};
|
|
File without changes
|
|
@@ -153,8 +153,7 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
153
153
|
|
|
154
154
|
var init = field.init,
|
|
155
155
|
getValue = field.getValue,
|
|
156
|
-
reset = field.reset
|
|
157
|
-
getError = field.getError;
|
|
156
|
+
reset = field.reset;
|
|
158
157
|
var focusProps = {
|
|
159
158
|
onFocus: function onFocus() {
|
|
160
159
|
setFocused(true);
|
|
@@ -336,7 +335,7 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
336
335
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
337
336
|
className: "".concat(prefix, "input-hint-wrap")
|
|
338
337
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
339
|
-
className: "".concat(prefix, "icon ").concat(prefix, "icon-delete-filling ").concat(prefix, "
|
|
338
|
+
className: "".concat(prefix, "icon ").concat(prefix, "icon-delete-filling ").concat(prefix, "input-hint ").concat(prefix, "input-clear-icon"),
|
|
340
339
|
role: "button",
|
|
341
340
|
"aria-label": "\u6E05\u9664",
|
|
342
341
|
onClick: function onClick() {
|
package/lib/search.js
CHANGED
|
@@ -9,14 +9,14 @@ exports.Search = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
|
-
var _index = _interopRequireDefault(require("./modeSingleSingle/index2"));
|
|
13
|
-
|
|
14
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
13
|
|
|
16
14
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
17
15
|
|
|
18
16
|
var _constants = require("./constants");
|
|
19
17
|
|
|
18
|
+
var _index = _interopRequireDefault(require("./ComplexSearch/index"));
|
|
19
|
+
|
|
20
20
|
var _LoggerProvider = _interopRequireDefault(require("./provider/LoggerProvider"));
|
|
21
21
|
|
|
22
22
|
var SearchWrap = _styledComponents.default.div.withConfig({
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
10
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
13
|
|
|
12
14
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -19,10 +21,29 @@ var _style = require("../style");
|
|
|
19
21
|
|
|
20
22
|
var _constants = require("../constants");
|
|
21
23
|
|
|
24
|
+
var _isArray = _interopRequireDefault(require("lodash/isArray"));
|
|
25
|
+
|
|
22
26
|
var _PureTag = _interopRequireDefault(require("./PureTag"));
|
|
23
27
|
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
|
+
|
|
24
32
|
var TagGroup = _consoleComponents.Tag.Group,
|
|
25
33
|
ClosableTag = _consoleComponents.Tag.Closeable;
|
|
34
|
+
/**
|
|
35
|
+
* 判断是否是 标签 的数据结构
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
var isTagLikeDataStructure = function isTagLikeDataStructure(value) {
|
|
39
|
+
var isTag = !!value.tagKey;
|
|
40
|
+
|
|
41
|
+
if ((0, _isArray.default)(value)) {
|
|
42
|
+
return value[0] && !!value[0].tagKey;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return isTag;
|
|
46
|
+
};
|
|
26
47
|
|
|
27
48
|
var SearchTagList = function SearchTagList(props) {
|
|
28
49
|
var dataSource = props.dataSource,
|
|
@@ -33,7 +54,7 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
33
54
|
_props$prefix = props.prefix,
|
|
34
55
|
prefix = _props$prefix === void 0 ? "next-" : _props$prefix;
|
|
35
56
|
|
|
36
|
-
function
|
|
57
|
+
var onRemoveFilter = function onRemoveFilter(item) {
|
|
37
58
|
var newTagList = (0, _toConsumableArray2.default)(dataSource);
|
|
38
59
|
|
|
39
60
|
if (onChange) {
|
|
@@ -43,33 +64,66 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
43
64
|
var deletedTags = newTagList.splice(resFindIndex, 1);
|
|
44
65
|
onChange(deletedTags[0], newTagList);
|
|
45
66
|
}
|
|
46
|
-
}
|
|
67
|
+
};
|
|
47
68
|
|
|
48
|
-
function
|
|
69
|
+
var onRemoveAllFilter = function onRemoveAllFilter() {
|
|
49
70
|
if (onClear) {
|
|
50
71
|
onClear();
|
|
51
72
|
}
|
|
52
|
-
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var onRemoveTag = function onRemoveTag(item, tag) {
|
|
76
|
+
var newDataSource = (0, _toConsumableArray2.default)(dataSource);
|
|
77
|
+
|
|
78
|
+
if (onChange) {
|
|
79
|
+
var resFindIndex = item.value.findIndex(function (x) {
|
|
80
|
+
return x.tagKey === tag.tagKey && x.tagValue === tag.tagValue;
|
|
81
|
+
});
|
|
82
|
+
var deletedTags = item.value.splice(resFindIndex, 1);
|
|
83
|
+
onChange(_objectSpread(_objectSpread({}, item), {}, {
|
|
84
|
+
value: deletedTags
|
|
85
|
+
}), newDataSource);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
var renderTags = function renderTags(tagItem) {
|
|
90
|
+
var value = tagItem.value;
|
|
91
|
+
|
|
92
|
+
if ((0, _isArray.default)(value)) {
|
|
93
|
+
return value.map(function (t) {
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement(_PureTag.default, {
|
|
95
|
+
showLabel: true,
|
|
96
|
+
key: "".concat(t.tagKey, "-").concat(t.tagValue),
|
|
97
|
+
tagKey: t.tagKey,
|
|
98
|
+
tagValue: t.tagValue,
|
|
99
|
+
closable: true,
|
|
100
|
+
onClose: function onClose() {
|
|
101
|
+
onRemoveTag(tagItem, t);
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return /*#__PURE__*/_react.default.createElement(_PureTag.default, {
|
|
109
|
+
showLabel: true,
|
|
110
|
+
tagKey: value.tagKey,
|
|
111
|
+
tagValue: value.tagValue,
|
|
112
|
+
closable: true,
|
|
113
|
+
onClose: function onClose() {
|
|
114
|
+
onRemoveFilter(tagItem);
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
};
|
|
53
119
|
|
|
54
120
|
return /*#__PURE__*/_react.default.createElement(_style.TagListWrap, {
|
|
55
121
|
prefix: prefix,
|
|
56
122
|
className: (0, _classnames.default)(_constants.baseTagListClassName, className),
|
|
57
123
|
style: style
|
|
58
124
|
}, /*#__PURE__*/_react.default.createElement(TagGroup, null, dataSource && dataSource.length > 0 && dataSource.map(function (tagItem) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (isTag) {
|
|
63
|
-
return /*#__PURE__*/_react.default.createElement(_PureTag.default, {
|
|
64
|
-
showLabel: true,
|
|
65
|
-
tagKey: value.tagKey,
|
|
66
|
-
tagValue: value.tagKey,
|
|
67
|
-
closable: true,
|
|
68
|
-
onClose: function onClose() {
|
|
69
|
-
onRemoveTag(tagItem);
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
125
|
+
if (isTagLikeDataStructure(tagItem.value)) {
|
|
126
|
+
return renderTags(tagItem);
|
|
73
127
|
}
|
|
74
128
|
|
|
75
129
|
return /*#__PURE__*/_react.default.createElement(ClosableTag, {
|
|
@@ -78,15 +132,15 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
78
132
|
type: "normal",
|
|
79
133
|
size: "medium",
|
|
80
134
|
onClose: function onClose() {
|
|
81
|
-
|
|
135
|
+
onRemoveFilter(tagItem);
|
|
82
136
|
return true;
|
|
83
137
|
}
|
|
84
|
-
}, /*#__PURE__*/_react.default.createElement("label", {
|
|
138
|
+
}, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("label", {
|
|
85
139
|
className: "console-tags-tag-label"
|
|
86
|
-
}, tagItem.label), tagItem.
|
|
140
|
+
}, tagItem.label), tagItem.valueLabel || tagItem.value));
|
|
87
141
|
}), dataSource && dataSource.length > 0 && /*#__PURE__*/_react.default.createElement("a", {
|
|
88
142
|
className: "remove-btn",
|
|
89
|
-
onClick:
|
|
143
|
+
onClick: onRemoveAllFilter
|
|
90
144
|
}, "\u6E05\u9664\u7B5B\u9009\u6761\u4EF6")));
|
|
91
145
|
};
|
|
92
146
|
|
package/lib/style.js
CHANGED
|
@@ -15,7 +15,7 @@ var prefix = function prefix(props) {
|
|
|
15
15
|
|
|
16
16
|
var SearchWarp = _styledComponents.default.div.withConfig({
|
|
17
17
|
componentId: "sc-1afc1cn-0"
|
|
18
|
-
})(["height:100%;width:100%;display:flex;.left-wrap{flex:1;border-left:1px solid rgba(192,198,204,1);border-bottom:1px solid rgba(192,198,204,1);border-top:1px solid rgba(192,198,204,1);border-right:1px solid rgba(192,198,204,1);display:flex;border-bottom-left-radius:2px;border-top-left-radius:2px;&.focus{border:1px solid #0064c8;border:1px solid var(--input-focus-border-color,#0064c8);;border-right:1px solid rgba(192,198,204,1);}.condition{height:26px;display:inline-block;margin-top:2px;}.condition-item{height:26px;display:inline-block;line-height:26px;background:#EFF3F8;border-radius:2px;background-color:#EFF3F8;padding:0 8px;margin:0 2px;font-size:12px;color:#333;position:relative;&-txt{padding-right:4px;}&:hover{background-color:#E0E4E8;}}.condition-select{width:100%;height:100%;opacity:0;position:absolute;top:0;left:0;min-width:auto;", "select-inner{min-width:auto;}}.forms{flex:1;position:relative;.clear-level1{position:absolute;top:1px;right:1px;height:28px;width:30px;background-color:#fff;z-index:99;color:#333;text-align:center;line-height:28px;font-size:12px;cursor:pointer;padding:6px 0 0 6px;}}.main-input{height:auto;border:none;box-shadow:none;&.single{flex:1;}&.select{width:100%;}&.multi{width:100%;}", "input,", "input{height:auto;box-shadow:none;}}", "input", "medium{height:auto;}}.right-wrap{width:32px;.search-btn{width:32px;padding:0 !important;border-bottom-left-radius:0;border-top-left-radius:0;&.focus{border-color:#0064c8;border-color:var(--input-focus-border-color,#0064c8);}border-left:none;}}"], prefix, prefix, prefix, prefix, prefix);
|
|
18
|
+
})(["height:100%;width:100%;display:flex;.left-wrap{flex:1;border-left:1px solid rgba(192,198,204,1);border-bottom:1px solid rgba(192,198,204,1);border-top:1px solid rgba(192,198,204,1);border-right:1px solid rgba(192,198,204,1);display:flex;border-bottom-left-radius:var(--corner-1,2px);border-top-left-radius:var(--corner-1,2px);&.focus{border:1px solid #0064c8;border:1px solid var(--input-focus-border-color,#0064c8);;border-right:1px solid rgba(192,198,204,1);}.condition{height:26px;display:inline-block;margin-top:2px;}.condition-item{height:26px;display:inline-block;line-height:26px;background:#EFF3F8;border-radius:var(--corner-1,2px);background-color:#EFF3F8;padding:0 8px;margin:0 2px;font-size:12px;color:#333;position:relative;&-txt{padding-right:4px;}&:hover{background-color:#E0E4E8;}}.condition-select{width:100%;height:100%;opacity:0;position:absolute;top:0;left:0;min-width:auto;", "select-inner{min-width:auto;}}.forms{flex:1;position:relative;.clear-level1{position:absolute;top:1px;right:1px;height:28px;width:30px;background-color:#fff;z-index:99;color:#333;text-align:center;line-height:28px;font-size:12px;cursor:pointer;padding:6px 0 0 6px;}}.main-input{height:auto;border:none;box-shadow:none;&.single{flex:1;}&.select{width:100%;}&.multi{width:100%;}", "input,", "input{height:auto;box-shadow:none;}}", "input", "medium{height:auto;}}.right-wrap{width:32px;.search-btn{width:32px;padding:0 !important;border-bottom-left-radius:0;border-top-left-radius:0;&.focus{border-color:#0064c8;border-color:var(--input-focus-border-color,#0064c8);}border-left:none;}}"], prefix, prefix, prefix, prefix, prefix);
|
|
19
19
|
|
|
20
20
|
exports.SearchWarp = SearchWarp;
|
|
21
21
|
|