@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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultEndLoadingFunction: (url: any, data: any, res: any) =>
|
|
1
|
+
declare const defaultEndLoadingFunction: (url: any, timestamp: any, data: any, res: any) => void;
|
|
2
2
|
export { defaultEndLoadingFunction };
|
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import { numProperties } from './numProperties';
|
|
2
|
+
import { log } from './log';
|
|
3
|
+
import { isCp } from './isCp';
|
|
4
|
+
const defaultEndLoadingFunction = function (url, timestamp, data, res) {
|
|
5
|
+
var _a;
|
|
6
|
+
if (res && res.data && (numProperties(res.data) === 1) && res.data.disconnected) {
|
|
7
|
+
window.location.reload();
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if ((_a = window.appui) === null || _a === void 0 ? void 0 : _a.status) {
|
|
11
|
+
this.$nextTick(() => {
|
|
12
|
+
log("UPDATE LOADBAR");
|
|
13
|
+
const loadBar = this.getRef('loading');
|
|
14
|
+
if (isCp(loadBar)) {
|
|
15
|
+
loadBar.$updateAllComputed();
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
};
|
|
2
20
|
export { defaultEndLoadingFunction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultPreLinkFunction: (url: any
|
|
1
|
+
declare const defaultPreLinkFunction: (url: any) => boolean;
|
|
2
2
|
export { defaultPreLinkFunction };
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { isFunction } from './isFunction';
|
|
2
|
+
const defaultPreLinkFunction = function (url) {
|
|
3
|
+
let router = appui.getRef('router');
|
|
4
|
+
if (router) {
|
|
5
|
+
if (isFunction(router.route) && !router.disabled) {
|
|
6
|
+
router.route(url);
|
|
7
|
+
}
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return true;
|
|
11
|
+
};
|
|
2
12
|
export { defaultPreLinkFunction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultStartLoadingFunction: (
|
|
1
|
+
declare const defaultStartLoadingFunction: () => void;
|
|
2
2
|
export { defaultStartLoadingFunction };
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { log } from './log';
|
|
2
|
+
import { isCp } from './isCp';
|
|
3
|
+
const defaultStartLoadingFunction = function () {
|
|
4
|
+
var _a;
|
|
5
|
+
if ((_a = window.appui) === null || _a === void 0 ? void 0 : _a.status) {
|
|
6
|
+
this.$nextTick(() => {
|
|
7
|
+
log("UPDATE LOADBAR");
|
|
8
|
+
const loadBar = this.getRef('loading');
|
|
9
|
+
if (isCp(loadBar)) {
|
|
10
|
+
loadBar.$updateAllComputed();
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
};
|
|
2
15
|
export { defaultStartLoadingFunction };
|
package/dist/fn/deleteProp.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
const deleteProp = function (obj, prop) {
|
|
1
|
+
const deleteProp = function (obj, prop) {
|
|
2
|
+
checkType(obj, "object", bbn._("The obj must be an object in setProp"));
|
|
3
|
+
checkType(prop, "string", bbn._("The prop must be a string in setProp"));
|
|
4
|
+
delete obj[prop];
|
|
5
|
+
};
|
|
2
6
|
export { deleteProp };
|
package/dist/fn/diffObj.js
CHANGED
|
@@ -12,7 +12,9 @@ const diffObj = function (obj1, obj2, unchanged, notRoot) {
|
|
|
12
12
|
if (value1 === value2) {
|
|
13
13
|
return VALUE_UNCHANGED;
|
|
14
14
|
}
|
|
15
|
-
if (isDate(value1) &&
|
|
15
|
+
if (isDate(value1) &&
|
|
16
|
+
isDate(value2) &&
|
|
17
|
+
(value1.getTime() === value2.getTime())) {
|
|
16
18
|
return VALUE_UNCHANGED;
|
|
17
19
|
}
|
|
18
20
|
if ('undefined' == typeof (value1)) {
|
|
@@ -32,11 +34,23 @@ const diffObj = function (obj1, obj2, unchanged, notRoot) {
|
|
|
32
34
|
let res = _compareValues(obj1, obj2);
|
|
33
35
|
if (unchanged || (res !== VALUE_UNCHANGED)) {
|
|
34
36
|
let ret = createObject();
|
|
35
|
-
Object.defineProperty(ret, 'type', {
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
Object.defineProperty(ret, 'type', {
|
|
38
|
+
value: res,
|
|
39
|
+
enumerable: false
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(ret, 'data', {
|
|
42
|
+
value: (obj1 === undefined) ? obj2 : obj1,
|
|
43
|
+
enumerable: false
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(ret, '_bbnDiffObjProof', {
|
|
46
|
+
value: true,
|
|
47
|
+
enumerable: false
|
|
48
|
+
});
|
|
38
49
|
if (obj1 !== undefined) {
|
|
39
|
-
Object.defineProperty(ret, 'newData', {
|
|
50
|
+
Object.defineProperty(ret, 'newData', {
|
|
51
|
+
value: obj2,
|
|
52
|
+
enumerable: false
|
|
53
|
+
});
|
|
40
54
|
}
|
|
41
55
|
return ret;
|
|
42
56
|
}
|
|
@@ -46,6 +60,7 @@ const diffObj = function (obj1, obj2, unchanged, notRoot) {
|
|
|
46
60
|
return false;
|
|
47
61
|
}
|
|
48
62
|
if (diffObjProcessed.includes(obj1) || diffObjProcessed.includes(obj2)) {
|
|
63
|
+
//error(bbn._("Can't compare objects because they contain circular references"));
|
|
49
64
|
return false;
|
|
50
65
|
}
|
|
51
66
|
diffObjProcessed.push(obj1, obj2);
|
package/dist/fn/download.js
CHANGED
|
@@ -7,6 +7,7 @@ import { fileExt } from './fileExt';
|
|
|
7
7
|
import { downloadContent } from './downloadContent';
|
|
8
8
|
import { defaultAjaxErrorFunction } from './defaultAjaxErrorFunction';
|
|
9
9
|
const download = function (url, filename, params) {
|
|
10
|
+
// We can intervert the arguments
|
|
10
11
|
if (isObject(filename)) {
|
|
11
12
|
params = filename;
|
|
12
13
|
filename = null;
|
|
@@ -30,6 +31,8 @@ const download = function (url, filename, params) {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
defaultAjaxErrorFunction(e);
|
|
33
|
-
}, e => {
|
|
34
|
+
}, e => {
|
|
35
|
+
defaultAjaxErrorFunction(e);
|
|
36
|
+
});
|
|
34
37
|
};
|
|
35
38
|
export { download };
|
|
@@ -4,7 +4,16 @@ import { isString } from './isString';
|
|
|
4
4
|
import { log } from './log';
|
|
5
5
|
const downloadContent = function (filename, content, type) {
|
|
6
6
|
if (isCanvas(content)) {
|
|
7
|
-
content.toBlob((blob) => {
|
|
7
|
+
content.toBlob((blob) => {
|
|
8
|
+
// blob ready, download it
|
|
9
|
+
let a = document.createElement('a');
|
|
10
|
+
a.download = filename;
|
|
11
|
+
a.href = window.URL.createObjectURL(blob);
|
|
12
|
+
a.className = 'bbn-no';
|
|
13
|
+
a.click();
|
|
14
|
+
// delete the internal blob reference, to let the browser clear memory from it
|
|
15
|
+
window.URL.revokeObjectURL(a.href);
|
|
16
|
+
}, type || 'image/png');
|
|
8
17
|
return;
|
|
9
18
|
}
|
|
10
19
|
if (!type) {
|
|
@@ -29,9 +38,11 @@ const downloadContent = function (filename, content, type) {
|
|
|
29
38
|
}
|
|
30
39
|
a.href = window.URL.createObjectURL(src);
|
|
31
40
|
a.download = filename;
|
|
41
|
+
// Append anchor to body.
|
|
32
42
|
document.body.appendChild(a);
|
|
33
43
|
a.click();
|
|
34
44
|
window.URL.revokeObjectURL(a.href);
|
|
45
|
+
// Remove anchor from body
|
|
35
46
|
document.body.removeChild(a);
|
|
36
47
|
};
|
|
37
48
|
export { downloadContent };
|
package/dist/fn/eraseCookie.js
CHANGED
package/dist/fn/error.js
CHANGED
|
@@ -5,7 +5,11 @@ const error = function (errorMsg) {
|
|
|
5
5
|
for (let i = 1; i < arguments.length; i++) {
|
|
6
6
|
args.push(arguments[i]);
|
|
7
7
|
}
|
|
8
|
-
args.unshift({
|
|
8
|
+
args.unshift({
|
|
9
|
+
_bbn_console_mode: "error",
|
|
10
|
+
_bbn_console_level: 1,
|
|
11
|
+
_bbn_console_style: "color: #E64141; background: #F7E195; font-size: 14px"
|
|
12
|
+
});
|
|
9
13
|
log.apply(this, args);
|
|
10
14
|
}
|
|
11
15
|
throw new Error(errorMsg);
|
package/dist/fn/escapeRegExp.js
CHANGED
package/dist/fn/escapeUrl.js
CHANGED
|
@@ -14,7 +14,9 @@ const escapeUrl = function (url, params) {
|
|
|
14
14
|
st += '://';
|
|
15
15
|
url = url.substring(3);
|
|
16
16
|
}
|
|
17
|
-
each(dirName(url).split('/'), a => {
|
|
17
|
+
each(dirName(url).split('/'), a => {
|
|
18
|
+
st += encodeURIComponent(a) + '/';
|
|
19
|
+
});
|
|
18
20
|
let base = baseName(url);
|
|
19
21
|
let sep = '?';
|
|
20
22
|
let existingParams = '';
|
package/dist/fn/extend.js
CHANGED
|
@@ -58,7 +58,12 @@ const extend = function () {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
if (args[i].__bbnNoData) {
|
|
61
|
-
Object.defineProperty(out, '__bbnNoData', {
|
|
61
|
+
Object.defineProperty(out, '__bbnNoData', {
|
|
62
|
+
value: true,
|
|
63
|
+
enumerable: false,
|
|
64
|
+
configurable: false,
|
|
65
|
+
writable: false
|
|
66
|
+
});
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
69
|
return out;
|
package/dist/fn/fdate.js
CHANGED
package/dist/fn/fdatetime.js
CHANGED
|
@@ -7,7 +7,16 @@ const fdatetime = function (d, wrong_result) {
|
|
|
7
7
|
return wrong_result && isString(wrong_result) ? wrong_result : '';
|
|
8
8
|
}
|
|
9
9
|
if (undefined !== dayjs) {
|
|
10
|
-
return dayjs(r).
|
|
10
|
+
//return dayjs(r).format('lll');
|
|
11
|
+
return dayjs(r).calendar(null, {
|
|
12
|
+
sameDay: '[' + bbn._('Today') + '] HH:mm',
|
|
13
|
+
nextDay: '[' + bbn._('Tomorrow') + '] HH:mm',
|
|
14
|
+
nextWeek: 'ddd D HH:mm',
|
|
15
|
+
lastDay: '[' + bbn._('Yesterday') + '] HH:mm',
|
|
16
|
+
lastWeek: 'ddd D HH:mm',
|
|
17
|
+
sameElse: 'DD/MM/YYYY HH:mm'
|
|
18
|
+
});
|
|
19
|
+
//return dayjs(r).format("DD/MM/YYYY HH:mm")
|
|
11
20
|
}
|
|
12
21
|
return r.toLocaleDateString();
|
|
13
22
|
};
|
package/dist/fn/filter.js
CHANGED
|
@@ -24,16 +24,20 @@ const filter = function (arr, prop, val, operator) {
|
|
|
24
24
|
throw new Error("Search function error: The prop argument should be a string or an object");
|
|
25
25
|
}
|
|
26
26
|
if (isFn) {
|
|
27
|
-
each(arr, (a, i) => {
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
each(arr, (a, i) => {
|
|
28
|
+
if (filter(a, i)) {
|
|
29
|
+
res.push(a);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
30
32
|
}
|
|
31
33
|
else {
|
|
32
34
|
filter = filterToConditions(filter, operator);
|
|
33
35
|
if (filter.conditions && filter.logic) {
|
|
34
|
-
each(arr, (a) => {
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
each(arr, (a) => {
|
|
37
|
+
if (compareConditions(a, filter)) {
|
|
38
|
+
res.push(a);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
return res;
|
|
@@ -12,10 +12,16 @@ const filterToConditions = function (filter, operator) {
|
|
|
12
12
|
tmp.push(filterToConditions(a));
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
-
tmp.push({
|
|
15
|
+
tmp.push({
|
|
16
|
+
field: n,
|
|
17
|
+
operator: operator || '=',
|
|
18
|
+
value: a
|
|
19
|
+
});
|
|
16
20
|
}
|
|
17
21
|
});
|
|
18
|
-
filter = {
|
|
22
|
+
filter = {
|
|
23
|
+
conditions: tmp
|
|
24
|
+
};
|
|
19
25
|
}
|
|
20
26
|
if (!filter.logic) {
|
|
21
27
|
filter.logic = 'AND';
|
package/dist/fn/findAll.js
CHANGED
|
@@ -8,9 +8,11 @@ const findAll = function (arr, filter, deepProperty, res = []) {
|
|
|
8
8
|
res.push(arr[idx]);
|
|
9
9
|
start = idx + 1;
|
|
10
10
|
}
|
|
11
|
-
each(arr, it => {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
each(arr, it => {
|
|
12
|
+
if (isArray(it[deepProperty])) {
|
|
13
|
+
findAll(it[deepProperty], filter, deepProperty, res);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
14
16
|
return res;
|
|
15
17
|
};
|
|
16
18
|
export { findAll };
|
package/dist/fn/format.js
CHANGED
|
@@ -3,7 +3,11 @@ const format = function (str) {
|
|
|
3
3
|
let args = Array.prototype.slice.call(arguments, 1);
|
|
4
4
|
if (args.length) {
|
|
5
5
|
let i = 0;
|
|
6
|
-
return str.replace(/\%([d|s])/g, (match, type) => {
|
|
6
|
+
return str.replace(/\%([d|s])/g, (match, type) => {
|
|
7
|
+
let tmp = args[i++];
|
|
8
|
+
checkType(tmp, type === 'd' ? 'number' : 'string', bbn._("The value doesn't correspond to the format"));
|
|
9
|
+
return tmp;
|
|
10
|
+
});
|
|
7
11
|
}
|
|
8
12
|
return str;
|
|
9
13
|
};
|
package/dist/fn/formatDate.js
CHANGED
package/dist/fn/formdata.js
CHANGED
|
@@ -11,12 +11,16 @@ const formdata = function (form) {
|
|
|
11
11
|
v = fieldValue(input);
|
|
12
12
|
if ((v !== undefined) && !input.disabled) {
|
|
13
13
|
let name = input.name;
|
|
14
|
-
if ((name.indexOf("[]") === -1) &&
|
|
14
|
+
if ((name.indexOf("[]") === -1) &&
|
|
15
|
+
(name.indexOf("[") > -1) &&
|
|
16
|
+
(name.indexOf("]") > -1) &&
|
|
17
|
+
(name.lastIndexOf("]") === name.length - 1)) {
|
|
15
18
|
name = replaceAll("][", ".", name);
|
|
16
19
|
name = replaceAll("[", ".", name);
|
|
17
20
|
name = replaceAll("]", "", name);
|
|
18
21
|
}
|
|
19
|
-
if ((name.length > 2) &&
|
|
22
|
+
if ((name.length > 2) &&
|
|
23
|
+
(name.indexOf("[]") === (name.length - 2))) {
|
|
20
24
|
n = substr(name, 0, name.length - 2);
|
|
21
25
|
if (res[n] === undefined) {
|
|
22
26
|
res[n] = [];
|
|
@@ -43,6 +47,7 @@ const formdata = function (form) {
|
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
49
|
});
|
|
50
|
+
// return num_changes ? res : false;
|
|
46
51
|
return res;
|
|
47
52
|
};
|
|
48
53
|
export { formdata };
|
package/dist/fn/ftime.js
CHANGED
|
@@ -7,7 +7,9 @@ const ftime = function (d, wrong_result) {
|
|
|
7
7
|
return wrong_result && isString(wrong_result) ? wrong_result : '';
|
|
8
8
|
}
|
|
9
9
|
if (undefined !== dayjs) {
|
|
10
|
-
return dayjs(r).calendar({
|
|
10
|
+
return dayjs(r).calendar({
|
|
11
|
+
sameElse: 'D/M/YY HH:mm'
|
|
12
|
+
});
|
|
11
13
|
}
|
|
12
14
|
return r.toLocaleDateString();
|
|
13
15
|
};
|
package/dist/fn/getAllTags.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { unique } from './unique';
|
|
2
|
-
const getAllTags = function () {
|
|
2
|
+
const getAllTags = function () {
|
|
3
|
+
return unique(Array.prototype.map.apply(document.all, [a => a.tagName.toLowerCase()]));
|
|
4
|
+
};
|
|
3
5
|
export { getAllTags };
|
package/dist/fn/getAttributes.js
CHANGED
|
@@ -4,7 +4,9 @@ const getAttributes = function (ele) {
|
|
|
4
4
|
error("The element is not a proper HTML Element");
|
|
5
5
|
}
|
|
6
6
|
let res = Object.create(null);
|
|
7
|
-
ele.getAttributeNames().forEach(name => {
|
|
7
|
+
ele.getAttributeNames().forEach(name => {
|
|
8
|
+
res[name] = ele.getAttribute(name);
|
|
9
|
+
});
|
|
8
10
|
return res;
|
|
9
11
|
};
|
|
10
12
|
export { getAttributes };
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
const getBrowserName = function () {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const getBrowserName = function () {
|
|
2
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
3
|
+
switch (true) {
|
|
4
|
+
case userAgent.includes('edge'):
|
|
5
|
+
case userAgent.includes('edg/'):
|
|
6
|
+
return "Edge";
|
|
7
|
+
case userAgent.includes('opr') && !!window.opr:
|
|
8
|
+
return "Opera";
|
|
9
|
+
case userAgent.includes('chrome') && !!window.chrome:
|
|
10
|
+
return "Chrome";
|
|
11
|
+
case userAgent.includes('trident'):
|
|
12
|
+
return "Internet Explorer";
|
|
13
|
+
case userAgent.includes('firefox'):
|
|
14
|
+
return "Firefox";
|
|
15
|
+
case userAgent.includes('safari'):
|
|
16
|
+
return "Safari";
|
|
17
|
+
default:
|
|
18
|
+
return "Other";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
11
21
|
export { getBrowserName };
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
const getBrowserVersion = function () {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const getBrowserVersion = function () {
|
|
2
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
3
|
+
switch (true) {
|
|
4
|
+
case userAgent.includes('edge/'):
|
|
5
|
+
return userAgent.split('edge/')[1].split(' ')[0];
|
|
6
|
+
case userAgent.includes('edg/'):
|
|
7
|
+
return userAgent.split('edg/')[1].split(' ')[0];
|
|
8
|
+
case userAgent.includes('opr/') && !!window.opr:
|
|
9
|
+
return userAgent.split('opr/')[1].split(' ')[0];
|
|
10
|
+
case userAgent.includes('chrome/') && !!window.chrome:
|
|
11
|
+
return userAgent.split('chrome/')[1].split(' ')[0];
|
|
12
|
+
case userAgent.includes('trident/'):
|
|
13
|
+
return userAgent.split('trident/')[1].split(' ')[0];
|
|
14
|
+
case userAgent.includes('firefox/'):
|
|
15
|
+
return userAgent.split('firefox/')[1].split(' ')[0];
|
|
16
|
+
case userAgent.includes('safari/'):
|
|
17
|
+
return userAgent.split('version/')[1].split(' ')[0];
|
|
18
|
+
default:
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
};
|
|
11
22
|
export { getBrowserVersion };
|
package/dist/fn/getEventData.js
CHANGED
|
@@ -10,12 +10,21 @@ const getEventData = function (e) {
|
|
|
10
10
|
let sel = window.getSelection();
|
|
11
11
|
res.raw = sel.toString();
|
|
12
12
|
let html = getHTMLOfSelection();
|
|
13
|
-
res.str.push({
|
|
13
|
+
res.str.push({
|
|
14
|
+
type: 'text/plain',
|
|
15
|
+
data: res.raw
|
|
16
|
+
});
|
|
14
17
|
if (html !== res.raw) {
|
|
15
|
-
res.str.push({
|
|
18
|
+
res.str.push({
|
|
19
|
+
type: 'text/html',
|
|
20
|
+
data: html
|
|
21
|
+
});
|
|
16
22
|
}
|
|
17
23
|
else if (res.raw.trim().indexOf('<') === 0) {
|
|
18
|
-
res.str.push({
|
|
24
|
+
res.str.push({
|
|
25
|
+
type: 'text/html',
|
|
26
|
+
data: "<meta charset='utf-8'><code style=\"white-space: pre; font-family: 'Courier New', sans-serif\">\n" + res.raw + "\n</code>"
|
|
27
|
+
});
|
|
19
28
|
}
|
|
20
29
|
done = true;
|
|
21
30
|
ok(res);
|
|
@@ -39,7 +48,13 @@ const getEventData = function (e) {
|
|
|
39
48
|
if (blob) {
|
|
40
49
|
done = true;
|
|
41
50
|
num--;
|
|
42
|
-
res.files.push({
|
|
51
|
+
res.files.push({
|
|
52
|
+
type: type,
|
|
53
|
+
data: blob,
|
|
54
|
+
name: name,
|
|
55
|
+
size: size,
|
|
56
|
+
mdate: lastModified
|
|
57
|
+
});
|
|
43
58
|
strings.push(name);
|
|
44
59
|
if (!num) {
|
|
45
60
|
if (!res.raw) {
|
|
@@ -56,7 +71,10 @@ const getEventData = function (e) {
|
|
|
56
71
|
done = true;
|
|
57
72
|
item.getAsString((data) => {
|
|
58
73
|
num--;
|
|
59
|
-
res.str.push({
|
|
74
|
+
res.str.push({
|
|
75
|
+
type: type,
|
|
76
|
+
data: data
|
|
77
|
+
});
|
|
60
78
|
if (type === 'text/plain') {
|
|
61
79
|
strings.push(name);
|
|
62
80
|
}
|
|
@@ -71,7 +89,9 @@ const getEventData = function (e) {
|
|
|
71
89
|
});
|
|
72
90
|
}
|
|
73
91
|
if (!done) {
|
|
74
|
-
setTimeout(() => {
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
ok(res);
|
|
94
|
+
});
|
|
75
95
|
}
|
|
76
96
|
});
|
|
77
97
|
return p;
|
package/dist/fn/getField.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { getRow } from './getRow';
|
|
2
1
|
const getField = function (arr, field, prop, val, operator) {
|
|
3
2
|
var r;
|
|
4
|
-
if (field && (r = getRow(arr, prop, val, operator))) {
|
|
3
|
+
if (field && (r = bbn.fn.getRow(arr, prop, val, operator))) {
|
|
5
4
|
return r[field];
|
|
6
5
|
}
|
|
7
6
|
return undefined;
|
package/dist/fn/getPath.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { replaceAll } from './replaceAll';
|
|
2
2
|
const getPath = function (element) {
|
|
3
|
-
let path,
|
|
3
|
+
let path,
|
|
4
|
+
//node = $(element),
|
|
5
|
+
node = element, done = false;
|
|
4
6
|
while (node.length) {
|
|
7
|
+
//let realNode = node[0],
|
|
5
8
|
let realNode = node, name = realNode.localName;
|
|
6
9
|
if (!name)
|
|
7
10
|
break;
|
|
@@ -16,9 +19,17 @@ const getPath = function (element) {
|
|
|
16
19
|
}
|
|
17
20
|
done = 1;
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
//var parent = node.parent(),
|
|
23
|
+
let parent = node.parentNode,
|
|
24
|
+
//sameTagSiblings = parent.children(name);
|
|
25
|
+
sameTagSiblings = parent.children.filter(val => {
|
|
26
|
+
return val.tagName === name;
|
|
27
|
+
});
|
|
20
28
|
if (sameTagSiblings.length > 1) {
|
|
21
|
-
|
|
29
|
+
//var allSiblings = parent.children(),
|
|
30
|
+
let allSiblings = parent.children,
|
|
31
|
+
//index = allSiblings.index(realNode) + 1;
|
|
32
|
+
index = allSiblings.indexOf(realNode) + 1;
|
|
22
33
|
if (index > 1) {
|
|
23
34
|
name += ':nth-child(' + index + ')';
|
|
24
35
|
}
|
package/dist/fn/getProp.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
const getProp = function (obj, prop) {
|
|
1
|
+
const getProp = function (obj, prop) {
|
|
2
|
+
checkType(obj, "object", bbn._("The obj must be an object in setProp"));
|
|
3
|
+
checkType(prop, "string", bbn._("The prop must be a string in setProp"));
|
|
4
|
+
return obj[prop];
|
|
5
|
+
};
|
|
2
6
|
export { getProp };
|