1 line
2.6 KiB
JavaScript
1 line
2.6 KiB
JavaScript
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[27],{316:function(e,t,i){},371:function(e,t,i){"use strict";i(316)},394:function(e,t,i){"use strict";i.r(t);var o=i(246),a={props:{identifier:{type:String,required:!1},initialTitle:{type:String,required:!1},initialValue:{type:String,required:!1},onCancel:{type:Function},onSave:{type:Function}},data(){return{title:this.initialTitle,customCode:this.initialValue,touched:null!=this.initialValue}},methods:{getLabel(e){return Object(o.a)(e,this.$lang)},isCodeValid(){if(!this.customCode)return!1;const e=this.customCode.replace(/(?:\r|\n|\s)/g,"");return/^[a-fA-F0-9]+$/.test(e)&&e.length%16==0},onTouch(){this.touched=!0},confirmCancel(){confirm(Object(o.a)("common.discard",this.$lang))&&this.onCancel()},onSubmit(){this.onSave(this.identifier,this.title?this.title:"N/A",this.customCode.replace(/[^a-zA-Z0-9]/g,"").toUpperCase())},onPaste(e){var t,i,o,a;e.stopPropagation(),e.preventDefault();const l=(null===(t=e.clipboardData)||void 0===t||null===(i=t.getData)||void 0===i?void 0:i.call(t,"text"))||(null===(o=window.clipboardData)||void 0===o||null===(a=o.getData)||void 0===a?void 0:a.call(o,"text"));if(!l)return;const s=`${this.customCode?this.customCode:""} ${l}`.replace(/(?:\t|\s)/g,"").replace(/(.{8})(.{8})/g,"$1 $2\r\n");this.customCode=s}}},l=(i(371),i(10)),s=Object(l.a)(a,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"modal-mask"},[t("div",{staticClass:"modal-wrapper"},[t("div",{staticClass:"modal-container"},[t("span",{staticClass:"btn-close",on:{click:e.confirmCancel}},[e._v("×")]),e._v(" "),t("div",{staticClass:"modal-body"},[t("div",[t("label",[e._v("\n "+e._s(e.getLabel("codeeditor.fields.title.label"))+"\n ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.title,expression:"title"}],attrs:{type:"text",placeholder:e.getLabel("codeeditor.fields.title.placeholder")},domProps:{value:e.title},on:{input:function(t){t.target.composing||(e.title=t.target.value)}}})]),e._v(" "),t("div",[t("label",[e._v(" "+e._s(e.getLabel("codeeditor.fields.value.label"))+"* ")]),e._v(" "),t("textarea",{directives:[{name:"model",rawName:"v-model",value:e.customCode,expression:"customCode"}],class:e.touched&&!e.isCodeValid()?"invalid":"",attrs:{placeholder:e.getLabel("codeeditor.fields.value.placeholder")},domProps:{value:e.customCode},on:{paste:e.onPaste,blur:e.onTouch,input:function(t){t.target.composing||(e.customCode=t.target.value)}}})]),e._v(" "),t("div",[t("ButtonComponent",{attrs:{disabled:!e.isCodeValid(),label:e.getLabel("codeeditor.save"),onClick:e.onSubmit}})],1)])])])])}),[],!1,null,"03e5fae6",null);t.default=s.exports}}]);
|