@jscrpt/common 2.0.2 → 2.1.0
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/changelog.md +24 -0
- package/es/rxjs/src/index.js.map +1 -0
- package/es/rxjs/src/index.mjs +3 -0
- package/es/rxjs/src/types/async.js.map +1 -0
- package/es/rxjs/src/types/async.mjs +2 -0
- package/es/rxjs/src/utils/async.js.map +1 -0
- package/es/rxjs/src/utils/async.mjs +21 -0
- package/es/src/decorators/bindThis.decorator.js.map +1 -0
- package/es/src/decorators/bindThis.decorator.mjs +24 -0
- package/es/src/decorators/callOnce.decorator.js.map +1 -0
- package/es/src/decorators/callOnce.decorator.mjs +29 -0
- package/es/src/decorators/debounceCall.decorator.js.map +1 -0
- package/es/src/decorators/debounceCall.decorator.mjs +25 -0
- package/es/src/encoder/encoder.js.map +1 -0
- package/{dist/es2015/encoder/encoder.js → es/src/encoder/encoder.mjs} +0 -0
- package/es/src/enums/orderByDirection.js.map +1 -0
- package/{dist/es2015/enums/orderByDirection.js → es/src/enums/orderByDirection.mjs} +0 -0
- package/es/src/index.js.map +1 -0
- package/es/src/index.mjs +29 -0
- package/es/src/indexNode.js.map +1 -0
- package/es/src/indexNode.mjs +2 -0
- package/es/src/jsDevMode.js.map +1 -0
- package/{dist/es2015/jsDevMode.js → es/src/jsDevMode.mjs} +0 -0
- package/es/src/normalizer/charMaps.js.map +1 -0
- package/{dist/es2015/normalizer/charMaps.js → es/src/normalizer/charMaps.mjs} +0 -0
- package/es/src/normalizer/normalizer.js.map +1 -0
- package/{dist/es2015/normalizer/normalizer.js → es/src/normalizer/normalizer.mjs} +0 -0
- package/es/src/paginator/paginator.js.map +1 -0
- package/{dist/es2015/paginator/paginator.js → es/src/paginator/paginator.mjs} +0 -0
- package/es/src/types/async.js.map +1 -0
- package/es/src/types/async.mjs +2 -0
- package/es/src/types/cssProperties.js.map +1 -0
- package/es/src/types/cssProperties.mjs +2 -0
- package/es/src/types/dictionaries.js.map +1 -0
- package/{dist/es2015/types/dictionaries.js → es/src/types/dictionaries.mjs} +0 -0
- package/es/src/types/enums.js.map +1 -0
- package/{dist/es2015/types/enums.js → es/src/types/enums.mjs} +0 -0
- package/es/src/types/functions.js.map +1 -0
- package/{dist/es2015/types/functions.js → es/src/types/functions.mjs} +0 -0
- package/es/src/types/pageable.js.map +1 -0
- package/es/src/types/pageable.mjs +2 -0
- package/es/src/types/pagedData.js.map +1 -0
- package/es/src/types/pagedData.mjs +2 -0
- package/es/src/types/valueNamePair.js.map +1 -0
- package/{dist/es2015/types/valueNamePair.js → es/src/types/valueNamePair.mjs} +0 -0
- package/es/src/utils/async.js.map +1 -0
- package/es/src/utils/async.mjs +14 -0
- package/es/src/utils/common.js.map +1 -0
- package/es/src/utils/common.mjs +225 -0
- package/es/src/utils/lang.js.map +1 -0
- package/{dist/es2015/utils/lang.js → es/src/utils/lang.mjs} +0 -0
- package/es/src/utils/nameof.js.map +1 -0
- package/{dist/es2015/utils/nameof.js → es/src/utils/nameof.mjs} +0 -0
- package/es2015/rxjs/src/index.js +3 -0
- package/es2015/rxjs/src/index.js.map +1 -0
- package/es2015/rxjs/src/types/async.js +2 -0
- package/es2015/rxjs/src/types/async.js.map +1 -0
- package/es2015/rxjs/src/utils/async.js +21 -0
- package/es2015/rxjs/src/utils/async.js.map +1 -0
- package/{dist/es2015 → es2015/src}/decorators/bindThis.decorator.js +0 -0
- package/{dist/es2015 → es2015/src}/decorators/bindThis.decorator.js.map +0 -0
- package/{dist/es2015 → es2015/src}/decorators/callOnce.decorator.js +0 -0
- package/{dist/es2015 → es2015/src}/decorators/callOnce.decorator.js.map +0 -0
- package/{dist/es2015 → es2015/src}/decorators/debounceCall.decorator.js +0 -0
- package/{dist/es2015 → es2015/src}/decorators/debounceCall.decorator.js.map +0 -0
- package/{dist/es2020 → es2015/src}/encoder/encoder.js +0 -0
- package/{dist/es2015 → es2015/src}/encoder/encoder.js.map +0 -0
- package/{dist/es2020 → es2015/src}/enums/orderByDirection.js +0 -0
- package/{dist/es2015 → es2015/src}/enums/orderByDirection.js.map +0 -0
- package/{dist/es2015 → es2015/src}/index.js +5 -0
- package/es2015/src/index.js.map +1 -0
- package/{dist/es2015 → es2015/src}/indexNode.js +0 -0
- package/{dist/es2015 → es2015/src}/indexNode.js.map +0 -0
- package/{dist/es2020 → es2015/src}/jsDevMode.js +0 -0
- package/{dist/es2015 → es2015/src}/jsDevMode.js.map +0 -0
- package/{dist/es2020 → es2015/src}/normalizer/charMaps.js +0 -0
- package/{dist/es2015 → es2015/src}/normalizer/charMaps.js.map +0 -0
- package/{dist/es2020 → es2015/src}/normalizer/normalizer.js +0 -0
- package/{dist/es2015 → es2015/src}/normalizer/normalizer.js.map +0 -0
- package/{dist/es2020 → es2015/src}/paginator/paginator.js +0 -0
- package/{dist/es2015 → es2015/src}/paginator/paginator.js.map +0 -0
- package/es2015/src/types/async.js +2 -0
- package/es2015/src/types/async.js.map +1 -0
- package/es2015/src/types/cssProperties.js +2 -0
- package/es2015/src/types/cssProperties.js.map +1 -0
- package/{dist/es2020 → es2015/src}/types/dictionaries.js +0 -0
- package/{dist/es2015 → es2015/src}/types/dictionaries.js.map +1 -1
- package/{dist/es2020 → es2015/src}/types/enums.js +0 -0
- package/{dist/es2015 → es2015/src}/types/enums.js.map +0 -0
- package/{dist/es2020 → es2015/src}/types/functions.js +0 -0
- package/{dist/es2015 → es2015/src}/types/functions.js.map +0 -0
- package/es2015/src/types/pageable.js +2 -0
- package/es2015/src/types/pageable.js.map +1 -0
- package/es2015/src/types/pagedData.js +2 -0
- package/es2015/src/types/pagedData.js.map +1 -0
- package/{dist/es2020 → es2015/src}/types/valueNamePair.js +0 -0
- package/{dist/es2015 → es2015/src}/types/valueNamePair.js.map +0 -0
- package/es2015/src/utils/async.js +14 -0
- package/es2015/src/utils/async.js.map +1 -0
- package/{dist/es2015 → es2015/src}/utils/common.js +16 -0
- package/es2015/src/utils/common.js.map +1 -0
- package/{dist/es2020 → es2015/src}/utils/lang.js +0 -0
- package/{dist/es2015 → es2015/src}/utils/lang.js.map +0 -0
- package/{dist/es2020 → es2015/src}/utils/nameof.js +0 -0
- package/{dist/es2015 → es2015/src}/utils/nameof.js.map +0 -0
- package/es2020/rxjs/src/index.js +3 -0
- package/es2020/rxjs/src/index.js.map +1 -0
- package/es2020/rxjs/src/types/async.js +2 -0
- package/es2020/rxjs/src/types/async.js.map +1 -0
- package/es2020/rxjs/src/utils/async.js +21 -0
- package/es2020/rxjs/src/utils/async.js.map +1 -0
- package/{dist/es2020 → es2020/src}/decorators/bindThis.decorator.js +0 -0
- package/{dist/es2020 → es2020/src}/decorators/bindThis.decorator.js.map +0 -0
- package/{dist/es2020 → es2020/src}/decorators/callOnce.decorator.js +0 -0
- package/{dist/es2020 → es2020/src}/decorators/callOnce.decorator.js.map +0 -0
- package/{dist/es2020 → es2020/src}/decorators/debounceCall.decorator.js +0 -0
- package/{dist/es2020 → es2020/src}/decorators/debounceCall.decorator.js.map +0 -0
- package/es2020/src/encoder/encoder.js +220 -0
- package/{dist/es2020 → es2020/src}/encoder/encoder.js.map +0 -0
- package/{dist/es5 → es2020/src}/enums/orderByDirection.js +0 -0
- package/{dist/es2020 → es2020/src}/enums/orderByDirection.js.map +0 -0
- package/{dist/es2020 → es2020/src}/index.js +5 -0
- package/es2020/src/index.js.map +1 -0
- package/{dist/es2020 → es2020/src}/indexNode.js +0 -0
- package/{dist/es2020 → es2020/src}/indexNode.js.map +0 -0
- package/{dist/es5 → es2020/src}/jsDevMode.js +0 -0
- package/{dist/es2020 → es2020/src}/jsDevMode.js.map +0 -0
- package/es2020/src/normalizer/charMaps.js +20 -0
- package/{dist/es2020 → es2020/src}/normalizer/charMaps.js.map +0 -0
- package/es2020/src/normalizer/normalizer.js +14 -0
- package/{dist/es2020 → es2020/src}/normalizer/normalizer.js.map +0 -0
- package/es2020/src/paginator/paginator.js +230 -0
- package/{dist/es2020 → es2020/src}/paginator/paginator.js.map +0 -0
- package/es2020/src/types/async.js +2 -0
- package/es2020/src/types/async.js.map +1 -0
- package/es2020/src/types/cssProperties.js +2 -0
- package/es2020/src/types/cssProperties.js.map +1 -0
- package/{dist/es5 → es2020/src}/types/dictionaries.js +0 -0
- package/{dist/es2020 → es2020/src}/types/dictionaries.js.map +1 -1
- package/{dist/es5 → es2020/src}/types/enums.js +0 -0
- package/{dist/es2020 → es2020/src}/types/enums.js.map +0 -0
- package/{dist/es5 → es2020/src}/types/functions.js +0 -0
- package/{dist/es2020 → es2020/src}/types/functions.js.map +0 -0
- package/es2020/src/types/pageable.js +2 -0
- package/es2020/src/types/pageable.js.map +1 -0
- package/es2020/src/types/pagedData.js +2 -0
- package/es2020/src/types/pagedData.js.map +1 -0
- package/{dist/es5 → es2020/src}/types/valueNamePair.js +0 -0
- package/{dist/es2020 → es2020/src}/types/valueNamePair.js.map +0 -0
- package/es2020/src/utils/async.js +11 -0
- package/es2020/src/utils/async.js.map +1 -0
- package/{dist/es2020 → es2020/src}/utils/common.js +16 -0
- package/es2020/src/utils/common.js.map +1 -0
- package/es2020/src/utils/lang.js +79 -0
- package/{dist/es2020 → es2020/src}/utils/lang.js.map +0 -0
- package/es2020/src/utils/nameof.js +6 -0
- package/{dist/es2020 → es2020/src}/utils/nameof.js.map +0 -0
- package/es5/rxjs/src/index.js +3 -0
- package/es5/rxjs/src/index.js.map +1 -0
- package/es5/rxjs/src/types/async.js +2 -0
- package/es5/rxjs/src/types/async.js.map +1 -0
- package/es5/rxjs/src/utils/async.js +21 -0
- package/es5/rxjs/src/utils/async.js.map +1 -0
- package/{dist/es5 → es5/src}/decorators/bindThis.decorator.js +1 -1
- package/{dist/es5 → es5/src}/decorators/bindThis.decorator.js.map +1 -1
- package/{dist/es5 → es5/src}/decorators/callOnce.decorator.js +1 -1
- package/{dist/es5 → es5/src}/decorators/callOnce.decorator.js.map +1 -1
- package/{dist/es5 → es5/src}/decorators/debounceCall.decorator.js +1 -1
- package/{dist/es5 → es5/src}/decorators/debounceCall.decorator.js.map +1 -1
- package/{dist/es5 → es5/src}/encoder/encoder.js +0 -0
- package/{dist/es5 → es5/src}/encoder/encoder.js.map +0 -0
- package/es5/src/enums/orderByDirection.js +15 -0
- package/{dist/es5 → es5/src}/enums/orderByDirection.js.map +0 -0
- package/{dist/es5 → es5/src}/index.js +5 -0
- package/es5/src/index.js.map +1 -0
- package/{dist/es5 → es5/src}/indexNode.js +0 -0
- package/{dist/es5 → es5/src}/indexNode.js.map +0 -0
- package/es5/src/jsDevMode.js +8 -0
- package/{dist/es5 → es5/src}/jsDevMode.js.map +0 -0
- package/{dist/es5 → es5/src}/normalizer/charMaps.js +0 -0
- package/{dist/es5 → es5/src}/normalizer/charMaps.js.map +0 -0
- package/{dist/es5 → es5/src}/normalizer/normalizer.js +0 -0
- package/{dist/es5 → es5/src}/normalizer/normalizer.js.map +0 -0
- package/{dist/es5 → es5/src}/paginator/paginator.js +0 -0
- package/{dist/es5 → es5/src}/paginator/paginator.js.map +0 -0
- package/es5/src/types/async.js +2 -0
- package/es5/src/types/async.js.map +1 -0
- package/es5/src/types/cssProperties.js +2 -0
- package/es5/src/types/cssProperties.js.map +1 -0
- package/es5/src/types/dictionaries.js +2 -0
- package/{dist/es5 → es5/src}/types/dictionaries.js.map +1 -1
- package/es5/src/types/enums.js +2 -0
- package/{dist/es5 → es5/src}/types/enums.js.map +0 -0
- package/es5/src/types/functions.js +2 -0
- package/{dist/es5 → es5/src}/types/functions.js.map +0 -0
- package/es5/src/types/pageable.js +2 -0
- package/es5/src/types/pageable.js.map +1 -0
- package/es5/src/types/pagedData.js +2 -0
- package/es5/src/types/pagedData.js.map +1 -0
- package/es5/src/types/valueNamePair.js +2 -0
- package/{dist/es5 → es5/src}/types/valueNamePair.js.map +0 -0
- package/es5/src/utils/async.js +19 -0
- package/es5/src/utils/async.js.map +1 -0
- package/{dist/es5 → es5/src}/utils/common.js +19 -1
- package/es5/src/utils/common.js.map +1 -0
- package/{dist/es5 → es5/src}/utils/lang.js +0 -0
- package/{dist/es5 → es5/src}/utils/lang.js.map +0 -0
- package/{dist/es5 → es5/src}/utils/nameof.js +0 -0
- package/{dist/es5 → es5/src}/utils/nameof.js.map +0 -0
- package/module/rxjs/src/index.cjs +6 -0
- package/module/rxjs/src/index.js.map +1 -0
- package/module/rxjs/src/types/async.cjs +3 -0
- package/module/rxjs/src/types/async.js.map +1 -0
- package/module/rxjs/src/utils/async.cjs +25 -0
- package/module/rxjs/src/utils/async.js.map +1 -0
- package/{dist/module → module/src}/decorators/bindThis.decorator.cjs +0 -0
- package/{dist/module → module/src}/decorators/bindThis.decorator.js.map +0 -0
- package/{dist/module → module/src}/decorators/callOnce.decorator.cjs +0 -0
- package/{dist/module → module/src}/decorators/callOnce.decorator.js.map +0 -0
- package/{dist/module → module/src}/decorators/debounceCall.decorator.cjs +0 -0
- package/{dist/module → module/src}/decorators/debounceCall.decorator.js.map +0 -0
- package/{dist/module → module/src}/encoder/encoder.cjs +0 -0
- package/{dist/module → module/src}/encoder/encoder.js.map +0 -0
- package/{dist/module → module/src}/enums/orderByDirection.cjs +0 -0
- package/{dist/module → module/src}/enums/orderByDirection.js.map +0 -0
- package/{dist/module → module/src}/index.cjs +5 -0
- package/module/src/index.js.map +1 -0
- package/{dist/module → module/src}/indexNode.cjs +0 -0
- package/{dist/module → module/src}/indexNode.js.map +0 -0
- package/{dist/module → module/src}/jsDevMode.cjs +0 -0
- package/{dist/module → module/src}/jsDevMode.js.map +0 -0
- package/{dist/module → module/src}/normalizer/charMaps.cjs +0 -0
- package/{dist/module → module/src}/normalizer/charMaps.js.map +0 -0
- package/{dist/module → module/src}/normalizer/normalizer.cjs +0 -0
- package/{dist/module → module/src}/normalizer/normalizer.js.map +0 -0
- package/{dist/module → module/src}/paginator/paginator.cjs +0 -0
- package/{dist/module → module/src}/paginator/paginator.js.map +0 -0
- package/module/src/types/async.cjs +3 -0
- package/module/src/types/async.js.map +1 -0
- package/module/src/types/cssProperties.cjs +3 -0
- package/module/src/types/cssProperties.js.map +1 -0
- package/{dist/module → module/src}/types/dictionaries.cjs +0 -0
- package/{dist/module → module/src}/types/dictionaries.js.map +1 -1
- package/{dist/module → module/src}/types/enums.cjs +0 -0
- package/{dist/module → module/src}/types/enums.js.map +0 -0
- package/{dist/module → module/src}/types/functions.cjs +0 -0
- package/{dist/module → module/src}/types/functions.js.map +0 -0
- package/module/src/types/pageable.cjs +3 -0
- package/module/src/types/pageable.js.map +1 -0
- package/module/src/types/pagedData.cjs +3 -0
- package/module/src/types/pagedData.js.map +1 -0
- package/{dist/module → module/src}/types/valueNamePair.cjs +0 -0
- package/{dist/module → module/src}/types/valueNamePair.js.map +0 -0
- package/module/src/utils/async.cjs +18 -0
- package/module/src/utils/async.js.map +1 -0
- package/{dist/module → module/src}/utils/common.cjs +18 -1
- package/module/src/utils/common.js.map +1 -0
- package/{dist/module → module/src}/utils/lang.cjs +0 -0
- package/{dist/module → module/src}/utils/lang.js.map +0 -0
- package/{dist/module → module/src}/utils/nameof.cjs +0 -0
- package/{dist/module → module/src}/utils/nameof.js.map +0 -0
- package/package.json +49 -27
- package/rxjs/package.json +11 -0
- package/rxjs/src/index.d.ts +3 -0
- package/rxjs/src/index.d.ts.map +1 -0
- package/rxjs/src/types/async.d.ts +6 -0
- package/rxjs/src/types/async.d.ts.map +1 -0
- package/rxjs/src/utils/async.d.ts +7 -0
- package/rxjs/src/utils/async.d.ts.map +1 -0
- package/src/index.d.ts +5 -0
- package/src/index.d.ts.map +1 -1
- package/src/types/async.d.ts +5 -0
- package/src/types/async.d.ts.map +1 -0
- package/src/types/cssProperties.d.ts +17 -0
- package/src/types/cssProperties.d.ts.map +1 -0
- package/src/types/pageable.d.ts +14 -0
- package/src/types/pageable.d.ts.map +1 -0
- package/src/types/pagedData.d.ts +38 -0
- package/src/types/pagedData.d.ts.map +1 -0
- package/src/utils/async.d.ts +7 -0
- package/src/utils/async.d.ts.map +1 -0
- package/src/utils/common.d.ts +7 -0
- package/src/utils/common.d.ts.map +1 -1
- package/version.bak +1 -1
- package/dist/es2015/index.js.map +0 -1
- package/dist/es2015/utils/common.js.map +0 -1
- package/dist/es2020/index.js.map +0 -1
- package/dist/es2020/utils/common.js.map +0 -1
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/utils/common.js.map +0 -1
- package/dist/module/index.js.map +0 -1
- package/dist/module/utils/common.js.map +0 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import extendLib from 'extend';
|
|
2
|
+
import { isPresent } from './lang.mjs';
|
|
3
|
+
import { normalize } from '../normalizer/normalizer.mjs';
|
|
4
|
+
/**
|
|
5
|
+
* Reverse current string and returns new reverse string
|
|
6
|
+
* @param str - String to be reversed
|
|
7
|
+
* @returns string Reverse string
|
|
8
|
+
*/
|
|
9
|
+
export function reverseString(str) {
|
|
10
|
+
return str.split('').reverse().join('');
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Extends one object with additional properties from other objects, supports deep extend
|
|
14
|
+
* @param deepOrObject - Object to be extended or indication that deep copy should be performed
|
|
15
|
+
* @param objectN - Objects that will be used for extending, if deep is used first here is target object
|
|
16
|
+
* @returns Object Extended object with properties from other objects
|
|
17
|
+
*/
|
|
18
|
+
export function extend(deepOrObject, ...objectN) {
|
|
19
|
+
return extendLib.apply(null, [deepOrObject, ...objectN]);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generates random string consisting from lowercase letters
|
|
23
|
+
* @param length - Length of generated string
|
|
24
|
+
* @returns number Generated string
|
|
25
|
+
*/
|
|
26
|
+
export function generateId(length) {
|
|
27
|
+
let result = '';
|
|
28
|
+
for (let x = 0; x < length; x++) {
|
|
29
|
+
result += String.fromCharCode(Math.round(Math.random() * 25 + 97));
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Generates random string of specified length from possible characters
|
|
35
|
+
* @param length - Length of generated string
|
|
36
|
+
* @param possible - Possible characters used for generation of string
|
|
37
|
+
*/
|
|
38
|
+
export function generateRandomString(length, possible = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
|
|
39
|
+
let text = '';
|
|
40
|
+
for (let i = 0; i < length; i++) {
|
|
41
|
+
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
|
42
|
+
}
|
|
43
|
+
return text;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Converts string in that way that first letter will be lowerCase
|
|
47
|
+
* @param text - Text to be converted
|
|
48
|
+
*/
|
|
49
|
+
export function firstToLowerCase(text) {
|
|
50
|
+
return text.charAt(0).toLowerCase() + text.substr(1);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Gets indication whether is child descendand of parent
|
|
54
|
+
* @param parent - Parent to be tested
|
|
55
|
+
* @param child - Child to be looked for
|
|
56
|
+
*/
|
|
57
|
+
export function isDescendant(parent, child) {
|
|
58
|
+
let node = child.parentNode;
|
|
59
|
+
while (node != null) {
|
|
60
|
+
if (node == parent) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
node = node.parentNode;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Computes offset of element against document
|
|
69
|
+
* @param element - Html element which offset is counted
|
|
70
|
+
* @param doc - Html document to be used for extracting scroll offset
|
|
71
|
+
*/
|
|
72
|
+
export function offset(element, doc) {
|
|
73
|
+
doc = doc || document;
|
|
74
|
+
const rect = element.getBoundingClientRect(), scrollLeft = window.pageXOffset || doc.documentElement.scrollLeft, scrollTop = window.pageYOffset || doc.documentElement.scrollTop;
|
|
75
|
+
return {
|
|
76
|
+
top: rect.top + scrollTop,
|
|
77
|
+
left: rect.left + scrollLeft,
|
|
78
|
+
bottom: rect.top + scrollTop + rect.height,
|
|
79
|
+
right: rect.left + scrollLeft + rect.width
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Converts html string into html DOM
|
|
84
|
+
* @param html - Html string to be converted to DOM
|
|
85
|
+
* @param doc - Optional html document to be used
|
|
86
|
+
*/
|
|
87
|
+
export function htmlToElement(html, doc) {
|
|
88
|
+
let htmlDocument = document;
|
|
89
|
+
if (isPresent(doc)) {
|
|
90
|
+
htmlDocument = doc;
|
|
91
|
+
}
|
|
92
|
+
const template = htmlDocument.createElement('template');
|
|
93
|
+
html = html.trim();
|
|
94
|
+
template.innerHTML = html;
|
|
95
|
+
return template.content.firstChild;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Extract values from enum type
|
|
99
|
+
* @param enumType - Enum type that will have extracted values
|
|
100
|
+
*/
|
|
101
|
+
export function getEnumValues(enumType) {
|
|
102
|
+
const result = [];
|
|
103
|
+
Object.keys(enumType).forEach(key => {
|
|
104
|
+
if (isNaN(+key)) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
result.push({
|
|
108
|
+
value: key,
|
|
109
|
+
name: enumType[+key]
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
export function getValue(object, expression) {
|
|
115
|
+
return expression.split('.').reduce((o, i) => {
|
|
116
|
+
if (o) {
|
|
117
|
+
return o[i];
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}, object);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Sets value to objects property using string expression
|
|
124
|
+
* @param object - Object which property value will be set
|
|
125
|
+
* @param value - Value that will be set
|
|
126
|
+
* @param expression - Expression for setting value
|
|
127
|
+
*/
|
|
128
|
+
export function setValue(object, value, expression) {
|
|
129
|
+
const parts = expression.split('.');
|
|
130
|
+
parts.forEach((part, index) => {
|
|
131
|
+
var _a;
|
|
132
|
+
//last item value is assigned
|
|
133
|
+
if (index == parts.length - 1) {
|
|
134
|
+
if (isPresent(value)) {
|
|
135
|
+
object[part] = value;
|
|
136
|
+
}
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
object = object[part] = (_a = object[part]) !== null && _a !== void 0 ? _a : {};
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Formats string using '%s', to print '%s' you have to use '%%s'
|
|
144
|
+
* @param str - String containing substitution constants
|
|
145
|
+
* @param args - Arguments that are used for replacement
|
|
146
|
+
*/
|
|
147
|
+
export function format(str, ...args) {
|
|
148
|
+
let i = 0;
|
|
149
|
+
return str.replace(/((?!%).)%s/g, (_sub, substArgs) => `${substArgs[0]}${args[i++]}`).replace(/%%s/g, '%s');
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Performs flatMap over provided array
|
|
153
|
+
* @param array - Array to be reduced using flatMap
|
|
154
|
+
*/
|
|
155
|
+
export function flatMapArray(array) {
|
|
156
|
+
return array.reduce((acc, x) => acc.concat(x), []);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Serialize object to string that is usable as url query parameter
|
|
160
|
+
* @param obj - Object to be serialized
|
|
161
|
+
* @param replacer - Function that can be used for replacing provided values
|
|
162
|
+
*/
|
|
163
|
+
export function serializeToUrlQuery(obj, replacer) {
|
|
164
|
+
return btoa(encodeURIComponent(JSON.stringify(obj, replacer)));
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Deserialize value from url query string into object
|
|
168
|
+
* @param queryParamValue - Query param string value
|
|
169
|
+
* @param reviver - Function that can be used for correctly deserializing value
|
|
170
|
+
*/
|
|
171
|
+
export function deserializeFromUrlQuery(queryParamValue, reviver) {
|
|
172
|
+
return JSON.parse(decodeURIComponent(atob(queryParamValue)), reviver);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Converts id to valid html id
|
|
176
|
+
* @param id - Id that is going to be converted to valid html id
|
|
177
|
+
* @param charMap - Character map used during normalization
|
|
178
|
+
*/
|
|
179
|
+
export function validHtmlId(id, charMap = {}) {
|
|
180
|
+
id = id.toLowerCase()
|
|
181
|
+
.replace(/[\s]+/g, '-')
|
|
182
|
+
.replace(/\./g, '')
|
|
183
|
+
.replace(/^(\d)/g, 'x$1');
|
|
184
|
+
id = normalize(id, charMap);
|
|
185
|
+
return id;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Checks whether is element overflown either horizontal, or vertical
|
|
189
|
+
* @param element - Element to be tested for overflow
|
|
190
|
+
*/
|
|
191
|
+
export function isOverflown(element) {
|
|
192
|
+
return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Normalizes string, removing accent
|
|
196
|
+
* @param value - String to be normalized
|
|
197
|
+
*/
|
|
198
|
+
export function normalizeAccent(value) {
|
|
199
|
+
return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Converts instance of Class to equivalent Record type
|
|
203
|
+
* @param instance - Instance which type to be converted
|
|
204
|
+
* @typeparam TType - Type of instance
|
|
205
|
+
*/
|
|
206
|
+
export function asDictionary(instance) {
|
|
207
|
+
return instance;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Maps all iterable property values of object to "this" bounded
|
|
211
|
+
* @param this - Object which will be filled with new values
|
|
212
|
+
* @param value - Object holding values that will be used for filling
|
|
213
|
+
* @param all - Indication whether map only existing properties or everything
|
|
214
|
+
*/
|
|
215
|
+
export function mapValuesToThis(value, all = false) {
|
|
216
|
+
if (!value) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
Object.keys(value).forEach(prop => {
|
|
220
|
+
if (value[prop] !== undefined && (all || (prop in this))) {
|
|
221
|
+
this[prop] = value[prop];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lang.mjs","sourceRoot":"","sources":["../../../src/utils/lang.ts"],"names":[],"mappings":"AAAA;;;GAGG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3B,OAAO,GAAG,YAAY,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,IAAI;AAGpB,CAAC;AAED,MAAM,UAAU,cAAc,CAAsB,GAAwB;IAExE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,CAAM;IAE7B,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,UAAU,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAQ;IAEhC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,IAAS;IAEnD,OAAO,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAQ;IAElC,KAAK,MAAM,KAAK,IAAI,GAAG,EACvB;QACI,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["/**\r\n * Tests whether is object not `null` and not `undefined` at the same time\r\n * @param obj - Object to be tested\r\n */\r\nexport function isPresent<TObj>(obj: TObj): obj is NonNullable<TObj>\r\n{\r\n return obj !== undefined && obj !== null;\r\n}\r\n\r\n/**\r\n * Tests whether is object `null` or `undefined`\r\n * @param obj - Object to be tested\r\n */\r\nexport function isBlank(obj: any): obj is null|undefined\r\n{\r\n return obj === undefined || obj === null;\r\n}\r\n\r\n/**\r\n * Tests whether is object instance of `boolean`\r\n * @param obj - Object to be tested\r\n */\r\nexport function isBoolean(obj: any): obj is boolean\r\n{\r\n return typeof obj === 'boolean';\r\n}\r\n\r\n/**\r\n * Tests whether is object instance of number\r\n * @param obj - Object to be tested\r\n */\r\nexport function isNumber(obj: any): obj is number\r\n{\r\n return typeof obj === 'number';\r\n}\r\n\r\n/**\r\n * Tests whether is object instance of string\r\n * @param obj - Object to be tested\r\n */\r\nexport function isString(obj: any): obj is string\r\n{\r\n return typeof obj === 'string';\r\n}\r\n\r\n/**\r\n * Tests whether is object instance of function\r\n * @param obj - Object to be tested\r\n */\r\nexport function isFunction(obj: any): obj is Function\r\n{\r\n return typeof obj === 'function';\r\n}\r\n\r\nexport function isType(obj: any): obj is Function\r\n{\r\n return isFunction(obj);\r\n}\r\n\r\nexport function isStringMap(obj: any): obj is Object\r\n{\r\n return typeof obj === 'object' && obj !== null;\r\n}\r\n\r\nconst STRING_MAP_PROTO = Object.getPrototypeOf({});\r\n\r\nexport function isStrictStringMap(obj: any): boolean\r\n{\r\n return isStringMap(obj) && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;\r\n}\r\n\r\nexport function isArray(obj: any): obj is Array<any>\r\n{\r\n return Array.isArray(obj);\r\n}\r\n\r\nexport function isDate(obj: any): obj is Date\r\n{\r\n return obj instanceof Date && !isNaN(obj.valueOf());\r\n}\r\n\r\nexport function noop(): void\r\n// eslint-disable-next-line @typescript-eslint/no-empty-function\r\n{\r\n}\r\n\r\nexport function normalizeBlank<TObj extends Object>(obj: TObj|undefined|null): TObj|null\r\n{\r\n return isBlank(obj) ? null : obj;\r\n}\r\n\r\nexport function isJsObject(o: any): o is Function|Object\r\n{\r\n return o !== null && (typeof o === 'function' || typeof o === 'object');\r\n}\r\n\r\nexport function isPrimitive(obj: any): boolean\r\n{\r\n return !isJsObject(obj);\r\n}\r\n\r\nexport function hasConstructor(value: Object, type: any): boolean\r\n{\r\n return value.constructor === type;\r\n}\r\n\r\nexport function isEmptyObject(obj: any): boolean\r\n{\r\n for (const _name in obj)\r\n {\r\n return false;\r\n }\r\n\r\n return true;\r\n}"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nameof.mjs","sourceRoot":"","sources":["../../../src/utils/nameof.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAI,IAA8B,EAAU,EAAE,CAAC,IAAI,CAAC","sourcesContent":["/**\r\n * Returns name of property, checked by typescript\r\n * @param name - Name of property that should be returned\r\n */\r\nexport const nameof = <T>(name: Extract<keyof T, string>): string => name;"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../rxjs/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC","sourcesContent":["export * from './types/async';\nexport * from './utils/async';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../../rxjs/src/types/async.ts"],"names":[],"mappings":"","sourcesContent":["import {Observable} from 'rxjs';\n\n/**\n * Type that represents pure value or value obtained by promise or value obtained by Observable\n */\nexport type PromiseObservableOr<TValue> = Observable<TValue>|Promise<TValue>|TValue;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves `PromiseObservableOr` value, if value is Observable then can be completed without value and undefined is resolved
|
|
4
|
+
* @param value - Value to be solved
|
|
5
|
+
*/
|
|
6
|
+
export function resolvePromiseObservableOr(value) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
if (value instanceof Observable) {
|
|
9
|
+
value = value
|
|
10
|
+
.toPromise();
|
|
11
|
+
}
|
|
12
|
+
if (value instanceof Promise) {
|
|
13
|
+
value
|
|
14
|
+
.then(resolve)
|
|
15
|
+
.catch(error => reject(error));
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
resolve(value);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=async.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../../rxjs/src/utils/async.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,MAAM,CAAC;AAGhC;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAU,KAAmC;IAEnF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAEnC,IAAG,KAAK,YAAY,UAAU,EAC9B;YACI,KAAK,GAAG,KAAK;iBACR,SAAS,EAAE,CAAC;SACpB;QAED,IAAG,KAAK,YAAY,OAAO,EAC3B;YACI,KAAK;iBACA,IAAI,CAAC,OAAO,CAAC;iBACb,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAEnC,OAAO;SACV;QAED,OAAO,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import {Observable} from 'rxjs';\nimport {PromiseObservableOr} from '../types/async';\n\n/**\n * Resolves `PromiseObservableOr` value, if value is Observable then can be completed without value and undefined is resolved\n * @param value - Value to be solved\n */\nexport function resolvePromiseObservableOr<TResult>(value: PromiseObservableOr<TResult>): Promise<TResult|undefined>\n{\n return new Promise((resolve, reject) =>\n {\n if(value instanceof Observable)\n {\n value = value\n .toPromise();\n }\n\n if(value instanceof Promise)\n {\n value\n .then(resolve)\n .catch(error => reject(error));\n\n return;\n }\n \n resolve(value);\n });\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -11,10 +11,15 @@ export * from './paginator/paginator';
|
|
|
11
11
|
export * from './normalizer/charMaps';
|
|
12
12
|
export * from './normalizer/normalizer';
|
|
13
13
|
export * from './enums/orderByDirection';
|
|
14
|
+
export * from './types/async';
|
|
15
|
+
export * from './types/cssProperties';
|
|
14
16
|
export * from './types/dictionaries';
|
|
15
17
|
export * from './types/enums';
|
|
16
18
|
export * from './types/functions';
|
|
19
|
+
export * from './types/pageable';
|
|
20
|
+
export * from './types/pagedData';
|
|
17
21
|
export * from './types/valueNamePair';
|
|
22
|
+
export * from './utils/async';
|
|
18
23
|
export * from './utils/common';
|
|
19
24
|
export * from './utils/lang';
|
|
20
25
|
export * from './utils/nameof';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,YAAY,CAAC,MAAM,CAAC,EAAE;IAElB,IAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAC/B;QACI,MAAM,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC;KAC/B;AACL,CAAC,CAAC,CAAC;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC","sourcesContent":["import {globalDefine} from './jsDevMode';\r\nimport {isBlank} from './utils/lang';\r\n\r\nglobalDefine(global =>\r\n{\r\n if(isBlank(global['jsDevMode']))\r\n {\r\n global['jsDevMode'] = false;\r\n }\r\n});\r\n\r\nexport * from './jsDevMode';\r\nexport * from './encoder/encoder';\r\nexport * from './paginator/paginator';\r\nexport * from './normalizer/charMaps';\r\nexport * from './normalizer/normalizer';\r\nexport * from './enums/orderByDirection';\r\nexport * from './types/async';\r\nexport * from './types/cssProperties';\r\nexport * from './types/dictionaries';\r\nexport * from './types/enums';\r\nexport * from './types/functions';\r\nexport * from './types/pageable';\r\nexport * from './types/pagedData';\r\nexport * from './types/valueNamePair';\r\nexport * from './utils/async';\r\nexport * from './utils/common';\r\nexport * from './utils/lang';\r\nexport * from './utils/nameof';\r\nexport * from './decorators/bindThis.decorator';\r\nexport * from './decorators/callOnce.decorator';\r\nexport * from './decorators/debounceCall.decorator';\r\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../src/types/async.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Type that represents pure value or value obtained by promise\n */\nexport type PromiseOr<TValue> = Promise<TValue>|TValue;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cssProperties.js","sourceRoot":"","sources":["../../../src/types/cssProperties.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents css global values, usable for any css property\n */\nexport type CssGlobal = 'inherit'|'initial'|'revert'|'unset';\n\n/**\n * Represents css overflow values\n */\nexport type CssOverflow = 'visible'|'hidden'|'clip'|'scroll'|'auto'|'hidden visible'|CssGlobal;\n\n/**\n * Represents css position values\n */\nexport type CssPosition = 'static'|'relative'|'absolute'|'fixed'|'sticky'|CssGlobal;\n\n/**\n * Represents css display values\n */\nexport type CssDisplay = 'block'|'inline'|'run-in'|'flow'|'flow-root'|'table'|'flex'|'grid'|'list-item'|'table-row-group'|'table-header-group'|'table-footer-group'|'table-row'|'table-cell'|'table-column-group'|'table-column'|'table-caption'|'contents'|'none'|'inline-block'|'inline-list-item'|'inline-table'|'inline-flex'|'inline-grid'|CssGlobal;\n"]}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionaries.js","sourceRoot":"","sources":["../../../src/types/dictionaries.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Represents type that extracts class as type Record with property keys as index and unknown property values\r\n */\r\nexport type AsDictionary<TType extends Object> = TType extends {[P in keyof TType]: unknown} ? Record<keyof TType, unknown> : unknown;\r\n\r\n/**\r\n * Represents Record type where, key is string and value is defined by typeparam\r\n * @typeparam TData - Type of property value\r\n */\r\nexport type Dictionary<TData = unknown> = Record<string, TData>;\r\n\r\n/**\r\n * Represents Record type where, key is string and value is string\r\n */\r\nexport type StringDictionary = Record<string, string
|
|
1
|
+
{"version":3,"file":"dictionaries.js","sourceRoot":"","sources":["../../../src/types/dictionaries.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Represents type that extracts class as type Record with property keys as index and unknown property values\r\n */\r\nexport type AsDictionary<TType extends Object> = TType extends {[P in keyof TType]: unknown} ? Record<keyof TType, unknown> : unknown;\r\n\r\n/**\r\n * Represents Record type where, key is string and value is defined by typeparam\r\n * @typeparam TData - Type of property value\r\n */\r\nexport type Dictionary<TData = unknown> = Record<string, TData>;\r\n\r\n/**\r\n * Represents Record type where, key is string and value is string\r\n */\r\nexport type StringDictionary = Record<string, string>;\r\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageable.js","sourceRoot":"","sources":["../../../src/types/pageable.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Interface for paging\n */\nexport interface Pageable\n{\n /**\n * Number of items that should be returned\n */\n size: number;\n\n /**\n * Page number that should be returned\n */\n page: number;\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagedData.js","sourceRoot":"","sources":["../../../src/types/pagedData.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Representation of data that are paged\n */\nexport interface PagedData<TData = unknown>\n{\n /**\n * Reveived data\n */\n content: TData[];\n\n /**\n * Count of all available pages\n */\n totalPages: number;\n\n /**\n * Count of all items that are available\n */\n totalElements: number;\n\n /**\n * Indication that this page is last or not\n */\n last: boolean;\n\n /**\n * Requested number of items\n */\n size: number;\n\n /**\n * Requested page number\n */\n number: number;\n\n /**\n * Indication whether is this first page\n */\n first: boolean;\n\n /**\n * Number of returned items\n */\n numberOfElements: number;\n}"]}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves `PromiseOr` value
|
|
4
|
+
* @param value - Value to be solved
|
|
5
|
+
*/
|
|
6
|
+
export function resolvePromiseOr(value) {
|
|
7
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
if (value instanceof Promise) {
|
|
9
|
+
return yield value;
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=async.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../src/utils/async.ts"],"names":[],"mappings":";AAEA;;;GAGG;AACH,MAAM,UAAgB,gBAAgB,CAAU,KAAyB;;QAErE,IAAG,KAAK,YAAY,OAAO,EAC3B;YACI,OAAO,MAAM,KAAK,CAAC;SACtB;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CAAA","sourcesContent":["import {PromiseOr} from '../types/async';\n\n/**\n * Resolves `PromiseOr` value\n * @param value - Value to be solved\n */\nexport async function resolvePromiseOr<TResult>(value: PromiseOr<TResult>): Promise<TResult>\n{\n if(value instanceof Promise)\n {\n return await value;\n }\n\n return value;\n}\n"]}
|
|
@@ -206,4 +206,20 @@ export function normalizeAccent(value) {
|
|
|
206
206
|
export function asDictionary(instance) {
|
|
207
207
|
return instance;
|
|
208
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* Maps all iterable property values of object to "this" bounded
|
|
211
|
+
* @param this - Object which will be filled with new values
|
|
212
|
+
* @param value - Object holding values that will be used for filling
|
|
213
|
+
* @param all - Indication whether map only existing properties or everything
|
|
214
|
+
*/
|
|
215
|
+
export function mapValuesToThis(value, all = false) {
|
|
216
|
+
if (!value) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
Object.keys(value).forEach(prop => {
|
|
220
|
+
if (value[prop] !== undefined && (all || (prop in this))) {
|
|
221
|
+
this[prop] = value[prop];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
209
225
|
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AAIjC,OAAO,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAEnD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IAErC,OAAO,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5C,CAAC;AAyED;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,YAAuC,EAAE,GAAG,OAA0B;IAEzF,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc;IAErC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB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AU,YAAY,CAAQ,QAAe;IAE/C,OAAO,QAA+B,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAwB,KAAsB,EAAE,MAAe,KAAK;IAE/F,IAAG,CAAC,KAAK,EACT;QACI,OAAO;KACV;IAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAE9B,IAAG,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,EACvD;YACI,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;SAC5B;IACL,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import extendLib from 'extend';\r\n\r\nimport {isPresent} from './lang';\r\nimport {AsDictionary, Dictionary, StringDictionary} from '../types/dictionaries';\r\nimport {Enum} from '../types/enums';\r\nimport {ValueNamePair} from '../types/valueNamePair';\r\nimport {normalize} from '../normalizer/normalizer';\r\n\r\n/**\r\n * Reverse current string and returns new reverse string\r\n * @param str - String to be reversed\r\n * @returns string Reverse string\r\n */\r\nexport function reverseString(str: string): string\r\n{\r\n return str.split('').reverse().join('');\r\n}\r\n\r\n/**\r\n * Extends target object with source\r\n * @param deep - Indication whether deep copy should be performed\r\n * @param target - Object that will extended\r\n * @param source - Object that will be used for extending\r\n */\r\nexport function extend<T, U>(deep: boolean, target: T, source: U): T & U;\r\n/**\r\n * Extends target object with source objects\r\n * @param deep - Indication whether deep copy should be performed\r\n * @param target - Object that will extended\r\n * @param source1 - Object that will be used for extending\r\n * @param source2 - Object that will be used for extending\r\n */\r\nexport function extend<T, U, V>(deep: boolean, target: T, source1: U, source2: V): T & U & V;\r\n/**\r\n * Extends target object with source objects\r\n * @param deep - Indication whether deep copy should be performed\r\n * @param target - Object that will extended\r\n * @param source1 - Object that will be used for extending\r\n * @param source2 - Object that will be used for extending\r\n * @param source3 - Object that will be used for extending\r\n */\r\nexport function extend<T, U, V, W>(deep: boolean, target: T, source1: U, source2: V, source3: W): T & U & V & W;\r\n/**\r\n * Extends target object with source objects\r\n * @param deep - Indication whether deep copy should be performed\r\n * @param target - Object that will extended\r\n * @param source1 - Object that will be used for extending\r\n * @param source2 - Object that will be used for extending\r\n * @param source3 - Object that will be used for extending\r\n * @param source4 - Object that will be used for extending\r\n */\r\nexport function extend<T, U, V, W, X>(deep: boolean, target: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X;\r\n/**\r\n * Extends target object with source\r\n * @param target - Object that will extended\r\n * @param source - Object that will be used for extending\r\n */\r\nexport function extend<T, U>(target: T, source: U): T & U;\r\n/**\r\n * Extends target object with source\r\n * @param target - Object that will extended\r\n * @param source1 - Object that will be used for extending\r\n * @param source2 - Object that will be used for extending\r\n */\r\nexport function extend<T, U, V>(target: T, source1: U, source2: V): T & U & V;\r\n/**\r\n * Extends target object with source\r\n * @param target - Object that will extended\r\n * @param source1 - Object that will be used for extending\r\n * @param source2 - Object that will be used for extending\r\n * @param source3 - Object that will be used for extending\r\n */\r\nexport function extend<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;\r\n/**\r\n * Extends target object with source\r\n * @param target - Object that will extended\r\n * @param source1 - Object that will be used for extending\r\n * @param source2 - Object that will be used for extending\r\n * @param source3 - Object that will be used for extending\r\n * @param source4 - Object that will be used for extending\r\n */\r\nexport function extend<T, U, V, W, X>(target: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X;\r\n/**\r\n * Extends one object with additional properties from other objects, supports deep extend\r\n * @param deepOrObject - Object to be extended or indication that deep copy should be performed\r\n * @param objectN - Objects that will be used for extending, if deep is used first here is target object\r\n * @returns Object Extended object with properties from other objects\r\n */\r\nexport function extend<TResult>(deepOrObject: boolean | Dictionary<any>, ...objectN: Dictionary<any>[]): TResult;\r\n/**\r\n * Extends one object with additional properties from other objects, supports deep extend\r\n * @param deepOrObject - Object to be extended or indication that deep copy should be performed\r\n * @param objectN - Objects that will be used for extending, if deep is used first here is target object\r\n * @returns Object Extended object with properties from other objects\r\n */\r\nexport function extend(deepOrObject: boolean | Dictionary<any>, ...objectN: Dictionary<any>[]): Dictionary\r\n{\r\n return extendLib.apply(null, [deepOrObject, ...objectN]);\r\n}\r\n\r\n/**\r\n * Generates random string consisting from lowercase letters\r\n * @param length - Length of generated string\r\n * @returns number Generated string\r\n */\r\nexport function generateId(length: number): string\r\n{\r\n let result = '';\r\n\r\n for(let x = 0; x < length; x++)\r\n {\r\n result += String.fromCharCode(Math.round(Math.random() * 25 + 97));\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Generates random string of specified length from possible characters\r\n * @param length - Length of generated string\r\n * @param possible - Possible characters used for generation of string\r\n */\r\nexport function generateRandomString(length: number, possible: string = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'): string\r\n{\r\n let text = '';\r\n\r\n for (let i = 0;i < length; i++)\r\n {\r\n text += possible.charAt(Math.floor(Math.random() * possible.length));\r\n }\r\n\r\n return text;\r\n}\r\n\r\n/**\r\n * Converts string in that way that first letter will be lowerCase\r\n * @param text - Text to be converted\r\n */\r\nexport function firstToLowerCase(text: string): string\r\n{\r\n return text.charAt(0).toLowerCase() + text.substr(1);\r\n}\r\n\r\n/**\r\n * Gets indication whether is child descendand of parent\r\n * @param parent - Parent to be tested\r\n * @param child - Child to be looked for\r\n */\r\nexport function isDescendant(parent: HTMLElement, child: HTMLElement): boolean\r\n{\r\n let node = child.parentNode;\r\n\r\n while (node != null)\r\n {\r\n if (node == parent)\r\n {\r\n return true;\r\n }\r\n\r\n node = node.parentNode;\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Computes offset of element against document\r\n * @param element - Html element which offset is counted\r\n * @param doc - Html document to be used for extracting scroll offset\r\n */\r\nexport function offset(element: HTMLElement, doc?: Document)\r\n{\r\n doc = doc || document;\r\n\r\n const rect = element.getBoundingClientRect(),\r\n scrollLeft = window.pageXOffset || doc.documentElement.scrollLeft,\r\n scrollTop = window.pageYOffset || doc.documentElement.scrollTop;\r\n\r\n return {\r\n top: rect.top + scrollTop,\r\n left: rect.left + scrollLeft,\r\n bottom: rect.top + scrollTop + rect.height,\r\n right: rect.left + scrollLeft + rect.width\r\n };\r\n}\r\n\r\n/**\r\n * Converts html string into html DOM\r\n * @param html - Html string to be converted to DOM\r\n * @param doc - Optional html document to be used\r\n */\r\nexport function htmlToElement(html: string, doc?: Document): HTMLElement\r\n{\r\n let htmlDocument = document;\r\n\r\n if(isPresent(doc))\r\n {\r\n htmlDocument = doc;\r\n }\r\n\r\n const template = htmlDocument.createElement('template');\r\n html = html.trim();\r\n template.innerHTML = html;\r\n\r\n return template.content.firstChild as HTMLElement;\r\n}\r\n\r\n/**\r\n * Extract values from enum type\r\n * @param enumType - Enum type that will have extracted values\r\n */\r\nexport function getEnumValues<TEnum extends Enum>(enumType: TEnum): ValueNamePair[]\r\n{\r\n const result: ValueNamePair[] = [];\r\n\r\n Object.keys(enumType).forEach(key =>\r\n {\r\n if(isNaN(+key))\r\n {\r\n return;\r\n }\r\n\r\n result.push(\r\n {\r\n value: key,\r\n name: enumType[+key]\r\n });\r\n });\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Safely returns value from object property using string expression\r\n * @param object - Object which property value will be obtained\r\n * @param expression - Expression for obtaining value\r\n */\r\nexport function getValue<TValue = unknown>(object: Dictionary<any>, expression: string): TValue\r\nexport function getValue(object: Dictionary<any>, expression: string): unknown\r\n{\r\n return expression.split('.').reduce((o, i) =>\r\n {\r\n if(o)\r\n {\r\n return o[i];\r\n }\r\n\r\n return null;\r\n }, object);\r\n}\r\n\r\n/**\r\n * Sets value to objects property using string expression\r\n * @param object - Object which property value will be set\r\n * @param value - Value that will be set\r\n * @param expression - Expression for setting value\r\n */\r\nexport function setValue(object: Dictionary<any>, value: unknown, expression: string): void\r\n{\r\n const parts = expression.split('.');\r\n\r\n parts.forEach((part, index) =>\r\n {\r\n //last item value is assigned\r\n if(index == parts.length - 1)\r\n {\r\n if(isPresent(value))\r\n {\r\n object[part] = value;\r\n }\r\n\r\n return;\r\n }\r\n\r\n object = object[part] = object[part] ?? {};\r\n });\r\n}\r\n\r\n/**\r\n * Formats string using '%s', to print '%s' you have to use '%%s'\r\n * @param str - String containing substitution constants\r\n * @param args - Arguments that are used for replacement\r\n */\r\nexport function format(str: string, ...args: unknown[]): string\r\n{\r\n let i = 0;\r\n\r\n return str.replace(/((?!%).)%s/g, (_sub, substArgs) => `${substArgs[0]}${args[i++]}`).replace(/%%s/g, '%s');\r\n}\r\n\r\n/**\r\n * Performs flatMap over provided array\r\n * @param array - Array to be reduced using flatMap\r\n */\r\nexport function flatMapArray<TItem>(array: TItem[][]): TItem[]\r\n{\r\n return array.reduce((acc, x) => acc.concat(x), []);\r\n}\r\n\r\n/**\r\n * Serialize object to string that is usable as url query parameter\r\n * @param obj - Object to be serialized\r\n * @param replacer - Function that can be used for replacing provided values\r\n */\r\nexport function serializeToUrlQuery<TObj>(obj: TObj, replacer?: (this: any, key: string, value: any) => any): string\r\n{\r\n return btoa(encodeURIComponent(JSON.stringify(obj, replacer)));\r\n}\r\n\r\n/**\r\n * Deserialize value from url query string into object\r\n * @param queryParamValue - Query param string value\r\n * @param reviver - Function that can be used for correctly deserializing value\r\n */\r\nexport function deserializeFromUrlQuery<TObj>(queryParamValue: string, reviver?: (this: any, key: string, value: any) => any): TObj\r\n{\r\n return JSON.parse(decodeURIComponent(atob(queryParamValue)), reviver);\r\n}\r\n\r\n/**\r\n * Converts id to valid html id\r\n * @param id - Id that is going to be converted to valid html id\r\n * @param charMap - Character map used during normalization\r\n */\r\nexport function validHtmlId(id: string, charMap: StringDictionary = {}): string\r\n{\r\n id = id.toLowerCase()\r\n .replace(/[\\s]+/g, '-')\r\n .replace(/\\./g, '')\r\n .replace(/^(\\d)/g, 'x$1');\r\n\r\n id = normalize(id, charMap);\r\n\r\n return id;\r\n}\r\n\r\n/**\r\n * Checks whether is element overflown either horizontal, or vertical\r\n * @param element - Element to be tested for overflow\r\n */\r\nexport function isOverflown(element: HTMLElement): boolean\r\n{\r\n return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;\r\n}\r\n\r\n/**\r\n * Normalizes string, removing accent\r\n * @param value - String to be normalized\r\n */\r\nexport function normalizeAccent(value: string): string\r\n{\r\n return value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '');\r\n}\r\n\r\n/**\r\n * Converts instance of Class to equivalent Record type\r\n * @param instance - Instance which type to be converted\r\n * @typeparam TType - Type of instance\r\n */\r\nexport function asDictionary<TType>(instance: TType): AsDictionary<TType>\r\n{\r\n return instance as AsDictionary<TType>;\r\n}\r\n\r\n/**\r\n * Maps all iterable property values of object to \"this\" bounded\r\n * @param this - Object which will be filled with new values\r\n * @param value - Object holding values that will be used for filling\r\n * @param all - Indication whether map only existing properties or everything\r\n */\r\nexport function mapValuesToThis(this: Dictionary<any>, value: Dictionary<any>, all: boolean = false): void\r\n{\r\n if(!value)\r\n {\r\n return;\r\n }\r\n\r\n Object.keys(value).forEach(prop =>\r\n {\r\n if(value[prop] !== undefined && (all || (prop in this)))\r\n {\r\n this[prop] = value[prop];\r\n }\r\n });\r\n}\r\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../rxjs/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC","sourcesContent":["export * from './types/async';\nexport * from './utils/async';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../../rxjs/src/types/async.ts"],"names":[],"mappings":"","sourcesContent":["import {Observable} from 'rxjs';\n\n/**\n * Type that represents pure value or value obtained by promise or value obtained by Observable\n */\nexport type PromiseObservableOr<TValue> = Observable<TValue>|Promise<TValue>|TValue;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves `PromiseObservableOr` value, if value is Observable then can be completed without value and undefined is resolved
|
|
4
|
+
* @param value - Value to be solved
|
|
5
|
+
*/
|
|
6
|
+
export function resolvePromiseObservableOr(value) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
if (value instanceof Observable) {
|
|
9
|
+
value = value
|
|
10
|
+
.toPromise();
|
|
11
|
+
}
|
|
12
|
+
if (value instanceof Promise) {
|
|
13
|
+
value
|
|
14
|
+
.then(resolve)
|
|
15
|
+
.catch(error => reject(error));
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
resolve(value);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=async.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../../rxjs/src/utils/async.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,MAAM,CAAC;AAGhC;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAU,KAAmC;IAEnF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAEnC,IAAG,KAAK,YAAY,UAAU,EAC9B;YACI,KAAK,GAAG,KAAK;iBACR,SAAS,EAAE,CAAC;SACpB;QAED,IAAG,KAAK,YAAY,OAAO,EAC3B;YACI,KAAK;iBACA,IAAI,CAAC,OAAO,CAAC;iBACb,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAEnC,OAAO;SACV;QAED,OAAO,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import {Observable} from 'rxjs';\nimport {PromiseObservableOr} from '../types/async';\n\n/**\n * Resolves `PromiseObservableOr` value, if value is Observable then can be completed without value and undefined is resolved\n * @param value - Value to be solved\n */\nexport function resolvePromiseObservableOr<TResult>(value: PromiseObservableOr<TResult>): Promise<TResult|undefined>\n{\n return new Promise((resolve, reject) =>\n {\n if(value instanceof Observable)\n {\n value = value\n .toPromise();\n }\n\n if(value instanceof Promise)\n {\n value\n .then(resolve)\n .catch(error => reject(error));\n\n return;\n }\n \n resolve(value);\n });\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|