@douyinfe/semi-ui 2.9.0-beta.0 → 2.9.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/baseComponent.tsx +2 -1
- package/_portal/index.tsx +2 -1
- package/anchor/__test__/anchor.test.js +1 -0
- package/anchor/_story/anchor.stories.js +23 -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/_story/badge.stories.js +34 -2
- 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/_story/cascader.stories.js +17 -2
- package/cascader/index.tsx +4 -3
- package/cascader/item.tsx +3 -1
- package/checkbox/_story/checkbox.stories.js +1 -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 +5 -0
- package/collapsible/index.tsx +2 -2
- package/configProvider/context.tsx +1 -1
- package/datePicker/_story/datePicker.stories.js +37 -0
- package/datePicker/datePicker.tsx +2 -1
- package/descriptions/index.tsx +2 -1
- package/descriptions/item.tsx +4 -1
- package/dist/css/semi.css +2 -2
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +7560 -3681
- 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 +9 -6
- 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/input/__test__/input.test.js +12 -3
- package/input/__test__/textArea.test.js +53 -0
- 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/button/index.d.ts +1 -1
- 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/index.js +1 -1
- 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/collapse/item.js +4 -2
- 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 +4 -3
- 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 +2 -2
- package/lib/cjs/form/baseForm.js +1 -1
- package/lib/cjs/form/errorMessage.d.ts +1 -1
- package/lib/cjs/form/group.d.ts +3 -1
- package/lib/cjs/form/hoc/withField.js +6 -4
- 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/iconButton/index.d.ts +1 -1
- 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/Modal.js +3 -0
- package/lib/cjs/modal/ModalContent.d.ts +7 -2
- package/lib/cjs/modal/confirm.d.ts +10 -5
- 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 +4 -6
- 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/index.d.ts +2 -2
- 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 +4 -2
- package/lib/cjs/progress/index.d.ts +1 -1
- package/lib/cjs/radio/radio.d.ts +1 -0
- package/lib/cjs/radio/radioGroup.d.ts +1 -0
- package/lib/cjs/scrollList/scrollItem.js +5 -1
- package/lib/cjs/select/index.d.ts +3 -1
- package/lib/cjs/select/optionGroup.d.ts +1 -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/BaseRow.d.ts +1 -1
- package/lib/cjs/table/Body/ExpandedRow.d.ts +4 -2
- package/lib/cjs/table/Body/SectionRow.d.ts +3 -1
- package/lib/cjs/table/Column.d.ts +1 -1
- package/lib/cjs/table/ColumnShape.d.ts +1 -1
- package/lib/cjs/table/CustomExpandIcon.d.ts +1 -1
- package/lib/cjs/table/Table.d.ts +10 -8
- package/lib/cjs/table/TableCell.d.ts +5 -3
- package/lib/cjs/table/TableHeaderRow.d.ts +3 -1
- package/lib/cjs/table/index.d.ts +4 -4
- package/lib/cjs/table/table-context.d.ts +7 -6
- package/lib/cjs/tabs/TabPane.d.ts +3 -1
- package/lib/cjs/tabs/TabPane.js +4 -0
- package/lib/cjs/tabs/index.js +2 -0
- 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 +4 -2
- package/lib/cjs/tooltip/index.js +1 -1
- package/lib/cjs/transfer/index.d.ts +4 -3
- package/lib/cjs/transfer/index.js +5 -2
- 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/button/index.d.ts +1 -1
- 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/index.js +1 -1
- 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/collapse/item.js +4 -2
- 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 +4 -3
- 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 +2 -2
- package/lib/es/form/baseForm.js +1 -1
- package/lib/es/form/errorMessage.d.ts +1 -1
- package/lib/es/form/group.d.ts +3 -1
- package/lib/es/form/hoc/withField.js +6 -4
- 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/iconButton/index.d.ts +1 -1
- 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/Modal.js +3 -0
- package/lib/es/modal/ModalContent.d.ts +7 -2
- package/lib/es/modal/confirm.d.ts +10 -5
- 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 +4 -6
- 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/index.d.ts +2 -2
- 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 +4 -2
- package/lib/es/progress/index.d.ts +1 -1
- package/lib/es/radio/radio.d.ts +1 -0
- package/lib/es/radio/radioGroup.d.ts +1 -0
- package/lib/es/scrollList/scrollItem.js +5 -1
- package/lib/es/select/index.d.ts +3 -1
- package/lib/es/select/optionGroup.d.ts +1 -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/BaseRow.d.ts +1 -1
- package/lib/es/table/Body/ExpandedRow.d.ts +4 -2
- package/lib/es/table/Body/SectionRow.d.ts +3 -1
- package/lib/es/table/Column.d.ts +1 -1
- package/lib/es/table/ColumnShape.d.ts +1 -1
- package/lib/es/table/CustomExpandIcon.d.ts +1 -1
- package/lib/es/table/Table.d.ts +10 -8
- package/lib/es/table/TableCell.d.ts +5 -3
- package/lib/es/table/TableHeaderRow.d.ts +3 -1
- package/lib/es/table/index.d.ts +4 -4
- package/lib/es/table/table-context.d.ts +7 -6
- package/lib/es/tabs/TabPane.d.ts +3 -1
- package/lib/es/tabs/TabPane.js +4 -0
- package/lib/es/tabs/index.js +2 -0
- 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 +4 -2
- package/lib/es/tooltip/index.js +1 -1
- package/lib/es/transfer/index.d.ts +4 -3
- package/lib/es/transfer/index.js +6 -2
- 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 +3 -0
- package/modal/ModalContent.tsx +9 -3
- package/modal/confirm.tsx +1 -1
- 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/_story/overflowList.stories.js +44 -0
- package/overflowList/intersectionObserver.tsx +2 -1
- package/package.json +9 -9
- 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/scrollList/_story/SingleWheelList/index.js +72 -0
- package/scrollList/_story/scrolllist.stories.js +7 -0
- package/scrollList/scrollItem.tsx +4 -1
- 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/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/__test__/table.test.js +1 -0
- package/table/table-context.ts +10 -6
- package/tabs/TabPane.tsx +4 -0
- package/tabs/_story/tabs.stories.js +72 -0
- package/tabs/index.tsx +3 -2
- package/tabs/interface.ts +2 -1
- package/tag/group.tsx +5 -5
- package/tagInput/_story/tagInput.stories.js +14 -1
- package/timePicker/TimePicker.tsx +2 -2
- package/timePicker/_story/timepicker.stories.js +20 -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/_story/tooltip.stories.js +127 -15
- package/tooltip/index.tsx +3 -2
- package/transfer/index.tsx +7 -2
- 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/typography/__test__/typography.test.js +1 -0
- package/upload/__test__/upload.test.js +2 -0
- package/upload/_story/upload.stories.js +2 -2
- package/upload/index.tsx +1 -1
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;
|
|
@@ -51,6 +53,7 @@ class TabPane extends PureComponent<TabPaneProps> {
|
|
|
51
53
|
return false;
|
|
52
54
|
};
|
|
53
55
|
|
|
56
|
+
/* istanbul ignore next */
|
|
54
57
|
hideScroll = (): void => {
|
|
55
58
|
if (this.ref && this.ref.current) {
|
|
56
59
|
this.ref.current.style.overflow = 'hidden';
|
|
@@ -58,6 +61,7 @@ class TabPane extends PureComponent<TabPaneProps> {
|
|
|
58
61
|
}
|
|
59
62
|
};
|
|
60
63
|
|
|
64
|
+
/* istanbul ignore next */
|
|
61
65
|
autoScroll = (): void => {
|
|
62
66
|
if (this.ref && this.ref.current) {
|
|
63
67
|
this.ref.current.style.overflow = '';
|
|
@@ -795,3 +795,75 @@ export const TabSize = () => <TabSizeDemo />;
|
|
|
795
795
|
TabSize.story = {
|
|
796
796
|
name: 'tab size',
|
|
797
797
|
};
|
|
798
|
+
|
|
799
|
+
class TabListChangeDemo extends React.Component {
|
|
800
|
+
constructor() {
|
|
801
|
+
super();
|
|
802
|
+
this.state = {
|
|
803
|
+
itemKey: '1',
|
|
804
|
+
tabList:[
|
|
805
|
+
{
|
|
806
|
+
tab: '文档',
|
|
807
|
+
itemKey: '1',
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
tab: '快速起步',
|
|
811
|
+
itemKey: '2',
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
tab: '帮助',
|
|
815
|
+
itemKey: '3',
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
tab: '关于',
|
|
819
|
+
itemKey: '4',
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
tab: '资源工具',
|
|
823
|
+
itemKey: '5',
|
|
824
|
+
},
|
|
825
|
+
]
|
|
826
|
+
};
|
|
827
|
+
this.onTabClick = this.onTabClick.bind(this);
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
onTabClick(itemKey, type) {
|
|
831
|
+
this.setState({
|
|
832
|
+
[type]: itemKey,
|
|
833
|
+
tabList: [{
|
|
834
|
+
tab: '文档',
|
|
835
|
+
itemKey: '1',
|
|
836
|
+
}]
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
render() {
|
|
841
|
+
const contentList = [
|
|
842
|
+
<div>文档</div>,
|
|
843
|
+
<div>快速起步</div>,
|
|
844
|
+
<div>帮助</div>,
|
|
845
|
+
<div>关于</div>,
|
|
846
|
+
<div>资源工具</div>,
|
|
847
|
+
];
|
|
848
|
+
return (
|
|
849
|
+
<Tabs
|
|
850
|
+
style={style}
|
|
851
|
+
type="line"
|
|
852
|
+
tabList={this.state.tabList}
|
|
853
|
+
onTabClick={itemKey => {
|
|
854
|
+
this.onTabClick(itemKey, 'itemKey');
|
|
855
|
+
}}
|
|
856
|
+
>
|
|
857
|
+
{contentList[this.state.itemKey]}
|
|
858
|
+
<span>test</span>
|
|
859
|
+
<span>test2</span>
|
|
860
|
+
</Tabs>
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
export const TabListChange = () => <TabListChangeDemo />;
|
|
866
|
+
|
|
867
|
+
TabListChange.story = {
|
|
868
|
+
name: 'tablist change',
|
|
869
|
+
};
|
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
|
|
|
@@ -192,6 +192,7 @@ class Tabs extends BaseComponent<TabsProps, TabsState> {
|
|
|
192
192
|
this.foundation.handleTabClick(activeKey, event);
|
|
193
193
|
};
|
|
194
194
|
|
|
195
|
+
/* istanbul ignore next */
|
|
195
196
|
rePosChildren = (children: ReactElement[], activeKey: string): ReactElement[] => {
|
|
196
197
|
const newChildren: ReactElement[] = [];
|
|
197
198
|
|
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}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Toast, Icon, Button, Avatar } from '@douyinfe/semi-ui/';
|
|
2
|
+
import { Toast, Icon, Button, Avatar, Form } from '@douyinfe/semi-ui/';
|
|
3
3
|
import TagInput from '../index';
|
|
4
4
|
import { IconGift, IconVigoLogo } from '@douyinfe/semi-icons';
|
|
5
5
|
const style = {
|
|
@@ -412,3 +412,16 @@ export const PrefixSuffix = () => (
|
|
|
412
412
|
PrefixSuffix.story = {
|
|
413
413
|
name: 'prefix / suffix',
|
|
414
414
|
};
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
export const TagInputInForm = () => (
|
|
418
|
+
<>
|
|
419
|
+
<Form onSubmit={() => Toast.info('123')}>
|
|
420
|
+
<TagInput showClear />
|
|
421
|
+
</Form>
|
|
422
|
+
</>
|
|
423
|
+
);
|
|
424
|
+
|
|
425
|
+
PrefixSuffix.story = {
|
|
426
|
+
name: 'TagInputInForm'
|
|
427
|
+
};
|
|
@@ -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;
|
|
@@ -475,7 +475,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
475
475
|
|
|
476
476
|
const panelPrefix = classNames({
|
|
477
477
|
[`${prefixCls}-panel`]: true,
|
|
478
|
-
[`${prefixCls}-panel-${
|
|
478
|
+
[`${prefixCls}-panel-${size}`]: size,
|
|
479
479
|
});
|
|
480
480
|
|
|
481
481
|
const inputProps = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component, useState } from 'react';
|
|
2
2
|
import TimePickerPanel from '../index';
|
|
3
|
-
import { TimePicker as BasicTimePicker, Button } from '../../index';
|
|
3
|
+
import { TimePicker as BasicTimePicker, Button, Form } from '../../index';
|
|
4
4
|
import { strings } from '@douyinfe/semi-foundation/timePicker/constants';
|
|
5
5
|
import { get } from 'lodash';
|
|
6
6
|
|
|
@@ -44,6 +44,12 @@ const init = () => {
|
|
|
44
44
|
init();
|
|
45
45
|
|
|
46
46
|
export const TimePickerPanelDefault = () => {
|
|
47
|
+
const initValues = {
|
|
48
|
+
testRange: [
|
|
49
|
+
new Date("2022-04-17T15:00:00"),
|
|
50
|
+
new Date("2022-04-17T18:00:00"),
|
|
51
|
+
],
|
|
52
|
+
};
|
|
47
53
|
return (
|
|
48
54
|
<div>
|
|
49
55
|
<TimePicker panelHeader={'Time Select'} onChange={val => console.log(val)} />
|
|
@@ -53,6 +59,19 @@ export const TimePickerPanelDefault = () => {
|
|
|
53
59
|
defaultOpen={true}
|
|
54
60
|
scrollItemProps={{ cycled: false }}
|
|
55
61
|
/>
|
|
62
|
+
<TimePicker use12Hours defaultValue={"上午 10:32:33"}/>
|
|
63
|
+
<br/><br/>
|
|
64
|
+
<TimePicker type="timeRange" use12Hours format="a h:mm" defaultValue={["下午 08:11", "上午 11:21"]} />
|
|
65
|
+
<Form initValues={initValues}>
|
|
66
|
+
<pre>{JSON.stringify(initValues)}</pre>
|
|
67
|
+
<Form.TimePicker
|
|
68
|
+
use12Hours
|
|
69
|
+
field="testRange"
|
|
70
|
+
label="Time Range"
|
|
71
|
+
type="timeRange"
|
|
72
|
+
format="a hh:mm"
|
|
73
|
+
/>
|
|
74
|
+
</Form>
|
|
56
75
|
</div>
|
|
57
76
|
);
|
|
58
77
|
};
|
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,
|
|
@@ -404,6 +404,115 @@ AdjustPosition.story = {
|
|
|
404
404
|
name: '自适应',
|
|
405
405
|
};
|
|
406
406
|
|
|
407
|
+
export const AdjustPosIfNeed = () => {
|
|
408
|
+
const tops = [
|
|
409
|
+
['topLeft', 'TL'],
|
|
410
|
+
['top', 'Top'],
|
|
411
|
+
['topRight', 'TR'],
|
|
412
|
+
];
|
|
413
|
+
const lefts = [
|
|
414
|
+
['leftTop', 'LT'],
|
|
415
|
+
['left', 'Left'],
|
|
416
|
+
['leftBottom', 'LB'],
|
|
417
|
+
];
|
|
418
|
+
const rights = [
|
|
419
|
+
['rightTop', 'RT'],
|
|
420
|
+
['right', 'Right'],
|
|
421
|
+
['rightBottom', 'RB'],
|
|
422
|
+
];
|
|
423
|
+
const bottoms = [
|
|
424
|
+
['bottomLeft', 'BL'],
|
|
425
|
+
['bottom', 'Bottom'],
|
|
426
|
+
['bottomRight', 'BR'],
|
|
427
|
+
];
|
|
428
|
+
|
|
429
|
+
return (
|
|
430
|
+
<div style={{ paddingLeft: 40 }}>
|
|
431
|
+
<div style={{ marginLeft: 40, whiteSpace: 'nowrap' }}>
|
|
432
|
+
{tops.map((pos, index) => (
|
|
433
|
+
<Tooltip
|
|
434
|
+
showArrow
|
|
435
|
+
arrowPointAtCenter
|
|
436
|
+
content={
|
|
437
|
+
<article>
|
|
438
|
+
Hi ByteDancer, this is a tooltip.
|
|
439
|
+
<br /> We have 2 lines.
|
|
440
|
+
</article>
|
|
441
|
+
}
|
|
442
|
+
position={Array.isArray(pos) ? pos[0] : pos}
|
|
443
|
+
key={index}
|
|
444
|
+
>
|
|
445
|
+
<Tag
|
|
446
|
+
style={{ marginRight: '8px' }}
|
|
447
|
+
data-cy={Array.isArray(pos) ? pos[0] : pos}
|
|
448
|
+
>
|
|
449
|
+
{Array.isArray(pos) ? pos[1] : pos}
|
|
450
|
+
</Tag>
|
|
451
|
+
</Tooltip>
|
|
452
|
+
))}
|
|
453
|
+
</div>
|
|
454
|
+
<div style={{ width: 40, float: 'left' }}>
|
|
455
|
+
{lefts.map((pos, index) => (
|
|
456
|
+
<Tooltip
|
|
457
|
+
showArrow
|
|
458
|
+
arrowPointAtCenter
|
|
459
|
+
content={
|
|
460
|
+
<article>
|
|
461
|
+
Hi ByteDancer, this is a tooltip.
|
|
462
|
+
<br /> We have 2 lines.
|
|
463
|
+
</article>
|
|
464
|
+
}
|
|
465
|
+
position={Array.isArray(pos) ? pos[0] : pos}
|
|
466
|
+
key={index}
|
|
467
|
+
>
|
|
468
|
+
<Tag data-cy={Array.isArray(pos) ? pos[0] : pos} style={{ marginBottom: '8px' }}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
|
|
469
|
+
</Tooltip>
|
|
470
|
+
))}
|
|
471
|
+
</div>
|
|
472
|
+
<div style={{ width: 40, marginLeft: 180 }}>
|
|
473
|
+
{rights.map((pos, index) => (
|
|
474
|
+
<Tooltip
|
|
475
|
+
showArrow
|
|
476
|
+
arrowPointAtCenter
|
|
477
|
+
content={
|
|
478
|
+
<article>
|
|
479
|
+
Hi ByteDancer, this is a tooltip.
|
|
480
|
+
<br /> We have 2 lines.
|
|
481
|
+
</article>
|
|
482
|
+
}
|
|
483
|
+
position={Array.isArray(pos) ? pos[0] : pos}
|
|
484
|
+
key={index}
|
|
485
|
+
>
|
|
486
|
+
<Tag data-cy={Array.isArray(pos) ? pos[0] : pos} style={{ marginBottom: '8px' }}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
|
|
487
|
+
</Tooltip>
|
|
488
|
+
))}
|
|
489
|
+
</div>
|
|
490
|
+
<div style={{ marginLeft: 40, clear: 'both', whiteSpace: 'nowrap' }}>
|
|
491
|
+
{bottoms.map((pos, index) => (
|
|
492
|
+
<Tooltip
|
|
493
|
+
showArrow
|
|
494
|
+
arrowPointAtCenter
|
|
495
|
+
content={
|
|
496
|
+
<article>
|
|
497
|
+
Hi ByteDancer, this is a tooltip.
|
|
498
|
+
<br /> We have 2 lines.
|
|
499
|
+
</article>
|
|
500
|
+
}
|
|
501
|
+
position={Array.isArray(pos) ? pos[0] : pos}
|
|
502
|
+
key={index}
|
|
503
|
+
>
|
|
504
|
+
<Tag data-cy={Array.isArray(pos) ? pos[0] : pos} position={Array.isArray(pos) ? pos[0] : pos} style={{ marginRight: '8px' }}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
|
|
505
|
+
</Tooltip>
|
|
506
|
+
))}
|
|
507
|
+
</div>
|
|
508
|
+
</div>
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
AdjustPosIfNeed.story = {
|
|
513
|
+
name: '自适应位置',
|
|
514
|
+
};
|
|
515
|
+
|
|
407
516
|
export const CompositeComponent = () => (
|
|
408
517
|
<div
|
|
409
518
|
style={{
|
|
@@ -764,7 +873,7 @@ export const leftTopOverDemo = () => {
|
|
|
764
873
|
content,
|
|
765
874
|
trigger: 'click',
|
|
766
875
|
showArrow: false,
|
|
767
|
-
visible,
|
|
876
|
+
visible:true,
|
|
768
877
|
trigger: 'custom',
|
|
769
878
|
motion: false,
|
|
770
879
|
};
|
|
@@ -774,34 +883,37 @@ export const leftTopOverDemo = () => {
|
|
|
774
883
|
|
|
775
884
|
return (
|
|
776
885
|
<div data-cy="wrapper">
|
|
777
|
-
<Button onClick={() => setVisible(!visible)}>toggle visible</Button>
|
|
778
|
-
<div style={{ paddingTop:
|
|
886
|
+
<Button onClick={() => setVisible(!visible)} data-cy="toggleVisible">toggle visible</Button>
|
|
887
|
+
<div style={{ paddingTop: 110 }}>
|
|
779
888
|
<Space spacing={80}>
|
|
780
|
-
<Tooltip {...commonProps} position="
|
|
781
|
-
<Button data-cy="leftTopOver" style={buttonStyle}>
|
|
782
|
-
leftTopOver
|
|
783
|
-
</Button>
|
|
784
|
-
</Tooltip>
|
|
785
|
-
<Tooltip {...commonProps} position="leftBottomOver">
|
|
889
|
+
<Tooltip {...commonProps} position="leftBottomOver" trigger="click">
|
|
786
890
|
<Button data-cy="leftBottomOver" style={buttonStyle}>
|
|
787
891
|
leftBottomOver
|
|
788
892
|
</Button>
|
|
789
893
|
</Tooltip>
|
|
790
|
-
<Tooltip {...commonProps} position="
|
|
791
|
-
<Button data-cy="rightTopOver" style={buttonStyle}>
|
|
792
|
-
rightTopOver
|
|
793
|
-
</Button>
|
|
794
|
-
</Tooltip>
|
|
795
|
-
<Tooltip {...commonProps} position="rightBottomOver">
|
|
894
|
+
<Tooltip {...commonProps} position="rightBottomOver" trigger="click">
|
|
796
895
|
<Button data-cy="rightBottomOver" style={buttonStyle}>
|
|
797
896
|
rightBottomOver
|
|
798
897
|
</Button>
|
|
799
898
|
</Tooltip>
|
|
800
899
|
</Space>
|
|
801
900
|
</div>
|
|
901
|
+
<Space spacing={80}>
|
|
902
|
+
<Tooltip {...commonProps} position="leftTopOver" trigger="click">
|
|
903
|
+
<Button data-cy="leftTopOver" style={buttonStyle}>
|
|
904
|
+
leftTopOver
|
|
905
|
+
</Button>
|
|
906
|
+
</Tooltip>
|
|
907
|
+
<Tooltip {...commonProps} position="rightTopOver" trigger="click">
|
|
908
|
+
<Button data-cy="rightTopOver" style={buttonStyle}>
|
|
909
|
+
rightTopOver
|
|
910
|
+
</Button>
|
|
911
|
+
</Tooltip>
|
|
912
|
+
</Space>
|
|
802
913
|
</div>
|
|
803
914
|
);
|
|
804
915
|
};
|
|
916
|
+
|
|
805
917
|
leftTopOverDemo.storyName = `leftTopOver visible`;
|
|
806
918
|
leftTopOverDemo.parameters = {
|
|
807
919
|
chromatic: {
|
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);
|
|
@@ -580,7 +581,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
580
581
|
}
|
|
581
582
|
</TooltipTransition>
|
|
582
583
|
) : (
|
|
583
|
-
<div className={className} {...portalEventSet} x-placement={placement} style={{ visibility: motion ?
|
|
584
|
+
<div className={className} {...portalEventSet} x-placement={placement} style={{ visibility: motion ? 'hidden' : 'visible', ...style }}>
|
|
584
585
|
{contentNode}
|
|
585
586
|
{icon}
|
|
586
587
|
</div>
|
package/transfer/index.tsx
CHANGED
|
@@ -60,6 +60,8 @@ export interface SourcePanelProps {
|
|
|
60
60
|
filterData: Array<DataItem>;
|
|
61
61
|
/* All items */
|
|
62
62
|
sourceData: Array<DataItem>;
|
|
63
|
+
/* transfer props' dataSource */
|
|
64
|
+
propsDataSource: DataSource,
|
|
63
65
|
/* Whether to select all */
|
|
64
66
|
allChecked: boolean;
|
|
65
67
|
/* Number of filtered results */
|
|
@@ -359,7 +361,7 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
|
|
|
359
361
|
|
|
360
362
|
renderLeft(locale: Locale['Transfer']) {
|
|
361
363
|
const { data, selectedItems, inputValue, searchResult } = this.state;
|
|
362
|
-
const { loading, type, emptyContent, renderSourcePanel } = this.props;
|
|
364
|
+
const { loading, type, emptyContent, renderSourcePanel, dataSource } = this.props;
|
|
363
365
|
const totalToken = locale.total;
|
|
364
366
|
const inSearchMode = inputValue !== '';
|
|
365
367
|
const showNumber = inSearchMode ? searchResult.size : data.length;
|
|
@@ -423,6 +425,7 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
|
|
|
423
425
|
noMatch,
|
|
424
426
|
filterData,
|
|
425
427
|
sourceData: data,
|
|
428
|
+
propsDataSource: dataSource,
|
|
426
429
|
allChecked: !leftContainesNotInSelected,
|
|
427
430
|
showNumber,
|
|
428
431
|
inputValue,
|
|
@@ -558,18 +561,20 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
|
|
|
558
561
|
renderRightSortableList(selectedData: Array<ResolvedDataItem>) {
|
|
559
562
|
// when choose some items && draggable is true
|
|
560
563
|
const SortableItem = SortableElement((
|
|
561
|
-
(item: ResolvedDataItem) => this.renderRightItem(item)) as React.
|
|
564
|
+
(item: ResolvedDataItem) => this.renderRightItem(item)) as React.FC<ResolvedDataItem>
|
|
562
565
|
);
|
|
563
566
|
const SortableList = SortableContainer(({ items }: { items: Array<ResolvedDataItem> }) => (
|
|
564
567
|
<div className={`${prefixcls}-right-list`} role="list" aria-label="Selected list">
|
|
565
568
|
{items.map((item, index: number) => (
|
|
566
569
|
// sortableElement will take over the property 'key', so use another '_optionKey' to pass
|
|
570
|
+
// @ts-ignore skip SortableItem type check
|
|
567
571
|
<SortableItem key={item.label} index={index} {...item} _optionKey={item.key} />
|
|
568
572
|
))}
|
|
569
573
|
</div>
|
|
570
574
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
571
575
|
// @ts-ignore see reasons: https://github.com/clauderic/react-sortable-hoc/issues/206
|
|
572
576
|
), { distance: 10 });
|
|
577
|
+
// @ts-ignore skip SortableItem type check
|
|
573
578
|
const sortList = <SortableList useDragHandle onSortEnd={this.onSortEnd} items={selectedData} />;
|
|
574
579
|
return sortList;
|
|
575
580
|
}
|