diff --git a/packages/standard-components/src/DataForm.svelte b/packages/standard-components/src/DataForm.svelte index 0b8267c87f..8165fc6bdd 100644 --- a/packages/standard-components/src/DataForm.svelte +++ b/packages/standard-components/src/DataForm.svelte @@ -1,9 +1,19 @@ @@ -112,44 +118,52 @@ {#if title}

{title}

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

{error}

- {/each} -
+ {#each fields as field} -
- - {#if schema[field].type === 'string' && schema[field].constraints.inclusion} - - {:else if schema[field].type === 'datetime'} - - {:else if schema[field].type === 'boolean'} - - {:else if schema[field].type === 'number'} - - {:else if schema[field].type === 'string'} - - {:else if schema[field].type === 'attachment'} + {#if schema[field].type === 'options'} + + {:else if schema[field].type === 'datetime'} + + {:else if schema[field].type === 'boolean'} + + {:else if schema[field].type === 'number'} + + {:else if schema[field].type === 'string'} + + {:else if schema[field].type === 'attachment'} +
+ - {/if} -
-
+
+ {:else if schema[field].type === 'link'} + + {/if} {/each} -
- +
+
@@ -162,104 +176,14 @@ } .form-content { - margin-bottom: 20px; + margin-bottom: var(--spacing-xl); + display: grid; + gap: var(--spacing-xl); width: 100%; } - .input { - border-radius: 5px; - border: 1px solid #e6e6e6; - padding: 1rem; - font-size: 16px; - } - - .form-item { - display: flex; - flex-direction: column; - margin-bottom: 16px; - } - - hr { - border: 1px solid var(--grey-1); - margin: 20px 0px; - } - - hr:nth-last-child(2) { - border: 1px solid #fff; - margin: 20px 0px; - } - - .button-block { + .buttons { display: flex; justify-content: flex-end; } - - button { - font-size: 16px; - padding: 0.4em; - box-sizing: border-box; - border-radius: 4px; - color: white; - background-color: #393c44; - outline: none; - width: 300px; - height: 40px; - cursor: pointer; - transition: all 0.2s ease 0s; - overflow: hidden; - outline: none; - user-select: none; - white-space: nowrap; - text-align: center; - } - - button.saved { - background-color: #84c991; - border: none; - } - - button:hover { - box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), - 0 4px 6px -2px rgba(0, 0, 0, 0.05); - } - - input[type="checkbox"] { - width: 32px; - height: 32px; - padding: 0; - margin: 0; - vertical-align: bottom; - position: relative; - top: -1px; - *overflow: hidden; - } - - select::-ms-expand { - display: none; - } - select { - display: inline-block; - cursor: pointer; - align-items: baseline; - box-sizing: border-box; - padding: 1em 1em; - border: 1px solid #eaeaea; - border-radius: 5px; - font: inherit; - line-height: inherit; - -webkit-appearance: none; - -moz-appearance: none; - -ms-appearance: none; - appearance: none; - background-repeat: no-repeat; - background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), - linear-gradient(135deg, currentColor 50%, transparent 50%); - 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/ErrorsBox.svelte b/packages/standard-components/src/ErrorsBox.svelte new file mode 100644 index 0000000000..ac948fb28b --- /dev/null +++ b/packages/standard-components/src/ErrorsBox.svelte @@ -0,0 +1,31 @@ + + +{#if hasErrors} +
+ {#each errors as error} +
{error.dataPath} {error.message}
+ {/each} +
+{/if} + + diff --git a/packages/standard-components/src/LinkedRecordSelector.svelte b/packages/standard-components/src/LinkedRecordSelector.svelte new file mode 100644 index 0000000000..4ea84223f3 --- /dev/null +++ b/packages/standard-components/src/LinkedRecordSelector.svelte @@ -0,0 +1,65 @@ + + +{#if linkedModel != null} + {#if linkedModel.primaryDisplay == null} + {#if showLabel} + + {/if} + + {:else} + {#await recordsPromise then records} + + {#each records as record} + + {/each} + + {/await} + {/if} +{/if} diff --git a/packages/standard-components/src/helpers.js b/packages/standard-components/src/helpers.js new file mode 100644 index 0000000000..2989f4d39c --- /dev/null +++ b/packages/standard-components/src/helpers.js @@ -0,0 +1 @@ +export const capitalise = s => s.substring(0, 1).toUpperCase() + s.substring(1)