@tddc/assign-modal 3.1.5 → 3.1.6
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/es/index.js +67791 -3
- package/es/index.js.LICENSE.txt +45 -0
- package/lib/index.js +70897 -0
- package/lib/index.js.LICENSE.txt +45 -0
- package/package.json +44 -2
- package/src/.octopus/ar-EG/index.js +17 -3
- package/src/.octopus/en-US/index.js +6 -6
- package/src/.octopus/es-ES/index.js +17 -3
- package/src/.octopus/ko-KR/index.js +17 -3
- package/src/.octopus/th-TH/index.js +17 -3
- package/src/.octopus/zh-TW/index.js +19 -0
- package/src/I18N.js +3 -0
- package/src/locale/en-US.js +5 -0
- package/src/locale/es-ES.js +5 -0
- package/src/locale/ko-KR.js +5 -0
- package/src/locale/th-TH.js +5 -0
- package/src/locale/zh-CN.js +5 -0
- package/src/locale/zh-TW.js +5 -0
- package/es/AssignModal/AssignApp/Edit.js +0 -1504
- package/es/AssignModal/AssignApp/Edit_without_TntdVirtualTree.js +0 -1359
- package/es/AssignModal/AssignApp/View.js +0 -641
- package/es/AssignModal/AssignApp/index.js +0 -9
- package/es/AssignModal/AssignApp/index.less +0 -329
- package/es/AssignModal/AssignApp/utils.js +0 -241
- package/es/AssignModal/index.js +0 -202
- package/es/AssignModal/index.less +0 -12
- package/es/I18N.js +0 -102
- package/es/locale/ar-EG.js +0 -4
- package/es/locale/en-US.js +0 -0
- package/es/locale/es-ES.js +0 -0
- package/es/locale/ko-KR.js +0 -0
- package/es/locale/th-TH.js +0 -0
- package/es/locale/zh-CN.js +0 -0
- package/src/.octopus/ar-EG/test.js +0 -3
- package/src/.octopus/en-US/test.js +0 -3
- package/src/.octopus/es-ES/test.js +0 -3
- package/src/.octopus/ko-KR/test.js +0 -3
- package/src/.octopus/th-TH/test.js +0 -3
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
.assign-box-container {
|
|
2
|
-
& {
|
|
3
|
-
height: calc(100% - 24px);
|
|
4
|
-
overflow: hidden;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.slider {
|
|
8
|
-
display: flex;
|
|
9
|
-
height: calc(100% - 24px);
|
|
10
|
-
margin-top: 16px;
|
|
11
|
-
// transition 已移至 inline style,支持动态面板数量
|
|
12
|
-
|
|
13
|
-
.panel {
|
|
14
|
-
flex: 1 0 0; // flex-grow: 1, flex-shrink: 0, flex-basis: 0
|
|
15
|
-
// 每个面板平分 slider 宽度,不压缩,从 0 基准开始计算
|
|
16
|
-
height: 100%;
|
|
17
|
-
padding: 16px;
|
|
18
|
-
overflow: hidden;
|
|
19
|
-
background-color: #fff;
|
|
20
|
-
border-radius: @border-radius-base * 2;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.panel-menu-body {
|
|
24
|
-
& {
|
|
25
|
-
display: flex;
|
|
26
|
-
width: 100%;
|
|
27
|
-
height: calc(100% - 36px);
|
|
28
|
-
padding: 16px 0 16px 16px;
|
|
29
|
-
background: @fill-color-quaternary;
|
|
30
|
-
border-radius: @border-radius-base;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
> div {
|
|
34
|
-
width: 50%;
|
|
35
|
-
}
|
|
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
|
-
height: 28px;
|
|
46
|
-
// background: #f8f9fb;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
> .ant-checkbox-wrapper {
|
|
50
|
-
margin-left: 8px;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.panel-right {
|
|
55
|
-
overflow: hidden;
|
|
56
|
-
|
|
57
|
-
& {
|
|
58
|
-
padding: 0 0px 16px 16px;
|
|
59
|
-
border-left: 1px solid @border-color-secondary;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.select-menu-header {
|
|
63
|
-
display: flex;
|
|
64
|
-
align-items: flex-start;
|
|
65
|
-
justify-content: space-between;
|
|
66
|
-
margin-right: 16px;
|
|
67
|
-
margin-bottom: 16px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.select-menu-list {
|
|
71
|
-
position: relative;
|
|
72
|
-
height: calc(100% - 16px);
|
|
73
|
-
margin: 0px;
|
|
74
|
-
padding: 0px;
|
|
75
|
-
overflow: auto;
|
|
76
|
-
|
|
77
|
-
> .ant-input-affix-wrapper {
|
|
78
|
-
position: sticky;
|
|
79
|
-
top: 0px;
|
|
80
|
-
z-index: 1;
|
|
81
|
-
background: #f8f9fb;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.select-menu-list-item {
|
|
85
|
-
position: relative;
|
|
86
|
-
display: flex;
|
|
87
|
-
flex-direction: column;
|
|
88
|
-
height: 50px;
|
|
89
|
-
margin-right: 8px;
|
|
90
|
-
margin-bottom: 4px;
|
|
91
|
-
padding: 4px 16px 4px 8px;
|
|
92
|
-
border-radius: @border-radius-base;
|
|
93
|
-
|
|
94
|
-
.org-name {
|
|
95
|
-
display: inline-block;
|
|
96
|
-
color: @bg-color-spotilight;
|
|
97
|
-
font-weight: 400;
|
|
98
|
-
font-size: 14px;
|
|
99
|
-
font-family: 'PingFang SC';
|
|
100
|
-
line-height: 22px;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.path-name {
|
|
104
|
-
display: inline-block;
|
|
105
|
-
color: tint(@bg-color-spotilight, 50%);
|
|
106
|
-
font-weight: 400;
|
|
107
|
-
font-size: 12px;
|
|
108
|
-
font-family: 'PingFang SC';
|
|
109
|
-
line-height: 20px;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.close-icon {
|
|
113
|
-
position: absolute;
|
|
114
|
-
top: calc(50% - 6px);
|
|
115
|
-
right: 8px;
|
|
116
|
-
font-size: 12px;
|
|
117
|
-
cursor: pointer;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.select-menu-list-item:hover {
|
|
122
|
-
background-color: #fff;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.app-panel,
|
|
129
|
-
.user-panel {
|
|
130
|
-
.panel-menu-body {
|
|
131
|
-
.panel-left {
|
|
132
|
-
position: relative;
|
|
133
|
-
display: flex;
|
|
134
|
-
flex-direction: column;
|
|
135
|
-
|
|
136
|
-
> .ant-input-affix-wrapper {
|
|
137
|
-
position: sticky;
|
|
138
|
-
top: 0px;
|
|
139
|
-
z-index: 1;
|
|
140
|
-
background: #f8f9fb;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
> label {
|
|
144
|
-
margin-bottom: 8px;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
> label:last-child {
|
|
148
|
-
margin-bottom: 0px;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.panel-right {
|
|
153
|
-
.select-menu-list {
|
|
154
|
-
.select-menu-list-item {
|
|
155
|
-
height: 30px;
|
|
156
|
-
padding: 4px 8px;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.menu-header {
|
|
165
|
-
& {
|
|
166
|
-
display: flex;
|
|
167
|
-
justify-content: space-between;
|
|
168
|
-
width: 100%;
|
|
169
|
-
margin-bottom: 16px;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.title {
|
|
173
|
-
position: relative;
|
|
174
|
-
margin-left: 12px;
|
|
175
|
-
color: @text-color;
|
|
176
|
-
font-weight: 600;
|
|
177
|
-
font-style: normal;
|
|
178
|
-
line-height: 22px;
|
|
179
|
-
|
|
180
|
-
.sum {
|
|
181
|
-
display: inline-block;
|
|
182
|
-
margin: 0 4px;
|
|
183
|
-
color: @blue-6;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.text-grey {
|
|
187
|
-
color: tint(@text-color, 50%);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.title::after {
|
|
192
|
-
position: absolute;
|
|
193
|
-
top: 5px;
|
|
194
|
-
left: -12px;
|
|
195
|
-
display: inline-block;
|
|
196
|
-
width: 4px;
|
|
197
|
-
height: 12px;
|
|
198
|
-
background: @blue-6;
|
|
199
|
-
border-radius: 4px;
|
|
200
|
-
content: '';
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.disabeld {
|
|
205
|
-
color: rgba(0, 0, 0, 0.25);
|
|
206
|
-
cursor: not-allowed;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.assign-box-container.view-mode {
|
|
211
|
-
& {
|
|
212
|
-
display: flex;
|
|
213
|
-
gap: 16px;
|
|
214
|
-
height: 100%;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.panel.org-panel,
|
|
218
|
-
.panel.app-panel,
|
|
219
|
-
.panel.user-panel {
|
|
220
|
-
flex: 1;
|
|
221
|
-
height: 100%;
|
|
222
|
-
padding: 16px;
|
|
223
|
-
overflow: hidden;
|
|
224
|
-
background-color: #fff;
|
|
225
|
-
border-radius: @border-radius-base * 2;
|
|
226
|
-
|
|
227
|
-
.panel-menu-body {
|
|
228
|
-
& {
|
|
229
|
-
width: 100%;
|
|
230
|
-
height: calc(100% - 36px);
|
|
231
|
-
padding: 16px;
|
|
232
|
-
background: @fill-color-quaternary;
|
|
233
|
-
border-radius: @border-radius-base;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.select-menu-header {
|
|
237
|
-
display: flex;
|
|
238
|
-
align-items: flex-start;
|
|
239
|
-
justify-content: space-between;
|
|
240
|
-
margin-bottom: 16px;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.select-menu-list {
|
|
244
|
-
position: relative;
|
|
245
|
-
height: 100%;
|
|
246
|
-
margin: 0px;
|
|
247
|
-
padding: 0px;
|
|
248
|
-
overflow: auto;
|
|
249
|
-
|
|
250
|
-
> .ant-input-affix-wrapper {
|
|
251
|
-
position: sticky;
|
|
252
|
-
top: 0px;
|
|
253
|
-
z-index: 1;
|
|
254
|
-
background: #f8f9fb;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.select-menu-list-item {
|
|
258
|
-
&:last-child {
|
|
259
|
-
margin-bottom: 0px;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
margin-bottom: 8px;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.org-panel {
|
|
269
|
-
flex: 1;
|
|
270
|
-
|
|
271
|
-
.panel-menu-body {
|
|
272
|
-
padding: 16px;
|
|
273
|
-
background: #f8f9fb;
|
|
274
|
-
border-radius: 8px;
|
|
275
|
-
// overflow: auto;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
.select-menu-list {
|
|
279
|
-
position: relative;
|
|
280
|
-
height: calc(100% - 16px);
|
|
281
|
-
margin: 0px;
|
|
282
|
-
padding: 16px;
|
|
283
|
-
|
|
284
|
-
> .ant-input-affix-wrapper {
|
|
285
|
-
position: sticky;
|
|
286
|
-
top: 0px;
|
|
287
|
-
z-index: 1;
|
|
288
|
-
background: #f8f9fb;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.select-menu-list-item {
|
|
292
|
-
& {
|
|
293
|
-
position: relative;
|
|
294
|
-
display: flex;
|
|
295
|
-
flex-direction: column;
|
|
296
|
-
height: 50px;
|
|
297
|
-
margin-right: 16px;
|
|
298
|
-
margin-bottom: 4px !important;
|
|
299
|
-
padding: 0px;
|
|
300
|
-
border-radius: @border-radius-base;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
&:last-child {
|
|
304
|
-
margin-bottom: 0px;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.org-name {
|
|
308
|
-
display: inline-block;
|
|
309
|
-
height: 22px;
|
|
310
|
-
color: @bg-color-spotilight;
|
|
311
|
-
font-weight: 400;
|
|
312
|
-
font-size: 14px;
|
|
313
|
-
font-family: 'PingFang SC';
|
|
314
|
-
line-height: 22px;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
.path-name {
|
|
318
|
-
display: inline-block;
|
|
319
|
-
height: 22px;
|
|
320
|
-
color: tint(@bg-color-spotilight, 50%);
|
|
321
|
-
font-weight: 400;
|
|
322
|
-
font-size: 12px;
|
|
323
|
-
font-family: 'PingFang SC';
|
|
324
|
-
line-height: 22px;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(r, e) {
|
|
2
|
-
return (
|
|
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) ||
|
|
50
|
-
_nonIterableSpread()
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
function _nonIterableSpread() {
|
|
54
|
-
throw new TypeError(
|
|
55
|
-
'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.',
|
|
56
|
-
);
|
|
57
|
-
}
|
|
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
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function _iterableToArray(r) {
|
|
73
|
-
if (('undefined' != typeof Symbol && null != r[Symbol.iterator]) || null != r['@@iterator'])
|
|
74
|
-
return Array.from(r);
|
|
75
|
-
}
|
|
76
|
-
function _arrayWithoutHoles(r) {
|
|
77
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
78
|
-
}
|
|
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;
|
|
83
|
-
}
|
|
84
|
-
import { debounce } from 'lodash';
|
|
85
|
-
import { useState, useEffect } from 'react';
|
|
86
|
-
|
|
87
|
-
// 遍历机构树 添加 path属性 (上级机构到子机构的路径)
|
|
88
|
-
var _dataFormat = function dataFormat(root, cb) {
|
|
89
|
-
if (!root) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
var path = [].concat(_toConsumableArray(parent), [root.code]);
|
|
93
|
-
root.path = _toConsumableArray(path);
|
|
94
|
-
root.path = _toConsumableArray(path);
|
|
95
|
-
root.show = true;
|
|
96
|
-
cb && cb(root.key, root);
|
|
97
|
-
for (
|
|
98
|
-
var i = 0;
|
|
99
|
-
i <
|
|
100
|
-
((_ref = (root === null || root === void 0 ? void 0 : root.children) || []) === null ||
|
|
101
|
-
_ref === void 0
|
|
102
|
-
? void 0
|
|
103
|
-
: _ref.length);
|
|
104
|
-
i++
|
|
105
|
-
) {
|
|
106
|
-
var _ref;
|
|
107
|
-
_dataFormat(root.children[i], path, cb);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// 遍历寻找 当前规则集所属机构
|
|
112
|
-
export { _dataFormat as dataFormat };
|
|
113
|
-
export var findSameCodePath = function findSameCodePath(root, code) {
|
|
114
|
-
var res = {};
|
|
115
|
-
var _dfs = function dfs(root, code) {
|
|
116
|
-
if (!root) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (root.code === code) res = root;
|
|
120
|
-
for (
|
|
121
|
-
var i = 0;
|
|
122
|
-
i <
|
|
123
|
-
((_ref2 = (root === null || root === void 0 ? void 0 : root.children) || []) === null ||
|
|
124
|
-
_ref2 === void 0
|
|
125
|
-
? void 0
|
|
126
|
-
: _ref2.length);
|
|
127
|
-
i++
|
|
128
|
-
) {
|
|
129
|
-
var _ref2;
|
|
130
|
-
_dfs(root.children[i], code);
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
_dfs(root, code);
|
|
134
|
-
return res.path || [];
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
// 遍历输出 orgCode;
|
|
138
|
-
export var preorder = function preorder(root, cb) {
|
|
139
|
-
var isAddPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
140
|
-
var res = [];
|
|
141
|
-
var _dfs2 = function dfs(root) {
|
|
142
|
-
var res = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
143
|
-
var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
144
|
-
var cb = arguments.length > 3 ? arguments[3] : undefined;
|
|
145
|
-
if (!root) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
var path = [];
|
|
149
|
-
if (isAddPath) {
|
|
150
|
-
path = [].concat(_toConsumableArray(parent), [root.code]);
|
|
151
|
-
root.path = _toConsumableArray(path);
|
|
152
|
-
root.path = _toConsumableArray(path);
|
|
153
|
-
root.show = true;
|
|
154
|
-
}
|
|
155
|
-
res.push(root.code || root.key);
|
|
156
|
-
cb && cb(root.code || root.key, root);
|
|
157
|
-
for (
|
|
158
|
-
var i = 0;
|
|
159
|
-
i <
|
|
160
|
-
(root === null || root === void 0
|
|
161
|
-
? void 0
|
|
162
|
-
: (_root$children = root.children) === null || _root$children === void 0
|
|
163
|
-
? void 0
|
|
164
|
-
: _root$children.length);
|
|
165
|
-
i++
|
|
166
|
-
) {
|
|
167
|
-
var _root$children;
|
|
168
|
-
_dfs2(root.children[i], res, path, cb);
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
_dfs2(root, res, [], cb);
|
|
172
|
-
return res;
|
|
173
|
-
};
|
|
174
|
-
export var mergeAndDeduplicate = function mergeAndDeduplicate(arr1, arr2) {
|
|
175
|
-
// 合并两个数组
|
|
176
|
-
var combined = [].concat(_toConsumableArray(arr1), _toConsumableArray(arr2));
|
|
177
|
-
|
|
178
|
-
// 用 Set 对象来追踪已经遇到过的元素
|
|
179
|
-
var seen = new Set();
|
|
180
|
-
|
|
181
|
-
// 使用 filter 方法去重并保持顺序
|
|
182
|
-
var uniqueCombined = combined.filter(function (item) {
|
|
183
|
-
if (seen.has(item)) {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
seen.add(item);
|
|
187
|
-
return true;
|
|
188
|
-
});
|
|
189
|
-
return uniqueCombined;
|
|
190
|
-
};
|
|
191
|
-
export var doSearch = function doSearch() {
|
|
192
|
-
var fileterKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
193
|
-
var flattenTreeMap = arguments.length > 1 ? arguments[1] : undefined;
|
|
194
|
-
var cb = arguments.length > 2 ? arguments[2] : undefined;
|
|
195
|
-
var treeNodeArr = Object.keys(flattenTreeMap);
|
|
196
|
-
var areadyHandled = [];
|
|
197
|
-
for (var i = 0; i < treeNodeArr.length; i++) {
|
|
198
|
-
var key = treeNodeArr[i];
|
|
199
|
-
var node = flattenTreeMap[key];
|
|
200
|
-
if (!fileterKeys) {
|
|
201
|
-
flattenTreeMap[key].show = true;
|
|
202
|
-
}
|
|
203
|
-
var name = node.name,
|
|
204
|
-
value = node.value,
|
|
205
|
-
path = node.path;
|
|
206
|
-
var filteredStr = name.toLowerCase() + value.toLowerCase();
|
|
207
|
-
if (filteredStr.includes(fileterKeys.toLowerCase())) {
|
|
208
|
-
path
|
|
209
|
-
.filter(function (i) {
|
|
210
|
-
return !areadyHandled.includes(i);
|
|
211
|
-
})
|
|
212
|
-
.map(function (i) {
|
|
213
|
-
areadyHandled.push(i);
|
|
214
|
-
flattenTreeMap[i].show = true;
|
|
215
|
-
});
|
|
216
|
-
} else {
|
|
217
|
-
!areadyHandled.includes(key) && (flattenTreeMap[key].show = false);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
cb && cb();
|
|
221
|
-
};
|
|
222
|
-
export var useWindowHeight = function useWindowHeight(gap) {
|
|
223
|
-
var _useState = useState(window.innerHeight - gap),
|
|
224
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
225
|
-
windowHeight = _useState2[0],
|
|
226
|
-
setWindowHeight = _useState2[1];
|
|
227
|
-
useEffect(
|
|
228
|
-
function () {
|
|
229
|
-
var handleResize = debounce(function () {
|
|
230
|
-
setWindowHeight(window.innerHeight - gap);
|
|
231
|
-
});
|
|
232
|
-
window.addEventListener('resize', handleResize);
|
|
233
|
-
// 清理事件监听器
|
|
234
|
-
return function () {
|
|
235
|
-
window.removeEventListener('resize', handleResize);
|
|
236
|
-
};
|
|
237
|
-
},
|
|
238
|
-
[gap],
|
|
239
|
-
);
|
|
240
|
-
return windowHeight;
|
|
241
|
-
};
|