fix select elements
This commit is contained in:
parent
8427fc3d24
commit
a35c4bca2a
|
@ -52,14 +52,14 @@
|
||||||
<div class="input-group-row">
|
<div class="input-group-row">
|
||||||
<p>The</p>
|
<p>The</p>
|
||||||
<Select secondary thin bind:value={view.calculation}>
|
<Select secondary thin bind:value={view.calculation}>
|
||||||
<option value={null} />
|
<option value="">Choose an option</option>
|
||||||
{#each CALCULATIONS as calculation}
|
{#each CALCULATIONS as calculation}
|
||||||
<option value={calculation.key}>{calculation.name}</option>
|
<option value={calculation.key}>{calculation.name}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</Select>
|
||||||
<p>of</p>
|
<p>of</p>
|
||||||
<Select secondary thin bind:value={view.field}>
|
<Select secondary thin bind:value={view.field}>
|
||||||
<option value={null} />
|
<option value="">Choose an option</option>
|
||||||
{#each fields as field}
|
{#each fields as field}
|
||||||
<option value={field}>{field}</option>
|
<option value={field}>{field}</option>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
@ -106,17 +106,20 @@
|
||||||
<p>Where</p>
|
<p>Where</p>
|
||||||
{:else}
|
{:else}
|
||||||
<Select secondary thin bind:value={filter.conjunction}>
|
<Select secondary thin bind:value={filter.conjunction}>
|
||||||
|
<option value="">Choose an option</option>
|
||||||
{#each CONJUNCTIONS as conjunction}
|
{#each CONJUNCTIONS as conjunction}
|
||||||
<option value={conjunction.key}>{conjunction.name}</option>
|
<option value={conjunction.key}>{conjunction.name}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</Select>
|
||||||
{/if}
|
{/if}
|
||||||
<Select secondary thin bind:value={filter.key}>
|
<Select secondary thin bind:value={filter.key}>
|
||||||
|
<option value="">Choose an option</option>
|
||||||
{#each fields as field}
|
{#each fields as field}
|
||||||
<option value={field}>{field}</option>
|
<option value={field}>{field}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</Select>
|
||||||
<Select secondary thin bind:value={filter.condition}>
|
<Select secondary thin bind:value={filter.condition}>
|
||||||
|
<option value="">Choose an option</option>
|
||||||
{#each CONDITIONS as condition}
|
{#each CONDITIONS as condition}
|
||||||
<option value={condition.key}>{condition.name}</option>
|
<option value={condition.key}>{condition.name}</option>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
<div class="input-group-row">
|
<div class="input-group-row">
|
||||||
<p>Group By</p>
|
<p>Group By</p>
|
||||||
<Select secondary thin bind:value={view.groupBy}>
|
<Select secondary thin bind:value={view.groupBy}>
|
||||||
<option value={false} />
|
<option value="">Choose an option</option>
|
||||||
{#each fields as field}
|
{#each fields as field}
|
||||||
<option value={field}>{field}</option>
|
<option value={field}>{field}</option>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
name="Name"
|
name="Name"
|
||||||
placeholder="Username" />
|
placeholder="Username" />
|
||||||
<Select disabled={!editMode} bind:value={user.accessLevelId} thin>
|
<Select disabled={!editMode} bind:value={user.accessLevelId} thin>
|
||||||
|
<option value="">Choose an option</option>
|
||||||
<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>
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
name="Password"
|
name="Password"
|
||||||
placeholder="Password" />
|
placeholder="Password" />
|
||||||
<Select bind:value={accessLevelId} thin>
|
<Select bind:value={accessLevelId} thin>
|
||||||
|
<option value="">Choose an option</option>
|
||||||
<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>
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
type="pasword"
|
type="pasword"
|
||||||
error={blurred.password && validationErrors.password} />
|
error={blurred.password && validationErrors.password} />
|
||||||
<Select secondary name="accessLevelId">
|
<Select secondary name="accessLevelId">
|
||||||
|
<option value="">Choose an option</option>
|
||||||
<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>
|
||||||
|
|
|
@ -1,139 +0,0 @@
|
||||||
<script>
|
|
||||||
import { Button, Select } from "@budibase/bbui"
|
|
||||||
import StateBindingCascader from "./StateBindingCascader.svelte"
|
|
||||||
import { find, map, keys, reduce, keyBy } from "lodash/fp"
|
|
||||||
import { pipe } from "components/common/core"
|
|
||||||
import {
|
|
||||||
EVENT_TYPE_MEMBER_NAME,
|
|
||||||
allHandlers,
|
|
||||||
} from "components/common/eventHandlers"
|
|
||||||
import { store } from "builderStore"
|
|
||||||
|
|
||||||
export let handler
|
|
||||||
export let onCreate
|
|
||||||
export let onChanged
|
|
||||||
export let onRemoved
|
|
||||||
|
|
||||||
export let index
|
|
||||||
export let newHandler
|
|
||||||
|
|
||||||
let eventOptions
|
|
||||||
let handlerType
|
|
||||||
let parameters = []
|
|
||||||
|
|
||||||
$: eventOptions = allHandlers()
|
|
||||||
|
|
||||||
$: {
|
|
||||||
if (handler) {
|
|
||||||
handlerType = handler[EVENT_TYPE_MEMBER_NAME]
|
|
||||||
parameters = Object.entries(handler.parameters).map(([name, value]) => ({
|
|
||||||
name,
|
|
||||||
value,
|
|
||||||
}))
|
|
||||||
} else {
|
|
||||||
// Empty Handler
|
|
||||||
handlerType = ""
|
|
||||||
parameters = []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handlerChanged = (type, params) => {
|
|
||||||
const handlerParams = {}
|
|
||||||
for (let param of params) {
|
|
||||||
handlerParams[param.name] = param.value
|
|
||||||
}
|
|
||||||
|
|
||||||
const updatedHandler = {
|
|
||||||
[EVENT_TYPE_MEMBER_NAME]: type,
|
|
||||||
parameters: handlerParams,
|
|
||||||
}
|
|
||||||
|
|
||||||
onChanged(updatedHandler, index)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handlerTypeChanged = e => {
|
|
||||||
const handlerType = eventOptions.find(
|
|
||||||
handler => handler.name === e.target.value
|
|
||||||
)
|
|
||||||
const defaultParams = handlerType.parameters.map(param => ({
|
|
||||||
name: param,
|
|
||||||
value: "",
|
|
||||||
}))
|
|
||||||
|
|
||||||
handlerChanged(handlerType.name, defaultParams)
|
|
||||||
}
|
|
||||||
|
|
||||||
const onParameterChanged = index => e => {
|
|
||||||
const value = e.target ? e.target.value : e
|
|
||||||
const newParams = [...parameters]
|
|
||||||
newParams[index].value = value
|
|
||||||
handlerChanged(handlerType, newParams)
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="type-selector-container {newHandler && 'new-handler'}">
|
|
||||||
<div class="handler-controls">
|
|
||||||
<div class="handler-option">
|
|
||||||
<span>Action</span>
|
|
||||||
<Select value={handlerType} on:change={handlerTypeChanged}>
|
|
||||||
<option />
|
|
||||||
{#each eventOptions as option}
|
|
||||||
<option value={option.name}>{option.name}</option>
|
|
||||||
{/each}
|
|
||||||
</Select>
|
|
||||||
</div>
|
|
||||||
{#if parameters}
|
|
||||||
<br />
|
|
||||||
{#each parameters as parameter, idx}
|
|
||||||
<StateBindingCascader on:change={onParameterChanged(idx)} {parameter} />
|
|
||||||
{/each}
|
|
||||||
{/if}
|
|
||||||
{#if parameters.length > 0}
|
|
||||||
<div class="button-container">
|
|
||||||
{#if newHandler}
|
|
||||||
<Button primary thin on:click={onCreate}>Add Action</Button>
|
|
||||||
{:else}
|
|
||||||
<Button outline thin on:click={onRemoved}>Remove Action</Button>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.type-selector-container {
|
|
||||||
display: grid;
|
|
||||||
grid-gap: 20px;
|
|
||||||
width: 100%;
|
|
||||||
background: rgba(223, 223, 223, 0.5);
|
|
||||||
border: 1px solid #dfdfdf;
|
|
||||||
margin-bottom: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.handler-option {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.new-handler {
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.handler-controls {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
grid-gap: 20px;
|
|
||||||
padding: 22px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-container {
|
|
||||||
display: grid;
|
|
||||||
justify-items: end;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
font-size: 18px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
</style>
|
|
Loading…
Reference in New Issue