Add `title` prop to forms (hides title if none entered)
This commit is contained in:
parent
3c557b3b3f
commit
ec594234d8
|
@ -335,6 +335,11 @@ export default {
|
||||||
key: "model",
|
key: "model",
|
||||||
control: ModelSelect,
|
control: ModelSelect,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Title",
|
||||||
|
key: "title",
|
||||||
|
control: Input,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
template: {
|
template: {
|
||||||
|
@ -355,6 +360,11 @@ export default {
|
||||||
key: "model",
|
key: "model",
|
||||||
control: ModelSelect,
|
control: ModelSelect,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Title",
|
||||||
|
key: "title",
|
||||||
|
control: Input,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -206,14 +206,16 @@
|
||||||
"description": "an HTML table that fetches data from a table or view and displays it.",
|
"description": "an HTML table that fetches data from a table or view and displays it.",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
"model": "models"
|
"model": "models",
|
||||||
|
"title": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dataformwide": {
|
"dataformwide": {
|
||||||
"description": "an HTML table that fetches data from a table or view and displays it.",
|
"description": "an HTML table that fetches data from a table or view and displays it.",
|
||||||
"data": true,
|
"data": true,
|
||||||
"props": {
|
"props": {
|
||||||
"model": "models"
|
"model": "models",
|
||||||
|
"title": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"datalist": {
|
"datalist": {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
export let _bb
|
export let _bb
|
||||||
export let model
|
export let model
|
||||||
|
export let title
|
||||||
|
|
||||||
const TYPE_MAP = {
|
const TYPE_MAP = {
|
||||||
string: "text",
|
string: "text",
|
||||||
|
@ -10,8 +11,6 @@
|
||||||
number: "number",
|
number: "number",
|
||||||
}
|
}
|
||||||
|
|
||||||
let username
|
|
||||||
let password
|
|
||||||
let newModel = {
|
let newModel = {
|
||||||
modelId: model,
|
modelId: model,
|
||||||
}
|
}
|
||||||
|
@ -64,7 +63,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form class="form" on:submit|preventDefault>
|
<form class="form" on:submit|preventDefault>
|
||||||
<h1>{modelDef.name} Form</h1>
|
{#if title}
|
||||||
|
<h1>{title}</h1>
|
||||||
|
{/if}
|
||||||
<hr />
|
<hr />
|
||||||
<div class="form-content">
|
<div class="form-content">
|
||||||
{#each fields as field}
|
{#each fields as field}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
export let _bb
|
export let _bb
|
||||||
export let model
|
export let model
|
||||||
|
export let title
|
||||||
|
|
||||||
const TYPE_MAP = {
|
const TYPE_MAP = {
|
||||||
string: "text",
|
string: "text",
|
||||||
|
@ -9,8 +10,6 @@
|
||||||
number: "number",
|
number: "number",
|
||||||
}
|
}
|
||||||
|
|
||||||
let username
|
|
||||||
let password
|
|
||||||
let newModel = {
|
let newModel = {
|
||||||
modelId: model,
|
modelId: model,
|
||||||
}
|
}
|
||||||
|
@ -54,7 +53,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form class="form" on:submit|preventDefault>
|
<form class="form" on:submit|preventDefault>
|
||||||
<h1>{modelDef.name} Form</h1>
|
{#if title}
|
||||||
|
<h1>{title}</h1>
|
||||||
|
{/if}
|
||||||
<hr />
|
<hr />
|
||||||
<div class="form-content">
|
<div class="form-content">
|
||||||
{#each fields as field}
|
{#each fields as field}
|
||||||
|
|
Loading…
Reference in New Issue