@appscode/ui-builder
Version:
## Motivation
1 lines • 3.2 kB
JavaScript
import{r as t,U as e,ag as i,M as o,ah as n,a1 as a,K as r,O as s,Y as d,a5 as c,X as l,o as u,a6 as p,ai as f,n as m}from"./wrapper-5d451278.js";import"vue";import{o as h}from"./object-set-prototype-of-866dfe15.js";var g=function(e,i,o){var n,a;return h&&"function"==typeof(n=i.constructor)&&n!==o&&t(a=n.prototype)&&a!==o.prototype&&h(e,a),e},v=d.f,E=c.f,b=l.f,N=f.trim,y=e.Number,I=y.prototype,C="Number"==i(o(I)),_=function(t){var e,i,o,n,a,r,s,d,c=p(t,!1);if("string"==typeof c&&c.length>2)if(43===(e=(c=N(c)).charCodeAt(0))||45===e){if(88===(i=c.charCodeAt(2))||120===i)return NaN}else if(48===e){switch(c.charCodeAt(1)){case 66:case 98:o=2,n=49;break;case 79:case 111:o=8,n=55;break;default:return+c}for(r=(a=c.slice(2)).length,s=0;s<r;s++)if((d=a.charCodeAt(s))<48||d>n)return NaN;return parseInt(a,o)}return+c};if(n("Number",!y(" 0o1")||!y("0b1")||y("+0x1"))){for(var M,T=function(t){var e=arguments.length<1?0:t,o=this;return o instanceof T&&(C?u((function(){I.valueOf.call(o)})):"Number"!=i(o))?g(new y(_(e)),o,T):_(e)},w=a?v(y):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),A=0;w.length>A;A++)r(y,M=w[A])&&!r(T,M)&&b(T,M,E(y,M));T.prototype=I,I.constructor=T,s(e,"Number",T)}var S=m({render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[t.readOnly?t._e():i("editor-tabs",{attrs:{"active-tab":t.activeTab},on:{tabchange:function(e){t.activeTab=e}}}),t._v(" "),"edit"===t.activeTab?i("monaco-editor",{key:"edit",ref:"monacoEditor",class:"vh-"+t.editorHeight+" is-clipped",attrs:{language:t.language,options:{minimap:{enabled:t.calcShowMinimap},readOnly:t.readOnly}},on:{editorDidMount:t.onEditorMount},model:{value:t.editorContent,callback:function(e){t.editorContent=e},expression:"editorContent"}}):t._e(),t._v(" "),"preview"===t.activeTab?i("monaco-editor",{key:"preview",class:"vh-"+t.editorHeight+" is-clipped",attrs:{value:t.editorContent,language:t.language,options:{minimap:{enabled:t.calcShowMinimap},readOnly:!0},original:t.originalEditorContent,"diff-editor":!0}}):t._e()],1)},staticRenderFns:[]},void 0,{props:{value:{type:String,default:""},originalValue:{type:String,default:""},readOnly:{type:Boolean,default:!1},language:{type:String,default:"yaml"},showMinimap:{type:Boolean,default:!0},editorHeight:{type:Number,default:40}},components:{EditorTabs:function(){return import("./EditorTabs-1881f2b3.js")},MonacoEditor:function(){return import("./vue-monaco.es-220f6092.js")}},data:function(){return{activeTab:"edit",editorContent:"",originalEditorContent:""}},computed:{calcShowMinimap:function(){var t=this.editorContent.split("\n").length;return this.showMinimap&&2*t>this.editorHeight}},watch:{value:{immediate:!0,handler:function(t){this.editorContent!==t&&(this.editorContent=t)}},originalValue:{immediate:!0,handler:function(t){this.originalEditorContent!==t&&(this.originalEditorContent=t)}}},methods:{onEditorMount:function(){var t=this;this.$refs.monacoEditor.getEditor().onDidBlurEditorText((function(){t.$emit("input",t.editorContent)}))}}},void 0,!1,void 0,!1,void 0,void 0,void 0);export default S;