-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
1 lines (1 loc) · 3.09 KB
/
index.js
1
(function(){"use strict";var p=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("k-select-field",{staticClass:"k-fontfamily-field",attrs:{help:e.help,label:e.label,when:e.when,default:this.default,disabled:e.disabled,value:e.value,options:e.options},on:{input:e.onInput}})},v=[],T="";function r(e,t,s,l,a,d,f,R){var n=typeof e=="function"?e.options:e;t&&(n.render=t,n.staticRenderFns=s,n._compiled=!0),l&&(n.functional=!0),d&&(n._scopeId="data-v-"+d);var o;if(f?(o=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__),a&&a.call(this,i),i&&i._registeredComponents&&i._registeredComponents.add(f)},n._ssrRegister=o):a&&(o=R?function(){a.call(this,(n.functional?this.parent:this).$root.$options.shadowRoot)}:a),o)if(n.functional){n._injectStyles=o;var k=n.render;n.render=function(B,c){return o.call(c),k(B,c)}}else{var _=n.beforeCreate;n.beforeCreate=_?[].concat(_,o):[o]}return{exports:e,options:n}}const g={props:{help:String,label:String,when:String,default:String,disabled:Boolean,value:String,reload:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},data(){return{options:[],loading:!1}},created(){this.syncContent(),this.$events.on("model.update",()=>this.reload&&this.syncContent())},methods:{onInput(e){this.$emit("input",e)},syncContent(){this.loading=!0,this.$api.get("fontselector/families?reload="+(this.reload?"1":"0")).then(e=>{this.options=e.families?e.families:[],this.options.some(t=>t.value===this.value)===!1&&this.onInput(""),this.loading=!1}).catch(e=>{this.loading=!1})}}},u={};var m=r(g,p,v,!1,$,null,null,null);function $(e){for(let t in u)this[t]=u[t]}var y=function(){return m.exports}(),C=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("k-select-field",{staticClass:"k-fontweight-field",attrs:{help:e.help,label:e.label,when:e.when,default:this.default,disabled:e.disabled,options:e.options,required:e.required},on:{input:e.onInput},model:{value:e.value,callback:function(l){e.value=l},expression:"value"}})},F=[],q="";const b={props:{help:String,label:String,when:String,watchField:String,default:String,disabled:Boolean,value:String,required:{type:Boolean,default:!0}},data(){return{options:[],loading:!1}},created(){this.syncContent(this.$store.getters["content/values"]()[this.watchField])},watch:{fontFamily(){this.syncContent(this.fontFamily)}},computed:{hasChanges(){return this.$store.getters["content/hasChanges"]()},fontFamily(){return this.$store.getters["content/values"]()[this.watchField]}},methods:{onInput(e){this.$emit("input",e)},syncContent(e){if(e===void 0||e.length===0){this.options=[],this.onInput("");return}this.loading=!0,this.$api.get("fontselector/family/"+encodeURIComponent(e)).then(t=>{this.options=t.weight?t.weight:[],this.options.some(s=>s.value===this.value)===!1&&this.onInput(""),this.loading=!1}).catch(t=>{this.loading=!1})}}},h={};var w=r(b,C,F,!1,S,null,null,null);function S(e){for(let t in h)this[t]=h[t]}var I=function(){return w.exports}();panel.plugin("bnomei/fontselector",{fields:{fontfamily:y,fontweight:I}})})();