- {propertyName}
- {JSON.stringify(property)}
- isRequired: {JSON.stringify(isRequired)}
- initialValue: {JSON.stringify(initialValue)}
-
+ const propertyType = property.type;
+ const defaultValue = property.default;
+ const propertyDescription = property.description;
+ const [propertyValue, setPropertyValue] = useState(
+ initialValue ?? defaultValue
);
-});
+
+ let propertyControl;
+
+ useEffect(() => {
+ if (propertyName != null && propertyName.trim() !== "") {
+ setValue((oldValue: any) => {
+ return {
+ ...(oldValue ?? {}),
+ [propertyName]: propertyValue,
+ };
+ });
+ } else {
+ setValue(propertyValue);
+ }
+ }, [propertyName, propertyValue, setValue]);
+
+ // Used in the case the property is an array
+ // TODO: Should initialize with values from settings if available
+ const [itemControls, setItemControls] = useState