@bbn/bbn 1.0.26 → 1.0.27
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 +24 -24
- package/dist/fn/_addLoader.js +6 -3
- package/dist/fn/_compareValues.js +14 -11
- package/dist/fn/_deleteLoader.js +10 -7
- package/dist/fn/abort.js +6 -3
- package/dist/fn/abortURL.js +7 -4
- package/dist/fn/addColors.js +8 -5
- package/dist/fn/addInputs.js +6 -3
- package/dist/fn/addStyle.js +8 -5
- package/dist/fn/adjustHeight.js +8 -5
- package/dist/fn/adjustSize.js +8 -5
- package/dist/fn/adjustWidth.js +8 -5
- package/dist/fn/ajax.js +34 -31
- package/dist/fn/analyzeFunction.js +6 -3
- package/dist/fn/animateCss.js +4 -1
- package/dist/fn/arrayBuffer2String.js +4 -1
- package/dist/fn/arrayFromProp.js +8 -5
- package/dist/fn/autoExtend.js +7 -4
- package/dist/fn/baseName.js +9 -6
- package/dist/fn/br2nl.js +6 -3
- package/dist/fn/calendar.d.ts +1 -1
- package/dist/fn/calendar.js +20 -11
- package/dist/fn/callback.js +19 -16
- package/dist/fn/camelToCss.js +4 -1
- package/dist/fn/camelize.js +4 -1
- package/dist/fn/canvasToImage.js +4 -1
- package/dist/fn/center.js +4 -1
- package/dist/fn/checkProps.js +6 -3
- package/dist/fn/checkPropsDetails.js +12 -9
- package/dist/fn/checkPropsOrDie.js +6 -3
- package/dist/fn/checkType.js +19 -16
- package/dist/fn/chrono.js +7 -3
- package/dist/fn/circularReplacer.js +10 -7
- package/dist/fn/clone.js +10 -7
- package/dist/fn/colorToHex.js +4 -1
- package/dist/fn/compare.js +21 -18
- package/dist/fn/compareConditions.js +13 -10
- package/dist/fn/copy.js +7 -4
- package/dist/fn/correctCase.js +4 -1
- package/dist/fn/count.js +6 -3
- package/dist/fn/crc32.js +4 -1
- package/dist/fn/createObject.js +6 -3
- package/dist/fn/cssExists.js +6 -3
- package/dist/fn/date.js +11 -8
- package/dist/fn/dateSQL.d.ts +1 -1
- package/dist/fn/dateSQL.js +11 -4
- package/dist/fn/daysInMonth.d.ts +1 -1
- package/dist/fn/daysInMonth.js +11 -4
- package/dist/fn/deepPath.js +10 -7
- package/dist/fn/defaultAjaxAbortFunction.js +6 -3
- package/dist/fn/defaultAjaxErrorFunction.js +4 -1
- package/dist/fn/defaultAlertFunction.js +4 -1
- package/dist/fn/defaultConfirmFunction.js +7 -4
- package/dist/fn/defaultEndLoadingFunction.js +4 -1
- package/dist/fn/defaultErrorFunction.js +6 -3
- package/dist/fn/defaultHistoryFunction.js +4 -1
- package/dist/fn/defaultLinkFunction.js +4 -1
- package/dist/fn/defaultPostLinkFunction.js +4 -1
- package/dist/fn/defaultPreLinkFunction.js +4 -1
- package/dist/fn/defaultResizeFunction.js +4 -1
- package/dist/fn/defaultStartLoadingFunction.js +4 -1
- package/dist/fn/deleteProp.js +7 -4
- package/dist/fn/diffObj.js +19 -16
- package/dist/fn/dirName.js +10 -7
- package/dist/fn/download.js +18 -15
- package/dist/fn/downloadContent.js +12 -9
- package/dist/fn/each.js +10 -7
- package/dist/fn/eraseCookie.js +4 -1
- package/dist/fn/error.js +6 -3
- package/dist/fn/escapeDquotes.js +6 -3
- package/dist/fn/escapeRegExp.js +4 -1
- package/dist/fn/escapeSquotes.js +6 -3
- package/dist/fn/escapeTicks.js +6 -3
- package/dist/fn/escapeUrl.js +11 -8
- package/dist/fn/extend.js +16 -13
- package/dist/fn/extendOut.js +7 -4
- package/dist/fn/fdate.js +18 -11
- package/dist/fn/fdatetime.js +16 -9
- package/dist/fn/fieldValue.js +4 -1
- package/dist/fn/fileExt.js +6 -3
- package/dist/fn/filter.js +15 -12
- package/dist/fn/filterToConditions.js +11 -8
- package/dist/fn/findAll.js +10 -7
- package/dist/fn/fori.js +9 -6
- package/dist/fn/forir.js +9 -6
- package/dist/fn/format.js +6 -3
- package/dist/fn/formatBytes.js +4 -1
- package/dist/fn/formatDate.d.ts +1 -1
- package/dist/fn/formatDate.js +9 -2
- package/dist/fn/formatSize.js +8 -5
- package/dist/fn/formdata.js +14 -11
- package/dist/fn/fromXml.js +4 -1
- package/dist/fn/ftime.js +18 -11
- package/dist/fn/getAllTags.js +6 -3
- package/dist/fn/getAncestors.js +4 -1
- package/dist/fn/getAttributes.js +6 -3
- package/dist/fn/getBrowserName.js +4 -1
- package/dist/fn/getBrowserVersion.js +4 -1
- package/dist/fn/getCookie.js +4 -1
- package/dist/fn/getCssVar.js +4 -1
- package/dist/fn/getDay.js +6 -3
- package/dist/fn/getDeviceType.js +4 -1
- package/dist/fn/getEventData.js +10 -7
- package/dist/fn/getField.js +6 -3
- package/dist/fn/getFieldValues.js +10 -7
- package/dist/fn/getHTMLOfSelection.js +7 -4
- package/dist/fn/getHtml.js +6 -3
- package/dist/fn/getLoader.js +6 -3
- package/dist/fn/getPath.js +6 -3
- package/dist/fn/getProp.js +7 -4
- package/dist/fn/getProperty.js +4 -1
- package/dist/fn/getRequestId.js +8 -5
- package/dist/fn/getRow.js +6 -3
- package/dist/fn/getScrollBarSize.js +4 -1
- package/dist/fn/getText.js +4 -1
- package/dist/fn/getTimeoff.js +4 -1
- package/dist/fn/happy.js +6 -3
- package/dist/fn/hash.js +14 -11
- package/dist/fn/hex2rgb.js +4 -1
- package/dist/fn/history.js +4 -1
- package/dist/fn/html2text.js +4 -1
- package/dist/fn/imageToCanvas.js +4 -1
- package/dist/fn/imgToBase64.js +6 -3
- package/dist/fn/info.js +6 -3
- package/dist/fn/init.js +58 -31
- package/dist/fn/isActiveInterface.js +4 -1
- package/dist/fn/isArray.js +4 -1
- package/dist/fn/isBlob.js +4 -1
- package/dist/fn/isBoolean.js +4 -1
- package/dist/fn/isCanvas.js +4 -1
- package/dist/fn/isColor.js +6 -3
- package/dist/fn/isComment.js +4 -1
- package/dist/fn/isCp.js +6 -3
- package/dist/fn/isDate.js +4 -1
- package/dist/fn/isDesktopDevice.js +4 -1
- package/dist/fn/isDimension.js +6 -3
- package/dist/fn/isDom.js +4 -1
- package/dist/fn/isEmail.js +6 -3
- package/dist/fn/isEmpty.js +8 -5
- package/dist/fn/isEvent.js +4 -1
- package/dist/fn/isFocused.js +4 -1
- package/dist/fn/isFunction.js +4 -1
- package/dist/fn/isHostname.js +8 -5
- package/dist/fn/isIP.js +6 -3
- package/dist/fn/isInside.js +10 -7
- package/dist/fn/isInt.js +4 -1
- package/dist/fn/isIterable.js +4 -1
- package/dist/fn/isMobile.js +7 -4
- package/dist/fn/isMobileDevice.js +4 -1
- package/dist/fn/isNull.js +4 -1
- package/dist/fn/isNumber.js +4 -1
- package/dist/fn/isObject.js +4 -1
- package/dist/fn/isPercent.js +4 -1
- package/dist/fn/isPrimitive.js +4 -1
- package/dist/fn/isPromise.js +4 -1
- package/dist/fn/isPropSize.js +6 -3
- package/dist/fn/isSQLDate.js +4 -1
- package/dist/fn/isSame.js +8 -5
- package/dist/fn/isString.js +4 -1
- package/dist/fn/isSymbol.js +4 -1
- package/dist/fn/isTabletDevice.js +4 -1
- package/dist/fn/isURL.js +4 -1
- package/dist/fn/isValidDimension.js +7 -4
- package/dist/fn/isValidName.js +6 -3
- package/dist/fn/isValue.js +6 -3
- package/dist/fn/isVue.js +4 -1
- package/dist/fn/iterate.js +8 -5
- package/dist/fn/lightenDarkenHex.js +4 -1
- package/dist/fn/link.js +22 -19
- package/dist/fn/log.js +6 -3
- package/dist/fn/makeReactive.js +31 -28
- package/dist/fn/map.js +6 -3
- package/dist/fn/md5.js +4 -1
- package/dist/fn/money.js +6 -3
- package/dist/fn/move.js +4 -1
- package/dist/fn/multiorder.js +6 -3
- package/dist/fn/nl2br.js +6 -3
- package/dist/fn/numProperties.js +4 -1
- package/dist/fn/objectToFormData.js +15 -12
- package/dist/fn/order.js +6 -3
- package/dist/fn/outerHeight.js +6 -3
- package/dist/fn/outerWidth.js +6 -3
- package/dist/fn/percent.js +4 -1
- package/dist/fn/pickValue.js +4 -1
- package/dist/fn/post.js +10 -7
- package/dist/fn/postOut.js +8 -5
- package/dist/fn/printf.js +4 -1
- package/dist/fn/quotes2html.js +7 -4
- package/dist/fn/randomInt.js +4 -1
- package/dist/fn/randomString.js +7 -4
- package/dist/fn/removeAccents.js +8 -5
- package/dist/fn/removeEmpty.js +11 -8
- package/dist/fn/removeExtraSpaces.js +4 -1
- package/dist/fn/removeHtmlComments.js +6 -3
- package/dist/fn/removePrivateProp.js +6 -3
- package/dist/fn/removeTrailingChars.js +9 -6
- package/dist/fn/repeat.js +4 -1
- package/dist/fn/replaceAll.js +7 -4
- package/dist/fn/replaceSelection.js +4 -1
- package/dist/fn/resize.js +10 -7
- package/dist/fn/rgb2hex.js +4 -1
- package/dist/fn/riterate.js +6 -3
- package/dist/fn/roundDecimal.js +4 -1
- package/dist/fn/sanitize.js +8 -5
- package/dist/fn/search.js +18 -15
- package/dist/fn/selectElementText.js +4 -1
- package/dist/fn/selector.js +4 -1
- package/dist/fn/setCookie.js +4 -1
- package/dist/fn/setCssVar.js +4 -1
- package/dist/fn/setNavigationVars.js +13 -10
- package/dist/fn/setProp.js +4 -1
- package/dist/fn/setProperty.js +6 -3
- package/dist/fn/shorten.js +8 -5
- package/dist/fn/shortenObj.js +12 -9
- package/dist/fn/shuffle.js +4 -1
- package/dist/fn/simpleHash.js +8 -5
- package/dist/fn/simpleHash1.js +4 -1
- package/dist/fn/simpleHash2.js +4 -1
- package/dist/fn/stat.js +4 -1
- package/dist/fn/string2ArrayBuffer.js +4 -1
- package/dist/fn/submit.js +9 -6
- package/dist/fn/substr.js +10 -7
- package/dist/fn/sum.js +7 -4
- package/dist/fn/timestamp.js +4 -1
- package/dist/fn/toCSV.js +11 -8
- package/dist/fn/toggleFullScreen.js +6 -3
- package/dist/fn/translate.js +6 -3
- package/dist/fn/treatAjaxArguments.js +13 -10
- package/dist/fn/trim.js +7 -4
- package/dist/fn/uniqString.js +10 -7
- package/dist/fn/unique.js +4 -1
- package/dist/fn/upload.js +33 -6
- package/dist/fn/warning.js +6 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +471 -459
- package/package.json +1 -1
package/dist/fn/ajax.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ajax = void 0;
|
|
4
|
+
const isObject_1 = require("./isObject");
|
|
5
|
+
const replaceAll_1 = require("./replaceAll");
|
|
6
|
+
const getRequestId_1 = require("./getRequestId");
|
|
7
|
+
const getLoader_1 = require("./getLoader");
|
|
8
|
+
const extend_1 = require("./extend");
|
|
9
|
+
const numProperties_1 = require("./numProperties");
|
|
10
|
+
const _deleteLoader_1 = require("./_deleteLoader");
|
|
11
|
+
const defaultEndLoadingFunction_1 = require("./defaultEndLoadingFunction");
|
|
12
|
+
const isFunction_1 = require("./isFunction");
|
|
13
|
+
const defaultAjaxErrorFunction_1 = require("./defaultAjaxErrorFunction");
|
|
14
|
+
const defaultAjaxAbortFunction_1 = require("./defaultAjaxAbortFunction");
|
|
15
|
+
const _addLoader_1 = require("./_addLoader");
|
|
16
|
+
const defaultStartLoadingFunction_1 = require("./defaultStartLoadingFunction");
|
|
14
17
|
const ajax = function (url, datatype, data, success, failure, abort) {
|
|
15
18
|
if (arguments.length === 1 && url && typeof url === 'object' && url.url) {
|
|
16
19
|
if (url.abort) {
|
|
@@ -36,19 +39,19 @@ const ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
36
39
|
if (url && typeof url === 'string') {
|
|
37
40
|
if (url.indexOf('://') === -1) {
|
|
38
41
|
// Prevent protocol mismatch by Axios
|
|
39
|
-
url = replaceAll('//', '/', url);
|
|
42
|
+
url = (0, replaceAll_1.replaceAll)('//', '/', url);
|
|
40
43
|
}
|
|
41
44
|
if (!datatype) {
|
|
42
45
|
datatype = 'json';
|
|
43
46
|
}
|
|
44
|
-
let requestId = getRequestId(url, data, datatype);
|
|
45
|
-
let loaderObj = getLoader(requestId);
|
|
47
|
+
let requestId = (0, getRequestId_1.getRequestId)(url, data, datatype);
|
|
48
|
+
let loaderObj = (0, getLoader_1.getLoader)(requestId);
|
|
46
49
|
//log("IN AJAX", loaderObj? loaderObj.loader : "NO LOADER")
|
|
47
50
|
if (loaderObj && loaderObj.loader) {
|
|
48
51
|
return loaderObj.loader;
|
|
49
52
|
}
|
|
50
53
|
if (bbn.env.token) {
|
|
51
|
-
extend(data || {}, { _bbn_token: bbn.env.token });
|
|
54
|
+
(0, extend_1.extend)(data || {}, { _bbn_token: bbn.env.token });
|
|
52
55
|
}
|
|
53
56
|
let cancelToken = axios.CancelToken;
|
|
54
57
|
let source = cancelToken.source();
|
|
@@ -63,52 +66,52 @@ const ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
63
66
|
};
|
|
64
67
|
}
|
|
65
68
|
let args = [url];
|
|
66
|
-
if (isObject(data) && numProperties(data) > 0) {
|
|
69
|
+
if ((0, isObject_1.isObject)(data) && (0, numProperties_1.numProperties)(data) > 0) {
|
|
67
70
|
args.push(data);
|
|
68
71
|
}
|
|
69
72
|
args.push(options);
|
|
70
73
|
let loader = axios[args.length === 2 ? 'get' : 'post']
|
|
71
74
|
.apply(axios, args)
|
|
72
75
|
.then((res) => {
|
|
73
|
-
_deleteLoader(requestId, res);
|
|
74
|
-
defaultEndLoadingFunction(url, tst, data, res);
|
|
76
|
+
(0, _deleteLoader_1._deleteLoader)(requestId, res);
|
|
77
|
+
(0, defaultEndLoadingFunction_1.defaultEndLoadingFunction)(url, tst, data, res);
|
|
75
78
|
switch (res.status) {
|
|
76
79
|
case 200:
|
|
77
|
-
if (isFunction(success)) {
|
|
80
|
+
if ((0, isFunction_1.isFunction)(success)) {
|
|
78
81
|
success(res.data, res.headers);
|
|
79
82
|
}
|
|
80
83
|
break;
|
|
81
84
|
default:
|
|
82
|
-
defaultAjaxErrorFunction(loader, res);
|
|
85
|
+
(0, defaultAjaxErrorFunction_1.defaultAjaxErrorFunction)(loader, res);
|
|
83
86
|
}
|
|
84
87
|
return res;
|
|
85
88
|
})
|
|
86
89
|
.catch((err) => {
|
|
87
90
|
let isAbort = axios.isCancel(err);
|
|
88
|
-
_deleteLoader(requestId, err.message || err.response.data, isAbort);
|
|
89
|
-
defaultEndLoadingFunction(url, tst, data, err);
|
|
91
|
+
(0, _deleteLoader_1._deleteLoader)(requestId, err.message || err.response.data, isAbort);
|
|
92
|
+
(0, defaultEndLoadingFunction_1.defaultEndLoadingFunction)(url, tst, data, err);
|
|
90
93
|
if (isAbort) {
|
|
91
94
|
let ok = 1;
|
|
92
|
-
if (isFunction(abort)) {
|
|
95
|
+
if ((0, isFunction_1.isFunction)(abort)) {
|
|
93
96
|
ok = abort(err.message, url);
|
|
94
97
|
}
|
|
95
98
|
if (ok) {
|
|
96
|
-
defaultAjaxAbortFunction(err.message, url);
|
|
99
|
+
(0, defaultAjaxAbortFunction_1.defaultAjaxAbortFunction)(err.message, url);
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
else {
|
|
100
103
|
let ok = 1;
|
|
101
|
-
if (isFunction(failure)) {
|
|
104
|
+
if ((0, isFunction_1.isFunction)(failure)) {
|
|
102
105
|
ok = failure(err.request, err);
|
|
103
106
|
}
|
|
104
107
|
if (ok) {
|
|
105
|
-
defaultAjaxErrorFunction(err.request, err.response ? err.response.data : '', err.response ? err.response.status : err);
|
|
108
|
+
(0, defaultAjaxErrorFunction_1.defaultAjaxErrorFunction)(err.request, err.response ? err.response.data : '', err.response ? err.response.status : err);
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
});
|
|
109
|
-
let tst = _addLoader(requestId, loader, source);
|
|
110
|
-
defaultStartLoadingFunction(url, tst, data, requestId);
|
|
112
|
+
let tst = (0, _addLoader_1._addLoader)(requestId, loader, source);
|
|
113
|
+
(0, defaultStartLoadingFunction_1.defaultStartLoadingFunction)(url, tst, data, requestId);
|
|
111
114
|
return loader;
|
|
112
115
|
}
|
|
113
116
|
};
|
|
114
|
-
|
|
117
|
+
exports.ajax = ajax;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.analyzeFunction = void 0;
|
|
4
|
+
const md5_1 = require("./md5");
|
|
2
5
|
const analyzeFunction = function (fn) {
|
|
3
6
|
const functionString = fn.toString();
|
|
4
7
|
let all = functionString.split('');
|
|
@@ -126,7 +129,7 @@ const analyzeFunction = function (fn) {
|
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
131
|
const argString = args.map((arg) => arg.name + (arg.default ? ' = ' + arg.default : '')).join(', ');
|
|
129
|
-
const hash = md5(body + (name ? '-' + name : '') + (argString ? '-' + argString : ''));
|
|
132
|
+
const hash = (0, md5_1.md5)(body + (name ? '-' + name : '') + (argString ? '-' + argString : ''));
|
|
130
133
|
return {
|
|
131
134
|
body,
|
|
132
135
|
args,
|
|
@@ -138,4 +141,4 @@ const analyzeFunction = function (fn) {
|
|
|
138
141
|
hash,
|
|
139
142
|
};
|
|
140
143
|
};
|
|
141
|
-
|
|
144
|
+
exports.analyzeFunction = analyzeFunction;
|
package/dist/fn/animateCss.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.animateCss = void 0;
|
|
1
4
|
const animateCss = function (ele, animationName, callback) {
|
|
2
5
|
let animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
|
|
3
6
|
/*$(ele).addClass('animated ' + animationName).one(animationEnd, function(){
|
|
@@ -17,4 +20,4 @@ const animateCss = function (ele, animationName, callback) {
|
|
|
17
20
|
this.classList.remove(animationName);
|
|
18
21
|
});
|
|
19
22
|
};
|
|
20
|
-
|
|
23
|
+
exports.animateCss = animateCss;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayBuffer2String = void 0;
|
|
1
4
|
const arrayBuffer2String = function (buf) {
|
|
2
5
|
return String.fromCharCode.apply(null, new Uint16Array(buf));
|
|
3
6
|
};
|
|
4
|
-
|
|
7
|
+
exports.arrayBuffer2String = arrayBuffer2String;
|
package/dist/fn/arrayFromProp.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayFromProp = void 0;
|
|
4
|
+
const each_1 = require("./each");
|
|
5
|
+
const getProperty_1 = require("./getProperty");
|
|
3
6
|
const arrayFromProp = function (arr, prop) {
|
|
4
7
|
let r = [];
|
|
5
|
-
each(arr, (a, i) => {
|
|
6
|
-
r.push(getProperty(a, prop));
|
|
8
|
+
(0, each_1.each)(arr, (a, i) => {
|
|
9
|
+
r.push((0, getProperty_1.getProperty)(a, prop));
|
|
7
10
|
});
|
|
8
11
|
return r;
|
|
9
12
|
};
|
|
10
|
-
|
|
13
|
+
exports.arrayFromProp = arrayFromProp;
|
package/dist/fn/autoExtend.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.autoExtend = void 0;
|
|
4
|
+
const extend_1 = require("./extend");
|
|
2
5
|
const autoExtend = function (namespace, obj) {
|
|
3
6
|
if (!bbn[namespace]) {
|
|
4
7
|
bbn[namespace] = {};
|
|
5
8
|
//$.extend(true, bbn[namespace], obj);
|
|
6
|
-
extend(bbn[namespace], obj);
|
|
9
|
+
(0, extend_1.extend)(bbn[namespace], obj);
|
|
7
10
|
}
|
|
8
11
|
else {
|
|
9
12
|
// $.extend(true, bbn[namespace], obj);
|
|
10
|
-
extend(bbn[namespace], obj);
|
|
13
|
+
(0, extend_1.extend)(bbn[namespace], obj);
|
|
11
14
|
}
|
|
12
15
|
};
|
|
13
|
-
|
|
16
|
+
exports.autoExtend = autoExtend;
|
package/dist/fn/baseName.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.baseName = void 0;
|
|
4
|
+
const isString_1 = require("./isString");
|
|
5
|
+
const substr_1 = require("./substr");
|
|
3
6
|
const baseName = function (path, suffix) {
|
|
4
|
-
if (path && isString(path)) {
|
|
7
|
+
if (path && (0, isString_1.isString)(path)) {
|
|
5
8
|
let bits = path.split('/');
|
|
6
9
|
let res = bits.pop();
|
|
7
10
|
if (!suffix) {
|
|
8
11
|
return res;
|
|
9
12
|
}
|
|
10
13
|
let len = suffix.length;
|
|
11
|
-
if (res && substr(res, -len) === suffix) {
|
|
12
|
-
return substr(res, 0, res.length - len);
|
|
14
|
+
if (res && (0, substr_1.substr)(res, -len) === suffix) {
|
|
15
|
+
return (0, substr_1.substr)(res, 0, res.length - len);
|
|
13
16
|
}
|
|
14
17
|
}
|
|
15
18
|
return '';
|
|
16
19
|
};
|
|
17
|
-
|
|
20
|
+
exports.baseName = baseName;
|
package/dist/fn/br2nl.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.br2nl = void 0;
|
|
4
|
+
const replaceAll_1 = require("./replaceAll");
|
|
2
5
|
const br2nl = function (st) {
|
|
3
|
-
return replaceAll('<br />', '\n', replaceAll('<br/>', '\n', replaceAll('<br>', '\n', st)));
|
|
6
|
+
return (0, replaceAll_1.replaceAll)('<br />', '\n', (0, replaceAll_1.replaceAll)('<br/>', '\n', (0, replaceAll_1.replaceAll)('<br>', '\n', st)));
|
|
4
7
|
};
|
|
5
|
-
|
|
8
|
+
exports.br2nl = br2nl;
|
package/dist/fn/calendar.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const calendar: (d
|
|
1
|
+
declare const calendar: (d?: Date | number | string, wrong_result?: string) => any;
|
|
2
2
|
export { calendar };
|
package/dist/fn/calendar.js
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.calendar = void 0;
|
|
7
|
+
const fdate_1 = require("./fdate");
|
|
8
|
+
const date_1 = require("./date");
|
|
9
|
+
const isDate_1 = require("./isDate");
|
|
10
|
+
const isString_1 = require("./isString");
|
|
11
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
12
|
+
const calendar_1 = __importDefault(require("dayjs/plugin/calendar"));
|
|
13
|
+
dayjs_1.default.extend(calendar_1.default);
|
|
5
14
|
const calendar = function (d, wrong_result) {
|
|
6
|
-
if (undefined ===
|
|
7
|
-
return fdate(d, wrong_result);
|
|
15
|
+
if (undefined === dayjs_1.default) {
|
|
16
|
+
return (0, fdate_1.fdate)(d, wrong_result);
|
|
8
17
|
}
|
|
9
|
-
let r = date(d);
|
|
10
|
-
if (!isDate(r)) {
|
|
11
|
-
return wrong_result && isString(wrong_result) ? wrong_result : '';
|
|
18
|
+
let r = (0, date_1.date)(d);
|
|
19
|
+
if (!(0, isDate_1.isDate)(r)) {
|
|
20
|
+
return wrong_result && (0, isString_1.isString)(wrong_result) ? wrong_result : '';
|
|
12
21
|
}
|
|
13
|
-
return
|
|
22
|
+
return (0, dayjs_1.default)(r).calendar(null, {
|
|
14
23
|
sameDay: '[' + bbn._('Today') + ']',
|
|
15
24
|
nextDay: '[' + bbn._('Tomorrow') + ']',
|
|
16
25
|
nextWeek: 'ddd D',
|
|
@@ -19,4 +28,4 @@ const calendar = function (d, wrong_result) {
|
|
|
19
28
|
sameElse: 'L',
|
|
20
29
|
});
|
|
21
30
|
};
|
|
22
|
-
|
|
31
|
+
exports.calendar = calendar;
|
package/dist/fn/callback.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.callback = void 0;
|
|
4
|
+
const error_1 = require("./error");
|
|
5
|
+
const defaultLinkFunction_1 = require("./defaultLinkFunction");
|
|
6
|
+
const isFunction_1 = require("./isFunction");
|
|
7
|
+
const log_1 = require("./log");
|
|
8
|
+
const defaultPostLinkFunction_1 = require("./defaultPostLinkFunction");
|
|
9
|
+
const defaultAlertFunction_1 = require("./defaultAlertFunction");
|
|
7
10
|
const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
|
|
8
11
|
let tmp = false;
|
|
9
12
|
if (res) {
|
|
@@ -17,7 +20,7 @@ const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
|
|
|
17
20
|
eval(res.prescript);
|
|
18
21
|
}
|
|
19
22
|
catch (e) {
|
|
20
|
-
error(e.message || '');
|
|
23
|
+
(0, error_1.error)(e.message || '');
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
26
|
if (isObj && res.url === undefined) {
|
|
@@ -28,7 +31,7 @@ const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
|
|
|
28
31
|
tmp = fn(res, ele);
|
|
29
32
|
}
|
|
30
33
|
else {
|
|
31
|
-
tmp = defaultLinkFunction(res, ele);
|
|
34
|
+
tmp = (0, defaultLinkFunction_1.defaultLinkFunction)(res, ele);
|
|
32
35
|
}
|
|
33
36
|
if (ele && isObj && (res.content !== undefined)) {
|
|
34
37
|
if ('value' in ele) {
|
|
@@ -47,13 +50,13 @@ const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
|
|
|
47
50
|
let r = null;
|
|
48
51
|
try {
|
|
49
52
|
r = eval(res.script);
|
|
50
|
-
if (isFunction(r)) {
|
|
53
|
+
if ((0, isFunction_1.isFunction)(r)) {
|
|
51
54
|
r = r(data, ele);
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
catch (e) {
|
|
55
|
-
log(e, res);
|
|
56
|
-
error(isFunction(e.getMessage) ? e.getMessage() : null);
|
|
58
|
+
(0, log_1.log)(e, res);
|
|
59
|
+
(0, error_1.error)((0, isFunction_1.isFunction)(e.getMessage) ? e.getMessage() : null);
|
|
57
60
|
}
|
|
58
61
|
return r;
|
|
59
62
|
})(res.data ? res.data : {}, ele ? ele : false);
|
|
@@ -63,20 +66,20 @@ const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
|
|
|
63
66
|
if (tmp && fn2) {
|
|
64
67
|
fn2(res);
|
|
65
68
|
}
|
|
66
|
-
else if (isObj && defaultPostLinkFunction) {
|
|
67
|
-
defaultPostLinkFunction(res, ele);
|
|
69
|
+
else if (isObj && defaultPostLinkFunction_1.defaultPostLinkFunction) {
|
|
70
|
+
(0, defaultPostLinkFunction_1.defaultPostLinkFunction)(res, ele);
|
|
68
71
|
}
|
|
69
72
|
if (tmp && isObj && res.postscript) {
|
|
70
73
|
eval(res.postscript);
|
|
71
74
|
}
|
|
72
75
|
if (isObj && res.error) {
|
|
73
76
|
errTitle = res.errorTitle || bbn.lng.server_response;
|
|
74
|
-
defaultAlertFunction(res.error, errTitle);
|
|
77
|
+
(0, defaultAlertFunction_1.defaultAlertFunction)(res.error, errTitle);
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
else {
|
|
78
|
-
defaultAlertFunction(bbn.lng.errorText, bbn.lng.error);
|
|
81
|
+
(0, defaultAlertFunction_1.defaultAlertFunction)(bbn.lng.errorText, bbn.lng.error);
|
|
79
82
|
}
|
|
80
83
|
return tmp;
|
|
81
84
|
};
|
|
82
|
-
|
|
85
|
+
exports.callback = callback;
|
package/dist/fn/camelToCss.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.camelToCss = void 0;
|
|
1
4
|
const camelToCss = function (str) {
|
|
2
5
|
return str
|
|
3
6
|
.replace(/([A-Z])/g, function (st) {
|
|
@@ -7,4 +10,4 @@ const camelToCss = function (str) {
|
|
|
7
10
|
return st.toLowerCase();
|
|
8
11
|
});
|
|
9
12
|
};
|
|
10
|
-
|
|
13
|
+
exports.camelToCss = camelToCss;
|
package/dist/fn/camelize.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.camelize = void 0;
|
|
1
4
|
const camelize = function (str) {
|
|
2
5
|
return str.replace(/^([A-Z])|[\s-](\w)/g, function (match, p1, p2, offset) {
|
|
3
6
|
if (p2) {
|
|
@@ -6,4 +9,4 @@ const camelize = function (str) {
|
|
|
6
9
|
return p1.toLowerCase();
|
|
7
10
|
});
|
|
8
11
|
};
|
|
9
|
-
|
|
12
|
+
exports.camelize = camelize;
|
package/dist/fn/canvasToImage.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.canvasToImage = void 0;
|
|
1
4
|
const canvasToImage = function (canvas) {
|
|
2
5
|
let img = new Image();
|
|
3
6
|
img.src = canvas.toDataURL('image/png');
|
|
4
7
|
return img;
|
|
5
8
|
};
|
|
6
|
-
|
|
9
|
+
exports.canvasToImage = canvasToImage;
|
package/dist/fn/center.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.center = void 0;
|
|
1
4
|
const center = function (ele) {
|
|
2
5
|
//ele = $(ele);
|
|
3
6
|
let parent = ele.parentNode,
|
|
@@ -21,4 +24,4 @@ const center = function (ele) {
|
|
|
21
24
|
ele.style.left = Math.max(0, (h - ele.offsetWidth) / 2 + parent.scrollLeft) + 'px';
|
|
22
25
|
return ele;
|
|
23
26
|
};
|
|
24
|
-
|
|
27
|
+
exports.center = center;
|
package/dist/fn/checkProps.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkProps = void 0;
|
|
4
|
+
const checkPropsDetails_1 = require("./checkPropsDetails");
|
|
2
5
|
const checkProps = function (obj, props, checkEmpty = false) {
|
|
3
|
-
return checkPropsDetails(obj, props, checkEmpty).result;
|
|
6
|
+
return (0, checkPropsDetails_1.checkPropsDetails)(obj, props, checkEmpty).result;
|
|
4
7
|
};
|
|
5
|
-
|
|
8
|
+
exports.checkProps = checkProps;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkPropsDetails = void 0;
|
|
4
|
+
const isArray_1 = require("./isArray");
|
|
5
|
+
const isObject_1 = require("./isObject");
|
|
6
|
+
const each_1 = require("./each");
|
|
7
|
+
const substr_1 = require("./substr");
|
|
5
8
|
const checkPropsDetails = function (obj, props, checkEmpty = false) {
|
|
6
9
|
let res = {
|
|
7
10
|
error: false,
|
|
@@ -10,15 +13,15 @@ const checkPropsDetails = function (obj, props, checkEmpty = false) {
|
|
|
10
13
|
if (typeof (props) === 'string') {
|
|
11
14
|
props = [props];
|
|
12
15
|
}
|
|
13
|
-
if (!isArray(props)) {
|
|
16
|
+
if (!(0, isArray_1.isArray)(props)) {
|
|
14
17
|
res.error = bbn._('checkProps must receive a string or an array as props argument');
|
|
15
18
|
}
|
|
16
|
-
if (!isObject(obj)) {
|
|
19
|
+
if (!(0, isObject_1.isObject)(obj)) {
|
|
17
20
|
res.error = bbn._('checkProps must receive an object as obj argument');
|
|
18
21
|
}
|
|
19
22
|
if (!res.error) {
|
|
20
23
|
let check;
|
|
21
|
-
each(props, (varName) => {
|
|
24
|
+
(0, each_1.each)(props, (varName) => {
|
|
22
25
|
varName = varName.trim().split(':');
|
|
23
26
|
let type = varName[1] || false;
|
|
24
27
|
varName = varName[0];
|
|
@@ -26,7 +29,7 @@ const checkPropsDetails = function (obj, props, checkEmpty = false) {
|
|
|
26
29
|
res.error = varName + ' ' + bbn._('is not defined');
|
|
27
30
|
}
|
|
28
31
|
else if (type) {
|
|
29
|
-
check = 'is' + substr(type, 0, 1).toUpperCase() + substr(type, 1).toLowerCase();
|
|
32
|
+
check = 'is' + (0, substr_1.substr)(type, 0, 1).toUpperCase() + (0, substr_1.substr)(type, 1).toLowerCase();
|
|
30
33
|
if (bbn.fn[check] === undefined) {
|
|
31
34
|
res.error = type + ' ' + bbn._('is not a valid type');
|
|
32
35
|
}
|
|
@@ -47,4 +50,4 @@ const checkPropsDetails = function (obj, props, checkEmpty = false) {
|
|
|
47
50
|
}
|
|
48
51
|
return res;
|
|
49
52
|
};
|
|
50
|
-
|
|
53
|
+
exports.checkPropsDetails = checkPropsDetails;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkPropsOrDie = void 0;
|
|
4
|
+
const checkPropsDetails_1 = require("./checkPropsDetails");
|
|
2
5
|
const checkPropsOrDie = function (obj, props, checkEmpty = false) {
|
|
3
|
-
let res = checkPropsDetails(obj, props, checkEmpty);
|
|
6
|
+
let res = (0, checkPropsDetails_1.checkPropsDetails)(obj, props, checkEmpty);
|
|
4
7
|
if (res.error) {
|
|
5
8
|
throw new Error(res.error);
|
|
6
9
|
}
|
|
7
10
|
return true;
|
|
8
11
|
};
|
|
9
|
-
|
|
12
|
+
exports.checkPropsOrDie = checkPropsOrDie;
|
package/dist/fn/checkType.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkType = void 0;
|
|
4
|
+
const isArray_1 = require("./isArray");
|
|
5
|
+
const each_1 = require("./each");
|
|
6
|
+
const isFunction_1 = require("./isFunction");
|
|
7
|
+
const isString_1 = require("./isString");
|
|
8
|
+
const correctCase_1 = require("./correctCase");
|
|
9
|
+
const error_1 = require("./error");
|
|
10
|
+
const log_1 = require("./log");
|
|
8
11
|
const checkType = function (value, type, msg, ...logs) {
|
|
9
12
|
let ok = false;
|
|
10
|
-
if (!isArray(type)) {
|
|
13
|
+
if (!(0, isArray_1.isArray)(type)) {
|
|
11
14
|
type = [type];
|
|
12
15
|
}
|
|
13
16
|
const typesList = [];
|
|
14
|
-
each(type, (t) => {
|
|
17
|
+
(0, each_1.each)(type, (t) => {
|
|
15
18
|
var _a;
|
|
16
19
|
if (t === String) {
|
|
17
20
|
t = 'string';
|
|
@@ -31,17 +34,17 @@ const checkType = function (value, type, msg, ...logs) {
|
|
|
31
34
|
else if (t === Function) {
|
|
32
35
|
t = 'function';
|
|
33
36
|
}
|
|
34
|
-
if (isFunction(t)) {
|
|
37
|
+
if ((0, isFunction_1.isFunction)(t)) {
|
|
35
38
|
typesList.push(t.name || ((_a = t.constructor) === null || _a === void 0 ? void 0 : _a.name) || t.toString());
|
|
36
39
|
if (value instanceof t) {
|
|
37
40
|
ok = true;
|
|
38
41
|
return false;
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
|
-
else if (!isString(t) || !isFunction(bbn.fn['is' + correctCase(t)])) {
|
|
42
|
-
error(`The type ${t} is not recognized`);
|
|
44
|
+
else if (!(0, isString_1.isString)(t) || !(0, isFunction_1.isFunction)(bbn.fn['is' + (0, correctCase_1.correctCase)(t)])) {
|
|
45
|
+
(0, error_1.error)(`The type ${t} is not recognized`);
|
|
43
46
|
}
|
|
44
|
-
else if (bbn.fn['is' + correctCase(t)](value)) {
|
|
47
|
+
else if (bbn.fn['is' + (0, correctCase_1.correctCase)(t)](value)) {
|
|
45
48
|
ok = true;
|
|
46
49
|
return false;
|
|
47
50
|
}
|
|
@@ -50,11 +53,11 @@ const checkType = function (value, type, msg, ...logs) {
|
|
|
50
53
|
}
|
|
51
54
|
});
|
|
52
55
|
if (!ok) {
|
|
53
|
-
log(['Value given', value, 'type', typeof value, 'expected', typesList.join(' or ')]);
|
|
56
|
+
(0, log_1.log)(['Value given', value, 'type', typeof value, 'expected', typesList.join(' or ')]);
|
|
54
57
|
if (logs.length) {
|
|
55
|
-
log(logs);
|
|
58
|
+
(0, log_1.log)(logs);
|
|
56
59
|
}
|
|
57
60
|
throw new Error((msg ? msg + ' - ' : '') + bbn._('The value should be a %s', typesList.join(' ' + bbn._('or a') + ' ')));
|
|
58
61
|
}
|
|
59
62
|
};
|
|
60
|
-
|
|
63
|
+
exports.checkType = checkType;
|
package/dist/fn/chrono.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stopChrono = exports.startChrono = void 0;
|
|
4
|
+
const each_1 = require("./each");
|
|
2
5
|
const _private = [];
|
|
3
6
|
const startChrono = function (name) {
|
|
4
7
|
let now = new Date().getTime();
|
|
5
8
|
let h1 = 3600 * 1000;
|
|
6
9
|
if (_private.length) {
|
|
7
|
-
each(_private, (t, n) => {
|
|
10
|
+
(0, each_1.each)(_private, (t, n) => {
|
|
8
11
|
if (now - t > h1) {
|
|
9
12
|
delete _private[n];
|
|
10
13
|
}
|
|
@@ -13,6 +16,7 @@ const startChrono = function (name) {
|
|
|
13
16
|
}
|
|
14
17
|
_private[name] = now;
|
|
15
18
|
};
|
|
19
|
+
exports.startChrono = startChrono;
|
|
16
20
|
const stopChrono = function (name) {
|
|
17
21
|
if (_private[name]) {
|
|
18
22
|
let now = new Date().getTime();
|
|
@@ -20,4 +24,4 @@ const stopChrono = function (name) {
|
|
|
20
24
|
return diff;
|
|
21
25
|
}
|
|
22
26
|
};
|
|
23
|
-
|
|
27
|
+
exports.stopChrono = stopChrono;
|