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
+1
View File
@@ -600,6 +600,7 @@ class Pages extends LitElement
.sortDesc="${this.sortDesc}"
.sortKeys="${Pages.sortKeys}"
.data="${this.filteredPages}"
pageResults="100"
@sort-changed="${this.onSortChanged}"
class="${this.filteredPages.length ? '' : 'is-hidden'}">
</wr-sorter>
+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;
}
+1
View File
@@ -166,6 +166,7 @@ class URLResources extends LitElement
const last = this.results[this.results.length - 1];
params.set("fromMime", last.mime);
params.set("fromUrl", last.url);
params.set("fromStatus", last.status);
params.set("fromTs", new Date(last.date).getTime());
}