@douyinfe/semi-ui 2.3.0-beta.0 → 2.4.0
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/_base/_story/a11y.scss +0 -1
- package/_base/_story/index.scss +2 -5
- package/avatar/avatarGroup.tsx +1 -1
- package/avatar/index.tsx +0 -4
- package/button/__test__/button.test.js +1 -1
- package/checkbox/_story/checkbox.stories.js +2 -2
- package/collapse/index.tsx +1 -1
- package/collapse/item.tsx +1 -3
- package/datePicker/_story/RenderDate/index.js +13 -3
- package/datePicker/_story/RenderFullDate/index.js +36 -14
- package/datePicker/_story/RenderFullDate/index.scss +1 -1
- package/datePicker/_story/datePicker.stories.js +19 -11
- package/datePicker/_story/v2/PanelOpen.jsx +39 -0
- package/datePicker/_story/v2/index.js +2 -1
- package/dist/css/semi.css +33 -9
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +96 -57
- 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/dropdown/index.tsx +11 -3
- package/empty/index.tsx +1 -1
- package/input/textarea.tsx +5 -3
- package/inputNumber/__test__/inputNumber.test.js +36 -8
- package/inputNumber/index.tsx +2 -1
- package/lib/cjs/avatar/avatarGroup.js +1 -2
- package/lib/cjs/avatar/index.js +1 -6
- package/lib/cjs/collapse/index.js +1 -2
- package/lib/cjs/collapse/item.js +1 -5
- package/lib/cjs/dropdown/index.d.ts +10 -3
- package/lib/cjs/empty/index.js +1 -2
- package/lib/cjs/input/textarea.js +4 -2
- package/lib/cjs/inputNumber/index.js +3 -2
- package/lib/cjs/list/index.d.ts +4 -4
- package/lib/cjs/navigation/Item.js +1 -1
- package/lib/cjs/navigation/SubNav.js +1 -1
- package/lib/cjs/scrollList/scrollItem.d.ts +5 -1
- package/lib/cjs/scrollList/scrollItem.js +7 -0
- package/lib/cjs/select/index.js +1 -1
- package/lib/cjs/sideSheet/SideSheetContent.js +5 -9
- package/lib/cjs/spin/icon.js +2 -1
- package/lib/cjs/table/Table.js +9 -5
- package/lib/cjs/timePicker/TimePicker.d.ts +2 -0
- package/lib/cjs/timePicker/TimePicker.js +2 -3
- package/lib/cjs/timePicker/index.d.ts +1 -0
- package/lib/cjs/tooltip/index.js +1 -1
- package/lib/cjs/tree/treeNode.js +10 -1
- package/lib/cjs/treeSelect/index.js +11 -3
- package/lib/cjs/typography/util.js +0 -1
- package/lib/cjs/upload/fileCard.js +3 -3
- package/lib/es/avatar/avatarGroup.js +1 -2
- package/lib/es/avatar/index.js +1 -6
- package/lib/es/collapse/index.js +1 -2
- package/lib/es/collapse/item.js +1 -5
- package/lib/es/dropdown/index.d.ts +10 -3
- package/lib/es/empty/index.js +1 -2
- package/lib/es/input/textarea.js +4 -2
- package/lib/es/inputNumber/index.js +3 -2
- package/lib/es/list/index.d.ts +4 -4
- package/lib/es/navigation/Item.js +1 -1
- package/lib/es/navigation/SubNav.js +1 -1
- package/lib/es/scrollList/scrollItem.d.ts +5 -1
- package/lib/es/scrollList/scrollItem.js +7 -0
- package/lib/es/select/index.js +1 -1
- package/lib/es/sideSheet/SideSheetContent.js +5 -9
- package/lib/es/spin/icon.js +2 -1
- package/lib/es/table/Table.js +9 -5
- package/lib/es/timePicker/TimePicker.d.ts +2 -0
- package/lib/es/timePicker/TimePicker.js +2 -3
- package/lib/es/timePicker/index.d.ts +1 -0
- package/lib/es/tooltip/index.js +2 -2
- package/lib/es/tree/treeNode.js +9 -1
- package/lib/es/treeSelect/index.js +12 -4
- package/lib/es/typography/util.js +0 -1
- package/lib/es/upload/fileCard.js +3 -3
- package/list/index.tsx +5 -5
- package/navigation/Item.tsx +1 -1
- package/navigation/SubNav.tsx +1 -1
- package/package.json +8 -8
- package/scrollList/scrollItem.tsx +10 -3
- package/select/index.tsx +6 -1
- package/sideSheet/SideSheetContent.tsx +6 -8
- package/spin/icon.tsx +2 -1
- package/table/Table.tsx +9 -6
- package/table/_story/table.stories.js +2 -0
- package/table/_story/v2/FixedColumnsChange/index.jsx +104 -0
- package/table/_story/v2/FixedZIndex/index.jsx +87 -0
- package/timePicker/TimePicker.tsx +3 -1
- package/timePicker/__test__/timePicker.test.js +42 -3
- package/timePicker/_story/timepicker.stories.js +18 -0
- package/tooltip/index.tsx +3 -2
- package/tree/treeNode.tsx +9 -2
- package/treeSelect/__test__/treeSelect.test.js +157 -0
- package/treeSelect/index.tsx +21 -12
- package/typography/_story/typography.stories.js +8 -0
- package/typography/util.tsx +0 -1
- package/upload/fileCard.tsx +2 -2
package/lib/es/avatar/index.js
CHANGED
|
@@ -158,7 +158,6 @@ export default class Avatar extends BaseComponent {
|
|
|
158
158
|
const hoverRender = hoverContent ? /*#__PURE__*/React.createElement("div", {
|
|
159
159
|
className: "".concat(prefixCls, "-hover")
|
|
160
160
|
}, hoverContent) : null;
|
|
161
|
-
let ariaLabel;
|
|
162
161
|
|
|
163
162
|
if (isImg) {
|
|
164
163
|
content = /*#__PURE__*/React.createElement("img", _Object$assign({
|
|
@@ -167,22 +166,18 @@ export default class Avatar extends BaseComponent {
|
|
|
167
166
|
onError: this.handleError,
|
|
168
167
|
alt: alt
|
|
169
168
|
}, imgAttr));
|
|
170
|
-
ariaLabel = 'avatar';
|
|
171
169
|
} else if (typeof children === 'string') {
|
|
172
170
|
content = /*#__PURE__*/React.createElement("span", {
|
|
173
171
|
className: "".concat(prefixCls, "-content")
|
|
174
172
|
}, /*#__PURE__*/React.createElement("span", {
|
|
175
173
|
className: "".concat(prefixCls, "-label")
|
|
176
174
|
}, children));
|
|
177
|
-
ariaLabel = "avatar of ".concat(children);
|
|
178
175
|
}
|
|
179
176
|
|
|
180
177
|
return (
|
|
181
178
|
/*#__PURE__*/
|
|
182
179
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events
|
|
183
|
-
React.createElement("span", _Object$assign({
|
|
184
|
-
"aria-label": ariaLabel
|
|
185
|
-
}, others, {
|
|
180
|
+
React.createElement("span", _Object$assign({}, others, {
|
|
186
181
|
style: style,
|
|
187
182
|
className: avatarCls,
|
|
188
183
|
onClick: onClick,
|
package/lib/es/collapse/index.js
CHANGED
|
@@ -99,8 +99,7 @@ class Collapse extends BaseComponent {
|
|
|
99
99
|
} = this.state;
|
|
100
100
|
return /*#__PURE__*/React.createElement("div", {
|
|
101
101
|
className: clsPrefix,
|
|
102
|
-
style: style
|
|
103
|
-
"aria-label": "Collapse"
|
|
102
|
+
style: style
|
|
104
103
|
}, /*#__PURE__*/React.createElement(CollapseContext.Provider, {
|
|
105
104
|
value: {
|
|
106
105
|
activeSet,
|
package/lib/es/collapse/item.js
CHANGED
|
@@ -60,9 +60,7 @@ export default class CollapsePanel extends PureComponent {
|
|
|
60
60
|
if (typeof header === 'string') {
|
|
61
61
|
return /*#__PURE__*/React.createElement(React.Fragment, null, iconPosLeft ? icon : null, /*#__PURE__*/React.createElement("span", null, header), /*#__PURE__*/React.createElement("span", {
|
|
62
62
|
className: "".concat(cssClasses.PREFIX, "-header-right")
|
|
63
|
-
}, /*#__PURE__*/React.createElement("span",
|
|
64
|
-
"aria-label": 'Extra of collapse header'
|
|
65
|
-
}, extra), iconPosLeft ? null : icon));
|
|
63
|
+
}, /*#__PURE__*/React.createElement("span", null, extra), iconPosLeft ? null : icon));
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
return /*#__PURE__*/React.createElement(React.Fragment, null, iconPosLeft ? icon : null, header, iconPosLeft ? null : icon);
|
|
@@ -97,7 +95,6 @@ export default class CollapsePanel extends PureComponent {
|
|
|
97
95
|
["".concat(cssClasses.PREFIX, "-content")]: true
|
|
98
96
|
});
|
|
99
97
|
return /*#__PURE__*/React.createElement("div", _Object$assign({
|
|
100
|
-
"aria-label": 'Collapse panel',
|
|
101
98
|
className: itemCls
|
|
102
99
|
}, restProps), /*#__PURE__*/React.createElement("div", {
|
|
103
100
|
role: "button",
|
|
@@ -113,7 +110,6 @@ export default class CollapsePanel extends PureComponent {
|
|
|
113
110
|
reCalcKey: reCalcKey
|
|
114
111
|
}, /*#__PURE__*/React.createElement("div", {
|
|
115
112
|
className: contentCls,
|
|
116
|
-
"aria-label": 'Collapse content',
|
|
117
113
|
"aria-hidden": !active,
|
|
118
114
|
id: this.ariaID
|
|
119
115
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -12,11 +12,18 @@ export { DropdownDividerProps } from './dropdownDivider';
|
|
|
12
12
|
export { DropdownItemProps, Type } from './dropdownItem';
|
|
13
13
|
export { DropdownMenuProps } from './dropdownMenu';
|
|
14
14
|
export { DropdownTitleProps } from './dropdownTitle';
|
|
15
|
-
export interface
|
|
16
|
-
node: '
|
|
15
|
+
export interface DropDownMenuItemItem extends DropdownItemProps {
|
|
16
|
+
node: 'item';
|
|
17
17
|
name?: string;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
19
|
+
export interface DropDownMenuItemDivider extends DropdownDividerProps {
|
|
20
|
+
node: 'divider';
|
|
21
|
+
}
|
|
22
|
+
export interface DropDownMenuItemTitle extends DropdownTitleProps {
|
|
23
|
+
node: 'title';
|
|
24
|
+
name?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare type DropDownMenuItem = DropDownMenuItemItem | DropDownMenuItemDivider | DropDownMenuItemTitle;
|
|
20
27
|
export interface DropdownProps extends TooltipProps {
|
|
21
28
|
render?: React.ReactNode;
|
|
22
29
|
children?: React.ReactNode;
|
package/lib/es/empty/index.js
CHANGED
|
@@ -98,8 +98,7 @@ export default class Empty extends BaseComponent {
|
|
|
98
98
|
};
|
|
99
99
|
return /*#__PURE__*/React.createElement("div", {
|
|
100
100
|
className: wrapperCls,
|
|
101
|
-
style: style
|
|
102
|
-
"aria-label": "empty placeholder image"
|
|
101
|
+
style: style
|
|
103
102
|
}, /*#__PURE__*/React.createElement("div", {
|
|
104
103
|
className: "".concat(prefixCls, "-image"),
|
|
105
104
|
style: imageStyle
|
package/lib/es/input/textarea.js
CHANGED
|
@@ -241,14 +241,16 @@ class TextArea extends BaseComponent {
|
|
|
241
241
|
minLength: stateMinLength
|
|
242
242
|
} = this.state;
|
|
243
243
|
const wrapperCls = cls(className, "".concat(prefixCls, "-textarea-wrapper"), {
|
|
244
|
-
["".concat(prefixCls, "-textarea-wrapper-disabled")]: disabled
|
|
244
|
+
["".concat(prefixCls, "-textarea-wrapper-disabled")]: disabled,
|
|
245
|
+
["".concat(prefixCls, "-textarea-wrapper-readonly")]: readonly,
|
|
245
246
|
[_concatInstanceProperty(_context = "".concat(prefixCls, "-textarea-wrapper-")).call(_context, validateStatus)]: Boolean(validateStatus),
|
|
246
247
|
["".concat(prefixCls, "-textarea-wrapper-focus")]: isFocus // [`${prefixCls}-textarea-wrapper-resize`]: !autosize && resize,
|
|
247
248
|
|
|
248
249
|
}); // const ref = this.props.forwardRef || this.textAreaRef;
|
|
249
250
|
|
|
250
251
|
const itemCls = cls("".concat(prefixCls, "-textarea"), {
|
|
251
|
-
["".concat(prefixCls, "-textarea-disabled")]: disabled
|
|
252
|
+
["".concat(prefixCls, "-textarea-disabled")]: disabled,
|
|
253
|
+
["".concat(prefixCls, "-textarea-readonly")]: readonly,
|
|
252
254
|
["".concat(prefixCls, "-textarea-autosize")]: autosize,
|
|
253
255
|
["".concat(prefixCls, "-textarea-showClear")]: showClear
|
|
254
256
|
});
|
|
@@ -412,9 +412,10 @@ class InputNumber extends BaseComponent {
|
|
|
412
412
|
innerButtons,
|
|
413
413
|
style,
|
|
414
414
|
onNumberChange,
|
|
415
|
-
keepFocus
|
|
415
|
+
keepFocus,
|
|
416
|
+
defaultValue
|
|
416
417
|
} = _a,
|
|
417
|
-
rest = __rest(_a, ["disabled", "className", "prefixCls", "min", "max", "step", "shiftStep", "precision", "formatter", "parser", "forwardedRef", "onUpClick", "onDownClick", "pressInterval", "pressTimeout", "suffix", "size", "hideButtons", "innerButtons", "style", "onNumberChange", "keepFocus"]);
|
|
418
|
+
rest = __rest(_a, ["disabled", "className", "prefixCls", "min", "max", "step", "shiftStep", "precision", "formatter", "parser", "forwardedRef", "onUpClick", "onDownClick", "pressInterval", "pressTimeout", "suffix", "size", "hideButtons", "innerButtons", "style", "onNumberChange", "keepFocus", "defaultValue"]);
|
|
418
419
|
|
|
419
420
|
const {
|
|
420
421
|
value,
|
package/lib/es/list/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import ListItem from './item';
|
|
|
5
5
|
import { Grid } from './list-context';
|
|
6
6
|
import BaseComponent from '../_base/baseComponent';
|
|
7
7
|
export { ListItemProps } from './item';
|
|
8
|
-
export interface ListProps {
|
|
8
|
+
export interface ListProps<T> {
|
|
9
9
|
style?: React.CSSProperties;
|
|
10
10
|
className?: string;
|
|
11
11
|
bordered?: boolean;
|
|
@@ -15,15 +15,15 @@ export interface ListProps {
|
|
|
15
15
|
size?: 'small' | 'large' | 'default';
|
|
16
16
|
split?: boolean;
|
|
17
17
|
emptyContent?: React.ReactNode;
|
|
18
|
-
dataSource?:
|
|
19
|
-
renderItem?: (item:
|
|
18
|
+
dataSource?: T[];
|
|
19
|
+
renderItem?: (item: T, ind: number) => React.ReactNode;
|
|
20
20
|
grid?: Grid;
|
|
21
21
|
loading?: boolean;
|
|
22
22
|
loadMore?: React.ReactNode;
|
|
23
23
|
onClick?: React.MouseEventHandler<HTMLLIElement>;
|
|
24
24
|
onRightClick?: React.MouseEventHandler<HTMLLIElement>;
|
|
25
25
|
}
|
|
26
|
-
declare class List extends BaseComponent<ListProps
|
|
26
|
+
declare class List<T = any> extends BaseComponent<ListProps<T>> {
|
|
27
27
|
static Item: typeof ListItem;
|
|
28
28
|
static propTypes: {
|
|
29
29
|
style: PropTypes.Requireable<object>;
|
|
@@ -176,7 +176,7 @@ export default class NavItem extends BaseComponent {
|
|
|
176
176
|
} else {
|
|
177
177
|
let placeholderIcons = null;
|
|
178
178
|
|
|
179
|
-
if (mode === strings.MODE_VERTICAL && !limitIndent) {
|
|
179
|
+
if (mode === strings.MODE_VERTICAL && !limitIndent && !isCollapsed) {
|
|
180
180
|
const iconAmount = icon && !indent ? level : level - 1;
|
|
181
181
|
placeholderIcons = _times(iconAmount, () => this.renderIcon(null, strings.ICON_POS_RIGHT, false));
|
|
182
182
|
}
|
|
@@ -200,7 +200,7 @@ export default class SubNav extends BaseComponent {
|
|
|
200
200
|
|
|
201
201
|
let placeholderIcons = null;
|
|
202
202
|
|
|
203
|
-
if (mode === strings.MODE_VERTICAL && !limitIndent) {
|
|
203
|
+
if (mode === strings.MODE_VERTICAL && !limitIndent && !isCollapsed) {
|
|
204
204
|
/* Different icons' amount means different indents.*/
|
|
205
205
|
const iconAmount = icon && !indent ? level : level - 1;
|
|
206
206
|
placeholderIcons = _times(iconAmount, index => this.renderIcon(null, strings.ICON_POS_RIGHT, false, undefined, index));
|
|
@@ -3,7 +3,10 @@ import BaseComponent from '../_base/baseComponent';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { Item, ScrollItemAdapter } from '@douyinfe/semi-foundation/lib/es/scrollList/itemFoundation';
|
|
5
5
|
import { Motion } from '../_base/base';
|
|
6
|
-
|
|
6
|
+
interface DebounceSelectFn {
|
|
7
|
+
(e: React.UIEvent, newSelectedNode: HTMLElement): void;
|
|
8
|
+
cancel(): void;
|
|
9
|
+
}
|
|
7
10
|
export interface ScrollItemProps<T extends Item> {
|
|
8
11
|
mode?: string;
|
|
9
12
|
cycled?: boolean;
|
|
@@ -52,6 +55,7 @@ export default class ScrollItem<T extends Item> extends BaseComponent<ScrollItem
|
|
|
52
55
|
debouncedSelect: DebounceSelectFn;
|
|
53
56
|
constructor(props?: {});
|
|
54
57
|
get adapter(): ScrollItemAdapter<ScrollItemProps<T>, ScrollItemState, T>;
|
|
58
|
+
componentWillUnmount(): void;
|
|
55
59
|
componentDidMount(): void;
|
|
56
60
|
componentDidUpdate(prevProps: ScrollItemProps<T>): void;
|
|
57
61
|
_cacheNode: (name: string, node: Element) => Element;
|
|
@@ -429,6 +429,13 @@ export default class ScrollItem extends BaseComponent {
|
|
|
429
429
|
});
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
+
componentWillUnmount() {
|
|
433
|
+
if (this.props.cycled) {
|
|
434
|
+
this.throttledAdjustList.cancel();
|
|
435
|
+
this.debouncedSelect.cancel();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
432
439
|
componentDidMount() {
|
|
433
440
|
this.foundation.init();
|
|
434
441
|
const {
|
package/lib/es/select/index.js
CHANGED
|
@@ -506,7 +506,7 @@ class Select extends BaseComponent {
|
|
|
506
506
|
role: "button",
|
|
507
507
|
"aria-label": "Use the input box to create an optional item",
|
|
508
508
|
onClick: e => this.onSelect(option, optionIndex, e),
|
|
509
|
-
key:
|
|
509
|
+
key: option.key || option.label
|
|
510
510
|
}, customCreateItem)
|
|
511
511
|
);
|
|
512
512
|
}
|
|
@@ -79,8 +79,7 @@ export default class SideSheetContent extends React.PureComponent {
|
|
|
79
79
|
|
|
80
80
|
if (title) {
|
|
81
81
|
header = /*#__PURE__*/React.createElement("div", {
|
|
82
|
-
className: "".concat(prefixCls, "-title")
|
|
83
|
-
"aria-label": 'Sidesheet title'
|
|
82
|
+
className: "".concat(prefixCls, "-title")
|
|
84
83
|
}, this.props.title);
|
|
85
84
|
}
|
|
86
85
|
|
|
@@ -99,6 +98,7 @@ export default class SideSheetContent extends React.PureComponent {
|
|
|
99
98
|
return /*#__PURE__*/React.createElement("div", {
|
|
100
99
|
className: "".concat(prefixCls, "-header"),
|
|
101
100
|
role: 'heading',
|
|
101
|
+
"aria-level": 1,
|
|
102
102
|
style: _Object$assign({}, headerStyle)
|
|
103
103
|
}, header, closer);
|
|
104
104
|
}
|
|
@@ -131,15 +131,12 @@ export default class SideSheetContent extends React.PureComponent {
|
|
|
131
131
|
// onMouseDown={this.onDialogMouseDown}
|
|
132
132
|
style: _Object$assign(_Object$assign({}, props.style), style)
|
|
133
133
|
}, /*#__PURE__*/React.createElement("div", {
|
|
134
|
-
className: "".concat(prefixCls, "-content")
|
|
135
|
-
"aria-label": "Sidesheet content"
|
|
134
|
+
className: "".concat(prefixCls, "-content")
|
|
136
135
|
}, header, /*#__PURE__*/React.createElement("div", {
|
|
137
136
|
className: "".concat(prefixCls, "-body"),
|
|
138
|
-
"aria-label": "Sidesheet body",
|
|
139
137
|
style: props.bodyStyle
|
|
140
138
|
}, props.children), props.footer ? /*#__PURE__*/React.createElement("div", {
|
|
141
|
-
className: "".concat(prefixCls, "-footer")
|
|
142
|
-
"aria-label": "Sidesheet footer"
|
|
139
|
+
className: "".concat(prefixCls, "-footer")
|
|
143
140
|
}, props.footer) : null));
|
|
144
141
|
return dialogElement;
|
|
145
142
|
}
|
|
@@ -161,8 +158,7 @@ export default class SideSheetContent extends React.PureComponent {
|
|
|
161
158
|
|
|
162
159
|
return /*#__PURE__*/React.createElement("div", {
|
|
163
160
|
className: wrapperCls,
|
|
164
|
-
style: wrapperStyle
|
|
165
|
-
"aria-label": this.props['aria-label']
|
|
161
|
+
style: wrapperStyle
|
|
166
162
|
}, this.getMaskElement(), this.getDialogElement());
|
|
167
163
|
}
|
|
168
164
|
|
package/lib/es/spin/icon.js
CHANGED
|
@@ -44,7 +44,8 @@ function Icon() {
|
|
|
44
44
|
viewBox: "0 0 36 36",
|
|
45
45
|
version: "1.1",
|
|
46
46
|
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
-
"aria-
|
|
47
|
+
"aria-hidden": true,
|
|
48
|
+
"data-icon": "spin"
|
|
48
49
|
}), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
49
50
|
x1: "0%",
|
|
50
51
|
y1: "100%",
|
package/lib/es/table/Table.js
CHANGED
|
@@ -1238,15 +1238,18 @@ class Table extends BaseComponent {
|
|
|
1238
1238
|
const _dataSource = [...dataSource];
|
|
1239
1239
|
const filteredSortedDataSource = this.foundation.getFilteredSortedDataSource(_dataSource, stateQueries);
|
|
1240
1240
|
this.foundation.setCachedFilteredSortedDataSource(filteredSortedDataSource);
|
|
1241
|
-
states.dataSource = filteredSortedDataSource;
|
|
1242
|
-
|
|
1243
|
-
states.pagination = _isObject(statePagination) ? _Object$assign(_Object$assign({}, statePagination), {
|
|
1244
|
-
currentPage: _isObject(propsPagination) && propsPagination.currentPage ? propsPagination.currentPage : 1
|
|
1245
|
-
}) : statePagination;
|
|
1241
|
+
states.dataSource = filteredSortedDataSource;
|
|
1246
1242
|
|
|
1247
1243
|
if (this.props.groupBy) {
|
|
1248
1244
|
states.groups = null;
|
|
1249
1245
|
}
|
|
1246
|
+
} // when dataSource has change, should reset currentPage
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
if (dataSource !== prevProps.dataSource) {
|
|
1250
|
+
states.pagination = _isObject(statePagination) ? _Object$assign(_Object$assign({}, statePagination), {
|
|
1251
|
+
currentPage: _isObject(propsPagination) && propsPagination.currentPage ? propsPagination.currentPage : 1
|
|
1252
|
+
}) : statePagination;
|
|
1250
1253
|
}
|
|
1251
1254
|
|
|
1252
1255
|
if (_Object$keys(states).length) {
|
|
@@ -1433,6 +1436,7 @@ class Table extends BaseComponent {
|
|
|
1433
1436
|
return /*#__PURE__*/React.createElement("div", {
|
|
1434
1437
|
ref: this.rootWrapRef,
|
|
1435
1438
|
className: classnames(className, "".concat(prefixCls, "-wrapper")),
|
|
1439
|
+
"data-column-fixed": anyColumnFixed,
|
|
1436
1440
|
style: wrapStyle,
|
|
1437
1441
|
id: id
|
|
1438
1442
|
}, /*#__PURE__*/React.createElement(TableContextProvider, _Object$assign({}, tableContextValue), /*#__PURE__*/React.createElement(Spin, {
|
|
@@ -69,6 +69,7 @@ export declare type TimePickerProps = {
|
|
|
69
69
|
zIndex?: number | string;
|
|
70
70
|
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
71
71
|
onChange?: TimePickerAdapter['notifyChange'];
|
|
72
|
+
onChangeWithDateFirst?: boolean;
|
|
72
73
|
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
73
74
|
onOpenChange?: (open: boolean) => void;
|
|
74
75
|
};
|
|
@@ -169,6 +170,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
169
170
|
onFocus: (...args: any[]) => void;
|
|
170
171
|
onBlur: (...args: any[]) => void;
|
|
171
172
|
onChange: (...args: any[]) => void;
|
|
173
|
+
onChangeWithDateFirst: boolean;
|
|
172
174
|
use12Hours: boolean;
|
|
173
175
|
focusOnOpen: boolean;
|
|
174
176
|
onKeyDown: (...args: any[]) => void;
|
|
@@ -149,9 +149,7 @@ export default class TimePicker extends BaseComponent {
|
|
|
149
149
|
notifyOpenChange: function () {
|
|
150
150
|
return _this2.props.onOpenChange(...arguments);
|
|
151
151
|
},
|
|
152
|
-
notifyChange:
|
|
153
|
-
return _this2.props.onChange && _this2.props.onChange(...arguments);
|
|
154
|
-
},
|
|
152
|
+
notifyChange: (agr1, arg2) => this.props.onChange && this.props.onChange(agr1, arg2),
|
|
155
153
|
notifyFocus: function () {
|
|
156
154
|
return _this2.props.onFocus && _this2.props.onFocus(...arguments);
|
|
157
155
|
},
|
|
@@ -469,6 +467,7 @@ TimePicker.defaultProps = _Object$assign({
|
|
|
469
467
|
onFocus: _noop,
|
|
470
468
|
onBlur: _noop,
|
|
471
469
|
onChange: _noop,
|
|
470
|
+
onChangeWithDateFirst: true,
|
|
472
471
|
use12Hours: false,
|
|
473
472
|
focusOnOpen: false,
|
|
474
473
|
onKeyDown: _noop,
|
|
@@ -91,6 +91,7 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
|
|
|
91
91
|
onFocus: (...args: any[]) => void;
|
|
92
92
|
onBlur: (...args: any[]) => void;
|
|
93
93
|
onChange: (...args: any[]) => void;
|
|
94
|
+
onChangeWithDateFirst: boolean;
|
|
94
95
|
use12Hours: boolean;
|
|
95
96
|
focusOnOpen: boolean;
|
|
96
97
|
onKeyDown: (...args: any[]) => void;
|
package/lib/es/tooltip/index.js
CHANGED
|
@@ -33,7 +33,7 @@ import Event from '@douyinfe/semi-foundation/lib/es/utils/Event';
|
|
|
33
33
|
import { convertDOMRectToObject } from '@douyinfe/semi-foundation/lib/es/utils/dom';
|
|
34
34
|
import TooltipFoundation from '@douyinfe/semi-foundation/lib/es/tooltip/foundation';
|
|
35
35
|
import { strings, cssClasses, numbers } from '@douyinfe/semi-foundation/lib/es/tooltip/constants';
|
|
36
|
-
import {
|
|
36
|
+
import { getUuidShort } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
|
|
37
37
|
import '@douyinfe/semi-foundation/lib/es/tooltip/tooltip.css';
|
|
38
38
|
import BaseComponent from '../_base/baseComponent';
|
|
39
39
|
import { isHTMLElement } from '../_base/reactUtils';
|
|
@@ -268,7 +268,7 @@ export default class Tooltip extends BaseComponent {
|
|
|
268
268
|
placement: props.position || 'top',
|
|
269
269
|
transitionStyle: {},
|
|
270
270
|
isPositionUpdated: false,
|
|
271
|
-
id:
|
|
271
|
+
id: getUuidShort() // auto generate id, will be used by children.aria-describedby & content.id, improve a11y
|
|
272
272
|
|
|
273
273
|
};
|
|
274
274
|
this.foundation = new TooltipFoundation(this.adapter);
|
package/lib/es/tree/treeNode.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _isEmpty from "lodash/isEmpty";
|
|
1
2
|
import _get from "lodash/get";
|
|
2
3
|
import _isString from "lodash/isString";
|
|
3
4
|
import _isFunction from "lodash/isFunction";
|
|
@@ -470,7 +471,14 @@ export default class TreeNode extends PureComponent {
|
|
|
470
471
|
ref: this.setRef
|
|
471
472
|
}, dragProps));
|
|
472
473
|
} else {
|
|
473
|
-
|
|
474
|
+
if (_isEmpty(style)) {
|
|
475
|
+
return customLabel;
|
|
476
|
+
} else {
|
|
477
|
+
// In virtualization, props.style will contain location information
|
|
478
|
+
return /*#__PURE__*/React.cloneElement(customLabel, {
|
|
479
|
+
style: _Object$assign(_Object$assign({}, _get(customLabel, ['props', 'style'])), style)
|
|
480
|
+
});
|
|
481
|
+
}
|
|
474
482
|
}
|
|
475
483
|
}
|
|
476
484
|
|
|
@@ -17,7 +17,7 @@ import ReactDOM from 'react-dom';
|
|
|
17
17
|
import cls from 'classnames';
|
|
18
18
|
import PropTypes from 'prop-types';
|
|
19
19
|
import TreeSelectFoundation from '@douyinfe/semi-foundation/lib/es/treeSelect/foundation';
|
|
20
|
-
import { convertDataToEntities, flattenTreeData, calcExpandedKeysForValues, calcMotionKeys, findKeysForValues, calcCheckedKeys, calcExpandedKeys, getValueOrKey, normalizeKeyList, calcDisabledKeys, normalizeValue } from '@douyinfe/semi-foundation/lib/es/tree/treeUtil';
|
|
20
|
+
import { convertDataToEntities, flattenTreeData, calcExpandedKeysForValues, calcMotionKeys, findKeysForValues, calcCheckedKeys, calcExpandedKeys, getValueOrKey, normalizeKeyList, calcDisabledKeys, normalizeValue, updateKeys } from '@douyinfe/semi-foundation/lib/es/tree/treeUtil';
|
|
21
21
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/treeSelect/constants';
|
|
22
22
|
import { numbers as popoverNumbers } from '@douyinfe/semi-foundation/lib/es/popover/constants';
|
|
23
23
|
import { FixedSizeList as VirtualList } from 'react-window';
|
|
@@ -896,7 +896,7 @@ class TreeSelect extends BaseComponent {
|
|
|
896
896
|
} // if treeData keys changes, we won't show animation
|
|
897
897
|
|
|
898
898
|
|
|
899
|
-
if (treeData && props.motion && !_isEqual(
|
|
899
|
+
if (treeData && props.motion && !_isEqual(_Object$keys(newState.keyEntities), _Object$keys(prevState.keyEntities))) {
|
|
900
900
|
if (prevProps && props.motion) {
|
|
901
901
|
newState.motionKeys = new _Set([]);
|
|
902
902
|
newState.motionType = null;
|
|
@@ -942,7 +942,11 @@ class TreeSelect extends BaseComponent {
|
|
|
942
942
|
newState.selectedKeys = findKeysForValues(normalizeValue(props.defaultValue, withObject), valueEntities, isMultiple);
|
|
943
943
|
} else if (treeData) {
|
|
944
944
|
// If `treeData` changed, we also need check it
|
|
945
|
-
|
|
945
|
+
if (props.value) {
|
|
946
|
+
newState.selectedKeys = findKeysForValues(normalizeValue(props.value, withObject) || '', valueEntities, isMultiple);
|
|
947
|
+
} else {
|
|
948
|
+
newState.selectedKeys = updateKeys(prevState.selectedKeys, keyEntities);
|
|
949
|
+
}
|
|
946
950
|
}
|
|
947
951
|
} else {
|
|
948
952
|
// checkedKeys: multiple mode controlled || data changed
|
|
@@ -954,7 +958,11 @@ class TreeSelect extends BaseComponent {
|
|
|
954
958
|
checkedKeyValues = findKeysForValues(normalizeValue(props.defaultValue, withObject), valueEntities, isMultiple);
|
|
955
959
|
} else if (treeData) {
|
|
956
960
|
// If `treeData` changed, we also need check it
|
|
957
|
-
|
|
961
|
+
if (props.value) {
|
|
962
|
+
checkedKeyValues = findKeysForValues(normalizeValue(props.value, withObject) || [], valueEntities, isMultiple);
|
|
963
|
+
} else {
|
|
964
|
+
checkedKeyValues = updateKeys(prevState.checkedKeys, keyEntities);
|
|
965
|
+
}
|
|
958
966
|
}
|
|
959
967
|
|
|
960
968
|
if (checkedKeyValues) {
|
|
@@ -62,7 +62,6 @@ const getRenderText = function (originEle, rows) {
|
|
|
62
62
|
ellipsisContainer.style.zIndex = '-1000'; // clean up css overflow
|
|
63
63
|
|
|
64
64
|
ellipsisContainer.style.textOverflow = 'clip';
|
|
65
|
-
ellipsisContainer.style.whiteSpace = 'normal';
|
|
66
65
|
ellipsisContainer.style.webkitLineClamp = 'none'; // Render fake container
|
|
67
66
|
|
|
68
67
|
ReactDOM.render( /*#__PURE__*/React.createElement(React.Fragment, null), ellipsisContainer); // Check if ellipsis in measure div is height enough for content
|
|
@@ -223,12 +223,12 @@ class FileCard extends PureComponent {
|
|
|
223
223
|
orbitStroke: '#FFF',
|
|
224
224
|
"aria-label": "uploading file progress"
|
|
225
225
|
}) : null, showRetry ? retry : null, showReplace && replace, showPicInfo && picInfo, !disabled && /*#__PURE__*/React.createElement("div", {
|
|
226
|
-
className: closeCls
|
|
226
|
+
className: closeCls,
|
|
227
|
+
onClick: e => this.onRemove(e)
|
|
227
228
|
}, /*#__PURE__*/React.createElement(IconClose, {
|
|
228
229
|
tabIndex: 0,
|
|
229
230
|
role: "button",
|
|
230
|
-
size: "extra-small"
|
|
231
|
-
onClick: e => this.onRemove(e)
|
|
231
|
+
size: "extra-small"
|
|
232
232
|
})), this.renderPicValidateMsg());
|
|
233
233
|
}
|
|
234
234
|
|
package/list/index.tsx
CHANGED
|
@@ -14,7 +14,7 @@ import BaseComponent from '../_base/baseComponent';
|
|
|
14
14
|
|
|
15
15
|
export { ListItemProps } from './item';
|
|
16
16
|
|
|
17
|
-
export interface ListProps {
|
|
17
|
+
export interface ListProps<T> {
|
|
18
18
|
style?: React.CSSProperties;
|
|
19
19
|
className?: string;
|
|
20
20
|
bordered?: boolean;
|
|
@@ -24,8 +24,8 @@ export interface ListProps {
|
|
|
24
24
|
size?: 'small' | 'large' | 'default';
|
|
25
25
|
split?: boolean;
|
|
26
26
|
emptyContent?: React.ReactNode;
|
|
27
|
-
dataSource?:
|
|
28
|
-
renderItem?: (item:
|
|
27
|
+
dataSource?: T[];
|
|
28
|
+
renderItem?: (item: T, ind: number) => React.ReactNode;
|
|
29
29
|
grid?: Grid;
|
|
30
30
|
loading?: boolean;
|
|
31
31
|
loadMore?: React.ReactNode;
|
|
@@ -35,7 +35,7 @@ export interface ListProps {
|
|
|
35
35
|
|
|
36
36
|
const prefixCls = cssClasses.PREFIX;
|
|
37
37
|
|
|
38
|
-
class List extends BaseComponent<ListProps
|
|
38
|
+
class List<T = any> extends BaseComponent<ListProps<T>> {
|
|
39
39
|
static Item = ListItem;
|
|
40
40
|
|
|
41
41
|
static propTypes = {
|
|
@@ -170,4 +170,4 @@ class List extends BaseComponent<ListProps> {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
export default List;
|
|
173
|
+
export default List;
|
package/navigation/Item.tsx
CHANGED
|
@@ -195,7 +195,7 @@ export default class NavItem extends BaseComponent<NavItemProps, NavItemState> {
|
|
|
195
195
|
itemChildren = children;
|
|
196
196
|
} else {
|
|
197
197
|
let placeholderIcons = null;
|
|
198
|
-
if (mode === strings.MODE_VERTICAL && !limitIndent) {
|
|
198
|
+
if (mode === strings.MODE_VERTICAL && !limitIndent && !isCollapsed) {
|
|
199
199
|
const iconAmount = (icon && !indent) ? level : level - 1;
|
|
200
200
|
placeholderIcons = times(iconAmount, () => this.renderIcon(null, strings.ICON_POS_RIGHT, false));
|
|
201
201
|
}
|
package/navigation/SubNav.tsx
CHANGED
|
@@ -237,7 +237,7 @@ export default class SubNav extends BaseComponent<SubNavProps, SubNavState> {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
let placeholderIcons = null;
|
|
240
|
-
if (mode === strings.MODE_VERTICAL && !limitIndent) {
|
|
240
|
+
if (mode === strings.MODE_VERTICAL && !limitIndent && !isCollapsed) {
|
|
241
241
|
/* Different icons' amount means different indents.*/
|
|
242
242
|
const iconAmount = (icon && !indent) ? level : level - 1;
|
|
243
243
|
placeholderIcons = times(iconAmount, index => this.renderIcon(null, strings.ICON_POS_RIGHT, false, undefined, index));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
17
|
-
"@douyinfe/semi-animation-react": "2.
|
|
18
|
-
"@douyinfe/semi-foundation": "2.
|
|
19
|
-
"@douyinfe/semi-icons": "2.
|
|
20
|
-
"@douyinfe/semi-illustrations": "2.
|
|
21
|
-
"@douyinfe/semi-theme-default": "2.
|
|
17
|
+
"@douyinfe/semi-animation-react": "2.4.0",
|
|
18
|
+
"@douyinfe/semi-foundation": "2.4.0",
|
|
19
|
+
"@douyinfe/semi-icons": "2.4.0",
|
|
20
|
+
"@douyinfe/semi-illustrations": "2.4.0",
|
|
21
|
+
"@douyinfe/semi-theme-default": "2.4.0",
|
|
22
22
|
"@types/react-window": "^1.8.2",
|
|
23
23
|
"async-validator": "^3.5.0",
|
|
24
24
|
"classnames": "^2.2.6",
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
],
|
|
69
69
|
"author": "",
|
|
70
70
|
"license": "MIT",
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "d902a6f731475dea585d63907aee06ebe1153419",
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
74
74
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
75
75
|
"@babel/preset-env": "^7.15.8",
|
|
76
76
|
"@babel/preset-react": "^7.14.5",
|
|
77
|
-
"@douyinfe/semi-scss-compile": "2.
|
|
77
|
+
"@douyinfe/semi-scss-compile": "2.4.0",
|
|
78
78
|
"@storybook/addon-knobs": "^6.3.1",
|
|
79
79
|
"@types/lodash": "^4.14.176",
|
|
80
80
|
"babel-loader": "^8.2.2",
|
|
@@ -13,8 +13,10 @@ import { Motion } from '../_base/base';
|
|
|
13
13
|
const msPerFrame = 1000 / 60;
|
|
14
14
|
const blankReg = /^\s*$/;
|
|
15
15
|
const wheelMode = 'wheel';
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
interface DebounceSelectFn {
|
|
17
|
+
(e: React.UIEvent, newSelectedNode: HTMLElement): void;
|
|
18
|
+
cancel(): void
|
|
19
|
+
}
|
|
18
20
|
export interface ScrollItemProps<T extends Item> {
|
|
19
21
|
mode?: string;
|
|
20
22
|
cycled?: boolean;
|
|
@@ -110,7 +112,12 @@ export default class ScrollItem<T extends Item> extends BaseComponent<ScrollItem
|
|
|
110
112
|
scrollToCenter: this.scrollToCenter,
|
|
111
113
|
};
|
|
112
114
|
}
|
|
113
|
-
|
|
115
|
+
componentWillUnmount(){
|
|
116
|
+
if (this.props.cycled) {
|
|
117
|
+
this.throttledAdjustList.cancel();
|
|
118
|
+
this.debouncedSelect.cancel();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
114
121
|
componentDidMount() {
|
|
115
122
|
this.foundation.init();
|
|
116
123
|
|
package/select/index.tsx
CHANGED
|
@@ -739,7 +739,12 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
739
739
|
|
|
740
740
|
return (
|
|
741
741
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/interactive-supports-focus
|
|
742
|
-
<div
|
|
742
|
+
<div
|
|
743
|
+
role="button"
|
|
744
|
+
aria-label="Use the input box to create an optional item"
|
|
745
|
+
onClick={e => this.onSelect(option, optionIndex, e)}
|
|
746
|
+
key={option.key || option.label}
|
|
747
|
+
>
|
|
743
748
|
{customCreateItem}
|
|
744
749
|
</div>
|
|
745
750
|
);
|