@bbn/bbn 1.0.15 → 1.0.17

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.
Files changed (194) hide show
  1. package/dist/bundle.d.ts +32 -32
  2. package/dist/bundle.js +1216 -419
  3. package/dist/fn/_addLoader.js +21 -1
  4. package/dist/fn/abort.js +12 -3
  5. package/dist/fn/addColors.js +11 -3
  6. package/dist/fn/addInputs.js +9 -2
  7. package/dist/fn/addStyle.js +7 -3
  8. package/dist/fn/adjustSize.js +19 -6
  9. package/dist/fn/ajax.js +16 -5
  10. package/dist/fn/analyzeFunction.js +10 -1
  11. package/dist/fn/animateCss.js +8 -2
  12. package/dist/fn/arrayBuffer2String.js +3 -1
  13. package/dist/fn/arrayFromProp.js +7 -1
  14. package/dist/fn/autoExtend.js +2 -0
  15. package/dist/fn/br2nl.js +3 -1
  16. package/dist/fn/calendar.js +8 -1
  17. package/dist/fn/callback.js +4 -2
  18. package/dist/fn/camelToCss.js +7 -1
  19. package/dist/fn/canvasToImage.js +5 -1
  20. package/dist/fn/center.js +12 -1
  21. package/dist/fn/checkProps.js +3 -1
  22. package/dist/fn/checkPropsDetails.js +4 -1
  23. package/dist/fn/clone.js +3 -1
  24. package/dist/fn/colorToHex.js +5 -1
  25. package/dist/fn/compare.js +28 -15
  26. package/dist/fn/compareConditions.js +1 -0
  27. package/dist/fn/copy.js +8 -2
  28. package/dist/fn/correctCase.js +3 -1
  29. package/dist/fn/count.js +3 -1
  30. package/dist/fn/crc32.js +1 -1
  31. package/dist/fn/cssExists.js +2 -0
  32. package/dist/fn/dateSQL.js +6 -3
  33. package/dist/fn/deepPath.js +9 -7
  34. package/dist/fn/defaultAjaxAbortFunction.js +3 -1
  35. package/dist/fn/defaultAjaxErrorFunction.d.ts +1 -1
  36. package/dist/fn/defaultAjaxErrorFunction.js +15 -2
  37. package/dist/fn/defaultAlertFunction.d.ts +1 -1
  38. package/dist/fn/defaultAlertFunction.js +5 -1
  39. package/dist/fn/defaultEndLoadingFunction.d.ts +1 -1
  40. package/dist/fn/defaultEndLoadingFunction.js +19 -1
  41. package/dist/fn/defaultErrorFunction.js +3 -1
  42. package/dist/fn/defaultHistoryFunction.js +3 -1
  43. package/dist/fn/defaultLinkFunction.js +3 -1
  44. package/dist/fn/defaultPostLinkFunction.js +3 -1
  45. package/dist/fn/defaultPreLinkFunction.d.ts +1 -1
  46. package/dist/fn/defaultPreLinkFunction.js +11 -1
  47. package/dist/fn/defaultResizeFunction.js +3 -1
  48. package/dist/fn/defaultStartLoadingFunction.d.ts +1 -1
  49. package/dist/fn/defaultStartLoadingFunction.js +14 -1
  50. package/dist/fn/deleteProp.js +5 -1
  51. package/dist/fn/diffObj.js +20 -5
  52. package/dist/fn/download.js +4 -1
  53. package/dist/fn/downloadContent.js +12 -1
  54. package/dist/fn/eraseCookie.js +3 -1
  55. package/dist/fn/error.js +5 -1
  56. package/dist/fn/escapeRegExp.js +3 -1
  57. package/dist/fn/escapeUrl.js +3 -1
  58. package/dist/fn/extend.js +6 -1
  59. package/dist/fn/fdate.js +1 -0
  60. package/dist/fn/fdatetime.js +10 -1
  61. package/dist/fn/filter.js +10 -6
  62. package/dist/fn/filterToConditions.js +8 -2
  63. package/dist/fn/findAll.js +5 -3
  64. package/dist/fn/format.js +5 -1
  65. package/dist/fn/formatDate.js +3 -1
  66. package/dist/fn/formdata.js +7 -2
  67. package/dist/fn/ftime.js +3 -1
  68. package/dist/fn/getAllTags.js +3 -1
  69. package/dist/fn/getAttributes.js +3 -1
  70. package/dist/fn/getBrowserName.js +20 -10
  71. package/dist/fn/getBrowserVersion.js +21 -10
  72. package/dist/fn/getEventData.js +26 -6
  73. package/dist/fn/getField.js +1 -2
  74. package/dist/fn/getPath.js +14 -3
  75. package/dist/fn/getProp.js +5 -1
  76. package/dist/fn/getRequestId.js +5 -3
  77. package/dist/fn/getScrollBarSize.js +4 -1
  78. package/dist/fn/getText.js +3 -1
  79. package/dist/fn/happy.js +8 -1
  80. package/dist/fn/hash.js +2 -1
  81. package/dist/fn/hex2rgb.js +8 -1
  82. package/dist/fn/history.js +3 -1
  83. package/dist/fn/html2text.js +6 -1
  84. package/dist/fn/imageToCanvas.js +7 -1
  85. package/dist/fn/imgToBase64.js +4 -1
  86. package/dist/fn/info.js +9 -1
  87. package/dist/fn/init.js +72 -14
  88. package/dist/fn/isArray.d.ts +1 -1
  89. package/dist/fn/isArray.js +3 -3
  90. package/dist/fn/isBlob.d.ts +1 -1
  91. package/dist/fn/isBlob.js +3 -3
  92. package/dist/fn/isBoolean.d.ts +1 -1
  93. package/dist/fn/isBoolean.js +3 -3
  94. package/dist/fn/isCanvas.d.ts +1 -1
  95. package/dist/fn/isCanvas.js +3 -3
  96. package/dist/fn/isComment.d.ts +1 -1
  97. package/dist/fn/isComment.js +3 -3
  98. package/dist/fn/isCp.d.ts +1 -1
  99. package/dist/fn/isCp.js +3 -3
  100. package/dist/fn/isDate.d.ts +1 -1
  101. package/dist/fn/isDate.js +3 -3
  102. package/dist/fn/isDesktopDevice.js +3 -1
  103. package/dist/fn/isDom.d.ts +1 -1
  104. package/dist/fn/isDom.js +3 -3
  105. package/dist/fn/isEvent.d.ts +1 -1
  106. package/dist/fn/isEvent.js +3 -3
  107. package/dist/fn/isFocused.js +3 -1
  108. package/dist/fn/isFunction.d.ts +1 -1
  109. package/dist/fn/isFunction.js +3 -3
  110. package/dist/fn/isHostname.d.ts +1 -1
  111. package/dist/fn/isHostname.js +10 -5
  112. package/dist/fn/isIP.d.ts +1 -1
  113. package/dist/fn/isIP.js +10 -3
  114. package/dist/fn/isInside.js +6 -4
  115. package/dist/fn/isInt.d.ts +1 -1
  116. package/dist/fn/isInt.js +3 -3
  117. package/dist/fn/isIterable.js +3 -1
  118. package/dist/fn/isMobile.js +3 -1
  119. package/dist/fn/isMobileDevice.js +3 -1
  120. package/dist/fn/isNull.d.ts +1 -1
  121. package/dist/fn/isNull.js +3 -3
  122. package/dist/fn/isNumber.d.ts +1 -1
  123. package/dist/fn/isNumber.js +3 -3
  124. package/dist/fn/isObject.d.ts +1 -1
  125. package/dist/fn/isObject.js +3 -3
  126. package/dist/fn/isPercent.d.ts +1 -1
  127. package/dist/fn/isPercent.js +3 -3
  128. package/dist/fn/isPrimitive.d.ts +1 -1
  129. package/dist/fn/isPrimitive.js +3 -3
  130. package/dist/fn/isPromise.d.ts +1 -1
  131. package/dist/fn/isPromise.js +3 -3
  132. package/dist/fn/isPropSize.js +10 -4
  133. package/dist/fn/isSQLDate.d.ts +1 -1
  134. package/dist/fn/isSQLDate.js +5 -4
  135. package/dist/fn/isSame.js +7 -4
  136. package/dist/fn/isString.d.ts +1 -1
  137. package/dist/fn/isString.js +3 -3
  138. package/dist/fn/isSymbol.d.ts +1 -1
  139. package/dist/fn/isSymbol.js +3 -3
  140. package/dist/fn/isTabletDevice.js +3 -1
  141. package/dist/fn/isURL.d.ts +1 -1
  142. package/dist/fn/isURL.js +10 -1
  143. package/dist/fn/isValidDimension.js +3 -1
  144. package/dist/fn/isValidName.d.ts +1 -1
  145. package/dist/fn/isValidName.js +3 -3
  146. package/dist/fn/isValue.d.ts +1 -1
  147. package/dist/fn/isValue.js +3 -3
  148. package/dist/fn/isVue.d.ts +1 -1
  149. package/dist/fn/isVue.js +5 -5
  150. package/dist/fn/iterate.js +5 -3
  151. package/dist/fn/link.js +24 -3
  152. package/dist/fn/makeReactive.js +47 -11
  153. package/dist/fn/md5.js +12 -3
  154. package/dist/fn/money.js +26 -0
  155. package/dist/fn/nl2br.js +3 -1
  156. package/dist/fn/objectToFormData.js +8 -4
  157. package/dist/fn/order.js +3 -1
  158. package/dist/fn/percent.js +3 -1
  159. package/dist/fn/pickValue.js +5 -3
  160. package/dist/fn/post.js +8 -3
  161. package/dist/fn/printf.js +8 -1
  162. package/dist/fn/randomInt.js +3 -1
  163. package/dist/fn/randomString.js +9 -2
  164. package/dist/fn/removeExtraSpaces.js +3 -1
  165. package/dist/fn/repeat.js +7 -1
  166. package/dist/fn/replaceSelection.js +6 -0
  167. package/dist/fn/riterate.js +3 -1
  168. package/dist/fn/roundDecimal.js +3 -1
  169. package/dist/fn/search.js +17 -2
  170. package/dist/fn/selector.js +3 -1
  171. package/dist/fn/setNavigationVars.js +20 -2
  172. package/dist/fn/setProp.js +9 -1
  173. package/dist/fn/shorten.js +1 -1
  174. package/dist/fn/shuffle.js +6 -1
  175. package/dist/fn/simpleHash.js +5 -1
  176. package/dist/fn/simpleHash1.js +1 -1
  177. package/dist/fn/simpleHash2.js +1 -1
  178. package/dist/fn/startChrono.js +5 -3
  179. package/dist/fn/stat.js +4 -2
  180. package/dist/fn/stopChrono.js +7 -5
  181. package/dist/fn/string2ArrayBuffer.js +1 -1
  182. package/dist/fn/submit.js +12 -1
  183. package/dist/fn/sum.js +11 -3
  184. package/dist/fn/timestamp.js +4 -1
  185. package/dist/fn/toggleFullScreen.js +3 -1
  186. package/dist/fn/translate.js +6 -1
  187. package/dist/fn/treatAjaxArguments.js +8 -0
  188. package/dist/fn/uniqString.d.ts +1 -1
  189. package/dist/fn/uniqString.js +14 -11
  190. package/dist/fn/unique.js +5 -1
  191. package/dist/fn/upload.js +20 -9
  192. package/dist/fn/warning.js +10 -1
  193. package/dist/index.js +1 -1
  194. package/package.json +1 -1
@@ -1,2 +1,6 @@
1
- const defaultAlertFunction = function (text, title) { alert(text); };
1
+ const defaultAlertFunction = function (ele) {
2
+ /** @todo */
3
+ let c = appui.getCurrentContainer();
4
+ c.alert.apply(c, arguments);
5
+ };
2
6
  export { defaultAlertFunction };
@@ -1,2 +1,2 @@
1
- declare const defaultEndLoadingFunction: (url: any, data: any, res: any) => boolean;
1
+ declare const defaultEndLoadingFunction: (url: any, timestamp: any, data: any, res: any) => void;
2
2
  export { defaultEndLoadingFunction };
@@ -1,2 +1,20 @@
1
- const defaultEndLoadingFunction = function (url, data, res) { return true; };
1
+ import { numProperties } from './numProperties';
2
+ import { log } from './log';
3
+ import { isCp } from './isCp';
4
+ const defaultEndLoadingFunction = function (url, timestamp, data, res) {
5
+ var _a;
6
+ if (res && res.data && (numProperties(res.data) === 1) && res.data.disconnected) {
7
+ window.location.reload();
8
+ return;
9
+ }
10
+ if ((_a = window.appui) === null || _a === void 0 ? void 0 : _a.status) {
11
+ this.$nextTick(() => {
12
+ log("UPDATE LOADBAR");
13
+ const loadBar = this.getRef('loading');
14
+ if (isCp(loadBar)) {
15
+ loadBar.$updateAllComputed();
16
+ }
17
+ });
18
+ }
19
+ };
2
20
  export { defaultEndLoadingFunction };
@@ -1,3 +1,5 @@
1
1
  import { log } from './log';
2
- const defaultErrorFunction = function (message) { log(message); };
2
+ const defaultErrorFunction = function (message) {
3
+ log(message);
4
+ };
3
5
  export { defaultErrorFunction };
@@ -1,2 +1,4 @@
1
- const defaultHistoryFunction = function (obj) { return true; };
1
+ const defaultHistoryFunction = function (obj) {
2
+ return true;
3
+ };
2
4
  export { defaultHistoryFunction };
@@ -1,2 +1,4 @@
1
- const defaultLinkFunction = function (responseObj, ele) { return true; };
1
+ const defaultLinkFunction = function (responseObj, ele) {
2
+ return true;
3
+ };
2
4
  export { defaultLinkFunction };
@@ -1,2 +1,4 @@
1
- const defaultPostLinkFunction = function (r) { return true; };
1
+ const defaultPostLinkFunction = function (r) {
2
+ return true;
3
+ };
2
4
  export { defaultPostLinkFunction };
@@ -1,2 +1,2 @@
1
- declare const defaultPreLinkFunction: (url: any, ele: any) => boolean;
1
+ declare const defaultPreLinkFunction: (url: any) => boolean;
2
2
  export { defaultPreLinkFunction };
@@ -1,2 +1,12 @@
1
- const defaultPreLinkFunction = function (url, ele) { return true; };
1
+ import { isFunction } from './isFunction';
2
+ const defaultPreLinkFunction = function (url) {
3
+ let router = appui.getRef('router');
4
+ if (router) {
5
+ if (isFunction(router.route) && !router.disabled) {
6
+ router.route(url);
7
+ }
8
+ return false;
9
+ }
10
+ return true;
11
+ };
2
12
  export { defaultPreLinkFunction };
@@ -1,2 +1,4 @@
1
- const defaultResizeFunction = function () { return true; };
1
+ const defaultResizeFunction = function () {
2
+ return true;
3
+ };
2
4
  export { defaultResizeFunction };
@@ -1,2 +1,2 @@
1
- declare const defaultStartLoadingFunction: (url: any, data: any) => boolean;
1
+ declare const defaultStartLoadingFunction: () => void;
2
2
  export { defaultStartLoadingFunction };
@@ -1,2 +1,15 @@
1
- const defaultStartLoadingFunction = function (url, data) { return true; };
1
+ import { log } from './log';
2
+ import { isCp } from './isCp';
3
+ const defaultStartLoadingFunction = function () {
4
+ var _a;
5
+ if ((_a = window.appui) === null || _a === void 0 ? void 0 : _a.status) {
6
+ this.$nextTick(() => {
7
+ log("UPDATE LOADBAR");
8
+ const loadBar = this.getRef('loading');
9
+ if (isCp(loadBar)) {
10
+ loadBar.$updateAllComputed();
11
+ }
12
+ });
13
+ }
14
+ };
2
15
  export { defaultStartLoadingFunction };
@@ -1,2 +1,6 @@
1
- const deleteProp = function (obj, prop) { checkType(obj, "object", bbn._("The obj must be an object in setProp")); checkType(prop, "string", bbn._("The prop must be a string in setProp")); delete obj[prop]; };
1
+ const deleteProp = function (obj, prop) {
2
+ checkType(obj, "object", bbn._("The obj must be an object in setProp"));
3
+ checkType(prop, "string", bbn._("The prop must be a string in setProp"));
4
+ delete obj[prop];
5
+ };
2
6
  export { deleteProp };
@@ -12,7 +12,9 @@ const diffObj = function (obj1, obj2, unchanged, notRoot) {
12
12
  if (value1 === value2) {
13
13
  return VALUE_UNCHANGED;
14
14
  }
15
- if (isDate(value1) && isDate(value2) && (value1.getTime() === value2.getTime())) {
15
+ if (isDate(value1) &&
16
+ isDate(value2) &&
17
+ (value1.getTime() === value2.getTime())) {
16
18
  return VALUE_UNCHANGED;
17
19
  }
18
20
  if ('undefined' == typeof (value1)) {
@@ -32,11 +34,23 @@ const diffObj = function (obj1, obj2, unchanged, notRoot) {
32
34
  let res = _compareValues(obj1, obj2);
33
35
  if (unchanged || (res !== VALUE_UNCHANGED)) {
34
36
  let ret = createObject();
35
- Object.defineProperty(ret, 'type', { value: res, enumerable: false });
36
- Object.defineProperty(ret, 'data', { value: (obj1 === undefined) ? obj2 : obj1, enumerable: false });
37
- Object.defineProperty(ret, '_bbnDiffObjProof', { value: true, enumerable: false });
37
+ Object.defineProperty(ret, 'type', {
38
+ value: res,
39
+ enumerable: false
40
+ });
41
+ Object.defineProperty(ret, 'data', {
42
+ value: (obj1 === undefined) ? obj2 : obj1,
43
+ enumerable: false
44
+ });
45
+ Object.defineProperty(ret, '_bbnDiffObjProof', {
46
+ value: true,
47
+ enumerable: false
48
+ });
38
49
  if (obj1 !== undefined) {
39
- Object.defineProperty(ret, 'newData', { value: obj2, enumerable: false });
50
+ Object.defineProperty(ret, 'newData', {
51
+ value: obj2,
52
+ enumerable: false
53
+ });
40
54
  }
41
55
  return ret;
42
56
  }
@@ -46,6 +60,7 @@ const diffObj = function (obj1, obj2, unchanged, notRoot) {
46
60
  return false;
47
61
  }
48
62
  if (diffObjProcessed.includes(obj1) || diffObjProcessed.includes(obj2)) {
63
+ //error(bbn._("Can't compare objects because they contain circular references"));
49
64
  return false;
50
65
  }
51
66
  diffObjProcessed.push(obj1, obj2);
@@ -7,6 +7,7 @@ import { fileExt } from './fileExt';
7
7
  import { downloadContent } from './downloadContent';
8
8
  import { defaultAjaxErrorFunction } from './defaultAjaxErrorFunction';
9
9
  const download = function (url, filename, params) {
10
+ // We can intervert the arguments
10
11
  if (isObject(filename)) {
11
12
  params = filename;
12
13
  filename = null;
@@ -30,6 +31,8 @@ const download = function (url, filename, params) {
30
31
  }
31
32
  }
32
33
  defaultAjaxErrorFunction(e);
33
- }, e => { defaultAjaxErrorFunction(e); });
34
+ }, e => {
35
+ defaultAjaxErrorFunction(e);
36
+ });
34
37
  };
35
38
  export { download };
@@ -4,7 +4,16 @@ import { isString } from './isString';
4
4
  import { log } from './log';
5
5
  const downloadContent = function (filename, content, type) {
6
6
  if (isCanvas(content)) {
7
- content.toBlob((blob) => { let a = document.createElement('a'); a.download = filename; a.href = window.URL.createObjectURL(blob); a.className = 'bbn-no'; a.click(); window.URL.revokeObjectURL(a.href); }, type || 'image/png');
7
+ content.toBlob((blob) => {
8
+ // blob ready, download it
9
+ let a = document.createElement('a');
10
+ a.download = filename;
11
+ a.href = window.URL.createObjectURL(blob);
12
+ a.className = 'bbn-no';
13
+ a.click();
14
+ // delete the internal blob reference, to let the browser clear memory from it
15
+ window.URL.revokeObjectURL(a.href);
16
+ }, type || 'image/png');
8
17
  return;
9
18
  }
10
19
  if (!type) {
@@ -29,9 +38,11 @@ const downloadContent = function (filename, content, type) {
29
38
  }
30
39
  a.href = window.URL.createObjectURL(src);
31
40
  a.download = filename;
41
+ // Append anchor to body.
32
42
  document.body.appendChild(a);
33
43
  a.click();
34
44
  window.URL.revokeObjectURL(a.href);
45
+ // Remove anchor from body
35
46
  document.body.removeChild(a);
36
47
  };
37
48
  export { downloadContent };
@@ -1,2 +1,4 @@
1
- const eraseCookie = function (name) { document.cookie = name + '=; Max-Age=-99999999;'; };
1
+ const eraseCookie = function (name) {
2
+ document.cookie = name + '=; Max-Age=-99999999;';
3
+ };
2
4
  export { eraseCookie };
package/dist/fn/error.js CHANGED
@@ -5,7 +5,11 @@ const error = function (errorMsg) {
5
5
  for (let i = 1; i < arguments.length; i++) {
6
6
  args.push(arguments[i]);
7
7
  }
8
- args.unshift({ _bbn_console_mode: "error", _bbn_console_level: 1, _bbn_console_style: "color: #E64141; background: #F7E195; font-size: 14px" });
8
+ args.unshift({
9
+ _bbn_console_mode: "error",
10
+ _bbn_console_level: 1,
11
+ _bbn_console_style: "color: #E64141; background: #F7E195; font-size: 14px"
12
+ });
9
13
  log.apply(this, args);
10
14
  }
11
15
  throw new Error(errorMsg);
@@ -1,2 +1,4 @@
1
- const escapeRegExp = function (str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); };
1
+ const escapeRegExp = function (str) {
2
+ return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
3
+ };
2
4
  export { escapeRegExp };
@@ -14,7 +14,9 @@ const escapeUrl = function (url, params) {
14
14
  st += '://';
15
15
  url = url.substring(3);
16
16
  }
17
- each(dirName(url).split('/'), a => { st += encodeURIComponent(a) + '/'; });
17
+ each(dirName(url).split('/'), a => {
18
+ st += encodeURIComponent(a) + '/';
19
+ });
18
20
  let base = baseName(url);
19
21
  let sep = '?';
20
22
  let existingParams = '';
package/dist/fn/extend.js CHANGED
@@ -58,7 +58,12 @@ const extend = function () {
58
58
  }
59
59
  });
60
60
  if (args[i].__bbnNoData) {
61
- Object.defineProperty(out, '__bbnNoData', { value: true, enumerable: false, configurable: false, writable: false });
61
+ Object.defineProperty(out, '__bbnNoData', {
62
+ value: true,
63
+ enumerable: false,
64
+ configurable: false,
65
+ writable: false
66
+ });
62
67
  }
63
68
  }
64
69
  return out;
package/dist/fn/fdate.js CHANGED
@@ -3,6 +3,7 @@ import { date } from './date';
3
3
  import { isDate } from './isDate';
4
4
  import { isString } from './isString';
5
5
  const fdate = function (d, wrong_result) {
6
+ // Retro compatibility
6
7
  if (wrong_result === true) {
7
8
  return fdatetime(d);
8
9
  }
@@ -7,7 +7,16 @@ const fdatetime = function (d, wrong_result) {
7
7
  return wrong_result && isString(wrong_result) ? wrong_result : '';
8
8
  }
9
9
  if (undefined !== dayjs) {
10
- return dayjs(r).calendar(null, { sameDay: '[' + bbn._('Today') + '] HH:mm', nextDay: '[' + bbn._('Tomorrow') + '] HH:mm', nextWeek: 'ddd D HH:mm', lastDay: '[' + bbn._('Yesterday') + '] HH:mm', lastWeek: 'ddd D HH:mm', sameElse: 'DD/MM/YYYY HH:mm' });
10
+ //return dayjs(r).format('lll');
11
+ return dayjs(r).calendar(null, {
12
+ sameDay: '[' + bbn._('Today') + '] HH:mm',
13
+ nextDay: '[' + bbn._('Tomorrow') + '] HH:mm',
14
+ nextWeek: 'ddd D HH:mm',
15
+ lastDay: '[' + bbn._('Yesterday') + '] HH:mm',
16
+ lastWeek: 'ddd D HH:mm',
17
+ sameElse: 'DD/MM/YYYY HH:mm'
18
+ });
19
+ //return dayjs(r).format("DD/MM/YYYY HH:mm")
11
20
  }
12
21
  return r.toLocaleDateString();
13
22
  };
package/dist/fn/filter.js CHANGED
@@ -24,16 +24,20 @@ const filter = function (arr, prop, val, operator) {
24
24
  throw new Error("Search function error: The prop argument should be a string or an object");
25
25
  }
26
26
  if (isFn) {
27
- each(arr, (a, i) => { if (filter(a, i)) {
28
- res.push(a);
29
- } });
27
+ each(arr, (a, i) => {
28
+ if (filter(a, i)) {
29
+ res.push(a);
30
+ }
31
+ });
30
32
  }
31
33
  else {
32
34
  filter = filterToConditions(filter, operator);
33
35
  if (filter.conditions && filter.logic) {
34
- each(arr, (a) => { if (compareConditions(a, filter)) {
35
- res.push(a);
36
- } });
36
+ each(arr, (a) => {
37
+ if (compareConditions(a, filter)) {
38
+ res.push(a);
39
+ }
40
+ });
37
41
  }
38
42
  }
39
43
  return res;
@@ -12,10 +12,16 @@ const filterToConditions = function (filter, operator) {
12
12
  tmp.push(filterToConditions(a));
13
13
  }
14
14
  else {
15
- tmp.push({ field: n, operator: operator || '=', value: a });
15
+ tmp.push({
16
+ field: n,
17
+ operator: operator || '=',
18
+ value: a
19
+ });
16
20
  }
17
21
  });
18
- filter = { conditions: tmp };
22
+ filter = {
23
+ conditions: tmp
24
+ };
19
25
  }
20
26
  if (!filter.logic) {
21
27
  filter.logic = 'AND';
@@ -8,9 +8,11 @@ const findAll = function (arr, filter, deepProperty, res = []) {
8
8
  res.push(arr[idx]);
9
9
  start = idx + 1;
10
10
  }
11
- each(arr, it => { if (isArray(it[deepProperty])) {
12
- findAll(it[deepProperty], filter, deepProperty, res);
13
- } });
11
+ each(arr, it => {
12
+ if (isArray(it[deepProperty])) {
13
+ findAll(it[deepProperty], filter, deepProperty, res);
14
+ }
15
+ });
14
16
  return res;
15
17
  };
16
18
  export { findAll };
package/dist/fn/format.js CHANGED
@@ -3,7 +3,11 @@ const format = function (str) {
3
3
  let args = Array.prototype.slice.call(arguments, 1);
4
4
  if (args.length) {
5
5
  let i = 0;
6
- return str.replace(/\%([d|s])/g, (match, type) => { let tmp = args[i++]; checkType(tmp, type === 'd' ? 'number' : 'string', bbn._("The value doesn't correspond to the format")); return tmp; });
6
+ return str.replace(/\%([d|s])/g, (match, type) => {
7
+ let tmp = args[i++];
8
+ checkType(tmp, type === 'd' ? 'number' : 'string', bbn._("The value doesn't correspond to the format"));
9
+ return tmp;
10
+ });
7
11
  }
8
12
  return str;
9
13
  };
@@ -1,2 +1,4 @@
1
- const formatDate = function (date, format) { return dayjs(date).format(format); };
1
+ const formatDate = function (date, format) {
2
+ return dayjs(date).format(format);
3
+ };
2
4
  export { formatDate };
@@ -11,12 +11,16 @@ const formdata = function (form) {
11
11
  v = fieldValue(input);
12
12
  if ((v !== undefined) && !input.disabled) {
13
13
  let name = input.name;
14
- if ((name.indexOf("[]") === -1) && (name.indexOf("[") > -1) && (name.indexOf("]") > -1) && (name.lastIndexOf("]") === name.length - 1)) {
14
+ if ((name.indexOf("[]") === -1) &&
15
+ (name.indexOf("[") > -1) &&
16
+ (name.indexOf("]") > -1) &&
17
+ (name.lastIndexOf("]") === name.length - 1)) {
15
18
  name = replaceAll("][", ".", name);
16
19
  name = replaceAll("[", ".", name);
17
20
  name = replaceAll("]", "", name);
18
21
  }
19
- if ((name.length > 2) && (name.indexOf("[]") === (name.length - 2))) {
22
+ if ((name.length > 2) &&
23
+ (name.indexOf("[]") === (name.length - 2))) {
20
24
  n = substr(name, 0, name.length - 2);
21
25
  if (res[n] === undefined) {
22
26
  res[n] = [];
@@ -43,6 +47,7 @@ const formdata = function (form) {
43
47
  }
44
48
  }
45
49
  });
50
+ // return num_changes ? res : false;
46
51
  return res;
47
52
  };
48
53
  export { formdata };
package/dist/fn/ftime.js CHANGED
@@ -7,7 +7,9 @@ const ftime = function (d, wrong_result) {
7
7
  return wrong_result && isString(wrong_result) ? wrong_result : '';
8
8
  }
9
9
  if (undefined !== dayjs) {
10
- return dayjs(r).calendar({ sameElse: 'D/M/YY HH:mm' });
10
+ return dayjs(r).calendar({
11
+ sameElse: 'D/M/YY HH:mm'
12
+ });
11
13
  }
12
14
  return r.toLocaleDateString();
13
15
  };
@@ -1,3 +1,5 @@
1
1
  import { unique } from './unique';
2
- const getAllTags = function () { return unique(Array.prototype.map.apply(document.all, [a => a.tagName.toLowerCase()])); };
2
+ const getAllTags = function () {
3
+ return unique(Array.prototype.map.apply(document.all, [a => a.tagName.toLowerCase()]));
4
+ };
3
5
  export { getAllTags };
@@ -4,7 +4,9 @@ const getAttributes = function (ele) {
4
4
  error("The element is not a proper HTML Element");
5
5
  }
6
6
  let res = Object.create(null);
7
- ele.getAttributeNames().forEach(name => { res[name] = ele.getAttribute(name); });
7
+ ele.getAttributeNames().forEach(name => {
8
+ res[name] = ele.getAttribute(name);
9
+ });
8
10
  return res;
9
11
  };
10
12
  export { getAttributes };
@@ -1,11 +1,21 @@
1
- const getBrowserName = function () { const userAgent = navigator.userAgent.toLowerCase(); switch (true) {
2
- case userAgent.includes('edge'):
3
- case userAgent.includes('edg/'): return "Edge";
4
- case userAgent.includes('opr') && !!window.opr: return "Opera";
5
- case userAgent.includes('chrome') && !!window.chrome: return "Chrome";
6
- case userAgent.includes('trident'): return "Internet Explorer";
7
- case userAgent.includes('firefox'): return "Firefox";
8
- case userAgent.includes('safari'): return "Safari";
9
- default: return "Other";
10
- } };
1
+ const getBrowserName = function () {
2
+ const userAgent = navigator.userAgent.toLowerCase();
3
+ switch (true) {
4
+ case userAgent.includes('edge'):
5
+ case userAgent.includes('edg/'):
6
+ return "Edge";
7
+ case userAgent.includes('opr') && !!window.opr:
8
+ return "Opera";
9
+ case userAgent.includes('chrome') && !!window.chrome:
10
+ return "Chrome";
11
+ case userAgent.includes('trident'):
12
+ return "Internet Explorer";
13
+ case userAgent.includes('firefox'):
14
+ return "Firefox";
15
+ case userAgent.includes('safari'):
16
+ return "Safari";
17
+ default:
18
+ return "Other";
19
+ }
20
+ };
11
21
  export { getBrowserName };
@@ -1,11 +1,22 @@
1
- const getBrowserVersion = function () { const userAgent = navigator.userAgent.toLowerCase(); switch (true) {
2
- case userAgent.includes('edge/'): return userAgent.split('edge/')[1].split(' ')[0];
3
- case userAgent.includes('edg/'): return userAgent.split('edg/')[1].split(' ')[0];
4
- case userAgent.includes('opr/') && !!window.opr: return userAgent.split('opr/')[1].split(' ')[0];
5
- case userAgent.includes('chrome/') && !!window.chrome: return userAgent.split('chrome/')[1].split(' ')[0];
6
- case userAgent.includes('trident/'): return userAgent.split('trident/')[1].split(' ')[0];
7
- case userAgent.includes('firefox/'): return userAgent.split('firefox/')[1].split(' ')[0];
8
- case userAgent.includes('safari/'): return userAgent.split('version/')[1].split(' ')[0];
9
- default: return '';
10
- } };
1
+ const getBrowserVersion = function () {
2
+ const userAgent = navigator.userAgent.toLowerCase();
3
+ switch (true) {
4
+ case userAgent.includes('edge/'):
5
+ return userAgent.split('edge/')[1].split(' ')[0];
6
+ case userAgent.includes('edg/'):
7
+ return userAgent.split('edg/')[1].split(' ')[0];
8
+ case userAgent.includes('opr/') && !!window.opr:
9
+ return userAgent.split('opr/')[1].split(' ')[0];
10
+ case userAgent.includes('chrome/') && !!window.chrome:
11
+ return userAgent.split('chrome/')[1].split(' ')[0];
12
+ case userAgent.includes('trident/'):
13
+ return userAgent.split('trident/')[1].split(' ')[0];
14
+ case userAgent.includes('firefox/'):
15
+ return userAgent.split('firefox/')[1].split(' ')[0];
16
+ case userAgent.includes('safari/'):
17
+ return userAgent.split('version/')[1].split(' ')[0];
18
+ default:
19
+ return '';
20
+ }
21
+ };
11
22
  export { getBrowserVersion };
@@ -10,12 +10,21 @@ const getEventData = function (e) {
10
10
  let sel = window.getSelection();
11
11
  res.raw = sel.toString();
12
12
  let html = getHTMLOfSelection();
13
- res.str.push({ type: 'text/plain', data: res.raw });
13
+ res.str.push({
14
+ type: 'text/plain',
15
+ data: res.raw
16
+ });
14
17
  if (html !== res.raw) {
15
- res.str.push({ type: 'text/html', data: html });
18
+ res.str.push({
19
+ type: 'text/html',
20
+ data: html
21
+ });
16
22
  }
17
23
  else if (res.raw.trim().indexOf('<') === 0) {
18
- res.str.push({ type: 'text/html', data: "<meta charset='utf-8'><code style=\"white-space: pre; font-family: 'Courier New', sans-serif\">\n" + res.raw + "\n</code>" });
24
+ res.str.push({
25
+ type: 'text/html',
26
+ data: "<meta charset='utf-8'><code style=\"white-space: pre; font-family: 'Courier New', sans-serif\">\n" + res.raw + "\n</code>"
27
+ });
19
28
  }
20
29
  done = true;
21
30
  ok(res);
@@ -39,7 +48,13 @@ const getEventData = function (e) {
39
48
  if (blob) {
40
49
  done = true;
41
50
  num--;
42
- res.files.push({ type: type, data: blob, name: name, size: size, mdate: lastModified });
51
+ res.files.push({
52
+ type: type,
53
+ data: blob,
54
+ name: name,
55
+ size: size,
56
+ mdate: lastModified
57
+ });
43
58
  strings.push(name);
44
59
  if (!num) {
45
60
  if (!res.raw) {
@@ -56,7 +71,10 @@ const getEventData = function (e) {
56
71
  done = true;
57
72
  item.getAsString((data) => {
58
73
  num--;
59
- res.str.push({ type: type, data: data });
74
+ res.str.push({
75
+ type: type,
76
+ data: data
77
+ });
60
78
  if (type === 'text/plain') {
61
79
  strings.push(name);
62
80
  }
@@ -71,7 +89,9 @@ const getEventData = function (e) {
71
89
  });
72
90
  }
73
91
  if (!done) {
74
- setTimeout(() => { ok(res); });
92
+ setTimeout(() => {
93
+ ok(res);
94
+ });
75
95
  }
76
96
  });
77
97
  return p;
@@ -1,7 +1,6 @@
1
- import { getRow } from './getRow';
2
1
  const getField = function (arr, field, prop, val, operator) {
3
2
  var r;
4
- if (field && (r = getRow(arr, prop, val, operator))) {
3
+ if (field && (r = bbn.fn.getRow(arr, prop, val, operator))) {
5
4
  return r[field];
6
5
  }
7
6
  return undefined;
@@ -1,7 +1,10 @@
1
1
  import { replaceAll } from './replaceAll';
2
2
  const getPath = function (element) {
3
- let path, node = element, done = false;
3
+ let path,
4
+ //node = $(element),
5
+ node = element, done = false;
4
6
  while (node.length) {
7
+ //let realNode = node[0],
5
8
  let realNode = node, name = realNode.localName;
6
9
  if (!name)
7
10
  break;
@@ -16,9 +19,17 @@ const getPath = function (element) {
16
19
  }
17
20
  done = 1;
18
21
  }
19
- let parent = node.parentNode, sameTagSiblings = parent.children.filter(val => { return val.tagName === name; });
22
+ //var parent = node.parent(),
23
+ let parent = node.parentNode,
24
+ //sameTagSiblings = parent.children(name);
25
+ sameTagSiblings = parent.children.filter(val => {
26
+ return val.tagName === name;
27
+ });
20
28
  if (sameTagSiblings.length > 1) {
21
- let allSiblings = parent.children, index = allSiblings.indexOf(realNode) + 1;
29
+ //var allSiblings = parent.children(),
30
+ let allSiblings = parent.children,
31
+ //index = allSiblings.index(realNode) + 1;
32
+ index = allSiblings.indexOf(realNode) + 1;
22
33
  if (index > 1) {
23
34
  name += ':nth-child(' + index + ')';
24
35
  }
@@ -1,2 +1,6 @@
1
- const getProp = function (obj, prop) { checkType(obj, "object", bbn._("The obj must be an object in setProp")); checkType(prop, "string", bbn._("The prop must be a string in setProp")); return obj[prop]; };
1
+ const getProp = function (obj, prop) {
2
+ checkType(obj, "object", bbn._("The obj must be an object in setProp"));
3
+ checkType(prop, "string", bbn._("The prop must be a string in setProp"));
4
+ return obj[prop];
5
+ };
2
6
  export { getProp };