Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial spreadsheet mode #1747

Merged
merged 11 commits into from
Nov 27, 2023
Merged
2 changes: 1 addition & 1 deletion apps/studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"sql-formatter": "~10.7.2",
"sql-query-identifier": "^2.2.0",
"ssh2": "^1.14.0",
"tabulator-tables": "~5.5.2",
"tabulator-tables": "beekeeper-studio/tabulator#daa59721b253cb6d69e8b35c4fee468666954fc2",
"tinyduration": "^3.2.4",
"typeface-roboto": "^0.0.75",
"typeface-source-code-pro": "^1.1.3",
Expand Down
4 changes: 4 additions & 0 deletions apps/studio/src/assets/styles/app/core-tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@
flex-direction: column;
gap: 0.5rem;
}
.left-section {
padding-left: 0.45rem;
padding-right: 0.25rem;
}
.multiple-filter {
flex-grow: 1;
& > * {
Expand Down
3 changes: 0 additions & 3 deletions apps/studio/src/assets/styles/app/query-editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@
overflow: hidden;
.tabulator-cell {
cursor: default;
&:hover {
background: transparent;
}
}
}
.not-run-yet {
Expand Down
218 changes: 145 additions & 73 deletions apps/studio/src/assets/styles/app/vendor/tabulator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ $errorColor: $brand-danger;
$foreign-key-width: 20px;

$row-height: 30px;
$row-highlight: lighten($query-editor-bg, 1%);
$row-add: #18855F;
$row-delete: #8A3937;
$row-error: #38201F;
Expand All @@ -15,6 +14,9 @@ $cell-radius: 2px;

$cell-padding: $gutter-w;

$header-highlight: mix($query-editor-bg, $theme-base, 95%);
$header-selected: mix($query-editor-bg, $theme-primary, 10%);

// Mixin
@mixin cell-shadow($bg) {
box-shadow: inset -1px 0 rgba(black, 0.2),
Expand Down Expand Up @@ -98,8 +100,21 @@ $cell-padding: $gutter-w;
background: transparent;
width: min-content;
min-width: 100%;
&:nth-child(odd) {
background: rgba($theme-base, 0.015);
&.tabulator-row-odd {
background-color: rgba($theme-base, 0.015);
}
&.tabulator-spreadsheet-selected.tabulator-row-even:hover {
background-color: transparent;
}
&.tabulator-spreadsheet-highlight .tabulator-cell.tabulator-frozen.tabulator-spreadsheet-row-header {
background-color: $header-highlight !important;
color: $text-dark;
}
&.tabulator-spreadsheet-selected .tabulator-cell.tabulator-frozen.tabulator-spreadsheet-row-header {
background-color: $header-selected !important;
color: black;
font-weight: bold;
border-radius: 0;
}
&.inserted {
.tabulator-cell {
Expand All @@ -126,16 +141,24 @@ $cell-padding: $gutter-w;
min-height: $row-height;
height: $row-height;
line-height: $row-height;
border-radius: $cell-radius;
cursor: default;
&:not(.tabulator-spreadsheet-row-header) {
border-radius: $cell-radius;
}
&:first-of-type {
padding-left: $cell-padding * 1.5;
}
&:last-of-type {
padding-right: $cell-padding * 1.5;
}
i.fk-link {
display:none;
&.tabulator-frozen.tabulator-spreadsheet-row-header {
padding: 0;
background-color: $query-editor-bg;
border-right: 0 !important;
box-shadow: 1px 0 $border-color;
&:hover {
background-color: rgba($theme-base, 0.10);
}
}
pre {
margin: 0;
Expand Down Expand Up @@ -171,14 +194,6 @@ $cell-padding: $gutter-w;
color: $db-select-text;
}

&.selected {
background: rgba($theme-base, 0.10) !important;
opacity: 1!important;
&:hover {
background: rgba($theme-base, 0.10) !important;
}
}

&.copied {
background: rgba($theme-base, 0.4) !important;
}
Expand Down Expand Up @@ -232,36 +247,19 @@ $cell-padding: $gutter-w;
}
}
}
&.foreign-key {
padding-right: $foreign-key-width - 6px;
}
&.foreign-key-button {
display: inline-flex;
align-items: center;
justify-content: flex-end;
width: $foreign-key-width!important;
min-width: $foreign-key-width!important;
padding-left: 0!important;
padding-right: 0.35rem!important;
margin-left: -$foreign-key-width;
cursor: pointer!important;
&:hover {
background: transparent!important;
}
.material-icons {
font-size: 14px;
line-height: 22px;
color: $text-light;
cursor: pointer;
}
.tabulator-col-resize-handle.prev {
display: none;
}
}
&.tabulator-frozen {
border: 0 !important;
background-color: transparent;
}

.cell-link-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
:not(.fk-link) {
flex-grow: 1;
}
}
}

&.copied {
Expand Down Expand Up @@ -299,28 +297,33 @@ $cell-padding: $gutter-w;
&.edit-success {
@include cell-shadow(rgba($query-editor-bg, 0.75));
}
}

&.tabulator-selectable {
&:hover {
background: rgba($theme-base, 0.05);
background-color: rgba($theme-base, 0.05);
cursor: default;
i.fk-link {
display: inline-block;
&:hover {
color: white;
}
}
&.tabulator-selected {
background: rgba($theme-base, 0.1);
&.tabulator-spreadsheet-selected:not(.tabulator-spreadsheet-only-cell-selected) {
background-color: rgba($theme-base, 0.05);
}
}
&.tabulator-selected {
background: rgba($theme-base, 0.1);
&.tabulator-spreadsheet-selected:not(.tabulator-spreadsheet-only-cell-selected) {
background-color: rgba($theme-base, 0.05);
}

}

i.fk-link {
display:none;
cursor: pointer;
color: $text-light;
font-size: 14px;
}
&:hover {
i.fk-link {
display: inline-block;
&:hover {
color: $theme-base;
}
}
}
}

// Editable Hover
Expand All @@ -332,7 +335,9 @@ $cell-padding: $gutter-w;
}
&.primary-key {
cursor: default;
opacity: 0.5;
& > * {
opacity: 0.5;
}
&:hover {
background: transparent;
}
Expand Down Expand Up @@ -390,37 +395,85 @@ $cell-padding: $gutter-w;
background: transparent;
border: 0;
width: -webkit-fill-available;
box-shadow: inset 0 -1px $border-color;
box-shadow: 0 1px $border-color;
.tabulator-col {
background: transparent;
border-color: transparent;
height: 32px!important;
font-size: 90%;
line-height: 1;

color: $text-dark;
&:not(.tabulator-spreadsheet-row-header):not(.tabulator-spreadsheet-selected) {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
&:hover {
background: rgba($theme-base, 0.035);
.tabulator-header-popup-button {
display: inline-block;
}
}
&.tabulator-spreadsheet-highlight {
background-color: $header-highlight;
}
&.tabulator-spreadsheet-selected {
background-color: $header-selected;
color: black;
}
&.tabulator-spreadsheet-row-header {
background-color: transparent;
}
.tabulator-header-popup-button {
display: none;
position: relative;
&::before {
transition: opacity 0.15s;
content: "";
position: absolute;
width: 24px;
height: 24px;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
border-radius: 9999px;
background-color: rgba($theme-base, 0.1);
opacity: 0;
}
&:hover {
opacity: 1;
&::before {
opacity: 1;
}
}
}
.tabulator-col-title {
color: $text-dark;
display: flex;
flex-direction: row-reverse;
overflow: visible;
.title {
flex-grow: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
& > * {
display: inline;
}
}
}

&:first-of-type .tabulator-col-content {
padding-left: $gutter-w * 1.5;
}
&:last-of-type .tabulator-col-content {
padding-right: $gutter-w * 1.5;
padding-right: $gutter-w * 0.5;
}
.badge {
& .badge {
background: transparent;
color: $text-lighter;
padding: 0 0.1rem;
}
&.tabulator-sortable{
border-radius: 2px;
&:hover {
background: rgba($theme-base, 0.035);
}
.tabulator-col-title {
padding-right: 16px;
}
&.tabulator-spreadsheet-selected .badge {
color: black;
}
&.tabulator-sortable[aria-sort="ascending"] {
.tabulator-col-content {
Expand Down Expand Up @@ -466,9 +519,15 @@ $cell-padding: $gutter-w;

}
}
&.primary-key {
&:before {
color: $theme-secondary;
&.primary-key:before {
color: $theme-secondary;
}
&.tabulator-spreadsheet-selected {
&.primary-key:before {
color: black;
}
&.foreign-key:before {
color: mix($theme-primary, black, 60%);
}
}
&.foreign-key-button {
Expand Down Expand Up @@ -556,7 +615,6 @@ $cell-padding: $gutter-w;
}
}


.tabulator-edit-select-list {
background: $theme-bg;
color: white;
Expand Down Expand Up @@ -683,7 +741,7 @@ $cell-padding: $gutter-w;
padding: 0.3rem 0;

.tabulator-menu-item {
&:hover {
&:hover, &.tabulator-spreadsheet-menu-item-focused {
background: rgba($theme-base, 0.05);
}
color: $text-dark;
Expand Down Expand Up @@ -716,3 +774,17 @@ $cell-padding: $gutter-w;
}
}
}

.tabulator-range-overlay {
.tabulator-range, .tabulator-range-cell-active {
border-color: darken($theme-primary, 20%);
border-width: 1px;
}
.tabulator-range::after {
background-color: darken($theme-primary, 20%);
}
.tabulator-range.copied {
border-style: dashed;
}
}