mirror of
https://github.com/501351981/vue-office.git
synced 2025-06-15 07:00:00 +08:00
Merge branch 'master' into master
This commit is contained in:
commit
74e370b2a4
10
README.md
10
README.md
@ -13,13 +13,13 @@
|
||||
## 安装
|
||||
```shell
|
||||
#docx文档预览组件
|
||||
npm install @vue-office/docx vue-demi
|
||||
npm install @vue-office/docx vue-demi@0.13.11
|
||||
|
||||
#excel文档预览组件
|
||||
npm install @vue-office/excel vue-demi
|
||||
npm install @vue-office/excel vue-demi@0.13.11
|
||||
|
||||
#pdf文档预览组件
|
||||
npm install @vue-office/pdf vue-demi
|
||||
npm install @vue-office/pdf vue-demi@0.13.11
|
||||
```
|
||||
如果是vue2.6版本或以下还需要额外安装 @vue/composition-api
|
||||
```shell
|
||||
@ -182,11 +182,11 @@ export default {
|
||||
|
||||
## 赞助和微信交流
|
||||
|
||||
**_如果该项目确实帮助到了您_**,为您节省了时间,请您不吝赞助,优化项目真的都是用爱发电^_^,有很多大的优化点或者新功能开发实在没有精力,一边要努力工作以免被裁员,一边要陪伴家人,人已不再年轻,没有收益的事情很难抽出更多时间精力~~,不能打赏的朋友麻烦帮点个免费的赞
|
||||
**_如果该项目确实帮助到了您_**,为您节省了时间,请您不吝赞助,请作者喝一杯秋天的奶茶,暖一暖冰冷的心吧,哈哈哈,优化项目真的都是用爱发电^_^,不能打赏的朋友麻烦帮点个免费的赞
|
||||
|
||||
<img src="https://501351981.github.io/vue-office/examples/dist/static/wx.png" alt="赞助二维码" width="260"/>
|
||||
|
||||
打赏的朋友欢迎**添加微信**,交流前端技术
|
||||
打赏的朋友欢迎**添加微信**,交流前端开发中遇到的技术、问题和困惑。
|
||||
|
||||
【**仅添加**打赏过的用户(工作太忙了,请理解),不定期删除屏蔽朋友圈的好友】
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@js-preview/excel",
|
||||
"type" :"module",
|
||||
"version": "1.3.0",
|
||||
"version": "1.3.1",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue-office/excel",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
|
@ -145,10 +145,59 @@ function transferColumns(excelSheet, spreadSheet, options){
|
||||
|
||||
function getCellText(cell){
|
||||
//console.log(cell);
|
||||
const {numFmt, value, type} = cell;
|
||||
let {numFmt, value, type} = cell;
|
||||
switch (type){
|
||||
case 2: //数字
|
||||
return value + '';
|
||||
try {
|
||||
//numFmt:
|
||||
// "0.00%"
|
||||
// "0.00_);(0.00)"
|
||||
// "#,##0.000_);(#,##0.000)" 千分位
|
||||
// "#,##0.000;[Red]#,##0.000"
|
||||
if(cell.style.numFmt){
|
||||
if(cell.style.numFmt.endsWith('%')){
|
||||
let precision = cell.style.numFmt.match(/\.(\d+)%/);
|
||||
if(precision){
|
||||
return (value * 100).toFixed(precision[1].length) + '%';
|
||||
}else {
|
||||
return value * 100 + '%';
|
||||
}
|
||||
}else if(/0(\.0+)?/.test(cell.style.numFmt)){
|
||||
if(value === 0 && cell.style.numFmt.startsWith('_')){
|
||||
return '-';
|
||||
}
|
||||
let precision = cell.style.numFmt.match(/0\.(0+)(_|;|$)/);
|
||||
if(precision){
|
||||
precision = precision[1].length;
|
||||
}else{
|
||||
precision = 0;
|
||||
}
|
||||
|
||||
let result = value.toFixed(precision) + '';
|
||||
if(cell.style.numFmt.includes('#,##')){
|
||||
//千分位
|
||||
result = result.split('.');
|
||||
let number = result[0].split('').reverse();
|
||||
let newNumber = [];
|
||||
for(let i = 0; i< number.length; i++){
|
||||
newNumber.push(number[i]);
|
||||
if((i+1) % 3 === 0 && i < number.length - 1 && number[i+1] !== '-'){
|
||||
newNumber.push(',');
|
||||
}
|
||||
|
||||
}
|
||||
result[0] = newNumber.reverse().join('');
|
||||
result = result.join('.');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
return value + '';
|
||||
}catch (e){
|
||||
return value;
|
||||
}
|
||||
|
||||
case 3: //字符串
|
||||
return value;
|
||||
case 4: //日期
|
||||
@ -295,7 +344,7 @@ function getStyle(cell){
|
||||
|
||||
export function transferExcelToSpreadSheet(workbook, options){
|
||||
let workbookData = [];
|
||||
// console.log(workbook, 'workbook')
|
||||
console.log(workbook, 'workbook');
|
||||
workbook.eachSheet((sheet) => {
|
||||
//console.log(sheet,'sheet');
|
||||
// 构造x-data-spreadsheet 的 sheet 数据源结构
|
||||
@ -348,7 +397,7 @@ export function transferExcelToSpreadSheet(workbook, options){
|
||||
sheetData.rows.len = Math.max(Object.keys(sheetData.rows).length, 100);
|
||||
workbookData.push(sheetData);
|
||||
});
|
||||
// console.log(workbookData, 'workbookData')
|
||||
//console.log(workbookData, 'workbookData')
|
||||
return {
|
||||
workbookData,
|
||||
workbookSource: workbook,
|
||||
|
@ -4,6 +4,7 @@ import vue3 from '@vitejs/plugin-vue';
|
||||
import * as compiler from '@vue/compiler-sfc';
|
||||
import { isVue2 } from 'vue-demi';
|
||||
const { resolve } = require('path');
|
||||
import babel from '@rollup/plugin-babel';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
@ -11,9 +12,10 @@ export default defineConfig({
|
||||
? createVuePlugin()
|
||||
: vue3({
|
||||
compiler: compiler
|
||||
}),
|
||||
})
|
||||
],
|
||||
build: {
|
||||
minify: 'terser',
|
||||
target: 'es2015',
|
||||
outDir: 'lib/v' + (isVue2 ? '2' : '3'),
|
||||
lib: {
|
||||
@ -32,6 +34,27 @@ export default defineConfig({
|
||||
'vue-demi': 'VueDemi'
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
babel({
|
||||
extensions: ['.js', '.ts', '.vue'],
|
||||
babelHelpers: 'runtime',
|
||||
plugins: [
|
||||
'@babel/plugin-transform-runtime',
|
||||
'@babel/plugin-transform-template-literals'
|
||||
],
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
useBuiltIns: false,
|
||||
targets: {
|
||||
chrome: '40'
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue-office/pdf",
|
||||
"version": "1.4.2",
|
||||
"version": "1.4.4",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
|
@ -68,7 +68,9 @@ export default defineComponent({
|
||||
loadingTask.promise.then((pdf) => {
|
||||
pdfDocument = pdf;
|
||||
numPages.value = Math.min(pdfDocument.numPages, lazySize.value);
|
||||
renderPage(1);
|
||||
setTimeout(()=>{
|
||||
renderPage(1);
|
||||
});
|
||||
}).catch((e) => {
|
||||
emit('error', e);
|
||||
});
|
||||
|
1
examples/dist/assets/DocxDemo-94f2dbdf.js
vendored
Normal file
1
examples/dist/assets/DocxDemo-94f2dbdf.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import{d as r}from"./docx-a4764915.js";import{d as x}from"./url-de9b02cf.js";import{d as m,_ as l,r as u,o as h,w as v,a as _,c as g,b as D,e as y,f as w,g as B,u as O}from"./index-c8d88308.js";import{P as R,u as f}from"./PreviewWrapper-b7a4e640.js";import"./_commonjs-dynamic-modules-302442b1.js";const $=m({name:"VueOfficeDocx",props:{src:[String,ArrayBuffer,Blob],requestOptions:{type:Object,default:()=>({})},options:{type:Object,default:()=>({})}},emits:["rendered","error"],setup(e,{emit:o}){const t=u(null);let n=null;function a(){let c=t.value;r.getData(e.src,e.requestOptions).then(async d=>{n=await r.getBlob(d),r.render(n,c,e.options).then(()=>{o("rendered")}).catch(p=>{r.render("",c,e.options),o("error",p)})}).catch(d=>{r.render("",c,e.options),o("error",d)})}h(()=>{e.src&&a()}),v(()=>e.src,()=>{e.src?a():r.render("",t.value,e.options).then(()=>{o("rendered")})});function s(c){x(c||`vue-office-docx-${new Date().getTime()}.docx`,n)}return{rootRef:t,save:s}}}),b={class:"vue-office-docx"},k={class:"vue-office-docx-main",ref:"rootRef"};function V(e,o,t,n,a,s){return _(),g("div",b,[D("div",k,null,512)])}const i=l($,[["render",V]]);i.install=function(e){e.component(i.name,i)};const E={__name:"DocxDemo",setup(e){function o(){f.hideLoading()}function t(s){console.log("出差",s),f.hideLoading()}const n=location.origin+(location.pathname+"/").replace("//","/")+"static/test-files/test.docx",a=u();return(s,c)=>(_(),y(R,{accept:".docx",placeholder:"请输入docx文件地址","default-src":n},{default:w(d=>[B(O(i),{ref_key:"docxRef",ref:a,src:d.src,style:{flex:"1",height:"0"},onRendered:o,onError:t},null,8,["src"])]),_:1}))}},P=l(E,[["__scopeId","data-v-637d9a60"]]);export{P as default};
|
1
examples/dist/assets/DocxDemo-a0fa4afa.js
vendored
Normal file
1
examples/dist/assets/DocxDemo-a0fa4afa.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import{d as r}from"./docx-a0687961.js";import{d as x}from"./url-de9b02cf.js";import{d as m,_ as l,r as u,o as h,w as v,a as _,c as g,b as D,e as y,f as w,g as B,u as O}from"./index-11290fb6.js";import{P as R,u as f}from"./PreviewWrapper-95ad6bf9.js";import"./_commonjs-dynamic-modules-302442b1.js";const $=m({name:"VueOfficeDocx",props:{src:[String,ArrayBuffer,Blob],requestOptions:{type:Object,default:()=>({})},options:{type:Object,default:()=>({})}},emits:["rendered","error"],setup(e,{emit:o}){const t=u(null);let n=null;function a(){let c=t.value;r.getData(e.src,e.requestOptions).then(async d=>{n=await r.getBlob(d),r.render(n,c,e.options).then(()=>{o("rendered")}).catch(p=>{r.render("",c,e.options),o("error",p)})}).catch(d=>{r.render("",c,e.options),o("error",d)})}h(()=>{e.src&&a()}),v(()=>e.src,()=>{e.src?a():r.render("",t.value,e.options).then(()=>{o("rendered")})});function s(c){x(c||`vue-office-docx-${new Date().getTime()}.docx`,n)}return{rootRef:t,save:s}}}),b={class:"vue-office-docx"},k={class:"vue-office-docx-main",ref:"rootRef"};function V(e,o,t,n,a,s){return _(),g("div",b,[D("div",k,null,512)])}const i=l($,[["render",V]]);i.install=function(e){e.component(i.name,i)};const E={__name:"DocxDemo",setup(e){function o(){f.hideLoading()}function t(s){console.log("出差",s),f.hideLoading()}const n=location.origin+(location.pathname+"/").replace("//","/")+"static/test-files/test.docx",a=u();return(s,c)=>(_(),y(R,{accept:".docx",placeholder:"请输入docx文件地址","default-src":n},{default:w(d=>[B(O(i),{ref_key:"docxRef",ref:a,src:d.src,style:{flex:"1",height:"0"},onRendered:o,onError:t},null,8,["src"])]),_:1}))}},P=l(E,[["__scopeId","data-v-637d9a60"]]);export{P as default};
|
1
examples/dist/assets/DocxDemo-ad4133f0.js
vendored
Normal file
1
examples/dist/assets/DocxDemo-ad4133f0.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import{d as r}from"./docx-f7736cac.js";import{d as x}from"./url-de9b02cf.js";import{d as m,_ as l,r as u,o as h,w as v,a as _,c as g,b as D,e as y,f as w,g as B,u as O}from"./index-80932b39.js";import{P as R,u as f}from"./PreviewWrapper-c0fee36e.js";import"./_commonjs-dynamic-modules-302442b1.js";const $=m({name:"VueOfficeDocx",props:{src:[String,ArrayBuffer,Blob],requestOptions:{type:Object,default:()=>({})},options:{type:Object,default:()=>({})}},emits:["rendered","error"],setup(e,{emit:o}){const t=u(null);let n=null;function a(){let c=t.value;r.getData(e.src,e.requestOptions).then(async d=>{n=await r.getBlob(d),r.render(n,c,e.options).then(()=>{o("rendered")}).catch(p=>{r.render("",c,e.options),o("error",p)})}).catch(d=>{r.render("",c,e.options),o("error",d)})}h(()=>{e.src&&a()}),v(()=>e.src,()=>{e.src?a():r.render("",t.value,e.options).then(()=>{o("rendered")})});function s(c){x(c||`vue-office-docx-${new Date().getTime()}.docx`,n)}return{rootRef:t,save:s}}}),b={class:"vue-office-docx"},k={class:"vue-office-docx-main",ref:"rootRef"};function V(e,o,t,n,a,s){return _(),g("div",b,[D("div",k,null,512)])}const i=l($,[["render",V]]);i.install=function(e){e.component(i.name,i)};const E={__name:"DocxDemo",setup(e){function o(){f.hideLoading()}function t(s){console.log("出差",s),f.hideLoading()}const n=location.origin+(location.pathname+"/").replace("//","/")+"static/test-files/test.docx",a=u();return(s,c)=>(_(),y(R,{accept:".docx",placeholder:"请输入docx文件地址","default-src":n},{default:w(d=>[B(O(i),{ref_key:"docxRef",ref:a,src:d.src,style:{flex:"1",height:"0"},onRendered:o,onError:t},null,8,["src"])]),_:1}))}},P=l(E,[["__scopeId","data-v-637d9a60"]]);export{P as default};
|
1
examples/dist/assets/ExcelDemo-241e947a.js
vendored
Normal file
1
examples/dist/assets/ExcelDemo-241e947a.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import{l as R,r as B,S as T,a as h,g as k,b as $,t as L,c as D}from"./hack-2409615a.js";import{d as q}from"./url-de9b02cf.js";import{d as F,_ as V,r as m,o as W,n as j,h as I,w as M,a as S,c as N,b as P,i as A,e as H,f as U,j as z,g as G,u as J}from"./index-11290fb6.js";import{P as K,u as O}from"./PreviewWrapper-95ad6bf9.js";import"./_commonjs-dynamic-modules-302442b1.js";const E={minColLength:20},Q=F({name:"VueOfficeExcel",props:{src:[String,ArrayBuffer,Blob],requestOptions:{type:Object,default:()=>({})},options:{type:Object,default:()=>({...E})}},emits:["rendered","error"],setup(t,{emit:i}){const n=m(null),s=m(null);let r={_worksheets:[]},a=[],d=1,u=null,e=null,f=null,w=null;function _(c){w=c,$(c).then(l=>{if(!l._worksheets||l._worksheets.length===0)throw new Error("未获取到数据,可能文件格式不正确或文件已损坏");const{workbookData:x,medias:g,workbookSource:o}=L(l,{...E,...t.options});a=g,r=o,f=null,d=1,D(),e.loadData(x),h(u,a,r._worksheets[d],f),i("rendered")}).catch(l=>{console.warn(l),a=[],r={_worksheets:[]},D(),e&&e.loadData({}),i("error",l)})}const v=R.debounce(B,200).bind(this,s.value),b=new MutationObserver(v),y={attributes:!0,childList:!0,subtree:!0};W(()=>{j(()=>{b.observe(s.value,y),v(s),e=new T(s.value,{mode:"read",showToolbar:!1,showContextmenu:t.options.showContextmenu||!1,view:{height:()=>n.value&&n.value.clientHeight||300,width:()=>n.value&&n.value.clientWidth||1200},row:{height:24,len:100},col:{len:26,width:80,indexWidth:60,minWidth:60},autoFocus:!1}).loadData({});let c=e.bottombar.swapFunc;e.bottombar.swapFunc=function(o){c.call(e.bottombar,o),d=o+1,setTimeout(()=>{e.reRender(),h(u,a,r._worksheets[d],f)})};let l=e.sheet.editor.clear;e.sheet.editor.clear=function(...o){l.apply(e.sheet.editor,o),setTimeout(()=>{h(u,a,r._worksheets[d],f)})};let x=e.sheet.editor.setOffset;e.sheet.editor.setOffset=function(...o){x.apply(e.sheet.editor,o),f=o[0],h(u,a,r._worksheets[d],f)},u=s.value.querySelector("canvas").getContext("2d"),t.src&&k(t.src,t.requestOptions).then(_).catch(o=>{e.loadData({}),i("error",o)})})}),I(()=>{b.disconnect(),e=null}),M(()=>t.src,()=>{t.src?k(t.src,t.requestOptions).then(_).catch(c=>{e.loadData({}),i("error",c)}):e.loadData({})});function C(c){q(c||`vue-office-excel-${new Date().getTime()}.xlsx`,w)}return{wrapperRef:n,rootRef:s,save:C}}}),X={class:"vue-office-excel",ref:"wrapperRef"},Y={class:"vue-office-excel-main",ref:"rootRef"};function Z(t,i,n,s,r,a){return S(),N("div",X,[P("div",Y,null,512)],512)}const p=V(Q,[["render",Z]]);p.install=function(t){t.component(p.name,p)};const re={__name:"ExcelDemo",setup(t){function i(){O.hideLoading()}function n(a){console.log("出差",a),O.hideLoading()}const s=location.origin+(location.pathname+"/").replace("//","/")+"static/test-files/test.xlsx",r=m();return(a,d)=>{const u=A("loading");return S(),H(K,{accept:".xlsx",placeholder:"请输入xlsx文件地址","default-src":s},{default:U(e=>[z(G(J(p),{ref_key:"docxRef",ref:r,src:e.src,style:{flex:"1",height:"0"},onRendered:i,onError:n},null,8,["src"]),[[u,!0]])]),_:1})}}};export{re as default};
|
1
examples/dist/assets/ExcelDemo-a9a09c1e.js
vendored
Normal file
1
examples/dist/assets/ExcelDemo-a9a09c1e.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import{l as R,r as B,S as T,a as h,g as k,b as $,t as L,c as D}from"./hack-354e39e4.js";import{d as q}from"./url-de9b02cf.js";import{d as F,_ as V,r as m,o as W,n as j,h as I,w as M,a as S,c as N,b as P,i as A,e as H,f as U,j as z,g as G,u as J}from"./index-c8d88308.js";import{P as K,u as O}from"./PreviewWrapper-b7a4e640.js";import"./_commonjs-dynamic-modules-302442b1.js";const E={minColLength:20},Q=F({name:"VueOfficeExcel",props:{src:[String,ArrayBuffer,Blob],requestOptions:{type:Object,default:()=>({})},options:{type:Object,default:()=>({...E})}},emits:["rendered","error"],setup(t,{emit:i}){const n=m(null),s=m(null);let r={_worksheets:[]},a=[],d=1,u=null,e=null,f=null,w=null;function _(c){w=c,$(c).then(l=>{if(!l._worksheets||l._worksheets.length===0)throw new Error("未获取到数据,可能文件格式不正确或文件已损坏");const{workbookData:x,medias:g,workbookSource:o}=L(l,{...E,...t.options});a=g,r=o,f=null,d=1,D(),e.loadData(x),h(u,a,r._worksheets[d],f),i("rendered")}).catch(l=>{console.warn(l),a=[],r={_worksheets:[]},D(),e&&e.loadData({}),i("error",l)})}const v=R.debounce(B,200).bind(this,s.value),b=new MutationObserver(v),y={attributes:!0,childList:!0,subtree:!0};W(()=>{j(()=>{b.observe(s.value,y),v(s),e=new T(s.value,{mode:"read",showToolbar:!1,showContextmenu:t.options.showContextmenu||!1,view:{height:()=>n.value&&n.value.clientHeight||300,width:()=>n.value&&n.value.clientWidth||1200},row:{height:24,len:100},col:{len:26,width:80,indexWidth:60,minWidth:60},autoFocus:!1}).loadData({});let c=e.bottombar.swapFunc;e.bottombar.swapFunc=function(o){c.call(e.bottombar,o),d=o+1,setTimeout(()=>{e.reRender(),h(u,a,r._worksheets[d],f)})};let l=e.sheet.editor.clear;e.sheet.editor.clear=function(...o){l.apply(e.sheet.editor,o),setTimeout(()=>{h(u,a,r._worksheets[d],f)})};let x=e.sheet.editor.setOffset;e.sheet.editor.setOffset=function(...o){x.apply(e.sheet.editor,o),f=o[0],h(u,a,r._worksheets[d],f)},u=s.value.querySelector("canvas").getContext("2d"),t.src&&k(t.src,t.requestOptions).then(_).catch(o=>{e.loadData({}),i("error",o)})})}),I(()=>{b.disconnect(),e=null}),M(()=>t.src,()=>{t.src?k(t.src,t.requestOptions).then(_).catch(c=>{e.loadData({}),i("error",c)}):e.loadData({})});function C(c){q(c||`vue-office-excel-${new Date().getTime()}.xlsx`,w)}return{wrapperRef:n,rootRef:s,save:C}}}),X={class:"vue-office-excel",ref:"wrapperRef"},Y={class:"vue-office-excel-main",ref:"rootRef"};function Z(t,i,n,s,r,a){return S(),N("div",X,[P("div",Y,null,512)],512)}const p=V(Q,[["render",Z]]);p.install=function(t){t.component(p.name,p)};const re={__name:"ExcelDemo",setup(t){function i(){O.hideLoading()}function n(a){console.log("出差",a),O.hideLoading()}const s=location.origin+(location.pathname+"/").replace("//","/")+"static/test-files/test.xlsx",r=m();return(a,d)=>{const u=A("loading");return S(),H(K,{accept:".xlsx",placeholder:"请输入xlsx文件地址","default-src":s},{default:U(e=>[z(G(J(p),{ref_key:"docxRef",ref:r,src:e.src,style:{flex:"1",height:"0"},onRendered:i,onError:n},null,8,["src"]),[[u,!0]])]),_:1})}}};export{re as default};
|
1
examples/dist/assets/ExcelDemo-c921e0e4.js
vendored
Normal file
1
examples/dist/assets/ExcelDemo-c921e0e4.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import{l as R,r as B,S as T,a as h,g as k,b as $,t as L,c as D}from"./hack-6a7812ef.js";import{d as q}from"./url-de9b02cf.js";import{d as F,_ as V,r as m,o as W,n as j,h as I,w as M,a as S,c as N,b as P,i as A,e as H,f as U,j as z,g as G,u as J}from"./index-80932b39.js";import{P as K,u as O}from"./PreviewWrapper-c0fee36e.js";import"./_commonjs-dynamic-modules-302442b1.js";const E={minColLength:20},Q=F({name:"VueOfficeExcel",props:{src:[String,ArrayBuffer,Blob],requestOptions:{type:Object,default:()=>({})},options:{type:Object,default:()=>({...E})}},emits:["rendered","error"],setup(t,{emit:i}){const n=m(null),s=m(null);let r={_worksheets:[]},a=[],d=1,u=null,e=null,f=null,w=null;function _(c){w=c,$(c).then(l=>{if(!l._worksheets||l._worksheets.length===0)throw new Error("未获取到数据,可能文件格式不正确或文件已损坏");const{workbookData:x,medias:g,workbookSource:o}=L(l,{...E,...t.options});a=g,r=o,f=null,d=1,D(),e.loadData(x),h(u,a,r._worksheets[d],f),i("rendered")}).catch(l=>{console.warn(l),a=[],r={_worksheets:[]},D(),e&&e.loadData({}),i("error",l)})}const v=R.debounce(B,200).bind(this,s.value),b=new MutationObserver(v),y={attributes:!0,childList:!0,subtree:!0};W(()=>{j(()=>{b.observe(s.value,y),v(s),e=new T(s.value,{mode:"read",showToolbar:!1,showContextmenu:t.options.showContextmenu||!1,view:{height:()=>n.value&&n.value.clientHeight||300,width:()=>n.value&&n.value.clientWidth||1200},row:{height:24,len:100},col:{len:26,width:80,indexWidth:60,minWidth:60},autoFocus:!1}).loadData({});let c=e.bottombar.swapFunc;e.bottombar.swapFunc=function(o){c.call(e.bottombar,o),d=o+1,setTimeout(()=>{e.reRender(),h(u,a,r._worksheets[d],f)})};let l=e.sheet.editor.clear;e.sheet.editor.clear=function(...o){l.apply(e.sheet.editor,o),setTimeout(()=>{h(u,a,r._worksheets[d],f)})};let x=e.sheet.editor.setOffset;e.sheet.editor.setOffset=function(...o){x.apply(e.sheet.editor,o),f=o[0],h(u,a,r._worksheets[d],f)},u=s.value.querySelector("canvas").getContext("2d"),t.src&&k(t.src,t.requestOptions).then(_).catch(o=>{e.loadData({}),i("error",o)})})}),I(()=>{b.disconnect(),e=null}),M(()=>t.src,()=>{t.src?k(t.src,t.requestOptions).then(_).catch(c=>{e.loadData({}),i("error",c)}):e.loadData({})});function C(c){q(c||`vue-office-excel-${new Date().getTime()}.xlsx`,w)}return{wrapperRef:n,rootRef:s,save:C}}}),X={class:"vue-office-excel",ref:"wrapperRef"},Y={class:"vue-office-excel-main",ref:"rootRef"};function Z(t,i,n,s,r,a){return S(),N("div",X,[P("div",Y,null,512)],512)}const p=V(Q,[["render",Z]]);p.install=function(t){t.component(p.name,p)};const re={__name:"ExcelDemo",setup(t){function i(){O.hideLoading()}function n(a){console.log("出差",a),O.hideLoading()}const s=location.origin+(location.pathname+"/").replace("//","/")+"static/test-files/test.xlsx",r=m();return(a,d)=>{const u=A("loading");return S(),H(K,{accept:".xlsx",placeholder:"请输入xlsx文件地址","default-src":s},{default:U(e=>[z(G(J(p),{ref_key:"docxRef",ref:r,src:e.src,style:{flex:"1",height:"0"},onRendered:i,onError:n},null,8,["src"]),[[u,!0]])]),_:1})}}};export{re as default};
|
1
examples/dist/assets/JsDocxDemo-158672fe.js
vendored
Normal file
1
examples/dist/assets/JsDocxDemo-158672fe.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var p=Object.defineProperty;var c=(i,e,t)=>e in i?p(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var r=(i,e,t)=>(c(i,typeof e!="symbol"?e+"":e,t),t);import{d as n}from"./docx-f7736cac.js";import{d as l}from"./url-de9b02cf.js";import{r as h,o as d,a as u,c as m}from"./index-80932b39.js";import"./_commonjs-dynamic-modules-302442b1.js";class w{constructor(e,t={},s={}){r(this,"container",null);r(this,"wrapper",null);r(this,"wrapperMain",null);r(this,"options",{});r(this,"requestOptions",{});r(this,"fileData",null);this.container=e,this.options=t,this.requestOptions=s,this.createWrapper()}createWrapper(){this.wrapper=document.createElement("div"),this.wrapper.className="vue-office-docx",this.wrapperMain=document.createElement("div"),this.wrapperMain.className="vue-office-docx-main",this.wrapper.appendChild(this.wrapperMain),this.container.appendChild(this.wrapper)}setOptions(e){this.options=e}setRequestOptions(e){this.requestOptions=e}preview(e){return new Promise((t,s)=>{n.getData(e,this.requestOptions).then(async o=>{this.fileData=await n.getBlob(o),n.render(this.fileData,this.wrapperMain,this.options).then(()=>{t()}).catch(a=>{n.render("",this.wrapperMain,this.options),s(a)})}).catch(o=>{n.render("",this.wrapperMain,this.options),s(o)})})}save(e){l(e||`js-preview-docx-${new Date().getTime()}.docx`,this.fileData)}destroy(){this.container.removeChild(this.wrapper),this.container=null,this.wrapper=null,this.wrapperMain=null,this.options=null,this.requestOptions=null}}function f(i,e,t){return new w(i,e,t)}const v={init:f};const q={__name:"JsDocxDemo",setup(i){const e=h(null);return d(()=>{let t=v.init(e.value);t.preview("/vue-office/examples/dist/static/test-files/test.docx").then(s=>{console.log("docx preview done"),setTimeout(()=>{t.preview("/vue-office/examples/dist/static/test-files/test2.docx")},3e3)}).catch(s=>{console.log("err",s)})}),(t,s)=>(u(),m("div",{ref_key:"dom",ref:e},null,512))}};export{q as default};
|
1
examples/dist/assets/JsDocxDemo-2175979c.js
vendored
Normal file
1
examples/dist/assets/JsDocxDemo-2175979c.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var p=Object.defineProperty;var c=(i,e,t)=>e in i?p(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var r=(i,e,t)=>(c(i,typeof e!="symbol"?e+"":e,t),t);import{d as n}from"./docx-a0687961.js";import{d as l}from"./url-de9b02cf.js";import{r as h,o as d,a as u,c as m}from"./index-11290fb6.js";import"./_commonjs-dynamic-modules-302442b1.js";class w{constructor(e,t={},s={}){r(this,"container",null);r(this,"wrapper",null);r(this,"wrapperMain",null);r(this,"options",{});r(this,"requestOptions",{});r(this,"fileData",null);this.container=e,this.options=t,this.requestOptions=s,this.createWrapper()}createWrapper(){this.wrapper=document.createElement("div"),this.wrapper.className="vue-office-docx",this.wrapperMain=document.createElement("div"),this.wrapperMain.className="vue-office-docx-main",this.wrapper.appendChild(this.wrapperMain),this.container.appendChild(this.wrapper)}setOptions(e){this.options=e}setRequestOptions(e){this.requestOptions=e}preview(e){return new Promise((t,s)=>{n.getData(e,this.requestOptions).then(async o=>{this.fileData=await n.getBlob(o),n.render(this.fileData,this.wrapperMain,this.options).then(()=>{t()}).catch(a=>{n.render("",this.wrapperMain,this.options),s(a)})}).catch(o=>{n.render("",this.wrapperMain,this.options),s(o)})})}save(e){l(e||`js-preview-docx-${new Date().getTime()}.docx`,this.fileData)}destroy(){this.container.removeChild(this.wrapper),this.container=null,this.wrapper=null,this.wrapperMain=null,this.options=null,this.requestOptions=null}}function f(i,e,t){return new w(i,e,t)}const v={init:f};const q={__name:"JsDocxDemo",setup(i){const e=h(null);return d(()=>{let t=v.init(e.value);t.preview("/vue-office/examples/dist/static/test-files/test.docx").then(s=>{console.log("docx preview done"),setTimeout(()=>{t.preview("/vue-office/examples/dist/static/test-files/test2.docx")},3e3)}).catch(s=>{console.log("err",s)})}),(t,s)=>(u(),m("div",{ref_key:"dom",ref:e},null,512))}};export{q as default};
|
1
examples/dist/assets/JsDocxDemo-ed7fa826.js
vendored
Normal file
1
examples/dist/assets/JsDocxDemo-ed7fa826.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var p=Object.defineProperty;var c=(i,e,t)=>e in i?p(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var r=(i,e,t)=>(c(i,typeof e!="symbol"?e+"":e,t),t);import{d as n}from"./docx-a4764915.js";import{d as l}from"./url-de9b02cf.js";import{r as h,o as d,a as u,c as m}from"./index-c8d88308.js";import"./_commonjs-dynamic-modules-302442b1.js";class w{constructor(e,t={},s={}){r(this,"container",null);r(this,"wrapper",null);r(this,"wrapperMain",null);r(this,"options",{});r(this,"requestOptions",{});r(this,"fileData",null);this.container=e,this.options=t,this.requestOptions=s,this.createWrapper()}createWrapper(){this.wrapper=document.createElement("div"),this.wrapper.className="vue-office-docx",this.wrapperMain=document.createElement("div"),this.wrapperMain.className="vue-office-docx-main",this.wrapper.appendChild(this.wrapperMain),this.container.appendChild(this.wrapper)}setOptions(e){this.options=e}setRequestOptions(e){this.requestOptions=e}preview(e){return new Promise((t,s)=>{n.getData(e,this.requestOptions).then(async o=>{this.fileData=await n.getBlob(o),n.render(this.fileData,this.wrapperMain,this.options).then(()=>{t()}).catch(a=>{n.render("",this.wrapperMain,this.options),s(a)})}).catch(o=>{n.render("",this.wrapperMain,this.options),s(o)})})}save(e){l(e||`js-preview-docx-${new Date().getTime()}.docx`,this.fileData)}destroy(){this.container.removeChild(this.wrapper),this.container=null,this.wrapper=null,this.wrapperMain=null,this.options=null,this.requestOptions=null}}function f(i,e,t){return new w(i,e,t)}const v={init:f};const q={__name:"JsDocxDemo",setup(i){const e=h(null);return d(()=>{let t=v.init(e.value);t.preview("/vue-office/examples/dist/static/test-files/test.docx").then(s=>{console.log("docx preview done"),setTimeout(()=>{t.preview("/vue-office/examples/dist/static/test-files/test2.docx")},3e3)}).catch(s=>{console.log("err",s)})}),(t,s)=>(u(),m("div",{ref_key:"dom",ref:e},null,512))}};export{q as default};
|
1
examples/dist/assets/JsExcelDemo-2cc5483a.js
vendored
Normal file
1
examples/dist/assets/JsExcelDemo-2cc5483a.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var c=Object.defineProperty;var p=(r,e,t)=>e in r?c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>(p(r,typeof e!="symbol"?e+"":e,t),t);import{S as u,a as n,b as d,t as w,c as l,l as x,r as m,g as f}from"./hack-354e39e4.js";import{d as k}from"./url-de9b02cf.js";/* empty css */import{r as v,o as b,a as S,c as D}from"./index-c8d88308.js";import"./_commonjs-dynamic-modules-302442b1.js";const _={minColLength:20};class E{constructor(e,t={},i={}){s(this,"container",null);s(this,"wrapper",null);s(this,"wrapperMain",null);s(this,"options",{});s(this,"requestOptions",{});s(this,"mediasSource",[]);s(this,"workbookDataSource",{_worksheets:[]});s(this,"sheetIndex",1);s(this,"ctx",null);s(this,"xs",null);s(this,"offset",null);s(this,"observer",null);s(this,"fileData",null);this.container=e,this.options={..._,...t},this.requestOptions=i,this.createWrapper(),this.initSpreadsheet(),this.hack()}createWrapper(){this.wrapper=document.createElement("div"),this.wrapper.className="vue-office-excel",this.wrapperMain=document.createElement("div"),this.wrapperMain.className="vue-office-excel-main",this.wrapper.appendChild(this.wrapperMain),this.container.appendChild(this.wrapper)}initSpreadsheet(){this.xs=new u(this.wrapperMain,{mode:"read",showToolbar:!1,showContextmenu:this.options.showContextmenu||!1,view:{height:()=>this.wrapper&&this.wrapper.clientHeight||300,width:()=>this.wrapper&&this.wrapper.clientWidth||1200},row:{height:24,len:100},col:{len:26,width:80,indexWidth:60,minWidth:60},autoFocus:!1}).loadData({});let e=this,t=this.xs.bottombar.swapFunc;this.xs.bottombar.swapFunc=function(a){t.call(e.xs.bottombar,a),e.sheetIndex=a+1,setTimeout(()=>{e.xs.reRender(),n(e.ctx,e.mediasSource,e.workbookDataSource._worksheets[e.sheetIndex],e.offset)})};let i=this.xs.sheet.editor.clear;this.xs.sheet.editor.clear=function(...a){i.apply(e.xs.sheet.editor,a),setTimeout(()=>{n(e.ctx,e.mediasSource,e.workbookDataSource._worksheets[e.sheetIndex],e.offset)})};let o=this.xs.sheet.editor.setOffset;this.xs.sheet.editor.setOffset=function(...a){o.apply(e.xs.sheet.editor,a),e.offset=a[0],n(e.ctx,e.mediasSource,e.workbookDataSource._worksheets[e.sheetIndex],e.offset)};const h=this.wrapperMain.querySelector("canvas");this.ctx=h.getContext("2d")}renderExcel(e){return this.fileData=e,d(e).then(t=>{if(!t._worksheets||t._worksheets.length===0)throw new Error("未获取到数据,可能文件格式不正确或文件已损坏");const{workbookData:i,medias:o,workbookSource:h}=w(t,this.options);this.mediasSource=o,this.workbookDataSource=h,this.offset=null,this.sheetIndex=1,l(),this.xs.loadData(i),n(this.ctx,this.mediasSource,this.workbookDataSource._worksheets[this.sheetIndex],this.offset)}).catch(t=>(this.mediasSource=[],this.workbookDataSource={_worksheets:[]},l(),this.xs.loadData({}),Promise.reject(t)))}hack(){const e=x.debounce(m,200).bind(this,this.wrapperMain);this.observer=new MutationObserver(e);const t={attributes:!0,childList:!0,subtree:!0};this.observer.observe(this.wrapperMain,t),e(this.wrapperMain)}setOptions(e){this.options=e}setRequestOptions(e){this.requestOptions=e}preview(e){return new Promise((t,i)=>{f(e,this.requestOptions).then(o=>{this.renderExcel(o).then(t)}).catch(o=>{this.xs.loadData({}),i(o)})})}save(e){k(e||`js-preview-excel-${new Date().getTime()}.xlsx`,this.fileData)}destroy(){this.observer.disconnect(),this.container.removeChild(this.wrapper),this.container=null,this.wrapper=null,this.wrapperMain=null,this.ctx=null,this.xs=null,this.observer=null,this.options=null,this.requestOptions=null,this.mediasSource=null,this.workbookDataSource=null}}function g(r,e,t){return new E(r,e,t)}const O={init:g},T={__name:"JsExcelDemo",setup(r){const e=v(null);return b(()=>{window.myExcelPreview=O.init(e.value,{}),window.myExcelPreview.preview("/vue-office/examples/dist/static/test-files/test.xlsx").then(t=>{console.log("excel preview done",window.myExcelPreview)}).catch(t=>{console.log("err",t)})}),(t,i)=>(S(),D("div",{ref_key:"dom",ref:e,style:{height:"calc(100vh - 50px)"}},null,512))}};export{T as default};
|
1
examples/dist/assets/JsExcelDemo-76fa96d6.js
vendored
Normal file
1
examples/dist/assets/JsExcelDemo-76fa96d6.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var c=Object.defineProperty;var p=(r,e,t)=>e in r?c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>(p(r,typeof e!="symbol"?e+"":e,t),t);import{S as u,a as n,b as d,t as w,c as l,l as x,r as m,g as f}from"./hack-6a7812ef.js";import{d as k}from"./url-de9b02cf.js";/* empty css */import{r as v,o as b,a as S,c as D}from"./index-80932b39.js";import"./_commonjs-dynamic-modules-302442b1.js";const _={minColLength:20};class E{constructor(e,t={},i={}){s(this,"container",null);s(this,"wrapper",null);s(this,"wrapperMain",null);s(this,"options",{});s(this,"requestOptions",{});s(this,"mediasSource",[]);s(this,"workbookDataSource",{_worksheets:[]});s(this,"sheetIndex",1);s(this,"ctx",null);s(this,"xs",null);s(this,"offset",null);s(this,"observer",null);s(this,"fileData",null);this.container=e,this.options={..._,...t},this.requestOptions=i,this.createWrapper(),this.initSpreadsheet(),this.hack()}createWrapper(){this.wrapper=document.createElement("div"),this.wrapper.className="vue-office-excel",this.wrapperMain=document.createElement("div"),this.wrapperMain.className="vue-office-excel-main",this.wrapper.appendChild(this.wrapperMain),this.container.appendChild(this.wrapper)}initSpreadsheet(){this.xs=new u(this.wrapperMain,{mode:"read",showToolbar:!1,showContextmenu:this.options.showContextmenu||!1,view:{height:()=>this.wrapper&&this.wrapper.clientHeight||300,width:()=>this.wrapper&&this.wrapper.clientWidth||1200},row:{height:24,len:100},col:{len:26,width:80,indexWidth:60,minWidth:60},autoFocus:!1}).loadData({});let e=this,t=this.xs.bottombar.swapFunc;this.xs.bottombar.swapFunc=function(a){t.call(e.xs.bottombar,a),e.sheetIndex=a+1,setTimeout(()=>{e.xs.reRender(),n(e.ctx,e.mediasSource,e.workbookDataSource._worksheets[e.sheetIndex],e.offset)})};let i=this.xs.sheet.editor.clear;this.xs.sheet.editor.clear=function(...a){i.apply(e.xs.sheet.editor,a),setTimeout(()=>{n(e.ctx,e.mediasSource,e.workbookDataSource._worksheets[e.sheetIndex],e.offset)})};let o=this.xs.sheet.editor.setOffset;this.xs.sheet.editor.setOffset=function(...a){o.apply(e.xs.sheet.editor,a),e.offset=a[0],n(e.ctx,e.mediasSource,e.workbookDataSource._worksheets[e.sheetIndex],e.offset)};const h=this.wrapperMain.querySelector("canvas");this.ctx=h.getContext("2d")}renderExcel(e){return this.fileData=e,d(e).then(t=>{if(!t._worksheets||t._worksheets.length===0)throw new Error("未获取到数据,可能文件格式不正确或文件已损坏");const{workbookData:i,medias:o,workbookSource:h}=w(t,this.options);this.mediasSource=o,this.workbookDataSource=h,this.offset=null,this.sheetIndex=1,l(),this.xs.loadData(i),n(this.ctx,this.mediasSource,this.workbookDataSource._worksheets[this.sheetIndex],this.offset)}).catch(t=>(this.mediasSource=[],this.workbookDataSource={_worksheets:[]},l(),this.xs.loadData({}),Promise.reject(t)))}hack(){const e=x.debounce(m,200).bind(this,this.wrapperMain);this.observer=new MutationObserver(e);const t={attributes:!0,childList:!0,subtree:!0};this.observer.observe(this.wrapperMain,t),e(this.wrapperMain)}setOptions(e){this.options=e}setRequestOptions(e){this.requestOptions=e}preview(e){return new Promise((t,i)=>{f(e,this.requestOptions).then(o=>{this.renderExcel(o).then(t)}).catch(o=>{this.xs.loadData({}),i(o)})})}save(e){k(e||`js-preview-excel-${new Date().getTime()}.xlsx`,this.fileData)}destroy(){this.observer.disconnect(),this.container.removeChild(this.wrapper),this.container=null,this.wrapper=null,this.wrapperMain=null,this.ctx=null,this.xs=null,this.observer=null,this.options=null,this.requestOptions=null,this.mediasSource=null,this.workbookDataSource=null}}function g(r,e,t){return new E(r,e,t)}const O={init:g},T={__name:"JsExcelDemo",setup(r){const e=v(null);return b(()=>{window.myExcelPreview=O.init(e.value,{}),window.myExcelPreview.preview("/vue-office/examples/dist/static/test-files/test.xlsx").then(t=>{console.log("excel preview done",window.myExcelPreview)}).catch(t=>{console.log("err",t)})}),(t,i)=>(S(),D("div",{ref_key:"dom",ref:e,style:{height:"calc(100vh - 50px)"}},null,512))}};export{T as default};
|
1
examples/dist/assets/JsExcelDemo-da6c7b53.js
vendored
Normal file
1
examples/dist/assets/JsExcelDemo-da6c7b53.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var c=Object.defineProperty;var p=(r,e,t)=>e in r?c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>(p(r,typeof e!="symbol"?e+"":e,t),t);import{S as u,a as n,b as d,t as w,c as l,l as x,r as m,g as f}from"./hack-2409615a.js";import{d as k}from"./url-de9b02cf.js";/* empty css */import{r as v,o as b,a as S,c as D}from"./index-11290fb6.js";import"./_commonjs-dynamic-modules-302442b1.js";const _={minColLength:20};class E{constructor(e,t={},i={}){s(this,"container",null);s(this,"wrapper",null);s(this,"wrapperMain",null);s(this,"options",{});s(this,"requestOptions",{});s(this,"mediasSource",[]);s(this,"workbookDataSource",{_worksheets:[]});s(this,"sheetIndex",1);s(this,"ctx",null);s(this,"xs",null);s(this,"offset",null);s(this,"observer",null);s(this,"fileData",null);this.container=e,this.options={..._,...t},this.requestOptions=i,this.createWrapper(),this.initSpreadsheet(),this.hack()}createWrapper(){this.wrapper=document.createElement("div"),this.wrapper.className="vue-office-excel",this.wrapperMain=document.createElement("div"),this.wrapperMain.className="vue-office-excel-main",this.wrapper.appendChild(this.wrapperMain),this.container.appendChild(this.wrapper)}initSpreadsheet(){this.xs=new u(this.wrapperMain,{mode:"read",showToolbar:!1,showContextmenu:this.options.showContextmenu||!1,view:{height:()=>this.wrapper&&this.wrapper.clientHeight||300,width:()=>this.wrapper&&this.wrapper.clientWidth||1200},row:{height:24,len:100},col:{len:26,width:80,indexWidth:60,minWidth:60},autoFocus:!1}).loadData({});let e=this,t=this.xs.bottombar.swapFunc;this.xs.bottombar.swapFunc=function(a){t.call(e.xs.bottombar,a),e.sheetIndex=a+1,setTimeout(()=>{e.xs.reRender(),n(e.ctx,e.mediasSource,e.workbookDataSource._worksheets[e.sheetIndex],e.offset)})};let i=this.xs.sheet.editor.clear;this.xs.sheet.editor.clear=function(...a){i.apply(e.xs.sheet.editor,a),setTimeout(()=>{n(e.ctx,e.mediasSource,e.workbookDataSource._worksheets[e.sheetIndex],e.offset)})};let o=this.xs.sheet.editor.setOffset;this.xs.sheet.editor.setOffset=function(...a){o.apply(e.xs.sheet.editor,a),e.offset=a[0],n(e.ctx,e.mediasSource,e.workbookDataSource._worksheets[e.sheetIndex],e.offset)};const h=this.wrapperMain.querySelector("canvas");this.ctx=h.getContext("2d")}renderExcel(e){return this.fileData=e,d(e).then(t=>{if(!t._worksheets||t._worksheets.length===0)throw new Error("未获取到数据,可能文件格式不正确或文件已损坏");const{workbookData:i,medias:o,workbookSource:h}=w(t,this.options);this.mediasSource=o,this.workbookDataSource=h,this.offset=null,this.sheetIndex=1,l(),this.xs.loadData(i),n(this.ctx,this.mediasSource,this.workbookDataSource._worksheets[this.sheetIndex],this.offset)}).catch(t=>(this.mediasSource=[],this.workbookDataSource={_worksheets:[]},l(),this.xs.loadData({}),Promise.reject(t)))}hack(){const e=x.debounce(m,200).bind(this,this.wrapperMain);this.observer=new MutationObserver(e);const t={attributes:!0,childList:!0,subtree:!0};this.observer.observe(this.wrapperMain,t),e(this.wrapperMain)}setOptions(e){this.options=e}setRequestOptions(e){this.requestOptions=e}preview(e){return new Promise((t,i)=>{f(e,this.requestOptions).then(o=>{this.renderExcel(o).then(t)}).catch(o=>{this.xs.loadData({}),i(o)})})}save(e){k(e||`js-preview-excel-${new Date().getTime()}.xlsx`,this.fileData)}destroy(){this.observer.disconnect(),this.container.removeChild(this.wrapper),this.container=null,this.wrapper=null,this.wrapperMain=null,this.ctx=null,this.xs=null,this.observer=null,this.options=null,this.requestOptions=null,this.mediasSource=null,this.workbookDataSource=null}}function g(r,e,t){return new E(r,e,t)}const O={init:g},T={__name:"JsExcelDemo",setup(r){const e=v(null);return b(()=>{window.myExcelPreview=O.init(e.value,{}),window.myExcelPreview.preview("/vue-office/examples/dist/static/test-files/test.xlsx").then(t=>{console.log("excel preview done",window.myExcelPreview)}).catch(t=>{console.log("err",t)})}),(t,i)=>(S(),D("div",{ref_key:"dom",ref:e,style:{height:"calc(100vh - 50px)"}},null,512))}};export{T as default};
|
1
examples/dist/assets/JsPdfDemo-725fde6e.js
vendored
Normal file
1
examples/dist/assets/JsPdfDemo-725fde6e.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
examples/dist/assets/JsPdfDemo-aad1d8f0.js
vendored
Normal file
1
examples/dist/assets/JsPdfDemo-aad1d8f0.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
examples/dist/assets/JsPdfDemo-e01b6abb.js
vendored
Normal file
1
examples/dist/assets/JsPdfDemo-e01b6abb.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
examples/dist/assets/PdfDemo-711b6389.js
vendored
Normal file
1
examples/dist/assets/PdfDemo-711b6389.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
examples/dist/assets/PdfDemo-7f00ec2b.js
vendored
Normal file
1
examples/dist/assets/PdfDemo-7f00ec2b.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
examples/dist/assets/PdfDemo-d33183d4.js
vendored
Normal file
1
examples/dist/assets/PdfDemo-d33183d4.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
examples/dist/assets/PreviewWrapper-95ad6bf9.js
vendored
Normal file
1
examples/dist/assets/PreviewWrapper-95ad6bf9.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import{r as d,m as C,_ as I,w as N,p as l,a as p,c as x,u as t,g as i,f as n,q as v,s as S,e as y,l as m,t as V,v as W,x as A,b as R}from"./index-11290fb6.js";function T(e){const s=d("url"),a=d(e),r=d(e),u=d([]);function b(w){let c=new FileReader;return c.onload=o=>{let _=o.target.result;r.value=_},c.readAsArrayBuffer(w),!1}return{type:s,inputSrc:a,src:r,fileList:u,beforeUpload:b}}let g=d(!1),k;function $(e){k=C.loading(e,0),g.value=!0}function q(){g.value===!0&&(k(),g.value=!1)}const E={loading:g,showLoading:$,hideLoading:q};function F(){return location.href.includes("test")}const j=e=>(W("data-v-6e0b6946"),e=e(),A(),e),z={class:"preview-wrapper"},D={key:0,class:"operate-area"},G=j(()=>R("div",{class:"preview-wrapper-main"},null,-1)),H={__name:"PreviewWrapper",props:{accept:String,placeholder:String,defaultSrc:String},setup(e){const s=e,{type:a,inputSrc:r,src:u,fileList:b,beforeUpload:w}=T(s.defaultSrc);return N(u,()=>{E.showLoading()},{immediate:!0}),(c,o)=>{const _=l("a-radio-button"),B=l("a-radio-group"),L=l("a-input"),h=l("a-button"),U=l("upload-outlined"),P=l("a-upload");return p(),x("div",z,[t(F)()?m("",!0):(p(),x("div",D,[i(B,{value:t(a),"onUpdate:value":o[0]||(o[0]=f=>S(a)?a.value=f:null),"button-style":"solid"},{default:n(()=>[i(_,{value:"url"},{default:n(()=>[v("远程文件地址")]),_:1}),i(_,{value:"upload"},{default:n(()=>[v("上传本地文件")]),_:1})]),_:1},8,["value"]),t(a)==="url"?(p(),y(L,{key:0,value:t(r),"onUpdate:value":o[1]||(o[1]=f=>S(r)?r.value=f:null),placeholder:s.placeholder,style:{width:"600px","margin-left":"10px"}},null,8,["value","placeholder"])):m("",!0),t(a)==="url"?(p(),y(h,{key:1,type:"primary",style:{"margin-left":"10px"},onClick:o[2]||(o[2]=f=>u.value=t(r))},{default:n(()=>[v(" 预览 ")]),_:1})):m("",!0),t(a)!=="url"?(p(),y(P,{key:2,accept:s.accept,action:"",beforeUpload:t(w),"file-list":[]},{default:n(()=>[i(h,{style:{"margin-left":"10px"}},{default:n(()=>[i(U),v(" 选择文件 ")]),_:1})]),_:1},8,["accept","beforeUpload"])):m("",!0)])),V(c.$slots,"default",{src:t(u)},void 0,!0),G])}}},K=I(H,[["__scopeId","data-v-6e0b6946"]]);export{K as P,E as u};
|
1
examples/dist/assets/PreviewWrapper-b7a4e640.js
vendored
Normal file
1
examples/dist/assets/PreviewWrapper-b7a4e640.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import{r as d,m as C,_ as I,w as N,p as l,a as p,c as x,u as t,g as i,f as n,q as v,s as S,e as y,l as m,t as V,v as W,x as A,b as R}from"./index-c8d88308.js";function T(e){const s=d("url"),a=d(e),r=d(e),u=d([]);function b(w){let c=new FileReader;return c.onload=o=>{let _=o.target.result;r.value=_},c.readAsArrayBuffer(w),!1}return{type:s,inputSrc:a,src:r,fileList:u,beforeUpload:b}}let g=d(!1),k;function $(e){k=C.loading(e,0),g.value=!0}function q(){g.value===!0&&(k(),g.value=!1)}const E={loading:g,showLoading:$,hideLoading:q};function F(){return location.href.includes("test")}const j=e=>(W("data-v-6e0b6946"),e=e(),A(),e),z={class:"preview-wrapper"},D={key:0,class:"operate-area"},G=j(()=>R("div",{class:"preview-wrapper-main"},null,-1)),H={__name:"PreviewWrapper",props:{accept:String,placeholder:String,defaultSrc:String},setup(e){const s=e,{type:a,inputSrc:r,src:u,fileList:b,beforeUpload:w}=T(s.defaultSrc);return N(u,()=>{E.showLoading()},{immediate:!0}),(c,o)=>{const _=l("a-radio-button"),B=l("a-radio-group"),L=l("a-input"),h=l("a-button"),U=l("upload-outlined"),P=l("a-upload");return p(),x("div",z,[t(F)()?m("",!0):(p(),x("div",D,[i(B,{value:t(a),"onUpdate:value":o[0]||(o[0]=f=>S(a)?a.value=f:null),"button-style":"solid"},{default:n(()=>[i(_,{value:"url"},{default:n(()=>[v("远程文件地址")]),_:1}),i(_,{value:"upload"},{default:n(()=>[v("上传本地文件")]),_:1})]),_:1},8,["value"]),t(a)==="url"?(p(),y(L,{key:0,value:t(r),"onUpdate:value":o[1]||(o[1]=f=>S(r)?r.value=f:null),placeholder:s.placeholder,style:{width:"600px","margin-left":"10px"}},null,8,["value","placeholder"])):m("",!0),t(a)==="url"?(p(),y(h,{key:1,type:"primary",style:{"margin-left":"10px"},onClick:o[2]||(o[2]=f=>u.value=t(r))},{default:n(()=>[v(" 预览 ")]),_:1})):m("",!0),t(a)!=="url"?(p(),y(P,{key:2,accept:s.accept,action:"",beforeUpload:t(w),"file-list":[]},{default:n(()=>[i(h,{style:{"margin-left":"10px"}},{default:n(()=>[i(U),v(" 选择文件 ")]),_:1})]),_:1},8,["accept","beforeUpload"])):m("",!0)])),V(c.$slots,"default",{src:t(u)},void 0,!0),G])}}},K=I(H,[["__scopeId","data-v-6e0b6946"]]);export{K as P,E as u};
|
1
examples/dist/assets/PreviewWrapper-c0fee36e.js
vendored
Normal file
1
examples/dist/assets/PreviewWrapper-c0fee36e.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import{r as d,m as C,_ as I,w as N,p as l,a as p,c as x,u as t,g as i,f as n,q as v,s as S,e as y,l as m,t as V,v as W,x as A,b as R}from"./index-80932b39.js";function T(e){const s=d("url"),a=d(e),r=d(e),u=d([]);function b(w){let c=new FileReader;return c.onload=o=>{let _=o.target.result;r.value=_},c.readAsArrayBuffer(w),!1}return{type:s,inputSrc:a,src:r,fileList:u,beforeUpload:b}}let g=d(!1),k;function $(e){k=C.loading(e,0),g.value=!0}function q(){g.value===!0&&(k(),g.value=!1)}const E={loading:g,showLoading:$,hideLoading:q};function F(){return location.href.includes("test")}const j=e=>(W("data-v-6e0b6946"),e=e(),A(),e),z={class:"preview-wrapper"},D={key:0,class:"operate-area"},G=j(()=>R("div",{class:"preview-wrapper-main"},null,-1)),H={__name:"PreviewWrapper",props:{accept:String,placeholder:String,defaultSrc:String},setup(e){const s=e,{type:a,inputSrc:r,src:u,fileList:b,beforeUpload:w}=T(s.defaultSrc);return N(u,()=>{E.showLoading()},{immediate:!0}),(c,o)=>{const _=l("a-radio-button"),B=l("a-radio-group"),L=l("a-input"),h=l("a-button"),U=l("upload-outlined"),P=l("a-upload");return p(),x("div",z,[t(F)()?m("",!0):(p(),x("div",D,[i(B,{value:t(a),"onUpdate:value":o[0]||(o[0]=f=>S(a)?a.value=f:null),"button-style":"solid"},{default:n(()=>[i(_,{value:"url"},{default:n(()=>[v("远程文件地址")]),_:1}),i(_,{value:"upload"},{default:n(()=>[v("上传本地文件")]),_:1})]),_:1},8,["value"]),t(a)==="url"?(p(),y(L,{key:0,value:t(r),"onUpdate:value":o[1]||(o[1]=f=>S(r)?r.value=f:null),placeholder:s.placeholder,style:{width:"600px","margin-left":"10px"}},null,8,["value","placeholder"])):m("",!0),t(a)==="url"?(p(),y(h,{key:1,type:"primary",style:{"margin-left":"10px"},onClick:o[2]||(o[2]=f=>u.value=t(r))},{default:n(()=>[v(" 预览 ")]),_:1})):m("",!0),t(a)!=="url"?(p(),y(P,{key:2,accept:s.accept,action:"",beforeUpload:t(w),"file-list":[]},{default:n(()=>[i(h,{style:{"margin-left":"10px"}},{default:n(()=>[i(U),v(" 选择文件 ")]),_:1})]),_:1},8,["accept","beforeUpload"])):m("",!0)])),V(c.$slots,"default",{src:t(u)},void 0,!0),G])}}},K=I(H,[["__scopeId","data-v-6e0b6946"]]);export{K as P,E as u};
|
96
examples/dist/assets/docx-a0687961.js
vendored
Normal file
96
examples/dist/assets/docx-a0687961.js
vendored
Normal file
File diff suppressed because one or more lines are too long
96
examples/dist/assets/docx-a4764915.js
vendored
Normal file
96
examples/dist/assets/docx-a4764915.js
vendored
Normal file
File diff suppressed because one or more lines are too long
96
examples/dist/assets/docx-f7736cac.js
vendored
Normal file
96
examples/dist/assets/docx-f7736cac.js
vendored
Normal file
File diff suppressed because one or more lines are too long
99
examples/dist/assets/hack-2409615a.js
vendored
Normal file
99
examples/dist/assets/hack-2409615a.js
vendored
Normal file
File diff suppressed because one or more lines are too long
99
examples/dist/assets/hack-354e39e4.js
vendored
Normal file
99
examples/dist/assets/hack-354e39e4.js
vendored
Normal file
File diff suppressed because one or more lines are too long
99
examples/dist/assets/hack-6a7812ef.js
vendored
Normal file
99
examples/dist/assets/hack-6a7812ef.js
vendored
Normal file
File diff suppressed because one or more lines are too long
121
examples/dist/assets/index-11290fb6.js
vendored
Normal file
121
examples/dist/assets/index-11290fb6.js
vendored
Normal file
File diff suppressed because one or more lines are too long
121
examples/dist/assets/index-80932b39.js
vendored
Normal file
121
examples/dist/assets/index-80932b39.js
vendored
Normal file
File diff suppressed because one or more lines are too long
121
examples/dist/assets/index-c8d88308.js
vendored
Normal file
121
examples/dist/assets/index-c8d88308.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
examples/dist/assets/omit-481a4757.js
vendored
Normal file
1
examples/dist/assets/omit-481a4757.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
examples/dist/assets/omit-7d7c3e22.js
vendored
Normal file
1
examples/dist/assets/omit-7d7c3e22.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
examples/dist/assets/omit-98776422.js
vendored
Normal file
1
examples/dist/assets/omit-98776422.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
examples/dist/index.html
vendored
2
examples/dist/index.html
vendored
@ -7,7 +7,7 @@
|
||||
content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<title>@vue-office演示demo</title>
|
||||
<script type="module" crossorigin src="/vue-office/examples/dist/assets/index-68a00e4b.js"></script>
|
||||
<script type="module" crossorigin src="/vue-office/examples/dist/assets/index-c8d88308.js"></script>
|
||||
<link rel="stylesheet" href="/vue-office/examples/dist/assets/index-cc8fb346.css">
|
||||
</head>
|
||||
<body>
|
||||
|
Loading…
x
Reference in New Issue
Block a user