@chaoswise/ui 3.1.6 → 3.1.8
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/lib/Antd5/_util/PurePanel.js +9 -1
- package/lib/Antd5/_util/convertToTooltipProps.js +15 -0
- package/lib/Antd5/_util/extendsObject.js +14 -23
- package/lib/Antd5/_util/hooks/useClosable.js +25 -31
- package/lib/Antd5/_util/hooks/useMergeSemantic/index.js +89 -0
- package/lib/Antd5/_util/hooks/useMergeSemantic/interface.js +1 -0
- package/lib/Antd5/_util/isPrimitive.js +5 -0
- package/lib/Antd5/_util/mediaQueryUtil.js +16 -0
- package/lib/Antd5/_util/responsiveObserver.js +41 -33
- package/lib/Antd5/_util/toList.js +6 -3
- package/lib/Antd5/_util/warning.js +0 -1
- package/lib/Antd5/_util/wave/WaveEffect.js +29 -16
- package/lib/Antd5/_util/wave/index.js +2 -2
- package/lib/Antd5/_util/wave/useWave.js +1 -1
- package/lib/Antd5/affix/index.js +13 -11
- package/lib/Antd5/alert/Alert.js +19 -18
- package/lib/Antd5/anchor/Anchor.js +9 -7
- package/lib/Antd5/anchor/AnchorLink.js +16 -3
- package/lib/Antd5/app/App.js +90 -0
- package/lib/Antd5/app/index.js +3 -92
- package/lib/Antd5/app/useApp.js +6 -0
- package/lib/Antd5/auto-complete/AutoComplete.js +142 -0
- package/lib/Antd5/auto-complete/index.js +8 -106
- package/lib/Antd5/avatar/{avatar.js → Avatar.js} +25 -29
- package/lib/Antd5/avatar/{group.js → AvatarGroup.js} +14 -9
- package/lib/Antd5/avatar/index.js +3 -4
- package/lib/Antd5/breadcrumb/Breadcrumb.js +1 -0
- package/lib/Antd5/breadcrumb/style/index.js +1 -1
- package/lib/Antd5/button/{LoadingIcon.js → DefaultLoadingIcon.js} +12 -9
- package/lib/Antd5/button/button-group.js +11 -11
- package/lib/Antd5/button/button.js +60 -26
- package/lib/Antd5/button/buttonHelpers.js +8 -1
- package/lib/Antd5/button/style/compact.js +9 -10
- package/lib/Antd5/button/style/index.js +127 -41
- package/lib/Antd5/button/style/token.js +19 -8
- package/lib/Antd5/calendar/Header.js +4 -4
- package/lib/Antd5/calendar/generateCalendar.js +17 -12
- package/lib/Antd5/calendar/style/index.js +8 -2
- package/lib/Antd5/card/Card.js +9 -5
- package/lib/Antd5/card/style/index.js +22 -15
- package/lib/Antd5/carousel/index.js +21 -11
- package/lib/Antd5/carousel/style/index.js +39 -12
- package/lib/Antd5/cascader/index.js +54 -18
- package/lib/Antd5/cascader/style/columns.js +4 -2
- package/lib/Antd5/cascader/style/index.js +2 -1
- package/lib/Antd5/collapse/Collapse.js +32 -25
- package/lib/Antd5/collapse/style/index.js +14 -10
- package/lib/Antd5/color-picker/ColorPicker.js +13 -8
- package/lib/Antd5/color-picker/components/ColorAlphaInput.js +8 -13
- package/lib/Antd5/color-picker/components/ColorHexInput.js +1 -1
- package/lib/Antd5/color-picker/components/ColorHsbInput.js +8 -13
- package/lib/Antd5/color-picker/components/ColorInput.js +7 -7
- package/lib/Antd5/color-picker/components/ColorPresets.js +15 -12
- package/lib/Antd5/color-picker/components/ColorRgbInput.js +8 -13
- package/lib/Antd5/color-picker/components/ColorSteppers.js +6 -13
- package/lib/Antd5/color-picker/interface.js +3 -6
- package/lib/Antd5/color-picker/style/color-block.js +2 -1
- package/lib/Antd5/config-provider/MotionWrapper.js +12 -4
- package/lib/Antd5/config-provider/UnstableContext.js +29 -0
- package/lib/Antd5/config-provider/context.js +32 -2
- package/lib/Antd5/config-provider/cssVariables.js +7 -7
- package/lib/Antd5/config-provider/hooks/useSize.js +1 -1
- package/lib/Antd5/config-provider/index.js +12 -3
- package/lib/Antd5/date-picker/generatePicker/generateRangePicker.js +33 -12
- package/lib/Antd5/date-picker/generatePicker/generateSinglePicker.js +32 -13
- package/lib/Antd5/date-picker/hooks/useMergedPickerSemantic.js +47 -0
- package/lib/Antd5/date-picker/index.js +2 -2
- package/lib/Antd5/date-picker/locale/ar_EG.js +1 -8
- package/lib/Antd5/date-picker/locale/example.json +5 -8
- package/lib/Antd5/date-picker/locale/ko_KR.js +11 -1
- package/lib/Antd5/date-picker/locale/pl_PL.js +0 -3
- package/lib/Antd5/date-picker/locale/pt_PT.js +0 -3
- package/lib/Antd5/date-picker/locale/sl_SI.js +1 -3
- package/lib/Antd5/date-picker/style/index.js +9 -6
- package/lib/Antd5/date-picker/style/panel.js +12 -8
- package/lib/Antd5/date-picker/style/token.js +3 -3
- package/lib/Antd5/date-picker/style/variants.js +6 -2
- package/lib/Antd5/descriptions/Cell.js +14 -8
- package/lib/Antd5/descriptions/Item.js +2 -0
- package/lib/Antd5/descriptions/Row.js +10 -6
- package/lib/Antd5/descriptions/hooks/useRow.js +1 -1
- package/lib/Antd5/descriptions/index.js +45 -18
- package/lib/Antd5/descriptions/style/index.js +11 -2
- package/lib/Antd5/divider/index.js +32 -15
- package/lib/Antd5/divider/style/index.js +20 -7
- package/lib/Antd5/drawer/DrawerPanel.js +8 -10
- package/lib/Antd5/drawer/index.js +20 -17
- package/lib/Antd5/dropdown/dropdown-button.js +9 -3
- package/lib/Antd5/dropdown/dropdown.js +33 -35
- package/lib/Antd5/dropdown/style/index.js +1 -1
- package/lib/Antd5/empty/empty.js +2 -2
- package/lib/Antd5/empty/index.js +41 -23
- package/lib/Antd5/empty/simple.js +4 -4
- package/lib/Antd5/flex/style/index.js +2 -0
- package/lib/Antd5/float-button/FloatButton.js +12 -15
- package/lib/Antd5/float-button/FloatButtonContent.js +13 -7
- package/lib/Antd5/float-button/FloatButtonGroup.js +6 -6
- package/lib/Antd5/float-button/style/keyframes.js +4 -4
- package/lib/Antd5/form/ErrorList.js +1 -3
- package/lib/Antd5/form/Form.js +19 -19
- package/lib/Antd5/form/FormItem/index.js +1 -1
- package/lib/Antd5/form/FormItemLabel.js +12 -14
- package/lib/Antd5/form/context.js +3 -4
- package/lib/Antd5/form/hooks/useForm.js +16 -5
- package/lib/Antd5/form/hooks/useFormInstance.js +3 -3
- package/lib/Antd5/form/hooks/useFormItemStatus.js +7 -7
- package/lib/Antd5/form/hooks/useFormWarning.js +2 -2
- package/lib/Antd5/form/hooks/useFrameState.js +3 -4
- package/lib/Antd5/form/hooks/useItemRef.js +3 -2
- package/lib/Antd5/form/hooks/useVariants.js +5 -5
- package/lib/Antd5/form/style/index.js +22 -15
- package/lib/Antd5/grid/hooks/useBreakpoint.js +2 -1
- package/lib/Antd5/grid/hooks/useGutter.js +29 -0
- package/lib/Antd5/grid/row.js +8 -63
- package/lib/Antd5/grid/style/index.js +14 -8
- package/lib/Antd5/image/PreviewGroup.js +9 -2
- package/lib/Antd5/image/index.js +26 -17
- package/lib/Antd5/image/style/index.js +10 -10
- package/lib/Antd5/index.js +3 -1
- package/lib/Antd5/input/Group.js +5 -3
- package/lib/Antd5/input/Input.js +27 -20
- package/lib/Antd5/input/OTP/OTPInput.js +36 -19
- package/lib/Antd5/input/OTP/index.js +40 -19
- package/lib/Antd5/input/Password.js +7 -9
- package/lib/Antd5/input/Search.js +16 -9
- package/lib/Antd5/input/TextArea.js +90 -33
- package/lib/Antd5/input/style/index.js +31 -82
- package/lib/Antd5/input/style/otp.js +22 -6
- package/lib/Antd5/input/style/textarea.js +80 -0
- package/lib/Antd5/input/style/token.js +16 -7
- package/lib/Antd5/input/style/variants.js +67 -12
- package/lib/Antd5/input-number/index.js +1 -1
- package/lib/Antd5/input-number/style/index.js +10 -7
- package/lib/Antd5/input-number/style/token.js +6 -4
- package/lib/Antd5/layout/Sider.js +58 -68
- package/lib/Antd5/layout/layout.js +7 -5
- package/lib/Antd5/layout/style/sider.js +33 -42
- package/lib/Antd5/list/index.js +45 -45
- package/lib/Antd5/locale/ar_EG.js +7 -1
- package/lib/Antd5/locale/az_AZ.js +3 -2
- package/lib/Antd5/locale/bg_BG.js +8 -0
- package/lib/Antd5/locale/bn_BD.js +7 -1
- package/lib/Antd5/locale/by_BY.js +8 -2
- package/lib/Antd5/locale/ca_ES.js +7 -1
- package/lib/Antd5/locale/cs_CZ.js +19 -2
- package/lib/Antd5/locale/da_DK.js +8 -0
- package/lib/Antd5/locale/de_DE.js +4 -2
- package/lib/Antd5/locale/el_GR.js +3 -2
- package/lib/Antd5/locale/en_GB.js +8 -2
- package/lib/Antd5/locale/en_US.js +3 -2
- package/lib/Antd5/locale/es_ES.js +3 -2
- package/lib/Antd5/locale/et_EE.js +8 -2
- package/lib/Antd5/locale/eu_ES.js +3 -2
- package/lib/Antd5/locale/fa_IR.js +17 -7
- package/lib/Antd5/locale/fi_FI.js +8 -0
- package/lib/Antd5/locale/fr_BE.js +4 -1
- package/lib/Antd5/locale/fr_CA.js +9 -1
- package/lib/Antd5/locale/fr_FR.js +4 -1
- package/lib/Antd5/locale/ga_IE.js +7 -1
- package/lib/Antd5/locale/gl_ES.js +7 -1
- package/lib/Antd5/locale/he_IL.js +10 -1
- package/lib/Antd5/locale/hi_IN.js +7 -1
- package/lib/Antd5/locale/hr_HR.js +7 -1
- package/lib/Antd5/locale/hu_HU.js +8 -0
- package/lib/Antd5/locale/hy_AM.js +8 -3
- package/lib/Antd5/locale/id_ID.js +3 -2
- package/lib/Antd5/locale/is_IS.js +8 -0
- package/lib/Antd5/locale/it_IT.js +3 -2
- package/lib/Antd5/locale/ja_JP.js +3 -2
- package/lib/Antd5/locale/ka_GE.js +7 -1
- package/lib/Antd5/locale/kk_KZ.js +7 -1
- package/lib/Antd5/locale/km_KH.js +3 -0
- package/lib/Antd5/locale/kmr_IQ.js +8 -0
- package/lib/Antd5/locale/kn_IN.js +8 -2
- package/lib/Antd5/locale/ko_KR.js +3 -2
- package/lib/Antd5/locale/ku_IQ.js +8 -0
- package/lib/Antd5/locale/lt_LT.js +3 -2
- package/lib/Antd5/locale/lv_LV.js +8 -0
- package/lib/Antd5/locale/mk_MK.js +7 -1
- package/lib/Antd5/locale/ml_IN.js +7 -1
- package/lib/Antd5/locale/mn_MN.js +8 -2
- package/lib/Antd5/locale/ms_MY.js +3 -2
- package/lib/Antd5/locale/my_MM.js +3 -2
- package/lib/Antd5/locale/nb_NO.js +7 -1
- package/lib/Antd5/locale/ne_NP.js +3 -2
- package/lib/Antd5/locale/nl_BE.js +2 -1
- package/lib/Antd5/locale/nl_NL.js +2 -1
- package/lib/Antd5/locale/pl_PL.js +3 -2
- package/lib/Antd5/locale/pt_BR.js +3 -2
- package/lib/Antd5/locale/pt_PT.js +3 -2
- package/lib/Antd5/locale/ro_RO.js +7 -1
- package/lib/Antd5/locale/ru_RU.js +4 -3
- package/lib/Antd5/locale/si_LK.js +8 -2
- package/lib/Antd5/locale/sk_SK.js +8 -2
- package/lib/Antd5/locale/sl_SI.js +8 -0
- package/lib/Antd5/locale/sr_RS.js +7 -1
- package/lib/Antd5/locale/sv_SE.js +3 -2
- package/lib/Antd5/locale/ta_IN.js +8 -2
- package/lib/Antd5/locale/th_TH.js +3 -2
- package/lib/Antd5/locale/tk_TK.js +7 -1
- package/lib/Antd5/locale/tr_TR.js +8 -2
- package/lib/Antd5/locale/uk_UA.js +3 -2
- package/lib/Antd5/locale/ur_PK.js +7 -1
- package/lib/Antd5/locale/uz_UZ.js +5 -4
- package/lib/Antd5/locale/vi_VN.js +3 -2
- package/lib/Antd5/locale/zh_CN.js +3 -2
- package/lib/Antd5/locale/zh_HK.js +11 -3
- package/lib/Antd5/locale/zh_TW.js +11 -3
- package/lib/Antd5/mentions/index.js +1 -1
- package/lib/Antd5/mentions/style/index.js +12 -7
- package/lib/Antd5/menu/MenuItem.js +3 -1
- package/lib/Antd5/menu/OverrideContext.js +2 -2
- package/lib/Antd5/menu/menu.js +1 -7
- package/lib/Antd5/menu/style/index.js +9 -6
- package/lib/Antd5/menu/style/theme.js +4 -3
- package/lib/Antd5/menu/style/vertical.js +1 -1
- package/lib/Antd5/message/style/index.js +4 -3
- package/lib/Antd5/modal/ConfirmDialog.js +2 -19
- package/lib/Antd5/modal/Modal.js +67 -35
- package/lib/Antd5/modal/confirm.js +5 -3
- package/lib/Antd5/modal/style/confirm.js +3 -1
- package/lib/Antd5/modal/style/index.js +21 -1
- package/lib/Antd5/modal/useModal/HookModal.js +2 -1
- package/lib/Antd5/notification/PurePanel.js +13 -6
- package/lib/Antd5/notification/index.js +3 -4
- package/lib/Antd5/notification/style/index.js +4 -3
- package/lib/Antd5/notification/style/stack.js +2 -1
- package/lib/Antd5/notification/useNotification.js +9 -4
- package/lib/Antd5/notification/util.js +9 -0
- package/lib/Antd5/pagination/Pagination.js +87 -20
- package/lib/Antd5/pagination/style/index.js +2 -10
- package/lib/Antd5/pagination/useShowSizeChanger.js +13 -0
- package/lib/Antd5/popconfirm/index.js +21 -6
- package/lib/Antd5/popover/index.js +21 -8
- package/lib/Antd5/progress/Steps.js +6 -2
- package/lib/Antd5/progress/progress.js +2 -2
- package/lib/Antd5/progress/utils.js +3 -3
- package/lib/Antd5/qr-code/style/index.js +2 -2
- package/lib/Antd5/segmented/index.js +16 -8
- package/lib/Antd5/segmented/style/index.js +14 -6
- package/lib/Antd5/select/index.js +45 -16
- package/lib/Antd5/select/style/dropdown.js +10 -9
- package/lib/Antd5/select/style/index.js +14 -10
- package/lib/Antd5/select/style/single.js +6 -3
- package/lib/Antd5/select/style/variants.js +55 -1
- package/lib/Antd5/skeleton/Paragraph.js +5 -8
- package/lib/Antd5/skeleton/Skeleton.js +8 -7
- package/lib/Antd5/slider/SliderTooltip.js +3 -2
- package/lib/Antd5/slider/index.js +43 -17
- package/lib/Antd5/slider/style/index.js +3 -3
- package/lib/Antd5/slider/useRafLock.js +1 -1
- package/lib/Antd5/space/Compact.js +8 -6
- package/lib/Antd5/space/index.js +16 -12
- package/lib/Antd5/spin/index.js +11 -9
- package/lib/Antd5/spin/style/index.js +1 -3
- package/lib/Antd5/spin/usePercent.js +1 -1
- package/lib/Antd5/splitter/SplitBar.js +56 -7
- package/lib/Antd5/splitter/Splitter.js +27 -17
- package/lib/Antd5/splitter/hooks/useResizable.js +3 -3
- package/lib/Antd5/splitter/hooks/useResize.js +17 -6
- package/lib/Antd5/splitter/style/index.js +32 -6
- package/lib/Antd5/statistic/Countdown.js +8 -61
- package/lib/Antd5/statistic/Statistic.js +17 -9
- package/lib/Antd5/statistic/Timer.js +91 -0
- package/lib/Antd5/statistic/index.js +2 -0
- package/lib/Antd5/statistic/utils.js +2 -2
- package/lib/Antd5/steps/index.js +8 -7
- package/lib/Antd5/steps/style/index.js +1 -1
- package/lib/Antd5/style/index.js +9 -4
- package/lib/Antd5/switch/style/index.js +2 -2
- package/lib/Antd5/table/InternalTable.js +6 -5
- package/lib/Antd5/table/hooks/useFilter/FilterDropdown.js +15 -11
- package/lib/Antd5/table/hooks/useFilter/FilterSearch.js +1 -1
- package/lib/Antd5/table/hooks/useFilter/index.js +3 -2
- package/lib/Antd5/table/hooks/useSelection.js +11 -3
- package/lib/Antd5/table/hooks/useSorter.js +4 -3
- package/lib/Antd5/table/style/filter.js +2 -2
- package/lib/Antd5/table/style/index.js +9 -9
- package/lib/Antd5/table/style/sorter.js +2 -1
- package/lib/Antd5/table/style/sticky.js +1 -1
- package/lib/Antd5/tabs/hooks/useLegacyItems.js +11 -4
- package/lib/Antd5/tabs/index.js +9 -2
- package/lib/Antd5/tabs/style/index.js +44 -23
- package/lib/Antd5/tag/style/index.js +3 -3
- package/lib/Antd5/theme/context.js +1 -3
- package/lib/Antd5/theme/getDesignToken.js +2 -2
- package/lib/Antd5/theme/themes/dark/colorAlgorithm.js +3 -3
- package/lib/Antd5/theme/themes/dark/index.js +13 -3
- package/lib/Antd5/theme/themes/default/colorAlgorithm.js +3 -3
- package/lib/Antd5/theme/themes/default/index.js +5 -1
- package/lib/Antd5/theme/themes/default/theme.js +4 -0
- package/lib/Antd5/theme/themes/shared/genColorMapToken.js +3 -3
- package/lib/Antd5/theme/themes/shared/genFontSizes.js +3 -1
- package/lib/Antd5/theme/util/alias.js +2 -2
- package/lib/Antd5/theme/util/genStyleUtils.js +9 -11
- package/lib/Antd5/theme/util/getAlphaColor.js +12 -12
- package/lib/Antd5/theme/util/useResetIconStyle.js +2 -10
- package/lib/Antd5/time-picker/index.js +1 -1
- package/lib/Antd5/timeline/TimelineItemList.js +1 -1
- package/lib/Antd5/tooltip/index.js +46 -31
- package/lib/Antd5/tooltip/style/index.js +13 -4
- package/lib/Antd5/tour/index.js +4 -2
- package/lib/Antd5/tour/panelRender.js +42 -27
- package/lib/Antd5/tour/style/index.js +3 -3
- package/lib/Antd5/transfer/ListItem.js +1 -1
- package/lib/Antd5/transfer/hooks/useData.js +8 -4
- package/lib/Antd5/transfer/hooks/useSelection.js +5 -4
- package/lib/Antd5/transfer/index.js +6 -2
- package/lib/Antd5/transfer/list.js +32 -13
- package/lib/Antd5/transfer/search.js +1 -1
- package/lib/Antd5/transfer/style/index.js +3 -1
- package/lib/Antd5/tree/DirectoryTree.js +2 -2
- package/lib/Antd5/tree/style/index.js +9 -3
- package/lib/Antd5/tree-select/index.js +61 -18
- package/lib/Antd5/tree-select/style/index.js +1 -1
- package/lib/Antd5/typography/Base/Ellipsis.js +3 -3
- package/lib/Antd5/typography/Base/index.js +20 -13
- package/lib/Antd5/typography/Editable.js +1 -1
- package/lib/Antd5/typography/Typography.js +8 -7
- package/lib/Antd5/typography/hooks/useCopyClick.js +24 -25
- package/lib/Antd5/typography/hooks/usePrevious.js +1 -1
- package/lib/Antd5/typography/style/index.js +5 -5
- package/lib/Antd5/typography/style/mixins.js +1 -1
- package/lib/Antd5/upload/Upload.js +22 -24
- package/lib/Antd5/version/index.js +0 -1
- package/lib/Antd5/version/token-meta.json +1 -0
- package/lib/Antd5/version/token.json +1 -0
- package/lib/Antd5/version/version.js +1 -1
- package/lib/Antd5/watermark/context.js +1 -1
- package/lib/Antd5/watermark/index.js +20 -13
- package/lib/Antd5/watermark/useClips.js +18 -16
- package/lib/Antd5/watermark/useRafDebounce.js +1 -1
- package/lib/Antd5/watermark/useSingletonCache.js +19 -0
- package/lib/Antd5/watermark/useWatermark.js +9 -18
- package/lib/CWCascader/rc-cascader/OptionList/Column.js +17 -18
- package/lib/CWMessage/MessageContent/TabList/index.js +10 -10
- package/lib/CWMessage/MessageContent/index.js +26 -28
- package/lib/CWMessage/index.js +42 -46
- package/lib/CWRangePicker/index.js +15 -15
- package/lib/CWRangePicker/utils/generate/dayjs.js +112 -23
- package/lib/CWRangePicker/utils/generate/moment.js +109 -21
- package/lib/CWSelect/index.js +423 -150
- package/lib/CWTable/CWTable.js +11 -11
- package/lib/Joyride/index.js +3 -3
- package/lib/ModuleFederation/react-dynamic-remote-component/RemoteComponent.js +38 -39
- package/lib/ModuleFederation/react-dynamic-remote-component/load-module.js +22 -23
- package/lib/QuickTransfer/index.js +13 -13
- package/lib/SearchBar/index.js +7 -7
- package/lib/SingleSpa/index.js +22 -24
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/hooks/useMouse.js +3 -3
- package/lib/TimeRangeSlider/index.js +6 -6
- package/lib/TimeRangeSlider/utils/generate/dayjs.js +109 -20
- package/lib/TimeRangeSlider/utils/generate/moment.js +109 -20
- package/lib/TimeZoneSelect/index.js +21 -22
- package/package.json +35 -34
- package/lib/Antd5/_util/isNumeric.js +0 -4
- package/lib/Antd5/pagination/Select.js +0 -24
package/lib/Antd5/space/index.js
CHANGED
|
@@ -18,20 +18,24 @@ import * as React from 'react';
|
|
|
18
18
|
import classNames from 'classnames';
|
|
19
19
|
import toArray from 'rc-util/lib/Children/toArray';
|
|
20
20
|
import { isPresetSize, isValidGapNumber } from '../_util/gapSize';
|
|
21
|
-
import {
|
|
21
|
+
import { useComponentConfig } from '../config-provider/context';
|
|
22
22
|
import Compact from './Compact';
|
|
23
23
|
import { SpaceContextProvider } from './context';
|
|
24
24
|
import Item from './Item';
|
|
25
25
|
import useStyle from './style';
|
|
26
26
|
export { SpaceContext } from './context';
|
|
27
27
|
var InternalSpace = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
getPrefixCls =
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
var _customClassNames$ite;
|
|
29
|
+
var _useComponentConfig = useComponentConfig('space'),
|
|
30
|
+
getPrefixCls = _useComponentConfig.getPrefixCls,
|
|
31
|
+
directionConfig = _useComponentConfig.direction,
|
|
32
|
+
contextSize = _useComponentConfig.size,
|
|
33
|
+
contextClassName = _useComponentConfig.className,
|
|
34
|
+
contextStyle = _useComponentConfig.style,
|
|
35
|
+
contextClassNames = _useComponentConfig.classNames,
|
|
36
|
+
contextStyles = _useComponentConfig.styles;
|
|
33
37
|
var _props$size = props.size,
|
|
34
|
-
size = _props$size === void 0 ?
|
|
38
|
+
size = _props$size === void 0 ? contextSize !== null && contextSize !== void 0 ? contextSize : 'small' : _props$size,
|
|
35
39
|
align = props.align,
|
|
36
40
|
className = props.className,
|
|
37
41
|
rootClassName = props.rootClassName,
|
|
@@ -64,12 +68,12 @@ var InternalSpace = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
64
68
|
wrapCSSVar = _useStyle2[0],
|
|
65
69
|
hashId = _useStyle2[1],
|
|
66
70
|
cssVarCls = _useStyle2[2];
|
|
67
|
-
var cls = classNames(prefixCls,
|
|
68
|
-
var itemClassName = classNames("".concat(prefixCls, "-item"), (_customClassNames$ite = customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.item) !== null && _customClassNames$ite !== void 0 ? _customClassNames$ite :
|
|
71
|
+
var cls = classNames(prefixCls, contextClassName, hashId, "".concat(prefixCls, "-").concat(direction), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-rtl"), directionConfig === 'rtl'), "".concat(prefixCls, "-align-").concat(mergedAlign), mergedAlign), "".concat(prefixCls, "-gap-row-").concat(verticalSize), isPresetVerticalSize), "".concat(prefixCls, "-gap-col-").concat(horizontalSize), isPresetHorizontalSize), className, rootClassName, cssVarCls);
|
|
72
|
+
var itemClassName = classNames("".concat(prefixCls, "-item"), (_customClassNames$ite = customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.item) !== null && _customClassNames$ite !== void 0 ? _customClassNames$ite : contextClassNames.item);
|
|
69
73
|
// Calculate latest one
|
|
70
74
|
var latestIndex = 0;
|
|
71
75
|
var nodes = childNodes.map(function (child, i) {
|
|
72
|
-
var _styles$item
|
|
76
|
+
var _styles$item;
|
|
73
77
|
if (child !== null && child !== undefined) {
|
|
74
78
|
latestIndex = i;
|
|
75
79
|
}
|
|
@@ -78,7 +82,7 @@ var InternalSpace = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
78
82
|
className: itemClassName,
|
|
79
83
|
index: i,
|
|
80
84
|
split: split,
|
|
81
|
-
style: (_styles$item = styles === null || styles === void 0 ? void 0 : styles.item) !== null && _styles$item !== void 0 ? _styles$item :
|
|
85
|
+
style: (_styles$item = styles === null || styles === void 0 ? void 0 : styles.item) !== null && _styles$item !== void 0 ? _styles$item : contextStyles.item,
|
|
82
86
|
children: child
|
|
83
87
|
}, key);
|
|
84
88
|
});
|
|
@@ -104,7 +108,7 @@ var InternalSpace = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
104
108
|
return wrapCSSVar(_jsx("div", _objectSpread(_objectSpread({
|
|
105
109
|
ref: ref,
|
|
106
110
|
className: cls,
|
|
107
|
-
style: _objectSpread(_objectSpread(_objectSpread({}, gapStyle),
|
|
111
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, gapStyle), contextStyle), style)
|
|
108
112
|
}, otherProps), {}, {
|
|
109
113
|
children: _jsx(SpaceContextProvider, {
|
|
110
114
|
value: spaceContext,
|
package/lib/Antd5/spin/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import * as React from 'react';
|
|
|
18
18
|
import classNames from 'classnames';
|
|
19
19
|
import { debounce } from 'throttle-debounce';
|
|
20
20
|
import { devUseWarning } from '../_util/warning';
|
|
21
|
-
import {
|
|
21
|
+
import { useComponentConfig } from '../config-provider/context';
|
|
22
22
|
import Indicator from './Indicator';
|
|
23
23
|
import useStyle from './style/index';
|
|
24
24
|
import usePercent from './usePercent';
|
|
@@ -26,7 +26,7 @@ var _SpinSizes = ['small', 'default', 'large'];
|
|
|
26
26
|
// Render indicator
|
|
27
27
|
var defaultIndicator;
|
|
28
28
|
function shouldDelay(spinning, delay) {
|
|
29
|
-
return !!spinning && !!delay && !isNaN(Number(delay));
|
|
29
|
+
return !!spinning && !!delay && !Number.isNaN(Number(delay));
|
|
30
30
|
}
|
|
31
31
|
var Spin = function Spin(props) {
|
|
32
32
|
var _ref;
|
|
@@ -48,10 +48,12 @@ var Spin = function Spin(props) {
|
|
|
48
48
|
indicator = props.indicator,
|
|
49
49
|
percent = props.percent,
|
|
50
50
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
51
|
-
var
|
|
52
|
-
getPrefixCls =
|
|
53
|
-
direction =
|
|
54
|
-
|
|
51
|
+
var _useComponentConfig = useComponentConfig('spin'),
|
|
52
|
+
getPrefixCls = _useComponentConfig.getPrefixCls,
|
|
53
|
+
direction = _useComponentConfig.direction,
|
|
54
|
+
contextClassName = _useComponentConfig.className,
|
|
55
|
+
contextStyle = _useComponentConfig.style,
|
|
56
|
+
contextIndicator = _useComponentConfig.indicator;
|
|
55
57
|
var prefixCls = getPrefixCls('spin', customizePrefixCls);
|
|
56
58
|
var _useStyle = useStyle(prefixCls),
|
|
57
59
|
_useStyle2 = _slicedToArray(_useStyle, 3),
|
|
@@ -85,10 +87,10 @@ var Spin = function Spin(props) {
|
|
|
85
87
|
var warning = devUseWarning('Spin');
|
|
86
88
|
warning(!tip || isNestedPattern || fullscreen, 'usage', '`tip` only work in nest or fullscreen pattern.');
|
|
87
89
|
}
|
|
88
|
-
var spinClassName = classNames(prefixCls,
|
|
90
|
+
var spinClassName = classNames(prefixCls, contextClassName, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-sm"), size === 'small'), "".concat(prefixCls, "-lg"), size === 'large'), "".concat(prefixCls, "-spinning"), spinning), "".concat(prefixCls, "-show-text"), !!tip), "".concat(prefixCls, "-rtl"), direction === 'rtl'), className, !fullscreen && rootClassName, hashId, cssVarCls);
|
|
89
91
|
var containerClassName = classNames("".concat(prefixCls, "-container"), _defineProperty({}, "".concat(prefixCls, "-blur"), spinning));
|
|
90
|
-
var mergedIndicator = (_ref = indicator !== null && indicator !== void 0 ? indicator :
|
|
91
|
-
var mergedStyle = _objectSpread(_objectSpread({},
|
|
92
|
+
var mergedIndicator = (_ref = indicator !== null && indicator !== void 0 ? indicator : contextIndicator) !== null && _ref !== void 0 ? _ref : defaultIndicator;
|
|
93
|
+
var mergedStyle = _objectSpread(_objectSpread({}, contextStyle), style);
|
|
92
94
|
var spinElement = _jsxs("div", _objectSpread(_objectSpread({}, restProps), {}, {
|
|
93
95
|
style: mergedStyle,
|
|
94
96
|
className: spinClassName,
|
|
@@ -139,9 +139,7 @@ var genSpinStyle = function genSpinStyle(token) {
|
|
|
139
139
|
}
|
|
140
140
|
}), "".concat(componentCls, "-dot-progress"), {
|
|
141
141
|
position: 'absolute',
|
|
142
|
-
|
|
143
|
-
transform: 'translate(-50%, -50%)',
|
|
144
|
-
insetInlineStart: '50%'
|
|
142
|
+
inset: 0
|
|
145
143
|
}), "".concat(componentCls, "-dot"), {
|
|
146
144
|
position: 'relative',
|
|
147
145
|
display: 'inline-block',
|
|
@@ -12,7 +12,7 @@ export default function usePercent(spinning, percent) {
|
|
|
12
12
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
13
13
|
mockPercent = _React$useState2[0],
|
|
14
14
|
setMockPercent = _React$useState2[1];
|
|
15
|
-
var mockIntervalRef = React.useRef();
|
|
15
|
+
var mockIntervalRef = React.useRef(null);
|
|
16
16
|
var isAuto = percent === 'auto';
|
|
17
17
|
React.useEffect(function () {
|
|
18
18
|
if (isAuto && spinning) {
|
|
@@ -15,6 +15,7 @@ import LeftOutlined from '@ant-design/icons/LeftOutlined';
|
|
|
15
15
|
import RightOutlined from '@ant-design/icons/RightOutlined';
|
|
16
16
|
import UpOutlined from '@ant-design/icons/UpOutlined';
|
|
17
17
|
import classNames from 'classnames';
|
|
18
|
+
import useEvent from 'rc-util/lib/hooks/useEvent';
|
|
18
19
|
function getValidNumber(num) {
|
|
19
20
|
return typeof num === 'number' && !Number.isNaN(num) ? Math.round(num) : 0;
|
|
20
21
|
}
|
|
@@ -32,13 +33,21 @@ var SplitBar = function SplitBar(props) {
|
|
|
32
33
|
onOffsetStart = props.onOffsetStart,
|
|
33
34
|
onOffsetUpdate = props.onOffsetUpdate,
|
|
34
35
|
onOffsetEnd = props.onOffsetEnd,
|
|
35
|
-
onCollapse = props.onCollapse
|
|
36
|
+
onCollapse = props.onCollapse,
|
|
37
|
+
lazy = props.lazy,
|
|
38
|
+
containerSize = props.containerSize;
|
|
36
39
|
var splitBarPrefixCls = "".concat(prefixCls, "-bar");
|
|
37
40
|
// ======================== Resize ========================
|
|
38
41
|
var _useState = useState(null),
|
|
39
42
|
_useState2 = _slicedToArray(_useState, 2),
|
|
40
43
|
startPos = _useState2[0],
|
|
41
44
|
setStartPos = _useState2[1];
|
|
45
|
+
var _useState3 = useState(0),
|
|
46
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
47
|
+
constrainedOffset = _useState4[0],
|
|
48
|
+
setConstrainedOffset = _useState4[1];
|
|
49
|
+
var constrainedOffsetX = vertical ? 0 : constrainedOffset;
|
|
50
|
+
var constrainedOffsetY = vertical ? constrainedOffset : 0;
|
|
42
51
|
var onMouseDown = function onMouseDown(e) {
|
|
43
52
|
if (resizable && e.currentTarget) {
|
|
44
53
|
setStartPos([e.pageX, e.pageY]);
|
|
@@ -52,6 +61,26 @@ var SplitBar = function SplitBar(props) {
|
|
|
52
61
|
onOffsetStart(index);
|
|
53
62
|
}
|
|
54
63
|
};
|
|
64
|
+
// Updated constraint calculation
|
|
65
|
+
var getConstrainedOffset = function getConstrainedOffset(rawOffset) {
|
|
66
|
+
var currentPos = containerSize * ariaNow / 100;
|
|
67
|
+
var newPos = currentPos + rawOffset;
|
|
68
|
+
// Calculate available space
|
|
69
|
+
var minAllowed = Math.max(0, containerSize * ariaMin / 100);
|
|
70
|
+
var maxAllowed = Math.min(containerSize, containerSize * ariaMax / 100);
|
|
71
|
+
// Constrain new position within bounds
|
|
72
|
+
var clampedPos = Math.max(minAllowed, Math.min(maxAllowed, newPos));
|
|
73
|
+
return clampedPos - currentPos;
|
|
74
|
+
};
|
|
75
|
+
var handleLazyMove = useEvent(function (offsetX, offsetY) {
|
|
76
|
+
var constrainedOffsetValue = getConstrainedOffset(vertical ? offsetY : offsetX);
|
|
77
|
+
setConstrainedOffset(constrainedOffsetValue);
|
|
78
|
+
});
|
|
79
|
+
var handleLazyEnd = useEvent(function () {
|
|
80
|
+
onOffsetUpdate(index, constrainedOffsetX, constrainedOffsetY, true);
|
|
81
|
+
setConstrainedOffset(0);
|
|
82
|
+
onOffsetEnd(true);
|
|
83
|
+
});
|
|
55
84
|
React.useEffect(function () {
|
|
56
85
|
if (startPos) {
|
|
57
86
|
var onMouseMove = function onMouseMove(e) {
|
|
@@ -59,23 +88,39 @@ var SplitBar = function SplitBar(props) {
|
|
|
59
88
|
pageY = e.pageY;
|
|
60
89
|
var offsetX = pageX - startPos[0];
|
|
61
90
|
var offsetY = pageY - startPos[1];
|
|
62
|
-
|
|
91
|
+
if (lazy) {
|
|
92
|
+
handleLazyMove(offsetX, offsetY);
|
|
93
|
+
} else {
|
|
94
|
+
onOffsetUpdate(index, offsetX, offsetY);
|
|
95
|
+
}
|
|
63
96
|
};
|
|
64
97
|
var onMouseUp = function onMouseUp() {
|
|
98
|
+
if (lazy) {
|
|
99
|
+
handleLazyEnd();
|
|
100
|
+
} else {
|
|
101
|
+
onOffsetEnd();
|
|
102
|
+
}
|
|
65
103
|
setStartPos(null);
|
|
66
|
-
onOffsetEnd();
|
|
67
104
|
};
|
|
68
105
|
var handleTouchMove = function handleTouchMove(e) {
|
|
69
106
|
if (e.touches.length === 1) {
|
|
70
107
|
var touch = e.touches[0];
|
|
71
108
|
var offsetX = touch.pageX - startPos[0];
|
|
72
109
|
var offsetY = touch.pageY - startPos[1];
|
|
73
|
-
|
|
110
|
+
if (lazy) {
|
|
111
|
+
handleLazyMove(offsetX, offsetY);
|
|
112
|
+
} else {
|
|
113
|
+
onOffsetUpdate(index, offsetX, offsetY);
|
|
114
|
+
}
|
|
74
115
|
}
|
|
75
116
|
};
|
|
76
117
|
var handleTouchEnd = function handleTouchEnd() {
|
|
118
|
+
if (lazy) {
|
|
119
|
+
handleLazyEnd();
|
|
120
|
+
} else {
|
|
121
|
+
onOffsetEnd();
|
|
122
|
+
}
|
|
77
123
|
setStartPos(null);
|
|
78
|
-
onOffsetEnd();
|
|
79
124
|
};
|
|
80
125
|
window.addEventListener('touchmove', handleTouchMove);
|
|
81
126
|
window.addEventListener('touchend', handleTouchEnd);
|
|
@@ -88,7 +133,8 @@ var SplitBar = function SplitBar(props) {
|
|
|
88
133
|
window.removeEventListener('touchend', handleTouchEnd);
|
|
89
134
|
};
|
|
90
135
|
}
|
|
91
|
-
}, [startPos]);
|
|
136
|
+
}, [startPos, lazy, vertical, index, containerSize, ariaNow, ariaMin, ariaMax]);
|
|
137
|
+
var transformStyle = _defineProperty({}, "--".concat(splitBarPrefixCls, "-preview-offset"), "".concat(constrainedOffset, "px"));
|
|
92
138
|
// ======================== Render ========================
|
|
93
139
|
var StartIcon = vertical ? UpOutlined : LeftOutlined;
|
|
94
140
|
var EndIcon = vertical ? DownOutlined : RightOutlined;
|
|
@@ -98,7 +144,10 @@ var SplitBar = function SplitBar(props) {
|
|
|
98
144
|
"aria-valuenow": getValidNumber(ariaNow),
|
|
99
145
|
"aria-valuemin": getValidNumber(ariaMin),
|
|
100
146
|
"aria-valuemax": getValidNumber(ariaMax),
|
|
101
|
-
children: [_jsx("div", {
|
|
147
|
+
children: [lazy && _jsx("div", {
|
|
148
|
+
className: classNames("".concat(splitBarPrefixCls, "-preview"), _defineProperty({}, "".concat(splitBarPrefixCls, "-preview-active"), !!constrainedOffset)),
|
|
149
|
+
style: transformStyle
|
|
150
|
+
}), _jsx("div", {
|
|
102
151
|
className: classNames("".concat(splitBarPrefixCls, "-dragger"), _defineProperty(_defineProperty({}, "".concat(splitBarPrefixCls, "-dragger-disabled"), !resizable), "".concat(splitBarPrefixCls, "-dragger-active"), active)),
|
|
103
152
|
onMouseDown: onMouseDown,
|
|
104
153
|
onTouchStart: onTouchStart
|
|
@@ -17,7 +17,7 @@ import classNames from 'classnames';
|
|
|
17
17
|
import ResizeObserver from 'rc-resize-observer';
|
|
18
18
|
import useEvent from 'rc-util/lib/hooks/useEvent';
|
|
19
19
|
import { devUseWarning } from '../_util/warning';
|
|
20
|
-
import {
|
|
20
|
+
import { useComponentConfig } from '../config-provider/context';
|
|
21
21
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
|
22
22
|
import useItems from './hooks/useItems';
|
|
23
23
|
import useResizable from './hooks/useResizable';
|
|
@@ -36,11 +36,13 @@ var Splitter = function Splitter(props) {
|
|
|
36
36
|
rootClassName = props.rootClassName,
|
|
37
37
|
onResizeStart = props.onResizeStart,
|
|
38
38
|
onResize = props.onResize,
|
|
39
|
-
onResizeEnd = props.onResizeEnd
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
onResizeEnd = props.onResizeEnd,
|
|
40
|
+
lazy = props.lazy;
|
|
41
|
+
var _useComponentConfig = useComponentConfig('splitter'),
|
|
42
|
+
getPrefixCls = _useComponentConfig.getPrefixCls,
|
|
43
|
+
direction = _useComponentConfig.direction,
|
|
44
|
+
contextClassName = _useComponentConfig.className,
|
|
45
|
+
contextStyle = _useComponentConfig.style;
|
|
44
46
|
var prefixCls = getPrefixCls('splitter', customizePrefixCls);
|
|
45
47
|
var rootCls = useCSSVarCls(prefixCls);
|
|
46
48
|
var _useStyle = useStyle(prefixCls, rootCls),
|
|
@@ -96,8 +98,8 @@ var Splitter = function Splitter(props) {
|
|
|
96
98
|
itemPtgMaxSizes = _useSizes2[4],
|
|
97
99
|
updateSizes = _useSizes2[5];
|
|
98
100
|
// ====================== Resizable =======================
|
|
99
|
-
var resizableInfos = useResizable(items, itemPxSizes);
|
|
100
|
-
var _useResize = useResize(items, resizableInfos, itemPtgSizes, containerSize, updateSizes),
|
|
101
|
+
var resizableInfos = useResizable(items, itemPxSizes, isRTL);
|
|
102
|
+
var _useResize = useResize(items, resizableInfos, itemPtgSizes, containerSize, updateSizes, isRTL),
|
|
101
103
|
_useResize2 = _slicedToArray(_useResize, 5),
|
|
102
104
|
onOffsetStart = _useResize2[0],
|
|
103
105
|
onOffsetUpdate = _useResize2[1],
|
|
@@ -109,13 +111,19 @@ var Splitter = function Splitter(props) {
|
|
|
109
111
|
onOffsetStart(index);
|
|
110
112
|
onResizeStart === null || onResizeStart === void 0 || onResizeStart(itemPxSizes);
|
|
111
113
|
});
|
|
112
|
-
var onInternalResizeUpdate = useEvent(function (index, offset) {
|
|
114
|
+
var onInternalResizeUpdate = useEvent(function (index, offset, lazyEnd) {
|
|
113
115
|
var nextSizes = onOffsetUpdate(index, offset);
|
|
114
|
-
|
|
116
|
+
if (lazyEnd) {
|
|
117
|
+
onResizeEnd === null || onResizeEnd === void 0 || onResizeEnd(nextSizes);
|
|
118
|
+
} else {
|
|
119
|
+
onResize === null || onResize === void 0 || onResize(nextSizes);
|
|
120
|
+
}
|
|
115
121
|
});
|
|
116
|
-
var onInternalResizeEnd = useEvent(function () {
|
|
122
|
+
var onInternalResizeEnd = useEvent(function (lazyEnd) {
|
|
117
123
|
onOffsetEnd();
|
|
118
|
-
|
|
124
|
+
if (!lazyEnd) {
|
|
125
|
+
onResizeEnd === null || onResizeEnd === void 0 || onResizeEnd(itemPxSizes);
|
|
126
|
+
}
|
|
119
127
|
});
|
|
120
128
|
var onInternalCollapse = useEvent(function (index, type) {
|
|
121
129
|
var nextSizes = onCollapse(index, type);
|
|
@@ -123,7 +131,7 @@ var Splitter = function Splitter(props) {
|
|
|
123
131
|
onResizeEnd === null || onResizeEnd === void 0 || onResizeEnd(nextSizes);
|
|
124
132
|
});
|
|
125
133
|
// ======================== Styles ========================
|
|
126
|
-
var containerClassName = classNames(prefixCls, className, "".concat(prefixCls, "-").concat(layout), _defineProperty({}, "".concat(prefixCls, "-rtl"), isRTL), rootClassName,
|
|
134
|
+
var containerClassName = classNames(prefixCls, className, "".concat(prefixCls, "-").concat(layout), _defineProperty({}, "".concat(prefixCls, "-rtl"), isRTL), rootClassName, contextClassName, cssVarCls, rootCls, hashId);
|
|
127
135
|
// ======================== Render ========================
|
|
128
136
|
var maskCls = "".concat(prefixCls, "-mask");
|
|
129
137
|
var stackSizes = React.useMemo(function () {
|
|
@@ -135,7 +143,7 @@ var Splitter = function Splitter(props) {
|
|
|
135
143
|
}
|
|
136
144
|
return mergedSizes;
|
|
137
145
|
}, [itemPtgSizes]);
|
|
138
|
-
var mergedStyle = _objectSpread(_objectSpread({},
|
|
146
|
+
var mergedStyle = _objectSpread(_objectSpread({}, contextStyle), style);
|
|
139
147
|
return wrapCSSVar(_jsx(ResizeObserver, {
|
|
140
148
|
onResize: onContainerResize,
|
|
141
149
|
children: _jsxs("div", {
|
|
@@ -156,6 +164,7 @@ var Splitter = function Splitter(props) {
|
|
|
156
164
|
var ariaMaxStart = (stackSizes[idx - 1] || 0) + itemPtgMaxSizes[idx];
|
|
157
165
|
var ariaMaxEnd = (stackSizes[idx + 1] || 100) - itemPtgMinSizes[idx + 1];
|
|
158
166
|
splitBar = _jsx(SplitBar, {
|
|
167
|
+
lazy: lazy,
|
|
159
168
|
index: idx,
|
|
160
169
|
active: movingIndex === idx,
|
|
161
170
|
prefixCls: prefixCls,
|
|
@@ -167,15 +176,16 @@ var Splitter = function Splitter(props) {
|
|
|
167
176
|
startCollapsible: resizableInfo.startCollapsible,
|
|
168
177
|
endCollapsible: resizableInfo.endCollapsible,
|
|
169
178
|
onOffsetStart: onInternalResizeStart,
|
|
170
|
-
onOffsetUpdate: function onOffsetUpdate(index, offsetX, offsetY) {
|
|
179
|
+
onOffsetUpdate: function onOffsetUpdate(index, offsetX, offsetY, lazyEnd) {
|
|
171
180
|
var offset = isVertical ? offsetY : offsetX;
|
|
172
181
|
if (reverse) {
|
|
173
182
|
offset = -offset;
|
|
174
183
|
}
|
|
175
|
-
onInternalResizeUpdate(index, offset);
|
|
184
|
+
onInternalResizeUpdate(index, offset, lazyEnd);
|
|
176
185
|
},
|
|
177
186
|
onOffsetEnd: onInternalResizeEnd,
|
|
178
|
-
onCollapse: onInternalCollapse
|
|
187
|
+
onCollapse: onInternalCollapse,
|
|
188
|
+
containerSize: containerSize || 0
|
|
179
189
|
});
|
|
180
190
|
}
|
|
181
191
|
return _jsxs(React.Fragment, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export default function useResizable(items, pxSizes) {
|
|
2
|
+
export default function useResizable(items, pxSizes, isRTL) {
|
|
3
3
|
return React.useMemo(function () {
|
|
4
4
|
var resizeInfos = [];
|
|
5
5
|
for (var i = 0; i < items.length - 1; i += 1) {
|
|
@@ -34,8 +34,8 @@ export default function useResizable(items, pxSizes) {
|
|
|
34
34
|
prevCollapsible.end && prevSize === 0 && nextSize > 0;
|
|
35
35
|
resizeInfos[i] = {
|
|
36
36
|
resizable: mergedResizable,
|
|
37
|
-
startCollapsible: !!startCollapsible,
|
|
38
|
-
endCollapsible: !!endCollapsible
|
|
37
|
+
startCollapsible: !!(isRTL ? endCollapsible : startCollapsible),
|
|
38
|
+
endCollapsible: !!(isRTL ? startCollapsible : endCollapsible)
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
return resizeInfos;
|
|
@@ -13,7 +13,7 @@ import { getPtg } from './useSizes';
|
|
|
13
13
|
/**
|
|
14
14
|
* Handle user drag resize logic.
|
|
15
15
|
*/
|
|
16
|
-
export default function useResize(items, resizableInfos, percentSizes, containerSize, updateSizes) {
|
|
16
|
+
export default function useResize(items, resizableInfos, percentSizes, containerSize, updateSizes, isRTL) {
|
|
17
17
|
var limitSizes = items.map(function (item) {
|
|
18
18
|
return [item.min, item.max];
|
|
19
19
|
});
|
|
@@ -33,6 +33,7 @@ export default function useResize(items, resizableInfos, percentSizes, container
|
|
|
33
33
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
34
34
|
cacheSizes = _React$useState2[0],
|
|
35
35
|
setCacheSizes = _React$useState2[1];
|
|
36
|
+
var cacheCollapsedSize = React.useRef([]);
|
|
36
37
|
/**
|
|
37
38
|
* When start drag, check the direct is `start` or `end`.
|
|
38
39
|
* This will handle when 2 splitter bar are in the same position.
|
|
@@ -111,14 +112,16 @@ export default function useResize(items, resizableInfos, percentSizes, container
|
|
|
111
112
|
// ======================= Collapse =======================
|
|
112
113
|
var onCollapse = function onCollapse(index, type) {
|
|
113
114
|
var currentSizes = getPxSizes();
|
|
114
|
-
var
|
|
115
|
-
var
|
|
115
|
+
var adjustedType = isRTL ? type === 'start' ? 'end' : 'start' : type;
|
|
116
|
+
var currentIndex = adjustedType === 'start' ? index : index + 1;
|
|
117
|
+
var targetIndex = adjustedType === 'start' ? index + 1 : index;
|
|
116
118
|
var currentSize = currentSizes[currentIndex];
|
|
117
119
|
var targetSize = currentSizes[targetIndex];
|
|
118
120
|
if (currentSize !== 0 && targetSize !== 0) {
|
|
119
121
|
// Collapse directly
|
|
120
122
|
currentSizes[currentIndex] = 0;
|
|
121
123
|
currentSizes[targetIndex] += currentSize;
|
|
124
|
+
cacheCollapsedSize.current[index] = currentSize;
|
|
122
125
|
} else {
|
|
123
126
|
var totalSize = currentSize + targetSize;
|
|
124
127
|
var currentSizeMin = getLimitSize(limitSizes[currentIndex][0], 0);
|
|
@@ -127,9 +130,17 @@ export default function useResize(items, resizableInfos, percentSizes, container
|
|
|
127
130
|
var targetSizeMax = getLimitSize(limitSizes[targetIndex][1], mergedContainerSize);
|
|
128
131
|
var limitStart = Math.max(currentSizeMin, totalSize - targetSizeMax);
|
|
129
132
|
var limitEnd = Math.min(currentSizeMax, totalSize - targetSizeMin);
|
|
130
|
-
var halfOffset = (limitEnd - limitStart) / 2;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
var halfOffset = targetSizeMin || (limitEnd - limitStart) / 2;
|
|
134
|
+
var targetCacheCollapsedSize = cacheCollapsedSize.current[index];
|
|
135
|
+
var currentCacheCollapsedSize = totalSize - targetCacheCollapsedSize;
|
|
136
|
+
var shouldUseCache = targetCacheCollapsedSize && targetCacheCollapsedSize <= targetSizeMax && targetCacheCollapsedSize >= targetSizeMin && currentCacheCollapsedSize <= currentSizeMax && currentCacheCollapsedSize >= currentSizeMin;
|
|
137
|
+
if (shouldUseCache) {
|
|
138
|
+
currentSizes[targetIndex] = targetCacheCollapsedSize;
|
|
139
|
+
currentSizes[currentIndex] = currentCacheCollapsedSize;
|
|
140
|
+
} else {
|
|
141
|
+
currentSizes[currentIndex] -= halfOffset;
|
|
142
|
+
currentSizes[targetIndex] += halfOffset;
|
|
143
|
+
}
|
|
133
144
|
}
|
|
134
145
|
updateSizes(currentSizes);
|
|
135
146
|
return currentSizes;
|
|
@@ -39,11 +39,22 @@ var genSplitterStyle = function genSplitterStyle(token) {
|
|
|
39
39
|
splitTriggerSize = token.splitTriggerSize,
|
|
40
40
|
controlItemBgHover = token.controlItemBgHover,
|
|
41
41
|
controlItemBgActive = token.controlItemBgActive,
|
|
42
|
-
controlItemBgActiveHover = token.controlItemBgActiveHover
|
|
42
|
+
controlItemBgActiveHover = token.controlItemBgActiveHover,
|
|
43
|
+
prefixCls = token.prefixCls;
|
|
43
44
|
var splitBarCls = "".concat(componentCls, "-bar");
|
|
44
45
|
var splitMaskCls = "".concat(componentCls, "-mask");
|
|
45
46
|
var splitPanelCls = "".concat(componentCls, "-panel");
|
|
46
47
|
var halfTriggerSize = token.calc(splitTriggerSize).div(2).equal();
|
|
48
|
+
var splitterBarPreviewOffsetVar = "".concat(prefixCls, "-bar-preview-offset");
|
|
49
|
+
var splitterBarPreviewStyle = {
|
|
50
|
+
position: 'absolute',
|
|
51
|
+
background: token.colorPrimary,
|
|
52
|
+
opacity: 0.2,
|
|
53
|
+
pointerEvents: 'none',
|
|
54
|
+
transition: 'none',
|
|
55
|
+
zIndex: 1,
|
|
56
|
+
display: 'none'
|
|
57
|
+
};
|
|
47
58
|
return _defineProperty({}, componentCls, _objectSpread(_objectSpread({}, resetComponent(token)), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
48
59
|
display: 'flex',
|
|
49
60
|
width: '100%',
|
|
@@ -86,7 +97,7 @@ var genSplitterStyle = function genSplitterStyle(token) {
|
|
|
86
97
|
display: 'none'
|
|
87
98
|
}
|
|
88
99
|
}))), "".concat(splitBarCls, "-collapse-bar"), _objectSpread(_objectSpread({}, centerStyle), {}, {
|
|
89
|
-
zIndex:
|
|
100
|
+
zIndex: token.zIndexPopupBase,
|
|
90
101
|
background: controlItemBgHover,
|
|
91
102
|
fontSize: token.fontSizeSM,
|
|
92
103
|
borderRadius: token.borderRadiusXS,
|
|
@@ -96,6 +107,9 @@ var genSplitterStyle = function genSplitterStyle(token) {
|
|
|
96
107
|
display: 'flex',
|
|
97
108
|
alignItems: 'center',
|
|
98
109
|
justifyContent: 'center',
|
|
110
|
+
'@media(hover:none)': {
|
|
111
|
+
opacity: 1
|
|
112
|
+
},
|
|
99
113
|
// Hover
|
|
100
114
|
'&:hover': {
|
|
101
115
|
background: controlItemBgActive
|
|
@@ -118,9 +132,15 @@ var genSplitterStyle = function genSplitterStyle(token) {
|
|
|
118
132
|
}
|
|
119
133
|
}), '&-horizontal', _defineProperty({
|
|
120
134
|
flexDirection: 'row'
|
|
121
|
-
}, "> ".concat(splitBarCls), _defineProperty(_defineProperty({
|
|
135
|
+
}, "> ".concat(splitBarCls), _defineProperty(_defineProperty(_defineProperty({
|
|
122
136
|
width: 0
|
|
123
|
-
}, "".concat(splitBarCls, "-
|
|
137
|
+
}, "".concat(splitBarCls, "-preview"), _objectSpread(_objectSpread({
|
|
138
|
+
height: '100%',
|
|
139
|
+
width: splitBarSize
|
|
140
|
+
}, splitterBarPreviewStyle), {}, _defineProperty({}, "&".concat(splitBarCls, "-preview-active"), {
|
|
141
|
+
display: 'block',
|
|
142
|
+
transform: "translateX(var(--".concat(splitterBarPreviewOffsetVar, "))")
|
|
143
|
+
}))), "".concat(splitBarCls, "-dragger"), {
|
|
124
144
|
cursor: 'col-resize',
|
|
125
145
|
height: '100%',
|
|
126
146
|
width: splitTriggerSize,
|
|
@@ -159,9 +179,15 @@ var genSplitterStyle = function genSplitterStyle(token) {
|
|
|
159
179
|
}
|
|
160
180
|
}))), '&-vertical', _defineProperty({
|
|
161
181
|
flexDirection: 'column'
|
|
162
|
-
}, "> ".concat(splitBarCls), _defineProperty(_defineProperty({
|
|
182
|
+
}, "> ".concat(splitBarCls), _defineProperty(_defineProperty(_defineProperty({
|
|
163
183
|
height: 0
|
|
164
|
-
}, "".concat(splitBarCls, "-
|
|
184
|
+
}, "".concat(splitBarCls, "-preview"), _objectSpread(_objectSpread({
|
|
185
|
+
height: splitBarSize,
|
|
186
|
+
width: '100%'
|
|
187
|
+
}, splitterBarPreviewStyle), {}, _defineProperty({}, "&".concat(splitBarCls, "-preview-active"), {
|
|
188
|
+
display: 'block',
|
|
189
|
+
transform: "translateY(var(--".concat(splitterBarPreviewOffsetVar, "))")
|
|
190
|
+
}))), "".concat(splitBarCls, "-dragger"), {
|
|
165
191
|
cursor: 'row-resize',
|
|
166
192
|
width: '100%',
|
|
167
193
|
height: splitTriggerSize,
|
|
@@ -1,73 +1,20 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["value", "format", "onChange", "onFinish"];
|
|
3
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
8
|
import * as React from 'react';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import Statistic from './Statistic';
|
|
15
|
-
import { formatCountdown } from './utils';
|
|
16
|
-
var REFRESH_INTERVAL = 1000 / 30;
|
|
17
|
-
function getTime(value) {
|
|
18
|
-
return new Date(value).getTime();
|
|
19
|
-
}
|
|
9
|
+
import { devUseWarning } from '../_util/warning';
|
|
10
|
+
import StatisticTimer from './Timer';
|
|
20
11
|
var Countdown = function Countdown(props) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var forceUpdate = useForceUpdate();
|
|
28
|
-
var countdown = React.useRef(null);
|
|
29
|
-
var stopTimer = function stopTimer() {
|
|
30
|
-
onFinish === null || onFinish === void 0 || onFinish();
|
|
31
|
-
if (countdown.current) {
|
|
32
|
-
clearInterval(countdown.current);
|
|
33
|
-
countdown.current = null;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var syncTimer = function syncTimer() {
|
|
37
|
-
var timestamp = getTime(value);
|
|
38
|
-
if (timestamp >= Date.now()) {
|
|
39
|
-
countdown.current = setInterval(function () {
|
|
40
|
-
forceUpdate();
|
|
41
|
-
onChange === null || onChange === void 0 || onChange(timestamp - Date.now());
|
|
42
|
-
if (timestamp < Date.now()) {
|
|
43
|
-
stopTimer();
|
|
44
|
-
}
|
|
45
|
-
}, REFRESH_INTERVAL);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
React.useEffect(function () {
|
|
49
|
-
syncTimer();
|
|
50
|
-
return function () {
|
|
51
|
-
if (countdown.current) {
|
|
52
|
-
clearInterval(countdown.current);
|
|
53
|
-
countdown.current = null;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}, [value]);
|
|
57
|
-
var formatter = function formatter(formatValue, config) {
|
|
58
|
-
return formatCountdown(formatValue, _objectSpread(_objectSpread({}, config), {}, {
|
|
59
|
-
format: format
|
|
60
|
-
}));
|
|
61
|
-
};
|
|
62
|
-
var valueRender = function valueRender(node) {
|
|
63
|
-
return cloneElement(node, {
|
|
64
|
-
title: undefined
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
return _jsx(Statistic, _objectSpread(_objectSpread({}, rest), {}, {
|
|
68
|
-
value: value,
|
|
69
|
-
valueRender: valueRender,
|
|
70
|
-
formatter: formatter
|
|
12
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
13
|
+
var warning = devUseWarning('Countdown');
|
|
14
|
+
warning.deprecated(false, '<Statistic.Countdown />', '<Statistic.Timer type="countdown" />');
|
|
15
|
+
}
|
|
16
|
+
return _jsx(StatisticTimer, _objectSpread(_objectSpread({}, props), {}, {
|
|
17
|
+
type: "countdown"
|
|
71
18
|
}));
|
|
72
19
|
};
|
|
73
20
|
export default /*#__PURE__*/React.memo(Countdown);
|