@opensumi/ide-file-tree-next 3.5.1-next-1731638201.0 → 3.5.1-next-1731934001.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/dialog/file-dialog-model.service.d.ts +1 -1
- package/lib/browser/dialog/file-dialog-model.service.d.ts.map +1 -1
- package/lib/browser/dialog/file-dialog.contextkey.d.ts +9 -0
- package/lib/browser/dialog/file-dialog.contextkey.d.ts.map +1 -0
- package/lib/browser/dialog/file-dialog.contextkey.js +25 -0
- package/lib/browser/dialog/file-dialog.contextkey.js.map +1 -0
- package/lib/browser/dialog/file-dialog.module.less +12 -4
- package/lib/browser/dialog/file-dialog.service.d.ts +4 -0
- package/lib/browser/dialog/file-dialog.service.d.ts.map +1 -1
- package/lib/browser/dialog/file-dialog.service.js +14 -0
- package/lib/browser/dialog/file-dialog.service.js.map +1 -1
- package/lib/browser/dialog/file-dialog.view.d.ts +3 -1
- package/lib/browser/dialog/file-dialog.view.d.ts.map +1 -1
- package/lib/browser/dialog/file-dialog.view.js +45 -27
- package/lib/browser/dialog/file-dialog.view.js.map +1 -1
- package/lib/browser/dialog/window-dialog.service.d.ts +1 -0
- package/lib/browser/dialog/window-dialog.service.d.ts.map +1 -1
- package/lib/browser/dialog/window-dialog.service.js +4 -2
- package/lib/browser/dialog/window-dialog.service.js.map +1 -1
- package/package.json +17 -17
- package/src/browser/dialog/file-dialog-model.service.ts +1 -1
- package/src/browser/dialog/file-dialog.contextkey.ts +21 -0
- package/src/browser/dialog/file-dialog.module.less +12 -4
- package/src/browser/dialog/file-dialog.service.ts +16 -0
- package/src/browser/dialog/file-dialog.view.tsx +91 -57
- package/src/browser/dialog/window-dialog.service.tsx +20 -2
|
@@ -10,7 +10,7 @@ export interface IParseStore {
|
|
|
10
10
|
type: PasteTypes;
|
|
11
11
|
}
|
|
12
12
|
export interface IFileTreeHandle extends IRecycleTreeHandle {
|
|
13
|
-
hasDirectFocus
|
|
13
|
+
hasDirectFocus?: () => boolean;
|
|
14
14
|
}
|
|
15
15
|
export interface FileTreeValidateMessage extends PromptValidateMessage {
|
|
16
16
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-dialog-model.service.d.ts","sourceRoot":"","sources":["../../../src/browser/dialog/file-dialog-model.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAEL,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,IAAI,EAEJ,YAAY,EACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAkD,KAAK,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAA0B,UAAU,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC;IAC5B,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;IACzD,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"file-dialog-model.service.d.ts","sourceRoot":"","sources":["../../../src/browser/dialog/file-dialog-model.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAEL,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,IAAI,EAEJ,YAAY,EACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAkD,KAAK,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,MA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@@
|
|
|
1
|
+
import { IContextKey, IContextKeyService } from '@opensumi/ide-core-browser';
|
|
2
|
+
export declare class FileDialogContextKey {
|
|
3
|
+
private readonly globalContextKeyService;
|
|
4
|
+
fileDialogViewVisibleContext: IContextKey<boolean>;
|
|
5
|
+
private _contextKeyService;
|
|
6
|
+
initScopedContext(dom: HTMLDivElement): void;
|
|
7
|
+
get service(): IContextKeyService;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=file-dialog.contextkey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-dialog.contextkey.d.ts","sourceRoot":"","sources":["../../../src/browser/dialog/file-dialog.contextkey.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAG7E,qBACa,oBAAoB;IAE/B,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAqB;IAEtD,4BAA4B,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC1D,OAAO,CAAC,kBAAkB,CAAqB;IAE/C,iBAAiB,CAAC,GAAG,EAAE,cAAc;IAKrC,IAAI,OAAO,uBAEV;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileDialogContextKey = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@opensumi/di");
|
|
6
|
+
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
7
|
+
const contextkey_1 = require("@opensumi/ide-core-browser/lib/contextkey");
|
|
8
|
+
let FileDialogContextKey = class FileDialogContextKey {
|
|
9
|
+
initScopedContext(dom) {
|
|
10
|
+
this._contextKeyService = this.globalContextKeyService.createScoped(dom);
|
|
11
|
+
this.fileDialogViewVisibleContext = contextkey_1.FileDialogViewVisibleContext.bind(this._contextKeyService);
|
|
12
|
+
}
|
|
13
|
+
get service() {
|
|
14
|
+
return this._contextKeyService;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.FileDialogContextKey = FileDialogContextKey;
|
|
18
|
+
tslib_1.__decorate([
|
|
19
|
+
(0, di_1.Autowired)(ide_core_browser_1.IContextKeyService),
|
|
20
|
+
tslib_1.__metadata("design:type", Object)
|
|
21
|
+
], FileDialogContextKey.prototype, "globalContextKeyService", void 0);
|
|
22
|
+
exports.FileDialogContextKey = FileDialogContextKey = tslib_1.__decorate([
|
|
23
|
+
(0, di_1.Injectable)()
|
|
24
|
+
], FileDialogContextKey);
|
|
25
|
+
//# sourceMappingURL=file-dialog.contextkey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-dialog.contextkey.js","sourceRoot":"","sources":["../../../src/browser/dialog/file-dialog.contextkey.ts"],"names":[],"mappings":";;;;AAAA,qCAAqD;AACrD,iEAA6E;AAC7E,0EAAyF;AAGlF,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAO/B,iBAAiB,CAAC,GAAmB;QACnC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACzE,IAAI,CAAC,4BAA4B,GAAG,yCAA4B,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACjG,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;CACF,CAAA;AAfY,oDAAoB;AAEd;IADhB,IAAA,cAAS,EAAC,qCAAkB,CAAC;;qEAC+B;+BAFlD,oBAAoB;IADhC,IAAA,eAAU,GAAE;GACA,oBAAoB,CAehC"}
|
|
@@ -67,9 +67,17 @@
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
.file_dialog_wrapper {
|
|
70
|
-
:global
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
:global {
|
|
71
|
+
.kt-modal-close-x {
|
|
72
|
+
margin: 10px 18px 0 0;
|
|
73
|
+
width: 12px;
|
|
74
|
+
height: 12px;
|
|
75
|
+
line-height: 20px;
|
|
76
|
+
color: var(--kt-notificationsCloseIcon-foreground);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.kt-modal-body {
|
|
80
|
+
padding-bottom: 8px;
|
|
81
|
+
}
|
|
74
82
|
}
|
|
75
83
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ITreeNodeOrCompositeTreeNode, Tree } from '@opensumi/ide-components';
|
|
2
2
|
import { LabelService } from '@opensumi/ide-core-browser/lib/services';
|
|
3
3
|
import { Directory } from '../../common/file-tree-node.define';
|
|
4
|
+
import { FileDialogContextKey } from './file-dialog.contextkey';
|
|
4
5
|
export declare class FileTreeDialogService extends Tree {
|
|
5
6
|
private fileTreeAPI;
|
|
6
7
|
private workspaceService;
|
|
7
8
|
labelService: LabelService;
|
|
9
|
+
private fileDialogContextKey;
|
|
8
10
|
private workspaceRoot;
|
|
9
11
|
_whenReady: Promise<void>;
|
|
10
12
|
constructor(root: string);
|
|
@@ -14,6 +16,8 @@ export declare class FileTreeDialogService extends Tree {
|
|
|
14
16
|
resolveRoot(path: string): Promise<(Directory | import("../../common/file-tree-node.define").File)[] | undefined>;
|
|
15
17
|
getDirectoryList(): string[];
|
|
16
18
|
sortComparator(a: ITreeNodeOrCompositeTreeNode, b: ITreeNodeOrCompositeTreeNode): any;
|
|
19
|
+
initContextKey(dom: HTMLDivElement): void;
|
|
20
|
+
get contextKey(): FileDialogContextKey;
|
|
17
21
|
dispose(): void;
|
|
18
22
|
}
|
|
19
23
|
//# sourceMappingURL=file-dialog.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-dialog.service.d.ts","sourceRoot":"","sources":["../../../src/browser/dialog/file-dialog.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,IAAI,EAAgB,MAAM,0BAA0B,CAAC;AAE5F,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAKvE,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAE/D,qBACa,qBAAsB,SAAQ,IAAI;IAE7C,OAAO,CAAC,WAAW,CAAe;IAGlC,OAAO,CAAC,gBAAgB,CAAoB;IAGrC,YAAY,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"file-dialog.service.d.ts","sourceRoot":"","sources":["../../../src/browser/dialog/file-dialog.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,IAAI,EAAgB,MAAM,0BAA0B,CAAC;AAE5F,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAKvE,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,qBACa,qBAAsB,SAAQ,IAAI;IAE7C,OAAO,CAAC,WAAW,CAAe;IAGlC,OAAO,CAAC,gBAAgB,CAAoB;IAGrC,YAAY,EAAE,YAAY,CAAC;IAGlC,OAAO,CAAC,oBAAoB,CAAuB;IAEnD,OAAO,CAAC,aAAa,CAAW;IAEzB,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBAET,IAAI,EAAE,MAAM;IAKpC,IAAI,SAAS,kBAEZ;IAEK,oBAAoB,CAAC,IAAI,EAAE,MAAM;IAUjC,eAAe,CAAC,MAAM,CAAC,EAAE,SAAS;IAmBlC,WAAW,CAAC,IAAI,EAAE,MAAM;IAc9B,gBAAgB;IAqBhB,cAAc,CAAC,CAAC,EAAE,4BAA4B,EAAE,CAAC,EAAE,4BAA4B;IAe/E,cAAc,CAAC,GAAG,EAAE,cAAc;IAOlC,IAAI,UAAU,yBAEb;IAED,OAAO;CAGR"}
|
|
@@ -8,6 +8,7 @@ const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
|
8
8
|
const services_1 = require("@opensumi/ide-core-browser/lib/services");
|
|
9
9
|
const ide_workspace_1 = require("@opensumi/ide-workspace");
|
|
10
10
|
const common_1 = require("../../common");
|
|
11
|
+
const file_dialog_contextkey_1 = require("./file-dialog.contextkey");
|
|
11
12
|
let FileTreeDialogService = class FileTreeDialogService extends ide_components_1.Tree {
|
|
12
13
|
constructor(root) {
|
|
13
14
|
super();
|
|
@@ -92,6 +93,15 @@ let FileTreeDialogService = class FileTreeDialogService extends ide_components_1
|
|
|
92
93
|
}
|
|
93
94
|
return a.type === ide_components_1.TreeNodeType.CompositeTreeNode ? -1 : b.type === ide_components_1.TreeNodeType.CompositeTreeNode ? 1 : 0;
|
|
94
95
|
}
|
|
96
|
+
initContextKey(dom) {
|
|
97
|
+
if (!dom) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.fileDialogContextKey.initScopedContext(dom);
|
|
101
|
+
}
|
|
102
|
+
get contextKey() {
|
|
103
|
+
return this.fileDialogContextKey;
|
|
104
|
+
}
|
|
95
105
|
dispose() {
|
|
96
106
|
super.dispose();
|
|
97
107
|
}
|
|
@@ -109,6 +119,10 @@ tslib_1.__decorate([
|
|
|
109
119
|
(0, di_1.Autowired)(services_1.LabelService),
|
|
110
120
|
tslib_1.__metadata("design:type", services_1.LabelService)
|
|
111
121
|
], FileTreeDialogService.prototype, "labelService", void 0);
|
|
122
|
+
tslib_1.__decorate([
|
|
123
|
+
(0, di_1.Autowired)(file_dialog_contextkey_1.FileDialogContextKey),
|
|
124
|
+
tslib_1.__metadata("design:type", file_dialog_contextkey_1.FileDialogContextKey)
|
|
125
|
+
], FileTreeDialogService.prototype, "fileDialogContextKey", void 0);
|
|
112
126
|
exports.FileTreeDialogService = FileTreeDialogService = tslib_1.__decorate([
|
|
113
127
|
(0, di_1.Injectable)({ multiple: true }),
|
|
114
128
|
tslib_1.__param(0, (0, di_1.Optional)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-dialog.service.js","sourceRoot":"","sources":["../../../src/browser/dialog/file-dialog.service.ts"],"names":[],"mappings":";;;;AAAA,qCAA+D;AAC/D,6DAA4F;AAC5F,iEAA0D;AAC1D,sEAAuE;AAEvE,2DAA4D;AAE5D,yCAA4C;
|
|
1
|
+
{"version":3,"file":"file-dialog.service.js","sourceRoot":"","sources":["../../../src/browser/dialog/file-dialog.service.ts"],"names":[],"mappings":";;;;AAAA,qCAA+D;AAC/D,6DAA4F;AAC5F,iEAA0D;AAC1D,sEAAuE;AAEvE,2DAA4D;AAE5D,yCAA4C;AAG5C,qEAAgE;AAGzD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,qBAAI;IAiB7C,YAAwB,IAAY;QAClC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,IAAY;QACrC,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,OAAO,GAAQ,IAAI,sBAAG,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,0BAAO,CAAC,IAAI,CAAC,CAAC;YAC5D,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;YACrE,IAAI,YAAY,EAAE,CAAC;gBACjB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;YACpC,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,MAAkB;QACtC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,QAAQ;YACR,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;gBACxB,IAAI,CAAC,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9D,CAAC;YACD,MAAM,EAA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,IAAI,KAAK,6BAAY,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,6BAAY,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5G,CAAC;IAED,cAAc,CAAC,GAAmB;QAChC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO;QACT,CAAC;QACD,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF,CAAA;AAvHY,sDAAqB;AAExB;IADP,IAAA,cAAS,EAAC,qBAAY,CAAC;;0DACU;AAG1B;IADP,IAAA,cAAS,EAAC,iCAAiB,CAAC;;+DACe;AAGrC;IADN,IAAA,cAAS,EAAC,uBAAY,CAAC;sCACH,uBAAY;2DAAC;AAG1B;IADP,IAAA,cAAS,EAAC,6CAAoB,CAAC;sCACF,6CAAoB;mEAAC;gCAXxC,qBAAqB;IADjC,IAAA,eAAU,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAkBhB,mBAAA,IAAA,aAAQ,GAAE,CAAA;;GAjBZ,qBAAqB,CAuHjC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IOpenDialogOptions, ISaveDialogOptions } from '@opensumi/ide-overlay';
|
|
3
3
|
import { FileTreeDialogModel } from './file-dialog-model.service';
|
|
4
|
+
import { FileTreeDialogService } from './file-dialog.service';
|
|
4
5
|
export interface IFileDialogProps {
|
|
5
6
|
options: ISaveDialogOptions | IOpenDialogOptions;
|
|
6
7
|
model: FileTreeDialogModel;
|
|
8
|
+
fileService: FileTreeDialogService;
|
|
7
9
|
isOpenDialog: boolean;
|
|
8
10
|
}
|
|
9
11
|
export declare const FILE_TREE_DIALOG_HEIGHT = 22;
|
|
10
|
-
export declare const FileDialog: ({ options, model, isOpenDialog }: React.PropsWithChildren<IFileDialogProps>) => React.JSX.Element;
|
|
12
|
+
export declare const FileDialog: ({ options, model, isOpenDialog, fileService, }: React.PropsWithChildren<IFileDialogProps>) => React.JSX.Element;
|
|
11
13
|
//# sourceMappingURL=file-dialog.view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-dialog.view.d.ts","sourceRoot":"","sources":["../../../src/browser/dialog/file-dialog.view.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"file-dialog.view.d.ts","sourceRoot":"","sources":["../../../src/browser/dialog/file-dialog.view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAcjF,OAAO,EAAkB,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CAAC;IACjD,KAAK,EAAE,mBAAmB,CAAC;IAC3B,WAAW,EAAE,qBAAqB,CAAC;IACnC,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,eAAO,MAAM,UAAU,mDAKpB,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,sBA6R3C,CAAC"}
|
|
@@ -10,17 +10,19 @@ const ide_overlay_1 = require("@opensumi/ide-overlay");
|
|
|
10
10
|
const file_dialog_node_1 = require("./file-dialog-node");
|
|
11
11
|
const file_dialog_module_less_1 = tslib_1.__importDefault(require("./file-dialog.module.less"));
|
|
12
12
|
exports.FILE_TREE_DIALOG_HEIGHT = 22;
|
|
13
|
-
const FileDialog = ({ options, model, isOpenDialog }) => {
|
|
13
|
+
const FileDialog = ({ options, model, isOpenDialog, fileService, }) => {
|
|
14
14
|
const dialogService = (0, ide_core_browser_1.useInjectable)(ide_overlay_1.IDialogService);
|
|
15
15
|
const wrapperRef = (0, react_1.useRef)(null);
|
|
16
|
-
const [fileName, setFileName] = (0, react_1.useState)('');
|
|
16
|
+
const [fileName, setFileName] = (0, react_1.useState)(options.defaultFileName || '');
|
|
17
17
|
const [isReady, setIsReady] = (0, react_1.useState)(false);
|
|
18
18
|
const [selectPath, setSelectPath] = (0, react_1.useState)('');
|
|
19
19
|
const [directoryList, setDirectoryList] = (0, react_1.useState)([]);
|
|
20
20
|
(0, react_1.useEffect)(() => {
|
|
21
|
+
var _a;
|
|
21
22
|
if (model) {
|
|
22
23
|
setIsReady(false);
|
|
23
24
|
ensureIsReady();
|
|
25
|
+
(_a = fileService.contextKey.fileDialogViewVisibleContext) === null || _a === void 0 ? void 0 : _a.set(true);
|
|
24
26
|
}
|
|
25
27
|
return () => {
|
|
26
28
|
model.dispose();
|
|
@@ -37,7 +39,7 @@ const FileDialog = ({ options, model, isOpenDialog }) => {
|
|
|
37
39
|
setDirectoryList(list);
|
|
38
40
|
}
|
|
39
41
|
}, [isReady]);
|
|
40
|
-
const
|
|
42
|
+
const ensure = (0, react_1.useCallback)(() => {
|
|
41
43
|
const value = model.selectedFiles.map((file) => file.uri.path.toString());
|
|
42
44
|
// 如果有文件名的,说明肯定是保存文件的情况
|
|
43
45
|
if (fileName && options.showNameInput && ((value === null || value === void 0 ? void 0 : value.length) === 1 || options.defaultUri)) {
|
|
@@ -59,10 +61,12 @@ const FileDialog = ({ options, model, isOpenDialog }) => {
|
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
setIsReady(false);
|
|
64
|
+
fileService.contextKey.fileDialogViewVisibleContext.set(false);
|
|
62
65
|
}, [isReady, dialogService, model, fileName, options]);
|
|
63
66
|
const close = (0, react_1.useCallback)(() => {
|
|
64
67
|
setIsReady(false);
|
|
65
68
|
dialogService.hide();
|
|
69
|
+
fileService.contextKey.fileDialogViewVisibleContext.set(false);
|
|
66
70
|
}, [isReady, dialogService]);
|
|
67
71
|
const ensureIsReady = (0, react_1.useCallback)(async () => {
|
|
68
72
|
await model.whenReady;
|
|
@@ -77,7 +81,6 @@ const FileDialog = ({ options, model, isOpenDialog }) => {
|
|
|
77
81
|
model.handleTreeHandler({
|
|
78
82
|
...handle,
|
|
79
83
|
getModel: () => model.treeModel,
|
|
80
|
-
hasDirectFocus: () => wrapperRef.current === document.activeElement,
|
|
81
84
|
});
|
|
82
85
|
}, [model]);
|
|
83
86
|
const handleTwistierClick = (0, react_1.useCallback)((ev, item) => {
|
|
@@ -160,29 +163,44 @@ const FileDialog = ({ options, model, isOpenDialog }) => {
|
|
|
160
163
|
return (react_1.default.createElement(ide_components_1.Select, { onChange: onRootChangeHandler, className: file_dialog_module_less_1.default.select_control, size: 'small', value: selectPath }, directoryList.map((item, idx) => (react_1.default.createElement(ide_components_1.Option, { value: item, key: `${idx} - ${item}` }, item)))));
|
|
161
164
|
}
|
|
162
165
|
}, [directoryList, selectPath]);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
166
|
+
const handleKeyUp = (0, react_1.useCallback)((event) => {
|
|
167
|
+
const { key } = ide_core_browser_1.KeyCode.createKeyCode(event);
|
|
168
|
+
const hasModifyKey = event.shiftKey || event.metaKey || event.altKey || event.ctrlKey;
|
|
169
|
+
if (key && ide_core_browser_1.Key.ENTER.keyCode === key.keyCode && !hasModifyKey) {
|
|
170
|
+
ensure();
|
|
171
|
+
}
|
|
172
|
+
}, [ensure]);
|
|
173
|
+
(0, react_1.useEffect)(() => {
|
|
174
|
+
var _a;
|
|
175
|
+
if (wrapperRef.current) {
|
|
176
|
+
fileService.initContextKey(wrapperRef.current);
|
|
177
|
+
fileService.contextKey.fileDialogViewVisibleContext.set(true);
|
|
178
|
+
(_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('keyup', handleKeyUp);
|
|
179
|
+
}
|
|
180
|
+
return () => {
|
|
181
|
+
var _a;
|
|
182
|
+
(_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('keyup', handleKeyUp);
|
|
183
|
+
};
|
|
184
|
+
}, []);
|
|
185
|
+
const DialogContent = (0, react_1.useMemo)(() => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
186
|
+
react_1.default.createElement("div", { className: file_dialog_module_less_1.default.file_dialog_directory }, renderDirectorySelection()),
|
|
187
|
+
react_1.default.createElement("div", { className: file_dialog_module_less_1.default.file_dialog_content }, renderDialogTree()))), [renderDirectorySelection, renderDialogTree]);
|
|
188
|
+
const DialogButtons = (0, react_1.useMemo)(() => (react_1.default.createElement("div", { className: file_dialog_module_less_1.default.file_dialog_buttons },
|
|
189
|
+
react_1.default.createElement(ide_components_1.Button, { onClick: close, type: 'secondary', className: file_dialog_module_less_1.default.button }, (0, ide_core_browser_1.localize)('dialog.file.close')),
|
|
190
|
+
react_1.default.createElement(ide_components_1.Button, { onClick: ensure, type: 'primary', className: file_dialog_module_less_1.default.button, disabled: isSaveDialog && options.showNameInput && fileName.length === 0 }, isOpenDialog
|
|
191
|
+
? options.openLabel || (0, ide_core_browser_1.localize)('dialog.file.ok')
|
|
192
|
+
: (0, ide_core_browser_1.localize)('dialog.file.ok')))), [close, ensure, isSaveDialog, isOpenDialog, fileName, options]);
|
|
193
|
+
return (react_1.default.createElement("div", { className: file_dialog_module_less_1.default.file_dialog_wrapper, ref: wrapperRef },
|
|
194
|
+
react_1.default.createElement("div", { className: file_dialog_module_less_1.default.file_dialog_directory_title }, isOpenDialog
|
|
195
|
+
? options.title || (0, ide_core_browser_1.localize)('dialog.file.openLabel')
|
|
196
|
+
: options.saveLabel || (0, ide_core_browser_1.localize)('dialog.file.saveLabel')),
|
|
197
|
+
DialogContent,
|
|
198
|
+
!isOpenDialog && options.showNameInput && (react_1.default.createElement("div", { className: file_dialog_module_less_1.default.file_dialog_file_container },
|
|
199
|
+
react_1.default.createElement("span", { className: file_dialog_module_less_1.default.file_dialog_file_name },
|
|
200
|
+
(0, ide_core_browser_1.localize)('dialog.file.name'),
|
|
201
|
+
": "),
|
|
202
|
+
react_1.default.createElement(ide_components_1.Input, { size: 'small', value: fileName, autoFocus: true, selection: { start: 0, end: fileName.indexOf('.') || fileName.length }, onChange: (event) => setFileName(event.target.value) }))),
|
|
203
|
+
DialogButtons));
|
|
186
204
|
};
|
|
187
205
|
exports.FileDialog = FileDialog;
|
|
188
206
|
//# sourceMappingURL=file-dialog.view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-dialog.view.js","sourceRoot":"","sources":["../../../src/browser/dialog/file-dialog.view.tsx"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"file-dialog.view.js","sourceRoot":"","sources":["../../../src/browser/dialog/file-dialog.view.tsx"],"names":[],"mappings":";;;;AAAA,uDAAiF;AAEjF,6DASkC;AAClC,iEAA2G;AAC3G,uFAAgF;AAChF,uDAA+F;AAK/F,yDAAwD;AACxD,gGAA+C;AAUlC,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAEnC,MAAM,UAAU,GAAG,CAAC,EACzB,OAAO,EACP,KAAK,EACL,YAAY,EACZ,WAAW,GAC+B,EAAE,EAAE;IAC9C,MAAM,aAAa,GAAG,IAAA,gCAAa,EAAiB,4BAAc,CAAC,CAAC;IACpE,MAAM,UAAU,GAAG,IAAA,cAAM,EAAwB,IAAI,CAAC,CAAC;IACvD,MAAM,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AC,eAAe,CAAkB;IAGzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IAEtC,OAAO,CAAC,mBAAmB,CAAW;IAEtC,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,WAAW,CAAM;;
|
|
1
|
+
{"version":3,"file":"window-dialog.service.d.ts","sourceRoot":"","sources":["../../../src/browser/dialog/window-dialog.service.tsx"],"names":[],"mappings":"AAGA,OAAO,EAML,GAAG,EAGJ,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAkB,kBAAkB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAOrH,qBACa,uBAAwB,YAAW,oBAAoB;IAElE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;IAGpC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAG/C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAqB;IAGvD,OAAO,CAAC,eAAe,CAAkB;IAGzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IAEtC,OAAO,CAAC,mBAAmB,CAAW;IAEtC,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,GAAG,CAAK;;IAMV,IAAI;IAWV,IAAI,UAAU,QAEb;IAED,IAAI,SAAS,kBAEZ;YAEa,sBAAsB;IAM9B,cAAc,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;IAuF5E,cAAc,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;CAwDjF"}
|
|
@@ -14,6 +14,7 @@ const file_dialog_service_1 = require("./file-dialog.service");
|
|
|
14
14
|
const file_dialog_view_1 = require("./file-dialog.view");
|
|
15
15
|
let WindowDialogServiceImpl = class WindowDialogServiceImpl {
|
|
16
16
|
constructor() {
|
|
17
|
+
this.idx = 1;
|
|
17
18
|
this._whenReady = this.init();
|
|
18
19
|
}
|
|
19
20
|
async init() {
|
|
@@ -39,6 +40,7 @@ let WindowDialogServiceImpl = class WindowDialogServiceImpl {
|
|
|
39
40
|
}
|
|
40
41
|
// https://code.visualstudio.com/api/references/vscode-api#OpenDialogOptions
|
|
41
42
|
async showOpenDialog(options = {}) {
|
|
43
|
+
this.dialogService.reset();
|
|
42
44
|
await this.whenReady;
|
|
43
45
|
const defaultOptions = {
|
|
44
46
|
canSelectFiles: true,
|
|
@@ -91,7 +93,7 @@ let WindowDialogServiceImpl = class WindowDialogServiceImpl {
|
|
|
91
93
|
await fileTreeDialogService.whenReady;
|
|
92
94
|
const model = file_dialog_model_service_1.FileTreeDialogModel.createModel(this.injector, fileTreeDialogService);
|
|
93
95
|
const res = await this.dialogService.open({
|
|
94
|
-
message: react_1.default.createElement(file_dialog_view_1.FileDialog, { model: model, options: { ...defaultOptions, ...options }, isOpenDialog: true }),
|
|
96
|
+
message: (react_1.default.createElement(file_dialog_view_1.FileDialog, { key: this.idx++, fileService: fileTreeDialogService, model: model, options: { ...defaultOptions, ...options }, isOpenDialog: true })),
|
|
95
97
|
type: ide_core_browser_1.MessageType.Empty,
|
|
96
98
|
buttons: [],
|
|
97
99
|
closable: true,
|
|
@@ -143,7 +145,7 @@ let WindowDialogServiceImpl = class WindowDialogServiceImpl {
|
|
|
143
145
|
await fileTreeDialogService.whenReady;
|
|
144
146
|
const model = file_dialog_model_service_1.FileTreeDialogModel.createModel(this.injector, fileTreeDialogService);
|
|
145
147
|
const res = await this.dialogService.open({
|
|
146
|
-
message: react_1.default.createElement(file_dialog_view_1.FileDialog, { model: model, options: options, isOpenDialog: false }),
|
|
148
|
+
message: (react_1.default.createElement(file_dialog_view_1.FileDialog, { key: this.idx++, fileService: fileTreeDialogService, model: model, options: options, isOpenDialog: false })),
|
|
147
149
|
type: ide_core_browser_1.MessageType.Empty,
|
|
148
150
|
buttons: [],
|
|
149
151
|
closable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window-dialog.service.js","sourceRoot":"","sources":["../../../src/browser/dialog/window-dialog.service.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,qCAA+E;AAC/E,iEASoC;AACpC,qEAAgF;AAChF,iEAAgE;AAChE,uDAAqH;AAErH,2EAAkE;AAClE,gGAA+C;AAC/C,+DAA8D;AAC9D,yDAAgD;AAGzC,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;
|
|
1
|
+
{"version":3,"file":"window-dialog.service.js","sourceRoot":"","sources":["../../../src/browser/dialog/window-dialog.service.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,qCAA+E;AAC/E,iEASoC;AACpC,qEAAgF;AAChF,iEAAgE;AAChE,uDAAqH;AAErH,2EAAkE;AAClE,gGAA+C;AAC/C,+DAA8D;AAC9D,yDAAgD;AAGzC,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAsBlC;QAFQ,QAAG,GAAG,CAAC,CAAC;QAGd,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,mBAAmB,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,oCAAiB,CAAC,kBAAkB,CAAC,CAAC;QAC5F,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAS,2BAA2B,CAAC,CAAC;QAC9F,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,CAAC;YACnE,IAAI,CAAC,WAAW,GAAG,IAAI,sBAAG,CAAC,QAAS,CAAC,GAAG,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,WAAW,GAAG,IAAI,sBAAG,CAAC,aAAa,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,IAAI,UAAU;QACZ,O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"version": "3.5.1-next-1731934001.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib",
|
|
6
6
|
"src"
|
|
@@ -17,23 +17,23 @@
|
|
|
17
17
|
"url": "git@github.com:opensumi/core.git"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@opensumi/ide-core-node": "3.5.1-next-
|
|
21
|
-
"@opensumi/ide-file-service": "3.5.1-next-
|
|
20
|
+
"@opensumi/ide-core-node": "3.5.1-next-1731934001.0",
|
|
21
|
+
"@opensumi/ide-file-service": "3.5.1-next-1731934001.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@opensumi/ide-components": "3.5.1-next-
|
|
25
|
-
"@opensumi/ide-core-browser": "3.5.1-next-
|
|
26
|
-
"@opensumi/ide-core-common": "3.5.1-next-
|
|
27
|
-
"@opensumi/ide-decoration": "3.5.1-next-
|
|
28
|
-
"@opensumi/ide-dev-tool": "3.5.1-next-
|
|
29
|
-
"@opensumi/ide-editor": "3.5.1-next-
|
|
30
|
-
"@opensumi/ide-explorer": "3.5.1-next-
|
|
31
|
-
"@opensumi/ide-main-layout": "3.5.1-next-
|
|
32
|
-
"@opensumi/ide-overlay": "3.5.1-next-
|
|
33
|
-
"@opensumi/ide-terminal-next": "3.5.1-next-
|
|
34
|
-
"@opensumi/ide-theme": "3.5.1-next-
|
|
35
|
-
"@opensumi/ide-workspace": "3.5.1-next-
|
|
36
|
-
"@opensumi/ide-workspace-edit": "3.5.1-next-
|
|
24
|
+
"@opensumi/ide-components": "3.5.1-next-1731934001.0",
|
|
25
|
+
"@opensumi/ide-core-browser": "3.5.1-next-1731934001.0",
|
|
26
|
+
"@opensumi/ide-core-common": "3.5.1-next-1731934001.0",
|
|
27
|
+
"@opensumi/ide-decoration": "3.5.1-next-1731934001.0",
|
|
28
|
+
"@opensumi/ide-dev-tool": "3.5.1-next-1731934001.0",
|
|
29
|
+
"@opensumi/ide-editor": "3.5.1-next-1731934001.0",
|
|
30
|
+
"@opensumi/ide-explorer": "3.5.1-next-1731934001.0",
|
|
31
|
+
"@opensumi/ide-main-layout": "3.5.1-next-1731934001.0",
|
|
32
|
+
"@opensumi/ide-overlay": "3.5.1-next-1731934001.0",
|
|
33
|
+
"@opensumi/ide-terminal-next": "3.5.1-next-1731934001.0",
|
|
34
|
+
"@opensumi/ide-theme": "3.5.1-next-1731934001.0",
|
|
35
|
+
"@opensumi/ide-workspace": "3.5.1-next-1731934001.0",
|
|
36
|
+
"@opensumi/ide-workspace-edit": "3.5.1-next-1731934001.0"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "5849361f31f3affe436c41a791112e3c7352c98c"
|
|
39
39
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Autowired, Injectable } from '@opensumi/di';
|
|
2
|
+
import { IContextKey, IContextKeyService } from '@opensumi/ide-core-browser';
|
|
3
|
+
import { FileDialogViewVisibleContext } from '@opensumi/ide-core-browser/lib/contextkey';
|
|
4
|
+
|
|
5
|
+
@Injectable()
|
|
6
|
+
export class FileDialogContextKey {
|
|
7
|
+
@Autowired(IContextKeyService)
|
|
8
|
+
private readonly globalContextKeyService: IContextKeyService;
|
|
9
|
+
|
|
10
|
+
public fileDialogViewVisibleContext: IContextKey<boolean>;
|
|
11
|
+
private _contextKeyService: IContextKeyService;
|
|
12
|
+
|
|
13
|
+
initScopedContext(dom: HTMLDivElement) {
|
|
14
|
+
this._contextKeyService = this.globalContextKeyService.createScoped(dom);
|
|
15
|
+
this.fileDialogViewVisibleContext = FileDialogViewVisibleContext.bind(this._contextKeyService);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get service() {
|
|
19
|
+
return this._contextKeyService;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -67,9 +67,17 @@
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
.file_dialog_wrapper {
|
|
70
|
-
:global
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
:global {
|
|
71
|
+
.kt-modal-close-x {
|
|
72
|
+
margin: 10px 18px 0 0;
|
|
73
|
+
width: 12px;
|
|
74
|
+
height: 12px;
|
|
75
|
+
line-height: 20px;
|
|
76
|
+
color: var(--kt-notificationsCloseIcon-foreground);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.kt-modal-body {
|
|
80
|
+
padding-bottom: 8px;
|
|
81
|
+
}
|
|
74
82
|
}
|
|
75
83
|
}
|
|
@@ -8,6 +8,8 @@ import { IWorkspaceService } from '@opensumi/ide-workspace';
|
|
|
8
8
|
import { IFileTreeAPI } from '../../common';
|
|
9
9
|
import { Directory } from '../../common/file-tree-node.define';
|
|
10
10
|
|
|
11
|
+
import { FileDialogContextKey } from './file-dialog.contextkey';
|
|
12
|
+
|
|
11
13
|
@Injectable({ multiple: true })
|
|
12
14
|
export class FileTreeDialogService extends Tree {
|
|
13
15
|
@Autowired(IFileTreeAPI)
|
|
@@ -19,6 +21,9 @@ export class FileTreeDialogService extends Tree {
|
|
|
19
21
|
@Autowired(LabelService)
|
|
20
22
|
public labelService: LabelService;
|
|
21
23
|
|
|
24
|
+
@Autowired(FileDialogContextKey)
|
|
25
|
+
private fileDialogContextKey: FileDialogContextKey;
|
|
26
|
+
|
|
22
27
|
private workspaceRoot: FileStat;
|
|
23
28
|
|
|
24
29
|
public _whenReady: Promise<void>;
|
|
@@ -111,6 +116,17 @@ export class FileTreeDialogService extends Tree {
|
|
|
111
116
|
return a.type === TreeNodeType.CompositeTreeNode ? -1 : b.type === TreeNodeType.CompositeTreeNode ? 1 : 0;
|
|
112
117
|
}
|
|
113
118
|
|
|
119
|
+
initContextKey(dom: HTMLDivElement) {
|
|
120
|
+
if (!dom) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
this.fileDialogContextKey.initScopedContext(dom);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
get contextKey() {
|
|
127
|
+
return this.fileDialogContextKey;
|
|
128
|
+
}
|
|
129
|
+
|
|
114
130
|
dispose() {
|
|
115
131
|
super.dispose();
|
|
116
132
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
Select,
|
|
11
11
|
TreeNodeType,
|
|
12
12
|
} from '@opensumi/ide-components';
|
|
13
|
-
import { URI, isMacintosh, localize, path, useInjectable } from '@opensumi/ide-core-browser';
|
|
13
|
+
import { Key, KeyCode, URI, isMacintosh, localize, path, useInjectable } from '@opensumi/ide-core-browser';
|
|
14
14
|
import { Progress } from '@opensumi/ide-core-browser/lib/progress/progress-bar';
|
|
15
15
|
import { IDialogService, IOpenDialogOptions, ISaveDialogOptions } from '@opensumi/ide-overlay';
|
|
16
16
|
|
|
@@ -19,19 +19,26 @@ import { Directory, File } from '../../common/file-tree-node.define';
|
|
|
19
19
|
import { FileTreeDialogModel } from './file-dialog-model.service';
|
|
20
20
|
import { FileTreeDialogNode } from './file-dialog-node';
|
|
21
21
|
import styles from './file-dialog.module.less';
|
|
22
|
+
import { FileTreeDialogService } from './file-dialog.service';
|
|
22
23
|
|
|
23
24
|
export interface IFileDialogProps {
|
|
24
25
|
options: ISaveDialogOptions | IOpenDialogOptions;
|
|
25
26
|
model: FileTreeDialogModel;
|
|
27
|
+
fileService: FileTreeDialogService;
|
|
26
28
|
isOpenDialog: boolean;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
export const FILE_TREE_DIALOG_HEIGHT = 22;
|
|
30
32
|
|
|
31
|
-
export const FileDialog = ({
|
|
33
|
+
export const FileDialog = ({
|
|
34
|
+
options,
|
|
35
|
+
model,
|
|
36
|
+
isOpenDialog,
|
|
37
|
+
fileService,
|
|
38
|
+
}: React.PropsWithChildren<IFileDialogProps>) => {
|
|
32
39
|
const dialogService = useInjectable<IDialogService>(IDialogService);
|
|
33
40
|
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
|
34
|
-
const [fileName, setFileName] = useState<string>('');
|
|
41
|
+
const [fileName, setFileName] = useState<string>((options as ISaveDialogOptions).defaultFileName || '');
|
|
35
42
|
const [isReady, setIsReady] = useState<boolean>(false);
|
|
36
43
|
const [selectPath, setSelectPath] = useState<string>('');
|
|
37
44
|
const [directoryList, setDirectoryList] = useState<string[]>([]);
|
|
@@ -40,6 +47,7 @@ export const FileDialog = ({ options, model, isOpenDialog }: React.PropsWithChil
|
|
|
40
47
|
if (model) {
|
|
41
48
|
setIsReady(false);
|
|
42
49
|
ensureIsReady();
|
|
50
|
+
fileService.contextKey.fileDialogViewVisibleContext?.set(true);
|
|
43
51
|
}
|
|
44
52
|
return () => {
|
|
45
53
|
model.dispose();
|
|
@@ -59,7 +67,7 @@ export const FileDialog = ({ options, model, isOpenDialog }: React.PropsWithChil
|
|
|
59
67
|
}
|
|
60
68
|
}, [isReady]);
|
|
61
69
|
|
|
62
|
-
const
|
|
70
|
+
const ensure = useCallback(() => {
|
|
63
71
|
const value: string[] = model.selectedFiles.map((file) => file.uri.path.toString());
|
|
64
72
|
// 如果有文件名的,说明肯定是保存文件的情况
|
|
65
73
|
if (fileName && (options as ISaveDialogOptions).showNameInput && (value?.length === 1 || options.defaultUri)) {
|
|
@@ -77,11 +85,13 @@ export const FileDialog = ({ options, model, isOpenDialog }: React.PropsWithChil
|
|
|
77
85
|
}
|
|
78
86
|
}
|
|
79
87
|
setIsReady(false);
|
|
88
|
+
fileService.contextKey.fileDialogViewVisibleContext.set(false);
|
|
80
89
|
}, [isReady, dialogService, model, fileName, options]);
|
|
81
90
|
|
|
82
91
|
const close = useCallback(() => {
|
|
83
92
|
setIsReady(false);
|
|
84
93
|
dialogService.hide();
|
|
94
|
+
fileService.contextKey.fileDialogViewVisibleContext.set(false);
|
|
85
95
|
}, [isReady, dialogService]);
|
|
86
96
|
|
|
87
97
|
const ensureIsReady = useCallback(async () => {
|
|
@@ -100,7 +110,6 @@ export const FileDialog = ({ options, model, isOpenDialog }: React.PropsWithChil
|
|
|
100
110
|
model.handleTreeHandler({
|
|
101
111
|
...handle,
|
|
102
112
|
getModel: () => model.treeModel,
|
|
103
|
-
hasDirectFocus: () => wrapperRef.current === document.activeElement,
|
|
104
113
|
});
|
|
105
114
|
},
|
|
106
115
|
[model],
|
|
@@ -232,58 +241,83 @@ export const FileDialog = ({ options, model, isOpenDialog }: React.PropsWithChil
|
|
|
232
241
|
}
|
|
233
242
|
}, [directoryList, selectPath]);
|
|
234
243
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
)
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
244
|
+
const handleKeyUp = useCallback(
|
|
245
|
+
(event: KeyboardEvent) => {
|
|
246
|
+
const { key } = KeyCode.createKeyCode(event);
|
|
247
|
+
const hasModifyKey = event.shiftKey || event.metaKey || event.altKey || event.ctrlKey;
|
|
248
|
+
if (key && Key.ENTER.keyCode === key.keyCode && !hasModifyKey) {
|
|
249
|
+
ensure();
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
[ensure],
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
useEffect(() => {
|
|
256
|
+
if (wrapperRef.current) {
|
|
257
|
+
fileService.initContextKey(wrapperRef.current);
|
|
258
|
+
fileService.contextKey.fileDialogViewVisibleContext.set(true);
|
|
259
|
+
wrapperRef.current?.addEventListener('keyup', handleKeyUp);
|
|
260
|
+
}
|
|
261
|
+
return () => {
|
|
262
|
+
wrapperRef.current?.removeEventListener('keyup', handleKeyUp);
|
|
263
|
+
};
|
|
264
|
+
}, []);
|
|
265
|
+
|
|
266
|
+
const DialogContent = useMemo(
|
|
267
|
+
() => (
|
|
268
|
+
<>
|
|
259
269
|
<div className={styles.file_dialog_directory}>{renderDirectorySelection()}</div>
|
|
260
270
|
<div className={styles.file_dialog_content}>{renderDialogTree()}</div>
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
271
|
+
</>
|
|
272
|
+
),
|
|
273
|
+
[renderDirectorySelection, renderDialogTree],
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
const DialogButtons = useMemo(
|
|
277
|
+
() => (
|
|
278
|
+
<div className={styles.file_dialog_buttons}>
|
|
279
|
+
<Button onClick={close} type='secondary' className={styles.button}>
|
|
280
|
+
{localize('dialog.file.close')}
|
|
281
|
+
</Button>
|
|
282
|
+
<Button
|
|
283
|
+
onClick={ensure}
|
|
284
|
+
type='primary'
|
|
285
|
+
className={styles.button}
|
|
286
|
+
disabled={isSaveDialog && (options as ISaveDialogOptions).showNameInput && fileName.length === 0}
|
|
287
|
+
>
|
|
288
|
+
{isOpenDialog
|
|
289
|
+
? (options as IOpenDialogOptions).openLabel || localize('dialog.file.ok')
|
|
290
|
+
: localize('dialog.file.ok')}
|
|
291
|
+
</Button>
|
|
292
|
+
</div>
|
|
293
|
+
),
|
|
294
|
+
[close, ensure, isSaveDialog, isOpenDialog, fileName, options],
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
return (
|
|
298
|
+
<div className={styles.file_dialog_wrapper} ref={wrapperRef}>
|
|
299
|
+
<div className={styles.file_dialog_directory_title}>
|
|
300
|
+
{isOpenDialog
|
|
301
|
+
? options.title || localize('dialog.file.openLabel')
|
|
302
|
+
: (options as ISaveDialogOptions).saveLabel || localize('dialog.file.saveLabel')}
|
|
286
303
|
</div>
|
|
287
|
-
|
|
288
|
-
|
|
304
|
+
|
|
305
|
+
{DialogContent}
|
|
306
|
+
|
|
307
|
+
{!isOpenDialog && (options as ISaveDialogOptions).showNameInput && (
|
|
308
|
+
<div className={styles.file_dialog_file_container}>
|
|
309
|
+
<span className={styles.file_dialog_file_name}>{localize('dialog.file.name')}: </span>
|
|
310
|
+
<Input
|
|
311
|
+
size='small'
|
|
312
|
+
value={fileName}
|
|
313
|
+
autoFocus={true}
|
|
314
|
+
selection={{ start: 0, end: fileName.indexOf('.') || fileName.length }}
|
|
315
|
+
onChange={(event) => setFileName(event.target.value)}
|
|
316
|
+
/>
|
|
317
|
+
</div>
|
|
318
|
+
)}
|
|
319
|
+
|
|
320
|
+
{DialogButtons}
|
|
321
|
+
</div>
|
|
322
|
+
);
|
|
289
323
|
};
|
|
@@ -41,6 +41,7 @@ export class WindowDialogServiceImpl implements IWindowDialogService {
|
|
|
41
41
|
|
|
42
42
|
private _whenReady: Promise<void>;
|
|
43
43
|
private _defaultUri: URI;
|
|
44
|
+
private idx = 1;
|
|
44
45
|
|
|
45
46
|
constructor() {
|
|
46
47
|
this._whenReady = this.init();
|
|
@@ -72,6 +73,7 @@ export class WindowDialogServiceImpl implements IWindowDialogService {
|
|
|
72
73
|
|
|
73
74
|
// https://code.visualstudio.com/api/references/vscode-api#OpenDialogOptions
|
|
74
75
|
async showOpenDialog(options: IOpenDialogOptions = {}): Promise<URI[] | undefined> {
|
|
76
|
+
this.dialogService.reset();
|
|
75
77
|
await this.whenReady;
|
|
76
78
|
const defaultOptions: IOpenDialogOptions = {
|
|
77
79
|
canSelectFiles: true,
|
|
@@ -131,7 +133,15 @@ export class WindowDialogServiceImpl implements IWindowDialogService {
|
|
|
131
133
|
await fileTreeDialogService.whenReady;
|
|
132
134
|
const model = FileTreeDialogModel.createModel(this.injector, fileTreeDialogService);
|
|
133
135
|
const res = await this.dialogService.open<string[]>({
|
|
134
|
-
message:
|
|
136
|
+
message: (
|
|
137
|
+
<FileDialog
|
|
138
|
+
key={this.idx++}
|
|
139
|
+
fileService={fileTreeDialogService}
|
|
140
|
+
model={model}
|
|
141
|
+
options={{ ...defaultOptions, ...options }}
|
|
142
|
+
isOpenDialog={true}
|
|
143
|
+
/>
|
|
144
|
+
),
|
|
135
145
|
type: MessageType.Empty,
|
|
136
146
|
buttons: [],
|
|
137
147
|
closable: true,
|
|
@@ -180,7 +190,15 @@ export class WindowDialogServiceImpl implements IWindowDialogService {
|
|
|
180
190
|
await fileTreeDialogService.whenReady;
|
|
181
191
|
const model = FileTreeDialogModel.createModel(this.injector, fileTreeDialogService);
|
|
182
192
|
const res = await this.dialogService.open<string[]>({
|
|
183
|
-
message:
|
|
193
|
+
message: (
|
|
194
|
+
<FileDialog
|
|
195
|
+
key={this.idx++}
|
|
196
|
+
fileService={fileTreeDialogService}
|
|
197
|
+
model={model}
|
|
198
|
+
options={options}
|
|
199
|
+
isOpenDialog={false}
|
|
200
|
+
/>
|
|
201
|
+
),
|
|
184
202
|
type: MessageType.Empty,
|
|
185
203
|
buttons: [],
|
|
186
204
|
closable: true,
|