@unicom-cloud/ui 0.8.90 → 0.8.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Affix.js +10 -9
- package/Alert.js +6 -5
- package/AutoComplete.js +11 -8
- package/BackTop.js +12 -10
- package/Badge.js +10 -9
- package/Breadcrumb.js +10 -9
- package/Button.js +9 -8
- package/Calendar.js +13 -10
- package/Card.js +9 -8
- package/Carousel.js +9 -8
- package/Cascader.js +2 -2
- package/Checkbox.js +8 -6
- package/Collapse.js +3 -2
- package/ColorPicker.js +16 -13
- package/Comment.js +6 -5
- package/ConfigProvider.js +6 -5
- package/Copy.js +6 -5
- package/DatePicker.js +13 -8
- package/Descriptions.js +5 -4
- package/Details.js +15 -0
- package/Development.js +5 -3
- package/Divider.js +5 -4
- package/Draggable.js +4 -3
- package/Dropdown.js +12 -10
- package/Empty.js +6 -3
- package/Form.js +17 -13
- package/Icon.js +7 -6
- package/IconHover.js +4 -2
- package/Image.js +5 -5
- package/Input.js +17 -12
- package/InputNumber.js +7 -5
- package/Layout.js +13 -12
- package/Link.js +6 -5
- package/List.js +9 -7
- package/Loading.js +3 -2
- package/Mentions.js +7 -5
- package/Menu.js +7 -6
- package/Message.js +13 -6
- package/Modal.js +2 -2
- package/Notice.js +10 -7
- package/Notification.js +13 -7
- package/OverflowEllipsis.js +5 -4
- package/PageHeader.js +9 -7
- package/Pagination.js +2 -2
- package/Popconfirm.js +6 -5
- package/Popover.js +6 -5
- package/Progress.js +6 -5
- package/Radio.js +8 -6
- package/Rate.js +6 -5
- package/ResizeBox.js +12 -11
- package/Result.js +5 -4
- package/Select.js +6 -5
- package/SelectView.js +2 -2
- package/Skeleton.js +6 -5
- package/Slider.js +11 -8
- package/Space.js +6 -5
- package/SpeechSynthesis.js +4 -2
- package/Spin.js +6 -5
- package/Statistic.js +10 -8
- package/Steps.js +9 -8
- package/SuspenseFallbackTest.js +3 -2
- package/Switch.js +13 -8
- package/Table.js +27 -15
- package/Tabs.js +5 -5
- package/Tag.js +8 -6
- package/Tooltip.js +9 -7
- package/Transfer.js +8 -6
- package/Tree.js +3 -2
- package/TreeSelect.js +3 -3
- package/Trigger.js +17 -12
- package/Typography.js +7 -6
- package/Upload.js +6 -5
- package/affix/index.js +32 -31
- package/alert/index.js +60 -70
- package/anchor/Anchor.js +46 -45
- package/anchor/Link.js +9 -8
- package/anchor/util.js +15 -14
- package/auto-complete/index.js +154 -15
- package/avatar/Avatar.js +6 -5
- package/avatar/Group.js +17 -16
- package/back-top/index.js +38 -36
- package/badge/Count.js +11 -11
- package/badge/index.js +35 -34
- package/breadcrumb/Item.js +7 -7
- package/breadcrumb/index.js +29 -28
- package/button/Group.js +8 -7
- package/button/index.js +13 -12
- package/calendar/Month.js +140 -10
- package/calendar/Year.js +21 -20
- package/calendar/header/Panel.js +57 -0
- package/calendar/header/index.js +110 -0
- package/calendar/hook/useCellClassName.js +41 -0
- package/calendar/index.js +171 -14
- package/card/Grid.js +12 -11
- package/card/Meta.js +14 -13
- package/card/index.js +11 -10
- package/carousel/Arrow.js +16 -15
- package/carousel/Indicator.js +19 -18
- package/carousel/index.js +16 -15
- package/cascader/Cascader.js +299 -24
- package/cascader/base/node.js +142 -0
- package/cascader/base/store.js +93 -0
- package/cascader/hook/useRefCurrent.js +12 -0
- package/cascader/index.js +2 -2
- package/cascader/panel/List.js +278 -0
- package/cascader/panel/Option.js +33 -0
- package/cascader/panel/Search.js +169 -0
- package/cascader/util.js +64 -12
- package/checkbox/Checkbox.js +125 -17
- package/checkbox/Group.js +97 -12
- package/checkbox/GroupBlock.js +62 -6
- package/checkbox/index.js +7 -6
- package/collapse/Collapse.js +67 -234
- package/collapse/Item.js +181 -9
- package/collapse/index.js +1 -1
- package/color-picker/ControlBar.js +21 -20
- package/color-picker/InputAlpha.js +10 -9
- package/color-picker/InputHex.js +27 -25
- package/color-picker/InputRgb.js +27 -24
- package/color-picker/Mode.js +6 -7
- package/color-picker/Palette.js +16 -14
- package/color-picker/Panel.js +269 -15
- package/color-picker/colors.js +8 -7
- package/color-picker/hooks/useColorPicker.js +128 -0
- package/{chunk/k-OUstoD.js → color-picker/hooks/useControlBlock.js} +1 -1
- package/color-picker/index.js +160 -24
- package/color-picker/utils.js +18 -17
- package/comment/index.js +23 -22
- package/components/common/development/index.js +32 -0
- package/components/common/empty/index.js +17 -0
- package/components/common/higher-order/with-speech-synthesis/index.js +61 -0
- package/{chunk/DxVvggX2.js → components/common/hooks/useComputedState.js} +2 -2
- package/components/common/hooks/useCreate.js +8 -0
- package/components/common/hooks/useForceUpdate.js +8 -0
- package/{chunk/B4YRLi8r.js → components/common/hooks/useId.js} +5 -5
- package/components/common/hooks/useInView.js +31 -0
- package/{chunk/B4WG1mhs.js → components/common/hooks/useIntersectionObserver.js} +9 -9
- package/components/common/hooks/useInterval.js +18 -0
- package/{chunk/oopARUrq.js → components/common/hooks/useIsFirstRender.js} +1 -1
- package/components/common/hooks/useIsomorphicLayoutEffect.js +6 -0
- package/components/common/hooks/useKeyboardEvent.js +17 -0
- package/{chunk/BL9DMeor.js → components/common/hooks/useListenResize.js} +1 -1
- package/{chunk/BXAeh0_V.js → components/common/hooks/useMedia.js} +1 -1
- package/{chunk/BFTV6myl.js → components/common/hooks/useMergeProps.js} +3 -3
- package/{chunk/D5wldVRB.js → components/common/hooks/useMergeValue.js} +8 -8
- package/{chunk/zmmqLCF4.js → components/common/hooks/useOnlineStatus.js} +1 -1
- package/{chunk/DU1RCDfh.js → components/common/hooks/useOverflowHidden.js} +1 -1
- package/components/common/hooks/useOverrideRef.js +14 -0
- package/{chunk/BsY85n3_.js → components/common/hooks/usePersistCallback.js} +2 -2
- package/{chunk/rT6qmv-Y.js → components/common/hooks/usePrefersColorSchemeDark.js} +5 -5
- package/components/common/hooks/usePrevious.js +10 -0
- package/components/common/hooks/useRefs.js +10 -0
- package/{chunk/CmZzBtA4.js → components/common/hooks/useResizeObserver.js} +4 -4
- package/{chunk/hEWZQ8Zi.js → components/common/hooks/useStateCallback.js} +5 -5
- package/{chunk/Duezix3m.js → components/common/hooks/useStateWithPromise.js} +6 -6
- package/components/common/hooks/useUpdateEffect.js +12 -0
- package/components/common/hooks/useWatch.js +11 -0
- package/{chunk/CB4jGw4K.js → components/common/hooks/useWindowSize.js} +6 -6
- package/components/common/icons/file/index.js +56 -0
- package/components/common/space/index.js +110 -0
- package/components/common/utils/PqbCSSTransition.js +32 -0
- package/{chunk/B6r8jPCd.js → components/common/utils/constant.js} +2 -2
- package/components/common/utils/copy.js +7 -0
- package/{chunk/B3LeSidy.js → components/common/utils/dayjs.js} +25 -24
- package/components/common/utils/dom.js +51 -0
- package/components/common/utils/fillNBSP.js +7 -0
- package/{chunk/B7M-FGia.js → components/common/utils/getHighlightText.js} +11 -10
- package/{chunk/Dh7Osrvr.js → components/common/utils/getHotkeyHandler.js} +6 -5
- package/{chunk/DKHXj8Kf.js → components/common/utils/getStringLength.js} +3 -2
- package/components/common/utils/include.js +10 -0
- package/components/common/utils/is.js +126 -0
- package/{chunk/DH7HTOV_.js → components/common/utils/mergeProps.js} +3 -2
- package/components/common/utils/mergedToString.js +16 -0
- package/components/common/utils/omit.js +12 -0
- package/components/common/utils/pad.js +18 -0
- package/components/common/utils/pick.js +18 -0
- package/components/common/utils/react19Adapter.js +3 -0
- package/{chunk/BZ3igxQN.js → components/common/utils/reactDOM.js} +13 -13
- package/components/common/utils/resizeObserverEffect.js +23 -0
- package/components/common/utils/scrollIntoView.js +25 -0
- package/components/common/utils/setDarkTheme.js +27 -0
- package/components/common/utils/setPrimaryColor.js +30 -0
- package/{chunk/DzekwbB4.js → components/common/utils/setTheme.js} +16 -14
- package/components/common/utils/style.js +39 -0
- package/components/common/utils/throttleByRaf.js +16 -0
- package/components/common/utils/warning.js +11 -0
- package/config-provider/ConfigProvider.js +56 -13
- package/config-provider/context.js +24 -7
- package/config-provider/index.js +6 -5
- package/copy/index.js +15 -14
- package/date-picker/Picker.js +75 -73
- package/date-picker/RangePicker.js +585 -22
- package/date-picker/hook/useCellClassName.js +60 -0
- package/date-picker/index.js +32 -27
- package/date-picker/panel/Body.js +88 -0
- package/date-picker/panel/Footer.js +71 -0
- package/date-picker/panel/Header.js +69 -0
- package/date-picker/panel/Shortcut.js +45 -0
- package/date-picker/panel/WeekList.js +19 -0
- package/date-picker/panel/date/index.js +193 -0
- package/date-picker/panel/month/index.js +112 -0
- package/date-picker/panel/quarter/index.js +97 -0
- package/date-picker/panel/range/index.js +250 -0
- package/date-picker/panel/week/index.js +35 -0
- package/date-picker/panel/year/index.js +73 -0
- package/date-picker/util.js +8 -8
- package/descriptions/index.js +24 -23
- package/details/index.js +82 -0
- package/details/interface.js +1 -0
- package/development/index.js +17 -36
- package/dist/compute-scroll-into-view/src/index.js +126 -0
- package/dist/dom-helpers/addClass.js +10 -0
- package/dist/dom-helpers/hasClass.js +8 -0
- package/dist/dom-helpers/removeClass.js +18 -0
- package/dist/react-transition-group/chunk/CPfP7aNL.js +381 -0
- package/dist/react-transition-group/chunk/F6QOOr2H.js +500 -0
- package/dist/react-transition-group/src/CSSTransition.js +202 -0
- package/dist/react-transition-group/src/ReplaceTransition.js +43 -0
- package/dist/react-transition-group/src/SwitchTransition.js +117 -0
- package/dist/react-transition-group/src/TransitionGroup.js +160 -0
- package/dist/react-transition-group/src/TransitionGroupContext.js +5 -0
- package/dist/react-transition-group/src/config.js +6 -0
- package/{chunk/Coz3rCng.js → dist/scroll-into-view-if-needed/src/index.js} +5 -5
- package/dist/tinycolor/chunk/DGZSWe7E.js +182 -0
- package/dist/tinycolor/customize/index.js +12 -0
- package/dist/tinycolor/src/conversion.js +143 -0
- package/dist/tinycolor/src/css-color-names.js +153 -0
- package/dist/tinycolor/src/format-input.js +77 -0
- package/dist/tinycolor/src/index.js +388 -0
- package/dist/tinycolor/src/util.js +32 -0
- package/dist/tween/src/easing.js +43 -0
- package/dist/tween/src/tween.js +70 -0
- package/dist/validate/chunk/BXTR2LmP.js +49 -0
- package/{chunk/DEuVgCzp.js → dist/validate/src/index.js} +91 -151
- package/dist/validate/src/util.js +22 -0
- package/divider/index.js +15 -14
- package/draggable/index.js +17 -16
- package/drawer/Drawer.js +41 -39
- package/dropdown/Button.js +88 -9
- package/dropdown/index.js +85 -163
- package/empty/index.js +21 -5
- package/form/Control.js +1 -1
- package/form/Form.js +159 -14
- package/form/FormItem.js +30 -29
- package/form/FormList.js +1 -1
- package/form/context.js +1 -1
- package/form/hook/useContext.js +32 -0
- package/form/hook/useForm.js +58 -0
- package/form/hook/useState.js +31 -0
- package/form/hook/useWatch.js +36 -0
- package/form/index.js +29 -106
- package/form/promisify.js +1 -1
- package/form/store.js +1 -1
- package/form/util.js +5 -5
- package/grid/Col.js +14 -13
- package/grid/Grid.js +23 -22
- package/grid/GridItem.js +23 -22
- package/grid/Row.js +19 -18
- package/{chunk/xAb6ZgqS.js → grid/hook/useResponsiveState.js} +2 -2
- package/hooks/index.js +38 -38
- package/hooks/use-watermark/utils.js +9 -0
- package/hooks/useComputedState.js +2 -2
- package/hooks/useCreate.js +2 -2
- package/hooks/useForceUpdate.js +2 -2
- package/hooks/useId.js +2 -2
- package/hooks/useInView.js +2 -2
- package/hooks/useIntersectionObserver.js +2 -2
- package/hooks/useInterval.js +2 -2
- package/hooks/useIsFirstRender.js +2 -2
- package/hooks/useIsomorphicLayoutEffect.js +2 -2
- package/hooks/useKeyboardEvent.js +2 -2
- package/hooks/useListenResize.js +2 -2
- package/hooks/useMedia.js +2 -2
- package/hooks/useMergeProps.js +2 -2
- package/hooks/useMergeValue.js +2 -2
- package/hooks/useOnlineStatus.js +2 -2
- package/hooks/useOverflowHidden.js +2 -2
- package/hooks/useOverrideRef.js +2 -2
- package/hooks/usePersistCallback.js +2 -2
- package/hooks/usePrefersColorSchemeDark.js +2 -2
- package/hooks/usePrevious.js +2 -2
- package/hooks/useRefs.js +2 -2
- package/hooks/useResizeObserver.js +2 -2
- package/hooks/useStateCallback.js +2 -2
- package/hooks/useStateWithPromise.js +2 -2
- package/hooks/useUpdateEffect.js +2 -2
- package/hooks/useVerificationCode.js +21 -21
- package/hooks/useWatch.js +2 -2
- package/hooks/useWatermark.js +72 -77
- package/hooks/useWindowSize.js +2 -2
- package/icon/addFromIconFontCn.js +31 -5
- package/icon/index.js +22 -48
- package/icon-hover/index.js +37 -5
- package/icons/file.js +15 -63
- package/image/Image.js +35 -32
- package/image/ImageFooter.js +44 -6
- package/image/ImagePreview.js +480 -34
- package/image/ImagePreviewArrow.js +8 -7
- package/image/ImagePreviewGroup.js +9 -9
- package/image/index.js +3 -3
- package/image/util/getFixTranslate.js +7 -0
- package/image/util/getScale.js +74 -0
- package/image/util/hook/useImageStatus.js +16 -0
- package/image/util/hook/useShowFooter.js +7 -0
- package/index.js +681 -614
- package/input/Button.js +67 -9
- package/input/Group.js +9 -8
- package/input/Input.js +158 -684
- package/input/InputElement.js +33 -33
- package/input/Number.js +2 -2
- package/input/Password.js +69 -11
- package/input/Search.js +68 -11
- package/input/Textarea.js +166 -14
- package/input/index.js +17 -13
- package/input-number/index.js +209 -16
- package/input-number/useSelectionRange.js +3 -3
- package/input-tag/InputTag.js +78 -72
- package/layout/Content.js +7 -6
- package/layout/Footer.js +7 -6
- package/layout/Header.js +5 -4
- package/layout/Sider.js +19 -18
- package/layout/index.js +21 -20
- package/link/index.js +15 -14
- package/list/Item.js +12 -11
- package/list/Meta.js +7 -6
- package/list/index.js +268 -17
- package/loading/index.js +13 -13
- package/loading/style/index.module.less.js +4 -0
- package/locale/en-US.js +4 -3
- package/locale/tr-TR.js +4 -3
- package/mentions/index.js +145 -11
- package/menu/Item.js +3 -3
- package/menu/Menu.js +182 -24
- package/menu/OverflowWrap.js +88 -8
- package/menu/index.js +9 -9
- package/menu/sub-menu/Inline.js +111 -0
- package/menu/sub-menu/Pop.js +120 -0
- package/menu/sub-menu/index.js +17 -0
- package/message/index.js +147 -13
- package/message/useMessage.js +57 -5
- package/modal/Confirm.js +110 -11
- package/modal/Modal.js +440 -20
- package/modal/index.js +1 -1
- package/modal/use-modal/Hook.js +52 -0
- package/modal/use-modal/index.js +68 -0
- package/notice/index.js +176 -17
- package/notification/index.js +149 -15
- package/notification/useNotification.js +52 -4
- package/overflow-ellipsis/OverflowItem.js +17 -16
- package/overflow-ellipsis/index.js +30 -29
- package/package.json +1 -1
- package/page-header/index.js +30 -28
- package/pagination/PageItem.js +16 -15
- package/pagination/PageJumper.js +13 -12
- package/pagination/PageOption.js +45 -5
- package/pagination/Pagination.js +244 -11
- package/pagination/index.js +2 -2
- package/picker/Input.js +47 -45
- package/picker/InputRange.js +53 -51
- package/popconfirm/index.js +10 -9
- package/popover/index.js +12 -11
- package/portal/Portal.js +7 -7
- package/progress/CircleProgress.js +1 -1
- package/progress/index.js +32 -31
- package/radio/Group.js +94 -14
- package/radio/GroupBlock.js +68 -7
- package/radio/Radio.js +92 -14
- package/radio/index.js +7 -6
- package/rate/index.js +31 -30
- package/resize-box/ResizeTrigger.js +10 -9
- package/resize-box/Split.js +66 -65
- package/resize-box/SplitGroup.js +10 -9
- package/resize-box/index.js +18 -17
- package/result/index.js +33 -32
- package/select/OptGroup.js +10 -10
- package/select/Option.js +93 -6
- package/select/Select.js +548 -24
- package/select/index.js +3 -3
- package/select/util.js +139 -18
- package/select-view/Core.js +23 -21
- package/select-view/index.js +7 -7
- package/skeleton/index.js +12 -11
- package/slider/Button.js +24 -23
- package/slider/Input.js +11 -11
- package/slider/hook/useInterval.js +73 -0
- package/slider/hook/useLegalValue.js +70 -0
- package/slider/index.js +220 -345
- package/space/index.js +38 -127
- package/space-/index.js +17 -16
- package/speech-synthesis/index.js +9 -63
- package/speech-synthesis/style/index.less.js +1 -0
- package/spin/DotLoading.js +10 -9
- package/spin/index.js +21 -20
- package/statistic/Countdown.js +16 -15
- package/statistic/index.js +45 -43
- package/statistic/util.js +1 -1
- package/steps/index.js +14 -13
- package/style.css +1 -1
- package/suspense-fallback-test/index.js +6 -5
- package/suspense-fallback-test/style/index.less.js +1 -0
- package/switch/index.js +43 -38
- package/table/Table.js +627 -21
- package/table/hook/useColumns.js +141 -0
- package/table/hook/useComponent.js +28 -0
- package/table/hook/useExpand.js +36 -0
- package/table/hook/useRowSelection.js +94 -0
- package/table/hook/useSorter.js +54 -0
- package/table/hook/useStickyClassNames.js +30 -0
- package/table/hook/useStickyOffsets.js +28 -0
- package/table/hook/useThResizable.js +39 -0
- package/table/index.js +28 -15
- package/table/summary/Cell.js +10 -0
- package/table/summary/Row.js +25 -0
- package/table/summary/context.js +5 -0
- package/table/summary/index.js +12 -0
- package/table/tbody/Td.js +180 -0
- package/table/tbody/Tr.js +165 -0
- package/table/tbody/index.js +154 -0
- package/table/tfoot/index.js +16 -0
- package/table/th-resizable/index.js +46 -0
- package/table/thead/Column.js +251 -0
- package/table/thead/index.js +129 -0
- package/tabs/Tab.js +169 -16
- package/tabs/TabContent.js +51 -6
- package/tabs/TabPane.js +13 -12
- package/tabs/hook/useDomSize.js +17 -0
- package/tabs/hook/useHeaderScroll.js +67 -0
- package/tabs/index.js +6 -6
- package/tabs/tab-header/DropdownIcon.js +66 -0
- package/tabs/tab-header/TabInk.js +66 -0
- package/tabs/tab-header/TabNavIcon.js +66 -0
- package/tabs/tab-header/TabTitle.js +78 -0
- package/tabs/tab-header/index.js +331 -0
- package/tag/index.js +32 -30
- package/time-picker/Picker.js +56 -55
- package/time-picker/RangePicker.js +14 -14
- package/time-picker/TimeColumn.js +1 -1
- package/time-picker/TimePicker.js +42 -41
- package/time-picker/util.js +23 -22
- package/timeline/Item.js +4 -3
- package/timeline/Timeline.js +12 -11
- package/tooltip/index.js +35 -33
- package/transfer/Item.js +104 -9
- package/transfer/List.js +186 -13
- package/transfer/index.js +181 -13
- package/tree/Animation.js +100 -9
- package/tree/Node.js +212 -13
- package/tree/NodeList.js +80 -6
- package/tree/Tree.js +595 -17
- package/tree/index.js +3 -2
- package/tree-select/List.js +122 -6
- package/tree-select/Select.js +258 -22
- package/tree-select/hook/useKeyCache.js +55 -0
- package/tree-select/hook/useStateValue.js +95 -0
- package/tree-select/hook/useTreeData.js +13 -0
- package/tree-select/index.js +3 -3
- package/trigger/getPopupStyle.js +2 -2
- package/trigger/index.js +27 -22
- package/types/common/empty/index.d.ts +1 -1
- package/types/common/icons/file/index.d.ts +1 -1
- package/types/common/space/index.d.ts +1 -1
- package/types/common/utils/is.d.ts +2 -1
- package/types/pc/anchor/context.d.ts +1 -1
- package/types/pc/color-picker/InputHex.d.ts +1 -1
- package/types/pc/color-picker/InputRgb.d.ts +1 -1
- package/types/pc/color-picker/Mode.d.ts +1 -1
- package/types/pc/color-picker/Palette.d.ts +1 -1
- package/types/pc/color-picker/utils.d.ts +1 -1
- package/types/pc/config-provider/context.d.ts +1 -1
- package/types/pc/date-picker/Picker.d.ts +1 -1
- package/types/pc/date-picker/RangePicker.d.ts +1 -1
- package/types/pc/details/index.d.ts +4 -0
- package/types/pc/details/interface.d.ts +33 -0
- package/types/pc/grid/context.d.ts +1 -1
- package/types/pc/grid/util.d.ts +1 -1
- package/types/pc/hooks/use-watermark/index.d.ts +1 -1
- package/types/pc/icons/file/index.d.ts +1 -1
- package/types/pc/index.d.ts +1 -0
- package/types/pc/input/index.d.ts +1 -1
- package/types/pc/message/index.d.ts +1 -2
- package/types/pc/message/useMessage.d.ts +1 -1
- package/types/pc/notification/useNotification.d.ts +1 -1
- package/types/pc/select/interface.d.ts +3 -3
- package/types/pc/space/index.d.ts +1 -1
- package/types/pc/table/ColGroup.d.ts +1 -1
- package/types/pc/table/constant.d.ts +1 -1
- package/types/pc/tree/Context.d.ts +2 -2
- package/types/pc/tree/index.d.ts +1 -1
- package/types/pc/tree/interface.d.ts +6 -2
- package/types/pc/trigger/getPopupStyle.d.ts +1 -1
- package/types/pc/typography/EditContent.d.ts +1 -1
- package/types/pc/typography/Ellipsis.d.ts +1 -1
- package/types/pc/typography/Paragraph.d.ts +1 -1
- package/types/pc/typography/Title.d.ts +1 -1
- package/types/pc/upload/Upload.d.ts +2 -2
- package/types/pc/upload/constant.d.ts +4 -0
- package/types/pc/upload/index.d.ts +2 -0
- package/types/pc/upload/interface.d.ts +0 -3
- package/types/pc/upload/request.d.ts +1 -1
- package/types/pc/upload/util.d.ts +1 -1
- package/types/pc/utils/names.d.ts +140 -134
- package/types/pc/verification-code/VerificationCode.d.ts +1 -1
- package/types/pc/verification-code/index.d.ts +1 -1
- package/types/pc/watermark/Watermark.d.ts +1 -1
- package/types/pc/watermark/index.d.ts +1 -1
- package/typography/Base.js +43 -42
- package/typography/EditContent.js +7 -7
- package/typography/Ellipsis.js +193 -23
- package/typography/Operations.js +4 -4
- package/typography/Paragraph.js +12 -11
- package/typography/Typography.js +8 -7
- package/typography/index.js +15 -10
- package/typography/useEllipsis.js +21 -21
- package/upload/TriggerNode.js +9 -8
- package/upload/Upload.js +127 -550
- package/upload/Uploader.js +12 -12
- package/upload/constant.js +9 -0
- package/upload/index.js +4 -4
- package/upload/interface.js +1 -9
- package/upload/list/PictureItem.js +119 -0
- package/upload/list/TextItem.js +123 -0
- package/upload/list/UploadProgress.js +96 -0
- package/upload/list/index.js +140 -0
- package/upload/request.js +3 -3
- package/upload/request_.js +5 -5
- package/utils/PqbCSSTransition.js +3 -3
- package/utils/color.js +1 -1
- package/utils/computeScrollIntoView.js +4 -126
- package/utils/constant.js +6 -6
- package/utils/contextHolder.js +29 -4
- package/utils/dayjs.js +11 -11
- package/utils/dom.js +7 -49
- package/utils/fillNBSP.js +3 -3
- package/utils/getHighlightText.js +1 -1
- package/utils/getHotkeyHandler.js +1 -1
- package/utils/getStringLength.js +1 -1
- package/utils/include.js +3 -3
- package/utils/index.js +280 -270
- package/utils/is.js +39 -39
- package/utils/mergeProps.js +1 -1
- package/utils/mergedToString.js +1 -1
- package/utils/names.js +4 -0
- package/utils/omit.js +1 -1
- package/utils/pad.js +3 -16
- package/utils/pick.js +5 -5
- package/utils/react19Adapter.js +1 -3
- package/utils/reactDOM.js +3 -3
- package/utils/reactTransitionGroup.js +12 -8
- package/utils/resizeObserverEffect.js +1 -1
- package/utils/scrollIntoView.js +1 -1
- package/utils/setDarkTheme.js +10 -30
- package/utils/setPrimaryColor.js +6 -29
- package/utils/setTheme.js +3 -3
- package/utils/style.js +4 -37
- package/utils/throttleByRaf.js +3 -14
- package/utils/throttleByRaf2.js +1 -1
- package/utils/tinycolor.js +26 -27
- package/utils/tween.js +4 -3
- package/utils/validate.js +5 -4
- package/utils/warning.js +3 -9
- package/verification-code/VerificationCode.js +25 -24
- package/version/index.js +1 -1
- package/virtual-list/VirtualList.js +278 -391
- package/virtual-list/util/algorithm.js +32 -0
- package/virtual-list/util/item.js +99 -0
- package/watermark/Watermark.js +17 -16
- package/chunk/5_U1CBIu.js +0 -8
- package/chunk/9TSjT7x_.js +0 -927
- package/chunk/B2yFlXke.js +0 -6
- package/chunk/B44Hj5ad.js +0 -697
- package/chunk/B5RFT17G.js +0 -15
- package/chunk/BJ9_azwQ.js +0 -1391
- package/chunk/BKKEev13.js +0 -11
- package/chunk/BKT9BFf4.js +0 -11
- package/chunk/BL8tIaO8.js +0 -649
- package/chunk/BNevupAU.js +0 -72
- package/chunk/BYdIoY50.js +0 -17
- package/chunk/BbQEqpOn.js +0 -7835
- package/chunk/BcCuJQY8.js +0 -214
- package/chunk/Bg3uJGPu.js +0 -10
- package/chunk/BsUZRQDT.js +0 -23
- package/chunk/C4OrxKE6.js +0 -18
- package/chunk/C8Kcc_9d.js +0 -1479
- package/chunk/CC---6jO.js +0 -110
- package/chunk/CCKr5jj1.js +0 -31
- package/chunk/CIRG541s.js +0 -22
- package/chunk/CPCJg6bv.js +0 -570
- package/chunk/CQ_WOOmf.js +0 -8
- package/chunk/CYhxqVkn.js +0 -9
- package/chunk/CftuXmo_.js +0 -6
- package/chunk/CkEaf5V0.js +0 -473
- package/chunk/ClM74To2.js +0 -58
- package/chunk/ClqoGc3r.js +0 -17
- package/chunk/D-Hw4x_H.js +0 -88
- package/chunk/D-ap9qEk.js +0 -14
- package/chunk/DWvmq7az.js +0 -843
- package/chunk/Dc-uXGtN.js +0 -178
- package/chunk/DxYoPlum.js +0 -50
- package/chunk/NPajzdOv.js +0 -27
- package/chunk/VSe_Wq1g.js +0 -10
- package/chunk/a3hR6zLw.js +0 -12
- package/types/common/assets/hourglass.d.ts +0 -2
package/cascader/Cascader.js
CHANGED
|
@@ -1,26 +1,301 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import "@unicom-cloud/icons/IconUiCheck";
|
|
3
|
-
import "@unicom-cloud/icons/IconUiLeft";
|
|
4
|
-
import "@unicom-cloud/icons/IconUiLoading";
|
|
5
|
-
import "@unicom-cloud/icons/IconUiRight";
|
|
6
|
-
import "@unicom-cloud/utils/is";
|
|
7
|
-
import "lodash/isArray";
|
|
8
|
-
import "lodash/isFunction";
|
|
9
|
-
import "lodash/isPlainObject";
|
|
10
|
-
import "lodash/isString";
|
|
11
|
-
import "react";
|
|
12
|
-
import "../
|
|
13
|
-
import "../
|
|
14
|
-
import "../
|
|
15
|
-
import "../
|
|
16
|
-
import "../
|
|
17
|
-
import "../
|
|
18
|
-
import "../select-view/index.js";
|
|
19
|
-
import "../trigger/index.js";
|
|
20
|
-
import "@unicom-cloud/utils/class-name";
|
|
21
|
-
import "@unicom-cloud/utils/constant/keyboardCode";
|
|
22
|
-
import
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import ce from "@unicom-cloud/icons/IconUiCheck";
|
|
3
|
+
import de from "@unicom-cloud/icons/IconUiLeft";
|
|
4
|
+
import pe from "@unicom-cloud/icons/IconUiLoading";
|
|
5
|
+
import me from "@unicom-cloud/icons/IconUiRight";
|
|
6
|
+
import { isEmptyValue as fe, isEmptyArray as he } from "@unicom-cloud/utils/is";
|
|
7
|
+
import ge from "lodash/isArray";
|
|
8
|
+
import O from "lodash/isFunction";
|
|
9
|
+
import L from "lodash/isPlainObject";
|
|
10
|
+
import Ce from "lodash/isString";
|
|
11
|
+
import { forwardRef as Ve, useContext as ve, useRef as S, useState as ye, useEffect as $, useImperativeHandle as Se, useCallback as j } from "react";
|
|
12
|
+
import "../config-provider/ConfigProvider.js";
|
|
13
|
+
import be from "../components/common/hooks/useForceUpdate.js";
|
|
14
|
+
import ke from "../components/common/hooks/useId.js";
|
|
15
|
+
import we from "../components/common/hooks/useMergeProps.js";
|
|
16
|
+
import z from "../components/common/hooks/useMergeValue.js";
|
|
17
|
+
import Oe from "../components/common/hooks/useUpdateEffect.js";
|
|
18
|
+
import Ee from "../select-view/index.js";
|
|
19
|
+
import Ne from "../trigger/index.js";
|
|
20
|
+
import Pe from "@unicom-cloud/utils/class-name";
|
|
21
|
+
import { Esc as Ie, Tab as xe, Enter as Me } from "@unicom-cloud/utils/constant/keyboardCode";
|
|
22
|
+
import Le from "./hook/useRefCurrent.js";
|
|
23
|
+
import Te from "./panel/List.js";
|
|
24
|
+
import Re from "./panel/Search.js";
|
|
25
|
+
import { SHOW_CHILD as De, getConfig as Fe, getStore as Ae, formatValue as b, transformValuesToSet as Ue, valueInSet as Be, removeValueFromSet as _e, PANEL_MODE as K } from "./util.js";
|
|
26
|
+
import He from "../config-provider/context.js";
|
|
27
|
+
const We = {
|
|
28
|
+
label: "label",
|
|
29
|
+
value: "value",
|
|
30
|
+
isLeaf: "isLeaf",
|
|
31
|
+
children: "children",
|
|
32
|
+
disabled: "disabled"
|
|
33
|
+
}, $e = {
|
|
34
|
+
options: [],
|
|
35
|
+
bordered: !0,
|
|
36
|
+
fieldNames: We,
|
|
37
|
+
trigger: "click",
|
|
38
|
+
expandTrigger: "click",
|
|
39
|
+
checkedStrategy: De,
|
|
40
|
+
defaultActiveFirstOption: !0
|
|
41
|
+
}, je = { bottom: 4 };
|
|
42
|
+
function ze(J, q) {
|
|
43
|
+
const { getPrefixCls: E, renderEmpty: G, componentConfig: N, rtl: v } = ve(He), e = we(
|
|
44
|
+
J,
|
|
45
|
+
$e,
|
|
46
|
+
N == null ? void 0 : N.Cascader
|
|
47
|
+
), {
|
|
48
|
+
disabled: T,
|
|
49
|
+
renderFormat: P,
|
|
50
|
+
getPopupContainer: Q,
|
|
51
|
+
children: R,
|
|
52
|
+
triggerProps: X,
|
|
53
|
+
expandTrigger: Y,
|
|
54
|
+
icons: f
|
|
55
|
+
} = e, D = {
|
|
56
|
+
loading: (f == null ? void 0 : f.loading) || /* @__PURE__ */ p(pe, {}),
|
|
57
|
+
checked: (f == null ? void 0 : f.checked) || /* @__PURE__ */ p(ce, {}),
|
|
58
|
+
next: (f == null ? void 0 : f.next) || (v ? /* @__PURE__ */ p(de, {}) : /* @__PURE__ */ p(me, {}))
|
|
59
|
+
}, g = E == null ? void 0 : E("cascader"), a = e.mode === "multiple", y = S(null), Z = be(), l = Le(() => Ae(
|
|
60
|
+
e,
|
|
61
|
+
b(
|
|
62
|
+
"value" in e ? e.value : e.defaultValue,
|
|
63
|
+
a
|
|
64
|
+
)
|
|
65
|
+
), [JSON.stringify(Fe(e)), e.options]), [I, F] = ye(() => "value" in e ? b(e.value, a, l) : "defaultValue" in e ? b(e.defaultValue, a, l) : []), h = "value" in e ? b(e.value, a, l) : I, [u, ee] = z(!1, {
|
|
66
|
+
value: e.popupVisible,
|
|
67
|
+
defaultValue: e.defaultPopupVisible
|
|
68
|
+
}), [c, te, ne] = z("", {
|
|
69
|
+
value: "inputValue" in e ? e.inputValue || "" : void 0
|
|
70
|
+
}), k = S(c), A = S(null), C = S(null), x = S((l == null ? void 0 : l.getCheckedNodes()) || []), U = ke(`${g}-popup-`), M = (t, n) => {
|
|
71
|
+
var r;
|
|
72
|
+
t !== k.current && (te(t), k.current = t, A.current = n, (r = e.onInputValueChange) == null || r.call(e, t, n));
|
|
73
|
+
};
|
|
74
|
+
function re(t) {
|
|
75
|
+
return fe(t) || he(t);
|
|
76
|
+
}
|
|
77
|
+
$(() => {
|
|
78
|
+
var n;
|
|
79
|
+
const { current: t } = A;
|
|
80
|
+
ne === c && (t === "manual" || t === "optionListHide") && ((n = e.onSearch) == null || n.call(e, c, t)), c !== k.current && (k.current = c);
|
|
81
|
+
}, [c]), $(() => {
|
|
82
|
+
const t = () => {
|
|
83
|
+
clearTimeout(y.current), y.current = null;
|
|
84
|
+
};
|
|
85
|
+
return !u && c && (y.current && t(), y.current = setTimeout(() => {
|
|
86
|
+
M("", "optionListHide"), y.current = null;
|
|
87
|
+
}, 200)), () => {
|
|
88
|
+
t();
|
|
89
|
+
};
|
|
90
|
+
}, [u]), Oe(() => {
|
|
91
|
+
if ("value" in e && e.value !== I) {
|
|
92
|
+
const t = b(e.value, a);
|
|
93
|
+
l.setNodeCheckedByValue(t), F(t);
|
|
94
|
+
}
|
|
95
|
+
}, [e.value, a]), Se(q, () => C.current, []);
|
|
96
|
+
const oe = (t) => {
|
|
97
|
+
x.current = Array.from(
|
|
98
|
+
new Set([].concat(t, x.current))
|
|
99
|
+
);
|
|
100
|
+
}, B = (t) => {
|
|
101
|
+
const n = [], r = Ue(t), i = (o) => {
|
|
102
|
+
o.some((s) => {
|
|
103
|
+
if (Be(r, s.pathValue) && (n.push(s.getPathNodes().map((d) => d._data)), _e(r, s.pathValue)), !r.size)
|
|
104
|
+
return !0;
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
return i(l.getCheckedNodes()), r.size && i(x.current), n;
|
|
108
|
+
}, m = j(
|
|
109
|
+
(t) => {
|
|
110
|
+
var n;
|
|
111
|
+
t !== u && ((n = e.onVisibleChange) == null || n.call(e, t), "popupVisible" in e || ee(t));
|
|
112
|
+
},
|
|
113
|
+
[e.onVisibleChange, u]
|
|
114
|
+
), ie = j(
|
|
115
|
+
(t) => {
|
|
116
|
+
var o;
|
|
117
|
+
const n = B([t])[0] || [];
|
|
118
|
+
let r, i = ge(t) ? t.map((s) => String(s)) : [];
|
|
119
|
+
return n.length && (i = n.map((s) => s.label)), O(P) ? r = P(i) : i.every((s, d, w) => Ce(s)) ? r = i.join(" / ") : r = i.reduce((s, d, w) => s.concat(w === 0 ? [d] : [" / ", d]), []), {
|
|
120
|
+
text: r || "",
|
|
121
|
+
disabled: (o = n[n.length - 1]) == null ? void 0 : o.disabled
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
[l, I, P]
|
|
125
|
+
// 这里把 stateValue 放到依赖里面,是因为当受控时props.value改变或非受控时内部stateValue改变,都会需要出发节点选中状态的更新
|
|
126
|
+
// 此时需要重新渲染已选中值的展示
|
|
127
|
+
), V = (t, n) => {
|
|
128
|
+
var W;
|
|
129
|
+
n === "panel" && L(e.showSearch) && !e.showSearch.retainInputValueWhileSelect && a && M("", "optionChecked");
|
|
130
|
+
const { onChange: r, changeOnSelect: i, expandTrigger: o } = e;
|
|
131
|
+
if (h === t)
|
|
132
|
+
return;
|
|
133
|
+
a || l.setNodeCheckedByValue(t), oe(l.getCheckedNodes());
|
|
134
|
+
const d = B(t), w = a ? t : t[0], ue = a ? d : d[0];
|
|
135
|
+
a || (c || d[0] && ((W = d[0][d[0].length - 1]) != null && W.isLeaf) || i && o === "hover") && m(!1), "value" in e ? (l.setNodeCheckedByValue(h), Z()) : F(t), r == null || r(w, ue, {
|
|
136
|
+
dropdownVisible: u
|
|
137
|
+
});
|
|
138
|
+
}, ae = (t, n, r) => {
|
|
139
|
+
if (r.stopPropagation(), t.disabled)
|
|
140
|
+
return;
|
|
141
|
+
const i = h.filter((o, s) => s !== n);
|
|
142
|
+
l.setNodeCheckedByValue(i), V(i);
|
|
143
|
+
}, _ = (t) => {
|
|
144
|
+
const n = t || C.current && C.current.getWidth();
|
|
145
|
+
return /* @__PURE__ */ p(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
className: `${g}-list-empty`,
|
|
149
|
+
style: { width: n },
|
|
150
|
+
children: e.notFoundContent || G("Cascader")
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}, le = () => {
|
|
154
|
+
const t = L(e.showSearch) ? e.showSearch.panelMode : void 0, n = t === K.select ? !0 : t === K.cascader ? !1 : !O(e.onSearch) && !!c, r = C.current && C.current.getWidth(), i = O(e.dropdownRender) ? e.dropdownRender : (o) => o;
|
|
155
|
+
return /* @__PURE__ */ p(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
id: U,
|
|
159
|
+
className: Pe(`${g}-popup`, e.dropdownMenuClassName, {
|
|
160
|
+
[`${g}-popup-trigger-hover`]: e.expandTrigger === "hover"
|
|
161
|
+
}),
|
|
162
|
+
children: i(
|
|
163
|
+
/* @__PURE__ */ p(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
className: `${g}-popup-inner`,
|
|
167
|
+
onMouseDown: (o) => o.preventDefault(),
|
|
168
|
+
children: n ? /* @__PURE__ */ p(
|
|
169
|
+
Re,
|
|
170
|
+
{
|
|
171
|
+
style: { minWidth: r },
|
|
172
|
+
store: l,
|
|
173
|
+
inputValue: c,
|
|
174
|
+
renderEmpty: () => _(r),
|
|
175
|
+
multiple: a,
|
|
176
|
+
onChange: (o) => {
|
|
177
|
+
V(o, "panel");
|
|
178
|
+
},
|
|
179
|
+
prefixCls: g,
|
|
180
|
+
rtl: v,
|
|
181
|
+
onEsc: () => {
|
|
182
|
+
m(!1);
|
|
183
|
+
},
|
|
184
|
+
renderOption: L(e.showSearch) && e.showSearch.renderOption || void 0,
|
|
185
|
+
getTriggerElement: () => {
|
|
186
|
+
var o;
|
|
187
|
+
return (o = C.current) == null ? void 0 : o.dom;
|
|
188
|
+
},
|
|
189
|
+
value: h,
|
|
190
|
+
virtualListProps: e.virtualListProps,
|
|
191
|
+
defaultActiveFirstOption: e.defaultActiveFirstOption,
|
|
192
|
+
icons: D
|
|
193
|
+
}
|
|
194
|
+
) : /* @__PURE__ */ p(
|
|
195
|
+
Te,
|
|
196
|
+
{
|
|
197
|
+
dropdownMenuColumnStyle: e.dropdownMenuColumnStyle,
|
|
198
|
+
virtualListProps: e.virtualListProps,
|
|
199
|
+
expandTrigger: Y,
|
|
200
|
+
store: l,
|
|
201
|
+
dropdownColumnRender: e.dropdownColumnRender,
|
|
202
|
+
renderOption: e.renderOption,
|
|
203
|
+
changeOnSelect: e.changeOnSelect,
|
|
204
|
+
showEmptyChildren: e.showEmptyChildren || !!e.loadMore,
|
|
205
|
+
multiple: a,
|
|
206
|
+
onChange: (o) => {
|
|
207
|
+
V(o, "panel");
|
|
208
|
+
},
|
|
209
|
+
loadMore: e.loadMore,
|
|
210
|
+
prefixCls: g,
|
|
211
|
+
rtl: v,
|
|
212
|
+
getTriggerElement: () => {
|
|
213
|
+
var o;
|
|
214
|
+
return (o = C.current) == null ? void 0 : o.dom;
|
|
215
|
+
},
|
|
216
|
+
renderEmpty: _,
|
|
217
|
+
popupVisible: u,
|
|
218
|
+
value: h,
|
|
219
|
+
renderFooter: e.renderFooter,
|
|
220
|
+
icons: D,
|
|
221
|
+
onEsc: () => {
|
|
222
|
+
m(!1);
|
|
223
|
+
},
|
|
224
|
+
onDoubleClickOption: () => {
|
|
225
|
+
e.changeOnSelect && !a && m(!1);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}, se = (t) => {
|
|
235
|
+
V(t);
|
|
236
|
+
}, H = (t) => /* @__PURE__ */ p(
|
|
237
|
+
Ne,
|
|
238
|
+
{
|
|
239
|
+
popup: le,
|
|
240
|
+
trigger: e.trigger,
|
|
241
|
+
disabled: T,
|
|
242
|
+
getPopupContainer: Q,
|
|
243
|
+
position: v ? "br" : "bl",
|
|
244
|
+
classNames: "slideDynamicOrigin",
|
|
245
|
+
popupAlign: je,
|
|
246
|
+
unmountOnExit: "unmountOnExit" in e ? e.unmountOnExit : !O(e.loadMore),
|
|
247
|
+
popupVisible: u,
|
|
248
|
+
...X,
|
|
249
|
+
onVisibleChange: m,
|
|
250
|
+
children: t
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
return R ? H(R) : /* @__PURE__ */ p(
|
|
254
|
+
Ee,
|
|
255
|
+
{
|
|
256
|
+
...e,
|
|
257
|
+
ref: C,
|
|
258
|
+
ariaControls: U,
|
|
259
|
+
popupVisible: u,
|
|
260
|
+
value: a ? h : h && h[0],
|
|
261
|
+
inputValue: c,
|
|
262
|
+
rtl: v,
|
|
263
|
+
isEmptyValue: re(h),
|
|
264
|
+
prefixCls: g,
|
|
265
|
+
isMultiple: a,
|
|
266
|
+
renderText: ie,
|
|
267
|
+
onRemoveCheckedItem: ae,
|
|
268
|
+
onSort: se,
|
|
269
|
+
renderView: H,
|
|
270
|
+
onClear: (t) => {
|
|
271
|
+
var n;
|
|
272
|
+
if (t.stopPropagation(), !a)
|
|
273
|
+
V([]);
|
|
274
|
+
else {
|
|
275
|
+
const i = l.getCheckedNodes().filter((o) => o.disabled).map((o) => o.pathValue);
|
|
276
|
+
l.setNodeCheckedByValue(i), V(i);
|
|
277
|
+
}
|
|
278
|
+
(n = e.onClear) == null || n.call(e, !!u);
|
|
279
|
+
},
|
|
280
|
+
onKeyDown: (t) => {
|
|
281
|
+
var r;
|
|
282
|
+
if (T)
|
|
283
|
+
return;
|
|
284
|
+
t.stopPropagation();
|
|
285
|
+
const n = t.key;
|
|
286
|
+
u ? (n === Ie.key && (m(!1), t.preventDefault()), n === xe.key && m(!1)) : n === Me.key && (m(!0), t.preventDefault()), (r = e.onKeyDown) == null || r.call(e, t);
|
|
287
|
+
},
|
|
288
|
+
onChangeInputValue: (t) => {
|
|
289
|
+
M(t, "manual"), u || m(!0);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
const Ke = Ve(
|
|
295
|
+
ze
|
|
296
|
+
);
|
|
297
|
+
Ke.displayName = "Cascader";
|
|
23
298
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
299
|
+
We as DefaultFieldNames,
|
|
300
|
+
Ke as default
|
|
26
301
|
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var k = (d, e, t) => e in d ? b(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
|
|
3
|
+
var a = (d, e, t) => k(d, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import c from "lodash/get";
|
|
5
|
+
import { DefaultFieldNames as g } from "../Cascader.js";
|
|
6
|
+
class _ {
|
|
7
|
+
constructor(e, t, h) {
|
|
8
|
+
a(this, "value");
|
|
9
|
+
a(this, "label");
|
|
10
|
+
// 是否禁用
|
|
11
|
+
a(this, "disabled");
|
|
12
|
+
a(this, "_level");
|
|
13
|
+
a(this, "_index");
|
|
14
|
+
a(this, "isLeaf");
|
|
15
|
+
a(this, "disableCheckbox");
|
|
16
|
+
// 是否选中
|
|
17
|
+
a(this, "_checked");
|
|
18
|
+
/** 是否半选 */
|
|
19
|
+
a(this, "_halfChecked");
|
|
20
|
+
/** 当前选项节点的父节点 */
|
|
21
|
+
a(this, "parent");
|
|
22
|
+
/** 当前选项节点路径的所有节点的值 */
|
|
23
|
+
a(this, "pathValue", []);
|
|
24
|
+
a(this, "pathLabel", []);
|
|
25
|
+
/** 下一级选项 */
|
|
26
|
+
a(this, "children");
|
|
27
|
+
/** 是否在加载中 */
|
|
28
|
+
a(this, "loading");
|
|
29
|
+
/** 是否加载完成 */
|
|
30
|
+
a(this, "loaded");
|
|
31
|
+
a(this, "config", {});
|
|
32
|
+
// 保存暴露给外部的属性
|
|
33
|
+
a(this, "_data");
|
|
34
|
+
a(this, "_initNode", (e, t = null) => {
|
|
35
|
+
const { showEmptyChildren: h, lazyload: i } = this.config, l = { ...g, ...this.config.fieldNames }, n = c(e, l.children) || e[l.children];
|
|
36
|
+
let f = Array.isArray(n) ? h ? !1 : n.length === 0 : !0;
|
|
37
|
+
i && (l.isLeaf in e ? f = !!c(e, l.isLeaf) || !!e[l.isLeaf] : f = !1);
|
|
38
|
+
const u = c(e, l.value) || e[l.value], o = c(e, l.label) || e[l.label], r = {
|
|
39
|
+
...e,
|
|
40
|
+
value: u,
|
|
41
|
+
label: o,
|
|
42
|
+
isLeaf: f,
|
|
43
|
+
loading: !1,
|
|
44
|
+
loaded: !1,
|
|
45
|
+
disabled: t && t.disabled || c(e, l.disabled) || e[l.disabled],
|
|
46
|
+
parent: t,
|
|
47
|
+
pathValue: t ? [...t.pathValue, u] : [u],
|
|
48
|
+
pathLabel: t ? [...t.pathLabel, o] : [o],
|
|
49
|
+
_level: t ? t._level + 1 : 0,
|
|
50
|
+
_checked: !1,
|
|
51
|
+
_halfChecked: !1
|
|
52
|
+
};
|
|
53
|
+
this._data = {
|
|
54
|
+
...r,
|
|
55
|
+
parent: r.parent && r.parent._data
|
|
56
|
+
}, Object.keys(r).forEach((s) => {
|
|
57
|
+
this[s] = r[s];
|
|
58
|
+
}), n && n.length && (this.children = n.map((s, C) => new _({ ...s, _index: C }, this.config, this)), this._data.children = this.children.map((s) => s._data));
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* 根据this.children 计算是否当前node半选状态
|
|
62
|
+
* 假设半选是 0.5,全选是1,不选是0。
|
|
63
|
+
* 那么只有当前节点的所有children加起来等于children.length,才是全选,否则和大于0,就是半选。
|
|
64
|
+
*/
|
|
65
|
+
a(this, "_isHalfChecked", () => {
|
|
66
|
+
const e = this.children.reduce((t, h) => {
|
|
67
|
+
const i = h._halfChecked ? 0.5 : h._checked ? 1 : 0;
|
|
68
|
+
return t + i;
|
|
69
|
+
}, 0);
|
|
70
|
+
return e !== this.children.length && e > 0;
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* @param checked 选中状态
|
|
75
|
+
* @param ignoreDisabled 是否忽略节点禁用设置选中状态,一般在初始化设置选中状态时传参为true
|
|
76
|
+
*/
|
|
77
|
+
a(this, "_setNodeChildrenChecked", (e, t) => {
|
|
78
|
+
!t && this.disabled || this.children && this.children.length && (this.children.forEach((h) => {
|
|
79
|
+
h.disabled ? t && h.setCheckedStateIgnoreDisabled(e) : h.setCheckedState(e);
|
|
80
|
+
}), this.updateHalfState(e));
|
|
81
|
+
});
|
|
82
|
+
a(this, "getSelfChildrenValue", () => {
|
|
83
|
+
const e = [], t = (h, i) => {
|
|
84
|
+
if (!i || !i.length) {
|
|
85
|
+
e.push(h);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
(i || []).forEach((l) => {
|
|
89
|
+
t(l.pathValue, l.children);
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
return t(this.pathValue, this.children), e;
|
|
93
|
+
});
|
|
94
|
+
a(this, "updateHalfState", (e) => {
|
|
95
|
+
this._halfChecked = this._isHalfChecked(), this._checked = this._halfChecked ? !1 : e;
|
|
96
|
+
});
|
|
97
|
+
// 直接设置选中状态
|
|
98
|
+
a(this, "setCheckedProperty", (e) => {
|
|
99
|
+
this._checked = e, this._halfChecked = !1;
|
|
100
|
+
});
|
|
101
|
+
// 设置当前节点选中状态
|
|
102
|
+
a(this, "setCheckedState", (e) => {
|
|
103
|
+
const t = e ? this._checked : !this._checked && !this._halfChecked;
|
|
104
|
+
if (!(this.disabled || t) && (this.setCheckedProperty(e), !this.config.changeOnSelect)) {
|
|
105
|
+
this._setNodeChildrenChecked(e);
|
|
106
|
+
let h = this.parent;
|
|
107
|
+
for (; h && !h.disabled; )
|
|
108
|
+
h.updateHalfState(e), h = h.parent;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
// 忽略禁用设置选中状态
|
|
112
|
+
a(this, "setCheckedStateIgnoreDisabled", (e) => {
|
|
113
|
+
if (e !== !!this._checked && (this.setCheckedProperty(e), !this.config.changeOnSelect)) {
|
|
114
|
+
this._setNodeChildrenChecked(e, !0);
|
|
115
|
+
let t = this.parent;
|
|
116
|
+
for (; t; )
|
|
117
|
+
t.updateHalfState(e), t = t.parent;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
/**
|
|
121
|
+
* 遍历节点的parent,获取当前节点的路径节点。
|
|
122
|
+
* node: { label: '1-1-1', parent: { label: '1-1', parent: { label: '1' }, ... }, ...}
|
|
123
|
+
* @return [node.parent.parent, node.parent, node]
|
|
124
|
+
* @memberof Store
|
|
125
|
+
*/
|
|
126
|
+
a(this, "getPathNodes", () => {
|
|
127
|
+
const e = [this];
|
|
128
|
+
let t = this.parent;
|
|
129
|
+
for (; t; )
|
|
130
|
+
e.unshift(t), t = t.parent;
|
|
131
|
+
return e;
|
|
132
|
+
});
|
|
133
|
+
a(this, "getChildren", () => this.children);
|
|
134
|
+
a(this, "setLoading", (e) => {
|
|
135
|
+
this.loading = e, (e || e === void 0) && (this.loaded = !1), e === !1 && (this.loaded = !0);
|
|
136
|
+
});
|
|
137
|
+
this.config = t || {}, this._initNode(e, h || null);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
export {
|
|
141
|
+
_ as default
|
|
142
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var l = Object.defineProperty;
|
|
2
|
+
var c = (i, e, t) => e in i ? l(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var a = (i, e, t) => c(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import d from "lodash/isArray";
|
|
5
|
+
import u from "lodash/isEqualWith";
|
|
6
|
+
import N from "lodash/isFunction";
|
|
7
|
+
import g from "lodash/isString";
|
|
8
|
+
import { transformValuesToSet as m, valueInSet as n } from "../util.js";
|
|
9
|
+
import p from "./node.js";
|
|
10
|
+
class P {
|
|
11
|
+
constructor(e, t, s) {
|
|
12
|
+
a(this, "nodes", []);
|
|
13
|
+
a(this, "flatNodes", []);
|
|
14
|
+
a(this, "config", {});
|
|
15
|
+
// 初始化节点状态,附加状态信息字段: _checked,_halfChecked,parent,disabled
|
|
16
|
+
a(this, "_calcNodes", (e, t) => e ? e.map((s, r) => new p({ ...s, _index: r }, this.config, t)) : []);
|
|
17
|
+
// this.flatNodes 保存所有可能的选中项
|
|
18
|
+
a(this, "_updateFlatNodes", () => {
|
|
19
|
+
const e = !this.config.changeOnSelect;
|
|
20
|
+
this.flatNodes = [];
|
|
21
|
+
const t = (s) => {
|
|
22
|
+
s && ((!e || s.isLeaf) && this.flatNodes.push(s), d(s.children) && s.children.forEach((r) => {
|
|
23
|
+
t(r);
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
this.nodes.forEach((s) => {
|
|
27
|
+
t(s);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* values: 全部的选中值
|
|
32
|
+
* 根据values更新节点状态。不包含在values的节点都设置为未选中状态
|
|
33
|
+
* @memberof Store
|
|
34
|
+
*/
|
|
35
|
+
a(this, "setNodeCheckedByValue", (e) => {
|
|
36
|
+
const t = m(e);
|
|
37
|
+
this.flatNodes.forEach((s) => {
|
|
38
|
+
let r = !1;
|
|
39
|
+
this.config.showParent ? s.pathValue.some(
|
|
40
|
+
(o, h, f) => n(t, f.slice(0, h + 1))
|
|
41
|
+
) && (r = !0) : n(t, s.pathValue) && (r = !0), s.setCheckedStateIgnoreDisabled(r);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* 为当前节点插入子节点。动态加载时候用到
|
|
46
|
+
*/
|
|
47
|
+
a(this, "appendOptionChildren", (e, t) => {
|
|
48
|
+
if (t && e) {
|
|
49
|
+
const s = this._calcNodes(t, e);
|
|
50
|
+
e.children = s, this._updateFlatNodes(), this.config.changeOnSelect || e.setCheckedState(!1);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* 通过 value 查找对应的node节点。
|
|
55
|
+
* value: 是路径节点的value组成的数组
|
|
56
|
+
*/
|
|
57
|
+
a(this, "findNodeByValue", (e) => {
|
|
58
|
+
let t = null;
|
|
59
|
+
return !e || !e.length || this.flatNodes.some((s) => {
|
|
60
|
+
u(s.pathValue, e) && (t = s);
|
|
61
|
+
}), t;
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* 搜索所有label含有关键字的节点
|
|
65
|
+
*/
|
|
66
|
+
a(this, "searchNodeByLabel", (e) => {
|
|
67
|
+
if (!e)
|
|
68
|
+
return this.flatNodes;
|
|
69
|
+
const { filterOption: t } = this.config, s = N(t) ? t : (r, o) => g(o.label) && o.label.indexOf(r) > -1;
|
|
70
|
+
return this.flatNodes.filter((r) => r.getPathNodes().some((h) => s(e, h._data)));
|
|
71
|
+
});
|
|
72
|
+
/** 获取所有节点 */
|
|
73
|
+
a(this, "getOptions", () => this.nodes);
|
|
74
|
+
/** 获取所有选中状态的节点。 aggregation: 是否聚合节点 */
|
|
75
|
+
a(this, "getCheckedNodes", () => this.config.showParent ? this.getCheckedParentNodes() : this.flatNodes.filter((e) => e._checked));
|
|
76
|
+
// 按照父节点纬度聚合当前所有选中节点。
|
|
77
|
+
a(this, "getCheckedParentNodes", () => {
|
|
78
|
+
const e = /* @__PURE__ */ new Set();
|
|
79
|
+
return this.flatNodes.forEach((t) => {
|
|
80
|
+
t._checked && t.getPathNodes().some((r) => {
|
|
81
|
+
if (r._checked)
|
|
82
|
+
return e.has(r) || e.add(r), !0;
|
|
83
|
+
});
|
|
84
|
+
}), Array.from(e);
|
|
85
|
+
});
|
|
86
|
+
this.config = { ...s };
|
|
87
|
+
const r = Array.isArray(t) ? t : [];
|
|
88
|
+
this.nodes = this._calcNodes(e, null), this._updateFlatNodes(), this.setNodeCheckedByValue(r);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
P as default
|
|
93
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useRef as o } from "react";
|
|
2
|
+
import u from "../../components/common/hooks/useForceUpdate.js";
|
|
3
|
+
import c from "../../components/common/hooks/useUpdateEffect.js";
|
|
4
|
+
function m(e, t) {
|
|
5
|
+
const r = o(null), f = u();
|
|
6
|
+
return r.current || (r.current = e()), c(() => {
|
|
7
|
+
r.current = e(), f();
|
|
8
|
+
}, [...t]), r.current;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
m as default
|
|
12
|
+
};
|
package/cascader/index.js
CHANGED