UNPKG

primevue

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primevue.svg)](https://badge.fury.io/js/primevue)

1 lines 8.01 kB
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["inputswitch"]=t(require("vue")):e["inputswitch"]=t(e["Vue"])})("undefined"!==typeof self?self:this,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({"24fb":function(e,t,n){"use strict";function r(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"===typeof btoa){var i=o(r),c=r.sources.map((function(e){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(e," */")}));return[n].concat(c).concat([i]).join("\n")}return[n].join("\n")}function o(e){var t=btoa(unescape(encodeURIComponent(JSON.stringify(e)))),n="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(t);return"/*# ".concat(n," */")}e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=r(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"===typeof e&&(e=[[null,e,""]]);var o={};if(r)for(var i=0;i<this.length;i++){var c=this[i][0];null!=c&&(o[c]=!0)}for(var u=0;u<e.length;u++){var s=[].concat(e[u]);r&&o[s[0]]||(n&&(s[2]?s[2]="".concat(n," and ").concat(s[2]):s[2]=n),t.push(s))}},t}},"499e":function(e,t,n){"use strict";function r(e,t){for(var n=[],r={},o=0;o<t.length;o++){var i=t[o],c=i[0],u=i[1],s=i[2],a=i[3],l={id:e+":"+o,css:u,media:s,sourceMap:a};r[c]?r[c].parts.push(l):n.push(r[c]={id:c,parts:[l]})}return n}n.r(t),n.d(t,"default",(function(){return h}));var o="undefined"!==typeof document;if("undefined"!==typeof DEBUG&&DEBUG&&!o)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var i={},c=o&&(document.head||document.getElementsByTagName("head")[0]),u=null,s=0,a=!1,l=function(){},f=null,d="data-vue-ssr-id",p="undefined"!==typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function h(e,t,n,o){a=n,f=o||{};var c=r(e,t);return m(c),function(t){for(var n=[],o=0;o<c.length;o++){var u=c[o],s=i[u.id];s.refs--,n.push(s)}t?(c=r(e,t),m(c)):c=[];for(o=0;o<n.length;o++){s=n[o];if(0===s.refs){for(var a=0;a<s.parts.length;a++)s.parts[a]();delete i[s.id]}}}}function m(e){for(var t=0;t<e.length;t++){var n=e[t],r=i[n.id];if(r){r.refs++;for(var o=0;o<r.parts.length;o++)r.parts[o](n.parts[o]);for(;o<n.parts.length;o++)r.parts.push(b(n.parts[o]));r.parts.length>n.parts.length&&(r.parts.length=n.parts.length)}else{var c=[];for(o=0;o<n.parts.length;o++)c.push(b(n.parts[o]));i[n.id]={id:n.id,refs:1,parts:c}}}}function v(){var e=document.createElement("style");return e.type="text/css",c.appendChild(e),e}function b(e){var t,n,r=document.querySelector("style["+d+'~="'+e.id+'"]');if(r){if(a)return l;r.parentNode.removeChild(r)}if(p){var o=s++;r=u||(u=v()),t=g.bind(null,r,o,!1),n=g.bind(null,r,o,!0)}else r=v(),t=j.bind(null,r),n=function(){r.parentNode.removeChild(r)};return t(e),function(r){if(r){if(r.css===e.css&&r.media===e.media&&r.sourceMap===e.sourceMap)return;t(e=r)}else n()}}var y=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}();function g(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=y(t,o);else{var i=document.createTextNode(o),c=e.childNodes;c[t]&&e.removeChild(c[t]),c.length?e.insertBefore(i,c[t]):e.appendChild(i)}}function j(e,t){var n=t.css,r=t.media,o=t.sourceMap;if(r&&e.setAttribute("media",r),f.ssrId&&e.setAttribute(d,t.id),o&&(n+="\n/*# sourceURL="+o.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),e.styleSheet)e.styleSheet.cssText=n;else{while(e.firstChild)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}},8875:function(e,t,n){var r,o,i;(function(n,c){o=[],r=c,i="function"===typeof r?r.apply(t,o):r,void 0===i||(e.exports=i)})("undefined"!==typeof self&&self,(function(){function e(){var t=Object.getOwnPropertyDescriptor(document,"currentScript");if(!t&&"currentScript"in document&&document.currentScript)return document.currentScript;if(t&&t.get!==e&&document.currentScript)return document.currentScript;try{throw new Error}catch(p){var n,r,o,i=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,c=/@([^@]*):(\d+):(\d+)\s*$/gi,u=i.exec(p.stack)||c.exec(p.stack),s=u&&u[1]||!1,a=u&&u[2]||!1,l=document.location.href.replace(document.location.hash,""),f=document.getElementsByTagName("script");s===l&&(n=document.documentElement.outerHTML,r=new RegExp("(?:[^\\n]+?\\n){0,"+(a-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),o=n.replace(r,"$1").trim());for(var d=0;d<f.length;d++){if("interactive"===f[d].readyState)return f[d];if(f[d].src===s)return f[d];if(s===l&&f[d].innerHTML&&f[d].innerHTML.trim()===o)return f[d]}return null}}return e}))},"8bbf":function(t,n){t.exports=e},e1c9:function(e,t,n){"use strict";n("f12a")},e853:function(e,t,n){var r=n("24fb");t=r(!1),t.push([e.i,'.p-inputswitch{position:relative;display:inline-block}.p-inputswitch-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0}.p-inputswitch-slider:before{position:absolute;content:"";top:50%}',""]),e.exports=t},f12a:function(e,t,n){var r=n("e853");"string"===typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);var o=n("499e").default;o("223f43e1",r,!0,{sourceMap:!1,shadowMode:!1})},fb15:function(e,t,n){"use strict";if(n.r(t),"undefined"!==typeof window){var r=window.document.currentScript,o=n("8875");r=o(),"currentScript"in document||Object.defineProperty(document,"currentScript",{get:o});var i=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}var c=n("8bbf"),u={class:"p-hidden-accessible"},s=Object(c["createVNode"])("span",{class:"p-inputswitch-slider"},null,-1);function a(e,t,n,r,o,i){return Object(c["openBlock"])(),Object(c["createBlock"])("div",{class:i.containerClass,onClick:t[4]||(t[4]=function(e){return i.onClick(e)}),style:n.style},[Object(c["createVNode"])("div",u,[Object(c["createVNode"])("input",Object(c["mergeProps"])({ref:"input",type:"checkbox",checked:n.modelValue},e.$attrs,{onFocus:t[1]||(t[1]=function(e){return i.onFocus(e)}),onBlur:t[2]||(t[2]=function(e){return i.onBlur(e)}),onKeydown:t[3]||(t[3]=Object(c["withKeys"])(Object(c["withModifiers"])((function(e){return i.onClick(e)}),["prevent"]),["enter"])),role:"switch","aria-checked":n.modelValue}),null,16,["checked","aria-checked"])]),s],6)}var l={inheritAttrs:!1,emits:["update:modelValue","click","change"],props:{modelValue:Boolean,class:null,style:null},data:function(){return{focused:!1}},methods:{onClick:function(e){this.$attrs.disabled||(this.$emit("click",e),this.$emit("update:modelValue",!this.modelValue),this.$emit("change",e),this.$refs.input.focus()),e.preventDefault()},onFocus:function(){this.focused=!0},onBlur:function(){this.focused=!1}},computed:{containerClass:function(){return["p-inputswitch p-component",this.class,{"p-inputswitch-checked":this.modelValue,"p-disabled":this.$attrs.disabled,"p-focus":this.focused}]}}};n("e1c9");l.render=a;var f=l;t["default"]=f}})["default"]}));