antd-management-fast-framework 1.12.41 → 1.12.44
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/es/utils/Authorized.js +3 -3
- package/es/utils/appConfiguration.d.ts +1 -0
- package/es/utils/appConfiguration.js +7 -0
- package/es/utils/cacheAssist.js +12 -8
- package/es/utils/core.d.ts +4 -1
- package/es/utils/core.js +24 -4
- package/es/utils/developAssist.d.ts +31 -0
- package/es/utils/developAssist.js +169 -0
- package/es/utils/globalStorageAssist.js +3 -3
- package/es/utils/tools.d.ts +7 -31
- package/es/utils/tools.js +37 -187
- package/es/utils/typeCheck.d.ts +13 -0
- package/es/utils/typeCheck.js +37 -0
- package/package.json +2 -2
package/es/utils/Authorized.js
CHANGED
|
@@ -9,12 +9,12 @@ exports.reloadAuthorized = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _Authorized = _interopRequireDefault(require("../customComponents/Authorized"));
|
|
11
11
|
|
|
12
|
-
var _core = require("./core");
|
|
13
|
-
|
|
14
12
|
var _globalStorageAssist = require("./globalStorageAssist");
|
|
15
13
|
|
|
16
14
|
var _localStorageAssist = require("./localStorageAssist");
|
|
17
15
|
|
|
16
|
+
var _typeCheck = require("./typeCheck");
|
|
17
|
+
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
20
|
function getAuthority(str) {
|
|
@@ -33,7 +33,7 @@ function getAuthority(str) {
|
|
|
33
33
|
return [authority];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
if ((0,
|
|
36
|
+
if ((0, _typeCheck.isArray)(authority)) {
|
|
37
37
|
return authority;
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -31,6 +31,7 @@ export function getAppInitConfigData(): {
|
|
|
31
31
|
tinymceApiKey: string;
|
|
32
32
|
tinymceImagesUploadUrl: string;
|
|
33
33
|
};
|
|
34
|
+
export function logShowInConsole(): boolean;
|
|
34
35
|
export function getTinymceImagesUploadUrl(): string;
|
|
35
36
|
export function getTinymceApiKey(): string;
|
|
36
37
|
export function getUseNprogress(): boolean;
|
|
@@ -34,6 +34,7 @@ exports.getTitle = getTitle;
|
|
|
34
34
|
exports.getUseNprogress = getUseNprogress;
|
|
35
35
|
exports.getUseVirtualRequest = getUseVirtualRequest;
|
|
36
36
|
exports.getVideoUploadMaxSize = getVideoUploadMaxSize;
|
|
37
|
+
exports.logShowInConsole = logShowInConsole;
|
|
37
38
|
|
|
38
39
|
var _constants = require("./constants");
|
|
39
40
|
|
|
@@ -61,6 +62,12 @@ function getAppInitConfigData() {
|
|
|
61
62
|
return appInitConfig;
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
function logShowInConsole() {
|
|
66
|
+
var appInit = getAppInitConfigData();
|
|
67
|
+
var result = !!(appInit.showLogInConsole || false);
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
|
|
64
71
|
function getTinymceImagesUploadUrl() {
|
|
65
72
|
var appInit = getAppInitConfigData();
|
|
66
73
|
|
package/es/utils/cacheAssist.js
CHANGED
|
@@ -20,7 +20,11 @@ exports.takeCache = takeCache;
|
|
|
20
20
|
|
|
21
21
|
var _nodeCache = _interopRequireDefault(require("node-cache"));
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _core = require("./core");
|
|
24
|
+
|
|
25
|
+
var _developAssist = require("./developAssist");
|
|
26
|
+
|
|
27
|
+
var _typeCheck = require("./typeCheck");
|
|
24
28
|
|
|
25
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
30
|
|
|
@@ -31,12 +35,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
31
35
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
32
36
|
|
|
33
37
|
function checkKey(key) {
|
|
34
|
-
if ((0,
|
|
38
|
+
if ((0, _core.stringIsNullOrWhiteSpace)(key)) {
|
|
35
39
|
throw new Error('cache key is null or empty');
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
if (!((0,
|
|
39
|
-
(0,
|
|
42
|
+
if (!((0, _typeCheck.isString)(key) || (0, _typeCheck.isNumber)(key))) {
|
|
43
|
+
(0, _developAssist.recordError)(key);
|
|
40
44
|
throw new Error('cache key must be string or number,you can check it in console');
|
|
41
45
|
}
|
|
42
46
|
}
|
|
@@ -100,7 +104,7 @@ function setCache(_ref2) {
|
|
|
100
104
|
|
|
101
105
|
|
|
102
106
|
function setMultiCache(list) {
|
|
103
|
-
if (!(0,
|
|
107
|
+
if (!(0, _typeCheck.isArray)(list)) {
|
|
104
108
|
throw new Error('setMultiCache: list must be array');
|
|
105
109
|
}
|
|
106
110
|
|
|
@@ -119,7 +123,7 @@ function setMultiCache(list) {
|
|
|
119
123
|
value = _key$value$expiration.value,
|
|
120
124
|
expiration = _key$value$expiration.expiration;
|
|
121
125
|
|
|
122
|
-
if (!(0,
|
|
126
|
+
if (!(0, _core.stringIsNullOrWhiteSpace)(key)) {
|
|
123
127
|
checkKey(key);
|
|
124
128
|
listData.push({
|
|
125
129
|
key: key,
|
|
@@ -203,7 +207,7 @@ function getCache(_ref5) {
|
|
|
203
207
|
|
|
204
208
|
|
|
205
209
|
function getMultiCache(list) {
|
|
206
|
-
if (!(0,
|
|
210
|
+
if (!(0, _typeCheck.isArray)(list)) {
|
|
207
211
|
throw new Error('getMultiCache: list must be array');
|
|
208
212
|
}
|
|
209
213
|
|
|
@@ -258,7 +262,7 @@ function deleteCache(_ref7) {
|
|
|
258
262
|
|
|
259
263
|
|
|
260
264
|
function deleteMultiCache(list) {
|
|
261
|
-
if (!(0,
|
|
265
|
+
if (!(0, _typeCheck.isArray)(list)) {
|
|
262
266
|
throw new Error('deleteMultiCache: list must be array');
|
|
263
267
|
}
|
|
264
268
|
|
package/es/utils/core.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export function isArray(value: any): boolean;
|
|
2
1
|
export function replace(source: any, pattern: any, replacement: any): string;
|
|
3
2
|
export function trim(source: any): string;
|
|
4
3
|
export function stringIsNullOrWhiteSpace(value: any): boolean;
|
|
5
4
|
export function isBrowser(): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* 检测目标是否在数组址之中
|
|
7
|
+
*/
|
|
8
|
+
export function inCollection(collection: any, value: any): boolean;
|
|
6
9
|
/**
|
|
7
10
|
* 占位函数
|
|
8
11
|
*
|
package/es/utils/core.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.empty = empty;
|
|
7
|
-
exports.
|
|
7
|
+
exports.inCollection = inCollection;
|
|
8
8
|
exports.isBrowser = isBrowser;
|
|
9
9
|
exports.replace = replace;
|
|
10
10
|
exports.stringIsNullOrWhiteSpace = stringIsNullOrWhiteSpace;
|
|
@@ -12,9 +12,7 @@ exports.trim = trim;
|
|
|
12
12
|
|
|
13
13
|
var _lodash = require("lodash");
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
return Array.isArray(value);
|
|
17
|
-
}
|
|
15
|
+
var _typeCheck = require("./typeCheck");
|
|
18
16
|
|
|
19
17
|
function replace(source, pattern, replacement) {
|
|
20
18
|
return (0, _lodash.replace)(source, pattern, replacement);
|
|
@@ -31,6 +29,28 @@ function stringIsNullOrWhiteSpace(value) {
|
|
|
31
29
|
function isBrowser() {
|
|
32
30
|
return typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
33
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* 检测目标是否在数组址之中
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
function inCollection(collection, value) {
|
|
38
|
+
var result = false;
|
|
39
|
+
|
|
40
|
+
if (!(0, _typeCheck.isArray)(collection)) {
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
collection.some(function (o) {
|
|
45
|
+
if (o === value) {
|
|
46
|
+
result = true;
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return false;
|
|
51
|
+
});
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
34
54
|
/**
|
|
35
55
|
* 占位函数
|
|
36
56
|
*
|
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 记录日志
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @param {*} str
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export function recordLog(record: any, showMode: any, level?: string): void;
|
|
9
|
+
export function recordWarn(record: any): void;
|
|
10
|
+
export function recordInfo(record: any): void;
|
|
11
|
+
export function recordDebug(record: any): void;
|
|
12
|
+
/**
|
|
13
|
+
* 记录错误信息
|
|
14
|
+
*/
|
|
15
|
+
export function recordError(record: any): void;
|
|
16
|
+
/**
|
|
17
|
+
* 记录日志
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @param {*} str
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export function recordText(record: any, level?: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* 记录日志
|
|
26
|
+
*
|
|
27
|
+
* @export
|
|
28
|
+
* @param {*} str
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
export function recordObject(record: any, level?: string): void;
|
|
1
32
|
export function getNearestLocalhostNotifyCache(): any;
|
|
2
33
|
export function setNearestLocalhostNotifyCache(): void;
|
|
3
34
|
export function removeNearestLocalhostNotifyCache(): void;
|
|
@@ -5,14 +5,183 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.empty = empty;
|
|
7
7
|
exports.getNearestLocalhostNotifyCache = getNearestLocalhostNotifyCache;
|
|
8
|
+
exports.recordDebug = recordDebug;
|
|
9
|
+
exports.recordError = recordError;
|
|
10
|
+
exports.recordInfo = recordInfo;
|
|
11
|
+
exports.recordLog = recordLog;
|
|
12
|
+
exports.recordObject = recordObject;
|
|
13
|
+
exports.recordText = recordText;
|
|
14
|
+
exports.recordWarn = recordWarn;
|
|
8
15
|
exports.removeNearestLocalhostNotifyCache = removeNearestLocalhostNotifyCache;
|
|
9
16
|
exports.setNearestLocalhostNotifyCache = setNearestLocalhostNotifyCache;
|
|
10
17
|
|
|
18
|
+
var _appConfiguration = require("./appConfiguration");
|
|
19
|
+
|
|
20
|
+
var _constants = require("./constants");
|
|
21
|
+
|
|
22
|
+
var _core = require("./core");
|
|
23
|
+
|
|
11
24
|
var _localStorageAssist = require("./localStorageAssist");
|
|
12
25
|
|
|
26
|
+
var _typeCheck = require("./typeCheck");
|
|
27
|
+
|
|
13
28
|
var storageKeyCollection = {
|
|
14
29
|
nearestLocalhostNotify: 'nearestLocalhostNotify'
|
|
15
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* 记录日志
|
|
33
|
+
*
|
|
34
|
+
* @export
|
|
35
|
+
* @param {*} str
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
function recordLog(record, showMode) {
|
|
40
|
+
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _constants.logLevel.debug;
|
|
41
|
+
var showModeModified = (showMode || null) == null || (0, _core.stringIsNullOrWhiteSpace)(showMode) ? _constants.logShowMode.unknown : showMode;
|
|
42
|
+
|
|
43
|
+
if (!inCollection([_constants.logShowMode.unknown, _constants.logShowMode.text, _constants.logShowMode.object], showModeModified)) {
|
|
44
|
+
throw new Error("\u65E0\u6548\u7684\u65E5\u5FD7\u663E\u793A\u6A21\u5F0F:".concat(showModeModified));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (showModeModified === _constants.logShowMode.unknown) {
|
|
48
|
+
if ((0, _typeCheck.isString)(record)) {
|
|
49
|
+
showModeModified = _constants.logShowMode.text;
|
|
50
|
+
} else {
|
|
51
|
+
showModeModified = _constants.logShowMode.object;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if ((0, _appConfiguration.logShowInConsole)() && level === _constants.logLevel.debug) {
|
|
56
|
+
if (showModeModified === _constants.logShowMode.text) {
|
|
57
|
+
var data = {
|
|
58
|
+
record: record,
|
|
59
|
+
level: level
|
|
60
|
+
};
|
|
61
|
+
console.log('%c%s', 'color:#00768f;', JSON.stringify(data));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (showModeModified === _constants.logShowMode.object) {
|
|
65
|
+
console.log({
|
|
66
|
+
record: record,
|
|
67
|
+
level: level
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if ((0, _appConfiguration.logShowInConsole)() && level === _constants.logLevel.warn) {
|
|
73
|
+
if (showModeModified === _constants.logShowMode.text) {
|
|
74
|
+
var _data = {
|
|
75
|
+
record: record,
|
|
76
|
+
level: level
|
|
77
|
+
};
|
|
78
|
+
console.log('%c%s', 'color:#ff4f49;', JSON.stringify(_data));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (showModeModified === _constants.logShowMode.object) {
|
|
82
|
+
console.log({
|
|
83
|
+
record: record,
|
|
84
|
+
level: level
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if ((0, _appConfiguration.logShowInConsole)() && level === _constants.logLevel.info) {
|
|
90
|
+
if (showModeModified === _constants.logShowMode.text) {
|
|
91
|
+
var _data2 = {
|
|
92
|
+
record: record,
|
|
93
|
+
level: level
|
|
94
|
+
};
|
|
95
|
+
console.log('%c%s', 'color:#89ca78;', JSON.stringify(_data2));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (showModeModified === _constants.logShowMode.object) {
|
|
99
|
+
console.log({
|
|
100
|
+
record: record,
|
|
101
|
+
level: level
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (level === _constants.logLevel.error) {
|
|
107
|
+
if (showModeModified === _constants.logShowMode.text) {
|
|
108
|
+
var _data3 = {
|
|
109
|
+
record: record,
|
|
110
|
+
level: level
|
|
111
|
+
};
|
|
112
|
+
console.error(JSON.stringify(_data3));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (showModeModified === _constants.logShowMode.object) {
|
|
116
|
+
console.error({
|
|
117
|
+
record: record,
|
|
118
|
+
level: level
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function recordWarn(record) {
|
|
125
|
+
if ((0, _typeCheck.isString)(record)) {
|
|
126
|
+
recordText(record, _constants.logLevel.warn);
|
|
127
|
+
} else {
|
|
128
|
+
recordObject(record, _constants.logLevel.warn);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function recordInfo(record) {
|
|
133
|
+
if ((0, _typeCheck.isString)(record)) {
|
|
134
|
+
recordText(record, _constants.logLevel.info);
|
|
135
|
+
} else {
|
|
136
|
+
recordObject(record, _constants.logLevel.info);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function recordDebug(record) {
|
|
141
|
+
if ((0, _typeCheck.isString)(record)) {
|
|
142
|
+
recordText(record, _constants.logLevel.debug);
|
|
143
|
+
} else {
|
|
144
|
+
recordObject(record, _constants.logLevel.debug);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* 记录错误信息
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
function recordError(record) {
|
|
153
|
+
if ((0, _typeCheck.isString)(record)) {
|
|
154
|
+
recordText(record, _constants.logLevel.error);
|
|
155
|
+
} else {
|
|
156
|
+
recordObject(record, _constants.logLevel.error);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* 记录日志
|
|
161
|
+
*
|
|
162
|
+
* @export
|
|
163
|
+
* @param {*} str
|
|
164
|
+
* @returns
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
function recordText(record) {
|
|
169
|
+
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.logLevel.debug;
|
|
170
|
+
recordLog(record, _constants.logShowMode.text, level);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* 记录日志
|
|
174
|
+
*
|
|
175
|
+
* @export
|
|
176
|
+
* @param {*} str
|
|
177
|
+
* @returns
|
|
178
|
+
*/
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
function recordObject(record) {
|
|
182
|
+
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.logLevel.debug;
|
|
183
|
+
recordLog(record, _constants.logShowMode.object, level);
|
|
184
|
+
}
|
|
16
185
|
|
|
17
186
|
function getNearestLocalhostNotifyCache() {
|
|
18
187
|
var key = storageKeyCollection.nearestLocalhostNotify;
|
|
@@ -23,10 +23,10 @@ var _cacheAssist = require("./cacheAssist");
|
|
|
23
23
|
|
|
24
24
|
var _constants = require("./constants");
|
|
25
25
|
|
|
26
|
-
var _core = require("./core");
|
|
27
|
-
|
|
28
26
|
var _localStorageAssist = require("./localStorageAssist");
|
|
29
27
|
|
|
28
|
+
var _typeCheck = require("./typeCheck");
|
|
29
|
+
|
|
30
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
31
|
|
|
32
32
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -82,7 +82,7 @@ function getAccessWayCollectionCache() {
|
|
|
82
82
|
key: key
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
if ((0,
|
|
85
|
+
if ((0, _typeCheck.isArray)(result)) {
|
|
86
86
|
return result;
|
|
87
87
|
}
|
|
88
88
|
}
|
package/es/utils/tools.d.ts
CHANGED
|
@@ -209,37 +209,6 @@ export function showMessage({ type, duration, message: messageText, onClose, }:
|
|
|
209
209
|
message: any;
|
|
210
210
|
onClose?: (() => void) | undefined;
|
|
211
211
|
}): void;
|
|
212
|
-
/**
|
|
213
|
-
* 记录日志
|
|
214
|
-
*
|
|
215
|
-
* @export
|
|
216
|
-
* @param {*} str
|
|
217
|
-
* @returns
|
|
218
|
-
*/
|
|
219
|
-
export function recordLog(record: any, showMode: any, level?: string): void;
|
|
220
|
-
export function recordWarn(record: any): void;
|
|
221
|
-
export function recordInfo(record: any): void;
|
|
222
|
-
export function recordDebug(record: any): void;
|
|
223
|
-
/**
|
|
224
|
-
* 记录错误信息
|
|
225
|
-
*/
|
|
226
|
-
export function recordError(record: any): void;
|
|
227
|
-
/**
|
|
228
|
-
* 记录日志
|
|
229
|
-
*
|
|
230
|
-
* @export
|
|
231
|
-
* @param {*} str
|
|
232
|
-
* @returns
|
|
233
|
-
*/
|
|
234
|
-
export function recordText(record: any, level?: string): void;
|
|
235
|
-
/**
|
|
236
|
-
* 记录日志
|
|
237
|
-
*
|
|
238
|
-
* @export
|
|
239
|
-
* @param {*} str
|
|
240
|
-
* @returns
|
|
241
|
-
*/
|
|
242
|
-
export function recordObject(record: any, level?: string): void;
|
|
243
212
|
/**
|
|
244
213
|
* 获取Guid
|
|
245
214
|
*
|
|
@@ -681,6 +650,13 @@ export function notify({ type, placement: placementValue, message: messageValue,
|
|
|
681
650
|
message: any;
|
|
682
651
|
description: any;
|
|
683
652
|
}): void;
|
|
653
|
+
export function recordLog(record: any, showMode: any, level?: any): void;
|
|
654
|
+
export function recordWarn(record: any): void;
|
|
655
|
+
export function recordInfo(record: any): void;
|
|
656
|
+
export function recordDebug(record: any): void;
|
|
657
|
+
export function recordError(record: any): void;
|
|
658
|
+
export function recordText(record: any, level?: any): void;
|
|
659
|
+
export function recordObject(record: any, level?: any): void;
|
|
684
660
|
export function checkFromConfig({ label, name, helper }: {
|
|
685
661
|
label: any;
|
|
686
662
|
name: any;
|
package/es/utils/tools.js
CHANGED
|
@@ -159,6 +159,8 @@ var _core = require("./core");
|
|
|
159
159
|
|
|
160
160
|
var _developAssist = require("./developAssist");
|
|
161
161
|
|
|
162
|
+
var _typeCheck = require("./typeCheck");
|
|
163
|
+
|
|
162
164
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
163
165
|
|
|
164
166
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
@@ -555,167 +557,6 @@ function showMessage(_ref9) {
|
|
|
555
557
|
}
|
|
556
558
|
});
|
|
557
559
|
}
|
|
558
|
-
/**
|
|
559
|
-
* 记录日志
|
|
560
|
-
*
|
|
561
|
-
* @export
|
|
562
|
-
* @param {*} str
|
|
563
|
-
* @returns
|
|
564
|
-
*/
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
function recordLog(record, showMode) {
|
|
568
|
-
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _constants.logLevel.debug;
|
|
569
|
-
var showModeModified = (showMode || null) == null || stringIsNullOrWhiteSpace(showMode) ? _constants.logShowMode.unknown : showMode;
|
|
570
|
-
|
|
571
|
-
if (!inCollection([_constants.logShowMode.unknown, _constants.logShowMode.text, _constants.logShowMode.object], showModeModified)) {
|
|
572
|
-
throw new Error("\u65E0\u6548\u7684\u65E5\u5FD7\u663E\u793A\u6A21\u5F0F:".concat(showModeModified));
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
if (showModeModified === _constants.logShowMode.unknown) {
|
|
576
|
-
if (isString(record)) {
|
|
577
|
-
showModeModified = _constants.logShowMode.text;
|
|
578
|
-
} else {
|
|
579
|
-
showModeModified = _constants.logShowMode.object;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
if (logShowInConsole() && level === _constants.logLevel.debug) {
|
|
584
|
-
if (showModeModified === _constants.logShowMode.text) {
|
|
585
|
-
var data = {
|
|
586
|
-
record: record,
|
|
587
|
-
level: level
|
|
588
|
-
};
|
|
589
|
-
console.log('%c%s', 'color:#00768f;', JSON.stringify(data));
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
if (showModeModified === _constants.logShowMode.object) {
|
|
593
|
-
console.log({
|
|
594
|
-
record: record,
|
|
595
|
-
level: level
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
if (logShowInConsole() && level === _constants.logLevel.warn) {
|
|
601
|
-
if (showModeModified === _constants.logShowMode.text) {
|
|
602
|
-
var _data = {
|
|
603
|
-
record: record,
|
|
604
|
-
level: level
|
|
605
|
-
};
|
|
606
|
-
console.log('%c%s', 'color:#ff4f49;', JSON.stringify(_data));
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
if (showModeModified === _constants.logShowMode.object) {
|
|
610
|
-
console.log({
|
|
611
|
-
record: record,
|
|
612
|
-
level: level
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
if (logShowInConsole() && level === _constants.logLevel.info) {
|
|
618
|
-
if (showModeModified === _constants.logShowMode.text) {
|
|
619
|
-
var _data2 = {
|
|
620
|
-
record: record,
|
|
621
|
-
level: level
|
|
622
|
-
};
|
|
623
|
-
console.log('%c%s', 'color:#89ca78;', JSON.stringify(_data2));
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
if (showModeModified === _constants.logShowMode.object) {
|
|
627
|
-
console.log({
|
|
628
|
-
record: record,
|
|
629
|
-
level: level
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
if (level === _constants.logLevel.error) {
|
|
635
|
-
if (showModeModified === _constants.logShowMode.text) {
|
|
636
|
-
var _data3 = {
|
|
637
|
-
record: record,
|
|
638
|
-
level: level
|
|
639
|
-
};
|
|
640
|
-
console.error(JSON.stringify(_data3));
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
if (showModeModified === _constants.logShowMode.object) {
|
|
644
|
-
console.error({
|
|
645
|
-
record: record,
|
|
646
|
-
level: level
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
function recordWarn(record) {
|
|
653
|
-
if (isString(record)) {
|
|
654
|
-
recordText(record, _constants.logLevel.warn);
|
|
655
|
-
} else {
|
|
656
|
-
recordObject(record, _constants.logLevel.warn);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
function recordInfo(record) {
|
|
661
|
-
if (isString(record)) {
|
|
662
|
-
recordText(record, _constants.logLevel.info);
|
|
663
|
-
} else {
|
|
664
|
-
recordObject(record, _constants.logLevel.info);
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
function recordDebug(record) {
|
|
669
|
-
if (isString(record)) {
|
|
670
|
-
recordText(record, _constants.logLevel.debug);
|
|
671
|
-
} else {
|
|
672
|
-
recordObject(record, _constants.logLevel.debug);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
/**
|
|
676
|
-
* 记录错误信息
|
|
677
|
-
*/
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
function recordError(record) {
|
|
681
|
-
if (isString(record)) {
|
|
682
|
-
recordText(record, _constants.logLevel.error);
|
|
683
|
-
} else {
|
|
684
|
-
recordObject(record, _constants.logLevel.error);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* 记录日志
|
|
689
|
-
*
|
|
690
|
-
* @export
|
|
691
|
-
* @param {*} str
|
|
692
|
-
* @returns
|
|
693
|
-
*/
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
function recordText(record) {
|
|
697
|
-
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.logLevel.debug;
|
|
698
|
-
recordLog(record, _constants.logShowMode.text, level);
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* 记录日志
|
|
702
|
-
*
|
|
703
|
-
* @export
|
|
704
|
-
* @param {*} str
|
|
705
|
-
* @returns
|
|
706
|
-
*/
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
function recordObject(record) {
|
|
710
|
-
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.logLevel.debug;
|
|
711
|
-
recordLog(record, _constants.logShowMode.object, level);
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
function logShowInConsole() {
|
|
715
|
-
var appInit = (0, _appConfiguration.getAppInitConfigData)();
|
|
716
|
-
var result = !!(appInit.showLogInConsole || false);
|
|
717
|
-
return result;
|
|
718
|
-
}
|
|
719
560
|
/**
|
|
720
561
|
* 获取Guid
|
|
721
562
|
*
|
|
@@ -734,21 +575,7 @@ function getGuid() {
|
|
|
734
575
|
|
|
735
576
|
|
|
736
577
|
function inCollection(collection, value) {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
if (!isArray(collection)) {
|
|
740
|
-
return result;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
collection.some(function (o) {
|
|
744
|
-
if (o === value) {
|
|
745
|
-
result = true;
|
|
746
|
-
return true;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
return false;
|
|
750
|
-
});
|
|
751
|
-
return result;
|
|
578
|
+
return (0, _core.inCollection)(collection, value);
|
|
752
579
|
}
|
|
753
580
|
/**
|
|
754
581
|
* 格式化时间
|
|
@@ -939,15 +766,7 @@ function isDatetime(v) {
|
|
|
939
766
|
|
|
940
767
|
|
|
941
768
|
function isNumber(v) {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
if (str === '') {
|
|
945
|
-
return false;
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
var regular = /^[0-9]*$/;
|
|
949
|
-
var re = new RegExp(regular);
|
|
950
|
-
return re.test(str);
|
|
769
|
+
return (0, _typeCheck.isNumber)(v);
|
|
951
770
|
}
|
|
952
771
|
/**
|
|
953
772
|
* 转换为数字
|
|
@@ -1750,7 +1569,7 @@ function isFunction(value) {
|
|
|
1750
1569
|
}
|
|
1751
1570
|
|
|
1752
1571
|
function isArray(value) {
|
|
1753
|
-
return (0,
|
|
1572
|
+
return (0, _typeCheck.isArray)(value);
|
|
1754
1573
|
}
|
|
1755
1574
|
|
|
1756
1575
|
function isObject(o) {
|
|
@@ -1856,7 +1675,7 @@ function isDate(value) {
|
|
|
1856
1675
|
|
|
1857
1676
|
|
|
1858
1677
|
function isString(value) {
|
|
1859
|
-
return (0,
|
|
1678
|
+
return (0, _typeCheck.isString)(value);
|
|
1860
1679
|
}
|
|
1861
1680
|
/**
|
|
1862
1681
|
* 移除数组中predicate(断言)返回为真值的所有元素,并返回移除元素组成的数组。predicate(断言) 会传入3个参数: (value, index, array)。
|
|
@@ -2119,6 +1938,37 @@ function notify(_ref23) {
|
|
|
2119
1938
|
}, 600);
|
|
2120
1939
|
}
|
|
2121
1940
|
|
|
1941
|
+
function recordLog(record, showMode) {
|
|
1942
|
+
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : logLevel.debug;
|
|
1943
|
+
(0, _developAssist.recordLog)(record, showMode, level);
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
function recordWarn(record) {
|
|
1947
|
+
(0, _developAssist.recordWarn)(record);
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
function recordInfo(record) {
|
|
1951
|
+
(0, _developAssist.recordInfo)(record);
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
function recordDebug(record) {
|
|
1955
|
+
(0, _developAssist.recordDebug)(record);
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
function recordError(record) {
|
|
1959
|
+
(0, _developAssist.recordError)(record);
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
function recordText(record) {
|
|
1963
|
+
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : logLevel.debug;
|
|
1964
|
+
(0, _developAssist.recordText)(record, level);
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
function recordObject(record) {
|
|
1968
|
+
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : logLevel.debug;
|
|
1969
|
+
(0, _developAssist.recordObject)(record, level);
|
|
1970
|
+
}
|
|
1971
|
+
|
|
2122
1972
|
function checkFromConfig(_ref24) {
|
|
2123
1973
|
var label = _ref24.label,
|
|
2124
1974
|
name = _ref24.name,
|
package/es/utils/typeCheck.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* check value is string
|
|
3
|
+
*/
|
|
4
|
+
export function isString(value: any): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* 判断是否是数字字符串
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @param {*} str
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export function isNumber(v: any): boolean;
|
|
13
|
+
export function isArray(value: any): boolean;
|
|
1
14
|
/**
|
|
2
15
|
* 占位函数
|
|
3
16
|
*
|
package/es/utils/typeCheck.js
CHANGED
|
@@ -4,13 +4,50 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.empty = empty;
|
|
7
|
+
exports.isArray = isArray;
|
|
8
|
+
exports.isNumber = isNumber;
|
|
9
|
+
exports.isString = isString;
|
|
7
10
|
|
|
11
|
+
var _lodash = require("lodash");
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* check value is string
|
|
15
|
+
*/
|
|
16
|
+
function isString(value) {
|
|
17
|
+
return (0, _lodash.isString)(value);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 判断是否是数字字符串
|
|
21
|
+
*
|
|
22
|
+
* @export
|
|
23
|
+
* @param {*} str
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
function isNumber(v) {
|
|
29
|
+
var str = "".concat(typeof v === 'undefined' ? null : v);
|
|
30
|
+
|
|
31
|
+
if (str === '') {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var regular = /^[0-9]*$/;
|
|
36
|
+
var re = new RegExp(regular);
|
|
37
|
+
return re.test(str);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function isArray(value) {
|
|
41
|
+
return Array.isArray(value);
|
|
42
|
+
}
|
|
8
43
|
/**
|
|
9
44
|
* 占位函数
|
|
10
45
|
*
|
|
11
46
|
* @export
|
|
12
47
|
* @returns
|
|
13
48
|
*/
|
|
49
|
+
|
|
50
|
+
|
|
14
51
|
function empty() {
|
|
15
52
|
return {};
|
|
16
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-management-fast-framework",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.44",
|
|
4
4
|
"description": "antd-management-fast-framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antd-management-fast-framework"
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
"src/framework",
|
|
172
172
|
"src/utils"
|
|
173
173
|
],
|
|
174
|
-
"gitHead": "
|
|
174
|
+
"gitHead": "98f4b9ddcaf870d47fde6c1437e299b6d63eff21",
|
|
175
175
|
"gitHooks": {
|
|
176
176
|
"pre-commit": "lint-staged"
|
|
177
177
|
}
|