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