@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-11997.0 → 0.0.0-bugfix-dev-KB-99999.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-0e4275f5.js → ConfigStorage-8009ecb2.js} +20 -4
- package/dist/cjs/{DataFetcher-bd3d53a8.js → DataFetcher-ba94ed5b.js} +142 -102
- package/dist/cjs/{PersonalizedFilterUtils-1aeb625d.js → PersonalizedFilterUtils-0184ffbb.js} +11 -4
- package/dist/cjs/PreloadManager-84466da6.js +224 -0
- package/dist/cjs/{SnkFormConfigManager-5b485cd4.js → SnkFormConfigManager-7d850fbc.js} +23 -6
- package/dist/cjs/{SnkMessageBuilder-d0abb63d.js → SnkMessageBuilder-7293d0ad.js} +29 -8
- package/dist/cjs/{SnkMultiSelectionListDataSource-804ff4c7.js → SnkMultiSelectionListDataSource-ba5838c2.js} +15 -0
- package/dist/cjs/Sortable-fb1c4cbb.js +2853 -0
- package/dist/cjs/{auth-fetcher-1583fe43.js → auth-fetcher-c8467c07.js} +1 -1
- package/dist/cjs/{constants-d187e03e.js → constants-35ddd366.js} +4 -0
- package/dist/cjs/dataunit-fetcher-de65b9fc.js +725 -0
- package/dist/cjs/{taskbar-processor-bce3f499.js → field-search-f56aa7d6.js} +35 -0
- package/dist/cjs/{filter-item-type.enum-aa823a00.js → filter-item-type.enum-a7ffdaa6.js} +1 -0
- package/dist/cjs/filterNumberVariation-d65332da.js +7 -0
- package/dist/cjs/{form-config-fetcher-f6cb55e6.js → form-config-fetcher-df043d3d.js} +1 -1
- package/dist/cjs/{index-0e663819.js → index-0922807b.js} +1 -0
- package/dist/cjs/index-f9e81701.js +10 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-3356b3df.js → pesquisa-fetcher-ef050a47.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/{snk-actions-button.cjs.entry.js → snk-actions-button_2.cjs.entry.js} +214 -91
- package/dist/cjs/snk-application.cjs.entry.js +474 -140
- package/dist/cjs/snk-attach.cjs.entry.js +27 -11
- package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
- package/dist/cjs/snk-configurator.cjs.entry.js +17 -2
- package/dist/cjs/snk-crud.cjs.entry.js +127 -17
- package/dist/cjs/snk-custom-slot-elements.cjs.entry.js +20 -0
- package/dist/cjs/snk-data-exporter.cjs.entry.js +12 -11
- package/dist/cjs/{snk-data-unit-7cc1846d.js → snk-data-unit-1bc69073.js} +15 -5
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +34 -14
- package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-bar.cjs.entry.js +163 -17
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +52 -0
- package/dist/cjs/snk-filter-detail.cjs.entry.js +9 -2
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-item.cjs.entry.js +39 -15
- package/dist/cjs/snk-filter-list.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +9 -9
- package/dist/cjs/snk-filter-modal.cjs.entry.js +38 -7
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-number.cjs.entry.js +42 -3
- package/dist/cjs/snk-filter-period.cjs.entry.js +3 -3
- package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +16 -15
- package/dist/cjs/snk-form-view.cjs.entry.js +14 -0
- package/dist/cjs/snk-form.cjs.entry.js +6 -7
- package/dist/cjs/snk-grid-config.cjs.entry.js +6 -7
- package/dist/cjs/snk-grid.cjs.entry.js +131 -40
- package/dist/cjs/{snk-guides-viewer-5e22097d.js → snk-guides-viewer-7f9b6d94.js} +161 -22
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +16 -13
- package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +24 -13
- package/dist/cjs/snk-select-box.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +127 -103
- package/dist/cjs/snk-tab-config.cjs.entry.js +12 -11
- package/dist/cjs/snk-taskbar.cjs.entry.js +3 -3
- package/dist/cjs/{taskbar-elements-39949c7a.js → taskbar-elements-01b85b99.js} +4 -4
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/snk-actions-button/actions/executor/java.executor.js +2 -2
- package/dist/collection/components/snk-actions-button/actions/executor/javascript.executor.js +2 -2
- package/dist/collection/components/snk-actions-button/actions/executor/procedure.executor.js +2 -2
- package/dist/collection/components/snk-actions-button/clientEvent/index.js +81 -76
- package/dist/collection/components/snk-actions-button/snk-actions-button.css +4 -11
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +2 -2
- package/dist/collection/components/snk-application/snk-application.js +485 -84
- package/dist/collection/components/snk-attach/snk-attach.css +6 -0
- package/dist/collection/components/snk-attach/snk-attach.js +15 -3
- package/dist/collection/components/snk-attach/structure/data-unit-builder.js +4 -1
- package/dist/collection/components/snk-configurator/snk-configurator.js +33 -1
- package/dist/collection/components/snk-crud/snk-crud.js +136 -10
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +21 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +45 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +178 -22
- package/dist/collection/components/snk-custom-slot-elements/snk-custom-slot-elements.css +3 -0
- package/dist/collection/components/{snk-taskbar/snk-taskbar-custom-elements.js → snk-custom-slot-elements/snk-custom-slot-elements.js} +10 -10
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.css +1 -9
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +1 -1
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +15 -12
- package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +69 -2
- package/dist/collection/components/snk-filter-bar/filter-item/editors/enum/filterNumberVariation.js +5 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +95 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +93 -8
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +2 -2
- package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +1 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +7 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +38 -14
- package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +87 -6
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +4 -3
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +5 -6
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +218 -7
- package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +3 -1
- package/dist/collection/components/snk-form/SnkFormConfigManager.js +22 -5
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +10 -8
- package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js +10 -8
- package/dist/collection/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.js +11 -0
- package/dist/collection/components/snk-grid/snk-grid.css +7 -2
- package/dist/collection/components/snk-grid/snk-grid.js +166 -39
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +32 -6
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +13 -4
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +8 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +115 -6
- package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.css +6 -0
- package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +310 -0
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -3
- package/dist/collection/components/snk-taskbar/snk-taskbar.css +0 -4
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +1 -1
- package/dist/collection/components/snk-taskbar/subcomponents/field-search.js +31 -0
- package/dist/collection/lib/@types/index.js +1 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +74 -15
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +61 -43
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +118 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +80 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +139 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/{dataunit-fetcher.js → data-unit/dataunit-fetcher.js} +49 -100
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadDataResult.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadDataStrategy.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRecordField.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IResponseRecord.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DataUnitStrategy.js +68 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +162 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +3 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/personalized-reports-fetcher.js +3 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +14 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +3 -0
- package/dist/collection/lib/index.js +1 -1
- package/dist/collection/lib/message/SnkMessageBuilder.js +9 -3
- package/dist/collection/lib/message/resources/snk-application.msg.js +9 -0
- package/dist/collection/lib/message/resources/snk-crud.msg.js +1 -0
- package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +5 -4
- package/dist/collection/lib/message/resources/snk-grid.msg.js +3 -1
- package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +4 -0
- package/dist/collection/lib/utils/constants.js +3 -0
- package/dist/collection/lib/utils/urlutils.js +10 -4
- package/dist/collection/lib/workspace/workspace.js +27 -0
- package/dist/components/ConfigStorage.js +17 -1
- package/dist/components/DataFetcher.js +101 -61
- package/dist/components/PersonalizedFilterUtils.js +10 -3
- package/dist/components/SnkFormConfigManager.js +22 -5
- package/dist/components/SnkMessageBuilder.js +29 -8
- package/dist/components/constants.js +4 -1
- package/dist/components/dataunit-fetcher.js +846 -100
- package/dist/components/{SnkMultiSelectionListDataSource.js → field-search.js} +44 -1
- package/dist/components/filter-item-type.enum.js +1 -0
- package/dist/components/filterNumberVariation.js +7 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +3 -1
- package/dist/components/index2.js +1 -0
- package/dist/components/snk-actions-button2.js +91 -86
- package/dist/components/snk-application2.js +392 -55
- package/dist/components/snk-attach2.js +39 -19
- package/dist/components/snk-configurator2.js +18 -2
- package/dist/components/snk-crud.js +184 -70
- package/dist/components/snk-custom-slot-elements.d.ts +11 -0
- package/dist/components/snk-custom-slot-elements.js +35 -0
- package/dist/components/snk-data-exporter2.js +7 -5
- package/dist/components/snk-data-unit2.js +15 -5
- package/dist/components/snk-detail-view2.js +264 -96
- package/dist/components/snk-filter-bar2.js +164 -13
- package/dist/components/snk-filter-checkbox-list.d.ts +11 -0
- package/dist/components/snk-filter-checkbox-list.js +68 -0
- package/dist/components/snk-filter-detail2.js +7 -0
- package/dist/components/snk-filter-item2.js +38 -14
- package/dist/components/snk-filter-list.js +1 -1
- package/dist/components/snk-filter-modal-item2.js +4 -3
- package/dist/components/snk-filter-modal.js +40 -7
- package/dist/components/snk-filter-number.js +43 -2
- package/dist/components/snk-filter-period.js +2 -2
- package/dist/components/snk-form-config2.js +13 -11
- package/dist/components/snk-form-view2.js +15 -0
- package/dist/components/snk-grid2.js +166 -68
- package/dist/components/snk-personalized-filter2.js +18 -6
- package/dist/components/snk-simple-crud2.js +132 -104
- package/dist/components/snk-tab-config2.js +2203 -6233
- package/dist/components/snk-taskbar2.js +16 -10
- package/dist/components/taskbar-actions-button.d.ts +11 -0
- package/dist/components/taskbar-actions-button.js +6 -0
- package/dist/components/taskbar-actions-button2.js +140 -0
- package/dist/esm/{ConfigStorage-f359573c.js → ConfigStorage-1244b8b0.js} +20 -4
- package/dist/esm/{DataFetcher-8daff9ad.js → DataFetcher-aa159c5a.js} +101 -61
- package/dist/esm/{PersonalizedFilterUtils-75fb0106.js → PersonalizedFilterUtils-e2b38ef7.js} +11 -4
- package/dist/esm/PreloadManager-c1c2f2b4.js +222 -0
- package/dist/esm/{SnkFormConfigManager-35876bad.js → SnkFormConfigManager-9be0e7d4.js} +24 -7
- package/dist/esm/{SnkMessageBuilder-68c1c25a.js → SnkMessageBuilder-ca843d1b.js} +29 -8
- package/dist/esm/{SnkMultiSelectionListDataSource-892f37f9.js → SnkMultiSelectionListDataSource-44494b0e.js} +11 -0
- package/dist/esm/Sortable-83960219.js +2851 -0
- package/dist/esm/{auth-fetcher-299fed55.js → auth-fetcher-c05dc474.js} +1 -1
- package/dist/esm/{constants-3644f1b6.js → constants-8457af36.js} +4 -1
- package/dist/esm/dataunit-fetcher-e218c6d2.js +722 -0
- package/dist/esm/{taskbar-processor-94402e6e.js → field-search-efbe307f.js} +34 -1
- package/dist/esm/{filter-item-type.enum-5028ed3f.js → filter-item-type.enum-d45e026f.js} +1 -0
- package/dist/esm/filterNumberVariation-8cee02ea.js +7 -0
- package/dist/esm/{form-config-fetcher-8ef7be16.js → form-config-fetcher-36219cd3.js} +1 -1
- package/dist/esm/{index-1564817d.js → index-0ece87a6.js} +1 -0
- package/dist/esm/index-a7d3d3f1.js +10 -6
- package/dist/esm/loader.js +1 -1
- package/dist/{components/pesquisa-fetcher.js → esm/pesquisa-fetcher-dd3ca0a5.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/{snk-actions-button.entry.js → snk-actions-button_2.entry.js} +215 -93
- package/dist/esm/snk-application.entry.js +475 -141
- package/dist/esm/snk-attach.entry.js +27 -11
- package/dist/esm/snk-config-options.entry.js +1 -1
- package/dist/esm/snk-configurator.entry.js +18 -3
- package/dist/esm/snk-crud.entry.js +128 -18
- package/dist/esm/snk-custom-slot-elements.entry.js +16 -0
- package/dist/esm/snk-data-exporter.entry.js +13 -12
- package/dist/esm/{snk-data-unit-1715d2f1.js → snk-data-unit-6208ebf0.js} +16 -6
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +34 -14
- package/dist/esm/snk-field-config.entry.js +1 -1
- package/dist/esm/snk-filter-advanced-mode_2.entry.js +2 -2
- package/dist/esm/snk-filter-bar.entry.js +165 -19
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-filter-checkbox-list.entry.js +48 -0
- package/dist/esm/snk-filter-detail.entry.js +9 -2
- package/dist/esm/snk-filter-field-search_2.entry.js +2 -2
- package/dist/esm/snk-filter-item.entry.js +39 -15
- package/dist/esm/snk-filter-list.entry.js +1 -1
- package/dist/esm/snk-filter-modal-item.entry.js +9 -9
- package/dist/esm/snk-filter-modal.entry.js +38 -7
- package/dist/esm/snk-filter-multi-select.entry.js +1 -1
- package/dist/esm/snk-filter-number.entry.js +42 -3
- package/dist/esm/snk-filter-period.entry.js +3 -3
- package/dist/esm/snk-filter-search.entry.js +1 -1
- package/dist/esm/snk-form-config.entry.js +16 -15
- package/dist/esm/snk-form-view.entry.js +14 -0
- package/dist/esm/snk-form.entry.js +6 -7
- package/dist/esm/snk-grid-config.entry.js +6 -7
- package/dist/esm/snk-grid.entry.js +132 -41
- package/dist/esm/{snk-guides-viewer-b0e32a7d.js → snk-guides-viewer-9d5e073f.js} +161 -22
- package/dist/esm/snk-guides-viewer.entry.js +16 -13
- package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
- package/dist/esm/snk-personalized-filter.entry.js +24 -13
- package/dist/esm/snk-select-box.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +126 -102
- package/dist/esm/snk-tab-config.entry.js +12 -11
- package/dist/esm/snk-taskbar.entry.js +3 -3
- package/dist/esm/{taskbar-elements-0a6b8b95.js → taskbar-elements-d4d0b424.js} +4 -4
- package/dist/sankhyablocks/p-01ba23cd.entry.js +1 -0
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +1 -0
- package/dist/sankhyablocks/{p-5c1aacc7.js → p-057fad05.js} +1 -1
- package/dist/sankhyablocks/p-0874adb5.entry.js +1 -0
- package/dist/sankhyablocks/p-094c30cb.js +1 -0
- package/dist/sankhyablocks/p-0d084a0f.entry.js +1 -0
- package/dist/sankhyablocks/{p-c870b530.js → p-0d7863ed.js} +1 -1
- package/dist/sankhyablocks/p-11081798.entry.js +1 -0
- package/dist/sankhyablocks/p-143425c0.entry.js +1 -0
- package/dist/sankhyablocks/{p-cb37982f.entry.js → p-20726710.entry.js} +1 -1
- package/dist/sankhyablocks/p-32f0935f.js +1 -0
- package/dist/sankhyablocks/p-3520c088.entry.js +1 -0
- package/dist/sankhyablocks/p-374d03f6.js +1 -0
- package/dist/sankhyablocks/p-38289a55.js +1 -0
- package/dist/sankhyablocks/{p-25c5428f.entry.js → p-3ab6df3d.entry.js} +1 -1
- package/dist/sankhyablocks/p-3b60db06.entry.js +1 -0
- package/dist/sankhyablocks/{p-eb636e15.entry.js → p-41f8bfa3.entry.js} +1 -1
- package/dist/sankhyablocks/p-4775a293.entry.js +1 -0
- package/dist/sankhyablocks/p-4b0938f6.entry.js +1 -0
- package/dist/sankhyablocks/p-585294ee.js +56 -0
- package/dist/sankhyablocks/p-5f74c859.entry.js +1 -0
- package/dist/sankhyablocks/p-69754d94.entry.js +1 -0
- package/dist/sankhyablocks/p-6977a26c.entry.js +1 -0
- package/dist/sankhyablocks/{p-648a7c72.entry.js → p-69efa80d.entry.js} +1 -1
- package/dist/sankhyablocks/p-70589af8.entry.js +1 -0
- package/dist/sankhyablocks/p-776ee8e3.js +1 -0
- package/dist/sankhyablocks/{p-959e0835.entry.js → p-7e2ded86.entry.js} +1 -1
- package/dist/sankhyablocks/p-7f9d6b5d.entry.js +11 -0
- package/dist/sankhyablocks/{p-0885ed3c.entry.js → p-8002dcd0.entry.js} +1 -1
- package/dist/sankhyablocks/p-809f367d.entry.js +1 -0
- package/dist/sankhyablocks/p-8437508f.js +1 -0
- package/dist/sankhyablocks/p-8eb67fa4.entry.js +1 -0
- package/dist/sankhyablocks/{p-f30526a7.entry.js → p-95df461f.entry.js} +1 -1
- package/dist/sankhyablocks/p-9695f78b.js +1 -0
- package/dist/sankhyablocks/{p-838f8234.entry.js → p-98674137.entry.js} +1 -1
- package/dist/sankhyablocks/p-a87229cd.entry.js +1 -0
- package/dist/sankhyablocks/p-a9e5b094.entry.js +1 -0
- package/dist/sankhyablocks/p-aaa3ee68.entry.js +1 -0
- package/dist/sankhyablocks/p-b0ef4383.js +1 -0
- package/dist/sankhyablocks/p-ba627e85.js +60 -0
- package/dist/sankhyablocks/p-c22c1d8e.js +1 -0
- package/dist/sankhyablocks/p-c2495304.js +1 -0
- package/dist/sankhyablocks/{p-26ad62b9.entry.js → p-c758265f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-fe49067d.entry.js → p-c8622597.entry.js} +1 -1
- package/dist/sankhyablocks/p-cb7419e0.entry.js +1 -0
- package/dist/sankhyablocks/p-d1007720.entry.js +1 -0
- package/dist/sankhyablocks/{p-a1e1b305.entry.js → p-d3f53df2.entry.js} +1 -1
- package/dist/sankhyablocks/p-d6317851.entry.js +1 -0
- package/dist/sankhyablocks/{p-b13cb8b5.js → p-d9bb09b3.js} +2 -2
- package/dist/sankhyablocks/p-e3132789.entry.js +1 -0
- package/dist/sankhyablocks/p-e6380c60.js +1 -0
- package/dist/sankhyablocks/p-f514913b.entry.js +1 -0
- package/dist/sankhyablocks/p-fa80e546.js +1 -0
- package/dist/sankhyablocks/p-fa816fb2.js +1 -0
- package/dist/sankhyablocks/p-fd8814b9.entry.js +1 -0
- package/dist/sankhyablocks/{p-584d7212.js → p-ff1990ad.js} +1 -1
- package/dist/sankhyablocks/p-ff6064e7.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/clientEvent/index.d.ts +1 -1
- package/dist/types/components/snk-actions-button/subcomponents/snk-actions-form.d.ts +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +90 -15
- package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +6 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +13 -0
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +3 -0
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +10 -1
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +49 -12
- package/dist/types/components/snk-custom-slot-elements/snk-custom-slot-elements.d.ts +7 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/enum/filterNumberVariation.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.d.ts +27 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +24 -2
- package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +2 -1
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +15 -1
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +30 -0
- package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +5 -1
- package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +6 -1
- package/dist/types/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.d.ts +2 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +20 -6
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +4 -1
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.d.ts +1 -1
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +24 -2
- package/dist/types/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.d.ts +59 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +18 -2
- package/dist/types/components/snk-taskbar/subcomponents/field-search.d.ts +4 -0
- package/dist/types/components.d.ts +256 -32
- package/dist/types/lib/@types/index.d.ts +2 -1
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +5 -1
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +8 -4
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +13 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +19 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +22 -0
- package/dist/types/lib/http/data-fetcher/fetchers/{dataunit-fetcher.d.ts → data-unit/dataunit-fetcher.d.ts} +5 -3
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadDataResult.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadDataStrategy.d.ts +7 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.d.ts +10 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRecordField.d.ts +4 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IResponseRecord.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DataUnitStrategy.d.ts +9 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +16 -0
- package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +1 -1
- package/dist/types/lib/index.d.ts +1 -1
- package/dist/types/lib/message/resources/snk-application.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-simple-crud.msg.d.ts +2 -0
- package/dist/types/lib/utils/constants.d.ts +3 -4
- package/dist/types/lib/workspace/workspace.d.ts +6 -0
- package/package.json +4 -4
- package/react/components.d.ts +3 -1
- package/react/components.js +3 -1
- package/react/components.js.map +1 -1
- package/dist/cjs/_commonjsHelpers-537d719a.js +0 -20
- package/dist/cjs/dataunit-fetcher-910be4ce.js +0 -356
- package/dist/cjs/draggable.bundle-82a25c06.js +0 -6886
- package/dist/cjs/snk-taskbar-custom-elements.cjs.entry.js +0 -20
- package/dist/collection/components/snk-data-unit/snk-data-unit.css +0 -6
- package/dist/components/_commonjsHelpers.js +0 -17
- package/dist/components/snk-taskbar-custom-elements.d.ts +0 -11
- package/dist/components/snk-taskbar-custom-elements.js +0 -35
- package/dist/esm/_commonjsHelpers-9943807e.js +0 -17
- package/dist/esm/dataunit-fetcher-bd8f9572.js +0 -354
- package/dist/esm/draggable.bundle-41d56f06.js +0 -6884
- package/dist/esm/pesquisa-fetcher-27819123.js +0 -165
- package/dist/esm/snk-taskbar-custom-elements.entry.js +0 -16
- package/dist/sankhyablocks/p-0df2ead8.entry.js +0 -11
- package/dist/sankhyablocks/p-112455b1.js +0 -1
- package/dist/sankhyablocks/p-324ce41e.entry.js +0 -1
- package/dist/sankhyablocks/p-34604220.entry.js +0 -1
- package/dist/sankhyablocks/p-4a78e118.js +0 -1
- package/dist/sankhyablocks/p-5534e08c.js +0 -1
- package/dist/sankhyablocks/p-5d04ae42.entry.js +0 -1
- package/dist/sankhyablocks/p-6a38bda5.entry.js +0 -1
- package/dist/sankhyablocks/p-7bcd2f89.js +0 -56
- package/dist/sankhyablocks/p-7bd5aea7.js +0 -1
- package/dist/sankhyablocks/p-8014cc25.entry.js +0 -1
- package/dist/sankhyablocks/p-928efcaa.entry.js +0 -1
- package/dist/sankhyablocks/p-989937ee.entry.js +0 -1
- package/dist/sankhyablocks/p-9a270401.entry.js +0 -1
- package/dist/sankhyablocks/p-a7ee0e6f.entry.js +0 -1
- package/dist/sankhyablocks/p-ac0556a3.js +0 -1
- package/dist/sankhyablocks/p-ae6aff81.js +0 -1
- package/dist/sankhyablocks/p-b244640b.js +0 -1
- package/dist/sankhyablocks/p-b6d6b172.js +0 -1
- package/dist/sankhyablocks/p-bba91710.entry.js +0 -1
- package/dist/sankhyablocks/p-bd628455.entry.js +0 -1
- package/dist/sankhyablocks/p-c2beb95c.js +0 -1
- package/dist/sankhyablocks/p-c555075c.entry.js +0 -1
- package/dist/sankhyablocks/p-c9841939.js +0 -1
- package/dist/sankhyablocks/p-d3ec3586.entry.js +0 -1
- package/dist/sankhyablocks/p-d708b4ab.entry.js +0 -1
- package/dist/sankhyablocks/p-d84bc5c1.js +0 -1
- package/dist/sankhyablocks/p-de76b8a8.js +0 -76
- package/dist/sankhyablocks/p-e19014a9.entry.js +0 -1
- package/dist/sankhyablocks/p-e1cb1f0b.js +0 -1
- package/dist/sankhyablocks/p-e3a82e1c.entry.js +0 -1
- package/dist/sankhyablocks/p-e9b53a9a.entry.js +0 -1
- package/dist/sankhyablocks/p-ebf8c5df.entry.js +0 -1
- package/dist/sankhyablocks/p-ed5f1204.entry.js +0 -1
- package/dist/sankhyablocks/p-f9395c20.entry.js +0 -1
- package/dist/sankhyablocks/p-f94b999e.entry.js +0 -1
- package/dist/sankhyablocks/p-fa9d3f73.js +0 -1
- package/dist/sankhyablocks/p-fb1ecd0b.entry.js +0 -1
- package/dist/sankhyablocks/p-fcd09423.entry.js +0 -1
- package/dist/sankhyablocks/p-fd15aaac.entry.js +0 -1
- package/dist/types/components/snk-taskbar/snk-taskbar-custom-elements.d.ts +0 -7
|
@@ -0,0 +1,725 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const core = require('@sankhyalabs/core');
|
|
4
|
+
const DataFetcher = require('./DataFetcher-ba94ed5b.js');
|
|
5
|
+
const constants = require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
6
|
+
const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
7
|
+
const PreloadManager = require('./PreloadManager-84466da6.js');
|
|
8
|
+
const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
|
|
9
|
+
const utils = require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
10
|
+
|
|
11
|
+
class InMemoryLoader {
|
|
12
|
+
constructor(metadata, records) {
|
|
13
|
+
this.metadata = metadata;
|
|
14
|
+
this.records = records;
|
|
15
|
+
this._dataUnit = new core.DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
|
16
|
+
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
|
17
|
+
this._dataUnit.dataLoader = (dataUnit, request) => this.inMemoryLoader(dataUnit, request, this.getRecordsToLoad());
|
|
18
|
+
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
|
19
|
+
this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
|
|
20
|
+
this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
|
|
21
|
+
}
|
|
22
|
+
getRecordsToLoad() {
|
|
23
|
+
if (this._initialRecords == undefined && this.dataUnit.records.length > 0) {
|
|
24
|
+
this._initialRecords = this.dataUnit.records;
|
|
25
|
+
}
|
|
26
|
+
return this._initialRecords;
|
|
27
|
+
}
|
|
28
|
+
get dataUnit() {
|
|
29
|
+
return this._dataUnit;
|
|
30
|
+
}
|
|
31
|
+
get records() {
|
|
32
|
+
return this.dataUnit.records;
|
|
33
|
+
}
|
|
34
|
+
static getConvertedValue(descriptor, strValue) {
|
|
35
|
+
if (descriptor.dataType === core.DataType.BOOLEAN) {
|
|
36
|
+
return strValue === "S";
|
|
37
|
+
}
|
|
38
|
+
if (descriptor.dataType === core.DataType.NUMBER) {
|
|
39
|
+
return Number(strValue);
|
|
40
|
+
}
|
|
41
|
+
if (descriptor.dataType === core.DataType.DATE) {
|
|
42
|
+
return core.DateUtils.strToDate(strValue, true);
|
|
43
|
+
}
|
|
44
|
+
if (descriptor.dataType === core.DataType.OBJECT) {
|
|
45
|
+
return JSON.parse(strValue);
|
|
46
|
+
}
|
|
47
|
+
return strValue;
|
|
48
|
+
}
|
|
49
|
+
set records(records) {
|
|
50
|
+
const columns = this._metadata ? new Map(this._metadata.fields.map(descriptor => [descriptor.name, descriptor])) : undefined;
|
|
51
|
+
const newRecords = records === null || records === void 0 ? void 0 : records.map(record => {
|
|
52
|
+
if (!record["__record__id__"]) {
|
|
53
|
+
record["__record__id__"] = this.generateUniqueId();
|
|
54
|
+
}
|
|
55
|
+
if (columns != undefined) {
|
|
56
|
+
for (const name in record) {
|
|
57
|
+
const value = record[name];
|
|
58
|
+
if (typeof value === "string" && columns.has(name)) {
|
|
59
|
+
record[name] = InMemoryLoader.getConvertedValue(columns.get(name), value);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return record;
|
|
64
|
+
});
|
|
65
|
+
this._initialRecords = newRecords;
|
|
66
|
+
if (this._dataUnit) {
|
|
67
|
+
//Isso força o refresh internamente no datunit
|
|
68
|
+
this._dataUnit.gotoPage(0);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
get metadata() {
|
|
72
|
+
return this._metadata;
|
|
73
|
+
}
|
|
74
|
+
set metadata(metadata) {
|
|
75
|
+
this._metadata = metadata;
|
|
76
|
+
if (this._dataUnit) {
|
|
77
|
+
this._dataUnit.metadata = this._metadata;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
generateUniqueId() {
|
|
81
|
+
return core.StringUtils.generateUUID();
|
|
82
|
+
}
|
|
83
|
+
inMemoryLoader(dataUnit, request, recordsIn) {
|
|
84
|
+
let records = this.applyFilter(recordsIn, dataUnit, request.filters);
|
|
85
|
+
records = this.applySorting(records, dataUnit, request.sort);
|
|
86
|
+
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(request, records) });
|
|
87
|
+
}
|
|
88
|
+
applyFilter(records, dataUnit, filters) {
|
|
89
|
+
const columnFilters = utils.ColumnFilterManager.getColumnFilters(filters, "");
|
|
90
|
+
if (columnFilters == undefined || columnFilters.size == 0) {
|
|
91
|
+
return records;
|
|
92
|
+
}
|
|
93
|
+
const filterFunciton = utils.ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
|
94
|
+
if (filterFunciton == undefined) {
|
|
95
|
+
return records;
|
|
96
|
+
}
|
|
97
|
+
return records.filter(filterFunciton);
|
|
98
|
+
}
|
|
99
|
+
applySorting(records, dataUnit, sorting) {
|
|
100
|
+
if (sorting == undefined || sorting.length == 0) {
|
|
101
|
+
return records;
|
|
102
|
+
}
|
|
103
|
+
const sortingFunction = PreloadManager.PreloadManager.getSortingFunction(dataUnit, sorting);
|
|
104
|
+
if (sortingFunction == undefined) {
|
|
105
|
+
return records;
|
|
106
|
+
}
|
|
107
|
+
return records.sort(sortingFunction);
|
|
108
|
+
}
|
|
109
|
+
metadaLoader() {
|
|
110
|
+
return Promise.resolve(this._metadata);
|
|
111
|
+
}
|
|
112
|
+
saveLoader(_dataUnit, changes) {
|
|
113
|
+
return new Promise((resolve) => {
|
|
114
|
+
let dataUnitRecords = [];
|
|
115
|
+
changes.forEach(change => {
|
|
116
|
+
let { record, updatingFields, operation } = change;
|
|
117
|
+
const changedRecord = Object.assign(Object.assign({}, record), updatingFields);
|
|
118
|
+
if (operation === core.ChangeOperation.INSERT ||
|
|
119
|
+
operation === core.ChangeOperation.COPY) {
|
|
120
|
+
changedRecord["__old__id__"] = record["__record__id__"];
|
|
121
|
+
changedRecord["__record__id__"] = this.generateUniqueId();
|
|
122
|
+
this.records.push(changedRecord);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
const recordIndex = this.records.findIndex(r => r["__record__id__"] == changedRecord["__record__id__"]);
|
|
126
|
+
this.records[recordIndex] = changedRecord;
|
|
127
|
+
}
|
|
128
|
+
dataUnitRecords.push(changedRecord);
|
|
129
|
+
});
|
|
130
|
+
resolve(dataUnitRecords);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
removeLoader(_dataUnit, recordIds) {
|
|
134
|
+
return new Promise((resolve) => {
|
|
135
|
+
resolve(recordIds);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME = "InMemoryDataUnit";
|
|
140
|
+
function buildPaginationInfo({ offset, limit }, records) {
|
|
141
|
+
if (offset === undefined || limit === undefined) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
const lastRecord = Math.min(offset + limit, records.length);
|
|
145
|
+
return {
|
|
146
|
+
currentPage: Math.ceil(offset / limit),
|
|
147
|
+
firstRecord: offset,
|
|
148
|
+
lastRecord: lastRecord,
|
|
149
|
+
total: records.length,
|
|
150
|
+
hasMore: !!(records.length - lastRecord),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
class DatasetStrategy {
|
|
155
|
+
canSlice() {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
async load(dataUnit, request, loadingInfo) {
|
|
159
|
+
if (dataUnit.metadata == undefined) {
|
|
160
|
+
return Promise.resolve({ records: [], loadingInfo });
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
const localSorting = [];
|
|
164
|
+
const serverSorting = [];
|
|
165
|
+
if (request.sort != undefined) {
|
|
166
|
+
for (const sort of request.sort) {
|
|
167
|
+
const descriptor = dataUnit.getField(sort.field);
|
|
168
|
+
const local = descriptor != undefined
|
|
169
|
+
&& descriptor.properties != undefined
|
|
170
|
+
&& descriptor.properties.calculated === "true";
|
|
171
|
+
if (local) {
|
|
172
|
+
localSorting.push(sort);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
serverSorting.push(sort);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const fields = this.getFieldsList(dataUnit);
|
|
180
|
+
const serviceName = "DatasetSP.loadRecords";
|
|
181
|
+
const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting);
|
|
182
|
+
const params = loadingInfo.quiet ? { urlParams: { quietMode: "true" } } : undefined;
|
|
183
|
+
const { result: responseRecords, pagerID: pagerId } = await DataFetcher.DataFetcher.get().callServiceBroker(serviceName, requestBody, params);
|
|
184
|
+
const records = this.processRecords(dataUnit, fields, responseRecords);
|
|
185
|
+
const loadingInProgress = pagerId != undefined;
|
|
186
|
+
const count = loadingInfo.count + records.length;
|
|
187
|
+
const needReload = !loadingInProgress && localSorting.length > 0;
|
|
188
|
+
return Promise.resolve({
|
|
189
|
+
records,
|
|
190
|
+
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
|
191
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count,
|
|
192
|
+
needReload })
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
console.error(error);
|
|
197
|
+
return Promise.reject(error);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
getFieldsList(dataUnit) {
|
|
201
|
+
let fields = ["__record__id__", "__record__label__"];
|
|
202
|
+
dataUnit.metadata.fields.forEach((descriptor) => {
|
|
203
|
+
if (descriptor.standAlone) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
fields = fields.concat(this.getFieldNames(descriptor));
|
|
207
|
+
});
|
|
208
|
+
return fields;
|
|
209
|
+
}
|
|
210
|
+
getFieldNames(descriptor) {
|
|
211
|
+
const descriptionField = this.getSearchDescriptionField(descriptor);
|
|
212
|
+
if (descriptionField == undefined) {
|
|
213
|
+
return descriptor.name;
|
|
214
|
+
}
|
|
215
|
+
return [descriptor.name, descriptionField];
|
|
216
|
+
}
|
|
217
|
+
buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, sorting) {
|
|
218
|
+
const dataSetID = dataUnit.dataUnitId;
|
|
219
|
+
const dataUnitName = dataUnit.name;
|
|
220
|
+
const entityName = DataUnitFetcher.parseDataUnitName(dataUnitName).entityName;
|
|
221
|
+
const useParallelLoader = !!(request.limit || request.offset);
|
|
222
|
+
const requestBody = {
|
|
223
|
+
serviceName,
|
|
224
|
+
requestBody: {
|
|
225
|
+
dataSetID,
|
|
226
|
+
fields,
|
|
227
|
+
entityName,
|
|
228
|
+
pageNumber: loadingInfo.pageNumber,
|
|
229
|
+
totalRecordsCount: loadingInfo.count,
|
|
230
|
+
pagerID: loadingInfo.pagerId,
|
|
231
|
+
standAlone: false,
|
|
232
|
+
standAloneFieldsMD: {
|
|
233
|
+
__record__id__: { "fieldType": "S", "userType": "P" },
|
|
234
|
+
__record__label__: { "fieldType": "S", "userType": "P" }
|
|
235
|
+
},
|
|
236
|
+
tryJoinedFields: true,
|
|
237
|
+
parallelLoader: useParallelLoader,
|
|
238
|
+
crudListener: `br.com.sankhya.bff.${this.getModuleName()}.BFFDataUnitDatasetAdapter`,
|
|
239
|
+
txProperties: this.getTxProperties(dataUnitName, request, sorting),
|
|
240
|
+
useDefaultRowsLimit: false
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
return JSON.stringify(requestBody);
|
|
244
|
+
}
|
|
245
|
+
getModuleName() {
|
|
246
|
+
const app = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
247
|
+
const moduleName = app.getModuleName();
|
|
248
|
+
return moduleName.replace("-bff", "");
|
|
249
|
+
}
|
|
250
|
+
getTxProperties(dataUnitName, request, sorting) {
|
|
251
|
+
var _a, _b;
|
|
252
|
+
const txProperties = {
|
|
253
|
+
"__DATA_UNIT_ADAPTER__[dataUnitName]": dataUnitName
|
|
254
|
+
};
|
|
255
|
+
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 : [];
|
|
256
|
+
if (serverSideFilters.length !== 0) {
|
|
257
|
+
txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
|
|
258
|
+
}
|
|
259
|
+
if (sorting != undefined && sorting.length !== 0) {
|
|
260
|
+
txProperties["__DATA_UNIT_ADAPTER__[sorting]"] = JSON.stringify(sorting);
|
|
261
|
+
}
|
|
262
|
+
if (request.parentRecordId != undefined) {
|
|
263
|
+
txProperties["__DATA_UNIT_ADAPTER__[parentRecordId]"] = request.parentRecordId;
|
|
264
|
+
}
|
|
265
|
+
return txProperties;
|
|
266
|
+
}
|
|
267
|
+
processRecords(dataUnit, fields, responseRecords) {
|
|
268
|
+
return responseRecords.map((dataFrame) => {
|
|
269
|
+
const duRecord = {
|
|
270
|
+
__record__id__: dataFrame[0],
|
|
271
|
+
__record__label__: dataFrame[1]
|
|
272
|
+
};
|
|
273
|
+
dataUnit.metadata.fields.forEach(fieldDescriptor => {
|
|
274
|
+
duRecord[fieldDescriptor.name] = this.buildFieldValue(fieldDescriptor, fields, dataFrame);
|
|
275
|
+
});
|
|
276
|
+
return duRecord;
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
buildFieldValue(descriptor, allFields, dataFrame) {
|
|
280
|
+
const fieldIndex = allFields.indexOf(descriptor.name);
|
|
281
|
+
if (fieldIndex < 0) {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
const strValue = dataFrame[fieldIndex];
|
|
285
|
+
if (core.StringUtils.isEmpty(strValue)) {
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
const descriptionField = this.getSearchDescriptionField(descriptor);
|
|
289
|
+
if (descriptionField != undefined) {
|
|
290
|
+
const descriptionFieldIndex = allFields.indexOf(descriptionField);
|
|
291
|
+
if (descriptionFieldIndex >= 0) {
|
|
292
|
+
return { value: strValue, label: dataFrame[descriptionFieldIndex] };
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (descriptor.userInterface === core.UserInterface.SEARCH) {
|
|
296
|
+
//Se não tem um campo de descrição (código acima)
|
|
297
|
+
//Mas é um search, tentamos parsear um numero...
|
|
298
|
+
return isNaN(Number(strValue)) ? strValue : Number(strValue);
|
|
299
|
+
}
|
|
300
|
+
return InMemoryLoader.getConvertedValue(descriptor, strValue);
|
|
301
|
+
}
|
|
302
|
+
getSearchDescriptionField(descriptor) {
|
|
303
|
+
if (descriptor.userInterface === core.UserInterface.SEARCH) {
|
|
304
|
+
const { ENTITYNAME, mergedFrom, DESCRIPTIONFIELD } = descriptor.properties;
|
|
305
|
+
if (!core.StringUtils.isEmpty(DESCRIPTIONFIELD)) {
|
|
306
|
+
return mergedFrom != undefined ? `${mergedFrom}.${ENTITYNAME}.${DESCRIPTIONFIELD}` : `${ENTITYNAME}.${DESCRIPTIONFIELD}`;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return undefined;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
class DataUnitDataLoader {
|
|
314
|
+
static async debounce(dataUnit, callBack) {
|
|
315
|
+
const duName = dataUnit.name;
|
|
316
|
+
if (DataUnitDataLoader._debouncingTimeouts[duName]) {
|
|
317
|
+
clearTimeout(DataUnitDataLoader._debouncingTimeouts[duName]);
|
|
318
|
+
delete DataUnitDataLoader._debouncingTimeouts[duName];
|
|
319
|
+
}
|
|
320
|
+
DataUnitDataLoader._debouncingTimeouts[duName] = setTimeout(() => {
|
|
321
|
+
delete DataUnitDataLoader._debouncingTimeouts[duName];
|
|
322
|
+
callBack();
|
|
323
|
+
}, 100);
|
|
324
|
+
}
|
|
325
|
+
static async loadData(dataUnit, request) {
|
|
326
|
+
return new Promise((resolve, reject) => {
|
|
327
|
+
DataUnitDataLoader.debounce(dataUnit, () => {
|
|
328
|
+
PreloadManager.PreloadManager.loadData(dataUnit, request, this.loadFromServer)
|
|
329
|
+
.then(resp => resolve(resp))
|
|
330
|
+
.catch(reason => reject(reason));
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
static async loadFromServer(dataUnit, request, loadingInfo) {
|
|
335
|
+
try {
|
|
336
|
+
//Registramos a request com as informações de carga para determinarmos a última.
|
|
337
|
+
//Caso o usuário inicie outro refresh antes de terminar, devemos ignorar o resultado.
|
|
338
|
+
loadingInfo = DataUnitDataLoader.registryLoading(dataUnit, loadingInfo);
|
|
339
|
+
const loadResult = await DataUnitDataLoader.callLoader(dataUnit, request, loadingInfo);
|
|
340
|
+
if (loadResult == undefined) {
|
|
341
|
+
//Essa request foi originada de refresh antigo. Será ignorada;
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const loadedRecords = loadResult.records;
|
|
345
|
+
const paginationInfo = DataUnitDataLoader.buildPaginationInfo(loadedRecords.length, request, loadResult.loadingInfo);
|
|
346
|
+
const records = paginationInfo == undefined ? loadedRecords : loadedRecords.slice(0, paginationInfo.lastRecord);
|
|
347
|
+
return Promise.resolve({ records, paginationInfo });
|
|
348
|
+
}
|
|
349
|
+
catch (error) {
|
|
350
|
+
console.error(error);
|
|
351
|
+
return Promise.reject(error);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
static async callLoader(dataUnit, request, requestLoadingInfo, dataLoader) {
|
|
355
|
+
if (dataLoader == undefined) {
|
|
356
|
+
//dataLoader = new DataUnitStrategy();
|
|
357
|
+
dataLoader = new DatasetStrategy();
|
|
358
|
+
}
|
|
359
|
+
const result = await dataLoader.load(dataUnit, request, requestLoadingInfo);
|
|
360
|
+
const { records, loadingInfo: responseLoadingInfo } = result;
|
|
361
|
+
if (DataUnitDataLoader.isOldRequest(dataUnit, responseLoadingInfo)) {
|
|
362
|
+
return Promise.resolve(undefined);
|
|
363
|
+
}
|
|
364
|
+
const recreateCache = !dataLoader.canSlice() || responseLoadingInfo.count === 0;
|
|
365
|
+
PreloadManager.PreloadManager.cacheRecords(dataUnit, records, recreateCache, responseLoadingInfo.loadingInProgress);
|
|
366
|
+
if (PreloadManager.PreloadManager.isCacheEnabled(dataUnit) && responseLoadingInfo.loadingInProgress) {
|
|
367
|
+
const newRequest = Object.assign(Object.assign({}, request), { offset: responseLoadingInfo.count });
|
|
368
|
+
const newLoadingInfo = Object.assign(Object.assign({}, responseLoadingInfo), { pageNumber: (responseLoadingInfo.pageNumber || 0) + 1, quiet: true });
|
|
369
|
+
this.callLoader(dataUnit, newRequest, newLoadingInfo, dataLoader)
|
|
370
|
+
.then(result => DataUnitDataLoader.afterLoadingPage(dataUnit, result.loadingInfo))
|
|
371
|
+
.catch(reason => console.error(reason));
|
|
372
|
+
}
|
|
373
|
+
return Promise.resolve(result);
|
|
374
|
+
}
|
|
375
|
+
static afterLoadingPage(dataUnit, loadingInfo) {
|
|
376
|
+
PreloadManager.PreloadManager.setLoadingStatus(dataUnit, loadingInfo.loadingInProgress);
|
|
377
|
+
const dataUnitPagination = dataUnit.getPaginationInfo();
|
|
378
|
+
if (dataUnitPagination == undefined) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const count = loadingInfo.count;
|
|
382
|
+
if (loadingInfo.loadingInProgress) {
|
|
383
|
+
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count }));
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (loadingInfo.needReload) {
|
|
387
|
+
//Ir para a primeira página, faz com que o loadData seja chamado novamente
|
|
388
|
+
dataUnit.gotoPage(0);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count }));
|
|
392
|
+
}
|
|
393
|
+
static registryLoading(dataUnit, loadingInfo) {
|
|
394
|
+
if (loadingInfo == undefined) {
|
|
395
|
+
loadingInfo = { requestTime: new Date().getTime(), count: 0 };
|
|
396
|
+
}
|
|
397
|
+
DataUnitDataLoader._requestTimeByDataUnit.set(dataUnit.name, loadingInfo.requestTime);
|
|
398
|
+
return loadingInfo;
|
|
399
|
+
}
|
|
400
|
+
static isOldRequest(dataUnit, loadingInfo) {
|
|
401
|
+
return DataUnitDataLoader._requestTimeByDataUnit.get(dataUnit.name) > loadingInfo.requestTime;
|
|
402
|
+
}
|
|
403
|
+
static buildPaginationInfo(pageSize, request, loadingInfo) {
|
|
404
|
+
let { limit, offset } = request;
|
|
405
|
+
if (!limit) {
|
|
406
|
+
return undefined;
|
|
407
|
+
}
|
|
408
|
+
if (loadingInfo.pageNumber === 1) {
|
|
409
|
+
// Quando o loader não é capaz de fatiar os registros
|
|
410
|
+
// ele pode decidir por uma carga completa, o que faz o
|
|
411
|
+
// controle de paginação voltar pra primeira página.
|
|
412
|
+
offset = 0;
|
|
413
|
+
}
|
|
414
|
+
const { total, count, loadingInProgress } = loadingInfo;
|
|
415
|
+
const firstRecord = (count === 0 || pageSize === 0) ? 0 : offset + 1;
|
|
416
|
+
const lastRecord = offset + Math.min(pageSize, limit);
|
|
417
|
+
return {
|
|
418
|
+
total,
|
|
419
|
+
count,
|
|
420
|
+
lastRecord,
|
|
421
|
+
firstRecord,
|
|
422
|
+
currentPage: offset / limit,
|
|
423
|
+
hasMore: lastRecord < count || loadingInProgress
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
DataUnitDataLoader._requestTimeByDataUnit = new Map();
|
|
428
|
+
DataUnitDataLoader._debouncingTimeouts = {};
|
|
429
|
+
|
|
430
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
431
|
+
var t = {};
|
|
432
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
433
|
+
t[p] = s[p];
|
|
434
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
435
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
436
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
437
|
+
t[p[i]] = s[p[i]];
|
|
438
|
+
}
|
|
439
|
+
return t;
|
|
440
|
+
};
|
|
441
|
+
const DATA_UNIT_NAME_PARSER = /dd:\/\/([^/]+)\/([^/?]+)/;
|
|
442
|
+
class DataUnitFetcher {
|
|
443
|
+
constructor() {
|
|
444
|
+
this.templateByQuery = new Map();
|
|
445
|
+
this.buldTemplates();
|
|
446
|
+
}
|
|
447
|
+
buldTemplates() {
|
|
448
|
+
this.templateByQuery.set("fetchDataUnit", DataFetcher.dist.gql `query($name: String!) {
|
|
449
|
+
$queryAlias$: fetchDataUnit(name: $name){
|
|
450
|
+
name
|
|
451
|
+
fields{
|
|
452
|
+
name
|
|
453
|
+
defaultValue
|
|
454
|
+
label
|
|
455
|
+
visible
|
|
456
|
+
standAlone
|
|
457
|
+
readOnly
|
|
458
|
+
required
|
|
459
|
+
dataType
|
|
460
|
+
userInterface
|
|
461
|
+
calculated
|
|
462
|
+
group
|
|
463
|
+
order
|
|
464
|
+
properties{
|
|
465
|
+
name
|
|
466
|
+
value
|
|
467
|
+
}
|
|
468
|
+
dependencies{
|
|
469
|
+
masterFields
|
|
470
|
+
type
|
|
471
|
+
expression
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
children{
|
|
475
|
+
name
|
|
476
|
+
label
|
|
477
|
+
links{
|
|
478
|
+
source
|
|
479
|
+
target
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}`);
|
|
484
|
+
this.templateByQuery.set("saveData", DataFetcher.dist.gql `mutation($changes: [InputBatchChange!]!) {
|
|
485
|
+
$queryAlias$: batchOperationDataUnit(changes: $changes){
|
|
486
|
+
oldId
|
|
487
|
+
id
|
|
488
|
+
label
|
|
489
|
+
ownerDataUnitName
|
|
490
|
+
fields {
|
|
491
|
+
name
|
|
492
|
+
value
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}`);
|
|
496
|
+
this.templateByQuery.set("fetchDataRecord", DataFetcher.dist.gql `query($dataunit: String! $recordID: [String!]) {
|
|
497
|
+
$queryAlias$: fetchDataUnit(name: $dataunit){
|
|
498
|
+
record(id: $recordID){
|
|
499
|
+
id
|
|
500
|
+
label
|
|
501
|
+
fields {
|
|
502
|
+
name
|
|
503
|
+
value
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}`);
|
|
508
|
+
this.templateByQuery.set("fetchDistinctColumn", DataFetcher.dist.gql `query($dataUnit: String!, $fieldName: String!, $argument: String, $filters: [InputFilter], $parentRecordId: String) {
|
|
509
|
+
$queryAlias$: selectDistinct(dataUnit: $dataUnit, fieldName: $fieldName, argument: $argument, filters: $filters, parentRecordId: $parentRecordId)
|
|
510
|
+
}`);
|
|
511
|
+
}
|
|
512
|
+
static parseDataUnitName(name) {
|
|
513
|
+
if (name == undefined) {
|
|
514
|
+
return undefined;
|
|
515
|
+
}
|
|
516
|
+
const parts = DATA_UNIT_NAME_PARSER.exec(name);
|
|
517
|
+
if (!parts) {
|
|
518
|
+
return undefined;
|
|
519
|
+
}
|
|
520
|
+
return { entityName: parts[1], resourceID: parts[2] };
|
|
521
|
+
}
|
|
522
|
+
getDataUnit(entityName, resourceID, parentDataUnit, configName) {
|
|
523
|
+
if (PreloadManager.PreloadManager.applicationResourceID == undefined) {
|
|
524
|
+
//Por falta de um lugar melhor pra iniciar essa variável, fazemos isso aqui.
|
|
525
|
+
ResourceIDUtils.ResourceIDUtils.getResourceID().then(resourceID => PreloadManager.PreloadManager.applicationResourceID = resourceID);
|
|
526
|
+
}
|
|
527
|
+
const duName = `dd://${entityName}/${resourceID}${configName ? "/" + configName : ""}`;
|
|
528
|
+
const dataUnit = parentDataUnit != undefined ? parentDataUnit.getChildDataunit(duName) : new core.DataUnit(duName);
|
|
529
|
+
dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
|
|
530
|
+
dataUnit.dataLoader = (dataUnit, request) => DataUnitDataLoader.loadData(dataUnit, request);
|
|
531
|
+
dataUnit.saveLoader = (_dataUnit, changes) => this.saveData(dataUnit, changes);
|
|
532
|
+
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
|
533
|
+
dataUnit.recordLoader = (dataUnit, recordIds) => this.loadRecord(dataUnit, recordIds);
|
|
534
|
+
return dataUnit;
|
|
535
|
+
}
|
|
536
|
+
loadMetadata(dataUnit) {
|
|
537
|
+
return new Promise((resolve, reject) => {
|
|
538
|
+
DataFetcher.DataFetcher.get()
|
|
539
|
+
.callGraphQL({
|
|
540
|
+
values: { name: dataUnit.name },
|
|
541
|
+
query: this.templateByQuery.get("fetchDataUnit"),
|
|
542
|
+
})
|
|
543
|
+
.then((resp) => {
|
|
544
|
+
var _a;
|
|
545
|
+
const metadata = {
|
|
546
|
+
name: resp.name,
|
|
547
|
+
label: resp.name,
|
|
548
|
+
children: [...resp.children],
|
|
549
|
+
fields: []
|
|
550
|
+
};
|
|
551
|
+
(_a = resp.fields) === null || _a === void 0 ? void 0 : _a.forEach((source) => {
|
|
552
|
+
let properties = undefined;
|
|
553
|
+
if (Array.isArray(source.properties)) {
|
|
554
|
+
properties = {};
|
|
555
|
+
if (source.calculated) {
|
|
556
|
+
properties.gridHeaderTooltip = "Campos calculados não podem ser ordenados";
|
|
557
|
+
}
|
|
558
|
+
source.properties.forEach((prop) => (properties[prop.name] = prop.value));
|
|
559
|
+
}
|
|
560
|
+
metadata.fields.push(Object.assign(Object.assign({}, source), { properties }));
|
|
561
|
+
});
|
|
562
|
+
metadata.fields.sort((a, b) => a.order - b.order);
|
|
563
|
+
resolve(metadata);
|
|
564
|
+
})
|
|
565
|
+
.catch((error) => {
|
|
566
|
+
reject(error);
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
loadSelectDistinct(dataUnit, fieldName, argument) {
|
|
571
|
+
const { parentRecordId, filters } = dataUnit.getLastLoadRequest() || {};
|
|
572
|
+
const filteredFilters = filters.filter(f => f.name !== `${constants.DISTINCT_FILTER_NAME_PREFIX}${fieldName}`);
|
|
573
|
+
const values = {
|
|
574
|
+
dataUnit: dataUnit.name,
|
|
575
|
+
argument,
|
|
576
|
+
fieldName,
|
|
577
|
+
parentRecordId,
|
|
578
|
+
filters: filteredFilters
|
|
579
|
+
};
|
|
580
|
+
return new Promise((resolve, reject) => {
|
|
581
|
+
DataFetcher.DataFetcher.get()
|
|
582
|
+
.callGraphQL({
|
|
583
|
+
values,
|
|
584
|
+
query: this.templateByQuery.get("fetchDistinctColumn"),
|
|
585
|
+
})
|
|
586
|
+
.then((result) => {
|
|
587
|
+
resolve(result);
|
|
588
|
+
})
|
|
589
|
+
.catch((error) => {
|
|
590
|
+
reject(error);
|
|
591
|
+
});
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
saveData(dataUnit, duChanges) {
|
|
595
|
+
const updatedRecordsIds = [];
|
|
596
|
+
const addedRecordsIds = [];
|
|
597
|
+
const changes = duChanges.map((change) => {
|
|
598
|
+
const { dataUnit: changeDU, record, updatingFields, operation } = change;
|
|
599
|
+
const dataUnitInstance = core.DataUnitStorage.get(changeDU);
|
|
600
|
+
let parsedUpdatingFields;
|
|
601
|
+
if (updatingFields) {
|
|
602
|
+
parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
|
|
603
|
+
const descriptor = dataUnitInstance.getField(fieldName);
|
|
604
|
+
const dataType = descriptor ? descriptor.dataType : core.DataType.TEXT;
|
|
605
|
+
return { fieldName, dataType, value: dataUnitInstance.valueToString(fieldName, value) };
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
if (changeDU === dataUnit.name) {
|
|
609
|
+
if (operation === core.ChangeOperation.INSERT || operation === core.ChangeOperation.COPY) {
|
|
610
|
+
addedRecordsIds.push(record.__record__id__);
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
updatedRecordsIds.push(record.__record__id__);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
const reqChange = { dataUnit: changeDU, fields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
|
|
617
|
+
if (change.sourceId) {
|
|
618
|
+
reqChange.sourceId = change.sourceId;
|
|
619
|
+
}
|
|
620
|
+
if (record.__parent__record__id__) {
|
|
621
|
+
reqChange.parentRecordId = record.__parent__record__id__;
|
|
622
|
+
}
|
|
623
|
+
return reqChange;
|
|
624
|
+
});
|
|
625
|
+
return new Promise((resolve, reject) => {
|
|
626
|
+
const changesFormatted = changes.map((_a) => {
|
|
627
|
+
var rest = __rest(_a, []);
|
|
628
|
+
return rest;
|
|
629
|
+
});
|
|
630
|
+
DataFetcher.DataFetcher.get()
|
|
631
|
+
.callGraphQL({
|
|
632
|
+
values: { changes: changesFormatted },
|
|
633
|
+
query: this.templateByQuery.get("saveData"),
|
|
634
|
+
})
|
|
635
|
+
.then((resp) => {
|
|
636
|
+
const dataUnitRecords = [];
|
|
637
|
+
resp === null || resp === void 0 ? void 0 : resp.forEach((responseRecord) => {
|
|
638
|
+
const duRecord = {
|
|
639
|
+
__record__id__: responseRecord.id,
|
|
640
|
+
__record__label__: responseRecord.label,
|
|
641
|
+
__owner__dataunit__name__: responseRecord.ownerDataUnitName,
|
|
642
|
+
};
|
|
643
|
+
const dataUnitInstance = core.DataUnitStorage.get(duRecord.__owner__dataunit__name__) || dataUnit;
|
|
644
|
+
if (responseRecord.oldId) {
|
|
645
|
+
duRecord.__old__id__ = responseRecord.oldId;
|
|
646
|
+
}
|
|
647
|
+
responseRecord.fields.forEach(({ name, value }) => {
|
|
648
|
+
var _a;
|
|
649
|
+
duRecord[name] = ((_a = dataUnitInstance === null || dataUnitInstance === void 0 ? void 0 : dataUnitInstance.valueFromString) === null || _a === void 0 ? void 0 : _a.call(dataUnitInstance, name, value)) || value;
|
|
650
|
+
});
|
|
651
|
+
dataUnitRecords.push(duRecord);
|
|
652
|
+
});
|
|
653
|
+
this.updateCache(dataUnit, dataUnitRecords, updatedRecordsIds, addedRecordsIds);
|
|
654
|
+
resolve(dataUnitRecords);
|
|
655
|
+
})
|
|
656
|
+
.catch((error) => {
|
|
657
|
+
reject(error);
|
|
658
|
+
});
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
updateCache(dataUnit, savedRecords, toUpdate, toInsert) {
|
|
662
|
+
const recordsById = new Map(savedRecords.map(record => [record.__old__id__ || record.__record__id__, record]));
|
|
663
|
+
const addedRecords = toInsert.map(recordId => {
|
|
664
|
+
const copy = Object.assign({}, recordsById.get(recordId));
|
|
665
|
+
delete copy.__old__id__;
|
|
666
|
+
return copy;
|
|
667
|
+
});
|
|
668
|
+
if (addedRecords.length > 0) {
|
|
669
|
+
const firstRecord = dataUnit.records[0];
|
|
670
|
+
PreloadManager.PreloadManager.insertRecords(dataUnit, firstRecord, addedRecords);
|
|
671
|
+
}
|
|
672
|
+
const updatedRecords = toUpdate.map(recordId => (Object.assign({}, recordsById.get(recordId))));
|
|
673
|
+
PreloadManager.PreloadManager.updateRecords(dataUnit, updatedRecords);
|
|
674
|
+
}
|
|
675
|
+
getTransientInfo(dataUnit, recordID) {
|
|
676
|
+
const { records } = dataUnit.getSelectionInfo();
|
|
677
|
+
return Object.entries(records.filter(record => record.__record__id__ == recordID)[0]).filter(([key]) => key.startsWith(UnitMetadata.DataUnitTransient.DATA_UNIT_TRANSIENT_PREFIX_NAME)).map(([name, value]) => ({ fieldName: name, value, dataType: core.DataType.TEXT }));
|
|
678
|
+
}
|
|
679
|
+
removeRecords(dataUnit, recordIds) {
|
|
680
|
+
const changes = recordIds.map((recordId) => {
|
|
681
|
+
return { dataUnit: dataUnit.name, operation: core.ChangeOperation.DELETE, recordId, fields: this.getTransientInfo(dataUnit, recordId) };
|
|
682
|
+
});
|
|
683
|
+
return new Promise((resolve, reject) => {
|
|
684
|
+
DataFetcher.DataFetcher.get()
|
|
685
|
+
.callGraphQL({
|
|
686
|
+
values: { changes: changes },
|
|
687
|
+
query: this.templateByQuery.get("saveData"),
|
|
688
|
+
})
|
|
689
|
+
.then((_resp) => {
|
|
690
|
+
PreloadManager.PreloadManager.removeRecords(dataUnit, dataUnit.records.filter(record => recordIds.includes(record.__record__id__)));
|
|
691
|
+
resolve(recordIds);
|
|
692
|
+
})
|
|
693
|
+
.catch((error) => {
|
|
694
|
+
reject(error);
|
|
695
|
+
});
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
loadRecord(dataUnit, recordIds) {
|
|
699
|
+
return new Promise((resolve, reject) => {
|
|
700
|
+
DataFetcher.DataFetcher.get()
|
|
701
|
+
.callGraphQL({
|
|
702
|
+
values: { recordID: recordIds, dataunit: dataUnit.name },
|
|
703
|
+
query: this.templateByQuery.get("fetchDataRecord"),
|
|
704
|
+
})
|
|
705
|
+
.then((response) => {
|
|
706
|
+
const dataUnitRecords = [];
|
|
707
|
+
response.record.forEach(responseRecord => {
|
|
708
|
+
const duRecord = { __record__id__: responseRecord.id, __record__label__: responseRecord.label };
|
|
709
|
+
responseRecord.fields.forEach(({ name, value }) => {
|
|
710
|
+
duRecord[name] = dataUnit.valueFromString(name, value);
|
|
711
|
+
});
|
|
712
|
+
dataUnitRecords.push(duRecord);
|
|
713
|
+
});
|
|
714
|
+
//TODO: Chamar o worker para persistir a nova versão do registro
|
|
715
|
+
resolve(dataUnitRecords);
|
|
716
|
+
})
|
|
717
|
+
.catch((error) => {
|
|
718
|
+
reject(error);
|
|
719
|
+
});
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
exports.DataUnitFetcher = DataUnitFetcher;
|
|
725
|
+
exports.InMemoryLoader = InMemoryLoader;
|