@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/dropdown/context.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export interface DropdownContextType {
|
|
4
|
+
level?: number;
|
|
5
|
+
showTick?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const DropdownContext = React.createContext<DropdownContextType>({
|
|
4
9
|
level: 0,
|
|
5
10
|
});
|
|
6
11
|
export default DropdownContext;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import cls from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { cssClasses as css, strings } from '@douyinfe/semi-foundation/dropdown/constants';
|
|
5
|
-
import DropdownContext from './context';
|
|
5
|
+
import DropdownContext, { DropdownContextType } from './context';
|
|
6
6
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
7
7
|
import { IconTick } from '@douyinfe/semi-icons';
|
|
8
8
|
import { noop } from 'lodash';
|
|
@@ -43,6 +43,7 @@ class DropdownItem extends BaseComponent<DropdownItemProps> {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
static contextType = DropdownContext;
|
|
46
|
+
context: DropdownContextType;
|
|
46
47
|
|
|
47
48
|
static defaultProps = {
|
|
48
49
|
disabled: false,
|
|
@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { cssClasses } from '@douyinfe/semi-foundation/dropdown/constants';
|
|
4
4
|
import cls from 'classnames';
|
|
5
|
-
import DropdownContext from './context';
|
|
5
|
+
import DropdownContext, { DropdownContextType } from './context';
|
|
6
6
|
import { BaseProps } from '../_base/baseComponent';
|
|
7
7
|
|
|
8
8
|
const prefixCls = cssClasses.PREFIX;
|
|
@@ -17,6 +17,7 @@ class DropdownTitle extends PureComponent<DropdownTitleProps> {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
static contextType = DropdownContext;
|
|
20
|
+
context: DropdownContextType;
|
|
20
21
|
|
|
21
22
|
render() {
|
|
22
23
|
const { className, style, children } = this.props;
|
package/dropdown/index.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import DropdownItem, { DropdownItemProps } from './dropdownItem';
|
|
|
13
13
|
import DropdownDivider, { DropdownDividerProps } from './dropdownDivider';
|
|
14
14
|
import DropdownTitle, { DropdownTitleProps } from './dropdownTitle';
|
|
15
15
|
|
|
16
|
-
import DropdownContext from './context';
|
|
16
|
+
import DropdownContext, { DropdownContextType } from './context';
|
|
17
17
|
import '@douyinfe/semi-foundation/dropdown/dropdown.scss';
|
|
18
18
|
import { noop, get } from 'lodash';
|
|
19
19
|
import { Motion } from '../_base/base';
|
|
@@ -118,6 +118,8 @@ class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
|
|
|
118
118
|
this.foundation = new Foundation(this.adapter);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
context: DropdownContextType;
|
|
122
|
+
|
|
121
123
|
get adapter() {
|
|
122
124
|
return {
|
|
123
125
|
...super.adapter,
|
package/empty/index.tsx
CHANGED
package/form/arrayField.tsx
CHANGED
|
@@ -73,6 +73,7 @@ class ArrayFieldComponent extends Component<ArrayFieldProps, ArrayFieldState> {
|
|
|
73
73
|
cacheFieldValues: any[];
|
|
74
74
|
shouldUseInitValue: boolean;
|
|
75
75
|
cacheUpdateKey: string;
|
|
76
|
+
context: FormUpdaterContextType;
|
|
76
77
|
|
|
77
78
|
constructor(props: ArrayFieldProps, context: FormUpdaterContextType) {
|
|
78
79
|
super(props, context);
|
package/form/baseForm.tsx
CHANGED
|
@@ -18,7 +18,8 @@ import ErrorMessage from './errorMessage';
|
|
|
18
18
|
import FormInputGroup from './group';
|
|
19
19
|
import { noop } from 'lodash';
|
|
20
20
|
import '@douyinfe/semi-foundation/form/form.scss';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
FormInput,
|
|
22
23
|
FormInputNumber,
|
|
23
24
|
FormTextArea,
|
|
24
25
|
FormSelect,
|
|
@@ -206,7 +207,7 @@ class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
206
207
|
values: formState.values,
|
|
207
208
|
};
|
|
208
209
|
if (component) {
|
|
209
|
-
return React.createElement(component, props
|
|
210
|
+
return React.createElement(component, props);
|
|
210
211
|
}
|
|
211
212
|
if (render) {
|
|
212
213
|
return render(props);
|
package/form/group.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import { FormUpdaterContext } from './context';
|
|
|
11
11
|
import { useFormState } from './hooks/index';
|
|
12
12
|
import InputGroup, { InputGroupProps as BacisInputGroupProps } from '../input/inputGroup';
|
|
13
13
|
import { BaseFormProps, FormState } from './interface';
|
|
14
|
+
import { FormUpdaterContextType } from '@douyinfe/semi-foundation/form/interface';
|
|
14
15
|
|
|
15
16
|
interface GroupErrorProps {
|
|
16
17
|
showValidateIcon?: boolean;
|
|
@@ -44,6 +45,7 @@ const GroupError = (props: GroupErrorProps) => {
|
|
|
44
45
|
|
|
45
46
|
class FormInputGroup extends Component<InputGroupProps> {
|
|
46
47
|
static contextType = FormUpdaterContext;
|
|
48
|
+
context: FormUpdaterContextType;
|
|
47
49
|
renderLabel(label: LabelProps, formProps: BaseFormProps) {
|
|
48
50
|
if (label) {
|
|
49
51
|
if (isString(label)) {
|
package/form/hoc/withField.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { Col } from '../../grid';
|
|
|
15
15
|
import { CallOpts, WithFieldOption } from '@douyinfe/semi-foundation/form/interface';
|
|
16
16
|
import { CommonFieldProps, CommonexcludeType } from '../interface';
|
|
17
17
|
import { Subtract } from 'utility-types';
|
|
18
|
+
import { noop } from "lodash";
|
|
18
19
|
|
|
19
20
|
const prefix = cssClasses.PREFIX;
|
|
20
21
|
|
|
@@ -121,6 +122,7 @@ function withField<
|
|
|
121
122
|
const [status, setStatus] = useState(validateStatus); // use props.validateStatus to init
|
|
122
123
|
|
|
123
124
|
const rulesRef = useRef(rules);
|
|
125
|
+
const validateRef = useRef(validate);
|
|
124
126
|
|
|
125
127
|
// notNotify is true means that the onChange of the Form does not need to be triggered
|
|
126
128
|
// notUpdate is true means that this operation does not need to trigger the forceUpdate
|
|
@@ -221,7 +223,7 @@ function withField<
|
|
|
221
223
|
let maybePromisedErrors;
|
|
222
224
|
// let errorThrowSync;
|
|
223
225
|
try {
|
|
224
|
-
maybePromisedErrors =
|
|
226
|
+
maybePromisedErrors = validateRef.current(val, values);
|
|
225
227
|
} catch (err) {
|
|
226
228
|
// error throw by syncValidate
|
|
227
229
|
maybePromisedErrors = err;
|
|
@@ -258,7 +260,7 @@ function withField<
|
|
|
258
260
|
if (transform) {
|
|
259
261
|
finalVal = transform(val);
|
|
260
262
|
}
|
|
261
|
-
if (
|
|
263
|
+
if (validateRef.current) {
|
|
262
264
|
return _validate(finalVal, updater.getValue(), callOpts);
|
|
263
265
|
} else if (latestRules) {
|
|
264
266
|
return _validateInternal(finalVal, callOpts);
|
|
@@ -357,7 +359,8 @@ function withField<
|
|
|
357
359
|
// avoid hooks capture value, fixed issue 346
|
|
358
360
|
useLayoutEffect(() => {
|
|
359
361
|
rulesRef.current = rules;
|
|
360
|
-
|
|
362
|
+
validateRef.current = validate;
|
|
363
|
+
}, [rules, validate]);
|
|
361
364
|
|
|
362
365
|
// exec validate once when trigger inlcude 'mount'
|
|
363
366
|
useLayoutEffect(() => {
|
|
@@ -442,11 +445,11 @@ function withField<
|
|
|
442
445
|
if (helpText) {
|
|
443
446
|
newProps['aria-describedby'] = extraText ? `${helpTextId} ${extraTextId}` : helpTextId;
|
|
444
447
|
}
|
|
445
|
-
|
|
448
|
+
|
|
446
449
|
if (extraText) {
|
|
447
450
|
newProps['aria-describedby'] = helpText ? `${helpTextId} ${extraTextId}` : extraTextId;
|
|
448
451
|
}
|
|
449
|
-
|
|
452
|
+
|
|
450
453
|
if (status === 'error') {
|
|
451
454
|
newProps['aria-errormessage'] = errorMessageId;
|
|
452
455
|
newProps['aria-invalid'] = true;
|
|
@@ -580,7 +583,7 @@ function withField<
|
|
|
580
583
|
}
|
|
581
584
|
};
|
|
582
585
|
SemiField = forwardRef(SemiField);
|
|
583
|
-
(SemiField as React.
|
|
586
|
+
(SemiField as React.FC).displayName = getDisplayName(Component);
|
|
584
587
|
return SemiField as any;
|
|
585
588
|
}
|
|
586
589
|
|
package/form/label.tsx
CHANGED
package/form/section.tsx
CHANGED
|
@@ -10,7 +10,7 @@ export interface SectionProps {
|
|
|
10
10
|
className?: string;
|
|
11
11
|
style?: React.CSSProperties;
|
|
12
12
|
text?: React.ReactNode | string;
|
|
13
|
-
children?: React.ReactNode;
|
|
13
|
+
children?: React.ReactNode | undefined;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export default class Section extends PureComponent<SectionProps> {
|
package/form/slot.tsx
CHANGED
|
@@ -59,9 +59,11 @@ const FormSlot = (props: SlotProps) => {
|
|
|
59
59
|
// do nothing
|
|
60
60
|
break;
|
|
61
61
|
case isString(label) || isNumber(label):
|
|
62
|
+
// @ts-ignore skip type check, the actual type is already determined
|
|
62
63
|
label = { text: label };
|
|
63
64
|
break;
|
|
64
65
|
case React.isValidElement(label):
|
|
66
|
+
// @ts-ignore skip type check, the actual type is already determined
|
|
65
67
|
label = { text: label };
|
|
66
68
|
break;
|
|
67
69
|
default:
|
package/grid/col.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { RowContext } from './row';
|
|
6
|
+
import { RowContext, RowContextType } from './row';
|
|
7
7
|
import classnames from 'classnames';
|
|
8
8
|
import { cssClasses } from '@douyinfe/semi-foundation/grid/constants';
|
|
9
9
|
|
|
@@ -59,6 +59,8 @@ class Col extends React.Component<ColProps> {
|
|
|
59
59
|
prefixCls: cssClasses.PREFIX,
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
+
context: RowContextType;
|
|
63
|
+
|
|
62
64
|
render() {
|
|
63
65
|
const { props } = this;
|
|
64
66
|
const { prefixCls, span, order, offset, push, pull, className, children, ...others } = props;
|
package/grid/row.tsx
CHANGED
|
@@ -10,7 +10,11 @@ import { registerMediaQuery } from '../_utils';
|
|
|
10
10
|
|
|
11
11
|
const responsiveArray = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export interface RowContextType {
|
|
14
|
+
gutters?: Gutter | [Gutter, Gutter];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const RowContext = React.createContext<RowContextType>(null);
|
|
14
18
|
|
|
15
19
|
export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
16
20
|
|
|
@@ -113,9 +113,18 @@ describe('Input', () => {
|
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
it('input password mode', () => {
|
|
116
|
-
const inputMode = mount(<Input
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
const inputMode = mount(<Input />);
|
|
117
|
+
expect(inputMode.find('input').instance().type).toEqual('text');
|
|
118
|
+
inputMode.setProps({ mode: 'password' }) ;
|
|
119
|
+
expect(inputMode.find('input').instance().type).toEqual('password');
|
|
120
|
+
inputMode.setProps({ mode: '' }) ;
|
|
121
|
+
expect(inputMode.find('input').instance().type).toEqual('text');
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('input password click eyes icon', () => {
|
|
125
|
+
const inputMode = mount(<Input mode='password' defaultValue="123456" autofocus/>);
|
|
126
|
+
inputMode.simulate('mouseEnter', {}).find(`.${BASE_CLASS_PREFIX}-input-modebtn`).simulate('click');
|
|
127
|
+
expect(inputMode.find('input').instance().type).toEqual('text');
|
|
119
128
|
});
|
|
120
129
|
|
|
121
130
|
it('input controlled mode', () => {
|
|
@@ -116,4 +116,57 @@ describe('TextArea', () => {
|
|
|
116
116
|
const counter2 = textarea.find(`.${BASE_CLASS_PREFIX}-input-textarea-counter`);
|
|
117
117
|
expect(counter2.hasClass('semi-input-textarea-counter-exceed')).toEqual(false);
|
|
118
118
|
});
|
|
119
|
+
|
|
120
|
+
it('test minLength', () => {
|
|
121
|
+
let inputValue = '💖💖💖';
|
|
122
|
+
let inputValue1 = '💖💖💖💖';
|
|
123
|
+
let minLength = 4;
|
|
124
|
+
let event = { target: { value: inputValue } };
|
|
125
|
+
let event1 = { target: { value: inputValue1 } };
|
|
126
|
+
|
|
127
|
+
let onChange = value => {
|
|
128
|
+
console.log(value);
|
|
129
|
+
};
|
|
130
|
+
let spyOnChange = sinon.spy(onChange);
|
|
131
|
+
const textArea = mount(<TextArea onChange={spyOnChange} minLength={minLength} getValueLength={getValueLength} />);
|
|
132
|
+
const textAreaDom = textArea.find('textarea');
|
|
133
|
+
|
|
134
|
+
textAreaDom.simulate('change', event);
|
|
135
|
+
expect(spyOnChange.calledOnce).toBe(true);
|
|
136
|
+
expect(spyOnChange.calledWithMatch(textAreaDom)).toBe(true);
|
|
137
|
+
expect(textAreaDom.instance().minLength).toEqual(inputValue.length + (minLength - getValueLength(inputValue)));
|
|
138
|
+
|
|
139
|
+
textAreaDom.simulate('change', event1);
|
|
140
|
+
expect(spyOnChange.calledWithMatch(textAreaDom)).toBe(true);
|
|
141
|
+
expect(textAreaDom.instance().minLength).toEqual(minLength)
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('test maxLength + truncateValue', () => {
|
|
145
|
+
function truncateValue(inputValue, maxLength, getValueLength) {
|
|
146
|
+
let event = { target: { value: inputValue } };
|
|
147
|
+
let onChange = value => {
|
|
148
|
+
console.log(value);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
let spyOnChange = sinon.spy(onChange);
|
|
152
|
+
const textArea = mount(<TextArea onChange={spyOnChange} maxLength={maxLength} getValueLength={getValueLength} />);
|
|
153
|
+
const textAreaDom = textArea.find('textarea');
|
|
154
|
+
textAreaDom.simulate('change', event);
|
|
155
|
+
expect(spyOnChange.calledOnce).toBe(true);
|
|
156
|
+
return textAreaDom.instance().value;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const testCases = [
|
|
160
|
+
// 自定义valueLength
|
|
161
|
+
['Semi', 5, getValueLength, 'Semi'],
|
|
162
|
+
['Semi Design', 4, getValueLength, 'Semi'],
|
|
163
|
+
['💖💖💖💖💖💖💖💖💖💖👨👩👧👦', 10, getValueLength, '💖💖💖💖💖💖💖💖💖💖'],
|
|
164
|
+
['💖', -1, getValueLength, ''],
|
|
165
|
+
['🆗', 1, getValueLength, '🆗'],
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
for (let [value, length, fc, result] of testCases) {
|
|
169
|
+
expect(truncateValue(value, length, fc)).toBe(result);
|
|
170
|
+
}
|
|
171
|
+
})
|
|
119
172
|
})
|
package/layout/Sider.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import cls from 'classnames';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/layout/constants';
|
|
5
5
|
import getDataAttr from '@douyinfe/semi-foundation/utils/getDataAttr';
|
|
6
|
-
import LayoutContext from './layout-context';
|
|
6
|
+
import LayoutContext, { ContextType } from './layout-context';
|
|
7
7
|
import { registerMediaQuery } from '../_utils';
|
|
8
8
|
|
|
9
9
|
const responsiveMap: ResponsiveMap = {
|
|
@@ -38,6 +38,7 @@ export interface SiderProps {
|
|
|
38
38
|
prefixCls?: string;
|
|
39
39
|
style?: CSSProperties;
|
|
40
40
|
className?: string;
|
|
41
|
+
children?: React.ReactNode | undefined;
|
|
41
42
|
breakpoint?: Array<keyof ResponsiveMap>;
|
|
42
43
|
onBreakpoint?: (screen: keyof ResponsiveMap, match: boolean) => void;
|
|
43
44
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
@@ -62,6 +63,7 @@ class Sider extends React.PureComponent<SiderProps> {
|
|
|
62
63
|
static contextType = LayoutContext;
|
|
63
64
|
|
|
64
65
|
unRegisters: Array<() => void> = [];
|
|
66
|
+
context: ContextType;
|
|
65
67
|
uniqueId = '';
|
|
66
68
|
|
|
67
69
|
constructor(props: SiderProps) {
|
package/layout/index.tsx
CHANGED
|
@@ -32,6 +32,7 @@ export interface BasicProps {
|
|
|
32
32
|
className?: string;
|
|
33
33
|
tagName?: keyof HTMLElementTagNameMap;
|
|
34
34
|
type?: string;
|
|
35
|
+
children?: React.ReactNode | undefined;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
class Basic extends React.PureComponent<BasicProps> {
|
|
@@ -60,6 +61,7 @@ export interface BasicLayoutProps {
|
|
|
60
61
|
prefixCls?: string;
|
|
61
62
|
style?: CSSProperties;
|
|
62
63
|
className?: string;
|
|
64
|
+
children?: React.ReactNode | undefined;
|
|
63
65
|
hasSider?: boolean;
|
|
64
66
|
tagName?: keyof HTMLElementTagNameMap;
|
|
65
67
|
}
|
package/layout/layout-context.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The Semi Foundation / Adapter architecture split was inspired by Material Component For Web. (https://github.com/material-components/material-components-web)
|
|
3
3
|
* We re-implemented our own code based on the principle and added more functions we need according to actual needs.
|
|
4
4
|
*/
|
|
5
|
-
import React, { Component } from 'react';
|
|
5
|
+
import React, { Component, ReactNode } from 'react';
|
|
6
6
|
import { DefaultAdapter } from '@douyinfe/semi-foundation/lib/cjs/base/foundation';
|
|
7
7
|
import { VALIDATE_STATUS } from '@douyinfe/semi-foundation/lib/cjs/base/constants';
|
|
8
8
|
import { ArrayElement } from './base';
|
|
@@ -10,6 +10,7 @@ export declare type ValidateStatus = ArrayElement<typeof VALIDATE_STATUS>;
|
|
|
10
10
|
export interface BaseProps {
|
|
11
11
|
style?: React.CSSProperties;
|
|
12
12
|
className?: string;
|
|
13
|
+
children?: ReactNode | undefined | any;
|
|
13
14
|
}
|
|
14
15
|
export default class BaseComponent<P extends BaseProps = {}, S = {}> extends Component<P, S> {
|
|
15
16
|
static propTypes: {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { ContextValue } from '../configProvider/context';
|
|
3
4
|
import '@douyinfe/semi-foundation/lib/cjs/_portal/portal.css';
|
|
4
5
|
export interface PortalProps {
|
|
5
6
|
children: React.ReactNode;
|
|
@@ -13,7 +14,7 @@ export interface PortalState {
|
|
|
13
14
|
container: undefined | HTMLElement;
|
|
14
15
|
}
|
|
15
16
|
declare class Portal extends PureComponent<PortalProps, PortalState> {
|
|
16
|
-
static contextType: React.Context<
|
|
17
|
+
static contextType: React.Context<ContextValue>;
|
|
17
18
|
static defaultProps: {
|
|
18
19
|
prefixCls: string;
|
|
19
20
|
};
|
|
@@ -25,6 +26,7 @@ declare class Portal extends PureComponent<PortalProps, PortalState> {
|
|
|
25
26
|
didUpdate: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
27
|
};
|
|
27
28
|
el: HTMLElement;
|
|
29
|
+
context: ContextValue;
|
|
28
30
|
constructor(props: PortalProps);
|
|
29
31
|
componentDidMount(): void;
|
|
30
32
|
componentDidUpdate(prevProps: PortalProps): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { strings } from '@douyinfe/semi-foundation/lib/cjs/anchor/constants';
|
|
4
4
|
import AnchorFoundation, { AnchorAdapter } from '@douyinfe/semi-foundation/lib/cjs/anchor/foundation';
|
|
@@ -10,6 +10,7 @@ export { LinkProps } from './link';
|
|
|
10
10
|
export interface AnchorProps {
|
|
11
11
|
autoCollapse?: boolean;
|
|
12
12
|
className?: string;
|
|
13
|
+
children?: ReactNode | undefined;
|
|
13
14
|
defaultAnchor?: string;
|
|
14
15
|
getContainer?: () => HTMLElement | Window;
|
|
15
16
|
maxHeight?: string | number;
|
package/lib/cjs/anchor/link.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import BaseComponent from '../_base/baseComponent';
|
|
4
4
|
import LinkFoundation, { LinkAdapter } from '@douyinfe/semi-foundation/lib/cjs/anchor/linkFoundation';
|
|
@@ -7,6 +7,7 @@ export interface LinkProps {
|
|
|
7
7
|
href?: string;
|
|
8
8
|
title?: string | React.ReactNode;
|
|
9
9
|
className?: string;
|
|
10
|
+
children?: ReactNode | undefined;
|
|
10
11
|
style?: React.CSSProperties;
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
}
|
|
@@ -34,7 +35,7 @@ export default class Link extends BaseComponent<LinkProps, {}> {
|
|
|
34
35
|
componentDidMount(): void;
|
|
35
36
|
componentDidUpdate(prevProps: LinkProps): void;
|
|
36
37
|
componentWillUnmount(): void;
|
|
37
|
-
renderTitle: () => React.
|
|
38
|
+
renderTitle: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
38
39
|
renderChildren: () => React.ReactNode;
|
|
39
40
|
render(): JSX.Element;
|
|
40
41
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { AutoCompleteAdapter, StateOptionItem, DataItem } from '@douyinfe/semi-foundation/lib/cjs/autoComplete/foundation';
|
|
4
4
|
import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
|
|
@@ -27,7 +27,7 @@ export interface AutoCompleteProps<T extends AutoCompleteItems> {
|
|
|
27
27
|
autoAdjustOverflow?: boolean;
|
|
28
28
|
autoFocus?: boolean;
|
|
29
29
|
className?: string;
|
|
30
|
-
children?:
|
|
30
|
+
children?: ReactNode | undefined;
|
|
31
31
|
data?: T[];
|
|
32
32
|
disabled?: boolean;
|
|
33
33
|
defaultOpen?: boolean;
|
|
@@ -15,7 +15,7 @@ export default class AvatarGroup extends PureComponent<AvatarGroupProps> {
|
|
|
15
15
|
renderMore: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
16
|
overlapFrom: PropTypes.Requireable<string>;
|
|
17
17
|
};
|
|
18
|
-
getAllAvatars():
|
|
18
|
+
getAllAvatars(): any[];
|
|
19
19
|
getMergeAvatars(avatars: React.ReactNode[]): React.ReactNode[];
|
|
20
20
|
renderMoreAvatar(restNumber: number, restAvatars: React.ReactNode[]): JSX.Element;
|
|
21
21
|
render(): JSX.Element;
|
|
@@ -4,7 +4,7 @@ export declare type AvatarShape = 'circle' | 'square';
|
|
|
4
4
|
export declare type AvatarSize = 'extra-extra-small' | 'extra-small' | 'small' | 'default' | 'medium' | 'large' | 'extra-large';
|
|
5
5
|
export declare type AvatarColor = 'amber' | 'blue' | 'cyan' | 'green' | 'grey' | 'indigo' | 'light-blue' | 'light-green' | 'lime' | 'orange' | 'pink' | 'purple' | 'red' | 'teal' | 'violet' | 'yellow';
|
|
6
6
|
export interface AvatarProps extends BaseProps {
|
|
7
|
-
children?: React.ReactNode;
|
|
7
|
+
children?: React.ReactNode | undefined;
|
|
8
8
|
color?: AvatarColor;
|
|
9
9
|
shape?: AvatarShape;
|
|
10
10
|
size?: AvatarSize;
|
|
@@ -22,7 +22,7 @@ export declare type AvatarGroupShape = 'circle' | 'square';
|
|
|
22
22
|
export declare type AvatarGroupSize = 'extra-extra-small' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
|
|
23
23
|
export declare type AvatarGroupOverlapFrom = 'start' | 'end';
|
|
24
24
|
export interface AvatarGroupProps {
|
|
25
|
-
children?: React.ReactNode;
|
|
25
|
+
children?: React.ReactNode | undefined;
|
|
26
26
|
shape?: AvatarGroupShape;
|
|
27
27
|
size?: AvatarGroupSize;
|
|
28
28
|
overlapFrom?: AvatarGroupOverlapFrom;
|
package/lib/cjs/badge/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { ContextValue } from '../configProvider/context';
|
|
3
4
|
import '@douyinfe/semi-foundation/lib/cjs/badge/badge.css';
|
|
4
5
|
export declare type BadgeType = 'primary' | 'secondary' | 'tertiary' | 'danger' | 'warning';
|
|
5
6
|
export declare type BadgeTheme = 'solid' | 'light' | 'inverted';
|
|
@@ -13,13 +14,13 @@ export interface BadgeProps {
|
|
|
13
14
|
overflowCount?: number;
|
|
14
15
|
style?: React.CSSProperties;
|
|
15
16
|
className?: string;
|
|
16
|
-
children?: React.ReactNode;
|
|
17
17
|
onMouseEnter?: (e: React.MouseEvent) => any;
|
|
18
18
|
onMouseLeave?: (e: React.MouseEvent) => any;
|
|
19
19
|
onClick?: (e: React.MouseEvent) => any;
|
|
20
|
+
children?: React.ReactNode | undefined;
|
|
20
21
|
}
|
|
21
22
|
export default class Badge extends PureComponent<BadgeProps> {
|
|
22
|
-
static contextType: React.Context<
|
|
23
|
+
static contextType: React.Context<ContextValue>;
|
|
23
24
|
static propTypes: {
|
|
24
25
|
count: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
25
26
|
dot: PropTypes.Requireable<boolean>;
|
|
@@ -43,5 +44,6 @@ export default class Badge extends PureComponent<BadgeProps> {
|
|
|
43
44
|
onMouseEnter: () => (...args: any[]) => void;
|
|
44
45
|
onMouseLeave: () => (...args: any[]) => void;
|
|
45
46
|
};
|
|
47
|
+
context: ContextValue;
|
|
46
48
|
render(): JSX.Element;
|
|
47
49
|
}
|
|
@@ -7,6 +7,7 @@ export declare type Type = 'info' | 'danger' | 'warning' | 'success';
|
|
|
7
7
|
export interface BannerProps {
|
|
8
8
|
type?: Type;
|
|
9
9
|
className?: string;
|
|
10
|
+
children?: React.ReactNode | undefined;
|
|
10
11
|
fullMode?: boolean;
|
|
11
12
|
title?: React.ReactNode;
|
|
12
13
|
description?: React.ReactNode;
|
|
@@ -44,7 +45,7 @@ export default class Banner extends BaseComponent<BannerProps, BannerState> {
|
|
|
44
45
|
componentDidMount(): void;
|
|
45
46
|
componentWillUnmount(): void;
|
|
46
47
|
remove: React.MouseEventHandler;
|
|
47
|
-
renderCloser(): React.
|
|
48
|
+
renderCloser(): string | number | boolean | React.ReactFragment | JSX.Element;
|
|
48
49
|
renderIcon(): JSX.Element;
|
|
49
50
|
render(): JSX.Element;
|
|
50
51
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { showToolTipProps } from './index';
|
|
3
3
|
import { BreadcrumbItemInfo } from './item';
|
|
4
|
-
export interface
|
|
4
|
+
export interface BreadContextType {
|
|
5
5
|
onClick?: (info: BreadcrumbItemInfo, event: React.MouseEvent) => void;
|
|
6
6
|
showTooltip?: boolean | showToolTipProps;
|
|
7
7
|
compact?: boolean;
|
|
8
8
|
separator?: string | React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
declare const BreadContext: React.Context<
|
|
10
|
+
declare const BreadContext: React.Context<BreadContextType>;
|
|
11
11
|
export default BreadContext;
|
|
@@ -5,7 +5,7 @@ import '@douyinfe/semi-foundation/lib/cjs/breadcrumb/breadcrumb.css';
|
|
|
5
5
|
import { noop } from '@douyinfe/semi-foundation/lib/cjs/utils/function';
|
|
6
6
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
7
7
|
import BreadcrumbItem, { RouteProps, BreadcrumbItemInfo } from './item';
|
|
8
|
-
import {
|
|
8
|
+
import { BreadContextType } from './bread-context';
|
|
9
9
|
import { TooltipProps } from '../tooltip';
|
|
10
10
|
export { RouteProps, BreadcrumbItemProps, BreadcrumbItemInfo } from './item';
|
|
11
11
|
export interface showToolTipProps {
|
|
@@ -33,7 +33,7 @@ interface BreadcrumbState {
|
|
|
33
33
|
isCollapsed: boolean;
|
|
34
34
|
}
|
|
35
35
|
declare class Breadcrumb extends BaseComponent<BreadcrumbProps, BreadcrumbState> {
|
|
36
|
-
static contextType: React.Context<
|
|
36
|
+
static contextType: React.Context<BreadContextType>;
|
|
37
37
|
static Item: typeof BreadcrumbItem;
|
|
38
38
|
static propTypes: {
|
|
39
39
|
routes: propTypes.Requireable<any[]>;
|
|
@@ -3,6 +3,7 @@ import propTypes from 'prop-types';
|
|
|
3
3
|
import { BreadcrumbItemAdapter, BreadcrumbItemInfo, Route } from '@douyinfe/semi-foundation/lib/cjs/breadcrumb/itemFoundation';
|
|
4
4
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
5
5
|
import { noop } from '@douyinfe/semi-foundation/lib/cjs/utils/function';
|
|
6
|
+
import { BreadContextType } from './bread-context';
|
|
6
7
|
export { BreadcrumbItemInfo };
|
|
7
8
|
export interface RouteProps extends Route {
|
|
8
9
|
icon?: React.ReactNode;
|
|
@@ -20,7 +21,7 @@ export interface BreadcrumbItemProps extends BaseProps {
|
|
|
20
21
|
declare type BreadcrumbItemState = Record<string, never>;
|
|
21
22
|
export default class BreadcrumbItem extends BaseComponent<BreadcrumbItemProps, BreadcrumbItemState> {
|
|
22
23
|
static isBreadcrumbItem: boolean;
|
|
23
|
-
static contextType: React.Context<
|
|
24
|
+
static contextType: React.Context<BreadContextType>;
|
|
24
25
|
static propTypes: {
|
|
25
26
|
onClick: propTypes.Requireable<(...args: any[]) => any>;
|
|
26
27
|
route: propTypes.Requireable<string | object>;
|
|
@@ -36,12 +37,23 @@ export default class BreadcrumbItem extends BaseComponent<BreadcrumbItemProps, B
|
|
|
36
37
|
onClick: typeof noop;
|
|
37
38
|
shouldRenderSeparator: boolean;
|
|
38
39
|
};
|
|
40
|
+
context: BreadContextType;
|
|
39
41
|
get adapter(): BreadcrumbItemAdapter<BreadcrumbItemProps, BreadcrumbItemState>;
|
|
40
42
|
constructor(props: BreadcrumbItemProps);
|
|
41
43
|
componentDidMount(): void;
|
|
42
44
|
componentWillUnmount(): void;
|
|
43
|
-
renderIcon: () =>
|
|
44
|
-
getTooltipOpt: () =>
|
|
45
|
+
renderIcon: () => string | number | boolean | React.ReactFragment | React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
46
|
+
getTooltipOpt: () => {
|
|
47
|
+
width: number;
|
|
48
|
+
ellipsisPos: string;
|
|
49
|
+
opts: {
|
|
50
|
+
autoAdjustOverflow: boolean;
|
|
51
|
+
position: string;
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
width: number;
|
|
55
|
+
ellipsisPos: string;
|
|
56
|
+
};
|
|
45
57
|
getItemInfo: () => BreadcrumbItemInfo;
|
|
46
58
|
renderBreadItem: () => JSX.Element;
|
|
47
59
|
renderItem: () => React.DetailedReactHTMLElement<{
|