@sankhyalabs/sankhyablocks 8.15.0-dev.6 → 8.15.0-dev.61
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-8009ecb2.js → ConfigStorage-7df9d3bb.js} +102 -30
- package/dist/cjs/IExporterProvider-c307e2b1.js +187 -0
- package/dist/cjs/{ISave-d68ce3cd.js → ISave-e91b70a7.js} +1 -0
- package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
- package/dist/cjs/{SnkFormConfigManager-7d850fbc.js → SnkFormConfigManager-4259edbe.js} +21 -13
- package/dist/cjs/{SnkMessageBuilder-7293d0ad.js → SnkMessageBuilder-66aa2557.js} +19 -1
- package/dist/cjs/{auth-fetcher-c8467c07.js → auth-fetcher-e6112be7.js} +1 -1
- package/dist/cjs/{DataFetcher-ba94ed5b.js → form-config-fetcher-3c4daeb5.js} +258 -4
- package/dist/cjs/index-f9e81701.js +2 -10
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{dataunit-fetcher-bd4c52da.js → pesquisa-fetcher-cbdaba63.js} +520 -86
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/{snk-actions-button_2.cjs.entry.js → snk-actions-button_4.cjs.entry.js} +529 -13
- package/dist/cjs/snk-application.cjs.entry.js +62 -28
- package/dist/cjs/snk-attach.cjs.entry.js +422 -62
- package/dist/cjs/snk-crud.cjs.entry.js +17 -12
- package/dist/cjs/snk-data-exporter.cjs.entry.js +204 -82
- package/dist/cjs/{snk-data-unit-1bc69073.js → snk-data-unit-abd2113f.js} +3 -38
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +10 -12
- package/dist/cjs/snk-entity-list.cjs.entry.js +5 -3
- package/dist/cjs/snk-filter-bar.cjs.entry.js +65 -10
- package/dist/cjs/snk-filter-detail.cjs.entry.js +4 -1
- package/dist/cjs/snk-filter-item.cjs.entry.js +13 -6
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -3
- package/dist/cjs/snk-filter-modal.cjs.entry.js +2 -1
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +2 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +46 -27
- package/dist/cjs/snk-form.cjs.entry.js +10 -4
- package/dist/cjs/snk-grid.cjs.entry.js +95 -116
- package/dist/cjs/{snk-guides-viewer-cb176c4d.js → snk-guides-viewer-b0c44e0c.js} +15 -11
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -10
- package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +3 -1
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -3
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +367 -38
- package/dist/cjs/snk-taskbar.cjs.entry.js +124 -15
- package/dist/cjs/{taskbar-elements-01b85b99.js → taskbar-elements-d9392685.js} +11 -11
- package/dist/collection/collection-manifest.json +7 -7
- package/dist/collection/components/snk-application/__mocks__/snk-application.js +7 -0
- package/dist/collection/components/snk-application/snk-application.js +85 -2
- package/dist/collection/components/snk-attach/snk-attach.js +212 -39
- package/dist/collection/components/snk-attach/structure/{crud-config-builder.js → builder/anexo-sistema-crud-config.builder.js} +1 -1
- package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +62 -0
- package/dist/collection/components/snk-attach/structure/{taskbar-builder.js → builder/taskbar-builder.js} +1 -1
- package/dist/collection/components/snk-attach/structure/fetcher/facade/fetcher.facade.js +1 -0
- package/dist/collection/components/snk-attach/structure/{data-unit-builder.js → fetcher/factory/anexo-sistema-data-unit.factory.js} +14 -11
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +118 -0
- package/dist/collection/components/snk-attach/structure/index.js +6 -3
- package/dist/collection/components/snk-crud/snk-crud.js +95 -3
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +11 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +27 -3
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +90 -0
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +68 -0
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +48 -1
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +53 -0
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +42 -48
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
- package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +3 -42
- package/dist/collection/components/snk-entity-list/snk-entity-list.js +5 -3
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +2 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +3 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +22 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +31 -6
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +19 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +24 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +159 -5
- package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +3 -1
- package/dist/collection/components/snk-form/snk-form.js +25 -1
- package/dist/collection/components/{snk-form → snk-form-config}/SnkFormConfigManager.js +20 -12
- package/dist/collection/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.js +50 -30
- package/dist/collection/components/snk-grid/snk-grid.js +102 -109
- package/dist/collection/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.js +130 -123
- package/dist/collection/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.js +1 -1
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -4
- package/dist/collection/components/snk-simple-crud/regular-buttons.js +3 -0
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +10 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +548 -20
- package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +4 -2
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +11 -11
- package/dist/collection/components/snk-taskbar/snk-taskbar.css +17 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +167 -14
- package/dist/collection/lib/configs/ConfigStorage.js +86 -16
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +9 -40
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +33 -0
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +7 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/{attach-fetcher.js → AttachFetcher/anexo-sistema-fetcher.js} +16 -15
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.js +90 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/index.js +2 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDelete.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDownloadKey.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +3 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +4 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +11 -13
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +32 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +36 -23
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +12 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +21 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +6 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +12 -13
- package/dist/collection/lib/index.js +1 -1
- package/dist/collection/lib/message/resources/snk-attach.msg.js +13 -0
- package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +2 -1
- package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +4 -0
- package/dist/collection/lib/utils/CrudUtils.js +13 -1
- package/dist/components/ConfigStorage.js +93 -21
- package/dist/components/IExporterProvider.js +256 -0
- package/dist/components/ISave.js +42 -0
- package/dist/components/SnkFormConfigManager.js +19 -11
- package/dist/components/SnkMessageBuilder.js +19 -1
- package/dist/components/dataunit-fetcher.js +138 -91
- package/dist/components/form-config-fetcher.js +7035 -3
- package/dist/components/index.d.ts +6 -6
- package/dist/components/index2.js +198 -33
- package/dist/components/snk-actions-button2.js +3 -11
- package/dist/components/snk-application2.js +42 -3
- package/dist/components/snk-attach2.js +478 -70
- package/dist/components/snk-crud.js +18 -7
- package/dist/components/snk-data-exporter2.js +199 -82
- package/dist/components/snk-data-unit2.js +41 -39
- package/dist/components/snk-detail-view2.js +44 -12
- package/dist/components/snk-entity-list.js +5 -3
- package/dist/components/snk-expression-item2.js +1 -1
- package/dist/components/snk-filter-bar2.js +69 -8
- package/dist/components/snk-filter-detail2.js +5 -1
- package/dist/components/snk-filter-item2.js +14 -6
- package/dist/components/snk-filter-modal.js +4 -2
- package/dist/components/snk-filter-multi-select.js +2 -1
- package/dist/components/snk-form-config2.js +47 -27
- package/dist/components/snk-form.js +8 -0
- package/dist/components/snk-grid-config2.js +128 -102
- package/dist/components/snk-grid2.js +96 -112
- package/dist/components/snk-personalized-filter-editor.js +3 -1
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/components/snk-simple-crud2.js +421 -34
- package/dist/components/snk-taskbar2.js +144 -29
- package/dist/components/taskbar-actions-button2.js +4 -2
- package/dist/esm/{ConfigStorage-1244b8b0.js → ConfigStorage-928c3bf4.js} +93 -21
- package/dist/esm/IExporterProvider-e2a1195d.js +179 -0
- package/dist/esm/{ISave-4412b20c.js → ISave-d8c8bc59.js} +1 -0
- package/dist/esm/RecordIDUtils-87d02110.js +41 -0
- package/dist/esm/{SnkFormConfigManager-9be0e7d4.js → SnkFormConfigManager-a87ade7a.js} +21 -13
- package/dist/esm/{SnkMessageBuilder-ca843d1b.js → SnkMessageBuilder-0a4becdd.js} +19 -1
- package/dist/esm/{auth-fetcher-c05dc474.js → auth-fetcher-e1cb288f.js} +1 -1
- package/dist/esm/{DataFetcher-aa159c5a.js → form-config-fetcher-e3094014.js} +257 -5
- package/dist/esm/index-a7d3d3f1.js +2 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{dataunit-fetcher-65714f21.js → pesquisa-fetcher-6d8e50bb.js} +494 -69
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/{snk-actions-button_2.entry.js → snk-actions-button_4.entry.js} +523 -9
- package/dist/esm/snk-application.entry.js +43 -9
- package/dist/esm/snk-attach.entry.js +422 -62
- package/dist/esm/snk-crud.entry.js +17 -12
- package/dist/esm/snk-data-exporter.entry.js +204 -82
- package/dist/esm/{snk-data-unit-6208ebf0.js → snk-data-unit-29eba11a.js} +4 -39
- package/dist/esm/snk-data-unit.entry.js +3 -2
- package/dist/esm/snk-detail-view.entry.js +10 -12
- package/dist/esm/snk-entity-list.entry.js +5 -3
- package/dist/esm/snk-filter-bar.entry.js +65 -10
- package/dist/esm/snk-filter-detail.entry.js +4 -1
- package/dist/esm/snk-filter-item.entry.js +13 -6
- package/dist/esm/snk-filter-modal-item.entry.js +2 -3
- package/dist/esm/snk-filter-modal.entry.js +2 -1
- package/dist/esm/snk-filter-multi-select.entry.js +2 -1
- package/dist/esm/snk-form-config.entry.js +47 -28
- package/dist/esm/snk-form.entry.js +10 -4
- package/dist/esm/snk-grid.entry.js +95 -116
- package/dist/esm/{snk-guides-viewer-eeb8f354.js → snk-guides-viewer-1fd41a25.js} +15 -11
- package/dist/esm/snk-guides-viewer.entry.js +8 -10
- package/dist/esm/snk-personalized-filter-editor.entry.js +3 -1
- package/dist/esm/snk-personalized-filter.entry.js +2 -3
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +359 -30
- package/dist/esm/snk-taskbar.entry.js +125 -16
- package/dist/esm/{taskbar-elements-d4d0b424.js → taskbar-elements-ad766858.js} +11 -11
- package/dist/sankhyablocks/p-029bfc09.js +1 -0
- package/dist/sankhyablocks/p-07825198.js +1 -0
- package/dist/sankhyablocks/p-0e8702f0.js +1 -0
- package/dist/sankhyablocks/p-13ea113d.entry.js +1 -0
- package/dist/sankhyablocks/{p-9e7d65a4.js → p-21749402.js} +1 -1
- package/dist/sankhyablocks/p-314e2d1a.entry.js +1 -0
- package/dist/sankhyablocks/p-32556aa6.js +1 -0
- package/dist/sankhyablocks/p-3357af48.js +1 -0
- package/dist/sankhyablocks/p-33718dfc.entry.js +1 -0
- package/dist/sankhyablocks/p-3c2a1f4d.js +65 -0
- package/dist/sankhyablocks/p-3e7167dd.js +1 -0
- package/dist/sankhyablocks/p-536eeb16.js +26 -0
- package/dist/sankhyablocks/p-54a5d52a.entry.js +1 -0
- package/dist/sankhyablocks/p-587f9dcf.entry.js +1 -0
- package/dist/sankhyablocks/p-61984566.entry.js +1 -0
- package/dist/sankhyablocks/p-61dd89eb.js +1 -0
- package/dist/sankhyablocks/p-65b6dba3.entry.js +1 -0
- package/dist/sankhyablocks/p-6a7bc5c8.entry.js +1 -0
- package/dist/sankhyablocks/p-6c9edfd8.entry.js +1 -0
- package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
- package/dist/sankhyablocks/p-89bde7d3.entry.js +1 -0
- package/dist/sankhyablocks/p-91dceecf.entry.js +1 -0
- package/dist/sankhyablocks/p-9863d682.js +1 -0
- package/dist/sankhyablocks/p-a40cbad8.entry.js +1 -0
- package/dist/sankhyablocks/p-b11aa1e0.entry.js +1 -0
- package/dist/sankhyablocks/p-b86ea293.entry.js +1 -0
- package/dist/sankhyablocks/p-bf2acf72.entry.js +1 -0
- package/dist/sankhyablocks/p-cfb98f51.entry.js +1 -0
- package/dist/sankhyablocks/{p-247a8b36.entry.js → p-d1791da2.entry.js} +1 -1
- package/dist/sankhyablocks/p-d8ddb2a4.entry.js +11 -0
- package/dist/sankhyablocks/p-df73ac00.entry.js +1 -0
- package/dist/sankhyablocks/p-e27496ed.js +56 -0
- package/dist/sankhyablocks/p-e8763234.entry.js +1 -0
- package/dist/sankhyablocks/p-f92f1f5f.entry.js +1 -0
- package/dist/sankhyablocks/p-fa84e72f.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/__mocks__/snk-application.d.ts +3 -0
- package/dist/types/components/snk-application/snk-application.d.ts +15 -0
- package/dist/types/components/snk-attach/{structure/crud-config-builder.d.ts → interfaces/ICrudConfig.d.ts} +1 -2
- package/dist/types/components/snk-attach/interfaces/TFetcherType.d.ts +1 -0
- package/dist/types/components/snk-attach/snk-attach.d.ts +29 -6
- package/dist/types/components/snk-attach/structure/builder/anexo-sistema-crud-config.builder.d.ts +2 -0
- package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +40 -0
- package/dist/types/components/snk-attach/structure/{taskbar-builder.d.ts → builder/taskbar-builder.d.ts} +1 -1
- package/dist/types/components/snk-attach/structure/fetcher/facade/fetcher.facade.d.ts +11 -0
- package/dist/types/components/snk-attach/structure/fetcher/factory/anexo-sistema-data-unit.factory.d.ts +17 -0
- package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +16 -0
- package/dist/types/components/snk-attach/structure/index.d.ts +6 -3
- package/dist/types/components/snk-crud/snk-crud.d.ts +21 -0
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +1 -1
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +6 -1
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +13 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +11 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +21 -4
- package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +5 -0
- package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +17 -0
- package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +17 -0
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +3 -1
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +7 -3
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +5 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +27 -1
- package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +3 -1
- package/dist/types/components/snk-form/snk-form.d.ts +6 -1
- package/dist/types/components/{snk-form → snk-form-config}/SnkFormConfigManager.d.ts +2 -1
- package/dist/types/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.d.ts +5 -3
- package/dist/types/components/snk-grid/snk-grid.d.ts +19 -4
- package/dist/types/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.d.ts +11 -6
- package/dist/types/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.d.ts +1 -1
- package/dist/types/components/snk-simple-crud/regular-buttons.d.ts +3 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +98 -4
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +34 -1
- package/dist/types/components.d.ts +314 -12
- package/dist/types/lib/configs/ConfigStorage.d.ts +25 -1
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -2
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +4 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
- package/dist/types/lib/http/data-fetcher/fetchers/{attach-fetcher.d.ts → AttachFetcher/anexo-sistema-fetcher.d.ts} +3 -2
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.d.ts +11 -0
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.d.ts +8 -0
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/index.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +1 -0
- package/dist/types/lib/index.d.ts +1 -1
- package/dist/types/lib/utils/CrudUtils.d.ts +3 -0
- package/package.json +15 -6
- package/dist/cjs/PreloadManager-84466da6.js +0 -224
- package/dist/cjs/SnkMultiSelectionListDataSource-ba5838c2.js +0 -49
- package/dist/cjs/form-config-fetcher-df043d3d.js +0 -244
- package/dist/cjs/pesquisa-fetcher-ef050a47.js +0 -167
- package/dist/cjs/snk-grid-config.cjs.entry.js +0 -483
- package/dist/cjs/snk-select-box.cjs.entry.js +0 -25
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
- package/dist/components/DataFetcher.js +0 -7021
- package/dist/components/field-search.js +0 -121
- package/dist/components/index3.js +0 -199
- package/dist/esm/PreloadManager-c1c2f2b4.js +0 -222
- package/dist/esm/SnkMultiSelectionListDataSource-44494b0e.js +0 -43
- package/dist/esm/form-config-fetcher-36219cd3.js +0 -241
- package/dist/esm/pesquisa-fetcher-dd3ca0a5.js +0 -165
- package/dist/esm/snk-grid-config.entry.js +0 -479
- package/dist/esm/snk-select-box.entry.js +0 -21
- package/dist/sankhyablocks/p-0874adb5.entry.js +0 -1
- package/dist/sankhyablocks/p-094c30cb.js +0 -1
- package/dist/sankhyablocks/p-0d7863ed.js +0 -26
- package/dist/sankhyablocks/p-0dca29cb.entry.js +0 -1
- package/dist/sankhyablocks/p-11081798.entry.js +0 -1
- package/dist/sankhyablocks/p-20726710.entry.js +0 -1
- package/dist/sankhyablocks/p-29804fc5.js +0 -60
- package/dist/sankhyablocks/p-32f0935f.js +0 -1
- package/dist/sankhyablocks/p-3520c088.entry.js +0 -1
- package/dist/sankhyablocks/p-374d03f6.js +0 -1
- package/dist/sankhyablocks/p-4775a293.entry.js +0 -1
- package/dist/sankhyablocks/p-585294ee.js +0 -56
- package/dist/sankhyablocks/p-6977a26c.entry.js +0 -1
- package/dist/sankhyablocks/p-69efa80d.entry.js +0 -1
- package/dist/sankhyablocks/p-6d20d38c.entry.js +0 -1
- package/dist/sankhyablocks/p-776ee8e3.js +0 -1
- package/dist/sankhyablocks/p-7d51d949.entry.js +0 -11
- package/dist/sankhyablocks/p-809f367d.entry.js +0 -1
- package/dist/sankhyablocks/p-95a3778f.entry.js +0 -1
- package/dist/sankhyablocks/p-9695f78b.js +0 -1
- package/dist/sankhyablocks/p-98674137.entry.js +0 -1
- package/dist/sankhyablocks/p-a9e5b094.entry.js +0 -1
- package/dist/sankhyablocks/p-b146a9f0.entry.js +0 -1
- package/dist/sankhyablocks/p-bedb8ad6.entry.js +0 -1
- package/dist/sankhyablocks/p-c22c1d8e.js +0 -1
- package/dist/sankhyablocks/p-c758265f.entry.js +0 -1
- package/dist/sankhyablocks/p-ca4d337a.entry.js +0 -1
- package/dist/sankhyablocks/p-cb7419e0.entry.js +0 -1
- package/dist/sankhyablocks/p-d1f5bc50.js +0 -1
- package/dist/sankhyablocks/p-d4f9ee17.entry.js +0 -1
- package/dist/sankhyablocks/p-d6317851.entry.js +0 -1
- package/dist/sankhyablocks/p-d9bb09b3.js +0 -6
- package/dist/sankhyablocks/p-e6380c60.js +0 -1
- package/dist/sankhyablocks/p-f2056f66.entry.js +0 -1
- package/dist/sankhyablocks/p-f514913b.entry.js +0 -1
- package/dist/sankhyablocks/p-fd8814b9.entry.js +0 -1
- package/dist/sankhyablocks/p-ff6064e7.js +0 -1
- package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +0 -15
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
- /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js → components/snk-attach/interfaces/ICrudConfig.js} +0 -0
- /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js → components/snk-attach/interfaces/TFetcherType.js} +0 -0
- /package/dist/collection/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.css +0 -0
- /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.css +0 -0
- /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.js +0 -0
- /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.css +0 -0
- /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.js +0 -0
- /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.css +0 -0
- /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.js +0 -0
- /package/dist/collection/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.css +0 -0
- /package/dist/collection/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.css +0 -0
- /package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.js +0 -0
- /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.d.ts +0 -0
- /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.d.ts +0 -0
- /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.d.ts +0 -0
- /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDelete.d.ts +0 -0
- /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDownloadKey.d.ts +0 -0
- /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.d.ts +0 -0
@@ -1,10 +1,260 @@
|
|
1
|
-
import { DataUnit, DataType, DateUtils, StringUtils, ChangeOperation, ApplicationContext, UserInterface, DataUnitStorage } from '@sankhyalabs/core';
|
2
|
-
import { D as DataFetcher, d as dist } from './
|
1
|
+
import { ObjectUtils, DataUnit, DataType, DateUtils, StringUtils, ChangeOperation, ApplicationContext, UserInterface, DataUnitStorage } from '@sankhyalabs/core';
|
2
|
+
import { D as DataFetcher, d as dist } from './form-config-fetcher-e3094014.js';
|
3
3
|
import { DISTINCT_FILTER_NAME_PREFIX } from '@sankhyalabs/ezui/dist/collection/utils/constants';
|
4
4
|
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
5
|
-
import { P as PreloadManager } from './PreloadManager-c1c2f2b4.js';
|
6
|
-
import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
|
7
5
|
import { ColumnFilterManager } from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
6
|
+
import SortingUtils from '@sankhyalabs/core/dist/utils/SortingUtils';
|
7
|
+
import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
|
8
|
+
|
9
|
+
class ArrayRepository {
|
10
|
+
constructor(equalsFunction) {
|
11
|
+
this._list = [];
|
12
|
+
this._equalsFunction = equalsFunction;
|
13
|
+
}
|
14
|
+
async load(filterFunction, sortingFunction, offset, limit) {
|
15
|
+
let result = [].concat(this._list);
|
16
|
+
if (filterFunction != undefined) {
|
17
|
+
result = this._list.filter(item => filterFunction(item));
|
18
|
+
}
|
19
|
+
if (sortingFunction != undefined) {
|
20
|
+
result = result.sort(sortingFunction);
|
21
|
+
}
|
22
|
+
const count = result.length;
|
23
|
+
if (limit != undefined) {
|
24
|
+
const start = offset || 0;
|
25
|
+
const end = limit ? start + limit : result.length;
|
26
|
+
result = result.slice(start, end);
|
27
|
+
}
|
28
|
+
return Promise.resolve({ result, count });
|
29
|
+
}
|
30
|
+
async distict(itemProcessor) {
|
31
|
+
const processedItems = [];
|
32
|
+
let hasEmpty = false;
|
33
|
+
for (const item of this._list) {
|
34
|
+
const processedItem = itemProcessor(item);
|
35
|
+
if (processedItem == undefined) {
|
36
|
+
continue;
|
37
|
+
}
|
38
|
+
if (processedItem.value == undefined) {
|
39
|
+
hasEmpty = true;
|
40
|
+
continue;
|
41
|
+
}
|
42
|
+
processedItems.push(processedItem);
|
43
|
+
}
|
44
|
+
if (hasEmpty) {
|
45
|
+
processedItems.push({ key: "", value: null });
|
46
|
+
}
|
47
|
+
return Promise.resolve(new Map(processedItems.map(item => [item.key, item.value])));
|
48
|
+
}
|
49
|
+
async push(items) {
|
50
|
+
this._list.push(...items);
|
51
|
+
}
|
52
|
+
async clear() {
|
53
|
+
this._list = [];
|
54
|
+
}
|
55
|
+
async delete(items) {
|
56
|
+
this._list = this._list.filter(item => {
|
57
|
+
for (const removed of items) {
|
58
|
+
if (this._equalsFunction(item, removed)) {
|
59
|
+
return false;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
return true;
|
63
|
+
});
|
64
|
+
}
|
65
|
+
async update(items) {
|
66
|
+
this._list = this._list.map(existingItem => {
|
67
|
+
const newItem = items.find(newItem => this._equalsFunction(existingItem, newItem));
|
68
|
+
return newItem == undefined ? existingItem : newItem;
|
69
|
+
});
|
70
|
+
}
|
71
|
+
async insert(itemReference, items) {
|
72
|
+
const itemPosition = this._list.indexOf(itemReference);
|
73
|
+
if (itemPosition == -1) {
|
74
|
+
this._list.push(...items);
|
75
|
+
return;
|
76
|
+
}
|
77
|
+
this._list = this._list.slice(0, itemPosition).concat(items).concat(this._list.slice(itemPosition));
|
78
|
+
}
|
79
|
+
isOperating() {
|
80
|
+
return true;
|
81
|
+
}
|
82
|
+
async isEmpty() {
|
83
|
+
return Promise.resolve(this._list.length === 0);
|
84
|
+
}
|
85
|
+
async count() {
|
86
|
+
return Promise.resolve(this._list.length);
|
87
|
+
}
|
88
|
+
getFromCache() {
|
89
|
+
return ObjectUtils.copy(this._list);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
class PreloadManager {
|
94
|
+
static setLoadingStatus(dataUnit, loadingInProgress) {
|
95
|
+
this._loadingStatus.set(dataUnit.name, loadingInProgress);
|
96
|
+
}
|
97
|
+
static isCacheEnabled(_dataUnit) {
|
98
|
+
return true;
|
99
|
+
}
|
100
|
+
static cacheRecords(dataUnit, records, resetDatabase, loadingInProgress) {
|
101
|
+
PreloadManager.setLoadingStatus(dataUnit, loadingInProgress);
|
102
|
+
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
103
|
+
this.getRepository(dataUnit).push(records);
|
104
|
+
}
|
105
|
+
else {
|
106
|
+
if (resetDatabase) {
|
107
|
+
this._repositories.delete(dataUnit.name);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
static getSortingFunction(dataUnit, sorting) {
|
112
|
+
return SortingUtils.getSortingFunction(dataUnit, sorting);
|
113
|
+
}
|
114
|
+
static async getDistinct(dataUnit, fieldName) {
|
115
|
+
if (!PreloadManager.isCacheEnabled(dataUnit)) {
|
116
|
+
return Promise.resolve(ColumnFilterManager.compileDistinct(fieldName, dataUnit));
|
117
|
+
}
|
118
|
+
let filterFunction;
|
119
|
+
const request = dataUnit.getLastLoadRequest();
|
120
|
+
if (request != undefined) {
|
121
|
+
const columnFilters = ColumnFilterManager.getColumnFilters(request.filters, fieldName);
|
122
|
+
filterFunction = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
123
|
+
}
|
124
|
+
return new Promise((accept, reject) => {
|
125
|
+
PreloadManager.getRepository(dataUnit).distict(record => {
|
126
|
+
if (filterFunction != undefined && !filterFunction(record)) {
|
127
|
+
return undefined;
|
128
|
+
}
|
129
|
+
const fieldValue = record[fieldName];
|
130
|
+
if (fieldValue == undefined) {
|
131
|
+
return { key: null, value: null };
|
132
|
+
}
|
133
|
+
const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
|
134
|
+
return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
|
135
|
+
})
|
136
|
+
.then(result => {
|
137
|
+
if (result == undefined) {
|
138
|
+
accept(undefined);
|
139
|
+
return;
|
140
|
+
}
|
141
|
+
accept(Array.from(result.entries()).map(([label, value]) => ({ label, value, check: true })));
|
142
|
+
})
|
143
|
+
.catch(reason => reject(reason));
|
144
|
+
});
|
145
|
+
}
|
146
|
+
static async loadData(dataUnit, request, loadFromServer) {
|
147
|
+
try {
|
148
|
+
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
149
|
+
const useCache = [
|
150
|
+
"EZ_GRID_LOADING_SOURCE",
|
151
|
+
DataUnit.CHANGING_PAGE_LOADING_SOURCE,
|
152
|
+
DataUnit.ALL_RECORDS_SELECTION_SOURCE
|
153
|
+
].includes(request.source);
|
154
|
+
if (useCache) {
|
155
|
+
const isCacheEmpty = await PreloadManager.getRepository(dataUnit).isEmpty();
|
156
|
+
if (!isCacheEmpty) {
|
157
|
+
return PreloadManager.loadFromCache(dataUnit, request);
|
158
|
+
}
|
159
|
+
}
|
160
|
+
//Como não vamos aproveitar o cache, ele precisa ser limpo.
|
161
|
+
PreloadManager.getRepository(dataUnit).clear().catch(() => { });
|
162
|
+
}
|
163
|
+
return loadFromServer(dataUnit, request);
|
164
|
+
}
|
165
|
+
catch (error) {
|
166
|
+
console.error(error);
|
167
|
+
return Promise.reject(error);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
static insertRecords(dataUnit, reference, records) {
|
171
|
+
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
172
|
+
PreloadManager.getRepository(dataUnit).insert(reference, records);
|
173
|
+
}
|
174
|
+
}
|
175
|
+
static updateRecords(dataUnit, records) {
|
176
|
+
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
177
|
+
PreloadManager.getRepository(dataUnit).update(records);
|
178
|
+
}
|
179
|
+
}
|
180
|
+
static removeRecords(dataUnit, records) {
|
181
|
+
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
182
|
+
PreloadManager.getRepository(dataUnit).delete(records);
|
183
|
+
}
|
184
|
+
}
|
185
|
+
static async countRecords(dataUnit) {
|
186
|
+
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
187
|
+
return PreloadManager.getRepository(dataUnit).count();
|
188
|
+
}
|
189
|
+
return Promise.resolve(0);
|
190
|
+
}
|
191
|
+
static getRepository(dataUnit) {
|
192
|
+
const name = dataUnit.name;
|
193
|
+
if (!PreloadManager._repositories.has(name)) {
|
194
|
+
PreloadManager._repositories.set(name, new ArrayRepository((recordA, recordB) => recordA.__record__id__ === recordB.__record__id__));
|
195
|
+
}
|
196
|
+
return PreloadManager._repositories.get(name);
|
197
|
+
}
|
198
|
+
static async loadFromCache(dataUnit, request) {
|
199
|
+
return new Promise((accept, reject) => {
|
200
|
+
const columnFilters = ColumnFilterManager.getColumnFilters(request.filters, "");
|
201
|
+
const { limit, offset, sort } = request;
|
202
|
+
PreloadManager.getRepository(dataUnit)
|
203
|
+
.load(ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values())), PreloadManager.getSortingFunction(dataUnit, sort), offset, limit)
|
204
|
+
.then(loadResult => {
|
205
|
+
const stillLoading = PreloadManager._loadingStatus.get(dataUnit.name);
|
206
|
+
const { count, result: records } = loadResult;
|
207
|
+
const firstRecord = count == 0 ? 0 : offset + 1;
|
208
|
+
const lastRecord = offset + Math.min(records.length, limit);
|
209
|
+
const currentPage = offset / limit;
|
210
|
+
const paginationInfo = {
|
211
|
+
count, currentPage, firstRecord, lastRecord,
|
212
|
+
hasMore: stillLoading || (lastRecord < count),
|
213
|
+
total: stillLoading ? undefined : count
|
214
|
+
};
|
215
|
+
accept({ records, paginationInfo });
|
216
|
+
})
|
217
|
+
.catch(reason => reject(reason));
|
218
|
+
});
|
219
|
+
}
|
220
|
+
static getCachedRecords(dataUnit) {
|
221
|
+
return PreloadManager.getRepository(dataUnit).getFromCache();
|
222
|
+
}
|
223
|
+
}
|
224
|
+
PreloadManager._repositories = new Map();
|
225
|
+
PreloadManager._loadingStatus = new Map();
|
226
|
+
|
227
|
+
function applyFilter(records, dataUnit, filters) {
|
228
|
+
const columnFilters = ColumnFilterManager.getColumnFilters(filters, "");
|
229
|
+
if (!(columnFilters === null || columnFilters === void 0 ? void 0 : columnFilters.size)) {
|
230
|
+
return records;
|
231
|
+
}
|
232
|
+
const filterFunction = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
233
|
+
if (filterFunction == undefined) {
|
234
|
+
return records;
|
235
|
+
}
|
236
|
+
return records.filter(filterFunction);
|
237
|
+
}
|
238
|
+
function applySorting(records, dataUnit, sorting) {
|
239
|
+
if (sorting == undefined || sorting.length == 0) {
|
240
|
+
return records;
|
241
|
+
}
|
242
|
+
const sortingFunction = PreloadManager.getSortingFunction(dataUnit, sorting);
|
243
|
+
if (sortingFunction == undefined) {
|
244
|
+
return records;
|
245
|
+
}
|
246
|
+
return records.sort(sortingFunction);
|
247
|
+
}
|
248
|
+
function buildPaginationInfo(records, offset = 0, limit = 0) {
|
249
|
+
const lastRecord = Math.min(offset + limit, records === null || records === void 0 ? void 0 : records.length);
|
250
|
+
return {
|
251
|
+
currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
|
252
|
+
firstRecord: offset,
|
253
|
+
lastRecord: lastRecord,
|
254
|
+
total: records === null || records === void 0 ? void 0 : records.length,
|
255
|
+
hasMore: !!((records === null || records === void 0 ? void 0 : records.length) - lastRecord),
|
256
|
+
};
|
257
|
+
}
|
8
258
|
|
9
259
|
class InMemoryLoader {
|
10
260
|
constructor(metadata, records) {
|
@@ -21,6 +271,10 @@ class InMemoryLoader {
|
|
21
271
|
if (this._initialRecords == undefined && this.dataUnit.records.length > 0) {
|
22
272
|
this._initialRecords = this.dataUnit.records;
|
23
273
|
}
|
274
|
+
const addedRecords = this.dataUnit.getAddedRecords();
|
275
|
+
if (addedRecords) {
|
276
|
+
return [...this._initialRecords, ...addedRecords];
|
277
|
+
}
|
24
278
|
return this._initialRecords;
|
25
279
|
}
|
26
280
|
get dataUnit() {
|
@@ -63,7 +317,7 @@ class InMemoryLoader {
|
|
63
317
|
this._initialRecords = newRecords;
|
64
318
|
if (this._dataUnit) {
|
65
319
|
//Isso força o refresh internamente no datunit
|
66
|
-
this._dataUnit.
|
320
|
+
this._dataUnit.loadData();
|
67
321
|
}
|
68
322
|
}
|
69
323
|
get metadata() {
|
@@ -79,30 +333,9 @@ class InMemoryLoader {
|
|
79
333
|
return StringUtils.generateUUID();
|
80
334
|
}
|
81
335
|
inMemoryLoader(dataUnit, request, recordsIn) {
|
82
|
-
let records =
|
83
|
-
records =
|
84
|
-
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(request,
|
85
|
-
}
|
86
|
-
applyFilter(records, dataUnit, filters) {
|
87
|
-
const columnFilters = ColumnFilterManager.getColumnFilters(filters, "");
|
88
|
-
if (columnFilters == undefined || columnFilters.size == 0) {
|
89
|
-
return records;
|
90
|
-
}
|
91
|
-
const filterFunciton = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
92
|
-
if (filterFunciton == undefined) {
|
93
|
-
return records;
|
94
|
-
}
|
95
|
-
return records.filter(filterFunciton);
|
96
|
-
}
|
97
|
-
applySorting(records, dataUnit, sorting) {
|
98
|
-
if (sorting == undefined || sorting.length == 0) {
|
99
|
-
return records;
|
100
|
-
}
|
101
|
-
const sortingFunction = PreloadManager.getSortingFunction(dataUnit, sorting);
|
102
|
-
if (sortingFunction == undefined) {
|
103
|
-
return records;
|
104
|
-
}
|
105
|
-
return records.sort(sortingFunction);
|
336
|
+
let records = applyFilter(recordsIn, dataUnit, request.filters);
|
337
|
+
records = applySorting(records, dataUnit, request.sort);
|
338
|
+
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
106
339
|
}
|
107
340
|
metadaLoader() {
|
108
341
|
return Promise.resolve(this._metadata);
|
@@ -135,48 +368,43 @@ class InMemoryLoader {
|
|
135
368
|
}
|
136
369
|
}
|
137
370
|
InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME = "InMemoryDataUnit";
|
138
|
-
function buildPaginationInfo({ offset, limit }, records) {
|
139
|
-
if (offset === undefined || limit === undefined) {
|
140
|
-
return undefined;
|
141
|
-
}
|
142
|
-
const lastRecord = Math.min(offset + limit, records.length);
|
143
|
-
return {
|
144
|
-
currentPage: Math.ceil(offset / limit),
|
145
|
-
firstRecord: offset,
|
146
|
-
lastRecord: lastRecord,
|
147
|
-
total: records.length,
|
148
|
-
hasMore: !!(records.length - lastRecord),
|
149
|
-
};
|
150
|
-
}
|
151
371
|
|
152
372
|
class DatasetStrategy {
|
153
373
|
canSlice() {
|
154
374
|
return false;
|
155
375
|
}
|
376
|
+
processSortingSide(request, dataUnit, serverSideFilters) {
|
377
|
+
var _a;
|
378
|
+
const localSorting = [];
|
379
|
+
const serverSorting = [];
|
380
|
+
if (request.sort != undefined) {
|
381
|
+
if (serverSideFilters.length === 0) {
|
382
|
+
return { localSorting: request.sort, serverSorting: [] };
|
383
|
+
}
|
384
|
+
for (const sort of request.sort) {
|
385
|
+
const descriptor = dataUnit.getField(sort.field);
|
386
|
+
const local = ((_a = descriptor === null || descriptor === void 0 ? void 0 : descriptor.properties) === null || _a === void 0 ? void 0 : _a.calculated) === "true" || (descriptor === null || descriptor === void 0 ? void 0 : descriptor.userInterface) === UserInterface.LONGTEXT;
|
387
|
+
if (local) {
|
388
|
+
localSorting.push(sort);
|
389
|
+
}
|
390
|
+
else {
|
391
|
+
serverSorting.push(sort);
|
392
|
+
}
|
393
|
+
}
|
394
|
+
}
|
395
|
+
return { localSorting, serverSorting };
|
396
|
+
}
|
156
397
|
async load(dataUnit, request, loadingInfo) {
|
398
|
+
var _a, _b;
|
157
399
|
if (dataUnit.metadata == undefined) {
|
158
400
|
return Promise.resolve({ records: [], loadingInfo });
|
159
401
|
}
|
160
402
|
try {
|
161
|
-
const
|
162
|
-
const serverSorting =
|
163
|
-
if (request.sort != undefined) {
|
164
|
-
for (const sort of request.sort) {
|
165
|
-
const descriptor = dataUnit.getField(sort.field);
|
166
|
-
const local = descriptor != undefined
|
167
|
-
&& descriptor.properties != undefined
|
168
|
-
&& descriptor.properties.calculated === "true";
|
169
|
-
if (local) {
|
170
|
-
localSorting.push(sort);
|
171
|
-
}
|
172
|
-
else {
|
173
|
-
serverSorting.push(sort);
|
174
|
-
}
|
175
|
-
}
|
176
|
-
}
|
403
|
+
const serverSideFilters = (_b = (_a = request.filters) === null || _a === void 0 ? void 0 : _a.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"))) !== null && _b !== void 0 ? _b : [];
|
404
|
+
const { localSorting, serverSorting } = this.processSortingSide(request, dataUnit, serverSideFilters);
|
177
405
|
const fields = this.getFieldsList(dataUnit);
|
178
406
|
const serviceName = "DatasetSP.loadRecords";
|
179
|
-
const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting);
|
407
|
+
const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting, serverSideFilters);
|
180
408
|
const params = loadingInfo.quiet ? { urlParams: { quietMode: "true" } } : undefined;
|
181
409
|
const { result: responseRecords, pagerID: pagerId } = await DataFetcher.get().callServiceBroker(serviceName, requestBody, params);
|
182
410
|
const records = this.processRecords(dataUnit, fields, responseRecords);
|
@@ -220,7 +448,7 @@ class DatasetStrategy {
|
|
220
448
|
}
|
221
449
|
return [descriptor.name, descriptionField];
|
222
450
|
}
|
223
|
-
buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, sorting) {
|
451
|
+
buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, sorting, serverSideFilters) {
|
224
452
|
const dataSetID = dataUnit.dataUnitId;
|
225
453
|
const dataUnitName = dataUnit.name;
|
226
454
|
const entityName = DataUnitFetcher.parseDataUnitName(dataUnitName).entityName;
|
@@ -239,7 +467,7 @@ class DatasetStrategy {
|
|
239
467
|
tryJoinedFields: true,
|
240
468
|
parallelLoader: useParallelLoader,
|
241
469
|
crudListener: `br.com.sankhya.bff.${this.getModuleName()}.BFFDataUnitDatasetAdapter`,
|
242
|
-
txProperties: this.getTxProperties(
|
470
|
+
txProperties: this.getTxProperties(dataUnit, request, sorting, serverSideFilters),
|
243
471
|
useDefaultRowsLimit: false
|
244
472
|
}
|
245
473
|
};
|
@@ -250,12 +478,10 @@ class DatasetStrategy {
|
|
250
478
|
const moduleName = app.getModuleName();
|
251
479
|
return moduleName.replace("-bff", "");
|
252
480
|
}
|
253
|
-
getTxProperties(
|
254
|
-
var _a, _b;
|
481
|
+
getTxProperties(dataUnit, request, sorting, serverSideFilters) {
|
255
482
|
const txProperties = {
|
256
|
-
"__DATA_UNIT_ADAPTER__[dataUnitName]":
|
483
|
+
"__DATA_UNIT_ADAPTER__[dataUnitName]": dataUnit.name
|
257
484
|
};
|
258
|
-
const serverSideFilters = (_b = (_a = request.filters) === null || _a === void 0 ? void 0 : _a.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"))) !== null && _b !== void 0 ? _b : [];
|
259
485
|
if (serverSideFilters.length !== 0) {
|
260
486
|
txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
|
261
487
|
}
|
@@ -265,6 +491,13 @@ class DatasetStrategy {
|
|
265
491
|
if (request.parentRecordId != undefined) {
|
266
492
|
txProperties["__DATA_UNIT_ADAPTER__[parentRecordId]"] = request.parentRecordId;
|
267
493
|
}
|
494
|
+
const loaderProps = dataUnit.getGlobalLoaderProps();
|
495
|
+
if (loaderProps == undefined || loaderProps.size === 0) {
|
496
|
+
return txProperties;
|
497
|
+
}
|
498
|
+
Array.from(loaderProps.entries()).forEach(([name, value]) => {
|
499
|
+
txProperties[name] = value;
|
500
|
+
});
|
268
501
|
return txProperties;
|
269
502
|
}
|
270
503
|
processRecords(dataUnit, fields, responseRecords) {
|
@@ -334,6 +567,9 @@ class DataUnitDataLoader {
|
|
334
567
|
});
|
335
568
|
});
|
336
569
|
}
|
570
|
+
static getCachedRecords(dataUnit) {
|
571
|
+
return PreloadManager.getCachedRecords(dataUnit);
|
572
|
+
}
|
337
573
|
static async loadFromServer(dataUnit, request, loadingInfo) {
|
338
574
|
try {
|
339
575
|
//Registramos a request com as informações de carga para determinarmos a última.
|
@@ -534,6 +770,7 @@ class DataUnitFetcher {
|
|
534
770
|
dataUnit.saveLoader = (_dataUnit, changes) => this.saveData(dataUnit, changes);
|
535
771
|
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
536
772
|
dataUnit.recordLoader = (dataUnit, recordIds) => this.loadRecord(dataUnit, recordIds);
|
773
|
+
dataUnit.allRecordsLoader = (dataUnit) => DataUnitDataLoader.getCachedRecords(dataUnit);
|
537
774
|
return dataUnit;
|
538
775
|
}
|
539
776
|
loadMetadata(dataUnit) {
|
@@ -594,14 +831,41 @@ class DataUnitFetcher {
|
|
594
831
|
});
|
595
832
|
});
|
596
833
|
}
|
834
|
+
addTransientProperties(dataUnit, updatingFields) {
|
835
|
+
const loaderProps = dataUnit.getGlobalLoaderProps();
|
836
|
+
if (loaderProps == undefined || loaderProps.size === 0) {
|
837
|
+
return updatingFields;
|
838
|
+
}
|
839
|
+
if (updatingFields == undefined) {
|
840
|
+
updatingFields = {};
|
841
|
+
}
|
842
|
+
Array.from(loaderProps.entries()).forEach(([name, value]) => {
|
843
|
+
updatingFields[`transient.${name}`] = value;
|
844
|
+
});
|
845
|
+
return updatingFields;
|
846
|
+
}
|
847
|
+
getUpdatingFields(dataUnit, originalUpdatingFields) {
|
848
|
+
if (originalUpdatingFields == undefined) {
|
849
|
+
return;
|
850
|
+
}
|
851
|
+
const updatingFields = Object.assign({}, originalUpdatingFields);
|
852
|
+
Object.keys(updatingFields).forEach(key => {
|
853
|
+
const descriptor = dataUnit.getField(key);
|
854
|
+
if (descriptor != undefined && descriptor.standAlone) {
|
855
|
+
delete updatingFields[key];
|
856
|
+
}
|
857
|
+
});
|
858
|
+
return this.addTransientProperties(dataUnit, updatingFields);
|
859
|
+
}
|
597
860
|
saveData(dataUnit, duChanges) {
|
598
861
|
const updatedRecordsIds = [];
|
599
862
|
const addedRecordsIds = [];
|
600
863
|
const changes = duChanges.map((change) => {
|
601
|
-
const { dataUnit: changeDU, record,
|
864
|
+
const { dataUnit: changeDU, record, operation } = change;
|
602
865
|
const dataUnitInstance = DataUnitStorage.get(changeDU);
|
866
|
+
const updatingFields = this.getUpdatingFields(dataUnitInstance, change.updatingFields);
|
603
867
|
let parsedUpdatingFields;
|
604
|
-
if (updatingFields) {
|
868
|
+
if (updatingFields != undefined) {
|
605
869
|
parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
|
606
870
|
const descriptor = dataUnitInstance.getField(fieldName);
|
607
871
|
const dataType = descriptor ? descriptor.dataType : DataType.TEXT;
|
@@ -649,7 +913,8 @@ class DataUnitFetcher {
|
|
649
913
|
}
|
650
914
|
responseRecord.fields.forEach(({ name, value }) => {
|
651
915
|
var _a;
|
652
|
-
|
916
|
+
const valueFromString = (_a = dataUnitInstance === null || dataUnitInstance === void 0 ? void 0 : dataUnitInstance.valueFromString) === null || _a === void 0 ? void 0 : _a.call(dataUnitInstance, name, value);
|
917
|
+
duRecord[name] = (valueFromString !== undefined) ? valueFromString : value;
|
653
918
|
});
|
654
919
|
dataUnitRecords.push(duRecord);
|
655
920
|
});
|
@@ -724,4 +989,164 @@ class DataUnitFetcher {
|
|
724
989
|
}
|
725
990
|
}
|
726
991
|
|
727
|
-
|
992
|
+
class PesquisaFetcher {
|
993
|
+
constructor() {
|
994
|
+
this._defaultPageSize = 100;
|
995
|
+
this._templateByQuery = new Map();
|
996
|
+
this._searchListenersByDataUnit = new Map();
|
997
|
+
this.buldTemplates();
|
998
|
+
}
|
999
|
+
buldTemplates() {
|
1000
|
+
this._templateByQuery.set("search", dist.gql `query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
|
1001
|
+
$queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria options: $options){
|
1002
|
+
value
|
1003
|
+
label
|
1004
|
+
}
|
1005
|
+
}`);
|
1006
|
+
}
|
1007
|
+
loadSearchOptions(entityName, argument, criteria, options) {
|
1008
|
+
var _a;
|
1009
|
+
const cleanText = (argument === null || argument === void 0 ? void 0 : argument.toString().trim()) || undefined;
|
1010
|
+
argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
|
1011
|
+
criteria === null || criteria === void 0 ? void 0 : criteria.params.forEach(param => {
|
1012
|
+
if (param.dataType === DataType.OBJECT) {
|
1013
|
+
param.value = JSON.stringify(param.value);
|
1014
|
+
}
|
1015
|
+
});
|
1016
|
+
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, options);
|
1017
|
+
const values = {
|
1018
|
+
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
1019
|
+
entityName,
|
1020
|
+
criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
|
1021
|
+
options: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) || options,
|
1022
|
+
};
|
1023
|
+
if (values.options) {
|
1024
|
+
(_a = values.options) === null || _a === void 0 ? true : delete _a.dataUnitId;
|
1025
|
+
}
|
1026
|
+
return new Promise((resolve, reject) => {
|
1027
|
+
DataFetcher.get()
|
1028
|
+
.callGraphQL({
|
1029
|
+
values,
|
1030
|
+
query: this._templateByQuery.get("search"),
|
1031
|
+
})
|
1032
|
+
.then((result) => {
|
1033
|
+
resolve(result);
|
1034
|
+
})
|
1035
|
+
.catch((error) => {
|
1036
|
+
reject(error);
|
1037
|
+
});
|
1038
|
+
});
|
1039
|
+
}
|
1040
|
+
loadAdvancedSearch(entityName, argument, criteria, searchOptions) {
|
1041
|
+
var _a, _b, _c, _d, _e;
|
1042
|
+
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
1043
|
+
const values = {
|
1044
|
+
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
1045
|
+
criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
|
1046
|
+
searchOptions: Object.assign(Object.assign({}, searchOptions), listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions),
|
1047
|
+
};
|
1048
|
+
const serviceName = "PesquisaSP.getSuggestion";
|
1049
|
+
const externalCriteria = {
|
1050
|
+
query: {
|
1051
|
+
$: (_a = values.criteria) === null || _a === void 0 ? void 0 : _a.expression
|
1052
|
+
}
|
1053
|
+
};
|
1054
|
+
if (((_c = (_b = values.criteria) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
1055
|
+
externalCriteria.params = {
|
1056
|
+
param: values.criteria.params.map(param => {
|
1057
|
+
let value = param.value;
|
1058
|
+
if (typeof value === "string") {
|
1059
|
+
const match = /CTX\{([^}]+)\}/.exec(value);
|
1060
|
+
if (match) {
|
1061
|
+
value = ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
1062
|
+
}
|
1063
|
+
}
|
1064
|
+
let type = param.dataType;
|
1065
|
+
if (type === DataType.OBJECT) {
|
1066
|
+
value = value.value;
|
1067
|
+
type = "S";
|
1068
|
+
}
|
1069
|
+
else {
|
1070
|
+
type = convertParamType(param.dataType);
|
1071
|
+
}
|
1072
|
+
return { $: value, type };
|
1073
|
+
})
|
1074
|
+
};
|
1075
|
+
}
|
1076
|
+
const options = searchOptions != undefined
|
1077
|
+
? Object.assign(Object.assign({}, values === null || values === void 0 ? void 0 : values.searchOptions), { "pkFieldName": searchOptions.codeFieldName, "label": searchOptions.descriptionFieldName, "fieldName": searchOptions.codeFieldName, "useDescriptionOptions": false, "enableRowsCounter": true }) : undefined;
|
1078
|
+
const reqBody = {
|
1079
|
+
"serviceName": serviceName,
|
1080
|
+
"requestBody": {
|
1081
|
+
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": (_d = options === null || options === void 0 ? void 0 : options.ignoreEntityCriteria) !== null && _d !== void 0 ? _d : false, "limit": this._defaultPageSize, "query": { "$": values.argument }, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_e = values.searchOptions) === null || _e === void 0 ? void 0 : _e.rootEntity }, { options }),
|
1082
|
+
"clientEventList": {
|
1083
|
+
"clientEvent": []
|
1084
|
+
}
|
1085
|
+
}
|
1086
|
+
};
|
1087
|
+
return new Promise((resolve, reject) => {
|
1088
|
+
DataFetcher.get()
|
1089
|
+
.callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
|
1090
|
+
.then(result => resolve(result))
|
1091
|
+
.catch(error => reject(error));
|
1092
|
+
});
|
1093
|
+
}
|
1094
|
+
addSearchListener(entityName, dataUnitID, listener) {
|
1095
|
+
var _a;
|
1096
|
+
const dataUnitSearchListeners = this._searchListenersByDataUnit.get(dataUnitID) || [];
|
1097
|
+
const entityListener = dataUnitSearchListeners.find(currentListener => currentListener.entity === entityName);
|
1098
|
+
if (!entityListener) {
|
1099
|
+
this._searchListenersByDataUnit.set(dataUnitID, [...dataUnitSearchListeners, { entity: entityName, listener }]);
|
1100
|
+
}
|
1101
|
+
else {
|
1102
|
+
for (const type of Object.keys(listener)) {
|
1103
|
+
if (type in entityListener.listener) {
|
1104
|
+
const listenerFunctionIsEquals = ((_a = entityListener.listener[type]) === null || _a === void 0 ? void 0 : _a.toString()) === listener[type].toString();
|
1105
|
+
if (listenerFunctionIsEquals)
|
1106
|
+
continue;
|
1107
|
+
entityListener.listener[type] = listener[type];
|
1108
|
+
}
|
1109
|
+
}
|
1110
|
+
}
|
1111
|
+
return () => {
|
1112
|
+
const newListeners = dataUnitSearchListeners.filter(currentListener => currentListener.entity !== entityName);
|
1113
|
+
if (!newListeners.length) {
|
1114
|
+
this._searchListenersByDataUnit.delete(dataUnitID);
|
1115
|
+
return;
|
1116
|
+
}
|
1117
|
+
this._searchListenersByDataUnit.set(dataUnitID, newListeners);
|
1118
|
+
};
|
1119
|
+
}
|
1120
|
+
applySearchListener(listenerType, entityName, argument, criteria, searchOptions) {
|
1121
|
+
var _a;
|
1122
|
+
const dataUnitId = searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.dataUnitId;
|
1123
|
+
if (!dataUnitId)
|
1124
|
+
return;
|
1125
|
+
const entityListener = (_a = this._searchListenersByDataUnit.get(dataUnitId)) === null || _a === void 0 ? void 0 : _a.find(({ entity }) => entity === entityName);
|
1126
|
+
if (!entityListener)
|
1127
|
+
return;
|
1128
|
+
const { listener } = entityListener;
|
1129
|
+
if (!(listenerType in listener))
|
1130
|
+
return;
|
1131
|
+
return listener[listenerType]({ argument, criteria, searchOptions });
|
1132
|
+
}
|
1133
|
+
}
|
1134
|
+
function convertParamType(dataType) {
|
1135
|
+
//Alerta: Cuidado pra não contaminar o DataType com a implementação
|
1136
|
+
//atual da pesquisa... em geral, somente inteiros,
|
1137
|
+
//data (com ou sem hora) e string são realmente relevantes
|
1138
|
+
switch (dataType) {
|
1139
|
+
case DataType.NUMBER:
|
1140
|
+
return "I";
|
1141
|
+
case DataType.DATE:
|
1142
|
+
return "D";
|
1143
|
+
default:
|
1144
|
+
return "S";
|
1145
|
+
}
|
1146
|
+
}
|
1147
|
+
var SearchListenerType;
|
1148
|
+
(function (SearchListenerType) {
|
1149
|
+
SearchListenerType["beforeSearch"] = "beforeSearch";
|
1150
|
+
})(SearchListenerType || (SearchListenerType = {}));
|
1151
|
+
|
1152
|
+
export { DataUnitFetcher as D, InMemoryLoader as I, PesquisaFetcher as P, PreloadManager as a, applyFilter as b, applySorting as c, buildPaginationInfo as d };
|