@bbn/bbn 1.0.84 → 1.0.86
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 +98 -98
- package/dist/bundle.js +131 -129
- package/dist/fn/ajax/postOut.d.ts +2 -2
- package/dist/fn/ajax/postOut.js +28 -25
- package/dist/fn/ajax/setNavigationVars.d.ts +2 -2
- package/dist/fn/ajax/setNavigationVars.js +2 -2
- package/dist/fn/ajax/treatAjaxArguments.d.ts +1 -1
- package/dist/fn/ajax/treatAjaxArguments.js +32 -31
- package/dist/fn/ajax/upload.d.ts +1 -1
- package/dist/fn/ajax/upload.js +1 -1
- package/dist/fn/browser/isFocused.d.ts +1 -1
- package/dist/fn/browser/isFocused.js +1 -1
- package/dist/fn/browser/selectElementText.d.ts +1 -1
- package/dist/fn/browser/selectElementText.js +1 -1
- package/dist/fn/browser/warning.d.ts +1 -1
- package/dist/fn/convert/imageToCanvas.d.ts +1 -1
- package/dist/fn/convert/imageToCanvas.js +1 -1
- package/dist/fn/convert/imgToBase64.js +0 -1
- package/dist/fn/convert/toCSV.d.ts +1 -1
- package/dist/fn/datetime/calendar.d.ts +1 -1
- package/dist/fn/datetime/calendar.js +1 -1
- package/dist/fn/datetime/fdate.d.ts +1 -1
- package/dist/fn/datetime/fdate.js +1 -1
- package/dist/fn/datetime/fdatetime.d.ts +1 -1
- package/dist/fn/datetime/fdatetime.js +1 -1
- package/dist/fn/datetime/timestamp.js +1 -1
- package/dist/fn/default/defaultAjaxAbortFunction.d.ts +1 -1
- package/dist/fn/default/defaultAjaxErrorFunction.d.ts +1 -1
- package/dist/fn/default/defaultAjaxErrorFunction.js +1 -1
- package/dist/fn/default/defaultAlertFunction.d.ts +1 -1
- package/dist/fn/default/defaultAlertFunction.js +1 -1
- package/dist/fn/default/defaultConfirmFunction.d.ts +1 -1
- package/dist/fn/default/defaultConfirmFunction.js +1 -1
- package/dist/fn/default/defaultEndLoadingFunction.d.ts +1 -1
- package/dist/fn/default/defaultEndLoadingFunction.js +1 -1
- package/dist/fn/default/defaultPostLinkFunction.d.ts +1 -1
- package/dist/fn/default/defaultPostLinkFunction.js +1 -1
- package/dist/fn/default/defaultPreLinkFunction.d.ts +1 -1
- package/dist/fn/default/defaultPreLinkFunction.js +1 -1
- package/dist/fn/default/defaultStartLoadingFunction.d.ts +1 -1
- package/dist/fn/default/defaultStartLoadingFunction.js +1 -1
- package/dist/fn/form/addInputs.d.ts +1 -1
- package/dist/fn/form/formdata.d.ts +1 -1
- package/dist/fn/form/objectToFormData.d.ts +1 -1
- package/dist/fn/form/objectToFormData.js +1 -1
- package/dist/fn/html/getAncestors.d.ts +1 -1
- package/dist/fn/html/getAncestors.js +1 -1
- package/dist/fn/html/getPath.d.ts +1 -1
- package/dist/fn/html/getText.d.ts +1 -1
- package/dist/fn/html/html2text.d.ts +1 -1
- package/dist/fn/html/selector.d.ts +2 -2
- package/dist/fn/html/selector.js +1 -1
- package/dist/fn/loop/fori.d.ts +1 -1
- package/dist/fn/loop/forir.d.ts +1 -1
- package/dist/fn/loop/iterate.d.ts +1 -1
- package/dist/fn/loop/riterate.d.ts +1 -1
- package/dist/fn/loop/riterate.js +1 -1
- package/dist/fn.d.ts +31 -31
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isObject } from
|
|
2
|
-
import { isFunction } from
|
|
3
|
-
import { substr } from
|
|
4
|
-
import { numProperties } from
|
|
1
|
+
import { isObject } from "../type/isObject";
|
|
2
|
+
import { isFunction } from "../type/isFunction";
|
|
3
|
+
import { substr } from "../string/substr";
|
|
4
|
+
import { numProperties } from "../object/numProperties";
|
|
5
5
|
/**
|
|
6
6
|
* Transforms unordered arguments into a configuratiuon object for Ajax shortcut functions.
|
|
7
7
|
*
|
|
@@ -65,62 +65,63 @@ const treatAjaxArguments = function (args) {
|
|
|
65
65
|
t = t.toLowerCase();
|
|
66
66
|
/* Callbacks */
|
|
67
67
|
if (isFunction(args[i])) {
|
|
68
|
-
if (cfg
|
|
69
|
-
cfg
|
|
68
|
+
if (cfg["errorFn"] && !cfg["abortFn"]) {
|
|
69
|
+
cfg["abortFn"] = args[i];
|
|
70
70
|
}
|
|
71
|
-
if (cfg
|
|
72
|
-
cfg
|
|
71
|
+
if (cfg["successFn"] && !cfg["errorFn"]) {
|
|
72
|
+
cfg["errorFn"] = args[i];
|
|
73
73
|
}
|
|
74
|
-
else if (!cfg
|
|
75
|
-
cfg
|
|
74
|
+
else if (!cfg["successFn"]) {
|
|
75
|
+
cfg["successFn"] = args[i];
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
else if (args[i] === 1 || args[i] === true) {
|
|
79
79
|
/* Force */
|
|
80
|
-
cfg
|
|
80
|
+
cfg["force"] = true;
|
|
81
81
|
}
|
|
82
|
-
else if (t ===
|
|
83
|
-
if (!cfg
|
|
82
|
+
else if (t === "string") {
|
|
83
|
+
if (!cfg["url"]) {
|
|
84
84
|
/* Hash */
|
|
85
|
-
if (args[i].indexOf(
|
|
86
|
-
|
|
85
|
+
if (args[i].indexOf("#") === 0 ||
|
|
86
|
+
args[i].indexOf(bbn.env.root + "#") === 0) {
|
|
87
|
+
cfg["url"] = substr(args[i], bbn.env.root.length);
|
|
87
88
|
}
|
|
88
89
|
else {
|
|
89
90
|
/* Link */
|
|
90
|
-
cfg
|
|
91
|
-
if (cfg
|
|
92
|
-
cfg
|
|
91
|
+
cfg["url"] = args[i];
|
|
92
|
+
if (cfg["url"].indexOf(bbn.env.root) === 0) {
|
|
93
|
+
cfg["url"] = substr(cfg["url"], bbn.env.root.length);
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
else {
|
|
97
98
|
/* Ajax datatype */
|
|
98
|
-
cfg
|
|
99
|
+
cfg["datatype"] = args[i];
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
|
-
else if (args[i] && t ===
|
|
102
|
+
else if (args[i] && t === "object") {
|
|
102
103
|
/* Event */
|
|
103
104
|
if (args[i] instanceof Event) {
|
|
104
|
-
cfg
|
|
105
|
+
cfg["e"] = args[i];
|
|
105
106
|
}
|
|
106
|
-
else if (!cfg
|
|
107
|
+
else if (!cfg["ele"] && args[i].nodeType === 1) {
|
|
107
108
|
/* HTML Element */
|
|
108
|
-
cfg
|
|
109
|
+
cfg["ele"] = args[i];
|
|
109
110
|
}
|
|
110
|
-
else if (t.toLowerCase() ===
|
|
111
|
+
else if (t.toLowerCase() === "object") {
|
|
111
112
|
/* An object to post */
|
|
112
|
-
cfg
|
|
113
|
+
cfg["obj"] = args[i];
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
|
-
if (!cfg
|
|
117
|
-
cfg
|
|
117
|
+
if (!cfg["url"] && numProperties(cfg)) {
|
|
118
|
+
cfg["url"] = bbn.env.path;
|
|
118
119
|
}
|
|
119
|
-
if (cfg
|
|
120
|
-
cfg
|
|
120
|
+
if (cfg["obj"] === undefined) {
|
|
121
|
+
cfg["obj"] = { _bbn: "public" };
|
|
121
122
|
}
|
|
122
|
-
if (!cfg
|
|
123
|
-
cfg
|
|
123
|
+
if (!cfg["datatype"]) {
|
|
124
|
+
cfg["datatype"] = "json";
|
|
124
125
|
}
|
|
125
126
|
return cfg;
|
|
126
127
|
};
|
package/dist/fn/ajax/upload.d.ts
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @returns {Promise}
|
|
16
16
|
*/
|
|
17
|
-
declare const upload: (url:
|
|
17
|
+
declare const upload: (url: any, file: any, success?: any, failure?: any, progress?: any) => any;
|
|
18
18
|
export { upload };
|
package/dist/fn/ajax/upload.js
CHANGED
|
@@ -16,7 +16,7 @@ import { log } from '../browser/log';
|
|
|
16
16
|
*
|
|
17
17
|
* @returns {Promise}
|
|
18
18
|
*/
|
|
19
|
-
const upload = function (url, file, success, failure, progress) {
|
|
19
|
+
const upload = function (url, file, success = null, failure = null, progress = null) {
|
|
20
20
|
let fn = () => {
|
|
21
21
|
return axios.post(url || bbn.env.path, objectToFormData(file), {
|
|
22
22
|
headers: {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @returns {Boolean} True if focused
|
|
19
19
|
*/
|
|
20
|
-
const isFocused = function (ele, contain) {
|
|
20
|
+
const isFocused = function (ele, contain = false) {
|
|
21
21
|
return ele === document.activeElement || (contain && ele.contains && ele.contains(document.activeElement));
|
|
22
22
|
};
|
|
23
23
|
export { isFocused };
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* @param {String} [valEsc="] The string escaper character
|
|
23
23
|
* @returns {String} A CSV string
|
|
24
24
|
*/
|
|
25
|
-
declare const toCSV: (arr: any
|
|
25
|
+
declare const toCSV: (arr: any, valSep?: string, rowSep?: string, valEsc?: string) => string;
|
|
26
26
|
export { toCSV };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const calendar: (d
|
|
1
|
+
declare const calendar: (d: any, wrong_result?: boolean) => any;
|
|
2
2
|
export { calendar };
|
|
@@ -3,7 +3,7 @@ import { date } from './date';
|
|
|
3
3
|
import { isDate } from '../type/isDate';
|
|
4
4
|
import { isString } from '../type/isString';
|
|
5
5
|
dayjs.extend(window['dayjs_plugin_calendar']);
|
|
6
|
-
const calendar = function (d, wrong_result) {
|
|
6
|
+
const calendar = function (d, wrong_result = false) {
|
|
7
7
|
if (undefined === dayjs) {
|
|
8
8
|
return fdate(d, wrong_result);
|
|
9
9
|
}
|
|
@@ -11,7 +11,7 @@ import { isString } from '../type/isString';
|
|
|
11
11
|
* @param {String} wrong_result
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
const fdate = function (d, wrong_result) {
|
|
14
|
+
const fdate = function (d, wrong_result = false) {
|
|
15
15
|
// Retro compatibility
|
|
16
16
|
if (wrong_result === true) {
|
|
17
17
|
return fdatetime(d);
|
|
@@ -8,7 +8,7 @@ import { isString } from '../type/isString';
|
|
|
8
8
|
* @memberof bbn.fn
|
|
9
9
|
* @returns {*}
|
|
10
10
|
*/
|
|
11
|
-
const fdatetime = function (d, wrong_result) {
|
|
11
|
+
const fdatetime = function (d, wrong_result = false) {
|
|
12
12
|
let r = date(d);
|
|
13
13
|
if (!isDate(r)) {
|
|
14
14
|
return wrong_result && isString(wrong_result) ? wrong_result : '';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultAjaxAbortFunction: (message:
|
|
1
|
+
declare const defaultAjaxAbortFunction: (message: any, url?: string) => void;
|
|
2
2
|
export { defaultAjaxAbortFunction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultAjaxErrorFunction: (jqXHR: any, textStatus?:
|
|
1
|
+
declare const defaultAjaxErrorFunction: (jqXHR: any, textStatus?: any, errorThrown?: any) => void;
|
|
2
2
|
export { defaultAjaxErrorFunction };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { log } from '../browser/log';
|
|
2
|
-
const defaultAjaxErrorFunction = function (jqXHR, textStatus, errorThrown) {
|
|
2
|
+
const defaultAjaxErrorFunction = function (jqXHR, textStatus = null, errorThrown = null) {
|
|
3
3
|
log(textStatus, errorThrown);
|
|
4
4
|
};
|
|
5
5
|
export { defaultAjaxErrorFunction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultAlertFunction: (msg:
|
|
1
|
+
declare const defaultAlertFunction: (msg: any, title?: any) => void;
|
|
2
2
|
export { defaultAlertFunction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultConfirmFunction: (text:
|
|
1
|
+
declare const defaultConfirmFunction: (text: any, yesFn: any, noFn?: any) => void;
|
|
2
2
|
export { defaultConfirmFunction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultEndLoadingFunction: (url:
|
|
1
|
+
declare const defaultEndLoadingFunction: (url: any, timestamp: any, data?: any, res?: any) => boolean;
|
|
2
2
|
export { defaultEndLoadingFunction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultPostLinkFunction: (r:
|
|
1
|
+
declare const defaultPostLinkFunction: (r: any, ele?: any) => boolean;
|
|
2
2
|
export { defaultPostLinkFunction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultPreLinkFunction: (url:
|
|
1
|
+
declare const defaultPreLinkFunction: (url: any, force?: boolean, ele?: any) => boolean;
|
|
2
2
|
export { defaultPreLinkFunction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const defaultStartLoadingFunction: (url:
|
|
1
|
+
declare const defaultStartLoadingFunction: (url: any, tst: any, data?: any, requestId?: any) => boolean;
|
|
2
2
|
export { defaultStartLoadingFunction };
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
* @param {String} prefix The optional object's name of the fields in the form
|
|
40
40
|
* @returns {undefined}
|
|
41
41
|
*/
|
|
42
|
-
declare const addInputs: (form:
|
|
42
|
+
declare const addInputs: (form: any, params?: any, prefix?: string) => void;
|
|
43
43
|
export { addInputs };
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* @param {Array} ignoreList
|
|
9
9
|
* @returns
|
|
10
10
|
*/
|
|
11
|
-
declare const objectToFormData: (obj:
|
|
11
|
+
declare const objectToFormData: (obj: any, key?: string, ignoreList?: any) => FormData;
|
|
12
12
|
export { objectToFormData };
|
|
@@ -13,7 +13,7 @@ import { isNull } from '../type/isNull';
|
|
|
13
13
|
* @param {Array} ignoreList
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
|
-
const objectToFormData = function (obj, key = '', ignoreList) {
|
|
16
|
+
const objectToFormData = function (obj, key = '', ignoreList = null) {
|
|
17
17
|
let formData = new FormData();
|
|
18
18
|
let appendFormData = (data, key = '') => {
|
|
19
19
|
if (!ignoreList || (isArray(ignoreList) && !ignoreList.includes(key))) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const getAncestors: (ele:
|
|
1
|
+
declare const getAncestors: (ele: any, selector?: any) => any[];
|
|
2
2
|
export { getAncestors };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const getText: (ele: any) =>
|
|
1
|
+
declare const getText: (ele: any) => any;
|
|
2
2
|
export { getText };
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @todo Add method description for selector
|
|
5
5
|
* @global
|
|
6
6
|
* @memberof bbn.fn
|
|
7
|
-
* @returns {
|
|
7
|
+
* @returns {HTMLElement | undefined}
|
|
8
8
|
*/
|
|
9
|
-
declare const selector: (ele:
|
|
9
|
+
declare const selector: (ele: any) => any;
|
|
10
10
|
export { selector };
|
package/dist/fn/html/selector.js
CHANGED
package/dist/fn/loop/fori.d.ts
CHANGED
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
* @param {Number} min The index at which the loop will start
|
|
33
33
|
* @returns {undefined}
|
|
34
34
|
*/
|
|
35
|
-
declare const fori: (arr: any
|
|
35
|
+
declare const fori: (arr: any, fn: any, max?: number, min?: number) => void;
|
|
36
36
|
export { fori };
|
package/dist/fn/loop/forir.d.ts
CHANGED
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
* @param {Number} min The index at which the loop will start
|
|
33
33
|
* @returns {undefined}
|
|
34
34
|
*/
|
|
35
|
-
declare const forir: (arr: any
|
|
35
|
+
declare const forir: (arr: any, fn: any, max?: number, min?: number) => void;
|
|
36
36
|
export { forir };
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
* @param {Boolean} reverse If set to true the order of the keys will be reversed
|
|
19
19
|
* @returns {Object}
|
|
20
20
|
*/
|
|
21
|
-
declare const iterate: (obj:
|
|
21
|
+
declare const iterate: (obj: any, fn: any, noPrivate?: boolean, reverse?: boolean) => any;
|
|
22
22
|
export { iterate };
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
* @param {Boolean} noPrivate If set to true the _private_ properties won't be included
|
|
18
18
|
* @returns {Object}
|
|
19
19
|
*/
|
|
20
|
-
declare const riterate: (obj:
|
|
20
|
+
declare const riterate: (obj: any, fn: any, noPrivate?: boolean) => any;
|
|
21
21
|
export { riterate };
|
package/dist/fn/loop/riterate.js
CHANGED
|
@@ -18,7 +18,7 @@ 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
|
-
const riterate = function (obj, fn, noPrivate) {
|
|
21
|
+
const riterate = function (obj, fn, noPrivate = false) {
|
|
22
22
|
return iterate(obj, fn, noPrivate, true);
|
|
23
23
|
};
|
|
24
24
|
export { riterate };
|