@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,10 +1,20 @@
1
1
  import { QuickFilter } from "../DataUnit.js";
2
2
  import { Filter, Sort } from "../metadata/UnitMetadata.js";
3
3
 
4
+ /** Atributos enviados na requisição de carregamento dos registros */
4
5
  export interface LoadDataRequest {
6
+ /** Indice inicial dos registros que será retornado */
5
7
  offset?: number;
8
+
9
+ /** Quantidade de registros que será retornado */
6
10
  limit?: number;
11
+
12
+ /** Filtro rápido */
7
13
  quickFilter?: QuickFilter;
14
+
15
+ /** Filtros */
8
16
  filters?: Array<Filter>;
17
+
18
+ /** Ordenação dos resultados */
9
19
  sort?: Array<Sort>;
10
20
  }
@@ -1,7 +1,11 @@
1
1
  import { Record } from "../DataUnit.js";
2
2
  import { PaginationInfo } from "./PaginationInfo.js";
3
3
 
4
+ /** Retorno dos registros da requisição de carregamento de dados */
4
5
  export interface LoadDataResponse {
6
+ /** Registros retornados na requisição */
5
7
  records: Array<Record>;
8
+
9
+ /** Informações da paginação */
6
10
  paginationInfo?: PaginationInfo;
7
11
  }
@@ -1,8 +1,18 @@
1
-
1
+ /** Informações da paginação retornada na requisição de carregamento de registros */
2
2
  export interface PaginationInfo {
3
+
4
+ /** Página atual */
3
5
  currentPage: number;
6
+
7
+ /** Indice do primeiro registro na página */
4
8
  firstRecord: number;
9
+
10
+ /** Indice do último registro na página */
5
11
  lastRecord: number;
12
+
13
+ /** Quantidade total de registros */
6
14
  total: number;
15
+
16
+ /** Se ainda existem mais registros além dos exibidos na página */
7
17
  hasMore: boolean;
8
18
  }
@@ -1,5 +1,7 @@
1
1
  import DateUtils from "../../utils/DateUtils.js";
2
2
 
3
+ /* `DataType` Tipos de dados válidos para os valores dos campos no dataUnit */
4
+
3
5
  export enum DataType {
4
6
  NUMBER = "NUMBER",
5
7
  DATE = "DATE",
@@ -8,6 +10,24 @@ export enum DataType {
8
10
  OBJECT = "OBJECT"
9
11
  }
10
12
 
13
+ /**
14
+ * Converte o valor para outro tipo.
15
+ *
16
+ * Tipos aceitos:
17
+ *
18
+ * NUMBER = "NUMBER",
19
+ * DATE = "DATE",
20
+ * TEXT = "TEXT",
21
+ * BOOLEAN = "BOOLEAN",
22
+ * OBJECT = "OBJECT"
23
+ *
24
+ * @param dataType - Tipo que o valor será convertido.
25
+ * @param value - Valor a ser convertido.
26
+ * @returns - Informação convertida para o tipo informado.
27
+ *
28
+ * @example
29
+ * ``` informado: DataType.NUMBER, "10" | Retorno: 10 ```
30
+ */
11
31
  export const convertType = (dataType: DataType, value: any): any => {
12
32
 
13
33
  if (value === undefined || value === null) {
@@ -21,7 +41,25 @@ export const convertType = (dataType: DataType, value: any): any => {
21
41
  return getConvertedValue(dataType, value);
22
42
  }
23
43
 
24
- export const getConvertedValue = (dataType: DataType, value: any) => {
44
+ /**
45
+ * Efetua a conversão da informação de acordo com o tipo definido pelo dataType.
46
+ *
47
+ * Tipos aceitos:
48
+ *
49
+ * NUMBER = "NUMBER",
50
+ * DATE = "DATE",
51
+ * TEXT = "TEXT",
52
+ * BOOLEAN = "BOOLEAN",
53
+ * OBJECT = "OBJECT"
54
+ *
55
+ * @param dataType - Tipo que o valor será convertido.
56
+ * @param value - Valor a ser convertido.
57
+ * @returns - Informação convertida para o tipo informado.
58
+ *
59
+ * @example
60
+ * ``` informado: DataType.NUMBER, "10" | Retorno: 10 ```
61
+ */
62
+ export const getConvertedValue = (dataType: DataType, value: any): any => {
25
63
  switch (dataType) {
26
64
  case DataType.NUMBER:
27
65
  return value === "" || isNaN(Number(value)) ? null : Number(value);
@@ -46,6 +84,14 @@ export const getConvertedValue = (dataType: DataType, value: any) => {
46
84
  }
47
85
  }
48
86
 
87
+ /**
88
+ * Converte valor para texto
89
+ *
90
+ * @param dataType - Tipo do dado para conversão
91
+ * @param value - Valor a ser convertido.
92
+ * @returns - Valor convertido em forma de texto.
93
+ *
94
+ */
49
95
  export const toString = ( dataType: DataType|undefined, value: any): string => {
50
96
 
51
97
  if (value === undefined || value === null) {
@@ -1,7 +1,15 @@
1
+ /**
2
+ * `ErrorException`: Exceção lançada quando ocorre um erro.
3
+ */
1
4
  export default class ErrorException extends Error {
2
5
 
6
+ /** Titulo do erro. */
3
7
  public title: string;
8
+
9
+ /** Descrição do erro. */
4
10
  public message: string;
11
+
12
+ /** Código do erro, indica o erro disparado pelo backend. */
5
13
  public errorCode: string;
6
14
 
7
15
  constructor(title: string, message: string, errorCode: string = "") {
@@ -1,7 +1,12 @@
1
-
1
+ /**
2
+ * `WaitingChangeException`: Exceção lançada quando um campo está pendente de finalizar a alteração antes de executar uma ação.
3
+ */
2
4
  export default class WaitingChangeException extends Error {
3
5
 
6
+ /** Titulo do erro. */
4
7
  public title: string;
8
+
9
+ /** Descrição do erro. */
5
10
  public message: string;
6
11
 
7
12
  constructor(title: string, message: string) {
@@ -1,8 +1,15 @@
1
-
1
+ /**
2
+ * `WarningException`: Exceção lançada quando o "erro" vindo do backend é caracterizado como warning.
3
+ */
2
4
  export default class WarningException extends Error {
3
5
 
6
+ /** Titulo do alerta. */
4
7
  public title: string;
8
+
9
+ /** Descrição do alerta. */
5
10
  public message: string;
11
+
12
+ /** Código do alerta, indica o alerta disparado pelo backend. */
6
13
  public errorCode: string;
7
14
 
8
15
  constructor(title: string, message: string, errorCode: string = "") {
@@ -2,7 +2,17 @@ import ErrorException from "../exceptions/ErrorException.js";
2
2
  import WaitingChangeException from "../exceptions/WaitingChangeException.js";
3
3
  import WarningException from "../exceptions/WarningException.js";
4
4
 
5
+ /**
6
+ * `ErrorTracking`: Handler para processar exceptions lançadas.
7
+ */
8
+
5
9
  export class ErrorTracking {
10
+
11
+ /**
12
+ *
13
+ * Inicializa o Rollbar, utilizado para rastreio de erros e análise de logs.
14
+ *
15
+ */
6
16
  public static init(){
7
17
  const rollbar = (window as any).Rollbar;
8
18
  if(rollbar){
@@ -14,6 +24,13 @@ export class ErrorTracking {
14
24
  }
15
25
  }
16
26
 
27
+ /**
28
+ *
29
+ * Retorna se o erro é uma exceção interna na aplicação.
30
+ * @param error - Erro que será identificado como exceção interna ou não.
31
+ * @returns - Verdadeiro caso seja uma exceção interna.
32
+ *
33
+ */
17
34
  private static isInternalException(error:any):boolean{
18
35
  return (error instanceof ErrorException || error instanceof WaitingChangeException || error instanceof WarningException);
19
36
  }
@@ -30,6 +30,13 @@ class FloatingEntry {
30
30
  this.options = opts;
31
31
  }
32
32
 
33
+ /**
34
+ *
35
+ * Obtém o elemento HTML pai associado ao objeto.
36
+ *
37
+ * @returns - Elemento HTML pai.
38
+ *
39
+ */
33
40
  public get parent():HTMLElement|undefined{
34
41
  if(this.weakRefParent){
35
42
  return this.weakRefParent.deref();
@@ -37,6 +44,13 @@ class FloatingEntry {
37
44
  return this.strongRefParent
38
45
  }
39
46
 
47
+ /**
48
+ *
49
+ * Obtém o elemento HTML de conteúdo associado ao objeto.
50
+ *
51
+ * @returns - Elemento HTML de conteúdo associado.
52
+ *
53
+ */
40
54
  public get content():HTMLElement|undefined{
41
55
  if(this.weakRefContent){
42
56
  return this.weakRefContent.deref();
@@ -45,6 +59,9 @@ class FloatingEntry {
45
59
  }
46
60
  }
47
61
 
62
+ /**
63
+ * `FloatingManager`: Gerenciador de elementos flutuantes na tela.
64
+ */
48
65
 
49
66
  export default class FloatingManager {
50
67
  public static MODAL_DEFAULT_CLASSNAME = "FloatingManager__modal";
@@ -54,6 +71,12 @@ export default class FloatingManager {
54
71
  private static initialized: boolean;
55
72
  private static entries: Array<FloatingEntry>;
56
73
 
74
+
75
+ /**
76
+ *
77
+ * Inicializa a classe FloatingManager.
78
+ *
79
+ */
57
80
  private static init() {
58
81
  FloatingManager.entries = [];
59
82
  document.addEventListener('mousedown', FloatingManager.handleDocumentEvent);
@@ -61,7 +84,12 @@ export default class FloatingManager {
61
84
  FloatingManager.initialized = true;
62
85
  }
63
86
 
64
- private static innerClick(container: HTMLElement, node: HTMLElement) {
87
+ /**
88
+ *
89
+ * Retorna se o elemento clicado possui elementos internos.
90
+ *
91
+ */
92
+ private static innerClick(container: HTMLElement, node: HTMLElement): boolean {
65
93
  if (container.contains(node)) {
66
94
  return true;
67
95
  }
@@ -73,7 +101,17 @@ export default class FloatingManager {
73
101
  return false;
74
102
  }
75
103
 
76
- private static doClose(id: number, entry: FloatingEntry, target?: HTMLElement, event?:Event) {
104
+ /**
105
+ *
106
+ * Fecha uma entrada flutuante (FloatingManager).
107
+ *
108
+ * @param id - Código da entrada que se deseja encerrar.
109
+ * @param entry - FloatingManager.
110
+ * @param target - Elemento HTML referente.
111
+ * @param event - Evento específico que será verificado, como clique do mouse.
112
+ *
113
+ */
114
+ private static doClose(id: number, entry: FloatingEntry, target?: HTMLElement, event?:Event): void {
77
115
  if (!target || entry.options.autoClose) {
78
116
  const parent: HTMLElement | undefined = entry.parent;
79
117
  const content: HTMLElement | undefined = entry.content;
@@ -93,14 +131,28 @@ export default class FloatingManager {
93
131
  FloatingManager.hideOverlay();
94
132
  }
95
133
 
96
- private static handleDocumentEvent(event: Event) {
134
+ /**
135
+ *
136
+ * Fecha todas as FloatingManagers abertas.
137
+ *
138
+ * @param event - Evento ocorrido, como clique do mouse, por exemplo.
139
+ *
140
+ */
141
+ private static handleDocumentEvent(event: Event): void {
97
142
 
98
143
  FloatingManager.entries.forEach((entry, index) => {
99
144
  FloatingManager.doClose(index, entry, event.composedPath()[0] as HTMLElement, event);
100
145
  });
101
146
  }
102
147
 
103
- private static handleKeyboardEvent(event: KeyboardEvent) {
148
+ /**
149
+ *
150
+ * Captura eventos de teclado para manipular os elementos flutuantes via eventos da tecla pressionada.
151
+ *
152
+ * @param event - Evento de teclado.
153
+ *
154
+ */
155
+ private static handleKeyboardEvent(event: KeyboardEvent): void {
104
156
  if (event.key === 'Escape') {
105
157
  for (let index: number = FloatingManager.entries.length; index >= 0; index--) {
106
158
  const entry: FloatingEntry = FloatingManager.entries[index];
@@ -112,12 +164,30 @@ export default class FloatingManager {
112
164
  }
113
165
  }
114
166
 
115
- private static applyStyle(element: HTMLElement, propertyName: string, value?: string) {
167
+ /**
168
+ *
169
+ * Adiciona uma propriedade CSS em um elemento HTML.
170
+ *
171
+ * @param element - Elemento HTML que será modificado.
172
+ * @param propertyName - Nome da propriedade CSS que será adicionada.
173
+ * @param value - Valor da propriedade adicionada.
174
+ *
175
+ *
176
+ */
177
+ private static applyStyle(element: HTMLElement, propertyName: string, value?: string):void {
116
178
  if (value) {
117
179
  element.style.setProperty(propertyName, value);
118
180
  }
119
181
  }
120
182
 
183
+ /**
184
+ *
185
+ * Obtém o índice do FloatingManager do Elemento HMTL desejado.
186
+ *
187
+ * @param content - Elemento a ser buscado.
188
+ * @param parent - Elemento pai do content a ser buscado.
189
+ * @returns - Índice do elemento informado.
190
+ */
121
191
  private static getFloatIndex(content: HTMLElement, parent: HTMLElement): number {
122
192
 
123
193
  for (let index: number = 0; index < FloatingManager.entries.length; index++) {
@@ -129,10 +199,30 @@ export default class FloatingManager {
129
199
  return -1;
130
200
  }
131
201
 
132
- public static isFloating(id: number){
202
+ /**
203
+ *
204
+ * Retorna se uma entrada flutuante existe.
205
+ *
206
+ * @param id - Índice para ser verificado no FloatingManager.
207
+ *
208
+ * @returns - Verdadeiro se existir.
209
+ *
210
+ */
211
+ public static isFloating(id: number): boolean{
133
212
  return FloatingManager.entries[id] !== undefined;
134
213
  }
135
214
 
215
+
216
+ /**
217
+ *
218
+ * Cria e exibe um novo item no FloatingManager.
219
+ *
220
+ * @param content - Elemento HTML que será criado.
221
+ * @param parent - Elemento HTML que será o pai do item a ser criado.
222
+ * @param options - Opções de configuração a serem adicionadas.
223
+ *
224
+ * @returns - ID do novo item criado.
225
+ */
136
226
  public static float(content: HTMLElement, parent: HTMLElement, options: FloatingOptions = { autoClose: true }): number {
137
227
 
138
228
  if (!FloatingManager.initialized) {
@@ -158,12 +248,25 @@ export default class FloatingManager {
158
248
  return FloatingManager.entries.length - 1;
159
249
  }
160
250
 
161
- private static showOverlay(options: FloatingOptions){
251
+ /**
252
+ *
253
+ * Aplica o desfoque na página se o elemento possuir essa option ativada.
254
+ *
255
+ * @param options - Configurações que serão utilizadas no elemento.
256
+ *
257
+ */
258
+ private static showOverlay(options: FloatingOptions): void{
162
259
  if(options.useOverlay){
163
260
  this.createOrUpdatOverlay().style.display = "block";
164
261
  }
165
262
  }
166
263
 
264
+ /**
265
+ *
266
+ * Desfaz o desfoque/overlay dos elementos na tela.
267
+ *
268
+ *
269
+ */
167
270
  private static hideOverlay(){
168
271
 
169
272
  if(FloatingManager.entries.filter(entry => entry.options.useOverlay).length > 0){
@@ -176,6 +279,14 @@ export default class FloatingManager {
176
279
  }
177
280
  }
178
281
 
282
+
283
+ /**
284
+ *
285
+ * Cria ou atualiza o elemento de sobreposição.
286
+ *
287
+ * @param className - Classe CSS que será adicionada ao modal.
288
+ * @returns - O elemento atualizado.
289
+ */
179
290
  private static createOrUpdatOverlay(className: string = FloatingManager.MODAL_DEFAULT_CLASSNAME):HTMLDivElement{
180
291
  let overlayElement: HTMLDivElement = document.querySelector(`div#${FloatingManager.MODAL_ELEMENT_ID}`) as HTMLDivElement;
181
292
  if(!overlayElement){
@@ -195,6 +306,11 @@ export default class FloatingManager {
195
306
  return overlayElement;
196
307
  }
197
308
 
309
+ /**
310
+ *
311
+ * Cria elemento de estilo.
312
+ * Elemento que define o estilo padrão do elemento de sobreposição.
313
+ */
198
314
  private static createStyleElement():void{
199
315
  let styleElement:HTMLStyleElement = document.querySelector(`style#${FloatingManager.STYLE_ELEMENT_ID}`) as HTMLStyleElement;
200
316
  if(styleElement == undefined){
@@ -219,6 +335,14 @@ export default class FloatingManager {
219
335
  }
220
336
  }
221
337
 
338
+ /**
339
+ *
340
+ * Atualiza posição de um elemento que já está em tela.
341
+ *
342
+ * @param content - Elemento HTML que será atualizado.
343
+ * @param parent - Elemento pai do content passado.
344
+ * @param options - Novas opções desejadas.
345
+ */
222
346
  public static updateFloatPosition(content: HTMLElement, parent: HTMLElement, options: FloatingOptions = { autoClose: true }) {
223
347
  const alreadyFloatingIndex = FloatingManager.getFloatIndex(content, parent);
224
348
  if (alreadyFloatingIndex > -1) {
@@ -230,6 +354,13 @@ export default class FloatingManager {
230
354
 
231
355
  }
232
356
 
357
+ /**
358
+ *
359
+ * Fecha elemento flutuante da tela.
360
+ *
361
+ * @param id - Índice do elemento desejado.
362
+ *
363
+ */
233
364
  public static close(id: number) {
234
365
  if (FloatingManager.entries[id]) {
235
366
  FloatingManager.doClose(id, FloatingManager.entries[id], undefined);
@@ -1,13 +1,34 @@
1
+ /***
2
+ * `ApplicationContext`: Utilizado para manipulação do contexto.
3
+ * - Evitar uso da classe sem alinhamento com a arquitetura devido ao uso de variáveis globais.
4
+ */
1
5
  export default class ApplicationContext{
2
6
 
7
+ /**
8
+ * Obtém informação específica do contexto.
9
+ *
10
+ * @param key - Chave do contexto desejada.
11
+ * @returns - Informação do contexto desejado.
12
+ */
3
13
  public static getContextValue(key: string):any{
4
14
  return ApplicationContext.getCtx()[key];
5
15
  }
6
16
 
17
+ /**
18
+ * Aplica informação no contexto.
19
+ *
20
+ * @param key - Identificador do contexto.
21
+ * @param value - Informação a ser inserida no contexto.
22
+ */
7
23
  public static setContextValue(key: string, value: any):any{
8
24
  ApplicationContext.getCtx()[key] = value;
9
25
  }
10
26
 
27
+ /**
28
+ * Obtém o contexto global da aplicação sankhyacore.
29
+ * - Esse contexto pode ser entendido como um ponto de coesão para atores que não se conhecem poderem trocar informação. Assim, o código x busca por um possível valor no contexto. Se essa informação estiver lá, ele reage de certa forma. O código Y, sabe dessa necessidade mas não consegue passar essa informação diretamente, então atribui o valor ao contexto.
30
+ * @returns - Objeto com as propriedades da variável global ___snkcore___ctx___.
31
+ */
11
32
  private static getCtx():any{
12
33
  let ctx = (window as any).___snkcore___ctx___;
13
34
  if(!ctx){
@@ -1,14 +1,16 @@
1
1
  import { StringUtils } from "./StringUtils.js";
2
-
2
+ /**
3
+ * `ArrayUtils`: Utilitário com a responsabilidade de manipular Arrays.
4
+ */
3
5
  export default class ArrayUtils {
4
6
  /**
5
7
  * Filtra um array a partir de um critério textual.
6
8
  *
7
- * @param argument - Texto a ser usado no filtro
8
- * @param originalArray - Array no formato original
9
+ * @param argument - Texto a ser usado no filtro.
10
+ * @param originalArray - Array no formato original.
9
11
  * @param alphabeticalSorting - Determina se o resultado deve ser ordenado ou mantido na ordem original. Por padrão ordena.
10
- * @param fieldName - Caso o objeto deva ser filtrado por um campo diferente de "label", pode-se usar esse parâmetro
11
- * @returns Um array filtrado e ordenado conforme necessidade. Se "argument" for omitido, ou nulo, o array original é retornado.
12
+ * @param fieldName - Caso o objeto deva ser filtrado por um campo diferente de "label", pode-se usar esse parâmetro.
13
+ * @returns - Um array filtrado e ordenado conforme necessidade..
12
14
  */
13
15
  static applyStringFilter(argument: string, originalArray: Array<any>, alphabeticalSorting: boolean = true, fieldName: string = "label"): Array<any>{
14
16
  if(!argument){
@@ -22,10 +24,22 @@ export default class ArrayUtils {
22
24
  return alphabeticalSorting ? ArrayUtils.sortAlphabetically(filteredArray, fieldName) : filteredArray;
23
25
  }
24
26
 
27
+ /**
28
+ * Converte texto para caixa alta e substitui caracteres acentuados.
29
+ *
30
+ * @param original - Texto a ser convertido.
31
+ * @returns - Texto com as letras acentuadas sem os acentos e em caixa alta.
32
+ */
25
33
  private static normalizeSearchString(original:string ): string{
26
34
  return StringUtils.replaceAccentuatedCharsKeepSymbols(original.toUpperCase());
27
35
  }
28
36
 
37
+ /**
38
+ * Ordena valores de um array alfabeticamente.
39
+ *
40
+ * @param originalArray - Array a ser ordenado.
41
+ * @returns - Array ordenado alfabeticamente..
42
+ */
29
43
  static sortAlphabetically(originalArray: Array<any>, fieldName: string = "label"): Array<any>{
30
44
  return originalArray.sort((fieldA, fieldB) => StringUtils.compare(fieldA[fieldName], fieldB[fieldName]));
31
45
  }
@@ -6,7 +6,8 @@ interface OutputJSON {
6
6
  }
7
7
 
8
8
  /**
9
- * CriteriaParameter
9
+ * `CriteriaParameter`: Utilizado para validar e manipular os critérios da requisição.
10
+ *
10
11
  */
11
12
  export class Criteria {
12
13
 
@@ -32,7 +33,6 @@ export class Criteria {
32
33
  * @methodOf sankhyalabs.core.src:CriteriaProvider
33
34
  * @description Setter para "parameters". Trata-se de uma Array de parametros da classe Criteria.
34
35
  * @param {Array<CriteriaParameter>} [parameters] Array de parametros da classe Criteria.
35
- * @returns {void}
36
36
  */
37
37
  public set parameters(parameters: Array<CriteriaParameter>) {
38
38
  this._parameters = parameters;
@@ -57,7 +57,6 @@ export class Criteria {
57
57
  * @methodOf sankhyalabs.core.src:CriteriaProvider
58
58
  * @description Setter para "expression". Trata-se do expressão da classe Criteria.
59
59
  * @param {string} [expression] Expressão da classe Criteria.
60
- * @returns {void}
61
60
  */
62
61
  public set expression(expression: string | undefined) {
63
62
  this._expression = expression;
@@ -196,10 +195,9 @@ export class Criteria {
196
195
  * - Se passado um array, o metodo iterará no array e adicionará cada um dos itens.
197
196
  * - É possível passar um Objeto CriteriaParameter, um número, string ou uma instancia de data, eles serão inferidos para o tipo certo.
198
197
  * @param {CriteriaParameter} Parâmetro a ser adicionado.
199
- * @returns {Criteria} Retorna a própria instância do Criterio para encadeamento.
200
198
  */
201
199
  private addParameter(param: Array<CriteriaParameter>): void {
202
- for (let index in param) {
200
+ for (const index in param) {
203
201
  this.parameters.push(param[index]);
204
202
  }
205
203
  }