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

Dean/table #367

Open
wants to merge 55 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ccfc0f1
Refactor Table with resizable columns
dastratakos May 10, 2023
c416d96
Make rows resizable
dastratakos May 10, 2023
1c488dc
Work on styling
dastratakos May 10, 2023
30b4f54
Add cutout in top left to cover scrolling headers
dastratakos May 10, 2023
585caa7
Add selecting
dastratakos May 11, 2023
c23352a
Work on drag select
dastratakos May 11, 2023
ef7d637
Fix drag select
dastratakos May 11, 2023
7d331af
Remove old function
dastratakos May 11, 2023
fcde831
Add better highlight colors
dastratakos May 11, 2023
82bf5dd
Clean up Cell type, add arrow key support
dastratakos May 12, 2023
4bb8461
Work on border box around selection
dastratakos May 12, 2023
c23ad7c
Hide overflow
dastratakos May 12, 2023
d138259
Improve selected borders
dastratakos May 12, 2023
66e44a3
Simplify borders
dastratakos May 12, 2023
442b693
Simplify border calculation again
dastratakos May 12, 2023
31db50e
Work on edge cases
dastratakos May 12, 2023
df99dfa
Add support for cmd+shift+arrow
dastratakos May 13, 2023
41ea6f2
Add select all, deselect single cell from col/row
dastratakos May 13, 2023
4250600
Add todo
dastratakos May 13, 2023
9526a47
Add in activeCells array
dastratakos May 13, 2023
584eb7d
Fix edge case with metaKey
dastratakos May 13, 2023
7b078ab
Filter selected cells to be unique
dastratakos May 14, 2023
70fd3cb
Work on selection edge cases
dastratakos May 14, 2023
2554247
Add Tab keyboard shortcut
dastratakos May 14, 2023
af897fe
Add todo
dastratakos May 14, 2023
886ca3a
Make text editable with some bugs
dastratakos May 23, 2023
3e48d77
Make text purple when editing
dastratakos May 23, 2023
b953e52
Work on adding minWidth and minHeight
dastratakos May 25, 2023
22a7b30
Fix minWidth minHeight bug
dastratakos May 25, 2023
1164305
Add second border (outline) when editing
dastratakos May 25, 2023
8f0ce09
Work on box margin style, will need to fix
dastratakos May 25, 2023
fb70c7a
Fix cell overlap when editing
dastratakos May 25, 2023
46066ee
Try to work on newlines when editing a cell
dastratakos May 25, 2023
c5350e2
Work on reducing number of fetches
dastratakos Jun 2, 2023
14cbbaf
Work on min-content for wrappign
dastratakos Jun 5, 2023
03f353d
Make buttons full width/height and centered
dastratakos Jun 5, 2023
f1e52ad
Work on double click to fit content
dastratakos Jun 5, 2023
bae63cc
Remove min-width and min-height from Cell.svelte
dastratakos Jun 5, 2023
546a09c
Add focused prop to Text
dastratakos Jun 5, 2023
4405377
Fix selected borders
dastratakos Jun 5, 2023
0255298
Remove warning by refactoring
dastratakos Jun 6, 2023
1f5a01f
Remove error with arrow keys
dastratakos Jun 6, 2023
8b8fcda
Add wrapping
dastratakos Jun 6, 2023
5ef23ba
Clean up wrap clip
dastratakos Jun 6, 2023
f179781
Clamp the initial size of the columns
dastratakos Jun 7, 2023
fff0685
Make column and row headers select while dragging
dastratakos Jun 7, 2023
0e95c29
Set row heights after load
dastratakos Jun 7, 2023
36503ac
Set column and row sizes when wrapping
dastratakos Jun 7, 2023
6099346
Fix editable numbers
dastratakos Jun 7, 2023
80a5c6e
Remove dataframe.ts change
dastratakos Jun 7, 2023
e8c40e0
Call endEdit to clean up code
dastratakos Jun 7, 2023
f988dbc
Update shake animiation
dastratakos Jun 7, 2023
4567805
Add more selection details at the bottom
dastratakos Jun 7, 2023
afbc332
Fix row and column edit mode
dastratakos Jun 10, 2023
549c81a
Fix pagination, make selected col icons white
dastratakos Jun 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 40 additions & 10 deletions meerkat/interactive/app/src/lib/component/core/number/Number.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,40 @@
export let precision: number = 3;
export let percentage: boolean = false;
export let editable: boolean = false;
export let focused: boolean = false;
export let classes: string = '';

const cellEdit: CallableFunction = getContext('cellEdit');

let editableCell: HTMLDivElement;

$: setFocus(focused);

function setFocus(focus: boolean) {
if (!editableCell) return;

if (!focus) {
editableCell.blur();
} else {
editableCell.focus();

// Set the cursor to the end of the div. From
// https://stackoverflow.com/a/3866442. Supported on Firefox,
// Chrome, Opera, Safari, IE 9+
let range = document.createRange();
range.selectNodeContents(editableCell);
range.collapse(false);

let selection = window.getSelection();
if (selection) {
selection.removeAllRanges();
selection.addRange(range);
}
}
}

let invalid = false;
let showInvalid = false;
let invalidCount = 0;

if (dtype === 'auto') {
// The + operator converts a string or number to a number if possible
Expand Down Expand Up @@ -39,15 +67,17 @@
</script>

{#if editable}
<input
class={'input w-full' + (invalid && ' outline-red-500')}
class:invalid={showInvalid}
bind:value={data}
on:input={() => (invalid = data !== '' && data !== 'NaN' && isNaN(data))}
on:change={() => {
<div
class={classes + (invalid ? ' outline-red-500' : ' outline-none')}
class:invalid={invalidCount > 0}
contenteditable="true"
bind:innerHTML={data}
bind:this={editableCell}
on:input={() => {
invalid = data !== '' && data !== 'NaN' && isNaN(data);
if (invalid) {
showInvalid = true;
setTimeout(() => (showInvalid = false), 1000);
invalidCount++;
setTimeout(() => invalidCount--, 400);
} else {
cellEdit(data === '' ? 0 : dtype === 'string' ? data : +data);
}
Expand Down Expand Up @@ -76,6 +106,6 @@
}

.invalid {
animation: shake 0.2s ease-in-out 0s 2;
animation: shake 0.2s ease-in-out 0s infinite;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ class Number(Component):
percentage: bool = False
classes: str = ""
editable: bool = False
focused: bool = False
Loading