@alicloud/console-components-search 0.2.34 → 0.2.35
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/LICENSE +21 -0
- package/es/ComplexSearch/InputPrefix.js +6 -9
- package/es/ComplexSearch/index.js +46 -84
- package/es/constants.js +3 -1
- package/es/index.js +4 -4
- package/es/message.js +16 -17
- package/es/search.js +11 -18
- package/es/searchTagList/PureTag.js +10 -15
- package/es/searchTagList/index.js +16 -37
- package/es/style.js +13 -11
- package/es/types/IRcSearchOptions.type.js +1 -0
- package/es/types/IRcSearchProps.type.js +1 -0
- package/es/types/IRcSearchTagItemProps.type.js +1 -0
- package/es/types/IRcSearchTagListProps.type.js +1 -0
- package/es/useCssVar.js +6 -11
- package/es/utils.js +9 -41
- package/lib/ComplexSearch/InputPrefix.d.ts +2 -2
- package/lib/ComplexSearch/InputPrefix.js +7 -16
- package/lib/ComplexSearch/index.js +50 -107
- package/lib/constants.js +7 -9
- package/lib/index.d.ts +5 -5
- package/lib/index.js +10 -17
- package/lib/message.js +17 -22
- package/lib/search.d.ts +2 -2
- package/lib/search.js +9 -28
- package/lib/searchTagList/PureTag.js +11 -23
- package/lib/searchTagList/index.d.ts +1 -1
- package/lib/searchTagList/index.js +12 -48
- package/lib/style.d.ts +1 -1
- package/lib/style.js +13 -24
- package/lib/types/IRcSearchOptions.type.d.ts +13 -13
- package/lib/types/IRcSearchOptions.type.js +5 -1
- package/lib/types/IRcSearchProps.type.d.ts +2 -2
- package/lib/types/IRcSearchProps.type.js +5 -1
- package/lib/types/IRcSearchTagItemProps.type.js +5 -1
- package/lib/types/IRcSearchTagListProps.type.js +5 -1
- package/lib/useCssVar.js +6 -19
- package/lib/utils.d.ts +1 -3
- package/lib/utils.js +18 -72
- package/package.json +19 -16
- package/dist/index.css +0 -73
- package/dist/index.js +0 -135349
- package/doc-dist/0.js +0 -2094
- package/doc-dist/1.js +0 -27
- package/doc-dist/10.js +0 -6
- package/doc-dist/11.js +0 -6
- package/doc-dist/12.js +0 -6
- package/doc-dist/13.js +0 -6
- package/doc-dist/14.js +0 -6
- package/doc-dist/15.js +0 -6
- package/doc-dist/16.js +0 -6
- package/doc-dist/3.js +0 -89
- package/doc-dist/4.js +0 -6
- package/doc-dist/5.js +0 -13
- package/doc-dist/6.css +0 -1
- package/doc-dist/6.js +0 -6
- package/doc-dist/6.os.css +0 -1
- package/doc-dist/7.js +0 -6
- package/doc-dist/8.js +0 -6
- package/doc-dist/9.js +0 -6
- package/doc-dist/console-fe-test-rc-search-doc.manifest.json +0 -38
- package/doc-dist/deps/console-fe-test-rc-search-doc-deps.manifest.json +0 -33
- package/doc-dist/deps/index.html +0 -14
- package/doc-dist/deps/main.css +0 -1
- package/doc-dist/deps/main.js +0 -103
- package/doc-dist/deps/main.os.css +0 -1
- package/doc-dist/index.css +0 -1
- package/doc-dist/index.html +0 -14
- package/doc-dist/index.js +0 -19
- package/doc-dist/index.os.css +0 -1
- package/doc-dist/log-deps-build.log +0 -19
- package/es/provider/LoggerProvider.js +0 -37
- package/lib/provider/LoggerProvider.d.ts +0 -8
- package/lib/provider/LoggerProvider.js +0 -47
|
@@ -1,39 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
11
|
var _consoleComponents = require("@alicloud/console-components");
|
|
17
|
-
|
|
18
12
|
var _consoleComponentsTruncate = _interopRequireDefault(require("@alicloud/console-components-truncate"));
|
|
19
|
-
|
|
20
13
|
var _message = _interopRequireDefault(require("../message"));
|
|
21
|
-
|
|
14
|
+
var _excluded = ["intl", "tagKey", "disableTruncate", "showDot", "tagValue", "showLabel", "closable"];
|
|
22
15
|
var Empty = function Empty(_ref) {
|
|
23
16
|
var children = _ref.children;
|
|
24
17
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
25
18
|
};
|
|
26
|
-
|
|
27
19
|
var PureTag = function PureTag(props) {
|
|
28
20
|
var intl = props.intl,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
tagKey = props.tagKey,
|
|
22
|
+
disableTruncate = props.disableTruncate,
|
|
23
|
+
showDot = props.showDot,
|
|
24
|
+
tagValue = props.tagValue,
|
|
25
|
+
showLabel = props.showLabel,
|
|
26
|
+
_props$closable = props.closable,
|
|
27
|
+
closable = _props$closable === void 0 ? true : _props$closable,
|
|
28
|
+
resetProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
37
29
|
var defaultTruncateProps = {
|
|
38
30
|
threshold: 20,
|
|
39
31
|
showTooltip: false
|
|
@@ -42,16 +34,14 @@ var PureTag = function PureTag(props) {
|
|
|
42
34
|
var DotWrapper = showDot ? _consoleComponents.Badge : Empty;
|
|
43
35
|
var TagWrapper = closable ? _consoleComponents.Tag.Closeable : _consoleComponents.Tag;
|
|
44
36
|
var transformedTagValue = tagValue;
|
|
45
|
-
|
|
46
37
|
if (tagValue === '') {
|
|
47
38
|
transformedTagValue = _message.default.emptyValue;
|
|
48
39
|
} else if (tagValue === undefined || tagValue === null) {
|
|
49
40
|
transformedTagValue = _message.default.allValue;
|
|
50
41
|
}
|
|
51
|
-
|
|
52
42
|
return (
|
|
53
43
|
/*#__PURE__*/
|
|
54
|
-
|
|
44
|
+
// @ts-ignore
|
|
55
45
|
_react.default.createElement(DotWrapper, {
|
|
56
46
|
className: "search-tags-tag-dot",
|
|
57
47
|
dot: true
|
|
@@ -65,6 +55,4 @@ var PureTag = function PureTag(props) {
|
|
|
65
55
|
}, transformedTagValue)))
|
|
66
56
|
);
|
|
67
57
|
};
|
|
68
|
-
|
|
69
|
-
var _default = PureTag;
|
|
70
|
-
exports.default = _default;
|
|
58
|
+
var _default = exports.default = PureTag;
|
|
@@ -1,68 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
-
|
|
18
12
|
var _consoleComponents = require("@alicloud/console-components");
|
|
19
|
-
|
|
20
|
-
var _style = require("../style");
|
|
21
|
-
|
|
22
|
-
var _constants = require("../constants");
|
|
23
|
-
|
|
24
13
|
var _isArray = _interopRequireDefault(require("lodash/isArray"));
|
|
25
|
-
|
|
26
14
|
var _isObject = _interopRequireDefault(require("lodash/isObject"));
|
|
27
|
-
|
|
15
|
+
var _style = require("../style");
|
|
16
|
+
var _constants = require("../constants");
|
|
28
17
|
var _PureTag = _interopRequireDefault(require("./PureTag"));
|
|
29
|
-
|
|
30
18
|
var _useCssVar = require("../useCssVar");
|
|
31
|
-
|
|
32
19
|
var _message = _interopRequireDefault(require("../message"));
|
|
20
|
+
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; }
|
|
21
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
22
|
+
var ClosableTag = _consoleComponents.Tag.Closeable;
|
|
33
23
|
|
|
34
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
-
|
|
36
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
37
|
-
|
|
38
|
-
var TagGroup = _consoleComponents.Tag.Group,
|
|
39
|
-
ClosableTag = _consoleComponents.Tag.Closeable;
|
|
40
24
|
/**
|
|
41
25
|
* 判断是否是 标签 的数据结构
|
|
42
26
|
*/
|
|
43
|
-
|
|
44
27
|
var isTagLikeDataStructure = function isTagLikeDataStructure(value) {
|
|
45
28
|
var isTag = !!(value !== null && value !== void 0 && value.tagKey);
|
|
46
|
-
|
|
47
29
|
if ((0, _isArray.default)(value)) {
|
|
48
30
|
return value[0] && !!value[0].tagKey;
|
|
49
31
|
}
|
|
50
|
-
|
|
51
32
|
return isTag;
|
|
52
33
|
};
|
|
53
|
-
|
|
54
34
|
var SearchTagList = function SearchTagList(props) {
|
|
55
35
|
var dataSource = props.dataSource,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
36
|
+
className = props.className,
|
|
37
|
+
style = props.style,
|
|
38
|
+
onChange = props.onChange,
|
|
39
|
+
onClear = props.onClear,
|
|
40
|
+
_props$prefix = props.prefix,
|
|
41
|
+
prefix = _props$prefix === void 0 ? 'next-' : _props$prefix;
|
|
63
42
|
var onRemoveFilter = function onRemoveFilter(item) {
|
|
64
43
|
var newTagList = (0, _toConsumableArray2.default)(dataSource);
|
|
65
|
-
|
|
66
44
|
if (onChange) {
|
|
67
45
|
var resFindIndex = newTagList.findIndex(function (x) {
|
|
68
46
|
return x.dataIndex === item.dataIndex;
|
|
@@ -71,22 +49,18 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
71
49
|
onChange(deletedTags[0], newTagList);
|
|
72
50
|
}
|
|
73
51
|
};
|
|
74
|
-
|
|
75
52
|
var onRemoveAllFilter = function onRemoveAllFilter() {
|
|
76
53
|
if (onClear) {
|
|
77
54
|
onClear();
|
|
78
55
|
}
|
|
79
56
|
};
|
|
80
|
-
|
|
81
57
|
var onRemoveTag = function onRemoveTag(item, tag) {
|
|
82
58
|
var newDataSource = (0, _toConsumableArray2.default)(dataSource);
|
|
83
|
-
|
|
84
59
|
if (onChange) {
|
|
85
60
|
var resFindIndex = item.value.findIndex(function (x) {
|
|
86
61
|
return x.tagKey === tag.tagKey && x.tagValue === tag.tagValue;
|
|
87
62
|
});
|
|
88
63
|
var deletedTags = item.value.splice(resFindIndex, 1);
|
|
89
|
-
|
|
90
64
|
if (item.value.length === 0) {
|
|
91
65
|
onRemoveFilter(item);
|
|
92
66
|
} else {
|
|
@@ -96,10 +70,8 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
96
70
|
}
|
|
97
71
|
}
|
|
98
72
|
};
|
|
99
|
-
|
|
100
73
|
var renderTags = function renderTags(tagItem) {
|
|
101
74
|
var value = tagItem.value;
|
|
102
|
-
|
|
103
75
|
if ((0, _isArray.default)(value)) {
|
|
104
76
|
return value.map(function (t) {
|
|
105
77
|
return /*#__PURE__*/_react.default.createElement(_PureTag.default, {
|
|
@@ -115,7 +87,6 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
115
87
|
});
|
|
116
88
|
});
|
|
117
89
|
}
|
|
118
|
-
|
|
119
90
|
return /*#__PURE__*/_react.default.createElement(_PureTag.default, {
|
|
120
91
|
showLabel: true,
|
|
121
92
|
tagKey: value === null || value === void 0 ? void 0 : value.tagKey,
|
|
@@ -127,18 +98,15 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
127
98
|
}
|
|
128
99
|
});
|
|
129
100
|
};
|
|
130
|
-
|
|
131
101
|
var processDataSource = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.filter(function (t) {
|
|
132
102
|
if ((0, _isArray.default)(t === null || t === void 0 ? void 0 : t.value)) {
|
|
133
103
|
// 过滤掉非法的 Tag 节点
|
|
134
104
|
var validValue = t.value.filter(isTagLikeDataStructure);
|
|
135
105
|
if (!validValue.length) return false;
|
|
136
106
|
}
|
|
137
|
-
|
|
138
107
|
if ((0, _isObject.default)(t === null || t === void 0 ? void 0 : t.value)) {
|
|
139
108
|
return isTagLikeDataStructure(t.value);
|
|
140
109
|
}
|
|
141
|
-
|
|
142
110
|
return true;
|
|
143
111
|
})) || [];
|
|
144
112
|
var isWindClass = (0, _useCssVar.useWindTheme)();
|
|
@@ -150,7 +118,6 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
150
118
|
if (isTagLikeDataStructure(tagItem.value)) {
|
|
151
119
|
return renderTags(tagItem);
|
|
152
120
|
}
|
|
153
|
-
|
|
154
121
|
return /*#__PURE__*/_react.default.createElement(ClosableTag, {
|
|
155
122
|
className: "search-tags-tag",
|
|
156
123
|
key: tagItem.dataIndex + tagItem.value,
|
|
@@ -168,7 +135,4 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
168
135
|
onClick: onRemoveAllFilter
|
|
169
136
|
}, _message.default.clearFilter));
|
|
170
137
|
};
|
|
171
|
-
|
|
172
|
-
var _default = _consoleComponents.ConfigProvider.config(SearchTagList);
|
|
173
|
-
|
|
174
|
-
exports.default = _default;
|
|
138
|
+
var _default = exports.default = _consoleComponents.ConfigProvider.config(SearchTagList);
|
package/lib/style.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ declare const MultiBtnWarp: import("styled-components").StyledComponent<"div", a
|
|
|
10
10
|
declare const TagListWrap: import("styled-components").StyledComponent<"div", any, {
|
|
11
11
|
prefix: string;
|
|
12
12
|
}, never>;
|
|
13
|
-
export { SearchWarp, MultiBtnWarp, TagListWrap, MenuContentWrap };
|
|
13
|
+
export { SearchWarp, MultiBtnWarp, TagListWrap, MenuContentWrap, };
|
package/lib/style.js
CHANGED
|
@@ -1,34 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
-
|
|
7
|
+
exports.TagListWrap = exports.SearchWarp = exports.MultiBtnWarp = exports.MenuContentWrap = void 0;
|
|
12
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
15
|
-
|
|
16
9
|
var prefix = function prefix(props) {
|
|
17
10
|
return props.prefix ? ".".concat(props.prefix) : '.next-';
|
|
18
11
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
exports.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var TagListWrap = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n ", "tag-medium", "tag-closable > ", "tag-close-btn {\n margin-left: 8px;\n padding-right: 6px;\n }\n ", "tag-medium", "tag-closable > ", "tag-body {\n max-width: calc(100% - 8px - 8px - var(--tag-size-m-padding-lr, 8px));\n }\n ", "tag-medium", "tag-closable > ", "tag-close-btn ", "icon:before, ", "tag-medium", "tag-closable > ", "tag-close-btn ", "icon ", "icon-remote{\n font-size: 16px;\n }\n && [class*='-icon-close']::before{\n color: #808080;\n font-size: 12px !important;\n }\n .remove-btn{\n line-height: 24px;\n margin-top: 4px;\n display: inline-block;\n vertical-align: middle;\n cursor: pointer;\n }\n"])), prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix);
|
|
33
|
-
|
|
34
|
-
exports.TagListWrap = TagListWrap;
|
|
12
|
+
var SearchWarp = exports.SearchWarp = _styledComponents.default.div.withConfig({
|
|
13
|
+
componentId: "sc-1afc1cn-0"
|
|
14
|
+
})(["height:100%;width:100%;display:flex;--input-clear-icon-transform:1;--input-hint-icon-color:#808080;.left-wrap{flex:1;border:1px solid var(--btn-pure-normal-border-color,#d1d5d9);display:flex;border-bottom-left-radius:var(--corner-1,2px);border-top-left-radius:var(--corner-1,2px);border-right:none;&.focus{border:1px solid #0064c8;border:1px solid var(--input-focus-border-color,#0064c8);;border-right:none;}.condition{height:26px;display:inline-block;margin-top:2px;}.condition-item{height:26px;display:inline-block;line-height:26px;background-color:var(--console-rc-search-label-color,#F7F9FA);:hover{background-color:var(--console-rc-search-label-hover-color,#EFF3F8);}border-radius:var(--corner-1,2px);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;&.rc-search-prefix-no-select{", "input", "disabled{cursor:auto;}}", "select-inner{min-width:auto;}}.forms{flex:1;position:relative;.clear-level1{position:absolute;top:var(--console-rc-search-close-btn-top,1px);right:var(--console-rc-search-close-btn-left,1px);height:28px;width:30px;background-color:transparent;z-index:1;color:#333;text-align:center;line-height:28px;font-size:12px;cursor:pointer;padding:6px 0 0 6px;}}.main-input{", "select-arrow{display:none !important;}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);}}}.isWidget & .right-wrap,.isWind & .right-wrap{.search-btn{&:hover{border-color:#0064c8;border-color:var(--input-focus-border-color,#0064c8);}}}& ", "input-control ", "input-clear-icon::before{content:var(--icon-content-close,\"ea22\") !important;}.isWidget & ", "input-control ", "input-clear-icon::before{content:\"\\E697\" !important;}"], prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix);
|
|
15
|
+
var MenuContentWrap = exports.MenuContentWrap = _styledComponents.default.ul.withConfig({
|
|
16
|
+
componentId: "sc-1afc1cn-1"
|
|
17
|
+
})(["", "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;}"], prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix);
|
|
18
|
+
var MultiBtnWarp = exports.MultiBtnWarp = _styledComponents.default.div.withConfig({
|
|
19
|
+
componentId: "sc-1afc1cn-2"
|
|
20
|
+
})(["padding:\"0 4px\";text-align:\"center\";.pri-btn{margin-right:8px;width:auto;min-width:auto;padding:3px 12px;}.cancel-btn{padding:3px 12px;width:auto;min-width:auto;}", "btn", "small:not(.isOnlyIcon):not(", "btn-text){min-width:auto;}"], prefix, prefix, prefix);
|
|
21
|
+
var TagListWrap = exports.TagListWrap = _styledComponents.default.div.withConfig({
|
|
22
|
+
componentId: "sc-1afc1cn-3"
|
|
23
|
+
})(["", "tag-medium", "tag-closable > ", "tag-close-btn{margin-left:8px;padding-right:6px;}", "tag-medium", "tag-closable > ", "tag-body{max-width:calc(100% - 8px - 8px - var(--tag-size-m-padding-lr,8px));}", "tag-medium", "tag-closable > ", "tag-close-btn ", "icon:before,", "tag-medium", "tag-closable > ", "tag-close-btn ", "icon ", "icon-remote{font-size:16px;}&& [class*='-icon-close']::before{color:#808080;font-size:12px !important;}.remove-btn{line-height:24px;margin-top:4px;display:inline-block;vertical-align:middle;cursor:pointer;}"], prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix);
|
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface IRcSearchOptionsProps {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* 字段展示名称
|
|
7
|
+
*/
|
|
8
8
|
label: string;
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* 字段表单key
|
|
11
|
+
*/
|
|
12
12
|
dataIndex: string;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
* 字段,交互组件类型(input/select/multiple)<br />
|
|
15
|
+
* - input:搜索框<br />
|
|
16
|
+
* - select:单选<br />
|
|
17
|
+
* - multiple:多选<br />
|
|
18
|
+
*/
|
|
19
19
|
template?: string;
|
|
20
20
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
* 定义传给表单项的属性
|
|
22
|
+
* templateProps.placeholder
|
|
23
|
+
* templateProps.dataSource
|
|
24
|
+
*/
|
|
25
25
|
templateProps?: any;
|
|
26
26
|
groupName?: string;
|
|
27
27
|
}
|
package/lib/useCssVar.js
CHANGED
|
@@ -1,57 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.useCssVar = useCssVar;
|
|
9
8
|
exports.useWindTheme = useWindTheme;
|
|
10
|
-
|
|
11
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
-
|
|
13
10
|
var _react = require("react");
|
|
14
|
-
|
|
15
11
|
var _consoleComponents = require("@alicloud/console-components");
|
|
16
|
-
|
|
17
12
|
var nextId = 0;
|
|
18
|
-
|
|
19
13
|
function useCssVar(cssVarName) {
|
|
20
14
|
var _useState = (0, _react.useState)(''),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
16
|
+
v = _useState2[0],
|
|
17
|
+
setV = _useState2[1];
|
|
25
18
|
var refElement = _consoleComponents.ConfigProvider.useRefElement();
|
|
26
|
-
|
|
27
19
|
(0, _react.useLayoutEffect)(function () {
|
|
28
20
|
var _window$__recheck_css;
|
|
21
|
+
check();
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var checkArr = window['__recheck_css_var'] = (_window$__recheck_css = window['__recheck_css_var']) !== null && _window$__recheck_css !== void 0 ? _window$__recheck_css : [];
|
|
33
|
-
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
var checkArr = window.__recheck_css_var = (_window$__recheck_css = window.__recheck_css_var) !== null && _window$__recheck_css !== void 0 ? _window$__recheck_css : [];
|
|
34
25
|
while (checkArr[nextId]) {
|
|
35
26
|
// 如果一个页面下有份此组件库(即有多个nextId指针),需要避免冲突
|
|
36
27
|
nextId++;
|
|
37
28
|
}
|
|
38
|
-
|
|
39
29
|
var id = nextId++;
|
|
40
30
|
checkArr[id] = check;
|
|
41
31
|
return function () {
|
|
42
32
|
delete checkArr[id];
|
|
43
33
|
};
|
|
44
|
-
|
|
45
34
|
function check() {
|
|
46
35
|
var _window$getComputedSt, _window$getComputedSt2, _window;
|
|
47
|
-
|
|
48
36
|
var val = (_window$getComputedSt = (_window$getComputedSt2 = (_window = window).getComputedStyle) === null || _window$getComputedSt2 === void 0 ? void 0 : _window$getComputedSt2.call(_window, refElement).getPropertyValue(cssVarName)) !== null && _window$getComputedSt !== void 0 ? _window$getComputedSt : '';
|
|
49
37
|
setV(val);
|
|
50
38
|
}
|
|
51
39
|
}, [refElement, cssVarName]);
|
|
52
40
|
return v;
|
|
53
41
|
}
|
|
54
|
-
|
|
55
42
|
function useWindTheme() {
|
|
56
43
|
var themeVar = useCssVar('--alicloudfe-components-theme') || '';
|
|
57
44
|
return themeVar.indexOf('xconsole') === -1 ? themeVar.indexOf('wind') === -1 ? 'isWind isWidget' : 'isWind' : '';
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { LogFn } from '@alicloud/console-logger-sls';
|
|
2
1
|
declare const getHistoryTag: () => any;
|
|
3
2
|
declare const setHistoryTag: (newTagList: any) => any;
|
|
4
3
|
declare const removeHistoryTagItem: (tagItem: any) => any;
|
|
@@ -9,6 +8,5 @@ declare const getSelectOptionAdatp: (title: string, list: any) => {
|
|
|
9
8
|
children: any[];
|
|
10
9
|
}[];
|
|
11
10
|
declare const getEnv: () => any;
|
|
12
|
-
declare const getLogger: () => LogFn;
|
|
13
11
|
declare const isValidKey: (key: string | number | symbol, object: object) => key is never;
|
|
14
|
-
export { getHistoryTag, setHistoryTag, removeHistoryTagItem, getTagByFileds, checkNoIndexListFormat, getSelectOptionAdatp, getEnv,
|
|
12
|
+
export { getHistoryTag, setHistoryTag, removeHistoryTagItem, getTagByFileds, checkNoIndexListFormat, getSelectOptionAdatp, getEnv, isValidKey, };
|
package/lib/utils.js
CHANGED
|
@@ -1,39 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.
|
|
9
|
-
|
|
7
|
+
exports.setHistoryTag = exports.removeHistoryTagItem = exports.isValidKey = exports.getTagByFileds = exports.getSelectOptionAdatp = exports.getHistoryTag = exports.getEnv = exports.checkNoIndexListFormat = void 0;
|
|
10
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
10
|
var _lodash = require("lodash");
|
|
11
|
+
var historyTagKey = "xconsole-rcsearch-historytag-".concat(location.origin).concat(location.pathname);
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var historyTagKey = "xconsole-rcsearch-historytag-".concat(location.origin).concat(location.pathname); // 从localStorage中获取tagList
|
|
19
|
-
|
|
20
|
-
var getHistoryTag = function getHistoryTag() {
|
|
13
|
+
// 从localStorage中获取tagList
|
|
14
|
+
var getHistoryTag = exports.getHistoryTag = function getHistoryTag() {
|
|
21
15
|
var tagStr = localStorage.getItem(historyTagKey);
|
|
22
|
-
|
|
23
16
|
if (tagStr) {
|
|
24
17
|
return JSON.parse(tagStr);
|
|
25
18
|
} else {
|
|
26
19
|
return [];
|
|
27
20
|
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
exports.getHistoryTag = getHistoryTag;
|
|
21
|
+
};
|
|
32
22
|
|
|
33
|
-
|
|
23
|
+
// 向localStorage中存入tagList
|
|
24
|
+
var setHistoryTag = exports.setHistoryTag = function setHistoryTag(newTagList) {
|
|
34
25
|
var tagsHistory = getHistoryTag();
|
|
35
26
|
var newHTags = tagsHistory.concat(newTagList);
|
|
36
|
-
|
|
37
27
|
if (newHTags.length > 5) {
|
|
38
28
|
newHTags.reverse();
|
|
39
29
|
newHTags = (0, _lodash.uniqWith)(newHTags, _lodash.isEqual);
|
|
@@ -42,17 +32,12 @@ var setHistoryTag = function setHistoryTag(newTagList) {
|
|
|
42
32
|
} else {
|
|
43
33
|
newHTags = (0, _lodash.uniqWith)(newHTags, _lodash.isEqual);
|
|
44
34
|
}
|
|
45
|
-
|
|
46
35
|
localStorage.setItem(historyTagKey, JSON.stringify(newHTags));
|
|
47
36
|
return newHTags;
|
|
48
37
|
};
|
|
49
|
-
|
|
50
|
-
exports.setHistoryTag = setHistoryTag;
|
|
51
|
-
|
|
52
|
-
var removeHistoryTagItem = function removeHistoryTagItem(tagItem) {
|
|
38
|
+
var removeHistoryTagItem = exports.removeHistoryTagItem = function removeHistoryTagItem(tagItem) {
|
|
53
39
|
var tagsHistory = getHistoryTag();
|
|
54
40
|
var findTagIndex = -1;
|
|
55
|
-
|
|
56
41
|
if (tagsHistory && tagsHistory.length > 0) {
|
|
57
42
|
findTagIndex = tagsHistory.findIndex(function (x) {
|
|
58
43
|
if (tagItem.dataIndex === x.dataIndex && tagItem.valueShow === x.valueShow) {
|
|
@@ -62,25 +47,20 @@ var removeHistoryTagItem = function removeHistoryTagItem(tagItem) {
|
|
|
62
47
|
}
|
|
63
48
|
});
|
|
64
49
|
}
|
|
65
|
-
|
|
66
50
|
if (findTagIndex >= 0) {
|
|
67
51
|
tagsHistory.splice(findTagIndex, 1);
|
|
68
52
|
}
|
|
69
|
-
|
|
70
53
|
localStorage.setItem(historyTagKey, JSON.stringify(tagsHistory));
|
|
71
54
|
return tagsHistory;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
exports.removeHistoryTagItem = removeHistoryTagItem;
|
|
55
|
+
};
|
|
76
56
|
|
|
77
|
-
|
|
57
|
+
// 将内部的表单对象, 转化成taglist array
|
|
58
|
+
var getTagByFileds = exports.getTagByFileds = function getTagByFileds(fileds, options) {
|
|
78
59
|
var rtTags = new Array();
|
|
79
60
|
Object.keys(fileds).forEach(function (key) {
|
|
80
61
|
var resItem = options.find(function (x) {
|
|
81
62
|
return x.dataIndex === key;
|
|
82
63
|
});
|
|
83
|
-
|
|
84
64
|
if (resItem && fileds[key]) {
|
|
85
65
|
var tagItem = {
|
|
86
66
|
label: resItem.label,
|
|
@@ -88,7 +68,6 @@ var getTagByFileds = function getTagByFileds(fileds, options) {
|
|
|
88
68
|
value: fileds[key],
|
|
89
69
|
valueShow: ''
|
|
90
70
|
};
|
|
91
|
-
|
|
92
71
|
if (resItem.template === 'input') {
|
|
93
72
|
tagItem.valueShow = fileds[key];
|
|
94
73
|
} else if (resItem.template === 'select') {
|
|
@@ -102,23 +81,18 @@ var getTagByFileds = function getTagByFileds(fileds, options) {
|
|
|
102
81
|
var findMul = resItem.templateProps.dataSource.find(function (z) {
|
|
103
82
|
return z.value === y;
|
|
104
83
|
});
|
|
105
|
-
|
|
106
84
|
if (findMul) {
|
|
107
85
|
valueShowArr.push(findMul.label);
|
|
108
86
|
}
|
|
109
87
|
});
|
|
110
88
|
tagItem.valueShow = valueShowArr.join('/');
|
|
111
89
|
}
|
|
112
|
-
|
|
113
90
|
rtTags.push(tagItem);
|
|
114
91
|
}
|
|
115
92
|
});
|
|
116
93
|
return rtTags;
|
|
117
94
|
};
|
|
118
|
-
|
|
119
|
-
exports.getTagByFileds = getTagByFileds;
|
|
120
|
-
|
|
121
|
-
var checkNoIndexListFormat = function checkNoIndexListFormat(list) {
|
|
95
|
+
var checkNoIndexListFormat = exports.checkNoIndexListFormat = function checkNoIndexListFormat(list) {
|
|
122
96
|
var isOk = true;
|
|
123
97
|
list.forEach(function (groupItem) {
|
|
124
98
|
if (groupItem && groupItem.children && Array.isArray(groupItem.children) && groupItem.children.length > 0) {
|
|
@@ -130,48 +104,20 @@ var checkNoIndexListFormat = function checkNoIndexListFormat(list) {
|
|
|
130
104
|
}
|
|
131
105
|
});
|
|
132
106
|
};
|
|
133
|
-
|
|
134
|
-
exports.checkNoIndexListFormat = checkNoIndexListFormat;
|
|
135
|
-
|
|
136
|
-
var getSelectOptionAdatp = function getSelectOptionAdatp(title, list) {
|
|
107
|
+
var getSelectOptionAdatp = exports.getSelectOptionAdatp = function getSelectOptionAdatp(title, list) {
|
|
137
108
|
return [{
|
|
138
109
|
label: title || '',
|
|
139
110
|
children: (0, _toConsumableArray2.default)(list)
|
|
140
111
|
}];
|
|
141
112
|
};
|
|
142
|
-
|
|
143
|
-
exports.getSelectOptionAdatp = getSelectOptionAdatp;
|
|
144
|
-
|
|
145
|
-
var getEnv = function getEnv() {
|
|
113
|
+
var getEnv = exports.getEnv = function getEnv() {
|
|
146
114
|
var _window, _window$ALIYUN_CONSOL;
|
|
147
|
-
|
|
148
115
|
if (process.env.NODE_ENV === 'development') {
|
|
149
116
|
return 'local';
|
|
150
|
-
} // @ts-ignore
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return ((_window = window) === null || _window === void 0 ? void 0 : (_window$ALIYUN_CONSOL = _window.ALIYUN_CONSOLE_CONFIG) === null || _window$ALIYUN_CONSOL === void 0 ? void 0 : _window$ALIYUN_CONSOL.fEnv) || 'prod';
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
exports.getEnv = getEnv;
|
|
157
|
-
var logger = null;
|
|
158
|
-
|
|
159
|
-
var getLogger = function getLogger() {
|
|
160
|
-
if (!logger) {
|
|
161
|
-
logger = (0, _consoleLoggerSls.default)({
|
|
162
|
-
project: 'stonehenge-console',
|
|
163
|
-
endpoint: 'cn-hangzhou.log.aliyuncs.com',
|
|
164
|
-
logstore: "com-usage-origin"
|
|
165
|
-
});
|
|
166
117
|
}
|
|
167
|
-
|
|
168
|
-
return
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
return ((_window = window) === null || _window === void 0 ? void 0 : (_window$ALIYUN_CONSOL = _window.ALIYUN_CONSOLE_CONFIG) === null || _window$ALIYUN_CONSOL === void 0 ? void 0 : _window$ALIYUN_CONSOL.fEnv) || 'prod';
|
|
169
120
|
};
|
|
170
|
-
|
|
171
|
-
exports.getLogger = getLogger;
|
|
172
|
-
|
|
173
|
-
var isValidKey = function isValidKey(key, object) {
|
|
121
|
+
var isValidKey = exports.isValidKey = function isValidKey(key, object) {
|
|
174
122
|
return key in object;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
exports.isValidKey = isValidKey;
|
|
123
|
+
};
|