@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/form/Form.js
CHANGED
|
@@ -15,10 +15,9 @@ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i
|
|
|
15
15
|
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; }
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
import * as React from 'react';
|
|
18
|
-
import { useMemo } from 'react';
|
|
19
18
|
import classNames from 'classnames';
|
|
20
19
|
import FieldForm, { List, useWatch } from 'rc-field-form';
|
|
21
|
-
import {
|
|
20
|
+
import { useComponentConfig } from '../config-provider/context';
|
|
22
21
|
import DisabledContext, { DisabledContextProvider } from '../config-provider/DisabledContext';
|
|
23
22
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
|
24
23
|
import useSize from '../config-provider/hooks/useSize';
|
|
@@ -30,10 +29,14 @@ import useStyle from './style';
|
|
|
30
29
|
import ValidateMessagesContext from './validateMessagesContext';
|
|
31
30
|
var InternalForm = function InternalForm(props, ref) {
|
|
32
31
|
var contextDisabled = React.useContext(DisabledContext);
|
|
33
|
-
var
|
|
34
|
-
getPrefixCls =
|
|
35
|
-
direction =
|
|
36
|
-
|
|
32
|
+
var _useComponentConfig = useComponentConfig('form'),
|
|
33
|
+
getPrefixCls = _useComponentConfig.getPrefixCls,
|
|
34
|
+
direction = _useComponentConfig.direction,
|
|
35
|
+
contextRequiredMark = _useComponentConfig.requiredMark,
|
|
36
|
+
contextColon = _useComponentConfig.colon,
|
|
37
|
+
contextScrollToFirstError = _useComponentConfig.scrollToFirstError,
|
|
38
|
+
contextClassName = _useComponentConfig.className,
|
|
39
|
+
contextStyle = _useComponentConfig.style;
|
|
37
40
|
var customizePrefixCls = props.prefixCls,
|
|
38
41
|
className = props.className,
|
|
39
42
|
rootClassName = props.rootClassName,
|
|
@@ -63,19 +66,19 @@ var InternalForm = function InternalForm(props, ref) {
|
|
|
63
66
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
64
67
|
useFormWarning(props);
|
|
65
68
|
}
|
|
66
|
-
var mergedRequiredMark = useMemo(function () {
|
|
69
|
+
var mergedRequiredMark = React.useMemo(function () {
|
|
67
70
|
if (requiredMark !== undefined) {
|
|
68
71
|
return requiredMark;
|
|
69
72
|
}
|
|
70
73
|
if (hideRequiredMark) {
|
|
71
74
|
return false;
|
|
72
75
|
}
|
|
73
|
-
if (
|
|
74
|
-
return
|
|
76
|
+
if (contextRequiredMark !== undefined) {
|
|
77
|
+
return contextRequiredMark;
|
|
75
78
|
}
|
|
76
79
|
return true;
|
|
77
|
-
}, [hideRequiredMark, requiredMark,
|
|
78
|
-
var mergedColon = colon !== null && colon !== void 0 ? colon :
|
|
80
|
+
}, [hideRequiredMark, requiredMark, contextRequiredMark]);
|
|
81
|
+
var mergedColon = colon !== null && colon !== void 0 ? colon : contextColon;
|
|
79
82
|
var prefixCls = getPrefixCls('form', customizePrefixCls);
|
|
80
83
|
// Style
|
|
81
84
|
var rootCls = useCSSVarCls(prefixCls);
|
|
@@ -84,13 +87,13 @@ var InternalForm = function InternalForm(props, ref) {
|
|
|
84
87
|
wrapCSSVar = _useStyle2[0],
|
|
85
88
|
hashId = _useStyle2[1],
|
|
86
89
|
cssVarCls = _useStyle2[2];
|
|
87
|
-
var formClassName = classNames(prefixCls, "".concat(prefixCls, "-").concat(layout), _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-hide-required-mark"), mergedRequiredMark === false), "".concat(prefixCls, "-rtl"), direction === 'rtl'), "".concat(prefixCls, "-").concat(mergedSize), mergedSize), cssVarCls, rootCls, hashId,
|
|
90
|
+
var formClassName = classNames(prefixCls, "".concat(prefixCls, "-").concat(layout), _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-hide-required-mark"), mergedRequiredMark === false), "".concat(prefixCls, "-rtl"), direction === 'rtl'), "".concat(prefixCls, "-").concat(mergedSize), mergedSize), cssVarCls, rootCls, hashId, contextClassName, className, rootClassName);
|
|
88
91
|
var _useForm = useForm(form),
|
|
89
92
|
_useForm2 = _slicedToArray(_useForm, 1),
|
|
90
93
|
wrapForm = _useForm2[0];
|
|
91
94
|
var __INTERNAL__ = wrapForm.__INTERNAL__;
|
|
92
95
|
__INTERNAL__.name = name;
|
|
93
|
-
var formContextValue = useMemo(function () {
|
|
96
|
+
var formContextValue = React.useMemo(function () {
|
|
94
97
|
return {
|
|
95
98
|
name: name,
|
|
96
99
|
labelAlign: labelAlign,
|
|
@@ -121,9 +124,6 @@ var InternalForm = function InternalForm(props, ref) {
|
|
|
121
124
|
defaultScrollToFirstError = _objectSpread(_objectSpread({}, defaultScrollToFirstError), options);
|
|
122
125
|
}
|
|
123
126
|
wrapForm.scrollToField(fieldName, defaultScrollToFirstError);
|
|
124
|
-
if (defaultScrollToFirstError.focus) {
|
|
125
|
-
wrapForm.focusField(fieldName);
|
|
126
|
-
}
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
var onInternalFinishFailed = function onInternalFinishFailed(errorInfo) {
|
|
@@ -134,8 +134,8 @@ var InternalForm = function InternalForm(props, ref) {
|
|
|
134
134
|
scrollToField(scrollToFirstError, fieldName);
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
if (
|
|
138
|
-
scrollToField(
|
|
137
|
+
if (contextScrollToFirstError !== undefined) {
|
|
138
|
+
scrollToField(contextScrollToFirstError, fieldName);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
};
|
|
@@ -157,7 +157,7 @@ var InternalForm = function InternalForm(props, ref) {
|
|
|
157
157
|
onFinishFailed: onInternalFinishFailed,
|
|
158
158
|
form: wrapForm,
|
|
159
159
|
ref: nativeElementRef,
|
|
160
|
-
style: _objectSpread(_objectSpread({},
|
|
160
|
+
style: _objectSpread(_objectSpread({}, contextStyle), style),
|
|
161
161
|
className: formClassName
|
|
162
162
|
}))
|
|
163
163
|
})
|
|
@@ -110,7 +110,7 @@ function InternalFormItem(props) {
|
|
|
110
110
|
// ========================= MISC =========================
|
|
111
111
|
// Get `noStyle` required info
|
|
112
112
|
var listContext = React.useContext(ListContext);
|
|
113
|
-
var fieldKeyPathRef = React.useRef();
|
|
113
|
+
var fieldKeyPathRef = React.useRef(null);
|
|
114
114
|
// ======================== Errors ========================
|
|
115
115
|
// >>>>> Collect sub field errors
|
|
116
116
|
var _useFrameState = useFrameState({}),
|
|
@@ -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
|
var _excluded = ["icon"];
|
|
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; }
|
|
@@ -12,27 +13,16 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
12
13
|
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; }
|
|
13
14
|
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; } }
|
|
14
15
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
|
-
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); }
|
|
16
16
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
import * as React from 'react';
|
|
18
18
|
import QuestionCircleOutlined from '@ant-design/icons/QuestionCircleOutlined';
|
|
19
19
|
import classNames from 'classnames';
|
|
20
|
+
import convertToTooltipProps from '../_util/convertToTooltipProps';
|
|
20
21
|
import Col from '../grid/col';
|
|
21
22
|
import { useLocale } from '../locale';
|
|
22
23
|
import defaultLocale from '../locale/en_US';
|
|
23
24
|
import Tooltip from '../tooltip';
|
|
24
25
|
import { FormContext } from './context';
|
|
25
|
-
function toTooltipProps(tooltip) {
|
|
26
|
-
if (!tooltip) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
if (_typeof(tooltip) === 'object' && ! /*#__PURE__*/React.isValidElement(tooltip)) {
|
|
30
|
-
return tooltip;
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
title: tooltip
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
26
|
var FormItemLabel = function FormItemLabel(_ref) {
|
|
37
27
|
var prefixCls = _ref.prefixCls,
|
|
38
28
|
label = _ref.label,
|
|
@@ -68,7 +58,7 @@ var FormItemLabel = function FormItemLabel(_ref) {
|
|
|
68
58
|
labelChildren = label.replace(/[:|:]\s*$/, '');
|
|
69
59
|
}
|
|
70
60
|
// Tooltip
|
|
71
|
-
var tooltipProps =
|
|
61
|
+
var tooltipProps = convertToTooltipProps(tooltip);
|
|
72
62
|
if (tooltipProps) {
|
|
73
63
|
var _tooltipProps$icon = tooltipProps.icon,
|
|
74
64
|
icon = _tooltipProps$icon === void 0 ? _jsx(QuestionCircleOutlined, {}) : _tooltipProps$icon,
|
|
@@ -92,6 +82,7 @@ var FormItemLabel = function FormItemLabel(_ref) {
|
|
|
92
82
|
// Required Mark
|
|
93
83
|
var isOptionalMark = requiredMark === 'optional';
|
|
94
84
|
var isRenderMark = typeof requiredMark === 'function';
|
|
85
|
+
var hideRequiredMark = requiredMark === false;
|
|
95
86
|
if (isRenderMark) {
|
|
96
87
|
labelChildren = requiredMark(labelChildren, {
|
|
97
88
|
required: !!required
|
|
@@ -106,7 +97,14 @@ var FormItemLabel = function FormItemLabel(_ref) {
|
|
|
106
97
|
})]
|
|
107
98
|
});
|
|
108
99
|
}
|
|
109
|
-
|
|
100
|
+
// https://github.com/ant-design/ant-design/pull/52950#discussion_r1980880316
|
|
101
|
+
var markType;
|
|
102
|
+
if (hideRequiredMark) {
|
|
103
|
+
markType = 'hidden';
|
|
104
|
+
} else if (isOptionalMark || isRenderMark) {
|
|
105
|
+
markType = 'optional';
|
|
106
|
+
}
|
|
107
|
+
var labelClassName = classNames(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-item-required"), required), "".concat(prefixCls, "-item-required-mark-").concat(markType), markType), "".concat(prefixCls, "-item-no-colon"), !computedColon));
|
|
110
108
|
return _jsx(Col, _objectSpread(_objectSpread({}, mergedLabelCol), {}, {
|
|
111
109
|
className: labelColClassName,
|
|
112
110
|
children: _jsx("label", {
|
|
@@ -6,7 +6,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
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); }
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import * as React from 'react';
|
|
9
|
-
import { createContext, useContext, useMemo } from 'react';
|
|
10
9
|
import { FormProvider as RcFormProvider } from 'rc-field-form';
|
|
11
10
|
import omit from 'rc-util/lib/omit';
|
|
12
11
|
export var FormContext = /*#__PURE__*/React.createContext({
|
|
@@ -30,8 +29,8 @@ export var NoFormStyle = function NoFormStyle(_ref) {
|
|
|
30
29
|
var children = _ref.children,
|
|
31
30
|
status = _ref.status,
|
|
32
31
|
override = _ref.override;
|
|
33
|
-
var formItemInputContext = useContext(FormItemInputContext);
|
|
34
|
-
var newFormItemInputContext = useMemo(function () {
|
|
32
|
+
var formItemInputContext = React.useContext(FormItemInputContext);
|
|
33
|
+
var newFormItemInputContext = React.useMemo(function () {
|
|
35
34
|
var newContext = _objectSpread({}, formItemInputContext);
|
|
36
35
|
if (override) {
|
|
37
36
|
delete newContext.isFormItemInput;
|
|
@@ -48,4 +47,4 @@ export var NoFormStyle = function NoFormStyle(_ref) {
|
|
|
48
47
|
children: children
|
|
49
48
|
});
|
|
50
49
|
};
|
|
51
|
-
export var VariantContext = /*#__PURE__*/createContext(undefined);
|
|
50
|
+
export var VariantContext = /*#__PURE__*/React.createContext(undefined);
|
|
@@ -1,4 +1,7 @@
|
|
|
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 = ["focus"];
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
2
5
|
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
6
|
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
7
|
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; }
|
|
@@ -51,19 +54,27 @@ export default function useForm(form) {
|
|
|
51
54
|
},
|
|
52
55
|
scrollToField: function scrollToField(name) {
|
|
53
56
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
57
|
+
var focus = options.focus,
|
|
58
|
+
restOpt = _objectWithoutProperties(options, _excluded);
|
|
54
59
|
var node = getFieldDOMNode(name, wrapForm);
|
|
55
60
|
if (node) {
|
|
56
61
|
scrollIntoView(node, _objectSpread({
|
|
57
62
|
scrollMode: 'if-needed',
|
|
58
63
|
block: 'nearest'
|
|
59
|
-
},
|
|
64
|
+
}, restOpt));
|
|
65
|
+
// Focus if scroll success
|
|
66
|
+
if (focus) {
|
|
67
|
+
wrapForm.focusField(name);
|
|
68
|
+
}
|
|
60
69
|
}
|
|
61
70
|
},
|
|
62
71
|
focusField: function focusField(name) {
|
|
63
|
-
var
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
72
|
+
var itemRef = wrapForm.getFieldInstance(name);
|
|
73
|
+
if (typeof (itemRef === null || itemRef === void 0 ? void 0 : itemRef.focus) === 'function') {
|
|
74
|
+
itemRef.focus();
|
|
75
|
+
} else {
|
|
76
|
+
var _getFieldDOMNode, _getFieldDOMNode$focu;
|
|
77
|
+
(_getFieldDOMNode = getFieldDOMNode(name, wrapForm)) === null || _getFieldDOMNode === void 0 || (_getFieldDOMNode$focu = _getFieldDOMNode.focus) === null || _getFieldDOMNode$focu === void 0 || _getFieldDOMNode$focu.call(_getFieldDOMNode);
|
|
67
78
|
}
|
|
68
79
|
},
|
|
69
80
|
getFieldInstance: function getFieldInstance(name) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { FormContext } from '../context';
|
|
3
3
|
export default function useFormInstance() {
|
|
4
|
-
var
|
|
5
|
-
form =
|
|
4
|
+
var _React$useContext = React.useContext(FormContext),
|
|
5
|
+
form = _React$useContext.form;
|
|
6
6
|
return form;
|
|
7
7
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { devUseWarning } from '../../_util/warning';
|
|
3
3
|
import { FormItemInputContext } from '../context';
|
|
4
4
|
var useFormItemStatus = function useFormItemStatus() {
|
|
5
|
-
var
|
|
6
|
-
status =
|
|
7
|
-
|
|
8
|
-
errors =
|
|
9
|
-
|
|
10
|
-
warnings =
|
|
5
|
+
var _React$useContext = React.useContext(FormItemInputContext),
|
|
6
|
+
status = _React$useContext.status,
|
|
7
|
+
_React$useContext$err = _React$useContext.errors,
|
|
8
|
+
errors = _React$useContext$err === void 0 ? [] : _React$useContext$err,
|
|
9
|
+
_React$useContext$war = _React$useContext.warnings,
|
|
10
|
+
warnings = _React$useContext$war === void 0 ? [] : _React$useContext$war;
|
|
11
11
|
if (process.env.NODE_ENV !== 'production') {
|
|
12
12
|
var warning = devUseWarning('Form.Item');
|
|
13
13
|
warning(status !== undefined, 'usage', 'Form.Item.useStatus should be used under Form.Item component. For more information: https://u.ant.design/form-item-usestatus');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { devUseWarning } from '../../_util/warning';
|
|
3
3
|
var names = {};
|
|
4
4
|
export default function useFormWarning(_ref) {
|
|
5
5
|
var name = _ref.name;
|
|
6
6
|
var warning = devUseWarning('Form');
|
|
7
|
-
useEffect(function () {
|
|
7
|
+
React.useEffect(function () {
|
|
8
8
|
if (name) {
|
|
9
9
|
names[name] = (names[name] || 0) + 1;
|
|
10
10
|
warning(names[name] <= 1, 'usage', 'There exist multiple Form with same `name`.');
|
|
@@ -5,16 +5,15 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
5
5
|
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; } }
|
|
6
6
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import { useRef } from 'react';
|
|
9
8
|
import raf from 'rc-util/lib/raf';
|
|
10
9
|
export default function useFrameState(defaultValue) {
|
|
11
10
|
var _React$useState = React.useState(defaultValue),
|
|
12
11
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
13
12
|
value = _React$useState2[0],
|
|
14
13
|
setValue = _React$useState2[1];
|
|
15
|
-
var frameRef = useRef(null);
|
|
16
|
-
var batchRef = useRef([]);
|
|
17
|
-
var destroyRef = useRef(false);
|
|
14
|
+
var frameRef = React.useRef(null);
|
|
15
|
+
var batchRef = React.useRef([]);
|
|
16
|
+
var destroyRef = React.useRef(false);
|
|
18
17
|
React.useEffect(function () {
|
|
19
18
|
destroyRef.current = false;
|
|
20
19
|
return function () {
|
|
@@ -1,13 +1,14 @@
|
|
|
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
2
|
import * as React from 'react';
|
|
3
|
-
import { composeRef } from 'rc-util/lib/ref';
|
|
3
|
+
import { composeRef, getNodeRef } from 'rc-util/lib/ref';
|
|
4
4
|
import { FormContext } from '../context';
|
|
5
5
|
export default function useItemRef() {
|
|
6
6
|
var _React$useContext = React.useContext(FormContext),
|
|
7
7
|
itemRef = _React$useContext.itemRef;
|
|
8
8
|
var cacheRef = React.useRef({});
|
|
9
9
|
function getRef(name, children) {
|
|
10
|
-
|
|
10
|
+
// Outer caller already check the `supportRef`
|
|
11
|
+
var childrenRef = children && _typeof(children) === 'object' && getNodeRef(children);
|
|
11
12
|
var nameStr = name.join('_');
|
|
12
13
|
if (cacheRef.current.name !== nameStr || cacheRef.current.originRef !== childrenRef) {
|
|
13
14
|
cacheRef.current.name = nameStr;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { VariantContext } from '../context';
|
|
3
3
|
import { ConfigContext, Variants } from '../../config-provider';
|
|
4
4
|
/**
|
|
@@ -6,10 +6,10 @@ import { ConfigContext, Variants } from '../../config-provider';
|
|
|
6
6
|
*/
|
|
7
7
|
var useVariant = function useVariant(component, variant) {
|
|
8
8
|
var legacyBordered = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
9
|
-
var
|
|
10
|
-
configVariant =
|
|
11
|
-
componentConfig =
|
|
12
|
-
var ctxVariant = useContext(VariantContext);
|
|
9
|
+
var _React$useContext = React.useContext(ConfigContext),
|
|
10
|
+
configVariant = _React$useContext.variant,
|
|
11
|
+
componentConfig = _React$useContext[component];
|
|
12
|
+
var ctxVariant = React.useContext(VariantContext);
|
|
13
13
|
var configComponentVariant = componentConfig === null || componentConfig === void 0 ? void 0 : componentConfig.variant;
|
|
14
14
|
var mergedVariant;
|
|
15
15
|
if (typeof variant !== 'undefined') {
|
|
@@ -70,7 +70,6 @@ var genFormStyle = function genFormStyle(token) {
|
|
|
70
70
|
var genFormItemStyle = function genFormItemStyle(token) {
|
|
71
71
|
var formItemCls = token.formItemCls,
|
|
72
72
|
iconCls = token.iconCls,
|
|
73
|
-
componentCls = token.componentCls,
|
|
74
73
|
rootPrefixCls = token.rootPrefixCls,
|
|
75
74
|
antCls = token.antCls,
|
|
76
75
|
labelRequiredMarkColor = token.labelRequiredMarkColor,
|
|
@@ -105,7 +104,11 @@ var genFormItemStyle = function genFormItemStyle(token) {
|
|
|
105
104
|
'&-wrap': {
|
|
106
105
|
overflow: 'unset',
|
|
107
106
|
lineHeight: token.lineHeight,
|
|
108
|
-
whiteSpace: 'unset'
|
|
107
|
+
whiteSpace: 'unset',
|
|
108
|
+
'> label': {
|
|
109
|
+
verticalAlign: 'middle',
|
|
110
|
+
textWrap: 'balance'
|
|
111
|
+
}
|
|
109
112
|
},
|
|
110
113
|
'> label': _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
111
114
|
position: 'relative',
|
|
@@ -118,21 +121,25 @@ var genFormItemStyle = function genFormItemStyle(token) {
|
|
|
118
121
|
}, "> ".concat(iconCls), {
|
|
119
122
|
fontSize: token.fontSize,
|
|
120
123
|
verticalAlign: 'top'
|
|
121
|
-
}), "&".concat(formItemCls, "-required
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
124
|
+
}), "&".concat(formItemCls, "-required"), _defineProperty({
|
|
125
|
+
'&::before': {
|
|
126
|
+
display: 'inline-block',
|
|
127
|
+
marginInlineEnd: token.marginXXS,
|
|
128
|
+
color: labelRequiredMarkColor,
|
|
129
|
+
fontSize: token.fontSize,
|
|
130
|
+
fontFamily: 'SimSun, sans-serif',
|
|
131
|
+
lineHeight: 1,
|
|
132
|
+
content: '"*"'
|
|
133
|
+
}
|
|
134
|
+
}, "&".concat(formItemCls, "-required-mark-hidden, &").concat(formItemCls, "-required-mark-optional"), {
|
|
135
|
+
'&::before': {
|
|
136
|
+
display: 'none'
|
|
137
|
+
}
|
|
131
138
|
})), "".concat(formItemCls, "-optional"), _defineProperty({
|
|
132
139
|
display: 'inline-block',
|
|
133
140
|
marginInlineStart: token.marginXXS,
|
|
134
141
|
color: token.colorTextDescription
|
|
135
|
-
}, "".concat(
|
|
142
|
+
}, "&".concat(formItemCls, "-required-mark-hidden"), {
|
|
136
143
|
display: 'none'
|
|
137
144
|
})), "".concat(formItemCls, "-tooltip"), {
|
|
138
145
|
color: token.colorTextDescription,
|
|
@@ -319,8 +326,8 @@ export var prepareToken = function prepareToken(token, rootPrefixCls) {
|
|
|
319
326
|
});
|
|
320
327
|
return formToken;
|
|
321
328
|
};
|
|
322
|
-
export default genStyleHooks('Form', function (token,
|
|
323
|
-
var rootPrefixCls =
|
|
329
|
+
export default genStyleHooks('Form', function (token, _ref10) {
|
|
330
|
+
var rootPrefixCls = _ref10.rootPrefixCls;
|
|
324
331
|
var formToken = prepareToken(token, rootPrefixCls);
|
|
325
332
|
return [genFormStyle(formToken), genFormItemStyle(formToken), genFormValidateMotionStyle(formToken), genHorizontalStyle(formToken, formToken.componentCls), genHorizontalStyle(formToken, formToken.formItemCls), genInlineStyle(formToken), genVerticalStyle(formToken), genItemVerticalStyle(formToken), genCollapseMotion(formToken), zoomIn];
|
|
326
333
|
}, prepareComponentToken, {
|
|
@@ -4,7 +4,8 @@ import useForceUpdate from '../../_util/hooks/useForceUpdate';
|
|
|
4
4
|
import useResponsiveObserver from '../../_util/responsiveObserver';
|
|
5
5
|
function useBreakpoint() {
|
|
6
6
|
var refreshOnChange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
7
|
-
var
|
|
7
|
+
var defaultScreens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8
|
+
var screensRef = useRef(defaultScreens);
|
|
8
9
|
var forceUpdate = useForceUpdate();
|
|
9
10
|
var responsiveObserver = useResponsiveObserver();
|
|
10
11
|
useLayoutEffect(function () {
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
import { responsiveArray } from '../../_util/responsiveObserver';
|
|
3
|
+
export default function useGutter(gutter, screens) {
|
|
4
|
+
var results = [undefined, undefined];
|
|
5
|
+
var normalizedGutter = Array.isArray(gutter) ? gutter : [gutter, undefined];
|
|
6
|
+
// By default use as `xs`
|
|
7
|
+
var mergedScreens = screens || {
|
|
8
|
+
xs: true,
|
|
9
|
+
sm: true,
|
|
10
|
+
md: true,
|
|
11
|
+
lg: true,
|
|
12
|
+
xl: true,
|
|
13
|
+
xxl: true
|
|
14
|
+
};
|
|
15
|
+
normalizedGutter.forEach(function (g, index) {
|
|
16
|
+
if (_typeof(g) === 'object' && g !== null) {
|
|
17
|
+
for (var i = 0; i < responsiveArray.length; i++) {
|
|
18
|
+
var breakpoint = responsiveArray[i];
|
|
19
|
+
if (mergedScreens[breakpoint] && g[breakpoint] !== undefined) {
|
|
20
|
+
results[index] = g[breakpoint];
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
results[index] = g;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return results;
|
|
29
|
+
}
|
package/lib/Antd5/grid/row.js
CHANGED
|
@@ -16,8 +16,10 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
import * as React from 'react';
|
|
18
18
|
import classNames from 'classnames';
|
|
19
|
-
import
|
|
19
|
+
import { responsiveArray } from '../_util/responsiveObserver';
|
|
20
20
|
import { ConfigContext } from '../config-provider';
|
|
21
|
+
import useBreakpoint from './hooks/useBreakpoint';
|
|
22
|
+
import useGutter from './hooks/useGutter';
|
|
21
23
|
import RowContext from './RowContext';
|
|
22
24
|
import { useRowStyle } from './style';
|
|
23
25
|
var _RowAligns = ['top', 'middle', 'bottom', 'stretch'];
|
|
@@ -37,7 +39,7 @@ function useMergedPropByScreen(oriProp, screen) {
|
|
|
37
39
|
for (var i = 0; i < responsiveArray.length; i++) {
|
|
38
40
|
var breakpoint = responsiveArray[i];
|
|
39
41
|
// if do not match, do nothing
|
|
40
|
-
if (!screen[breakpoint]) {
|
|
42
|
+
if (!screen || !screen[breakpoint]) {
|
|
41
43
|
continue;
|
|
42
44
|
}
|
|
43
45
|
var curVal = oriProp[breakpoint];
|
|
@@ -66,73 +68,16 @@ var Row = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
66
68
|
var _React$useContext = React.useContext(ConfigContext),
|
|
67
69
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
68
70
|
direction = _React$useContext.direction;
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
md: true,
|
|
73
|
-
lg: true,
|
|
74
|
-
xl: true,
|
|
75
|
-
xxl: true
|
|
76
|
-
}),
|
|
77
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
78
|
-
screens = _React$useState4[0],
|
|
79
|
-
setScreens = _React$useState4[1];
|
|
80
|
-
// to save screens info when responsiveObserve callback had been call
|
|
81
|
-
var _React$useState5 = React.useState({
|
|
82
|
-
xs: false,
|
|
83
|
-
sm: false,
|
|
84
|
-
md: false,
|
|
85
|
-
lg: false,
|
|
86
|
-
xl: false,
|
|
87
|
-
xxl: false
|
|
88
|
-
}),
|
|
89
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
90
|
-
curScreens = _React$useState6[0],
|
|
91
|
-
setCurScreens = _React$useState6[1];
|
|
92
|
-
// ================================== calc responsive data ==================================
|
|
93
|
-
var mergedAlign = useMergedPropByScreen(align, curScreens);
|
|
94
|
-
var mergedJustify = useMergedPropByScreen(justify, curScreens);
|
|
95
|
-
var gutterRef = React.useRef(gutter);
|
|
96
|
-
var responsiveObserver = useResponsiveObserver();
|
|
97
|
-
// ================================== Effect ==================================
|
|
98
|
-
React.useEffect(function () {
|
|
99
|
-
var token = responsiveObserver.subscribe(function (screen) {
|
|
100
|
-
setCurScreens(screen);
|
|
101
|
-
var currentGutter = gutterRef.current || 0;
|
|
102
|
-
if (!Array.isArray(currentGutter) && _typeof(currentGutter) === 'object' || Array.isArray(currentGutter) && (_typeof(currentGutter[0]) === 'object' || _typeof(currentGutter[1]) === 'object')) {
|
|
103
|
-
setScreens(screen);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
return function () {
|
|
107
|
-
return responsiveObserver.unsubscribe(token);
|
|
108
|
-
};
|
|
109
|
-
}, []);
|
|
110
|
-
// ================================== Render ==================================
|
|
111
|
-
var getGutter = function getGutter() {
|
|
112
|
-
var results = [undefined, undefined];
|
|
113
|
-
var normalizedGutter = Array.isArray(gutter) ? gutter : [gutter, undefined];
|
|
114
|
-
normalizedGutter.forEach(function (g, index) {
|
|
115
|
-
if (_typeof(g) === 'object') {
|
|
116
|
-
for (var i = 0; i < responsiveArray.length; i++) {
|
|
117
|
-
var breakpoint = responsiveArray[i];
|
|
118
|
-
if (screens[breakpoint] && g[breakpoint] !== undefined) {
|
|
119
|
-
results[index] = g[breakpoint];
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
results[index] = g;
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
return results;
|
|
128
|
-
};
|
|
71
|
+
var screens = useBreakpoint(true, null);
|
|
72
|
+
var mergedAlign = useMergedPropByScreen(align, screens);
|
|
73
|
+
var mergedJustify = useMergedPropByScreen(justify, screens);
|
|
129
74
|
var prefixCls = getPrefixCls('row', customizePrefixCls);
|
|
130
75
|
var _useRowStyle = useRowStyle(prefixCls),
|
|
131
76
|
_useRowStyle2 = _slicedToArray(_useRowStyle, 3),
|
|
132
77
|
wrapCSSVar = _useRowStyle2[0],
|
|
133
78
|
hashId = _useRowStyle2[1],
|
|
134
79
|
cssVarCls = _useRowStyle2[2];
|
|
135
|
-
var gutters =
|
|
80
|
+
var gutters = useGutter(gutter, screens);
|
|
136
81
|
var classes = classNames(prefixCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-no-wrap"), wrap === false), "".concat(prefixCls, "-").concat(mergedJustify), mergedJustify), "".concat(prefixCls, "-").concat(mergedAlign), mergedAlign), "".concat(prefixCls, "-rtl"), direction === 'rtl'), className, hashId, cssVarCls);
|
|
137
82
|
// Add gutter related style
|
|
138
83
|
var rowStyle = {};
|
|
@@ -134,19 +134,25 @@ export var prepareColComponentToken = function prepareColComponentToken() {
|
|
|
134
134
|
};
|
|
135
135
|
// ============================== Export ==============================
|
|
136
136
|
export var useRowStyle = genStyleHooks('Grid', genGridRowStyle, prepareRowComponentToken);
|
|
137
|
+
export var getMediaSize = function getMediaSize(token) {
|
|
138
|
+
var mediaSizesMap = {
|
|
139
|
+
xs: token.screenXSMin,
|
|
140
|
+
sm: token.screenSMMin,
|
|
141
|
+
md: token.screenMDMin,
|
|
142
|
+
lg: token.screenLGMin,
|
|
143
|
+
xl: token.screenXLMin,
|
|
144
|
+
xxl: token.screenXXLMin
|
|
145
|
+
};
|
|
146
|
+
return mediaSizesMap;
|
|
147
|
+
};
|
|
137
148
|
export var useColStyle = genStyleHooks('Grid', function (token) {
|
|
138
149
|
var gridToken = mergeToken(token, {
|
|
139
150
|
gridColumns: 24 // Row is divided into 24 parts in Grid
|
|
140
151
|
});
|
|
141
|
-
var gridMediaSizesMap =
|
|
142
|
-
|
|
143
|
-
'-md': gridToken.screenMDMin,
|
|
144
|
-
'-lg': gridToken.screenLGMin,
|
|
145
|
-
'-xl': gridToken.screenXLMin,
|
|
146
|
-
'-xxl': gridToken.screenXXLMin
|
|
147
|
-
};
|
|
152
|
+
var gridMediaSizesMap = getMediaSize(gridToken);
|
|
153
|
+
delete gridMediaSizesMap.xs;
|
|
148
154
|
return [genGridColStyle(gridToken), genGridStyle(gridToken, ''), genGridStyle(gridToken, '-xs'), Object.keys(gridMediaSizesMap).map(function (key) {
|
|
149
|
-
return genGridMediaStyle(gridToken, gridMediaSizesMap[key], key);
|
|
155
|
+
return genGridMediaStyle(gridToken, gridMediaSizesMap[key], "-".concat(key));
|
|
150
156
|
}).reduce(function (pre, cur) {
|
|
151
157
|
return _objectSpread(_objectSpread({}, pre), cur);
|
|
152
158
|
}, {})];
|
|
@@ -48,7 +48,8 @@ var InternalPreviewGroup = function InternalPreviewGroup(_ref) {
|
|
|
48
48
|
preview = _ref.preview,
|
|
49
49
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
50
50
|
var _React$useContext = React.useContext(ConfigContext),
|
|
51
|
-
getPrefixCls = _React$useContext.getPrefixCls
|
|
51
|
+
getPrefixCls = _React$useContext.getPrefixCls,
|
|
52
|
+
direction = _React$useContext.direction;
|
|
52
53
|
var prefixCls = getPrefixCls('image', customizePrefixCls);
|
|
53
54
|
var previewPrefixCls = "".concat(prefixCls, "-preview");
|
|
54
55
|
var rootPrefixCls = getPrefixCls();
|
|
@@ -61,6 +62,12 @@ var InternalPreviewGroup = function InternalPreviewGroup(_ref) {
|
|
|
61
62
|
var _useZIndex = useZIndex('ImagePreview', _typeof(preview) === 'object' ? preview.zIndex : undefined),
|
|
62
63
|
_useZIndex2 = _slicedToArray(_useZIndex, 1),
|
|
63
64
|
zIndex = _useZIndex2[0];
|
|
65
|
+
var memoizedIcons = React.useMemo(function () {
|
|
66
|
+
return _objectSpread(_objectSpread({}, icons), {}, {
|
|
67
|
+
left: direction === 'rtl' ? _jsx(RightOutlined, {}) : _jsx(LeftOutlined, {}),
|
|
68
|
+
right: direction === 'rtl' ? _jsx(LeftOutlined, {}) : _jsx(RightOutlined, {})
|
|
69
|
+
});
|
|
70
|
+
}, [direction]);
|
|
64
71
|
var mergedPreview = React.useMemo(function () {
|
|
65
72
|
var _preview$rootClassNam;
|
|
66
73
|
if (preview === false) {
|
|
@@ -78,7 +85,7 @@ var InternalPreviewGroup = function InternalPreviewGroup(_ref) {
|
|
|
78
85
|
return wrapCSSVar(_jsx(RcImage.PreviewGroup, _objectSpread({
|
|
79
86
|
preview: mergedPreview,
|
|
80
87
|
previewPrefixCls: previewPrefixCls,
|
|
81
|
-
icons:
|
|
88
|
+
icons: memoizedIcons
|
|
82
89
|
}, otherProps)));
|
|
83
90
|
};
|
|
84
91
|
export default InternalPreviewGroup;
|