@aloudata/aloudata-design 0.4.8-beta.2 → 0.4.8-beta.4
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/dist/Select/components/MultipleOption.d.ts +1 -0
- package/dist/Select/components/MultipleOption.js +4 -2
- package/dist/Select/components/SingleOption.d.ts +1 -0
- package/dist/Select/components/SingleOption.js +4 -2
- package/dist/Select/index.js +22 -5
- package/dist/Select/style/index.less +1 -1
- package/dist/Select/style/multiple.less +2 -2
- package/dist/Select/style/single.less +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Checkbox } from 'antd';
|
|
2
|
+
import classnames from 'classnames';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
export default function MultipleList(params) {
|
|
4
5
|
var disabled = params.disabled,
|
|
5
6
|
option = params.option,
|
|
6
7
|
selected = params.selected,
|
|
7
|
-
onChange = params.onChange
|
|
8
|
+
onChange = params.onChange,
|
|
9
|
+
className = params.className;
|
|
8
10
|
|
|
9
11
|
var onClick = function onClick() {
|
|
10
12
|
//TODO: 这里有bug 等待antd升级 https://github.com/ant-design/ant-design/pull/39078
|
|
@@ -12,7 +14,7 @@ export default function MultipleList(params) {
|
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
-
className:
|
|
17
|
+
className: classnames('ald-multiple-option', className),
|
|
16
18
|
onClick: onClick
|
|
17
19
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
18
20
|
checked: selected,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CheckLine } from '@aloudata/icons-react';
|
|
2
|
+
import classnames from 'classnames';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import colors from "../../style/themes/default/themeColor.module.less";
|
|
4
5
|
export default function SingleOption(params) {
|
|
@@ -6,7 +7,8 @@ export default function SingleOption(params) {
|
|
|
6
7
|
selected = params.selected,
|
|
7
8
|
option = params.option,
|
|
8
9
|
_params$onChange = params.onChange,
|
|
9
|
-
onChange = _params$onChange === void 0 ? function () {} : _params$onChange
|
|
10
|
+
onChange = _params$onChange === void 0 ? function () {} : _params$onChange,
|
|
11
|
+
className = params.className;
|
|
10
12
|
|
|
11
13
|
var onClick = function onClick() {
|
|
12
14
|
if (disabled) return;
|
|
@@ -14,7 +16,7 @@ export default function SingleOption(params) {
|
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
|
-
className:
|
|
19
|
+
className: classnames('ald-single-option', className),
|
|
18
20
|
onClick: onClick
|
|
19
21
|
}, /*#__PURE__*/React.createElement("div", {
|
|
20
22
|
className: "ald-icons-check-line"
|
package/dist/Select/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["mode", "options", "dropdownRender", "onDropdownVisibleChange", "defaultValue", "onChange", "open", "defaultOpen", "prefix", "className", "popupClassName", "notFoundContent", "value", "style"];
|
|
1
|
+
var _excluded = ["mode", "options", "dropdownRender", "onDropdownVisibleChange", "defaultValue", "onChange", "open", "defaultOpen", "prefix", "className", "popupClassName", "listHeight", "listItemHeight", "notFoundContent", "value", "style"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
@@ -30,9 +30,10 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
30
30
|
|
|
31
31
|
import { Select as AntdSelect } from 'antd';
|
|
32
32
|
import classNames from 'classnames';
|
|
33
|
+
import List from 'rc-virtual-list';
|
|
33
34
|
import React, { forwardRef, useEffect, useLayoutEffect, useMemo } from 'react';
|
|
34
35
|
import Empty from "../Empty";
|
|
35
|
-
import
|
|
36
|
+
import MultipleOption from "./components/MultipleOption";
|
|
36
37
|
import SingleOption from "./components/SingleOption";
|
|
37
38
|
|
|
38
39
|
var getSelectedOptionsFromValue = function getSelectedOptionsFromValue(isMultiple, options, value, defaultValue) {
|
|
@@ -90,6 +91,8 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
90
91
|
prefix = props.prefix,
|
|
91
92
|
className = props.className,
|
|
92
93
|
popupClassName = props.popupClassName,
|
|
94
|
+
listHeight = props.listHeight,
|
|
95
|
+
listItemHeight = props.listItemHeight,
|
|
93
96
|
_props$notFoundConten = props.notFoundContent,
|
|
94
97
|
notFoundContent = _props$notFoundConten === void 0 ? /*#__PURE__*/React.createElement(Empty, null) : _props$notFoundConten,
|
|
95
98
|
value = props.value,
|
|
@@ -147,13 +150,20 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
147
150
|
var multipleRender = function multipleRender() {
|
|
148
151
|
return /*#__PURE__*/React.createElement("div", {
|
|
149
152
|
className: "ald-multiple-option-list"
|
|
150
|
-
},
|
|
153
|
+
}, /*#__PURE__*/React.createElement(List, {
|
|
154
|
+
data: options || [],
|
|
155
|
+
"data-id": "list",
|
|
156
|
+
height: listHeight,
|
|
157
|
+
itemHeight: listItemHeight || 36,
|
|
158
|
+
itemKey: "value"
|
|
159
|
+
}, function (option) {
|
|
151
160
|
var isSelected = selectedOptions.some(function (selectedOption) {
|
|
152
161
|
return selectedOption.value === option.value;
|
|
153
162
|
});
|
|
154
|
-
return /*#__PURE__*/React.createElement(
|
|
163
|
+
return /*#__PURE__*/React.createElement(MultipleOption, {
|
|
155
164
|
key: option.value,
|
|
156
165
|
selected: isSelected,
|
|
166
|
+
className: option.className,
|
|
157
167
|
option: option,
|
|
158
168
|
disabled: option.disabled,
|
|
159
169
|
onChange: function onChange(selected) {
|
|
@@ -178,13 +188,20 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
178
188
|
var singleRender = function singleRender() {
|
|
179
189
|
return /*#__PURE__*/React.createElement("div", {
|
|
180
190
|
className: "ald-single-option-list"
|
|
181
|
-
},
|
|
191
|
+
}, /*#__PURE__*/React.createElement(List, {
|
|
192
|
+
data: options || [],
|
|
193
|
+
"data-id": "list",
|
|
194
|
+
height: listHeight,
|
|
195
|
+
itemHeight: listItemHeight || 36,
|
|
196
|
+
itemKey: "value"
|
|
197
|
+
}, function (option) {
|
|
182
198
|
var isSelected = selectedOptions.some(function (selectedOption) {
|
|
183
199
|
return selectedOption.value === option.value;
|
|
184
200
|
});
|
|
185
201
|
return /*#__PURE__*/React.createElement(SingleOption, {
|
|
186
202
|
key: option.value,
|
|
187
203
|
selected: isSelected,
|
|
204
|
+
className: option.className,
|
|
188
205
|
option: option,
|
|
189
206
|
disabled: option.disabled,
|
|
190
207
|
onChange: function onChange() {
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
justify-content: space-between;
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
color: @NL0;
|
|
8
|
-
font-size:
|
|
8
|
+
font-size: 13px;
|
|
9
9
|
line-height: 20px;
|
|
10
10
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.ald-multiple-option{
|
|
14
14
|
padding: 8px 14px;
|
|
15
|
-
height: 20px;
|
|
15
|
+
// height: 20px;
|
|
16
16
|
margin-left: 0;
|
|
17
17
|
display: flex;
|
|
18
18
|
|