This commit is contained in:
Gerard Burns 2024-04-13 11:05:08 +01:00
parent 2317003fbf
commit 7fcea91ab4
8 changed files with 38 additions and 15 deletions

View File

@ -36,11 +36,11 @@
{:else if schema.type === "number"} {:else if schema.type === "number"}
<Property <Property
name="Min Value" name="Min Value"
value={schema?.constraints?.numericality?.greaterThanOrEqualTo === "" ? "None" : schema?.constraints?.numericality?.greaterThanOrEqualTo} value={[null, undefined, ""].includes(schema?.constraints?.numericality?.greaterThanOrEqualTo) ? "None" : schema?.constraints?.numericality?.greaterThanOrEqualTo}
/> />
<Property <Property
name="Max Value" name="Max Value"
value={schema?.constraints?.numericality?.lessThanOrEqualTo === "" ? "None" : schema?.constraints?.numericality?.lessThanOrEqualTo} value={[null, undefined, ""].includes(schema?.constraints?.numericality?.lessThanOrEqualTo)? "None" : schema?.constraints?.numericality?.lessThanOrEqualTo}
/> />
{:else if schema.type === "json"} {:else if schema.type === "json"}
<Property <Property

View File

@ -1,9 +1,9 @@
<script> <script>
import { Subject, Section } from './components' import { Block, Subject, Section } from './components'
</script> </script>
<Subject heading="'Required' Constraint"> <Subject heading="Required Constraint">
<Section> <Section>
A 'required' contraint can be applied to columns to ensure a value is always present. If a column doesn't have this constraint, then its value for a particular row could he missing. A <Block>required</Block> constraint can be applied to columns to ensure a value is always present. If a column doesn't have this constraint, then its value for a particular row could he missing.
</Section> </Section>
</Subject> </Subject>

View File

@ -1,9 +1,25 @@
<script> <script>
import { Subject, Section } from './components' import { Block, Subject, Section } from './components'
</script> </script>
<Subject heading="Text as Numbers"> <Subject heading="Text as Numbers">
<Section> <Section>
Text can be used in place of numbers in certain scenarios, but care needs to be taken to ensure that non-numerical values aren't also present, otherwise they may be parsed incorrectly and lead to unexpected behavior. Text can be used in place of numbers in certain scenarios, but care needs to be taken, as text that doesn't contain a strictly base-ten, non-decimal value may lead to unexpected behavior.
</Section>
<Section>
Examples:
<br />
<Block>"100"</Block>{" -> "}<Block>100</Block>
<br />
<Block>"100k"</Block>{" -> "}<Block>100</Block>
<br />
<Block>"100,000"</Block>{" -> "}<Block>100</Block>
<br />
<Block>"100 million"</Block>{" -> "}<Block>100</Block>
<br />
<Block>"100.9"</Block>{" -> "}<Block>100</Block>
<br />
<Block>"One hundred"</Block>{" -> "}<Block>Error</Block>
</Section> </Section>
</Subject> </Subject>

View File

@ -5,10 +5,10 @@
<style> <style>
.block { .block {
font-style: italic; font-style: italic;
padding: 0px 3px; padding: 0px 5px 0px 3px;
border-radius: 1px; border-radius: 1px;
background-color: var(--grey-3); background-color: var(--grey-3);
color: var(--ink); color: var(--ink);
word-break: break-all; word-break: break-word;
} }
</style> </style>

View File

@ -13,7 +13,7 @@
target="_blank" target="_blank"
class="link" class="link"
> >
<Icon size="S" name={icon} /> <Icon size="XS" name={icon} />
<span class="text"> <span class="text">
<slot> <slot>
{text} {text}
@ -32,8 +32,9 @@
.link { .link {
display: inline-flex; display: inline-flex;
box-sizing: border-box; box-sizing: border-box;
padding: 1px 0; padding: 1px 0 2px;
filter: brightness(100%); filter: brightness(100%);
align-items: center;
overflow: hidden; overflow: hidden;
flex-shrink: 0; flex-shrink: 0;

View File

@ -21,7 +21,7 @@
on:mouseleave on:mouseleave
> >
{#if icon} {#if icon}
<Icon size="S" name={icon} /> <Icon size="XS" name={icon} />
{/if} {/if}
<span class="text"> <span class="text">
<slot> <slot>
@ -39,7 +39,7 @@
on:mouseleave on:mouseleave
> >
{#if icon} {#if icon}
<Icon size="S" name={icon} /> <Icon size="XS" name={icon} />
{/if} {/if}
<span class="text"> <span class="text">
<slot> <slot>
@ -53,7 +53,7 @@
.infoWord { .infoWord {
display: inline-flex; display: inline-flex;
box-sizing: border-box; box-sizing: border-box;
padding: 1px 0; padding: 1px 0 2px;
filter: brightness(100%); filter: brightness(100%);
overflow: hidden; overflow: hidden;
transition: filter 300ms; transition: filter 300ms;

View File

@ -59,6 +59,6 @@
/* invisible properties to match other inline text elements that do have borders. If we don't match here we run into subpixel issues */ /* invisible properties to match other inline text elements that do have borders. If we don't match here we run into subpixel issues */
box-sizing: border-box; box-sizing: border-box;
border-bottom: 1px solid transparent; border-bottom: 1px solid transparent;
padding: 1px 0; padding: 1px 0 2px;
} }
</style> </style>

View File

@ -70,6 +70,10 @@
if (field) { if (field) {
return field.name return field.name
} else if (type === "jsonarray") {
// `jsonarray` isn't present in the above FIELDS constant
return "JSON Array"
} }
return "" return ""
@ -93,6 +97,8 @@
const onOptionMouseleave = (e, option) => { const onOptionMouseleave = (e, option) => {
updateTooltip(e, null); updateTooltip(e, null);
} }
$: console.log(schema)
</script> </script>
<Multiselect <Multiselect