@douyinfe/semi-ui 2.22.0-beta.0 → 2.22.0-beta.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/dist/css/semi.css +438 -38
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +4084 -5300
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/_cssAnimation/index.d.ts +39 -0
- package/lib/cjs/_cssAnimation/index.js +133 -0
- package/lib/cjs/anchor/index.d.ts +3 -3
- package/lib/cjs/anchor/link.d.ts +1 -1
- package/lib/cjs/autoComplete/index.d.ts +7 -8
- package/lib/cjs/autoComplete/option.d.ts +1 -1
- package/lib/cjs/banner/index.d.ts +2 -2
- package/lib/cjs/breadcrumb/index.d.ts +3 -3
- package/lib/cjs/breadcrumb/item.d.ts +3 -3
- package/lib/cjs/button/index.d.ts +2 -2
- package/lib/cjs/calendar/dayCalendar.d.ts +2 -2
- package/lib/cjs/calendar/index.d.ts +2 -2
- package/lib/cjs/calendar/monthCalendar.d.ts +2 -2
- package/lib/cjs/calendar/rangeCalendar.d.ts +2 -2
- package/lib/cjs/calendar/weekCalendar.d.ts +2 -2
- package/lib/cjs/card/cardGroup.d.ts +1 -1
- package/lib/cjs/carousel/index.d.ts +1 -1
- package/lib/cjs/cascader/index.d.ts +7 -8
- package/lib/cjs/cascader/index.js +8 -6
- package/lib/cjs/collapse/collapse-context.d.ts +1 -2
- package/lib/cjs/collapse/index.d.ts +3 -3
- package/lib/cjs/collapse/item.d.ts +2 -2
- package/lib/cjs/collapsible/index.d.ts +32 -19
- package/lib/cjs/collapsible/index.js +157 -121
- package/lib/cjs/configProvider/index.d.ts +1 -1
- package/lib/cjs/datePicker/dateInput.d.ts +3 -3
- package/lib/cjs/datePicker/datePicker.d.ts +12 -9
- package/lib/cjs/datePicker/datePicker.js +11 -13
- package/lib/cjs/datePicker/month.d.ts +1 -1
- package/lib/cjs/datePicker/month.js +5 -1
- package/lib/cjs/datePicker/monthsGrid.d.ts +7 -6
- package/lib/cjs/datePicker/monthsGrid.js +9 -26
- package/lib/cjs/datePicker/quickControl.d.ts +1 -1
- package/lib/cjs/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/cjs/datePicker/yearAndMonth.js +13 -8
- package/lib/cjs/descriptions/index.d.ts +1 -1
- package/lib/cjs/dropdown/dropdownItem.d.ts +2 -1
- package/lib/cjs/dropdown/dropdownItem.js +3 -1
- package/lib/cjs/dropdown/index.d.ts +5 -6
- package/lib/cjs/form/baseForm.d.ts +7 -5
- package/lib/cjs/form/errorMessage.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +4 -2
- package/lib/cjs/form/label.d.ts +1 -1
- package/lib/cjs/grid/col.d.ts +6 -6
- package/lib/cjs/grid/row.d.ts +1 -1
- package/lib/cjs/iconButton/index.d.ts +2 -2
- package/lib/cjs/image/image.d.ts +4 -4
- package/lib/cjs/image/preview.d.ts +1 -1
- package/lib/cjs/image/previewInner.d.ts +1 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +8 -0
- package/lib/cjs/inputNumber/index.d.ts +2 -2
- package/lib/cjs/locale/source/ro.d.ts +3 -3
- package/lib/cjs/modal/Modal.d.ts +6 -6
- package/lib/cjs/modal/Modal.js +80 -56
- package/lib/cjs/modal/ModalContent.js +6 -5
- package/lib/cjs/modal/confirm.d.ts +10 -10
- package/lib/cjs/modal/confirm.js +1 -15
- package/lib/cjs/modal/useModal/HookModal.d.ts +0 -2
- package/lib/cjs/modal/useModal/HookModal.js +6 -18
- package/lib/cjs/navigation/Footer.d.ts +1 -1
- package/lib/cjs/navigation/Header.d.ts +3 -3
- package/lib/cjs/navigation/Item.d.ts +4 -4
- package/lib/cjs/navigation/Item.js +11 -5
- package/lib/cjs/navigation/OpenIconTransition.d.ts +1 -15
- package/lib/cjs/navigation/OpenIconTransition.js +1 -82
- package/lib/cjs/navigation/SubNav.d.ts +4 -4
- package/lib/cjs/navigation/SubNav.js +43 -27
- package/lib/cjs/navigation/index.d.ts +8 -11
- package/lib/cjs/notification/index.d.ts +0 -1
- package/lib/cjs/notification/index.js +25 -15
- package/lib/cjs/notification/notice.d.ts +3 -1
- package/lib/cjs/notification/notice.js +3 -1
- package/lib/cjs/popconfirm/index.d.ts +4 -5
- package/lib/cjs/popover/index.d.ts +8 -8
- package/lib/cjs/popover/index.js +1 -1
- package/lib/cjs/progress/index.d.ts +4 -4
- package/lib/cjs/rating/index.d.ts +1 -1
- package/lib/cjs/rating/item.d.ts +1 -1
- package/lib/cjs/scrollList/index.d.ts +1 -1
- package/lib/cjs/scrollList/scrollItem.d.ts +3 -3
- package/lib/cjs/scrollList/scrollItem.js +2 -2
- package/lib/cjs/select/index.d.ts +11 -6
- package/lib/cjs/select/index.js +108 -60
- package/lib/cjs/select/option.d.ts +1 -1
- package/lib/cjs/select/optionGroup.d.ts +1 -1
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +8 -0
- package/lib/cjs/sideSheet/SideSheetContent.js +10 -6
- package/lib/cjs/sideSheet/index.d.ts +4 -4
- package/lib/cjs/sideSheet/index.js +69 -39
- package/lib/cjs/space/index.d.ts +1 -1
- package/lib/cjs/spin/index.js +1 -4
- package/lib/cjs/table/Body/BaseRow.d.ts +5 -5
- package/lib/cjs/table/Body/ExpandedRow.d.ts +3 -3
- package/lib/cjs/table/Body/SectionRow.d.ts +3 -3
- package/lib/cjs/table/Column.d.ts +4 -4
- package/lib/cjs/table/ColumnShape.d.ts +4 -4
- package/lib/cjs/table/ColumnSorter.d.ts +1 -1
- package/lib/cjs/table/CustomExpandIcon.d.ts +1 -1
- package/lib/cjs/table/CustomExpandIcon.js +13 -5
- package/lib/cjs/table/Table.d.ts +16 -16
- package/lib/cjs/table/TableCell.d.ts +4 -4
- package/lib/cjs/table/TableHeaderRow.d.ts +2 -2
- package/lib/cjs/table/TablePagination.d.ts +1 -1
- package/lib/cjs/table/index.d.ts +15 -15
- package/lib/cjs/tabs/TabPane.d.ts +2 -8
- package/lib/cjs/tabs/TabPane.js +40 -38
- package/lib/cjs/tabs/index.d.ts +5 -3
- package/lib/cjs/tabs/index.js +26 -4
- package/lib/cjs/tabs/interface.d.ts +2 -0
- package/lib/cjs/tag/group.d.ts +1 -0
- package/lib/cjs/tag/group.js +6 -3
- package/lib/cjs/tag/index.d.ts +1 -1
- package/lib/cjs/tag/index.js +1 -0
- package/lib/cjs/tag/interface.d.ts +3 -1
- package/lib/cjs/tagInput/index.d.ts +3 -3
- package/lib/cjs/timePicker/Combobox.js +4 -8
- package/lib/cjs/timePicker/PanelShape.d.ts +2 -2
- package/lib/cjs/timePicker/TimePicker.d.ts +11 -11
- package/lib/cjs/timePicker/TimePicker.js +3 -1
- package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
- package/lib/cjs/timePicker/index.d.ts +10 -9
- package/lib/cjs/timeline/index.d.ts +1 -1
- package/lib/cjs/toast/index.d.ts +2 -4
- package/lib/cjs/toast/index.js +29 -14
- package/lib/cjs/toast/toast.d.ts +4 -2
- package/lib/cjs/toast/toast.js +3 -1
- package/lib/cjs/tooltip/index.d.ts +8 -9
- package/lib/cjs/tooltip/index.js +30 -37
- package/lib/cjs/transfer/index.d.ts +1 -1
- package/lib/cjs/tree/autoSizer.d.ts +2 -2
- package/lib/cjs/tree/index.d.ts +5 -5
- package/lib/cjs/tree/nodeCollapsible.d.ts +11 -0
- package/lib/cjs/tree/nodeCollapsible.js +50 -0
- package/lib/cjs/tree/nodeList.js +6 -5
- package/lib/cjs/tree/treeNode.d.ts +1 -1
- package/lib/cjs/treeSelect/index.d.ts +12 -9
- package/lib/cjs/treeSelect/index.js +23 -9
- package/lib/cjs/trigger/index.d.ts +1 -1
- package/lib/cjs/typography/base.d.ts +8 -8
- package/lib/cjs/typography/index.d.ts +2 -0
- package/lib/cjs/typography/index.js +3 -0
- package/lib/cjs/typography/interface.d.ts +2 -0
- package/lib/cjs/typography/numeral.d.ts +68 -0
- package/lib/cjs/typography/numeral.js +106 -0
- package/lib/cjs/typography/paragraph.d.ts +3 -3
- package/lib/cjs/typography/text.d.ts +4 -4
- package/lib/cjs/typography/title.d.ts +4 -4
- package/lib/cjs/upload/fileCard.d.ts +1 -1
- package/lib/es/_cssAnimation/index.d.ts +39 -0
- package/lib/es/_cssAnimation/index.js +122 -0
- package/lib/es/anchor/index.d.ts +3 -3
- package/lib/es/anchor/link.d.ts +1 -1
- package/lib/es/autoComplete/index.d.ts +7 -8
- package/lib/es/autoComplete/option.d.ts +1 -1
- package/lib/es/banner/index.d.ts +2 -2
- package/lib/es/breadcrumb/index.d.ts +3 -3
- package/lib/es/breadcrumb/item.d.ts +3 -3
- package/lib/es/button/index.d.ts +2 -2
- package/lib/es/calendar/dayCalendar.d.ts +2 -2
- package/lib/es/calendar/index.d.ts +2 -2
- package/lib/es/calendar/monthCalendar.d.ts +2 -2
- package/lib/es/calendar/rangeCalendar.d.ts +2 -2
- package/lib/es/calendar/weekCalendar.d.ts +2 -2
- package/lib/es/card/cardGroup.d.ts +1 -1
- package/lib/es/carousel/index.d.ts +1 -1
- package/lib/es/cascader/index.d.ts +7 -8
- package/lib/es/cascader/index.js +8 -6
- package/lib/es/collapse/collapse-context.d.ts +1 -2
- package/lib/es/collapse/index.d.ts +3 -3
- package/lib/es/collapse/item.d.ts +2 -2
- package/lib/es/collapsible/index.d.ts +32 -19
- package/lib/es/collapsible/index.js +158 -119
- package/lib/es/configProvider/index.d.ts +1 -1
- package/lib/es/datePicker/dateInput.d.ts +3 -3
- package/lib/es/datePicker/datePicker.d.ts +12 -9
- package/lib/es/datePicker/datePicker.js +11 -13
- package/lib/es/datePicker/month.d.ts +1 -1
- package/lib/es/datePicker/month.js +5 -1
- package/lib/es/datePicker/monthsGrid.d.ts +7 -6
- package/lib/es/datePicker/monthsGrid.js +9 -26
- package/lib/es/datePicker/quickControl.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonth.js +13 -8
- package/lib/es/descriptions/index.d.ts +1 -1
- package/lib/es/dropdown/dropdownItem.d.ts +2 -1
- package/lib/es/dropdown/dropdownItem.js +3 -1
- package/lib/es/dropdown/index.d.ts +5 -6
- package/lib/es/form/baseForm.d.ts +7 -5
- package/lib/es/form/errorMessage.d.ts +1 -1
- package/lib/es/form/field.d.ts +4 -2
- package/lib/es/form/label.d.ts +1 -1
- package/lib/es/grid/col.d.ts +6 -6
- package/lib/es/grid/row.d.ts +1 -1
- package/lib/es/iconButton/index.d.ts +2 -2
- package/lib/es/image/image.d.ts +4 -4
- package/lib/es/image/preview.d.ts +1 -1
- package/lib/es/image/previewInner.d.ts +1 -1
- package/lib/es/index.d.ts +1 -0
- package/lib/es/index.js +1 -0
- package/lib/es/inputNumber/index.d.ts +2 -2
- package/lib/es/locale/source/ro.d.ts +3 -3
- package/lib/es/modal/Modal.d.ts +6 -6
- package/lib/es/modal/Modal.js +79 -56
- package/lib/es/modal/ModalContent.js +6 -5
- package/lib/es/modal/confirm.d.ts +10 -10
- package/lib/es/modal/confirm.js +1 -14
- package/lib/es/modal/useModal/HookModal.d.ts +0 -2
- package/lib/es/modal/useModal/HookModal.js +7 -19
- package/lib/es/navigation/Footer.d.ts +1 -1
- package/lib/es/navigation/Header.d.ts +3 -3
- package/lib/es/navigation/Item.d.ts +4 -4
- package/lib/es/navigation/Item.js +11 -5
- package/lib/es/navigation/OpenIconTransition.d.ts +1 -15
- package/lib/es/navigation/OpenIconTransition.js +1 -66
- package/lib/es/navigation/SubNav.d.ts +4 -4
- package/lib/es/navigation/SubNav.js +43 -28
- package/lib/es/navigation/index.d.ts +8 -11
- package/lib/es/notification/index.d.ts +0 -1
- package/lib/es/notification/index.js +24 -14
- package/lib/es/notification/notice.d.ts +3 -1
- package/lib/es/notification/notice.js +3 -1
- package/lib/es/popconfirm/index.d.ts +4 -5
- package/lib/es/popover/index.d.ts +8 -8
- package/lib/es/popover/index.js +1 -1
- package/lib/es/progress/index.d.ts +4 -4
- package/lib/es/rating/index.d.ts +1 -1
- package/lib/es/rating/item.d.ts +1 -1
- package/lib/es/scrollList/index.d.ts +1 -1
- package/lib/es/scrollList/scrollItem.d.ts +3 -3
- package/lib/es/scrollList/scrollItem.js +3 -3
- package/lib/es/select/index.d.ts +11 -6
- package/lib/es/select/index.js +108 -60
- package/lib/es/select/option.d.ts +1 -1
- package/lib/es/select/optionGroup.d.ts +1 -1
- package/lib/es/sideSheet/SideSheetContent.d.ts +8 -0
- package/lib/es/sideSheet/SideSheetContent.js +10 -6
- package/lib/es/sideSheet/index.d.ts +4 -4
- package/lib/es/sideSheet/index.js +67 -37
- package/lib/es/space/index.d.ts +1 -1
- package/lib/es/spin/index.js +1 -4
- package/lib/es/table/Body/BaseRow.d.ts +5 -5
- package/lib/es/table/Body/ExpandedRow.d.ts +3 -3
- package/lib/es/table/Body/SectionRow.d.ts +3 -3
- package/lib/es/table/Column.d.ts +4 -4
- package/lib/es/table/ColumnShape.d.ts +4 -4
- package/lib/es/table/ColumnSorter.d.ts +1 -1
- package/lib/es/table/CustomExpandIcon.d.ts +1 -1
- package/lib/es/table/CustomExpandIcon.js +13 -5
- package/lib/es/table/Table.d.ts +16 -16
- package/lib/es/table/TableCell.d.ts +4 -4
- package/lib/es/table/TableHeaderRow.d.ts +2 -2
- package/lib/es/table/TablePagination.d.ts +1 -1
- package/lib/es/table/index.d.ts +15 -15
- package/lib/es/tabs/TabPane.d.ts +2 -8
- package/lib/es/tabs/TabPane.js +40 -38
- package/lib/es/tabs/index.d.ts +5 -3
- package/lib/es/tabs/index.js +26 -4
- package/lib/es/tabs/interface.d.ts +2 -0
- package/lib/es/tag/group.d.ts +1 -0
- package/lib/es/tag/group.js +6 -3
- package/lib/es/tag/index.d.ts +1 -1
- package/lib/es/tag/index.js +1 -0
- package/lib/es/tag/interface.d.ts +3 -1
- package/lib/es/tagInput/index.d.ts +3 -3
- package/lib/es/timePicker/Combobox.js +4 -8
- package/lib/es/timePicker/PanelShape.d.ts +2 -2
- package/lib/es/timePicker/TimePicker.d.ts +11 -11
- package/lib/es/timePicker/TimePicker.js +3 -1
- package/lib/es/timePicker/TimeShape.d.ts +1 -1
- package/lib/es/timePicker/index.d.ts +10 -9
- package/lib/es/timeline/index.d.ts +1 -1
- package/lib/es/toast/index.d.ts +2 -4
- package/lib/es/toast/index.js +27 -13
- package/lib/es/toast/toast.d.ts +4 -2
- package/lib/es/toast/toast.js +3 -1
- package/lib/es/tooltip/index.d.ts +8 -9
- package/lib/es/tooltip/index.js +27 -36
- package/lib/es/transfer/index.d.ts +1 -1
- package/lib/es/tree/autoSizer.d.ts +2 -2
- package/lib/es/tree/index.d.ts +5 -5
- package/lib/es/tree/nodeCollapsible.d.ts +11 -0
- package/lib/es/tree/nodeCollapsible.js +35 -0
- package/lib/es/tree/nodeList.js +6 -5
- package/lib/es/tree/treeNode.d.ts +1 -1
- package/lib/es/treeSelect/index.d.ts +12 -9
- package/lib/es/treeSelect/index.js +22 -8
- package/lib/es/trigger/index.d.ts +1 -1
- package/lib/es/typography/base.d.ts +8 -8
- package/lib/es/typography/index.d.ts +2 -0
- package/lib/es/typography/index.js +2 -0
- package/lib/es/typography/interface.d.ts +2 -0
- package/lib/es/typography/numeral.d.ts +68 -0
- package/lib/es/typography/numeral.js +86 -0
- package/lib/es/typography/paragraph.d.ts +3 -3
- package/lib/es/typography/text.d.ts +4 -4
- package/lib/es/typography/title.d.ts +4 -4
- package/lib/es/upload/fileCard.d.ts +1 -1
- package/package.json +7 -7
- package/lib/cjs/motions/Rotate.d.ts +0 -23
- package/lib/cjs/motions/Rotate.js +0 -76
- package/lib/cjs/navigation/SubNavTransition.d.ts +0 -17
- package/lib/cjs/navigation/SubNavTransition.js +0 -83
- package/lib/cjs/notification/NoticeTransition.d.ts +0 -10
- package/lib/cjs/notification/NoticeTransition.js +0 -85
- package/lib/cjs/sideSheet/SideSheetTransition.d.ts +0 -12
- package/lib/cjs/sideSheet/SideSheetTransition.js +0 -115
- package/lib/cjs/tabs/TabPaneTransition.d.ts +0 -4
- package/lib/cjs/tabs/TabPaneTransition.js +0 -114
- package/lib/cjs/toast/ToastTransition.d.ts +0 -7
- package/lib/cjs/toast/ToastTransition.js +0 -66
- package/lib/cjs/tooltip/TooltipStyledTransition.d.ts +0 -9
- package/lib/cjs/tooltip/TooltipStyledTransition.js +0 -52
- package/lib/cjs/tree/collapse.d.ts +0 -29
- package/lib/cjs/tree/collapse.js +0 -155
- package/lib/es/motions/Rotate.d.ts +0 -23
- package/lib/es/motions/Rotate.js +0 -60
- package/lib/es/navigation/SubNavTransition.d.ts +0 -17
- package/lib/es/navigation/SubNavTransition.js +0 -66
- package/lib/es/notification/NoticeTransition.d.ts +0 -10
- package/lib/es/notification/NoticeTransition.js +0 -74
- package/lib/es/sideSheet/SideSheetTransition.d.ts +0 -12
- package/lib/es/sideSheet/SideSheetTransition.js +0 -102
- package/lib/es/tabs/TabPaneTransition.d.ts +0 -4
- package/lib/es/tabs/TabPaneTransition.js +0 -103
- package/lib/es/toast/ToastTransition.d.ts +0 -7
- package/lib/es/toast/ToastTransition.js +0 -55
- package/lib/es/tooltip/TooltipStyledTransition.d.ts +0 -9
- package/lib/es/tooltip/TooltipStyledTransition.js +0 -38
- package/lib/es/tree/collapse.d.ts +0 -29
- package/lib/es/tree/collapse.js +0 -136
package/lib/es/modal/Modal.js
CHANGED
|
@@ -26,6 +26,7 @@ import '@douyinfe/semi-foundation/lib/es/modal/modal.css';
|
|
|
26
26
|
import BaseComponent from '../_base/baseComponent';
|
|
27
27
|
import confirm, { withConfirm, withError, withInfo, withSuccess, withWarning } from './confirm';
|
|
28
28
|
import useModal from './useModal';
|
|
29
|
+
import CSSAnimation from "../_cssAnimation";
|
|
29
30
|
export const destroyFns = [];
|
|
30
31
|
|
|
31
32
|
class Modal extends BaseComponent {
|
|
@@ -40,19 +41,13 @@ class Modal extends BaseComponent {
|
|
|
40
41
|
this.foundation.handleOk(e);
|
|
41
42
|
};
|
|
42
43
|
|
|
43
|
-
this.
|
|
44
|
+
this.updateState = () => {
|
|
44
45
|
const {
|
|
45
46
|
visible
|
|
46
47
|
} = this.props;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (!visible && !hidden) {
|
|
52
|
-
this.foundation.toggleHidden(true, () => this.foundation.afterClose());
|
|
53
|
-
} else if (visible && this.state.hidden) {
|
|
54
|
-
this.foundation.toggleHidden(false);
|
|
55
|
-
}
|
|
48
|
+
this.foundation.toggleDisplayNone(!visible);
|
|
49
|
+
const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered);
|
|
50
|
+
this.foundation.setShouldRender(shouldRender);
|
|
56
51
|
};
|
|
57
52
|
|
|
58
53
|
this.renderFooter = () => {
|
|
@@ -132,39 +127,62 @@ class Modal extends BaseComponent {
|
|
|
132
127
|
}
|
|
133
128
|
|
|
134
129
|
const classList = cls(className, {
|
|
135
|
-
["".concat(cssClasses.DIALOG, "-displayNone")]: keepDOM && this.state.
|
|
130
|
+
["".concat(cssClasses.DIALOG, "-displayNone")]: keepDOM && this.state.displayNone
|
|
136
131
|
});
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
["".concat(cssClasses.DIALOG, "-mask-animate-hide")]: !visible,
|
|
143
|
-
["".concat(cssClasses.DIALOG, "-mask-animate-show")]: visible
|
|
144
|
-
}) : null;
|
|
132
|
+
|
|
133
|
+
if (this.state.shouldRender) {
|
|
134
|
+
this._haveRendered = true;
|
|
135
|
+
}
|
|
136
|
+
|
|
145
137
|
return /*#__PURE__*/React.createElement(Portal, {
|
|
146
138
|
style: wrapperStyle,
|
|
147
139
|
getPopupContainer: getPopupContainer
|
|
148
|
-
}, /*#__PURE__*/React.createElement(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
className: classList,
|
|
153
|
-
getPopupContainer: getPopupContainer,
|
|
154
|
-
maskStyle: maskStyle,
|
|
155
|
-
style: style,
|
|
156
|
-
ref: this.modalRef,
|
|
140
|
+
}, /*#__PURE__*/React.createElement(CSSAnimation, {
|
|
141
|
+
motion: this.props.motion,
|
|
142
|
+
animationState: visible ? 'enter' : 'leave',
|
|
143
|
+
startClassName: visible ? "".concat(cssClasses.DIALOG, "-content-animate-show") : "".concat(cssClasses.DIALOG, "-content-animate-hide"),
|
|
157
144
|
onAnimationEnd: () => {
|
|
158
|
-
this.
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
145
|
+
this.updateState();
|
|
146
|
+
}
|
|
147
|
+
}, _ref => {
|
|
148
|
+
let {
|
|
149
|
+
animationClassName,
|
|
150
|
+
animationEventsNeedBind
|
|
151
|
+
} = _ref;
|
|
152
|
+
return /*#__PURE__*/React.createElement(CSSAnimation, {
|
|
153
|
+
motion: this.props.motion,
|
|
154
|
+
animationState: visible ? 'enter' : 'leave',
|
|
155
|
+
startClassName: visible ? "".concat(cssClasses.DIALOG, "-mask-animate-show") : "".concat(cssClasses.DIALOG, "-mask-animate-hide"),
|
|
156
|
+
onAnimationEnd: () => {
|
|
157
|
+
this.updateState();
|
|
158
|
+
}
|
|
159
|
+
}, _ref2 => {
|
|
160
|
+
let {
|
|
161
|
+
animationClassName: maskAnimationClassName,
|
|
162
|
+
animationEventsNeedBind: maskAnimationEventsNeedBind
|
|
163
|
+
} = _ref2;
|
|
164
|
+
return this.state.shouldRender ? /*#__PURE__*/React.createElement(ModalContent, Object.assign({}, restProps, {
|
|
165
|
+
contentExtraProps: animationEventsNeedBind,
|
|
166
|
+
maskExtraProps: maskAnimationEventsNeedBind,
|
|
167
|
+
isFullScreen: this.state.isFullScreen,
|
|
168
|
+
contentClassName: animationClassName,
|
|
169
|
+
maskClassName: maskAnimationClassName,
|
|
170
|
+
className: classList,
|
|
171
|
+
getPopupContainer: getPopupContainer,
|
|
172
|
+
maskStyle: maskStyle,
|
|
173
|
+
style: style,
|
|
174
|
+
ref: this.modalRef,
|
|
175
|
+
footer: renderFooter,
|
|
176
|
+
onClose: this.handleCancel
|
|
177
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
178
|
+
});
|
|
179
|
+
}));
|
|
163
180
|
};
|
|
164
181
|
|
|
165
182
|
this.state = {
|
|
166
|
-
|
|
167
|
-
isFullScreen: props.fullScreen
|
|
183
|
+
displayNone: !props.visible,
|
|
184
|
+
isFullScreen: props.fullScreen,
|
|
185
|
+
shouldRender: this.props.visible || this.props.keepDOM && !this.props.lazyRender
|
|
168
186
|
};
|
|
169
187
|
this.foundation = new ModalFoundation(this.adapter);
|
|
170
188
|
this.modalRef = /*#__PURE__*/React.createRef();
|
|
@@ -204,15 +222,12 @@ class Modal extends BaseComponent {
|
|
|
204
222
|
this.props.onOk(e);
|
|
205
223
|
},
|
|
206
224
|
notifyClose: () => {
|
|
207
|
-
var _a, _b;
|
|
208
|
-
|
|
209
|
-
(_b = (_a = this.props.motion) === null || _a === void 0 ? void 0 : _a.didLeave) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
210
225
|
this.props.afterClose();
|
|
211
226
|
},
|
|
212
|
-
|
|
213
|
-
if (
|
|
227
|
+
toggleDisplayNone: (displayNone, callback) => {
|
|
228
|
+
if (displayNone !== this.state.displayNone) {
|
|
214
229
|
this.setState({
|
|
215
|
-
|
|
230
|
+
displayNone: displayNone
|
|
216
231
|
}, callback || _noop);
|
|
217
232
|
}
|
|
218
233
|
},
|
|
@@ -222,6 +237,13 @@ class Modal extends BaseComponent {
|
|
|
222
237
|
isFullScreen
|
|
223
238
|
});
|
|
224
239
|
}
|
|
240
|
+
},
|
|
241
|
+
setShouldRender: shouldRender => {
|
|
242
|
+
if (shouldRender !== this.state.shouldRender) {
|
|
243
|
+
this.setState({
|
|
244
|
+
shouldRender
|
|
245
|
+
});
|
|
246
|
+
}
|
|
225
247
|
}
|
|
226
248
|
});
|
|
227
249
|
}
|
|
@@ -233,6 +255,14 @@ class Modal extends BaseComponent {
|
|
|
233
255
|
newState.isFullScreen = props.fullScreen;
|
|
234
256
|
}
|
|
235
257
|
|
|
258
|
+
if (props.visible && prevState.displayNone) {
|
|
259
|
+
newState.displayNone = false;
|
|
260
|
+
} //
|
|
261
|
+
// if (!props.visible && !props.motion && !prevState.displayNone) {
|
|
262
|
+
// newState.displayNone = true;
|
|
263
|
+
// }
|
|
264
|
+
|
|
265
|
+
|
|
236
266
|
return newState;
|
|
237
267
|
}
|
|
238
268
|
|
|
@@ -250,7 +280,6 @@ class Modal extends BaseComponent {
|
|
|
250
280
|
|
|
251
281
|
if (this.props.visible) {
|
|
252
282
|
this.foundation.beforeShow();
|
|
253
|
-
this._active = this._active || this.props.visible;
|
|
254
283
|
}
|
|
255
284
|
}
|
|
256
285
|
|
|
@@ -258,15 +287,16 @@ class Modal extends BaseComponent {
|
|
|
258
287
|
// hide => show
|
|
259
288
|
if (!prevProps.visible && this.props.visible) {
|
|
260
289
|
this.foundation.beforeShow();
|
|
261
|
-
}
|
|
290
|
+
}
|
|
262
291
|
|
|
292
|
+
const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered);
|
|
263
293
|
|
|
264
|
-
if (
|
|
265
|
-
this.foundation.
|
|
294
|
+
if (shouldRender === true && this.state.shouldRender === false) {
|
|
295
|
+
this.foundation.setShouldRender(true);
|
|
266
296
|
}
|
|
267
297
|
|
|
268
|
-
if (!this.
|
|
269
|
-
this.
|
|
298
|
+
if (!prevState.displayNone && this.state.displayNone) {
|
|
299
|
+
this.foundation.afterHide();
|
|
270
300
|
}
|
|
271
301
|
}
|
|
272
302
|
|
|
@@ -282,14 +312,7 @@ class Modal extends BaseComponent {
|
|
|
282
312
|
keepDOM,
|
|
283
313
|
lazyRender
|
|
284
314
|
} = this.props;
|
|
285
|
-
|
|
286
|
-
const shouldRender = (visible || keepDOM) && (!lazyRender || this._active) || !this.state.hidden;
|
|
287
|
-
|
|
288
|
-
if (shouldRender) {
|
|
289
|
-
return this.renderDialog();
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
return null;
|
|
315
|
+
return this.renderDialog();
|
|
293
316
|
}
|
|
294
317
|
|
|
295
318
|
}
|
|
@@ -322,7 +345,7 @@ Modal.propTypes = {
|
|
|
322
345
|
header: PropTypes.node,
|
|
323
346
|
footer: PropTypes.node,
|
|
324
347
|
hasCancel: PropTypes.bool,
|
|
325
|
-
motion: PropTypes.
|
|
348
|
+
motion: PropTypes.bool,
|
|
326
349
|
children: PropTypes.node,
|
|
327
350
|
getPopupContainer: PropTypes.func,
|
|
328
351
|
getContainerContext: PropTypes.func,
|
|
@@ -66,11 +66,12 @@ export default class ModalContent extends BaseComponent {
|
|
|
66
66
|
if (mask) {
|
|
67
67
|
const className = cls("".concat(cssClasses.DIALOG, "-mask"), {// [`${cssClasses.DIALOG}-mask-hidden`]: !props.visible,
|
|
68
68
|
});
|
|
69
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
70
|
-
key: "mask"
|
|
69
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
70
|
+
key: "mask"
|
|
71
|
+
}, this.props.maskExtraProps, {
|
|
71
72
|
className: cls(className, maskClassName),
|
|
72
73
|
style: props.maskStyle
|
|
73
|
-
});
|
|
74
|
+
}));
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
return null;
|
|
@@ -334,7 +335,7 @@ export default class ModalContent extends BaseComponent {
|
|
|
334
335
|
const containerContext = getContainerContext();
|
|
335
336
|
const elem = /*#__PURE__*/React.createElement("div", {
|
|
336
337
|
className: classList
|
|
337
|
-
}, this.getMaskElement(), /*#__PURE__*/React.createElement("div", {
|
|
338
|
+
}, this.getMaskElement(), /*#__PURE__*/React.createElement("div", Object.assign({
|
|
338
339
|
role: "none",
|
|
339
340
|
className: cls({
|
|
340
341
|
["".concat(cssClasses.DIALOG, "-wrap")]: true,
|
|
@@ -342,7 +343,7 @@ export default class ModalContent extends BaseComponent {
|
|
|
342
343
|
}),
|
|
343
344
|
onClick: maskClosable ? this.onMaskClick : null,
|
|
344
345
|
onMouseUp: maskClosable ? this.onMaskMouseUp : null
|
|
345
|
-
}, this.getDialogElement())); // eslint-disable-next-line max-len
|
|
346
|
+
}, this.props.contentExtraProps), this.getDialogElement())); // eslint-disable-next-line max-len
|
|
346
347
|
|
|
347
348
|
return containerContext && containerContext.Provider ? /*#__PURE__*/React.createElement(containerContext.Provider, {
|
|
348
349
|
value: containerContext.value
|
|
@@ -17,7 +17,7 @@ export declare function withInfo(props: ModalReactProps): {
|
|
|
17
17
|
bodyStyle?: React.CSSProperties;
|
|
18
18
|
maskStyle?: React.CSSProperties;
|
|
19
19
|
style?: React.CSSProperties;
|
|
20
|
-
icon: React.
|
|
20
|
+
icon: string | number | boolean | React.ReactFragment | JSX.Element;
|
|
21
21
|
closeIcon?: React.ReactNode;
|
|
22
22
|
title?: React.ReactNode;
|
|
23
23
|
content?: React.ReactNode;
|
|
@@ -37,7 +37,7 @@ export declare function withInfo(props: ModalReactProps): {
|
|
|
37
37
|
mask?: boolean;
|
|
38
38
|
maskClosable?: boolean;
|
|
39
39
|
maskFixed?: boolean;
|
|
40
|
-
motion?:
|
|
40
|
+
motion?: boolean;
|
|
41
41
|
okText?: string;
|
|
42
42
|
okType?: import("@douyinfe/semi-foundation/lib/es/modal/modalFoundation").OKType;
|
|
43
43
|
visible?: boolean;
|
|
@@ -60,7 +60,7 @@ export declare function withSuccess(props: ModalReactProps): {
|
|
|
60
60
|
bodyStyle?: React.CSSProperties;
|
|
61
61
|
maskStyle?: React.CSSProperties;
|
|
62
62
|
style?: React.CSSProperties;
|
|
63
|
-
icon: React.
|
|
63
|
+
icon: string | number | boolean | React.ReactFragment | JSX.Element;
|
|
64
64
|
closeIcon?: React.ReactNode;
|
|
65
65
|
title?: React.ReactNode;
|
|
66
66
|
content?: React.ReactNode;
|
|
@@ -80,7 +80,7 @@ export declare function withSuccess(props: ModalReactProps): {
|
|
|
80
80
|
mask?: boolean;
|
|
81
81
|
maskClosable?: boolean;
|
|
82
82
|
maskFixed?: boolean;
|
|
83
|
-
motion?:
|
|
83
|
+
motion?: boolean;
|
|
84
84
|
okText?: string;
|
|
85
85
|
okType?: import("@douyinfe/semi-foundation/lib/es/modal/modalFoundation").OKType;
|
|
86
86
|
visible?: boolean;
|
|
@@ -103,7 +103,7 @@ export declare function withWarning(props: ModalReactProps): {
|
|
|
103
103
|
bodyStyle?: React.CSSProperties;
|
|
104
104
|
maskStyle?: React.CSSProperties;
|
|
105
105
|
style?: React.CSSProperties;
|
|
106
|
-
icon: React.
|
|
106
|
+
icon: string | number | boolean | React.ReactFragment | JSX.Element;
|
|
107
107
|
closeIcon?: React.ReactNode;
|
|
108
108
|
title?: React.ReactNode;
|
|
109
109
|
content?: React.ReactNode;
|
|
@@ -123,7 +123,7 @@ export declare function withWarning(props: ModalReactProps): {
|
|
|
123
123
|
mask?: boolean;
|
|
124
124
|
maskClosable?: boolean;
|
|
125
125
|
maskFixed?: boolean;
|
|
126
|
-
motion?:
|
|
126
|
+
motion?: boolean;
|
|
127
127
|
okText?: string;
|
|
128
128
|
okType?: import("@douyinfe/semi-foundation/lib/es/modal/modalFoundation").OKType;
|
|
129
129
|
visible?: boolean;
|
|
@@ -146,7 +146,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
146
146
|
bodyStyle?: React.CSSProperties;
|
|
147
147
|
maskStyle?: React.CSSProperties;
|
|
148
148
|
style?: React.CSSProperties;
|
|
149
|
-
icon: React.
|
|
149
|
+
icon: string | number | boolean | React.ReactFragment | JSX.Element;
|
|
150
150
|
closeIcon?: React.ReactNode;
|
|
151
151
|
title?: React.ReactNode;
|
|
152
152
|
content?: React.ReactNode;
|
|
@@ -166,7 +166,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
166
166
|
mask?: boolean;
|
|
167
167
|
maskClosable?: boolean;
|
|
168
168
|
maskFixed?: boolean;
|
|
169
|
-
motion?:
|
|
169
|
+
motion?: boolean;
|
|
170
170
|
okText?: string;
|
|
171
171
|
okType?: import("@douyinfe/semi-foundation/lib/es/modal/modalFoundation").OKType;
|
|
172
172
|
visible?: boolean;
|
|
@@ -189,7 +189,7 @@ export declare function withConfirm(props: ModalReactProps): {
|
|
|
189
189
|
bodyStyle?: React.CSSProperties;
|
|
190
190
|
maskStyle?: React.CSSProperties;
|
|
191
191
|
style?: React.CSSProperties;
|
|
192
|
-
icon: React.
|
|
192
|
+
icon: string | number | boolean | React.ReactFragment | JSX.Element;
|
|
193
193
|
closeIcon?: React.ReactNode;
|
|
194
194
|
title?: React.ReactNode;
|
|
195
195
|
content?: React.ReactNode;
|
|
@@ -209,7 +209,7 @@ export declare function withConfirm(props: ModalReactProps): {
|
|
|
209
209
|
mask?: boolean;
|
|
210
210
|
maskClosable?: boolean;
|
|
211
211
|
maskFixed?: boolean;
|
|
212
|
-
motion?:
|
|
212
|
+
motion?: boolean;
|
|
213
213
|
okText?: string;
|
|
214
214
|
okType?: import("@douyinfe/semi-foundation/lib/es/modal/modalFoundation").OKType;
|
|
215
215
|
visible?: boolean;
|
package/lib/es/modal/confirm.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _get from "lodash/get";
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import ReactDOM from 'react-dom';
|
|
4
3
|
import { destroyFns } from './Modal';
|
|
@@ -28,21 +27,9 @@ export default function confirm(props) {
|
|
|
28
27
|
}
|
|
29
28
|
};
|
|
30
29
|
|
|
31
|
-
const mergedMotion = typeof props.motion === 'undefined' || props.motion ? Object.assign(Object.assign({}, props.motion), {
|
|
32
|
-
didLeave: function () {
|
|
33
|
-
const didLeave = _get(props.motion, 'didLeave');
|
|
34
|
-
|
|
35
|
-
if (typeof didLeave === 'function') {
|
|
36
|
-
didLeave(...arguments);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
destroy();
|
|
40
|
-
}
|
|
41
|
-
}) : false;
|
|
42
|
-
|
|
43
30
|
function render(renderProps) {
|
|
44
31
|
ReactDOM.render( /*#__PURE__*/React.createElement(ConfirmModal, Object.assign({}, renderProps, {
|
|
45
|
-
motion:
|
|
32
|
+
motion: props.motion
|
|
46
33
|
})), div);
|
|
47
34
|
}
|
|
48
35
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ConfirmProps } from '../confirm';
|
|
3
|
-
import { Motion } from '../../_base/base';
|
|
4
3
|
interface HookModalProps {
|
|
5
4
|
afterClose: (...args: any[]) => void;
|
|
6
5
|
config: ConfirmProps;
|
|
7
|
-
motion?: Motion;
|
|
8
6
|
}
|
|
9
7
|
export interface HookModalRef {
|
|
10
8
|
destroy: () => void;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _get from "lodash/get";
|
|
2
|
-
|
|
3
1
|
var __rest = this && this.__rest || function (s, e) {
|
|
4
2
|
var t = {};
|
|
5
3
|
|
|
@@ -12,9 +10,8 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
12
10
|
};
|
|
13
11
|
|
|
14
12
|
import React from 'react';
|
|
15
|
-
import ConfirmModal from '../ConfirmModal';
|
|
13
|
+
import ConfirmModal from '../ConfirmModal'; // eslint-disable-next-line max-len
|
|
16
14
|
|
|
17
|
-
// eslint-disable-next-line max-len
|
|
18
15
|
const HookModal = (_a, ref) => {
|
|
19
16
|
var {
|
|
20
17
|
afterClose,
|
|
@@ -33,25 +30,16 @@ const HookModal = (_a, ref) => {
|
|
|
33
30
|
setInnerConfig(originConfig => Object.assign(Object.assign({}, originConfig), newConfig));
|
|
34
31
|
}
|
|
35
32
|
}));
|
|
36
|
-
const {
|
|
37
|
-
motion
|
|
38
|
-
} = props;
|
|
39
|
-
/* istanbul ignore next */
|
|
40
33
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const didLeave = _get(props.motion, 'didLeave');
|
|
34
|
+
const mergeAfterClose = () => {
|
|
35
|
+
var _a;
|
|
44
36
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
(_a = config === null || config === void 0 ? void 0 : config.afterClose) === null || _a === void 0 ? void 0 : _a.call(config);
|
|
38
|
+
afterClose();
|
|
39
|
+
};
|
|
48
40
|
|
|
49
|
-
afterClose();
|
|
50
|
-
}
|
|
51
|
-
}) : false;
|
|
52
41
|
return /*#__PURE__*/React.createElement(ConfirmModal, Object.assign({}, innerConfig, {
|
|
53
|
-
|
|
54
|
-
motion: mergedMotion
|
|
42
|
+
afterClose: mergeAfterClose
|
|
55
43
|
}));
|
|
56
44
|
};
|
|
57
45
|
|
|
@@ -13,7 +13,7 @@ export default class NavFooter extends PureComponent<NavFooterProps> {
|
|
|
13
13
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
14
14
|
style: PropTypes.Requireable<object>;
|
|
15
15
|
className: PropTypes.Requireable<string>;
|
|
16
|
-
collapseButton: PropTypes.Requireable<PropTypes.ReactNodeLike
|
|
16
|
+
collapseButton: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
17
17
|
collapseText: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
18
|
};
|
|
19
19
|
static defaultProps: {
|
|
@@ -15,8 +15,8 @@ export default class NavHeader extends PureComponent<NavHeaderProps> {
|
|
|
15
15
|
static contextType: React.Context<NavContextType>;
|
|
16
16
|
static propTypes: {
|
|
17
17
|
prefixCls: PropTypes.Requireable<string>;
|
|
18
|
-
logo: PropTypes.Requireable<object | PropTypes.ReactNodeLike
|
|
19
|
-
text: PropTypes.Requireable<PropTypes.ReactNodeLike
|
|
18
|
+
logo: PropTypes.Requireable<NonNullable<object | PropTypes.ReactNodeLike>>;
|
|
19
|
+
text: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
20
20
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
21
21
|
style: PropTypes.Requireable<object>;
|
|
22
22
|
className: PropTypes.Requireable<string>;
|
|
@@ -27,6 +27,6 @@ export default class NavHeader extends PureComponent<NavHeaderProps> {
|
|
|
27
27
|
prefixCls: string;
|
|
28
28
|
};
|
|
29
29
|
context: NavContextType;
|
|
30
|
-
renderLogo(logo: React.ReactNode): React.ReactElement<
|
|
30
|
+
renderLogo(logo: React.ReactNode): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
31
31
|
render(): JSX.Element;
|
|
32
32
|
}
|
|
@@ -28,18 +28,18 @@ export interface NavItemState {
|
|
|
28
28
|
export default class NavItem extends BaseComponent<NavItemProps, NavItemState> {
|
|
29
29
|
static contextType: React.Context<NavContextType>;
|
|
30
30
|
static propTypes: {
|
|
31
|
-
text: PropTypes.Requireable<PropTypes.ReactNodeLike
|
|
32
|
-
itemKey: PropTypes.Requireable<string | number
|
|
31
|
+
text: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
32
|
+
itemKey: PropTypes.Requireable<NonNullable<string | number>>;
|
|
33
33
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
34
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
35
35
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
36
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
37
|
-
icon: PropTypes.Requireable<PropTypes.ReactNodeLike
|
|
37
|
+
icon: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
38
38
|
className: PropTypes.Requireable<string>;
|
|
39
39
|
toggleIcon: PropTypes.Requireable<string>;
|
|
40
40
|
style: PropTypes.Requireable<object>;
|
|
41
41
|
forwardRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
|
-
indent: PropTypes.Requireable<number | boolean
|
|
42
|
+
indent: PropTypes.Requireable<NonNullable<number | boolean>>;
|
|
43
43
|
isCollapsed: PropTypes.Requireable<boolean>;
|
|
44
44
|
isSubNav: PropTypes.Requireable<boolean>;
|
|
45
45
|
link: PropTypes.Requireable<string>;
|
|
@@ -178,7 +178,8 @@ export default class NavItem extends BaseComponent {
|
|
|
178
178
|
if (typeof link === 'string') {
|
|
179
179
|
itemChildren = /*#__PURE__*/React.createElement("a", Object.assign({
|
|
180
180
|
className: "".concat(prefixCls, "-item-link"),
|
|
181
|
-
href: link
|
|
181
|
+
href: link,
|
|
182
|
+
tabIndex: -1
|
|
182
183
|
}, linkOptions), itemChildren);
|
|
183
184
|
}
|
|
184
185
|
|
|
@@ -200,7 +201,8 @@ export default class NavItem extends BaseComponent {
|
|
|
200
201
|
onClick: this.handleClick,
|
|
201
202
|
onMouseEnter: onMouseEnter,
|
|
202
203
|
onMouseLeave: onMouseLeave,
|
|
203
|
-
disabled: disabled
|
|
204
|
+
disabled: disabled,
|
|
205
|
+
onKeyDown: this.handleKeyPress
|
|
204
206
|
}, itemChildren);
|
|
205
207
|
} else {
|
|
206
208
|
// Items are divided into normal and sub-wrap
|
|
@@ -220,9 +222,13 @@ export default class NavItem extends BaseComponent {
|
|
|
220
222
|
ariaProps['aria-expanded'] = isOpen;
|
|
221
223
|
}
|
|
222
224
|
|
|
223
|
-
itemDom =
|
|
224
|
-
|
|
225
|
-
|
|
225
|
+
itemDom =
|
|
226
|
+
/*#__PURE__*/
|
|
227
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
228
|
+
React.createElement("li", Object.assign({
|
|
229
|
+
// if role = menuitem, the narration will read all expanded li
|
|
230
|
+
role: isSubNav ? null : "menuitem",
|
|
231
|
+
tabIndex: isSubNav ? -1 : 0
|
|
226
232
|
}, ariaProps, {
|
|
227
233
|
style: style,
|
|
228
234
|
ref: this.setItemRef,
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
export interface OpenIconTransitionProps {
|
|
4
|
-
children?: React.ReactNode | ((transitionArgus?: any) => React.ReactNode);
|
|
5
|
-
isCollapsed?: boolean;
|
|
6
|
-
isOpen?: boolean;
|
|
7
|
-
}
|
|
8
|
-
declare function OpenIconTransition(props?: OpenIconTransitionProps): JSX.Element;
|
|
9
|
-
declare namespace OpenIconTransition {
|
|
10
|
-
var propTypes: {
|
|
11
|
-
isOpen: PropTypes.Validator<boolean>;
|
|
12
|
-
children: PropTypes.Validator<any>;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export default OpenIconTransition;
|
|
1
|
+
|
|
@@ -1,66 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Transition } from '@douyinfe/semi-animation-react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
const formatStyle = function formatStyle(_ref) {
|
|
6
|
-
let {
|
|
7
|
-
rotate = 0
|
|
8
|
-
} = _ref;
|
|
9
|
-
return {
|
|
10
|
-
transform: "rotate(".concat(Math.ceil(rotate), "deg)")
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
function OpenIconTransition() {
|
|
15
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
|
-
const {
|
|
17
|
-
children,
|
|
18
|
-
isOpen
|
|
19
|
-
} = props;
|
|
20
|
-
const [immediate, setImmediate] = useState(true);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
setImmediate(false);
|
|
23
|
-
}, []);
|
|
24
|
-
return /*#__PURE__*/React.createElement(Transition, {
|
|
25
|
-
immediate: immediate,
|
|
26
|
-
state: isOpen ? 'enter' : 'leave',
|
|
27
|
-
from: {
|
|
28
|
-
rotate: 0
|
|
29
|
-
},
|
|
30
|
-
enter: {
|
|
31
|
-
rotate: {
|
|
32
|
-
val: 180,
|
|
33
|
-
duration: 200,
|
|
34
|
-
easing: 'cubic-bezier(.62, .05, .36, .95)'
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
leave: {
|
|
38
|
-
rotate: {
|
|
39
|
-
val: 0,
|
|
40
|
-
duration: 200,
|
|
41
|
-
easing: 'cubic-bezier(.62, .05, .36, .95)'
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}, transitionStyle => {
|
|
45
|
-
const formatedStyle = formatStyle(transitionStyle);
|
|
46
|
-
|
|
47
|
-
if (typeof children === 'function') {
|
|
48
|
-
return children(formatedStyle);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if ( /*#__PURE__*/React.isValidElement(children)) {
|
|
52
|
-
return /*#__PURE__*/React.cloneElement(children, {
|
|
53
|
-
// @ts-ignore
|
|
54
|
-
style: Object.assign(Object.assign({}, children.props && children.props.style), formatedStyle)
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return children;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
OpenIconTransition.propTypes = {
|
|
63
|
-
isOpen: PropTypes.bool.isRequired,
|
|
64
|
-
children: PropTypes.any.isRequired
|
|
65
|
-
};
|
|
66
|
-
export default OpenIconTransition;
|
|
1
|
+
"use strict";
|
|
@@ -32,11 +32,11 @@ export default class SubNav extends BaseComponent<SubNavProps, SubNavState> {
|
|
|
32
32
|
/**
|
|
33
33
|
* Unique identification
|
|
34
34
|
*/
|
|
35
|
-
itemKey: PropTypes.Requireable<string | number
|
|
35
|
+
itemKey: PropTypes.Requireable<NonNullable<string | number>>;
|
|
36
36
|
/**
|
|
37
37
|
* Copywriting
|
|
38
38
|
*/
|
|
39
|
-
text: PropTypes.Requireable<PropTypes.ReactNodeLike
|
|
39
|
+
text: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
40
40
|
/**
|
|
41
41
|
* Whether child navigation is expanded
|
|
42
42
|
*/
|
|
@@ -48,7 +48,7 @@ export default class SubNav extends BaseComponent<SubNavProps, SubNavState> {
|
|
|
48
48
|
/**
|
|
49
49
|
* Whether to keep the left Icon placeholder
|
|
50
50
|
*/
|
|
51
|
-
indent: PropTypes.Requireable<number | boolean
|
|
51
|
+
indent: PropTypes.Requireable<NonNullable<number | boolean>>;
|
|
52
52
|
/**
|
|
53
53
|
* Nested child elements
|
|
54
54
|
*/
|
|
@@ -61,7 +61,7 @@ export default class SubNav extends BaseComponent<SubNavProps, SubNavState> {
|
|
|
61
61
|
/**
|
|
62
62
|
* Icon name on the left
|
|
63
63
|
*/
|
|
64
|
-
icon: PropTypes.Requireable<PropTypes.ReactNodeLike
|
|
64
|
+
icon: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
65
65
|
/**
|
|
66
66
|
* Maximum height (for animation)
|
|
67
67
|
*/
|