From 1e5506b8c3a35f29ef08ce15af9324242bc948be Mon Sep 17 00:00:00 2001 From: Dean Date: Fri, 5 Apr 2024 12:50:09 +0100 Subject: [PATCH] Full support for signature field type and some feedback changes --- packages/bbui/src/Form/Core/Signature.svelte | 313 +++++++++++++----- packages/bbui/src/Modal/Modal.svelte | 1 + packages/bbui/src/Modal/ModalContent.svelte | 23 +- .../backend/DataTable/TableDataTable.svelte | 5 + .../components/backend/DataTable/formula.js | 1 + .../design/settings/componentSettings.js | 1 + .../ValidationEditor/ValidationDrawer.svelte | 1 + .../builder/src/constants/backend/index.js | 1 - packages/client/manifest.json | 2 +- .../client/src/components/Component.svelte | 3 + .../src/components/app/GridBlock.svelte | 2 + .../src/components/app/forms/Signature.svelte | 8 - .../app/forms/SignatureField.svelte | 140 +++++++- .../src/components/app/forms/validation.js | 4 +- .../src/components/SignatureModal.svelte | 48 +++ .../grid/cells/SignatureCell.svelte | 146 +++++--- .../src/components/grid/layout/Grid.svelte | 2 + .../frontend-core/src/components/index.js | 1 + packages/server/src/sdk/app/rows/utils.ts | 6 +- .../src/utilities/rowProcessor/attachments.ts | 11 +- .../src/utilities/rowProcessor/index.ts | 12 +- 21 files changed, 572 insertions(+), 159 deletions(-) delete mode 100644 packages/client/src/components/app/forms/Signature.svelte create mode 100644 packages/frontend-core/src/components/SignatureModal.svelte diff --git a/packages/bbui/src/Form/Core/Signature.svelte b/packages/bbui/src/Form/Core/Signature.svelte index 74a022881c..de73c803ad 100644 --- a/packages/bbui/src/Form/Core/Signature.svelte +++ b/packages/bbui/src/Form/Core/Signature.svelte @@ -1,65 +1,80 @@ - -
-
{JSON.stringify(debugData, null, 2)}
- { - touching = true - canvasMouseDown(e) - }} - on:touchend={e => { - touching = false - touchmove = false - stopTracking(e) - }} - on:touchmove={e => { - touchmove = true - handleDraw(e) - }} - on:touchleave={e => { - touching = false - touchmove = false - stopTracking(e) - }} - class:touching={touching && debug} - class:touchmove={touchmove && debug} - /> +
+ {#if !disabled} +
+ {#if updated && saveIcon} + + { + dispatch("change", toDataUrl()) + }} + /> + + {/if} + {#if signature?.url && !updated} + + { + if (editable) { + clearCanvas() + } + dispatch("clear") + }} + /> + + {/if} +
+ {/if} + {#if !editable && signature?.url} + + {#if !urlFailed} + { + urlFailed = true + }} + /> + {:else} + Could not load signature + {/if} + {:else} +
+ + {#if editable} +
+
+ +
+
+
+ {/if} +
+ {/if}
diff --git a/packages/bbui/src/Modal/Modal.svelte b/packages/bbui/src/Modal/Modal.svelte index be9c338892..4656be69d1 100644 --- a/packages/bbui/src/Modal/Modal.svelte +++ b/packages/bbui/src/Modal/Modal.svelte @@ -173,6 +173,7 @@ } .spectrum-Modal { + border: 2px solid var(--spectrum-global-color-gray-200); overflow: visible; max-height: none; margin: 40px 0; diff --git a/packages/bbui/src/Modal/ModalContent.svelte b/packages/bbui/src/Modal/ModalContent.svelte index 189ef70c2b..ecad889031 100644 --- a/packages/bbui/src/Modal/ModalContent.svelte +++ b/packages/bbui/src/Modal/ModalContent.svelte @@ -27,6 +27,7 @@ export let secondaryButtonText = undefined export let secondaryAction = undefined export let secondaryButtonWarning = false + export let enableGrid = true const { hide, cancel } = getContext(Context.Modal) let loading = false @@ -63,12 +64,13 @@ class:spectrum-Dialog--medium={size === "M"} class:spectrum-Dialog--large={size === "L"} class:spectrum-Dialog--extraLarge={size === "XL"} + class:no-grid={!enableGrid} style="position: relative;" role="dialog" tabindex="-1" aria-modal="true" > -
+