vue-happy-framework 1.0.9 → 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.
- package/README.md +19 -0
- package/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
- package/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/index.css +1 -0
- package/index2.css +1 -0
- package/mobile/components/index.cjs +1 -0
- package/mobile/components/index.d.ts +3 -0
- package/mobile/components/index.js +53 -0
- package/mobile/utils/index.d.ts +2 -0
- package/package.json +11 -5
- package/pc/components/index.cjs +1 -1
- package/pc/components/index.d.ts +3 -0
- package/pc/components/index.js +61 -20
- package/pc/utils/index.cjs +11 -0
- package/pc/utils/index.d.ts +2 -0
- package/pc/utils/index.js +3032 -0
- package/utils/index.cjs +1 -1
- package/utils/index.d.ts +7 -0
- package/utils/index.js +177 -35
package/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
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;
|
package/utils/index.d.ts
ADDED
|
@@ -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
|
|
2
|
-
var
|
|
3
|
-
|
|
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(
|
|
5
|
+
setTimeout(l, e);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
var
|
|
9
|
-
let
|
|
10
|
-
const
|
|
11
|
-
for (var
|
|
12
|
-
let m =
|
|
13
|
-
|
|
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
|
-
|
|
15
|
+
t.appendChild(l);
|
|
16
16
|
let u = 0;
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
{ top: -((
|
|
22
|
-
{ top: -(
|
|
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
|
-
|
|
30
|
-
}, 1e3),
|
|
31
|
-
}
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
clearTimeout(
|
|
35
|
-
},
|
|
36
|
-
|
|
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
|
|
40
|
-
|
|
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
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
v as
|
|
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
|
};
|