@chaoswise/ui 3.0.22 → 3.1.0
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/Alert/index.js +48 -2
- package/lib/Alert/index.style.js +36 -0
- package/lib/Antd5/_util/ActionButton.js +4 -2
- package/lib/Antd5/_util/ContextIsolator.js +27 -0
- package/lib/Antd5/_util/easings.js +2 -2
- package/lib/Antd5/_util/getScroll.js +9 -8
- package/lib/Antd5/_util/hooks/useClosable.js +3 -2
- package/lib/Antd5/_util/hooks/useUniqueMemo.js +123 -0
- package/lib/Antd5/_util/hooks/useZIndex.js +31 -15
- package/lib/Antd5/_util/motion.js +3 -2
- package/lib/Antd5/_util/placements.js +2 -2
- package/lib/Antd5/_util/scrollTo.js +1 -1
- package/lib/Antd5/_util/statusUtils.js +1 -1
- package/lib/Antd5/_util/toList.js +5 -0
- package/lib/Antd5/_util/warning.js +0 -1
- package/lib/Antd5/_util/wave/WaveEffect.js +2 -2
- package/lib/Antd5/_util/wave/interface.js +2 -1
- package/lib/Antd5/_util/wave/useWave.js +1 -1
- package/lib/Antd5/_util/wave/util.js +1 -9
- package/lib/Antd5/alert/Alert.js +1 -2
- package/lib/Antd5/alert/ErrorBoundary.js +1 -1
- package/lib/Antd5/alert/design/behavior-pattern.js +3 -3
- package/lib/Antd5/alert/style/index.js +6 -4
- package/lib/Antd5/anchor/Anchor.js +8 -7
- package/lib/Antd5/anchor/AnchorLink.js +4 -4
- package/lib/Antd5/app/index.js +2 -1
- package/lib/Antd5/app/style/index.js +5 -4
- package/lib/Antd5/auto-complete/index.js +1 -1
- package/lib/Antd5/avatar/group.js +35 -17
- package/lib/Antd5/avatar/style/index.js +18 -13
- package/lib/Antd5/back-top/index.js +3 -2
- package/lib/Antd5/badge/ScrollNumber.js +1 -1
- package/lib/Antd5/badge/SingleNumber.js +17 -16
- package/lib/Antd5/badge/style/index.js +6 -7
- package/lib/Antd5/badge/style/ribbon.js +3 -3
- package/lib/Antd5/breadcrumb/design/behavior-pattern.js +4 -4
- package/lib/Antd5/breadcrumb/style/index.js +2 -2
- package/lib/Antd5/button/LoadingIcon.js +5 -10
- package/lib/Antd5/button/button-group.js +0 -1
- package/lib/Antd5/button/button.js +70 -41
- package/lib/Antd5/button/buttonHelpers.js +7 -5
- package/lib/Antd5/button/style/{compactCmp.js → compact.js} +20 -27
- package/lib/Antd5/button/style/group.js +9 -7
- package/lib/Antd5/button/style/index.js +150 -110
- package/lib/Antd5/button/style/token.js +8 -1
- package/lib/Antd5/calendar/generateCalendar.js +25 -28
- package/lib/Antd5/calendar/style/index.js +4 -4
- package/lib/Antd5/card/Card.js +3 -3
- package/lib/Antd5/card/style/index.js +6 -9
- package/lib/Antd5/carousel/index.js +3 -3
- package/lib/Antd5/carousel/style/index.js +1 -1
- package/lib/Antd5/cascader/Panel.js +7 -2
- package/lib/Antd5/cascader/hooks/useBase.js +3 -2
- package/lib/Antd5/cascader/hooks/useColumnIcons.js +6 -3
- package/lib/Antd5/cascader/index.js +1 -1
- package/lib/Antd5/cascader/style/columns.js +6 -4
- package/lib/Antd5/checkbox/Checkbox.js +11 -5
- package/lib/Antd5/checkbox/style/index.js +6 -3
- package/lib/Antd5/collapse/Collapse.js +2 -1
- package/lib/Antd5/collapse/style/index.js +20 -13
- package/lib/Antd5/color-picker/ColorPicker.js +120 -78
- package/lib/Antd5/color-picker/ColorPickerPanel.js +44 -26
- package/lib/Antd5/color-picker/color.js +82 -10
- package/lib/Antd5/color-picker/components/ColorAlphaInput.js +2 -2
- package/lib/Antd5/color-picker/components/ColorClear.js +2 -2
- package/lib/Antd5/color-picker/components/ColorHexInput.js +5 -4
- package/lib/Antd5/color-picker/components/ColorInput.js +4 -3
- package/lib/Antd5/color-picker/components/ColorPresets.js +1 -1
- package/lib/Antd5/color-picker/components/ColorSlider.js +139 -0
- package/lib/Antd5/color-picker/components/ColorTrigger.js +52 -26
- package/lib/Antd5/color-picker/components/PanelPicker/GradientColorBar.js +130 -0
- package/lib/Antd5/color-picker/components/PanelPicker/index.js +194 -0
- package/lib/Antd5/color-picker/context.js +1 -5
- package/lib/Antd5/color-picker/hooks/useModeColor.js +87 -0
- package/lib/Antd5/color-picker/style/color-block.js +3 -2
- package/lib/Antd5/color-picker/style/index.js +33 -15
- package/lib/Antd5/color-picker/style/input.js +1 -1
- package/lib/Antd5/color-picker/style/picker.js +6 -33
- package/lib/Antd5/color-picker/style/slider.js +87 -0
- package/lib/Antd5/color-picker/util.js +53 -7
- package/lib/Antd5/config-provider/context.js +3 -1
- package/lib/Antd5/config-provider/cssVariables.js +0 -1
- package/lib/Antd5/config-provider/defaultRenderEmpty.js +8 -1
- package/lib/Antd5/config-provider/index.js +13 -5
- package/lib/Antd5/config-provider/style/index.js +0 -1
- package/lib/Antd5/date-picker/PickerButton.js +3 -2
- package/lib/Antd5/date-picker/design/behavior-pattern.js +15 -15
- package/lib/Antd5/date-picker/generatePicker/constant.js +15 -0
- package/lib/Antd5/date-picker/generatePicker/generateRangePicker.js +16 -11
- package/lib/Antd5/date-picker/generatePicker/generateSinglePicker.js +19 -15
- package/lib/Antd5/date-picker/generatePicker/index.js +2 -2
- package/lib/Antd5/date-picker/generatePicker/interface.js +1 -1
- package/lib/Antd5/date-picker/index.js +2 -17
- package/lib/Antd5/date-picker/locale/ar_EG.js +9 -1
- package/lib/Antd5/date-picker/locale/az_AZ.js +9 -1
- package/lib/Antd5/date-picker/locale/el_GR.js +9 -1
- package/lib/Antd5/date-picker/locale/ja_JP.js +11 -1
- package/lib/Antd5/date-picker/locale/kn_IN.js +9 -1
- package/lib/Antd5/date-picker/locale/pl_PL.js +9 -1
- package/lib/Antd5/date-picker/locale/uk_UA.js +10 -1
- package/lib/Antd5/date-picker/style/index.js +13 -10
- package/lib/Antd5/date-picker/style/panel.js +36 -32
- package/lib/Antd5/date-picker/style/token.js +1 -1
- package/lib/Antd5/date-picker/util.js +0 -48
- package/lib/Antd5/descriptions/hooks/useItems.js +5 -0
- package/lib/Antd5/descriptions/hooks/useRow.js +42 -34
- package/lib/Antd5/descriptions/style/index.js +20 -8
- package/lib/Antd5/divider/index.js +4 -3
- package/lib/Antd5/divider/style/index.js +19 -4
- package/lib/Antd5/drawer/DrawerPanel.js +11 -20
- package/lib/Antd5/drawer/index.js +39 -42
- package/lib/Antd5/drawer/style/index.js +10 -11
- package/lib/Antd5/dropdown/dropdown.js +5 -7
- package/lib/Antd5/dropdown/style/index.js +27 -11
- package/lib/Antd5/empty/empty.js +9 -3
- package/lib/Antd5/empty/simple.js +9 -3
- package/lib/Antd5/empty/style/index.js +1 -1
- package/lib/Antd5/float-button/BackTop.js +3 -2
- package/lib/Antd5/float-button/FloatButton.js +16 -5
- package/lib/Antd5/float-button/FloatButtonGroup.js +76 -52
- package/lib/Antd5/float-button/style/index.js +117 -76
- package/lib/Antd5/float-button/style/keyframes.js +118 -0
- package/lib/Antd5/form/ErrorList.js +14 -2
- package/lib/Antd5/form/Form.js +11 -3
- package/lib/Antd5/form/FormItem/ItemHolder.js +8 -4
- package/lib/Antd5/form/FormItem/index.js +6 -4
- package/lib/Antd5/form/FormItemInput.js +68 -28
- package/lib/Antd5/form/FormItemLabel.js +3 -3
- package/lib/Antd5/form/hooks/useForm.js +8 -1
- package/lib/Antd5/form/hooks/useVariants.js +10 -4
- package/lib/Antd5/form/style/explain.js +9 -8
- package/lib/Antd5/form/style/index.js +30 -18
- package/lib/Antd5/grid/row.js +2 -2
- package/lib/Antd5/image/index.js +3 -1
- package/lib/Antd5/image/style/index.js +17 -20
- package/lib/Antd5/index.js +2 -1
- package/lib/Antd5/input/Input.js +18 -38
- package/lib/Antd5/input/OTP/OTPInput.js +10 -5
- package/lib/Antd5/input/OTP/index.js +12 -4
- package/lib/Antd5/input/Password.js +6 -2
- package/lib/Antd5/input/Search.js +2 -4
- package/lib/Antd5/input/TextArea.js +1 -1
- package/lib/Antd5/input/style/index.js +72 -63
- package/lib/Antd5/input/style/otp.js +1 -1
- package/lib/Antd5/input/style/variants.js +38 -23
- package/lib/Antd5/input/utils.js +0 -1
- package/lib/Antd5/input-number/index.js +19 -22
- package/lib/Antd5/input-number/style/index.js +26 -16
- package/lib/Antd5/layout/Sider.js +15 -8
- package/lib/Antd5/layout/style/index.js +6 -96
- package/lib/Antd5/layout/style/sider.js +115 -0
- package/lib/Antd5/list/Item.js +18 -5
- package/lib/Antd5/list/index.js +15 -10
- package/lib/Antd5/list/style/index.js +40 -41
- package/lib/Antd5/locale/ar_EG.js +14 -1
- package/lib/Antd5/locale/az_AZ.js +78 -28
- package/lib/Antd5/locale/bn_BD.js +0 -1
- package/lib/Antd5/locale/by_BY.js +0 -1
- package/lib/Antd5/locale/ca_ES.js +0 -1
- package/lib/Antd5/locale/cs_CZ.js +0 -1
- package/lib/Antd5/locale/de_DE.js +0 -1
- package/lib/Antd5/locale/el_GR.js +104 -3
- package/lib/Antd5/locale/en_GB.js +0 -1
- package/lib/Antd5/locale/en_US.js +4 -2
- package/lib/Antd5/locale/es_ES.js +10 -6
- package/lib/Antd5/locale/et_EE.js +0 -1
- package/lib/Antd5/locale/eu_ES.js +4 -2
- package/lib/Antd5/locale/fa_IR.js +0 -1
- package/lib/Antd5/locale/fr_BE.js +5 -1
- package/lib/Antd5/locale/fr_CA.js +0 -1
- package/lib/Antd5/locale/fr_FR.js +5 -6
- package/lib/Antd5/locale/ga_IE.js +0 -1
- package/lib/Antd5/locale/gl_ES.js +0 -1
- package/lib/Antd5/locale/he_IL.js +0 -1
- package/lib/Antd5/locale/hi_IN.js +0 -1
- package/lib/Antd5/locale/hr_HR.js +0 -1
- package/lib/Antd5/locale/id_ID.js +4 -2
- package/lib/Antd5/locale/index.js +1 -1
- package/lib/Antd5/locale/it_IT.js +0 -1
- package/lib/Antd5/locale/ja_JP.js +4 -2
- package/lib/Antd5/locale/ka_GE.js +0 -1
- package/lib/Antd5/locale/kk_KZ.js +0 -1
- package/lib/Antd5/locale/km_KH.js +0 -1
- package/lib/Antd5/locale/kn_IN.js +82 -4
- package/lib/Antd5/locale/ko_KR.js +4 -2
- package/lib/Antd5/locale/lt_LT.js +4 -2
- package/lib/Antd5/locale/ml_IN.js +0 -1
- package/lib/Antd5/locale/mn_MN.js +86 -2
- package/lib/Antd5/locale/ms_MY.js +101 -18
- package/lib/Antd5/locale/my_MM.js +0 -1
- package/lib/Antd5/locale/nb_NO.js +0 -1
- package/lib/Antd5/locale/ne_NP.js +104 -2
- package/lib/Antd5/locale/nl_BE.js +5 -1
- package/lib/Antd5/locale/nl_NL.js +5 -1
- package/lib/Antd5/locale/pl_PL.js +0 -1
- package/lib/Antd5/locale/pt_BR.js +0 -1
- package/lib/Antd5/locale/pt_PT.js +55 -38
- package/lib/Antd5/locale/ro_RO.js +0 -1
- package/lib/Antd5/locale/ru_RU.js +9 -2
- package/lib/Antd5/locale/si_LK.js +0 -1
- package/lib/Antd5/locale/sk_SK.js +0 -1
- package/lib/Antd5/locale/sr_RS.js +0 -1
- package/lib/Antd5/locale/sv_SE.js +0 -1
- package/lib/Antd5/locale/th_TH.js +11 -3
- package/lib/Antd5/locale/tk_TK.js +0 -1
- package/lib/Antd5/locale/tr_TR.js +2 -1
- package/lib/Antd5/locale/uk_UA.js +1 -1
- package/lib/Antd5/locale/ur_PK.js +0 -1
- package/lib/Antd5/locale/uz_UZ.js +6 -7
- package/lib/Antd5/locale/zh_CN.js +4 -2
- package/lib/Antd5/locale/zh_HK.js +0 -1
- package/lib/Antd5/locale/zh_TW.js +0 -1
- package/lib/Antd5/mentions/index.js +4 -4
- package/lib/Antd5/menu/MenuItem.js +6 -5
- package/lib/Antd5/menu/OverrideContext.js +4 -3
- package/lib/Antd5/menu/SubMenu.js +2 -2
- package/lib/Antd5/menu/menu.js +2 -2
- package/lib/Antd5/menu/style/index.js +58 -40
- package/lib/Antd5/menu/style/theme.js +24 -20
- package/lib/Antd5/menu/style/vertical.js +10 -7
- package/lib/Antd5/message/PurePanel.js +22 -40
- package/lib/Antd5/message/style/index.js +8 -47
- package/lib/Antd5/message/useMessage.js +3 -15
- package/lib/Antd5/modal/Modal.js +50 -38
- package/lib/Antd5/modal/PurePanel.js +0 -1
- package/lib/Antd5/modal/confirm.js +4 -5
- package/lib/Antd5/modal/style/confirm.js +1 -2
- package/lib/Antd5/modal/style/index.js +13 -3
- package/lib/Antd5/modal/useModal/HookModal.js +4 -3
- package/lib/Antd5/modal/useModal/index.js +0 -1
- package/lib/Antd5/notification/index.js +6 -3
- package/lib/Antd5/notification/style/index.js +35 -3
- package/lib/Antd5/notification/useNotification.js +6 -1
- package/lib/Antd5/pagination/Pagination.js +10 -5
- package/lib/Antd5/pagination/design/behavior-pattern.js +3 -3
- package/lib/Antd5/pagination/style/bordered.js +1 -1
- package/lib/Antd5/pagination/style/index.js +27 -18
- package/lib/Antd5/popconfirm/PurePanel.js +7 -7
- package/lib/Antd5/popover/PurePanel.js +16 -6
- package/lib/Antd5/popover/index.js +7 -19
- package/lib/Antd5/popover/style/index.js +3 -1
- package/lib/Antd5/progress/Line.js +27 -19
- package/lib/Antd5/progress/design/behavior-pattern.js +3 -3
- package/lib/Antd5/progress/progress.js +37 -11
- package/lib/Antd5/progress/style/index.js +46 -11
- package/lib/Antd5/progress/utils.js +20 -18
- package/lib/Antd5/qr-code/QrcodeStatus.js +42 -0
- package/lib/Antd5/qr-code/index.js +31 -31
- package/lib/Antd5/rate/index.js +8 -2
- package/lib/Antd5/result/noFound.js +3 -1
- package/lib/Antd5/result/serverError.js +3 -1
- package/lib/Antd5/result/unauthorized.js +5 -3
- package/lib/Antd5/segmented/index.js +5 -3
- package/lib/Antd5/segmented/style/index.js +11 -3
- package/lib/Antd5/select/index.js +4 -2
- package/lib/Antd5/select/style/dropdown.js +1 -1
- package/lib/Antd5/select/style/index.js +21 -8
- package/lib/Antd5/select/style/multiple.js +18 -9
- package/lib/Antd5/select/style/single.js +8 -10
- package/lib/Antd5/select/style/token.js +9 -2
- package/lib/Antd5/select/style/variants.js +20 -11
- package/lib/Antd5/skeleton/Image.js +6 -4
- package/lib/Antd5/skeleton/Node.js +1 -3
- package/lib/Antd5/skeleton/Paragraph.js +1 -1
- package/lib/Antd5/skeleton/Title.js +9 -6
- package/lib/Antd5/skeleton/style/index.js +13 -13
- package/lib/Antd5/slider/Context.js +4 -0
- package/lib/Antd5/slider/SliderTooltip.js +9 -5
- package/lib/Antd5/slider/index.js +32 -31
- package/lib/Antd5/slider/style/index.js +60 -44
- package/lib/Antd5/space/Compact.js +1 -1
- package/lib/Antd5/space/index.js +3 -3
- package/lib/Antd5/spin/Indicator/Looper.js +29 -0
- package/lib/Antd5/spin/Indicator/Progress.js +78 -0
- package/lib/Antd5/spin/Indicator/index.js +21 -0
- package/lib/Antd5/spin/index.js +27 -45
- package/lib/Antd5/spin/style/index.js +54 -17
- package/lib/Antd5/spin/usePercent.js +40 -0
- package/lib/Antd5/splitter/Panel.js +36 -0
- package/lib/Antd5/splitter/SplitBar.js +124 -0
- package/lib/Antd5/splitter/Splitter.js +194 -0
- package/lib/Antd5/{_util/transButton.js → splitter/hooks/useItems.js} +28 -54
- package/lib/Antd5/splitter/hooks/useResizable.js +43 -0
- package/lib/Antd5/splitter/hooks/useResize.js +138 -0
- package/lib/Antd5/splitter/hooks/useSizes.js +109 -0
- package/lib/Antd5/splitter/index.js +5 -0
- package/lib/Antd5/splitter/interface.js +1 -0
- package/lib/Antd5/splitter/style/index.js +219 -0
- package/lib/Antd5/statistic/style/index.js +1 -1
- package/lib/Antd5/steps/style/custom-icon.js +1 -1
- package/lib/Antd5/steps/style/index.js +11 -8
- package/lib/Antd5/steps/style/inline.js +5 -4
- package/lib/Antd5/steps/style/progress-dot.js +2 -2
- package/lib/Antd5/steps/style/small.js +3 -3
- package/lib/Antd5/steps/style/vertical.js +2 -2
- package/lib/Antd5/style/index.js +37 -13
- package/lib/Antd5/style/motion/slide.js +6 -5
- package/lib/Antd5/style/placementArrow.js +15 -6
- package/lib/Antd5/switch/style/index.js +1 -1
- package/lib/Antd5/table/Column.js +2 -3
- package/lib/Antd5/table/ColumnGroup.js +2 -3
- package/lib/Antd5/table/ExpandIcon.js +6 -6
- package/lib/Antd5/table/InternalTable.js +6 -6
- package/lib/Antd5/table/RcTable/VirtualTable.js +3 -2
- package/lib/Antd5/table/RcTable/index.js +3 -2
- package/lib/Antd5/table/hooks/useFilter/FilterDropdown.js +82 -61
- package/lib/Antd5/table/hooks/useFilter/FilterSearch.js +7 -7
- package/lib/Antd5/table/hooks/useFilter/index.js +28 -26
- package/lib/Antd5/table/hooks/useLazyKVMap.js +5 -5
- package/lib/Antd5/table/hooks/useSelection.js +21 -11
- package/lib/Antd5/table/hooks/useSorter.js +66 -42
- package/lib/Antd5/table/hooks/useTitleColumns.js +9 -7
- package/lib/Antd5/table/interface.js +1 -1
- package/lib/Antd5/table/style/bordered.js +5 -3
- package/lib/Antd5/table/style/expand.js +44 -38
- package/lib/Antd5/table/style/filter.js +1 -1
- package/lib/Antd5/table/style/index.js +26 -21
- package/lib/Antd5/table/style/selection.js +3 -1
- package/lib/Antd5/table/style/sorter.js +3 -1
- package/lib/Antd5/table/style/virtual.js +2 -2
- package/lib/Antd5/table/util.js +9 -8
- package/lib/Antd5/tabs/style/index.js +2 -2
- package/lib/Antd5/tag/style/index.js +2 -2
- package/lib/Antd5/theme/index.js +12 -5
- package/lib/Antd5/theme/interface/cssinjs-utils.js +1 -0
- package/lib/Antd5/theme/internal.js +10 -5
- package/lib/Antd5/theme/themes/dark/colors.js +3 -0
- package/lib/Antd5/theme/themes/dark/index.js +1 -0
- package/lib/Antd5/theme/themes/default/colors.js +3 -0
- package/lib/Antd5/theme/themes/default/index.js +6 -2
- package/lib/Antd5/theme/themes/seed.js +5 -2
- package/lib/Antd5/theme/themes/shared/genColorMapToken.js +2 -0
- package/lib/Antd5/theme/themes/shared/genFontSizes.js +1 -1
- package/lib/Antd5/theme/useToken.js +2 -1
- package/lib/Antd5/theme/util/alias.js +1 -1
- package/lib/Antd5/theme/util/genStyleUtils.js +61 -0
- package/lib/Antd5/time-picker/index.js +15 -2
- package/lib/Antd5/time-picker/locale/az_AZ.js +2 -1
- package/lib/Antd5/time-picker/locale/it_IT.js +2 -1
- package/lib/Antd5/time-picker/locale/uk_UA.js +2 -1
- package/lib/Antd5/timeline/TimelineItemList.js +0 -1
- package/lib/Antd5/timeline/style/index.js +1 -1
- package/lib/Antd5/tooltip/index.js +3 -2
- package/lib/Antd5/tooltip/style/index.js +3 -1
- package/lib/Antd5/tooltip/util.js +0 -1
- package/lib/Antd5/tour/panelRender.js +7 -13
- package/lib/Antd5/tour/style/index.js +6 -13
- package/lib/Antd5/transfer/ListItem.js +3 -3
- package/lib/Antd5/transfer/hooks/useData.js +1 -1
- package/lib/Antd5/transfer/hooks/useSelection.js +26 -21
- package/lib/Antd5/transfer/style/index.js +12 -22
- package/lib/Antd5/tree/Tree.js +2 -0
- package/lib/Antd5/tree/style/directory.js +39 -0
- package/lib/Antd5/tree/style/index.js +115 -166
- package/lib/Antd5/tree/utils/dropIndicator.js +3 -2
- package/lib/Antd5/tree/utils/iconUtil.js +5 -1
- package/lib/Antd5/tree-select/index.js +47 -43
- package/lib/Antd5/typography/Base/CopyBtn.js +17 -17
- package/lib/Antd5/typography/Base/Ellipsis.js +48 -40
- package/lib/Antd5/typography/Base/index.js +20 -60
- package/lib/Antd5/typography/Base/util.js +31 -1
- package/lib/Antd5/typography/Editable.js +11 -10
- package/lib/Antd5/typography/Title.js +1 -6
- package/lib/Antd5/typography/Typography.js +2 -6
- package/lib/Antd5/typography/hooks/useCopyClick.js +3 -2
- package/lib/Antd5/typography/hooks/usePrevious.js +1 -1
- package/lib/Antd5/{message/assets/Close.js → typography/hooks/useTooltipProps.js} +24 -16
- package/lib/Antd5/typography/style/mixins.js +3 -9
- package/lib/Antd5/upload/Upload.js +55 -83
- package/lib/Antd5/upload/UploadList/ListItem.js +15 -9
- package/lib/Antd5/upload/UploadList/index.js +33 -47
- package/lib/Antd5/upload/style/dragger.js +5 -26
- package/lib/Antd5/upload/style/list.js +2 -7
- package/lib/Antd5/version/version.js +1 -1
- package/lib/Antd5/watermark/context.js +1 -1
- package/lib/Antd5/watermark/index.js +35 -18
- package/lib/Antd5/watermark/useClips.js +2 -1
- package/lib/Antd5/watermark/useRafDebounce.js +1 -1
- package/lib/Antd5/watermark/utils.js +1 -1
- package/lib/Button/index.style.js +1 -3
- package/lib/CWSelect/index.js +39 -1
- package/lib/CWSelect/index.style.js +39 -0
- package/lib/CWTree/index.js +3 -9
- package/lib/CWTree/index.style.js +2 -0
- package/lib/ConfigProvider/ConfigProvider.js +9 -10
- package/lib/ConfigProvider/customTheme.js +9 -2
- package/lib/ConfigProvider/theme/common.js +140 -0
- package/lib/ConfigProvider/theme/dark.js +2 -0
- package/lib/ConfigProvider/theme/default.js +115 -0
- package/lib/ConfigProvider/theme/utils.js +49 -0
- package/lib/QuickTransfer/index.js +44 -48
- package/lib/RangePicker/components/ExtraQuickSelect.js +1 -4
- package/lib/RangePicker/index.js +38 -26
- package/lib/RangePicker/utils/generate/dayjs.js +1 -1
- package/lib/Splitter/index.js +2 -0
- package/package.json +37 -35
- package/lib/Antd5/color-picker/components/PanelPicker.js +0 -53
- package/lib/Antd5/color-picker/hooks/useColorState.js +0 -53
- package/lib/Antd5/layout/style/light.js +0 -24
- package/lib/Antd5/style/operationUnit.js +0 -18
- package/lib/Antd5/theme/util/calc/CSSCalculator.js +0 -119
- package/lib/Antd5/theme/util/calc/NumCalculator.js +0 -81
- package/lib/Antd5/theme/util/calc/calculator.js +0 -10
- package/lib/Antd5/theme/util/calc/index.js +0 -9
- package/lib/Antd5/theme/util/genComponentStyleHook.js +0 -243
- package/lib/Antd5/theme/util/maxmin.js +0 -27
- package/lib/Antd5/theme/util/statistic.js +0 -74
- package/lib/Antd5/typography/hooks/useUpdatedEffect.js +0 -13
- package/lib/Antd5/version/token-meta.json +0 -1
- package/lib/Antd5/version/token.json +0 -1
- package/lib/ConfigProvider/customTheme.json +0 -163
|
@@ -8,36 +8,36 @@ import CheckOutlined from '@ant-design/icons/CheckOutlined';
|
|
|
8
8
|
import CopyOutlined from '@ant-design/icons/CopyOutlined';
|
|
9
9
|
import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
|
-
import TransButton from '../../_util/transButton';
|
|
12
11
|
import Tooltip from '../../tooltip';
|
|
13
12
|
import { getNode, toList } from './util';
|
|
14
|
-
var CopyBtn = function CopyBtn(
|
|
15
|
-
var prefixCls =
|
|
16
|
-
copied =
|
|
17
|
-
locale =
|
|
18
|
-
iconOnly =
|
|
19
|
-
tooltips =
|
|
20
|
-
icon =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
var CopyBtn = function CopyBtn(_ref) {
|
|
14
|
+
var prefixCls = _ref.prefixCls,
|
|
15
|
+
copied = _ref.copied,
|
|
16
|
+
locale = _ref.locale,
|
|
17
|
+
iconOnly = _ref.iconOnly,
|
|
18
|
+
tooltips = _ref.tooltips,
|
|
19
|
+
icon = _ref.icon,
|
|
20
|
+
tabIndex = _ref.tabIndex,
|
|
21
|
+
onCopy = _ref.onCopy,
|
|
22
|
+
btnLoading = _ref.loading;
|
|
24
23
|
var tooltipNodes = toList(tooltips);
|
|
25
24
|
var iconNodes = toList(icon);
|
|
26
|
-
var
|
|
27
|
-
copiedText =
|
|
28
|
-
copyText =
|
|
29
|
-
var copyTitle = copied ? getNode(tooltipNodes[1], copiedText) : getNode(tooltipNodes[0], copyText);
|
|
25
|
+
var _ref2 = locale !== null && locale !== void 0 ? locale : {},
|
|
26
|
+
copiedText = _ref2.copied,
|
|
27
|
+
copyText = _ref2.copy;
|
|
30
28
|
var systemStr = copied ? copiedText : copyText;
|
|
29
|
+
var copyTitle = getNode(tooltipNodes[copied ? 1 : 0], systemStr);
|
|
31
30
|
var ariaLabel = typeof copyTitle === 'string' ? copyTitle : systemStr;
|
|
32
31
|
return _jsx(Tooltip, {
|
|
33
32
|
title: copyTitle,
|
|
34
|
-
children: _jsx(
|
|
33
|
+
children: _jsx("button", {
|
|
34
|
+
type: "button",
|
|
35
35
|
className: classNames("".concat(prefixCls, "-copy"), _defineProperty(_defineProperty({}, "".concat(prefixCls, "-copy-success"), copied), "".concat(prefixCls, "-copy-icon-only"), iconOnly)),
|
|
36
36
|
onClick: onCopy,
|
|
37
37
|
"aria-label": ariaLabel,
|
|
38
38
|
tabIndex: tabIndex,
|
|
39
39
|
children: copied ? getNode(iconNodes[1], _jsx(CheckOutlined, {}), true) : getNode(iconNodes[0], btnLoading ? _jsx(LoadingOutlined, {}) : _jsx(CopyOutlined, {}), true)
|
|
40
40
|
})
|
|
41
|
-
}
|
|
41
|
+
});
|
|
42
42
|
};
|
|
43
43
|
export default CopyBtn;
|
|
@@ -1,3 +1,4 @@
|
|
|
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); }
|
|
1
2
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
2
3
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
4
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
@@ -8,7 +9,6 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
8
9
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
9
10
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
11
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
11
|
-
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); }
|
|
12
12
|
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; }
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
@@ -18,6 +18,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
18
18
|
import * as React from 'react';
|
|
19
19
|
import toArray from 'rc-util/lib/Children/toArray';
|
|
20
20
|
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
|
|
21
|
+
import { isValidText } from './util';
|
|
21
22
|
var MeasureText = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
22
23
|
var style = _ref.style,
|
|
23
24
|
children = _ref.children;
|
|
@@ -47,21 +48,11 @@ var MeasureText = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
47
48
|
children: children
|
|
48
49
|
});
|
|
49
50
|
});
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
var totalLen = 0;
|
|
56
|
-
nodeList.forEach(function (node) {
|
|
57
|
-
if (cuttable(node)) {
|
|
58
|
-
totalLen += String(node).length;
|
|
59
|
-
} else {
|
|
60
|
-
totalLen += 1;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
return totalLen;
|
|
64
|
-
}
|
|
51
|
+
var getNodesLen = function getNodesLen(nodeList) {
|
|
52
|
+
return nodeList.reduce(function (totalLen, node) {
|
|
53
|
+
return totalLen + (isValidText(node) ? String(node).length : 1);
|
|
54
|
+
}, 0);
|
|
55
|
+
};
|
|
65
56
|
function sliceNodes(nodeList, len) {
|
|
66
57
|
var currLen = 0;
|
|
67
58
|
var currentNodeList = [];
|
|
@@ -71,7 +62,7 @@ function sliceNodes(nodeList, len) {
|
|
|
71
62
|
return currentNodeList;
|
|
72
63
|
}
|
|
73
64
|
var node = nodeList[i];
|
|
74
|
-
var canCut =
|
|
65
|
+
var canCut = isValidText(node);
|
|
75
66
|
var nodeLen = canCut ? String(node).length : 1;
|
|
76
67
|
var nextLen = currLen + nodeLen;
|
|
77
68
|
// Exceed but current not which means we need cut this
|
|
@@ -88,9 +79,10 @@ function sliceNodes(nodeList, len) {
|
|
|
88
79
|
}
|
|
89
80
|
// Measure for the `text` is exceed the `rows` or not
|
|
90
81
|
var STATUS_MEASURE_NONE = 0;
|
|
91
|
-
var
|
|
92
|
-
var
|
|
93
|
-
var
|
|
82
|
+
var STATUS_MEASURE_PREPARE = 1;
|
|
83
|
+
var STATUS_MEASURE_START = 2;
|
|
84
|
+
var STATUS_MEASURE_NEED_ELLIPSIS = 3;
|
|
85
|
+
var STATUS_MEASURE_NO_NEED_ELLIPSIS = 4;
|
|
94
86
|
var lineClipStyle = {
|
|
95
87
|
display: '-webkit-box',
|
|
96
88
|
overflow: 'hidden',
|
|
@@ -123,6 +115,7 @@ export default function EllipsisMeasure(props) {
|
|
|
123
115
|
setEllipsisCutIndex = _React$useState2[1];
|
|
124
116
|
var cutMidRef = React.useRef(null);
|
|
125
117
|
// ========================= NeedEllipsis =========================
|
|
118
|
+
var measureWhiteSpaceRef = React.useRef(null);
|
|
126
119
|
var needEllipsisRef = React.useRef(null);
|
|
127
120
|
// Measure for `rows-1` height, to avoid operation exceed the line height
|
|
128
121
|
var descRowsEllipsisRef = React.useRef(null);
|
|
@@ -139,17 +132,26 @@ export default function EllipsisMeasure(props) {
|
|
|
139
132
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
140
133
|
ellipsisHeight = _React$useState8[0],
|
|
141
134
|
setEllipsisHeight = _React$useState8[1];
|
|
135
|
+
var _React$useState9 = React.useState(null),
|
|
136
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
137
|
+
parentWhiteSpace = _React$useState10[0],
|
|
138
|
+
setParentWhiteSpace = _React$useState10[1];
|
|
142
139
|
// Trigger start measure
|
|
143
140
|
useLayoutEffect(function () {
|
|
144
141
|
if (enableMeasure && width && nodeLen) {
|
|
145
|
-
setNeedEllipsis(
|
|
142
|
+
setNeedEllipsis(STATUS_MEASURE_PREPARE);
|
|
146
143
|
} else {
|
|
147
144
|
setNeedEllipsis(STATUS_MEASURE_NONE);
|
|
148
145
|
}
|
|
149
146
|
}, [width, text, rows, enableMeasure, nodeList]);
|
|
150
147
|
// Measure process
|
|
151
148
|
useLayoutEffect(function () {
|
|
152
|
-
if (needEllipsis ===
|
|
149
|
+
if (needEllipsis === STATUS_MEASURE_PREPARE) {
|
|
150
|
+
setNeedEllipsis(STATUS_MEASURE_START);
|
|
151
|
+
// Parent ref `white-space`
|
|
152
|
+
var nextWhiteSpace = measureWhiteSpaceRef.current && getComputedStyle(measureWhiteSpaceRef.current).whiteSpace;
|
|
153
|
+
setParentWhiteSpace(nextWhiteSpace);
|
|
154
|
+
} else if (needEllipsis === STATUS_MEASURE_START) {
|
|
153
155
|
var _needEllipsisRef$curr, _needEllipsisRef$curr2, _descRowsEllipsisRef$, _symbolRowEllipsisRef;
|
|
154
156
|
var isOverflow = !!((_needEllipsisRef$curr = needEllipsisRef.current) !== null && _needEllipsisRef$curr !== void 0 && _needEllipsisRef$curr.isExceed());
|
|
155
157
|
setNeedEllipsis(isOverflow ? STATUS_MEASURE_NEED_ELLIPSIS : STATUS_MEASURE_NO_NEED_ELLIPSIS);
|
|
@@ -160,8 +162,9 @@ export default function EllipsisMeasure(props) {
|
|
|
160
162
|
// Get the height of `rows - 1` + symbol height
|
|
161
163
|
var descRowsEllipsisHeight = rows === 1 ? 0 : ((_descRowsEllipsisRef$ = descRowsEllipsisRef.current) === null || _descRowsEllipsisRef$ === void 0 ? void 0 : _descRowsEllipsisRef$.getHeight()) || 0;
|
|
162
164
|
var symbolRowEllipsisHeight = ((_symbolRowEllipsisRef = symbolRowEllipsisRef.current) === null || _symbolRowEllipsisRef === void 0 ? void 0 : _symbolRowEllipsisRef.getHeight()) || 0;
|
|
163
|
-
var
|
|
164
|
-
|
|
165
|
+
var maxRowsHeight = Math.max(baseRowsEllipsisHeight,
|
|
166
|
+
// height of rows with ellipsis
|
|
167
|
+
descRowsEllipsisHeight + symbolRowEllipsisHeight);
|
|
165
168
|
setEllipsisHeight(maxRowsHeight + 1);
|
|
166
169
|
onEllipsis(isOverflow);
|
|
167
170
|
}
|
|
@@ -181,37 +184,37 @@ export default function EllipsisMeasure(props) {
|
|
|
181
184
|
if (maxIndex - minIndex === 1) {
|
|
182
185
|
targetMidIndex = isOverflow ? minIndex : maxIndex;
|
|
183
186
|
}
|
|
184
|
-
|
|
185
|
-
setEllipsisCutIndex([minIndex, targetMidIndex]);
|
|
186
|
-
} else {
|
|
187
|
-
setEllipsisCutIndex([targetMidIndex, maxIndex]);
|
|
188
|
-
}
|
|
187
|
+
setEllipsisCutIndex(isOverflow ? [minIndex, targetMidIndex] : [targetMidIndex, maxIndex]);
|
|
189
188
|
}
|
|
190
189
|
}, [ellipsisCutIndex, cutMidIndex]);
|
|
191
190
|
// ========================= Text Content =========================
|
|
192
191
|
var finalContent = React.useMemo(function () {
|
|
192
|
+
// Skip everything if `enableMeasure` is disabled
|
|
193
|
+
if (!enableMeasure) {
|
|
194
|
+
return children(nodeList, false);
|
|
195
|
+
}
|
|
193
196
|
if (needEllipsis !== STATUS_MEASURE_NEED_ELLIPSIS || !ellipsisCutIndex || ellipsisCutIndex[0] !== ellipsisCutIndex[1]) {
|
|
194
197
|
var content = children(nodeList, false);
|
|
195
|
-
// Limit the max line count to avoid scrollbar blink
|
|
198
|
+
// Limit the max line count to avoid scrollbar blink unless no need ellipsis
|
|
196
199
|
// https://github.com/ant-design/ant-design/issues/42958
|
|
197
|
-
if (
|
|
198
|
-
return
|
|
199
|
-
style: _objectSpread(_objectSpread({}, lineClipStyle), {}, {
|
|
200
|
-
WebkitLineClamp: rows
|
|
201
|
-
}),
|
|
202
|
-
children: content
|
|
203
|
-
});
|
|
200
|
+
if ([STATUS_MEASURE_NO_NEED_ELLIPSIS, STATUS_MEASURE_NONE].includes(needEllipsis)) {
|
|
201
|
+
return content;
|
|
204
202
|
}
|
|
205
|
-
return
|
|
203
|
+
return _jsx("span", {
|
|
204
|
+
style: _objectSpread(_objectSpread({}, lineClipStyle), {}, {
|
|
205
|
+
WebkitLineClamp: rows
|
|
206
|
+
}),
|
|
207
|
+
children: content
|
|
208
|
+
});
|
|
206
209
|
}
|
|
207
210
|
return children(expanded ? nodeList : sliceNodes(nodeList, ellipsisCutIndex[0]), canEllipsis);
|
|
208
211
|
}, [expanded, needEllipsis, ellipsisCutIndex, nodeList].concat(_toConsumableArray(miscDeps)));
|
|
209
212
|
// ============================ Render ============================
|
|
210
213
|
var measureStyle = {
|
|
211
214
|
width: width,
|
|
212
|
-
whiteSpace: 'normal',
|
|
213
215
|
margin: 0,
|
|
214
|
-
padding: 0
|
|
216
|
+
padding: 0,
|
|
217
|
+
whiteSpace: parentWhiteSpace === 'nowrap' ? 'normal' : 'inherit'
|
|
215
218
|
};
|
|
216
219
|
return _jsxs(_Fragment, {
|
|
217
220
|
children: [finalContent, needEllipsis === STATUS_MEASURE_START && _jsxs(_Fragment, {
|
|
@@ -240,6 +243,11 @@ export default function EllipsisMeasure(props) {
|
|
|
240
243
|
}),
|
|
241
244
|
ref: cutMidRef,
|
|
242
245
|
children: children(sliceNodes(nodeList, cutMidIndex), true)
|
|
246
|
+
}), needEllipsis === STATUS_MEASURE_PREPARE && _jsx("span", {
|
|
247
|
+
style: {
|
|
248
|
+
whiteSpace: 'inherit'
|
|
249
|
+
},
|
|
250
|
+
ref: measureWhiteSpaceRef
|
|
243
251
|
})]
|
|
244
252
|
});
|
|
245
253
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
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); }
|
|
1
2
|
var _excluded = ["prefixCls", "className", "style", "type", "disabled", "children", "ellipsis", "editable", "copyable", "component", "title"];
|
|
2
3
|
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; }
|
|
3
4
|
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; }
|
|
4
5
|
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; }
|
|
5
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
7
|
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); }
|
|
7
|
-
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); }
|
|
8
8
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
9
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
10
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -19,24 +19,24 @@ import EditOutlined from '@ant-design/icons/EditOutlined';
|
|
|
19
19
|
import classNames from 'classnames';
|
|
20
20
|
import ResizeObserver from 'rc-resize-observer';
|
|
21
21
|
import toArray from 'rc-util/lib/Children/toArray';
|
|
22
|
-
import
|
|
22
|
+
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
|
|
23
23
|
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
|
24
24
|
import omit from 'rc-util/lib/omit';
|
|
25
25
|
import { composeRef } from 'rc-util/lib/ref';
|
|
26
26
|
import { isStyleSupport } from '../../_util/styleChecker';
|
|
27
|
-
import TransButton from '../../_util/transButton';
|
|
28
27
|
import { ConfigContext } from '../../config-provider';
|
|
29
28
|
import useLocale from '../../locale/useLocale';
|
|
30
29
|
import Tooltip from '../../tooltip';
|
|
31
30
|
import Editable from '../Editable';
|
|
32
31
|
import useCopyClick from '../hooks/useCopyClick';
|
|
33
32
|
import useMergedConfig from '../hooks/useMergedConfig';
|
|
34
|
-
import useUpdatedEffect from '../hooks/useUpdatedEffect';
|
|
35
33
|
import usePrevious from '../hooks/usePrevious';
|
|
34
|
+
import useTooltipProps from '../hooks/useTooltipProps';
|
|
36
35
|
import Typography from '../Typography';
|
|
37
36
|
import CopyBtn from './CopyBtn';
|
|
38
37
|
import Ellipsis from './Ellipsis';
|
|
39
38
|
import EllipsisTooltip from './EllipsisTooltip';
|
|
39
|
+
import { isEleEllipsis, isValidText } from './util';
|
|
40
40
|
function wrapperDecorations(_ref, content) {
|
|
41
41
|
var mark = _ref.mark,
|
|
42
42
|
code = _ref.code,
|
|
@@ -108,7 +108,7 @@ var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
108
108
|
};
|
|
109
109
|
// Focus edit icon when back
|
|
110
110
|
var prevEditing = usePrevious(editing);
|
|
111
|
-
|
|
111
|
+
useLayoutEffect(function () {
|
|
112
112
|
if (!editing && prevEditing) {
|
|
113
113
|
var _editIconRef$current;
|
|
114
114
|
(_editIconRef$current = editIconRef.current) === null || _editIconRef$current === void 0 || _editIconRef$current.focus();
|
|
@@ -190,7 +190,7 @@ var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
190
190
|
ellipsisConfig.expandable || enableEdit || enableCopy)
|
|
191
191
|
);
|
|
192
192
|
}, [mergedEnableEllipsis, ellipsisConfig, enableEdit, enableCopy]);
|
|
193
|
-
|
|
193
|
+
useLayoutEffect(function () {
|
|
194
194
|
if (enableEllipsis && !needMeasureEllipsis) {
|
|
195
195
|
setIsLineClampSupport(isStyleSupport('webkitLineClamp'));
|
|
196
196
|
setIsTextOverflowSupport(isStyleSupport('textOverflow'));
|
|
@@ -211,7 +211,7 @@ var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
211
211
|
}, [needMeasureEllipsis, isTextOverflowSupport, isLineClampSupport]);
|
|
212
212
|
// We use effect to change from css ellipsis to js ellipsis.
|
|
213
213
|
// To make SSR still can see the ellipsis.
|
|
214
|
-
|
|
214
|
+
useLayoutEffect(function () {
|
|
215
215
|
setCssEllipsis(canUseCssEllipsis && mergedEnableEllipsis);
|
|
216
216
|
}, [canUseCssEllipsis, mergedEnableEllipsis]);
|
|
217
217
|
var isMergedEllipsis = mergedEnableEllipsis && (cssEllipsis ? isNativeEllipsis : isJsEllipsis);
|
|
@@ -244,7 +244,7 @@ var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
244
244
|
React.useEffect(function () {
|
|
245
245
|
var textEle = typographyRef.current;
|
|
246
246
|
if (enableEllipsis && cssEllipsis && textEle) {
|
|
247
|
-
var currentEllipsis =
|
|
247
|
+
var currentEllipsis = isEleEllipsis(textEle);
|
|
248
248
|
if (isNativeEllipsis !== currentEllipsis) {
|
|
249
249
|
setIsNativeEllipsis(currentEllipsis);
|
|
250
250
|
}
|
|
@@ -267,53 +267,19 @@ var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
267
267
|
};
|
|
268
268
|
}, [cssEllipsis, mergedEnableEllipsis]);
|
|
269
269
|
// ========================== Tooltip ===========================
|
|
270
|
-
var tooltipProps =
|
|
271
|
-
if (ellipsisConfig.tooltip === true) {
|
|
272
|
-
var _editConfig$text;
|
|
273
|
-
tooltipProps = {
|
|
274
|
-
title: (_editConfig$text = editConfig.text) !== null && _editConfig$text !== void 0 ? _editConfig$text : _children
|
|
275
|
-
};
|
|
276
|
-
} else if (/*#__PURE__*/React.isValidElement(ellipsisConfig.tooltip)) {
|
|
277
|
-
tooltipProps = {
|
|
278
|
-
title: ellipsisConfig.tooltip
|
|
279
|
-
};
|
|
280
|
-
} else if (_typeof(ellipsisConfig.tooltip) === 'object') {
|
|
281
|
-
var _editConfig$text2;
|
|
282
|
-
tooltipProps = _objectSpread({
|
|
283
|
-
title: (_editConfig$text2 = editConfig.text) !== null && _editConfig$text2 !== void 0 ? _editConfig$text2 : _children
|
|
284
|
-
}, ellipsisConfig.tooltip);
|
|
285
|
-
} else {
|
|
286
|
-
tooltipProps = {
|
|
287
|
-
title: ellipsisConfig.tooltip
|
|
288
|
-
};
|
|
289
|
-
}
|
|
270
|
+
var tooltipProps = useTooltipProps(ellipsisConfig.tooltip, editConfig.text, _children);
|
|
290
271
|
var topAriaLabel = React.useMemo(function () {
|
|
291
|
-
var isValid = function isValid(val) {
|
|
292
|
-
return ['string', 'number'].includes(_typeof(val));
|
|
293
|
-
};
|
|
294
272
|
if (!enableEllipsis || cssEllipsis) {
|
|
295
273
|
return undefined;
|
|
296
274
|
}
|
|
297
|
-
|
|
298
|
-
return editConfig.text;
|
|
299
|
-
}
|
|
300
|
-
if (isValid(_children)) {
|
|
301
|
-
return _children;
|
|
302
|
-
}
|
|
303
|
-
if (isValid(title)) {
|
|
304
|
-
return title;
|
|
305
|
-
}
|
|
306
|
-
if (isValid(tooltipProps.title)) {
|
|
307
|
-
return tooltipProps.title;
|
|
308
|
-
}
|
|
309
|
-
return undefined;
|
|
275
|
+
return [editConfig.text, _children, title, tooltipProps.title].find(isValidText);
|
|
310
276
|
}, [enableEllipsis, cssEllipsis, title, tooltipProps.title, isMergedEllipsis]);
|
|
311
277
|
// =========================== Render ===========================
|
|
312
278
|
// >>>>>>>>>>> Editing input
|
|
313
279
|
if (editing) {
|
|
314
|
-
var _editConfig$
|
|
280
|
+
var _editConfig$text;
|
|
315
281
|
return _jsx(Editable, {
|
|
316
|
-
value: (_editConfig$
|
|
282
|
+
value: (_editConfig$text = editConfig.text) !== null && _editConfig$text !== void 0 ? _editConfig$text : typeof _children === 'string' ? _children : '',
|
|
317
283
|
onSave: onEditChange,
|
|
318
284
|
onCancel: onEditCancel,
|
|
319
285
|
onEnd: editConfig.onEnd,
|
|
@@ -332,13 +298,8 @@ var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
332
298
|
var renderExpand = function renderExpand() {
|
|
333
299
|
var expandable = ellipsisConfig.expandable,
|
|
334
300
|
symbol = ellipsisConfig.symbol;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
if (expanded && expandable !== 'collapsible') {
|
|
339
|
-
return null;
|
|
340
|
-
}
|
|
341
|
-
return _jsx("a", {
|
|
301
|
+
return expandable ? _jsx("button", {
|
|
302
|
+
type: "button",
|
|
342
303
|
className: "".concat(prefixCls, "-").concat(expanded ? 'collapse' : 'expand'),
|
|
343
304
|
onClick: function onClick(e) {
|
|
344
305
|
return onExpandClick(e, {
|
|
@@ -347,7 +308,7 @@ var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
347
308
|
},
|
|
348
309
|
"aria-label": expanded ? textLocale.collapse : textLocale === null || textLocale === void 0 ? void 0 : textLocale.expand,
|
|
349
310
|
children: typeof symbol === 'function' ? symbol(expanded) : symbol
|
|
350
|
-
}, "expand");
|
|
311
|
+
}, "expand") : null;
|
|
351
312
|
};
|
|
352
313
|
// Edit
|
|
353
314
|
var renderEdit = function renderEdit() {
|
|
@@ -361,7 +322,8 @@ var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
361
322
|
var ariaLabel = typeof editTitle === 'string' ? editTitle : '';
|
|
362
323
|
return triggerType.includes('icon') ? _jsx(Tooltip, {
|
|
363
324
|
title: tooltip === false ? '' : editTitle,
|
|
364
|
-
children: _jsx(
|
|
325
|
+
children: _jsx("button", {
|
|
326
|
+
type: "button",
|
|
365
327
|
ref: editIconRef,
|
|
366
328
|
className: "".concat(prefixCls, "-edit"),
|
|
367
329
|
onClick: onEditClick,
|
|
@@ -388,9 +350,7 @@ var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
388
350
|
}), "copy");
|
|
389
351
|
};
|
|
390
352
|
var renderOperations = function renderOperations(canEllipsis) {
|
|
391
|
-
return [
|
|
392
|
-
// (renderExpanded || ellipsisConfig.collapsible) && renderExpand(),
|
|
393
|
-
canEllipsis && renderExpand(), renderEdit(), renderCopy()];
|
|
353
|
+
return [canEllipsis && renderExpand(), renderEdit(), renderCopy()];
|
|
394
354
|
};
|
|
395
355
|
var renderEllipsis = function renderEllipsis(canEllipsis) {
|
|
396
356
|
return [canEllipsis && !expanded && _jsx("span", {
|
|
@@ -407,7 +367,7 @@ var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
407
367
|
enableEllipsis: mergedEnableEllipsis,
|
|
408
368
|
isEllipsis: isMergedEllipsis,
|
|
409
369
|
children: _jsx(Typography, _objectSpread(_objectSpread({
|
|
410
|
-
className: classNames(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(
|
|
370
|
+
className: classNames(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-").concat(type), type), "".concat(prefixCls, "-disabled"), disabled), "".concat(prefixCls, "-ellipsis"), enableEllipsis), "".concat(prefixCls, "-ellipsis-single-line"), cssTextOverflow), "".concat(prefixCls, "-ellipsis-multiple-line"), cssLineClamp), className),
|
|
411
371
|
prefixCls: customizePrefixCls,
|
|
412
372
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
413
373
|
WebkitLineClamp: cssLineClamp ? rows : undefined
|
|
@@ -426,7 +386,7 @@ var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
426
386
|
width: ellipsisWidth,
|
|
427
387
|
onEllipsis: onJsEllipsis,
|
|
428
388
|
expanded: expanded,
|
|
429
|
-
miscDeps: [copied, expanded, copyLoading, enableEdit, enableCopy],
|
|
389
|
+
miscDeps: [copied, expanded, copyLoading, enableEdit, enableCopy, textLocale],
|
|
430
390
|
children: function children(node, canEllipsis) {
|
|
431
391
|
return wrapperDecorations(props, _jsxs(_Fragment, {
|
|
432
392
|
children: [node.length > 0 && canEllipsis && !expanded && topAriaLabel ? _jsx("span", {
|
|
@@ -1,3 +1,4 @@
|
|
|
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); }
|
|
1
2
|
export function toList(val) {
|
|
2
3
|
if (val === false) {
|
|
3
4
|
return [false, false];
|
|
@@ -9,4 +10,33 @@ export function getNode(dom, defaultNode, needDom) {
|
|
|
9
10
|
return defaultNode;
|
|
10
11
|
}
|
|
11
12
|
return dom || needDom && defaultNode;
|
|
12
|
-
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Check for element is native ellipsis
|
|
16
|
+
* ref:
|
|
17
|
+
* - https://github.com/ant-design/ant-design/issues/50143
|
|
18
|
+
* - https://github.com/ant-design/ant-design/issues/50414
|
|
19
|
+
*/
|
|
20
|
+
export function isEleEllipsis(ele) {
|
|
21
|
+
// Create a new div to get the size
|
|
22
|
+
var childDiv = document.createElement('em');
|
|
23
|
+
ele.appendChild(childDiv);
|
|
24
|
+
// For test case
|
|
25
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
26
|
+
childDiv.className = 'ant-typography-css-ellipsis-content-measure';
|
|
27
|
+
}
|
|
28
|
+
var rect = ele.getBoundingClientRect();
|
|
29
|
+
var childRect = childDiv.getBoundingClientRect();
|
|
30
|
+
// Reset
|
|
31
|
+
ele.removeChild(childDiv);
|
|
32
|
+
// Range checker
|
|
33
|
+
return (
|
|
34
|
+
// Horizontal out of range
|
|
35
|
+
rect.left > childRect.left || childRect.right > rect.right ||
|
|
36
|
+
// Vertical out of range
|
|
37
|
+
rect.top > childRect.top || childRect.bottom > rect.bottom
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
export var isValidText = function isValidText(val) {
|
|
41
|
+
return ['string', 'number'].includes(_typeof(val));
|
|
42
|
+
};
|
|
@@ -43,7 +43,8 @@ var Editable = function Editable(props) {
|
|
|
43
43
|
setCurrent(value);
|
|
44
44
|
}, [value]);
|
|
45
45
|
React.useEffect(function () {
|
|
46
|
-
|
|
46
|
+
var _ref$current;
|
|
47
|
+
if ((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.resizableTextArea) {
|
|
47
48
|
var textArea = ref.current.resizableTextArea.textArea;
|
|
48
49
|
textArea.focus();
|
|
49
50
|
var length = textArea.value.length;
|
|
@@ -76,25 +77,25 @@ var Editable = function Editable(props) {
|
|
|
76
77
|
metaKey = _ref3.metaKey,
|
|
77
78
|
shiftKey = _ref3.shiftKey;
|
|
78
79
|
// Check if it's a real key
|
|
79
|
-
if (lastKeyCode.current
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
if (lastKeyCode.current !== keyCode || inComposition.current || ctrlKey || altKey || metaKey || shiftKey) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (keyCode === KeyCode.ENTER) {
|
|
84
|
+
confirmChange();
|
|
85
|
+
onEnd === null || onEnd === void 0 || onEnd();
|
|
86
|
+
} else if (keyCode === KeyCode.ESC) {
|
|
87
|
+
onCancel();
|
|
86
88
|
}
|
|
87
89
|
};
|
|
88
90
|
var onBlur = function onBlur() {
|
|
89
91
|
confirmChange();
|
|
90
92
|
};
|
|
91
|
-
var textClassName = component ? "".concat(prefixCls, "-").concat(component) : '';
|
|
92
93
|
var _useStyle = useStyle(prefixCls),
|
|
93
94
|
_useStyle2 = _slicedToArray(_useStyle, 3),
|
|
94
95
|
wrapCSSVar = _useStyle2[0],
|
|
95
96
|
hashId = _useStyle2[1],
|
|
96
97
|
cssVarCls = _useStyle2[2];
|
|
97
|
-
var textAreaClassName = classNames(prefixCls, "".concat(prefixCls, "-edit-content"), _defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'),
|
|
98
|
+
var textAreaClassName = classNames(prefixCls, "".concat(prefixCls, "-edit-content"), _defineProperty(_defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), "".concat(prefixCls, "-").concat(component), !!component), className, hashId, cssVarCls);
|
|
98
99
|
return wrapCSSVar(_jsxs("div", {
|
|
99
100
|
className: textAreaClassName,
|
|
100
101
|
style: style,
|
|
@@ -16,16 +16,11 @@ var Title = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
16
16
|
var _props$level = props.level,
|
|
17
17
|
level = _props$level === void 0 ? 1 : _props$level,
|
|
18
18
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
19
|
-
var component;
|
|
20
19
|
if (process.env.NODE_ENV !== 'production') {
|
|
21
20
|
var warning = devUseWarning('Typography.Title');
|
|
22
21
|
warning(TITLE_ELE_LIST.includes(level), 'usage', 'Title only accept `1 | 2 | 3 | 4 | 5` as `level` value. And `5` need 4.6.0+ version.');
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
component = "h".concat(level);
|
|
26
|
-
} else {
|
|
27
|
-
component = 'h1';
|
|
28
|
-
}
|
|
23
|
+
var component = TITLE_ELE_LIST.includes(level) ? "h".concat(level) : "h1";
|
|
29
24
|
return _jsx(Base, _objectSpread(_objectSpread({
|
|
30
25
|
ref: ref
|
|
31
26
|
}, restProps), {}, {
|
|
@@ -36,15 +36,12 @@ var Typography = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
36
36
|
contextDirection = _React$useContext.direction,
|
|
37
37
|
typography = _React$useContext.typography;
|
|
38
38
|
var direction = typographyDirection !== null && typographyDirection !== void 0 ? typographyDirection : contextDirection;
|
|
39
|
-
var mergedRef = ref;
|
|
40
|
-
|
|
41
|
-
mergedRef = composeRef(ref, setContentRef);
|
|
42
|
-
}
|
|
39
|
+
var mergedRef = setContentRef ? composeRef(ref, setContentRef) : ref;
|
|
40
|
+
var prefixCls = getPrefixCls('typography', customizePrefixCls);
|
|
43
41
|
if (process.env.NODE_ENV !== 'production') {
|
|
44
42
|
var warning = devUseWarning('Typography');
|
|
45
43
|
warning.deprecated(!setContentRef, 'setContentRef', 'ref');
|
|
46
44
|
}
|
|
47
|
-
var prefixCls = getPrefixCls('typography', customizePrefixCls);
|
|
48
45
|
// Style
|
|
49
46
|
var _useStyle = useStyle(prefixCls),
|
|
50
47
|
_useStyle2 = _slicedToArray(_useStyle, 3),
|
|
@@ -66,5 +63,4 @@ var Typography = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
66
63
|
if (process.env.NODE_ENV !== 'production') {
|
|
67
64
|
Typography.displayName = 'Typography';
|
|
68
65
|
}
|
|
69
|
-
// es default export should use const instead of let
|
|
70
66
|
export default Typography;
|
|
@@ -10,7 +10,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
10
10
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import copy from 'copy-to-clipboard';
|
|
13
|
-
import
|
|
13
|
+
import useEvent from 'rc-util/lib/hooks/useEvent';
|
|
14
|
+
import toList from '../../_util/toList';
|
|
14
15
|
var useCopyClick = function useCopyClick(_ref) {
|
|
15
16
|
var copyConfig = _ref.copyConfig,
|
|
16
17
|
children = _ref.children;
|
|
@@ -60,7 +61,7 @@ var useCopyClick = function useCopyClick(_ref) {
|
|
|
60
61
|
_context.t0 = copyConfig.text;
|
|
61
62
|
case 11:
|
|
62
63
|
text = _context.t0;
|
|
63
|
-
copy(text ||
|
|
64
|
+
copy(text || toList(children, true).join('') || '', copyOptions);
|
|
64
65
|
setCopyLoading(false);
|
|
65
66
|
setCopied(true);
|
|
66
67
|
// Trigger tips update
|
|
@@ -1,22 +1,30 @@
|
|
|
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
1
|
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; }
|
|
3
2
|
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; }
|
|
4
3
|
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; }
|
|
5
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
5
|
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); }
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
var
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
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); }
|
|
7
|
+
import { isValidElement, useMemo } from 'react';
|
|
8
|
+
var useTooltipProps = function useTooltipProps(tooltip, editConfigText, children) {
|
|
9
|
+
return useMemo(function () {
|
|
10
|
+
if (tooltip === true) {
|
|
11
|
+
return {
|
|
12
|
+
title: editConfigText !== null && editConfigText !== void 0 ? editConfigText : children
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (/*#__PURE__*/isValidElement(tooltip)) {
|
|
16
|
+
return {
|
|
17
|
+
title: tooltip
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (_typeof(tooltip) === 'object') {
|
|
21
|
+
return _objectSpread({
|
|
22
|
+
title: editConfigText !== null && editConfigText !== void 0 ? editConfigText : children
|
|
23
|
+
}, tooltip);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
title: tooltip
|
|
27
|
+
};
|
|
28
|
+
}, [tooltip, editConfigText, children]);
|
|
21
29
|
};
|
|
22
|
-
export default
|
|
30
|
+
export default useTooltipProps;
|