@bbn/bbn 1.0.35 → 1.0.37
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 +858 -1140
- package/dist/fn/_addLoader.js +5 -5
- package/dist/fn/_compareValues.js +2 -3
- package/dist/fn/_deleteLoader.js +11 -13
- package/dist/fn/abort.js +2 -2
- package/dist/fn/abortURL.js +2 -2
- package/dist/fn/addColors.js +12 -12
- package/dist/fn/addInputs.js +10 -12
- package/dist/fn/addStyle.js +2 -2
- package/dist/fn/adjustHeight.js +2 -2
- package/dist/fn/adjustSize.js +6 -6
- package/dist/fn/adjustWidth.js +2 -2
- package/dist/fn/ajax.js +21 -21
- package/dist/fn/analyzeFunction.js +28 -28
- package/dist/fn/animateCss.js +5 -6
- package/dist/fn/arrayBuffer2String.js +1 -1
- package/dist/fn/arrayFromProp.js +3 -3
- package/dist/fn/autoExtend.js +1 -1
- package/dist/fn/baseName.js +4 -4
- package/dist/fn/br2nl.js +1 -1
- package/dist/fn/calendar.js +2 -2
- package/dist/fn/callback.js +7 -11
- package/dist/fn/camelToCss.js +1 -1
- package/dist/fn/camelize.js +1 -1
- package/dist/fn/canvasToImage.js +2 -2
- package/dist/fn/center.js +2 -2
- package/dist/fn/checkProps.js +1 -2
- package/dist/fn/checkPropsDetails.js +8 -9
- package/dist/fn/checkPropsOrDie.js +2 -3
- package/dist/fn/checkType.js +6 -11
- package/dist/fn/chrono.js +8 -8
- package/dist/fn/circularReplacer.js +3 -3
- package/dist/fn/clone.js +3 -3
- package/dist/fn/colorToHex.js +2 -2
- package/dist/fn/compare.js +1 -1
- package/dist/fn/compareConditions.js +7 -7
- package/dist/fn/copy.js +6 -8
- package/dist/fn/correctCase.js +2 -2
- package/dist/fn/count.js +1 -3
- package/dist/fn/crc32.js +8 -8
- package/dist/fn/createObject.js +3 -16
- package/dist/fn/cssExists.js +6 -6
- package/dist/fn/date.js +2 -2
- package/dist/fn/dateSQL.js +2 -2
- package/dist/fn/daysInMonth.js +2 -2
- package/dist/fn/deepPath.js +6 -7
- package/dist/fn/defaultAjaxAbortFunction.js +1 -2
- package/dist/fn/defaultAjaxErrorFunction.js +1 -1
- package/dist/fn/defaultAlertFunction.js +1 -1
- package/dist/fn/defaultConfirmFunction.js +2 -2
- package/dist/fn/defaultEndLoadingFunction.js +1 -1
- package/dist/fn/defaultErrorFunction.js +1 -1
- package/dist/fn/defaultHistoryFunction.js +1 -1
- package/dist/fn/defaultLinkFunction.js +1 -1
- package/dist/fn/defaultPostLinkFunction.js +1 -1
- package/dist/fn/defaultPreLinkFunction.js +1 -1
- package/dist/fn/defaultResizeFunction.js +1 -1
- package/dist/fn/defaultStartLoadingFunction.js +1 -2
- package/dist/fn/deleteProp.js +1 -1
- package/dist/fn/diffObj.js +11 -13
- package/dist/fn/dirName.js +2 -2
- package/dist/fn/download.js +6 -6
- package/dist/fn/downloadContent.js +5 -5
- package/dist/fn/each.js +3 -3
- package/dist/fn/eraseCookie.js +1 -1
- package/dist/fn/error.js +3 -3
- package/dist/fn/escapeDquotes.js +1 -1
- package/dist/fn/escapeRegExp.js +1 -1
- package/dist/fn/escapeSquotes.js +1 -1
- package/dist/fn/escapeTicks.js +1 -1
- package/dist/fn/escapeUrl.js +7 -7
- package/dist/fn/extend.js +9 -13
- package/dist/fn/extendOut.js +4 -9
- package/dist/fn/fdate.js +2 -2
- package/dist/fn/fdatetime.js +2 -2
- package/dist/fn/fieldValue.js +2 -2
- package/dist/fn/fileExt.js +2 -2
- package/dist/fn/filter.js +6 -8
- package/dist/fn/filterToConditions.js +6 -7
- package/dist/fn/findAll.js +4 -5
- package/dist/fn/fori.js +3 -5
- package/dist/fn/forir.js +3 -5
- package/dist/fn/format.js +5 -5
- package/dist/fn/formatBytes.js +2 -3
- package/dist/fn/formatDate.js +1 -1
- package/dist/fn/formatSize.js +1 -1
- package/dist/fn/formdata.js +25 -25
- package/dist/fn/fromXml.js +8 -14
- package/dist/fn/ftime.js +2 -2
- package/dist/fn/getAllTags.js +2 -2
- package/dist/fn/getAncestors.js +2 -2
- package/dist/fn/getAttributes.js +3 -3
- package/dist/fn/getBrowserName.js +2 -2
- package/dist/fn/getBrowserVersion.js +2 -2
- package/dist/fn/getCookie.js +6 -6
- package/dist/fn/getCssVar.js +1 -1
- package/dist/fn/getDay.js +4 -4
- package/dist/fn/getDeviceType.js +2 -2
- package/dist/fn/getEventData.js +31 -31
- package/dist/fn/getField.js +2 -5
- package/dist/fn/getFieldValues.js +3 -3
- package/dist/fn/getHTMLOfSelection.js +5 -5
- package/dist/fn/getHtml.js +2 -3
- package/dist/fn/getLoader.js +2 -2
- package/dist/fn/getPath.js +16 -23
- package/dist/fn/getProp.js +1 -1
- package/dist/fn/getProperty.js +2 -2
- package/dist/fn/getRequestId.js +3 -3
- package/dist/fn/getRow.js +1 -3
- package/dist/fn/getScrollBarSize.js +6 -6
- package/dist/fn/getText.js +1 -1
- package/dist/fn/getTimeoff.js +1 -1
- package/dist/fn/happy.js +1 -5
- package/dist/fn/hash.js +4 -4
- package/dist/fn/hex2rgb.js +1 -1
- package/dist/fn/history.js +1 -1
- package/dist/fn/html2text.js +2 -2
- package/dist/fn/imageToCanvas.js +2 -2
- package/dist/fn/imgToBase64.js +2 -3
- package/dist/fn/info.js +1 -5
- package/dist/fn/init.js +17 -17
- package/dist/fn/isActiveInterface.js +2 -3
- package/dist/fn/isArray.js +2 -7
- package/dist/fn/isBlob.js +2 -7
- package/dist/fn/isBoolean.js +2 -7
- package/dist/fn/isCanvas.js +2 -7
- package/dist/fn/isColor.js +2 -7
- package/dist/fn/isComment.js +2 -7
- package/dist/fn/isCp.js +3 -8
- package/dist/fn/isDate.js +2 -7
- package/dist/fn/isDesktopDevice.js +1 -1
- package/dist/fn/isDimension.js +2 -7
- package/dist/fn/isDom.js +2 -7
- package/dist/fn/isEmail.js +3 -8
- package/dist/fn/isEmpty.js +1 -1
- package/dist/fn/isEvent.js +2 -7
- package/dist/fn/isFocused.js +1 -1
- package/dist/fn/isFunction.js +2 -7
- package/dist/fn/isHostname.js +2 -7
- package/dist/fn/isIP.js +2 -7
- package/dist/fn/isInside.js +6 -6
- package/dist/fn/isInt.js +2 -7
- package/dist/fn/isIterable.js +1 -1
- package/dist/fn/isMobile.js +1 -1
- package/dist/fn/isMobileDevice.js +1 -1
- package/dist/fn/isNull.js +2 -7
- package/dist/fn/isNumber.js +2 -7
- package/dist/fn/isObject.js +2 -7
- package/dist/fn/isPercent.js +2 -7
- package/dist/fn/isPrimitive.js +2 -7
- package/dist/fn/isPromise.js +2 -7
- package/dist/fn/isPropSize.js +3 -3
- package/dist/fn/isSQLDate.js +2 -7
- package/dist/fn/isSame.js +7 -7
- package/dist/fn/isString.js +2 -7
- package/dist/fn/isSymbol.js +2 -7
- package/dist/fn/isTabletDevice.js +1 -1
- package/dist/fn/isURL.js +2 -7
- package/dist/fn/isValidDimension.js +3 -3
- package/dist/fn/isValidName.js +2 -7
- package/dist/fn/isValue.js +2 -7
- package/dist/fn/isVue.js +4 -11
- package/dist/fn/iterate.js +5 -8
- package/dist/fn/lightenDarkenHex.js +3 -3
- package/dist/fn/link.js +7 -11
- package/dist/fn/log.js +6 -10
- package/dist/fn/makeReactive.js +24 -28
- package/dist/fn/map.js +2 -3
- package/dist/fn/md5.js +1 -1
- package/dist/fn/money.js +5 -5
- package/dist/fn/move.js +2 -2
- package/dist/fn/multiorder.js +6 -7
- package/dist/fn/nl2br.js +1 -1
- package/dist/fn/numProperties.js +1 -1
- package/dist/fn/objectToFormData.js +5 -7
- package/dist/fn/order.js +1 -2
- package/dist/fn/outerHeight.js +3 -3
- package/dist/fn/outerWidth.js +3 -3
- package/dist/fn/percent.js +1 -1
- package/dist/fn/pickValue.js +1 -1
- package/dist/fn/post.js +3 -7
- package/dist/fn/postOut.js +2 -2
- package/dist/fn/printf.js +1 -1
- package/dist/fn/quotes2html.js +1 -1
- package/dist/fn/randomInt.js +1 -1
- package/dist/fn/randomString.js +6 -6
- package/dist/fn/removeAccents.js +1 -1
- package/dist/fn/removeEmpty.js +3 -3
- package/dist/fn/removeExtraSpaces.js +1 -1
- package/dist/fn/removeHtmlComments.js +1 -1
- package/dist/fn/removePrivateProp.js +2 -3
- package/dist/fn/removeTrailingChars.js +1 -1
- package/dist/fn/repeat.js +1 -1
- package/dist/fn/replaceAll.js +1 -2
- package/dist/fn/replaceSelection.js +6 -6
- package/dist/fn/resize.js +15 -15
- package/dist/fn/rgb2hex.js +1 -1
- package/dist/fn/riterate.js +1 -1
- package/dist/fn/roundDecimal.js +1 -1
- package/dist/fn/sanitize.js +6 -7
- package/dist/fn/search.js +6 -9
- package/dist/fn/selectElementText.js +4 -4
- package/dist/fn/selector.js +1 -1
- package/dist/fn/setCookie.js +4 -4
- package/dist/fn/setCssVar.js +1 -1
- package/dist/fn/setNavigationVars.js +5 -5
- package/dist/fn/setProp.js +1 -3
- package/dist/fn/setProperty.js +9 -9
- package/dist/fn/shorten.js +1 -1
- package/dist/fn/shortenObj.js +3 -4
- package/dist/fn/shuffle.js +3 -4
- package/dist/fn/simpleHash.js +3 -3
- package/dist/fn/simpleHash1.js +4 -4
- package/dist/fn/simpleHash2.js +4 -4
- package/dist/fn/stat.js +1 -1
- package/dist/fn/string2ArrayBuffer.js +1 -1
- package/dist/fn/submit.js +3 -3
- package/dist/fn/substr.js +1 -1
- package/dist/fn/sum.js +4 -4
- package/dist/fn/timestamp.js +1 -1
- package/dist/fn/toCSV.js +7 -10
- package/dist/fn/toggleFullScreen.js +1 -1
- package/dist/fn/translate.js +3 -3
- package/dist/fn/treatAjaxArguments.js +4 -4
- package/dist/fn/trim.js +1 -2
- package/dist/fn/uniqString.js +7 -14
- package/dist/fn/unique.js +1 -1
- package/dist/fn/upload.js +6 -6
- package/dist/fn/warning.js +3 -3
- package/dist/index.js +237 -241
- package/package.json +1 -1
package/dist/fn/_addLoader.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { substr } from './substr';
|
|
2
|
-
|
|
2
|
+
const _addLoader = function (requestId, prom, source) {
|
|
3
3
|
/** @var {Number} tst Current timestamp */
|
|
4
|
-
|
|
4
|
+
let tst = (new Date()).getTime();
|
|
5
5
|
/** @var {String} url The original URL (part of requestId before : and md5) */
|
|
6
|
-
|
|
6
|
+
let url = substr(requestId, 0, requestId.length - 33);
|
|
7
7
|
/** @var {Object} loader The loader object */
|
|
8
|
-
|
|
8
|
+
let loader = {
|
|
9
9
|
key: requestId,
|
|
10
10
|
url: url,
|
|
11
11
|
loader: prom,
|
|
@@ -22,7 +22,7 @@ var _addLoader = function (requestId, prom, source) {
|
|
|
22
22
|
// Adding an object with this loader info in bbn.env.loadersHistory
|
|
23
23
|
bbn.env.loadersHistory.unshift(loader);
|
|
24
24
|
/** @var {Number} idx A pointer starting at the end of array loadersHistory */
|
|
25
|
-
|
|
25
|
+
let idx = bbn.env.loadersHistory.length;
|
|
26
26
|
// Removing elements from the loadersHistory object if their number is higher
|
|
27
27
|
// than bbn.env.maxLoadersHistory
|
|
28
28
|
while (idx && (bbn.env.loadersHistory.length > bbn.env.maxLoadersHistory)) {
|
|
@@ -2,9 +2,8 @@ import { getProperty } from './getProperty';
|
|
|
2
2
|
import { isString } from './isString';
|
|
3
3
|
import { removeAccents } from './removeAccents';
|
|
4
4
|
import { isDate } from './isDate';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var va = getProperty(a, prop), vb = getProperty(b, prop), ta = (typeof (va)).toLowerCase(), tb = (typeof (vb)).toLowerCase();
|
|
5
|
+
const _compareValues = function (a, b, prop, dir = 'asc') {
|
|
6
|
+
let va = getProperty(a, prop), vb = getProperty(b, prop), ta = (typeof (va)).toLowerCase(), tb = (typeof (vb)).toLowerCase();
|
|
8
7
|
if ((dir !== 'asc') && isString(dir) && (dir.toLowerCase() === 'desc')) {
|
|
9
8
|
dir = 'desc';
|
|
10
9
|
}
|
package/dist/fn/_deleteLoader.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { search } from './search';
|
|
2
2
|
import { getRow } from './getRow';
|
|
3
3
|
import { isObject } from './isObject';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (isAbort === void 0) { isAbort = false; }
|
|
7
|
-
var idx = search(bbn.env.loaders, { key: requestId });
|
|
4
|
+
const _deleteLoader = function (requestId, res = null, isAbort = false) {
|
|
5
|
+
let idx = search(bbn.env.loaders, { key: requestId });
|
|
8
6
|
if (idx > -1) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
let loader = bbn.env.loaders.splice(idx, 1)[0];
|
|
8
|
+
let history = getRow(bbn.env.loadersHistory, { key: requestId, start: loader.start });
|
|
9
|
+
if (history) {
|
|
10
|
+
history.loading = false;
|
|
11
|
+
history.duration = new Date().getTime() - loader.start;
|
|
14
12
|
if (typeof res === 'string') {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
history.errorMessage = res;
|
|
14
|
+
history.error = !isAbort;
|
|
15
|
+
history.abort = isAbort;
|
|
18
16
|
}
|
|
19
17
|
else if (isObject(res)) {
|
|
20
|
-
|
|
18
|
+
history.success = true;
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
return true;
|
package/dist/fn/abort.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getLoader } from './getLoader';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const abort = function (requestId) {
|
|
3
|
+
let loader = getLoader(requestId);
|
|
4
4
|
if (loader && loader.source) {
|
|
5
5
|
//this._deleteLoader(requestId);
|
|
6
6
|
loader.source.cancel('Operation canceled by the user.');
|
package/dist/fn/abortURL.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { each } from './each';
|
|
2
2
|
import { filter } from './filter';
|
|
3
|
-
|
|
4
|
-
each(filter(bbn.env.loaders, { url: url }),
|
|
3
|
+
const abortURL = function (url) {
|
|
4
|
+
each(filter(bbn.env.loaders, { url: url }), (a) => {
|
|
5
5
|
if (a && a.source) {
|
|
6
6
|
a.source.cancel('Operation canceled by the user.');
|
|
7
7
|
}
|
package/dist/fn/addColors.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { numProperties } from './numProperties';
|
|
2
2
|
import { iterate } from './iterate';
|
|
3
|
-
|
|
3
|
+
const addColors = function (colors) {
|
|
4
4
|
if (numProperties(colors)) {
|
|
5
5
|
if (!bbn.vars.colors) {
|
|
6
6
|
bbn.vars.colors = {};
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
let element = document.createElement('style');
|
|
9
9
|
document.head.appendChild(element);
|
|
10
|
-
|
|
10
|
+
let sheet = element.sheet;
|
|
11
11
|
// Append style element to head
|
|
12
|
-
|
|
13
|
-
iterate(colors,
|
|
12
|
+
let i = 0;
|
|
13
|
+
iterate(colors, (v, n) => {
|
|
14
14
|
bbn.vars.colors[n] = v;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
sheet.insertRule('.bbn-' + n + ', .bbn-color-text-' + n + ' {color: ' + v + ' !important;}', i);
|
|
16
|
+
sheet.insertRule('svg.bbn-' +
|
|
17
17
|
n +
|
|
18
18
|
', .bbn-' +
|
|
19
19
|
n +
|
|
@@ -23,8 +23,8 @@ var addColors = function (colors) {
|
|
|
23
23
|
n +
|
|
24
24
|
' svg {fill: ' +
|
|
25
25
|
v +
|
|
26
|
-
';}',
|
|
27
|
-
|
|
26
|
+
';}', i);
|
|
27
|
+
sheet.insertRule('.bbn-bg-' +
|
|
28
28
|
n +
|
|
29
29
|
', .bbn-color-bg-' +
|
|
30
30
|
n +
|
|
@@ -32,9 +32,9 @@ var addColors = function (colors) {
|
|
|
32
32
|
n +
|
|
33
33
|
' {background-color: ' +
|
|
34
34
|
v +
|
|
35
|
-
' !important;}',
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
' !important;}', i);
|
|
36
|
+
sheet.insertRule('.bbn-border-' + n + ', .bbn-color-border-' + n + ' {border-color: ' + v + ' !important;}', i);
|
|
37
|
+
sheet.insertRule('.bbn-color-' + n + ' {border-color: ' + v + '; background-color: ' + v + '; color: ' + v + ';}', i);
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
};
|
package/dist/fn/addInputs.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { iterate } from './iterate';
|
|
2
|
-
|
|
3
|
-
if (params === void 0) { params = null; }
|
|
4
|
-
if (prefix === void 0) { prefix = ''; }
|
|
2
|
+
const addInputs = function (form, params = null, prefix = '') {
|
|
5
3
|
if (form && form.tagName === 'FORM') {
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
let appendToForm = (name, val) => {
|
|
5
|
+
let input = document.createElement('input');
|
|
8
6
|
input.setAttribute('type', 'hidden');
|
|
9
7
|
input.setAttribute('name', name);
|
|
10
8
|
input.setAttribute('value', val);
|
|
@@ -13,19 +11,19 @@ var addInputs = function (form, params, prefix) {
|
|
|
13
11
|
params = JSON.parse(JSON.stringify(params || {}));
|
|
14
12
|
prefix = prefix || '';
|
|
15
13
|
if (params) {
|
|
16
|
-
iterate(params,
|
|
17
|
-
|
|
14
|
+
iterate(params, (param, key) => {
|
|
15
|
+
let name = prefix ? `${prefix}[${key}]` : key;
|
|
18
16
|
if (param instanceof Date) {
|
|
19
|
-
|
|
17
|
+
appendToForm(name, param.toISOString());
|
|
20
18
|
}
|
|
21
19
|
else if (param instanceof Array) {
|
|
22
|
-
param.forEach(
|
|
23
|
-
|
|
20
|
+
param.forEach((e, i) => {
|
|
21
|
+
const tempName = `${name}[${i}]`;
|
|
24
22
|
if (typeof e === 'object') {
|
|
25
23
|
addInputs(form, e, tempName);
|
|
26
24
|
}
|
|
27
25
|
else {
|
|
28
|
-
|
|
26
|
+
appendToForm(tempName, e.toString());
|
|
29
27
|
}
|
|
30
28
|
});
|
|
31
29
|
}
|
|
@@ -33,7 +31,7 @@ var addInputs = function (form, params, prefix) {
|
|
|
33
31
|
addInputs(form, param, name);
|
|
34
32
|
}
|
|
35
33
|
else {
|
|
36
|
-
|
|
34
|
+
appendToForm(name, param.toString());
|
|
37
35
|
}
|
|
38
36
|
});
|
|
39
37
|
}
|
package/dist/fn/addStyle.js
CHANGED
package/dist/fn/adjustHeight.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isIterable } from './isIterable';
|
|
2
2
|
import { adjustSize } from './adjustSize';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const adjustHeight = function () {
|
|
4
|
+
let args = arguments;
|
|
5
5
|
if (args.length === 1 && isIterable(args[0])) {
|
|
6
6
|
args = args[0];
|
|
7
7
|
}
|
package/dist/fn/adjustSize.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { each } from './each';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
each(eles,
|
|
2
|
+
const adjustSize = function (type, eles) {
|
|
3
|
+
let max = 0, idx;
|
|
4
|
+
each(eles, (el) => {
|
|
5
5
|
el.style[type] = 'auto';
|
|
6
6
|
});
|
|
7
|
-
each(eles,
|
|
8
|
-
|
|
7
|
+
each(eles, (el, i) => {
|
|
8
|
+
let rect = el.getBoundingClientRect(), s = rect[type] % 1 ? rect[type] - (rect[type] % 1) + 1 : rect[type];
|
|
9
9
|
//s = rect[type];
|
|
10
10
|
if (s > max) {
|
|
11
11
|
max = s;
|
|
12
12
|
idx = i;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
each(eles,
|
|
15
|
+
each(eles, (el, i) => {
|
|
16
16
|
if (max) {
|
|
17
17
|
el.style[type] = max + 'px';
|
|
18
18
|
}
|
package/dist/fn/adjustWidth.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isIterable } from './isIterable';
|
|
2
2
|
import { adjustSize } from './adjustSize';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const adjustWidth = function () {
|
|
4
|
+
let args = arguments;
|
|
5
5
|
if (args.length === 1 && isIterable(args[0])) {
|
|
6
6
|
args = args[0];
|
|
7
7
|
}
|
package/dist/fn/ajax.js
CHANGED
|
@@ -11,7 +11,7 @@ import { defaultAjaxErrorFunction } from './defaultAjaxErrorFunction';
|
|
|
11
11
|
import { defaultAjaxAbortFunction } from './defaultAjaxAbortFunction';
|
|
12
12
|
import { _addLoader } from './_addLoader';
|
|
13
13
|
import { defaultStartLoadingFunction } from './defaultStartLoadingFunction';
|
|
14
|
-
|
|
14
|
+
const ajax = function (url, datatype, data, success, failure, abort) {
|
|
15
15
|
if (arguments.length === 1 && url && typeof url === 'object' && url.url) {
|
|
16
16
|
if (url.abort) {
|
|
17
17
|
abort = url.abort;
|
|
@@ -41,8 +41,8 @@ var ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
41
41
|
if (!datatype) {
|
|
42
42
|
datatype = 'json';
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
let requestId = getRequestId(url, data, datatype);
|
|
45
|
+
let loaderObj = getLoader(requestId);
|
|
46
46
|
//log("IN AJAX", loaderObj? loaderObj.loader : "NO LOADER")
|
|
47
47
|
if (loaderObj && loaderObj.loader) {
|
|
48
48
|
return loaderObj.loader;
|
|
@@ -50,9 +50,9 @@ var ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
50
50
|
if (bbn.env.token) {
|
|
51
51
|
extend(data || {}, { _bbn_token: bbn.env.token });
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
let cancelToken = axios.CancelToken;
|
|
54
|
+
let source = cancelToken.source();
|
|
55
|
+
let options = {
|
|
56
56
|
responseType: datatype,
|
|
57
57
|
cancelToken: source.token,
|
|
58
58
|
};
|
|
@@ -62,16 +62,16 @@ var ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
62
62
|
'Content-Type': 'text/javascript',
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
let args = [url];
|
|
66
66
|
if (isObject(data) && numProperties(data) > 0) {
|
|
67
67
|
args.push(data);
|
|
68
68
|
}
|
|
69
69
|
args.push(options);
|
|
70
|
-
|
|
70
|
+
let loader = axios[args.length === 2 ? 'get' : 'post']
|
|
71
71
|
.apply(axios, args)
|
|
72
|
-
.then(
|
|
73
|
-
_deleteLoader(
|
|
74
|
-
defaultEndLoadingFunction(url,
|
|
72
|
+
.then((res) => {
|
|
73
|
+
_deleteLoader(requestId, res);
|
|
74
|
+
defaultEndLoadingFunction(url, tst, data, res);
|
|
75
75
|
switch (res.status) {
|
|
76
76
|
case 200:
|
|
77
77
|
if (isFunction(success)) {
|
|
@@ -79,16 +79,16 @@ var ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
79
79
|
}
|
|
80
80
|
break;
|
|
81
81
|
default:
|
|
82
|
-
defaultAjaxErrorFunction(
|
|
82
|
+
defaultAjaxErrorFunction(loader, res);
|
|
83
83
|
}
|
|
84
84
|
return res;
|
|
85
85
|
})
|
|
86
|
-
.catch(
|
|
87
|
-
|
|
88
|
-
_deleteLoader(
|
|
89
|
-
defaultEndLoadingFunction(url,
|
|
86
|
+
.catch((err) => {
|
|
87
|
+
let isAbort = axios.isCancel(err);
|
|
88
|
+
_deleteLoader(requestId, err.message || err.response.data, isAbort);
|
|
89
|
+
defaultEndLoadingFunction(url, tst, data, err);
|
|
90
90
|
if (isAbort) {
|
|
91
|
-
|
|
91
|
+
let ok = 1;
|
|
92
92
|
if (isFunction(abort)) {
|
|
93
93
|
ok = abort(err.message, url);
|
|
94
94
|
}
|
|
@@ -97,7 +97,7 @@ var ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
else {
|
|
100
|
-
|
|
100
|
+
let ok = 1;
|
|
101
101
|
if (isFunction(failure)) {
|
|
102
102
|
ok = failure(err.request, err);
|
|
103
103
|
}
|
|
@@ -106,9 +106,9 @@ var ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
-
|
|
110
|
-
defaultStartLoadingFunction(url,
|
|
111
|
-
return
|
|
109
|
+
let tst = _addLoader(requestId, loader, source);
|
|
110
|
+
defaultStartLoadingFunction(url, tst, data, requestId);
|
|
111
|
+
return loader;
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
export { ajax };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { md5 } from './md5';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
for (
|
|
2
|
+
const analyzeFunction = function (fn) {
|
|
3
|
+
const functionString = fn.toString();
|
|
4
|
+
let all = functionString.split('');
|
|
5
|
+
let exp = '';
|
|
6
|
+
let isArrow = false;
|
|
7
|
+
let isAsync = false;
|
|
8
|
+
let hasFunction = false;
|
|
9
|
+
let name = null;
|
|
10
|
+
let parOpened = 0;
|
|
11
|
+
let parClosed = 0;
|
|
12
|
+
let args = [];
|
|
13
|
+
let currentArg = {};
|
|
14
|
+
let body;
|
|
15
|
+
let currentQuote = '';
|
|
16
|
+
let escapable = ['"', "'", '`'];
|
|
17
|
+
let isEscaped = false;
|
|
18
|
+
let settingDefault = false;
|
|
19
|
+
for (let i = 0; i < all.length; i++) {
|
|
20
20
|
if (all[i] === currentQuote && !isEscaped && currentQuote) {
|
|
21
21
|
currentQuote = '';
|
|
22
22
|
exp += all[i];
|
|
@@ -125,17 +125,17 @@ var analyzeFunction = function (fn) {
|
|
|
125
125
|
throw Error('Unexpected end of function while parsing function');
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
const argString = args.map((arg) => arg.name + (arg.default ? ' = ' + arg.default : '')).join(', ');
|
|
129
|
+
const hash = md5(body + (name ? '-' + name : '') + (argString ? '-' + argString : ''));
|
|
130
130
|
return {
|
|
131
|
-
body
|
|
132
|
-
args
|
|
133
|
-
argString
|
|
134
|
-
isArrow
|
|
135
|
-
hasFunction
|
|
136
|
-
name
|
|
137
|
-
isAsync
|
|
138
|
-
hash
|
|
131
|
+
body,
|
|
132
|
+
args,
|
|
133
|
+
argString,
|
|
134
|
+
isArrow,
|
|
135
|
+
hasFunction,
|
|
136
|
+
name,
|
|
137
|
+
isAsync,
|
|
138
|
+
hash,
|
|
139
139
|
};
|
|
140
140
|
};
|
|
141
141
|
export { analyzeFunction };
|
package/dist/fn/animateCss.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
|
|
1
|
+
const animateCss = function (ele, animationName, callback) {
|
|
2
|
+
let animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
|
|
4
3
|
/*$(ele).addClass('animated ' + animationName).one(animationEnd, function(){
|
|
5
4
|
if ( typeof callback == 'function' ){ // make sure the callback is a function
|
|
6
5
|
callback.call(this); // brings the scope to the callback
|
|
@@ -9,13 +8,13 @@ var animateCss = function (ele, animationName, callback) {
|
|
|
9
8
|
})*/
|
|
10
9
|
ele.classList.add('animated');
|
|
11
10
|
ele.classList.add(animationName);
|
|
12
|
-
ele.addEventListener(animationEnd,
|
|
11
|
+
ele.addEventListener(animationEnd, (e) => {
|
|
13
12
|
e.target.removeEventListener(e.type, arguments.callee);
|
|
14
13
|
if (typeof callback == 'function') {
|
|
15
14
|
// make sure the callback is a function
|
|
16
|
-
callback.call(
|
|
15
|
+
callback.call(this); // brings the scope to the callback
|
|
17
16
|
}
|
|
18
|
-
|
|
17
|
+
this.classList.remove(animationName);
|
|
19
18
|
});
|
|
20
19
|
};
|
|
21
20
|
export { animateCss };
|
package/dist/fn/arrayFromProp.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { each } from './each';
|
|
2
2
|
import { getProperty } from './getProperty';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
each(arr,
|
|
3
|
+
const arrayFromProp = function (arr, prop) {
|
|
4
|
+
let r = [];
|
|
5
|
+
each(arr, (a, i) => {
|
|
6
6
|
r.push(getProperty(a, prop));
|
|
7
7
|
});
|
|
8
8
|
return r;
|
package/dist/fn/autoExtend.js
CHANGED
package/dist/fn/baseName.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { isString } from './isString';
|
|
2
2
|
import { substr } from './substr';
|
|
3
|
-
|
|
3
|
+
const baseName = function (path, suffix) {
|
|
4
4
|
if (path && isString(path)) {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
let bits = path.split('/');
|
|
6
|
+
let res = bits.pop();
|
|
7
7
|
if (!suffix) {
|
|
8
8
|
return res;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
let len = suffix.length;
|
|
11
11
|
if (res && substr(res, -len) === suffix) {
|
|
12
12
|
return substr(res, 0, res.length - len);
|
|
13
13
|
}
|
package/dist/fn/br2nl.js
CHANGED
package/dist/fn/calendar.js
CHANGED
|
@@ -3,11 +3,11 @@ import { date } from './date';
|
|
|
3
3
|
import { isDate } from './isDate';
|
|
4
4
|
import { isString } from './isString';
|
|
5
5
|
dayjs.extend(window['dayjs_plugin_calendar']);
|
|
6
|
-
|
|
6
|
+
const calendar = function (d, wrong_result) {
|
|
7
7
|
if (undefined === dayjs) {
|
|
8
8
|
return fdate(d, wrong_result);
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
let r = date(d);
|
|
11
11
|
if (!isDate(r)) {
|
|
12
12
|
return wrong_result && isString(wrong_result) ? wrong_result : '';
|
|
13
13
|
}
|
package/dist/fn/callback.js
CHANGED
|
@@ -4,17 +4,13 @@ import { isFunction } from './isFunction';
|
|
|
4
4
|
import { log } from './log';
|
|
5
5
|
import { defaultPostLinkFunction } from './defaultPostLinkFunction';
|
|
6
6
|
import { defaultAlertFunction } from './defaultAlertFunction';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (fn === void 0) { fn = null; }
|
|
10
|
-
if (fn2 === void 0) { fn2 = null; }
|
|
11
|
-
if (ele === void 0) { ele = null; }
|
|
12
|
-
var tmp = false;
|
|
7
|
+
const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
|
|
8
|
+
let tmp = false;
|
|
13
9
|
if (res) {
|
|
14
10
|
tmp = true;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
let t = typeof res;
|
|
12
|
+
let isObj = t.toLowerCase() === 'object';
|
|
13
|
+
let errTitle;
|
|
18
14
|
if (isObj && res.prescript) {
|
|
19
15
|
/* var ok can be changed to false in prescript execution */
|
|
20
16
|
try {
|
|
@@ -47,8 +43,8 @@ var callback = function (url, res, fn, fn2, ele) {
|
|
|
47
43
|
tmp = res.script(res.data ? res.data : {}, ele || null);
|
|
48
44
|
}
|
|
49
45
|
else {
|
|
50
|
-
tmp = (
|
|
51
|
-
|
|
46
|
+
tmp = ((data, ele) => {
|
|
47
|
+
let r = null;
|
|
52
48
|
try {
|
|
53
49
|
r = eval(res.script);
|
|
54
50
|
if (isFunction(r)) {
|
package/dist/fn/camelToCss.js
CHANGED
package/dist/fn/camelize.js
CHANGED
package/dist/fn/canvasToImage.js
CHANGED
package/dist/fn/center.js
CHANGED
package/dist/fn/checkProps.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { checkPropsDetails } from './checkPropsDetails';
|
|
2
|
-
|
|
3
|
-
if (checkEmpty === void 0) { checkEmpty = false; }
|
|
2
|
+
const checkProps = function (obj, props, checkEmpty = false) {
|
|
4
3
|
return checkPropsDetails(obj, props, checkEmpty).result;
|
|
5
4
|
};
|
|
6
5
|
export { checkProps };
|
|
@@ -2,9 +2,8 @@ import { isArray } from './isArray';
|
|
|
2
2
|
import { isObject } from './isObject';
|
|
3
3
|
import { each } from './each';
|
|
4
4
|
import { substr } from './substr';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var res = {
|
|
5
|
+
const checkPropsDetails = function (obj, props, checkEmpty = false) {
|
|
6
|
+
let res = {
|
|
8
7
|
error: false,
|
|
9
8
|
result: true,
|
|
10
9
|
};
|
|
@@ -18,20 +17,20 @@ var checkPropsDetails = function (obj, props, checkEmpty) {
|
|
|
18
17
|
res.error = bbn._('checkProps must receive an object as obj argument');
|
|
19
18
|
}
|
|
20
19
|
if (!res.error) {
|
|
21
|
-
|
|
22
|
-
each(props,
|
|
20
|
+
let check;
|
|
21
|
+
each(props, (varName) => {
|
|
23
22
|
varName = varName.trim().split(':');
|
|
24
|
-
|
|
23
|
+
let type = varName[1] || false;
|
|
25
24
|
varName = varName[0];
|
|
26
25
|
if (obj[varName] === undefined) {
|
|
27
26
|
res.error = varName + ' ' + bbn._('is not defined');
|
|
28
27
|
}
|
|
29
28
|
else if (type) {
|
|
30
|
-
|
|
31
|
-
if (bbn.fn[
|
|
29
|
+
check = 'is' + substr(type, 0, 1).toUpperCase() + substr(type, 1).toLowerCase();
|
|
30
|
+
if (bbn.fn[check] === undefined) {
|
|
32
31
|
res.error = type + ' ' + bbn._('is not a valid type');
|
|
33
32
|
}
|
|
34
|
-
else if (!bbn.fn[
|
|
33
|
+
else if (!bbn.fn[check](obj[varName])) {
|
|
35
34
|
res.error = varName + ' ' + bbn._('is not a') + ' ' + type;
|
|
36
35
|
}
|
|
37
36
|
}
|