diff --git a/packages/builder/src/components/design/AppPreview/componentStructure.json b/packages/builder/src/components/design/AppPreview/componentStructure.json index 357ea5a7be..b237347c44 100644 --- a/packages/builder/src/components/design/AppPreview/componentStructure.json +++ b/packages/builder/src/components/design/AppPreview/componentStructure.json @@ -67,6 +67,7 @@ "icon", "embed" ] - } + }, + "dynamicfilter" ] diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 050ac4a63a..ba7f95e42e 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -2623,6 +2623,17 @@ } ] }, + "dynamicfilter": { + "name": "Dynamic Filter", + "icon": "FilterEdit", + "settings": [ + { + "type": "dataProvider", + "label": "Provider", + "key": "dataProvider" + } + ] + }, "tableblock": { "block": true, "name": "Table block", diff --git a/packages/client/src/components/app/dynamic-filter/DynamicFilter.svelte b/packages/client/src/components/app/dynamic-filter/DynamicFilter.svelte new file mode 100644 index 0000000000..6cd0d2be5b --- /dev/null +++ b/packages/client/src/components/app/dynamic-filter/DynamicFilter.svelte @@ -0,0 +1,37 @@ + + +
+ + + + + + +
diff --git a/packages/client/src/components/app/dynamic-filter/FilterModal.svelte b/packages/client/src/components/app/dynamic-filter/FilterModal.svelte new file mode 100644 index 0000000000..99b9a1a6f6 --- /dev/null +++ b/packages/client/src/components/app/dynamic-filter/FilterModal.svelte @@ -0,0 +1,176 @@ + + + +
+ + + {#if !filters?.length} + Add your first filter expression. + {:else} + Results are filtered to only those which match all of the following + constraints. + {/if} + + {#if filters?.length} +
+ {#each filters as filter, idx} + onOperatorChange(filter, e.detail)} + placeholder={null} + /> + {#if ["string", "longform", "number"].includes(filter.type)} + + {:else if ["options", "array"].includes(filter.type)} + + {:else if filter.type === "boolean"} + + {:else if filter.type === "datetime"} + + {:else} + + {/if} + duplicateFilter(filter.id)} + /> + removeFilter(filter.id)} + /> + {/each} +
+ {/if} +
+ +
+
+
+
+ + diff --git a/packages/client/src/components/app/dynamic-filter/index.js b/packages/client/src/components/app/dynamic-filter/index.js new file mode 100644 index 0000000000..5ac7d31730 --- /dev/null +++ b/packages/client/src/components/app/dynamic-filter/index.js @@ -0,0 +1 @@ +export { default as dynamicfilter } from "./DynamicFilter.svelte" diff --git a/packages/client/src/components/app/index.js b/packages/client/src/components/app/index.js index 92725f0738..f5d085e97b 100644 --- a/packages/client/src/components/app/index.js +++ b/packages/client/src/components/app/index.js @@ -33,6 +33,7 @@ export * from "./charts" export * from "./forms" export * from "./table" export * from "./blocks" +export * from "./dynamic-filter" // Deprecated component left for compatibility in old apps export { default as navigation } from "./deprecated/Navigation.svelte"