0.1.1 • Published 5 years ago

react-library-dfg v0.1.1

Weekly downloads
15
License
-
Repository
-
Last release
5 years ago

###-For importing import DFGFieldClass from 'react-library-dfg';

###For using the class You have to put certain values.

key = {name_of_your_json.controlType === "radio") ? name_of_your_json.label: name_of_your_json.modelFieldKey}

obj = {name_of_your_json}

value = {name_of_your_json.controlType === "radio"} ? this.statename_of_your_json.radioButtonGroup :this.statename_of_your_json.modelFieldKey}

onChange = {(name_of_your_json.controlType === "date")? this.handleDateChange.bind(this, name_of_your_json.modelFieldKey): this.handleText}

onClick = {this.handleApi.bind(this, field)}

onButton = {this.handleButton.bind(this, field)}

state = {this.state}

propis={this.props}

An Example

<DFGFieldClass key={(field.controlType == "radio") ? field.label: field.modelFieldKey} obj={field} value = {(field.controlType === "radio") ? this.statefield.radioButtonGroup:this.statefield.modelFieldKey} onChange={(field.controlType ==="date")? this.handleDateChange.bind(this, field.modelFieldKey):this.handleText} onClick = {this.handleApi.bind(this, field)} onButton = {this.handleButton.bind(this,field)} state={this.state} propis={this.props} />

###Remember your json must be like this: "test":[ { "columnSize": 1, "fields": { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "text", "label": "Name", "modelFieldKey": "appName", "defaultValue": "Enter a name for your application" } }, { "columnSize": 1, "fields": { "disabled": false, "required": true, "hidden": false, "expanded": false, "controlType": "textarea", "label": "Description", "modelFieldKey": "description", "defaultValue": "Describe your application" } }, { "columnSize": 1, "fields": { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "text", "label": "Icon", "modelFieldKey": "Icon", "defaultValue": "Browse" } }, { "columnSize": 1, "fields": { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "seperator", "label": "separator", "modelFieldKey": "separator" } }, { "columnSize": 1, "fields": [ { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "select", "label": "App Type*", "modelFieldKey": "apptype", "defaultOptionList": { "itemName": "Desktop", "id": "101", "sequenceId": "1" }, { "itemName": "Web app", "id": "102", "sequenceId": "2" }, { "itemName": "Symphony app", "id": "103", "sequenceId": "3" } } ] }, { "columnSize": 1, "fields": { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "label", "label": "Audience", "modelFieldKey": "newField" }, { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "radio", "label": "Internal", "modelFieldKey": "audience", "radioButtonValue": "internal", "radioButtonGroup": "audience" }, { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "radio", "label": "External", "modelFieldKey": "audience", "radioButtonValue": "external", "radioButtonGroup": "audience" }, { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "radio", "label": "Both", "modelFieldKey": "audience", "radioButtonValue": "both", "radioButtonGroup": "audience" } }, { "columnSize": 1, "fields": { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "label", "label": "Channels", "modelFieldKey": "newField" } }, { "columnSize": 1, "fields": { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "checkbox", "label": "JPM Desktop", "modelFieldKey": "JPMDesktop" }, { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "checkbox", "label": "JPM Web", "modelFieldKey": "newField", "defaultValue": "JPMWeb" }, { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "checkbox", "label": "Symphony", "modelFieldKey": "Symphony" }, { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "checkbox", "label": "Mobile", "modelFieldKey": "Mobile" } }, { "columnSize": 1, "fields": { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "seperator", "label": "New Field", "modelFieldKey": "newField" } }, { "columnSize": 1, "fields": { "disabled": false, "required": false, "hidden": false, "expanded": false, "controlType": "button", "label": "Continue", "modelFieldKey": "newField", "actionConfig": { "actionType": "", "actionName": "", "actionApiUrl": "", "httpMethod": "", "actionParameterKey": "", "actionApiName": "", "actionRedirect": "", "actionRedirectParameterKey": "", "actionResultBindModelKey": "", "actionDescription": "" } } } ]