diff --git a/frontend/src/utils/async-table/async-table.ts b/frontend/src/utils/async-table/async-table.ts index 617c88d72..78d3fe5a0 100644 --- a/frontend/src/utils/async-table/async-table.ts +++ b/frontend/src/utils/async-table/async-table.ts @@ -27,10 +27,25 @@ const ASYNC_TABLE_LOADING_CLASS = 'async-table--loading'; const ASYNC_TABLE_FILTER_FORM_SELECTOR = '.table-filter-form'; -@Utility({ - selector: '[uw-async-table]', -}) -export class AsyncTable { +class FilterInputs { + search : any[]; + input: any[]; + change: any[]; + select: any[]; + + constructor() { + this.search = []; + this.input = []; + this.change = []; + this.select = []; + } + + entries() { + return this.search.concat(this.input.concat(this.change.concat(this.select))); + } + +} +abstract class TableUtil { _element; _app; @@ -48,12 +63,8 @@ export class AsyncTable { _cancelPendingUpdates = []; - _tableFilterInputs = { - search: [], - input: [], - change: [], - select: [], - }; + _tableFilterInputs = new FilterInputs(); + _ignoreRequest = false; _windowStorage; @@ -62,13 +73,12 @@ export class AsyncTable { _active = true; constructor(element, app) { - alert("async table constructor"); if (!element) { - throw new Error('Async Table utility cannot be setup without an element!'); + throw new Error('Table utility cannot be setup without an element!'); } if (!app) { - throw new Error('Async Table utility cannot be setup without an app!'); + throw new Error('Table utility cannot be setup without an app!'); } this._element = element; @@ -87,7 +97,7 @@ export class AsyncTable { const table = this._element.querySelector('table, .div__course-teaser'); if (!table) { - throw new Error('Async Table utility needs a