@bbn/bbn 1.0.27 → 1.0.29
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 +22 -22
- package/dist/fn/_addLoader.js +3 -6
- package/dist/fn/_compareValues.js +11 -14
- package/dist/fn/_deleteLoader.js +7 -10
- package/dist/fn/abort.js +3 -6
- package/dist/fn/abortURL.js +4 -7
- package/dist/fn/addColors.js +5 -8
- package/dist/fn/addInputs.js +3 -6
- package/dist/fn/addStyle.js +5 -8
- package/dist/fn/adjustHeight.js +5 -8
- package/dist/fn/adjustSize.js +5 -8
- package/dist/fn/adjustWidth.js +5 -8
- package/dist/fn/ajax.js +31 -34
- package/dist/fn/analyzeFunction.js +3 -6
- package/dist/fn/animateCss.js +1 -4
- package/dist/fn/arrayBuffer2String.js +1 -4
- package/dist/fn/arrayFromProp.js +5 -8
- package/dist/fn/autoExtend.js +4 -7
- package/dist/fn/baseName.js +6 -9
- package/dist/fn/br2nl.js +3 -6
- package/dist/fn/calendar.js +14 -20
- package/dist/fn/callback.js +16 -19
- package/dist/fn/camelToCss.js +1 -4
- package/dist/fn/camelize.js +1 -4
- package/dist/fn/canvasToImage.js +1 -4
- package/dist/fn/center.js +1 -4
- package/dist/fn/checkProps.js +3 -6
- package/dist/fn/checkPropsDetails.js +9 -12
- package/dist/fn/checkPropsOrDie.js +3 -6
- package/dist/fn/checkType.js +16 -19
- package/dist/fn/chrono.js +3 -7
- package/dist/fn/circularReplacer.js +7 -10
- package/dist/fn/clone.js +7 -10
- package/dist/fn/colorToHex.js +1 -4
- package/dist/fn/compare.js +18 -21
- package/dist/fn/compareConditions.js +10 -13
- package/dist/fn/copy.js +4 -7
- package/dist/fn/correctCase.js +1 -4
- package/dist/fn/count.js +3 -6
- package/dist/fn/crc32.js +1 -4
- package/dist/fn/createObject.js +3 -6
- package/dist/fn/cssExists.js +3 -6
- package/dist/fn/date.js +8 -11
- package/dist/fn/dateSQL.js +5 -11
- package/dist/fn/daysInMonth.js +5 -11
- package/dist/fn/deepPath.js +7 -10
- package/dist/fn/defaultAjaxAbortFunction.js +3 -6
- package/dist/fn/defaultAjaxErrorFunction.js +1 -4
- package/dist/fn/defaultAlertFunction.js +1 -4
- package/dist/fn/defaultConfirmFunction.js +4 -7
- package/dist/fn/defaultEndLoadingFunction.js +1 -4
- package/dist/fn/defaultErrorFunction.js +3 -6
- package/dist/fn/defaultHistoryFunction.js +1 -4
- package/dist/fn/defaultLinkFunction.js +1 -4
- package/dist/fn/defaultPostLinkFunction.js +1 -4
- package/dist/fn/defaultPreLinkFunction.js +1 -4
- package/dist/fn/defaultResizeFunction.js +1 -4
- package/dist/fn/defaultStartLoadingFunction.js +1 -4
- package/dist/fn/deleteProp.js +4 -7
- package/dist/fn/diffObj.js +16 -19
- package/dist/fn/dirName.js +7 -10
- package/dist/fn/download.js +15 -18
- package/dist/fn/downloadContent.js +9 -12
- package/dist/fn/each.js +7 -10
- package/dist/fn/eraseCookie.js +1 -4
- package/dist/fn/error.js +3 -6
- package/dist/fn/escapeDquotes.js +3 -6
- package/dist/fn/escapeRegExp.js +1 -4
- package/dist/fn/escapeSquotes.js +3 -6
- package/dist/fn/escapeTicks.js +3 -6
- package/dist/fn/escapeUrl.js +8 -11
- package/dist/fn/extend.js +13 -16
- package/dist/fn/extendOut.js +4 -7
- package/dist/fn/fdate.js +12 -18
- package/dist/fn/fdatetime.js +10 -16
- package/dist/fn/fieldValue.js +1 -4
- package/dist/fn/fileExt.js +3 -6
- package/dist/fn/filter.js +12 -15
- package/dist/fn/filterToConditions.js +8 -11
- package/dist/fn/findAll.js +7 -10
- package/dist/fn/fori.js +6 -9
- package/dist/fn/forir.js +6 -9
- package/dist/fn/format.js +3 -6
- package/dist/fn/formatBytes.js +1 -4
- package/dist/fn/formatDate.js +3 -9
- package/dist/fn/formatSize.js +5 -8
- package/dist/fn/formdata.js +11 -14
- package/dist/fn/fromXml.js +1 -4
- package/dist/fn/ftime.js +12 -18
- package/dist/fn/getAllTags.js +3 -6
- package/dist/fn/getAncestors.js +1 -4
- package/dist/fn/getAttributes.js +3 -6
- package/dist/fn/getBrowserName.js +1 -4
- package/dist/fn/getBrowserVersion.js +1 -4
- package/dist/fn/getCookie.js +1 -4
- package/dist/fn/getCssVar.js +1 -4
- package/dist/fn/getDay.js +3 -6
- package/dist/fn/getDeviceType.js +1 -4
- package/dist/fn/getEventData.js +7 -10
- package/dist/fn/getField.js +3 -6
- package/dist/fn/getFieldValues.js +7 -10
- package/dist/fn/getHTMLOfSelection.js +4 -7
- package/dist/fn/getHtml.js +3 -6
- package/dist/fn/getLoader.js +3 -6
- package/dist/fn/getPath.js +3 -6
- package/dist/fn/getProp.js +4 -7
- package/dist/fn/getProperty.js +1 -4
- package/dist/fn/getRequestId.js +5 -8
- package/dist/fn/getRow.js +3 -6
- package/dist/fn/getScrollBarSize.js +1 -4
- package/dist/fn/getText.js +1 -4
- package/dist/fn/getTimeoff.js +1 -4
- package/dist/fn/happy.js +3 -6
- package/dist/fn/hash.js +11 -14
- package/dist/fn/hex2rgb.js +1 -4
- package/dist/fn/history.js +1 -4
- package/dist/fn/html2text.js +1 -4
- package/dist/fn/imageToCanvas.js +1 -4
- package/dist/fn/imgToBase64.js +3 -6
- package/dist/fn/info.js +3 -6
- package/dist/fn/init.js +32 -58
- package/dist/fn/isActiveInterface.js +1 -4
- package/dist/fn/isArray.js +1 -4
- package/dist/fn/isBlob.js +1 -4
- package/dist/fn/isBoolean.js +1 -4
- package/dist/fn/isCanvas.js +1 -4
- package/dist/fn/isColor.js +3 -6
- package/dist/fn/isComment.js +1 -4
- package/dist/fn/isCp.js +3 -6
- package/dist/fn/isDate.js +1 -4
- package/dist/fn/isDesktopDevice.js +1 -4
- package/dist/fn/isDimension.js +3 -6
- package/dist/fn/isDom.js +1 -4
- package/dist/fn/isEmail.js +3 -6
- package/dist/fn/isEmpty.js +5 -8
- package/dist/fn/isEvent.js +1 -4
- package/dist/fn/isFocused.js +1 -4
- package/dist/fn/isFunction.js +1 -4
- package/dist/fn/isHostname.js +5 -8
- package/dist/fn/isIP.js +3 -6
- package/dist/fn/isInside.js +7 -10
- package/dist/fn/isInt.js +1 -4
- package/dist/fn/isIterable.js +1 -4
- package/dist/fn/isMobile.js +4 -7
- package/dist/fn/isMobileDevice.js +1 -4
- package/dist/fn/isNull.js +1 -4
- package/dist/fn/isNumber.js +1 -4
- package/dist/fn/isObject.js +1 -4
- package/dist/fn/isPercent.js +1 -4
- package/dist/fn/isPrimitive.js +1 -4
- package/dist/fn/isPromise.js +1 -4
- package/dist/fn/isPropSize.js +3 -6
- package/dist/fn/isSQLDate.js +1 -4
- package/dist/fn/isSame.js +5 -8
- package/dist/fn/isString.js +1 -4
- package/dist/fn/isSymbol.js +1 -4
- package/dist/fn/isTabletDevice.js +1 -4
- package/dist/fn/isURL.js +1 -4
- package/dist/fn/isValidDimension.js +4 -7
- package/dist/fn/isValidName.js +3 -6
- package/dist/fn/isValue.js +3 -6
- package/dist/fn/isVue.js +1 -4
- package/dist/fn/iterate.js +5 -8
- package/dist/fn/lightenDarkenHex.js +1 -4
- package/dist/fn/link.js +19 -22
- package/dist/fn/log.js +3 -6
- package/dist/fn/makeReactive.js +28 -31
- package/dist/fn/map.js +3 -6
- package/dist/fn/md5.js +1 -4
- package/dist/fn/money.js +3 -6
- package/dist/fn/move.js +1 -4
- package/dist/fn/multiorder.js +3 -6
- package/dist/fn/nl2br.js +3 -6
- package/dist/fn/numProperties.js +1 -4
- package/dist/fn/objectToFormData.js +12 -15
- package/dist/fn/order.js +3 -6
- package/dist/fn/outerHeight.js +3 -6
- package/dist/fn/outerWidth.js +3 -6
- package/dist/fn/percent.js +1 -4
- package/dist/fn/pickValue.js +1 -4
- package/dist/fn/post.js +7 -10
- package/dist/fn/postOut.js +5 -8
- package/dist/fn/printf.js +1 -4
- package/dist/fn/quotes2html.js +4 -7
- package/dist/fn/randomInt.js +1 -4
- package/dist/fn/randomString.js +4 -7
- package/dist/fn/removeAccents.js +5 -8
- package/dist/fn/removeEmpty.js +8 -11
- package/dist/fn/removeExtraSpaces.js +1 -4
- package/dist/fn/removeHtmlComments.js +3 -6
- package/dist/fn/removePrivateProp.js +3 -6
- package/dist/fn/removeTrailingChars.js +6 -9
- package/dist/fn/repeat.js +1 -4
- package/dist/fn/replaceAll.js +4 -7
- package/dist/fn/replaceSelection.js +1 -4
- package/dist/fn/resize.js +7 -10
- package/dist/fn/rgb2hex.js +1 -4
- package/dist/fn/riterate.js +3 -6
- package/dist/fn/roundDecimal.js +1 -4
- package/dist/fn/sanitize.js +5 -8
- package/dist/fn/search.js +15 -18
- package/dist/fn/selectElementText.js +1 -4
- package/dist/fn/selector.js +1 -4
- package/dist/fn/setCookie.js +1 -4
- package/dist/fn/setCssVar.js +1 -4
- package/dist/fn/setNavigationVars.js +10 -13
- package/dist/fn/setProp.js +1 -4
- package/dist/fn/setProperty.js +3 -6
- package/dist/fn/shorten.js +5 -8
- package/dist/fn/shortenObj.js +9 -12
- package/dist/fn/shuffle.js +1 -4
- package/dist/fn/simpleHash.js +5 -8
- package/dist/fn/simpleHash1.js +1 -4
- package/dist/fn/simpleHash2.js +1 -4
- package/dist/fn/stat.js +1 -4
- package/dist/fn/string2ArrayBuffer.js +1 -4
- package/dist/fn/submit.js +6 -9
- package/dist/fn/substr.js +7 -10
- package/dist/fn/sum.js +4 -7
- package/dist/fn/timestamp.js +1 -4
- package/dist/fn/toCSV.js +8 -11
- package/dist/fn/toggleFullScreen.js +3 -6
- package/dist/fn/translate.js +3 -6
- package/dist/fn/treatAjaxArguments.js +10 -13
- package/dist/fn/trim.js +4 -7
- package/dist/fn/uniqString.js +7 -10
- package/dist/fn/unique.js +1 -4
- package/dist/fn/upload.js +7 -33
- package/dist/fn/warning.js +3 -6
- package/dist/index.js +459 -471
- package/package.json +1 -1
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const isArray_1 = require("./isArray");
|
|
5
|
-
const each_1 = require("./each");
|
|
6
|
-
const getProperty_1 = require("./getProperty");
|
|
1
|
+
import { isArray } from './isArray';
|
|
2
|
+
import { each } from './each';
|
|
3
|
+
import { getProperty } from './getProperty';
|
|
7
4
|
const compareConditions = function (data, filter) {
|
|
8
|
-
if (!filter.conditions || !filter.logic || !
|
|
5
|
+
if (!filter.conditions || !filter.logic || !isArray(filter.conditions)) {
|
|
9
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');
|
|
10
7
|
}
|
|
11
8
|
let ok = filter.logic === 'AND' ? true : false;
|
|
12
|
-
|
|
9
|
+
each(filter.conditions, (a) => {
|
|
13
10
|
let compare;
|
|
14
|
-
if (a.conditions &&
|
|
11
|
+
if (a.conditions && isArray(a.conditions)) {
|
|
15
12
|
compare = compareConditions(data, a);
|
|
16
13
|
}
|
|
17
14
|
else {
|
|
18
|
-
compare = compare(
|
|
15
|
+
compare = compare(getProperty(data, a.field), a.value, a.operator);
|
|
19
16
|
if (compare) {
|
|
20
17
|
let bits = a.field.split('.');
|
|
21
18
|
let prop = bits.pop();
|
|
22
19
|
if (bits.length) {
|
|
23
|
-
|
|
20
|
+
each(bits, (b) => (data = data[b]));
|
|
24
21
|
}
|
|
25
22
|
// Case where both are undefined: value and prop which doesn't exist; they are not the same!
|
|
26
|
-
if (
|
|
23
|
+
if (getProperty(data, prop) === undefined && a.value !== undefined) {
|
|
27
24
|
compare = false;
|
|
28
25
|
}
|
|
29
26
|
}
|
|
@@ -41,4 +38,4 @@ const compareConditions = function (data, filter) {
|
|
|
41
38
|
});
|
|
42
39
|
return ok;
|
|
43
40
|
};
|
|
44
|
-
|
|
41
|
+
export { compareConditions };
|
package/dist/fn/copy.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.copy = void 0;
|
|
4
|
-
const isObject_1 = require("./isObject");
|
|
5
|
-
const isFunction_1 = require("./isFunction");
|
|
1
|
+
import { isObject } from './isObject';
|
|
2
|
+
import { isFunction } from './isFunction';
|
|
6
3
|
const copy = function (st) {
|
|
7
4
|
return new Promise((resolve) => {
|
|
8
5
|
if (st) {
|
|
@@ -12,7 +9,7 @@ const copy = function (st) {
|
|
|
12
9
|
resolve(true);
|
|
13
10
|
});
|
|
14
11
|
}
|
|
15
|
-
else if (
|
|
12
|
+
else if (isObject(st) && isFunction(st.toBlob)) {
|
|
16
13
|
st.toBlob((blob) => {
|
|
17
14
|
navigator.clipboard.write([new ClipboardItem({ [blob.type.toString()]: blob })]).then(() => {
|
|
18
15
|
resolve(true);
|
|
@@ -37,4 +34,4 @@ const copy = function (st) {
|
|
|
37
34
|
resolve(false);
|
|
38
35
|
});
|
|
39
36
|
};
|
|
40
|
-
|
|
37
|
+
export { copy };
|
package/dist/fn/correctCase.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.correctCase = void 0;
|
|
4
1
|
const correctCase = function (str) {
|
|
5
2
|
return str.replace(/[A-z]{1}/, (c) => c.toUpperCase());
|
|
6
3
|
};
|
|
7
|
-
|
|
4
|
+
export { correctCase };
|
package/dist/fn/count.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.count = void 0;
|
|
4
|
-
const filter_1 = require("./filter");
|
|
1
|
+
import { filter } from './filter';
|
|
5
2
|
const count = function (arr, prop, val = null, operator = '=') {
|
|
6
|
-
return
|
|
3
|
+
return filter(arr, prop, val, operator).length || 0;
|
|
7
4
|
};
|
|
8
|
-
|
|
5
|
+
export { count };
|
package/dist/fn/crc32.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.crc32 = void 0;
|
|
4
1
|
// this is a test
|
|
5
2
|
const crc32Table = [];
|
|
6
3
|
for (let i = 0; i < 256; i++) {
|
|
@@ -18,4 +15,4 @@ const crc32 = function (str) {
|
|
|
18
15
|
}
|
|
19
16
|
return (crc ^ -1) >>> 0; // Make sure the result is a 32-bit positive integer
|
|
20
17
|
};
|
|
21
|
-
|
|
18
|
+
export { crc32 };
|
package/dist/fn/createObject.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createObject = void 0;
|
|
4
|
-
const extend_1 = require("./extend");
|
|
1
|
+
import { extend } from './extend';
|
|
5
2
|
const createObject = function (...args) {
|
|
6
3
|
const obj = Object.create(null);
|
|
7
4
|
if (args.length) {
|
|
8
|
-
|
|
5
|
+
extend(obj, ...args);
|
|
9
6
|
}
|
|
10
7
|
return obj;
|
|
11
8
|
};
|
|
12
|
-
|
|
9
|
+
export { createObject };
|
package/dist/fn/cssExists.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cssExists = void 0;
|
|
4
1
|
//import { log } from './log';
|
|
5
|
-
|
|
2
|
+
import { escapeRegExp } from './escapeRegExp';
|
|
6
3
|
const cssExists = function (f) {
|
|
7
4
|
let ok;
|
|
8
5
|
let rules;
|
|
@@ -22,7 +19,7 @@ const cssExists = function (f) {
|
|
|
22
19
|
//log(rules);
|
|
23
20
|
for (let cx = 0; cx < rules.length; cx++) {
|
|
24
21
|
//log(rules[cx].selectorText);
|
|
25
|
-
if (new RegExp('(^|\\s)' +
|
|
22
|
+
if (new RegExp('(^|\\s)' + escapeRegExp(f) + '(\\{|\\s)', 'g').test(rules[cx].selectorText)) {
|
|
26
23
|
return true;
|
|
27
24
|
}
|
|
28
25
|
}
|
|
@@ -30,4 +27,4 @@ const cssExists = function (f) {
|
|
|
30
27
|
}
|
|
31
28
|
return false;
|
|
32
29
|
};
|
|
33
|
-
|
|
30
|
+
export { cssExists };
|
package/dist/fn/date.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const isNumber_1 = require("./isNumber");
|
|
5
|
-
const substr_1 = require("./substr");
|
|
6
|
-
const isDate_1 = require("./isDate");
|
|
1
|
+
import { isNumber } from './isNumber';
|
|
2
|
+
import { substr } from './substr';
|
|
3
|
+
import { isDate } from './isDate';
|
|
7
4
|
const date = function (v) {
|
|
8
5
|
let d = false, t = typeof v;
|
|
9
6
|
if (v === undefined) {
|
|
10
7
|
return new Date();
|
|
11
8
|
}
|
|
12
|
-
if (t === 'number' || (
|
|
9
|
+
if (t === 'number' || (isNumber(v) && v !== '')) {
|
|
13
10
|
if (v < 10000000000) {
|
|
14
11
|
v = v * 1000;
|
|
15
12
|
}
|
|
@@ -17,15 +14,15 @@ const date = function (v) {
|
|
|
17
14
|
}
|
|
18
15
|
if (t === 'string') {
|
|
19
16
|
if (v.length === 10) {
|
|
20
|
-
return new Date(parseInt(
|
|
17
|
+
return new Date(parseInt(substr(v, 0, 4)), parseInt(substr(v, 5, 2)) - 1, parseInt(substr(v, 8, 2)), 12);
|
|
21
18
|
}
|
|
22
19
|
else if (v.length === 19) {
|
|
23
|
-
return new Date(parseInt(
|
|
20
|
+
return new Date(parseInt(substr(v, 0, 4)), parseInt(substr(v, 5, 2)) - 1, parseInt(substr(v, 8, 2)), parseInt(substr(v, 11, 2)), parseInt(substr(v, 14, 2)), parseInt(substr(v, 17, 2)));
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
|
-
else if (
|
|
23
|
+
else if (isDate(v)) {
|
|
27
24
|
return v;
|
|
28
25
|
}
|
|
29
26
|
return d;
|
|
30
27
|
};
|
|
31
|
-
|
|
28
|
+
export { date };
|
package/dist/fn/dateSQL.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.dateSQL = void 0;
|
|
7
|
-
const date_1 = require("./date");
|
|
8
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
1
|
+
import { date } from './date';
|
|
2
|
+
import * as dayjs from 'dayjs';
|
|
9
3
|
const dateSQL = function (v, dayOnly) {
|
|
10
|
-
let value =
|
|
4
|
+
let value = date(v);
|
|
11
5
|
if (value) {
|
|
12
|
-
return (
|
|
6
|
+
return dayjs(value).format('YYYY-MM-DD' + (dayOnly ? '' : ' HH:mm:ss'));
|
|
13
7
|
}
|
|
14
8
|
};
|
|
15
|
-
|
|
9
|
+
export { dateSQL };
|
package/dist/fn/daysInMonth.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.daysInMonth = void 0;
|
|
7
|
-
const date_1 = require("./date");
|
|
8
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
1
|
+
import { date } from './date';
|
|
2
|
+
import * as dayjs from 'dayjs';
|
|
9
3
|
const daysInMonth = function (v) {
|
|
10
|
-
let d =
|
|
4
|
+
let d = date(v);
|
|
11
5
|
if (d) {
|
|
12
|
-
return (
|
|
6
|
+
return dayjs(d).daysInMonth();
|
|
13
7
|
}
|
|
14
8
|
return false;
|
|
15
9
|
};
|
|
16
|
-
|
|
10
|
+
export { daysInMonth };
|
package/dist/fn/deepPath.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const search_1 = require("./search");
|
|
5
|
-
const each_1 = require("./each");
|
|
6
|
-
const isArray_1 = require("./isArray");
|
|
1
|
+
import { search } from './search';
|
|
2
|
+
import { each } from './each';
|
|
3
|
+
import { isArray } from './isArray';
|
|
7
4
|
const deepPath = function (arr, filter, deepProperty, res = []) {
|
|
8
5
|
let idx;
|
|
9
6
|
let start = 0;
|
|
10
|
-
if ((idx =
|
|
7
|
+
if ((idx = search(arr, filter, start)) > -1) {
|
|
11
8
|
res.push(idx);
|
|
12
9
|
return res;
|
|
13
10
|
}
|
|
14
|
-
|
|
15
|
-
if (
|
|
11
|
+
each(arr, (it, i) => {
|
|
12
|
+
if (isArray(it[deepProperty])) {
|
|
16
13
|
let r = res.slice();
|
|
17
14
|
r.push(i);
|
|
18
15
|
let tmp = deepPath(it[deepProperty], filter, deepProperty, r);
|
|
@@ -23,4 +20,4 @@ const deepPath = function (arr, filter, deepProperty, res = []) {
|
|
|
23
20
|
});
|
|
24
21
|
return false;
|
|
25
22
|
};
|
|
26
|
-
|
|
23
|
+
export { deepPath };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultAjaxAbortFunction = void 0;
|
|
4
|
-
const log_1 = require("./log");
|
|
1
|
+
import { log } from './log';
|
|
5
2
|
const defaultAjaxAbortFunction = function (message, url = '') {
|
|
6
|
-
|
|
3
|
+
log(message);
|
|
7
4
|
};
|
|
8
|
-
|
|
5
|
+
export { defaultAjaxAbortFunction };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultAjaxErrorFunction = void 0;
|
|
4
1
|
const defaultAjaxErrorFunction = function (jqXHR, textStatus, errorThrown) {
|
|
5
2
|
return false;
|
|
6
3
|
};
|
|
7
|
-
|
|
4
|
+
export { defaultAjaxErrorFunction };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultAlertFunction = void 0;
|
|
4
1
|
const defaultAlertFunction = function (msg, title) {
|
|
5
2
|
/** @todo */
|
|
6
3
|
alert(msg);
|
|
7
4
|
};
|
|
8
|
-
|
|
5
|
+
export { defaultAlertFunction };
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultConfirmFunction = void 0;
|
|
4
|
-
const isFunction_1 = require("./isFunction");
|
|
1
|
+
import { isFunction } from './isFunction';
|
|
5
2
|
const defaultConfirmFunction = function (text, yesFn, noFn) {
|
|
6
3
|
let ok = 0;
|
|
7
4
|
if (confirm(text)) {
|
|
8
|
-
if (
|
|
5
|
+
if (isFunction(yesFn)) {
|
|
9
6
|
yesFn();
|
|
10
7
|
ok = 1;
|
|
11
8
|
}
|
|
12
9
|
}
|
|
13
|
-
if (!ok &&
|
|
10
|
+
if (!ok && isFunction(noFn)) {
|
|
14
11
|
noFn();
|
|
15
12
|
}
|
|
16
13
|
};
|
|
17
|
-
|
|
14
|
+
export { defaultConfirmFunction };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultEndLoadingFunction = void 0;
|
|
4
1
|
const defaultEndLoadingFunction = function (url, timestamp, data, res) {
|
|
5
2
|
return true;
|
|
6
3
|
};
|
|
7
|
-
|
|
4
|
+
export { defaultEndLoadingFunction };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultErrorFunction = void 0;
|
|
4
|
-
const log_1 = require("./log");
|
|
1
|
+
import { log } from './log';
|
|
5
2
|
const defaultErrorFunction = function (message) {
|
|
6
|
-
|
|
3
|
+
log(message);
|
|
7
4
|
};
|
|
8
|
-
|
|
5
|
+
export { defaultErrorFunction };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultHistoryFunction = void 0;
|
|
4
1
|
const defaultHistoryFunction = function (obj) {
|
|
5
2
|
return true;
|
|
6
3
|
};
|
|
7
|
-
|
|
4
|
+
export { defaultHistoryFunction };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultLinkFunction = void 0;
|
|
4
1
|
const defaultLinkFunction = function (responseObj, ele) {
|
|
5
2
|
return true;
|
|
6
3
|
};
|
|
7
|
-
|
|
4
|
+
export { defaultLinkFunction };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultPostLinkFunction = void 0;
|
|
4
1
|
const defaultPostLinkFunction = function (r, ele) {
|
|
5
2
|
return true;
|
|
6
3
|
};
|
|
7
|
-
|
|
4
|
+
export { defaultPostLinkFunction };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultPreLinkFunction = void 0;
|
|
4
1
|
const defaultPreLinkFunction = function (url, force, ele) {
|
|
5
2
|
return url;
|
|
6
3
|
};
|
|
7
|
-
|
|
4
|
+
export { defaultPreLinkFunction };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultResizeFunction = void 0;
|
|
4
1
|
const defaultResizeFunction = function () {
|
|
5
2
|
return true;
|
|
6
3
|
};
|
|
7
|
-
|
|
4
|
+
export { defaultResizeFunction };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultStartLoadingFunction = void 0;
|
|
4
1
|
const defaultStartLoadingFunction = function (url, tst, data, requestId = null) {
|
|
5
2
|
return true;
|
|
6
3
|
};
|
|
7
|
-
|
|
4
|
+
export { defaultStartLoadingFunction };
|
package/dist/fn/deleteProp.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteProp = void 0;
|
|
4
|
-
const checkType_1 = require("./checkType");
|
|
1
|
+
import { checkType } from './checkType';
|
|
5
2
|
const deleteProp = function (obj, prop) {
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
checkType(obj, 'object', bbn._('The obj must be an object in setProp'));
|
|
4
|
+
checkType(prop, 'string', bbn._('The prop must be a string in setProp'));
|
|
8
5
|
delete obj[prop];
|
|
9
6
|
};
|
|
10
|
-
|
|
7
|
+
export { deleteProp };
|
package/dist/fn/diffObj.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const isValue_1 = require("./isValue");
|
|
8
|
-
const isDom_1 = require("./isDom");
|
|
9
|
-
const numProperties_1 = require("./numProperties");
|
|
1
|
+
import { isDate } from './isDate';
|
|
2
|
+
import { createObject } from './createObject';
|
|
3
|
+
import { isFunction } from './isFunction';
|
|
4
|
+
import { isValue } from './isValue';
|
|
5
|
+
import { isDom } from './isDom';
|
|
6
|
+
import { numProperties } from './numProperties';
|
|
10
7
|
let diffObjProcessed = [];
|
|
11
8
|
const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
|
|
12
9
|
if (!notRoot) {
|
|
@@ -16,7 +13,7 @@ const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
|
|
|
16
13
|
if (value1 === value2) {
|
|
17
14
|
return VALUE_UNCHANGED;
|
|
18
15
|
}
|
|
19
|
-
if (
|
|
16
|
+
if (isDate(value1) && isDate(value2) && value1.getTime() === value2.getTime()) {
|
|
20
17
|
return VALUE_UNCHANGED;
|
|
21
18
|
}
|
|
22
19
|
if ('undefined' == typeof value1) {
|
|
@@ -30,12 +27,12 @@ const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
|
|
|
30
27
|
if (notRoot === undefined) {
|
|
31
28
|
notRoot = false;
|
|
32
29
|
}
|
|
33
|
-
let diff =
|
|
34
|
-
if (!
|
|
35
|
-
if (
|
|
30
|
+
let diff = createObject();
|
|
31
|
+
if (!isFunction(obj1) && !isFunction(obj2)) {
|
|
32
|
+
if (isValue(obj1) || isValue(obj2)) {
|
|
36
33
|
let res = _compareValues(obj1, obj2);
|
|
37
34
|
if (unchanged || res !== VALUE_UNCHANGED) {
|
|
38
|
-
let ret =
|
|
35
|
+
let ret = createObject();
|
|
39
36
|
Object.defineProperty(ret, 'type', {
|
|
40
37
|
value: res,
|
|
41
38
|
enumerable: false,
|
|
@@ -58,7 +55,7 @@ const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
|
|
|
58
55
|
}
|
|
59
56
|
return false;
|
|
60
57
|
}
|
|
61
|
-
if (
|
|
58
|
+
if (isDom(obj1) || isDom(obj2)) {
|
|
62
59
|
return false;
|
|
63
60
|
}
|
|
64
61
|
if (diffObjProcessed.includes(obj1) || diffObjProcessed.includes(obj2)) {
|
|
@@ -67,7 +64,7 @@ const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
|
|
|
67
64
|
}
|
|
68
65
|
diffObjProcessed.push(obj1, obj2);
|
|
69
66
|
for (let key in obj1) {
|
|
70
|
-
if (
|
|
67
|
+
if (isFunction(obj1[key])) {
|
|
71
68
|
continue;
|
|
72
69
|
}
|
|
73
70
|
let value2 = undefined;
|
|
@@ -80,7 +77,7 @@ const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
|
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
79
|
for (let key in obj2) {
|
|
83
|
-
if (
|
|
80
|
+
if (isFunction(obj2[key]) || 'undefined' != typeof obj1[key]) {
|
|
84
81
|
continue;
|
|
85
82
|
}
|
|
86
83
|
let res = diffObj(undefined, obj2[key], unchanged, true);
|
|
@@ -89,6 +86,6 @@ const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
|
|
|
89
86
|
}
|
|
90
87
|
}
|
|
91
88
|
}
|
|
92
|
-
return !notRoot || unchanged ||
|
|
89
|
+
return !notRoot || unchanged || numProperties(diff) ? diff : false;
|
|
93
90
|
};
|
|
94
|
-
|
|
91
|
+
export { diffObj };
|
package/dist/fn/dirName.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.dirName = void 0;
|
|
4
|
-
const isString_1 = require("./isString");
|
|
5
|
-
const substr_1 = require("./substr");
|
|
1
|
+
import { isString } from './isString';
|
|
2
|
+
import { substr } from './substr';
|
|
6
3
|
const dirName = function (path) {
|
|
7
|
-
if (
|
|
8
|
-
while (
|
|
9
|
-
path =
|
|
4
|
+
if (isString(path) && path) {
|
|
5
|
+
while (substr(path, path.length - 1) === '/') {
|
|
6
|
+
path = substr(path, 0, path.length - 1);
|
|
10
7
|
}
|
|
11
8
|
let pos = path.lastIndexOf('/');
|
|
12
9
|
if (pos > 0) {
|
|
13
|
-
return
|
|
10
|
+
return substr(path, 0, pos);
|
|
14
11
|
}
|
|
15
12
|
if (pos === 0) {
|
|
16
13
|
return '/';
|
|
@@ -18,4 +15,4 @@ const dirName = function (path) {
|
|
|
18
15
|
}
|
|
19
16
|
return '';
|
|
20
17
|
};
|
|
21
|
-
|
|
18
|
+
export { dirName };
|
package/dist/fn/download.js
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const fileExt_1 = require("./fileExt");
|
|
9
|
-
const downloadContent_1 = require("./downloadContent");
|
|
10
|
-
const defaultAjaxErrorFunction_1 = require("./defaultAjaxErrorFunction");
|
|
1
|
+
import { ajax } from './ajax';
|
|
2
|
+
import { substr } from './substr';
|
|
3
|
+
import { baseName } from './baseName';
|
|
4
|
+
import { isBlob } from './isBlob';
|
|
5
|
+
import { fileExt } from './fileExt';
|
|
6
|
+
import { downloadContent } from './downloadContent';
|
|
7
|
+
import { defaultAjaxErrorFunction } from './defaultAjaxErrorFunction';
|
|
11
8
|
const download = function (url, filename, params) {
|
|
12
9
|
// We can intervert the arguments
|
|
13
10
|
if (filename && (typeof (filename) === 'object')) {
|
|
14
11
|
params = filename;
|
|
15
12
|
filename = null;
|
|
16
13
|
}
|
|
17
|
-
return
|
|
14
|
+
return ajax(url, 'blob', params || { _bbn_download: 1 }, (d, headers) => {
|
|
18
15
|
if (!filename) {
|
|
19
16
|
let cd = 'attachment; filename=';
|
|
20
17
|
if (headers && headers['content-disposition'] && headers['content-disposition'].indexOf(cd) === 0) {
|
|
21
|
-
filename =
|
|
18
|
+
filename = substr(headers['content-disposition'], cd.length + 1, headers['content-disposition'].length - cd.length - 2);
|
|
22
19
|
}
|
|
23
20
|
else {
|
|
24
|
-
filename =
|
|
21
|
+
filename = baseName(url);
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
if (
|
|
28
|
-
let extension =
|
|
24
|
+
if (isBlob(d)) {
|
|
25
|
+
let extension = fileExt(filename);
|
|
29
26
|
let htmlExtensions = ['php', 'html'];
|
|
30
27
|
if ((typeof filename === 'string') && ((('type' in d) && (d.type !== 'text/html')) || htmlExtensions.includes(extension))) {
|
|
31
|
-
|
|
28
|
+
downloadContent(filename, d);
|
|
32
29
|
return;
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
}, e => {
|
|
36
|
-
|
|
33
|
+
defaultAjaxErrorFunction(e);
|
|
37
34
|
});
|
|
38
35
|
};
|
|
39
|
-
|
|
36
|
+
export { download };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const isObject_1 = require("./isObject");
|
|
6
|
-
const isString_1 = require("./isString");
|
|
7
|
-
const log_1 = require("./log");
|
|
1
|
+
import { isCanvas } from './isCanvas';
|
|
2
|
+
import { isObject } from './isObject';
|
|
3
|
+
import { isString } from './isString';
|
|
4
|
+
import { log } from './log';
|
|
8
5
|
const downloadContent = function (filename, content, type) {
|
|
9
|
-
if (
|
|
6
|
+
if (isCanvas(content)) {
|
|
10
7
|
content.toBlob((blob) => {
|
|
11
8
|
// blob ready, download it
|
|
12
9
|
let a = document.createElement('a');
|
|
@@ -20,7 +17,7 @@ const downloadContent = function (filename, content, type) {
|
|
|
20
17
|
return;
|
|
21
18
|
}
|
|
22
19
|
if (!type) {
|
|
23
|
-
type =
|
|
20
|
+
type = isObject(content) && content.type ? content.type : 'octet/stream';
|
|
24
21
|
}
|
|
25
22
|
else if (type.indexOf('/') === -1) {
|
|
26
23
|
type = 'text/' + type;
|
|
@@ -28,7 +25,7 @@ const downloadContent = function (filename, content, type) {
|
|
|
28
25
|
let a = window.document.createElement('a');
|
|
29
26
|
a.className = 'bbn-no';
|
|
30
27
|
let src = null;
|
|
31
|
-
if (
|
|
28
|
+
if (isString(content)) {
|
|
32
29
|
src = new Blob([content], { type: type });
|
|
33
30
|
}
|
|
34
31
|
else {
|
|
@@ -36,7 +33,7 @@ const downloadContent = function (filename, content, type) {
|
|
|
36
33
|
src = content;
|
|
37
34
|
}
|
|
38
35
|
catch (e) {
|
|
39
|
-
|
|
36
|
+
log(e);
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
39
|
a.href = window.URL.createObjectURL(src);
|
|
@@ -48,4 +45,4 @@ const downloadContent = function (filename, content, type) {
|
|
|
48
45
|
// Remove anchor from body
|
|
49
46
|
document.body.removeChild(a);
|
|
50
47
|
};
|
|
51
|
-
|
|
48
|
+
export { downloadContent };
|