@theia/filesystem 1.48.1 → 1.48.2
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/README.md +30 -30
- package/lib/browser/breadcrumbs/filepath-breadcrumb.d.ts +15 -15
- package/lib/browser/breadcrumbs/filepath-breadcrumb.js +41 -41
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.d.ts +13 -13
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.js +70 -70
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.d.ts +27 -27
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.js +118 -118
- package/lib/browser/download/file-download-command-contribution.d.ts +18 -18
- package/lib/browser/download/file-download-command-contribution.js +75 -75
- package/lib/browser/download/file-download-frontend-module.d.ts +3 -3
- package/lib/browser/download/file-download-frontend-module.js +25 -25
- package/lib/browser/download/file-download-service.d.ts +28 -28
- package/lib/browser/download/file-download-service.js +167 -167
- package/lib/browser/file-dialog/file-dialog-container.d.ts +5 -5
- package/lib/browser/file-dialog/file-dialog-container.js +60 -60
- package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.d.ts +15 -15
- package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.js +59 -59
- package/lib/browser/file-dialog/file-dialog-model.d.ts +25 -25
- package/lib/browser/file-dialog/file-dialog-model.js +100 -100
- package/lib/browser/file-dialog/file-dialog-module.d.ts +3 -3
- package/lib/browser/file-dialog/file-dialog-module.js +45 -45
- package/lib/browser/file-dialog/file-dialog-service.d.ts +32 -32
- package/lib/browser/file-dialog/file-dialog-service.js +101 -101
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.d.ts +39 -39
- package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.js +81 -81
- package/lib/browser/file-dialog/file-dialog-tree.d.ts +26 -26
- package/lib/browser/file-dialog/file-dialog-tree.js +83 -83
- package/lib/browser/file-dialog/file-dialog-widget.d.ts +15 -15
- package/lib/browser/file-dialog/file-dialog-widget.js +75 -75
- package/lib/browser/file-dialog/file-dialog.d.ts +129 -129
- package/lib/browser/file-dialog/file-dialog.js +351 -351
- package/lib/browser/file-dialog/index.d.ts +4 -4
- package/lib/browser/file-dialog/index.js +22 -22
- package/lib/browser/file-resource.d.ts +67 -67
- package/lib/browser/file-resource.js +369 -369
- package/lib/browser/file-selection.d.ts +14 -14
- package/lib/browser/file-selection.js +36 -36
- package/lib/browser/file-service.d.ts +425 -425
- package/lib/browser/file-service.js +1366 -1366
- package/lib/browser/file-tree/file-tree-container.d.ts +3 -3
- package/lib/browser/file-tree/file-tree-container.js +35 -35
- package/lib/browser/file-tree/file-tree-decorator-adapter.d.ts +30 -30
- package/lib/browser/file-tree/file-tree-decorator-adapter.js +169 -169
- package/lib/browser/file-tree/file-tree-label-provider.d.ts +12 -12
- package/lib/browser/file-tree/file-tree-label-provider.js +54 -54
- package/lib/browser/file-tree/file-tree-model.d.ts +37 -37
- package/lib/browser/file-tree/file-tree-model.js +217 -217
- package/lib/browser/file-tree/file-tree-widget.d.ts +44 -44
- package/lib/browser/file-tree/file-tree-widget.js +317 -317
- package/lib/browser/file-tree/file-tree.d.ts +46 -46
- package/lib/browser/file-tree/file-tree.js +176 -176
- package/lib/browser/file-tree/index.d.ts +6 -6
- package/lib/browser/file-tree/index.js +24 -24
- package/lib/browser/file-upload-service.d.ts +109 -109
- package/lib/browser/file-upload-service.js +434 -434
- package/lib/browser/filesystem-frontend-contribution.d.ts +74 -74
- package/lib/browser/filesystem-frontend-contribution.js +356 -356
- package/lib/browser/filesystem-frontend-module.d.ts +5 -5
- package/lib/browser/filesystem-frontend-module.js +64 -64
- package/lib/browser/filesystem-preferences.d.ts +29 -29
- package/lib/browser/filesystem-preferences.js +110 -110
- package/lib/browser/filesystem-save-resource-service.d.ts +29 -29
- package/lib/browser/filesystem-save-resource-service.js +135 -135
- package/lib/browser/filesystem-watcher-error-handler.d.ts +10 -10
- package/lib/browser/filesystem-watcher-error-handler.js +61 -61
- package/lib/browser/index.d.ts +5 -5
- package/lib/browser/index.js +23 -23
- package/lib/browser/location/index.d.ts +2 -2
- package/lib/browser/location/index.js +20 -20
- package/lib/browser/location/location-renderer.d.ts +100 -100
- package/lib/browser/location/location-renderer.js +343 -343
- package/lib/browser/location/location-service.d.ts +5 -5
- package/lib/browser/location/location-service.js +17 -17
- package/lib/browser/remote-file-service-contribution.d.ts +6 -6
- package/lib/browser/remote-file-service-contribution.js +39 -39
- package/lib/browser-only/browser-only-filesystem-frontend-module.d.ts +3 -3
- package/lib/browser-only/browser-only-filesystem-frontend-module.js +40 -40
- package/lib/browser-only/browser-only-filesystem-provider-server.d.ts +11 -11
- package/lib/browser-only/browser-only-filesystem-provider-server.js +39 -39
- package/lib/browser-only/browserfs-filesystem-initialization.d.ts +12 -12
- package/lib/browser-only/browserfs-filesystem-initialization.js +54 -54
- package/lib/browser-only/browserfs-filesystem-provider.d.ts +45 -45
- package/lib/browser-only/browserfs-filesystem-provider.js +439 -439
- package/lib/common/delegating-file-system-provider.d.ts +76 -76
- package/lib/common/delegating-file-system-provider.js +168 -168
- package/lib/common/download/file-download-data.d.ts +6 -6
- package/lib/common/download/file-download-data.js +26 -26
- package/lib/common/file-upload.d.ts +1 -1
- package/lib/common/file-upload.js +19 -19
- package/lib/common/files.d.ts +659 -659
- package/lib/common/files.js +355 -355
- package/lib/common/files.spec.d.ts +1 -1
- package/lib/common/files.spec.js +51 -51
- package/lib/common/filesystem-utils.d.ts +14 -14
- package/lib/common/filesystem-utils.js +63 -63
- package/lib/common/filesystem-utils.spec.d.ts +1 -1
- package/lib/common/filesystem-utils.spec.js +378 -378
- package/lib/common/filesystem-watcher-protocol.d.ts +71 -71
- package/lib/common/filesystem-watcher-protocol.js +20 -20
- package/lib/common/filesystem.d.ts +22 -22
- package/lib/common/filesystem.js +42 -42
- package/lib/common/index.d.ts +2 -2
- package/lib/common/index.js +20 -20
- package/lib/common/io.d.ts +19 -19
- package/lib/common/io.js +110 -110
- package/lib/common/remote-file-system-provider.d.ts +173 -173
- package/lib/common/remote-file-system-provider.js +435 -435
- package/lib/electron-browser/file-dialog/electron-file-dialog-module.d.ts +3 -3
- package/lib/electron-browser/file-dialog/electron-file-dialog-module.js +24 -24
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.d.ts +19 -19
- package/lib/electron-browser/file-dialog/electron-file-dialog-service.js +148 -148
- package/lib/electron-browser/preload.d.ts +1 -1
- package/lib/electron-browser/preload.js +30 -30
- package/lib/electron-common/electron-api.d.ts +34 -34
- package/lib/electron-common/electron-api.js +20 -20
- package/lib/electron-main/electron-api-main.d.ts +5 -5
- package/lib/electron-main/electron-api-main.js +73 -73
- package/lib/electron-main/electron-main-module.d.ts +3 -3
- package/lib/electron-main/electron-main-module.js +24 -24
- package/lib/node/disk-file-system-provider.d.ts +72 -72
- package/lib/node/disk-file-system-provider.js +787 -787
- package/lib/node/disk-file-system-provider.spec.d.ts +1 -1
- package/lib/node/disk-file-system-provider.spec.js +122 -122
- package/lib/node/download/directory-archiver.d.ts +9 -9
- package/lib/node/download/directory-archiver.js +127 -127
- package/lib/node/download/directory-archiver.spec.d.ts +1 -1
- package/lib/node/download/directory-archiver.spec.js +97 -97
- package/lib/node/download/file-download-backend-module.d.ts +3 -3
- package/lib/node/download/file-download-backend-module.js +32 -32
- package/lib/node/download/file-download-cache.d.ts +21 -21
- package/lib/node/download/file-download-cache.js +82 -82
- package/lib/node/download/file-download-endpoint.d.ts +11 -11
- package/lib/node/download/file-download-endpoint.js +67 -67
- package/lib/node/download/file-download-handler.d.ts +50 -50
- package/lib/node/download/file-download-handler.js +307 -307
- package/lib/node/download/test/mock-directory-archiver.d.ts +7 -7
- package/lib/node/download/test/mock-directory-archiver.js +29 -29
- package/lib/node/file-change-collection.d.ts +22 -22
- package/lib/node/file-change-collection.js +77 -77
- package/lib/node/file-change-collection.spec.d.ts +1 -1
- package/lib/node/file-change-collection.spec.js +90 -90
- package/lib/node/filesystem-backend-module.d.ts +26 -26
- package/lib/node/filesystem-backend-module.js +120 -120
- package/lib/node/filesystem-watcher-client.d.ts +23 -23
- package/lib/node/filesystem-watcher-client.js +75 -75
- package/lib/node/filesystem-watcher-dispatcher.d.ts +23 -23
- package/lib/node/filesystem-watcher-dispatcher.js +80 -80
- package/lib/node/node-file-upload-service.d.ts +16 -16
- package/lib/node/node-file-upload-service.js +79 -79
- package/lib/node/nsfw-watcher/index.d.ts +3 -3
- package/lib/node/nsfw-watcher/index.js +39 -39
- package/lib/node/nsfw-watcher/nsfw-filesystem-service.d.ts +191 -191
- package/lib/node/nsfw-watcher/nsfw-filesystem-service.js +405 -405
- package/lib/node/nsfw-watcher/nsfw-filesystem-watcher.spec.d.ts +1 -1
- package/lib/node/nsfw-watcher/nsfw-filesystem-watcher.spec.js +151 -151
- package/lib/node/nsfw-watcher/nsfw-options.d.ts +6 -6
- package/lib/node/nsfw-watcher/nsfw-options.js +22 -22
- package/package.json +4 -4
- package/src/browser/breadcrumbs/filepath-breadcrumb.ts +43 -43
- package/src/browser/breadcrumbs/filepath-breadcrumbs-container.ts +65 -65
- package/src/browser/breadcrumbs/filepath-breadcrumbs-contribution.ts +129 -129
- package/src/browser/download/file-download-command-contribution.ts +83 -83
- package/src/browser/download/file-download-frontend-module.ts +25 -25
- package/src/browser/download/file-download-service.ts +179 -179
- package/src/browser/file-dialog/file-dialog-container.ts +67 -67
- package/src/browser/file-dialog/file-dialog-hidden-files-renderer.tsx +59 -59
- package/src/browser/file-dialog/file-dialog-model.ts +96 -96
- package/src/browser/file-dialog/file-dialog-module.ts +44 -44
- package/src/browser/file-dialog/file-dialog-service.ts +99 -99
- package/src/browser/file-dialog/file-dialog-tree-filters-renderer.tsx +100 -100
- package/src/browser/file-dialog/file-dialog-tree.ts +89 -89
- package/src/browser/file-dialog/file-dialog-widget.ts +75 -75
- package/src/browser/file-dialog/file-dialog.ts +434 -434
- package/src/browser/file-dialog/index.ts +20 -20
- package/src/browser/file-resource.ts +390 -390
- package/src/browser/file-selection.ts +44 -44
- package/src/browser/file-service.ts +1841 -1841
- package/src/browser/file-tree/file-tree-container.ts +36 -36
- package/src/browser/file-tree/file-tree-decorator-adapter.ts +159 -159
- package/src/browser/file-tree/file-tree-label-provider.ts +53 -53
- package/src/browser/file-tree/file-tree-model.ts +212 -212
- package/src/browser/file-tree/file-tree-widget.tsx +327 -327
- package/src/browser/file-tree/file-tree.ts +183 -183
- package/src/browser/file-tree/index.ts +22 -22
- package/src/browser/file-upload-service.ts +539 -539
- package/src/browser/filesystem-frontend-contribution.ts +381 -381
- package/src/browser/filesystem-frontend-module.ts +77 -77
- package/src/browser/filesystem-preferences.ts +139 -139
- package/src/browser/filesystem-save-resource-service.ts +125 -125
- package/src/browser/filesystem-watcher-error-handler.ts +60 -60
- package/src/browser/index.ts +21 -21
- package/src/browser/location/index.ts +18 -18
- package/src/browser/location/location-renderer.tsx +404 -404
- package/src/browser/location/location-service.ts +22 -22
- package/src/browser/remote-file-service-contribution.ts +38 -38
- package/src/browser/style/file-dialog.css +208 -208
- package/src/browser/style/file-icons.css +64 -64
- package/src/browser/style/filepath-breadcrumbs.css +20 -20
- package/src/browser/style/index.css +36 -36
- package/src/browser-only/browser-only-filesystem-frontend-module.ts +38 -38
- package/src/browser-only/browser-only-filesystem-provider-server.ts +32 -32
- package/src/browser-only/browserfs-filesystem-initialization.ts +61 -61
- package/src/browser-only/browserfs-filesystem-provider.ts +462 -462
- package/src/common/delegating-file-system-provider.ts +226 -226
- package/src/common/download/README.md +30 -30
- package/src/common/download/file-download-data.ts +27 -27
- package/src/common/file-upload.ts +17 -17
- package/src/common/files.spec.ts +51 -51
- package/src/common/files.ts +996 -996
- package/src/common/filesystem-utils.spec.ts +411 -411
- package/src/common/filesystem-utils.ts +64 -64
- package/src/common/filesystem-watcher-protocol.ts +96 -96
- package/src/common/filesystem.ts +43 -43
- package/src/common/index.ts +18 -18
- package/src/common/io.ts +150 -150
- package/src/common/remote-file-system-provider.ts +549 -549
- package/src/electron-browser/file-dialog/electron-file-dialog-module.ts +24 -24
- package/src/electron-browser/file-dialog/electron-file-dialog-service.ts +165 -165
- package/src/electron-browser/preload.ts +31 -31
- package/src/electron-common/electron-api.ts +55 -55
- package/src/electron-main/electron-api-main.ts +78 -78
- package/src/electron-main/electron-main-module.ts +23 -23
- package/src/node/disk-file-system-provider.spec.ts +142 -142
- package/src/node/disk-file-system-provider.ts +915 -915
- package/src/node/download/directory-archiver.spec.ts +104 -104
- package/src/node/download/directory-archiver.ts +126 -126
- package/src/node/download/file-download-backend-module.ts +32 -32
- package/src/node/download/file-download-cache.ts +88 -88
- package/src/node/download/file-download-endpoint.ts +63 -63
- package/src/node/download/file-download-handler.ts +304 -304
- package/src/node/download/test/mock-directory-archiver.ts +30 -30
- package/src/node/file-change-collection.spec.ts +110 -110
- package/src/node/file-change-collection.ts +78 -78
- package/src/node/filesystem-backend-module.ts +140 -140
- package/src/node/filesystem-watcher-client.ts +72 -72
- package/src/node/filesystem-watcher-dispatcher.ts +82 -82
- package/src/node/node-file-upload-service.ts +80 -80
- package/src/node/nsfw-watcher/index.ts +45 -45
- package/src/node/nsfw-watcher/nsfw-filesystem-service.ts +481 -481
- package/src/node/nsfw-watcher/nsfw-filesystem-watcher.spec.ts +182 -182
- package/src/node/nsfw-watcher/nsfw-options.ts +23 -23
- package/src/typings/dom.webkit.d.ts +77 -77
- package/src/typings/mv/index.d.ts +21 -21
- package/src/typings/nsfw/index.d.ts +18 -18
- package/src/typings/trash/index.d.ts +20 -20
|
@@ -1,352 +1,352 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.SaveFileDialog = exports.OpenFileDialog = exports.FileDialog = exports.SaveFileDialogProps = exports.OpenFileDialogProps = exports.FileDialogProps = exports.TOOLBAR_ITEM_TRANSFORM_TIMEOUT = exports.CONTROL_PANEL_CLASS = exports.FILENAME_TEXTFIELD_CLASS = exports.FILENAME_LABEL_CLASS = exports.FILENAME_PANEL_CLASS = exports.FILTERS_LIST_PANEL_CLASS = exports.FILTERS_LABEL_CLASS = exports.FILTERS_PANEL_CLASS = exports.NAVIGATION_LOCATION_LIST_PANEL_CLASS = exports.NAVIGATION_UP_CLASS = exports.NAVIGATION_HOME_CLASS = exports.NAVIGATION_FORWARD_CLASS = exports.NAVIGATION_BACK_CLASS = exports.NAVIGATION_PANEL_CLASS = exports.SAVE_DIALOG_CLASS = exports.SaveFileDialogFactory = exports.OpenFileDialogFactory = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
-
const common_1 = require("@theia/core/lib/common");
|
|
22
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
23
|
-
const location_1 = require("../location");
|
|
24
|
-
const file_dialog_widget_1 = require("./file-dialog-widget");
|
|
25
|
-
const file_dialog_tree_filters_renderer_1 = require("./file-dialog-tree-filters-renderer");
|
|
26
|
-
const widgets_1 = require("@theia/core/shared/@phosphor/widgets");
|
|
27
|
-
const DOMPurify = require("@theia/core/shared/dompurify");
|
|
28
|
-
const file_dialog_hidden_files_renderer_1 = require("./file-dialog-hidden-files-renderer");
|
|
29
|
-
exports.OpenFileDialogFactory = Symbol('OpenFileDialogFactory');
|
|
30
|
-
exports.SaveFileDialogFactory = Symbol('SaveFileDialogFactory');
|
|
31
|
-
exports.SAVE_DIALOG_CLASS = 'theia-SaveFileDialog';
|
|
32
|
-
exports.NAVIGATION_PANEL_CLASS = 'theia-NavigationPanel';
|
|
33
|
-
exports.NAVIGATION_BACK_CLASS = 'theia-NavigationBack';
|
|
34
|
-
exports.NAVIGATION_FORWARD_CLASS = 'theia-NavigationForward';
|
|
35
|
-
exports.NAVIGATION_HOME_CLASS = 'theia-NavigationHome';
|
|
36
|
-
exports.NAVIGATION_UP_CLASS = 'theia-NavigationUp';
|
|
37
|
-
exports.NAVIGATION_LOCATION_LIST_PANEL_CLASS = 'theia-LocationListPanel';
|
|
38
|
-
exports.FILTERS_PANEL_CLASS = 'theia-FiltersPanel';
|
|
39
|
-
exports.FILTERS_LABEL_CLASS = 'theia-FiltersLabel';
|
|
40
|
-
exports.FILTERS_LIST_PANEL_CLASS = 'theia-FiltersListPanel';
|
|
41
|
-
exports.FILENAME_PANEL_CLASS = 'theia-FileNamePanel';
|
|
42
|
-
exports.FILENAME_LABEL_CLASS = 'theia-FileNameLabel';
|
|
43
|
-
exports.FILENAME_TEXTFIELD_CLASS = 'theia-FileNameTextField';
|
|
44
|
-
exports.CONTROL_PANEL_CLASS = 'theia-ControlPanel';
|
|
45
|
-
exports.TOOLBAR_ITEM_TRANSFORM_TIMEOUT = 100;
|
|
46
|
-
class FileDialogProps extends browser_1.DialogProps {
|
|
47
|
-
}
|
|
48
|
-
exports.FileDialogProps = FileDialogProps;
|
|
49
|
-
let OpenFileDialogProps = class OpenFileDialogProps extends FileDialogProps {
|
|
50
|
-
};
|
|
51
|
-
OpenFileDialogProps = (0, tslib_1.__decorate)([
|
|
52
|
-
(0, inversify_1.injectable)()
|
|
53
|
-
], OpenFileDialogProps);
|
|
54
|
-
exports.OpenFileDialogProps = OpenFileDialogProps;
|
|
55
|
-
let SaveFileDialogProps = class SaveFileDialogProps extends FileDialogProps {
|
|
56
|
-
};
|
|
57
|
-
SaveFileDialogProps = (0, tslib_1.__decorate)([
|
|
58
|
-
(0, inversify_1.injectable)()
|
|
59
|
-
], SaveFileDialogProps);
|
|
60
|
-
exports.SaveFileDialogProps = SaveFileDialogProps;
|
|
61
|
-
let FileDialog = class FileDialog extends browser_1.AbstractDialog {
|
|
62
|
-
constructor(props) {
|
|
63
|
-
super(props);
|
|
64
|
-
this.props = props;
|
|
65
|
-
}
|
|
66
|
-
init() {
|
|
67
|
-
this.treePanel = new widgets_1.Panel();
|
|
68
|
-
this.treePanel.addWidget(this.widget);
|
|
69
|
-
this.toDispose.push(this.treePanel);
|
|
70
|
-
this.toDispose.push(this.model.onChanged(() => this.update()));
|
|
71
|
-
this.toDispose.push(this.model.onDidOpenFile(() => this.accept()));
|
|
72
|
-
this.toDispose.push(this.model.onSelectionChanged(() => this.update()));
|
|
73
|
-
const navigationPanel = document.createElement('div');
|
|
74
|
-
navigationPanel.classList.add(exports.NAVIGATION_PANEL_CLASS);
|
|
75
|
-
this.contentNode.appendChild(navigationPanel);
|
|
76
|
-
navigationPanel.appendChild(this.back = (0, browser_1.createIconButton)(...(0, browser_1.codiconArray)('chevron-left', true)));
|
|
77
|
-
this.back.classList.add(exports.NAVIGATION_BACK_CLASS);
|
|
78
|
-
this.back.title = common_1.nls.localize('theia/filesystem/dialog/navigateBack', 'Navigate Back');
|
|
79
|
-
navigationPanel.appendChild(this.forward = (0, browser_1.createIconButton)(...(0, browser_1.codiconArray)('chevron-right', true)));
|
|
80
|
-
this.forward.classList.add(exports.NAVIGATION_FORWARD_CLASS);
|
|
81
|
-
this.forward.title = common_1.nls.localize('theia/filesystem/dialog/navigateForward', 'Navigate Forward');
|
|
82
|
-
navigationPanel.appendChild(this.home = (0, browser_1.createIconButton)(...(0, browser_1.codiconArray)('home', true)));
|
|
83
|
-
this.home.classList.add(exports.NAVIGATION_HOME_CLASS);
|
|
84
|
-
this.home.title = common_1.nls.localize('theia/filesystem/dialog/initialLocation', 'Go To Initial Location');
|
|
85
|
-
navigationPanel.appendChild(this.up = (0, browser_1.createIconButton)(...(0, browser_1.codiconArray)('arrow-up', true)));
|
|
86
|
-
this.up.classList.add(exports.NAVIGATION_UP_CLASS);
|
|
87
|
-
this.up.title = common_1.nls.localize('theia/filesystem/dialog/navigateUp', 'Navigate Up One Directory');
|
|
88
|
-
const locationListRendererHost = document.createElement('div');
|
|
89
|
-
this.locationListRenderer = this.locationListFactory({ model: this.model, host: locationListRendererHost });
|
|
90
|
-
this.toDispose.push(this.locationListRenderer);
|
|
91
|
-
this.locationListRenderer.host.classList.add(exports.NAVIGATION_LOCATION_LIST_PANEL_CLASS);
|
|
92
|
-
navigationPanel.appendChild(this.locationListRenderer.host);
|
|
93
|
-
this.hiddenFilesToggleRenderer = this.hiddenFilesToggleFactory(this.widget.model.tree);
|
|
94
|
-
this.contentNode.appendChild(this.hiddenFilesToggleRenderer.host);
|
|
95
|
-
if (this.props.filters) {
|
|
96
|
-
this.treeFiltersRenderer = this.treeFiltersFactory({ suppliedFilters: this.props.filters, fileDialogTree: this.widget.model.tree });
|
|
97
|
-
const filters = Object.keys(this.props.filters);
|
|
98
|
-
if (filters.length) {
|
|
99
|
-
this.widget.model.tree.setFilter(this.props.filters[filters[0]]);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
get model() {
|
|
104
|
-
return this.widget.model;
|
|
105
|
-
}
|
|
106
|
-
onUpdateRequest(msg) {
|
|
107
|
-
super.onUpdateRequest(msg);
|
|
108
|
-
(0, browser_1.setEnabled)(this.back, this.model.canNavigateBackward());
|
|
109
|
-
(0, browser_1.setEnabled)(this.forward, this.model.canNavigateForward());
|
|
110
|
-
(0, browser_1.setEnabled)(this.home, !!this.model.initialLocation
|
|
111
|
-
&& !!this.model.location
|
|
112
|
-
&& this.model.initialLocation.toString() !== this.model.location.toString());
|
|
113
|
-
(0, browser_1.setEnabled)(this.up, this.model.canNavigateUpward());
|
|
114
|
-
this.locationListRenderer.render();
|
|
115
|
-
if (this.treeFiltersRenderer) {
|
|
116
|
-
this.treeFiltersRenderer.render();
|
|
117
|
-
}
|
|
118
|
-
this.widget.update();
|
|
119
|
-
}
|
|
120
|
-
handleEnter(event) {
|
|
121
|
-
if (event.target instanceof HTMLTextAreaElement || this.targetIsDirectoryInput(event.target) || this.targetIsInputToggle(event.target)) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
this.accept();
|
|
125
|
-
}
|
|
126
|
-
handleEscape(event) {
|
|
127
|
-
if (event.target instanceof HTMLTextAreaElement || this.targetIsDirectoryInput(event.target)) {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
this.close();
|
|
131
|
-
}
|
|
132
|
-
targetIsDirectoryInput(target) {
|
|
133
|
-
return target instanceof HTMLInputElement && target.classList.contains(location_1.LocationListRenderer.Styles.LOCATION_TEXT_INPUT_CLASS);
|
|
134
|
-
}
|
|
135
|
-
targetIsInputToggle(target) {
|
|
136
|
-
return target instanceof HTMLSpanElement && target.classList.contains(location_1.LocationListRenderer.Styles.LOCATION_INPUT_TOGGLE_CLASS);
|
|
137
|
-
}
|
|
138
|
-
appendFiltersPanel() {
|
|
139
|
-
if (this.treeFiltersRenderer) {
|
|
140
|
-
const filtersPanel = document.createElement('div');
|
|
141
|
-
filtersPanel.classList.add(exports.FILTERS_PANEL_CLASS);
|
|
142
|
-
this.contentNode.appendChild(filtersPanel);
|
|
143
|
-
const titlePanel = document.createElement('div');
|
|
144
|
-
titlePanel.innerHTML = DOMPurify.sanitize(common_1.nls.localize('theia/filesystem/format', 'Format:'));
|
|
145
|
-
titlePanel.classList.add(exports.FILTERS_LABEL_CLASS);
|
|
146
|
-
filtersPanel.appendChild(titlePanel);
|
|
147
|
-
this.treeFiltersRenderer.host.classList.add(exports.FILTERS_LIST_PANEL_CLASS);
|
|
148
|
-
filtersPanel.appendChild(this.treeFiltersRenderer.host);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
onAfterAttach(msg) {
|
|
152
|
-
browser_1.Widget.attach(this.treePanel, this.contentNode);
|
|
153
|
-
this.toDisposeOnDetach.push(common_1.Disposable.create(() => {
|
|
154
|
-
browser_1.Widget.detach(this.treePanel);
|
|
155
|
-
this.locationListRenderer.dispose();
|
|
156
|
-
if (this.treeFiltersRenderer) {
|
|
157
|
-
this.treeFiltersRenderer.dispose();
|
|
158
|
-
}
|
|
159
|
-
}));
|
|
160
|
-
this.appendFiltersPanel();
|
|
161
|
-
this.appendCloseButton(common_1.nls.localizeByDefault('Cancel'));
|
|
162
|
-
this.appendAcceptButton(this.getAcceptButtonLabel());
|
|
163
|
-
this.addKeyListener(this.back, browser_1.Key.ENTER, () => {
|
|
164
|
-
this.addTransformEffectToIcon(this.back);
|
|
165
|
-
this.model.navigateBackward();
|
|
166
|
-
}, 'click');
|
|
167
|
-
this.addKeyListener(this.forward, browser_1.Key.ENTER, () => {
|
|
168
|
-
this.addTransformEffectToIcon(this.forward);
|
|
169
|
-
this.model.navigateForward();
|
|
170
|
-
}, 'click');
|
|
171
|
-
this.addKeyListener(this.home, browser_1.Key.ENTER, () => {
|
|
172
|
-
this.addTransformEffectToIcon(this.home);
|
|
173
|
-
if (this.model.initialLocation) {
|
|
174
|
-
this.model.location = this.model.initialLocation;
|
|
175
|
-
}
|
|
176
|
-
}, 'click');
|
|
177
|
-
this.addKeyListener(this.up, browser_1.Key.ENTER, () => {
|
|
178
|
-
this.addTransformEffectToIcon(this.up);
|
|
179
|
-
if (this.model.location) {
|
|
180
|
-
this.model.location = this.model.location.parent;
|
|
181
|
-
}
|
|
182
|
-
}, 'click');
|
|
183
|
-
super.onAfterAttach(msg);
|
|
184
|
-
}
|
|
185
|
-
addTransformEffectToIcon(element) {
|
|
186
|
-
const icon = element.getElementsByTagName('i')[0];
|
|
187
|
-
icon.classList.add('active');
|
|
188
|
-
setTimeout(() => icon.classList.remove('active'), exports.TOOLBAR_ITEM_TRANSFORM_TIMEOUT);
|
|
189
|
-
}
|
|
190
|
-
onActivateRequest(msg) {
|
|
191
|
-
this.widget.activate();
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
(0, tslib_1.__decorate)([
|
|
195
|
-
(0, inversify_1.inject)(file_dialog_widget_1.FileDialogWidget),
|
|
196
|
-
(0, tslib_1.__metadata)("design:type", file_dialog_widget_1.FileDialogWidget)
|
|
197
|
-
], FileDialog.prototype, "widget", void 0);
|
|
198
|
-
(0, tslib_1.__decorate)([
|
|
199
|
-
(0, inversify_1.inject)(location_1.LocationListRendererFactory),
|
|
200
|
-
(0, tslib_1.__metadata)("design:type", Function)
|
|
201
|
-
], FileDialog.prototype, "locationListFactory", void 0);
|
|
202
|
-
(0, tslib_1.__decorate)([
|
|
203
|
-
(0, inversify_1.inject)(file_dialog_tree_filters_renderer_1.FileDialogTreeFiltersRendererFactory),
|
|
204
|
-
(0, tslib_1.__metadata)("design:type", Function)
|
|
205
|
-
], FileDialog.prototype, "treeFiltersFactory", void 0);
|
|
206
|
-
(0, tslib_1.__decorate)([
|
|
207
|
-
(0, inversify_1.inject)(file_dialog_hidden_files_renderer_1.HiddenFilesToggleRendererFactory),
|
|
208
|
-
(0, tslib_1.__metadata)("design:type", Function)
|
|
209
|
-
], FileDialog.prototype, "hiddenFilesToggleFactory", void 0);
|
|
210
|
-
(0, tslib_1.__decorate)([
|
|
211
|
-
(0, inversify_1.postConstruct)(),
|
|
212
|
-
(0, tslib_1.__metadata)("design:type", Function),
|
|
213
|
-
(0, tslib_1.__metadata)("design:paramtypes", []),
|
|
214
|
-
(0, tslib_1.__metadata)("design:returntype", void 0)
|
|
215
|
-
], FileDialog.prototype, "init", null);
|
|
216
|
-
FileDialog = (0, tslib_1.__decorate)([
|
|
217
|
-
(0, tslib_1.__param)(0, (0, inversify_1.inject)(FileDialogProps)),
|
|
218
|
-
(0, tslib_1.__metadata)("design:paramtypes", [FileDialogProps])
|
|
219
|
-
], FileDialog);
|
|
220
|
-
exports.FileDialog = FileDialog;
|
|
221
|
-
let OpenFileDialog = class OpenFileDialog extends FileDialog {
|
|
222
|
-
constructor(props) {
|
|
223
|
-
super(props);
|
|
224
|
-
this.props = props;
|
|
225
|
-
}
|
|
226
|
-
init() {
|
|
227
|
-
super.init();
|
|
228
|
-
const { props } = this;
|
|
229
|
-
if (props.canSelectFiles !== undefined) {
|
|
230
|
-
this.widget.disableFileSelection = !props.canSelectFiles;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
getAcceptButtonLabel() {
|
|
234
|
-
return this.props.openLabel ? this.props.openLabel : common_1.nls.localizeByDefault('Open');
|
|
235
|
-
}
|
|
236
|
-
isValid(value) {
|
|
237
|
-
if (value && !this.props.canSelectMany && value instanceof Array) {
|
|
238
|
-
return common_1.nls.localize('theia/filesystem/dialog/multipleItemMessage', 'You can select only one item');
|
|
239
|
-
}
|
|
240
|
-
return '';
|
|
241
|
-
}
|
|
242
|
-
get value() {
|
|
243
|
-
if (this.widget.model.selectedFileStatNodes.length === 1) {
|
|
244
|
-
return this.widget.model.selectedFileStatNodes[0];
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
return this.widget.model.selectedFileStatNodes;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
async accept() {
|
|
251
|
-
const selection = this.value;
|
|
252
|
-
if (!this.props.canSelectFolders
|
|
253
|
-
&& !Array.isArray(selection)
|
|
254
|
-
&& selection.fileStat.isDirectory) {
|
|
255
|
-
this.widget.model.openNode(selection);
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
super.accept();
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
(0, tslib_1.__decorate)([
|
|
262
|
-
(0, inversify_1.postConstruct)(),
|
|
263
|
-
(0, tslib_1.__metadata)("design:type", Function),
|
|
264
|
-
(0, tslib_1.__metadata)("design:paramtypes", []),
|
|
265
|
-
(0, tslib_1.__metadata)("design:returntype", void 0)
|
|
266
|
-
], OpenFileDialog.prototype, "init", null);
|
|
267
|
-
OpenFileDialog = (0, tslib_1.__decorate)([
|
|
268
|
-
(0, inversify_1.injectable)(),
|
|
269
|
-
(0, tslib_1.__param)(0, (0, inversify_1.inject)(OpenFileDialogProps)),
|
|
270
|
-
(0, tslib_1.__metadata)("design:paramtypes", [OpenFileDialogProps])
|
|
271
|
-
], OpenFileDialog);
|
|
272
|
-
exports.OpenFileDialog = OpenFileDialog;
|
|
273
|
-
let SaveFileDialog = class SaveFileDialog extends FileDialog {
|
|
274
|
-
constructor(props) {
|
|
275
|
-
super(props);
|
|
276
|
-
this.props = props;
|
|
277
|
-
}
|
|
278
|
-
init() {
|
|
279
|
-
super.init();
|
|
280
|
-
const { widget } = this;
|
|
281
|
-
widget.addClass(exports.SAVE_DIALOG_CLASS);
|
|
282
|
-
}
|
|
283
|
-
getAcceptButtonLabel() {
|
|
284
|
-
return this.props.saveLabel ? this.props.saveLabel : common_1.nls.localizeByDefault('Save');
|
|
285
|
-
}
|
|
286
|
-
onUpdateRequest(msg) {
|
|
287
|
-
// Update file name field when changing a selection
|
|
288
|
-
if (this.fileNameField) {
|
|
289
|
-
if (this.widget.model.selectedFileStatNodes.length === 1) {
|
|
290
|
-
const node = this.widget.model.selectedFileStatNodes[0];
|
|
291
|
-
if (!node.fileStat.isDirectory) {
|
|
292
|
-
this.fileNameField.value = this.labelProvider.getName(node);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
this.fileNameField.value = '';
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
// Continue updating the dialog
|
|
300
|
-
super.onUpdateRequest(msg);
|
|
301
|
-
}
|
|
302
|
-
isValid(value) {
|
|
303
|
-
if (this.fileNameField && this.fileNameField.value) {
|
|
304
|
-
return '';
|
|
305
|
-
}
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
get value() {
|
|
309
|
-
if (this.fileNameField && this.widget.model.selectedFileStatNodes.length === 1) {
|
|
310
|
-
const node = this.widget.model.selectedFileStatNodes[0];
|
|
311
|
-
if (node.fileStat.isDirectory) {
|
|
312
|
-
return node.uri.resolve(this.fileNameField.value);
|
|
313
|
-
}
|
|
314
|
-
return node.uri.parent.resolve(this.fileNameField.value);
|
|
315
|
-
}
|
|
316
|
-
return undefined;
|
|
317
|
-
}
|
|
318
|
-
onAfterAttach(msg) {
|
|
319
|
-
super.onAfterAttach(msg);
|
|
320
|
-
const fileNamePanel = document.createElement('div');
|
|
321
|
-
fileNamePanel.classList.add(exports.FILENAME_PANEL_CLASS);
|
|
322
|
-
this.contentNode.appendChild(fileNamePanel);
|
|
323
|
-
const titlePanel = document.createElement('div');
|
|
324
|
-
titlePanel.innerHTML = DOMPurify.sanitize(common_1.nls.localize('theia/filesystem/dialog/name', 'Name:'));
|
|
325
|
-
titlePanel.classList.add(exports.FILENAME_LABEL_CLASS);
|
|
326
|
-
fileNamePanel.appendChild(titlePanel);
|
|
327
|
-
this.fileNameField = document.createElement('input');
|
|
328
|
-
this.fileNameField.type = 'text';
|
|
329
|
-
this.fileNameField.spellcheck = false;
|
|
330
|
-
this.fileNameField.classList.add('theia-input', exports.FILENAME_TEXTFIELD_CLASS);
|
|
331
|
-
this.fileNameField.value = this.props.inputValue || '';
|
|
332
|
-
fileNamePanel.appendChild(this.fileNameField);
|
|
333
|
-
this.fileNameField.onkeyup = () => this.validate();
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
(0, tslib_1.__decorate)([
|
|
337
|
-
(0, inversify_1.inject)(browser_1.LabelProvider),
|
|
338
|
-
(0, tslib_1.__metadata)("design:type", browser_1.LabelProvider)
|
|
339
|
-
], SaveFileDialog.prototype, "labelProvider", void 0);
|
|
340
|
-
(0, tslib_1.__decorate)([
|
|
341
|
-
(0, inversify_1.postConstruct)(),
|
|
342
|
-
(0, tslib_1.__metadata)("design:type", Function),
|
|
343
|
-
(0, tslib_1.__metadata)("design:paramtypes", []),
|
|
344
|
-
(0, tslib_1.__metadata)("design:returntype", void 0)
|
|
345
|
-
], SaveFileDialog.prototype, "init", null);
|
|
346
|
-
SaveFileDialog = (0, tslib_1.__decorate)([
|
|
347
|
-
(0, inversify_1.injectable)(),
|
|
348
|
-
(0, tslib_1.__param)(0, (0, inversify_1.inject)(SaveFileDialogProps)),
|
|
349
|
-
(0, tslib_1.__metadata)("design:paramtypes", [SaveFileDialogProps])
|
|
350
|
-
], SaveFileDialog);
|
|
351
|
-
exports.SaveFileDialog = SaveFileDialog;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.SaveFileDialog = exports.OpenFileDialog = exports.FileDialog = exports.SaveFileDialogProps = exports.OpenFileDialogProps = exports.FileDialogProps = exports.TOOLBAR_ITEM_TRANSFORM_TIMEOUT = exports.CONTROL_PANEL_CLASS = exports.FILENAME_TEXTFIELD_CLASS = exports.FILENAME_LABEL_CLASS = exports.FILENAME_PANEL_CLASS = exports.FILTERS_LIST_PANEL_CLASS = exports.FILTERS_LABEL_CLASS = exports.FILTERS_PANEL_CLASS = exports.NAVIGATION_LOCATION_LIST_PANEL_CLASS = exports.NAVIGATION_UP_CLASS = exports.NAVIGATION_HOME_CLASS = exports.NAVIGATION_FORWARD_CLASS = exports.NAVIGATION_BACK_CLASS = exports.NAVIGATION_PANEL_CLASS = exports.SAVE_DIALOG_CLASS = exports.SaveFileDialogFactory = exports.OpenFileDialogFactory = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const common_1 = require("@theia/core/lib/common");
|
|
22
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
23
|
+
const location_1 = require("../location");
|
|
24
|
+
const file_dialog_widget_1 = require("./file-dialog-widget");
|
|
25
|
+
const file_dialog_tree_filters_renderer_1 = require("./file-dialog-tree-filters-renderer");
|
|
26
|
+
const widgets_1 = require("@theia/core/shared/@phosphor/widgets");
|
|
27
|
+
const DOMPurify = require("@theia/core/shared/dompurify");
|
|
28
|
+
const file_dialog_hidden_files_renderer_1 = require("./file-dialog-hidden-files-renderer");
|
|
29
|
+
exports.OpenFileDialogFactory = Symbol('OpenFileDialogFactory');
|
|
30
|
+
exports.SaveFileDialogFactory = Symbol('SaveFileDialogFactory');
|
|
31
|
+
exports.SAVE_DIALOG_CLASS = 'theia-SaveFileDialog';
|
|
32
|
+
exports.NAVIGATION_PANEL_CLASS = 'theia-NavigationPanel';
|
|
33
|
+
exports.NAVIGATION_BACK_CLASS = 'theia-NavigationBack';
|
|
34
|
+
exports.NAVIGATION_FORWARD_CLASS = 'theia-NavigationForward';
|
|
35
|
+
exports.NAVIGATION_HOME_CLASS = 'theia-NavigationHome';
|
|
36
|
+
exports.NAVIGATION_UP_CLASS = 'theia-NavigationUp';
|
|
37
|
+
exports.NAVIGATION_LOCATION_LIST_PANEL_CLASS = 'theia-LocationListPanel';
|
|
38
|
+
exports.FILTERS_PANEL_CLASS = 'theia-FiltersPanel';
|
|
39
|
+
exports.FILTERS_LABEL_CLASS = 'theia-FiltersLabel';
|
|
40
|
+
exports.FILTERS_LIST_PANEL_CLASS = 'theia-FiltersListPanel';
|
|
41
|
+
exports.FILENAME_PANEL_CLASS = 'theia-FileNamePanel';
|
|
42
|
+
exports.FILENAME_LABEL_CLASS = 'theia-FileNameLabel';
|
|
43
|
+
exports.FILENAME_TEXTFIELD_CLASS = 'theia-FileNameTextField';
|
|
44
|
+
exports.CONTROL_PANEL_CLASS = 'theia-ControlPanel';
|
|
45
|
+
exports.TOOLBAR_ITEM_TRANSFORM_TIMEOUT = 100;
|
|
46
|
+
class FileDialogProps extends browser_1.DialogProps {
|
|
47
|
+
}
|
|
48
|
+
exports.FileDialogProps = FileDialogProps;
|
|
49
|
+
let OpenFileDialogProps = class OpenFileDialogProps extends FileDialogProps {
|
|
50
|
+
};
|
|
51
|
+
OpenFileDialogProps = (0, tslib_1.__decorate)([
|
|
52
|
+
(0, inversify_1.injectable)()
|
|
53
|
+
], OpenFileDialogProps);
|
|
54
|
+
exports.OpenFileDialogProps = OpenFileDialogProps;
|
|
55
|
+
let SaveFileDialogProps = class SaveFileDialogProps extends FileDialogProps {
|
|
56
|
+
};
|
|
57
|
+
SaveFileDialogProps = (0, tslib_1.__decorate)([
|
|
58
|
+
(0, inversify_1.injectable)()
|
|
59
|
+
], SaveFileDialogProps);
|
|
60
|
+
exports.SaveFileDialogProps = SaveFileDialogProps;
|
|
61
|
+
let FileDialog = class FileDialog extends browser_1.AbstractDialog {
|
|
62
|
+
constructor(props) {
|
|
63
|
+
super(props);
|
|
64
|
+
this.props = props;
|
|
65
|
+
}
|
|
66
|
+
init() {
|
|
67
|
+
this.treePanel = new widgets_1.Panel();
|
|
68
|
+
this.treePanel.addWidget(this.widget);
|
|
69
|
+
this.toDispose.push(this.treePanel);
|
|
70
|
+
this.toDispose.push(this.model.onChanged(() => this.update()));
|
|
71
|
+
this.toDispose.push(this.model.onDidOpenFile(() => this.accept()));
|
|
72
|
+
this.toDispose.push(this.model.onSelectionChanged(() => this.update()));
|
|
73
|
+
const navigationPanel = document.createElement('div');
|
|
74
|
+
navigationPanel.classList.add(exports.NAVIGATION_PANEL_CLASS);
|
|
75
|
+
this.contentNode.appendChild(navigationPanel);
|
|
76
|
+
navigationPanel.appendChild(this.back = (0, browser_1.createIconButton)(...(0, browser_1.codiconArray)('chevron-left', true)));
|
|
77
|
+
this.back.classList.add(exports.NAVIGATION_BACK_CLASS);
|
|
78
|
+
this.back.title = common_1.nls.localize('theia/filesystem/dialog/navigateBack', 'Navigate Back');
|
|
79
|
+
navigationPanel.appendChild(this.forward = (0, browser_1.createIconButton)(...(0, browser_1.codiconArray)('chevron-right', true)));
|
|
80
|
+
this.forward.classList.add(exports.NAVIGATION_FORWARD_CLASS);
|
|
81
|
+
this.forward.title = common_1.nls.localize('theia/filesystem/dialog/navigateForward', 'Navigate Forward');
|
|
82
|
+
navigationPanel.appendChild(this.home = (0, browser_1.createIconButton)(...(0, browser_1.codiconArray)('home', true)));
|
|
83
|
+
this.home.classList.add(exports.NAVIGATION_HOME_CLASS);
|
|
84
|
+
this.home.title = common_1.nls.localize('theia/filesystem/dialog/initialLocation', 'Go To Initial Location');
|
|
85
|
+
navigationPanel.appendChild(this.up = (0, browser_1.createIconButton)(...(0, browser_1.codiconArray)('arrow-up', true)));
|
|
86
|
+
this.up.classList.add(exports.NAVIGATION_UP_CLASS);
|
|
87
|
+
this.up.title = common_1.nls.localize('theia/filesystem/dialog/navigateUp', 'Navigate Up One Directory');
|
|
88
|
+
const locationListRendererHost = document.createElement('div');
|
|
89
|
+
this.locationListRenderer = this.locationListFactory({ model: this.model, host: locationListRendererHost });
|
|
90
|
+
this.toDispose.push(this.locationListRenderer);
|
|
91
|
+
this.locationListRenderer.host.classList.add(exports.NAVIGATION_LOCATION_LIST_PANEL_CLASS);
|
|
92
|
+
navigationPanel.appendChild(this.locationListRenderer.host);
|
|
93
|
+
this.hiddenFilesToggleRenderer = this.hiddenFilesToggleFactory(this.widget.model.tree);
|
|
94
|
+
this.contentNode.appendChild(this.hiddenFilesToggleRenderer.host);
|
|
95
|
+
if (this.props.filters) {
|
|
96
|
+
this.treeFiltersRenderer = this.treeFiltersFactory({ suppliedFilters: this.props.filters, fileDialogTree: this.widget.model.tree });
|
|
97
|
+
const filters = Object.keys(this.props.filters);
|
|
98
|
+
if (filters.length) {
|
|
99
|
+
this.widget.model.tree.setFilter(this.props.filters[filters[0]]);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
get model() {
|
|
104
|
+
return this.widget.model;
|
|
105
|
+
}
|
|
106
|
+
onUpdateRequest(msg) {
|
|
107
|
+
super.onUpdateRequest(msg);
|
|
108
|
+
(0, browser_1.setEnabled)(this.back, this.model.canNavigateBackward());
|
|
109
|
+
(0, browser_1.setEnabled)(this.forward, this.model.canNavigateForward());
|
|
110
|
+
(0, browser_1.setEnabled)(this.home, !!this.model.initialLocation
|
|
111
|
+
&& !!this.model.location
|
|
112
|
+
&& this.model.initialLocation.toString() !== this.model.location.toString());
|
|
113
|
+
(0, browser_1.setEnabled)(this.up, this.model.canNavigateUpward());
|
|
114
|
+
this.locationListRenderer.render();
|
|
115
|
+
if (this.treeFiltersRenderer) {
|
|
116
|
+
this.treeFiltersRenderer.render();
|
|
117
|
+
}
|
|
118
|
+
this.widget.update();
|
|
119
|
+
}
|
|
120
|
+
handleEnter(event) {
|
|
121
|
+
if (event.target instanceof HTMLTextAreaElement || this.targetIsDirectoryInput(event.target) || this.targetIsInputToggle(event.target)) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
this.accept();
|
|
125
|
+
}
|
|
126
|
+
handleEscape(event) {
|
|
127
|
+
if (event.target instanceof HTMLTextAreaElement || this.targetIsDirectoryInput(event.target)) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
this.close();
|
|
131
|
+
}
|
|
132
|
+
targetIsDirectoryInput(target) {
|
|
133
|
+
return target instanceof HTMLInputElement && target.classList.contains(location_1.LocationListRenderer.Styles.LOCATION_TEXT_INPUT_CLASS);
|
|
134
|
+
}
|
|
135
|
+
targetIsInputToggle(target) {
|
|
136
|
+
return target instanceof HTMLSpanElement && target.classList.contains(location_1.LocationListRenderer.Styles.LOCATION_INPUT_TOGGLE_CLASS);
|
|
137
|
+
}
|
|
138
|
+
appendFiltersPanel() {
|
|
139
|
+
if (this.treeFiltersRenderer) {
|
|
140
|
+
const filtersPanel = document.createElement('div');
|
|
141
|
+
filtersPanel.classList.add(exports.FILTERS_PANEL_CLASS);
|
|
142
|
+
this.contentNode.appendChild(filtersPanel);
|
|
143
|
+
const titlePanel = document.createElement('div');
|
|
144
|
+
titlePanel.innerHTML = DOMPurify.sanitize(common_1.nls.localize('theia/filesystem/format', 'Format:'));
|
|
145
|
+
titlePanel.classList.add(exports.FILTERS_LABEL_CLASS);
|
|
146
|
+
filtersPanel.appendChild(titlePanel);
|
|
147
|
+
this.treeFiltersRenderer.host.classList.add(exports.FILTERS_LIST_PANEL_CLASS);
|
|
148
|
+
filtersPanel.appendChild(this.treeFiltersRenderer.host);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
onAfterAttach(msg) {
|
|
152
|
+
browser_1.Widget.attach(this.treePanel, this.contentNode);
|
|
153
|
+
this.toDisposeOnDetach.push(common_1.Disposable.create(() => {
|
|
154
|
+
browser_1.Widget.detach(this.treePanel);
|
|
155
|
+
this.locationListRenderer.dispose();
|
|
156
|
+
if (this.treeFiltersRenderer) {
|
|
157
|
+
this.treeFiltersRenderer.dispose();
|
|
158
|
+
}
|
|
159
|
+
}));
|
|
160
|
+
this.appendFiltersPanel();
|
|
161
|
+
this.appendCloseButton(common_1.nls.localizeByDefault('Cancel'));
|
|
162
|
+
this.appendAcceptButton(this.getAcceptButtonLabel());
|
|
163
|
+
this.addKeyListener(this.back, browser_1.Key.ENTER, () => {
|
|
164
|
+
this.addTransformEffectToIcon(this.back);
|
|
165
|
+
this.model.navigateBackward();
|
|
166
|
+
}, 'click');
|
|
167
|
+
this.addKeyListener(this.forward, browser_1.Key.ENTER, () => {
|
|
168
|
+
this.addTransformEffectToIcon(this.forward);
|
|
169
|
+
this.model.navigateForward();
|
|
170
|
+
}, 'click');
|
|
171
|
+
this.addKeyListener(this.home, browser_1.Key.ENTER, () => {
|
|
172
|
+
this.addTransformEffectToIcon(this.home);
|
|
173
|
+
if (this.model.initialLocation) {
|
|
174
|
+
this.model.location = this.model.initialLocation;
|
|
175
|
+
}
|
|
176
|
+
}, 'click');
|
|
177
|
+
this.addKeyListener(this.up, browser_1.Key.ENTER, () => {
|
|
178
|
+
this.addTransformEffectToIcon(this.up);
|
|
179
|
+
if (this.model.location) {
|
|
180
|
+
this.model.location = this.model.location.parent;
|
|
181
|
+
}
|
|
182
|
+
}, 'click');
|
|
183
|
+
super.onAfterAttach(msg);
|
|
184
|
+
}
|
|
185
|
+
addTransformEffectToIcon(element) {
|
|
186
|
+
const icon = element.getElementsByTagName('i')[0];
|
|
187
|
+
icon.classList.add('active');
|
|
188
|
+
setTimeout(() => icon.classList.remove('active'), exports.TOOLBAR_ITEM_TRANSFORM_TIMEOUT);
|
|
189
|
+
}
|
|
190
|
+
onActivateRequest(msg) {
|
|
191
|
+
this.widget.activate();
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
(0, tslib_1.__decorate)([
|
|
195
|
+
(0, inversify_1.inject)(file_dialog_widget_1.FileDialogWidget),
|
|
196
|
+
(0, tslib_1.__metadata)("design:type", file_dialog_widget_1.FileDialogWidget)
|
|
197
|
+
], FileDialog.prototype, "widget", void 0);
|
|
198
|
+
(0, tslib_1.__decorate)([
|
|
199
|
+
(0, inversify_1.inject)(location_1.LocationListRendererFactory),
|
|
200
|
+
(0, tslib_1.__metadata)("design:type", Function)
|
|
201
|
+
], FileDialog.prototype, "locationListFactory", void 0);
|
|
202
|
+
(0, tslib_1.__decorate)([
|
|
203
|
+
(0, inversify_1.inject)(file_dialog_tree_filters_renderer_1.FileDialogTreeFiltersRendererFactory),
|
|
204
|
+
(0, tslib_1.__metadata)("design:type", Function)
|
|
205
|
+
], FileDialog.prototype, "treeFiltersFactory", void 0);
|
|
206
|
+
(0, tslib_1.__decorate)([
|
|
207
|
+
(0, inversify_1.inject)(file_dialog_hidden_files_renderer_1.HiddenFilesToggleRendererFactory),
|
|
208
|
+
(0, tslib_1.__metadata)("design:type", Function)
|
|
209
|
+
], FileDialog.prototype, "hiddenFilesToggleFactory", void 0);
|
|
210
|
+
(0, tslib_1.__decorate)([
|
|
211
|
+
(0, inversify_1.postConstruct)(),
|
|
212
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
|
213
|
+
(0, tslib_1.__metadata)("design:paramtypes", []),
|
|
214
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
|
215
|
+
], FileDialog.prototype, "init", null);
|
|
216
|
+
FileDialog = (0, tslib_1.__decorate)([
|
|
217
|
+
(0, tslib_1.__param)(0, (0, inversify_1.inject)(FileDialogProps)),
|
|
218
|
+
(0, tslib_1.__metadata)("design:paramtypes", [FileDialogProps])
|
|
219
|
+
], FileDialog);
|
|
220
|
+
exports.FileDialog = FileDialog;
|
|
221
|
+
let OpenFileDialog = class OpenFileDialog extends FileDialog {
|
|
222
|
+
constructor(props) {
|
|
223
|
+
super(props);
|
|
224
|
+
this.props = props;
|
|
225
|
+
}
|
|
226
|
+
init() {
|
|
227
|
+
super.init();
|
|
228
|
+
const { props } = this;
|
|
229
|
+
if (props.canSelectFiles !== undefined) {
|
|
230
|
+
this.widget.disableFileSelection = !props.canSelectFiles;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
getAcceptButtonLabel() {
|
|
234
|
+
return this.props.openLabel ? this.props.openLabel : common_1.nls.localizeByDefault('Open');
|
|
235
|
+
}
|
|
236
|
+
isValid(value) {
|
|
237
|
+
if (value && !this.props.canSelectMany && value instanceof Array) {
|
|
238
|
+
return common_1.nls.localize('theia/filesystem/dialog/multipleItemMessage', 'You can select only one item');
|
|
239
|
+
}
|
|
240
|
+
return '';
|
|
241
|
+
}
|
|
242
|
+
get value() {
|
|
243
|
+
if (this.widget.model.selectedFileStatNodes.length === 1) {
|
|
244
|
+
return this.widget.model.selectedFileStatNodes[0];
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
return this.widget.model.selectedFileStatNodes;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
async accept() {
|
|
251
|
+
const selection = this.value;
|
|
252
|
+
if (!this.props.canSelectFolders
|
|
253
|
+
&& !Array.isArray(selection)
|
|
254
|
+
&& selection.fileStat.isDirectory) {
|
|
255
|
+
this.widget.model.openNode(selection);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
super.accept();
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
(0, tslib_1.__decorate)([
|
|
262
|
+
(0, inversify_1.postConstruct)(),
|
|
263
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
|
264
|
+
(0, tslib_1.__metadata)("design:paramtypes", []),
|
|
265
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
|
266
|
+
], OpenFileDialog.prototype, "init", null);
|
|
267
|
+
OpenFileDialog = (0, tslib_1.__decorate)([
|
|
268
|
+
(0, inversify_1.injectable)(),
|
|
269
|
+
(0, tslib_1.__param)(0, (0, inversify_1.inject)(OpenFileDialogProps)),
|
|
270
|
+
(0, tslib_1.__metadata)("design:paramtypes", [OpenFileDialogProps])
|
|
271
|
+
], OpenFileDialog);
|
|
272
|
+
exports.OpenFileDialog = OpenFileDialog;
|
|
273
|
+
let SaveFileDialog = class SaveFileDialog extends FileDialog {
|
|
274
|
+
constructor(props) {
|
|
275
|
+
super(props);
|
|
276
|
+
this.props = props;
|
|
277
|
+
}
|
|
278
|
+
init() {
|
|
279
|
+
super.init();
|
|
280
|
+
const { widget } = this;
|
|
281
|
+
widget.addClass(exports.SAVE_DIALOG_CLASS);
|
|
282
|
+
}
|
|
283
|
+
getAcceptButtonLabel() {
|
|
284
|
+
return this.props.saveLabel ? this.props.saveLabel : common_1.nls.localizeByDefault('Save');
|
|
285
|
+
}
|
|
286
|
+
onUpdateRequest(msg) {
|
|
287
|
+
// Update file name field when changing a selection
|
|
288
|
+
if (this.fileNameField) {
|
|
289
|
+
if (this.widget.model.selectedFileStatNodes.length === 1) {
|
|
290
|
+
const node = this.widget.model.selectedFileStatNodes[0];
|
|
291
|
+
if (!node.fileStat.isDirectory) {
|
|
292
|
+
this.fileNameField.value = this.labelProvider.getName(node);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
this.fileNameField.value = '';
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// Continue updating the dialog
|
|
300
|
+
super.onUpdateRequest(msg);
|
|
301
|
+
}
|
|
302
|
+
isValid(value) {
|
|
303
|
+
if (this.fileNameField && this.fileNameField.value) {
|
|
304
|
+
return '';
|
|
305
|
+
}
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
get value() {
|
|
309
|
+
if (this.fileNameField && this.widget.model.selectedFileStatNodes.length === 1) {
|
|
310
|
+
const node = this.widget.model.selectedFileStatNodes[0];
|
|
311
|
+
if (node.fileStat.isDirectory) {
|
|
312
|
+
return node.uri.resolve(this.fileNameField.value);
|
|
313
|
+
}
|
|
314
|
+
return node.uri.parent.resolve(this.fileNameField.value);
|
|
315
|
+
}
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
onAfterAttach(msg) {
|
|
319
|
+
super.onAfterAttach(msg);
|
|
320
|
+
const fileNamePanel = document.createElement('div');
|
|
321
|
+
fileNamePanel.classList.add(exports.FILENAME_PANEL_CLASS);
|
|
322
|
+
this.contentNode.appendChild(fileNamePanel);
|
|
323
|
+
const titlePanel = document.createElement('div');
|
|
324
|
+
titlePanel.innerHTML = DOMPurify.sanitize(common_1.nls.localize('theia/filesystem/dialog/name', 'Name:'));
|
|
325
|
+
titlePanel.classList.add(exports.FILENAME_LABEL_CLASS);
|
|
326
|
+
fileNamePanel.appendChild(titlePanel);
|
|
327
|
+
this.fileNameField = document.createElement('input');
|
|
328
|
+
this.fileNameField.type = 'text';
|
|
329
|
+
this.fileNameField.spellcheck = false;
|
|
330
|
+
this.fileNameField.classList.add('theia-input', exports.FILENAME_TEXTFIELD_CLASS);
|
|
331
|
+
this.fileNameField.value = this.props.inputValue || '';
|
|
332
|
+
fileNamePanel.appendChild(this.fileNameField);
|
|
333
|
+
this.fileNameField.onkeyup = () => this.validate();
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
(0, tslib_1.__decorate)([
|
|
337
|
+
(0, inversify_1.inject)(browser_1.LabelProvider),
|
|
338
|
+
(0, tslib_1.__metadata)("design:type", browser_1.LabelProvider)
|
|
339
|
+
], SaveFileDialog.prototype, "labelProvider", void 0);
|
|
340
|
+
(0, tslib_1.__decorate)([
|
|
341
|
+
(0, inversify_1.postConstruct)(),
|
|
342
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
|
343
|
+
(0, tslib_1.__metadata)("design:paramtypes", []),
|
|
344
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
|
345
|
+
], SaveFileDialog.prototype, "init", null);
|
|
346
|
+
SaveFileDialog = (0, tslib_1.__decorate)([
|
|
347
|
+
(0, inversify_1.injectable)(),
|
|
348
|
+
(0, tslib_1.__param)(0, (0, inversify_1.inject)(SaveFileDialogProps)),
|
|
349
|
+
(0, tslib_1.__metadata)("design:paramtypes", [SaveFileDialogProps])
|
|
350
|
+
], SaveFileDialog);
|
|
351
|
+
exports.SaveFileDialog = SaveFileDialog;
|
|
352
352
|
//# sourceMappingURL=file-dialog.js.map
|