@bbn/bbn 1.0.27 → 1.0.29
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.js +22 -22
- package/dist/fn/_addLoader.js +3 -6
- package/dist/fn/_compareValues.js +11 -14
- package/dist/fn/_deleteLoader.js +7 -10
- package/dist/fn/abort.js +3 -6
- package/dist/fn/abortURL.js +4 -7
- package/dist/fn/addColors.js +5 -8
- package/dist/fn/addInputs.js +3 -6
- package/dist/fn/addStyle.js +5 -8
- package/dist/fn/adjustHeight.js +5 -8
- package/dist/fn/adjustSize.js +5 -8
- package/dist/fn/adjustWidth.js +5 -8
- package/dist/fn/ajax.js +31 -34
- package/dist/fn/analyzeFunction.js +3 -6
- package/dist/fn/animateCss.js +1 -4
- package/dist/fn/arrayBuffer2String.js +1 -4
- package/dist/fn/arrayFromProp.js +5 -8
- package/dist/fn/autoExtend.js +4 -7
- package/dist/fn/baseName.js +6 -9
- package/dist/fn/br2nl.js +3 -6
- package/dist/fn/calendar.js +14 -20
- package/dist/fn/callback.js +16 -19
- package/dist/fn/camelToCss.js +1 -4
- package/dist/fn/camelize.js +1 -4
- package/dist/fn/canvasToImage.js +1 -4
- package/dist/fn/center.js +1 -4
- package/dist/fn/checkProps.js +3 -6
- package/dist/fn/checkPropsDetails.js +9 -12
- package/dist/fn/checkPropsOrDie.js +3 -6
- package/dist/fn/checkType.js +16 -19
- package/dist/fn/chrono.js +3 -7
- package/dist/fn/circularReplacer.js +7 -10
- package/dist/fn/clone.js +7 -10
- package/dist/fn/colorToHex.js +1 -4
- package/dist/fn/compare.js +18 -21
- package/dist/fn/compareConditions.js +10 -13
- package/dist/fn/copy.js +4 -7
- package/dist/fn/correctCase.js +1 -4
- package/dist/fn/count.js +3 -6
- package/dist/fn/crc32.js +1 -4
- package/dist/fn/createObject.js +3 -6
- package/dist/fn/cssExists.js +3 -6
- package/dist/fn/date.js +8 -11
- package/dist/fn/dateSQL.js +5 -11
- package/dist/fn/daysInMonth.js +5 -11
- package/dist/fn/deepPath.js +7 -10
- package/dist/fn/defaultAjaxAbortFunction.js +3 -6
- package/dist/fn/defaultAjaxErrorFunction.js +1 -4
- package/dist/fn/defaultAlertFunction.js +1 -4
- package/dist/fn/defaultConfirmFunction.js +4 -7
- package/dist/fn/defaultEndLoadingFunction.js +1 -4
- package/dist/fn/defaultErrorFunction.js +3 -6
- package/dist/fn/defaultHistoryFunction.js +1 -4
- package/dist/fn/defaultLinkFunction.js +1 -4
- package/dist/fn/defaultPostLinkFunction.js +1 -4
- package/dist/fn/defaultPreLinkFunction.js +1 -4
- package/dist/fn/defaultResizeFunction.js +1 -4
- package/dist/fn/defaultStartLoadingFunction.js +1 -4
- package/dist/fn/deleteProp.js +4 -7
- package/dist/fn/diffObj.js +16 -19
- package/dist/fn/dirName.js +7 -10
- package/dist/fn/download.js +15 -18
- package/dist/fn/downloadContent.js +9 -12
- package/dist/fn/each.js +7 -10
- package/dist/fn/eraseCookie.js +1 -4
- package/dist/fn/error.js +3 -6
- package/dist/fn/escapeDquotes.js +3 -6
- package/dist/fn/escapeRegExp.js +1 -4
- package/dist/fn/escapeSquotes.js +3 -6
- package/dist/fn/escapeTicks.js +3 -6
- package/dist/fn/escapeUrl.js +8 -11
- package/dist/fn/extend.js +13 -16
- package/dist/fn/extendOut.js +4 -7
- package/dist/fn/fdate.js +12 -18
- package/dist/fn/fdatetime.js +10 -16
- package/dist/fn/fieldValue.js +1 -4
- package/dist/fn/fileExt.js +3 -6
- package/dist/fn/filter.js +12 -15
- package/dist/fn/filterToConditions.js +8 -11
- package/dist/fn/findAll.js +7 -10
- package/dist/fn/fori.js +6 -9
- package/dist/fn/forir.js +6 -9
- package/dist/fn/format.js +3 -6
- package/dist/fn/formatBytes.js +1 -4
- package/dist/fn/formatDate.js +3 -9
- package/dist/fn/formatSize.js +5 -8
- package/dist/fn/formdata.js +11 -14
- package/dist/fn/fromXml.js +1 -4
- package/dist/fn/ftime.js +12 -18
- package/dist/fn/getAllTags.js +3 -6
- package/dist/fn/getAncestors.js +1 -4
- package/dist/fn/getAttributes.js +3 -6
- package/dist/fn/getBrowserName.js +1 -4
- package/dist/fn/getBrowserVersion.js +1 -4
- package/dist/fn/getCookie.js +1 -4
- package/dist/fn/getCssVar.js +1 -4
- package/dist/fn/getDay.js +3 -6
- package/dist/fn/getDeviceType.js +1 -4
- package/dist/fn/getEventData.js +7 -10
- package/dist/fn/getField.js +3 -6
- package/dist/fn/getFieldValues.js +7 -10
- package/dist/fn/getHTMLOfSelection.js +4 -7
- package/dist/fn/getHtml.js +3 -6
- package/dist/fn/getLoader.js +3 -6
- package/dist/fn/getPath.js +3 -6
- package/dist/fn/getProp.js +4 -7
- package/dist/fn/getProperty.js +1 -4
- package/dist/fn/getRequestId.js +5 -8
- package/dist/fn/getRow.js +3 -6
- package/dist/fn/getScrollBarSize.js +1 -4
- package/dist/fn/getText.js +1 -4
- package/dist/fn/getTimeoff.js +1 -4
- package/dist/fn/happy.js +3 -6
- package/dist/fn/hash.js +11 -14
- package/dist/fn/hex2rgb.js +1 -4
- package/dist/fn/history.js +1 -4
- package/dist/fn/html2text.js +1 -4
- package/dist/fn/imageToCanvas.js +1 -4
- package/dist/fn/imgToBase64.js +3 -6
- package/dist/fn/info.js +3 -6
- package/dist/fn/init.js +32 -58
- package/dist/fn/isActiveInterface.js +1 -4
- package/dist/fn/isArray.js +1 -4
- package/dist/fn/isBlob.js +1 -4
- package/dist/fn/isBoolean.js +1 -4
- package/dist/fn/isCanvas.js +1 -4
- package/dist/fn/isColor.js +3 -6
- package/dist/fn/isComment.js +1 -4
- package/dist/fn/isCp.js +3 -6
- package/dist/fn/isDate.js +1 -4
- package/dist/fn/isDesktopDevice.js +1 -4
- package/dist/fn/isDimension.js +3 -6
- package/dist/fn/isDom.js +1 -4
- package/dist/fn/isEmail.js +3 -6
- package/dist/fn/isEmpty.js +5 -8
- package/dist/fn/isEvent.js +1 -4
- package/dist/fn/isFocused.js +1 -4
- package/dist/fn/isFunction.js +1 -4
- package/dist/fn/isHostname.js +5 -8
- package/dist/fn/isIP.js +3 -6
- package/dist/fn/isInside.js +7 -10
- package/dist/fn/isInt.js +1 -4
- package/dist/fn/isIterable.js +1 -4
- package/dist/fn/isMobile.js +4 -7
- package/dist/fn/isMobileDevice.js +1 -4
- package/dist/fn/isNull.js +1 -4
- package/dist/fn/isNumber.js +1 -4
- package/dist/fn/isObject.js +1 -4
- package/dist/fn/isPercent.js +1 -4
- package/dist/fn/isPrimitive.js +1 -4
- package/dist/fn/isPromise.js +1 -4
- package/dist/fn/isPropSize.js +3 -6
- package/dist/fn/isSQLDate.js +1 -4
- package/dist/fn/isSame.js +5 -8
- package/dist/fn/isString.js +1 -4
- package/dist/fn/isSymbol.js +1 -4
- package/dist/fn/isTabletDevice.js +1 -4
- package/dist/fn/isURL.js +1 -4
- package/dist/fn/isValidDimension.js +4 -7
- package/dist/fn/isValidName.js +3 -6
- package/dist/fn/isValue.js +3 -6
- package/dist/fn/isVue.js +1 -4
- package/dist/fn/iterate.js +5 -8
- package/dist/fn/lightenDarkenHex.js +1 -4
- package/dist/fn/link.js +19 -22
- package/dist/fn/log.js +3 -6
- package/dist/fn/makeReactive.js +28 -31
- package/dist/fn/map.js +3 -6
- package/dist/fn/md5.js +1 -4
- package/dist/fn/money.js +3 -6
- package/dist/fn/move.js +1 -4
- package/dist/fn/multiorder.js +3 -6
- package/dist/fn/nl2br.js +3 -6
- package/dist/fn/numProperties.js +1 -4
- package/dist/fn/objectToFormData.js +12 -15
- package/dist/fn/order.js +3 -6
- package/dist/fn/outerHeight.js +3 -6
- package/dist/fn/outerWidth.js +3 -6
- package/dist/fn/percent.js +1 -4
- package/dist/fn/pickValue.js +1 -4
- package/dist/fn/post.js +7 -10
- package/dist/fn/postOut.js +5 -8
- package/dist/fn/printf.js +1 -4
- package/dist/fn/quotes2html.js +4 -7
- package/dist/fn/randomInt.js +1 -4
- package/dist/fn/randomString.js +4 -7
- package/dist/fn/removeAccents.js +5 -8
- package/dist/fn/removeEmpty.js +8 -11
- package/dist/fn/removeExtraSpaces.js +1 -4
- package/dist/fn/removeHtmlComments.js +3 -6
- package/dist/fn/removePrivateProp.js +3 -6
- package/dist/fn/removeTrailingChars.js +6 -9
- package/dist/fn/repeat.js +1 -4
- package/dist/fn/replaceAll.js +4 -7
- package/dist/fn/replaceSelection.js +1 -4
- package/dist/fn/resize.js +7 -10
- package/dist/fn/rgb2hex.js +1 -4
- package/dist/fn/riterate.js +3 -6
- package/dist/fn/roundDecimal.js +1 -4
- package/dist/fn/sanitize.js +5 -8
- package/dist/fn/search.js +15 -18
- package/dist/fn/selectElementText.js +1 -4
- package/dist/fn/selector.js +1 -4
- package/dist/fn/setCookie.js +1 -4
- package/dist/fn/setCssVar.js +1 -4
- package/dist/fn/setNavigationVars.js +10 -13
- package/dist/fn/setProp.js +1 -4
- package/dist/fn/setProperty.js +3 -6
- package/dist/fn/shorten.js +5 -8
- package/dist/fn/shortenObj.js +9 -12
- package/dist/fn/shuffle.js +1 -4
- package/dist/fn/simpleHash.js +5 -8
- package/dist/fn/simpleHash1.js +1 -4
- package/dist/fn/simpleHash2.js +1 -4
- package/dist/fn/stat.js +1 -4
- package/dist/fn/string2ArrayBuffer.js +1 -4
- package/dist/fn/submit.js +6 -9
- package/dist/fn/substr.js +7 -10
- package/dist/fn/sum.js +4 -7
- package/dist/fn/timestamp.js +1 -4
- package/dist/fn/toCSV.js +8 -11
- package/dist/fn/toggleFullScreen.js +3 -6
- package/dist/fn/translate.js +3 -6
- package/dist/fn/treatAjaxArguments.js +10 -13
- package/dist/fn/trim.js +4 -7
- package/dist/fn/uniqString.js +7 -10
- package/dist/fn/unique.js +1 -4
- package/dist/fn/upload.js +7 -33
- package/dist/fn/warning.js +3 -6
- package/dist/index.js +459 -471
- package/package.json +1 -1
package/dist/fn/animateCss.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.animateCss = void 0;
|
|
4
1
|
const animateCss = function (ele, animationName, callback) {
|
|
5
2
|
let animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
|
|
6
3
|
/*$(ele).addClass('animated ' + animationName).one(animationEnd, function(){
|
|
@@ -20,4 +17,4 @@ const animateCss = function (ele, animationName, callback) {
|
|
|
20
17
|
this.classList.remove(animationName);
|
|
21
18
|
});
|
|
22
19
|
};
|
|
23
|
-
|
|
20
|
+
export { animateCss };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.arrayBuffer2String = void 0;
|
|
4
1
|
const arrayBuffer2String = function (buf) {
|
|
5
2
|
return String.fromCharCode.apply(null, new Uint16Array(buf));
|
|
6
3
|
};
|
|
7
|
-
|
|
4
|
+
export { arrayBuffer2String };
|
package/dist/fn/arrayFromProp.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.arrayFromProp = void 0;
|
|
4
|
-
const each_1 = require("./each");
|
|
5
|
-
const getProperty_1 = require("./getProperty");
|
|
1
|
+
import { each } from './each';
|
|
2
|
+
import { getProperty } from './getProperty';
|
|
6
3
|
const arrayFromProp = function (arr, prop) {
|
|
7
4
|
let r = [];
|
|
8
|
-
|
|
9
|
-
r.push(
|
|
5
|
+
each(arr, (a, i) => {
|
|
6
|
+
r.push(getProperty(a, prop));
|
|
10
7
|
});
|
|
11
8
|
return r;
|
|
12
9
|
};
|
|
13
|
-
|
|
10
|
+
export { arrayFromProp };
|
package/dist/fn/autoExtend.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.autoExtend = void 0;
|
|
4
|
-
const extend_1 = require("./extend");
|
|
1
|
+
import { extend } from './extend';
|
|
5
2
|
const autoExtend = function (namespace, obj) {
|
|
6
3
|
if (!bbn[namespace]) {
|
|
7
4
|
bbn[namespace] = {};
|
|
8
5
|
//$.extend(true, bbn[namespace], obj);
|
|
9
|
-
|
|
6
|
+
extend(bbn[namespace], obj);
|
|
10
7
|
}
|
|
11
8
|
else {
|
|
12
9
|
// $.extend(true, bbn[namespace], obj);
|
|
13
|
-
|
|
10
|
+
extend(bbn[namespace], obj);
|
|
14
11
|
}
|
|
15
12
|
};
|
|
16
|
-
|
|
13
|
+
export { autoExtend };
|
package/dist/fn/baseName.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.baseName = void 0;
|
|
4
|
-
const isString_1 = require("./isString");
|
|
5
|
-
const substr_1 = require("./substr");
|
|
1
|
+
import { isString } from './isString';
|
|
2
|
+
import { substr } from './substr';
|
|
6
3
|
const baseName = function (path, suffix) {
|
|
7
|
-
if (path &&
|
|
4
|
+
if (path && isString(path)) {
|
|
8
5
|
let bits = path.split('/');
|
|
9
6
|
let res = bits.pop();
|
|
10
7
|
if (!suffix) {
|
|
11
8
|
return res;
|
|
12
9
|
}
|
|
13
10
|
let len = suffix.length;
|
|
14
|
-
if (res &&
|
|
15
|
-
return
|
|
11
|
+
if (res && substr(res, -len) === suffix) {
|
|
12
|
+
return substr(res, 0, res.length - len);
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
15
|
return '';
|
|
19
16
|
};
|
|
20
|
-
|
|
17
|
+
export { baseName };
|
package/dist/fn/br2nl.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.br2nl = void 0;
|
|
4
|
-
const replaceAll_1 = require("./replaceAll");
|
|
1
|
+
import { replaceAll } from './replaceAll';
|
|
5
2
|
const br2nl = function (st) {
|
|
6
|
-
return
|
|
3
|
+
return replaceAll('<br />', '\n', replaceAll('<br/>', '\n', replaceAll('<br>', '\n', st)));
|
|
7
4
|
};
|
|
8
|
-
|
|
5
|
+
export { br2nl };
|
package/dist/fn/calendar.js
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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);
|
|
1
|
+
import { fdate } from './fdate';
|
|
2
|
+
import { date } from './date';
|
|
3
|
+
import { isDate } from './isDate';
|
|
4
|
+
import { isString } from './isString';
|
|
5
|
+
import * as dayjs from 'dayjs';
|
|
6
|
+
import * as cal from 'dayjs/plugin/calendar';
|
|
7
|
+
dayjs.extend(cal);
|
|
14
8
|
const calendar = function (d, wrong_result) {
|
|
15
|
-
if (undefined ===
|
|
16
|
-
return
|
|
9
|
+
if (undefined === dayjs) {
|
|
10
|
+
return fdate(d, wrong_result);
|
|
17
11
|
}
|
|
18
|
-
let r =
|
|
19
|
-
if (!
|
|
20
|
-
return wrong_result &&
|
|
12
|
+
let r = date(d);
|
|
13
|
+
if (!isDate(r)) {
|
|
14
|
+
return wrong_result && isString(wrong_result) ? wrong_result : '';
|
|
21
15
|
}
|
|
22
|
-
return (
|
|
16
|
+
return dayjs(r).calendar(null, {
|
|
23
17
|
sameDay: '[' + bbn._('Today') + ']',
|
|
24
18
|
nextDay: '[' + bbn._('Tomorrow') + ']',
|
|
25
19
|
nextWeek: 'ddd D',
|
|
@@ -28,4 +22,4 @@ const calendar = function (d, wrong_result) {
|
|
|
28
22
|
sameElse: 'L',
|
|
29
23
|
});
|
|
30
24
|
};
|
|
31
|
-
|
|
25
|
+
export { calendar };
|
package/dist/fn/callback.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const log_1 = require("./log");
|
|
8
|
-
const defaultPostLinkFunction_1 = require("./defaultPostLinkFunction");
|
|
9
|
-
const defaultAlertFunction_1 = require("./defaultAlertFunction");
|
|
1
|
+
import { error } from './error';
|
|
2
|
+
import { defaultLinkFunction } from './defaultLinkFunction';
|
|
3
|
+
import { isFunction } from './isFunction';
|
|
4
|
+
import { log } from './log';
|
|
5
|
+
import { defaultPostLinkFunction } from './defaultPostLinkFunction';
|
|
6
|
+
import { defaultAlertFunction } from './defaultAlertFunction';
|
|
10
7
|
const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
|
|
11
8
|
let tmp = false;
|
|
12
9
|
if (res) {
|
|
@@ -20,7 +17,7 @@ const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
|
|
|
20
17
|
eval(res.prescript);
|
|
21
18
|
}
|
|
22
19
|
catch (e) {
|
|
23
|
-
|
|
20
|
+
error(e.message || '');
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
23
|
if (isObj && res.url === undefined) {
|
|
@@ -31,7 +28,7 @@ const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
|
|
|
31
28
|
tmp = fn(res, ele);
|
|
32
29
|
}
|
|
33
30
|
else {
|
|
34
|
-
tmp =
|
|
31
|
+
tmp = defaultLinkFunction(res, ele);
|
|
35
32
|
}
|
|
36
33
|
if (ele && isObj && (res.content !== undefined)) {
|
|
37
34
|
if ('value' in ele) {
|
|
@@ -50,13 +47,13 @@ const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
|
|
|
50
47
|
let r = null;
|
|
51
48
|
try {
|
|
52
49
|
r = eval(res.script);
|
|
53
|
-
if (
|
|
50
|
+
if (isFunction(r)) {
|
|
54
51
|
r = r(data, ele);
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
54
|
catch (e) {
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
log(e, res);
|
|
56
|
+
error(isFunction(e.getMessage) ? e.getMessage() : null);
|
|
60
57
|
}
|
|
61
58
|
return r;
|
|
62
59
|
})(res.data ? res.data : {}, ele ? ele : false);
|
|
@@ -66,20 +63,20 @@ const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
|
|
|
66
63
|
if (tmp && fn2) {
|
|
67
64
|
fn2(res);
|
|
68
65
|
}
|
|
69
|
-
else if (isObj &&
|
|
70
|
-
|
|
66
|
+
else if (isObj && defaultPostLinkFunction) {
|
|
67
|
+
defaultPostLinkFunction(res, ele);
|
|
71
68
|
}
|
|
72
69
|
if (tmp && isObj && res.postscript) {
|
|
73
70
|
eval(res.postscript);
|
|
74
71
|
}
|
|
75
72
|
if (isObj && res.error) {
|
|
76
73
|
errTitle = res.errorTitle || bbn.lng.server_response;
|
|
77
|
-
|
|
74
|
+
defaultAlertFunction(res.error, errTitle);
|
|
78
75
|
}
|
|
79
76
|
}
|
|
80
77
|
else {
|
|
81
|
-
|
|
78
|
+
defaultAlertFunction(bbn.lng.errorText, bbn.lng.error);
|
|
82
79
|
}
|
|
83
80
|
return tmp;
|
|
84
81
|
};
|
|
85
|
-
|
|
82
|
+
export { callback };
|
package/dist/fn/camelToCss.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.camelToCss = void 0;
|
|
4
1
|
const camelToCss = function (str) {
|
|
5
2
|
return str
|
|
6
3
|
.replace(/([A-Z])/g, function (st) {
|
|
@@ -10,4 +7,4 @@ const camelToCss = function (str) {
|
|
|
10
7
|
return st.toLowerCase();
|
|
11
8
|
});
|
|
12
9
|
};
|
|
13
|
-
|
|
10
|
+
export { camelToCss };
|
package/dist/fn/camelize.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.camelize = void 0;
|
|
4
1
|
const camelize = function (str) {
|
|
5
2
|
return str.replace(/^([A-Z])|[\s-](\w)/g, function (match, p1, p2, offset) {
|
|
6
3
|
if (p2) {
|
|
@@ -9,4 +6,4 @@ const camelize = function (str) {
|
|
|
9
6
|
return p1.toLowerCase();
|
|
10
7
|
});
|
|
11
8
|
};
|
|
12
|
-
|
|
9
|
+
export { camelize };
|
package/dist/fn/canvasToImage.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.canvasToImage = void 0;
|
|
4
1
|
const canvasToImage = function (canvas) {
|
|
5
2
|
let img = new Image();
|
|
6
3
|
img.src = canvas.toDataURL('image/png');
|
|
7
4
|
return img;
|
|
8
5
|
};
|
|
9
|
-
|
|
6
|
+
export { canvasToImage };
|
package/dist/fn/center.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.center = void 0;
|
|
4
1
|
const center = function (ele) {
|
|
5
2
|
//ele = $(ele);
|
|
6
3
|
let parent = ele.parentNode,
|
|
@@ -24,4 +21,4 @@ const center = function (ele) {
|
|
|
24
21
|
ele.style.left = Math.max(0, (h - ele.offsetWidth) / 2 + parent.scrollLeft) + 'px';
|
|
25
22
|
return ele;
|
|
26
23
|
};
|
|
27
|
-
|
|
24
|
+
export { center };
|
package/dist/fn/checkProps.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkProps = void 0;
|
|
4
|
-
const checkPropsDetails_1 = require("./checkPropsDetails");
|
|
1
|
+
import { checkPropsDetails } from './checkPropsDetails';
|
|
5
2
|
const checkProps = function (obj, props, checkEmpty = false) {
|
|
6
|
-
return
|
|
3
|
+
return checkPropsDetails(obj, props, checkEmpty).result;
|
|
7
4
|
};
|
|
8
|
-
|
|
5
|
+
export { checkProps };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const isObject_1 = require("./isObject");
|
|
6
|
-
const each_1 = require("./each");
|
|
7
|
-
const substr_1 = require("./substr");
|
|
1
|
+
import { isArray } from './isArray';
|
|
2
|
+
import { isObject } from './isObject';
|
|
3
|
+
import { each } from './each';
|
|
4
|
+
import { substr } from './substr';
|
|
8
5
|
const checkPropsDetails = function (obj, props, checkEmpty = false) {
|
|
9
6
|
let res = {
|
|
10
7
|
error: false,
|
|
@@ -13,15 +10,15 @@ const checkPropsDetails = function (obj, props, checkEmpty = false) {
|
|
|
13
10
|
if (typeof (props) === 'string') {
|
|
14
11
|
props = [props];
|
|
15
12
|
}
|
|
16
|
-
if (!
|
|
13
|
+
if (!isArray(props)) {
|
|
17
14
|
res.error = bbn._('checkProps must receive a string or an array as props argument');
|
|
18
15
|
}
|
|
19
|
-
if (!
|
|
16
|
+
if (!isObject(obj)) {
|
|
20
17
|
res.error = bbn._('checkProps must receive an object as obj argument');
|
|
21
18
|
}
|
|
22
19
|
if (!res.error) {
|
|
23
20
|
let check;
|
|
24
|
-
|
|
21
|
+
each(props, (varName) => {
|
|
25
22
|
varName = varName.trim().split(':');
|
|
26
23
|
let type = varName[1] || false;
|
|
27
24
|
varName = varName[0];
|
|
@@ -29,7 +26,7 @@ const checkPropsDetails = function (obj, props, checkEmpty = false) {
|
|
|
29
26
|
res.error = varName + ' ' + bbn._('is not defined');
|
|
30
27
|
}
|
|
31
28
|
else if (type) {
|
|
32
|
-
check = 'is' +
|
|
29
|
+
check = 'is' + substr(type, 0, 1).toUpperCase() + substr(type, 1).toLowerCase();
|
|
33
30
|
if (bbn.fn[check] === undefined) {
|
|
34
31
|
res.error = type + ' ' + bbn._('is not a valid type');
|
|
35
32
|
}
|
|
@@ -50,4 +47,4 @@ const checkPropsDetails = function (obj, props, checkEmpty = false) {
|
|
|
50
47
|
}
|
|
51
48
|
return res;
|
|
52
49
|
};
|
|
53
|
-
|
|
50
|
+
export { checkPropsDetails };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkPropsOrDie = void 0;
|
|
4
|
-
const checkPropsDetails_1 = require("./checkPropsDetails");
|
|
1
|
+
import { checkPropsDetails } from './checkPropsDetails';
|
|
5
2
|
const checkPropsOrDie = function (obj, props, checkEmpty = false) {
|
|
6
|
-
let res =
|
|
3
|
+
let res = checkPropsDetails(obj, props, checkEmpty);
|
|
7
4
|
if (res.error) {
|
|
8
5
|
throw new Error(res.error);
|
|
9
6
|
}
|
|
10
7
|
return true;
|
|
11
8
|
};
|
|
12
|
-
|
|
9
|
+
export { checkPropsOrDie };
|
package/dist/fn/checkType.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const correctCase_1 = require("./correctCase");
|
|
9
|
-
const error_1 = require("./error");
|
|
10
|
-
const log_1 = require("./log");
|
|
1
|
+
import { isArray } from './isArray';
|
|
2
|
+
import { each } from './each';
|
|
3
|
+
import { isFunction } from './isFunction';
|
|
4
|
+
import { isString } from './isString';
|
|
5
|
+
import { correctCase } from './correctCase';
|
|
6
|
+
import { error } from './error';
|
|
7
|
+
import { log } from './log';
|
|
11
8
|
const checkType = function (value, type, msg, ...logs) {
|
|
12
9
|
let ok = false;
|
|
13
|
-
if (!
|
|
10
|
+
if (!isArray(type)) {
|
|
14
11
|
type = [type];
|
|
15
12
|
}
|
|
16
13
|
const typesList = [];
|
|
17
|
-
|
|
14
|
+
each(type, (t) => {
|
|
18
15
|
var _a;
|
|
19
16
|
if (t === String) {
|
|
20
17
|
t = 'string';
|
|
@@ -34,17 +31,17 @@ const checkType = function (value, type, msg, ...logs) {
|
|
|
34
31
|
else if (t === Function) {
|
|
35
32
|
t = 'function';
|
|
36
33
|
}
|
|
37
|
-
if (
|
|
34
|
+
if (isFunction(t)) {
|
|
38
35
|
typesList.push(t.name || ((_a = t.constructor) === null || _a === void 0 ? void 0 : _a.name) || t.toString());
|
|
39
36
|
if (value instanceof t) {
|
|
40
37
|
ok = true;
|
|
41
38
|
return false;
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
|
-
else if (!
|
|
45
|
-
|
|
41
|
+
else if (!isString(t) || !isFunction(bbn.fn['is' + correctCase(t)])) {
|
|
42
|
+
error(`The type ${t} is not recognized`);
|
|
46
43
|
}
|
|
47
|
-
else if (bbn.fn['is' +
|
|
44
|
+
else if (bbn.fn['is' + correctCase(t)](value)) {
|
|
48
45
|
ok = true;
|
|
49
46
|
return false;
|
|
50
47
|
}
|
|
@@ -53,11 +50,11 @@ const checkType = function (value, type, msg, ...logs) {
|
|
|
53
50
|
}
|
|
54
51
|
});
|
|
55
52
|
if (!ok) {
|
|
56
|
-
|
|
53
|
+
log(['Value given', value, 'type', typeof value, 'expected', typesList.join(' or ')]);
|
|
57
54
|
if (logs.length) {
|
|
58
|
-
|
|
55
|
+
log(logs);
|
|
59
56
|
}
|
|
60
57
|
throw new Error((msg ? msg + ' - ' : '') + bbn._('The value should be a %s', typesList.join(' ' + bbn._('or a') + ' ')));
|
|
61
58
|
}
|
|
62
59
|
};
|
|
63
|
-
|
|
60
|
+
export { checkType };
|
package/dist/fn/chrono.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stopChrono = exports.startChrono = void 0;
|
|
4
|
-
const each_1 = require("./each");
|
|
1
|
+
import { each } from './each';
|
|
5
2
|
const _private = [];
|
|
6
3
|
const startChrono = function (name) {
|
|
7
4
|
let now = new Date().getTime();
|
|
8
5
|
let h1 = 3600 * 1000;
|
|
9
6
|
if (_private.length) {
|
|
10
|
-
|
|
7
|
+
each(_private, (t, n) => {
|
|
11
8
|
if (now - t > h1) {
|
|
12
9
|
delete _private[n];
|
|
13
10
|
}
|
|
@@ -16,7 +13,6 @@ const startChrono = function (name) {
|
|
|
16
13
|
}
|
|
17
14
|
_private[name] = now;
|
|
18
15
|
};
|
|
19
|
-
exports.startChrono = startChrono;
|
|
20
16
|
const stopChrono = function (name) {
|
|
21
17
|
if (_private[name]) {
|
|
22
18
|
let now = new Date().getTime();
|
|
@@ -24,4 +20,4 @@ const stopChrono = function (name) {
|
|
|
24
20
|
return diff;
|
|
25
21
|
}
|
|
26
22
|
};
|
|
27
|
-
|
|
23
|
+
export { startChrono, stopChrono };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const isDom_1 = require("./isDom");
|
|
5
|
-
const isCp_1 = require("./isCp");
|
|
6
|
-
const log_1 = require("./log");
|
|
1
|
+
import { isDom } from './isDom';
|
|
2
|
+
import { isCp } from './isCp';
|
|
3
|
+
import { log } from './log';
|
|
7
4
|
const circularReplacer = function () {
|
|
8
5
|
const visited = new WeakSet();
|
|
9
6
|
return (key, value) => {
|
|
@@ -13,7 +10,7 @@ const circularReplacer = function () {
|
|
|
13
10
|
}
|
|
14
11
|
visited.add(value);
|
|
15
12
|
if (![undefined, Object, Array, null].includes(value.constructor)) {
|
|
16
|
-
if (
|
|
13
|
+
if (isDom(value)) {
|
|
17
14
|
if (value.bbnId) {
|
|
18
15
|
value = '__BBN_DOM__' + value.tagName + '/' + value.bbnId + value.bbnHash;
|
|
19
16
|
}
|
|
@@ -21,8 +18,8 @@ const circularReplacer = function () {
|
|
|
21
18
|
value = '__BBN_DOM__' + value.tagName + '/' + value.className;
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
|
-
else if (
|
|
25
|
-
|
|
21
|
+
else if (isCp(value)) {
|
|
22
|
+
log('IS CP');
|
|
26
23
|
value = '__BBN_CP__' + value.$options.name + '/' + value.$cid;
|
|
27
24
|
}
|
|
28
25
|
else {
|
|
@@ -33,4 +30,4 @@ const circularReplacer = function () {
|
|
|
33
30
|
return value;
|
|
34
31
|
};
|
|
35
32
|
};
|
|
36
|
-
|
|
33
|
+
export { circularReplacer };
|
package/dist/fn/clone.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const isArray_1 = require("./isArray");
|
|
5
|
-
const isObject_1 = require("./isObject");
|
|
6
|
-
const extend_1 = require("./extend");
|
|
1
|
+
import { isArray } from './isArray';
|
|
2
|
+
import { isObject } from './isObject';
|
|
3
|
+
import { extend } from './extend';
|
|
7
4
|
const clone = function (obj) {
|
|
8
|
-
if (
|
|
5
|
+
if (isArray(obj)) {
|
|
9
6
|
return obj.slice().map((a) => {
|
|
10
7
|
return typeof a === 'object' ? clone(a) : a;
|
|
11
8
|
});
|
|
12
9
|
}
|
|
13
|
-
if (
|
|
10
|
+
if (isObject(obj)) {
|
|
14
11
|
const o = Object.create(Object.getPrototypeOf(obj));
|
|
15
|
-
return
|
|
12
|
+
return extend(true, o, obj);
|
|
16
13
|
}
|
|
17
14
|
return obj;
|
|
18
15
|
};
|
|
19
|
-
|
|
16
|
+
export { clone };
|
package/dist/fn/colorToHex.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.colorToHex = void 0;
|
|
4
1
|
const colorToHex = function (color) {
|
|
5
2
|
let canvas = document.createElement('canvas').getContext('2d');
|
|
6
3
|
canvas.fillStyle = color;
|
|
7
4
|
return canvas.fillStyle;
|
|
8
5
|
};
|
|
9
|
-
|
|
6
|
+
export { colorToHex };
|
package/dist/fn/compare.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const isNull_1 = require("./isNull");
|
|
7
|
-
const isObject_1 = require("./isObject");
|
|
8
|
-
const isSame_1 = require("./isSame");
|
|
1
|
+
import { isEmpty } from './isEmpty';
|
|
2
|
+
import { removeAccents } from './removeAccents';
|
|
3
|
+
import { isNull } from './isNull';
|
|
4
|
+
import { isObject } from './isObject';
|
|
5
|
+
import { isSame } from './isSame';
|
|
9
6
|
const compare = function (v1, v2, operator) {
|
|
10
7
|
switch (operator) {
|
|
11
8
|
case '===':
|
|
@@ -26,19 +23,19 @@ const compare = function (v1, v2, operator) {
|
|
|
26
23
|
case 'contain':
|
|
27
24
|
case 'icontains':
|
|
28
25
|
case 'icontain':
|
|
29
|
-
if (
|
|
26
|
+
if (isEmpty(v1) || isEmpty(v2)) {
|
|
30
27
|
return false;
|
|
31
28
|
}
|
|
32
|
-
return
|
|
29
|
+
return removeAccents(v1).toLowerCase().indexOf(removeAccents(v2).toLowerCase()) !== -1;
|
|
33
30
|
case 'doesnotcontain':
|
|
34
31
|
case 'donotcontain':
|
|
35
|
-
if (
|
|
32
|
+
if (isNull(v1) || isNull(v2)) {
|
|
36
33
|
return true;
|
|
37
34
|
}
|
|
38
|
-
return
|
|
35
|
+
return removeAccents(v1.toLowerCase()).indexOf(removeAccents(v2.toLowerCase())) === -1;
|
|
39
36
|
case 'starts':
|
|
40
37
|
case 'start':
|
|
41
|
-
if (
|
|
38
|
+
if (isNull(v1) || isNull(v2)) {
|
|
42
39
|
return false;
|
|
43
40
|
}
|
|
44
41
|
if (typeof v1 !== 'string') {
|
|
@@ -53,24 +50,24 @@ const compare = function (v1, v2, operator) {
|
|
|
53
50
|
case 'starti':
|
|
54
51
|
case 'istarts':
|
|
55
52
|
case 'istart':
|
|
56
|
-
if (
|
|
53
|
+
if (isNull(v1) || isNull(v2)) {
|
|
57
54
|
return false;
|
|
58
55
|
}
|
|
59
|
-
return
|
|
56
|
+
return removeAccents(v1).toLowerCase().indexOf(removeAccents(v2).toLowerCase()) === 0;
|
|
60
57
|
case 'endswith':
|
|
61
58
|
case 'endsi':
|
|
62
59
|
case 'endi':
|
|
63
60
|
case 'iends':
|
|
64
61
|
case 'iend':
|
|
65
|
-
if (
|
|
62
|
+
if (isNull(v1) || isNull(v2)) {
|
|
66
63
|
return false;
|
|
67
64
|
}
|
|
68
65
|
return v1.lastIndexOf(v2) === v1.length - v2.length;
|
|
69
66
|
case 'like':
|
|
70
|
-
if (
|
|
67
|
+
if (isNull(v1) || isNull(v2)) {
|
|
71
68
|
return false;
|
|
72
69
|
}
|
|
73
|
-
return
|
|
70
|
+
return removeAccents(v1).toLowerCase() === removeAccents(v2).toLowerCase();
|
|
74
71
|
case 'gt':
|
|
75
72
|
case '>':
|
|
76
73
|
return v1 > v2;
|
|
@@ -92,11 +89,11 @@ const compare = function (v1, v2, operator) {
|
|
|
92
89
|
case 'isnotempty':
|
|
93
90
|
return v1 !== '';
|
|
94
91
|
case '==':
|
|
95
|
-
if (
|
|
96
|
-
return
|
|
92
|
+
if (isObject(v1, v2)) {
|
|
93
|
+
return isSame(v1, v2);
|
|
97
94
|
}
|
|
98
95
|
default:
|
|
99
96
|
return v1 == v2;
|
|
100
97
|
}
|
|
101
98
|
};
|
|
102
|
-
|
|
99
|
+
export { compare };
|