@douyinfe/semi-ui 2.23.0-beta.1 → 2.23.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/dist/css/semi.css +102 -57
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +96 -112
- 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/_base/base.css +1 -0
- package/lib/cjs/datePicker/yearAndMonth.js +0 -1
- package/lib/cjs/dropdown/dropdownMenu.d.ts +0 -2
- package/lib/cjs/dropdown/dropdownMenu.js +1 -7
- package/lib/cjs/dropdown/index.d.ts +3 -1
- package/lib/cjs/dropdown/index.js +5 -2
- package/lib/cjs/locale/source/vi_VN.js +1 -1
- package/lib/cjs/modal/Modal.js +6 -19
- package/lib/cjs/select/index.js +1 -1
- package/lib/cjs/sideSheet/index.js +6 -19
- package/lib/cjs/tagInput/index.js +2 -0
- package/lib/cjs/tooltip/index.d.ts +1 -0
- package/lib/cjs/tooltip/index.js +7 -1
- package/lib/cjs/transfer/index.js +30 -25
- package/lib/es/_base/base.css +1 -0
- package/lib/es/datePicker/yearAndMonth.js +0 -1
- package/lib/es/dropdown/dropdownMenu.d.ts +0 -2
- package/lib/es/dropdown/dropdownMenu.js +1 -7
- package/lib/es/dropdown/index.d.ts +3 -1
- package/lib/es/dropdown/index.js +5 -2
- package/lib/es/locale/source/vi_VN.js +1 -1
- package/lib/es/modal/Modal.js +6 -19
- package/lib/es/select/index.js +1 -1
- package/lib/es/sideSheet/index.js +6 -19
- package/lib/es/tagInput/index.js +2 -0
- package/lib/es/tooltip/index.d.ts +1 -0
- package/lib/es/tooltip/index.js +6 -1
- package/lib/es/transfer/index.js +30 -25
- package/package.json +7 -7
package/lib/cjs/_base/base.css
CHANGED
|
@@ -9,6 +9,7 @@ body {
|
|
|
9
9
|
--semi-transition_duration-fast:0ms;
|
|
10
10
|
--semi-transition_duration-faster:0ms;
|
|
11
11
|
--semi-transition_duration-fastest:0ms;
|
|
12
|
+
--semi-transition_duration-none:0ms;
|
|
12
13
|
--semi-transition_function-linear:linear;
|
|
13
14
|
--semi-transition_function-ease:ease;
|
|
14
15
|
--semi-transition_function-easeIn:ease-in;
|
|
@@ -9,7 +9,6 @@ declare class DropdownMenu extends BaseComponent<DropdownMenuProps> {
|
|
|
9
9
|
style: PropTypes.Requireable<object>;
|
|
10
10
|
};
|
|
11
11
|
static contextType: React.Context<import("./context").DropdownContextType>;
|
|
12
|
-
menuRef: React.RefObject<HTMLUListElement>;
|
|
13
12
|
constructor(props: DropdownMenuProps);
|
|
14
13
|
get adapter(): {
|
|
15
14
|
getContext(key: string): any;
|
|
@@ -25,7 +24,6 @@ declare class DropdownMenu extends BaseComponent<DropdownMenuProps> {
|
|
|
25
24
|
stopPropagation(e: any): void;
|
|
26
25
|
persistEvent: (event: any) => void;
|
|
27
26
|
};
|
|
28
|
-
componentDidMount(): void;
|
|
29
27
|
render(): JSX.Element;
|
|
30
28
|
}
|
|
31
29
|
export default DropdownMenu;
|
|
@@ -37,7 +37,6 @@ const prefixCls = _constants.cssClasses.PREFIX;
|
|
|
37
37
|
class DropdownMenu extends _baseComponent.default {
|
|
38
38
|
constructor(props) {
|
|
39
39
|
super(props);
|
|
40
|
-
this.menuRef = /*#__PURE__*/_react.default.createRef();
|
|
41
40
|
this.foundation = new _menuFoundation.default(this.adapter);
|
|
42
41
|
}
|
|
43
42
|
|
|
@@ -45,10 +44,6 @@ class DropdownMenu extends _baseComponent.default {
|
|
|
45
44
|
return Object.assign({}, super.adapter);
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
componentDidMount() {
|
|
49
|
-
this.foundation.autoFocus(this.menuRef.current);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
47
|
render() {
|
|
53
48
|
const _a = this.props,
|
|
54
49
|
{
|
|
@@ -60,8 +55,7 @@ class DropdownMenu extends _baseComponent.default {
|
|
|
60
55
|
|
|
61
56
|
return /*#__PURE__*/_react.default.createElement("ul", Object.assign({
|
|
62
57
|
role: "menu",
|
|
63
|
-
"aria-orientation": "vertical"
|
|
64
|
-
ref: this.menuRef
|
|
58
|
+
"aria-orientation": "vertical"
|
|
65
59
|
}, rest, {
|
|
66
60
|
className: (0, _classnames.default)("".concat(prefixCls, "-menu"), className),
|
|
67
61
|
style: style,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import BaseComponent from '../_base/baseComponent';
|
|
4
|
-
import { Position, TooltipProps, Trigger } from '../tooltip/index';
|
|
4
|
+
import Tooltip, { Position, TooltipProps, Trigger } from '../tooltip/index';
|
|
5
5
|
import DropdownMenu from './dropdownMenu';
|
|
6
6
|
import DropdownItem, { DropdownItemProps } from './dropdownItem';
|
|
7
7
|
import { DropdownDividerProps } from './dropdownDivider';
|
|
@@ -87,11 +87,13 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
|
|
|
87
87
|
closeOnEsc: boolean;
|
|
88
88
|
onEscKeyDown: (...args: any[]) => void;
|
|
89
89
|
};
|
|
90
|
+
tooltipRef: React.RefObject<Tooltip>;
|
|
90
91
|
constructor(props: DropdownProps);
|
|
91
92
|
context: DropdownContextType;
|
|
92
93
|
get adapter(): {
|
|
93
94
|
setPopVisible: (popVisible: boolean) => void;
|
|
94
95
|
notifyVisibleChange: (visible: boolean) => void;
|
|
96
|
+
getPopupId: () => string;
|
|
95
97
|
getContext(key: string): any;
|
|
96
98
|
getContexts(): any;
|
|
97
99
|
getProp(key: string): any;
|
|
@@ -63,6 +63,7 @@ class Dropdown extends _baseComponent.default {
|
|
|
63
63
|
popVisible: props.visible
|
|
64
64
|
};
|
|
65
65
|
this.foundation = new _foundation.default(this.adapter);
|
|
66
|
+
this.tooltipRef = /*#__PURE__*/_react.default.createRef();
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
get adapter() {
|
|
@@ -70,7 +71,8 @@ class Dropdown extends _baseComponent.default {
|
|
|
70
71
|
setPopVisible: popVisible => this.setState({
|
|
71
72
|
popVisible
|
|
72
73
|
}),
|
|
73
|
-
notifyVisibleChange: visible => this.props.onVisibleChange(visible)
|
|
74
|
+
notifyVisibleChange: visible => this.props.onVisibleChange(visible),
|
|
75
|
+
getPopupId: () => this.tooltipRef.current.getPopupId()
|
|
74
76
|
});
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -227,7 +229,8 @@ class Dropdown extends _baseComponent.default {
|
|
|
227
229
|
trigger: trigger,
|
|
228
230
|
onVisibleChange: this.handleVisibleChange,
|
|
229
231
|
showArrow: false,
|
|
230
|
-
returnFocusOnClose: true
|
|
232
|
+
returnFocusOnClose: true,
|
|
233
|
+
ref: this.tooltipRef
|
|
231
234
|
}, attr), /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, {
|
|
232
235
|
//@ts-ignore
|
|
233
236
|
className: (0, _classnames.default)((0, _get2.default)(children, 'props.className'), {
|
|
@@ -105,7 +105,7 @@ const local = {
|
|
|
105
105
|
},
|
|
106
106
|
Table: {
|
|
107
107
|
emptyText: 'Không kết quả',
|
|
108
|
-
pageText: 'Hiển thị $
|
|
108
|
+
pageText: 'Hiển thị ${currentStart} đến ${currentEnd} trong tổng số ${total}}'
|
|
109
109
|
},
|
|
110
110
|
Select: {
|
|
111
111
|
emptyText: 'Không kết quả',
|
package/lib/cjs/modal/Modal.js
CHANGED
|
@@ -74,8 +74,6 @@ class Modal extends _baseComponent.default {
|
|
|
74
74
|
visible
|
|
75
75
|
} = this.props;
|
|
76
76
|
this.foundation.toggleDisplayNone(!visible);
|
|
77
|
-
const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered);
|
|
78
|
-
this.foundation.setShouldRender(shouldRender);
|
|
79
77
|
};
|
|
80
78
|
|
|
81
79
|
this.renderFooter = () => {
|
|
@@ -157,8 +155,11 @@ class Modal extends _baseComponent.default {
|
|
|
157
155
|
const classList = (0, _classnames.default)(className, {
|
|
158
156
|
["".concat(_constants.cssClasses.DIALOG, "-displayNone")]: keepDOM && this.state.displayNone
|
|
159
157
|
});
|
|
158
|
+
const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered) || this.props.motion && !this.state.displayNone
|
|
159
|
+
/* When there is animation, we use displayNone to judge whether animation is ended and judge whether to unmount content */
|
|
160
|
+
;
|
|
160
161
|
|
|
161
|
-
if (
|
|
162
|
+
if (shouldRender) {
|
|
162
163
|
this._haveRendered = true;
|
|
163
164
|
}
|
|
164
165
|
|
|
@@ -189,7 +190,7 @@ class Modal extends _baseComponent.default {
|
|
|
189
190
|
animationClassName: maskAnimationClassName,
|
|
190
191
|
animationEventsNeedBind: maskAnimationEventsNeedBind
|
|
191
192
|
} = _ref2;
|
|
192
|
-
return
|
|
193
|
+
return shouldRender ? /*#__PURE__*/_react.default.createElement(_ModalContent.default, Object.assign({}, restProps, {
|
|
193
194
|
contentExtraProps: animationEventsNeedBind,
|
|
194
195
|
maskExtraProps: maskAnimationEventsNeedBind,
|
|
195
196
|
isFullScreen: this.state.isFullScreen,
|
|
@@ -209,8 +210,7 @@ class Modal extends _baseComponent.default {
|
|
|
209
210
|
|
|
210
211
|
this.state = {
|
|
211
212
|
displayNone: !props.visible,
|
|
212
|
-
isFullScreen: props.fullScreen
|
|
213
|
-
shouldRender: this.props.visible || this.props.keepDOM && !this.props.lazyRender
|
|
213
|
+
isFullScreen: props.fullScreen
|
|
214
214
|
};
|
|
215
215
|
this.foundation = new _modalFoundation.default(this.adapter);
|
|
216
216
|
this.modalRef = /*#__PURE__*/_react.default.createRef();
|
|
@@ -265,13 +265,6 @@ class Modal extends _baseComponent.default {
|
|
|
265
265
|
isFullScreen
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
|
-
},
|
|
269
|
-
setShouldRender: shouldRender => {
|
|
270
|
-
if (shouldRender !== this.state.shouldRender) {
|
|
271
|
-
this.setState({
|
|
272
|
-
shouldRender
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
268
|
}
|
|
276
269
|
});
|
|
277
270
|
}
|
|
@@ -317,12 +310,6 @@ class Modal extends _baseComponent.default {
|
|
|
317
310
|
this.foundation.beforeShow();
|
|
318
311
|
}
|
|
319
312
|
|
|
320
|
-
const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered);
|
|
321
|
-
|
|
322
|
-
if (shouldRender === true && this.state.shouldRender === false) {
|
|
323
|
-
this.foundation.setShouldRender(true);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
313
|
if (!prevState.displayNone && this.state.displayNone) {
|
|
327
314
|
this.foundation.afterHide();
|
|
328
315
|
}
|
package/lib/cjs/select/index.js
CHANGED
|
@@ -451,7 +451,7 @@ class Select extends _baseComponent.default {
|
|
|
451
451
|
} // Add isOptionChanged: There may be cases where the value is unchanged, but the optionList is updated. At this time, the label corresponding to the value may change, and the selected item needs to be updated
|
|
452
452
|
|
|
453
453
|
|
|
454
|
-
if (
|
|
454
|
+
if (!(0, _isEqual2.default)(this.props.value, prevProps.value) || isOptionsChanged) {
|
|
455
455
|
if ('value' in this.props) {
|
|
456
456
|
this.foundation.handleValueChange(this.props.value);
|
|
457
457
|
} else {
|
|
@@ -61,14 +61,11 @@ class SideSheet extends _baseComponent.default {
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
this.updateState = () => {
|
|
64
|
-
const shouldRender = this.props.visible || this.props.keepDOM;
|
|
65
|
-
this.foundation.setShouldRender(shouldRender);
|
|
66
64
|
this.foundation.toggleDisplayNone(!this.props.visible);
|
|
67
65
|
};
|
|
68
66
|
|
|
69
67
|
this.state = {
|
|
70
|
-
displayNone: !this.props.visible
|
|
71
|
-
shouldRender: this.props.visible
|
|
68
|
+
displayNone: !this.props.visible
|
|
72
69
|
};
|
|
73
70
|
this.foundation = new _sideSheetFoundation.default(this.adapter);
|
|
74
71
|
}
|
|
@@ -115,13 +112,6 @@ class SideSheet extends _baseComponent.default {
|
|
|
115
112
|
displayNone: displayNone
|
|
116
113
|
});
|
|
117
114
|
}
|
|
118
|
-
},
|
|
119
|
-
setShouldRender: shouldRender => {
|
|
120
|
-
if (shouldRender !== this.state.shouldRender) {
|
|
121
|
-
this.setState({
|
|
122
|
-
shouldRender
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
115
|
}
|
|
126
116
|
});
|
|
127
117
|
}
|
|
@@ -157,12 +147,6 @@ class SideSheet extends _baseComponent.default {
|
|
|
157
147
|
this.foundation.afterHide();
|
|
158
148
|
}
|
|
159
149
|
|
|
160
|
-
const shouldRender = this.props.visible || this.props.keepDOM;
|
|
161
|
-
|
|
162
|
-
if (shouldRender === true && this.state.shouldRender === false) {
|
|
163
|
-
this.foundation.setShouldRender(true);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
150
|
if (prevState.displayNone !== this.state.displayNone) {
|
|
167
151
|
this.foundation.onVisibleChange(!this.state.displayNone);
|
|
168
152
|
}
|
|
@@ -214,7 +198,10 @@ class SideSheet extends _baseComponent.default {
|
|
|
214
198
|
width: sheetWidth,
|
|
215
199
|
height: sheetHeight,
|
|
216
200
|
onClose: this.handleCancel
|
|
217
|
-
});
|
|
201
|
+
});
|
|
202
|
+
const shouldRender = this.props.visible || this.props.keepDOM || this.props.motion && !this.state.displayNone
|
|
203
|
+
/* When there is animation, we use displayNone to judge whether animation is ended and judge whether to unmount content */
|
|
204
|
+
; // Since user could change animate duration , we don't know which animation end first. So we call updateState func twice.
|
|
218
205
|
|
|
219
206
|
return /*#__PURE__*/_react.default.createElement(_cssAnimation.default, {
|
|
220
207
|
motion: this.props.motion,
|
|
@@ -239,7 +226,7 @@ class SideSheet extends _baseComponent.default {
|
|
|
239
226
|
animationStyle,
|
|
240
227
|
animationEventsNeedBind
|
|
241
228
|
} = _ref2;
|
|
242
|
-
return
|
|
229
|
+
return shouldRender ? /*#__PURE__*/_react.default.createElement(_SideSheetContent.default, Object.assign({}, contentProps, {
|
|
243
230
|
maskExtraProps: maskAnimationEventsNeedBind,
|
|
244
231
|
wrapperExtraProps: animationEventsNeedBind,
|
|
245
232
|
dialogClassName: animationClassName,
|
|
@@ -450,9 +450,11 @@ class TagInput extends _baseComponent.default {
|
|
|
450
450
|
}));
|
|
451
451
|
|
|
452
452
|
if (active && draggable && sortableListItems.length > 0) {
|
|
453
|
+
// helperClass:add styles to the helper(item being dragged) https://github.com/clauderic/react-sortable-hoc/issues/87
|
|
453
454
|
// @ts-ignore skip SortableItem type check
|
|
454
455
|
return /*#__PURE__*/_react.default.createElement(SortableList, {
|
|
455
456
|
useDragHandle: true,
|
|
457
|
+
helperClass: "".concat(prefixCls, "-drag-item-move"),
|
|
456
458
|
items: sortableListItems,
|
|
457
459
|
onSortEnd: this.onSortEnd,
|
|
458
460
|
axis: "xy"
|
|
@@ -185,5 +185,6 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
185
185
|
renderPortal: () => JSX.Element;
|
|
186
186
|
wrapSpan: (elem: React.ReactNode | React.ReactElement) => JSX.Element;
|
|
187
187
|
mergeEvents: (rawEvents: Record<string, any>, events: Record<string, any>) => {};
|
|
188
|
+
getPopupId: () => string;
|
|
188
189
|
render(): JSX.Element;
|
|
189
190
|
}
|
package/lib/cjs/tooltip/index.js
CHANGED
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
9
|
+
|
|
8
10
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
9
11
|
|
|
10
12
|
var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
|
|
@@ -304,6 +306,10 @@ class Tooltip extends _baseComponent.default {
|
|
|
304
306
|
return mergedEvents;
|
|
305
307
|
};
|
|
306
308
|
|
|
309
|
+
this.getPopupId = () => {
|
|
310
|
+
return this.state.id;
|
|
311
|
+
};
|
|
312
|
+
|
|
307
313
|
this.state = {
|
|
308
314
|
visible: false,
|
|
309
315
|
|
|
@@ -615,7 +621,7 @@ class Tooltip extends _baseComponent.default {
|
|
|
615
621
|
this.props.visible ? this.foundation.delayShow() : this.foundation.delayHide();
|
|
616
622
|
}
|
|
617
623
|
|
|
618
|
-
if (prevProps.rePosKey
|
|
624
|
+
if (!(0, _isEqual2.default)(prevProps.rePosKey, this.props.rePosKey)) {
|
|
619
625
|
this.rePosition();
|
|
620
626
|
}
|
|
621
627
|
}
|
|
@@ -49,7 +49,30 @@ var _semiIcons = require("@douyinfe/semi-icons");
|
|
|
49
49
|
|
|
50
50
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
51
51
|
|
|
52
|
-
const prefixcls = _constants.cssClasses.PREFIX;
|
|
52
|
+
const prefixcls = _constants.cssClasses.PREFIX; // SortableItem & SortableList should not be assigned inside of the render function
|
|
53
|
+
|
|
54
|
+
const SortableItem = (0, _reactSortableHoc.SortableElement)(props => props.item.node);
|
|
55
|
+
const SortableList = (0, _reactSortableHoc.SortableContainer)(_ref => {
|
|
56
|
+
let {
|
|
57
|
+
items
|
|
58
|
+
} = _ref;
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
60
|
+
className: "".concat(prefixcls, "-right-list"),
|
|
61
|
+
role: "list",
|
|
62
|
+
"aria-label": "Selected list"
|
|
63
|
+
}, items.map((item, index) =>
|
|
64
|
+
/*#__PURE__*/
|
|
65
|
+
// @ts-ignore skip SortableItem type check
|
|
66
|
+
_react.default.createElement(SortableItem, {
|
|
67
|
+
key: item.label,
|
|
68
|
+
index: index,
|
|
69
|
+
item: item
|
|
70
|
+
}))) // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
71
|
+
// @ts-ignore see reasons: https://github.com/clauderic/react-sortable-hoc/issues/206
|
|
72
|
+
;
|
|
73
|
+
}, {
|
|
74
|
+
distance: 10
|
|
75
|
+
});
|
|
53
76
|
|
|
54
77
|
class Transfer extends _baseComponent.default {
|
|
55
78
|
constructor(props) {
|
|
@@ -493,34 +516,16 @@ class Transfer extends _baseComponent.default {
|
|
|
493
516
|
}
|
|
494
517
|
|
|
495
518
|
renderRightSortableList(selectedData) {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
items
|
|
501
|
-
} = _ref;
|
|
502
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
503
|
-
className: "".concat(prefixcls, "-right-list"),
|
|
504
|
-
role: "list",
|
|
505
|
-
"aria-label": "Selected list"
|
|
506
|
-
}, items.map((item, index) =>
|
|
507
|
-
/*#__PURE__*/
|
|
508
|
-
// @ts-ignore skip SortableItem type check
|
|
509
|
-
_react.default.createElement(SortableItem, {
|
|
510
|
-
key: item.label,
|
|
511
|
-
index: index,
|
|
512
|
-
item: item
|
|
513
|
-
}))) // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
514
|
-
// @ts-ignore see reasons: https://github.com/clauderic/react-sortable-hoc/issues/206
|
|
515
|
-
;
|
|
516
|
-
}, {
|
|
517
|
-
distance: 10
|
|
518
|
-
}); // @ts-ignore skip SortableItem type check
|
|
519
|
+
const sortableListItems = selectedData.map(item => Object.assign(Object.assign({}, item), {
|
|
520
|
+
node: this.renderRightItem(item)
|
|
521
|
+
})); // helperClass:add styles to the helper(item being dragged) https://github.com/clauderic/react-sortable-hoc/issues/87
|
|
522
|
+
// @ts-ignore skip SortableItem type check
|
|
519
523
|
|
|
520
524
|
const sortList = /*#__PURE__*/_react.default.createElement(SortableList, {
|
|
521
525
|
useDragHandle: true,
|
|
526
|
+
helperClass: "".concat(prefixcls, "-right-item-drag-item-move"),
|
|
522
527
|
onSortEnd: this.onSortEnd,
|
|
523
|
-
items:
|
|
528
|
+
items: sortableListItems
|
|
524
529
|
});
|
|
525
530
|
|
|
526
531
|
return sortList;
|
package/lib/es/_base/base.css
CHANGED
|
@@ -9,6 +9,7 @@ body {
|
|
|
9
9
|
--semi-transition_duration-fast:0ms;
|
|
10
10
|
--semi-transition_duration-faster:0ms;
|
|
11
11
|
--semi-transition_duration-fastest:0ms;
|
|
12
|
+
--semi-transition_duration-none:0ms;
|
|
12
13
|
--semi-transition_function-linear:linear;
|
|
13
14
|
--semi-transition_function-ease:ease;
|
|
14
15
|
--semi-transition_function-easeIn:ease-in;
|
|
@@ -9,7 +9,6 @@ declare class DropdownMenu extends BaseComponent<DropdownMenuProps> {
|
|
|
9
9
|
style: PropTypes.Requireable<object>;
|
|
10
10
|
};
|
|
11
11
|
static contextType: React.Context<import("./context").DropdownContextType>;
|
|
12
|
-
menuRef: React.RefObject<HTMLUListElement>;
|
|
13
12
|
constructor(props: DropdownMenuProps);
|
|
14
13
|
get adapter(): {
|
|
15
14
|
getContext(key: string): any;
|
|
@@ -25,7 +24,6 @@ declare class DropdownMenu extends BaseComponent<DropdownMenuProps> {
|
|
|
25
24
|
stopPropagation(e: any): void;
|
|
26
25
|
persistEvent: (event: any) => void;
|
|
27
26
|
};
|
|
28
|
-
componentDidMount(): void;
|
|
29
27
|
render(): JSX.Element;
|
|
30
28
|
}
|
|
31
29
|
export default DropdownMenu;
|
|
@@ -21,7 +21,6 @@ const prefixCls = cssClasses.PREFIX;
|
|
|
21
21
|
class DropdownMenu extends BaseComponent {
|
|
22
22
|
constructor(props) {
|
|
23
23
|
super(props);
|
|
24
|
-
this.menuRef = /*#__PURE__*/React.createRef();
|
|
25
24
|
this.foundation = new Foundation(this.adapter);
|
|
26
25
|
}
|
|
27
26
|
|
|
@@ -29,10 +28,6 @@ class DropdownMenu extends BaseComponent {
|
|
|
29
28
|
return Object.assign({}, super.adapter);
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
componentDidMount() {
|
|
33
|
-
this.foundation.autoFocus(this.menuRef.current);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
31
|
render() {
|
|
37
32
|
const _a = this.props,
|
|
38
33
|
{
|
|
@@ -44,8 +39,7 @@ class DropdownMenu extends BaseComponent {
|
|
|
44
39
|
|
|
45
40
|
return /*#__PURE__*/React.createElement("ul", Object.assign({
|
|
46
41
|
role: "menu",
|
|
47
|
-
"aria-orientation": "vertical"
|
|
48
|
-
ref: this.menuRef
|
|
42
|
+
"aria-orientation": "vertical"
|
|
49
43
|
}, rest, {
|
|
50
44
|
className: classnames("".concat(prefixCls, "-menu"), className),
|
|
51
45
|
style: style,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import BaseComponent from '../_base/baseComponent';
|
|
4
|
-
import { Position, TooltipProps, Trigger } from '../tooltip/index';
|
|
4
|
+
import Tooltip, { Position, TooltipProps, Trigger } from '../tooltip/index';
|
|
5
5
|
import DropdownMenu from './dropdownMenu';
|
|
6
6
|
import DropdownItem, { DropdownItemProps } from './dropdownItem';
|
|
7
7
|
import { DropdownDividerProps } from './dropdownDivider';
|
|
@@ -87,11 +87,13 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
|
|
|
87
87
|
closeOnEsc: boolean;
|
|
88
88
|
onEscKeyDown: (...args: any[]) => void;
|
|
89
89
|
};
|
|
90
|
+
tooltipRef: React.RefObject<Tooltip>;
|
|
90
91
|
constructor(props: DropdownProps);
|
|
91
92
|
context: DropdownContextType;
|
|
92
93
|
get adapter(): {
|
|
93
94
|
setPopVisible: (popVisible: boolean) => void;
|
|
94
95
|
notifyVisibleChange: (visible: boolean) => void;
|
|
96
|
+
getPopupId: () => string;
|
|
95
97
|
getContext(key: string): any;
|
|
96
98
|
getContexts(): any;
|
|
97
99
|
getProp(key: string): any;
|
package/lib/es/dropdown/index.js
CHANGED
|
@@ -39,6 +39,7 @@ class Dropdown extends BaseComponent {
|
|
|
39
39
|
popVisible: props.visible
|
|
40
40
|
};
|
|
41
41
|
this.foundation = new Foundation(this.adapter);
|
|
42
|
+
this.tooltipRef = /*#__PURE__*/React.createRef();
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
get adapter() {
|
|
@@ -46,7 +47,8 @@ class Dropdown extends BaseComponent {
|
|
|
46
47
|
setPopVisible: popVisible => this.setState({
|
|
47
48
|
popVisible
|
|
48
49
|
}),
|
|
49
|
-
notifyVisibleChange: visible => this.props.onVisibleChange(visible)
|
|
50
|
+
notifyVisibleChange: visible => this.props.onVisibleChange(visible),
|
|
51
|
+
getPopupId: () => this.tooltipRef.current.getPopupId()
|
|
50
52
|
});
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -203,7 +205,8 @@ class Dropdown extends BaseComponent {
|
|
|
203
205
|
trigger: trigger,
|
|
204
206
|
onVisibleChange: this.handleVisibleChange,
|
|
205
207
|
showArrow: false,
|
|
206
|
-
returnFocusOnClose: true
|
|
208
|
+
returnFocusOnClose: true,
|
|
209
|
+
ref: this.tooltipRef
|
|
207
210
|
}, attr), /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, {
|
|
208
211
|
//@ts-ignore
|
|
209
212
|
className: classnames(_get(children, 'props.className'), {
|
|
@@ -97,7 +97,7 @@ const local = {
|
|
|
97
97
|
},
|
|
98
98
|
Table: {
|
|
99
99
|
emptyText: 'Không kết quả',
|
|
100
|
-
pageText: 'Hiển thị $
|
|
100
|
+
pageText: 'Hiển thị ${currentStart} đến ${currentEnd} trong tổng số ${total}}'
|
|
101
101
|
},
|
|
102
102
|
Select: {
|
|
103
103
|
emptyText: 'Không kết quả',
|
package/lib/es/modal/Modal.js
CHANGED
|
@@ -46,8 +46,6 @@ class Modal extends BaseComponent {
|
|
|
46
46
|
visible
|
|
47
47
|
} = this.props;
|
|
48
48
|
this.foundation.toggleDisplayNone(!visible);
|
|
49
|
-
const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered);
|
|
50
|
-
this.foundation.setShouldRender(shouldRender);
|
|
51
49
|
};
|
|
52
50
|
|
|
53
51
|
this.renderFooter = () => {
|
|
@@ -129,8 +127,11 @@ class Modal extends BaseComponent {
|
|
|
129
127
|
const classList = cls(className, {
|
|
130
128
|
["".concat(cssClasses.DIALOG, "-displayNone")]: keepDOM && this.state.displayNone
|
|
131
129
|
});
|
|
130
|
+
const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered) || this.props.motion && !this.state.displayNone
|
|
131
|
+
/* When there is animation, we use displayNone to judge whether animation is ended and judge whether to unmount content */
|
|
132
|
+
;
|
|
132
133
|
|
|
133
|
-
if (
|
|
134
|
+
if (shouldRender) {
|
|
134
135
|
this._haveRendered = true;
|
|
135
136
|
}
|
|
136
137
|
|
|
@@ -161,7 +162,7 @@ class Modal extends BaseComponent {
|
|
|
161
162
|
animationClassName: maskAnimationClassName,
|
|
162
163
|
animationEventsNeedBind: maskAnimationEventsNeedBind
|
|
163
164
|
} = _ref2;
|
|
164
|
-
return
|
|
165
|
+
return shouldRender ? /*#__PURE__*/React.createElement(ModalContent, Object.assign({}, restProps, {
|
|
165
166
|
contentExtraProps: animationEventsNeedBind,
|
|
166
167
|
maskExtraProps: maskAnimationEventsNeedBind,
|
|
167
168
|
isFullScreen: this.state.isFullScreen,
|
|
@@ -181,8 +182,7 @@ class Modal extends BaseComponent {
|
|
|
181
182
|
|
|
182
183
|
this.state = {
|
|
183
184
|
displayNone: !props.visible,
|
|
184
|
-
isFullScreen: props.fullScreen
|
|
185
|
-
shouldRender: this.props.visible || this.props.keepDOM && !this.props.lazyRender
|
|
185
|
+
isFullScreen: props.fullScreen
|
|
186
186
|
};
|
|
187
187
|
this.foundation = new ModalFoundation(this.adapter);
|
|
188
188
|
this.modalRef = /*#__PURE__*/React.createRef();
|
|
@@ -237,13 +237,6 @@ class Modal extends BaseComponent {
|
|
|
237
237
|
isFullScreen
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
|
-
},
|
|
241
|
-
setShouldRender: shouldRender => {
|
|
242
|
-
if (shouldRender !== this.state.shouldRender) {
|
|
243
|
-
this.setState({
|
|
244
|
-
shouldRender
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
240
|
}
|
|
248
241
|
});
|
|
249
242
|
}
|
|
@@ -289,12 +282,6 @@ class Modal extends BaseComponent {
|
|
|
289
282
|
this.foundation.beforeShow();
|
|
290
283
|
}
|
|
291
284
|
|
|
292
|
-
const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered);
|
|
293
|
-
|
|
294
|
-
if (shouldRender === true && this.state.shouldRender === false) {
|
|
295
|
-
this.foundation.setShouldRender(true);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
285
|
if (!prevState.displayNone && this.state.displayNone) {
|
|
299
286
|
this.foundation.afterHide();
|
|
300
287
|
}
|
package/lib/es/select/index.js
CHANGED
|
@@ -405,7 +405,7 @@ class Select extends BaseComponent {
|
|
|
405
405
|
} // Add isOptionChanged: There may be cases where the value is unchanged, but the optionList is updated. At this time, the label corresponding to the value may change, and the selected item needs to be updated
|
|
406
406
|
|
|
407
407
|
|
|
408
|
-
if (
|
|
408
|
+
if (!_isEqual(this.props.value, prevProps.value) || isOptionsChanged) {
|
|
409
409
|
if ('value' in this.props) {
|
|
410
410
|
this.foundation.handleValueChange(this.props.value);
|
|
411
411
|
} else {
|
|
@@ -40,14 +40,11 @@ export default class SideSheet extends BaseComponent {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
this.updateState = () => {
|
|
43
|
-
const shouldRender = this.props.visible || this.props.keepDOM;
|
|
44
|
-
this.foundation.setShouldRender(shouldRender);
|
|
45
43
|
this.foundation.toggleDisplayNone(!this.props.visible);
|
|
46
44
|
};
|
|
47
45
|
|
|
48
46
|
this.state = {
|
|
49
|
-
displayNone: !this.props.visible
|
|
50
|
-
shouldRender: this.props.visible
|
|
47
|
+
displayNone: !this.props.visible
|
|
51
48
|
};
|
|
52
49
|
this.foundation = new SideSheetFoundation(this.adapter);
|
|
53
50
|
}
|
|
@@ -94,13 +91,6 @@ export default class SideSheet extends BaseComponent {
|
|
|
94
91
|
displayNone: displayNone
|
|
95
92
|
});
|
|
96
93
|
}
|
|
97
|
-
},
|
|
98
|
-
setShouldRender: shouldRender => {
|
|
99
|
-
if (shouldRender !== this.state.shouldRender) {
|
|
100
|
-
this.setState({
|
|
101
|
-
shouldRender
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
94
|
}
|
|
105
95
|
});
|
|
106
96
|
}
|
|
@@ -136,12 +126,6 @@ export default class SideSheet extends BaseComponent {
|
|
|
136
126
|
this.foundation.afterHide();
|
|
137
127
|
}
|
|
138
128
|
|
|
139
|
-
const shouldRender = this.props.visible || this.props.keepDOM;
|
|
140
|
-
|
|
141
|
-
if (shouldRender === true && this.state.shouldRender === false) {
|
|
142
|
-
this.foundation.setShouldRender(true);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
129
|
if (prevState.displayNone !== this.state.displayNone) {
|
|
146
130
|
this.foundation.onVisibleChange(!this.state.displayNone);
|
|
147
131
|
}
|
|
@@ -193,7 +177,10 @@ export default class SideSheet extends BaseComponent {
|
|
|
193
177
|
width: sheetWidth,
|
|
194
178
|
height: sheetHeight,
|
|
195
179
|
onClose: this.handleCancel
|
|
196
|
-
});
|
|
180
|
+
});
|
|
181
|
+
const shouldRender = this.props.visible || this.props.keepDOM || this.props.motion && !this.state.displayNone
|
|
182
|
+
/* When there is animation, we use displayNone to judge whether animation is ended and judge whether to unmount content */
|
|
183
|
+
; // Since user could change animate duration , we don't know which animation end first. So we call updateState func twice.
|
|
197
184
|
|
|
198
185
|
return /*#__PURE__*/React.createElement(CSSAnimation, {
|
|
199
186
|
motion: this.props.motion,
|
|
@@ -218,7 +205,7 @@ export default class SideSheet extends BaseComponent {
|
|
|
218
205
|
animationStyle,
|
|
219
206
|
animationEventsNeedBind
|
|
220
207
|
} = _ref2;
|
|
221
|
-
return
|
|
208
|
+
return shouldRender ? /*#__PURE__*/React.createElement(SideSheetContent, Object.assign({}, contentProps, {
|
|
222
209
|
maskExtraProps: maskAnimationEventsNeedBind,
|
|
223
210
|
wrapperExtraProps: animationEventsNeedBind,
|
|
224
211
|
dialogClassName: animationClassName,
|