@bbn/bbn 1.0.118 → 1.0.120
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/$.js +1 -1
- package/dist/_.js +11 -7
- package/dist/bundle-webpack.js +17 -13549
- package/dist/bundle-webpack.js.map +1 -1
- package/dist/db.js +82 -81
- package/dist/env.js +1 -1
- package/dist/fn/ajax/_addLoader.js +6 -6
- package/dist/fn/ajax/_deleteLoader.js +16 -14
- package/dist/fn/ajax/abort.js +3 -3
- package/dist/fn/ajax/abortURL.js +4 -4
- package/dist/fn/ajax/ajax.js +36 -31
- package/dist/fn/ajax/callback.js +14 -10
- package/dist/fn/ajax/download.js +15 -13
- package/dist/fn/ajax/downloadContent.js +10 -9
- package/dist/fn/ajax/getLoader.js +3 -3
- package/dist/fn/ajax/getRequestId.js +5 -5
- package/dist/fn/ajax/link.js +20 -16
- package/dist/fn/ajax/post.js +10 -6
- package/dist/fn/ajax/postOut.js +7 -5
- package/dist/fn/ajax/setNavigationVars.js +11 -9
- package/dist/fn/ajax/treatAjaxArguments.js +8 -8
- package/dist/fn/ajax/upload.js +11 -8
- package/dist/fn/browser/copy.js +10 -8
- package/dist/fn/browser/eraseCookie.js +1 -1
- package/dist/fn/browser/error.js +4 -4
- package/dist/fn/browser/getBrowserName.js +2 -2
- package/dist/fn/browser/getBrowserVersion.js +2 -2
- package/dist/fn/browser/getCookie.js +6 -6
- package/dist/fn/browser/getDeviceType.js +2 -2
- package/dist/fn/browser/getEventData.js +33 -33
- package/dist/fn/browser/happy.js +6 -2
- package/dist/fn/browser/history.js +1 -1
- package/dist/fn/browser/info.js +6 -2
- package/dist/fn/browser/isActiveInterface.js +3 -2
- package/dist/fn/browser/isDesktopDevice.js +2 -2
- package/dist/fn/browser/isFocused.js +2 -1
- package/dist/fn/browser/isMobile.js +3 -3
- package/dist/fn/browser/isMobileDevice.js +2 -2
- package/dist/fn/browser/isTabletDevice.js +2 -2
- package/dist/fn/browser/log.js +13 -9
- package/dist/fn/browser/replaceSelection.js +6 -6
- package/dist/fn/browser/selectElementText.js +5 -4
- package/dist/fn/browser/setCookie.js +4 -4
- package/dist/fn/browser/toggleFullScreen.js +2 -2
- package/dist/fn/browser/warning.js +4 -4
- package/dist/fn/convert/arrayBuffer2String.js +1 -1
- package/dist/fn/convert/canvasToImage.js +2 -2
- package/dist/fn/convert/colorToHex.js +2 -2
- package/dist/fn/convert/fromXml.js +14 -8
- package/dist/fn/convert/hex2rgb.js +1 -1
- package/dist/fn/convert/imageToCanvas.js +2 -2
- package/dist/fn/convert/imgToBase64.js +4 -3
- package/dist/fn/convert/rgb2hex.js +1 -1
- package/dist/fn/convert/string2ArrayBuffer.js +1 -1
- package/dist/fn/convert/toCSV.js +13 -10
- package/dist/fn/datetime/calendar.js +11 -10
- package/dist/fn/datetime/chrono.js +9 -9
- package/dist/fn/datetime/date.js +5 -5
- package/dist/fn/datetime/dateSQL.d.ts +1 -1
- package/dist/fn/datetime/dateSQL.js +4 -4
- package/dist/fn/datetime/daysInMonth.js +3 -3
- package/dist/fn/datetime/fdate.js +7 -6
- package/dist/fn/datetime/fdatetime.js +6 -5
- package/dist/fn/datetime/formatDate.js +1 -1
- package/dist/fn/datetime/ftime.js +5 -5
- package/dist/fn/datetime/getDay.js +5 -5
- package/dist/fn/datetime/timestamp.js +3 -2
- package/dist/fn/default/defaultAjaxAbortFunction.js +3 -2
- package/dist/fn/default/defaultAjaxErrorFunction.js +4 -2
- package/dist/fn/default/defaultAlertFunction.js +2 -1
- package/dist/fn/default/defaultConfirmFunction.js +4 -3
- package/dist/fn/default/defaultEndLoadingFunction.js +3 -1
- package/dist/fn/default/defaultErrorFunction.js +2 -2
- package/dist/fn/default/defaultHistoryFunction.js +1 -1
- package/dist/fn/default/defaultLinkFunction.js +1 -1
- package/dist/fn/default/defaultPostLinkFunction.js +2 -1
- package/dist/fn/default/defaultPreLinkFunction.js +4 -2
- package/dist/fn/default/defaultResizeFunction.js +1 -1
- package/dist/fn/default/defaultStartLoadingFunction.js +3 -1
- package/dist/fn/form/addInputs.js +13 -11
- package/dist/fn/form/fieldValue.js +2 -2
- package/dist/fn/form/formdata.js +29 -29
- package/dist/fn/form/objectToFormData.js +13 -10
- package/dist/fn/form/submit.js +5 -5
- package/dist/fn/html/adjustHeight.js +4 -4
- package/dist/fn/html/adjustSize.js +7 -7
- package/dist/fn/html/adjustWidth.js +4 -4
- package/dist/fn/html/getAllTags.js +3 -3
- package/dist/fn/html/getAncestors.js +3 -2
- package/dist/fn/html/getAttributes.js +4 -4
- package/dist/fn/html/getHTMLOfSelection.js +6 -6
- package/dist/fn/html/getHtml.js +4 -3
- package/dist/fn/html/getPath.js +24 -17
- package/dist/fn/html/getText.js +1 -1
- package/dist/fn/html/html2text.js +2 -2
- package/dist/fn/html/isInside.js +9 -9
- package/dist/fn/html/makeReactive.js +35 -31
- package/dist/fn/html/selector.js +1 -1
- package/dist/fn/init.js +28 -28
- package/dist/fn/loop/each.js +6 -6
- package/dist/fn/loop/fori.js +7 -5
- package/dist/fn/loop/forir.js +7 -5
- package/dist/fn/loop/iterate.js +7 -4
- package/dist/fn/loop/riterate.js +3 -2
- package/dist/fn/misc/analyzeFunction.d.ts +1 -1
- package/dist/fn/misc/analyzeFunction.js +31 -31
- package/dist/fn/misc/getTimeoff.js +1 -1
- package/dist/fn/misc/money.js +6 -6
- package/dist/fn/misc/percent.js +1 -1
- package/dist/fn/misc/randomInt.js +1 -1
- package/dist/fn/misc/roundDecimal.js +1 -1
- package/dist/fn/misc/translate.js +4 -4
- package/dist/fn/object/_compareValues.js +7 -6
- package/dist/fn/object/arrayFromProp.js +5 -5
- package/dist/fn/object/autoExtend.js +2 -2
- package/dist/fn/object/checkProps.js +3 -2
- package/dist/fn/object/checkPropsDetails.js +13 -12
- package/dist/fn/object/checkPropsOrDie.js +4 -3
- package/dist/fn/object/circularReplacer.js +6 -6
- package/dist/fn/object/clone.js +6 -6
- package/dist/fn/object/compare.js +6 -6
- package/dist/fn/object/compareConditions.js +11 -11
- package/dist/fn/object/count.js +4 -2
- package/dist/fn/object/createObject.js +17 -4
- package/dist/fn/object/deepPath.js +10 -9
- package/dist/fn/object/deleteProp.js +2 -2
- package/dist/fn/object/diffObj.js +19 -17
- package/dist/fn/object/extend.js +17 -13
- package/dist/fn/object/extendOut.js +10 -5
- package/dist/fn/object/filter.d.ts +1 -1
- package/dist/fn/object/filter.js +12 -10
- package/dist/fn/object/filterToConditions.js +10 -9
- package/dist/fn/object/findAll.js +8 -7
- package/dist/fn/object/getField.js +6 -3
- package/dist/fn/object/getFieldValues.js +6 -6
- package/dist/fn/object/getProp.js +2 -2
- package/dist/fn/object/getProperty.js +2 -2
- package/dist/fn/object/getRow.js +4 -2
- package/dist/fn/object/map.js +4 -3
- package/dist/fn/object/move.js +2 -2
- package/dist/fn/object/multiorder.js +8 -7
- package/dist/fn/object/numProperties.js +1 -1
- package/dist/fn/object/order.js +3 -2
- package/dist/fn/object/pickValue.js +1 -1
- package/dist/fn/object/removeEmpty.js +6 -6
- package/dist/fn/object/removePrivateProp.js +4 -3
- package/dist/fn/object/search.d.ts +1 -1
- package/dist/fn/object/search.js +15 -12
- package/dist/fn/object/setProp.js +3 -1
- package/dist/fn/object/setProperty.js +10 -10
- package/dist/fn/object/shortenObj.js +8 -7
- package/dist/fn/object/shuffle.js +4 -3
- package/dist/fn/object/sum.js +6 -6
- package/dist/fn/object/unique.js +1 -1
- package/dist/fn/string/baseName.js +6 -6
- package/dist/fn/string/br2nl.js +2 -2
- package/dist/fn/string/camelToCss.js +1 -1
- package/dist/fn/string/camelize.js +1 -1
- package/dist/fn/string/correctCase.js +2 -2
- package/dist/fn/string/crc32.js +8 -8
- package/dist/fn/string/dirName.js +4 -4
- package/dist/fn/string/escapeDquotes.js +2 -2
- package/dist/fn/string/escapeRegExp.js +1 -1
- package/dist/fn/string/escapeSquotes.js +2 -2
- package/dist/fn/string/escapeTicks.js +2 -2
- package/dist/fn/string/escapeUrl.js +11 -11
- package/dist/fn/string/fileExt.js +3 -3
- package/dist/fn/string/format.js +6 -6
- package/dist/fn/string/formatBytes.js +3 -2
- package/dist/fn/string/formatSize.js +3 -3
- package/dist/fn/string/hash.js +9 -9
- package/dist/fn/string/md5.js +1 -1
- package/dist/fn/string/nl2br.js +2 -2
- package/dist/fn/string/printf.js +1 -1
- package/dist/fn/string/quotes2html.js +2 -2
- package/dist/fn/string/randomString.js +7 -7
- package/dist/fn/string/removeAccents.js +3 -3
- package/dist/fn/string/removeExtraSpaces.js +1 -1
- package/dist/fn/string/removeHtmlComments.js +2 -2
- package/dist/fn/string/removeTrailingChars.js +2 -2
- package/dist/fn/string/repeat.js +1 -1
- package/dist/fn/string/replaceAll.js +4 -3
- package/dist/fn/string/sanitize.js +9 -8
- package/dist/fn/string/shorten.js +3 -3
- package/dist/fn/string/simpleHash.js +5 -5
- package/dist/fn/string/simpleHash1.js +4 -4
- package/dist/fn/string/simpleHash2.js +4 -4
- package/dist/fn/string/substr.js +4 -4
- package/dist/fn/string/trim.js +3 -2
- package/dist/fn/string/uniqString.js +17 -10
- package/dist/fn/style/addColors.js +17 -17
- package/dist/fn/style/addStyle.js +4 -4
- package/dist/fn/style/animateCss.js +4 -4
- package/dist/fn/style/center.js +2 -2
- package/dist/fn/style/cssExists.js +8 -8
- package/dist/fn/style/getCssVar.js +1 -1
- package/dist/fn/style/getScrollBarSize.js +6 -6
- package/dist/fn/style/lightenDarkenHex.js +3 -3
- package/dist/fn/style/outerHeight.js +4 -4
- package/dist/fn/style/outerWidth.js +4 -4
- package/dist/fn/style/resize.js +17 -17
- package/dist/fn/style/setCssVar.js +1 -1
- package/dist/fn/type/checkType.js +16 -12
- package/dist/fn/type/isArray.js +7 -2
- package/dist/fn/type/isBlob.js +7 -2
- package/dist/fn/type/isBoolean.js +7 -2
- package/dist/fn/type/isCanvas.js +7 -2
- package/dist/fn/type/isColor.js +8 -3
- package/dist/fn/type/isComment.js +7 -2
- package/dist/fn/type/isCp.js +9 -4
- package/dist/fn/type/isDate.js +7 -2
- package/dist/fn/type/isDimension.js +8 -3
- package/dist/fn/type/isDom.js +7 -2
- package/dist/fn/type/isEmail.js +9 -4
- package/dist/fn/type/isEmpty.js +3 -3
- package/dist/fn/type/isEvent.js +7 -2
- package/dist/fn/type/isFunction.js +7 -2
- package/dist/fn/type/isHostname.js +9 -4
- package/dist/fn/type/isIP.js +8 -3
- package/dist/fn/type/isInt.js +7 -2
- package/dist/fn/type/isIterable.js +7 -2
- package/dist/fn/type/isNull.js +7 -2
- package/dist/fn/type/isNumber.js +7 -2
- package/dist/fn/type/isObject.js +7 -2
- package/dist/fn/type/isPercent.js +7 -2
- package/dist/fn/type/isPrimitive.js +7 -2
- package/dist/fn/type/isPromise.js +7 -2
- package/dist/fn/type/isPropSize.js +4 -4
- package/dist/fn/type/isSQLDate.js +7 -2
- package/dist/fn/type/isSame.js +9 -9
- package/dist/fn/type/isString.js +7 -2
- package/dist/fn/type/isSymbol.js +7 -2
- package/dist/fn/type/isURL.js +7 -2
- package/dist/fn/type/isValidDimension.js +5 -5
- package/dist/fn/type/isValidName.js +8 -3
- package/dist/fn/type/isValue.js +8 -3
- package/dist/fn/type/isVue.js +11 -4
- package/dist/fn.d.ts +5 -5
- package/dist/fn.js +456 -456
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1922 -1604
- package/dist/lng.js +1 -1
- package/dist/vars.js +1 -1
- package/package.json +7 -6
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { log } from '../browser/log';
|
|
2
|
-
import { createObject } from '../object/createObject';
|
|
3
|
-
import { isSymbol } from '../type/isSymbol';
|
|
4
|
-
import { isNumber } from '../type/isNumber';
|
|
5
|
-
import { isArray } from '../type/isArray';
|
|
6
|
-
import { warning } from '../browser/warning';
|
|
7
|
-
import { isFunction } from '../type/isFunction';
|
|
8
|
-
import { isSame } from '../type/isSame';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { log } from '../browser/log.js';
|
|
2
|
+
import { createObject } from '../object/createObject.js';
|
|
3
|
+
import { isSymbol } from '../type/isSymbol.js';
|
|
4
|
+
import { isNumber } from '../type/isNumber.js';
|
|
5
|
+
import { isArray } from '../type/isArray.js';
|
|
6
|
+
import { warning } from '../browser/warning.js';
|
|
7
|
+
import { isFunction } from '../type/isFunction.js';
|
|
8
|
+
import { isSame } from '../type/isSame.js';
|
|
9
|
+
var makeReactive = function (obj, onSet, parent, parentProp) {
|
|
10
|
+
var parentString = (parent === null || parent === void 0 ? void 0 : parent.$cid) || '';
|
|
11
|
+
var prefix = '__bbn_' + (parentString ? parentString + '_' : '');
|
|
12
12
|
if (obj && typeof obj === 'object' && [undefined, Object, Array].includes(obj.constructor)) {
|
|
13
13
|
if (obj.__bbnIsProxy && obj.__bbnParent === parent) {
|
|
14
14
|
return obj;
|
|
@@ -24,19 +24,23 @@ const makeReactive = function (obj, onSet, parent, parentProp) {
|
|
|
24
24
|
enumerable: false,
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
get(target, key) {
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
var handler = {
|
|
28
|
+
get: function (target, key) {
|
|
29
|
+
var realValue = Reflect.get(target, key);
|
|
30
|
+
var realTarget = target.__bbnRoot || target;
|
|
31
31
|
if (isSymbol(key)) {
|
|
32
32
|
return Reflect.get(realTarget, key);
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
var propName = parentProp ? parentProp + '.' + key : key;
|
|
35
|
+
var hiddenKey = prefix + (isNumber(key) ? key.toString() : key);
|
|
36
36
|
if (['fill', 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'].includes(key) &&
|
|
37
37
|
isArray(target)) {
|
|
38
|
-
return function (
|
|
39
|
-
|
|
38
|
+
return function () {
|
|
39
|
+
var args = [];
|
|
40
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
41
|
+
args[_i] = arguments[_i];
|
|
42
|
+
}
|
|
43
|
+
var res = realTarget[key].apply(realTarget, args);
|
|
40
44
|
warning('DOING ARRAY STUFF');
|
|
41
45
|
log(target.__bbnParent);
|
|
42
46
|
onSet(target, 'length', parent);
|
|
@@ -47,7 +51,7 @@ const makeReactive = function (obj, onSet, parent, parentProp) {
|
|
|
47
51
|
return realValue;
|
|
48
52
|
}
|
|
49
53
|
if (key === '__bbnRoot') {
|
|
50
|
-
|
|
54
|
+
var root = obj;
|
|
51
55
|
while (root && (root === null || root === void 0 ? void 0 : root.__bbnTarget)) {
|
|
52
56
|
root = root.__bbnTarget;
|
|
53
57
|
}
|
|
@@ -95,12 +99,12 @@ const makeReactive = function (obj, onSet, parent, parentProp) {
|
|
|
95
99
|
}
|
|
96
100
|
return realValue;
|
|
97
101
|
},
|
|
98
|
-
set(target, key, value) {
|
|
102
|
+
set: function (target, key, value) {
|
|
99
103
|
if (isSymbol(key)) {
|
|
100
104
|
return Reflect.get(target, key, value);
|
|
101
105
|
}
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
var realTarget = target.__bbnRoot || target;
|
|
107
|
+
var propName = parentProp ? parentProp + '.' + key : key;
|
|
104
108
|
if (isSymbol(key)) {
|
|
105
109
|
return Reflect.get(target, key);
|
|
106
110
|
}
|
|
@@ -120,7 +124,7 @@ const makeReactive = function (obj, onSet, parent, parentProp) {
|
|
|
120
124
|
if (value &&
|
|
121
125
|
typeof value === 'object' &&
|
|
122
126
|
[undefined, Object, Array].includes(value.constructor)) {
|
|
123
|
-
|
|
127
|
+
var hiddenKey = prefix + (isNumber(key) ? key.toString() : key);
|
|
124
128
|
Reflect.defineProperty(realTarget, hiddenKey, {
|
|
125
129
|
value: makeReactive(value, onSet, parent, propName),
|
|
126
130
|
writable: true,
|
|
@@ -147,14 +151,14 @@ const makeReactive = function (obj, onSet, parent, parentProp) {
|
|
|
147
151
|
}
|
|
148
152
|
return true;
|
|
149
153
|
},
|
|
150
|
-
defineProperty(target, key, description) {
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
defineProperty: function (target, key, description) {
|
|
155
|
+
var realTarget = target;
|
|
156
|
+
var propName = parentProp ? parentProp + '.' + key : key;
|
|
153
157
|
if (key === '__bbnWatchers' || isSymbol(key) || key.indexOf('__bbn_') === 0) {
|
|
154
158
|
Reflect.defineProperty(realTarget, key, description);
|
|
155
159
|
}
|
|
156
160
|
else {
|
|
157
|
-
|
|
161
|
+
var hiddenKey = prefix + (isNumber(key) ? key.toString() : key);
|
|
158
162
|
Reflect.defineProperty(realTarget, hiddenKey, {
|
|
159
163
|
value: makeReactive(description.value, onSet, parent, propName),
|
|
160
164
|
writable: true,
|
|
@@ -165,13 +169,13 @@ const makeReactive = function (obj, onSet, parent, parentProp) {
|
|
|
165
169
|
onSet(target, key, parent);
|
|
166
170
|
return true;
|
|
167
171
|
},
|
|
168
|
-
deleteProperty(target, key) {
|
|
169
|
-
|
|
172
|
+
deleteProperty: function (target, key) {
|
|
173
|
+
var realTarget = target;
|
|
170
174
|
if (key.indexOf('__bbn_') === 0) {
|
|
171
175
|
Reflect.deleteProperty(realTarget, key);
|
|
172
176
|
}
|
|
173
177
|
else {
|
|
174
|
-
|
|
178
|
+
var hiddenKey = prefix + (isNumber(key) ? key.toString() : key);
|
|
175
179
|
Reflect.deleteProperty(realTarget, hiddenKey);
|
|
176
180
|
Reflect.deleteProperty(target, key);
|
|
177
181
|
}
|
package/dist/fn/html/selector.js
CHANGED
package/dist/fn/init.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { substr } from './string/substr';
|
|
2
|
-
import { each } from './loop/each';
|
|
3
|
-
import { extend } from './object/extend';
|
|
4
|
-
import { addColors } from './style/addColors';
|
|
5
|
-
import { link } from './ajax/link';
|
|
6
|
-
import { submit } from './form/submit';
|
|
7
|
-
import { resize } from './style/resize';
|
|
8
|
-
import { isMobile } from './browser/isMobile';
|
|
9
|
-
import { isTabletDevice } from './browser/isTabletDevice';
|
|
10
|
-
import { isFunction } from './type/isFunction';
|
|
11
|
-
import { log } from './browser/log';
|
|
1
|
+
import { substr } from './string/substr.js';
|
|
2
|
+
import { each } from './loop/each.js';
|
|
3
|
+
import { extend } from './object/extend.js';
|
|
4
|
+
import { addColors } from './style/addColors.js';
|
|
5
|
+
import { link } from './ajax/link.js';
|
|
6
|
+
import { submit } from './form/submit.js';
|
|
7
|
+
import { resize } from './style/resize.js';
|
|
8
|
+
import { isMobile } from './browser/isMobile.js';
|
|
9
|
+
import { isTabletDevice } from './browser/isTabletDevice.js';
|
|
10
|
+
import { isFunction } from './type/isFunction.js';
|
|
11
|
+
import { log } from './browser/log.js';
|
|
12
12
|
/**
|
|
13
13
|
* Initializes the library bbn basing on the given configuration object.
|
|
14
14
|
* - Gives to the environment the dimension of the window.innerWidth and window.innerHeight
|
|
@@ -22,8 +22,8 @@ import { log } from './browser/log';
|
|
|
22
22
|
* @param {Object} cfg
|
|
23
23
|
* @returns
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
var init = function (cfg, force) {
|
|
26
|
+
var parts;
|
|
27
27
|
if (!bbn.env.isInit || force) {
|
|
28
28
|
bbn.env.root =
|
|
29
29
|
document.baseURI.length > 0 ? document.baseURI : bbn.env.host;
|
|
@@ -65,7 +65,7 @@ const init = function (cfg, force) {
|
|
|
65
65
|
"weekOfYear",
|
|
66
66
|
"weekYear",
|
|
67
67
|
"weekday",
|
|
68
|
-
], (plugin)
|
|
68
|
+
], function (plugin) {
|
|
69
69
|
if (window["dayjs_plugin_" + plugin]) {
|
|
70
70
|
dayjs.extend(window["dayjs_plugin_" + plugin]);
|
|
71
71
|
}
|
|
@@ -78,7 +78,7 @@ const init = function (cfg, force) {
|
|
|
78
78
|
bbn.env.path = substr(bbn.env.url, bbn.env.root.length);
|
|
79
79
|
parts = bbn.env.path.split("/");
|
|
80
80
|
//$.each(parts, function(i, v){
|
|
81
|
-
each(parts, (v, i)
|
|
81
|
+
each(parts, function (v, i) {
|
|
82
82
|
v = decodeURI(v.trim());
|
|
83
83
|
if (v !== "") {
|
|
84
84
|
bbn.env.params.push(v);
|
|
@@ -90,28 +90,28 @@ const init = function (cfg, force) {
|
|
|
90
90
|
if (bbn.env.lang && undefined !== dayjs) {
|
|
91
91
|
dayjs.locale(bbn.env.lang);
|
|
92
92
|
}
|
|
93
|
-
window.onfocus = ()
|
|
93
|
+
window.onfocus = function () {
|
|
94
94
|
bbn.env.isFocused = true;
|
|
95
95
|
};
|
|
96
|
-
window.onblur = ()
|
|
96
|
+
window.onblur = function () {
|
|
97
97
|
bbn.env.isFocused = false;
|
|
98
98
|
bbn.env.timeoff = Math.round(new Date().getTime() / 1000);
|
|
99
99
|
};
|
|
100
|
-
document.addEventListener("focusin", (e)
|
|
100
|
+
document.addEventListener("focusin", function (e) {
|
|
101
101
|
if (e.target instanceof HTMLElement &&
|
|
102
102
|
!e.target.classList.contains("bbn-no")) {
|
|
103
103
|
bbn.env.focused = e.target;
|
|
104
104
|
}
|
|
105
105
|
bbn.env.last_focus = new Date().getTime();
|
|
106
106
|
});
|
|
107
|
-
document.addEventListener("click", (e)
|
|
107
|
+
document.addEventListener("click", function (e) {
|
|
108
108
|
bbn.env.last_focus = new Date().getTime();
|
|
109
109
|
if (bbn.env.nav !== "ajax") {
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
var target = e.target;
|
|
113
113
|
if (target instanceof HTMLElement && target.tagName !== "A") {
|
|
114
|
-
|
|
114
|
+
var p = target;
|
|
115
115
|
while (p && p.tagName !== "A") {
|
|
116
116
|
if (p.tagName === "BODY") {
|
|
117
117
|
break;
|
|
@@ -135,18 +135,18 @@ const init = function (cfg, force) {
|
|
|
135
135
|
return false;
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
|
-
each(document.querySelectorAll("form:not(.bbn-no), form:not(.bbn-form)"), (ele)
|
|
139
|
-
ele.addEventListener("submit", (e)
|
|
138
|
+
each(document.querySelectorAll("form:not(.bbn-no), form:not(.bbn-form)"), function (ele) {
|
|
139
|
+
ele.addEventListener("submit", function (e) {
|
|
140
140
|
submit(ele, e);
|
|
141
141
|
});
|
|
142
142
|
});
|
|
143
|
-
window.addEventListener("hashchange", ()
|
|
143
|
+
window.addEventListener("hashchange", function () {
|
|
144
144
|
bbn.env.hashChanged = new Date().getTime();
|
|
145
145
|
}, false);
|
|
146
|
-
window.addEventListener("resize", ()
|
|
146
|
+
window.addEventListener("resize", function () {
|
|
147
147
|
resize();
|
|
148
148
|
});
|
|
149
|
-
window.addEventListener("orientationchange", ()
|
|
149
|
+
window.addEventListener("orientationchange", function () {
|
|
150
150
|
resize();
|
|
151
151
|
});
|
|
152
152
|
resize();
|
|
@@ -158,11 +158,11 @@ const init = function (cfg, force) {
|
|
|
158
158
|
}
|
|
159
159
|
if (window.history) {
|
|
160
160
|
window.onpopstate = function (e) {
|
|
161
|
-
|
|
161
|
+
var h = window.history;
|
|
162
162
|
if (!bbn.env.historyDisabled && h) {
|
|
163
163
|
//e.preventDefault();
|
|
164
164
|
if (bbn.fn.defaultHistoryFunction(h.state)) {
|
|
165
|
-
|
|
165
|
+
var state = h.state;
|
|
166
166
|
if (state) {
|
|
167
167
|
//link(substr(state.url, bbn.env.root.length), $.extend({title: state.title}, state.data));
|
|
168
168
|
link(state.url, extend({ title: state.title || bbn.env.siteTitle }, state.data || {}));
|
package/dist/fn/loop/each.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isNumber } from '../type/isNumber';
|
|
2
|
-
import { isIterable } from '../type/isIterable';
|
|
3
|
-
import { iterate } from './iterate';
|
|
1
|
+
import { isNumber } from '../type/isNumber.js';
|
|
2
|
+
import { isIterable } from '../type/isIterable.js';
|
|
3
|
+
import { iterate } from './iterate.js';
|
|
4
4
|
/**
|
|
5
5
|
* Executes the provided function on each element of the given array.
|
|
6
6
|
*
|
|
@@ -32,9 +32,9 @@ import { iterate } from './iterate';
|
|
|
32
32
|
* @param {Function} fn The function, gets the array's element and the index as arguments
|
|
33
33
|
* @returns {[Array, Object, void]}
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
var each = function (arr, fn) {
|
|
36
36
|
if (isNumber(arr) && arr > 0) {
|
|
37
|
-
for (
|
|
37
|
+
for (var i = 0; i < arr; i++) {
|
|
38
38
|
if (fn(i, i) === false) {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
@@ -42,7 +42,7 @@ const each = function (arr, fn) {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
if (isIterable(arr)) {
|
|
45
|
-
for (
|
|
45
|
+
for (var i = 0; i < arr.length; i++) {
|
|
46
46
|
if (fn(arr[i], i) === false) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
package/dist/fn/loop/fori.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isArray } from '../type/isArray';
|
|
2
|
-
import { isNumber } from '../type/isNumber';
|
|
1
|
+
import { isArray } from '../type/isArray.js';
|
|
2
|
+
import { isNumber } from '../type/isNumber.js';
|
|
3
3
|
/**
|
|
4
4
|
* Executes the provided function on each element of the given array.
|
|
5
5
|
*
|
|
@@ -34,16 +34,18 @@ import { isNumber } from '../type/isNumber';
|
|
|
34
34
|
* @param {Number} min The index at which the loop will start
|
|
35
35
|
* @returns {undefined}
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
var fori = function (arr, fn, max, min) {
|
|
38
|
+
if (max === void 0) { max = arr.length - 1; }
|
|
39
|
+
if (min === void 0) { min = 0; }
|
|
38
40
|
if (isArray(arr)) {
|
|
39
|
-
|
|
41
|
+
var realMax = arr.length - 1;
|
|
40
42
|
if (!isNumber(max) || !(0 < max && max <= realMax)) {
|
|
41
43
|
max = realMax;
|
|
42
44
|
}
|
|
43
45
|
if (!isNumber(min) || !(0 <= min && min < realMax) || min > max) {
|
|
44
46
|
min = 0;
|
|
45
47
|
}
|
|
46
|
-
for (
|
|
48
|
+
for (var i = min; i <= max; i++) {
|
|
47
49
|
if (fn(arr[i], i) === false) {
|
|
48
50
|
return;
|
|
49
51
|
}
|
package/dist/fn/loop/forir.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isArray } from '../type/isArray';
|
|
2
|
-
import { isNumber } from '../type/isNumber';
|
|
1
|
+
import { isArray } from '../type/isArray.js';
|
|
2
|
+
import { isNumber } from '../type/isNumber.js';
|
|
3
3
|
/**
|
|
4
4
|
* Executes the provided function on each element of the given array, going backward.
|
|
5
5
|
*
|
|
@@ -34,16 +34,18 @@ import { isNumber } from '../type/isNumber';
|
|
|
34
34
|
* @param {Number} min The index at which the loop will start
|
|
35
35
|
* @returns {undefined}
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
var forir = function (arr, fn, max, min) {
|
|
38
|
+
if (max === void 0) { max = arr.length - 1; }
|
|
39
|
+
if (min === void 0) { min = 0; }
|
|
38
40
|
if (isArray(arr)) {
|
|
39
|
-
|
|
41
|
+
var realMax = arr.length - 1;
|
|
40
42
|
if (!isNumber(max) || !(0 < max && max <= realMax)) {
|
|
41
43
|
max = realMax;
|
|
42
44
|
}
|
|
43
45
|
if (!isNumber(min) || !(0 <= min && min < realMax) || min > max) {
|
|
44
46
|
min = 0;
|
|
45
47
|
}
|
|
46
|
-
for (
|
|
48
|
+
for (var i = max; i >= min; i--) {
|
|
47
49
|
if (fn(arr[i], i) === false) {
|
|
48
50
|
return;
|
|
49
51
|
}
|
package/dist/fn/loop/iterate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { removePrivateProp } from '../object/removePrivateProp';
|
|
1
|
+
import { removePrivateProp } from '../object/removePrivateProp.js';
|
|
2
2
|
/**
|
|
3
3
|
* Executes the provided function on each property of the given object.
|
|
4
4
|
*
|
|
@@ -19,13 +19,16 @@ import { removePrivateProp } from '../object/removePrivateProp';
|
|
|
19
19
|
* @param {Boolean} reverse If set to true the order of the keys will be reversed
|
|
20
20
|
* @returns {Object}
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
var iterate = function (obj, fn, noPrivate, reverse) {
|
|
23
|
+
if (noPrivate === void 0) { noPrivate = false; }
|
|
24
|
+
if (reverse === void 0) { reverse = false; }
|
|
23
25
|
if (obj !== null && typeof obj === "object") {
|
|
24
|
-
|
|
26
|
+
var iter = Object.keys(noPrivate ? removePrivateProp(obj) : obj);
|
|
25
27
|
if (reverse) {
|
|
26
28
|
iter.reverse();
|
|
27
29
|
}
|
|
28
|
-
for (
|
|
30
|
+
for (var _i = 0, iter_1 = iter; _i < iter_1.length; _i++) {
|
|
31
|
+
var prop = iter_1[_i];
|
|
29
32
|
if (fn(obj[prop], prop) === false) {
|
|
30
33
|
break;
|
|
31
34
|
}
|
package/dist/fn/loop/riterate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { iterate } from './iterate';
|
|
1
|
+
import { iterate } from './iterate.js';
|
|
2
2
|
/**
|
|
3
3
|
* Executes the provided function on each property of the given object.
|
|
4
4
|
*
|
|
@@ -18,7 +18,8 @@ import { iterate } from './iterate';
|
|
|
18
18
|
* @param {Boolean} noPrivate If set to true the _private_ properties won't be included
|
|
19
19
|
* @returns {Object}
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
var riterate = function (obj, fn, noPrivate) {
|
|
22
|
+
if (noPrivate === void 0) { noPrivate = false; }
|
|
22
23
|
return iterate(obj, fn, noPrivate, true);
|
|
23
24
|
};
|
|
24
25
|
export { riterate };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { md5 } from '../string/md5';
|
|
1
|
+
import { md5 } from '../string/md5.js';
|
|
2
2
|
/**
|
|
3
3
|
* Analyzes the given function and extracts details about its structure.
|
|
4
4
|
*
|
|
@@ -7,28 +7,28 @@ import { md5 } from '../string/md5';
|
|
|
7
7
|
* @returns {Object} An object containing details about the function.
|
|
8
8
|
* @throws {Error} When unexpected syntax is encountered while parsing.
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
var analyzeFunction = function (fn) {
|
|
11
|
+
var all = typeof fn === 'function' ? fn.toString() : fn;
|
|
12
12
|
if (typeof all !== 'string') {
|
|
13
13
|
throw Error('Unexpected type ' + typeof fn + ' while parsing function');
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
for (
|
|
15
|
+
var exp = '';
|
|
16
|
+
var isArrow = false;
|
|
17
|
+
var isAsync = false;
|
|
18
|
+
var hasFunction = false;
|
|
19
|
+
var name = '';
|
|
20
|
+
var parOpened = 0;
|
|
21
|
+
var parClosed = 0;
|
|
22
|
+
var args = [];
|
|
23
|
+
var currentArg = {};
|
|
24
|
+
var body;
|
|
25
|
+
var currentQuote = '';
|
|
26
|
+
var escapable = ['"', "'", '`'];
|
|
27
|
+
var isEscaped = false;
|
|
28
|
+
var settingDefault = false;
|
|
29
|
+
var isComment = false;
|
|
30
|
+
var isCommentLine = false;
|
|
31
|
+
for (var i = 0; i < all.length; i++) {
|
|
32
32
|
// Handle string literals
|
|
33
33
|
if (!isComment && all[i] === '/' && all[i + 1] === '*') {
|
|
34
34
|
isComment = true;
|
|
@@ -135,8 +135,8 @@ const analyzeFunction = function (fn) {
|
|
|
135
135
|
if (exp.trim() !== '') {
|
|
136
136
|
if (exp.trim() === 'async') {
|
|
137
137
|
isAsync = true;
|
|
138
|
-
exp = '';
|
|
139
138
|
}
|
|
139
|
+
exp = '';
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
else {
|
|
@@ -151,17 +151,17 @@ const analyzeFunction = function (fn) {
|
|
|
151
151
|
throw Error('Unexpected end of function while parsing function');
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
var argString = args.map(function (arg) { return arg.name + (arg.default ? ' = ' + arg.default : ''); }).join(', ');
|
|
155
|
+
var hash = md5(body + (name ? '-' + name : '') + (argString ? '-' + argString : ''));
|
|
156
156
|
return {
|
|
157
|
-
body,
|
|
158
|
-
args,
|
|
159
|
-
argString,
|
|
160
|
-
isArrow,
|
|
161
|
-
hasFunction,
|
|
162
|
-
name,
|
|
163
|
-
isAsync,
|
|
164
|
-
hash,
|
|
157
|
+
body: body,
|
|
158
|
+
args: args,
|
|
159
|
+
argString: argString,
|
|
160
|
+
isArrow: isArrow,
|
|
161
|
+
hasFunction: hasFunction,
|
|
162
|
+
name: name,
|
|
163
|
+
isAsync: isAsync,
|
|
164
|
+
hash: hash,
|
|
165
165
|
};
|
|
166
166
|
};
|
|
167
167
|
export { analyzeFunction };
|
package/dist/fn/misc/money.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isNumber } from '../type/isNumber';
|
|
1
|
+
import { isNumber } from '../type/isNumber.js';
|
|
2
2
|
/**
|
|
3
3
|
* Returns the given value to money format basing on the given configuration.
|
|
4
4
|
*
|
|
@@ -20,7 +20,7 @@ import { isNumber } from '../type/isNumber';
|
|
|
20
20
|
* @param {String} thousands The character to use to separate thounsands.
|
|
21
21
|
* @param {Number} precision The number of decimals places.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
var money = function (val, kilo, currency, novalue, decimal, thousands, precision) {
|
|
24
24
|
/*
|
|
25
25
|
money(val, kilo){
|
|
26
26
|
let decimal = ',',
|
|
@@ -82,7 +82,7 @@ const money = function (val, kilo, currency, novalue, decimal, thousands, precis
|
|
|
82
82
|
precision = kilo ? 3 : 0;
|
|
83
83
|
}
|
|
84
84
|
if ((val === 0) && (typeof precision === 'number') && (precision > 0)) {
|
|
85
|
-
|
|
85
|
+
var res = val.toFixed(precision).replace('.', decimal);
|
|
86
86
|
if (currency) {
|
|
87
87
|
res += ' ' + (kilo ? 'K' + currency : currency);
|
|
88
88
|
}
|
|
@@ -100,9 +100,9 @@ const money = function (val, kilo, currency, novalue, decimal, thousands, precis
|
|
|
100
100
|
currency = 'K' + currency;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
var v = val.toFixed(precision);
|
|
104
|
+
var decimalPosition = 0;
|
|
105
|
+
var decimalIdx = 10000;
|
|
106
106
|
if (v) {
|
|
107
107
|
decimalIdx = v.indexOf('.');
|
|
108
108
|
if (decimalIdx <= 0) {
|
package/dist/fn/misc/percent.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { iterate } from '../loop/iterate';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
iterate(o, (v, k)
|
|
1
|
+
import { iterate } from '../loop/iterate.js';
|
|
2
|
+
var translate = function (o, namespace) {
|
|
3
|
+
var lng = namespace ? bbn.lng[namespace.indexOf('_') === 0 ? namespace : '_' + namespace] : bbn.lng;
|
|
4
|
+
iterate(o, function (v, k) {
|
|
5
5
|
lng[k] = v;
|
|
6
6
|
});
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getProperty } from './getProperty';
|
|
2
|
-
import { isString } from '../type/isString';
|
|
3
|
-
import { removeAccents } from '../string/removeAccents';
|
|
4
|
-
import { isDate } from '../type/isDate';
|
|
1
|
+
import { getProperty } from './getProperty.js';
|
|
2
|
+
import { isString } from '../type/isString.js';
|
|
3
|
+
import { removeAccents } from '../string/removeAccents.js';
|
|
4
|
+
import { isDate } from '../type/isDate.js';
|
|
5
5
|
/**
|
|
6
6
|
* Compares the given property in the given objects and returns -1, 1, or 0 depending on their difference.
|
|
7
7
|
*
|
|
@@ -40,8 +40,9 @@ import { isDate } from '../type/isDate';
|
|
|
40
40
|
* @param {String} [dir=asc] Direction of comparison (desc or asc by default)
|
|
41
41
|
* @returns {Number} Always either -1, 1, or 0
|
|
42
42
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
var _compareValues = function (a, b, prop, dir) {
|
|
44
|
+
if (dir === void 0) { dir = "asc"; }
|
|
45
|
+
var va = getProperty(a, prop), vb = getProperty(b, prop), ta = (typeof va).toLowerCase(), tb = (typeof vb).toLowerCase();
|
|
45
46
|
if (dir !== "asc" && isString(dir) && dir.toLowerCase() === "desc") {
|
|
46
47
|
dir = "desc";
|
|
47
48
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { each } from '../loop/each';
|
|
2
|
-
import { getProperty } from './getProperty';
|
|
1
|
+
import { each } from '../loop/each.js';
|
|
2
|
+
import { getProperty } from './getProperty.js';
|
|
3
3
|
/**
|
|
4
4
|
* Creates and returns a new array made of the given property's values from the given array of objects.
|
|
5
5
|
*
|
|
@@ -31,9 +31,9 @@ import { getProperty } from './getProperty';
|
|
|
31
31
|
* @param {String} prop
|
|
32
32
|
* @returns {Array} The new array
|
|
33
33
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
each(arr, (a, i)
|
|
34
|
+
var arrayFromProp = function (arr, prop) {
|
|
35
|
+
var r = [];
|
|
36
|
+
each(arr, function (a, i) {
|
|
37
37
|
r.push(getProperty(a, prop));
|
|
38
38
|
});
|
|
39
39
|
return r;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extend } from './extend';
|
|
1
|
+
import { extend } from './extend.js';
|
|
2
2
|
/**
|
|
3
3
|
* Extends the bbn object by passing the namespace and the object it will merge with.
|
|
4
4
|
*
|
|
@@ -30,7 +30,7 @@ import { extend } from './extend';
|
|
|
30
30
|
* @param {Object} obj The object to merge
|
|
31
31
|
* @returns {undefined} No return value
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
var autoExtend = function (namespace, obj) {
|
|
34
34
|
if (!bbn[namespace]) {
|
|
35
35
|
bbn[namespace] = {};
|
|
36
36
|
//$.extend(true, bbn[namespace], obj);
|