-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
1 lines (1 loc) · 2.38 KB
/
index.js
1
(function(){"use strict";function p(t,e,s,r,a,l,d,m){var i=typeof t=="function"?t.options:t;e&&(i.render=e,i.staticRenderFns=s,i._compiled=!0),r&&(i.functional=!0),l&&(i._scopeId="data-v-"+l);var o;if(d?(o=function(n){n=n||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!n&&typeof __VUE_SSR_CONTEXT__<"u"&&(n=__VUE_SSR_CONTEXT__),a&&a.call(this,n),n&&n._registeredComponents&&n._registeredComponents.add(d)},i._ssrRegister=o):a&&(o=m?function(){a.call(this,(i.functional?this.parent:this).$root.$options.shadowRoot)}:a),o)if(i.functional){i._injectStyles=o;var k=i.render;i.render=function(g,u){return o.call(u),k(g,u)}}else{var f=i.beforeCreate;i.beforeCreate=f?[].concat(f,o):[o]}return{exports:t,options:i}}const c={extends:"k-files-field",data(){return{csv:null}},computed:{button(){return[{icon:"remove",responsive:!0,size:"xs",text:this.$t("remove"),variant:"filled",click:()=>this.clear()}]},file(){var t;return(t=this.selected[0])==null?void 0:t.id},index(){var t;if((t=this.csv)!=null&&t.pagination)return(this.csv.pagination.page-1)*this.csv.pagination.limit+1},pagination(){var t;return{...((t=this.csv)==null?void 0:t.pagination)??{},details:!0}},table(){return this.csv?{...this.csv,index:this.index,pagination:this.pagination}:{}}},mounted(){this.preview()},methods:{clear(){this.selected=[],this.csv=null,this.onInput()},onInput(){this.$emit("input",this.selected),this.preview()},async preview(t=1){this.file&&(this.csv=await this.$api.get(this.endpoints.field+"/preview",{file:this.file,page:t}))}}};var v=function(){var e=this,s=e._self._c;return s("k-field",e._b({staticClass:"k-models-field k-csv-field",scopedSlots:e._u([e.disabled?null:{key:"options",fn:function(){return[s("k-button-group",{ref:"buttons",staticClass:"k-field-options",attrs:{buttons:e.file?e.button:e.buttons,layout:"collapsed",size:"xs",variant:"filled"}})]},proxy:!0}],null,!0)},"k-field",e.$props,!1),[e.csv?s("k-table",e._b({on:{paginate:function(r){return e.preview(r.page)}}},"k-table",e.table,!1)):e.file?s("k-empty",{attrs:{text:e.$t("field.csv.loading"),icon:"loader",layout:"table"}}):s("k-dropzone",{attrs:{disabled:!e.hasDropzone},on:{drop:e.drop}},[s("k-empty",{attrs:{text:e.$t("field.csv.empty"),icon:"table",layout:"table"},on:{click:e.open}})],1)],1)},h=[],_=p(c,v,h,!1,null,null,null,null);const b=_.exports;panel.plugin("distantnative/kirby-csv-field",{fields:{csv:b}})})();