@tddc/assign-modal 2.0.6 → 3.0.2

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.
@@ -1,99 +1,310 @@
1
1
  .assign-box-container {
2
- display: flex;
3
- height: 550px;
4
- background-color: #fff;
5
- .menu-header {
6
- display: flex;
7
- align-items: center;
8
- justify-content: space-between;
9
- height: 44px;
10
- padding: 0 20px;
11
- color: #17233d;
12
- font-size: 14px;
13
- border-bottom: 1px solid #e1e6ee;
2
+ & {
3
+ height: calc(100% - 24px);
4
+ overflow: hidden;
14
5
  }
15
6
 
16
- .left {
17
- position: relative;
18
- z-index: 3;
19
- width: 430px;
20
- background: #ffffff;
21
- box-shadow: 0px 0px 6px 0px rgba(58, 48, 48, 0.12);
22
- .tree-list {
23
- height: calc(100% - 52px);
24
- padding-top: 10px;
25
- overflow: auto;
26
-
27
- .node-title {
28
- position: relative;
29
- display: inline;
7
+ .slider {
8
+ display: flex;
9
+ height: calc(100% - 24px);
10
+ margin-top: 16px;
11
+ transition: transform 0.2s ease;
12
+
13
+ .panel {
14
+ // width: 650px;
15
+ flex: 1;
16
+ min-width: 652px;
17
+ height: 100%;
18
+ padding: 16px;
19
+ overflow: hidden;
20
+ background-color: #fff;
21
+ border-radius: @border-radius-base * 2;
22
+ }
23
+
24
+ .panel-menu-body {
25
+ & {
26
+ display: flex;
30
27
  width: 100%;
31
- &.active {
32
- &::after {
33
- position: absolute;
34
- top: 1px;
35
- right: -9px;
36
- width: 6px;
37
- height: 6px;
38
- background-color: #f7b036;
39
- border-radius: 50%;
40
- content: ' ';
28
+ height: calc(100% - 36px);
29
+ padding: 16px;
30
+ background: @fill-color-quaternary;
31
+ border-radius: @border-radius-base;
32
+ }
33
+
34
+ > div {
35
+ width: 50%;
36
+ }
37
+ .panel-left {
38
+ height: 100%;
39
+ // overflow: auto;
40
+
41
+ > .ant-input-affix-wrapper {
42
+ position: sticky;
43
+ top: 0px;
44
+ z-index: 1;
45
+ background: #f8f9fb;
46
+ }
47
+ }
48
+ .panel-right {
49
+ overflow: hidden;
50
+ & {
51
+ padding: 0 0px 16px 16px;
52
+ border-left: 1px solid @border-color-secondary;
53
+ }
54
+ .select-menu-header {
55
+ display: flex;
56
+ align-items: flex-start;
57
+ justify-content: space-between;
58
+ margin-bottom: 16px;
59
+ }
60
+
61
+ .select-menu-list {
62
+ position: relative;
63
+ height: calc(100% - 16px);
64
+ margin: 0px;
65
+ padding: 0px;
66
+ overflow: auto;
67
+
68
+ > .ant-input-affix-wrapper {
69
+ position: sticky;
70
+ top: 0px;
71
+ z-index: 1;
72
+ background: #f8f9fb;
73
+ }
74
+
75
+ .select-menu-list-item {
76
+ position: relative;
77
+ display: flex;
78
+ flex-direction: column;
79
+ height: 50px;
80
+ margin-bottom: 4px;
81
+ padding: 4px 16px 4px 8px;
82
+ border-radius: @border-radius-base;
83
+
84
+ .org-name {
85
+ display: inline-block;
86
+ color: @bg-color-spotilight;
87
+ font-weight: 400;
88
+ font-size: 14px;
89
+ font-family: 'PingFang SC';
90
+ line-height: 22px;
91
+ }
92
+ .path-name {
93
+ display: inline-block;
94
+ color: tint(@bg-color-spotilight, 50%);
95
+ font-weight: 400;
96
+ font-size: 12px;
97
+ font-family: 'PingFang SC';
98
+ line-height: 20px;
99
+ }
100
+ .close-icon {
101
+ position: absolute;
102
+ top: calc(50% - 6px);
103
+ right: 8px;
104
+ font-size: 12px;
105
+ cursor: pointer;
106
+ }
107
+ }
108
+ .select-menu-list-item:hover {
109
+ background-color: #fff;
41
110
  }
42
111
  }
43
112
  }
113
+ }
114
+
115
+ .app-panel,
116
+ .user-panel {
117
+ .panel-menu-body {
118
+ .panel-left {
119
+ position: relative;
120
+ display: flex;
121
+ flex-direction: column;
122
+
123
+ > .ant-input-affix-wrapper {
124
+ position: sticky;
125
+ top: 0px;
126
+ z-index: 1;
127
+ background: #f8f9fb;
128
+ }
129
+
130
+ > label {
131
+ margin-bottom: 8px;
132
+ }
133
+ > label:last-child {
134
+ margin-bottom: 0px;
135
+ }
136
+ }
44
137
 
45
- // .ant-tree-checkbox-indeterminate
46
- // .ant-tree-checkbox-inner:after{
47
- // position: absolute;
48
- // display: table;
49
- // border: 2px solid #fff;
50
- // border-top: 0;
51
- // border-left: 0;
52
- // transform: rotate(45deg) scale(1) translate(-50%, -50%);
53
- // opacity: 1;
54
- // transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;
55
- // width: 5.71428571px;
56
- // height: 9.14285714px;
57
- // content: ' ';
58
- // left: 3px;
59
- // }
60
-
61
- // .ant-tree-checkbox-indeterminate .ant-tree-checkbox-inner {
62
- // background-color: #126BFB;
63
- // border-color: #126BFB;
64
- // }
138
+ .panel-right {
139
+ .select-menu-list {
140
+ .select-menu-list-item {
141
+ height: 30px;
142
+ padding: 4px 8px;
143
+ }
144
+ }
145
+ }
146
+ }
65
147
  }
66
148
  }
67
149
 
68
- .right {
69
- z-index: 2;
70
- flex: 1;
71
- overflow: scroll;
72
- background: #fcfcfc;
73
- box-shadow: 0 0 10px 0 rgba(213, 213, 213, 0.5);
74
- .menu-body {
75
- margin: 20px;
76
- .ant-checkbox-wrapper {
77
- margin-left: 16px !important;
150
+ .slider.panel-0 {
151
+ transform: translateX(0);
152
+ }
153
+ .slider.panel-1 {
154
+ transform: translateX(-652px);
155
+ }
156
+ .slider.panel-2 {
157
+ transform: translateX(-1304px);
158
+ }
159
+
160
+ .menu-header {
161
+ & {
162
+ display: flex;
163
+ justify-content: space-between;
164
+ width: 100%;
165
+ margin-bottom: 16px;
166
+ }
167
+ .title {
168
+ position: relative;
169
+ margin-left: 16px;
170
+ color: @text-color;
171
+ font-weight: 600;
172
+ font-style: normal;
173
+ line-height: 22px;
174
+ .sum {
175
+ display: inline-block;
176
+ margin: 0 4px;
177
+ color: @blue-6;
78
178
  }
179
+ .text-grey {
180
+ color: tint(@text-color, 50%);
181
+ }
182
+ }
183
+ .title::after {
184
+ position: absolute;
185
+ top: 5px;
186
+ left: -14px;
187
+ display: inline-block;
188
+ width: 4px;
189
+ height: 12px;
190
+ background: @blue-6;
191
+ border-radius: 4px;
192
+ content: '';
79
193
  }
80
194
  }
195
+ }
196
+
197
+ .assign-box-container.view-mode {
198
+ & {
199
+ display: flex;
200
+ gap: 16px;
201
+ height: 100%;
202
+ }
203
+ .panel.org-panel,
204
+ .panel.app-panel,
205
+ .panel.user-panel {
206
+ flex: 1;
207
+ height: 100%;
208
+ padding: 16px;
209
+ overflow: hidden;
210
+ background-color: #fff;
211
+ border-radius: @border-radius-base * 2;
81
212
 
82
- .user {
83
- position: relative;
84
- z-index: 1;
85
- width: 320px;
86
- overflow: auto;
87
- background: #ffffff;
88
- box-shadow: 0px 0px 6px 0px rgba(58, 48, 48, 0.12);
89
- .menu-body {
90
- margin: 20px;
91
- .ant-checkbox-wrapper {
92
- margin: 0 4px !important;
213
+ .panel-menu-body {
214
+ & {
215
+ width: 100%;
216
+ height: calc(100% - 36px);
217
+ padding: 16px;
218
+ background: @fill-color-quaternary;
219
+ border-radius: @border-radius-base;
220
+ }
221
+
222
+ .select-menu-header {
223
+ display: flex;
224
+ align-items: flex-start;
225
+ justify-content: space-between;
226
+ margin-bottom: 16px;
227
+ }
228
+
229
+ .select-menu-list {
230
+ position: relative;
231
+ height: 100%;
232
+ margin: 0px;
233
+ padding: 0px;
234
+ overflow: auto;
235
+
236
+ > .ant-input-affix-wrapper {
237
+ position: sticky;
238
+ top: 0px;
239
+ z-index: 1;
240
+ background: #f8f9fb;
241
+ }
242
+ .select-menu-list-item {
243
+ &:last-child {
244
+ margin-bottom: 0px;
245
+ }
246
+ margin-bottom: 8px;
247
+ }
93
248
  }
94
249
  }
95
250
  }
96
- .assign-search-wrap {
97
- margin: -8px 0 10px 0;
251
+
252
+ .org-panel {
253
+ flex: 1;
254
+
255
+ .panel-menu-body {
256
+ padding: 16px;
257
+ background: #f8f9fb;
258
+ border-radius: 8px;
259
+ // overflow: auto;
260
+ }
261
+
262
+ .select-menu-list {
263
+ position: relative;
264
+ height: calc(100% - 16px);
265
+ margin: 0px;
266
+ padding: 16px;
267
+
268
+ > .ant-input-affix-wrapper {
269
+ position: sticky;
270
+ top: 0px;
271
+ z-index: 1;
272
+ background: #f8f9fb;
273
+ }
274
+
275
+ .select-menu-list-item {
276
+ & {
277
+ position: relative;
278
+ display: flex;
279
+ flex-direction: column;
280
+ height: 50px;
281
+ margin-bottom: 4px !important;
282
+ padding: 0px;
283
+ border-radius: @border-radius-base;
284
+ }
285
+ &:last-child {
286
+ margin-bottom: 0px;
287
+ }
288
+
289
+ .org-name {
290
+ display: inline-block;
291
+ height: 22px;
292
+ color: @bg-color-spotilight;
293
+ font-weight: 400;
294
+ font-size: 14px;
295
+ font-family: 'PingFang SC';
296
+ line-height: 22px;
297
+ }
298
+ .path-name {
299
+ display: inline-block;
300
+ height: 22px;
301
+ color: tint(@bg-color-spotilight, 50%);
302
+ font-weight: 400;
303
+ font-size: 12px;
304
+ font-family: 'PingFang SC';
305
+ line-height: 22px;
306
+ }
307
+ }
308
+ }
98
309
  }
99
310
  }
@@ -1,8 +1,52 @@
1
- function _toConsumableArray(arr) {
1
+ function _slicedToArray(r, e) {
2
2
  return (
3
- _arrayWithoutHoles(arr) ||
4
- _iterableToArray(arr) ||
5
- _unsupportedIterableToArray(arr) ||
3
+ _arrayWithHoles(r) ||
4
+ _iterableToArrayLimit(r, e) ||
5
+ _unsupportedIterableToArray(r, e) ||
6
+ _nonIterableRest()
7
+ );
8
+ }
9
+ function _nonIterableRest() {
10
+ throw new TypeError(
11
+ 'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.',
12
+ );
13
+ }
14
+ function _iterableToArrayLimit(r, l) {
15
+ var t =
16
+ null == r ? null : ('undefined' != typeof Symbol && r[Symbol.iterator]) || r['@@iterator'];
17
+ if (null != t) {
18
+ var e,
19
+ n,
20
+ i,
21
+ u,
22
+ a = [],
23
+ f = !0,
24
+ o = !1;
25
+ try {
26
+ if (((i = (t = t.call(r)).next), 0 === l)) {
27
+ if (Object(t) !== t) return;
28
+ f = !1;
29
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
30
+ } catch (r) {
31
+ (o = !0), (n = r);
32
+ } finally {
33
+ try {
34
+ if (!f && null != t.return && ((u = t.return()), Object(u) !== u)) return;
35
+ } finally {
36
+ if (o) throw n;
37
+ }
38
+ }
39
+ return a;
40
+ }
41
+ }
42
+ function _arrayWithHoles(r) {
43
+ if (Array.isArray(r)) return r;
44
+ }
45
+ function _toConsumableArray(r) {
46
+ return (
47
+ _arrayWithoutHoles(r) ||
48
+ _iterableToArray(r) ||
49
+ _unsupportedIterableToArray(r) ||
6
50
  _nonIterableSpread()
7
51
  );
8
52
  }
@@ -11,84 +55,169 @@ function _nonIterableSpread() {
11
55
  'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.',
12
56
  );
13
57
  }
14
- function _unsupportedIterableToArray(o, minLen) {
15
- if (!o) return;
16
- if (typeof o === 'string') return _arrayLikeToArray(o, minLen);
17
- var n = Object.prototype.toString.call(o).slice(8, -1);
18
- if (n === 'Object' && o.constructor) n = o.constructor.name;
19
- if (n === 'Map' || n === 'Set') return Array.from(o);
20
- if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
21
- return _arrayLikeToArray(o, minLen);
58
+ function _unsupportedIterableToArray(r, a) {
59
+ if (r) {
60
+ if ('string' == typeof r) return _arrayLikeToArray(r, a);
61
+ var t = {}.toString.call(r).slice(8, -1);
62
+ return (
63
+ 'Object' === t && r.constructor && (t = r.constructor.name),
64
+ 'Map' === t || 'Set' === t
65
+ ? Array.from(r)
66
+ : 'Arguments' === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)
67
+ ? _arrayLikeToArray(r, a)
68
+ : void 0
69
+ );
70
+ }
22
71
  }
23
- function _iterableToArray(iter) {
24
- if (
25
- (typeof Symbol !== 'undefined' && iter[Symbol.iterator] != null) ||
26
- iter['@@iterator'] != null
27
- )
28
- return Array.from(iter);
72
+ function _iterableToArray(r) {
73
+ if (('undefined' != typeof Symbol && null != r[Symbol.iterator]) || null != r['@@iterator'])
74
+ return Array.from(r);
29
75
  }
30
- function _arrayWithoutHoles(arr) {
31
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
76
+ function _arrayWithoutHoles(r) {
77
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
32
78
  }
33
- function _arrayLikeToArray(arr, len) {
34
- if (len == null || len > arr.length) len = arr.length;
35
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
36
- arr2[i] = arr[i];
37
- }
38
- return arr2;
79
+ function _arrayLikeToArray(r, a) {
80
+ (null == a || a > r.length) && (a = r.length);
81
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
82
+ return n;
39
83
  }
84
+ import { debounce } from 'lodash';
85
+ import { useState, useEffect } from 'react';
86
+
40
87
  // 遍历机构树 添加 path属性 (上级机构到子机构的路径)
41
- export var addPath = function addPath(root) {
42
- var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
88
+ var _dataFormat = function dataFormat(root, cb) {
43
89
  if (!root) {
44
90
  return;
45
91
  }
46
92
  var path = [].concat(_toConsumableArray(parent), [root.code]);
47
93
  root.path = _toConsumableArray(path);
94
+ root.path = _toConsumableArray(path);
95
+ root.show = true;
96
+ cb && cb(root.key, root);
48
97
  for (var i = 0; i < root.children.length; i++) {
49
- addPath(root.children[i], path);
98
+ _dataFormat(root.children[i], path, cb);
50
99
  }
51
100
  };
52
101
 
53
102
  // 遍历寻找 当前规则集所属机构
54
- export var findSameCodePath = function findSameCodePath(orgList, code) {
55
- var loop = function loop(list, code) {
56
- for (var i = 0; i < list.length; i++) {
57
- var _root$children;
58
- var root = list[i];
59
- if (root.code === code) {
60
- return root;
61
- }
62
- if (
63
- ((_root$children = root.children) === null || _root$children === void 0
64
- ? void 0
65
- : _root$children.length) > 0
66
- ) {
67
- var _back = loop(root.children, code);
68
- if (_back) {
69
- return _back;
70
- }
71
- }
103
+ export { _dataFormat as dataFormat };
104
+ export var findSameCodePath = function findSameCodePath(root, code) {
105
+ var res = {};
106
+ var _dfs = function dfs(root, code) {
107
+ if (!root) {
108
+ return;
109
+ }
110
+ if (root.code === code) res = root;
111
+ for (var i = 0; i < root.children.length; i++) {
112
+ _dfs(root.children[i], code);
72
113
  }
73
- return false;
74
114
  };
75
- var back = loop(orgList, code);
76
- return (back === null || back === void 0 ? void 0 : back.path) || [];
115
+ _dfs(root, code);
116
+ return res.path || [];
77
117
  };
78
118
 
79
119
  // 遍历输出 orgCode;
80
- export var preorder = function preorder(root) {
120
+ export var preorder = function preorder(root, cb) {
121
+ var isAddPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
81
122
  var res = [];
82
- var dfs = function dfs(root) {
123
+ var _dfs2 = function dfs(root) {
83
124
  var res = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
125
+ var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
126
+ var cb = arguments.length > 3 ? arguments[3] : undefined;
84
127
  if (!root) {
85
128
  return;
86
129
  }
130
+ var path = [];
131
+ if (isAddPath) {
132
+ path = [].concat(_toConsumableArray(parent), [root.code]);
133
+ root.path = _toConsumableArray(path);
134
+ root.path = _toConsumableArray(path);
135
+ root.show = true;
136
+ }
87
137
  res.push(root.code || root.key);
88
- for (var i = 0; i < root.children.length; i++) {
89
- dfs(root.children[i], res);
138
+ cb && cb(root.key, root);
139
+ for (
140
+ var i = 0;
141
+ i <
142
+ (root === null || root === void 0
143
+ ? void 0
144
+ : (_root$children = root.children) === null || _root$children === void 0
145
+ ? void 0
146
+ : _root$children.length);
147
+ i++
148
+ ) {
149
+ var _root$children;
150
+ _dfs2(root.children[i], res, path, cb);
90
151
  }
91
152
  };
92
- dfs(root, res);
153
+ _dfs2(root, res, [], cb);
93
154
  return res;
94
155
  };
156
+ export var mergeAndDeduplicate = function mergeAndDeduplicate(arr1, arr2) {
157
+ // 合并两个数组
158
+ var combined = [].concat(_toConsumableArray(arr1), _toConsumableArray(arr2));
159
+
160
+ // 用 Set 对象来追踪已经遇到过的元素
161
+ var seen = new Set();
162
+
163
+ // 使用 filter 方法去重并保持顺序
164
+ var uniqueCombined = combined.filter(function (item) {
165
+ if (seen.has(item)) {
166
+ return false;
167
+ }
168
+ seen.add(item);
169
+ return true;
170
+ });
171
+ return uniqueCombined;
172
+ };
173
+ export var doSearch = function doSearch() {
174
+ var fileterKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
175
+ var flattenTreeMap = arguments.length > 1 ? arguments[1] : undefined;
176
+ var cb = arguments.length > 2 ? arguments[2] : undefined;
177
+ var treeNodeArr = Object.keys(flattenTreeMap);
178
+ var areadyHandled = [];
179
+ for (var i = 0; i < treeNodeArr.length; i++) {
180
+ var key = treeNodeArr[i];
181
+ var node = flattenTreeMap[key];
182
+ if (!fileterKeys) {
183
+ flattenTreeMap[key].show = true;
184
+ }
185
+ var name = node.name,
186
+ value = node.value,
187
+ path = node.path;
188
+ var filteredStr = name.toLowerCase() + value.toLowerCase();
189
+ if (filteredStr.includes(fileterKeys.toLowerCase())) {
190
+ path
191
+ .filter(function (i) {
192
+ return !areadyHandled.includes(i);
193
+ })
194
+ .map(function (i) {
195
+ areadyHandled.push(i);
196
+ flattenTreeMap[i].show = true;
197
+ });
198
+ } else {
199
+ !areadyHandled.includes(key) && (flattenTreeMap[key].show = false);
200
+ }
201
+ }
202
+ cb && cb();
203
+ };
204
+ export var useWindowHeight = function useWindowHeight(gap) {
205
+ var _useState = useState(window.innerHeight - gap),
206
+ _useState2 = _slicedToArray(_useState, 2),
207
+ windowHeight = _useState2[0],
208
+ setWindowHeight = _useState2[1];
209
+ useEffect(
210
+ function () {
211
+ var handleResize = debounce(function () {
212
+ setWindowHeight(window.innerHeight - gap);
213
+ });
214
+ window.addEventListener('resize', handleResize);
215
+ // 清理事件监听器
216
+ return function () {
217
+ window.removeEventListener('resize', handleResize);
218
+ };
219
+ },
220
+ [gap],
221
+ );
222
+ return windowHeight;
223
+ };