1
1
import 'reflect-metadata' ;
2
2
import { Controller } from 'mo/react/controller' ;
3
3
import { container , singleton } from 'tsyringe' ;
4
- import { IActivityBarItem } from 'mo' ;
4
+ import { connect , IActivityBarItem } from 'mo' ;
5
5
import * as React from 'react' ;
6
- import { SearchPanelView } from 'mo/workbench/sidebar/search' ;
6
+ import { SearchPanel } from 'mo/workbench/sidebar/search' ;
7
7
import { IActionBarItem } from 'mo/components/actionBar' ;
8
8
import {
9
9
SEARCH_CASE_SENSITIVE_COMMAND_ID ,
@@ -17,6 +17,8 @@ import {
17
17
ActivityBarService ,
18
18
IActivityBarService ,
19
19
ISearchService ,
20
+ FolderTreeService ,
21
+ IFolderTreeService ,
20
22
ISidebarService ,
21
23
SearchService ,
22
24
SidebarService ,
@@ -38,24 +40,43 @@ export class SearchController extends Controller implements ISearchController {
38
40
private readonly activityBarService : IActivityBarService ;
39
41
private readonly sidebarService : ISidebarService ;
40
42
private readonly searchService : ISearchService ;
41
- private readonly searchController : ISearchController ;
43
+ private readonly folderTreeService : IFolderTreeService ;
42
44
43
45
constructor ( ) {
44
46
super ( ) ;
45
47
this . activityBarService = container . resolve ( ActivityBarService ) ;
46
48
this . sidebarService = container . resolve ( SidebarService ) ;
47
49
this . searchService = container . resolve ( SearchService ) ;
48
- this . searchController = container . resolve ( SearchController ) ;
50
+ this . folderTreeService = container . resolve ( FolderTreeService ) ;
49
51
this . initView ( ) ;
50
52
}
51
53
52
- private initView = ( ) => {
53
- const ctx = this ;
54
+ private initView ( ) {
55
+ const SearchPanelView = connect (
56
+ {
57
+ search : this . searchService ,
58
+ folderTree : this . folderTreeService ,
59
+ } ,
60
+ SearchPanel
61
+ ) ;
62
+
63
+ const searchEvent = {
64
+ setSearchValue : this . setSearchValue ,
65
+ setReplaceValue : this . setReplaceValue ,
66
+ onToggleAddon : this . onToggleAddon ,
67
+ onToggleCaseSensitive : this . onToggleCaseSensitive ,
68
+ onToggleWholeWord : this . onToggleWholeWord ,
69
+ onToggleRegex : this . onToggleRegex ,
70
+ onTogglePreserveCase : this . onTogglePreserveCase ,
71
+ onToggleRepalceAll : this . onToggleRepalceAll ,
72
+ convertFoldToSearchTree : this . convertFoldToSearchTree ,
73
+ } ;
74
+
54
75
const searchSidePane = {
55
76
id : 'searchPane' ,
56
77
title : 'SEARCH' ,
57
78
render ( ) {
58
- return < SearchPanelView { ...ctx . searchController } /> ;
79
+ return < SearchPanelView { ...searchEvent } /> ;
59
80
} ,
60
81
} ;
61
82
@@ -70,7 +91,7 @@ export class SearchController extends Controller implements ISearchController {
70
91
} ) ;
71
92
}
72
93
} ) ;
73
- } ;
94
+ }
74
95
75
96
public readonly setSearchValue = ( value ?: string ) => {
76
97
this . searchService . setSearchValue ?.( value ) ;
0 commit comments