@alicloud/console-components-search 0.2.8 → 0.2.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/config/components-with-style.tsx +1 -1
- package/demos/demo1.demo.tsx +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +15 -15
- package/doc-dist/10.js +1 -1
- package/doc-dist/deps/main.css +1 -1
- package/doc-dist/deps/main.js +8 -8
- package/doc-dist/deps/main.os.css +1 -1
- package/doc-dist/log-deps-build.log +3 -3
- package/es/ComplexSearch/index.js +11 -6
- package/es/message.js +32 -0
- package/es/search.js +3 -1
- package/es/searchTagList/PureTag.js +4 -4
- package/es/searchTagList/index.js +5 -2
- package/es/style.js +1 -1
- package/es/useCssVar.js +4 -0
- package/lib/ComplexSearch/index.js +13 -6
- package/lib/message.d.ts +2 -0
- package/lib/message.js +43 -0
- package/lib/search.js +4 -1
- package/lib/searchTagList/PureTag.js +5 -4
- package/lib/searchTagList/index.js +7 -2
- package/lib/style.js +1 -1
- package/lib/useCssVar.d.ts +1 -0
- package/lib/useCssVar.js +6 -0
- package/package.json +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
html body .xconsole-rcsearch-multi-pop.xconsole-rcsearch-multi-pop>ul{padding:8px}html body .xconsole-rcsearch-multi-pop .next-select-menu-item{padding-left:0!important}html body .xconsole-rcsearch-multi-pop .next-select-menu-item .next-menu-icon-selected{display:none}html body .xconsole-rcsearch-multi-pop .next-menu-group-label{padding-left:0}html body .xconsole-rc-search-popup{margin-top:4px}html .console-tags-tag.console-tags-tag{font-weight:600;color:var(--color-text1-9,#333)!important}html .console-tags-tag.console-tags-tag .console-tags-tag-label{font-weight:400;color:var(--color-text1-6,grey);margin-right:8px}html .console-tags-tag.console-tags-tag[class*=tag-closable]>[class*=tag-close-btn]{margin-left:12px}html .console-tags-tag.console-tags-tag.console-tags-tag.console-tags-tag:hover [class*=-icon-close]{color:#181818}html .console-tags-tag
|
|
1
|
+
html body .xconsole-rcsearch-multi-pop.xconsole-rcsearch-multi-pop>ul{padding:8px}html body .xconsole-rcsearch-multi-pop .next-select-menu-item{padding-left:0!important}html body .xconsole-rcsearch-multi-pop .next-select-menu-item .next-menu-icon-selected{display:none}html body .xconsole-rcsearch-multi-pop .next-menu-group-label{padding-left:0}html body .xconsole-rc-search-popup{margin-top:4px}html body .rc-search.isWind{--console-rc-search-label-color:#f7f7f7;--console-rc-search-label-hover-color:#ebebeb}html body .rc-search.isWidget{--console-rc-search-close-btn-top:2px;--console-rc-search-close-btn-left:-2px}html .rc-search-taglist:not(.isWind).rc-search-taglist:not(.isWind) [class*=-icon-close]:before{content:var(--icon-content-close)!important}html .console-tags-tag.console-tags-tag{font-weight:600;color:var(--color-text1-9,#333)!important}html .console-tags-tag.console-tags-tag .console-tags-tag-label{font-weight:400;color:var(--color-text1-6,grey);margin-right:8px}html .console-tags-tag.console-tags-tag[class*=tag-closable]>[class*=tag-close-btn]{margin-left:12px}html .console-tags-tag.console-tags-tag.console-tags-tag.console-tags-tag:hover [class*=-icon-close]{color:#181818}html .console-tags-tag:not(:last-child){margin-right:8px}html .console-tags-tag_empty{color:var(--color-text1-6,grey)}html .console-tags-tag-dot.console-tags-tag-dot [class*=-badge-dot]{right:4px;top:0}
|
|
@@ -1,13 +1,13 @@
|
|
|
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.62s
|
|
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:
|
|
8
|
-
main.js (2.
|
|
8
|
+
main.js (2.5 MiB),entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
|
|
9
9
|
Entrypoints:
|
|
10
|
-
main (2.
|
|
10
|
+
main (2.5 MiB)
|
|
11
11
|
main.css
|
|
12
12
|
main.js
|
|
13
13
|
,webpack performance recommendations:
|
|
@@ -16,6 +16,8 @@ import { Button, Icon, Select, ConfigProvider, Field, Checkbox } from '@alicloud
|
|
|
16
16
|
import { SearchWarp, MultiBtnWarp } from "../style";
|
|
17
17
|
import SearchConditionSelectPrefix from "./InputPrefix";
|
|
18
18
|
import { SEARCH_FILTER_FIELD, SEARCH_FILTER_VALUE_FIELD } from "../constants";
|
|
19
|
+
import message from "../message";
|
|
20
|
+
import { template } from 'lodash';
|
|
19
21
|
var AutoComplete = Select.AutoComplete;
|
|
20
22
|
/**
|
|
21
23
|
*
|
|
@@ -26,7 +28,7 @@ var AutoComplete = Select.AutoComplete;
|
|
|
26
28
|
var normalizeOptions = function normalizeOptions(options) {
|
|
27
29
|
var optionsCopy = cloneDeep(options);
|
|
28
30
|
optionsCopy.forEach(function (o) {
|
|
29
|
-
return !o.groupName && (o.groupName =
|
|
31
|
+
return !o.groupName && (o.groupName = message.defaultFilterGroupName);
|
|
30
32
|
});
|
|
31
33
|
return Object.entries(groupBy(optionsCopy, 'groupName')).map(function (_ref) {
|
|
32
34
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
@@ -144,7 +146,9 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
144
146
|
label = highlightKeyword(item.label, searchKey);
|
|
145
147
|
}
|
|
146
148
|
|
|
147
|
-
return
|
|
149
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
150
|
+
"data-value": label
|
|
151
|
+
}, label);
|
|
148
152
|
};
|
|
149
153
|
/**
|
|
150
154
|
* 处理筛选类型选中的情况
|
|
@@ -278,7 +282,7 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
278
282
|
onClick: function onClick() {
|
|
279
283
|
handleSearch();
|
|
280
284
|
}
|
|
281
|
-
},
|
|
285
|
+
}, message.confirm), /*#__PURE__*/React.createElement(Button, {
|
|
282
286
|
size: "small",
|
|
283
287
|
className: classNames("cancel-btn"),
|
|
284
288
|
type: "normal",
|
|
@@ -286,7 +290,7 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
286
290
|
reset();
|
|
287
291
|
document.body.click();
|
|
288
292
|
}
|
|
289
|
-
},
|
|
293
|
+
}, message.cancel))
|
|
290
294
|
}
|
|
291
295
|
}));
|
|
292
296
|
|
|
@@ -306,7 +310,6 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
306
310
|
}, /*#__PURE__*/React.createElement("i", {
|
|
307
311
|
className: "".concat(prefix, "icon ").concat(prefix, "icon-delete-filling ").concat(prefix, "input-hint ").concat(prefix, "input-clear-icon"),
|
|
308
312
|
role: "button",
|
|
309
|
-
"aria-label": "\u6E05\u9664",
|
|
310
313
|
onClick: function onClick() {
|
|
311
314
|
handlerFilterClear();
|
|
312
315
|
}
|
|
@@ -340,7 +343,9 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
340
343
|
}), {
|
|
341
344
|
// @ts-ignore
|
|
342
345
|
itemRender: highlightItem,
|
|
343
|
-
placeholder: placeholder ? placeholder : defaultFilter !== null && defaultFilter !== void 0 && defaultFilter.label ?
|
|
346
|
+
placeholder: placeholder ? placeholder : defaultFilter !== null && defaultFilter !== void 0 && defaultFilter.label ? template(message.defaultPlaceHolder)({
|
|
347
|
+
value: defaultFilter === null || defaultFilter === void 0 ? void 0 : defaultFilter.label
|
|
348
|
+
}) : '',
|
|
344
349
|
className: classNames('main-input', 'multi'),
|
|
345
350
|
hasBorder: false,
|
|
346
351
|
onKeyUp: handleKeyUp,
|
package/es/message.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Cookie from 'js-cookie';
|
|
2
|
+
var isSSR = typeof document === 'undefined';
|
|
3
|
+
var messages = {
|
|
4
|
+
'zh': {
|
|
5
|
+
confirm: '确定',
|
|
6
|
+
cancel: '取消',
|
|
7
|
+
allValue: '全部值',
|
|
8
|
+
emptyValue: '空值',
|
|
9
|
+
tag: "标签",
|
|
10
|
+
defaultFilterGroupName: "选择筛选条件",
|
|
11
|
+
defaultPlaceHolder: '默认按${value}搜索',
|
|
12
|
+
clearFilter: '清除筛选条件'
|
|
13
|
+
},
|
|
14
|
+
'en': {
|
|
15
|
+
confirm: 'Ok',
|
|
16
|
+
cancel: 'Cancel',
|
|
17
|
+
allValue: 'All Value',
|
|
18
|
+
emptyValue: 'Empty Value',
|
|
19
|
+
tag: "Tag",
|
|
20
|
+
defaultFilterGroupName: "Filters",
|
|
21
|
+
defaultPlaceHolder: 'Search By ${value}',
|
|
22
|
+
clearFilter: 'Clear Filter'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var lang = isSSR ? 'en' : Cookie.get('aliyun_lang') || 'en';
|
|
26
|
+
|
|
27
|
+
if (!Object.keys(messages).includes(lang)) {
|
|
28
|
+
lang = 'en';
|
|
29
|
+
} // @ts-ignore
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export default messages[lang];
|
package/es/search.js
CHANGED
|
@@ -4,6 +4,7 @@ import styled from "styled-components";
|
|
|
4
4
|
import { baseClassName } from './constants';
|
|
5
5
|
import ComplexSearch from "./ComplexSearch/index";
|
|
6
6
|
import LoggerProvider from './provider/LoggerProvider';
|
|
7
|
+
import { useWindTheme } from "./useCssVar";
|
|
7
8
|
var SearchWrap = styled.div.withConfig({
|
|
8
9
|
componentId: "sc-1szhzw4-0"
|
|
9
10
|
})(["height:32px;width:400px;display:inline-block;vertical-align:top;"]);
|
|
@@ -12,12 +13,13 @@ export var Search = function Search(props) {
|
|
|
12
13
|
_props$simple = props.simple,
|
|
13
14
|
simple = _props$simple === void 0 ? false : _props$simple,
|
|
14
15
|
style = props.style;
|
|
16
|
+
var windThemeClass = useWindTheme();
|
|
15
17
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LoggerProvider, {
|
|
16
18
|
regionId: props.regionId,
|
|
17
19
|
resourceType: props.resourceType || '',
|
|
18
20
|
componentName: "RcSearch"
|
|
19
21
|
}), /*#__PURE__*/React.createElement(SearchWrap, {
|
|
20
|
-
className: classNames(baseClassName, className),
|
|
22
|
+
className: classNames(baseClassName, className, windThemeClass),
|
|
21
23
|
style: style
|
|
22
24
|
}, /*#__PURE__*/React.createElement(ComplexSearch, props)));
|
|
23
25
|
};
|
|
@@ -4,6 +4,7 @@ var _excluded = ["intl", "tagKey", "disableTruncate", "showDot", "tagValue", "sh
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { Tag, Badge } from '@alicloud/console-components';
|
|
6
6
|
import Truncate from '@alicloud/console-components-truncate';
|
|
7
|
+
import message from '../message';
|
|
7
8
|
|
|
8
9
|
var Empty = function Empty(_ref) {
|
|
9
10
|
var children = _ref.children;
|
|
@@ -31,16 +32,15 @@ var PureTag = function PureTag(props) {
|
|
|
31
32
|
var transformedTagValue = tagValue;
|
|
32
33
|
|
|
33
34
|
if (tagValue === '') {
|
|
34
|
-
transformedTagValue =
|
|
35
|
+
transformedTagValue = message.emptyValue;
|
|
35
36
|
} else if (tagValue === undefined || tagValue === null) {
|
|
36
|
-
transformedTagValue =
|
|
37
|
+
transformedTagValue = message.allValue;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
return (
|
|
40
41
|
/*#__PURE__*/
|
|
41
42
|
//@ts-ignore
|
|
42
43
|
React.createElement(DotWrapper, {
|
|
43
|
-
title: "\u5373\u5C06\u65B0\u5EFA",
|
|
44
44
|
className: "console-tags-tag-dot",
|
|
45
45
|
dot: true
|
|
46
46
|
}, /*#__PURE__*/React.createElement(TagWrapper, _extends({
|
|
@@ -48,7 +48,7 @@ var PureTag = function PureTag(props) {
|
|
|
48
48
|
className: "console-tags-tag"
|
|
49
49
|
}, resetProps), showLabel && /*#__PURE__*/React.createElement("label", {
|
|
50
50
|
className: "console-tags-tag-label"
|
|
51
|
-
},
|
|
51
|
+
}, message.tag), /*#__PURE__*/React.createElement(TruncateWrapper, defaultTruncateProps, tagKey), ":", tagValue ? /*#__PURE__*/React.createElement(TruncateWrapper, defaultTruncateProps, tagValue) : /*#__PURE__*/React.createElement("span", {
|
|
52
52
|
className: "console-tags-tag_empty"
|
|
53
53
|
}, transformedTagValue)))
|
|
54
54
|
);
|
|
@@ -12,6 +12,8 @@ import { TagListWrap } from '../style';
|
|
|
12
12
|
import { baseTagListClassName } from '../constants';
|
|
13
13
|
import isArray from 'lodash/isArray';
|
|
14
14
|
import PureTag from "./PureTag";
|
|
15
|
+
import { useWindTheme } from "../useCssVar";
|
|
16
|
+
import message from "../message";
|
|
15
17
|
var TagGroup = Tag.Group,
|
|
16
18
|
ClosableTag = Tag.Closeable;
|
|
17
19
|
/**
|
|
@@ -110,9 +112,10 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
110
112
|
|
|
111
113
|
return !isArray(t === null || t === void 0 ? void 0 : t.value) || (t === null || t === void 0 ? void 0 : (_t$value = t.value) === null || _t$value === void 0 ? void 0 : _t$value.length);
|
|
112
114
|
}) || [];
|
|
115
|
+
var isWindClass = useWindTheme();
|
|
113
116
|
return /*#__PURE__*/React.createElement(TagListWrap, {
|
|
114
117
|
prefix: prefix,
|
|
115
|
-
className: classNames(baseTagListClassName, className),
|
|
118
|
+
className: classNames(baseTagListClassName, className, isWindClass),
|
|
116
119
|
style: style
|
|
117
120
|
}, /*#__PURE__*/React.createElement(TagGroup, null, processDataSource.map(function (tagItem) {
|
|
118
121
|
if (isTagLikeDataStructure(tagItem.value)) {
|
|
@@ -134,7 +137,7 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
134
137
|
}), processDataSource.length > 0 && /*#__PURE__*/React.createElement("a", {
|
|
135
138
|
className: "remove-btn",
|
|
136
139
|
onClick: onRemoveAllFilter
|
|
137
|
-
},
|
|
140
|
+
}, message.clearFilter)));
|
|
138
141
|
};
|
|
139
142
|
|
|
140
143
|
export default ConfigProvider.config(SearchTagList);
|
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
|
|
9
|
+
})(["height:100%;width:100%;display:flex;.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);&.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-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:var(--console-rc-search-close-btn-top,0);left:var(--console-rc-search-close-btn-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);
|
package/es/useCssVar.js
CHANGED
|
@@ -35,4 +35,8 @@ export function useCssVar(cssVarName) {
|
|
|
35
35
|
}
|
|
36
36
|
}, [refElement, cssVarName]);
|
|
37
37
|
return v;
|
|
38
|
+
}
|
|
39
|
+
export function useWindTheme() {
|
|
40
|
+
var themeVar = useCssVar('--alicloudfe-components-theme');
|
|
41
|
+
return themeVar && themeVar.indexOf('xconsole') === -1 ? themeVar.indexOf('wind') === -1 ? 'isWind isWidget' : 'isWind' : '';
|
|
38
42
|
}
|
|
@@ -35,6 +35,10 @@ var _InputPrefix = _interopRequireDefault(require("./InputPrefix"));
|
|
|
35
35
|
|
|
36
36
|
var _constants = require("../constants");
|
|
37
37
|
|
|
38
|
+
var _message = _interopRequireDefault(require("../message"));
|
|
39
|
+
|
|
40
|
+
var _lodash = require("lodash");
|
|
41
|
+
|
|
38
42
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
43
|
|
|
40
44
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -53,7 +57,7 @@ var AutoComplete = _consoleComponents.Select.AutoComplete;
|
|
|
53
57
|
var normalizeOptions = function normalizeOptions(options) {
|
|
54
58
|
var optionsCopy = (0, _cloneDeep.default)(options);
|
|
55
59
|
optionsCopy.forEach(function (o) {
|
|
56
|
-
return !o.groupName && (o.groupName =
|
|
60
|
+
return !o.groupName && (o.groupName = _message.default.defaultFilterGroupName);
|
|
57
61
|
});
|
|
58
62
|
return Object.entries((0, _groupBy.default)(optionsCopy, 'groupName')).map(function (_ref) {
|
|
59
63
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
@@ -173,7 +177,9 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
173
177
|
label = highlightKeyword(item.label, searchKey);
|
|
174
178
|
}
|
|
175
179
|
|
|
176
|
-
return
|
|
180
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
181
|
+
"data-value": label
|
|
182
|
+
}, label);
|
|
177
183
|
};
|
|
178
184
|
/**
|
|
179
185
|
* 处理筛选类型选中的情况
|
|
@@ -307,7 +313,7 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
307
313
|
onClick: function onClick() {
|
|
308
314
|
handleSearch();
|
|
309
315
|
}
|
|
310
|
-
},
|
|
316
|
+
}, _message.default.confirm), /*#__PURE__*/_react.default.createElement(_consoleComponents.Button, {
|
|
311
317
|
size: "small",
|
|
312
318
|
className: (0, _classnames.default)("cancel-btn"),
|
|
313
319
|
type: "normal",
|
|
@@ -315,7 +321,7 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
315
321
|
reset();
|
|
316
322
|
document.body.click();
|
|
317
323
|
}
|
|
318
|
-
},
|
|
324
|
+
}, _message.default.cancel))
|
|
319
325
|
}
|
|
320
326
|
}));
|
|
321
327
|
|
|
@@ -335,7 +341,6 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
335
341
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
336
342
|
className: "".concat(prefix, "icon ").concat(prefix, "icon-delete-filling ").concat(prefix, "input-hint ").concat(prefix, "input-clear-icon"),
|
|
337
343
|
role: "button",
|
|
338
|
-
"aria-label": "\u6E05\u9664",
|
|
339
344
|
onClick: function onClick() {
|
|
340
345
|
handlerFilterClear();
|
|
341
346
|
}
|
|
@@ -369,7 +374,9 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
369
374
|
}), {
|
|
370
375
|
// @ts-ignore
|
|
371
376
|
itemRender: highlightItem,
|
|
372
|
-
placeholder: placeholder ? placeholder : defaultFilter !== null && defaultFilter !== void 0 && defaultFilter.label ?
|
|
377
|
+
placeholder: placeholder ? placeholder : defaultFilter !== null && defaultFilter !== void 0 && defaultFilter.label ? (0, _lodash.template)(_message.default.defaultPlaceHolder)({
|
|
378
|
+
value: defaultFilter === null || defaultFilter === void 0 ? void 0 : defaultFilter.label
|
|
379
|
+
}) : '',
|
|
373
380
|
className: (0, _classnames.default)('main-input', 'multi'),
|
|
374
381
|
hasBorder: false,
|
|
375
382
|
onKeyUp: handleKeyUp,
|
package/lib/message.d.ts
ADDED
package/lib/message.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
11
|
+
|
|
12
|
+
var isSSR = typeof document === 'undefined';
|
|
13
|
+
var messages = {
|
|
14
|
+
'zh': {
|
|
15
|
+
confirm: '确定',
|
|
16
|
+
cancel: '取消',
|
|
17
|
+
allValue: '全部值',
|
|
18
|
+
emptyValue: '空值',
|
|
19
|
+
tag: "标签",
|
|
20
|
+
defaultFilterGroupName: "选择筛选条件",
|
|
21
|
+
defaultPlaceHolder: '默认按${value}搜索',
|
|
22
|
+
clearFilter: '清除筛选条件'
|
|
23
|
+
},
|
|
24
|
+
'en': {
|
|
25
|
+
confirm: 'Ok',
|
|
26
|
+
cancel: 'Cancel',
|
|
27
|
+
allValue: 'All Value',
|
|
28
|
+
emptyValue: 'Empty Value',
|
|
29
|
+
tag: "Tag",
|
|
30
|
+
defaultFilterGroupName: "Filters",
|
|
31
|
+
defaultPlaceHolder: 'Search By ${value}',
|
|
32
|
+
clearFilter: 'Clear Filter'
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var lang = isSSR ? 'en' : _jsCookie.default.get('aliyun_lang') || 'en';
|
|
36
|
+
|
|
37
|
+
if (!Object.keys(messages).includes(lang)) {
|
|
38
|
+
lang = 'en';
|
|
39
|
+
} // @ts-ignore
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
var _default = messages[lang];
|
|
43
|
+
exports.default = _default;
|
package/lib/search.js
CHANGED
|
@@ -19,6 +19,8 @@ var _index = _interopRequireDefault(require("./ComplexSearch/index"));
|
|
|
19
19
|
|
|
20
20
|
var _LoggerProvider = _interopRequireDefault(require("./provider/LoggerProvider"));
|
|
21
21
|
|
|
22
|
+
var _useCssVar = require("./useCssVar");
|
|
23
|
+
|
|
22
24
|
var SearchWrap = _styledComponents.default.div.withConfig({
|
|
23
25
|
componentId: "sc-1szhzw4-0"
|
|
24
26
|
})(["height:32px;width:400px;display:inline-block;vertical-align:top;"]);
|
|
@@ -28,12 +30,13 @@ var Search = function Search(props) {
|
|
|
28
30
|
_props$simple = props.simple,
|
|
29
31
|
simple = _props$simple === void 0 ? false : _props$simple,
|
|
30
32
|
style = props.style;
|
|
33
|
+
var windThemeClass = (0, _useCssVar.useWindTheme)();
|
|
31
34
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_LoggerProvider.default, {
|
|
32
35
|
regionId: props.regionId,
|
|
33
36
|
resourceType: props.resourceType || '',
|
|
34
37
|
componentName: "RcSearch"
|
|
35
38
|
}), /*#__PURE__*/_react.default.createElement(SearchWrap, {
|
|
36
|
-
className: (0, _classnames.default)(_constants.baseClassName, className),
|
|
39
|
+
className: (0, _classnames.default)(_constants.baseClassName, className, windThemeClass),
|
|
37
40
|
style: style
|
|
38
41
|
}, /*#__PURE__*/_react.default.createElement(_index.default, props)));
|
|
39
42
|
};
|
|
@@ -17,6 +17,8 @@ var _consoleComponents = require("@alicloud/console-components");
|
|
|
17
17
|
|
|
18
18
|
var _consoleComponentsTruncate = _interopRequireDefault(require("@alicloud/console-components-truncate"));
|
|
19
19
|
|
|
20
|
+
var _message = _interopRequireDefault(require("../message"));
|
|
21
|
+
|
|
20
22
|
var _excluded = ["intl", "tagKey", "disableTruncate", "showDot", "tagValue", "showLabel", "closable"];
|
|
21
23
|
|
|
22
24
|
var Empty = function Empty(_ref) {
|
|
@@ -44,16 +46,15 @@ var PureTag = function PureTag(props) {
|
|
|
44
46
|
var transformedTagValue = tagValue;
|
|
45
47
|
|
|
46
48
|
if (tagValue === '') {
|
|
47
|
-
transformedTagValue =
|
|
49
|
+
transformedTagValue = _message.default.emptyValue;
|
|
48
50
|
} else if (tagValue === undefined || tagValue === null) {
|
|
49
|
-
transformedTagValue =
|
|
51
|
+
transformedTagValue = _message.default.allValue;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
return (
|
|
53
55
|
/*#__PURE__*/
|
|
54
56
|
//@ts-ignore
|
|
55
57
|
_react.default.createElement(DotWrapper, {
|
|
56
|
-
title: "\u5373\u5C06\u65B0\u5EFA",
|
|
57
58
|
className: "console-tags-tag-dot",
|
|
58
59
|
dot: true
|
|
59
60
|
}, /*#__PURE__*/_react.default.createElement(TagWrapper, (0, _extends2.default)({
|
|
@@ -61,7 +62,7 @@ var PureTag = function PureTag(props) {
|
|
|
61
62
|
className: "console-tags-tag"
|
|
62
63
|
}, resetProps), showLabel && /*#__PURE__*/_react.default.createElement("label", {
|
|
63
64
|
className: "console-tags-tag-label"
|
|
64
|
-
},
|
|
65
|
+
}, _message.default.tag), /*#__PURE__*/_react.default.createElement(TruncateWrapper, defaultTruncateProps, tagKey), ":", tagValue ? /*#__PURE__*/_react.default.createElement(TruncateWrapper, defaultTruncateProps, tagValue) : /*#__PURE__*/_react.default.createElement("span", {
|
|
65
66
|
className: "console-tags-tag_empty"
|
|
66
67
|
}, transformedTagValue)))
|
|
67
68
|
);
|
|
@@ -25,6 +25,10 @@ var _isArray = _interopRequireDefault(require("lodash/isArray"));
|
|
|
25
25
|
|
|
26
26
|
var _PureTag = _interopRequireDefault(require("./PureTag"));
|
|
27
27
|
|
|
28
|
+
var _useCssVar = require("../useCssVar");
|
|
29
|
+
|
|
30
|
+
var _message = _interopRequireDefault(require("../message"));
|
|
31
|
+
|
|
28
32
|
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
33
|
|
|
30
34
|
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; }
|
|
@@ -127,9 +131,10 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
127
131
|
|
|
128
132
|
return !(0, _isArray.default)(t === null || t === void 0 ? void 0 : t.value) || (t === null || t === void 0 ? void 0 : (_t$value = t.value) === null || _t$value === void 0 ? void 0 : _t$value.length);
|
|
129
133
|
}) || [];
|
|
134
|
+
var isWindClass = (0, _useCssVar.useWindTheme)();
|
|
130
135
|
return /*#__PURE__*/_react.default.createElement(_style.TagListWrap, {
|
|
131
136
|
prefix: prefix,
|
|
132
|
-
className: (0, _classnames.default)(_constants.baseTagListClassName, className),
|
|
137
|
+
className: (0, _classnames.default)(_constants.baseTagListClassName, className, isWindClass),
|
|
133
138
|
style: style
|
|
134
139
|
}, /*#__PURE__*/_react.default.createElement(TagGroup, null, processDataSource.map(function (tagItem) {
|
|
135
140
|
if (isTagLikeDataStructure(tagItem.value)) {
|
|
@@ -151,7 +156,7 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
151
156
|
}), processDataSource.length > 0 && /*#__PURE__*/_react.default.createElement("a", {
|
|
152
157
|
className: "remove-btn",
|
|
153
158
|
onClick: onRemoveAllFilter
|
|
154
|
-
},
|
|
159
|
+
}, _message.default.clearFilter)));
|
|
155
160
|
};
|
|
156
161
|
|
|
157
162
|
var _default = _consoleComponents.ConfigProvider.config(SearchTagList);
|
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
|
|
18
|
+
})(["height:100%;width:100%;display:flex;.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);&.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-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:var(--console-rc-search-close-btn-top,0);left:var(--console-rc-search-close-btn-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
|
|
package/lib/useCssVar.d.ts
CHANGED
package/lib/useCssVar.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.useCssVar = useCssVar;
|
|
9
|
+
exports.useWindTheme = useWindTheme;
|
|
9
10
|
|
|
10
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
12
|
|
|
@@ -49,4 +50,9 @@ function useCssVar(cssVarName) {
|
|
|
49
50
|
}
|
|
50
51
|
}, [refElement, cssVarName]);
|
|
51
52
|
return v;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function useWindTheme() {
|
|
56
|
+
var themeVar = useCssVar('--alicloudfe-components-theme');
|
|
57
|
+
return themeVar && themeVar.indexOf('xconsole') === -1 ? themeVar.indexOf('wind') === -1 ? 'isWind isWidget' : 'isWind' : '';
|
|
52
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alicloud/console-components-search",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"@alicloud/console-toolkit-cli": "^1.2.0",
|
|
22
22
|
"@alicloud/console-toolkit-preset-component": "^1.2.8",
|
|
23
23
|
"@alicloud/console-toolkit-preset-docs": "^1.0.34",
|
|
24
|
+
"@types/js-cookie": "^3.0.1",
|
|
24
25
|
"@types/react": "^17.0.0",
|
|
25
26
|
"@types/react-dom": "^17.0.0",
|
|
26
27
|
"@types/styled-components": "^5.1.7",
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
39
|
"@alicloud/console-components-truncate": "^1.0.16",
|
|
39
|
-
"@alicloud/console-logger-sls": "^1.2.31"
|
|
40
|
+
"@alicloud/console-logger-sls": "^1.2.31",
|
|
41
|
+
"js-cookie": "^3.0.1"
|
|
40
42
|
}
|
|
41
43
|
}
|