@difizen/libro-search 0.1.20 → 0.1.21
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.
|
@@ -38,7 +38,7 @@ export declare class LibroSearchView extends BaseView {
|
|
|
38
38
|
onCellsChanged: () => void;
|
|
39
39
|
onViewWillUnmount: () => Promise<void>;
|
|
40
40
|
show: () => void;
|
|
41
|
-
hide: () => void;
|
|
41
|
+
hide: (focus?: boolean) => void;
|
|
42
42
|
onFocus: () => void;
|
|
43
43
|
onBlur: (e: React.FocusEvent<HTMLDivElement>) => void;
|
|
44
44
|
search: (hightlightNext?: boolean) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-search-view.d.ts","sourceRoot":"","sources":["../src/libro-search-view.tsx"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAsB,MAAM,mBAAmB,CAAC;AAIjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAM3D,eAAO,MAAM,aAAa,+CAYzB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAgB/B,CAAC;AAEF,eAAO,MAAM,eAAe,0CAAoB,CAAC;AAEjD,eAAO,MAAM,aAAa,+
|
|
1
|
+
{"version":3,"file":"libro-search-view.d.ts","sourceRoot":"","sources":["../src/libro-search-view.tsx"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE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pB;IACD,IAAI,YAAY,uBAEf;IAEQ,WAAW,aAuBlB;IAEF,mBAAmB,aAIjB;IAEF,cAAc,aAIZ;IAEF,iBAAiB,sBAGf;IAEF,IAAI,aAKF;IACF,IAAI,4BAUF;IAEF,OAAO,aAEL;IAEF,MAAM,MAAO,gBAAgB,CAAC,cAAc,CAAC,UAI3C;IAEF,MAAM,8CAgBJ;IACF,aAAa,aAKX;IAEF,aAAa,aAGX;IAEF,mBAAmB,aAGjB;IAEF,cAAc,aAGZ;IAEF,IAAI,aAEF;IAEF,QAAQ,aAEN;IAEF,sBAAsB,MAAO,mBAAmB,UAI9C;IAEF,OAAO,aAEL;IACF,UAAU,aAER;IACF,YAAY,aAMV;IACF,eAAe,eAUb;IAEF,SAAS,YAAmB,OAAO,mBAMjC;IAEF,aAAa,MAAO,aAAa,UAqB/B;IAEF,gBAAgB,MAAO,MAAM,WAAW,CAAC,gBAAgB,CAAC,UAKxD;IAEF,mBAAmB,MAAO,MAAM,WAAW,CAAC,gBAAgB,CAAC,UAE3D;CACH"}
|
package/es/libro-search-view.js
CHANGED
|
@@ -142,7 +142,9 @@ export var SearchContent = function SearchContent() {
|
|
|
142
142
|
icon: /*#__PURE__*/_jsx(EllipsisOutlined, {}),
|
|
143
143
|
size: "small"
|
|
144
144
|
}), /*#__PURE__*/_jsx(Button, {
|
|
145
|
-
onClick:
|
|
145
|
+
onClick: function onClick() {
|
|
146
|
+
return instance.hide();
|
|
147
|
+
},
|
|
146
148
|
icon: /*#__PURE__*/_jsx(CloseOutlined, {}),
|
|
147
149
|
size: "small"
|
|
148
150
|
})]
|
|
@@ -246,11 +248,12 @@ export var LibroSearchView = (_dec = transient(), _dec2 = view('libro-search-vie
|
|
|
246
248
|
_this.toDispose.push(_this.libro.model.onCellViewChanged(function () {
|
|
247
249
|
return _this.onCellsChanged();
|
|
248
250
|
}));
|
|
251
|
+
// search view 失去焦点时依然可以通过esc隐藏search
|
|
249
252
|
_this.toDispose.push(_this.libro.model.onCommandModeChanged(function (mode) {
|
|
250
253
|
if (mode) {
|
|
251
254
|
setTimeout(function () {
|
|
252
255
|
if (_this.hasFocus === false) {
|
|
253
|
-
_this.hide();
|
|
256
|
+
_this.hide(false);
|
|
254
257
|
}
|
|
255
258
|
}, 0);
|
|
256
259
|
}
|
|
@@ -292,14 +295,18 @@ export var LibroSearchView = (_dec = transient(), _dec2 = view('libro-search-vie
|
|
|
292
295
|
(_this$findInputRef = _this.findInputRef) === null || _this$findInputRef === void 0 || (_this$findInputRef = _this$findInputRef.current) === null || _this$findInputRef === void 0 || _this$findInputRef.focus();
|
|
293
296
|
};
|
|
294
297
|
_this.hide = function () {
|
|
295
|
-
var _this$searchProvider5
|
|
298
|
+
var _this$searchProvider5;
|
|
299
|
+
var focus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
296
300
|
_this.searchVisible = false;
|
|
297
301
|
_this.contextKey.enableCommandMode();
|
|
298
302
|
(_this$searchProvider5 = _this.searchProvider) === null || _this$searchProvider5 === void 0 || _this$searchProvider5.endQuery();
|
|
299
303
|
if (_this.searchProvider) {
|
|
300
304
|
_this.searchProvider.replaceMode = false;
|
|
301
305
|
}
|
|
302
|
-
(
|
|
306
|
+
if (focus) {
|
|
307
|
+
var _this$libro;
|
|
308
|
+
(_this$libro = _this.libro) === null || _this$libro === void 0 || _this$libro.focus();
|
|
309
|
+
}
|
|
303
310
|
};
|
|
304
311
|
_this.onFocus = function () {
|
|
305
312
|
_this.contextKey.disableCommandMode();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-search",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"@difizen/mana-app": "latest",
|
|
37
37
|
"@difizen/mana-l10n": "latest",
|
|
38
38
|
"@ant-design/icons": "^5.1.0",
|
|
39
|
-
"@difizen/libro-common": "^0.1.
|
|
40
|
-
"@difizen/libro-core": "^0.1.
|
|
41
|
-
"@difizen/libro-code-editor": "^0.1.
|
|
39
|
+
"@difizen/libro-common": "^0.1.21",
|
|
40
|
+
"@difizen/libro-core": "^0.1.21",
|
|
41
|
+
"@difizen/libro-code-editor": "^0.1.21",
|
|
42
42
|
"@types/lodash.debounce": "^4.0.7",
|
|
43
43
|
"classnames": "^2.3.2",
|
|
44
44
|
"lodash.debounce": "^4.0.8",
|
|
@@ -142,7 +142,11 @@ export const SearchContent = () => {
|
|
|
142
142
|
icon={<EllipsisOutlined />}
|
|
143
143
|
size="small"
|
|
144
144
|
/>
|
|
145
|
-
<Button
|
|
145
|
+
<Button
|
|
146
|
+
onClick={() => instance.hide()}
|
|
147
|
+
icon={<CloseOutlined />}
|
|
148
|
+
size="small"
|
|
149
|
+
/>
|
|
146
150
|
</div>
|
|
147
151
|
</td>
|
|
148
152
|
</tr>
|
|
@@ -269,12 +273,13 @@ export class LibroSearchView extends BaseView {
|
|
|
269
273
|
this.toDispose.push(
|
|
270
274
|
this.libro.model.onCellViewChanged(() => this.onCellsChanged()),
|
|
271
275
|
);
|
|
276
|
+
// search view 失去焦点时依然可以通过esc隐藏search
|
|
272
277
|
this.toDispose.push(
|
|
273
278
|
this.libro.model.onCommandModeChanged((mode) => {
|
|
274
279
|
if (mode) {
|
|
275
280
|
setTimeout(() => {
|
|
276
281
|
if (this.hasFocus === false) {
|
|
277
|
-
this.hide();
|
|
282
|
+
this.hide(false);
|
|
278
283
|
}
|
|
279
284
|
}, 0);
|
|
280
285
|
}
|
|
@@ -306,14 +311,16 @@ export class LibroSearchView extends BaseView {
|
|
|
306
311
|
this.initialQuery();
|
|
307
312
|
this.findInputRef?.current?.focus();
|
|
308
313
|
};
|
|
309
|
-
hide = () => {
|
|
314
|
+
hide = (focus = true) => {
|
|
310
315
|
this.searchVisible = false;
|
|
311
316
|
this.contextKey.enableCommandMode();
|
|
312
317
|
this.searchProvider?.endQuery();
|
|
313
318
|
if (this.searchProvider) {
|
|
314
319
|
this.searchProvider.replaceMode = false;
|
|
315
320
|
}
|
|
316
|
-
|
|
321
|
+
if (focus) {
|
|
322
|
+
this.libro?.focus();
|
|
323
|
+
}
|
|
317
324
|
};
|
|
318
325
|
|
|
319
326
|
onFocus = () => {
|