@cloud-app-dev/vidc 2.1.0-alpha.9 → 2.2.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.umirc.ts +3 -4
- package/es/Api/index.js +1 -1
- package/es/AppContext/Sync.d.ts +1 -0
- package/es/AppContext/interface.d.ts +4 -1
- package/es/CheckGroupFixed/index.d.ts +1 -0
- package/es/DeviceSelect/TreeType.d.ts +1 -0
- package/es/DeviceSelect/demo.d.ts +1 -0
- package/es/DeviceSelect/index.d.ts +1 -0
- package/es/DeviceSelect/index.js +2 -2
- package/es/Drag/DragAndDropItem.js +2 -2
- package/es/Drag/DropItem.js +2 -2
- package/es/Drawer/Demo.js +24 -3
- package/es/Drawer/Footer.d.ts +1 -0
- package/es/Drawer/index.d.ts +29 -3
- package/es/Drawer/index.js +155 -4
- package/es/FrontendPlayer/index.d.ts +2 -0
- package/es/FrontendPlayer/index.js +2 -0
- package/es/FullScreen/index.d.ts +3 -3
- package/es/FullScreen/index.js +18 -42
- package/es/HightLevel/index.js +1 -1
- package/es/InitialConfig/utils.d.ts +5 -5
- package/es/InitialConfig/utils.js +19 -19
- package/es/Input/index.d.ts +1 -0
- package/es/List/CheckExt.d.ts +1 -0
- package/es/List/DeviceList/index.js +1 -1
- package/es/List/DynamicDeviceList/Demo.d.ts +1 -0
- package/es/List/DynamicDeviceList/index.d.ts +1 -0
- package/es/List/GridList/index.js +0 -1
- package/es/List/VList/index.d.ts +1 -0
- package/es/List/index.d.ts +1 -0
- package/es/LoaderApp/loader.js +2 -6
- package/es/LoaderApp/utils.d.ts +1 -0
- package/es/LoaderApp/utils.js +37 -0
- package/es/Modal/index.d.ts +27 -0
- package/es/Modal/index.js +155 -1
- package/es/Picture/component/DefaultRects/RectInfo.d.ts +1 -0
- package/es/Picture/component/DefaultRects/index.d.ts +2 -1
- package/es/Picture/component/DrawRect/index.d.ts +3 -4
- package/es/Picture/component/MoveContent/index.js +18 -14
- package/es/Picture/component/RectMenu/index.d.ts +2 -3
- package/es/Picture/component/Tools/index.js +0 -5
- package/es/Picture/component/WheelScale/index.d.ts +1 -0
- package/es/Picture/component/WheelScale/index.js +3 -3
- package/es/Picture/demo.d.ts +2 -0
- package/es/Picture/demo.js +16 -0
- package/es/Picture/index.d.ts +1 -0
- package/es/Picture/index.js +6 -4
- package/es/Picture/interface.d.ts +4 -2
- package/es/Picture/utils.d.ts +1 -0
- package/es/Picture/utils.js +1 -1
- package/es/Player/api/index.d.ts +71 -0
- package/es/Player/api/index.js +284 -0
- package/es/Player/contraller_bar/bar.d.ts +8 -0
- package/es/Player/contraller_bar/bar.js +21 -0
- package/es/Player/contraller_bar/contraller_event.d.ts +9 -0
- package/es/{RefModal/index.js → Player/contraller_bar/contraller_event.js} +39 -54
- package/es/Player/contraller_bar/index.d.ts +19 -0
- package/es/Player/contraller_bar/index.js +37 -0
- package/es/Player/contraller_bar/left_bar.d.ts +15 -0
- package/es/Player/contraller_bar/left_bar.js +91 -0
- package/es/Player/contraller_bar/right_bar.d.ts +13 -0
- package/es/Player/contraller_bar/right_bar.js +55 -0
- package/es/Player/contraller_bar/useBarStatus.d.ts +3 -0
- package/es/{RefDrawer/index.js → Player/contraller_bar/useBarStatus.js} +27 -46
- package/es/Player/demo.d.ts +2 -0
- package/es/Player/demo.js +269 -0
- package/es/Player/event/browserTabEvent.d.ts +9 -0
- package/es/Player/event/browserTabEvent.js +57 -0
- package/es/Player/event/errorEvent.d.ts +16 -0
- package/es/Player/event/errorEvent.js +120 -0
- package/es/Player/event/eventName.d.ts +3 -0
- package/es/Player/event/eventName.js +15 -0
- package/es/Player/event/index.d.ts +22 -0
- package/es/Player/event/index.js +175 -0
- package/es/Player/frontend_player.d.ts +9 -0
- package/es/Player/frontend_player.js +90 -0
- package/es/Player/frontend_timeline.d.ts +14 -0
- package/es/Player/frontend_timeline.js +138 -0
- package/es/Player/iconfont.d.ts +13 -0
- package/es/Player/iconfont.js +18 -0
- package/es/Player/index.d.ts +2 -0
- package/es/Player/index.js +2 -0
- package/es/Player/live_heart.d.ts +6 -0
- package/es/Player/live_heart.js +29 -0
- package/es/Player/message.d.ts +11 -0
- package/es/Player/message.js +150 -0
- package/es/Player/player.d.ts +90 -0
- package/es/Player/segment_player.d.ts +9 -0
- package/es/Player/segment_player.js +191 -0
- package/es/Player/segment_timeline.d.ts +16 -0
- package/es/Player/segment_timeline.js +154 -0
- package/es/Player/single_player.d.ts +5 -0
- package/es/Player/single_player.js +185 -0
- package/es/Player/style/bar.css +37 -0
- package/es/Player/style/iconfont.css +62 -0
- package/es/Player/style/index.css +22 -0
- package/es/Player/style/message.css +49 -0
- package/es/Player/style/slider.css +96 -0
- package/es/Player/style/timeline.css +92 -0
- package/es/Player/timeline.d.ts +11 -0
- package/es/Player/timeline.js +104 -0
- package/es/Player/util.d.ts +48 -0
- package/es/Player/util.js +172 -0
- package/es/PlayerExt/demo.d.ts +2 -0
- package/es/PlayerExt/demo.js +227 -0
- package/es/PlayerExt/index.css +13 -0
- package/es/PlayerExt/index.d.ts +36 -0
- package/es/PlayerExt/index.js +120 -0
- package/es/Progress/index.d.ts +1 -0
- package/es/SegmentPlayer/index.d.ts +2 -0
- package/es/SegmentPlayer/index.js +2 -0
- package/es/Service/fetch-adapter.d.ts +12 -0
- package/es/Service/fetch-adapter.js +184 -0
- package/es/Service/http.d.ts +1 -1
- package/es/Service/http.js +4 -2
- package/es/Service/interface.d.ts +2 -1
- package/es/Tree/BaseTree/demo.d.ts +1 -0
- package/es/Tree/BaseTree/demo.js +3 -1
- package/es/Tree/BaseTree/index.d.ts +2 -2
- package/es/Tree/demo.d.ts +1 -0
- package/es/Tree/index.js +1 -1
- package/es/UserSelect/demo.d.ts +1 -0
- package/es/UserSelect/index.js +1 -1
- package/es/WorkerFlow/Form/Approver.d.ts +1 -0
- package/es/WorkerFlow/Form/Condition.d.ts +1 -0
- package/es/WorkerFlow/Form/Condition.js +2 -1
- package/es/WorkerFlow/Form/EmptyUserSet.d.ts +1 -0
- package/es/WorkerFlow/Form/EmptyUserSet.js +3 -2
- package/es/WorkerFlow/Form/FormAuth.d.ts +1 -0
- package/es/WorkerFlow/Form/FormAuth.js +1 -1
- package/es/WorkerFlow/Form/GroupList.d.ts +1 -0
- package/es/WorkerFlow/Form/GroupSelect.d.ts +1 -0
- package/es/WorkerFlow/Form/GroupSelect.js +3 -2
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +1 -1
- package/es/WorkerFlow/Form/Handle.d.ts +1 -0
- package/es/WorkerFlow/Form/LevelGroupSelect.d.ts +1 -0
- package/es/WorkerFlow/Form/LevelGroupSelect.js +3 -2
- package/es/WorkerFlow/Form/Notifier.d.ts +1 -0
- package/es/WorkerFlow/Form/UserAndGroupSelect.d.ts +1 -0
- package/es/WorkerFlow/Form/UserAndGroupSelect.js +3 -2
- package/es/WorkerFlow/Form/UserSelect.d.ts +1 -0
- package/es/WorkerFlow/Form/UserSelect.js +3 -2
- package/es/WorkerFlow/Form/UserSelectModalContent.js +1 -1
- package/es/WorkerFlow/Form/UserSet.d.ts +1 -0
- package/es/WorkerFlow/Form/UserSet.js +1 -1
- package/es/WorkerFlow/Form/UsersHandleType.d.ts +1 -0
- package/es/WorkerFlow/Nodes/Add.d.ts +1 -0
- package/es/WorkerFlow/Nodes/Add.js +1 -1
- package/es/WorkerFlow/Nodes/AddOption.d.ts +1 -0
- package/es/WorkerFlow/Nodes/AddOptionList.d.ts +1 -0
- package/es/WorkerFlow/Nodes/Approver.d.ts +1 -0
- package/es/WorkerFlow/Nodes/Condition.d.ts +1 -0
- package/es/WorkerFlow/Nodes/End.d.ts +1 -0
- package/es/WorkerFlow/Nodes/Handle.d.ts +1 -0
- package/es/WorkerFlow/Nodes/Node.d.ts +1 -0
- package/es/WorkerFlow/Nodes/Notifier.d.ts +1 -0
- package/es/WorkerFlow/Nodes/Render.d.ts +1 -0
- package/es/WorkerFlow/Nodes/Start.d.ts +1 -0
- package/es/WorkerFlow/Nodes/TitleElement.d.ts +1 -0
- package/es/WorkerFlow/Nodes/TitleElement.js +6 -2
- package/es/WorkerFlow/index.js +3 -2
- package/es/WorkerFlow/utils.js +1 -1
- package/es/index.d.ts +6 -8
- package/es/index.js +7 -9
- package/es/typings.d.ts +1 -0
- package/package.json +17 -13
- package/tsconfig.json +4 -3
- package/typings/global.d.ts +4 -0
- package/es/AppRedirect/index.css +0 -0
- package/es/AppRedirect/index.d.ts +0 -16
- package/es/AppRedirect/index.js +0 -33
- package/es/AppRouter/index.d.ts +0 -8
- package/es/AppRouter/index.js +0 -17
- package/es/RefDrawer/index.d.ts +0 -15
- package/es/RefModal/index.d.ts +0 -15
- package/es/useDrawer/index.d.ts +0 -14
- package/es/useDrawer/index.js +0 -91
- package/es/useModal/index.d.ts +0 -14
- package/es/useModal/index.js +0 -93
- package/typings.d.ts +0 -2
|
@@ -14,7 +14,6 @@ function GridList(props, ref) {
|
|
|
14
14
|
useImperativeHandle(ref, function () {
|
|
15
15
|
return containerRef.current;
|
|
16
16
|
}, []);
|
|
17
|
-
console.log(renderData);
|
|
18
17
|
return /*#__PURE__*/React.createElement("div", {
|
|
19
18
|
ref: containerRef,
|
|
20
19
|
className: "cloudapp-grid-list ".concat(props.className || '')
|
package/es/List/VList/index.d.ts
CHANGED
package/es/List/index.d.ts
CHANGED
package/es/LoaderApp/loader.js
CHANGED
|
@@ -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
|
|
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;
|
package/es/LoaderApp/utils.d.ts
CHANGED
|
@@ -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;
|
package/es/LoaderApp/utils.js
CHANGED
|
@@ -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,
|
package/es/Modal/index.d.ts
CHANGED
|
@@ -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
|
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[]) =>
|
|
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[]) =>
|
|
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;
|
|
@@ -8,7 +8,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
8
8
|
|
|
9
9
|
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); }
|
|
10
10
|
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
12
|
|
|
13
13
|
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); }; }
|
|
14
14
|
|
|
@@ -18,7 +18,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
18
18
|
|
|
19
19
|
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; } }
|
|
20
20
|
|
|
21
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
22
|
|
|
23
23
|
import React from 'react';
|
|
24
24
|
import addEventListener from 'add-dom-event-listener';
|
|
@@ -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
|
|
|
@@ -13,14 +13,14 @@ function WheelScale(_ref) {
|
|
|
13
13
|
|
|
14
14
|
useEffect(function () {
|
|
15
15
|
if (!dom) {
|
|
16
|
-
return
|
|
16
|
+
return undefined;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
dom.addEventListener('
|
|
19
|
+
dom.addEventListener('wheel', onWheel, {
|
|
20
20
|
passive: false
|
|
21
21
|
});
|
|
22
22
|
return function () {
|
|
23
|
-
return dom.removeEventListener('
|
|
23
|
+
return dom.removeEventListener('wheel', onWheel);
|
|
24
24
|
};
|
|
25
25
|
}, [dom, onWheel]);
|
|
26
26
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "antd/lib/config-provider/style";
|
|
2
|
+
import _ConfigProvider from "antd/lib/config-provider";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Picture from '.';
|
|
5
|
+
export default function App() {
|
|
6
|
+
return /*#__PURE__*/React.createElement(_ConfigProvider, {
|
|
7
|
+
prefixCls: "cloudapp"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
style: {
|
|
10
|
+
width: 800,
|
|
11
|
+
height: 400
|
|
12
|
+
}
|
|
13
|
+
}, /*#__PURE__*/React.createElement(Picture, {
|
|
14
|
+
imagePath: "https://x0.ifengimg.com/cmpp/fck/2020_30/65cca65a549d6c2_w1024_h578.jpg"
|
|
15
|
+
})));
|
|
16
|
+
}
|
package/es/Picture/index.d.ts
CHANGED
|
@@ -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;
|
package/es/Picture/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import Tools from './component/Tools';
|
|
|
23
23
|
import DrawRect from './component/DrawRect';
|
|
24
24
|
import WheelScale from './component/WheelScale';
|
|
25
25
|
import DefaultRects from './component/DefaultRects';
|
|
26
|
-
import { isFunction } from 'lodash';
|
|
26
|
+
import { isFunction } from 'lodash-es';
|
|
27
27
|
import "./index.css";
|
|
28
28
|
|
|
29
29
|
function Picture(_a) {
|
|
@@ -152,7 +152,7 @@ function Picture(_a) {
|
|
|
152
152
|
*/
|
|
153
153
|
|
|
154
154
|
var resetPicture = useCallback(function (event) {
|
|
155
|
-
event.stopPropagation(
|
|
155
|
+
event.stopPropagation();
|
|
156
156
|
setState(function (old) {
|
|
157
157
|
return Object.assign(Object.assign({}, old), {
|
|
158
158
|
scale: 1,
|
|
@@ -187,7 +187,7 @@ function Picture(_a) {
|
|
|
187
187
|
rotate = state.rotate;
|
|
188
188
|
|
|
189
189
|
if (!layoutRef.current) {
|
|
190
|
-
return;
|
|
190
|
+
return undefined;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
var position = computedBound(layoutRef.current, currrentPosition, scale, rotate);
|
|
@@ -304,7 +304,9 @@ function Picture(_a) {
|
|
|
304
304
|
draggable: false,
|
|
305
305
|
src: imagePath,
|
|
306
306
|
key: imagePath,
|
|
307
|
-
onLoad:
|
|
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
|
|
63
|
-
onMenuClick?: (item: MenuRectType
|
|
64
|
+
onClickRect?: (item: RectType) => void;
|
|
65
|
+
onMenuClick?: (item: MenuRectType) => void;
|
|
64
66
|
children?: (option: any) => void;
|
|
65
67
|
hasTool?: boolean;
|
|
66
68
|
fullScreenEle?: Element;
|
package/es/Picture/utils.d.ts
CHANGED
package/es/Picture/utils.js
CHANGED
|
@@ -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;
|