@@ -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,23 +76,53 @@ 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- * @param el The DOM element to mount to
82- */
83- mount ?( el : HTMLElement ) : void
84-
8579 /**
8680 * Reset the filter to the initial state.
87- * This is called by the files app.
81+ *
8882 * 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.
8984 *
9085 * @since 3.10.0
9186 */
9287 reset ?( ) : void
9388}
9489
95- export class FileListFilter extends TypedEventTarget < IFileListFilterEvents > implements IFileListFilter {
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
101+
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 {
96126
97127 public id : string
98128
0 commit comments