@cloud-app-dev/vidc 4.0.17 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/.dumirc.ts +1 -1
  2. package/.eslintrc.js +3 -0
  3. package/.fatherrc.ts +0 -6
  4. package/es/AppContext/Sync.d.ts +7 -0
  5. package/es/AppContext/Sync.js +44 -0
  6. package/es/AppContext/index.d.ts +17 -0
  7. package/es/AppContext/index.js +154 -0
  8. package/es/AppContext/interface.d.ts +42 -0
  9. package/es/AppContext/static.d.ts +8 -0
  10. package/es/AppContext/static.js +9 -0
  11. package/es/CheckGroupFixed/demo.d.ts +2 -0
  12. package/es/CheckGroupFixed/demo.js +20 -0
  13. package/es/CheckGroupFixed/index.d.ts +22 -0
  14. package/es/CheckGroupFixed/index.js +150 -0
  15. package/es/CheckGroupFixed/style.d.ts +6 -0
  16. package/es/CheckGroupFixed/style.js +9 -0
  17. package/es/Config/index.d.ts +4 -0
  18. package/es/Config/index.js +77 -0
  19. package/es/Config/interface.d.ts +65 -0
  20. package/es/Config/utils.d.ts +4 -0
  21. package/es/Config/utils.js +33 -0
  22. package/es/CustomRenderSelect/index.d.ts +13 -0
  23. package/es/CustomRenderSelect/index.js +86 -0
  24. package/es/DBTools/index.d.ts +25 -0
  25. package/es/DBTools/index.js +336 -0
  26. package/es/DisableMark/index.d.ts +8 -0
  27. package/es/DisableMark/index.js +25 -0
  28. package/es/DomMove/demo.d.ts +1 -0
  29. package/es/DomMove/demo.js +19 -0
  30. package/es/DomMove/index.d.ts +16 -0
  31. package/es/DomMove/index.js +148 -0
  32. package/es/DomMove/utils.d.ts +8 -0
  33. package/es/DomMove/utils.js +33 -0
  34. package/es/Drag/DragAndDropItem.d.ts +4 -0
  35. package/es/Drag/DragAndDropItem.js +133 -0
  36. package/es/Drag/DropItem.d.ts +4 -0
  37. package/es/Drag/DropItem.js +50 -0
  38. package/es/Drag/index.d.ts +7 -0
  39. package/es/Drag/index.js +7 -0
  40. package/es/Drag/interface.d.ts +16 -0
  41. package/es/DynamicGridList/demo.d.ts +2 -0
  42. package/es/DynamicGridList/demo.js +86 -0
  43. package/es/DynamicGridList/index.d.ts +27 -0
  44. package/es/DynamicGridList/index.js +71 -0
  45. package/es/DynamicList/demo.d.ts +1 -0
  46. package/es/DynamicList/demo.js +45 -0
  47. package/es/DynamicList/index.d.ts +30 -0
  48. package/es/DynamicList/index.js +98 -0
  49. package/es/DynamicList/interface.d.ts +19 -0
  50. package/es/DynamicList/utils.d.ts +4 -0
  51. package/es/DynamicList/utils.js +6 -0
  52. package/es/ErrorFallback/index.d.ts +8 -0
  53. package/es/ErrorFallback/index.js +38 -0
  54. package/es/ErrorFallback/inerface.d.ts +48 -0
  55. package/es/EventTools/index.d.ts +3 -0
  56. package/es/EventTools/index.js +12 -0
  57. package/es/FrontendPlayer/index.d.ts +4 -0
  58. package/es/FrontendPlayer/index.js +2 -0
  59. package/es/GridList/data.d.ts +16 -0
  60. package/es/GridList/data.js +609 -0
  61. package/es/GridList/demo.d.ts +2 -0
  62. package/es/GridList/demo.js +89 -0
  63. package/es/GridList/hook.d.ts +13 -0
  64. package/es/GridList/hook.js +270 -0
  65. package/es/GridList/index.d.ts +14 -0
  66. package/es/GridList/index.js +51 -0
  67. package/es/GridList/interface.d.ts +59 -0
  68. package/es/GridList/utils.d.ts +9 -0
  69. package/es/GridList/utils.js +42 -0
  70. package/es/HightLevel/index.d.ts +8 -0
  71. package/es/HightLevel/index.js +20 -0
  72. package/es/IconFont/index.d.ts +12 -0
  73. package/es/IconFont/index.js +63 -0
  74. package/es/InstanceHistory/index.d.ts +3 -0
  75. package/es/InstanceHistory/index.js +7 -0
  76. package/es/LabelValue/index.d.ts +14 -0
  77. package/es/LabelValue/index.js +35 -0
  78. package/es/List/demo.d.ts +2 -0
  79. package/es/List/demo.js +25 -0
  80. package/es/List/index.d.ts +27 -0
  81. package/es/List/index.js +38 -0
  82. package/es/ListWithSizeAnimate/demo.d.ts +1 -0
  83. package/es/ListWithSizeAnimate/demo.js +128 -0
  84. package/es/ListWithSizeAnimate/index.d.ts +13 -0
  85. package/es/ListWithSizeAnimate/index.js +106 -0
  86. package/es/LoaderScript/index.d.ts +47 -0
  87. package/es/LoaderScript/index.js +38 -0
  88. package/es/LoaderScript/utils.d.ts +13 -0
  89. package/es/LoaderScript/utils.js +179 -0
  90. package/es/Picture/component/DefaultRects/RectInfo.d.ts +7 -0
  91. package/es/Picture/component/DefaultRects/RectInfo.js +90 -0
  92. package/es/Picture/component/DefaultRects/index.d.ts +11 -0
  93. package/es/Picture/component/DefaultRects/index.js +58 -0
  94. package/es/Picture/component/DefaultRects/style.d.ts +10 -0
  95. package/es/Picture/component/DefaultRects/style.js +28 -0
  96. package/es/Picture/component/DefaultRects/utils.d.ts +2 -0
  97. package/es/Picture/component/DefaultRects/utils.js +11 -0
  98. package/es/Picture/component/DrawRect/index.d.ts +11 -0
  99. package/es/Picture/component/DrawRect/index.js +54 -0
  100. package/es/Picture/component/RectMenu/index.d.ts +10 -0
  101. package/es/Picture/component/RectMenu/index.js +84 -0
  102. package/es/Picture/component/RectMenu/utils.d.ts +12 -0
  103. package/es/Picture/component/RectMenu/utils.js +19 -0
  104. package/es/Picture/component/Tools/index.d.ts +11 -0
  105. package/es/Picture/component/Tools/index.js +105 -0
  106. package/es/Picture/component/Tools/style.d.ts +2 -0
  107. package/es/Picture/component/Tools/style.js +5 -0
  108. package/es/Picture/component/WheelScale/index.d.ts +6 -0
  109. package/es/Picture/component/WheelScale/index.js +29 -0
  110. package/es/Picture/demo.d.ts +1 -0
  111. package/es/Picture/demo.js +114 -0
  112. package/es/Picture/index.d.ts +17 -0
  113. package/es/Picture/index.js +356 -0
  114. package/es/Picture/interface.d.ts +196 -0
  115. package/es/Picture/loadCaptureRectImage.d.ts +3 -0
  116. package/es/Picture/loadCaptureRectImage.js +99 -0
  117. package/es/Picture/useDraw.d.ts +1 -0
  118. package/es/Picture/useDraw.js +103 -0
  119. package/es/Picture/utils.d.ts +26 -0
  120. package/es/Picture/utils.js +143 -0
  121. package/es/Player/api/index.d.ts +68 -0
  122. package/es/Player/api/index.js +309 -0
  123. package/es/Player/context.d.ts +21 -0
  124. package/es/Player/context.js +25 -0
  125. package/es/Player/contraller_bar/bar.d.ts +8 -0
  126. package/es/Player/contraller_bar/bar.js +32 -0
  127. package/es/Player/contraller_bar/contraller_event.d.ts +6 -0
  128. package/es/Player/contraller_bar/contraller_event.js +52 -0
  129. package/es/Player/contraller_bar/index.d.ts +13 -0
  130. package/es/Player/contraller_bar/index.js +39 -0
  131. package/es/Player/contraller_bar/left_bar.d.ts +10 -0
  132. package/es/Player/contraller_bar/left_bar.js +97 -0
  133. package/es/Player/contraller_bar/right_bar.d.ts +8 -0
  134. package/es/Player/contraller_bar/right_bar.js +36 -0
  135. package/es/Player/contraller_bar/time.d.ts +2 -0
  136. package/es/Player/contraller_bar/time.js +24 -0
  137. package/es/Player/contraller_bar/useBarStatus.d.ts +2 -0
  138. package/es/Player/contraller_bar/useBarStatus.js +43 -0
  139. package/es/Player/contraller_bar/volume.d.ts +8 -0
  140. package/es/Player/contraller_bar/volume.js +70 -0
  141. package/es/Player/demo.d.ts +2 -0
  142. package/es/Player/demo.js +289 -0
  143. package/es/Player/empty.d.ts +1 -0
  144. package/es/Player/empty.js +5 -0
  145. package/es/Player/event/errorEvent.d.ts +14 -0
  146. package/es/Player/event/errorEvent.js +88 -0
  147. package/es/Player/event/eventName.d.ts +18 -0
  148. package/es/Player/event/eventName.js +30 -0
  149. package/es/Player/event/index.d.ts +24 -0
  150. package/es/Player/event/index.js +205 -0
  151. package/es/Player/fps_play.d.ts +10 -0
  152. package/es/Player/fps_play.js +88 -0
  153. package/es/Player/frontend_player.d.ts +7 -0
  154. package/es/Player/frontend_player.js +71 -0
  155. package/es/Player/frontend_timeline.d.ts +8 -0
  156. package/es/Player/frontend_timeline.js +153 -0
  157. package/es/Player/iconfont.d.ts +4 -0
  158. package/es/Player/iconfont.js +21 -0
  159. package/es/Player/index.d.ts +2 -0
  160. package/es/Player/index.js +2 -0
  161. package/es/Player/live_heart.d.ts +8 -0
  162. package/es/Player/live_heart.js +45 -0
  163. package/es/Player/message.d.ts +3 -0
  164. package/es/Player/message.js +147 -0
  165. package/es/Player/player.d.ts +233 -0
  166. package/es/Player/segment_player.d.ts +8 -0
  167. package/es/Player/segment_player.js +229 -0
  168. package/es/Player/segment_timeline.d.ts +10 -0
  169. package/es/Player/segment_timeline.js +200 -0
  170. package/es/Player/single_player.d.ts +4 -0
  171. package/es/Player/single_player.js +278 -0
  172. package/es/Player/style/iconfont.js +43 -0
  173. package/es/Player/timeline.d.ts +7 -0
  174. package/es/Player/timeline.js +104 -0
  175. package/es/Player/util.d.ts +43 -0
  176. package/es/Player/util.js +189 -0
  177. package/es/PlayerExt/demo.d.ts +2 -0
  178. package/es/PlayerExt/demo.js +170 -0
  179. package/es/PlayerExt/index.d.ts +47 -0
  180. package/es/PlayerExt/index.js +212 -0
  181. package/es/Progress/index.d.ts +10 -0
  182. package/es/Progress/index.js +60 -0
  183. package/es/ROI/demo.d.ts +2 -0
  184. package/es/ROI/demo.js +17 -0
  185. package/es/ROI/index.d.ts +32 -0
  186. package/es/ROI/index.js +67 -0
  187. package/es/RefDrawer/Footer.d.ts +9 -0
  188. package/es/RefDrawer/Footer.js +27 -0
  189. package/es/RefDrawer/demo.d.ts +3 -0
  190. package/es/RefDrawer/demo.js +32 -0
  191. package/es/RefDrawer/index.d.ts +26 -0
  192. package/es/RefDrawer/index.js +73 -0
  193. package/es/RefModal/demo.d.ts +2 -0
  194. package/es/RefModal/demo.js +32 -0
  195. package/es/RefModal/index.d.ts +17 -0
  196. package/es/RefModal/index.js +71 -0
  197. package/es/ScreenPlayer/Live.d.ts +8 -0
  198. package/es/ScreenPlayer/Live.js +219 -0
  199. package/es/ScreenPlayer/LiveTools.d.ts +33 -0
  200. package/es/ScreenPlayer/LiveTools.js +172 -0
  201. package/es/ScreenPlayer/PlayerWithExt.d.ts +34 -0
  202. package/es/ScreenPlayer/PlayerWithExt.js +241 -0
  203. package/es/ScreenPlayer/RatePick.d.ts +7 -0
  204. package/es/ScreenPlayer/RatePick.js +35 -0
  205. package/es/ScreenPlayer/Record.d.ts +8 -0
  206. package/es/ScreenPlayer/Record.js +452 -0
  207. package/es/ScreenPlayer/RecordTools.d.ts +38 -0
  208. package/es/ScreenPlayer/RecordTools.js +214 -0
  209. package/es/ScreenPlayer/ScreenSelect.d.ts +6 -0
  210. package/es/ScreenPlayer/ScreenSelect.js +59 -0
  211. package/es/ScreenPlayer/SegmentTimeLine.d.ts +16 -0
  212. package/es/ScreenPlayer/SegmentTimeLine.js +44 -0
  213. package/es/ScreenPlayer/TimeMode.d.ts +6 -0
  214. package/es/ScreenPlayer/TimeMode.js +34 -0
  215. package/es/ScreenPlayer/TimeSelect.d.ts +6 -0
  216. package/es/ScreenPlayer/TimeSelect.js +99 -0
  217. package/es/ScreenPlayer/containerStyle.d.ts +13 -0
  218. package/es/ScreenPlayer/containerStyle.js +32 -0
  219. package/es/ScreenPlayer/demo.d.ts +1 -0
  220. package/es/ScreenPlayer/demo.js +19 -0
  221. package/es/ScreenPlayer/demo2.d.ts +1 -0
  222. package/es/ScreenPlayer/demo2.js +196 -0
  223. package/es/ScreenPlayer/index.d.ts +6 -0
  224. package/es/ScreenPlayer/index.js +9 -0
  225. package/es/ScreenPlayer/interface.d.ts +216 -0
  226. package/es/ScreenPlayer/useTimeSlider.d.ts +25 -0
  227. package/es/ScreenPlayer/useTimeSlider.js +451 -0
  228. package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
  229. package/es/ScreenPlayer/useVideoFit.js +35 -0
  230. package/es/ScreenPlayer/utils.d.ts +17 -0
  231. package/es/ScreenPlayer/utils.js +85 -0
  232. package/es/SegmentPlayer/index.d.ts +2 -0
  233. package/es/SegmentPlayer/index.js +2 -0
  234. package/es/Service/http.d.ts +6 -0
  235. package/es/Service/http.js +125 -0
  236. package/es/Service/index.d.ts +3 -0
  237. package/es/Service/index.js +10 -0
  238. package/es/Service/interface.d.ts +22 -0
  239. package/es/Service/middleware.d.ts +5 -0
  240. package/es/Service/middleware.js +15 -0
  241. package/es/SocketEmitter/eventEmitter.d.ts +27 -0
  242. package/es/SocketEmitter/eventEmitter.js +88 -0
  243. package/es/SocketEmitter/index.d.ts +24 -0
  244. package/es/SocketEmitter/index.js +125 -0
  245. package/es/SocketEmitter/interface.d.ts +4 -0
  246. package/es/TableLayout/index.d.ts +9 -0
  247. package/es/TableLayout/index.js +32 -0
  248. package/es/Timeout/index.d.ts +31 -0
  249. package/es/Timeout/index.js +69 -0
  250. package/es/cache/index.d.ts +34 -0
  251. package/es/cache/index.js +94 -0
  252. package/es/copy/index.d.ts +1 -0
  253. package/es/copy/index.js +9 -0
  254. package/es/core.d.ts +0 -0
  255. package/es/getThemeStyle/index.d.ts +2 -0
  256. package/es/getThemeStyle/index.js +5 -0
  257. package/es/index.d.ts +52 -0
  258. package/es/index.js +52 -0
  259. package/es/likeGo/index.d.ts +2 -0
  260. package/es/likeGo/index.js +31 -0
  261. package/es/likeGoSync/index.d.ts +2 -0
  262. package/es/likeGoSync/index.js +10 -0
  263. package/es/logger/index.d.ts +7 -0
  264. package/es/logger/index.js +30 -0
  265. package/es/nextTick/index.d.ts +1 -0
  266. package/es/nextTick/index.js +3 -0
  267. package/es/recorder/demo.d.ts +2 -0
  268. package/es/recorder/demo.js +200 -0
  269. package/es/recorder/index.d.ts +294 -0
  270. package/es/recorder/index.js +991 -0
  271. package/es/submidstr/index.d.ts +5 -0
  272. package/es/submidstr/index.js +14 -0
  273. package/es/treeHelper/index.d.ts +11 -0
  274. package/es/treeHelper/index.js +189 -0
  275. package/es/typings.d.ts +2 -0
  276. package/es/useDrawROI/index.d.ts +16 -0
  277. package/es/useDrawROI/index.js +318 -0
  278. package/es/useEventEmitterHandle/index.d.ts +2 -0
  279. package/es/useEventEmitterHandle/index.js +17 -0
  280. package/es/useHistory/index.d.ts +3 -0
  281. package/es/useHistory/index.js +9 -0
  282. package/es/useHistory/interface.d.ts +3 -0
  283. package/es/useInfiniteScroll/index.d.ts +16 -0
  284. package/es/useInfiniteScroll/index.js +102 -0
  285. package/es/useRafInterval/index.d.ts +5 -0
  286. package/es/useRafInterval/index.js +70 -0
  287. package/es/useSimpleState/index.d.ts +3 -0
  288. package/es/useSimpleState/index.js +35 -0
  289. package/es/useVirtualList/index.d.ts +13 -0
  290. package/es/useVirtualList/index.js +136 -0
  291. package/es/utils.d.ts +14 -0
  292. package/es/utils.js +46 -0
  293. package/es/uuid/index.d.ts +5 -0
  294. package/es/uuid/index.js +6 -0
  295. package/package.json +16 -21
  296. package/release-build.sh +2 -0
  297. package/scripts/{entry.js → entry.mjs} +4 -6
  298. package/{icon-fix.js → scripts/icon-fix.mjs} +4 -3
  299. package/tsconfig.json +1 -1
package/.dumirc.ts CHANGED
@@ -47,7 +47,7 @@ export default defineConfig({
47
47
  changeOrigin: true,
48
48
  },
49
49
  },
50
- scripts: ['//at.alicdn.com/t/font_1724012_972m5d05cou.js'],
50
+ scripts: [],
51
51
  styles: [themeConfig],
52
52
 
53
53
  // more config: https://d.umijs.org/config
package/.eslintrc.js CHANGED
@@ -1,3 +1,6 @@
1
1
  module.exports = {
2
2
  extends: require.resolve('@umijs/lint/dist/config/eslint'),
3
+ rules: {
4
+ 'react/no-unknown-property': ['error', { ignore: ['css'] }],
5
+ },
3
6
  };
package/.fatherrc.ts CHANGED
@@ -1,11 +1,5 @@
1
1
  import { defineConfig } from 'father';
2
2
 
3
- const importProps = {
4
- style: false,
5
- camel2DashComponentName: false,
6
- libraryDirectory: 'es',
7
- };
8
-
9
3
  export default defineConfig({
10
4
  platform: 'browser',
11
5
  esm: {
@@ -0,0 +1,7 @@
1
+ import { AppContextInterface, AppStoreType } from './interface';
2
+ interface ISyncProps {
3
+ stateChange: (options: AppContextInterface) => void;
4
+ storeChange: (store: AppStoreType) => void;
5
+ }
6
+ declare function Sync({ stateChange, storeChange }: ISyncProps): import("react/jsx-runtime").JSX.Element;
7
+ export default Sync;
@@ -0,0 +1,44 @@
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
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ function Sync(_ref) {
7
+ var stateChange = _ref.stateChange,
8
+ storeChange = _ref.storeChange;
9
+ /**
10
+ * @description 用户微应用之间的状态同步
11
+ */
12
+ useEffect(function () {
13
+ var userFn = function userFn(user) {
14
+ return stateChange({
15
+ user: user
16
+ });
17
+ };
18
+ var operationFn = function operationFn(operation) {
19
+ return stateChange({
20
+ operation: operation
21
+ });
22
+ };
23
+ var statusFn = function statusFn(status) {
24
+ return stateChange({
25
+ loginStatus: status
26
+ });
27
+ };
28
+ var storeFn = function storeFn(store) {
29
+ return storeChange(store);
30
+ };
31
+ SocketEmitter.on(_USER_EVENT_CHANGE_, userFn);
32
+ SocketEmitter.on(_OPERATION_EVENT_CHANGE_, operationFn);
33
+ SocketEmitter.on(_LOGIN_STATUS_EVENT_CHANGE_, statusFn);
34
+ SocketEmitter.on(_STORE_EVENT_CHANGE_, storeFn);
35
+ return function () {
36
+ SocketEmitter.off(_USER_EVENT_CHANGE_, userFn);
37
+ SocketEmitter.off(_OPERATION_EVENT_CHANGE_, operationFn);
38
+ SocketEmitter.off(_LOGIN_STATUS_EVENT_CHANGE_, statusFn);
39
+ SocketEmitter.off(_STORE_EVENT_CHANGE_, storeFn);
40
+ };
41
+ }, []);
42
+ return /*#__PURE__*/_jsx(_Fragment, {});
43
+ }
44
+ export default Sync;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { AppContextInterface } from './interface';
3
+ interface IProviderProps {
4
+ getContainer: () => HTMLElement;
5
+ children: React.ReactNode;
6
+ }
7
+ declare function Provider({ getContainer, children }: IProviderProps): import("react/jsx-runtime").JSX.Element;
8
+ declare namespace Provider {
9
+ var defaultProps: {
10
+ getContainer: () => HTMLElement;
11
+ };
12
+ }
13
+ declare const _default: {
14
+ Provider: typeof Provider;
15
+ Context: React.Context<AppContextInterface>;
16
+ };
17
+ export default _default;
@@ -0,0 +1,154 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
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 SocketEmitter from "../SocketEmitter";
16
+ import cache from "../cache";
17
+ import nextTick from "../nextTick";
18
+ import Sync from "./Sync";
19
+ 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";
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
+ import { jsxs as _jsxs } from "react/jsx-runtime";
22
+ var Context = /*#__PURE__*/React.createContext(null);
23
+ function Provider(_ref) {
24
+ var getContainer = _ref.getContainer,
25
+ children = _ref.children;
26
+ var _useState = useState({
27
+ user: cache.getCache(_USER_SESSION_, 'session') || {},
28
+ operation: cache.getCache(_OPERATION_SESSION_, 'session') || {},
29
+ loginStatus: cache.getCache(_LOGIN_STATUS_SESSION_, 'session') || false,
30
+ store: cache.getCache(_STORE_SESSION_, 'session') || {}
31
+ }),
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ state = _useState2[0],
34
+ setState = _useState2[1];
35
+ function updateUser() {
36
+ var user = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
37
+ var newUser = _objectSpread(_objectSpread({}, state.user), user);
38
+ setState(function (old) {
39
+ return _objectSpread(_objectSpread({}, old), {}, {
40
+ user: newUser
41
+ });
42
+ });
43
+ nextTick(function () {
44
+ SocketEmitter.emit(_USER_EVENT_CHANGE_, newUser);
45
+ cache.setCache(_USER_SESSION_, newUser, 'session');
46
+ console.info('AppContext updateUser is run !', user);
47
+ });
48
+ }
49
+ function updateOperation() {
50
+ var operation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
51
+ var newOperation = _objectSpread(_objectSpread({}, state.operation), operation);
52
+ setState(function (old) {
53
+ return _objectSpread(_objectSpread({}, old), {}, {
54
+ operation: newOperation
55
+ });
56
+ });
57
+ nextTick(function () {
58
+ SocketEmitter.emit(_OPERATION_EVENT_CHANGE_, newOperation);
59
+ cache.setCache(_OPERATION_SESSION_, newOperation, 'session');
60
+ console.info('AppContext updateOperation is run !', operation);
61
+ });
62
+ }
63
+ function updateLoginStatus(status) {
64
+ if (typeof status !== 'boolean') {
65
+ throw new Error('status type is boolean !');
66
+ }
67
+ setState(function (old) {
68
+ return status !== old.loginStatus ? _objectSpread(_objectSpread({}, old), {}, {
69
+ loginStatus: status
70
+ }) : old;
71
+ });
72
+ nextTick(function () {
73
+ SocketEmitter.emit(_LOGIN_STATUS_EVENT_CHANGE_, status);
74
+ cache.setCache(_LOGIN_STATUS_SESSION_, status, 'session');
75
+ console.info('AppContext updateLoginStatus is run !', status);
76
+ });
77
+ }
78
+
79
+ /**
80
+ * @desc 用于全局自定义状态存储,依赖sessionStorage持久化能力,不建议存储大数据量
81
+ * @param data
82
+ */
83
+ function updateStore() {
84
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
85
+ setState(function (old) {
86
+ var newData = {};
87
+
88
+ //获取变更项
89
+ for (var _key in data) {
90
+ if (data[_key] !== old.store[_key]) {
91
+ newData[_key] = data[_key];
92
+ }
93
+ }
94
+ if (isEmpty(newData)) {
95
+ return old;
96
+ }
97
+ var newStore = _objectSpread(_objectSpread({}, old.store), newData);
98
+ cache.setCache(_STORE_SESSION_, newStore, 'session');
99
+ return _objectSpread(_objectSpread({}, old), {}, {
100
+ store: newStore
101
+ });
102
+ });
103
+ nextTick(function () {
104
+ SocketEmitter.emit(_STORE_EVENT_CHANGE_, data);
105
+ console.info('AppContext updateStore is run !', data);
106
+ });
107
+ }
108
+ var stateChange = useCallback(function (options) {
109
+ return setState(function (old) {
110
+ return _objectSpread(_objectSpread({}, old), options);
111
+ });
112
+ }, []);
113
+ var storeChange = useCallback(function (store) {
114
+ return setState(function (old) {
115
+ return _objectSpread(_objectSpread({}, old), {}, {
116
+ store: _objectSpread(_objectSpread({}, old.store), store)
117
+ });
118
+ });
119
+ }, []);
120
+ var root = useMemo(function () {
121
+ return getContainer();
122
+ }, [getContainer]);
123
+ var providerValue = useMemo(function () {
124
+ return {
125
+ user: state.user,
126
+ operation: state.operation,
127
+ loginStatus: state.loginStatus,
128
+ store: state.store,
129
+ updateUser: updateUser,
130
+ updateOperation: updateOperation,
131
+ updateLoginStatus: updateLoginStatus,
132
+ updateStore: updateStore,
133
+ root: root
134
+ };
135
+ },
136
+ // eslint-disable-next-line react-hooks/exhaustive-deps
137
+ [state.user, state.operation, state.loginStatus]);
138
+ return /*#__PURE__*/_jsxs(Context.Provider, {
139
+ value: providerValue,
140
+ children: [children, /*#__PURE__*/_jsx(Sync, {
141
+ stateChange: stateChange,
142
+ storeChange: storeChange
143
+ })]
144
+ });
145
+ }
146
+ Provider.defaultProps = {
147
+ getContainer: function getContainer() {
148
+ return document.body;
149
+ }
150
+ };
151
+ export default {
152
+ Provider: Provider,
153
+ Context: Context
154
+ };
@@ -0,0 +1,42 @@
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
+ root: HTMLElement;
42
+ }
@@ -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
@@ -0,0 +1,2 @@
1
+ declare const App: () => import("react/jsx-runtime").JSX.Element;
2
+ export default App;
@@ -0,0 +1,20 @@
1
+ import CheckGroupFixed from "./index";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ var defaultSource = Array.from(new Array(100)).map(function (_, i) {
4
+ return {
5
+ label: "\u9009\u9879".concat(i),
6
+ value: i
7
+ };
8
+ });
9
+ var App = function App() {
10
+ return /*#__PURE__*/_jsx("div", {
11
+ style: {
12
+ width: '100%'
13
+ },
14
+ children: /*#__PURE__*/_jsx(CheckGroupFixed, {
15
+ label: "\u6807\u9898",
16
+ source: defaultSource
17
+ })
18
+ });
19
+ };
20
+ export default App;
@@ -0,0 +1,22 @@
1
+ export interface SourceDictType {
2
+ value?: string | number;
3
+ label: string;
4
+ icon?: string;
5
+ }
6
+ interface ICheckGroupFixedProps {
7
+ /**
8
+ * label
9
+ */
10
+ label: string;
11
+ /**
12
+ * 字典
13
+ */
14
+ source: SourceDictType[];
15
+ onChange?: (keys: string[] & number[] & boolean[]) => void;
16
+ checboxSize?: number;
17
+ labelSize?: number;
18
+ cutRow?: number;
19
+ value?: string[] & number[] & boolean[];
20
+ }
21
+ declare function CheckGroupFixed({ label, source, checboxSize, cutRow, labelSize, value, onChange }: ICheckGroupFixedProps): import("react/jsx-runtime").JSX.Element;
22
+ export default CheckGroupFixed;
@@ -0,0 +1,150 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
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 * as style from "./style";
17
+ import { jsxs as _jsxs } from "react/jsx-runtime";
18
+ import { jsx as _jsx } from "react/jsx-runtime";
19
+ function CheckGroupFixed(_ref) {
20
+ var label = _ref.label,
21
+ _ref$source = _ref.source,
22
+ source = _ref$source === void 0 ? [] : _ref$source,
23
+ _ref$checboxSize = _ref.checboxSize,
24
+ checboxSize = _ref$checboxSize === void 0 ? 120 : _ref$checboxSize,
25
+ _ref$cutRow = _ref.cutRow,
26
+ cutRow = _ref$cutRow === void 0 ? 1 : _ref$cutRow,
27
+ _ref$labelSize = _ref.labelSize,
28
+ labelSize = _ref$labelSize === void 0 ? 100 : _ref$labelSize,
29
+ value = _ref.value,
30
+ onChange = _ref.onChange;
31
+ var _useState = useState({
32
+ visible: false,
33
+ sider: false,
34
+ pos: [0, 0],
35
+ w: 0,
36
+ selectKeys: value || []
37
+ }),
38
+ _useState2 = _slicedToArray(_useState, 2),
39
+ state = _useState2[0],
40
+ setState = _useState2[1];
41
+ var domRef = useRef(null);
42
+ useLayoutEffect(function () {
43
+ var _domRef$current;
44
+ var contentEle = (_domRef$current = domRef.current) === null || _domRef$current === void 0 ? void 0 : _domRef$current.querySelector('.check-content-box');
45
+ var contentRect = (contentEle === null || contentEle === void 0 ? void 0 : contentEle.getBoundingClientRect()) || {
46
+ width: 0
47
+ };
48
+ if (contentRect.width < checboxSize * source.length) {
49
+ var _domRef$current2;
50
+ var lr = (_domRef$current2 = domRef.current) === null || _domRef$current2 === void 0 ? void 0 : _domRef$current2.getBoundingClientRect();
51
+ setState(function (old) {
52
+ return _objectSpread(_objectSpread({}, old), {}, {
53
+ visible: true,
54
+ w: (lr === null || lr === void 0 ? void 0 : lr.width) || 0
55
+ });
56
+ });
57
+ }
58
+ }, [checboxSize, source.length, state.visible]);
59
+ var fixedStyle = useMemo(function () {
60
+ return state.sider ? {
61
+ position: 'absolute',
62
+ width: state.w,
63
+ height: 'auto',
64
+ left: state.pos[0],
65
+ top: state.pos[1],
66
+ backgroundColor: 'white',
67
+ zIndex: 99,
68
+ boxShadow: ' 0 0 10px rgba(0,0,0,0.1)'
69
+ } : {};
70
+ }, [state.sider, state.w, state.pos]);
71
+ useUpdateEffect(function () {
72
+ return onChange === null || onChange === void 0 ? void 0 : onChange(state.selectKeys);
73
+ }, [state.selectKeys]);
74
+ useLayoutEffect(function () {
75
+ var _domRef$current3;
76
+ var dom = (_domRef$current3 = domRef.current) === null || _domRef$current3 === void 0 ? void 0 : _domRef$current3.querySelector('.check-box-group-layout');
77
+ dom === null || dom === void 0 ? void 0 : dom.setAttribute('style', "grid-template-columns:repeat(auto-fill, minmax(".concat(checboxSize, "px, 1fr));"));
78
+ }, [checboxSize]);
79
+ return /*#__PURE__*/_jsxs("div", {
80
+ className: style.groupLayout,
81
+ ref: domRef,
82
+ style: {
83
+ height: state.sider ? cutRow * 30 + 20 : 'auto'
84
+ },
85
+ children: [/*#__PURE__*/_jsxs("div", {
86
+ className: style.groupBox,
87
+ style: fixedStyle,
88
+ children: [/*#__PURE__*/_jsxs("span", {
89
+ className: style.checkLabelBox,
90
+ style: {
91
+ width: labelSize
92
+ },
93
+ children: [label, "\uFF1A"]
94
+ }), /*#__PURE__*/_jsx("div", {
95
+ className: style.checkContentBox,
96
+ style: {
97
+ height: state.sider ? 'auto' : cutRow * 30
98
+ },
99
+ children: /*#__PURE__*/_jsx(Checkbox.Group, {
100
+ value: state.selectKeys,
101
+ className: "check-box-group-layout",
102
+ onChange: function onChange(keys) {
103
+ return setState(function (old) {
104
+ return _objectSpread(_objectSpread({}, old), {}, {
105
+ selectKeys: keys
106
+ });
107
+ });
108
+ },
109
+ children: source.map(function (v) {
110
+ return /*#__PURE__*/_jsx(Checkbox, {
111
+ style: {
112
+ width: checboxSize
113
+ },
114
+ value: v.value,
115
+ children: /*#__PURE__*/_jsx("span", {
116
+ title: v.label,
117
+ children: v.label
118
+ })
119
+ }, v.value);
120
+ })
121
+ })
122
+ }), state.visible && /*#__PURE__*/_jsx(Badge, {
123
+ count: state.sider ? 0 : state.selectKeys.length,
124
+ size: "small",
125
+ offset: [10, 0],
126
+ children: /*#__PURE__*/_jsx("span", {
127
+ className: style.sliceBtn,
128
+ onClick: function onClick() {
129
+ return setState(function (old) {
130
+ return _objectSpread(_objectSpread({}, old), {}, {
131
+ sider: !state.sider
132
+ });
133
+ });
134
+ },
135
+ children: state.sider ? '收起' : '展开'
136
+ })
137
+ })]
138
+ }), state.sider && /*#__PURE__*/_jsx("div", {
139
+ className: style.siderMask,
140
+ onClick: function onClick() {
141
+ return setState(function (old) {
142
+ return _objectSpread(_objectSpread({}, old), {}, {
143
+ sider: false
144
+ });
145
+ });
146
+ }
147
+ })]
148
+ });
149
+ }
150
+ export default CheckGroupFixed;
@@ -0,0 +1,6 @@
1
+ export declare const groupLayout: string;
2
+ export declare const groupBox: string;
3
+ export declare const checkLabelBox: string;
4
+ export declare const checkContentBox: string;
5
+ export declare const siderMask: string;
6
+ export declare const sliceBtn: string;
@@ -0,0 +1,9 @@
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
2
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
+ import { css } from '@emotion/css';
4
+ export var groupLayout = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n"])));
5
+ export var groupBox = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n padding: 10px;\n"])));
6
+ export var checkLabelBox = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 80px;\n color: #999;\n line-height: 30px;\n text-align: center;\n"])));
7
+ export var checkContentBox = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 100%;\n height: 30px;\n overflow: hidden;\n flex: 1;\n .ant-checkbox-group {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));\n grid-gap: 10px;\n .ant-checkbox-wrapper {\n display: flex;\n width: 120px;\n height: 30px;\n margin-left: 0;\n align-items: center;\n > span:not(.ant-checkbox) {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 1;\n }\n }\n }\n"])));
8
+ export var siderMask = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n z-index: 98;\n width: 100%;\n height: 100%;\n"])));
9
+ export var sliceBtn = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: relative;\n top: 10px;\n right: 10px;\n color: var(--primary);\n cursor: pointer;\n"])));
@@ -0,0 +1,4 @@
1
+ import { ConfigJOSN } from './interface';
2
+ declare const Config: ConfigJOSN;
3
+ declare const LMConfig: typeof Config;
4
+ export default LMConfig;
@@ -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;