merge v0.23.0-rc changes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script>
|
||||
import SchemaField from "@/components/collections/schema/SchemaField.svelte";
|
||||
import tooltip from "@/actions/tooltip";
|
||||
import Field from "@/components/base/Field.svelte";
|
||||
import SchemaField from "@/components/collections/schema/SchemaField.svelte";
|
||||
|
||||
export let field;
|
||||
export let key = "";
|
||||
@@ -9,37 +10,73 @@
|
||||
<SchemaField bind:field {key} on:rename on:remove on:duplicate {...$$restProps}>
|
||||
<svelte:fragment slot="options">
|
||||
<div class="grid grid-sm">
|
||||
<div class="col-sm-3">
|
||||
<Field class="form-field" name="schema.{key}.options.min" let:uniqueId>
|
||||
<label for={uniqueId}>Min length</label>
|
||||
<input type="number" id={uniqueId} step="1" min="0" bind:value={field.options.min} />
|
||||
</Field>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<Field class="form-field" name="schema.{key}.options.max" let:uniqueId>
|
||||
<label for={uniqueId}>Max length</label>
|
||||
<div class="col-sm-6">
|
||||
<Field class="form-field" name="fields.{key}.min" let:uniqueId>
|
||||
<label for={uniqueId}>
|
||||
<span class="txt">Min length</span>
|
||||
<i
|
||||
class="ri-information-line link-hint"
|
||||
use:tooltip={"Clear the field or set it to 0 for no limit."}
|
||||
/>
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
id={uniqueId}
|
||||
step="1"
|
||||
min={field.options.min || 0}
|
||||
bind:value={field.options.max}
|
||||
min="0"
|
||||
placeholder="No min limit"
|
||||
value={field.min || ""}
|
||||
on:input={(e) => (field.min = e.target.value << 0)}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<Field class="form-field" name="schema.{key}.options.pattern" let:uniqueId>
|
||||
<label for={uniqueId}>Regex pattern</label>
|
||||
<Field class="form-field" name="fields.{key}.max" let:uniqueId>
|
||||
<label for={uniqueId}>
|
||||
<span class="txt">Max length</span>
|
||||
<i
|
||||
class="ri-information-line link-hint"
|
||||
use:tooltip={"Clear the field or set it to 0 to fallback to the default limit."}
|
||||
/>
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
type="number"
|
||||
id={uniqueId}
|
||||
placeholder={"Valid Go regular expression, eg. ^\\w+$"}
|
||||
bind:value={field.options.pattern}
|
||||
step="1"
|
||||
placeholder="Default to max 5000 characters"
|
||||
min={field.min || 0}
|
||||
value={field.max || ""}
|
||||
on:input={(e) => (field.max = e.target.value << 0)}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<Field class="form-field" name="fields.{key}.pattern" let:uniqueId>
|
||||
<label for={uniqueId}>Validation pattern</label>
|
||||
<input type="text" id={uniqueId} bind:value={field.pattern} />
|
||||
<div class="help-block">
|
||||
<p>Ex. <code>{"^[a-z0-9]+$"}</code></p>
|
||||
</div>
|
||||
</Field>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<Field class="form-field" name="fields.{key}.pattern" let:uniqueId>
|
||||
<label for={uniqueId}>
|
||||
<span class="txt">Autogenerate pattern</span>
|
||||
<i
|
||||
class="ri-information-line link-hint"
|
||||
use:tooltip={"Set and autogenerate text matching the pattern on missing record create value."}
|
||||
/>
|
||||
</label>
|
||||
<input type="text" id={uniqueId} bind:value={field.autogeneratePattern} />
|
||||
<div class="help-block">
|
||||
<p>Ex. <code>{"[a-z0-9]{30}"}</code></p>
|
||||
</div>
|
||||
</Field>
|
||||
</div>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</SchemaField>
|
||||
|
||||
Reference in New Issue
Block a user