@bbn/bbn 1.0.34 → 1.0.35
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 +1105 -824
- package/dist/fn/_addLoader.js +5 -5
- package/dist/fn/_compareValues.js +3 -2
- package/dist/fn/_deleteLoader.js +13 -11
- 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 +12 -10
- 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 +6 -5
- 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 +11 -7
- 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 +2 -1
- package/dist/fn/checkPropsDetails.js +9 -8
- package/dist/fn/checkPropsOrDie.js +3 -2
- package/dist/fn/checkType.js +9 -5
- 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 +8 -6
- package/dist/fn/correctCase.js +2 -2
- package/dist/fn/count.js +3 -1
- package/dist/fn/crc32.js +8 -8
- package/dist/fn/createObject.js +16 -3
- 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 +7 -6
- package/dist/fn/defaultAjaxAbortFunction.js +2 -1
- 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 +2 -1
- package/dist/fn/deleteProp.js +1 -1
- package/dist/fn/diffObj.js +13 -11
- 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 +13 -9
- package/dist/fn/extendOut.js +9 -4
- 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 +8 -6
- package/dist/fn/filterToConditions.js +7 -6
- package/dist/fn/findAll.js +5 -4
- package/dist/fn/fori.js +5 -3
- package/dist/fn/forir.js +5 -3
- package/dist/fn/format.js +5 -5
- package/dist/fn/formatBytes.js +3 -2
- 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 +14 -8
- 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 +5 -2
- package/dist/fn/getFieldValues.js +3 -3
- package/dist/fn/getHTMLOfSelection.js +5 -5
- package/dist/fn/getHtml.js +3 -2
- package/dist/fn/getLoader.js +2 -2
- package/dist/fn/getPath.js +23 -16
- 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 +3 -1
- 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 +5 -1
- 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 +3 -2
- package/dist/fn/info.js +5 -1
- package/dist/fn/init.js +17 -17
- package/dist/fn/isActiveInterface.js +3 -2
- package/dist/fn/isArray.js +7 -2
- package/dist/fn/isBlob.js +7 -2
- package/dist/fn/isBoolean.js +7 -2
- package/dist/fn/isCanvas.js +7 -2
- package/dist/fn/isColor.js +7 -2
- package/dist/fn/isComment.js +7 -2
- package/dist/fn/isCp.js +8 -3
- package/dist/fn/isDate.js +7 -2
- package/dist/fn/isDesktopDevice.js +1 -1
- package/dist/fn/isDimension.js +7 -2
- package/dist/fn/isDom.js +7 -2
- package/dist/fn/isEmail.js +8 -3
- package/dist/fn/isEmpty.js +1 -1
- package/dist/fn/isEvent.js +7 -2
- package/dist/fn/isFocused.js +1 -1
- package/dist/fn/isFunction.js +7 -2
- package/dist/fn/isHostname.js +7 -2
- package/dist/fn/isIP.js +7 -2
- package/dist/fn/isInside.js +6 -6
- package/dist/fn/isInt.js +7 -2
- 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 +7 -2
- package/dist/fn/isNumber.js +7 -2
- package/dist/fn/isObject.js +7 -2
- package/dist/fn/isPercent.js +7 -2
- package/dist/fn/isPrimitive.js +7 -2
- package/dist/fn/isPromise.js +7 -2
- package/dist/fn/isPropSize.js +3 -3
- package/dist/fn/isSQLDate.js +7 -2
- package/dist/fn/isSame.js +7 -7
- package/dist/fn/isString.js +7 -2
- package/dist/fn/isSymbol.js +7 -2
- package/dist/fn/isTabletDevice.js +1 -1
- package/dist/fn/isURL.js +7 -2
- package/dist/fn/isValidDimension.js +3 -3
- package/dist/fn/isValidName.js +7 -2
- package/dist/fn/isValue.js +7 -2
- package/dist/fn/isVue.js +11 -4
- package/dist/fn/iterate.js +5 -3
- package/dist/fn/lightenDarkenHex.js +3 -3
- package/dist/fn/link.js +11 -7
- package/dist/fn/log.js +10 -6
- package/dist/fn/makeReactive.js +27 -23
- package/dist/fn/map.js +3 -2
- 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 +7 -6
- package/dist/fn/nl2br.js +1 -1
- package/dist/fn/numProperties.js +1 -1
- package/dist/fn/objectToFormData.js +7 -5
- package/dist/fn/order.js +2 -1
- 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 +7 -3
- 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 +3 -2
- package/dist/fn/removeTrailingChars.js +1 -1
- package/dist/fn/repeat.js +1 -1
- package/dist/fn/replaceAll.js +2 -1
- 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 +7 -6
- package/dist/fn/search.js +9 -6
- 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 +3 -1
- package/dist/fn/setProperty.js +9 -9
- package/dist/fn/shorten.js +1 -1
- package/dist/fn/shortenObj.js +4 -3
- package/dist/fn/shuffle.js +4 -3
- 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 +10 -7
- 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 +2 -1
- package/dist/fn/uniqString.js +14 -7
- 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 +241 -237
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { checkPropsDetails } from './checkPropsDetails';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var checkPropsOrDie = function (obj, props, checkEmpty) {
|
|
3
|
+
if (checkEmpty === void 0) { checkEmpty = false; }
|
|
4
|
+
var res = checkPropsDetails(obj, props, checkEmpty);
|
|
4
5
|
if (res.error) {
|
|
5
6
|
throw new Error(res.error);
|
|
6
7
|
}
|
package/dist/fn/checkType.js
CHANGED
|
@@ -5,13 +5,17 @@ import { isString } from './isString';
|
|
|
5
5
|
import { correctCase } from './correctCase';
|
|
6
6
|
import { error } from './error';
|
|
7
7
|
import { log } from './log';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
var checkType = function (value, type, msg) {
|
|
9
|
+
var logs = [];
|
|
10
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
11
|
+
logs[_i - 3] = arguments[_i];
|
|
12
|
+
}
|
|
13
|
+
var ok = false;
|
|
10
14
|
if (!isArray(type)) {
|
|
11
15
|
type = [type];
|
|
12
16
|
}
|
|
13
|
-
|
|
14
|
-
each(type, (t)
|
|
17
|
+
var typesList = [];
|
|
18
|
+
each(type, function (t) {
|
|
15
19
|
var _a;
|
|
16
20
|
if (t === String) {
|
|
17
21
|
t = 'string';
|
|
@@ -39,7 +43,7 @@ const checkType = function (value, type, msg, ...logs) {
|
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
else if (!isString(t) || !isFunction(bbn.fn['is' + correctCase(t)])) {
|
|
42
|
-
error(
|
|
46
|
+
error("The type ".concat(t, " is not recognized"));
|
|
43
47
|
}
|
|
44
48
|
else if (bbn.fn['is' + correctCase(t)](value)) {
|
|
45
49
|
ok = true;
|
package/dist/fn/chrono.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { each } from './each';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var _private = [];
|
|
3
|
+
var startChrono = function (name) {
|
|
4
|
+
var now = new Date().getTime();
|
|
5
|
+
var h1 = 3600 * 1000;
|
|
6
6
|
if (_private.length) {
|
|
7
|
-
each(_private, (t, n)
|
|
7
|
+
each(_private, function (t, n) {
|
|
8
8
|
if (now - t > h1) {
|
|
9
9
|
delete _private[n];
|
|
10
10
|
}
|
|
@@ -13,10 +13,10 @@ const startChrono = function (name) {
|
|
|
13
13
|
}
|
|
14
14
|
_private[name] = now;
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
var stopChrono = function (name) {
|
|
17
17
|
if (_private[name]) {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
var now = new Date().getTime();
|
|
19
|
+
var diff = now - _private[name];
|
|
20
20
|
return diff;
|
|
21
21
|
}
|
|
22
22
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isDom } from './isDom';
|
|
2
2
|
import { isCp } from './isCp';
|
|
3
3
|
import { log } from './log';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return (key, value)
|
|
4
|
+
var circularReplacer = function () {
|
|
5
|
+
var visited = new WeakSet();
|
|
6
|
+
return function (key, value) {
|
|
7
7
|
if (typeof value === 'object' && value !== null) {
|
|
8
8
|
if (visited.has(value)) {
|
|
9
9
|
return;
|
package/dist/fn/clone.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { isArray } from './isArray';
|
|
2
2
|
import { isObject } from './isObject';
|
|
3
3
|
import { extend } from './extend';
|
|
4
|
-
|
|
4
|
+
var clone = function (obj) {
|
|
5
5
|
if (isArray(obj)) {
|
|
6
|
-
return obj.slice().map((a)
|
|
6
|
+
return obj.slice().map(function (a) {
|
|
7
7
|
return typeof a === 'object' ? clone(a) : a;
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
if (isObject(obj)) {
|
|
11
|
-
|
|
11
|
+
var o = Object.create(Object.getPrototypeOf(obj));
|
|
12
12
|
return extend(true, o, obj);
|
|
13
13
|
}
|
|
14
14
|
return obj;
|
package/dist/fn/colorToHex.js
CHANGED
package/dist/fn/compare.js
CHANGED
|
@@ -3,7 +3,7 @@ import { removeAccents } from './removeAccents';
|
|
|
3
3
|
import { isNull } from './isNull';
|
|
4
4
|
import { isObject } from './isObject';
|
|
5
5
|
import { isSame } from './isSame';
|
|
6
|
-
|
|
6
|
+
var compare = function (v1, v2, operator) {
|
|
7
7
|
switch (operator) {
|
|
8
8
|
case '===':
|
|
9
9
|
case '=':
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { isArray } from './isArray';
|
|
2
2
|
import { each } from './each';
|
|
3
3
|
import { getProperty } from './getProperty';
|
|
4
|
-
|
|
4
|
+
var compareConditions = function (data, filter) {
|
|
5
5
|
if (!filter.conditions || !filter.logic || !isArray(filter.conditions)) {
|
|
6
6
|
throw new Error('Error in compareConditions: the filter should an abject with conditions and logic properties and conditions should be an array of objects');
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
each(filter.conditions, (a)
|
|
10
|
-
|
|
8
|
+
var ok = filter.logic === 'AND' ? true : false;
|
|
9
|
+
each(filter.conditions, function (a) {
|
|
10
|
+
var compare;
|
|
11
11
|
if (a.conditions && isArray(a.conditions)) {
|
|
12
12
|
compare = compareConditions(data, a);
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
15
|
compare = compare(getProperty(data, a.field), a.value, a.operator);
|
|
16
16
|
if (compare) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
var bits = a.field.split('.');
|
|
18
|
+
var prop = bits.pop();
|
|
19
19
|
if (bits.length) {
|
|
20
|
-
each(bits, (b)
|
|
20
|
+
each(bits, function (b) { return (data = data[b]); });
|
|
21
21
|
}
|
|
22
22
|
// Case where both are undefined: value and prop which doesn't exist; they are not the same!
|
|
23
23
|
if (getProperty(data, prop) === undefined && a.value !== undefined) {
|
package/dist/fn/copy.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { isObject } from './isObject';
|
|
2
2
|
import { isFunction } from './isFunction';
|
|
3
|
-
|
|
4
|
-
return new Promise((resolve)
|
|
3
|
+
var copy = function (st) {
|
|
4
|
+
return new Promise(function (resolve) {
|
|
5
|
+
var _a;
|
|
5
6
|
if (st) {
|
|
6
7
|
if (navigator && navigator.clipboard) {
|
|
7
8
|
if (st instanceof Blob) {
|
|
8
|
-
navigator.clipboard.write([new ClipboardItem({ [st.type.toString()]
|
|
9
|
+
navigator.clipboard.write([new ClipboardItem((_a = {}, _a[st.type.toString()] = st, _a))]).then(function () {
|
|
9
10
|
resolve(true);
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
13
|
else if (isObject(st) && isFunction(st.toBlob)) {
|
|
13
|
-
st.toBlob((blob)
|
|
14
|
-
|
|
14
|
+
st.toBlob(function (blob) {
|
|
15
|
+
var _a;
|
|
16
|
+
navigator.clipboard.write([new ClipboardItem((_a = {}, _a[blob.type.toString()] = blob, _a))]).then(function () {
|
|
15
17
|
resolve(true);
|
|
16
18
|
});
|
|
17
19
|
});
|
|
@@ -22,7 +24,7 @@ const copy = function (st) {
|
|
|
22
24
|
}
|
|
23
25
|
return;
|
|
24
26
|
}
|
|
25
|
-
|
|
27
|
+
var input = document.createElement('textarea');
|
|
26
28
|
input.style.opacity = '0';
|
|
27
29
|
input.value = st;
|
|
28
30
|
document.body.appendChild(input);
|
package/dist/fn/correctCase.js
CHANGED
package/dist/fn/count.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { filter } from './filter';
|
|
2
|
-
|
|
2
|
+
var count = function (arr, prop, val, operator) {
|
|
3
|
+
if (val === void 0) { val = null; }
|
|
4
|
+
if (operator === void 0) { operator = '='; }
|
|
3
5
|
return filter(arr, prop, val, operator).length || 0;
|
|
4
6
|
};
|
|
5
7
|
export { count };
|
package/dist/fn/crc32.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// this is a test
|
|
2
|
-
|
|
3
|
-
for (
|
|
4
|
-
|
|
5
|
-
for (
|
|
2
|
+
var crc32Table = [];
|
|
3
|
+
for (var i = 0; i < 256; i++) {
|
|
4
|
+
var c = i;
|
|
5
|
+
for (var j = 0; j < 8; j++) {
|
|
6
6
|
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
7
7
|
}
|
|
8
8
|
crc32Table.push(c);
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
for (
|
|
13
|
-
|
|
10
|
+
var crc32 = function (str) {
|
|
11
|
+
var crc = 0 ^ -1;
|
|
12
|
+
for (var i = 0; i < str.length; i++) {
|
|
13
|
+
var charCode = str.charCodeAt(i);
|
|
14
14
|
crc = (crc >>> 8) ^ crc32Table[(crc ^ charCode) & 0xff];
|
|
15
15
|
}
|
|
16
16
|
return (crc ^ -1) >>> 0; // Make sure the result is a 32-bit positive integer
|
package/dist/fn/createObject.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
+
};
|
|
1
10
|
import { extend } from './extend';
|
|
2
|
-
|
|
3
|
-
|
|
11
|
+
var createObject = function () {
|
|
12
|
+
var args = [];
|
|
13
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
14
|
+
args[_i] = arguments[_i];
|
|
15
|
+
}
|
|
16
|
+
var obj = Object.create(null);
|
|
4
17
|
if (args.length) {
|
|
5
|
-
extend(obj,
|
|
18
|
+
extend.apply(void 0, __spreadArray([obj], args, false));
|
|
6
19
|
}
|
|
7
20
|
return obj;
|
|
8
21
|
};
|
package/dist/fn/cssExists.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//import { log } from './log';
|
|
2
2
|
import { escapeRegExp } from './escapeRegExp';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
for (
|
|
3
|
+
var cssExists = function (f) {
|
|
4
|
+
var ok;
|
|
5
|
+
var rules;
|
|
6
|
+
var css = document.styleSheets;
|
|
7
|
+
for (var sx = 0; sx < css.length; sx++) {
|
|
8
8
|
ok = 1;
|
|
9
9
|
try {
|
|
10
10
|
rules = css[sx].rules || css[sx].cssRules;
|
|
@@ -17,7 +17,7 @@ const cssExists = function (f) {
|
|
|
17
17
|
}
|
|
18
18
|
if (ok) {
|
|
19
19
|
//log(rules);
|
|
20
|
-
for (
|
|
20
|
+
for (var cx = 0; cx < rules.length; cx++) {
|
|
21
21
|
//log(rules[cx].selectorText);
|
|
22
22
|
if (new RegExp('(^|\\s)' + escapeRegExp(f) + '(\\{|\\s)', 'g').test(rules[cx].selectorText)) {
|
|
23
23
|
return true;
|
package/dist/fn/date.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isNumber } from './isNumber';
|
|
2
2
|
import { substr } from './substr';
|
|
3
3
|
import { isDate } from './isDate';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var date = function (v) {
|
|
5
|
+
var d = false, t = typeof v;
|
|
6
6
|
if (v === undefined) {
|
|
7
7
|
return new Date();
|
|
8
8
|
}
|
package/dist/fn/dateSQL.js
CHANGED
package/dist/fn/daysInMonth.js
CHANGED
package/dist/fn/deepPath.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { search } from './search';
|
|
2
2
|
import { each } from './each';
|
|
3
3
|
import { isArray } from './isArray';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
var deepPath = function (arr, filter, deepProperty, res) {
|
|
5
|
+
if (res === void 0) { res = []; }
|
|
6
|
+
var idx;
|
|
7
|
+
var start = 0;
|
|
7
8
|
if ((idx = search(arr, filter, start)) > -1) {
|
|
8
9
|
res.push(idx);
|
|
9
10
|
return res;
|
|
10
11
|
}
|
|
11
|
-
each(arr, (it, i)
|
|
12
|
+
each(arr, function (it, i) {
|
|
12
13
|
if (isArray(it[deepProperty])) {
|
|
13
|
-
|
|
14
|
+
var r = res.slice();
|
|
14
15
|
r.push(i);
|
|
15
|
-
|
|
16
|
+
var tmp = deepPath(it[deepProperty], filter, deepProperty, r);
|
|
16
17
|
if (tmp !== false) {
|
|
17
18
|
return tmp;
|
|
18
19
|
}
|
package/dist/fn/deleteProp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { checkType } from './checkType';
|
|
2
|
-
|
|
2
|
+
var deleteProp = function (obj, prop) {
|
|
3
3
|
checkType(obj, 'object', bbn._('The obj must be an object in setProp'));
|
|
4
4
|
checkType(prop, 'string', bbn._('The prop must be a string in setProp'));
|
|
5
5
|
delete obj[prop];
|
package/dist/fn/diffObj.js
CHANGED
|
@@ -4,12 +4,14 @@ import { isFunction } from './isFunction';
|
|
|
4
4
|
import { isValue } from './isValue';
|
|
5
5
|
import { isDom } from './isDom';
|
|
6
6
|
import { numProperties } from './numProperties';
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
var diffObjProcessed = [];
|
|
8
|
+
var diffObj = function (obj1, obj2, unchanged, notRoot) {
|
|
9
|
+
if (unchanged === void 0) { unchanged = false; }
|
|
10
|
+
if (notRoot === void 0) { notRoot = false; }
|
|
9
11
|
if (!notRoot) {
|
|
10
12
|
diffObjProcessed = [];
|
|
11
13
|
}
|
|
12
|
-
|
|
14
|
+
var VALUE_CREATED = 'created', VALUE_UPDATED = 'updated', VALUE_DELETED = 'deleted', VALUE_UNCHANGED = 'unchanged', _compareValues = function (value1, value2) {
|
|
13
15
|
if (value1 === value2) {
|
|
14
16
|
return VALUE_UNCHANGED;
|
|
15
17
|
}
|
|
@@ -27,12 +29,12 @@ const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
|
|
|
27
29
|
if (notRoot === undefined) {
|
|
28
30
|
notRoot = false;
|
|
29
31
|
}
|
|
30
|
-
|
|
32
|
+
var diff = createObject();
|
|
31
33
|
if (!isFunction(obj1) && !isFunction(obj2)) {
|
|
32
34
|
if (isValue(obj1) || isValue(obj2)) {
|
|
33
|
-
|
|
35
|
+
var res = _compareValues(obj1, obj2);
|
|
34
36
|
if (unchanged || res !== VALUE_UNCHANGED) {
|
|
35
|
-
|
|
37
|
+
var ret = createObject();
|
|
36
38
|
Object.defineProperty(ret, 'type', {
|
|
37
39
|
value: res,
|
|
38
40
|
enumerable: false,
|
|
@@ -63,24 +65,24 @@ const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
|
|
|
63
65
|
return false;
|
|
64
66
|
}
|
|
65
67
|
diffObjProcessed.push(obj1, obj2);
|
|
66
|
-
for (
|
|
68
|
+
for (var key in obj1) {
|
|
67
69
|
if (isFunction(obj1[key])) {
|
|
68
70
|
continue;
|
|
69
71
|
}
|
|
70
|
-
|
|
72
|
+
var value2 = undefined;
|
|
71
73
|
if ('undefined' != typeof obj2[key]) {
|
|
72
74
|
value2 = obj2[key];
|
|
73
75
|
}
|
|
74
|
-
|
|
76
|
+
var res = diffObj(obj1[key], value2, unchanged, true);
|
|
75
77
|
if (res) {
|
|
76
78
|
diff[key] = res;
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
|
-
for (
|
|
81
|
+
for (var key in obj2) {
|
|
80
82
|
if (isFunction(obj2[key]) || 'undefined' != typeof obj1[key]) {
|
|
81
83
|
continue;
|
|
82
84
|
}
|
|
83
|
-
|
|
85
|
+
var res = diffObj(undefined, obj2[key], unchanged, true);
|
|
84
86
|
if (res) {
|
|
85
87
|
diff[key] = res;
|
|
86
88
|
}
|
package/dist/fn/dirName.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isString } from './isString';
|
|
2
2
|
import { substr } from './substr';
|
|
3
|
-
|
|
3
|
+
var dirName = function (path) {
|
|
4
4
|
if (isString(path) && path) {
|
|
5
5
|
while (substr(path, path.length - 1) === '/') {
|
|
6
6
|
path = substr(path, 0, path.length - 1);
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
var pos = path.lastIndexOf('/');
|
|
9
9
|
if (pos > 0) {
|
|
10
10
|
return substr(path, 0, pos);
|
|
11
11
|
}
|
package/dist/fn/download.js
CHANGED
|
@@ -5,15 +5,15 @@ import { isBlob } from './isBlob';
|
|
|
5
5
|
import { fileExt } from './fileExt';
|
|
6
6
|
import { downloadContent } from './downloadContent';
|
|
7
7
|
import { defaultAjaxErrorFunction } from './defaultAjaxErrorFunction';
|
|
8
|
-
|
|
8
|
+
var download = function (url, filename, params) {
|
|
9
9
|
// We can intervert the arguments
|
|
10
10
|
if (filename && (typeof (filename) === 'object')) {
|
|
11
11
|
params = filename;
|
|
12
12
|
filename = null;
|
|
13
13
|
}
|
|
14
|
-
return ajax(url, 'blob', params || { _bbn_download: 1 }, (d, headers)
|
|
14
|
+
return ajax(url, 'blob', params || { _bbn_download: 1 }, function (d, headers) {
|
|
15
15
|
if (!filename) {
|
|
16
|
-
|
|
16
|
+
var cd = 'attachment; filename=';
|
|
17
17
|
if (headers && headers['content-disposition'] && headers['content-disposition'].indexOf(cd) === 0) {
|
|
18
18
|
filename = substr(headers['content-disposition'], cd.length + 1, headers['content-disposition'].length - cd.length - 2);
|
|
19
19
|
}
|
|
@@ -22,14 +22,14 @@ const download = function (url, filename, params) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
if (isBlob(d)) {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
var extension = fileExt(filename);
|
|
26
|
+
var htmlExtensions = ['php', 'html'];
|
|
27
27
|
if ((typeof filename === 'string') && ((('type' in d) && (d.type !== 'text/html')) || htmlExtensions.includes(extension))) {
|
|
28
28
|
downloadContent(filename, d);
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
}, e
|
|
32
|
+
}, function (e) {
|
|
33
33
|
defaultAjaxErrorFunction(e);
|
|
34
34
|
});
|
|
35
35
|
};
|
|
@@ -2,11 +2,11 @@ import { isCanvas } from './isCanvas';
|
|
|
2
2
|
import { isObject } from './isObject';
|
|
3
3
|
import { isString } from './isString';
|
|
4
4
|
import { log } from './log';
|
|
5
|
-
|
|
5
|
+
var downloadContent = function (filename, content, type) {
|
|
6
6
|
if (isCanvas(content)) {
|
|
7
|
-
content.toBlob((blob)
|
|
7
|
+
content.toBlob(function (blob) {
|
|
8
8
|
// blob ready, download it
|
|
9
|
-
|
|
9
|
+
var a = document.createElement('a');
|
|
10
10
|
a.download = filename;
|
|
11
11
|
a.href = window.URL.createObjectURL(blob);
|
|
12
12
|
a.className = 'bbn-no';
|
|
@@ -22,9 +22,9 @@ const downloadContent = function (filename, content, type) {
|
|
|
22
22
|
else if (type.indexOf('/') === -1) {
|
|
23
23
|
type = 'text/' + type;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
var a = window.document.createElement('a');
|
|
26
26
|
a.className = 'bbn-no';
|
|
27
|
-
|
|
27
|
+
var src = null;
|
|
28
28
|
if (isString(content)) {
|
|
29
29
|
src = new Blob([content], { type: type });
|
|
30
30
|
}
|
package/dist/fn/each.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isNumber } from './isNumber';
|
|
2
2
|
import { isIterable } from './isIterable';
|
|
3
3
|
import { iterate } from './iterate';
|
|
4
|
-
|
|
4
|
+
var each = function (arr, fn) {
|
|
5
5
|
if (isNumber(arr) && arr > 0) {
|
|
6
|
-
for (
|
|
6
|
+
for (var i = 0; i < arr; i++) {
|
|
7
7
|
if (fn(i, i) === false) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
@@ -11,7 +11,7 @@ const each = function (arr, fn) {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
if (isIterable(arr)) {
|
|
14
|
-
for (
|
|
14
|
+
for (var i = 0; i < arr.length; i++) {
|
|
15
15
|
if (fn(arr[i], i) === false) {
|
|
16
16
|
return;
|
|
17
17
|
}
|
package/dist/fn/eraseCookie.js
CHANGED
package/dist/fn/error.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { log } from './log';
|
|
2
|
-
|
|
2
|
+
var error = function (errorMsg) {
|
|
3
3
|
if (arguments.length > 1) {
|
|
4
|
-
|
|
5
|
-
for (
|
|
4
|
+
var args = [];
|
|
5
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6
6
|
args.push(arguments[i]);
|
|
7
7
|
}
|
|
8
8
|
args.unshift({
|
package/dist/fn/escapeDquotes.js
CHANGED