diff --git a/packages/builder/src/components/design/settings/componentSettings.js b/packages/builder/src/components/design/settings/componentSettings.js index 314391e77c..8b151564a1 100644 --- a/packages/builder/src/components/design/settings/componentSettings.js +++ b/packages/builder/src/components/design/settings/componentSettings.js @@ -23,6 +23,7 @@ import BasicColumnEditor from "./controls/ColumnEditor/BasicColumnEditor.svelte" import GridColumnEditor from "./controls/ColumnEditor/GridColumnEditor.svelte" import BarButtonList from "./controls/BarButtonList.svelte" import FieldConfiguration from "./controls/FieldConfiguration/FieldConfiguration.svelte" +import RelationshipFilterEditor from "./controls/RelationshipFilterEditor.svelte" const componentMap = { text: DrawerBindableInput, @@ -44,6 +45,7 @@ const componentMap = { schema: SchemaSelect, section: SectionSelect, filter: FilterEditor, + "filter/relationship": RelationshipFilterEditor, url: URLSelect, fieldConfiguration: FieldConfiguration, columns: ColumnEditor, diff --git a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterEditor.svelte b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterEditor.svelte index 88c3842f54..828d189850 100644 --- a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterEditor.svelte +++ b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterEditor.svelte @@ -13,13 +13,14 @@ export let value = [] export let componentInstance export let bindings = [] + export let schema = null let drawer $: tempValue = value $: datasource = getDatasourceForProvider($currentAsset, componentInstance) - $: schema = getSchemaForDatasource($currentAsset, datasource)?.schema - $: schemaFields = Object.values(schema || {}) + $: dsSchema = getSchemaForDatasource($currentAsset, datasource)?.schema + $: schemaFields = Object.values(schema || dsSchema || {}) $: text = getText(value?.filter(filter => filter.field)) async function saveFilter() { diff --git a/packages/builder/src/components/design/settings/controls/RelationshipFilterEditor.svelte b/packages/builder/src/components/design/settings/controls/RelationshipFilterEditor.svelte new file mode 100644 index 0000000000..0010a22d15 --- /dev/null +++ b/packages/builder/src/components/design/settings/controls/RelationshipFilterEditor.svelte @@ -0,0 +1,35 @@ + + + diff --git a/packages/builder/src/components/design/settings/controls/ValidationEditor/ValidationEditor.svelte b/packages/builder/src/components/design/settings/controls/ValidationEditor/ValidationEditor.svelte index 6c62c9f5af..6db24e8d69 100644 --- a/packages/builder/src/components/design/settings/controls/ValidationEditor/ValidationEditor.svelte +++ b/packages/builder/src/components/design/settings/controls/ValidationEditor/ValidationEditor.svelte @@ -8,16 +8,29 @@ export let componentDefinition export let type + const dispatch = createEventDispatcher() let drawer - const dispatch = createEventDispatcher() + $: text = getText(value) + const save = () => { dispatch("change", value) drawer.hide() } + + const getText = rules => { + if (!rules?.length) { + return "No rules set" + } else { + return `${rules.length} rule${rules.length === 1 ? "" : "s"} set` + } + } -Configure validation +
+ {text} +
+ Configure validation rules for this field. @@ -31,3 +44,9 @@ {componentDefinition} /> + + diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 285f045d08..1e4c443f06 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -3485,6 +3485,16 @@ } ] }, + { + "type": "validation/link", + "label": "Validation", + "key": "validation" + }, + { + "type": "filter/relationship", + "label": "Filtering", + "key": "filter" + }, { "type": "boolean", "label": "Autocomplete", @@ -3496,11 +3506,6 @@ "label": "Disabled", "key": "disabled", "defaultValue": false - }, - { - "type": "validation/link", - "label": "Validation", - "key": "validation" } ] }, diff --git a/packages/client/src/components/app/forms/RelationshipField.svelte b/packages/client/src/components/app/forms/RelationshipField.svelte index 735b44b9ae..0c8b076a67 100644 --- a/packages/client/src/components/app/forms/RelationshipField.svelte +++ b/packages/client/src/components/app/forms/RelationshipField.svelte @@ -1,5 +1,6 @@