@nextcloud/files 4.0.0-beta.7 → 4.0.0-beta.9
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/actions/fileAction.d.ts +29 -14
- package/dist/actions/fileListAction.d.ts +12 -3
- package/dist/actions/index.d.ts +2 -2
- package/dist/chunks/{folder-Bf-tAYWu.mjs → folder-CeyZUHai.mjs} +57 -31
- package/dist/chunks/folder-CeyZUHai.mjs.map +1 -0
- package/dist/dav/dav.d.ts +2 -2
- package/dist/dav/davPermissions.d.ts +6 -2
- package/dist/dav/davProperties.d.ts +10 -6
- package/dist/dav/index.d.ts +4 -3
- package/dist/dav.mjs +31 -24
- package/dist/dav.mjs.map +1 -1
- package/dist/fileListFilters.d.ts +37 -9
- package/dist/fileListHeaders.d.ts +11 -3
- package/dist/index.mjs +121 -81
- package/dist/index.mjs.map +1 -1
- package/dist/navigation/index.d.ts +3 -3
- package/dist/navigation/navigation.d.ts +5 -2
- package/dist/navigation/view.d.ts +2 -3
- package/dist/newMenu/NewMenu.d.ts +12 -7
- package/dist/node/file.d.ts +3 -3
- package/dist/node/fileType.d.ts +5 -4
- package/dist/node/folder.d.ts +3 -3
- package/dist/node/node.d.ts +15 -15
- package/dist/node/nodeData.d.ts +13 -8
- package/dist/permissions.d.ts +34 -9
- package/dist/sidebar/Sidebar.d.ts +47 -5
- package/dist/sidebar/SidebarAction.d.ts +51 -0
- package/dist/sidebar/SidebarTab.d.ts +1 -1
- package/dist/sidebar/index.d.ts +2 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/fileSize.d.ts +3 -3
- package/dist/utils/fileSorting.d.ts +11 -6
- package/dist/utils/filename-validation.d.ts +10 -7
- package/dist/utils/filename.d.ts +3 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/sorting.d.ts +4 -0
- package/package.json +6 -6
- package/dist/chunks/folder-Bf-tAYWu.mjs.map +0 -1
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
|
|
3
3
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
4
|
*/
|
|
5
|
-
export * from './navigation';
|
|
6
|
-
export * from './column';
|
|
7
|
-
export * from './view';
|
|
5
|
+
export * from './navigation.ts';
|
|
6
|
+
export * from './column.ts';
|
|
7
|
+
export * from './view.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IView } from './view';
|
|
1
|
+
import { IView } from './view.ts';
|
|
2
2
|
import { TypedEventTarget } from 'typescript-event-target';
|
|
3
3
|
/**
|
|
4
4
|
* The event is emitted when the navigation view was updated.
|
|
@@ -18,6 +18,7 @@ interface UpdateViewsEvent extends CustomEvent<never> {
|
|
|
18
18
|
*
|
|
19
19
|
* Custom views for the files app can be registered (examples are the favorites views or the shared-with-you view).
|
|
20
20
|
* It is also possible to listen on changes of the registered views or when the current active view is changed.
|
|
21
|
+
*
|
|
21
22
|
* @example
|
|
22
23
|
* ```js
|
|
23
24
|
* const navigation = getNavigation()
|
|
@@ -42,6 +43,7 @@ export declare class Navigation extends TypedEventTarget<{
|
|
|
42
43
|
private _currentView;
|
|
43
44
|
/**
|
|
44
45
|
* Register a new view on the navigation
|
|
46
|
+
*
|
|
45
47
|
* @param view The view to register
|
|
46
48
|
* @throws {Error} if a view with the same id is already registered
|
|
47
49
|
* @throws {Error} if the registered view is invalid
|
|
@@ -49,6 +51,7 @@ export declare class Navigation extends TypedEventTarget<{
|
|
|
49
51
|
register(view: IView): void;
|
|
50
52
|
/**
|
|
51
53
|
* Remove a registered view
|
|
54
|
+
*
|
|
52
55
|
* @param id The id of the view to remove
|
|
53
56
|
*/
|
|
54
57
|
remove(id: string): void;
|
|
@@ -72,5 +75,5 @@ export declare class Navigation extends TypedEventTarget<{
|
|
|
72
75
|
/**
|
|
73
76
|
* Get the current files navigation
|
|
74
77
|
*/
|
|
75
|
-
export declare
|
|
78
|
+
export declare function getNavigation(): Navigation;
|
|
76
79
|
export {};
|
|
@@ -38,9 +38,8 @@ export interface IView {
|
|
|
38
38
|
* This method _must_ also return the current directory
|
|
39
39
|
* information alongside with its content.
|
|
40
40
|
*
|
|
41
|
-
* An abort signal is provided
|
|
42
|
-
* cancel the request if the user change directory
|
|
43
|
-
* {@see https://developer.mozilla.org/en-US/docs/Web/API/AbortController }.
|
|
41
|
+
* An [abort signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) is provided
|
|
42
|
+
* to be able to cancel the request if the user change directory.
|
|
44
43
|
*/
|
|
45
44
|
getContents(path: string, options: IGetContentsOptions): Promise<ContentsWithRoot>;
|
|
46
45
|
/**
|
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
import { IFolder, INode } from '../node/index.ts';
|
|
2
|
-
export declare
|
|
2
|
+
export declare const NewMenuEntryCategory: Readonly<{
|
|
3
3
|
/**
|
|
4
4
|
* For actions where the user is intended to upload from their device
|
|
5
5
|
*/
|
|
6
|
-
UploadFromDevice
|
|
6
|
+
UploadFromDevice: 0;
|
|
7
7
|
/**
|
|
8
8
|
* For actions that create new nodes on the server without uploading
|
|
9
9
|
*/
|
|
10
|
-
CreateNew
|
|
10
|
+
CreateNew: 1;
|
|
11
11
|
/**
|
|
12
12
|
* For everything not matching the other categories
|
|
13
13
|
*/
|
|
14
|
-
Other
|
|
15
|
-
}
|
|
14
|
+
Other: 2;
|
|
15
|
+
}>;
|
|
16
|
+
export type TNewMenuEntryCategory = typeof NewMenuEntryCategory[keyof typeof NewMenuEntryCategory];
|
|
16
17
|
export interface NewMenuEntry {
|
|
17
18
|
/** Unique ID */
|
|
18
19
|
id: string;
|
|
19
20
|
/**
|
|
20
21
|
* Category to put this entry in
|
|
21
22
|
* (supported since Nextcloud 30)
|
|
22
|
-
*
|
|
23
|
+
*
|
|
23
24
|
* @default NewMenuEntryCategory.CreateNew
|
|
25
|
+
* @see NewMenuEntryCategory
|
|
26
|
+
* @since 3.3.0
|
|
24
27
|
*/
|
|
25
|
-
category?:
|
|
28
|
+
category?: TNewMenuEntryCategory;
|
|
26
29
|
/** Translatable string displayed in the menu */
|
|
27
30
|
displayName: string;
|
|
28
31
|
/**
|
|
29
32
|
* Condition wether this entry is shown or not
|
|
33
|
+
*
|
|
30
34
|
* @param context the creation context. Usually the current folder
|
|
31
35
|
*/
|
|
32
36
|
enabled?: (context: IFolder) => boolean;
|
|
@@ -39,6 +43,7 @@ export interface NewMenuEntry {
|
|
|
39
43
|
order?: number;
|
|
40
44
|
/**
|
|
41
45
|
* Function to be run after creation
|
|
46
|
+
*
|
|
42
47
|
* @param context - The creation context. Usually the current folder
|
|
43
48
|
* @param content - List of file/folders present in the context folder
|
|
44
49
|
*/
|
package/dist/node/file.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { NodeConstructorData, Node } from './node';
|
|
2
|
-
import { FileType } from './fileType';
|
|
1
|
+
import { NodeConstructorData, Node } from './node.ts';
|
|
2
|
+
import { FileType } from './fileType.ts';
|
|
3
3
|
export declare class File extends Node {
|
|
4
4
|
constructor(...[data, davService]: NodeConstructorData);
|
|
5
|
-
get type(): FileType.File;
|
|
5
|
+
get type(): typeof FileType.File;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Interface of the File class
|
package/dist/node/fileType.d.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
|
|
3
3
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
4
|
*/
|
|
5
|
-
export declare
|
|
6
|
-
Folder
|
|
7
|
-
File
|
|
8
|
-
}
|
|
5
|
+
export declare const FileType: Readonly<{
|
|
6
|
+
Folder: "folder";
|
|
7
|
+
File: "file";
|
|
8
|
+
}>;
|
|
9
|
+
export type TFileType = typeof FileType[keyof typeof FileType];
|
package/dist/node/folder.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { NodeConstructorData, Node } from './node';
|
|
2
|
-
import { FileType } from './fileType';
|
|
1
|
+
import { NodeConstructorData, Node } from './node.ts';
|
|
2
|
+
import { FileType } from './fileType.ts';
|
|
3
3
|
export declare class Folder extends Node {
|
|
4
4
|
constructor(...[data, davService]: NodeConstructorData);
|
|
5
|
-
get type(): FileType.Folder;
|
|
5
|
+
get type(): typeof FileType.Folder;
|
|
6
6
|
get extension(): null;
|
|
7
7
|
get mime(): 'httpd/unix-directory';
|
|
8
8
|
}
|
package/dist/node/node.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare enum NodeStatus {
|
|
1
|
+
import { TFileType } from './fileType.ts';
|
|
2
|
+
import { Attribute, NodeData } from './nodeData.ts';
|
|
3
|
+
export declare const NodeStatus: Readonly<{
|
|
5
4
|
/** This is a new node and it doesn't exists on the filesystem yet */
|
|
6
|
-
NEW
|
|
5
|
+
NEW: "new";
|
|
7
6
|
/** This node has failed and is unavailable */
|
|
8
|
-
FAILED
|
|
7
|
+
FAILED: "failed";
|
|
9
8
|
/** This node is currently loading or have an operation in progress */
|
|
10
|
-
LOADING
|
|
9
|
+
LOADING: "loading";
|
|
11
10
|
/** This node is locked and cannot be modified */
|
|
12
|
-
LOCKED
|
|
13
|
-
}
|
|
11
|
+
LOCKED: "locked";
|
|
12
|
+
}>;
|
|
13
|
+
export type TNodeStatus = typeof NodeStatus[keyof typeof NodeStatus];
|
|
14
14
|
export type NodeConstructorData = [NodeData, RegExp?];
|
|
15
15
|
export declare abstract class Node {
|
|
16
16
|
private _attributes;
|
|
@@ -63,7 +63,7 @@ export declare abstract class Node {
|
|
|
63
63
|
/**
|
|
64
64
|
* Is it a file or a folder ?
|
|
65
65
|
*/
|
|
66
|
-
abstract get type():
|
|
66
|
+
abstract get type(): TFileType;
|
|
67
67
|
/**
|
|
68
68
|
* Get the file mime
|
|
69
69
|
*/
|
|
@@ -102,11 +102,11 @@ export declare abstract class Node {
|
|
|
102
102
|
/**
|
|
103
103
|
* Get the file permissions
|
|
104
104
|
*/
|
|
105
|
-
get permissions():
|
|
105
|
+
get permissions(): number;
|
|
106
106
|
/**
|
|
107
107
|
* Set the file permissions
|
|
108
108
|
*/
|
|
109
|
-
set permissions(permissions:
|
|
109
|
+
set permissions(permissions: number);
|
|
110
110
|
/**
|
|
111
111
|
* Get the file owner
|
|
112
112
|
* There is no setter as the owner is not meant to be changed
|
|
@@ -133,15 +133,15 @@ export declare abstract class Node {
|
|
|
133
133
|
/**
|
|
134
134
|
* Get the node status.
|
|
135
135
|
*/
|
|
136
|
-
get status():
|
|
136
|
+
get status(): TNodeStatus | undefined;
|
|
137
137
|
/**
|
|
138
138
|
* Set the node status.
|
|
139
139
|
*/
|
|
140
|
-
set status(status:
|
|
140
|
+
set status(status: TNodeStatus | undefined);
|
|
141
141
|
/**
|
|
142
142
|
* Move the node to a new destination
|
|
143
143
|
*
|
|
144
|
-
* @param
|
|
144
|
+
* @param destination the new source.
|
|
145
145
|
* e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg
|
|
146
146
|
*/
|
|
147
147
|
move(destination: string): void;
|
package/dist/node/nodeData.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NodeStatus } from './node';
|
|
1
|
+
import { TNodeStatus } from './node.ts';
|
|
3
2
|
export interface Attribute {
|
|
4
3
|
[key: string]: any;
|
|
5
4
|
}
|
|
@@ -26,8 +25,14 @@ export interface NodeData {
|
|
|
26
25
|
mime?: string;
|
|
27
26
|
/** The node size type */
|
|
28
27
|
size?: number;
|
|
29
|
-
/**
|
|
30
|
-
|
|
28
|
+
/**
|
|
29
|
+
* The node permissions.
|
|
30
|
+
*
|
|
31
|
+
* A binary mask of `Permission` values.
|
|
32
|
+
*
|
|
33
|
+
* @see Permission
|
|
34
|
+
*/
|
|
35
|
+
permissions?: number;
|
|
31
36
|
/** The owner UID of this node */
|
|
32
37
|
owner: string | null;
|
|
33
38
|
/** Optional the displayname of this node */
|
|
@@ -35,7 +40,7 @@ export interface NodeData {
|
|
|
35
40
|
/** The node attributes */
|
|
36
41
|
attributes?: Attribute;
|
|
37
42
|
/** The node status */
|
|
38
|
-
status?:
|
|
43
|
+
status?: TNodeStatus;
|
|
39
44
|
}
|
|
40
45
|
/**
|
|
41
46
|
* Check if a node source is from a specific DAV service
|
|
@@ -43,7 +48,7 @@ export interface NodeData {
|
|
|
43
48
|
* @param source The source to check
|
|
44
49
|
* @param davService Pattern to check if source is DAV resource
|
|
45
50
|
*/
|
|
46
|
-
export declare
|
|
51
|
+
export declare function isDavResource(source: string, davService: RegExp): boolean;
|
|
47
52
|
/**
|
|
48
53
|
* Validate Node construct data
|
|
49
54
|
*
|
|
@@ -57,10 +62,10 @@ export declare function validateData(data: NodeData, davService: RegExp): void;
|
|
|
57
62
|
*
|
|
58
63
|
* @param data The internal node data
|
|
59
64
|
*/
|
|
60
|
-
export declare
|
|
65
|
+
export declare function fixDates(data: NodeData): void;
|
|
61
66
|
/**
|
|
62
67
|
* Fix a RegExp pattern from string or RegExp to RegExp
|
|
63
68
|
*
|
|
64
69
|
* @param pattern The pattern as string or RegExp
|
|
65
70
|
*/
|
|
66
|
-
export declare
|
|
71
|
+
export declare function fixRegExp(pattern: string | RegExp): RegExp;
|
package/dist/permissions.d.ts
CHANGED
|
@@ -5,12 +5,37 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Node permissions
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
export declare const Permission: Readonly<{
|
|
9
|
+
/**
|
|
10
|
+
* No permissions granted
|
|
11
|
+
*/
|
|
12
|
+
NONE: 0;
|
|
13
|
+
/**
|
|
14
|
+
* Can read the file content
|
|
15
|
+
*/
|
|
16
|
+
READ: 1;
|
|
17
|
+
/**
|
|
18
|
+
* Can modify the file itself (move, rename, etc)
|
|
19
|
+
*/
|
|
20
|
+
UPDATE: 2;
|
|
21
|
+
/**
|
|
22
|
+
* Can create new files/folders inside a folder
|
|
23
|
+
*/
|
|
24
|
+
CREATE: 4;
|
|
25
|
+
/**
|
|
26
|
+
* Can change the file content
|
|
27
|
+
*/
|
|
28
|
+
WRITE: 4;
|
|
29
|
+
/**
|
|
30
|
+
* Can delete the node
|
|
31
|
+
*/
|
|
32
|
+
DELETE: 8;
|
|
33
|
+
/**
|
|
34
|
+
* Can share the node
|
|
35
|
+
*/
|
|
36
|
+
SHARE: 16;
|
|
37
|
+
/**
|
|
38
|
+
* All permissions are granted
|
|
39
|
+
*/
|
|
40
|
+
ALL: 31;
|
|
41
|
+
}>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { INode } from '../node/node.ts';
|
|
2
|
+
import { ISidebarAction } from './SidebarAction.ts';
|
|
1
3
|
import { ISidebarContext, ISidebarTab } from './SidebarTab.ts';
|
|
2
4
|
export interface ISidebar {
|
|
3
5
|
/**
|
|
@@ -8,15 +10,41 @@ export interface ISidebar {
|
|
|
8
10
|
/**
|
|
9
11
|
* The current open state of the sidebar
|
|
10
12
|
*/
|
|
11
|
-
readonly
|
|
13
|
+
readonly isOpen: boolean;
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
15
|
+
* The currently active sidebar tab id
|
|
16
|
+
*/
|
|
17
|
+
readonly activeTab?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The currently opened node in the sidebar
|
|
20
|
+
*/
|
|
21
|
+
readonly node?: INode;
|
|
22
|
+
/**
|
|
23
|
+
* Open the sidebar for a specific node.
|
|
24
|
+
*
|
|
25
|
+
* When the sidebar is fully opened the `files:sidebar:opened` event is emitted,
|
|
26
|
+
* see also `@nextcloud/event-bus`.
|
|
27
|
+
*
|
|
28
|
+
* @param node - The node to open the sidebar for
|
|
29
|
+
* @param tab - The tab to open by default
|
|
30
|
+
*/
|
|
31
|
+
open(node: INode, tab?: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Close the sidebar.
|
|
34
|
+
*
|
|
35
|
+
* When the sidebar is fully closed the `files:sidebar:closed` event is emitted,
|
|
36
|
+
* see also `@nextcloud/event-bus`.
|
|
37
|
+
*/
|
|
38
|
+
close(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Set the active sidebar tab
|
|
14
41
|
*
|
|
15
|
-
* @param
|
|
42
|
+
* @param tabId - The tab to set active
|
|
16
43
|
*/
|
|
17
|
-
|
|
44
|
+
setActiveTab(tabId: string): void;
|
|
18
45
|
/**
|
|
19
|
-
* Register a new sidebar tab
|
|
46
|
+
* Register a new sidebar tab.
|
|
47
|
+
* This should ideally be done on app initialization using Nextcloud init scripts.
|
|
20
48
|
*
|
|
21
49
|
* @param tab - The sidebar tab to register
|
|
22
50
|
*/
|
|
@@ -26,6 +54,20 @@ export interface ISidebar {
|
|
|
26
54
|
* If a node is passed only the enabled tabs are retrieved.
|
|
27
55
|
*/
|
|
28
56
|
getTabs(context?: ISidebarContext): ISidebarTab[];
|
|
57
|
+
/**
|
|
58
|
+
* Get all registered sidebar actions.
|
|
59
|
+
*
|
|
60
|
+
* If a context is provided only the enabled actions are returned.
|
|
61
|
+
*
|
|
62
|
+
* @param context - The context
|
|
63
|
+
*/
|
|
64
|
+
getActions(context?: ISidebarContext): ISidebarAction[];
|
|
65
|
+
/**
|
|
66
|
+
* Register a new sidebar action.
|
|
67
|
+
*
|
|
68
|
+
* @param action - The action to register
|
|
69
|
+
*/
|
|
70
|
+
registerAction(action: ISidebarAction): void;
|
|
29
71
|
}
|
|
30
72
|
/**
|
|
31
73
|
* Get a reference to the files sidebar.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ISidebarContext } from './SidebarTab.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Implementation of a custom sidebar tab within the files app.
|
|
4
|
+
*/
|
|
5
|
+
export interface ISidebarAction {
|
|
6
|
+
/**
|
|
7
|
+
* Unique id of the sidebar tab.
|
|
8
|
+
* This has to conform to the HTML id attribute specification.
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* The order of this tab.
|
|
13
|
+
* Use a low number to make this tab ordered in front.
|
|
14
|
+
*/
|
|
15
|
+
order: number;
|
|
16
|
+
/**
|
|
17
|
+
* The localized name of the sidebar tab.
|
|
18
|
+
*
|
|
19
|
+
* @param context - The current context of the files app
|
|
20
|
+
*/
|
|
21
|
+
displayName(context: ISidebarContext): string;
|
|
22
|
+
/**
|
|
23
|
+
* The icon, as SVG, of the sidebar tab.
|
|
24
|
+
*
|
|
25
|
+
* @param context - The current context of the files app
|
|
26
|
+
*/
|
|
27
|
+
iconSvgInline(context: ISidebarContext): string;
|
|
28
|
+
/**
|
|
29
|
+
* Callback to check if the sidebar tab should be shown for the selected node.
|
|
30
|
+
*
|
|
31
|
+
* @param context - The current context of the files app
|
|
32
|
+
*/
|
|
33
|
+
enabled(context: ISidebarContext): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Handle the sidebar action.
|
|
36
|
+
*
|
|
37
|
+
* @param context - The current context of the files app
|
|
38
|
+
*/
|
|
39
|
+
onClick(context: ISidebarContext): void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Register a new sidebar action.
|
|
43
|
+
*
|
|
44
|
+
* @param action - The sidebar action to register
|
|
45
|
+
* @throws {Error} If the provided action is not a valid sidebar action and thus cannot be registered.
|
|
46
|
+
*/
|
|
47
|
+
export declare function registerSidebarAction(action: ISidebarAction): void;
|
|
48
|
+
/**
|
|
49
|
+
* Get all currently registered sidebar actions.
|
|
50
|
+
*/
|
|
51
|
+
export declare function getSidebarActions(): ISidebarAction[];
|
|
@@ -69,7 +69,7 @@ export interface ISidebarTab {
|
|
|
69
69
|
* Register a new sidebar tab for the files app.
|
|
70
70
|
*
|
|
71
71
|
* @param tab - The sidebar tab to register
|
|
72
|
-
* @throws If the provided tab is not a valid sidebar tab and thus cannot be registered.
|
|
72
|
+
* @throws {Error} If the provided tab is not a valid sidebar tab and thus cannot be registered.
|
|
73
73
|
*/
|
|
74
74
|
export declare function registerSidebarTab(tab: ISidebarTab): void;
|
|
75
75
|
/**
|
package/dist/sidebar/index.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
package/dist/utils/fileSize.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export declare function formatFileSize(size: number | string, skipSmallSizes?: b
|
|
|
18
18
|
* Returns a file size in bytes from a humanly readable string
|
|
19
19
|
* Note: `b` and `B` are both parsed as bytes and not as bit or byte.
|
|
20
20
|
*
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @return
|
|
21
|
+
* @param value file size in human-readable format
|
|
22
|
+
* @param forceBinary for backwards compatibility this allows values to be base 2 (so 2KB means 2048 bytes instead of 2000 bytes)
|
|
23
|
+
* @return or null if string could not be parsed
|
|
24
24
|
*/
|
|
25
25
|
export declare function parseFileSize(value: string, forceBinary?: boolean): number | null;
|
|
@@ -1,33 +1,38 @@
|
|
|
1
1
|
import { INode } from '../node/node.ts';
|
|
2
2
|
import { SortingOrder } from './sorting.ts';
|
|
3
|
-
export declare
|
|
4
|
-
Name
|
|
5
|
-
Modified
|
|
6
|
-
Size
|
|
7
|
-
}
|
|
3
|
+
export declare const FilesSortingMode: Readonly<{
|
|
4
|
+
Name: "basename";
|
|
5
|
+
Modified: "mtime";
|
|
6
|
+
Size: "size";
|
|
7
|
+
}>;
|
|
8
|
+
export type TFilesSortingMode = typeof FilesSortingMode[keyof typeof FilesSortingMode];
|
|
8
9
|
export interface FilesSortingOptions {
|
|
9
10
|
/**
|
|
10
11
|
* They key to order the files by
|
|
12
|
+
*
|
|
11
13
|
* @default FilesSortingMode.Name
|
|
12
14
|
*/
|
|
13
|
-
sortingMode?:
|
|
15
|
+
sortingMode?: TFilesSortingMode | string;
|
|
14
16
|
/**
|
|
15
17
|
* @default 'asc'
|
|
16
18
|
*/
|
|
17
19
|
sortingOrder?: SortingOrder;
|
|
18
20
|
/**
|
|
19
21
|
* If set to true nodes marked as favorites are ordered on top of all other nodes
|
|
22
|
+
*
|
|
20
23
|
* @default false
|
|
21
24
|
*/
|
|
22
25
|
sortFavoritesFirst?: boolean;
|
|
23
26
|
/**
|
|
24
27
|
* If set to true folders are ordered on top of files
|
|
28
|
+
*
|
|
25
29
|
* @default false
|
|
26
30
|
*/
|
|
27
31
|
sortFoldersFirst?: boolean;
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
34
|
* Sort files and folders according to the sorting options
|
|
35
|
+
*
|
|
31
36
|
* @param nodes Nodes to sort
|
|
32
37
|
* @param options Sorting options
|
|
33
38
|
*/
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
|
|
3
3
|
* SPDX-License-Identifier: AGPL-3.0-or-later or LGPL-3.0-or-later
|
|
4
4
|
*/
|
|
5
|
-
export declare
|
|
6
|
-
ReservedName
|
|
7
|
-
Character
|
|
8
|
-
Extension
|
|
9
|
-
}
|
|
5
|
+
export declare const InvalidFilenameErrorReason: Readonly<{
|
|
6
|
+
ReservedName: "reserved name";
|
|
7
|
+
Character: "character";
|
|
8
|
+
Extension: "extension";
|
|
9
|
+
}>;
|
|
10
|
+
export type TInvalidFilenameErrorReason = typeof InvalidFilenameErrorReason[keyof typeof InvalidFilenameErrorReason];
|
|
10
11
|
interface InvalidFilenameErrorOptions {
|
|
11
12
|
/**
|
|
12
13
|
* The filename that was validated
|
|
@@ -15,7 +16,7 @@ interface InvalidFilenameErrorOptions {
|
|
|
15
16
|
/**
|
|
16
17
|
* Reason why the validation failed
|
|
17
18
|
*/
|
|
18
|
-
reason:
|
|
19
|
+
reason: TInvalidFilenameErrorReason;
|
|
19
20
|
/**
|
|
20
21
|
* Part of the filename that caused this error
|
|
21
22
|
*/
|
|
@@ -30,7 +31,7 @@ export declare class InvalidFilenameError extends Error {
|
|
|
30
31
|
/**
|
|
31
32
|
* Reason why the validation failed
|
|
32
33
|
*/
|
|
33
|
-
get reason():
|
|
34
|
+
get reason(): TInvalidFilenameErrorReason;
|
|
34
35
|
/**
|
|
35
36
|
* Part of the filename that caused this error
|
|
36
37
|
*/
|
|
@@ -38,6 +39,7 @@ export declare class InvalidFilenameError extends Error {
|
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
41
|
* Validate a given filename
|
|
42
|
+
*
|
|
41
43
|
* @param filename The filename to check
|
|
42
44
|
* @throws {InvalidFilenameError}
|
|
43
45
|
*/
|
|
@@ -45,6 +47,7 @@ export declare function validateFilename(filename: string): void;
|
|
|
45
47
|
/**
|
|
46
48
|
* Check the validity of a filename
|
|
47
49
|
* This is a convenient wrapper for `checkFilenameValidity` to only return a boolean for the valid
|
|
50
|
+
*
|
|
48
51
|
* @param filename Filename to check validity
|
|
49
52
|
*/
|
|
50
53
|
export declare function isFilenameValid(filename: string): boolean;
|
package/dist/utils/filename.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
interface UniqueNameOptions {
|
|
6
6
|
/**
|
|
7
7
|
* A function that takes an index and returns a suffix to add to the file name, defaults to '(index)'
|
|
8
|
+
*
|
|
8
9
|
* @param index The current index to add
|
|
9
10
|
*/
|
|
10
11
|
suffix?: (index: number) => string;
|
|
@@ -15,10 +16,11 @@ interface UniqueNameOptions {
|
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* Create an unique file name
|
|
19
|
+
*
|
|
18
20
|
* @param name The initial name to use
|
|
19
21
|
* @param otherNames Other names that are already used
|
|
20
22
|
* @param options Optional parameters for tuning the behavior
|
|
21
|
-
* @return
|
|
23
|
+
* @return Either the initial name, if unique, or the name with the suffix so that the name is unique
|
|
22
24
|
*/
|
|
23
25
|
export declare function getUniqueName(name: string, otherNames: string[], options?: UniqueNameOptions): string;
|
|
24
26
|
export {};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export type { FilesSortingOptions } from './fileSorting.ts';
|
|
|
3
3
|
export * from './filename-validation.ts';
|
|
4
4
|
export { getUniqueName } from './filename.ts';
|
|
5
5
|
export { formatFileSize, parseFileSize } from './fileSize.ts';
|
|
6
|
-
export {
|
|
6
|
+
export { FilesSortingMode, sortNodes } from './fileSorting.ts';
|
|
7
7
|
export { orderBy } from './sorting.ts';
|
package/dist/utils/sorting.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextcloud/files",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.9",
|
|
4
4
|
"description": "Nextcloud files utils",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nextcloud",
|
|
@@ -57,25 +57,25 @@
|
|
|
57
57
|
"@nextcloud/router": "^3.1.0",
|
|
58
58
|
"@nextcloud/sharing": "^0.3.0",
|
|
59
59
|
"is-svg": "^6.1.0",
|
|
60
|
-
"typescript-event-target": "^1.1.
|
|
60
|
+
"typescript-event-target": "^1.1.2",
|
|
61
61
|
"webdav": "^5.8.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@codecov/vite-plugin": "^1.9.1",
|
|
65
|
-
"@nextcloud/eslint-config": "^
|
|
65
|
+
"@nextcloud/eslint-config": "^9.0.0-rc.5",
|
|
66
66
|
"@nextcloud/event-bus": "^3.3.3",
|
|
67
67
|
"@nextcloud/typings": "^1.10.0",
|
|
68
68
|
"@nextcloud/vite-config": "^2.5.2",
|
|
69
|
-
"@types/node": "^25.0.
|
|
69
|
+
"@types/node": "^25.0.5",
|
|
70
70
|
"@vitest/coverage-istanbul": "^4.0.16",
|
|
71
71
|
"css.escape": "^1.5.1",
|
|
72
72
|
"fast-xml-parser": "^5.3.3",
|
|
73
|
-
"jsdom": "^27.
|
|
73
|
+
"jsdom": "^27.4.0",
|
|
74
74
|
"tslib": "^2.8.1",
|
|
75
75
|
"typedoc": "^0.28.15",
|
|
76
76
|
"typedoc-plugin-missing-exports": "^4.1.2",
|
|
77
77
|
"typescript": "^5.9.3",
|
|
78
|
-
"vite": "^7.3.
|
|
78
|
+
"vite": "^7.3.1",
|
|
79
79
|
"vitest": "^4.0.14"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|