mobx-view-model-devtools 0.0.42 → 0.0.44
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/auto.global.js +2 -2
- package/index.cjs +2 -2
- package/index.d.ts +50 -2
- package/index.js +442 -88
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { VirtualizerHandle } from 'virtua';
|
|
|
6
6
|
import { Ref } from 'yummies/mobx';
|
|
7
7
|
import { AnyObject, Maybe, Defined } from 'yummies/types';
|
|
8
8
|
import { KeyboardHandler as KeyboardHandler$1, KeyboardHandlerAction } from 'mobx-swiss-knife';
|
|
9
|
-
import { ComponentType, ChangeEventHandler, ChangeEvent, KeyboardEvent } from 'react';
|
|
9
|
+
import { ComponentType, ChangeEventHandler, ChangeEvent, FocusEvent, KeyboardEvent } from 'react';
|
|
10
10
|
|
|
11
11
|
declare class KeyboardHandler extends KeyboardHandler$1<KeyboardHandlerAction> {
|
|
12
12
|
constructor(devtools: ViewModelDevtools);
|
|
@@ -97,13 +97,27 @@ interface SearchEngineConfig {
|
|
|
97
97
|
getRootItems: () => ListItem<any>[];
|
|
98
98
|
getPresentationMode: () => 'tree' | 'list';
|
|
99
99
|
}
|
|
100
|
+
interface SearchSuggestion {
|
|
101
|
+
value: string;
|
|
102
|
+
suffix: string;
|
|
103
|
+
vmName: string;
|
|
104
|
+
ownerKey: string;
|
|
105
|
+
}
|
|
100
106
|
declare class SearchEngine {
|
|
101
107
|
private config;
|
|
102
108
|
searchInputRef: FocusableRef<HTMLInputElement>;
|
|
103
109
|
searchText: string;
|
|
110
|
+
searchTextToSearch: string;
|
|
111
|
+
selectedSuggestionIndex: number;
|
|
112
|
+
isSearchInputFocused: boolean;
|
|
113
|
+
isSuggestionsDismissed: boolean;
|
|
114
|
+
selectedPathOwnerKey: string | null;
|
|
115
|
+
selectedPathSegment: string | null;
|
|
104
116
|
searchCacheKey: string;
|
|
105
117
|
isSearching: boolean;
|
|
118
|
+
private searchTextToSearchTimeout;
|
|
106
119
|
private scrollToSearchMatchTimeout;
|
|
120
|
+
private static readonly searchDebounceMs;
|
|
107
121
|
private static readonly itemHeight;
|
|
108
122
|
get formattedSearchText(): string;
|
|
109
123
|
/**
|
|
@@ -112,15 +126,41 @@ declare class SearchEngine {
|
|
|
112
126
|
*/
|
|
113
127
|
get segments(): string[];
|
|
114
128
|
get endsWithDot(): boolean;
|
|
129
|
+
get isNestedSearch(): boolean;
|
|
115
130
|
get isActive(): boolean;
|
|
131
|
+
get isSearchTextDebouncing(): boolean;
|
|
132
|
+
get shouldShowSuggestions(): boolean;
|
|
133
|
+
get suggestionItems(): SearchSuggestion[];
|
|
134
|
+
private getActiveSearchText;
|
|
135
|
+
private buildSuggestionItemsForText;
|
|
136
|
+
get selectedSuggestion(): SearchSuggestion | null;
|
|
116
137
|
/**
|
|
117
|
-
* Суффикс
|
|
138
|
+
* Суффикс выбранного свойства, которое начинается с последнего сегмента.
|
|
118
139
|
* Отображается как серая подсказка в инпуте.
|
|
119
140
|
* Например: ввод "_pay" → suggestionSuffix = "load" (от "_payload")
|
|
120
141
|
*/
|
|
121
142
|
get suggestionSuffix(): string;
|
|
143
|
+
selectSuggestionAtIndex: (index: number) => void;
|
|
144
|
+
applySuggestion: (suggestion: SearchSuggestion, options?: {
|
|
145
|
+
commitOwner?: boolean;
|
|
146
|
+
dismissSuggestions?: boolean;
|
|
147
|
+
}) => void;
|
|
148
|
+
applySuggestionFromClick: (suggestion: SearchSuggestion, index: number) => void;
|
|
122
149
|
handleSearchInput: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
150
|
+
handleSearchInputFocus: (_e: FocusEvent<HTMLInputElement>) => void;
|
|
151
|
+
handleSearchInputBlur: (_e: FocusEvent<HTMLInputElement>) => void;
|
|
123
152
|
handleKeyDown: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
153
|
+
private commitSuggestionOwner;
|
|
154
|
+
private handlePathOwnerSelectionFromInput;
|
|
155
|
+
/**
|
|
156
|
+
* При вводе точки debounce ещё не применил searchTextToSearch,
|
|
157
|
+
* поэтому owner берём из подсказок предыдущего сегмента.
|
|
158
|
+
* Если пользователь явно не выбирал — берём exact-match `service`, иначе первый в списке.
|
|
159
|
+
*/
|
|
160
|
+
private getFirstPathSegment;
|
|
161
|
+
private resolvePathOwnerSuggestion;
|
|
162
|
+
private clearSearchDebounce;
|
|
163
|
+
private scheduleSearchTextDebounce;
|
|
124
164
|
private scheduleScrollToFirstSearchMatch;
|
|
125
165
|
private scrollToFirstSearchMatch;
|
|
126
166
|
private scrollSimpleBarToOffset;
|
|
@@ -133,12 +173,19 @@ declare class SearchEngine {
|
|
|
133
173
|
* pathSegments — все сегменты кроме последнего (путь навигации).
|
|
134
174
|
*/
|
|
135
175
|
private getCandidatePropsAtDepth;
|
|
176
|
+
private getOwnerMatchedPathCandidates;
|
|
177
|
+
private getPropertyPathCandidates;
|
|
178
|
+
private getDirectPropertyChildren;
|
|
179
|
+
private isOwnerAllowedForFirstPathSegment;
|
|
180
|
+
private isPathOwnerLockedToAnotherOwner;
|
|
136
181
|
/**
|
|
137
182
|
* Уже введённый path-сегмент должен совпадать строго:
|
|
138
183
|
* `product.` заходит только в `product`, а не в `productAsyncTasks`
|
|
139
184
|
* или `serviceAndProductSearch`.
|
|
140
185
|
*/
|
|
141
186
|
private getPathMatchingProps;
|
|
187
|
+
private getOwnerVMName;
|
|
188
|
+
private getOwnerKey;
|
|
142
189
|
/**
|
|
143
190
|
* Навигация вглубь по цепочке свойств.
|
|
144
191
|
* Возвращает свойства на нужной глубине.
|
|
@@ -151,6 +198,7 @@ declare class SearchEngine {
|
|
|
151
198
|
private getFlatListItems;
|
|
152
199
|
getListItems(rootItems: ListItem<any>[]): ListItem<any>[];
|
|
153
200
|
private getFilteredItemsForSearch;
|
|
201
|
+
private getExtraSearchItems;
|
|
154
202
|
private getVMSearchItems;
|
|
155
203
|
/**
|
|
156
204
|
* Рекурсивно строит плоский список PropertyListItem для отображения.
|