@alicloud/console-components-search 0.2.36 → 0.2.37-alpha.0
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 +91 -82
- package/dist/index.js +347 -367
- package/es/ComplexSearch/InputPrefix.js +18 -3
- package/es/ComplexSearch/index.js +5 -1
- package/es/search.js +0 -2
- package/lib/ComplexSearch/InputPrefix.js +17 -2
- package/lib/ComplexSearch/index.js +6 -3
- package/lib/search.js +0 -2
- package/lib/types/IRcSearchProps.type.d.ts +4 -0
- package/package.json +4 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["defaultValue", "dataSource", "label"];
|
|
3
|
+
var _excluded = ["defaultValue", "dataSource", "label", "type"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import { Icon, Select } from '@alicloud/console-components';
|
|
6
|
+
import { Icon, Select, CascaderSelect } from '@alicloud/console-components';
|
|
7
7
|
var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
|
|
8
8
|
var _dataSource$, _dataSource$$children;
|
|
9
9
|
var defaultValue = props.defaultValue,
|
|
10
10
|
_props$dataSource = props.dataSource,
|
|
11
11
|
dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
|
|
12
12
|
label = props.label,
|
|
13
|
+
type = props.type,
|
|
13
14
|
reset = _objectWithoutProperties(props, _excluded);
|
|
14
15
|
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;
|
|
15
16
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -19,7 +20,7 @@ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
|
|
|
19
20
|
}, label), noSelect ? null : /*#__PURE__*/React.createElement(Icon, {
|
|
20
21
|
type: "caret-down",
|
|
21
22
|
size: "xxs"
|
|
22
|
-
}), /*#__PURE__*/React.createElement(Select, _extends({
|
|
23
|
+
}), type === 'select' ? /*#__PURE__*/React.createElement(Select, _extends({
|
|
23
24
|
className: classNames('condition-select', {
|
|
24
25
|
'rc-search-prefix-no-select': noSelect
|
|
25
26
|
}),
|
|
@@ -38,6 +39,20 @@ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
|
|
|
38
39
|
}, reset, {
|
|
39
40
|
autoWidth: false,
|
|
40
41
|
popupClassName: "rc-search-prefix"
|
|
42
|
+
})) : /*#__PURE__*/React.createElement(CascaderSelect, _extends({
|
|
43
|
+
className: classNames('condition-select', {
|
|
44
|
+
'rc-search-prefix-no-select': noSelect
|
|
45
|
+
}),
|
|
46
|
+
defaultValue: defaultValue,
|
|
47
|
+
hasBorder: false,
|
|
48
|
+
disabled: noSelect,
|
|
49
|
+
autoHighlightFirstItem: false,
|
|
50
|
+
dataSource: dataSource
|
|
51
|
+
// itemRender={({ label, value }) => (<span data-value={value}>{label}</span>)}
|
|
52
|
+
}, reset, {
|
|
53
|
+
autoWidth: false,
|
|
54
|
+
popupClassName: "rc-search-prefix",
|
|
55
|
+
canOnlyCheckLeaf: true
|
|
41
56
|
})));
|
|
42
57
|
};
|
|
43
58
|
export default SearchConditionSelectPrefix;
|
|
@@ -109,7 +109,9 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
109
109
|
_props$suggestions = props.suggestions,
|
|
110
110
|
suggestions = _props$suggestions === void 0 ? [] : _props$suggestions,
|
|
111
111
|
_props$prefix = props.prefix,
|
|
112
|
-
prefix = _props$prefix === void 0 ? 'next-' : _props$prefix
|
|
112
|
+
prefix = _props$prefix === void 0 ? 'next-' : _props$prefix,
|
|
113
|
+
_props$prefixSelectMo = props.prefixSelectMode,
|
|
114
|
+
prefixSelectMode = _props$prefixSelectMo === void 0 ? 'select' : _props$prefixSelectMo;
|
|
113
115
|
var _useState = useState(options.find(function (o) {
|
|
114
116
|
return o.dataIndex === defaultSelectedDataIndex;
|
|
115
117
|
})),
|
|
@@ -325,10 +327,12 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
325
327
|
}, /*#__PURE__*/React.createElement("div", {
|
|
326
328
|
className: classNames('condition')
|
|
327
329
|
}, selectedFilterType ? /*#__PURE__*/React.createElement(SearchConditionSelectPrefix, {
|
|
330
|
+
type: prefixSelectMode,
|
|
328
331
|
dataSource: normalizeOptions(options),
|
|
329
332
|
label: selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.label,
|
|
330
333
|
defaultValue: selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.dataIndex,
|
|
331
334
|
onChange: function onChange(value) {
|
|
335
|
+
console.log(value);
|
|
332
336
|
handlerFilterTypeChange(value);
|
|
333
337
|
}
|
|
334
338
|
}) : null), /*#__PURE__*/React.createElement("div", {
|
package/es/search.js
CHANGED
|
@@ -9,8 +9,6 @@ var SearchWrap = styled.div.withConfig({
|
|
|
9
9
|
})(["height:32px;width:400px;display:inline-block;vertical-align:top;"]);
|
|
10
10
|
export var Search = function Search(props) {
|
|
11
11
|
var className = props.className,
|
|
12
|
-
_props$simple = props.simple,
|
|
13
|
-
simple = _props$simple === void 0 ? false : _props$simple,
|
|
14
12
|
style = props.style;
|
|
15
13
|
var windThemeClass = useWindTheme();
|
|
16
14
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchWrap, {
|
|
@@ -10,13 +10,14 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
12
|
var _consoleComponents = require("@alicloud/console-components");
|
|
13
|
-
var _excluded = ["defaultValue", "dataSource", "label"];
|
|
13
|
+
var _excluded = ["defaultValue", "dataSource", "label", "type"];
|
|
14
14
|
var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
|
|
15
15
|
var _dataSource$, _dataSource$$children;
|
|
16
16
|
var defaultValue = props.defaultValue,
|
|
17
17
|
_props$dataSource = props.dataSource,
|
|
18
18
|
dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
|
|
19
19
|
label = props.label,
|
|
20
|
+
type = props.type,
|
|
20
21
|
reset = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
21
22
|
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;
|
|
22
23
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -26,7 +27,7 @@ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
|
|
|
26
27
|
}, label), noSelect ? null : /*#__PURE__*/_react.default.createElement(_consoleComponents.Icon, {
|
|
27
28
|
type: "caret-down",
|
|
28
29
|
size: "xxs"
|
|
29
|
-
}), /*#__PURE__*/_react.default.createElement(_consoleComponents.Select, (0, _extends2.default)({
|
|
30
|
+
}), type === 'select' ? /*#__PURE__*/_react.default.createElement(_consoleComponents.Select, (0, _extends2.default)({
|
|
30
31
|
className: (0, _classnames.default)('condition-select', {
|
|
31
32
|
'rc-search-prefix-no-select': noSelect
|
|
32
33
|
}),
|
|
@@ -45,6 +46,20 @@ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
|
|
|
45
46
|
}, reset, {
|
|
46
47
|
autoWidth: false,
|
|
47
48
|
popupClassName: "rc-search-prefix"
|
|
49
|
+
})) : /*#__PURE__*/_react.default.createElement(_consoleComponents.CascaderSelect, (0, _extends2.default)({
|
|
50
|
+
className: (0, _classnames.default)('condition-select', {
|
|
51
|
+
'rc-search-prefix-no-select': noSelect
|
|
52
|
+
}),
|
|
53
|
+
defaultValue: defaultValue,
|
|
54
|
+
hasBorder: false,
|
|
55
|
+
disabled: noSelect,
|
|
56
|
+
autoHighlightFirstItem: false,
|
|
57
|
+
dataSource: dataSource
|
|
58
|
+
// itemRender={({ label, value }) => (<span data-value={value}>{label}</span>)}
|
|
59
|
+
}, reset, {
|
|
60
|
+
autoWidth: false,
|
|
61
|
+
popupClassName: "rc-search-prefix",
|
|
62
|
+
canOnlyCheckLeaf: true
|
|
48
63
|
})));
|
|
49
64
|
};
|
|
50
65
|
var _default = exports.default = SearchConditionSelectPrefix;
|
|
@@ -21,8 +21,7 @@ var _style = require("../style");
|
|
|
21
21
|
var _InputPrefix = _interopRequireDefault(require("./InputPrefix"));
|
|
22
22
|
var _constants = require("../constants");
|
|
23
23
|
var _message = _interopRequireDefault(require("../message"));
|
|
24
|
-
function
|
|
25
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
26
25
|
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; }
|
|
27
26
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
27
|
var AutoComplete = _consoleComponents.Select.AutoComplete;
|
|
@@ -119,7 +118,9 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
119
118
|
_props$suggestions = props.suggestions,
|
|
120
119
|
suggestions = _props$suggestions === void 0 ? [] : _props$suggestions,
|
|
121
120
|
_props$prefix = props.prefix,
|
|
122
|
-
prefix = _props$prefix === void 0 ? 'next-' : _props$prefix
|
|
121
|
+
prefix = _props$prefix === void 0 ? 'next-' : _props$prefix,
|
|
122
|
+
_props$prefixSelectMo = props.prefixSelectMode,
|
|
123
|
+
prefixSelectMode = _props$prefixSelectMo === void 0 ? 'select' : _props$prefixSelectMo;
|
|
123
124
|
var _useState = (0, _react.useState)(options.find(function (o) {
|
|
124
125
|
return o.dataIndex === defaultSelectedDataIndex;
|
|
125
126
|
})),
|
|
@@ -335,10 +336,12 @@ var ComplexSearch = function ComplexSearch(props) {
|
|
|
335
336
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
336
337
|
className: (0, _classnames.default)('condition')
|
|
337
338
|
}, selectedFilterType ? /*#__PURE__*/_react.default.createElement(_InputPrefix.default, {
|
|
339
|
+
type: prefixSelectMode,
|
|
338
340
|
dataSource: normalizeOptions(options),
|
|
339
341
|
label: selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.label,
|
|
340
342
|
defaultValue: selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.dataIndex,
|
|
341
343
|
onChange: function onChange(value) {
|
|
344
|
+
console.log(value);
|
|
342
345
|
handlerFilterTypeChange(value);
|
|
343
346
|
}
|
|
344
347
|
}) : null), /*#__PURE__*/_react.default.createElement("div", {
|
package/lib/search.js
CHANGED
|
@@ -16,8 +16,6 @@ var SearchWrap = _styledComponents.default.div.withConfig({
|
|
|
16
16
|
})(["height:32px;width:400px;display:inline-block;vertical-align:top;"]);
|
|
17
17
|
var Search = exports.Search = function Search(props) {
|
|
18
18
|
var className = props.className,
|
|
19
|
-
_props$simple = props.simple,
|
|
20
|
-
simple = _props$simple === void 0 ? false : _props$simple,
|
|
21
19
|
style = props.style;
|
|
22
20
|
var windThemeClass = (0, _useCssVar.useWindTheme)();
|
|
23
21
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(SearchWrap, {
|
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.37-alpha.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"@alicloud/console-toolkit-preset-component": "^1.2.8",
|
|
10
10
|
"@alicloud/console-toolkit-preset-docs": "^1.0.34",
|
|
11
11
|
"@alifd/next": "^1.27.29",
|
|
12
|
+
"@babel/core": "^7.28.0",
|
|
12
13
|
"@types/classnames": "^2.3.4",
|
|
13
14
|
"@types/js-cookie": "^3.0.1",
|
|
14
15
|
"@types/react": "^17.0.0",
|
|
@@ -17,6 +18,8 @@
|
|
|
17
18
|
"prettier": "^2.2.1",
|
|
18
19
|
"react": "^17.0.1",
|
|
19
20
|
"react-dom": "^17.0.1",
|
|
21
|
+
"react-router": "^5.0.0",
|
|
22
|
+
"react-router-dom": "^5.0.0",
|
|
20
23
|
"serve": "^11.3.2",
|
|
21
24
|
"styled-components": "^5.2.1",
|
|
22
25
|
"typescript": "^4.1.3"
|