@alicloud/console-components-search 0.1.0 → 0.1.1
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 +5 -13
- package/demos/demo2.demo.tsx +4 -31
- package/demos/demo3.demo.tsx +5 -33
- package/demos/demo4.demo.tsx +0 -2
- package/dist/index.js +9 -9
- package/doc-dist/10.js +1 -1
- package/doc-dist/11.js +1 -1
- package/doc-dist/12.js +1 -1
- package/doc-dist/13.js +1 -1
- package/doc-dist/17.js +1 -1
- package/doc-dist/deps/main.js +9 -9
- package/doc-dist/log-deps-build.log +3 -3
- package/es/modeSingleMulti/index.js +87 -124
- package/es/modeSingleSingle/index.js +11 -7
- package/es/search.js +3 -2
- package/es/searchTagList/index.js +6 -3
- package/es/style.js +9 -4
- package/lib/modeSingleMulti/index.d.ts +2 -4
- package/lib/modeSingleMulti/index.js +86 -119
- package/lib/modeSingleSingle/index.d.ts +2 -4
- package/lib/modeSingleSingle/index.js +11 -6
- package/lib/provider/LoggerProvider.d.ts +1 -1
- package/lib/search.js +3 -2
- package/lib/searchTagList/index.d.ts +2 -4
- package/lib/searchTagList/index.js +6 -2
- package/lib/style.d.ts +12 -4
- package/lib/style.js +8 -4
- package/lib/types/IRcSearchProps.type.d.ts +4 -8
- package/package.json +2 -4
|
@@ -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
|
|
4
|
+
✔ Webpack: Compiled successfully in 10.35s
|
|
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.46 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.46 MiB)
|
|
11
11
|
main.css
|
|
12
12
|
main.js
|
|
13
13
|
,webpack performance recommendations:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
|
|
@@ -9,28 +9,23 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
10
|
|
|
11
11
|
import React, { useState, useEffect } from "react";
|
|
12
|
-
import classNames from 'classnames';
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
import { getHistoryTag as getHistoryTagUtil, setHistoryTag as setHistoryTagUtil, removeHistoryTagItem as removeHistoryTagItemUtils, getTagByFileds, checkNoIndexListFormat, getSelectOptionAdatp } from "../utils"; // import '../index.less'
|
|
17
|
-
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import { Button, Icon, Tag, Select, ConfigProvider } from '@alicloud/console-components';
|
|
14
|
+
import { getHistoryTag as getHistoryTagUtil, setHistoryTag as setHistoryTagUtil, removeHistoryTagItem as removeHistoryTagItemUtils, getTagByFileds, checkNoIndexListFormat, getSelectOptionAdatp } from "../utils";
|
|
18
15
|
import { SearchWarp, MultiBtnWarp, MenuContentWrap } from "../style";
|
|
19
16
|
var TagGroup = Tag.Group,
|
|
20
17
|
ClosableTag = Tag.Closeable;
|
|
21
18
|
var AutoComplete = Select.AutoComplete;
|
|
22
19
|
|
|
23
20
|
var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
24
|
-
var
|
|
25
|
-
options = props.options,
|
|
21
|
+
var options = props.options,
|
|
26
22
|
defaultDataIndex = props.defaultDataIndex,
|
|
27
23
|
defaultPlaceholder = props.defaultPlaceholder,
|
|
28
24
|
tags = props.tags,
|
|
29
25
|
onSuggest = props.onSuggest,
|
|
30
26
|
onSuggestNoDataIndex = props.onSuggestNoDataIndex,
|
|
31
|
-
onChange = props.onChange,
|
|
32
27
|
onSearch = props.onSearch,
|
|
33
|
-
|
|
28
|
+
prefix = props.prefix;
|
|
34
29
|
|
|
35
30
|
var _useState = useState({}),
|
|
36
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -89,8 +84,8 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
89
84
|
|
|
90
85
|
var _useState23 = useState([]),
|
|
91
86
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
historyList = _useState24[0],
|
|
88
|
+
setHistoryList = _useState24[1];
|
|
94
89
|
|
|
95
90
|
var _useState25 = useState(''),
|
|
96
91
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
@@ -104,11 +99,12 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
104
99
|
setFocusClass = _useState28[1]; // focus/''
|
|
105
100
|
|
|
106
101
|
|
|
102
|
+
console.log('prefix', prefix);
|
|
107
103
|
useEffect(function () {
|
|
108
104
|
var initHisTags = getHistoryTagUtil();
|
|
109
105
|
|
|
110
106
|
if (initHisTags) {
|
|
111
|
-
|
|
107
|
+
setHistoryList(initHisTags);
|
|
112
108
|
}
|
|
113
109
|
|
|
114
110
|
initCurType();
|
|
@@ -135,14 +131,7 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
135
131
|
|
|
136
132
|
|
|
137
133
|
setCurType(initCurType);
|
|
138
|
-
}
|
|
139
|
-
// let defaultItem2 = options.find((x:any) => x.template === 'input')
|
|
140
|
-
// if (defaultItem2) {
|
|
141
|
-
// console.log(defaultItem2)
|
|
142
|
-
// setDefaultOptionItem(defaultItem2);
|
|
143
|
-
// }
|
|
144
|
-
// }
|
|
145
|
-
|
|
134
|
+
}
|
|
146
135
|
|
|
147
136
|
var level1DataSourceTemp = [{
|
|
148
137
|
label: '选择筛选条件',
|
|
@@ -161,17 +150,19 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
161
150
|
|
|
162
151
|
var menuPropsLevel1 = {
|
|
163
152
|
focusable: false,
|
|
164
|
-
header: /*#__PURE__*/React.createElement(MenuContentWrap,
|
|
153
|
+
header: /*#__PURE__*/React.createElement(MenuContentWrap, {
|
|
154
|
+
prefix: ""
|
|
155
|
+
}, defaultDataIndex && defaultDataIndex !== '' && historyList && historyList.length > 0 && defaultInputValue === '' && /*#__PURE__*/React.createElement("li", {
|
|
165
156
|
role: "option",
|
|
166
157
|
title: "\u5386\u53F2\u641C\u7D22\u8BB0\u5F55",
|
|
167
|
-
className: "
|
|
158
|
+
className: "".concat(prefix, "menu-group-label")
|
|
168
159
|
}, /*#__PURE__*/React.createElement("div", {
|
|
169
|
-
className: "
|
|
170
|
-
}, "\u5386\u53F2\u641C\u7D22\u8BB0\u5F55")), defaultDataIndex && defaultDataIndex !== '' &&
|
|
160
|
+
className: "".concat(prefix, "menu-item-inner")
|
|
161
|
+
}, "\u5386\u53F2\u641C\u7D22\u8BB0\u5F55")), defaultDataIndex && defaultDataIndex !== '' && historyList && historyList.length > 0 && defaultInputValue === '' && /*#__PURE__*/React.createElement(TagGroup, {
|
|
171
162
|
style: {
|
|
172
163
|
paddingLeft: '20px'
|
|
173
164
|
}
|
|
174
|
-
},
|
|
165
|
+
}, historyList.map(function (tag, index) {
|
|
175
166
|
return tag ? /*#__PURE__*/React.createElement(ClosableTag, {
|
|
176
167
|
size: "small",
|
|
177
168
|
key: tag.dataIndex + tag.value + index,
|
|
@@ -190,7 +181,9 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
190
181
|
var menuProps = {
|
|
191
182
|
focusable: false,
|
|
192
183
|
header: null,
|
|
193
|
-
footer: /*#__PURE__*/React.createElement(MultiBtnWarp,
|
|
184
|
+
footer: /*#__PURE__*/React.createElement(MultiBtnWarp, {
|
|
185
|
+
prefix: prefix
|
|
186
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
194
187
|
size: "small",
|
|
195
188
|
className: classNames("pri-btn"),
|
|
196
189
|
disabled: multipleValues.length === 0,
|
|
@@ -216,7 +209,7 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
216
209
|
var key = searchKey.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
217
210
|
var reg = new RegExp("(".concat(key, ")"), 'ig');
|
|
218
211
|
label = label.replace(reg, function (x) {
|
|
219
|
-
return "<span class=\"
|
|
212
|
+
return "<span class=\"".concat(prefix, "select-highlight\" style=\"background-color: #EFF3F8;font-weight: 500;\">").concat(x, "</span>");
|
|
220
213
|
});
|
|
221
214
|
}
|
|
222
215
|
|
|
@@ -234,54 +227,46 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
234
227
|
return v === item.value;
|
|
235
228
|
})) {
|
|
236
229
|
isChecked = true;
|
|
237
|
-
}
|
|
238
|
-
|
|
230
|
+
}
|
|
239
231
|
|
|
240
232
|
return /*#__PURE__*/React.createElement("label", {
|
|
241
|
-
className: classNames(
|
|
233
|
+
className: classNames("".concat(prefix, "-checkbox-wrapper"), 'multi-lable', isChecked ? 'checked' : ''),
|
|
242
234
|
style: {
|
|
243
235
|
paddingLeft: '8px'
|
|
244
236
|
}
|
|
245
237
|
}, /*#__PURE__*/React.createElement("span", {
|
|
246
|
-
className: "
|
|
238
|
+
className: "".concat(prefix, "checkbox")
|
|
247
239
|
}, /*#__PURE__*/React.createElement("span", {
|
|
248
|
-
className: "
|
|
240
|
+
className: "".concat(prefix, "checkbox-inner")
|
|
249
241
|
}, /*#__PURE__*/React.createElement("i", {
|
|
250
|
-
className: "
|
|
242
|
+
className: "".concat(prefix, "icon ").concat(prefix, "icon-select ").concat(prefix, "xs ").concat(prefix, "checkbox-select-icon")
|
|
251
243
|
})), /*#__PURE__*/React.createElement("input", {
|
|
252
244
|
type: "checkbox",
|
|
253
|
-
className: "
|
|
245
|
+
className: "".concat(prefix, "checkbox-input"),
|
|
254
246
|
defaultChecked: isChecked
|
|
255
247
|
})), /*#__PURE__*/React.createElement("span", {
|
|
256
|
-
className: "
|
|
248
|
+
className: "".concat(prefix, "checkbox-label")
|
|
257
249
|
}, item.label));
|
|
258
250
|
};
|
|
259
251
|
|
|
260
252
|
function onRemoveHisTag(tagItem) {
|
|
261
253
|
var newHisTags = removeHistoryTagItemUtils(tagItem);
|
|
262
|
-
|
|
254
|
+
setHistoryList(newHisTags);
|
|
263
255
|
}
|
|
264
256
|
|
|
265
257
|
function onSelectHisTag(tagItem) {
|
|
266
258
|
var changeFileds = Object.create({});
|
|
267
259
|
var tempAllFileds = Object.create({});
|
|
268
260
|
changeFileds[tagItem.dataIndex] = tagItem.value;
|
|
269
|
-
|
|
270
|
-
if (mode === 'single-multi') {
|
|
271
|
-
tempAllFileds = changeFileds;
|
|
272
|
-
} else if (mode === 'multi-multi') {
|
|
273
|
-
tempAllFileds = _objectSpread(_objectSpread({}, allFileds), changeFileds);
|
|
274
|
-
}
|
|
275
|
-
|
|
261
|
+
tempAllFileds = changeFileds;
|
|
276
262
|
onChangeItem(changeFileds, tempAllFileds);
|
|
277
263
|
}
|
|
278
264
|
|
|
279
|
-
function
|
|
280
|
-
// const allFiledsTagList = getTagByFileds(allFileds, options);
|
|
265
|
+
function updateHistory() {
|
|
281
266
|
var allFiledsTagList = _toConsumableArray(tagList);
|
|
282
267
|
|
|
283
268
|
var rtHisTags = setHistoryTagUtil(allFiledsTagList);
|
|
284
|
-
|
|
269
|
+
setHistoryList(rtHisTags);
|
|
285
270
|
}
|
|
286
271
|
|
|
287
272
|
function checkAllFromTags(allFileds) {
|
|
@@ -297,21 +282,15 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
297
282
|
}
|
|
298
283
|
|
|
299
284
|
return allFiledsAdapt;
|
|
300
|
-
} // 某一类别确定时,修改
|
|
285
|
+
} // 某一类别确定时,修改filed
|
|
301
286
|
|
|
302
287
|
|
|
303
288
|
function onChangeItem(changeFileds, allFileds) {
|
|
304
289
|
setDefaultVisible(false);
|
|
305
290
|
setAllFileds(allFileds); // todo
|
|
306
291
|
|
|
307
|
-
if (
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
if (onTagChange) {
|
|
312
|
-
var newTags = getTagByFileds(allFileds, options);
|
|
313
|
-
setTagList(newTags);
|
|
314
|
-
onTagChange(newTags);
|
|
292
|
+
if (onSearch) {
|
|
293
|
+
onSearch(getTagByFileds(allFileds, options));
|
|
315
294
|
} // 仅仅清空值, 保留类别
|
|
316
295
|
|
|
317
296
|
|
|
@@ -353,16 +332,8 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
353
332
|
if (onChangeItem) {
|
|
354
333
|
var changeFileds = Object.create({});
|
|
355
334
|
changeFileds[dataIndex] = multipleValues;
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
setAllFileds(changeFileds);
|
|
359
|
-
onChangeItem(changeFileds, changeFileds);
|
|
360
|
-
} else if (mode === 'multi-multi') {
|
|
361
|
-
allFileds[dataIndex] = multipleValues;
|
|
362
|
-
setAllFileds(allFileds);
|
|
363
|
-
onChangeItem(changeFileds, allFileds);
|
|
364
|
-
}
|
|
365
|
-
|
|
335
|
+
setAllFileds(changeFileds);
|
|
336
|
+
onChangeItem(changeFileds, changeFileds);
|
|
366
337
|
setMultipleValues([]);
|
|
367
338
|
}
|
|
368
339
|
} // 多选的change,仅改变state
|
|
@@ -389,8 +360,7 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
389
360
|
while (1) {
|
|
390
361
|
switch (_context.prev = _context.next) {
|
|
391
362
|
case 0:
|
|
392
|
-
|
|
393
|
-
setClearLevel1Show(true); // console.log('defaultInputValue', defaultInputValue)
|
|
363
|
+
setClearLevel1Show(true);
|
|
394
364
|
|
|
395
365
|
if (!(actionType === 'itemClick')) {
|
|
396
366
|
_context.next = 5;
|
|
@@ -412,7 +382,6 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
412
382
|
|
|
413
383
|
setVisible(true);
|
|
414
384
|
} else if (curType === 'default' && defaultDataIndex && defaultDataIndex !== '') {
|
|
415
|
-
// 选了suggest
|
|
416
385
|
inputChange(value, 'itemClick', defaultDataIndex);
|
|
417
386
|
setDefaultValue('');
|
|
418
387
|
setLevel1DataSource(level1DataSourceTemp);
|
|
@@ -424,50 +393,60 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
424
393
|
}
|
|
425
394
|
}
|
|
426
395
|
|
|
427
|
-
_context.next =
|
|
396
|
+
_context.next = 24;
|
|
428
397
|
break;
|
|
429
398
|
|
|
430
399
|
case 5:
|
|
431
400
|
if (!(actionType === 'change')) {
|
|
432
|
-
_context.next =
|
|
401
|
+
_context.next = 24;
|
|
433
402
|
break;
|
|
434
403
|
}
|
|
435
404
|
|
|
436
405
|
if (!(!value || value === '')) {
|
|
437
|
-
_context.next =
|
|
406
|
+
_context.next = 11;
|
|
438
407
|
break;
|
|
439
408
|
}
|
|
440
409
|
|
|
410
|
+
// 如果是删除为空的情况,需要还原 AutoComplete 中的 dataSource
|
|
441
411
|
setLevel1DataSource(level1DataSourceTemp);
|
|
442
|
-
|
|
412
|
+
setDefaultVisible(true);
|
|
413
|
+
_context.next = 23;
|
|
443
414
|
break;
|
|
444
415
|
|
|
445
|
-
case
|
|
416
|
+
case 11:
|
|
446
417
|
if (!(defaultDataIndex && defaultDataIndex !== '' && onSuggest)) {
|
|
447
|
-
_context.next =
|
|
418
|
+
_context.next = 16;
|
|
448
419
|
break;
|
|
449
420
|
}
|
|
450
421
|
|
|
451
|
-
_context.next =
|
|
422
|
+
_context.next = 14;
|
|
452
423
|
return setDefSuggest(value);
|
|
453
424
|
|
|
454
|
-
case
|
|
455
|
-
_context.next =
|
|
425
|
+
case 14:
|
|
426
|
+
_context.next = 23;
|
|
456
427
|
break;
|
|
457
428
|
|
|
458
|
-
case
|
|
429
|
+
case 16:
|
|
459
430
|
if (!onSuggestNoDataIndex) {
|
|
460
|
-
_context.next =
|
|
431
|
+
_context.next = 21;
|
|
461
432
|
break;
|
|
462
433
|
}
|
|
463
434
|
|
|
464
|
-
_context.next =
|
|
435
|
+
_context.next = 19;
|
|
465
436
|
return setNoDefSuggest(value);
|
|
466
437
|
|
|
467
|
-
case
|
|
438
|
+
case 19:
|
|
439
|
+
_context.next = 23;
|
|
440
|
+
break;
|
|
441
|
+
|
|
442
|
+
case 21:
|
|
443
|
+
setLevel1DataSource([]);
|
|
444
|
+
setDefaultVisible(false);
|
|
445
|
+
|
|
446
|
+
case 23:
|
|
468
447
|
setDefaultValue(value);
|
|
469
448
|
|
|
470
|
-
case
|
|
449
|
+
case 24:
|
|
471
450
|
case "end":
|
|
472
451
|
return _context.stop();
|
|
473
452
|
}
|
|
@@ -598,29 +577,21 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
598
577
|
switch (_context4.prev = _context4.next) {
|
|
599
578
|
case 0:
|
|
600
579
|
if (!((actionType === 'itemClick' || actionType === 'enter') && onChangeItem)) {
|
|
601
|
-
_context4.next =
|
|
580
|
+
_context4.next = 10;
|
|
602
581
|
break;
|
|
603
582
|
}
|
|
604
583
|
|
|
605
584
|
changeFileds = Object.create({});
|
|
606
585
|
changeFileds[dataIndex] = value;
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
setAllFileds(changeFileds);
|
|
610
|
-
onChangeItem(changeFileds, changeFileds);
|
|
611
|
-
} else if (mode === 'multi-multi') {
|
|
612
|
-
allFileds[dataIndex] = value;
|
|
613
|
-
setAllFileds(allFileds);
|
|
614
|
-
onChangeItem(changeFileds, allFileds);
|
|
615
|
-
}
|
|
616
|
-
|
|
586
|
+
setAllFileds(changeFileds);
|
|
587
|
+
onChangeItem(changeFileds, changeFileds);
|
|
617
588
|
setVisible(false);
|
|
618
589
|
setDefaultVisible(false);
|
|
619
590
|
setInputDataSource([]);
|
|
620
|
-
_context4.next =
|
|
591
|
+
_context4.next = 20;
|
|
621
592
|
break;
|
|
622
593
|
|
|
623
|
-
case
|
|
594
|
+
case 10:
|
|
624
595
|
if (value === '') {
|
|
625
596
|
setInputDataSource([]);
|
|
626
597
|
setClearLevel1Show(true);
|
|
@@ -631,14 +602,14 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
631
602
|
setInputValue(value);
|
|
632
603
|
|
|
633
604
|
if (!(value !== '' && onSuggest)) {
|
|
634
|
-
_context4.next =
|
|
605
|
+
_context4.next = 20;
|
|
635
606
|
break;
|
|
636
607
|
}
|
|
637
608
|
|
|
638
|
-
_context4.next =
|
|
609
|
+
_context4.next = 15;
|
|
639
610
|
return onSuggest(value, dataIndex);
|
|
640
611
|
|
|
641
|
-
case
|
|
612
|
+
case 15:
|
|
642
613
|
list = _context4.sent;
|
|
643
614
|
// console.log('res suggest', list);
|
|
644
615
|
newDataSource = [{
|
|
@@ -649,7 +620,7 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
649
620
|
setVisible(true);
|
|
650
621
|
setDefaultVisible(true);
|
|
651
622
|
|
|
652
|
-
case
|
|
623
|
+
case 20:
|
|
653
624
|
case "end":
|
|
654
625
|
return _context4.stop();
|
|
655
626
|
}
|
|
@@ -660,23 +631,14 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
660
631
|
}
|
|
661
632
|
|
|
662
633
|
function selectChange(value, dataIndex) {
|
|
663
|
-
// setSingleValues(value);
|
|
664
634
|
setVisible(false);
|
|
665
635
|
setFocusClass('');
|
|
666
636
|
|
|
667
637
|
if (onChangeItem) {
|
|
668
638
|
var changeFileds = Object.create({});
|
|
669
639
|
changeFileds[dataIndex] = value;
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
// 判断value 是否为undefined
|
|
673
|
-
setAllFileds(changeFileds);
|
|
674
|
-
onChangeItem(changeFileds, changeFileds);
|
|
675
|
-
} else if (mode === 'multi-multi') {
|
|
676
|
-
allFileds[dataIndex] = value;
|
|
677
|
-
setAllFileds(allFileds);
|
|
678
|
-
onChangeItem(changeFileds, allFileds);
|
|
679
|
-
}
|
|
640
|
+
setAllFileds(changeFileds);
|
|
641
|
+
onChangeItem(changeFileds, changeFileds);
|
|
680
642
|
}
|
|
681
643
|
} // 提交按钮
|
|
682
644
|
|
|
@@ -686,12 +648,14 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
686
648
|
var checkAllFileds = checkAllFromTags(allFileds);
|
|
687
649
|
onSearch(checkAllFileds); // todo: 只有搜索了才会被记录到,根据页面的路由为key,history
|
|
688
650
|
|
|
689
|
-
|
|
651
|
+
updateHistory();
|
|
690
652
|
}
|
|
691
653
|
}
|
|
692
654
|
|
|
693
|
-
return /*#__PURE__*/React.createElement(SearchWarp,
|
|
694
|
-
|
|
655
|
+
return /*#__PURE__*/React.createElement(SearchWarp, {
|
|
656
|
+
prefix: prefix
|
|
657
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
658
|
+
className: classNames('left-wrap', "".concat(prefix, "input"), focusClass)
|
|
695
659
|
}, /*#__PURE__*/React.createElement("div", {
|
|
696
660
|
className: classNames('condition')
|
|
697
661
|
}, curType === 'item' && /*#__PURE__*/React.createElement("div", {
|
|
@@ -720,7 +684,7 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
720
684
|
,
|
|
721
685
|
itemRender: itemRender,
|
|
722
686
|
onChange: onLevel1Change,
|
|
723
|
-
popupStyle:
|
|
687
|
+
popupStyle: historyList && historyList.length > 0 ? {} : {
|
|
724
688
|
width: 'auto'
|
|
725
689
|
},
|
|
726
690
|
visible: defaultVisible,
|
|
@@ -739,7 +703,7 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
739
703
|
hasClear: true,
|
|
740
704
|
hasBorder: false,
|
|
741
705
|
menuProps: menuPropsLevel1,
|
|
742
|
-
popupStyle:
|
|
706
|
+
popupStyle: historyList && historyList.length > 0 ? {} : {
|
|
743
707
|
width: 'auto'
|
|
744
708
|
} // @ts-ignore
|
|
745
709
|
,
|
|
@@ -788,7 +752,7 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
788
752
|
selectChange(value, curOptionItem.dataIndex);
|
|
789
753
|
},
|
|
790
754
|
popupStyle: {
|
|
791
|
-
|
|
755
|
+
width: 'auto'
|
|
792
756
|
},
|
|
793
757
|
autoFocus: true,
|
|
794
758
|
visible: visible,
|
|
@@ -835,20 +799,19 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
835
799
|
onMultipleChange(value);
|
|
836
800
|
},
|
|
837
801
|
popupStyle: {
|
|
838
|
-
|
|
839
|
-
padding: '10px 8px 10px 8px'
|
|
802
|
+
width: 'auto'
|
|
840
803
|
}
|
|
841
804
|
}), clearLevel1Show && /*#__PURE__*/React.createElement("div", {
|
|
842
805
|
className: "clear-level1",
|
|
843
806
|
onClick: onClearLevel1
|
|
844
807
|
}, /*#__PURE__*/React.createElement("span", {
|
|
845
|
-
className: "
|
|
808
|
+
className: "".concat(prefix, "input-control")
|
|
846
809
|
}, /*#__PURE__*/React.createElement("span", {
|
|
847
|
-
className: "
|
|
810
|
+
className: "".concat(prefix, "input-hint-wrap")
|
|
848
811
|
}, /*#__PURE__*/React.createElement("i", {
|
|
849
812
|
role: "button",
|
|
850
813
|
"aria-label": "\u6E05\u9664",
|
|
851
|
-
className: "
|
|
814
|
+
className: "".concat(prefix, "icon ").concat(prefix, "icon-delete-filling ").concat(prefix, "medium ").concat(prefix, "input-hint ").concat(prefix, "input-clear-icon")
|
|
852
815
|
})))))), /*#__PURE__*/React.createElement("div", {
|
|
853
816
|
className: classNames('right-wrap')
|
|
854
817
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -859,4 +822,4 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
859
822
|
}))));
|
|
860
823
|
};
|
|
861
824
|
|
|
862
|
-
export default ModeSingleSingle;
|
|
825
|
+
export default ConfigProvider.config(ModeSingleSingle);
|
|
@@ -4,7 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import React, { useState } from "react";
|
|
5
5
|
import classNames from 'classnames'; // import styled from "styled-components";
|
|
6
6
|
|
|
7
|
-
import { Button, Icon, Select } from '@alicloud/console-components';
|
|
7
|
+
import { Button, ConfigProvider, Icon, Select } from '@alicloud/console-components';
|
|
8
8
|
import { SearchWarp } from "../style";
|
|
9
9
|
import { getSelectOptionAdatp } from '../utils';
|
|
10
10
|
var AutoComplete = Select.AutoComplete;
|
|
@@ -13,7 +13,9 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
13
13
|
var options = props.options,
|
|
14
14
|
onSuggest = props.onSuggest,
|
|
15
15
|
onChange = props.onChange,
|
|
16
|
-
onSearch = props.onSearch
|
|
16
|
+
onSearch = props.onSearch,
|
|
17
|
+
_props$prefix = props.prefix,
|
|
18
|
+
prefix = _props$prefix === void 0 ? "next-" : _props$prefix;
|
|
17
19
|
var optionItem = options[0];
|
|
18
20
|
|
|
19
21
|
if (!optionItem.templateProps) {
|
|
@@ -47,7 +49,7 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
47
49
|
var key = searchKey.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
48
50
|
var reg = new RegExp("(".concat(key, ")"), 'ig');
|
|
49
51
|
label = label.replace(reg, function (x) {
|
|
50
|
-
return "<span class=\"
|
|
52
|
+
return "<span class=\"".concat(prefix, "-select-highlight\" style=\"background-color: #EFF3F8;font-weight: 500;\">").concat(x, "</span>");
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
55
|
|
|
@@ -164,8 +166,10 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
168
|
|
|
167
|
-
return /*#__PURE__*/React.createElement(SearchWarp,
|
|
168
|
-
|
|
169
|
+
return /*#__PURE__*/React.createElement(SearchWarp, {
|
|
170
|
+
prefix: prefix
|
|
171
|
+
}, optionItem.template === 'input' && /*#__PURE__*/React.createElement("div", {
|
|
172
|
+
className: classNames('left-wrap', "".concat(prefix, "input"))
|
|
169
173
|
}, /*#__PURE__*/React.createElement(AutoComplete, {
|
|
170
174
|
className: classNames('main-input', 'single'),
|
|
171
175
|
placeholder: optionItem.templateProps.placeholder || "\u9ED8\u8BA4\u6309".concat(optionItem.label, "\u641C\u7D22"),
|
|
@@ -183,7 +187,7 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
183
187
|
inputChange(value, actionType, optionItem.dataIndex);
|
|
184
188
|
}
|
|
185
189
|
})), optionItem.template === 'select' && /*#__PURE__*/React.createElement("div", {
|
|
186
|
-
className: classNames('left-wrap',
|
|
190
|
+
className: classNames('left-wrap', "".concat(prefix, "input"))
|
|
187
191
|
}, /*#__PURE__*/React.createElement("div", {
|
|
188
192
|
className: classNames('condition')
|
|
189
193
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -210,4 +214,4 @@ var ModeSingleSingle = function ModeSingleSingle(props) {
|
|
|
210
214
|
}))));
|
|
211
215
|
};
|
|
212
216
|
|
|
213
|
-
export default ModeSingleSingle;
|
|
217
|
+
export default ConfigProvider.config(ModeSingleSingle);
|
package/es/search.js
CHANGED
|
@@ -10,7 +10,8 @@ var SearchWrap = styled.div.withConfig({
|
|
|
10
10
|
})(["height:32px;width:400px;display:inline-block;vertical-align:top;"]);
|
|
11
11
|
export var Search = function Search(props) {
|
|
12
12
|
var className = props.className,
|
|
13
|
-
|
|
13
|
+
_props$simple = props.simple,
|
|
14
|
+
simple = _props$simple === void 0 ? false : _props$simple,
|
|
14
15
|
style = props.style;
|
|
15
16
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LoggerProvider, {
|
|
16
17
|
regionId: props.regionId,
|
|
@@ -19,5 +20,5 @@ export var Search = function Search(props) {
|
|
|
19
20
|
}), /*#__PURE__*/React.createElement(SearchWrap, {
|
|
20
21
|
className: classNames(baseClassName, className),
|
|
21
22
|
style: style
|
|
22
|
-
},
|
|
23
|
+
}, simple ? /*#__PURE__*/React.createElement(ModeSingleSingle, props) : /*#__PURE__*/React.createElement(ModeSingleMulti, props)));
|
|
23
24
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { Tag } from '@alicloud/console-components';
|
|
4
|
+
import { ConfigProvider, Tag } from '@alicloud/console-components';
|
|
5
5
|
import LoggerProvider from '../provider/LoggerProvider';
|
|
6
6
|
import { TagListWrap } from '../style';
|
|
7
7
|
import { baseTagListClassName } from '../constants';
|
|
@@ -12,7 +12,9 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
12
12
|
var tagList = props.tagList,
|
|
13
13
|
className = props.className,
|
|
14
14
|
style = props.style,
|
|
15
|
-
onChange = props.onChange
|
|
15
|
+
onChange = props.onChange,
|
|
16
|
+
_props$prefix = props.prefix,
|
|
17
|
+
prefix = _props$prefix === void 0 ? "next-" : _props$prefix;
|
|
16
18
|
|
|
17
19
|
function onRemoveTag(item) {
|
|
18
20
|
var newTagList = _toConsumableArray(tagList);
|
|
@@ -33,6 +35,7 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
return /*#__PURE__*/React.createElement(TagListWrap, {
|
|
38
|
+
prefix: prefix,
|
|
36
39
|
className: classNames(baseTagListClassName, className),
|
|
37
40
|
style: style
|
|
38
41
|
}, /*#__PURE__*/React.createElement(LoggerProvider, {
|
|
@@ -55,4 +58,4 @@ var SearchTagList = function SearchTagList(props) {
|
|
|
55
58
|
}, "\u6E05\u9664\u7B5B\u9009\u6761\u4EF6")));
|
|
56
59
|
};
|
|
57
60
|
|
|
58
|
-
export default SearchTagList;
|
|
61
|
+
export default ConfigProvider.config(SearchTagList);
|
package/es/style.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
var prefix = function prefix(props) {
|
|
4
|
+
return props.prefix ? ".".concat(props.prefix) : '.next-';
|
|
5
|
+
};
|
|
6
|
+
|
|
2
7
|
var SearchWarp = styled.div.withConfig({
|
|
3
8
|
componentId: "sc-1afc1cn-0"
|
|
4
|
-
})(["height:100%;width:100%;display:flex;.left-wrap{flex:1;border-left:1px solid rgba(192,198,204,1);border-bottom:1px solid rgba(192,198,204,1);border-top:1px solid rgba(192,198,204,1);border-right:1px solid rgba(192,198,204,1);display:flex;border-bottom-left-radius:2px;border-top-left-radius:2px;&.focus{border:1px solid #0064c8;}.condition{height:26px;display:inline-block;margin-top:2px;}.condition-item{height:26px;display:inline-block;line-height:26px;background:#EFF3F8;border-radius:2px;background-color:#EFF3F8;padding:0 8px;margin:0 2px;font-size:12px;color:#333;position:relative;&-txt{padding-right:4px;}&:hover{background-color:#E0E4E8;}}.condition-select{width:100%;height:100%;opacity:0;position:absolute;top:0;left:0;min-width:auto
|
|
9
|
+
})(["height:100%;width:100%;display:flex;.left-wrap{flex:1;border-left:1px solid rgba(192,198,204,1);border-bottom:1px solid rgba(192,198,204,1);border-top:1px solid rgba(192,198,204,1);border-right:1px solid rgba(192,198,204,1);display:flex;border-bottom-left-radius:2px;border-top-left-radius:2px;&.focus{border:1px solid #0064c8;}.condition{height:26px;display:inline-block;margin-top:2px;}.condition-item{height:26px;display:inline-block;line-height:26px;background:#EFF3F8;border-radius:2px;background-color:#EFF3F8;padding:0 8px;margin:0 2px;font-size:12px;color:#333;position:relative;&-txt{padding-right:4px;}&:hover{background-color:#E0E4E8;}}.condition-select{width:100%;height:100%;opacity:0;position:absolute;top:0;left:0;min-width:auto;", "select-inner{min-width:auto;}}.forms{flex:1;position:relative;.clear-level1{position:absolute;top:1px;right:1px;height:28px;width:30px;background-color:#fff;z-index:99;color:#333;text-align:center;line-height:28px;font-size:12px;cursor:pointer;padding:6px 0 0 6px;}}.main-input{height:auto;border:none;box-shadow:none;&.single{flex:1;}&.select{width:100%;}&.multi{width:100%;}", "input,", "-input{height:auto;box-shadow:none;}}", "-input", "-medium{height:auto;}}.right-wrap{width:32px;.search-btn{width:32px;padding:0 !important;border-bottom-left-radius:0;border-top-left-radius:0;border-left:none;}}"], prefix, prefix, prefix, prefix, prefix);
|
|
5
10
|
var MenuContentWrap = styled.ul.withConfig({
|
|
6
11
|
componentId: "sc-1afc1cn-1"
|
|
7
|
-
})(["
|
|
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);
|
|
8
13
|
var MultiBtnWarp = styled.div.withConfig({
|
|
9
14
|
componentId: "sc-1afc1cn-2"
|
|
10
|
-
})(["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;}
|
|
15
|
+
})(["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);
|
|
11
16
|
var TagListWrap = styled.div.withConfig({
|
|
12
17
|
componentId: "sc-1afc1cn-3"
|
|
13
|
-
})(["
|
|
18
|
+
})(["", "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']:hover::before{color:#181818;}&& [class*='-icon-close']::before{color:#808080;content:var(--icon-content-delete-filling);}.remove-btn{margin-bottom:8px;line-height:24px;display:inline-block;vertical-align:middle;cursor:pointer;}"], prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix);
|
|
14
19
|
export { SearchWarp, MultiBtnWarp, TagListWrap, MenuContentWrap };
|