sqlui 0.1.61 → 0.1.62

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: 3ba6df74cbbe88d22279ec0a6a7cc9bf1ed191d695b84fcf424ee9b03a6b64cb
4
+ data.tar.gz: a9f53957b16860755a7d6d21980e573af93054bff997a205d791553b8b8dae59
5
5
  SHA512:
6
- metadata.gz: fd504e8ba6cf53b06b30b21867a7925ef7fda8055690eefb7759dd8ed745dd28088ca6c2f257eef1073aa976b67548c155bc26eb4f334750df6a059e9abdf6db
7
- data.tar.gz: 96584bb97da39f508542a861d16d1bb2196238ab4d12c99528937704f6b29aefee9563c837921dbee1a72fe5113b3a8dfb39b4c74a5951ffc6fb8be697d535cb
6
+ metadata.gz: d9375a77c825b5036079d8e3d4b5df74e4370be1966441bc3a8a4a887e878fd58d79500187116c2492e3d27358084c0aaa70bd45f48aba5e387ac37c0d51e678
7
+ data.tar.gz: ac699985a8459edb63c8aeeca34c861471d468b9680fd767d8c69f14610c27d04d55feeaa07d2c0256fa0ee6148e4f659f9060b399847173fc4cbe67d3c9b6ea
data/.release-version CHANGED
@@ -1 +1 @@
1
- 0.1.61
1
+ 0.1.62
@@ -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,79 @@
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 justify-content: right;\n margin: 0;\n padding: 10px;\n}\n\n.popup_button__CkIzv {\n width: 100px;\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);
24727
-
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;
24733
-
24734
- wrapperElement.addEventListener('click', () => {
24735
- document.body.removeChild(wrapperElement);
24740
+ popupElement.appendChild(titleElement);
24741
+
24742
+ const contentElement = document.createElement('pre');
24743
+ contentElement.classList.add(styles$1.content);
24744
+ contentElement.innerText = text;
24745
+ popupElement.appendChild(contentElement);
24746
+
24747
+ const buttonBarElement = document.createElement('div');
24748
+ buttonBarElement.classList.add(styles$1['button-bar']);
24749
+ popupElement.appendChild(buttonBarElement);
24750
+
24751
+ const copyElement = document.createElement('input');
24752
+ copyElement.classList.add(styles$1.button);
24753
+ copyElement.type = 'button';
24754
+ copyElement.value = 'Copy';
24755
+ buttonBarElement.appendChild(copyElement);
24756
+
24757
+ copyElement.addEventListener('click', (event) => {
24758
+ copyTextToClipboard(text);
24759
+ toast('Text copied to clipboard.');
24736
24760
  });
24737
24761
 
24738
- contentElement.addEventListener('click', (event) => {
24739
- event.stopPropagation();
24762
+ const closeElement = document.createElement('input');
24763
+ closeElement.id = 'popup-close';
24764
+ closeElement.classList.add(styles$1.button);
24765
+ closeElement.type = 'button';
24766
+ closeElement.value = 'Close';
24767
+ buttonBarElement.appendChild(closeElement);
24768
+
24769
+ closeElement.addEventListener('click', (event) => {
24770
+ document.body.removeChild(popupWrapperElement);
24740
24771
  });
24741
24772
 
24742
24773
  closeElement.focus();
@@ -24744,13 +24775,13 @@
24744
24775
 
24745
24776
  document.addEventListener('keydown', (event) => {
24746
24777
  if (event.code === 'Escape') {
24747
- const wrapperElement = document.getElementById('popup');
24778
+ const wrapperElement = document.getElementById('popup-wrapper');
24748
24779
  if (wrapperElement) {
24749
24780
  event.preventDefault();
24750
24781
  document.body.removeChild(wrapperElement);
24751
24782
  }
24752
24783
  } else if (event.code === 'Tab') {
24753
- const wrapperElement = document.getElementById('popup');
24784
+ const wrapperElement = document.getElementById('popup-wrapper');
24754
24785
  if (wrapperElement) {
24755
24786
  event.preventDefault();
24756
24787
  document.getElementById('popup-close').focus();
@@ -25668,25 +25699,36 @@
25668
25699
 
25669
25700
  function registerTableCellPopup (tableElement) {
25670
25701
  const listener = (event) => {
25671
- if (event.which === 1 && event.metaKey) {
25702
+ if (event.which === 1 && (event.metaKey || event.altKey)) {
25672
25703
  let node = event.target;
25673
25704
  while (!['td', 'th', 'table'].includes(node.tagName.toLowerCase()) && node.parentNode) {
25674
25705
  node = node.parentNode;
25675
25706
  }
25707
+
25676
25708
  if (node.tagName.toLowerCase() === 'td') {
25677
- if (event.type === 'mousedown') {
25709
+ if (event.type === 'mousedown' && node.dataset.row) {
25678
25710
  const row = parseInt(node.dataset.row);
25679
25711
  const column = parseInt(node.dataset.column);
25680
25712
  const title = window.sqlFetch.result.columns[column].replaceAll('\n', '¶');
25681
- createPopup(title, window.sqlFetch.result.rows[row][column]);
25713
+ if (event.metaKey) {
25714
+ createPopup(title, window.sqlFetch.result.rows[row][column]);
25715
+ } else if (event.altKey) {
25716
+ copyTextToClipboard(window.sqlFetch.result.rows[row][column]);
25717
+ toast('Text copied to clipboard.');
25718
+ }
25682
25719
  }
25683
25720
  event.preventDefault();
25684
25721
  } else if (node.tagName.toLowerCase() === 'th') {
25685
- if (event.type === 'mousedown') {
25722
+ if (event.type === 'mousedown' && node.dataset.column) {
25686
25723
  const column = parseInt(node.dataset.column);
25687
25724
  const value = window.sqlFetch.result.columns[column];
25688
25725
  const title = value.replaceAll('\n', '¶');
25689
- createPopup(title, value);
25726
+ if (event.metaKey) {
25727
+ createPopup(title, value);
25728
+ } else if (event.altKey) {
25729
+ copyTextToClipboard(value);
25730
+ toast('Text copied to clipboard.');
25731
+ }
25690
25732
  }
25691
25733
  event.preventDefault();
25692
25734
  }
@@ -25774,7 +25816,7 @@
25774
25816
  return
25775
25817
  }
25776
25818
 
25777
- document.getElementById('cancel-button').style.display = 'none';
25819
+ document.getElementById('cancel-button').style.visibility = 'hidden';
25778
25820
  document.getElementById('fetch-sql-box').style.display = 'none';
25779
25821
  document.getElementById('graph-box').style.display = 'flex';
25780
25822
 
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.62
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