react-survey-builder 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,7 +37,7 @@ ReactDOM.render(
37
37
  var items = [{
38
38
  key: 'Header',
39
39
  name: 'Header Text',
40
- icon: 'fa fa-header',
40
+ icon: FaHeader,
41
41
  static: true,
42
42
  content: 'Placeholder Text...'
43
43
  },
@@ -45,7 +45,7 @@ var items = [{
45
45
  key: 'Paragraph',
46
46
  name: 'Paragraph',
47
47
  static: true,
48
- icon: 'fa fa-paragraph',
48
+ icon: FaParagraph,
49
49
  content: 'Placeholder Text...'
50
50
  }];
51
51
 
@@ -69,7 +69,7 @@ ReactDOM.render(
69
69
  formAction="/path/to/form/submit"
70
70
  formMethod="POST"
71
71
  task_id={12} // Used to submit a hidden variable with the id to the form from the database.
72
- answerData={JSON_ANSWERS} // Answer data, only used if loading a pre-existing form with values.
72
+ answers={JSON_ANSWERS} // Answer data, only used if loading a pre-existing form with values.
73
73
  authenticity_token={AUTH_TOKEN} // If using Rails and need an auth token to submit form.
74
74
  items={JSON_QUESTION_DATA} // Question data
75
75
  />,
@@ -91,7 +91,7 @@ items | array | Required | Question data retrieved from the database
91
91
  backAction | string | Optional | URL path to go back if needed.
92
92
  backName | string | Optional | Button text for back action. Defaults to "Cancel".
93
93
  task_id | integer | Optional | User to submit a hidden variable with id to the form on the backend database.
94
- answerData | array | Optional | Answer data, only used if loading a pre-existing form with values.
94
+ answers | array | Optional | Answer data, only used if loading a pre-existing form with values.
95
95
  authenticity_token | string | Optional | If using Rails and need an auth token to submit form.
96
96
  hideActions | boolean | Optional | If you would like to hide the submit / cancel buttons set to true.
97
97
  submitButton | ElementNode | Optional | If you would like to inject your own submit button.
@@ -103,7 +103,7 @@ displayShort | boolean | Optional | Display an optional "shorter page/form" whic
103
103
  readOnly | boolean | Optional | Shows a read only version which has fields disabled and removes "required" labels.
104
104
  print | boolean | Optional | Shows a print friendly version of the form that removes all the form fields.
105
105
  variables | object | Optional | Key/value object that can be used for Signature variable replacement.
106
- methods | object | Optional | React Hook Form methods object generated by the useForm hook.
106
+ methods | object | Optional (Required if using ReactSurveyFieldGenerator) | React Hook Form methods object generated by the useForm hook.
107
107
 
108
108
  ### Read only Signatures
109
109
 
@@ -118,7 +118,7 @@ The signature data should be in base 64 format.
118
118
  There is a `variables.js` file that contains a sample base 64 signature. This variable is passed into the demo builder and generator for testing. Use the variable key "JOHN" to test the variable replacement.
119
119
 
120
120
  # Vendor Dependencies
121
- In order to make the form builder look pretty, there are a few dependencies other than React. Style sheets from `Bootstrap` and `FontAwesome` must be added to index.html. See the example code in [index.html](https://github.com/Kiho/react-form-builder/blob/master/public/index.html#L5) for more details.
121
+ In order to make the form builder look pretty, there are a few dependencies other than React.
122
122
 
123
123
  - React Bootstrap
124
124
  - React-Icon
@@ -159,8 +159,8 @@ Then navigate to http://localhost:8080/ in your browser and you should be able t
159
159
  toolbarItems={toolbarItems}
160
160
  onSubmit={handleSubmit}
161
161
  actionName="Set this to change the default submit button text"
162
- submitButton={<button type="submit" className="btn btn-primary">Submit</button>}
163
- backButton={<a href="/" className="btn btn-default btn-cancel btn-big">Back</a>}
162
+ submitButton={<Button variant="primary" type="submit">Submit</Button>}
163
+ backButton={<Button variant="secondary" onClick={backAction}>Back</Button>}
164
164
  />
165
165
  ```
166
166
 
@@ -198,7 +198,7 @@ const items = [{
198
198
  type: 'custom',
199
199
  fieldName: 'test_component',
200
200
  name: 'Something You Want',
201
- icon: 'fa fa-cog',
201
+ icon: FaCog,
202
202
  static: true,
203
203
  props: { test: 'test_comp' },
204
204
  label: 'Label Test',
@@ -210,7 +210,7 @@ const items = [{
210
210
  forwardRef: true,
211
211
  fieldName: 'my_input_',
212
212
  name: 'My Input',
213
- icon: 'fa fa-cog',
213
+ icon: FaCog,
214
214
  props: { test: 'test_input' },
215
215
  label: 'Label Input',
216
216
  },
package/dist/186.index.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkReactSurveyBuilder=self.webpackChunkReactSurveyBuilder||[]).push([[186],{8186:(e,t,n)=>{n.r(t),n.d(t,{default:()=>D});var a=n(5671),l=n(3144),r=n(136),o=n(2963),i=n(1120),s=n(359),m=n.n(s),p=n(7462),c=n(3366);const d=s.useLayoutEffect;var h=function(e,t){"function"!=typeof e?e.current=t:e(t)};var u={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},f=function(e){Object.keys(u).forEach((function(t){e.style.setProperty(t,u[t],"important")}))},E=null,b=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize},v=function(){},y=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],g=!!document.documentElement.currentStyle;function w(e,t,n){var a,l,r=(a=n,l=s.useRef(a),d((function(){l.current=a})),l);s.useLayoutEffect((function(){var n=function(e){return r.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}}),[])}var Z=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],C=function(e,t){var n,a=e.cacheMeasurements,l=e.maxRows,r=e.minRows,o=e.onChange,i=void 0===o?v:o,m=e.onHeightChange,d=void 0===m?v:m,u=(0,c.Z)(e,Z),C=void 0!==u.value,k=s.useRef(null),x=function(e,t){var n=(0,s.useRef)();return(0,s.useCallback)((function(a){e.current=a,n.current&&h(n.current,null),n.current=t,t&&h(t,a)}),[t])}(k,t),N=s.useRef(0),P=s.useRef(),O=function(){var e=k.current,t=a&&P.current?P.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n,a=(n=t,y.reduce((function(e,t){return e[t]=n[t],e}),{})),l=a.boxSizing;return""===l?null:(g&&"border-box"===l&&(a.width=parseFloat(a.width)+parseFloat(a.borderRightWidth)+parseFloat(a.borderLeftWidth)+parseFloat(a.paddingRight)+parseFloat(a.paddingLeft)+"px"),{sizingStyle:a,paddingSize:parseFloat(a.paddingBottom)+parseFloat(a.paddingTop),borderSize:parseFloat(a.borderBottomWidth)+parseFloat(a.borderTopWidth)})}(e);if(t){P.current=t;var n=function(e,t,n,a){void 0===n&&(n=1),void 0===a&&(a=1/0),E||((E=document.createElement("textarea")).setAttribute("tabindex","-1"),E.setAttribute("aria-hidden","true"),f(E)),null===E.parentNode&&document.body.appendChild(E);var l=e.paddingSize,r=e.borderSize,o=e.sizingStyle,i=o.boxSizing;Object.keys(o).forEach((function(e){var t=e;E.style[t]=o[t]})),f(E),E.value=t;var s=b(E,e);E.value=t,s=b(E,e),E.value="x";var m=E.scrollHeight-l,p=m*n;"border-box"===i&&(p=p+l+r),s=Math.max(p,s);var c=m*a;return"border-box"===i&&(c=c+l+r),[s=Math.min(c,s),m]}(t,e.value||e.placeholder||"x",r,l),o=n[0],i=n[1];N.current!==o&&(N.current=o,e.style.setProperty("height",o+"px","important"),d(o,{rowHeight:i}))}};return s.useLayoutEffect(O),w(window,"resize",O),n=O,w(document.fonts,"loadingdone",n),s.createElement("textarea",(0,p.Z)({},u,{onChange:function(e){C||O(),i(e)},ref:x}))},k=s.forwardRef(C),x=n(7163),N=n(9265),P=n.n(N),O=n(5108),S=n(9333),L=n.n(S),F=n(7582),B=n(4806),V=n(680);function R(e){var t=function(){var e=s.useContext(B._y);return(0,V.lq)(e),e}(),n=t.formatMessage,a=t.textComponent,l=void 0===a?s.Fragment:a,r=e.id,o=e.description,i=e.defaultMessage,m=e.values,p=e.children,c=e.tagName,d=void 0===c?l:c,h=n({id:r,description:o,defaultMessage:i},m,{ignoreTag:e.ignoreTag});return"function"==typeof p?p(Array.isArray(h)?h:[h]):d?s.createElement(d,null,s.Children.toArray(h)):s.createElement(s.Fragment,null,h)}R.displayName="FormattedMessage";var H=s.memo(R,(function(e,t){var n=e.values,a=(0,F._T)(e,["values"]),l=t.values,r=(0,F._T)(t,["values"]);return(0,V.wU)(l,n)&&(0,V.wU)(a,r)}));H.displayName="MemoizedFormattedMessage";const T=H,G=(0,B.ZP)((function(e){return m().createElement(T,e)}),{withRef:!1});var z=n(5565),M=n(4051),A=n(1555),_=n(7833),W=n(5005);var I=function(e){(0,r.Z)(p,e);var t,n,s=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,i.Z)(t);if(n){var l=(0,i.Z)(this).constructor;e=Reflect.construct(a,arguments,l)}else e=a.apply(this,arguments);return(0,o.Z)(this,e)});function p(e){var t;return(0,a.Z)(this,p),(t=s.call(this,e)).state={element:t.props.element,item:t.props.item,dirty:!1},t}return(0,l.Z)(p,[{key:"_setValue",value:function(e){return e.replace(/[^A-Z0-9]+/gi,"_").toLowerCase()}},{key:"editOption",value:function(e,t){var n=this.state.element,a=n.options[e].value!==this._setValue(n.options[e].text)?n.options[e].value:this._setValue(t.target.value);n.options[e].text=t.target.value,n.options[e].value=a,this.setState({element:n,dirty:!0})}},{key:"editValue",value:function(e,t){var n=this.state.element,a=""===t.target.value?this._setValue(n.options[e].text):t.target.value;n.options[e].value=a,this.setState({element:n,dirty:!0})}},{key:"editOptionCorrect",value:function(e,t){var n=this.state.element;n.options[e].hasOwnProperty("correct")?delete n.options[e].correct:n.options[e].correct=!0,this.setState({element:n}),this.props.updateElement.call(this.props.preview,n)}},{key:"updateOption",value:function(){var e=this.state.element;this.state.dirty&&(this.props.updateElement.call(this.props.preview,e),this.setState({dirty:!1}))}},{key:"addOption",value:function(e){var t=this.state.element;t.options.splice(e+1,0,{value:"",text:"",key:L().uuid()}),this.props.updateElement.call(this.props.preview,t)}},{key:"removeOption",value:function(e){var t=this.state.element;t.options.splice(e,1),this.props.updateElement.call(this.props.preview,t)}},{key:"render",value:function(){var e=this;return this.state.dirty&&(this.state.element.dirty=!0),m().createElement("div",{className:"dynamic-option-list"},m().createElement("ul",null,m().createElement("li",null,m().createElement(M.Z,null,m().createElement(A.Z,{sm:6},m().createElement("b",null,m().createElement(G,{id:"options"}))),this.props.canHaveOptionValue&&m().createElement(A.Z,{sm:2},m().createElement("b",null,m().createElement(G,{id:"value"}))),this.props.canHaveOptionValue&&this.props.canHaveOptionCorrect&&m().createElement(A.Z,{sm:4},m().createElement("b",null,m().createElement(G,{id:"correct"}))))),this.props.element.options.map((function(t,n){var a="edit_".concat(t.key),l=t.value!==e._setValue(t.text)?t.value:"";return m().createElement("li",{className:"clearfix",key:a},m().createElement(M.Z,null,m().createElement(A.Z,{sm:6},m().createElement(_.Z.Control,{tabIndex:n+1,style:{width:"100%"},type:"text",name:"text_".concat(n),placeholder:"Option text",value:t.text,onBlur:e.updateOption.bind(e),onChange:e.editOption.bind(e,n)})),e.props.canHaveOptionValue&&m().createElement(A.Z,{sm:2},m().createElement(_.Z.Control,{type:"text",name:"value_".concat(n),value:l,onChange:e.editValue.bind(e,n)})),e.props.canHaveOptionValue&&e.props.canHaveOptionCorrect&&m().createElement(A.Z,{sm:1},m().createElement(_.Z.Check,{type:"checkbox",value:"1",onChange:e.editOptionCorrect.bind(e,n),checked:t.hasOwnProperty("correct")})),m().createElement(A.Z,{sm:3},m().createElement("div",{className:"dynamic-options-actions-buttons"},m().createElement(W.Z,{variant:"success",onClick:e.addOption.bind(e,n)},m().createElement(z.EIY,null)),n>0&&m().createElement(W.Z,{variant:"danger",onClick:e.removeOption.bind(e,n)},m().createElement(z.wbB,null))))))}))))}}]),p}(m().Component),q=n(2083);var U={options:["inline","list","textAlign","fontSize","link","history"],inline:{inDropdown:!1,className:void 0,options:["bold","italic","underline","superscript","subscript"]}},D=function(e){(0,r.Z)(p,e);var t,n,s=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,i.Z)(t);if(n){var l=(0,i.Z)(this).constructor;e=Reflect.construct(a,arguments,l)}else e=a.apply(this,arguments);return(0,o.Z)(this,e)});function p(e){var t;return(0,a.Z)(this,p),(t=s.call(this,e)).state={element:t.props.element,item:t.props.item,dirty:!1},t}return(0,l.Z)(p,[{key:"toggleRequired",value:function(){}},{key:"editElementProp",value:function(e,t,n){var a=this,l=this.state.element;l[e]=n.target[t],this.setState({element:l,dirty:!0},(function(){"checked"===t&&a.updateElement()}))}},{key:"onEditorStateChange",value:function(e,t,n){var a=P()((0,x.convertToRaw)(n.getCurrentContent())).replace(/<p>/g,"").replace(/<\/p>/g,"").replace(/&nbsp;/g," ").replace(/(?:\r\n|\r|\n)/g,""),l=this.state.element;l[t]=a,this.setState({element:l,dirty:!0})}},{key:"updateElement",value:function(){var e=this.state.element;this.state.dirty&&(this.props.updateElement.call(this.props.preview,e),this.setState({dirty:!1}))}},{key:"convertFromHTML",value:function(e){var t=(0,x.convertFromHTML)(e);if(!t.contentBlocks||!t.contentBlocks.length)return x.EditorState.createEmpty();var n=x.ContentState.createFromBlockArray(t);return x.EditorState.createWithContent(n)}},{key:"addOptions",value:function(){var e=this,t=document.getElementById("optionsApiUrl").value;t&&(0,q.U)(t).then((function(t){e.props.element.options=[];var n=e.props.element.options;t.forEach((function(e){e.key=L().uuid(),n.push(e)}));var a=e.state.element;e.setState({element:a,dirty:!0})}))}},{key:"render",value:function(){this.state.dirty&&(this.props.element.dirty=!0);var e,t,n=!!this.props.element.hasOwnProperty("required")&&this.props.element.required,a=!!this.props.element.hasOwnProperty("defaultChecked")&&this.props.element.defaultChecked,l=!!this.props.element.hasOwnProperty("readOnly")&&this.props.element.readOnly,r=!!this.props.element.hasOwnProperty("defaultToday")&&this.props.element.defaultToday,o=(!!this.props.element.hasOwnProperty("showTimeSelect")&&this.props.element.showTimeSelect,!!this.props.element.hasOwnProperty("showTimeSelectOnly")&&this.props.element.showTimeSelectOnly,!!this.props.element.hasOwnProperty("showTimeInput")&&this.props.element.showTimeInput,!!this.props.element.hasOwnProperty("inline")&&this.props.element.inline),i=!!this.props.element.hasOwnProperty("bold")&&this.props.element.bold,s=!!this.props.element.hasOwnProperty("italic")&&this.props.element.italic,p=!!this.props.element.hasOwnProperty("center")&&this.props.element.center,c=!!this.props.element.hasOwnProperty("pageBreakBefore")&&this.props.element.pageBreakBefore,d=!!this.props.element.hasOwnProperty("alternateForm")&&this.props.element.alternateForm,h=this.props.element,u=h.canHavePageBreakBefore,f=h.canHaveAlternateForm,E=h.canHaveDisplayHorizontal,b=h.canHaveOptionCorrect,v=h.canHaveOptionValue,y="Image"===this.state.element.element||"Camera"===this.state.element.element,g=this.props.files.length?this.props.files:[];return(g.length<1||g.length>0&&""!==g[0].id)&&g.unshift({id:"",file_name:""}),this.props.element.hasOwnProperty("content")&&(e=this.convertFromHTML(this.props.element.content)),this.props.element.hasOwnProperty("label")&&(e=this.convertFromHTML(this.props.element.label)),this.props.element.hasOwnProperty("boxLabel")&&(t=this.convertFromHTML(this.props.element.boxLabel)),m().createElement("div",null,m().createElement("div",{className:"clearfix"},m().createElement("h4",{className:"float-start"},this.props.element.text),m().createElement(z.aHS,{className:"float-end dismiss-edit",onClick:this.props.manualEditModeOff})),this.props.element.hasOwnProperty("content")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"text-to-display"}),":"),m().createElement(O.Editor,{toolbar:U,defaultEditorState:e,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"content"),stripPastedStyles:!0})),this.props.element.hasOwnProperty("filePath")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"fileSelect"},m().createElement(G,{id:"choose-file"}),":"),m().createElement(_.Z.Select,{id:"fileSelect",defaultValue:this.props.element.filePath,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"filePath","value")},g.map((function(e){var t="file_".concat(e.id);return m().createElement("option",{value:e.id,key:t},e.file_name)})))),this.props.element.hasOwnProperty("href")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"href"},m().createElement(G,{id:"link-to"}),":"),m().createElement(_.Z.Control,{id:"href",type:"text",defaultValue:this.props.element.href,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"href","value")})),this.props.element.hasOwnProperty("label")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"display-label"}),":"),m().createElement(O.Editor,{toolbar:U,defaultEditorState:e,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"label"),stripPastedStyles:!0}),m().createElement("br",null),m().createElement(_.Z.Label,{className:"fw-bold"},"Field Properties:"),m().createElement(_.Z.Check,{id:"is-required",label:m().createElement(G,{id:"required"}),type:"checkbox",checked:n,value:!0,onChange:this.editElementProp.bind(this,"required","checked")}),this.props.element.hasOwnProperty("readOnly")&&m().createElement(_.Z.Check,{id:"is-read-only",label:m().createElement(G,{id:"read-only"}),type:"checkbox",checked:l,value:!0,onChange:this.editElementProp.bind(this,"readOnly","checked")}),this.props.element.hasOwnProperty("defaultToday")&&m().createElement(_.Z.Check,{id:"is-default-to-today",label:m().createElement(G,{id:"default-to-today"}),type:"checkbox",checked:r,value:!0,onChange:this.editElementProp.bind(this,"defaultToday","checked")}),-1!==["Checkboxes","Checkbox"].indexOf(this.state.element.element)&&m().createElement(_.Z.Check,{id:"default-checked",label:m().createElement(G,{id:"default-checked"}),type:"checkbox",checked:a,value:!0,onChange:this.editElementProp.bind(this,"defaultChecked","checked")}),("RadioButtons"===this.state.element.element||"Checkboxes"===this.state.element.element)&&E&&m().createElement(_.Z.Check,{id:"display-horizontal",label:m().createElement(G,{id:"display-horizontal"}),type:"checkbox",checked:o,value:!0,onChange:this.editElementProp.bind(this,"inline","checked")})),"Checkbox"===this.state.element.element&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"checkbox-label-text"}),":"),m().createElement(O.Editor,{toolbar:U,defaultEditorState:t,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"boxLabel"),stripPastedStyles:!0})),this.props.element.hasOwnProperty("src")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"srcInput"},m().createElement(G,{id:"link-to"}),":"),m().createElement(_.Z.Control,{id:"srcInput",type:"text",defaultValue:this.props.element.src,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"src","value")})),y&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(M.Z,null,m().createElement(A.Z,{sm:3},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"do-center"},"Alignment:"),m().createElement(_.Z.Check,{id:"do-center",label:m().createElement(G,{id:"center"}),type:"checkbox",checked:p,value:!0,onChange:this.editElementProp.bind(this,"center","checked")})),m().createElement(A.Z,{sm:3},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"elementWidth"},m().createElement(G,{id:"width"}),":"),m().createElement(_.Z.Control,{id:"elementWidth",type:"number",defaultValue:this.props.element.width,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"width","value")})),m().createElement(A.Z,{sm:3},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"elementHeight"},m().createElement(G,{id:"height"}),":"),m().createElement(_.Z.Control,{id:"elementHeight",type:"number",defaultValue:this.props.element.height,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"height","value")})))),"FileUpload"===this.state.element.element&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"fileType"},m().createElement(G,{id:"choose-file-type"}),":"),m().createElement(_.Z.Select,{id:"fileType",onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"fileType","value")},[{type:"image, application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation, video/mp4,video/x-m4v,video/*",typeName:"All File Type"},{type:"image",typeName:"Image"},{type:"application/pdf",typeName:"PDF"},{type:"application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document",typeName:"Word"},{type:"application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",typeName:"Excel"},{type:"application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation",typeName:"Powerpoint"},{type:"video/mp4,video/x-m4v,video/*",typeName:"Videos"}].map((function(e,t){return m().createElement("option",{value:e.type,key:t},e.typeName)})))),u&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"print-options"}),":"),m().createElement(_.Z.Check,{id:"page-break-before-element",label:m().createElement(G,{id:"page-break-before-element"}),type:"checkbox",checked:c,value:!0,onChange:this.editElementProp.bind(this,"pageBreakBefore","checked")})),f&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"alternate-signature-page"}),":"),m().createElement(_.Z.Check,{id:"display-on-alternate",label:m().createElement(G,{id:"display-on-alternate-signature-page"}),type:"checkbox",checked:d,value:!0,onChange:this.editElementProp.bind(this,"alternateForm","checked")})),this.props.element.hasOwnProperty("step")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement("div",{className:"form-group-range"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"rangeStep"},m().createElement(G,{id:"step"}),":"),m().createElement(_.Z.Control,{id:"rangeStep",type:"number",defaultValue:this.props.element.step,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"step","value")}))),this.props.element.hasOwnProperty("minValue")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement("div",{className:"form-group-range"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"rangeMin"},m().createElement(G,{id:"min"}),":"),m().createElement(_.Z.Control,{id:"rangeMin",type:"number",defaultValue:this.props.element.minValue,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"minValue","value")}))),this.props.element.hasOwnProperty("minLabel")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement("div",{className:"form-group-range"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"rangeMin"},m().createElement(G,{id:"min-label"}),":"),m().createElement(_.Z.Control,{type:"text",defaultValue:this.props.element.minLabel,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"minLabel","value")}))),this.props.element.hasOwnProperty("maxValue")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement("div",{className:"form-group-range"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"rangeMax"},m().createElement(G,{id:"max"}),":"),m().createElement(_.Z.Control,{id:"rangeMax",type:"number",defaultValue:this.props.element.maxValue,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"maxValue","value")}))),this.props.element.hasOwnProperty("maxLabel")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement("div",{className:"form-group-range"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"rangeMax"},m().createElement(G,{id:"max-label"}),":"),m().createElement(_.Z.Control,{type:"text",defaultValue:this.props.element.maxLabel,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"maxLabel","value")}))),this.props.element.hasOwnProperty("defaultValue")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement("div",{className:"form-group-range"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"defaultSelected"},m().createElement(G,{id:"default-selected"}),":"),m().createElement(_.Z.Control,{id:"defaultSelected",type:"number",defaultValue:this.props.element.defaultValue,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"defaultValue","value")}))),this.props.element.hasOwnProperty("static")&&this.props.element.static&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"text-style"}),":"),m().createElement(_.Z.Check,{id:"do-bold",inline:!0,label:m().createElement(G,{id:"bold"}),type:"checkbox",checked:i,value:!0,onChange:this.editElementProp.bind(this,"bold","checked")}),m().createElement(_.Z.Check,{id:"do-italic",inline:!0,label:m().createElement(G,{id:"italic"}),type:"checkbox",checked:s,value:!0,onChange:this.editElementProp.bind(this,"italic","checked")})),this.props.element.showPlaceholder&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"placeholder"},m().createElement(G,{id:"place-holder-text-label"}),":"),m().createElement(_.Z.Control,{type:"text",id:"placeholder",defaultValue:this.props.element.placeholder,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"placeholder","value")})),this.props.element.showCustomName&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"customName"},m().createElement(G,{id:"custom-name-label"}),":"),m().createElement(_.Z.Control,{type:"text",id:"customName",defaultValue:this.props.element.customName,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"customName","value")})),this.props.element.showLabelLocationPicker&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"labelLocation"},m().createElement(G,{id:"choose-label-location"}),":"),m().createElement(_.Z.Select,{id:"labelLocation",defaultValue:this.props.element.labelLocation,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"labelLocation","value")},m().createElement("option",{value:"ABOVE"},"Above Form Field"),m().createElement("option",{value:"FLOATING"},"Floating Inside Form Field"))),this.props.element.showHelp&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"help"},m().createElement(G,{id:"help-label"}),":"),m().createElement(k,{type:"text",className:"form-control",id:"help",defaultValue:this.props.element.help,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"help","value")})),this.props.element.showDescription&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"questionDescription"},m().createElement(G,{id:"description"}),":"),m().createElement(k,{type:"text",className:"form-control",id:"questionDescription",defaultValue:this.props.element.description,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"description","value")})),this.props.showCorrectColumn&&this.props.element.canHaveAnswer&&!this.props.element.hasOwnProperty("options")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"correctAnswer"},m().createElement(G,{id:"correct-answer"}),":"),m().createElement(_.Z.Control,{id:"correctAnswer",type:"text",defaultValue:this.props.element.correct,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"correct","value")})),this.props.element.canPopulateFromApi&&this.props.element.hasOwnProperty("options")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"optionsApiUrl"},m().createElement(G,{id:"populate-options-from-api"}),":"),m().createElement(M.Z,null,m().createElement(A.Z,{sm:6},m().createElement(_.Z.Control,{style:{width:"100%"},type:"text",id:"optionsApiUrl",placeholder:"http://localhost:8080/api/optionsdata"})),m().createElement(A.Z,{sm:6},m().createElement(W.Z,{variant:"success",onClick:this.addOptions.bind(this)},m().createElement(G,{id:"populate"}))))),this.props.element.hasOwnProperty("options")&&m().createElement(I,{showCorrectColumn:this.props.showCorrectColumn,canHaveOptionCorrect:b,canHaveOptionValue:v,item:this.props.preview.state.item,updateElement:this.props.updateElement,preview:this.props.preview,element:this.props.element,key:this.props.element.options.length}))}}]),p}(m().Component);D.defaultProps={className:"edit-element-fields"}}}]);
1
+ "use strict";(self.webpackChunkReactSurveyBuilder=self.webpackChunkReactSurveyBuilder||[]).push([[186],{8186:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Y});var a=n(5671),l=n(3144),r=n(136),o=n(2963),i=n(1120),s=n(359),m=n.n(s),p=n(7462),c=n(3366);const d=s.useLayoutEffect;var h=function(e,t){"function"!=typeof e?e.current=t:e(t)};var u={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},b=function(e){Object.keys(u).forEach((function(t){e.style.setProperty(t,u[t],"important")}))},E=null,f=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize},y=function(){},v=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],g=!!document.documentElement.currentStyle;function w(e,t,n){var a,l,r=(a=n,l=s.useRef(a),d((function(){l.current=a})),l);s.useLayoutEffect((function(){var n=function(e){return r.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}}),[])}var Z=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],C=function(e,t){var n,a=e.cacheMeasurements,l=e.maxRows,r=e.minRows,o=e.onChange,i=void 0===o?y:o,m=e.onHeightChange,d=void 0===m?y:m,u=(0,c.Z)(e,Z),C=void 0!==u.value,k=s.useRef(null),x=function(e,t){var n=(0,s.useRef)();return(0,s.useCallback)((function(a){e.current=a,n.current&&h(n.current,null),n.current=t,t&&h(t,a)}),[t])}(k,t),N=s.useRef(0),P=s.useRef(),O=function(){var e=k.current,t=a&&P.current?P.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n,a=(n=t,v.reduce((function(e,t){return e[t]=n[t],e}),{})),l=a.boxSizing;return""===l?null:(g&&"border-box"===l&&(a.width=parseFloat(a.width)+parseFloat(a.borderRightWidth)+parseFloat(a.borderLeftWidth)+parseFloat(a.paddingRight)+parseFloat(a.paddingLeft)+"px"),{sizingStyle:a,paddingSize:parseFloat(a.paddingBottom)+parseFloat(a.paddingTop),borderSize:parseFloat(a.borderBottomWidth)+parseFloat(a.borderTopWidth)})}(e);if(t){P.current=t;var n=function(e,t,n,a){void 0===n&&(n=1),void 0===a&&(a=1/0),E||((E=document.createElement("textarea")).setAttribute("tabindex","-1"),E.setAttribute("aria-hidden","true"),b(E)),null===E.parentNode&&document.body.appendChild(E);var l=e.paddingSize,r=e.borderSize,o=e.sizingStyle,i=o.boxSizing;Object.keys(o).forEach((function(e){var t=e;E.style[t]=o[t]})),b(E),E.value=t;var s=f(E,e);E.value=t,s=f(E,e),E.value="x";var m=E.scrollHeight-l,p=m*n;"border-box"===i&&(p=p+l+r),s=Math.max(p,s);var c=m*a;return"border-box"===i&&(c=c+l+r),[s=Math.min(c,s),m]}(t,e.value||e.placeholder||"x",r,l),o=n[0],i=n[1];N.current!==o&&(N.current=o,e.style.setProperty("height",o+"px","important"),d(o,{rowHeight:i}))}};return s.useLayoutEffect(O),w(window,"resize",O),n=O,w(document.fonts,"loadingdone",n),s.createElement("textarea",(0,p.Z)({},u,{onChange:function(e){C||O(),i(e)},ref:x}))},k=s.forwardRef(C),x=n(7163),N=n(9265),P=n.n(N),O=n(5108),S=n(9333),L=n.n(S),F=n(7582),B=n(4806),V=n(680);function H(e){var t=function(){var e=s.useContext(B._y);return(0,V.lq)(e),e}(),n=t.formatMessage,a=t.textComponent,l=void 0===a?s.Fragment:a,r=e.id,o=e.description,i=e.defaultMessage,m=e.values,p=e.children,c=e.tagName,d=void 0===c?l:c,h=n({id:r,description:o,defaultMessage:i},m,{ignoreTag:e.ignoreTag});return"function"==typeof p?p(Array.isArray(h)?h:[h]):d?s.createElement(d,null,s.Children.toArray(h)):s.createElement(s.Fragment,null,h)}H.displayName="FormattedMessage";var R=s.memo(H,(function(e,t){var n=e.values,a=(0,F._T)(e,["values"]),l=t.values,r=(0,F._T)(t,["values"]);return(0,V.wU)(l,n)&&(0,V.wU)(a,r)}));R.displayName="MemoizedFormattedMessage";const T=R,G=(0,B.ZP)((function(e){return m().createElement(T,e)}),{withRef:!1});var z=n(2091),A=n(4051),M=n(1555),_=n(7833),W=n(5005);var I=function(e){(0,r.Z)(p,e);var t,n,s=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,i.Z)(t);if(n){var l=(0,i.Z)(this).constructor;e=Reflect.construct(a,arguments,l)}else e=a.apply(this,arguments);return(0,o.Z)(this,e)});function p(e){var t;return(0,a.Z)(this,p),(t=s.call(this,e)).state={element:t.props.element,item:t.props.item,dirty:!1},t}return(0,l.Z)(p,[{key:"_setValue",value:function(e){return e.replace(/[^A-Z0-9]+/gi,"_").toLowerCase()}},{key:"editOption",value:function(e,t){var n=this.state.element,a=n.options[e].value!==this._setValue(n.options[e].text)?n.options[e].value:this._setValue(t.target.value);n.options[e].text=t.target.value,n.options[e].value=a,this.setState({element:n,dirty:!0})}},{key:"editValue",value:function(e,t){var n=this.state.element,a=""===t.target.value?this._setValue(n.options[e].text):t.target.value;n.options[e].value=a,this.setState({element:n,dirty:!0})}},{key:"editOptionCorrect",value:function(e,t){var n=this.state.element;n.options[e].hasOwnProperty("correct")?delete n.options[e].correct:n.options[e].correct=!0,this.setState({element:n}),this.props.updateElement.call(this.props.preview,n)}},{key:"updateOption",value:function(){var e=this.state.element;this.state.dirty&&(this.props.updateElement.call(this.props.preview,e),this.setState({dirty:!1}))}},{key:"addOption",value:function(e){var t=this.state.element;t.options.splice(e+1,0,{value:"",text:"",key:L().uuid()}),this.props.updateElement.call(this.props.preview,t)}},{key:"removeOption",value:function(e){var t=this.state.element;t.options.splice(e,1),this.props.updateElement.call(this.props.preview,t)}},{key:"render",value:function(){var e=this;return this.state.dirty&&(this.state.element.dirty=!0),m().createElement("div",{className:"dynamic-option-list"},m().createElement("ul",null,m().createElement("li",null,m().createElement(A.Z,null,m().createElement(M.Z,{sm:6},m().createElement("b",null,m().createElement(G,{id:"options"}))),this.props.canHaveOptionValue&&m().createElement(M.Z,{sm:2},m().createElement("b",null,m().createElement(G,{id:"value"}))),this.props.canHaveOptionValue&&this.props.canHaveOptionCorrect&&m().createElement(M.Z,{sm:4},m().createElement("b",null,m().createElement(G,{id:"correct"}))))),this.props.element.options.map((function(t,n){var a="edit_".concat(t.key),l=t.value!==e._setValue(t.text)?t.value:"";return m().createElement("li",{className:"clearfix",key:a},m().createElement(A.Z,null,m().createElement(M.Z,{sm:6},m().createElement(_.Z.Control,{tabIndex:n+1,style:{width:"100%"},type:"text",name:"text_".concat(n),placeholder:"Option text",value:t.text,onBlur:e.updateOption.bind(e),onChange:e.editOption.bind(e,n)})),e.props.canHaveOptionValue&&m().createElement(M.Z,{sm:2},m().createElement(_.Z.Control,{type:"text",name:"value_".concat(n),value:l,onChange:e.editValue.bind(e,n)})),e.props.canHaveOptionValue&&e.props.canHaveOptionCorrect&&m().createElement(M.Z,{sm:1},m().createElement(_.Z.Check,{type:"checkbox",value:"1",onChange:e.editOptionCorrect.bind(e,n),checked:t.hasOwnProperty("correct")})),m().createElement(M.Z,{sm:3},m().createElement("div",{className:"dynamic-options-actions-buttons"},m().createElement(W.Z,{variant:"success",onClick:e.addOption.bind(e,n)},m().createElement(z.EIY,null)),n>0&&m().createElement(W.Z,{variant:"danger",onClick:e.removeOption.bind(e,n)},m().createElement(z.wbB,null))))))}))))}}]),p}(m().Component),q=n(2083);var D={options:["inline","blockType","list","textAlign","fontSize","link","remove","history"],inline:{inDropdown:!1,className:void 0,options:["bold","italic","underline","strikethrough","monospace","superscript","subscript"]}},U={options:["inline","list","textAlign","fontSize","link","history"],inline:{inDropdown:!1,className:void 0,options:["bold","italic","underline","superscript","subscript"]}},j={options:["inline","list","textAlign","fontSize","link","history"],inline:{inDropdown:!1,className:void 0,options:["bold","italic","underline","superscript","subscript"]}},Y=function(e){(0,r.Z)(p,e);var t,n,s=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,i.Z)(t);if(n){var l=(0,i.Z)(this).constructor;e=Reflect.construct(a,arguments,l)}else e=a.apply(this,arguments);return(0,o.Z)(this,e)});function p(e){var t;return(0,a.Z)(this,p),(t=s.call(this,e)).state={element:t.props.element,item:t.props.item,dirty:!1},t}return(0,l.Z)(p,[{key:"toggleRequired",value:function(){}},{key:"editElementProp",value:function(e,t,n){var a=this,l=this.state.element;l[e]=n.target[t],this.setState({element:l,dirty:!0},(function(){"checked"===t&&a.updateElement()}))}},{key:"onEditorStateChange",value:function(e,t,n){var a=P()((0,x.convertToRaw)(n.getCurrentContent())).replace(/&nbsp;/g," ").replace(/(?:\r\n|\r|\n)/g,""),l=this.state.element;l[t]=a,this.setState({element:l,dirty:!0})}},{key:"updateElement",value:function(){var e=this.state.element;this.state.dirty&&(this.props.updateElement.call(this.props.preview,e),this.setState({dirty:!1}))}},{key:"convertFromHTML",value:function(e){var t=(0,x.convertFromHTML)(e);if(!t.contentBlocks||!t.contentBlocks.length)return x.EditorState.createEmpty();var n=x.ContentState.createFromBlockArray(t);return x.EditorState.createWithContent(n)}},{key:"addOptions",value:function(){var e=this,t=document.getElementById("optionsApiUrl").value;t&&(0,q.U)(t).then((function(t){e.props.element.options=[];var n=e.props.element.options;t.forEach((function(e){e.key=L().uuid(),n.push(e)}));var a=e.state.element;e.setState({element:a,dirty:!0})}))}},{key:"render",value:function(){this.state.dirty&&(this.props.element.dirty=!0);var e,t,n=!!this.props.element.hasOwnProperty("required")&&this.props.element.required,a=!!this.props.element.hasOwnProperty("defaultChecked")&&this.props.element.defaultChecked,l=!!this.props.element.hasOwnProperty("readOnly")&&this.props.element.readOnly,r=!!this.props.element.hasOwnProperty("defaultToday")&&this.props.element.defaultToday,o=(!!this.props.element.hasOwnProperty("showTimeSelect")&&this.props.element.showTimeSelect,!!this.props.element.hasOwnProperty("showTimeSelectOnly")&&this.props.element.showTimeSelectOnly,!!this.props.element.hasOwnProperty("showTimeInput")&&this.props.element.showTimeInput,!!this.props.element.hasOwnProperty("inline")&&this.props.element.inline),i=!!this.props.element.hasOwnProperty("bold")&&this.props.element.bold,s=!!this.props.element.hasOwnProperty("italic")&&this.props.element.italic,p=!!this.props.element.hasOwnProperty("center")&&this.props.element.center,c=!!this.props.element.hasOwnProperty("pageBreakBefore")&&this.props.element.pageBreakBefore,d=!!this.props.element.hasOwnProperty("alternateForm")&&this.props.element.alternateForm,h=!!this.props.element.hasOwnProperty("hideLabel")&&this.props.element.hideLabel,u=this.props.element,b=u.canHavePageBreakBefore,E=u.canHaveAlternateForm,f=u.canHaveDisplayHorizontal,y=u.canHaveOptionCorrect,v=u.canHaveOptionValue,g=u.canHideLabel,w=void 0!==g&&g,Z="Image"===this.state.element.element||"Camera"===this.state.element.element,C=this.props.files.length?this.props.files:[];return(C.length<1||C.length>0&&""!==C[0].id)&&C.unshift({id:"",file_name:""}),this.props.element.hasOwnProperty("content")&&(e=this.convertFromHTML(this.props.element.content)),this.props.element.hasOwnProperty("label")&&(e=this.convertFromHTML(this.props.element.label)),this.props.element.hasOwnProperty("boxLabel")&&(t=this.convertFromHTML(this.props.element.boxLabel)),m().createElement("div",null,m().createElement("div",{className:"clearfix"},m().createElement("h4",{className:"float-start"},this.props.element.text),m().createElement(z.aHS,{className:"float-end dismiss-edit",onClick:this.props.manualEditModeOff})),this.props.element.hasOwnProperty("content")&&"Header"===this.state.element.element&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"text-to-display"}),":"),m().createElement(O.Editor,{toolbar:U,defaultEditorState:e,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"content"),stripPastedStyles:!0})),this.props.element.hasOwnProperty("content")&&"Label"===this.state.element.element&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"text-to-display"}),":"),m().createElement(O.Editor,{toolbar:j,defaultEditorState:e,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"content"),stripPastedStyles:!0})),this.props.element.hasOwnProperty("content")&&"Paragraph"===this.state.element.element&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"text-to-display"}),":"),m().createElement(O.Editor,{toolbar:j,defaultEditorState:e,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"content"),stripPastedStyles:!0})),this.props.element.hasOwnProperty("content")&&"ContentBody"===this.state.element.element&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"text-to-display"}),":"),m().createElement(O.Editor,{toolbar:D,defaultEditorState:e,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"content")})),this.props.element.hasOwnProperty("filePath")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"fileSelect"},m().createElement(G,{id:"choose-file"}),":"),m().createElement(_.Z.Select,{id:"fileSelect",defaultValue:this.props.element.filePath,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"filePath","value")},C.map((function(e){var t="file_".concat(e.id);return m().createElement("option",{value:e.id,key:t},e.file_name)})))),this.props.element.hasOwnProperty("href")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"href"},m().createElement(G,{id:"link-to"}),":"),m().createElement(_.Z.Control,{id:"href",type:"text",defaultValue:this.props.element.href,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"href","value")})),this.props.element.hasOwnProperty("label")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"display-label"}),":"),m().createElement(O.Editor,{toolbar:j,defaultEditorState:e,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"label"),stripPastedStyles:!0}),m().createElement("br",null),m().createElement(_.Z.Label,{className:"fw-bold"},"Field Properties:"),m().createElement(_.Z.Check,{id:"is-required",label:m().createElement(G,{id:"required"}),type:"checkbox",checked:n,value:!0,onChange:this.editElementProp.bind(this,"required","checked")}),this.props.element.hasOwnProperty("readOnly")&&m().createElement(_.Z.Check,{id:"is-read-only",label:m().createElement(G,{id:"read-only"}),type:"checkbox",checked:l,value:!0,onChange:this.editElementProp.bind(this,"readOnly","checked")}),this.props.element.hasOwnProperty("defaultToday")&&m().createElement(_.Z.Check,{id:"is-default-to-today",label:m().createElement(G,{id:"default-to-today"}),type:"checkbox",checked:r,value:!0,onChange:this.editElementProp.bind(this,"defaultToday","checked")}),-1!==["Checkboxes","Checkbox"].indexOf(this.state.element.element)&&m().createElement(_.Z.Check,{id:"default-checked",label:m().createElement(G,{id:"default-checked"}),type:"checkbox",checked:a,value:!0,onChange:this.editElementProp.bind(this,"defaultChecked","checked")}),("RadioButtons"===this.state.element.element||"Checkboxes"===this.state.element.element)&&f&&m().createElement(_.Z.Check,{id:"display-horizontal",label:m().createElement(G,{id:"display-horizontal"}),type:"checkbox",checked:o,value:!0,onChange:this.editElementProp.bind(this,"inline","checked")})),"Checkbox"===this.state.element.element&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"checkbox-label-text"}),":"),m().createElement(O.Editor,{toolbar,defaultEditorState:t,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"boxLabel"),stripPastedStyles:!0})),this.props.element.hasOwnProperty("src")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"srcInput"},m().createElement(G,{id:"link-to"}),":"),m().createElement(_.Z.Control,{id:"srcInput",type:"text",defaultValue:this.props.element.src,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"src","value")})),Z&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(A.Z,null,m().createElement(M.Z,{sm:3},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"do-center"},"Alignment:"),m().createElement(_.Z.Check,{id:"do-center",label:m().createElement(G,{id:"center"}),type:"checkbox",checked:p,value:!0,onChange:this.editElementProp.bind(this,"center","checked")})),m().createElement(M.Z,{sm:3},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"elementWidth"},m().createElement(G,{id:"width"}),":"),m().createElement(_.Z.Control,{id:"elementWidth",type:"number",defaultValue:this.props.element.width,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"width","value")})),m().createElement(M.Z,{sm:3},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"elementHeight"},m().createElement(G,{id:"height"}),":"),m().createElement(_.Z.Control,{id:"elementHeight",type:"number",defaultValue:this.props.element.height,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"height","value")})))),"FileUpload"===this.state.element.element&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"fileType"},m().createElement(G,{id:"choose-file-type"}),":"),m().createElement(_.Z.Select,{id:"fileType",onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"fileType","value")},[{type:"image, application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation, video/mp4,video/x-m4v,video/*",typeName:"All File Type"},{type:"image",typeName:"Image"},{type:"application/pdf",typeName:"PDF"},{type:"application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document",typeName:"Word"},{type:"application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",typeName:"Excel"},{type:"application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation",typeName:"Powerpoint"},{type:"video/mp4,video/x-m4v,video/*",typeName:"Videos"}].map((function(e,t){return m().createElement("option",{value:e.type,key:t},e.typeName)})))),b&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"print-options"}),":"),m().createElement(_.Z.Check,{id:"page-break-before-element",label:m().createElement(G,{id:"page-break-before-element"}),type:"checkbox",checked:c,value:!0,onChange:this.editElementProp.bind(this,"pageBreakBefore","checked")})),E&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"alternate-signature-page"}),":"),m().createElement(_.Z.Check,{id:"display-on-alternate",label:m().createElement(G,{id:"display-on-alternate-signature-page"}),type:"checkbox",checked:d,value:!0,onChange:this.editElementProp.bind(this,"alternateForm","checked")})),this.props.element.hasOwnProperty("step")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement("div",{className:"form-group-range"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"rangeStep"},m().createElement(G,{id:"step"}),":"),m().createElement(_.Z.Control,{id:"rangeStep",type:"number",defaultValue:this.props.element.step,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"step","value")}))),this.props.element.hasOwnProperty("minValue")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement("div",{className:"form-group-range"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"rangeMin"},m().createElement(G,{id:"min"}),":"),m().createElement(_.Z.Control,{id:"rangeMin",type:"number",defaultValue:this.props.element.minValue,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"minValue","value")}))),this.props.element.hasOwnProperty("minLabel")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement("div",{className:"form-group-range"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"rangeMin"},m().createElement(G,{id:"min-label"}),":"),m().createElement(_.Z.Control,{type:"text",defaultValue:this.props.element.minLabel,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"minLabel","value")}))),this.props.element.hasOwnProperty("maxValue")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement("div",{className:"form-group-range"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"rangeMax"},m().createElement(G,{id:"max"}),":"),m().createElement(_.Z.Control,{id:"rangeMax",type:"number",defaultValue:this.props.element.maxValue,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"maxValue","value")}))),this.props.element.hasOwnProperty("maxLabel")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement("div",{className:"form-group-range"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"rangeMax"},m().createElement(G,{id:"max-label"}),":"),m().createElement(_.Z.Control,{type:"text",defaultValue:this.props.element.maxLabel,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"maxLabel","value")}))),this.props.element.hasOwnProperty("defaultValue")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement("div",{className:"form-group-range"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"defaultSelected"},m().createElement(G,{id:"default-selected"}),":"),m().createElement(_.Z.Control,{id:"defaultSelected",type:"number",defaultValue:this.props.element.defaultValue,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"defaultValue","value")}))),this.props.element.hasOwnProperty("static")&&this.props.element.static&&this.props.element.hasOwnProperty("bold")&&this.props.element.hasOwnProperty("italic")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},m().createElement(G,{id:"text-style"}),":"),m().createElement(_.Z.Check,{id:"do-bold",inline:!0,label:m().createElement(G,{id:"bold"}),type:"checkbox",checked:i,value:!0,onChange:this.editElementProp.bind(this,"bold","checked")}),m().createElement(_.Z.Check,{id:"do-italic",inline:!0,label:m().createElement(G,{id:"italic"}),type:"checkbox",checked:s,value:!0,onChange:this.editElementProp.bind(this,"italic","checked")})),this.props.element.showPlaceholder&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"placeholder"},m().createElement(G,{id:"place-holder-text-label"}),":"),m().createElement(_.Z.Control,{type:"text",id:"placeholder",defaultValue:this.props.element.placeholder,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"placeholder","value")})),this.props.element.showCustomName&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"customName"},m().createElement(G,{id:"custom-name-label"}),":"),m().createElement(_.Z.Control,{type:"text",id:"customName",defaultValue:this.props.element.customName,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"customName","value")})),this.props.element.showLabelLocationPicker&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"labelLocation"},m().createElement(G,{id:"choose-label-location"}),":"),m().createElement(_.Z.Select,{id:"labelLocation",defaultValue:this.props.element.labelLocation,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"labelLocation","value")},m().createElement("option",{value:"ABOVE"},"Above Form Field"),m().createElement("option",{value:"FLOATING"},"Floating Inside Form Field"))),w&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold"},"Hide Label:"),m().createElement(_.Z.Check,{id:"hide-label",label:"Hide Label",type:"checkbox",checked:h,value:!0,onChange:this.editElementProp.bind(this,"hideLabel","checked")})),this.props.element.showHelp&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"help"},m().createElement(G,{id:"help-label"}),":"),m().createElement(k,{type:"text",className:"form-control",id:"help",defaultValue:this.props.element.help,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"help","value")})),this.props.element.showDescription&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"questionDescription"},m().createElement(G,{id:"description"}),":"),m().createElement(k,{type:"text",className:"form-control",id:"questionDescription",defaultValue:this.props.element.description,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"description","value")})),this.props.showCorrectColumn&&this.props.element.canHaveAnswer&&!this.props.element.hasOwnProperty("options")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"correctAnswer"},m().createElement(G,{id:"correct-answer"}),":"),m().createElement(_.Z.Control,{id:"correctAnswer",type:"text",defaultValue:this.props.element.correct,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"correct","value")})),this.props.element.canPopulateFromApi&&this.props.element.hasOwnProperty("options")&&m().createElement(_.Z.Group,{className:"form-group mb-5"},m().createElement(_.Z.Label,{className:"fw-bold",htmlFor:"optionsApiUrl"},m().createElement(G,{id:"populate-options-from-api"}),":"),m().createElement(A.Z,null,m().createElement(M.Z,{sm:6},m().createElement(_.Z.Control,{style:{width:"100%"},type:"text",id:"optionsApiUrl",placeholder:"http://localhost:8080/api/optionsdata"})),m().createElement(M.Z,{sm:6},m().createElement(W.Z,{variant:"success",onClick:this.addOptions.bind(this)},m().createElement(G,{id:"populate"}))))),this.props.element.hasOwnProperty("options")&&m().createElement(I,{showCorrectColumn:this.props.showCorrectColumn,canHaveOptionCorrect:y,canHaveOptionValue:v,item:this.props.preview.state.item,updateElement:this.props.updateElement,preview:this.props.preview,element:this.props.element,key:this.props.element.options.length}))}}]),p}(m().Component);Y.defaultProps={className:"edit-element-fields"}}}]);