UNPKG

surveyjs-widgets

Version:

Custom widgets for the SurveyJS library

3 lines 2.57 kB
/*! For license information please see easy-autocomplete.min.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("widgets/easy-autocomplete",[],t):"object"==typeof exports?exports["widgets/easy-autocomplete"]=t():e["widgets/easy-autocomplete"]=t()}(self,(()=>(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function o(e,t){t=t||window.$;var o={name:"autocomplete",widgetIsLoaded:function(){return"function"==typeof t&&!!t.fn.easyAutocomplete},isFit:function(e){return"text"===e.getType()},isDefaultRender:!0,activatedByChanged:function(t){e.Serializer.findProperty("text","choices")||e.Serializer.findProperty("text","choicesByUrl")||(e.Serializer.addProperty("text",{name:"choices:itemvalues",category:"choices",categoryIndex:1}),e.Serializer.addProperty("text",{name:"choicesByUrl:restfull",className:"ChoicesRestfull",category:"choicesByUrl",visible:!1,categoryIndex:2}),e.Serializer.addProperty("text",{name:"config",category:"general",visible:!1}))},afterRender:function(e,o){var r,a=t(o).is("input")?t(o):t(o).find("input"),i=(r=e.cssRoot)?r.replace(/(^\s*)|(\s+)/g,"."):"",n=a.parents(i)[0];i&&n&&(n.style.overflow="visible");var c=e.config,l=c&&"string"==typeof c?JSON.parse(c):c;l||(l={}),l.data=(e.choices||[]).map((function(e){return e.text})),void 0===l.adjustWidth&&(l.adjustWidth=!1),l.list||(l.list={sort:{enabled:!0,method:(e,t)=>{const o=a.val().toLowerCase();return e.toLowerCase().indexOf(o)-t.toLowerCase().indexOf(o)}},match:{enabled:!0},onChooseEvent:function(){var t=a.getSelectedItemData();t&&"object"==typeof t&&e.choicesByUrl&&e.choicesByUrl.valueName&&(t=t[e.choicesByUrl.valueName]),e.value=t}}),l.placeholder||(l.placeholder=e.placeholder),e.choicesByUrl&&(l.url=function(t){return e.choicesByUrl.url},l.getValue=e.choicesByUrl.valueName),a.easyAutocomplete(l),a[0].oninput=function(){e.customWidgetData.isNeedRender=!0};var s=function(){a[0].value=void 0===e.value?"":e.value};e.valueChangedCallback=s,s()},willUnmount:function(e,t){}};e.CustomWidgetCollection.Instance.addCustomWidget(o)}e.r(t),e.d(t,{default:()=>r}),"undefined"!=typeof Survey&&o(Survey,window.jQuery);const r=o;return t})())); //# sourceMappingURL=easy-autocomplete.min.js.map