fix resize on tolims page
This commit is contained in:
parent
28a708dad3
commit
cb38bfb75a
@ -2016,6 +2016,51 @@ function resolveFixedValue(string $key, $val, array $fixedLookup): string {
|
||||
el.addEventListener('change', () => el.classList.toggle('has-value', el.value.trim() !== ''));
|
||||
});
|
||||
})();
|
||||
|
||||
// ── Column resize ──
|
||||
(function() {
|
||||
const resizers = document.querySelectorAll('.resizer');
|
||||
let currentResizer = null, startX = 0, startWidth = 0, columnIndex = null;
|
||||
|
||||
function resize(e) {
|
||||
if (!currentResizer || columnIndex === null) return;
|
||||
const newWidth = Math.max(80, startWidth + (e.pageX - startX));
|
||||
const sel = '[data-index="' + columnIndex + '"]';
|
||||
const header = document.querySelector('.grid-header' + sel);
|
||||
if (header) header.style.flex = '0 0 ' + newWidth + 'px';
|
||||
const topCell = document.querySelector('.grid-top .grid-cell' + sel);
|
||||
if (topCell) topCell.style.flex = '0 0 ' + newWidth + 'px';
|
||||
document.querySelectorAll('.grid-row .grid-cell' + sel).forEach(function(cell) {
|
||||
cell.style.flex = '0 0 ' + newWidth + 'px';
|
||||
});
|
||||
var filterCell = document.querySelector('#gridFilterRow > .grid-cell:nth-child(' + (parseInt(columnIndex, 10) + 1) + ')');
|
||||
if (filterCell) filterCell.style.flex = '0 0 ' + newWidth + 'px';
|
||||
}
|
||||
|
||||
function stopResize() {
|
||||
if (currentResizer) {
|
||||
document.removeEventListener('mousemove', resize);
|
||||
document.removeEventListener('mouseup', stopResize);
|
||||
currentResizer = null;
|
||||
columnIndex = null;
|
||||
}
|
||||
}
|
||||
|
||||
resizers.forEach(function(resizer) {
|
||||
resizer.addEventListener('mousedown', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
currentResizer = this;
|
||||
var header = this.closest('.grid-header');
|
||||
if (!header) return;
|
||||
columnIndex = header.getAttribute('data-index');
|
||||
startX = e.pageX;
|
||||
startWidth = header.offsetWidth;
|
||||
document.addEventListener('mousemove', resize);
|
||||
document.addEventListener('mouseup', stopResize);
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user