@lambo-design/shared 1.0.0-beta.64 → 1.0.0-beta.67
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/package.json +1 -1
- package/utils/assist.js +6 -0
- package/utils/base64.js +126 -39
package/package.json
CHANGED
package/utils/assist.js
CHANGED
|
@@ -61,6 +61,9 @@ export function typeOf(obj) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export function operateBtn(vm, h, currentRow, operationName, operation, type, permission) {
|
|
64
|
+
if (!permission){
|
|
65
|
+
permission = '1'
|
|
66
|
+
}
|
|
64
67
|
return h('Button', {
|
|
65
68
|
props: {
|
|
66
69
|
type: type,
|
|
@@ -84,6 +87,9 @@ export function operateBtn(vm, h, currentRow, operationName, operation, type, pe
|
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
export function operateHref(vm, h, currentRow, operationName, operation, type, permission) {
|
|
90
|
+
if (!permission){
|
|
91
|
+
permission = '1'
|
|
92
|
+
}
|
|
87
93
|
return h('a', {
|
|
88
94
|
style: {
|
|
89
95
|
margin: '0 4px'
|
package/utils/base64.js
CHANGED
|
@@ -1,39 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
1
|
+
let Base64 = {
|
|
2
|
+
Base64Chars:
|
|
3
|
+
"abcdefghijklmnopqrstuv" +
|
|
4
|
+
"wxyzABCDEFGHIJKLMNOP" +
|
|
5
|
+
"QRSTUVWXYZ0123456789@*-",
|
|
6
|
+
/**
|
|
7
|
+
* Encode a string to a Base64 string follow Bse64 regular.
|
|
8
|
+
* @param s, a normal string
|
|
9
|
+
* @return a Base64 string
|
|
10
|
+
*/
|
|
11
|
+
encode: function (s) {
|
|
12
|
+
if (!s || s.length == 0) return s;
|
|
13
|
+
|
|
14
|
+
var d = "";
|
|
15
|
+
var b = this.ucs2_utf8(s);
|
|
16
|
+
var b0, b1, b2, b3;
|
|
17
|
+
var len = b.length;
|
|
18
|
+
var i = 0;
|
|
19
|
+
while (i < len) {
|
|
20
|
+
var tmp = b[i++];
|
|
21
|
+
b0 = (tmp & 0xfc) >> 2;
|
|
22
|
+
b1 = (tmp & 0x03) << 4;
|
|
23
|
+
if (i < len) {
|
|
24
|
+
tmp = b[i++];
|
|
25
|
+
b1 |= (tmp & 0xf0) >> 4;
|
|
26
|
+
b2 = (tmp & 0x0f) << 2;
|
|
27
|
+
if (i < len) {
|
|
28
|
+
tmp = b[i++];
|
|
29
|
+
b2 |= (tmp & 0xc0) >> 6;
|
|
30
|
+
b3 = tmp & 0x3f;
|
|
31
|
+
} else {
|
|
32
|
+
b3 = 64; // 1 byte "-" is supplement
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
b2 = b3 = 64; // 2 bytes "-" are supplement
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
d += this.Base64Chars.charAt(b0);
|
|
41
|
+
d += this.Base64Chars.charAt(b1);
|
|
42
|
+
d += this.Base64Chars.charAt(b2);
|
|
43
|
+
d += this.Base64Chars.charAt(b3);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return d;
|
|
47
|
+
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Encodes a ucs2 string to a utf8 integer array.
|
|
52
|
+
* @param s, a string
|
|
53
|
+
* @return an integer array
|
|
54
|
+
*/
|
|
55
|
+
ucs2_utf8: function (s) {
|
|
56
|
+
if (!s) return null;
|
|
57
|
+
var d = new Array();
|
|
58
|
+
if (s == "") return d;
|
|
59
|
+
|
|
60
|
+
var c = 0, i = 0, j = 0;
|
|
61
|
+
var len = s.length;
|
|
62
|
+
while (i < len) {
|
|
63
|
+
c = s.charCodeAt(i++);
|
|
64
|
+
if (c <= 0x7f) {
|
|
65
|
+
// 1 byte
|
|
66
|
+
|
|
67
|
+
d[j++] = c;
|
|
68
|
+
} else if ((c >= 0x80) && (c <= 0x7ff)) {
|
|
69
|
+
// 2 bytes
|
|
70
|
+
|
|
71
|
+
d[j++] = ((c >> 6) & 0x1f) | 0xc0;
|
|
72
|
+
d[j++] = (c & 0x3f) | 0x80;
|
|
73
|
+
} else {
|
|
74
|
+
// 3 bytes
|
|
75
|
+
|
|
76
|
+
d[j++] = (c >> 12) | 0xe0;
|
|
77
|
+
d[j++] = ((c >> 6) & 0x3f) | 0x80;
|
|
78
|
+
d[j++] = (c & 0x3f) | 0x80;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return d;
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* Encodes a utf8 integer array to a ucs2 string.
|
|
86
|
+
* @param s, an integer array
|
|
87
|
+
* @return a string
|
|
88
|
+
*/
|
|
89
|
+
utf8_ucs2: function (s) {
|
|
90
|
+
if (!s) return null;
|
|
91
|
+
var len = s.length;
|
|
92
|
+
if (len == 0) return "";
|
|
93
|
+
|
|
94
|
+
var d = "";
|
|
95
|
+
var c = 0, i = 0, tmp = 0;
|
|
96
|
+
while (i < len) {
|
|
97
|
+
c = s[i++];
|
|
98
|
+
if ((c & 0xe0) == 0xe0) {
|
|
99
|
+
// 3 bytes
|
|
100
|
+
|
|
101
|
+
tmp = (c & 0x0f) << 12;
|
|
102
|
+
c = s[i++];
|
|
103
|
+
tmp |= ((c & 0x3f) << 6);
|
|
104
|
+
c = s[i++];
|
|
105
|
+
tmp |= (c & 0x3f);
|
|
106
|
+
} else if ((c & 0xc0) == 0xc0) {
|
|
107
|
+
// 2 bytes
|
|
108
|
+
|
|
109
|
+
tmp = (c & 0x1f) << 6;
|
|
110
|
+
c = s[i++];
|
|
111
|
+
tmp |= (c & 0x3f);
|
|
112
|
+
} else {
|
|
113
|
+
// 1 byte
|
|
114
|
+
|
|
115
|
+
tmp = c;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
d += String.fromCharCode(tmp);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return d;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
export {
|
|
125
|
+
Base64
|
|
126
|
+
}
|