UNPKG

custom-metrosurvey-widgets

Version:

Custom widgets for the SurveyJS library

7 lines 3.35 kB
/*! * custom-metrosurvey-widgets - Widgets for the SurveyJS library v1.0.27 * Copyright (c) 2015-2022 Devsoft Baltic OÜ - http://surveyjs.io/ * License: MIT (http://www.opensource.org/licenses/mit-license.php) */ !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("widgets/emotionsratings",[],n):"object"==typeof exports?exports["widgets/emotionsratings"]=n():e["widgets/emotionsratings"]=n()}(window,(function(){return function(e){var n={};function t(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var i in e)t.d(o,i,function(n){return e[n]}.bind(null,i));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=19)}({19:function(e,n,t){"use strict";function o(e,n){n=n||window.$;var t={name:"emotionsratings",title:"Emotions Ratings",iconName:"icon-emotionsratings",widgetIsLoaded:function(){return"function"==typeof n&&!!n.fn.emotionsRating},defaultJSON:{choices:[1,2,3,4,5]},isFit:function(e){return"emotionsratings"===e.getType()},isDefaultRender:!1,htmlTemplate:"<div style='height: 33px'></div>",activatedByChanged:function(n){e.JsonObject.metaData.addClass("emotionsratings",[{name:"hasOther",visible:!1},{name:"otherText",visible:!1},{name:"optionsCaption",visible:!1},{name:"otherErrorText",visible:!1},{name:"storeOthersAsComment",visible:!1},{name:"renderAs",visible:!1}],null,"dropdown"),e.JsonObject.metaData.addProperties("emotionsratings",[{name:"emotions:itemvalues",category:"emotions",categoryIndex:1,default:["angry","disappointed","meh","happy","inLove"]},{name:"emotionSize:number",category:"emotions",default:30},{name:"emotionsCount:number",category:"emotions",default:5},{name:"bgEmotion",category:"emotions",default:"happy"},{name:"emotionColor",category:"emotions",default:"#FF0066"}])},afterRender:function(e,t){var o=(e.emotions||[]).map((function(e){return e.value}));0===o.length&&(o=["angry","disappointed","meh","happy","inLove"]);var i={emotionSize:e.emotionSize,bgEmotion:e.bgEmotion,emotions:o,initialRating:e.value,color:e.emotionColor,count:e.emotionsCount,onUpdate:function(n){e.value=n}};function a(){t.innerHTML="<div></div>",n(t).off(),i.initialRating=e.value||0,i.disabled=e.isReadOnly,n(t).find("div").emotionsRating(i)}a(),e.valueChangedCallback=a,e.readOnlyChangedCallback=a},willUnmount:function(e,t){t.innerHTML=null,n(t).off(),e.readOnlyChangedCallback=null,e.valueChangedCallback=null},pdfQuestionType:"dropdown"};e.CustomWidgetCollection.Instance.addCustomWidget(t,"customtype")}t.r(n),"undefined"!=typeof Survey&&o(Survey,window.$),n.default=o}})})); //# sourceMappingURL=emotionsratings.min.js.map