@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.
Files changed (117) hide show
  1. package/.docs/classes/ApplicationContext.md +24 -10
  2. package/.docs/classes/ArrayUtils.md +24 -14
  3. package/.docs/classes/Change.md +40 -18
  4. package/.docs/classes/DataUnit.md +418 -225
  5. package/.docs/classes/DateUtils.md +95 -36
  6. package/.docs/classes/ElementIDUtils.md +70 -37
  7. package/.docs/classes/ErrorException.md +12 -4
  8. package/.docs/classes/ErrorTracking.md +13 -5
  9. package/.docs/classes/FloatingManager.md +104 -63
  10. package/.docs/classes/MaskFormatter-1.md +17 -17
  11. package/.docs/classes/NumberUtils.md +74 -35
  12. package/.docs/classes/ObjectUtils.md +34 -12
  13. package/.docs/classes/ReadyUtil.md +18 -6
  14. package/.docs/classes/StringUtils.md +108 -52
  15. package/.docs/classes/TimeFormatter.md +9 -9
  16. package/.docs/classes/UserAgentUtils.md +12 -2
  17. package/.docs/classes/WaitingChangeException.md +9 -3
  18. package/.docs/classes/WarningException.md +12 -4
  19. package/.docs/enums/ChangeOperation.md +4 -4
  20. package/.docs/enums/DataType.md +5 -5
  21. package/.docs/interfaces/DUActionInterceptor.md +1 -1
  22. package/.docs/interfaces/LoadDataRequest.md +17 -5
  23. package/.docs/interfaces/LoadDataResponse.md +8 -2
  24. package/.docs/interfaces/PageRequest.md +3 -3
  25. package/.docs/interfaces/PaginationInfo.md +17 -5
  26. package/.docs/interfaces/QuickFilter.md +2 -2
  27. package/.docs/interfaces/Record.md +2 -2
  28. package/.docs/interfaces/SavedRecord.md +3 -3
  29. package/.docs/interfaces/WaitingChange.md +3 -3
  30. package/.docs/modules/MaskFormatter.md +2 -2
  31. package/.releaserc +1 -1
  32. package/.reusable-default-scripts.yml +4 -2
  33. package/build.env +0 -2
  34. package/dist/dataunit/DataUnit.d.ts +516 -7
  35. package/dist/dataunit/DataUnit.js +511 -3
  36. package/dist/dataunit/DataUnit.js.map +1 -1
  37. package/dist/dataunit/loading/LoadDataRequest.d.ts +6 -0
  38. package/dist/dataunit/loading/LoadDataResponse.d.ts +3 -0
  39. package/dist/dataunit/loading/PaginationInfo.d.ts +6 -0
  40. package/dist/dataunit/metadata/DataType.d.ts +44 -0
  41. package/dist/dataunit/metadata/DataType.js +45 -0
  42. package/dist/dataunit/metadata/DataType.js.map +1 -1
  43. package/dist/exceptions/ErrorException.d.ts +6 -0
  44. package/dist/exceptions/ErrorException.js +3 -0
  45. package/dist/exceptions/ErrorException.js.map +1 -1
  46. package/dist/exceptions/WaitingChangeException.d.ts +5 -0
  47. package/dist/exceptions/WaitingChangeException.js +3 -0
  48. package/dist/exceptions/WaitingChangeException.js.map +1 -1
  49. package/dist/exceptions/WarningException.d.ts +6 -0
  50. package/dist/exceptions/WarningException.js +3 -0
  51. package/dist/exceptions/WarningException.js.map +1 -1
  52. package/dist/traking/ErrorTraking.d.ts +15 -0
  53. package/dist/traking/ErrorTraking.js +15 -0
  54. package/dist/traking/ErrorTraking.js.map +1 -1
  55. package/dist/ui/FloatingManager.d.ts +114 -0
  56. package/dist/ui/FloatingManager.js +128 -0
  57. package/dist/ui/FloatingManager.js.map +1 -1
  58. package/dist/utils/ApplicationContext.d.ts +21 -0
  59. package/dist/utils/ApplicationContext.js +21 -0
  60. package/dist/utils/ApplicationContext.js.map +1 -1
  61. package/dist/utils/ArrayUtils.d.ts +19 -4
  62. package/dist/utils/ArrayUtils.js +19 -4
  63. package/dist/utils/ArrayUtils.js.map +1 -1
  64. package/dist/utils/CriteriaModel.d.ts +2 -4
  65. package/dist/utils/CriteriaModel.js +3 -5
  66. package/dist/utils/CriteriaModel.js.map +1 -1
  67. package/dist/utils/DateUtils.d.ts +63 -0
  68. package/dist/utils/DateUtils.js +63 -1
  69. package/dist/utils/DateUtils.js.map +1 -1
  70. package/dist/utils/ElementIDUtils.d.ts +51 -0
  71. package/dist/utils/ElementIDUtils.js +51 -0
  72. package/dist/utils/ElementIDUtils.js.map +1 -1
  73. package/dist/utils/MaskFormatter.d.ts +45 -24
  74. package/dist/utils/MaskFormatter.js +99 -25
  75. package/dist/utils/MaskFormatter.js.map +1 -1
  76. package/dist/utils/NumberUtils.d.ts +39 -31
  77. package/dist/utils/NumberUtils.js +39 -31
  78. package/dist/utils/NumberUtils.js.map +1 -1
  79. package/dist/utils/ObjectUtils.d.ts +27 -0
  80. package/dist/utils/ObjectUtils.js +27 -0
  81. package/dist/utils/ObjectUtils.js.map +1 -1
  82. package/dist/utils/ReadyUtil.d.ts +16 -0
  83. package/dist/utils/ReadyUtil.js +16 -0
  84. package/dist/utils/ReadyUtil.js.map +1 -1
  85. package/dist/utils/StringUtils.d.ts +72 -28
  86. package/dist/utils/StringUtils.js +72 -28
  87. package/dist/utils/StringUtils.js.map +1 -1
  88. package/dist/utils/TimeFormatter.d.ts +9 -9
  89. package/dist/utils/TimeFormatter.js +10 -10
  90. package/dist/utils/TimeFormatter.js.map +1 -1
  91. package/dist/utils/UserAgentUtils/index.d.ts +11 -0
  92. package/dist/utils/UserAgentUtils/index.js +11 -0
  93. package/dist/utils/UserAgentUtils/index.js.map +1 -1
  94. package/package.json +1 -1
  95. package/publish-docs.sh +1 -2
  96. package/src/dataunit/DataUnit.ts +520 -10
  97. package/src/dataunit/loading/LoadDataRequest.ts +10 -0
  98. package/src/dataunit/loading/LoadDataResponse.ts +4 -0
  99. package/src/dataunit/loading/PaginationInfo.ts +11 -1
  100. package/src/dataunit/metadata/DataType.ts +47 -1
  101. package/src/exceptions/ErrorException.ts +8 -0
  102. package/src/exceptions/WaitingChangeException.ts +6 -1
  103. package/src/exceptions/WarningException.ts +8 -1
  104. package/src/traking/ErrorTraking.ts +17 -0
  105. package/src/ui/FloatingManager.ts +138 -7
  106. package/src/utils/ApplicationContext.ts +21 -0
  107. package/src/utils/ArrayUtils.ts +19 -5
  108. package/src/utils/CriteriaModel.ts +3 -5
  109. package/src/utils/DateUtils.ts +70 -6
  110. package/src/utils/ElementIDUtils.ts +52 -4
  111. package/src/utils/MaskFormatter.ts +103 -27
  112. package/src/utils/NumberUtils.ts +40 -36
  113. package/src/utils/ObjectUtils.ts +28 -0
  114. package/src/utils/ReadyUtil.ts +16 -0
  115. package/src/utils/StringUtils.ts +73 -29
  116. package/src/utils/TimeFormatter.ts +10 -10
  117. package/src/utils/UserAgentUtils/index.ts +12 -0
@@ -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) => {
@@ -1,13 +1,15 @@
1
1
  /**
2
- * Classe com utiliários comuns para Strings.
2
+ * `StringUtils`: Utilizado para manipulação de Strings.
3
3
  */
4
4
  export class StringUtils {
5
5
 
6
6
  /**
7
- * Verifica se a string está vazia.
7
+ * Retorna se a string está vazia.
8
8
  * Valores null e undefined são considerados como vazio.
9
9
  *
10
- * @param value String para ser validada.
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: "&lt;Teste&gt;" // retorno: "<Teste>"
50
52
  */
51
- static decodeHtmlEntities(text: string): string {
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 String para ser transformada.
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 valor em string para booleano
134
- * @param value Valor a ser convertido
135
- * @param defaultValue Será retornado esse caso seja passado valores diferentes do esperado(true, false, "true", "false", "S", "N")
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
- * Utilitário para determinar a ordem de strings. Geralmente usado no método "sort" de um array.
168
- * Retorna um número negativo se o primeiro argumento é menor que o segundo, zero se os dois são iguais
169
- * e um número positivo quando o primeiro é maior que o segundo.if they're equal, and a positive value otherwise.
170
- * @param a - Primeira string para comparação
171
- * @param b - Segunda string para comparação
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
- * Utilitário para converter string em camelCase
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
- * Utilitário para converter string em PascalCase
209
- * Combina palavras colocando todas as palavras em minúsculas (mesmo a primeira palavra) removendo espaços
210
- * @param value String a ser convertida
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
- * Combina palavras substituindo cada espaço por um unsderscore (_) convertendo todas as letras para minúsculas
223
- * @param value String a ser convertida
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
- * Combina palavras substituindo cada espaço por um traço (-) convertendo todas as letras para minúsculas
237
- * @param value String a ser convertida
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` é um utilitário para formatação de strings desformatadas em strings válidas de horários
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
- * @prepareValue: converts an unformated time string into a formatted time.
11
+ * Converte um texto para o formato de hora.
12
12
  *
13
- * @param value unformated time string to convert
14
- *
15
- * @returns formatted time string
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
- * @validateTime: validates if an input string has the corect time format.
53
+ * Retorna se o texto está no formato de hora.
54
54
  *
55
- * @param value input string to validate
56
- *
57
- * @returns true or false
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
- let validationValue = value.replace(/:/g, "");
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;