@unicom-cloud/ui 0.8.43 → 0.8.45
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/Affix.js +54 -51
- package/Alert.js +46 -43
- package/Anchor.js +5 -4
- package/AutoComplete.js +60 -55
- package/Avatar.js +10 -155
- package/BackTop.js +41 -38
- package/Badge.js +63 -93
- package/Breadcrumb.js +63 -118
- package/Button.js +105 -109
- package/Calendar.js +139 -536
- package/Card.js +65 -101
- package/Carousel.js +169 -270
- package/Cascader.js +9 -8
- package/Checkbox.js +4 -3
- package/Collapse.js +4 -3
- package/ColorPicker.js +95 -546
- package/Comment.js +14 -12
- package/ConfigProvider.js +6 -5
- package/Copy.js +33 -31
- package/DatePicker.js +35 -1993
- package/Descriptions.js +30 -28
- package/Divider.js +8 -6
- package/Draggable.js +28 -85
- package/Drawer.js +5 -4
- package/Dropdown.js +107 -167
- package/Empty.js +28 -8
- package/Form.js +30 -1418
- package/Grid.js +13 -248
- package/Icon.js +19 -45
- package/IconHover.js +39 -6
- package/Image.js +3 -3
- package/Input.js +4 -4
- package/InputNumber.js +213 -17
- package/InputTag.js +5 -4
- package/Layout.js +35 -48
- package/Link.js +16 -14
- package/List.js +191 -228
- package/Loading.js +18 -17
- package/Mentions.js +99 -115
- package/Menu.js +8 -7
- package/Message.js +147 -10
- package/Modal.js +5 -4
- package/Notice.js +196 -13
- package/Notification.js +136 -11
- package/NotificationBase.js +5 -4
- package/OverflowEllipsis.js +48 -71
- package/PageHeader.js +52 -52
- package/Pagination.js +12 -11
- package/Picker.js +6 -4
- package/Popconfirm.js +47 -44
- package/Popover.js +25 -23
- package/Portal.js +12 -32
- package/Progress.js +65 -328
- package/Radio.js +6 -5
- package/Rate.js +48 -45
- package/ResizeBox.js +127 -505
- package/Result.js +60 -1417
- package/Select.js +9 -8
- package/SelectView.js +49 -328
- package/Skeleton.js +41 -78
- package/Slider.js +228 -702
- package/Space.js +53 -57
- package/Spin.js +57 -72
- package/Statistic.js +84 -153
- package/Steps.js +64 -123
- package/SuspenseFallbackTest.js +4 -3
- package/Switch.js +41 -38
- package/Table.js +20 -1999
- package/Tabs.js +9 -8
- package/Tag.js +24 -21
- package/TimePicker.js +19 -272
- package/Timeline.js +4 -3
- package/Tooltip.js +79 -72
- package/Transfer.js +138 -402
- package/Tree.js +5 -4
- package/TreeSelect.js +8 -7
- package/Trigger.js +407 -571
- package/Typography.js +11 -721
- package/Upload.js +9 -8
- package/VerificationCode.js +6 -5
- package/Version.js +1 -1
- package/VirtualList.js +4 -3
- package/Watermark.js +3 -2
- package/anchor/Anchor.js +193 -0
- package/anchor/Link.js +54 -0
- package/anchor/context.js +14 -0
- package/anchor/util.js +41 -0
- package/avatar/Avatar.js +85 -0
- package/avatar/Group.js +84 -0
- package/avatar/context.js +5 -0
- package/badge/Count.js +35 -0
- package/breadcrumb/Item.js +67 -0
- package/button/Group.js +15 -0
- package/calendar/Month.js +142 -0
- package/calendar/WeekList.js +24 -0
- package/calendar/Year.js +75 -0
- package/calendar/header/Panel.js +57 -0
- package/calendar/header/index.js +118 -0
- package/calendar/hook/useCellClassName.js +41 -0
- package/card/Grid.js +27 -0
- package/card/Meta.js +32 -0
- package/carousel/Arrow.js +57 -0
- package/carousel/Indicator.js +68 -0
- package/cascader/Cascader.js +300 -0
- package/cascader/base/node.js +142 -0
- package/cascader/base/store.js +93 -0
- package/cascader/hook/useRefCurrent.js +12 -0
- package/cascader/panel/List.js +275 -0
- package/cascader/panel/Option.js +35 -0
- package/cascader/panel/Search.js +171 -0
- package/cascader/util.js +66 -0
- package/checkbox/Checkbox.js +111 -0
- package/checkbox/Group.js +97 -0
- package/checkbox/useCheckbox.js +45 -0
- package/collapse/Collapse.js +90 -0
- package/collapse/Item.js +165 -0
- package/color-picker/ControlBar.js +64 -0
- package/color-picker/InputAlpha.js +24 -0
- package/color-picker/InputHex.js +59 -0
- package/color-picker/InputRgb.js +66 -0
- package/color-picker/Palette.js +36 -0
- package/color-picker/Panel.js +165 -0
- package/color-picker/colors.js +37 -0
- package/color-picker/hooks/useColorPicker.js +63 -0
- package/color-picker/hooks/useControlBlock.js +40 -0
- package/config-provider/ConfigProvider.js +94 -0
- package/config-provider/context.js +24 -0
- package/date-picker/Picker.js +399 -0
- package/date-picker/PickerRange.js +568 -0
- package/date-picker/context.js +5 -0
- package/date-picker/hook/useCellClassName.js +58 -0
- package/date-picker/panel/Body.js +78 -0
- package/date-picker/panel/Footer.js +71 -0
- package/date-picker/panel/Header.js +74 -0
- package/date-picker/panel/Shortcut.js +45 -0
- package/date-picker/panel/WeekList.js +19 -0
- package/date-picker/panel/date/index.js +194 -0
- package/date-picker/panel/month/index.js +113 -0
- package/date-picker/panel/quarter/index.js +93 -0
- package/date-picker/panel/range/index.js +251 -0
- package/date-picker/panel/week/index.js +35 -0
- package/date-picker/panel/year/index.js +74 -0
- package/date-picker/util.js +69 -0
- package/draggable/Item.js +66 -0
- package/drawer/Drawer.js +226 -0
- package/dropdown/Button.js +91 -0
- package/form/Control.js +264 -0
- package/form/Form.js +156 -0
- package/form/FormItem.js +241 -0
- package/form/FormLabel.js +54 -0
- package/form/FormList.js +96 -0
- package/form/FormProvider.js +48 -0
- package/form/IconSymbol.js +20 -0
- package/form/context.js +43 -0
- package/form/hook/useContext.js +32 -0
- package/form/hook/useState.js +31 -0
- package/form/hook/useWatch.js +36 -0
- package/form/interface.js +11 -0
- package/form/promisify.js +23 -0
- package/form/store.js +354 -0
- package/form/useForm.js +53 -0
- package/form/util.js +72 -0
- package/grid/Col.js +87 -0
- package/grid/Row.js +88 -0
- package/grid/context.js +9 -0
- package/grid/grid-item.js +77 -0
- package/grid/grid.js +104 -0
- package/grid/hook/useResponsiveState.js +38 -0
- package/grid/util.js +51 -0
- package/{chunk/I4RV9SKZ.js → hooks/factory/createHTMLMediaHook.js} +35 -43
- package/hooks/index.js +246 -4
- package/{chunk/BdYAMaw9.js → hooks/misc/hookState.js} +1 -1
- package/hooks/misc/parseTimeRanges.js +12 -0
- package/{chunk/TXCrI0jN.js → hooks/misc/util.js} +6 -6
- package/hooks/use-watermark/utils.js +8 -0
- package/hooks/use-watermark.js +71 -76
- package/hooks/useAudio.js +3 -3
- package/hooks/useBeforeUnload.js +2 -2
- package/hooks/useClickAway.js +10 -10
- package/hooks/useCounter.js +1 -1
- package/hooks/useCreation.js +2 -4
- package/hooks/useDrop.js +12 -12
- package/hooks/useDropArea.js +5 -5
- package/hooks/useEvent.js +6 -6
- package/hooks/useEventListener.js +2 -4
- package/hooks/useFavicon.js +1 -2
- package/hooks/useFullscreen.js +11 -13
- package/hooks/useGetSet.js +5 -5
- package/hooks/useHash.js +6 -6
- package/hooks/useHover.js +6 -6
- package/hooks/useHoverDirty.js +7 -7
- package/hooks/useIdle.js +17 -17
- package/hooks/useIsomorphicLayoutEffect2.js +3 -3
- package/hooks/useKey.js +5 -5
- package/hooks/useList.js +1 -1
- package/hooks/useLocalStorage.js +2 -3
- package/hooks/useLocation.js +1 -1
- package/hooks/useLockBodyScroll.js +13 -14
- package/hooks/useLongPress.js +7 -7
- package/hooks/useMeasure.js +3 -3
- package/hooks/useMedia.js +4 -4
- package/hooks/useMediaDevices.js +10 -10
- package/hooks/useMotion.js +11 -11
- package/hooks/useMouse.js +9 -9
- package/hooks/useMouseWheel.js +7 -7
- package/hooks/useNetworkState.js +7 -7
- package/hooks/useOrientation.js +10 -11
- package/hooks/useOverrideRef.js +14 -0
- package/hooks/usePageLeave.js +4 -4
- package/hooks/usePermission.js +9 -9
- package/hooks/usePersistCallback.js +15 -0
- package/hooks/useScroll.js +6 -6
- package/hooks/useScrolling.js +7 -7
- package/hooks/useSearchParam.js +5 -5
- package/hooks/useSessionStorage.js +9 -9
- package/hooks/useSize.js +1 -1
- package/hooks/useSlider.js +6 -6
- package/hooks/useStartTyping.js +4 -4
- package/hooks/useStateList.js +4 -5
- package/hooks/useStateWithHistory.js +1 -1
- package/hooks/useTimeout.js +1 -2
- package/hooks/useVibrate.js +5 -5
- package/hooks/useVideo.js +3 -3
- package/hooks/useWindowScroll.js +13 -13
- package/hooks/useWindowSize.js +6 -6
- package/icon/addFromIconFontCn.js +33 -0
- package/image/Image.js +189 -0
- package/image/ImageFooter.js +45 -0
- package/image/ImagePreview.js +473 -0
- package/image/ImagePreviewArrow.js +40 -0
- package/image/ImagePreviewGroup.js +125 -0
- package/image/ImagePreviewToolbar.js +98 -0
- package/image/TriggerForToolbar.js +10 -0
- package/image/previewGroupContext.js +17 -0
- package/image/util/getFixTranslate.js +7 -0
- package/image/util/getScale.js +72 -0
- package/image/util/hook/useImageStatus.js +16 -0
- package/image/util/hook/useShowFooter.js +7 -0
- package/index.js +440 -395
- package/input/Group.js +20 -0
- package/input/Input.js +185 -0
- package/input/InputElement.js +233 -0
- package/input/Number.js +4 -0
- package/input/Password.js +72 -0
- package/input/Search.js +80 -0
- package/input/Tag.js +7 -0
- package/input/Textarea.js +168 -0
- package/input/autoSizeTextAreaHeight.js +65 -0
- package/input/useComposition.js +39 -0
- package/input-number/decimal.js +154 -0
- package/input-number/useSelectionRange.js +26 -0
- package/input-number/util.js +57 -0
- package/input-tag/InputTag.js +381 -0
- package/layout/Content.js +15 -0
- package/layout/Footer.js +15 -0
- package/layout/Header.js +15 -0
- package/{chunk/B9asjXwm.js → layout/Sider.js} +23 -22
- package/list/Item.js +46 -0
- package/list/Meta.js +21 -0
- package/loading/style/index.module.less.js +4 -0
- package/locale/de-DE.js +1 -1
- package/mentions/util.js +26 -0
- package/menu/Indent.js +17 -0
- package/menu/Item.js +125 -0
- package/menu/ItemGroup.js +39 -0
- package/menu/Menu.js +181 -0
- package/menu/OverflowWrap.js +85 -0
- package/menu/context.js +5 -0
- package/menu/sub-menu/Inline.js +111 -0
- package/menu/sub-menu/Pop.js +126 -0
- package/menu/sub-menu/index.js +17 -0
- package/menu/util.js +80 -0
- package/message/useMessage.js +53 -0
- package/modal/Confirm.js +98 -0
- package/modal/Modal.js +419 -0
- package/modal/config.js +25 -0
- package/modal/use-modal/Hook.js +55 -0
- package/modal/use-modal/index.js +68 -0
- package/notification/useNotification.js +55 -0
- package/overflow-ellipsis/OverflowItem.js +34 -0
- package/package.json +27 -1
- package/pagination/PageItem.js +121 -0
- package/pagination/PageJumper.js +64 -0
- package/pagination/PageOption.js +55 -0
- package/pagination/Pagination.js +245 -0
- package/picker/Input.js +124 -0
- package/picker/InputRange.js +155 -0
- package/portal/Portal.js +25 -0
- package/progress/CircleProgress.js +117 -0
- package/progress/LineProgess.js +103 -0
- package/progress/StepProgress.js +74 -0
- package/radio/Group.js +91 -0
- package/radio/Radio.js +90 -0
- package/resize-box/ResizeTrigger.js +78 -0
- package/resize-box/Split.js +132 -0
- package/resize-box/SplitGroup.js +204 -0
- package/result/403.js +695 -0
- package/result/404.js +513 -0
- package/result/500.js +166 -0
- package/select/OptGroup.js +20 -0
- package/select/Option.js +97 -0
- package/select/Select.js +544 -0
- package/select/util.js +140 -0
- package/select-view/Core.js +309 -0
- package/skeleton/Image.js +24 -0
- package/skeleton/Text.js +27 -0
- package/slider/Button.js +159 -0
- package/slider/Dot.js +43 -0
- package/slider/Input.js +75 -0
- package/slider/Mark.js +28 -0
- package/slider/Tick.js +44 -0
- package/slider/hook/useInterval.js +73 -0
- package/slider/hook/useLegalValue.js +70 -0
- package/slider/util.js +63 -0
- package/space/toArray.js +11 -0
- package/spin/DotLoading.js +26 -0
- package/statistic/Countdown.js +57 -0
- package/statistic/util.js +33 -0
- package/steps/Step.js +68 -0
- package/style.css +1 -1
- package/table/ColGroup.js +59 -0
- package/table/Table.js +634 -0
- package/table/constant.js +5 -0
- package/table/hook/useColumns.js +141 -0
- package/table/hook/useComponent.js +64 -0
- package/table/hook/useExpand.js +36 -0
- package/table/hook/useRowSelection.js +92 -0
- package/table/hook/useSorter.js +54 -0
- package/table/hook/useStickyClassNames.js +30 -0
- package/table/hook/useStickyOffsets.js +30 -0
- package/table/summary/Cell.js +10 -0
- package/table/summary/Row.js +26 -0
- package/table/summary/context.js +5 -0
- package/table/summary/index.js +10 -0
- package/table/tbody/Td.js +160 -0
- package/table/tbody/Tr.js +168 -0
- package/table/tbody/index.js +156 -0
- package/table/tfoot/index.js +16 -0
- package/table/thead/Column.js +250 -0
- package/table/thead/index.js +131 -0
- package/table/util.js +121 -0
- package/tabs/Tab.js +170 -0
- package/tabs/TabContent.js +54 -0
- package/tabs/TabPane.js +26 -0
- package/tabs/hook/useDomSize.js +17 -0
- package/tabs/hook/useHeaderScroll.js +64 -0
- package/tabs/tab-header/DropdownIcon.js +71 -0
- package/tabs/tab-header/TabInk.js +65 -0
- package/tabs/tab-header/TabNavIcon.js +65 -0
- package/tabs/tab-header/TabTitle.js +78 -0
- package/tabs/tab-header/index.js +335 -0
- package/tabs/util.js +22 -0
- package/time-picker/Picker.js +221 -0
- package/time-picker/RangePicker.js +56 -0
- package/time-picker/TimeColumn.js +65 -0
- package/time-picker/TimePicker.js +242 -0
- package/time-picker/context.js +5 -0
- package/time-picker/util.js +43 -0
- package/timeline/Item.js +94 -0
- package/timeline/Timeline.js +80 -0
- package/transfer/Item.js +107 -0
- package/transfer/List.js +192 -0
- package/tree/Animation.js +104 -0
- package/tree/Context.js +5 -0
- package/tree/Node.js +215 -0
- package/tree/NodeList.js +84 -0
- package/tree/Tree.js +549 -0
- package/tree/util.js +76 -0
- package/tree-select/List.js +127 -0
- package/tree-select/Select.js +260 -0
- package/tree-select/hook/useKeyCache.js +56 -0
- package/tree-select/hook/useStateValue.js +98 -0
- package/tree-select/hook/useTreeData.js +13 -0
- package/tree-select/interface.js +13 -0
- package/tree-select/util.js +9 -0
- package/trigger/Portal.js +14 -0
- package/trigger/getPopupStyle.js +190 -0
- package/types/badge/Count.d.ts +2 -1
- package/types/badge/index.d.ts +2 -2
- package/types/button/index.d.ts +2 -2
- package/types/carousel/index.d.ts +1 -1
- package/types/color-picker/colors.d.ts +1 -1
- package/types/color-picker/style/index.d.ts +1 -1
- package/types/drawer/Drawer.d.ts +1 -1
- package/types/dropdown/interface.d.ts +1 -0
- package/types/grid/index.d.ts +1 -0
- package/types/hooks/index.d.ts +122 -0
- package/types/hooks/use-verification-code/interface.d.ts +1 -1
- package/types/hooks/useAsync.d.ts +1 -1
- package/types/hooks/useDropArea.d.ts +1 -0
- package/types/hooks/useOverrideRef.d.ts +5 -0
- package/types/hooks/usePersistCallback.d.ts +1 -0
- package/types/hooks/useUpsert.d.ts +1 -1
- package/types/icon-hover/index.d.ts +5 -3
- package/types/index.d.ts +4 -120
- package/types/input-tag/InputTag.d.ts +1 -1
- package/types/input-tag/interface.d.ts +1 -1
- package/types/link/interface.d.ts +1 -1
- package/types/list/index.d.ts +1 -1
- package/types/modal/interface.d.ts +1 -0
- package/types/notice/index.d.ts +3 -0
- package/types/notification/index.d.ts +1 -1
- package/types/page-header/index.d.ts +1 -1
- package/types/select/Select.d.ts +1 -1
- package/types/select-view/Core.d.ts +3 -2
- package/types/select-view/index.d.ts +1 -0
- package/types/statistic/index.d.ts +1 -1
- package/types/switch/index.d.ts +1 -1
- package/types/switch/interface.d.ts +1 -1
- package/types/table/interface.d.ts +2 -1
- package/types/tooltip/index.d.ts +1 -1
- package/types/trigger/index.d.ts +12 -8
- package/types/trigger/interface.d.ts +1 -0
- package/types/typography/Base.d.ts +8 -7
- package/types/typography/EditContent.d.ts +3 -2
- package/types/typography/Paragraph.d.ts +2 -5
- package/types/typography/Text.d.ts +1 -5
- package/types/typography/Title.d.ts +2 -5
- package/types/upload/TriggerNode.d.ts +5 -3
- package/types/upload/list/PictureItem.d.ts +3 -3
- package/types/upload/list/TextItem.d.ts +3 -3
- package/types/utils/CSSTransition.d.ts +2 -0
- package/types/utils/constant.d.ts +1 -1
- package/types/utils/is.d.ts +4 -0
- package/types/utils/reactDOM.d.ts +3 -1
- package/types/utils/warning.d.ts +1 -1
- package/types/version/index.d.ts +1 -1
- package/typography/Base.js +184 -0
- package/typography/EditContent.js +49 -0
- package/typography/Ellipsis.js +293 -0
- package/typography/Operations.js +78 -0
- package/typography/Paragraph.js +26 -0
- package/typography/Text.js +11 -0
- package/typography/Title.js +12 -0
- package/typography/Typography.js +15 -0
- package/typography/useCssEllipsis.js +37 -0
- package/typography/useEllipsis.js +150 -0
- package/upload/TriggerNode.js +118 -0
- package/upload/Upload.js +205 -0
- package/upload/Uploader.js +205 -0
- package/upload/interface.js +9 -0
- package/upload/list/PictureItem.js +91 -0
- package/upload/list/TextItem.js +99 -0
- package/upload/list/UploadProgress.js +97 -0
- package/upload/list/index.js +120 -0
- package/upload/request.js +51 -0
- package/upload/util.js +61 -0
- package/utils/CSSTransition.js +27 -0
- package/utils/contextHolder.js +29 -4
- package/utils/getHighlightText.js +1 -2
- package/utils/is.js +81 -68
- package/utils/reactDOM.js +33 -22
- package/utils/style.js +1 -2
- package/utils/warning.js +7 -3
- package/verification-code/VerificationCode.js +83 -0
- package/virtual-list/Filler.js +31 -0
- package/virtual-list/VirtualList.js +378 -0
- package/virtual-list/util/algorithm.js +32 -0
- package/virtual-list/util/item.js +99 -0
- package/{chunk/BCEX3Acw.js → watermark/Watermark.js} +13 -11
- package/chunk/B1P8u7kB.js +0 -798
- package/chunk/B2ufZjjd.js +0 -1000
- package/chunk/B7QOJqps.js +0 -162
- package/chunk/BBz3S3zo.js +0 -966
- package/chunk/BGzBxiWE.js +0 -517
- package/chunk/BNRfcEHj.js +0 -984
- package/chunk/BSs6uXmc.js +0 -946
- package/chunk/BTjUAV8T.js +0 -277
- package/chunk/BYQeEcKe.js +0 -375
- package/chunk/Ba4UXIST.js +0 -605
- package/chunk/BfaXVcik.js +0 -271
- package/chunk/Bs11tCU6.js +0 -240
- package/chunk/C7FC7dzS.js +0 -516
- package/chunk/CLzbve11.js +0 -694
- package/chunk/CN4zXU4b.js +0 -877
- package/chunk/CYTPZUHD.js +0 -769
- package/chunk/CcCo_dK0.js +0 -335
- package/chunk/CoCXcpQd.js +0 -261
- package/chunk/D4yH4UKK.js +0 -80
- package/chunk/DiSLYN2-.js +0 -167
- package/chunk/Dr0iXIXO.js +0 -736
- package/chunk/G3-2uJao.js +0 -229
- package/chunk/RnTpOC5-.js +0 -1
- package/chunk/Z-mtdHUQ.js +0 -226
- package/chunk/ZISxNnaR.js +0 -165
- package/chunk/aPJXnDSb.js +0 -450
- package/chunk/i605JRmI.js +0 -232
- package/chunk/l0sNRNKZ.js +0 -1
- package/types/form/FormItemTip.d.ts +0 -8
- /package/{chunk/C6Kfwj0f.js → loading/style/index.less.js} +0 -0
- /package/{chunk/DP2rzg_V.js → suspense-fallback-test/style/index.less.js} +0 -0
- /package/types/{Popover → popover}/index.d.ts +0 -0
- /package/types/{Popover → popover}/interface.d.ts +0 -0
- /package/types/{Popover → popover}/style/index.d.ts +0 -0
- /package/{chunk/K6Dvbx-E.js → virtual-list/style/index.less.js} +0 -0
package/Trigger.js
CHANGED
|
@@ -1,227 +1,39 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import { Esc as
|
|
17
|
-
import
|
|
18
|
-
import { pickDataAttributes as
|
|
19
|
-
import { caf as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
r && r.parentNode && (r.parentNode.removeChild(r), e.current = null);
|
|
28
|
-
}, []), e.current ? ut.createPortal(t, e.current) : null;
|
|
29
|
-
}, B = 0, I = (h, l) => {
|
|
30
|
-
const { position: t } = l, { width: e, height: i, left: r, right: n, top: u, bottom: P } = h.getBoundingClientRect(), o = l.boundaryDistance || {}, M = "left" in o && o.left || B, g = "top" in o && o.top || B;
|
|
31
|
-
let a, c, f, m;
|
|
32
|
-
return ["bottom", "bl", "br"].indexOf(t) > -1 ? (f = u, m = P) : (f = u - g, m = P - g), ["right", "rt", "rb"].indexOf(t) > -1 ? (a = r, c = n) : (a = r - M, c = n - M), {
|
|
33
|
-
width: e,
|
|
34
|
-
height: i,
|
|
35
|
-
left: a,
|
|
36
|
-
right: c,
|
|
37
|
-
top: f,
|
|
38
|
-
bottom: m
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
function wt(h, l, t, e) {
|
|
42
|
-
if (!t || !h || tt)
|
|
43
|
-
return { left: 0, width: 0, height: 0, top: 0 };
|
|
44
|
-
const i = (m) => document.documentElement[m] || document.body[m], r = t === document.body ? i("scrollTop") : t.scrollTop, n = t === document.body ? i("scrollLeft") : t.scrollLeft, { left: u, top: P, width: o, height: M } = l, g = t === document.body ? 0 : I(t, e).left, a = t === document.body ? 0 : I(t, e).top, c = P + r - a;
|
|
45
|
-
return {
|
|
46
|
-
left: u + n - g,
|
|
47
|
-
top: c,
|
|
48
|
-
width: o,
|
|
49
|
-
height: M
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
const E = function(h, l, t) {
|
|
53
|
-
return t < h ? h : t > l ? l : t;
|
|
54
|
-
}, Ct = (h, l) => {
|
|
55
|
-
let t = 0, e = 0, i = {};
|
|
56
|
-
l ? i = {
|
|
57
|
-
left: 12,
|
|
58
|
-
right: 12,
|
|
59
|
-
top: 12,
|
|
60
|
-
bottom: 12,
|
|
61
|
-
...h
|
|
62
|
-
} : i = { ...h };
|
|
63
|
-
for (const r in i)
|
|
64
|
-
if (Tt(i[r])) {
|
|
65
|
-
let n = 0;
|
|
66
|
-
["top", "bottom"].indexOf(r) > -1 ? (n = 1, t = i[r][0]) : e = i[r][1], i[r] = i[r][n];
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
...i,
|
|
70
|
-
horizontalOffset: t,
|
|
71
|
-
verticalOffset: e
|
|
72
|
-
};
|
|
73
|
-
}, vt = (h, l, { boundaryDistance: t, position: e }) => l ? {
|
|
74
|
-
left: l.clientX,
|
|
75
|
-
top: l.clientY,
|
|
76
|
-
width: 0,
|
|
77
|
-
height: 0,
|
|
78
|
-
right: l.clientX,
|
|
79
|
-
bottom: l.clientY
|
|
80
|
-
} : I(h, { boundaryDistance: t, position: e }), Mt = (h) => {
|
|
81
|
-
const l = h.offsetWidth, t = h.offsetHeight;
|
|
82
|
-
return {
|
|
83
|
-
width: l,
|
|
84
|
-
height: t
|
|
85
|
-
};
|
|
86
|
-
}, Ot = (h) => {
|
|
87
|
-
var n, u;
|
|
88
|
-
const l = h || {}, t = "left" in l ? l.left : "right" in l ? l.right : B, e = "top" in l ? l.top : "bottom" in l ? l.bottom : B, i = (((n = document.documentElement) == null ? void 0 : n.clientHeight) || window.innerHeight) - (e || B), r = (((u = document.documentElement) == null ? void 0 : u.clientWidth) || window.innerWidth) - (t || B);
|
|
89
|
-
return {
|
|
90
|
-
windowHeight: i,
|
|
91
|
-
windowWidth: r
|
|
92
|
-
};
|
|
93
|
-
}, Dt = (h, l, t, e, i) => {
|
|
94
|
-
const {
|
|
95
|
-
autoAlignPopupWidth: r,
|
|
96
|
-
autoAlignPopupMinWidth: n,
|
|
97
|
-
alignPoint: u,
|
|
98
|
-
style: P
|
|
99
|
-
} = h;
|
|
100
|
-
if (!t || !l || !e)
|
|
1
|
+
var J = Object.defineProperty;
|
|
2
|
+
var Z = (u, h, e) => h in u ? J(u, h, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[h] = e;
|
|
3
|
+
var i = (u, h, e) => Z(u, typeof h != "symbol" ? h + "" : h, e);
|
|
4
|
+
import { jsx as d, jsxs as V } from "react/jsx-runtime";
|
|
5
|
+
/* empty css */
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { CSSTransition as ee } from "@unicom-cloud/react-transition-group";
|
|
8
|
+
import te from "lodash/isArray";
|
|
9
|
+
import ie from "lodash/isEqual";
|
|
10
|
+
import g from "lodash/isFunction";
|
|
11
|
+
import C, { PureComponent as se, createRef as H } from "react";
|
|
12
|
+
import "./config-provider/ConfigProvider.js";
|
|
13
|
+
import b from "@unicom-cloud/utils/class-name";
|
|
14
|
+
import { on as w, off as R, getScrollElements as oe, isScrollElement as re, contains as $ } from "./utils/dom.js";
|
|
15
|
+
import { isObject as L, supportRef as ne } from "./utils/is.js";
|
|
16
|
+
import { Esc as N } from "./utils/keyCode.js";
|
|
17
|
+
import pe from "./utils/mergeProp.js";
|
|
18
|
+
import { pickDataAttributes as le } from "./utils/pick.js";
|
|
19
|
+
import { caf as k, raf as ue } from "./utils/raf.js";
|
|
20
|
+
import { findDOMNode as he, callbackOriginRef as ae } from "./utils/reactDOM.js";
|
|
21
|
+
import F from "./utils/throttleByRaf.js";
|
|
22
|
+
import ce from "./trigger/Portal.js";
|
|
23
|
+
import de, { getBoundingClientRect as ge } from "./trigger/getPopupStyle.js";
|
|
24
|
+
import { ConfigContext as fe } from "./config-provider/context.js";
|
|
25
|
+
function B(u, h) {
|
|
26
|
+
if (!u)
|
|
101
27
|
return {};
|
|
102
|
-
const
|
|
103
|
-
boundaryDistance: M,
|
|
104
|
-
position: h.position
|
|
105
|
-
}), { left: a, top: c, width: f, height: m } = wt(
|
|
106
|
-
t,
|
|
107
|
-
g,
|
|
108
|
-
e,
|
|
109
|
-
{
|
|
110
|
-
boundaryDistance: M,
|
|
111
|
-
position: h.position
|
|
112
|
-
}
|
|
113
|
-
), V = Ct(h.popupAlign, h.showArrow), H = V.left || 0, N = V.right || 0, k = V.top || 0, F = V.bottom || 0;
|
|
114
|
-
r && (P == null ? void 0 : P.width) === void 0 && (l.style.width = `${t.offsetWidth}px`), n && (l.style.minWidth = `${t.offsetWidth}px`);
|
|
115
|
-
const p = Mt(l);
|
|
116
|
-
let v = h.position;
|
|
117
|
-
const y = {}, O = (D) => {
|
|
118
|
-
if (!h.autoFitPosition)
|
|
119
|
-
return;
|
|
120
|
-
const { windowHeight: S, windowWidth: z } = Ot(M);
|
|
121
|
-
let L = !1;
|
|
122
|
-
const b = {
|
|
123
|
-
left: a - g.left,
|
|
124
|
-
top: c - g.top
|
|
125
|
-
}, { top: $ = 0, left: T = 0 } = o;
|
|
126
|
-
if ((D === "top" || D === "bottom") && (b.left > T && g.right > 12 ? (o.left = Math.max(b.left, a - p.width), o.left = Math.max(
|
|
127
|
-
o.left,
|
|
128
|
-
a - p.width + 24
|
|
129
|
-
)) : T - b.left + p.width > z && z - g.left > 12 && (o.left = Math.max(
|
|
130
|
-
b.left,
|
|
131
|
-
b.left + z - p.width
|
|
132
|
-
), o.left = Math.max(
|
|
133
|
-
o.left,
|
|
134
|
-
a - p.width + 24
|
|
135
|
-
))), (D === "left" || D === "right") && (b.top > $ && g.bottom > 12 ? (o.top = b.top, o.top = Math.max(
|
|
136
|
-
o.top,
|
|
137
|
-
c - p.height + g.height / 2
|
|
138
|
-
)) : $ - b.top + p.height > S && S - g.top > 12 && (o.top = Math.max(
|
|
139
|
-
b.top,
|
|
140
|
-
b.top + S - p.height
|
|
141
|
-
), o.top = Math.max(
|
|
142
|
-
o.top,
|
|
143
|
-
c - p.height + g.height / 2
|
|
144
|
-
))), D === "top" && b.top > $ && (g.top < S - g.bottom ? (o.top = Math.min(
|
|
145
|
-
c + m + (k || 0),
|
|
146
|
-
b.top + S - p.height
|
|
147
|
-
), L = !0) : o.top = b.top), D === "bottom" && $ - b.top + p.height > S && (S - g.bottom < g.top ? (o.top = Math.max(
|
|
148
|
-
c - p.height - (F || 0),
|
|
149
|
-
b.top
|
|
150
|
-
), L = !0) : o.top = b.top + S - p.height), D === "left" && b.left > T && (g.left < z - g.right ? (o.left = Math.min(
|
|
151
|
-
f + a + N,
|
|
152
|
-
b.left + z - p.width
|
|
153
|
-
), L = !0) : o.left = b.left), D === "right" && T - b.left + p.width > z && (z - g.right < g.left ? (o.left = Math.max(
|
|
154
|
-
a - p.width - H,
|
|
155
|
-
b.left
|
|
156
|
-
), L = !0) : o.left = b.left + z - p.width), o.left < 0)
|
|
157
|
-
o.left = 0;
|
|
158
|
-
else {
|
|
159
|
-
const et = e.scrollWidth - p.width;
|
|
160
|
-
o.left = Math.min(et, o.left);
|
|
161
|
-
}
|
|
162
|
-
return L;
|
|
163
|
-
}, d = V.horizontalOffset || 0, x = V.verticalOffset || 0;
|
|
164
|
-
let C = a - Number(o.left) + f / 2, w = c - Number(o.top) + m / 2;
|
|
165
|
-
switch (h.position) {
|
|
166
|
-
case "top": {
|
|
167
|
-
o.top = c - p.height - k, o.left = a + f / 2 - p.width / 2, O("top") && (v = "bottom"), o.left += d, C = a - Number(o.left) + f / 2, y.left = E(12, p.width - 12, C);
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
case "tl":
|
|
171
|
-
o.top = c - p.height - k, o.left = a, O("top") && (v = "bl"), o.left += d, C = a - Number(o.left) + Math.min(f / 2, 50), y.left = E(12, p.width - 12, C);
|
|
172
|
-
break;
|
|
173
|
-
case "tr":
|
|
174
|
-
o.top = -l.clientHeight + c - k, o.left = a + f - p.width, O("top") && (v = "br"), o.left += d, C = a - Number(o.left) + Math.max(f / 2, f - 50), y.left = E(12, p.width - 12, C);
|
|
175
|
-
break;
|
|
176
|
-
case "bottom": {
|
|
177
|
-
o.top = m + c + F, o.left = a + f / 2 - p.width / 2, O("bottom") && (v = "top"), o.left += d, C = a - Number(o.left) + f / 2, y.left = E(12, p.width - 12, C);
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
case "bl":
|
|
181
|
-
o.top = m + c + F, o.left = a, O("bottom") && (v = "tl"), o.left += d, C = a - Number(o.left) + Math.min(f / 2, 50), y.left = E(12, p.width - 12, C);
|
|
182
|
-
break;
|
|
183
|
-
case "br":
|
|
184
|
-
o.top = m + c + F, o.left = a + f - p.width, O("bottom") && (v = "tr"), o.left += d, C = a - Number(o.left) + Math.max(f / 2, f - 50), y.left = E(12, p.width - 12, C);
|
|
185
|
-
break;
|
|
186
|
-
case "left": {
|
|
187
|
-
o.top = c + m / 2 - p.height / 2, o.left = a - p.width - H, O("left") && (v = "right"), o.top += x, w = c - Number(o.top) + m / 2, y.top = E(12, p.height - 12, w);
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
case "lt":
|
|
191
|
-
o.top = c, o.left = a - p.width - H, O("left") && (v = "rt"), o.top += x, w = c - Number(o.top) + Math.min(m / 2, 50), y.top = E(12, p.height - 12, w);
|
|
192
|
-
break;
|
|
193
|
-
case "lb":
|
|
194
|
-
o.top = c + m - p.height, o.left = a - p.width - H, O("left") && (v = "rb"), o.top += x, w = c - Number(o.top) + Math.max(m / 2, m - 50), y.top = E(12, p.height - 12, w);
|
|
195
|
-
break;
|
|
196
|
-
case "right": {
|
|
197
|
-
o.top = c + m / 2 - p.height / 2, o.left = f + a + N, O("right") && (v = "left"), o.top += x, w = c - Number(o.top) + m / 2, y.top = E(12, p.height - 12, w);
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
case "rt":
|
|
201
|
-
o.top = c, o.left = f + a + N, O("right") && (v = "lt"), o.top += x, w = c - Number(o.top) + Math.min(m / 2, 50), y.top = E(12, p.height - 12, w);
|
|
202
|
-
break;
|
|
203
|
-
case "rb":
|
|
204
|
-
o.top = c + m - p.height, o.left = f + a + N, O("right") && (v = "lb"), o.top += x, w = c - Number(o.top) + Math.max(m / 2, m - 50), y.top = E(12, p.height - 12, w);
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
28
|
+
const { width: e, height: t, left: s, right: o } = ge(u, h);
|
|
207
29
|
return {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
};
|
|
213
|
-
function J(h, l) {
|
|
214
|
-
if (!h)
|
|
215
|
-
return {};
|
|
216
|
-
const { width: t, height: e, left: i, right: r } = I(h, l);
|
|
217
|
-
return {
|
|
218
|
-
width: t,
|
|
219
|
-
height: e,
|
|
220
|
-
left: i,
|
|
221
|
-
right: r
|
|
30
|
+
width: e,
|
|
31
|
+
height: t,
|
|
32
|
+
left: s,
|
|
33
|
+
right: o
|
|
222
34
|
};
|
|
223
35
|
}
|
|
224
|
-
const
|
|
36
|
+
const We = [
|
|
225
37
|
"onClick",
|
|
226
38
|
"onMouseEnter",
|
|
227
39
|
"onMouseLeave",
|
|
@@ -231,13 +43,13 @@ const Kt = [
|
|
|
231
43
|
"onContextMenu",
|
|
232
44
|
"onKeyDown"
|
|
233
45
|
];
|
|
234
|
-
function
|
|
235
|
-
const
|
|
236
|
-
return
|
|
237
|
-
|
|
238
|
-
}), { picked:
|
|
46
|
+
function me(u, h) {
|
|
47
|
+
const e = {}, t = { ...u };
|
|
48
|
+
return h.forEach((s) => {
|
|
49
|
+
u && s in u && (e[s] = u[s], delete t[s]);
|
|
50
|
+
}), { picked: e, omitted: t };
|
|
239
51
|
}
|
|
240
|
-
const
|
|
52
|
+
const Pe = {
|
|
241
53
|
blurToHide: !0,
|
|
242
54
|
// clickToClose: true,
|
|
243
55
|
classNames: "fadeIn",
|
|
@@ -257,170 +69,212 @@ const xt = {
|
|
|
257
69
|
mouseLeaveDelay: 100,
|
|
258
70
|
autoFitPosition: !0
|
|
259
71
|
};
|
|
260
|
-
class
|
|
261
|
-
constructor(
|
|
262
|
-
super(
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
72
|
+
class W extends se {
|
|
73
|
+
constructor(e, t) {
|
|
74
|
+
super(e, t);
|
|
75
|
+
i(this, "context");
|
|
76
|
+
i(this, "popupContainer");
|
|
77
|
+
i(this, "rootElementRef");
|
|
78
|
+
i(this, "triggerRef", H());
|
|
79
|
+
// 标志 popup 是否被销毁
|
|
80
|
+
i(this, "triggerRefDestoried");
|
|
81
|
+
i(this, "delayTimer", null);
|
|
82
|
+
i(this, "updatePositionTimer", null);
|
|
268
83
|
// popup 真正出现的位置
|
|
269
|
-
|
|
84
|
+
i(this, "realPosition");
|
|
270
85
|
// arrow 箭头的位置
|
|
271
|
-
|
|
86
|
+
i(this, "arrowStyle");
|
|
272
87
|
// is popup open?
|
|
273
|
-
|
|
88
|
+
i(this, "popupOpen", !1);
|
|
274
89
|
// if mousedown to hide popup, ignore onFocus
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
90
|
+
i(this, "mousedownToHide", !1);
|
|
91
|
+
i(this, "mouseDownTimeout");
|
|
92
|
+
i(this, "hasPopupMouseDown", !1);
|
|
278
93
|
// handle click outside document
|
|
279
|
-
|
|
94
|
+
i(this, "handleClickOutside");
|
|
280
95
|
// 是否监听了window 的resize
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
96
|
+
i(this, "handleWindowResize");
|
|
97
|
+
i(this, "unmount", !1);
|
|
98
|
+
i(this, "isDidMount", !1);
|
|
284
99
|
// 保存鼠标的位置
|
|
285
|
-
|
|
100
|
+
i(this, "mouseLocation", {
|
|
286
101
|
clientX: 0,
|
|
287
102
|
clientY: 0
|
|
288
103
|
});
|
|
289
104
|
// 保存当前的mount container dom元素
|
|
290
|
-
|
|
105
|
+
i(this, "observerContainer", null);
|
|
291
106
|
// 保存当前节点到 popupContainer 间的所有滚动元素
|
|
292
|
-
|
|
107
|
+
i(this, "scrollElements", null);
|
|
293
108
|
// container 触发 resize时执行
|
|
294
|
-
|
|
109
|
+
i(this, "resizeObserver", new ResizeObserver(() => {
|
|
295
110
|
window.requestAnimationFrame(this.handleUpdatePosition);
|
|
296
111
|
}));
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
112
|
+
i(this, "resizeObserver2", new ResizeObserver(() => {
|
|
113
|
+
window.requestAnimationFrame(() => {
|
|
114
|
+
const e = this.triggerRef.current;
|
|
115
|
+
if (e) {
|
|
116
|
+
const t = this.getPopupStyle(), s = this.props.style || {};
|
|
117
|
+
e.style.top = String(s.top || `${t.top}px`), e.style.left = String(s.left || `${t.left}px`);
|
|
118
|
+
}
|
|
119
|
+
this.onResize();
|
|
120
|
+
});
|
|
121
|
+
}));
|
|
122
|
+
i(this, "onResizeObserver2", () => {
|
|
123
|
+
var t, s;
|
|
124
|
+
this.offResizeObserver2();
|
|
125
|
+
let e = this.getPopupElement();
|
|
126
|
+
e && ((s = (t = this.resizeObserver2) == null ? void 0 : t.observe) == null || s.call(t, e));
|
|
127
|
+
});
|
|
128
|
+
i(this, "offResizeObserver2", () => {
|
|
129
|
+
var t, s;
|
|
130
|
+
let e = this.getPopupElement();
|
|
131
|
+
e && ((s = (t = this.resizeObserver2) == null ? void 0 : t.unobserve) == null || s.call(t, e));
|
|
132
|
+
});
|
|
133
|
+
i(this, "resizeObserver3", new ResizeObserver(() => {
|
|
134
|
+
window.requestAnimationFrame(this.onResize);
|
|
135
|
+
}));
|
|
136
|
+
i(this, "onResizeObserver3", () => {
|
|
137
|
+
var t, s;
|
|
138
|
+
this.offResizeObserver3();
|
|
139
|
+
let e = this.getRootElement();
|
|
140
|
+
e && ((s = (t = this.resizeObserver3) == null ? void 0 : t.observe) == null || s.call(t, e));
|
|
141
|
+
});
|
|
142
|
+
i(this, "offResizeObserver3", () => {
|
|
143
|
+
var t, s;
|
|
144
|
+
let e = this.getRootElement();
|
|
145
|
+
e && ((s = (t = this.resizeObserver3) == null ? void 0 : t.unobserve) == null || s.call(t, e));
|
|
146
|
+
});
|
|
147
|
+
i(this, "childrenDom", null);
|
|
300
148
|
// 保存children节点的尺寸。 主要用于在弹出层动画前和动画完成后比较尺寸是否有变化。
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
const { componentConfig:
|
|
304
|
-
return
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
149
|
+
i(this, "childrenDomSize", {});
|
|
150
|
+
i(this, "getMergedProps", (e) => {
|
|
151
|
+
const { componentConfig: t } = this.context ?? {};
|
|
152
|
+
return pe(
|
|
153
|
+
e && L(e) ? e : this.props,
|
|
154
|
+
Pe,
|
|
155
|
+
t == null ? void 0 : t.Trigger,
|
|
156
|
+
e && te(e) ? e : void 0
|
|
309
157
|
);
|
|
310
158
|
});
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
159
|
+
i(this, "getRootElement", () => {
|
|
160
|
+
var e, t;
|
|
161
|
+
return this.childrenDom = he(
|
|
162
|
+
((t = (e = this.props).getTargetDOMNode) == null ? void 0 : t.call(e)) || this.rootElementRef,
|
|
163
|
+
this
|
|
164
|
+
), this.childrenDom;
|
|
165
|
+
});
|
|
166
|
+
i(this, "getPopupElement", () => this.triggerRef.current || null);
|
|
167
|
+
i(this, "offScrollListeners", () => {
|
|
168
|
+
(this.scrollElements || []).forEach((e) => {
|
|
169
|
+
R(e, "scroll", this.handleScroll);
|
|
315
170
|
}), this.scrollElements = null;
|
|
316
171
|
});
|
|
317
|
-
|
|
318
|
-
this.handleWindowResize = !1,
|
|
172
|
+
i(this, "offWindowResize", () => {
|
|
173
|
+
this.handleWindowResize = !1, R(window, "resize", this.handleUpdatePosition);
|
|
319
174
|
});
|
|
320
|
-
|
|
175
|
+
i(this, "offContainerResize", () => {
|
|
321
176
|
this.resizeObserver && this.observerContainer && (this.resizeObserver.unobserve(this.observerContainer), this.observerContainer = null);
|
|
322
177
|
});
|
|
323
|
-
|
|
324
|
-
const
|
|
178
|
+
i(this, "handleScroll", () => {
|
|
179
|
+
const e = this.getMergedProps([
|
|
325
180
|
"containerScrollToClose",
|
|
326
181
|
"updateOnScroll"
|
|
327
182
|
]);
|
|
328
|
-
|
|
183
|
+
e.containerScrollToClose ? this.setPopupVisible(!1) : e.updateOnScroll && this.handleUpdatePosition();
|
|
329
184
|
});
|
|
330
|
-
|
|
331
|
-
var
|
|
332
|
-
this.scrollElements || (this.scrollElements =
|
|
185
|
+
i(this, "onContainersScroll", (e) => {
|
|
186
|
+
var t, s;
|
|
187
|
+
this.scrollElements || (this.scrollElements = oe(
|
|
333
188
|
this.childrenDom,
|
|
334
|
-
(
|
|
335
|
-
),
|
|
336
|
-
|
|
189
|
+
(t = this.popupContainer) == null ? void 0 : t.parentNode
|
|
190
|
+
), e.containerScrollToClose && ((s = this.popupContainer) == null ? void 0 : s.parentNode) === document.body && this.scrollElements.indexOf(document.body) === -1 && re(document.documentElement) && this.scrollElements.push(window), this.scrollElements.forEach((o) => {
|
|
191
|
+
w(o, "scroll", this.handleScroll);
|
|
337
192
|
}));
|
|
338
193
|
});
|
|
339
|
-
|
|
340
|
-
var
|
|
341
|
-
const
|
|
342
|
-
this.resizeObserver && this.observerContainer !==
|
|
194
|
+
i(this, "onContainerResize", () => {
|
|
195
|
+
var t;
|
|
196
|
+
const e = (t = this.popupContainer) == null ? void 0 : t.parentNode;
|
|
197
|
+
this.resizeObserver && this.observerContainer !== e && (this.offContainerResize(), e && this.resizeObserver.observe(e), this.observerContainer = e);
|
|
343
198
|
});
|
|
344
199
|
// getPopupContainer 改变时候触发
|
|
345
|
-
|
|
200
|
+
i(this, "handleUpdatePosition", F(() => {
|
|
346
201
|
this.updatePopupPosition();
|
|
347
202
|
}));
|
|
348
|
-
|
|
349
|
-
const { trigger:
|
|
350
|
-
return [].concat(
|
|
203
|
+
i(this, "isClickTrigger", () => {
|
|
204
|
+
const { trigger: e } = this.getMergedProps(["trigger"]);
|
|
205
|
+
return [].concat(e).indexOf("click") > -1;
|
|
351
206
|
});
|
|
352
|
-
|
|
353
|
-
const { trigger:
|
|
354
|
-
return [].concat(
|
|
207
|
+
i(this, "isFocusTrigger", () => {
|
|
208
|
+
const { trigger: e } = this.getMergedProps(["trigger"]);
|
|
209
|
+
return [].concat(e).indexOf("focus") > -1;
|
|
355
210
|
});
|
|
356
|
-
|
|
357
|
-
const { trigger:
|
|
358
|
-
return [].concat(
|
|
211
|
+
i(this, "isHoverTrigger", () => {
|
|
212
|
+
const { trigger: e } = this.getMergedProps(["trigger"]);
|
|
213
|
+
return [].concat(e).indexOf("hover") > -1;
|
|
359
214
|
});
|
|
360
|
-
|
|
361
|
-
const { trigger:
|
|
362
|
-
return [].concat(
|
|
215
|
+
i(this, "isContextMenuTrigger", () => {
|
|
216
|
+
const { trigger: e } = this.getMergedProps(["trigger"]);
|
|
217
|
+
return [].concat(e).indexOf("contextMenu") > -1;
|
|
363
218
|
});
|
|
364
219
|
// 是否在鼠标移出触发节点和popup的时候隐藏弹出层
|
|
365
|
-
|
|
220
|
+
i(this, "isMouseLeaveToClose", () => this.isHoverTrigger() && this.getMergedProps(["mouseLeaveToClose"]).mouseLeaveToClose);
|
|
366
221
|
// 是否在悬浮到popup的时候隐藏弹出层
|
|
367
|
-
|
|
368
|
-
|
|
222
|
+
i(this, "isPopupHoverHide", () => this.isHoverTrigger() && !this.getMergedProps(["popupHoverStay"]).popupHoverStay);
|
|
223
|
+
i(this, "isClickToHide", () => {
|
|
369
224
|
if (this.isClickTrigger() || this.isContextMenuTrigger()) {
|
|
370
|
-
const { clickToClose:
|
|
371
|
-
return
|
|
225
|
+
const { clickToClose: e = !0 } = this.getMergedProps(["clickToClose"]);
|
|
226
|
+
return e;
|
|
372
227
|
}
|
|
373
228
|
return this.isHoverTrigger() && this.props.clickToClose;
|
|
374
229
|
});
|
|
375
|
-
|
|
376
|
-
|
|
230
|
+
i(this, "isBlurToHide", () => this.isFocusTrigger() && this.getMergedProps(["blurToHide"]).blurToHide);
|
|
231
|
+
i(this, "clearTimer", () => {
|
|
377
232
|
this.updatePositionTimer && (this.updatePositionTimer.cancel ? this.updatePositionTimer.cancel() : (clearTimeout(this.updatePositionTimer), this.updatePositionTimer = null)), this.delayTimer && (clearTimeout(this.delayTimer), this.delayTimer = null), this.mouseDownTimeout && (clearTimeout(this.mouseDownTimeout), this.mouseDownTimeout = null);
|
|
378
233
|
});
|
|
379
|
-
|
|
234
|
+
i(this, "offClickOutside", () => {
|
|
380
235
|
if (this.handleClickOutside) {
|
|
381
|
-
const { getDocument:
|
|
382
|
-
|
|
236
|
+
const { getDocument: e } = this.getMergedProps(["getDocument"]), t = g(e) && e();
|
|
237
|
+
R(t, "mousedown", this.onClickOutside), this.handleClickOutside = !1;
|
|
383
238
|
}
|
|
384
239
|
});
|
|
385
|
-
|
|
386
|
-
var
|
|
387
|
-
const
|
|
388
|
-
if (!
|
|
389
|
-
|
|
390
|
-
const { showArrow: i, classNames: r } = this.getMergedProps([
|
|
240
|
+
i(this, "getTransformOrigin", (e) => {
|
|
241
|
+
var T, f;
|
|
242
|
+
const t = this.getPopupElement();
|
|
243
|
+
if (!t) return {};
|
|
244
|
+
const { showArrow: s, classNames: o } = this.getMergedProps([
|
|
391
245
|
"showArrow",
|
|
392
246
|
"classNames"
|
|
393
247
|
]);
|
|
394
|
-
let
|
|
395
|
-
|
|
396
|
-
const
|
|
397
|
-
top: `${
|
|
398
|
-
tl: `${
|
|
399
|
-
tr: `${
|
|
400
|
-
bottom: `${
|
|
401
|
-
bl: `${
|
|
402
|
-
br: `${
|
|
403
|
-
left: `100% ${
|
|
404
|
-
lt: `100% ${
|
|
405
|
-
lb: `100% ${
|
|
406
|
-
right: `0 ${
|
|
407
|
-
rt: `0 ${
|
|
408
|
-
rb: `0 ${
|
|
248
|
+
let r = s && ((T = this.arrowStyle) == null ? void 0 : T.top) || 0, n = s && ((f = this.arrowStyle) == null ? void 0 : f.left) || 0;
|
|
249
|
+
r = r ? `${r}px` : "", n = n ? `${n}px` : "";
|
|
250
|
+
const a = {
|
|
251
|
+
top: `${n || "50%"} 100% 0`,
|
|
252
|
+
tl: `${n || "15px"} 100% 0`,
|
|
253
|
+
tr: `${n || `${t.clientWidth - 15}px`} 100% 0`,
|
|
254
|
+
bottom: `${n || "50%"} 0 0`,
|
|
255
|
+
bl: `${n || "15px"} 0 0`,
|
|
256
|
+
br: `${n || `${t.clientWidth - 15}px`} 0 0`,
|
|
257
|
+
left: `100% ${r || "50%"} 0`,
|
|
258
|
+
lt: `100% ${r || "15px"} 0`,
|
|
259
|
+
lb: `100% ${r || `${t.clientHeight - 15}px`} 0`,
|
|
260
|
+
right: `0 ${r || "50%"} 0`,
|
|
261
|
+
rt: `0 ${r || "15px"} 0`,
|
|
262
|
+
rb: `0 ${r || `${t.clientHeight - 15}px`} 0`
|
|
409
263
|
};
|
|
410
|
-
if (
|
|
264
|
+
if (o && o.indexOf("zoom") > -1)
|
|
411
265
|
return {
|
|
412
|
-
transformOrigin:
|
|
266
|
+
transformOrigin: a[e]
|
|
413
267
|
};
|
|
414
|
-
if (
|
|
415
|
-
let
|
|
416
|
-
return ["top", "tl", "tr"].indexOf(
|
|
417
|
-
transformOrigin:
|
|
268
|
+
if (o === "slideDynamicOrigin") {
|
|
269
|
+
let v = "0% 0%";
|
|
270
|
+
return ["top", "tl", "tr"].indexOf(e) > -1 && (v = "100% 100%"), {
|
|
271
|
+
transformOrigin: v
|
|
418
272
|
};
|
|
419
273
|
}
|
|
420
274
|
return {};
|
|
421
275
|
});
|
|
422
276
|
// 下拉框存在初始translateY/translateX,需要根据真实的弹出位置确定
|
|
423
|
-
|
|
277
|
+
i(this, "getTransformTranslate", () => {
|
|
424
278
|
if (this.getMergedProps(["classNames"]).classNames !== "slideDynamicOrigin")
|
|
425
279
|
return "";
|
|
426
280
|
switch (this.realPosition) {
|
|
@@ -436,171 +290,172 @@ class Z extends ht {
|
|
|
436
290
|
return "";
|
|
437
291
|
}
|
|
438
292
|
});
|
|
439
|
-
|
|
293
|
+
i(this, "getPopupStyle", () => {
|
|
440
294
|
if (this.unmount || !this.popupContainer)
|
|
441
295
|
return;
|
|
442
|
-
const
|
|
443
|
-
if (!
|
|
296
|
+
const e = this.popupContainer, t = this.triggerRef.current, s = this.getRootElement();
|
|
297
|
+
if (!s.offsetParent && !s.getClientRects().length)
|
|
444
298
|
return this.state.popupStyle;
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
e,
|
|
448
|
-
i,
|
|
299
|
+
const o = this.getMergedProps(), { style: r, arrowStyle: n, realPosition: a } = de(
|
|
300
|
+
o,
|
|
449
301
|
t,
|
|
302
|
+
s,
|
|
303
|
+
e,
|
|
450
304
|
this.mouseLocation
|
|
451
305
|
);
|
|
452
|
-
return this.realPosition =
|
|
453
|
-
...
|
|
306
|
+
return this.realPosition = a || o.position, this.arrowStyle = n || {}, {
|
|
307
|
+
...r,
|
|
454
308
|
...this.getTransformOrigin(this.realPosition)
|
|
455
309
|
};
|
|
456
310
|
});
|
|
457
|
-
|
|
311
|
+
i(this, "showPopup", (e = () => {
|
|
458
312
|
}) => {
|
|
459
|
-
const
|
|
313
|
+
const t = this.getPopupStyle();
|
|
460
314
|
this.setState(
|
|
461
315
|
{
|
|
462
|
-
popupStyle:
|
|
316
|
+
popupStyle: t
|
|
463
317
|
},
|
|
464
|
-
|
|
318
|
+
e
|
|
465
319
|
);
|
|
466
320
|
});
|
|
467
|
-
|
|
321
|
+
i(this, "update", F((e) => {
|
|
468
322
|
if (this.unmount || !this.state.popupVisible)
|
|
469
323
|
return;
|
|
470
|
-
const
|
|
324
|
+
const t = this.getPopupStyle();
|
|
471
325
|
this.setState(
|
|
472
326
|
{
|
|
473
|
-
popupStyle:
|
|
327
|
+
popupStyle: t
|
|
474
328
|
},
|
|
475
329
|
() => {
|
|
476
|
-
|
|
330
|
+
e == null || e();
|
|
477
331
|
}
|
|
478
332
|
);
|
|
479
333
|
}));
|
|
480
|
-
|
|
334
|
+
i(this, "getRootDOMNode", () => this.getRootElement());
|
|
335
|
+
i(this, "updatePopupPosition", (e = 0, t) => {
|
|
481
336
|
if (this.state.popupVisible) {
|
|
482
|
-
if (
|
|
483
|
-
this.updatePositionTimer = this.update(
|
|
337
|
+
if (e < 4) {
|
|
338
|
+
this.updatePositionTimer = this.update(t);
|
|
484
339
|
return;
|
|
485
340
|
}
|
|
486
341
|
this.updatePositionTimer = setTimeout(() => {
|
|
487
|
-
const
|
|
342
|
+
const o = this.getPopupStyle();
|
|
488
343
|
this.setState(
|
|
489
344
|
{
|
|
490
|
-
popupStyle:
|
|
345
|
+
popupStyle: o
|
|
491
346
|
},
|
|
492
347
|
() => {
|
|
493
|
-
|
|
348
|
+
t == null || t();
|
|
494
349
|
}
|
|
495
350
|
);
|
|
496
|
-
},
|
|
351
|
+
}, e);
|
|
497
352
|
}
|
|
498
353
|
});
|
|
499
|
-
|
|
500
|
-
const
|
|
354
|
+
i(this, "setPopupVisible", (e, t = 0, s) => {
|
|
355
|
+
const o = this.getMergedProps([
|
|
501
356
|
"onVisibleChange",
|
|
502
357
|
"popupVisible"
|
|
503
|
-
]), { onVisibleChange:
|
|
504
|
-
|
|
505
|
-
|
|
358
|
+
]), { onVisibleChange: r } = o, n = this.state.popupVisible;
|
|
359
|
+
e !== n ? this.delayToDo(t, () => {
|
|
360
|
+
r == null || r(e), "popupVisible" in o ? s == null || s() : e ? this.setState(
|
|
506
361
|
{
|
|
507
362
|
popupVisible: !0
|
|
508
363
|
},
|
|
509
364
|
() => {
|
|
510
|
-
this.showPopup(
|
|
365
|
+
this.showPopup(s);
|
|
511
366
|
}
|
|
512
367
|
) : this.setState(
|
|
513
368
|
{
|
|
514
369
|
popupVisible: !1
|
|
515
370
|
},
|
|
516
371
|
() => {
|
|
517
|
-
|
|
372
|
+
s == null || s();
|
|
518
373
|
}
|
|
519
374
|
);
|
|
520
|
-
}) :
|
|
375
|
+
}) : s == null || s();
|
|
521
376
|
});
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
},
|
|
377
|
+
i(this, "delayToDo", (e, t) => {
|
|
378
|
+
e ? (this.clearDelayTimer(), this.delayTimer = setTimeout(() => {
|
|
379
|
+
t(), this.clearDelayTimer();
|
|
380
|
+
}, e)) : t();
|
|
526
381
|
});
|
|
527
382
|
// 点击非popup内部,非children内部的节点,触发clickoutside 逻辑
|
|
528
|
-
|
|
529
|
-
const { onClickOutside:
|
|
383
|
+
i(this, "onClickOutside", (e) => {
|
|
384
|
+
const { onClickOutside: t, clickOutsideToClose: s } = this.getMergedProps([
|
|
530
385
|
"onClickOutside",
|
|
531
386
|
"clickOutsideToClose"
|
|
532
|
-
]),
|
|
533
|
-
|
|
387
|
+
]), o = this.getPopupElement(), r = this.getRootElement();
|
|
388
|
+
!$(o, e.target) && !$(r, e.target) && !this.hasPopupMouseDown && (t == null || t(), s && !this.isBlurToHide() && !this.isHoverTrigger() && this.setPopupVisible(!1));
|
|
534
389
|
});
|
|
535
|
-
|
|
536
|
-
const
|
|
537
|
-
this.triggerPropsEvent("onKeyDown",
|
|
390
|
+
i(this, "onKeyDown", (e) => {
|
|
391
|
+
const t = e.key;
|
|
392
|
+
this.triggerPropsEvent("onKeyDown", e), t === N.key && this.onPressEsc(e);
|
|
538
393
|
});
|
|
539
|
-
|
|
540
|
-
const { escToClose:
|
|
541
|
-
|
|
394
|
+
i(this, "onPressEsc", (e) => {
|
|
395
|
+
const { escToClose: t } = this.getMergedProps(["escToClose"]);
|
|
396
|
+
t && e && e.key === N.key && this.state.popupVisible && this.setPopupVisible(!1);
|
|
542
397
|
});
|
|
543
|
-
|
|
544
|
-
const { mouseEnterDelay:
|
|
545
|
-
this.triggerPropsEvent("onMouseEnter",
|
|
398
|
+
i(this, "onMouseEnter", (e) => {
|
|
399
|
+
const { mouseEnterDelay: t } = this.getMergedProps(["mouseEnterDelay"]);
|
|
400
|
+
this.triggerPropsEvent("onMouseEnter", e), this.clearDelayTimer(), this.setPopupVisible(!0, t || 0);
|
|
546
401
|
});
|
|
547
|
-
|
|
548
|
-
this.triggerPropsEvent("onMouseMove",
|
|
402
|
+
i(this, "onMouseMove", (e) => {
|
|
403
|
+
this.triggerPropsEvent("onMouseMove", e), this.setMouseLocation(e), this.state.popupVisible && this.update();
|
|
549
404
|
});
|
|
550
|
-
|
|
551
|
-
const { mouseLeaveDelay:
|
|
552
|
-
this.clearDelayTimer(), this.triggerPropsEvent("onMouseLeave",
|
|
405
|
+
i(this, "onMouseLeave", (e) => {
|
|
406
|
+
const { mouseLeaveDelay: t } = this.getMergedProps(["mouseLeaveDelay"]);
|
|
407
|
+
this.clearDelayTimer(), this.triggerPropsEvent("onMouseLeave", e), this.isMouseLeaveToClose() && this.state.popupVisible && this.setPopupVisible(!1, t || 0);
|
|
553
408
|
});
|
|
554
|
-
|
|
409
|
+
i(this, "onPopupMouseEnter", () => {
|
|
555
410
|
this.clearDelayTimer();
|
|
556
411
|
});
|
|
557
|
-
|
|
558
|
-
this.onMouseLeave(
|
|
412
|
+
i(this, "onPopupMouseLeave", (e) => {
|
|
413
|
+
this.onMouseLeave(e);
|
|
559
414
|
});
|
|
560
|
-
|
|
415
|
+
i(this, "setMouseLocation", (e) => {
|
|
561
416
|
this.getMergedProps(["alignPoint"]).alignPoint && (this.mouseLocation = {
|
|
562
|
-
clientX:
|
|
563
|
-
clientY:
|
|
417
|
+
clientX: e.clientX,
|
|
418
|
+
clientY: e.clientY
|
|
564
419
|
});
|
|
565
420
|
});
|
|
566
|
-
|
|
567
|
-
|
|
421
|
+
i(this, "onContextMenu", (e) => {
|
|
422
|
+
e.preventDefault(), this.triggerPropsEvent("onContextMenu", e), this.setMouseLocation(e), this.state.popupVisible ? this.getMergedProps(["alignPoint"]).alignPoint && this.update() : this.setPopupVisible(!0, 0);
|
|
568
423
|
});
|
|
569
|
-
|
|
570
|
-
const { popupVisible:
|
|
571
|
-
|
|
424
|
+
i(this, "clickToHidePopup", (e) => {
|
|
425
|
+
const { popupVisible: t } = this.state;
|
|
426
|
+
t && (this.mousedownToHide = !0), this.triggerPropsEvent("onClick", e), this.isClickToHide() && t && this.setPopupVisible(!t, 0);
|
|
572
427
|
});
|
|
573
|
-
|
|
574
|
-
const { popupVisible:
|
|
575
|
-
|
|
428
|
+
i(this, "onClick", (e) => {
|
|
429
|
+
const { popupVisible: t } = this.state;
|
|
430
|
+
t && (this.mousedownToHide = !0), this.triggerPropsEvent("onClick", e), this.setMouseLocation(e), !(!this.isClickToHide() && t) && this.setPopupVisible(!t, 0);
|
|
576
431
|
});
|
|
577
|
-
|
|
578
|
-
const { focusDelay:
|
|
579
|
-
this.triggerPropsEvent("onFocus",
|
|
432
|
+
i(this, "onFocus", (e) => {
|
|
433
|
+
const { focusDelay: t } = this.getMergedProps(["focusDelay"]), s = () => {
|
|
434
|
+
this.triggerPropsEvent("onFocus", e);
|
|
580
435
|
};
|
|
581
|
-
this.clearDelayTimer(), this.mousedownToHide || (this.state.popupVisible ?
|
|
436
|
+
this.clearDelayTimer(), this.mousedownToHide || (this.state.popupVisible ? s == null || s() : this.setPopupVisible(!0, t || 0, s)), this.mousedownToHide = !1;
|
|
582
437
|
});
|
|
583
|
-
|
|
584
|
-
this.setPopupVisible(!1, 200, () => this.triggerPropsEvent("onBlur",
|
|
438
|
+
i(this, "onBlur", (e) => {
|
|
439
|
+
this.setPopupVisible(!1, 200, () => this.triggerPropsEvent("onBlur", e));
|
|
585
440
|
});
|
|
586
|
-
|
|
441
|
+
i(this, "onResize", () => {
|
|
587
442
|
this.getMergedProps(["autoFixPosition"]).autoFixPosition && this.state.popupVisible && this.updatePopupPosition();
|
|
588
443
|
});
|
|
589
|
-
|
|
444
|
+
i(this, "onPopupMouseDown", () => {
|
|
590
445
|
this.hasPopupMouseDown = !0, clearTimeout(this.mouseDownTimeout), this.mouseDownTimeout = setTimeout(() => {
|
|
591
446
|
this.hasPopupMouseDown = !1;
|
|
592
447
|
}, 0);
|
|
593
448
|
});
|
|
594
449
|
// 当 children 中的元素 disabled 时,不能正确触发 hover 等事件,所以当监测到对应
|
|
595
450
|
// 组件有 disabled 时,给元素加一层 span,处理事件,模拟样式
|
|
596
|
-
|
|
597
|
-
var
|
|
598
|
-
const { children:
|
|
599
|
-
let
|
|
600
|
-
if (["string", "number"].indexOf(typeof
|
|
601
|
-
|
|
602
|
-
else if (
|
|
603
|
-
const { picked:
|
|
451
|
+
i(this, "getChild", () => {
|
|
452
|
+
var r;
|
|
453
|
+
const { children: e } = this.props, t = e, s = t && typeof t != "string" && t.type;
|
|
454
|
+
let o = e;
|
|
455
|
+
if (["string", "number"].indexOf(typeof e) > -1 || C.Children.count(e) > 1)
|
|
456
|
+
o = /* @__PURE__ */ d("span", { children: e });
|
|
457
|
+
else if (t && s && (s.__PQB_BUTTON === !0 || s.__PQB_CHECKBOX === !0 || s.__PQB_SWITCH === !0 || s.__PQB_RADIO === !0 || s === "button") && t.props.disabled) {
|
|
458
|
+
const { picked: n, omitted: a } = me(t.props.style, [
|
|
604
459
|
"position",
|
|
605
460
|
"left",
|
|
606
461
|
"right",
|
|
@@ -610,14 +465,14 @@ class Z extends ht {
|
|
|
610
465
|
"display",
|
|
611
466
|
"zIndex"
|
|
612
467
|
]);
|
|
613
|
-
|
|
468
|
+
o = /* @__PURE__ */ d(
|
|
614
469
|
"span",
|
|
615
470
|
{
|
|
616
|
-
className: (
|
|
617
|
-
style: { display: "inline-block", ...
|
|
618
|
-
children:
|
|
471
|
+
className: (r = t.props) == null ? void 0 : r.className,
|
|
472
|
+
style: { display: "inline-block", ...n, cursor: "not-allowed" },
|
|
473
|
+
children: C.cloneElement(t, {
|
|
619
474
|
style: {
|
|
620
|
-
...
|
|
475
|
+
...a,
|
|
621
476
|
pointerEvents: "none"
|
|
622
477
|
},
|
|
623
478
|
className: void 0
|
|
@@ -625,217 +480,198 @@ class Z extends ht {
|
|
|
625
480
|
}
|
|
626
481
|
);
|
|
627
482
|
}
|
|
628
|
-
return
|
|
483
|
+
return o || /* @__PURE__ */ d("span", {});
|
|
629
484
|
});
|
|
630
|
-
|
|
485
|
+
i(this, "rafId");
|
|
631
486
|
// 创建的dom节点插入getPopupContainer。
|
|
632
|
-
|
|
633
|
-
if (
|
|
634
|
-
const { getPopupContainer:
|
|
635
|
-
if (
|
|
636
|
-
|
|
487
|
+
i(this, "appendToContainer", (e) => {
|
|
488
|
+
if (k(this.rafId), this.isDidMount) {
|
|
489
|
+
const { getPopupContainer: t } = this.context, { getPopupContainer: s } = this.getMergedProps(["getPopupContainer"]), o = s || t, r = this.getRootElement(), n = o == null ? void 0 : o(r);
|
|
490
|
+
if (n) {
|
|
491
|
+
n.appendChild(e);
|
|
637
492
|
return;
|
|
638
493
|
}
|
|
639
494
|
}
|
|
640
|
-
this.rafId =
|
|
641
|
-
this.appendToContainer(
|
|
495
|
+
this.rafId = ue(() => {
|
|
496
|
+
this.appendToContainer(e);
|
|
642
497
|
});
|
|
643
498
|
});
|
|
644
|
-
|
|
645
|
-
const
|
|
646
|
-
return
|
|
499
|
+
i(this, "getContainer", () => {
|
|
500
|
+
const e = document.createElement("div");
|
|
501
|
+
return e.style.width = "100%", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", this.popupContainer = e, this.appendToContainer(e), e;
|
|
647
502
|
});
|
|
648
503
|
// 1. 触发直接附加到 Trigger 上的事件,大多是Trigger直接嵌套Trigger的情况
|
|
649
504
|
// 2. 触发children上直接被附加的事件
|
|
650
|
-
|
|
651
|
-
const
|
|
652
|
-
|
|
505
|
+
i(this, "triggerPropsEvent", (e, t) => {
|
|
506
|
+
const s = this.getChild(), o = s && s.props && s.props[e], r = this.getMergedProps([e])[e];
|
|
507
|
+
g(o) && o(t), g(r) && r(t);
|
|
653
508
|
});
|
|
654
509
|
// 触发 children/ trigger 组件上被附加的事件
|
|
655
|
-
|
|
656
|
-
const
|
|
657
|
-
return
|
|
658
|
-
|
|
659
|
-
} :
|
|
660
|
-
});
|
|
661
|
-
const
|
|
662
|
-
this.popupOpen = !!
|
|
663
|
-
popupVisible: !!
|
|
510
|
+
i(this, "triggerOriginEvent", (e) => {
|
|
511
|
+
const t = this.getChild(), s = t && t.props && t.props[e], o = this.getMergedProps([e])[e];
|
|
512
|
+
return g(o) && g(s) ? (r) => {
|
|
513
|
+
s(r), o(r);
|
|
514
|
+
} : s || o;
|
|
515
|
+
});
|
|
516
|
+
const s = this.getMergedProps(e), o = "popupVisible" in s ? s.popupVisible : s.defaultPopupVisible;
|
|
517
|
+
this.popupOpen = !!o, this.triggerRef = H(), this.state = {
|
|
518
|
+
popupVisible: !!o,
|
|
664
519
|
popupStyle: {}
|
|
665
520
|
};
|
|
666
521
|
}
|
|
667
|
-
static getDerivedStateFromProps(
|
|
668
|
-
return "popupVisible" in
|
|
669
|
-
popupVisible:
|
|
522
|
+
static getDerivedStateFromProps(e, t) {
|
|
523
|
+
return "popupVisible" in e && e.popupVisible !== t.popupVisible ? {
|
|
524
|
+
popupVisible: e.popupVisible
|
|
670
525
|
} : null;
|
|
671
526
|
}
|
|
672
|
-
resizeObserver2Observe() {
|
|
673
|
-
var t, e;
|
|
674
|
-
this.refTrigger && (this.resizeObserver2 || (this.resizeObserver2Disconnect(), this.resizeObserver2 = new ResizeObserver(() => {
|
|
675
|
-
window.requestAnimationFrame(() => {
|
|
676
|
-
const i = this.refTrigger;
|
|
677
|
-
if (i) {
|
|
678
|
-
const r = this.getPopupStyle(), n = this.props.style || {};
|
|
679
|
-
i.style.top = String(n.top || `${r.top}px`), i.style.left = String(n.left || `${r.left}px`);
|
|
680
|
-
}
|
|
681
|
-
this.onResize();
|
|
682
|
-
});
|
|
683
|
-
}), (e = (t = this.resizeObserver2) == null ? void 0 : t.observe) == null || e.call(t, this.refTrigger)));
|
|
684
|
-
}
|
|
685
|
-
resizeObserver2Disconnect() {
|
|
686
|
-
var t, e;
|
|
687
|
-
(e = (t = this.resizeObserver2) == null ? void 0 : t.disconnect) == null || e.call(t), this.resizeObserver2 = null;
|
|
688
|
-
}
|
|
689
|
-
resizeObserver3Observe() {
|
|
690
|
-
var t, e;
|
|
691
|
-
this.childrenDom && (this.resizeObserver3 || (this.resizeObserver3Disconnect(), this.resizeObserver3 = new ResizeObserver(() => {
|
|
692
|
-
window.requestAnimationFrame(this.onResize);
|
|
693
|
-
}), (e = (t = this.resizeObserver3) == null ? void 0 : t.observe) == null || e.call(t, this.childrenDom)));
|
|
694
|
-
}
|
|
695
|
-
resizeObserver3Disconnect() {
|
|
696
|
-
var t, e;
|
|
697
|
-
(e = (t = this.resizeObserver3) == null ? void 0 : t.disconnect) == null || e.call(t), this.resizeObserver3 = null;
|
|
698
|
-
}
|
|
699
527
|
componentDidMount() {
|
|
700
|
-
this.componentDidUpdate(this.getMergedProps()), this.isDidMount = !0, this.unmount = !1, this.childrenDom = this.getRootElement(), this.state.popupVisible && (this.childrenDomSize =
|
|
528
|
+
this.componentDidUpdate(this.getMergedProps()), this.isDidMount = !0, this.unmount = !1, this.childrenDom = this.getRootElement(), this.state.popupVisible && (this.childrenDomSize = B(this.childrenDom, {
|
|
701
529
|
boundaryDistance: this.props.alignPoint ? void 0 : this.props.boundaryDistance,
|
|
702
530
|
position: this.props.position
|
|
703
531
|
}));
|
|
704
532
|
}
|
|
705
|
-
componentDidUpdate(
|
|
706
|
-
this.
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
this.offClickOutside(), this.offContainerResize(), this.offWindowResize(), this.offScrollListeners();
|
|
533
|
+
componentDidUpdate(e) {
|
|
534
|
+
const t = this.getMergedProps(e), s = this.getMergedProps();
|
|
535
|
+
!t.popupVisible && s.popupVisible && this.update();
|
|
536
|
+
const { popupVisible: o } = this.state;
|
|
537
|
+
this.popupOpen = o;
|
|
538
|
+
const { getDocument: r } = s;
|
|
539
|
+
if (!o) {
|
|
540
|
+
this.offClickOutside(), this.offContainerResize(), this.offWindowResize(), this.offScrollListeners(), this.offResizeObserver2(), this.offResizeObserver3();
|
|
714
541
|
return;
|
|
715
542
|
}
|
|
716
|
-
const
|
|
543
|
+
const n = B(this.childrenDom, {
|
|
717
544
|
boundaryDistance: this.props.alignPoint ? {} : this.props.boundaryDistance,
|
|
718
545
|
position: this.props.position
|
|
719
546
|
});
|
|
720
|
-
if (
|
|
721
|
-
const
|
|
722
|
-
|
|
723
|
-
capture:
|
|
547
|
+
if (ie(n, this.childrenDomSize) || (this.updatePopupPosition(), this.childrenDomSize = n), this.onContainerResize(), (s.updateOnScroll || s.containerScrollToClose) && this.onContainersScroll(s), this.handleWindowResize || (w(window, "resize", this.handleUpdatePosition), this.handleWindowResize = !0), !this.handleClickOutside) {
|
|
548
|
+
const a = g(r) && r();
|
|
549
|
+
a && (w(a, "mousedown", this.onClickOutside, {
|
|
550
|
+
capture: L(s.clickOutsideToClose) ? s.clickOutsideToClose.capture : !1
|
|
724
551
|
}), this.handleClickOutside = !0);
|
|
725
552
|
}
|
|
553
|
+
this.onResizeObserver2(), this.onResizeObserver3();
|
|
726
554
|
}
|
|
727
555
|
componentWillUnmount() {
|
|
728
|
-
this.unmount = !0, this.offClickOutside(), this.clearTimer(), this.offWindowResize(), this.offScrollListeners(), this.offContainerResize(),
|
|
556
|
+
this.unmount = !0, this.offClickOutside(), this.clearTimer(), this.offWindowResize(), this.offScrollListeners(), this.offContainerResize(), k(this.rafId), this.offResizeObserver2(), this.offResizeObserver3();
|
|
729
557
|
}
|
|
730
558
|
clearDelayTimer() {
|
|
731
559
|
this.delayTimer && (clearTimeout(this.delayTimer), this.delayTimer = null);
|
|
732
560
|
}
|
|
733
561
|
render() {
|
|
734
|
-
var
|
|
562
|
+
var z;
|
|
735
563
|
const {
|
|
736
|
-
children:
|
|
737
|
-
style:
|
|
738
|
-
className:
|
|
739
|
-
arrowProps:
|
|
740
|
-
disabled:
|
|
741
|
-
popup:
|
|
742
|
-
classNames:
|
|
743
|
-
duration:
|
|
744
|
-
unmountOnExit:
|
|
745
|
-
alignPoint:
|
|
746
|
-
autoAlignPopupWidth:
|
|
747
|
-
position:
|
|
748
|
-
childrenPrefix:
|
|
749
|
-
showArrow:
|
|
750
|
-
popupStyle:
|
|
751
|
-
__onExit:
|
|
752
|
-
__onExited:
|
|
753
|
-
} = this.getMergedProps(),
|
|
754
|
-
if (!
|
|
564
|
+
children: e,
|
|
565
|
+
style: t,
|
|
566
|
+
className: s,
|
|
567
|
+
arrowProps: o,
|
|
568
|
+
disabled: r,
|
|
569
|
+
popup: n,
|
|
570
|
+
classNames: a,
|
|
571
|
+
duration: T,
|
|
572
|
+
unmountOnExit: f,
|
|
573
|
+
alignPoint: v,
|
|
574
|
+
autoAlignPopupWidth: A,
|
|
575
|
+
position: I,
|
|
576
|
+
childrenPrefix: c,
|
|
577
|
+
showArrow: U,
|
|
578
|
+
popupStyle: _,
|
|
579
|
+
__onExit: M,
|
|
580
|
+
__onExited: E
|
|
581
|
+
} = this.getMergedProps(), S = e || e === 0, { getPrefixCls: Y, zIndex: q, rtl: Q } = this.context, { popupVisible: D, popupStyle: X } = this.state;
|
|
582
|
+
if (!n)
|
|
755
583
|
return null;
|
|
756
|
-
const
|
|
584
|
+
const p = {}, O = {
|
|
757
585
|
onMouseDown: this.onPopupMouseDown
|
|
758
586
|
};
|
|
759
|
-
this.isHoverTrigger() && !
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
`${
|
|
766
|
-
{ [`${
|
|
767
|
-
|
|
768
|
-
),
|
|
769
|
-
...
|
|
770
|
-
|
|
771
|
-
|
|
587
|
+
this.isHoverTrigger() && !r ? (p.onMouseEnter = this.onMouseEnter, p.onMouseLeave = this.onMouseLeave, this.isClickToHide() && (p.onClick = this.clickToHidePopup), v && (p.onMouseMove = this.onMouseMove), this.isPopupHoverHide() || (O.onMouseEnter = this.onPopupMouseEnter, O.onMouseLeave = this.onPopupMouseLeave)) : (p.onMouseEnter = this.triggerOriginEvent("onMouseEnter"), p.onMouseLeave = this.triggerOriginEvent("onMouseLeave")), this.isContextMenuTrigger() && !r ? (p.onContextMenu = this.onContextMenu, p.onClick = this.clickToHidePopup) : p.onContextMenu = this.triggerOriginEvent("onContextMenu"), this.isClickTrigger() && !r ? p.onClick = this.onClick : p.onClick = p.onClick || this.triggerOriginEvent("onClick"), this.isFocusTrigger() && !r ? (p.onFocus = this.onFocus, this.isBlurToHide() && (p.onBlur = this.onBlur)) : (p.onFocus = this.triggerOriginEvent("onFocus"), p.onBlur = this.triggerOriginEvent("onBlur")), r ? p.onKeyDown = this.triggerOriginEvent("onKeyDown") : p.onKeyDown = this.onKeyDown;
|
|
588
|
+
const m = this.getChild(), y = C.Children.only(n());
|
|
589
|
+
m.props.className && (p.className = m.props.className), c && D && (p.className = p.className ? `${p.className} ${c}-open` : `${c}-open`), this.isFocusTrigger() && (p.tabIndex = r ? -1 : 0);
|
|
590
|
+
const P = Y("trigger"), K = b(
|
|
591
|
+
P,
|
|
592
|
+
c,
|
|
593
|
+
`${P}-position-${I}`,
|
|
594
|
+
{ [`${P}-rtl`]: Q },
|
|
595
|
+
s
|
|
596
|
+
), G = S && C.cloneElement(m, {
|
|
597
|
+
...p,
|
|
598
|
+
ref: ne(m) ? (l) => {
|
|
599
|
+
this.rootElementRef = l, ae(m, l);
|
|
600
|
+
} : void 0
|
|
601
|
+
}), j = /* @__PURE__ */ d(
|
|
602
|
+
ee,
|
|
772
603
|
{
|
|
773
|
-
in: !!
|
|
774
|
-
timeout:
|
|
775
|
-
classNames:
|
|
776
|
-
unmountOnExit:
|
|
604
|
+
in: !!D,
|
|
605
|
+
timeout: T,
|
|
606
|
+
classNames: a,
|
|
607
|
+
unmountOnExit: f,
|
|
777
608
|
appear: !0,
|
|
778
609
|
mountOnEnter: !0,
|
|
779
|
-
onEnter: (
|
|
780
|
-
|
|
610
|
+
onEnter: () => {
|
|
611
|
+
this.triggerRefDestoried = !1;
|
|
612
|
+
const l = this.getPopupElement();
|
|
613
|
+
l && (l.style.display = "initial", l.style.pointerEvents = "none", a === "slideDynamicOrigin" && (l.style.transform = this.getTransformTranslate()));
|
|
781
614
|
},
|
|
782
|
-
onEntering: (
|
|
783
|
-
|
|
615
|
+
onEntering: () => {
|
|
616
|
+
const l = this.getPopupElement();
|
|
617
|
+
l && a === "slideDynamicOrigin" && (l.style.transform = "");
|
|
784
618
|
},
|
|
785
|
-
onEntered: (
|
|
786
|
-
|
|
619
|
+
onEntered: () => {
|
|
620
|
+
const l = this.getPopupElement();
|
|
621
|
+
l && (l.style.pointerEvents = "auto", this.forceUpdate());
|
|
787
622
|
},
|
|
788
|
-
onExit: (
|
|
789
|
-
|
|
623
|
+
onExit: () => {
|
|
624
|
+
const l = this.getPopupElement();
|
|
625
|
+
l && (l.style.pointerEvents = "none", M == null || M(l));
|
|
790
626
|
},
|
|
791
|
-
onExited: (
|
|
792
|
-
|
|
627
|
+
onExited: () => {
|
|
628
|
+
const l = this.getPopupElement();
|
|
629
|
+
l && (l.style.display = "none", f && (this.triggerRefDestoried = !0), this.setState({ popupStyle: {} }), E == null || E(l));
|
|
793
630
|
},
|
|
794
|
-
|
|
631
|
+
nodeRef: this.triggerRef,
|
|
632
|
+
children: /* @__PURE__ */ V(
|
|
795
633
|
"span",
|
|
796
634
|
{
|
|
797
|
-
ref:
|
|
798
|
-
this.resizeObserver2Disconnect(), this.refTrigger = T, this.resizeObserver2Observe();
|
|
799
|
-
},
|
|
635
|
+
ref: this.triggerRef,
|
|
800
636
|
"trigger-placement": this.realPosition,
|
|
801
637
|
style: {
|
|
802
|
-
width:
|
|
803
|
-
...
|
|
638
|
+
width: A && (t == null ? void 0 : t.width) === void 0 ? (z = this.childrenDomSize) == null ? void 0 : z.width : "",
|
|
639
|
+
...X,
|
|
804
640
|
position: "absolute",
|
|
805
|
-
zIndex:
|
|
806
|
-
...
|
|
641
|
+
zIndex: q || "",
|
|
642
|
+
...t
|
|
807
643
|
// display
|
|
808
644
|
},
|
|
809
|
-
...
|
|
810
|
-
className:
|
|
811
|
-
...
|
|
645
|
+
...O,
|
|
646
|
+
className: K,
|
|
647
|
+
...le(this.props),
|
|
812
648
|
children: [
|
|
813
|
-
/* @__PURE__ */
|
|
814
|
-
|
|
649
|
+
/* @__PURE__ */ d(
|
|
650
|
+
y.type,
|
|
815
651
|
{
|
|
816
|
-
ref:
|
|
817
|
-
...
|
|
818
|
-
style: { ...
|
|
652
|
+
ref: y.ref,
|
|
653
|
+
...y.props,
|
|
654
|
+
style: { ...y.props.style, ..._ }
|
|
819
655
|
}
|
|
820
656
|
),
|
|
821
|
-
(
|
|
657
|
+
(U || o) && /* @__PURE__ */ d(
|
|
822
658
|
"div",
|
|
823
659
|
{
|
|
824
|
-
className:
|
|
825
|
-
[`${
|
|
660
|
+
className: b(`${P}-arrow-container`, {
|
|
661
|
+
[`${c}-arrow-container`]: c
|
|
826
662
|
}),
|
|
827
|
-
children: /* @__PURE__ */
|
|
663
|
+
children: /* @__PURE__ */ d(
|
|
828
664
|
"div",
|
|
829
665
|
{
|
|
830
|
-
...
|
|
831
|
-
className:
|
|
832
|
-
`${
|
|
666
|
+
...o,
|
|
667
|
+
className: b(
|
|
668
|
+
`${P}-arrow`,
|
|
833
669
|
{
|
|
834
|
-
[`${
|
|
670
|
+
[`${c}-arrow`]: c
|
|
835
671
|
},
|
|
836
|
-
|
|
672
|
+
o == null ? void 0 : o.className
|
|
837
673
|
),
|
|
838
|
-
style: { ...this.arrowStyle, ...
|
|
674
|
+
style: { ...this.arrowStyle, ...o == null ? void 0 : o.style }
|
|
839
675
|
}
|
|
840
676
|
)
|
|
841
677
|
}
|
|
@@ -844,15 +680,15 @@ class Z extends ht {
|
|
|
844
680
|
}
|
|
845
681
|
)
|
|
846
682
|
}
|
|
847
|
-
),
|
|
848
|
-
return
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
] }) :
|
|
683
|
+
), x = D || this.getPopupElement() && !this.triggerRefDestoried ? /* @__PURE__ */ d(ce, { getContainer: this.getContainer, children: j }) : null;
|
|
684
|
+
return S ? /* @__PURE__ */ V(C.Fragment, { children: [
|
|
685
|
+
G,
|
|
686
|
+
x
|
|
687
|
+
] }) : x;
|
|
852
688
|
}
|
|
853
689
|
}
|
|
854
|
-
|
|
690
|
+
i(W, "displayName", "Trigger"), i(W, "contextType", fe);
|
|
855
691
|
export {
|
|
856
|
-
|
|
857
|
-
|
|
692
|
+
We as EventsByTriggerNeed,
|
|
693
|
+
W as default
|
|
858
694
|
};
|