@bbn/bbn 1.0.71 → 1.0.73

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  const $ = (selector, context) => {
2
- if (context?.querySelectorAll) {
2
+ if (context === null || context === void 0 ? void 0 : context.querySelectorAll) {
3
3
  return context.querySelectorAll(selector);
4
4
  }
5
5
  return document.body.querySelectorAll(selector);
package/dist/bundle.d.ts CHANGED
@@ -3918,7 +3918,7 @@ declare module "fn/object/multiorder" {
3918
3918
  * @param {Array|Object} orders The properties and directions (asc, desc) to order by
3919
3919
  * @returns {Array} The same array (arr), ordered differently
3920
3920
  */
3921
- const multiorder: (arr: object[], orders: object | BbnOrderItem[]) => object[];
3921
+ const multiorder: (arr: object[], orders: any) => object[];
3922
3922
  export { multiorder };
3923
3923
  }
3924
3924
  declare module "fn/string/nl2br" {
@@ -4828,7 +4828,7 @@ declare module "fn" {
4828
4828
  md5: (st: any) => string;
4829
4829
  money: (val: number, kilo?: boolean, currency?: string, novalue?: string | false, decimal?: string, thousands?: string, precision?: number) => string;
4830
4830
  move: (arr: any[], fromIndex: number, toIndex: number) => any[];
4831
- multiorder: (arr: object[], orders: object | BbnOrderItem[]) => object[];
4831
+ multiorder: (arr: object[], orders: any) => object[];
4832
4832
  nl2br: (st: any, keepNl: any) => string;
4833
4833
  numProperties: (obj: object) => number;
4834
4834
  objectToFormData: (obj: object, key?: string, ignoreList?: string[]) => FormData;
package/dist/bundle.js CHANGED
@@ -506,6 +506,7 @@
506
506
  }
507
507
  const typesList = [];
508
508
  (0, each_1.each)(type, (t) => {
509
+ var _a;
509
510
  if (t === String) {
510
511
  t = 'string';
511
512
  }
@@ -525,7 +526,7 @@
525
526
  t = 'function';
526
527
  }
527
528
  if ((0, isFunction_2.isFunction)(t)) {
528
- typesList.push(t.name || t.constructor?.name || t.toString());
529
+ typesList.push(t.name || ((_a = t.constructor) === null || _a === void 0 ? void 0 : _a.name) || t.toString());
529
530
  if (value instanceof t) {
530
531
  ok = true;
531
532
  return false;
@@ -585,7 +586,7 @@
585
586
  Object.defineProperty(exports, "__esModule", { value: true });
586
587
  exports.$ = void 0;
587
588
  const $ = (selector, context) => {
588
- if (context?.querySelectorAll) {
589
+ if (context === null || context === void 0 ? void 0 : context.querySelectorAll) {
589
590
  return context.querySelectorAll(selector);
590
591
  }
591
592
  return document.body.querySelectorAll(selector);
@@ -820,7 +821,8 @@
820
821
  this.selectOne = (table, field, where, order, start, limit) => {
821
822
  return new Promise(resolve => {
822
823
  this.select(table, [field], where, order, start, limit).then(d => {
823
- resolve(d[field] ?? undefined);
824
+ var _a;
825
+ resolve((_a = d[field]) !== null && _a !== void 0 ? _a : undefined);
824
826
  });
825
827
  });
826
828
  };
@@ -910,7 +912,8 @@
910
912
  });
911
913
  },
912
914
  add(database, name, structure) {
913
- if (structure?.keys?.PRIMARY && structure?.fields) {
915
+ var _a;
916
+ if (((_a = structure === null || structure === void 0 ? void 0 : structure.keys) === null || _a === void 0 ? void 0 : _a.PRIMARY) && (structure === null || structure === void 0 ? void 0 : structure.fields)) {
914
917
  if (!db._structures[database]) {
915
918
  db._structures[database] = {};
916
919
  }
@@ -1364,13 +1367,14 @@
1364
1367
  Object.defineProperty(exports, "__esModule", { value: true });
1365
1368
  exports.isCp = void 0;
1366
1369
  const isCp = function (...args) {
1370
+ var _a;
1367
1371
  if (!args.length) {
1368
1372
  return false;
1369
1373
  }
1370
1374
  if ('cp' in bbn && 'isComponent' in bbn['cp'] && (typeof bbn['cp'].isComponent === 'function')) {
1371
1375
  for (let a of args) {
1372
1376
  let res = bbn.cp.isComponent(a);
1373
- if (!res || (0, isDom_1.isDom)(a) || !a.$el?.bbnCid) {
1377
+ if (!res || (0, isDom_1.isDom)(a) || !((_a = a.$el) === null || _a === void 0 ? void 0 : _a.bbnCid)) {
1374
1378
  return false;
1375
1379
  }
1376
1380
  }
@@ -3064,7 +3068,7 @@
3064
3068
  "use strict";
3065
3069
  Object.defineProperty(exports, "__esModule", { value: true });
3066
3070
  exports.defaultAjaxAbortFunction = void 0;
3067
- const defaultAjaxAbortFunction = function (message, url = '') {
3071
+ const defaultAjaxAbortFunction = function (message, url = "") {
3068
3072
  (0, log_10.log)(message);
3069
3073
  };
3070
3074
  exports.defaultAjaxAbortFunction = defaultAjaxAbortFunction;
@@ -3171,7 +3175,7 @@
3171
3175
  let requestId = (0, getRequestId_1.getRequestId)(url, data, datatype);
3172
3176
  let loaderObj = (0, getLoader_2.getLoader)(requestId);
3173
3177
  //log("IN AJAX", loaderObj? loaderObj.loader : "NO LOADER")
3174
- if (loaderObj?.loader) {
3178
+ if (loaderObj === null || loaderObj === void 0 ? void 0 : loaderObj.loader) {
3175
3179
  return loaderObj.loader;
3176
3180
  }
3177
3181
  if (bbn.env.token) {
@@ -5008,7 +5012,7 @@
5008
5012
  return (0, ajax_1.ajax)(url, 'blob', params || { _bbn_download: 1 }, (d, headers) => {
5009
5013
  if (!filename) {
5010
5014
  let cd = 'attachment; filename=';
5011
- if (headers?.['content-disposition'] && headers['content-disposition'].indexOf(cd) === 0) {
5015
+ if ((headers === null || headers === void 0 ? void 0 : headers['content-disposition']) && headers['content-disposition'].indexOf(cd) === 0) {
5012
5016
  filename = (0, substr_7.substr)(headers['content-disposition'], cd.length + 1, headers['content-disposition'].length - cd.length - 2);
5013
5017
  }
5014
5018
  else {
@@ -7869,7 +7873,7 @@
7869
7873
  Object.defineProperty(exports, "__esModule", { value: true });
7870
7874
  exports.makeReactive = void 0;
7871
7875
  const makeReactive = function (obj, onSet, parent, parentProp) {
7872
- const parentString = parent?.$cid || '';
7876
+ const parentString = (parent === null || parent === void 0 ? void 0 : parent.$cid) || '';
7873
7877
  const prefix = '__bbn_' + (parentString ? parentString + '_' : '');
7874
7878
  if (obj && typeof obj === 'object' && [undefined, Object, Array].includes(obj.constructor)) {
7875
7879
  if (obj.__bbnIsProxy && obj.__bbnParent === parent) {
@@ -7910,7 +7914,7 @@
7910
7914
  }
7911
7915
  if (key === '__bbnRoot') {
7912
7916
  let root = obj;
7913
- while (root && root?.__bbnTarget) {
7917
+ while (root && (root === null || root === void 0 ? void 0 : root.__bbnTarget)) {
7914
7918
  root = root.__bbnTarget;
7915
7919
  }
7916
7920
  return root;
@@ -10027,7 +10031,7 @@
10027
10031
  Object.defineProperty(exports, "__cjsModule", { value: true });
10028
10032
  Object.defineProperty(exports, "default", { value: require(name) });
10029
10033
  }
10030
- catch {
10034
+ catch (_a) {
10031
10035
  throw Error(['module "', name, '" not found.'].join(''));
10032
10036
  }
10033
10037
  };
package/dist/db.js CHANGED
@@ -78,7 +78,8 @@ const dbObject = function (dbName) {
78
78
  this.selectOne = (table, field, where, order, start, limit) => {
79
79
  return new Promise(resolve => {
80
80
  this.select(table, [field], where, order, start, limit).then(d => {
81
- resolve(d[field] ?? undefined);
81
+ var _a;
82
+ resolve((_a = d[field]) !== null && _a !== void 0 ? _a : undefined);
82
83
  });
83
84
  });
84
85
  };
@@ -168,7 +169,8 @@ const db = {
168
169
  });
169
170
  },
170
171
  add(database, name, structure) {
171
- if (structure?.keys?.PRIMARY && structure?.fields) {
172
+ var _a;
173
+ if (((_a = structure === null || structure === void 0 ? void 0 : structure.keys) === null || _a === void 0 ? void 0 : _a.PRIMARY) && (structure === null || structure === void 0 ? void 0 : structure.fields)) {
172
174
  if (!db._structures[database]) {
173
175
  db._structures[database] = {};
174
176
  }
@@ -100,7 +100,7 @@ const ajax = function (url, datatype, data, success, failure, abort) {
100
100
  let requestId = getRequestId(url, data, datatype);
101
101
  let loaderObj = getLoader(requestId);
102
102
  //log("IN AJAX", loaderObj? loaderObj.loader : "NO LOADER")
103
- if (loaderObj?.loader) {
103
+ if (loaderObj === null || loaderObj === void 0 ? void 0 : loaderObj.loader) {
104
104
  return loaderObj.loader;
105
105
  }
106
106
  if (bbn.env.token) {
@@ -42,7 +42,7 @@ const download = function (url, filename, params) {
42
42
  return ajax(url, 'blob', params || { _bbn_download: 1 }, (d, headers) => {
43
43
  if (!filename) {
44
44
  let cd = 'attachment; filename=';
45
- if (headers?.['content-disposition'] && headers['content-disposition'].indexOf(cd) === 0) {
45
+ if ((headers === null || headers === void 0 ? void 0 : headers['content-disposition']) && headers['content-disposition'].indexOf(cd) === 0) {
46
46
  filename = substr(headers['content-disposition'], cd.length + 1, headers['content-disposition'].length - cd.length - 2);
47
47
  }
48
48
  else {
@@ -1,5 +1,5 @@
1
- import { log } from '../browser/log';
2
- const defaultAjaxAbortFunction = function (message, url = '') {
1
+ import { log } from "../browser/log";
2
+ const defaultAjaxAbortFunction = function (message, url = "") {
3
3
  log(message);
4
4
  };
5
5
  export { defaultAjaxAbortFunction };
@@ -7,7 +7,7 @@ import { warning } from '../browser/warning';
7
7
  import { isFunction } from '../type/isFunction';
8
8
  import { isSame } from '../type/isSame';
9
9
  const makeReactive = function (obj, onSet, parent, parentProp) {
10
- const parentString = parent?.$cid || '';
10
+ const parentString = (parent === null || parent === void 0 ? void 0 : parent.$cid) || '';
11
11
  const 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) {
@@ -48,7 +48,7 @@ const makeReactive = function (obj, onSet, parent, parentProp) {
48
48
  }
49
49
  if (key === '__bbnRoot') {
50
50
  let root = obj;
51
- while (root && root?.__bbnTarget) {
51
+ while (root && (root === null || root === void 0 ? void 0 : root.__bbnTarget)) {
52
52
  root = root.__bbnTarget;
53
53
  }
54
54
  return root;
@@ -36,5 +36,5 @@
36
36
  * @param {Array|Object} orders The properties and directions (asc, desc) to order by
37
37
  * @returns {Array} The same array (arr), ordered differently
38
38
  */
39
- declare const multiorder: (arr: object[], orders: object | BbnOrderItem[]) => object[];
39
+ declare const multiorder: (arr: object[], orders: any) => object[];
40
40
  export { multiorder };
@@ -12,6 +12,7 @@ const checkType = function (value, type, msg, ...logs) {
12
12
  }
13
13
  const typesList = [];
14
14
  each(type, (t) => {
15
+ var _a;
15
16
  if (t === String) {
16
17
  t = 'string';
17
18
  }
@@ -31,7 +32,7 @@ const checkType = function (value, type, msg, ...logs) {
31
32
  t = 'function';
32
33
  }
33
34
  if (isFunction(t)) {
34
- typesList.push(t.name || t.constructor?.name || t.toString());
35
+ typesList.push(t.name || ((_a = t.constructor) === null || _a === void 0 ? void 0 : _a.name) || t.toString());
35
36
  if (value instanceof t) {
36
37
  ok = true;
37
38
  return false;
@@ -1,12 +1,13 @@
1
1
  import { isDom } from './isDom';
2
2
  const isCp = function (...args) {
3
+ var _a;
3
4
  if (!args.length) {
4
5
  return false;
5
6
  }
6
7
  if ('cp' in bbn && 'isComponent' in bbn['cp'] && (typeof bbn['cp'].isComponent === 'function')) {
7
8
  for (let a of args) {
8
9
  let res = bbn.cp.isComponent(a);
9
- if (!res || isDom(a) || !a.$el?.bbnCid) {
10
+ if (!res || isDom(a) || !((_a = a.$el) === null || _a === void 0 ? void 0 : _a.bbnCid)) {
10
11
  return false;
11
12
  }
12
13
  }
package/dist/fn.d.ts CHANGED
@@ -181,7 +181,7 @@ declare const fn: {
181
181
  md5: (st: any) => string;
182
182
  money: (val: number, kilo?: boolean, currency?: string, novalue?: string | false, decimal?: string, thousands?: string, precision?: number) => string;
183
183
  move: (arr: any[], fromIndex: number, toIndex: number) => any[];
184
- multiorder: (arr: object[], orders: object | BbnOrderItem[]) => object[];
184
+ multiorder: (arr: object[], orders: any) => object[];
185
185
  nl2br: (st: any, keepNl: any) => string;
186
186
  numProperties: (obj: object) => number;
187
187
  objectToFormData: (obj: object, key?: string, ignoreList?: string[]) => FormData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.71",
3
+ "version": "1.0.73",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,7 +9,8 @@
9
9
  ],
10
10
  "scripts": {
11
11
  "bbn": "tsc && tsc-bundle tsconfig.json && git stage ./src/* && git stage ./*.ts && git stage ./*.json && git stage -f ./dist/bundle.js && git commit -m \"Latest changes\" && git push && npm version patch && npm publish",
12
- "test": "echo \"Error: no test specified\" && exit 1"
12
+ "test": "echo \"Error: no test specified\" && exit 1",
13
+ "wtf": "echo \"Error: no test specified\" && exit 1"
13
14
  },
14
15
  "keywords": [
15
16
  "toolkit"