@nextcloud/files 3.6.0 → 3.7.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/fileListFilters.d.ts +86 -0
- package/dist/index.cjs +549 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.mjs +549 -13
- package/dist/index.mjs.map +1 -1
- package/dist/navigation/index.d.ts +7 -0
- package/dist/utils/fileSorting.d.ts +2 -1
- package/dist/utils/sorting.d.ts +1 -1
- package/dist/vendor.LICENSE.txt +8 -0
- package/package.json +8 -6
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { TypedEventTarget } from 'typescript-event-target';
|
|
2
|
+
import { INode } from './files/node';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Active filters can provide one or more "chips" to show the currently active state.
|
|
6
|
+
* Must at least provide a text representing the filters state and a callback to unset that state (disable this filter).
|
|
7
|
+
*/
|
|
8
|
+
export interface IFileListFilterChip {
|
|
9
|
+
/**
|
|
10
|
+
* Text of the chip
|
|
11
|
+
*/
|
|
12
|
+
text: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional icon to be used on the chip (inline SVG as string)
|
|
15
|
+
*/
|
|
16
|
+
icon?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Handler to be called on click
|
|
19
|
+
*/
|
|
20
|
+
onclick: () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This event is emitted when the the filter value changed and the file list needs to be updated
|
|
24
|
+
*/
|
|
25
|
+
export interface FilterUpdateEvent extends CustomEvent<never> {
|
|
26
|
+
type: 'update:filter';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* This event is emitted when the the filter value changed and the file list needs to be updated
|
|
30
|
+
*/
|
|
31
|
+
export interface FilterUpdateChipsEvent extends CustomEvent<IFileListFilterChip[]> {
|
|
32
|
+
type: 'update:chips';
|
|
33
|
+
}
|
|
34
|
+
interface IFileListFilterEvents {
|
|
35
|
+
[name: string]: CustomEvent;
|
|
36
|
+
'update:filter': FilterUpdateEvent;
|
|
37
|
+
'update:chips': FilterUpdateChipsEvent;
|
|
38
|
+
}
|
|
39
|
+
export interface IFileListFilter extends TypedEventTarget<IFileListFilterEvents> {
|
|
40
|
+
/**
|
|
41
|
+
* Unique ID of this filter
|
|
42
|
+
*/
|
|
43
|
+
readonly id: string;
|
|
44
|
+
/**
|
|
45
|
+
* Order of the filter
|
|
46
|
+
*
|
|
47
|
+
* Use a low number to make this filter ordered in front.
|
|
48
|
+
*/
|
|
49
|
+
readonly order: number;
|
|
50
|
+
/**
|
|
51
|
+
* If the filter needs a visual element for settings it can provide a function to mount it.
|
|
52
|
+
*/
|
|
53
|
+
readonly mount?: (el: HTMLElement) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Filter function to decide if a node is shown
|
|
56
|
+
* @return The nodes to be shown
|
|
57
|
+
*/
|
|
58
|
+
filter(node: INode[]): INode[];
|
|
59
|
+
}
|
|
60
|
+
export declare class FileListFilter extends TypedEventTarget<IFileListFilterEvents> implements IFileListFilter {
|
|
61
|
+
id: string;
|
|
62
|
+
order: number;
|
|
63
|
+
constructor(id: string, order?: number);
|
|
64
|
+
filter(nodes: INode[]): INode[];
|
|
65
|
+
protected updateChips(chips: IFileListFilterChip[]): void;
|
|
66
|
+
protected filterUpdated(): void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Register a new filter on the file list
|
|
70
|
+
*
|
|
71
|
+
* This only must be called once to register the filter,
|
|
72
|
+
* when the filter state changes you need to call `filterUpdated` on the filter instead.
|
|
73
|
+
*
|
|
74
|
+
* @param filter The filter to register on the file list
|
|
75
|
+
*/
|
|
76
|
+
export declare function registerFileListFilter(filter: IFileListFilter): void;
|
|
77
|
+
/**
|
|
78
|
+
* Remove a registered filter from the file list
|
|
79
|
+
* @param filterId The unique ID of the filter to remove
|
|
80
|
+
*/
|
|
81
|
+
export declare function unregisterFileListFilter(filterId: string): void;
|
|
82
|
+
/**
|
|
83
|
+
* Get all registered file list filters
|
|
84
|
+
*/
|
|
85
|
+
export declare function getFileListFilters(): IFileListFilter[];
|
|
86
|
+
export {};
|