From 68d0a4c3360f3354f36ac233aa51ea864b9bf0a5 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 18 Nov 2022 15:52:30 +0000 Subject: [PATCH] Allow custom labels for dynamic filter --- packages/client/manifest.json | 7 ++++--- .../src/components/app/dynamic-filter/DynamicFilter.svelte | 5 +++-- .../src/components/app/dynamic-filter/FilterModal.svelte | 5 ++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 45bb38439a..66bed98e3c 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -3940,10 +3940,11 @@ "required": true }, { - "type": "multifield", - "label": "Allowed filter fields", + "type": "columns", + "label": "Allowed filter columns", "key": "allowedFields", - "placeholder": "All fields" + "dependsOn": "dataProvider", + "nested": true }, { "type": "select", diff --git a/packages/client/src/components/app/dynamic-filter/DynamicFilter.svelte b/packages/client/src/components/app/dynamic-filter/DynamicFilter.svelte index 141ce2e955..7ee704cd84 100644 --- a/packages/client/src/components/app/dynamic-filter/DynamicFilter.svelte +++ b/packages/client/src/components/app/dynamic-filter/DynamicFilter.svelte @@ -61,8 +61,9 @@ clonedSchema = schema } else { allowedFields?.forEach(field => { - if (schema[field]) { - clonedSchema[field] = schema[field] + if (schema[field.name]) { + clonedSchema[field.name] = schema[field.name] + clonedSchema[field.name].displayName = field.displayName } }) } diff --git a/packages/client/src/components/app/dynamic-filter/FilterModal.svelte b/packages/client/src/components/app/dynamic-filter/FilterModal.svelte index b8815279dd..8d89d3a6ff 100644 --- a/packages/client/src/components/app/dynamic-filter/FilterModal.svelte +++ b/packages/client/src/components/app/dynamic-filter/FilterModal.svelte @@ -25,7 +25,10 @@ !BannedTypes.includes(field.type) || (field.type === "formula" && field.formulaType === "static") ) - .map(field => field.name) + .map(field => ({ + label: field.displayName || field.name, + value: field.name, + })) const addFilter = () => { filters = [