remove: excessive changes

This commit is contained in:
Darshan
2025-10-28 18:20:39 +05:30
parent b084bc9d11
commit c71c8d0998
4 changed files with 10 additions and 23 deletions
@@ -475,8 +475,7 @@
<EditRow
bind:this={editRow}
bind:row={$databaseRowSheetOptions.row}
bind:rowId={$databaseRowSheetOptions.rowId}
autoFocus={$databaseRowSheetOptions.autoFocus} />
bind:rowId={$databaseRowSheetOptions.rowId} />
{/key}
</SideSheet>
@@ -19,12 +19,10 @@
let {
row = $bindable(),
rowId = $bindable(null),
autoFocus = true
rowId = $bindable(null)
}: {
row?: Models.Row | null;
rowId?: string | null;
autoFocus?: boolean;
} = $props();
let loading = $state(false);
@@ -78,9 +76,7 @@
$effect(() => {
if (row) {
work = initWork();
if (autoFocus) {
focusFirstInput();
}
requestAnimationFrame(() => focusFirstInput());
} else {
work = null;
}
@@ -543,13 +543,11 @@
} else if (type === 'row') {
if (action === 'update') {
databaseRowSheetOptions.update((opts) => {
const wasOpen = opts.show;
return {
...opts,
row,
show: true,
title: 'Update row',
autoFocus: !wasOpen,
title: 'Update row'
};
});
}
@@ -760,15 +758,11 @@
$: rowSelection = !$spreadsheetLoading && !$paginatedRowsLoading ? true : ('disabled' as const);
$: if (!$databaseRowSheetOptions.show) {
$databaseRowSheetOptions.autoFocus = true;
if (previouslyFocusedElement) {
requestAnimationFrame(() => {
(previouslyFocusedElement as HTMLElement)?.focus();
previouslyFocusedElement = null;
});
}
$: if (!$databaseRowSheetOptions.show && previouslyFocusedElement) {
requestAnimationFrame(() => {
(previouslyFocusedElement as HTMLElement)?.focus();
previouslyFocusedElement = null;
});
}
</script>
@@ -64,14 +64,12 @@ export const databaseRowSheetOptions = writable<
DatabaseSheetOptions & {
row: Models.Row;
rowId?: string;
autoFocus?: boolean;
}
>({
title: null,
show: false,
row: null,
rowId: null, // for loading from a given id
autoFocus: true
rowId: null // for loading from a given id
});
export const databaseRelatedRowSheetOptions = writable<