@cloud-app-dev/vidc 2.0.0-alpha.1 → 2.0.0-alpha.13
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 +2 -3
- package/es/Api/index.d.ts +3 -4
- package/es/Api/index.js +7 -8
- package/es/AppRedirect/index.css +0 -0
- package/es/AppRedirect/index.d.ts +16 -0
- package/es/AppRedirect/index.js +34 -0
- package/es/AppRoute/index.d.ts +10 -0
- package/es/AppRoute/index.js +115 -0
- package/es/AppRoute/interface.d.ts +8 -0
- package/es/Auth/index.d.ts +8 -0
- package/es/Auth/index.js +17 -0
- package/es/AutoExit/index.js +15 -10
- package/es/Box/BetweenBox/index.css +5 -0
- package/es/Box/BetweenBox/index.d.ts +12 -0
- package/es/Box/BetweenBox/index.js +24 -0
- package/es/Box/InfoBox/index.css +23 -0
- package/es/Box/InfoBox/index.d.ts +12 -0
- package/es/Box/InfoBox/index.js +26 -0
- package/es/Box/TwoColumnBox/index.css +77 -0
- package/es/Box/TwoColumnBox/index.d.ts +10 -0
- package/es/Box/TwoColumnBox/index.js +50 -0
- package/es/Box/deps/content-grid.d.ts +9 -0
- package/es/Box/deps/content-grid.js +9 -0
- package/es/Box/deps/grid-factory.d.ts +10 -0
- package/es/Box/deps/grid-factory.js +72 -0
- package/es/Box/deps/simple-grid.d.ts +9 -0
- package/es/Box/deps/simple-grid.js +8 -0
- package/es/Box/index.css +9 -0
- package/es/Box/index.d.ts +14 -0
- package/es/Box/index.js +28 -0
- package/es/CheckGroupFixed/index.css +49 -0
- package/es/CheckGroupFixed/index.d.ts +17 -0
- package/es/CheckGroupFixed/index.js +148 -0
- package/es/Config/index.js +63 -6
- package/es/Config/interface.d.ts +30 -5
- package/es/Config/utils.d.ts +2 -11
- package/es/Config/utils.js +1 -12
- package/es/ConfigContext/index.d.ts +3 -0
- package/es/DeviceIcon/icon.js +5 -5
- package/es/DeviceIcon/index.js +2 -2
- package/es/DeviceSelect/TreeType.d.ts +6 -0
- package/es/DeviceSelect/TreeType.js +36 -0
- package/es/DeviceSelect/demo.js +2 -2
- package/es/DeviceSelect/index.css +6 -1
- package/es/DeviceSelect/index.d.ts +5 -0
- package/es/DeviceSelect/index.js +22 -53
- package/es/Dict/cache.d.ts +3 -0
- package/es/Dict/cache.js +21 -0
- package/es/Dict/desc.d.ts +64 -0
- package/es/Dict/desc.js +162 -0
- package/es/Dict/device.d.ts +28 -0
- package/es/Dict/device.js +117 -0
- package/es/Dict/hook.d.ts +4 -0
- package/es/Dict/hook.js +114 -0
- package/es/Dict/index.d.ts +13 -0
- package/es/Dict/index.js +14 -0
- package/es/Dict/interface.d.ts +16 -0
- package/es/Dict/utils.d.ts +11 -0
- package/es/Dict/utils.js +51 -0
- package/es/Drag/DragAndDropItem.d.ts +4 -0
- package/es/Drag/DragAndDropItem.js +145 -0
- package/es/Drag/DropItem.d.ts +4 -0
- package/es/Drag/DropItem.js +54 -0
- package/es/Drag/index.css +0 -0
- package/es/Drag/index.d.ts +7 -0
- package/es/Drag/index.js +7 -0
- package/es/Drag/interface.d.ts +16 -0
- package/es/Drawer/Demo.d.ts +3 -0
- package/es/Drawer/Demo.js +52 -0
- package/es/Drawer/Footer.d.ts +4 -0
- package/es/Drawer/Footer.js +26 -0
- package/es/Drawer/index.css +39 -0
- package/es/Drawer/index.d.ts +12 -0
- package/es/Drawer/index.js +41 -0
- package/es/Drawer/interface.d.ts +191 -0
- package/es/FullScreen/index.css +16 -0
- package/es/FullScreen/index.d.ts +10 -0
- package/es/FullScreen/index.js +68 -0
- package/es/HightLevel/index.css +3 -0
- package/es/HightLevel/index.d.ts +9 -0
- package/es/HightLevel/index.js +23 -0
- package/es/IconFont/index.d.ts +12 -0
- package/es/IconFont/index.js +57 -0
- package/es/ImageView/index.css +6 -0
- package/es/ImageView/index.d.ts +17 -0
- package/es/ImageView/index.js +58 -0
- package/es/InitialConfig/index.js +7 -11
- package/es/InitialConfig/utils.d.ts +1 -1
- package/es/InitialConfig/utils.js +8 -31
- package/es/InitialRequest/index.d.ts +1 -1
- package/es/InitialRequest/index.js +19 -11
- package/es/InitialRequest/utils.d.ts +5 -4
- package/es/InitialRequest/utils.js +58 -94
- package/es/Input/index.css +8 -0
- package/es/Input/index.d.ts +18 -0
- package/es/Input/index.js +76 -0
- package/es/LabelValue/index.css +18 -0
- package/es/LabelValue/index.d.ts +23 -0
- package/es/LabelValue/index.js +32 -0
- package/es/{DynamicDeviceList → List}/CheckExt.d.ts +0 -0
- package/es/{DynamicDeviceList → List}/CheckExt.js +4 -4
- package/es/List/DeviceList/index.css +0 -0
- package/es/List/DeviceList/index.d.ts +11 -0
- package/es/{DeviceList → List/DeviceList}/index.js +8 -20
- package/es/{DynamicDeviceList → List/DynamicDeviceList}/Demo.d.ts +0 -0
- package/es/List/DynamicDeviceList/Demo.js +54 -0
- package/es/{DynamicDeviceList → List/DynamicDeviceList}/index.css +5 -17
- package/es/List/DynamicDeviceList/index.d.ts +11 -0
- package/es/List/DynamicDeviceList/index.js +205 -0
- package/es/List/DynamicDeviceList/interface.d.ts +37 -0
- package/es/List/DynamicDeviceList/utils.d.ts +16 -0
- package/es/List/DynamicDeviceList/utils.js +61 -0
- package/es/List/DynamicGridList/Demo.d.ts +2 -0
- package/es/List/DynamicGridList/Demo.js +70 -0
- package/es/List/DynamicGridList/index.d.ts +26 -0
- package/es/List/DynamicGridList/index.js +73 -0
- package/es/List/GridList/Demo.d.ts +2 -0
- package/es/List/GridList/Demo.js +91 -0
- package/es/List/GridList/hook.d.ts +13 -0
- package/es/List/GridList/hook.js +301 -0
- package/es/List/GridList/index.css +7 -0
- package/es/List/GridList/index.d.ts +15 -0
- package/es/List/GridList/index.js +47 -0
- package/es/List/GridList/interface.d.ts +59 -0
- package/es/List/GridList/utils.d.ts +9 -0
- package/es/List/GridList/utils.js +43 -0
- package/es/List/ListExt/index.css +3 -0
- package/es/List/ListExt/index.d.ts +19 -0
- package/es/List/ListExt/index.js +44 -0
- package/es/List/VList/index.css +6 -0
- package/es/List/VList/index.d.ts +18 -0
- package/es/List/VList/index.js +51 -0
- package/es/List/VList/utils.d.ts +14 -0
- package/es/List/VList/utils.js +17 -0
- package/es/List/index.css +60 -5
- package/es/List/index.d.ts +10 -13
- package/es/List/index.js +170 -36
- package/es/List/interface.d.ts +87 -0
- package/es/List/renderItem.d.ts +20 -0
- package/es/List/renderItem.js +71 -0
- package/es/LoaderApp/index.css +3 -0
- package/es/LoaderApp/index.d.ts +31 -0
- package/es/LoaderApp/index.js +135 -0
- package/es/LoaderApp/interface.d.ts +6 -0
- package/es/LoaderApp/loader.d.ts +20 -0
- package/es/LoaderApp/loader.js +86 -0
- package/es/LoaderApp/utils.d.ts +13 -0
- package/es/LoaderApp/utils.js +121 -0
- package/es/LoaderScript/index.d.ts +26 -0
- package/es/LoaderScript/index.js +127 -0
- package/es/LoaderScript/interface.d.ts +26 -0
- package/es/LoaderScript/utils.d.ts +12 -0
- package/es/LoaderScript/utils.js +133 -0
- package/es/Modal/index.css +43 -0
- package/es/Modal/index.d.ts +17 -0
- package/es/Modal/index.js +34 -0
- package/es/Modal/interface.d.ts +339 -0
- package/es/Picture/component/DefaultRects/RectInfo.d.ts +7 -0
- package/es/Picture/component/DefaultRects/RectInfo.js +94 -0
- package/es/Picture/component/DefaultRects/index.css +247 -0
- package/es/Picture/component/DefaultRects/index.d.ts +12 -0
- package/es/Picture/component/DefaultRects/index.js +47 -0
- package/es/Picture/component/DefaultRects/utils.d.ts +2 -0
- package/es/Picture/component/DefaultRects/utils.js +11 -0
- package/es/Picture/component/DrawRect/index.css +8 -0
- package/es/Picture/component/DrawRect/index.d.ts +14 -0
- package/es/Picture/component/DrawRect/index.js +41 -0
- package/es/Picture/component/MoveContent/index.css +0 -0
- package/es/Picture/component/MoveContent/index.d.ts +39 -0
- package/es/Picture/component/MoveContent/index.js +240 -0
- package/es/Picture/component/MoveContent/utils.d.ts +4 -0
- package/es/Picture/component/MoveContent/utils.js +19 -0
- package/es/Picture/component/RectMenu/index.css +31 -0
- package/es/Picture/component/RectMenu/index.d.ts +13 -0
- package/es/Picture/component/RectMenu/index.js +81 -0
- package/es/Picture/component/RectMenu/utils.d.ts +12 -0
- package/es/Picture/component/RectMenu/utils.js +22 -0
- package/es/Picture/component/Tools/index.css +42 -0
- package/es/Picture/component/Tools/index.d.ts +13 -0
- package/es/Picture/component/Tools/index.js +83 -0
- package/es/Picture/component/WheelScale/index.d.ts +6 -0
- package/es/Picture/component/WheelScale/index.js +29 -0
- package/es/Picture/dragBound.d.ts +5 -0
- package/es/Picture/dragBound.js +77 -0
- package/es/Picture/index.css +12 -0
- package/es/Picture/index.d.ts +16 -0
- package/es/Picture/index.js +344 -0
- package/es/Picture/interface.d.ts +67 -0
- package/es/Picture/loadCaptureRectImage.d.ts +8 -0
- package/es/Picture/loadCaptureRectImage.js +119 -0
- package/es/Picture/useDraw.d.ts +1 -0
- package/es/Picture/useDraw.js +136 -0
- package/es/Picture/utils.d.ts +22 -0
- package/es/Picture/utils.js +90 -0
- package/es/Progress/index.css +20 -0
- package/es/Progress/index.d.ts +11 -0
- package/es/Progress/index.js +68 -0
- package/es/RefDrawer/index.js +4 -5
- package/es/RefModal/index.js +4 -5
- package/es/Service/http.d.ts +1 -1
- package/es/Service/http.js +2 -25
- package/es/TableLayout/index.css +4 -0
- package/es/TableLayout/index.d.ts +13 -0
- package/es/TableLayout/index.js +33 -0
- package/es/ThemeAntd/index.css +501 -0
- package/es/ThemeAntd/index.d.ts +7 -0
- package/es/ThemeAntd/index.js +6 -0
- package/es/ThemeAntd/style/button.css +46 -0
- package/es/ThemeAntd/style/checkbox.css +64 -0
- package/es/ThemeAntd/style/form.css +10 -0
- package/es/ThemeAntd/style/input.css +58 -0
- package/es/ThemeAntd/style/pagination.css +44 -0
- package/es/ThemeAntd/style/picker.css +86 -0
- package/es/ThemeAntd/style/popover.css +3 -0
- package/es/ThemeAntd/style/radio.css +71 -0
- package/es/ThemeAntd/style/scrollbar.css +19 -0
- package/es/ThemeAntd/style/select.css +57 -0
- package/es/ThemeAntd/style/table.css +36 -0
- package/es/ThemeAntd/style/tree.css +4 -0
- package/es/{TreeTitle → Title}/index.css +5 -5
- package/es/{TreeTitle → Title}/index.d.ts +2 -2
- package/es/{TreeTitle → Title}/index.js +9 -6
- package/es/{TreeMode → Tree/BaseTree}/demo.d.ts +0 -0
- package/es/Tree/BaseTree/demo.js +69 -0
- package/es/Tree/BaseTree/index.css +64 -0
- package/es/Tree/BaseTree/index.d.ts +24 -0
- package/es/Tree/BaseTree/index.js +83 -0
- package/es/Tree/demo.d.ts +2 -0
- package/es/{TreeMode → Tree}/demo.js +0 -0
- package/es/{TreeMode → Tree}/index.css +1 -1
- package/es/{TreeMode → Tree}/index.d.ts +1 -1
- package/es/{TreeMode → Tree}/index.js +9 -12
- package/es/UserSelect/index.d.ts +3 -3
- package/es/UserSelect/index.js +18 -15
- package/es/WorkerFlow/Form/Condition.js +6 -8
- package/es/WorkerFlow/Form/EmptyUserSet.js +4 -6
- package/es/WorkerFlow/Form/FormAuth.js +3 -3
- package/es/WorkerFlow/Form/GroupList.js +2 -2
- package/es/WorkerFlow/Form/GroupSelect.js +4 -6
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +8 -7
- package/es/WorkerFlow/Form/LevelGroupSelect.js +5 -7
- package/es/WorkerFlow/Form/UserAndGroupSelect.js +4 -6
- package/es/WorkerFlow/Form/UserSelect.js +4 -6
- package/es/WorkerFlow/Form/UserSelectModalContent.js +8 -6
- package/es/WorkerFlow/Form/UserSet.js +3 -3
- package/es/WorkerFlow/Nodes/Add.js +2 -3
- package/es/WorkerFlow/Nodes/AddOption.js +2 -2
- package/es/WorkerFlow/Nodes/Approver.js +2 -2
- package/es/WorkerFlow/Nodes/Condition.js +2 -2
- package/es/WorkerFlow/Nodes/Handle.js +2 -2
- package/es/WorkerFlow/Nodes/Notifier.js +2 -2
- package/es/WorkerFlow/Nodes/TitleElement.js +70 -36
- package/es/WorkerFlow/index.css +9 -3
- package/es/WorkerFlow/index.js +3 -3
- package/es/WorkerFlow/utils.js +2 -2
- package/es/core.d.ts +27 -0
- package/es/index.d.ts +27 -4
- package/es/index.js +27 -4
- package/es/useDrawer/index.d.ts +14 -0
- package/es/useDrawer/index.js +91 -0
- package/es/useHttp/index.d.ts +8 -0
- package/es/useHttp/index.js +78 -0
- package/es/useModal/index.d.ts +14 -0
- package/es/useModal/index.js +93 -0
- package/es/useNavigate/index.css +0 -0
- package/es/useNavigate/index.d.ts +4 -0
- package/es/useNavigate/index.js +14 -0
- package/es/utils.d.ts +11 -0
- package/es/utils.js +68 -1
- package/package.json +10 -8
- package/es/DeviceList/index.css +0 -32
- package/es/DeviceList/index.d.ts +0 -14
- package/es/DynamicDeviceList/Demo.js +0 -17
- package/es/DynamicDeviceList/index.d.ts +0 -35
- package/es/DynamicDeviceList/index.js +0 -224
- package/es/DynamicDeviceList/utils.d.ts +0 -2
- package/es/DynamicDeviceList/utils.js +0 -15
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import _IconFont from "@cloud-app-dev/basic-components/es/IconFont";
|
|
2
1
|
import React, { useContext } from 'react';
|
|
3
2
|
import AddNode from './Add';
|
|
4
3
|
import Render from './Render';
|
|
5
4
|
import { NodeTypes } from './Constants';
|
|
6
5
|
import WFC from '../OperatorContext';
|
|
7
6
|
import TitleElement from './TitleElement';
|
|
7
|
+
import IconFont from '../../IconFont';
|
|
8
8
|
|
|
9
9
|
function CoverLine(_ref) {
|
|
10
10
|
var _ref$first = _ref.first,
|
|
@@ -68,7 +68,7 @@ function BranchNode(_ref2) {
|
|
|
68
68
|
title: owner
|
|
69
69
|
}, owner) : /*#__PURE__*/React.createElement("span", {
|
|
70
70
|
className: "placeholder"
|
|
71
|
-
}, "\u8BF7\u8BBE\u7F6E\u6761\u4EF6"), /*#__PURE__*/React.createElement(
|
|
71
|
+
}, "\u8BF7\u8BBE\u7F6E\u6761\u4EF6"), /*#__PURE__*/React.createElement(IconFont, {
|
|
72
72
|
type: "icon-S_Arrow_SmallRight"
|
|
73
73
|
})))), /*#__PURE__*/React.createElement(AddNode, {
|
|
74
74
|
node: node
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _IconFont from "@cloud-app-dev/basic-components/es/IconFont";
|
|
2
1
|
import React, { useContext } from 'react';
|
|
3
2
|
import NodeWrap from './Wrap';
|
|
4
3
|
import TitleElement from './TitleElement';
|
|
5
4
|
import WFC from '../OperatorContext';
|
|
5
|
+
import IconFont from '../../IconFont';
|
|
6
6
|
|
|
7
7
|
function HandleNode(_ref) {
|
|
8
8
|
var parentNode = _ref.parentNode,
|
|
@@ -44,7 +44,7 @@ function HandleNode(_ref) {
|
|
|
44
44
|
title: owner
|
|
45
45
|
}, owner) : /*#__PURE__*/React.createElement("span", {
|
|
46
46
|
className: "placeholder"
|
|
47
|
-
}, "\u8BF7\u9009\u62E9\u529E\u7406\u4EBA"), /*#__PURE__*/React.createElement(
|
|
47
|
+
}, "\u8BF7\u9009\u62E9\u529E\u7406\u4EBA"), /*#__PURE__*/React.createElement(IconFont, {
|
|
48
48
|
type: "icon-S_Arrow_SmallRight"
|
|
49
49
|
})));
|
|
50
50
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _IconFont from "@cloud-app-dev/basic-components/es/IconFont";
|
|
2
1
|
import React, { useContext } from 'react';
|
|
3
2
|
import NodeWrap from './Wrap';
|
|
4
3
|
import TitleElement from './TitleElement';
|
|
5
4
|
import WFC from '../OperatorContext';
|
|
5
|
+
import IconFont from '../../IconFont';
|
|
6
6
|
|
|
7
7
|
function NotifierNode(_ref) {
|
|
8
8
|
var parentNode = _ref.parentNode,
|
|
@@ -44,7 +44,7 @@ function NotifierNode(_ref) {
|
|
|
44
44
|
title: owner
|
|
45
45
|
}, owner) : /*#__PURE__*/React.createElement("span", {
|
|
46
46
|
className: "placeholder"
|
|
47
|
-
}, "\u8BF7\u9009\u62E9\u6284\u9001\u4EBA"), /*#__PURE__*/React.createElement(
|
|
47
|
+
}, "\u8BF7\u9009\u62E9\u6284\u9001\u4EBA"), /*#__PURE__*/React.createElement(IconFont, {
|
|
48
48
|
type: "icon-S_Arrow_SmallRight"
|
|
49
49
|
})));
|
|
50
50
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
2
|
+
import _nextTick from "@cloud-app-dev/utils/es/nextTick";
|
|
3
|
+
import _useFocusWithin from "ahooks/es/useFocusWithin";
|
|
3
4
|
|
|
4
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
6
|
|
|
@@ -13,8 +14,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
13
14
|
|
|
14
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
16
|
|
|
16
|
-
import React, { useState, useEffect, useRef,
|
|
17
|
+
import React, { useState, useEffect, useRef, useContext } from 'react';
|
|
17
18
|
import WFC from '../OperatorContext';
|
|
19
|
+
import IconFont from '../../IconFont';
|
|
18
20
|
|
|
19
21
|
function TitleElement(_ref) {
|
|
20
22
|
var nodeName = _ref.nodeName,
|
|
@@ -26,59 +28,91 @@ function TitleElement(_ref) {
|
|
|
26
28
|
var _useContext = useContext(WFC),
|
|
27
29
|
readOnly = _useContext.readOnly;
|
|
28
30
|
|
|
29
|
-
var
|
|
30
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
-
title = _useState2[0],
|
|
32
|
-
setTitle = _useState2[1];
|
|
31
|
+
var ref = useRef(null);
|
|
33
32
|
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
var _useState = useState({
|
|
34
|
+
title: nodeName,
|
|
35
|
+
editable: false
|
|
36
|
+
}),
|
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
+
state = _useState2[0],
|
|
39
|
+
setState = _useState2[1];
|
|
40
|
+
|
|
41
|
+
var setTitle = function setTitle(title) {
|
|
42
|
+
return setState(function (old) {
|
|
43
|
+
return Object.assign(Object.assign({}, old), {
|
|
44
|
+
title: title
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var setEditable = function setEditable(editable) {
|
|
50
|
+
return setState(function (old) {
|
|
51
|
+
return Object.assign(Object.assign({}, old), {
|
|
52
|
+
editable: editable
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
var isFocus = _useFocusWithin(ref);
|
|
38
58
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
if (isFocus && !readOnly && state.editable) {
|
|
61
|
+
_nextTick(function () {
|
|
62
|
+
var _a;
|
|
42
63
|
|
|
43
|
-
|
|
44
|
-
|
|
64
|
+
return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.select();
|
|
65
|
+
});
|
|
45
66
|
}
|
|
46
|
-
}, [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
67
|
+
}, [readOnly, isFocus, state.editable]);
|
|
68
|
+
|
|
69
|
+
_useUpdateEffect(function () {
|
|
70
|
+
return !readOnly && !state.editable && onTitleChange && onTitleChange(state.title);
|
|
71
|
+
}, [state.title, state.editable]);
|
|
72
|
+
|
|
73
|
+
_useUpdateEffect(function () {
|
|
74
|
+
var _a;
|
|
75
|
+
|
|
76
|
+
return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
77
|
+
}, [state.editable]);
|
|
50
78
|
|
|
51
|
-
|
|
52
|
-
!
|
|
53
|
-
}, [title,
|
|
79
|
+
_useUpdateEffect(function () {
|
|
80
|
+
return !state.title && !isFocus && setTitle(placeholder);
|
|
81
|
+
}, [isFocus, state.title, placeholder]);
|
|
54
82
|
|
|
55
|
-
return /*#__PURE__*/React.createElement(
|
|
83
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: "node-title-ele",
|
|
85
|
+
tabIndex: 1000
|
|
86
|
+
}, icon && /*#__PURE__*/React.createElement(IconFont, {
|
|
56
87
|
type: icon,
|
|
57
88
|
style: {
|
|
58
89
|
paddingRight: 4
|
|
59
90
|
}
|
|
60
|
-
}),
|
|
61
|
-
ref:
|
|
91
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
92
|
+
ref: ref,
|
|
62
93
|
type: "text",
|
|
94
|
+
style: {
|
|
95
|
+
display: !readOnly && state.editable ? 'inline-block' : 'none'
|
|
96
|
+
},
|
|
63
97
|
className: "cloudapp-input editable-title-input",
|
|
64
|
-
onBlur: onBlur,
|
|
65
98
|
onChange: function onChange(e) {
|
|
66
99
|
return setTitle(e.target.value);
|
|
67
100
|
},
|
|
68
|
-
|
|
69
|
-
return
|
|
101
|
+
onBlur: function onBlur() {
|
|
102
|
+
return setEditable(false);
|
|
70
103
|
},
|
|
71
|
-
value: title,
|
|
104
|
+
value: state.title,
|
|
72
105
|
placeholder: placeholder
|
|
73
|
-
})
|
|
106
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
74
107
|
className: "editable-title",
|
|
108
|
+
style: {
|
|
109
|
+
display: !(!readOnly && state.editable) ? 'inline-block' : 'none',
|
|
110
|
+
borderColor: readOnly ? 'transparent' : undefined
|
|
111
|
+
},
|
|
75
112
|
onClick: function onClick() {
|
|
76
113
|
return setEditable(true);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
borderColor: 'transparent'
|
|
80
|
-
} : undefined
|
|
81
|
-
}, title), !readOnly && /*#__PURE__*/React.createElement(_IconFont, {
|
|
114
|
+
}
|
|
115
|
+
}, state.title), !readOnly && /*#__PURE__*/React.createElement(IconFont, {
|
|
82
116
|
className: "worker-flow-node-del",
|
|
83
117
|
type: "icon-MarkNo",
|
|
84
118
|
onClick: delNode,
|
package/es/WorkerFlow/index.css
CHANGED
|
@@ -241,6 +241,9 @@
|
|
|
241
241
|
color: #15bc83;
|
|
242
242
|
text-align: left;
|
|
243
243
|
line-height: 16px;
|
|
244
|
+
width: 100%;
|
|
245
|
+
}
|
|
246
|
+
.worker-flow-design .auto-judge .title-wrapper .node-title-ele {
|
|
244
247
|
display: flex;
|
|
245
248
|
justify-content: space-between;
|
|
246
249
|
}
|
|
@@ -492,8 +495,6 @@
|
|
|
492
495
|
}
|
|
493
496
|
.node-wrap-box .title {
|
|
494
497
|
position: relative;
|
|
495
|
-
display: flex;
|
|
496
|
-
align-items: center;
|
|
497
498
|
padding-left: 10px;
|
|
498
499
|
padding-right: 40px;
|
|
499
500
|
width: 100%;
|
|
@@ -501,10 +502,15 @@
|
|
|
501
502
|
line-height: 30px;
|
|
502
503
|
font-size: 12px;
|
|
503
504
|
color: #fff;
|
|
504
|
-
text-align: left;
|
|
505
505
|
background: #576a95;
|
|
506
506
|
border-radius: 4px 4px 0 0;
|
|
507
507
|
}
|
|
508
|
+
.node-wrap-box .title .node-title-ele {
|
|
509
|
+
width: 100%;
|
|
510
|
+
height: 100%;
|
|
511
|
+
display: flex;
|
|
512
|
+
align-items: center;
|
|
513
|
+
}
|
|
508
514
|
.node-wrap-box .title .iconfont {
|
|
509
515
|
font-size: 12px;
|
|
510
516
|
margin-right: 5px;
|
package/es/WorkerFlow/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
2
2
|
import "antd/lib/modal/style";
|
|
3
3
|
import _Modal from "antd/lib/modal";
|
|
4
4
|
|
|
@@ -32,7 +32,7 @@ import ApproverForm from './Form/Approver';
|
|
|
32
32
|
import ConditionForm from './Form/Condition';
|
|
33
33
|
import NotifierForm from './Form/Notifier';
|
|
34
34
|
import { TemplateConfig1 } from './template';
|
|
35
|
-
import
|
|
35
|
+
import cloneDeep from 'lodash-es/cloneDeep';
|
|
36
36
|
import EndNode from './Nodes/End';
|
|
37
37
|
import Render from './Nodes/Render';
|
|
38
38
|
import Tools from './Tools';
|
|
@@ -291,7 +291,7 @@ function WorkerFlow(_ref, ref) {
|
|
|
291
291
|
* @description onChange传递数据
|
|
292
292
|
*/
|
|
293
293
|
|
|
294
|
-
|
|
294
|
+
_useUpdateEffect(function () {
|
|
295
295
|
return onChange && onChange(getConfig());
|
|
296
296
|
}, [config]);
|
|
297
297
|
/**
|
package/es/WorkerFlow/utils.js
CHANGED
|
@@ -10,7 +10,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
10
10
|
|
|
11
11
|
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; }
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import cloneDeep from 'lodash-es/cloneDeep';
|
|
14
14
|
import { getNodeById } from './XML/utils';
|
|
15
15
|
export function getJAVATaskData(data) {
|
|
16
16
|
var _a;
|
|
@@ -137,7 +137,7 @@ export function getNextNode(node) {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
export function filterNoticeNode(data) {
|
|
140
|
-
var newData =
|
|
140
|
+
var newData = cloneDeep(data);
|
|
141
141
|
|
|
142
142
|
var fn = function fn(node) {
|
|
143
143
|
var _a; // 过滤抄送节点
|
package/es/core.d.ts
CHANGED
|
@@ -45,6 +45,18 @@ export type BzTreeItemType = {
|
|
|
45
45
|
treeId: string;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
export interface OrgItemType {
|
|
49
|
+
createTime: string;
|
|
50
|
+
id: string;
|
|
51
|
+
orgSort: number;
|
|
52
|
+
parentId: string;
|
|
53
|
+
type: string;
|
|
54
|
+
name: string;
|
|
55
|
+
organizationName: string;
|
|
56
|
+
organizationDescription: string;
|
|
57
|
+
organizationSort: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
48
60
|
export interface DeviceItemType {
|
|
49
61
|
ability: any;
|
|
50
62
|
accessType: null;
|
|
@@ -120,3 +132,18 @@ export interface DeviceItemType {
|
|
|
120
132
|
tags: string;
|
|
121
133
|
villageLocationType: string;
|
|
122
134
|
}
|
|
135
|
+
|
|
136
|
+
export type PlaceItemType = {
|
|
137
|
+
areaCode: string;
|
|
138
|
+
areaName: string;
|
|
139
|
+
center: string;
|
|
140
|
+
hasDevice: boolean;
|
|
141
|
+
id: string;
|
|
142
|
+
level: number;
|
|
143
|
+
name: string;
|
|
144
|
+
parentCode: string;
|
|
145
|
+
placeId: string;
|
|
146
|
+
pcodes?: Array<string>;
|
|
147
|
+
provinceId: string;
|
|
148
|
+
placeInfoUrl?: string;
|
|
149
|
+
};
|
package/es/index.d.ts
CHANGED
|
@@ -1,19 +1,42 @@
|
|
|
1
1
|
export { default as Api } from './Api';
|
|
2
2
|
export { default as AppContext } from './AppContext';
|
|
3
|
+
export { default as AppRedirect } from './AppRedirect';
|
|
4
|
+
export { default as AppRoute } from './AppRoute';
|
|
5
|
+
export { default as Auth } from './Auth';
|
|
3
6
|
export { default as AutoExit } from './AutoExit';
|
|
7
|
+
export { default as Box } from './Box';
|
|
8
|
+
export { default as CheckGroupFixed } from './CheckGroupFixed';
|
|
4
9
|
export { default as Config } from './Config';
|
|
5
10
|
export { default as ConfigContext } from './ConfigContext';
|
|
6
11
|
export { default as DeviceIcon } from './DeviceIcon';
|
|
7
|
-
export { default as DeviceList } from './DeviceList';
|
|
8
12
|
export { default as DeviceSelect } from './DeviceSelect';
|
|
9
|
-
export { default as
|
|
13
|
+
export { default as Dict } from './Dict';
|
|
14
|
+
export { default as Drag } from './Drag';
|
|
15
|
+
export { default as Drawer } from './Drawer';
|
|
16
|
+
export { default as FullScreen } from './FullScreen';
|
|
17
|
+
export { default as HightLevel } from './HightLevel';
|
|
18
|
+
export { default as IconFont } from './IconFont';
|
|
19
|
+
export { default as ImageView } from './ImageView';
|
|
10
20
|
export { default as InitialConfig } from './InitialConfig';
|
|
11
21
|
export { default as InitialRequest } from './InitialRequest';
|
|
22
|
+
export { default as Input } from './Input';
|
|
23
|
+
export { default as LabelValue } from './LabelValue';
|
|
12
24
|
export { default as List } from './List';
|
|
25
|
+
export { default as LoaderApp } from './LoaderApp';
|
|
26
|
+
export { default as LoaderScript } from './LoaderScript';
|
|
27
|
+
export { default as Modal } from './Modal';
|
|
28
|
+
export { default as Picture } from './Picture';
|
|
29
|
+
export { default as Progress } from './Progress';
|
|
13
30
|
export { default as RefDrawer } from './RefDrawer';
|
|
14
31
|
export { default as RefModal } from './RefModal';
|
|
15
32
|
export { default as Service } from './Service';
|
|
16
|
-
export { default as
|
|
17
|
-
export { default as
|
|
33
|
+
export { default as TableLayout } from './TableLayout';
|
|
34
|
+
export { default as ThemeAntd } from './ThemeAntd';
|
|
35
|
+
export { default as Title } from './Title';
|
|
36
|
+
export { default as Tree } from './Tree';
|
|
37
|
+
export { default as useDrawer } from './useDrawer';
|
|
38
|
+
export { default as useHttp } from './useHttp';
|
|
39
|
+
export { default as useModal } from './useModal';
|
|
40
|
+
export { default as useNavigate } from './useNavigate';
|
|
18
41
|
export { default as UserSelect } from './UserSelect';
|
|
19
42
|
export { default as WorkerFlow } from './WorkerFlow';
|
package/es/index.js
CHANGED
|
@@ -1,19 +1,42 @@
|
|
|
1
1
|
export { default as Api } from './Api';
|
|
2
2
|
export { default as AppContext } from './AppContext';
|
|
3
|
+
export { default as AppRedirect } from './AppRedirect';
|
|
4
|
+
export { default as AppRoute } from './AppRoute';
|
|
5
|
+
export { default as Auth } from './Auth';
|
|
3
6
|
export { default as AutoExit } from './AutoExit';
|
|
7
|
+
export { default as Box } from './Box';
|
|
8
|
+
export { default as CheckGroupFixed } from './CheckGroupFixed';
|
|
4
9
|
export { default as Config } from './Config';
|
|
5
10
|
export { default as ConfigContext } from './ConfigContext';
|
|
6
11
|
export { default as DeviceIcon } from './DeviceIcon';
|
|
7
|
-
export { default as DeviceList } from './DeviceList';
|
|
8
12
|
export { default as DeviceSelect } from './DeviceSelect';
|
|
9
|
-
export { default as
|
|
13
|
+
export { default as Dict } from './Dict';
|
|
14
|
+
export { default as Drag } from './Drag';
|
|
15
|
+
export { default as Drawer } from './Drawer';
|
|
16
|
+
export { default as FullScreen } from './FullScreen';
|
|
17
|
+
export { default as HightLevel } from './HightLevel';
|
|
18
|
+
export { default as IconFont } from './IconFont';
|
|
19
|
+
export { default as ImageView } from './ImageView';
|
|
10
20
|
export { default as InitialConfig } from './InitialConfig';
|
|
11
21
|
export { default as InitialRequest } from './InitialRequest';
|
|
22
|
+
export { default as Input } from './Input';
|
|
23
|
+
export { default as LabelValue } from './LabelValue';
|
|
12
24
|
export { default as List } from './List';
|
|
25
|
+
export { default as LoaderApp } from './LoaderApp';
|
|
26
|
+
export { default as LoaderScript } from './LoaderScript';
|
|
27
|
+
export { default as Modal } from './Modal';
|
|
28
|
+
export { default as Picture } from './Picture';
|
|
29
|
+
export { default as Progress } from './Progress';
|
|
13
30
|
export { default as RefDrawer } from './RefDrawer';
|
|
14
31
|
export { default as RefModal } from './RefModal';
|
|
15
32
|
export { default as Service } from './Service';
|
|
16
|
-
export { default as
|
|
17
|
-
export { default as
|
|
33
|
+
export { default as TableLayout } from './TableLayout';
|
|
34
|
+
export { default as ThemeAntd } from './ThemeAntd';
|
|
35
|
+
export { default as Title } from './Title';
|
|
36
|
+
export { default as Tree } from './Tree';
|
|
37
|
+
export { default as useDrawer } from './useDrawer';
|
|
38
|
+
export { default as useHttp } from './useHttp';
|
|
39
|
+
export { default as useModal } from './useModal';
|
|
40
|
+
export { default as useNavigate } from './useNavigate';
|
|
18
41
|
export { default as UserSelect } from './UserSelect';
|
|
19
42
|
export { default as WorkerFlow } from './WorkerFlow';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IUseDrawerHookState {
|
|
3
|
+
content?: React.ReactNode;
|
|
4
|
+
visible?: boolean;
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
onOk?: () => void;
|
|
7
|
+
width?: number | string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function useDrawer(prefixCls?: string): {
|
|
11
|
+
open: (options: IUseDrawerHookState) => void;
|
|
12
|
+
close: () => void;
|
|
13
|
+
};
|
|
14
|
+
export default useDrawer;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import "antd/lib/config-provider/style";
|
|
2
|
+
import _ConfigProvider from "antd/lib/config-provider";
|
|
3
|
+
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
|
|
6
|
+
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."); }
|
|
7
|
+
|
|
8
|
+
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); }
|
|
9
|
+
|
|
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
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
|
|
16
|
+
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
17
|
+
import ReactDOM from 'react-dom';
|
|
18
|
+
import Drawer from '../Drawer';
|
|
19
|
+
import CC from '../ConfigContext';
|
|
20
|
+
|
|
21
|
+
function useDrawer() {
|
|
22
|
+
var prefixCls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'cloudapp';
|
|
23
|
+
var context = useContext(CC);
|
|
24
|
+
var root = useMemo(function () {
|
|
25
|
+
return (context === null || context === void 0 ? void 0 : context.root) || document.body;
|
|
26
|
+
}, [context === null || context === void 0 ? void 0 : context.root]);
|
|
27
|
+
var div = useMemo(function () {
|
|
28
|
+
return document.createElement('div');
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
var _useState = useState({
|
|
32
|
+
content: null,
|
|
33
|
+
visible: false,
|
|
34
|
+
title: '',
|
|
35
|
+
onOk: undefined,
|
|
36
|
+
width: undefined,
|
|
37
|
+
className: undefined
|
|
38
|
+
}),
|
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
+
state = _useState2[0],
|
|
41
|
+
setState = _useState2[1];
|
|
42
|
+
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
root.appendChild(div);
|
|
45
|
+
return function () {
|
|
46
|
+
root.removeChild(div);
|
|
47
|
+
ReactDOM.unmountComponentAtNode(div);
|
|
48
|
+
div.remove();
|
|
49
|
+
};
|
|
50
|
+
}, []);
|
|
51
|
+
useEffect(function () {
|
|
52
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(_ConfigProvider, {
|
|
53
|
+
prefixCls: prefixCls,
|
|
54
|
+
getPopupContainer: function getPopupContainer() {
|
|
55
|
+
return root;
|
|
56
|
+
}
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Drawer, {
|
|
58
|
+
visible: state.visible,
|
|
59
|
+
onOk: state.onOk,
|
|
60
|
+
onClose: close,
|
|
61
|
+
destroyOnClose: true,
|
|
62
|
+
title: state.title,
|
|
63
|
+
width: state.width,
|
|
64
|
+
className: state.className,
|
|
65
|
+
getContainer: false
|
|
66
|
+
}, state.content)), div);
|
|
67
|
+
}, [state.content, state.visible, state.title, state.onOk, state.width, state.className]);
|
|
68
|
+
|
|
69
|
+
var open = function open(options) {
|
|
70
|
+
setState(function (old) {
|
|
71
|
+
return Object.assign(Object.assign(Object.assign({}, old), options), {
|
|
72
|
+
visible: true
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var close = function close() {
|
|
78
|
+
setState(function (old) {
|
|
79
|
+
return Object.assign(Object.assign({}, old), {
|
|
80
|
+
visible: false
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
open: open,
|
|
87
|
+
close: close
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default useDrawer;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
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."); }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
14
|
+
|
|
15
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
16
|
+
var cacheMemory = {};
|
|
17
|
+
|
|
18
|
+
function useHttp(key, fetcher) {
|
|
19
|
+
var cacheKey = useMemo(function () {
|
|
20
|
+
return Array.isArray(key) ? key.map(function (v) {
|
|
21
|
+
return _typeof(v) === 'object' ? JSON.stringify(v) : v;
|
|
22
|
+
}).join('-') : JSON.stringify(key);
|
|
23
|
+
}, [key]);
|
|
24
|
+
|
|
25
|
+
var _useState = useState({
|
|
26
|
+
data: cacheMemory[cacheKey],
|
|
27
|
+
error: undefined,
|
|
28
|
+
loadding: true,
|
|
29
|
+
httpKey: Date.now()
|
|
30
|
+
}),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
state = _useState2[0],
|
|
33
|
+
setState = _useState2[1]; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var promiseFetcher = useMemo(function () {
|
|
37
|
+
return fetcher(key);
|
|
38
|
+
}, [cacheKey, state.httpKey]);
|
|
39
|
+
var update = useCallback(function () {
|
|
40
|
+
delete cacheMemory[cacheKey];
|
|
41
|
+
setState(function (old) {
|
|
42
|
+
return Object.assign(Object.assign({}, old), {
|
|
43
|
+
httpKey: Date.now()
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}, [cacheKey]);
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
setState(function (old) {
|
|
49
|
+
return old.loadding ? old : Object.assign(Object.assign({}, old), {
|
|
50
|
+
loadding: true
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
promiseFetcher.then(function (res) {
|
|
54
|
+
cacheMemory[cacheKey] = res;
|
|
55
|
+
setState(function (old) {
|
|
56
|
+
return Object.assign(Object.assign({}, old), {
|
|
57
|
+
data: res,
|
|
58
|
+
loadding: false
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}).catch(function (e) {
|
|
62
|
+
setState(function (old) {
|
|
63
|
+
return Object.assign(Object.assign({}, old), {
|
|
64
|
+
error: e,
|
|
65
|
+
loadding: false
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
+
}, [promiseFetcher, cacheKey]);
|
|
70
|
+
return {
|
|
71
|
+
update: update,
|
|
72
|
+
data: state.data,
|
|
73
|
+
error: state.error,
|
|
74
|
+
loadding: state.loadding
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default useHttp;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IUseModalHookState {
|
|
3
|
+
content?: React.ReactNode;
|
|
4
|
+
visible?: boolean;
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
onOk?: () => void;
|
|
7
|
+
width?: number | string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function useModal(prefixCls?: string): {
|
|
11
|
+
open: (options: IUseModalHookState) => void;
|
|
12
|
+
close: () => void;
|
|
13
|
+
};
|
|
14
|
+
export default useModal;
|