@@ -54,7 +54,7 @@ interface IFileListFilterEvents {
5454 'update:chips' : FilterUpdateChipsEvent
5555}
5656
57- export interface IFileListFilter extends TypedEventTarget < IFileListFilterEvents > {
57+ export interface IFileListFilterBase extends TypedEventTarget < IFileListFilterEvents > {
5858
5959 /**
6060 * Unique ID of this filter
@@ -76,26 +76,54 @@ export interface IFileListFilter extends TypedEventTarget<IFileListFilterEvents>
7676 */
7777 filter ( nodes : INode [ ] ) : INode [ ]
7878
79- /**
80- * If the filter needs a visual element for settings it can provide a function to mount it.
81- *
82- * @param el The DOM element to mount to
83- */
84- mount ?( el : HTMLElement ) : void
85-
8679 /**
8780 * Reset the filter to the initial state.
88- * This is called by the files app.
81+ *
8982 * Implementations should make sure,that if they provide chips they need to emit the `update:chips` event.
83+ * This is called by the files app.
9084 *
9185 * @since 3.10.0
9286 */
9387 reset ?( ) : void
9488}
9589
96- export class FileListFilter extends TypedEventTarget < IFileListFilterEvents > implements IFileListFilter {
97- public id : string
90+ /**
91+ * File list filter interface with UI component
92+ *
93+ * Filters with UI must provide additional information for rendering the filter component.
94+ * The ui will be rendered depending on the view port - either as inline actions or in a dropdown menu.
95+ */
96+ export interface IFileListFilterWithUi extends IFileListFilterBase {
97+ /**
98+ * Display name of the filter
99+ */
100+ readonly displayName : string
98101
102+ /**
103+ * Inline SVG icon as string for the filter
104+ */
105+ readonly iconSvgInline : string
106+
107+ /**
108+ * Tag name of the web component to use as filter UI
109+ *
110+ * The web component must extend `HTMLElement` and accept a property `filter` of type `IFileListFilterWithUi`
111+ * (it will receive the filter instance itself).
112+ *
113+ * @see https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements
114+ */
115+ readonly tagName : string
116+ }
117+
118+ /**
119+ * File list filter interface
120+ *
121+ * Filters can either be simple filters without UI or filters with a UI component.
122+ */
123+ export type IFileListFilter = IFileListFilterBase | IFileListFilterWithUi
124+
125+ export class FileListFilter extends TypedEventTarget < IFileListFilterEvents > implements IFileListFilterBase {
126+ public id : string
99127 public order : number
100128
101129 constructor ( id : string , order : number = 100 ) {
0 commit comments