@douyinfe/semi-ui 2.20.2 → 2.20.3
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/umd/semi-ui.js +255 -233
- 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/anchor/index.d.ts +1 -1
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/breadcrumb/item.js +1 -0
- package/lib/cjs/button/buttonGroup.js +14 -9
- package/lib/cjs/datePicker/datePicker.d.ts +2 -2
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/datePicker/quickControl.d.ts +1 -1
- package/lib/cjs/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/cjs/dropdown/index.d.ts +1 -1
- package/lib/cjs/dropdown/index.js +1 -0
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/form/hoc/withField.js +7 -4
- package/lib/cjs/inputNumber/index.js +1 -1
- package/lib/cjs/modal/ModalContent.js +9 -2
- package/lib/cjs/navigation/Footer.js +2 -2
- package/lib/cjs/navigation/OpenIconTransition.js +1 -0
- package/lib/cjs/navigation/SubNav.js +6 -2
- package/lib/cjs/popover/index.d.ts +1 -1
- package/lib/cjs/select/index.d.ts +1 -1
- package/lib/cjs/table/Body/index.js +1 -1
- package/lib/cjs/table/Table.d.ts +1 -1
- package/lib/cjs/timeline/index.js +1 -0
- package/lib/cjs/tooltip/index.d.ts +1 -1
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/es/anchor/index.d.ts +1 -1
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/breadcrumb/item.js +1 -0
- package/lib/es/button/buttonGroup.js +14 -9
- package/lib/es/datePicker/datePicker.d.ts +2 -2
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/datePicker/quickControl.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/es/dropdown/index.d.ts +1 -1
- package/lib/es/dropdown/index.js +1 -0
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/form/hoc/withField.js +8 -5
- package/lib/es/inputNumber/index.js +1 -1
- package/lib/es/modal/ModalContent.js +8 -2
- package/lib/es/navigation/Footer.js +2 -2
- package/lib/es/navigation/OpenIconTransition.js +1 -0
- package/lib/es/navigation/SubNav.js +6 -2
- package/lib/es/popover/index.d.ts +1 -1
- package/lib/es/select/index.d.ts +1 -1
- package/lib/es/table/Body/index.js +1 -1
- package/lib/es/table/Table.d.ts +1 -1
- package/lib/es/timeline/index.js +1 -0
- package/lib/es/tooltip/index.d.ts +1 -1
- package/lib/es/typography/title.d.ts +1 -1
- package/package.json +7 -7
|
@@ -48,7 +48,7 @@ declare class Anchor extends BaseComponent<AnchorProps, AnchorState> {
|
|
|
48
48
|
offsetTop: PropTypes.Requireable<number>;
|
|
49
49
|
targetOffset: PropTypes.Requireable<number>;
|
|
50
50
|
showTooltip: PropTypes.Requireable<boolean>;
|
|
51
|
-
position: PropTypes.Requireable<"
|
|
51
|
+
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
52
52
|
maxWidth: PropTypes.Requireable<string | number>;
|
|
53
53
|
maxHeight: PropTypes.Requireable<string | number>;
|
|
54
54
|
getContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -113,7 +113,7 @@ declare class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<Au
|
|
|
113
113
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
114
114
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
115
115
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
116
|
-
position: PropTypes.Requireable<"
|
|
116
|
+
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
117
117
|
placeholder: PropTypes.Requireable<string>;
|
|
118
118
|
prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
119
119
|
onChangeWithObject: PropTypes.Requireable<boolean>;
|
|
@@ -50,6 +50,7 @@ class BreadcrumbItem extends _baseComponent.default {
|
|
|
50
50
|
const className = "".concat(clsPrefix, "-item-icon");
|
|
51
51
|
|
|
52
52
|
if ( /*#__PURE__*/_react.default.isValidElement(iconType)) {
|
|
53
|
+
//@ts-ignore
|
|
53
54
|
return /*#__PURE__*/_react.default.cloneElement(iconType, {
|
|
54
55
|
className,
|
|
55
56
|
size: iconSize
|
|
@@ -45,7 +45,7 @@ class ButtonGroup extends _baseComponent.default {
|
|
|
45
45
|
let lineCls = "".concat(prefixCls, "-group-line");
|
|
46
46
|
|
|
47
47
|
if (inner.length > 1) {
|
|
48
|
-
inner.slice(0, -1).forEach(item => {
|
|
48
|
+
inner.slice(0, -1).forEach((item, index) => {
|
|
49
49
|
const isButtonType = (0, _get2.default)(item, 'type.elementType') === 'Button';
|
|
50
50
|
const buttonProps = (0, _get2.default)(item, 'props');
|
|
51
51
|
|
|
@@ -62,7 +62,8 @@ class ButtonGroup extends _baseComponent.default {
|
|
|
62
62
|
|
|
63
63
|
if (isButtonType) {
|
|
64
64
|
innerWithLine.push(item, /*#__PURE__*/_react.default.createElement("span", {
|
|
65
|
-
className: lineCls
|
|
65
|
+
className: lineCls,
|
|
66
|
+
key: "line-".concat(index)
|
|
66
67
|
}));
|
|
67
68
|
} else {
|
|
68
69
|
innerWithLine.push(item);
|
|
@@ -93,13 +94,17 @@ class ButtonGroup extends _baseComponent.default {
|
|
|
93
94
|
const cls = (0, _classnames.default)("".concat(prefixCls, "-group"), className);
|
|
94
95
|
|
|
95
96
|
if (children) {
|
|
96
|
-
inner = (Array.isArray(children) ? children : [children]).map((itm, index) =>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
inner = (Array.isArray(children) ? children : [children]).map((itm, index) => {
|
|
98
|
+
var _a;
|
|
99
|
+
|
|
100
|
+
return /*#__PURE__*/(0, _react.isValidElement)(itm) ? /*#__PURE__*/(0, _react.cloneElement)(itm, Object.assign(Object.assign(Object.assign({
|
|
101
|
+
disabled,
|
|
102
|
+
size,
|
|
103
|
+
type
|
|
104
|
+
}, itm.props), rest), {
|
|
105
|
+
key: (_a = itm.key) !== null && _a !== void 0 ? _a : index
|
|
106
|
+
})) : itm;
|
|
107
|
+
});
|
|
103
108
|
innerWithLine = this.getInnerWithLine(inner);
|
|
104
109
|
}
|
|
105
110
|
|
|
@@ -56,7 +56,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
56
56
|
max: PropTypes.Requireable<number>;
|
|
57
57
|
placeholder: PropTypes.Requireable<string | any[]>;
|
|
58
58
|
presets: PropTypes.Requireable<any[]>;
|
|
59
|
-
presetPosition: PropTypes.Requireable<"
|
|
59
|
+
presetPosition: PropTypes.Requireable<"left" | "top" | "right" | "bottom">;
|
|
60
60
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
61
61
|
onChangeWithDateFirst: PropTypes.Requireable<boolean>;
|
|
62
62
|
weekStartsOn: PropTypes.Requireable<number>;
|
|
@@ -73,7 +73,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
73
73
|
insetLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
74
74
|
insetLabelId: PropTypes.Requireable<string>;
|
|
75
75
|
zIndex: PropTypes.Requireable<number>;
|
|
76
|
-
position: PropTypes.Requireable<"
|
|
76
|
+
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
77
77
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
78
78
|
onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
79
79
|
onConfirm: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -50,7 +50,7 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
50
50
|
onPanelChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
51
51
|
focusRecordsRef: PropTypes.Requireable<object>;
|
|
52
52
|
triggerRender: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
|
-
presetPosition: PropTypes.Requireable<"
|
|
53
|
+
presetPosition: PropTypes.Requireable<"left" | "top" | "right" | "bottom">;
|
|
54
54
|
renderQuickControls: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
55
55
|
renderDateInput: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
56
56
|
};
|
|
@@ -13,7 +13,7 @@ export interface QuickControlProps {
|
|
|
13
13
|
declare class QuickControl extends PureComponent<QuickControlProps> {
|
|
14
14
|
static propTypes: {
|
|
15
15
|
presets: PropTypes.Requireable<any[]>;
|
|
16
|
-
presetPosition: PropTypes.Requireable<"
|
|
16
|
+
presetPosition: PropTypes.Requireable<"left" | "top" | "right" | "bottom">;
|
|
17
17
|
onPresetClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
18
|
type: PropTypes.Requireable<string>;
|
|
19
19
|
insetInput: PropTypes.Requireable<boolean>;
|
|
@@ -20,7 +20,7 @@ declare class YearAndMonth extends BaseComponent<YearAndMonthProps, YearAndMonth
|
|
|
20
20
|
noBackBtn: PropTypes.Requireable<boolean>;
|
|
21
21
|
disabledDate: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
22
|
density: PropTypes.Requireable<string>;
|
|
23
|
-
presetPosition: PropTypes.Requireable<"
|
|
23
|
+
presetPosition: PropTypes.Requireable<"left" | "top" | "right" | "bottom">;
|
|
24
24
|
renderQuickControls: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
25
25
|
renderDateInput: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
26
26
|
};
|
|
@@ -59,7 +59,7 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
|
|
|
59
59
|
render: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
60
60
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
61
61
|
visible: PropTypes.Requireable<boolean>;
|
|
62
|
-
position: PropTypes.Requireable<"
|
|
62
|
+
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
63
63
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
64
64
|
mouseEnterDelay: PropTypes.Requireable<number>;
|
|
65
65
|
mouseLeaveDelay: PropTypes.Requireable<number>;
|
|
@@ -229,6 +229,7 @@ class Dropdown extends _baseComponent.default {
|
|
|
229
229
|
showArrow: false,
|
|
230
230
|
returnFocusOnClose: true
|
|
231
231
|
}, attr), /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, {
|
|
232
|
+
//@ts-ignore
|
|
232
233
|
className: (0, _classnames.default)((0, _get2.default)(children, 'props.className'), {
|
|
233
234
|
["".concat(prefixCls, "-showing")]: popVisible
|
|
234
235
|
}),
|
|
@@ -80,7 +80,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
80
80
|
emptyContent?: React.ReactNode;
|
|
81
81
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
82
82
|
zIndex?: number;
|
|
83
|
-
position?: "
|
|
83
|
+
position?: "left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
84
84
|
onSearch?: (value: string) => void;
|
|
85
85
|
dropdownClassName?: string;
|
|
86
86
|
dropdownStyle?: React.CSSProperties;
|
package/lib/cjs/form/field.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
28
28
|
emptyContent?: import("react").ReactNode;
|
|
29
29
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
30
30
|
zIndex?: number;
|
|
31
|
-
position?: "
|
|
31
|
+
position?: "left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
32
32
|
onSearch?: (value: string) => void;
|
|
33
33
|
dropdownClassName?: string;
|
|
34
34
|
dropdownStyle?: import("react").CSSProperties;
|
|
@@ -36,7 +36,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
36
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
37
|
|
|
38
38
|
/* eslint-disable max-lines-per-function, react-hooks/rules-of-hooks, prefer-const, max-len */
|
|
39
|
-
const prefix = _constants.cssClasses.PREFIX;
|
|
39
|
+
const prefix = _constants.cssClasses.PREFIX; // To avoid useLayoutEffect warning when ssr, refer: https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
40
|
+
// Fix issue 1140
|
|
41
|
+
|
|
42
|
+
const useIsomorphicEffect = typeof window !== 'undefined' ? _react.useLayoutEffect : _react.useEffect;
|
|
40
43
|
/**
|
|
41
44
|
* withFiled is used to inject components
|
|
42
45
|
* 1. Takes over the value and onChange of the component and synchronizes them to Form Foundation
|
|
@@ -376,12 +379,12 @@ function withField(Component, opts) {
|
|
|
376
379
|
status
|
|
377
380
|
}; // avoid hooks capture value, fixed issue 346
|
|
378
381
|
|
|
379
|
-
(
|
|
382
|
+
useIsomorphicEffect(() => {
|
|
380
383
|
rulesRef.current = rules;
|
|
381
384
|
validateRef.current = validate;
|
|
382
385
|
}, [rules, validate]); // exec validate once when trigger inlcude 'mount'
|
|
383
386
|
|
|
384
|
-
(
|
|
387
|
+
useIsomorphicEffect(() => {
|
|
385
388
|
if (validateOnMount) {
|
|
386
389
|
fieldValidate(value);
|
|
387
390
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -389,7 +392,7 @@ function withField(Component, opts) {
|
|
|
389
392
|
}, []); // register when mounted,unregister when unmounted
|
|
390
393
|
// register again when field change
|
|
391
394
|
|
|
392
|
-
(
|
|
395
|
+
useIsomorphicEffect(() => {
|
|
393
396
|
// register
|
|
394
397
|
if (typeof field === 'undefined') {
|
|
395
398
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
@@ -399,7 +399,7 @@ class InputNumber extends _baseComponent.default {
|
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
if ((0, _isString2.default)(newValue) && newValue !== String(this.props.value)) {
|
|
402
|
+
if (newValue && (0, _isString2.default)(newValue) && newValue !== String(this.props.value)) {
|
|
403
403
|
this.foundation.notifyChange(newValue, null);
|
|
404
404
|
}
|
|
405
405
|
}
|
|
@@ -223,7 +223,6 @@ class ModalContent extends _baseComponent.default {
|
|
|
223
223
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
224
224
|
role: "dialog",
|
|
225
225
|
ref: this.modalDialogRef,
|
|
226
|
-
tabIndex: -1,
|
|
227
226
|
"aria-modal": "true",
|
|
228
227
|
"aria-labelledby": "".concat(_constants.cssClasses.DIALOG, "-title"),
|
|
229
228
|
"aria-describedby": "".concat(_constants.cssClasses.DIALOG, "-body"),
|
|
@@ -323,8 +322,17 @@ class ModalContent extends _baseComponent.default {
|
|
|
323
322
|
}
|
|
324
323
|
|
|
325
324
|
componentDidMount() {
|
|
325
|
+
var _a;
|
|
326
|
+
|
|
326
327
|
this.foundation.handleKeyDownEventListenerMount();
|
|
327
328
|
this.foundation.modalDialogFocus();
|
|
329
|
+
|
|
330
|
+
const nodes = _FocusHandle.default.getFocusableElements(this.modalDialogRef.current);
|
|
331
|
+
|
|
332
|
+
if (!this.modalDialogRef.current.contains(document.activeElement)) {
|
|
333
|
+
// focus on first focusable element
|
|
334
|
+
(_a = nodes[0]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
335
|
+
}
|
|
328
336
|
}
|
|
329
337
|
|
|
330
338
|
componentWillUnmount() {
|
|
@@ -354,7 +362,6 @@ class ModalContent extends _baseComponent.default {
|
|
|
354
362
|
className: classList
|
|
355
363
|
}, this.getMaskElement(), /*#__PURE__*/_react.default.createElement("div", {
|
|
356
364
|
role: "none",
|
|
357
|
-
tabIndex: -1,
|
|
358
365
|
className: (0, _classnames.default)({
|
|
359
366
|
["".concat(_constants.cssClasses.DIALOG, "-wrap")]: true,
|
|
360
367
|
["".concat(_constants.cssClasses.DIALOG, "-wrap-center")]: this.props.centered
|
|
@@ -45,13 +45,13 @@ class NavFooter extends _react.PureComponent {
|
|
|
45
45
|
locale,
|
|
46
46
|
isCollapsed
|
|
47
47
|
} = this.context;
|
|
48
|
-
return /*#__PURE__*/_react.default.createElement(_CollapseButton.default,
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_CollapseButton.default, {
|
|
49
49
|
prefixCls: prefixCls,
|
|
50
50
|
isCollapsed: isCollapsed,
|
|
51
51
|
locale: locale,
|
|
52
52
|
onClick: onCollapseChange,
|
|
53
53
|
collapseText: collapseText
|
|
54
|
-
}
|
|
54
|
+
});
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -65,6 +65,7 @@ function OpenIconTransition() {
|
|
|
65
65
|
|
|
66
66
|
if ( /*#__PURE__*/_react.default.isValidElement(children)) {
|
|
67
67
|
return /*#__PURE__*/_react.default.cloneElement(children, {
|
|
68
|
+
// @ts-ignore
|
|
68
69
|
style: Object.assign(Object.assign({}, children.props && children.props.style), formatedStyle)
|
|
69
70
|
});
|
|
70
71
|
}
|
|
@@ -151,11 +151,15 @@ class SubNav extends _baseComponent.default {
|
|
|
151
151
|
["".concat(prefixCls, "-item-icon-info")]: !isToggleIcon
|
|
152
152
|
});
|
|
153
153
|
const isOpen = this.adapter.getIsOpen();
|
|
154
|
-
const iconElem = /*#__PURE__*/_react.default.isValidElement(icon) ? withTransition ?
|
|
154
|
+
const iconElem = /*#__PURE__*/_react.default.isValidElement(icon) ? withTransition ?
|
|
155
|
+
/*#__PURE__*/
|
|
156
|
+
// @ts-ignore
|
|
157
|
+
_react.default.createElement(_OpenIconTransition.default, {
|
|
155
158
|
isOpen: isOpen
|
|
156
159
|
}, /*#__PURE__*/_react.default.cloneElement(icon, {
|
|
157
160
|
size: iconSize
|
|
158
|
-
}))
|
|
161
|
+
})) //@ts-ignore
|
|
162
|
+
: /*#__PURE__*/_react.default.cloneElement(icon, {
|
|
159
163
|
size: iconSize
|
|
160
164
|
}) : null;
|
|
161
165
|
return /*#__PURE__*/_react.default.createElement("i", {
|
|
@@ -53,7 +53,7 @@ declare class Popover extends React.PureComponent<PopoverProps, PopoverState> {
|
|
|
53
53
|
visible: PropTypes.Requireable<boolean>;
|
|
54
54
|
autoAdjustOverflow: PropTypes.Requireable<boolean>;
|
|
55
55
|
motion: PropTypes.Requireable<boolean | object>;
|
|
56
|
-
position: PropTypes.Requireable<"
|
|
56
|
+
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
57
57
|
mouseEnterDelay: PropTypes.Requireable<number>;
|
|
58
58
|
mouseLeaveDelay: PropTypes.Requireable<number>;
|
|
59
59
|
trigger: PropTypes.Validator<"hover" | "focus" | "click" | "custom">;
|
|
@@ -168,7 +168,7 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
168
168
|
emptyContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
169
169
|
onDropdownVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
170
170
|
zIndex: PropTypes.Requireable<number>;
|
|
171
|
-
position: PropTypes.Requireable<"
|
|
171
|
+
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
172
172
|
onSearch: PropTypes.Requireable<(...args: any[]) => any>;
|
|
173
173
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
174
174
|
dropdownClassName: PropTypes.Requireable<string>;
|
|
@@ -313,7 +313,7 @@ class Body extends _baseComponent.default {
|
|
|
313
313
|
overflowY: 'auto'
|
|
314
314
|
};
|
|
315
315
|
const wrapCls = (0, _classnames.default)("".concat(prefixCls, "-body"));
|
|
316
|
-
return /*#__PURE__*/_react.default.createElement(_reactWindow.VariableSizeList, Object.assign({}, virtualized, {
|
|
316
|
+
return /*#__PURE__*/_react.default.createElement(_reactWindow.VariableSizeList, Object.assign({}, typeof virtualized === 'object' ? virtualized : {}, {
|
|
317
317
|
initialScrollOffset: this.state.cache.virtualizedScrollTop,
|
|
318
318
|
onScroll: this.handleVirtualizedScroll,
|
|
319
319
|
onItemsRendered: this.onItemsRendered,
|
package/lib/cjs/table/Table.d.ts
CHANGED
|
@@ -300,7 +300,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
|
|
|
300
300
|
showSizeChanger?: boolean;
|
|
301
301
|
showQuickJumper?: boolean;
|
|
302
302
|
popoverZIndex?: number;
|
|
303
|
-
popoverPosition?: "
|
|
303
|
+
popoverPosition?: "left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
304
304
|
hideOnSinglePage?: boolean;
|
|
305
305
|
hoverShowPageSelect?: boolean;
|
|
306
306
|
};
|
|
@@ -66,6 +66,7 @@ class Timeline extends _react.PureComponent {
|
|
|
66
66
|
this.addClassName = items => _react.default.Children.map(items, (ele, idx) => {
|
|
67
67
|
if ( /*#__PURE__*/_react.default.isValidElement(ele)) {
|
|
68
68
|
return /*#__PURE__*/_react.default.cloneElement(ele, {
|
|
69
|
+
// @ts-ignore
|
|
69
70
|
className: (0, _classnames.default)(ele.props.className, this.getPosCls(ele, idx))
|
|
70
71
|
});
|
|
71
72
|
}
|
|
@@ -81,7 +81,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
81
81
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
82
82
|
motion: PropTypes.Requireable<boolean | object>;
|
|
83
83
|
autoAdjustOverflow: PropTypes.Requireable<boolean>;
|
|
84
|
-
position: PropTypes.Requireable<"
|
|
84
|
+
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
85
85
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
86
86
|
mouseEnterDelay: PropTypes.Requireable<number>;
|
|
87
87
|
mouseLeaveDelay: PropTypes.Requireable<number>;
|
|
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
|
|
|
37
37
|
underline: PropTypes.Requireable<boolean>;
|
|
38
38
|
strong: PropTypes.Requireable<boolean>;
|
|
39
39
|
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
40
|
-
heading: PropTypes.Requireable<1 | 2 | 3 | 4 |
|
|
40
|
+
heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 6 | 5>;
|
|
41
41
|
style: PropTypes.Requireable<object>;
|
|
42
42
|
className: PropTypes.Requireable<string>;
|
|
43
43
|
component: PropTypes.Requireable<string>;
|
package/lib/es/anchor/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ declare class Anchor extends BaseComponent<AnchorProps, AnchorState> {
|
|
|
48
48
|
offsetTop: PropTypes.Requireable<number>;
|
|
49
49
|
targetOffset: PropTypes.Requireable<number>;
|
|
50
50
|
showTooltip: PropTypes.Requireable<boolean>;
|
|
51
|
-
position: PropTypes.Requireable<"
|
|
51
|
+
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
52
52
|
maxWidth: PropTypes.Requireable<string | number>;
|
|
53
53
|
maxHeight: PropTypes.Requireable<string | number>;
|
|
54
54
|
getContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -113,7 +113,7 @@ declare class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<Au
|
|
|
113
113
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
114
114
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
115
115
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
116
|
-
position: PropTypes.Requireable<"
|
|
116
|
+
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
117
117
|
placeholder: PropTypes.Requireable<string>;
|
|
118
118
|
prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
119
119
|
onChangeWithObject: PropTypes.Requireable<boolean>;
|
|
@@ -24,6 +24,7 @@ export default class BreadcrumbItem extends BaseComponent {
|
|
|
24
24
|
const className = "".concat(clsPrefix, "-item-icon");
|
|
25
25
|
|
|
26
26
|
if ( /*#__PURE__*/React.isValidElement(iconType)) {
|
|
27
|
+
//@ts-ignore
|
|
27
28
|
return /*#__PURE__*/React.cloneElement(iconType, {
|
|
28
29
|
className,
|
|
29
30
|
size: iconSize
|
|
@@ -25,7 +25,7 @@ export default class ButtonGroup extends BaseComponent {
|
|
|
25
25
|
let lineCls = "".concat(prefixCls, "-group-line");
|
|
26
26
|
|
|
27
27
|
if (inner.length > 1) {
|
|
28
|
-
inner.slice(0, -1).forEach(item => {
|
|
28
|
+
inner.slice(0, -1).forEach((item, index) => {
|
|
29
29
|
const isButtonType = _get(item, 'type.elementType') === 'Button';
|
|
30
30
|
|
|
31
31
|
const buttonProps = _get(item, 'props');
|
|
@@ -43,7 +43,8 @@ export default class ButtonGroup extends BaseComponent {
|
|
|
43
43
|
|
|
44
44
|
if (isButtonType) {
|
|
45
45
|
innerWithLine.push(item, /*#__PURE__*/React.createElement("span", {
|
|
46
|
-
className: lineCls
|
|
46
|
+
className: lineCls,
|
|
47
|
+
key: "line-".concat(index)
|
|
47
48
|
}));
|
|
48
49
|
} else {
|
|
49
50
|
innerWithLine.push(item);
|
|
@@ -74,13 +75,17 @@ export default class ButtonGroup extends BaseComponent {
|
|
|
74
75
|
const cls = classNames("".concat(prefixCls, "-group"), className);
|
|
75
76
|
|
|
76
77
|
if (children) {
|
|
77
|
-
inner = (Array.isArray(children) ? children : [children]).map((itm, index) =>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
inner = (Array.isArray(children) ? children : [children]).map((itm, index) => {
|
|
79
|
+
var _a;
|
|
80
|
+
|
|
81
|
+
return /*#__PURE__*/isValidElement(itm) ? /*#__PURE__*/cloneElement(itm, Object.assign(Object.assign(Object.assign({
|
|
82
|
+
disabled,
|
|
83
|
+
size,
|
|
84
|
+
type
|
|
85
|
+
}, itm.props), rest), {
|
|
86
|
+
key: (_a = itm.key) !== null && _a !== void 0 ? _a : index
|
|
87
|
+
})) : itm;
|
|
88
|
+
});
|
|
84
89
|
innerWithLine = this.getInnerWithLine(inner);
|
|
85
90
|
}
|
|
86
91
|
|
|
@@ -56,7 +56,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
56
56
|
max: PropTypes.Requireable<number>;
|
|
57
57
|
placeholder: PropTypes.Requireable<string | any[]>;
|
|
58
58
|
presets: PropTypes.Requireable<any[]>;
|
|
59
|
-
presetPosition: PropTypes.Requireable<"
|
|
59
|
+
presetPosition: PropTypes.Requireable<"left" | "top" | "right" | "bottom">;
|
|
60
60
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
61
61
|
onChangeWithDateFirst: PropTypes.Requireable<boolean>;
|
|
62
62
|
weekStartsOn: PropTypes.Requireable<number>;
|
|
@@ -73,7 +73,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
73
73
|
insetLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
74
74
|
insetLabelId: PropTypes.Requireable<string>;
|
|
75
75
|
zIndex: PropTypes.Requireable<number>;
|
|
76
|
-
position: PropTypes.Requireable<"
|
|
76
|
+
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
77
77
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
78
78
|
onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
79
79
|
onConfirm: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -50,7 +50,7 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
50
50
|
onPanelChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
51
51
|
focusRecordsRef: PropTypes.Requireable<object>;
|
|
52
52
|
triggerRender: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
|
-
presetPosition: PropTypes.Requireable<"
|
|
53
|
+
presetPosition: PropTypes.Requireable<"left" | "top" | "right" | "bottom">;
|
|
54
54
|
renderQuickControls: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
55
55
|
renderDateInput: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
56
56
|
};
|
|
@@ -13,7 +13,7 @@ export interface QuickControlProps {
|
|
|
13
13
|
declare class QuickControl extends PureComponent<QuickControlProps> {
|
|
14
14
|
static propTypes: {
|
|
15
15
|
presets: PropTypes.Requireable<any[]>;
|
|
16
|
-
presetPosition: PropTypes.Requireable<"
|
|
16
|
+
presetPosition: PropTypes.Requireable<"left" | "top" | "right" | "bottom">;
|
|
17
17
|
onPresetClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
18
|
type: PropTypes.Requireable<string>;
|
|
19
19
|
insetInput: PropTypes.Requireable<boolean>;
|
|
@@ -20,7 +20,7 @@ declare class YearAndMonth extends BaseComponent<YearAndMonthProps, YearAndMonth
|
|
|
20
20
|
noBackBtn: PropTypes.Requireable<boolean>;
|
|
21
21
|
disabledDate: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
22
|
density: PropTypes.Requireable<string>;
|
|
23
|
-
presetPosition: PropTypes.Requireable<"
|
|
23
|
+
presetPosition: PropTypes.Requireable<"left" | "top" | "right" | "bottom">;
|
|
24
24
|
renderQuickControls: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
25
25
|
renderDateInput: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
26
26
|
};
|
|
@@ -59,7 +59,7 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
|
|
|
59
59
|
render: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
60
60
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
61
61
|
visible: PropTypes.Requireable<boolean>;
|
|
62
|
-
position: PropTypes.Requireable<"
|
|
62
|
+
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
63
63
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
64
64
|
mouseEnterDelay: PropTypes.Requireable<number>;
|
|
65
65
|
mouseLeaveDelay: PropTypes.Requireable<number>;
|
package/lib/es/dropdown/index.js
CHANGED
|
@@ -205,6 +205,7 @@ class Dropdown extends BaseComponent {
|
|
|
205
205
|
showArrow: false,
|
|
206
206
|
returnFocusOnClose: true
|
|
207
207
|
}, attr), /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, {
|
|
208
|
+
//@ts-ignore
|
|
208
209
|
className: classnames(_get(children, 'props.className'), {
|
|
209
210
|
["".concat(prefixCls, "-showing")]: popVisible
|
|
210
211
|
}),
|
|
@@ -80,7 +80,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
80
80
|
emptyContent?: React.ReactNode;
|
|
81
81
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
82
82
|
zIndex?: number;
|
|
83
|
-
position?: "
|
|
83
|
+
position?: "left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
84
84
|
onSearch?: (value: string) => void;
|
|
85
85
|
dropdownClassName?: string;
|
|
86
86
|
dropdownStyle?: React.CSSProperties;
|
package/lib/es/form/field.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
28
28
|
emptyContent?: import("react").ReactNode;
|
|
29
29
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
30
30
|
zIndex?: number;
|
|
31
|
-
position?: "
|
|
31
|
+
position?: "left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
32
32
|
onSearch?: (value: string) => void;
|
|
33
33
|
dropdownClassName?: string;
|
|
34
34
|
dropdownStyle?: import("react").CSSProperties;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable max-lines-per-function, react-hooks/rules-of-hooks, prefer-const, max-len */
|
|
2
|
-
import React, { useState, useLayoutEffect, useMemo, useRef, forwardRef } from 'react';
|
|
2
|
+
import React, { useState, useLayoutEffect, useEffect, useMemo, useRef, forwardRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/form/constants';
|
|
5
5
|
import { isValid, generateValidatesFromRules, mergeOptions, mergeProps, getDisplayName } from '@douyinfe/semi-foundation/lib/es/form/utils';
|
|
@@ -11,7 +11,10 @@ import ErrorMessage from '../errorMessage';
|
|
|
11
11
|
import { isElement } from '../../_base/reactUtils';
|
|
12
12
|
import Label from '../label';
|
|
13
13
|
import { Col } from '../../grid';
|
|
14
|
-
const prefix = cssClasses.PREFIX;
|
|
14
|
+
const prefix = cssClasses.PREFIX; // To avoid useLayoutEffect warning when ssr, refer: https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
15
|
+
// Fix issue 1140
|
|
16
|
+
|
|
17
|
+
const useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
15
18
|
/**
|
|
16
19
|
* withFiled is used to inject components
|
|
17
20
|
* 1. Takes over the value and onChange of the component and synchronizes them to Form Foundation
|
|
@@ -351,12 +354,12 @@ function withField(Component, opts) {
|
|
|
351
354
|
status
|
|
352
355
|
}; // avoid hooks capture value, fixed issue 346
|
|
353
356
|
|
|
354
|
-
|
|
357
|
+
useIsomorphicEffect(() => {
|
|
355
358
|
rulesRef.current = rules;
|
|
356
359
|
validateRef.current = validate;
|
|
357
360
|
}, [rules, validate]); // exec validate once when trigger inlcude 'mount'
|
|
358
361
|
|
|
359
|
-
|
|
362
|
+
useIsomorphicEffect(() => {
|
|
360
363
|
if (validateOnMount) {
|
|
361
364
|
fieldValidate(value);
|
|
362
365
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -364,7 +367,7 @@ function withField(Component, opts) {
|
|
|
364
367
|
}, []); // register when mounted,unregister when unmounted
|
|
365
368
|
// register again when field change
|
|
366
369
|
|
|
367
|
-
|
|
370
|
+
useIsomorphicEffect(() => {
|
|
368
371
|
// register
|
|
369
372
|
if (typeof field === 'undefined') {
|
|
370
373
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
@@ -377,7 +377,7 @@ class InputNumber extends BaseComponent {
|
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
if (_isString(newValue) && newValue !== String(this.props.value)) {
|
|
380
|
+
if (newValue && _isString(newValue) && newValue !== String(this.props.value)) {
|
|
381
381
|
this.foundation.notifyChange(newValue, null);
|
|
382
382
|
}
|
|
383
383
|
}
|