text: "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _conf=_interopRequireDefault(require("../../conf")),_vXETable=_interopRequireDefault(require("../../v-x-e-table")),_tools=require("../../tools");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default={name:"VxeImportPanel",props:{defaultOptions:Object,storeData:Object},computed:{vSize:function(){return this.size||this.$parent.size||this.$parent.vSize},selectName:function(){return"".concat(this.storeData.filename,".").concat(this.storeData.type)},hasFile:function(){return this.storeData.file&&this.storeData.type},parseTypeLabel:function(){var e=this.storeData;return e.type?_conf.default.i18n("vxe.types.".concat(e.type)):"*.".concat((this.defaultOptions.types||_vXETable.default.importTypes).join(", *."))}},render:function(e){var t=this.hasFile,i=this.parseTypeLabel,a=this.defaultOptions,o=this.storeData,l=this.selectName;return e("vxe-modal",{res:"modal",model:{value:o.visible,callback:function(e){o.visible=e}},props:{title:_conf.default.i18n("vxe.toolbar.impTitle"),width:440,mask:!0,lockView:!0,showFooter:!1,maskClosable:!0}},[e("div",{class:"vxe-export--panel"},[e("table",{attrs:{cellspacing:0,cellpadding:0,border:0}},[e("tr",[e("td",_conf.default.i18n("vxe.toolbar.impFile")),e("td",[t?e("div",{class:"vxe-import-selected--file",attrs:{title:l}},[e("span",l),e("i",{class:_conf.default.icon.importRemove,on:{click:this.clearFileEvent}})]):e("span",{class:"vxe-import-select--file",on:{click:this.selectFileEvent}},_conf.default.i18n("vxe.toolbar.impSelect"))])]),e("tr",[e("td",_conf.default.i18n("vxe.toolbar.impType")),e("td",i)]),e("tr",[e("td",_conf.default.i18n("vxe.toolbar.impOpts")),e("td",[e("vxe-radio",{props:{name:"mode",label:"covering"},model:{value:a.mode,callback:function(e){a.mode=e}}},_conf.default.i18n("vxe.toolbar.impModeCovering")),e("vxe-radio",{props:{name:"mode",label:"append"},model:{value:a.mode,callback:function(e){a.mode=e}}},_conf.default.i18n("vxe.toolbar.impModeAppend"))])])]),e("div",{class:"vxe-export--panel-btns"},[e("vxe-button",{props:{type:"primary",disabled:!t},on:{click:this.importEvent}},_conf.default.i18n("vxe.toolbar.impConfirm"))])])])},methods:{clearFileEvent:function(){Object.assign(this.storeData,{filename:"",sheetName:"",type:""})},selectFileEvent:function(){var i=this,e=this.$parent,t=e.$grid,a=e.$table,o=t||a;o&&o.readFile(this.defaultOptions).then(function(e){var t=e.target.files[0];Object.assign(i.storeData,_tools.UtilTools.parseFile(t),{file:t})}).catch(function(e){return e})},importEvent:function(){var e=this.storeData,t=this.defaultOptions,i=Object.assign({},t);e.visible=!1,this.$emit("import",i)}}};exports.default=_default;