@sankhyalabs/core-docs 5.20.0-dev.5 → 5.20.0-dev.6
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/README.md +3 -1
- package/classes/ApplicationContext.md +31 -32
- package/classes/ArrayUtils.md +95 -83
- package/classes/AuthorizedServiceCaller.md +25 -34
- package/classes/Change.md +59 -74
- package/classes/DataUnit.md +1017 -1091
- package/classes/DataUnitAction.md +25 -42
- package/classes/DataUnitStorage.md +40 -43
- package/classes/DateUtils.md +133 -126
- package/classes/ElementIDUtils.md +123 -122
- package/classes/ErrorException.md +67 -88
- package/classes/ErrorTracking.md +20 -23
- package/classes/FieldComparator.md +35 -39
- package/classes/FloatingManager.md +195 -198
- package/classes/HTMLBuilder.md +14 -20
- package/classes/HttpProvider.md +45 -41
- package/classes/IDBRepository.md +179 -196
- package/classes/JSUtils.md +65 -66
- package/classes/KeyboardManager.md +95 -87
- package/classes/{MaskFormatter-1.md → MaskFormatter.md} +81 -120
- package/classes/NumberUtils.md +163 -152
- package/classes/ObjectUtils.md +66 -71
- package/classes/OnboardingUtils.md +36 -51
- package/classes/PromiseSync.md +25 -42
- package/classes/ReadyUtil.md +31 -41
- package/classes/RequestMetadata.md +29 -30
- package/classes/SearchUtils.md +18 -20
- package/classes/SelectionInfo.md +59 -74
- package/classes/SkwHttpProvider.md +33 -45
- package/classes/StringUtils.md +297 -322
- package/classes/TimeFormatter.md +43 -44
- package/classes/UserAgentUtils.md +17 -20
- package/classes/VersionUtils.md +15 -18
- package/classes/WaitingChangeException.md +63 -84
- package/classes/WarningException.md +67 -88
- package/enumerations/Action.md +297 -0
- package/enumerations/ChangeOperation.md +47 -0
- package/enumerations/DataType.md +57 -0
- package/enumerations/DependencyType.md +37 -0
- package/enumerations/SelectionMode.md +27 -0
- package/enumerations/SortMode.md +27 -0
- package/enumerations/UserInterface.md +177 -0
- package/functions/defaultDataLoader.md +25 -0
- package/{modules.md → globals.md} +17 -39
- package/interfaces/ChildDescriptor.md +12 -16
- package/interfaces/ChildLink.md +9 -12
- package/interfaces/DUActionInterceptor.md +10 -14
- package/interfaces/ExecutionContext.md +17 -32
- package/interfaces/FieldDescriptor.md +52 -66
- package/interfaces/Filter.md +13 -17
- package/interfaces/IElementIDInfo.md +11 -14
- package/interfaces/ILoadResult.md +11 -16
- package/interfaces/IRepository.md +88 -93
- package/interfaces/IRepositoryIndex.md +23 -30
- package/interfaces/LoadDataRequest.md +36 -45
- package/interfaces/LoadDataResponse.md +11 -14
- package/interfaces/PageRequest.md +16 -20
- package/interfaces/PaginationInfo.md +24 -31
- package/interfaces/PromiseSyncCallback.md +13 -17
- package/interfaces/QuickFilter.md +17 -21
- package/interfaces/Record.md +26 -33
- package/interfaces/SavedRecord.md +33 -41
- package/interfaces/Sort.md +12 -16
- package/interfaces/SortingProvider.md +10 -13
- package/interfaces/UnitMetadata.md +16 -21
- package/interfaces/WaitingChange.md +16 -20
- package/namespaces/MaskFormatter/README.md +17 -0
- package/namespaces/MaskFormatter/type-aliases/MaskCharacter.md +13 -0
- package/namespaces/MaskFormatter/variables/MaskCharacter.md +13 -0
- package/package.json +1 -1
- package/enums/Action.md +0 -305
- package/enums/ChangeOperation.md +0 -52
- package/enums/DataType.md +0 -63
- package/enums/DependencyType.md +0 -41
- package/enums/SelectionMode.md +0 -30
- package/enums/SortMode.md +0 -30
- package/enums/UserInterface.md +0 -195
- package/modules/MaskFormatter.md +0 -37
package/classes/NumberUtils.md
CHANGED
@@ -1,83 +1,74 @@
|
|
1
|
-
[
|
1
|
+
[**@sankhyalabs/core**](../README.md) • **Docs**
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@sankhyalabs/core](../globals.md) / NumberUtils
|
2
6
|
|
3
7
|
# Class: NumberUtils
|
4
8
|
|
5
9
|
`NumberUtils`: Utilizado para manipulação de numerais.
|
6
10
|
|
7
|
-
##
|
11
|
+
## Constructors
|
8
12
|
|
9
|
-
###
|
13
|
+
### new NumberUtils()
|
10
14
|
|
11
|
-
|
15
|
+
> **new NumberUtils**(): [`NumberUtils`](NumberUtils.md)
|
12
16
|
|
13
|
-
|
17
|
+
#### Returns
|
14
18
|
|
15
|
-
|
16
|
-
- [compare](NumberUtils.md#compare)
|
17
|
-
- [format](NumberUtils.md#format)
|
18
|
-
- [getValueOrDefault](NumberUtils.md#getvalueordefault)
|
19
|
-
- [getValueOrZero](NumberUtils.md#getvalueorzero)
|
20
|
-
- [keepOnlyDecimalSeparator](NumberUtils.md#keeponlydecimalseparator)
|
21
|
-
- [round](NumberUtils.md#round)
|
22
|
-
- [safeFormat](NumberUtils.md#safeformat)
|
23
|
-
- [stringToNumber](NumberUtils.md#stringtonumber)
|
19
|
+
[`NumberUtils`](NumberUtils.md)
|
24
20
|
|
25
|
-
##
|
21
|
+
## Methods
|
26
22
|
|
27
|
-
###
|
23
|
+
### changeFormat()
|
28
24
|
|
29
|
-
|
25
|
+
> `static` **changeFormat**(`value`): `string`
|
30
26
|
|
31
|
-
|
27
|
+
Troca o formato do numeral(string) de "PT-BR" para "EN-US" e vice-versa.
|
32
28
|
|
33
|
-
|
29
|
+
#### Parameters
|
34
30
|
|
35
|
-
|
31
|
+
• **value**: `string`
|
36
32
|
|
37
|
-
|
33
|
+
Numeral em formato de string a ser convertido.
|
34
|
+
|
35
|
+
#### Returns
|
36
|
+
|
37
|
+
`string`
|
38
|
+
|
39
|
+
- Numeral em formato de string formatado de "PT-BR" para "EN-US" e vice-versa.
|
38
40
|
|
39
|
-
|
41
|
+
#### Examples
|
40
42
|
|
41
43
|
```ts
|
42
44
|
Informo: "15,55" | Obtenho: "15.55"
|
43
45
|
```
|
44
46
|
|
45
|
-
**`Example`**
|
46
|
-
|
47
47
|
```ts
|
48
48
|
Informo: "27.99" | Obtenho: "27,99"
|
49
49
|
```
|
50
50
|
|
51
|
-
####
|
52
|
-
|
53
|
-
| Name | Type | Description |
|
54
|
-
| :------ | :------ | :------ |
|
55
|
-
| `value` | `string` | Numeral em formato de string a ser convertido. |
|
56
|
-
|
57
|
-
#### Returns
|
58
|
-
|
59
|
-
`string`
|
60
|
-
|
61
|
-
- Numeral em formato de string formatado de "PT-BR" para "EN-US" e vice-versa.
|
62
|
-
|
63
|
-
#### Defined in
|
51
|
+
#### Source
|
64
52
|
|
65
53
|
src/utils/NumberUtils.ts:186
|
66
54
|
|
67
|
-
|
55
|
+
***
|
68
56
|
|
69
|
-
### compare
|
57
|
+
### compare()
|
70
58
|
|
71
|
-
|
59
|
+
> `static` **compare**(`a`, `b`): `number`
|
72
60
|
|
73
61
|
Determina a ordem de umeros.
|
74
62
|
|
75
63
|
#### Parameters
|
76
64
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
65
|
+
• **a**: `number`
|
66
|
+
|
67
|
+
Primeio número para comparação.
|
68
|
+
|
69
|
+
• **b**: `number`
|
70
|
+
|
71
|
+
Segundo número para comparação.
|
81
72
|
|
82
73
|
#### Returns
|
83
74
|
|
@@ -85,34 +76,35 @@ Determina a ordem de umeros.
|
|
85
76
|
|
86
77
|
- Um numeral negativo se o primeiro argumento é menor que o segundo, zero se os dois são iguais e um numeral positivo quando o primeiro é maior que o segundo.
|
87
78
|
|
88
|
-
####
|
79
|
+
#### Source
|
89
80
|
|
90
81
|
src/utils/NumberUtils.ts:267
|
91
82
|
|
92
|
-
|
83
|
+
***
|
93
84
|
|
94
|
-
### format
|
85
|
+
### format()
|
95
86
|
|
96
|
-
|
87
|
+
> `static` **format**(`value`, `precision`, `prettyPrecision`, `defaultValue`): `string`
|
97
88
|
|
98
89
|
Formata o numeral com a precisão informada.
|
99
90
|
|
100
|
-
|
91
|
+
#### Parameters
|
101
92
|
|
102
|
-
|
103
|
-
Informado: ('10,9845444', 3, 3) | Retorna: '10,985'
|
104
|
-
Informado: (undefined, 3, 3) | Retorna: NaN
|
105
|
-
Informado: (undefined, 3, 3, '0,00') | Retorna: 0,00
|
106
|
-
```
|
93
|
+
• **value**: `string`
|
107
94
|
|
108
|
-
|
95
|
+
Numeral em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico - sem separador de milhares: ######.##).
|
96
|
+
|
97
|
+
• **precision**: `number`
|
98
|
+
|
99
|
+
Quantidade de casas decimais.
|
100
|
+
|
101
|
+
• **prettyPrecision**: `number`= `NaN`
|
109
102
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
| `defaultValue` | `string` | `undefined` | Valor padrão caso o value não seja um valor numérico válido. |
|
103
|
+
Quantidade de zeros nos decimais.
|
104
|
+
|
105
|
+
• **defaultValue**: `string`= `undefined`
|
106
|
+
|
107
|
+
Valor padrão caso o value não seja um valor numérico válido.
|
116
108
|
|
117
109
|
#### Returns
|
118
110
|
|
@@ -120,66 +112,73 @@ Informado: (undefined, 3, 3, '0,00') | Retorna: 0,00
|
|
120
112
|
|
121
113
|
- Numeral em formato de String formatado em PT-BR.
|
122
114
|
|
123
|
-
####
|
115
|
+
#### Example
|
116
|
+
|
117
|
+
```ts
|
118
|
+
Informado: ('10,9845444', 3, 3) | Retorna: '10,985'
|
119
|
+
Informado: (undefined, 3, 3) | Retorna: NaN
|
120
|
+
Informado: (undefined, 3, 3, '0,00') | Retorna: 0,00
|
121
|
+
```
|
122
|
+
|
123
|
+
#### Source
|
124
124
|
|
125
125
|
src/utils/NumberUtils.ts:77
|
126
126
|
|
127
|
-
|
127
|
+
***
|
128
128
|
|
129
|
-
### getValueOrDefault
|
129
|
+
### getValueOrDefault()
|
130
130
|
|
131
|
-
|
131
|
+
> `static` **getValueOrDefault**(`value`, `defaultValue`): `number`
|
132
132
|
|
133
133
|
Obtém o valor ou o valor padrão, caso o valor seja inválido(NaN/undefined).
|
134
134
|
|
135
|
-
|
135
|
+
#### Parameters
|
136
|
+
|
137
|
+
• **value**: `any`
|
138
|
+
|
139
|
+
Valor a ser validado.
|
140
|
+
|
141
|
+
• **defaultValue**: `number`
|
142
|
+
|
143
|
+
Valor padrão a ser retornado caso o value seja inválido.
|
144
|
+
|
145
|
+
#### Returns
|
146
|
+
|
147
|
+
`number`
|
148
|
+
|
149
|
+
- O próprio numeral passado ou zero.
|
150
|
+
|
151
|
+
#### Examples
|
136
152
|
|
137
153
|
```ts
|
138
154
|
Informo: value: 30, defaultValue: 0 | Obtenho: 30
|
139
155
|
```
|
140
156
|
|
141
|
-
**`Example`**
|
142
|
-
|
143
157
|
```ts
|
144
158
|
Informo: value: "30", defaultValue: 0 | Obtenho: 30
|
145
159
|
```
|
146
160
|
|
147
|
-
**`Example`**
|
148
|
-
|
149
161
|
```ts
|
150
162
|
Informo: value: "30abc", defaultValue: 0 | Obtenho: 0
|
151
163
|
```
|
152
164
|
|
153
|
-
####
|
154
|
-
|
155
|
-
| Name | Type | Description |
|
156
|
-
| :------ | :------ | :------ |
|
157
|
-
| `value` | `any` | Valor a ser validado. |
|
158
|
-
| `defaultValue` | `number` | Valor padrão a ser retornado caso o value seja inválido. |
|
159
|
-
|
160
|
-
#### Returns
|
161
|
-
|
162
|
-
`number`
|
163
|
-
|
164
|
-
- O próprio numeral passado ou zero.
|
165
|
-
|
166
|
-
#### Defined in
|
165
|
+
#### Source
|
167
166
|
|
168
167
|
src/utils/NumberUtils.ts:208
|
169
168
|
|
170
|
-
|
169
|
+
***
|
171
170
|
|
172
|
-
### getValueOrZero
|
171
|
+
### getValueOrZero()
|
173
172
|
|
174
|
-
|
173
|
+
> `static` **getValueOrZero**(`value`): `number`
|
175
174
|
|
176
175
|
Obtém o valor ou zero, caso o valor seja inválido(NaN/undefined).
|
177
176
|
|
178
177
|
#### Parameters
|
179
178
|
|
180
|
-
|
181
|
-
|
182
|
-
|
179
|
+
• **value**: `any`
|
180
|
+
|
181
|
+
Numeral a ser validado.
|
183
182
|
|
184
183
|
#### Returns
|
185
184
|
|
@@ -187,30 +186,27 @@ Obtém o valor ou zero, caso o valor seja inválido(NaN/undefined).
|
|
187
186
|
|
188
187
|
- O próprio numeral passado. Caso esse seja inválido retorna zero.
|
189
188
|
|
190
|
-
####
|
189
|
+
#### Source
|
191
190
|
|
192
191
|
src/utils/NumberUtils.ts:227
|
193
192
|
|
194
|
-
|
193
|
+
***
|
195
194
|
|
196
|
-
### keepOnlyDecimalSeparator
|
195
|
+
### keepOnlyDecimalSeparator()
|
197
196
|
|
198
|
-
|
197
|
+
> `static` **keepOnlyDecimalSeparator**(`value`, `formatnumber`): `string`
|
199
198
|
|
200
199
|
Retira os separadores de milhar de um numeral em formato de string.
|
201
200
|
|
202
|
-
|
201
|
+
#### Parameters
|
203
202
|
|
204
|
-
|
205
|
-
Informado: '95.12' | Retorna: '9512'
|
206
|
-
```
|
203
|
+
• **value**: `string`
|
207
204
|
|
208
|
-
|
205
|
+
Numeral em formato de string a ser convertido.
|
206
|
+
|
207
|
+
• **formatnumber**: `string`= `'pt-BR'`
|
209
208
|
|
210
|
-
|
211
|
-
| :------ | :------ | :------ | :------ |
|
212
|
-
| `value` | `string` | `undefined` | Numeral em formato de string a ser convertido. |
|
213
|
-
| `formatnumber` | `string` | `'pt-BR'` | Formatação de ENTRADA e SAÍDA do utilitário: pt-BR="###.###,##" en-US="###,###.##"; Default: "pt-BR". |
|
209
|
+
Formatação de ENTRADA e SAÍDA do utilitário: pt-BR="###.###,##" en-US="###,###.##"; Default: "pt-BR".
|
214
210
|
|
215
211
|
#### Returns
|
216
212
|
|
@@ -218,19 +214,41 @@ Informado: '95.12' | Retorna: '9512'
|
|
218
214
|
|
219
215
|
- Numeral em formato de string formatado apenas com separador decimal.
|
220
216
|
|
221
|
-
####
|
217
|
+
#### Example
|
218
|
+
|
219
|
+
```ts
|
220
|
+
Informado: '95.12' | Retorna: '9512'
|
221
|
+
```
|
222
|
+
|
223
|
+
#### Source
|
222
224
|
|
223
225
|
src/utils/NumberUtils.ts:158
|
224
226
|
|
225
|
-
|
227
|
+
***
|
226
228
|
|
227
|
-
### round
|
229
|
+
### round()
|
228
230
|
|
229
|
-
|
231
|
+
> `static` **round**(`value`, `decimals`): `number`
|
230
232
|
|
231
233
|
Realiza o arredondamento de casas decimais de um numero.
|
232
234
|
|
233
|
-
|
235
|
+
#### Parameters
|
236
|
+
|
237
|
+
• **value**: `number`
|
238
|
+
|
239
|
+
Numeral a ser arredondado.
|
240
|
+
|
241
|
+
• **decimals**: `number`= `2`
|
242
|
+
|
243
|
+
Quantidade de casas decimais ussada no arredondamento.
|
244
|
+
|
245
|
+
#### Returns
|
246
|
+
|
247
|
+
`number`
|
248
|
+
|
249
|
+
- O próprio numeral arredondado com a quantidade de casas decimais do argumento decimals.
|
250
|
+
|
251
|
+
#### Example
|
234
252
|
|
235
253
|
```ts
|
236
254
|
Informo: (100.12) | 100.12
|
@@ -249,65 +267,70 @@ Informo: ("100.16", 2) | 100.16
|
|
249
267
|
Informo: ("100.16", 3) | 100.16
|
250
268
|
```
|
251
269
|
|
252
|
-
####
|
270
|
+
#### Source
|
253
271
|
|
254
|
-
|
255
|
-
| :------ | :------ | :------ | :------ |
|
256
|
-
| `value` | `number` | `undefined` | Numeral a ser arredondado. |
|
257
|
-
| `decimals` | `number` | `2` | Quantidade de casas decimais ussada no arredondamento. |
|
272
|
+
src/utils/NumberUtils.ts:255
|
258
273
|
|
259
|
-
|
274
|
+
***
|
260
275
|
|
261
|
-
|
276
|
+
### safeFormat()
|
262
277
|
|
263
|
-
|
278
|
+
> `static` **safeFormat**(`value`, `precision`, `prettyPrecision`): `string`
|
264
279
|
|
265
|
-
|
280
|
+
Formata o numeral com a precisão informada e o valor default 0,00 caso o value não seja um numero valido.
|
266
281
|
|
267
|
-
|
282
|
+
#### Parameters
|
268
283
|
|
269
|
-
|
284
|
+
• **value**: `string`
|
270
285
|
|
271
|
-
|
286
|
+
Numeral em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico - sem separador de milhares: ######.##).
|
272
287
|
|
273
|
-
|
288
|
+
• **precision**: `number`
|
274
289
|
|
275
|
-
|
290
|
+
Quantidade de casas decimais.
|
276
291
|
|
277
|
-
|
292
|
+
• **prettyPrecision**: `number`= `NaN`
|
293
|
+
|
294
|
+
Quantidade de zeros nos decimais.
|
295
|
+
|
296
|
+
#### Returns
|
297
|
+
|
298
|
+
`string`
|
299
|
+
|
300
|
+
- Numeral em formato de String formatado em PT-BR.
|
301
|
+
|
302
|
+
#### Example
|
278
303
|
|
279
304
|
```ts
|
280
305
|
Informado: ('10,9845444', 3, 3) | Retorna: '10,985'
|
281
306
|
Informado: (undefined, 3, 3) | Retorna: 0,00
|
282
307
|
```
|
283
308
|
|
284
|
-
####
|
309
|
+
#### Source
|
285
310
|
|
286
|
-
|
287
|
-
| :------ | :------ | :------ | :------ |
|
288
|
-
| `value` | `string` | `undefined` | Numeral em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico - sem separador de milhares: ######.##). |
|
289
|
-
| `precision` | `number` | `undefined` | Quantidade de casas decimais. |
|
290
|
-
| `prettyPrecision` | `number` | `NaN` | Quantidade de zeros nos decimais. |
|
311
|
+
src/utils/NumberUtils.ts:143
|
291
312
|
|
292
|
-
|
313
|
+
***
|
293
314
|
|
294
|
-
|
315
|
+
### stringToNumber()
|
295
316
|
|
296
|
-
|
317
|
+
> `static` **stringToNumber**(`value`): `number`
|
297
318
|
|
298
|
-
|
319
|
+
Converte o dado numérico de string para number.
|
299
320
|
|
300
|
-
|
321
|
+
#### Parameters
|
301
322
|
|
302
|
-
|
323
|
+
• **value**: `string`
|
303
324
|
|
304
|
-
|
325
|
+
Numeral em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico: ######.##).
|
305
326
|
|
306
|
-
|
327
|
+
#### Returns
|
307
328
|
|
308
|
-
|
329
|
+
`number`
|
330
|
+
|
331
|
+
- Numeral passado.
|
309
332
|
|
310
|
-
|
333
|
+
#### Example
|
311
334
|
|
312
335
|
```ts
|
313
336
|
@"100,12" | 100.12
|
@@ -318,18 +341,6 @@ Converte o dado numérico de string para number.
|
|
318
341
|
@"string" | NaN
|
319
342
|
```
|
320
343
|
|
321
|
-
####
|
322
|
-
|
323
|
-
| Name | Type | Description |
|
324
|
-
| :------ | :------ | :------ |
|
325
|
-
| `value` | `string` | Numeral em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico: ######.##). |
|
326
|
-
|
327
|
-
#### Returns
|
328
|
-
|
329
|
-
`number`
|
330
|
-
|
331
|
-
- Numeral passado.
|
332
|
-
|
333
|
-
#### Defined in
|
344
|
+
#### Source
|
334
345
|
|
335
346
|
src/utils/NumberUtils.ts:22
|