vue-happy-framework 1.0.10 → 1.0.11

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.
@@ -0,0 +1,3 @@
1
+ import { default as button } from './button/index.vue';
2
+ import { default as badge } from './badge/index.vue';
3
+ export { button as VhfButton, badge as VhfBadge };
@@ -0,0 +1,2 @@
1
+ import { request, getClientFile, getUrl } from './request';
2
+ export { request, getClientFile, getUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-happy-framework",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "基于Vue的应用框架",
5
5
  "keywords": [
6
6
  "vue",
@@ -36,11 +36,13 @@
36
36
  "vue-router": "^4.4.3"
37
37
  },
38
38
  "devDependencies": {
39
+ "@rollup/plugin-typescript": "^12.1.2",
39
40
  "@vitejs/plugin-vue": "^5.2.1",
40
41
  "sass": "^1.79.1",
41
42
  "typescript": "^5.5.3",
42
43
  "vite": "^6.0.1",
43
44
  "vite-plugin-cp": "^4.0.8",
45
+ "vite-plugin-dts": "^4.4.0",
44
46
  "vue-tsc": "^2.0.29"
45
47
  }
46
48
  }
@@ -0,0 +1,3 @@
1
+ import { default as button } from './button/index.vue';
2
+ import { default as badge } from './badge/index.vue';
3
+ export { button as VhfButton, badge as VhfBadge };
@@ -0,0 +1,2 @@
1
+ import { request, getClientFile, getUrl } from './request';
2
+ export { request, getClientFile, getUrl };
package/utils/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function f(n,o,t){var e=document.getElementById(n),r=e.getAttribute(o),i=r-1e3,a=function(){i<r&&(i++,e.innerText=i),setTimeout(a,t)};setTimeout(a,t)}function p(n,o){var t=document.getElementsByClassName(n)[0],e=t.firstElementChild,r=e.children.length;let i=e==null?void 0:e.children;const a=document.createDocumentFragment();for(var d=0;d<r;d++){let m=i[d].cloneNode(!0);a.appendChild(m)}e.appendChild(a);let u=0;r>=2&&(u=e==null?void 0:e.children[1].offsetTop);var l=0;function c(){l>=r&&(l=0,e.style.top="0px"),l++,e.children[l-1].classList.add("active"),e.animate([{top:-((l-1)*u)+"px"},{top:-(l*u)+"px"}],{duration:1e3,delay:100,easing:"ease-in",fill:"forwards"}),setTimeout(function(){e.children[l-1].classList.remove("active")},1e3),s=setTimeout(c,o)}var s=setTimeout(c,o);t.onmouseover=function(){clearTimeout(s)},t.onmouseout=function(){s=setTimeout(c,o)}}function v(n){return`undefined${n}`}function h(n,o){let t=new Blob([n]),e=document.createElement("a");e.download="导出文件.xlsx",e.href=URL.createObjectURL(t),e.style.display="none",e.target="_blank",document.appendChild(e),e.click(),URL.revokeObjectURL(t),document.body.removeChild(e)}exports.AutoScroll=p;exports.NunberAdd=f;exports.exportExl=h;exports.getFileUrl=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function y(i,n,e){var t=document.getElementById(i),r=t.getAttribute(n),o=r-1e3,a=function(){o<r&&(o++,t.innerText=o),setTimeout(a,e)};setTimeout(a,e)}function b(i,n){var e=document.getElementsByClassName(i)[0],t=e.firstElementChild,r=t.children.length;let o=t==null?void 0:t.children;const a=document.createDocumentFragment();for(var l=0;l<r;l++){let T=o[l].cloneNode(!0);a.appendChild(T)}t.appendChild(a);let u=0;r>=2&&(u=t==null?void 0:t.children[1].offsetTop);var s=0;function d(){s>=r&&(s=0,t.style.top="0px"),s++,t.children[s-1].classList.add("active"),t.animate([{top:-((s-1)*u)+"px"},{top:-(s*u)+"px"}],{duration:1e3,delay:100,easing:"ease-in",fill:"forwards"}),setTimeout(function(){t.children[s-1].classList.remove("active")},1e3),f=setTimeout(d,n)}var f=setTimeout(d,n);e.onmouseover=function(){clearTimeout(f)},e.onmouseout=function(){f=setTimeout(d,n)}}function w(i){return`undefined${i}`}function C(i,n){let e=new Blob([i]),t=document.createElement("a");t.download="导出文件.xlsx",t.href=URL.createObjectURL(e),t.style.display="none",t.target="_blank",document.appendChild(t),t.click(),URL.revokeObjectURL(e),document.body.removeChild(t)}class x{constructor(){this.bus={}}$on(n,e){if(this.bus.hasOwnProperty(n)){console.log("该事件名已订阅过");return}this.bus[n]=e}$emit(n,e){this.bus[n].apply(null,[e])}$off(n){delete this.bus[n]}}function O(i,n){var e=null;return function(){clearTimeout(e),e=setTimeout(()=>{i.apply(this,arguments)},n)}}function B(i,n){var e=!0;return function(){e&&(e=!1,setTimeout(()=>{i.apply(this,arguments),e=!0},n))}}function c(i){var n=Array.isArray(i)?[]:{};if(i&&typeof i=="object")for(let e in i)i.hasOwnProperty(e)&&(i[e]&&typeof i[e]=="object"?n[e]=c(i[e]):n[e]=i[e]);return n}function E(i){return new Promise(n=>{var e=new Image;e.crossOrigin="anonymous",e.src=i,e.onload=function(){var t=document.createElement("canvas");t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0);var r=t.toDataURL();n(r)}})}function L(i){return new Promise(n=>{var e=new Image;e.crossOrigin="anonymous",e.src=i,e.onload=function(){var t=document.createElement("canvas");t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0),t.toBlob(r=>{n(r)})}})}function D(i,n){let e=JSON.parse(JSON.stringify(i)),t="id",r="pid";n&&(t=n.id,r=n.pid);let o=new Map;for(let l of e)o.set(l[t],l);let a=[];for(let l of e)if(o.has(l[r])){let u=o.get(l[r]);u.children==null&&(u.children=[]),u.children.push(l)}else a.push(l);return a}function m(i=[],n=[],e=[]){if(!i.length)return[];for(let t of i){if(!(n.includes(items.parentCode)||n.includes(t.organCode)))continue;let r={...t,children:[]};e.push(r),t.children&&t.children.length&&m(t.children,n,r.children)}}function h(i,n,e){e==null&&(e="children");for(let t of i){if(n(t))return t;if(t[e]){let r=h(t[e],n);if(r)return r}}}function p(i,n,e){e==null&&(e="children");for(let t of i){for(let r in n)t[r]=n[r];t[e]&&p(t[e],n,e)}}function g(i,n){var e=[];let t="children";return n&&(t=n.children),v(i,e,t),e}function v(i,n,e){if(!(!i||!i.length))for(let t of i){let r=JSON.parse(JSON.stringify(t));t[e]&&delete r[e],n.push(r),t[e]&&v(t[e],n,e)}}function S(i,n,e){let t=g(i,e);for(let r of t){itemMap[r.id]=r;let o=itemMap[r.parentId];o&&(r.parent={},r.parent=o),r.code==n&&(data=itemMap[r.id])}return data}exports.AutoScroll=b;exports.EventBus=x;exports.NunberAdd=y;exports.addDataTree=p;exports.debounce=O;exports.deepClone=c;exports.exportExl=C;exports.filterTree=m;exports.findTreeNode=h;exports.getFileUrl=w;exports.getParentData=S;exports.imgToBase64=E;exports.imgToBlob=L;exports.listToTree=D;exports.throttle=B;exports.treeToList=g;
@@ -0,0 +1,7 @@
1
+ import { AutoScroll, NunberAdd } from './animation';
2
+ import { exportExl, getFileUrl } from './file';
3
+ import { default as EventBus } from './EventBus';
4
+ import { debounce, throttle, deepClone } from './function';
5
+ import { imgToBase64, imgToBlob } from './img';
6
+ import { listToTree, treeToList, filterTree, findTreeNode, addDataTree, getParentData } from './tree';
7
+ export { AutoScroll, NunberAdd, exportExl, getFileUrl, EventBus, debounce, throttle, deepClone, imgToBase64, imgToBlob, listToTree, treeToList, filterTree, findTreeNode, addDataTree, getParentData };
package/utils/index.js CHANGED
@@ -1,51 +1,193 @@
1
- function f(n, o, t) {
2
- var e = document.getElementById(n), l = e.getAttribute(o), r = l - 1e3, a = function() {
3
- r < l && (r++, e.innerText = r), setTimeout(a, t);
1
+ function T(i, n, e) {
2
+ var t = document.getElementById(i), r = t.getAttribute(n), o = r - 1e3, l = function() {
3
+ o < r && (o++, t.innerText = o), setTimeout(l, e);
4
4
  };
5
- setTimeout(a, t);
5
+ setTimeout(l, e);
6
6
  }
7
- function p(n, o) {
8
- var t = document.getElementsByClassName(n)[0], e = t.firstElementChild, l = e.children.length;
9
- let r = e == null ? void 0 : e.children;
10
- const a = document.createDocumentFragment();
11
- for (var d = 0; d < l; d++) {
12
- let m = r[d].cloneNode(!0);
13
- a.appendChild(m);
7
+ function w(i, n) {
8
+ var e = document.getElementsByClassName(i)[0], t = e.firstElementChild, r = t.children.length;
9
+ let o = t == null ? void 0 : t.children;
10
+ const l = document.createDocumentFragment();
11
+ for (var a = 0; a < r; a++) {
12
+ let m = o[a].cloneNode(!0);
13
+ l.appendChild(m);
14
14
  }
15
- e.appendChild(a);
15
+ t.appendChild(l);
16
16
  let u = 0;
17
- l >= 2 && (u = e == null ? void 0 : e.children[1].offsetTop);
18
- var i = 0;
19
- function c() {
20
- i >= l && (i = 0, e.style.top = "0px"), i++, e.children[i - 1].classList.add("active"), e.animate([
21
- { top: -((i - 1) * u) + "px" },
22
- { top: -(i * u) + "px" }
17
+ r >= 2 && (u = t == null ? void 0 : t.children[1].offsetTop);
18
+ var s = 0;
19
+ function f() {
20
+ s >= r && (s = 0, t.style.top = "0px"), s++, t.children[s - 1].classList.add("active"), t.animate([
21
+ { top: -((s - 1) * u) + "px" },
22
+ { top: -(s * u) + "px" }
23
23
  ], {
24
24
  duration: 1e3,
25
25
  delay: 100,
26
26
  easing: "ease-in",
27
27
  fill: "forwards"
28
28
  }), setTimeout(function() {
29
- e.children[i - 1].classList.remove("active");
30
- }, 1e3), s = setTimeout(c, o);
31
- }
32
- var s = setTimeout(c, o);
33
- t.onmouseover = function() {
34
- clearTimeout(s);
35
- }, t.onmouseout = function() {
36
- s = setTimeout(c, o);
29
+ t.children[s - 1].classList.remove("active");
30
+ }, 1e3), d = setTimeout(f, n);
31
+ }
32
+ var d = setTimeout(f, n);
33
+ e.onmouseover = function() {
34
+ clearTimeout(d);
35
+ }, e.onmouseout = function() {
36
+ d = setTimeout(f, n);
37
+ };
38
+ }
39
+ function b(i) {
40
+ return `undefined${i}`;
41
+ }
42
+ function C(i, n) {
43
+ let e = new Blob([i]), t = document.createElement("a");
44
+ t.download = "导出文件.xlsx", t.href = URL.createObjectURL(e), t.style.display = "none", t.target = "_blank", document.appendChild(t), t.click(), URL.revokeObjectURL(e), document.body.removeChild(t);
45
+ }
46
+ class x {
47
+ constructor() {
48
+ this.bus = {};
49
+ }
50
+ $on(n, e) {
51
+ if (this.bus.hasOwnProperty(n)) {
52
+ console.log("该事件名已订阅过");
53
+ return;
54
+ }
55
+ this.bus[n] = e;
56
+ }
57
+ $emit(n, e) {
58
+ this.bus[n].apply(null, [e]);
59
+ }
60
+ $off(n) {
61
+ delete this.bus[n];
62
+ }
63
+ }
64
+ function O(i, n) {
65
+ var e = null;
66
+ return function() {
67
+ clearTimeout(e), e = setTimeout(() => {
68
+ i.apply(this, arguments);
69
+ }, n);
70
+ };
71
+ }
72
+ function L(i, n) {
73
+ var e = !0;
74
+ return function() {
75
+ e && (e = !1, setTimeout(() => {
76
+ i.apply(this, arguments), e = !0;
77
+ }, n));
37
78
  };
38
79
  }
39
- function v(n) {
40
- return `undefined${n}`;
80
+ function h(i) {
81
+ var n = Array.isArray(i) ? [] : {};
82
+ if (i && typeof i == "object")
83
+ for (let e in i)
84
+ i.hasOwnProperty(e) && (i[e] && typeof i[e] == "object" ? n[e] = h(i[e]) : n[e] = i[e]);
85
+ return n;
41
86
  }
42
- function h(n, o) {
43
- let t = new Blob([n]), e = document.createElement("a");
44
- e.download = "导出文件.xlsx", e.href = URL.createObjectURL(t), e.style.display = "none", e.target = "_blank", document.appendChild(e), e.click(), URL.revokeObjectURL(t), document.body.removeChild(e);
87
+ function E(i) {
88
+ return new Promise((n) => {
89
+ var e = new Image();
90
+ e.crossOrigin = "anonymous", e.src = i, e.onload = function() {
91
+ var t = document.createElement("canvas");
92
+ t.width = e.width, t.height = e.height, t.getContext("2d").drawImage(e, 0, 0);
93
+ var r = t.toDataURL();
94
+ n(r);
95
+ };
96
+ });
97
+ }
98
+ function B(i) {
99
+ return new Promise((n) => {
100
+ var e = new Image();
101
+ e.crossOrigin = "anonymous", e.src = i, e.onload = function() {
102
+ var t = document.createElement("canvas");
103
+ t.width = e.width, t.height = e.height, t.getContext("2d").drawImage(e, 0, 0), t.toBlob((r) => {
104
+ n(r);
105
+ });
106
+ };
107
+ });
108
+ }
109
+ function D(i, n) {
110
+ let e = JSON.parse(JSON.stringify(i)), t = "id", r = "pid";
111
+ n && (t = n.id, r = n.pid);
112
+ let o = /* @__PURE__ */ new Map();
113
+ for (let a of e)
114
+ o.set(a[t], a);
115
+ let l = [];
116
+ for (let a of e)
117
+ if (o.has(a[r])) {
118
+ let u = o.get(a[r]);
119
+ u.children == null && (u.children = []), u.children.push(a);
120
+ } else
121
+ l.push(a);
122
+ return l;
123
+ }
124
+ function p(i = [], n = [], e = []) {
125
+ if (!i.length) return [];
126
+ for (let t of i) {
127
+ if (!(n.includes(items.parentCode) || n.includes(t.organCode))) continue;
128
+ let r = {
129
+ ...t,
130
+ children: []
131
+ };
132
+ e.push(r), t.children && t.children.length && p(t.children, n, r.children);
133
+ }
134
+ }
135
+ function g(i, n, e) {
136
+ e == null && (e = "children");
137
+ for (let t of i) {
138
+ if (n(t))
139
+ return t;
140
+ if (t[e]) {
141
+ let r = g(t[e], n);
142
+ if (r)
143
+ return r;
144
+ }
145
+ }
146
+ }
147
+ function v(i, n, e) {
148
+ e == null && (e = "children");
149
+ for (let t of i) {
150
+ for (let r in n)
151
+ t[r] = n[r];
152
+ t[e] && v(t[e], n, e);
153
+ }
154
+ }
155
+ function y(i, n) {
156
+ var e = [];
157
+ let t = "children";
158
+ return n && (t = n.children), c(i, e, t), e;
159
+ }
160
+ function c(i, n, e) {
161
+ if (!(!i || !i.length))
162
+ for (let t of i) {
163
+ let r = JSON.parse(JSON.stringify(t));
164
+ t[e] && delete r[e], n.push(r), t[e] && c(t[e], n, e);
165
+ }
166
+ }
167
+ function I(i, n, e) {
168
+ let t = y(i, e);
169
+ for (let r of t) {
170
+ itemMap[r.id] = r;
171
+ let o = itemMap[r.parentId];
172
+ o && (r.parent = {}, r.parent = o), r.code == n && (data = itemMap[r.id]);
173
+ }
174
+ return data;
45
175
  }
46
176
  export {
47
- p as AutoScroll,
48
- f as NunberAdd,
49
- h as exportExl,
50
- v as getFileUrl
177
+ w as AutoScroll,
178
+ x as EventBus,
179
+ T as NunberAdd,
180
+ v as addDataTree,
181
+ O as debounce,
182
+ h as deepClone,
183
+ C as exportExl,
184
+ p as filterTree,
185
+ g as findTreeNode,
186
+ b as getFileUrl,
187
+ I as getParentData,
188
+ E as imgToBase64,
189
+ B as imgToBlob,
190
+ D as listToTree,
191
+ L as throttle,
192
+ y as treeToList
51
193
  };