@nextcloud/files 3.3.0 → 3.4.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/dist/files/node.d.ts +3 -2
- package/dist/index.cjs +189 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +190 -85
- package/dist/index.mjs.map +1 -1
- package/dist/utils/fileSorting.d.ts +34 -0
- package/dist/utils/sorting.d.ts +12 -0
- package/dist/vendor.LICENSE.txt +1 -1
- package/package.json +3 -3
- /package/dist/{humanfilesize.d.ts → utils/fileSize.d.ts} +0 -0
- /package/dist/{filename.d.ts → utils/filename.d.ts} +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Node } from '../files/node';
|
|
2
|
+
|
|
3
|
+
export declare enum FilesSortingMode {
|
|
4
|
+
Name = "basename",
|
|
5
|
+
Modified = "mtime",
|
|
6
|
+
Size = "size"
|
|
7
|
+
}
|
|
8
|
+
export interface FilesSortingOptions {
|
|
9
|
+
/**
|
|
10
|
+
* They key to order the files by
|
|
11
|
+
* @default FilesSortingMode.Name
|
|
12
|
+
*/
|
|
13
|
+
sortingMode?: FilesSortingMode;
|
|
14
|
+
/**
|
|
15
|
+
* @default 'asc'
|
|
16
|
+
*/
|
|
17
|
+
sortingOrder?: 'asc' | 'desc';
|
|
18
|
+
/**
|
|
19
|
+
* If set to true nodes marked as favorites are ordered on top of all other nodes
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
sortFavoritesFirst?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* If set to true folders are ordered on top of files
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
sortFoldersFirst?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Sort files and folders according to the sorting options
|
|
31
|
+
* @param nodes Nodes to sort
|
|
32
|
+
* @param options Sorting options
|
|
33
|
+
*/
|
|
34
|
+
export declare function sortNodes(nodes: Node[], options?: FilesSortingOptions): Node[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type IdentifierFn<T> = (v: T) => unknown;
|
|
2
|
+
type SortingOrder = 'asc' | 'desc';
|
|
3
|
+
/**
|
|
4
|
+
* Natural order a collection
|
|
5
|
+
* You can define identifiers as callback functions, that get the element and return the value to sort.
|
|
6
|
+
*
|
|
7
|
+
* @param collection The collection to order
|
|
8
|
+
* @param identifiers An array of identifiers to use, by default the identity of the element is used
|
|
9
|
+
* @param orders Array of orders, by default all identifiers are sorted ascening
|
|
10
|
+
*/
|
|
11
|
+
export declare function orderBy<T>(collection: readonly T[], identifiers?: IdentifierFn<T>[], orders?: SortingOrder[]): T[];
|
|
12
|
+
export {};
|
package/dist/vendor.LICENSE.txt
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextcloud/files",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Nextcloud files utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://github.com/nextcloud-libraries/nextcloud-files",
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@codecov/vite-plugin": "^0.0.1-beta.
|
|
54
|
+
"@codecov/vite-plugin": "^0.0.1-beta.8",
|
|
55
55
|
"@nextcloud/eslint-config": "^8.4.1",
|
|
56
56
|
"@nextcloud/typings": "^1.8.0",
|
|
57
57
|
"@nextcloud/vite-config": "^2.0.0",
|
|
58
58
|
"@types/node": "^20.12.12",
|
|
59
59
|
"@vitest/coverage-istanbul": "^1.6.0",
|
|
60
|
-
"fast-xml-parser": "^4.
|
|
60
|
+
"fast-xml-parser": "^4.4.0",
|
|
61
61
|
"jsdom": "^24.0.0",
|
|
62
62
|
"tslib": "^2.6.2",
|
|
63
63
|
"typedoc": "^0.25.13",
|
|
File without changes
|
|
File without changes
|