Release v2.2.0
This commit is contained in:
@@ -15,6 +15,35 @@
|
||||
if (typeof window.initLocalDateTimes === 'function') {
|
||||
window.initLocalDateTimes(container);
|
||||
}
|
||||
|
||||
syncTablePaginationCards(container);
|
||||
syncTablePaginationPageClass();
|
||||
}
|
||||
|
||||
function syncTablePaginationCards(root) {
|
||||
if (!root || !root.querySelectorAll) {
|
||||
return;
|
||||
}
|
||||
|
||||
Array.prototype.forEach.call(root.querySelectorAll('[data-table-pagination-card]'), function (card) {
|
||||
if (!card || !card.getBoundingClientRect) {
|
||||
return;
|
||||
}
|
||||
|
||||
var cardRect = card.getBoundingClientRect();
|
||||
var bottomInset = 16;
|
||||
var availableHeight = Math.max(0, window.innerHeight - cardRect.top - bottomInset);
|
||||
card.style.removeProperty('--table-pagination-card-height');
|
||||
card.style.setProperty('--table-pagination-card-max-height', availableHeight + 'px');
|
||||
});
|
||||
}
|
||||
|
||||
function syncTablePaginationPageClass() {
|
||||
if (!document || !document.body || !document.body.classList) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.body.classList.toggle('table-pagination-page', !!document.querySelector('[data-table-pagination-card]'));
|
||||
}
|
||||
|
||||
function focusSearchInput(input) {
|
||||
@@ -163,8 +192,21 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
syncTablePaginationCards(scope);
|
||||
}
|
||||
|
||||
if (window.addEventListener) {
|
||||
window.addEventListener('resize', function () {
|
||||
syncTablePaginationCards(document);
|
||||
});
|
||||
window.addEventListener('orientationchange', function () {
|
||||
syncTablePaginationCards(document);
|
||||
});
|
||||
}
|
||||
|
||||
window.initTableSearches = initTableSearches;
|
||||
window.replaceTableResults = replaceTableResults;
|
||||
syncTablePaginationCards(document);
|
||||
syncTablePaginationPageClass();
|
||||
}());
|
||||
Reference in New Issue
Block a user