@sankhyalabs/sankhyablocks 8.15.0-dev.60 → 8.15.0-dev.62
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/dist/cjs/{ConfigStorage-7df9d3bb.js → ConfigStorage-9a53a42c.js} +12 -11
- package/dist/cjs/{form-config-fetcher-3c4daeb5.js → DataFetcher-515bda03.js} +0 -251
- package/dist/cjs/{IExporterProvider-1ed8e92a.js → IExporterProvider-d3a3ccd1.js} +55 -12
- package/dist/cjs/{SnkFormConfigManager-4259edbe.js → SnkFormConfigManager-dda10d75.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-4a95fe86.js} +6 -12
- package/dist/cjs/{auth-fetcher-e6112be7.js → auth-fetcher-5acb0335.js} +1 -1
- package/dist/cjs/{pesquisa-fetcher-cb768be1.js → dataunit-fetcher-e2109392.js} +68 -173
- package/dist/cjs/form-config-fetcher-3f430aee.js +256 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-fetcher-916a935c.js +166 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +10 -8
- package/dist/cjs/snk-application.cjs.entry.js +49 -39
- package/dist/cjs/snk-attach.cjs.entry.js +19 -17
- package/dist/cjs/snk-crud.cjs.entry.js +43 -9
- package/dist/cjs/snk-data-exporter.cjs.entry.js +9 -7
- package/dist/cjs/snk-data-unit-dee38ccd.js +614 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +10 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +8 -6
- package/dist/cjs/snk-filter-bar.cjs.entry.js +3 -2
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -2
- package/dist/cjs/snk-form-config.cjs.entry.js +2 -1
- package/dist/cjs/snk-form-view.cjs.entry.js +36 -0
- package/dist/cjs/snk-form.cjs.entry.js +28 -7
- package/dist/cjs/snk-grid.cjs.entry.js +55 -10
- package/dist/cjs/{snk-guides-viewer-bec9c1a5.js → snk-guides-viewer-af4a6ae5.js} +19 -6
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -6
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +96 -14
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +37 -17
- package/dist/collection/components/snk-crud/snk-crud.js +109 -6
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +79 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +41 -4
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +14 -8
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +5 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +413 -165
- package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
- package/dist/collection/components/snk-form/snk-form.js +50 -4
- package/dist/collection/components/snk-grid/snk-grid.js +96 -7
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +156 -8
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
- package/dist/collection/lib/dataUnit/ValueFormatter.js +4 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +51 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +2 -2
- package/dist/collection/lib/message/SnkMessageBuilder.js +25 -32
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -0
- package/dist/components/ConfigStorage.js +2 -1
- package/dist/components/DataFetcher.js +7024 -0
- package/dist/components/IExporterProvider.js +54 -12
- package/dist/components/SnkMessageBuilder.js +6 -12
- package/dist/components/dataunit-fetcher.js +58 -164
- package/dist/components/form-config-fetcher.js +3 -7023
- package/dist/components/pesquisa-fetcher.js +164 -0
- package/dist/components/snk-actions-button2.js +4 -2
- package/dist/components/snk-application2.js +26 -17
- package/dist/components/snk-attach2.js +4 -2
- package/dist/components/snk-crud.js +46 -9
- package/dist/components/snk-data-exporter2.js +4 -2
- package/dist/components/snk-data-unit2.js +356 -166
- package/dist/components/snk-detail-view2.js +21 -6
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-form-view2.js +39 -1
- package/dist/components/snk-form.js +26 -5
- package/dist/components/snk-grid2.js +58 -11
- package/dist/components/snk-simple-crud2.js +96 -10
- package/dist/esm/{ConfigStorage-928c3bf4.js → ConfigStorage-174101b9.js} +2 -1
- package/dist/esm/{form-config-fetcher-e3094014.js → DataFetcher-4b4b7beb.js} +1 -250
- package/dist/esm/{IExporterProvider-ceabfb7e.js → IExporterProvider-640e1f6b.js} +54 -12
- package/dist/esm/{SnkFormConfigManager-a87ade7a.js → SnkFormConfigManager-87bd8082.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-3a767111.js} +6 -12
- package/dist/esm/{auth-fetcher-e1cb288f.js → auth-fetcher-9f86c346.js} +1 -1
- package/dist/esm/{pesquisa-fetcher-72125b13.js → dataunit-fetcher-87ecba4a.js} +57 -163
- package/dist/esm/form-config-fetcher-5d72aaf1.js +253 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-fetcher-9cfab836.js +164 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +5 -3
- package/dist/esm/snk-application.entry.js +30 -20
- package/dist/esm/snk-attach.entry.js +5 -3
- package/dist/esm/snk-crud.entry.js +43 -9
- package/dist/esm/snk-data-exporter.entry.js +6 -4
- package/dist/esm/snk-data-unit-1132e40b.js +612 -0
- package/dist/esm/snk-data-unit.entry.js +10 -2
- package/dist/esm/snk-detail-view.entry.js +8 -6
- package/dist/esm/snk-filter-bar.entry.js +3 -2
- package/dist/esm/snk-filter-modal-item.entry.js +3 -2
- package/dist/esm/snk-form-config.entry.js +2 -1
- package/dist/esm/snk-form-view.entry.js +36 -0
- package/dist/esm/snk-form.entry.js +28 -7
- package/dist/esm/snk-grid.entry.js +56 -11
- package/dist/esm/{snk-guides-viewer-303aafb4.js → snk-guides-viewer-359e39a7.js} +19 -6
- package/dist/esm/snk-guides-viewer.entry.js +8 -6
- package/dist/esm/snk-personalized-filter.entry.js +3 -2
- package/dist/esm/snk-simple-crud.entry.js +95 -13
- package/dist/sankhyablocks/p-010d475f.js +1 -0
- package/dist/sankhyablocks/p-08fee6e8.js +60 -0
- package/dist/sankhyablocks/p-0bcc6e83.js +1 -0
- package/dist/sankhyablocks/p-2a84e45b.entry.js +1 -0
- package/dist/sankhyablocks/{p-0e8702f0.js → p-2eb90860.js} +1 -1
- package/dist/sankhyablocks/p-33f695d6.entry.js +1 -0
- package/dist/sankhyablocks/p-3519a984.entry.js +1 -0
- package/dist/sankhyablocks/p-4ce73e88.js +1 -0
- package/dist/sankhyablocks/{p-e27496ed.js → p-566f5f50.js} +6 -6
- package/dist/sankhyablocks/p-59dccb7a.entry.js +1 -0
- package/dist/sankhyablocks/p-5c8a9e27.entry.js +1 -0
- package/dist/sankhyablocks/p-66a31d30.entry.js +11 -0
- package/dist/sankhyablocks/p-6b2be902.js +6 -0
- package/dist/sankhyablocks/p-7ecaaea2.entry.js +1 -0
- package/dist/sankhyablocks/p-83950924.entry.js +1 -0
- package/dist/sankhyablocks/p-873d2e6a.entry.js +1 -0
- package/dist/sankhyablocks/p-931343a1.entry.js +1 -0
- package/dist/sankhyablocks/p-a6dfa396.js +1 -0
- package/dist/sankhyablocks/p-aa854fa8.entry.js +1 -0
- package/dist/sankhyablocks/p-b11921ca.entry.js +1 -0
- package/dist/sankhyablocks/p-cb91634d.js +1 -0
- package/dist/sankhyablocks/p-cf9d2d1e.entry.js +1 -0
- package/dist/sankhyablocks/p-d29a252c.js +1 -0
- package/dist/sankhyablocks/p-d799aa7f.entry.js +1 -0
- package/dist/sankhyablocks/p-da6e3dcf.entry.js +1 -0
- package/dist/sankhyablocks/p-e0c27486.js +26 -0
- package/dist/sankhyablocks/p-f72e8835.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +6 -2
- package/dist/types/components/snk-crud/snk-crud.d.ts +14 -1
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +13 -1
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +6 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +3 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +45 -1
- package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +3 -0
- package/dist/types/components/snk-form/snk-form.d.ts +6 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +19 -3
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +22 -0
- package/dist/types/components.d.ts +68 -4
- package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +11 -0
- package/dist/types/lib/dataUnit/ValueFormatter.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +10 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +7 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +20 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/snk-data-unit-abd2113f.js +0 -427
- package/dist/esm/snk-data-unit-29eba11a.js +0 -425
- package/dist/sankhyablocks/p-029bfc09.js +0 -1
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
- package/dist/sankhyablocks/p-07825198.js +0 -1
- package/dist/sankhyablocks/p-13ea113d.entry.js +0 -1
- package/dist/sankhyablocks/p-1fa244c0.entry.js +0 -1
- package/dist/sankhyablocks/p-2d972c2e.entry.js +0 -1
- package/dist/sankhyablocks/p-314e2d1a.entry.js +0 -1
- package/dist/sankhyablocks/p-32556aa6.js +0 -1
- package/dist/sankhyablocks/p-3494a28e.entry.js +0 -1
- package/dist/sankhyablocks/p-35bd4df7.entry.js +0 -1
- package/dist/sankhyablocks/p-536eeb16.js +0 -26
- package/dist/sankhyablocks/p-563701f3.js +0 -1
- package/dist/sankhyablocks/p-61984566.entry.js +0 -1
- package/dist/sankhyablocks/p-64977b22.entry.js +0 -1
- package/dist/sankhyablocks/p-65b6dba3.entry.js +0 -1
- package/dist/sankhyablocks/p-6bc64fb0.entry.js +0 -1
- package/dist/sankhyablocks/p-aedf37fb.js +0 -65
- package/dist/sankhyablocks/p-b233f5aa.entry.js +0 -1
- package/dist/sankhyablocks/p-b86ea293.entry.js +0 -1
- package/dist/sankhyablocks/p-c73482cf.js +0 -1
- package/dist/sankhyablocks/p-cb3c7b4a.entry.js +0 -11
- package/dist/sankhyablocks/p-d911a023.entry.js +0 -1
- package/dist/sankhyablocks/p-fa84e72f.entry.js +0 -1
@@ -1,8 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"entries": [
|
3
3
|
"./components/snk-filter-bar/filter-item/snk-filter-item.js",
|
4
|
-
"./components/snk-application/snk-application.js",
|
5
4
|
"./components/snk-data-unit/snk-data-unit.js",
|
5
|
+
"./components/snk-application/snk-application.js",
|
6
6
|
"./components/snk-taskbar/snk-taskbar.js",
|
7
7
|
"./components/snk-filter-bar/filter-list/snk-filter-list.js",
|
8
8
|
"./components/snk-print-selector/snk-print-selector.js",
|
@@ -347,7 +347,7 @@ export class SnkApplication {
|
|
347
347
|
* Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
|
348
348
|
* passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado.
|
349
349
|
*/
|
350
|
-
async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
350
|
+
async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID, options) {
|
351
351
|
if (resourceID == undefined) {
|
352
352
|
resourceID = this.applicationResourceID;
|
353
353
|
}
|
@@ -357,21 +357,29 @@ export class SnkApplication {
|
|
357
357
|
duPromisses.push(new PendingPromise(resolve, reject));
|
358
358
|
if (!waitingDu) {
|
359
359
|
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
}
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
}
|
371
|
-
}
|
360
|
+
if (options === null || options === void 0 ? void 0 : options.skipLoadMetadata) {
|
361
|
+
this.processResolveDataUnit(dataUnit, dataUnitName, duPromisses);
|
362
|
+
}
|
363
|
+
else {
|
364
|
+
dataUnit.loadMetadata().then(() => {
|
365
|
+
this.processResolveDataUnit(dataUnit, dataUnitName, duPromisses);
|
366
|
+
}).catch(reason => {
|
367
|
+
while (duPromisses.length > 0) {
|
368
|
+
duPromisses.pop().reject(reason);
|
369
|
+
}
|
370
|
+
});
|
371
|
+
}
|
372
372
|
}
|
373
373
|
});
|
374
374
|
}
|
375
|
+
processResolveDataUnit(dataUnit, dataUnitName, duPromisses) {
|
376
|
+
if (dataUnitName) {
|
377
|
+
this.updateDataunitCache(undefined, dataUnitName, dataUnit);
|
378
|
+
}
|
379
|
+
while (duPromisses.length > 0) {
|
380
|
+
duPromisses.pop().resolve(dataUnit);
|
381
|
+
}
|
382
|
+
}
|
375
383
|
/**
|
376
384
|
* Atualiza o cache de dataunits da aplicação.
|
377
385
|
* @param oldName - Nome do dataunit que está em cache.
|
@@ -387,14 +395,14 @@ export class SnkApplication {
|
|
387
395
|
/**
|
388
396
|
* Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
|
389
397
|
*/
|
390
|
-
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
398
|
+
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID, options) {
|
391
399
|
return new Promise((resolve, reject) => {
|
392
400
|
const dataUnit = this._duCache.get(dataUnitName);
|
393
401
|
if (dataUnit) {
|
394
402
|
resolve(dataUnit);
|
395
403
|
}
|
396
404
|
else {
|
397
|
-
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID).then(dataUnit => {
|
405
|
+
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID, options).then(dataUnit => {
|
398
406
|
resolve(dataUnit);
|
399
407
|
}).catch(reason => reject(reason));
|
400
408
|
}
|
@@ -1678,7 +1686,7 @@ export class SnkApplication {
|
|
1678
1686
|
},
|
1679
1687
|
"createDataunit": {
|
1680
1688
|
"complexType": {
|
1681
|
-
"signature": "(entityName: string, dataUnitName?: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string) => Promise<DataUnit>",
|
1689
|
+
"signature": "(entityName: string, dataUnitName?: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string, options?: GetDataUnitOptions) => Promise<DataUnit>",
|
1682
1690
|
"parameters": [{
|
1683
1691
|
"tags": [],
|
1684
1692
|
"text": ""
|
@@ -1694,6 +1702,9 @@ export class SnkApplication {
|
|
1694
1702
|
}, {
|
1695
1703
|
"tags": [],
|
1696
1704
|
"text": ""
|
1705
|
+
}, {
|
1706
|
+
"tags": [],
|
1707
|
+
"text": ""
|
1697
1708
|
}],
|
1698
1709
|
"references": {
|
1699
1710
|
"Promise": {
|
@@ -1702,6 +1713,9 @@ export class SnkApplication {
|
|
1702
1713
|
"DataUnit": {
|
1703
1714
|
"location": "import",
|
1704
1715
|
"path": "@sankhyalabs/core"
|
1716
|
+
},
|
1717
|
+
"GetDataUnitOptions": {
|
1718
|
+
"location": "global"
|
1705
1719
|
}
|
1706
1720
|
},
|
1707
1721
|
"return": "Promise<DataUnit>"
|
@@ -1760,7 +1774,7 @@ export class SnkApplication {
|
|
1760
1774
|
},
|
1761
1775
|
"getDataUnit": {
|
1762
1776
|
"complexType": {
|
1763
|
-
"signature": "(entityName: string, dataUnitName: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string) => Promise<DataUnit>",
|
1777
|
+
"signature": "(entityName: string, dataUnitName: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string, options?: GetDataUnitOptions) => Promise<DataUnit>",
|
1764
1778
|
"parameters": [{
|
1765
1779
|
"tags": [],
|
1766
1780
|
"text": ""
|
@@ -1776,6 +1790,9 @@ export class SnkApplication {
|
|
1776
1790
|
}, {
|
1777
1791
|
"tags": [],
|
1778
1792
|
"text": ""
|
1793
|
+
}, {
|
1794
|
+
"tags": [],
|
1795
|
+
"text": ""
|
1779
1796
|
}],
|
1780
1797
|
"references": {
|
1781
1798
|
"Promise": {
|
@@ -1784,6 +1801,9 @@ export class SnkApplication {
|
|
1784
1801
|
"DataUnit": {
|
1785
1802
|
"location": "import",
|
1786
1803
|
"path": "@sankhyalabs/core"
|
1804
|
+
},
|
1805
|
+
"GetDataUnitOptions": {
|
1806
|
+
"location": "global"
|
1787
1807
|
}
|
1788
1808
|
},
|
1789
1809
|
"return": "Promise<DataUnit>"
|
@@ -70,6 +70,24 @@ export class SnkCrud {
|
|
70
70
|
async getFilterBar() {
|
71
71
|
return await this._snkGrid.getFilterBar();
|
72
72
|
}
|
73
|
+
/**
|
74
|
+
* Registra um formatador de valores para uma coluna da grid.
|
75
|
+
*/
|
76
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
77
|
+
this._snkGrid.addCustomValueFormatter(columnName, customFormatter);
|
78
|
+
}
|
79
|
+
/**
|
80
|
+
* Remove o formatador de valores de uma coluna da grid.
|
81
|
+
*/
|
82
|
+
async removeCustomValueFormatter(columnName) {
|
83
|
+
this._snkGrid.removeCustomValueFormatter(columnName);
|
84
|
+
}
|
85
|
+
/**
|
86
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
87
|
+
*/
|
88
|
+
async setFieldProp(fieldName, propName, value) {
|
89
|
+
await this._guidesViewer.setFieldProp(fieldName, propName, value);
|
90
|
+
}
|
73
91
|
currentViewModeWatcher(currentView) {
|
74
92
|
this._viewHistory = [...this._viewHistory.slice(-1), currentView];
|
75
93
|
}
|
@@ -145,12 +163,7 @@ export class SnkCrud {
|
|
145
163
|
else {
|
146
164
|
this.initDataUnit();
|
147
165
|
}
|
148
|
-
this._snkDataUnit.addEventListener("dataStateChange",
|
149
|
-
this._dataState = dataState;
|
150
|
-
if (dataState.selectedRecord !== undefined) {
|
151
|
-
this.attachmentRegisterKey = await this.getAttachmentRegisterKey();
|
152
|
-
}
|
153
|
-
});
|
166
|
+
this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
|
154
167
|
break;
|
155
168
|
}
|
156
169
|
parent = parent.parentElement;
|
@@ -166,6 +179,26 @@ export class SnkCrud {
|
|
166
179
|
this.removeShortcuts();
|
167
180
|
window.removeEventListener("keydown", this._keyDownHandler);
|
168
181
|
}
|
182
|
+
async handleDataStateChange(evt) {
|
183
|
+
var _a;
|
184
|
+
this._dataState = evt.detail;
|
185
|
+
if (this._dataState.selectedRecord !== undefined) {
|
186
|
+
this.attachmentRegisterKey = await this.getAttachmentRegisterKey();
|
187
|
+
}
|
188
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
189
|
+
for (const field of fieldsWithRmPrecision || []) {
|
190
|
+
if (!field) {
|
191
|
+
continue;
|
192
|
+
}
|
193
|
+
const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
|
194
|
+
if (!rmPrecision) {
|
195
|
+
continue;
|
196
|
+
}
|
197
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
198
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
199
|
+
}
|
200
|
+
;
|
201
|
+
}
|
169
202
|
async initKeyboardManager() {
|
170
203
|
var _a;
|
171
204
|
const keyboardManager = await ((_a = this._application) === null || _a === void 0 ? void 0 : _a.getKeyboardManager());
|
@@ -777,6 +810,76 @@ export class SnkCrud {
|
|
777
810
|
"text": "Retorna o elemento da filter-bar da grade.",
|
778
811
|
"tags": []
|
779
812
|
}
|
813
|
+
},
|
814
|
+
"addCustomValueFormatter": {
|
815
|
+
"complexType": {
|
816
|
+
"signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
|
817
|
+
"parameters": [{
|
818
|
+
"tags": [],
|
819
|
+
"text": ""
|
820
|
+
}, {
|
821
|
+
"tags": [],
|
822
|
+
"text": ""
|
823
|
+
}],
|
824
|
+
"references": {
|
825
|
+
"Promise": {
|
826
|
+
"location": "global"
|
827
|
+
},
|
828
|
+
"ICustomFormatter": {
|
829
|
+
"location": "import",
|
830
|
+
"path": "@sankhyalabs/ezui/dist/types/components/ez-grid/interfaces"
|
831
|
+
}
|
832
|
+
},
|
833
|
+
"return": "Promise<void>"
|
834
|
+
},
|
835
|
+
"docs": {
|
836
|
+
"text": "Registra um formatador de valores para uma coluna da grid.",
|
837
|
+
"tags": []
|
838
|
+
}
|
839
|
+
},
|
840
|
+
"removeCustomValueFormatter": {
|
841
|
+
"complexType": {
|
842
|
+
"signature": "(columnName: string) => Promise<void>",
|
843
|
+
"parameters": [{
|
844
|
+
"tags": [],
|
845
|
+
"text": ""
|
846
|
+
}],
|
847
|
+
"references": {
|
848
|
+
"Promise": {
|
849
|
+
"location": "global"
|
850
|
+
}
|
851
|
+
},
|
852
|
+
"return": "Promise<void>"
|
853
|
+
},
|
854
|
+
"docs": {
|
855
|
+
"text": "Remove o formatador de valores de uma coluna da grid.",
|
856
|
+
"tags": []
|
857
|
+
}
|
858
|
+
},
|
859
|
+
"setFieldProp": {
|
860
|
+
"complexType": {
|
861
|
+
"signature": "(fieldName: string, propName: string, value: any) => Promise<void>",
|
862
|
+
"parameters": [{
|
863
|
+
"tags": [],
|
864
|
+
"text": ""
|
865
|
+
}, {
|
866
|
+
"tags": [],
|
867
|
+
"text": ""
|
868
|
+
}, {
|
869
|
+
"tags": [],
|
870
|
+
"text": ""
|
871
|
+
}],
|
872
|
+
"references": {
|
873
|
+
"Promise": {
|
874
|
+
"location": "global"
|
875
|
+
}
|
876
|
+
},
|
877
|
+
"return": "Promise<void>"
|
878
|
+
},
|
879
|
+
"docs": {
|
880
|
+
"text": "Altera/adiciona uma propriedade nos metadados do campo.",
|
881
|
+
"tags": []
|
882
|
+
}
|
780
883
|
}
|
781
884
|
};
|
782
885
|
}
|
@@ -3,6 +3,7 @@ import { Host, h } from "@stencil/core";
|
|
3
3
|
import { DataBinder } from "@sankhyalabs/ezui/dist/collection/utils/form";
|
4
4
|
export class SnkFormView {
|
5
5
|
constructor() {
|
6
|
+
this._fieldProps = new Map();
|
6
7
|
this.levelPath = undefined;
|
7
8
|
this.label = undefined;
|
8
9
|
this.name = undefined;
|
@@ -16,12 +17,29 @@ export class SnkFormView {
|
|
16
17
|
this.canFix = true;
|
17
18
|
this.recordsValidator = undefined;
|
18
19
|
this.fieldToFocus = undefined;
|
20
|
+
this.fieldsProps = undefined;
|
19
21
|
}
|
20
22
|
async showUp() {
|
21
23
|
if (this._formView) {
|
22
24
|
this._formView.showUp();
|
23
25
|
}
|
24
26
|
}
|
27
|
+
/**
|
28
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
29
|
+
*/
|
30
|
+
async setFieldProp(fieldName, propName, value) {
|
31
|
+
const props = this._fieldProps.get(fieldName) || [];
|
32
|
+
this._fieldProps.set(fieldName, [...props, { propName, value }]);
|
33
|
+
}
|
34
|
+
async observeFieldsProps(newValue) {
|
35
|
+
for (const field in newValue) {
|
36
|
+
const fieldProps = newValue[field];
|
37
|
+
const propNames = Object.keys(fieldProps);
|
38
|
+
for (const propName of propNames) {
|
39
|
+
await this.setFieldProp(field, propName, fieldProps[propName]);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
25
43
|
changeFix() {
|
26
44
|
this.fixed = !this.fixed;
|
27
45
|
this.emitEvent("fixed");
|
@@ -80,7 +98,11 @@ export class SnkFormView {
|
|
80
98
|
this._dataBinder.onDisconnectedCallback();
|
81
99
|
}
|
82
100
|
}
|
101
|
+
componentDidLoad() {
|
102
|
+
this.observeFieldsProps(this.fieldsProps);
|
103
|
+
}
|
83
104
|
componentDidRender() {
|
105
|
+
this.setFieldProps();
|
84
106
|
if (this.fieldToFocus == undefined) {
|
85
107
|
return;
|
86
108
|
}
|
@@ -92,6 +114,17 @@ export class SnkFormView {
|
|
92
114
|
this.snkRequestClearFieldToFocus.emit();
|
93
115
|
});
|
94
116
|
}
|
117
|
+
setFieldProps() {
|
118
|
+
if (!this._formView) {
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
for (const [fieldName, propsToChange] of this._fieldProps) {
|
122
|
+
propsToChange.forEach(prop => {
|
123
|
+
this._formView.setFieldProp(fieldName, prop.propName, prop.value);
|
124
|
+
this._fieldProps.delete(fieldName);
|
125
|
+
});
|
126
|
+
}
|
127
|
+
}
|
95
128
|
render() {
|
96
129
|
return (h(Host, { class: "ez-box__container" }, h("div", { class: "summary-header ez-flex ez-size-width--full" }, h("div", { class: "ez-flex ez-text ez-title--primary ez-text--bold ez-flex--justify-start ez-flex--align-items-center ez-col--sd-9" }, this.levelPath ? h("span", { class: "level-path" }, this.levelPath + " /") : undefined, this.label), h("div", { class: "ez-flex ez-flex--justify-end ez-col--sd-3" }, this.canFix &&
|
97
130
|
h("ez-button", { class: "ez-padding-left--medium", mode: "icon", size: "small", iconName: this.fixed ? "un-pin" : "push-pin", "data-element-id": ElementIDUtils.getInternalIDInfo("toggleFixed_ezFormCard"), onClick: () => this.changeFix(), title: this.fixed ? "Desafixar" : "Fixar" }), this.canExpand &&
|
@@ -361,6 +394,21 @@ export class SnkFormView {
|
|
361
394
|
},
|
362
395
|
"attribute": "field-to-focus",
|
363
396
|
"reflect": false
|
397
|
+
},
|
398
|
+
"fieldsProps": {
|
399
|
+
"type": "unknown",
|
400
|
+
"mutable": false,
|
401
|
+
"complexType": {
|
402
|
+
"original": "object",
|
403
|
+
"resolved": "object",
|
404
|
+
"references": {}
|
405
|
+
},
|
406
|
+
"required": false,
|
407
|
+
"optional": false,
|
408
|
+
"docs": {
|
409
|
+
"tags": [],
|
410
|
+
"text": "Lista de propriedades que ser\u00E3o alteradas/adicionadas por coluna."
|
411
|
+
}
|
364
412
|
}
|
365
413
|
};
|
366
414
|
}
|
@@ -441,7 +489,38 @@ export class SnkFormView {
|
|
441
489
|
"text": "",
|
442
490
|
"tags": []
|
443
491
|
}
|
492
|
+
},
|
493
|
+
"setFieldProp": {
|
494
|
+
"complexType": {
|
495
|
+
"signature": "(fieldName: string, propName: string, value: any) => Promise<void>",
|
496
|
+
"parameters": [{
|
497
|
+
"tags": [],
|
498
|
+
"text": ""
|
499
|
+
}, {
|
500
|
+
"tags": [],
|
501
|
+
"text": ""
|
502
|
+
}, {
|
503
|
+
"tags": [],
|
504
|
+
"text": ""
|
505
|
+
}],
|
506
|
+
"references": {
|
507
|
+
"Promise": {
|
508
|
+
"location": "global"
|
509
|
+
}
|
510
|
+
},
|
511
|
+
"return": "Promise<void>"
|
512
|
+
},
|
513
|
+
"docs": {
|
514
|
+
"text": "Altera/adiciona uma propriedade nos metadados do campo.",
|
515
|
+
"tags": []
|
516
|
+
}
|
444
517
|
}
|
445
518
|
};
|
446
519
|
}
|
520
|
+
static get watchers() {
|
521
|
+
return [{
|
522
|
+
"propName": "fieldsProps",
|
523
|
+
"methodName": "observeFieldsProps"
|
524
|
+
}];
|
525
|
+
}
|
447
526
|
}
|
@@ -33,6 +33,7 @@ export class SnkGuidesViewer {
|
|
33
33
|
this._formEditorConfigManager = undefined;
|
34
34
|
this._formEditorDataUnit = undefined;
|
35
35
|
this._fieldToGetFocus = undefined;
|
36
|
+
this._fieldsProps = {};
|
36
37
|
}
|
37
38
|
observeDataUnit() {
|
38
39
|
this.loadGuides(true);
|
@@ -63,6 +64,15 @@ export class SnkGuidesViewer {
|
|
63
64
|
async findField() {
|
64
65
|
await openFieldSearch(this._moreOptions, this._fieldSearch);
|
65
66
|
}
|
67
|
+
/**
|
68
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
69
|
+
*/
|
70
|
+
async setFieldProp(fieldName, propName, value) {
|
71
|
+
const newFieldsProps = {
|
72
|
+
[fieldName]: Object.assign(Object.assign({}, this._fieldsProps[fieldName]), { [propName]: value })
|
73
|
+
};
|
74
|
+
this._fieldsProps = Object.assign(Object.assign({}, this._fieldsProps), newFieldsProps);
|
75
|
+
}
|
66
76
|
exitViewer() {
|
67
77
|
if (this.dataUnit.isDirty()) {
|
68
78
|
this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
@@ -205,7 +215,7 @@ export class SnkGuidesViewer {
|
|
205
215
|
if (sheet == undefined) {
|
206
216
|
return;
|
207
217
|
}
|
208
|
-
return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); } });
|
218
|
+
return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); }, fieldsProps: params.fieldsProps });
|
209
219
|
})));
|
210
220
|
}
|
211
221
|
wrapDetail(levels, content) {
|
@@ -254,7 +264,7 @@ export class SnkGuidesViewer {
|
|
254
264
|
const sheet = this._masterFormMetadata.getSheet(cardId);
|
255
265
|
if (sheet) {
|
256
266
|
const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
|
257
|
-
content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler() }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
267
|
+
content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), fieldsProps: this._fieldsProps }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
258
268
|
}
|
259
269
|
}
|
260
270
|
return content;
|
@@ -460,7 +470,8 @@ export class SnkGuidesViewer {
|
|
460
470
|
dataUnit: this.dataUnit,
|
461
471
|
recordsValidator: this.recordsValidator,
|
462
472
|
fieldToFocus: this._fieldToGetFocus,
|
463
|
-
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this)
|
473
|
+
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
|
474
|
+
fieldsProps: this._fieldsProps
|
464
475
|
}), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail), resourceID: this.resourceID })));
|
465
476
|
}
|
466
477
|
static get is() { return "snk-guides-viewer"; }
|
@@ -774,7 +785,8 @@ export class SnkGuidesViewer {
|
|
774
785
|
"_guides": {},
|
775
786
|
"_formEditorConfigManager": {},
|
776
787
|
"_formEditorDataUnit": {},
|
777
|
-
"_fieldToGetFocus": {}
|
788
|
+
"_fieldToGetFocus": {},
|
789
|
+
"_fieldsProps": {}
|
778
790
|
};
|
779
791
|
}
|
780
792
|
static get events() {
|
@@ -874,6 +886,31 @@ export class SnkGuidesViewer {
|
|
874
886
|
"text": "Abre o localizador de campos",
|
875
887
|
"tags": []
|
876
888
|
}
|
889
|
+
},
|
890
|
+
"setFieldProp": {
|
891
|
+
"complexType": {
|
892
|
+
"signature": "(fieldName: string, propName: string, value: any) => Promise<void>",
|
893
|
+
"parameters": [{
|
894
|
+
"tags": [],
|
895
|
+
"text": ""
|
896
|
+
}, {
|
897
|
+
"tags": [],
|
898
|
+
"text": ""
|
899
|
+
}, {
|
900
|
+
"tags": [],
|
901
|
+
"text": ""
|
902
|
+
}],
|
903
|
+
"references": {
|
904
|
+
"Promise": {
|
905
|
+
"location": "global"
|
906
|
+
}
|
907
|
+
},
|
908
|
+
"return": "Promise<void>"
|
909
|
+
},
|
910
|
+
"docs": {
|
911
|
+
"text": "Altera/adiciona uma propriedade nos metadados do campo.",
|
912
|
+
"tags": []
|
913
|
+
}
|
877
914
|
}
|
878
915
|
};
|
879
916
|
}
|
@@ -7,26 +7,31 @@ export class CommonsExporter {
|
|
7
7
|
}
|
8
8
|
async getColumnsMetadata() {
|
9
9
|
var _a;
|
10
|
-
|
11
|
-
return this.buildColumnsMetadata(columnsState);
|
10
|
+
this.columnsState = await ((_a = this.grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
|
11
|
+
return await this.buildColumnsMetadata(this.columnsState);
|
12
12
|
}
|
13
|
-
|
13
|
+
getColumnsState() {
|
14
|
+
return this.columnsState;
|
15
|
+
}
|
16
|
+
async buildColumnsMetadata(gridColumns) {
|
17
|
+
var _a, _b;
|
14
18
|
const columnsMetadata = [];
|
15
|
-
|
16
|
-
var _a, _b;
|
19
|
+
for (const column of gridColumns) {
|
17
20
|
/**
|
18
21
|
* TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
|
19
22
|
*/
|
20
23
|
if (column.hidden && column.name !== "RECDESP") {
|
21
|
-
|
24
|
+
continue;
|
22
25
|
}
|
23
26
|
const fieldData = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
|
27
|
+
const customFormatter = await this.grid.getCustomValueFormatter(column.name);
|
24
28
|
const columnData = {
|
25
29
|
label: column.label,
|
26
30
|
id: column.name,
|
27
31
|
width: (fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface) === UserInterface.SEARCH ? 30 : column.width,
|
28
32
|
type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
29
|
-
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
|
33
|
+
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface,
|
34
|
+
customFormatter
|
30
35
|
};
|
31
36
|
columnsMetadata.push(columnData);
|
32
37
|
if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
|
@@ -42,7 +47,8 @@ export class CommonsExporter {
|
|
42
47
|
};
|
43
48
|
columnsMetadata.push(descriptionColumn);
|
44
49
|
}
|
45
|
-
}
|
50
|
+
}
|
51
|
+
;
|
46
52
|
return columnsMetadata || [];
|
47
53
|
}
|
48
54
|
}
|
package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js
CHANGED
@@ -48,6 +48,11 @@ export default class ClientSideExporterProvider extends CommonsExporter {
|
|
48
48
|
if (fieldDescriptor.userInterface === UserInterface.SEARCH) {
|
49
49
|
return value.value;
|
50
50
|
}
|
51
|
+
if (column.customFormatter) {
|
52
|
+
const ezGridColumn = this.getColumnsState().find(columnState => column.id === columnState.name);
|
53
|
+
const formattedValue = column.customFormatter.format(value, ezGridColumn, record.__record__id__);
|
54
|
+
return formattedValue;
|
55
|
+
}
|
51
56
|
return this.dataUnit.getFormattedValue(id, value);
|
52
57
|
}
|
53
58
|
}
|