zmdms-webui 0.0.133 → 0.0.134
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/dist/es/button/buttonExport.d.ts +0 -2
- package/dist/es/button/buttonExport.js +25 -23
- package/package.json +1 -1
- package/dist/es/_virtual/browser.js +0 -3
- package/dist/es/_virtual/index3.js +0 -3
- package/dist/es/_virtual/index4.js +0 -3
- package/dist/es/_virtual/index5.js +0 -3
- package/dist/es/_virtual/node.js +0 -3
- package/dist/es/_virtual/serialOrdered.js +0 -3
- package/dist/es/node_modules/asynckit/index.js +0 -12
- package/dist/es/node_modules/asynckit/lib/abort.js +0 -31
- package/dist/es/node_modules/asynckit/lib/async.js +0 -38
- package/dist/es/node_modules/asynckit/lib/defer.js +0 -28
- package/dist/es/node_modules/asynckit/lib/iterate.js +0 -80
- package/dist/es/node_modules/asynckit/lib/state.js +0 -39
- package/dist/es/node_modules/asynckit/lib/terminator.js +0 -34
- package/dist/es/node_modules/asynckit/parallel.js +0 -49
- package/dist/es/node_modules/asynckit/serial.js +0 -21
- package/dist/es/node_modules/asynckit/serialOrdered.js +0 -84
- package/dist/es/node_modules/axios/lib/adapters/adapters.js +0 -61
- package/dist/es/node_modules/axios/lib/adapters/http.js +0 -664
- package/dist/es/node_modules/axios/lib/adapters/xhr.js +0 -253
- package/dist/es/node_modules/axios/lib/axios.js +0 -89
- package/dist/es/node_modules/axios/lib/cancel/CancelToken.js +0 -121
- package/dist/es/node_modules/axios/lib/cancel/CanceledError.js +0 -23
- package/dist/es/node_modules/axios/lib/cancel/isCancel.js +0 -5
- package/dist/es/node_modules/axios/lib/core/Axios.js +0 -201
- package/dist/es/node_modules/axios/lib/core/AxiosError.js +0 -98
- package/dist/es/node_modules/axios/lib/core/AxiosHeaders.js +0 -298
- package/dist/es/node_modules/axios/lib/core/InterceptorManager.js +0 -71
- package/dist/es/node_modules/axios/lib/core/buildFullPath.js +0 -21
- package/dist/es/node_modules/axios/lib/core/dispatchRequest.js +0 -81
- package/dist/es/node_modules/axios/lib/core/mergeConfig.js +0 -105
- package/dist/es/node_modules/axios/lib/core/settle.js +0 -27
- package/dist/es/node_modules/axios/lib/core/transformData.js +0 -28
- package/dist/es/node_modules/axios/lib/defaults/index.js +0 -159
- package/dist/es/node_modules/axios/lib/defaults/transitional.js +0 -7
- package/dist/es/node_modules/axios/lib/env/data.js +0 -3
- package/dist/es/node_modules/axios/lib/helpers/AxiosTransformStream.js +0 -191
- package/dist/es/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -56
- package/dist/es/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -73
- package/dist/es/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +0 -28
- package/dist/es/node_modules/axios/lib/helpers/bind.js +0 -7
- package/dist/es/node_modules/axios/lib/helpers/buildURL.js +0 -63
- package/dist/es/node_modules/axios/lib/helpers/callbackify.js +0 -18
- package/dist/es/node_modules/axios/lib/helpers/combineURLs.js +0 -15
- package/dist/es/node_modules/axios/lib/helpers/cookies.js +0 -52
- package/dist/es/node_modules/axios/lib/helpers/formDataToJSON.js +0 -90
- package/dist/es/node_modules/axios/lib/helpers/formDataToStream.js +0 -113
- package/dist/es/node_modules/axios/lib/helpers/fromDataURI.js +0 -53
- package/dist/es/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -15
- package/dist/es/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
- package/dist/es/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -67
- package/dist/es/node_modules/axios/lib/helpers/parseHeaders.js +0 -55
- package/dist/es/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
- package/dist/es/node_modules/axios/lib/helpers/readBlob.js +0 -17
- package/dist/es/node_modules/axios/lib/helpers/speedometer.js +0 -53
- package/dist/es/node_modules/axios/lib/helpers/spread.js +0 -28
- package/dist/es/node_modules/axios/lib/helpers/throttle.js +0 -31
- package/dist/es/node_modules/axios/lib/helpers/toFormData.js +0 -216
- package/dist/es/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -18
- package/dist/es/node_modules/axios/lib/helpers/validator.js +0 -91
- package/dist/es/node_modules/axios/lib/platform/node/classes/FormData.js +0 -5
- package/dist/es/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +0 -5
- package/dist/es/node_modules/axios/lib/platform/node/index.js +0 -14
- package/dist/es/node_modules/axios/lib/utils.js +0 -723
- package/dist/es/node_modules/combined-stream/lib/combined_stream.js +0 -214
- package/dist/es/node_modules/debug/node_modules/ms/index.js +0 -172
- package/dist/es/node_modules/debug/src/browser.js +0 -283
- package/dist/es/node_modules/debug/src/common.js +0 -285
- package/dist/es/node_modules/debug/src/index.js +0 -23
- package/dist/es/node_modules/debug/src/node.js +0 -280
- package/dist/es/node_modules/delayed-stream/lib/delayed_stream.js +0 -112
- package/dist/es/node_modules/follow-redirects/debug.js +0 -19
- package/dist/es/node_modules/follow-redirects/index.js +0 -647
- package/dist/es/node_modules/form-data/lib/form_data.js +0 -519
- package/dist/es/node_modules/form-data/lib/populate.js +0 -12
- package/dist/es/node_modules/has-flag/index.js +0 -17
- package/dist/es/node_modules/mime-db/db.json.js +0 -10704
- package/dist/es/node_modules/mime-db/index.js +0 -16
- package/dist/es/node_modules/mime-types/index.js +0 -193
- package/dist/es/node_modules/proxy-from-env/index.js +0 -110
- package/dist/es/node_modules/supports-color/index.js +0 -148
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
1
|
import React__default from 'react';
|
|
3
2
|
import { IButtonProps } from './interface.js';
|
|
4
3
|
|
|
5
4
|
interface IButtonDownloadProps extends Omit<IButtonProps, "onClick"> {
|
|
6
5
|
/** 导出的接口方法 */
|
|
7
6
|
fetchHandle?: () => Promise<any>;
|
|
8
|
-
axiosRequestConfig?: AxiosRequestConfig;
|
|
9
7
|
/** 代理点击事件 如果下载结束后 还需做别的处理 */
|
|
10
8
|
onClick?: (e: any, info: any) => void;
|
|
11
9
|
}
|
|
@@ -2,21 +2,27 @@ import { __rest, __assign, __awaiter, __generator } from '../_virtual/_tslib.js'
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import ButtonCom from './button.js';
|
|
5
|
-
import { exportBolb
|
|
6
|
-
import '../config/ZtxkContext.js';
|
|
7
|
-
import useBaseContext from '../config/useBaseContext.js';
|
|
8
|
-
import axios from '../node_modules/axios/lib/axios.js';
|
|
5
|
+
import { exportBolb } from 'zmdms-utils';
|
|
9
6
|
import { message } from 'antd';
|
|
10
7
|
|
|
11
|
-
function downloadFile(config) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
// export function downloadFile(config: AxiosRequestConfig) {
|
|
9
|
+
// const token = getToken();
|
|
10
|
+
// const { headers, ...axiosConfig } = config;
|
|
11
|
+
// return axios({
|
|
12
|
+
// headers: {
|
|
13
|
+
// "Zmdms-Auth": token,
|
|
14
|
+
// ...headers,
|
|
15
|
+
// },
|
|
16
|
+
// responseType: "blob",
|
|
17
|
+
// ...axiosConfig,
|
|
18
|
+
// });
|
|
19
|
+
// }
|
|
16
20
|
var ButtonExport = function (props) {
|
|
17
|
-
var fetchHandle = props.fetchHandle,
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
var fetchHandle = props.fetchHandle,
|
|
22
|
+
// axiosRequestConfig = {},
|
|
23
|
+
onClick = props.onClick, resetProps = __rest(props, ["fetchHandle", "onClick"]);
|
|
24
|
+
var _a = useState(false), loading = _a[0], setLoading = _a[1];
|
|
25
|
+
// const { apiBaseUrl } = useBaseContext();
|
|
20
26
|
var onClickHandle = function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
|
21
27
|
var res, err_1;
|
|
22
28
|
return __generator(this, function (_a) {
|
|
@@ -25,18 +31,14 @@ var ButtonExport = function (props) {
|
|
|
25
31
|
setLoading(true);
|
|
26
32
|
_a.label = 1;
|
|
27
33
|
case 1:
|
|
28
|
-
_a.trys.push([1,
|
|
34
|
+
_a.trys.push([1, 4, , 5]);
|
|
29
35
|
res = void 0;
|
|
30
36
|
if (!fetchHandle) return [3 /*break*/, 3];
|
|
31
37
|
return [4 /*yield*/, fetchHandle()];
|
|
32
38
|
case 2:
|
|
33
39
|
res = _a.sent();
|
|
34
|
-
return [3 /*break*/,
|
|
35
|
-
case 3:
|
|
36
|
-
case 4:
|
|
37
|
-
res = _a.sent();
|
|
38
|
-
_a.label = 5;
|
|
39
|
-
case 5:
|
|
40
|
+
return [3 /*break*/, 3];
|
|
41
|
+
case 3:
|
|
40
42
|
exportBolb(res)
|
|
41
43
|
.then(function (r) {
|
|
42
44
|
if (r.result) {
|
|
@@ -49,8 +51,8 @@ var ButtonExport = function (props) {
|
|
|
49
51
|
message.error((err === null || err === void 0 ? void 0 : err.msg) || "导出失败!");
|
|
50
52
|
});
|
|
51
53
|
setLoading(false);
|
|
52
|
-
return [3 /*break*/,
|
|
53
|
-
case
|
|
54
|
+
return [3 /*break*/, 5];
|
|
55
|
+
case 4:
|
|
54
56
|
err_1 = _a.sent();
|
|
55
57
|
setLoading(false);
|
|
56
58
|
if (typeof err_1 === "string") {
|
|
@@ -60,7 +62,7 @@ var ButtonExport = function (props) {
|
|
|
60
62
|
message.error((err_1 === null || err_1 === void 0 ? void 0 : err_1.msg) || "导出失败!");
|
|
61
63
|
}
|
|
62
64
|
return [2 /*return*/, err_1];
|
|
63
|
-
case
|
|
65
|
+
case 5: return [2 /*return*/];
|
|
64
66
|
}
|
|
65
67
|
});
|
|
66
68
|
}); };
|
|
@@ -68,4 +70,4 @@ var ButtonExport = function (props) {
|
|
|
68
70
|
};
|
|
69
71
|
ButtonExport.displayName = "ZTXK_WEBUI_ButtonExport";
|
|
70
72
|
|
|
71
|
-
export { ButtonExport as default
|
|
73
|
+
export { ButtonExport as default };
|
package/package.json
CHANGED
package/dist/es/_virtual/node.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { p as parallel_1 } from './parallel.js';
|
|
2
|
-
import { s as serial_1 } from './serial.js';
|
|
3
|
-
import { s as serialOrderedExports } from './serialOrdered.js';
|
|
4
|
-
|
|
5
|
-
var asynckit =
|
|
6
|
-
{
|
|
7
|
-
parallel : parallel_1,
|
|
8
|
-
serial : serial_1,
|
|
9
|
-
serialOrdered : serialOrderedExports
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { asynckit as a };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// API
|
|
2
|
-
var abort_1 = abort;
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Aborts leftover active jobs
|
|
6
|
-
*
|
|
7
|
-
* @param {object} state - current state object
|
|
8
|
-
*/
|
|
9
|
-
function abort(state)
|
|
10
|
-
{
|
|
11
|
-
Object.keys(state.jobs).forEach(clean.bind(state));
|
|
12
|
-
|
|
13
|
-
// reset leftover jobs
|
|
14
|
-
state.jobs = {};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Cleans up leftover job by invoking abort function for the provided job id
|
|
19
|
-
*
|
|
20
|
-
* @this state
|
|
21
|
-
* @param {string|number} key - job id to abort
|
|
22
|
-
*/
|
|
23
|
-
function clean(key)
|
|
24
|
-
{
|
|
25
|
-
if (typeof this.jobs[key] == 'function')
|
|
26
|
-
{
|
|
27
|
-
this.jobs[key]();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { abort_1 as a };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { d as defer_1 } from './defer.js';
|
|
2
|
-
|
|
3
|
-
var defer = defer_1;
|
|
4
|
-
|
|
5
|
-
// API
|
|
6
|
-
var async_1 = async;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Runs provided callback asynchronously
|
|
10
|
-
* even if callback itself is not
|
|
11
|
-
*
|
|
12
|
-
* @param {function} callback - callback to invoke
|
|
13
|
-
* @returns {function} - augmented callback
|
|
14
|
-
*/
|
|
15
|
-
function async(callback)
|
|
16
|
-
{
|
|
17
|
-
var isAsync = false;
|
|
18
|
-
|
|
19
|
-
// check if async happened
|
|
20
|
-
defer(function() { isAsync = true; });
|
|
21
|
-
|
|
22
|
-
return function async_callback(err, result)
|
|
23
|
-
{
|
|
24
|
-
if (isAsync)
|
|
25
|
-
{
|
|
26
|
-
callback(err, result);
|
|
27
|
-
}
|
|
28
|
-
else
|
|
29
|
-
{
|
|
30
|
-
defer(function nextTick_callback()
|
|
31
|
-
{
|
|
32
|
-
callback(err, result);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { async_1 as a };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var defer_1 = defer;
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Runs provided function on next iteration of the event loop
|
|
5
|
-
*
|
|
6
|
-
* @param {function} fn - function to run
|
|
7
|
-
*/
|
|
8
|
-
function defer(fn)
|
|
9
|
-
{
|
|
10
|
-
var nextTick = typeof setImmediate == 'function'
|
|
11
|
-
? setImmediate
|
|
12
|
-
: (
|
|
13
|
-
typeof process == 'object' && typeof process.nextTick == 'function'
|
|
14
|
-
? process.nextTick
|
|
15
|
-
: null
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
if (nextTick)
|
|
19
|
-
{
|
|
20
|
-
nextTick(fn);
|
|
21
|
-
}
|
|
22
|
-
else
|
|
23
|
-
{
|
|
24
|
-
setTimeout(fn, 0);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { defer_1 as d };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { a as async_1 } from './async.js';
|
|
2
|
-
import { a as abort_1 } from './abort.js';
|
|
3
|
-
|
|
4
|
-
var async = async_1
|
|
5
|
-
, abort = abort_1
|
|
6
|
-
;
|
|
7
|
-
|
|
8
|
-
// API
|
|
9
|
-
var iterate_1 = iterate;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Iterates over each job object
|
|
13
|
-
*
|
|
14
|
-
* @param {array|object} list - array or object (named list) to iterate over
|
|
15
|
-
* @param {function} iterator - iterator to run
|
|
16
|
-
* @param {object} state - current job status
|
|
17
|
-
* @param {function} callback - invoked when all elements processed
|
|
18
|
-
*/
|
|
19
|
-
function iterate(list, iterator, state, callback)
|
|
20
|
-
{
|
|
21
|
-
// store current index
|
|
22
|
-
var key = state['keyedList'] ? state['keyedList'][state.index] : state.index;
|
|
23
|
-
|
|
24
|
-
state.jobs[key] = runJob(iterator, key, list[key], function(error, output)
|
|
25
|
-
{
|
|
26
|
-
// don't repeat yourself
|
|
27
|
-
// skip secondary callbacks
|
|
28
|
-
if (!(key in state.jobs))
|
|
29
|
-
{
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// clean up jobs
|
|
34
|
-
delete state.jobs[key];
|
|
35
|
-
|
|
36
|
-
if (error)
|
|
37
|
-
{
|
|
38
|
-
// don't process rest of the results
|
|
39
|
-
// stop still active jobs
|
|
40
|
-
// and reset the list
|
|
41
|
-
abort(state);
|
|
42
|
-
}
|
|
43
|
-
else
|
|
44
|
-
{
|
|
45
|
-
state.results[key] = output;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// return salvaged results
|
|
49
|
-
callback(error, state.results);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Runs iterator over provided job element
|
|
55
|
-
*
|
|
56
|
-
* @param {function} iterator - iterator to invoke
|
|
57
|
-
* @param {string|number} key - key/index of the element in the list of jobs
|
|
58
|
-
* @param {mixed} item - job description
|
|
59
|
-
* @param {function} callback - invoked after iterator is done with the job
|
|
60
|
-
* @returns {function|mixed} - job abort function or something else
|
|
61
|
-
*/
|
|
62
|
-
function runJob(iterator, key, item, callback)
|
|
63
|
-
{
|
|
64
|
-
var aborter;
|
|
65
|
-
|
|
66
|
-
// allow shortcut if iterator expects only two arguments
|
|
67
|
-
if (iterator.length == 2)
|
|
68
|
-
{
|
|
69
|
-
aborter = iterator(item, async(callback));
|
|
70
|
-
}
|
|
71
|
-
// otherwise go with full three arguments
|
|
72
|
-
else
|
|
73
|
-
{
|
|
74
|
-
aborter = iterator(item, key, async(callback));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return aborter;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export { iterate_1 as i };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// API
|
|
2
|
-
var state_1 = state;
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Creates initial state object
|
|
6
|
-
* for iteration over list
|
|
7
|
-
*
|
|
8
|
-
* @param {array|object} list - list to iterate over
|
|
9
|
-
* @param {function|null} sortMethod - function to use for keys sort,
|
|
10
|
-
* or `null` to keep them as is
|
|
11
|
-
* @returns {object} - initial state object
|
|
12
|
-
*/
|
|
13
|
-
function state(list, sortMethod)
|
|
14
|
-
{
|
|
15
|
-
var isNamedList = !Array.isArray(list)
|
|
16
|
-
, initState =
|
|
17
|
-
{
|
|
18
|
-
index : 0,
|
|
19
|
-
keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
|
|
20
|
-
jobs : {},
|
|
21
|
-
results : isNamedList ? {} : [],
|
|
22
|
-
size : isNamedList ? Object.keys(list).length : list.length
|
|
23
|
-
}
|
|
24
|
-
;
|
|
25
|
-
|
|
26
|
-
if (sortMethod)
|
|
27
|
-
{
|
|
28
|
-
// sort array keys based on it's values
|
|
29
|
-
// sort object's keys just on own merit
|
|
30
|
-
initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
|
|
31
|
-
{
|
|
32
|
-
return sortMethod(list[a], list[b]);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return initState;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { state_1 as s };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { a as abort_1 } from './abort.js';
|
|
2
|
-
import { a as async_1 } from './async.js';
|
|
3
|
-
|
|
4
|
-
var abort = abort_1
|
|
5
|
-
, async = async_1
|
|
6
|
-
;
|
|
7
|
-
|
|
8
|
-
// API
|
|
9
|
-
var terminator_1 = terminator;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Terminates jobs in the attached state context
|
|
13
|
-
*
|
|
14
|
-
* @this AsyncKitState#
|
|
15
|
-
* @param {function} callback - final callback to invoke after termination
|
|
16
|
-
*/
|
|
17
|
-
function terminator(callback)
|
|
18
|
-
{
|
|
19
|
-
if (!Object.keys(this.jobs).length)
|
|
20
|
-
{
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// fast forward iteration index
|
|
25
|
-
this.index = this.size;
|
|
26
|
-
|
|
27
|
-
// abort jobs
|
|
28
|
-
abort(this);
|
|
29
|
-
|
|
30
|
-
// send back results we have so far
|
|
31
|
-
async(callback)(null, this.results);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { terminator_1 as t };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { i as iterate_1 } from './lib/iterate.js';
|
|
2
|
-
import { s as state_1 } from './lib/state.js';
|
|
3
|
-
import { t as terminator_1 } from './lib/terminator.js';
|
|
4
|
-
|
|
5
|
-
var iterate = iterate_1
|
|
6
|
-
, initState = state_1
|
|
7
|
-
, terminator = terminator_1
|
|
8
|
-
;
|
|
9
|
-
|
|
10
|
-
// Public API
|
|
11
|
-
var parallel_1 = parallel;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Runs iterator over provided array elements in parallel
|
|
15
|
-
*
|
|
16
|
-
* @param {array|object} list - array or object (named list) to iterate over
|
|
17
|
-
* @param {function} iterator - iterator to run
|
|
18
|
-
* @param {function} callback - invoked when all elements processed
|
|
19
|
-
* @returns {function} - jobs terminator
|
|
20
|
-
*/
|
|
21
|
-
function parallel(list, iterator, callback)
|
|
22
|
-
{
|
|
23
|
-
var state = initState(list);
|
|
24
|
-
|
|
25
|
-
while (state.index < (state['keyedList'] || list).length)
|
|
26
|
-
{
|
|
27
|
-
iterate(list, iterator, state, function(error, result)
|
|
28
|
-
{
|
|
29
|
-
if (error)
|
|
30
|
-
{
|
|
31
|
-
callback(error, result);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// looks like it's the last one
|
|
36
|
-
if (Object.keys(state.jobs).length === 0)
|
|
37
|
-
{
|
|
38
|
-
callback(null, state.results);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
state.index++;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return terminator.bind(state, callback);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { parallel_1 as p };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { s as serialOrderedExports } from './serialOrdered.js';
|
|
2
|
-
|
|
3
|
-
var serialOrdered = serialOrderedExports;
|
|
4
|
-
|
|
5
|
-
// Public API
|
|
6
|
-
var serial_1 = serial;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Runs iterator over provided array elements in series
|
|
10
|
-
*
|
|
11
|
-
* @param {array|object} list - array or object (named list) to iterate over
|
|
12
|
-
* @param {function} iterator - iterator to run
|
|
13
|
-
* @param {function} callback - invoked when all elements processed
|
|
14
|
-
* @returns {function} - jobs terminator
|
|
15
|
-
*/
|
|
16
|
-
function serial(list, iterator, callback)
|
|
17
|
-
{
|
|
18
|
-
return serialOrdered(list, iterator, null, callback);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { serial_1 as s };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { __module as serialOrdered$1 } from '../../_virtual/serialOrdered.js';
|
|
2
|
-
import { i as iterate_1 } from './lib/iterate.js';
|
|
3
|
-
import { s as state_1 } from './lib/state.js';
|
|
4
|
-
import { t as terminator_1 } from './lib/terminator.js';
|
|
5
|
-
|
|
6
|
-
var iterate = iterate_1
|
|
7
|
-
, initState = state_1
|
|
8
|
-
, terminator = terminator_1
|
|
9
|
-
;
|
|
10
|
-
|
|
11
|
-
// Public API
|
|
12
|
-
serialOrdered$1.exports = serialOrdered;
|
|
13
|
-
// sorting helpers
|
|
14
|
-
serialOrdered$1.exports.ascending = ascending;
|
|
15
|
-
serialOrdered$1.exports.descending = descending;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Runs iterator over provided sorted array elements in series
|
|
19
|
-
*
|
|
20
|
-
* @param {array|object} list - array or object (named list) to iterate over
|
|
21
|
-
* @param {function} iterator - iterator to run
|
|
22
|
-
* @param {function} sortMethod - custom sort function
|
|
23
|
-
* @param {function} callback - invoked when all elements processed
|
|
24
|
-
* @returns {function} - jobs terminator
|
|
25
|
-
*/
|
|
26
|
-
function serialOrdered(list, iterator, sortMethod, callback)
|
|
27
|
-
{
|
|
28
|
-
var state = initState(list, sortMethod);
|
|
29
|
-
|
|
30
|
-
iterate(list, iterator, state, function iteratorHandler(error, result)
|
|
31
|
-
{
|
|
32
|
-
if (error)
|
|
33
|
-
{
|
|
34
|
-
callback(error, result);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
state.index++;
|
|
39
|
-
|
|
40
|
-
// are we there yet?
|
|
41
|
-
if (state.index < (state['keyedList'] || list).length)
|
|
42
|
-
{
|
|
43
|
-
iterate(list, iterator, state, iteratorHandler);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// done here
|
|
48
|
-
callback(null, state.results);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
return terminator.bind(state, callback);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/*
|
|
55
|
-
* -- Sort methods
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* sort helper to sort array elements in ascending order
|
|
60
|
-
*
|
|
61
|
-
* @param {mixed} a - an item to compare
|
|
62
|
-
* @param {mixed} b - an item to compare
|
|
63
|
-
* @returns {number} - comparison result
|
|
64
|
-
*/
|
|
65
|
-
function ascending(a, b)
|
|
66
|
-
{
|
|
67
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* sort helper to sort array elements in descending order
|
|
72
|
-
*
|
|
73
|
-
* @param {mixed} a - an item to compare
|
|
74
|
-
* @param {mixed} b - an item to compare
|
|
75
|
-
* @returns {number} - comparison result
|
|
76
|
-
*/
|
|
77
|
-
function descending(a, b)
|
|
78
|
-
{
|
|
79
|
-
return -1 * ascending(a, b);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var serialOrderedExports = serialOrdered$1.exports;
|
|
83
|
-
|
|
84
|
-
export { serialOrderedExports as s };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import utils from '../utils.js';
|
|
2
|
-
import httpAdapter from './http.js';
|
|
3
|
-
import xhrAdapter from './xhr.js';
|
|
4
|
-
import AxiosError from '../core/AxiosError.js';
|
|
5
|
-
|
|
6
|
-
const knownAdapters = {
|
|
7
|
-
http: httpAdapter,
|
|
8
|
-
xhr: xhrAdapter
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
utils.forEach(knownAdapters, (fn, value) => {
|
|
12
|
-
if(fn) {
|
|
13
|
-
try {
|
|
14
|
-
Object.defineProperty(fn, 'name', {value});
|
|
15
|
-
} catch (e) {
|
|
16
|
-
// eslint-disable-next-line no-empty
|
|
17
|
-
}
|
|
18
|
-
Object.defineProperty(fn, 'adapterName', {value});
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
var adapters = {
|
|
23
|
-
getAdapter: (adapters) => {
|
|
24
|
-
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
|
25
|
-
|
|
26
|
-
const {length} = adapters;
|
|
27
|
-
let nameOrAdapter;
|
|
28
|
-
let adapter;
|
|
29
|
-
|
|
30
|
-
for (let i = 0; i < length; i++) {
|
|
31
|
-
nameOrAdapter = adapters[i];
|
|
32
|
-
if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (!adapter) {
|
|
38
|
-
if (adapter === false) {
|
|
39
|
-
throw new AxiosError(
|
|
40
|
-
`Adapter ${nameOrAdapter} is not supported by the environment`,
|
|
41
|
-
'ERR_NOT_SUPPORT'
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
throw new Error(
|
|
46
|
-
utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
|
|
47
|
-
`Adapter '${nameOrAdapter}' is not available in the build` :
|
|
48
|
-
`Unknown adapter '${nameOrAdapter}'`
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (!utils.isFunction(adapter)) {
|
|
53
|
-
throw new TypeError('adapter is not a function');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return adapter;
|
|
57
|
-
},
|
|
58
|
-
adapters: knownAdapters
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export { adapters as default };
|