@lambo-design/shared 1.0.0-beta.188 → 1.0.0-beta.189

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,29 @@
1
+ /*
2
+ vxe-table
3
+ */
4
+ /*font*/
5
+ /*size*/
6
+ /*icon*/
7
+ /*color*/
8
+ /*input/radio/checkbox*/
9
+ /*popup*/
10
+ /*table*/
11
+ /*filter*/
12
+ /*menu*/
13
+ /*loading*/
14
+ /*validate*/
15
+ /*grid*/
16
+ /*toolbar*/
17
+ /*tooltip*/
18
+ /*pager*/
19
+ /*modal*/
20
+ /*checkbox*/
21
+ /*radio*/
22
+ /*button*/
23
+ /*input*/
24
+ /*textarea*/
25
+ /*form*/
26
+ /*select*/
27
+ /*switch*/
28
+ /*pulldown*/
29
+ /*# sourceMappingURL=var.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"var.css"}
@@ -0,0 +1,29 @@
1
+ /*
2
+ vxe-table
3
+ */
4
+ /*font*/
5
+ /*size*/
6
+ /*icon*/
7
+ /*color*/
8
+ /*input/radio/checkbox*/
9
+ /*popup*/
10
+ /*table*/
11
+ /*filter*/
12
+ /*menu*/
13
+ /*loading*/
14
+ /*validate*/
15
+ /*grid*/
16
+ /*toolbar*/
17
+ /*tooltip*/
18
+ /*pager*/
19
+ /*modal*/
20
+ /*checkbox*/
21
+ /*radio*/
22
+ /*button*/
23
+ /*input*/
24
+ /*textarea*/
25
+ /*form*/
26
+ /*select*/
27
+ /*switch*/
28
+ /*pulldown*/
29
+ /*# sourceMappingURL=var.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"var.css"}
@@ -0,0 +1,29 @@
1
+ /*
2
+ vxe-table
3
+ */
4
+ /*font*/
5
+ /*size*/
6
+ /*icon*/
7
+ /*color*/
8
+ /*input/radio/checkbox*/
9
+ /*popup*/
10
+ /*table*/
11
+ /*filter*/
12
+ /*menu*/
13
+ /*loading*/
14
+ /*validate*/
15
+ /*grid*/
16
+ /*toolbar*/
17
+ /*tooltip*/
18
+ /*pager*/
19
+ /*modal*/
20
+ /*checkbox*/
21
+ /*radio*/
22
+ /*button*/
23
+ /*input*/
24
+ /*textarea*/
25
+ /*form*/
26
+ /*select*/
27
+ /*switch*/
28
+ /*pulldown*/
29
+ /*# sourceMappingURL=var.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"var.css"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design/shared",
3
- "version": "1.0.0-beta.188",
3
+ "version": "1.0.0-beta.189",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -0,0 +1,23 @@
1
+ import * as CryptoJS from 'crypto-js';
2
+
3
+ const AES_KEY = 'gYj2iqBV5AzxC8H0';
4
+ const AES_IV = 'z5c8fSuHX1PxWtIg';
5
+
6
+ crypto.aes = {
7
+ encrypt(message) {
8
+ return CryptoJS.AES.encrypt(message, AES_KEY, {
9
+ mode: CryptoJS.mode.CBC,
10
+ padding: CryptoJS.pad.Pkcs7,
11
+ iv: AES_IV
12
+ })
13
+ },
14
+ decrypt(ciphertext) {
15
+ return CryptoJS.AES.decrypt(ciphertext, AES_KEY, {
16
+ mode: CryptoJS.mode.CBC,
17
+ padding: CryptoJS.pad.Pkcs7,
18
+ iv: AES_IV
19
+ }).toString(CryptoJS.enc.Utf8)
20
+ }
21
+ }
22
+
23
+ export default crypto.aes;
@@ -0,0 +1,16 @@
1
+ import NodeRSA from "node-rsa";
2
+
3
+ const publicKey = `-----BEGIN PUBLIC KEY-----
4
+ MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCyhhlApSAjPWRjzg+wSIfALbrC
5
+ Ti4GVBYYBjfMYKU0O9z6EGQAXSLPW+S4VYm4LKtKXuKoeF441KU2HvnGM63cTIYt
6
+ T4lGbTGeYfsbeWNs1u9G9J+DrfKK8HsVB1IZIqhbMf0x7KGMeoQ2SN4KtbaPIwhl
7
+ IPfXzuLZiCW90l+a/wIDAQAB
8
+ -----END PUBLIC KEY-----`;
9
+
10
+ // 创建NodeRSA实例并指定公钥格式
11
+ const key = new NodeRSA(publicKey, "pkcs8-public");
12
+
13
+ // 加密函数
14
+ function rsa(data) {
15
+ return key.encrypt(data, "base64");
16
+ }
package/utils/storage.js CHANGED
@@ -1,198 +1,198 @@
1
- /*
2
- * Copyright 2019 WeBank
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- /* \
19
- |*|
20
- |*| :: cookies.js ::
21
- |*|
22
- |*| A complete cookies reader/writer framework with full unicode support.
23
- |*|
24
- |*| https://developer.mozilla.org/en-US/docs/DOM/document.cookie
25
- |*|
26
- |*| This framework is released under the GNU Public License, version 3 or later.
27
- |*| http://www.gnu.org/licenses/gpl-3.0-standalone.html
28
- |*|
29
- |*| Syntaxes:
30
- |*|
31
- |*| * docCookies.setItem(name, value[, end[, path[, domain[, secure]]]])
32
- |*| * docCookies.getItem(name)
33
- |*| * docCookies.removeItem(name[, path], domain)
34
- |*| * docCookies.hasItem(name)
35
- |*| * docCookies.keys()
36
- |*|
37
- \ */
38
-
39
- let docCookies = {
40
- getItem: function(sKey) {
41
- return decodeURIComponent(document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1')) || null;
42
- },
43
- setItem: function(sKey, sValue, vEnd, sPath, sDomain, bSecure) {
44
- if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) {
45
- return false;
46
- }
47
- let sExpires = '';
48
- if (vEnd) {
49
- switch (vEnd.constructor) {
50
- case Number:
51
- sExpires = vEnd === Infinity ? '; expires=Fri, 31 Dec 9999 23:59:59 GMT' : '; max-age=' + vEnd;
52
- break;
53
- case String:
54
- sExpires = '; expires=' + vEnd;
55
- break;
56
- case Date:
57
- sExpires = '; expires=' + vEnd.toUTCString();
58
- break;
59
- }
60
- }
61
- document.cookie = encodeURIComponent(sKey) + '=' + encodeURIComponent(sValue) + sExpires + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '') + (bSecure ? '; secure' : '');
62
- return true;
63
- },
64
- removeItem: function(sKey, sPath, sDomain) {
65
- if (!sKey || !this.hasItem(sKey)) {
66
- return false;
67
- }
68
- document.cookie = encodeURIComponent(sKey) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT' + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '');
69
- return true;
70
- },
71
- hasItem: function(sKey) {
72
- return (new RegExp('(?:^|;\\s*)' + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=')).test(document.cookie);
73
- },
74
- keys: /* optional method: you can safely remove it! */ function() {
75
- let aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, '').split(/\s*(?:\=[^;]*)?;\s*/);
76
- for (let nIdx = 0; nIdx < aKeys.length; nIdx++) {
77
- aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]);
78
- }
79
- return aKeys;
80
- },
81
- };
82
-
83
- /**
84
- * 操作cookie、sessionStorage、localStorage、缓存
85
- */
86
-
87
- const
88
- SESSION = 'session';
89
-
90
- const LOCAL = 'local';
91
-
92
- const COOKIE = 'cookie';
93
-
94
- export default {
95
- set: function(key, value, category = SESSION, expired) {
96
- let { storage, isWebStorage = true } = this._map(category);
97
-
98
- if (isWebStorage) {
99
- storageManager.set(key, value, storage);
100
- } else {
101
- cookieManager.set(key, value, expired);
102
- }
103
- },
104
- get: function(key, category = SESSION) {
105
- let { storage, isWebStorage = true } = this._map(category);
106
-
107
- if (isWebStorage) {
108
- return storageManager.get(key, storage);
109
- } else {
110
- return cookieManager.get(key);
111
- }
112
- },
113
- clear: function(category = SESSION) {
114
- let { storage, isWebStorage = true } = this._map(category);
115
-
116
- if (isWebStorage) {
117
- storageManager.clear(storage);
118
- } else {
119
- cookieManager.clear();
120
- }
121
- },
122
- remove: function(key, category = SESSION) {
123
- let { storage, isWebStorage = true } = this._map(category);
124
-
125
- if (isWebStorage) {
126
- storageManager.remove(key, storage);
127
- } else {
128
- cookieManager.remove(key);
129
- }
130
- },
131
- _map: function(category) {
132
- let isWebStorage = true; let storage;
133
-
134
- switch (true) {
135
- case category === SESSION:
136
- storage = 'sessionStorage';
137
- break;
138
- case category === LOCAL:
139
- storage = 'localStorage';
140
- break;
141
- case category === COOKIE:
142
- storage = 'cookie';
143
- isWebStorage = false;
144
- break;
145
- default:
146
- storage = 'sessionStorage';
147
- }
148
-
149
- return { isWebStorage, storage };
150
- },
151
- };
152
-
153
- let isProd = process.env.NODE_ENV === 'production';
154
-
155
- export const storageManager = {
156
- set: function(key, value, storage) {
157
- try {
158
- window[storage].setItem(key, JSON.stringify(value));
159
- } catch (e) {
160
- !isProd && console.error(e);
161
- }
162
- },
163
- get: function(key, storage) {
164
- try {
165
- if (window[storage].getItem(key)) {
166
- return JSON.parse(window[storage].getItem(key));
167
- } else {
168
- return window[storage].getItem(key);
169
- }
170
- } catch (e) {
171
- !isProd && console.error(e, key);
172
- }
173
- },
174
- clear: function(storage) {
175
- window[storage].clear();
176
- },
177
- remove: function(key, storage) {
178
- window[storage].removeItem(key);
179
- },
180
- };
181
-
182
- export const cookieManager = {
183
- set: function(key, value, expired) {
184
- if (expired) docCookies.setItem(key, value, expired);
185
- else docCookies.setItem(key, value);
186
- },
187
- get: function(key) {
188
- return docCookies.getItem(key);
189
- },
190
- clear: function() {
191
- docCookies.keys().forEach((key) => {
192
- docCookies.removeItem(key);
193
- });
194
- },
195
- remove: function(key) {
196
- docCookies.removeItem(key);
197
- },
198
- };
1
+ /*
2
+ * Copyright 2019 WeBank
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ /* \
19
+ |*|
20
+ |*| :: cookies.js ::
21
+ |*|
22
+ |*| A complete cookies reader/writer framework with full unicode support.
23
+ |*|
24
+ |*| https://developer.mozilla.org/en-US/docs/DOM/document.cookie
25
+ |*|
26
+ |*| This framework is released under the GNU Public License, version 3 or later.
27
+ |*| http://www.gnu.org/licenses/gpl-3.0-standalone.html
28
+ |*|
29
+ |*| Syntaxes:
30
+ |*|
31
+ |*| * docCookies.setItem(name, value[, end[, path[, domain[, secure]]]])
32
+ |*| * docCookies.getItem(name)
33
+ |*| * docCookies.removeItem(name[, path], domain)
34
+ |*| * docCookies.hasItem(name)
35
+ |*| * docCookies.keys()
36
+ |*|
37
+ \ */
38
+
39
+ let docCookies = {
40
+ getItem: function(sKey) {
41
+ return decodeURIComponent(document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1')) || null;
42
+ },
43
+ setItem: function(sKey, sValue, vEnd, sPath, sDomain, bSecure) {
44
+ if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) {
45
+ return false;
46
+ }
47
+ let sExpires = '';
48
+ if (vEnd) {
49
+ switch (vEnd.constructor) {
50
+ case Number:
51
+ sExpires = vEnd === Infinity ? '; expires=Fri, 31 Dec 9999 23:59:59 GMT' : '; max-age=' + vEnd;
52
+ break;
53
+ case String:
54
+ sExpires = '; expires=' + vEnd;
55
+ break;
56
+ case Date:
57
+ sExpires = '; expires=' + vEnd.toUTCString();
58
+ break;
59
+ }
60
+ }
61
+ document.cookie = encodeURIComponent(sKey) + '=' + encodeURIComponent(sValue) + sExpires + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '') + (bSecure ? '; secure' : '');
62
+ return true;
63
+ },
64
+ removeItem: function(sKey, sPath, sDomain) {
65
+ if (!sKey || !this.hasItem(sKey)) {
66
+ return false;
67
+ }
68
+ document.cookie = encodeURIComponent(sKey) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT' + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '');
69
+ return true;
70
+ },
71
+ hasItem: function(sKey) {
72
+ return (new RegExp('(?:^|;\\s*)' + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=')).test(document.cookie);
73
+ },
74
+ keys: /* optional method: you can safely remove it! */ function() {
75
+ let aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, '').split(/\s*(?:\=[^;]*)?;\s*/);
76
+ for (let nIdx = 0; nIdx < aKeys.length; nIdx++) {
77
+ aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]);
78
+ }
79
+ return aKeys;
80
+ },
81
+ };
82
+
83
+ /**
84
+ * 操作cookie、sessionStorage、localStorage、缓存
85
+ */
86
+
87
+ const
88
+ SESSION = 'session';
89
+
90
+ const LOCAL = 'local';
91
+
92
+ const COOKIE = 'cookie';
93
+
94
+ export default {
95
+ set: function(key, value, category = SESSION, expired) {
96
+ let { storage, isWebStorage = true } = this._map(category);
97
+
98
+ if (isWebStorage) {
99
+ storageManager.set(key, value, storage);
100
+ } else {
101
+ cookieManager.set(key, value, expired);
102
+ }
103
+ },
104
+ get: function(key, category = SESSION) {
105
+ let { storage, isWebStorage = true } = this._map(category);
106
+
107
+ if (isWebStorage) {
108
+ return storageManager.get(key, storage);
109
+ } else {
110
+ return cookieManager.get(key);
111
+ }
112
+ },
113
+ clear: function(category = SESSION) {
114
+ let { storage, isWebStorage = true } = this._map(category);
115
+
116
+ if (isWebStorage) {
117
+ storageManager.clear(storage);
118
+ } else {
119
+ cookieManager.clear();
120
+ }
121
+ },
122
+ remove: function(key, category = SESSION) {
123
+ let { storage, isWebStorage = true } = this._map(category);
124
+
125
+ if (isWebStorage) {
126
+ storageManager.remove(key, storage);
127
+ } else {
128
+ cookieManager.remove(key);
129
+ }
130
+ },
131
+ _map: function(category) {
132
+ let isWebStorage = true; let storage;
133
+
134
+ switch (true) {
135
+ case category === SESSION:
136
+ storage = 'sessionStorage';
137
+ break;
138
+ case category === LOCAL:
139
+ storage = 'localStorage';
140
+ break;
141
+ case category === COOKIE:
142
+ storage = 'cookie';
143
+ isWebStorage = false;
144
+ break;
145
+ default:
146
+ storage = 'sessionStorage';
147
+ }
148
+
149
+ return { isWebStorage, storage };
150
+ },
151
+ };
152
+
153
+ let isProd = process.env.NODE_ENV === 'production';
154
+
155
+ export const storageManager = {
156
+ set: function(key, value, storage) {
157
+ try {
158
+ window[storage].setItem(key, JSON.stringify(value));
159
+ } catch (e) {
160
+ !isProd && console.error(e);
161
+ }
162
+ },
163
+ get: function(key, storage) {
164
+ try {
165
+ if (window[storage].getItem(key)) {
166
+ return JSON.parse(window[storage].getItem(key));
167
+ } else {
168
+ return window[storage].getItem(key);
169
+ }
170
+ } catch (e) {
171
+ !isProd && console.error(e, key);
172
+ }
173
+ },
174
+ clear: function(storage) {
175
+ window[storage].clear();
176
+ },
177
+ remove: function(key, storage) {
178
+ window[storage].removeItem(key);
179
+ },
180
+ };
181
+
182
+ export const cookieManager = {
183
+ set: function(key, value, expired) {
184
+ if (expired) docCookies.setItem(key, value, expired);
185
+ else docCookies.setItem(key, value);
186
+ },
187
+ get: function(key) {
188
+ return docCookies.getItem(key);
189
+ },
190
+ clear: function() {
191
+ docCookies.keys().forEach((key) => {
192
+ docCookies.removeItem(key);
193
+ });
194
+ },
195
+ remove: function(key) {
196
+ docCookies.removeItem(key);
197
+ },
198
+ };
package/utils/style.js CHANGED
@@ -1,24 +1,24 @@
1
- const SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g
2
- const MOZ_HACK_REGEXP = /^moz([A-Z])/
3
-
4
- function camelCase(name) {
5
- return name
6
- .replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
7
- return offset ? letter.toUpperCase() : letter
8
- })
9
- .replace(MOZ_HACK_REGEXP, 'Moz$1')
10
- }
11
- // getStyle
12
- export function getStyle(element, styleName) {
13
- if (!element || !styleName) return null
14
- styleName = camelCase(styleName)
15
- if (styleName === 'float') {
16
- styleName = 'cssFloat'
17
- }
18
- try {
19
- const computed = document.defaultView.getComputedStyle(element, '')
20
- return element.style[styleName] || computed ? computed[styleName] : null
21
- } catch (e) {
22
- return element.style[styleName]
23
- }
24
- }
1
+ const SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g
2
+ const MOZ_HACK_REGEXP = /^moz([A-Z])/
3
+
4
+ function camelCase(name) {
5
+ return name
6
+ .replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
7
+ return offset ? letter.toUpperCase() : letter
8
+ })
9
+ .replace(MOZ_HACK_REGEXP, 'Moz$1')
10
+ }
11
+ // getStyle
12
+ export function getStyle(element, styleName) {
13
+ if (!element || !styleName) return null
14
+ styleName = camelCase(styleName)
15
+ if (styleName === 'float') {
16
+ styleName = 'cssFloat'
17
+ }
18
+ try {
19
+ const computed = document.defaultView.getComputedStyle(element, '')
20
+ return element.style[styleName] || computed ? computed[styleName] : null
21
+ } catch (e) {
22
+ return element.style[styleName]
23
+ }
24
+ }
@@ -1,7 +1,7 @@
1
- let transferIndex = 1000
2
-
3
- function transferIncrease() {
4
- transferIndex++
5
- }
6
-
7
- export { transferIndex, transferIncrease }
1
+ let transferIndex = 1000
2
+
3
+ function transferIncrease() {
4
+ transferIndex++
5
+ }
6
+
7
+ export { transferIndex, transferIncrease }
package/utils/type.js CHANGED
@@ -1,102 +1,102 @@
1
- /*
2
- * Copyright 2019 WeBank
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- const objectToString = Object.prototype.toString;
19
- const OBJECT_STRING = '[object Object]';
20
-
21
- /**
22
- * 是否是普通对象
23
- * @param {any} obj
24
- * @return {Boolean}
25
- */
26
- export function isPlainObject(obj) {
27
- return objectToString.call(obj) === OBJECT_STRING;
28
- }
29
-
30
- /**
31
- * 是否是数字
32
- * @param {any} value
33
- * @return {Boolean}
34
- */
35
- export function isNumber(value) {
36
- return typeof value === 'number';
37
- }
38
-
39
- /**
40
- * 是否是日期
41
- * @param {any} value
42
- * @return {Boolean}
43
- */
44
- export function isDate(value) {
45
- return objectToString.call(value) === '[object Date]';
46
- }
47
-
48
- /**
49
- * 是否是函数
50
- * @param {any} value
51
- * @return {Boolean}
52
- */
53
- export function isFunction(value) {
54
- return typeof value === 'function';
55
- }
56
-
57
- /**
58
- * 是否是函数
59
- * @param {any} value
60
- * @return {Boolean}
61
- */
62
- export function isObject(value) {
63
- let type = typeof value;
64
- return !!value && (type == 'object' || type == 'function');
65
- }
66
-
67
- /**
68
- * 是否是数组
69
- * @param {any} value
70
- * @return {Boolean}
71
- */
72
- export function isArray(value) {
73
- return Array.isArray(value);
74
- }
75
-
76
- /**
77
- * 是否像对象
78
- * @param {any} value
79
- * @return {Boolean}
80
- */
81
- export function isObjectLike(value) {
82
- return !!value && typeof value == 'object';
83
- }
84
-
85
- /**
86
- * 是否是字符串
87
- * @param {any} value
88
- * @return {Boolean}
89
- */
90
- export function isString(value) {
91
- return typeof value == 'string' ||
92
- (!isArray(value) && isObjectLike(value) && objectToString.call(value) == '[object String]');
93
- }
94
-
95
- /**
96
- * 是否是空的
97
- * @param {any} value
98
- * @return {Boolean}
99
- */
100
- export function isNull(value) {
101
- return value === undefined || value === null || value === '';
102
- }
1
+ /*
2
+ * Copyright 2019 WeBank
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ const objectToString = Object.prototype.toString;
19
+ const OBJECT_STRING = '[object Object]';
20
+
21
+ /**
22
+ * 是否是普通对象
23
+ * @param {any} obj
24
+ * @return {Boolean}
25
+ */
26
+ export function isPlainObject(obj) {
27
+ return objectToString.call(obj) === OBJECT_STRING;
28
+ }
29
+
30
+ /**
31
+ * 是否是数字
32
+ * @param {any} value
33
+ * @return {Boolean}
34
+ */
35
+ export function isNumber(value) {
36
+ return typeof value === 'number';
37
+ }
38
+
39
+ /**
40
+ * 是否是日期
41
+ * @param {any} value
42
+ * @return {Boolean}
43
+ */
44
+ export function isDate(value) {
45
+ return objectToString.call(value) === '[object Date]';
46
+ }
47
+
48
+ /**
49
+ * 是否是函数
50
+ * @param {any} value
51
+ * @return {Boolean}
52
+ */
53
+ export function isFunction(value) {
54
+ return typeof value === 'function';
55
+ }
56
+
57
+ /**
58
+ * 是否是函数
59
+ * @param {any} value
60
+ * @return {Boolean}
61
+ */
62
+ export function isObject(value) {
63
+ let type = typeof value;
64
+ return !!value && (type == 'object' || type == 'function');
65
+ }
66
+
67
+ /**
68
+ * 是否是数组
69
+ * @param {any} value
70
+ * @return {Boolean}
71
+ */
72
+ export function isArray(value) {
73
+ return Array.isArray(value);
74
+ }
75
+
76
+ /**
77
+ * 是否像对象
78
+ * @param {any} value
79
+ * @return {Boolean}
80
+ */
81
+ export function isObjectLike(value) {
82
+ return !!value && typeof value == 'object';
83
+ }
84
+
85
+ /**
86
+ * 是否是字符串
87
+ * @param {any} value
88
+ * @return {Boolean}
89
+ */
90
+ export function isString(value) {
91
+ return typeof value == 'string' ||
92
+ (!isArray(value) && isObjectLike(value) && objectToString.call(value) == '[object String]');
93
+ }
94
+
95
+ /**
96
+ * 是否是空的
97
+ * @param {any} value
98
+ * @return {Boolean}
99
+ */
100
+ export function isNull(value) {
101
+ return value === undefined || value === null || value === '';
102
+ }
package/.versionrc DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "tagPrefix": "@lambo-design/shared@",
3
- "releaseCommitMessageFormat": "chore(release): @lambo-design/shared@{{currentTag}}",
4
- "path": ".",
5
- "header": "# Changelog",
6
- "types": [
7
- {"type": "chore", "section":"'🎫 Chores | 其他更新", "hidden": false},
8
- {"type": "revert", "section":"⏪ Reverts | 回退", "hidden": false},
9
- {"type": "feat", "section": "✨ Features | 新功能", "hidden": false},
10
- {"type": "fix", "section": "🐛 Bug Fixes | Bug 修复", "hidden": false},
11
- {"type": "improvement", "section": "Feature Improvements", "hidden": false},
12
- {"type": "docs", "section":"📝 Documentation | 文档", "hidden": false},
13
- {"type": "style", "section":"💄 Styles | 风格", "hidden": false},
14
- {"type": "refactor", "section":"💄 Styles | 风格", "hidden": false},
15
- {"type": "perf", "section":"⚡ Performance Improvements | 性能优化", "hidden": false},
16
- {"type": "test", "section":"✅ Tests | 测试", "hidden": false},
17
- {"type": "build", "section":"👷‍ Build System | 构建", "hidden": false},
18
- {"type": "ci", "section":"🔧 Continuous Integration | CI 配置", "hidden":false}
19
- ],
20
- "commitUrlFormat": "http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/{{hash}}",
21
- "compareUrlFormat": "http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/{{previousTag}}...{{currentTag}}",
22
- "issueUrlFormat": "http://git.inspur.com/ecbh/lambo-design/lambo-design/-/issues/{{id}}"
23
- }
package/CHANGELOG.md DELETED
@@ -1,134 +0,0 @@
1
- # Changelog
2
- ## [1.0.0-beta.188](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.187...@lambo-design/shared@1.0.0-beta.188) (2024-06-11)
3
-
4
-
5
- ### ✨ Features | 新功能
6
-
7
- * **@lambo-design/shared:** 增加oss的工具类 ([06e23c7](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/06e23c735b08afbf64780936c76fa640d627cd94))
8
-
9
- ## [1.0.0-beta.187](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.186...@lambo-design/shared@1.0.0-beta.187) (2024-06-11)
10
-
11
-
12
- ### ✨ Features | 新功能
13
-
14
- * **@lambo-design/shared:** 日期格式化功能注释适配 ([d70ff5c](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/d70ff5caefa0755fb37791431ccf6a359030ce79))
15
-
16
- ## [1.0.0-beta.186](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.185...@lambo-design/shared@1.0.0-beta.186) (2024-06-11)
17
-
18
-
19
- ### 🐛 Bug Fixes | Bug 修复
20
-
21
- * **@lambo-design/shared:** 修改不兼容写法?. ([5884b3a](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/5884b3aa1d1671712f39d7a6ece1dd737ab138c8))
22
-
23
- ## [1.0.0-beta.185](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.184...@lambo-design/shared@1.0.0-beta.185) (2024-06-11)
24
-
25
-
26
- ### ✨ Features | 新功能
27
-
28
- * **@lambo-design/shared:** 引入transfer-queue.js ([1ce3533](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/1ce35335e9eacb97539e7c652082554699c5fb7d))
29
-
30
- ## [1.0.0-beta.184](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.182...@lambo-design/shared@1.0.0-beta.184) (2024-06-07)
31
-
32
-
33
- ### ✨ Features | 新功能
34
-
35
- * **@lambo-design/shared:** 引入工业相关utils ([544c5ef](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/544c5ef37591bb297c74ecd931e5d851d0728200))
36
-
37
- ## [1.0.0-beta.182](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.181...@lambo-design/shared@1.0.0-beta.182) (2024-05-24)
38
-
39
- ## [1.0.0-beta.181](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.180...@lambo-design/shared@1.0.0-beta.181) (2024-05-24)
40
-
41
- ## [1.0.0-beta.180](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.179...@lambo-design/shared@1.0.0-beta.180) (2024-05-24)
42
-
43
- ## [1.0.0-beta.179](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.178...@lambo-design/shared@1.0.0-beta.179) (2024-05-24)
44
-
45
- ## [1.0.0-beta.178](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.177...@lambo-design/shared@1.0.0-beta.178) (2024-05-23)
46
-
47
-
48
- ### ✨ Features | 新功能
49
-
50
- * **@lambo-design/shared:** excel.js代码修正 ([0b7ef15](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/0b7ef158b5ba07b9dc7b6551e53186524f8de185))
51
-
52
- ## [1.0.0-beta.177](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.176...@lambo-design/shared@1.0.0-beta.177) (2024-05-17)
53
-
54
- ## [1.0.0-beta.176](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.175...@lambo-design/shared@1.0.0-beta.176) (2024-05-17)
55
-
56
- ## [1.0.0-beta.175](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.174...@lambo-design/shared@1.0.0-beta.175) (2024-05-16)
57
-
58
- ## [1.0.0-beta.174](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.173...@lambo-design/shared@1.0.0-beta.174) (2024-05-16)
59
-
60
- ## [1.0.0-beta.173](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.172...@lambo-design/shared@1.0.0-beta.173) (2024-05-14)
61
-
62
- ## [1.0.0-beta.172](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.171...@lambo-design/shared@1.0.0-beta.172) (2024-05-14)
63
-
64
- ## [1.0.0-beta.171](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.170...@lambo-design/shared@1.0.0-beta.171) (2024-05-10)
65
-
66
-
67
- ### ✨ Features | 新功能
68
-
69
- * **@lambo-design/shared:** moment引用优化 ([a901194](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/a901194d01d01df95fa04029afbad540ab89c8e5))
70
-
71
- ## [1.0.0-beta.170](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.169...@lambo-design/shared@1.0.0-beta.170) (2024-05-08)
72
-
73
-
74
- ### ✨ Features | 新功能
75
-
76
- * **@lambo-design/shared:** 修改moment引用写法 ([2d61d82](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/2d61d82a4cab800a77bbd930a16b4cdc3b5b0108))
77
-
78
- ## [1.0.0-beta.169](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.168...@lambo-design/shared@1.0.0-beta.169) (2024-05-08)
79
-
80
-
81
- ### ✨ Features | 新功能
82
-
83
- * **@lambo-design/shared:** 修改moment引用写法 ([84d0867](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/84d0867eda67526ea70c3caa11317c9c60de0b43))
84
-
85
- ## [1.0.0-beta.168](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.163...@lambo-design/shared@1.0.0-beta.168) (2024-04-29)
86
-
87
-
88
- ### ✨ Features | 新功能
89
-
90
- * **@lambo-design/shared:** 增加方法注释 ([b549d8e](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/b549d8e4d5125dba971cfe166f1cb6ef5648248d))
91
-
92
- ## [1.0.0-beta.163](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.161...@lambo-design/shared@1.0.0-beta.163) (2024-04-24)
93
-
94
-
95
- ### 💄 Styles | 风格
96
-
97
- * **@lambo-design/shared:** 代码结构优化 ([98c6f3f](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/98c6f3ff7084c77134214d0993065f775d2ec77c))
98
-
99
-
100
- ### ✨ Features | 新功能
101
-
102
- * **@lambo-design/shared:** 菜单滴搭与大屏共用页面 ([abe7bbb](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/abe7bbb16618cf4cdc0353eba42f9021fc0bc97f))
103
-
104
- ## [1.0.0-beta.161](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.160...@lambo-design/shared@1.0.0-beta.161) (2024-04-24)
105
-
106
-
107
- ### 🐛 Bug Fixes | Bug 修复
108
-
109
- * **@lambo-design/shared:** 修复excel导出,多级表头情况下的一些问题 ([7a8f760](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/7a8f760bba49ebe240d6afe58b4154752c8e27b6))
110
-
111
- ## [1.0.0-beta.160](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.158...@lambo-design/shared@1.0.0-beta.160) (2024-04-23)
112
-
113
-
114
- ### ✨ Features | 新功能
115
-
116
- * **@lambo-design/shared:** 菜单渲染逻辑增加滴搭大屏页面 ([0bf4877](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/0bf4877c2f45350f6ee78cd0b19b05afe6b06a58))
117
-
118
- ## [1.0.0-beta.158](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.156...@lambo-design/shared@1.0.0-beta.158) (2024-04-18)
119
-
120
-
121
- ### ✨ Features | 新功能
122
-
123
- * **@lambo-design/shared:** 文件相关方法迁移到file.js ([11341fe](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/11341fe74d77029bf4b1776467cb4b970c733e7b))
124
-
125
- ## [1.0.0-beta.156](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.154...@lambo-design/shared@1.0.0-beta.156) (2024-04-16)
126
-
127
-
128
- ### ✨ Features | 新功能
129
-
130
- * **@lambo-design/shared:** 校验函数迁移到validator.js中 ([81d3f44](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/81d3f440e664ea52c5885b94c7def48f0bee16fc))
131
-
132
- ## [1.0.0-beta.154](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design/shared@1.0.0-beta.153...@lambo-design/shared@1.0.0-beta.154) (2024-04-12)
133
-
134
- ## 1.0.0-beta.153 (2024-04-12)