sqlui 0.1.61 → 0.1.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec12b1d88bc2adff9dba6ff91b01e66b123d17cb8b042e142c24f71303a27a92
4
- data.tar.gz: df939b59b2bae004270ea1907a6be52352e7c81e6050405bc4534a6faaae0567
3
+ metadata.gz: 728b5c2df39daf318b2936df45ddfd20bf1e33d2ae4545cae7484e8abeddacc9
4
+ data.tar.gz: 814be017688d908e4db747959146ecbd1eed4ed5558619b75a275573242e044e
5
5
  SHA512:
6
- metadata.gz: fd504e8ba6cf53b06b30b21867a7925ef7fda8055690eefb7759dd8ed745dd28088ca6c2f257eef1073aa976b67548c155bc26eb4f334750df6a059e9abdf6db
7
- data.tar.gz: 96584bb97da39f508542a861d16d1bb2196238ab4d12c99528937704f6b29aefee9563c837921dbee1a72fe5113b3a8dfb39b4c74a5951ffc6fb8be697d535cb
6
+ metadata.gz: 9ad46193307ad7c1b3c0e6f1c95f33bfd82994a28d7327088326ace510e4e51c4328a911c4546557d01d4fce8a6e8f735b6e636c82dadc7589256fb921b1877f
7
+ data.tar.gz: bc37ae6f014b3b53953a34f578db586e60d39c3959deb25631ce2fe06f46a914d105ecaa42fd15856874b04f196f82008e1680ea9779b206aa9f1b44f18f8a85
data/.release-version CHANGED
@@ -1 +1 @@
1
- 0.1.61
1
+ 0.1.63
@@ -262,10 +262,6 @@ table tbody tr td {
262
262
  height: 21px;
263
263
  }
264
264
 
265
- #result-table td, #result-table th {
266
- cursor: default;
267
- }
268
-
269
265
  #result-table tbody tr td abbr a {
270
266
  color: #555;
271
267
  cursor: pointer;
@@ -24695,48 +24695,97 @@
24695
24695
  }
24696
24696
  }
24697
24697
 
24698
- var css_248z = ".popup_popup-wrapper__huCTg {\n position: absolute;\n background: rgba(0, 0, 0, 0.3);\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: 2;\n}\n\n.popup_popup-content__iGYws {\n position: absolute;\n top: 50px;\n left: 50px;\n height: calc(100% - 100px);\n width: calc(100% - 100px);\n background: #fff;\n border: 1px solid #888;\n}\n\n.popup_popup-pre__gF3-Q {\n position: absolute;\n top: 40px;\n left: 0;\n height: calc(100% - 112px);\n width: calc(100% - 20px);\n overflow: auto;\n font-size: 18px;\n border-top: 1px solid #ddd;\n border-bottom: 1px solid #ddd;\n margin: 0px;\n padding: 10px;\n background: #fff;\n font-family: monospace;\n}\n\n.popup_popup-pre__gF3-Q:focus {\n outline: none;\n}\n.popup_popup-close__3GBw3 {\n position: absolute;\n right: 20px;\n bottom: 10px;\n width: 100px;\n height: 30px;\n cursor: pointer;\n font-family: Helvetica, sans-serif;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 18px;\n color: #333;\n border: 1px solid #888;\n background: #fff;\n}\n\n.popup_popup-close__3GBw3:active {\n background-color: #e6e6e6;\n}\n\n.popup_popup-title__W2N2J {\n position: absolute;\n top: 10px;\n left: 10px;\n font-family: Helvetica, sans-serif;\n font-size: 18px;\n color: #333;\n font-weight: bold;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n width: calc(100% - 20px);\n}\n";
24699
- var styles = {"popup-wrapper":"popup_popup-wrapper__huCTg","popup-content":"popup_popup-content__iGYws","popup-pre":"popup_popup-pre__gF3-Q","popup-close":"popup_popup-close__3GBw3","popup-title":"popup_popup-title__W2N2J"};
24698
+ var css_248z$1 = ".popup_popup-wrapper__huCTg {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 2;\n margin: 0;\n padding: 0;\n background: rgba(0, 0, 0, 0.3);\n}\n\n.popup_popup__co5G- {\n position: absolute;\n top: 60px;\n right: 60px;\n bottom: 60px;\n left: 60px;\n display: flex;\n flex-direction: column;\n margin: 0;\n padding: 0;\n background: #fff;\n border: 1px solid #888;\n}\n\n.popup_title__JT4Lb {\n margin: 0;\n padding: 10px;\n font-weight: bold;\n font-family: Helvetica, sans-serif;\n font-size: 18px;\n color: #333;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.popup_content__m7uSh {\n flex: 1;\n margin: 0;\n padding: 10px;\n overflow: auto;\n font-family: monospace;\n font-size: 18px;\n border-top: 1px solid #888;\n border-bottom: 1px solid #888;\n color: #333;\n}\n\n.popup_content__m7uSh:focus {\n outline: none;\n}\n\n.popup_button-bar__VCxAC {\n display: flex;\n flex-direction: row;\n margin: 0;\n padding: 10px;\n}\n\n.popup_button__CkIzv {\n width: 150px;\n height: 30px;\n margin: 0 5px;\n cursor: pointer;\n font-family: Helvetica, sans-serif;\n display: flex;\n justify-content: center;\n font-size: 18px;\n color: #333;\n border: 1px solid #888;\n}\n\n.popup_button__CkIzv:active {\n background-color: #e6e6e6;\n}\n";
24699
+ var styles$1 = {"popup-wrapper":"popup_popup-wrapper__huCTg","popup":"popup_popup__co5G-","title":"popup_title__JT4Lb","content":"popup_content__m7uSh","button-bar":"popup_button-bar__VCxAC","button":"popup_button__CkIzv"};
24700
+ styleInject(css_248z$1);
24701
+
24702
+ var css_248z = ".toast_toast__019Ay {\n min-width: 250px; /* Set a default minimum width */\n margin-left: -125px; /* Divide value of min-width by 2 */\n position: fixed; /* Sit on top of the screen */\n left: 50%; /* Center on screen. */\n top: 30px; /* 30px from the top of the screen */\n z-index: 3;\n background-color: white;\n font-family: Helvetica, sans-serif;\n font-size: 18px;\n box-shadow: 2px 2px 2px rgb(0, 0, 0, .2);\n color: #333;\n border: 1px solid #888;\n text-align: center;\n border-radius: 2px;\n padding: 10px;\n -webkit-animation: toast_fadein__g6ghy 0.5s, toast_fadeout__8dF5T 0.5s 2.5s;\n animation: toast_fadein__g6ghy 0.5s, toast_fadeout__8dF5T 0.5s 2.5s;\n}\n\n@-webkit-keyframes toast_fadein__g6ghy {\n from {top: 0; opacity: 0;}\n to {top: 30px; opacity: 1;}\n}\n\n@keyframes toast_fadein__g6ghy {\n from {top: 0; opacity: 0;}\n to {top: 30px; opacity: 1;}\n}\n\n@-webkit-keyframes toast_fadeout__8dF5T {\n from {top: 30px; opacity: 1;}\n to {top: 0; opacity: 0;}\n}\n\n@keyframes toast_fadeout__8dF5T {\n from {top: 30px; opacity: 1;}\n to {top: 0; opacity: 0;}\n}\n";
24703
+ var styles = {"toast":"toast_toast__019Ay","fadein":"toast_fadein__g6ghy","fadeout":"toast_fadeout__8dF5T"};
24700
24704
  styleInject(css_248z);
24701
24705
 
24706
+ function toast (text) {
24707
+ const toastElement = document.createElement('div');
24708
+ toastElement.innerText = text;
24709
+ toastElement.classList.add(styles.toast);
24710
+ document.body.appendChild(toastElement);
24711
+ toastElement.onanimationend = (e) => {
24712
+ if (e.animationName === styles.fadeout) {
24713
+ document.body.removeChild(toastElement);
24714
+ }
24715
+ };
24716
+ }
24717
+
24702
24718
  function createPopup (title, text) {
24703
- const wrapperElement = document.createElement('div');
24704
- wrapperElement.id = 'popup';
24705
- wrapperElement.classList.add(styles['popup-wrapper']);
24706
- document.body.appendChild(wrapperElement);
24719
+ const popupWrapperElement = document.createElement('div');
24720
+ popupWrapperElement.id = 'popup-wrapper';
24721
+ popupWrapperElement.classList.add(styles$1['popup-wrapper']);
24722
+ document.body.appendChild(popupWrapperElement);
24707
24723
 
24708
- const contentElement = document.createElement('div');
24709
- contentElement.classList.add(styles['popup-content']);
24710
- wrapperElement.appendChild(contentElement);
24724
+ popupWrapperElement.addEventListener('click', () => {
24725
+ document.body.removeChild(popupWrapperElement);
24726
+ });
24711
24727
 
24712
- const closeElement = document.createElement('input');
24713
- closeElement.id = 'popup-close';
24714
- closeElement.classList.add(styles['popup-close']);
24715
- closeElement.type = 'button';
24716
- closeElement.value = 'Close';
24717
- contentElement.appendChild(closeElement);
24728
+ const popupElement = document.createElement('div');
24729
+ popupElement.id = 'popup';
24730
+ popupElement.classList.add(styles$1.popup);
24731
+ popupWrapperElement.appendChild(popupElement);
24718
24732
 
24719
- closeElement.addEventListener('click', (event) => {
24720
- document.body.removeChild(wrapperElement);
24733
+ popupElement.addEventListener('click', (event) => {
24734
+ event.stopPropagation();
24721
24735
  });
24722
24736
 
24723
24737
  const titleElement = document.createElement('div');
24724
- titleElement.classList.add(styles['popup-title']);
24738
+ titleElement.classList.add(styles$1.title);
24725
24739
  titleElement.innerText = title;
24726
- contentElement.appendChild(titleElement);
24740
+ popupElement.appendChild(titleElement);
24727
24741
 
24728
- const preElement = document.createElement('pre');
24729
- preElement.id = 'popup-pre';
24730
- preElement.classList.add(styles['popup-pre']);
24731
- contentElement.appendChild(preElement);
24732
- preElement.innerText = text;
24742
+ const contentElement = document.createElement('pre');
24743
+ contentElement.classList.add(styles$1.content);
24744
+ contentElement.innerText = text;
24745
+ popupElement.appendChild(contentElement);
24733
24746
 
24734
- wrapperElement.addEventListener('click', () => {
24735
- document.body.removeChild(wrapperElement);
24747
+ const buttonBarElement = document.createElement('div');
24748
+ buttonBarElement.classList.add(styles$1['button-bar']);
24749
+ popupElement.appendChild(buttonBarElement);
24750
+
24751
+ const jsonElement = document.createElement('input');
24752
+ jsonElement.classList.add(styles$1.button);
24753
+ jsonElement.type = 'button';
24754
+ jsonElement.value = 'Parse JSON';
24755
+ buttonBarElement.appendChild(jsonElement);
24756
+
24757
+ jsonElement.addEventListener('click', (event) => {
24758
+ try {
24759
+ contentElement.innerText = JSON.stringify(JSON.parse(text), null, 2);
24760
+ } catch (_) {
24761
+ toast('Failed to parse JSON.');
24762
+ }
24736
24763
  });
24737
24764
 
24738
- contentElement.addEventListener('click', (event) => {
24739
- event.stopPropagation();
24765
+ const copyElement = document.createElement('input');
24766
+ copyElement.classList.add(styles$1.button);
24767
+ copyElement.type = 'button';
24768
+ copyElement.value = 'Copy';
24769
+ buttonBarElement.appendChild(copyElement);
24770
+
24771
+ copyElement.addEventListener('click', (event) => {
24772
+ copyTextToClipboard(contentElement.innerText);
24773
+ toast('Text copied to clipboard.');
24774
+ });
24775
+
24776
+ const spacerElement = document.createElement('div');
24777
+ spacerElement.style.flex = 1;
24778
+ buttonBarElement.appendChild(spacerElement);
24779
+
24780
+ const closeElement = document.createElement('input');
24781
+ closeElement.id = 'popup-close';
24782
+ closeElement.classList.add(styles$1.button);
24783
+ closeElement.type = 'button';
24784
+ closeElement.value = 'Close';
24785
+ buttonBarElement.appendChild(closeElement);
24786
+
24787
+ closeElement.addEventListener('click', (event) => {
24788
+ document.body.removeChild(popupWrapperElement);
24740
24789
  });
24741
24790
 
24742
24791
  closeElement.focus();
@@ -24744,13 +24793,13 @@
24744
24793
 
24745
24794
  document.addEventListener('keydown', (event) => {
24746
24795
  if (event.code === 'Escape') {
24747
- const wrapperElement = document.getElementById('popup');
24796
+ const wrapperElement = document.getElementById('popup-wrapper');
24748
24797
  if (wrapperElement) {
24749
24798
  event.preventDefault();
24750
24799
  document.body.removeChild(wrapperElement);
24751
24800
  }
24752
24801
  } else if (event.code === 'Tab') {
24753
- const wrapperElement = document.getElementById('popup');
24802
+ const wrapperElement = document.getElementById('popup-wrapper');
24754
24803
  if (wrapperElement) {
24755
24804
  event.preventDefault();
24756
24805
  document.getElementById('popup-close').focus();
@@ -25668,25 +25717,36 @@
25668
25717
 
25669
25718
  function registerTableCellPopup (tableElement) {
25670
25719
  const listener = (event) => {
25671
- if (event.which === 1 && event.metaKey) {
25720
+ if (event.which === 1 && (event.metaKey || event.altKey)) {
25672
25721
  let node = event.target;
25673
25722
  while (!['td', 'th', 'table'].includes(node.tagName.toLowerCase()) && node.parentNode) {
25674
25723
  node = node.parentNode;
25675
25724
  }
25725
+
25676
25726
  if (node.tagName.toLowerCase() === 'td') {
25677
- if (event.type === 'mousedown') {
25727
+ if (event.type === 'mousedown' && node.dataset.row) {
25678
25728
  const row = parseInt(node.dataset.row);
25679
25729
  const column = parseInt(node.dataset.column);
25680
25730
  const title = window.sqlFetch.result.columns[column].replaceAll('\n', '¶');
25681
- createPopup(title, window.sqlFetch.result.rows[row][column]);
25731
+ if (event.metaKey) {
25732
+ createPopup(title, window.sqlFetch.result.rows[row][column]);
25733
+ } else if (event.altKey) {
25734
+ copyTextToClipboard(window.sqlFetch.result.rows[row][column]);
25735
+ toast('Text copied to clipboard.');
25736
+ }
25682
25737
  }
25683
25738
  event.preventDefault();
25684
25739
  } else if (node.tagName.toLowerCase() === 'th') {
25685
- if (event.type === 'mousedown') {
25740
+ if (event.type === 'mousedown' && node.dataset.column) {
25686
25741
  const column = parseInt(node.dataset.column);
25687
25742
  const value = window.sqlFetch.result.columns[column];
25688
25743
  const title = value.replaceAll('\n', '¶');
25689
- createPopup(title, value);
25744
+ if (event.metaKey) {
25745
+ createPopup(title, value);
25746
+ } else if (event.altKey) {
25747
+ copyTextToClipboard(value);
25748
+ toast('Text copied to clipboard.');
25749
+ }
25690
25750
  }
25691
25751
  event.preventDefault();
25692
25752
  }
@@ -25774,7 +25834,7 @@
25774
25834
  return
25775
25835
  }
25776
25836
 
25777
- document.getElementById('cancel-button').style.display = 'none';
25837
+ document.getElementById('cancel-button').style.visibility = 'hidden';
25778
25838
  document.getElementById('fetch-sql-box').style.display = 'none';
25779
25839
  document.getElementById('graph-box').style.display = 'flex';
25780
25840
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.61
4
+ version: 0.1.63
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Dower
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-03 00:00:00.000000000 Z
11
+ date: 2023-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airbrake