pixiebrix-extension
pixiebrix-extension copied to clipboard
Var and Database fields handling by form preview
Context: form builder.
When we assign a @var value to a dropdown it is stored in the enum field as a string.
-
There're 2 places where
enumstring value is handled in the similar ways: FormPreviewSchemaField and SelectWidgetPreview. If the logic of FormPreviewSchemaField is sufficient, clean up the SelectWidgetPreview. If possible, move this logic to FormPreview component. -
Update SelectWidgetPreview to support
readonlyproperty of the schema (disable the field). -
In case of
databasefield, change the code in FormPreview to:
property.type = "string";
property.enum = ["Select..."];
property.default = "Select...";
property.readOnly = true;
Related discussion https://github.com/pixiebrix/pixiebrix-extension/pull/4406#discussion_r989315313