@bbn/bbn 1.0.68 → 1.0.70
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/bundle.d.ts +2 -2
- package/dist/bundle.js +49 -47
- package/dist/fn/ajax/_addLoader.js +1 -0
- package/dist/fn/ajax/ajax.js +26 -25
- package/dist/fn/default/defaultAjaxErrorFunction.d.ts +1 -1
- package/dist/fn/default/defaultAjaxErrorFunction.js +2 -1
- package/dist/fn/default/defaultConfirmFunction.js +1 -1
- package/dist/fn/default/defaultPreLinkFunction.js +1 -1
- package/dist/fn.d.ts +1 -1
- package/package.json +1 -1
package/dist/bundle.d.ts
CHANGED
|
@@ -1535,7 +1535,7 @@ declare module "fn/default/defaultEndLoadingFunction" {
|
|
|
1535
1535
|
export { defaultEndLoadingFunction };
|
|
1536
1536
|
}
|
|
1537
1537
|
declare module "fn/default/defaultAjaxErrorFunction" {
|
|
1538
|
-
const defaultAjaxErrorFunction: (jqXHR: any, textStatus?: string, errorThrown?: object) =>
|
|
1538
|
+
const defaultAjaxErrorFunction: (jqXHR: any, textStatus?: string, errorThrown?: object) => void;
|
|
1539
1539
|
export { defaultAjaxErrorFunction };
|
|
1540
1540
|
}
|
|
1541
1541
|
declare module "fn/default/defaultAjaxAbortFunction" {
|
|
@@ -4700,7 +4700,7 @@ declare module "fn" {
|
|
|
4700
4700
|
daysInMonth: (v: any) => number | false;
|
|
4701
4701
|
deepPath: (arr: any[], filter: object, deepProperty: string, res?: any[]) => false | any[];
|
|
4702
4702
|
defaultAjaxAbortFunction: (message: string, url?: string) => void;
|
|
4703
|
-
defaultAjaxErrorFunction: (jqXHR: any, textStatus?: string, errorThrown?: object) =>
|
|
4703
|
+
defaultAjaxErrorFunction: (jqXHR: any, textStatus?: string, errorThrown?: object) => void;
|
|
4704
4704
|
defaultAlertFunction: (msg: string, title?: string) => void;
|
|
4705
4705
|
defaultConfirmFunction: (text: string, yesFn: () => any, noFn: () => any) => void;
|
|
4706
4706
|
defaultEndLoadingFunction: (url: string, timestamp: number, data?: object, res?: object) => boolean;
|
package/dist/bundle.js
CHANGED
|
@@ -942,6 +942,7 @@
|
|
|
942
942
|
* @returns {Number} The timestamp (in ms)
|
|
943
943
|
*/
|
|
944
944
|
const _addLoader = function (requestId, prom, source) {
|
|
945
|
+
console.log('_addLoader', requestId);
|
|
945
946
|
/** @var {Number} tst Current timestamp */
|
|
946
947
|
let tst = new Date().getTime();
|
|
947
948
|
/** @var {String} url The original URL (part of requestId before : and md5) */
|
|
@@ -3050,21 +3051,21 @@
|
|
|
3050
3051
|
};
|
|
3051
3052
|
exports.defaultEndLoadingFunction = defaultEndLoadingFunction;
|
|
3052
3053
|
});
|
|
3053
|
-
define("fn/default/defaultAjaxErrorFunction", ["require", "exports"], function (require, exports) {
|
|
3054
|
+
define("fn/default/defaultAjaxErrorFunction", ["require", "exports", "fn/browser/log"], function (require, exports, log_8) {
|
|
3054
3055
|
"use strict";
|
|
3055
3056
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3056
3057
|
exports.defaultAjaxErrorFunction = void 0;
|
|
3057
3058
|
const defaultAjaxErrorFunction = function (jqXHR, textStatus, errorThrown) {
|
|
3058
|
-
|
|
3059
|
+
(0, log_8.log)(textStatus, errorThrown);
|
|
3059
3060
|
};
|
|
3060
3061
|
exports.defaultAjaxErrorFunction = defaultAjaxErrorFunction;
|
|
3061
3062
|
});
|
|
3062
|
-
define("fn/default/defaultAjaxAbortFunction", ["require", "exports", "fn/browser/log"], function (require, exports,
|
|
3063
|
+
define("fn/default/defaultAjaxAbortFunction", ["require", "exports", "fn/browser/log"], function (require, exports, log_9) {
|
|
3063
3064
|
"use strict";
|
|
3064
3065
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3065
3066
|
exports.defaultAjaxAbortFunction = void 0;
|
|
3066
3067
|
const defaultAjaxAbortFunction = function (message, url = '') {
|
|
3067
|
-
(0,
|
|
3068
|
+
(0, log_9.log)(message);
|
|
3068
3069
|
};
|
|
3069
3070
|
exports.defaultAjaxAbortFunction = defaultAjaxAbortFunction;
|
|
3070
3071
|
});
|
|
@@ -3138,7 +3139,7 @@
|
|
|
3138
3139
|
* @returns {Promise} The Promise created by the generated XHR.
|
|
3139
3140
|
*/
|
|
3140
3141
|
const ajax = function (url, datatype, data, success, failure, abort) {
|
|
3141
|
-
if (arguments.length === 1 && url && typeof url ===
|
|
3142
|
+
if (arguments.length === 1 && url && typeof url === "object" && url.url) {
|
|
3142
3143
|
if (url.abort) {
|
|
3143
3144
|
abort = url.abort;
|
|
3144
3145
|
}
|
|
@@ -3159,13 +3160,13 @@
|
|
|
3159
3160
|
if (!url) {
|
|
3160
3161
|
return;
|
|
3161
3162
|
}
|
|
3162
|
-
if (url && typeof url ===
|
|
3163
|
-
if (url.indexOf(
|
|
3163
|
+
if (url && typeof url === "string") {
|
|
3164
|
+
if (url.indexOf("://") === -1) {
|
|
3164
3165
|
// Prevent protocol mismatch by Axios
|
|
3165
|
-
url = (0, replaceAll_1.replaceAll)(
|
|
3166
|
+
url = (0, replaceAll_1.replaceAll)("//", "/", url);
|
|
3166
3167
|
}
|
|
3167
3168
|
if (!datatype) {
|
|
3168
|
-
datatype =
|
|
3169
|
+
datatype = "json";
|
|
3169
3170
|
}
|
|
3170
3171
|
let requestId = (0, getRequestId_1.getRequestId)(url, data, datatype);
|
|
3171
3172
|
let loaderObj = (0, getLoader_2.getLoader)(requestId);
|
|
@@ -3182,10 +3183,10 @@
|
|
|
3182
3183
|
responseType: datatype,
|
|
3183
3184
|
cancelToken: source.token,
|
|
3184
3185
|
};
|
|
3185
|
-
if (datatype ===
|
|
3186
|
+
if (datatype === "text") {
|
|
3186
3187
|
options.headers = {
|
|
3187
|
-
accept:
|
|
3188
|
-
|
|
3188
|
+
accept: "text/javascript",
|
|
3189
|
+
"Content-Type": "text/javascript",
|
|
3189
3190
|
};
|
|
3190
3191
|
}
|
|
3191
3192
|
let args = [url];
|
|
@@ -3193,9 +3194,10 @@
|
|
|
3193
3194
|
args.push(data);
|
|
3194
3195
|
}
|
|
3195
3196
|
args.push(options);
|
|
3196
|
-
const axiosMethod = args.length === 2 ?
|
|
3197
|
-
let loader = axios[axiosMethod]
|
|
3198
|
-
.
|
|
3197
|
+
const axiosMethod = args.length === 2 ? "get" : "post";
|
|
3198
|
+
let loader = axios[axiosMethod]
|
|
3199
|
+
.apply(null, args)
|
|
3200
|
+
.then((res) => {
|
|
3199
3201
|
(0, _deleteLoader_1._deleteLoader)(requestId, res);
|
|
3200
3202
|
(0, defaultEndLoadingFunction_1.defaultEndLoadingFunction)(url, tst, data, res);
|
|
3201
3203
|
switch (res.status) {
|
|
@@ -3228,7 +3230,7 @@
|
|
|
3228
3230
|
ok = failure(err.request, err);
|
|
3229
3231
|
}
|
|
3230
3232
|
if (ok) {
|
|
3231
|
-
(0, defaultAjaxErrorFunction_1.defaultAjaxErrorFunction)(err.request, err.response ? err.response.data :
|
|
3233
|
+
(0, defaultAjaxErrorFunction_1.defaultAjaxErrorFunction)(err.request, err.response ? err.response.data : "", err.response ? err.response.status : err);
|
|
3232
3234
|
}
|
|
3233
3235
|
}
|
|
3234
3236
|
});
|
|
@@ -3748,7 +3750,7 @@
|
|
|
3748
3750
|
};
|
|
3749
3751
|
exports.defaultAlertFunction = defaultAlertFunction;
|
|
3750
3752
|
});
|
|
3751
|
-
define("fn/ajax/callback", ["require", "exports", "fn/browser/error", "fn/default/defaultLinkFunction", "fn/type/isFunction", "fn/browser/log", "fn/default/defaultPostLinkFunction", "fn/default/defaultAlertFunction"], function (require, exports, error_2, defaultLinkFunction_1, isFunction_4,
|
|
3753
|
+
define("fn/ajax/callback", ["require", "exports", "fn/browser/error", "fn/default/defaultLinkFunction", "fn/type/isFunction", "fn/browser/log", "fn/default/defaultPostLinkFunction", "fn/default/defaultAlertFunction"], function (require, exports, error_2, defaultLinkFunction_1, isFunction_4, log_10, defaultPostLinkFunction_1, defaultAlertFunction_1) {
|
|
3752
3754
|
"use strict";
|
|
3753
3755
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3754
3756
|
exports.callback = void 0;
|
|
@@ -3835,7 +3837,7 @@
|
|
|
3835
3837
|
}
|
|
3836
3838
|
}
|
|
3837
3839
|
catch (e) {
|
|
3838
|
-
(0,
|
|
3840
|
+
(0, log_10.log)(e, res);
|
|
3839
3841
|
(0, error_2.error)((0, isFunction_4.isFunction)(e.getMessage) ? e.getMessage() : null);
|
|
3840
3842
|
}
|
|
3841
3843
|
return r;
|
|
@@ -4490,12 +4492,12 @@
|
|
|
4490
4492
|
};
|
|
4491
4493
|
exports.defaultConfirmFunction = defaultConfirmFunction;
|
|
4492
4494
|
});
|
|
4493
|
-
define("fn/default/defaultErrorFunction", ["require", "exports", "fn/browser/log"], function (require, exports,
|
|
4495
|
+
define("fn/default/defaultErrorFunction", ["require", "exports", "fn/browser/log"], function (require, exports, log_11) {
|
|
4494
4496
|
"use strict";
|
|
4495
4497
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4496
4498
|
exports.defaultErrorFunction = void 0;
|
|
4497
4499
|
const defaultErrorFunction = function (message) {
|
|
4498
|
-
(0,
|
|
4500
|
+
(0, log_11.log)(message);
|
|
4499
4501
|
};
|
|
4500
4502
|
exports.defaultErrorFunction = defaultErrorFunction;
|
|
4501
4503
|
});
|
|
@@ -4513,7 +4515,7 @@
|
|
|
4513
4515
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4514
4516
|
exports.defaultPreLinkFunction = void 0;
|
|
4515
4517
|
const defaultPreLinkFunction = function (url, force, ele) {
|
|
4516
|
-
return
|
|
4518
|
+
return true;
|
|
4517
4519
|
};
|
|
4518
4520
|
exports.defaultPreLinkFunction = defaultPreLinkFunction;
|
|
4519
4521
|
});
|
|
@@ -4890,7 +4892,7 @@
|
|
|
4890
4892
|
};
|
|
4891
4893
|
exports.isCanvas = isCanvas;
|
|
4892
4894
|
});
|
|
4893
|
-
define("fn/ajax/downloadContent", ["require", "exports", "fn/type/isCanvas", "fn/type/isObject", "fn/type/isString", "fn/browser/log"], function (require, exports, isCanvas_1, isObject_12, isString_11,
|
|
4895
|
+
define("fn/ajax/downloadContent", ["require", "exports", "fn/type/isCanvas", "fn/type/isObject", "fn/type/isString", "fn/browser/log"], function (require, exports, isCanvas_1, isObject_12, isString_11, log_12) {
|
|
4894
4896
|
"use strict";
|
|
4895
4897
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4896
4898
|
exports.downloadContent = void 0;
|
|
@@ -4951,7 +4953,7 @@
|
|
|
4951
4953
|
src = content;
|
|
4952
4954
|
}
|
|
4953
4955
|
catch (e) {
|
|
4954
|
-
(0,
|
|
4956
|
+
(0, log_12.log)(e);
|
|
4955
4957
|
}
|
|
4956
4958
|
}
|
|
4957
4959
|
a.href = window.URL.createObjectURL(src);
|
|
@@ -5917,7 +5919,7 @@
|
|
|
5917
5919
|
};
|
|
5918
5920
|
exports.getDeviceType = getDeviceType;
|
|
5919
5921
|
});
|
|
5920
|
-
define("fn/html/getHTMLOfSelection", ["require", "exports", "fn/browser/log"], function (require, exports,
|
|
5922
|
+
define("fn/html/getHTMLOfSelection", ["require", "exports", "fn/browser/log"], function (require, exports, log_13) {
|
|
5921
5923
|
"use strict";
|
|
5922
5924
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5923
5925
|
exports.getHTMLOfSelection = void 0;
|
|
@@ -5926,9 +5928,9 @@
|
|
|
5926
5928
|
let selection = window.getSelection();
|
|
5927
5929
|
if (selection.rangeCount > 0) {
|
|
5928
5930
|
range = selection.getRangeAt(0);
|
|
5929
|
-
(0,
|
|
5931
|
+
(0, log_13.log)('RANGE', range);
|
|
5930
5932
|
let clonedSelection = range.cloneContents();
|
|
5931
|
-
(0,
|
|
5933
|
+
(0, log_13.log)('clonedSelection', clonedSelection);
|
|
5932
5934
|
let div = document.createElement('div');
|
|
5933
5935
|
div.appendChild(clonedSelection);
|
|
5934
5936
|
return div.innerHTML;
|
|
@@ -6300,7 +6302,7 @@
|
|
|
6300
6302
|
};
|
|
6301
6303
|
exports.getTimeoff = getTimeoff;
|
|
6302
6304
|
});
|
|
6303
|
-
define("fn/browser/happy", ["require", "exports", "fn/browser/log"], function (require, exports,
|
|
6305
|
+
define("fn/browser/happy", ["require", "exports", "fn/browser/log"], function (require, exports, log_14) {
|
|
6304
6306
|
"use strict";
|
|
6305
6307
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6306
6308
|
exports.happy = void 0;
|
|
@@ -6321,7 +6323,7 @@
|
|
|
6321
6323
|
_bbn_console_level: 3,
|
|
6322
6324
|
_bbn_console_style: 'color: white; background: green; font-size: 18px;',
|
|
6323
6325
|
});
|
|
6324
|
-
|
|
6326
|
+
log_14.log.apply(this, args);
|
|
6325
6327
|
return this;
|
|
6326
6328
|
};
|
|
6327
6329
|
exports.happy = happy;
|
|
@@ -6433,7 +6435,7 @@
|
|
|
6433
6435
|
};
|
|
6434
6436
|
exports.imgToBase64 = imgToBase64;
|
|
6435
6437
|
});
|
|
6436
|
-
define("fn/browser/info", ["require", "exports", "fn/browser/log"], function (require, exports,
|
|
6438
|
+
define("fn/browser/info", ["require", "exports", "fn/browser/log"], function (require, exports, log_15) {
|
|
6437
6439
|
"use strict";
|
|
6438
6440
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6439
6441
|
exports.info = void 0;
|
|
@@ -6451,7 +6453,7 @@
|
|
|
6451
6453
|
_bbn_console_level: 4,
|
|
6452
6454
|
_bbn_console_style: 'color: #EEE; background: blue; font-size: 12px;',
|
|
6453
6455
|
});
|
|
6454
|
-
|
|
6456
|
+
log_15.log.apply(this, args);
|
|
6455
6457
|
return this;
|
|
6456
6458
|
};
|
|
6457
6459
|
exports.info = info;
|
|
@@ -6665,7 +6667,7 @@
|
|
|
6665
6667
|
};
|
|
6666
6668
|
exports.setNavigationVars = setNavigationVars;
|
|
6667
6669
|
});
|
|
6668
|
-
define("fn/ajax/link", ["require", "exports", "fn/ajax/treatAjaxArguments", "fn/ajax/getLoader", "fn/default/defaultPreLinkFunction", "fn/ajax/ajax", "fn/browser/log", "fn/type/isObject", "fn/ajax/callback", "fn/ajax/setNavigationVars"], function (require, exports, treatAjaxArguments_1, getLoader_3, defaultPreLinkFunction_1, ajax_2,
|
|
6670
|
+
define("fn/ajax/link", ["require", "exports", "fn/ajax/treatAjaxArguments", "fn/ajax/getLoader", "fn/default/defaultPreLinkFunction", "fn/ajax/ajax", "fn/browser/log", "fn/type/isObject", "fn/ajax/callback", "fn/ajax/setNavigationVars"], function (require, exports, treatAjaxArguments_1, getLoader_3, defaultPreLinkFunction_1, ajax_2, log_16, isObject_15, callback_1, setNavigationVars_1) {
|
|
6669
6671
|
"use strict";
|
|
6670
6672
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6671
6673
|
exports.link = void 0;
|
|
@@ -6763,12 +6765,12 @@
|
|
|
6763
6765
|
let errSt = bbn._('The Ajax call to') + ' ' + cfg.url + ' ';
|
|
6764
6766
|
return (0, ajax_2.ajax)(cfg.url, cfg.datatype, cfg.obj, function (res) {
|
|
6765
6767
|
if (!res) {
|
|
6766
|
-
(0,
|
|
6768
|
+
(0, log_16.log)(errSt + bbn._('returned no answer'));
|
|
6767
6769
|
}
|
|
6768
6770
|
if ((0, isObject_15.isObject)(res)) {
|
|
6769
6771
|
// If there's nothing in the result, just an empty object, the callback stops here and the URL is not changed
|
|
6770
6772
|
if (Object.keys(res).length === 0) {
|
|
6771
|
-
(0,
|
|
6773
|
+
(0, log_16.log)(errSt + bbn._('returned an empty object'));
|
|
6772
6774
|
}
|
|
6773
6775
|
if (res.new_url) {
|
|
6774
6776
|
res.old_path = cfg.url;
|
|
@@ -6984,7 +6986,7 @@
|
|
|
6984
6986
|
};
|
|
6985
6987
|
exports.isMobile = isMobile;
|
|
6986
6988
|
});
|
|
6987
|
-
define("fn/init", ["require", "exports", "fn/string/substr", "fn/loop/each", "fn/object/extend", "fn/style/addColors", "fn/ajax/link", "fn/form/submit", "fn/style/resize", "fn/browser/isMobile", "fn/browser/isTabletDevice", "fn/default/defaultHistoryFunction", "fn/type/isFunction", "fn/browser/log"], function (require, exports, substr_11, each_18, extend_6, addColors_1, link_1, submit_1, resize_1, isMobile_1, isTabletDevice_2, defaultHistoryFunction_1, isFunction_9,
|
|
6989
|
+
define("fn/init", ["require", "exports", "fn/string/substr", "fn/loop/each", "fn/object/extend", "fn/style/addColors", "fn/ajax/link", "fn/form/submit", "fn/style/resize", "fn/browser/isMobile", "fn/browser/isTabletDevice", "fn/default/defaultHistoryFunction", "fn/type/isFunction", "fn/browser/log"], function (require, exports, substr_11, each_18, extend_6, addColors_1, link_1, submit_1, resize_1, isMobile_1, isTabletDevice_2, defaultHistoryFunction_1, isFunction_9, log_17) {
|
|
6988
6990
|
"use strict";
|
|
6989
6991
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6990
6992
|
exports.init = void 0;
|
|
@@ -7151,7 +7153,7 @@
|
|
|
7151
7153
|
bbn.env.isInit = true;
|
|
7152
7154
|
document.dispatchEvent(new Event('bbninit'));
|
|
7153
7155
|
if (bbn.env.logging) {
|
|
7154
|
-
(0,
|
|
7156
|
+
(0, log_17.log)('Logging in bbn is enabled');
|
|
7155
7157
|
}
|
|
7156
7158
|
}
|
|
7157
7159
|
};
|
|
@@ -7834,7 +7836,7 @@
|
|
|
7834
7836
|
};
|
|
7835
7837
|
exports.lightenDarkenHex = lightenDarkenHex;
|
|
7836
7838
|
});
|
|
7837
|
-
define("fn/browser/warning", ["require", "exports", "fn/browser/log"], function (require, exports,
|
|
7839
|
+
define("fn/browser/warning", ["require", "exports", "fn/browser/log"], function (require, exports, log_18) {
|
|
7838
7840
|
"use strict";
|
|
7839
7841
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7840
7842
|
exports.warning = void 0;
|
|
@@ -7858,11 +7860,11 @@
|
|
|
7858
7860
|
_bbn_console_style: 'color: #E64141; background: #F7E195; font-size: 14px',
|
|
7859
7861
|
};
|
|
7860
7862
|
args.unshift(obj);
|
|
7861
|
-
|
|
7863
|
+
log_18.log.apply(this, args);
|
|
7862
7864
|
};
|
|
7863
7865
|
exports.warning = warning;
|
|
7864
7866
|
});
|
|
7865
|
-
define("fn/html/makeReactive", ["require", "exports", "fn/browser/log", "fn/object/createObject", "fn/type/isSymbol", "fn/type/isNumber", "fn/type/isArray", "fn/browser/warning", "fn/type/isFunction", "fn/type/isSame"], function (require, exports,
|
|
7867
|
+
define("fn/html/makeReactive", ["require", "exports", "fn/browser/log", "fn/object/createObject", "fn/type/isSymbol", "fn/type/isNumber", "fn/type/isArray", "fn/browser/warning", "fn/type/isFunction", "fn/type/isSame"], function (require, exports, log_19, createObject_2, isSymbol_1, isNumber_8, isArray_13, warning_1, isFunction_10, isSame_2) {
|
|
7866
7868
|
"use strict";
|
|
7867
7869
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7868
7870
|
exports.makeReactive = void 0;
|
|
@@ -7874,7 +7876,7 @@
|
|
|
7874
7876
|
return obj;
|
|
7875
7877
|
}
|
|
7876
7878
|
if (parent && parent.$options && parent.$options.name === 'bbn-loadbar') {
|
|
7877
|
-
(0,
|
|
7879
|
+
(0, log_19.log)(['MAKING bbn-loadbar', obj]);
|
|
7878
7880
|
}
|
|
7879
7881
|
if (!obj.__bbnWatchers) {
|
|
7880
7882
|
Reflect.defineProperty(obj, '__bbnWatchers', {
|
|
@@ -7898,7 +7900,7 @@
|
|
|
7898
7900
|
return function (...args) {
|
|
7899
7901
|
let res = realTarget[key](...args);
|
|
7900
7902
|
(0, warning_1.warning)('DOING ARRAY STUFF');
|
|
7901
|
-
(0,
|
|
7903
|
+
(0, log_19.log)(target.__bbnParent);
|
|
7902
7904
|
onSet(target, 'length', parent);
|
|
7903
7905
|
return res;
|
|
7904
7906
|
};
|
|
@@ -7965,7 +7967,7 @@
|
|
|
7965
7967
|
return Reflect.get(target, key);
|
|
7966
7968
|
}
|
|
7967
7969
|
if (parent && parent.$options && parent.$options.name === 'bbn-loadbar') {
|
|
7968
|
-
(0,
|
|
7970
|
+
(0, log_19.log)(['Setting proxy prop in ' + parent.$options.name, target, key, value]);
|
|
7969
7971
|
}
|
|
7970
7972
|
if (!(0, isSame_2.isSame)(realTarget[key], value)) {
|
|
7971
7973
|
if (key.indexOf('__bbn_') === 0) {
|
|
@@ -7993,7 +7995,7 @@
|
|
|
7993
7995
|
}
|
|
7994
7996
|
}
|
|
7995
7997
|
if (parent && parent.$options && parent.$options.name === 'bbn-loadbar') {
|
|
7996
|
-
(0,
|
|
7998
|
+
(0, log_19.log)([
|
|
7997
7999
|
'Setting proxy prop in ' +
|
|
7998
8000
|
parent.$options.name +
|
|
7999
8001
|
' ' +
|
|
@@ -9696,7 +9698,7 @@
|
|
|
9696
9698
|
};
|
|
9697
9699
|
exports.uniqString = uniqString;
|
|
9698
9700
|
});
|
|
9699
|
-
define("fn/ajax/upload", ["require", "exports", "fn/form/objectToFormData", "fn/browser/log"], function (require, exports, objectToFormData_1,
|
|
9701
|
+
define("fn/ajax/upload", ["require", "exports", "fn/form/objectToFormData", "fn/browser/log"], function (require, exports, objectToFormData_1, log_20) {
|
|
9700
9702
|
"use strict";
|
|
9701
9703
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9702
9704
|
exports.upload = void 0;
|
|
@@ -9737,13 +9739,13 @@
|
|
|
9737
9739
|
return fn()
|
|
9738
9740
|
.then((res) => {
|
|
9739
9741
|
if (success) {
|
|
9740
|
-
(0,
|
|
9742
|
+
(0, log_20.log)('SUCCESS', res);
|
|
9741
9743
|
success(res);
|
|
9742
9744
|
}
|
|
9743
9745
|
})
|
|
9744
9746
|
.catch((err) => {
|
|
9745
9747
|
if (failure) {
|
|
9746
|
-
(0,
|
|
9748
|
+
(0, log_20.log)('ERROR', err);
|
|
9747
9749
|
failure(err);
|
|
9748
9750
|
}
|
|
9749
9751
|
});
|
|
@@ -9751,7 +9753,7 @@
|
|
|
9751
9753
|
};
|
|
9752
9754
|
exports.upload = upload;
|
|
9753
9755
|
});
|
|
9754
|
-
define("fn", ["require", "exports", "fn/ajax/_addLoader", "fn/object/_compareValues", "fn/ajax/_deleteLoader", "fn/ajax/abort", "fn/ajax/abortURL", "fn/style/addColors", "fn/form/addInputs", "fn/style/addStyle", "fn/html/adjustHeight", "fn/html/adjustSize", "fn/html/adjustWidth", "fn/ajax/ajax", "fn/misc/analyzeFunction", "fn/style/animateCss", "fn/convert/arrayBuffer2String", "fn/object/arrayFromProp", "fn/object/autoExtend", "fn/string/baseName", "fn/string/br2nl", "fn/datetime/calendar", "fn/ajax/callback", "fn/string/camelize", "fn/string/camelToCss", "fn/convert/canvasToImage", "fn/style/center", "fn/object/checkProps", "fn/object/checkPropsDetails", "fn/object/checkPropsOrDie", "fn/type/checkType", "fn/object/circularReplacer", "fn/object/clone", "fn/convert/colorToHex", "fn/object/compare", "fn/object/compareConditions", "fn/browser/copy", "fn/string/correctCase", "fn/object/count", "fn/string/crc32", "fn/object/createObject", "fn/style/cssExists", "fn/datetime/date", "fn/datetime/dateSQL", "fn/datetime/daysInMonth", "fn/object/deepPath", "fn/default/defaultAjaxAbortFunction", "fn/default/defaultAjaxErrorFunction", "fn/default/defaultAlertFunction", "fn/default/defaultConfirmFunction", "fn/default/defaultEndLoadingFunction", "fn/default/defaultErrorFunction", "fn/default/defaultHistoryFunction", "fn/default/defaultLinkFunction", "fn/default/defaultPostLinkFunction", "fn/default/defaultPreLinkFunction", "fn/default/defaultResizeFunction", "fn/default/defaultStartLoadingFunction", "fn/object/deleteProp", "fn/object/diffObj", "fn/string/dirName", "fn/ajax/download", "fn/ajax/downloadContent", "fn/loop/each", "fn/browser/eraseCookie", "fn/browser/error", "fn/string/escapeDquotes", "fn/string/escapeRegExp", "fn/string/escapeSquotes", "fn/string/escapeTicks", "fn/string/escapeUrl", "fn/object/extend", "fn/object/extendOut", "fn/datetime/fdate", "fn/datetime/fdatetime", "fn/form/fieldValue", "fn/string/fileExt", "fn/object/filter", "fn/object/filterToConditions", "fn/object/findAll", "fn/loop/fori", "fn/loop/forir", "fn/string/format", "fn/string/formatBytes", "fn/datetime/formatDate", "fn/string/formatSize", "fn/form/formdata", "fn/convert/fromXml", "fn/datetime/ftime", "fn/html/getAllTags", "fn/html/getAncestors", "fn/html/getAttributes", "fn/browser/getBrowserName", "fn/browser/getBrowserVersion", "fn/browser/getCookie", "fn/style/getCssVar", "fn/datetime/getDay", "fn/browser/getDeviceType", "fn/browser/getEventData", "fn/object/getField", "fn/object/getFieldValues", "fn/html/getHtml", "fn/html/getHTMLOfSelection", "fn/ajax/getLoader", "fn/html/getPath", "fn/object/getProp", "fn/object/getProperty", "fn/ajax/getRequestId", "fn/object/getRow", "fn/style/getScrollBarSize", "fn/html/getText", "fn/misc/getTimeoff", "fn/browser/happy", "fn/string/hash", "fn/convert/hex2rgb", "fn/browser/history", "fn/html/html2text", "fn/convert/imageToCanvas", "fn/convert/imgToBase64", "fn/browser/info", "fn/init", "fn/browser/isActiveInterface", "fn/type/isArray", "fn/type/isBlob", "fn/type/isBoolean", "fn/type/isCanvas", "fn/type/isColor", "fn/type/isComment", "fn/type/isCp", "fn/type/isDate", "fn/browser/isDesktopDevice", "fn/type/isDimension", "fn/type/isDom", "fn/type/isEmail", "fn/type/isEmpty", "fn/type/isEvent", "fn/browser/isFocused", "fn/type/isFunction", "fn/type/isHostname", "fn/html/isInside", "fn/type/isInt", "fn/type/isIP", "fn/type/isIterable", "fn/browser/isMobile", "fn/browser/isMobileDevice", "fn/type/isNull", "fn/type/isNumber", "fn/type/isObject", "fn/type/isPercent", "fn/type/isPrimitive", "fn/type/isPromise", "fn/type/isPropSize", "fn/type/isSame", "fn/type/isSQLDate", "fn/type/isString", "fn/type/isSymbol", "fn/browser/isTabletDevice", "fn/type/isURL", "fn/type/isValidDimension", "fn/type/isValidName", "fn/type/isValue", "fn/type/isVue", "fn/loop/iterate", "fn/style/lightenDarkenHex", "fn/ajax/link", "fn/browser/log", "fn/html/makeReactive", "fn/object/map", "fn/string/md5", "fn/misc/money", "fn/object/move", "fn/object/multiorder", "fn/string/nl2br", "fn/object/numProperties", "fn/form/objectToFormData", "fn/object/order", "fn/style/outerHeight", "fn/style/outerWidth", "fn/misc/percent", "fn/object/pickValue", "fn/ajax/post", "fn/ajax/postOut", "fn/string/printf", "fn/string/quotes2html", "fn/misc/randomInt", "fn/string/randomString", "fn/string/removeAccents", "fn/object/removeEmpty", "fn/string/removeExtraSpaces", "fn/string/removeHtmlComments", "fn/object/removePrivateProp", "fn/string/removeTrailingChars", "fn/string/repeat", "fn/string/replaceAll", "fn/browser/replaceSelection", "fn/style/resize", "fn/convert/rgb2hex", "fn/loop/riterate", "fn/misc/roundDecimal", "fn/string/sanitize", "fn/object/search", "fn/browser/selectElementText", "fn/html/selector", "fn/browser/setCookie", "fn/style/setCssVar", "fn/ajax/setNavigationVars", "fn/object/setProp", "fn/object/setProperty", "fn/string/shorten", "fn/object/shortenObj", "fn/object/shuffle", "fn/string/simpleHash", "fn/string/simpleHash1", "fn/string/simpleHash2", "fn/datetime/chrono", "fn/convert/string2ArrayBuffer", "fn/form/submit", "fn/string/substr", "fn/object/sum", "fn/datetime/timestamp", "fn/convert/toCSV", "fn/browser/toggleFullScreen", "fn/misc/translate", "fn/ajax/treatAjaxArguments", "fn/string/trim", "fn/string/uniqString", "fn/object/unique", "fn/ajax/upload", "fn/browser/warning"], function (require, exports, _addLoader_2, _compareValues_3, _deleteLoader_2, abort_1, abortURL_1, addColors_2, addInputs_2, addStyle_1, adjustHeight_1, adjustSize_3, adjustWidth_1, ajax_4, analyzeFunction_1, animateCss_1, arrayBuffer2String_1, arrayFromProp_1, autoExtend_1, baseName_3, br2nl_1, calendar_1, callback_3, camelize_1, camelToCss_1, canvasToImage_1, center_1, checkProps_1, checkPropsDetails_3, checkPropsOrDie_1, checkType_6, circularReplacer_2, clone_2, colorToHex_1, compare_2, compareConditions_3, copy_1, correctCase_2, count_1, crc32_1, createObject_4, cssExists_1, date_8, dateSQL_1, daysInMonth_1, deepPath_1, defaultAjaxAbortFunction_2, defaultAjaxErrorFunction_3, defaultAlertFunction_2, defaultConfirmFunction_1, defaultEndLoadingFunction_2, defaultErrorFunction_2, defaultHistoryFunction_2, defaultLinkFunction_2, defaultPostLinkFunction_2, defaultPreLinkFunction_2, defaultResizeFunction_2, defaultStartLoadingFunction_2, deleteProp_1, diffObj_1, dirName_2, download_1, downloadContent_2, each_28, eraseCookie_1, error_4, escapeDquotes_1, escapeRegExp_3, escapeSquotes_1, escapeTicks_1, escapeUrl_1, extend_7, extendOut_1, fdate_2, fdatetime_2, fieldValue_2, fileExt_2, filter_6, filterToConditions_3, findAll_1, fori_1, forir_1, format_1, formatBytes_1, formatDate_1, formatSize_1, formdata_2, fromXml_1, ftime_1, getAllTags_1, getAncestors_2, getAttributes_1, getBrowserName_1, getBrowserVersion_1, getCookie_1, getCssVar_2, getDay_1, getDeviceType_4, getEventData_1, getField_1, getFieldValues_1, getHtml_1, getHTMLOfSelection_2, getLoader_4, getPath_1, getProp_1, getProperty_4, getRequestId_2, getRow_3, getScrollBarSize_1, getText_1, getTimeoff_1, happy_1, hash_2, hex2rgb_1, history_1, html2text_2, imageToCanvas_2, imgToBase64_1, info_1, init_1, isActiveInterface_1, isArray_19, isBlob_2, isBoolean_1, isCanvas_2, isColor_1, isComment_1, isCp_3, isDate_8, isDesktopDevice_1, isDimension_1, isDom_5, isEmail_1, isEmpty_2, isEvent_1, isFocused_1, isFunction_11, isHostname_1, isInside_1, isInt_2, isIP_2, isIterable_5, isMobile_2, isMobileDevice_2, isNull_4, isNumber_10, isObject_18, isPercent_1, isPrimitive_1, isPromise_1, isPropSize_1, isSame_3, isSQLDate_1, isString_27, isSymbol_2, isTabletDevice_3, isURL_1, isValidDimension_2, isValidName_1, isValue_2, isVue_1, iterate_12, lightenDarkenHex_1, link_2,
|
|
9756
|
+
define("fn", ["require", "exports", "fn/ajax/_addLoader", "fn/object/_compareValues", "fn/ajax/_deleteLoader", "fn/ajax/abort", "fn/ajax/abortURL", "fn/style/addColors", "fn/form/addInputs", "fn/style/addStyle", "fn/html/adjustHeight", "fn/html/adjustSize", "fn/html/adjustWidth", "fn/ajax/ajax", "fn/misc/analyzeFunction", "fn/style/animateCss", "fn/convert/arrayBuffer2String", "fn/object/arrayFromProp", "fn/object/autoExtend", "fn/string/baseName", "fn/string/br2nl", "fn/datetime/calendar", "fn/ajax/callback", "fn/string/camelize", "fn/string/camelToCss", "fn/convert/canvasToImage", "fn/style/center", "fn/object/checkProps", "fn/object/checkPropsDetails", "fn/object/checkPropsOrDie", "fn/type/checkType", "fn/object/circularReplacer", "fn/object/clone", "fn/convert/colorToHex", "fn/object/compare", "fn/object/compareConditions", "fn/browser/copy", "fn/string/correctCase", "fn/object/count", "fn/string/crc32", "fn/object/createObject", "fn/style/cssExists", "fn/datetime/date", "fn/datetime/dateSQL", "fn/datetime/daysInMonth", "fn/object/deepPath", "fn/default/defaultAjaxAbortFunction", "fn/default/defaultAjaxErrorFunction", "fn/default/defaultAlertFunction", "fn/default/defaultConfirmFunction", "fn/default/defaultEndLoadingFunction", "fn/default/defaultErrorFunction", "fn/default/defaultHistoryFunction", "fn/default/defaultLinkFunction", "fn/default/defaultPostLinkFunction", "fn/default/defaultPreLinkFunction", "fn/default/defaultResizeFunction", "fn/default/defaultStartLoadingFunction", "fn/object/deleteProp", "fn/object/diffObj", "fn/string/dirName", "fn/ajax/download", "fn/ajax/downloadContent", "fn/loop/each", "fn/browser/eraseCookie", "fn/browser/error", "fn/string/escapeDquotes", "fn/string/escapeRegExp", "fn/string/escapeSquotes", "fn/string/escapeTicks", "fn/string/escapeUrl", "fn/object/extend", "fn/object/extendOut", "fn/datetime/fdate", "fn/datetime/fdatetime", "fn/form/fieldValue", "fn/string/fileExt", "fn/object/filter", "fn/object/filterToConditions", "fn/object/findAll", "fn/loop/fori", "fn/loop/forir", "fn/string/format", "fn/string/formatBytes", "fn/datetime/formatDate", "fn/string/formatSize", "fn/form/formdata", "fn/convert/fromXml", "fn/datetime/ftime", "fn/html/getAllTags", "fn/html/getAncestors", "fn/html/getAttributes", "fn/browser/getBrowserName", "fn/browser/getBrowserVersion", "fn/browser/getCookie", "fn/style/getCssVar", "fn/datetime/getDay", "fn/browser/getDeviceType", "fn/browser/getEventData", "fn/object/getField", "fn/object/getFieldValues", "fn/html/getHtml", "fn/html/getHTMLOfSelection", "fn/ajax/getLoader", "fn/html/getPath", "fn/object/getProp", "fn/object/getProperty", "fn/ajax/getRequestId", "fn/object/getRow", "fn/style/getScrollBarSize", "fn/html/getText", "fn/misc/getTimeoff", "fn/browser/happy", "fn/string/hash", "fn/convert/hex2rgb", "fn/browser/history", "fn/html/html2text", "fn/convert/imageToCanvas", "fn/convert/imgToBase64", "fn/browser/info", "fn/init", "fn/browser/isActiveInterface", "fn/type/isArray", "fn/type/isBlob", "fn/type/isBoolean", "fn/type/isCanvas", "fn/type/isColor", "fn/type/isComment", "fn/type/isCp", "fn/type/isDate", "fn/browser/isDesktopDevice", "fn/type/isDimension", "fn/type/isDom", "fn/type/isEmail", "fn/type/isEmpty", "fn/type/isEvent", "fn/browser/isFocused", "fn/type/isFunction", "fn/type/isHostname", "fn/html/isInside", "fn/type/isInt", "fn/type/isIP", "fn/type/isIterable", "fn/browser/isMobile", "fn/browser/isMobileDevice", "fn/type/isNull", "fn/type/isNumber", "fn/type/isObject", "fn/type/isPercent", "fn/type/isPrimitive", "fn/type/isPromise", "fn/type/isPropSize", "fn/type/isSame", "fn/type/isSQLDate", "fn/type/isString", "fn/type/isSymbol", "fn/browser/isTabletDevice", "fn/type/isURL", "fn/type/isValidDimension", "fn/type/isValidName", "fn/type/isValue", "fn/type/isVue", "fn/loop/iterate", "fn/style/lightenDarkenHex", "fn/ajax/link", "fn/browser/log", "fn/html/makeReactive", "fn/object/map", "fn/string/md5", "fn/misc/money", "fn/object/move", "fn/object/multiorder", "fn/string/nl2br", "fn/object/numProperties", "fn/form/objectToFormData", "fn/object/order", "fn/style/outerHeight", "fn/style/outerWidth", "fn/misc/percent", "fn/object/pickValue", "fn/ajax/post", "fn/ajax/postOut", "fn/string/printf", "fn/string/quotes2html", "fn/misc/randomInt", "fn/string/randomString", "fn/string/removeAccents", "fn/object/removeEmpty", "fn/string/removeExtraSpaces", "fn/string/removeHtmlComments", "fn/object/removePrivateProp", "fn/string/removeTrailingChars", "fn/string/repeat", "fn/string/replaceAll", "fn/browser/replaceSelection", "fn/style/resize", "fn/convert/rgb2hex", "fn/loop/riterate", "fn/misc/roundDecimal", "fn/string/sanitize", "fn/object/search", "fn/browser/selectElementText", "fn/html/selector", "fn/browser/setCookie", "fn/style/setCssVar", "fn/ajax/setNavigationVars", "fn/object/setProp", "fn/object/setProperty", "fn/string/shorten", "fn/object/shortenObj", "fn/object/shuffle", "fn/string/simpleHash", "fn/string/simpleHash1", "fn/string/simpleHash2", "fn/datetime/chrono", "fn/convert/string2ArrayBuffer", "fn/form/submit", "fn/string/substr", "fn/object/sum", "fn/datetime/timestamp", "fn/convert/toCSV", "fn/browser/toggleFullScreen", "fn/misc/translate", "fn/ajax/treatAjaxArguments", "fn/string/trim", "fn/string/uniqString", "fn/object/unique", "fn/ajax/upload", "fn/browser/warning"], function (require, exports, _addLoader_2, _compareValues_3, _deleteLoader_2, abort_1, abortURL_1, addColors_2, addInputs_2, addStyle_1, adjustHeight_1, adjustSize_3, adjustWidth_1, ajax_4, analyzeFunction_1, animateCss_1, arrayBuffer2String_1, arrayFromProp_1, autoExtend_1, baseName_3, br2nl_1, calendar_1, callback_3, camelize_1, camelToCss_1, canvasToImage_1, center_1, checkProps_1, checkPropsDetails_3, checkPropsOrDie_1, checkType_6, circularReplacer_2, clone_2, colorToHex_1, compare_2, compareConditions_3, copy_1, correctCase_2, count_1, crc32_1, createObject_4, cssExists_1, date_8, dateSQL_1, daysInMonth_1, deepPath_1, defaultAjaxAbortFunction_2, defaultAjaxErrorFunction_3, defaultAlertFunction_2, defaultConfirmFunction_1, defaultEndLoadingFunction_2, defaultErrorFunction_2, defaultHistoryFunction_2, defaultLinkFunction_2, defaultPostLinkFunction_2, defaultPreLinkFunction_2, defaultResizeFunction_2, defaultStartLoadingFunction_2, deleteProp_1, diffObj_1, dirName_2, download_1, downloadContent_2, each_28, eraseCookie_1, error_4, escapeDquotes_1, escapeRegExp_3, escapeSquotes_1, escapeTicks_1, escapeUrl_1, extend_7, extendOut_1, fdate_2, fdatetime_2, fieldValue_2, fileExt_2, filter_6, filterToConditions_3, findAll_1, fori_1, forir_1, format_1, formatBytes_1, formatDate_1, formatSize_1, formdata_2, fromXml_1, ftime_1, getAllTags_1, getAncestors_2, getAttributes_1, getBrowserName_1, getBrowserVersion_1, getCookie_1, getCssVar_2, getDay_1, getDeviceType_4, getEventData_1, getField_1, getFieldValues_1, getHtml_1, getHTMLOfSelection_2, getLoader_4, getPath_1, getProp_1, getProperty_4, getRequestId_2, getRow_3, getScrollBarSize_1, getText_1, getTimeoff_1, happy_1, hash_2, hex2rgb_1, history_1, html2text_2, imageToCanvas_2, imgToBase64_1, info_1, init_1, isActiveInterface_1, isArray_19, isBlob_2, isBoolean_1, isCanvas_2, isColor_1, isComment_1, isCp_3, isDate_8, isDesktopDevice_1, isDimension_1, isDom_5, isEmail_1, isEmpty_2, isEvent_1, isFocused_1, isFunction_11, isHostname_1, isInside_1, isInt_2, isIP_2, isIterable_5, isMobile_2, isMobileDevice_2, isNull_4, isNumber_10, isObject_18, isPercent_1, isPrimitive_1, isPromise_1, isPropSize_1, isSame_3, isSQLDate_1, isString_27, isSymbol_2, isTabletDevice_3, isURL_1, isValidDimension_2, isValidName_1, isValue_2, isVue_1, iterate_12, lightenDarkenHex_1, link_2, log_21, makeReactive_1, map_1, md5_4, money_1, move_1, multiorder_1, nl2br_1, numProperties_8, objectToFormData_2, order_1, outerHeight_1, outerWidth_1, percent_1, pickValue_1, post_2, postOut_1, printf_1, quotes2html_1, randomInt_2, randomString_1, removeAccents_4, removeEmpty_1, removeExtraSpaces_1, removeHtmlComments_2, removePrivateProp_2, removeTrailingChars_1, repeat_1, replaceAll_8, replaceSelection_1, resize_3, rgb2hex_1, riterate_1, roundDecimal_1, sanitize_1, search_6, selectElementText_1, selector_3, setCookie_1, setCssVar_1, setNavigationVars_2, setProp_1, setProperty_1, shorten_2, shortenObj_1, shuffle_1, simpleHash_2, simpleHash1_2, simpleHash2_2, chrono_1, string2ArrayBuffer_1, submit_2, substr_16, sum_1, timestamp_1, toCSV_1, toggleFullScreen_1, translate_1, treatAjaxArguments_3, trim_2, uniqString_1, unique_2, upload_1, warning_2) {
|
|
9755
9757
|
"use strict";
|
|
9756
9758
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9757
9759
|
exports.fn = void 0;
|
|
@@ -9919,7 +9921,7 @@
|
|
|
9919
9921
|
iterate: iterate_12.iterate,
|
|
9920
9922
|
lightenDarkenHex: lightenDarkenHex_1.lightenDarkenHex,
|
|
9921
9923
|
link: link_2.link,
|
|
9922
|
-
log:
|
|
9924
|
+
log: log_21.log,
|
|
9923
9925
|
makeReactive: makeReactive_1.makeReactive,
|
|
9924
9926
|
map: map_1.map,
|
|
9925
9927
|
md5: md5_4.md5,
|
|
@@ -14,6 +14,7 @@ import { substr } from "../string/substr";
|
|
|
14
14
|
* @returns {Number} The timestamp (in ms)
|
|
15
15
|
*/
|
|
16
16
|
const _addLoader = function (requestId, prom, source) {
|
|
17
|
+
console.log('_addLoader', requestId);
|
|
17
18
|
/** @var {Number} tst Current timestamp */
|
|
18
19
|
let tst = new Date().getTime();
|
|
19
20
|
/** @var {String} url The original URL (part of requestId before : and md5) */
|
package/dist/fn/ajax/ajax.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { isObject } from
|
|
2
|
-
import { replaceAll } from
|
|
3
|
-
import { getRequestId } from
|
|
4
|
-
import { getLoader } from
|
|
5
|
-
import { extend } from
|
|
6
|
-
import { numProperties } from
|
|
7
|
-
import { _deleteLoader } from
|
|
8
|
-
import { defaultEndLoadingFunction } from
|
|
9
|
-
import { isFunction } from
|
|
10
|
-
import { defaultAjaxErrorFunction } from
|
|
11
|
-
import { defaultAjaxAbortFunction } from
|
|
12
|
-
import { _addLoader } from
|
|
13
|
-
import { defaultStartLoadingFunction } from
|
|
1
|
+
import { isObject } from "../type/isObject";
|
|
2
|
+
import { replaceAll } from "../string/replaceAll";
|
|
3
|
+
import { getRequestId } from "./getRequestId";
|
|
4
|
+
import { getLoader } from "./getLoader";
|
|
5
|
+
import { extend } from "../object/extend";
|
|
6
|
+
import { numProperties } from "../object/numProperties";
|
|
7
|
+
import { _deleteLoader } from "./_deleteLoader";
|
|
8
|
+
import { defaultEndLoadingFunction } from "../default/defaultEndLoadingFunction";
|
|
9
|
+
import { isFunction } from "../type/isFunction";
|
|
10
|
+
import { defaultAjaxErrorFunction } from "../default/defaultAjaxErrorFunction";
|
|
11
|
+
import { defaultAjaxAbortFunction } from "../default/defaultAjaxAbortFunction";
|
|
12
|
+
import { _addLoader } from "./_addLoader";
|
|
13
|
+
import { defaultStartLoadingFunction } from "../default/defaultStartLoadingFunction";
|
|
14
14
|
/**
|
|
15
15
|
* Creates an XHR object and returns the Promise.
|
|
16
16
|
*
|
|
@@ -68,7 +68,7 @@ import { defaultStartLoadingFunction } from '../default/defaultStartLoadingFunct
|
|
|
68
68
|
* @returns {Promise} The Promise created by the generated XHR.
|
|
69
69
|
*/
|
|
70
70
|
const ajax = function (url, datatype, data, success, failure, abort) {
|
|
71
|
-
if (arguments.length === 1 && url && typeof url ===
|
|
71
|
+
if (arguments.length === 1 && url && typeof url === "object" && url.url) {
|
|
72
72
|
if (url.abort) {
|
|
73
73
|
abort = url.abort;
|
|
74
74
|
}
|
|
@@ -89,13 +89,13 @@ const ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
89
89
|
if (!url) {
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
if (url && typeof url ===
|
|
93
|
-
if (url.indexOf(
|
|
92
|
+
if (url && typeof url === "string") {
|
|
93
|
+
if (url.indexOf("://") === -1) {
|
|
94
94
|
// Prevent protocol mismatch by Axios
|
|
95
|
-
url = replaceAll(
|
|
95
|
+
url = replaceAll("//", "/", url);
|
|
96
96
|
}
|
|
97
97
|
if (!datatype) {
|
|
98
|
-
datatype =
|
|
98
|
+
datatype = "json";
|
|
99
99
|
}
|
|
100
100
|
let requestId = getRequestId(url, data, datatype);
|
|
101
101
|
let loaderObj = getLoader(requestId);
|
|
@@ -112,10 +112,10 @@ const ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
112
112
|
responseType: datatype,
|
|
113
113
|
cancelToken: source.token,
|
|
114
114
|
};
|
|
115
|
-
if (datatype ===
|
|
115
|
+
if (datatype === "text") {
|
|
116
116
|
options.headers = {
|
|
117
|
-
accept:
|
|
118
|
-
|
|
117
|
+
accept: "text/javascript",
|
|
118
|
+
"Content-Type": "text/javascript",
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
let args = [url];
|
|
@@ -123,9 +123,10 @@ const ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
123
123
|
args.push(data);
|
|
124
124
|
}
|
|
125
125
|
args.push(options);
|
|
126
|
-
const axiosMethod = args.length === 2 ?
|
|
127
|
-
let loader = axios[axiosMethod]
|
|
128
|
-
.
|
|
126
|
+
const axiosMethod = args.length === 2 ? "get" : "post";
|
|
127
|
+
let loader = axios[axiosMethod]
|
|
128
|
+
.apply(null, args)
|
|
129
|
+
.then((res) => {
|
|
129
130
|
_deleteLoader(requestId, res);
|
|
130
131
|
defaultEndLoadingFunction(url, tst, data, res);
|
|
131
132
|
switch (res.status) {
|
|
@@ -158,7 +159,7 @@ const ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
158
159
|
ok = failure(err.request, err);
|
|
159
160
|
}
|
|
160
161
|
if (ok) {
|
|
161
|
-
defaultAjaxErrorFunction(err.request, err.response ? err.response.data :
|
|
162
|
+
defaultAjaxErrorFunction(err.request, err.response ? err.response.data : "", err.response ? err.response.status : err);
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultAjaxErrorFunction: (jqXHR: any, textStatus?: string, errorThrown?: object) =>
|
|
1
|
+
declare const defaultAjaxErrorFunction: (jqXHR: any, textStatus?: string, errorThrown?: object) => void;
|
|
2
2
|
export { defaultAjaxErrorFunction };
|
package/dist/fn.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ declare const fn: {
|
|
|
53
53
|
daysInMonth: (v: any) => number | false;
|
|
54
54
|
deepPath: (arr: any[], filter: object, deepProperty: string, res?: any[]) => false | any[];
|
|
55
55
|
defaultAjaxAbortFunction: (message: string, url?: string) => void;
|
|
56
|
-
defaultAjaxErrorFunction: (jqXHR: any, textStatus?: string, errorThrown?: object) =>
|
|
56
|
+
defaultAjaxErrorFunction: (jqXHR: any, textStatus?: string, errorThrown?: object) => void;
|
|
57
57
|
defaultAlertFunction: (msg: string, title?: string) => void;
|
|
58
58
|
defaultConfirmFunction: (text: string, yesFn: () => any, noFn: () => any) => void;
|
|
59
59
|
defaultEndLoadingFunction: (url: string, timestamp: number, data?: object, res?: object) => boolean;
|