@topdatasec/report 1.0.0

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/README.md ADDED
File without changes
File without changes
@@ -0,0 +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:"Bar",props:{data:{}},setup(e){const t=e,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"])]))}})),V=Object.freeze(Object.defineProperty({__proto__:null,TdsReportBar:y},Symbol.toStringTag,{value:"Module"}));function k(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 U(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 F(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=F(()=>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=F(()=>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 L={TdsReportBar:"TdsReportBar"},R={BackTop:["Tooltip"]};function J(e,t){if(["NumberAnimation","Watermark"].includes(e))return[];const n=[e];e in R&&n.push(...R[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}/${L[a]}/${a}.css`)}),s}function K(e){return{type:"component",resolve:t=>{if(t in L)return{name:t,from:"@topdatasec/report",sideEffects:J(t,e)}}}}const Y=function(e){return Object.values(V).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=k,u.debounce=T,u.default=Q,u.downloadFile=j,u.formatNumber=U,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["@topdatasec/report"]=this["@topdatasec/report"]||{},Vue,TdsChart);
package/dist/index.js ADDED
@@ -0,0 +1,370 @@
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({
4
+ name: "TdsReportBar",
5
+ __name: "Bar",
6
+ props: {
7
+ data: {}
8
+ },
9
+ setup(e) {
10
+ const t = e, n = h(() => t.data.options);
11
+ return (r, s) => (H(), B("div", P, [
12
+ U(V(C), { option: n.value }, null, 8, ["option"])
13
+ ]));
14
+ }
15
+ }), Z = (e) => {
16
+ const t = e;
17
+ return t.install = function(n) {
18
+ n.component(t.__name, e);
19
+ }, e;
20
+ }, G = Z(W), J = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
21
+ __proto__: null,
22
+ TdsReportBar: G
23
+ }, Symbol.toStringTag, { value: "Module" }));
24
+ function se(e = Date.now(), t = "YYYY-MM-DD HH:mm:ss") {
25
+ try {
26
+ let n;
27
+ if (typeof e == "number" || typeof e == "string") {
28
+ if (n = new Date(e), isNaN(n.getTime()))
29
+ throw new Error("Invalid date");
30
+ } else
31
+ n = e;
32
+ const r = (c, o = 2) => String(c).padStart(o, "0"), s = (c) => {
33
+ switch (c) {
34
+ case "YYYY":
35
+ return r(n.getFullYear());
36
+ case "YY":
37
+ return r(n.getFullYear()).slice(2, 4);
38
+ case "MM":
39
+ return r(n.getMonth() + 1);
40
+ case "M":
41
+ return String(n.getMonth() + 1);
42
+ case "DD":
43
+ return r(n.getDate());
44
+ case "D":
45
+ return String(n.getDate());
46
+ case "HH":
47
+ return r(n.getHours());
48
+ case "H":
49
+ return String(n.getHours());
50
+ case "mm":
51
+ return r(n.getMinutes());
52
+ case "m":
53
+ return String(n.getMinutes());
54
+ case "ss":
55
+ return r(n.getSeconds());
56
+ case "s":
57
+ return String(n.getSeconds());
58
+ case "SSS":
59
+ return r(n.getMilliseconds(), 3);
60
+ default:
61
+ return c;
62
+ }
63
+ };
64
+ return t.replace(/(YYYY|YY|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS)/g, s);
65
+ } catch (n) {
66
+ return console.error("Error formatting date:", n), "";
67
+ }
68
+ }
69
+ function oe(e, t = 2, n = ",", r = ".", s, c) {
70
+ 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");
71
+ const o = Number(e);
72
+ if (isNaN(o) || !isFinite(o))
73
+ return "";
74
+ if (o === 0)
75
+ return o.toFixed(t);
76
+ let i = o.toFixed(t);
77
+ if (typeof n == "string" && n !== "") {
78
+ const [l, d] = i.split(".");
79
+ i = l.replace(/(\d)(?=(\d{3})+$)/g, "$1" + n) + (d ? r + d : "");
80
+ }
81
+ return (s || "") + i + (c || "");
82
+ }
83
+ function ce(e, t = 0, n = !1) {
84
+ let r = null;
85
+ function s(o) {
86
+ if (r || (r = o), o - r >= t) {
87
+ try {
88
+ e();
89
+ } catch (l) {
90
+ console.error("Error executing rafTimeout function:", l);
91
+ }
92
+ n && (r = o, c.id = requestAnimationFrame(s));
93
+ } else
94
+ c.id = requestAnimationFrame(s);
95
+ }
96
+ const c = {
97
+ id: requestAnimationFrame(s)
98
+ };
99
+ return c;
100
+ }
101
+ function ae(e) {
102
+ e && e.id && typeof e.id == "number" ? cancelAnimationFrame(e.id) : console.warn("cancelRaf received an invalid id:", e);
103
+ }
104
+ function K(e, t = 300) {
105
+ let n = !0;
106
+ return function(...r) {
107
+ return n && (e(...r), n = !1, setTimeout(() => {
108
+ n = !0;
109
+ }, t)), !1;
110
+ };
111
+ }
112
+ function X(e, t = 300) {
113
+ let n = null;
114
+ return function(...r) {
115
+ n && clearTimeout(n), n = setTimeout(() => {
116
+ e(...r);
117
+ }, t);
118
+ };
119
+ }
120
+ function ie(e, t) {
121
+ if (Number.isNaN(e) || Number.isNaN(t))
122
+ throw new Error("Both num1 and num2 must be valid numbers.");
123
+ const n = e % 1 !== 0, r = t % 1 !== 0;
124
+ if (!n && !r)
125
+ return e + t;
126
+ const s = String(e).split(".")[1] ?? "", c = String(t).split(".")[1] ?? "", o = Math.max(s.length, c.length), i = Math.pow(10, o), l = e.toFixed(o), d = t.toFixed(o);
127
+ return (+l.replace(".", "") + +d.replace(".", "")) / i;
128
+ }
129
+ function le(e, t) {
130
+ if (!e) {
131
+ console.error("无效的 url");
132
+ return;
133
+ }
134
+ const n = t || e.split("?")[0].split("/").pop() || "download";
135
+ try {
136
+ fetch(e).then((r) => {
137
+ r.ok ? r.blob().then((s) => {
138
+ const c = URL.createObjectURL(s), o = document.createElement("a");
139
+ o.href = c, o.download = n, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(c);
140
+ }) : console.error("请求文件失败,状态码:", r.status);
141
+ });
142
+ } catch (r) {
143
+ console.error("文件下载失败:", r);
144
+ }
145
+ }
146
+ function ue() {
147
+ const e = document.documentElement;
148
+ e.classList.toggle("dark"), e.classList.contains("dark") ? e.style.colorScheme = "dark" : e.style.colorScheme = "light";
149
+ }
150
+ function Q() {
151
+ const e = f(!1), t = I();
152
+ return t && x(() => {
153
+ e.value = !0;
154
+ }, t), e;
155
+ }
156
+ function D(e) {
157
+ const t = Q();
158
+ return h(() => (t.value, !!e()));
159
+ }
160
+ function fe(e, t, n) {
161
+ x(() => e.addEventListener(t, n)), N(() => e.removeEventListener(t, n));
162
+ }
163
+ function de(e, t, n = {}) {
164
+ const r = D(() => window && "MutationObserver" in window), s = f(!1);
165
+ let c;
166
+ const o = h(() => {
167
+ const u = E(e);
168
+ return u ? Array.isArray(u) ? u.map((m) => E(m)).filter((m) => m) : [u] : [];
169
+ }), i = () => {
170
+ c && (c.disconnect(), c = void 0);
171
+ }, l = () => {
172
+ r.value && o.value.length && !s.value && (c = new MutationObserver(t), o.value.forEach((u) => c.observe(u, n)));
173
+ };
174
+ T(
175
+ () => o.value,
176
+ () => {
177
+ i(), l();
178
+ },
179
+ {
180
+ immediate: !0,
181
+ // 立即触发回调,以便初始状态也被观察
182
+ flush: "post"
183
+ }
184
+ );
185
+ const d = () => {
186
+ s.value = !0, i();
187
+ }, v = () => {
188
+ s.value = !1, l();
189
+ };
190
+ return S(() => i()), {
191
+ stop: d,
192
+ start: v
193
+ };
194
+ }
195
+ function me(e = window, t = 0, n, r) {
196
+ const s = f(0), c = f(0), o = f(0), i = f(0), l = f(!1), d = f(!1), v = f(!1), u = f(!1), m = f(!1), w = f(0), y = f(0);
197
+ function _(a) {
198
+ l.value = !0;
199
+ const p = a.target.documentElement ?? a.target;
200
+ 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);
201
+ }
202
+ const L = K(_, t);
203
+ function O(a) {
204
+ l.value && (l.value = !1, d.value = !1, v.value = !1, u.value = !1, m.value = !1, r && r(a));
205
+ }
206
+ const M = X(O, t + 200), Y = h(() => {
207
+ const a = E(e);
208
+ return a || null;
209
+ });
210
+ T(
211
+ () => Y.value,
212
+ (a, p) => {
213
+ var b;
214
+ if (p && F(p), a) {
215
+ const g = ((b = a == null ? void 0 : a.document) == null ? void 0 : b.documentElement) || (a == null ? void 0 : a.documentElement) || a;
216
+ c.value = g.scrollWidth - g.clientWidth, i.value = g.scrollHeight - g.clientHeight, g.addEventListener("scroll", L), g.addEventListener("scrollend", M);
217
+ }
218
+ },
219
+ {
220
+ immediate: !0,
221
+ flush: "post"
222
+ }
223
+ );
224
+ function F(a) {
225
+ var b;
226
+ const p = ((b = a == null ? void 0 : a.document) == null ? void 0 : b.documentElement) || (a == null ? void 0 : a.documentElement) || a;
227
+ p.removeEventListener("scroll", L), p.removeEventListener("scrollend", M);
228
+ }
229
+ return S(() => F(Y.value)), { x: s, xScrollMax: c, y: o, yScrollMax: i, isScrolling: l, left: d, right: v, top: u, bottom: m };
230
+ }
231
+ function ve() {
232
+ const e = f(0), t = f(0);
233
+ let n = performance.now();
234
+ const r = 10, s = (c) => {
235
+ if (t.value++, t.value >= r) {
236
+ const o = c - n;
237
+ e.value = Math.round(1e3 / (o / r)), n = c, t.value = 0;
238
+ }
239
+ requestAnimationFrame(s);
240
+ };
241
+ return requestAnimationFrame(s), { fps: e };
242
+ }
243
+ function pe(e) {
244
+ if (!e || typeof e != "string" || e.trim() === "")
245
+ throw new Error("Invalid mediaQuery parameter. It must be a non-empty string.");
246
+ const t = f(window && window.matchMedia(e).matches), n = window.matchMedia(e), r = (s) => {
247
+ t.value = s.matches;
248
+ };
249
+ return x(() => {
250
+ n.addEventListener("change", r);
251
+ }), S(() => {
252
+ n.removeEventListener("change", r);
253
+ }), { match: t };
254
+ }
255
+ function he(e, t, n = {}) {
256
+ const r = D(() => window && "ResizeObserver" in window);
257
+ let s;
258
+ const c = f(!1), o = h(() => {
259
+ const u = E(e);
260
+ return u ? Array.isArray(u) ? u.map((m) => E(m)).filter((m) => m) : [u] : [];
261
+ }), i = () => {
262
+ s && (s.disconnect(), s = void 0);
263
+ }, l = () => {
264
+ r.value && o.value.length && !c.value && (s = new ResizeObserver(t), o.value.forEach((u) => s.observe(u, n)));
265
+ };
266
+ T(
267
+ () => o.value,
268
+ () => {
269
+ i(), l();
270
+ },
271
+ {
272
+ immediate: !0,
273
+ // 立即触发回调,以便初始状态也被观察
274
+ flush: "post"
275
+ }
276
+ );
277
+ const d = () => {
278
+ c.value = !0, i();
279
+ }, v = () => {
280
+ c.value = !1, l();
281
+ };
282
+ return S(() => i()), {
283
+ stop: d,
284
+ start: v
285
+ };
286
+ }
287
+ function ge(e = "default") {
288
+ const t = $(), n = (r) => {
289
+ var o;
290
+ const s = (o = t[r]) == null ? void 0 : o.call(t), c = (i) => {
291
+ if (i.type === q || Array.isArray(i.children) && !i.children.length)
292
+ return !1;
293
+ if (i.type !== z)
294
+ return !0;
295
+ if (typeof i.children == "string")
296
+ return i.children.trim() !== "";
297
+ };
298
+ return s && (s != null && s.length) ? s.some((l) => c(l)) : !1;
299
+ };
300
+ if (Array.isArray(e)) {
301
+ const r = j({});
302
+ return e.forEach((s) => {
303
+ const c = h(() => n(s));
304
+ r[s] = c;
305
+ }), r;
306
+ } else
307
+ return h(() => n(e));
308
+ }
309
+ const R = {
310
+ TdsReportBar: "TdsReportBar"
311
+ }, A = {
312
+ BackTop: ["Tooltip"]
313
+ };
314
+ function ee(e, t) {
315
+ if (["NumberAnimation", "Watermark"].includes(e))
316
+ return [];
317
+ const n = [e];
318
+ e in A && n.push(...A[e]);
319
+ const r = t != null && t.cjs ? "lib" : "es", s = [`@topdatasec/report/${r}/style/global.css`];
320
+ return n.forEach((c) => {
321
+ s.push(
322
+ `@topdatasec/report/${r}/${R[c]}/${c}.css`
323
+ );
324
+ }), s;
325
+ }
326
+ function be(e) {
327
+ return {
328
+ type: "component",
329
+ resolve: (t) => {
330
+ if (t in R)
331
+ return {
332
+ name: t,
333
+ // 组件名
334
+ from: "@topdatasec/report",
335
+ // 组件库名称
336
+ sideEffects: ee(t, e)
337
+ // 组件样式文件
338
+ };
339
+ }
340
+ };
341
+ }
342
+ const te = function(e) {
343
+ return Object.values(J).forEach((t) => {
344
+ t && t.install && e.use(t);
345
+ }), e;
346
+ }, Ee = {
347
+ install: te
348
+ };
349
+ export {
350
+ G as TdsReportBar,
351
+ be as VueAmazingUIResolver,
352
+ ie as add,
353
+ ae as cancelRaf,
354
+ se as dateFormat,
355
+ X as debounce,
356
+ Ee as default,
357
+ le as downloadFile,
358
+ oe as formatNumber,
359
+ te as install,
360
+ ce as rafTimeout,
361
+ K as throttle,
362
+ ue as toggleDark,
363
+ fe as useEventListener,
364
+ ve as useFps,
365
+ pe as useMediaQuery,
366
+ de as useMutationObserver,
367
+ he as useResizeObserver,
368
+ me as useScroll,
369
+ ge as useSlotsExist
370
+ };
@@ -0,0 +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["@topdatasec/report"]=i["@topdatasec/report"]||{},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:"Bar",props:{data:{}},setup(e){const t=e,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"])]))}})),V=Object.freeze(Object.defineProperty({__proto__:null,TdsReportBar:y},Symbol.toStringTag,{value:"Module"}));function k(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 U(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 j(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 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 F(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=F(()=>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=F(()=>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 L={TdsReportBar:"TdsReportBar"},R={BackTop:["Tooltip"]};function J(e,t){if(["NumberAnimation","Watermark"].includes(e))return[];const n=[e];e in R&&n.push(...R[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}/${L[a]}/${a}.css`)}),s}function K(e){return{type:"component",resolve:t=>{if(t in L)return{name:t,from:"@topdatasec/report",sideEffects:J(t,e)}}}}const Y=function(e){return Object.values(V).forEach(t=>{t&&t.install&&e.use(t)}),e},Q={install:Y};i.TdsReportBar=y,i.VueAmazingUIResolver=K,i.add=I,i.cancelRaf=j,i.dateFormat=k,i.debounce=T,i.default=Q,i.downloadFile=N,i.formatNumber=U,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"}})});
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ *,*:before,*:after{box-sizing:border-box;margin:0;padding:0;caret-color:transparent}:root{--primary-color: #1677ff;--primary-color-hover: #4096ff}body{font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}input,textarea{caret-color:auto}a{color:var(--primary-color);text-decoration:none;background-color:transparent;-webkit-tap-highlight-color:transparent;outline:none;cursor:pointer;transition:color .3s ease}a:hover{color:var(--primary-color-hover)}
@@ -0,0 +1,52 @@
1
+ import { Slot } from 'vue';
2
+ export interface Props {
3
+ message?: string;
4
+ description?: string;
5
+ type?: 'default' | 'success' | 'info' | 'warning' | 'error';
6
+ bordered?: boolean;
7
+ closable?: boolean;
8
+ closeText?: string;
9
+ icon?: string;
10
+ showIcon?: boolean;
11
+ actions?: Slot;
12
+ }
13
+ declare function __VLS_template(): {
14
+ attrs: Partial<{}>;
15
+ slots: {
16
+ icon?(_: {}): any;
17
+ icon?(_: {}): any;
18
+ default?(_: {}): any;
19
+ description?(_: {}): any;
20
+ actions?(_: {}): any;
21
+ closeText?(_: {}): any;
22
+ };
23
+ refs: {
24
+ alertRef: HTMLDivElement;
25
+ };
26
+ rootEl: any;
27
+ };
28
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
29
+ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
30
+ close: (...args: any[]) => void;
31
+ }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
32
+ onClose?: ((...args: any[]) => any) | undefined;
33
+ }>, {
34
+ type: "default" | "success" | "info" | "warning" | "error";
35
+ message: string;
36
+ description: string;
37
+ bordered: boolean;
38
+ closable: boolean;
39
+ closeText: string;
40
+ icon: string;
41
+ showIcon: boolean;
42
+ actions: Slot;
43
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
44
+ alertRef: HTMLDivElement;
45
+ }, any>;
46
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
47
+ export default _default;
48
+ type __VLS_WithTemplateSlots<T, S> = T & {
49
+ new (): {
50
+ $slots: S;
51
+ };
52
+ };
@@ -0,0 +1,66 @@
1
+ export type { Props } from './Alert';
2
+ declare const _default: {
3
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./Alert').Props> & Readonly<{
4
+ onClose?: ((...args: any[]) => any) | undefined;
5
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
6
+ close: (...args: any[]) => void;
7
+ }, import('vue').PublicProps, {
8
+ type: "default" | "success" | "info" | "warning" | "error";
9
+ message: string;
10
+ description: string;
11
+ bordered: boolean;
12
+ closable: boolean;
13
+ closeText: string;
14
+ icon: string;
15
+ showIcon: boolean;
16
+ actions: import('vue').Slot;
17
+ }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
18
+ alertRef: HTMLDivElement;
19
+ }, any, import('vue').ComponentProvideOptions, {
20
+ P: {};
21
+ B: {};
22
+ D: {};
23
+ C: {};
24
+ M: {};
25
+ Defaults: {};
26
+ }, Readonly<import('./Alert').Props> & Readonly<{
27
+ onClose?: ((...args: any[]) => any) | undefined;
28
+ }>, {}, {}, {}, {}, {
29
+ type: "default" | "success" | "info" | "warning" | "error";
30
+ message: string;
31
+ description: string;
32
+ bordered: boolean;
33
+ closable: boolean;
34
+ closeText: string;
35
+ icon: string;
36
+ showIcon: boolean;
37
+ actions: import('vue').Slot;
38
+ }>;
39
+ __isFragment?: never;
40
+ __isTeleport?: never;
41
+ __isSuspense?: never;
42
+ } & import('vue').ComponentOptionsBase<Readonly<import('./Alert').Props> & Readonly<{
43
+ onClose?: ((...args: any[]) => any) | undefined;
44
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
45
+ close: (...args: any[]) => void;
46
+ }, string, {
47
+ type: "default" | "success" | "info" | "warning" | "error";
48
+ message: string;
49
+ description: string;
50
+ bordered: boolean;
51
+ closable: boolean;
52
+ closeText: string;
53
+ icon: string;
54
+ showIcon: boolean;
55
+ actions: import('vue').Slot;
56
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
57
+ $slots: {
58
+ icon?(_: {}): any;
59
+ icon?(_: {}): any;
60
+ default?(_: {}): any;
61
+ description?(_: {}): any;
62
+ actions?(_: {}): any;
63
+ closeText?(_: {}): any;
64
+ };
65
+ }) & import('vue').Plugin;
66
+ export default _default;
@@ -0,0 +1,5 @@
1
+ export type Props = {
2
+ data: any;
3
+ };
4
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
5
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import { defineComponent as n, computed as r, createElementBlock as a, openBlock as p, createVNode as s, unref as c } from "vue";
2
+ import m from "topdatasec-ui";
3
+ const d = { class: "chart-components" }, f = /* @__PURE__ */ n({
4
+ name: "TdsReportBar",
5
+ __name: "Bar",
6
+ props: {
7
+ data: {}
8
+ },
9
+ setup(o) {
10
+ const t = o, e = r(() => t.data.options);
11
+ return (i, l) => (p(), a("div", d, [
12
+ s(c(m), { option: e.value }, null, 8, ["option"])
13
+ ]));
14
+ }
15
+ });
16
+ export {
17
+ f as default
18
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./Bar.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,15 @@
1
+ export type { Props } from './Bar';
2
+ declare const _default: {
3
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./Bar').Props> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
4
+ P: {};
5
+ B: {};
6
+ D: {};
7
+ C: {};
8
+ M: {};
9
+ Defaults: {};
10
+ }, Readonly<import('./Bar').Props> & Readonly<{}>, {}, {}, {}, {}, {}>;
11
+ __isFragment?: never;
12
+ __isTeleport?: never;
13
+ __isSuspense?: never;
14
+ } & import('vue').ComponentOptionsBase<Readonly<import('./Bar').Props> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & import('vue').Plugin;
15
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import t from "./Bar.vue.js";
2
+ import { withInstall as o } from "../utils/type.js";
3
+ const r = o(t);
4
+ export {
5
+ r as default
6
+ };
@@ -0,0 +1,2 @@
1
+ export type { Props as TdsReportBarProps } from './bar';
2
+ export { default as TdsReportBar } from './bar';
@@ -0,0 +1,4 @@
1
+ import { default as e } from "./bar/index.js";
2
+ export {
3
+ e as TdsReportBar
4
+ };
package/es/index.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { App } from 'vue';
2
+ export * from './components';
3
+ export { dateFormat, formatNumber, rafTimeout, cancelRaf, throttle, debounce, add, downloadFile, toggleDark, useEventListener, useMutationObserver, useScroll, useFps, useMediaQuery, useResizeObserver, useSlotsExist } from './utils';
4
+ export { VueAmazingUIResolver } from './utils/resolver';
5
+ export type { VueAmazingUIResolverOptions } from './utils/resolver';
6
+ export declare const install: (app: App) => App<any>;
7
+ declare const _default: {
8
+ install: (app: App) => App<any>;
9
+ };
10
+ export default _default;
package/es/index.js ADDED
@@ -0,0 +1,34 @@
1
+ /* empty css */
2
+ import * as t from "./components.js";
3
+ import { add as i, cancelRaf as n, dateFormat as f, debounce as d, downloadFile as m, formatNumber as c, rafTimeout as x, throttle as b, toggleDark as p, useEventListener as v, useFps as R, useMediaQuery as g, useMutationObserver as E, useResizeObserver as F, useScroll as O, useSlotsExist as h } from "./utils/index.js";
4
+ import { VueAmazingUIResolver as M } from "./utils/resolver.js";
5
+ import { default as T } from "./bar/index.js";
6
+ const s = function(r) {
7
+ return Object.values(t).forEach((e) => {
8
+ e && e.install && r.use(e);
9
+ }), r;
10
+ }, a = {
11
+ install: s
12
+ };
13
+ export {
14
+ T as TdsReportBar,
15
+ M as VueAmazingUIResolver,
16
+ i as add,
17
+ n as cancelRaf,
18
+ f as dateFormat,
19
+ d as debounce,
20
+ a as default,
21
+ m as downloadFile,
22
+ c as formatNumber,
23
+ s as install,
24
+ x as rafTimeout,
25
+ b as throttle,
26
+ p as toggleDark,
27
+ v as useEventListener,
28
+ R as useFps,
29
+ g as useMediaQuery,
30
+ E as useMutationObserver,
31
+ F as useResizeObserver,
32
+ O as useScroll,
33
+ h as useSlotsExist
34
+ };
@@ -0,0 +1 @@
1
+ *,*:before,*:after{box-sizing:border-box;margin:0;padding:0;caret-color:transparent}:root{--primary-color: #1677ff;--primary-color-hover: #4096ff}body{font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}input,textarea{caret-color:auto}a{color:var(--primary-color);text-decoration:none;background-color:transparent;-webkit-tap-highlight-color:transparent;outline:none;cursor:pointer;transition:color .3s ease}a:hover{color:var(--primary-color-hover)}