@cloud-app-dev/vidc 4.0.20 → 4.0.21
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/es/AppContext/Sync.d.ts +8 -0
- package/es/AppContext/Sync.js +42 -0
- package/es/AppContext/index.d.ts +10 -0
- package/es/AppContext/index.js +141 -0
- package/es/AppContext/interface.d.ts +41 -0
- package/es/AppContext/static.d.ts +8 -0
- package/es/AppContext/static.js +9 -0
- package/es/Auth/index.d.ts +8 -0
- package/es/Auth/index.js +14 -0
- package/es/AutoExit/index.d.ts +6 -0
- package/es/AutoExit/index.js +19 -0
- package/es/CheckGroupFixed/demo.d.ts +3 -0
- package/es/CheckGroupFixed/demo.js +22 -0
- package/es/CheckGroupFixed/index.d.ts +24 -0
- package/es/CheckGroupFixed/index.js +140 -0
- package/es/CheckGroupFixed/index.less +56 -0
- package/es/Config/index.d.ts +4 -0
- package/es/Config/index.js +77 -0
- package/es/Config/interface.d.ts +65 -0
- package/es/Config/utils.d.ts +4 -0
- package/es/Config/utils.js +33 -0
- package/es/ConfigContext/index.d.ts +17 -0
- package/es/ConfigContext/index.js +21 -0
- package/es/CustomRenderSelect/index.d.ts +12 -0
- package/es/CustomRenderSelect/index.js +73 -0
- package/es/CustomRenderSelect/index.less +25 -0
- package/es/DBTools/index.d.ts +25 -0
- package/es/DBTools/index.js +336 -0
- package/es/DisableMark/index.d.ts +9 -0
- package/es/DisableMark/index.js +19 -0
- package/es/DisableMark/index.less +9 -0
- package/es/DomMove/demo.d.ts +2 -0
- package/es/DomMove/demo.js +16 -0
- package/es/DomMove/index.d.ts +16 -0
- package/es/DomMove/index.js +139 -0
- package/es/DomMove/utils.d.ts +8 -0
- package/es/DomMove/utils.js +32 -0
- package/es/Drag/DragAndDropItem.d.ts +4 -0
- package/es/Drag/DragAndDropItem.js +134 -0
- package/es/Drag/DropItem.d.ts +4 -0
- package/es/Drag/DropItem.js +50 -0
- package/es/Drag/index.d.ts +7 -0
- package/es/Drag/index.js +7 -0
- package/es/Drag/interface.d.ts +16 -0
- package/es/DynamicGridList/Demo.d.ts +3 -0
- package/es/DynamicGridList/Demo.js +77 -0
- package/es/DynamicGridList/index.d.ts +24 -0
- package/es/DynamicGridList/index.js +67 -0
- package/es/DynamicList/demo.d.ts +2 -0
- package/es/DynamicList/demo.js +44 -0
- package/es/DynamicList/index.d.ts +22 -0
- package/es/DynamicList/index.js +86 -0
- package/es/DynamicList/index.less +17 -0
- package/es/DynamicList/interface.d.ts +19 -0
- package/es/DynamicList/utils.d.ts +4 -0
- package/es/DynamicList/utils.js +6 -0
- package/es/ErrorFallback/index.d.ts +9 -0
- package/es/ErrorFallback/index.js +31 -0
- package/es/ErrorFallback/inerface.d.ts +48 -0
- package/es/EventTools/index.d.ts +3 -0
- package/es/EventTools/index.js +12 -0
- package/es/FrontendPlayer/index.d.ts +4 -0
- package/es/FrontendPlayer/index.js +2 -0
- package/es/FullScreen/index.d.ts +22 -0
- package/es/FullScreen/index.js +33 -0
- package/es/FullScreen/index.less +18 -0
- package/es/GridList/Demo.d.ts +3 -0
- package/es/GridList/Demo.js +80 -0
- package/es/GridList/data.d.ts +16 -0
- package/es/GridList/data.js +609 -0
- package/es/GridList/hook.d.ts +13 -0
- package/es/GridList/hook.js +270 -0
- package/es/GridList/index.d.ts +15 -0
- package/es/GridList/index.js +44 -0
- package/es/GridList/index.less +8 -0
- package/es/GridList/interface.d.ts +59 -0
- package/es/GridList/utils.d.ts +9 -0
- package/es/GridList/utils.js +42 -0
- package/es/HightLevel/index.d.ts +9 -0
- package/es/HightLevel/index.js +18 -0
- package/es/HightLevel/index.less +3 -0
- package/es/IconFont/index.d.ts +12 -0
- package/es/IconFont/index.js +54 -0
- package/es/ImageView/index.d.ts +20 -0
- package/es/ImageView/index.js +51 -0
- package/es/ImageView/index.less +11 -0
- package/es/InstanceHistory/index.d.ts +3 -0
- package/es/InstanceHistory/index.js +7 -0
- package/es/LabelPlayer/111.png +0 -0
- package/es/LabelPlayer/demo.d.ts +2 -0
- package/es/LabelPlayer/demo.js +115 -0
- package/es/LabelPlayer/index.d.ts +21 -0
- package/es/LabelPlayer/index.js +160 -0
- package/es/LabelPlayer/index.less +24 -0
- package/es/LabelValue/index.d.ts +15 -0
- package/es/LabelValue/index.js +27 -0
- package/es/LabelValue/index.less +23 -0
- package/es/List/demo.d.ts +3 -0
- package/es/List/demo.js +23 -0
- package/es/List/index.d.ts +28 -0
- package/es/List/index.js +28 -0
- package/es/List/index.less +20 -0
- package/es/ListWithSizeAnimate/demo.d.ts +2 -0
- package/es/ListWithSizeAnimate/demo.js +98 -0
- package/es/ListWithSizeAnimate/index.d.ts +14 -0
- package/es/ListWithSizeAnimate/index.js +85 -0
- package/es/ListWithSizeAnimate/index.less +23 -0
- package/es/LoaderScript/index.d.ts +47 -0
- package/es/LoaderScript/index.js +34 -0
- package/es/LoaderScript/utils.d.ts +13 -0
- package/es/LoaderScript/utils.js +179 -0
- package/es/Map/AMap.d.ts +7109 -0
- package/es/Map/BasicMap/AMapInstance.d.ts +19 -0
- package/es/Map/BasicMap/AMapInstance.js +98 -0
- package/es/Map/BasicMap/LeafletInstance.d.ts +18 -0
- package/es/Map/BasicMap/LeafletInstance.js +111 -0
- package/es/Map/BasicMap/index.d.ts +9 -0
- package/es/Map/BasicMap/index.js +90 -0
- package/es/Map/BasicMap/index.less +29 -0
- package/es/Map/ClusterLayer/demo.d.ts +3 -0
- package/es/Map/ClusterLayer/demo.js +18 -0
- package/es/Map/ClusterLayer/hook.d.ts +5 -0
- package/es/Map/ClusterLayer/hook.js +123 -0
- package/es/Map/ClusterLayer/index.d.ts +6 -0
- package/es/Map/ClusterLayer/index.js +28 -0
- package/es/Map/ClusterLayer/index.less +29 -0
- package/es/Map/ClusterLayer/props.d.ts +8 -0
- package/es/Map/Config/index.d.ts +9 -0
- package/es/Map/Config/index.js +48 -0
- package/es/Map/Config/utils.d.ts +2 -0
- package/es/Map/Config/utils.js +65 -0
- package/es/Map/Context/index.d.ts +11 -0
- package/es/Map/Context/index.js +51 -0
- package/es/Map/FindPio/index.d.ts +4 -0
- package/es/Map/FindPio/index.js +13 -0
- package/es/Map/FindPio/index.less +7 -0
- package/es/Map/InfoWindow/MakerLikeWindow.d.ts +4 -0
- package/es/Map/InfoWindow/MakerLikeWindow.js +112 -0
- package/es/Map/InfoWindow/demo.d.ts +3 -0
- package/es/Map/InfoWindow/demo.js +70 -0
- package/es/Map/InfoWindow/index.d.ts +11 -0
- package/es/Map/InfoWindow/index.js +66 -0
- package/es/Map/LevelCenter/DragMarker/index.d.ts +10 -0
- package/es/Map/LevelCenter/DragMarker/index.js +42 -0
- package/es/Map/LevelCenter/demo.d.ts +3 -0
- package/es/Map/LevelCenter/demo.js +38 -0
- package/es/Map/LevelCenter/index.d.ts +15 -0
- package/es/Map/LevelCenter/index.js +66 -0
- package/es/Map/LoaderMap/index.d.ts +7 -0
- package/es/Map/LoaderMap/index.js +62 -0
- package/es/Map/MapDrawSelect/demo.d.ts +3 -0
- package/es/Map/MapDrawSelect/demo.js +71 -0
- package/es/Map/MapDrawSelect/index.d.ts +15 -0
- package/es/Map/MapDrawSelect/index.js +56 -0
- package/es/Map/MouseTool/index.d.ts +10 -0
- package/es/Map/MouseTool/index.js +40 -0
- package/es/Map/MouseTool/useMouseTools.d.ts +7 -0
- package/es/Map/MouseTool/useMouseTools.js +83 -0
- package/es/Map/ResetTools/index.d.ts +10 -0
- package/es/Map/ResetTools/index.js +57 -0
- package/es/Map/ResetTools/index.less +39 -0
- package/es/Map/SinglePoint/demo.d.ts +3 -0
- package/es/Map/SinglePoint/demo.js +14 -0
- package/es/Map/SinglePoint/index.d.ts +27 -0
- package/es/Map/SinglePoint/index.js +52 -0
- package/es/Map/SinglePoint/index.less +41 -0
- package/es/Map/hook/useMapEvent.d.ts +2 -0
- package/es/Map/hook/useMapEvent.js +19 -0
- package/es/Map/hook/useMapType.d.ts +4 -0
- package/es/Map/hook/useMapType.js +12 -0
- package/es/Map/icon.d.ts +2 -0
- package/es/Map/icon.js +10 -0
- package/es/Map/index.d.ts +24 -0
- package/es/Map/index.js +25 -0
- package/es/Map/interface.d.ts +74 -0
- package/es/Map/points.d.ts +50 -0
- package/es/Map/points.js +1 -0
- package/es/Map/useMarker/index.d.ts +10 -0
- package/es/Map/useMarker/index.js +71 -0
- package/es/Map/withMap/index.d.ts +3 -0
- package/es/Map/withMap/index.js +10 -0
- package/es/Picture/component/DefaultRects/RectInfo.d.ts +8 -0
- package/es/Picture/component/DefaultRects/RectInfo.js +80 -0
- package/es/Picture/component/DefaultRects/index.d.ts +13 -0
- package/es/Picture/component/DefaultRects/index.js +52 -0
- package/es/Picture/component/DefaultRects/index.less +211 -0
- package/es/Picture/component/DefaultRects/utils.d.ts +2 -0
- package/es/Picture/component/DefaultRects/utils.js +11 -0
- package/es/Picture/component/DrawRect/index.d.ts +13 -0
- package/es/Picture/component/DrawRect/index.js +46 -0
- package/es/Picture/component/DrawRect/index.less +8 -0
- package/es/Picture/component/RectMenu/index.d.ts +12 -0
- package/es/Picture/component/RectMenu/index.js +76 -0
- package/es/Picture/component/RectMenu/index.less +36 -0
- package/es/Picture/component/RectMenu/utils.d.ts +12 -0
- package/es/Picture/component/RectMenu/utils.js +19 -0
- package/es/Picture/component/Tools/index.d.ts +12 -0
- package/es/Picture/component/Tools/index.js +73 -0
- package/es/Picture/component/Tools/index.less +49 -0
- package/es/Picture/component/WheelScale/index.d.ts +7 -0
- package/es/Picture/component/WheelScale/index.js +27 -0
- package/es/Picture/demo.d.ts +2 -0
- package/es/Picture/demo.js +105 -0
- package/es/Picture/index.d.ts +5 -0
- package/es/Picture/index.js +341 -0
- package/es/Picture/index.less +20 -0
- package/es/Picture/interface.d.ts +196 -0
- package/es/Picture/loadCaptureRectImage.d.ts +3 -0
- package/es/Picture/loadCaptureRectImage.js +99 -0
- package/es/Picture/useDraw.d.ts +1 -0
- package/es/Picture/useDraw.js +103 -0
- package/es/Picture/utils.d.ts +26 -0
- package/es/Picture/utils.js +143 -0
- package/es/Player/api/index.d.ts +68 -0
- package/es/Player/api/index.js +309 -0
- package/es/Player/context.d.ts +17 -0
- package/es/Player/context.js +24 -0
- package/es/Player/contraller_bar/bar.d.ts +8 -0
- package/es/Player/contraller_bar/bar.js +20 -0
- package/es/Player/contraller_bar/contraller_event.d.ts +6 -0
- package/es/Player/contraller_bar/contraller_event.js +50 -0
- package/es/Player/contraller_bar/index.d.ts +14 -0
- package/es/Player/contraller_bar/index.js +27 -0
- package/es/Player/contraller_bar/left_bar.d.ts +10 -0
- package/es/Player/contraller_bar/left_bar.js +83 -0
- package/es/Player/contraller_bar/right_bar.d.ts +8 -0
- package/es/Player/contraller_bar/right_bar.js +32 -0
- package/es/Player/contraller_bar/time.d.ts +3 -0
- package/es/Player/contraller_bar/time.js +19 -0
- package/es/Player/contraller_bar/useBarStatus.d.ts +2 -0
- package/es/Player/contraller_bar/useBarStatus.js +43 -0
- package/es/Player/contraller_bar/volume.d.ts +9 -0
- package/es/Player/contraller_bar/volume.js +62 -0
- package/es/Player/demo.d.ts +3 -0
- package/es/Player/demo.js +266 -0
- package/es/Player/empty.d.ts +2 -0
- package/es/Player/empty.js +4 -0
- package/es/Player/event/errorEvent.d.ts +14 -0
- package/es/Player/event/errorEvent.js +88 -0
- package/es/Player/event/eventName.d.ts +18 -0
- package/es/Player/event/eventName.js +29 -0
- package/es/Player/event/index.d.ts +24 -0
- package/es/Player/event/index.js +205 -0
- package/es/Player/fps_play.d.ts +11 -0
- package/es/Player/fps_play.js +83 -0
- package/es/Player/frontend_player.d.ts +8 -0
- package/es/Player/frontend_player.js +64 -0
- package/es/Player/frontend_timeline.d.ts +10 -0
- package/es/Player/frontend_timeline.js +132 -0
- package/es/Player/iconfont.d.ts +5 -0
- package/es/Player/iconfont.js +16 -0
- package/es/Player/index.d.ts +2 -0
- package/es/Player/index.js +2 -0
- package/es/Player/live_heart.d.ts +8 -0
- package/es/Player/live_heart.js +45 -0
- package/es/Player/message.d.ts +5 -0
- package/es/Player/message.js +137 -0
- package/es/Player/player.d.ts +233 -0
- package/es/Player/segment_player.d.ts +9 -0
- package/es/Player/segment_player.js +228 -0
- package/es/Player/segment_timeline.d.ts +12 -0
- package/es/Player/segment_timeline.js +173 -0
- package/es/Player/single_player.d.ts +5 -0
- package/es/Player/single_player.js +262 -0
- package/es/Player/style/bar.less +43 -0
- package/es/Player/style/iconfont.js +43 -0
- package/es/Player/style/index.less +34 -0
- package/es/Player/style/message.less +56 -0
- package/es/Player/style/slider.less +106 -0
- package/es/Player/style/timeline.less +117 -0
- package/es/Player/style/volume.less +24 -0
- package/es/Player/timeline.d.ts +5 -0
- package/es/Player/timeline.js +95 -0
- package/es/Player/util.d.ts +43 -0
- package/es/Player/util.js +189 -0
- package/es/PlayerExt/demo.d.ts +3 -0
- package/es/PlayerExt/demo.js +154 -0
- package/es/PlayerExt/index.d.ts +48 -0
- package/es/PlayerExt/index.js +188 -0
- package/es/PlayerExt/index.less +10 -0
- package/es/Progress/index.d.ts +7 -0
- package/es/Progress/index.js +53 -0
- package/es/Progress/index.less +21 -0
- package/es/ROI/demo.d.ts +3 -0
- package/es/ROI/demo.js +16 -0
- package/es/ROI/index.d.ts +33 -0
- package/es/ROI/index.js +54 -0
- package/es/ROI/index.less +33 -0
- package/es/RefDrawer/Footer.d.ts +9 -0
- package/es/RefDrawer/Footer.js +22 -0
- package/es/RefDrawer/demo.d.ts +3 -0
- package/es/RefDrawer/demo.js +18 -0
- package/es/RefDrawer/index.d.ts +26 -0
- package/es/RefDrawer/index.js +71 -0
- package/es/RefModal/demo.d.ts +3 -0
- package/es/RefModal/demo.js +18 -0
- package/es/RefModal/index.d.ts +17 -0
- package/es/RefModal/index.js +70 -0
- package/es/ScreenPlayer/Live.d.ts +5 -0
- package/es/ScreenPlayer/Live.js +212 -0
- package/es/ScreenPlayer/LiveTools.d.ts +29 -0
- package/es/ScreenPlayer/LiveTools.js +151 -0
- package/es/ScreenPlayer/PlayerWithExt.d.ts +34 -0
- package/es/ScreenPlayer/PlayerWithExt.js +231 -0
- package/es/ScreenPlayer/RatePick.d.ts +8 -0
- package/es/ScreenPlayer/RatePick.js +29 -0
- package/es/ScreenPlayer/Record.d.ts +10 -0
- package/es/ScreenPlayer/Record.js +442 -0
- package/es/ScreenPlayer/RecordTools.d.ts +38 -0
- package/es/ScreenPlayer/RecordTools.js +197 -0
- package/es/ScreenPlayer/ScreenSelect.d.ts +7 -0
- package/es/ScreenPlayer/ScreenSelect.js +46 -0
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +17 -0
- package/es/ScreenPlayer/SegmentTimeLine.js +36 -0
- package/es/ScreenPlayer/TimeMode.d.ts +7 -0
- package/es/ScreenPlayer/TimeMode.js +26 -0
- package/es/ScreenPlayer/TimeSelect.d.ts +7 -0
- package/es/ScreenPlayer/TimeSelect.js +88 -0
- package/es/ScreenPlayer/demo.d.ts +2 -0
- package/es/ScreenPlayer/demo.js +21 -0
- package/es/ScreenPlayer/demo2.d.ts +2 -0
- package/es/ScreenPlayer/demo2.js +194 -0
- package/es/ScreenPlayer/index.d.ts +6 -0
- package/es/ScreenPlayer/index.js +9 -0
- package/es/ScreenPlayer/index.less +335 -0
- package/es/ScreenPlayer/interface.d.ts +216 -0
- package/es/ScreenPlayer/useTimeSlider.d.ts +25 -0
- package/es/ScreenPlayer/useTimeSlider.js +451 -0
- package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
- package/es/ScreenPlayer/useVideoFit.js +35 -0
- package/es/ScreenPlayer/utils.d.ts +17 -0
- package/es/ScreenPlayer/utils.js +85 -0
- package/es/SegmentPlayer/index.d.ts +2 -0
- package/es/SegmentPlayer/index.js +2 -0
- package/es/Service/http.d.ts +6 -0
- package/es/Service/http.js +133 -0
- package/es/Service/index.d.ts +3 -0
- package/es/Service/index.js +11 -0
- package/es/Service/interface.d.ts +23 -0
- package/es/Service/middleware.d.ts +8 -0
- package/es/Service/middleware.js +22 -0
- package/es/SocketEmitter/eventEmitter.d.ts +27 -0
- package/es/SocketEmitter/eventEmitter.js +88 -0
- package/es/SocketEmitter/index.d.ts +24 -0
- package/es/SocketEmitter/index.js +125 -0
- package/es/SocketEmitter/interface.d.ts +4 -0
- package/es/TableLayout/index.d.ts +10 -0
- package/es/TableLayout/index.js +27 -0
- package/es/TableLayout/index.less +4 -0
- package/es/ThemeAntd/demo.d.ts +4 -0
- package/es/ThemeAntd/demo.js +81 -0
- package/es/ThemeAntd/demo.less +20 -0
- package/es/ThemeAntd/index.d.ts +7 -0
- package/es/ThemeAntd/index.js +21 -0
- package/es/ThemeAntd/index.less +4 -0
- package/es/Timeout/index.d.ts +26 -0
- package/es/Timeout/index.js +65 -0
- package/es/bigNumberTransformCN/index.d.ts +5 -0
- package/es/bigNumberTransformCN/index.js +58 -0
- package/es/cache/index.d.ts +34 -0
- package/es/cache/index.js +94 -0
- package/es/copy/index.d.ts +1 -0
- package/es/copy/index.js +9 -0
- package/es/core.d.ts +0 -0
- package/es/getThemeStyle/index.d.ts +2 -0
- package/es/getThemeStyle/index.js +5 -0
- package/es/index.d.ts +62 -0
- package/es/index.js +62 -0
- package/es/likeGo/index.d.ts +2 -0
- package/es/likeGo/index.js +31 -0
- package/es/likeGoSync/index.d.ts +2 -0
- package/es/likeGoSync/index.js +10 -0
- package/es/logger/index.d.ts +7 -0
- package/es/logger/index.js +30 -0
- package/es/nextTick/index.d.ts +1 -0
- package/es/nextTick/index.js +3 -0
- package/es/recorder/demo.d.ts +3 -0
- package/es/recorder/demo.js +181 -0
- package/es/recorder/index.d.ts +294 -0
- package/es/recorder/index.js +992 -0
- package/es/submidstr/index.d.ts +5 -0
- package/es/submidstr/index.js +14 -0
- package/es/treeHelper/index.d.ts +11 -0
- package/es/treeHelper/index.js +188 -0
- package/es/typings.d.ts +2 -0
- package/es/useDrawROI/index.d.ts +16 -0
- package/es/useDrawROI/index.js +318 -0
- package/es/useEventEmitterHandle/index.d.ts +2 -0
- package/es/useEventEmitterHandle/index.js +17 -0
- package/es/useFullscreen/demo.d.ts +2 -0
- package/es/useFullscreen/demo.js +43 -0
- package/es/useFullscreen/index.d.ts +12 -0
- package/es/useFullscreen/index.js +76 -0
- package/es/useHistory/index.d.ts +3 -0
- package/es/useHistory/index.js +9 -0
- package/es/useHistory/interface.d.ts +3 -0
- package/es/useInfiniteScroll/index.d.ts +16 -0
- package/es/useInfiniteScroll/index.js +102 -0
- package/es/useRafInterval/index.d.ts +5 -0
- package/es/useRafInterval/index.js +71 -0
- package/es/useSimpleState/index.d.ts +3 -0
- package/es/useSimpleState/index.js +35 -0
- package/es/useVirtualList/index.d.ts +13 -0
- package/es/useVirtualList/index.js +136 -0
- package/es/utils.d.ts +14 -0
- package/es/utils.js +46 -0
- package/es/uuid/index.d.ts +5 -0
- package/es/uuid/index.js +6 -0
- package/package.json +1 -1
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AppContextInterface, AppStoreType } from './interface';
|
|
3
|
+
interface ISyncProps {
|
|
4
|
+
stateChange: (options: AppContextInterface) => void;
|
|
5
|
+
storeChange: (store: AppStoreType) => void;
|
|
6
|
+
}
|
|
7
|
+
declare function Sync({ stateChange, storeChange }: ISyncProps): React.JSX.Element;
|
|
8
|
+
export default Sync;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import SocketEmitter from "../SocketEmitter";
|
|
3
|
+
import { _LOGIN_STATUS_EVENT_CHANGE_, _OPERATION_EVENT_CHANGE_, _STORE_EVENT_CHANGE_, _USER_EVENT_CHANGE_ } from "./static";
|
|
4
|
+
function Sync(_ref) {
|
|
5
|
+
var stateChange = _ref.stateChange,
|
|
6
|
+
storeChange = _ref.storeChange;
|
|
7
|
+
/**
|
|
8
|
+
* @description 用户微应用之间的状态同步
|
|
9
|
+
*/
|
|
10
|
+
useEffect(function () {
|
|
11
|
+
var userFn = function userFn(user) {
|
|
12
|
+
return stateChange({
|
|
13
|
+
user: user
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var operationFn = function operationFn(operation) {
|
|
17
|
+
return stateChange({
|
|
18
|
+
operation: operation
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var statusFn = function statusFn(status) {
|
|
22
|
+
return stateChange({
|
|
23
|
+
loginStatus: status
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var storeFn = function storeFn(store) {
|
|
27
|
+
return storeChange(store);
|
|
28
|
+
};
|
|
29
|
+
SocketEmitter.on(_USER_EVENT_CHANGE_, userFn);
|
|
30
|
+
SocketEmitter.on(_OPERATION_EVENT_CHANGE_, operationFn);
|
|
31
|
+
SocketEmitter.on(_LOGIN_STATUS_EVENT_CHANGE_, statusFn);
|
|
32
|
+
SocketEmitter.on(_STORE_EVENT_CHANGE_, storeFn);
|
|
33
|
+
return function () {
|
|
34
|
+
SocketEmitter.off(_USER_EVENT_CHANGE_, userFn);
|
|
35
|
+
SocketEmitter.off(_OPERATION_EVENT_CHANGE_, operationFn);
|
|
36
|
+
SocketEmitter.off(_LOGIN_STATUS_EVENT_CHANGE_, statusFn);
|
|
37
|
+
SocketEmitter.off(_STORE_EVENT_CHANGE_, storeFn);
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
41
|
+
}
|
|
42
|
+
export default Sync;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AppContextInterface } from './interface';
|
|
3
|
+
declare function Provider({ children }: {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
declare const _default: {
|
|
7
|
+
Provider: typeof Provider;
|
|
8
|
+
Context: React.Context<AppContextInterface>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,141 @@
|
|
|
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
|
+
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
|
+
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
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { isEmpty } from 'lodash-es';
|
|
14
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
15
|
+
import cache from "../cache";
|
|
16
|
+
import nextTick from "../nextTick";
|
|
17
|
+
import SocketEmitter from "../SocketEmitter";
|
|
18
|
+
import { _LOGIN_STATUS_EVENT_CHANGE_, _LOGIN_STATUS_SESSION_, _OPERATION_EVENT_CHANGE_, _OPERATION_SESSION_, _STORE_EVENT_CHANGE_, _STORE_SESSION_, _USER_EVENT_CHANGE_, _USER_SESSION_ } from "./static";
|
|
19
|
+
import Sync from "./Sync";
|
|
20
|
+
var Context = /*#__PURE__*/React.createContext(null);
|
|
21
|
+
function Provider(_ref) {
|
|
22
|
+
var children = _ref.children;
|
|
23
|
+
var _useState = useState({
|
|
24
|
+
user: cache.getCache(_USER_SESSION_, 'session') || {},
|
|
25
|
+
operation: cache.getCache(_OPERATION_SESSION_, 'session') || {},
|
|
26
|
+
loginStatus: cache.getCache(_LOGIN_STATUS_SESSION_, 'session') || false,
|
|
27
|
+
store: cache.getCache(_STORE_SESSION_, 'session') || {}
|
|
28
|
+
}),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
state = _useState2[0],
|
|
31
|
+
setState = _useState2[1];
|
|
32
|
+
function updateUser() {
|
|
33
|
+
var user = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
34
|
+
var newUser = _objectSpread(_objectSpread({}, state.user), user);
|
|
35
|
+
setState(function (old) {
|
|
36
|
+
return _objectSpread(_objectSpread({}, old), {}, {
|
|
37
|
+
user: newUser
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
nextTick(function () {
|
|
41
|
+
SocketEmitter.emit(_USER_EVENT_CHANGE_, newUser);
|
|
42
|
+
cache.setCache(_USER_SESSION_, newUser, 'session');
|
|
43
|
+
console.info('AppContext updateUser is run !', user);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function updateOperation() {
|
|
47
|
+
var operation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
48
|
+
var newOperation = _objectSpread(_objectSpread({}, state.operation), operation);
|
|
49
|
+
setState(function (old) {
|
|
50
|
+
return _objectSpread(_objectSpread({}, old), {}, {
|
|
51
|
+
operation: newOperation
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
nextTick(function () {
|
|
55
|
+
SocketEmitter.emit(_OPERATION_EVENT_CHANGE_, newOperation);
|
|
56
|
+
cache.setCache(_OPERATION_SESSION_, newOperation, 'session');
|
|
57
|
+
console.info('AppContext updateOperation is run !', operation);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function updateLoginStatus(status) {
|
|
61
|
+
if (typeof status !== 'boolean') {
|
|
62
|
+
throw new Error('status type is boolean !');
|
|
63
|
+
}
|
|
64
|
+
setState(function (old) {
|
|
65
|
+
return status !== old.loginStatus ? _objectSpread(_objectSpread({}, old), {}, {
|
|
66
|
+
loginStatus: status
|
|
67
|
+
}) : old;
|
|
68
|
+
});
|
|
69
|
+
nextTick(function () {
|
|
70
|
+
SocketEmitter.emit(_LOGIN_STATUS_EVENT_CHANGE_, status);
|
|
71
|
+
cache.setCache(_LOGIN_STATUS_SESSION_, status, 'session');
|
|
72
|
+
console.info('AppContext updateLoginStatus is run !', status);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @desc 用于全局自定义状态存储,依赖sessionStorage持久化能力,不建议存储大数据量
|
|
78
|
+
* @param data
|
|
79
|
+
*/
|
|
80
|
+
function updateStore() {
|
|
81
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
82
|
+
setState(function (old) {
|
|
83
|
+
var newData = {};
|
|
84
|
+
|
|
85
|
+
//获取变更项
|
|
86
|
+
for (var _key in data) {
|
|
87
|
+
if (data[_key] !== old.store[_key]) {
|
|
88
|
+
newData[_key] = data[_key];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (isEmpty(newData)) {
|
|
92
|
+
return old;
|
|
93
|
+
}
|
|
94
|
+
var newStore = _objectSpread(_objectSpread({}, old.store), newData);
|
|
95
|
+
cache.setCache(_STORE_SESSION_, newStore, 'session');
|
|
96
|
+
return _objectSpread(_objectSpread({}, old), {}, {
|
|
97
|
+
store: newStore
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
nextTick(function () {
|
|
101
|
+
SocketEmitter.emit(_STORE_EVENT_CHANGE_, data);
|
|
102
|
+
console.info('AppContext updateStore is run !', data);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
var stateChange = useCallback(function (options) {
|
|
106
|
+
return setState(function (old) {
|
|
107
|
+
return _objectSpread(_objectSpread({}, old), options);
|
|
108
|
+
});
|
|
109
|
+
}, []);
|
|
110
|
+
var storeChange = useCallback(function (store) {
|
|
111
|
+
return setState(function (old) {
|
|
112
|
+
return _objectSpread(_objectSpread({}, old), {}, {
|
|
113
|
+
store: _objectSpread(_objectSpread({}, old.store), store)
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}, []);
|
|
117
|
+
var providerValue = useMemo(function () {
|
|
118
|
+
return {
|
|
119
|
+
user: state.user,
|
|
120
|
+
operation: state.operation,
|
|
121
|
+
loginStatus: state.loginStatus,
|
|
122
|
+
store: state.store,
|
|
123
|
+
updateUser: updateUser,
|
|
124
|
+
updateOperation: updateOperation,
|
|
125
|
+
updateLoginStatus: updateLoginStatus,
|
|
126
|
+
updateStore: updateStore
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
130
|
+
[state.user, state.operation, state.loginStatus]);
|
|
131
|
+
return /*#__PURE__*/React.createElement(Context.Provider, {
|
|
132
|
+
value: providerValue
|
|
133
|
+
}, children, /*#__PURE__*/React.createElement(Sync, {
|
|
134
|
+
stateChange: stateChange,
|
|
135
|
+
storeChange: storeChange
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
export default {
|
|
139
|
+
Provider: Provider,
|
|
140
|
+
Context: Context
|
|
141
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type UserInfoType = {
|
|
2
|
+
acceptAgreement: boolean;
|
|
3
|
+
id: string;
|
|
4
|
+
idCardNotNull: false;
|
|
5
|
+
lockTime: string;
|
|
6
|
+
loginName: string;
|
|
7
|
+
operationCenterId: string;
|
|
8
|
+
organizationId: string;
|
|
9
|
+
organizationName: string;
|
|
10
|
+
phoneNum: string;
|
|
11
|
+
realName: string;
|
|
12
|
+
roleIds: string[];
|
|
13
|
+
userAvatarUrl?: string;
|
|
14
|
+
userGrade: string;
|
|
15
|
+
userSource: string;
|
|
16
|
+
userType: string;
|
|
17
|
+
validState: string;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type OperationInfoType = {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type AppStoreType = {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export interface IProviderState {
|
|
30
|
+
user: UserInfoType;
|
|
31
|
+
operation: OperationInfoType;
|
|
32
|
+
loginStatus: boolean;
|
|
33
|
+
store: AppStoreType;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface AppContextInterface extends IProviderState {
|
|
37
|
+
updateUser: (user: UserInfoType) => void;
|
|
38
|
+
updateOperation: (user: OperationInfoType) => void;
|
|
39
|
+
updateLoginStatus: (status: boolean) => void;
|
|
40
|
+
updateStore: (data: { [key: string]: any }) => void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const _USER_EVENT_CHANGE_ = "_USER_EVENT_CHANGE_";
|
|
2
|
+
export declare const _OPERATION_EVENT_CHANGE_ = "_OPERATION_EVENT_CHANGE_";
|
|
3
|
+
export declare const _LOGIN_STATUS_EVENT_CHANGE_ = "_LOGIN_STATUS_EVENT_CHANGE_";
|
|
4
|
+
export declare const _STORE_EVENT_CHANGE_ = "_STORE_EVENT_CHANGE_";
|
|
5
|
+
export declare const _USER_SESSION_ = "_USER_SESSION_";
|
|
6
|
+
export declare const _OPERATION_SESSION_ = "_OPERATION_SESSION_";
|
|
7
|
+
export declare const _LOGIN_STATUS_SESSION_ = "_LOGIN_STATUS_SESSION_";
|
|
8
|
+
export declare const _STORE_SESSION_ = "_STORE_SESSION_";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var _USER_EVENT_CHANGE_ = '_USER_EVENT_CHANGE_'; //用户信息变化
|
|
2
|
+
export var _OPERATION_EVENT_CHANGE_ = '_OPERATION_EVENT_CHANGE_'; //应用系统信息变化
|
|
3
|
+
export var _LOGIN_STATUS_EVENT_CHANGE_ = '_LOGIN_STATUS_EVENT_CHANGE_'; //登录状态变化
|
|
4
|
+
export var _STORE_EVENT_CHANGE_ = '_STORE_EVENT_CHANGE_'; //登录状态变化
|
|
5
|
+
|
|
6
|
+
export var _USER_SESSION_ = '_USER_SESSION_'; //用户信息 缓存key
|
|
7
|
+
export var _OPERATION_SESSION_ = '_OPERATION_SESSION_'; //应用系统信息 缓存key
|
|
8
|
+
export var _LOGIN_STATUS_SESSION_ = '_LOGIN_STATUS_SESSION_'; //登录状态 缓存key
|
|
9
|
+
export var _STORE_SESSION_ = '_STORE_SESSION_'; //登录状态 缓存key
|
package/es/Auth/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import Config from "../Config";
|
|
3
|
+
function Auth(_ref) {
|
|
4
|
+
var featureId = _ref.featureId,
|
|
5
|
+
noAuthContent = _ref.noAuthContent,
|
|
6
|
+
children = _ref.children;
|
|
7
|
+
var action = useMemo(function () {
|
|
8
|
+
return !!Config.feature.find(function (v) {
|
|
9
|
+
return v === featureId;
|
|
10
|
+
});
|
|
11
|
+
}, [featureId]); //获取按钮权限
|
|
12
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !action ? noAuthContent ? noAuthContent : null : children);
|
|
13
|
+
}
|
|
14
|
+
export default Auth;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { useContext, useEffect } from 'react';
|
|
2
|
+
import AppContext from "../AppContext";
|
|
3
|
+
import nextTick from "../nextTick";
|
|
4
|
+
import useHistory from "../useHistory";
|
|
5
|
+
function AutoExit(_ref) {
|
|
6
|
+
var children = _ref.children;
|
|
7
|
+
var _useContext = useContext(AppContext.Context),
|
|
8
|
+
loginStatus = _useContext.loginStatus;
|
|
9
|
+
var history = useHistory();
|
|
10
|
+
useEffect(function () {
|
|
11
|
+
if (!loginStatus) {
|
|
12
|
+
nextTick(function () {
|
|
13
|
+
return history.replace('/login');
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}, [loginStatus]);
|
|
17
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, loginStatus ? children : null);
|
|
18
|
+
}
|
|
19
|
+
export default AutoExit;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ConfigProvider } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import CheckGroupFixed from "./index";
|
|
4
|
+
var defaultSource = Array.from(new Array(100)).map(function (_, i) {
|
|
5
|
+
return {
|
|
6
|
+
label: "\u9009\u9879".concat(i),
|
|
7
|
+
value: i
|
|
8
|
+
};
|
|
9
|
+
});
|
|
10
|
+
var App = function App() {
|
|
11
|
+
return /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
12
|
+
prefixCls: "cloudapp"
|
|
13
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
style: {
|
|
15
|
+
width: '100%'
|
|
16
|
+
}
|
|
17
|
+
}, /*#__PURE__*/React.createElement(CheckGroupFixed, {
|
|
18
|
+
label: "\u6807\u9898",
|
|
19
|
+
source: defaultSource
|
|
20
|
+
})));
|
|
21
|
+
};
|
|
22
|
+
export default App;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export interface SourceDictType {
|
|
4
|
+
value?: string | number;
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
}
|
|
8
|
+
interface ICheckGroupFixedProps {
|
|
9
|
+
/**
|
|
10
|
+
* label
|
|
11
|
+
*/
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* 字典
|
|
15
|
+
*/
|
|
16
|
+
source: SourceDictType[];
|
|
17
|
+
onChange?: (keys: string[] & number[] & boolean[]) => void;
|
|
18
|
+
checboxSize?: number;
|
|
19
|
+
labelSize?: number;
|
|
20
|
+
cutRow?: number;
|
|
21
|
+
value?: string[] & number[] & boolean[];
|
|
22
|
+
}
|
|
23
|
+
declare function CheckGroupFixed({ label, source, checboxSize, cutRow, labelSize, value, onChange }: ICheckGroupFixedProps): React.JSX.Element;
|
|
24
|
+
export default CheckGroupFixed;
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
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
|
+
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
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { useUpdateEffect } from 'ahooks';
|
|
14
|
+
import { Badge, Checkbox } from 'antd';
|
|
15
|
+
import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
16
|
+
import "./index.less";
|
|
17
|
+
function CheckGroupFixed(_ref) {
|
|
18
|
+
var label = _ref.label,
|
|
19
|
+
_ref$source = _ref.source,
|
|
20
|
+
source = _ref$source === void 0 ? [] : _ref$source,
|
|
21
|
+
_ref$checboxSize = _ref.checboxSize,
|
|
22
|
+
checboxSize = _ref$checboxSize === void 0 ? 120 : _ref$checboxSize,
|
|
23
|
+
_ref$cutRow = _ref.cutRow,
|
|
24
|
+
cutRow = _ref$cutRow === void 0 ? 1 : _ref$cutRow,
|
|
25
|
+
_ref$labelSize = _ref.labelSize,
|
|
26
|
+
labelSize = _ref$labelSize === void 0 ? 100 : _ref$labelSize,
|
|
27
|
+
value = _ref.value,
|
|
28
|
+
onChange = _ref.onChange;
|
|
29
|
+
var _useState = useState({
|
|
30
|
+
visible: false,
|
|
31
|
+
sider: false,
|
|
32
|
+
pos: [0, 0],
|
|
33
|
+
w: 0,
|
|
34
|
+
selectKeys: value || []
|
|
35
|
+
}),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
state = _useState2[0],
|
|
38
|
+
setState = _useState2[1];
|
|
39
|
+
var domRef = useRef(null);
|
|
40
|
+
useLayoutEffect(function () {
|
|
41
|
+
var _domRef$current;
|
|
42
|
+
var contentEle = (_domRef$current = domRef.current) === null || _domRef$current === void 0 ? void 0 : _domRef$current.querySelector('.check-content-box');
|
|
43
|
+
var contentRect = (contentEle === null || contentEle === void 0 ? void 0 : contentEle.getBoundingClientRect()) || {
|
|
44
|
+
width: 0
|
|
45
|
+
};
|
|
46
|
+
if (contentRect.width < checboxSize * source.length) {
|
|
47
|
+
var _domRef$current2;
|
|
48
|
+
var lr = (_domRef$current2 = domRef.current) === null || _domRef$current2 === void 0 ? void 0 : _domRef$current2.getBoundingClientRect();
|
|
49
|
+
setState(function (old) {
|
|
50
|
+
return _objectSpread(_objectSpread({}, old), {}, {
|
|
51
|
+
visible: true,
|
|
52
|
+
w: (lr === null || lr === void 0 ? void 0 : lr.width) || 0
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}, [checboxSize, source.length, state.visible]);
|
|
57
|
+
var fixedStyle = useMemo(function () {
|
|
58
|
+
return state.sider ? {
|
|
59
|
+
position: 'absolute',
|
|
60
|
+
width: state.w,
|
|
61
|
+
height: 'auto',
|
|
62
|
+
left: state.pos[0],
|
|
63
|
+
top: state.pos[1],
|
|
64
|
+
backgroundColor: 'white',
|
|
65
|
+
zIndex: 99,
|
|
66
|
+
boxShadow: ' 0 0 10px rgba(0,0,0,0.1)'
|
|
67
|
+
} : {};
|
|
68
|
+
}, [state.sider, state.w, state.pos]);
|
|
69
|
+
useUpdateEffect(function () {
|
|
70
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(state.selectKeys);
|
|
71
|
+
}, [state.selectKeys]);
|
|
72
|
+
useLayoutEffect(function () {
|
|
73
|
+
var _domRef$current3;
|
|
74
|
+
var dom = (_domRef$current3 = domRef.current) === null || _domRef$current3 === void 0 ? void 0 : _domRef$current3.querySelector('.check-box-group-layout');
|
|
75
|
+
dom === null || dom === void 0 || dom.setAttribute('style', "grid-template-columns:repeat(auto-fill, minmax(".concat(checboxSize, "px, 1fr));"));
|
|
76
|
+
}, [checboxSize]);
|
|
77
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: "c-check-group-layout",
|
|
79
|
+
ref: domRef,
|
|
80
|
+
style: {
|
|
81
|
+
height: state.sider ? cutRow * 30 + 20 : 'auto'
|
|
82
|
+
}
|
|
83
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: "c-check-group-box",
|
|
85
|
+
style: fixedStyle
|
|
86
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
87
|
+
className: "check-label-box",
|
|
88
|
+
style: {
|
|
89
|
+
width: labelSize
|
|
90
|
+
}
|
|
91
|
+
}, label, "\uFF1A"), /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "check-content-box",
|
|
93
|
+
style: {
|
|
94
|
+
height: state.sider ? 'auto' : cutRow * 30
|
|
95
|
+
}
|
|
96
|
+
}, /*#__PURE__*/React.createElement(Checkbox.Group, {
|
|
97
|
+
value: state.selectKeys,
|
|
98
|
+
className: "check-box-group-layout",
|
|
99
|
+
onChange: function onChange(keys) {
|
|
100
|
+
return setState(function (old) {
|
|
101
|
+
return _objectSpread(_objectSpread({}, old), {}, {
|
|
102
|
+
selectKeys: keys
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}, source.map(function (v) {
|
|
107
|
+
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
108
|
+
style: {
|
|
109
|
+
width: checboxSize
|
|
110
|
+
},
|
|
111
|
+
key: v.value,
|
|
112
|
+
value: v.value
|
|
113
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
114
|
+
title: v.label
|
|
115
|
+
}, v.label));
|
|
116
|
+
}))), state.visible && /*#__PURE__*/React.createElement(Badge, {
|
|
117
|
+
count: state.sider ? 0 : state.selectKeys.length,
|
|
118
|
+
size: "small",
|
|
119
|
+
offset: [10, 0]
|
|
120
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
121
|
+
className: "slice-btn",
|
|
122
|
+
onClick: function onClick() {
|
|
123
|
+
return setState(function (old) {
|
|
124
|
+
return _objectSpread(_objectSpread({}, old), {}, {
|
|
125
|
+
sider: !state.sider
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}, state.sider ? '收起' : '展开'))), state.sider && /*#__PURE__*/React.createElement("div", {
|
|
130
|
+
className: "sider-mask",
|
|
131
|
+
onClick: function onClick() {
|
|
132
|
+
return setState(function (old) {
|
|
133
|
+
return _objectSpread(_objectSpread({}, old), {}, {
|
|
134
|
+
sider: false
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
export default CheckGroupFixed;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.c-check-group-layout {
|
|
2
|
+
position: relative;
|
|
3
|
+
|
|
4
|
+
.c-check-group-box {
|
|
5
|
+
display: flex;
|
|
6
|
+
padding: 10px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.check-label-box {
|
|
10
|
+
width: 80px;
|
|
11
|
+
line-height: 30px;
|
|
12
|
+
color: #999;
|
|
13
|
+
text-align: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.check-content-box {
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 30px;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
flex: 1;
|
|
21
|
+
.@{ant-prefix}-checkbox-group {
|
|
22
|
+
display: grid;
|
|
23
|
+
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
24
|
+
grid-gap: 10px;
|
|
25
|
+
.@{ant-prefix}-checkbox-wrapper {
|
|
26
|
+
display: flex;
|
|
27
|
+
width: 120px;
|
|
28
|
+
height: 30px;
|
|
29
|
+
margin-left: 0;
|
|
30
|
+
align-items: center;
|
|
31
|
+
> span:not(.@{ant-prefix}-checkbox) {
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
text-overflow: ellipsis;
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
flex: 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.sider-mask {
|
|
42
|
+
position: fixed;
|
|
43
|
+
top: 0;
|
|
44
|
+
left: 0;
|
|
45
|
+
z-index: 98;
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.slice-btn {
|
|
51
|
+
position: relative;
|
|
52
|
+
top: 4px;
|
|
53
|
+
color: var(--primary);
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { produce } from 'immer';
|
|
2
|
+
import { insertThemeStyle, lock } from "./utils";
|
|
3
|
+
var Config = {
|
|
4
|
+
app: produce({}, function () {}),
|
|
5
|
+
bs: produce({}, function () {}),
|
|
6
|
+
features: produce([], function () {}),
|
|
7
|
+
featureIds: produce([], function () {}),
|
|
8
|
+
theme: produce({}, function () {}),
|
|
9
|
+
registerAppConfig: function registerAppConfig() {
|
|
10
|
+
var app = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
11
|
+
Config.app = produce(Config.app, function (draft) {
|
|
12
|
+
app.forEach(function (item) {
|
|
13
|
+
draft[item.routerPrefix] = item;
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
registerFeatrueIds: function registerFeatrueIds() {
|
|
18
|
+
var featureIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
19
|
+
Config.featureIds = produce(Config.featureIds, function (draft) {
|
|
20
|
+
featureIds.forEach(function (id) {
|
|
21
|
+
var index = draft.findIndex(function (v) {
|
|
22
|
+
return v === id;
|
|
23
|
+
});
|
|
24
|
+
if (index === -1) {
|
|
25
|
+
draft.push(id);
|
|
26
|
+
} else {
|
|
27
|
+
draft[index] = id;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
registerBSConfig: function registerBSConfig() {
|
|
33
|
+
var bs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
34
|
+
Config.bs = produce(Config.bs, function (draft) {
|
|
35
|
+
Object.keys(bs).forEach(function (key) {
|
|
36
|
+
draft[key] = bs[key];
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
registerPlatformFeature: function registerPlatformFeature() {
|
|
41
|
+
var features = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
42
|
+
Config.features = produce(Config.features, function (draft) {
|
|
43
|
+
features.forEach(function (item) {
|
|
44
|
+
var index = draft.findIndex(function (v) {
|
|
45
|
+
return v.id === item.id;
|
|
46
|
+
});
|
|
47
|
+
if (index === -1) {
|
|
48
|
+
draft.push(item);
|
|
49
|
+
} else {
|
|
50
|
+
draft[index] = item;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
registerThemeConfig: function registerThemeConfig() {
|
|
56
|
+
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
|
+
insertThemeStyle(theme);
|
|
58
|
+
Config.theme = produce(Config.theme, function (draft) {
|
|
59
|
+
for (var _key in theme) {
|
|
60
|
+
if (theme[_key]) {
|
|
61
|
+
draft[_key] = theme[_key];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var LMConfig = function () {
|
|
68
|
+
var _global = window;
|
|
69
|
+
if (_global['_CONFIG_']) {
|
|
70
|
+
return _global['_CONFIG_'];
|
|
71
|
+
} else {
|
|
72
|
+
_global['_CONFIG_'] = Config;
|
|
73
|
+
lock();
|
|
74
|
+
return Config;
|
|
75
|
+
}
|
|
76
|
+
}();
|
|
77
|
+
export default LMConfig;
|