@douyinfe/semi-ui 2.18.0 → 2.19.0-alpha.2
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/checkboxGroup.tsx +11 -2
- package/dist/css/semi.css +6 -8
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +315 -288
- 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 +1 -0
- package/lib/cjs/checkbox/checkboxGroup.js +31 -8
- package/lib/cjs/form/baseForm.js +1 -0
- package/lib/cjs/radio/radioGroup.js +34 -7
- package/lib/cjs/table/ColumnFilter.js +2 -4
- package/lib/cjs/table/ColumnSorter.d.ts +0 -1
- package/lib/cjs/table/ColumnSorter.js +6 -9
- package/lib/cjs/table/Table.js +4 -11
- package/lib/cjs/tabs/TabBar.js +1 -5
- package/lib/cjs/transfer/index.js +2 -7
- package/lib/es/checkbox/checkboxGroup.js +27 -6
- package/lib/es/form/baseForm.js +1 -0
- package/lib/es/radio/radioGroup.js +30 -5
- package/lib/es/table/ColumnFilter.js +2 -4
- package/lib/es/table/ColumnSorter.d.ts +0 -1
- package/lib/es/table/ColumnSorter.js +6 -9
- package/lib/es/table/Table.js +4 -10
- package/lib/es/tabs/TabBar.js +1 -5
- package/lib/es/transfer/index.js +2 -7
- package/package.json +7 -7
- package/radio/radioGroup.tsx +15 -4
- package/table/ColumnFilter.tsx +1 -2
- package/table/ColumnSorter.tsx +10 -16
- package/table/Table.tsx +4 -7
- package/tabs/TabBar.tsx +1 -7
- package/transfer/index.tsx +2 -7
- package/webpack.config.js +1 -3
package/radio/radioGroup.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
import { noop } from 'lodash';
|
|
4
|
+
import { get, noop } from 'lodash';
|
|
5
5
|
|
|
6
6
|
import { radioGroupClasses as css, strings } from '@douyinfe/semi-foundation/radio/constants';
|
|
7
7
|
import RadioGroupFoundation, { RadioGroupAdapter } from '@douyinfe/semi-foundation/radio/radioGroupFoundation';
|
|
@@ -177,6 +177,7 @@ class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState> {
|
|
|
177
177
|
key={index}
|
|
178
178
|
disabled={this.props.disabled}
|
|
179
179
|
value={option}
|
|
180
|
+
type={type}
|
|
180
181
|
>
|
|
181
182
|
{option}
|
|
182
183
|
</Radio>
|
|
@@ -190,6 +191,7 @@ class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState> {
|
|
|
190
191
|
extra={option.extra}
|
|
191
192
|
className={option.className}
|
|
192
193
|
style={option.style}
|
|
194
|
+
type={type}
|
|
193
195
|
>
|
|
194
196
|
{option.label}
|
|
195
197
|
</Radio>
|
|
@@ -197,9 +199,18 @@ class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState> {
|
|
|
197
199
|
}
|
|
198
200
|
});
|
|
199
201
|
} else if (children) {
|
|
200
|
-
inner = React.Children.map(children, (itm, index) =>
|
|
201
|
-
React.
|
|
202
|
-
|
|
202
|
+
inner = React.Children.map(children, (itm, index) => {
|
|
203
|
+
if (React.isValidElement(itm)) {
|
|
204
|
+
const props: Record<string, any> = { key: index };
|
|
205
|
+
const isRadioComp = ['Radio', 'RadioWithGroup'].some(comp => [get(itm, 'type.displayName'), get(itm, 'type.name')].includes(comp));
|
|
206
|
+
if (isRadioComp) {
|
|
207
|
+
props.type = type;
|
|
208
|
+
}
|
|
209
|
+
return React.cloneElement(itm, props);
|
|
210
|
+
} else {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
203
214
|
}
|
|
204
215
|
|
|
205
216
|
return (
|
package/table/ColumnFilter.tsx
CHANGED
|
@@ -164,13 +164,12 @@ export default function ColumnFilter(props: ColumnFilterProps = {}): React.React
|
|
|
164
164
|
} else {
|
|
165
165
|
iconElem = (
|
|
166
166
|
<div className={finalCls}>
|
|
167
|
-
{'\u200b'/* ZWSP(zero-width space) */}
|
|
168
167
|
<IconFilter
|
|
169
168
|
role="button"
|
|
170
169
|
aria-label="Filter data with this column"
|
|
171
170
|
aria-haspopup="listbox"
|
|
172
171
|
tabIndex={-1}
|
|
173
|
-
size="
|
|
172
|
+
size="small"
|
|
174
173
|
/>
|
|
175
174
|
</div>
|
|
176
175
|
);
|
package/table/ColumnSorter.tsx
CHANGED
|
@@ -15,7 +15,6 @@ export interface ColumnSorterProps {
|
|
|
15
15
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
16
16
|
prefixCls?: string;
|
|
17
17
|
sortOrder?: SortOrder;
|
|
18
|
-
title?: React.ReactNode;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
|
|
@@ -34,9 +33,9 @@ export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
|
|
|
34
33
|
};
|
|
35
34
|
|
|
36
35
|
render() {
|
|
37
|
-
const { prefixCls, onClick, sortOrder, style
|
|
36
|
+
const { prefixCls, onClick, sortOrder, style } = this.props;
|
|
38
37
|
|
|
39
|
-
const iconBtnSize = '
|
|
38
|
+
const iconBtnSize = 'small';
|
|
40
39
|
|
|
41
40
|
const upCls = cls(`${prefixCls}-column-sorter-up`, {
|
|
42
41
|
on: sortOrder === strings.SORT_DIRECTIONS[0],
|
|
@@ -59,22 +58,17 @@ export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
|
|
|
59
58
|
role='button'
|
|
60
59
|
{...ariaProps}
|
|
61
60
|
tabIndex={-1}
|
|
62
|
-
|
|
61
|
+
style={style}
|
|
62
|
+
className={`${prefixCls}-column-sorter`}
|
|
63
63
|
onClick={onClick}
|
|
64
64
|
onKeyPress={e => isEnterPress(e) && onClick(e as any)}
|
|
65
65
|
>
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<IconCaretup size={iconBtnSize} />
|
|
73
|
-
</span>
|
|
74
|
-
<span className={`${downCls}`}>
|
|
75
|
-
<IconCaretdown size={iconBtnSize} />
|
|
76
|
-
</span>
|
|
77
|
-
</div>
|
|
66
|
+
<span className={`${upCls}`}>
|
|
67
|
+
<IconCaretup size={iconBtnSize} />
|
|
68
|
+
</span>
|
|
69
|
+
<span className={`${downCls}`}>
|
|
70
|
+
<IconCaretdown size={iconBtnSize} />
|
|
71
|
+
</span>
|
|
78
72
|
</div>
|
|
79
73
|
);
|
|
80
74
|
}
|
package/table/Table.tsx
CHANGED
|
@@ -933,22 +933,16 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
933
933
|
const stateSortOrder = get(curQuery, 'sortOrder');
|
|
934
934
|
const defaultSortOrder = get(curQuery, 'defaultSortOrder', false);
|
|
935
935
|
const sortOrder = this.foundation.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
|
|
936
|
-
const TitleNode = typeof rawTitle !== 'function' && <React.Fragment key={strings.DEFAULT_KEY_COLUMN_TITLE}>{rawTitle as React.ReactNode}</React.Fragment>;
|
|
937
936
|
if (typeof column.sorter === 'function' || column.sorter === true) {
|
|
938
|
-
// In order to increase the click hot area of sorting, when sorting is required & useFullRender is false,
|
|
939
|
-
// both the title and sorting areas are used as the click hot area for sorting。
|
|
940
937
|
const sorter = (
|
|
941
938
|
<ColumnSorter
|
|
942
939
|
key={strings.DEFAULT_KEY_COLUMN_SORTER}
|
|
943
940
|
sortOrder={sortOrder}
|
|
944
941
|
onClick={e => this.foundation.handleSort(column, e)}
|
|
945
|
-
title={TitleNode}
|
|
946
942
|
/>
|
|
947
943
|
);
|
|
948
944
|
useFullRender && (titleMap.sorter = sorter);
|
|
949
945
|
titleArr.push(sorter);
|
|
950
|
-
} else {
|
|
951
|
-
titleArr.push(TitleNode);
|
|
952
946
|
}
|
|
953
947
|
|
|
954
948
|
const stateFilteredValue = get(curQuery, 'filteredValue');
|
|
@@ -970,7 +964,10 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
970
964
|
|
|
971
965
|
const newTitle =
|
|
972
966
|
typeof rawTitle === 'function' ?
|
|
973
|
-
() => rawTitle(titleMap) :
|
|
967
|
+
() => rawTitle(titleMap) :
|
|
968
|
+
titleArr.unshift(
|
|
969
|
+
<React.Fragment key={strings.DEFAULT_KEY_COLUMN_TITLE}>{rawTitle}</React.Fragment>
|
|
970
|
+
) && titleArr;
|
|
974
971
|
|
|
975
972
|
column = { ...column, title: newTitle };
|
|
976
973
|
}
|
package/tabs/TabBar.tsx
CHANGED
|
@@ -147,13 +147,7 @@ class TabBar extends React.Component<TabBarProps, TabBarState> {
|
|
|
147
147
|
|
|
148
148
|
renderCollapse = (items: Array<OverflowItem>, icon: ReactNode, pos: 'start' | 'end'): ReactNode => {
|
|
149
149
|
if (isEmpty(items)) {
|
|
150
|
-
return
|
|
151
|
-
<Button
|
|
152
|
-
disabled={true}
|
|
153
|
-
icon={icon}
|
|
154
|
-
theme="borderless"
|
|
155
|
-
/>
|
|
156
|
-
);
|
|
150
|
+
return null;
|
|
157
151
|
}
|
|
158
152
|
const { dropdownClassName, dropdownStyle } = this.props;
|
|
159
153
|
const { rePosKey } = this.state;
|
package/transfer/index.tsx
CHANGED
|
@@ -393,9 +393,7 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
|
|
|
393
393
|
const noMatch = inSearchMode && searchResult.size === 0;
|
|
394
394
|
const emptySearch = emptyContent.search ? emptyContent.search : locale.emptySearch;
|
|
395
395
|
const emptyLeft = emptyContent.left ? emptyContent.left : locale.emptyLeft;
|
|
396
|
-
const
|
|
397
|
-
const emptySearchCom = this.renderEmpty('left', emptySearch);
|
|
398
|
-
|
|
396
|
+
const emptyCom = this.renderEmpty('left', inputValue ? emptySearch : emptyLeft);
|
|
399
397
|
const loadingCom = <Spin />;
|
|
400
398
|
|
|
401
399
|
let content: React.ReactNode = null;
|
|
@@ -404,10 +402,7 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
|
|
|
404
402
|
content = loadingCom;
|
|
405
403
|
break;
|
|
406
404
|
case noMatch:
|
|
407
|
-
content =
|
|
408
|
-
break;
|
|
409
|
-
case data.length === 0:
|
|
410
|
-
content = emptyDataCom;
|
|
405
|
+
content = emptyCom;
|
|
411
406
|
break;
|
|
412
407
|
case type === strings.TYPE_TREE_TO_LIST:
|
|
413
408
|
content = (
|
package/webpack.config.js
CHANGED
|
@@ -29,9 +29,7 @@ module.exports = function ({ minimize }) {
|
|
|
29
29
|
test: /\.tsx?$/,
|
|
30
30
|
include: [
|
|
31
31
|
path.join(rootPath, 'packages/semi-ui'),
|
|
32
|
-
path.join(rootPath, 'packages/semi-foundation')
|
|
33
|
-
path.join(rootPath, 'packages/semi-animation'),
|
|
34
|
-
path.join(rootPath, 'packages/semi-animation-react')
|
|
32
|
+
path.join(rootPath, 'packages/semi-foundation')
|
|
35
33
|
],
|
|
36
34
|
use: [
|
|
37
35
|
{
|