diff --git a/packages/builder/src/builderStore/storeUtils.js b/packages/builder/src/builderStore/storeUtils.js
index 00f5a209a3..6d0f0beab0 100644
--- a/packages/builder/src/builderStore/storeUtils.js
+++ b/packages/builder/src/builderStore/storeUtils.js
@@ -59,8 +59,8 @@ export const findComponentPath = (rootComponent, id, path = []) => {
}
/**
- * Recurses through the component tree and finds all components of a certain
- * type.
+ * Recurses through the component tree and finds all components which match
+ * a certain selector
*/
export const findAllMatchingComponents = (rootComponent, selector) => {
if (!rootComponent || !selector) {
@@ -81,6 +81,26 @@ export const findAllMatchingComponents = (rootComponent, selector) => {
return components.reverse()
}
+/**
+ * Finds the closes parent component which matches certain criteria
+ */
+export const findClosestMatchingComponent = (
+ rootComponent,
+ componentId,
+ selector
+) => {
+ if (!selector) {
+ return null
+ }
+ const componentPath = findComponentPath(rootComponent, componentId).reverse()
+ for (let component of componentPath) {
+ if (selector(component)) {
+ return component
+ }
+ }
+ return null
+}
+
/**
* Recurses through a component tree evaluating a matching function against
* components until a match is found
diff --git a/packages/builder/src/components/design/AppPreview/componentStructure.json b/packages/builder/src/components/design/AppPreview/componentStructure.json
index e0881821c7..9193a566b5 100644
--- a/packages/builder/src/components/design/AppPreview/componentStructure.json
+++ b/packages/builder/src/components/design/AppPreview/componentStructure.json
@@ -8,7 +8,9 @@
"icon": "ri-file-edit-line",
"children": [
"form",
- "input",
+ "stringfield",
+ "numberfield",
+ "optionsfield",
"richtext",
"datepicker"
]
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FormFieldSelect.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FormFieldSelect.svelte
new file mode 100644
index 0000000000..ca40946bcb
--- /dev/null
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FormFieldSelect.svelte
@@ -0,0 +1,33 @@
+
+
+