sqlui 0.1.55 → 0.1.56
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.release-version +1 -1
- data/client/resources/sqlui.css +0 -1
- data/client/resources/sqlui.js +99 -88
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54098affe9aed43da3e5cfb8ac348989f4965f790ecdfec200ec9e79d3b7b532
|
4
|
+
data.tar.gz: cd5b2dea4f9f7afc1a465e6c6d68f8e84982547032e90fd5f979c4f6f72eb452
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9444bf4a2cb0bb5d9f397d2ed6ad0ef212846db09172314083f7f951f3a1e58ec9965f1b6f08432ce74739cdf7e35b7d112b4ba0a4c9a5c62abdb7763e8c371a
|
7
|
+
data.tar.gz: c37479f67876f510a7a6c65c72bf4abbb7c0eeb7bd3b82fc6f0571f91a369685db75b177b50db7b95a533254c40a769248b588d79b41cd79fd475a26d6999c14
|
data/.release-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.56
|
data/client/resources/sqlui.css
CHANGED
data/client/resources/sqlui.js
CHANGED
@@ -24295,17 +24295,22 @@
|
|
24295
24295
|
return match ? match[1] : identifier
|
24296
24296
|
}
|
24297
24297
|
|
24298
|
-
|
24299
|
-
|
24300
|
-
|
24301
|
-
|
24302
|
-
|
24303
|
-
|
24304
|
-
|
24305
|
-
|
24298
|
+
class Drag {
|
24299
|
+
scrolled = null
|
24300
|
+
scrollOffset = null
|
24301
|
+
containerOffset = null
|
24302
|
+
containerWidth = null
|
24303
|
+
thElement = null
|
24304
|
+
colElement = null
|
24305
|
+
otherColWidths = null
|
24306
|
+
lastColElement = null
|
24307
|
+
}
|
24308
|
+
|
24309
|
+
let drag = new Drag();
|
24306
24310
|
|
24307
24311
|
document.addEventListener('mousedown', (event) => {
|
24308
24312
|
if (event.target.classList.contains('col-resizer')) {
|
24313
|
+
drag = new Drag();
|
24309
24314
|
event.preventDefault();
|
24310
24315
|
const thElement = event.target.parentElement.parentElement;
|
24311
24316
|
if (thElement.tagName.toLowerCase() !== 'th') {
|
@@ -24313,57 +24318,43 @@
|
|
24313
24318
|
}
|
24314
24319
|
const trElement = thElement.parentElement;
|
24315
24320
|
const theadElement = trElement.parentElement;
|
24316
|
-
|
24317
|
-
|
24321
|
+
const tableElement = theadElement.parentElement;
|
24322
|
+
const containerElement = tableElement.parentElement;
|
24323
|
+
drag.containerWidth = containerElement.clientWidth;
|
24324
|
+
drag.scrollOffset = containerElement.scrollLeft;
|
24325
|
+
drag.scrolled = drag.scrollOffset > 0;
|
24326
|
+
drag.containerOffset = containerElement.offsetLeft;
|
24318
24327
|
drag.thElement = thElement;
|
24319
24328
|
drag.colElement = document.getElementById(event.target.dataset.colId);
|
24320
24329
|
|
24321
24330
|
const colElements = Array.from(drag.colElement.parentElement.childNodes);
|
24322
24331
|
drag.lastColElement = colElements[colElements.length - 1];
|
24323
|
-
drag.
|
24332
|
+
drag.otherColsWidth = 0;
|
24324
24333
|
for (let i = 0; i < colElements.length - 1; i++) {
|
24325
24334
|
if (colElements[i] !== drag.colElement) {
|
24326
|
-
drag.
|
24335
|
+
drag.otherColsWidth += colElements[i].getBoundingClientRect().width;
|
24327
24336
|
}
|
24337
|
+
colElements[i].style.width = `${colElements[i].getBoundingClientRect().width}px`;
|
24328
24338
|
}
|
24329
|
-
|
24330
|
-
element.style.width = `${element.getBoundingClientRect().width}px`;
|
24331
|
-
});
|
24332
|
-
drag.tableElement.style.tableLayout = 'fixed';
|
24339
|
+
tableElement.style.tableLayout = 'fixed';
|
24333
24340
|
}
|
24334
24341
|
});
|
24335
24342
|
|
24336
24343
|
document.addEventListener('mouseup', (event) => {
|
24337
|
-
drag
|
24338
|
-
drag.tableElement = null;
|
24339
|
-
drag.thElement = null;
|
24340
|
-
drag.colElement = null;
|
24341
|
-
drag.otherColWidths = null;
|
24342
|
-
drag.lastColElement = null;
|
24344
|
+
drag = new Drag();
|
24343
24345
|
});
|
24344
24346
|
|
24345
24347
|
document.addEventListener('mousemove', (event) => {
|
24346
|
-
if (drag.colElement)
|
24347
|
-
|
24348
|
-
|
24349
|
-
|
24350
|
-
|
24351
|
-
|
24352
|
-
|
24353
|
-
drag.
|
24354
|
-
|
24355
|
-
drag.
|
24356
|
-
runningWidth += width;
|
24357
|
-
});
|
24358
|
-
let remainingWidth;
|
24359
|
-
if (scrolled) {
|
24360
|
-
remainingWidth = (scrollOffset + drag.containerElement.clientWidth) - runningWidth;
|
24361
|
-
} else {
|
24362
|
-
remainingWidth = Math.max(10, drag.containerElement.clientWidth - runningWidth);
|
24363
|
-
}
|
24364
|
-
drag.lastColElement.style.width = `${remainingWidth}px`;
|
24365
|
-
runningWidth += remainingWidth;
|
24366
|
-
drag.tableElement.style.width = `${runningWidth}px`;
|
24348
|
+
if (!drag.colElement) return
|
24349
|
+
|
24350
|
+
const newColumnWidth = Math.max(0, drag.scrollOffset + (event.clientX - drag.containerOffset) - drag.thElement.offsetLeft);
|
24351
|
+
if (newColumnWidth < drag.colElement.getBoundingClientRect().width && newColumnWidth < 30) return
|
24352
|
+
|
24353
|
+
drag.colElement.style.width = `${newColumnWidth}px`;
|
24354
|
+
if (drag.scrolled) {
|
24355
|
+
drag.lastColElement.style.width = ((drag.scrollOffset + drag.containerWidth) - (newColumnWidth + drag.otherColsWidth)) + 'px';
|
24356
|
+
} else {
|
24357
|
+
drag.lastColElement.style.width = (Math.max(10, drag.containerWidth - (newColumnWidth + drag.otherColsWidth))) + 'px';
|
24367
24358
|
}
|
24368
24359
|
});
|
24369
24360
|
|
@@ -24376,6 +24367,7 @@
|
|
24376
24367
|
const tableElement = document.createElement('table');
|
24377
24368
|
containerElement.appendChild(tableElement);
|
24378
24369
|
if (id) tableElement.id = id;
|
24370
|
+
tableElement.style.tableLayout = 'auto';
|
24379
24371
|
|
24380
24372
|
const colgroupElement = document.createElement('colgroup');
|
24381
24373
|
tableElement.appendChild(colgroupElement);
|
@@ -24386,45 +24378,52 @@
|
|
24386
24378
|
const headerTrElement = document.createElement('tr');
|
24387
24379
|
theadElement.appendChild(headerTrElement);
|
24388
24380
|
|
24389
|
-
const nonLastColElements = [];
|
24390
|
-
columns.forEach(function (column, index) {
|
24391
|
-
const headerElement = document.createElement('th');
|
24392
|
-
headerTrElement.appendChild(headerElement);
|
24393
|
-
|
24394
|
-
const contentWrapperElement = document.createElement('div');
|
24395
|
-
contentWrapperElement.classList.add('col-content-wrapper');
|
24396
|
-
headerElement.appendChild(contentWrapperElement);
|
24397
|
-
|
24398
|
-
const nameElement = document.createElement('div');
|
24399
|
-
nameElement.classList.add('col-name');
|
24400
|
-
contentWrapperElement.appendChild(nameElement);
|
24401
|
-
|
24402
|
-
const colElement = document.createElement('col');
|
24403
|
-
colElement.id = `${id}-col-${index}`;
|
24404
|
-
colgroupElement.appendChild(colElement);
|
24405
|
-
nonLastColElements.push(colElement);
|
24406
|
-
|
24407
|
-
const resizerElement = document.createElement('div');
|
24408
|
-
resizerElement.classList.add('col-resizer');
|
24409
|
-
resizerElement.dataset.colId = colElement.id;
|
24410
|
-
contentWrapperElement.appendChild(resizerElement);
|
24411
|
-
|
24412
|
-
nameElement.innerText = column;
|
24413
|
-
});
|
24414
24381
|
if (columns.length > 0) {
|
24382
|
+
const colElements = [];
|
24383
|
+
columns.forEach(function (column, index) {
|
24384
|
+
const headerElement = document.createElement('th');
|
24385
|
+
headerTrElement.appendChild(headerElement);
|
24386
|
+
|
24387
|
+
const contentWrapperElement = document.createElement('div');
|
24388
|
+
contentWrapperElement.classList.add('col-content-wrapper');
|
24389
|
+
headerElement.appendChild(contentWrapperElement);
|
24390
|
+
|
24391
|
+
const nameElement = document.createElement('div');
|
24392
|
+
nameElement.classList.add('col-name');
|
24393
|
+
contentWrapperElement.appendChild(nameElement);
|
24394
|
+
|
24395
|
+
const colElement = document.createElement('col');
|
24396
|
+
colElement.id = `${id}-col-${index}`;
|
24397
|
+
colgroupElement.appendChild(colElement);
|
24398
|
+
colElements.push(colElement);
|
24399
|
+
|
24400
|
+
const resizerElement = document.createElement('div');
|
24401
|
+
resizerElement.classList.add('col-resizer');
|
24402
|
+
resizerElement.dataset.colId = colElement.id;
|
24403
|
+
contentWrapperElement.appendChild(resizerElement);
|
24404
|
+
|
24405
|
+
nameElement.innerText = column;
|
24406
|
+
});
|
24407
|
+
|
24415
24408
|
headerTrElement.appendChild(document.createElement('th'));
|
24416
24409
|
const lastColElement = document.createElement('col');
|
24417
24410
|
lastColElement.style.width = '100%';
|
24411
|
+
colElements.push(lastColElement);
|
24412
|
+
|
24413
|
+
let columnsWidth;
|
24418
24414
|
function resize () {
|
24419
|
-
|
24420
|
-
|
24421
|
-
|
24422
|
-
|
24423
|
-
|
24424
|
-
|
24425
|
-
|
24426
|
-
|
24427
|
-
|
24415
|
+
if (tableElement.style.tableLayout === 'auto') {
|
24416
|
+
return
|
24417
|
+
}
|
24418
|
+
if (!columnsWidth) {
|
24419
|
+
columnsWidth = 0;
|
24420
|
+
colElements.slice(0, -1).forEach((element, index) => {
|
24421
|
+
columnsWidth += element.getBoundingClientRect().width;
|
24422
|
+
});
|
24423
|
+
}
|
24424
|
+
const remainingWidth = Math.max(10, containerElement.clientWidth - columnsWidth);
|
24425
|
+
colElements.slice(-1)[0].style.width = `${remainingWidth}px`;
|
24426
|
+
tableElement.style.width = `${columnsWidth + remainingWidth}px`;
|
24428
24427
|
}
|
24429
24428
|
|
24430
24429
|
const resizeObserver = new ResizeObserver(resize);
|
@@ -24440,12 +24439,23 @@
|
|
24440
24439
|
mutationObserver.observe(containerElement, { childList: true });
|
24441
24440
|
colgroupElement.appendChild(lastColElement);
|
24442
24441
|
|
24443
|
-
|
24442
|
+
setTableBody(rows, tableElement, cellRenderer);
|
24444
24443
|
}
|
24444
|
+
|
24445
|
+
return tableElement
|
24446
|
+
}
|
24447
|
+
|
24448
|
+
function getTableBody (tableElement) {
|
24449
|
+
return tableElement.getElementsByTagName('tbody')[0]
|
24445
24450
|
}
|
24446
24451
|
|
24447
|
-
function
|
24448
|
-
|
24452
|
+
function setTableBody (rows, tableElement, cellRenderer) {
|
24453
|
+
tableElement.style.tableLayout = 'auto';
|
24454
|
+
|
24455
|
+
let tbodyElement = getTableBody(tableElement);
|
24456
|
+
tbodyElement?.parentElement?.removeChild(tbodyElement);
|
24457
|
+
|
24458
|
+
tbodyElement = document.createElement('tbody');
|
24449
24459
|
tableElement.appendChild(tbodyElement);
|
24450
24460
|
|
24451
24461
|
let highlight = false;
|
@@ -24694,6 +24704,8 @@
|
|
24694
24704
|
selected.style.display = 'none';
|
24695
24705
|
});
|
24696
24706
|
|
24707
|
+
setStatus('');
|
24708
|
+
|
24697
24709
|
switch (window.tab) {
|
24698
24710
|
case 'query':
|
24699
24711
|
selectResultTab(internal);
|
@@ -25274,28 +25286,27 @@
|
|
25274
25286
|
|
25275
25287
|
displaySqlFetchResultStatus(fetch);
|
25276
25288
|
|
25277
|
-
const resultBody = document.querySelector('table[id="result-table"] > tbody');
|
25278
25289
|
const pageStart = fetch.page * fetch.pageSize;
|
25279
25290
|
const rows = fetch.result.rows.slice(pageStart, pageStart + fetch.pageSize);
|
25280
|
-
|
25291
|
+
|
25292
|
+
let tableElement = document.getElementById('result-table');
|
25293
|
+
if (tableElement) {
|
25294
|
+
const resultBody = getTableBody(tableElement);
|
25281
25295
|
if (resultBody.dataset.page === fetch.page) {
|
25282
25296
|
// Results already displayed.
|
25283
25297
|
return
|
25284
25298
|
}
|
25285
|
-
|
25286
|
-
createTableBody(rows, document.getElementById('result-table'), resultCellRenderer);
|
25299
|
+
setTableBody(rows, tableElement, resultCellRenderer);
|
25287
25300
|
} else {
|
25288
25301
|
clearResultBox();
|
25289
|
-
createTable(
|
25302
|
+
tableElement = createTable(
|
25290
25303
|
document.getElementById('result-box'),
|
25291
25304
|
fetch.result.columns,
|
25292
25305
|
rows,
|
25293
25306
|
'result-table',
|
25294
25307
|
resultCellRenderer);
|
25295
25308
|
}
|
25296
|
-
|
25297
|
-
.querySelector('table[id="result-table"] > tbody')
|
25298
|
-
.setAttribute('data-page', fetch.page);
|
25309
|
+
tableElement.setAttribute('data-page', fetch.page);
|
25299
25310
|
}
|
25300
25311
|
|
25301
25312
|
function disableDownloadButtons () {
|