@cloud-app-dev/vidc 4.0.8 → 4.0.10

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 (116) hide show
  1. package/.dumirc.ts +0 -10
  2. package/.fatherrc.ts +1 -4
  3. package/es/AppContext/Sync.js +10 -24
  4. package/es/AppContext/index.js +19 -19
  5. package/es/AppContext/static.js +0 -6
  6. package/es/Auth/index.js +2 -5
  7. package/es/AutoExit/index.js +2 -2
  8. package/es/CheckGroupFixed/demo.js +0 -2
  9. package/es/CheckGroupFixed/index.js +25 -42
  10. package/es/CustomRenderSelect/index.js +2 -2
  11. package/es/DisableMark/index.js +2 -2
  12. package/es/DomMove/index.js +31 -42
  13. package/es/DomMove/utils.js +3 -8
  14. package/es/Drag/DragAndDropItem.js +28 -45
  15. package/es/Drag/DropItem.js +11 -21
  16. package/es/DynamicGridList/Demo.js +1 -13
  17. package/es/DynamicList/demo.js +1 -10
  18. package/es/DynamicList/index.js +27 -41
  19. package/es/ErrorFallback/index.js +1 -3
  20. package/es/EventTools/index.d.ts +3 -0
  21. package/es/EventTools/index.js +12 -0
  22. package/es/GridList/Demo.js +5 -18
  23. package/es/GridList/utils.js +0 -1
  24. package/es/HightLevel/index.js +1 -5
  25. package/es/IconFont/index.js +9 -18
  26. package/es/InstanceHistory/index.js +0 -2
  27. package/es/ListWithSizeAnimate/index.js +15 -31
  28. package/es/LoaderScript/index.js +10 -21
  29. package/es/LoaderScript/utils.js +2 -2
  30. package/es/Map/BasicMap/AMapInstance.js +6 -16
  31. package/es/Map/BasicMap/LeafletInstance.js +16 -26
  32. package/es/Map/ClusterLayer/hook.js +16 -38
  33. package/es/Map/ClusterLayer/index.js +2 -6
  34. package/es/Map/Context/index.js +6 -30
  35. package/es/Map/FindPio/index.js +0 -2
  36. package/es/Map/LevelCenter/DragMarker/index.js +6 -9
  37. package/es/Map/LevelCenter/demo.js +12 -21
  38. package/es/Map/LevelCenter/index.js +8 -14
  39. package/es/Map/LoaderMap/index.js +14 -17
  40. package/es/Map/MapDrawSelect/demo.js +14 -25
  41. package/es/Map/MapDrawSelect/index.js +14 -20
  42. package/es/Map/MouseTool/index.js +17 -27
  43. package/es/Map/MouseTool/useMouseTools.js +12 -35
  44. package/es/Map/ResetTools/index.js +4 -8
  45. package/es/Map/SinglePoint/index.js +6 -13
  46. package/es/Map/hook/useMapEvent.js +3 -7
  47. package/es/Map/hook/useMapType.js +1 -2
  48. package/es/Map/useMarker/index.js +17 -30
  49. package/es/Map/withMap/index.js +4 -6
  50. package/es/Picture/component/DefaultRects/RectInfo.js +13 -27
  51. package/es/Picture/component/DefaultRects/index.js +7 -10
  52. package/es/Picture/component/DrawRect/index.js +10 -13
  53. package/es/Picture/component/RectMenu/index.js +10 -15
  54. package/es/Picture/component/RectMenu/utils.js +3 -6
  55. package/es/Picture/component/WheelScale/index.js +3 -5
  56. package/es/Picture/loadCaptureRectImage.js +42 -61
  57. package/es/Picture/useDraw.js +23 -39
  58. package/es/Player/api/index.js +2 -2
  59. package/es/Player/context.js +5 -9
  60. package/es/Player/contraller_bar/bar.js +9 -16
  61. package/es/Player/contraller_bar/contraller_event.js +7 -25
  62. package/es/Player/contraller_bar/index.js +7 -9
  63. package/es/Player/contraller_bar/left_bar.js +17 -29
  64. package/es/Player/contraller_bar/time.js +5 -14
  65. package/es/Player/contraller_bar/useBarStatus.js +12 -24
  66. package/es/Player/contraller_bar/volume.js +9 -29
  67. package/es/Player/event/eventName.js +1 -1
  68. package/es/Player/event/index.js +28 -63
  69. package/es/Player/frontend_player.js +16 -27
  70. package/es/Player/iconfont.js +6 -12
  71. package/es/Player/live_heart.js +2 -18
  72. package/es/Player/message.js +15 -35
  73. package/es/Player/segment_player.js +48 -86
  74. package/es/Player/timeline.js +19 -41
  75. package/es/PlayerExt/demo.js +15 -25
  76. package/es/PlayerExt/index.js +29 -51
  77. package/es/ROI/demo.js +0 -2
  78. package/es/ScreenPlayer/Record.js +1 -1
  79. package/es/ScreenPlayer/TimeMode.js +1 -3
  80. package/es/ScreenPlayer/useTimeSlider.js +3 -3
  81. package/es/SocketEmitter/eventEmitter.d.ts +27 -0
  82. package/es/SocketEmitter/eventEmitter.js +87 -0
  83. package/es/SocketEmitter/index.d.ts +24 -0
  84. package/es/SocketEmitter/index.js +125 -0
  85. package/es/SocketEmitter/interface.d.ts +4 -0
  86. package/es/ThemeAntd/demo.js +0 -2
  87. package/es/VList/utils.js +2 -3
  88. package/es/bigNumberTransformCN/index.d.ts +5 -0
  89. package/es/bigNumberTransformCN/index.js +60 -0
  90. package/es/cache/index.d.ts +34 -0
  91. package/es/cache/index.js +94 -0
  92. package/es/copy/index.d.ts +1 -0
  93. package/es/copy/index.js +9 -0
  94. package/es/getThemeStyle/index.d.ts +2 -0
  95. package/es/getThemeStyle/index.js +5 -0
  96. package/es/index.d.ts +11 -0
  97. package/es/index.js +12 -1
  98. package/es/logger/index.d.ts +7 -0
  99. package/es/logger/index.js +30 -0
  100. package/es/nextTick/index.d.ts +1 -0
  101. package/es/nextTick/index.js +7 -0
  102. package/es/submidstr/index.d.ts +5 -0
  103. package/es/submidstr/index.js +14 -0
  104. package/es/treeHelper/index.d.ts +11 -0
  105. package/es/treeHelper/index.js +173 -0
  106. package/es/useEventEmitterHandle/index.js +5 -9
  107. package/es/useFullscreen/demo.js +8 -18
  108. package/es/useFullscreen/index.js +7 -28
  109. package/es/useHistory/index.js +0 -2
  110. package/es/useRafInterval/index.js +3 -27
  111. package/es/useSimpleState/index.js +11 -22
  112. package/es/useVirtualList/index.js +21 -57
  113. package/es/utils.js +2 -2
  114. package/es/uuid/index.d.ts +4 -0
  115. package/es/uuid/index.js +15 -0
  116. package/package.json +6 -3
@@ -1,46 +1,39 @@
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); }
1
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; }
2
-
3
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
-
5
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
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
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
-
9
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."); }
10
-
11
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); }
12
-
13
- 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; }
14
-
15
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
16
-
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; } }
17
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
-
19
13
  import React, { useEffect, useMemo, useState } from 'react';
20
14
  import IconFont from "../Player/iconfont";
21
15
  import "./index.less";
22
16
  import { jsx as _jsx } from "react/jsx-runtime";
23
17
  import { jsxs as _jsxs } from "react/jsx-runtime";
24
-
25
18
  /**
26
19
  * 客户端插件模式,随机端口
27
20
  */
28
21
  export var LOCAL_PORT = ['15080', '15081', '15082', '15083', '15084', '15085', '15086', '15087', '15088', '15089'];
22
+
29
23
  /**
30
24
  * 随机获取端口号
31
25
  * @returns
32
26
  */
33
-
34
27
  export function getLocalPort() {
35
28
  return LOCAL_PORT[Math.floor(Math.random() * LOCAL_PORT.length)];
36
29
  }
30
+
37
31
  /**
38
32
  * @desc 转码插件模式下的url
39
33
  * @param url
40
34
  * @param params
41
35
  * @returns
42
36
  */
43
-
44
37
  export function getLocalPlayPath(url) {
45
38
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
46
39
  var URL_TEMPLATE = "http://127.0.0.1:<port>/video/v1/transcoding?uri=<pull_uri>";
@@ -50,26 +43,22 @@ export function getLocalPlayPath(url) {
50
43
  }
51
44
  export function usePlugin(mode, key) {
52
45
  var _useState = useState({
53
- installed: false
54
- }),
55
- _useState2 = _slicedToArray(_useState, 2),
56
- state = _useState2[0],
57
- setState = _useState2[1];
58
-
46
+ installed: false
47
+ }),
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ state = _useState2[0],
50
+ setState = _useState2[1];
59
51
  useEffect(function () {
60
52
  if (mode !== 2) {
61
53
  return undefined;
62
54
  }
63
-
64
55
  var port = getLocalPort();
65
56
  var url = "http://127.0.0.1:".concat(port, "/video/v1/state");
66
-
67
57
  var thenFn = function thenFn(res) {
68
58
  return res.status === 200 ? setState({
69
59
  installed: true
70
60
  }) : undefined;
71
61
  };
72
-
73
62
  fetch(url).then(thenFn).catch(function (e) {
74
63
  return console.error('插件未安装', e);
75
64
  });
@@ -80,10 +69,9 @@ export function usePlugin(mode, key) {
80
69
  }, [state.installed, mode])
81
70
  };
82
71
  }
83
-
84
72
  function NeedInstallPlugin(_ref) {
85
73
  var pluginDownloadUrl = _ref.pluginDownloadUrl,
86
- retry = _ref.retry;
74
+ retry = _ref.retry;
87
75
  return /*#__PURE__*/_jsx("div", {
88
76
  className: "lm-player-ext-layout",
89
77
  children: /*#__PURE__*/_jsxs("div", {
@@ -124,7 +112,6 @@ function NeedInstallPlugin(_ref) {
124
112
  })
125
113
  });
126
114
  }
127
-
128
115
  function Loading() {
129
116
  return /*#__PURE__*/_jsx("div", {
130
117
  className: "lm-player-ext-layout",
@@ -146,7 +133,6 @@ function Loading() {
146
133
  })
147
134
  });
148
135
  }
149
-
150
136
  function Empty() {
151
137
  return /*#__PURE__*/_jsx("div", {
152
138
  className: "lm-player-ext-layout",
@@ -158,37 +144,33 @@ function Empty() {
158
144
  })
159
145
  });
160
146
  }
161
-
162
147
  export function ExtModel(_ref2) {
163
148
  var url = _ref2.url,
164
- children = _ref2.children,
165
- mode = _ref2.mode,
166
- pluginDownloadUrl = _ref2.pluginDownloadUrl,
167
- pluginParams = _ref2.pluginParams,
168
- loading = _ref2.loading,
169
- segments = _ref2.segments;
170
-
149
+ children = _ref2.children,
150
+ mode = _ref2.mode,
151
+ pluginDownloadUrl = _ref2.pluginDownloadUrl,
152
+ pluginParams = _ref2.pluginParams,
153
+ loading = _ref2.loading,
154
+ segments = _ref2.segments;
171
155
  var _useState3 = useState({
172
- forceKey: Date.now()
173
- }),
174
- _useState4 = _slicedToArray(_useState3, 2),
175
- state = _useState4[0],
176
- setState = _useState4[1];
177
-
156
+ forceKey: Date.now()
157
+ }),
158
+ _useState4 = _slicedToArray(_useState3, 2),
159
+ state = _useState4[0],
160
+ setState = _useState4[1];
178
161
  var hasUrl = useMemo(function () {
179
162
  return !!url || Array.isArray(segments) && segments.findIndex(function (v) {
180
163
  return v.url;
181
164
  }) > -1;
182
165
  }, [segments, url]);
183
-
184
166
  var _usePlugin = usePlugin(mode, state.forceKey),
185
- needInstall = _usePlugin.needInstall; // eslint-disable-next-line react-hooks/exhaustive-deps
186
-
167
+ needInstall = _usePlugin.needInstall;
187
168
 
169
+ // eslint-disable-next-line react-hooks/exhaustive-deps
188
170
  var playUrl = useMemo(function () {
189
171
  return mode === 2 && url ? getLocalPlayPath(url, pluginParams) : url;
190
- }, [url, mode]); // eslint-disable-next-line react-hooks/exhaustive-deps
191
-
172
+ }, [url, mode]);
173
+ // eslint-disable-next-line react-hooks/exhaustive-deps
192
174
  var playSegments = useMemo(function () {
193
175
  return mode === 2 && segments ? segments.map(function (v) {
194
176
  return _objectSpread(_objectSpread({}, v), {}, {
@@ -196,7 +178,6 @@ export function ExtModel(_ref2) {
196
178
  });
197
179
  }) : segments;
198
180
  }, [segments, mode]);
199
-
200
181
  if (needInstall) {
201
182
  return /*#__PURE__*/_jsx(NeedInstallPlugin, {
202
183
  pluginDownloadUrl: pluginDownloadUrl,
@@ -209,15 +190,12 @@ export function ExtModel(_ref2) {
209
190
  }
210
191
  });
211
192
  }
212
-
213
193
  if (loading) {
214
194
  return /*#__PURE__*/_jsx(Loading, {});
215
195
  }
216
-
217
196
  if (!hasUrl) {
218
197
  return /*#__PURE__*/_jsx(Empty, {});
219
198
  }
220
-
221
199
  return /*#__PURE__*/_jsx("div", {
222
200
  className: "lm-player-ext-layout",
223
201
  children: /*#__PURE__*/React.cloneElement(children, mode === 2 ? {
package/es/ROI/demo.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import ROI from "./index";
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
-
5
4
  var App = function App() {
6
5
  return /*#__PURE__*/_jsx("div", {
7
6
  style: {
@@ -16,5 +15,4 @@ var App = function App() {
16
15
  })
17
16
  });
18
17
  };
19
-
20
18
  export default App;
@@ -102,7 +102,7 @@ function RecordPlayer(_ref) {
102
102
  }, [state.selectIndex, screenList]);
103
103
  var timeBegin = useMemo(function () {
104
104
  var _state$begins, _segmentItem$date;
105
- return (_state$begins = state.begins["".concat(getKey(segmentItem))]) !== null && _state$begins !== void 0 ? _state$begins : ((_segmentItem$date = segmentItem === null || segmentItem === void 0 ? void 0 : segmentItem.date) !== null && _segmentItem$date !== void 0 ? _segmentItem$date : 0) - state.timeMode / 2 * 3600 * 1000;
105
+ return ((_state$begins = state.begins["".concat(getKey(segmentItem))]) !== null && _state$begins !== void 0 ? _state$begins : segmentItem === null || segmentItem === void 0 ? void 0 : segmentItem.date) ? ((_segmentItem$date = segmentItem === null || segmentItem === void 0 ? void 0 : segmentItem.date) !== null && _segmentItem$date !== void 0 ? _segmentItem$date : 0) - state.timeMode / 2 * 3600 * 1000 : undefined;
106
106
  }, [segmentItem, state.begins, state.timeMode]);
107
107
  var currentTime = useMemo(function () {
108
108
  var _state$currentTimes;
@@ -3,10 +3,9 @@ import React from 'react';
3
3
  import { TimeModeLibs } from "./utils";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { jsxs as _jsxs } from "react/jsx-runtime";
6
-
7
6
  function TimeMode(_ref) {
8
7
  var timeMode = _ref.timeMode,
9
- onChange = _ref.onChange;
8
+ onChange = _ref.onChange;
10
9
  return /*#__PURE__*/_jsx(Select, {
11
10
  value: timeMode,
12
11
  onChange: onChange,
@@ -28,5 +27,4 @@ function TimeMode(_ref) {
28
27
  })
29
28
  });
30
29
  }
31
-
32
30
  export default TimeMode;
@@ -1,5 +1,4 @@
1
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
- import _nextTick from "@cloud-app-dev/utils/es/nextTick";
3
2
  import _useEventListener from "ahooks/es/useEventListener";
4
3
  import _useUpdateEffect from "ahooks/es/useUpdateEffect";
5
4
  import _useSize from "ahooks/es/useSize";
@@ -16,6 +15,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
16
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
16
  import moment from 'dayjs';
18
17
  import { useEffect, useMemo, useRef, useState } from 'react';
18
+ import nextTick from "../nextTick";
19
19
  var hours = [1, 6, 12, 24];
20
20
  var currentColor = '#FF000A';
21
21
  var normalLineColor = '#ffffff';
@@ -316,7 +316,7 @@ function useTimeSlider(canvasRef, _ref2) {
316
316
  hoursPer: new_hoursPer
317
317
  });
318
318
  });
319
- _nextTick(function () {
319
+ nextTick(function () {
320
320
  return onHoursPerChange === null || onHoursPerChange === void 0 ? void 0 : onHoursPerChange(new_hoursPer);
321
321
  });
322
322
  }, {
@@ -407,7 +407,7 @@ function useTimeSlider(canvasRef, _ref2) {
407
407
  current: new_current
408
408
  });
409
409
  });
410
- _nextTick(function () {
410
+ nextTick(function () {
411
411
  return onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange({
412
412
  currentTime: new_current
413
413
  }, _outTimeline);
@@ -0,0 +1,27 @@
1
+ /**
2
+ * 自定义事件
3
+ * author hjj
4
+ */
5
+ declare type EventItemType = {
6
+ [key: string]: {
7
+ listener: (data?: any) => void;
8
+ timer: number;
9
+ }[];
10
+ };
11
+ declare class EventEmitter {
12
+ events: EventItemType;
13
+ constructor();
14
+ getEvents(): EventItemType;
15
+ once(eventName: string, listener: (...args: any) => void): void;
16
+ on(eventName: string, listener: (...args: any) => void, timer?: number): void;
17
+ emit(eventName: string, ...args: any): void;
18
+ remove(eventName: string): void;
19
+ off(eventName: string, listener: (...args: any) => void): void;
20
+ clear(): void;
21
+ trigger(eventName: string, args: any): void;
22
+ getListeners(eventName: string): {
23
+ listener: (data?: any) => void;
24
+ timer: number;
25
+ }[];
26
+ }
27
+ export default EventEmitter;
@@ -0,0 +1,87 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ 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; }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ 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); }
8
+ /**
9
+ * 自定义事件
10
+ * author hjj
11
+ */
12
+ var EventEmitter = /*#__PURE__*/function () {
13
+ function EventEmitter() {
14
+ _classCallCheck(this, EventEmitter);
15
+ _defineProperty(this, "events", void 0);
16
+ this.events = {};
17
+ }
18
+ _createClass(EventEmitter, [{
19
+ key: "getEvents",
20
+ value: function getEvents() {
21
+ return this.events;
22
+ }
23
+ }, {
24
+ key: "once",
25
+ value: function once(eventName, listener) {
26
+ return this.on(eventName, listener, 0);
27
+ }
28
+ }, {
29
+ key: "on",
30
+ value: function on(eventName, listener) {
31
+ var timer = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
32
+ var listeners = this.getListeners(eventName);
33
+ listeners.push({
34
+ listener: listener,
35
+ timer: timer
36
+ });
37
+ }
38
+ }, {
39
+ key: "emit",
40
+ value: function emit(eventName) {
41
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
42
+ args[_key - 1] = arguments[_key];
43
+ }
44
+ return this.trigger(eventName, args);
45
+ }
46
+ }, {
47
+ key: "remove",
48
+ value: function remove(eventName) {
49
+ this.events[eventName] && delete this.events[eventName];
50
+ }
51
+ }, {
52
+ key: "off",
53
+ value: function off(eventName, listener) {
54
+ var listeners = this.getListeners(eventName);
55
+ var index = listeners.findIndex(function (item) {
56
+ return item.listener === listener;
57
+ });
58
+ index !== -1 && listeners.splice(index, 1);
59
+ }
60
+ }, {
61
+ key: "clear",
62
+ value: function clear() {
63
+ this.events = {};
64
+ }
65
+ }, {
66
+ key: "trigger",
67
+ value: function trigger(eventName, args) {
68
+ var listeners = this.getListeners(eventName);
69
+ for (var i = 0; i < listeners.length; i++) {
70
+ var listener = listeners[i];
71
+ if (listener) {
72
+ listener.listener.apply(this, args || []);
73
+ listener.timer === 0 && listeners.splice(i, 1);
74
+ listeners.length === 0 && delete this.events[eventName];
75
+ listener.timer !== -1 && listener.timer--;
76
+ }
77
+ }
78
+ }
79
+ }, {
80
+ key: "getListeners",
81
+ value: function getListeners(eventName) {
82
+ return this.events[eventName] || (this.events[eventName] = []);
83
+ }
84
+ }]);
85
+ return EventEmitter;
86
+ }();
87
+ export default EventEmitter;
@@ -0,0 +1,24 @@
1
+ import EventEmitter from './eventEmitter';
2
+ declare class SocketEmitter extends EventEmitter {
3
+ sokect: any;
4
+ sokectEvents: string[];
5
+ subActions: {
6
+ [key: string]: (data?: any) => void;
7
+ };
8
+ constructor();
9
+ connect(url: string, options: any): void;
10
+ disconnect(): void;
11
+ /**
12
+ * 抽象socket监听方法
13
+ * @param {*} param0
14
+ */
15
+ subscribe(eventName: string, listener: (...args: any) => void): void;
16
+ subAction(eventName: string): (data: any) => void;
17
+ /**
18
+ * 抽象socket监听方法
19
+ * @param {*} param0
20
+ */
21
+ unsubscribe(eventName: string, listener: (...args: any) => void): void;
22
+ }
23
+ declare const LMEvent: SocketEmitter;
24
+ export default LMEvent;
@@ -0,0 +1,125 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
8
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
9
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
11
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
14
+ 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; }
15
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
16
+ 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); }
17
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
18
+ import EventEmitter from "./eventEmitter";
19
+ import logger from "../logger";
20
+ import cache from "../cache";
21
+ import io from 'socket.io-client';
22
+ var SocketEmitter = /*#__PURE__*/function (_EventEmitter) {
23
+ _inherits(SocketEmitter, _EventEmitter);
24
+ var _super = _createSuper(SocketEmitter);
25
+ function SocketEmitter() {
26
+ var _this;
27
+ _classCallCheck(this, SocketEmitter);
28
+ _this = _super.call(this);
29
+ _defineProperty(_assertThisInitialized(_this), "sokect", void 0);
30
+ _defineProperty(_assertThisInitialized(_this), "sokectEvents", void 0);
31
+ _defineProperty(_assertThisInitialized(_this), "subActions", void 0);
32
+ _this.sokectEvents = [];
33
+ _this.subActions = {};
34
+ return _this;
35
+ }
36
+ _createClass(SocketEmitter, [{
37
+ key: "connect",
38
+ value: function connect(url, options) {
39
+ if (this.sokect && this.sokect.connected) {
40
+ return;
41
+ }
42
+ var token = cache.getCache('token', 'session');
43
+ logger.debug('第一次尝试连接socket');
44
+ this.sokect = io(url, _objectSpread({
45
+ path: '/socket.io',
46
+ query: {
47
+ token: token
48
+ },
49
+ transports: ['websocket']
50
+ }, options));
51
+ this.sokect.on('connect', function () {
52
+ logger.debug('socket连接成功');
53
+ });
54
+ this.sokect.on('disconnect', function () {
55
+ logger.debug('socket断开连接');
56
+ });
57
+ }
58
+ }, {
59
+ key: "disconnect",
60
+ value: function disconnect() {
61
+ this.clear();
62
+ this.sokect && this.sokect.disconnect();
63
+ this.sokect = null;
64
+ }
65
+
66
+ /**
67
+ * 抽象socket监听方法
68
+ * @param {*} param0
69
+ */
70
+ }, {
71
+ key: "subscribe",
72
+ value: function subscribe(eventName, listener) {
73
+ this.on(eventName, listener);
74
+ if (this.sokectEvents.includes(eventName) || !this.sokect) {
75
+ return;
76
+ }
77
+ this.sokectEvents.push(eventName);
78
+ this.subActions[eventName] = this.subAction(eventName);
79
+ this.sokect && this.sokect.on(eventName, this.subActions[eventName]);
80
+ logger.debug("socket.io listener event -> ".concat(eventName));
81
+ }
82
+ }, {
83
+ key: "subAction",
84
+ value: function subAction(eventName) {
85
+ var _this2 = this;
86
+ return function (data) {
87
+ var json;
88
+ try {
89
+ json = JSON.parse(data);
90
+ } catch (e) {
91
+ json = data;
92
+ }
93
+ _this2.emit(eventName, json);
94
+ };
95
+ }
96
+
97
+ /**
98
+ * 抽象socket监听方法
99
+ * @param {*} param0
100
+ */
101
+ }, {
102
+ key: "unsubscribe",
103
+ value: function unsubscribe(eventName, listener) {
104
+ this.off(eventName, listener);
105
+ this.sokect && this.sokect.off(eventName, this.subActions[eventName]);
106
+ delete this.subActions[eventName];
107
+ this.sokectEvents = this.sokectEvents.filter(function (v) {
108
+ return v !== eventName;
109
+ });
110
+ logger.debug("socket.io unlistener event -> ".concat(eventName));
111
+ }
112
+ }]);
113
+ return SocketEmitter;
114
+ }(EventEmitter);
115
+ var _global = window;
116
+ var event = new SocketEmitter();
117
+ var LMEvent = function () {
118
+ if (_global._LM_EVENT_) {
119
+ return _global._LM_EVENT_;
120
+ } else {
121
+ _global._LM_EVENT_ = event;
122
+ return event;
123
+ }
124
+ }();
125
+ export default LMEvent;
@@ -0,0 +1,4 @@
1
+ declare module 'socket.io-client' {
2
+ io: any;
3
+ export default io;
4
+ }
@@ -4,7 +4,6 @@ import ThemeAntd from '.';
4
4
  import "./demo.less";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
-
8
7
  var App = function App() {
9
8
  var ref = useRef(null);
10
9
  return /*#__PURE__*/_jsx(ConfigProvider, {
@@ -127,5 +126,4 @@ var App = function App() {
127
126
  })
128
127
  });
129
128
  };
130
-
131
129
  export default App;
package/es/VList/utils.js CHANGED
@@ -4,11 +4,10 @@ export function renderRowItem(rowRenderer, renderItem, data) {
4
4
  if (rowRenderer) {
5
5
  return rowRenderer;
6
6
  }
7
-
8
7
  return function (_ref) {
9
8
  var key = _ref.key,
10
- index = _ref.index,
11
- style = _ref.style;
9
+ index = _ref.index,
10
+ style = _ref.style;
12
11
  var item = data[index];
13
12
  return /*#__PURE__*/_jsx("div", {
14
13
  style: style,
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 大数字转换,将大额数字转换为万、千万、亿等
3
+ * @param value 数字值
4
+ */
5
+ export default function bigNumberTransformCN(value: number): string;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * 大数字转换,将大额数字转换为万、千万、亿等
3
+ * @param value 数字值
4
+ */
5
+ export default function bigNumberTransformCN(value) {
6
+ var newValue = ['', '', ''];
7
+ var fr = 1000;
8
+ var num = 3;
9
+ var text1 = '';
10
+ var fm = 1;
11
+ while (value / fr >= 1) {
12
+ fr *= 10;
13
+ num += 1;
14
+ // console.log('数字', value / fr, 'num:', num)
15
+ }
16
+
17
+ if (num <= 4) {
18
+ // 千
19
+ newValue[0] = "".concat(Math.round(value / 1000));
20
+ newValue[1] = '千';
21
+ } else if (num <= 8) {
22
+ // 万
23
+ text1 = Math.round(num - 4) / 3 > 1 ? '千万' : '万';
24
+ // tslint:disable-next-line:no-shadowed-variable
25
+ fm = text1 === '万' ? 10000 : 10000000;
26
+ if (value % fm === 0) {
27
+ newValue[0] = Math.round(value / fm) + '';
28
+ } else {
29
+ newValue[0] = Math.round(value / fm).toFixed(2) + '';
30
+ }
31
+ newValue[1] = text1;
32
+ } else if (num <= 16) {
33
+ // 亿
34
+ text1 = (num - 8) / 3 > 1 ? '千亿' : '亿';
35
+ text1 = (num - 8) / 4 > 1 ? '万亿' : text1;
36
+ text1 = (num - 8) / 7 > 1 ? '千万亿' : text1;
37
+ // tslint:disable-next-line:no-shadowed-variable
38
+ fm = 1;
39
+ if (text1 === '亿') {
40
+ fm = 100000000;
41
+ } else if (text1 === '千亿') {
42
+ fm = 100000000000;
43
+ } else if (text1 === '万亿') {
44
+ fm = 1000000000000;
45
+ } else if (text1 === '千万亿') {
46
+ fm = 1000000000000000;
47
+ }
48
+ if (value % fm === 0) {
49
+ newValue[0] = Math.round(value / fm) + '';
50
+ } else {
51
+ newValue[0] = Math.round(value / fm).toFixed(2) + '';
52
+ }
53
+ newValue[1] = text1;
54
+ }
55
+ if (value < 1000) {
56
+ newValue[0] = value + '';
57
+ newValue[1] = '';
58
+ }
59
+ return newValue.join('');
60
+ }