@alicloud/console-components-search 0.2.37-alpha.5 → 0.2.37-alpha.6
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/demos/demo1.demo.tsx +116 -1
- package/dist/index.js +13 -1
- package/es/ComplexSearch/index.js +12 -1
- package/lib/ComplexSearch/index.js +12 -1
- package/package.json +1 -1
package/demos/demo1.demo.tsx
CHANGED
|
@@ -58,6 +58,121 @@ const options2 = [
|
|
|
58
58
|
},
|
|
59
59
|
];
|
|
60
60
|
|
|
61
|
+
const intl = (a) => a;
|
|
62
|
+
|
|
63
|
+
const options3 = [
|
|
64
|
+
{
|
|
65
|
+
dataIndex: 'SourceIp',
|
|
66
|
+
label: intl('flow_analysis.prop.enum', { value: 'SourceIp' }),
|
|
67
|
+
template: 'input',
|
|
68
|
+
// groupName: intl('flow_analysis.prop.enum', { value: 'SourceIp' }),
|
|
69
|
+
children: [
|
|
70
|
+
{
|
|
71
|
+
dataIndex: 'SourceIp_equal',
|
|
72
|
+
label: intl('flow_analysis.prop.enum', { value: 'SourceIp_equal' }),
|
|
73
|
+
template: 'input',
|
|
74
|
+
}, {
|
|
75
|
+
dataIndex: 'SourceIp_like',
|
|
76
|
+
label: intl('flow_analysis.prop.enum', { value: 'SourceIp_like' }),
|
|
77
|
+
template: 'input',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
dataIndex: 'SourceIp_notlike',
|
|
81
|
+
label: intl('flow_analysis.prop.enum', { value: 'SourceIp_notlike' }),
|
|
82
|
+
template: 'input',
|
|
83
|
+
// groupName: intl('flow_analysis.prop.enum', { value: 'SourceIp' }),
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
dataIndex: 'DestinationIp_equal',
|
|
89
|
+
label: intl('flow_analysis.prop.enum', { value: 'DestinationIp_equal' }),
|
|
90
|
+
labelEx: (
|
|
91
|
+
<div>
|
|
92
|
+
<span>
|
|
93
|
+
{intl('flow_analysis.prop.enum', { value: 'DestinationIp_equal' })}
|
|
94
|
+
</span>
|
|
95
|
+
<span>
|
|
96
|
+
{intl('tr_flow_log.search.operator.enum', { value: 'equal' })}
|
|
97
|
+
</span>
|
|
98
|
+
</div>
|
|
99
|
+
),
|
|
100
|
+
template: 'input',
|
|
101
|
+
groupName: intl('flow_analysis.prop.enum', { value: 'DestinationIp' }),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
dataIndex: 'DestinationIp_like',
|
|
105
|
+
label: intl('flow_analysis.prop.enum', { value: 'DestinationIp_like' }),
|
|
106
|
+
labelEx: (
|
|
107
|
+
<div>
|
|
108
|
+
<span>
|
|
109
|
+
{intl('flow_analysis.prop.enum', { value: 'DestinationIp_like' })}
|
|
110
|
+
</span>
|
|
111
|
+
<span>
|
|
112
|
+
{intl('tr_flow_log.search.operator.enum', { value: 'like' })}
|
|
113
|
+
</span>
|
|
114
|
+
</div>
|
|
115
|
+
),
|
|
116
|
+
template: 'input',
|
|
117
|
+
groupName: intl('flow_analysis.prop.enum', { value: 'DestinationIp' }),
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
dataIndex: 'DestinationIp_notlike',
|
|
121
|
+
label: intl('flow_analysis.prop.enum', { value: 'DestinationIp_notlike' }),
|
|
122
|
+
labelEx: (
|
|
123
|
+
<div>
|
|
124
|
+
<span>
|
|
125
|
+
{intl('flow_analysis.prop.enum', { value: 'DestinationIp_notlike' })}
|
|
126
|
+
</span>
|
|
127
|
+
<span>
|
|
128
|
+
{intl('tr_flow_log.search.operator.enum', { value: 'notlike' })}
|
|
129
|
+
</span>
|
|
130
|
+
</div>
|
|
131
|
+
),
|
|
132
|
+
template: 'input',
|
|
133
|
+
groupName: intl('flow_analysis.prop.enum', { value: 'DestinationIp' }),
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
dataIndex: 'Dscp',
|
|
137
|
+
label: intl('flow_analysis.prop.enum', { value: 'Dscp' }),
|
|
138
|
+
template: 'input',
|
|
139
|
+
groupName: intl('flow_analysis.prop.enum', { value: 'Dscp' }),
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
dataIndex: 'Protocol',
|
|
143
|
+
label: intl('flow_analysis.prop.enum', { value: 'Protocol' }),
|
|
144
|
+
template: 'select',
|
|
145
|
+
templateProps: {
|
|
146
|
+
dataSource: [
|
|
147
|
+
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
|
148
|
+
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
|
149
|
+
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 62, 64, 65, 66, 67, 69, 70, 71, 72, 73,
|
|
150
|
+
74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
|
|
151
|
+
97, 98, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 115, 116, 117,
|
|
152
|
+
118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
|
|
153
|
+
136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 255,
|
|
154
|
+
].map((item) => ({
|
|
155
|
+
label: intl('flow_analyzer.detail.protocol.enum', { value: item }),
|
|
156
|
+
value: String(item),
|
|
157
|
+
})),
|
|
158
|
+
},
|
|
159
|
+
groupName: intl('flow_analysis.prop.enum', { value: 'Protocol' }),
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
dataIndex: 'DestinationPort',
|
|
163
|
+
label: intl('flow_analysis.prop.enum', { value: 'DestinationPort' }),
|
|
164
|
+
template: 'input',
|
|
165
|
+
groupName: intl('flow_analysis.prop.enum', { value: 'DestinationPort' }),
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
dataIndex: 'SourcePort',
|
|
169
|
+
label: intl('flow_analysis.prop.enum', { value: 'SourcePort' }),
|
|
170
|
+
template: 'input',
|
|
171
|
+
groupName: intl('flow_analysis.prop.enum', { value: 'SourcePort' }),
|
|
172
|
+
},
|
|
173
|
+
];
|
|
174
|
+
|
|
175
|
+
|
|
61
176
|
const Demo1: React.FC<{}> = (props) => {
|
|
62
177
|
const [filters, setFilters] = useState<any>([
|
|
63
178
|
{ label: '实例名称', value: 'xxxxxx', dataIndex: 'name' },
|
|
@@ -108,7 +223,7 @@ const Demo1: React.FC<{}> = (props) => {
|
|
|
108
223
|
<Search
|
|
109
224
|
defaultDataIndex="name"
|
|
110
225
|
// defaultSelectedDataIndex="name"
|
|
111
|
-
options={
|
|
226
|
+
options={options3}
|
|
112
227
|
prefixSelectMode="cascader"
|
|
113
228
|
onSearch={(value, dataIndex, extra) => {
|
|
114
229
|
// @ts-ignore
|
package/dist/index.js
CHANGED
|
@@ -90337,7 +90337,19 @@ var ComplexSearch = function (props) {
|
|
|
90337
90337
|
*/
|
|
90338
90338
|
var handlerFilterTypeChange = function (type, resetValue) {
|
|
90339
90339
|
if (resetValue === void 0) { resetValue = true; }
|
|
90340
|
-
|
|
90340
|
+
var flatOption = function (opts) {
|
|
90341
|
+
var flattened = [];
|
|
90342
|
+
opts.forEach(function (item) {
|
|
90343
|
+
if (item.children) {
|
|
90344
|
+
flattened.push.apply(flattened, flatOption(item.children));
|
|
90345
|
+
}
|
|
90346
|
+
else {
|
|
90347
|
+
flattened.push(item);
|
|
90348
|
+
}
|
|
90349
|
+
});
|
|
90350
|
+
return flattened;
|
|
90351
|
+
};
|
|
90352
|
+
setSelectedFilterType(flatOption(options).find(function (o) { return getDataIndex(o) === type; }));
|
|
90341
90353
|
resetValue && reset();
|
|
90342
90354
|
};
|
|
90343
90355
|
/**
|
|
@@ -184,7 +184,18 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
184
184
|
*/
|
|
185
185
|
var handlerFilterTypeChange = function handlerFilterTypeChange(type) {
|
|
186
186
|
var resetValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
187
|
-
|
|
187
|
+
var _flatOption = function flatOption(opts) {
|
|
188
|
+
var flattened = [];
|
|
189
|
+
opts.forEach(function (item) {
|
|
190
|
+
if (item.children) {
|
|
191
|
+
flattened.push.apply(flattened, _toConsumableArray(_flatOption(item.children)));
|
|
192
|
+
} else {
|
|
193
|
+
flattened.push(item);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
return flattened;
|
|
197
|
+
};
|
|
198
|
+
setSelectedFilterType(_flatOption(options).find(function (o) {
|
|
188
199
|
return getDataIndex(o) === type;
|
|
189
200
|
}));
|
|
190
201
|
resetValue && reset();
|
|
@@ -193,7 +193,18 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
193
193
|
*/
|
|
194
194
|
var handlerFilterTypeChange = function handlerFilterTypeChange(type) {
|
|
195
195
|
var resetValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
196
|
-
|
|
196
|
+
var _flatOption = function flatOption(opts) {
|
|
197
|
+
var flattened = [];
|
|
198
|
+
opts.forEach(function (item) {
|
|
199
|
+
if (item.children) {
|
|
200
|
+
flattened.push.apply(flattened, (0, _toConsumableArray2.default)(_flatOption(item.children)));
|
|
201
|
+
} else {
|
|
202
|
+
flattened.push(item);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
return flattened;
|
|
206
|
+
};
|
|
207
|
+
setSelectedFilterType(_flatOption(options).find(function (o) {
|
|
197
208
|
return getDataIndex(o) === type;
|
|
198
209
|
}));
|
|
199
210
|
resetValue && reset();
|