Skip to content

Commit a99774b

Browse files
fix: table-components refactor AddRow and Editable components for improved disabled state handling and UI consistency
1 parent 73b2e37 commit a99774b

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/codeblocks/ui/componets/Table/AddRow/AddRow.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
const { text, onClick, disabled = false }: Props = $props();
1111
</script>
1212

13-
<tr class="add-row" class:disabled={disabled}>
13+
<tr class="add-row" class:disabled>
1414
<td colspan="4" onclick={() => (disabled ? undefined : onClick())}>
1515
<div class="button">
1616
<Icon name="circle-plus" />

src/codeblocks/ui/componets/Table/Editable/Editable.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
type={valueType}
7575
min={valueType === 'number' ? '0' : undefined}
7676
step={valueType === 'number' ? '0.10' : undefined}
77-
disabled={disabled}
77+
{disabled}
7878
onblur={handleOnLeave}
7979
onwheel={handleOnWheel}
8080
onkeydown={handleOnInputKeyDown}

src/codeblocks/ui/componets/Table/Table.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@
3232
(categories: TableCategories, rows: TableRows) => {
3333
if ($tableStateStore.isEditing) return;
3434
35-
// Block interactions while saving
3635
tableStateStore.update((s) => ({ ...s, isSaving: true }));
3736
try {
3837
onTableChange(categories, rows);
3938
} finally {
40-
// Release saving lock on next tick to allow CM dispatch to finish
4139
setTimeout(() => tableStateStore.update((s) => ({ ...s, isSaving: false })), 0);
4240
}
4341
},
@@ -83,7 +81,11 @@
8381
<Row {row} />
8482
{/each}
8583

86-
<AddRow text="New Row" onClick={() => newRow(categoryId)} disabled={$tableStateStore.isSaving} />
84+
<AddRow
85+
text="New Row"
86+
onClick={() => newRow(categoryId)}
87+
disabled={$tableStateStore.isSaving}
88+
/>
8789

8890
{#if $tableStore.categories.size > 1}
8991
<CategoryFooter {categoryId} />

0 commit comments

Comments
 (0)