@sankhyalabs/core 2.3.6 → 2.4.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/.docs/classes/ApplicationContext.md +24 -10
- package/.docs/classes/ArrayUtils.md +24 -14
- package/.docs/classes/Change.md +40 -18
- package/.docs/classes/DataUnit.md +418 -225
- package/.docs/classes/DateUtils.md +95 -36
- package/.docs/classes/ElementIDUtils.md +70 -37
- package/.docs/classes/ErrorException.md +12 -4
- package/.docs/classes/ErrorTracking.md +13 -5
- package/.docs/classes/FloatingManager.md +104 -63
- package/.docs/classes/MaskFormatter-1.md +17 -17
- package/.docs/classes/NumberUtils.md +74 -35
- package/.docs/classes/ObjectUtils.md +34 -12
- package/.docs/classes/ReadyUtil.md +18 -6
- package/.docs/classes/StringUtils.md +108 -52
- package/.docs/classes/TimeFormatter.md +9 -9
- package/.docs/classes/UserAgentUtils.md +12 -2
- package/.docs/classes/WaitingChangeException.md +9 -3
- package/.docs/classes/WarningException.md +12 -4
- package/.docs/enums/ChangeOperation.md +4 -4
- package/.docs/enums/DataType.md +5 -5
- package/.docs/interfaces/DUActionInterceptor.md +1 -1
- package/.docs/interfaces/LoadDataRequest.md +17 -5
- package/.docs/interfaces/LoadDataResponse.md +8 -2
- package/.docs/interfaces/PageRequest.md +3 -3
- package/.docs/interfaces/PaginationInfo.md +17 -5
- package/.docs/interfaces/QuickFilter.md +2 -2
- package/.docs/interfaces/Record.md +2 -2
- package/.docs/interfaces/SavedRecord.md +3 -3
- package/.docs/interfaces/WaitingChange.md +3 -3
- package/.docs/modules/MaskFormatter.md +2 -2
- package/.releaserc +1 -1
- package/.reusable-default-scripts.yml +4 -2
- package/build.env +0 -2
- package/dist/dataunit/DataUnit.d.ts +516 -7
- package/dist/dataunit/DataUnit.js +511 -3
- package/dist/dataunit/DataUnit.js.map +1 -1
- package/dist/dataunit/loading/LoadDataRequest.d.ts +6 -0
- package/dist/dataunit/loading/LoadDataResponse.d.ts +3 -0
- package/dist/dataunit/loading/PaginationInfo.d.ts +6 -0
- package/dist/dataunit/metadata/DataType.d.ts +44 -0
- package/dist/dataunit/metadata/DataType.js +45 -0
- package/dist/dataunit/metadata/DataType.js.map +1 -1
- package/dist/exceptions/ErrorException.d.ts +6 -0
- package/dist/exceptions/ErrorException.js +3 -0
- package/dist/exceptions/ErrorException.js.map +1 -1
- package/dist/exceptions/WaitingChangeException.d.ts +5 -0
- package/dist/exceptions/WaitingChangeException.js +3 -0
- package/dist/exceptions/WaitingChangeException.js.map +1 -1
- package/dist/exceptions/WarningException.d.ts +6 -0
- package/dist/exceptions/WarningException.js +3 -0
- package/dist/exceptions/WarningException.js.map +1 -1
- package/dist/traking/ErrorTraking.d.ts +15 -0
- package/dist/traking/ErrorTraking.js +15 -0
- package/dist/traking/ErrorTraking.js.map +1 -1
- package/dist/ui/FloatingManager.d.ts +114 -0
- package/dist/ui/FloatingManager.js +128 -0
- package/dist/ui/FloatingManager.js.map +1 -1
- package/dist/utils/ApplicationContext.d.ts +21 -0
- package/dist/utils/ApplicationContext.js +21 -0
- package/dist/utils/ApplicationContext.js.map +1 -1
- package/dist/utils/ArrayUtils.d.ts +19 -4
- package/dist/utils/ArrayUtils.js +19 -4
- package/dist/utils/ArrayUtils.js.map +1 -1
- package/dist/utils/CriteriaModel.d.ts +2 -4
- package/dist/utils/CriteriaModel.js +3 -5
- package/dist/utils/CriteriaModel.js.map +1 -1
- package/dist/utils/DateUtils.d.ts +63 -0
- package/dist/utils/DateUtils.js +63 -1
- package/dist/utils/DateUtils.js.map +1 -1
- package/dist/utils/ElementIDUtils.d.ts +51 -0
- package/dist/utils/ElementIDUtils.js +51 -0
- package/dist/utils/ElementIDUtils.js.map +1 -1
- package/dist/utils/MaskFormatter.d.ts +45 -24
- package/dist/utils/MaskFormatter.js +99 -25
- package/dist/utils/MaskFormatter.js.map +1 -1
- package/dist/utils/NumberUtils.d.ts +39 -31
- package/dist/utils/NumberUtils.js +39 -31
- package/dist/utils/NumberUtils.js.map +1 -1
- package/dist/utils/ObjectUtils.d.ts +27 -0
- package/dist/utils/ObjectUtils.js +27 -0
- package/dist/utils/ObjectUtils.js.map +1 -1
- package/dist/utils/ReadyUtil.d.ts +16 -0
- package/dist/utils/ReadyUtil.js +16 -0
- package/dist/utils/ReadyUtil.js.map +1 -1
- package/dist/utils/StringUtils.d.ts +72 -28
- package/dist/utils/StringUtils.js +72 -28
- package/dist/utils/StringUtils.js.map +1 -1
- package/dist/utils/TimeFormatter.d.ts +9 -9
- package/dist/utils/TimeFormatter.js +10 -10
- package/dist/utils/TimeFormatter.js.map +1 -1
- package/dist/utils/UserAgentUtils/index.d.ts +11 -0
- package/dist/utils/UserAgentUtils/index.js +11 -0
- package/dist/utils/UserAgentUtils/index.js.map +1 -1
- package/package.json +1 -1
- package/publish-docs.sh +1 -2
- package/src/dataunit/DataUnit.ts +520 -10
- package/src/dataunit/loading/LoadDataRequest.ts +10 -0
- package/src/dataunit/loading/LoadDataResponse.ts +4 -0
- package/src/dataunit/loading/PaginationInfo.ts +11 -1
- package/src/dataunit/metadata/DataType.ts +47 -1
- package/src/exceptions/ErrorException.ts +8 -0
- package/src/exceptions/WaitingChangeException.ts +6 -1
- package/src/exceptions/WarningException.ts +8 -1
- package/src/traking/ErrorTraking.ts +17 -0
- package/src/ui/FloatingManager.ts +138 -7
- package/src/utils/ApplicationContext.ts +21 -0
- package/src/utils/ArrayUtils.ts +19 -5
- package/src/utils/CriteriaModel.ts +3 -5
- package/src/utils/DateUtils.ts +70 -6
- package/src/utils/ElementIDUtils.ts +52 -4
- package/src/utils/MaskFormatter.ts +103 -27
- package/src/utils/NumberUtils.ts +40 -36
- package/src/utils/ObjectUtils.ts +28 -0
- package/src/utils/ReadyUtil.ts +16 -0
- package/src/utils/StringUtils.ts +73 -29
- package/src/utils/TimeFormatter.ts +10 -10
- package/src/utils/UserAgentUtils/index.ts +12 -0
package/src/utils/ReadyUtil.ts
CHANGED
|
@@ -1,22 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ReadyUtil`: Registra processos que serão invocados após a conclusão de operações.
|
|
3
|
+
*/
|
|
1
4
|
export default class ReadyUtil{
|
|
2
5
|
private resolve:any;
|
|
3
6
|
private promise:any;
|
|
4
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Limpa o estado da instancia ao finalizar a execução do processo registrado.
|
|
10
|
+
*/
|
|
5
11
|
private clean() {
|
|
6
12
|
this.resolve = undefined;
|
|
7
13
|
this.promise = undefined;
|
|
8
14
|
}
|
|
9
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Inicializa o estado da instancia ao registrar processo.
|
|
18
|
+
*/
|
|
10
19
|
private start() {
|
|
11
20
|
if(!this.promise) this.promise = new Promise((accept) => {
|
|
12
21
|
this.resolve = () => accept(true);
|
|
13
22
|
})
|
|
14
23
|
}
|
|
15
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Executa processo atribuído.
|
|
27
|
+
*/
|
|
16
28
|
end(){
|
|
17
29
|
this.resolve && this.resolve();
|
|
18
30
|
}
|
|
19
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Atribui processo que será executado por operações que o invocarem no método 'end'.
|
|
34
|
+
* @returns Promise que deve conter o código do processo.
|
|
35
|
+
*/
|
|
20
36
|
whenReady(){
|
|
21
37
|
this.start();
|
|
22
38
|
return new Promise((accept) => {
|
package/src/utils/StringUtils.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* `StringUtils`: Utilizado para manipulação de Strings.
|
|
3
3
|
*/
|
|
4
4
|
export class StringUtils {
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Retorna se a string está vazia.
|
|
8
8
|
* Valores null e undefined são considerados como vazio.
|
|
9
9
|
*
|
|
10
|
-
* @param value
|
|
10
|
+
* @param value - String para ser validada.
|
|
11
|
+
* @returns - Verdadeiro caso a string não contenha informação.
|
|
12
|
+
*
|
|
11
13
|
*/
|
|
12
14
|
static isEmpty(value: any): Boolean {
|
|
13
15
|
|
|
@@ -48,7 +50,7 @@ export class StringUtils {
|
|
|
48
50
|
* @param text String para ser transformada.
|
|
49
51
|
* @example entrada: "<Teste>" // retorno: "<Teste>"
|
|
50
52
|
*/
|
|
51
|
-
|
|
53
|
+
static decodeHtmlEntities(text: string): string {
|
|
52
54
|
const entities = [
|
|
53
55
|
['amp', '&'],
|
|
54
56
|
['apos', '\''],
|
|
@@ -108,7 +110,8 @@ export class StringUtils {
|
|
|
108
110
|
|
|
109
111
|
/**
|
|
110
112
|
* Remove acentos de vogais, substitui Ç por c e retorna a string em caixa alta mantendo espaços e símbolos.
|
|
111
|
-
* @param text
|
|
113
|
+
* @param text - Texto para ser transformado.
|
|
114
|
+
* @returns - Texto sem acentuação e caixa alta, mantendo espaços e símbolos.
|
|
112
115
|
*/
|
|
113
116
|
static replaceAccentuatedCharsKeepSymbols(text: string): string {
|
|
114
117
|
return text.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toUpperCase();
|
|
@@ -117,6 +120,9 @@ export class StringUtils {
|
|
|
117
120
|
/**
|
|
118
121
|
* Calcula um código hash para uma string.
|
|
119
122
|
* @param value String que será gerado o hash code.
|
|
123
|
+
* @returns - Um hash calculado com base no valor informado.
|
|
124
|
+
* @example
|
|
125
|
+
* Informado: '123456' | Retorna: 1450575459
|
|
120
126
|
*/
|
|
121
127
|
static hashCode(value: string): string {
|
|
122
128
|
let hash = 0, i, chr;
|
|
@@ -130,9 +136,14 @@ export class StringUtils {
|
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
/**
|
|
133
|
-
* Converte um
|
|
134
|
-
*
|
|
135
|
-
* @param
|
|
139
|
+
* Converte um texto do tipo string para um booleano.
|
|
140
|
+
*
|
|
141
|
+
* @param value Valor a ser convertido.
|
|
142
|
+
* @param defaultValue Valor padrão.
|
|
143
|
+
* @returns - Texto convertido.
|
|
144
|
+
* @example
|
|
145
|
+
* Informado: 'true' | Retorna: true
|
|
146
|
+
* Informado: 'false' | Retorna: false
|
|
136
147
|
*/
|
|
137
148
|
static getBooleanValue(value:string, defaultValue:boolean = false): boolean {
|
|
138
149
|
if([true, "true", "S"].includes(value)) {
|
|
@@ -146,6 +157,23 @@ export class StringUtils {
|
|
|
146
157
|
}
|
|
147
158
|
}
|
|
148
159
|
|
|
160
|
+
/**
|
|
161
|
+
*
|
|
162
|
+
* Adiciona caracteres à esquerda caso texto seja menor que o valor do parâmetro len passado.
|
|
163
|
+
*
|
|
164
|
+
* @param str - Texto para ser ajustado.
|
|
165
|
+
* @param len - Tamanho desejado do texto.
|
|
166
|
+
* @param pad - Caractere a ser adicionado a esquerda caso o texto menor que o tamanho passado.
|
|
167
|
+
* @returns - Texto passado se este for maior que o len.
|
|
168
|
+
* Ou retorna o texto com os caracteres adicionados na esquerda.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* padStart('SANKHYA', 8,'.') | Retorna: '...SANKHYA'
|
|
172
|
+
* @example
|
|
173
|
+
* padStart('SANKHYA', 5,'A') | Retorna: 'SANKHYA'
|
|
174
|
+
*
|
|
175
|
+
*
|
|
176
|
+
*/
|
|
149
177
|
static padStart(str: string, len: number, pad: string = " "): string {
|
|
150
178
|
str = str != undefined ? str : "";
|
|
151
179
|
while (str.length < len) {
|
|
@@ -154,6 +182,23 @@ export class StringUtils {
|
|
|
154
182
|
return str;
|
|
155
183
|
}
|
|
156
184
|
|
|
185
|
+
/**
|
|
186
|
+
*
|
|
187
|
+
* Adiciona caracteres à direita caso texto seja menor que o valor do parâmetro len passado.
|
|
188
|
+
*
|
|
189
|
+
* @param str - Texto para ser ajustado.
|
|
190
|
+
* @param len - Tamanho desejado do texto.
|
|
191
|
+
* @param pad - Caractere a ser adicionado a direita caso o texto menor que o tamanho passado.
|
|
192
|
+
* @returns - Texto passado se este for maior que o len.
|
|
193
|
+
* Ou retorna o texto com os caracteres adicionados na direita.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* padStart('SANKHYA', 8,'.') | Retorna: 'SANKHYA...'
|
|
197
|
+
* @example
|
|
198
|
+
* padStart('SANKHYA', 5,'A') | Retorna: 'SANKHYA'
|
|
199
|
+
*
|
|
200
|
+
*
|
|
201
|
+
*/
|
|
157
202
|
static padEnd(str: string, len: number, pad: string = " "): string {
|
|
158
203
|
str = str != undefined ? str : "";
|
|
159
204
|
while (str.length < len) {
|
|
@@ -164,12 +209,11 @@ export class StringUtils {
|
|
|
164
209
|
|
|
165
210
|
|
|
166
211
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* @param
|
|
171
|
-
* @
|
|
172
|
-
* @returns Um valor maior, menor ou igual a zero para determinar se a ordem precisa ser alterada.
|
|
212
|
+
* Determina a ordem de strings.
|
|
213
|
+
*
|
|
214
|
+
* @param a - Primeira string para comparação.
|
|
215
|
+
* @param b - Segunda string para comparação.
|
|
216
|
+
* @returns - 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.
|
|
173
217
|
*/
|
|
174
218
|
static compare(a: string, b: string): number{
|
|
175
219
|
|
|
@@ -189,10 +233,13 @@ export class StringUtils {
|
|
|
189
233
|
}
|
|
190
234
|
|
|
191
235
|
/**
|
|
192
|
-
*
|
|
236
|
+
* Converte string em camelCase.
|
|
193
237
|
* Combina palavras compostas ou frases, alterando a inicial de cada uma, a partir da primeira, para maiúscula e unidas sem espaços.
|
|
194
|
-
* @param value String a ser convertida
|
|
195
|
-
* @returns String convertida em camelCase
|
|
238
|
+
* @param value String a ser convertida.
|
|
239
|
+
* @returns String convertida em camelCase.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* toCamelCase('Exemplo de uso') | Retorna: 'exemploDeUso'
|
|
196
243
|
*/
|
|
197
244
|
static toCamelCase(value: string): string {
|
|
198
245
|
if(!value) return "";
|
|
@@ -205,10 +252,9 @@ export class StringUtils {
|
|
|
205
252
|
}
|
|
206
253
|
|
|
207
254
|
/**
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* @
|
|
211
|
-
* @returns String convertida em PascalCase
|
|
255
|
+
* Converte string para PascalCase.
|
|
256
|
+
* @param value String a ser convertida.
|
|
257
|
+
* @returns String convertida em PascalCase.
|
|
212
258
|
*/
|
|
213
259
|
static toPascalCase(value: string): string{
|
|
214
260
|
return value
|
|
@@ -218,10 +264,9 @@ export class StringUtils {
|
|
|
218
264
|
}
|
|
219
265
|
|
|
220
266
|
/**
|
|
221
|
-
* Utilitário para converter string em snake_case
|
|
222
|
-
*
|
|
223
|
-
* @
|
|
224
|
-
* @returns String convertida em snake_case
|
|
267
|
+
* Utilitário para converter string em snake_case.
|
|
268
|
+
* @param value String a ser convertida.
|
|
269
|
+
* @returns String convertida em snake_case.
|
|
225
270
|
*/
|
|
226
271
|
static toSnakeCase(value: string): string{
|
|
227
272
|
return value
|
|
@@ -232,10 +277,9 @@ export class StringUtils {
|
|
|
232
277
|
}
|
|
233
278
|
|
|
234
279
|
/**
|
|
235
|
-
* Utilitário para converter string em kebab-case
|
|
236
|
-
*
|
|
237
|
-
* @
|
|
238
|
-
* @returns String convertida em KebabCase
|
|
280
|
+
* Utilitário para converter string em kebab-case.
|
|
281
|
+
* @param value String a ser convertida.
|
|
282
|
+
* @returns String convertida em KebabCase.
|
|
239
283
|
*/
|
|
240
284
|
static toKebabCase(value: string): string{
|
|
241
285
|
return value.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/[\s_]+/g, '-').toLowerCase();
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { MaskFormatter } from "./MaskFormatter.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* `TimeFormatter
|
|
4
|
+
* `TimeFormatter`: Utilizado para formatar horas.
|
|
5
5
|
*/
|
|
6
6
|
export class TimeFormatter {
|
|
7
7
|
|
|
8
8
|
static _maskFormatter: MaskFormatter = new MaskFormatter("##:##");
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Converte um texto para o formato de hora.
|
|
12
12
|
*
|
|
13
|
-
* @param value
|
|
14
|
-
*
|
|
15
|
-
* @returns
|
|
13
|
+
* @param value - Texto não formatado.
|
|
14
|
+
* @param showSeconds - Se será validado os segundos.
|
|
15
|
+
* @returns - Texto em formato de hora.
|
|
16
16
|
*
|
|
17
17
|
* @Exemples
|
|
18
18
|
* @"1012" | "10:12"
|
|
@@ -50,11 +50,11 @@ export class TimeFormatter {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* Retorna se o texto está no formato de hora.
|
|
54
54
|
*
|
|
55
|
-
* @param value
|
|
56
|
-
*
|
|
57
|
-
* @returns
|
|
55
|
+
* @param value - Texto a ser validado.
|
|
56
|
+
* @param showSeconds - Se será validado os segundos.
|
|
57
|
+
* @returns - Verdadeiro para valores no formato de hora e False para formatos diferentes.
|
|
58
58
|
*
|
|
59
59
|
* @Exemples
|
|
60
60
|
* @"1012" | true
|
|
@@ -64,7 +64,7 @@ export class TimeFormatter {
|
|
|
64
64
|
static validateTime(value: string, showSeconds: boolean) {
|
|
65
65
|
let isValid: boolean = true;
|
|
66
66
|
if (value) {
|
|
67
|
-
|
|
67
|
+
const validationValue = value.replace(/:/g, "");
|
|
68
68
|
if (showSeconds) {
|
|
69
69
|
if (!["1", "2", "0"].includes(validationValue[0])) {
|
|
70
70
|
isValid = false;
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import AGENT_LIST from "./navigatorAgentList.js"
|
|
2
2
|
import { NumberUtils } from "../NumberUtils.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* `UserAgentUtils`: Utilitario para tratativas relacionadas ao navegador.
|
|
6
|
+
*/
|
|
4
7
|
export class UserAgentUtils {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Obtém se o navegador do usuário é o firefox.
|
|
11
|
+
* @returns Verdadeiro se o navegador do usuário for o firefox.
|
|
12
|
+
*/
|
|
5
13
|
public static isFirefox() {
|
|
6
14
|
const browser = this.getBrowserInfo();
|
|
7
15
|
return !!browser.firefox;
|
|
8
16
|
}
|
|
9
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Obtém nome e versão do navegador que está sendo utilizado.
|
|
20
|
+
* @returns Objeto com o nome e versão do navegador.
|
|
21
|
+
*/
|
|
10
22
|
public static getBrowserInfo(): any {
|
|
11
23
|
const userAgent = window.navigator.userAgent;
|
|
12
24
|
let browser = { name: '', version: '' } as any;
|