wabac.js update

url search: fix loading of additional items for mime type search, sorter optionally pages results
bump to 1.1.2-beta.1
This commit is contained in:
Ilya Kreymer
2020-10-02 16:09:28 -07:00
parent b2fcc4ced1
commit 5d44a7f8d9
7 changed files with 41 additions and 38 deletions
+6 -6
View File
@@ -4,7 +4,6 @@ import { wrapCss } from './misc';
import fasSortDown from '@fortawesome/fontawesome-free/svgs/solid/sort-down.svg';
import fasSortUp from '@fortawesome/fontawesome-free/svgs/solid/sort-up.svg';
const DEFAULT_RESULTS = 100;
// ===========================================================================
class Sorter extends LitElement
@@ -14,7 +13,8 @@ class Sorter extends LitElement
this.sortedData = [];
this.data = [];
this.numResults = DEFAULT_RESULTS;
this.pageResults = 0;
this.numResults = 0;
this.sortKey = null
this.sortDesc = null;
@@ -24,7 +24,7 @@ class Sorter extends LitElement
return {
id: { type: String },
numResults: {type: Number},
pageResults: {type: Number},
data: { type: Array },
sortedData: { type: Array },
@@ -67,7 +67,7 @@ class Sorter extends LitElement
sortData() {
this.sortedData = [...this.data];
this.numResults = DEFAULT_RESULTS;
this.numResults = this.pageResults;
if (this.sortKey === "") {
if (this.sortDesc) {
@@ -90,13 +90,13 @@ class Sorter extends LitElement
const detail = {
sortKey: this.sortKey,
sortDesc: this.sortDesc,
sortedData: this.sortedData.slice(0, this.numResults)
sortedData: this.numResults ? this.sortedData.slice(0, this.numResults) : this.sortedData
};
this.dispatchEvent(new CustomEvent("sort-changed", {detail}));
}
getMore(more = 100) {
if (this.numResults >= this.sortedData.length) {
if (this.pageResults && this.numResults >= this.sortedData.length) {
return;
}