@douyinfe/semi-ui 2.18.0-beta.0 → 2.18.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/checkbox/checkbox.tsx +10 -2
- package/dist/css/semi.css +8 -6
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +26416 -27922
- 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/form/baseForm.tsx +0 -1
- package/lib/cjs/checkbox/checkbox.d.ts +4 -0
- package/lib/cjs/checkbox/checkbox.js +9 -3
- package/lib/cjs/form/baseForm.js +0 -1
- package/lib/cjs/radio/radio.d.ts +2 -0
- package/lib/cjs/radio/radio.js +33 -8
- 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/cjs/tabs/TabBar.js +5 -1
- package/lib/cjs/transfer/index.js +7 -2
- package/lib/es/checkbox/checkbox.d.ts +4 -0
- package/lib/es/checkbox/checkbox.js +10 -4
- package/lib/es/form/baseForm.js +0 -1
- package/lib/es/radio/radio.d.ts +2 -0
- package/lib/es/radio/radio.js +31 -8
- 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/lib/es/tabs/TabBar.js +5 -1
- package/lib/es/transfer/index.js +7 -2
- package/package.json +7 -7
- package/radio/radio.tsx +27 -5
- package/table/ColumnFilter.tsx +2 -1
- package/table/ColumnSorter.tsx +16 -10
- package/table/Table.tsx +7 -4
- package/tabs/TabBar.tsx +7 -1
- package/transfer/index.tsx +7 -2
- package/webpack.config.js +13 -3
package/form/baseForm.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import CheckboxInner from './checkboxInner';
|
|
|
5
5
|
import BaseComponent from '../_base/baseComponent';
|
|
6
6
|
import '@douyinfe/semi-foundation/lib/cjs/checkbox/checkbox.css';
|
|
7
7
|
import { CheckboxContextType } from './context';
|
|
8
|
+
import { CheckboxType } from './checkboxGroup';
|
|
8
9
|
export declare type CheckboxEvent = BasicCheckboxEvent;
|
|
9
10
|
export declare type TargetObject = BasicTargetObject;
|
|
10
11
|
export interface CheckboxProps extends BaseCheckboxProps {
|
|
@@ -24,6 +25,7 @@ export interface CheckboxProps extends BaseCheckboxProps {
|
|
|
24
25
|
tabIndex?: number;
|
|
25
26
|
addonId?: string;
|
|
26
27
|
extraId?: string;
|
|
28
|
+
type?: CheckboxType;
|
|
27
29
|
}
|
|
28
30
|
interface CheckboxState {
|
|
29
31
|
checked: boolean;
|
|
@@ -55,6 +57,7 @@ declare class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
55
57
|
'aria-label': PropTypes.Requireable<string>;
|
|
56
58
|
tabIndex: PropTypes.Requireable<number>;
|
|
57
59
|
preventScroll: PropTypes.Requireable<boolean>;
|
|
60
|
+
type: PropTypes.Requireable<string>;
|
|
58
61
|
};
|
|
59
62
|
static defaultProps: {
|
|
60
63
|
defaultChecked: boolean;
|
|
@@ -62,6 +65,7 @@ declare class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
62
65
|
onChange: (...args: any[]) => void;
|
|
63
66
|
onMouseEnter: (...args: any[]) => void;
|
|
64
67
|
onMouseLeave: (...args: any[]) => void;
|
|
68
|
+
type: string;
|
|
65
69
|
};
|
|
66
70
|
checkboxEntity: CheckboxInner;
|
|
67
71
|
context: CheckboxContextType;
|
|
@@ -151,7 +151,8 @@ class Checkbox extends _baseComponent.default {
|
|
|
151
151
|
value,
|
|
152
152
|
role,
|
|
153
153
|
tabIndex,
|
|
154
|
-
id
|
|
154
|
+
id,
|
|
155
|
+
type
|
|
155
156
|
} = this.props;
|
|
156
157
|
const {
|
|
157
158
|
checked,
|
|
@@ -184,6 +185,9 @@ class Checkbox extends _baseComponent.default {
|
|
|
184
185
|
props.isCardType = isCardType;
|
|
185
186
|
props.isPureCardType = isPureCardType;
|
|
186
187
|
props['name'] = this.context.checkboxGroup.name;
|
|
188
|
+
} else {
|
|
189
|
+
props.isPureCardType = type === _constants.strings.TYPE_PURECARD;
|
|
190
|
+
props.isCardType = type === _constants.strings.TYPE_CARD || props.isPureCardType;
|
|
187
191
|
}
|
|
188
192
|
|
|
189
193
|
const prefix = prefixCls || _constants.checkboxClasses.PREFIX;
|
|
@@ -274,14 +278,16 @@ Checkbox.propTypes = {
|
|
|
274
278
|
index: _propTypes.default.number,
|
|
275
279
|
'aria-label': _propTypes.default.string,
|
|
276
280
|
tabIndex: _propTypes.default.number,
|
|
277
|
-
preventScroll: _propTypes.default.bool
|
|
281
|
+
preventScroll: _propTypes.default.bool,
|
|
282
|
+
type: _propTypes.default.string
|
|
278
283
|
};
|
|
279
284
|
Checkbox.defaultProps = {
|
|
280
285
|
defaultChecked: false,
|
|
281
286
|
indeterminate: false,
|
|
282
287
|
onChange: _noop2.default,
|
|
283
288
|
onMouseEnter: _noop2.default,
|
|
284
|
-
onMouseLeave: _noop2.default
|
|
289
|
+
onMouseLeave: _noop2.default,
|
|
290
|
+
type: 'default'
|
|
285
291
|
};
|
|
286
292
|
var _default = Checkbox;
|
|
287
293
|
exports.default = _default;
|
package/lib/cjs/form/baseForm.js
CHANGED
package/lib/cjs/radio/radio.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export interface RadioState {
|
|
|
39
39
|
addonId?: string;
|
|
40
40
|
extraId?: string;
|
|
41
41
|
focusVisible?: boolean;
|
|
42
|
+
checked?: boolean;
|
|
42
43
|
}
|
|
43
44
|
export { RadioChangeEvent };
|
|
44
45
|
declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
@@ -71,6 +72,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
71
72
|
addonId: string;
|
|
72
73
|
extraId: string;
|
|
73
74
|
constructor(props: RadioProps);
|
|
75
|
+
componentDidUpdate(prevProps: RadioProps): void;
|
|
74
76
|
get adapter(): RadioAdapter;
|
|
75
77
|
isInGroup(): {
|
|
76
78
|
value?: string | number;
|
package/lib/cjs/radio/radio.js
CHANGED
|
@@ -14,6 +14,10 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
14
14
|
|
|
15
15
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
16
16
|
|
|
17
|
+
var _isBoolean2 = _interopRequireDefault(require("lodash/isBoolean"));
|
|
18
|
+
|
|
19
|
+
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
|
20
|
+
|
|
17
21
|
var _noop2 = _interopRequireDefault(require("lodash/noop"));
|
|
18
22
|
|
|
19
23
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -53,6 +57,7 @@ class Radio extends _baseComponent.default {
|
|
|
53
57
|
radioGroup.onChange && radioGroup.onChange(e);
|
|
54
58
|
}
|
|
55
59
|
|
|
60
|
+
!('checked' in this.props) && this.foundation.setChecked(e.target.checked);
|
|
56
61
|
onChange && onChange(e);
|
|
57
62
|
};
|
|
58
63
|
|
|
@@ -77,12 +82,23 @@ class Radio extends _baseComponent.default {
|
|
|
77
82
|
this.state = {
|
|
78
83
|
hover: false,
|
|
79
84
|
addonId: props.addonId,
|
|
80
|
-
extraId: props.extraId
|
|
85
|
+
extraId: props.extraId,
|
|
86
|
+
checked: props.checked || props.defaultChecked || false
|
|
81
87
|
};
|
|
82
88
|
this.foundation = new _radioFoundation.default(this.adapter);
|
|
83
89
|
this.radioEntity = null;
|
|
84
90
|
}
|
|
85
91
|
|
|
92
|
+
componentDidUpdate(prevProps) {
|
|
93
|
+
if (this.props.checked !== prevProps.checked) {
|
|
94
|
+
if ((0, _isUndefined2.default)(this.props.checked)) {
|
|
95
|
+
this.foundation.setChecked(false);
|
|
96
|
+
} else if ((0, _isBoolean2.default)(this.props.checked)) {
|
|
97
|
+
this.foundation.setChecked(this.props.checked);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
86
102
|
get adapter() {
|
|
87
103
|
return (0, _assign.default)((0, _assign.default)({}, super.adapter), {
|
|
88
104
|
setHover: hover => {
|
|
@@ -97,6 +113,11 @@ class Radio extends _baseComponent.default {
|
|
|
97
113
|
})
|
|
98
114
|
});
|
|
99
115
|
},
|
|
116
|
+
setChecked: checked => {
|
|
117
|
+
this.setState({
|
|
118
|
+
checked
|
|
119
|
+
});
|
|
120
|
+
},
|
|
100
121
|
setExtraId: () => {
|
|
101
122
|
this.setState({
|
|
102
123
|
extraId: (0, _uuid.getUuidShort)({
|
|
@@ -131,7 +152,6 @@ class Radio extends _baseComponent.default {
|
|
|
131
152
|
const {
|
|
132
153
|
addonClassName,
|
|
133
154
|
addonStyle,
|
|
134
|
-
checked,
|
|
135
155
|
disabled,
|
|
136
156
|
style,
|
|
137
157
|
className,
|
|
@@ -149,9 +169,13 @@ class Radio extends _baseComponent.default {
|
|
|
149
169
|
hover: isHover,
|
|
150
170
|
addonId,
|
|
151
171
|
extraId,
|
|
152
|
-
focusVisible
|
|
172
|
+
focusVisible,
|
|
173
|
+
checked
|
|
153
174
|
} = this.state;
|
|
154
|
-
|
|
175
|
+
const props = {
|
|
176
|
+
checked,
|
|
177
|
+
disabled
|
|
178
|
+
};
|
|
155
179
|
|
|
156
180
|
if (this.isInGroup()) {
|
|
157
181
|
realChecked = this.context.radioGroup.value === propValue;
|
|
@@ -162,16 +186,17 @@ class Radio extends _baseComponent.default {
|
|
|
162
186
|
isPureCardRadioGroup = this.context.radioGroup.isPureCardRadio;
|
|
163
187
|
buttonSize = this.context.radioGroup.buttonSize;
|
|
164
188
|
realPrefixCls = prefixCls || this.context.radioGroup.prefixCls;
|
|
165
|
-
props =
|
|
166
|
-
|
|
167
|
-
disabled: isDisabled
|
|
168
|
-
};
|
|
189
|
+
props.checked = realChecked;
|
|
190
|
+
props.disabled = isDisabled;
|
|
169
191
|
} else {
|
|
170
192
|
realChecked = checked;
|
|
171
193
|
isDisabled = disabled;
|
|
172
194
|
realMode = mode;
|
|
173
195
|
isButtonRadioComponent = type === 'button';
|
|
174
196
|
realPrefixCls = prefixCls;
|
|
197
|
+
isButtonRadioGroup = type === _constants.strings.TYPE_BUTTON;
|
|
198
|
+
isPureCardRadioGroup = type === _constants.strings.TYPE_PURECARD;
|
|
199
|
+
isCardRadioGroup = type === _constants.strings.TYPE_CARD || isPureCardRadioGroup;
|
|
175
200
|
}
|
|
176
201
|
|
|
177
202
|
const isButtonRadio = typeof isButtonRadioGroup === 'undefined' ? isButtonRadioComponent : isButtonRadioGroup;
|
|
@@ -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
|
});
|
package/lib/cjs/tabs/TabBar.js
CHANGED
|
@@ -151,7 +151,11 @@ class TabBar extends _react.default.Component {
|
|
|
151
151
|
var _context5, _context6;
|
|
152
152
|
|
|
153
153
|
if ((0, _isEmpty2.default)(items)) {
|
|
154
|
-
return
|
|
154
|
+
return /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
155
|
+
disabled: true,
|
|
156
|
+
icon: icon,
|
|
157
|
+
theme: "borderless"
|
|
158
|
+
});
|
|
155
159
|
}
|
|
156
160
|
|
|
157
161
|
const {
|
|
@@ -322,7 +322,8 @@ class Transfer extends _baseComponent.default {
|
|
|
322
322
|
const noMatch = inSearchMode && searchResult.size === 0;
|
|
323
323
|
const emptySearch = emptyContent.search ? emptyContent.search : locale.emptySearch;
|
|
324
324
|
const emptyLeft = emptyContent.left ? emptyContent.left : locale.emptyLeft;
|
|
325
|
-
const
|
|
325
|
+
const emptyDataCom = this.renderEmpty('left', emptyLeft);
|
|
326
|
+
const emptySearchCom = this.renderEmpty('left', emptySearch);
|
|
326
327
|
|
|
327
328
|
const loadingCom = /*#__PURE__*/_react.default.createElement(_spin.default, null);
|
|
328
329
|
|
|
@@ -334,7 +335,11 @@ class Transfer extends _baseComponent.default {
|
|
|
334
335
|
break;
|
|
335
336
|
|
|
336
337
|
case noMatch:
|
|
337
|
-
content =
|
|
338
|
+
content = emptySearchCom;
|
|
339
|
+
break;
|
|
340
|
+
|
|
341
|
+
case data.length === 0:
|
|
342
|
+
content = emptyDataCom;
|
|
338
343
|
break;
|
|
339
344
|
|
|
340
345
|
case type === _constants.strings.TYPE_TREE_TO_LIST:
|
|
@@ -5,6 +5,7 @@ import CheckboxInner from './checkboxInner';
|
|
|
5
5
|
import BaseComponent from '../_base/baseComponent';
|
|
6
6
|
import '@douyinfe/semi-foundation/lib/es/checkbox/checkbox.css';
|
|
7
7
|
import { CheckboxContextType } from './context';
|
|
8
|
+
import { CheckboxType } from './checkboxGroup';
|
|
8
9
|
export declare type CheckboxEvent = BasicCheckboxEvent;
|
|
9
10
|
export declare type TargetObject = BasicTargetObject;
|
|
10
11
|
export interface CheckboxProps extends BaseCheckboxProps {
|
|
@@ -24,6 +25,7 @@ export interface CheckboxProps extends BaseCheckboxProps {
|
|
|
24
25
|
tabIndex?: number;
|
|
25
26
|
addonId?: string;
|
|
26
27
|
extraId?: string;
|
|
28
|
+
type?: CheckboxType;
|
|
27
29
|
}
|
|
28
30
|
interface CheckboxState {
|
|
29
31
|
checked: boolean;
|
|
@@ -55,6 +57,7 @@ declare class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
55
57
|
'aria-label': PropTypes.Requireable<string>;
|
|
56
58
|
tabIndex: PropTypes.Requireable<number>;
|
|
57
59
|
preventScroll: PropTypes.Requireable<boolean>;
|
|
60
|
+
type: PropTypes.Requireable<string>;
|
|
58
61
|
};
|
|
59
62
|
static defaultProps: {
|
|
60
63
|
defaultChecked: boolean;
|
|
@@ -62,6 +65,7 @@ declare class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
62
65
|
onChange: (...args: any[]) => void;
|
|
63
66
|
onMouseEnter: (...args: any[]) => void;
|
|
64
67
|
onMouseLeave: (...args: any[]) => void;
|
|
68
|
+
type: string;
|
|
65
69
|
};
|
|
66
70
|
checkboxEntity: CheckboxInner;
|
|
67
71
|
context: CheckboxContextType;
|
|
@@ -8,7 +8,7 @@ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/ins
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import classnames from 'classnames';
|
|
11
|
-
import { checkboxClasses as css } from '@douyinfe/semi-foundation/lib/es/checkbox/constants';
|
|
11
|
+
import { checkboxClasses as css, strings } from '@douyinfe/semi-foundation/lib/es/checkbox/constants';
|
|
12
12
|
import CheckboxFoundation from '@douyinfe/semi-foundation/lib/es/checkbox/checkboxFoundation';
|
|
13
13
|
import CheckboxInner from './checkboxInner';
|
|
14
14
|
import BaseComponent from '../_base/baseComponent';
|
|
@@ -126,7 +126,8 @@ class Checkbox extends BaseComponent {
|
|
|
126
126
|
value,
|
|
127
127
|
role,
|
|
128
128
|
tabIndex,
|
|
129
|
-
id
|
|
129
|
+
id,
|
|
130
|
+
type
|
|
130
131
|
} = this.props;
|
|
131
132
|
const {
|
|
132
133
|
checked,
|
|
@@ -160,6 +161,9 @@ class Checkbox extends BaseComponent {
|
|
|
160
161
|
props.isCardType = isCardType;
|
|
161
162
|
props.isPureCardType = isPureCardType;
|
|
162
163
|
props['name'] = this.context.checkboxGroup.name;
|
|
164
|
+
} else {
|
|
165
|
+
props.isPureCardType = type === strings.TYPE_PURECARD;
|
|
166
|
+
props.isCardType = type === strings.TYPE_CARD || props.isPureCardType;
|
|
163
167
|
}
|
|
164
168
|
|
|
165
169
|
const prefix = prefixCls || css.PREFIX;
|
|
@@ -250,13 +254,15 @@ Checkbox.propTypes = {
|
|
|
250
254
|
index: PropTypes.number,
|
|
251
255
|
'aria-label': PropTypes.string,
|
|
252
256
|
tabIndex: PropTypes.number,
|
|
253
|
-
preventScroll: PropTypes.bool
|
|
257
|
+
preventScroll: PropTypes.bool,
|
|
258
|
+
type: PropTypes.string
|
|
254
259
|
};
|
|
255
260
|
Checkbox.defaultProps = {
|
|
256
261
|
defaultChecked: false,
|
|
257
262
|
indeterminate: false,
|
|
258
263
|
onChange: _noop,
|
|
259
264
|
onMouseEnter: _noop,
|
|
260
|
-
onMouseLeave: _noop
|
|
265
|
+
onMouseLeave: _noop,
|
|
266
|
+
type: 'default'
|
|
261
267
|
};
|
|
262
268
|
export default Checkbox;
|
package/lib/es/form/baseForm.js
CHANGED
package/lib/es/radio/radio.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export interface RadioState {
|
|
|
39
39
|
addonId?: string;
|
|
40
40
|
extraId?: string;
|
|
41
41
|
focusVisible?: boolean;
|
|
42
|
+
checked?: boolean;
|
|
42
43
|
}
|
|
43
44
|
export { RadioChangeEvent };
|
|
44
45
|
declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
@@ -71,6 +72,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
71
72
|
addonId: string;
|
|
72
73
|
extraId: string;
|
|
73
74
|
constructor(props: RadioProps);
|
|
75
|
+
componentDidUpdate(prevProps: RadioProps): void;
|
|
74
76
|
get adapter(): RadioAdapter;
|
|
75
77
|
isInGroup(): {
|
|
76
78
|
value?: string | number;
|
package/lib/es/radio/radio.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _isBoolean from "lodash/isBoolean";
|
|
2
|
+
import _isUndefined from "lodash/isUndefined";
|
|
1
3
|
import _noop from "lodash/noop";
|
|
2
4
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
3
5
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
@@ -30,6 +32,7 @@ class Radio extends BaseComponent {
|
|
|
30
32
|
radioGroup.onChange && radioGroup.onChange(e);
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
!('checked' in this.props) && this.foundation.setChecked(e.target.checked);
|
|
33
36
|
onChange && onChange(e);
|
|
34
37
|
};
|
|
35
38
|
|
|
@@ -54,12 +57,23 @@ class Radio extends BaseComponent {
|
|
|
54
57
|
this.state = {
|
|
55
58
|
hover: false,
|
|
56
59
|
addonId: props.addonId,
|
|
57
|
-
extraId: props.extraId
|
|
60
|
+
extraId: props.extraId,
|
|
61
|
+
checked: props.checked || props.defaultChecked || false
|
|
58
62
|
};
|
|
59
63
|
this.foundation = new RadioFoundation(this.adapter);
|
|
60
64
|
this.radioEntity = null;
|
|
61
65
|
}
|
|
62
66
|
|
|
67
|
+
componentDidUpdate(prevProps) {
|
|
68
|
+
if (this.props.checked !== prevProps.checked) {
|
|
69
|
+
if (_isUndefined(this.props.checked)) {
|
|
70
|
+
this.foundation.setChecked(false);
|
|
71
|
+
} else if (_isBoolean(this.props.checked)) {
|
|
72
|
+
this.foundation.setChecked(this.props.checked);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
63
77
|
get adapter() {
|
|
64
78
|
return _Object$assign(_Object$assign({}, super.adapter), {
|
|
65
79
|
setHover: hover => {
|
|
@@ -74,6 +88,11 @@ class Radio extends BaseComponent {
|
|
|
74
88
|
})
|
|
75
89
|
});
|
|
76
90
|
},
|
|
91
|
+
setChecked: checked => {
|
|
92
|
+
this.setState({
|
|
93
|
+
checked
|
|
94
|
+
});
|
|
95
|
+
},
|
|
77
96
|
setExtraId: () => {
|
|
78
97
|
this.setState({
|
|
79
98
|
extraId: getUuidShort({
|
|
@@ -108,7 +127,6 @@ class Radio extends BaseComponent {
|
|
|
108
127
|
const {
|
|
109
128
|
addonClassName,
|
|
110
129
|
addonStyle,
|
|
111
|
-
checked,
|
|
112
130
|
disabled,
|
|
113
131
|
style,
|
|
114
132
|
className,
|
|
@@ -126,9 +144,13 @@ class Radio extends BaseComponent {
|
|
|
126
144
|
hover: isHover,
|
|
127
145
|
addonId,
|
|
128
146
|
extraId,
|
|
129
|
-
focusVisible
|
|
147
|
+
focusVisible,
|
|
148
|
+
checked
|
|
130
149
|
} = this.state;
|
|
131
|
-
|
|
150
|
+
const props = {
|
|
151
|
+
checked,
|
|
152
|
+
disabled
|
|
153
|
+
};
|
|
132
154
|
|
|
133
155
|
if (this.isInGroup()) {
|
|
134
156
|
realChecked = this.context.radioGroup.value === propValue;
|
|
@@ -139,16 +161,17 @@ class Radio extends BaseComponent {
|
|
|
139
161
|
isPureCardRadioGroup = this.context.radioGroup.isPureCardRadio;
|
|
140
162
|
buttonSize = this.context.radioGroup.buttonSize;
|
|
141
163
|
realPrefixCls = prefixCls || this.context.radioGroup.prefixCls;
|
|
142
|
-
props =
|
|
143
|
-
|
|
144
|
-
disabled: isDisabled
|
|
145
|
-
};
|
|
164
|
+
props.checked = realChecked;
|
|
165
|
+
props.disabled = isDisabled;
|
|
146
166
|
} else {
|
|
147
167
|
realChecked = checked;
|
|
148
168
|
isDisabled = disabled;
|
|
149
169
|
realMode = mode;
|
|
150
170
|
isButtonRadioComponent = type === 'button';
|
|
151
171
|
realPrefixCls = prefixCls;
|
|
172
|
+
isButtonRadioGroup = type === strings.TYPE_BUTTON;
|
|
173
|
+
isPureCardRadioGroup = type === strings.TYPE_PURECARD;
|
|
174
|
+
isCardRadioGroup = type === strings.TYPE_CARD || isPureCardRadioGroup;
|
|
152
175
|
}
|
|
153
176
|
|
|
154
177
|
const isButtonRadio = typeof isButtonRadioGroup === 'undefined' ? isButtonRadioComponent : isButtonRadioGroup;
|
|
@@ -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
|
}
|
package/lib/es/table/Table.js
CHANGED
|
@@ -494,15 +494,23 @@ class Table extends BaseComponent {
|
|
|
494
494
|
const defaultSortOrder = _get(curQuery, 'defaultSortOrder', false);
|
|
495
495
|
|
|
496
496
|
const sortOrder = _this.foundation.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
|
|
497
|
+
const TitleNode = typeof rawTitle !== 'function' && /*#__PURE__*/React.createElement(React.Fragment, {
|
|
498
|
+
key: strings.DEFAULT_KEY_COLUMN_TITLE
|
|
499
|
+
}, rawTitle);
|
|
497
500
|
|
|
498
501
|
if (typeof column.sorter === 'function' || column.sorter === true) {
|
|
502
|
+
// In order to increase the click hot area of sorting, when sorting is required & useFullRender is false,
|
|
503
|
+
// both the title and sorting areas are used as the click hot area for sorting。
|
|
499
504
|
const sorter = /*#__PURE__*/React.createElement(ColumnSorter, {
|
|
500
505
|
key: strings.DEFAULT_KEY_COLUMN_SORTER,
|
|
501
506
|
sortOrder: sortOrder,
|
|
502
|
-
onClick: e => _this.foundation.handleSort(column, e)
|
|
507
|
+
onClick: e => _this.foundation.handleSort(column, e),
|
|
508
|
+
title: TitleNode
|
|
503
509
|
});
|
|
504
510
|
useFullRender && (titleMap.sorter = sorter);
|
|
505
511
|
titleArr.push(sorter);
|
|
512
|
+
} else {
|
|
513
|
+
titleArr.push(TitleNode);
|
|
506
514
|
}
|
|
507
515
|
|
|
508
516
|
const stateFilteredValue = _get(curQuery, 'filteredValue');
|
|
@@ -523,9 +531,7 @@ class Table extends BaseComponent {
|
|
|
523
531
|
titleArr.push(filter);
|
|
524
532
|
}
|
|
525
533
|
|
|
526
|
-
const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr
|
|
527
|
-
key: strings.DEFAULT_KEY_COLUMN_TITLE
|
|
528
|
-
}, rawTitle)) && titleArr;
|
|
534
|
+
const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr;
|
|
529
535
|
column = _Object$assign(_Object$assign({}, column), {
|
|
530
536
|
title: newTitle
|
|
531
537
|
});
|
package/lib/es/tabs/TabBar.js
CHANGED
|
@@ -125,7 +125,11 @@ class TabBar extends React.Component {
|
|
|
125
125
|
var _context5, _context6;
|
|
126
126
|
|
|
127
127
|
if (_isEmpty(items)) {
|
|
128
|
-
return
|
|
128
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
129
|
+
disabled: true,
|
|
130
|
+
icon: icon,
|
|
131
|
+
theme: "borderless"
|
|
132
|
+
});
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
const {
|