From 44426b6bf821582e0b801436beb81b2dc45c79c1 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 10 Sep 2020 13:04:45 +0100 Subject: [PATCH] data form component date picker aware, form component refactor --- package.json | 2 +- packages/standard-components/package.json | 1 + .../standard-components/src/DataForm.svelte | 155 +++++++----------- .../src/DataFormWide.svelte | 155 +++++++----------- 4 files changed, 116 insertions(+), 197 deletions(-) diff --git a/package.json b/package.json index 69f7b0f21d..79935c5dce 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "publishdev": "lerna run publishdev", "publishnpm": "yarn build && lerna publish --force-publish", "clean": "lerna clean", - "dev": "node ./scripts/symlinkDev.js && lerna run --parallel --stream dev:builder", + "dev": "node ./scripts/symlinkDev.js && lerna run --parallel dev:builder", "test": "lerna run test", "lint": "eslint packages", "lint:fix": "eslint --fix packages", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 1325a3ad32..7cf1a9a47c 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -41,6 +41,7 @@ "d3-selection": "^1.4.2", "fast-sort": "^2.2.0", "fusioncharts": "^3.15.1-sr.1", + "lodash.debounce": "^4.0.8", "svelte-flatpickr": "^2.4.0", "svelte-fusioncharts": "^1.0.0" } diff --git a/packages/standard-components/src/DataForm.svelte b/packages/standard-components/src/DataForm.svelte index 21d4623822..4709097fad 100644 --- a/packages/standard-components/src/DataForm.svelte +++ b/packages/standard-components/src/DataForm.svelte @@ -1,7 +1,8 @@ @@ -164,23 +113,28 @@ {#if title}

{title}

{/if} + {#each errorMessages as error} +

{error}

+ {/each}
{#each fields as field}
{#if schema[field].type === 'string' && schema[field].constraints.inclusion} - {#each schema[field].constraints.inclusion as opt} {/each} - {:else} - + {:else if schema[field].type === 'datetime'} + + {:else if schema[field].type === 'boolean'} + + {:else if schema[field].type === 'number'} + + {:else if schema[field].type === 'string'} + {/if}

@@ -302,4 +256,9 @@ background-position: right 17px top 1.5em, right 10px top 1.5em; background-size: 7px 7px, 7px 7px; } + + .error { + color: red; + font-weight: 500; + } diff --git a/packages/standard-components/src/DataFormWide.svelte b/packages/standard-components/src/DataFormWide.svelte index 56011df569..99c5867d67 100644 --- a/packages/standard-components/src/DataFormWide.svelte +++ b/packages/standard-components/src/DataFormWide.svelte @@ -1,7 +1,8 @@ @@ -164,23 +113,28 @@ {#if title}

{title}

{/if} + {#each errorMessages as error} +

{error}

+ {/each}
{#each fields as field}
{#if schema[field].type === 'string' && schema[field].constraints.inclusion} - {#each schema[field].constraints.inclusion as opt} {/each} - {:else} - + {:else if schema[field].type === 'datetime'} + + {:else if schema[field].type === 'boolean'} + + {:else if schema[field].type === 'number'} + + {:else if schema[field].type === 'string'} + {/if}

@@ -293,4 +247,9 @@ background-position: right 17px top 1.5em, right 10px top 1.5em; background-size: 7px 7px, 7px 7px; } + + .error { + color: red; + font-weight: 500; + }