@cloud-app-dev/vidc 2.0.0-alpha.9 → 2.1.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/.fatherrc.js +11 -4
- package/.umirc.ts +1 -1
- package/es/Api/index.js +7 -7
- package/es/AppRedirect/index.d.ts +1 -1
- package/es/AppRedirect/index.js +7 -12
- package/es/AppRouter/index.d.ts +3 -0
- package/es/AppRouter/index.js +19 -0
- package/es/Auth/index.js +1 -1
- package/es/AutoExit/index.js +12 -10
- package/es/{ContentBox → Box}/BetweenBox/index.css +0 -0
- package/es/{ContentBox → Box}/BetweenBox/index.d.ts +0 -0
- package/es/{ContentBox → Box}/BetweenBox/index.js +0 -0
- package/es/{ContentBox → Box}/InfoBox/index.css +0 -0
- package/es/{ContentBox → Box}/InfoBox/index.d.ts +0 -0
- package/es/{ContentBox → Box}/InfoBox/index.js +0 -0
- package/es/{ContentBox → Box}/TwoColumnBox/index.css +0 -0
- package/es/{ContentBox → Box}/TwoColumnBox/index.d.ts +0 -0
- package/es/{ContentBox → Box}/TwoColumnBox/index.js +0 -0
- package/es/{ContentBox → Box}/deps/content-grid.d.ts +0 -0
- package/es/{ContentBox → Box}/deps/content-grid.js +0 -0
- package/es/{ContentBox → Box}/deps/grid-factory.d.ts +0 -0
- package/es/{ContentBox → Box}/deps/grid-factory.js +0 -0
- package/es/{ContentBox → Box}/deps/simple-grid.d.ts +0 -0
- package/es/{ContentBox → Box}/deps/simple-grid.js +0 -0
- package/es/{ContentBox → Box}/index.css +0 -0
- package/es/{ContentBox → Box}/index.d.ts +3 -3
- package/es/{ContentBox → Box}/index.js +5 -5
- package/es/CheckGroupFixed/index.js +4 -2
- package/es/Config/index.js +12 -12
- package/es/Config/interface.d.ts +6 -4
- package/es/ConfigContext/index.d.ts +15 -2
- package/es/ConfigContext/index.js +25 -3
- 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 -54
- package/es/Dict/desc.js +3 -3
- package/es/Dict/utils.js +3 -3
- package/es/HightLevel/index.js +1 -2
- package/es/IconFont/index.d.ts +0 -1
- package/es/IconFont/index.js +12 -13
- package/es/InitialConfig/index.js +7 -4
- package/es/InitialConfig/utils.d.ts +5 -0
- package/es/InitialConfig/utils.js +33 -6
- package/es/InitialRequest/index.d.ts +3 -1
- package/es/InitialRequest/index.js +20 -18
- package/es/InitialRequest/utils.d.ts +4 -3
- package/es/InitialRequest/utils.js +26 -27
- package/es/Input/index.js +3 -2
- package/es/InstanceHistory/index.d.ts +3 -0
- package/es/InstanceHistory/index.js +9 -0
- package/es/List/CheckExt.d.ts +3 -5
- package/es/List/CheckExt.js +21 -13
- package/es/{AppRoute → List/DeviceList}/index.css +0 -0
- package/es/List/DeviceList/index.d.ts +11 -0
- package/es/{DeviceList → List/DeviceList}/index.js +6 -18
- package/es/{DynamicDeviceList → List/DynamicDeviceList}/Demo.d.ts +0 -0
- package/es/{DynamicList/demo.js → List/DynamicDeviceList/Demo.js} +25 -42
- 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/{DynamicList/demo.d.ts → List/DynamicGridList/Demo.d.ts} +0 -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/{ListExt → List/ListExt}/index.d.ts +1 -1
- package/es/{ListExt → List/ListExt}/index.js +3 -3
- 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/{VList → List/VList}/utils.js +0 -0
- package/es/List/index.css +11 -12
- package/es/List/index.d.ts +5 -70
- package/es/List/index.js +32 -25
- package/es/List/interface.d.ts +87 -0
- package/es/List/renderItem.d.ts +1 -1
- package/es/List/renderItem.js +13 -10
- package/es/LoaderApp/index.d.ts +1 -1
- package/es/LoaderApp/index.js +18 -18
- package/es/LoaderApp/utils.d.ts +2 -1
- package/es/LoaderApp/utils.js +6 -3
- package/es/LoaderScript/index.js +7 -89
- package/es/LoaderScript/utils.d.ts +2 -0
- package/es/LoaderScript/utils.js +170 -33
- package/es/Picture/component/MoveContent/index.js +3 -3
- package/es/Picture/index.js +1 -1
- package/es/Picture/utils.js +1 -1
- package/es/RefDrawer/index.js +1 -1
- package/es/RefModal/index.js +1 -1
- package/es/Service/http.d.ts +6 -4
- package/es/Service/http.js +20 -22
- package/es/Service/index.d.ts +3 -3
- package/es/Service/index.js +7 -11
- package/es/Service/interface.d.ts +5 -11
- package/es/Service/middleware.d.ts +1 -1
- package/es/Service/middleware.js +1 -1
- package/es/TableLayout/index.d.ts +3 -0
- package/es/TableLayout/index.js +14 -45
- package/es/{TreeTitle → Title}/index.css +5 -5
- package/es/{TreeTitle → Title}/index.d.ts +2 -2
- package/es/{TreeTitle → Title}/index.js +7 -4
- 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.js +19 -56
- package/es/Tree/index.css +29 -55
- package/es/Tree/index.d.ts +19 -20
- package/es/Tree/index.js +185 -70
- package/es/UserSelect/index.js +7 -8
- package/es/WorkerFlow/Form/Condition.js +2 -4
- package/es/WorkerFlow/Form/EmptyUserSet.js +1 -1
- package/es/WorkerFlow/Form/FormAuth.js +3 -3
- package/es/WorkerFlow/Form/GroupList.js +2 -2
- package/es/WorkerFlow/Form/GroupSelect.js +1 -1
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +2 -3
- package/es/WorkerFlow/Form/LevelGroupSelect.js +2 -2
- package/es/WorkerFlow/Form/UserAndGroupSelect.js +1 -1
- package/es/WorkerFlow/Form/UserSelect.js +1 -1
- package/es/WorkerFlow/Form/UserSelectModalContent.js +3 -6
- package/es/WorkerFlow/Form/UserSet.js +3 -3
- package/es/WorkerFlow/Nodes/TitleElement.js +71 -34
- package/es/WorkerFlow/index.css +9 -3
- package/es/WorkerFlow/index.js +14 -9
- package/es/WorkerFlow/utils.js +1 -1
- package/es/index.d.ts +4 -11
- package/es/index.js +4 -11
- package/es/useDrawer/index.d.ts +1 -1
- package/es/useDrawer/index.js +3 -2
- package/es/useHistory/index.d.ts +2 -2
- package/es/useHistory/index.js +3 -6
- package/es/useHttp/index.js +1 -1
- package/es/useModal/index.d.ts +1 -1
- package/es/useModal/index.js +3 -2
- package/es/utils.d.ts +9 -0
- package/es/utils.js +36 -1
- package/package.json +10 -12
- package/tsconfig.json +1 -1
- package/es/AppRoute/Render.d.ts +0 -23
- package/es/AppRoute/Render.js +0 -111
- package/es/AppRoute/Rendered.d.ts +0 -4
- package/es/AppRoute/Rendered.js +0 -11
- package/es/AppRoute/index.d.ts +0 -14
- package/es/AppRoute/index.js +0 -106
- package/es/AppRoute/interface.d.ts +0 -18
- package/es/AppRoute/utils.d.ts +0 -1
- package/es/AppRoute/utils.js +0 -28
- package/es/DeviceList/index.css +0 -32
- package/es/DeviceList/index.d.ts +0 -14
- package/es/DynamicDeviceList/CheckExt.d.ts +0 -8
- package/es/DynamicDeviceList/CheckExt.js +0 -36
- 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
- package/es/DynamicList/index.css +0 -7
- package/es/DynamicList/index.d.ts +0 -31
- package/es/DynamicList/index.js +0 -132
- package/es/IconFont/index.css +0 -0
- package/es/List/utils.d.ts +0 -5
- package/es/List/utils.js +0 -18
- package/es/ListExt/index.css +0 -9
- package/es/ScrollList/index.css +0 -73
- package/es/ScrollList/index.d.ts +0 -24
- package/es/ScrollList/index.js +0 -262
- package/es/ScrollList/utils.js +0 -84
- package/es/Service/logger.d.ts +0 -3
- package/es/Service/logger.js +0 -13
- package/es/Service/utils.d.ts +0 -3
- package/es/Service/utils.js +0 -11
- package/es/TreeMode/demo.js +0 -32
- package/es/TreeMode/index.css +0 -38
- package/es/TreeMode/index.d.ts +0 -23
- package/es/TreeMode/index.js +0 -201
- package/es/VList/index.css +0 -4
- package/es/VList/index.d.ts +0 -16
- package/es/VList/index.js +0 -56
- package/es/VList/utils.d.ts +0 -10
- package/es/useChangeEffect/index.d.ts +0 -3
- package/es/useChangeEffect/index.js +0 -32
- package/es/useHistory/index.css +0 -0
package/es/Tree/index.js
CHANGED
|
@@ -1,83 +1,198 @@
|
|
|
1
|
-
import "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import _treeHelper from "@cloud-app-dev/utils/es/treeHelper";
|
|
2
|
+
|
|
3
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
+
|
|
5
|
+
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."); }
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
|
|
13
|
+
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."); }
|
|
14
|
+
|
|
15
|
+
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); }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
7
18
|
|
|
8
|
-
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
+
|
|
23
|
+
import { __rest } from "tslib";
|
|
24
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
25
|
+
import api from '../Api';
|
|
26
|
+
import Title from '../Title';
|
|
27
|
+
import { getParentListById, getPlaceCodesWithParent } from '../utils';
|
|
9
28
|
import IconFont from '../IconFont';
|
|
10
|
-
import
|
|
29
|
+
import useHttp from '../useHttp';
|
|
30
|
+
import Tree from './BaseTree';
|
|
11
31
|
import "./index.css";
|
|
32
|
+
var defaultList = [];
|
|
12
33
|
|
|
13
|
-
function
|
|
14
|
-
var
|
|
34
|
+
function TreeMode(_a) {
|
|
35
|
+
var title = _a.title,
|
|
15
36
|
className = _a.className,
|
|
16
|
-
|
|
37
|
+
renderHeader = _a.renderHeader,
|
|
38
|
+
inputPlaceholder = _a.inputPlaceholder,
|
|
17
39
|
treeNodeProps = _a.treeNodeProps,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
onDefailtSelect = _a.onDefailtSelect,
|
|
41
|
+
mode = _a.mode,
|
|
42
|
+
showIcon = _a.showIcon,
|
|
43
|
+
props = __rest(_a, ["title", "className", "renderHeader", "inputPlaceholder", "treeNodeProps", "onDefailtSelect", "mode", "showIcon"]);
|
|
44
|
+
|
|
45
|
+
var _useState = useState({
|
|
46
|
+
keyword: undefined,
|
|
47
|
+
expandedKeys: undefined,
|
|
48
|
+
focusKey: Date.now()
|
|
49
|
+
}),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
state = _useState2[0],
|
|
52
|
+
setState = _useState2[1];
|
|
53
|
+
/**
|
|
54
|
+
* @description 根据mode获取树的数据
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
var _useHttp = useHttp(['TreeMode', mode], function (_ref) {
|
|
59
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
60
|
+
_ = _ref2[0],
|
|
61
|
+
mode = _ref2[1];
|
|
62
|
+
|
|
63
|
+
return mode === 'Bz' ? api.getDeviceBzTree() : mode === 'Custom' ? api.getCustomDeviceGroup() : mode === 'Org' ? api.getOrgs() : api.getPlacesByHasDevice();
|
|
64
|
+
}),
|
|
65
|
+
_useHttp$data = _useHttp.data,
|
|
66
|
+
list = _useHttp$data === void 0 ? defaultList : _useHttp$data;
|
|
67
|
+
|
|
68
|
+
var treeData = useMemo(function () {
|
|
69
|
+
return mode === 'Place' ? _treeHelper.computPlaceTree(list) : _treeHelper.computTreeList(list);
|
|
70
|
+
}, [list, mode]);
|
|
71
|
+
/**
|
|
72
|
+
* @description 实现关键字展开节点
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
useEffect(function () {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
|
|
78
|
+
var keys = [];
|
|
79
|
+
var defaultKeys = mode === 'Place' ? [] : ((_a = treeData[0]) === null || _a === void 0 ? void 0 : _a.id) ? [(_b = treeData[0]) === null || _b === void 0 ? void 0 : _b.id] : [];
|
|
80
|
+
|
|
81
|
+
if (!state.keyword) {
|
|
82
|
+
setState(function (old) {
|
|
83
|
+
return Object.assign(Object.assign({}, old), {
|
|
84
|
+
expandedKeys: defaultKeys,
|
|
85
|
+
focusKey: Date.now()
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
switch (mode) {
|
|
92
|
+
case 'Place':
|
|
93
|
+
var places = list.filter(function (v) {
|
|
94
|
+
return v.areaName.includes(state.keyword);
|
|
95
|
+
});
|
|
96
|
+
places.forEach(function (v) {
|
|
97
|
+
var codes = getPlaceCodesWithParent(v.areaCode, list);
|
|
98
|
+
keys = [].concat(keys, codes);
|
|
99
|
+
});
|
|
100
|
+
break;
|
|
101
|
+
|
|
102
|
+
case 'Bz':
|
|
103
|
+
case 'Custom':
|
|
104
|
+
var trees = list.filter(function (v) {
|
|
105
|
+
return v.groupName.includes(state.keyword);
|
|
106
|
+
});
|
|
107
|
+
trees.forEach(function (v) {
|
|
108
|
+
var ids = getParentListById(v.id, list).map(function (v) {
|
|
109
|
+
return v.id;
|
|
110
|
+
});
|
|
111
|
+
keys = [].concat(keys, ids);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
case 'Org':
|
|
115
|
+
var orgs = list.filter(function (v) {
|
|
116
|
+
return v.organizationName.includes(state.keyword);
|
|
117
|
+
});
|
|
118
|
+
orgs.forEach(function (v) {
|
|
119
|
+
var ids = getParentListById(v.id, list).map(function (v) {
|
|
120
|
+
return v.id;
|
|
121
|
+
});
|
|
122
|
+
keys = [].concat(keys, ids);
|
|
123
|
+
});
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
var expandedKeys = _toConsumableArray(new Set(_toConsumableArray(keys)));
|
|
128
|
+
|
|
129
|
+
setState(function (old) {
|
|
130
|
+
var _a;
|
|
131
|
+
|
|
132
|
+
return Object.assign(Object.assign({}, old), {
|
|
133
|
+
expandedKeys: expandedKeys.length > 0 ? expandedKeys : [(_a = treeData[0]) === null || _a === void 0 ? void 0 : _a.id],
|
|
134
|
+
focusKey: Date.now()
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}, [state.keyword, list, treeData, mode]);
|
|
138
|
+
var treeKey = useMemo(function () {
|
|
139
|
+
return mode === 'Place' ? 'areaCode' : 'id';
|
|
140
|
+
}, [mode]);
|
|
141
|
+
var treeName = useMemo(function () {
|
|
142
|
+
return mode === 'Place' ? 'areaName' : mode === 'Org' ? 'organizationName' : 'groupName';
|
|
143
|
+
}, [mode]);
|
|
144
|
+
/**
|
|
145
|
+
* @description 触发默认选中节点事件
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
useEffect(function () {
|
|
149
|
+
var id = treeData[0] ? treeData[0][treeKey] : undefined;
|
|
150
|
+
id && onDefailtSelect && onDefailtSelect(id);
|
|
151
|
+
}, [treeData, treeKey]);
|
|
152
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
153
|
+
className: "bc-type-tree-layout ".concat(className)
|
|
154
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
155
|
+
title: title,
|
|
156
|
+
value: state.keyword,
|
|
157
|
+
inputPlaceholder: inputPlaceholder,
|
|
158
|
+
onChange: function onChange(val) {
|
|
159
|
+
return setState(function (old) {
|
|
160
|
+
return Object.assign(Object.assign({}, old), {
|
|
161
|
+
keyword: val
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}), renderHeader && renderHeader(), list.length > 0 && /*#__PURE__*/React.createElement(Tree, Object.assign({}, props, {
|
|
56
166
|
treeData: treeData,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
167
|
+
key: state.focusKey,
|
|
168
|
+
showIcon: showIcon,
|
|
169
|
+
onExpand: function onExpand(keys) {
|
|
170
|
+
return setState(function (old) {
|
|
171
|
+
return Object.assign(Object.assign({}, old), {
|
|
172
|
+
expandedKeys: keys
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
},
|
|
176
|
+
expandedKeys: state.expandedKeys,
|
|
177
|
+
defaultExpandedKeys: treeData[0] ? [treeData[0].id] : undefined,
|
|
178
|
+
treeNodeProps: {
|
|
179
|
+
keyword: state.keyword,
|
|
180
|
+
suffix: treeNodeProps === null || treeNodeProps === void 0 ? void 0 : treeNodeProps.suffix,
|
|
181
|
+
nameKey: treeName,
|
|
182
|
+
key: treeKey
|
|
60
183
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
className: "tree-item-title"
|
|
66
|
-
}, /*#__PURE__*/React.createElement("span", null, showIcon && icon && icon(node), prefix && prefix(node), /*#__PURE__*/React.createElement(HightLevel, {
|
|
67
|
-
keyword: keyword,
|
|
68
|
-
name: node[nameKey]
|
|
69
|
-
})), suffix && suffix(node));
|
|
184
|
+
icon: function icon(node) {
|
|
185
|
+
return /*#__PURE__*/React.createElement(IconFont, {
|
|
186
|
+
type: "".concat(treeData.length === 1 && node.id === treeData[0].id ? 'icon-S_Bar_Home' : mode === 'Place' ? node.level > 4 ? 'icon-S_Place_Place' : 'icon-S_Bar_Add' : 'icon-S_Photo_ListTree')
|
|
187
|
+
});
|
|
70
188
|
}
|
|
71
|
-
}
|
|
189
|
+
})));
|
|
72
190
|
}
|
|
73
191
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
treeData: [],
|
|
192
|
+
TreeMode.defaultProps = {
|
|
193
|
+
mode: 'Bz',
|
|
77
194
|
className: '',
|
|
78
|
-
treeNodeProps: {
|
|
79
|
-
|
|
80
|
-
key: 'id'
|
|
81
|
-
}
|
|
195
|
+
treeNodeProps: {},
|
|
196
|
+
showIcon: true
|
|
82
197
|
};
|
|
83
|
-
export default
|
|
198
|
+
export default TreeMode;
|
package/es/UserSelect/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
1
2
|
import _treeHelper from "@cloud-app-dev/utils/es/treeHelper";
|
|
2
3
|
|
|
3
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
@@ -22,15 +23,11 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
22
23
|
|
|
23
24
|
import React, { useCallback, useMemo, useState, useImperativeHandle } from 'react';
|
|
24
25
|
import api from '../Api';
|
|
25
|
-
import TreeMode from '../
|
|
26
|
-
import uniq from 'lodash
|
|
27
|
-
import intersectionWith from 'lodash-es/intersectionWith';
|
|
28
|
-
import uniqBy from 'lodash-es/uniqBy';
|
|
29
|
-
import differenceWith from 'lodash-es/differenceWith';
|
|
26
|
+
import TreeMode from '../Tree';
|
|
27
|
+
import { uniq, intersectionWith, uniqBy, differenceWith } from 'lodash';
|
|
30
28
|
import IconFont from '../IconFont';
|
|
31
|
-
import useChangeEffect from '../useChangeEffect';
|
|
32
29
|
import useHttp from '../useHttp';
|
|
33
|
-
import ListExt from '../ListExt';
|
|
30
|
+
import ListExt from '../List/ListExt';
|
|
34
31
|
import "./index.css";
|
|
35
32
|
|
|
36
33
|
function UserSelect(_ref, ref) {
|
|
@@ -117,11 +114,13 @@ function UserSelect(_ref, ref) {
|
|
|
117
114
|
})
|
|
118
115
|
};
|
|
119
116
|
}, [state.selectUsers, state.selectIds]);
|
|
120
|
-
|
|
117
|
+
|
|
118
|
+
_useUpdateEffect(function () {
|
|
121
119
|
return onChange && onChange(state.selectUsers.filter(function (v) {
|
|
122
120
|
return state.selectIds.includes(v.id);
|
|
123
121
|
}));
|
|
124
122
|
}, [state.selectUsers, state.selectIds]);
|
|
123
|
+
|
|
125
124
|
var renderList1 = useMemo(function () {
|
|
126
125
|
return userList.filter(function (v) {
|
|
127
126
|
return !state.keyword1 || v.realName.includes(state.keyword1);
|
|
@@ -16,7 +16,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
17
|
|
|
18
18
|
import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
19
|
-
import
|
|
19
|
+
import Box from '../../Box';
|
|
20
20
|
import IconFont from '../../IconFont';
|
|
21
21
|
import RefModal from '../../RefModal';
|
|
22
22
|
|
|
@@ -29,8 +29,6 @@ function ConditionForm(_ref) {
|
|
|
29
29
|
|
|
30
30
|
var _a, _b;
|
|
31
31
|
|
|
32
|
-
console.log(item, useConditionFields);
|
|
33
|
-
|
|
34
32
|
var _useState = useState({
|
|
35
33
|
field: (item === null || item === void 0 ? void 0 : item.conditionList) ? (_a = item.conditionList[0]) === null || _a === void 0 ? void 0 : _a.field : '',
|
|
36
34
|
value: (item === null || item === void 0 ? void 0 : item.conditionList) ? (_b = item === null || item === void 0 ? void 0 : item.conditionList[0]) === null || _b === void 0 ? void 0 : _b.value : ''
|
|
@@ -129,7 +127,7 @@ function ConditionForm(_ref) {
|
|
|
129
127
|
});
|
|
130
128
|
}
|
|
131
129
|
}, [state.field, state.value, formItem, options]);
|
|
132
|
-
return /*#__PURE__*/React.createElement(
|
|
130
|
+
return /*#__PURE__*/React.createElement(Box.InfoBox, {
|
|
133
131
|
title: "\u8BBE\u7F6E\u6761\u4EF6",
|
|
134
132
|
contentStyle: {
|
|
135
133
|
padding: 20
|
|
@@ -19,7 +19,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
19
19
|
|
|
20
20
|
import { __awaiter } from "tslib";
|
|
21
21
|
import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react';
|
|
22
|
-
import replace from 'lodash
|
|
22
|
+
import { replace } from 'lodash';
|
|
23
23
|
import chroma from 'chroma-js';
|
|
24
24
|
import UserSelectModalContent from './UserSelectModalContent';
|
|
25
25
|
import RefModal from '../../RefModal';
|
|
@@ -24,8 +24,8 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
24
24
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
25
|
|
|
26
26
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
27
|
-
import
|
|
28
|
-
import cloneDeep from 'lodash
|
|
27
|
+
import Box from '../../Box';
|
|
28
|
+
import { cloneDeep } from 'lodash';
|
|
29
29
|
|
|
30
30
|
function FormAuth(_ref) {
|
|
31
31
|
var form = _ref.form,
|
|
@@ -56,7 +56,7 @@ function FormAuth(_ref) {
|
|
|
56
56
|
form: state.form
|
|
57
57
|
});
|
|
58
58
|
}, [state.form]);
|
|
59
|
-
return /*#__PURE__*/React.createElement(
|
|
59
|
+
return /*#__PURE__*/React.createElement(Box.InfoBox, {
|
|
60
60
|
className: "user-form-auth-layout",
|
|
61
61
|
title: "\u8868\u5355\u64CD\u4F5C\u6743\u9650"
|
|
62
62
|
}, /*#__PURE__*/React.createElement(_Table, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "antd/lib/checkbox/style";
|
|
2
2
|
import _Checkbox from "antd/lib/checkbox";
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import
|
|
4
|
+
import Title from '../../Title';
|
|
5
5
|
|
|
6
6
|
function GroupList(_ref) {
|
|
7
7
|
var list = _ref.list,
|
|
@@ -11,7 +11,7 @@ function GroupList(_ref) {
|
|
|
11
11
|
title = _ref.title;
|
|
12
12
|
return /*#__PURE__*/React.createElement("div", {
|
|
13
13
|
className: "lm-c-check-list-wrapper vidc-list-component post-group-list"
|
|
14
|
-
}, /*#__PURE__*/React.createElement(
|
|
14
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
15
15
|
titleExt: false,
|
|
16
16
|
title: title,
|
|
17
17
|
inputPlaceholder: "\u8BF7\u8F93\u5165\u5C97\u4F4D\u540D\u79F0",
|
|
@@ -19,7 +19,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
19
19
|
|
|
20
20
|
import { __awaiter } from "tslib";
|
|
21
21
|
import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react';
|
|
22
|
-
import replace from 'lodash
|
|
22
|
+
import { replace } from 'lodash';
|
|
23
23
|
import chroma from 'chroma-js';
|
|
24
24
|
import GroupSelectModalContent from './GroupSelectModalContent';
|
|
25
25
|
import IconFont from '../../IconFont';
|
|
@@ -22,9 +22,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
22
22
|
|
|
23
23
|
import React, { useCallback, useMemo, useState, useImperativeHandle } from 'react';
|
|
24
24
|
import api from '../../Api';
|
|
25
|
-
import TreeMode from '../../
|
|
26
|
-
import uniq from 'lodash
|
|
27
|
-
import intersectionWith from 'lodash-es/intersectionWith';
|
|
25
|
+
import TreeMode from '../../Tree';
|
|
26
|
+
import { uniq, intersectionWith } from 'lodash';
|
|
28
27
|
import useHttp from '../../useHttp';
|
|
29
28
|
import { formatRenderGroup } from './utils';
|
|
30
29
|
import GroupList from './GroupList';
|
|
@@ -21,7 +21,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
21
21
|
|
|
22
22
|
import { __awaiter } from "tslib";
|
|
23
23
|
import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react';
|
|
24
|
-
import replace from 'lodash
|
|
24
|
+
import { replace } from 'lodash';
|
|
25
25
|
import chroma from 'chroma-js';
|
|
26
26
|
import GroupSelectModalContent from './GroupSelectModalContent';
|
|
27
27
|
import { formatRenderGroup, ToUpperNumberString } from './utils';
|
|
@@ -99,7 +99,7 @@ function LevelGroupSelect(_ref) {
|
|
|
99
99
|
users: state.userList,
|
|
100
100
|
chargeLevel: state.chargeLevel
|
|
101
101
|
});
|
|
102
|
-
}, [state.userList, state.chargeLevel]);
|
|
102
|
+
}, [state.userList, state.chargeLevel, onChange]);
|
|
103
103
|
var renderList = useMemo(function () {
|
|
104
104
|
return formatRenderGroup(state.userList);
|
|
105
105
|
}, [state.userList]);
|
|
@@ -21,7 +21,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
21
21
|
|
|
22
22
|
import { __awaiter } from "tslib";
|
|
23
23
|
import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react';
|
|
24
|
-
import replace from 'lodash
|
|
24
|
+
import { replace } from 'lodash';
|
|
25
25
|
import chroma from 'chroma-js';
|
|
26
26
|
import UserSelectModalContent from './UserSelectModalContent';
|
|
27
27
|
import GroupSelectModalContent from './GroupSelectModalContent';
|
|
@@ -19,7 +19,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
19
19
|
|
|
20
20
|
import { __awaiter } from "tslib";
|
|
21
21
|
import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react';
|
|
22
|
-
import replace from 'lodash
|
|
22
|
+
import { replace } from 'lodash';
|
|
23
23
|
import chroma from 'chroma-js';
|
|
24
24
|
import UserSelectModalContent from './UserSelectModalContent';
|
|
25
25
|
import RefModal from '../../RefModal';
|
|
@@ -20,12 +20,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
20
20
|
|
|
21
21
|
import React, { useCallback, useMemo, useState, forwardRef, useImperativeHandle } from 'react';
|
|
22
22
|
import api from '../../Api';
|
|
23
|
-
import TreeMode from '../../
|
|
24
|
-
import List from '../../ListExt';
|
|
25
|
-
import uniq from 'lodash
|
|
26
|
-
import intersectionWith from 'lodash-es/intersectionWith';
|
|
27
|
-
import uniqBy from 'lodash-es/uniqBy';
|
|
28
|
-
import differenceWith from 'lodash-es/differenceWith';
|
|
23
|
+
import TreeMode from '../../Tree';
|
|
24
|
+
import List from '../../List/ListExt';
|
|
25
|
+
import { uniq, uniqBy, differenceWith, intersectionWith } from 'lodash';
|
|
29
26
|
import useHttp from '../../useHttp';
|
|
30
27
|
var UserSelectModalContent = /*#__PURE__*/forwardRef(function UserSelectModalContent(_ref, ref) {
|
|
31
28
|
var selectUsers = _ref.selectUsers;
|
|
@@ -17,14 +17,14 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
17
17
|
|
|
18
18
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
19
19
|
import { UserSetOptions } from '../Nodes/Constants';
|
|
20
|
-
import cloneDeep from 'lodash
|
|
20
|
+
import { cloneDeep } from 'lodash';
|
|
21
21
|
import UsersHandleType from './UsersHandleType';
|
|
22
22
|
import UserSelect from './UserSelect';
|
|
23
23
|
import UserAndGroupSelect from './UserAndGroupSelect';
|
|
24
24
|
import GroupSelect from './GroupSelect';
|
|
25
25
|
import EmptyUserSet from './EmptyUserSet';
|
|
26
26
|
import LevelGroupSelect from './LevelGroupSelect';
|
|
27
|
-
import
|
|
27
|
+
import Box from '../../Box';
|
|
28
28
|
var contentMap = {
|
|
29
29
|
1: UserSelectType1,
|
|
30
30
|
2: UserSelectType2,
|
|
@@ -89,7 +89,7 @@ function UserSet(_ref) {
|
|
|
89
89
|
useEffect(function () {
|
|
90
90
|
return onChange(data);
|
|
91
91
|
}, [data]);
|
|
92
|
-
return /*#__PURE__*/React.createElement(
|
|
92
|
+
return /*#__PURE__*/React.createElement(Box.InfoBox, {
|
|
93
93
|
title: "\u8BBE\u7F6E\u4EBA\u5458"
|
|
94
94
|
}, /*#__PURE__*/React.createElement("div", {
|
|
95
95
|
className: "user-select-type-wrapper"
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
+
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
6
|
|
|
3
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."); }
|
|
@@ -10,10 +14,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
10
14
|
|
|
11
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
16
|
|
|
13
|
-
import React, { useState, useEffect, useRef,
|
|
17
|
+
import React, { useState, useEffect, useRef, useContext } from 'react';
|
|
14
18
|
import WFC from '../OperatorContext';
|
|
15
19
|
import IconFont from '../../IconFont';
|
|
16
|
-
import useChangeEffect from '../../useChangeEffect';
|
|
17
20
|
|
|
18
21
|
function TitleElement(_ref) {
|
|
19
22
|
var nodeName = _ref.nodeName,
|
|
@@ -25,57 +28,91 @@ function TitleElement(_ref) {
|
|
|
25
28
|
var _useContext = useContext(WFC),
|
|
26
29
|
readOnly = _useContext.readOnly;
|
|
27
30
|
|
|
28
|
-
var
|
|
31
|
+
var ref = useRef(null);
|
|
32
|
+
|
|
33
|
+
var _useState = useState({
|
|
34
|
+
title: nodeName,
|
|
35
|
+
editable: false
|
|
36
|
+
}),
|
|
29
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
state = _useState2[0],
|
|
39
|
+
setState = _useState2[1];
|
|
32
40
|
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
var setTitle = function setTitle(title) {
|
|
42
|
+
return setState(function (old) {
|
|
43
|
+
return Object.assign(Object.assign({}, old), {
|
|
44
|
+
title: title
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
};
|
|
37
48
|
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
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);
|
|
41
58
|
|
|
42
|
-
if (!title) {
|
|
43
|
-
setTitle(placeholder);
|
|
44
|
-
}
|
|
45
|
-
}, [title, placeholder]);
|
|
46
59
|
useEffect(function () {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
+
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]);
|
|
78
|
+
|
|
79
|
+
_useUpdateEffect(function () {
|
|
80
|
+
return !state.title && !isFocus && setTitle(placeholder);
|
|
81
|
+
}, [isFocus, state.title, placeholder]);
|
|
82
|
+
|
|
83
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: "node-title-ele",
|
|
85
|
+
tabIndex: 1000
|
|
86
|
+
}, icon && /*#__PURE__*/React.createElement(IconFont, {
|
|
53
87
|
type: icon,
|
|
54
88
|
style: {
|
|
55
89
|
paddingRight: 4
|
|
56
90
|
}
|
|
57
|
-
}),
|
|
58
|
-
ref:
|
|
91
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
92
|
+
ref: ref,
|
|
59
93
|
type: "text",
|
|
94
|
+
style: {
|
|
95
|
+
display: !readOnly && state.editable ? 'inline-block' : 'none'
|
|
96
|
+
},
|
|
60
97
|
className: "cloudapp-input editable-title-input",
|
|
61
|
-
onBlur: onBlur,
|
|
62
98
|
onChange: function onChange(e) {
|
|
63
99
|
return setTitle(e.target.value);
|
|
64
100
|
},
|
|
65
|
-
|
|
66
|
-
return
|
|
101
|
+
onBlur: function onBlur() {
|
|
102
|
+
return setEditable(false);
|
|
67
103
|
},
|
|
68
|
-
value: title,
|
|
104
|
+
value: state.title,
|
|
69
105
|
placeholder: placeholder
|
|
70
|
-
})
|
|
106
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
71
107
|
className: "editable-title",
|
|
108
|
+
style: {
|
|
109
|
+
display: !(!readOnly && state.editable) ? 'inline-block' : 'none',
|
|
110
|
+
borderColor: readOnly ? 'transparent' : undefined
|
|
111
|
+
},
|
|
72
112
|
onClick: function onClick() {
|
|
73
113
|
return setEditable(true);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
borderColor: 'transparent'
|
|
77
|
-
} : undefined
|
|
78
|
-
}, title), !readOnly && /*#__PURE__*/React.createElement(IconFont, {
|
|
114
|
+
}
|
|
115
|
+
}, state.title), !readOnly && /*#__PURE__*/React.createElement(IconFont, {
|
|
79
116
|
className: "worker-flow-node-del",
|
|
80
117
|
type: "icon-MarkNo",
|
|
81
118
|
onClick: delNode,
|