This repository has been archived by the owner on Sep 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
1 lines (1 loc) · 16.5 KB
/
index.js
1
(()=>{(function(){"use strict";var se=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("k-field",e._b({staticClass:"k-multi-toggle-field"},"k-field",e.$props,!1),[r("k-input",e._g(e._b({ref:"input",attrs:{id:e._uid,type:"multi-toggle"},on:{reset:function(n){return e.onInput("")}}},"k-input",e.$props,!1),e.$listeners))],1)},ge=[],$t="";function Y(e,t,r,n,o,d,m,c){var i=typeof e=="function"?e.options:e;t&&(i.render=t,i.staticRenderFns=r,i._compiled=!0),n&&(i.functional=!0),d&&(i._scopeId="data-v-"+d);var a;if(m?(a=function(_){_=_||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!_&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(_=__VUE_SSR_CONTEXT__),o&&o.call(this,_),_&&_._registeredComponents&&_._registeredComponents.add(m)},i._ssrRegister=a):o&&(a=c?function(){o.call(this,(i.functional?this.parent:this).$root.$options.shadowRoot)}:o),a)if(i.functional){i._injectStyles=a;var s=i.render;i.render=function(J,Z){return a.call(Z),s(J,Z)}}else{var h=i.beforeCreate;i.beforeCreate=h?[].concat(h,a):[a]}return{exports:e,options:i}}const me={props:{label:String,options:Array,textLabels:Boolean,value:String,help:String,disabled:Boolean,required:Boolean,reset:Boolean,equalize:Boolean},methods:{focus(){this.$refs.input.focus()},onInput(e){this.$emit("input",e)}}},K={};var _e=Y(me,se,ge,!1,he,null,null,null);function he(e){for(let t in K)this[t]=K[t]}var pe=function(){return _e.exports}(),k={},b={},l={},$={},g={};Object.defineProperty(g,"__esModule",{value:!0}),g.pushParams=te,g.popParams=re,g.withParams=Oe,g._setTarget=g.target=void 0;function ve(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(o){return Object.getOwnPropertyDescriptor(r,o).enumerable}))),n.forEach(function(o){ye(e,o,r[o])})}return e}function ye(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?v=function(r){return typeof r}:v=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},v(e)}var ee=[],p=null;g.target=p;var be=function(t){g.target=p=t};g._setTarget=be;function te(){p!==null&&ee.push(p),g.target=p={}}function re(){var e=p,t=g.target=p=ee.pop()||null;return t&&(Array.isArray(t.$sub)||(t.$sub=[]),t.$sub.push(e)),e}function $e(e){if(v(e)==="object"&&!Array.isArray(e))g.target=p=ve({},p,e);else throw new Error("params must be an object")}function Pe(e,t){return ne(function(r){return function(){r(e);for(var n=arguments.length,o=new Array(n),d=0;d<n;d++)o[d]=arguments[d];return t.apply(this,o)}})}function ne(e){var t=e($e);return function(){te();try{for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.apply(this,n)}finally{re()}}}function Oe(e,t){return v(e)==="object"&&t!==void 0?Pe(e,t):ne(e)}Object.defineProperty($,"__esModule",{value:!0}),$.default=void 0;var we=g.withParams,qe=we;$.default=qe,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"withParams",{enumerable:!0,get:function(){return t.default}}),e.regex=e.ref=e.len=e.req=void 0;var t=r($);function r(i){return i&&i.__esModule?i:{default:i}}function n(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?n=function(s){return typeof s}:n=function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},n(i)}var o=function(a){if(Array.isArray(a))return!!a.length;if(a==null)return!1;if(a===!1)return!0;if(a instanceof Date)return!isNaN(a.getTime());if(n(a)==="object"){for(var s in a)return!0;return!1}return!!String(a).length};e.req=o;var d=function(a){return Array.isArray(a)?a.length:n(a)==="object"?Object.keys(a).length:String(a).length};e.len=d;var m=function(a,s,h){return typeof a=="function"?a.call(s,h):h[a]};e.ref=m;var c=function(a,s){return(0,t.default)({type:a},function(h){return!o(h)||s.test(h)})};e.regex=c}(l),Object.defineProperty(b,"__esModule",{value:!0}),b.default=void 0;var Ae=l,je=(0,Ae.regex)("alpha",/^[a-zA-Z]*$/);b.default=je;var P={};Object.defineProperty(P,"__esModule",{value:!0}),P.default=void 0;var Me=l,xe=(0,Me.regex)("alphaNum",/^[a-zA-Z0-9]*$/);P.default=xe;var O={};Object.defineProperty(O,"__esModule",{value:!0}),O.default=void 0;var Se=l,ze=(0,Se.regex)("numeric",/^[0-9]*$/);O.default=ze;var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.default=void 0;var ae=l,Ve=function(t,r){return(0,ae.withParams)({type:"between",min:t,max:r},function(n){return!(0,ae.req)(n)||(!/\s/.test(n)||n instanceof Date)&&+t<=+n&&+r>=+n})};w.default=Ve;var q={};Object.defineProperty(q,"__esModule",{value:!0}),q.default=void 0;var Ce=l,Le=/^(?:[A-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]{2,}(?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/,Re=(0,Ce.regex)("email",Le);q.default=Re;var A={};Object.defineProperty(A,"__esModule",{value:!0}),A.default=void 0;var ue=l,Te=(0,ue.withParams)({type:"ipAddress"},function(e){if(!(0,ue.req)(e))return!0;if(typeof e!="string")return!1;var t=e.split(".");return t.length===4&&t.every(Ie)});A.default=Te;var Ie=function(t){if(t.length>3||t.length===0||t[0]==="0"&&t!=="0"||!t.match(/^\d+$/))return!1;var r=+t|0;return r>=0&&r<=255},j={};Object.defineProperty(j,"__esModule",{value:!0}),j.default=void 0;var ie=l,Be=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:":";return(0,ie.withParams)({type:"macAddress"},function(r){if(!(0,ie.req)(r))return!0;if(typeof r!="string")return!1;var n=typeof t=="string"&&t!==""?r.split(t):r.length===12||r.length===16?r.match(/.{2}/g):null;return n!==null&&(n.length===6||n.length===8)&&n.every(He)})};j.default=Be;var He=function(t){return t.toLowerCase().match(/^[0-9a-f]{2}$/)},M={};Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var E=l,De=function(t){return(0,E.withParams)({type:"maxLength",max:t},function(r){return!(0,E.req)(r)||(0,E.len)(r)<=t})};M.default=De;var x={};Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var F=l,Ne=function(t){return(0,F.withParams)({type:"minLength",min:t},function(r){return!(0,F.req)(r)||(0,F.len)(r)>=t})};x.default=Ne;var S={};Object.defineProperty(S,"__esModule",{value:!0}),S.default=void 0;var W=l,Ze=(0,W.withParams)({type:"required"},function(e){return typeof e=="string"?(0,W.req)(e.trim()):(0,W.req)(e)});S.default=Ze;var z={};Object.defineProperty(z,"__esModule",{value:!0}),z.default=void 0;var X=l,Ue=function(t){return(0,X.withParams)({type:"requiredIf",prop:t},function(r,n){return(0,X.ref)(t,this,n)?(0,X.req)(r):!0})};z.default=Ue;var V={};Object.defineProperty(V,"__esModule",{value:!0}),V.default=void 0;var G=l,Ee=function(t){return(0,G.withParams)({type:"requiredUnless",prop:t},function(r,n){return(0,G.ref)(t,this,n)?!0:(0,G.req)(r)})};V.default=Ee;var C={};Object.defineProperty(C,"__esModule",{value:!0}),C.default=void 0;var oe=l,Fe=function(t){return(0,oe.withParams)({type:"sameAs",eq:t},function(r,n){return r===(0,oe.ref)(t,this,n)})};C.default=Fe;var L={};Object.defineProperty(L,"__esModule",{value:!0}),L.default=void 0;var We=l,Xe=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:[/?#]\S*)?$/i,Ge=(0,We.regex)("url",Xe);L.default=Ge;var R={};Object.defineProperty(R,"__esModule",{value:!0}),R.default=void 0;var Je=l,Qe=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return(0,Je.withParams)({type:"or"},function(){for(var o=this,d=arguments.length,m=new Array(d),c=0;c<d;c++)m[c]=arguments[c];return r.length>0&&r.reduce(function(i,a){return i||a.apply(o,m)},!1)})};R.default=Qe;var T={};Object.defineProperty(T,"__esModule",{value:!0}),T.default=void 0;var Ye=l,Ke=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return(0,Ye.withParams)({type:"and"},function(){for(var o=this,d=arguments.length,m=new Array(d),c=0;c<d;c++)m[c]=arguments[c];return r.length>0&&r.reduce(function(i,a){return i&&a.apply(o,m)},!0)})};T.default=Ke;var I={};Object.defineProperty(I,"__esModule",{value:!0}),I.default=void 0;var le=l,ke=function(t){return(0,le.withParams)({type:"not"},function(r,n){return!(0,le.req)(r)||!t.call(this,r,n)})};I.default=ke;var B={};Object.defineProperty(B,"__esModule",{value:!0}),B.default=void 0;var fe=l,et=function(t){return(0,fe.withParams)({type:"minValue",min:t},function(r){return!(0,fe.req)(r)||(!/\s/.test(r)||r instanceof Date)&&+r>=+t})};B.default=et;var H={};Object.defineProperty(H,"__esModule",{value:!0}),H.default=void 0;var de=l,tt=function(t){return(0,de.withParams)({type:"maxValue",max:t},function(r){return!(0,de.req)(r)||(!/\s/.test(r)||r instanceof Date)&&+r<=+t})};H.default=tt;var D={};Object.defineProperty(D,"__esModule",{value:!0}),D.default=void 0;var rt=l,nt=(0,rt.regex)("integer",/(^[0-9]*$)|(^-[0-9]+$)/);D.default=nt;var N={};Object.defineProperty(N,"__esModule",{value:!0}),N.default=void 0;var at=l,ut=(0,at.regex)("decimal",/^[-]?\d*(\.\d+)?$/);N.default=ut,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"alpha",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"alphaNum",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"numeric",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"between",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"email",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(e,"ipAddress",{enumerable:!0,get:function(){return m.default}}),Object.defineProperty(e,"macAddress",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"maxLength",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"minLength",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"required",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"requiredIf",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(e,"requiredUnless",{enumerable:!0,get:function(){return _.default}}),Object.defineProperty(e,"sameAs",{enumerable:!0,get:function(){return J.default}}),Object.defineProperty(e,"url",{enumerable:!0,get:function(){return Z.default}}),Object.defineProperty(e,"or",{enumerable:!0,get:function(){return st.default}}),Object.defineProperty(e,"and",{enumerable:!0,get:function(){return gt.default}}),Object.defineProperty(e,"not",{enumerable:!0,get:function(){return mt.default}}),Object.defineProperty(e,"minValue",{enumerable:!0,get:function(){return _t.default}}),Object.defineProperty(e,"maxValue",{enumerable:!0,get:function(){return ht.default}}),Object.defineProperty(e,"integer",{enumerable:!0,get:function(){return pt.default}}),Object.defineProperty(e,"decimal",{enumerable:!0,get:function(){return vt.default}}),e.helpers=void 0;var t=f(b),r=f(P),n=f(O),o=f(w),d=f(q),m=f(A),c=f(j),i=f(M),a=f(x),s=f(S),h=f(z),_=f(V),J=f(C),Z=f(L),st=f(R),gt=f(T),mt=f(I),_t=f(B),ht=f(H),pt=f(D),vt=f(N),yt=bt(l);e.helpers=yt;function bt(u){if(u&&u.__esModule)return u;var U={};if(u!=null){for(var y in u)if(Object.prototype.hasOwnProperty.call(u,y)){var Q=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(u,y):{};Q.get||Q.set?Object.defineProperty(U,y,Q):U[y]=u[y]}}return U.default=u,U}function f(u){return u&&u.__esModule?u:{default:u}}}(k);var it=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{class:{"k-multi-toggle-input":!0,"k-multi-toggle-input--equalize":e.equalize},style:"--options:"+e.options.length,attrs:{"data-show-text-label":e.textLabels?"":!1}},[r("ul",e._l(e.options,function(n,o){return r("li",{key:o},[r("input",{attrs:{id:e.id+"-"+o,name:e.id,type:"radio"},domProps:{value:n.value,checked:e.value===n.value},on:{change:function(d){return e.onInput(n.value)}}}),r("label",{attrs:{for:e.id+"-"+o,title:e.textLabels?null:n.text}},[n.icon?r("k-icon",{attrs:{type:n.icon}}):e._e(),e.textLabels?r("span",{staticClass:"k-multi-toggle-text"},[e._v(" "+e._s(n.text)+" ")]):e._e()],1)])}),0),e.value&&e.reset&&!e.required?r("k-button",{attrs:{tooltip:e.$t("fabianmichael.multi-toggle.reset")},on:{click:function(n){return e.onReset()}}},[r("k-icon",{attrs:{type:"undo"}})],1):e._e()],1)},ot=[],Pt="";const lt={inheritAttrs:!1,props:{autofocus:Boolean,disabled:Boolean,id:{type:[Number,String],default(){return this._uid}},options:Array,required:Boolean,textLabels:Boolean,reset:Boolean,equalize:Boolean,value:[String,Number,Boolean]},watch:{value(){this.onInvalid()}},mounted(){this.onInvalid(),this.$props.autofocus&&this.focus()},methods:{focus(){(this.$el.querySelector("input[checked]")||this.$el.querySelector("input")).focus()},onInput(e){this.$emit("input",e)},onInvalid(){this.$emit("invalid",this.$v.$invalid,this.$v)},select(){this.focus()},onReset(){this.$emit("reset")}},validations(){return{value:{required:this.required?k.required:!0}}}},ce={};var ft=Y(lt,it,ot,!1,dt,null,null,null);function dt(e){for(let t in ce)this[t]=ce[t]}var ct=function(){return ft.exports}();panel.plugin("fabianmichael/multi-toggle-field",{components:{"k-multi-toggle-input":ct},fields:{"multi-toggle":pe},icons:{"align-left":'<rect y="1" width="16" height="2"></rect><rect data-color="color-2" y="5" width="10" height="2"></rect><rect y="9" width="16" height="2"></rect><rect data-color="color-2" y="13" width="10" height="2"></rect>',"align-center":'<rect y="1" width="16" height="2"></rect><rect data-color="color-2" x="3" y="5" width="10" height="2"></rect><rect y="9" width="16" height="2"></rect><rect data-color="color-2" x="3" y="13" width="10" height="2"></rect>',"align-right":'<rect y="1" width="16" height="2"></rect><rect data-color="color-2" x="6" y="5" width="10" height="2"></rect><rect y="9" width="16" height="2"></rect><rect data-color="color-2" x="6" y="13" width="10" height="2"></rect>',"align-justify":'<rect y="1" width="16" height="2"></rect> <rect data-color="color-2" y="5" width="16" height="2"></rect> <rect y="9" width="16" height="2"></rect> <rect data-color="color-2" y="13" width="16" height="2"></rect>',"heading-1":'<polygon points="8 3 6 3 6 7 3 7 3 3 1 3 1 13 3 13 3 9 6 9 6 13 8 13 8 3"></polygon><polygon points="14 13 12 13 12 5.929 10.606 7.124 9.304 5.605 12.345 3 14 3 14 13"></polygon>',"heading-2":'<path d="M16,13H9V11c2-1,5-3.356,5-4.84a1.381,1.381,0,0,0-1.424-1.516,4.6,4.6,0,0,0-2.622,1.02L8.923,3.95a6.24,6.24,0,0,1,3.653-1.306A3.3,3.3,0,0,1,16,6.115C16,7.987,14.08,9.756,12.479,11H16Zm-6-1.5h0Z"></path><polygon points="7 3 5 3 5 7 2 7 2 3 0 3 0 13 2 13 2 9 5 9 5 13 7 13 7 9 7 9 7 7 7 7 7 3"></polygon>',"heading-3":'<path d="M14.7,7.8a2.765,2.765,0,0,0,1-2.2c0-1.826-1.521-3.1-3.7-3.1A6.151,6.151,0,0,0,8.5,3.617l.969,1.731A4.621,4.621,0,0,1,12,4.5c.284,0,1.7.053,1.7,1.1C13.7,6.9,12.017,7,12,7H10.4V9h1C14,9,14,9.828,14,10.1c0,1.263-1.4,1.4-2,1.4a4.721,4.721,0,0,1-2.751-.858L8.285,12.4A6.939,6.939,0,0,0,12,13.5c2.393,0,4-1.366,4-3.4A2.637,2.637,0,0,0,14.7,7.8Z"></path><polygon points="7 3 5 3 5 7 2 7 2 3 0 3 0 13 2 13 2 9 5 9 5 13 7 13 7 9 7 9 7 7 7 7 7 3"></polygon>',"heading-4":'<polygon points="7 3 5 3 5 7 2 7 2 3 0 3 0 13 2 13 2 9 5 9 5 13 7 13 7 9 7 9 7 7 7 7 7 3"></polygon><path d="M15,13H13V11H8V9.143L13.026,3H15V9h1v2H15ZM10.7,9H13V6.19Z"></path>',"heading-5":'<polygon points="7 3 5 3 5 7 2 7 2 3 0 3 0 13 2 13 2 9 5 9 5 13 7 13 7 9 7 9 7 7 7 7 7 3"></polygon><path d="M11.881,13a7.058,7.058,0,0,1-3.1-.93l.877-1.8A4.564,4.564,0,0,0,11.948,11C13.22,11,14,10.432,14,9.518a1.364,1.364,0,0,0-1.537-1.4,18.553,18.553,0,0,0-3.088.308L10.014,3H16V5H11.792l-.14,1.193a5.876,5.876,0,0,1,.8-.071A3.333,3.333,0,0,1,16,9.518C16,11.592,14.3,13.038,11.881,13Z"></path>',"heading-6":'<polygon points="7 3 5 3 5 7 2 7 2 3 0 3 0 13 2 13 2 9 5 9 5 13 7 13 7 9 7 9 7 7 7 7 7 3"></polygon><path d="M12.5,13C10.808,13,9,11.949,9,9c0-4.959,2.719-6,5-6h1V5H14a2.828,2.828,0,0,0-2.853,1.545A1.829,1.829,0,0,1,12.5,6a3.5,3.5,0,0,1,0,7ZM11,9.045C11.015,10.8,11.861,11,12.5,11a1.5,1.5,0,0,0,0-3A1.673,1.673,0,0,0,11,9.045Z"></path>'}})})();})();