mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
table check touch area
This commit is contained in:
1 parent
b496a54e6b
commit
1f402848db
4 files changed
+33
-16
No files matched your search
@@ -10,7 +10,7 @@
|
||||
export let required = false;
|
||||
export let disabled = false;
|
||||
|
||||
let element: HTMLInputElement;
|
||||
export let element: HTMLInputElement;
|
||||
let error: string;
|
||||
|
||||
const handleInvalid = (event: Event) => {
|
||||
|
||||
@@ -14,3 +14,9 @@
|
||||
role="cell">
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.table-col {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
@@ -6,24 +6,35 @@
|
||||
|
||||
export let id: string;
|
||||
export let selectedIds: string[] = [];
|
||||
let el: HTMLInputElement;
|
||||
|
||||
const handleClick = (e: Event) => {
|
||||
// Prevent the link from being followed
|
||||
e.preventDefault();
|
||||
if (!isHTMLInputElement(el)) return;
|
||||
|
||||
selectedIds = toggle(selectedIds, id);
|
||||
|
||||
// Hack to make sure the checkbox is checked, independent of the
|
||||
// preventDefault() call above
|
||||
window.setTimeout(() => {
|
||||
el.checked = selectedIds.includes(id);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<TableCell>
|
||||
<div class="touch-area" on:click={handleClick} on:keypress={handleClick} />
|
||||
<InputCheckbox
|
||||
bind:element={el}
|
||||
id="select-{id}"
|
||||
value={selectedIds.includes(id)}
|
||||
on:click={(e) => {
|
||||
// Prevent the link from being followed
|
||||
e.preventDefault();
|
||||
const el = e.currentTarget;
|
||||
if (!isHTMLInputElement(el)) return;
|
||||
|
||||
selectedIds = toggle(selectedIds, id);
|
||||
|
||||
// Hack to make sure the checkbox is checked, independent of the
|
||||
// preventDefault() call above
|
||||
window.setTimeout(() => {
|
||||
el.checked = selectedIds.includes(id);
|
||||
});
|
||||
}} />
|
||||
on:click={handleClick} />
|
||||
</TableCell>
|
||||
|
||||
<style lang="scss">
|
||||
.touch-area {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
</style>
|
||||
+1
-1
@@ -235,7 +235,7 @@
|
||||
<div class="u-flex u-cross-center u-gap-8">
|
||||
<span class="indicator body-text-2 u-bold">{selectedDb.length}</span>
|
||||
<span>
|
||||
{selected.length > 1 ? 'documents' : 'document'} selected
|
||||
{selectedDb.length > 1 ? 'documents' : 'document'} selected
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user