kopia lustrzana https://github.com/simonw/datasette
Wide tables now scroll horizontally, refs #998
rodzic
6e26b05799
commit
20f8659e2a
|
@ -41,6 +41,9 @@ table a:link {
|
||||||
table a:visited {
|
table a:visited {
|
||||||
color: #8f54c4;
|
color: #8f54c4;
|
||||||
}
|
}
|
||||||
|
.table-wrapper {
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
.small-screen-only,
|
.small-screen-only,
|
||||||
.select-wrapper.small-screen-only {
|
.select-wrapper.small-screen-only {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
@ -50,9 +50,17 @@ var DROPDOWN_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="14" heig
|
||||||
params.set(`${column}__notblank`, '1');
|
params.set(`${column}__notblank`, '1');
|
||||||
return paramsToUrl(params);
|
return paramsToUrl(params);
|
||||||
}
|
}
|
||||||
function isFacetedBy(column) {
|
function closeMenu() {
|
||||||
return getParams().getAll('_facet').includes(column);
|
menu.style.display = 'none';
|
||||||
|
menu.classList.remove('anim-scale-in');
|
||||||
}
|
}
|
||||||
|
// When page loads, add scroll listener on .table-wrapper
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
var tableWrapper = document.querySelector('.table-wrapper');
|
||||||
|
if (tableWrapper) {
|
||||||
|
tableWrapper.addEventListener('scroll', closeMenu);
|
||||||
|
}
|
||||||
|
});
|
||||||
document.body.addEventListener('click', (ev) => {
|
document.body.addEventListener('click', (ev) => {
|
||||||
/* was this click outside the menu? */
|
/* was this click outside the menu? */
|
||||||
var target = ev.target;
|
var target = ev.target;
|
||||||
|
@ -60,8 +68,7 @@ var DROPDOWN_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="14" heig
|
||||||
target = target.parentNode;
|
target = target.parentNode;
|
||||||
}
|
}
|
||||||
if (!target) {
|
if (!target) {
|
||||||
menu.style.display = 'none';
|
closeMenu();
|
||||||
menu.classList.remove('anim-scale-in');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
function iconClicked(ev) {
|
function iconClicked(ev) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{% if display_rows %}
|
{% if display_rows %}
|
||||||
|
<div class="table-wrapper">
|
||||||
<table class="rows-and-columns">
|
<table class="rows-and-columns">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -27,6 +28,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="zero-results">0 records</p>
|
<p class="zero-results">0 records</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Ładowanie…
Reference in New Issue