@nextcloud/files 3.0.0-beta.9 → 3.0.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/README.md +53 -1
- package/dist/dav/dav.d.ts +64 -0
- package/dist/dav/davPermissions.d.ts +6 -0
- package/dist/dav/davProperties.d.ts +57 -0
- package/dist/fileAction.d.ts +43 -21
- package/dist/fileListHeaders.d.ts +47 -0
- package/dist/files/folder.d.ts +1 -1
- package/dist/files/node.d.ts +32 -3
- package/dist/files/nodeData.d.ts +16 -3
- package/dist/humanfilesize.d.ts +15 -1
- package/dist/index.cjs +2189 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +19 -15
- package/dist/index.mjs +2195 -0
- package/dist/index.mjs.map +1 -0
- package/dist/navigation/column.d.ts +48 -0
- package/dist/navigation/navigation.d.ts +32 -0
- package/dist/navigation/view.d.ts +103 -0
- package/dist/newFileMenu.d.ts +20 -7
- package/dist/permissions.d.ts +3 -5
- package/dist/utils/logger.d.ts +1 -1
- package/dist/vendor.LICENSE.txt +13 -0
- package/package.json +45 -38
- package/dist/index.esm.js +0 -771
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -889
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
3
|
+
*
|
|
4
|
+
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
5
|
+
*
|
|
6
|
+
* @license AGPL-3.0-or-later
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Affero General Public License as
|
|
10
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
11
|
+
* License, or (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Affero General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
import type { Folder, Node } from '@nextcloud/files';
|
|
23
|
+
import { Column } from './column.js';
|
|
24
|
+
export type ContentsWithRoot = {
|
|
25
|
+
folder: Folder;
|
|
26
|
+
contents: Node[];
|
|
27
|
+
};
|
|
28
|
+
interface ViewData {
|
|
29
|
+
/** Unique view ID */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Translated view name */
|
|
32
|
+
name: string;
|
|
33
|
+
/** Translated accessible description of the view */
|
|
34
|
+
caption?: string;
|
|
35
|
+
/** Translated title of the empty view */
|
|
36
|
+
emptyTitle?: string;
|
|
37
|
+
/** Translated description of the empty view */
|
|
38
|
+
emptyCaption?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Method return the content of the provided path
|
|
41
|
+
* This ideally should be a cancellable promise.
|
|
42
|
+
* promise.cancel(reason) will be called when the directory
|
|
43
|
+
* change and the promise is not resolved yet.
|
|
44
|
+
* You _must_ also return the current directory
|
|
45
|
+
* information alongside with its content.
|
|
46
|
+
*/
|
|
47
|
+
getContents: (path: string) => Promise<ContentsWithRoot>;
|
|
48
|
+
/** The view icon as an inline svg */
|
|
49
|
+
icon: string;
|
|
50
|
+
/** The view order */
|
|
51
|
+
order: number;
|
|
52
|
+
/**
|
|
53
|
+
* Custom params to give to the router on click
|
|
54
|
+
* If defined, will be treated as a dummy view and
|
|
55
|
+
* will just redirect and not fetch any contents.
|
|
56
|
+
*/
|
|
57
|
+
params?: Record<string, string>;
|
|
58
|
+
/**
|
|
59
|
+
* This view column(s). Name and actions are
|
|
60
|
+
* by default always included
|
|
61
|
+
*/
|
|
62
|
+
columns?: Column[];
|
|
63
|
+
/** The empty view element to render your empty content into */
|
|
64
|
+
emptyView?: (div: HTMLDivElement) => void;
|
|
65
|
+
/** The parent unique ID */
|
|
66
|
+
parent?: string;
|
|
67
|
+
/** This view is sticky (sent at the bottom) */
|
|
68
|
+
sticky?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* This view has children and is expanded (by default)
|
|
71
|
+
* or not. This will be overridden by user config.
|
|
72
|
+
*/
|
|
73
|
+
expanded?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Will be used as default if the user
|
|
76
|
+
* haven't customized their sorting column
|
|
77
|
+
*/
|
|
78
|
+
defaultSortKey?: string;
|
|
79
|
+
}
|
|
80
|
+
export declare class View implements ViewData {
|
|
81
|
+
private _view;
|
|
82
|
+
constructor(view: ViewData);
|
|
83
|
+
get id(): string;
|
|
84
|
+
get name(): string;
|
|
85
|
+
get caption(): string | undefined;
|
|
86
|
+
get emptyTitle(): string | undefined;
|
|
87
|
+
get emptyCaption(): string | undefined;
|
|
88
|
+
get getContents(): (path: string) => Promise<ContentsWithRoot>;
|
|
89
|
+
get icon(): string;
|
|
90
|
+
set icon(icon: string);
|
|
91
|
+
get order(): number;
|
|
92
|
+
set order(order: number);
|
|
93
|
+
get params(): Record<string, string> | undefined;
|
|
94
|
+
set params(params: Record<string, string> | undefined);
|
|
95
|
+
get columns(): Column[] | undefined;
|
|
96
|
+
get emptyView(): ((div: HTMLDivElement) => void) | undefined;
|
|
97
|
+
get parent(): string | undefined;
|
|
98
|
+
get sticky(): boolean | undefined;
|
|
99
|
+
get expanded(): boolean | undefined;
|
|
100
|
+
set expanded(expanded: boolean | undefined);
|
|
101
|
+
get defaultSortKey(): string | undefined;
|
|
102
|
+
}
|
|
103
|
+
export {};
|
package/dist/newFileMenu.d.ts
CHANGED
|
@@ -19,22 +19,35 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
|
+
import type { Folder, Node } from './index';
|
|
22
23
|
export interface Entry {
|
|
23
24
|
/** Unique ID */
|
|
24
25
|
id: string;
|
|
25
26
|
/** Translatable string displayed in the menu */
|
|
26
27
|
displayName: string;
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Condition wether this entry is shown or not
|
|
30
|
+
* @param context the creation context. Usually the current folder
|
|
31
|
+
*/
|
|
32
|
+
enabled?: (context: Folder) => boolean;
|
|
29
33
|
/**
|
|
30
34
|
* Either iconSvgInline or iconClass must be defined
|
|
31
35
|
* Svg as inline string. <svg><path fill="..." /></svg>
|
|
32
36
|
*/
|
|
33
37
|
iconSvgInline?: string;
|
|
34
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Existing icon css class
|
|
40
|
+
* @deprecated use iconSvgInline instead
|
|
41
|
+
*/
|
|
35
42
|
iconClass?: string;
|
|
36
|
-
/**
|
|
37
|
-
|
|
43
|
+
/** Order of the entry in the menu */
|
|
44
|
+
order?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Function to be run after creation
|
|
47
|
+
* @param context the creation context. Usually the current folder
|
|
48
|
+
* @param content list of file/folders present in the context folder
|
|
49
|
+
*/
|
|
50
|
+
handler: (context: Folder, content: Node[]) => void;
|
|
38
51
|
}
|
|
39
52
|
export declare class NewFileMenu {
|
|
40
53
|
private _entries;
|
|
@@ -43,9 +56,9 @@ export declare class NewFileMenu {
|
|
|
43
56
|
/**
|
|
44
57
|
* Get the list of registered entries
|
|
45
58
|
*
|
|
46
|
-
* @param {
|
|
59
|
+
* @param {Folder} context the creation context. Usually the current folder
|
|
47
60
|
*/
|
|
48
|
-
getEntries(context?:
|
|
61
|
+
getEntries(context?: Folder): Array<Entry>;
|
|
49
62
|
private getEntryIndex;
|
|
50
63
|
private validateEntry;
|
|
51
64
|
}
|
package/dist/permissions.d.ts
CHANGED
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
|
+
/**
|
|
23
|
+
* Node permissions
|
|
24
|
+
*/
|
|
22
25
|
export declare enum Permission {
|
|
23
26
|
NONE = 0,
|
|
24
27
|
CREATE = 4,
|
|
@@ -28,8 +31,3 @@ export declare enum Permission {
|
|
|
28
31
|
SHARE = 16,
|
|
29
32
|
ALL = 31
|
|
30
33
|
}
|
|
31
|
-
/**
|
|
32
|
-
* Parse the webdav permission string to a permission enum
|
|
33
|
-
* @see https://github.com/nextcloud/server/blob/71f698649f578db19a22457cb9d420fb62c10382/lib/public/Files/DavUtil.php#L58-L88
|
|
34
|
-
*/
|
|
35
|
-
export declare const parseWebdavPermissions: (permString?: string) => number;
|
package/dist/utils/logger.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextcloud/files",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Nextcloud files utils",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.mjs",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
12
14
|
}
|
|
13
15
|
},
|
|
14
16
|
"files": [
|
|
@@ -16,7 +18,8 @@
|
|
|
16
18
|
],
|
|
17
19
|
"author": "Christoph Wurst <christoph@winzerhof-wurst.at>",
|
|
18
20
|
"contributors": [
|
|
19
|
-
"John Molakvoæ <skjnldsv@protonmail.com>"
|
|
21
|
+
"John Molakvoæ <skjnldsv@protonmail.com>",
|
|
22
|
+
"Ferdinand Thiessen <opensource@fthiessen.de>"
|
|
20
23
|
],
|
|
21
24
|
"license": "AGPL-3.0-or-later",
|
|
22
25
|
"keywords": [
|
|
@@ -25,49 +28,53 @@
|
|
|
25
28
|
"library"
|
|
26
29
|
],
|
|
27
30
|
"scripts": {
|
|
28
|
-
"build": "
|
|
31
|
+
"build": "vite --mode production build",
|
|
29
32
|
"build:doc": "typedoc --out dist/doc lib && touch dist/doc/.nojekyll",
|
|
30
|
-
"dev": "
|
|
31
|
-
"watch": "
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"test
|
|
33
|
+
"dev": "vite --mode development build",
|
|
34
|
+
"watch": "vite --mode development build --watch",
|
|
35
|
+
"lint": "eslint .",
|
|
36
|
+
"lint:fix": "eslint --fix .",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"test:watch": "vitest watch",
|
|
39
|
+
"test:coverage": "vitest run --coverage"
|
|
35
40
|
},
|
|
36
41
|
"repository": {
|
|
37
42
|
"type": "git",
|
|
38
|
-
"url": "https://github.com/nextcloud/nextcloud-files.git"
|
|
43
|
+
"url": "https://github.com/nextcloud-libraries/nextcloud-files.git"
|
|
39
44
|
},
|
|
40
45
|
"bugs": {
|
|
41
|
-
"url": "https://github.com/nextcloud/nextcloud-files/issues"
|
|
46
|
+
"url": "https://github.com/nextcloud-libraries/nextcloud-files/issues"
|
|
42
47
|
},
|
|
43
48
|
"engines": {
|
|
44
|
-
"node": "^
|
|
45
|
-
"npm": "^
|
|
49
|
+
"node": "^20.0.0",
|
|
50
|
+
"npm": "^9.0.0"
|
|
46
51
|
},
|
|
47
|
-
"homepage": "https://github.com/nextcloud/nextcloud-files",
|
|
52
|
+
"homepage": "https://github.com/nextcloud-libraries/nextcloud-files",
|
|
48
53
|
"devDependencies": {
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@rollup
|
|
55
|
-
"@rollup/plugin-
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"typedoc": "^0.24.1",
|
|
66
|
-
"typescript": "^5.0.3"
|
|
54
|
+
"@nextcloud/eslint-config": "^8.3.0",
|
|
55
|
+
"@nextcloud/typings": "^1.7.0",
|
|
56
|
+
"@nextcloud/vite-config": "^1.1.0",
|
|
57
|
+
"@rollup-extras/plugin-clean": "^1.3.9",
|
|
58
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
59
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
60
|
+
"@rollup/plugin-typescript": "^11.1.5",
|
|
61
|
+
"@types/node": "^20.8.10",
|
|
62
|
+
"@vitest/coverage-istanbul": "^0.34.6",
|
|
63
|
+
"fast-xml-parser": "^4.3.2",
|
|
64
|
+
"rollup": "^4.3.0",
|
|
65
|
+
"tslib": "^2.6.2",
|
|
66
|
+
"typedoc": "^0.25.3",
|
|
67
|
+
"typescript": "^5.2.2",
|
|
68
|
+
"vite": "^4.5.0",
|
|
69
|
+
"vitest": "^0.34.6"
|
|
67
70
|
},
|
|
68
71
|
"dependencies": {
|
|
69
|
-
"@nextcloud/auth": "^2.
|
|
70
|
-
"@nextcloud/l10n": "^2.
|
|
71
|
-
"@nextcloud/logger": "^2.
|
|
72
|
+
"@nextcloud/auth": "^2.2.1",
|
|
73
|
+
"@nextcloud/l10n": "^2.2.0",
|
|
74
|
+
"@nextcloud/logger": "^2.7.0",
|
|
75
|
+
"@nextcloud/paths": "^2.1.0",
|
|
76
|
+
"@nextcloud/router": "^2.2.0",
|
|
77
|
+
"is-svg": "^5.0.0",
|
|
78
|
+
"webdav": "^5.3.0"
|
|
72
79
|
}
|
|
73
80
|
}
|