-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
1 lines (1 loc) · 2.39 KB
/
index.js
1
(function(){"use strict";var f=function(){var e=this,r=e.$createElement,s=e._self._c||r;return s("k-field",{staticClass:"k-colors-field",attrs:{help:e.help,label:e.label,disabled:e.disabled,required:e.required}},[s("div",{staticClass:"k-colors-field"},[s("div",{staticClass:"k-colors-container"},e._l(e.options,function(n,o){return s("button",{key:n.hex,staticClass:"k-colors-item",attrs:{type:"button"},on:{click:function(l){return l.preventDefault(),e.action_click(n)}}},[s("div",{staticClass:"k-colors-block",style:{"background-color":"#"+n.hex}},[n.hex===e.value.hex?s("svg",{staticClass:"k-colors-icon",class:e.action_color(n.hex)?"dark":"light",attrs:{viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"}},[s("path",{attrs:{d:"M438.6 105.4C451.1 117.9 451.1 138.1 438.6 150.6L182.6 406.6C170.1 419.1 149.9 419.1 137.4 406.6L9.372 278.6C-3.124 266.1-3.124 245.9 9.372 233.4C21.87 220.9 42.13 220.9 54.63 233.4L159.1 338.7L393.4 105.4C405.9 92.88 426.1 92.88 438.6 105.4H438.6z"}})]):e._e()])])}),0)])])},p=[],q="";function h(e,r,s,n,o,l,u,g){var t=typeof e=="function"?e.options:e;r&&(t.render=r,t.staticRenderFns=s,t._compiled=!0),n&&(t.functional=!0),l&&(t._scopeId="data-v-"+l);var a;if(u?(a=function(i){i=i||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!i&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(i=__VUE_SSR_CONTEXT__),o&&o.call(this,i),i&&i._registeredComponents&&i._registeredComponents.add(u)},t._ssrRegister=a):o&&(a=g?function(){o.call(this,(t.functional?this.parent:this).$root.$options.shadowRoot)}:o),a)if(t.functional){t._injectStyles=a;var m=t.render;t.render=function(y,d){return a.call(d),m(y,d)}}else{var _=t.beforeCreate;t.beforeCreate=_?[].concat(_,a):[a]}return{exports:e,options:t}}const v={name:"k-colors-field",props:{help:{type:String,required:!1},value:{type:Object,required:!1,default:()=>({hex:"",class:"",title:""})},label:{type:String,required:!1},disabled:{type:Boolean,required:!1},required:{type:Boolean,required:!1},options:{type:Object,required:!0}},methods:{action_click(e){this.$emit("input",{...e})},action_color(e){const r=e.replace("#",""),s=parseInt(r.substr(0,2),16),n=parseInt(r.substr(2,2),16),o=parseInt(r.substr(4,2),16);return(s*299+n*587+o*114)/1e3>155}}},c={};var b=h(v,f,p,!1,C,"2bb7c5b6",null,null);function C(e){for(let r in c)this[r]=c[r]}var k=function(){return b.exports}();panel.plugin("beluga/colors",{fields:{colors:k}})})();