yc-ui2 0.1.2-beta19 → 0.1.2-beta20

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yc-ui2",
3
- "version": "0.1.2-beta19",
3
+ "version": "0.1.2-beta20",
4
4
  "private": false,
5
5
  "description": "湖南优创UI组件库",
6
6
  "main": "dist/yc-ui2.umd.min.js",
@@ -0,0 +1,148 @@
1
+ /* eslint-disable no-unused-vars */
2
+ /*******************************************************
3
+ *
4
+ * 函数名称:Base64encode()
5
+ * 功 能:对数据进行Base64加密
6
+ * 说 明:函数中将数据使用_utf8_encode()进行编码转换后再加密,保证数据完整
7
+ *
8
+ **********************************************************/
9
+
10
+ var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
11
+
12
+ export function _Base64encode (input) {
13
+
14
+ var output = "";
15
+ var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
16
+ var i = 0;
17
+
18
+ input = _utf8_encode(input);
19
+
20
+ while (i < input.length) {
21
+
22
+ chr1 = input.charCodeAt(i++);
23
+ chr2 = input.charCodeAt(i++);
24
+ chr3 = input.charCodeAt(i++);
25
+
26
+ enc1 = chr1 >> 2;
27
+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
28
+ enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
29
+ enc4 = chr3 & 63;
30
+
31
+ if (isNaN(chr2)) {
32
+ enc3 = enc4 = 64;
33
+ } else if (isNaN(chr3)) {
34
+ enc4 = 64;
35
+ }
36
+ output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
37
+ }
38
+ return output;
39
+ }
40
+
41
+ /*******************************************************
42
+ *
43
+ * 函数名称:Base64decode()
44
+ * 功 能:对数据进行Base64解密
45
+ * 说 明:函数中将数据使用_utf8_decode()将解密后的数据编码,保证数据完整
46
+ *
47
+ **********************************************************/
48
+ function _Base64decode (input) {
49
+ var output = "";
50
+ var chr1, chr2, chr3;
51
+ var enc1, enc2, enc3, enc4;
52
+ var i = 0;
53
+
54
+ //input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
55
+ // eslint-disable-next-line no-useless-escape
56
+ input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
57
+ while (i < input.length) {
58
+
59
+ enc1 = _keyStr.indexOf(input.charAt(i++));
60
+ enc2 = _keyStr.indexOf(input.charAt(i++));
61
+ enc3 = _keyStr.indexOf(input.charAt(i++));
62
+ enc4 = _keyStr.indexOf(input.charAt(i++));
63
+
64
+ chr1 = (enc1 << 2) | (enc2 >> 4);
65
+ chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
66
+ chr3 = ((enc3 & 3) << 6) | enc4;
67
+
68
+ output = output + String.fromCharCode(chr1);
69
+
70
+ if (enc3 != 64) {
71
+ output = output + String.fromCharCode(chr2);
72
+ }
73
+ if (enc4 != 64) {
74
+ output = output + String.fromCharCode(chr3);
75
+ }
76
+
77
+ }
78
+
79
+ output = _utf8_decode(output);
80
+
81
+ return output;
82
+ }
83
+
84
+ /*******************************************************
85
+ *
86
+ * 函数名称:_utf8_encode()
87
+ * 功 能:将数据进行utf8编码
88
+ * 说 明:
89
+ *
90
+ **********************************************************/
91
+ function _utf8_encode (in_string) {
92
+ var string = "" + in_string;
93
+ string = string.replace(/\r\n/g, "\n");
94
+ var utftext = "";
95
+
96
+ for (var n = 0; n < string.length; n++) {
97
+
98
+ var c = string.charCodeAt(n);
99
+
100
+ if (c < 128) {
101
+ utftext += String.fromCharCode(c);
102
+ } else if ((c > 127) && (c < 2048)) {
103
+ utftext += String.fromCharCode((c >> 6) | 192);
104
+ utftext += String.fromCharCode((c & 63) | 128);
105
+ } else {
106
+ utftext += String.fromCharCode((c >> 12) | 224);
107
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
108
+ utftext += String.fromCharCode((c & 63) | 128);
109
+ }
110
+ }
111
+ return utftext;
112
+ }
113
+
114
+ /*******************************************************
115
+ *
116
+ * 函数名称:_utf8_decode()
117
+ * 功 能:将数据进行utf8解码
118
+ * 说 明:
119
+ *
120
+ **********************************************************/
121
+ function _utf8_decode (utftext) {
122
+ var string = "";
123
+ var i = 0;
124
+ var c1 = 0;
125
+ var c2 = 0;
126
+ var c3 = 0;
127
+ var c = c1 = c2 = 0;
128
+
129
+ while (i < utftext.length) {
130
+
131
+ c = utftext.charCodeAt(i);
132
+
133
+ if (c < 128) {
134
+ string += String.fromCharCode(c);
135
+ i++;
136
+ } else if ((c > 191) && (c < 224)) {
137
+ c2 = utftext.charCodeAt(i + 1);
138
+ string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
139
+ i += 2;
140
+ } else {
141
+ c2 = utftext.charCodeAt(i + 1);
142
+ c3 = utftext.charCodeAt(i + 2);
143
+ string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
144
+ i += 3;
145
+ }
146
+ }
147
+ return string;
148
+ }
@@ -0,0 +1,146 @@
1
+ /*******************************************************
2
+ *
3
+ * 函数名称:Base64encode()
4
+ * 功 能:对数据进行Base64加密
5
+ * 说 明:函数中将数据使用_utf8_encode()进行编码转换后再加密,保证数据完整
6
+ *
7
+ **********************************************************/
8
+
9
+ var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
10
+
11
+ export function _Base64encode (input) {
12
+
13
+ var output = "";
14
+ var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
15
+ var i = 0;
16
+
17
+ input = _utf8_encode(input);
18
+
19
+ while (i < input.length) {
20
+
21
+ chr1 = input.charCodeAt(i++);
22
+ chr2 = input.charCodeAt(i++);
23
+ chr3 = input.charCodeAt(i++);
24
+
25
+ enc1 = chr1 >> 2;
26
+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
27
+ enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
28
+ enc4 = chr3 & 63;
29
+
30
+ if (isNaN(chr2)) {
31
+ enc3 = enc4 = 64;
32
+ } else if (isNaN(chr3)) {
33
+ enc4 = 64;
34
+ }
35
+ output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
36
+ }
37
+ return output;
38
+ }
39
+
40
+ /*******************************************************
41
+ *
42
+ * 函数名称:Base64decode()
43
+ * 功 能:对数据进行Base64解密
44
+ * 说 明:函数中将数据使用_utf8_decode()将解密后的数据编码,保证数据完整
45
+ *
46
+ **********************************************************/
47
+ function _Base64decode (input) {
48
+ var output = "";
49
+ var chr1, chr2, chr3;
50
+ var enc1, enc2, enc3, enc4;
51
+ var i = 0;
52
+
53
+ //input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
54
+ input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
55
+ while (i < input.length) {
56
+
57
+ enc1 = _keyStr.indexOf(input.charAt(i++));
58
+ enc2 = _keyStr.indexOf(input.charAt(i++));
59
+ enc3 = _keyStr.indexOf(input.charAt(i++));
60
+ enc4 = _keyStr.indexOf(input.charAt(i++));
61
+
62
+ chr1 = (enc1 << 2) | (enc2 >> 4);
63
+ chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
64
+ chr3 = ((enc3 & 3) << 6) | enc4;
65
+
66
+ output = output + String.fromCharCode(chr1);
67
+
68
+ if (enc3 != 64) {
69
+ output = output + String.fromCharCode(chr2);
70
+ }
71
+ if (enc4 != 64) {
72
+ output = output + String.fromCharCode(chr3);
73
+ }
74
+
75
+ }
76
+
77
+ output = _utf8_decode(output);
78
+
79
+ return output;
80
+ }
81
+
82
+ /*******************************************************
83
+ *
84
+ * 函数名称:_utf8_encode()
85
+ * 功 能:将数据进行utf8编码
86
+ * 说 明:
87
+ *
88
+ **********************************************************/
89
+ function _utf8_encode (in_string) {
90
+ var string = "" + in_string;
91
+ string = string.replace(/\r\n/g, "\n");
92
+ var utftext = "";
93
+
94
+ for (var n = 0; n < string.length; n++) {
95
+
96
+ var c = string.charCodeAt(n);
97
+
98
+ if (c < 128) {
99
+ utftext += String.fromCharCode(c);
100
+ } else if ((c > 127) && (c < 2048)) {
101
+ utftext += String.fromCharCode((c >> 6) | 192);
102
+ utftext += String.fromCharCode((c & 63) | 128);
103
+ } else {
104
+ utftext += String.fromCharCode((c >> 12) | 224);
105
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
106
+ utftext += String.fromCharCode((c & 63) | 128);
107
+ }
108
+ }
109
+ return utftext;
110
+ }
111
+
112
+ /*******************************************************
113
+ *
114
+ * 函数名称:_utf8_decode()
115
+ * 功 能:将数据进行utf8解码
116
+ * 说 明:
117
+ *
118
+ **********************************************************/
119
+ function _utf8_decode (utftext) {
120
+ var string = "";
121
+ var i = 0;
122
+ var c1 = 0;
123
+ var c2 = 0;
124
+ var c3 = 0;
125
+ var c = c1 = c2 = 0;
126
+
127
+ while (i < utftext.length) {
128
+
129
+ c = utftext.charCodeAt(i);
130
+
131
+ if (c < 128) {
132
+ string += String.fromCharCode(c);
133
+ i++;
134
+ } else if ((c > 191) && (c < 224)) {
135
+ c2 = utftext.charCodeAt(i + 1);
136
+ string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
137
+ i += 2;
138
+ } else {
139
+ c2 = utftext.charCodeAt(i + 1);
140
+ c3 = utftext.charCodeAt(i + 2);
141
+ string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
142
+ i += 3;
143
+ }
144
+ }
145
+ return string;
146
+ }