@opensumi/ide-search 2.21.13 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/index.d.ts +1 -2
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +14 -1
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/replace.d.ts +3 -2
- package/lib/browser/replace.d.ts.map +1 -1
- package/lib/browser/replace.js +34 -15
- package/lib/browser/replace.js.map +1 -1
- package/lib/browser/search-contextkey.d.ts +6 -8
- package/lib/browser/search-contextkey.d.ts.map +1 -1
- package/lib/browser/search-contextkey.js +11 -13
- package/lib/browser/search-contextkey.js.map +1 -1
- package/lib/browser/search-preferences.d.ts +1 -1
- package/lib/browser/search-preferences.d.ts.map +1 -1
- package/lib/browser/search-preferences.js +5 -5
- package/lib/browser/search-preferences.js.map +1 -1
- package/lib/browser/search.contribution.d.ts +9 -11
- package/lib/browser/search.contribution.d.ts.map +1 -1
- package/lib/browser/search.contribution.js +126 -80
- package/lib/browser/search.contribution.js.map +1 -1
- package/lib/browser/search.input.widget.d.ts +3 -5
- package/lib/browser/search.input.widget.d.ts.map +1 -1
- package/lib/browser/search.input.widget.js +12 -13
- package/lib/browser/search.input.widget.js.map +1 -1
- package/lib/browser/search.module.less +23 -49
- package/lib/browser/search.replace.widget.d.ts +4 -8
- package/lib/browser/search.replace.widget.d.ts.map +1 -1
- package/lib/browser/search.replace.widget.js +5 -5
- package/lib/browser/search.replace.widget.js.map +1 -1
- package/lib/browser/search.rules.widget.d.ts.map +1 -1
- package/lib/browser/search.rules.widget.js +6 -6
- package/lib/browser/search.rules.widget.js.map +1 -1
- package/lib/browser/search.service.d.ts +43 -36
- package/lib/browser/search.service.d.ts.map +1 -1
- package/lib/browser/search.service.js +127 -187
- package/lib/browser/search.service.js.map +1 -1
- package/lib/browser/search.view.d.ts +14 -3
- package/lib/browser/search.view.d.ts.map +1 -1
- package/lib/browser/search.view.js +132 -50
- package/lib/browser/search.view.js.map +1 -1
- package/lib/browser/tree/search-node.d.ts +22 -0
- package/lib/browser/tree/search-node.d.ts.map +1 -0
- package/lib/browser/tree/search-node.js +155 -0
- package/lib/browser/tree/search-node.js.map +1 -0
- package/lib/browser/tree/search-tree.service.d.ts +56 -0
- package/lib/browser/tree/search-tree.service.d.ts.map +1 -0
- package/lib/browser/tree/search-tree.service.js +277 -0
- package/lib/browser/tree/search-tree.service.js.map +1 -0
- package/lib/browser/tree/search-tree.view.d.ts +21 -0
- package/lib/browser/tree/search-tree.view.d.ts.map +1 -0
- package/lib/browser/tree/search-tree.view.js +89 -0
- package/lib/browser/tree/search-tree.view.js.map +1 -0
- package/lib/browser/tree/tree-model.service.d.ts +59 -0
- package/lib/browser/tree/tree-model.service.d.ts.map +1 -0
- package/lib/browser/tree/tree-model.service.js +292 -0
- package/lib/browser/tree/tree-model.service.js.map +1 -0
- package/lib/browser/tree/tree-node.defined.d.ts +32 -0
- package/lib/browser/tree/tree-node.defined.d.ts.map +1 -0
- package/lib/browser/tree/tree-node.defined.js +55 -0
- package/lib/browser/tree/tree-node.defined.js.map +1 -0
- package/lib/browser/tree/tree-node.module.less +175 -0
- package/lib/common/content-search.d.ts +34 -16
- package/lib/common/content-search.d.ts.map +1 -1
- package/lib/common/content-search.js +2 -6
- package/lib/common/content-search.js.map +1 -1
- package/lib/node/content-search.service.d.ts +3 -5
- package/lib/node/content-search.service.d.ts.map +1 -1
- package/lib/node/content-search.service.js +3 -4
- package/lib/node/content-search.service.js.map +1 -1
- package/lib/node/index.js.map +1 -1
- package/package.json +21 -20
- package/src/browser/index.ts +42 -0
- package/src/browser/replace.ts +119 -0
- package/src/browser/search-contextkey.ts +30 -0
- package/src/browser/search-history.ts +113 -0
- package/src/browser/search-preferences.ts +78 -0
- package/src/browser/search-result-collection.ts +75 -0
- package/src/browser/search.contribution.ts +347 -0
- package/src/browser/search.input.widget.tsx +129 -0
- package/src/browser/search.module.less +352 -0
- package/src/browser/search.replace.widget.tsx +38 -0
- package/src/browser/search.rules.widget.tsx +204 -0
- package/src/browser/search.service.ts +881 -0
- package/src/browser/search.view.tsx +282 -0
- package/src/browser/tree/search-node.tsx +274 -0
- package/src/browser/tree/search-tree.service.ts +323 -0
- package/src/browser/tree/search-tree.view.tsx +179 -0
- package/src/browser/tree/tree-model.service.ts +338 -0
- package/src/browser/tree/tree-node.defined.ts +73 -0
- package/src/browser/tree/tree-node.module.less +175 -0
- package/src/common/content-search.ts +312 -0
- package/src/common/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/node/content-search.service.ts +297 -0
- package/src/node/index.ts +23 -0
- package/lib/browser/search-tree.service.d.ts +0 -76
- package/lib/browser/search-tree.service.d.ts.map +0 -1
- package/lib/browser/search-tree.service.js +0 -587
- package/lib/browser/search-tree.service.js.map +0 -1
- package/lib/browser/search-tree.view.d.ts +0 -22
- package/lib/browser/search-tree.view.d.ts.map +0 -1
- package/lib/browser/search-tree.view.js +0 -102
- package/lib/browser/search-tree.view.js.map +0 -1
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
.search_container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
position: absolute;
|
|
6
|
+
font-size: 12px;
|
|
7
|
+
user-select: none;
|
|
8
|
+
|
|
9
|
+
.search_options {
|
|
10
|
+
padding: 0 8px;
|
|
11
|
+
display: block;
|
|
12
|
+
|
|
13
|
+
input {
|
|
14
|
+
font-size: 12px; // 搜索这里字号会小一号 12px
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.replace {
|
|
19
|
+
padding: 0 5px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.header {
|
|
23
|
+
padding: 10px 5px;
|
|
24
|
+
> span {
|
|
25
|
+
display: inline-block;
|
|
26
|
+
margin-left: 10px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.menu {
|
|
30
|
+
float: right;
|
|
31
|
+
margin-left: 5px;
|
|
32
|
+
opacity: 0.5;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.menu_active {
|
|
36
|
+
opacity: 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.result_describe,
|
|
41
|
+
.result_error {
|
|
42
|
+
padding: 10px;
|
|
43
|
+
padding-top: 15px;
|
|
44
|
+
margin: 0;
|
|
45
|
+
display: flex;
|
|
46
|
+
.text {
|
|
47
|
+
display: inline;
|
|
48
|
+
flex: 1;
|
|
49
|
+
line-height: 16px;
|
|
50
|
+
}
|
|
51
|
+
.result_fresh,
|
|
52
|
+
.result_fold {
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
&:hover {
|
|
55
|
+
transform: scale(1.1);
|
|
56
|
+
}
|
|
57
|
+
&.disabled {
|
|
58
|
+
opacity: 0.5;
|
|
59
|
+
cursor: not-allowed;
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
.result_fresh {
|
|
64
|
+
margin: 0 5px;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.result_error {
|
|
69
|
+
color: var(--errorForeground);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
input[type='text'] {
|
|
73
|
+
width: 100%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.search_and_replace_container {
|
|
77
|
+
display: flex;
|
|
78
|
+
|
|
79
|
+
.replace-toggle {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
width: 15px;
|
|
83
|
+
min-width: 15px;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
margin-right: 2px;
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
|
|
88
|
+
&:hover {
|
|
89
|
+
background: var(--input-background);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.replace_all {
|
|
94
|
+
color: var(--textLink-foreground);
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.search_and_replace_fields {
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
flex: 1;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.search_input_title {
|
|
105
|
+
line-height: 20px;
|
|
106
|
+
margin-top: 8px;
|
|
107
|
+
margin-bottom: 8px;
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
justify-content: space-between;
|
|
111
|
+
.search_title {
|
|
112
|
+
margin-right: 5px;
|
|
113
|
+
text-transform: uppercase;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.search_field {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
border: var(--input-border);
|
|
121
|
+
margin-bottom: 4px;
|
|
122
|
+
|
|
123
|
+
&:hover {
|
|
124
|
+
border-color: var(--inputOption-activeBorder);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.option_buttons {
|
|
128
|
+
height: 23px;
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
background: var(--input-background);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.replace_field {
|
|
136
|
+
display: flex;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.search_details {
|
|
141
|
+
.glob_field {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
white-space: nowrap;
|
|
145
|
+
|
|
146
|
+
.label {
|
|
147
|
+
line-height: 20px;
|
|
148
|
+
margin: 8px 0 4px 0;
|
|
149
|
+
user-select: none;
|
|
150
|
+
font-size: 11px;
|
|
151
|
+
display: flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
justify-content: space-between;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.use_default_excludes_wrapper {
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.search_excludes_description {
|
|
164
|
+
line-height: 1;
|
|
165
|
+
margin-left: 5px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@option-size: 20px;
|
|
169
|
+
|
|
170
|
+
.search_option {
|
|
171
|
+
width: @option-size;
|
|
172
|
+
height: @option-size;
|
|
173
|
+
margin: 0 1px;
|
|
174
|
+
box-sizing: border-box;
|
|
175
|
+
display: flex;
|
|
176
|
+
justify-content: center;
|
|
177
|
+
user-select: none;
|
|
178
|
+
background-repeat: no-repeat;
|
|
179
|
+
background-position: center;
|
|
180
|
+
border: 1px solid transparent;
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
opacity: 0.7;
|
|
183
|
+
|
|
184
|
+
&:hover {
|
|
185
|
+
opacity: 1;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&::before {
|
|
189
|
+
display: inline-block;
|
|
190
|
+
height: @option-size - 2;
|
|
191
|
+
line-height: @option-size - 2;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&.select {
|
|
195
|
+
background-color: var(--inputOption-activeBackground);
|
|
196
|
+
border-color: var(--inputOption-activeBorder);
|
|
197
|
+
opacity: 1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.replace_all_button {
|
|
202
|
+
margin-left: 4px;
|
|
203
|
+
padding: 0 5px;
|
|
204
|
+
text-align: center;
|
|
205
|
+
line-height: 26px;
|
|
206
|
+
color: var(--textLink-foreground);
|
|
207
|
+
border: 1px solid transparent;
|
|
208
|
+
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
209
|
+
flex-shrink: 0;
|
|
210
|
+
cursor: pointer;
|
|
211
|
+
&.disabled {
|
|
212
|
+
color: inherit;
|
|
213
|
+
opacity: 0.7;
|
|
214
|
+
pointer-events: none;
|
|
215
|
+
}
|
|
216
|
+
&:hover {
|
|
217
|
+
border-radius: 2px;
|
|
218
|
+
border-color: currentColor;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.line_text {
|
|
224
|
+
white-space: nowrap;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.tree {
|
|
228
|
+
overflow: hidden;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.tree_child {
|
|
232
|
+
.icon {
|
|
233
|
+
font-size: 25px;
|
|
234
|
+
margin-left: 0px;
|
|
235
|
+
margin-right: 10px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.text {
|
|
239
|
+
white-space: nowrap;
|
|
240
|
+
text-overflow: ellipsis;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.title {
|
|
244
|
+
display: flex;
|
|
245
|
+
align-items: center;
|
|
246
|
+
height: 22px;
|
|
247
|
+
|
|
248
|
+
&:hover {
|
|
249
|
+
color: var(--list-hoverForeground);
|
|
250
|
+
background: var(--list-hoverBackground);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.result {
|
|
255
|
+
padding: 0;
|
|
256
|
+
margin: 0;
|
|
257
|
+
list-style-type: none;
|
|
258
|
+
|
|
259
|
+
li {
|
|
260
|
+
padding-left: 30px;
|
|
261
|
+
text-overflow: ellipsis;
|
|
262
|
+
width: 100%;
|
|
263
|
+
overflow: hidden;
|
|
264
|
+
|
|
265
|
+
&:hover {
|
|
266
|
+
color: var(--list-hoverForeground);
|
|
267
|
+
background: var(--list-hoverBackground);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
&.kt_mod_selected {
|
|
273
|
+
color: var(--list-activeSelectionForeground);
|
|
274
|
+
background: var(--list-activeSelectionBackground);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
&.kt_mod_focused {
|
|
278
|
+
color: var(--list-focusForeground);
|
|
279
|
+
background: var(--list-focusBackground);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
&.kt_mod_invalid {
|
|
283
|
+
color: var(--list-invalidItemForeground);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.include_rule_content {
|
|
288
|
+
font-size: 11px;
|
|
289
|
+
|
|
290
|
+
> p {
|
|
291
|
+
margin-tio: 2px;
|
|
292
|
+
margin-bottom: 0;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
> ul {
|
|
296
|
+
margin: 0;
|
|
297
|
+
padding: 0;
|
|
298
|
+
|
|
299
|
+
> li {
|
|
300
|
+
color: var(--descriptionForeground);
|
|
301
|
+
list-style-type: none;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.exclude_rule_content {
|
|
307
|
+
font-size: 11px;
|
|
308
|
+
|
|
309
|
+
> p {
|
|
310
|
+
margin-bottom: 5px;
|
|
311
|
+
> span {
|
|
312
|
+
float: right;
|
|
313
|
+
color: var(--textLink-foreground);
|
|
314
|
+
cursor: pointer;
|
|
315
|
+
|
|
316
|
+
&::hover {
|
|
317
|
+
color: var(--textLink-activeForeground);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
> div {
|
|
323
|
+
max-width: 200px;
|
|
324
|
+
color: var(--descriptionForeground);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.limit {
|
|
329
|
+
overflow: hidden;
|
|
330
|
+
text-overflow: ellipsis;
|
|
331
|
+
white-space: nowrap;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.loading-wrap {
|
|
335
|
+
position: relative;
|
|
336
|
+
width: calc(100% - 16px);
|
|
337
|
+
margin-left: 8px;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.search_result_code {
|
|
341
|
+
color: var(--foreground);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.search_result_label {
|
|
345
|
+
margin-right: 0;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.checkbox :global(.kt-checkbox-icon) {
|
|
349
|
+
width: 14px;
|
|
350
|
+
height: 14px;
|
|
351
|
+
border-color: var(--input-placeholderForeground);
|
|
352
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import cls from 'classnames';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { Input } from '@opensumi/ide-components';
|
|
5
|
+
import { localize } from '@opensumi/ide-core-common/lib/localize';
|
|
6
|
+
|
|
7
|
+
import styles from './search.module.less';
|
|
8
|
+
|
|
9
|
+
interface SearchReplaceWidgetProps {
|
|
10
|
+
replaceValue: string;
|
|
11
|
+
onSearch(): void;
|
|
12
|
+
onReplaceRuleChange(e: React.FormEvent<HTMLInputElement>): void;
|
|
13
|
+
replaceAll(): void;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const SearchReplaceWidget = React.memo(
|
|
18
|
+
({ replaceValue, disabled = true, onSearch, onReplaceRuleChange, replaceAll }: SearchReplaceWidgetProps) => (
|
|
19
|
+
<div className={styles.search_and_replace_container}>
|
|
20
|
+
<div className={styles.search_and_replace_fields}>
|
|
21
|
+
<div className={styles.replace_field}>
|
|
22
|
+
<Input
|
|
23
|
+
value={replaceValue}
|
|
24
|
+
id='replace-input-field'
|
|
25
|
+
title={localize('search.replace.label')}
|
|
26
|
+
type='text'
|
|
27
|
+
placeholder={localize('search.replace.title')}
|
|
28
|
+
onKeyUp={onSearch}
|
|
29
|
+
onChange={onReplaceRuleChange}
|
|
30
|
+
/>
|
|
31
|
+
<div className={cls(styles.replace_all_button, disabled && styles.disabled)} onClick={replaceAll}>
|
|
32
|
+
<span>{localize('search.replaceAll.label')}</span>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
),
|
|
38
|
+
);
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import cls from 'classnames';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { Input, CheckBox, Popover, PopoverTriggerType, PopoverPosition } from '@opensumi/ide-components';
|
|
5
|
+
import { ConfigContext } from '@opensumi/ide-core-browser/lib/react-providers/config-provider';
|
|
6
|
+
import { getExternalIcon, getIcon } from '@opensumi/ide-core-browser/lib/style/icon/icon';
|
|
7
|
+
import { localize } from '@opensumi/ide-core-common/lib/localize';
|
|
8
|
+
|
|
9
|
+
import { IContentSearchClientService } from '../common/content-search';
|
|
10
|
+
|
|
11
|
+
import styles from './search.module.less';
|
|
12
|
+
import { ContentSearchClientService } from './search.service';
|
|
13
|
+
|
|
14
|
+
const IncludeRuleContent = () => (
|
|
15
|
+
<div className={cls(styles.include_rule_content)}>
|
|
16
|
+
<ul>
|
|
17
|
+
<li>, : {localize('search.help.concatRule')}</li>
|
|
18
|
+
<li>* : {localize('search.help.matchOneOrMoreRule')}</li>
|
|
19
|
+
<li>? : {localize('search.help.matchOne')}</li>
|
|
20
|
+
<li>** : {localize('search.help.matchAny')}</li>
|
|
21
|
+
<li>
|
|
22
|
+
{} : {localize('search.help.matchWithGroup')}
|
|
23
|
+
</li>
|
|
24
|
+
<li>[] : {localize('search.help.matchRange')}</li>
|
|
25
|
+
</ul>
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const ExcludeRuleContent = React.memo(() => {
|
|
30
|
+
const configContext = React.useContext(ConfigContext);
|
|
31
|
+
const { injector } = configContext;
|
|
32
|
+
const searchBrowserService = injector.get(IContentSearchClientService);
|
|
33
|
+
const excludeList = React.useMemo(() => searchBrowserService.getPreferenceSearchExcludes(), [searchBrowserService]);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div className={cls(styles.exclude_rule_content)}>
|
|
37
|
+
<div>
|
|
38
|
+
{excludeList.map((exclude, index) => {
|
|
39
|
+
if (index === excludeList.length - 1) {
|
|
40
|
+
return exclude;
|
|
41
|
+
}
|
|
42
|
+
return `${exclude}, `;
|
|
43
|
+
})}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
interface SearchRulesWidgetProps {
|
|
50
|
+
includeValue: string;
|
|
51
|
+
excludeValue: string;
|
|
52
|
+
onChangeInclude(e: React.FormEvent<HTMLInputElement>): void;
|
|
53
|
+
onChangeExclude(e: React.FormEvent<HTMLInputElement>): void;
|
|
54
|
+
isOnlyOpenEditors: boolean;
|
|
55
|
+
onOnlyOpenEditorsToggle(): void;
|
|
56
|
+
isIncludeIgnored: boolean;
|
|
57
|
+
onIncludeIgnoredToggle(): void;
|
|
58
|
+
onSearch(): void;
|
|
59
|
+
onOpenPreference(): void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const IncludeInput = React.memo(
|
|
63
|
+
({
|
|
64
|
+
includeValue,
|
|
65
|
+
isOnlyOpenEditors,
|
|
66
|
+
onSearch,
|
|
67
|
+
onChangeInclude,
|
|
68
|
+
onOnlyOpenEditorsToggle,
|
|
69
|
+
}: Pick<
|
|
70
|
+
SearchRulesWidgetProps,
|
|
71
|
+
'includeValue' | 'onSearch' | 'onChangeInclude' | 'isOnlyOpenEditors' | 'onOnlyOpenEditorsToggle'
|
|
72
|
+
>) => (
|
|
73
|
+
<div className={cls(styles.glob_field)}>
|
|
74
|
+
<div className={cls(styles.label)}>
|
|
75
|
+
<span className={styles.limit}>{localize('search.includes')}</span>
|
|
76
|
+
<span className={cls(styles.include_rule)}>
|
|
77
|
+
<Popover
|
|
78
|
+
id={'show_include_rule'}
|
|
79
|
+
title={localize('search.help.supportRule')}
|
|
80
|
+
content={<IncludeRuleContent />}
|
|
81
|
+
trigger={PopoverTriggerType.hover}
|
|
82
|
+
delay={500}
|
|
83
|
+
position={PopoverPosition.right}
|
|
84
|
+
>
|
|
85
|
+
<a>{localize('search.help.showIncludeRule')}</a>
|
|
86
|
+
</Popover>
|
|
87
|
+
</span>
|
|
88
|
+
</div>
|
|
89
|
+
<Input
|
|
90
|
+
value={includeValue}
|
|
91
|
+
type='text'
|
|
92
|
+
placeholder={localize('search.includes.description')}
|
|
93
|
+
onKeyUp={onSearch}
|
|
94
|
+
onChange={onChangeInclude}
|
|
95
|
+
id='include-input-field'
|
|
96
|
+
addonAfter={[
|
|
97
|
+
<span
|
|
98
|
+
key='onlyOpenEditors'
|
|
99
|
+
className={cls(getExternalIcon('book'), styles.search_option, { [styles.select]: isOnlyOpenEditors })}
|
|
100
|
+
title={localize('search.onlyOpenEditors')}
|
|
101
|
+
onClick={onOnlyOpenEditorsToggle}
|
|
102
|
+
/>,
|
|
103
|
+
]}
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
),
|
|
107
|
+
(prevProps, nextProps) =>
|
|
108
|
+
prevProps.includeValue === nextProps.includeValue && prevProps.isOnlyOpenEditors === nextProps.isOnlyOpenEditors,
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const ExcludeInput = React.memo(
|
|
112
|
+
({
|
|
113
|
+
isIncludeIgnored,
|
|
114
|
+
excludeValue,
|
|
115
|
+
onIncludeIgnoredToggle,
|
|
116
|
+
onChangeExclude,
|
|
117
|
+
onOpenPreference,
|
|
118
|
+
onSearch,
|
|
119
|
+
}: Pick<
|
|
120
|
+
SearchRulesWidgetProps,
|
|
121
|
+
'isIncludeIgnored' | 'onIncludeIgnoredToggle' | 'onOpenPreference' | 'excludeValue' | 'onSearch' | 'onChangeExclude'
|
|
122
|
+
>) => (
|
|
123
|
+
<div className={cls(styles.glob_field, styles.search_excludes)}>
|
|
124
|
+
<div className={styles.label}>
|
|
125
|
+
<span className={styles.limit}>{localize('search.excludes')}</span>
|
|
126
|
+
<div className={styles.use_default_excludes_wrapper}>
|
|
127
|
+
<CheckBox
|
|
128
|
+
className={cls(styles.checkbox)}
|
|
129
|
+
label={localize('search.excludes.default.enable')}
|
|
130
|
+
checked={!isIncludeIgnored}
|
|
131
|
+
id='search-input-isIncludeIgnored'
|
|
132
|
+
onChange={onIncludeIgnoredToggle}
|
|
133
|
+
/>
|
|
134
|
+
<Popover
|
|
135
|
+
title={localize('search.help.excludeList')}
|
|
136
|
+
insertClass={cls(styles.search_excludes_description)}
|
|
137
|
+
id={'search_excludes'}
|
|
138
|
+
action={localize('search.help.modify')}
|
|
139
|
+
onClickAction={onOpenPreference}
|
|
140
|
+
content={<ExcludeRuleContent />}
|
|
141
|
+
trigger={PopoverTriggerType.hover}
|
|
142
|
+
delay={500}
|
|
143
|
+
position={PopoverPosition.right}
|
|
144
|
+
>
|
|
145
|
+
<span className={cls(getIcon('question-circle'))} style={{ opacity: '0.7', cursor: 'pointer' }} />
|
|
146
|
+
</Popover>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
<Input
|
|
150
|
+
type='text'
|
|
151
|
+
value={excludeValue}
|
|
152
|
+
placeholder={localize('search.includes.description')}
|
|
153
|
+
onKeyUp={onSearch}
|
|
154
|
+
onChange={onChangeExclude}
|
|
155
|
+
id='exclude-input-field'
|
|
156
|
+
/>
|
|
157
|
+
</div>
|
|
158
|
+
),
|
|
159
|
+
(prevProps, nextProps) =>
|
|
160
|
+
prevProps.excludeValue === nextProps.excludeValue && prevProps.isIncludeIgnored === nextProps.isIncludeIgnored,
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
function isSearchRulesPropsEqual(prevProps: SearchRulesWidgetProps, nextProps: SearchRulesWidgetProps) {
|
|
164
|
+
return (
|
|
165
|
+
prevProps.includeValue === nextProps.includeValue &&
|
|
166
|
+
prevProps.excludeValue === nextProps.excludeValue &&
|
|
167
|
+
prevProps.isOnlyOpenEditors === nextProps.isOnlyOpenEditors &&
|
|
168
|
+
prevProps.isIncludeIgnored === nextProps.isIncludeIgnored
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export const SearchRulesWidget = React.memo(
|
|
173
|
+
({
|
|
174
|
+
includeValue,
|
|
175
|
+
excludeValue,
|
|
176
|
+
onChangeExclude,
|
|
177
|
+
onChangeInclude,
|
|
178
|
+
isOnlyOpenEditors,
|
|
179
|
+
onOnlyOpenEditorsToggle,
|
|
180
|
+
isIncludeIgnored,
|
|
181
|
+
onIncludeIgnoredToggle,
|
|
182
|
+
onSearch,
|
|
183
|
+
onOpenPreference,
|
|
184
|
+
}: SearchRulesWidgetProps) => (
|
|
185
|
+
<div className='glob_field-container'>
|
|
186
|
+
<IncludeInput
|
|
187
|
+
includeValue={includeValue}
|
|
188
|
+
onSearch={onSearch}
|
|
189
|
+
onChangeInclude={onChangeInclude}
|
|
190
|
+
isOnlyOpenEditors={isOnlyOpenEditors}
|
|
191
|
+
onOnlyOpenEditorsToggle={onOnlyOpenEditorsToggle}
|
|
192
|
+
/>
|
|
193
|
+
<ExcludeInput
|
|
194
|
+
isIncludeIgnored={isIncludeIgnored}
|
|
195
|
+
excludeValue={excludeValue}
|
|
196
|
+
onIncludeIgnoredToggle={onIncludeIgnoredToggle}
|
|
197
|
+
onChangeExclude={onChangeExclude}
|
|
198
|
+
onOpenPreference={onOpenPreference}
|
|
199
|
+
onSearch={onSearch}
|
|
200
|
+
/>
|
|
201
|
+
</div>
|
|
202
|
+
),
|
|
203
|
+
isSearchRulesPropsEqual,
|
|
204
|
+
);
|