@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.
- package/.docs/classes/Change.md +11 -11
- package/.docs/classes/DataUnit.md +94 -74
- package/.docs/classes/FloatingManager.md +8 -8
- package/.docs/classes/SelectionInfo.md +11 -11
- package/.docs/enums/ChangeOperation.md +4 -4
- package/.docs/enums/SelectionMode.md +2 -2
- package/.docs/interfaces/DUActionInterceptor.md +1 -1
- package/.docs/interfaces/PageRequest.md +3 -3
- package/.docs/interfaces/QuickFilter.md +3 -3
- package/.docs/interfaces/Record.md +4 -4
- package/.docs/interfaces/SavedRecord.md +5 -5
- package/.docs/interfaces/WaitingChange.md +3 -3
- package/dist/dataunit/DataUnit.d.ts +10 -1
- package/dist/dataunit/DataUnit.js +19 -3
- package/dist/dataunit/DataUnit.js.map +1 -1
- package/dist/ui/FloatingManager.js +8 -1
- package/dist/ui/FloatingManager.js.map +1 -1
- package/package.json +1 -1
- package/src/dataunit/DataUnit.ts +20 -3
- package/src/ui/FloatingManager.ts +8 -2
package/src/dataunit/DataUnit.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
}
|