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