fix history

This commit is contained in:
Ruben Fiszel
2025-06-15 04:22:47 +02:00
parent c242a6a975
commit cb6a344c8c
5 changed files with 56 additions and 52 deletions

View File

@@ -75,9 +75,7 @@
// @ts-ignore
gridItem.data.configuration.columnDefs = { value: [], type: 'static', loading: false }
$app = {
...$app
}
$app = $app
}
const resolvedConfig = initConfig(
@@ -230,9 +228,7 @@
)
if (!resolvedConfig.type?.configuration?.[resolvedConfig.type.selected]?.resource) {
$app = {
...$app
}
$app = $app
return
}
@@ -265,9 +261,7 @@
}
)
$app = {
...$app
}
$app = $app
} catch (e) {}
}

View File

@@ -726,14 +726,19 @@
switch (event.key) {
case 'Z':
if (event.ctrlKey || event.metaKey) {
$app = redo(history)
const napp = redo(history)
for (const key in napp) {
$app[key] = napp[key]
}
event.preventDefault()
}
break
case 'z':
if (event.ctrlKey || event.metaKey) {
$app = undo(history, $app)
const napp = undo(history, $app)
for (const key in napp) {
$app[key] = napp[key]
}
event.preventDefault()
}
break
@@ -1313,10 +1318,16 @@
undoProps={{ disabled: $history?.index === 0 }}
redoProps={{ disabled: $history && $history?.index === $history.history.length - 1 }}
on:undo={() => {
$app = undo(history, $app)
const napp = undo(history, $app)
for (const key in napp) {
$app[key] = napp[key]
}
}}
on:redo={() => {
$app = redo(history)
const napp = redo(history)
for (const key in napp) {
$app[key] = napp[key]
}
}}
/>

View File

@@ -117,7 +117,7 @@
)
// Update the app state
$app = { ...$app }
$app = $app
$selectedComponent = [parentComponentId]
$focusedGrid = {

View File

@@ -124,7 +124,7 @@
)
// Update the app state
$app = { ...$app }
$app = $app
if (parentGrid) {
$focusedGrid = {
@@ -173,7 +173,7 @@
)
// Update the app state
$app = { ...$app }
$app = $app
}
</script>
@@ -201,7 +201,7 @@
isActive && !$selectedComponent?.includes(id)
? 'outline-orange-600'
: 'outline-gray-400 dark:outline-gray-600'
}`
}`
: ''}
>
<Grid

View File

@@ -74,7 +74,8 @@
>Status</div
>
<div class="font-semibold bg-gray-100 dark:bg-gray-900 px-2 py-1 text-xs border-b"
>Action</div>
>Action</div
>
<!-- Iterate over uninitializedComponents to display each component in the grid -->
{#each unintitializedComponents as c}
@@ -82,41 +83,39 @@
{#if !item}
<div>Item {c} not found</div>
{:else}
<!-- Component Id -->
<div class="text-xs flex items-center px-2 py-2">
<Badge>
{c}
</Badge>
</div>
<!-- Component Id -->
<div class="text-xs flex items-center px-2 py-2">
<Badge>
{c}
</Badge>
</div>
<div class="text-xs flex items-center px-2 py-2">
<Badge color="blue">
{item?.data?.type || 'Unknown'}
</Badge>
</div>
<div class="text-xs flex items-center px-2 py-2">
<Badge color="blue">
{item?.data?.type || 'Unknown'}
</Badge>
</div>
<div class="text-xs flex items-center px-2 py-2">
<Badge color="red">Uninitialized</Badge>
</div>
<div class="text-xs flex items-center px-2 py-2">
<Button
color="light"
startIcon={{
icon: Trash
}}
size="xs2"
on:click={() => {
let parent = findGridItemParentGrid($app, c)
deleteGridItem($app, item.data, parent)
$app = $app
}}
>
Remove
</Button>
</div>
<div class="text-xs flex items-center px-2 py-2">
<Badge color="red">Uninitialized</Badge>
</div>
<div class="text-xs flex items-center px-2 py-2">
<Button
color="light"
startIcon={{
icon: Trash
}}
size="xs2"
on:click={() => {
let parent = findGridItemParentGrid($app, c)
deleteGridItem($app, item.data, parent)
$app = $app
}}
>
Remove
</Button>
</div>
{/if}
{/each}
</div>
</div>
@@ -166,7 +165,7 @@
on:click={() => {
if ($app.subgrids && s) {
delete $app.subgrids[s.subGridId]
$app = { ...$app }
$app = $app
}
}}
>