@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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { checkPropsDetails } from './checkPropsDetails';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var res = checkPropsDetails(obj, props, checkEmpty);
|
|
2
|
+
const checkPropsOrDie = function (obj, props, checkEmpty = false) {
|
|
3
|
+
let res = checkPropsDetails(obj, props, checkEmpty);
|
|
5
4
|
if (res.error) {
|
|
6
5
|
throw new Error(res.error);
|
|
7
6
|
}
|
package/dist/fn/checkType.js
CHANGED
|
@@ -5,18 +5,13 @@ import { isString } from './isString';
|
|
|
5
5
|
import { correctCase } from './correctCase';
|
|
6
6
|
import { error } from './error';
|
|
7
7
|
import { log } from './log';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
for (var _i = 3; _i < arguments.length; _i++) {
|
|
11
|
-
logs[_i - 3] = arguments[_i];
|
|
12
|
-
}
|
|
13
|
-
var ok = false;
|
|
8
|
+
const checkType = function (value, type, msg, ...logs) {
|
|
9
|
+
let ok = false;
|
|
14
10
|
if (!isArray(type)) {
|
|
15
11
|
type = [type];
|
|
16
12
|
}
|
|
17
|
-
|
|
18
|
-
each(type,
|
|
19
|
-
var _a;
|
|
13
|
+
const typesList = [];
|
|
14
|
+
each(type, (t) => {
|
|
20
15
|
if (t === String) {
|
|
21
16
|
t = 'string';
|
|
22
17
|
}
|
|
@@ -36,14 +31,14 @@ var checkType = function (value, type, msg) {
|
|
|
36
31
|
t = 'function';
|
|
37
32
|
}
|
|
38
33
|
if (isFunction(t)) {
|
|
39
|
-
typesList.push(t.name ||
|
|
34
|
+
typesList.push(t.name || t.constructor?.name || t.toString());
|
|
40
35
|
if (value instanceof t) {
|
|
41
36
|
ok = true;
|
|
42
37
|
return false;
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
40
|
else if (!isString(t) || !isFunction(bbn.fn['is' + correctCase(t)])) {
|
|
46
|
-
error(
|
|
41
|
+
error(`The type ${t} is not recognized`);
|
|
47
42
|
}
|
|
48
43
|
else if (bbn.fn['is' + correctCase(t)](value)) {
|
|
49
44
|
ok = true;
|
package/dist/fn/chrono.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { each } from './each';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const _private = [];
|
|
3
|
+
const startChrono = function (name) {
|
|
4
|
+
let now = new Date().getTime();
|
|
5
|
+
let h1 = 3600 * 1000;
|
|
6
6
|
if (_private.length) {
|
|
7
|
-
each(_private,
|
|
7
|
+
each(_private, (t, n) => {
|
|
8
8
|
if (now - t > h1) {
|
|
9
9
|
delete _private[n];
|
|
10
10
|
}
|
|
@@ -13,10 +13,10 @@ var startChrono = function (name) {
|
|
|
13
13
|
}
|
|
14
14
|
_private[name] = now;
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
const stopChrono = function (name) {
|
|
17
17
|
if (_private[name]) {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
let now = new Date().getTime();
|
|
19
|
+
let 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
|
|
4
|
+
const circularReplacer = function () {
|
|
5
|
+
const visited = new WeakSet();
|
|
6
|
+
return (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
|
+
const clone = function (obj) {
|
|
5
5
|
if (isArray(obj)) {
|
|
6
|
-
return obj.slice().map(
|
|
6
|
+
return obj.slice().map((a) => {
|
|
7
7
|
return typeof a === 'object' ? clone(a) : a;
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
if (isObject(obj)) {
|
|
11
|
-
|
|
11
|
+
const 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
|
+
const 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
|
+
const 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,
|
|
10
|
-
|
|
8
|
+
let ok = filter.logic === 'AND' ? true : false;
|
|
9
|
+
each(filter.conditions, (a) => {
|
|
10
|
+
let 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
|
+
let bits = a.field.split('.');
|
|
18
|
+
let prop = bits.pop();
|
|
19
19
|
if (bits.length) {
|
|
20
|
-
each(bits,
|
|
20
|
+
each(bits, (b) => (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,19 +1,17 @@
|
|
|
1
1
|
import { isObject } from './isObject';
|
|
2
2
|
import { isFunction } from './isFunction';
|
|
3
|
-
|
|
4
|
-
return new Promise(
|
|
5
|
-
var _a;
|
|
3
|
+
const copy = function (st) {
|
|
4
|
+
return new Promise((resolve) => {
|
|
6
5
|
if (st) {
|
|
7
6
|
if (navigator && navigator.clipboard) {
|
|
8
7
|
if (st instanceof Blob) {
|
|
9
|
-
navigator.clipboard.write([new ClipboardItem(
|
|
8
|
+
navigator.clipboard.write([new ClipboardItem({ [st.type.toString()]: st })]).then(() => {
|
|
10
9
|
resolve(true);
|
|
11
10
|
});
|
|
12
11
|
}
|
|
13
12
|
else if (isObject(st) && isFunction(st.toBlob)) {
|
|
14
|
-
st.toBlob(
|
|
15
|
-
|
|
16
|
-
navigator.clipboard.write([new ClipboardItem((_a = {}, _a[blob.type.toString()] = blob, _a))]).then(function () {
|
|
13
|
+
st.toBlob((blob) => {
|
|
14
|
+
navigator.clipboard.write([new ClipboardItem({ [blob.type.toString()]: blob })]).then(() => {
|
|
17
15
|
resolve(true);
|
|
18
16
|
});
|
|
19
17
|
});
|
|
@@ -24,7 +22,7 @@ var copy = function (st) {
|
|
|
24
22
|
}
|
|
25
23
|
return;
|
|
26
24
|
}
|
|
27
|
-
|
|
25
|
+
let input = document.createElement('textarea');
|
|
28
26
|
input.style.opacity = '0';
|
|
29
27
|
input.value = st;
|
|
30
28
|
document.body.appendChild(input);
|
package/dist/fn/correctCase.js
CHANGED
package/dist/fn/count.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { filter } from './filter';
|
|
2
|
-
|
|
3
|
-
if (val === void 0) { val = null; }
|
|
4
|
-
if (operator === void 0) { operator = '='; }
|
|
2
|
+
const count = function (arr, prop, val = null, operator = '=') {
|
|
5
3
|
return filter(arr, prop, val, operator).length || 0;
|
|
6
4
|
};
|
|
7
5
|
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
|
+
const crc32Table = [];
|
|
3
|
+
for (let i = 0; i < 256; i++) {
|
|
4
|
+
let c = i;
|
|
5
|
+
for (let 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
|
+
const crc32 = function (str) {
|
|
11
|
+
let crc = 0 ^ -1;
|
|
12
|
+
for (let i = 0; i < str.length; i++) {
|
|
13
|
+
const 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,21 +1,8 @@
|
|
|
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
|
-
};
|
|
10
1
|
import { extend } from './extend';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
14
|
-
args[_i] = arguments[_i];
|
|
15
|
-
}
|
|
16
|
-
var obj = Object.create(null);
|
|
2
|
+
const createObject = function (...args) {
|
|
3
|
+
const obj = Object.create(null);
|
|
17
4
|
if (args.length) {
|
|
18
|
-
extend
|
|
5
|
+
extend(obj, ...args);
|
|
19
6
|
}
|
|
20
7
|
return obj;
|
|
21
8
|
};
|
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
|
+
const cssExists = function (f) {
|
|
4
|
+
let ok;
|
|
5
|
+
let rules;
|
|
6
|
+
let css = document.styleSheets;
|
|
7
|
+
for (let 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 @@ var cssExists = function (f) {
|
|
|
17
17
|
}
|
|
18
18
|
if (ok) {
|
|
19
19
|
//log(rules);
|
|
20
|
-
for (
|
|
20
|
+
for (let 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
|
+
const date = function (v) {
|
|
5
|
+
let 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,19 +1,18 @@
|
|
|
1
1
|
import { search } from './search';
|
|
2
2
|
import { each } from './each';
|
|
3
3
|
import { isArray } from './isArray';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var start = 0;
|
|
4
|
+
const deepPath = function (arr, filter, deepProperty, res = []) {
|
|
5
|
+
let idx;
|
|
6
|
+
let start = 0;
|
|
8
7
|
if ((idx = search(arr, filter, start)) > -1) {
|
|
9
8
|
res.push(idx);
|
|
10
9
|
return res;
|
|
11
10
|
}
|
|
12
|
-
each(arr,
|
|
11
|
+
each(arr, (it, i) => {
|
|
13
12
|
if (isArray(it[deepProperty])) {
|
|
14
|
-
|
|
13
|
+
let r = res.slice();
|
|
15
14
|
r.push(i);
|
|
16
|
-
|
|
15
|
+
let tmp = deepPath(it[deepProperty], filter, deepProperty, r);
|
|
17
16
|
if (tmp !== false) {
|
|
18
17
|
return tmp;
|
|
19
18
|
}
|
package/dist/fn/deleteProp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { checkType } from './checkType';
|
|
2
|
-
|
|
2
|
+
const 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,14 +4,12 @@ import { isFunction } from './isFunction';
|
|
|
4
4
|
import { isValue } from './isValue';
|
|
5
5
|
import { isDom } from './isDom';
|
|
6
6
|
import { numProperties } from './numProperties';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (unchanged === void 0) { unchanged = false; }
|
|
10
|
-
if (notRoot === void 0) { notRoot = false; }
|
|
7
|
+
let diffObjProcessed = [];
|
|
8
|
+
const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
|
|
11
9
|
if (!notRoot) {
|
|
12
10
|
diffObjProcessed = [];
|
|
13
11
|
}
|
|
14
|
-
|
|
12
|
+
let VALUE_CREATED = 'created', VALUE_UPDATED = 'updated', VALUE_DELETED = 'deleted', VALUE_UNCHANGED = 'unchanged', _compareValues = function (value1, value2) {
|
|
15
13
|
if (value1 === value2) {
|
|
16
14
|
return VALUE_UNCHANGED;
|
|
17
15
|
}
|
|
@@ -29,12 +27,12 @@ var diffObj = function (obj1, obj2, unchanged, notRoot) {
|
|
|
29
27
|
if (notRoot === undefined) {
|
|
30
28
|
notRoot = false;
|
|
31
29
|
}
|
|
32
|
-
|
|
30
|
+
let diff = createObject();
|
|
33
31
|
if (!isFunction(obj1) && !isFunction(obj2)) {
|
|
34
32
|
if (isValue(obj1) || isValue(obj2)) {
|
|
35
|
-
|
|
33
|
+
let res = _compareValues(obj1, obj2);
|
|
36
34
|
if (unchanged || res !== VALUE_UNCHANGED) {
|
|
37
|
-
|
|
35
|
+
let ret = createObject();
|
|
38
36
|
Object.defineProperty(ret, 'type', {
|
|
39
37
|
value: res,
|
|
40
38
|
enumerable: false,
|
|
@@ -65,24 +63,24 @@ var diffObj = function (obj1, obj2, unchanged, notRoot) {
|
|
|
65
63
|
return false;
|
|
66
64
|
}
|
|
67
65
|
diffObjProcessed.push(obj1, obj2);
|
|
68
|
-
for (
|
|
66
|
+
for (let key in obj1) {
|
|
69
67
|
if (isFunction(obj1[key])) {
|
|
70
68
|
continue;
|
|
71
69
|
}
|
|
72
|
-
|
|
70
|
+
let value2 = undefined;
|
|
73
71
|
if ('undefined' != typeof obj2[key]) {
|
|
74
72
|
value2 = obj2[key];
|
|
75
73
|
}
|
|
76
|
-
|
|
74
|
+
let res = diffObj(obj1[key], value2, unchanged, true);
|
|
77
75
|
if (res) {
|
|
78
76
|
diff[key] = res;
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
|
-
for (
|
|
79
|
+
for (let key in obj2) {
|
|
82
80
|
if (isFunction(obj2[key]) || 'undefined' != typeof obj1[key]) {
|
|
83
81
|
continue;
|
|
84
82
|
}
|
|
85
|
-
|
|
83
|
+
let res = diffObj(undefined, obj2[key], unchanged, true);
|
|
86
84
|
if (res) {
|
|
87
85
|
diff[key] = res;
|
|
88
86
|
}
|
package/dist/fn/dirName.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isString } from './isString';
|
|
2
2
|
import { substr } from './substr';
|
|
3
|
-
|
|
3
|
+
const 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
|
+
let 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
|
+
const 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 },
|
|
14
|
+
return ajax(url, 'blob', params || { _bbn_download: 1 }, (d, headers) => {
|
|
15
15
|
if (!filename) {
|
|
16
|
-
|
|
16
|
+
let 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 @@ var download = function (url, filename, params) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
if (isBlob(d)) {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
let extension = fileExt(filename);
|
|
26
|
+
let 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
|
-
},
|
|
32
|
+
}, 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
|
+
const downloadContent = function (filename, content, type) {
|
|
6
6
|
if (isCanvas(content)) {
|
|
7
|
-
content.toBlob(
|
|
7
|
+
content.toBlob((blob) => {
|
|
8
8
|
// blob ready, download it
|
|
9
|
-
|
|
9
|
+
let 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 @@ var downloadContent = function (filename, content, type) {
|
|
|
22
22
|
else if (type.indexOf('/') === -1) {
|
|
23
23
|
type = 'text/' + type;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
let a = window.document.createElement('a');
|
|
26
26
|
a.className = 'bbn-no';
|
|
27
|
-
|
|
27
|
+
let 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
|
+
const each = function (arr, fn) {
|
|
5
5
|
if (isNumber(arr) && arr > 0) {
|
|
6
|
-
for (
|
|
6
|
+
for (let i = 0; i < arr; i++) {
|
|
7
7
|
if (fn(i, i) === false) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
@@ -11,7 +11,7 @@ var each = function (arr, fn) {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
if (isIterable(arr)) {
|
|
14
|
-
for (
|
|
14
|
+
for (let 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
|
+
const error = function (errorMsg) {
|
|
3
3
|
if (arguments.length > 1) {
|
|
4
|
-
|
|
5
|
-
for (
|
|
4
|
+
const args = [];
|
|
5
|
+
for (let i = 1; i < arguments.length; i++) {
|
|
6
6
|
args.push(arguments[i]);
|
|
7
7
|
}
|
|
8
8
|
args.unshift({
|