@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
|
@@ -15,12 +15,11 @@ import originalDayjs from "dayjs";
|
|
|
15
15
|
import duration from "dayjs/plugin/duration";
|
|
16
16
|
import utc from "dayjs/plugin/utc";
|
|
17
17
|
import timezone from "dayjs/plugin/timezone";
|
|
18
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
18
19
|
originalDayjs.extend(duration);
|
|
19
20
|
// 扩展 dayjs 支持时区
|
|
20
21
|
originalDayjs.extend(utc);
|
|
21
22
|
originalDayjs.extend(timezone);
|
|
22
|
-
var _require = require("uuid"),
|
|
23
|
-
uuidv4 = _require.v4;
|
|
24
23
|
var timeZone = ((_originalDayjs$tz = originalDayjs.tz()) === null || _originalDayjs$tz === void 0 || (_originalDayjs$tz = _originalDayjs$tz.$x) === null || _originalDayjs$tz === void 0 ? void 0 : _originalDayjs$tz.$timezone) || originalDayjs.tz.guess();
|
|
25
24
|
// 封装 dayjs 函数,使其每次调用时自动应用当前的全局时区
|
|
26
25
|
var dayjs = function dayjs() {
|
|
@@ -29,12 +28,60 @@ var dayjs = function dayjs() {
|
|
|
29
28
|
};
|
|
30
29
|
// 枚举时间单位
|
|
31
30
|
var ENUM_TimeUnit = {
|
|
32
|
-
s:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
s: {
|
|
32
|
+
zh_CN: "秒",
|
|
33
|
+
en_US: {
|
|
34
|
+
singular: "Second",
|
|
35
|
+
plural: "Seconds"
|
|
36
|
+
},
|
|
37
|
+
zh_TW: "秒",
|
|
38
|
+
unit: "seconds"
|
|
39
|
+
},
|
|
40
|
+
m: {
|
|
41
|
+
zh_CN: "分钟",
|
|
42
|
+
en_US: {
|
|
43
|
+
singular: "Minute",
|
|
44
|
+
plural: "Minutes"
|
|
45
|
+
},
|
|
46
|
+
zh_TW: "分鐘",
|
|
47
|
+
unit: "minutes"
|
|
48
|
+
},
|
|
49
|
+
h: {
|
|
50
|
+
zh_CN: "小时",
|
|
51
|
+
en_US: {
|
|
52
|
+
singular: "Hour",
|
|
53
|
+
plural: "Hours"
|
|
54
|
+
},
|
|
55
|
+
zh_TW: "小時",
|
|
56
|
+
unit: "hours"
|
|
57
|
+
},
|
|
58
|
+
d: {
|
|
59
|
+
zh_CN: "天",
|
|
60
|
+
en_US: {
|
|
61
|
+
singular: "Day",
|
|
62
|
+
plural: "Days"
|
|
63
|
+
},
|
|
64
|
+
zh_TW: "天",
|
|
65
|
+
unit: "days"
|
|
66
|
+
},
|
|
67
|
+
mo: {
|
|
68
|
+
zh_CN: "月",
|
|
69
|
+
en_US: {
|
|
70
|
+
singular: "Month",
|
|
71
|
+
plural: "Months"
|
|
72
|
+
},
|
|
73
|
+
zh_TW: "月",
|
|
74
|
+
unit: "mo"
|
|
75
|
+
},
|
|
76
|
+
y: {
|
|
77
|
+
zh_CN: "年",
|
|
78
|
+
en_US: {
|
|
79
|
+
singular: "Year",
|
|
80
|
+
plural: "Years"
|
|
81
|
+
},
|
|
82
|
+
zh_TW: "年",
|
|
83
|
+
unit: "years"
|
|
84
|
+
}
|
|
38
85
|
};
|
|
39
86
|
|
|
40
87
|
/**
|
|
@@ -120,18 +167,60 @@ export var judgeType = function judgeType(recordDateValue) {
|
|
|
120
167
|
return [isRule, captureUnit, recordUnit];
|
|
121
168
|
};
|
|
122
169
|
export var echoRecentlyTimeTitle = function echoRecentlyTimeTitle(locale, captureUnit) {
|
|
123
|
-
//
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return "Past ".concat(captureUnit[0], " ").concat(ENUM_TimeUnit[captureUnit[1]][1]);
|
|
170
|
+
// 参数验证
|
|
171
|
+
if (!captureUnit || !Array.isArray(captureUnit) || captureUnit.length < 2) {
|
|
172
|
+
return "";
|
|
173
|
+
}
|
|
174
|
+
var _captureUnit3 = _slicedToArray(captureUnit, 2),
|
|
175
|
+
count = _captureUnit3[0],
|
|
176
|
+
unit = _captureUnit3[1];
|
|
177
|
+
var timeUnit = ENUM_TimeUnit[unit];
|
|
178
|
+
if (!timeUnit) {
|
|
179
|
+
return "";
|
|
134
180
|
}
|
|
181
|
+
var countNum = parseInt(count, 10);
|
|
182
|
+
|
|
183
|
+
// 语言配置映射
|
|
184
|
+
var localeConfig = {
|
|
185
|
+
zh_CN: {
|
|
186
|
+
template: function template(count, unitText) {
|
|
187
|
+
return "\u6700\u8FD1".concat(count).concat(unit === "mo" ? "个" : "").concat(unitText);
|
|
188
|
+
},
|
|
189
|
+
getUnitText: function getUnitText() {
|
|
190
|
+
return timeUnit.zh_CN;
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
zh: {
|
|
194
|
+
template: function template(count, unitText) {
|
|
195
|
+
return "\u6700\u8FD1".concat(count).concat(unit === "mo" ? "个" : "").concat(unitText);
|
|
196
|
+
},
|
|
197
|
+
getUnitText: function getUnitText() {
|
|
198
|
+
return timeUnit.zh_CN;
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
zh_TW: {
|
|
202
|
+
template: function template(count, unitText) {
|
|
203
|
+
return "\u6700\u8FD1".concat(count).concat(unit === "mo" ? "個" : "").concat(unitText);
|
|
204
|
+
},
|
|
205
|
+
getUnitText: function getUnitText() {
|
|
206
|
+
return timeUnit.zh_TW;
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"default": {
|
|
210
|
+
template: function template(count, unitText) {
|
|
211
|
+
return "Past ".concat(count, " ").concat(unitText);
|
|
212
|
+
},
|
|
213
|
+
getUnitText: function getUnitText() {
|
|
214
|
+
var isPlural = countNum !== 1;
|
|
215
|
+
return isPlural ? timeUnit.en_US.plural : timeUnit.en_US.singular;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// 获取当前语言配置,如果不存在则使用默认配置
|
|
221
|
+
var config = localeConfig[locale] || localeConfig["default"];
|
|
222
|
+
var unitText = config.getUnitText();
|
|
223
|
+
return config.template(count, unitText);
|
|
135
224
|
};
|
|
136
225
|
export var echoAbsoluteTimeTitle = function echoAbsoluteTimeTitle(value, format) {
|
|
137
226
|
var hasTimeSpan = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -388,7 +477,7 @@ export var getChangeDate = function getChangeDate(recordDateValue, direction) {
|
|
|
388
477
|
value = funcValueChangeArrayValue(values);
|
|
389
478
|
}
|
|
390
479
|
if (isRule && !values) {
|
|
391
|
-
value = getChangeUnitDate(captureUnit[0], ENUM_TimeUnit[captureUnit[1]]
|
|
480
|
+
value = getChangeUnitDate(captureUnit[0], ENUM_TimeUnit[captureUnit[1]].unit);
|
|
392
481
|
}
|
|
393
482
|
var timeDiff = value[1].diff(value[0]);
|
|
394
483
|
var duration = originalDayjs.duration(timeDiff);
|
|
@@ -546,7 +635,7 @@ var getFormatParseDate = function getFormatParseDate() {
|
|
|
546
635
|
cloneEndDate = null;
|
|
547
636
|
}
|
|
548
637
|
} else if (NEED_CHANGE_FORMATS.slice(0, 4).includes(format)) {
|
|
549
|
-
cloneEndDate = cloneEndDate.set(
|
|
638
|
+
cloneEndDate = cloneEndDate.set("hour", 23).set("minute", 59).set("second", 59);
|
|
550
639
|
if (isAfterDate(cloneEndDate, cloneStartDate)) {
|
|
551
640
|
if (!isAfterCurrentDate(cloneStartDate, cloneEndDate)) {
|
|
552
641
|
if (cloneEndDate.isSame(dayjs(), "day")) {
|
|
@@ -584,7 +673,7 @@ var getFormatParseDate = function getFormatParseDate() {
|
|
|
584
673
|
if (format !== "X") {
|
|
585
674
|
_cloneStartDate = _endDate.clone();
|
|
586
675
|
_cloneEndDate = _endDate.clone();
|
|
587
|
-
_cloneStartDate = _cloneStartDate.set(
|
|
676
|
+
_cloneStartDate = _cloneStartDate.set("hour", 0).set("minute", 0).set("second", 0);
|
|
588
677
|
if (NOT_CHANGE_FORMATS.includes(format)) {
|
|
589
678
|
if (!isAfterCurrentDate(_cloneStartDate, _cloneEndDate, true)) {
|
|
590
679
|
_cloneStartDate = null;
|
|
@@ -592,7 +681,7 @@ var getFormatParseDate = function getFormatParseDate() {
|
|
|
592
681
|
}
|
|
593
682
|
}
|
|
594
683
|
if (NEED_CHANGE_FORMATS.slice(0, 4).includes(format)) {
|
|
595
|
-
_cloneEndDate = _cloneEndDate.set(
|
|
684
|
+
_cloneEndDate = _cloneEndDate.set("hour", 23).set("minute", 59).set("second", 59);
|
|
596
685
|
if (!isAfterCurrentDate(_cloneStartDate, _cloneEndDate, true)) {
|
|
597
686
|
if (_cloneEndDate.isSame(dayjs(), "day")) {
|
|
598
687
|
_cloneEndDate = dayjs();
|
|
@@ -11,18 +11,64 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
11
11
|
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; } }
|
|
12
12
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
13
|
import moment from "moment";
|
|
14
|
-
|
|
15
|
-
uuidv4 = _require.v4;
|
|
14
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
16
15
|
// 枚举时间单位
|
|
17
16
|
var ENUM_TimeUnit = {
|
|
18
|
-
s:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
s: {
|
|
18
|
+
zh_CN: "秒",
|
|
19
|
+
en_US: {
|
|
20
|
+
singular: "Second",
|
|
21
|
+
plural: "Seconds"
|
|
22
|
+
},
|
|
23
|
+
zh_TW: "秒",
|
|
24
|
+
unit: "seconds"
|
|
25
|
+
},
|
|
26
|
+
m: {
|
|
27
|
+
zh_CN: "分钟",
|
|
28
|
+
en_US: {
|
|
29
|
+
singular: "Minute",
|
|
30
|
+
plural: "Minutes"
|
|
31
|
+
},
|
|
32
|
+
zh_TW: "分鐘",
|
|
33
|
+
unit: "minutes"
|
|
34
|
+
},
|
|
35
|
+
h: {
|
|
36
|
+
zh_CN: "小时",
|
|
37
|
+
en_US: {
|
|
38
|
+
singular: "Hour",
|
|
39
|
+
plural: "Hours"
|
|
40
|
+
},
|
|
41
|
+
zh_TW: "小時",
|
|
42
|
+
unit: "hours"
|
|
43
|
+
},
|
|
44
|
+
d: {
|
|
45
|
+
zh_CN: "天",
|
|
46
|
+
en_US: {
|
|
47
|
+
singular: "Day",
|
|
48
|
+
plural: "Days"
|
|
49
|
+
},
|
|
50
|
+
zh_TW: "天",
|
|
51
|
+
unit: "days"
|
|
52
|
+
},
|
|
53
|
+
mo: {
|
|
54
|
+
zh_CN: "月",
|
|
55
|
+
en_US: {
|
|
56
|
+
singular: "Month",
|
|
57
|
+
plural: "Months"
|
|
58
|
+
},
|
|
59
|
+
zh_TW: "月",
|
|
60
|
+
unit: "mo"
|
|
61
|
+
},
|
|
62
|
+
y: {
|
|
63
|
+
zh_CN: "年",
|
|
64
|
+
en_US: {
|
|
65
|
+
singular: "Year",
|
|
66
|
+
plural: "Years"
|
|
67
|
+
},
|
|
68
|
+
zh_TW: "年",
|
|
69
|
+
unit: "years"
|
|
70
|
+
}
|
|
24
71
|
};
|
|
25
|
-
|
|
26
72
|
/**
|
|
27
73
|
* 变换数据源格式
|
|
28
74
|
* @param {Array} 数据源
|
|
@@ -106,18 +152,60 @@ export var judgeType = function judgeType(recordDateValue) {
|
|
|
106
152
|
return [isRule, captureUnit, recordUnit];
|
|
107
153
|
};
|
|
108
154
|
export var echoRecentlyTimeTitle = function echoRecentlyTimeTitle(locale, captureUnit) {
|
|
109
|
-
//
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return "Past ".concat(captureUnit[0], " ").concat(ENUM_TimeUnit[captureUnit[1]][1]);
|
|
155
|
+
// 参数验证
|
|
156
|
+
if (!captureUnit || !Array.isArray(captureUnit) || captureUnit.length < 2) {
|
|
157
|
+
return '';
|
|
158
|
+
}
|
|
159
|
+
var _captureUnit3 = _slicedToArray(captureUnit, 2),
|
|
160
|
+
count = _captureUnit3[0],
|
|
161
|
+
unit = _captureUnit3[1];
|
|
162
|
+
var timeUnit = ENUM_TimeUnit[unit];
|
|
163
|
+
if (!timeUnit) {
|
|
164
|
+
return '';
|
|
120
165
|
}
|
|
166
|
+
var countNum = parseInt(count, 10);
|
|
167
|
+
|
|
168
|
+
// 语言配置映射
|
|
169
|
+
var localeConfig = {
|
|
170
|
+
zh_CN: {
|
|
171
|
+
template: function template(count, unitText) {
|
|
172
|
+
return "\u6700\u8FD1".concat(count).concat(unit === 'mo' ? '个' : '').concat(unitText);
|
|
173
|
+
},
|
|
174
|
+
getUnitText: function getUnitText() {
|
|
175
|
+
return timeUnit.zh_CN;
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
zh: {
|
|
179
|
+
template: function template(count, unitText) {
|
|
180
|
+
return "\u6700\u8FD1".concat(count).concat(unit === 'mo' ? '个' : '').concat(unitText);
|
|
181
|
+
},
|
|
182
|
+
getUnitText: function getUnitText() {
|
|
183
|
+
return timeUnit.zh_CN;
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
zh_TW: {
|
|
187
|
+
template: function template(count, unitText) {
|
|
188
|
+
return "\u6700\u8FD1".concat(count).concat(unit === 'mo' ? '個' : '').concat(unitText);
|
|
189
|
+
},
|
|
190
|
+
getUnitText: function getUnitText() {
|
|
191
|
+
return timeUnit.zh_TW;
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"default": {
|
|
195
|
+
template: function template(count, unitText) {
|
|
196
|
+
return "Past ".concat(count, " ").concat(unitText);
|
|
197
|
+
},
|
|
198
|
+
getUnitText: function getUnitText() {
|
|
199
|
+
var isPlural = countNum !== 1;
|
|
200
|
+
return isPlural ? timeUnit.en_US.plural : timeUnit.en_US.singular;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// 获取当前语言配置,如果不存在则使用默认配置
|
|
206
|
+
var config = localeConfig[locale] || localeConfig["default"];
|
|
207
|
+
var unitText = config.getUnitText();
|
|
208
|
+
return config.template(count, unitText);
|
|
121
209
|
};
|
|
122
210
|
export var echoAbsoluteTimeTitle = function echoAbsoluteTimeTitle(value, format) {
|
|
123
211
|
var hasTimeSpan = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -374,7 +462,7 @@ export var getChangeDate = function getChangeDate(recordDateValue, direction) {
|
|
|
374
462
|
value = funcValueChangeArrayValue(values);
|
|
375
463
|
}
|
|
376
464
|
if (isRule && !values) {
|
|
377
|
-
value = getChangeUnitDate(captureUnit[0], ENUM_TimeUnit[captureUnit[1]]
|
|
465
|
+
value = getChangeUnitDate(captureUnit[0], ENUM_TimeUnit[captureUnit[1]].unit);
|
|
378
466
|
}
|
|
379
467
|
var timeDiff = value[1].diff(value[0]);
|
|
380
468
|
var duration = moment.duration(timeDiff);
|