-
Notifications
You must be signed in to change notification settings - Fork 121
/
search.tsx
74 lines (70 loc) · 2.38 KB
/
search.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { ITreeNodeItemProps } from 'mo/components';
import { IActionBarItemProps } from 'mo/components/actionBar';
import { InfoTypeEnum } from 'mo/components/search/input';
export enum SearchEvent {
onChange = 'search.onChange',
onSearch = 'search.onSearch',
onReplaceAll = 'search.onReplaceAll',
onResultClick = 'search.onResultClick',
}
export interface ISearchProps {
headerToolBar?: IActionBarItemProps[];
searchAddons?: IActionBarItemProps[];
replaceAddons?: IActionBarItemProps[];
result: ITreeNodeItemProps[];
value?: string;
replaceValue?: string;
replaceMode?: boolean;
validationInfo?: { type: InfoTypeEnum; text: string };
isRegex?: boolean;
isCaseSensitive?: boolean;
isWholeWords?: boolean;
preserveCase?: boolean;
}
export class SearchModel implements ISearchProps {
public headerToolBar: IActionBarItemProps[];
public searchAddons: IActionBarItemProps[];
public replaceAddons: IActionBarItemProps[];
public result: ITreeNodeItemProps[] = [];
public value: string = '';
public replaceValue: string = '';
public replaceMode: boolean = false;
public isRegex: boolean = false;
public isCaseSensitive: boolean = false;
public isWholeWords: boolean = false;
public preserveCase: boolean = false;
public validationInfo: { type: InfoTypeEnum; text: string } = {
type: 'info',
text: '',
};
constructor(
headerToolBar: IActionBarItemProps[] = [],
searchAddons: IActionBarItemProps[] = [],
replaceAddons: IActionBarItemProps[] = [],
result = [],
value = '',
replaceValue = '',
replaceMode = false,
isCaseSensitive = false,
isWholeWords = false,
isRegex = false,
preserveCase = false,
validationInfo: { type: InfoTypeEnum; text: string } = {
type: 'info',
text: '',
}
) {
this.headerToolBar = headerToolBar;
this.searchAddons = searchAddons;
this.replaceAddons = replaceAddons;
this.value = value;
this.replaceValue = replaceValue;
this.replaceMode = replaceMode;
this.isCaseSensitive = isCaseSensitive;
this.isWholeWords = isWholeWords;
this.isRegex = isRegex;
this.preserveCase = preserveCase;
this.result = result;
this.validationInfo = validationInfo;
}
}