commit
3f73e109ca
|
@ -12,6 +12,5 @@
|
|||
</script>
|
||||
|
||||
<div class="bb-margin-m">
|
||||
<Label small forAttr={'datepicker-label'}>{label}</Label>
|
||||
<DatePicker placeholder={label} on:change={onChange} {value} />
|
||||
</div>
|
||||
|
|
|
@ -71,7 +71,16 @@
|
|||
}
|
||||
|
||||
function addFilter() {
|
||||
view.filters = [...view.filters, {}]
|
||||
view.filters.push({})
|
||||
view.filters = view.filters
|
||||
}
|
||||
|
||||
function isMultipleChoice(field) {
|
||||
return (
|
||||
viewModel.schema[field].constraints &&
|
||||
viewModel.schema[field].constraints.inclusion &&
|
||||
viewModel.schema[field].constraints.inclusion.length
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -108,10 +117,18 @@
|
|||
<option value={condition.key}>{condition.name}</option>
|
||||
{/each}
|
||||
</Select>
|
||||
{#if filter.key && isMultipleChoice(filter.key)}
|
||||
<Select secondary thin bind:value={filter.value}>
|
||||
{#each viewModel.schema[filter.key].constraints.inclusion as option}
|
||||
<option value={option}>{option}</option>
|
||||
{/each}
|
||||
</Select>
|
||||
{:else}
|
||||
<Input
|
||||
thin
|
||||
placeholder={filter.key || fields[0]}
|
||||
bind:value={filter.value} />
|
||||
{/if}
|
||||
<i class="ri-close-circle-fill" on:click={() => removeFilter(idx)} />
|
||||
{/each}
|
||||
</div>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -41,7 +41,6 @@
|
|||
([field, message]) => `${field} ${message}`
|
||||
)
|
||||
|
||||
|
||||
async function fetchModel() {
|
||||
const FETCH_MODEL_URL = `/api/models/${model}`
|
||||
const response = await _bb.api.get(FETCH_MODEL_URL)
|
||||
|
|
Loading…
Reference in New Issue