antd-management-fast-framework 1.9.17 → 1.9.39
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/configGroup/configGeneral.d.ts +47 -0
- package/es/configGroup/configGeneral.js +61 -0
- package/es/configGroup/themeCollection.d.ts +29 -0
- package/es/configGroup/themeCollection.js +117 -0
- package/es/configGroup/webpackPlugin.d.ts +11 -0
- package/es/configGroup/webpackPlugin.js +166 -0
- package/es/customComponents/PageLoading/index.d.ts +2 -0
- package/es/customComponents/PageLoading/index.js +13 -0
- package/es/framework/Base/index.d.ts +25 -2
- package/es/framework/Base/index.js +178 -11
- package/es/framework/ButtonExtension/SelectButton/Base/index.d.ts +1 -1
- package/es/framework/ButtonExtension/SelectButton/Base/index.js +2 -2
- package/es/framework/Common/index.d.ts +18 -6
- package/es/framework/Common/index.js +263 -153
- package/es/framework/DataDrawer/Base/index.d.ts +1 -1
- package/es/framework/DataDrawer/Base/index.js +2 -2
- package/es/framework/DataDrawer/BaseLoadDrawer/index.js +2 -6
- package/es/framework/DataForm/BaseAddForm/index.js +42 -27
- package/es/framework/DataForm/BaseUpdateForm/index.js +42 -31
- package/es/framework/DataForm/BaseUpdateFormContent/index.js +2 -2
- package/es/framework/DataListView/Base/index.d.ts +2 -1
- package/es/framework/DataListView/Base/index.js +9 -15
- package/es/framework/DataMenuContainer/index.d.ts +1 -1
- package/es/framework/DataMenuContainer/index.js +2 -2
- package/es/framework/DataModal/Base/index.d.ts +1 -1
- package/es/framework/DataModal/Base/index.js +13 -17
- package/es/framework/DataModal/BaseLoadModal/index.js +3 -11
- package/es/framework/DataModal/BaseUpdateTransferModal/index.js +1 -1
- package/es/framework/DataMultiPageView/MultiPage/index.js +3 -4
- package/es/framework/DataMultiPageView/MultiPageDrawer/index.js +6 -10
- package/es/framework/DataOperation/BaseWindow/index.js +41 -30
- package/es/framework/DataSinglePageView/SinglePage/index.js +1 -3
- package/es/framework/DataSinglePageView/SinglePageDrawer/index.js +2 -2
- package/es/framework/DataSingleView/DataCore/index.d.ts +1 -1
- package/es/framework/DataSingleView/DataCore/index.js +2 -2
- package/es/framework/DataTabContainer/index.js +2 -2
- package/es/framework/FieldExtension/SelectFieldDrawer/SelectFieldBase/index.d.ts +2 -1
- package/es/framework/FieldExtension/SelectFieldDrawer/SelectFieldBase/index.js +3 -2
- package/es/utils/actionAssist.js +67 -54
- package/es/utils/authority.d.ts +4 -0
- package/es/utils/authority.js +42 -3
- package/es/utils/cacheAssist.d.ts +85 -0
- package/es/utils/cacheAssist.js +313 -0
- package/es/utils/constants.d.ts +1 -0
- package/es/utils/constants.js +2 -1
- package/es/utils/defaultSettingsSpecial.d.ts +1 -0
- package/es/utils/defaultSettingsSpecial.js +10 -0
- package/es/utils/globalStorageAssist.d.ts +2 -2
- package/es/utils/globalStorageAssist.js +2 -2
- package/es/utils/proLayoutCollection.js +14 -10
- package/es/utils/requestAssistor.d.ts +14 -14
- package/es/utils/requestAssistor.js +29 -6
- package/es/utils/tools.d.ts +1 -0
- package/es/utils/tools.js +6 -2
- package/package.json +13 -11
package/es/utils/actionAssist.js
CHANGED
|
@@ -162,63 +162,76 @@ function _actionCore() {
|
|
|
162
162
|
|
|
163
163
|
target.setState({
|
|
164
164
|
processing: true
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
165
|
+
}, function () {
|
|
166
|
+
target.setState({
|
|
167
|
+
dispatchComplete: false
|
|
168
|
+
}, function () {
|
|
169
|
+
// 延迟一定时间,优化界面呈现
|
|
170
|
+
setTimeout(function () {
|
|
171
|
+
dispatch({
|
|
172
|
+
type: api,
|
|
173
|
+
payload: params
|
|
174
|
+
}).then(function () {
|
|
175
|
+
if (showProcessing) {
|
|
176
|
+
setTimeout(function () {
|
|
177
|
+
_message2["default"].destroy(key);
|
|
178
|
+
}, 200);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (!(0, _tools.isFunction)(getApiData)) {
|
|
182
|
+
throw new Error('actionCore: getApiData must be function');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
var data = getApiData(target.props);
|
|
186
|
+
|
|
187
|
+
if ((data || null) == null) {
|
|
188
|
+
throw new Error('actionCore: getApiData result not allow null');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
var dataSuccess = data.dataSuccess;
|
|
192
|
+
|
|
193
|
+
if (dataSuccess) {
|
|
194
|
+
var remoteData = data.data;
|
|
195
|
+
var messageText = successMessage;
|
|
196
|
+
|
|
197
|
+
if ((0, _tools.isFunction)(successMessageBuilder)) {
|
|
198
|
+
messageText = successMessageBuilder(remoteData);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
(0, _tools.notifySuccess)(messageText);
|
|
202
|
+
|
|
203
|
+
if ((0, _tools.isFunction)(successCallback)) {
|
|
204
|
+
successCallback({
|
|
205
|
+
target: target,
|
|
206
|
+
handleData: handleData,
|
|
207
|
+
remoteData: remoteData || null
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
target.setState({
|
|
213
|
+
processing: false,
|
|
214
|
+
dispatchComplete: true
|
|
205
215
|
});
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
})["catch"](function (res) {
|
|
217
|
+
(0, _tools.recordObject)(res);
|
|
218
|
+
|
|
219
|
+
if (showProcessing) {
|
|
220
|
+
setTimeout(function () {
|
|
221
|
+
_message2["default"].destroy(key);
|
|
222
|
+
}, 200);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
target.setState({
|
|
226
|
+
processing: false,
|
|
227
|
+
dispatchComplete: true
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
}, 400);
|
|
218
231
|
});
|
|
219
|
-
}
|
|
232
|
+
});
|
|
220
233
|
|
|
221
|
-
case
|
|
234
|
+
case 14:
|
|
222
235
|
case "end":
|
|
223
236
|
return _context.stop();
|
|
224
237
|
}
|
package/es/utils/authority.d.ts
CHANGED
package/es/utils/authority.js
CHANGED
|
@@ -10,6 +10,8 @@ exports.setAuthority = setAuthority;
|
|
|
10
10
|
|
|
11
11
|
var _tools = require("./tools");
|
|
12
12
|
|
|
13
|
+
var _cacheAssist = require("./cacheAssist");
|
|
14
|
+
|
|
13
15
|
var _globalStorageAssist = require("./globalStorageAssist");
|
|
14
16
|
|
|
15
17
|
var _Authorized = require("./Authorized");
|
|
@@ -54,6 +56,28 @@ function checkIsSuper() {
|
|
|
54
56
|
function checkHasAuthority(auth) {
|
|
55
57
|
var _accessWayCollection$;
|
|
56
58
|
|
|
59
|
+
if ((0, _tools.isObject)(auth)) {
|
|
60
|
+
console.log({
|
|
61
|
+
auth: auth,
|
|
62
|
+
attachedTargetName: (this || null) != null ? (this.constructor || null) != null ? this.constructor.name : '' : ''
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var result = '0';
|
|
67
|
+
var existCache = (0, _cacheAssist.hasCache)({
|
|
68
|
+
key: auth
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (existCache) {
|
|
72
|
+
result = (0, _cacheAssist.getCache)({
|
|
73
|
+
key: auth
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (result !== undefined) {
|
|
77
|
+
return result !== '0';
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
57
81
|
var list = getAllAuthorityCore();
|
|
58
82
|
var accessWayCollection = (0, _globalStorageAssist.getAccessWayCollectionCache)();
|
|
59
83
|
var superAuth = (_accessWayCollection$ = accessWayCollection["super"].permission) !== null && _accessWayCollection$ !== void 0 ? _accessWayCollection$ : '';
|
|
@@ -62,6 +86,10 @@ function checkHasAuthority(auth) {
|
|
|
62
86
|
});
|
|
63
87
|
|
|
64
88
|
if (isSuper === superAuth) {
|
|
89
|
+
(0, _cacheAssist.setCache)({
|
|
90
|
+
key: auth,
|
|
91
|
+
value: '1'
|
|
92
|
+
});
|
|
65
93
|
return true;
|
|
66
94
|
}
|
|
67
95
|
|
|
@@ -78,12 +106,23 @@ function checkHasAuthority(auth) {
|
|
|
78
106
|
});
|
|
79
107
|
}
|
|
80
108
|
|
|
81
|
-
|
|
109
|
+
result = !!(v !== undefined) ? '1' : '0';
|
|
110
|
+
(0, _cacheAssist.setCache)({
|
|
111
|
+
key: auth,
|
|
112
|
+
value: result
|
|
113
|
+
});
|
|
114
|
+
return result !== '0';
|
|
82
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* 缓存用户权限数据体
|
|
118
|
+
* @param {*} authority
|
|
119
|
+
*/
|
|
120
|
+
|
|
83
121
|
|
|
84
122
|
function setAuthority(authority) {
|
|
85
|
-
var
|
|
86
|
-
(0, _tools.saveJsonToLocalStorage)(_globalStorageAssist.storageKeyCollection.authorityCollection,
|
|
123
|
+
var authorityCollection = typeof authority === 'string' ? [authority] : authority;
|
|
124
|
+
(0, _tools.saveJsonToLocalStorage)(_globalStorageAssist.storageKeyCollection.authorityCollection, authorityCollection);
|
|
125
|
+
(0, _cacheAssist.flushAllCache)(); // auto reload
|
|
87
126
|
|
|
88
127
|
(0, _Authorized.reloadAuthorized)();
|
|
89
128
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取缓存池
|
|
3
|
+
* @export
|
|
4
|
+
*/
|
|
5
|
+
export function getCachePool(): any;
|
|
6
|
+
/**
|
|
7
|
+
* Returns boolean indicating if the key is cached
|
|
8
|
+
* @param {*} key
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export function hasCache({ key }: any): any;
|
|
12
|
+
/**
|
|
13
|
+
* Sets a key value pair. It is possible to define a ttl (in seconds). Returns true on success
|
|
14
|
+
* @param {*} key
|
|
15
|
+
* @param {*} value
|
|
16
|
+
* @param {*} expiration
|
|
17
|
+
*/
|
|
18
|
+
export function setCache({ key, value, expiration }: any): any;
|
|
19
|
+
/**
|
|
20
|
+
* Sets multiple key val pairs. It is possible to define a ttl (seconds). Returns true on success
|
|
21
|
+
* @param {*} list
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
export function setMultiCache(list: any): any;
|
|
25
|
+
/**
|
|
26
|
+
* a timestamp in ms representing the time at which the key will expire
|
|
27
|
+
* @param {*} key
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
export function getExpiration({ key }: any): any;
|
|
31
|
+
/**
|
|
32
|
+
* Redefine the ttl of a key. Returns true if the key has been found and changed. Otherwise returns false. If the ttl-argument isn't passed the default-TTL will be used.
|
|
33
|
+
* The key will be deleted when passing in a ttl < 0
|
|
34
|
+
* @param {*} key
|
|
35
|
+
* @param {*} expiration
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
export function setExpiration({ key, expiration }: any): any;
|
|
39
|
+
/**
|
|
40
|
+
* Gets a saved value from the cache. Returns a undefined if not found or expired. If the value was found it returns the value
|
|
41
|
+
* @param {*} key
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
export function getCache({ key }: any): any;
|
|
45
|
+
/**
|
|
46
|
+
* Gets multiple saved values from the cache. Returns an empty object {} if not found or expired. If the value was found it returns an object with the key value pair.
|
|
47
|
+
* @param {*} list
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
export function getMultiCache(list: any): any;
|
|
51
|
+
/**
|
|
52
|
+
* get the cached value and remove the key from the cache.
|
|
53
|
+
* @param {*} key
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
export function takeCache({ key }: any): any;
|
|
57
|
+
/**
|
|
58
|
+
* delete a key. Returns the number of deleted entries. A delete will never fail.
|
|
59
|
+
* @param {*} key
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
export function deleteCache({ key }: any): any;
|
|
63
|
+
/**
|
|
64
|
+
* Delete multiple keys. Returns the number of deleted entries. A delete will never fail.
|
|
65
|
+
* @param {*} list
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
export function deleteMultiCache(list: any): any;
|
|
69
|
+
/**
|
|
70
|
+
* Flush all data.
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
export function flushAllCache(): any;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the statistics.
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
export function statisticsCache(): any;
|
|
79
|
+
/**
|
|
80
|
+
* 占位函数
|
|
81
|
+
*
|
|
82
|
+
* @export
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
85
|
+
export function emptyExport(): {};
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.deleteCache = deleteCache;
|
|
7
|
+
exports.deleteMultiCache = deleteMultiCache;
|
|
8
|
+
exports.emptyExport = emptyExport;
|
|
9
|
+
exports.flushAllCache = flushAllCache;
|
|
10
|
+
exports.getCache = getCache;
|
|
11
|
+
exports.getCachePool = getCachePool;
|
|
12
|
+
exports.getExpiration = getExpiration;
|
|
13
|
+
exports.getMultiCache = getMultiCache;
|
|
14
|
+
exports.hasCache = hasCache;
|
|
15
|
+
exports.setCache = setCache;
|
|
16
|
+
exports.setExpiration = setExpiration;
|
|
17
|
+
exports.setMultiCache = setMultiCache;
|
|
18
|
+
exports.statisticsCache = statisticsCache;
|
|
19
|
+
exports.takeCache = takeCache;
|
|
20
|
+
|
|
21
|
+
var _nodeCache = _interopRequireDefault(require("node-cache"));
|
|
22
|
+
|
|
23
|
+
var _tools = require("./tools");
|
|
24
|
+
|
|
25
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
26
|
+
|
|
27
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
28
|
+
|
|
29
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
30
|
+
|
|
31
|
+
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
|
+
|
|
33
|
+
function checkKey(key) {
|
|
34
|
+
if ((0, _tools.stringIsNullOrWhiteSpace)(key)) {
|
|
35
|
+
throw new Error('cache key is null or empty');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!((0, _tools.isString)(key) || (0, _tools.isNumber)(key))) {
|
|
39
|
+
(0, _tools.recordError)(key);
|
|
40
|
+
throw new Error('cache key must be string or number,you can check it in console');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 获取缓存池
|
|
45
|
+
* @export
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
function getCachePool() {
|
|
50
|
+
if ((window.localRunningCache || null) == null) {
|
|
51
|
+
window.localRunningCache = new _nodeCache["default"]();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return window.localRunningCache;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns boolean indicating if the key is cached
|
|
58
|
+
* @param {*} key
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
function hasCache(_ref) {
|
|
64
|
+
var key = _ref.key;
|
|
65
|
+
var cachePool = getCachePool();
|
|
66
|
+
|
|
67
|
+
if (cachePool == null) {
|
|
68
|
+
throw new Error('cache pool not exist');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return cachePool.has(key);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Sets a key value pair. It is possible to define a ttl (in seconds). Returns true on success
|
|
75
|
+
* @param {*} key
|
|
76
|
+
* @param {*} value
|
|
77
|
+
* @param {*} expiration
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
function setCache(_ref2) {
|
|
82
|
+
var key = _ref2.key,
|
|
83
|
+
value = _ref2.value,
|
|
84
|
+
_ref2$expiration = _ref2.expiration,
|
|
85
|
+
expiration = _ref2$expiration === void 0 ? 0 : _ref2$expiration;
|
|
86
|
+
checkKey(key);
|
|
87
|
+
var cachePool = getCachePool();
|
|
88
|
+
|
|
89
|
+
if (cachePool == null) {
|
|
90
|
+
throw new Error('cache pool not exist');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return cachePool.set(key, value, expiration);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Sets multiple key val pairs. It is possible to define a ttl (seconds). Returns true on success
|
|
97
|
+
* @param {*} list
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
function setMultiCache(list) {
|
|
103
|
+
if (!(0, _tools.isArray)(list)) {
|
|
104
|
+
throw new Error('setMultiCache: list must be array');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (list.length <= 0) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
var listData = [];
|
|
112
|
+
list.forEach(function (o) {
|
|
113
|
+
var _key$value$expiration = _objectSpread(_objectSpread({}, {
|
|
114
|
+
key: '',
|
|
115
|
+
value: '',
|
|
116
|
+
expiration: 0
|
|
117
|
+
}), o),
|
|
118
|
+
key = _key$value$expiration.key,
|
|
119
|
+
value = _key$value$expiration.value,
|
|
120
|
+
expiration = _key$value$expiration.expiration;
|
|
121
|
+
|
|
122
|
+
if (!(0, _tools.stringIsNullOrWhiteSpace)(key)) {
|
|
123
|
+
checkKey(key);
|
|
124
|
+
listData.push({
|
|
125
|
+
key: key,
|
|
126
|
+
value: value,
|
|
127
|
+
ttl: expiration
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
if (listData.length <= 0) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
var cachePool = getCachePool();
|
|
137
|
+
|
|
138
|
+
if (cachePool == null) {
|
|
139
|
+
throw new Error('cache pool not exist');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return cachePool.mset(listData);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* a timestamp in ms representing the time at which the key will expire
|
|
146
|
+
* @param {*} key
|
|
147
|
+
* @returns
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
function getExpiration(_ref3) {
|
|
152
|
+
var key = _ref3.key;
|
|
153
|
+
var cachePool = getCachePool();
|
|
154
|
+
|
|
155
|
+
if (cachePool == null) {
|
|
156
|
+
throw new Error('cache pool not exist');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return cachePool.getTtl(key);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Redefine the ttl of a key. Returns true if the key has been found and changed. Otherwise returns false. If the ttl-argument isn't passed the default-TTL will be used.
|
|
163
|
+
* The key will be deleted when passing in a ttl < 0
|
|
164
|
+
* @param {*} key
|
|
165
|
+
* @param {*} expiration
|
|
166
|
+
* @returns
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
function setExpiration(_ref4) {
|
|
171
|
+
var key = _ref4.key,
|
|
172
|
+
expiration = _ref4.expiration;
|
|
173
|
+
var cachePool = getCachePool();
|
|
174
|
+
|
|
175
|
+
if (cachePool == null) {
|
|
176
|
+
throw new Error('cache pool not exist');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return cachePool.ttl(key, expiration);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Gets a saved value from the cache. Returns a undefined if not found or expired. If the value was found it returns the value
|
|
183
|
+
* @param {*} key
|
|
184
|
+
* @returns
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
function getCache(_ref5) {
|
|
189
|
+
var key = _ref5.key;
|
|
190
|
+
var cachePool = getCachePool();
|
|
191
|
+
|
|
192
|
+
if (cachePool == null) {
|
|
193
|
+
throw new Error('cache pool not exist');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return cachePool.get(key);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Gets multiple saved values from the cache. Returns an empty object {} if not found or expired. If the value was found it returns an object with the key value pair.
|
|
200
|
+
* @param {*} list
|
|
201
|
+
* @returns
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
function getMultiCache(list) {
|
|
206
|
+
if (!(0, _tools.isArray)(list)) {
|
|
207
|
+
throw new Error('getMultiCache: list must be array');
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
var cachePool = getCachePool();
|
|
211
|
+
|
|
212
|
+
if (cachePool == null) {
|
|
213
|
+
throw new Error('cache pool not exist');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return cachePool.mget(list);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* get the cached value and remove the key from the cache.
|
|
220
|
+
* @param {*} key
|
|
221
|
+
* @returns
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
function takeCache(_ref6) {
|
|
226
|
+
var key = _ref6.key;
|
|
227
|
+
var cachePool = getCachePool();
|
|
228
|
+
|
|
229
|
+
if (cachePool == null) {
|
|
230
|
+
throw new Error('cache pool not exist');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return cachePool.take(key);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* delete a key. Returns the number of deleted entries. A delete will never fail.
|
|
237
|
+
* @param {*} key
|
|
238
|
+
* @returns
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
function deleteCache(_ref7) {
|
|
243
|
+
var key = _ref7.key;
|
|
244
|
+
checkKey(key);
|
|
245
|
+
var cachePool = getCachePool();
|
|
246
|
+
|
|
247
|
+
if (cachePool == null) {
|
|
248
|
+
throw new Error('cache pool not exist');
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return cachePool.del(key);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Delete multiple keys. Returns the number of deleted entries. A delete will never fail.
|
|
255
|
+
* @param {*} list
|
|
256
|
+
* @returns
|
|
257
|
+
*/
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
function deleteMultiCache(list) {
|
|
261
|
+
if (!(0, _tools.isArray)(list)) {
|
|
262
|
+
throw new Error('deleteMultiCache: list must be array');
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
var cachePool = getCachePool();
|
|
266
|
+
|
|
267
|
+
if (cachePool == null) {
|
|
268
|
+
throw new Error('cache pool not exist');
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return cachePool.del(list);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Flush all data.
|
|
275
|
+
* @returns
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
function flushAllCache() {
|
|
280
|
+
var cachePool = getCachePool();
|
|
281
|
+
|
|
282
|
+
if (cachePool == null) {
|
|
283
|
+
throw new Error('cache pool not exist');
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return cachePool.flushAll();
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Returns the statistics.
|
|
290
|
+
* @returns
|
|
291
|
+
*/
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
function statisticsCache() {
|
|
295
|
+
var cachePool = getCachePool();
|
|
296
|
+
|
|
297
|
+
if (cachePool == null) {
|
|
298
|
+
throw new Error('cache pool not exist');
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return cachePool.getStats();
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* 占位函数
|
|
305
|
+
*
|
|
306
|
+
* @export
|
|
307
|
+
* @returns
|
|
308
|
+
*/
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
function emptyExport() {
|
|
312
|
+
return {};
|
|
313
|
+
}
|
package/es/utils/constants.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export namespace appInitDefault {
|
|
|
52
52
|
export const imageUploadMaxSize: number;
|
|
53
53
|
export const videoUploadMaxSize: number;
|
|
54
54
|
export const fileUploadMaxSize: number;
|
|
55
|
+
export const useNprogress: boolean;
|
|
55
56
|
}
|
|
56
57
|
export const accessWaySpecialCollection: {
|
|
57
58
|
super: {
|
package/es/utils/constants.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export function empty(): {};
|
|
8
8
|
export namespace defaultSettingsLayoutCustom {
|
|
9
|
+
export function getUseNprogress(): boolean;
|
|
9
10
|
export function getFileUploadMaxSize(): number;
|
|
10
11
|
export function getVideoUploadMaxSize(): number;
|
|
11
12
|
export function getImageUploadMaxSize(): number;
|
|
@@ -17,6 +17,16 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
17
17
|
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; }
|
|
18
18
|
|
|
19
19
|
var defaultSettingsLayoutCustom = {
|
|
20
|
+
getUseNprogress: function getUseNprogress() {
|
|
21
|
+
var appInit = (0, _tools.getAppInitConfigData)();
|
|
22
|
+
|
|
23
|
+
var _useNprogress = _objectSpread(_objectSpread({}, {
|
|
24
|
+
useNprogress: true
|
|
25
|
+
}), appInit || {}),
|
|
26
|
+
useNprogress = _useNprogress.useNprogress;
|
|
27
|
+
|
|
28
|
+
return useNprogress;
|
|
29
|
+
},
|
|
20
30
|
getFileUploadMaxSize: function getFileUploadMaxSize() {
|
|
21
31
|
var appInit = (0, _tools.getAppInitConfigData)();
|
|
22
32
|
|
|
@@ -36,7 +36,7 @@ export function removeParamsDataCache(key: any): void;
|
|
|
36
36
|
*/
|
|
37
37
|
export function getTokenKeyName(): string;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Get Token
|
|
40
40
|
*
|
|
41
41
|
* @export
|
|
42
42
|
* @param {*} fn
|
|
@@ -44,7 +44,7 @@ export function getTokenKeyName(): string;
|
|
|
44
44
|
*/
|
|
45
45
|
export function getToken(): any;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Set Token
|
|
48
48
|
*
|
|
49
49
|
* @export
|
|
50
50
|
* @param {*} fn
|
|
@@ -154,7 +154,7 @@ function getTokenKeyName() {
|
|
|
154
154
|
return storageKeyCollection.token;
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
|
-
*
|
|
157
|
+
* Get Token
|
|
158
158
|
*
|
|
159
159
|
* @export
|
|
160
160
|
* @param {*} fn
|
|
@@ -167,7 +167,7 @@ function getToken() {
|
|
|
167
167
|
return (0, _tools.getStringFromLocalStorage)(key);
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
|
-
*
|
|
170
|
+
* Set Token
|
|
171
171
|
*
|
|
172
172
|
* @export
|
|
173
173
|
* @param {*} fn
|