@cloud-app-dev/vidc 2.1.0-alpha.8 → 2.2.0-alpha.2

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 (166) hide show
  1. package/.umirc.ts +4 -3
  2. package/es/Api/index.js +1 -1
  3. package/es/AppContext/Sync.d.ts +1 -0
  4. package/es/AppContext/interface.d.ts +4 -1
  5. package/es/CheckGroupFixed/index.d.ts +1 -0
  6. package/es/DeviceSelect/TreeType.d.ts +1 -0
  7. package/es/DeviceSelect/demo.d.ts +1 -0
  8. package/es/DeviceSelect/index.d.ts +1 -0
  9. package/es/DeviceSelect/index.js +1 -1
  10. package/es/Drag/DragAndDropItem.js +2 -2
  11. package/es/Drag/DropItem.js +2 -2
  12. package/es/Drawer/Demo.js +24 -3
  13. package/es/Drawer/Footer.d.ts +1 -0
  14. package/es/Drawer/index.d.ts +29 -3
  15. package/es/Drawer/index.js +155 -4
  16. package/es/FrontendPlayer/index.d.ts +2 -0
  17. package/es/FrontendPlayer/index.js +2 -0
  18. package/es/FullScreen/index.d.ts +2 -3
  19. package/es/FullScreen/index.js +14 -41
  20. package/es/InitialConfig/utils.d.ts +5 -5
  21. package/es/InitialConfig/utils.js +19 -19
  22. package/es/Input/index.d.ts +1 -0
  23. package/es/List/CheckExt.d.ts +1 -0
  24. package/es/List/DeviceList/index.js +1 -1
  25. package/es/List/DynamicDeviceList/Demo.d.ts +1 -0
  26. package/es/List/DynamicDeviceList/index.d.ts +1 -0
  27. package/es/List/GridList/index.js +0 -1
  28. package/es/List/VList/index.d.ts +1 -0
  29. package/es/List/index.d.ts +1 -0
  30. package/es/LoaderApp/index.js +26 -22
  31. package/es/LoaderApp/loader.js +2 -6
  32. package/es/LoaderApp/utils.d.ts +1 -0
  33. package/es/LoaderApp/utils.js +37 -0
  34. package/es/Modal/index.d.ts +27 -0
  35. package/es/Modal/index.js +155 -1
  36. package/es/Picture/component/DefaultRects/RectInfo.d.ts +1 -0
  37. package/es/Picture/component/DefaultRects/index.d.ts +2 -1
  38. package/es/Picture/component/DrawRect/index.d.ts +3 -4
  39. package/es/Picture/component/MoveContent/index.js +16 -12
  40. package/es/Picture/component/RectMenu/index.d.ts +2 -3
  41. package/es/Picture/component/Tools/index.js +0 -5
  42. package/es/Picture/component/WheelScale/index.d.ts +1 -0
  43. package/es/Picture/component/WheelScale/index.js +3 -3
  44. package/es/Picture/index.d.ts +1 -0
  45. package/es/Picture/index.js +4 -2
  46. package/es/Picture/interface.d.ts +4 -2
  47. package/es/Picture/utils.d.ts +1 -0
  48. package/es/Player/api/index.d.ts +71 -0
  49. package/es/Player/api/index.js +284 -0
  50. package/es/Player/contraller_bar/bar.d.ts +8 -0
  51. package/es/Player/contraller_bar/bar.js +21 -0
  52. package/es/Player/contraller_bar/contraller_event.d.ts +9 -0
  53. package/es/{RefModal/index.js → Player/contraller_bar/contraller_event.js} +39 -54
  54. package/es/Player/contraller_bar/index.d.ts +19 -0
  55. package/es/Player/contraller_bar/index.js +37 -0
  56. package/es/Player/contraller_bar/left_bar.d.ts +15 -0
  57. package/es/Player/contraller_bar/left_bar.js +91 -0
  58. package/es/Player/contraller_bar/right_bar.d.ts +13 -0
  59. package/es/Player/contraller_bar/right_bar.js +55 -0
  60. package/es/Player/contraller_bar/useBarStatus.d.ts +3 -0
  61. package/es/{RefDrawer/index.js → Player/contraller_bar/useBarStatus.js} +27 -46
  62. package/es/Player/demo.d.ts +2 -0
  63. package/es/Player/demo.js +269 -0
  64. package/es/Player/event/browserTabEvent.d.ts +9 -0
  65. package/es/Player/event/browserTabEvent.js +57 -0
  66. package/es/Player/event/errorEvent.d.ts +16 -0
  67. package/es/Player/event/errorEvent.js +120 -0
  68. package/es/Player/event/eventName.d.ts +3 -0
  69. package/es/Player/event/eventName.js +15 -0
  70. package/es/Player/event/index.d.ts +22 -0
  71. package/es/Player/event/index.js +175 -0
  72. package/es/Player/frontend_player.d.ts +15 -0
  73. package/es/Player/frontend_player.js +90 -0
  74. package/es/Player/frontend_timeline.d.ts +14 -0
  75. package/es/Player/frontend_timeline.js +138 -0
  76. package/es/Player/iconfont.d.ts +13 -0
  77. package/es/Player/iconfont.js +18 -0
  78. package/es/Player/index.d.ts +8 -0
  79. package/es/Player/index.js +8 -0
  80. package/es/Player/live_heart.d.ts +6 -0
  81. package/es/Player/live_heart.js +29 -0
  82. package/es/Player/message.d.ts +11 -0
  83. package/es/Player/message.js +150 -0
  84. package/es/Player/player.d.ts +75 -0
  85. package/es/Player/segment_player.d.ts +13 -0
  86. package/es/Player/segment_player.js +191 -0
  87. package/es/Player/segment_timeline.d.ts +16 -0
  88. package/es/Player/segment_timeline.js +154 -0
  89. package/es/Player/single_player.d.ts +5 -0
  90. package/es/Player/single_player.js +185 -0
  91. package/es/Player/style/bar.css +37 -0
  92. package/es/Player/style/iconfont.css +62 -0
  93. package/es/Player/style/index.css +22 -0
  94. package/es/Player/style/message.css +49 -0
  95. package/es/Player/style/slider.css +96 -0
  96. package/es/Player/style/timeline.css +92 -0
  97. package/es/Player/timeline.d.ts +11 -0
  98. package/es/Player/timeline.js +104 -0
  99. package/es/Player/util.d.ts +48 -0
  100. package/es/Player/util.js +172 -0
  101. package/es/Progress/index.d.ts +1 -0
  102. package/es/SegmentPlayer/index.d.ts +2 -0
  103. package/es/SegmentPlayer/index.js +2 -0
  104. package/es/Service/fetch-adapter.d.ts +12 -0
  105. package/es/Service/fetch-adapter.js +184 -0
  106. package/es/Service/http.d.ts +1 -1
  107. package/es/Service/http.js +4 -2
  108. package/es/Service/interface.d.ts +2 -1
  109. package/es/Tree/BaseTree/demo.d.ts +1 -0
  110. package/es/Tree/BaseTree/demo.js +3 -1
  111. package/es/Tree/BaseTree/index.d.ts +2 -2
  112. package/es/Tree/demo.d.ts +1 -0
  113. package/es/Tree/index.js +1 -1
  114. package/es/UserSelect/demo.d.ts +1 -0
  115. package/es/WorkerFlow/Form/Approver.d.ts +1 -0
  116. package/es/WorkerFlow/Form/Condition.d.ts +1 -0
  117. package/es/WorkerFlow/Form/Condition.js +2 -1
  118. package/es/WorkerFlow/Form/EmptyUserSet.d.ts +1 -0
  119. package/es/WorkerFlow/Form/EmptyUserSet.js +2 -1
  120. package/es/WorkerFlow/Form/FormAuth.d.ts +1 -0
  121. package/es/WorkerFlow/Form/GroupList.d.ts +1 -0
  122. package/es/WorkerFlow/Form/GroupSelect.d.ts +1 -0
  123. package/es/WorkerFlow/Form/GroupSelect.js +2 -1
  124. package/es/WorkerFlow/Form/Handle.d.ts +1 -0
  125. package/es/WorkerFlow/Form/LevelGroupSelect.d.ts +1 -0
  126. package/es/WorkerFlow/Form/LevelGroupSelect.js +2 -1
  127. package/es/WorkerFlow/Form/Notifier.d.ts +1 -0
  128. package/es/WorkerFlow/Form/UserAndGroupSelect.d.ts +1 -0
  129. package/es/WorkerFlow/Form/UserAndGroupSelect.js +2 -1
  130. package/es/WorkerFlow/Form/UserSelect.d.ts +1 -0
  131. package/es/WorkerFlow/Form/UserSelect.js +2 -1
  132. package/es/WorkerFlow/Form/UserSet.d.ts +1 -0
  133. package/es/WorkerFlow/Form/UsersHandleType.d.ts +1 -0
  134. package/es/WorkerFlow/Nodes/Add.d.ts +1 -0
  135. package/es/WorkerFlow/Nodes/Add.js +1 -1
  136. package/es/WorkerFlow/Nodes/AddOption.d.ts +1 -0
  137. package/es/WorkerFlow/Nodes/AddOptionList.d.ts +1 -0
  138. package/es/WorkerFlow/Nodes/Approver.d.ts +1 -0
  139. package/es/WorkerFlow/Nodes/Condition.d.ts +1 -0
  140. package/es/WorkerFlow/Nodes/End.d.ts +1 -0
  141. package/es/WorkerFlow/Nodes/Handle.d.ts +1 -0
  142. package/es/WorkerFlow/Nodes/Node.d.ts +1 -0
  143. package/es/WorkerFlow/Nodes/Notifier.d.ts +1 -0
  144. package/es/WorkerFlow/Nodes/Render.d.ts +1 -0
  145. package/es/WorkerFlow/Nodes/Start.d.ts +1 -0
  146. package/es/WorkerFlow/Nodes/TitleElement.d.ts +1 -0
  147. package/es/WorkerFlow/Nodes/TitleElement.js +6 -2
  148. package/es/WorkerFlow/index.js +2 -1
  149. package/es/index.d.ts +5 -8
  150. package/es/index.js +6 -9
  151. package/es/typings.d.ts +1 -0
  152. package/package.json +15 -10
  153. package/tsconfig.json +3 -2
  154. package/typings/global.d.ts +4 -0
  155. package/es/AppRedirect/index.css +0 -0
  156. package/es/AppRedirect/index.d.ts +0 -16
  157. package/es/AppRedirect/index.js +0 -33
  158. package/es/AppRouter/index.d.ts +0 -8
  159. package/es/AppRouter/index.js +0 -17
  160. package/es/RefDrawer/index.d.ts +0 -15
  161. package/es/RefModal/index.d.ts +0 -15
  162. package/es/useDrawer/index.d.ts +0 -14
  163. package/es/useDrawer/index.js +0 -91
  164. package/es/useModal/index.d.ts +0 -14
  165. package/es/useModal/index.js +0 -93
  166. package/typings.d.ts +0 -2
@@ -1,3 +1,5 @@
1
+ import _useUnmount from "ahooks/es/useUnmount";
2
+ import _useMount from "ahooks/es/useMount";
1
3
  import _uuid from "@cloud-app-dev/utils/es/uuid";
2
4
 
3
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -13,7 +15,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
13
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
16
 
15
17
  import { __awaiter } from "tslib";
16
- import React, { useRef, useEffect, useState, useMemo } from 'react';
18
+ import React, { useRef, useState, useMemo } from 'react';
17
19
  import { getMicroConfig } from './utils';
18
20
  import LoaderModule from './loader';
19
21
  import "./index.css";
@@ -36,8 +38,7 @@ function LoaderApp(_ref) {
36
38
  status = _useState2[0],
37
39
  setStatus = _useState2[1];
38
40
 
39
- useEffect(function () {
40
- var app;
41
+ _useMount(function () {
41
42
  var config = getMicroConfig(appConfig, appProps, domRef.current);
42
43
 
43
44
  if (!config) {
@@ -72,26 +73,25 @@ function LoaderApp(_ref) {
72
73
  while (1) {
73
74
  switch (_context.prev = _context.next) {
74
75
  case 0:
75
- app = mod;
76
76
  loadedAppRef.current = mod;
77
77
 
78
78
  if (!status) {
79
- _context.next = 5;
79
+ _context.next = 4;
80
80
  break;
81
81
  }
82
82
 
83
- _context.next = 5;
84
- return app.bootstrap(props);
83
+ _context.next = 4;
84
+ return mod.bootstrap(props);
85
85
 
86
- case 5:
86
+ case 4:
87
87
  setStatus('bootstrap');
88
- _context.next = 8;
89
- return app.mount(props);
88
+ _context.next = 7;
89
+ return mod.mount(props);
90
90
 
91
- case 8:
91
+ case 7:
92
92
  setStatus('mount');
93
93
 
94
- case 9:
94
+ case 8:
95
95
  case "end":
96
96
  return _context.stop();
97
97
  }
@@ -99,16 +99,20 @@ function LoaderApp(_ref) {
99
99
  }, _callee);
100
100
  }));
101
101
  });
102
- return function () {
103
- console.debug('LoaderApp is destory!');
104
-
105
- if (app) {
106
- app.unmount(props);
107
- setStatus('unmount');
108
- app = null;
109
- }
110
- };
111
- }, []);
102
+ });
103
+
104
+ _useUnmount(function () {
105
+ if (loadedAppRef.current) {
106
+ var app = loadedAppRef.current;
107
+ var props = Object.assign(Object.assign({}, appProps), {
108
+ container: domRef.current
109
+ });
110
+ app.unmount(props);
111
+ setStatus('unmount');
112
+ loadedAppRef.current = null;
113
+ }
114
+ });
115
+
112
116
  return /*#__PURE__*/React.createElement("main", {
113
117
  ref: domRef,
114
118
  className: "loaded-app-layout ".concat(appConfig.routerPrefix, "-").concat(id),
@@ -1,5 +1,5 @@
1
1
  import { __awaiter } from "tslib";
2
- import { arrayify, rewrite } from './utils';
2
+ import { arrayify, fetchStyle, rewrite } from './utils';
3
3
  var _global = window;
4
4
  export function createScopedCssText(_ref) {
5
5
  var styleNode = _ref.styleNode,
@@ -27,11 +27,7 @@ export function LoaderStyle(_ref2) {
27
27
  }
28
28
 
29
29
  _context.next = 3;
30
- return fetch(style).then(function (r) {
31
- return r.text();
32
- }).catch(function () {
33
- return '';
34
- });
30
+ return fetchStyle(style);
35
31
 
36
32
  case 3:
37
33
  cssText = _context.sent;
@@ -10,5 +10,6 @@ export declare const getMicroConfig: (appConfig: AppItemType, appProps: any, con
10
10
  html: string;
11
11
  };
12
12
  };
13
+ export declare function fetchStyle(style: string): Promise<string>;
13
14
  export declare const arrayify: <T>(list: CSSRuleList | any[]) => T[];
14
15
  export declare function rewrite(rules: CSSRule[], prefix?: string): string;
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from "tslib";
1
2
  export var getMicroConfig = function getMicroConfig() {
2
3
  var appConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3
4
  var appProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -18,6 +19,42 @@ export var getMicroConfig = function getMicroConfig() {
18
19
  entry: microAppEntry
19
20
  };
20
21
  };
22
+ var styleCache = {};
23
+ export function fetchStyle(style) {
24
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
25
+ var cssText;
26
+ return regeneratorRuntime.wrap(function _callee$(_context) {
27
+ while (1) {
28
+ switch (_context.prev = _context.next) {
29
+ case 0:
30
+ if (!styleCache[style]) {
31
+ _context.next = 2;
32
+ break;
33
+ }
34
+
35
+ return _context.abrupt("return", styleCache[style]);
36
+
37
+ case 2:
38
+ _context.next = 4;
39
+ return fetch(style).then(function (r) {
40
+ return r.text();
41
+ }).catch(function () {
42
+ return '';
43
+ });
44
+
45
+ case 4:
46
+ cssText = _context.sent;
47
+ styleCache[style] = cssText;
48
+ return _context.abrupt("return", cssText);
49
+
50
+ case 7:
51
+ case "end":
52
+ return _context.stop();
53
+ }
54
+ }
55
+ }, _callee);
56
+ }));
57
+ }
21
58
  var RuleType = {
22
59
  // type: rule will be rewrote
23
60
  STYLE: 1,
@@ -1,4 +1,5 @@
1
1
  import { ModalProps } from './interface';
2
+ import React from 'react';
2
3
  import './index.less';
3
4
  declare function Modal({ children, className, style, getContainer, ...props }: ModalProps): JSX.Element;
4
5
  declare namespace Modal {
@@ -13,5 +14,31 @@ declare namespace Modal {
13
14
  var warning: import("antd/lib/modal/confirm").ModalFunc;
14
15
  var confirm: import("antd/lib/modal/confirm").ModalFunc;
15
16
  var destroyAll: () => void;
17
+ var useModal: (prefixCls?: string) => {
18
+ open: (options: IUseModalHookState) => void;
19
+ close: () => void;
20
+ };
21
+ var useAntdModal: typeof import("antd/lib/modal/useModal").default;
22
+ var RefModal: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<IRefModalMethodsProps>>;
23
+ }
24
+ export interface IUseModalHookState {
25
+ content?: React.ReactNode;
26
+ visible?: boolean;
27
+ title?: React.ReactNode;
28
+ onOk?: () => void;
29
+ width?: number | string;
30
+ className?: string;
31
+ }
32
+ export interface IUseModalHookState {
33
+ content?: React.ReactNode;
34
+ visible?: boolean;
35
+ title?: React.ReactNode;
36
+ onOk?: () => void;
37
+ width?: number | string;
38
+ className?: string;
39
+ }
40
+ export interface IRefModalMethodsProps {
41
+ open: (options: IUseModalHookState) => void;
42
+ close: () => void;
16
43
  }
17
44
  export default Modal;
package/es/Modal/index.js CHANGED
@@ -1,8 +1,26 @@
1
+ import "antd/lib/config-provider/style";
2
+ import _ConfigProvider from "antd/lib/config-provider";
1
3
  import "antd/lib/modal/style";
2
4
  import _Modal from "antd/lib/modal";
5
+
6
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
+
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
+
10
+ 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); }
11
+
12
+ 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; }
13
+
14
+ 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; }
15
+
16
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
+
3
18
  import { __rest } from "tslib";
4
- import React from 'react';
19
+ import React, { useContext, useEffect, useImperativeHandle, useMemo, useState } from 'react';
20
+ import * as ReactDOMClient from 'react-dom/client';
21
+ import CC from '../ConfigContext';
5
22
  import "./index.css";
23
+ import ConfigContext from '../ConfigContext';
6
24
 
7
25
  function Modal(_a) {
8
26
  var children = _a.children,
@@ -24,6 +42,139 @@ Modal.defaultProps = {
24
42
  className: '',
25
43
  getContainer: false
26
44
  };
45
+
46
+ function useModal() {
47
+ var prefixCls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'cloudapp';
48
+ var context = useContext(CC.Context);
49
+ var container = useMemo(function () {
50
+ var _a;
51
+
52
+ return (_a = context === null || context === void 0 ? void 0 : context.root) !== null && _a !== void 0 ? _a : document.body;
53
+ }, [context === null || context === void 0 ? void 0 : context.root]);
54
+ var div = useMemo(function () {
55
+ return document.createElement('div');
56
+ }, []);
57
+
58
+ var _useState = useState({
59
+ content: null,
60
+ visible: false,
61
+ title: '',
62
+ onOk: undefined,
63
+ width: undefined,
64
+ className: undefined
65
+ }),
66
+ _useState2 = _slicedToArray(_useState, 2),
67
+ state = _useState2[0],
68
+ setState = _useState2[1];
69
+
70
+ var root = useMemo(function () {
71
+ return ReactDOMClient.createRoot(div);
72
+ }, []);
73
+ useEffect(function () {
74
+ container.appendChild(div);
75
+ return function () {
76
+ setTimeout(function () {
77
+ return root.unmount(), div.remove();
78
+ }, 100);
79
+ };
80
+ }, []);
81
+ useEffect(function () {
82
+ root.render( /*#__PURE__*/React.createElement(_ConfigProvider, {
83
+ prefixCls: prefixCls,
84
+ getPopupContainer: function getPopupContainer() {
85
+ return container;
86
+ }
87
+ }, /*#__PURE__*/React.createElement(Modal, {
88
+ okText: "\u786E\u5B9A",
89
+ cancelText: "\u53D6\u6D88",
90
+ visible: state.visible,
91
+ onOk: state.onOk,
92
+ onCancel: close,
93
+ destroyOnClose: true,
94
+ title: state.title,
95
+ width: state.width,
96
+ className: state.className,
97
+ getContainer: false
98
+ }, state.content)));
99
+ }, [state.content, state.visible, state.title, state.onOk, state.width, state.className]);
100
+
101
+ var open = function open(options) {
102
+ setState(function (old) {
103
+ return Object.assign(Object.assign(Object.assign({}, old), options), {
104
+ visible: true
105
+ });
106
+ });
107
+ };
108
+
109
+ var close = function close() {
110
+ setState(function (old) {
111
+ return Object.assign(Object.assign({}, old), {
112
+ visible: false
113
+ });
114
+ });
115
+ };
116
+
117
+ return {
118
+ open: open,
119
+ close: close
120
+ };
121
+ }
122
+
123
+ var RefModal = /*#__PURE__*/React.forwardRef(function RefModal(_, ref) {
124
+ var context = useContext(ConfigContext.Context);
125
+ var root = useMemo(function () {
126
+ return (context === null || context === void 0 ? void 0 : context.root) || document.body;
127
+ }, [context === null || context === void 0 ? void 0 : context.root]);
128
+
129
+ var _useState3 = useState({
130
+ content: null,
131
+ visible: false,
132
+ title: '',
133
+ onOk: undefined,
134
+ width: undefined,
135
+ className: undefined
136
+ }),
137
+ _useState4 = _slicedToArray(_useState3, 2),
138
+ state = _useState4[0],
139
+ setState = _useState4[1];
140
+
141
+ var open = function open(options) {
142
+ setState(function (old) {
143
+ return Object.assign(Object.assign(Object.assign({}, old), options), {
144
+ visible: true
145
+ });
146
+ });
147
+ };
148
+
149
+ var close = function close() {
150
+ setState(function (old) {
151
+ return Object.assign(Object.assign({}, old), {
152
+ visible: false
153
+ });
154
+ });
155
+ };
156
+
157
+ useImperativeHandle(ref, function () {
158
+ return {
159
+ open: open,
160
+ close: close
161
+ };
162
+ }, [state]);
163
+ return /*#__PURE__*/React.createElement(Modal, {
164
+ okText: "\u786E\u5B9A",
165
+ cancelText: "\u53D6\u6D88",
166
+ visible: state.visible,
167
+ onOk: state.onOk,
168
+ onCancel: close,
169
+ destroyOnClose: true,
170
+ title: state.title,
171
+ width: state.width,
172
+ className: state.className,
173
+ getContainer: function getContainer() {
174
+ return root;
175
+ }
176
+ }, state.content);
177
+ });
27
178
  Modal.info = _Modal.info;
28
179
  Modal.success = _Modal.success;
29
180
  Modal.error = _Modal.error;
@@ -31,4 +182,7 @@ Modal.warn = _Modal.warn;
31
182
  Modal.warning = _Modal.warning;
32
183
  Modal.confirm = _Modal.confirm;
33
184
  Modal.destroyAll = _Modal.destroyAll;
185
+ Modal.useModal = useModal;
186
+ Modal.useAntdModal = _Modal.useModal;
187
+ Modal.RefModal = RefModal;
34
188
  export default Modal;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { RectType } from '../../interface';
2
3
  interface IRectInfoProps {
3
4
  item: RectType;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { RectType } from '../../interface';
2
3
  import './index.less';
3
4
  interface IDefaultRectsProps {
@@ -6,7 +7,7 @@ interface IDefaultRectsProps {
6
7
  onClickRect?: (item: RectType & {
7
8
  base64: string;
8
9
  }) => void;
9
- getRectImage: (rect: number[]) => void;
10
+ getRectImage: (rect: number[]) => string;
10
11
  }
11
12
  declare function DefaultRects({ rects, containerDom, onClickRect, getRectImage }: IDefaultRectsProps): JSX.Element;
12
13
  export default DefaultRects;
@@ -1,14 +1,13 @@
1
+ /// <reference types="react" />
1
2
  import { MenuRectType } from '../../interface';
2
3
  import './index.less';
3
4
  interface IDrawRectProps {
4
5
  rect: number[];
5
6
  canRenderMenu?: boolean;
6
7
  containerDom: HTMLDivElement;
7
- onMenuClick: (options: MenuRectType & {
8
- base64: string;
9
- }) => void;
8
+ onMenuClick: (options: MenuRectType) => void;
10
9
  menus: MenuRectType[];
11
- getRectImage: (rect: number[]) => void;
10
+ getRectImage: (rect: number[]) => string;
12
11
  }
13
12
  declare function DrawRect({ rect, canRenderMenu, containerDom, onMenuClick, menus, getRectImage }: IDrawRectProps): JSX.Element;
14
13
  export default DrawRect;
@@ -36,7 +36,23 @@ var MoveContentView = /*#__PURE__*/function (_React$Component) {
36
36
  _classCallCheck(this, MoveContentView);
37
37
 
38
38
  _this = _super.call(this, props);
39
+ _this.position = {
40
+ x: 0,
41
+ y: 0
42
+ };
43
+ _this.DA = {
44
+ x: 0,
45
+ y: 0
46
+ };
47
+ _this.moveEvents = [];
48
+ _this.isDrag = false;
39
49
  _this.dragRef = /*#__PURE__*/React.createRef();
50
+ _this.deviation = {
51
+ offsetX: 0,
52
+ offsetY: 0,
53
+ width: 0,
54
+ height: 0
55
+ };
40
56
 
41
57
  _this.onMouseMove = function (event) {
42
58
  if (_this.isDrag) {
@@ -104,18 +120,6 @@ var MoveContentView = /*#__PURE__*/function (_React$Component) {
104
120
  }
105
121
  };
106
122
 
107
- _this.isDrag = false;
108
- _this.DA = {
109
- x: 0,
110
- y: 0
111
- };
112
- _this.moveEvents = [];
113
- _this.deviation = {
114
- offsetX: 0,
115
- offsetY: 0,
116
- width: 0,
117
- height: 0
118
- };
119
123
  return _this;
120
124
  }
121
125
 
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  import { MenuRectType } from 'src/Picture/interface';
3
4
  interface IRectMenuProps {
@@ -5,9 +6,7 @@ interface IRectMenuProps {
5
6
  y: number;
6
7
  menus: MenuRectType[];
7
8
  containerDom: HTMLDivElement;
8
- onMenuClick: (options: MenuRectType & {
9
- base64: string;
10
- }) => void;
9
+ onMenuClick: (options: MenuRectType) => void;
11
10
  }
12
11
  declare function RectMenu({ x, y, menus, containerDom, onMenuClick }: IRectMenuProps): JSX.Element;
13
12
  export default RectMenu;
@@ -72,11 +72,6 @@ function Tools(_ref) {
72
72
  return containerEle;
73
73
  },
74
74
  fullScreenChange: fullScreenChange
75
- }, function (isFullscreen) {
76
- return /*#__PURE__*/React.createElement(IconFont, {
77
- title: !isFullscreen ? '全屏' : '退出全屏',
78
- type: !isFullscreen ? 'icon-S_View_ScreenViewFull' : 'icon-S_View_ScreenViewExit'
79
- });
80
75
  }))));
81
76
  }
82
77
 
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface IWheelScaleProps {
2
3
  dom: HTMLElement;
3
4
  setScale: (scale: number) => void;
@@ -13,14 +13,14 @@ function WheelScale(_ref) {
13
13
 
14
14
  useEffect(function () {
15
15
  if (!dom) {
16
- return null;
16
+ return undefined;
17
17
  }
18
18
 
19
- dom.addEventListener('mousewheel', onWheel, {
19
+ dom.addEventListener('wheel', onWheel, {
20
20
  passive: false
21
21
  });
22
22
  return function () {
23
- return dom.removeEventListener('mousewheel', onWheel);
23
+ return dom.removeEventListener('wheel', onWheel);
24
24
  };
25
25
  }, [dom, onWheel]);
26
26
  return /*#__PURE__*/React.createElement(React.Fragment, null);
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IPictureProps } from './interface';
2
3
  import './index.less';
3
4
  declare function Picture({ className, width, height, minHeight, disabledDrag, imagePath, rects, isOpenSelect, disabledDrawMenu, menus, hasTool, fullScreenEle, ...props }: IPictureProps): JSX.Element;
@@ -152,7 +152,7 @@ function Picture(_a) {
152
152
  */
153
153
 
154
154
  var resetPicture = useCallback(function (event) {
155
- event.stopPropagation(event);
155
+ event.stopPropagation();
156
156
  setState(function (old) {
157
157
  return Object.assign(Object.assign({}, old), {
158
158
  scale: 1,
@@ -304,7 +304,9 @@ function Picture(_a) {
304
304
  draggable: false,
305
305
  src: imagePath,
306
306
  key: imagePath,
307
- onLoad: loadImageSuccess
307
+ onLoad: function onLoad() {
308
+ return loadImageSuccess();
309
+ }
308
310
  }), !isEmpty ? /*#__PURE__*/React.createElement(DrawRect, {
309
311
  rect: selectArea,
310
312
  onMenuClick: onMenuClick,
@@ -4,6 +4,7 @@ export type MenuRectType = {
4
4
  pathname: string;
5
5
  title: string;
6
6
  icon: string;
7
+ base64?: string;
7
8
  };
8
9
 
9
10
  export type TagItemType = {
@@ -28,6 +29,7 @@ export type RectType = {
28
29
  feature?: string;
29
30
  dupId?: string;
30
31
  lowQuality?: boolean;
32
+ base64?: string;
31
33
  };
32
34
 
33
35
  export type PositionType = {
@@ -59,8 +61,8 @@ export interface IPictureProps {
59
61
  disabledDrawMenu?: false;
60
62
  menus?: MenuRectType[];
61
63
  imgDownload?: () => void;
62
- onClickRect?: (item: RectType & { base64: string }) => void;
63
- onMenuClick?: (item: MenuRectType & { base64: string }) => void;
64
+ onClickRect?: (item: RectType) => void;
65
+ onMenuClick?: (item: MenuRectType) => void;
64
66
  children?: (option: any) => void;
65
67
  hasTool?: boolean;
66
68
  fullScreenEle?: Element;
@@ -18,5 +18,6 @@ export declare function computedRectScale({ imageSource, domImg, rects }: {
18
18
  feature?: string;
19
19
  dupId?: string;
20
20
  lowQuality?: boolean;
21
+ base64?: string;
21
22
  }[];
22
23
  export declare function getCaptureRect(rect: number[], type: ImageType): number[];
@@ -0,0 +1,71 @@
1
+ import flvjs from 'flv.zv.js';
2
+ import Hls, { HlsConfig } from 'hls.js';
3
+ import type { FlvPlayerConfig } from '../player';
4
+ declare class Api {
5
+ container: HTMLElement;
6
+ constructor(container: HTMLElement);
7
+ get video(): HTMLVideoElement;
8
+ /**
9
+ * 全屏
10
+ */
11
+ requestFullScreen: () => void;
12
+ /**
13
+ * 退出全屏
14
+ */
15
+ cancelFullScreen: () => void;
16
+ play: () => void;
17
+ pause: () => void;
18
+ /**
19
+ * 设置currentTime实现seek
20
+ * @param {*} seconds
21
+ * @param {*} noEmit
22
+ */
23
+ seekTo: (seconds: number) => void;
24
+ setVolume: (fraction: number) => void;
25
+ mute: () => void;
26
+ unmute: () => void;
27
+ /**
28
+ * 开启画中画功能
29
+ */
30
+ requestPictureInPicture: () => void;
31
+ /**
32
+ * 关闭画中画功能
33
+ */
34
+ exitPictureInPicture: () => void;
35
+ /**
36
+ * 设置播放速率
37
+ * @param {*} rate
38
+ */
39
+ setPlaybackRate: (rate: number) => void;
40
+ /**
41
+ * 获取视频总时长
42
+ */
43
+ getDuration: () => number;
44
+ /**
45
+ * 获取当前播放时间
46
+ */
47
+ getCurrentTime: () => number;
48
+ /**
49
+ * 获取缓存时间
50
+ */
51
+ getSecondsLoaded: () => any;
52
+ /**
53
+ * 获取当前视频缓存的起止时间
54
+ */
55
+ getBufferedTime: () => number | number[];
56
+ /**
57
+ * 视频截屏方法
58
+ */
59
+ snapshot: () => string;
60
+ unload: () => void;
61
+ reload: () => void;
62
+ destroy: () => void;
63
+ }
64
+ export declare type TypeAndPlay = {
65
+ type?: string;
66
+ flv?: flvjs.Player;
67
+ hls?: Hls;
68
+ };
69
+ export declare function useTypeAndPlay(url?: string, type?: string, isLive?: boolean, container?: HTMLElement, segments?: flvjs.MediaSegment[], flvConfig?: FlvPlayerConfig, hlsConfig?: HlsConfig): [string, flvjs.Player, Hls];
70
+ export declare function usePlayerApi(url?: string, type?: string, isLive?: boolean, container?: HTMLElement, segments?: flvjs.MediaSegment[], flvConfig?: FlvPlayerConfig, hlsConfig?: HlsConfig): [Api, [string, flvjs.Player, Hls]];
71
+ export default Api;