@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,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Javascript object to encode and/or decode html characters using HTML or Numeric entities that handles double or partial encoding
|
|
3
|
+
* Author: R Reid
|
|
4
|
+
* source: http://www.strictly-software.com/htmlencode
|
|
5
|
+
* Licences: GPL, The MIT License (MIT)
|
|
6
|
+
* Copyright: (c) 2011 Robert Reid - Strictly-Software.com
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
9
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
11
|
+
*
|
|
12
|
+
* Revision:
|
|
13
|
+
* 2011-07-14, Jacques-Yves Bleau:
|
|
14
|
+
* - fixed conversion error with capitalized accentuated characters
|
|
15
|
+
* + converted arr1 and arr2 to object property to remove redundancy
|
|
16
|
+
*
|
|
17
|
+
* Revision:
|
|
18
|
+
* 2011-11-10, Ce-Yi Hio:
|
|
19
|
+
* - fixed conversion error with a number of capitalized entity characters
|
|
20
|
+
*
|
|
21
|
+
* Revision:
|
|
22
|
+
* 2011-11-10, Rob Reid:
|
|
23
|
+
* - changed array format
|
|
24
|
+
*
|
|
25
|
+
* Revision:
|
|
26
|
+
* 2012-09-23, Alex Oss:
|
|
27
|
+
* - replaced string concatonation in numEncode with string builder, push and join for peformance with ammendments by Rob Reid
|
|
28
|
+
*/
|
|
29
|
+
export class Encoder {
|
|
30
|
+
constructor() {
|
|
31
|
+
// When encoding do we convert characters into html or numerical entities
|
|
32
|
+
this.EncodeType = 'entity'; // entity OR numerical
|
|
33
|
+
// arrays for conversion from HTML Entities to Numerical values
|
|
34
|
+
this.arr1 = [' ', '¡', '¢', '£', '¤', '¥', '¦', '§', '¨', '©', 'ª', '«', '¬', '­', '®', '¯', '°', '±', '²', '³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', '"', '&', '<', '>', 'Œ', 'œ', 'Š', 'š', 'Ÿ', 'ˆ', '˜', ' ', ' ', ' ', '‌', '‍', '‎', '‏', '–', '—', '‘', '’', '‚', '“', '”', '„', '†', '‡', '‰', '‹', '›', '€', 'ƒ', 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω', 'α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ', 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'ς', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω', 'ϑ', 'ϒ', 'ϖ', '•', '…', '′', '″', '‾', '⁄', '℘', 'ℑ', 'ℜ', '™', 'ℵ', '←', '↑', '→', '↓', '↔', '↵', '⇐', '⇑', '⇒', '⇓', '⇔', '∀', '∂', '∃', '∅', '∇', '∈', '∉', '∋', '∏', '∑', '−', '∗', '√', '∝', '∞', '∠', '∧', '∨', '∩', '∪', '∫', '∴', '∼', '≅', '≈', '≠', '≡', '≤', '≥', '⊂', '⊃', '⊄', '⊆', '⊇', '⊕', '⊗', '⊥', '⋅', '⌈', '⌉', '⌊', '⌋', '⟨', '⟩', '◊', '♠', '♣', '♥', '♦'];
|
|
35
|
+
this.arr2 = [' ', '¡', '¢', '£', '¤', '¥', '¦', '§', '¨', '©', 'ª', '«', '¬', '­', '®', '¯', '°', '±', '²', '³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', '"', '&', '<', '>', 'Œ', 'œ', 'Š', 'š', 'Ÿ', 'ˆ', '˜', ' ', ' ', ' ', '‌', '‍', '‎', '‏', '–', '—', '‘', '’', '‚', '“', '”', '„', '†', '‡', '‰', '‹', '›', '€', 'ƒ', 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω', 'α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ', 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'ς', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω', 'ϑ', 'ϒ', 'ϖ', '•', '…', '′', '″', '‾', '⁄', '℘', 'ℑ', 'ℜ', '™', 'ℵ', '←', '↑', '→', '↓', '↔', '↵', '⇐', '⇑', '⇒', '⇓', '⇔', '∀', '∂', '∃', '∅', '∇', '∈', '∉', '∋', '∏', '∑', '−', '∗', '√', '∝', '∞', '∠', '∧', '∨', '∩', '∪', '∫', '∴', '∼', '≅', '≈', '≠', '≡', '≤', '≥', '⊂', '⊃', '⊄', '⊆', '⊇', '⊕', '⊗', '⊥', '⋅', '⌈', '⌉', '⌊', '⌋', '〈', '〉', '◊', '♠', '♣', '♥', '♦'];
|
|
36
|
+
}
|
|
37
|
+
isEmpty(val) {
|
|
38
|
+
if (val) {
|
|
39
|
+
return ((val === null) || val.length == 0 || /^\s+$/.test(val));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Convert HTML entities into numerical entities
|
|
46
|
+
HTML2Numerical(s) {
|
|
47
|
+
return this.swapArrayVals(s, this.arr1, this.arr2);
|
|
48
|
+
}
|
|
49
|
+
// Convert Numerical entities into HTML entities
|
|
50
|
+
NumericalToHTML(s) {
|
|
51
|
+
return this.swapArrayVals(s, this.arr2, this.arr1);
|
|
52
|
+
}
|
|
53
|
+
// Numerically encodes all unicode characters
|
|
54
|
+
numEncode(s) {
|
|
55
|
+
if (this.isEmpty(s)) {
|
|
56
|
+
return '';
|
|
57
|
+
}
|
|
58
|
+
const a = [], l = s.length;
|
|
59
|
+
for (let i = 0; i < l; i++) {
|
|
60
|
+
const c = s.charAt(i);
|
|
61
|
+
if (c < ' ' || c > '~') {
|
|
62
|
+
a.push('&#');
|
|
63
|
+
a.push(c.charCodeAt()); //numeric value of code point
|
|
64
|
+
a.push(';');
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
a.push(c);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return a.join('');
|
|
71
|
+
}
|
|
72
|
+
// HTML Decode numerical and HTML entities back to original values
|
|
73
|
+
htmlDecode(s) {
|
|
74
|
+
let c, m, d = s;
|
|
75
|
+
if (this.isEmpty(d)) {
|
|
76
|
+
return '';
|
|
77
|
+
}
|
|
78
|
+
// convert HTML entites back to numerical entites first
|
|
79
|
+
d = this.HTML2Numerical(d);
|
|
80
|
+
// look for numerical entities "
|
|
81
|
+
const arr = d.match(/&#[0-9]{1,5};/g);
|
|
82
|
+
// if no matches found in string then skip
|
|
83
|
+
if (arr != null) {
|
|
84
|
+
for (let x = 0; x < arr.length; x++) {
|
|
85
|
+
m = arr[x];
|
|
86
|
+
c = m.substring(2, m.length - 1); //get numeric part which is refernce to unicode character
|
|
87
|
+
// if its a valid number we can decode
|
|
88
|
+
if (c >= -32768 && c <= 65535) {
|
|
89
|
+
// decode every single match within string
|
|
90
|
+
d = d.replace(m, String.fromCharCode(c));
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
d = d.replace(m, ''); //invalid so replace with nada
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return d;
|
|
98
|
+
}
|
|
99
|
+
// encode an input string into either numerical or HTML entities
|
|
100
|
+
htmlEncode(s, dbl) {
|
|
101
|
+
if (this.isEmpty(s)) {
|
|
102
|
+
return '';
|
|
103
|
+
}
|
|
104
|
+
// do we allow double encoding? E.g will & be turned into &amp;
|
|
105
|
+
dbl = dbl || false; //default to prevent double encoding
|
|
106
|
+
// if allowing double encoding we do ampersands first
|
|
107
|
+
if (dbl) {
|
|
108
|
+
if (this.EncodeType == 'numerical') {
|
|
109
|
+
s = s.replace(/&/g, '&');
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
s = s.replace(/&/g, '&');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// convert the xss chars to numerical entities ' ' < >
|
|
116
|
+
s = this.XSSEncode(s, false);
|
|
117
|
+
if (this.EncodeType == 'numerical' || !dbl) {
|
|
118
|
+
// Now call function that will convert any HTML entities to numerical codes
|
|
119
|
+
s = this.HTML2Numerical(s);
|
|
120
|
+
}
|
|
121
|
+
// Now encode all chars above 127 e.g unicode
|
|
122
|
+
s = this.numEncode(s);
|
|
123
|
+
// now we know anything that needs to be encoded has been converted to numerical entities we
|
|
124
|
+
// can encode any ampersands & that are not part of encoded entities
|
|
125
|
+
// to handle the fact that I need to do a negative check and handle multiple ampersands &&&
|
|
126
|
+
// I am going to use a placeholder
|
|
127
|
+
// if we don't want double encoded entities we ignore the & in existing entities
|
|
128
|
+
if (!dbl) {
|
|
129
|
+
s = s.replace(/&#/g, '##AMPHASH##');
|
|
130
|
+
if (this.EncodeType == 'numerical') {
|
|
131
|
+
s = s.replace(/&/g, '&');
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
s = s.replace(/&/g, '&');
|
|
135
|
+
}
|
|
136
|
+
s = s.replace(/##AMPHASH##/g, '&#');
|
|
137
|
+
}
|
|
138
|
+
// replace any malformed entities
|
|
139
|
+
s = s.replace(/&#\d*([^\d;]|$)/g, '$1');
|
|
140
|
+
if (!dbl) {
|
|
141
|
+
// safety check to correct any double encoded &
|
|
142
|
+
s = this.correctEncoding(s);
|
|
143
|
+
}
|
|
144
|
+
// now do we need to convert our numerical encoded string into entities
|
|
145
|
+
if (this.EncodeType == 'entity') {
|
|
146
|
+
s = this.NumericalToHTML(s);
|
|
147
|
+
}
|
|
148
|
+
return s;
|
|
149
|
+
}
|
|
150
|
+
// Encodes the basic 4 characters used to malform HTML in XSS hacks
|
|
151
|
+
XSSEncode(s, en) {
|
|
152
|
+
if (!this.isEmpty(s)) {
|
|
153
|
+
en = en || true;
|
|
154
|
+
// do we convert to numerical or html entity?
|
|
155
|
+
if (en) {
|
|
156
|
+
s = s.replace(/'/g, '''); //no HTML equivalent as &apos is not cross browser supported
|
|
157
|
+
s = s.replace(/"/g, '"');
|
|
158
|
+
s = s.replace(/</g, '<');
|
|
159
|
+
s = s.replace(/>/g, '>');
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
s = s.replace(/'/g, '''); //no HTML equivalent as &apos is not cross browser supported
|
|
163
|
+
s = s.replace(/"/g, '"');
|
|
164
|
+
s = s.replace(/</g, '<');
|
|
165
|
+
s = s.replace(/>/g, '>');
|
|
166
|
+
}
|
|
167
|
+
return s;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
return '';
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// returns true if a string contains html or numerical encoded entities
|
|
174
|
+
hasEncoded(s) {
|
|
175
|
+
if (/&#[0-9]{1,5};/g.test(s)) {
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
else if (/&[A-Z]{2,6};/gi.test(s)) {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// will remove any unicode characters
|
|
186
|
+
stripUnicode(s) {
|
|
187
|
+
return s.replace(/[^\x20-\x7E]/g, '');
|
|
188
|
+
}
|
|
189
|
+
// corrects any double encoded & entities e.g &amp;
|
|
190
|
+
correctEncoding(s) {
|
|
191
|
+
return s.replace(/(&)(amp;)+/, '$1');
|
|
192
|
+
}
|
|
193
|
+
// Function to loop through an array swaping each item with the value from another array e.g swap HTML entities with Numericals
|
|
194
|
+
swapArrayVals(s, arr1, arr2) {
|
|
195
|
+
if (this.isEmpty(s)) {
|
|
196
|
+
return '';
|
|
197
|
+
}
|
|
198
|
+
let re;
|
|
199
|
+
if (arr1 && arr2) {
|
|
200
|
+
//ShowDebug('in swapArrayVals arr1.length = ' + arr1.length + ' arr2.length = ' + arr2.length)
|
|
201
|
+
// array lengths must match
|
|
202
|
+
if (arr1.length == arr2.length) {
|
|
203
|
+
for (let x = 0, i = arr1.length; x < i; x++) {
|
|
204
|
+
re = new RegExp(arr1[x], 'g');
|
|
205
|
+
s = s.replace(re, arr2[x]); //swap arr1 item with matching item from arr2
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return s;
|
|
210
|
+
}
|
|
211
|
+
inArray(item, arr) {
|
|
212
|
+
for (let i = 0, x = arr.length; i < x; i++) {
|
|
213
|
+
if (arr[i] === item) {
|
|
214
|
+
return i;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return -1;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=encoder.js.map
|
|
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
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Char map for slovak language
|
|
3
|
+
*/
|
|
4
|
+
export const SlovakCharmap = {
|
|
5
|
+
'áä': 'a',
|
|
6
|
+
'éě': 'e',
|
|
7
|
+
'í': 'i',
|
|
8
|
+
'óô': 'o',
|
|
9
|
+
'úů': 'u',
|
|
10
|
+
'ý': 'y',
|
|
11
|
+
'č': 'c',
|
|
12
|
+
'ď': 'd',
|
|
13
|
+
'ľĺ': 'l',
|
|
14
|
+
'ň': 'n',
|
|
15
|
+
'řŕ': 'r',
|
|
16
|
+
'š': 's',
|
|
17
|
+
'ť': 't',
|
|
18
|
+
'ž': 'z',
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=charMaps.js.map
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize strings, removes accent
|
|
3
|
+
* @param str - String to be normalized
|
|
4
|
+
* @param charMap - CharMap used for normalization
|
|
5
|
+
*/
|
|
6
|
+
export function normalize(str, charMap) {
|
|
7
|
+
Object.keys(charMap).forEach(chars => {
|
|
8
|
+
const normalized = charMap[chars];
|
|
9
|
+
const regex = new RegExp('[' + chars + ']', 'gi');
|
|
10
|
+
str = str.replace(regex, normalized);
|
|
11
|
+
});
|
|
12
|
+
return str;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=normalizer.js.map
|
|
File without changes
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class for paging evaluation
|
|
3
|
+
*/
|
|
4
|
+
export class Paginator {
|
|
5
|
+
constructor() {
|
|
6
|
+
//######################### private fields #########################
|
|
7
|
+
/**
|
|
8
|
+
* First page set to paginator
|
|
9
|
+
*/
|
|
10
|
+
this._base = 1;
|
|
11
|
+
/**
|
|
12
|
+
* Number of items per page
|
|
13
|
+
*/
|
|
14
|
+
this._itemsPerPage = 10;
|
|
15
|
+
/**
|
|
16
|
+
* Index of current page
|
|
17
|
+
*/
|
|
18
|
+
this._page = 1;
|
|
19
|
+
/**
|
|
20
|
+
* Number of all items to be used for counting paging
|
|
21
|
+
*/
|
|
22
|
+
this._itemCount = 0;
|
|
23
|
+
}
|
|
24
|
+
//######################### public methods #########################
|
|
25
|
+
/**
|
|
26
|
+
* Sets current page number.
|
|
27
|
+
* @param page - Page number
|
|
28
|
+
* @returns Paginator Provides a fluent interface
|
|
29
|
+
*/
|
|
30
|
+
setPage(page) {
|
|
31
|
+
this._page = page;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns current page number.
|
|
36
|
+
* @returns number Current page number
|
|
37
|
+
*/
|
|
38
|
+
getPage() {
|
|
39
|
+
return this._base + this.getPageIndex();
|
|
40
|
+
}
|
|
41
|
+
/// <summary>
|
|
42
|
+
/// Returns first page number.
|
|
43
|
+
/// </summary>
|
|
44
|
+
/// <returns>Number of first page</returns>
|
|
45
|
+
GetFirstPage() {
|
|
46
|
+
return this._base;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns last page number.
|
|
50
|
+
* @returns number Number of last page
|
|
51
|
+
*/
|
|
52
|
+
getLastPage() {
|
|
53
|
+
return this._base + Math.max(0, this.getPageCount() - 1);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Sets first page (base) number.
|
|
57
|
+
* @param baseVal - Index of base page
|
|
58
|
+
* @returns Paginator Provides a fluent interface
|
|
59
|
+
*/
|
|
60
|
+
setBase(baseVal) {
|
|
61
|
+
this._base = baseVal;
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Returns first page (base) number.
|
|
66
|
+
* @returns number Index of base page
|
|
67
|
+
*/
|
|
68
|
+
getBase() {
|
|
69
|
+
return this._base;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gets indication whether is the current page the first one?
|
|
73
|
+
* @returns boolean True if current page is first one
|
|
74
|
+
*/
|
|
75
|
+
isFirst() {
|
|
76
|
+
return this.getPageIndex() == 0;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Gets indication whether is the current page the last one?
|
|
80
|
+
* @returns boolean True if current page is last one, otherwise false
|
|
81
|
+
*/
|
|
82
|
+
isLast() {
|
|
83
|
+
return this.getPageIndex() == (this.getPageCount() - 1);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Returns the total number of pages.
|
|
87
|
+
* @returns number Total number of pages
|
|
88
|
+
*/
|
|
89
|
+
getPageCount() {
|
|
90
|
+
return Math.ceil(this._itemCount / this._itemsPerPage);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Sets the number of items to display on a single page.
|
|
94
|
+
* @param itemsPerPage - Number of items per page
|
|
95
|
+
* @returns Paginator Provides a fluent interface
|
|
96
|
+
*/
|
|
97
|
+
setItemsPerPage(itemsPerPage) {
|
|
98
|
+
this._itemsPerPage = Math.max(1, itemsPerPage);
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Returns the number of items to display on a single page.
|
|
103
|
+
* @returns number Number of items per one page
|
|
104
|
+
*/
|
|
105
|
+
getItemsPerPage() {
|
|
106
|
+
return this._itemsPerPage;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Sets the total number of items.
|
|
110
|
+
* @param itemCount - Count of items or -1 for infinity
|
|
111
|
+
* @returns Paginator Provides a fluent interface
|
|
112
|
+
*/
|
|
113
|
+
setItemCount(itemCount) {
|
|
114
|
+
this._itemCount = itemCount == -1 ? Number.MAX_VALUE : Math.max(0, itemCount);
|
|
115
|
+
return this;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Returns the total number of items.
|
|
119
|
+
* @returns number Total number of items
|
|
120
|
+
*/
|
|
121
|
+
getItemCount() {
|
|
122
|
+
return this._itemCount;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Returns the absolute index of the first item on current page.
|
|
126
|
+
* @returns number Absolute index of first item
|
|
127
|
+
*/
|
|
128
|
+
getOffset() {
|
|
129
|
+
return this.getPageIndex() * this._itemsPerPage;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Returns the absolute index of the first item on current page in countdown paging.
|
|
133
|
+
* @returns number Countdown offset of first item
|
|
134
|
+
*/
|
|
135
|
+
getCountdownOffset() {
|
|
136
|
+
return Math.max(0, this._itemCount - (this.getPageIndex() + 1) * this._itemsPerPage);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Returns the number of items on current page.
|
|
140
|
+
* @returns number Number of items on page
|
|
141
|
+
*/
|
|
142
|
+
getLength() {
|
|
143
|
+
return Math.min(this._itemsPerPage, this._itemCount - this.getPageIndex() * this._itemsPerPage);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Gets indexes for items on current page (zero-based indexes)
|
|
147
|
+
* @returns number Array of items indexes
|
|
148
|
+
*/
|
|
149
|
+
getIndexesPerPage() {
|
|
150
|
+
const result = [];
|
|
151
|
+
if (isNaN(this.getOffset())) {
|
|
152
|
+
for (let x = 0; x < this.getItemCount(); x++) {
|
|
153
|
+
result.push(x);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
for (let x = this.getOffset(); x < this.getOffset() + this.getLength(); x++) {
|
|
158
|
+
result.push(x);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Gets list of page numbers with specified dispersion
|
|
165
|
+
* @param dispersion - Number identifying dispersion
|
|
166
|
+
* @returns number Page numbers according specified dispersion
|
|
167
|
+
*/
|
|
168
|
+
getPagesWithDispersion(dispersion) {
|
|
169
|
+
const currentPage = this.getPage();
|
|
170
|
+
const pageCount = this.getPageCount();
|
|
171
|
+
const numberOfPages = Math.min(pageCount, Math.max(0, dispersion) * 2 + 1) - 1;
|
|
172
|
+
let startingPage = Math.max(this._base, currentPage - dispersion);
|
|
173
|
+
if ((currentPage + dispersion) > pageCount) {
|
|
174
|
+
startingPage = pageCount - numberOfPages;
|
|
175
|
+
}
|
|
176
|
+
let x;
|
|
177
|
+
const endingPage = startingPage + numberOfPages;
|
|
178
|
+
const result = [];
|
|
179
|
+
for (x = startingPage; x <= endingPage; x++) {
|
|
180
|
+
result.push(x);
|
|
181
|
+
}
|
|
182
|
+
return result;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Gets list of page numbers with specified dispersion, pages are trimmed if current page is near beginning or end
|
|
186
|
+
* @param dispersion - Number identifying dispersion
|
|
187
|
+
* @returns number Page numbers according specified dispersion
|
|
188
|
+
*/
|
|
189
|
+
getPagesWithTrimDispersion(dispersion) {
|
|
190
|
+
const currentPage = this.getPage();
|
|
191
|
+
const lastPage = this.getLastPage();
|
|
192
|
+
const startingPage = Math.max(this._base, currentPage - dispersion);
|
|
193
|
+
let x;
|
|
194
|
+
const endingPage = Math.min(lastPage, currentPage + dispersion);
|
|
195
|
+
const result = [];
|
|
196
|
+
for (x = startingPage; x <= endingPage; x++) {
|
|
197
|
+
result.push(x);
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Gets list of page numbers generated with uniform distribution
|
|
203
|
+
* @param numberOfPages - Number of pages that are going to be uniformly distributed between first and last page (including)
|
|
204
|
+
* @returns number Uniformly distributed page numbers
|
|
205
|
+
*/
|
|
206
|
+
getPagesWithUniformDistribution(numberOfPages) {
|
|
207
|
+
numberOfPages = Math.max(1, numberOfPages - 1);
|
|
208
|
+
const pageCount = this.getPageCount();
|
|
209
|
+
numberOfPages = Math.min(numberOfPages, pageCount - 1);
|
|
210
|
+
const step = pageCount / numberOfPages;
|
|
211
|
+
let page = this.GetFirstPage();
|
|
212
|
+
let x;
|
|
213
|
+
const result = [];
|
|
214
|
+
for (x = 0; x < numberOfPages; x++) {
|
|
215
|
+
result.push(Math.round(page));
|
|
216
|
+
page += step;
|
|
217
|
+
}
|
|
218
|
+
result.push(pageCount);
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
//######################### protected methods #########################
|
|
222
|
+
/**
|
|
223
|
+
* Returns zero-based page number.
|
|
224
|
+
* @returns number Zero-based page number
|
|
225
|
+
*/
|
|
226
|
+
getPageIndex() {
|
|
227
|
+
return Math.min(Math.max(0, this._page - this._base), Math.max(0, this.getPageCount() - 1));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=paginator.js.map
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../src/utils/async.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAU,KAAyB;IAErE,IAAG,KAAK,YAAY,OAAO,EAC3B;QACI,OAAO,MAAM,KAAK,CAAC;KACtB;IAED,OAAO,KAAK,CAAC;AACjB,CAAC","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"]}
|
|
@@ -205,4 +205,20 @@ export function normalizeAccent(value) {
|
|
|
205
205
|
export function asDictionary(instance) {
|
|
206
206
|
return instance;
|
|
207
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Maps all iterable property values of object to "this" bounded
|
|
210
|
+
* @param this - Object which will be filled with new values
|
|
211
|
+
* @param value - Object holding values that will be used for filling
|
|
212
|
+
* @param all - Indication whether map only existing properties or everything
|
|
213
|
+
*/
|
|
214
|
+
export function mapValuesToThis(value, all = false) {
|
|
215
|
+
if (!value) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
Object.keys(value).forEach(prop => {
|
|
219
|
+
if (value[prop] !== undefined && (all || (prop in this))) {
|
|
220
|
+
this[prop] = value[prop];
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
208
224
|
//# sourceMappingURL=common.js.map
|