@bbn/bbn 1.0.24 → 1.0.26
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 +224 -238
- package/dist/bundle.js +940 -906
- package/dist/fn/_addLoader.js +1 -1
- package/dist/fn/_deleteLoader.d.ts +1 -1
- package/dist/fn/_deleteLoader.js +2 -2
- package/dist/fn/abort.js +4 -4
- package/dist/fn/abortURL.js +2 -2
- package/dist/fn/addColors.d.ts +1 -1
- package/dist/fn/addColors.js +23 -6
- package/dist/fn/addInputs.d.ts +1 -2
- package/dist/fn/addInputs.js +4 -5
- package/dist/fn/adjustHeight.js +1 -1
- package/dist/fn/adjustSize.js +1 -1
- package/dist/fn/adjustWidth.js +1 -1
- package/dist/fn/ajax.d.ts +1 -1
- package/dist/fn/ajax.js +8 -7
- package/dist/fn/analyzeFunction.js +5 -5
- package/dist/fn/animateCss.js +8 -7
- package/dist/fn/baseName.d.ts +1 -1
- package/dist/fn/baseName.js +1 -1
- package/dist/fn/br2nl.d.ts +1 -1
- package/dist/fn/br2nl.js +1 -1
- package/dist/fn/calendar.js +1 -1
- package/dist/fn/callback.d.ts +1 -1
- package/dist/fn/callback.js +5 -5
- package/dist/fn/camelToCss.js +4 -2
- package/dist/fn/canvasToImage.js +1 -1
- package/dist/fn/center.js +3 -5
- package/dist/fn/checkProps.d.ts +1 -1
- package/dist/fn/checkProps.js +1 -1
- package/dist/fn/checkPropsDetails.d.ts +1 -4
- package/dist/fn/checkPropsDetails.js +10 -11
- package/dist/fn/checkPropsOrDie.d.ts +1 -1
- package/dist/fn/checkPropsOrDie.js +1 -1
- package/dist/fn/checkType.d.ts +1 -1
- package/dist/fn/checkType.js +3 -3
- package/dist/fn/chrono.d.ts +3 -0
- package/dist/fn/chrono.js +23 -0
- package/dist/fn/circularReplacer.js +2 -2
- package/dist/fn/clone.d.ts +0 -1
- package/dist/fn/clone.js +1 -1
- package/dist/fn/colorToHex.js +1 -1
- package/dist/fn/compare.js +44 -44
- package/dist/fn/compareConditions.d.ts +0 -1
- package/dist/fn/compareConditions.js +3 -3
- package/dist/fn/copy.js +9 -9
- package/dist/fn/correctCase.js +1 -1
- package/dist/fn/count.d.ts +1 -1
- package/dist/fn/count.js +2 -2
- package/dist/fn/crc32.js +12 -3
- package/dist/fn/createObject.d.ts +1 -1
- package/dist/fn/createObject.js +3 -3
- package/dist/fn/cssExists.js +7 -4
- package/dist/fn/date.js +5 -5
- package/dist/fn/dateSQL.js +4 -3
- package/dist/fn/deepPath.d.ts +1 -2
- package/dist/fn/defaultAjaxAbortFunction.d.ts +1 -1
- package/dist/fn/defaultAjaxAbortFunction.js +1 -1
- package/dist/fn/defaultAjaxErrorFunction.d.ts +1 -1
- package/dist/fn/defaultAjaxErrorFunction.js +0 -12
- package/dist/fn/defaultAlertFunction.d.ts +1 -1
- package/dist/fn/defaultAlertFunction.js +2 -3
- package/dist/fn/defaultConfirmFunction.d.ts +1 -1
- package/dist/fn/defaultEndLoadingFunction.d.ts +1 -1
- package/dist/fn/defaultEndLoadingFunction.js +1 -17
- package/dist/fn/defaultPostLinkFunction.d.ts +1 -1
- package/dist/fn/defaultPostLinkFunction.js +1 -1
- package/dist/fn/defaultPreLinkFunction.d.ts +1 -1
- package/dist/fn/defaultPreLinkFunction.js +2 -10
- package/dist/fn/defaultStartLoadingFunction.d.ts +1 -1
- package/dist/fn/defaultStartLoadingFunction.js +2 -13
- package/dist/fn/deleteProp.d.ts +1 -1
- package/dist/fn/deleteProp.js +3 -2
- package/dist/fn/diffObj.d.ts +1 -2
- package/dist/fn/diffObj.js +13 -14
- package/dist/fn/dirName.d.ts +1 -1
- package/dist/fn/download.d.ts +1 -1
- package/dist/fn/download.js +3 -5
- package/dist/fn/downloadContent.d.ts +1 -1
- package/dist/fn/each.js +1 -1
- package/dist/fn/error.js +2 -2
- package/dist/fn/escapeRegExp.js +1 -1
- package/dist/fn/escapeTicks.js +1 -1
- package/dist/fn/escapeUrl.js +1 -1
- package/dist/fn/extend.d.ts +1 -2
- package/dist/fn/extend.js +11 -11
- package/dist/fn/extendOut.d.ts +1 -2
- package/dist/fn/extendOut.js +3 -3
- package/dist/fn/fdate.d.ts +1 -1
- package/dist/fn/fdatetime.d.ts +1 -1
- package/dist/fn/fdatetime.js +1 -1
- package/dist/fn/fieldValue.js +2 -2
- package/dist/fn/fileExt.js +1 -1
- package/dist/fn/filter.d.ts +1 -2
- package/dist/fn/filter.js +13 -12
- package/dist/fn/filterToConditions.d.ts +11 -3
- package/dist/fn/filterToConditions.js +6 -6
- package/dist/fn/findAll.d.ts +0 -1
- package/dist/fn/findAll.js +1 -1
- package/dist/fn/fori.d.ts +1 -1
- package/dist/fn/fori.js +2 -2
- package/dist/fn/forir.d.ts +1 -1
- package/dist/fn/forir.js +2 -2
- package/dist/fn/formdata.d.ts +1 -1
- package/dist/fn/formdata.js +12 -13
- package/dist/fn/fromXml.js +6 -6
- package/dist/fn/ftime.js +1 -1
- package/dist/fn/getAllTags.d.ts +1 -1
- package/dist/fn/getAllTags.js +1 -1
- package/dist/fn/getAncestors.d.ts +1 -1
- package/dist/fn/getAncestors.js +7 -8
- package/dist/fn/getAttributes.js +2 -2
- package/dist/fn/getBrowserName.js +9 -9
- package/dist/fn/getBrowserVersion.js +2 -2
- package/dist/fn/getCookie.js +1 -1
- package/dist/fn/getDeviceType.js +3 -3
- package/dist/fn/getEventData.js +11 -8
- package/dist/fn/getField.d.ts +1 -1
- package/dist/fn/getField.js +4 -3
- package/dist/fn/getFieldValues.d.ts +1 -1
- package/dist/fn/getFieldValues.js +2 -2
- package/dist/fn/getHTMLOfSelection.d.ts +1 -1
- package/dist/fn/getHTMLOfSelection.js +9 -19
- package/dist/fn/getLoader.d.ts +1 -1
- package/dist/fn/getPath.d.ts +1 -1
- package/dist/fn/getPath.js +4 -4
- package/dist/fn/getProp.js +3 -2
- package/dist/fn/getProperty.js +1 -1
- package/dist/fn/getRow.d.ts +1 -1
- package/dist/fn/getRow.js +1 -1
- package/dist/fn/getScrollBarSize.js +9 -7
- package/dist/fn/getText.d.ts +1 -1
- package/dist/fn/getTimeoff.js +1 -1
- package/dist/fn/happy.js +1 -1
- package/dist/fn/hash.d.ts +1 -1
- package/dist/fn/hash.js +1 -1
- package/dist/fn/hex2rgb.js +7 -5
- package/dist/fn/html2text.d.ts +1 -1
- package/dist/fn/imageToCanvas.js +2 -2
- package/dist/fn/imgToBase64.d.ts +1 -1
- package/dist/fn/imgToBase64.js +3 -3
- package/dist/fn/info.js +1 -1
- package/dist/fn/init.js +29 -29
- package/dist/fn/isActiveInterface.js +2 -2
- package/dist/fn/isColor.d.ts +1 -1
- package/dist/fn/isColor.js +11 -4
- package/dist/fn/isCp.js +7 -7
- package/dist/fn/isDimension.d.ts +1 -1
- package/dist/fn/isDimension.js +11 -4
- package/dist/fn/isEmail.d.ts +1 -1
- package/dist/fn/isEmail.js +11 -4
- package/dist/fn/isEmpty.js +1 -1
- package/dist/fn/isFocused.d.ts +1 -1
- package/dist/fn/isFocused.js +1 -1
- package/dist/fn/isHostname.js +1 -1
- package/dist/fn/isIP.js +1 -1
- package/dist/fn/isInside.js +1 -1
- package/dist/fn/isIterable.js +1 -1
- package/dist/fn/isNumber.js +1 -1
- package/dist/fn/isPercent.js +1 -1
- package/dist/fn/isPrimitive.js +1 -1
- package/dist/fn/isPropSize.js +1 -1
- package/dist/fn/isSQLDate.js +1 -1
- package/dist/fn/isSame.d.ts +1 -2
- package/dist/fn/isSame.js +3 -3
- package/dist/fn/isURL.js +1 -1
- package/dist/fn/isValidDimension.js +2 -3
- package/dist/fn/isValue.js +1 -1
- package/dist/fn/isVue.d.ts +1 -1
- package/dist/fn/isVue.js +5 -5
- package/dist/fn/iterate.d.ts +1 -1
- package/dist/fn/iterate.js +3 -3
- package/dist/fn/lightenDarkenHex.js +2 -2
- package/dist/fn/link.d.ts +1 -2
- package/dist/fn/link.js +17 -19
- package/dist/fn/log.js +4 -4
- package/dist/fn/makeReactive.d.ts +0 -1
- package/dist/fn/makeReactive.js +35 -23
- package/dist/fn/map.d.ts +0 -1
- package/dist/fn/md5.js +30 -10
- package/dist/fn/money.d.ts +1 -1
- package/dist/fn/money.js +47 -34
- package/dist/fn/move.d.ts +1 -1
- package/dist/fn/move.js +1 -1
- package/dist/fn/multiorder.d.ts +1 -1
- package/dist/fn/multiorder.js +5 -5
- package/dist/fn/nl2br.d.ts +1 -1
- package/dist/fn/nl2br.js +1 -1
- package/dist/fn/numProperties.d.ts +1 -1
- package/dist/fn/numProperties.js +1 -1
- package/dist/fn/objectToFormData.d.ts +1 -1
- package/dist/fn/objectToFormData.js +3 -3
- package/dist/fn/outerHeight.d.ts +1 -1
- package/dist/fn/outerHeight.js +5 -4
- package/dist/fn/outerWidth.d.ts +1 -1
- package/dist/fn/outerWidth.js +1 -2
- package/dist/fn/pickValue.d.ts +1 -1
- package/dist/fn/post.d.ts +1 -1
- package/dist/fn/post.js +3 -3
- package/dist/fn/postOut.d.ts +1 -1
- package/dist/fn/postOut.js +2 -2
- package/dist/fn/printf.js +1 -3
- package/dist/fn/quotes2html.d.ts +1 -1
- package/dist/fn/quotes2html.js +3 -3
- package/dist/fn/randomInt.d.ts +1 -1
- package/dist/fn/randomString.d.ts +1 -1
- package/dist/fn/randomString.js +9 -8
- package/dist/fn/removeAccents.d.ts +1 -1
- package/dist/fn/removeAccents.js +1 -1
- package/dist/fn/removeEmpty.d.ts +1 -1
- package/dist/fn/removeExtraSpaces.d.ts +1 -1
- package/dist/fn/removeHtmlComments.d.ts +1 -1
- package/dist/fn/removePrivateProp.d.ts +1 -2
- package/dist/fn/removePrivateProp.js +6 -6
- package/dist/fn/removeTrailingChars.d.ts +1 -1
- package/dist/fn/repeat.d.ts +1 -1
- package/dist/fn/repeat.js +1 -6
- package/dist/fn/replaceAll.d.ts +1 -1
- package/dist/fn/replaceAll.js +1 -4
- package/dist/fn/replaceSelection.js +1 -1
- package/dist/fn/resize.js +9 -7
- package/dist/fn/rgb2hex.js +6 -4
- package/dist/fn/riterate.d.ts +1 -1
- package/dist/fn/roundDecimal.d.ts +1 -1
- package/dist/fn/roundDecimal.js +1 -1
- package/dist/fn/sanitize.js +3 -1
- package/dist/fn/search.d.ts +2 -1
- package/dist/fn/search.js +24 -21
- package/dist/fn/selectElementText.d.ts +1 -1
- package/dist/fn/selectElementText.js +1 -1
- package/dist/fn/selector.d.ts +1 -1
- package/dist/fn/selector.js +1 -1
- package/dist/fn/setCookie.js +4 -4
- package/dist/fn/setCssVar.js +2 -1
- package/dist/fn/setNavigationVars.d.ts +1 -1
- package/dist/fn/setNavigationVars.js +6 -5
- package/dist/fn/setProp.d.ts +1 -1
- package/dist/fn/setProp.js +1 -3
- package/dist/fn/setProperty.d.ts +1 -1
- package/dist/fn/setProperty.js +2 -2
- package/dist/fn/shorten.d.ts +1 -1
- package/dist/fn/shorten.js +3 -3
- package/dist/fn/shortenObj.d.ts +1 -2
- package/dist/fn/shortenObj.js +2 -2
- package/dist/fn/shuffle.d.ts +1 -1
- package/dist/fn/shuffle.js +1 -3
- package/dist/fn/simpleHash.d.ts +1 -1
- package/dist/fn/simpleHash1.d.ts +1 -1
- package/dist/fn/simpleHash1.js +1 -1
- package/dist/fn/simpleHash2.d.ts +1 -1
- package/dist/fn/stat.d.ts +1 -1
- package/dist/fn/stat.js +8 -8
- package/dist/fn/string2ArrayBuffer.d.ts +1 -1
- package/dist/fn/submit.d.ts +1 -1
- package/dist/fn/submit.js +6 -21
- package/dist/fn/substr.d.ts +1 -1
- package/dist/fn/substr.js +1 -1
- package/dist/fn/sum.d.ts +1 -1
- package/dist/fn/sum.js +2 -3
- package/dist/fn/timestamp.d.ts +1 -1
- package/dist/fn/timestamp.js +1 -1
- package/dist/fn/toCSV.d.ts +1 -1
- package/dist/fn/toCSV.js +1 -1
- package/dist/fn/toggleFullScreen.js +13 -13
- package/dist/fn/translate.d.ts +1 -1
- package/dist/fn/treatAjaxArguments.d.ts +1 -1
- package/dist/fn/treatAjaxArguments.js +16 -14
- package/dist/fn/uniqString.js +3 -3
- package/dist/fn/unique.d.ts +1 -1
- package/dist/fn/upload.d.ts +1 -1
- package/dist/fn/upload.js +6 -6
- package/dist/fn/warning.d.ts +1 -1
- package/dist/fn/warning.js +6 -6
- package/dist/index.d.ts +106 -108
- package/dist/index.js +5 -6
- package/package.json +3 -1
package/dist/fn/_addLoader.js
CHANGED
|
@@ -28,7 +28,7 @@ const _addLoader = function (requestId, prom, source) {
|
|
|
28
28
|
while (idx && (bbn.env.loadersHistory.length > bbn.env.maxLoadersHistory)) {
|
|
29
29
|
idx--;
|
|
30
30
|
// Not removing the ones still loading
|
|
31
|
-
if (!bbn.env.
|
|
31
|
+
if (!bbn.env.loading) {
|
|
32
32
|
bbn.env.loadersHistory.splice(idx, 1);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _deleteLoader: (requestId:
|
|
1
|
+
declare const _deleteLoader: (requestId: string, res?: any, isAbort?: boolean) => boolean;
|
|
2
2
|
export { _deleteLoader };
|
package/dist/fn/_deleteLoader.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { search } from './search';
|
|
2
2
|
import { getRow } from './getRow';
|
|
3
3
|
import { isObject } from './isObject';
|
|
4
|
-
const _deleteLoader = function (requestId, res, isAbort) {
|
|
4
|
+
const _deleteLoader = function (requestId, res = null, isAbort = false) {
|
|
5
5
|
let idx = search(bbn.env.loaders, { key: requestId });
|
|
6
6
|
if (idx > -1) {
|
|
7
7
|
let loader = bbn.env.loaders.splice(idx, 1)[0];
|
|
8
8
|
let history = getRow(bbn.env.loadersHistory, { key: requestId, start: loader.start });
|
|
9
9
|
if (history) {
|
|
10
10
|
history.loading = false;
|
|
11
|
-
history.duration =
|
|
11
|
+
history.duration = new Date().getTime() - loader.start;
|
|
12
12
|
if (typeof res === 'string') {
|
|
13
13
|
history.errorMessage = res;
|
|
14
14
|
history.error = !isAbort;
|
package/dist/fn/abort.js
CHANGED
|
@@ -6,9 +6,9 @@ const abort = function (requestId) {
|
|
|
6
6
|
loader.source.cancel('Operation canceled by the user.');
|
|
7
7
|
}
|
|
8
8
|
/*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
else {
|
|
10
|
+
throw new Error("Impossible to find the loader " + requestId);
|
|
11
|
+
}
|
|
12
|
+
*/
|
|
13
13
|
};
|
|
14
14
|
export { abort };
|
package/dist/fn/abortURL.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { each } from './each';
|
|
2
2
|
import { filter } from './filter';
|
|
3
3
|
const abortURL = function (url) {
|
|
4
|
-
each(filter(bbn.env.loaders, { url: url }), a => {
|
|
4
|
+
each(filter(bbn.env.loaders, { url: url }), (a) => {
|
|
5
5
|
if (a && a.source) {
|
|
6
6
|
a.source.cancel('Operation canceled by the user.');
|
|
7
7
|
}
|
|
8
8
|
else {
|
|
9
|
-
throw new Error(
|
|
9
|
+
throw new Error('Impossible to find the loader with URL ' + url);
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
};
|
package/dist/fn/addColors.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const addColors: (colors:
|
|
1
|
+
declare const addColors: (colors: object) => void;
|
|
2
2
|
export { addColors };
|
package/dist/fn/addColors.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { numProperties } from './numProperties';
|
|
2
2
|
import { iterate } from './iterate';
|
|
3
3
|
const addColors = function (colors) {
|
|
4
|
-
let st = '';
|
|
5
4
|
if (numProperties(colors)) {
|
|
6
|
-
if (!bbn.
|
|
7
|
-
bbn.
|
|
5
|
+
if (!bbn.vars.colors) {
|
|
6
|
+
bbn.vars.colors = {};
|
|
8
7
|
}
|
|
9
8
|
let element = document.createElement('style');
|
|
10
9
|
document.head.appendChild(element);
|
|
@@ -12,10 +11,28 @@ const addColors = function (colors) {
|
|
|
12
11
|
// Append style element to head
|
|
13
12
|
let i = 0;
|
|
14
13
|
iterate(colors, (v, n) => {
|
|
15
|
-
bbn.
|
|
14
|
+
bbn.vars.colors[n] = v;
|
|
16
15
|
sheet.insertRule('.bbn-' + n + ', .bbn-color-text-' + n + ' {color: ' + v + ' !important;}', i);
|
|
17
|
-
sheet.insertRule('svg.bbn-' +
|
|
18
|
-
|
|
16
|
+
sheet.insertRule('svg.bbn-' +
|
|
17
|
+
n +
|
|
18
|
+
', .bbn-' +
|
|
19
|
+
n +
|
|
20
|
+
' svg, svg.bbn-color-text-' +
|
|
21
|
+
n +
|
|
22
|
+
', .bbn-color-text-' +
|
|
23
|
+
n +
|
|
24
|
+
' svg {fill: ' +
|
|
25
|
+
v +
|
|
26
|
+
';}', i);
|
|
27
|
+
sheet.insertRule('.bbn-bg-' +
|
|
28
|
+
n +
|
|
29
|
+
', .bbn-color-bg-' +
|
|
30
|
+
n +
|
|
31
|
+
', .bbn-color-background-' +
|
|
32
|
+
n +
|
|
33
|
+
' {background-color: ' +
|
|
34
|
+
v +
|
|
35
|
+
' !important;}', i);
|
|
19
36
|
sheet.insertRule('.bbn-border-' + n + ', .bbn-color-border-' + n + ' {border-color: ' + v + ' !important;}', i);
|
|
20
37
|
sheet.insertRule('.bbn-color-' + n + ' {border-color: ' + v + '; background-color: ' + v + '; color: ' + v + ';}', i);
|
|
21
38
|
});
|
package/dist/fn/addInputs.d.ts
CHANGED
package/dist/fn/addInputs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { iterate } from './iterate';
|
|
2
|
-
const addInputs = function (form, params, prefix) {
|
|
3
|
-
if (form &&
|
|
2
|
+
const addInputs = function (form, params = null, prefix = '') {
|
|
3
|
+
if (form && form.tagName === 'FORM') {
|
|
4
4
|
let appendToForm = (name, val) => {
|
|
5
5
|
let input = document.createElement('input');
|
|
6
6
|
input.setAttribute('type', 'hidden');
|
|
@@ -14,7 +14,7 @@ const addInputs = function (form, params, prefix) {
|
|
|
14
14
|
iterate(params, (param, key) => {
|
|
15
15
|
let name = prefix ? `${prefix}[${key}]` : key;
|
|
16
16
|
if (param instanceof Date) {
|
|
17
|
-
appendToForm(
|
|
17
|
+
appendToForm(name, param.toISOString());
|
|
18
18
|
}
|
|
19
19
|
else if (param instanceof Array) {
|
|
20
20
|
param.forEach((e, i) => {
|
|
@@ -27,8 +27,7 @@ const addInputs = function (form, params, prefix) {
|
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
else if (
|
|
31
|
-
!(param instanceof File)) {
|
|
30
|
+
else if (typeof param === 'object' && !(param instanceof File)) {
|
|
32
31
|
addInputs(form, param, name);
|
|
33
32
|
}
|
|
34
33
|
else {
|
package/dist/fn/adjustHeight.js
CHANGED
|
@@ -2,7 +2,7 @@ import { isIterable } from './isIterable';
|
|
|
2
2
|
import { adjustSize } from './adjustSize';
|
|
3
3
|
const adjustHeight = function () {
|
|
4
4
|
let args = arguments;
|
|
5
|
-
if (
|
|
5
|
+
if (args.length === 1 && isIterable(args[0])) {
|
|
6
6
|
args = args[0];
|
|
7
7
|
}
|
|
8
8
|
return adjustSize('height', args);
|
package/dist/fn/adjustSize.js
CHANGED
|
@@ -5,7 +5,7 @@ const adjustSize = function (type, eles) {
|
|
|
5
5
|
el.style[type] = 'auto';
|
|
6
6
|
});
|
|
7
7
|
each(eles, (el, i) => {
|
|
8
|
-
let rect = el.getBoundingClientRect(), s = rect[type] % 1 ?
|
|
8
|
+
let rect = el.getBoundingClientRect(), s = rect[type] % 1 ? rect[type] - (rect[type] % 1) + 1 : rect[type];
|
|
9
9
|
//s = rect[type];
|
|
10
10
|
if (s > max) {
|
|
11
11
|
max = s;
|
package/dist/fn/adjustWidth.js
CHANGED
|
@@ -2,7 +2,7 @@ import { isIterable } from './isIterable';
|
|
|
2
2
|
import { adjustSize } from './adjustSize';
|
|
3
3
|
const adjustWidth = function () {
|
|
4
4
|
let args = arguments;
|
|
5
|
-
if (
|
|
5
|
+
if (args.length === 1 && isIterable(args[0])) {
|
|
6
6
|
args = args[0];
|
|
7
7
|
}
|
|
8
8
|
return adjustSize('width', args);
|
package/dist/fn/ajax.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const ajax: (url: any, datatype:
|
|
1
|
+
declare const ajax: (url: any, datatype: string, data: any, success?: (data: object, headers?: object) => any, failure?: (url: string, o?: object) => any, abort?: (message: string, url: string) => any) => any;
|
|
2
2
|
export { ajax };
|
package/dist/fn/ajax.js
CHANGED
|
@@ -12,7 +12,7 @@ import { defaultAjaxAbortFunction } from './defaultAjaxAbortFunction';
|
|
|
12
12
|
import { _addLoader } from './_addLoader';
|
|
13
13
|
import { defaultStartLoadingFunction } from './defaultStartLoadingFunction';
|
|
14
14
|
const ajax = function (url, datatype, data, success, failure, abort) {
|
|
15
|
-
if (
|
|
15
|
+
if (arguments.length === 1 && url && typeof url === 'object' && url.url) {
|
|
16
16
|
if (url.abort) {
|
|
17
17
|
abort = url.abort;
|
|
18
18
|
}
|
|
@@ -33,10 +33,10 @@ const ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
33
33
|
if (!url) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
if (url) {
|
|
36
|
+
if (url && typeof url === 'string') {
|
|
37
37
|
if (url.indexOf('://') === -1) {
|
|
38
38
|
// Prevent protocol mismatch by Axios
|
|
39
|
-
url = replaceAll(
|
|
39
|
+
url = replaceAll('//', '/', url);
|
|
40
40
|
}
|
|
41
41
|
if (!datatype) {
|
|
42
42
|
datatype = 'json';
|
|
@@ -54,20 +54,21 @@ const ajax = function (url, datatype, data, success, failure, abort) {
|
|
|
54
54
|
let source = cancelToken.source();
|
|
55
55
|
let options = {
|
|
56
56
|
responseType: datatype,
|
|
57
|
-
cancelToken: source.token
|
|
57
|
+
cancelToken: source.token,
|
|
58
58
|
};
|
|
59
59
|
if (datatype === 'text') {
|
|
60
60
|
options.headers = {
|
|
61
61
|
accept: 'text/javascript',
|
|
62
|
-
'Content-Type': 'text/javascript'
|
|
62
|
+
'Content-Type': 'text/javascript',
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
let args = [url];
|
|
66
|
-
if (isObject(data) &&
|
|
66
|
+
if (isObject(data) && numProperties(data) > 0) {
|
|
67
67
|
args.push(data);
|
|
68
68
|
}
|
|
69
69
|
args.push(options);
|
|
70
|
-
let loader = axios[args.length === 2 ? 'get' : 'post']
|
|
70
|
+
let loader = axios[args.length === 2 ? 'get' : 'post']
|
|
71
|
+
.apply(axios, args)
|
|
71
72
|
.then((res) => {
|
|
72
73
|
_deleteLoader(requestId, res);
|
|
73
74
|
defaultEndLoadingFunction(url, tst, data, res);
|
|
@@ -17,7 +17,7 @@ const analyzeFunction = function (fn) {
|
|
|
17
17
|
let isEscaped = false;
|
|
18
18
|
let settingDefault = false;
|
|
19
19
|
for (let i = 0; i < all.length; i++) {
|
|
20
|
-
if (
|
|
20
|
+
if (all[i] === currentQuote && !isEscaped && currentQuote) {
|
|
21
21
|
currentQuote = '';
|
|
22
22
|
exp += all[i];
|
|
23
23
|
}
|
|
@@ -59,7 +59,7 @@ const analyzeFunction = function (fn) {
|
|
|
59
59
|
}
|
|
60
60
|
else if (all[i] === '=') {
|
|
61
61
|
if (functionString.substr(i, 2) === '=>') {
|
|
62
|
-
if (exp.trim() !==
|
|
62
|
+
if (exp.trim() !== '' && parOpened === parClosed) {
|
|
63
63
|
currentArg.name = exp.trim();
|
|
64
64
|
args.push(currentArg);
|
|
65
65
|
currentArg = {};
|
|
@@ -122,10 +122,10 @@ const analyzeFunction = function (fn) {
|
|
|
122
122
|
body = exp;
|
|
123
123
|
}
|
|
124
124
|
else {
|
|
125
|
-
throw Error(
|
|
125
|
+
throw Error('Unexpected end of function while parsing function');
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
const argString = args.map(arg => arg.name + (arg.default ? ' = ' + arg.default : '')).join(', ');
|
|
128
|
+
const argString = args.map((arg) => arg.name + (arg.default ? ' = ' + arg.default : '')).join(', ');
|
|
129
129
|
const hash = md5(body + (name ? '-' + name : '') + (argString ? '-' + argString : ''));
|
|
130
130
|
return {
|
|
131
131
|
body,
|
|
@@ -135,7 +135,7 @@ const analyzeFunction = function (fn) {
|
|
|
135
135
|
hasFunction,
|
|
136
136
|
name,
|
|
137
137
|
isAsync,
|
|
138
|
-
hash
|
|
138
|
+
hash,
|
|
139
139
|
};
|
|
140
140
|
};
|
|
141
141
|
export { analyzeFunction };
|
package/dist/fn/animateCss.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
const animateCss = function (ele, animationName, callback) {
|
|
2
2
|
let animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
|
|
3
3
|
/*$(ele).addClass('animated ' + animationName).one(animationEnd, function(){
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
if ( typeof callback == 'function' ){ // make sure the callback is a function
|
|
5
|
+
callback.call(this); // brings the scope to the callback
|
|
6
|
+
}
|
|
7
|
+
$(this).removeClass('animated ' + animationName);
|
|
8
|
+
})*/
|
|
9
9
|
ele.classList.add('animated');
|
|
10
10
|
ele.classList.add(animationName);
|
|
11
11
|
ele.addEventListener(animationEnd, (e) => {
|
|
12
12
|
e.target.removeEventListener(e.type, arguments.callee);
|
|
13
|
-
if (typeof callback == 'function') {
|
|
13
|
+
if (typeof callback == 'function') {
|
|
14
|
+
// make sure the callback is a function
|
|
14
15
|
callback.call(this); // brings the scope to the callback
|
|
15
16
|
}
|
|
16
|
-
this.classList.remove(
|
|
17
|
+
this.classList.remove(animationName);
|
|
17
18
|
});
|
|
18
19
|
};
|
|
19
20
|
export { animateCss };
|
package/dist/fn/baseName.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const baseName: (path:
|
|
1
|
+
declare const baseName: (path: string, suffix?: string) => string;
|
|
2
2
|
export { baseName };
|
package/dist/fn/baseName.js
CHANGED
package/dist/fn/br2nl.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const br2nl: (st: any) =>
|
|
1
|
+
declare const br2nl: (st: any) => string;
|
|
2
2
|
export { br2nl };
|
package/dist/fn/br2nl.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { replaceAll } from './replaceAll';
|
|
2
2
|
const br2nl = function (st) {
|
|
3
|
-
return replaceAll(
|
|
3
|
+
return replaceAll('<br />', '\n', replaceAll('<br/>', '\n', replaceAll('<br>', '\n', st)));
|
|
4
4
|
};
|
|
5
5
|
export { br2nl };
|
package/dist/fn/calendar.js
CHANGED
package/dist/fn/callback.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const callback: (url:
|
|
1
|
+
declare const callback: (url: string, res?: BbnAjaxResult, fn?: (a: BbnAjaxResult, b?: HTMLElement) => any, fn2?: (a: BbnAjaxResult) => any, ele?: HTMLElement | HTMLInputElement | HTMLTextAreaElement) => boolean;
|
|
2
2
|
export { callback };
|
package/dist/fn/callback.js
CHANGED
|
@@ -4,7 +4,7 @@ import { isFunction } from './isFunction';
|
|
|
4
4
|
import { log } from './log';
|
|
5
5
|
import { defaultPostLinkFunction } from './defaultPostLinkFunction';
|
|
6
6
|
import { defaultAlertFunction } from './defaultAlertFunction';
|
|
7
|
-
const callback = function (url, res, fn, fn2, ele) {
|
|
7
|
+
const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
|
|
8
8
|
let tmp = false;
|
|
9
9
|
if (res) {
|
|
10
10
|
tmp = true;
|
|
@@ -31,16 +31,16 @@ const callback = function (url, res, fn, fn2, ele) {
|
|
|
31
31
|
tmp = defaultLinkFunction(res, ele);
|
|
32
32
|
}
|
|
33
33
|
if (ele && isObj && (res.content !== undefined)) {
|
|
34
|
-
if (ele
|
|
35
|
-
ele.
|
|
34
|
+
if ('value' in ele) {
|
|
35
|
+
ele.value = res.content;
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
38
|
ele.innerHTML = res.content;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
if (tmp && isObj && res.script) {
|
|
42
|
-
if (
|
|
43
|
-
tmp = res.script(res.data ? res.data : {}, ele
|
|
42
|
+
if (typeof (res.script) === 'function') {
|
|
43
|
+
tmp = res.script(res.data ? res.data : {}, ele || null);
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
46
|
tmp = ((data, ele) => {
|
package/dist/fn/camelToCss.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
const camelToCss = function (str) {
|
|
2
|
-
return str
|
|
2
|
+
return str
|
|
3
|
+
.replace(/([A-Z])/g, function (st) {
|
|
3
4
|
return '-' + st.toLowerCase();
|
|
4
|
-
})
|
|
5
|
+
})
|
|
6
|
+
.replace('/^./', function (st) {
|
|
5
7
|
return st.toLowerCase();
|
|
6
8
|
});
|
|
7
9
|
};
|
package/dist/fn/canvasToImage.js
CHANGED
package/dist/fn/center.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { log } from './log';
|
|
2
1
|
const center = function (ele) {
|
|
3
2
|
//ele = $(ele);
|
|
4
3
|
let parent = ele.parentNode,
|
|
@@ -14,13 +13,12 @@ const center = function (ele) {
|
|
|
14
13
|
w = parent.clientWidth;
|
|
15
14
|
h = parent.clientHeight;
|
|
16
15
|
}
|
|
17
|
-
log("BBN_CENTER", w, h);
|
|
18
16
|
//ele.css("position","absolute");
|
|
19
|
-
ele.style.position =
|
|
17
|
+
ele.style.position = 'absolute';
|
|
20
18
|
//ele.css("top", Math.max(0, ((h - ele.outerHeight()) / 2) + parent.scrollTop()) + "px");
|
|
21
|
-
ele.style.top = Math.max(0, (
|
|
19
|
+
ele.style.top = Math.max(0, (h - ele.offsetHeight) / 2 + parent.scrollTop) + 'px';
|
|
22
20
|
//ele.css("left", Math.max(0, ((w - ele.outerWidth()) / 2) + parent.scrollLeft()) + "px");
|
|
23
|
-
ele.style.left = Math.max(0, (
|
|
21
|
+
ele.style.left = Math.max(0, (h - ele.offsetWidth) / 2 + parent.scrollLeft) + 'px';
|
|
24
22
|
return ele;
|
|
25
23
|
};
|
|
26
24
|
export { center };
|
package/dist/fn/checkProps.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const checkProps: (obj:
|
|
1
|
+
declare const checkProps: (obj: object, props: string | string[], checkEmpty?: boolean) => boolean;
|
|
2
2
|
export { checkProps };
|
package/dist/fn/checkProps.js
CHANGED
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
import { isString } from './isString';
|
|
2
1
|
import { isArray } from './isArray';
|
|
3
2
|
import { isObject } from './isObject';
|
|
4
3
|
import { each } from './each';
|
|
5
4
|
import { substr } from './substr';
|
|
6
|
-
const checkPropsDetails = function (obj, props, checkEmpty) {
|
|
5
|
+
const checkPropsDetails = function (obj, props, checkEmpty = false) {
|
|
7
6
|
let res = {
|
|
8
7
|
error: false,
|
|
9
|
-
result: true
|
|
8
|
+
result: true,
|
|
10
9
|
};
|
|
11
|
-
if (
|
|
10
|
+
if (typeof (props) === 'string') {
|
|
12
11
|
props = [props];
|
|
13
12
|
}
|
|
14
13
|
if (!isArray(props)) {
|
|
15
|
-
res.error = bbn._(
|
|
14
|
+
res.error = bbn._('checkProps must receive a string or an array as props argument');
|
|
16
15
|
}
|
|
17
16
|
if (!isObject(obj)) {
|
|
18
|
-
res.error = bbn._(
|
|
17
|
+
res.error = bbn._('checkProps must receive an object as obj argument');
|
|
19
18
|
}
|
|
20
19
|
if (!res.error) {
|
|
21
20
|
let check;
|
|
22
|
-
each(props, varName => {
|
|
21
|
+
each(props, (varName) => {
|
|
23
22
|
varName = varName.trim().split(':');
|
|
24
23
|
let type = varName[1] || false;
|
|
25
24
|
varName = varName[0];
|
|
26
25
|
if (obj[varName] === undefined) {
|
|
27
|
-
res.error = varName + ' ' + bbn._(
|
|
26
|
+
res.error = varName + ' ' + bbn._('is not defined');
|
|
28
27
|
}
|
|
29
28
|
else if (type) {
|
|
30
29
|
check = 'is' + substr(type, 0, 1).toUpperCase() + substr(type, 1).toLowerCase();
|
|
31
30
|
if (bbn.fn[check] === undefined) {
|
|
32
|
-
res.error = type + ' ' + bbn._(
|
|
31
|
+
res.error = type + ' ' + bbn._('is not a valid type');
|
|
33
32
|
}
|
|
34
33
|
else if (!bbn.fn[check](obj[varName])) {
|
|
35
|
-
res.error = varName + ' ' + bbn._(
|
|
34
|
+
res.error = varName + ' ' + bbn._('is not a') + ' ' + type;
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
else if (checkEmpty && !obj[varName]) {
|
|
39
|
-
res.error = varName + ' ' + bbn._(
|
|
38
|
+
res.error = varName + ' ' + bbn._('is empty');
|
|
40
39
|
}
|
|
41
40
|
if (res.error) {
|
|
42
41
|
return false;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const checkPropsOrDie: (obj:
|
|
1
|
+
declare const checkPropsOrDie: (obj: object, props: string | string[], checkEmpty?: boolean) => boolean;
|
|
2
2
|
export { checkPropsOrDie };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { checkPropsDetails } from './checkPropsDetails';
|
|
2
|
-
const checkPropsOrDie = function (obj, props, checkEmpty) {
|
|
2
|
+
const checkPropsOrDie = function (obj, props, checkEmpty = false) {
|
|
3
3
|
let res = checkPropsDetails(obj, props, checkEmpty);
|
|
4
4
|
if (res.error) {
|
|
5
5
|
throw new Error(res.error);
|
package/dist/fn/checkType.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const checkType: (value: any, type:
|
|
1
|
+
declare const checkType: (value: any, type: object | string, msg?: string, ...logs: any[]) => void;
|
|
2
2
|
export { checkType };
|
package/dist/fn/checkType.js
CHANGED
|
@@ -11,7 +11,7 @@ const checkType = function (value, type, msg, ...logs) {
|
|
|
11
11
|
type = [type];
|
|
12
12
|
}
|
|
13
13
|
const typesList = [];
|
|
14
|
-
each(type, t => {
|
|
14
|
+
each(type, (t) => {
|
|
15
15
|
var _a;
|
|
16
16
|
if (t === String) {
|
|
17
17
|
t = 'string';
|
|
@@ -50,11 +50,11 @@ const checkType = function (value, type, msg, ...logs) {
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
if (!ok) {
|
|
53
|
-
log([
|
|
53
|
+
log(['Value given', value, 'type', typeof value, 'expected', typesList.join(' or ')]);
|
|
54
54
|
if (logs.length) {
|
|
55
55
|
log(logs);
|
|
56
56
|
}
|
|
57
|
-
throw new Error((msg ? msg + ' - ' : '') + bbn._(
|
|
57
|
+
throw new Error((msg ? msg + ' - ' : '') + bbn._('The value should be a %s', typesList.join(' ' + bbn._('or a') + ' ')));
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
export { checkType };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { each } from './each';
|
|
2
|
+
const _private = [];
|
|
3
|
+
const startChrono = function (name) {
|
|
4
|
+
let now = new Date().getTime();
|
|
5
|
+
let h1 = 3600 * 1000;
|
|
6
|
+
if (_private.length) {
|
|
7
|
+
each(_private, (t, n) => {
|
|
8
|
+
if (now - t > h1) {
|
|
9
|
+
delete _private[n];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
now = new Date().getTime();
|
|
13
|
+
}
|
|
14
|
+
_private[name] = now;
|
|
15
|
+
};
|
|
16
|
+
const stopChrono = function (name) {
|
|
17
|
+
if (_private[name]) {
|
|
18
|
+
let now = new Date().getTime();
|
|
19
|
+
let diff = now - _private[name];
|
|
20
|
+
return diff;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export { startChrono, stopChrono };
|
|
@@ -4,7 +4,7 @@ import { log } from './log';
|
|
|
4
4
|
const circularReplacer = function () {
|
|
5
5
|
const visited = new WeakSet();
|
|
6
6
|
return (key, value) => {
|
|
7
|
-
if (
|
|
7
|
+
if (typeof value === 'object' && value !== null) {
|
|
8
8
|
if (visited.has(value)) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
@@ -19,7 +19,7 @@ const circularReplacer = function () {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
else if (isCp(value)) {
|
|
22
|
-
log(
|
|
22
|
+
log('IS CP');
|
|
23
23
|
value = '__BBN_CP__' + value.$options.name + '/' + value.$cid;
|
|
24
24
|
}
|
|
25
25
|
else {
|
package/dist/fn/clone.d.ts
CHANGED
package/dist/fn/clone.js
CHANGED
package/dist/fn/colorToHex.js
CHANGED