The QueryBuilder is a versatile utility component designed for constructing database queries. it supports multiple operation modes, including a visual UI builder and direct SQL entry. It is designed to be highly compact and embeddable within sidebar settings or small UI subsections.
valstorm-components-15/components/AppBuilder/components/Utility/QueryBuilder
LIKE '%val%', IN (a, b)).ListViewSettings).| Prop | Type | Default | Description |
|---|---|---|---|
props | object | - | Standard App Builder props including appId, node, and handleClick. |
value | object | - | (Optional) The current state object. Including this makes the component controlled. |
onChange | function | - | (Optional) Callback fired when the query configuration changes. |
showRunButton | boolean | true | Whether to display the "Run Query" button. |
defaultCollapsed | boolean | false | Whether the component should start in a collapsed state. |
value)The component manages a complex JSON object that represents both the UI state and the compiled output:
{ "query_mode": "UI Builder", "sql_query": "SELECT * FROM users WHERE status = 'active' LIMIT 25 OFFSET 0", "ui_configuration": { "select": ["*"], "from": "users", "where": { "logical_operator": "AND", "rules": [ { "field": "status", "operator": "=", "value": "active" } ] }, "limit": 25, "offset": 0 } }
import { QueryBuilder } from "./QueryBuilder.component"; const MySettings = ({ filter, onUpdate }) => { return ( <QueryBuilder value={{ query_mode: filter.query_mode, sql_query: filter.query, ui_configuration: filter.ui_configuration }} onChange={(newValue) => { onUpdate({ query_mode: newValue.query_mode, query: newValue.sql_query, ui_configuration: newValue.ui_configuration }); }} defaultCollapsed={true} showRunButton={false} /> ); }
When added to an App Builder page, the component uses the node.props.data for its state and behaves as an interactive widget.
VisualQueryBuilderHandles the rendering of the "UI Builder" mode.
The header includes an expand/collapse toggle and an Editor Mode selector. The mode selector allows users to "Eject" from the UI builder into Custom SQL.
Note: Switching from UI Builder to Custom SQL will populate the textarea with the compiled SQL. However, manually editing the SQL and then switching back to the UI Builder may result in a loss of manual SQL changes as the UI Builder state takes precedence when re-active.
The ListViewSettings component provides a comprehensive management interface for list_filter records. It allows users to configure how data is queried, displayed, and interacted with across various view modes (Table, List, Kanban).
valstorm-components-15/components/AppBuilder/components/Utility/ListViewSettings
list_filter record.QueryBuilder for visual or SQL-based data sourcing.update_list_filter events to the system, allowing other components on the page to reflect configuration changes immediately without saving.| Prop | Type | Default | Description |
|---|---|---|---|
props | object | - | Standard App Builder props including appId, node, handleClick, and componentId. |
The component uses a local filter state initialized from the selectedFilter provided by the useFilterState hook. It also listens to the eventSystem for edit_list_filter and switch_list_filter events to stay in sync with the user's focus.
The component leverages the QueryBuilder in controlled mode:
<QueryBuilder value={{ query_mode: filter.query_mode, sql_query: filter.query, ui_configuration: filter.ui_configuration }} onChange={(newValue) => { // Updates filter state and dispatches update_list_filter event }} defaultCollapsed={true} showRunButton={false} />
| Event Type | Payload | Description |
|---|---|---|
update_list_filter | filter record | Fired on any change to provide live previews. |
open_clone_record_modal | { record, schema } | Fired when clicking the Clone button. |
Typically rendered in a sidebar or configuration panel within the App Builder or a Management interface to allow users to customize their data views.