@douyinfe/semi-ui 2.20.2 → 2.20.4
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/README.md +4 -4
- package/dist/css/semi.css +7 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +285 -251
- 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 +2 -1
- 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/image/image.d.ts +0 -1
- package/lib/cjs/image/image.js +0 -2
- package/lib/cjs/image/index.d.ts +1 -0
- package/lib/cjs/image/index.js +2 -0
- 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 +2 -1
- 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/image/image.d.ts +0 -1
- package/lib/es/image/image.js +0 -1
- package/lib/es/image/index.d.ts +1 -0
- package/lib/es/image/index.js +1 -0
- 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
|
@@ -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
|
package/lib/es/image/image.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import React from "react";
|
|
|
2
2
|
import BaseComponent from "../_base/baseComponent";
|
|
3
3
|
import { ImageProps, ImageStates } from "./interface";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import '@douyinfe/semi-foundation/lib/es/image/image.css';
|
|
6
5
|
import { PreviewContextProps } from "./previewContext";
|
|
7
6
|
import ImageFoundation, { ImageAdapter } from '@douyinfe/semi-foundation/lib/es/image/imageFoundation';
|
|
8
7
|
export default class Image extends BaseComponent<ImageProps, ImageStates> {
|
package/lib/es/image/image.js
CHANGED
|
@@ -10,7 +10,6 @@ import { cssClasses } from '@douyinfe/semi-foundation/lib/es/image/constants';
|
|
|
10
10
|
import cls from "classnames";
|
|
11
11
|
import { IconUploadError, IconEyeOpened } from "@douyinfe/semi-icons";
|
|
12
12
|
import PreviewInner from "./previewInner";
|
|
13
|
-
import '@douyinfe/semi-foundation/lib/es/image/image.css';
|
|
14
13
|
import { PreviewContext } from "./previewContext";
|
|
15
14
|
import ImageFoundation from '@douyinfe/semi-foundation/lib/es/image/imageFoundation';
|
|
16
15
|
import LocaleConsumer from "../locale/localeConsumer";
|
package/lib/es/image/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Image from "./image";
|
|
2
2
|
import PreviewInner from "./previewInner";
|
|
3
3
|
import Preview from "./preview";
|
|
4
|
+
import '@douyinfe/semi-foundation/lib/es/image/image.css';
|
|
4
5
|
export default Image;
|
|
5
6
|
export { PreviewInner, Preview, };
|
|
6
7
|
export { ImageProps, PreviewImageProps, PreviewProps, } from "./interface";
|
package/lib/es/image/index.js
CHANGED
|
@@ -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
|
}
|
|
@@ -199,7 +199,6 @@ export default class ModalContent extends BaseComponent {
|
|
|
199
199
|
}, /*#__PURE__*/React.createElement("div", {
|
|
200
200
|
role: "dialog",
|
|
201
201
|
ref: this.modalDialogRef,
|
|
202
|
-
tabIndex: -1,
|
|
203
202
|
"aria-modal": "true",
|
|
204
203
|
"aria-labelledby": "".concat(cssClasses.DIALOG, "-title"),
|
|
205
204
|
"aria-describedby": "".concat(cssClasses.DIALOG, "-body"),
|
|
@@ -299,8 +298,16 @@ export default class ModalContent extends BaseComponent {
|
|
|
299
298
|
}
|
|
300
299
|
|
|
301
300
|
componentDidMount() {
|
|
301
|
+
var _a;
|
|
302
|
+
|
|
302
303
|
this.foundation.handleKeyDownEventListenerMount();
|
|
303
304
|
this.foundation.modalDialogFocus();
|
|
305
|
+
const nodes = FocusTrapHandle.getFocusableElements(this.modalDialogRef.current);
|
|
306
|
+
|
|
307
|
+
if (!this.modalDialogRef.current.contains(document.activeElement)) {
|
|
308
|
+
// focus on first focusable element
|
|
309
|
+
(_a = nodes[0]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
310
|
+
}
|
|
304
311
|
}
|
|
305
312
|
|
|
306
313
|
componentWillUnmount() {
|
|
@@ -329,7 +336,6 @@ export default class ModalContent extends BaseComponent {
|
|
|
329
336
|
className: classList
|
|
330
337
|
}, this.getMaskElement(), /*#__PURE__*/React.createElement("div", {
|
|
331
338
|
role: "none",
|
|
332
|
-
tabIndex: -1,
|
|
333
339
|
className: cls({
|
|
334
340
|
["".concat(cssClasses.DIALOG, "-wrap")]: true,
|
|
335
341
|
["".concat(cssClasses.DIALOG, "-wrap-center")]: this.props.centered
|
|
@@ -25,13 +25,13 @@ export default class NavFooter extends PureComponent {
|
|
|
25
25
|
locale,
|
|
26
26
|
isCollapsed
|
|
27
27
|
} = this.context;
|
|
28
|
-
return /*#__PURE__*/React.createElement(CollapseButton,
|
|
28
|
+
return /*#__PURE__*/React.createElement(CollapseButton, {
|
|
29
29
|
prefixCls: prefixCls,
|
|
30
30
|
isCollapsed: isCollapsed,
|
|
31
31
|
locale: locale,
|
|
32
32
|
onClick: onCollapseChange,
|
|
33
33
|
collapseText: collapseText
|
|
34
|
-
}
|
|
34
|
+
});
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -50,6 +50,7 @@ function OpenIconTransition() {
|
|
|
50
50
|
|
|
51
51
|
if ( /*#__PURE__*/React.isValidElement(children)) {
|
|
52
52
|
return /*#__PURE__*/React.cloneElement(children, {
|
|
53
|
+
// @ts-ignore
|
|
53
54
|
style: Object.assign(Object.assign({}, children.props && children.props.style), formatedStyle)
|
|
54
55
|
});
|
|
55
56
|
}
|
|
@@ -127,11 +127,15 @@ export default class SubNav extends BaseComponent {
|
|
|
127
127
|
["".concat(prefixCls, "-item-icon-info")]: !isToggleIcon
|
|
128
128
|
});
|
|
129
129
|
const isOpen = this.adapter.getIsOpen();
|
|
130
|
-
const iconElem = /*#__PURE__*/React.isValidElement(icon) ? withTransition ?
|
|
130
|
+
const iconElem = /*#__PURE__*/React.isValidElement(icon) ? withTransition ?
|
|
131
|
+
/*#__PURE__*/
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
React.createElement(OpenIconTransition, {
|
|
131
134
|
isOpen: isOpen
|
|
132
135
|
}, /*#__PURE__*/React.cloneElement(icon, {
|
|
133
136
|
size: iconSize
|
|
134
|
-
}))
|
|
137
|
+
})) //@ts-ignore
|
|
138
|
+
: /*#__PURE__*/React.cloneElement(icon, {
|
|
135
139
|
size: iconSize
|
|
136
140
|
}) : null;
|
|
137
141
|
return /*#__PURE__*/React.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">;
|
package/lib/es/select/index.d.ts
CHANGED
|
@@ -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>;
|
|
@@ -292,7 +292,7 @@ class Body extends BaseComponent {
|
|
|
292
292
|
overflowY: 'auto'
|
|
293
293
|
};
|
|
294
294
|
const wrapCls = classnames("".concat(prefixCls, "-body"));
|
|
295
|
-
return /*#__PURE__*/React.createElement(List, Object.assign({}, virtualized, {
|
|
295
|
+
return /*#__PURE__*/React.createElement(List, Object.assign({}, typeof virtualized === 'object' ? virtualized : {}, {
|
|
296
296
|
initialScrollOffset: this.state.cache.virtualizedScrollTop,
|
|
297
297
|
onScroll: this.handleVirtualizedScroll,
|
|
298
298
|
onItemsRendered: this.onItemsRendered,
|
package/lib/es/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
|
};
|
package/lib/es/timeline/index.js
CHANGED
|
@@ -46,6 +46,7 @@ class Timeline extends PureComponent {
|
|
|
46
46
|
this.addClassName = items => React.Children.map(items, (ele, idx) => {
|
|
47
47
|
if ( /*#__PURE__*/React.isValidElement(ele)) {
|
|
48
48
|
return /*#__PURE__*/React.cloneElement(ele, {
|
|
49
|
+
// @ts-ignore
|
|
49
50
|
className: cls(ele.props.className, this.getPosCls(ele, idx))
|
|
50
51
|
});
|
|
51
52
|
}
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@douyinfe/semi-animation": "2.12.0",
|
|
21
|
-
"@douyinfe/semi-animation-react": "2.20.
|
|
22
|
-
"@douyinfe/semi-foundation": "2.20.
|
|
23
|
-
"@douyinfe/semi-icons": "2.20.
|
|
21
|
+
"@douyinfe/semi-animation-react": "2.20.4",
|
|
22
|
+
"@douyinfe/semi-foundation": "2.20.4",
|
|
23
|
+
"@douyinfe/semi-icons": "2.20.4",
|
|
24
24
|
"@douyinfe/semi-illustrations": "2.15.0",
|
|
25
|
-
"@douyinfe/semi-theme-default": "2.20.
|
|
25
|
+
"@douyinfe/semi-theme-default": "2.20.4",
|
|
26
26
|
"async-validator": "^3.5.0",
|
|
27
27
|
"classnames": "^2.2.6",
|
|
28
28
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
],
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "40e37ceae0e1a93741bb2434448e4f7421986492",
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
75
75
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
76
76
|
"@babel/preset-env": "^7.15.8",
|
|
77
77
|
"@babel/preset-react": "^7.14.5",
|
|
78
|
-
"@douyinfe/semi-scss-compile": "2.20.
|
|
78
|
+
"@douyinfe/semi-scss-compile": "2.20.4",
|
|
79
79
|
"@storybook/addon-knobs": "^6.3.1",
|
|
80
80
|
"@types/lodash": "^4.14.176",
|
|
81
81
|
"@types/react": ">=16.0.0",
|