@lingshugroup/web-plus 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/lib/index.css +1 -1
  2. package/lib/index.css.br +0 -0
  3. package/lib/index.css.gz +0 -0
  4. package/lib/packages/ls-components/components/icon/Index.vue/index.cjs +1 -1
  5. package/lib/packages/ls-components/components/icon/Index.vue/index.js +2 -2
  6. package/lib/packages/ls-components/components/icon/Index.vue/index2.cjs +1 -1
  7. package/lib/packages/ls-components/components/icon/Index.vue/index2.js +16 -15
  8. package/lib/packages/ls-components/components/icon/Index.vue/index2.js.br +0 -0
  9. package/lib/packages/ls-components/components/icon/Index.vue/index2.js.gz +0 -0
  10. package/lib/packages/ls-components/components/preview_docx/Docx.vue/index.cjs +1 -1
  11. package/lib/packages/ls-components/components/preview_docx/Docx.vue/index.js +2 -2
  12. package/lib/packages/ls-components/components/preview_docx/Docx.vue/index2.cjs +1 -1
  13. package/lib/packages/ls-components/components/preview_docx/Docx.vue/index2.js +54 -39
  14. package/lib/packages/ls-components/components/preview_docx/Docx.vue/index2.js.br +0 -0
  15. package/lib/packages/ls-components/components/preview_docx/Docx.vue/index2.js.gz +0 -0
  16. package/lib/packages/ls-components/components/preview_docx/Index.vue/index.cjs +1 -1
  17. package/lib/packages/ls-components/components/preview_docx/Index.vue/index.js +2 -2
  18. package/lib/packages/ls-components/components/preview_docx/Index.vue/index2.cjs +1 -1
  19. package/lib/packages/ls-components/components/preview_docx/Index.vue/index2.js +30 -27
  20. package/lib/packages/ls-components/components/preview_docx/Index.vue/index2.js.br +0 -0
  21. package/lib/packages/ls-components/components/preview_docx/Index.vue/index2.js.gz +0 -0
  22. package/lib/packages/ls-components/components/preview_image/Image.vue/index.cjs +1 -1
  23. package/lib/packages/ls-components/components/preview_image/Image.vue/index.js +2 -2
  24. package/lib/packages/ls-components/components/preview_image/Image.vue/index2.cjs +1 -1
  25. package/lib/packages/ls-components/components/preview_image/Image.vue/index2.js +132 -131
  26. package/lib/packages/ls-components/components/preview_image/Image.vue/index2.js.br +0 -0
  27. package/lib/packages/ls-components/components/preview_image/Image.vue/index2.js.gz +0 -0
  28. package/lib/packages/ls-components/components/preview_image/Index.vue/index.cjs +1 -1
  29. package/lib/packages/ls-components/components/preview_image/Index.vue/index.js +2 -2
  30. package/lib/packages/ls-components/components/preview_image/Index.vue/index2.cjs +1 -1
  31. package/lib/packages/ls-components/components/preview_image/Index.vue/index2.js +33 -30
  32. package/lib/packages/ls-components/components/preview_image/Index.vue/index2.js.br +0 -0
  33. package/lib/packages/ls-components/components/preview_image/Index.vue/index2.js.gz +0 -0
  34. package/lib/packages/ls-components/components/preview_pdf/Index.vue/index.cjs +1 -1
  35. package/lib/packages/ls-components/components/preview_pdf/Index.vue/index.js +1 -1
  36. package/lib/packages/ls-components/components/preview_pdf/Index.vue/index2.cjs +1 -1
  37. package/lib/packages/ls-components/components/preview_pdf/Index.vue/index2.js +31 -27
  38. package/lib/packages/ls-components/components/preview_pdf/Index.vue/index2.js.br +0 -0
  39. package/lib/packages/ls-components/components/preview_pdf/Index.vue/index2.js.gz +0 -0
  40. package/lib/packages/ls-components/components/preview_pdf/Pdf.vue/index.cjs +1 -1
  41. package/lib/packages/ls-components/components/preview_pdf/Pdf.vue/index.js +3 -3
  42. package/lib/packages/ls-components/components/preview_pdf/Pdf.vue/index2.cjs +1 -1
  43. package/lib/packages/ls-components/components/preview_pdf/Pdf.vue/index2.js +132 -116
  44. package/lib/packages/ls-components/components/preview_pdf/Pdf.vue/index2.js.br +0 -0
  45. package/lib/packages/ls-components/components/preview_pdf/Pdf.vue/index2.js.gz +0 -0
  46. package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index.cjs +1 -1
  47. package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index.js +3 -3
  48. package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index2.cjs +1 -1
  49. package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index2.js +25 -22
  50. package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index2.js.br +0 -0
  51. package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index2.js.gz +0 -0
  52. package/lib/packages/ls-components/components/preview_xlsx/Xlsx.vue/index.cjs +1 -1
  53. package/lib/packages/ls-components/components/preview_xlsx/Xlsx.vue/index.js +1 -1
  54. package/lib/packages/ls-components/components/preview_xlsx/Xlsx.vue/index2.cjs +1 -1
  55. package/lib/packages/ls-components/components/preview_xlsx/Xlsx.vue/index2.js +124 -108
  56. package/lib/packages/ls-components/components/preview_xlsx/Xlsx.vue/index2.js.br +0 -0
  57. package/lib/packages/ls-components/components/preview_xlsx/Xlsx.vue/index2.js.gz +0 -0
  58. package/package.json +1 -1
@@ -1,19 +1,19 @@
1
- var P = Object.defineProperty;
2
- var l = (o, t) => P(o, "name", { value: t, configurable: !0 });
1
+ var V = Object.defineProperty;
2
+ var l = (r, t) => V(r, "name", { value: t, configurable: !0 });
3
3
  /* empty css */
4
- import { defineComponent as C, mergeModels as f, useModel as V, createElementBlock as _, createCommentVNode as g, openBlock as a, normalizeClass as h, unref as e, createBlock as k, mergeProps as m, withCtx as B, createVNode as S } from "vue";
5
- import s from "../Xlsx.vue/index.js";
6
- import M from "../../_hooks/usePreviewHook/index.js";
4
+ import { defineComponent as v, mergeModels as f, useModel as _, createElementBlock as P, createCommentVNode as h, openBlock as a, normalizeClass as S, unref as e, createBlock as k, createElementVNode as g, mergeProps as s, withCtx as B, createVNode as x, renderSlot as M } from "vue";
5
+ import m from "../Xlsx.vue/index.js";
6
+ import N from "../../_hooks/usePreviewHook/index.js";
7
7
  import { lsPreviewProp as X } from "../../_constants/previewType/index.js";
8
- import { ElWatermark as x } from "../../../../../node_modules/.pnpm/element-plus@2.10.7_vue@3.5.18_typescript@5.9.2_/node_modules/element-plus/es/components/watermark/index/index.js";
8
+ import { ElWatermark as $ } from "../../../../../node_modules/.pnpm/element-plus@2.10.7_vue@3.5.18_typescript@5.9.2_/node_modules/element-plus/es/components/watermark/index/index.js";
9
9
  import w from "../../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/merge/index.js";
10
- const A = C({
10
+ const A = { class: "ls-preview-extra" }, W = v({
11
11
  name: "LSPreviewXlsx"
12
- }), D = /* @__PURE__ */ C({
13
- ...A,
12
+ }), I = /* @__PURE__ */ v({
13
+ ...W,
14
14
  name: "LSPreviewXlsx",
15
15
  components: {
16
- LSXlsx: s
16
+ LSXlsx: m
17
17
  },
18
18
  inheritAttrs: !1,
19
19
  props: /* @__PURE__ */ f(X, {
@@ -23,34 +23,37 @@ const A = C({
23
23
  modelModifiers: {}
24
24
  }),
25
25
  emits: /* @__PURE__ */ f(["loadComplete", "loadError"], ["update:modelValue"]),
26
- setup(o, { emit: t }) {
27
- const n = t, L = o, i = V(o, "modelValue"), { comClass: v, defAttrs: d, closeLoading: p, watermarkStyle: y } = M(L, i), c = /* @__PURE__ */ l(() => {
26
+ setup(r, { emit: t }) {
27
+ const n = t, C = r, d = _(r, "modelValue"), { comClass: E, defAttrs: i, closeLoading: p, watermarkStyle: L } = N(C, d), c = /* @__PURE__ */ l(() => {
28
28
  p(), n("loadComplete");
29
29
  }, "loadComplete"), u = /* @__PURE__ */ l(() => {
30
30
  p(), n("loadError");
31
31
  }, "loadError");
32
- return (r, N) => {
33
- const E = x;
34
- return i.value ? (a(), _("div", {
32
+ return (o, b) => {
33
+ const y = $;
34
+ return d.value ? (a(), P("div", {
35
35
  key: 0,
36
- class: h(e(v))
36
+ class: S(e(E))
37
37
  }, [
38
- r.showWatermark ? (a(), k(E, m({ key: 0 }, r.watermarkOption, { style: e(y) }), {
38
+ o.showWatermark ? (a(), k(y, s({ key: 0 }, o.watermarkOption, { style: e(L) }), {
39
39
  default: B(() => [
40
- S(s, m(e(w)(e(d), r.$attrs), {
40
+ x(m, s(e(w)(e(i), o.$attrs), {
41
41
  onLoadComplete: c,
42
42
  onLoadError: u
43
43
  }), null, 16)
44
44
  ]),
45
45
  _: 1
46
- }, 16, ["style"])) : (a(), k(s, m({ key: 1 }, e(w)(e(d), r.$attrs), {
46
+ }, 16, ["style"])) : (a(), k(m, s({ key: 1 }, e(w)(e(i), o.$attrs), {
47
47
  onLoadComplete: c,
48
48
  onLoadError: u
49
- }), null, 16))
50
- ], 2)) : g("", !0);
49
+ }), null, 16)),
50
+ g("div", A, [
51
+ M(o.$slots, "extra", {}, void 0, !0)
52
+ ])
53
+ ], 2)) : h("", !0);
51
54
  };
52
55
  }
53
56
  });
54
57
  export {
55
- D as default
58
+ I as default
56
59
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */;/* empty css */const t=/* empty css */u=t.default(e.default,[["__scopeId","data-v-0dfd277f"]]);exports.default=u;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */;/* empty css */const t=/* empty css */u=t.default(e.default,[["__scopeId","data-v-2de14eeb"]]);exports.default=u;
@@ -2,7 +2,7 @@ import o from "./index2.js";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  import t from "../../../../../_virtual/_plugin-vue_export-helper/index.js";
5
- const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-0dfd277f"]]);
5
+ const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-2de14eeb"]]);
6
6
  export {
7
7
  s as default
8
8
  };
@@ -1 +1 @@
1
- "use strict";var G=Object.defineProperty;var c=(S,L)=>G(S,"name",{value:L,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),H=/* empty css */J=/* empty css */M=/* empty css */C=/* empty css */K=/* empty css */F=/* empty css */Q=require("luckyexcel"),s=;/* empty css */;/* empty css */;/* empty css */;/* empty css */const I=/* empty css */W=t.defineComponent({name:"LSXlsx"}),Y=t.defineComponent({...W,props:J.xlsxProps,emits:M.previewEmits,setup(S,{emit:L}){const x=H.useNamespace("xlsx"),j=x.b(),f=S,i=L;t.watch(()=>f.source,e=>{if(e){const{size:r}=e||{};r/1024/1024<=s.fileSizeLimit?A(e):f.hasPagination?X(e):(I.ElMessage.error(`文件大小超过 ${s.fileSizeLimit} MB,加载失败!`),i("loadComplete"))}},{immediate:!0,deep:!0});const E=t.ref(!1);function P(){const e=document.scripts;for(let r=0;r<e.length;r++)if(e[r].src.includes("luckysheet"))return!0;return!1}c(P,"isLuckySheet");const R=c(()=>{f.onClose&&f.onClose(),i("update:source",[])},"closeFunc");async function A(e){let r=!1;if(await _(e))try{Q.transformExcelToLucky(e,function(n){if(n.sheets==null){i("loadError");return}window.luckysheet.destroy(),window.luckysheet.create({data:n.sheets,title:n.info.name,...s.luckysheetConfig}),r=!0,i("loadComplete")});let a=setTimeout(()=>{r||(I.ElMessage.error(M.fileEmpty),i("loadError"),clearTimeout(a))},6e3)}catch{i("loadError")}}c(A,"initXlsx");function V(e){const r=Math.min(0+s.rowsPerBatch,e.length),a=e.slice(0,r);let n=0;const o=[[]];return window.luckysheet.transToCellData(a).forEach(l=>{const{r:h}=l;n!==h&&(n=h,o[n]=[]),o[n].push(l)}),o}c(V,"getSheetData");async function X(e){if(await t.nextTick(),!!await _(e))try{const r=new FileReader;r.onload=async function(a){var b,D;const n=F.read(a.target.result,{type:"binary",dense:!0});let o=0;const l=(n.SheetNames||[]).map(u=>({name:u,data:F.utils.sheet_to_json(n.Sheets[u],{header:1})})),h=t.ref((b=l[o])==null?void 0:b.name),m=t.ref((D=l[o])==null?void 0:D.data);let p=m.value.length,v=0;const U=(l||[]).map((u,y)=>({name:u.name,index:y+1,status:"1",order:y,data:V(u.data)}));function T(){if(v*s.rowsPerBatch>=p)return;const u=v*s.rowsPerBatch,y=Math.min(u+s.rowsPerBatch,p),$=m.value.slice(u,y);let w=0;const q=[[]];if(window.luckysheet.transToCellData($).forEach(k=>{const{r:d}=k;w!==d&&(w=d,q[w]=[]),q[w].push(k)}),E.value)window.luckysheet.updataSheet({data:[{name:h,index:o+1,status:"1",order:o,data:q}]});else{window.luckysheet.destroy();const k={...s.luckysheetConfig,hook:{sheetActivate(d){var g,N,z;if(o!=d){o=d-1,h.value=(g=l[o])==null?void 0:g.name,m.value=((N=l[o])==null?void 0:N.data)||[],p=m.value.length;const B=(z=document.getElementById("luckysheet"))==null?void 0:z.querySelector('.spage-number button[data-page="1"]');B==null||B.click()}},onTogglePager(d){const{page:g}=d;v=g-1,T()}}};window.luckysheet.create({data:U,pager:{pageIndex:1,total:p,pageSize:s.rowsPerBatch,showTotal:!0,showSkip:!0,showPN:!0,prevPage:"",nextPage:"",totalTxt:""},...k}),E.value=!0}i("loadComplete")}c(T,"loadBatch"),T()},r.readAsArrayBuffer(e)}catch{i("loadError")}}c(X,"initXlsxLarge");async function _(e){return!e||!K.isFile(e)?!1:(P()||(await C.loadCss(s.cssList),await C.loadJs(s.jsList)),!0)}c(_,"initLuckySheet");function O(){E.value&&window.luckysheet.destroy(),P()&&(C.removeCss(s.cssList),C.removeJs(s.jsList))}return c(O,"resetLuckySheet"),t.onBeforeUnmount(()=>{O()}),(e,r)=>{const a=t.resolveComponent("LSIcon");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(j))},[t.createElementVNode("span",{class:t.normalizeClass([t.unref(x).e("btn"),t.unref(x).e("close")]),onClick:R},[t.createVNode(a,{name:"Close",size:24,color:"#FFF"})],2),r[0]||(r[0]=t.createElementVNode("div",{id:"luckysheet",class:"luckysheet-wrap"},null,-1))],2)}}});exports.default=Y;
1
+ "use strict";var Q=Object.defineProperty;var c=(v,x)=>Q(v,"name",{value:x,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),W=/* empty css */Y=/* empty css */I=/* empty css */L=/* empty css */Z=/* empty css */V=/* empty css */ee=require("luckyexcel"),n=;/* empty css */;/* empty css */;/* empty css */;/* empty css */const j=/* empty css */te=e.defineComponent({name:"LSXlsx"}),oe=e.defineComponent({...te,props:Y.xlsxProps,emits:I.previewEmits,setup(v,{emit:x}){const f=W.useNamespace("xlsx"),A=f.b(),w=v,l=x,h=e.useAttrs(),R=e.computed(()=>h["has-download"]||h.hasDownload),P=e.computed(()=>h["download-loading"]||h.downloadLoading||!1);e.watch(()=>w.source,t=>{if(t){const{size:o}=t||{};o/1024/1024<=n.fileSizeLimit?$(t):w.hasPagination?U(t):(j.ElMessage.error(`文件大小超过 ${n.fileSizeLimit} MB,加载失败!`),l("loadComplete"))}},{immediate:!0,deep:!0});const E=e.ref(!1);function _(){const t=document.scripts;for(let o=0;o<t.length;o++)if(t[o].src.includes("luckysheet"))return!0;return!1}c(_,"isLuckySheet");const X=c(()=>{w.onClose&&w.onClose(),l("update:source",[])},"closeFunc");async function $(t){let o=!1;if(await b(t))try{ee.transformExcelToLucky(t,function(r){if(r.sheets==null){l("loadError");return}window.luckysheet.destroy(),window.luckysheet.create({data:r.sheets,title:r.info.name,...n.luckysheetConfig}),o=!0,l("loadComplete")});let a=setTimeout(()=>{o||(j.ElMessage.error(I.fileEmpty),l("loadError"),clearTimeout(a))},6e3)}catch{l("loadError")}}c($,"initXlsx");function O(t){const o=Math.min(0+n.rowsPerBatch,t.length),a=t.slice(0,o);let r=0;const s=[[]];return window.luckysheet.transToCellData(a).forEach(i=>{const{r:m}=i;r!==m&&(r=m,s[r]=[]),s[r].push(i)}),s}c(O,"getSheetData");async function U(t){if(await e.nextTick(),!!await b(t))try{const o=new FileReader;o.onload=async function(a){var z,N;const r=V.read(a.target.result,{type:"binary",dense:!0});let s=0;const i=(r.SheetNames||[]).map(u=>({name:u,data:V.utils.sheet_to_json(r.Sheets[u],{header:1})})),m=e.ref((z=i[s])==null?void 0:z.name),p=e.ref((N=i[s])==null?void 0:N.data);let y=p.value.length,D=0;const J=(i||[]).map((u,k)=>({name:u.name,index:k+1,status:"1",order:k,data:O(u.data)}));function T(){if(D*n.rowsPerBatch>=y)return;const u=D*n.rowsPerBatch,k=Math.min(u+n.rowsPerBatch,y),K=p.value.slice(u,k);let g=0;const q=[[]];if(window.luckysheet.transToCellData(K).forEach(C=>{const{r:d}=C;g!==d&&(g=d,q[g]=[]),q[g].push(C)}),E.value)window.luckysheet.updataSheet({data:[{name:m,index:s+1,status:"1",order:s,data:q}]});else{window.luckysheet.destroy();const C={...n.luckysheetConfig,hook:{sheetActivate(d){var S,F,M;if(s!=d){s=d-1,m.value=(S=i[s])==null?void 0:S.name,p.value=((F=i[s])==null?void 0:F.data)||[],y=p.value.length;const B=(M=document.getElementById("luckysheet"))==null?void 0:M.querySelector('.spage-number button[data-page="1"]');B==null||B.click()}},onTogglePager(d){const{page:S}=d;D=S-1,T()}}};window.luckysheet.create({data:J,pager:{pageIndex:1,total:y,pageSize:n.rowsPerBatch,showTotal:!0,showSkip:!0,showPN:!0,prevPage:"",nextPage:"",totalTxt:""},...C}),E.value=!0}l("loadComplete")}c(T,"loadBatch"),T()},o.readAsArrayBuffer(t)}catch{l("loadError")}}c(U,"initXlsxLarge");async function b(t){return!t||!Z.isFile(t)?!1:(_()||(await L.loadCss(n.cssList),await L.loadJs(n.jsList)),!0)}c(b,"initLuckySheet");function G(){E.value&&window.luckysheet.destroy(),_()&&(L.removeCss(n.cssList),L.removeJs(n.jsList))}c(G,"resetLuckySheet");function H(){l("download",h.downloadData)}return c(H,"onDownload"),e.onBeforeUnmount(()=>{G()}),(t,o)=>{const a=e.resolveComponent("LSIcon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(A))},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(f).e("btn"),e.unref(f).e("close")]),onClick:X},[e.createVNode(a,{name:"Close",size:24,color:"#FFF"})],2),e.unref(R)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([e.unref(f).e("btn"),e.unref(f).e("download")]),onClick:H},[e.createVNode(a,{class:e.normalizeClass({"is-loading":e.unref(P)}),name:`${e.unref(P)?"Loading":"Download"}`,size:24,color:"#FFF"},null,8,["class","name"])],2)):e.createCommentVNode("",!0),o[0]||(o[0]=e.createElementVNode("div",{id:"luckysheet",class:"luckysheet-wrap"},null,-1))],2)}}});exports.default=oe;
@@ -1,32 +1,32 @@
1
- var W = Object.defineProperty;
2
- var s = (g, C) => W(g, "name", { value: C, configurable: !0 });
3
- import { defineComponent as q, watch as Y, ref as D, nextTick as Z, onBeforeUnmount as ee, resolveComponent as te, createElementBlock as oe, openBlock as re, normalizeClass as I, unref as _, createElementVNode as M, createVNode as ae } from "vue";
4
- import { useNamespace as se } from "../../_hooks/useNamespace/index.js";
5
- import { xlsxProps as ne } from "../types/index.js";
6
- import { previewEmits as ce, fileEmpty as le } from "../../_constants/previewType/index.js";
7
- import { loadCss as ie, loadJs as ue, removeCss as me, removeJs as de } from "../../_utils/utils/index.js";
8
- import { isFile as fe } from "../../_utils/check/index.js";
9
- import { read as he, utils as pe } from "../../../../../node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx/index.js";
10
- import ye from "luckyexcel";
11
- import { fileSizeLimit as R, luckysheetConfig as A, rowsPerBatch as m, cssList as X, jsList as j } from "../config/index.js";
1
+ var re = Object.defineProperty;
2
+ var r = (x, D) => re(x, "name", { value: D, configurable: !0 });
3
+ import { defineComponent as K, useAttrs as se, computed as R, watch as ce, ref as F, nextTick as le, onBeforeUnmount as ie, resolveComponent as ue, createElementBlock as V, openBlock as X, normalizeClass as L, unref as i, createElementVNode as j, createCommentVNode as de, createVNode as $ } from "vue";
4
+ import { useNamespace as me } from "../../_hooks/useNamespace/index.js";
5
+ import { xlsxProps as fe } from "../types/index.js";
6
+ import { previewEmits as he, fileEmpty as pe } from "../../_constants/previewType/index.js";
7
+ import { loadCss as we, loadJs as ye, removeCss as ke, removeJs as ge } from "../../_utils/utils/index.js";
8
+ import { isFile as Ce } from "../../_utils/check/index.js";
9
+ import { read as Se, utils as Le } from "../../../../../node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx/index.js";
10
+ import xe from "luckyexcel";
11
+ import { fileSizeLimit as q, luckysheetConfig as U, rowsPerBatch as h, cssList as G, jsList as H } from "../config/index.js";
12
12
  /* empty css */
13
13
  /* empty css */
14
14
  /* empty css */
15
- import { ElMessage as V } from "../../../../../node_modules/.pnpm/element-plus@2.10.7_vue@3.5.18_typescript@5.9.2_/node_modules/element-plus/es/components/message/index/index.js";
16
- const we = q({
15
+ import { ElMessage as J } from "../../../../../node_modules/.pnpm/element-plus@2.10.7_vue@3.5.18_typescript@5.9.2_/node_modules/element-plus/es/components/message/index/index.js";
16
+ const De = K({
17
17
  name: "LSXlsx"
18
- }), Fe = /* @__PURE__ */ q({
19
- ...we,
20
- props: ne,
21
- emits: ce,
22
- setup(g, { emit: C }) {
23
- const S = se("xlsx"), U = S.b(), d = g, n = C;
24
- Y(
25
- () => d.source,
18
+ }), Ve = /* @__PURE__ */ K({
19
+ ...De,
20
+ props: fe,
21
+ emits: he,
22
+ setup(x, { emit: D }) {
23
+ const d = me("xlsx"), O = d.b(), p = x, s = D, m = se(), Q = R(() => m["has-download"] || m.hasDownload), T = R(() => m["download-loading"] || m.downloadLoading || !1);
24
+ ce(
25
+ () => p.source,
26
26
  (e) => {
27
27
  if (e) {
28
28
  const { size: t } = e || {};
29
- t / 1024 / 1024 <= R ? G(e) : d.hasPagination ? J(e) : (V.error(`文件大小超过 ${R} MB,加载失败!`), n("loadComplete"));
29
+ t / 1024 / 1024 <= q ? Y(e) : p.hasPagination ? ee(e) : (J.error(`文件大小超过 ${q} MB,加载失败!`), s("loadComplete"));
30
30
  }
31
31
  },
32
32
  {
@@ -34,124 +34,124 @@ const we = q({
34
34
  deep: !0
35
35
  }
36
36
  );
37
- const x = D(!1);
38
- function T() {
37
+ const E = F(!1);
38
+ function B() {
39
39
  const e = document.scripts;
40
40
  for (let t = 0; t < e.length; t++)
41
41
  if (e[t].src.includes("luckysheet"))
42
42
  return !0;
43
43
  return !1;
44
44
  }
45
- s(T, "isLuckySheet");
46
- const $ = /* @__PURE__ */ s(() => {
47
- d.onClose && d.onClose(), n("update:source", []);
45
+ r(B, "isLuckySheet");
46
+ const W = /* @__PURE__ */ r(() => {
47
+ p.onClose && p.onClose(), s("update:source", []);
48
48
  }, "closeFunc");
49
- async function G(e) {
49
+ async function Y(e) {
50
50
  let t = !1;
51
- if (await b(e))
51
+ if (await N(e))
52
52
  try {
53
- ye.transformExcelToLucky(
53
+ xe.transformExcelToLucky(
54
54
  e,
55
- function(r) {
56
- if (r.sheets == null) {
57
- n("loadError");
55
+ function(a) {
56
+ if (a.sheets == null) {
57
+ s("loadError");
58
58
  return;
59
59
  }
60
60
  window.luckysheet.destroy(), window.luckysheet.create({
61
- data: r.sheets,
62
- title: r.info.name,
63
- ...A
64
- }), t = !0, n("loadComplete");
61
+ data: a.sheets,
62
+ title: a.info.name,
63
+ ...U
64
+ }), t = !0, s("loadComplete");
65
65
  }
66
66
  );
67
- let a = setTimeout(() => {
68
- t || (V.error(le), n("loadError"), clearTimeout(a));
67
+ let n = setTimeout(() => {
68
+ t || (J.error(pe), s("loadError"), clearTimeout(n));
69
69
  }, 6e3);
70
70
  } catch {
71
- n("loadError");
71
+ s("loadError");
72
72
  }
73
73
  }
74
- s(G, "initXlsx");
75
- function H(e) {
76
- const t = Math.min(0 + m, e.length), a = e.slice(0, t);
77
- let r = 0;
74
+ r(Y, "initXlsx");
75
+ function Z(e) {
76
+ const t = Math.min(0 + h, e.length), n = e.slice(0, t);
77
+ let a = 0;
78
78
  const o = [[]];
79
- return window.luckysheet.transToCellData(a).forEach((c) => {
80
- const { r: u } = c;
81
- r !== u && (r = u, o[r] = []), o[r].push(c);
79
+ return window.luckysheet.transToCellData(n).forEach((c) => {
80
+ const { r: f } = c;
81
+ a !== f && (a = f, o[a] = []), o[a].push(c);
82
82
  }), o;
83
83
  }
84
- s(H, "getSheetData");
85
- async function J(e) {
86
- if (await Z(), !!await b(e))
84
+ r(Z, "getSheetData");
85
+ async function ee(e) {
86
+ if (await le(), !!await N(e))
87
87
  try {
88
88
  const t = new FileReader();
89
- t.onload = async function(a) {
90
- var P, F;
91
- const r = he(a.target.result, {
89
+ t.onload = async function(n) {
90
+ var z, I;
91
+ const a = Se(n.target.result, {
92
92
  type: "binary",
93
93
  dense: !0
94
94
  });
95
95
  let o = 0;
96
- const c = (r.SheetNames || []).map((l) => ({
96
+ const c = (a.SheetNames || []).map((l) => ({
97
97
  name: l,
98
- data: pe.sheet_to_json(r.Sheets[l], { header: 1 })
99
- })), u = D((P = c[o]) == null ? void 0 : P.name), f = D((F = c[o]) == null ? void 0 : F.data);
100
- let h = f.value.length, L = 0;
101
- const O = (c || []).map((l, p) => ({
98
+ data: Le.sheet_to_json(a.Sheets[l], { header: 1 })
99
+ })), f = F((z = c[o]) == null ? void 0 : z.name), w = F((I = c[o]) == null ? void 0 : I.data);
100
+ let y = w.value.length, v = 0;
101
+ const ae = (c || []).map((l, k) => ({
102
102
  name: l.name,
103
- index: p + 1,
103
+ index: k + 1,
104
104
  status: "1",
105
- order: p,
106
- data: H(l.data)
105
+ order: k,
106
+ data: Z(l.data)
107
107
  }));
108
- function B() {
109
- if (L * m >= h) return;
110
- const l = L * m, p = Math.min(l + m, h), Q = f.value.slice(l, p);
111
- let y = 0;
112
- const E = [[]];
113
- if (window.luckysheet.transToCellData(Q).forEach((w) => {
114
- const { r: i } = w;
115
- y !== i && (y = i, E[y] = []), E[y].push(w);
116
- }), x.value)
108
+ function P() {
109
+ if (v * h >= y) return;
110
+ const l = v * h, k = Math.min(l + h, y), ne = w.value.slice(l, k);
111
+ let g = 0;
112
+ const _ = [[]];
113
+ if (window.luckysheet.transToCellData(ne).forEach((C) => {
114
+ const { r: u } = C;
115
+ g !== u && (g = u, _[g] = []), _[g].push(C);
116
+ }), E.value)
117
117
  window.luckysheet.updataSheet({
118
118
  data: [
119
119
  {
120
- name: u,
120
+ name: f,
121
121
  index: o + 1,
122
122
  status: "1",
123
123
  order: o,
124
- data: E
124
+ data: _
125
125
  }
126
126
  ]
127
127
  });
128
128
  else {
129
129
  window.luckysheet.destroy();
130
- const w = {
131
- ...A,
130
+ const C = {
131
+ ...U,
132
132
  hook: {
133
- sheetActivate(i) {
134
- var k, N, z;
135
- if (o != i) {
136
- o = i - 1, u.value = (k = c[o]) == null ? void 0 : k.name, f.value = ((N = c[o]) == null ? void 0 : N.data) || [], h = f.value.length;
137
- const v = (z = document.getElementById("luckysheet")) == null ? void 0 : z.querySelector('.spage-number button[data-page="1"]');
138
- v == null || v.click();
133
+ sheetActivate(u) {
134
+ var S, A, M;
135
+ if (o != u) {
136
+ o = u - 1, f.value = (S = c[o]) == null ? void 0 : S.name, w.value = ((A = c[o]) == null ? void 0 : A.data) || [], y = w.value.length;
137
+ const b = (M = document.getElementById("luckysheet")) == null ? void 0 : M.querySelector('.spage-number button[data-page="1"]');
138
+ b == null || b.click();
139
139
  }
140
140
  },
141
- onTogglePager(i) {
142
- const { page: k } = i;
143
- L = k - 1, B();
141
+ onTogglePager(u) {
142
+ const { page: S } = u;
143
+ v = S - 1, P();
144
144
  }
145
145
  }
146
146
  };
147
147
  window.luckysheet.create({
148
- data: O,
148
+ data: ae,
149
149
  pager: {
150
150
  pageIndex: 1,
151
151
  //当前页码,必填
152
- total: h,
152
+ total: y,
153
153
  //数据总条数,必填
154
- pageSize: m,
154
+ pageSize: h,
155
155
  //每页显示多少条数据,默认10条
156
156
  showTotal: !0,
157
157
  // 是否显示总数,默认关闭:false
@@ -166,43 +166,59 @@ const we = q({
166
166
  totalTxt: ""
167
167
  // 数据总条数文字描述,默认"总共:{total}"
168
168
  },
169
- ...w
170
- }), x.value = !0;
169
+ ...C
170
+ }), E.value = !0;
171
171
  }
172
- n("loadComplete");
172
+ s("loadComplete");
173
173
  }
174
- s(B, "loadBatch"), B();
174
+ r(P, "loadBatch"), P();
175
175
  }, t.readAsArrayBuffer(e);
176
176
  } catch {
177
- n("loadError");
177
+ s("loadError");
178
178
  }
179
179
  }
180
- s(J, "initXlsxLarge");
181
- async function b(e) {
182
- return !e || !fe(e) ? !1 : (T() || (await ie(X), await ue(j)), !0);
180
+ r(ee, "initXlsxLarge");
181
+ async function N(e) {
182
+ return !e || !Ce(e) ? !1 : (B() || (await we(G), await ye(H)), !0);
183
183
  }
184
- s(b, "initLuckySheet");
185
- function K() {
186
- x.value && window.luckysheet.destroy(), T() && (me(X), de(j));
184
+ r(N, "initLuckySheet");
185
+ function te() {
186
+ E.value && window.luckysheet.destroy(), B() && (ke(G), ge(H));
187
187
  }
188
- return s(K, "resetLuckySheet"), ee(() => {
189
- K();
188
+ r(te, "resetLuckySheet");
189
+ function oe() {
190
+ s("download", m.downloadData);
191
+ }
192
+ return r(oe, "onDownload"), ie(() => {
193
+ te();
190
194
  }), (e, t) => {
191
- const a = te("LSIcon");
192
- return re(), oe("div", {
193
- class: I(_(U))
195
+ const n = ue("LSIcon");
196
+ return X(), V("div", {
197
+ class: L(i(O))
194
198
  }, [
195
- M("span", {
196
- class: I([_(S).e("btn"), _(S).e("close")]),
197
- onClick: $
199
+ j("div", {
200
+ class: L([i(d).e("btn"), i(d).e("close")]),
201
+ onClick: W
198
202
  }, [
199
- ae(a, {
203
+ $(n, {
200
204
  name: "Close",
201
205
  size: 24,
202
206
  color: "#FFF"
203
207
  })
204
208
  ], 2),
205
- t[0] || (t[0] = M("div", {
209
+ i(Q) ? (X(), V("div", {
210
+ key: 0,
211
+ class: L([i(d).e("btn"), i(d).e("download")]),
212
+ onClick: oe
213
+ }, [
214
+ $(n, {
215
+ class: L({ "is-loading": i(T) }),
216
+ name: `${i(T) ? "Loading" : "Download"}`,
217
+ size: 24,
218
+ color: "#FFF"
219
+ }, null, 8, ["class", "name"])
220
+ ], 2)) : de("", !0),
221
+ t[0] || (t[0] = j("div", {
206
222
  id: "luckysheet",
207
223
  class: "luckysheet-wrap"
208
224
  }, null, -1))
@@ -211,5 +227,5 @@ const we = q({
211
227
  }
212
228
  });
213
229
  export {
214
- Fe as default
230
+ Ve as default
215
231
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingshugroup/web-plus",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "零数科技前端UI组件库(Vue3)",
5
5
  "type": "module",
6
6
  "main": "./lib/index/index.cjs",