react-survey-builder 1.0.8 → 1.0.9
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 +4 -0
- package/dist/967.index.js +1 -1
- package/dist/index.js +1 -1
- package/lib/form.js +3 -3
- package/lib/language-provider/index.js +1 -15
- package/lib/language-provider/locales/en-us.json +1 -0
- package/lib/survey-elements/index.js +78 -11
- package/lib/survey-elements-edit.js +44 -31
- package/lib/toolbar.js +14 -6
- package/package.json +1 -1
- package/types/index.d.ts +6 -0
- package/lib/language-provider/entries/it-it.js +0 -16
- package/lib/language-provider/entries/vi-vn.js +0 -16
- package/lib/language-provider/locales/it-it.json +0 -92
- package/lib/language-provider/locales/vi-vn.json +0 -82
package/README.md
CHANGED
@@ -92,6 +92,10 @@ task_id | integer | Optional | User to submit a hidden variable with id to the f
|
|
92
92
|
answerData | array | Optional | Answer data, only used if loading a pre-existing form with values.
|
93
93
|
authenticity_token | string | Optional | If using Rails and need an auth token to submit form.
|
94
94
|
hideActions | boolean | Optional | If you would like to hide the submit / cancel buttons set to true.
|
95
|
+
submitButton | ElementNode | Optional | If you would like to inject your own submit button.
|
96
|
+
backButton | ElementNode | Optional | If you would like to inject your own back/cancel button.
|
97
|
+
buttonClassName | string | Optional | CSS class(es) for the button container
|
98
|
+
hideActions | boolean | Optional | If you would like to hide the submit / cancel buttons set to true.
|
95
99
|
skipValidations | boolean | Optional | Suppress form validations on submit, if set to true.
|
96
100
|
displayShort | boolean | Optional | Display an optional "shorter page/form" which is common for legal documents or situations where the user will just have to sign or fill out a shorter form with only the critical elements.
|
97
101
|
readOnly | boolean | Optional | Shows a read only version which has fields disabled and removes "required" labels.
|
package/dist/967.index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkReactSurveyBuilder=self.webpackChunkReactSurveyBuilder||[]).push([[967],{7967:(e,t,n)=>{n.r(t),n.d(t,{default:()=>A});var l=n(5671),r=n(3144),a=n(136),i=n(2963),o=n(1120),s=n(359),p=n.n(s),c=n(7462),m=n(3366),d=n(3469),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"},E=function(e){Object.keys(u).forEach((function(t){e.style.setProperty(t,u[t],"important")}))},f=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"],Z=!!document.documentElement.currentStyle;function g(e,t,n){var l,r,a=(l=n,r=s.useRef(l),(0,d.Z)((function(){r.current=l})),r);s.useLayoutEffect((function(){var n=function(e){return a.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}}),[])}var C=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],k=function(e,t){var n,l=e.cacheMeasurements,r=e.maxRows,a=e.minRows,i=e.onChange,o=void 0===i?v:i,p=e.onHeightChange,d=void 0===p?v:p,u=(0,m.Z)(e,C),k=void 0!==u.value,x=s.useRef(null),w=function(e,t){var n=(0,s.useRef)();return(0,s.useCallback)((function(l){e.current=l,n.current&&h(n.current,null),n.current=t,t&&h(t,l)}),[t])}(x,t),P=s.useRef(0),O=s.useRef(),S=function(){var e=x.current,t=l&&O.current?O.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n,l=(n=t,y.reduce((function(e,t){return e[t]=n[t],e}),{})),r=l.boxSizing;return""===r?null:(Z&&"border-box"===r&&(l.width=parseFloat(l.width)+parseFloat(l.borderRightWidth)+parseFloat(l.borderLeftWidth)+parseFloat(l.paddingRight)+parseFloat(l.paddingLeft)+"px"),{sizingStyle:l,paddingSize:parseFloat(l.paddingBottom)+parseFloat(l.paddingTop),borderSize:parseFloat(l.borderBottomWidth)+parseFloat(l.borderTopWidth)})}(e);if(t){O.current=t;var n=function(e,t,n,l){void 0===n&&(n=1),void 0===l&&(l=1/0),f||((f=document.createElement("textarea")).setAttribute("tabindex","-1"),f.setAttribute("aria-hidden","true"),E(f)),null===f.parentNode&&document.body.appendChild(f);var r=e.paddingSize,a=e.borderSize,i=e.sizingStyle,o=i.boxSizing;Object.keys(i).forEach((function(e){var t=e;f.style[t]=i[t]})),E(f),f.value=t;var s=b(f,e);f.value=t,s=b(f,e),f.value="x";var p=f.scrollHeight-r,c=p*n;"border-box"===o&&(c=c+r+a),s=Math.max(c,s);var m=p*l;return"border-box"===o&&(m=m+r+a),[s=Math.min(m,s),p]}(t,e.value||e.placeholder||"x",a,r),i=n[0],o=n[1];P.current!==i&&(P.current=i,e.style.setProperty("height",i+"px","important"),d(i,{rowHeight:o}))}};return s.useLayoutEffect(S),g(window,"resize",S),n=S,g(document.fonts,"loadingdone",n),s.createElement("textarea",(0,c.Z)({},u,{onChange:function(e){k||S(),o(e)},ref:w}))},x=s.forwardRef(k),w=n(9041),P=n(9265),O=n.n(P),S=n(5108),B=n(9333),L=n.n(B),F=n(4152),V=n(5565),N=n(4051),H=n(1555),R=n(3561),T=n(5005);var G=function(e){(0,a.Z)(c,e);var t,n,s=(t=c,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,l=(0,o.Z)(t);if(n){var r=(0,o.Z)(this).constructor;e=Reflect.construct(l,arguments,r)}else e=l.apply(this,arguments);return(0,i.Z)(this,e)});function c(e){var t;return(0,l.Z)(this,c),(t=s.call(this,e)).state={element:t.props.element,data:t.props.data,dirty:!1},t}return(0,r.Z)(c,[{key:"_setValue",value:function(e){return e.replace(/[^A-Z0-9]+/gi,"_").toLowerCase()}},{key:"editOption",value:function(e,t){var n=this.state.element,l=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=l,this.setState({element:n,dirty:!0})}},{key:"editValue",value:function(e,t){var n=this.state.element,l=""===t.target.value?this._setValue(n.options[e].text):t.target.value;n.options[e].value=l,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),p().createElement("div",{className:"dynamic-option-list"},p().createElement("ul",null,p().createElement("li",null,p().createElement(N.Z,null,p().createElement(H.Z,{sm:6},p().createElement("b",null,p().createElement(F.Z,{id:"options"}))),this.props.canHaveOptionValue&&p().createElement(H.Z,{sm:2},p().createElement("b",null,p().createElement(F.Z,{id:"value"}))),this.props.canHaveOptionValue&&this.props.canHaveOptionCorrect&&p().createElement(H.Z,{sm:4},p().createElement("b",null,p().createElement(F.Z,{id:"correct"}))))),this.props.element.options.map((function(t,n){var l="edit_".concat(t.key),r=t.value!==e._setValue(t.text)?t.value:"";return p().createElement("li",{className:"clearfix",key:l},p().createElement(N.Z,null,p().createElement(H.Z,{sm:6},p().createElement(R.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&&p().createElement(H.Z,{sm:2},p().createElement(R.Z.Control,{type:"text",name:"value_".concat(n),value:r,onChange:e.editValue.bind(e,n)})),e.props.canHaveOptionValue&&e.props.canHaveOptionCorrect&&p().createElement(H.Z,{sm:1},p().createElement(R.Z.Check,{type:"checkbox",value:"1",onChange:e.editOptionCorrect.bind(e,n),checked:t.hasOwnProperty("correct")})),p().createElement(H.Z,{sm:3},p().createElement("div",{className:"dynamic-options-actions-buttons"},p().createElement(T.Z,{variant:"success",onClick:e.addOption.bind(e,n)},p().createElement(V.EIY,null)),n>0&&p().createElement(T.Z,{variant:"danger",onClick:e.removeOption.bind(e,n)},p().createElement(V.wbB,null))))))}))))}}]),c}(p().Component),z=n(2083);var M={options:["inline","list","textAlign","fontSize","link","history"],inline:{inDropdown:!1,className:void 0,options:["bold","italic","underline","superscript","subscript"]}},A=function(e){(0,a.Z)(c,e);var t,n,s=(t=c,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,l=(0,o.Z)(t);if(n){var r=(0,o.Z)(this).constructor;e=Reflect.construct(l,arguments,r)}else e=l.apply(this,arguments);return(0,i.Z)(this,e)});function c(e){var t;return(0,l.Z)(this,c),(t=s.call(this,e)).state={element:t.props.element,data:t.props.data,dirty:!1},t}return(0,r.Z)(c,[{key:"toggleRequired",value:function(){}},{key:"editElementProp",value:function(e,t,n){var l=this,r=this.state.element;r[e]=n.target[t],this.setState({element:r,dirty:!0},(function(){"checked"===t&&l.updateElement()}))}},{key:"onEditorStateChange",value:function(e,t,n){var l=O()((0,w.convertToRaw)(n.getCurrentContent())).replace(/<p>/g,"").replace(/<\/p>/g,"").replace(/ /g," ").replace(/(?:\r\n|\r|\n)/g,""),r=this.state.element;r[t]=l,this.setState({element:r,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,w.convertFromHTML)(e);if(!t.contentBlocks||!t.contentBlocks.length)return w.EditorState.createEmpty();var n=w.ContentState.createFromBlockArray(t);return w.EditorState.createWithContent(n)}},{key:"addOptions",value:function(){var e=this,t=document.getElementById("optionsApiUrl").value;t&&(0,z.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 l=e.state.element;e.setState({element:l,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,l=!!this.props.element.hasOwnProperty("defaultChecked")&&this.props.element.defaultChecked,r=!!this.props.element.hasOwnProperty("readOnly")&&this.props.element.readOnly,a=!!this.props.element.hasOwnProperty("defaultToday")&&this.props.element.defaultToday,i=(!!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),o=!!this.props.element.hasOwnProperty("bold")&&this.props.element.bold,s=!!this.props.element.hasOwnProperty("italic")&&this.props.element.italic,c=!!this.props.element.hasOwnProperty("center")&&this.props.element.center,m=!!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,E=h.canHaveAlternateForm,f=h.canHaveDisplayHorizontal,b=h.canHaveOptionCorrect,v=h.canHaveOptionValue,y="Image"===this.state.element.element||"Camera"===this.state.element.element,Z=this.props.files.length?this.props.files:[];return(Z.length<1||Z.length>0&&""!==Z[0].id)&&Z.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)),p().createElement("div",null,p().createElement("div",{className:"clearfix"},p().createElement("h4",{className:"float-start"},this.props.element.text),p().createElement(V.aHS,{className:"float-end dismiss-edit",onClick:this.props.manualEditModeOff})),this.props.element.hasOwnProperty("content")&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,null,p().createElement(F.Z,{id:"text-to-display"}),":"),p().createElement(S.Editor,{toolbar:M,defaultEditorState:e,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"content"),stripPastedStyles:!0})),this.props.element.hasOwnProperty("filePath")&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"fileSelect"},p().createElement(F.Z,{id:"choose-file"}),":"),p().createElement(R.Z.Select,{id:"fileSelect",defaultValue:this.props.element.filePath,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"filePath","value")},Z.map((function(e){var t="file_".concat(e.id);return p().createElement("option",{value:e.id,key:t},e.file_name)})))),this.props.element.hasOwnProperty("href")&&p().createElement(R.Z.Group,null,p().createElement(x,{type:"text",className:"form-control",defaultValue:this.props.element.href,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"href","value")})),this.props.element.hasOwnProperty("label")&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,null,p().createElement(F.Z,{id:"display-label"})),p().createElement(S.Editor,{toolbar:M,defaultEditorState:e,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"label"),stripPastedStyles:!0}),p().createElement("br",null),p().createElement(R.Z.Check,{id:"is-required",label:p().createElement(F.Z,{id:"required"}),type:"checkbox",checked:n,value:!0,onChange:this.editElementProp.bind(this,"required","checked")}),this.props.element.hasOwnProperty("readOnly")&&p().createElement(R.Z.Check,{id:"is-read-only",label:p().createElement(F.Z,{id:"read-only"}),type:"checkbox",checked:r,value:!0,onChange:this.editElementProp.bind(this,"readOnly","checked")}),this.props.element.hasOwnProperty("defaultToday")&&p().createElement(R.Z.Check,{id:"is-default-to-today",label:p().createElement(F.Z,{id:"default-to-today"}),type:"checkbox",checked:a,value:!0,onChange:this.editElementProp.bind(this,"defaultToday","checked")}),-1!==["Checkboxes","Checkbox"].indexOf(this.state.element.element)&&p().createElement(R.Z.Check,{id:"default-checked",label:p().createElement(F.Z,{id:"default-checked"}),type:"checkbox",checked:l,value:!0,onChange:this.editElementProp.bind(this,"defaultChecked","checked")}),("RadioButtons"===this.state.element.element||"Checkboxes"===this.state.element.element)&&f&&p().createElement(R.Z.Check,{id:"display-horizontal",label:p().createElement(F.Z,{id:"display-horizontal"}),type:"checkbox",checked:i,value:!0,onChange:this.editElementProp.bind(this,"inline","checked")})),"Checkbox"===this.state.element.element&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,null,p().createElement(F.Z,{id:"checkbox-label-text"}),":"),p().createElement(S.Editor,{toolbar:M,defaultEditorState:t,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"boxLabel"),stripPastedStyles:!0})),this.props.element.hasOwnProperty("src")&&p().createElement("div",null,p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"srcInput"},p().createElement(F.Z,{id:"link-to"}),":"),p().createElement(R.Z.Control,{id:"srcInput",type:"text",defaultValue:this.props.element.src,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"src","value")}))),y&&p().createElement("div",null,p().createElement(R.Z.Group,null,p().createElement(R.Z.Check,{id:"do-center",label:p().createElement(F.Z,{id:"center"}),type:"checkbox",checked:c,value:!0,onChange:this.editElementProp.bind(this,"center","checked")})),p().createElement(N.Z,null,p().createElement(H.Z,{sm:3},p().createElement(R.Z.Label,{htmlFor:"elementWidth"},p().createElement(F.Z,{id:"width"}),":"),p().createElement(R.Z.Control,{id:"elementWidth",type:"text",defaultValue:this.props.element.width,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"width","value")})),p().createElement(H.Z,{sm:3},p().createElement(R.Z.Label,{htmlFor:"elementHeight"},p().createElement(F.Z,{id:"height"}),":"),p().createElement(R.Z.Control,{id:"elementHeight",type:"text",defaultValue:this.props.element.height,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"height","value")})))),"FileUpload"===this.state.element.element&&p().createElement("div",null,p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{className:"control-label",htmlFor:"fileType"},p().createElement(F.Z,{id:"choose-file-type"}),":"),p().createElement(R.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 p().createElement("option",{value:e.type,key:t},e.typeName)}))))),u&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,null,p().createElement(F.Z,{id:"print-options"})),p().createElement(R.Z.Check,{id:"page-break-before-element",label:p().createElement(F.Z,{id:"page-break-before-element"}),type:"checkbox",checked:m,value:!0,onChange:this.editElementProp.bind(this,"pageBreakBefore","checked")})),E&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,null,p().createElement(F.Z,{id:"alternate-signature-page"})),p().createElement(R.Z.Check,{id:"display-on-alternate",label:p().createElement(F.Z,{id:"display-on-alternate-signature-page"}),type:"checkbox",checked:d,value:!0,onChange:this.editElementProp.bind(this,"alternateForm","checked")})),this.props.element.hasOwnProperty("step")&&p().createElement(R.Z.Group,null,p().createElement("div",{className:"form-group-range"},p().createElement(R.Z.Label,{htmlFor:"rangeStep"},p().createElement(F.Z,{id:"step"})),p().createElement(R.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")&&p().createElement(R.Z.Group,null,p().createElement("div",{className:"form-group-range"},p().createElement(R.Z.Label,{htmlFor:"rangeMin"},p().createElement(F.Z,{id:"min"})),p().createElement(R.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")&&p().createElement(R.Z.Group,null,p().createElement("div",{className:"form-group-range"},p().createElement(R.Z.Label,{htmlFor:"rangeMin"},p().createElement(F.Z,{id:"min-label"})),p().createElement(R.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")&&p().createElement(R.Z.Group,null,p().createElement("div",{className:"form-group-range"},p().createElement(R.Z.Label,{htmlFor:"rangeMax"},p().createElement(F.Z,{id:"max"})),p().createElement(R.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")&&p().createElement(R.Z.Group,null,p().createElement("div",{className:"form-group-range"},p().createElement(R.Z.Label,{htmlFor:"rangeMax"},p().createElement(F.Z,{id:"max-label"})),p().createElement(R.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")&&p().createElement(R.Z.Group,null,p().createElement("div",{className:"form-group-range"},p().createElement(R.Z.Label,{htmlFor:"defaultSelected"},p().createElement(F.Z,{id:"default-selected"})),p().createElement(R.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&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,null,p().createElement(F.Z,{id:"text-style"})),p().createElement(R.Z.Check,{id:"do-bold",label:p().createElement(F.Z,{id:"bold"}),type:"checkbox",checked:o,value:!0,onChange:this.editElementProp.bind(this,"bold","checked")}),p().createElement(R.Z.Check,{id:"do-italic",label:p().createElement(F.Z,{id:"italic"}),type:"checkbox",checked:s,value:!0,onChange:this.editElementProp.bind(this,"italic","checked")})),this.props.element.showPlaceholder&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"placeholder"},p().createElement(F.Z,{id:"place-holder-text-label"})),p().createElement(R.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&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"customName"},p().createElement(F.Z,{id:"custom-name-label"})),p().createElement(R.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.showHelp&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"help"},p().createElement(F.Z,{id:"help-label"})),p().createElement(x,{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&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"questionDescription"},p().createElement(F.Z,{id:"description"})),p().createElement(x,{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")&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"correctAnswer"},p().createElement(F.Z,{id:"correct-answer"})),p().createElement(R.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")&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"optionsApiUrl"},p().createElement(F.Z,{id:"populate-options-from-api"})),p().createElement(N.Z,null,p().createElement(H.Z,{sm:6},p().createElement(R.Z.Control,{style:{width:"100%"},type:"text",id:"optionsApiUrl",placeholder:"http://localhost:8080/api/optionsdata"})),p().createElement(H.Z,{sm:6},p().createElement(T.Z,{variant:"success",onClick:this.addOptions.bind(this)},p().createElement(F.Z,{id:"populate"}))))),this.props.element.hasOwnProperty("options")&&p().createElement(G,{showCorrectColumn:this.props.showCorrectColumn,canHaveOptionCorrect:b,canHaveOptionValue:v,data:this.props.preview.state.data,updateElement:this.props.updateElement,preview:this.props.preview,element:this.props.element,key:this.props.element.options.length}))}}]),c}(p().Component);A.defaultProps={className:"edit-element-fields"}}}]);
|
1
|
+
"use strict";(self.webpackChunkReactSurveyBuilder=self.webpackChunkReactSurveyBuilder||[]).push([[967],{7967:(e,t,n)=>{n.r(t),n.d(t,{default:()=>M});var l=n(5671),r=n(3144),a=n(136),i=n(2963),o=n(1120),s=n(359),p=n.n(s),c=n(7462),m=n(3366),d=n(3469),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"},E=function(e){Object.keys(u).forEach((function(t){e.style.setProperty(t,u[t],"important")}))},f=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"],Z=!!document.documentElement.currentStyle;function g(e,t,n){var l,r,a=(l=n,r=s.useRef(l),(0,d.Z)((function(){r.current=l})),r);s.useLayoutEffect((function(){var n=function(e){return a.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}}),[])}var C=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],k=function(e,t){var n,l=e.cacheMeasurements,r=e.maxRows,a=e.minRows,i=e.onChange,o=void 0===i?v:i,p=e.onHeightChange,d=void 0===p?v:p,u=(0,m.Z)(e,C),k=void 0!==u.value,x=s.useRef(null),w=function(e,t){var n=(0,s.useRef)();return(0,s.useCallback)((function(l){e.current=l,n.current&&h(n.current,null),n.current=t,t&&h(t,l)}),[t])}(x,t),P=s.useRef(0),O=s.useRef(),S=function(){var e=x.current,t=l&&O.current?O.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n,l=(n=t,y.reduce((function(e,t){return e[t]=n[t],e}),{})),r=l.boxSizing;return""===r?null:(Z&&"border-box"===r&&(l.width=parseFloat(l.width)+parseFloat(l.borderRightWidth)+parseFloat(l.borderLeftWidth)+parseFloat(l.paddingRight)+parseFloat(l.paddingLeft)+"px"),{sizingStyle:l,paddingSize:parseFloat(l.paddingBottom)+parseFloat(l.paddingTop),borderSize:parseFloat(l.borderBottomWidth)+parseFloat(l.borderTopWidth)})}(e);if(t){O.current=t;var n=function(e,t,n,l){void 0===n&&(n=1),void 0===l&&(l=1/0),f||((f=document.createElement("textarea")).setAttribute("tabindex","-1"),f.setAttribute("aria-hidden","true"),E(f)),null===f.parentNode&&document.body.appendChild(f);var r=e.paddingSize,a=e.borderSize,i=e.sizingStyle,o=i.boxSizing;Object.keys(i).forEach((function(e){var t=e;f.style[t]=i[t]})),E(f),f.value=t;var s=b(f,e);f.value=t,s=b(f,e),f.value="x";var p=f.scrollHeight-r,c=p*n;"border-box"===o&&(c=c+r+a),s=Math.max(c,s);var m=p*l;return"border-box"===o&&(m=m+r+a),[s=Math.min(m,s),p]}(t,e.value||e.placeholder||"x",a,r),i=n[0],o=n[1];P.current!==i&&(P.current=i,e.style.setProperty("height",i+"px","important"),d(i,{rowHeight:o}))}};return s.useLayoutEffect(S),g(window,"resize",S),n=S,g(document.fonts,"loadingdone",n),s.createElement("textarea",(0,c.Z)({},u,{onChange:function(e){k||S(),o(e)},ref:w}))},x=s.forwardRef(k),w=n(9041),P=n(9265),O=n.n(P),S=n(5108),L=n(9333),B=n.n(L),F=n(4152),V=n(5565),N=n(4051),H=n(1555),R=n(3561),T=n(5005);var G=function(e){(0,a.Z)(c,e);var t,n,s=(t=c,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,l=(0,o.Z)(t);if(n){var r=(0,o.Z)(this).constructor;e=Reflect.construct(l,arguments,r)}else e=l.apply(this,arguments);return(0,i.Z)(this,e)});function c(e){var t;return(0,l.Z)(this,c),(t=s.call(this,e)).state={element:t.props.element,data:t.props.data,dirty:!1},t}return(0,r.Z)(c,[{key:"_setValue",value:function(e){return e.replace(/[^A-Z0-9]+/gi,"_").toLowerCase()}},{key:"editOption",value:function(e,t){var n=this.state.element,l=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=l,this.setState({element:n,dirty:!0})}},{key:"editValue",value:function(e,t){var n=this.state.element,l=""===t.target.value?this._setValue(n.options[e].text):t.target.value;n.options[e].value=l,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:B().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),p().createElement("div",{className:"dynamic-option-list"},p().createElement("ul",null,p().createElement("li",null,p().createElement(N.Z,null,p().createElement(H.Z,{sm:6},p().createElement("b",null,p().createElement(F.Z,{id:"options"}))),this.props.canHaveOptionValue&&p().createElement(H.Z,{sm:2},p().createElement("b",null,p().createElement(F.Z,{id:"value"}))),this.props.canHaveOptionValue&&this.props.canHaveOptionCorrect&&p().createElement(H.Z,{sm:4},p().createElement("b",null,p().createElement(F.Z,{id:"correct"}))))),this.props.element.options.map((function(t,n){var l="edit_".concat(t.key),r=t.value!==e._setValue(t.text)?t.value:"";return p().createElement("li",{className:"clearfix",key:l},p().createElement(N.Z,null,p().createElement(H.Z,{sm:6},p().createElement(R.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&&p().createElement(H.Z,{sm:2},p().createElement(R.Z.Control,{type:"text",name:"value_".concat(n),value:r,onChange:e.editValue.bind(e,n)})),e.props.canHaveOptionValue&&e.props.canHaveOptionCorrect&&p().createElement(H.Z,{sm:1},p().createElement(R.Z.Check,{type:"checkbox",value:"1",onChange:e.editOptionCorrect.bind(e,n),checked:t.hasOwnProperty("correct")})),p().createElement(H.Z,{sm:3},p().createElement("div",{className:"dynamic-options-actions-buttons"},p().createElement(T.Z,{variant:"success",onClick:e.addOption.bind(e,n)},p().createElement(V.EIY,null)),n>0&&p().createElement(T.Z,{variant:"danger",onClick:e.removeOption.bind(e,n)},p().createElement(V.wbB,null))))))}))))}}]),c}(p().Component),z=n(2083);var A={options:["inline","list","textAlign","fontSize","link","history"],inline:{inDropdown:!1,className:void 0,options:["bold","italic","underline","superscript","subscript"]}},M=function(e){(0,a.Z)(c,e);var t,n,s=(t=c,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,l=(0,o.Z)(t);if(n){var r=(0,o.Z)(this).constructor;e=Reflect.construct(l,arguments,r)}else e=l.apply(this,arguments);return(0,i.Z)(this,e)});function c(e){var t;return(0,l.Z)(this,c),(t=s.call(this,e)).state={element:t.props.element,data:t.props.data,dirty:!1},t}return(0,r.Z)(c,[{key:"toggleRequired",value:function(){}},{key:"editElementProp",value:function(e,t,n){var l=this,r=this.state.element;r[e]=n.target[t],this.setState({element:r,dirty:!0},(function(){"checked"===t&&l.updateElement()}))}},{key:"onEditorStateChange",value:function(e,t,n){var l=O()((0,w.convertToRaw)(n.getCurrentContent())).replace(/<p>/g,"").replace(/<\/p>/g,"").replace(/ /g," ").replace(/(?:\r\n|\r|\n)/g,""),r=this.state.element;r[t]=l,this.setState({element:r,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,w.convertFromHTML)(e);if(!t.contentBlocks||!t.contentBlocks.length)return w.EditorState.createEmpty();var n=w.ContentState.createFromBlockArray(t);return w.EditorState.createWithContent(n)}},{key:"addOptions",value:function(){var e=this,t=document.getElementById("optionsApiUrl").value;t&&(0,z.U)(t).then((function(t){e.props.element.options=[];var n=e.props.element.options;t.forEach((function(e){e.key=B().uuid(),n.push(e)}));var l=e.state.element;e.setState({element:l,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,l=!!this.props.element.hasOwnProperty("defaultChecked")&&this.props.element.defaultChecked,r=!!this.props.element.hasOwnProperty("readOnly")&&this.props.element.readOnly,a=!!this.props.element.hasOwnProperty("defaultToday")&&this.props.element.defaultToday,i=(!!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),o=!!this.props.element.hasOwnProperty("bold")&&this.props.element.bold,s=!!this.props.element.hasOwnProperty("italic")&&this.props.element.italic,c=!!this.props.element.hasOwnProperty("center")&&this.props.element.center,m=!!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,E=h.canHaveAlternateForm,f=h.canHaveDisplayHorizontal,b=h.canHaveOptionCorrect,v=h.canHaveOptionValue,y="Image"===this.state.element.element||"Camera"===this.state.element.element,Z=this.props.files.length?this.props.files:[];return(Z.length<1||Z.length>0&&""!==Z[0].id)&&Z.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)),p().createElement("div",null,p().createElement("div",{className:"clearfix"},p().createElement("h4",{className:"float-start"},this.props.element.text),p().createElement(V.aHS,{className:"float-end dismiss-edit",onClick:this.props.manualEditModeOff})),this.props.element.hasOwnProperty("content")&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,null,p().createElement(F.Z,{id:"text-to-display"}),":"),p().createElement(S.Editor,{toolbar:A,defaultEditorState:e,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"content"),stripPastedStyles:!0})),this.props.element.hasOwnProperty("filePath")&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"fileSelect"},p().createElement(F.Z,{id:"choose-file"}),":"),p().createElement(R.Z.Select,{id:"fileSelect",defaultValue:this.props.element.filePath,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"filePath","value")},Z.map((function(e){var t="file_".concat(e.id);return p().createElement("option",{value:e.id,key:t},e.file_name)})))),this.props.element.hasOwnProperty("href")&&p().createElement(R.Z.Group,null,p().createElement(x,{type:"text",className:"form-control",defaultValue:this.props.element.href,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"href","value")})),this.props.element.hasOwnProperty("label")&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,null,p().createElement(F.Z,{id:"display-label"})),p().createElement(S.Editor,{toolbar:A,defaultEditorState:e,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"label"),stripPastedStyles:!0}),p().createElement("br",null),p().createElement(R.Z.Check,{id:"is-required",label:p().createElement(F.Z,{id:"required"}),type:"checkbox",checked:n,value:!0,onChange:this.editElementProp.bind(this,"required","checked")}),this.props.element.hasOwnProperty("readOnly")&&p().createElement(R.Z.Check,{id:"is-read-only",label:p().createElement(F.Z,{id:"read-only"}),type:"checkbox",checked:r,value:!0,onChange:this.editElementProp.bind(this,"readOnly","checked")}),this.props.element.hasOwnProperty("defaultToday")&&p().createElement(R.Z.Check,{id:"is-default-to-today",label:p().createElement(F.Z,{id:"default-to-today"}),type:"checkbox",checked:a,value:!0,onChange:this.editElementProp.bind(this,"defaultToday","checked")}),-1!==["Checkboxes","Checkbox"].indexOf(this.state.element.element)&&p().createElement(R.Z.Check,{id:"default-checked",label:p().createElement(F.Z,{id:"default-checked"}),type:"checkbox",checked:l,value:!0,onChange:this.editElementProp.bind(this,"defaultChecked","checked")}),("RadioButtons"===this.state.element.element||"Checkboxes"===this.state.element.element)&&f&&p().createElement(R.Z.Check,{id:"display-horizontal",label:p().createElement(F.Z,{id:"display-horizontal"}),type:"checkbox",checked:i,value:!0,onChange:this.editElementProp.bind(this,"inline","checked")})),"Checkbox"===this.state.element.element&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,null,p().createElement(F.Z,{id:"checkbox-label-text"}),":"),p().createElement(S.Editor,{toolbar:A,defaultEditorState:t,onBlur:this.updateElement.bind(this),onEditorStateChange:this.onEditorStateChange.bind(this,0,"boxLabel"),stripPastedStyles:!0})),this.props.element.hasOwnProperty("src")&&p().createElement("div",null,p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"srcInput"},p().createElement(F.Z,{id:"link-to"}),":"),p().createElement(R.Z.Control,{id:"srcInput",type:"text",defaultValue:this.props.element.src,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"src","value")}))),y&&p().createElement("div",null,p().createElement(R.Z.Group,null,p().createElement(R.Z.Check,{id:"do-center",label:p().createElement(F.Z,{id:"center"}),type:"checkbox",checked:c,value:!0,onChange:this.editElementProp.bind(this,"center","checked")})),p().createElement(N.Z,null,p().createElement(H.Z,{sm:3},p().createElement(R.Z.Label,{htmlFor:"elementWidth"},p().createElement(F.Z,{id:"width"}),":"),p().createElement(R.Z.Control,{id:"elementWidth",type:"text",defaultValue:this.props.element.width,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"width","value")})),p().createElement(H.Z,{sm:3},p().createElement(R.Z.Label,{htmlFor:"elementHeight"},p().createElement(F.Z,{id:"height"}),":"),p().createElement(R.Z.Control,{id:"elementHeight",type:"text",defaultValue:this.props.element.height,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"height","value")})))),"FileUpload"===this.state.element.element&&p().createElement("div",null,p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{className:"control-label",htmlFor:"fileType"},p().createElement(F.Z,{id:"choose-file-type"}),":"),p().createElement(R.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 p().createElement("option",{value:e.type,key:t},e.typeName)}))))),u&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,null,p().createElement(F.Z,{id:"print-options"})),p().createElement(R.Z.Check,{id:"page-break-before-element",label:p().createElement(F.Z,{id:"page-break-before-element"}),type:"checkbox",checked:m,value:!0,onChange:this.editElementProp.bind(this,"pageBreakBefore","checked")})),E&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,null,p().createElement(F.Z,{id:"alternate-signature-page"})),p().createElement(R.Z.Check,{id:"display-on-alternate",label:p().createElement(F.Z,{id:"display-on-alternate-signature-page"}),type:"checkbox",checked:d,value:!0,onChange:this.editElementProp.bind(this,"alternateForm","checked")})),this.props.element.hasOwnProperty("step")&&p().createElement(R.Z.Group,null,p().createElement("div",{className:"form-group-range"},p().createElement(R.Z.Label,{htmlFor:"rangeStep"},p().createElement(F.Z,{id:"step"})),p().createElement(R.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")&&p().createElement(R.Z.Group,null,p().createElement("div",{className:"form-group-range"},p().createElement(R.Z.Label,{htmlFor:"rangeMin"},p().createElement(F.Z,{id:"min"})),p().createElement(R.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")&&p().createElement(R.Z.Group,null,p().createElement("div",{className:"form-group-range"},p().createElement(R.Z.Label,{htmlFor:"rangeMin"},p().createElement(F.Z,{id:"min-label"})),p().createElement(R.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")&&p().createElement(R.Z.Group,null,p().createElement("div",{className:"form-group-range"},p().createElement(R.Z.Label,{htmlFor:"rangeMax"},p().createElement(F.Z,{id:"max"})),p().createElement(R.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")&&p().createElement(R.Z.Group,null,p().createElement("div",{className:"form-group-range"},p().createElement(R.Z.Label,{htmlFor:"rangeMax"},p().createElement(F.Z,{id:"max-label"})),p().createElement(R.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")&&p().createElement(R.Z.Group,null,p().createElement("div",{className:"form-group-range"},p().createElement(R.Z.Label,{htmlFor:"defaultSelected"},p().createElement(F.Z,{id:"default-selected"})),p().createElement(R.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&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,null,p().createElement(F.Z,{id:"text-style"})),p().createElement(R.Z.Check,{id:"do-bold",label:p().createElement(F.Z,{id:"bold"}),type:"checkbox",checked:o,value:!0,onChange:this.editElementProp.bind(this,"bold","checked")}),p().createElement(R.Z.Check,{id:"do-italic",label:p().createElement(F.Z,{id:"italic"}),type:"checkbox",checked:s,value:!0,onChange:this.editElementProp.bind(this,"italic","checked")})),this.props.element.showPlaceholder&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"placeholder"},p().createElement(F.Z,{id:"place-holder-text-label"})),p().createElement(R.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&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"customName"},p().createElement(F.Z,{id:"custom-name-label"})),p().createElement(R.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&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"labelLocation"},p().createElement(F.Z,{id:"choose-label-location"}),":"),p().createElement(R.Z.Select,{id:"labelLocation",defaultValue:this.props.element.labelLocation,onBlur:this.updateElement.bind(this),onChange:this.editElementProp.bind(this,"labelLocation","value")},p().createElement("option",{value:"ABOVE"},"Above Form Field"),p().createElement("option",{value:"FLOATING"},"Floating Inside Form Field"))),this.props.element.showHelp&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"help"},p().createElement(F.Z,{id:"help-label"})),p().createElement(x,{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&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"questionDescription"},p().createElement(F.Z,{id:"description"})),p().createElement(x,{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")&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"correctAnswer"},p().createElement(F.Z,{id:"correct-answer"})),p().createElement(R.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")&&p().createElement(R.Z.Group,null,p().createElement(R.Z.Label,{htmlFor:"optionsApiUrl"},p().createElement(F.Z,{id:"populate-options-from-api"})),p().createElement(N.Z,null,p().createElement(H.Z,{sm:6},p().createElement(R.Z.Control,{style:{width:"100%"},type:"text",id:"optionsApiUrl",placeholder:"http://localhost:8080/api/optionsdata"})),p().createElement(H.Z,{sm:6},p().createElement(T.Z,{variant:"success",onClick:this.addOptions.bind(this)},p().createElement(F.Z,{id:"populate"}))))),this.props.element.hasOwnProperty("options")&&p().createElement(G,{showCorrectColumn:this.props.showCorrectColumn,canHaveOptionCorrect:b,canHaveOptionValue:v,data:this.props.preview.state.data,updateElement:this.props.updateElement,preview:this.props.preview,element:this.props.element,key:this.props.element.options.length}))}}]),c}(p().Component);M.defaultProps={className:"edit-element-fields"}}}]);
|