@alicloud/console-components-search 0.2.33 → 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 +27 -47
- 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 +23 -57
- 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 -135343
- 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,47 +1,39 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
-
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
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) { _defineProperty(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; }
|
|
7
|
-
|
|
8
|
-
import React from "react";
|
|
3
|
+
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; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
import React from 'react';
|
|
9
6
|
import classNames from 'classnames';
|
|
10
7
|
import { ConfigProvider, Tag } from '@alicloud/console-components';
|
|
8
|
+
import isArray from 'lodash/isArray';
|
|
9
|
+
import isObject from 'lodash/isObject';
|
|
11
10
|
import { TagListWrap } from '../style';
|
|
12
11
|
import { baseTagListClassName } from '../constants';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
ClosableTag = Tag.Closeable;
|
|
12
|
+
import PureTag from './PureTag';
|
|
13
|
+
import { useWindTheme } from '../useCssVar';
|
|
14
|
+
import message from '../message';
|
|
15
|
+
var ClosableTag = Tag.Closeable;
|
|
16
|
+
|
|
19
17
|
/**
|
|
20
18
|
* 判断是否是 标签 的数据结构
|
|
21
19
|
*/
|
|
22
|
-
|
|
23
20
|
var isTagLikeDataStructure = function isTagLikeDataStructure(value) {
|
|
24
21
|
var isTag = !!(value !== null && value !== void 0 && value.tagKey);
|
|
25
|
-
|
|
26
22
|
if (isArray(value)) {
|
|
27
23
|
return value[0] && !!value[0].tagKey;
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
return isTag;
|
|
31
26
|
};
|
|
32
|
-
|
|
33
27
|
var SearchTagList = function SearchTagList(props) {
|
|
34
28
|
var dataSource = props.dataSource,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
className = props.className,
|
|
30
|
+
style = props.style,
|
|
31
|
+
onChange = props.onChange,
|
|
32
|
+
onClear = props.onClear,
|
|
33
|
+
_props$prefix = props.prefix,
|
|
34
|
+
prefix = _props$prefix === void 0 ? 'next-' : _props$prefix;
|
|
42
35
|
var onRemoveFilter = function onRemoveFilter(item) {
|
|
43
36
|
var newTagList = _toConsumableArray(dataSource);
|
|
44
|
-
|
|
45
37
|
if (onChange) {
|
|
46
38
|
var resFindIndex = newTagList.findIndex(function (x) {
|
|
47
39
|
return x.dataIndex === item.dataIndex;
|
|
@@ -50,22 +42,18 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
50
42
|
onChange(deletedTags[0], newTagList);
|
|
51
43
|
}
|
|
52
44
|
};
|
|
53
|
-
|
|
54
45
|
var onRemoveAllFilter = function onRemoveAllFilter() {
|
|
55
46
|
if (onClear) {
|
|
56
47
|
onClear();
|
|
57
48
|
}
|
|
58
49
|
};
|
|
59
|
-
|
|
60
50
|
var onRemoveTag = function onRemoveTag(item, tag) {
|
|
61
51
|
var newDataSource = _toConsumableArray(dataSource);
|
|
62
|
-
|
|
63
52
|
if (onChange) {
|
|
64
53
|
var resFindIndex = item.value.findIndex(function (x) {
|
|
65
54
|
return x.tagKey === tag.tagKey && x.tagValue === tag.tagValue;
|
|
66
55
|
});
|
|
67
56
|
var deletedTags = item.value.splice(resFindIndex, 1);
|
|
68
|
-
|
|
69
57
|
if (item.value.length === 0) {
|
|
70
58
|
onRemoveFilter(item);
|
|
71
59
|
} else {
|
|
@@ -75,10 +63,8 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
75
63
|
}
|
|
76
64
|
}
|
|
77
65
|
};
|
|
78
|
-
|
|
79
66
|
var renderTags = function renderTags(tagItem) {
|
|
80
67
|
var value = tagItem.value;
|
|
81
|
-
|
|
82
68
|
if (isArray(value)) {
|
|
83
69
|
return value.map(function (t) {
|
|
84
70
|
return /*#__PURE__*/React.createElement(PureTag, {
|
|
@@ -94,7 +80,6 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
94
80
|
});
|
|
95
81
|
});
|
|
96
82
|
}
|
|
97
|
-
|
|
98
83
|
return /*#__PURE__*/React.createElement(PureTag, {
|
|
99
84
|
showLabel: true,
|
|
100
85
|
tagKey: value === null || value === void 0 ? void 0 : value.tagKey,
|
|
@@ -106,12 +91,17 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
106
91
|
}
|
|
107
92
|
});
|
|
108
93
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
94
|
+
var processDataSource = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.filter(function (t) {
|
|
95
|
+
if (isArray(t === null || t === void 0 ? void 0 : t.value)) {
|
|
96
|
+
// 过滤掉非法的 Tag 节点
|
|
97
|
+
var validValue = t.value.filter(isTagLikeDataStructure);
|
|
98
|
+
if (!validValue.length) return false;
|
|
99
|
+
}
|
|
100
|
+
if (isObject(t === null || t === void 0 ? void 0 : t.value)) {
|
|
101
|
+
return isTagLikeDataStructure(t.value);
|
|
102
|
+
}
|
|
103
|
+
return true;
|
|
104
|
+
})) || [];
|
|
115
105
|
var isWindClass = useWindTheme();
|
|
116
106
|
return /*#__PURE__*/React.createElement(TagListWrap, {
|
|
117
107
|
prefix: prefix,
|
|
@@ -121,15 +111,6 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
121
111
|
if (isTagLikeDataStructure(tagItem.value)) {
|
|
122
112
|
return renderTags(tagItem);
|
|
123
113
|
}
|
|
124
|
-
/**
|
|
125
|
-
* 非 tag 标签类型的 Object 数据不渲染
|
|
126
|
-
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (typeof (tagItem.valueLabel || tagItem.value) !== 'string') {
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
114
|
return /*#__PURE__*/React.createElement(ClosableTag, {
|
|
134
115
|
className: "search-tags-tag",
|
|
135
116
|
key: tagItem.dataIndex + tagItem.value,
|
|
@@ -147,5 +128,4 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
147
128
|
onClick: onRemoveAllFilter
|
|
148
129
|
}, message.clearFilter));
|
|
149
130
|
};
|
|
150
|
-
|
|
151
131
|
export default ConfigProvider.config(SearchTagList);
|
package/es/style.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
4
|
-
|
|
5
|
-
import styled from "styled-components";
|
|
6
|
-
|
|
1
|
+
import styled from 'styled-components';
|
|
7
2
|
var prefix = function prefix(props) {
|
|
8
3
|
return props.prefix ? ".".concat(props.prefix) : '.next-';
|
|
9
4
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
5
|
+
var SearchWarp = styled.div.withConfig({
|
|
6
|
+
componentId: "sc-1afc1cn-0"
|
|
7
|
+
})(["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);
|
|
8
|
+
var MenuContentWrap = styled.ul.withConfig({
|
|
9
|
+
componentId: "sc-1afc1cn-1"
|
|
10
|
+
})(["", "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);
|
|
11
|
+
var MultiBtnWarp = styled.div.withConfig({
|
|
12
|
+
componentId: "sc-1afc1cn-2"
|
|
13
|
+
})(["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);
|
|
14
|
+
var TagListWrap = styled.div.withConfig({
|
|
15
|
+
componentId: "sc-1afc1cn-3"
|
|
16
|
+
})(["", "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);
|
|
15
17
|
export { SearchWarp, MultiBtnWarp, TagListWrap, MenuContentWrap };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/useCssVar.js
CHANGED
|
@@ -4,32 +4,27 @@ import { ConfigProvider } from '@alicloud/console-components';
|
|
|
4
4
|
var nextId = 0;
|
|
5
5
|
export function useCssVar(cssVarName) {
|
|
6
6
|
var _useState = useState(''),
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
8
|
+
v = _useState2[0],
|
|
9
|
+
setV = _useState2[1];
|
|
11
10
|
var refElement = ConfigProvider.useRefElement();
|
|
12
11
|
useLayoutEffect(function () {
|
|
13
12
|
var _window$__recheck_css;
|
|
13
|
+
check();
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var checkArr = window['__recheck_css_var'] = (_window$__recheck_css = window['__recheck_css_var']) !== null && _window$__recheck_css !== void 0 ? _window$__recheck_css : [];
|
|
18
|
-
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
var checkArr = window.__recheck_css_var = (_window$__recheck_css = window.__recheck_css_var) !== null && _window$__recheck_css !== void 0 ? _window$__recheck_css : [];
|
|
19
17
|
while (checkArr[nextId]) {
|
|
20
18
|
// 如果一个页面下有份此组件库(即有多个nextId指针),需要避免冲突
|
|
21
19
|
nextId++;
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
var id = nextId++;
|
|
25
22
|
checkArr[id] = check;
|
|
26
23
|
return function () {
|
|
27
24
|
delete checkArr[id];
|
|
28
25
|
};
|
|
29
|
-
|
|
30
26
|
function check() {
|
|
31
27
|
var _window$getComputedSt, _window$getComputedSt2, _window;
|
|
32
|
-
|
|
33
28
|
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 : '';
|
|
34
29
|
setV(val);
|
|
35
30
|
}
|
package/es/utils.js
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
3
|
import { uniqWith, isEqual } from 'lodash';
|
|
4
|
-
|
|
5
|
-
var historyTagKey = "xconsole-rcsearch-historytag-".concat(location.origin).concat(location.pathname); // 从localStorage中获取tagList
|
|
4
|
+
var historyTagKey = "xconsole-rcsearch-historytag-".concat(location.origin).concat(location.pathname);
|
|
6
5
|
|
|
6
|
+
// 从localStorage中获取tagList
|
|
7
7
|
var getHistoryTag = function getHistoryTag() {
|
|
8
8
|
var tagStr = localStorage.getItem(historyTagKey);
|
|
9
|
-
|
|
10
9
|
if (tagStr) {
|
|
11
10
|
return JSON.parse(tagStr);
|
|
12
11
|
} else {
|
|
13
12
|
return [];
|
|
14
13
|
}
|
|
15
|
-
};
|
|
16
|
-
|
|
14
|
+
};
|
|
17
15
|
|
|
16
|
+
// 向localStorage中存入tagList
|
|
18
17
|
var setHistoryTag = function setHistoryTag(newTagList) {
|
|
19
18
|
var tagsHistory = getHistoryTag();
|
|
20
19
|
var newHTags = tagsHistory.concat(newTagList);
|
|
21
|
-
|
|
22
20
|
if (newHTags.length > 5) {
|
|
23
21
|
newHTags.reverse();
|
|
24
22
|
newHTags = uniqWith(newHTags, isEqual);
|
|
@@ -27,15 +25,12 @@ var setHistoryTag = function setHistoryTag(newTagList) {
|
|
|
27
25
|
} else {
|
|
28
26
|
newHTags = uniqWith(newHTags, isEqual);
|
|
29
27
|
}
|
|
30
|
-
|
|
31
28
|
localStorage.setItem(historyTagKey, JSON.stringify(newHTags));
|
|
32
29
|
return newHTags;
|
|
33
30
|
};
|
|
34
|
-
|
|
35
31
|
var removeHistoryTagItem = function removeHistoryTagItem(tagItem) {
|
|
36
32
|
var tagsHistory = getHistoryTag();
|
|
37
33
|
var findTagIndex = -1;
|
|
38
|
-
|
|
39
34
|
if (tagsHistory && tagsHistory.length > 0) {
|
|
40
35
|
findTagIndex = tagsHistory.findIndex(function (x) {
|
|
41
36
|
if (tagItem.dataIndex === x.dataIndex && tagItem.valueShow === x.valueShow) {
|
|
@@ -45,23 +40,20 @@ var removeHistoryTagItem = function removeHistoryTagItem(tagItem) {
|
|
|
45
40
|
}
|
|
46
41
|
});
|
|
47
42
|
}
|
|
48
|
-
|
|
49
43
|
if (findTagIndex >= 0) {
|
|
50
44
|
tagsHistory.splice(findTagIndex, 1);
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
localStorage.setItem(historyTagKey, JSON.stringify(tagsHistory));
|
|
54
47
|
return tagsHistory;
|
|
55
|
-
};
|
|
56
|
-
|
|
48
|
+
};
|
|
57
49
|
|
|
50
|
+
// 将内部的表单对象, 转化成taglist array
|
|
58
51
|
var getTagByFileds = function getTagByFileds(fileds, options) {
|
|
59
52
|
var rtTags = new Array();
|
|
60
53
|
Object.keys(fileds).forEach(function (key) {
|
|
61
54
|
var resItem = options.find(function (x) {
|
|
62
55
|
return x.dataIndex === key;
|
|
63
56
|
});
|
|
64
|
-
|
|
65
57
|
if (resItem && fileds[key]) {
|
|
66
58
|
var tagItem = {
|
|
67
59
|
label: resItem.label,
|
|
@@ -69,7 +61,6 @@ var getTagByFileds = function getTagByFileds(fileds, options) {
|
|
|
69
61
|
value: fileds[key],
|
|
70
62
|
valueShow: ''
|
|
71
63
|
};
|
|
72
|
-
|
|
73
64
|
if (resItem.template === 'input') {
|
|
74
65
|
tagItem.valueShow = fileds[key];
|
|
75
66
|
} else if (resItem.template === 'select') {
|
|
@@ -83,20 +74,17 @@ var getTagByFileds = function getTagByFileds(fileds, options) {
|
|
|
83
74
|
var findMul = resItem.templateProps.dataSource.find(function (z) {
|
|
84
75
|
return z.value === y;
|
|
85
76
|
});
|
|
86
|
-
|
|
87
77
|
if (findMul) {
|
|
88
78
|
valueShowArr.push(findMul.label);
|
|
89
79
|
}
|
|
90
80
|
});
|
|
91
81
|
tagItem.valueShow = valueShowArr.join('/');
|
|
92
82
|
}
|
|
93
|
-
|
|
94
83
|
rtTags.push(tagItem);
|
|
95
84
|
}
|
|
96
85
|
});
|
|
97
86
|
return rtTags;
|
|
98
87
|
};
|
|
99
|
-
|
|
100
88
|
var checkNoIndexListFormat = function checkNoIndexListFormat(list) {
|
|
101
89
|
var isOk = true;
|
|
102
90
|
list.forEach(function (groupItem) {
|
|
@@ -109,41 +97,21 @@ var checkNoIndexListFormat = function checkNoIndexListFormat(list) {
|
|
|
109
97
|
}
|
|
110
98
|
});
|
|
111
99
|
};
|
|
112
|
-
|
|
113
100
|
var getSelectOptionAdatp = function getSelectOptionAdatp(title, list) {
|
|
114
101
|
return [{
|
|
115
102
|
label: title || '',
|
|
116
103
|
children: _toConsumableArray(list)
|
|
117
104
|
}];
|
|
118
105
|
};
|
|
119
|
-
|
|
120
106
|
var getEnv = function getEnv() {
|
|
121
107
|
var _window, _window$ALIYUN_CONSOL;
|
|
122
|
-
|
|
123
108
|
if (process.env.NODE_ENV === 'development') {
|
|
124
109
|
return 'local';
|
|
125
|
-
} // @ts-ignore
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
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';
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
var logger = null;
|
|
132
|
-
|
|
133
|
-
var getLogger = function getLogger() {
|
|
134
|
-
if (!logger) {
|
|
135
|
-
logger = createLogger({
|
|
136
|
-
project: 'stonehenge-console',
|
|
137
|
-
endpoint: 'cn-hangzhou.log.aliyuncs.com',
|
|
138
|
-
logstore: "com-usage-origin"
|
|
139
|
-
});
|
|
140
110
|
}
|
|
141
|
-
|
|
142
|
-
return
|
|
111
|
+
// @ts-ignore
|
|
112
|
+
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';
|
|
143
113
|
};
|
|
144
|
-
|
|
145
114
|
var isValidKey = function isValidKey(key, object) {
|
|
146
115
|
return key in object;
|
|
147
116
|
};
|
|
148
|
-
|
|
149
|
-
export { getHistoryTag, setHistoryTag, removeHistoryTagItem, getTagByFileds, checkNoIndexListFormat, getSelectOptionAdatp, getEnv, getLogger, isValidKey };
|
|
117
|
+
export { getHistoryTag, setHistoryTag, removeHistoryTagItem, getTagByFileds, checkNoIndexListFormat, getSelectOptionAdatp, getEnv, isValidKey };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const SearchConditionSelectPrefix: (props: any) => JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const SearchConditionSelectPrefix: (props: any) => React.JSX.Element;
|
|
3
3
|
export default SearchConditionSelectPrefix;
|
|
@@ -1,30 +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
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 _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
-
|
|
18
12
|
var _consoleComponents = require("@alicloud/console-components");
|
|
19
|
-
|
|
13
|
+
var _excluded = ["defaultValue", "dataSource", "label"];
|
|
20
14
|
var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
|
|
21
15
|
var _dataSource$, _dataSource$$children;
|
|
22
|
-
|
|
23
16
|
var defaultValue = props.defaultValue,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
_props$dataSource = props.dataSource,
|
|
18
|
+
dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
|
|
19
|
+
label = props.label,
|
|
20
|
+
reset = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
28
21
|
var noSelect = dataSource.length < 2 && ((_dataSource$ = dataSource[0]) === null || _dataSource$ === void 0 ? void 0 : (_dataSource$$children = _dataSource$.children) === null || _dataSource$$children === void 0 ? void 0 : _dataSource$$children.length) < 2;
|
|
29
22
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
30
23
|
className: (0, _classnames.default)('condition-item')
|
|
@@ -44,7 +37,7 @@ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
|
|
|
44
37
|
dataSource: dataSource,
|
|
45
38
|
itemRender: function itemRender(_ref) {
|
|
46
39
|
var label = _ref.label,
|
|
47
|
-
|
|
40
|
+
value = _ref.value;
|
|
48
41
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
49
42
|
"data-value": value
|
|
50
43
|
}, label);
|
|
@@ -54,6 +47,4 @@ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
|
|
|
54
47
|
popupClassName: "rc-search-prefix"
|
|
55
48
|
})));
|
|
56
49
|
};
|
|
57
|
-
|
|
58
|
-
var _default = SearchConditionSelectPrefix;
|
|
59
|
-
exports.default = _default;
|
|
50
|
+
var _default = exports.default = SearchConditionSelectPrefix;
|