@douyinfe/semi-ui 2.19.0-alpha.2 → 2.19.0-alpha.5
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/button/buttonGroup.tsx +38 -4
- package/checkbox/checkboxGroup.tsx +2 -11
- package/dist/css/semi.css +48 -9
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +87 -72
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/button/buttonGroup.d.ts +1 -0
- package/lib/cjs/button/buttonGroup.js +56 -3
- package/lib/cjs/checkbox/checkboxGroup.js +8 -31
- package/lib/cjs/radio/radioGroup.js +7 -34
- package/lib/cjs/table/ColumnFilter.js +4 -2
- package/lib/cjs/table/ColumnSorter.d.ts +1 -0
- package/lib/cjs/table/ColumnSorter.js +9 -6
- package/lib/cjs/table/Table.js +11 -4
- package/lib/es/button/buttonGroup.d.ts +1 -0
- package/lib/es/button/buttonGroup.js +53 -3
- package/lib/es/checkbox/checkboxGroup.js +6 -27
- package/lib/es/radio/radioGroup.js +5 -30
- package/lib/es/table/ColumnFilter.js +4 -2
- package/lib/es/table/ColumnSorter.d.ts +1 -0
- package/lib/es/table/ColumnSorter.js +9 -6
- package/lib/es/table/Table.js +10 -4
- package/package.json +7 -7
- package/radio/radioGroup.tsx +4 -15
- package/table/ColumnFilter.tsx +2 -1
- package/table/ColumnSorter.tsx +16 -10
- package/table/Table.tsx +7 -4
- package/webpack.config.js +3 -1
|
@@ -18,12 +18,22 @@ var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
|
|
|
18
18
|
|
|
19
19
|
var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
|
|
20
20
|
|
|
21
|
+
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
22
|
+
|
|
23
|
+
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
24
|
+
|
|
25
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
26
|
+
|
|
27
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
28
|
+
|
|
21
29
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
22
30
|
|
|
23
31
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
24
32
|
|
|
25
33
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
26
34
|
|
|
35
|
+
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
36
|
+
|
|
27
37
|
var _react = _interopRequireWildcard(require("react"));
|
|
28
38
|
|
|
29
39
|
var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
|
|
@@ -55,6 +65,47 @@ const prefixCls = _constants.cssClasses.PREFIX;
|
|
|
55
65
|
const btnSizes = _constants.strings.sizes;
|
|
56
66
|
|
|
57
67
|
class ButtonGroup extends _baseComponent.default {
|
|
68
|
+
getInnerWithLine(inner) {
|
|
69
|
+
const innerWithLine = [];
|
|
70
|
+
let lineCls = "".concat(prefixCls, "-group-line");
|
|
71
|
+
|
|
72
|
+
if (inner.length > 1) {
|
|
73
|
+
var _context;
|
|
74
|
+
|
|
75
|
+
(0, _forEach.default)(_context = (0, _slice.default)(inner).call(inner, 0, -1)).call(_context, item => {
|
|
76
|
+
var _context2;
|
|
77
|
+
|
|
78
|
+
const isButtonType = (0, _includes.default)(_context2 = [(0, _get2.default)(item, 'type.displayName'), (0, _get2.default)(item, 'type.name')]).call(_context2, 'Button');
|
|
79
|
+
const buttonProps = (0, _get2.default)(item, 'props');
|
|
80
|
+
|
|
81
|
+
if (buttonProps) {
|
|
82
|
+
var _context3, _context4;
|
|
83
|
+
|
|
84
|
+
const {
|
|
85
|
+
type,
|
|
86
|
+
theme,
|
|
87
|
+
disabled
|
|
88
|
+
} = buttonProps;
|
|
89
|
+
lineCls = (0, _classnames.default)("".concat(prefixCls, "-group-line"), (0, _concat.default)(_context3 = "".concat(prefixCls, "-group-line-")).call(_context3, theme !== null && theme !== void 0 ? theme : 'light'), (0, _concat.default)(_context4 = "".concat(prefixCls, "-group-line-")).call(_context4, type !== null && type !== void 0 ? type : 'primary'), {
|
|
90
|
+
["".concat(prefixCls, "-group-line-disabled")]: disabled
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (isButtonType) {
|
|
95
|
+
innerWithLine.push(item, /*#__PURE__*/_react.default.createElement("span", {
|
|
96
|
+
className: lineCls
|
|
97
|
+
}));
|
|
98
|
+
} else {
|
|
99
|
+
innerWithLine.push(item);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
innerWithLine.push((0, _slice.default)(inner).call(inner, -1));
|
|
103
|
+
return innerWithLine;
|
|
104
|
+
} else {
|
|
105
|
+
return inner;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
58
109
|
render() {
|
|
59
110
|
const _a = this.props,
|
|
60
111
|
{
|
|
@@ -68,25 +119,27 @@ class ButtonGroup extends _baseComponent.default {
|
|
|
68
119
|
rest = __rest(_a, ["children", "disabled", "size", "type", "className", 'aria-label']);
|
|
69
120
|
|
|
70
121
|
let inner;
|
|
122
|
+
let innerWithLine = [];
|
|
71
123
|
const cls = (0, _classnames.default)("".concat(prefixCls, "-group"), className);
|
|
72
124
|
|
|
73
125
|
if (children) {
|
|
74
|
-
var
|
|
126
|
+
var _context5;
|
|
75
127
|
|
|
76
|
-
inner = (0, _map.default)(
|
|
128
|
+
inner = (0, _map.default)(_context5 = (0, _isArray.default)(children) ? children : [children]).call(_context5, (itm, index) => /*#__PURE__*/(0, _react.isValidElement)(itm) ? /*#__PURE__*/(0, _react.cloneElement)(itm, (0, _assign.default)((0, _assign.default)((0, _assign.default)({
|
|
77
129
|
disabled,
|
|
78
130
|
size,
|
|
79
131
|
type
|
|
80
132
|
}, itm.props), rest), {
|
|
81
133
|
key: index
|
|
82
134
|
})) : itm);
|
|
135
|
+
innerWithLine = this.getInnerWithLine(inner);
|
|
83
136
|
}
|
|
84
137
|
|
|
85
138
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
86
139
|
className: cls,
|
|
87
140
|
role: "group",
|
|
88
141
|
"aria-label": ariaLabel
|
|
89
|
-
},
|
|
142
|
+
}, innerWithLine);
|
|
90
143
|
}
|
|
91
144
|
|
|
92
145
|
}
|
|
@@ -20,14 +20,8 @@ var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stab
|
|
|
20
20
|
|
|
21
21
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
22
22
|
|
|
23
|
-
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
24
|
-
|
|
25
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
26
|
-
|
|
27
23
|
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
28
24
|
|
|
29
|
-
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
30
|
-
|
|
31
25
|
var _react = _interopRequireDefault(require("react"));
|
|
32
26
|
|
|
33
27
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -40,7 +34,7 @@ var _checkboxGroupFoundation = _interopRequireDefault(require("@douyinfe/semi-fo
|
|
|
40
34
|
|
|
41
35
|
var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
|
|
42
36
|
|
|
43
|
-
var
|
|
37
|
+
var _context7 = require("./context");
|
|
44
38
|
|
|
45
39
|
var _checkbox = _interopRequireDefault(require("./checkbox"));
|
|
46
40
|
|
|
@@ -124,8 +118,7 @@ class CheckboxGroup extends _baseComponent.default {
|
|
|
124
118
|
key: index,
|
|
125
119
|
disabled: this.props.disabled,
|
|
126
120
|
value: option,
|
|
127
|
-
prefixCls: prefixCls
|
|
128
|
-
type: type
|
|
121
|
+
prefixCls: prefixCls
|
|
129
122
|
}, option);
|
|
130
123
|
} else {
|
|
131
124
|
return /*#__PURE__*/_react.default.createElement(_checkbox.default, {
|
|
@@ -137,33 +130,17 @@ class CheckboxGroup extends _baseComponent.default {
|
|
|
137
130
|
extra: option.extra,
|
|
138
131
|
className: option.className,
|
|
139
132
|
style: option.style,
|
|
140
|
-
onChange: option.onChange
|
|
141
|
-
type: type
|
|
133
|
+
onChange: option.onChange
|
|
142
134
|
}, option.label);
|
|
143
135
|
}
|
|
144
136
|
});
|
|
145
137
|
} else if (children) {
|
|
146
138
|
var _context6;
|
|
147
139
|
|
|
148
|
-
inner = (0, _map.default)(_context6 = _react.default.Children.toArray(children)).call(_context6, (itm, index) => {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
key: index,
|
|
153
|
-
role: 'listitem'
|
|
154
|
-
};
|
|
155
|
-
const isCheckboxComp = (0, _some.default)(_context7 = ['Checkbox', 'CheckboxWithGroup']).call(_context7, comp => {
|
|
156
|
-
var _context8;
|
|
157
|
-
|
|
158
|
-
return (0, _includes.default)(_context8 = [(0, _get2.default)(itm, 'type.displayName'), (0, _get2.default)(itm, 'type.name')]).call(_context8, comp);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
if (isCheckboxComp) {
|
|
162
|
-
props.type = type;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return /*#__PURE__*/_react.default.cloneElement(itm, props);
|
|
166
|
-
});
|
|
140
|
+
inner = (0, _map.default)(_context6 = _react.default.Children.toArray(children)).call(_context6, (itm, index) => /*#__PURE__*/_react.default.cloneElement(itm, {
|
|
141
|
+
key: index,
|
|
142
|
+
role: 'listitem'
|
|
143
|
+
}));
|
|
167
144
|
}
|
|
168
145
|
|
|
169
146
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -174,7 +151,7 @@ class CheckboxGroup extends _baseComponent.default {
|
|
|
174
151
|
style: style,
|
|
175
152
|
"aria-labelledby": this.props['aria-labelledby'],
|
|
176
153
|
"aria-describedby": this.props['aria-describedby']
|
|
177
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
154
|
+
}, /*#__PURE__*/_react.default.createElement(_context7.Context.Provider, {
|
|
178
155
|
value: {
|
|
179
156
|
checkboxGroup: {
|
|
180
157
|
onChange: this.onChange,
|
|
@@ -16,14 +16,8 @@ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
16
16
|
|
|
17
17
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
18
18
|
|
|
19
|
-
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
20
|
-
|
|
21
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
22
|
-
|
|
23
19
|
var _noop2 = _interopRequireDefault(require("lodash/noop"));
|
|
24
20
|
|
|
25
|
-
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
26
|
-
|
|
27
21
|
var _react = _interopRequireDefault(require("react"));
|
|
28
22
|
|
|
29
23
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -38,7 +32,7 @@ var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
|
|
|
38
32
|
|
|
39
33
|
var _radio = _interopRequireDefault(require("./radio"));
|
|
40
34
|
|
|
41
|
-
var
|
|
35
|
+
var _context6 = _interopRequireDefault(require("./context"));
|
|
42
36
|
|
|
43
37
|
class RadioGroup extends _baseComponent.default {
|
|
44
38
|
constructor(props) {
|
|
@@ -130,8 +124,7 @@ class RadioGroup extends _baseComponent.default {
|
|
|
130
124
|
return /*#__PURE__*/_react.default.createElement(_radio.default, {
|
|
131
125
|
key: index,
|
|
132
126
|
disabled: this.props.disabled,
|
|
133
|
-
value: option
|
|
134
|
-
type: type
|
|
127
|
+
value: option
|
|
135
128
|
}, option);
|
|
136
129
|
} else {
|
|
137
130
|
return /*#__PURE__*/_react.default.createElement(_radio.default, {
|
|
@@ -140,36 +133,16 @@ class RadioGroup extends _baseComponent.default {
|
|
|
140
133
|
value: option.value,
|
|
141
134
|
extra: option.extra,
|
|
142
135
|
className: option.className,
|
|
143
|
-
style: option.style
|
|
144
|
-
type: type
|
|
136
|
+
style: option.style
|
|
145
137
|
}, option.label);
|
|
146
138
|
}
|
|
147
139
|
});
|
|
148
140
|
} else if (children) {
|
|
149
141
|
var _context5;
|
|
150
142
|
|
|
151
|
-
inner = (0, _map.default)(_context5 = _react.default.Children).call(_context5, children, (itm, index) => {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const props = {
|
|
156
|
-
key: index
|
|
157
|
-
};
|
|
158
|
-
const isRadioComp = (0, _some.default)(_context6 = ['Radio', 'RadioWithGroup']).call(_context6, comp => {
|
|
159
|
-
var _context7;
|
|
160
|
-
|
|
161
|
-
return (0, _includes.default)(_context7 = [(0, _get2.default)(itm, 'type.displayName'), (0, _get2.default)(itm, 'type.name')]).call(_context7, comp);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
if (isRadioComp) {
|
|
165
|
-
props.type = type;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return /*#__PURE__*/_react.default.cloneElement(itm, props);
|
|
169
|
-
} else {
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
});
|
|
143
|
+
inner = (0, _map.default)(_context5 = _react.default.Children).call(_context5, children, (itm, index) => /*#__PURE__*/_react.default.isValidElement(itm) ? /*#__PURE__*/_react.default.cloneElement(itm, {
|
|
144
|
+
key: index
|
|
145
|
+
}) : null);
|
|
173
146
|
}
|
|
174
147
|
|
|
175
148
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -182,7 +155,7 @@ class RadioGroup extends _baseComponent.default {
|
|
|
182
155
|
"aria-labelledby": this.props['aria-labelledby'],
|
|
183
156
|
"aria-describedby": this.props['aria-describedby'],
|
|
184
157
|
"aria-required": this.props['aria-required']
|
|
185
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
158
|
+
}, /*#__PURE__*/_react.default.createElement(_context6.default.Provider, {
|
|
186
159
|
value: {
|
|
187
160
|
radioGroup: {
|
|
188
161
|
onChange: this.onChange,
|
|
@@ -179,12 +179,14 @@ function ColumnFilter() {
|
|
|
179
179
|
} else {
|
|
180
180
|
iconElem = /*#__PURE__*/_react.default.createElement("div", {
|
|
181
181
|
className: finalCls
|
|
182
|
-
},
|
|
182
|
+
}, '\u200b'
|
|
183
|
+
/* ZWSP(zero-width space) */
|
|
184
|
+
, /*#__PURE__*/_react.default.createElement(_semiIcons.IconFilter, {
|
|
183
185
|
role: "button",
|
|
184
186
|
"aria-label": "Filter data with this column",
|
|
185
187
|
"aria-haspopup": "listbox",
|
|
186
188
|
tabIndex: -1,
|
|
187
|
-
size: "
|
|
189
|
+
size: "default"
|
|
188
190
|
}));
|
|
189
191
|
}
|
|
190
192
|
|
|
@@ -7,6 +7,7 @@ export interface ColumnSorterProps {
|
|
|
7
7
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
8
8
|
prefixCls?: string;
|
|
9
9
|
sortOrder?: SortOrder;
|
|
10
|
+
title?: React.ReactNode;
|
|
10
11
|
}
|
|
11
12
|
export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
|
|
12
13
|
static propTypes: {
|
|
@@ -40,9 +40,10 @@ class ColumnSorter extends _react.PureComponent {
|
|
|
40
40
|
prefixCls,
|
|
41
41
|
onClick,
|
|
42
42
|
sortOrder,
|
|
43
|
-
style
|
|
43
|
+
style,
|
|
44
|
+
title
|
|
44
45
|
} = this.props;
|
|
45
|
-
const iconBtnSize = '
|
|
46
|
+
const iconBtnSize = 'default';
|
|
46
47
|
const upCls = (0, _classnames.default)("".concat(prefixCls, "-column-sorter-up"), {
|
|
47
48
|
on: sortOrder === _constants.strings.SORT_DIRECTIONS[0]
|
|
48
49
|
});
|
|
@@ -61,11 +62,13 @@ class ColumnSorter extends _react.PureComponent {
|
|
|
61
62
|
role: 'button'
|
|
62
63
|
}, ariaProps, {
|
|
63
64
|
tabIndex: -1,
|
|
64
|
-
|
|
65
|
-
className: "".concat(prefixCls, "-column-sorter"),
|
|
65
|
+
className: "".concat(prefixCls, "-column-sorter-wrapper"),
|
|
66
66
|
onClick: onClick,
|
|
67
67
|
onKeyPress: e => (0, _isEnterPress.default)(e) && onClick(e)
|
|
68
|
-
}), /*#__PURE__*/_react.default.createElement("
|
|
68
|
+
}), title, /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
+
style: style,
|
|
70
|
+
className: "".concat(prefixCls, "-column-sorter")
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
69
72
|
className: "".concat(upCls)
|
|
70
73
|
}, /*#__PURE__*/_react.default.createElement(_semiIcons.IconCaretup, {
|
|
71
74
|
size: iconBtnSize
|
|
@@ -73,7 +76,7 @@ class ColumnSorter extends _react.PureComponent {
|
|
|
73
76
|
className: "".concat(downCls)
|
|
74
77
|
}, /*#__PURE__*/_react.default.createElement(_semiIcons.IconCaretdown, {
|
|
75
78
|
size: iconBtnSize
|
|
76
|
-
})));
|
|
79
|
+
}))));
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
}
|
package/lib/cjs/table/Table.js
CHANGED
|
@@ -555,15 +555,24 @@ class Table extends _baseComponent.default {
|
|
|
555
555
|
const defaultSortOrder = (0, _get2.default)(curQuery, 'defaultSortOrder', false);
|
|
556
556
|
const sortOrder = _this.foundation.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
|
|
557
557
|
|
|
558
|
+
const TitleNode = typeof rawTitle !== 'function' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
559
|
+
key: _constants.strings.DEFAULT_KEY_COLUMN_TITLE
|
|
560
|
+
}, rawTitle);
|
|
561
|
+
|
|
558
562
|
if (typeof column.sorter === 'function' || column.sorter === true) {
|
|
563
|
+
// In order to increase the click hot area of sorting, when sorting is required & useFullRender is false,
|
|
564
|
+
// both the title and sorting areas are used as the click hot area for sorting。
|
|
559
565
|
const sorter = /*#__PURE__*/_react.default.createElement(_ColumnSorter.default, {
|
|
560
566
|
key: _constants.strings.DEFAULT_KEY_COLUMN_SORTER,
|
|
561
567
|
sortOrder: sortOrder,
|
|
562
|
-
onClick: e => _this.foundation.handleSort(column, e)
|
|
568
|
+
onClick: e => _this.foundation.handleSort(column, e),
|
|
569
|
+
title: TitleNode
|
|
563
570
|
});
|
|
564
571
|
|
|
565
572
|
useFullRender && (titleMap.sorter = sorter);
|
|
566
573
|
titleArr.push(sorter);
|
|
574
|
+
} else {
|
|
575
|
+
titleArr.push(TitleNode);
|
|
567
576
|
}
|
|
568
577
|
|
|
569
578
|
const stateFilteredValue = (0, _get2.default)(curQuery, 'filteredValue');
|
|
@@ -583,9 +592,7 @@ class Table extends _baseComponent.default {
|
|
|
583
592
|
titleArr.push(filter);
|
|
584
593
|
}
|
|
585
594
|
|
|
586
|
-
const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr
|
|
587
|
-
key: _constants.strings.DEFAULT_KEY_COLUMN_TITLE
|
|
588
|
-
}, rawTitle)) && titleArr;
|
|
595
|
+
const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr;
|
|
589
596
|
column = (0, _assign.default)((0, _assign.default)({}, column), {
|
|
590
597
|
title: newTitle
|
|
591
598
|
});
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import _get from "lodash/get";
|
|
1
2
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
2
3
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
4
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
5
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
6
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
7
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
3
8
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
4
9
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
5
10
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
@@ -24,6 +29,49 @@ import '@douyinfe/semi-foundation/lib/es/button/button.css';
|
|
|
24
29
|
const prefixCls = cssClasses.PREFIX;
|
|
25
30
|
const btnSizes = strings.sizes;
|
|
26
31
|
export default class ButtonGroup extends BaseComponent {
|
|
32
|
+
getInnerWithLine(inner) {
|
|
33
|
+
const innerWithLine = [];
|
|
34
|
+
let lineCls = "".concat(prefixCls, "-group-line");
|
|
35
|
+
|
|
36
|
+
if (inner.length > 1) {
|
|
37
|
+
var _context;
|
|
38
|
+
|
|
39
|
+
_forEachInstanceProperty(_context = _sliceInstanceProperty(inner).call(inner, 0, -1)).call(_context, item => {
|
|
40
|
+
var _context2;
|
|
41
|
+
|
|
42
|
+
const isButtonType = _includesInstanceProperty(_context2 = [_get(item, 'type.displayName'), _get(item, 'type.name')]).call(_context2, 'Button');
|
|
43
|
+
|
|
44
|
+
const buttonProps = _get(item, 'props');
|
|
45
|
+
|
|
46
|
+
if (buttonProps) {
|
|
47
|
+
var _context3, _context4;
|
|
48
|
+
|
|
49
|
+
const {
|
|
50
|
+
type,
|
|
51
|
+
theme,
|
|
52
|
+
disabled
|
|
53
|
+
} = buttonProps;
|
|
54
|
+
lineCls = classNames("".concat(prefixCls, "-group-line"), _concatInstanceProperty(_context3 = "".concat(prefixCls, "-group-line-")).call(_context3, theme !== null && theme !== void 0 ? theme : 'light'), _concatInstanceProperty(_context4 = "".concat(prefixCls, "-group-line-")).call(_context4, type !== null && type !== void 0 ? type : 'primary'), {
|
|
55
|
+
["".concat(prefixCls, "-group-line-disabled")]: disabled
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (isButtonType) {
|
|
60
|
+
innerWithLine.push(item, /*#__PURE__*/React.createElement("span", {
|
|
61
|
+
className: lineCls
|
|
62
|
+
}));
|
|
63
|
+
} else {
|
|
64
|
+
innerWithLine.push(item);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
innerWithLine.push(_sliceInstanceProperty(inner).call(inner, -1));
|
|
69
|
+
return innerWithLine;
|
|
70
|
+
} else {
|
|
71
|
+
return inner;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
27
75
|
render() {
|
|
28
76
|
const _a = this.props,
|
|
29
77
|
{
|
|
@@ -37,25 +85,27 @@ export default class ButtonGroup extends BaseComponent {
|
|
|
37
85
|
rest = __rest(_a, ["children", "disabled", "size", "type", "className", 'aria-label']);
|
|
38
86
|
|
|
39
87
|
let inner;
|
|
88
|
+
let innerWithLine = [];
|
|
40
89
|
const cls = classNames("".concat(prefixCls, "-group"), className);
|
|
41
90
|
|
|
42
91
|
if (children) {
|
|
43
|
-
var
|
|
92
|
+
var _context5;
|
|
44
93
|
|
|
45
|
-
inner = _mapInstanceProperty(
|
|
94
|
+
inner = _mapInstanceProperty(_context5 = _Array$isArray(children) ? children : [children]).call(_context5, (itm, index) => /*#__PURE__*/isValidElement(itm) ? /*#__PURE__*/cloneElement(itm, _Object$assign(_Object$assign(_Object$assign({
|
|
46
95
|
disabled,
|
|
47
96
|
size,
|
|
48
97
|
type
|
|
49
98
|
}, itm.props), rest), {
|
|
50
99
|
key: index
|
|
51
100
|
})) : itm);
|
|
101
|
+
innerWithLine = this.getInnerWithLine(inner);
|
|
52
102
|
}
|
|
53
103
|
|
|
54
104
|
return /*#__PURE__*/React.createElement("div", {
|
|
55
105
|
className: cls,
|
|
56
106
|
role: "group",
|
|
57
107
|
"aria-label": ariaLabel
|
|
58
|
-
},
|
|
108
|
+
}, innerWithLine);
|
|
59
109
|
}
|
|
60
110
|
|
|
61
111
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import _isEqual from "lodash/isEqual";
|
|
2
|
-
import _get from "lodash/get";
|
|
3
2
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
4
3
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
5
4
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
6
5
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
7
6
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
8
|
-
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
9
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
10
7
|
|
|
11
8
|
/* eslint-disable max-len */
|
|
12
9
|
import React from 'react';
|
|
@@ -99,8 +96,7 @@ class CheckboxGroup extends BaseComponent {
|
|
|
99
96
|
key: index,
|
|
100
97
|
disabled: this.props.disabled,
|
|
101
98
|
value: option,
|
|
102
|
-
prefixCls: prefixCls
|
|
103
|
-
type: type
|
|
99
|
+
prefixCls: prefixCls
|
|
104
100
|
}, option);
|
|
105
101
|
} else {
|
|
106
102
|
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
@@ -112,34 +108,17 @@ class CheckboxGroup extends BaseComponent {
|
|
|
112
108
|
extra: option.extra,
|
|
113
109
|
className: option.className,
|
|
114
110
|
style: option.style,
|
|
115
|
-
onChange: option.onChange
|
|
116
|
-
type: type
|
|
111
|
+
onChange: option.onChange
|
|
117
112
|
}, option.label);
|
|
118
113
|
}
|
|
119
114
|
});
|
|
120
115
|
} else if (children) {
|
|
121
116
|
var _context6;
|
|
122
117
|
|
|
123
|
-
inner = _mapInstanceProperty(_context6 = React.Children.toArray(children)).call(_context6, (itm, index) => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
key: index,
|
|
128
|
-
role: 'listitem'
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const isCheckboxComp = _someInstanceProperty(_context7 = ['Checkbox', 'CheckboxWithGroup']).call(_context7, comp => {
|
|
132
|
-
var _context8;
|
|
133
|
-
|
|
134
|
-
return _includesInstanceProperty(_context8 = [_get(itm, 'type.displayName'), _get(itm, 'type.name')]).call(_context8, comp);
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
if (isCheckboxComp) {
|
|
138
|
-
props.type = type;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return /*#__PURE__*/React.cloneElement(itm, props);
|
|
142
|
-
});
|
|
118
|
+
inner = _mapInstanceProperty(_context6 = React.Children.toArray(children)).call(_context6, (itm, index) => /*#__PURE__*/React.cloneElement(itm, {
|
|
119
|
+
key: index,
|
|
120
|
+
role: 'listitem'
|
|
121
|
+
}));
|
|
143
122
|
}
|
|
144
123
|
|
|
145
124
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import _noop from "lodash/noop";
|
|
2
|
-
import _get from "lodash/get";
|
|
3
2
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
4
3
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
5
4
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
6
|
-
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
7
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
8
5
|
import React from 'react';
|
|
9
6
|
import PropTypes from 'prop-types';
|
|
10
7
|
import classnames from 'classnames';
|
|
@@ -104,8 +101,7 @@ class RadioGroup extends BaseComponent {
|
|
|
104
101
|
return /*#__PURE__*/React.createElement(Radio, {
|
|
105
102
|
key: index,
|
|
106
103
|
disabled: this.props.disabled,
|
|
107
|
-
value: option
|
|
108
|
-
type: type
|
|
104
|
+
value: option
|
|
109
105
|
}, option);
|
|
110
106
|
} else {
|
|
111
107
|
return /*#__PURE__*/React.createElement(Radio, {
|
|
@@ -114,37 +110,16 @@ class RadioGroup extends BaseComponent {
|
|
|
114
110
|
value: option.value,
|
|
115
111
|
extra: option.extra,
|
|
116
112
|
className: option.className,
|
|
117
|
-
style: option.style
|
|
118
|
-
type: type
|
|
113
|
+
style: option.style
|
|
119
114
|
}, option.label);
|
|
120
115
|
}
|
|
121
116
|
});
|
|
122
117
|
} else if (children) {
|
|
123
118
|
var _context5;
|
|
124
119
|
|
|
125
|
-
inner = _mapInstanceProperty(_context5 = React.Children).call(_context5, children, (itm, index) => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const props = {
|
|
130
|
-
key: index
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const isRadioComp = _someInstanceProperty(_context6 = ['Radio', 'RadioWithGroup']).call(_context6, comp => {
|
|
134
|
-
var _context7;
|
|
135
|
-
|
|
136
|
-
return _includesInstanceProperty(_context7 = [_get(itm, 'type.displayName'), _get(itm, 'type.name')]).call(_context7, comp);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
if (isRadioComp) {
|
|
140
|
-
props.type = type;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return /*#__PURE__*/React.cloneElement(itm, props);
|
|
144
|
-
} else {
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
});
|
|
120
|
+
inner = _mapInstanceProperty(_context5 = React.Children).call(_context5, children, (itm, index) => /*#__PURE__*/React.isValidElement(itm) ? /*#__PURE__*/React.cloneElement(itm, {
|
|
121
|
+
key: index
|
|
122
|
+
}) : null);
|
|
148
123
|
}
|
|
149
124
|
|
|
150
125
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -153,12 +153,14 @@ export default function ColumnFilter() {
|
|
|
153
153
|
} else {
|
|
154
154
|
iconElem = /*#__PURE__*/React.createElement("div", {
|
|
155
155
|
className: finalCls
|
|
156
|
-
},
|
|
156
|
+
}, '\u200b'
|
|
157
|
+
/* ZWSP(zero-width space) */
|
|
158
|
+
, /*#__PURE__*/React.createElement(IconFilter, {
|
|
157
159
|
role: "button",
|
|
158
160
|
"aria-label": "Filter data with this column",
|
|
159
161
|
"aria-haspopup": "listbox",
|
|
160
162
|
tabIndex: -1,
|
|
161
|
-
size: "
|
|
163
|
+
size: "default"
|
|
162
164
|
}));
|
|
163
165
|
}
|
|
164
166
|
|
|
@@ -7,6 +7,7 @@ export interface ColumnSorterProps {
|
|
|
7
7
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
8
8
|
prefixCls?: string;
|
|
9
9
|
sortOrder?: SortOrder;
|
|
10
|
+
title?: React.ReactNode;
|
|
10
11
|
}
|
|
11
12
|
export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
|
|
12
13
|
static propTypes: {
|
|
@@ -12,9 +12,10 @@ export default class ColumnSorter extends PureComponent {
|
|
|
12
12
|
prefixCls,
|
|
13
13
|
onClick,
|
|
14
14
|
sortOrder,
|
|
15
|
-
style
|
|
15
|
+
style,
|
|
16
|
+
title
|
|
16
17
|
} = this.props;
|
|
17
|
-
const iconBtnSize = '
|
|
18
|
+
const iconBtnSize = 'default';
|
|
18
19
|
const upCls = cls("".concat(prefixCls, "-column-sorter-up"), {
|
|
19
20
|
on: sortOrder === strings.SORT_DIRECTIONS[0]
|
|
20
21
|
});
|
|
@@ -33,11 +34,13 @@ export default class ColumnSorter extends PureComponent {
|
|
|
33
34
|
role: 'button'
|
|
34
35
|
}, ariaProps, {
|
|
35
36
|
tabIndex: -1,
|
|
36
|
-
|
|
37
|
-
className: "".concat(prefixCls, "-column-sorter"),
|
|
37
|
+
className: "".concat(prefixCls, "-column-sorter-wrapper"),
|
|
38
38
|
onClick: onClick,
|
|
39
39
|
onKeyPress: e => isEnterPress(e) && onClick(e)
|
|
40
|
-
}), /*#__PURE__*/React.createElement("
|
|
40
|
+
}), title, /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
style: style,
|
|
42
|
+
className: "".concat(prefixCls, "-column-sorter")
|
|
43
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
41
44
|
className: "".concat(upCls)
|
|
42
45
|
}, /*#__PURE__*/React.createElement(IconCaretup, {
|
|
43
46
|
size: iconBtnSize
|
|
@@ -45,7 +48,7 @@ export default class ColumnSorter extends PureComponent {
|
|
|
45
48
|
className: "".concat(downCls)
|
|
46
49
|
}, /*#__PURE__*/React.createElement(IconCaretdown, {
|
|
47
50
|
size: iconBtnSize
|
|
48
|
-
})));
|
|
51
|
+
}))));
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
}
|