@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/cjs/modal/Modal.js
CHANGED
|
@@ -33,6 +33,8 @@ var _confirm = _interopRequireWildcard(require("./confirm"));
|
|
|
33
33
|
|
|
34
34
|
var _useModal = _interopRequireDefault(require("./useModal"));
|
|
35
35
|
|
|
36
|
+
var _cssAnimation = _interopRequireDefault(require("../_cssAnimation"));
|
|
37
|
+
|
|
36
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
39
|
|
|
38
40
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -67,19 +69,13 @@ class Modal extends _baseComponent.default {
|
|
|
67
69
|
this.foundation.handleOk(e);
|
|
68
70
|
};
|
|
69
71
|
|
|
70
|
-
this.
|
|
72
|
+
this.updateState = () => {
|
|
71
73
|
const {
|
|
72
74
|
visible
|
|
73
75
|
} = this.props;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (!visible && !hidden) {
|
|
79
|
-
this.foundation.toggleHidden(true, () => this.foundation.afterClose());
|
|
80
|
-
} else if (visible && this.state.hidden) {
|
|
81
|
-
this.foundation.toggleHidden(false);
|
|
82
|
-
}
|
|
76
|
+
this.foundation.toggleDisplayNone(!visible);
|
|
77
|
+
const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered);
|
|
78
|
+
this.foundation.setShouldRender(shouldRender);
|
|
83
79
|
};
|
|
84
80
|
|
|
85
81
|
this.renderFooter = () => {
|
|
@@ -159,39 +155,62 @@ class Modal extends _baseComponent.default {
|
|
|
159
155
|
}
|
|
160
156
|
|
|
161
157
|
const classList = (0, _classnames.default)(className, {
|
|
162
|
-
["".concat(_constants.cssClasses.DIALOG, "-displayNone")]: keepDOM && this.state.
|
|
158
|
+
["".concat(_constants.cssClasses.DIALOG, "-displayNone")]: keepDOM && this.state.displayNone
|
|
163
159
|
});
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
["".concat(_constants.cssClasses.DIALOG, "-mask-animate-hide")]: !visible,
|
|
170
|
-
["".concat(_constants.cssClasses.DIALOG, "-mask-animate-show")]: visible
|
|
171
|
-
}) : null;
|
|
160
|
+
|
|
161
|
+
if (this.state.shouldRender) {
|
|
162
|
+
this._haveRendered = true;
|
|
163
|
+
}
|
|
164
|
+
|
|
172
165
|
return /*#__PURE__*/_react.default.createElement(_portal.default, {
|
|
173
166
|
style: wrapperStyle,
|
|
174
167
|
getPopupContainer: getPopupContainer
|
|
175
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
className: classList,
|
|
180
|
-
getPopupContainer: getPopupContainer,
|
|
181
|
-
maskStyle: maskStyle,
|
|
182
|
-
style: style,
|
|
183
|
-
ref: this.modalRef,
|
|
168
|
+
}, /*#__PURE__*/_react.default.createElement(_cssAnimation.default, {
|
|
169
|
+
motion: this.props.motion,
|
|
170
|
+
animationState: visible ? 'enter' : 'leave',
|
|
171
|
+
startClassName: visible ? "".concat(_constants.cssClasses.DIALOG, "-content-animate-show") : "".concat(_constants.cssClasses.DIALOG, "-content-animate-hide"),
|
|
184
172
|
onAnimationEnd: () => {
|
|
185
|
-
this.
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
173
|
+
this.updateState();
|
|
174
|
+
}
|
|
175
|
+
}, _ref => {
|
|
176
|
+
let {
|
|
177
|
+
animationClassName,
|
|
178
|
+
animationEventsNeedBind
|
|
179
|
+
} = _ref;
|
|
180
|
+
return /*#__PURE__*/_react.default.createElement(_cssAnimation.default, {
|
|
181
|
+
motion: this.props.motion,
|
|
182
|
+
animationState: visible ? 'enter' : 'leave',
|
|
183
|
+
startClassName: visible ? "".concat(_constants.cssClasses.DIALOG, "-mask-animate-show") : "".concat(_constants.cssClasses.DIALOG, "-mask-animate-hide"),
|
|
184
|
+
onAnimationEnd: () => {
|
|
185
|
+
this.updateState();
|
|
186
|
+
}
|
|
187
|
+
}, _ref2 => {
|
|
188
|
+
let {
|
|
189
|
+
animationClassName: maskAnimationClassName,
|
|
190
|
+
animationEventsNeedBind: maskAnimationEventsNeedBind
|
|
191
|
+
} = _ref2;
|
|
192
|
+
return this.state.shouldRender ? /*#__PURE__*/_react.default.createElement(_ModalContent.default, Object.assign({}, restProps, {
|
|
193
|
+
contentExtraProps: animationEventsNeedBind,
|
|
194
|
+
maskExtraProps: maskAnimationEventsNeedBind,
|
|
195
|
+
isFullScreen: this.state.isFullScreen,
|
|
196
|
+
contentClassName: animationClassName,
|
|
197
|
+
maskClassName: maskAnimationClassName,
|
|
198
|
+
className: classList,
|
|
199
|
+
getPopupContainer: getPopupContainer,
|
|
200
|
+
maskStyle: maskStyle,
|
|
201
|
+
style: style,
|
|
202
|
+
ref: this.modalRef,
|
|
203
|
+
footer: renderFooter,
|
|
204
|
+
onClose: this.handleCancel
|
|
205
|
+
})) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
206
|
+
});
|
|
207
|
+
}));
|
|
190
208
|
};
|
|
191
209
|
|
|
192
210
|
this.state = {
|
|
193
|
-
|
|
194
|
-
isFullScreen: props.fullScreen
|
|
211
|
+
displayNone: !props.visible,
|
|
212
|
+
isFullScreen: props.fullScreen,
|
|
213
|
+
shouldRender: this.props.visible || this.props.keepDOM && !this.props.lazyRender
|
|
195
214
|
};
|
|
196
215
|
this.foundation = new _modalFoundation.default(this.adapter);
|
|
197
216
|
this.modalRef = /*#__PURE__*/_react.default.createRef();
|
|
@@ -231,15 +250,12 @@ class Modal extends _baseComponent.default {
|
|
|
231
250
|
this.props.onOk(e);
|
|
232
251
|
},
|
|
233
252
|
notifyClose: () => {
|
|
234
|
-
var _a, _b;
|
|
235
|
-
|
|
236
|
-
(_b = (_a = this.props.motion) === null || _a === void 0 ? void 0 : _a.didLeave) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
237
253
|
this.props.afterClose();
|
|
238
254
|
},
|
|
239
|
-
|
|
240
|
-
if (
|
|
255
|
+
toggleDisplayNone: (displayNone, callback) => {
|
|
256
|
+
if (displayNone !== this.state.displayNone) {
|
|
241
257
|
this.setState({
|
|
242
|
-
|
|
258
|
+
displayNone: displayNone
|
|
243
259
|
}, callback || _noop2.default);
|
|
244
260
|
}
|
|
245
261
|
},
|
|
@@ -249,6 +265,13 @@ class Modal extends _baseComponent.default {
|
|
|
249
265
|
isFullScreen
|
|
250
266
|
});
|
|
251
267
|
}
|
|
268
|
+
},
|
|
269
|
+
setShouldRender: shouldRender => {
|
|
270
|
+
if (shouldRender !== this.state.shouldRender) {
|
|
271
|
+
this.setState({
|
|
272
|
+
shouldRender
|
|
273
|
+
});
|
|
274
|
+
}
|
|
252
275
|
}
|
|
253
276
|
});
|
|
254
277
|
}
|
|
@@ -260,6 +283,14 @@ class Modal extends _baseComponent.default {
|
|
|
260
283
|
newState.isFullScreen = props.fullScreen;
|
|
261
284
|
}
|
|
262
285
|
|
|
286
|
+
if (props.visible && prevState.displayNone) {
|
|
287
|
+
newState.displayNone = false;
|
|
288
|
+
} //
|
|
289
|
+
// if (!props.visible && !props.motion && !prevState.displayNone) {
|
|
290
|
+
// newState.displayNone = true;
|
|
291
|
+
// }
|
|
292
|
+
|
|
293
|
+
|
|
263
294
|
return newState;
|
|
264
295
|
}
|
|
265
296
|
|
|
@@ -277,7 +308,6 @@ class Modal extends _baseComponent.default {
|
|
|
277
308
|
|
|
278
309
|
if (this.props.visible) {
|
|
279
310
|
this.foundation.beforeShow();
|
|
280
|
-
this._active = this._active || this.props.visible;
|
|
281
311
|
}
|
|
282
312
|
}
|
|
283
313
|
|
|
@@ -285,15 +315,16 @@ class Modal extends _baseComponent.default {
|
|
|
285
315
|
// hide => show
|
|
286
316
|
if (!prevProps.visible && this.props.visible) {
|
|
287
317
|
this.foundation.beforeShow();
|
|
288
|
-
}
|
|
318
|
+
}
|
|
289
319
|
|
|
320
|
+
const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered);
|
|
290
321
|
|
|
291
|
-
if (
|
|
292
|
-
this.foundation.
|
|
322
|
+
if (shouldRender === true && this.state.shouldRender === false) {
|
|
323
|
+
this.foundation.setShouldRender(true);
|
|
293
324
|
}
|
|
294
325
|
|
|
295
|
-
if (!this.
|
|
296
|
-
this.
|
|
326
|
+
if (!prevState.displayNone && this.state.displayNone) {
|
|
327
|
+
this.foundation.afterHide();
|
|
297
328
|
}
|
|
298
329
|
}
|
|
299
330
|
|
|
@@ -309,14 +340,7 @@ class Modal extends _baseComponent.default {
|
|
|
309
340
|
keepDOM,
|
|
310
341
|
lazyRender
|
|
311
342
|
} = this.props;
|
|
312
|
-
|
|
313
|
-
const shouldRender = (visible || keepDOM) && (!lazyRender || this._active) || !this.state.hidden;
|
|
314
|
-
|
|
315
|
-
if (shouldRender) {
|
|
316
|
-
return this.renderDialog();
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
return null;
|
|
343
|
+
return this.renderDialog();
|
|
320
344
|
}
|
|
321
345
|
|
|
322
346
|
}
|
|
@@ -349,7 +373,7 @@ Modal.propTypes = {
|
|
|
349
373
|
header: _propTypes.default.node,
|
|
350
374
|
footer: _propTypes.default.node,
|
|
351
375
|
hasCancel: _propTypes.default.bool,
|
|
352
|
-
motion: _propTypes.default.
|
|
376
|
+
motion: _propTypes.default.bool,
|
|
353
377
|
children: _propTypes.default.node,
|
|
354
378
|
getPopupContainer: _propTypes.default.func,
|
|
355
379
|
getContainerContext: _propTypes.default.func,
|
|
@@ -88,11 +88,12 @@ class ModalContent extends _baseComponent.default {
|
|
|
88
88
|
if (mask) {
|
|
89
89
|
const className = (0, _classnames.default)("".concat(_constants.cssClasses.DIALOG, "-mask"), {// [`${cssClasses.DIALOG}-mask-hidden`]: !props.visible,
|
|
90
90
|
});
|
|
91
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
92
|
-
key: "mask"
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement("div", Object.assign({
|
|
92
|
+
key: "mask"
|
|
93
|
+
}, this.props.maskExtraProps, {
|
|
93
94
|
className: (0, _classnames.default)(className, maskClassName),
|
|
94
95
|
style: props.maskStyle
|
|
95
|
-
});
|
|
96
|
+
}));
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
return null;
|
|
@@ -360,7 +361,7 @@ class ModalContent extends _baseComponent.default {
|
|
|
360
361
|
|
|
361
362
|
const elem = /*#__PURE__*/_react.default.createElement("div", {
|
|
362
363
|
className: classList
|
|
363
|
-
}, this.getMaskElement(), /*#__PURE__*/_react.default.createElement("div", {
|
|
364
|
+
}, this.getMaskElement(), /*#__PURE__*/_react.default.createElement("div", Object.assign({
|
|
364
365
|
role: "none",
|
|
365
366
|
className: (0, _classnames.default)({
|
|
366
367
|
["".concat(_constants.cssClasses.DIALOG, "-wrap")]: true,
|
|
@@ -368,7 +369,7 @@ class ModalContent extends _baseComponent.default {
|
|
|
368
369
|
}),
|
|
369
370
|
onClick: maskClosable ? this.onMaskClick : null,
|
|
370
371
|
onMouseUp: maskClosable ? this.onMaskMouseUp : null
|
|
371
|
-
}, this.getDialogElement())); // eslint-disable-next-line max-len
|
|
372
|
+
}, this.props.contentExtraProps), this.getDialogElement())); // eslint-disable-next-line max-len
|
|
372
373
|
|
|
373
374
|
|
|
374
375
|
return containerContext && containerContext.Provider ? /*#__PURE__*/_react.default.createElement(containerContext.Provider, {
|
|
@@ -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/cjs/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/cjs/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/cjs/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/cjs/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/cjs/modal/modalFoundation").OKType;
|
|
215
215
|
visible?: boolean;
|
package/lib/cjs/modal/confirm.js
CHANGED
|
@@ -10,8 +10,6 @@ exports.withInfo = withInfo;
|
|
|
10
10
|
exports.withSuccess = withSuccess;
|
|
11
11
|
exports.withWarning = withWarning;
|
|
12
12
|
|
|
13
|
-
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
14
|
-
|
|
15
13
|
var _react = _interopRequireDefault(require("react"));
|
|
16
14
|
|
|
17
15
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
@@ -50,21 +48,9 @@ function confirm(props) {
|
|
|
50
48
|
}
|
|
51
49
|
};
|
|
52
50
|
|
|
53
|
-
const mergedMotion = typeof props.motion === 'undefined' || props.motion ? Object.assign(Object.assign({}, props.motion), {
|
|
54
|
-
didLeave: function () {
|
|
55
|
-
const didLeave = (0, _get2.default)(props.motion, 'didLeave');
|
|
56
|
-
|
|
57
|
-
if (typeof didLeave === 'function') {
|
|
58
|
-
didLeave(...arguments);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
destroy();
|
|
62
|
-
}
|
|
63
|
-
}) : false;
|
|
64
|
-
|
|
65
51
|
function render(renderProps) {
|
|
66
52
|
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_ConfirmModal.default, Object.assign({}, renderProps, {
|
|
67
|
-
motion:
|
|
53
|
+
motion: props.motion
|
|
68
54
|
})), div);
|
|
69
55
|
}
|
|
70
56
|
|
|
@@ -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;
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
9
|
|
|
12
10
|
var _ConfirmModal = _interopRequireDefault(require("../ConfirmModal"));
|
|
@@ -45,25 +43,15 @@ const HookModal = (_a, ref) => {
|
|
|
45
43
|
}
|
|
46
44
|
}));
|
|
47
45
|
|
|
48
|
-
const {
|
|
49
|
-
|
|
50
|
-
} = props;
|
|
51
|
-
/* istanbul ignore next */
|
|
52
|
-
|
|
53
|
-
const mergedMotion = typeof motion === 'undefined' || motion ? Object.assign(Object.assign({}, motion), {
|
|
54
|
-
didLeave: function () {
|
|
55
|
-
const didLeave = (0, _get2.default)(props.motion, 'didLeave');
|
|
46
|
+
const mergeAfterClose = () => {
|
|
47
|
+
var _a;
|
|
56
48
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
(_a = config === null || config === void 0 ? void 0 : config.afterClose) === null || _a === void 0 ? void 0 : _a.call(config);
|
|
50
|
+
afterClose();
|
|
51
|
+
};
|
|
60
52
|
|
|
61
|
-
afterClose();
|
|
62
|
-
}
|
|
63
|
-
}) : false;
|
|
64
53
|
return /*#__PURE__*/_react.default.createElement(_ConfirmModal.default, Object.assign({}, innerConfig, {
|
|
65
|
-
|
|
66
|
-
motion: mergedMotion
|
|
54
|
+
afterClose: mergeAfterClose
|
|
67
55
|
}));
|
|
68
56
|
};
|
|
69
57
|
|
|
@@ -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>;
|
|
@@ -200,7 +200,8 @@ class NavItem extends _baseComponent.default {
|
|
|
200
200
|
if (typeof link === 'string') {
|
|
201
201
|
itemChildren = /*#__PURE__*/_react.default.createElement("a", Object.assign({
|
|
202
202
|
className: "".concat(prefixCls, "-item-link"),
|
|
203
|
-
href: link
|
|
203
|
+
href: link,
|
|
204
|
+
tabIndex: -1
|
|
204
205
|
}, linkOptions), itemChildren);
|
|
205
206
|
}
|
|
206
207
|
|
|
@@ -222,7 +223,8 @@ class NavItem extends _baseComponent.default {
|
|
|
222
223
|
onClick: this.handleClick,
|
|
223
224
|
onMouseEnter: onMouseEnter,
|
|
224
225
|
onMouseLeave: onMouseLeave,
|
|
225
|
-
disabled: disabled
|
|
226
|
+
disabled: disabled,
|
|
227
|
+
onKeyDown: this.handleKeyPress
|
|
226
228
|
}, itemChildren);
|
|
227
229
|
} else {
|
|
228
230
|
// Items are divided into normal and sub-wrap
|
|
@@ -242,9 +244,13 @@ class NavItem extends _baseComponent.default {
|
|
|
242
244
|
ariaProps['aria-expanded'] = isOpen;
|
|
243
245
|
}
|
|
244
246
|
|
|
245
|
-
itemDom =
|
|
246
|
-
|
|
247
|
-
|
|
247
|
+
itemDom =
|
|
248
|
+
/*#__PURE__*/
|
|
249
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
250
|
+
_react.default.createElement("li", Object.assign({
|
|
251
|
+
// if role = menuitem, the narration will read all expanded li
|
|
252
|
+
role: isSubNav ? null : "menuitem",
|
|
253
|
+
tabIndex: isSubNav ? -1 : 0
|
|
248
254
|
}, ariaProps, {
|
|
249
255
|
style: style,
|
|
250
256
|
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,82 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _semiAnimationReact = require("@douyinfe/semi-animation-react");
|
|
11
|
-
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
|
-
const formatStyle = function formatStyle(_ref) {
|
|
21
|
-
let {
|
|
22
|
-
rotate = 0
|
|
23
|
-
} = _ref;
|
|
24
|
-
return {
|
|
25
|
-
transform: "rotate(".concat(Math.ceil(rotate), "deg)")
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
function OpenIconTransition() {
|
|
30
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
31
|
-
const {
|
|
32
|
-
children,
|
|
33
|
-
isOpen
|
|
34
|
-
} = props;
|
|
35
|
-
const [immediate, setImmediate] = (0, _react.useState)(true);
|
|
36
|
-
(0, _react.useEffect)(() => {
|
|
37
|
-
setImmediate(false);
|
|
38
|
-
}, []);
|
|
39
|
-
return /*#__PURE__*/_react.default.createElement(_semiAnimationReact.Transition, {
|
|
40
|
-
immediate: immediate,
|
|
41
|
-
state: isOpen ? 'enter' : 'leave',
|
|
42
|
-
from: {
|
|
43
|
-
rotate: 0
|
|
44
|
-
},
|
|
45
|
-
enter: {
|
|
46
|
-
rotate: {
|
|
47
|
-
val: 180,
|
|
48
|
-
duration: 200,
|
|
49
|
-
easing: 'cubic-bezier(.62, .05, .36, .95)'
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
leave: {
|
|
53
|
-
rotate: {
|
|
54
|
-
val: 0,
|
|
55
|
-
duration: 200,
|
|
56
|
-
easing: 'cubic-bezier(.62, .05, .36, .95)'
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}, transitionStyle => {
|
|
60
|
-
const formatedStyle = formatStyle(transitionStyle);
|
|
61
|
-
|
|
62
|
-
if (typeof children === 'function') {
|
|
63
|
-
return children(formatedStyle);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if ( /*#__PURE__*/_react.default.isValidElement(children)) {
|
|
67
|
-
return /*#__PURE__*/_react.default.cloneElement(children, {
|
|
68
|
-
// @ts-ignore
|
|
69
|
-
style: Object.assign(Object.assign({}, children.props && children.props.style), formatedStyle)
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return children;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
OpenIconTransition.propTypes = {
|
|
78
|
-
isOpen: _propTypes.default.bool.isRequired,
|
|
79
|
-
children: _propTypes.default.any.isRequired
|
|
80
|
-
};
|
|
81
|
-
var _default = OpenIconTransition;
|
|
82
|
-
exports.default = _default;
|
|
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
|
*/
|