1
0
Fork 0
mirror of synced 2024-10-02 10:08:09 +13:00

Magic strings to enums

This commit is contained in:
Adria Navarro 2024-03-13 15:16:21 +01:00
parent 563eada394
commit fa84b3fbc2

View file

@ -479,7 +479,7 @@
newError.name = `Column name already in use.` newError.name = `Column name already in use.`
} }
if (fieldInfo.type === "auto" && !fieldInfo.subtype) { if (fieldInfo.type === FieldType.AUTO && !fieldInfo.subtype) {
newError.subtype = `Auto Column requires a type` newError.subtype = `Auto Column requires a type`
} }
@ -540,18 +540,18 @@
}} }}
/> />
{#if editableColumn.type === "string"} {#if editableColumn.type === FieldType.STRING}
<Input <Input
type="number" type="number"
label="Max Length" label="Max Length"
bind:value={editableColumn.constraints.length.maximum} bind:value={editableColumn.constraints.length.maximum}
/> />
{:else if editableColumn.type === "options"} {:else if editableColumn.type === FieldType.OPTIONS}
<OptionSelectDnD <OptionSelectDnD
bind:constraints={editableColumn.constraints} bind:constraints={editableColumn.constraints}
bind:optionColors={editableColumn.optionColors} bind:optionColors={editableColumn.optionColors}
/> />
{:else if editableColumn.type === "longform"} {:else if editableColumn.type === FieldType.LONGFORM}
<div> <div>
<div class="tooltip-alignment"> <div class="tooltip-alignment">
<Label size="M">Formatting</Label> <Label size="M">Formatting</Label>
@ -569,12 +569,12 @@
text="Enable rich text support (markdown)" text="Enable rich text support (markdown)"
/> />
</div> </div>
{:else if editableColumn.type === "array"} {:else if editableColumn.type === FieldType.ARRAY}
<OptionSelectDnD <OptionSelectDnD
bind:constraints={editableColumn.constraints} bind:constraints={editableColumn.constraints}
bind:optionColors={editableColumn.optionColors} bind:optionColors={editableColumn.optionColors}
/> />
{:else if editableColumn.type === "datetime" && !editableColumn.autocolumn} {:else if editableColumn.type === FieldType.DATETIME && !editableColumn.autocolumn}
<div class="split-label"> <div class="split-label">
<div class="label-length"> <div class="label-length">
<Label size="M">Earliest</Label> <Label size="M">Earliest</Label>
@ -613,7 +613,7 @@
</div> </div>
{/if} {/if}
<Toggle bind:value={editableColumn.dateOnly} text="Date only" /> <Toggle bind:value={editableColumn.dateOnly} text="Date only" />
{:else if editableColumn.type === "number" && !editableColumn.autocolumn} {:else if editableColumn.type === FieldType.NUMBER && !editableColumn.autocolumn}
<div class="split-label"> <div class="split-label">
<div class="label-length"> <div class="label-length">
<Label size="M">Min Value</Label> <Label size="M">Min Value</Label>
@ -638,7 +638,7 @@
/> />
</div> </div>
</div> </div>
{:else if editableColumn.type === "link"} {:else if editableColumn.type === FieldType.LINK}
<RelationshipSelector <RelationshipSelector
bind:relationshipPart1 bind:relationshipPart1
bind:relationshipPart2 bind:relationshipPart2