mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 00:08:25 +00:00
* fix: handle calendar boundaries in date comparisons * feat: add a single-date filter to the dashboard API * feat: send the viewer timezone with dashboard data requests * refactor: share dashboard filter controls and target settings * feat: configure dashboard filter conditions on date fields * feat: add the Date filter to the dashboard widget picker Implement the single-date mode of #6886. * fix: restore dragging dashboard filters by their titles * feat: persist the dashboard date filter display format * feat: choose how dashboard filter dates are displayed * test: align numeric filter checks with shared dashboard controls * style: format the dashboard date filter component test * fix: accept fixed UTC offsets in dashboard date filters * fix: expose dashboard filter dates as ISO strings in formulas * fix: seed dashboard conditions with compatible operators * feat: expose date ranges in dashboard formulas and viewer selections * feat: configure inclusive date range conditions for dashboard targets * feat: persist and dispatch inclusive dashboard date ranges * docs: describe date range selections in the dashboard dispatch API * feat: select and configure dashboard date ranges * fix: let viewers clear each dashboard date range endpoint * fix: preserve unfinished dashboard date range bounds on refresh * fix: refresh public dashboards after a date filter mode change * test: group dashboard date filter mode transitions * fix: warn about incompatible date range formula operands * fix: convert dashboard date defaults from the saved widget * fix: keep dashboard filter controls aligned when a condition has a warning * fix: clear incompatible dashboard conditions when switching date modes * fix: show cleared date conditions without warnings or redundant saves * fix: ignore empty dashboard date conditions after switching modes * fix: ignore dashboard date conditions without a single date and simplify mode switch clearing --------- Co-authored-by: peter_baserow <peter@baserow.io>
29 lines
827 B
JavaScript
29 lines
827 B
JavaScript
/**
|
|
* Find the primary field in a list of fields.
|
|
* If no primary field is found, return the first field.
|
|
* @param fields
|
|
* @returns {*}
|
|
*/
|
|
export function getPrimaryOrFirstField(fields) {
|
|
const primaryField = fields.find((field) => field.primary)
|
|
return primaryField || fields[0]
|
|
}
|
|
|
|
/** The registry order determines the default operator for a new condition. */
|
|
export function getFirstCompatibleFilterType(field, filterTypes) {
|
|
return Object.values(filterTypes).find((type) =>
|
|
type.fieldIsCompatible(field)
|
|
)
|
|
}
|
|
|
|
export function hasCompatibleFilterTypes(field, filterTypes) {
|
|
return getFirstCompatibleFilterType(field, filterTypes) !== undefined
|
|
}
|
|
|
|
/**
|
|
* Unique key used in combination with the `SelectRowModal`.
|
|
*/
|
|
export function getPersistentFieldOptionsKey(fieldId) {
|
|
return `link-row-${fieldId}`
|
|
}
|