using BBUI inputs where possible
This commit is contained in:
parent
43830f3913
commit
43faa20b44
|
@ -8,6 +8,7 @@
|
||||||
import UIkit from "uikit"
|
import UIkit from "uikit"
|
||||||
import { isRootComponent } from "./pagesParsing/searchComponents"
|
import { isRootComponent } from "./pagesParsing/searchComponents"
|
||||||
import { splitName } from "./pagesParsing/splitRootComponentName.js"
|
import { splitName } from "./pagesParsing/splitRootComponentName.js"
|
||||||
|
import { Input, Select } from "@budibase/bbui"
|
||||||
|
|
||||||
import { find, filter, some, map, includes } from "lodash/fp"
|
import { find, filter, some, map, includes } from "lodash/fp"
|
||||||
import { assign } from "lodash"
|
import { assign } from "lodash"
|
||||||
|
@ -21,6 +22,8 @@
|
||||||
let layoutComponent
|
let layoutComponent
|
||||||
let screens
|
let screens
|
||||||
let name = ""
|
let name = ""
|
||||||
|
let nameError = ""
|
||||||
|
let routeError
|
||||||
|
|
||||||
let saveAttempted = false
|
let saveAttempted = false
|
||||||
|
|
||||||
|
@ -39,12 +42,27 @@
|
||||||
const save = () => {
|
const save = () => {
|
||||||
saveAttempted = true
|
saveAttempted = true
|
||||||
|
|
||||||
const isValid =
|
if (name.length === 0) {
|
||||||
name.length > 0 &&
|
nameError = "Name is required"
|
||||||
!screenNameExists(name) &&
|
} else {
|
||||||
route.length > 0 &&
|
if (screenNameExists(name)) {
|
||||||
!routeNameExists(route) &&
|
nameError = "This name is already taken"
|
||||||
layoutComponent
|
} else {
|
||||||
|
nameError = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (route.length === 0) {
|
||||||
|
routeError = "Url is required"
|
||||||
|
} else {
|
||||||
|
if (routeNameExists(name)) {
|
||||||
|
routeError = "This url is already taken"
|
||||||
|
} else {
|
||||||
|
routeError = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const isValid = !routeError && !nameError
|
||||||
|
|
||||||
if (!isValid) return
|
if (!isValid) return
|
||||||
|
|
||||||
|
@ -82,40 +100,26 @@
|
||||||
onOk={save}
|
onOk={save}
|
||||||
okText="Create Screen">
|
okText="Create Screen">
|
||||||
|
|
||||||
<div class="uk-form-horizontal">
|
<div>
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
<label class="uk-form-label">Name</label>
|
<Input label="Name" error={nameError} bind:value={name} />
|
||||||
<div class="uk-form-controls">
|
|
||||||
<input
|
|
||||||
class="uk-input uk-form-small"
|
|
||||||
class:uk-form-danger={saveAttempted && (name.length === 0 || screenNameExists(name))}
|
|
||||||
bind:value={name} />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
<label class="uk-form-label">Route (URL)</label>
|
<Input
|
||||||
<div class="uk-form-controls">
|
label="Url"
|
||||||
<input
|
error={routeError}
|
||||||
class="uk-input uk-form-small"
|
bind:value={route}
|
||||||
class:uk-form-danger={saveAttempted && (route.length === 0 || routeNameExists(route))}
|
on:change={routeChanged} />
|
||||||
bind:value={route}
|
|
||||||
on:change={routeChanged} />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
<label class="uk-form-label">Layout Component</label>
|
<label>Layout Component</label>
|
||||||
<div class="uk-form-controls">
|
<Select bind:value={layoutComponent}>
|
||||||
<select
|
{#each layoutComponents as { _component, name }}
|
||||||
class="uk-select uk-form-small"
|
<option value={_component}>{name}</option>
|
||||||
bind:value={layoutComponent}
|
{/each}
|
||||||
class:uk-form-danger={saveAttempted && !layoutComponent}>
|
</Select>
|
||||||
{#each layoutComponents as { _component, name }}
|
|
||||||
<option value={_component}>{name}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -126,28 +130,4 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uk-form-controls {
|
|
||||||
margin-left: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-form-label {
|
|
||||||
padding-bottom: 10px;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 16px;
|
|
||||||
color: var(--grey-7);
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-input {
|
|
||||||
height: 40px !important;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-select {
|
|
||||||
height: 40px !important;
|
|
||||||
font-weight: 500px;
|
|
||||||
color: var(--grey-5);
|
|
||||||
border: 1px solid var(--grey-2);
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { backendUiStore } from "builderStore"
|
import { backendUiStore } from "builderStore"
|
||||||
|
import { Input } from "@budibase/bbui"
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
</script>
|
</script>
|
||||||
|
@ -19,8 +20,7 @@
|
||||||
<label class="uk-form-label fields">Fields</label>
|
<label class="uk-form-label fields">Fields</label>
|
||||||
{#each Object.keys(value.model.schema) as field}
|
{#each Object.keys(value.model.schema) as field}
|
||||||
<div class="uk-form-controls uk-margin">
|
<div class="uk-form-controls uk-margin">
|
||||||
<label class="uk-form-label">{field}</label>
|
<Input bind:value={value[field]} label={field} />
|
||||||
<input type="text" class="budibase__input" bind:value={value[field]} />
|
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import { notifier } from "builderStore/store/notifications"
|
import { notifier } from "builderStore/store/notifications"
|
||||||
import WorkflowBlockSetup from "./WorkflowBlockSetup.svelte"
|
import WorkflowBlockSetup from "./WorkflowBlockSetup.svelte"
|
||||||
import DeleteWorkflowModal from "./DeleteWorkflowModal.svelte"
|
import DeleteWorkflowModal from "./DeleteWorkflowModal.svelte"
|
||||||
import { Button } from "@budibase/bbui"
|
import { Button, Input } from "@budibase/bbui"
|
||||||
|
|
||||||
const { open, close } = getContext("simple-modal")
|
const { open, close } = getContext("simple-modal")
|
||||||
|
|
||||||
|
@ -112,13 +112,7 @@
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="block-label">Workflow: {workflow.name}</div>
|
<div class="block-label">Workflow: {workflow.name}</div>
|
||||||
<div class="config-item">
|
<div class="config-item">
|
||||||
<label>Name</label>
|
<Input label="Name" bind:value={workflow.name} thin />
|
||||||
<div class="form">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="budibase_input"
|
|
||||||
bind:value={workflow.name} />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="config-item">
|
<div class="config-item">
|
||||||
<label class="uk-form-label">User Access</label>
|
<label class="uk-form-label">User Access</label>
|
||||||
|
@ -194,28 +188,12 @@
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.budibase_input {
|
|
||||||
height: 36px;
|
|
||||||
width: 244px;
|
|
||||||
border-radius: 3px;
|
|
||||||
background-color: var(--grey-2);
|
|
||||||
border: 1px solid var(--grey-2);
|
|
||||||
text-align: left;
|
|
||||||
color: var(--ink);
|
|
||||||
font-size: 14px;
|
|
||||||
padding-left: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
header > span {
|
header > span {
|
||||||
color: var(--grey-5);
|
color: var(--grey-5);
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form {
|
|
||||||
margin-top: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
label {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import ComponentSelector from "./ParamInputs/ComponentSelector.svelte"
|
import ComponentSelector from "./ParamInputs/ComponentSelector.svelte"
|
||||||
import ModelSelector from "./ParamInputs/ModelSelector.svelte"
|
import ModelSelector from "./ParamInputs/ModelSelector.svelte"
|
||||||
import RecordSelector from "./ParamInputs/RecordSelector.svelte"
|
import RecordSelector from "./ParamInputs/RecordSelector.svelte"
|
||||||
|
import { Input, TextArea, Select } from "@budibase/bbui"
|
||||||
|
|
||||||
export let workflowBlock
|
export let workflowBlock
|
||||||
|
|
||||||
|
@ -18,42 +19,34 @@
|
||||||
<div class="block-field">
|
<div class="block-field">
|
||||||
<label class="label">{parameter}</label>
|
<label class="label">{parameter}</label>
|
||||||
{#if Array.isArray(type)}
|
{#if Array.isArray(type)}
|
||||||
<select class="budibase_input" bind:value={workflowBlock.args[parameter]}>
|
<Select bind:value={workflowBlock.args[parameter]} thin>
|
||||||
{#each type as option}
|
{#each type as option}
|
||||||
<option value={option}>{option}</option>
|
<option value={option}>{option}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</Select>
|
||||||
{:else if type === 'component'}
|
{:else if type === 'component'}
|
||||||
<ComponentSelector bind:value={workflowBlock.args[parameter]} />
|
<ComponentSelector bind:value={workflowBlock.args[parameter]} />
|
||||||
{:else if type === 'accessLevel'}
|
{:else if type === 'accessLevel'}
|
||||||
<select class="budibase_input" bind:value={workflowBlock.args[parameter]}>
|
<Select bind:value={workflowBlock.args[parameter]} thin>
|
||||||
<option value="ADMIN">Admin</option>
|
<option value="ADMIN">Admin</option>
|
||||||
<option value="POWER_USER">Power User</option>
|
<option value="POWER_USER">Power User</option>
|
||||||
</select>
|
</Select>
|
||||||
{:else if type === 'password'}
|
{:else if type === 'password'}
|
||||||
<input
|
<Input type="password" thin bind:value={workflowBlock.args[parameter]} />
|
||||||
type="password"
|
|
||||||
class="budibase_input"
|
|
||||||
bind:value={workflowBlock.args[parameter]} />
|
|
||||||
{:else if type === 'number'}
|
{:else if type === 'number'}
|
||||||
<input
|
<Input type="number" thin bind:value={workflowBlock.args[parameter]} />
|
||||||
type="number"
|
|
||||||
class="budibase_input"
|
|
||||||
bind:value={workflowBlock.args[parameter]} />
|
|
||||||
{:else if type === 'longText'}
|
{:else if type === 'longText'}
|
||||||
<textarea
|
<TextArea
|
||||||
type="text"
|
type="text"
|
||||||
class="budibase_input"
|
thin
|
||||||
bind:value={workflowBlock.args[parameter]} />
|
bind:value={workflowBlock.args[parameter]}
|
||||||
|
label="" />
|
||||||
{:else if type === 'model'}
|
{:else if type === 'model'}
|
||||||
<ModelSelector bind:value={workflowBlock.args[parameter]} />
|
<ModelSelector bind:value={workflowBlock.args[parameter]} />
|
||||||
{:else if type === 'record'}
|
{:else if type === 'record'}
|
||||||
<RecordSelector bind:value={workflowBlock.args[parameter]} />
|
<RecordSelector bind:value={workflowBlock.args[parameter]} />
|
||||||
{:else if type === 'string'}
|
{:else if type === 'string'}
|
||||||
<input
|
<Input type="text" thin bind:value={workflowBlock.args[parameter]} />
|
||||||
type="text"
|
|
||||||
class="budibase_input"
|
|
||||||
bind:value={workflowBlock.args[parameter]} />
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -62,17 +55,6 @@
|
||||||
.block-field {
|
.block-field {
|
||||||
display: grid;
|
display: grid;
|
||||||
}
|
}
|
||||||
.budibase_input {
|
|
||||||
height: 36px;
|
|
||||||
border-radius: 5px;
|
|
||||||
background-color: var(--grey-2);
|
|
||||||
border: 1px solid var(--grey-2);
|
|
||||||
text-align: left;
|
|
||||||
color: var(--ink);
|
|
||||||
font-size: 14px;
|
|
||||||
padding-left: 12px;
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
label {
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { store, backendUiStore, workflowStore } from "builderStore"
|
import { store, backendUiStore, workflowStore } from "builderStore"
|
||||||
import { notifier } from "builderStore/store/notifications"
|
import { notifier } from "builderStore/store/notifications"
|
||||||
import ActionButton from "components/common/ActionButton.svelte"
|
import ActionButton from "components/common/ActionButton.svelte"
|
||||||
|
import { Input } from "@budibase/bbui"
|
||||||
|
|
||||||
export let onClosed
|
export let onClosed
|
||||||
|
|
||||||
|
@ -26,8 +27,7 @@
|
||||||
Create Workflow
|
Create Workflow
|
||||||
</header>
|
</header>
|
||||||
<div>
|
<div>
|
||||||
<label class="uk-form-label" for="form-stacked-text">Name</label>
|
<Input bind:value={name} label="Name" />
|
||||||
<input class="uk-input" type="text" bind:value={name} />
|
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<a href="https://docs.budibase.com">
|
<a href="https://docs.budibase.com">
|
||||||
|
|
Loading…
Reference in New Issue