@bbn/bbn 1.0.15 → 1.0.17
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 +32 -32
- package/dist/bundle.js +1216 -419
- package/dist/fn/_addLoader.js +21 -1
- package/dist/fn/abort.js +12 -3
- package/dist/fn/addColors.js +11 -3
- package/dist/fn/addInputs.js +9 -2
- package/dist/fn/addStyle.js +7 -3
- package/dist/fn/adjustSize.js +19 -6
- package/dist/fn/ajax.js +16 -5
- package/dist/fn/analyzeFunction.js +10 -1
- package/dist/fn/animateCss.js +8 -2
- package/dist/fn/arrayBuffer2String.js +3 -1
- package/dist/fn/arrayFromProp.js +7 -1
- package/dist/fn/autoExtend.js +2 -0
- package/dist/fn/br2nl.js +3 -1
- package/dist/fn/calendar.js +8 -1
- package/dist/fn/callback.js +4 -2
- package/dist/fn/camelToCss.js +7 -1
- package/dist/fn/canvasToImage.js +5 -1
- package/dist/fn/center.js +12 -1
- package/dist/fn/checkProps.js +3 -1
- package/dist/fn/checkPropsDetails.js +4 -1
- package/dist/fn/clone.js +3 -1
- package/dist/fn/colorToHex.js +5 -1
- package/dist/fn/compare.js +28 -15
- package/dist/fn/compareConditions.js +1 -0
- package/dist/fn/copy.js +8 -2
- package/dist/fn/correctCase.js +3 -1
- package/dist/fn/count.js +3 -1
- package/dist/fn/crc32.js +1 -1
- package/dist/fn/cssExists.js +2 -0
- package/dist/fn/dateSQL.js +6 -3
- package/dist/fn/deepPath.js +9 -7
- package/dist/fn/defaultAjaxAbortFunction.js +3 -1
- package/dist/fn/defaultAjaxErrorFunction.d.ts +1 -1
- package/dist/fn/defaultAjaxErrorFunction.js +15 -2
- package/dist/fn/defaultAlertFunction.d.ts +1 -1
- package/dist/fn/defaultAlertFunction.js +5 -1
- package/dist/fn/defaultEndLoadingFunction.d.ts +1 -1
- package/dist/fn/defaultEndLoadingFunction.js +19 -1
- package/dist/fn/defaultErrorFunction.js +3 -1
- package/dist/fn/defaultHistoryFunction.js +3 -1
- package/dist/fn/defaultLinkFunction.js +3 -1
- package/dist/fn/defaultPostLinkFunction.js +3 -1
- package/dist/fn/defaultPreLinkFunction.d.ts +1 -1
- package/dist/fn/defaultPreLinkFunction.js +11 -1
- package/dist/fn/defaultResizeFunction.js +3 -1
- package/dist/fn/defaultStartLoadingFunction.d.ts +1 -1
- package/dist/fn/defaultStartLoadingFunction.js +14 -1
- package/dist/fn/deleteProp.js +5 -1
- package/dist/fn/diffObj.js +20 -5
- package/dist/fn/download.js +4 -1
- package/dist/fn/downloadContent.js +12 -1
- package/dist/fn/eraseCookie.js +3 -1
- package/dist/fn/error.js +5 -1
- package/dist/fn/escapeRegExp.js +3 -1
- package/dist/fn/escapeUrl.js +3 -1
- package/dist/fn/extend.js +6 -1
- package/dist/fn/fdate.js +1 -0
- package/dist/fn/fdatetime.js +10 -1
- package/dist/fn/filter.js +10 -6
- package/dist/fn/filterToConditions.js +8 -2
- package/dist/fn/findAll.js +5 -3
- package/dist/fn/format.js +5 -1
- package/dist/fn/formatDate.js +3 -1
- package/dist/fn/formdata.js +7 -2
- package/dist/fn/ftime.js +3 -1
- package/dist/fn/getAllTags.js +3 -1
- package/dist/fn/getAttributes.js +3 -1
- package/dist/fn/getBrowserName.js +20 -10
- package/dist/fn/getBrowserVersion.js +21 -10
- package/dist/fn/getEventData.js +26 -6
- package/dist/fn/getField.js +1 -2
- package/dist/fn/getPath.js +14 -3
- package/dist/fn/getProp.js +5 -1
- package/dist/fn/getRequestId.js +5 -3
- package/dist/fn/getScrollBarSize.js +4 -1
- package/dist/fn/getText.js +3 -1
- package/dist/fn/happy.js +8 -1
- package/dist/fn/hash.js +2 -1
- package/dist/fn/hex2rgb.js +8 -1
- package/dist/fn/history.js +3 -1
- package/dist/fn/html2text.js +6 -1
- package/dist/fn/imageToCanvas.js +7 -1
- package/dist/fn/imgToBase64.js +4 -1
- package/dist/fn/info.js +9 -1
- package/dist/fn/init.js +72 -14
- package/dist/fn/isArray.d.ts +1 -1
- package/dist/fn/isArray.js +3 -3
- package/dist/fn/isBlob.d.ts +1 -1
- package/dist/fn/isBlob.js +3 -3
- package/dist/fn/isBoolean.d.ts +1 -1
- package/dist/fn/isBoolean.js +3 -3
- package/dist/fn/isCanvas.d.ts +1 -1
- package/dist/fn/isCanvas.js +3 -3
- package/dist/fn/isComment.d.ts +1 -1
- package/dist/fn/isComment.js +3 -3
- package/dist/fn/isCp.d.ts +1 -1
- package/dist/fn/isCp.js +3 -3
- package/dist/fn/isDate.d.ts +1 -1
- package/dist/fn/isDate.js +3 -3
- package/dist/fn/isDesktopDevice.js +3 -1
- package/dist/fn/isDom.d.ts +1 -1
- package/dist/fn/isDom.js +3 -3
- package/dist/fn/isEvent.d.ts +1 -1
- package/dist/fn/isEvent.js +3 -3
- package/dist/fn/isFocused.js +3 -1
- package/dist/fn/isFunction.d.ts +1 -1
- package/dist/fn/isFunction.js +3 -3
- package/dist/fn/isHostname.d.ts +1 -1
- package/dist/fn/isHostname.js +10 -5
- package/dist/fn/isIP.d.ts +1 -1
- package/dist/fn/isIP.js +10 -3
- package/dist/fn/isInside.js +6 -4
- package/dist/fn/isInt.d.ts +1 -1
- package/dist/fn/isInt.js +3 -3
- package/dist/fn/isIterable.js +3 -1
- package/dist/fn/isMobile.js +3 -1
- package/dist/fn/isMobileDevice.js +3 -1
- package/dist/fn/isNull.d.ts +1 -1
- package/dist/fn/isNull.js +3 -3
- package/dist/fn/isNumber.d.ts +1 -1
- package/dist/fn/isNumber.js +3 -3
- package/dist/fn/isObject.d.ts +1 -1
- package/dist/fn/isObject.js +3 -3
- package/dist/fn/isPercent.d.ts +1 -1
- package/dist/fn/isPercent.js +3 -3
- package/dist/fn/isPrimitive.d.ts +1 -1
- package/dist/fn/isPrimitive.js +3 -3
- package/dist/fn/isPromise.d.ts +1 -1
- package/dist/fn/isPromise.js +3 -3
- package/dist/fn/isPropSize.js +10 -4
- package/dist/fn/isSQLDate.d.ts +1 -1
- package/dist/fn/isSQLDate.js +5 -4
- package/dist/fn/isSame.js +7 -4
- package/dist/fn/isString.d.ts +1 -1
- package/dist/fn/isString.js +3 -3
- package/dist/fn/isSymbol.d.ts +1 -1
- package/dist/fn/isSymbol.js +3 -3
- package/dist/fn/isTabletDevice.js +3 -1
- package/dist/fn/isURL.d.ts +1 -1
- package/dist/fn/isURL.js +10 -1
- package/dist/fn/isValidDimension.js +3 -1
- package/dist/fn/isValidName.d.ts +1 -1
- package/dist/fn/isValidName.js +3 -3
- package/dist/fn/isValue.d.ts +1 -1
- package/dist/fn/isValue.js +3 -3
- package/dist/fn/isVue.d.ts +1 -1
- package/dist/fn/isVue.js +5 -5
- package/dist/fn/iterate.js +5 -3
- package/dist/fn/link.js +24 -3
- package/dist/fn/makeReactive.js +47 -11
- package/dist/fn/md5.js +12 -3
- package/dist/fn/money.js +26 -0
- package/dist/fn/nl2br.js +3 -1
- package/dist/fn/objectToFormData.js +8 -4
- package/dist/fn/order.js +3 -1
- package/dist/fn/percent.js +3 -1
- package/dist/fn/pickValue.js +5 -3
- package/dist/fn/post.js +8 -3
- package/dist/fn/printf.js +8 -1
- package/dist/fn/randomInt.js +3 -1
- package/dist/fn/randomString.js +9 -2
- package/dist/fn/removeExtraSpaces.js +3 -1
- package/dist/fn/repeat.js +7 -1
- package/dist/fn/replaceSelection.js +6 -0
- package/dist/fn/riterate.js +3 -1
- package/dist/fn/roundDecimal.js +3 -1
- package/dist/fn/search.js +17 -2
- package/dist/fn/selector.js +3 -1
- package/dist/fn/setNavigationVars.js +20 -2
- package/dist/fn/setProp.js +9 -1
- package/dist/fn/shorten.js +1 -1
- package/dist/fn/shuffle.js +6 -1
- package/dist/fn/simpleHash.js +5 -1
- package/dist/fn/simpleHash1.js +1 -1
- package/dist/fn/simpleHash2.js +1 -1
- package/dist/fn/startChrono.js +5 -3
- package/dist/fn/stat.js +4 -2
- package/dist/fn/stopChrono.js +7 -5
- package/dist/fn/string2ArrayBuffer.js +1 -1
- package/dist/fn/submit.js +12 -1
- package/dist/fn/sum.js +11 -3
- package/dist/fn/timestamp.js +4 -1
- package/dist/fn/toggleFullScreen.js +3 -1
- package/dist/fn/translate.js +6 -1
- package/dist/fn/treatAjaxArguments.js +8 -0
- package/dist/fn/uniqString.d.ts +1 -1
- package/dist/fn/uniqString.js +14 -11
- package/dist/fn/unique.js +5 -1
- package/dist/fn/upload.js +20 -9
- package/dist/fn/warning.js +10 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/fn/_addLoader.js
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
import { substr } from './substr';
|
|
2
2
|
const _addLoader = function (requestId, prom, source) {
|
|
3
|
+
/** @var {Number} tst Current timestamp */
|
|
3
4
|
let tst = (new Date()).getTime();
|
|
5
|
+
/** @var {String} url The original URL (part of requestId before : and md5) */
|
|
4
6
|
let url = substr(requestId, 0, requestId.length - 33);
|
|
5
|
-
|
|
7
|
+
/** @var {Object} loader The loader object */
|
|
8
|
+
let loader = {
|
|
9
|
+
key: requestId,
|
|
10
|
+
url: url,
|
|
11
|
+
loader: prom,
|
|
12
|
+
source: source,
|
|
13
|
+
loading: true,
|
|
14
|
+
error: false,
|
|
15
|
+
abort: false,
|
|
16
|
+
errorMessage: false,
|
|
17
|
+
success: false,
|
|
18
|
+
start: tst
|
|
19
|
+
};
|
|
20
|
+
// Adding the loader in bbn.env.loaders
|
|
6
21
|
bbn.env.loaders.push(loader);
|
|
22
|
+
// Adding an object with this loader info in bbn.env.loadersHistory
|
|
7
23
|
bbn.env.loadersHistory.unshift(loader);
|
|
24
|
+
/** @var {Number} idx A pointer starting at the end of array loadersHistory */
|
|
8
25
|
let idx = bbn.env.loadersHistory.length;
|
|
26
|
+
// Removing elements from the loadersHistory object if their number is higher
|
|
27
|
+
// than bbn.env.maxLoadersHistory
|
|
9
28
|
while (idx && (bbn.env.loadersHistory.length > bbn.env.maxLoadersHistory)) {
|
|
10
29
|
idx--;
|
|
30
|
+
// Not removing the ones still loading
|
|
11
31
|
if (!bbn.env.loadersHistory.loading) {
|
|
12
32
|
bbn.env.loadersHistory.splice(idx, 1);
|
|
13
33
|
}
|
package/dist/fn/abort.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { getLoader } from './getLoader';
|
|
2
|
-
const abort = function (requestId) {
|
|
3
|
-
loader
|
|
4
|
-
|
|
2
|
+
const abort = function (requestId) {
|
|
3
|
+
let loader = getLoader(requestId);
|
|
4
|
+
if (loader && loader.source) {
|
|
5
|
+
//this._deleteLoader(requestId);
|
|
6
|
+
loader.source.cancel('Operation canceled by the user.');
|
|
7
|
+
}
|
|
8
|
+
/*
|
|
9
|
+
else {
|
|
10
|
+
throw new Error("Impossible to find the loader " + requestId);
|
|
11
|
+
}
|
|
12
|
+
*/
|
|
13
|
+
};
|
|
5
14
|
export { abort };
|
package/dist/fn/addColors.js
CHANGED
|
@@ -3,14 +3,22 @@ import { iterate } from './iterate';
|
|
|
3
3
|
const addColors = function (colors) {
|
|
4
4
|
let st = '';
|
|
5
5
|
if (numProperties(colors)) {
|
|
6
|
-
if (!bbn.
|
|
7
|
-
bbn.
|
|
6
|
+
if (!bbn.var.colors) {
|
|
7
|
+
bbn.var.colors = {};
|
|
8
8
|
}
|
|
9
9
|
let element = document.createElement('style');
|
|
10
10
|
document.head.appendChild(element);
|
|
11
11
|
let sheet = element.sheet;
|
|
12
|
+
// Append style element to head
|
|
12
13
|
let i = 0;
|
|
13
|
-
iterate(colors, (v, n) => {
|
|
14
|
+
iterate(colors, (v, n) => {
|
|
15
|
+
bbn.var.colors[n] = v;
|
|
16
|
+
sheet.insertRule('.bbn-' + n + ', .bbn-color-text-' + n + ' {color: ' + v + ' !important;}', i);
|
|
17
|
+
sheet.insertRule('svg.bbn-' + n + ', .bbn-' + n + ' svg, svg.bbn-color-text-' + n + ', .bbn-color-text-' + n + ' svg {fill: ' + v + ';}', i);
|
|
18
|
+
sheet.insertRule('.bbn-bg-' + n + ', .bbn-color-bg-' + n + ', .bbn-color-background-' + n + ' {background-color: ' + v + ' !important;}', i);
|
|
19
|
+
sheet.insertRule('.bbn-border-' + n + ', .bbn-color-border-' + n + ' {border-color: ' + v + ' !important;}', i);
|
|
20
|
+
sheet.insertRule('.bbn-color-' + n + ' {border-color: ' + v + '; background-color: ' + v + '; color: ' + v + ';}', i);
|
|
21
|
+
});
|
|
14
22
|
}
|
|
15
23
|
};
|
|
16
24
|
export { addColors };
|
package/dist/fn/addInputs.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { iterate } from './iterate';
|
|
2
2
|
const addInputs = function (form, params, prefix) {
|
|
3
3
|
if (form && (form.tagName === 'FORM')) {
|
|
4
|
-
let appendToForm = (name, val) => {
|
|
4
|
+
let appendToForm = (name, val) => {
|
|
5
|
+
let input = document.createElement('input');
|
|
6
|
+
input.setAttribute('type', 'hidden');
|
|
7
|
+
input.setAttribute('name', name);
|
|
8
|
+
input.setAttribute('value', val);
|
|
9
|
+
form.appendChild(input);
|
|
10
|
+
};
|
|
5
11
|
params = JSON.parse(JSON.stringify(params || {}));
|
|
6
12
|
prefix = prefix || '';
|
|
7
13
|
if (params) {
|
|
@@ -21,7 +27,8 @@ const addInputs = function (form, params, prefix) {
|
|
|
21
27
|
}
|
|
22
28
|
});
|
|
23
29
|
}
|
|
24
|
-
else if ((typeof param === 'object') &&
|
|
30
|
+
else if ((typeof param === 'object') &&
|
|
31
|
+
!(param instanceof File)) {
|
|
25
32
|
addInputs(form, param, name);
|
|
26
33
|
}
|
|
27
34
|
else {
|
package/dist/fn/addStyle.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { isObject } from './isObject';
|
|
2
2
|
import { iterate } from './iterate';
|
|
3
|
-
const addStyle = function (ele, o) {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const addStyle = function (ele, o) {
|
|
4
|
+
if (isObject(o)) {
|
|
5
|
+
iterate(o, (v, k) => {
|
|
6
|
+
ele.style[k] = v;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
};
|
|
6
10
|
export { addStyle };
|
package/dist/fn/adjustSize.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { each } from './each';
|
|
2
|
-
const adjustSize = function (type, eles) {
|
|
3
|
-
max =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
const adjustSize = function (type, eles) {
|
|
3
|
+
let max = 0, idx;
|
|
4
|
+
each(eles, (el) => {
|
|
5
|
+
el.style[type] = 'auto';
|
|
6
|
+
});
|
|
7
|
+
each(eles, (el, i) => {
|
|
8
|
+
let rect = el.getBoundingClientRect(), s = rect[type] % 1 ? (rect[type] - (rect[type] % 1) + 1) : rect[type];
|
|
9
|
+
//s = rect[type];
|
|
10
|
+
if (s > max) {
|
|
11
|
+
max = s;
|
|
12
|
+
idx = i;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
each(eles, (el, i) => {
|
|
16
|
+
if (max) {
|
|
17
|
+
el.style[type] = max + 'px';
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
8
21
|
export { adjustSize };
|
package/dist/fn/ajax.js
CHANGED
|
@@ -35,6 +35,7 @@ const ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
35
35
|
}
|
|
36
36
|
if (url) {
|
|
37
37
|
if (url.indexOf('://') === -1) {
|
|
38
|
+
// Prevent protocol mismatch by Axios
|
|
38
39
|
url = replaceAll("//", "/", url);
|
|
39
40
|
}
|
|
40
41
|
if (!datatype) {
|
|
@@ -42,6 +43,7 @@ const ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
42
43
|
}
|
|
43
44
|
let requestId = getRequestId(url, data, datatype);
|
|
44
45
|
let loaderObj = getLoader(requestId);
|
|
46
|
+
//log("IN AJAX", loaderObj? loaderObj.loader : "NO LOADER")
|
|
45
47
|
if (loaderObj && loaderObj.loader) {
|
|
46
48
|
return loaderObj.loader;
|
|
47
49
|
}
|
|
@@ -50,16 +52,23 @@ const ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
50
52
|
}
|
|
51
53
|
let cancelToken = axios.CancelToken;
|
|
52
54
|
let source = cancelToken.source();
|
|
53
|
-
let options = {
|
|
55
|
+
let options = {
|
|
56
|
+
responseType: datatype,
|
|
57
|
+
cancelToken: source.token
|
|
58
|
+
};
|
|
54
59
|
if (datatype === 'text') {
|
|
55
|
-
options.headers = {
|
|
60
|
+
options.headers = {
|
|
61
|
+
accept: 'text/javascript',
|
|
62
|
+
'Content-Type': 'text/javascript'
|
|
63
|
+
};
|
|
56
64
|
}
|
|
57
65
|
let args = [url];
|
|
58
66
|
if (isObject(data) && (numProperties(data) > 0)) {
|
|
59
67
|
args.push(data);
|
|
60
68
|
}
|
|
61
69
|
args.push(options);
|
|
62
|
-
let loader = axios[args.length === 2 ? 'get' : 'post'].apply(axios, args)
|
|
70
|
+
let loader = axios[args.length === 2 ? 'get' : 'post'].apply(axios, args)
|
|
71
|
+
.then((res) => {
|
|
63
72
|
_deleteLoader(requestId, res);
|
|
64
73
|
defaultEndLoadingFunction(url, tst, data, res);
|
|
65
74
|
switch (res.status) {
|
|
@@ -68,10 +77,12 @@ const ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
68
77
|
success(res.data, res.headers);
|
|
69
78
|
}
|
|
70
79
|
break;
|
|
71
|
-
default:
|
|
80
|
+
default:
|
|
81
|
+
defaultAjaxErrorFunction(loader, res);
|
|
72
82
|
}
|
|
73
83
|
return res;
|
|
74
|
-
})
|
|
84
|
+
})
|
|
85
|
+
.catch((err) => {
|
|
75
86
|
let isAbort = axios.isCancel(err);
|
|
76
87
|
_deleteLoader(requestId, err.message || err.response.data, isAbort);
|
|
77
88
|
defaultEndLoadingFunction(url, tst, data, err);
|
|
@@ -127,6 +127,15 @@ const analyzeFunction = function (fn) {
|
|
|
127
127
|
}
|
|
128
128
|
const argString = args.map(arg => arg.name + (arg.default ? ' = ' + arg.default : '')).join(', ');
|
|
129
129
|
const hash = md5(body + (name ? '-' + name : '') + (argString ? '-' + argString : ''));
|
|
130
|
-
return {
|
|
130
|
+
return {
|
|
131
|
+
body,
|
|
132
|
+
args,
|
|
133
|
+
argString,
|
|
134
|
+
isArrow,
|
|
135
|
+
hasFunction,
|
|
136
|
+
name,
|
|
137
|
+
isAsync,
|
|
138
|
+
hash
|
|
139
|
+
};
|
|
131
140
|
};
|
|
132
141
|
export { analyzeFunction };
|
package/dist/fn/animateCss.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
const animateCss = function (ele, animationName, callback) {
|
|
2
2
|
let animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
|
|
3
|
+
/*$(ele).addClass('animated ' + animationName).one(animationEnd, function(){
|
|
4
|
+
if ( typeof callback == 'function' ){ // make sure the callback is a function
|
|
5
|
+
callback.call(this); // brings the scope to the callback
|
|
6
|
+
}
|
|
7
|
+
$(this).removeClass('animated ' + animationName);
|
|
8
|
+
})*/
|
|
3
9
|
ele.classList.add('animated');
|
|
4
10
|
ele.classList.add(animationName);
|
|
5
11
|
ele.addEventListener(animationEnd, (e) => {
|
|
6
12
|
e.target.removeEventListener(e.type, arguments.callee);
|
|
7
|
-
if (typeof callback == 'function') {
|
|
8
|
-
callback.call(this);
|
|
13
|
+
if (typeof callback == 'function') { // make sure the callback is a function
|
|
14
|
+
callback.call(this); // brings the scope to the callback
|
|
9
15
|
}
|
|
10
16
|
this.classList.remove(animation);
|
|
11
17
|
});
|
package/dist/fn/arrayFromProp.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { each } from './each';
|
|
2
2
|
import { getProperty } from './getProperty';
|
|
3
|
-
const arrayFromProp = function (arr, prop) {
|
|
3
|
+
const arrayFromProp = function (arr, prop) {
|
|
4
|
+
let r = [];
|
|
5
|
+
each(arr, (a, i) => {
|
|
6
|
+
r.push(getProperty(a, prop));
|
|
7
|
+
});
|
|
8
|
+
return r;
|
|
9
|
+
};
|
|
4
10
|
export { arrayFromProp };
|
package/dist/fn/autoExtend.js
CHANGED
|
@@ -2,9 +2,11 @@ import { extend } from './extend';
|
|
|
2
2
|
const autoExtend = function (namespace, obj) {
|
|
3
3
|
if (!bbn[namespace]) {
|
|
4
4
|
bbn[namespace] = {};
|
|
5
|
+
//$.extend(true, bbn[namespace], obj);
|
|
5
6
|
extend(bbn[namespace], obj);
|
|
6
7
|
}
|
|
7
8
|
else {
|
|
9
|
+
// $.extend(true, bbn[namespace], obj);
|
|
8
10
|
extend(bbn[namespace], obj);
|
|
9
11
|
}
|
|
10
12
|
};
|
package/dist/fn/br2nl.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { replaceAll } from './replaceAll';
|
|
2
|
-
const br2nl = function (st) {
|
|
2
|
+
const br2nl = function (st) {
|
|
3
|
+
return replaceAll("<br />", "\n", replaceAll("<br/>", "\n", replaceAll("<br>", "\n", st)));
|
|
4
|
+
};
|
|
3
5
|
export { br2nl };
|
package/dist/fn/calendar.js
CHANGED
|
@@ -10,6 +10,13 @@ const calendar = function (d, wrong_result) {
|
|
|
10
10
|
if (!isDate(r)) {
|
|
11
11
|
return wrong_result && isString(wrong_result) ? wrong_result : '';
|
|
12
12
|
}
|
|
13
|
-
return dayjs(r).calendar(null, {
|
|
13
|
+
return dayjs(r).calendar(null, {
|
|
14
|
+
sameDay: '[' + bbn._('Today') + ']',
|
|
15
|
+
nextDay: '[' + bbn._('Tomorrow') + ']',
|
|
16
|
+
nextWeek: 'ddd D',
|
|
17
|
+
lastDay: '[' + bbn._('Yesterday') + ']',
|
|
18
|
+
lastWeek: 'ddd D',
|
|
19
|
+
sameElse: 'L'
|
|
20
|
+
});
|
|
14
21
|
};
|
|
15
22
|
export { calendar };
|
package/dist/fn/callback.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { error } from './error';
|
|
2
2
|
import { defaultLinkFunction } from './defaultLinkFunction';
|
|
3
|
-
import { insertContent } from './insertContent';
|
|
4
3
|
import { isFunction } from './isFunction';
|
|
5
4
|
import { log } from './log';
|
|
6
5
|
import { defaultPostLinkFunction } from './defaultPostLinkFunction';
|
|
@@ -13,6 +12,7 @@ const callback = function (url, res, fn, fn2, ele) {
|
|
|
13
12
|
let isObj = t.toLowerCase() === 'object';
|
|
14
13
|
let errTitle;
|
|
15
14
|
if (isObj && res.prescript) {
|
|
15
|
+
/* var ok can be changed to false in prescript execution */
|
|
16
16
|
try {
|
|
17
17
|
eval(res.prescript);
|
|
18
18
|
}
|
|
@@ -23,6 +23,7 @@ const callback = function (url, res, fn, fn2, ele) {
|
|
|
23
23
|
if (isObj && res.url === undefined) {
|
|
24
24
|
res.url = url;
|
|
25
25
|
}
|
|
26
|
+
/* Case where a callback is defined */
|
|
26
27
|
if (fn) {
|
|
27
28
|
tmp = fn(res, ele);
|
|
28
29
|
}
|
|
@@ -34,7 +35,7 @@ const callback = function (url, res, fn, fn2, ele) {
|
|
|
34
35
|
ele.val(res.content);
|
|
35
36
|
}
|
|
36
37
|
else {
|
|
37
|
-
|
|
38
|
+
ele.innerHTML = res.content;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
if (tmp && isObj && res.script) {
|
|
@@ -58,6 +59,7 @@ const callback = function (url, res, fn, fn2, ele) {
|
|
|
58
59
|
})(res.data ? res.data : {}, ele ? ele : false);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
62
|
+
/* Case where a callback is defined */
|
|
61
63
|
if (tmp && fn2) {
|
|
62
64
|
fn2(res);
|
|
63
65
|
}
|
package/dist/fn/camelToCss.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
const camelToCss = function (str) {
|
|
1
|
+
const camelToCss = function (str) {
|
|
2
|
+
return str.replace(/([A-Z])/g, function (st) {
|
|
3
|
+
return '-' + st.toLowerCase();
|
|
4
|
+
}).replace('/^./', function (st) {
|
|
5
|
+
return st.toLowerCase();
|
|
6
|
+
});
|
|
7
|
+
};
|
|
2
8
|
export { camelToCss };
|
package/dist/fn/canvasToImage.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
const canvasToImage = function (canvas) {
|
|
1
|
+
const canvasToImage = function (canvas) {
|
|
2
|
+
let img = new Image();
|
|
3
|
+
img.src = canvas.toDataURL("image/png");
|
|
4
|
+
return img;
|
|
5
|
+
};
|
|
2
6
|
export { canvasToImage };
|
package/dist/fn/center.js
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { log } from './log';
|
|
2
2
|
const center = function (ele) {
|
|
3
|
-
|
|
3
|
+
//ele = $(ele);
|
|
4
|
+
let parent = ele.parentNode,
|
|
5
|
+
//w = parent.width(),
|
|
6
|
+
w = parent.clientWidth,
|
|
7
|
+
//h = parent.height();
|
|
8
|
+
h = parent.clientHeight;
|
|
4
9
|
while (parent && (!w || !h)) {
|
|
10
|
+
/*parent = parent.parent(),
|
|
11
|
+
w = parent.width(),
|
|
12
|
+
h = parent.height();*/
|
|
5
13
|
parent = ele.parentNode;
|
|
6
14
|
w = parent.clientWidth;
|
|
7
15
|
h = parent.clientHeight;
|
|
8
16
|
}
|
|
9
17
|
log("BBN_CENTER", w, h);
|
|
18
|
+
//ele.css("position","absolute");
|
|
10
19
|
ele.style.position = "absolute";
|
|
20
|
+
//ele.css("top", Math.max(0, ((h - ele.outerHeight()) / 2) + parent.scrollTop()) + "px");
|
|
11
21
|
ele.style.top = Math.max(0, ((h - ele.offsetHeight) / 2) + parent.scrollTop) + "px";
|
|
22
|
+
//ele.css("left", Math.max(0, ((w - ele.outerWidth()) / 2) + parent.scrollLeft()) + "px");
|
|
12
23
|
ele.style.left = Math.max(0, ((h - ele.offsetWidth) / 2) + parent.scrollLeft) + "px";
|
|
13
24
|
return ele;
|
|
14
25
|
};
|
package/dist/fn/checkProps.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { checkPropsDetails } from './checkPropsDetails';
|
|
2
|
-
const checkProps = function (obj, props, checkEmpty) {
|
|
2
|
+
const checkProps = function (obj, props, checkEmpty) {
|
|
3
|
+
return checkPropsDetails(obj, props, checkEmpty).result;
|
|
4
|
+
};
|
|
3
5
|
export { checkProps };
|
|
@@ -4,7 +4,10 @@ import { isObject } from './isObject';
|
|
|
4
4
|
import { each } from './each';
|
|
5
5
|
import { substr } from './substr';
|
|
6
6
|
const checkPropsDetails = function (obj, props, checkEmpty) {
|
|
7
|
-
let res = {
|
|
7
|
+
let res = {
|
|
8
|
+
error: false,
|
|
9
|
+
result: true
|
|
10
|
+
};
|
|
8
11
|
if (isString(props)) {
|
|
9
12
|
props = [props];
|
|
10
13
|
}
|
package/dist/fn/clone.js
CHANGED
|
@@ -3,7 +3,9 @@ import { isObject } from './isObject';
|
|
|
3
3
|
import { extend } from './extend';
|
|
4
4
|
const clone = function (obj) {
|
|
5
5
|
if (isArray(obj)) {
|
|
6
|
-
return obj.slice().map((a) => {
|
|
6
|
+
return obj.slice().map((a) => {
|
|
7
|
+
return typeof (a) === 'object' ? clone(a) : a;
|
|
8
|
+
});
|
|
7
9
|
}
|
|
8
10
|
if (isObject(obj)) {
|
|
9
11
|
const o = Object.create(Object.getPrototypeOf(obj));
|
package/dist/fn/colorToHex.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
const colorToHex = function (color) {
|
|
1
|
+
const colorToHex = function (color) {
|
|
2
|
+
let canvas = document.createElement("canvas").getContext("2d");
|
|
3
|
+
canvas.fillStyle = color;
|
|
4
|
+
return canvas.fillStyle;
|
|
5
|
+
};
|
|
2
6
|
export { colorToHex };
|
package/dist/fn/compare.js
CHANGED
|
@@ -9,13 +9,16 @@ const compare = function (v1, v2, operator) {
|
|
|
9
9
|
case "=":
|
|
10
10
|
case "equal":
|
|
11
11
|
case "eq":
|
|
12
|
-
case "is":
|
|
12
|
+
case "is":
|
|
13
|
+
return v1 === v2;
|
|
13
14
|
case "!==":
|
|
14
15
|
case "notequal":
|
|
15
16
|
case "neq":
|
|
16
|
-
case "isnot":
|
|
17
|
+
case "isnot":
|
|
18
|
+
return v1 !== v2;
|
|
17
19
|
case "!=":
|
|
18
|
-
case "different":
|
|
20
|
+
case "different":
|
|
21
|
+
return v1 != v2;
|
|
19
22
|
case "contains":
|
|
20
23
|
case "contain":
|
|
21
24
|
case "icontains":
|
|
@@ -66,21 +69,31 @@ const compare = function (v1, v2, operator) {
|
|
|
66
69
|
}
|
|
67
70
|
return removeAccents(v1).toLowerCase() === removeAccents(v2).toLowerCase();
|
|
68
71
|
case "gt":
|
|
69
|
-
case ">":
|
|
72
|
+
case ">":
|
|
73
|
+
return v1 > v2;
|
|
70
74
|
case "gte":
|
|
71
|
-
case ">=":
|
|
75
|
+
case ">=":
|
|
76
|
+
return v1 >= v2;
|
|
72
77
|
case "lt":
|
|
73
|
-
case "<":
|
|
78
|
+
case "<":
|
|
79
|
+
return v1 < v2;
|
|
74
80
|
case "lte":
|
|
75
|
-
case "<=":
|
|
76
|
-
|
|
77
|
-
case "
|
|
78
|
-
|
|
79
|
-
case "
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
case "<=":
|
|
82
|
+
return v1 <= v2;
|
|
83
|
+
case "isnull":
|
|
84
|
+
return v1 === null;
|
|
85
|
+
case "isnotnull":
|
|
86
|
+
return v1 !== null;
|
|
87
|
+
case "isempty":
|
|
88
|
+
return v1 === '';
|
|
89
|
+
case "isnotempty":
|
|
90
|
+
return v1 !== '';
|
|
91
|
+
case '==':
|
|
92
|
+
if (isObject(v1, v2)) {
|
|
93
|
+
return isSame(v1, v2);
|
|
94
|
+
}
|
|
95
|
+
default:
|
|
96
|
+
return v1 == v2;
|
|
84
97
|
}
|
|
85
98
|
};
|
|
86
99
|
export { compare };
|
|
@@ -19,6 +19,7 @@ const compareConditions = function (data, filter) {
|
|
|
19
19
|
if (bits.length) {
|
|
20
20
|
each(bits, b => data = data[b]);
|
|
21
21
|
}
|
|
22
|
+
// Case where both are undefined: value and prop which doesn't exist; they are not the same!
|
|
22
23
|
if ((getProperty(data, prop) === undefined) && (a.value !== undefined)) {
|
|
23
24
|
compare = false;
|
|
24
25
|
}
|
package/dist/fn/copy.js
CHANGED
|
@@ -5,10 +5,16 @@ const copy = function (st) {
|
|
|
5
5
|
if (st) {
|
|
6
6
|
if (navigator && navigator.clipboard) {
|
|
7
7
|
if (st instanceof Blob) {
|
|
8
|
-
navigator.clipboard.write([new ClipboardItem({ [st.type.toString()]: st })]).then(() => {
|
|
8
|
+
navigator.clipboard.write([new ClipboardItem({ [st.type.toString()]: st })]).then(() => {
|
|
9
|
+
resolve();
|
|
10
|
+
});
|
|
9
11
|
}
|
|
10
12
|
else if (isObject(st) && isFunction(st.toBlob)) {
|
|
11
|
-
st.toBlob(blob => {
|
|
13
|
+
st.toBlob(blob => {
|
|
14
|
+
navigator.clipboard.write([new ClipboardItem({ [blob.type.toString()]: blob })]).then(() => {
|
|
15
|
+
resolve();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
12
18
|
}
|
|
13
19
|
else {
|
|
14
20
|
navigator.clipboard.writeText(st);
|
package/dist/fn/correctCase.js
CHANGED
package/dist/fn/count.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { filter } from './filter';
|
|
2
|
-
const count = function (arr, prop, val, operator) {
|
|
2
|
+
const count = function (arr, prop, val, operator) {
|
|
3
|
+
return filter(arr, prop, val, operator, false).length || 0;
|
|
4
|
+
};
|
|
3
5
|
export { count };
|
package/dist/fn/crc32.js
CHANGED
package/dist/fn/cssExists.js
CHANGED
|
@@ -13,7 +13,9 @@ const cssExists = function (f) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
if (ok) {
|
|
16
|
+
//log(rules);
|
|
16
17
|
for (var cx = 0; cx < rules.length; cx++) {
|
|
18
|
+
//log(rules[cx].selectorText);
|
|
17
19
|
if (new RegExp("(^|\\s)" + escapeRegExp(f) + "(\\{|\\s)", "g").test(rules[cx].selectorText)) {
|
|
18
20
|
return true;
|
|
19
21
|
}
|
package/dist/fn/dateSQL.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
const dateSQL = function (v, dayOnly) {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const dateSQL = function (v, dayOnly) {
|
|
2
|
+
let date = date(v);
|
|
3
|
+
if (date) {
|
|
4
|
+
return dayjs(date).format("YYYY-MM-DD" + (dayOnly ? '' : ' HH:mm:ss'));
|
|
5
|
+
}
|
|
6
|
+
};
|
|
4
7
|
export { dateSQL };
|
package/dist/fn/deepPath.js
CHANGED
|
@@ -8,14 +8,16 @@ const deepPath = function (arr, filter, deepProperty, res = []) {
|
|
|
8
8
|
res.push(idx);
|
|
9
9
|
return res;
|
|
10
10
|
}
|
|
11
|
-
each(arr, (it, i) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
each(arr, (it, i) => {
|
|
12
|
+
if (isArray(it[deepProperty])) {
|
|
13
|
+
let r = res.slice();
|
|
14
|
+
r.push(i);
|
|
15
|
+
let tmp = deepPath(it[deepProperty], filter, deepProperty, r);
|
|
16
|
+
if (tmp !== false) {
|
|
17
|
+
return tmp;
|
|
18
|
+
}
|
|
17
19
|
}
|
|
18
|
-
}
|
|
20
|
+
});
|
|
19
21
|
return false;
|
|
20
22
|
};
|
|
21
23
|
export { deepPath };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultAjaxErrorFunction: (jqXHR: any, textStatus: any, errorThrown: any) =>
|
|
1
|
+
declare const defaultAjaxErrorFunction: (jqXHR: any, textStatus: any, errorThrown: any) => boolean;
|
|
2
2
|
export { defaultAjaxErrorFunction };
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const defaultAjaxErrorFunction = function (jqXHR, textStatus, errorThrown) {
|
|
1
|
+
import { isCp } from './isCp';
|
|
2
|
+
const defaultAjaxErrorFunction = function (jqXHR, textStatus, errorThrown) {
|
|
3
|
+
var _a;
|
|
4
|
+
/** @todo */
|
|
5
|
+
if ((_a = window.appui) === null || _a === void 0 ? void 0 : _a.status) {
|
|
6
|
+
this.$nextTick(() => {
|
|
7
|
+
const loadBar = this.getRef('loading');
|
|
8
|
+
if (isCp(loadBar)) {
|
|
9
|
+
loadBar.$forceUpdate();
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
appui.error({ title: textStatus, content: errorThrown }, 4);
|
|
14
|
+
return false;
|
|
15
|
+
};
|
|
3
16
|
export { defaultAjaxErrorFunction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultAlertFunction: (
|
|
1
|
+
declare const defaultAlertFunction: (ele: any) => void;
|
|
2
2
|
export { defaultAlertFunction };
|