in source/idea/idea-cluster-manager/webapp/src/components/form-builder/form-builder.tsx [70:202]
constructor(props: IdeaFormBuilderFieldProps) {
super(props);
this.form = React.createRef();
this.preview = React.createRef();
this.state = {
debugMode: false,
edit: false,
param: this.props.param,
choices: this.props.param.choices ? this.props.param.choices : [],
showPreview: true,
buildParams: [
{
name: "field_type",
title: "Field Type",
description: "Form Field Type",
data_type: "str",
param_type: "select",
default: this.getFieldType(),
choices: [
{
title: "Text",
value: "text",
},
{
title: "Number",
value: "number",
},
{
title: "Select",
value: "select",
},
{
title: "Text Area",
value: "textarea",
},
{
title: "Toggle",
value: "toggle",
},
{
title: "Password",
value: "password",
},
{
title: "Heading 1",
value: "heading1",
},
{
title: "Heading 2",
value: "heading2",
},
{
title: "Heading 3",
value: "heading3",
},
{
title: "Heading 4",
value: "heading4",
},
{
title: "Heading 5",
value: "heading5",
},
],
},
{
name: "name",
title: "Name",
description: "Name of the form field",
data_type: "str",
param_type: "text",
default: this.props.param.name,
},
{
name: "title",
title: "Title",
description: "Title of the form field",
data_type: "str",
param_type: "text",
default: this.props.param.title,
},
{
name: "description",
title: "Description",
description: "Description for the form field",
data_type: "str",
param_type: "text",
default: this.props.param.description,
when: {
param: "field_type",
not_in: ["heading1", "heading2", "heading3", "heading4", "heading5"],
},
},
{
name: "help_text",
title: "Help Text",
description: "Help text for the form field.",
data_type: "str",
param_type: "text",
default: this.props.param.help_text,
when: {
param: "field_type",
not_in: ["heading1", "heading2", "heading3", "heading4", "heading5"],
},
},
{
name: "readonly",
title: "Is Readonly?",
description: "User will not be able to edit this value.",
data_type: "bool",
param_type: "confirm",
default: this.props.param.readonly,
when: {
param: "field_type",
not_in: ["heading1", "heading2", "heading3", "heading4", "heading5"],
},
},
{
name: "required",
title: "Is Required?",
description: "User must enter this value.",
data_type: "bool",
param_type: "confirm",
default: this.props.param.validate?.required,
when: {
param: "field_type",
not_in: ["heading1", "heading2", "heading3", "heading4", "heading5"],
},
},
],
};
}