@tutti-os/workspace-file-manager 0.0.159 → 0.0.160
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/dist/index.d.ts +18 -3
- package/dist/index.js +35 -21
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -46,13 +46,15 @@ interface WorkspaceFileManagerContextMenuProps {
|
|
|
46
46
|
resolveOpenWithApplicationIcon?: (application: WorkspaceFileOpenWithApplication) => ReactElement | null;
|
|
47
47
|
showCopyAction: boolean;
|
|
48
48
|
showCopyPathAction: boolean;
|
|
49
|
-
|
|
49
|
+
showCreateDirectoryAction: boolean;
|
|
50
|
+
showCreateFileAction: boolean;
|
|
50
51
|
showDeleteAction: boolean;
|
|
51
52
|
showImportAction: boolean;
|
|
52
53
|
showExportAction: boolean;
|
|
53
54
|
showOpenInAppBrowserAction: boolean;
|
|
54
55
|
showOpenInDefaultBrowserAction: boolean;
|
|
55
56
|
showOpenInFileViewerAction: boolean;
|
|
57
|
+
showOpenAction: boolean;
|
|
56
58
|
showOpenWithAction: boolean;
|
|
57
59
|
showOpenWithOtherAction: boolean;
|
|
58
60
|
showRevealInFolderAction: boolean;
|
|
@@ -77,7 +79,20 @@ interface WorkspaceFileManagerContextMenuProps {
|
|
|
77
79
|
onRevealInFolder: () => Promise<void>;
|
|
78
80
|
onRename: () => void;
|
|
79
81
|
}
|
|
80
|
-
declare function WorkspaceFileManagerContextMenu({ busy, copy, contextMenu, contextMenuRef, openInAppBrowserIcon, positionMode, showCopyAction, showCopyPathAction,
|
|
82
|
+
declare function WorkspaceFileManagerContextMenu({ busy, copy, contextMenu, contextMenuRef, openInAppBrowserIcon, positionMode, showCopyAction, showCopyPathAction, showCreateDirectoryAction, showCreateFileAction, showDeleteAction, showImportAction, showExportAction, showOpenInAppBrowserAction, showOpenInDefaultBrowserAction, showOpenInFileViewerAction, showOpenAction, showOpenWithAction, showOpenWithOtherAction, showRevealInFolderAction, showRenameAction, revealInFolderLabel, openWithApplications, openWithLoading, resolveOpenWithApplicationIcon, onClose, onCreateDirectory, onCreateFile, onCopy, onCopyPath, onDelete, onExport, onOpen, onOpenInAppBrowser, onOpenInDefaultBrowser, onOpenInFileViewer, onOpenWithApplication, onOpenWithOtherApplication, onImport, onRevealInFolder, onRename }: WorkspaceFileManagerContextMenuProps): ReactElement | null;
|
|
83
|
+
|
|
84
|
+
declare function WorkspaceFileManagerCreateDialog({ busy, copy, dialog, onClose, onConfirm, onNameChange }: {
|
|
85
|
+
busy: boolean;
|
|
86
|
+
copy: WorkspaceFileManagerI18nRuntime;
|
|
87
|
+
dialog: {
|
|
88
|
+
errorMessage: string | null;
|
|
89
|
+
kind: "directory" | "file";
|
|
90
|
+
name: string;
|
|
91
|
+
} | null;
|
|
92
|
+
onClose: () => void;
|
|
93
|
+
onConfirm: () => void;
|
|
94
|
+
onNameChange: (name: string) => void;
|
|
95
|
+
}): ReactElement | null;
|
|
81
96
|
|
|
82
97
|
declare function WorkspaceFileEntryIcon({ entry, frameClassName, iconClassName, iconUrlByCacheKey, isEnteringDirectory, loadingIconClassName, onViewportLeave, onViewportEnter }: {
|
|
83
98
|
entry: WorkspaceFileEntry;
|
|
@@ -102,4 +117,4 @@ declare function useWorkspaceFileEntryIconUrls(input: {
|
|
|
102
117
|
reportEntryIconViewportLeave: (entry: WorkspaceFileEntry) => void;
|
|
103
118
|
};
|
|
104
119
|
|
|
105
|
-
export { WorkspaceFileEntry, WorkspaceFileEntryIcon, WorkspaceFileLocation, WorkspaceFileManager, WorkspaceFileManagerContextMenu, type WorkspaceFileManagerContextMenuProps, type WorkspaceFileManagerEntryDragMode, WorkspaceFileManagerI18nRuntime, type WorkspaceFileManagerProps, WorkspaceFileManagerSession, WorkspaceFileOpenWithApplication, useWorkspaceFileEntryIconUrls };
|
|
120
|
+
export { WorkspaceFileEntry, WorkspaceFileEntryIcon, WorkspaceFileLocation, WorkspaceFileManager, WorkspaceFileManagerContextMenu, type WorkspaceFileManagerContextMenuProps, WorkspaceFileManagerCreateDialog, type WorkspaceFileManagerEntryDragMode, WorkspaceFileManagerI18nRuntime, type WorkspaceFileManagerProps, WorkspaceFileManagerSession, WorkspaceFileOpenWithApplication, useWorkspaceFileEntryIconUrls };
|
package/dist/index.js
CHANGED
|
@@ -171,13 +171,15 @@ function WorkspaceFileManagerContextMenu({
|
|
|
171
171
|
positionMode = "local",
|
|
172
172
|
showCopyAction,
|
|
173
173
|
showCopyPathAction,
|
|
174
|
-
|
|
174
|
+
showCreateDirectoryAction,
|
|
175
|
+
showCreateFileAction,
|
|
175
176
|
showDeleteAction,
|
|
176
177
|
showImportAction,
|
|
177
178
|
showExportAction,
|
|
178
179
|
showOpenInAppBrowserAction,
|
|
179
180
|
showOpenInDefaultBrowserAction,
|
|
180
181
|
showOpenInFileViewerAction,
|
|
182
|
+
showOpenAction,
|
|
181
183
|
showOpenWithAction,
|
|
182
184
|
showOpenWithOtherAction,
|
|
183
185
|
showRevealInFolderAction,
|
|
@@ -247,11 +249,14 @@ function WorkspaceFileManagerContextMenu({
|
|
|
247
249
|
positionMode,
|
|
248
250
|
showCopyAction,
|
|
249
251
|
showCopyPathAction,
|
|
252
|
+
showCreateDirectoryAction,
|
|
253
|
+
showCreateFileAction,
|
|
250
254
|
showExportAction,
|
|
251
255
|
showImportAction,
|
|
252
256
|
showOpenInAppBrowserAction,
|
|
253
257
|
showOpenInDefaultBrowserAction,
|
|
254
258
|
showOpenInFileViewerAction,
|
|
259
|
+
showOpenAction,
|
|
255
260
|
showOpenWithAction,
|
|
256
261
|
showOpenWithOtherAction,
|
|
257
262
|
showRevealInFolderAction,
|
|
@@ -266,6 +271,26 @@ function WorkspaceFileManagerContextMenu({
|
|
|
266
271
|
const transferItems = [];
|
|
267
272
|
const dangerItems = [];
|
|
268
273
|
const createItems = [];
|
|
274
|
+
if (!entry || isDirectory) {
|
|
275
|
+
if (showCreateFileAction) {
|
|
276
|
+
createItems.push({
|
|
277
|
+
action: onCreateFile,
|
|
278
|
+
disabled: busy,
|
|
279
|
+
icon: /* @__PURE__ */ jsx(NewWorkspaceLinedIcon, { className: "size-4" }),
|
|
280
|
+
key: "create-file",
|
|
281
|
+
label: copy.t("createFileLabel")
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
if (showCreateDirectoryAction) {
|
|
285
|
+
createItems.push({
|
|
286
|
+
action: onCreateDirectory,
|
|
287
|
+
disabled: busy,
|
|
288
|
+
icon: /* @__PURE__ */ jsx(FileLinedIcon, { className: "size-4" }),
|
|
289
|
+
key: "create-directory",
|
|
290
|
+
label: copy.t("createDirectoryLabel")
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
269
294
|
if (entry) {
|
|
270
295
|
if (showRenameAction) {
|
|
271
296
|
editItems.push({
|
|
@@ -332,22 +357,6 @@ function WorkspaceFileManagerContextMenu({
|
|
|
332
357
|
});
|
|
333
358
|
}
|
|
334
359
|
} else {
|
|
335
|
-
if (showCreateAction) {
|
|
336
|
-
createItems.push({
|
|
337
|
-
action: onCreateFile,
|
|
338
|
-
disabled: busy,
|
|
339
|
-
icon: /* @__PURE__ */ jsx(NewWorkspaceLinedIcon, { className: "size-4" }),
|
|
340
|
-
key: "create-file",
|
|
341
|
-
label: copy.t("createFileLabel")
|
|
342
|
-
});
|
|
343
|
-
createItems.push({
|
|
344
|
-
action: onCreateDirectory,
|
|
345
|
-
disabled: busy,
|
|
346
|
-
icon: /* @__PURE__ */ jsx(FileLinedIcon, { className: "size-4" }),
|
|
347
|
-
key: "create-directory",
|
|
348
|
-
label: copy.t("createDirectoryLabel")
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
360
|
if (showImportAction) {
|
|
352
361
|
transferItems.push({
|
|
353
362
|
action: onImport,
|
|
@@ -359,6 +368,7 @@ function WorkspaceFileManagerContextMenu({
|
|
|
359
368
|
}
|
|
360
369
|
}
|
|
361
370
|
const menuGroups = entry ? [
|
|
371
|
+
{ items: createItems, key: "create" },
|
|
362
372
|
{ items: editItems, key: "edit" },
|
|
363
373
|
{ items: transferItems, key: "transfer" },
|
|
364
374
|
{ items: dangerItems, key: "danger" }
|
|
@@ -388,7 +398,7 @@ function WorkspaceFileManagerContextMenu({
|
|
|
388
398
|
event.preventDefault();
|
|
389
399
|
},
|
|
390
400
|
children: [
|
|
391
|
-
entry ? /* @__PURE__ */ jsx(
|
|
401
|
+
entry && showOpenAction ? /* @__PURE__ */ jsx(
|
|
392
402
|
ContextMenuActionButton,
|
|
393
403
|
{
|
|
394
404
|
disabled: busy,
|
|
@@ -425,7 +435,7 @@ function WorkspaceFileManagerContextMenu({
|
|
|
425
435
|
ContextMenuActionGroup,
|
|
426
436
|
{
|
|
427
437
|
items: group.items,
|
|
428
|
-
showDivider: entry !== null
|
|
438
|
+
showDivider: groupIndex > 0 || entry !== null && (showOpenAction || showOpenWithAction),
|
|
429
439
|
onClose
|
|
430
440
|
},
|
|
431
441
|
group.key
|
|
@@ -1006,7 +1016,8 @@ function resolveWorkspaceFileManagerContextMenuViewState(input) {
|
|
|
1006
1016
|
isBusy: state.busyAction !== null,
|
|
1007
1017
|
isLoading: state.isLoading,
|
|
1008
1018
|
isMutating: state.isMutating,
|
|
1009
|
-
|
|
1019
|
+
showCreateDirectoryAction: !isExternalLocation && !isRecentLocation && !isSearchMode && state.capabilities.canCreateDirectory,
|
|
1020
|
+
showCreateFileAction: !isExternalLocation && !isRecentLocation && !isSearchMode && state.capabilities.canCreateFile,
|
|
1010
1021
|
showCopyAction: state.capabilities.canCopy,
|
|
1011
1022
|
showDeleteAction: state.capabilities.canDelete && !isExternalLocation && !isRecentLocation && !isSearchMode,
|
|
1012
1023
|
showExportAction: state.capabilities.canExport && !isExternalLocation,
|
|
@@ -1143,13 +1154,15 @@ function WorkspaceFileManagerContextMenuContainer({
|
|
|
1143
1154
|
contextMenuRef,
|
|
1144
1155
|
showCopyAction: view.showCopyAction,
|
|
1145
1156
|
showCopyPathAction: true,
|
|
1146
|
-
|
|
1157
|
+
showCreateDirectoryAction: view.contextMenu?.entry === null && view.showCreateDirectoryAction,
|
|
1158
|
+
showCreateFileAction: view.contextMenu?.entry === null && view.showCreateFileAction,
|
|
1147
1159
|
showDeleteAction: view.showDeleteAction,
|
|
1148
1160
|
showImportAction: view.showImportAction,
|
|
1149
1161
|
showExportAction: view.showExportAction,
|
|
1150
1162
|
showOpenInAppBrowserAction: showInternalOpenWithActions && view.showOpenInAppBrowserAction && !!view.contextMenu?.entry && isWorkspaceFileBrowserOpenable(view.contextMenu.entry),
|
|
1151
1163
|
showOpenInDefaultBrowserAction: view.showOpenInDefaultBrowserAction && !!view.contextMenu?.entry && isWorkspaceFileBrowserOpenable(view.contextMenu.entry),
|
|
1152
1164
|
showOpenInFileViewerAction: showInternalOpenWithActions && view.showOpenInFileViewerAction,
|
|
1165
|
+
showOpenAction: true,
|
|
1153
1166
|
showOpenWithAction: view.showOpenWithAction,
|
|
1154
1167
|
showOpenWithOtherAction: view.showOpenWithOtherAction,
|
|
1155
1168
|
showRevealInFolderAction: view.showRevealInFolderAction,
|
|
@@ -5107,6 +5120,7 @@ export {
|
|
|
5107
5120
|
WorkspaceFileEntryIcon,
|
|
5108
5121
|
WorkspaceFileManager,
|
|
5109
5122
|
WorkspaceFileManagerContextMenu,
|
|
5123
|
+
WorkspaceFileManagerCreateDialog,
|
|
5110
5124
|
classifyWorkspaceFilePreviewKind,
|
|
5111
5125
|
createWorkspaceFileManagerI18nRuntime,
|
|
5112
5126
|
createWorkspaceFileManagerService,
|