@sankhyalabs/core 4.10.0 → 4.11.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.
@@ -1,4 +1,4 @@
1
- import { convertType, toString } from "./metadata/DataType.js";
1
+ import { convertType, DataType, toString } from "./metadata/DataType.js";
2
2
  import { ChildDescriptor, FieldDescriptor, Filter, FilterProvider, Sort, SortingProvider, UnitMetadata } from "./metadata/UnitMetadata.js";
3
3
 
4
4
  import { Action, DataUnitAction, ExecutionContext } from "./state/action/DataUnitAction.js";
@@ -553,14 +553,20 @@ export default class DataUnit {
553
553
  * usada na interface.
554
554
  *
555
555
  * @param fieldName - Nome do campo utilizado do qual se quer obter valor.
556
+ * @param value (opcional) - O valor a ser convertido. Caso omitido pega do registro selecionado.
556
557
  *
557
558
  * @returns - Valor formatado.
558
559
  *
559
560
  */
560
- public getFormattedValue(fieldName: string): string {
561
+ public getFormattedValue(fieldName: string, value?: any): string {
561
562
 
562
563
  const descriptor = this.getField(fieldName);
563
- const value = this.getFieldValue(fieldName);
564
+ if (!value) {
565
+ value = this.getFieldValue(fieldName);
566
+ } else if (typeof value === "string" && descriptor?.dataType != DataType.TEXT){
567
+ value = this.valueFromString(fieldName, value);
568
+ }
569
+
564
570
  if(value == undefined){
565
571
  return "";
566
572
  }
@@ -1464,6 +1470,17 @@ export default class DataUnit {
1464
1470
  });
1465
1471
  return filters;
1466
1472
  }
1473
+
1474
+ /**
1475
+ *
1476
+ * Obtém as informações da última carga de dados.
1477
+ *
1478
+ * @returns - As informações de filtro e paginação.
1479
+ *
1480
+ */
1481
+ public getLastLoadRequest(): LoadDataRequest | undefined {
1482
+ return getCurrentRequest(this._stateManager);
1483
+ }
1467
1484
 
1468
1485
  /**
1469
1486
  *
@@ -279,9 +279,12 @@ export default class FloatingManager {
279
279
  if(overlayElement != undefined){
280
280
  overlayElement.style.display = "none";
281
281
  }
282
+ const body = document.querySelector("body");
283
+ if(body){
284
+ body.style.overflow = "";
285
+ }
282
286
  }
283
287
 
284
-
285
288
  /**
286
289
  *
287
290
  * Cria ou atualiza o elemento de sobreposição.
@@ -291,10 +294,10 @@ export default class FloatingManager {
291
294
  */
292
295
  private static createOrUpdatOverlay(className: string = FloatingManager.MODAL_DEFAULT_CLASSNAME):HTMLDivElement{
293
296
  let overlayElement: HTMLDivElement = document.querySelector(`div#${FloatingManager.MODAL_ELEMENT_ID}`) as HTMLDivElement;
297
+ const body = document.querySelector("body");
294
298
  if(!overlayElement){
295
299
  overlayElement = document.createElement("div");
296
300
  overlayElement.id = FloatingManager.MODAL_ELEMENT_ID;
297
- const body = document.querySelector("body");
298
301
  if(body){
299
302
  body.appendChild(overlayElement);
300
303
  }
@@ -304,6 +307,9 @@ export default class FloatingManager {
304
307
  } else {
305
308
  overlayElement.classList.remove(FloatingManager.MODAL_DEFAULT_CLASSNAME);
306
309
  }
310
+ if(body){
311
+ body.style.overflow = "hidden";
312
+ }
307
313
  overlayElement.className = className;
308
314
  return overlayElement;
309
315
  }