@douyinfe/semi-ui 2.8.0 → 2.8.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/_base/_story/index.scss +0 -1
- package/_base/baseComponent.tsx +2 -1
- package/_portal/index.tsx +2 -1
- package/anchor/index.tsx +2 -1
- package/anchor/link.tsx +2 -1
- package/autoComplete/index.tsx +2 -2
- package/avatar/interface.ts +2 -2
- package/backtop/index.tsx +1 -0
- package/badge/index.tsx +4 -2
- package/banner/index.tsx +1 -0
- package/breadcrumb/bread-context.tsx +2 -2
- package/breadcrumb/index.tsx +2 -2
- package/breadcrumb/item.tsx +11 -3
- package/button/Button.tsx +2 -1
- package/button/buttonGroup.tsx +2 -1
- package/calendar/_story/Demo.tsx +3 -3
- package/card/cardGroup.tsx +1 -0
- package/card/index.tsx +1 -0
- package/cascader/index.tsx +3 -2
- package/cascader/item.tsx +3 -1
- package/checkbox/checkbox.tsx +4 -2
- package/checkbox/checkboxGroup.tsx +1 -1
- package/checkbox/context.ts +3 -3
- package/collapse/index.tsx +1 -0
- package/collapse/item.tsx +3 -0
- package/collapsible/index.tsx +2 -2
- package/configProvider/context.tsx +1 -1
- package/datePicker/datePicker.tsx +2 -1
- package/descriptions/index.tsx +3 -2
- package/descriptions/item.tsx +4 -1
- package/dist/css/semi.css +1 -1
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +31 -17
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/dropdown/context.ts +6 -1
- package/dropdown/dropdownItem.tsx +2 -1
- package/dropdown/dropdownTitle.tsx +2 -1
- package/dropdown/index.tsx +3 -1
- package/empty/index.tsx +1 -1
- package/form/arrayField.tsx +1 -0
- package/form/baseForm.tsx +3 -2
- package/form/group.tsx +2 -0
- package/form/hoc/withField.tsx +1 -1
- package/form/label.tsx +1 -0
- package/form/section.tsx +1 -1
- package/form/slot.tsx +2 -0
- package/grid/col.tsx +3 -1
- package/grid/row.tsx +5 -1
- package/layout/Sider.tsx +3 -1
- package/layout/index.tsx +2 -0
- package/layout/layout-context.ts +1 -1
- package/lib/cjs/_base/baseComponent.d.ts +2 -1
- package/lib/cjs/_portal/index.d.ts +3 -1
- package/lib/cjs/anchor/index.d.ts +2 -1
- package/lib/cjs/anchor/link.d.ts +3 -2
- package/lib/cjs/autoComplete/index.d.ts +2 -2
- package/lib/cjs/avatar/avatarGroup.d.ts +1 -1
- package/lib/cjs/avatar/interface.d.ts +2 -2
- package/lib/cjs/backtop/index.d.ts +1 -0
- package/lib/cjs/badge/index.d.ts +4 -2
- package/lib/cjs/banner/index.d.ts +2 -1
- package/lib/cjs/breadcrumb/bread-context.d.ts +2 -2
- package/lib/cjs/breadcrumb/index.d.ts +2 -2
- package/lib/cjs/breadcrumb/item.d.ts +15 -3
- package/lib/cjs/button/Button.d.ts +2 -1
- package/lib/cjs/button/buttonGroup.d.ts +1 -0
- package/lib/cjs/calendar/timeCol.d.ts +1 -1
- package/lib/cjs/card/cardGroup.d.ts +1 -0
- package/lib/cjs/card/index.d.ts +2 -1
- package/lib/cjs/cascader/index.d.ts +5 -3
- package/lib/cjs/cascader/item.d.ts +3 -1
- package/lib/cjs/checkbox/checkbox.d.ts +5 -11
- package/lib/cjs/checkbox/checkbox.js +1 -1
- package/lib/cjs/checkbox/checkboxGroup.d.ts +1 -1
- package/lib/cjs/checkbox/checkboxInner.d.ts +1 -10
- package/lib/cjs/checkbox/context.d.ts +3 -3
- package/lib/cjs/collapse/index.d.ts +1 -0
- package/lib/cjs/collapse/item.d.ts +2 -0
- package/lib/cjs/collapsible/index.d.ts +1 -1
- package/lib/cjs/configProvider/index.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +3 -1
- package/lib/cjs/datePicker/insetInput.d.ts +1 -0
- package/lib/cjs/descriptions/index.d.ts +3 -2
- package/lib/cjs/descriptions/item.d.ts +4 -1
- package/lib/cjs/dropdown/context.d.ts +5 -3
- package/lib/cjs/dropdown/dropdownItem.d.ts +3 -3
- package/lib/cjs/dropdown/dropdownMenu.d.ts +1 -0
- package/lib/cjs/dropdown/dropdownTitle.d.ts +3 -3
- package/lib/cjs/dropdown/index.d.ts +3 -3
- package/lib/cjs/empty/index.d.ts +1 -1
- package/lib/cjs/form/arrayField.d.ts +1 -0
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/baseForm.js +1 -1
- package/lib/cjs/form/group.d.ts +3 -1
- package/lib/cjs/form/label.d.ts +1 -0
- package/lib/cjs/form/section.d.ts +1 -1
- package/lib/cjs/form/slot.js +2 -0
- package/lib/cjs/grid/col.d.ts +3 -3
- package/lib/cjs/grid/row.d.ts +4 -3
- package/lib/cjs/inputNumber/index.d.ts +1 -1
- package/lib/cjs/layout/Sider.d.ts +4 -1
- package/lib/cjs/layout/index.d.ts +2 -0
- package/lib/cjs/list/index.d.ts +1 -0
- package/lib/cjs/list/item.d.ts +5 -1
- package/lib/cjs/list/item.js +5 -1
- package/lib/cjs/modal/Modal.d.ts +1 -0
- package/lib/cjs/modal/ModalContent.d.ts +7 -2
- package/lib/cjs/modal/confirm.d.ts +5 -0
- package/lib/cjs/modal/useModal/index.d.ts +1 -0
- package/lib/cjs/navigation/Footer.d.ts +3 -5
- package/lib/cjs/navigation/Header.d.ts +3 -5
- package/lib/cjs/navigation/Item.d.ts +4 -6
- package/lib/cjs/navigation/OpenIconTransition.d.ts +2 -1
- package/lib/cjs/navigation/SubNav.d.ts +3 -5
- package/lib/cjs/navigation/SubNav.js +2 -2
- package/lib/cjs/navigation/SubNavTransition.d.ts +1 -1
- package/lib/cjs/navigation/nav-context.d.ts +21 -5
- package/lib/cjs/notification/NoticeTransition.d.ts +2 -2
- package/lib/cjs/notification/index.d.ts +3 -1
- package/lib/cjs/notification/notice.d.ts +3 -1
- package/lib/cjs/notification/useNotification/index.d.ts +1 -0
- package/lib/cjs/overflowList/intersectionObserver.d.ts +3 -2
- package/lib/cjs/pagination/index.d.ts +3 -1
- package/lib/cjs/pagination/index.js +15 -11
- package/lib/cjs/popconfirm/index.d.ts +4 -2
- package/lib/cjs/popover/index.d.ts +3 -1
- package/lib/cjs/radio/radio.d.ts +1 -0
- package/lib/cjs/radio/radioGroup.d.ts +1 -0
- package/lib/cjs/select/index.d.ts +3 -1
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -0
- package/lib/cjs/sideSheet/SideSheetTransition.d.ts +1 -1
- package/lib/cjs/sideSheet/index.d.ts +3 -1
- package/lib/cjs/table/Body/ExpandedRow.d.ts +3 -1
- package/lib/cjs/table/Body/SectionRow.d.ts +3 -1
- package/lib/cjs/table/Table.d.ts +5 -3
- package/lib/cjs/table/TableCell.d.ts +5 -3
- package/lib/cjs/table/TableHeaderRow.d.ts +3 -1
- package/lib/cjs/table/table-context.d.ts +7 -6
- package/lib/cjs/tabs/TabPane.d.ts +3 -1
- package/lib/cjs/tabs/interface.d.ts +2 -1
- package/lib/cjs/tag/group.d.ts +1 -1
- package/lib/cjs/timePicker/Combobox.d.ts +1 -0
- package/lib/cjs/timeline/index.d.ts +2 -1
- package/lib/cjs/timeline/item.d.ts +1 -0
- package/lib/cjs/toast/ToastTransition.d.ts +1 -1
- package/lib/cjs/toast/index.d.ts +8 -16
- package/lib/cjs/toast/toast.d.ts +4 -2
- package/lib/cjs/toast/useToast/index.d.ts +1 -0
- package/lib/cjs/tooltip/index.d.ts +3 -1
- package/lib/cjs/transfer/index.d.ts +3 -3
- package/lib/cjs/transfer/index.js +2 -1
- package/lib/cjs/tree/index.d.ts +13 -11
- package/lib/cjs/tree/nodeList.d.ts +1 -1
- package/lib/cjs/tree/treeContext.d.ts +10 -10
- package/lib/cjs/tree/treeNode.d.ts +11 -9
- package/lib/cjs/tree/treeNode.js +2 -0
- package/lib/cjs/treeSelect/index.d.ts +7 -5
- package/lib/cjs/typography/copyable.d.ts +1 -1
- package/lib/cjs/upload/index.d.ts +2 -2
- package/lib/es/_base/baseComponent.d.ts +2 -1
- package/lib/es/_portal/index.d.ts +3 -1
- package/lib/es/anchor/index.d.ts +2 -1
- package/lib/es/anchor/link.d.ts +3 -2
- package/lib/es/autoComplete/index.d.ts +2 -2
- package/lib/es/avatar/avatarGroup.d.ts +1 -1
- package/lib/es/avatar/interface.d.ts +2 -2
- package/lib/es/backtop/index.d.ts +1 -0
- package/lib/es/badge/index.d.ts +4 -2
- package/lib/es/banner/index.d.ts +2 -1
- package/lib/es/breadcrumb/bread-context.d.ts +2 -2
- package/lib/es/breadcrumb/index.d.ts +2 -2
- package/lib/es/breadcrumb/item.d.ts +15 -3
- package/lib/es/button/Button.d.ts +2 -1
- package/lib/es/button/buttonGroup.d.ts +1 -0
- package/lib/es/calendar/timeCol.d.ts +1 -1
- package/lib/es/card/cardGroup.d.ts +1 -0
- package/lib/es/card/index.d.ts +2 -1
- package/lib/es/cascader/index.d.ts +5 -3
- package/lib/es/cascader/item.d.ts +3 -1
- package/lib/es/checkbox/checkbox.d.ts +5 -11
- package/lib/es/checkbox/checkbox.js +1 -1
- package/lib/es/checkbox/checkboxGroup.d.ts +1 -1
- package/lib/es/checkbox/checkboxInner.d.ts +1 -10
- package/lib/es/checkbox/context.d.ts +3 -3
- package/lib/es/collapse/index.d.ts +1 -0
- package/lib/es/collapse/item.d.ts +2 -0
- package/lib/es/collapsible/index.d.ts +1 -1
- package/lib/es/configProvider/index.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +3 -1
- package/lib/es/datePicker/insetInput.d.ts +1 -0
- package/lib/es/descriptions/index.d.ts +3 -2
- package/lib/es/descriptions/item.d.ts +4 -1
- package/lib/es/dropdown/context.d.ts +5 -3
- package/lib/es/dropdown/dropdownItem.d.ts +3 -3
- package/lib/es/dropdown/dropdownMenu.d.ts +1 -0
- package/lib/es/dropdown/dropdownTitle.d.ts +3 -3
- package/lib/es/dropdown/index.d.ts +3 -3
- package/lib/es/empty/index.d.ts +1 -1
- package/lib/es/form/arrayField.d.ts +1 -0
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/baseForm.js +1 -1
- package/lib/es/form/group.d.ts +3 -1
- package/lib/es/form/label.d.ts +1 -0
- package/lib/es/form/section.d.ts +1 -1
- package/lib/es/form/slot.js +2 -0
- package/lib/es/grid/col.d.ts +3 -3
- package/lib/es/grid/row.d.ts +4 -3
- package/lib/es/inputNumber/index.d.ts +1 -1
- package/lib/es/layout/Sider.d.ts +4 -1
- package/lib/es/layout/index.d.ts +2 -0
- package/lib/es/list/index.d.ts +1 -0
- package/lib/es/list/item.d.ts +5 -1
- package/lib/es/list/item.js +5 -1
- package/lib/es/modal/Modal.d.ts +1 -0
- package/lib/es/modal/ModalContent.d.ts +7 -2
- package/lib/es/modal/confirm.d.ts +5 -0
- package/lib/es/modal/useModal/index.d.ts +1 -0
- package/lib/es/navigation/Footer.d.ts +3 -5
- package/lib/es/navigation/Header.d.ts +3 -5
- package/lib/es/navigation/Item.d.ts +4 -6
- package/lib/es/navigation/OpenIconTransition.d.ts +2 -1
- package/lib/es/navigation/SubNav.d.ts +3 -5
- package/lib/es/navigation/SubNav.js +2 -2
- package/lib/es/navigation/SubNavTransition.d.ts +1 -1
- package/lib/es/navigation/nav-context.d.ts +21 -5
- package/lib/es/notification/NoticeTransition.d.ts +2 -2
- package/lib/es/notification/index.d.ts +3 -1
- package/lib/es/notification/notice.d.ts +3 -1
- package/lib/es/notification/useNotification/index.d.ts +1 -0
- package/lib/es/overflowList/intersectionObserver.d.ts +3 -2
- package/lib/es/pagination/index.d.ts +3 -1
- package/lib/es/pagination/index.js +15 -11
- package/lib/es/popconfirm/index.d.ts +4 -2
- package/lib/es/popover/index.d.ts +3 -1
- package/lib/es/radio/radio.d.ts +1 -0
- package/lib/es/radio/radioGroup.d.ts +1 -0
- package/lib/es/select/index.d.ts +3 -1
- package/lib/es/sideSheet/SideSheetContent.d.ts +1 -0
- package/lib/es/sideSheet/SideSheetTransition.d.ts +1 -1
- package/lib/es/sideSheet/index.d.ts +3 -1
- package/lib/es/table/Body/ExpandedRow.d.ts +3 -1
- package/lib/es/table/Body/SectionRow.d.ts +3 -1
- package/lib/es/table/Table.d.ts +5 -3
- package/lib/es/table/TableCell.d.ts +5 -3
- package/lib/es/table/TableHeaderRow.d.ts +3 -1
- package/lib/es/table/table-context.d.ts +7 -6
- package/lib/es/tabs/TabPane.d.ts +3 -1
- package/lib/es/tabs/interface.d.ts +2 -1
- package/lib/es/tag/group.d.ts +1 -1
- package/lib/es/timePicker/Combobox.d.ts +1 -0
- package/lib/es/timeline/index.d.ts +2 -1
- package/lib/es/timeline/item.d.ts +1 -0
- package/lib/es/toast/ToastTransition.d.ts +1 -1
- package/lib/es/toast/index.d.ts +8 -16
- package/lib/es/toast/toast.d.ts +4 -2
- package/lib/es/toast/useToast/index.d.ts +1 -0
- package/lib/es/tooltip/index.d.ts +3 -1
- package/lib/es/transfer/index.d.ts +3 -3
- package/lib/es/transfer/index.js +3 -1
- package/lib/es/tree/index.d.ts +13 -11
- package/lib/es/tree/nodeList.d.ts +1 -1
- package/lib/es/tree/treeContext.d.ts +10 -10
- package/lib/es/tree/treeNode.d.ts +11 -9
- package/lib/es/tree/treeNode.js +2 -0
- package/lib/es/treeSelect/index.d.ts +7 -5
- package/lib/es/typography/copyable.d.ts +1 -1
- package/lib/es/upload/index.d.ts +2 -2
- package/list/index.tsx +1 -0
- package/list/item.tsx +6 -1
- package/modal/Modal.tsx +1 -0
- package/modal/ModalContent.tsx +9 -3
- package/navigation/Footer.tsx +3 -1
- package/navigation/Header.tsx +3 -1
- package/navigation/Item.tsx +4 -3
- package/navigation/OpenIconTransition.tsx +2 -1
- package/navigation/SubNav.tsx +4 -3
- package/navigation/SubNavTransition.tsx +1 -1
- package/navigation/nav-context.ts +22 -1
- package/notification/NoticeTransition.tsx +1 -1
- package/notification/index.tsx +3 -1
- package/notification/notice.tsx +3 -1
- package/overflowList/intersectionObserver.tsx +2 -1
- package/package.json +10 -10
- package/pagination/index.tsx +4 -1
- package/popconfirm/index.tsx +3 -1
- package/popover/index.tsx +3 -1
- package/radio/radio.tsx +1 -0
- package/radio/radioGroup.tsx +1 -0
- package/select/index.tsx +2 -1
- package/select/utils.tsx +1 -1
- package/sideSheet/SideSheetContent.tsx +1 -0
- package/sideSheet/SideSheetTransition.tsx +1 -1
- package/sideSheet/index.tsx +3 -2
- package/slider/index.tsx +1 -1
- package/table/Body/ExpandedRow.tsx +3 -1
- package/table/Body/SectionRow.tsx +3 -1
- package/table/Body/index.tsx +3 -2
- package/table/Table.tsx +4 -3
- package/table/TableCell.tsx +6 -4
- package/table/TableHeaderRow.tsx +3 -1
- package/table/table-context.ts +10 -6
- package/tabs/TabPane.tsx +2 -0
- package/tabs/index.tsx +2 -2
- package/tabs/interface.ts +2 -1
- package/tag/group.tsx +5 -5
- package/timePicker/TimePicker.tsx +1 -1
- package/timeline/index.tsx +1 -0
- package/timeline/item.tsx +1 -0
- package/toast/ToastTransition.tsx +1 -1
- package/toast/toast.tsx +3 -1
- package/tooltip/index.tsx +2 -1
- package/transfer/index.tsx +3 -1
- package/tree/index.tsx +12 -11
- package/tree/treeContext.tsx +10 -10
- package/tree/treeNode.tsx +10 -7
- package/treeSelect/index.tsx +5 -4
- package/upload/_story/upload.stories.js +2 -3
- package/upload/index.tsx +1 -1
package/sideSheet/index.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import BaseComponent from '../_base/baseComponent';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import Portal from '../_portal';
|
|
6
6
|
import cls from 'classnames';
|
|
7
|
-
import ConfigContext from '../configProvider/context';
|
|
7
|
+
import ConfigContext, { ContextValue } from '../configProvider/context';
|
|
8
8
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/sideSheet/constants';
|
|
9
9
|
import SideSheetTransition from './SideSheetTransition';
|
|
10
10
|
import SideSheetContent from './SideSheetContent';
|
|
@@ -32,7 +32,6 @@ export interface SideSheetReactProps extends SideSheetProps {
|
|
|
32
32
|
footer?: React.ReactNode;
|
|
33
33
|
children?: React.ReactNode;
|
|
34
34
|
onCancel?: (e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
35
|
-
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
export {
|
|
@@ -93,6 +92,8 @@ export default class SideSheet extends BaseComponent<SideSheetReactProps, SideSh
|
|
|
93
92
|
this._active = false;
|
|
94
93
|
}
|
|
95
94
|
|
|
95
|
+
context: ContextValue;
|
|
96
|
+
|
|
96
97
|
get adapter(): SideSheetAdapter {
|
|
97
98
|
return {
|
|
98
99
|
...super.adapter,
|
package/slider/index.tsx
CHANGED
|
@@ -300,7 +300,7 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
|
|
|
300
300
|
const maxClass = cls(cssClasses.HANDLE, {
|
|
301
301
|
[`${cssClasses.HANDLE}-clicked`]: chooseMovePos === 'max' && isDrag,
|
|
302
302
|
});
|
|
303
|
-
const {min, max, currentValue} = this.state;
|
|
303
|
+
const { min, max, currentValue } = this.state;
|
|
304
304
|
|
|
305
305
|
const commonAria = {
|
|
306
306
|
'aria-label': ariaLabel,
|
|
@@ -7,7 +7,7 @@ import { get, set, isNull } from 'lodash';
|
|
|
7
7
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/table/constants';
|
|
8
8
|
import { arrayAdd, filterColumns } from '@douyinfe/semi-foundation/table/utils';
|
|
9
9
|
import Store from '@douyinfe/semi-foundation/utils/Store';
|
|
10
|
-
import TableContext from '../table-context';
|
|
10
|
+
import TableContext, { TableContextProps } from '../table-context';
|
|
11
11
|
import TableRow from './BaseRow';
|
|
12
12
|
import { amendTableWidth } from '../utils';
|
|
13
13
|
import { ColumnProps, ExpandIcon, TableComponents, Virtualized, Fixed } from '../interface';
|
|
@@ -68,6 +68,8 @@ export default class TableExpandedRow extends PureComponent<TableExpandedRowProp
|
|
|
68
68
|
prefixCls: cssClasses.PREFIX,
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
context: TableContextProps;
|
|
72
|
+
|
|
71
73
|
render() {
|
|
72
74
|
const {
|
|
73
75
|
record,
|
|
@@ -10,7 +10,7 @@ import Store from '@douyinfe/semi-foundation/utils/Store';
|
|
|
10
10
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/table/constants';
|
|
11
11
|
import { filterColumns } from '@douyinfe/semi-foundation/table/utils';
|
|
12
12
|
import BaseRow from './BaseRow';
|
|
13
|
-
import TableContext from '../table-context';
|
|
13
|
+
import TableContext, { TableContextProps } from '../table-context';
|
|
14
14
|
import {
|
|
15
15
|
ColumnProps,
|
|
16
16
|
RenderGroupSection,
|
|
@@ -79,6 +79,8 @@ class SectionRow extends PureComponent<SectionRowProps> {
|
|
|
79
79
|
},
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
+
context: TableContextProps;
|
|
83
|
+
|
|
82
84
|
onRow = (...args: any[]): OnRowReturnObject => {
|
|
83
85
|
const { onGroupedRow, clickGroupedRowToExpand, onExpand, groupKey, expanded } = this.props;
|
|
84
86
|
const rowProps: { onClick?: (e: React.MouseEvent) => void } = {};
|
package/table/Body/index.tsx
CHANGED
|
@@ -30,7 +30,7 @@ import ExpandedRow from './ExpandedRow';
|
|
|
30
30
|
import SectionRow from './SectionRow';
|
|
31
31
|
import TableHeader from '../TableHeader';
|
|
32
32
|
import ConfigContext from '../../configProvider/context';
|
|
33
|
-
import TableContext from '../table-context';
|
|
33
|
+
import TableContext, { TableContextProps } from '../table-context';
|
|
34
34
|
import {
|
|
35
35
|
ExpandedRowRender,
|
|
36
36
|
Virtualized,
|
|
@@ -132,6 +132,7 @@ class Body extends BaseComponent<BodyProps, BodyState> {
|
|
|
132
132
|
foundation: BodyFoundation;
|
|
133
133
|
cellWidths: number[];
|
|
134
134
|
flattenedColumns: ColumnProps[];
|
|
135
|
+
context: TableContextProps;
|
|
135
136
|
constructor(props: BodyProps, context: BodyContext) {
|
|
136
137
|
super(props);
|
|
137
138
|
this.ref = React.createRef();
|
|
@@ -271,7 +272,7 @@ class Body extends BaseComponent<BodyProps, BodyState> {
|
|
|
271
272
|
|
|
272
273
|
itemKey = (index: number, data: Array<FlattenData | GroupFlattenData>) => get(data, [index, 'key'], index);
|
|
273
274
|
|
|
274
|
-
handleRowClick = (rowKey: RowKey<any>, e: React.MouseEvent
|
|
275
|
+
handleRowClick = (rowKey: RowKey<any>, e: React.MouseEvent<HTMLElement>, expand: boolean) => {
|
|
275
276
|
const { handleRowExpanded } = this.context;
|
|
276
277
|
handleRowExpanded(!expand, rowKey, e);
|
|
277
278
|
};
|
package/table/Table.tsx
CHANGED
|
@@ -353,6 +353,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
353
353
|
scrollPosition!: BodyScrollPosition;
|
|
354
354
|
position!: BodyScrollPosition;
|
|
355
355
|
foundation: TableFoundation<RecordType>;
|
|
356
|
+
context: TableContextProps;
|
|
356
357
|
constructor(props: NormalTableProps<RecordType>, context: TableContextProps) {
|
|
357
358
|
super(props);
|
|
358
359
|
this.foundation = new TableFoundation<RecordType>(this.adapter);
|
|
@@ -789,7 +790,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
789
790
|
}
|
|
790
791
|
};
|
|
791
792
|
|
|
792
|
-
renderSelection = (record
|
|
793
|
+
renderSelection = (record = {} as any, inHeader = false): React.ReactNode => {
|
|
793
794
|
const { rowSelection, disabledRowKeysSet } = this.state;
|
|
794
795
|
|
|
795
796
|
if (rowSelection && typeof rowSelection === 'object') {
|
|
@@ -1005,7 +1006,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
1005
1006
|
);
|
|
1006
1007
|
};
|
|
1007
1008
|
|
|
1008
|
-
renderTitle = (props: { title?: ReactNode; prefixCls?: string; dataSource?: any[] } = {}) => {
|
|
1009
|
+
renderTitle = (props: { title?: ReactNode | ((dataSource?: RecordType[]) => ReactNode); prefixCls?: string; dataSource?: any[] } = {}) => {
|
|
1009
1010
|
let { title } = props;
|
|
1010
1011
|
const { prefixCls, dataSource } = props;
|
|
1011
1012
|
|
|
@@ -1038,7 +1039,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
1038
1039
|
);
|
|
1039
1040
|
};
|
|
1040
1041
|
|
|
1041
|
-
renderFooter = (props: { footer?: ReactNode; prefixCls?: string; dataSource?: RecordType[] } = {}) => {
|
|
1042
|
+
renderFooter = (props: { footer?: ReactNode | ((dataSource?: RecordType[]) => ReactNode); prefixCls?: string; dataSource?: RecordType[] } = {}) => {
|
|
1042
1043
|
let { footer } = props;
|
|
1043
1044
|
const { prefixCls, dataSource } = props;
|
|
1044
1045
|
|
package/table/TableCell.tsx
CHANGED
|
@@ -10,9 +10,9 @@ import TableCellFoundation, { TableCellAdapter } from '@douyinfe/semi-foundation
|
|
|
10
10
|
import { isSelectionColumn, isExpandedColumn } from '@douyinfe/semi-foundation/table/utils';
|
|
11
11
|
|
|
12
12
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
13
|
-
import Context from './table-context';
|
|
13
|
+
import Context, { TableContextProps } from './table-context';
|
|
14
14
|
import { amendTableWidth } from './utils';
|
|
15
|
-
import { Align, ColumnProps } from './interface';
|
|
15
|
+
import { Align, ColumnProps, ExpandIcon } from './interface';
|
|
16
16
|
|
|
17
17
|
export interface TableCellProps extends BaseProps {
|
|
18
18
|
record?: Record<string, any>;
|
|
@@ -30,7 +30,7 @@ export interface TableCellProps extends BaseProps {
|
|
|
30
30
|
* When hideExpandedColumn is true or isSection is true
|
|
31
31
|
* expandIcon is a custom icon or true
|
|
32
32
|
*/
|
|
33
|
-
expandIcon?:
|
|
33
|
+
expandIcon?: ExpandIcon;
|
|
34
34
|
renderExpandIcon?: (record: Record<string, any>) => ReactNode;
|
|
35
35
|
hideExpandedColumn?: boolean;
|
|
36
36
|
component?: any;
|
|
@@ -100,6 +100,8 @@ export default class TableCell extends BaseComponent<TableCellProps, Record<stri
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
ref: React.MutableRefObject<any>;
|
|
103
|
+
context: TableContextProps;
|
|
104
|
+
|
|
103
105
|
constructor(props: TableCellProps) {
|
|
104
106
|
super(props);
|
|
105
107
|
this.ref = createRef();
|
|
@@ -242,7 +244,7 @@ export default class TableCell extends BaseComponent<TableCellProps, Record<stri
|
|
|
242
244
|
) : null;
|
|
243
245
|
|
|
244
246
|
// column.render
|
|
245
|
-
const realExpandIcon = typeof renderExpandIcon === 'function' ? renderExpandIcon(record) : expandIcon;
|
|
247
|
+
const realExpandIcon = (typeof renderExpandIcon === 'function' ? renderExpandIcon(record) : expandIcon) as React.ReactNode;
|
|
246
248
|
if (render) {
|
|
247
249
|
const renderOptions = {
|
|
248
250
|
expandIcon: realExpandIcon,
|
package/table/TableHeaderRow.tsx
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
sliceColumnsByLevel
|
|
15
15
|
} from '@douyinfe/semi-foundation/table/utils';
|
|
16
16
|
import BaseComponent from '../_base/baseComponent';
|
|
17
|
-
import TableContext from './table-context';
|
|
17
|
+
import TableContext, { TableContextProps } from './table-context';
|
|
18
18
|
import { TableComponents, OnHeaderRow, Fixed } from './interface';
|
|
19
19
|
|
|
20
20
|
export interface TableHeaderRowProps {
|
|
@@ -64,6 +64,8 @@ export default class TableHeaderRow extends BaseComponent<TableHeaderRowProps, R
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
headerNode: HTMLElement;
|
|
67
|
+
context: TableContextProps;
|
|
68
|
+
|
|
67
69
|
constructor(props: TableHeaderRowProps) {
|
|
68
70
|
super(props);
|
|
69
71
|
this.headerNode = null;
|
package/table/table-context.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
/* eslint-disable max-len */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { noop } from 'lodash';
|
|
4
|
-
import { ColumnProps, GetVirtualizedListRef } from './interface';
|
|
4
|
+
import { ColumnProps, GetVirtualizedListRef, RowKey } from './interface';
|
|
5
|
+
import {
|
|
6
|
+
BaseRowKeyType,
|
|
7
|
+
BaseHeadWidth,
|
|
8
|
+
} from '@douyinfe/semi-foundation/table/foundation';
|
|
5
9
|
|
|
6
10
|
export interface TableContextProps {
|
|
7
11
|
children?: React.ReactNode;
|
|
8
12
|
anyColumnFixed?: boolean;
|
|
9
13
|
flattenedColumns?: ColumnProps[];
|
|
10
|
-
tableWidth?: number
|
|
11
|
-
headWidths?:
|
|
12
|
-
setHeadWidths?: (headWidth?:
|
|
14
|
+
tableWidth?: number;
|
|
15
|
+
headWidths?: BaseHeadWidth[][];
|
|
16
|
+
setHeadWidths?: (headWidth?: BaseHeadWidth[], index?: number) => void;
|
|
13
17
|
getHeadWidths?: (index?: number) => number[];
|
|
14
18
|
getCellWidths?: (flattenColumns: ColumnProps[], flattenedWidths?: number[], ignoreScrollBarKey?: boolean) => number[];
|
|
15
|
-
handleRowExpanded?: (expanded: boolean, realKey:
|
|
19
|
+
handleRowExpanded?: (expanded: boolean, realKey: RowKey<any>, domEvent: React.MouseEvent<HTMLElement>) => void;
|
|
16
20
|
renderExpandIcon?: (record: Record<string, any>, isNested?: boolean, groupKey?: string | number) => React.ReactNode;
|
|
17
|
-
renderSelection?: (record
|
|
21
|
+
renderSelection?: (record?: Record<string, any>, isHeader?: boolean) => React.ReactNode;
|
|
18
22
|
getVirtualizedListRef?: GetVirtualizedListRef;
|
|
19
23
|
setBodyHasScrollbar?: (bodyHasScrollBar: boolean) => void;
|
|
20
24
|
}
|
package/tabs/TabPane.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import cls from 'classnames';
|
|
|
4
4
|
import { cssClasses } from '@douyinfe/semi-foundation/tabs/constants';
|
|
5
5
|
import getDataAttr from '@douyinfe/semi-foundation/utils/getDataAttr';
|
|
6
6
|
import TabsContext from './tabs-context';
|
|
7
|
+
import { TabContextValue } from './interface';
|
|
7
8
|
import TabPaneTransition from './TabPaneTransition';
|
|
8
9
|
import { PlainTab, TabPaneProps } from './interface';
|
|
9
10
|
|
|
@@ -27,6 +28,7 @@ class TabPane extends PureComponent<TabPaneProps> {
|
|
|
27
28
|
ref = createRef<HTMLDivElement>();
|
|
28
29
|
isAnimating: boolean;
|
|
29
30
|
_active: boolean;
|
|
31
|
+
context: TabContextValue;
|
|
30
32
|
|
|
31
33
|
componentDidMount(): void {
|
|
32
34
|
this.lastActiveKey = this.context.activeKey;
|
package/tabs/index.tsx
CHANGED
|
@@ -119,9 +119,9 @@ class Tabs extends BaseComponent<TabsProps, TabsState> {
|
|
|
119
119
|
}
|
|
120
120
|
if (panes.findIndex(p => p.itemKey === activeKey) === -1){
|
|
121
121
|
if (panes.length>0){
|
|
122
|
-
this.setState({activeKey: panes[0].itemKey});
|
|
122
|
+
this.setState({ activeKey: panes[0].itemKey });
|
|
123
123
|
} else {
|
|
124
|
-
this.setState({activeKey: ''});
|
|
124
|
+
this.setState({ activeKey: '' });
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
package/tabs/interface.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentType, CSSProperties, MouseEvent, ReactNode } from 'react';
|
|
1
|
+
import React, { ComponentType, CSSProperties, MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import { Motion } from '../_base/base';
|
|
3
3
|
|
|
4
4
|
export type TabType = 'line' | 'card' | 'button';
|
|
@@ -57,6 +57,7 @@ export interface TabBarProps {
|
|
|
57
57
|
|
|
58
58
|
export interface TabPaneProps {
|
|
59
59
|
className?: string;
|
|
60
|
+
children?: React.ReactNode | undefined;
|
|
60
61
|
disabled?: boolean;
|
|
61
62
|
icon?: ReactNode;
|
|
62
63
|
itemKey?: string;
|
package/tag/group.tsx
CHANGED
|
@@ -45,7 +45,7 @@ export default class TagGroup extends PureComponent<TagGroupProps> {
|
|
|
45
45
|
avatarShape: PropTypes.oneOf(avatarShapeSet),
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
renderNTag(n: number, restTags:
|
|
48
|
+
renderNTag(n: number, restTags: React.ReactNode) {
|
|
49
49
|
const { size, showPopover, popoverProps } = this.props;
|
|
50
50
|
let nTag = (
|
|
51
51
|
<Tag
|
|
@@ -84,7 +84,7 @@ export default class TagGroup extends PureComponent<TagGroupProps> {
|
|
|
84
84
|
let renderTags: (Tag | React.ReactNode)[] = tags;
|
|
85
85
|
|
|
86
86
|
const normalTags: (Tag | React.ReactNode)[] = tags.slice(0, maxTagCount);
|
|
87
|
-
const restTags = tags.slice(maxTagCount);
|
|
87
|
+
const restTags = tags.slice(maxTagCount) as React.ReactNode;
|
|
88
88
|
let nTag = null;
|
|
89
89
|
if (n > 0) {
|
|
90
90
|
nTag = this.renderNTag(n, restTags);
|
|
@@ -96,9 +96,9 @@ export default class TagGroup extends PureComponent<TagGroupProps> {
|
|
|
96
96
|
|
|
97
97
|
renderAllTags() {
|
|
98
98
|
const { tagList, size, mode, avatarShape } = this.props;
|
|
99
|
-
const renderTags
|
|
99
|
+
const renderTags = tagList.map((tag, index): (Tag | React.ReactNode) => {
|
|
100
100
|
if (mode === 'custom') {
|
|
101
|
-
return tag;
|
|
101
|
+
return tag as React.ReactNode;
|
|
102
102
|
}
|
|
103
103
|
if (!(tag as TagProps).size) {
|
|
104
104
|
(tag as TagProps).size = size;
|
|
@@ -122,7 +122,7 @@ export default class TagGroup extends PureComponent<TagGroupProps> {
|
|
|
122
122
|
}, className);
|
|
123
123
|
|
|
124
124
|
const tags = this.renderAllTags();
|
|
125
|
-
const tagContents = typeof maxTagCount === 'undefined' ? tags : this.renderMergeTags(tags);
|
|
125
|
+
const tagContents = (typeof maxTagCount === 'undefined' ? tags : this.renderMergeTags(tags)) as React.ReactNode;
|
|
126
126
|
|
|
127
127
|
return (
|
|
128
128
|
<div style={style} className={groupCls}>
|
|
@@ -323,7 +323,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
323
323
|
index,
|
|
324
324
|
isNullOrUndefined(panelHeader) ? get(defaultHeaderMap, index, null) : panelHeader
|
|
325
325
|
);
|
|
326
|
-
panelProps.panelFooter = get(panels, index, panelFooter);
|
|
326
|
+
panelProps.panelFooter = get(panels, index, panelFooter) as React.ReactNode;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
return panelProps;
|
package/timeline/index.tsx
CHANGED
package/timeline/item.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import '@douyinfe/semi-foundation/timeline/timeline.scss';
|
|
|
7
7
|
|
|
8
8
|
export interface TimelineItemProps {
|
|
9
9
|
color?: string;
|
|
10
|
+
children?: React.ReactNode | undefined;
|
|
10
11
|
time?: React.ReactNode;
|
|
11
12
|
type?: 'default' | 'ongoing' | 'success' | 'warning' | 'error';
|
|
12
13
|
dot?: React.ReactNode;
|
|
@@ -6,7 +6,7 @@ import React, { CSSProperties } from 'react';
|
|
|
6
6
|
|
|
7
7
|
export interface ToastTransitionProps{
|
|
8
8
|
motion?: Motion<ToastTransitionProps>;
|
|
9
|
-
children?: React.
|
|
9
|
+
children?: React.ReactNode | ((TransitionProps: any) => any)
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
|
package/toast/toast.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { CSSProperties } from 'react';
|
|
3
3
|
import cls from 'classnames';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import ConfigContext from '../configProvider/context';
|
|
5
|
+
import ConfigContext, { ContextValue } from '../configProvider/context';
|
|
6
6
|
import ToastFoundation, { ToastAdapter, ToastState, ToastProps } from '@douyinfe/semi-foundation/toast/toastFoundation';
|
|
7
7
|
import { numbers, cssClasses, strings } from '@douyinfe/semi-foundation/toast/constants';
|
|
8
8
|
import BaseComponent from '../_base/baseComponent';
|
|
@@ -52,6 +52,8 @@ class Toast extends BaseComponent<ToastReactProps, ToastState> {
|
|
|
52
52
|
this.foundation = new ToastFoundation(this.adapter);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
context: ContextValue;
|
|
56
|
+
|
|
55
57
|
get adapter(): ToastAdapter {
|
|
56
58
|
return {
|
|
57
59
|
...super.adapter,
|
package/tooltip/index.tsx
CHANGED
|
@@ -19,7 +19,7 @@ import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
|
19
19
|
import { isHTMLElement } from '../_base/reactUtils';
|
|
20
20
|
import { getActiveElement, getFocusableElements, stopPropagation } from '../_utils';
|
|
21
21
|
import Portal from '../_portal/index';
|
|
22
|
-
import ConfigContext from '../configProvider/context';
|
|
22
|
+
import ConfigContext, { ContextValue } from '../configProvider/context';
|
|
23
23
|
import TriangleArrow from './TriangleArrow';
|
|
24
24
|
import TriangleArrowVertical from './TriangleArrowVertical';
|
|
25
25
|
import TooltipTransition from './TooltipStyledTransition';
|
|
@@ -173,6 +173,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
173
173
|
getPopupContainer: () => HTMLElement;
|
|
174
174
|
containerPosition: string;
|
|
175
175
|
foundation: TooltipFoundation;
|
|
176
|
+
context: ContextValue;
|
|
176
177
|
|
|
177
178
|
constructor(props: TooltipProps) {
|
|
178
179
|
super(props);
|
package/transfer/index.tsx
CHANGED
|
@@ -558,18 +558,20 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
|
|
|
558
558
|
renderRightSortableList(selectedData: Array<ResolvedDataItem>) {
|
|
559
559
|
// when choose some items && draggable is true
|
|
560
560
|
const SortableItem = SortableElement((
|
|
561
|
-
(item: ResolvedDataItem) => this.renderRightItem(item)) as React.
|
|
561
|
+
(item: ResolvedDataItem) => this.renderRightItem(item)) as React.FC<ResolvedDataItem>
|
|
562
562
|
);
|
|
563
563
|
const SortableList = SortableContainer(({ items }: { items: Array<ResolvedDataItem> }) => (
|
|
564
564
|
<div className={`${prefixcls}-right-list`} role="list" aria-label="Selected list">
|
|
565
565
|
{items.map((item, index: number) => (
|
|
566
566
|
// sortableElement will take over the property 'key', so use another '_optionKey' to pass
|
|
567
|
+
// @ts-ignore skip SortableItem type check
|
|
567
568
|
<SortableItem key={item.label} index={index} {...item} _optionKey={item.key} />
|
|
568
569
|
))}
|
|
569
570
|
</div>
|
|
570
571
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
571
572
|
// @ts-ignore see reasons: https://github.com/clauderic/react-sortable-hoc/issues/206
|
|
572
573
|
), { distance: 10 });
|
|
574
|
+
// @ts-ignore skip SortableItem type check
|
|
573
575
|
const sortList = <SortableList useDragHandle onSortEnd={this.onSortEnd} items={selectedData} />;
|
|
574
576
|
return sortList;
|
|
575
577
|
}
|
package/tree/index.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable max-lines-per-function */
|
|
2
|
-
import React, { MouseEvent } from 'react';
|
|
2
|
+
import React, { MouseEvent, KeyboardEvent } from 'react';
|
|
3
3
|
import cls from 'classnames';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import ConfigContext from '../configProvider/context';
|
|
5
|
+
import ConfigContext, { ContextValue } from '../configProvider/context';
|
|
6
6
|
import TreeFoundation, { TreeAdapter } from '@douyinfe/semi-foundation/tree/foundation';
|
|
7
7
|
import {
|
|
8
8
|
convertDataToEntities,
|
|
@@ -143,6 +143,7 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
143
143
|
dragNode: any;
|
|
144
144
|
onNodeClick: any;
|
|
145
145
|
onMotionEnd: any;
|
|
146
|
+
context: ContextValue;
|
|
146
147
|
|
|
147
148
|
constructor(props: TreeProps) {
|
|
148
149
|
super(props);
|
|
@@ -545,7 +546,7 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
545
546
|
}
|
|
546
547
|
};
|
|
547
548
|
|
|
548
|
-
onNodeSelect = (e: MouseEvent, treeNode: TreeNodeProps) => {
|
|
549
|
+
onNodeSelect = (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => {
|
|
549
550
|
this.foundation.handleNodeSelect(e, treeNode);
|
|
550
551
|
};
|
|
551
552
|
|
|
@@ -558,11 +559,11 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
558
559
|
})
|
|
559
560
|
);
|
|
560
561
|
|
|
561
|
-
onNodeCheck = (e: MouseEvent, treeNode: TreeNodeProps) => {
|
|
562
|
+
onNodeCheck = (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => {
|
|
562
563
|
this.foundation.handleNodeSelect(e, treeNode);
|
|
563
564
|
};
|
|
564
565
|
|
|
565
|
-
onNodeExpand = (e: MouseEvent, treeNode: TreeNodeProps) => {
|
|
566
|
+
onNodeExpand = (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => {
|
|
566
567
|
this.foundation.handleNodeExpand(e, treeNode);
|
|
567
568
|
};
|
|
568
569
|
|
|
@@ -574,27 +575,27 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
574
575
|
this.foundation.handleNodeDoubleClick(e, treeNode);
|
|
575
576
|
};
|
|
576
577
|
|
|
577
|
-
onNodeDragStart = (e: React.DragEvent<
|
|
578
|
+
onNodeDragStart = (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => {
|
|
578
579
|
this.foundation.handleNodeDragStart(e, treeNode);
|
|
579
580
|
};
|
|
580
581
|
|
|
581
|
-
onNodeDragEnter = (e: React.DragEvent<
|
|
582
|
+
onNodeDragEnter = (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => {
|
|
582
583
|
this.foundation.handleNodeDragEnter(e, treeNode, this.dragNode);
|
|
583
584
|
};
|
|
584
585
|
|
|
585
|
-
onNodeDragOver = (e: React.DragEvent<
|
|
586
|
+
onNodeDragOver = (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => {
|
|
586
587
|
this.foundation.handleNodeDragOver(e, treeNode, this.dragNode);
|
|
587
588
|
};
|
|
588
589
|
|
|
589
|
-
onNodeDragLeave = (e: React.DragEvent<
|
|
590
|
+
onNodeDragLeave = (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => {
|
|
590
591
|
this.foundation.handleNodeDragLeave(e, treeNode);
|
|
591
592
|
};
|
|
592
593
|
|
|
593
|
-
onNodeDragEnd = (e: React.DragEvent<
|
|
594
|
+
onNodeDragEnd = (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => {
|
|
594
595
|
this.foundation.handleNodeDragEnd(e, treeNode);
|
|
595
596
|
};
|
|
596
597
|
|
|
597
|
-
onNodeDrop = (e: React.DragEvent<
|
|
598
|
+
onNodeDrop = (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => {
|
|
598
599
|
this.foundation.handleNodeDrop(e, treeNode, this.dragNode);
|
|
599
600
|
};
|
|
600
601
|
|
package/tree/treeContext.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ReactNode, MouseEvent, DragEvent } from 'react';
|
|
1
|
+
import React, { ReactNode, MouseEvent, DragEvent, KeyboardEvent } from 'react';
|
|
2
2
|
import { Virtualize, ExpandAction } from '@douyinfe/semi-foundation/tree/foundation';
|
|
3
3
|
import {
|
|
4
4
|
TreeNodeData,
|
|
@@ -17,18 +17,18 @@ export interface TreeContextValue {
|
|
|
17
17
|
filterTreeNode?: boolean | ((inputValue: string, treeNodeString: string) => void);
|
|
18
18
|
keyEntities?: KeyEntities;
|
|
19
19
|
onNodeClick?: any;
|
|
20
|
-
onNodeExpand?: (e: MouseEvent, treeNode: TreeNodeProps) => void;
|
|
21
|
-
onNodeSelect?: (e: MouseEvent, treeNode: TreeNodeProps) => void;
|
|
22
|
-
onNodeCheck?: (e: MouseEvent, treeNode: TreeNodeProps) => void;
|
|
20
|
+
onNodeExpand?: (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => void;
|
|
21
|
+
onNodeSelect?: (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => void;
|
|
22
|
+
onNodeCheck?: (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => void;
|
|
23
23
|
onNodeRightClick?: (e: MouseEvent, treeNode: TreeNodeProps) => void;
|
|
24
24
|
onNodeDoubleClick?: (e: MouseEvent, treeNode: TreeNodeProps) => void;
|
|
25
25
|
renderTreeNode?: (treeNode: FlattenNode, ind?: number, style?: React.CSSProperties) => ReactNode;
|
|
26
|
-
onNodeDragStart?: (e: DragEvent<
|
|
27
|
-
onNodeDragEnter?: (e: DragEvent<
|
|
28
|
-
onNodeDragOver?: (e: DragEvent<
|
|
29
|
-
onNodeDragLeave?: (e: DragEvent<
|
|
30
|
-
onNodeDragEnd?: (e: DragEvent<
|
|
31
|
-
onNodeDrop?: (e: DragEvent<
|
|
26
|
+
onNodeDragStart?: (e: DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void;
|
|
27
|
+
onNodeDragEnter?: (e: DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void;
|
|
28
|
+
onNodeDragOver?: (e: DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void;
|
|
29
|
+
onNodeDragLeave?: (e: DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void;
|
|
30
|
+
onNodeDragEnd?: (e: DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void;
|
|
31
|
+
onNodeDrop?: (e: DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void;
|
|
32
32
|
expandAction?: ExpandAction;
|
|
33
33
|
directory?: boolean;
|
|
34
34
|
multiple?: boolean;
|
package/tree/treeNode.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import isEnterPress from '@douyinfe/semi-foundation/utils/isEnterPress';
|
|
|
6
6
|
import { debounce, isFunction, isString, get, isEmpty } from 'lodash';
|
|
7
7
|
import { IconTreeTriangleDown, IconFile, IconFolder, IconFolderOpen } from '@douyinfe/semi-icons';
|
|
8
8
|
import { Checkbox } from '../checkbox';
|
|
9
|
-
import TreeContext from './treeContext';
|
|
9
|
+
import TreeContext, { TreeContextValue } from './treeContext';
|
|
10
10
|
import Spin from '../spin';
|
|
11
11
|
import { TreeNodeProps, TreeNodeState } from './interface';
|
|
12
12
|
|
|
@@ -42,6 +42,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
42
42
|
|
|
43
43
|
debounceSelect: any;
|
|
44
44
|
refNode: HTMLElement;
|
|
45
|
+
context: TreeContextValue;
|
|
45
46
|
|
|
46
47
|
constructor(props: TreeNodeProps) {
|
|
47
48
|
super(props);
|
|
@@ -121,7 +122,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
121
122
|
}
|
|
122
123
|
};
|
|
123
124
|
|
|
124
|
-
onDragStart = (e: React.DragEvent) => {
|
|
125
|
+
onDragStart = (e: React.DragEvent<HTMLLIElement>) => {
|
|
125
126
|
const { onNodeDragStart } = this.context;
|
|
126
127
|
e.stopPropagation();
|
|
127
128
|
onNodeDragStart(e, { ...this.props, nodeInstance: this.refNode });
|
|
@@ -135,33 +136,33 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
135
136
|
}
|
|
136
137
|
};
|
|
137
138
|
|
|
138
|
-
onDragEnter = (e: React.DragEvent) => {
|
|
139
|
+
onDragEnter = (e: React.DragEvent<HTMLLIElement>) => {
|
|
139
140
|
const { onNodeDragEnter } = this.context;
|
|
140
141
|
e.preventDefault();
|
|
141
142
|
e.stopPropagation();
|
|
142
143
|
onNodeDragEnter(e, { ...this.props, nodeInstance: this.refNode });
|
|
143
144
|
};
|
|
144
145
|
|
|
145
|
-
onDragOver = (e: React.DragEvent) => {
|
|
146
|
+
onDragOver = (e: React.DragEvent<HTMLLIElement>) => {
|
|
146
147
|
const { onNodeDragOver } = this.context;
|
|
147
148
|
e.preventDefault();
|
|
148
149
|
e.stopPropagation();
|
|
149
150
|
onNodeDragOver(e, { ...this.props, nodeInstance: this.refNode });
|
|
150
151
|
};
|
|
151
152
|
|
|
152
|
-
onDragLeave = (e: React.DragEvent) => {
|
|
153
|
+
onDragLeave = (e: React.DragEvent<HTMLLIElement>) => {
|
|
153
154
|
const { onNodeDragLeave } = this.context;
|
|
154
155
|
e.stopPropagation();
|
|
155
156
|
onNodeDragLeave(e, { ...this.props, nodeInstance: this.refNode });
|
|
156
157
|
};
|
|
157
158
|
|
|
158
|
-
onDragEnd = (e: React.DragEvent) => {
|
|
159
|
+
onDragEnd = (e: React.DragEvent<HTMLLIElement>) => {
|
|
159
160
|
const { onNodeDragEnd } = this.context;
|
|
160
161
|
e.stopPropagation();
|
|
161
162
|
onNodeDragEnd(e, { ...this.props, nodeInstance: this.refNode });
|
|
162
163
|
};
|
|
163
164
|
|
|
164
|
-
onDrop = (e: React.DragEvent) => {
|
|
165
|
+
onDrop = (e: React.DragEvent<HTMLLIElement>) => {
|
|
165
166
|
const { onNodeDrop } = this.context;
|
|
166
167
|
e.preventDefault();
|
|
167
168
|
e.stopPropagation();
|
|
@@ -387,6 +388,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
387
388
|
if (renderFullLabel) {
|
|
388
389
|
const customLabel = renderFullLabel({ ...labelProps });
|
|
389
390
|
if (draggable) {
|
|
391
|
+
// @ts-ignore skip cloneElement type check
|
|
390
392
|
return React.cloneElement(customLabel, {
|
|
391
393
|
ref: this.setRef,
|
|
392
394
|
...dragProps
|
|
@@ -396,6 +398,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
396
398
|
return customLabel;
|
|
397
399
|
} else {
|
|
398
400
|
// In virtualization, props.style will contain location information
|
|
401
|
+
// @ts-ignore skip cloneElement type check
|
|
399
402
|
return React.cloneElement(customLabel, {
|
|
400
403
|
style: { ...get(customLabel, ['props', 'style']), ...style }
|
|
401
404
|
});
|
package/treeSelect/index.tsx
CHANGED
|
@@ -32,7 +32,7 @@ import { FixedSizeList as VirtualList, ListItemKeySelector } from 'react-window'
|
|
|
32
32
|
import '@douyinfe/semi-foundation/tree/tree.scss';
|
|
33
33
|
import '@douyinfe/semi-foundation/treeSelect/treeSelect.scss';
|
|
34
34
|
import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
|
|
35
|
-
import ConfigContext from '../configProvider/context';
|
|
35
|
+
import ConfigContext, { ContextValue } from '../configProvider/context';
|
|
36
36
|
import TagGroup from '../tag/group';
|
|
37
37
|
import Tag, { TagProps } from '../tag/index';
|
|
38
38
|
import Input, { InputProps } from '../input/index';
|
|
@@ -294,6 +294,7 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
|
294
294
|
onNodeDoubleClick: any;
|
|
295
295
|
onMotionEnd: any;
|
|
296
296
|
treeSelectID: string;
|
|
297
|
+
context: ContextValue;
|
|
297
298
|
|
|
298
299
|
constructor(props: TreeSelectProps) {
|
|
299
300
|
super(props);
|
|
@@ -1177,15 +1178,15 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
|
1177
1178
|
|
|
1178
1179
|
onNodeLoad = (data: TreeNodeData) => new Promise(resolve => this.foundation.setLoadKeys(data, resolve));
|
|
1179
1180
|
|
|
1180
|
-
onNodeSelect = (e: React.MouseEvent, treeNode: TreeNodeProps) => {
|
|
1181
|
+
onNodeSelect = (e: React.MouseEvent | React.KeyboardEvent, treeNode: TreeNodeProps) => {
|
|
1181
1182
|
this.foundation.handleNodeSelect(e, treeNode);
|
|
1182
1183
|
};
|
|
1183
1184
|
|
|
1184
|
-
onNodeCheck = (e: React.MouseEvent, treeNode: TreeNodeProps) => {
|
|
1185
|
+
onNodeCheck = (e: React.MouseEvent | React.KeyboardEvent, treeNode: TreeNodeProps) => {
|
|
1185
1186
|
this.foundation.handleNodeSelect(e, treeNode);
|
|
1186
1187
|
};
|
|
1187
1188
|
|
|
1188
|
-
onNodeExpand = (e: React.MouseEvent, treeNode: TreeNodeProps) => {
|
|
1189
|
+
onNodeExpand = (e: React.MouseEvent | React.KeyboardEvent, treeNode: TreeNodeProps) => {
|
|
1189
1190
|
this.foundation.handleNodeExpand(e, treeNode);
|
|
1190
1191
|
};
|
|
1191
1192
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/* argus-disable unPkgSensitiveInfo */
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import FileCard from '../fileCard';
|
|
4
|
+
import { Button, Upload, Toast, Icon } from '@douyinfe/semi-ui/index';
|
|
4
5
|
import { withField, Form } from '../../form/index';
|
|
5
6
|
import { IconPlus, IconFile, IconUpload, IconEyeOpened, IconDownload, IconDelete } from '@douyinfe/semi-icons';
|
|
6
7
|
|
|
7
|
-
import FileCard from '../fileCard';
|
|
8
|
-
|
|
9
8
|
export default {
|
|
10
9
|
title: 'Upload'
|
|
11
10
|
}
|