@topdatasec/report 1.0.4 → 1.0.5

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.
@@ -1 +1 @@
1
- (function(u,r,O){"use strict";const B={class:"chart-components"},y=(e=>{const t=e;return t.install=function(n){n.component(t.__name,e)},e})(r.defineComponent({name:"TdsReportBar",__name:"TdsReportBar",props:{data:{}},setup(e){const t=e;console.log(t.data,444444444);const n=r.computed(()=>t.data.options);return(o,s)=>(r.openBlock(),r.createElementBlock("div",B,[r.createVNode(r.unref(O),{option:n.value},null,8,["option"])]))}})),U=Object.freeze(Object.defineProperty({__proto__:null,TdsReportBar:y},Symbol.toStringTag,{value:"Module"}));function V(e=Date.now(),t="YYYY-MM-DD HH:mm:ss"){try{let n;if(typeof e=="number"||typeof e=="string"){if(n=new Date(e),isNaN(n.getTime()))throw new Error("Invalid date")}else n=e;const o=(a,c=2)=>String(a).padStart(c,"0"),s=a=>{switch(a){case"YYYY":return o(n.getFullYear());case"YY":return o(n.getFullYear()).slice(2,4);case"MM":return o(n.getMonth()+1);case"M":return String(n.getMonth()+1);case"DD":return o(n.getDate());case"D":return String(n.getDate());case"HH":return o(n.getHours());case"H":return String(n.getHours());case"mm":return o(n.getMinutes());case"m":return String(n.getMinutes());case"ss":return o(n.getSeconds());case"s":return String(n.getSeconds());case"SSS":return o(n.getMilliseconds(),3);default:return a}};return t.replace(/(YYYY|YY|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS)/g,s)}catch(n){return console.error("Error formatting date:",n),""}}function k(e,t=2,n=",",o=".",s,a){typeof e!="number"&&typeof e!="string"&&console.warn("Expected value to be of type number or string"),typeof t!="number"&&console.warn("Expected precision to be of type number");const c=Number(e);if(isNaN(c)||!isFinite(c))return"";if(c===0)return c.toFixed(t);let i=c.toFixed(t);if(typeof n=="string"&&n!==""){const[f,m]=i.split(".");i=f.replace(/(\d)(?=(\d{3})+$)/g,"$1"+n)+(m?o+m:"")}return(s||"")+i+(a||"")}function H(e,t=0,n=!1){let o=null;function s(c){if(o||(o=c),c-o>=t){try{e()}catch(f){console.error("Error executing rafTimeout function:",f)}n&&(o=c,a.id=requestAnimationFrame(s))}else a.id=requestAnimationFrame(s)}const a={id:requestAnimationFrame(s)};return a}function I(e){e&&e.id&&typeof e.id=="number"?cancelAnimationFrame(e.id):console.warn("cancelRaf received an invalid id:",e)}function M(e,t=300){let n=!0;return function(...o){return n&&(e(...o),n=!1,setTimeout(()=>{n=!0},t)),!1}}function T(e,t=300){let n=null;return function(...o){n&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function N(e,t){if(Number.isNaN(e)||Number.isNaN(t))throw new Error("Both num1 and num2 must be valid numbers.");const n=e%1!==0,o=t%1!==0;if(!n&&!o)return e+t;const s=String(e).split(".")[1]??"",a=String(t).split(".")[1]??"",c=Math.max(s.length,a.length),i=Math.pow(10,c),f=e.toFixed(c),m=t.toFixed(c);return(+f.replace(".","")+ +m.replace(".",""))/i}function j(e,t){if(!e){console.error("无效的 url");return}const n=t||e.split("?")[0].split("/").pop()||"download";try{fetch(e).then(o=>{o.ok?o.blob().then(s=>{const a=URL.createObjectURL(s),c=document.createElement("a");c.href=a,c.download=n,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(a)}):console.error("请求文件失败,状态码:",o.status)})}catch(o){console.error("文件下载失败:",o)}}function z(){const e=document.documentElement;e.classList.toggle("dark"),e.classList.contains("dark")?e.style.colorScheme="dark":e.style.colorScheme="light"}function $(){const e=r.ref(!1),t=r.getCurrentInstance();return t&&r.onMounted(()=>{e.value=!0},t),e}function R(e){const t=$();return r.computed(()=>(t.value,!!e()))}function q(e,t,n){r.onMounted(()=>e.addEventListener(t,n)),r.onUnmounted(()=>e.removeEventListener(t,n))}function P(e,t,n={}){const o=R(()=>window&&"MutationObserver"in window),s=r.ref(!1);let a;const c=r.computed(()=>{const d=r.toValue(e);return d?Array.isArray(d)?d.map(h=>r.toValue(h)).filter(h=>h):[d]:[]}),i=()=>{a&&(a.disconnect(),a=void 0)},f=()=>{o.value&&c.value.length&&!s.value&&(a=new MutationObserver(t),c.value.forEach(d=>a.observe(d,n)))};r.watch(()=>c.value,()=>{i(),f()},{immediate:!0,flush:"post"});const m=()=>{s.value=!0,i()},p=()=>{s.value=!1,f()};return r.onBeforeUnmount(()=>i()),{stop:m,start:p}}function x(e=window,t=0,n,o){const s=r.ref(0),a=r.ref(0),c=r.ref(0),i=r.ref(0),f=r.ref(!1),m=r.ref(!1),p=r.ref(!1),d=r.ref(!1),h=r.ref(!1),E=r.ref(0),S=r.ref(0);function X(l){f.value=!0;const g=l.target.documentElement??l.target;s.value=g.scrollLeft,c.value=g.scrollTop,m.value=s.value<E.value,p.value=s.value>E.value,d.value=c.value<S.value,h.value=c.value>S.value,E.value=s.value,S.value=c.value,w(l),n&&n(l)}const _=M(X,t);function ee(l){f.value&&(f.value=!1,m.value=!1,p.value=!1,d.value=!1,h.value=!1,o&&o(l))}const w=T(ee,t+200),A=r.computed(()=>{const l=r.toValue(e);return l||null});r.watch(()=>A.value,(l,g)=>{var v;if(g&&D(g),l){const b=((v=l==null?void 0:l.document)==null?void 0:v.documentElement)||(l==null?void 0:l.documentElement)||l;a.value=b.scrollWidth-b.clientWidth,i.value=b.scrollHeight-b.clientHeight,b.addEventListener("scroll",_),b.addEventListener("scrollend",w)}},{immediate:!0,flush:"post"});function D(l){var v;const g=((v=l==null?void 0:l.document)==null?void 0:v.documentElement)||(l==null?void 0:l.documentElement)||l;g.removeEventListener("scroll",_),g.removeEventListener("scrollend",w)}return r.onBeforeUnmount(()=>D(A.value)),{x:s,xScrollMax:a,y:c,yScrollMax:i,isScrolling:f,left:m,right:p,top:d,bottom:h}}function C(){const e=r.ref(0),t=r.ref(0);let n=performance.now();const o=10,s=a=>{if(t.value++,t.value>=o){const c=a-n;e.value=Math.round(1e3/(c/o)),n=a,t.value=0}requestAnimationFrame(s)};return requestAnimationFrame(s),{fps:e}}function W(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid mediaQuery parameter. It must be a non-empty string.");const t=r.ref(window&&window.matchMedia(e).matches),n=window.matchMedia(e),o=s=>{t.value=s.matches};return r.onMounted(()=>{n.addEventListener("change",o)}),r.onBeforeUnmount(()=>{n.removeEventListener("change",o)}),{match:t}}function Z(e,t,n={}){const o=R(()=>window&&"ResizeObserver"in window);let s;const a=r.ref(!1),c=r.computed(()=>{const d=r.toValue(e);return d?Array.isArray(d)?d.map(h=>r.toValue(h)).filter(h=>h):[d]:[]}),i=()=>{s&&(s.disconnect(),s=void 0)},f=()=>{o.value&&c.value.length&&!a.value&&(s=new ResizeObserver(t),c.value.forEach(d=>s.observe(d,n)))};r.watch(()=>c.value,()=>{i(),f()},{immediate:!0,flush:"post"});const m=()=>{a.value=!0,i()},p=()=>{a.value=!1,f()};return r.onBeforeUnmount(()=>i()),{stop:m,start:p}}function G(e="default"){const t=r.useSlots(),n=o=>{var c;const s=(c=t[o])==null?void 0:c.call(t),a=i=>{if(i.type===r.Comment||Array.isArray(i.children)&&!i.children.length)return!1;if(i.type!==r.Text)return!0;if(typeof i.children=="string")return i.children.trim()!==""};return s&&(s!=null&&s.length)?s.some(f=>a(f)):!1};if(Array.isArray(e)){const o=r.reactive({});return e.forEach(s=>{const a=r.computed(()=>n(s));o[s]=a}),o}else return r.computed(()=>n(e))}const F={TdsReportBar:"TdsReportBar"},L={BackTop:["Tooltip"]};function J(e,t){if(["NumberAnimation","Watermark"].includes(e))return[];const n=[e];e in L&&n.push(...L[e]);const o=t!=null&&t.cjs?"lib":"es",s=[`@topdatasec/report/${o}/style/global.css`];return n.forEach(a=>{s.push(`@topdatasec/report/${o}/${F[a]}/${a}.css`)}),s}function K(e){return{type:"component",resolve:t=>{if(t in F)return{name:t,from:"@topdatasec/report",sideEffects:J(t,e)}}}}const Y=function(e){return Object.values(U).forEach(t=>{t&&t.install&&e.use(t)}),e},Q={install:Y};u.TdsReportBar=y,u.VueAmazingUIResolver=K,u.add=N,u.cancelRaf=I,u.dateFormat=V,u.debounce=T,u.default=Q,u.downloadFile=j,u.formatNumber=k,u.install=Y,u.rafTimeout=H,u.throttle=M,u.toggleDark=z,u.useEventListener=q,u.useFps=C,u.useMediaQuery=W,u.useMutationObserver=P,u.useResizeObserver=Z,u.useScroll=x,u.useSlotsExist=G,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})(this.TdsReportUI=this.TdsReportUI||{},Vue,TdsChart);
1
+ (function(u,r){"use strict";const O={class:"chart-components"},y=(e=>{const t=e;return t.install=function(n){n.component(t.__name,e)},e})(r.defineComponent({name:"TdsReportBar",__name:"TdsReportBar",props:{data:{}},setup(e){const t=e;console.log(t.data,444444444);const n=r.computed(()=>t.data.options);return(o,s)=>{const c=r.resolveComponent("TdsChart");return r.openBlock(),r.createElementBlock("div",O,[r.createVNode(c,{option:n.value},null,8,["option"])])}}})),B=Object.freeze(Object.defineProperty({__proto__:null,TdsReportBar:y},Symbol.toStringTag,{value:"Module"}));function U(e=Date.now(),t="YYYY-MM-DD HH:mm:ss"){try{let n;if(typeof e=="number"||typeof e=="string"){if(n=new Date(e),isNaN(n.getTime()))throw new Error("Invalid date")}else n=e;const o=(c,a=2)=>String(c).padStart(a,"0"),s=c=>{switch(c){case"YYYY":return o(n.getFullYear());case"YY":return o(n.getFullYear()).slice(2,4);case"MM":return o(n.getMonth()+1);case"M":return String(n.getMonth()+1);case"DD":return o(n.getDate());case"D":return String(n.getDate());case"HH":return o(n.getHours());case"H":return String(n.getHours());case"mm":return o(n.getMinutes());case"m":return String(n.getMinutes());case"ss":return o(n.getSeconds());case"s":return String(n.getSeconds());case"SSS":return o(n.getMilliseconds(),3);default:return c}};return t.replace(/(YYYY|YY|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS)/g,s)}catch(n){return console.error("Error formatting date:",n),""}}function V(e,t=2,n=",",o=".",s,c){typeof e!="number"&&typeof e!="string"&&console.warn("Expected value to be of type number or string"),typeof t!="number"&&console.warn("Expected precision to be of type number");const a=Number(e);if(isNaN(a)||!isFinite(a))return"";if(a===0)return a.toFixed(t);let i=a.toFixed(t);if(typeof n=="string"&&n!==""){const[f,m]=i.split(".");i=f.replace(/(\d)(?=(\d{3})+$)/g,"$1"+n)+(m?o+m:"")}return(s||"")+i+(c||"")}function k(e,t=0,n=!1){let o=null;function s(a){if(o||(o=a),a-o>=t){try{e()}catch(f){console.error("Error executing rafTimeout function:",f)}n&&(o=a,c.id=requestAnimationFrame(s))}else c.id=requestAnimationFrame(s)}const c={id:requestAnimationFrame(s)};return c}function H(e){e&&e.id&&typeof e.id=="number"?cancelAnimationFrame(e.id):console.warn("cancelRaf received an invalid id:",e)}function M(e,t=300){let n=!0;return function(...o){return n&&(e(...o),n=!1,setTimeout(()=>{n=!0},t)),!1}}function T(e,t=300){let n=null;return function(...o){n&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function I(e,t){if(Number.isNaN(e)||Number.isNaN(t))throw new Error("Both num1 and num2 must be valid numbers.");const n=e%1!==0,o=t%1!==0;if(!n&&!o)return e+t;const s=String(e).split(".")[1]??"",c=String(t).split(".")[1]??"",a=Math.max(s.length,c.length),i=Math.pow(10,a),f=e.toFixed(a),m=t.toFixed(a);return(+f.replace(".","")+ +m.replace(".",""))/i}function N(e,t){if(!e){console.error("无效的 url");return}const n=t||e.split("?")[0].split("/").pop()||"download";try{fetch(e).then(o=>{o.ok?o.blob().then(s=>{const c=URL.createObjectURL(s),a=document.createElement("a");a.href=c,a.download=n,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(c)}):console.error("请求文件失败,状态码:",o.status)})}catch(o){console.error("文件下载失败:",o)}}function j(){const e=document.documentElement;e.classList.toggle("dark"),e.classList.contains("dark")?e.style.colorScheme="dark":e.style.colorScheme="light"}function z(){const e=r.ref(!1),t=r.getCurrentInstance();return t&&r.onMounted(()=>{e.value=!0},t),e}function R(e){const t=z();return r.computed(()=>(t.value,!!e()))}function $(e,t,n){r.onMounted(()=>e.addEventListener(t,n)),r.onUnmounted(()=>e.removeEventListener(t,n))}function q(e,t,n={}){const o=R(()=>window&&"MutationObserver"in window),s=r.ref(!1);let c;const a=r.computed(()=>{const d=r.toValue(e);return d?Array.isArray(d)?d.map(h=>r.toValue(h)).filter(h=>h):[d]:[]}),i=()=>{c&&(c.disconnect(),c=void 0)},f=()=>{o.value&&a.value.length&&!s.value&&(c=new MutationObserver(t),a.value.forEach(d=>c.observe(d,n)))};r.watch(()=>a.value,()=>{i(),f()},{immediate:!0,flush:"post"});const m=()=>{s.value=!0,i()},p=()=>{s.value=!1,f()};return r.onBeforeUnmount(()=>i()),{stop:m,start:p}}function C(e=window,t=0,n,o){const s=r.ref(0),c=r.ref(0),a=r.ref(0),i=r.ref(0),f=r.ref(!1),m=r.ref(!1),p=r.ref(!1),d=r.ref(!1),h=r.ref(!1),E=r.ref(0),S=r.ref(0);function Q(l){f.value=!0;const g=l.target.documentElement??l.target;s.value=g.scrollLeft,a.value=g.scrollTop,m.value=s.value<E.value,p.value=s.value>E.value,d.value=a.value<S.value,h.value=a.value>S.value,E.value=s.value,S.value=a.value,w(l),n&&n(l)}const Y=M(Q,t);function X(l){f.value&&(f.value=!1,m.value=!1,p.value=!1,d.value=!1,h.value=!1,o&&o(l))}const w=T(X,t+200),A=r.computed(()=>{const l=r.toValue(e);return l||null});r.watch(()=>A.value,(l,g)=>{var v;if(g&&D(g),l){const b=((v=l==null?void 0:l.document)==null?void 0:v.documentElement)||(l==null?void 0:l.documentElement)||l;c.value=b.scrollWidth-b.clientWidth,i.value=b.scrollHeight-b.clientHeight,b.addEventListener("scroll",Y),b.addEventListener("scrollend",w)}},{immediate:!0,flush:"post"});function D(l){var v;const g=((v=l==null?void 0:l.document)==null?void 0:v.documentElement)||(l==null?void 0:l.documentElement)||l;g.removeEventListener("scroll",Y),g.removeEventListener("scrollend",w)}return r.onBeforeUnmount(()=>D(A.value)),{x:s,xScrollMax:c,y:a,yScrollMax:i,isScrolling:f,left:m,right:p,top:d,bottom:h}}function P(){const e=r.ref(0),t=r.ref(0);let n=performance.now();const o=10,s=c=>{if(t.value++,t.value>=o){const a=c-n;e.value=Math.round(1e3/(a/o)),n=c,t.value=0}requestAnimationFrame(s)};return requestAnimationFrame(s),{fps:e}}function x(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid mediaQuery parameter. It must be a non-empty string.");const t=r.ref(window&&window.matchMedia(e).matches),n=window.matchMedia(e),o=s=>{t.value=s.matches};return r.onMounted(()=>{n.addEventListener("change",o)}),r.onBeforeUnmount(()=>{n.removeEventListener("change",o)}),{match:t}}function W(e,t,n={}){const o=R(()=>window&&"ResizeObserver"in window);let s;const c=r.ref(!1),a=r.computed(()=>{const d=r.toValue(e);return d?Array.isArray(d)?d.map(h=>r.toValue(h)).filter(h=>h):[d]:[]}),i=()=>{s&&(s.disconnect(),s=void 0)},f=()=>{o.value&&a.value.length&&!c.value&&(s=new ResizeObserver(t),a.value.forEach(d=>s.observe(d,n)))};r.watch(()=>a.value,()=>{i(),f()},{immediate:!0,flush:"post"});const m=()=>{c.value=!0,i()},p=()=>{c.value=!1,f()};return r.onBeforeUnmount(()=>i()),{stop:m,start:p}}function Z(e="default"){const t=r.useSlots(),n=o=>{var a;const s=(a=t[o])==null?void 0:a.call(t),c=i=>{if(i.type===r.Comment||Array.isArray(i.children)&&!i.children.length)return!1;if(i.type!==r.Text)return!0;if(typeof i.children=="string")return i.children.trim()!==""};return s&&(s!=null&&s.length)?s.some(f=>c(f)):!1};if(Array.isArray(e)){const o=r.reactive({});return e.forEach(s=>{const c=r.computed(()=>n(s));o[s]=c}),o}else return r.computed(()=>n(e))}const F={TdsReportBar:"TdsReportBar"},L={BackTop:["Tooltip"]};function G(e,t){if(["NumberAnimation","Watermark"].includes(e))return[];const n=[e];e in L&&n.push(...L[e]);const o=t!=null&&t.cjs?"lib":"es",s=[`@topdatasec/report/${o}/style/global.css`];return n.forEach(c=>{s.push(`@topdatasec/report/${o}/${F[c]}/${c}.css`)}),s}function J(e){return{type:"component",resolve:t=>{if(t in F)return{name:t,from:"@topdatasec/report",sideEffects:G(t,e)}}}}const _=function(e){return Object.values(B).forEach(t=>{t&&t.install&&e.use(t)}),e},K={install:_};u.TdsReportBar=y,u.VueAmazingUIResolver=J,u.add=I,u.cancelRaf=H,u.dateFormat=U,u.debounce=T,u.default=K,u.downloadFile=N,u.formatNumber=V,u.install=_,u.rafTimeout=k,u.throttle=M,u.toggleDark=j,u.useEventListener=$,u.useFps=P,u.useMediaQuery=x,u.useMutationObserver=q,u.useResizeObserver=W,u.useScroll=C,u.useSlotsExist=Z,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})(this.TdsReportUI=this.TdsReportUI||{},Vue);
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
- import { defineComponent as k, computed as h, createElementBlock as B, openBlock as H, createVNode as U, unref as V, onMounted as x, onUnmounted as N, ref as f, toValue as E, watch as T, onBeforeUnmount as S, useSlots as $, reactive as j, getCurrentInstance as I, Comment as q, Text as z } from "vue";
2
- import C from "topdatasec-ui";
3
- const P = { class: "chart-components" }, W = /* @__PURE__ */ k({
1
+ import { defineComponent as k, computed as h, resolveComponent as B, createElementBlock as H, openBlock as U, createVNode as V, onMounted as x, onUnmounted as N, ref as f, toValue as E, watch as T, onBeforeUnmount as S, useSlots as $, reactive as j, getCurrentInstance as I, Comment as q, Text as z } from "vue";
2
+ const C = { class: "chart-components" }, P = /* @__PURE__ */ k({
4
3
  name: "TdsReportBar",
5
4
  __name: "TdsReportBar",
6
5
  props: {
@@ -10,20 +9,23 @@ const P = { class: "chart-components" }, W = /* @__PURE__ */ k({
10
9
  const t = e;
11
10
  console.log(t.data, 444444444);
12
11
  const n = h(() => t.data.options);
13
- return (r, s) => (H(), B("div", P, [
14
- U(V(C), { option: n.value }, null, 8, ["option"])
15
- ]));
12
+ return (r, o) => {
13
+ const s = B("TdsChart");
14
+ return U(), H("div", C, [
15
+ V(s, { option: n.value }, null, 8, ["option"])
16
+ ]);
17
+ };
16
18
  }
17
- }), Z = (e) => {
19
+ }), W = (e) => {
18
20
  const t = e;
19
21
  return t.install = function(n) {
20
22
  n.component(t.__name, e);
21
23
  }, e;
22
- }, G = Z(W), J = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
24
+ }, Z = W(P), G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
23
25
  __proto__: null,
24
- TdsReportBar: G
26
+ TdsReportBar: Z
25
27
  }, Symbol.toStringTag, { value: "Module" }));
26
- function se(e = Date.now(), t = "YYYY-MM-DD HH:mm:ss") {
28
+ function ne(e = Date.now(), t = "YYYY-MM-DD HH:mm:ss") {
27
29
  try {
28
30
  let n;
29
31
  if (typeof e == "number" || typeof e == "string") {
@@ -31,8 +33,8 @@ function se(e = Date.now(), t = "YYYY-MM-DD HH:mm:ss") {
31
33
  throw new Error("Invalid date");
32
34
  } else
33
35
  n = e;
34
- const r = (c, o = 2) => String(c).padStart(o, "0"), s = (c) => {
35
- switch (c) {
36
+ const r = (s, c = 2) => String(s).padStart(c, "0"), o = (s) => {
37
+ switch (s) {
36
38
  case "YYYY":
37
39
  return r(n.getFullYear());
38
40
  case "YY":
@@ -60,50 +62,50 @@ function se(e = Date.now(), t = "YYYY-MM-DD HH:mm:ss") {
60
62
  case "SSS":
61
63
  return r(n.getMilliseconds(), 3);
62
64
  default:
63
- return c;
65
+ return s;
64
66
  }
65
67
  };
66
- return t.replace(/(YYYY|YY|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS)/g, s);
68
+ return t.replace(/(YYYY|YY|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS)/g, o);
67
69
  } catch (n) {
68
70
  return console.error("Error formatting date:", n), "";
69
71
  }
70
72
  }
71
- function oe(e, t = 2, n = ",", r = ".", s, c) {
73
+ function re(e, t = 2, n = ",", r = ".", o, s) {
72
74
  typeof e != "number" && typeof e != "string" && console.warn("Expected value to be of type number or string"), typeof t != "number" && console.warn("Expected precision to be of type number");
73
- const o = Number(e);
74
- if (isNaN(o) || !isFinite(o))
75
+ const c = Number(e);
76
+ if (isNaN(c) || !isFinite(c))
75
77
  return "";
76
- if (o === 0)
77
- return o.toFixed(t);
78
- let l = o.toFixed(t);
78
+ if (c === 0)
79
+ return c.toFixed(t);
80
+ let l = c.toFixed(t);
79
81
  if (typeof n == "string" && n !== "") {
80
82
  const [i, d] = l.split(".");
81
83
  l = i.replace(/(\d)(?=(\d{3})+$)/g, "$1" + n) + (d ? r + d : "");
82
84
  }
83
- return (s || "") + l + (c || "");
85
+ return (o || "") + l + (s || "");
84
86
  }
85
- function ce(e, t = 0, n = !1) {
87
+ function oe(e, t = 0, n = !1) {
86
88
  let r = null;
87
- function s(o) {
88
- if (r || (r = o), o - r >= t) {
89
+ function o(c) {
90
+ if (r || (r = c), c - r >= t) {
89
91
  try {
90
92
  e();
91
93
  } catch (i) {
92
94
  console.error("Error executing rafTimeout function:", i);
93
95
  }
94
- n && (r = o, c.id = requestAnimationFrame(s));
96
+ n && (r = c, s.id = requestAnimationFrame(o));
95
97
  } else
96
- c.id = requestAnimationFrame(s);
98
+ s.id = requestAnimationFrame(o);
97
99
  }
98
- const c = {
99
- id: requestAnimationFrame(s)
100
+ const s = {
101
+ id: requestAnimationFrame(o)
100
102
  };
101
- return c;
103
+ return s;
102
104
  }
103
- function ae(e) {
105
+ function se(e) {
104
106
  e && e.id && typeof e.id == "number" ? cancelAnimationFrame(e.id) : console.warn("cancelRaf received an invalid id:", e);
105
107
  }
106
- function K(e, t = 300) {
108
+ function J(e, t = 300) {
107
109
  let n = !0;
108
110
  return function(...r) {
109
111
  return n && (e(...r), n = !1, setTimeout(() => {
@@ -111,7 +113,7 @@ function K(e, t = 300) {
111
113
  }, t)), !1;
112
114
  };
113
115
  }
114
- function X(e, t = 300) {
116
+ function K(e, t = 300) {
115
117
  let n = null;
116
118
  return function(...r) {
117
119
  n && clearTimeout(n), n = setTimeout(() => {
@@ -119,16 +121,16 @@ function X(e, t = 300) {
119
121
  }, t);
120
122
  };
121
123
  }
122
- function le(e, t) {
124
+ function ce(e, t) {
123
125
  if (Number.isNaN(e) || Number.isNaN(t))
124
126
  throw new Error("Both num1 and num2 must be valid numbers.");
125
127
  const n = e % 1 !== 0, r = t % 1 !== 0;
126
128
  if (!n && !r)
127
129
  return e + t;
128
- const s = String(e).split(".")[1] ?? "", c = String(t).split(".")[1] ?? "", o = Math.max(s.length, c.length), l = Math.pow(10, o), i = e.toFixed(o), d = t.toFixed(o);
130
+ const o = String(e).split(".")[1] ?? "", s = String(t).split(".")[1] ?? "", c = Math.max(o.length, s.length), l = Math.pow(10, c), i = e.toFixed(c), d = t.toFixed(c);
129
131
  return (+i.replace(".", "") + +d.replace(".", "")) / l;
130
132
  }
131
- function ie(e, t) {
133
+ function ae(e, t) {
132
134
  if (!e) {
133
135
  console.error("无效的 url");
134
136
  return;
@@ -136,45 +138,45 @@ function ie(e, t) {
136
138
  const n = t || e.split("?")[0].split("/").pop() || "download";
137
139
  try {
138
140
  fetch(e).then((r) => {
139
- r.ok ? r.blob().then((s) => {
140
- const c = URL.createObjectURL(s), o = document.createElement("a");
141
- o.href = c, o.download = n, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(c);
141
+ r.ok ? r.blob().then((o) => {
142
+ const s = URL.createObjectURL(o), c = document.createElement("a");
143
+ c.href = s, c.download = n, document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(s);
142
144
  }) : console.error("请求文件失败,状态码:", r.status);
143
145
  });
144
146
  } catch (r) {
145
147
  console.error("文件下载失败:", r);
146
148
  }
147
149
  }
148
- function ue() {
150
+ function le() {
149
151
  const e = document.documentElement;
150
152
  e.classList.toggle("dark"), e.classList.contains("dark") ? e.style.colorScheme = "dark" : e.style.colorScheme = "light";
151
153
  }
152
- function Q() {
154
+ function X() {
153
155
  const e = f(!1), t = I();
154
156
  return t && x(() => {
155
157
  e.value = !0;
156
158
  }, t), e;
157
159
  }
158
160
  function A(e) {
159
- const t = Q();
161
+ const t = X();
160
162
  return h(() => (t.value, !!e()));
161
163
  }
162
- function fe(e, t, n) {
164
+ function ie(e, t, n) {
163
165
  x(() => e.addEventListener(t, n)), N(() => e.removeEventListener(t, n));
164
166
  }
165
- function de(e, t, n = {}) {
166
- const r = A(() => window && "MutationObserver" in window), s = f(!1);
167
- let c;
168
- const o = h(() => {
167
+ function ue(e, t, n = {}) {
168
+ const r = A(() => window && "MutationObserver" in window), o = f(!1);
169
+ let s;
170
+ const c = h(() => {
169
171
  const u = E(e);
170
172
  return u ? Array.isArray(u) ? u.map((m) => E(m)).filter((m) => m) : [u] : [];
171
173
  }), l = () => {
172
- c && (c.disconnect(), c = void 0);
174
+ s && (s.disconnect(), s = void 0);
173
175
  }, i = () => {
174
- r.value && o.value.length && !s.value && (c = new MutationObserver(t), o.value.forEach((u) => c.observe(u, n)));
176
+ r.value && c.value.length && !o.value && (s = new MutationObserver(t), c.value.forEach((u) => s.observe(u, n)));
175
177
  };
176
178
  T(
177
- () => o.value,
179
+ () => c.value,
178
180
  () => {
179
181
  l(), i();
180
182
  },
@@ -185,27 +187,27 @@ function de(e, t, n = {}) {
185
187
  }
186
188
  );
187
189
  const d = () => {
188
- s.value = !0, l();
190
+ o.value = !0, l();
189
191
  }, v = () => {
190
- s.value = !1, i();
192
+ o.value = !1, i();
191
193
  };
192
194
  return S(() => l()), {
193
195
  stop: d,
194
196
  start: v
195
197
  };
196
198
  }
197
- function me(e = window, t = 0, n, r) {
198
- const s = f(0), c = f(0), o = f(0), l = f(0), i = f(!1), d = f(!1), v = f(!1), u = f(!1), m = f(!1), w = f(0), y = f(0);
199
+ function fe(e = window, t = 0, n, r) {
200
+ const o = f(0), s = f(0), c = f(0), l = f(0), i = f(!1), d = f(!1), v = f(!1), u = f(!1), m = f(!1), w = f(0), y = f(0);
199
201
  function _(a) {
200
202
  i.value = !0;
201
203
  const p = a.target.documentElement ?? a.target;
202
- s.value = p.scrollLeft, o.value = p.scrollTop, d.value = s.value < w.value, v.value = s.value > w.value, u.value = o.value < y.value, m.value = o.value > y.value, w.value = s.value, y.value = o.value, M(a), n && n(a);
204
+ o.value = p.scrollLeft, c.value = p.scrollTop, d.value = o.value < w.value, v.value = o.value > w.value, u.value = c.value < y.value, m.value = c.value > y.value, w.value = o.value, y.value = c.value, M(a), n && n(a);
203
205
  }
204
- const L = K(_, t);
206
+ const L = J(_, t);
205
207
  function O(a) {
206
208
  i.value && (i.value = !1, d.value = !1, v.value = !1, u.value = !1, m.value = !1, r && r(a));
207
209
  }
208
- const M = X(O, t + 200), Y = h(() => {
210
+ const M = K(O, t + 200), Y = h(() => {
209
211
  const a = E(e);
210
212
  return a || null;
211
213
  });
@@ -215,7 +217,7 @@ function me(e = window, t = 0, n, r) {
215
217
  var b;
216
218
  if (p && F(p), a) {
217
219
  const g = ((b = a == null ? void 0 : a.document) == null ? void 0 : b.documentElement) || (a == null ? void 0 : a.documentElement) || a;
218
- c.value = g.scrollWidth - g.clientWidth, l.value = g.scrollHeight - g.clientHeight, g.addEventListener("scroll", L), g.addEventListener("scrollend", M);
220
+ s.value = g.scrollWidth - g.clientWidth, l.value = g.scrollHeight - g.clientHeight, g.addEventListener("scroll", L), g.addEventListener("scrollend", M);
219
221
  }
220
222
  },
221
223
  {
@@ -228,25 +230,25 @@ function me(e = window, t = 0, n, r) {
228
230
  const p = ((b = a == null ? void 0 : a.document) == null ? void 0 : b.documentElement) || (a == null ? void 0 : a.documentElement) || a;
229
231
  p.removeEventListener("scroll", L), p.removeEventListener("scrollend", M);
230
232
  }
231
- return S(() => F(Y.value)), { x: s, xScrollMax: c, y: o, yScrollMax: l, isScrolling: i, left: d, right: v, top: u, bottom: m };
233
+ return S(() => F(Y.value)), { x: o, xScrollMax: s, y: c, yScrollMax: l, isScrolling: i, left: d, right: v, top: u, bottom: m };
232
234
  }
233
- function ve() {
235
+ function de() {
234
236
  const e = f(0), t = f(0);
235
237
  let n = performance.now();
236
- const r = 10, s = (c) => {
238
+ const r = 10, o = (s) => {
237
239
  if (t.value++, t.value >= r) {
238
- const o = c - n;
239
- e.value = Math.round(1e3 / (o / r)), n = c, t.value = 0;
240
+ const c = s - n;
241
+ e.value = Math.round(1e3 / (c / r)), n = s, t.value = 0;
240
242
  }
241
- requestAnimationFrame(s);
243
+ requestAnimationFrame(o);
242
244
  };
243
- return requestAnimationFrame(s), { fps: e };
245
+ return requestAnimationFrame(o), { fps: e };
244
246
  }
245
- function pe(e) {
247
+ function me(e) {
246
248
  if (!e || typeof e != "string" || e.trim() === "")
247
249
  throw new Error("Invalid mediaQuery parameter. It must be a non-empty string.");
248
- const t = f(window && window.matchMedia(e).matches), n = window.matchMedia(e), r = (s) => {
249
- t.value = s.matches;
250
+ const t = f(window && window.matchMedia(e).matches), n = window.matchMedia(e), r = (o) => {
251
+ t.value = o.matches;
250
252
  };
251
253
  return x(() => {
252
254
  n.addEventListener("change", r);
@@ -254,19 +256,19 @@ function pe(e) {
254
256
  n.removeEventListener("change", r);
255
257
  }), { match: t };
256
258
  }
257
- function he(e, t, n = {}) {
259
+ function ve(e, t, n = {}) {
258
260
  const r = A(() => window && "ResizeObserver" in window);
259
- let s;
260
- const c = f(!1), o = h(() => {
261
+ let o;
262
+ const s = f(!1), c = h(() => {
261
263
  const u = E(e);
262
264
  return u ? Array.isArray(u) ? u.map((m) => E(m)).filter((m) => m) : [u] : [];
263
265
  }), l = () => {
264
- s && (s.disconnect(), s = void 0);
266
+ o && (o.disconnect(), o = void 0);
265
267
  }, i = () => {
266
- r.value && o.value.length && !c.value && (s = new ResizeObserver(t), o.value.forEach((u) => s.observe(u, n)));
268
+ r.value && c.value.length && !s.value && (o = new ResizeObserver(t), c.value.forEach((u) => o.observe(u, n)));
267
269
  };
268
270
  T(
269
- () => o.value,
271
+ () => c.value,
270
272
  () => {
271
273
  l(), i();
272
274
  },
@@ -277,19 +279,19 @@ function he(e, t, n = {}) {
277
279
  }
278
280
  );
279
281
  const d = () => {
280
- c.value = !0, l();
282
+ s.value = !0, l();
281
283
  }, v = () => {
282
- c.value = !1, i();
284
+ s.value = !1, i();
283
285
  };
284
286
  return S(() => l()), {
285
287
  stop: d,
286
288
  start: v
287
289
  };
288
290
  }
289
- function ge(e = "default") {
291
+ function pe(e = "default") {
290
292
  const t = $(), n = (r) => {
291
- var o;
292
- const s = (o = t[r]) == null ? void 0 : o.call(t), c = (l) => {
293
+ var c;
294
+ const o = (c = t[r]) == null ? void 0 : c.call(t), s = (l) => {
293
295
  if (l.type === q || Array.isArray(l.children) && !l.children.length)
294
296
  return !1;
295
297
  if (l.type !== z)
@@ -297,13 +299,13 @@ function ge(e = "default") {
297
299
  if (typeof l.children == "string")
298
300
  return l.children.trim() !== "";
299
301
  };
300
- return s && (s != null && s.length) ? s.some((i) => c(i)) : !1;
302
+ return o && (o != null && o.length) ? o.some((i) => s(i)) : !1;
301
303
  };
302
304
  if (Array.isArray(e)) {
303
305
  const r = j({});
304
- return e.forEach((s) => {
305
- const c = h(() => n(s));
306
- r[s] = c;
306
+ return e.forEach((o) => {
307
+ const s = h(() => n(o));
308
+ r[o] = s;
307
309
  }), r;
308
310
  } else
309
311
  return h(() => n(e));
@@ -313,19 +315,19 @@ const D = {
313
315
  }, R = {
314
316
  BackTop: ["Tooltip"]
315
317
  };
316
- function ee(e, t) {
318
+ function Q(e, t) {
317
319
  if (["NumberAnimation", "Watermark"].includes(e))
318
320
  return [];
319
321
  const n = [e];
320
322
  e in R && n.push(...R[e]);
321
- const r = t != null && t.cjs ? "lib" : "es", s = [`@topdatasec/report/${r}/style/global.css`];
322
- return n.forEach((c) => {
323
- s.push(
324
- `@topdatasec/report/${r}/${D[c]}/${c}.css`
323
+ const r = t != null && t.cjs ? "lib" : "es", o = [`@topdatasec/report/${r}/style/global.css`];
324
+ return n.forEach((s) => {
325
+ o.push(
326
+ `@topdatasec/report/${r}/${D[s]}/${s}.css`
325
327
  );
326
- }), s;
328
+ }), o;
327
329
  }
328
- function be(e) {
330
+ function he(e) {
329
331
  return {
330
332
  type: "component",
331
333
  resolve: (t) => {
@@ -335,38 +337,38 @@ function be(e) {
335
337
  // 组件名
336
338
  from: "@topdatasec/report",
337
339
  // 组件库名称
338
- sideEffects: ee(t, e)
340
+ sideEffects: Q(t, e)
339
341
  // 组件样式文件
340
342
  };
341
343
  }
342
344
  };
343
345
  }
344
- const te = function(e) {
345
- return Object.values(J).forEach((t) => {
346
+ const ee = function(e) {
347
+ return Object.values(G).forEach((t) => {
346
348
  t && t.install && e.use(t);
347
349
  }), e;
348
- }, Ee = {
349
- install: te
350
+ }, ge = {
351
+ install: ee
350
352
  };
351
353
  export {
352
- G as TdsReportBar,
353
- be as VueAmazingUIResolver,
354
- le as add,
355
- ae as cancelRaf,
356
- se as dateFormat,
357
- X as debounce,
358
- Ee as default,
359
- ie as downloadFile,
360
- oe as formatNumber,
361
- te as install,
362
- ce as rafTimeout,
363
- K as throttle,
364
- ue as toggleDark,
365
- fe as useEventListener,
366
- ve as useFps,
367
- pe as useMediaQuery,
368
- de as useMutationObserver,
369
- he as useResizeObserver,
370
- me as useScroll,
371
- ge as useSlotsExist
354
+ Z as TdsReportBar,
355
+ he as VueAmazingUIResolver,
356
+ ce as add,
357
+ se as cancelRaf,
358
+ ne as dateFormat,
359
+ K as debounce,
360
+ ge as default,
361
+ ae as downloadFile,
362
+ re as formatNumber,
363
+ ee as install,
364
+ oe as rafTimeout,
365
+ J as throttle,
366
+ le as toggleDark,
367
+ ie as useEventListener,
368
+ de as useFps,
369
+ me as useMediaQuery,
370
+ ue as useMutationObserver,
371
+ ve as useResizeObserver,
372
+ fe as useScroll,
373
+ pe as useSlotsExist
372
374
  };
@@ -1 +1 @@
1
- (function(i,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("topdatasec-ui")):typeof define=="function"&&define.amd?define(["exports","vue","topdatasec-ui"],r):(i=typeof globalThis<"u"?globalThis:i||self,r(i.TdsReportUI=i.TdsReportUI||{},i.Vue,i.TdsChart))})(this,function(i,r,O){"use strict";const B={class:"chart-components"},y=(e=>{const t=e;return t.install=function(n){n.component(t.__name,e)},e})(r.defineComponent({name:"TdsReportBar",__name:"TdsReportBar",props:{data:{}},setup(e){const t=e;console.log(t.data,444444444);const n=r.computed(()=>t.data.options);return(o,s)=>(r.openBlock(),r.createElementBlock("div",B,[r.createVNode(r.unref(O),{option:n.value},null,8,["option"])]))}})),U=Object.freeze(Object.defineProperty({__proto__:null,TdsReportBar:y},Symbol.toStringTag,{value:"Module"}));function V(e=Date.now(),t="YYYY-MM-DD HH:mm:ss"){try{let n;if(typeof e=="number"||typeof e=="string"){if(n=new Date(e),isNaN(n.getTime()))throw new Error("Invalid date")}else n=e;const o=(a,c=2)=>String(a).padStart(c,"0"),s=a=>{switch(a){case"YYYY":return o(n.getFullYear());case"YY":return o(n.getFullYear()).slice(2,4);case"MM":return o(n.getMonth()+1);case"M":return String(n.getMonth()+1);case"DD":return o(n.getDate());case"D":return String(n.getDate());case"HH":return o(n.getHours());case"H":return String(n.getHours());case"mm":return o(n.getMinutes());case"m":return String(n.getMinutes());case"ss":return o(n.getSeconds());case"s":return String(n.getSeconds());case"SSS":return o(n.getMilliseconds(),3);default:return a}};return t.replace(/(YYYY|YY|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS)/g,s)}catch(n){return console.error("Error formatting date:",n),""}}function k(e,t=2,n=",",o=".",s,a){typeof e!="number"&&typeof e!="string"&&console.warn("Expected value to be of type number or string"),typeof t!="number"&&console.warn("Expected precision to be of type number");const c=Number(e);if(isNaN(c)||!isFinite(c))return"";if(c===0)return c.toFixed(t);let u=c.toFixed(t);if(typeof n=="string"&&n!==""){const[f,m]=u.split(".");u=f.replace(/(\d)(?=(\d{3})+$)/g,"$1"+n)+(m?o+m:"")}return(s||"")+u+(a||"")}function H(e,t=0,n=!1){let o=null;function s(c){if(o||(o=c),c-o>=t){try{e()}catch(f){console.error("Error executing rafTimeout function:",f)}n&&(o=c,a.id=requestAnimationFrame(s))}else a.id=requestAnimationFrame(s)}const a={id:requestAnimationFrame(s)};return a}function I(e){e&&e.id&&typeof e.id=="number"?cancelAnimationFrame(e.id):console.warn("cancelRaf received an invalid id:",e)}function M(e,t=300){let n=!0;return function(...o){return n&&(e(...o),n=!1,setTimeout(()=>{n=!0},t)),!1}}function T(e,t=300){let n=null;return function(...o){n&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function j(e,t){if(Number.isNaN(e)||Number.isNaN(t))throw new Error("Both num1 and num2 must be valid numbers.");const n=e%1!==0,o=t%1!==0;if(!n&&!o)return e+t;const s=String(e).split(".")[1]??"",a=String(t).split(".")[1]??"",c=Math.max(s.length,a.length),u=Math.pow(10,c),f=e.toFixed(c),m=t.toFixed(c);return(+f.replace(".","")+ +m.replace(".",""))/u}function N(e,t){if(!e){console.error("无效的 url");return}const n=t||e.split("?")[0].split("/").pop()||"download";try{fetch(e).then(o=>{o.ok?o.blob().then(s=>{const a=URL.createObjectURL(s),c=document.createElement("a");c.href=a,c.download=n,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(a)}):console.error("请求文件失败,状态码:",o.status)})}catch(o){console.error("文件下载失败:",o)}}function q(){const e=document.documentElement;e.classList.toggle("dark"),e.classList.contains("dark")?e.style.colorScheme="dark":e.style.colorScheme="light"}function z(){const e=r.ref(!1),t=r.getCurrentInstance();return t&&r.onMounted(()=>{e.value=!0},t),e}function R(e){const t=z();return r.computed(()=>(t.value,!!e()))}function $(e,t,n){r.onMounted(()=>e.addEventListener(t,n)),r.onUnmounted(()=>e.removeEventListener(t,n))}function x(e,t,n={}){const o=R(()=>window&&"MutationObserver"in window),s=r.ref(!1);let a;const c=r.computed(()=>{const d=r.toValue(e);return d?Array.isArray(d)?d.map(p=>r.toValue(p)).filter(p=>p):[d]:[]}),u=()=>{a&&(a.disconnect(),a=void 0)},f=()=>{o.value&&c.value.length&&!s.value&&(a=new MutationObserver(t),c.value.forEach(d=>a.observe(d,n)))};r.watch(()=>c.value,()=>{u(),f()},{immediate:!0,flush:"post"});const m=()=>{s.value=!0,u()},h=()=>{s.value=!1,f()};return r.onBeforeUnmount(()=>u()),{stop:m,start:h}}function P(e=window,t=0,n,o){const s=r.ref(0),a=r.ref(0),c=r.ref(0),u=r.ref(0),f=r.ref(!1),m=r.ref(!1),h=r.ref(!1),d=r.ref(!1),p=r.ref(!1),E=r.ref(0),S=r.ref(0);function X(l){f.value=!0;const g=l.target.documentElement??l.target;s.value=g.scrollLeft,c.value=g.scrollTop,m.value=s.value<E.value,h.value=s.value>E.value,d.value=c.value<S.value,p.value=c.value>S.value,E.value=s.value,S.value=c.value,w(l),n&&n(l)}const _=M(X,t);function ee(l){f.value&&(f.value=!1,m.value=!1,h.value=!1,d.value=!1,p.value=!1,o&&o(l))}const w=T(ee,t+200),A=r.computed(()=>{const l=r.toValue(e);return l||null});r.watch(()=>A.value,(l,g)=>{var b;if(g&&D(g),l){const v=((b=l==null?void 0:l.document)==null?void 0:b.documentElement)||(l==null?void 0:l.documentElement)||l;a.value=v.scrollWidth-v.clientWidth,u.value=v.scrollHeight-v.clientHeight,v.addEventListener("scroll",_),v.addEventListener("scrollend",w)}},{immediate:!0,flush:"post"});function D(l){var b;const g=((b=l==null?void 0:l.document)==null?void 0:b.documentElement)||(l==null?void 0:l.documentElement)||l;g.removeEventListener("scroll",_),g.removeEventListener("scrollend",w)}return r.onBeforeUnmount(()=>D(A.value)),{x:s,xScrollMax:a,y:c,yScrollMax:u,isScrolling:f,left:m,right:h,top:d,bottom:p}}function C(){const e=r.ref(0),t=r.ref(0);let n=performance.now();const o=10,s=a=>{if(t.value++,t.value>=o){const c=a-n;e.value=Math.round(1e3/(c/o)),n=a,t.value=0}requestAnimationFrame(s)};return requestAnimationFrame(s),{fps:e}}function W(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid mediaQuery parameter. It must be a non-empty string.");const t=r.ref(window&&window.matchMedia(e).matches),n=window.matchMedia(e),o=s=>{t.value=s.matches};return r.onMounted(()=>{n.addEventListener("change",o)}),r.onBeforeUnmount(()=>{n.removeEventListener("change",o)}),{match:t}}function Z(e,t,n={}){const o=R(()=>window&&"ResizeObserver"in window);let s;const a=r.ref(!1),c=r.computed(()=>{const d=r.toValue(e);return d?Array.isArray(d)?d.map(p=>r.toValue(p)).filter(p=>p):[d]:[]}),u=()=>{s&&(s.disconnect(),s=void 0)},f=()=>{o.value&&c.value.length&&!a.value&&(s=new ResizeObserver(t),c.value.forEach(d=>s.observe(d,n)))};r.watch(()=>c.value,()=>{u(),f()},{immediate:!0,flush:"post"});const m=()=>{a.value=!0,u()},h=()=>{a.value=!1,f()};return r.onBeforeUnmount(()=>u()),{stop:m,start:h}}function G(e="default"){const t=r.useSlots(),n=o=>{var c;const s=(c=t[o])==null?void 0:c.call(t),a=u=>{if(u.type===r.Comment||Array.isArray(u.children)&&!u.children.length)return!1;if(u.type!==r.Text)return!0;if(typeof u.children=="string")return u.children.trim()!==""};return s&&(s!=null&&s.length)?s.some(f=>a(f)):!1};if(Array.isArray(e)){const o=r.reactive({});return e.forEach(s=>{const a=r.computed(()=>n(s));o[s]=a}),o}else return r.computed(()=>n(e))}const F={TdsReportBar:"TdsReportBar"},L={BackTop:["Tooltip"]};function J(e,t){if(["NumberAnimation","Watermark"].includes(e))return[];const n=[e];e in L&&n.push(...L[e]);const o=t!=null&&t.cjs?"lib":"es",s=[`@topdatasec/report/${o}/style/global.css`];return n.forEach(a=>{s.push(`@topdatasec/report/${o}/${F[a]}/${a}.css`)}),s}function K(e){return{type:"component",resolve:t=>{if(t in F)return{name:t,from:"@topdatasec/report",sideEffects:J(t,e)}}}}const Y=function(e){return Object.values(U).forEach(t=>{t&&t.install&&e.use(t)}),e},Q={install:Y};i.TdsReportBar=y,i.VueAmazingUIResolver=K,i.add=j,i.cancelRaf=I,i.dateFormat=V,i.debounce=T,i.default=Q,i.downloadFile=N,i.formatNumber=k,i.install=Y,i.rafTimeout=H,i.throttle=M,i.toggleDark=q,i.useEventListener=$,i.useFps=C,i.useMediaQuery=W,i.useMutationObserver=x,i.useResizeObserver=Z,i.useScroll=P,i.useSlotsExist=G,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(i,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(i=typeof globalThis<"u"?globalThis:i||self,r(i.TdsReportUI=i.TdsReportUI||{},i.Vue))})(this,function(i,r){"use strict";const O={class:"chart-components"},y=(e=>{const t=e;return t.install=function(n){n.component(t.__name,e)},e})(r.defineComponent({name:"TdsReportBar",__name:"TdsReportBar",props:{data:{}},setup(e){const t=e;console.log(t.data,444444444);const n=r.computed(()=>t.data.options);return(o,s)=>{const c=r.resolveComponent("TdsChart");return r.openBlock(),r.createElementBlock("div",O,[r.createVNode(c,{option:n.value},null,8,["option"])])}}})),B=Object.freeze(Object.defineProperty({__proto__:null,TdsReportBar:y},Symbol.toStringTag,{value:"Module"}));function U(e=Date.now(),t="YYYY-MM-DD HH:mm:ss"){try{let n;if(typeof e=="number"||typeof e=="string"){if(n=new Date(e),isNaN(n.getTime()))throw new Error("Invalid date")}else n=e;const o=(c,a=2)=>String(c).padStart(a,"0"),s=c=>{switch(c){case"YYYY":return o(n.getFullYear());case"YY":return o(n.getFullYear()).slice(2,4);case"MM":return o(n.getMonth()+1);case"M":return String(n.getMonth()+1);case"DD":return o(n.getDate());case"D":return String(n.getDate());case"HH":return o(n.getHours());case"H":return String(n.getHours());case"mm":return o(n.getMinutes());case"m":return String(n.getMinutes());case"ss":return o(n.getSeconds());case"s":return String(n.getSeconds());case"SSS":return o(n.getMilliseconds(),3);default:return c}};return t.replace(/(YYYY|YY|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS)/g,s)}catch(n){return console.error("Error formatting date:",n),""}}function V(e,t=2,n=",",o=".",s,c){typeof e!="number"&&typeof e!="string"&&console.warn("Expected value to be of type number or string"),typeof t!="number"&&console.warn("Expected precision to be of type number");const a=Number(e);if(isNaN(a)||!isFinite(a))return"";if(a===0)return a.toFixed(t);let u=a.toFixed(t);if(typeof n=="string"&&n!==""){const[f,m]=u.split(".");u=f.replace(/(\d)(?=(\d{3})+$)/g,"$1"+n)+(m?o+m:"")}return(s||"")+u+(c||"")}function k(e,t=0,n=!1){let o=null;function s(a){if(o||(o=a),a-o>=t){try{e()}catch(f){console.error("Error executing rafTimeout function:",f)}n&&(o=a,c.id=requestAnimationFrame(s))}else c.id=requestAnimationFrame(s)}const c={id:requestAnimationFrame(s)};return c}function H(e){e&&e.id&&typeof e.id=="number"?cancelAnimationFrame(e.id):console.warn("cancelRaf received an invalid id:",e)}function M(e,t=300){let n=!0;return function(...o){return n&&(e(...o),n=!1,setTimeout(()=>{n=!0},t)),!1}}function T(e,t=300){let n=null;return function(...o){n&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function I(e,t){if(Number.isNaN(e)||Number.isNaN(t))throw new Error("Both num1 and num2 must be valid numbers.");const n=e%1!==0,o=t%1!==0;if(!n&&!o)return e+t;const s=String(e).split(".")[1]??"",c=String(t).split(".")[1]??"",a=Math.max(s.length,c.length),u=Math.pow(10,a),f=e.toFixed(a),m=t.toFixed(a);return(+f.replace(".","")+ +m.replace(".",""))/u}function j(e,t){if(!e){console.error("无效的 url");return}const n=t||e.split("?")[0].split("/").pop()||"download";try{fetch(e).then(o=>{o.ok?o.blob().then(s=>{const c=URL.createObjectURL(s),a=document.createElement("a");a.href=c,a.download=n,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(c)}):console.error("请求文件失败,状态码:",o.status)})}catch(o){console.error("文件下载失败:",o)}}function N(){const e=document.documentElement;e.classList.toggle("dark"),e.classList.contains("dark")?e.style.colorScheme="dark":e.style.colorScheme="light"}function z(){const e=r.ref(!1),t=r.getCurrentInstance();return t&&r.onMounted(()=>{e.value=!0},t),e}function R(e){const t=z();return r.computed(()=>(t.value,!!e()))}function $(e,t,n){r.onMounted(()=>e.addEventListener(t,n)),r.onUnmounted(()=>e.removeEventListener(t,n))}function q(e,t,n={}){const o=R(()=>window&&"MutationObserver"in window),s=r.ref(!1);let c;const a=r.computed(()=>{const d=r.toValue(e);return d?Array.isArray(d)?d.map(p=>r.toValue(p)).filter(p=>p):[d]:[]}),u=()=>{c&&(c.disconnect(),c=void 0)},f=()=>{o.value&&a.value.length&&!s.value&&(c=new MutationObserver(t),a.value.forEach(d=>c.observe(d,n)))};r.watch(()=>a.value,()=>{u(),f()},{immediate:!0,flush:"post"});const m=()=>{s.value=!0,u()},h=()=>{s.value=!1,f()};return r.onBeforeUnmount(()=>u()),{stop:m,start:h}}function x(e=window,t=0,n,o){const s=r.ref(0),c=r.ref(0),a=r.ref(0),u=r.ref(0),f=r.ref(!1),m=r.ref(!1),h=r.ref(!1),d=r.ref(!1),p=r.ref(!1),E=r.ref(0),S=r.ref(0);function Q(l){f.value=!0;const g=l.target.documentElement??l.target;s.value=g.scrollLeft,a.value=g.scrollTop,m.value=s.value<E.value,h.value=s.value>E.value,d.value=a.value<S.value,p.value=a.value>S.value,E.value=s.value,S.value=a.value,w(l),n&&n(l)}const Y=M(Q,t);function X(l){f.value&&(f.value=!1,m.value=!1,h.value=!1,d.value=!1,p.value=!1,o&&o(l))}const w=T(X,t+200),A=r.computed(()=>{const l=r.toValue(e);return l||null});r.watch(()=>A.value,(l,g)=>{var b;if(g&&D(g),l){const v=((b=l==null?void 0:l.document)==null?void 0:b.documentElement)||(l==null?void 0:l.documentElement)||l;c.value=v.scrollWidth-v.clientWidth,u.value=v.scrollHeight-v.clientHeight,v.addEventListener("scroll",Y),v.addEventListener("scrollend",w)}},{immediate:!0,flush:"post"});function D(l){var b;const g=((b=l==null?void 0:l.document)==null?void 0:b.documentElement)||(l==null?void 0:l.documentElement)||l;g.removeEventListener("scroll",Y),g.removeEventListener("scrollend",w)}return r.onBeforeUnmount(()=>D(A.value)),{x:s,xScrollMax:c,y:a,yScrollMax:u,isScrolling:f,left:m,right:h,top:d,bottom:p}}function C(){const e=r.ref(0),t=r.ref(0);let n=performance.now();const o=10,s=c=>{if(t.value++,t.value>=o){const a=c-n;e.value=Math.round(1e3/(a/o)),n=c,t.value=0}requestAnimationFrame(s)};return requestAnimationFrame(s),{fps:e}}function P(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid mediaQuery parameter. It must be a non-empty string.");const t=r.ref(window&&window.matchMedia(e).matches),n=window.matchMedia(e),o=s=>{t.value=s.matches};return r.onMounted(()=>{n.addEventListener("change",o)}),r.onBeforeUnmount(()=>{n.removeEventListener("change",o)}),{match:t}}function W(e,t,n={}){const o=R(()=>window&&"ResizeObserver"in window);let s;const c=r.ref(!1),a=r.computed(()=>{const d=r.toValue(e);return d?Array.isArray(d)?d.map(p=>r.toValue(p)).filter(p=>p):[d]:[]}),u=()=>{s&&(s.disconnect(),s=void 0)},f=()=>{o.value&&a.value.length&&!c.value&&(s=new ResizeObserver(t),a.value.forEach(d=>s.observe(d,n)))};r.watch(()=>a.value,()=>{u(),f()},{immediate:!0,flush:"post"});const m=()=>{c.value=!0,u()},h=()=>{c.value=!1,f()};return r.onBeforeUnmount(()=>u()),{stop:m,start:h}}function Z(e="default"){const t=r.useSlots(),n=o=>{var a;const s=(a=t[o])==null?void 0:a.call(t),c=u=>{if(u.type===r.Comment||Array.isArray(u.children)&&!u.children.length)return!1;if(u.type!==r.Text)return!0;if(typeof u.children=="string")return u.children.trim()!==""};return s&&(s!=null&&s.length)?s.some(f=>c(f)):!1};if(Array.isArray(e)){const o=r.reactive({});return e.forEach(s=>{const c=r.computed(()=>n(s));o[s]=c}),o}else return r.computed(()=>n(e))}const F={TdsReportBar:"TdsReportBar"},L={BackTop:["Tooltip"]};function G(e,t){if(["NumberAnimation","Watermark"].includes(e))return[];const n=[e];e in L&&n.push(...L[e]);const o=t!=null&&t.cjs?"lib":"es",s=[`@topdatasec/report/${o}/style/global.css`];return n.forEach(c=>{s.push(`@topdatasec/report/${o}/${F[c]}/${c}.css`)}),s}function J(e){return{type:"component",resolve:t=>{if(t in F)return{name:t,from:"@topdatasec/report",sideEffects:G(t,e)}}}}const _=function(e){return Object.values(B).forEach(t=>{t&&t.install&&e.use(t)}),e},K={install:_};i.TdsReportBar=y,i.VueAmazingUIResolver=J,i.add=I,i.cancelRaf=H,i.dateFormat=U,i.debounce=T,i.default=K,i.downloadFile=j,i.formatNumber=V,i.install=_,i.rafTimeout=k,i.throttle=M,i.toggleDark=N,i.useEventListener=$,i.useFps=C,i.useMediaQuery=P,i.useMutationObserver=q,i.useResizeObserver=W,i.useScroll=x,i.useSlotsExist=Z,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,6 +1,5 @@
1
- import { defineComponent as n, computed as a, createElementBlock as r, openBlock as s, createVNode as p, unref as c } from "vue";
2
- import d from "topdatasec-ui";
3
- const m = { class: "chart-components" }, f = /* @__PURE__ */ n({
1
+ import { defineComponent as s, computed as a, resolveComponent as c, createElementBlock as p, openBlock as r, createVNode as d } from "vue";
2
+ const l = { class: "chart-components" }, u = /* @__PURE__ */ s({
4
3
  name: "TdsReportBar",
5
4
  __name: "TdsReportBar",
6
5
  props: {
@@ -10,11 +9,14 @@ const m = { class: "chart-components" }, f = /* @__PURE__ */ n({
10
9
  const o = t;
11
10
  console.log(o.data, 444444444);
12
11
  const e = a(() => o.data.options);
13
- return (i, l) => (s(), r("div", m, [
14
- p(c(d), { option: e.value }, null, 8, ["option"])
15
- ]));
12
+ return (m, _) => {
13
+ const n = c("TdsChart");
14
+ return r(), p("div", l, [
15
+ d(n, { option: e.value }, null, 8, ["option"])
16
+ ]);
17
+ };
16
18
  }
17
19
  });
18
20
  export {
19
- f as default
21
+ u as default
20
22
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("topdatasec-ui"),s={class:"chart-components"},a=e.defineComponent({name:"TdsReportBar",__name:"TdsReportBar",props:{data:{}},setup(t){const o=t;console.log(o.data,444444444);const n=e.computed(()=>o.data.options);return(c,u)=>(e.openBlock(),e.createElementBlock("div",s,[e.createVNode(e.unref(r),{option:n.value},null,8,["option"])]))}});exports.default=a;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),a={class:"chart-components"},r=e.defineComponent({name:"TdsReportBar",__name:"TdsReportBar",props:{data:{}},setup(t){const o=t;console.log(o.data,444444444);const n=e.computed(()=>o.data.options);return(c,p)=>{const s=e.resolveComponent("TdsChart");return e.openBlock(),e.createElementBlock("div",a,[e.createVNode(s,{option:n.value},null,8,["option"])])}}});exports.default=r;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topdatasec/report",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "author": "wangguiwang",
6
6
  "homepage": "",
@@ -78,7 +78,6 @@
78
78
  "prettier": "^3.5.3",
79
79
  "rimraf": "^6.0.1",
80
80
  "rollup-plugin-visualizer": "^5.14.0",
81
- "topdatasec-ui": "^1.6.1",
82
81
  "typescript": "^5.8.2",
83
82
  "unplugin-auto-import": "^19.1.1",
84
83
  "unplugin-vue-components": "^28.4.1",