diff --git a/README.md b/README.md
index 1ab27b7..06a19e8 100644
--- a/README.md
+++ b/README.md
@@ -1 +1 @@
-# tp-element
+# tp-table
diff --git a/column-resizer.js b/column-resizer.js
new file mode 100644
index 0000000..05eb9e6
--- /dev/null
+++ b/column-resizer.js
@@ -0,0 +1,68 @@
+export default class ColumResizer {
+ constructor(wrap, handleSelector) {
+ this._handleSelector = handleSelector;
+ this._mouseDown = this._mouseDown.bind(this);
+ this._dragging = this._dragging.bind(this);
+ this._draggingEnd = this._draggingEnd.bind(this);
+ this._trackingStarted = false;
+
+ // Amount of pixels the handle must be moved before its registered as a tracking gesture.
+ this.threshold = 5;
+
+ wrap.addEventListener('mousedown', this._mouseDown);
+ }
+
+ _mouseDown(e) {
+ const handle = e.composedPath().find(node => node.matches && node.matches(this._handleSelector));
+ if (!handle) return;
+
+ this._cHandle = handle;
+ this._startX = e.pageX;
+ this._watchDrag();
+ }
+
+ _watchDrag() {
+ window.addEventListener('mousemove', this._dragging);
+ window.addEventListener('mouseup', this._draggingEnd);
+ }
+
+ _stopWatchDrag() {
+ window.removeEventListener('mousemove', this._dragging);
+ window.removeEventListener('mouseup', this._draggingEnd);
+ }
+
+ _dragging(e) {
+ this._dx = e.pageX - this._startX;
+
+ if (this._trackingStarted === false && Math.abs(this._dx) >= this.threshold) {
+ this._trackingStarted = true;
+ this._clearSelection();
+ this._cHandle.dispatchEvent(new CustomEvent('track', { detail: { state: 'start', dx: this._dx }, bubbles: true, composed: true }));
+ }
+
+ if (this._trackingStarted === true) {
+ this._cHandle.dispatchEvent(new CustomEvent('track', { detail: { state: 'track', dx: this._dx }, bubbles: true, composed: true }));
+ }
+ }
+
+ _draggingEnd(e) {
+ this._dx = e.pageX - this._startX;
+ this._trackingStarted = false;
+ this._cHandle.dispatchEvent(new CustomEvent('track', { detail: { state: 'end', dx: this._dx }, bubbles: true, composed: true }));
+ this._stopWatchDrag();
+ this._cHandle = null;
+ this._startX = 0;
+ this._clearSelection();
+ }
+
+ _clearSelection() {
+ const sel = window.getSelection ? window.getSelection() : document.selection;
+ if (sel) {
+ if (sel.removeAllRanges) {
+ sel.removeAllRanges();
+ } else if (sel.empty) {
+ sel.empty();
+ }
+ }
+ }
+}
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..c131fe4
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,235 @@
+{
+ "name": "@tp/tp-table",
+ "version": "1.0.0",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "@tp/tp-table",
+ "version": "1.0.0",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@lit-labs/virtualizer": "^0.7.0",
+ "@tp/helpers": "^1.1.3",
+ "@tp/tp-checkbox": "^1.0.4",
+ "@tp/tp-icon": "^1.0.1",
+ "@tp/tp-scroll-threshold": "^1.0.0",
+ "lit": "^2.2.6"
+ }
+ },
+ "node_modules/@lit-labs/virtualizer": {
+ "version": "0.7.0",
+ "resolved": "https://verdaccio.codeblob.work/@lit-labs%2fvirtualizer/-/virtualizer-0.7.0.tgz",
+ "integrity": "sha512-4h/TGmabGoo81EysUR9AV+fBeYHHvcgs0knmZDUQ5QRP49PM8k5mNnMfPBL7fxYErZrl0cUiNewg101q5zOitg==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "event-target-shim": "^5.0.1",
+ "lit": "^2.0.0",
+ "tslib": "^1.10.0"
+ }
+ },
+ "node_modules/@lit/reactive-element": {
+ "version": "1.3.2",
+ "resolved": "https://verdaccio.codeblob.work/@lit%2freactive-element/-/reactive-element-1.3.2.tgz",
+ "integrity": "sha512-A2e18XzPMrIh35nhIdE4uoqRzoIpEU5vZYuQN4S3Ee1zkGdYC27DP12pewbw/RLgPHzaE4kx/YqxMzebOpm0dA==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@tp/helpers": {
+ "version": "1.1.3",
+ "resolved": "https://verdaccio.codeblob.work/@tp%2fhelpers/-/helpers-1.1.3.tgz",
+ "integrity": "sha512-WDj3meXgCjF9/4eyPQMk2YEderVDUD3IVJrjds0i4seABVI5yyaMWVNtxxH+w8O9eIDgwxiuyQqaI7bdyNaCoA==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/@tp/tp-checkbox": {
+ "version": "1.0.4",
+ "resolved": "https://verdaccio.codeblob.work/@tp%2ftp-checkbox/-/tp-checkbox-1.0.4.tgz",
+ "integrity": "sha512-6pa7rS8sTi4b2EKgSIfeqgjMRXixt9PnehaPN6mOPW83BBivXuF1rtMwzjc38xNiqesyis0uhcJApTCyh3hA+A==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@tp/helpers": "^1.1.3",
+ "@tp/tp-icon": "^1.0.1",
+ "lit": "^2.2.0"
+ }
+ },
+ "node_modules/@tp/tp-icon": {
+ "version": "1.0.1",
+ "resolved": "https://verdaccio.codeblob.work/@tp%2ftp-icon/-/tp-icon-1.0.1.tgz",
+ "integrity": "sha512-rBbQoXZ5t35F7yIbPAEGAlDscZhxLZ5/o229kyiBBrXvCrc+aVOsetSwF1jPeBSmb57h2PfinIvQhtMARwWHoA==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@tp/tp-tooltip": "^1.0.0",
+ "lit": "^2.2.0"
+ }
+ },
+ "node_modules/@tp/tp-scroll-threshold": {
+ "version": "1.0.0",
+ "resolved": "https://verdaccio.codeblob.work/@tp%2ftp-scroll-threshold/-/tp-scroll-threshold-1.0.0.tgz",
+ "integrity": "sha512-8azYxjw9P1y5j9FLt6MVjzIBpG8vV8B6es0k2zeHf1CJJ7I/o+nRI+LOlfMoeU491bMZpgBdJHZqeNHLO5RyWw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "lit": "^2.2.0"
+ }
+ },
+ "node_modules/@tp/tp-tooltip": {
+ "version": "1.0.0",
+ "resolved": "https://verdaccio.codeblob.work/@tp%2ftp-tooltip/-/tp-tooltip-1.0.0.tgz",
+ "integrity": "sha512-UtrIK5KWcEiC+HnHOVbgg90j4RjHn3e9ehOBYPZsm6zO+tT7pQJJYFOtJqBW+DDV7jVfH3AvGKCxtzNiJXYvDw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@tp/helpers": "^1.0.0",
+ "lit": "^2.2.0"
+ }
+ },
+ "node_modules/@types/trusted-types": {
+ "version": "2.0.2",
+ "resolved": "https://verdaccio.codeblob.work/@types%2ftrusted-types/-/trusted-types-2.0.2.tgz",
+ "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==",
+ "license": "MIT"
+ },
+ "node_modules/event-target-shim": {
+ "version": "5.0.1",
+ "resolved": "https://verdaccio.codeblob.work/event-target-shim/-/event-target-shim-5.0.1.tgz",
+ "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/lit": {
+ "version": "2.2.6",
+ "resolved": "https://verdaccio.codeblob.work/lit/-/lit-2.2.6.tgz",
+ "integrity": "sha512-K2vkeGABfSJSfkhqHy86ujchJs3NR9nW1bEEiV+bXDkbiQ60Tv5GUausYN2mXigZn8lC1qXuc46ArQRKYmumZw==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@lit/reactive-element": "^1.3.0",
+ "lit-element": "^3.2.0",
+ "lit-html": "^2.2.0"
+ }
+ },
+ "node_modules/lit-element": {
+ "version": "3.2.0",
+ "resolved": "https://verdaccio.codeblob.work/lit-element/-/lit-element-3.2.0.tgz",
+ "integrity": "sha512-HbE7yt2SnUtg5DCrWt028oaU4D5F4k/1cntAFHTkzY8ZIa8N0Wmu92PxSxucsQSOXlODFrICkQ5x/tEshKi13g==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@lit/reactive-element": "^1.3.0",
+ "lit-html": "^2.2.0"
+ }
+ },
+ "node_modules/lit-html": {
+ "version": "2.2.6",
+ "resolved": "https://verdaccio.codeblob.work/lit-html/-/lit-html-2.2.6.tgz",
+ "integrity": "sha512-xOKsPmq/RAKJ6dUeOxhmOYFjcjf0Q7aSdfBJgdJkOfCUnkmmJPxNrlZpRBeVe1Gg50oYWMlgm6ccAE/SpJgSdw==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@types/trusted-types": "^2.0.2"
+ }
+ },
+ "node_modules/tslib": {
+ "version": "1.14.1",
+ "resolved": "https://verdaccio.codeblob.work/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
+ "license": "0BSD"
+ }
+ },
+ "dependencies": {
+ "@lit-labs/virtualizer": {
+ "version": "0.7.0",
+ "resolved": "https://verdaccio.codeblob.work/@lit-labs%2fvirtualizer/-/virtualizer-0.7.0.tgz",
+ "integrity": "sha512-4h/TGmabGoo81EysUR9AV+fBeYHHvcgs0knmZDUQ5QRP49PM8k5mNnMfPBL7fxYErZrl0cUiNewg101q5zOitg==",
+ "requires": {
+ "event-target-shim": "^5.0.1",
+ "lit": "^2.0.0",
+ "tslib": "^1.10.0"
+ }
+ },
+ "@lit/reactive-element": {
+ "version": "1.3.2",
+ "resolved": "https://verdaccio.codeblob.work/@lit%2freactive-element/-/reactive-element-1.3.2.tgz",
+ "integrity": "sha512-A2e18XzPMrIh35nhIdE4uoqRzoIpEU5vZYuQN4S3Ee1zkGdYC27DP12pewbw/RLgPHzaE4kx/YqxMzebOpm0dA=="
+ },
+ "@tp/helpers": {
+ "version": "1.1.3",
+ "resolved": "https://verdaccio.codeblob.work/@tp%2fhelpers/-/helpers-1.1.3.tgz",
+ "integrity": "sha512-WDj3meXgCjF9/4eyPQMk2YEderVDUD3IVJrjds0i4seABVI5yyaMWVNtxxH+w8O9eIDgwxiuyQqaI7bdyNaCoA=="
+ },
+ "@tp/tp-checkbox": {
+ "version": "1.0.4",
+ "resolved": "https://verdaccio.codeblob.work/@tp%2ftp-checkbox/-/tp-checkbox-1.0.4.tgz",
+ "integrity": "sha512-6pa7rS8sTi4b2EKgSIfeqgjMRXixt9PnehaPN6mOPW83BBivXuF1rtMwzjc38xNiqesyis0uhcJApTCyh3hA+A==",
+ "requires": {
+ "@tp/helpers": "^1.1.3",
+ "@tp/tp-icon": "^1.0.1",
+ "lit": "^2.2.0"
+ }
+ },
+ "@tp/tp-icon": {
+ "version": "1.0.1",
+ "resolved": "https://verdaccio.codeblob.work/@tp%2ftp-icon/-/tp-icon-1.0.1.tgz",
+ "integrity": "sha512-rBbQoXZ5t35F7yIbPAEGAlDscZhxLZ5/o229kyiBBrXvCrc+aVOsetSwF1jPeBSmb57h2PfinIvQhtMARwWHoA==",
+ "requires": {
+ "@tp/tp-tooltip": "^1.0.0",
+ "lit": "^2.2.0"
+ }
+ },
+ "@tp/tp-scroll-threshold": {
+ "version": "1.0.0",
+ "resolved": "https://verdaccio.codeblob.work/@tp%2ftp-scroll-threshold/-/tp-scroll-threshold-1.0.0.tgz",
+ "integrity": "sha512-8azYxjw9P1y5j9FLt6MVjzIBpG8vV8B6es0k2zeHf1CJJ7I/o+nRI+LOlfMoeU491bMZpgBdJHZqeNHLO5RyWw==",
+ "requires": {
+ "lit": "^2.2.0"
+ }
+ },
+ "@tp/tp-tooltip": {
+ "version": "1.0.0",
+ "resolved": "https://verdaccio.codeblob.work/@tp%2ftp-tooltip/-/tp-tooltip-1.0.0.tgz",
+ "integrity": "sha512-UtrIK5KWcEiC+HnHOVbgg90j4RjHn3e9ehOBYPZsm6zO+tT7pQJJYFOtJqBW+DDV7jVfH3AvGKCxtzNiJXYvDw==",
+ "requires": {
+ "@tp/helpers": "^1.0.0",
+ "lit": "^2.2.0"
+ }
+ },
+ "@types/trusted-types": {
+ "version": "2.0.2",
+ "resolved": "https://verdaccio.codeblob.work/@types%2ftrusted-types/-/trusted-types-2.0.2.tgz",
+ "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg=="
+ },
+ "event-target-shim": {
+ "version": "5.0.1",
+ "resolved": "https://verdaccio.codeblob.work/event-target-shim/-/event-target-shim-5.0.1.tgz",
+ "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
+ },
+ "lit": {
+ "version": "2.2.6",
+ "resolved": "https://verdaccio.codeblob.work/lit/-/lit-2.2.6.tgz",
+ "integrity": "sha512-K2vkeGABfSJSfkhqHy86ujchJs3NR9nW1bEEiV+bXDkbiQ60Tv5GUausYN2mXigZn8lC1qXuc46ArQRKYmumZw==",
+ "requires": {
+ "@lit/reactive-element": "^1.3.0",
+ "lit-element": "^3.2.0",
+ "lit-html": "^2.2.0"
+ }
+ },
+ "lit-element": {
+ "version": "3.2.0",
+ "resolved": "https://verdaccio.codeblob.work/lit-element/-/lit-element-3.2.0.tgz",
+ "integrity": "sha512-HbE7yt2SnUtg5DCrWt028oaU4D5F4k/1cntAFHTkzY8ZIa8N0Wmu92PxSxucsQSOXlODFrICkQ5x/tEshKi13g==",
+ "requires": {
+ "@lit/reactive-element": "^1.3.0",
+ "lit-html": "^2.2.0"
+ }
+ },
+ "lit-html": {
+ "version": "2.2.6",
+ "resolved": "https://verdaccio.codeblob.work/lit-html/-/lit-html-2.2.6.tgz",
+ "integrity": "sha512-xOKsPmq/RAKJ6dUeOxhmOYFjcjf0Q7aSdfBJgdJkOfCUnkmmJPxNrlZpRBeVe1Gg50oYWMlgm6ccAE/SpJgSdw==",
+ "requires": {
+ "@types/trusted-types": "^2.0.2"
+ }
+ },
+ "tslib": {
+ "version": "1.14.1",
+ "resolved": "https://verdaccio.codeblob.work/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
+ }
+ }
+}
diff --git a/package.json b/package.json
index c39fdff..6b1dba7 100644
--- a/package.json
+++ b/package.json
@@ -1,18 +1,23 @@
{
- "name": "@tp/tp-element",
- "version": "0.0.1",
+ "name": "@tp/tp-table",
+ "version": "1.0.0",
"description": "",
- "main": "tp-element.js",
+ "main": "tp-table.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
- "url": "https://gitea.codeblob.work/tp-elements/tp-element.git"
+ "url": "https://gitea.codeblob.work/tp-elements/tp-table.git"
},
"author": "trading_peter",
"license": "Apache-2.0",
"dependencies": {
- "lit": "^2.2.0"
+ "@lit-labs/virtualizer": "^0.7.0",
+ "@tp/helpers": "^1.1.3",
+ "@tp/tp-checkbox": "^1.0.4",
+ "@tp/tp-icon": "^1.0.1",
+ "@tp/tp-scroll-threshold": "^1.0.0",
+ "lit": "^2.2.6"
}
}
diff --git a/pagination.js b/pagination.js
new file mode 100644
index 0000000..c362fd3
--- /dev/null
+++ b/pagination.js
@@ -0,0 +1,226 @@
+/**
+@license
+Copyright (c) 2022 trading_peter
+This program is available under Apache License Version 2.0
+*/
+
+import { Debouncer } from '@polymer/polymer/lib/utils/debounce.js';
+import { Helper } from '@era-core/era-mixins/era-helper-mixin.js';
+import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
+import { timeOut } from '@polymer/polymer/lib/utils/async.js';
+
+/**
+ * # ListLoader
+ *
+ * Methods to load list contents page by page.
+ *
+ * @polymerBehavior ListLoader
+ */
+export const Pagination = dedupingMixin(function(superClass) {
+ return class extends Helper(superClass) {
+ static get properties() {
+ return {
+ _entries: { type: Array },
+ _entriesSet: { type: Object },
+ _page: { type: Number },
+ _filter: { type: String },
+ _filterPage: { type: Number },
+ _limit: { type: Number }
+ };
+ }
+
+ constructor() {
+ super();
+
+ this._entries = [];
+ this._entriesSet = new Set();
+ this._page = 1;
+ this._filterPage = 1;
+ this._limit = 350;
+ }
+
+ _fetch(query, cb) {
+ // Override
+ }
+
+ _isInFlight() {
+ // Override
+ }
+
+ get _hasFilter() {
+ return typeof this._filter === 'string' && this._filter.length > 0;
+ }
+
+ _reloadList() {
+ this._resetList();
+ this.__currentPage = 0;
+ this._lastPage = false;
+ this._listStateChanged();
+ }
+
+ _listStateChanged() {
+ if (this._hasFilter) {
+ this._fetchFiltered();
+ } else {
+ this._fetchPage();
+ }
+ }
+
+ _scrollThresholdTriggered(e) {
+ if (this.active && this._listOverflows()) {
+ this.__list = e.composedPath()[0].scrollTarget;
+ this.__listScrollOffset = this.__list.scrollTop;
+
+ if (this._hasFilter) {
+ this._filterPage++;
+ this._fetchFiltered();
+ } else {
+ this._page++;
+ this._fetchPage();
+ }
+ }
+ }
+
+ _resetList() {
+ if (typeof this.setProperties === 'function') {
+ this.setProperties({ _page: 1, _filterPage: 1, _entries: [] });
+ } else {
+ this._page = 1;
+ this._filterPage = 1;
+ this._entries = [];
+ }
+ }
+
+ _shouldFetch() {
+ if (this._page === undefined || this._limit === undefined) return false;
+ const pageChanged = this._page !== this.__currentPage;
+
+ let optionsChanged = false;
+ optionsChanged = JSON.stringify(this._statusFilter) !== JSON.stringify(this.__currentStatusFilter) || optionsChanged;
+ optionsChanged = JSON.stringify(this._sorting) !== JSON.stringify(this.__currentSorting) || optionsChanged;
+
+ this.__currentStatusFilter = this._statusFilter;
+ this.__currentSorting = this._sorting;
+
+ if (optionsChanged === true) {
+ this._resetList();
+ }
+
+ if ((pageChanged === false || this._lastPage || this._isInFlight()) && optionsChanged === false) return false;
+
+ return true;
+ }
+
+ _fetchPage() {
+ this._filterDebouncer = Debouncer.debounce(
+ this._filterDebouncer,
+ timeOut.after(20),
+ () => {
+ if (this._shouldFetch() === false) return;
+
+ this._fetch({ page: this._page, limit: this._limit, options: { statusFilter: this._statusFilter, sorting: this._sorting } }, (docs, pages) => {
+ if (this._page === 1) {
+ this._entriesSet = new Set();
+ }
+
+ docs = docs.filter(doc => this._entriesSet.has(doc._id) === false);
+ docs.forEach(doc => this._entriesSet.add(doc._id));
+
+ if (this._page === 1) {
+ this._entries = docs;
+ } else {
+ this._entries = this._entries.concat(docs);
+ }
+
+ // Restore scrolling position in the list.
+ if (this.__list !== undefined) {
+ this.__list.scrollTop = this.__listScrollOffset || 0;
+ }
+
+ this.__currentPage = this._page;
+
+ // Check if we reached the last page.
+ this._lastPage = pages <= this._page;
+
+ // Clear scroll threshold so the next page can be loaded.
+ this.clearTriggers();
+
+ this.__fillList();
+ });
+ }
+ );
+ }
+
+ _fetchFiltered() {
+ this._filterDebouncer = Debouncer.debounce(
+ this._filterDebouncer,
+ timeOut.after(300),
+ () => {
+ if (!this._hasFilter) {
+ this._lastPage = false;
+ this.__currentPage = false;
+ this._lastFilter = null;
+ this._page = 1;
+ this._filterPage = 1;
+ this.__listScrollOffset = 0;
+ this._fetchPage();
+ return;
+ }
+
+ if (this._shouldFetch() === false && this._lastPage === true && this._filter === this._lastFilter) return;
+
+ if (this._filter !== this._lastFilter) {
+ this._filterPage = 1;
+ }
+
+ this._lastFilter = this._filter;
+
+ this._fetch({ filter: this._filter, page: this._filterPage, limit: this._limit, options: {
+ statusFilter: this._statusFilter,
+ sorting: this._sorting
+ } }, (result, resp) => {
+ if (resp && resp.statusCode === 200) {
+ if (this._filterPage === 1) {
+ this._entries = result.entries.map(entry => entry.doc);
+ } else {
+ this._entries = this._entries.concat(result.entries.map(entry => entry.doc));
+ }
+
+ // Restore scrolling position in the list.
+ if (this.__list !== undefined) {
+ this.__list.scrollTop = this.__listScrollOffset || 0;
+ }
+
+ // Check if we reached the last page.
+ this._lastPage = result.pages <= this._filterPage || result.pages === 0;
+
+ // Clear scroll threshold so the next page can be loaded.
+ this.clearTriggers();
+
+ this.__fillList();
+ }
+ });
+ }
+ );
+ }
+
+ // Load pages until the list fills the screen.
+ // We check the list height after next render to see if the list already fills the screen.
+ // If not, load the next page.
+ // This needs to be triggered async so that the current `_fetchPage` request
+ // is finished and no longer considered "in flight".
+ __fillList() {
+ if (!this._lastPage && !this.listOverflows()) {
+ setTimeout(() => {
+ if (this._hasFilter) {
+ this._filterPage++;
+ this._fetchFiltered();
+ } else {
+ this._page++;
+ this._fetchPage();
+ }
+ });
+ }
+ }
+ };
+});
diff --git a/tp-table-item.js b/tp-table-item.js
new file mode 100644
index 0000000..87adc7a
--- /dev/null
+++ b/tp-table-item.js
@@ -0,0 +1,135 @@
+/**
+@license
+Copyright (c) 2021 EDV Wasmeier
+*/
+
+import '@tp/tp-checkbox/tp-checkbox.js';
+import { LitElement, html, css } from 'lit';
+import { DomQuery } from '@tp/helpers/dom-query.js';
+
+/**
+# ef-base-table-item
+
+## Example
+```html
+
No
`; } @@ -32,4 +33,4 @@ class TpElement extends LitElement { } -window.customElements.define('tp-element', TpElement); +window.customElements.define('tp-text-filter', TpTextFilter); \ No newline at end of file