@douyinfe/semi-ui 2.52.0-beta.1 → 2.53.0-beta.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/dist/css/semi.css +1 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +930 -1249
- 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/_utils/index.d.ts +2 -0
- package/lib/cjs/_utils/index.js +77 -0
- package/lib/cjs/_utils/semi-global.d.ts +46 -0
- package/lib/cjs/_utils/semi-global.js +13 -0
- package/lib/cjs/autoComplete/index.d.ts +2 -25
- package/lib/cjs/autoComplete/index.js +4 -2
- package/lib/cjs/avatar/index.d.ts +2 -10
- package/lib/cjs/avatar/index.js +4 -2
- package/lib/cjs/backtop/index.d.ts +2 -5
- package/lib/cjs/backtop/index.js +4 -2
- package/lib/cjs/button/Button.d.ts +1 -1
- package/lib/cjs/button/index.d.ts +3 -1
- package/lib/cjs/button/index.js +3 -0
- package/lib/cjs/carousel/index.d.ts +2 -2
- package/lib/cjs/cascader/index.d.ts +5 -33
- package/lib/cjs/cascader/index.js +34 -23
- package/lib/cjs/collapse/index.d.ts +2 -7
- package/lib/cjs/collapse/index.js +4 -2
- package/lib/cjs/collapsible/index.d.ts +3 -9
- package/lib/cjs/collapsible/index.js +4 -2
- package/lib/cjs/configProvider/index.d.ts +2 -1
- package/lib/cjs/configProvider/index.js +5 -2
- package/lib/cjs/datePicker/datePicker.d.ts +2 -44
- package/lib/cjs/datePicker/datePicker.js +5 -3
- package/lib/cjs/datePicker/yearAndMonth.js +20 -16
- package/lib/cjs/dropdown/index.d.ts +2 -12
- package/lib/cjs/dropdown/index.js +4 -2
- package/lib/cjs/form/arrayField.js +3 -3
- package/lib/cjs/form/hoc/withField.d.ts +3 -3
- package/lib/cjs/modal/Modal.d.ts +2 -20
- package/lib/cjs/modal/Modal.js +5 -4
- package/lib/cjs/modal/confirm.d.ts +14 -14
- package/lib/cjs/navigation/index.d.ts +2 -15
- package/lib/cjs/navigation/index.js +4 -2
- package/lib/cjs/notification/notice.d.ts +2 -12
- package/lib/cjs/notification/notice.js +3 -2
- package/lib/cjs/overflowList/index.d.ts +2 -9
- package/lib/cjs/overflowList/index.js +3 -2
- package/lib/cjs/popconfirm/index.d.ts +2 -15
- package/lib/cjs/popconfirm/index.js +4 -2
- package/lib/cjs/popover/index.d.ts +2 -23
- package/lib/cjs/popover/index.js +4 -2
- package/lib/cjs/resizeObserver/index.d.ts +14 -2
- package/lib/cjs/resizeObserver/index.js +66 -32
- package/lib/cjs/select/index.d.ts +1 -0
- package/lib/cjs/select/index.js +3 -2
- package/lib/cjs/select/option.js +2 -1
- package/lib/cjs/sideSheet/index.d.ts +1 -0
- package/lib/cjs/sideSheet/index.js +3 -2
- package/lib/cjs/table/ResizableTable.js +1 -1
- package/lib/cjs/tabs/index.d.ts +1 -0
- package/lib/cjs/tabs/index.js +4 -2
- package/lib/cjs/timePicker/TimePicker.d.ts +1 -1
- package/lib/cjs/timePicker/index.d.ts +2 -34
- package/lib/cjs/timePicker/index.js +3 -1
- package/lib/cjs/toast/toast.d.ts +2 -11
- package/lib/cjs/toast/toast.js +3 -2
- package/lib/cjs/tooltip/index.d.ts +2 -32
- package/lib/cjs/tooltip/index.js +3 -2
- package/lib/cjs/typography/base.d.ts +7 -4
- package/lib/cjs/typography/base.js +127 -64
- package/lib/cjs/typography/numeral.d.ts +1 -1
- package/lib/cjs/typography/paragraph.d.ts +1 -1
- package/lib/cjs/typography/text.d.ts +1 -1
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/es/_utils/index.d.ts +2 -0
- package/lib/es/_utils/index.js +75 -0
- package/lib/es/_utils/semi-global.d.ts +46 -0
- package/lib/es/_utils/semi-global.js +6 -0
- package/lib/es/autoComplete/index.d.ts +2 -25
- package/lib/es/autoComplete/index.js +4 -2
- package/lib/es/avatar/index.d.ts +2 -10
- package/lib/es/avatar/index.js +4 -2
- package/lib/es/backtop/index.d.ts +2 -5
- package/lib/es/backtop/index.js +4 -2
- package/lib/es/button/Button.d.ts +1 -1
- package/lib/es/button/index.d.ts +3 -1
- package/lib/es/button/index.js +3 -0
- package/lib/es/carousel/index.d.ts +2 -2
- package/lib/es/cascader/index.d.ts +5 -33
- package/lib/es/cascader/index.js +35 -24
- package/lib/es/collapse/index.d.ts +2 -7
- package/lib/es/collapse/index.js +4 -2
- package/lib/es/collapsible/index.d.ts +3 -9
- package/lib/es/collapsible/index.js +4 -2
- package/lib/es/configProvider/index.d.ts +2 -1
- package/lib/es/configProvider/index.js +5 -2
- package/lib/es/datePicker/datePicker.d.ts +2 -44
- package/lib/es/datePicker/datePicker.js +5 -3
- package/lib/es/datePicker/yearAndMonth.js +20 -16
- package/lib/es/dropdown/index.d.ts +2 -12
- package/lib/es/dropdown/index.js +4 -2
- package/lib/es/form/arrayField.js +3 -3
- package/lib/es/form/hoc/withField.d.ts +3 -3
- package/lib/es/modal/Modal.d.ts +2 -20
- package/lib/es/modal/Modal.js +6 -5
- package/lib/es/modal/confirm.d.ts +14 -14
- package/lib/es/navigation/index.d.ts +2 -15
- package/lib/es/navigation/index.js +4 -2
- package/lib/es/notification/notice.d.ts +2 -12
- package/lib/es/notification/notice.js +4 -3
- package/lib/es/overflowList/index.d.ts +2 -9
- package/lib/es/overflowList/index.js +4 -3
- package/lib/es/popconfirm/index.d.ts +2 -15
- package/lib/es/popconfirm/index.js +4 -2
- package/lib/es/popover/index.d.ts +2 -23
- package/lib/es/popover/index.js +4 -2
- package/lib/es/resizeObserver/index.d.ts +14 -2
- package/lib/es/resizeObserver/index.js +64 -31
- package/lib/es/select/index.d.ts +1 -0
- package/lib/es/select/index.js +4 -3
- package/lib/es/select/option.js +2 -1
- package/lib/es/sideSheet/index.d.ts +1 -0
- package/lib/es/sideSheet/index.js +4 -3
- package/lib/es/table/ResizableTable.js +1 -1
- package/lib/es/tabs/index.d.ts +1 -0
- package/lib/es/tabs/index.js +4 -2
- package/lib/es/timePicker/TimePicker.d.ts +1 -1
- package/lib/es/timePicker/index.d.ts +2 -34
- package/lib/es/timePicker/index.js +3 -1
- package/lib/es/toast/toast.d.ts +2 -11
- package/lib/es/toast/toast.js +4 -3
- package/lib/es/tooltip/index.d.ts +2 -32
- package/lib/es/tooltip/index.js +4 -3
- package/lib/es/typography/base.d.ts +7 -4
- package/lib/es/typography/base.js +128 -65
- package/lib/es/typography/numeral.d.ts +1 -1
- package/lib/es/typography/paragraph.d.ts +1 -1
- package/lib/es/typography/text.d.ts +1 -1
- package/lib/es/typography/title.d.ts +1 -1
- package/package.json +9 -9
- package/dist/umd/semi-ui.min.js.LICENSE.txt +0 -5
package/lib/es/modal/Modal.js
CHANGED
|
@@ -21,11 +21,12 @@ import BaseComponent from '../_base/baseComponent';
|
|
|
21
21
|
import confirm, { withConfirm, withError, withInfo, withSuccess, withWarning } from './confirm';
|
|
22
22
|
import useModal from './useModal';
|
|
23
23
|
import CSSAnimation from "../_cssAnimation";
|
|
24
|
-
import { getScrollbarWidth } from '../_utils';
|
|
24
|
+
import { getDefaultPropsFromGlobalConfig, getScrollbarWidth } from '../_utils';
|
|
25
25
|
export const destroyFns = [];
|
|
26
26
|
class Modal extends BaseComponent {
|
|
27
27
|
constructor(props) {
|
|
28
28
|
super(props);
|
|
29
|
+
this.bodyOverflow = null;
|
|
29
30
|
this.handleCancel = e => {
|
|
30
31
|
this.foundation.handleCancel(e);
|
|
31
32
|
};
|
|
@@ -172,7 +173,6 @@ class Modal extends BaseComponent {
|
|
|
172
173
|
};
|
|
173
174
|
this.foundation = new ModalFoundation(this.adapter);
|
|
174
175
|
this.modalRef = /*#__PURE__*/React.createRef();
|
|
175
|
-
this.bodyOverflow = '';
|
|
176
176
|
this.scrollBarWidth = 0;
|
|
177
177
|
this.originBodyWidth = '100%';
|
|
178
178
|
}
|
|
@@ -193,7 +193,7 @@ class Modal extends BaseComponent {
|
|
|
193
193
|
const {
|
|
194
194
|
getPopupContainer
|
|
195
195
|
} = this.props;
|
|
196
|
-
if (!getPopupContainer && this.bodyOverflow !== 'hidden') {
|
|
196
|
+
if (!getPopupContainer && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
|
|
197
197
|
document.body.style.overflow = this.bodyOverflow;
|
|
198
198
|
document.body.style.width = this.originBodyWidth;
|
|
199
199
|
}
|
|
@@ -311,7 +311,8 @@ Modal.propTypes = {
|
|
|
311
311
|
fullScreen: PropTypes.bool,
|
|
312
312
|
footerFill: PropTypes.bool
|
|
313
313
|
};
|
|
314
|
-
Modal.
|
|
314
|
+
Modal.__SemiComponentName__ = "Modal";
|
|
315
|
+
Modal.defaultProps = getDefaultPropsFromGlobalConfig(Modal.__SemiComponentName__, {
|
|
315
316
|
zIndex: 1000,
|
|
316
317
|
motion: true,
|
|
317
318
|
mask: true,
|
|
@@ -330,7 +331,7 @@ Modal.defaultProps = {
|
|
|
330
331
|
keepDOM: false,
|
|
331
332
|
lazyRender: true,
|
|
332
333
|
fullScreen: false
|
|
333
|
-
};
|
|
334
|
+
});
|
|
334
335
|
Modal.useModal = useModal;
|
|
335
336
|
Modal.info = function (props) {
|
|
336
337
|
return confirm(withInfo(props));
|
|
@@ -159,27 +159,27 @@ export declare function withError(props: ModalReactProps): {
|
|
|
159
159
|
width?: string | number;
|
|
160
160
|
height?: string | number;
|
|
161
161
|
content?: React.ReactNode;
|
|
162
|
-
icon: string | number | boolean | React.ReactFragment | JSX.Element;
|
|
163
|
-
onCancel?: (e: React.MouseEvent<Element, MouseEvent>) => void | Promise<any>;
|
|
164
162
|
closeOnEsc?: boolean;
|
|
165
163
|
preventScroll?: boolean;
|
|
166
164
|
afterClose?: () => void;
|
|
167
165
|
keepDOM?: boolean;
|
|
168
|
-
|
|
169
|
-
okText?: string;
|
|
170
|
-
closeIcon?: React.ReactNode;
|
|
171
|
-
bodyStyle?: React.CSSProperties;
|
|
166
|
+
icon: string | number | boolean | React.ReactFragment | JSX.Element;
|
|
172
167
|
closable?: boolean;
|
|
173
|
-
|
|
168
|
+
onCancel?: (e: React.MouseEvent<Element, MouseEvent>) => void | Promise<any>;
|
|
169
|
+
bodyStyle?: React.CSSProperties;
|
|
174
170
|
cancelButtonProps?: import("../button").BaseButtonProps;
|
|
171
|
+
cancelText?: string;
|
|
175
172
|
centered?: boolean;
|
|
176
173
|
confirmLoading?: boolean;
|
|
177
174
|
cancelLoading?: boolean;
|
|
178
175
|
hasCancel?: boolean;
|
|
176
|
+
maskClosable?: boolean;
|
|
179
177
|
maskStyle?: React.CSSProperties;
|
|
180
178
|
maskFixed?: boolean;
|
|
179
|
+
okText?: string;
|
|
181
180
|
okType?: import("@douyinfe/semi-foundation/lib/es/modal/modalFoundation").OKType;
|
|
182
181
|
onOk?: (e: React.MouseEvent<Element, MouseEvent>) => void | Promise<any>;
|
|
182
|
+
closeIcon?: React.ReactNode;
|
|
183
183
|
lazyRender?: boolean;
|
|
184
184
|
fullScreen?: boolean;
|
|
185
185
|
footerFill?: boolean;
|
|
@@ -380,12 +380,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
380
380
|
suppressHydrationWarning?: boolean;
|
|
381
381
|
accessKey?: string;
|
|
382
382
|
autoFocus?: boolean;
|
|
383
|
-
content?: string;
|
|
384
|
-
formAction?: string;
|
|
385
|
-
formEncType?: string;
|
|
386
|
-
formMethod?: string;
|
|
387
|
-
formNoValidate?: boolean;
|
|
388
|
-
formTarget?: string;
|
|
389
383
|
contextMenu?: string;
|
|
390
384
|
dir?: string;
|
|
391
385
|
draggable?: boolean | "true" | "false";
|
|
@@ -396,6 +390,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
396
390
|
inputMode?: "search" | "none" | "text" | "email" | "tel" | "url" | "numeric" | "decimal";
|
|
397
391
|
nonce?: string;
|
|
398
392
|
tabIndex?: number;
|
|
393
|
+
content?: string;
|
|
399
394
|
'aria-expanded'?: boolean | "true" | "false";
|
|
400
395
|
'aria-haspopup'?: boolean | "dialog" | "menu" | "grid" | "listbox" | "tree" | "true" | "false";
|
|
401
396
|
'aria-controls'?: string;
|
|
@@ -432,7 +427,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
432
427
|
'aria-colcount'?: number;
|
|
433
428
|
'aria-colindex'?: number;
|
|
434
429
|
'aria-colspan'?: number;
|
|
435
|
-
'aria-current'?: boolean | "time" | "true" | "false" | "date" | "
|
|
430
|
+
'aria-current'?: boolean | "time" | "true" | "false" | "date" | "location" | "page" | "step";
|
|
436
431
|
'aria-details'?: string;
|
|
437
432
|
'aria-disabled'?: boolean | "true" | "false";
|
|
438
433
|
'aria-dropeffect'?: "link" | "none" | "copy" | "move" | "execute" | "popup";
|
|
@@ -467,6 +462,11 @@ export declare function withError(props: ModalReactProps): {
|
|
|
467
462
|
'aria-valuemin'?: number;
|
|
468
463
|
'aria-valuenow'?: number;
|
|
469
464
|
'aria-valuetext'?: string;
|
|
465
|
+
formAction?: string;
|
|
466
|
+
formEncType?: string;
|
|
467
|
+
formMethod?: string;
|
|
468
|
+
formNoValidate?: boolean;
|
|
469
|
+
formTarget?: string;
|
|
470
470
|
};
|
|
471
471
|
};
|
|
472
472
|
export declare function withConfirm(props: ModalReactProps): {
|
|
@@ -119,21 +119,8 @@ declare class Nav extends BaseComponent<NavProps, NavState> {
|
|
|
119
119
|
limitIndent: PropTypes.Requireable<boolean>;
|
|
120
120
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
121
121
|
};
|
|
122
|
-
static
|
|
123
|
-
|
|
124
|
-
subNavOpenDelay: number;
|
|
125
|
-
tooltipHideDelay: number;
|
|
126
|
-
tooltipShowDelay: number;
|
|
127
|
-
onCollapseChange: (...args: any[]) => void;
|
|
128
|
-
onSelect: (...args: any[]) => void;
|
|
129
|
-
onClick: (...args: any[]) => void;
|
|
130
|
-
onOpenChange: (...args: any[]) => void;
|
|
131
|
-
toggleIconPosition: string;
|
|
132
|
-
limitIndent: boolean;
|
|
133
|
-
prefixCls: string;
|
|
134
|
-
subNavMotion: boolean;
|
|
135
|
-
mode: string;
|
|
136
|
-
};
|
|
122
|
+
static __SemiComponentName__: string;
|
|
123
|
+
static defaultProps: any;
|
|
137
124
|
itemsChanged: boolean;
|
|
138
125
|
constructor(props: NavProps);
|
|
139
126
|
static getDerivedStateFromProps(props: NavProps, state: NavState): Partial<NavState>;
|
|
@@ -22,6 +22,7 @@ import Header from './Header';
|
|
|
22
22
|
import NavContext from './nav-context';
|
|
23
23
|
import LocaleConsumer from '../locale/localeConsumer';
|
|
24
24
|
import '@douyinfe/semi-foundation/lib/es/navigation/navigation.css';
|
|
25
|
+
import { getDefaultPropsFromGlobalConfig } from "../_utils";
|
|
25
26
|
function createAddKeysFn(context, keyName) {
|
|
26
27
|
return function addKeys() {
|
|
27
28
|
const handleKeys = new Set(context.state[keyName]);
|
|
@@ -359,7 +360,8 @@ Nav.propTypes = {
|
|
|
359
360
|
limitIndent: PropTypes.bool,
|
|
360
361
|
getPopupContainer: PropTypes.func
|
|
361
362
|
};
|
|
362
|
-
Nav.
|
|
363
|
+
Nav.__SemiComponentName__ = "Navigation";
|
|
364
|
+
Nav.defaultProps = getDefaultPropsFromGlobalConfig(Nav.__SemiComponentName__, {
|
|
363
365
|
subNavCloseDelay: numbers.DEFAULT_SUBNAV_CLOSE_DELAY,
|
|
364
366
|
subNavOpenDelay: numbers.DEFAULT_SUBNAV_OPEN_DELAY,
|
|
365
367
|
tooltipHideDelay: numbers.DEFAULT_TOOLTIP_HIDE_DELAY,
|
|
@@ -377,6 +379,6 @@ Nav.defaultProps = {
|
|
|
377
379
|
// defaultOpenKeys: [],
|
|
378
380
|
// defaultSelectedKeys: [],
|
|
379
381
|
// items: [],
|
|
380
|
-
};
|
|
382
|
+
});
|
|
381
383
|
|
|
382
384
|
export default Nav;
|
|
@@ -29,18 +29,8 @@ declare class Notice extends BaseComponent<NoticeReactProps, NoticeState> {
|
|
|
29
29
|
close: PropTypes.Requireable<(...args: any[]) => any>;
|
|
30
30
|
direction: PropTypes.Requireable<"ltr" | "rtl">;
|
|
31
31
|
};
|
|
32
|
-
static
|
|
33
|
-
|
|
34
|
-
id: string;
|
|
35
|
-
close: (...args: any[]) => void;
|
|
36
|
-
onClose: (...args: any[]) => void;
|
|
37
|
-
onClick: (...args: any[]) => void;
|
|
38
|
-
onCloseClick: (...args: any[]) => void;
|
|
39
|
-
content: string;
|
|
40
|
-
title: string;
|
|
41
|
-
showClose: boolean;
|
|
42
|
-
theme: string;
|
|
43
|
-
};
|
|
32
|
+
static __SemiComponentName__: string;
|
|
33
|
+
static defaultProps: any;
|
|
44
34
|
get adapter(): NoticeAdapter;
|
|
45
35
|
constructor(props: NoticeReactProps);
|
|
46
36
|
context: ContextValue;
|
|
@@ -15,7 +15,7 @@ import { cssClasses, numbers, strings } from '@douyinfe/semi-foundation/lib/es/n
|
|
|
15
15
|
import NotificationFoundation from '@douyinfe/semi-foundation/lib/es/notification/notificationFoundation';
|
|
16
16
|
import Button from '../iconButton';
|
|
17
17
|
import BaseComponent from '../_base/baseComponent';
|
|
18
|
-
import { isSemiIcon } from '../_utils';
|
|
18
|
+
import { getDefaultPropsFromGlobalConfig, isSemiIcon } from '../_utils';
|
|
19
19
|
import { IconAlertCircle, IconAlertTriangle, IconClose, IconInfoCircle, IconTickCircle } from '@douyinfe/semi-icons';
|
|
20
20
|
import { getUuidShort } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
|
|
21
21
|
const prefixCls = cssClasses.NOTICE;
|
|
@@ -175,7 +175,8 @@ Notice.propTypes = {
|
|
|
175
175
|
close: PropTypes.func,
|
|
176
176
|
direction: PropTypes.oneOf(directions)
|
|
177
177
|
};
|
|
178
|
-
Notice.
|
|
178
|
+
Notice.__SemiComponentName__ = "Notification";
|
|
179
|
+
Notice.defaultProps = getDefaultPropsFromGlobalConfig(Notice.__SemiComponentName__, {
|
|
179
180
|
duration,
|
|
180
181
|
id: '',
|
|
181
182
|
close: _noop,
|
|
@@ -186,5 +187,5 @@ Notice.defaultProps = {
|
|
|
186
187
|
title: '',
|
|
187
188
|
showClose: true,
|
|
188
189
|
theme: 'normal'
|
|
189
|
-
};
|
|
190
|
+
});
|
|
190
191
|
export default Notice;
|
|
@@ -44,15 +44,8 @@ export interface OverflowListState {
|
|
|
44
44
|
overflowWidth?: number;
|
|
45
45
|
}
|
|
46
46
|
declare class OverflowList extends BaseComponent<OverflowListProps, OverflowListState> {
|
|
47
|
-
static
|
|
48
|
-
|
|
49
|
-
minVisibleItems: number;
|
|
50
|
-
overflowRenderer: () => ReactElement;
|
|
51
|
-
renderMode: string;
|
|
52
|
-
threshold: number;
|
|
53
|
-
visibleItemRenderer: () => ReactElement;
|
|
54
|
-
onOverflow: () => any;
|
|
55
|
-
};
|
|
47
|
+
static __SemiComponentName__: string;
|
|
48
|
+
static defaultProps: any;
|
|
56
49
|
static propTypes: {
|
|
57
50
|
className: PropTypes.Requireable<string>;
|
|
58
51
|
collapseFrom: PropTypes.Requireable<"end" | "start">;
|
|
@@ -10,7 +10,7 @@ import ResizeObserver from '../resizeObserver';
|
|
|
10
10
|
import IntersectionObserver from './intersectionObserver';
|
|
11
11
|
import OverflowListFoundation from '@douyinfe/semi-foundation/lib/es/overflowList/foundation';
|
|
12
12
|
import '@douyinfe/semi-foundation/lib/es/overflowList/overflowList.css';
|
|
13
|
-
import { cloneDeep } from '../_utils';
|
|
13
|
+
import { cloneDeep, getDefaultPropsFromGlobalConfig } from '../_utils';
|
|
14
14
|
const prefixCls = cssClasses.PREFIX;
|
|
15
15
|
const Boundary = strings.BOUNDARY_MAP;
|
|
16
16
|
const OverflowDirection = strings.OVERFLOW_DIR;
|
|
@@ -269,7 +269,8 @@ class OverflowList extends BaseComponent {
|
|
|
269
269
|
}, list);
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
OverflowList.
|
|
272
|
+
OverflowList.__SemiComponentName__ = "OverflowList";
|
|
273
|
+
OverflowList.defaultProps = getDefaultPropsFromGlobalConfig(OverflowList.__SemiComponentName__, {
|
|
273
274
|
collapseFrom: 'end',
|
|
274
275
|
minVisibleItems: 0,
|
|
275
276
|
overflowRenderer: () => null,
|
|
@@ -277,7 +278,7 @@ OverflowList.defaultProps = {
|
|
|
277
278
|
threshold: 0.75,
|
|
278
279
|
visibleItemRenderer: () => null,
|
|
279
280
|
onOverflow: () => null
|
|
280
|
-
};
|
|
281
|
+
});
|
|
281
282
|
OverflowList.propTypes = {
|
|
282
283
|
// if render in scroll mode, key is required in items
|
|
283
284
|
className: PropTypes.string,
|
|
@@ -65,21 +65,8 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
|
|
|
65
65
|
trigger: PropTypes.Requireable<string>;
|
|
66
66
|
position: PropTypes.Requireable<string>;
|
|
67
67
|
};
|
|
68
|
-
static
|
|
69
|
-
|
|
70
|
-
trigger: string;
|
|
71
|
-
onVisibleChange: (...args: any[]) => void;
|
|
72
|
-
disabled: boolean;
|
|
73
|
-
icon: JSX.Element;
|
|
74
|
-
okType: string;
|
|
75
|
-
cancelType: string;
|
|
76
|
-
prefixCls: string;
|
|
77
|
-
zIndex: number;
|
|
78
|
-
showCloseIcon: boolean;
|
|
79
|
-
onCancel: (...args: any[]) => void;
|
|
80
|
-
onConfirm: (...args: any[]) => void;
|
|
81
|
-
onClickOutSide: (...args: any[]) => void;
|
|
82
|
-
};
|
|
68
|
+
static __SemiComponentName__: string;
|
|
69
|
+
static defaultProps: any;
|
|
83
70
|
footerRef: React.RefObject<HTMLDivElement | null>;
|
|
84
71
|
popoverRef: React.RefObject<Popover | null>;
|
|
85
72
|
foundation: PopconfirmFoundation;
|
|
@@ -22,6 +22,7 @@ import Button from '../button';
|
|
|
22
22
|
import ConfigContext from '../configProvider/context';
|
|
23
23
|
import LocaleConsumer from '../locale/localeConsumer';
|
|
24
24
|
import '@douyinfe/semi-foundation/lib/es/popconfirm/popconfirm.css';
|
|
25
|
+
import { getDefaultPropsFromGlobalConfig } from "../_utils";
|
|
25
26
|
export default class Popconfirm extends BaseComponent {
|
|
26
27
|
constructor(props) {
|
|
27
28
|
super(props);
|
|
@@ -253,7 +254,8 @@ Popconfirm.propTypes = {
|
|
|
253
254
|
trigger: PropTypes.string,
|
|
254
255
|
position: PropTypes.string
|
|
255
256
|
};
|
|
256
|
-
Popconfirm.
|
|
257
|
+
Popconfirm.__SemiComponentName__ = "Popconfirm";
|
|
258
|
+
Popconfirm.defaultProps = getDefaultPropsFromGlobalConfig(Popconfirm.__SemiComponentName__, {
|
|
257
259
|
stopPropagation: true,
|
|
258
260
|
trigger: 'click',
|
|
259
261
|
// position: 'bottomLeft',
|
|
@@ -270,4 +272,4 @@ Popconfirm.defaultProps = {
|
|
|
270
272
|
onCancel: _noop,
|
|
271
273
|
onConfirm: _noop,
|
|
272
274
|
onClickOutSide: _noop
|
|
273
|
-
};
|
|
275
|
+
});
|
|
@@ -81,29 +81,8 @@ declare class Popover extends React.PureComponent<PopoverProps, PopoverState> {
|
|
|
81
81
|
guardFocus: PropTypes.Requireable<boolean>;
|
|
82
82
|
disableArrowKeyDown: PropTypes.Requireable<boolean>;
|
|
83
83
|
};
|
|
84
|
-
static
|
|
85
|
-
|
|
86
|
-
offsetY: number;
|
|
87
|
-
offsetX: number;
|
|
88
|
-
height: number;
|
|
89
|
-
width: 24;
|
|
90
|
-
};
|
|
91
|
-
showArrow: boolean;
|
|
92
|
-
autoAdjustOverflow: boolean;
|
|
93
|
-
zIndex: number;
|
|
94
|
-
motion: boolean;
|
|
95
|
-
trigger: string;
|
|
96
|
-
cancelText: string;
|
|
97
|
-
okText: string;
|
|
98
|
-
position: string;
|
|
99
|
-
prefixCls: string;
|
|
100
|
-
onClickOutSide: (...args: any[]) => void;
|
|
101
|
-
onEscKeyDown: (...args: any[]) => void;
|
|
102
|
-
closeOnEsc: boolean;
|
|
103
|
-
returnFocusOnClose: boolean;
|
|
104
|
-
guardFocus: boolean;
|
|
105
|
-
disableFocusListener: boolean;
|
|
106
|
-
};
|
|
84
|
+
static __SemiComponentName__: string;
|
|
85
|
+
static defaultProps: any;
|
|
107
86
|
context: ContextValue;
|
|
108
87
|
tooltipRef: React.RefObject<Tooltip | null>;
|
|
109
88
|
constructor(props: PopoverProps);
|
package/lib/es/popover/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import Tooltip from '../tooltip/index';
|
|
|
17
17
|
import Arrow from './Arrow';
|
|
18
18
|
import '@douyinfe/semi-foundation/lib/es/popover/popover.css';
|
|
19
19
|
import isNullOrUndefined from '@douyinfe/semi-foundation/lib/es/utils/isNullOrUndefined';
|
|
20
|
+
import { getDefaultPropsFromGlobalConfig } from "../_utils";
|
|
20
21
|
const positionSet = strings.POSITION_SET;
|
|
21
22
|
const triggerSet = strings.TRIGGER_SET;
|
|
22
23
|
class Popover extends React.PureComponent {
|
|
@@ -140,7 +141,8 @@ Popover.propTypes = {
|
|
|
140
141
|
guardFocus: PropTypes.bool,
|
|
141
142
|
disableArrowKeyDown: PropTypes.bool
|
|
142
143
|
};
|
|
143
|
-
Popover.
|
|
144
|
+
Popover.__SemiComponentName__ = "Popover";
|
|
145
|
+
Popover.defaultProps = getDefaultPropsFromGlobalConfig(Popover.__SemiComponentName__, {
|
|
144
146
|
arrowBounding: numbers.ARROW_BOUNDING,
|
|
145
147
|
showArrow: false,
|
|
146
148
|
autoAdjustOverflow: true,
|
|
@@ -157,5 +159,5 @@ Popover.defaultProps = {
|
|
|
157
159
|
returnFocusOnClose: true,
|
|
158
160
|
guardFocus: true,
|
|
159
161
|
disableFocusListener: true
|
|
160
|
-
};
|
|
162
|
+
});
|
|
161
163
|
export default Popover;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
4
|
-
import ResizeObserver from 'resize-observer-polyfill';
|
|
5
4
|
/** A parallel type to `ResizeObserverEntry` (from resize-observer-polyfill). */
|
|
6
5
|
export interface ResizeEntry {
|
|
7
6
|
contentRect: DOMRectReadOnly;
|
|
@@ -10,26 +9,39 @@ export interface ResizeEntry {
|
|
|
10
9
|
export interface ReactResizeObserverProps extends BaseProps {
|
|
11
10
|
onResize?: (entries: ResizeEntry[]) => void;
|
|
12
11
|
observeParent?: boolean;
|
|
12
|
+
observerProperty?: ObserverProperty;
|
|
13
|
+
delayTick?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare enum ObserverProperty {
|
|
16
|
+
Width = "width",
|
|
17
|
+
Height = "height",
|
|
18
|
+
All = "all"
|
|
13
19
|
}
|
|
14
20
|
export default class ReactResizeObserver extends BaseComponent<ReactResizeObserverProps> {
|
|
15
21
|
static propTypes: {
|
|
16
22
|
onResize: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
23
|
observeParent: PropTypes.Requireable<boolean>;
|
|
24
|
+
observerProperty: PropTypes.Requireable<string>;
|
|
25
|
+
delayTick: PropTypes.Requireable<number>;
|
|
18
26
|
};
|
|
19
27
|
static defaultProps: {
|
|
20
28
|
onResize: () => void;
|
|
21
29
|
observeParent: boolean;
|
|
30
|
+
observerProperty: string;
|
|
31
|
+
delayTick: number;
|
|
22
32
|
};
|
|
23
33
|
observer: ResizeObserver;
|
|
24
34
|
childNode: any;
|
|
25
35
|
element: Element;
|
|
26
36
|
_parentNode: HTMLElement;
|
|
37
|
+
formerPropertyValue: Map<Element, number>;
|
|
27
38
|
constructor(props: ReactResizeObserverProps);
|
|
28
39
|
componentDidMount(): void;
|
|
29
40
|
componentDidUpdate(prevProps: ReactResizeObserverProps): void;
|
|
30
41
|
componentWillUnmount(): void;
|
|
31
42
|
getElement: () => Element | Text;
|
|
32
|
-
|
|
43
|
+
handleResizeEventTriggered: (entries: ResizeEntry[]) => void;
|
|
44
|
+
observeElement: (force?: boolean) => void;
|
|
33
45
|
mergeRef: (ref: any, node: HTMLDivElement) => void;
|
|
34
46
|
render(): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
35
47
|
}
|
|
@@ -2,10 +2,18 @@ import React from 'react';
|
|
|
2
2
|
import { findDOMNode } from 'react-dom';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import BaseComponent from '../_base/baseComponent';
|
|
5
|
-
|
|
5
|
+
export var ObserverProperty;
|
|
6
|
+
(function (ObserverProperty) {
|
|
7
|
+
ObserverProperty["Width"] = "width";
|
|
8
|
+
ObserverProperty["Height"] = "height";
|
|
9
|
+
ObserverProperty["All"] = "all";
|
|
10
|
+
})(ObserverProperty || (ObserverProperty = {}));
|
|
6
11
|
export default class ReactResizeObserver extends BaseComponent {
|
|
7
12
|
constructor(props) {
|
|
13
|
+
var _this;
|
|
8
14
|
super(props);
|
|
15
|
+
_this = this;
|
|
16
|
+
this.formerPropertyValue = new Map();
|
|
9
17
|
this.getElement = () => {
|
|
10
18
|
try {
|
|
11
19
|
// using findDOMNode for two reasons:
|
|
@@ -17,6 +25,54 @@ export default class ReactResizeObserver extends BaseComponent {
|
|
|
17
25
|
return null;
|
|
18
26
|
}
|
|
19
27
|
};
|
|
28
|
+
this.handleResizeEventTriggered = entries => {
|
|
29
|
+
if (this.props.observerProperty === ObserverProperty.All) {
|
|
30
|
+
this.props.onResize(entries);
|
|
31
|
+
} else {
|
|
32
|
+
const finalEntries = [];
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
if (this.formerPropertyValue.has(entry.target)) {
|
|
35
|
+
if (entry.contentRect[this.props.observerProperty] !== this.formerPropertyValue.get(entry.target)) {
|
|
36
|
+
this.formerPropertyValue.set(entry.target, entry.contentRect[this.props.observerProperty]);
|
|
37
|
+
finalEntries.push(entry);
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
this.formerPropertyValue.set(entry.target, entry.contentRect[this.props.observerProperty]);
|
|
41
|
+
finalEntries.push(entry);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (finalEntries.length > 0) {
|
|
45
|
+
this.props.onResize(finalEntries);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
this.observeElement = function () {
|
|
50
|
+
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
51
|
+
const element = _this.getElement();
|
|
52
|
+
if (!_this.observer) {
|
|
53
|
+
_this.observer = new ResizeObserver(_this.handleResizeEventTriggered);
|
|
54
|
+
}
|
|
55
|
+
if (!(element && element instanceof Element)) {
|
|
56
|
+
// stop everything if not defined
|
|
57
|
+
_this.observer.disconnect();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (element === _this.element && !force) {
|
|
61
|
+
// abort if given same element -- nothing to update (unless forced)
|
|
62
|
+
return;
|
|
63
|
+
} else {
|
|
64
|
+
// clear observer list if new element
|
|
65
|
+
_this.observer.disconnect();
|
|
66
|
+
// remember element reference for next time
|
|
67
|
+
_this.element = element;
|
|
68
|
+
}
|
|
69
|
+
// observer callback is invoked immediately when observing new elements
|
|
70
|
+
_this.observer.observe(element);
|
|
71
|
+
if (_this.props.observeParent && element.parentNode && element.parentNode.ownerDocument && element.parentNode.ownerDocument.defaultView && element.parentNode instanceof element.parentNode.ownerDocument.defaultView.HTMLElement) {
|
|
72
|
+
_this._parentNode = element.parentNode;
|
|
73
|
+
_this.observer.observe(_this._parentNode);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
20
76
|
this.mergeRef = (ref, node) => {
|
|
21
77
|
this.childNode = node;
|
|
22
78
|
if (typeof ref === 'function') {
|
|
@@ -25,7 +81,7 @@ export default class ReactResizeObserver extends BaseComponent {
|
|
|
25
81
|
ref.current = node;
|
|
26
82
|
}
|
|
27
83
|
};
|
|
28
|
-
this.observer = new ResizeObserver(
|
|
84
|
+
this.observer = new ResizeObserver(this.handleResizeEventTriggered);
|
|
29
85
|
}
|
|
30
86
|
componentDidMount() {
|
|
31
87
|
this.observeElement();
|
|
@@ -40,33 +96,6 @@ export default class ReactResizeObserver extends BaseComponent {
|
|
|
40
96
|
this.element = null;
|
|
41
97
|
}
|
|
42
98
|
}
|
|
43
|
-
observeElement() {
|
|
44
|
-
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
45
|
-
const element = this.getElement();
|
|
46
|
-
if (!this.observer) {
|
|
47
|
-
this.observer = new ResizeObserver(this.props.onResize);
|
|
48
|
-
}
|
|
49
|
-
if (!(element && element instanceof Element)) {
|
|
50
|
-
// stop everything if not defined
|
|
51
|
-
this.observer.disconnect();
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (element === this.element && !force) {
|
|
55
|
-
// abort if given same element -- nothing to update (unless forced)
|
|
56
|
-
return;
|
|
57
|
-
} else {
|
|
58
|
-
// clear observer list if new element
|
|
59
|
-
this.observer.disconnect();
|
|
60
|
-
// remember element reference for next time
|
|
61
|
-
this.element = element;
|
|
62
|
-
}
|
|
63
|
-
// observer callback is invoked immediately when observing new elements
|
|
64
|
-
this.observer.observe(element);
|
|
65
|
-
if (this.props.observeParent && element.parentNode && element.parentNode.ownerDocument && element.parentNode.ownerDocument.defaultView && element.parentNode instanceof element.parentNode.ownerDocument.defaultView.HTMLElement) {
|
|
66
|
-
this._parentNode = element.parentNode;
|
|
67
|
-
this.observer.observe(this._parentNode);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
99
|
render() {
|
|
71
100
|
const child = React.Children.only(this.props.children);
|
|
72
101
|
const {
|
|
@@ -79,9 +108,13 @@ export default class ReactResizeObserver extends BaseComponent {
|
|
|
79
108
|
}
|
|
80
109
|
ReactResizeObserver.propTypes = {
|
|
81
110
|
onResize: PropTypes.func,
|
|
82
|
-
observeParent: PropTypes.bool
|
|
111
|
+
observeParent: PropTypes.bool,
|
|
112
|
+
observerProperty: PropTypes.string,
|
|
113
|
+
delayTick: PropTypes.number
|
|
83
114
|
};
|
|
84
115
|
ReactResizeObserver.defaultProps = {
|
|
85
116
|
onResize: () => {},
|
|
86
|
-
observeParent: false
|
|
117
|
+
observeParent: false,
|
|
118
|
+
observerProperty: "all",
|
|
119
|
+
delayTick: 0
|
|
87
120
|
};
|
package/lib/es/select/index.d.ts
CHANGED
|
@@ -251,6 +251,7 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
251
251
|
arrowIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
252
252
|
preventScroll: PropTypes.Requireable<boolean>;
|
|
253
253
|
};
|
|
254
|
+
static __SemiComponentName__: string;
|
|
254
255
|
static defaultProps: Partial<SelectProps>;
|
|
255
256
|
inputRef: React.RefObject<HTMLInputElement>;
|
|
256
257
|
triggerRef: React.RefObject<HTMLDivElement>;
|
package/lib/es/select/index.js
CHANGED
|
@@ -38,7 +38,7 @@ import OptionGroup from './optionGroup';
|
|
|
38
38
|
import Spin from '../spin';
|
|
39
39
|
import Trigger from '../trigger';
|
|
40
40
|
import { IconChevronDown, IconClear } from '@douyinfe/semi-icons';
|
|
41
|
-
import { isSemiIcon, getFocusableElements, getActiveElement } from '../_utils';
|
|
41
|
+
import { isSemiIcon, getFocusableElements, getActiveElement, getDefaultPropsFromGlobalConfig } from '../_utils';
|
|
42
42
|
import { getUuidShort } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
|
|
43
43
|
import '@douyinfe/semi-foundation/lib/es/select/select.css';
|
|
44
44
|
const prefixcls = cssClasses.PREFIX;
|
|
@@ -1284,7 +1284,8 @@ Select.propTypes = {
|
|
|
1284
1284
|
// tagClosable: PropTypes.bool,
|
|
1285
1285
|
};
|
|
1286
1286
|
|
|
1287
|
-
Select.
|
|
1287
|
+
Select.__SemiComponentName__ = "Select";
|
|
1288
|
+
Select.defaultProps = getDefaultPropsFromGlobalConfig(Select.__SemiComponentName__, {
|
|
1288
1289
|
stopPropagation: true,
|
|
1289
1290
|
motion: true,
|
|
1290
1291
|
borderless: false,
|
|
@@ -1329,6 +1330,6 @@ Select.defaultProps = {
|
|
|
1329
1330
|
// renderSelectedItem: (optionNode) => optionNode.label,
|
|
1330
1331
|
// The default creator rendering is related to i18, so it is not declared here
|
|
1331
1332
|
// renderCreateItem: (input) => input
|
|
1332
|
-
};
|
|
1333
|
+
});
|
|
1333
1334
|
|
|
1334
1335
|
export default Select;
|
package/lib/es/select/option.js
CHANGED
|
@@ -45,6 +45,7 @@ export default class SideSheet extends BaseComponent<SideSheetReactProps, SideSh
|
|
|
45
45
|
keepDOM: PropTypes.Requireable<boolean>;
|
|
46
46
|
'aria-label': PropTypes.Requireable<string>;
|
|
47
47
|
};
|
|
48
|
+
static __SemiComponentName__: string;
|
|
48
49
|
static defaultProps: SideSheetReactProps;
|
|
49
50
|
private _active;
|
|
50
51
|
constructor(props: SideSheetReactProps);
|
|
@@ -18,7 +18,7 @@ import SideSheetContent from './SideSheetContent';
|
|
|
18
18
|
import SideSheetFoundation from '@douyinfe/semi-foundation/lib/es/sideSheet/sideSheetFoundation';
|
|
19
19
|
import '@douyinfe/semi-foundation/lib/es/sideSheet/sideSheet.css';
|
|
20
20
|
import CSSAnimation from "../_cssAnimation";
|
|
21
|
-
import { getScrollbarWidth } from '../_utils';
|
|
21
|
+
import { getDefaultPropsFromGlobalConfig, getScrollbarWidth } from '../_utils';
|
|
22
22
|
const prefixCls = cssClasses.PREFIX;
|
|
23
23
|
const defaultWidthList = strings.WIDTH;
|
|
24
24
|
const defaultHeight = strings.HEIGHT;
|
|
@@ -248,7 +248,8 @@ SideSheet.propTypes = {
|
|
|
248
248
|
keepDOM: PropTypes.bool,
|
|
249
249
|
'aria-label': PropTypes.string
|
|
250
250
|
};
|
|
251
|
-
SideSheet.
|
|
251
|
+
SideSheet.__SemiComponentName__ = "SideSheet";
|
|
252
|
+
SideSheet.defaultProps = getDefaultPropsFromGlobalConfig(SideSheet.__SemiComponentName__, {
|
|
252
253
|
visible: false,
|
|
253
254
|
motion: true,
|
|
254
255
|
mask: true,
|
|
@@ -262,4 +263,4 @@ SideSheet.defaultProps = {
|
|
|
262
263
|
closeOnEsc: false,
|
|
263
264
|
afterVisibleChange: _noop,
|
|
264
265
|
keepDOM: false
|
|
265
|
-
};
|
|
266
|
+
});
|
|
@@ -57,7 +57,7 @@ const ResizableTable = function () {
|
|
|
57
57
|
width: numbers.DEFAULT_WIDTH_COLUMN_EXPAND
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
if (props.rowSelection && !_find(rawColumns, item => item.key === strings.DEFAULT_KEY_COLUMN_SELECTION)) {
|
|
60
|
+
if (props.rowSelection && !_get(props.rowSelection, 'hidden') && !_find(rawColumns, item => item.key === strings.DEFAULT_KEY_COLUMN_SELECTION)) {
|
|
61
61
|
newColumns.unshift({
|
|
62
62
|
width: _get(props, 'rowSelection.width', numbers.DEFAULT_WIDTH_COLUMN_SELECTION),
|
|
63
63
|
key: strings.DEFAULT_KEY_COLUMN_SELECTION
|
package/lib/es/tabs/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ declare class Tabs extends BaseComponent<TabsProps, TabsState> {
|
|
|
38
38
|
onTabClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
39
|
preventScroll: PropTypes.Requireable<boolean>;
|
|
40
40
|
};
|
|
41
|
+
static __SemiComponentName__: string;
|
|
41
42
|
static defaultProps: TabsProps;
|
|
42
43
|
contentRef: RefObject<HTMLDivElement>;
|
|
43
44
|
contentHeight: string;
|