Allow data provider filtering using dates and date ranges, and allow filtering using a value or binding for any type
This commit is contained in:
parent
023f5c5813
commit
4db2ee1843
|
@ -43,8 +43,6 @@
|
||||||
const onChange = e => {
|
const onChange = e => {
|
||||||
selectOption(e.target.value)
|
selectOption(e.target.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
$: console.log(disabled)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -5,6 +5,7 @@ export const gradient = (node, config = {}) => {
|
||||||
lightness: 0.7,
|
lightness: 0.7,
|
||||||
softness: 0.9,
|
softness: 0.9,
|
||||||
seed: null,
|
seed: null,
|
||||||
|
version: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Applies a gradient background
|
// Applies a gradient background
|
||||||
|
@ -15,6 +16,7 @@ export const gradient = (node, config = {}) => {
|
||||||
}
|
}
|
||||||
const { saturation, lightness, softness, points } = config
|
const { saturation, lightness, softness, points } = config
|
||||||
const seed = config.seed || Math.random().toString(32).substring(2)
|
const seed = config.seed || Math.random().toString(32).substring(2)
|
||||||
|
const version = config.version ?? 0
|
||||||
|
|
||||||
// Hash function which returns a fixed hash between specified limits
|
// Hash function which returns a fixed hash between specified limits
|
||||||
// for a given seed and a given version
|
// for a given seed and a given version
|
||||||
|
@ -69,10 +71,10 @@ export const gradient = (node, config = {}) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
let css = `opacity:0.9;background:${randomHSL(seed, 0, 0.7)};`
|
let css = `opacity:0.9;background:${randomHSL(seed, version, 0.7)};`
|
||||||
css += "background-image:"
|
css += "background-image:"
|
||||||
for (let i = 0; i < points - 1; i++) {
|
for (let i = 0; i < points - 1; i++) {
|
||||||
css += `${randomGradientPoint(seed, i)},`
|
css += `${randomGradientPoint(seed, version + i)},`
|
||||||
}
|
}
|
||||||
css += `${randomGradientPoint(seed, points)};`
|
css += `${randomGradientPoint(seed, points)};`
|
||||||
node.style = css
|
node.style = css
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
Button,
|
Button,
|
||||||
Select,
|
Select,
|
||||||
Combobox,
|
Combobox,
|
||||||
|
Input,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { store, currentAsset } from "builderStore"
|
import { store, currentAsset } from "builderStore"
|
||||||
import { getBindableProperties } from "builderStore/dataBinding"
|
import { getBindableProperties } from "builderStore/dataBinding"
|
||||||
|
@ -68,6 +69,7 @@
|
||||||
field: null,
|
field: null,
|
||||||
operator: OperatorOptions.Equals.value,
|
operator: OperatorOptions.Equals.value,
|
||||||
value: null,
|
value: null,
|
||||||
|
valueType: "Value",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -168,7 +170,13 @@
|
||||||
on:change={e => onOperatorChange(expression, e.detail)}
|
on:change={e => onOperatorChange(expression, e.detail)}
|
||||||
placeholder={null}
|
placeholder={null}
|
||||||
/>
|
/>
|
||||||
{#if ["string", "longform", "number"].includes(expression.type)}
|
<Select
|
||||||
|
disabled={expression.noValue || !expression.field}
|
||||||
|
options={["Value", "Binding"]}
|
||||||
|
bind:value={expression.valueType}
|
||||||
|
placeholder={null}
|
||||||
|
/>
|
||||||
|
{#if expression.valueType === "Binding"}
|
||||||
<DrawerBindableInput
|
<DrawerBindableInput
|
||||||
disabled={expression.noValue}
|
disabled={expression.noValue}
|
||||||
title={`Value for "${expression.field}"`}
|
title={`Value for "${expression.field}"`}
|
||||||
|
@ -177,6 +185,8 @@
|
||||||
bindings={bindableProperties}
|
bindings={bindableProperties}
|
||||||
on:change={event => (expression.value = event.detail)}
|
on:change={event => (expression.value = event.detail)}
|
||||||
/>
|
/>
|
||||||
|
{:else if ["string", "longform", "number"].includes(expression.type)}
|
||||||
|
<Input disabled={expression.noValue} bind:value={expression.value} />
|
||||||
{:else if expression.type === "options"}
|
{:else if expression.type === "options"}
|
||||||
<Combobox
|
<Combobox
|
||||||
disabled={expression.noValue}
|
disabled={expression.noValue}
|
||||||
|
@ -222,6 +232,6 @@
|
||||||
column-gap: var(--spacing-l);
|
column-gap: var(--spacing-l);
|
||||||
row-gap: var(--spacing-s);
|
row-gap: var(--spacing-s);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
grid-template-columns: 1fr 120px 1fr auto;
|
grid-template-columns: 1fr 120px 120px 1fr auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -39,7 +39,6 @@ function buildSearchUrl({
|
||||||
if (bookmark) {
|
if (bookmark) {
|
||||||
url += `&bookmark=${bookmark}`
|
url += `&bookmark=${bookmark}`
|
||||||
}
|
}
|
||||||
console.log(url)
|
|
||||||
return checkSlashesInUrl(url)
|
return checkSlashesInUrl(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,13 +141,12 @@ class QueryBuilder {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
if (isNaN(value.low) || value.low == null || value.low === "") {
|
if (value.low == null || value.low === "") {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
if (isNaN(value.high) || value.high == null || value.high === "") {
|
if (value.high == null || value.high === "") {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
console.log(value)
|
|
||||||
return `${key}:[${value.low} TO ${value.high}]`
|
return `${key}:[${value.low} TO ${value.high}]`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,20 +83,21 @@
|
||||||
notEmpty: {},
|
notEmpty: {},
|
||||||
}
|
}
|
||||||
if (Array.isArray(filter)) {
|
if (Array.isArray(filter)) {
|
||||||
filter.forEach(expression => {
|
filter.forEach(({ operator, field, type, value }) => {
|
||||||
if (expression.operator.startsWith("range")) {
|
if (operator.startsWith("range")) {
|
||||||
let range = {
|
if (!query.range[field]) {
|
||||||
low: Number.MIN_SAFE_INTEGER,
|
query.range[field] = {
|
||||||
high: Number.MAX_SAFE_INTEGER,
|
low: type === "number" ? Number.MIN_SAFE_INTEGER : "0000",
|
||||||
|
high: type === "number" ? Number.MAX_SAFE_INTEGER : "9999",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (expression.operator === "rangeLow") {
|
if (operator === "rangeLow") {
|
||||||
range.low = expression.value
|
query.range[field].low = value
|
||||||
} else if (expression.operator === "rangeHigh") {
|
} else if (operator === "rangeHigh") {
|
||||||
range.high = expression.value
|
query.range[field].high = value
|
||||||
}
|
}
|
||||||
query.range[expression.field] = range
|
} else if (query[operator]) {
|
||||||
} else if (query[expression.operator]) {
|
query[operator][field] = value
|
||||||
query[expression.operator][expression.field] = expression.value
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue