@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
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.19.0-alpha.
|
|
3
|
+
"version": "2.19.0-alpha.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
17
17
|
"@douyinfe/semi-animation": "2.12.0",
|
|
18
|
-
"@douyinfe/semi-animation-react": "2.19.0-alpha.
|
|
19
|
-
"@douyinfe/semi-foundation": "2.19.0-alpha.
|
|
20
|
-
"@douyinfe/semi-icons": "2.19.0-alpha.
|
|
18
|
+
"@douyinfe/semi-animation-react": "2.19.0-alpha.5",
|
|
19
|
+
"@douyinfe/semi-foundation": "2.19.0-alpha.5",
|
|
20
|
+
"@douyinfe/semi-icons": "2.19.0-alpha.5",
|
|
21
21
|
"@douyinfe/semi-illustrations": "2.15.0",
|
|
22
|
-
"@douyinfe/semi-theme-default": "2.19.0-alpha.
|
|
22
|
+
"@douyinfe/semi-theme-default": "2.19.0-alpha.5",
|
|
23
23
|
"async-validator": "^3.5.0",
|
|
24
24
|
"classnames": "^2.2.6",
|
|
25
25
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
],
|
|
67
67
|
"author": "",
|
|
68
68
|
"license": "MIT",
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "f49d77763d9cf17af15945bddd04557e57858b4b",
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
72
72
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
73
73
|
"@babel/preset-env": "^7.15.8",
|
|
74
74
|
"@babel/preset-react": "^7.14.5",
|
|
75
|
-
"@douyinfe/semi-scss-compile": "2.19.0-alpha.
|
|
75
|
+
"@douyinfe/semi-scss-compile": "2.19.0-alpha.5",
|
|
76
76
|
"@storybook/addon-knobs": "^6.3.1",
|
|
77
77
|
"@types/lodash": "^4.14.176",
|
|
78
78
|
"@types/react": ">=16.0.0",
|
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 {
|
|
4
|
+
import { 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,7 +177,6 @@ class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState> {
|
|
|
177
177
|
key={index}
|
|
178
178
|
disabled={this.props.disabled}
|
|
179
179
|
value={option}
|
|
180
|
-
type={type}
|
|
181
180
|
>
|
|
182
181
|
{option}
|
|
183
182
|
</Radio>
|
|
@@ -191,7 +190,6 @@ class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState> {
|
|
|
191
190
|
extra={option.extra}
|
|
192
191
|
className={option.className}
|
|
193
192
|
style={option.style}
|
|
194
|
-
type={type}
|
|
195
193
|
>
|
|
196
194
|
{option.label}
|
|
197
195
|
</Radio>
|
|
@@ -199,18 +197,9 @@ class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState> {
|
|
|
199
197
|
}
|
|
200
198
|
});
|
|
201
199
|
} else if (children) {
|
|
202
|
-
inner = React.Children.map(children, (itm, index) =>
|
|
203
|
-
|
|
204
|
-
|
|
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
|
-
});
|
|
200
|
+
inner = React.Children.map(children, (itm, index) => (React.isValidElement(itm) ?
|
|
201
|
+
React.cloneElement(itm, { key: index }) :
|
|
202
|
+
null));
|
|
214
203
|
}
|
|
215
204
|
|
|
216
205
|
return (
|
package/table/ColumnFilter.tsx
CHANGED
|
@@ -164,12 +164,13 @@ 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) */}
|
|
167
168
|
<IconFilter
|
|
168
169
|
role="button"
|
|
169
170
|
aria-label="Filter data with this column"
|
|
170
171
|
aria-haspopup="listbox"
|
|
171
172
|
tabIndex={-1}
|
|
172
|
-
size="
|
|
173
|
+
size="default"
|
|
173
174
|
/>
|
|
174
175
|
</div>
|
|
175
176
|
);
|
package/table/ColumnSorter.tsx
CHANGED
|
@@ -15,6 +15,7 @@ export interface ColumnSorterProps {
|
|
|
15
15
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
16
16
|
prefixCls?: string;
|
|
17
17
|
sortOrder?: SortOrder;
|
|
18
|
+
title?: React.ReactNode;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
|
|
@@ -33,9 +34,9 @@ export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
|
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
render() {
|
|
36
|
-
const { prefixCls, onClick, sortOrder, style } = this.props;
|
|
37
|
+
const { prefixCls, onClick, sortOrder, style, title } = this.props;
|
|
37
38
|
|
|
38
|
-
const iconBtnSize = '
|
|
39
|
+
const iconBtnSize = 'default';
|
|
39
40
|
|
|
40
41
|
const upCls = cls(`${prefixCls}-column-sorter-up`, {
|
|
41
42
|
on: sortOrder === strings.SORT_DIRECTIONS[0],
|
|
@@ -58,17 +59,22 @@ export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
|
|
|
58
59
|
role='button'
|
|
59
60
|
{...ariaProps}
|
|
60
61
|
tabIndex={-1}
|
|
61
|
-
|
|
62
|
-
className={`${prefixCls}-column-sorter`}
|
|
62
|
+
className={`${prefixCls}-column-sorter-wrapper`}
|
|
63
63
|
onClick={onClick}
|
|
64
64
|
onKeyPress={e => isEnterPress(e) && onClick(e as any)}
|
|
65
65
|
>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
{title}
|
|
67
|
+
<div
|
|
68
|
+
style={style}
|
|
69
|
+
className={`${prefixCls}-column-sorter`}
|
|
70
|
+
>
|
|
71
|
+
<span className={`${upCls}`}>
|
|
72
|
+
<IconCaretup size={iconBtnSize} />
|
|
73
|
+
</span>
|
|
74
|
+
<span className={`${downCls}`}>
|
|
75
|
+
<IconCaretdown size={iconBtnSize} />
|
|
76
|
+
</span>
|
|
77
|
+
</div>
|
|
72
78
|
</div>
|
|
73
79
|
);
|
|
74
80
|
}
|
package/table/Table.tsx
CHANGED
|
@@ -933,16 +933,22 @@ 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>;
|
|
936
937
|
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。
|
|
937
940
|
const sorter = (
|
|
938
941
|
<ColumnSorter
|
|
939
942
|
key={strings.DEFAULT_KEY_COLUMN_SORTER}
|
|
940
943
|
sortOrder={sortOrder}
|
|
941
944
|
onClick={e => this.foundation.handleSort(column, e)}
|
|
945
|
+
title={TitleNode}
|
|
942
946
|
/>
|
|
943
947
|
);
|
|
944
948
|
useFullRender && (titleMap.sorter = sorter);
|
|
945
949
|
titleArr.push(sorter);
|
|
950
|
+
} else {
|
|
951
|
+
titleArr.push(TitleNode);
|
|
946
952
|
}
|
|
947
953
|
|
|
948
954
|
const stateFilteredValue = get(curQuery, 'filteredValue');
|
|
@@ -964,10 +970,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
964
970
|
|
|
965
971
|
const newTitle =
|
|
966
972
|
typeof rawTitle === 'function' ?
|
|
967
|
-
() => rawTitle(titleMap) :
|
|
968
|
-
titleArr.unshift(
|
|
969
|
-
<React.Fragment key={strings.DEFAULT_KEY_COLUMN_TITLE}>{rawTitle}</React.Fragment>
|
|
970
|
-
) && titleArr;
|
|
973
|
+
() => rawTitle(titleMap) : titleArr;
|
|
971
974
|
|
|
972
975
|
column = { ...column, title: newTitle };
|
|
973
976
|
}
|
package/webpack.config.js
CHANGED
|
@@ -29,7 +29,9 @@ 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')
|
|
32
|
+
path.join(rootPath, 'packages/semi-foundation'),
|
|
33
|
+
path.join(rootPath, 'packages/semi-animation'),
|
|
34
|
+
path.join(rootPath, 'packages/semi-animation-react')
|
|
33
35
|
],
|
|
34
36
|
use: [
|
|
35
37
|
{
|