@cloud-app-dev/vidc 2.3.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.umirc.ts +2 -2
- package/es/Config/interface.d.ts +2 -1
- package/es/DomMove/demo.d.ts +2 -0
- package/es/DomMove/demo.js +16 -0
- package/es/DomMove/index.d.ts +16 -0
- package/es/DomMove/index.js +145 -0
- package/es/DomMove/utils.d.ts +8 -0
- package/es/{Picture/component/MoveContent → DomMove}/utils.js +19 -0
- package/es/Drawer/index.d.ts +2 -2
- package/es/Drawer/interface.d.ts +4 -174
- package/es/ErrorBoundary/index.d.ts +18 -0
- package/es/ErrorBoundary/index.js +84 -0
- package/es/List/DynamicGridList/Demo.js +40 -27
- package/es/List/DynamicGridList/index.d.ts +20 -29
- package/es/List/DynamicGridList/index.js +40 -63
- package/es/List/DynamicList/index.css +15 -0
- package/es/List/DynamicList/index.d.ts +14 -0
- package/es/List/DynamicList/index.js +105 -0
- package/es/List/DynamicList/interface.d.ts +19 -0
- package/es/List/DynamicList/utils.d.ts +4 -0
- package/es/List/DynamicList/utils.js +6 -0
- package/es/List/GridList/Demo.js +27 -4
- package/es/List/GridList/index.css +1 -0
- package/es/List/GridList/index.d.ts +2 -2
- package/es/List/GridList/index.js +8 -12
- package/es/List/GridList/interface.d.ts +1 -1
- package/es/List/VList/index.js +2 -3
- package/es/List/index.css +2 -54
- package/es/List/index.d.ts +6 -7
- package/es/List/index.js +14 -153
- package/es/List/interface.d.ts +3 -61
- package/es/LoaderApp/index.d.ts +1 -1
- package/es/LoaderApp/index.js +27 -46
- package/es/LoaderApp/interface.d.ts +3 -0
- package/es/LoaderApp/loader.d.ts +6 -7
- package/es/LoaderApp/loader.js +20 -30
- package/es/LoaderApp/sandbox.back.d.ts +18 -0
- package/es/LoaderApp/sandbox.back.js +356 -0
- package/es/LoaderApp/sandbox.d.ts +12 -0
- package/es/LoaderApp/sandbox.js +110 -0
- package/es/LoaderApp/utils.d.ts +5 -1
- package/es/LoaderApp/utils.js +98 -2
- package/es/Map/AMap.d.ts +1572 -0
- package/es/Map/BasicMap/AMapInstance.d.ts +15 -0
- package/es/Map/BasicMap/AMapInstance.js +66 -0
- package/es/Map/BasicMap/LeafletInstance.d.ts +15 -0
- package/es/Map/BasicMap/LeafletInstance.js +98 -0
- package/es/Map/BasicMap/index.css +24 -0
- package/es/Map/BasicMap/index.d.ts +9 -0
- package/es/Map/BasicMap/index.js +108 -0
- package/es/Map/ClusterLayer/hook.d.ts +5 -0
- package/es/Map/ClusterLayer/hook.js +144 -0
- package/es/Map/ClusterLayer/index.css +26 -0
- package/es/Map/ClusterLayer/index.d.ts +5 -0
- package/es/Map/ClusterLayer/index.js +31 -0
- package/es/Map/ClusterLayer/props.d.ts +8 -0
- package/es/Map/Config/index.d.ts +7 -0
- package/es/{InitialConfig → Map/Config}/index.js +35 -36
- package/es/Map/Config/utils.d.ts +2 -0
- package/es/{List/DynamicDeviceList → Map/Config}/utils.js +48 -45
- package/es/Map/Context/index.d.ts +11 -0
- package/es/Map/Context/index.js +66 -0
- package/es/Map/FindPio/index.css +7 -0
- package/es/Map/FindPio/index.d.ts +4 -0
- package/es/Map/FindPio/index.js +16 -0
- package/es/{WorkerFlow/Demo.d.ts → Map/InfoWindow/demo.d.ts} +0 -0
- package/es/{List/DynamicDeviceList/Demo.js → Map/InfoWindow/demo.js} +27 -25
- package/es/Map/InfoWindow/index.d.ts +8 -0
- package/es/Map/InfoWindow/index.js +74 -0
- package/es/Map/LevelCenter/DragMarker/index.d.ts +12 -0
- package/es/Map/LevelCenter/DragMarker/index.js +48 -0
- package/es/{List/DeviceList → Map/LevelCenter}/index.css +0 -0
- package/es/Map/LevelCenter/index.d.ts +13 -0
- package/es/Map/LevelCenter/index.js +42 -0
- package/es/Map/LoaderMap/index.d.ts +12 -0
- package/es/Map/LoaderMap/index.js +58 -0
- package/es/Map/ResetTools/index.css +32 -0
- package/es/Map/ResetTools/index.d.ts +9 -0
- package/es/Map/ResetTools/index.js +61 -0
- package/es/Map/SinglePoint/Marker/index.d.ts +7 -0
- package/es/Map/SinglePoint/Marker/index.js +29 -0
- package/es/Map/SinglePoint/icon/Place_icon_OnLine_Hover.svg +15 -0
- package/es/Map/SinglePoint/icon/Place_icon_OnLine_Normal.svg +15 -0
- package/es/Map/SinglePoint/icon/Place_icon_OutLine_Hover.svg +15 -0
- package/es/Map/SinglePoint/icon/Place_icon_OutLine_Normal.svg +15 -0
- package/es/Map/SinglePoint/index.css +29 -0
- package/es/Map/SinglePoint/index.d.ts +7 -0
- package/es/Map/SinglePoint/index.js +32 -0
- package/es/Map/hook/useMapType.d.ts +4 -0
- package/es/Map/hook/useMapType.js +13 -0
- package/es/Map/icon.d.ts +2 -0
- package/es/Map/icon.js +10 -0
- package/es/Map/index.d.ts +23 -0
- package/es/Map/index.js +25 -0
- package/es/Map/interface.d.ts +55 -0
- package/es/Map/points.json +61247 -0
- package/es/{Picture/component/MoveContent → Map/useMarker}/index.css +0 -0
- package/es/Map/useMarker/index.d.ts +11 -0
- package/es/{WorkerFlow/Form/FormAuth.js → Map/useMarker/index.js} +57 -80
- package/es/Map/withMap/index.d.ts +2 -0
- package/es/Map/withMap/index.js +12 -0
- package/es/Picture/index.d.ts +1 -1
- package/es/Picture/index.js +2 -2
- package/es/Player/api/index.d.ts +1 -0
- package/es/Player/api/index.js +7 -1
- package/es/Player/demo.js +13 -21
- package/es/Player/event/index.js +5 -1
- package/es/Player/frontend_player.d.ts +1 -1
- package/es/Player/frontend_player.js +20 -13
- package/es/Player/frontend_timeline.d.ts +1 -1
- package/es/Player/live_heart.js +45 -12
- package/es/Player/message.js +23 -12
- package/es/Player/player.d.ts +31 -7
- package/es/Player/segment_player.d.ts +1 -1
- package/es/Player/segment_player.js +30 -18
- package/es/Player/segment_timeline.js +6 -6
- package/es/Player/single_player.js +50 -9
- package/es/Player/timeline.js +8 -6
- package/es/Player/util.d.ts +2 -1
- package/es/Player/util.js +4 -1
- package/es/PlayerExt/index.css +2 -2
- package/es/PlayerExt/index.d.ts +3 -1
- package/es/PlayerExt/index.js +19 -5
- package/es/ScreenPlayer/Live.d.ts +5 -0
- package/es/ScreenPlayer/Live.js +109 -0
- package/es/ScreenPlayer/LiveTools.d.ts +15 -0
- package/es/ScreenPlayer/LiveTools.js +95 -0
- package/es/ScreenPlayer/PlayerWithExt.d.ts +22 -0
- package/es/ScreenPlayer/PlayerWithExt.js +169 -0
- package/es/ScreenPlayer/Record.d.ts +5 -0
- package/es/{WorkerFlow/index.js → ScreenPlayer/Record.js} +290 -273
- package/es/ScreenPlayer/RecordTools.d.ts +17 -0
- package/es/ScreenPlayer/RecordTools.js +102 -0
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +10 -0
- package/es/ScreenPlayer/SegmentTimeLine.js +40 -0
- package/es/ScreenPlayer/TimeSlider.d.ts +127 -0
- package/es/ScreenPlayer/TimeSlider.js +528 -0
- package/es/ScreenPlayer/demo.d.ts +2 -0
- package/es/ScreenPlayer/demo.js +25 -0
- package/es/ScreenPlayer/demo2.d.ts +2 -0
- package/es/ScreenPlayer/demo2.js +153 -0
- package/es/ScreenPlayer/index.css +50 -0
- package/es/ScreenPlayer/index.d.ts +6 -0
- package/es/ScreenPlayer/index.js +7 -0
- package/es/ScreenPlayer/interface.d.ts +81 -0
- package/es/ScreenPlayer/useRecordList.d.ts +3 -0
- package/es/{WorkerFlow/Form/UserAndGroupSelect.js → ScreenPlayer/useRecordList.js} +173 -176
- package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
- package/es/ScreenPlayer/useVideoFit.js +46 -0
- package/es/ScreenPlayer/utils.d.ts +25 -0
- package/es/ScreenPlayer/utils.js +84 -0
- package/es/Tree/demo.js +9 -12
- package/es/Tree/index.css +55 -29
- package/es/Tree/index.d.ts +20 -19
- package/es/Tree/index.js +70 -185
- package/es/index.d.ts +7 -9
- package/es/index.js +7 -9
- package/es/useInfiniteScroll/index.d.ts +16 -0
- package/es/{useHttp → useInfiniteScroll}/index.js +79 -43
- package/es/useVirtualList/index.d.ts +13 -0
- package/es/useVirtualList/index.js +175 -0
- package/es/withErrorBoundary/index.d.ts +8 -0
- package/es/withErrorBoundary/index.js +43 -0
- package/package.json +18 -21
- package/test.js +48 -0
- package/es/DeviceIcon/icon.d.ts +0 -9
- package/es/DeviceIcon/icon.js +0 -138
- package/es/DeviceIcon/index.css +0 -8
- package/es/DeviceIcon/index.d.ts +0 -14
- package/es/DeviceIcon/index.js +0 -37
- package/es/DeviceSelect/TreeType.d.ts +0 -7
- package/es/DeviceSelect/TreeType.js +0 -36
- package/es/DeviceSelect/demo.d.ts +0 -3
- package/es/DeviceSelect/demo.js +0 -22
- package/es/DeviceSelect/index.css +0 -11
- package/es/DeviceSelect/index.d.ts +0 -13
- package/es/DeviceSelect/index.js +0 -191
- package/es/Dict/cache.d.ts +0 -3
- package/es/Dict/cache.js +0 -21
- package/es/Dict/device.d.ts +0 -28
- package/es/Dict/device.js +0 -117
- package/es/Dict/hook.d.ts +0 -3
- package/es/Dict/hook.js +0 -98
- package/es/Dict/index.d.ts +0 -9
- package/es/Dict/index.js +0 -10
- package/es/Dict/interface.d.ts +0 -16
- package/es/Dict/utils.d.ts +0 -10
- package/es/Dict/utils.js +0 -44
- package/es/InitialConfig/index.d.ts +0 -8
- package/es/InitialConfig/utils.d.ts +0 -20
- package/es/InitialConfig/utils.js +0 -110
- package/es/InitialRequest/index.d.ts +0 -9
- package/es/InitialRequest/index.js +0 -97
- package/es/InitialRequest/utils.d.ts +0 -10
- package/es/InitialRequest/utils.js +0 -116
- package/es/List/CheckExt.d.ts +0 -9
- package/es/List/CheckExt.js +0 -36
- package/es/List/DeviceList/index.d.ts +0 -11
- package/es/List/DeviceList/index.js +0 -50
- package/es/List/DynamicDeviceList/Demo.d.ts +0 -3
- package/es/List/DynamicDeviceList/index.css +0 -39
- package/es/List/DynamicDeviceList/index.d.ts +0 -12
- package/es/List/DynamicDeviceList/index.js +0 -205
- package/es/List/DynamicDeviceList/interface.d.ts +0 -37
- package/es/List/DynamicDeviceList/utils.d.ts +0 -16
- package/es/List/ListExt/index.css +0 -3
- package/es/List/ListExt/index.d.ts +0 -19
- package/es/List/ListExt/index.js +0 -44
- package/es/Picture/component/MoveContent/index.d.ts +0 -39
- package/es/Picture/component/MoveContent/index.js +0 -244
- package/es/Picture/component/MoveContent/utils.d.ts +0 -4
- package/es/Title/index.css +0 -25
- package/es/Title/index.d.ts +0 -12
- package/es/Title/index.js +0 -30
- package/es/Tree/BaseTree/index.css +0 -64
- package/es/Tree/BaseTree/index.d.ts +0 -24
- package/es/Tree/BaseTree/index.js +0 -83
- package/es/UserSelect/demo.d.ts +0 -3
- package/es/UserSelect/demo.js +0 -21
- package/es/UserSelect/index.css +0 -16
- package/es/UserSelect/index.d.ts +0 -18
- package/es/UserSelect/index.js +0 -194
- package/es/WorkerFlow/Demo.js +0 -57
- package/es/WorkerFlow/Form/Approver.d.ts +0 -10
- package/es/WorkerFlow/Form/Approver.js +0 -33
- package/es/WorkerFlow/Form/Condition.d.ts +0 -11
- package/es/WorkerFlow/Form/Condition.js +0 -235
- package/es/WorkerFlow/Form/EmptyUserSet.d.ts +0 -8
- package/es/WorkerFlow/Form/EmptyUserSet.js +0 -137
- package/es/WorkerFlow/Form/FormAuth.d.ts +0 -8
- package/es/WorkerFlow/Form/GroupList.d.ts +0 -12
- package/es/WorkerFlow/Form/GroupList.js +0 -44
- package/es/WorkerFlow/Form/GroupSelect.d.ts +0 -8
- package/es/WorkerFlow/Form/GroupSelect.js +0 -167
- package/es/WorkerFlow/Form/GroupSelectModalContent.d.ts +0 -6
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +0 -177
- package/es/WorkerFlow/Form/Handle.d.ts +0 -10
- package/es/WorkerFlow/Form/Handle.js +0 -33
- package/es/WorkerFlow/Form/LevelGroupSelect.d.ts +0 -12
- package/es/WorkerFlow/Form/LevelGroupSelect.js +0 -208
- package/es/WorkerFlow/Form/Notifier.d.ts +0 -8
- package/es/WorkerFlow/Form/Notifier.js +0 -16
- package/es/WorkerFlow/Form/UserAndGroupSelect.d.ts +0 -8
- package/es/WorkerFlow/Form/UserSelect.d.ts +0 -8
- package/es/WorkerFlow/Form/UserSelect.js +0 -150
- package/es/WorkerFlow/Form/UserSelectModalContent.d.ts +0 -6
- package/es/WorkerFlow/Form/UserSelectModalContent.js +0 -166
- package/es/WorkerFlow/Form/UserSet.d.ts +0 -14
- package/es/WorkerFlow/Form/UserSet.js +0 -308
- package/es/WorkerFlow/Form/UsersHandleType.d.ts +0 -7
- package/es/WorkerFlow/Form/UsersHandleType.js +0 -32
- package/es/WorkerFlow/Form/utils.d.ts +0 -3
- package/es/WorkerFlow/Form/utils.js +0 -47
- package/es/WorkerFlow/Nodes/Add.d.ts +0 -7
- package/es/WorkerFlow/Nodes/Add.js +0 -98
- package/es/WorkerFlow/Nodes/AddOption.d.ts +0 -10
- package/es/WorkerFlow/Nodes/AddOption.js +0 -23
- package/es/WorkerFlow/Nodes/AddOptionList.d.ts +0 -8
- package/es/WorkerFlow/Nodes/AddOptionList.js +0 -46
- package/es/WorkerFlow/Nodes/Approver.d.ts +0 -11
- package/es/WorkerFlow/Nodes/Approver.js +0 -53
- package/es/WorkerFlow/Nodes/Condition.d.ts +0 -10
- package/es/WorkerFlow/Nodes/Condition.js +0 -140
- package/es/WorkerFlow/Nodes/Constants.d.ts +0 -35
- package/es/WorkerFlow/Nodes/Constants.js +0 -150
- package/es/WorkerFlow/Nodes/End.d.ts +0 -7
- package/es/WorkerFlow/Nodes/End.js +0 -16
- package/es/WorkerFlow/Nodes/Handle.d.ts +0 -11
- package/es/WorkerFlow/Nodes/Handle.js +0 -52
- package/es/WorkerFlow/Nodes/Node.d.ts +0 -8
- package/es/WorkerFlow/Nodes/Node.js +0 -26
- package/es/WorkerFlow/Nodes/Notifier.d.ts +0 -11
- package/es/WorkerFlow/Nodes/Notifier.js +0 -52
- package/es/WorkerFlow/Nodes/Render.d.ts +0 -8
- package/es/WorkerFlow/Nodes/Render.js +0 -16
- package/es/WorkerFlow/Nodes/Start.d.ts +0 -12
- package/es/WorkerFlow/Nodes/Start.js +0 -26
- package/es/WorkerFlow/Nodes/TitleElement.d.ts +0 -10
- package/es/WorkerFlow/Nodes/TitleElement.js +0 -127
- package/es/WorkerFlow/Nodes/Wrap.d.ts +0 -13
- package/es/WorkerFlow/Nodes/Wrap.js +0 -35
- package/es/WorkerFlow/OperatorContext.d.ts +0 -4
- package/es/WorkerFlow/OperatorContext.js +0 -3
- package/es/WorkerFlow/Tools.d.ts +0 -8
- package/es/WorkerFlow/Tools.js +0 -78
- package/es/WorkerFlow/XML/CanvasTag.d.ts +0 -3
- package/es/WorkerFlow/XML/CanvasTag.js +0 -142
- package/es/WorkerFlow/XML/EndEvent.d.ts +0 -1
- package/es/WorkerFlow/XML/EndEvent.js +0 -14
- package/es/WorkerFlow/XML/ExclusiveGateway.d.ts +0 -9
- package/es/WorkerFlow/XML/ExclusiveGateway.js +0 -101
- package/es/WorkerFlow/XML/Root.d.ts +0 -1
- package/es/WorkerFlow/XML/Root.js +0 -5
- package/es/WorkerFlow/XML/StartEvent.d.ts +0 -5
- package/es/WorkerFlow/XML/StartEvent.js +0 -28
- package/es/WorkerFlow/XML/UserTask.d.ts +0 -5
- package/es/WorkerFlow/XML/UserTask.js +0 -93
- package/es/WorkerFlow/XML/index.d.ts +0 -4
- package/es/WorkerFlow/XML/index.js +0 -100
- package/es/WorkerFlow/XML/utils.d.ts +0 -6
- package/es/WorkerFlow/XML/utils.js +0 -97
- package/es/WorkerFlow/data.json +0 -83
- package/es/WorkerFlow/index.css +0 -779
- package/es/WorkerFlow/index.d.ts +0 -13
- package/es/WorkerFlow/interface.d.ts +0 -93
- package/es/WorkerFlow/template.d.ts +0 -2
- package/es/WorkerFlow/template.js +0 -17
- package/es/WorkerFlow/utils.d.ts +0 -14
- package/es/WorkerFlow/utils.js +0 -212
- package/es/useHttp/index.d.ts +0 -8
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
2
|
-
import _nextTick from "@cloud-app-dev/utils/es/nextTick";
|
|
3
|
-
import _useFocusWithin from "ahooks/es/useFocusWithin";
|
|
4
|
-
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
|
|
7
|
-
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."); }
|
|
8
|
-
|
|
9
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
-
|
|
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
|
-
|
|
13
|
-
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; }
|
|
14
|
-
|
|
15
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
|
|
17
|
-
import React, { useState, useEffect, useRef, useContext } from 'react';
|
|
18
|
-
import WFC from '../OperatorContext';
|
|
19
|
-
import IconFont from '../../IconFont';
|
|
20
|
-
|
|
21
|
-
function TitleElement(_ref) {
|
|
22
|
-
var nodeName = _ref.nodeName,
|
|
23
|
-
placeholder = _ref.placeholder,
|
|
24
|
-
onTitleChange = _ref.onTitleChange,
|
|
25
|
-
icon = _ref.icon,
|
|
26
|
-
delNode = _ref.delNode;
|
|
27
|
-
|
|
28
|
-
var _useContext = useContext(WFC),
|
|
29
|
-
readOnly = _useContext.readOnly;
|
|
30
|
-
|
|
31
|
-
var ref = useRef(null);
|
|
32
|
-
|
|
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);
|
|
58
|
-
|
|
59
|
-
useEffect(function () {
|
|
60
|
-
if (isFocus && !readOnly && state.editable) {
|
|
61
|
-
_nextTick(function () {
|
|
62
|
-
var _a;
|
|
63
|
-
|
|
64
|
-
return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.select();
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}, [readOnly, isFocus, state.editable]);
|
|
68
|
-
|
|
69
|
-
_useUpdateEffect(function () {
|
|
70
|
-
if (!readOnly && !state.editable && onTitleChange) {
|
|
71
|
-
onTitleChange(state.title);
|
|
72
|
-
}
|
|
73
|
-
}, [state.title, state.editable]);
|
|
74
|
-
|
|
75
|
-
_useUpdateEffect(function () {
|
|
76
|
-
var _a;
|
|
77
|
-
|
|
78
|
-
return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
79
|
-
}, [state.editable]);
|
|
80
|
-
|
|
81
|
-
_useUpdateEffect(function () {
|
|
82
|
-
if (!state.title && !isFocus) {
|
|
83
|
-
setTitle(placeholder);
|
|
84
|
-
}
|
|
85
|
-
}, [isFocus, state.title, placeholder]);
|
|
86
|
-
|
|
87
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
88
|
-
className: "node-title-ele",
|
|
89
|
-
tabIndex: 1000
|
|
90
|
-
}, icon && /*#__PURE__*/React.createElement(IconFont, {
|
|
91
|
-
type: icon,
|
|
92
|
-
style: {
|
|
93
|
-
paddingRight: 4
|
|
94
|
-
}
|
|
95
|
-
}), /*#__PURE__*/React.createElement("input", {
|
|
96
|
-
ref: ref,
|
|
97
|
-
type: "text",
|
|
98
|
-
style: {
|
|
99
|
-
display: !readOnly && state.editable ? 'inline-block' : 'none'
|
|
100
|
-
},
|
|
101
|
-
className: "cloudapp-input editable-title-input",
|
|
102
|
-
onChange: function onChange(e) {
|
|
103
|
-
return setTitle(e.target.value);
|
|
104
|
-
},
|
|
105
|
-
onBlur: function onBlur() {
|
|
106
|
-
return setEditable(false);
|
|
107
|
-
},
|
|
108
|
-
value: state.title,
|
|
109
|
-
placeholder: placeholder
|
|
110
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
111
|
-
className: "editable-title",
|
|
112
|
-
style: {
|
|
113
|
-
display: !(!readOnly && state.editable) ? 'inline-block' : 'none',
|
|
114
|
-
borderColor: readOnly ? 'transparent' : undefined
|
|
115
|
-
},
|
|
116
|
-
onClick: function onClick() {
|
|
117
|
-
return setEditable(true);
|
|
118
|
-
}
|
|
119
|
-
}, state.title), !readOnly && /*#__PURE__*/React.createElement(IconFont, {
|
|
120
|
-
className: "worker-flow-node-del",
|
|
121
|
-
type: "icon-MarkNo",
|
|
122
|
-
onClick: delNode,
|
|
123
|
-
title: "\u5220\u9664\u8282\u70B9"
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export default TitleElement;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { NodeItem, NodeType } from '../interface';
|
|
3
|
-
interface INodeWrapProps {
|
|
4
|
-
titleStyle?: React.CSSProperties;
|
|
5
|
-
type?: NodeType;
|
|
6
|
-
onContentClick: () => void;
|
|
7
|
-
title: React.ReactNode;
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
node: NodeItem;
|
|
10
|
-
id: string;
|
|
11
|
-
}
|
|
12
|
-
declare function NodeWrap({ type, title, onContentClick, node, children, titleStyle, id }: INodeWrapProps): JSX.Element;
|
|
13
|
-
export default NodeWrap;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { NodeTypes } from './Constants';
|
|
3
|
-
import AddNode from './Add';
|
|
4
|
-
import WFC from '../OperatorContext';
|
|
5
|
-
|
|
6
|
-
function NodeWrap(_ref) {
|
|
7
|
-
var type = _ref.type,
|
|
8
|
-
title = _ref.title,
|
|
9
|
-
onContentClick = _ref.onContentClick,
|
|
10
|
-
node = _ref.node,
|
|
11
|
-
children = _ref.children,
|
|
12
|
-
titleStyle = _ref.titleStyle,
|
|
13
|
-
id = _ref.id;
|
|
14
|
-
|
|
15
|
-
var _useContext = useContext(WFC),
|
|
16
|
-
_useContext$errorIds = _useContext.errorIds,
|
|
17
|
-
errorIds = _useContext$errorIds === void 0 ? [] : _useContext$errorIds;
|
|
18
|
-
|
|
19
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
20
|
-
className: "node-wrap"
|
|
21
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
22
|
-
className: "node-wrap-box ".concat(type === NodeTypes.START ? 'start-node' : '', " ").concat(node.error || errorIds.includes(node.id) ? 'error' : ''),
|
|
23
|
-
id: id
|
|
24
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
25
|
-
className: "title",
|
|
26
|
-
style: titleStyle
|
|
27
|
-
}, title), /*#__PURE__*/React.createElement("div", {
|
|
28
|
-
className: "content",
|
|
29
|
-
onClick: onContentClick
|
|
30
|
-
}, children)), /*#__PURE__*/React.createElement(AddNode, {
|
|
31
|
-
node: node
|
|
32
|
-
})));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default NodeWrap;
|
package/es/WorkerFlow/Tools.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface IZoomLayoutProps {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
hasTools?: boolean;
|
|
5
|
-
exportBpmnFile?: () => any;
|
|
6
|
-
}
|
|
7
|
-
declare function ZoomLayout({ children, exportBpmnFile, hasTools }: IZoomLayoutProps): JSX.Element;
|
|
8
|
-
export default ZoomLayout;
|
package/es/WorkerFlow/Tools.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
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
|
-
import React, { useState } from 'react';
|
|
14
|
-
var ZOOM = {
|
|
15
|
-
DOWN: 1,
|
|
16
|
-
UP: 2,
|
|
17
|
-
MIN: 50,
|
|
18
|
-
MAX: 300
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
function ZoomLayout(_ref) {
|
|
22
|
-
var children = _ref.children,
|
|
23
|
-
exportBpmnFile = _ref.exportBpmnFile,
|
|
24
|
-
hasTools = _ref.hasTools;
|
|
25
|
-
|
|
26
|
-
// 放大比例, 按百分制给 100 为 100%
|
|
27
|
-
var _useState = useState(100),
|
|
28
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
-
scale = _useState2[0],
|
|
30
|
-
setScale = _useState2[1];
|
|
31
|
-
|
|
32
|
-
function zoomSize(type) {
|
|
33
|
-
if (type === ZOOM.DOWN) {
|
|
34
|
-
if (scale === ZOOM.MIN) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
scale -= 10;
|
|
39
|
-
setScale(scale);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (type === ZOOM.UP) {
|
|
43
|
-
if (scale === ZOOM.MAX) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
scale += 10;
|
|
48
|
-
setScale(scale);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
53
|
-
className: "zoom"
|
|
54
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
className: 'zoom-out' + (scale === ZOOM.MIN ? ' disabled' : ''),
|
|
56
|
-
onClick: function onClick() {
|
|
57
|
-
return zoomSize(ZOOM.DOWN);
|
|
58
|
-
}
|
|
59
|
-
}), /*#__PURE__*/React.createElement("span", null, scale, "%"), /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
className: 'zoom-in' + (scale === ZOOM.MAX ? ' disabled' : ''),
|
|
61
|
-
onClick: function onClick() {
|
|
62
|
-
return zoomSize(ZOOM.UP);
|
|
63
|
-
}
|
|
64
|
-
})), hasTools && /*#__PURE__*/React.createElement("div", {
|
|
65
|
-
className: "tools"
|
|
66
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
67
|
-
onClick: exportBpmnFile
|
|
68
|
-
}, "\u5BFC\u51FAbpmn")), /*#__PURE__*/React.createElement("div", {
|
|
69
|
-
className: "box-scale",
|
|
70
|
-
id: "box-scale",
|
|
71
|
-
style: {
|
|
72
|
-
transform: "scale(".concat(scale / 100, ")"),
|
|
73
|
-
transformOrigin: '50% 0px 0px'
|
|
74
|
-
}
|
|
75
|
-
}, children));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export default ZoomLayout;
|
|
@@ -1,142 +0,0 @@
|
|
|
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
|
-
import { getNodeById } from './utils';
|
|
14
|
-
export function createEdges(xml, eles, data) {
|
|
15
|
-
var arr = [];
|
|
16
|
-
var edgeIds = eles.filter(function (v) {
|
|
17
|
-
return v.tagName === 'bpmn:sequenceFlow';
|
|
18
|
-
}).map(function (v) {
|
|
19
|
-
return [v.getAttribute('sourceRef'), v.getAttribute('targetRef'), v.getAttribute('id')];
|
|
20
|
-
}); //生成线,计算位置
|
|
21
|
-
|
|
22
|
-
edgeIds.forEach(function (_ref) {
|
|
23
|
-
var _ref2 = _slicedToArray(_ref, 3),
|
|
24
|
-
sourceId = _ref2[0],
|
|
25
|
-
targetId = _ref2[1],
|
|
26
|
-
id = _ref2[2];
|
|
27
|
-
|
|
28
|
-
var BPMNEdge = xml.createElement('bpmndi:BPMNEdge');
|
|
29
|
-
BPMNEdge.setAttribute('id', "".concat(id, "_di"));
|
|
30
|
-
BPMNEdge.setAttribute('bpmnElement', id);
|
|
31
|
-
var sourceDom = document.getElementById(sourceId);
|
|
32
|
-
var targetDom = document.getElementById(targetId);
|
|
33
|
-
|
|
34
|
-
if (!sourceDom || !targetDom) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var sourceRect = sourceDom.getBoundingClientRect();
|
|
39
|
-
var targetRect = targetDom.getBoundingClientRect();
|
|
40
|
-
var x1 = sourceRect.x + sourceRect.width / 2;
|
|
41
|
-
var x2 = targetRect.x + targetRect.width / 2;
|
|
42
|
-
|
|
43
|
-
if (x1 === x2) {
|
|
44
|
-
var waypoint1 = xml.createElement('di:waypoint');
|
|
45
|
-
var waypoint2 = xml.createElement('di:waypoint');
|
|
46
|
-
waypoint1.setAttribute('x', "".concat(x1));
|
|
47
|
-
waypoint1.setAttribute('y', "".concat(sourceRect.y + sourceRect.height));
|
|
48
|
-
waypoint2.setAttribute('x', "".concat(x2));
|
|
49
|
-
waypoint2.setAttribute('y', "".concat(targetRect.y));
|
|
50
|
-
BPMNEdge.appendChild(waypoint1);
|
|
51
|
-
BPMNEdge.appendChild(waypoint2);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (x1 > x2) {
|
|
55
|
-
var _waypoint = xml.createElement('di:waypoint');
|
|
56
|
-
|
|
57
|
-
var _waypoint2 = xml.createElement('di:waypoint');
|
|
58
|
-
|
|
59
|
-
var waypoint3 = xml.createElement('di:waypoint');
|
|
60
|
-
|
|
61
|
-
_waypoint.setAttribute('x', "".concat(sourceRect.x));
|
|
62
|
-
|
|
63
|
-
_waypoint.setAttribute('y', "".concat(sourceRect.y + sourceRect.height / 2));
|
|
64
|
-
|
|
65
|
-
_waypoint2.setAttribute('x', "".concat(targetRect.x + targetRect.width / 2));
|
|
66
|
-
|
|
67
|
-
_waypoint2.setAttribute('y', "".concat(sourceRect.y + sourceRect.height / 2));
|
|
68
|
-
|
|
69
|
-
waypoint3.setAttribute('x', "".concat(targetRect.x + targetRect.width / 2));
|
|
70
|
-
waypoint3.setAttribute('y', "".concat(targetRect.y));
|
|
71
|
-
BPMNEdge.appendChild(_waypoint);
|
|
72
|
-
BPMNEdge.appendChild(_waypoint2);
|
|
73
|
-
BPMNEdge.appendChild(waypoint3);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (x1 < x2) {
|
|
77
|
-
var _waypoint3 = xml.createElement('di:waypoint');
|
|
78
|
-
|
|
79
|
-
var _waypoint4 = xml.createElement('di:waypoint');
|
|
80
|
-
|
|
81
|
-
var _waypoint5 = xml.createElement('di:waypoint');
|
|
82
|
-
|
|
83
|
-
_waypoint3.setAttribute('x', "".concat(sourceRect.x + sourceRect.width));
|
|
84
|
-
|
|
85
|
-
_waypoint3.setAttribute('y', "".concat(sourceRect.y + sourceRect.height / 2));
|
|
86
|
-
|
|
87
|
-
_waypoint4.setAttribute('x', "".concat(targetRect.x + targetRect.width / 2));
|
|
88
|
-
|
|
89
|
-
_waypoint4.setAttribute('y', "".concat(sourceRect.y + sourceRect.height / 2));
|
|
90
|
-
|
|
91
|
-
_waypoint5.setAttribute('x', "".concat(targetRect.x + targetRect.width / 2));
|
|
92
|
-
|
|
93
|
-
_waypoint5.setAttribute('y', "".concat(targetRect.y));
|
|
94
|
-
|
|
95
|
-
BPMNEdge.appendChild(_waypoint3);
|
|
96
|
-
BPMNEdge.appendChild(_waypoint4);
|
|
97
|
-
BPMNEdge.appendChild(_waypoint5);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
arr.push(BPMNEdge);
|
|
101
|
-
});
|
|
102
|
-
return arr;
|
|
103
|
-
}
|
|
104
|
-
export function createShape(xml, eles, data) {
|
|
105
|
-
var arr = [];
|
|
106
|
-
var shapeEles = eles.filter(function (v) {
|
|
107
|
-
return v.tagName !== 'bpmn:sequenceFlow';
|
|
108
|
-
});
|
|
109
|
-
var index = 1;
|
|
110
|
-
shapeEles.forEach(function (item) {
|
|
111
|
-
var id = item.getAttribute('id');
|
|
112
|
-
var dom = document.getElementById(id);
|
|
113
|
-
|
|
114
|
-
if (!dom) {
|
|
115
|
-
index++;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
var rect = (dom === null || dom === void 0 ? void 0 : dom.getBoundingClientRect()) || {
|
|
119
|
-
x: 100,
|
|
120
|
-
y: index * 80,
|
|
121
|
-
width: 50,
|
|
122
|
-
height: 50
|
|
123
|
-
};
|
|
124
|
-
var BPMNShape = xml.createElement('bpmndi:BPMNShape');
|
|
125
|
-
BPMNShape.setAttribute('id', "".concat(id, "_di"));
|
|
126
|
-
BPMNShape.setAttribute('bpmnElement', id);
|
|
127
|
-
var node = getNodeById(data, id);
|
|
128
|
-
|
|
129
|
-
if (node && node.bpmnType === 'exclusiveGateway') {
|
|
130
|
-
BPMNShape.setAttribute('isMarkerVisible', 'true');
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
var dcBounds = xml.createElement('dc:Bounds');
|
|
134
|
-
dcBounds.setAttribute('x', "".concat(rect.x));
|
|
135
|
-
dcBounds.setAttribute('y', "".concat(rect.y));
|
|
136
|
-
dcBounds.setAttribute('width', "".concat(rect.width));
|
|
137
|
-
dcBounds.setAttribute('height', "".concat(rect.height));
|
|
138
|
-
BPMNShape.appendChild(dcBounds);
|
|
139
|
-
arr.push(BPMNShape);
|
|
140
|
-
});
|
|
141
|
-
return arr;
|
|
142
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createEndEvent(xml: Document, stopId: string, pIds: string[]): HTMLElement;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createId } from './utils';
|
|
2
|
-
export function createEndEvent(xml, stopId, pIds) {
|
|
3
|
-
var endId = stopId || createId('EndEvent'); //结束流程
|
|
4
|
-
|
|
5
|
-
var endEvent = xml.createElement('bpmn:endEvent');
|
|
6
|
-
endEvent.setAttribute('id', endId); // 基于startEvent 创建outgoing
|
|
7
|
-
|
|
8
|
-
pIds.forEach(function (prevId) {
|
|
9
|
-
var endEventIn = xml.createElement('bpmn:incoming');
|
|
10
|
-
endEventIn.innerHTML = prevId;
|
|
11
|
-
endEvent.appendChild(endEventIn);
|
|
12
|
-
});
|
|
13
|
-
return endEvent;
|
|
14
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { NodeItem } from '../interface';
|
|
2
|
-
export declare function createExclusiveGateway(xml: Document, node: NodeItem, pIds?: string[]): {
|
|
3
|
-
eles: HTMLElement[];
|
|
4
|
-
};
|
|
5
|
-
export declare function createSequenceFlow(xml: Document, node: NodeItem, exclusiveGatewayId?: string, nextId?: string): HTMLElement;
|
|
6
|
-
export declare function createConditionNode(xml: Document, data: NodeItem, exclusiveGatewayId: string, stopId: string): {
|
|
7
|
-
eles: HTMLElement[];
|
|
8
|
-
prevId: string;
|
|
9
|
-
};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread 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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
-
|
|
9
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
-
|
|
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
|
-
|
|
13
|
-
import { createUserTask } from './UserTask';
|
|
14
|
-
export function createExclusiveGateway(xml, node, pIds) {
|
|
15
|
-
var data = {
|
|
16
|
-
eles: []
|
|
17
|
-
};
|
|
18
|
-
var exclusiveGateway = xml.createElement('bpmn:exclusiveGateway');
|
|
19
|
-
exclusiveGateway.setAttribute('id', node.id); // 子节点创建输入节点
|
|
20
|
-
|
|
21
|
-
pIds.forEach(function (prevId) {
|
|
22
|
-
var incoming = xml.createElement('bpmn:incoming');
|
|
23
|
-
incoming.innerHTML = prevId;
|
|
24
|
-
exclusiveGateway.appendChild(incoming);
|
|
25
|
-
});
|
|
26
|
-
data.eles.push(exclusiveGateway);
|
|
27
|
-
|
|
28
|
-
if (node.conditionNodes && node.conditionNodes.length > 0) {
|
|
29
|
-
// 子节点存在需要创建输出节点
|
|
30
|
-
node.conditionNodes.forEach(function (item) {
|
|
31
|
-
var outgoing = xml.createElement('bpmn:outgoing');
|
|
32
|
-
outgoing.innerHTML = item.id;
|
|
33
|
-
exclusiveGateway.appendChild(outgoing);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
|
-
export function createSequenceFlow(xml, node, exclusiveGatewayId, nextId) {
|
|
40
|
-
//生成条件连线
|
|
41
|
-
var sequenceFlow = xml.createElement('bpmn:sequenceFlow');
|
|
42
|
-
sequenceFlow.setAttribute('id', node.id);
|
|
43
|
-
sequenceFlow.setAttribute('sourceRef', exclusiveGatewayId);
|
|
44
|
-
sequenceFlow.setAttribute('targetRef', node.childNode ? node.childNode.id : nextId); // 子节点插入条件
|
|
45
|
-
|
|
46
|
-
var conditionExpression = xml.createElement('bpmn:conditionExpression');
|
|
47
|
-
conditionExpression.setAttribute('xsi:type', 'bpmn:tFormalExpression');
|
|
48
|
-
conditionExpression.innerHTML = node.expression;
|
|
49
|
-
sequenceFlow.appendChild(conditionExpression);
|
|
50
|
-
return sequenceFlow;
|
|
51
|
-
}
|
|
52
|
-
export function createConditionNode(xml, data, exclusiveGatewayId, stopId) {
|
|
53
|
-
var eles = [];
|
|
54
|
-
var pIds = [];
|
|
55
|
-
var gatwayId = ''; // 根据节点数据成次bpmn XML元素
|
|
56
|
-
|
|
57
|
-
var createElement = function createElement(node) {
|
|
58
|
-
var _a, _b;
|
|
59
|
-
|
|
60
|
-
switch (node.bpmnType) {
|
|
61
|
-
case 'sequenceFlow':
|
|
62
|
-
eles.push(createSequenceFlow(xml, node, gatwayId || exclusiveGatewayId, ((_a = node === null || node === void 0 ? void 0 : node.childNode) === null || _a === void 0 ? void 0 : _a.id) || stopId));
|
|
63
|
-
pIds = [node.id];
|
|
64
|
-
break;
|
|
65
|
-
|
|
66
|
-
case 'userTask':
|
|
67
|
-
var userTask = createUserTask(xml, node, pIds, ((_b = node === null || node === void 0 ? void 0 : node.childNode) === null || _b === void 0 ? void 0 : _b.id) || stopId);
|
|
68
|
-
eles.push.apply(eles, _toConsumableArray(userTask.eles));
|
|
69
|
-
pIds = userTask.prevId ? [userTask.prevId] : pIds;
|
|
70
|
-
break;
|
|
71
|
-
|
|
72
|
-
case 'exclusiveGateway':
|
|
73
|
-
var exclusiveGateway = createExclusiveGateway(xml, node, pIds);
|
|
74
|
-
eles.push.apply(eles, _toConsumableArray(exclusiveGateway.eles));
|
|
75
|
-
gatwayId = node.id;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (node.conditionNodes && node.conditionNodes.length > 0) {
|
|
80
|
-
var ids = [];
|
|
81
|
-
node.conditionNodes.forEach(function (item) {
|
|
82
|
-
var _a;
|
|
83
|
-
|
|
84
|
-
var data = createConditionNode(xml, item, gatwayId, ((_a = node.childNode) === null || _a === void 0 ? void 0 : _a.id) || stopId);
|
|
85
|
-
eles.push.apply(eles, _toConsumableArray(data.eles));
|
|
86
|
-
ids.push(data.prevId);
|
|
87
|
-
});
|
|
88
|
-
pIds = ids;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (node.childNode) {
|
|
92
|
-
createElement(node.childNode);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
createElement(data);
|
|
97
|
-
return {
|
|
98
|
-
eles: eles,
|
|
99
|
-
prevId: pIds[0]
|
|
100
|
-
};
|
|
101
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createRootElement(id: string, name: string): Document;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export function createRootElement(id, name) {
|
|
2
|
-
var parser = new DOMParser();
|
|
3
|
-
var xml = parser.parseFromString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <bpmn:definitions xmlns:bpmn=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:di=\"http://www.omg.org/spec/DD/20100524/DI\" xmlns:dc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:camunda=\"http://camunda.org/schema/1.0/bpmn\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" id=\"Definitions_0vip0x3\" targetNamespace=\"http://bpmn.io/schema/bpmn\" exporter=\"Camunda Modeler\" exporterVersion=\"1.16.2\">\n <bpmn:process id=\"".concat(id, "\" name=\"").concat(name, "\" processType=\"None\" isClosed=\"false\" isExecutable=\"true\"></bpmn:process>\n <bpmndi:BPMNDiagram id=\"BPMNDiagram_").concat(id, "\" >\n <bpmndi:BPMNPlane id=\"BPMNPlane_").concat(id, "\" bpmnElement=\"").concat(id, "\"></bpmndi:BPMNPlane>\n </bpmndi:BPMNDiagram>\n </bpmn:definitions>"), 'text/xml');
|
|
4
|
-
return xml;
|
|
5
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createId } from './utils';
|
|
2
|
-
export function createStartEvent(xml, node) {
|
|
3
|
-
var eles = []; // 创建 startEvent
|
|
4
|
-
|
|
5
|
-
var startEvent = xml.createElement('bpmn:startEvent');
|
|
6
|
-
startEvent.setAttribute('id', node.id);
|
|
7
|
-
var startSequenceFlowId = createId('SequenceFlow'); //预先生成startSequenceId
|
|
8
|
-
|
|
9
|
-
eles.push(startEvent); // startEvent存在子节点的时候需要创建输出节点和连线节点
|
|
10
|
-
|
|
11
|
-
if (node.childNode) {
|
|
12
|
-
// 基于startEvent 创建outgoing
|
|
13
|
-
var startEventOut = xml.createElement('bpmn:outgoing');
|
|
14
|
-
startEventOut.innerHTML = startSequenceFlowId;
|
|
15
|
-
startEvent.appendChild(startEventOut); // 创建startEvent的连线sequenceFlow
|
|
16
|
-
|
|
17
|
-
var sequenceFlow = xml.createElement('bpmn:sequenceFlow');
|
|
18
|
-
sequenceFlow.setAttribute('id', startSequenceFlowId);
|
|
19
|
-
sequenceFlow.setAttribute('sourceRef', node.id);
|
|
20
|
-
sequenceFlow.setAttribute('targetRef', node.childNode.id);
|
|
21
|
-
eles.push(sequenceFlow);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
eles: eles,
|
|
26
|
-
pId: startSequenceFlowId
|
|
27
|
-
};
|
|
28
|
-
}
|