From 49597b4b01b72d72ae48280081ec744c94c5fc3c Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Fri, 9 Aug 2024 17:36:22 +0200 Subject: [PATCH] indicator of changed rows in save button --- packages/datalib/src/ChangeSet.ts | 4 +++ .../web/src/buttons/ToolStripButton.svelte | 4 +++ .../src/buttons/ToolStripCommandButton.svelte | 2 ++ packages/web/src/icons/FontIcon.svelte | 27 +++++++++++++++++++ .../web/src/tabs/CollectionDataTab.svelte | 7 ++++- packages/web/src/tabs/TableDataTab.svelte | 7 ++++- 6 files changed, 49 insertions(+), 2 deletions(-) diff --git a/packages/datalib/src/ChangeSet.ts b/packages/datalib/src/ChangeSet.ts index 0d9947be..89fb29a6 100644 --- a/packages/datalib/src/ChangeSet.ts +++ b/packages/datalib/src/ChangeSet.ts @@ -530,3 +530,7 @@ export function changeSetContainsChanges(changeSet: ChangeSet) { changeSet.dataUpdateCommands?.length > 0 ); } + +export function changeSetChangedCount(changeSet: ChangeSet) { + return changeSet.deletes.length + changeSet.updates.length + changeSet.inserts.length; +} diff --git a/packages/web/src/buttons/ToolStripButton.svelte b/packages/web/src/buttons/ToolStripButton.svelte index bc52c596..07b30220 100644 --- a/packages/web/src/buttons/ToolStripButton.svelte +++ b/packages/web/src/buttons/ToolStripButton.svelte @@ -5,6 +5,7 @@ export let disabled = false; export let icon = null; export let title = null; + export let iconAfter = null; const dispatch = createEventDispatcher(); @@ -18,6 +19,9 @@
+ {#if iconAfter} + + {/if}
diff --git a/packages/web/src/buttons/ToolStripCommandButton.svelte b/packages/web/src/buttons/ToolStripCommandButton.svelte index 107fb46c..8d2e92ae 100644 --- a/packages/web/src/buttons/ToolStripCommandButton.svelte +++ b/packages/web/src/buttons/ToolStripCommandButton.svelte @@ -17,6 +17,7 @@ export let component = ToolStripButton; export let hideDisabled = false; export let buttonLabel = null; + export let iconAfter = null; $: cmd = Object.values($commandsCustomized).find((x: any) => x.id == command) as any; @@ -28,6 +29,7 @@ icon={cmd.icon} on:click={cmd.onClick} disabled={!cmd.enabled} + {iconAfter} {...$$restProps} > {buttonLabel || cmd.toolbarName || cmd.name} diff --git a/packages/web/src/icons/FontIcon.svelte b/packages/web/src/icons/FontIcon.svelte index 46711ff3..c64332de 100644 --- a/packages/web/src/icons/FontIcon.svelte +++ b/packages/web/src/icons/FontIcon.svelte @@ -1,3 +1,30 @@ + +