@cloud-app-dev/vidc 1.0.32 → 1.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/.umirc.ts +2 -2
  2. package/es/{WorkerFlow/api.d.ts → Api/index.d.ts} +4 -1
  3. package/es/{WorkerFlow/api.js → Api/index.js} +90 -0
  4. package/es/DeviceList/index.css +3 -0
  5. package/es/DeviceList/index.d.ts +12 -11
  6. package/es/DeviceList/index.js +54 -110
  7. package/es/DeviceSelect/demo.d.ts +2 -0
  8. package/es/DeviceSelect/demo.js +22 -0
  9. package/es/DeviceSelect/index.css +6 -0
  10. package/es/DeviceSelect/index.d.ts +7 -0
  11. package/es/DeviceSelect/index.js +222 -0
  12. package/es/DynamicDeviceList/CheckExt.d.ts +8 -0
  13. package/es/DynamicDeviceList/CheckExt.js +36 -0
  14. package/es/DynamicDeviceList/Demo.js +1 -5
  15. package/es/DynamicDeviceList/index.css +20 -0
  16. package/es/DynamicDeviceList/index.d.ts +7 -4
  17. package/es/DynamicDeviceList/index.js +100 -49
  18. package/es/DynamicDeviceList/utils.d.ts +1 -2
  19. package/es/List/index.css +2 -2
  20. package/es/OrgTree/index.js +5 -5
  21. package/es/OrgUserTree/demo.d.ts +2 -0
  22. package/es/OrgUserTree/demo.js +20 -0
  23. package/es/OrgUserTree/index.css +31 -0
  24. package/es/OrgUserTree/index.d.ts +22 -0
  25. package/es/OrgUserTree/index.js +128 -0
  26. package/es/PlaceTree/demo.d.ts +2 -0
  27. package/es/PlaceTree/demo.js +20 -0
  28. package/es/PlaceTree/index.css +1 -0
  29. package/es/PlaceTree/index.d.ts +2 -2
  30. package/es/PlaceTree/index.js +27 -22
  31. package/es/RefDrawer/index.d.ts +15 -0
  32. package/es/RefDrawer/index.js +72 -0
  33. package/es/RefModal/index.d.ts +15 -0
  34. package/es/RefModal/index.js +74 -0
  35. package/es/TreeMode/demo.d.ts +2 -0
  36. package/es/TreeMode/demo.js +30 -0
  37. package/es/TreeMode/index.css +36 -0
  38. package/es/TreeMode/index.d.ts +21 -0
  39. package/es/TreeMode/index.js +190 -0
  40. package/es/TreeTitle/index.css +1 -0
  41. package/es/TreeTitle/index.d.ts +3 -2
  42. package/es/TreeTitle/index.js +4 -2
  43. package/es/UserSelect/index.css +16 -0
  44. package/es/UserSelect/index.d.ts +10 -0
  45. package/es/UserSelect/index.js +168 -0
  46. package/es/WorkerFlow/Form/Condition.js +7 -5
  47. package/es/WorkerFlow/Form/EmptyUserSet.js +6 -4
  48. package/es/WorkerFlow/Form/GroupList.d.ts +1 -1
  49. package/es/WorkerFlow/Form/GroupList.js +3 -1
  50. package/es/WorkerFlow/Form/GroupSelect.js +6 -4
  51. package/es/WorkerFlow/Form/GroupSelectModalContent.js +12 -11
  52. package/es/WorkerFlow/Form/LevelGroupSelect.js +6 -4
  53. package/es/WorkerFlow/Form/Notifier.js +2 -1
  54. package/es/WorkerFlow/Form/UserAndGroupSelect.js +6 -4
  55. package/es/WorkerFlow/Form/UserSelect.js +6 -4
  56. package/es/WorkerFlow/Form/UserSelectModalContent.js +26 -25
  57. package/es/WorkerFlow/index.css +1 -1
  58. package/es/WorkerFlow/index.js +8 -5
  59. package/es/WorkerFlow/utils.js +6 -2
  60. package/es/core.d.ts +91 -0
  61. package/es/index.d.ts +7 -0
  62. package/es/index.js +7 -0
  63. package/es/utils.d.ts +10 -0
  64. package/es/utils.js +54 -1
  65. package/package.json +5 -5
  66. package/tsconfig.json +0 -1
  67. package/es/DynamicDeviceList/interface.d.ts +0 -75
@@ -0,0 +1,168 @@
1
+ import _useChangeEffect from "@cloud-app-dev/basic-components/es/useChangeEffect";
2
+ import _useHttp2 from "@cloud-app-dev/basic-components/es/useHttp";
3
+
4
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
+
6
+ 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."); }
7
+
8
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
+
10
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
+
12
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
+
14
+ 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."); }
15
+
16
+ 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); }
17
+
18
+ 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; }
19
+
20
+ 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; }
21
+
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+
24
+ import React, { useCallback, useMemo, useState, useImperativeHandle } from 'react';
25
+ import api from '../Api';
26
+ import OrgUserTree from '../OrgUserTree';
27
+ import { treeHelper } from '@cloud-app-dev/utils';
28
+ import List from '../List';
29
+ import { uniq, intersectionWith, uniqBy, differenceWith } from 'lodash';
30
+ import "./index.css";
31
+
32
+ function UserSelect(_ref, ref) {
33
+ var selectUsers = _ref.selectUsers,
34
+ onChange = _ref.onChange,
35
+ _ref$className = _ref.className,
36
+ className = _ref$className === void 0 ? '' : _ref$className;
37
+
38
+ var _useState = useState({
39
+ keyword1: '',
40
+ keyword2: '',
41
+ orgId: '',
42
+ selectUsers: selectUsers,
43
+ selectIds: selectUsers.map(function (v) {
44
+ return v.id;
45
+ })
46
+ }),
47
+ _useState2 = _slicedToArray(_useState, 2),
48
+ state = _useState2[0],
49
+ setState = _useState2[1];
50
+
51
+ var _useHttp = _useHttp2('QueryOrgList', function () {
52
+ return api.getOrgs();
53
+ }),
54
+ _useHttp$data = _useHttp.data,
55
+ orgList = _useHttp$data === void 0 ? [] : _useHttp$data;
56
+
57
+ var treeData = useMemo(function () {
58
+ return treeHelper.computTreeList(orgList);
59
+ }, [orgList]);
60
+ var selectId = useMemo(function () {
61
+ return state.orgId ? state.orgId : treeData[0] ? treeData[0].id : undefined;
62
+ }, [treeData, state.orgId]);
63
+
64
+ var _useHttp3 = _useHttp2(['QueryUserList', selectId], function (_ref2) {
65
+ var _ref3 = _slicedToArray(_ref2, 2),
66
+ _ = _ref3[0],
67
+ id = _ref3[1];
68
+
69
+ return id ? api.getUsers(id) : Promise.resolve();
70
+ }),
71
+ _useHttp3$data = _useHttp3.data,
72
+ userList = _useHttp3$data === void 0 ? [] : _useHttp3$data;
73
+
74
+ var onUserChecked1 = useCallback(function (ids) {
75
+ var items = userList.filter(function (v) {
76
+ return ids.includes(v.id);
77
+ });
78
+ var notInList = differenceWith(state.selectUsers, userList, function (a, b) {
79
+ return a.id === b.id;
80
+ });
81
+ var arr = [];
82
+ items.forEach(function (item) {
83
+ arr.push(item);
84
+ });
85
+ var newUsers = uniqBy([].concat(_toConsumableArray(notInList), arr), 'id');
86
+ setState(function (old) {
87
+ return Object.assign(Object.assign({}, old), {
88
+ selectUsers: newUsers,
89
+ selectIds: uniq([].concat(_toConsumableArray(old.selectIds), _toConsumableArray(ids)))
90
+ });
91
+ });
92
+ }, [userList, state.selectUsers]);
93
+ var onUserChecked2 = useCallback(function (ids) {
94
+ return setState(function (old) {
95
+ return Object.assign(Object.assign({}, old), {
96
+ selectIds: ids
97
+ });
98
+ });
99
+ }, []);
100
+ var list1CheckedKeys = useMemo(function () {
101
+ return intersectionWith(userList, state.selectUsers, function (a, b) {
102
+ return a.id === b.id;
103
+ }).map(function (v) {
104
+ return v.id;
105
+ });
106
+ }, [userList, state.selectUsers]);
107
+ useImperativeHandle(ref, function () {
108
+ return {
109
+ userList: state.selectUsers.filter(function (v) {
110
+ return state.selectIds.includes(v.id);
111
+ })
112
+ };
113
+ }, [state.selectUsers, state.selectIds]);
114
+
115
+ _useChangeEffect(function () {
116
+ return onChange && onChange(state.selectUsers.filter(function (v) {
117
+ return state.selectIds.includes(v.id);
118
+ }));
119
+ }, [state.selectUsers, state.selectIds]);
120
+
121
+ return /*#__PURE__*/React.createElement("div", {
122
+ className: "user-select-modal-content ".concat(className)
123
+ }, /*#__PURE__*/React.createElement(OrgUserTree, {
124
+ onSelect: function onSelect(ids) {
125
+ return setState(function (old) {
126
+ return Object.assign(Object.assign({}, old), {
127
+ orgId: ids[0]
128
+ });
129
+ });
130
+ },
131
+ activeKey: selectId
132
+ }), /*#__PURE__*/React.createElement(List, {
133
+ onChecked: onUserChecked1,
134
+ list: userList,
135
+ key: userList.length,
136
+ checkedKeys: list1CheckedKeys,
137
+ itemKey: "id",
138
+ itemNameKey: "realName",
139
+ className: "user-source-list",
140
+ title: "\u4EBA\u5458",
141
+ onKeywordChange: function onKeywordChange(v) {
142
+ return setState(function (old) {
143
+ return Object.assign(Object.assign({}, old), {
144
+ keyword1: v
145
+ });
146
+ });
147
+ },
148
+ keywords: state.keyword1
149
+ }), /*#__PURE__*/React.createElement(List, {
150
+ list: state.selectUsers,
151
+ itemKey: "id",
152
+ itemNameKey: "realName",
153
+ checkedKeys: state.selectIds,
154
+ className: "user-select-list",
155
+ title: "\u5DF2\u6DFB\u52A0",
156
+ onKeywordChange: function onKeywordChange(v) {
157
+ return setState(function (old) {
158
+ return Object.assign(Object.assign({}, old), {
159
+ keyword2: v
160
+ });
161
+ });
162
+ },
163
+ keywords: state.keyword2,
164
+ onChecked: onUserChecked2
165
+ }));
166
+ }
167
+
168
+ export default /*#__PURE__*/React.forwardRef(UserSelect);
@@ -5,7 +5,6 @@ import _Button from "antd/lib/button";
5
5
  import _IconFont from "@cloud-app-dev/basic-components/es/IconFont";
6
6
  import _ContentBox from "@cloud-app-dev/basic-components/es/ContentBox";
7
7
  import _useChangeEffect from "@cloud-app-dev/basic-components/es/useChangeEffect";
8
- import _useModal from "@cloud-app-dev/basic-components/es/useModal";
9
8
 
10
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
10
 
@@ -20,6 +19,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
20
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
20
 
22
21
  import React, { useCallback, useImperativeHandle, useMemo, useRef, useState } from 'react';
22
+ import RefModal from '../../RefModal';
23
23
 
24
24
  function ConditionForm(_ref) {
25
25
  var form = _ref.form,
@@ -46,9 +46,7 @@ function ConditionForm(_ref) {
46
46
  return formItem ? formItem.options : [];
47
47
  }, [formItem]);
48
48
  var cRef = useRef(null);
49
-
50
- var modal = _useModal();
51
-
49
+ var modalRef = useRef(null);
52
50
  var disabledValues = useMemo(function () {
53
51
  return useConditionFields.filter(function (v) {
54
52
  return v.field === formItem.name;
@@ -57,6 +55,8 @@ function ConditionForm(_ref) {
57
55
  });
58
56
  }, [formItem.name, useConditionFields]);
59
57
  var addCondition = useCallback(function () {
58
+ var modal = modalRef.current;
59
+
60
60
  var onOk = function onOk() {
61
61
  var _a, _b;
62
62
 
@@ -178,7 +178,9 @@ function ConditionForm(_ref) {
178
178
  },
179
179
  disabled: disabledValues.includes(item.value)
180
180
  }, item.label);
181
- }))));
181
+ }))), /*#__PURE__*/React.createElement(RefModal, {
182
+ ref: modalRef
183
+ }));
182
184
  }
183
185
 
184
186
  var ModalContent = /*#__PURE__*/React.forwardRef(function ModalContent(_ref2, ref) {
@@ -5,7 +5,6 @@ import "antd/lib/button/style";
5
5
  import _Button from "antd/lib/button";
6
6
  import "antd/lib/message/style";
7
7
  import _message from "antd/lib/message";
8
- import _useModal from "@cloud-app-dev/basic-components/es/useModal";
9
8
 
10
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
10
 
@@ -24,6 +23,7 @@ import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react'
24
23
  import _ from 'lodash';
25
24
  import chroma from 'chroma-js';
26
25
  import UserSelectModalContent from './UserSelectModalContent';
26
+ import RefModal from '../../RefModal';
27
27
 
28
28
  function EmptyUserSet(_ref) {
29
29
  var _this = this;
@@ -39,8 +39,7 @@ function EmptyUserSet(_ref) {
39
39
  state = _useState2[0],
40
40
  setState = _useState2[1];
41
41
 
42
- var modal = _useModal();
43
-
42
+ var modalRef = useRef(null);
44
43
  var cRef = useRef(null);
45
44
  var color = useMemo(function () {
46
45
  var c = getComputedStyle(document.querySelector(':root')).getPropertyValue('--primary');
@@ -50,6 +49,7 @@ function EmptyUserSet(_ref) {
50
49
  return chroma(col).alpha(0.5).hex('rgba');
51
50
  }, []);
52
51
  var userModify = useCallback(function () {
52
+ var modal = modalRef.current;
53
53
  modal.open({
54
54
  title: '添加人员',
55
55
  content: /*#__PURE__*/React.createElement(UserSelectModalContent, {
@@ -126,7 +126,9 @@ function EmptyUserSet(_ref) {
126
126
  return onCloseTag(v.value);
127
127
  }
128
128
  }, v.name);
129
- })));
129
+ })), /*#__PURE__*/React.createElement(RefModal, {
130
+ ref: modalRef
131
+ }));
130
132
  }
131
133
 
132
134
  export default EmptyUserSet;
@@ -6,5 +6,5 @@ interface IGroupListProps {
6
6
  keywords?: string;
7
7
  onChecked: (ids: string[]) => void;
8
8
  }
9
- declare function GroupList({ list, onKeywordChange, onChecked }: IGroupListProps): JSX.Element;
9
+ declare function GroupList({ list, onKeywordChange, onChecked, checkedKeys }: IGroupListProps): JSX.Element;
10
10
  export default GroupList;
@@ -6,7 +6,8 @@ import TreeTitle from '../../TreeTitle';
6
6
  function GroupList(_ref) {
7
7
  var list = _ref.list,
8
8
  onKeywordChange = _ref.onKeywordChange,
9
- onChecked = _ref.onChecked;
9
+ onChecked = _ref.onChecked,
10
+ checkedKeys = _ref.checkedKeys;
10
11
  return /*#__PURE__*/React.createElement("div", {
11
12
  className: "lm-c-check-list-wrapper vidc-list-component post-group-list"
12
13
  }, /*#__PURE__*/React.createElement(TreeTitle, {
@@ -17,6 +18,7 @@ function GroupList(_ref) {
17
18
  }), /*#__PURE__*/React.createElement("div", {
18
19
  className: "lm-c-base-list-layout"
19
20
  }, /*#__PURE__*/React.createElement(_Checkbox.Group, {
21
+ value: checkedKeys,
20
22
  onChange: function onChange(v) {
21
23
  return onChecked(v);
22
24
  }
@@ -5,7 +5,6 @@ import "antd/lib/button/style";
5
5
  import _Button from "antd/lib/button";
6
6
  import "antd/lib/message/style";
7
7
  import _message from "antd/lib/message";
8
- import _useModal from "@cloud-app-dev/basic-components/es/useModal";
9
8
 
10
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
10
 
@@ -25,6 +24,7 @@ import _ from 'lodash';
25
24
  import chroma from 'chroma-js';
26
25
  import GroupSelectModalContent from './GroupSelectModalContent';
27
26
  import { formatRenderGroup } from './utils';
27
+ import RefModal from '../../RefModal';
28
28
 
29
29
  function GroupSelect(_ref) {
30
30
  var _this = this;
@@ -40,8 +40,7 @@ function GroupSelect(_ref) {
40
40
  state = _useState2[0],
41
41
  setState = _useState2[1];
42
42
 
43
- var modal = _useModal();
44
-
43
+ var modalRef = useRef(null);
45
44
  var cRef = useRef(null);
46
45
  var color = useMemo(function () {
47
46
  var c = getComputedStyle(document.querySelector(':root')).getPropertyValue('--primary');
@@ -51,6 +50,7 @@ function GroupSelect(_ref) {
51
50
  return chroma(col).alpha(0.5).hex('rgba');
52
51
  }, []);
53
52
  var userModify = useCallback(function () {
53
+ var modal = modalRef.current;
54
54
  modal.open({
55
55
  title: '添加人员',
56
56
  content: /*#__PURE__*/React.createElement(GroupSelectModalContent, {
@@ -141,7 +141,9 @@ function GroupSelect(_ref) {
141
141
  }
142
142
  }, item.name);
143
143
  }));
144
- })));
144
+ })), /*#__PURE__*/React.createElement(RefModal, {
145
+ ref: modalRef
146
+ }));
145
147
  }
146
148
 
147
149
  export default GroupSelect;
@@ -21,8 +21,8 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
21
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
22
 
23
23
  import React, { useCallback, useMemo, useState, useImperativeHandle } from 'react';
24
- import api from '../api';
25
- import OrgTree from '../../OrgTree';
24
+ import api from '../../Api';
25
+ import TreeMode from '../../TreeMode';
26
26
  import List from '../../List';
27
27
  import { uniq, intersectionWith } from 'lodash';
28
28
  import { treeHelper } from '@cloud-app-dev/utils';
@@ -66,10 +66,10 @@ function GroupSelectModalContent(_ref, ref) {
66
66
  return id ? api.getPosts(id) : Promise.resolve();
67
67
  }),
68
68
  _useHttp3$data = _useHttp3.data,
69
- userList = _useHttp3$data === void 0 ? [] : _useHttp3$data;
69
+ groupList = _useHttp3$data === void 0 ? [] : _useHttp3$data;
70
70
 
71
71
  var onUserChecked1 = useCallback(function (ids) {
72
- var items = userList.filter(function (v) {
72
+ var items = groupList.filter(function (v) {
73
73
  return ids.includes(v.id);
74
74
  });
75
75
  var arr = [];
@@ -90,7 +90,7 @@ function GroupSelectModalContent(_ref, ref) {
90
90
  selectIds: uniq([].concat(_toConsumableArray(old.selectIds), _toConsumableArray(ids)))
91
91
  });
92
92
  });
93
- }, [userList, orgList]);
93
+ }, [groupList, orgList]);
94
94
  var onUserChecked2 = useCallback(function (ids) {
95
95
  return setState(function (old) {
96
96
  return Object.assign(Object.assign({}, old), {
@@ -99,12 +99,12 @@ function GroupSelectModalContent(_ref, ref) {
99
99
  });
100
100
  }, []);
101
101
  var list1CheckedKeys = useMemo(function () {
102
- return intersectionWith(userList, state.selectUsers, function (a, b) {
102
+ return intersectionWith(groupList, state.selectUsers, function (a, b) {
103
103
  return a.id === b.value;
104
104
  }).map(function (v) {
105
105
  return v.id;
106
106
  });
107
- }, [userList, state.selectUsers]);
107
+ }, [groupList, state.selectUsers]);
108
108
  useImperativeHandle(ref, function () {
109
109
  return {
110
110
  userList: state.selectUsers.filter(function (v) {
@@ -117,8 +117,9 @@ function GroupSelectModalContent(_ref, ref) {
117
117
  }, [state.selectUsers]);
118
118
  return /*#__PURE__*/React.createElement("div", {
119
119
  className: "user-select-modal-content"
120
- }, /*#__PURE__*/React.createElement(OrgTree, {
120
+ }, /*#__PURE__*/React.createElement(TreeMode, {
121
121
  treeData: treeData,
122
+ mode: "Org",
122
123
  title: "\u7EC4\u7EC7\u673A\u6784",
123
124
  onSelect: function onSelect(ids) {
124
125
  return setState(function (old) {
@@ -127,11 +128,11 @@ function GroupSelectModalContent(_ref, ref) {
127
128
  });
128
129
  });
129
130
  },
130
- activeKey: selectId
131
+ selectedKeys: [selectId]
131
132
  }), /*#__PURE__*/React.createElement(List, {
132
133
  onChecked: onUserChecked1,
133
- list: userList,
134
- key: userList.length,
134
+ list: groupList,
135
+ key: groupList.length,
135
136
  checkedKeys: list1CheckedKeys,
136
137
  itemKey: "id",
137
138
  itemNameKey: "postName",
@@ -7,7 +7,6 @@ import _Button from "antd/lib/button";
7
7
  import _IconFont from "@cloud-app-dev/basic-components/es/IconFont";
8
8
  import "antd/lib/message/style";
9
9
  import _message from "antd/lib/message";
10
- import _useModal from "@cloud-app-dev/basic-components/es/useModal";
11
10
 
12
11
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
12
 
@@ -27,6 +26,7 @@ import _ from 'lodash';
27
26
  import chroma from 'chroma-js';
28
27
  import GroupSelectModalContent from './GroupSelectModalContent';
29
28
  import { formatRenderGroup } from './utils';
29
+ import RefModal from '../../RefModal';
30
30
 
31
31
  function LevelGroupSelect(_ref) {
32
32
  var _this = this;
@@ -44,8 +44,7 @@ function LevelGroupSelect(_ref) {
44
44
  state = _useState2[0],
45
45
  setState = _useState2[1];
46
46
 
47
- var modal = _useModal();
48
-
47
+ var modalRef = useRef(null);
49
48
  var cRef = useRef(null);
50
49
  var color = useMemo(function () {
51
50
  var c = getComputedStyle(document.querySelector(':root')).getPropertyValue('--primary');
@@ -55,6 +54,7 @@ function LevelGroupSelect(_ref) {
55
54
  return chroma(col).alpha(0.5).hex('rgba');
56
55
  }, []);
57
56
  var userModify = useCallback(function () {
57
+ var modal = modalRef.current;
58
58
  modal.open({
59
59
  title: '添加人员',
60
60
  content: /*#__PURE__*/React.createElement(GroupSelectModalContent, {
@@ -175,7 +175,9 @@ function LevelGroupSelect(_ref) {
175
175
  value: 2
176
176
  }, "\u7B2C\u4E8C\u7EA7\u4E3B\u7BA1"), /*#__PURE__*/React.createElement(_Select.Option, {
177
177
  value: 3
178
- }, "\u7B2C\u4E09\u7EA7\u4E3B\u7BA1"))));
178
+ }, "\u7B2C\u4E09\u7EA7\u4E3B\u7BA1"))), /*#__PURE__*/React.createElement(RefModal, {
179
+ ref: modalRef
180
+ }));
179
181
  }
180
182
 
181
183
  export default LevelGroupSelect;
@@ -7,7 +7,8 @@ function NotifierForm(_ref) {
7
7
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UserSet, {
8
8
  userType: item.userType,
9
9
  nodeUserList: item.nodeUserList,
10
- onChange: onChange
10
+ onChange: onChange,
11
+ includeUserTypes: [1]
11
12
  }));
12
13
  }
13
14
 
@@ -7,7 +7,6 @@ import "antd/lib/select/style";
7
7
  import _Select from "antd/lib/select";
8
8
  import "antd/lib/message/style";
9
9
  import _message from "antd/lib/message";
10
- import _useModal from "@cloud-app-dev/basic-components/es/useModal";
11
10
 
12
11
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
12
 
@@ -27,6 +26,7 @@ import _ from 'lodash';
27
26
  import chroma from 'chroma-js';
28
27
  import UserSelectModalContent from './UserSelectModalContent';
29
28
  import GroupSelectModalContent from './GroupSelectModalContent';
29
+ import RefModal from '../../RefModal';
30
30
 
31
31
  function UserAndGroupSelect(_ref) {
32
32
  var _this = this;
@@ -47,8 +47,7 @@ function UserAndGroupSelect(_ref) {
47
47
  state = _useState2[0],
48
48
  setState = _useState2[1];
49
49
 
50
- var modal = _useModal();
51
-
50
+ var modalRef = useRef(null);
52
51
  var cRef = useRef(null);
53
52
  var color = useMemo(function () {
54
53
  var c = getComputedStyle(document.querySelector(':root')).getPropertyValue('--primary');
@@ -58,6 +57,7 @@ function UserAndGroupSelect(_ref) {
58
57
  return chroma(col).alpha(0.5).hex('rgba');
59
58
  }, []);
60
59
  var userModify = useCallback(function () {
60
+ var modal = modalRef.current;
61
61
  var Content = state.type === 'userId' ? UserSelectModalContent : GroupSelectModalContent;
62
62
  modal.open({
63
63
  title: '添加人员',
@@ -141,7 +141,9 @@ function UserAndGroupSelect(_ref) {
141
141
  key: v.value,
142
142
  color: color
143
143
  }, v.name);
144
- })));
144
+ })), /*#__PURE__*/React.createElement(RefModal, {
145
+ ref: modalRef
146
+ }));
145
147
  }
146
148
 
147
149
  export default UserAndGroupSelect;
@@ -5,7 +5,6 @@ import "antd/lib/button/style";
5
5
  import _Button from "antd/lib/button";
6
6
  import "antd/lib/message/style";
7
7
  import _message from "antd/lib/message";
8
- import _useModal from "@cloud-app-dev/basic-components/es/useModal";
9
8
 
10
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
10
 
@@ -24,6 +23,7 @@ import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react'
24
23
  import _ from 'lodash';
25
24
  import chroma from 'chroma-js';
26
25
  import UserSelectModalContent from './UserSelectModalContent';
26
+ import RefModal from '../../RefModal';
27
27
 
28
28
  function UserSelect(_ref) {
29
29
  var _this = this;
@@ -39,8 +39,7 @@ function UserSelect(_ref) {
39
39
  state = _useState2[0],
40
40
  setState = _useState2[1];
41
41
 
42
- var modal = _useModal();
43
-
42
+ var modalRef = useRef(null);
44
43
  var cRef = useRef(null);
45
44
  var color = useMemo(function () {
46
45
  var c = getComputedStyle(document.querySelector(':root')).getPropertyValue('--primary');
@@ -50,6 +49,7 @@ function UserSelect(_ref) {
50
49
  return chroma(col).alpha(0.5).hex('rgba');
51
50
  }, []);
52
51
  var userModify = useCallback(function () {
52
+ var modal = modalRef.current;
53
53
  modal.open({
54
54
  title: '添加人员',
55
55
  content: /*#__PURE__*/React.createElement(UserSelectModalContent, {
@@ -124,7 +124,9 @@ function UserSelect(_ref) {
124
124
  return onCloseTag(v.value);
125
125
  }
126
126
  }, v.name);
127
- })));
127
+ })), /*#__PURE__*/React.createElement(RefModal, {
128
+ ref: modalRef
129
+ }));
128
130
  }
129
131
 
130
132
  export default UserSelect;
@@ -21,11 +21,10 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
21
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
22
 
23
23
  import React, { useCallback, useMemo, useState, forwardRef, useImperativeHandle } from 'react';
24
- import api from '../api';
25
- import OrgTree from '../../OrgTree';
26
- import { treeHelper } from '@cloud-app-dev/utils';
24
+ import api from '../../Api';
25
+ import TreeMode from '../../TreeMode';
27
26
  import List from '../../List';
28
- import { uniq, intersectionWith } from 'lodash';
27
+ import { uniq, intersectionWith, uniqBy, differenceWith } from 'lodash';
29
28
  var UserSelectModalContent = /*#__PURE__*/forwardRef(function UserSelectModalContent(_ref, ref) {
30
29
  var selectUsers = _ref.selectUsers;
31
30
 
@@ -34,6 +33,9 @@ var UserSelectModalContent = /*#__PURE__*/forwardRef(function UserSelectModalCon
34
33
  keyword2: '',
35
34
  orgId: '',
36
35
  selectUsers: selectUsers,
36
+ list1CheckedKeys: selectUsers.map(function (v) {
37
+ return v.value;
38
+ }),
37
39
  selectIds: selectUsers.map(function (v) {
38
40
  return v.value;
39
41
  })
@@ -42,33 +44,23 @@ var UserSelectModalContent = /*#__PURE__*/forwardRef(function UserSelectModalCon
42
44
  state = _useState2[0],
43
45
  setState = _useState2[1];
44
46
 
45
- var _useHttp = _useHttp2('QueryOrgList', function () {
46
- return api.getOrgs();
47
- }),
48
- _useHttp$data = _useHttp.data,
49
- orgList = _useHttp$data === void 0 ? [] : _useHttp$data;
50
-
51
- var treeData = useMemo(function () {
52
- return treeHelper.computTreeList(orgList);
53
- }, [orgList]);
54
- var selectId = useMemo(function () {
55
- return state.orgId ? state.orgId : treeData[0] ? treeData[0].id : undefined;
56
- }, [treeData, state.orgId]);
57
-
58
- var _useHttp3 = _useHttp2(['QueryUserList', selectId], function (_ref2) {
47
+ var _useHttp = _useHttp2(['QueryUserList', state.orgId], function (_ref2) {
59
48
  var _ref3 = _slicedToArray(_ref2, 2),
60
49
  _ = _ref3[0],
61
50
  id = _ref3[1];
62
51
 
63
52
  return id ? api.getUsers(id) : Promise.resolve();
64
53
  }),
65
- _useHttp3$data = _useHttp3.data,
66
- userList = _useHttp3$data === void 0 ? [] : _useHttp3$data;
54
+ _useHttp$data = _useHttp.data,
55
+ userList = _useHttp$data === void 0 ? [] : _useHttp$data;
67
56
 
68
57
  var onUserChecked1 = useCallback(function (ids) {
69
58
  var items = userList.filter(function (v) {
70
59
  return ids.includes(v.id);
71
60
  });
61
+ var notInList = differenceWith(state.selectUsers, userList, function (a, b) {
62
+ return a.value === b.id;
63
+ });
72
64
  var arr = [];
73
65
  items.forEach(function (item) {
74
66
  arr.push({
@@ -79,11 +71,12 @@ var UserSelectModalContent = /*#__PURE__*/forwardRef(function UserSelectModalCon
79
71
  });
80
72
  setState(function (old) {
81
73
  return Object.assign(Object.assign({}, old), {
82
- selectUsers: arr,
74
+ selectUsers: uniqBy([].concat(_toConsumableArray(notInList), arr), 'value'),
75
+ list1CheckedKeys: ids,
83
76
  selectIds: uniq([].concat(_toConsumableArray(old.selectIds), _toConsumableArray(ids)))
84
77
  });
85
78
  });
86
- }, [userList]);
79
+ }, [userList, state.selectUsers]);
87
80
  var onUserChecked2 = useCallback(function (ids) {
88
81
  return setState(function (old) {
89
82
  return Object.assign(Object.assign({}, old), {
@@ -107,9 +100,16 @@ var UserSelectModalContent = /*#__PURE__*/forwardRef(function UserSelectModalCon
107
100
  }, [state.selectUsers, state.selectIds]);
108
101
  return /*#__PURE__*/React.createElement("div", {
109
102
  className: "user-select-modal-content"
110
- }, /*#__PURE__*/React.createElement(OrgTree, {
111
- treeData: treeData,
103
+ }, /*#__PURE__*/React.createElement(TreeMode, {
112
104
  title: "\u7EC4\u7EC7\u673A\u6784",
105
+ onDefailtSelect: function onDefailtSelect(orgId) {
106
+ return setState(function (old) {
107
+ return Object.assign(Object.assign({}, old), {
108
+ orgId: orgId
109
+ });
110
+ });
111
+ },
112
+ inputPlaceholder: "\u8BF7\u8F93\u5165\u540D\u79F0",
113
113
  onSelect: function onSelect(ids) {
114
114
  return setState(function (old) {
115
115
  return Object.assign(Object.assign({}, old), {
@@ -117,7 +117,8 @@ var UserSelectModalContent = /*#__PURE__*/forwardRef(function UserSelectModalCon
117
117
  });
118
118
  });
119
119
  },
120
- activeKey: selectId
120
+ selectedKeys: [state.orgId],
121
+ mode: "Org"
121
122
  }), /*#__PURE__*/React.createElement(List, {
122
123
  onChecked: onUserChecked1,
123
124
  list: userList,
@@ -695,7 +695,7 @@
695
695
  .user-select-modal-content > div {
696
696
  flex: 1;
697
697
  }
698
- .user-select-modal-content .lm-organization-tree {
698
+ .user-select-modal-content .bc-org-user-tree-layout {
699
699
  border-right: none;
700
700
  }
701
701
  .user-select-modal-content .user-source-list {