Frontend created and rewritten a few times, with some backend fixes #1

Merged
leo merged 110 commits from plaintable into main 2023-11-08 20:38:40 +00:00
5 changed files with 22 additions and 6 deletions
Showing only changes of commit 4f370440d9 - Show all commits

1
.gitignore vendored
View File

@ -4,5 +4,4 @@ __pycache__/
*.egg-info/
/cista/_version.py
/cista/wwwroot/*
/cista-front/components.d.ts # Generated
/dist

View File

@ -16,6 +16,7 @@ dist
dist-ssr
coverage
*.local
components.d.ts
/cypress/videos/
/cypress/screenshots/

View File

@ -92,10 +92,13 @@ const globalShortcutHandler = (event: KeyboardEvent) => {
}
if (!timer) {
// Initial move, then t0 delay until repeats at tr intervals
documentStore.fileExplorer.cursorMove(vert)
const select = event.shiftKey
documentStore.fileExplorer.cursorMove(vert, select)
const t0 = 200, tr = 30
timer = setTimeout(
() => timer = setInterval(() => { documentStore.fileExplorer.cursorMove(vert) }, tr),
() => timer = setInterval(() => {
documentStore.fileExplorer.cursorMove(vert, select)
}, tr),
t0 - tr
)
}

View File

@ -189,7 +189,6 @@ defineExpose({
editing.value = cursor.value
},
cursorSelect() {
console.log('select', documentStore.selected)
const doc = cursor.value
if (!doc) return
if (documentStore.selected.has(doc.key)) {
@ -199,7 +198,7 @@ defineExpose({
}
this.cursorMove(1)
},
cursorMove(d: number) {
cursorMove(d: number, select = false) {
// Move cursor up or down (keyboard navigation)
const documents = sorted(props.documents as FolderDocument[])
if (documents.length === 0) {
@ -208,10 +207,23 @@ defineExpose({
}
const mod = (a: number, b: number) => ((a % b) + b) % b
const index = cursor.value !== null ? documents.indexOf(cursor.value) : -1
cursor.value = documents[mod(index + d, documents.length + 1)] ?? null
const moveto = mod(index + d, documents.length + 1)
cursor.value = documents[moveto] ?? null
const tr = document.getElementById(
`file-${cursor.value.key}`
) as HTMLTableRowElement | null
if (select) {
// Go forwards, possibly wrapping over the end; the last entry is not toggled
let [begin, end] = d > 0 ? [index, moveto] : [moveto, index]
for (let p = begin; p !== end; p = mod(p + 1, documents.length)) {
const doc = documents[p]
if (documentStore.selected.has(doc.key)) {
documentStore.selected.delete(doc.key)
} else {
documentStore.selected.add(doc.key)
}
}
}
// @ts-ignore
scrolltr = tr
if (!scrolltimer) {

View File

@ -3,6 +3,7 @@
ref="input"
id="FileRenameInput"
type="text"
autocorrect="off"
v-model="name"
@blur="exit"
@keyup.esc="exit"