Skip to content

Commit 7dbf6a6

Browse files
committed
flex改用auto
1 parent e9bc49d commit 7dbf6a6

File tree

10 files changed

+83
-75
lines changed

10 files changed

+83
-75
lines changed

docs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
overflow: auto;
1616
}
1717
</style>
18-
<link href="static\css\index.c57af803.css" rel="stylesheet"></head>
18+
<link href="static\css\index.a1890453.css" rel="stylesheet"></head>
1919

2020
<body style="background:#F5F5F5">
2121
<div class="demo" id="demo">
2222
</div>
23-
<script src="static\js\vendors.e94b1935.chunk.js"></script><script src="static\js\index.ff6e5f2a.js"></script></body>
23+
<script src="static\js\vendors.e94b1935.chunk.js"></script><script src="static\js\index.46b94f42.js"></script></body>
2424

2525
</html>
Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/static/js/index.46b94f42.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/static/js/index.ff6e5f2a.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/ListBox.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Object.defineProperty(exports, "__esModule", {
88
});
99
exports.default = void 0;
1010

11+
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
12+
1113
var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
1214

1315
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
@@ -457,7 +459,7 @@ function (_React$Component) {
457459
return emptyLabel;
458460
}
459461

460-
var childs = items.length ? this.renderListItems(items, selectedMap) : this.renderListChild(children, selectedMap);
462+
var childs = (0, _isArray.default)(items) ? this.renderListItems(items, selectedMap) : this.renderListChild(children, selectedMap);
461463
return _react.default.Children.count(childs) ? childs : emptyLabel;
462464
}
463465
}, {
@@ -584,6 +586,9 @@ exports.default = ListBox;
584586
labelField: _propTypes.default.string,
585587
childrenField: _propTypes.default.string,
586588
items: _propTypes.default.array,
589+
//itemsMap: PropTypes.object,
590+
defaultValue: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.array]),
591+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.array]),
587592
emptyLabel: _propTypes.default.any,
588593
multiple: _propTypes.default.bool,
589594
disabled: _propTypes.default.bool,
@@ -616,9 +621,9 @@ exports.default = ListBox;
616621
childrenField: 'children',
617622
labelInValue: false,
618623
tabIndex: 0,
619-
items: [],
620624
emptyLabel: 'Not Found',
621625
enableDownUpSelect: true,
626+
//items: [],
622627
onFocus: noop,
623628
onBlur: noop,
624629
onKeyDown: noop,

lib/style/index.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
.rw-listbox {
3-
background: #FFF;
3+
background: #fff;
44
overflow: hidden;
55
-webkit-box-sizing: border-box;
66
box-sizing: border-box;
@@ -14,8 +14,8 @@
1414
.rw-listbox-disabled {
1515
border: 1px solid #b3b3b3; }
1616
.rw-listbox .rw-listbox-body {
17-
-ms-flex: 1 1;
18-
flex: 1 1;
17+
-ms-flex: auto;
18+
flex: auto;
1919
overflow: hidden;
2020
overflow-y: auto; }
2121
.rw-listbox .rw-listbox-body .rw-listbox-item-group-title,
@@ -32,7 +32,7 @@
3232
.rw-listbox .rw-listbox-body .rw-listbox-item-selected {
3333
background: #ebf9ff; }
3434
.rw-listbox .rw-listbox-body .rw-listbox-item-disabled {
35-
opacity: .5;
35+
opacity: 0.5;
3636
cursor: default; }
3737
.rw-listbox .rw-listbox-body .rw-listbox-item-disabled:not(.rw-listbox-item-selected):hover {
3838
background: none; }

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-widget-listbox",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"description": "",
55
"main": "index.js",
66
"repository": {

src/style/index.scss

Lines changed: 53 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,65 +3,63 @@ $listboxItemPadding: 8px 12px !default;
33
$listboxItemHeight: auto !default;
44

55
.#{$prefixCls} {
6-
background:#FFF;
7-
overflow: hidden;
8-
box-sizing: border-box;
9-
border:1px solid #e5e5ea;
6+
background: #fff;
7+
overflow: hidden;
8+
box-sizing: border-box;
9+
border: 1px solid #e5e5ea;
1010
display: flex;
1111
flex-direction: column;
12-
&:focus{
13-
outline:0;
14-
}
15-
&-disabled {
16-
border:1px solid #b3b3b3;
17-
}
18-
.#{$prefixCls}-body {
19-
flex: 1;
12+
&:focus {
13+
outline: 0;
14+
}
15+
&-disabled {
16+
border: 1px solid #b3b3b3;
17+
}
18+
.#{$prefixCls}-body {
19+
flex: auto;
2020
overflow: hidden;
2121
overflow-y: auto;
2222

23-
.#{$prefixCls}-item-group-title,
24-
.#{$prefixCls}-item {
25-
//list-style:none;
26-
position:relative;
27-
padding:$listboxItemPadding;
28-
cursor: pointer;
29-
line-height:$listboxItemHeight;
30-
height:$listboxItemHeight;
31-
white-space: nowrap;
32-
overflow:hidden;
33-
}
34-
35-
//hover
36-
.#{$prefixCls}-item-active {
37-
background: rgba(235,249,255,.5);
38-
// color: #575757;
39-
}
40-
41-
.#{$prefixCls}-item-selected {
23+
.#{$prefixCls}-item-group-title,
24+
.#{$prefixCls}-item {
25+
//list-style:none;
26+
position: relative;
27+
padding: $listboxItemPadding;
28+
cursor: pointer;
29+
line-height: $listboxItemHeight;
30+
height: $listboxItemHeight;
31+
white-space: nowrap;
32+
overflow: hidden;
33+
}
34+
35+
//hover
36+
.#{$prefixCls}-item-active {
37+
background: rgba(235, 249, 255, 0.5);
38+
// color: #575757;
39+
}
40+
41+
.#{$prefixCls}-item-selected {
4242
background: #ebf9ff;
43-
44-
}
45-
46-
.#{$prefixCls}-item-disabled {
47-
opacity: .5;
48-
cursor: default;
49-
&:not(.#{$prefixCls}-item-selected):hover {
50-
background: none;
51-
//color: rgba(0,0,0,.25);
52-
}
53-
}
54-
55-
.#{$prefixCls}-item-group-title {
56-
padding:$listboxItemPadding;
57-
cursor:default;
43+
}
44+
45+
.#{$prefixCls}-item-disabled {
46+
opacity: 0.5;
47+
cursor: default;
48+
&:not(.#{$prefixCls}-item-selected):hover {
49+
background: none;
50+
//color: rgba(0,0,0,.25);
51+
}
52+
}
53+
54+
.#{$prefixCls}-item-group-title {
55+
padding: $listboxItemPadding;
56+
cursor: default;
5857
font-weight: 700;
59-
//color: #999;
60-
}
61-
62-
.#{$prefixCls}-item-group-list .#{$prefixCls}-item {
63-
padding-left:28px;
64-
}
65-
66-
}
67-
}
58+
//color: #999;
59+
}
60+
61+
.#{$prefixCls}-item-group-list .#{$prefixCls}-item {
62+
padding-left: 28px;
63+
}
64+
}
65+
}

0 commit comments

Comments
 (0)