@sankhyalabs/sankhyablocks 8.15.0-dev.3 → 8.15.0-dev.30
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-0d507a8f.js → ConfigStorage-d4c99a5e.js} +27 -17
- package/dist/cjs/{DataFetcher-ba94ed5b.js → DataFetcher-99f0f6ed.js} +5 -3
- package/dist/cjs/{ISave-d68ce3cd.js → ISave-e91b70a7.js} +1 -0
- package/dist/cjs/{SnkFormConfigManager-467907f6.js → SnkFormConfigManager-3621bfc4.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-7293d0ad.js → SnkMessageBuilder-e7dcf408.js} +13 -0
- package/dist/cjs/{auth-fetcher-c8467c07.js → auth-fetcher-5161d082.js} +1 -1
- package/dist/cjs/{form-config-fetcher-df043d3d.js → form-config-fetcher-9f1a13ca.js} +1 -1
- package/dist/cjs/{index-0e663819.js → index-0922807b.js} +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{dataunit-fetcher-de65b9fc.js → pesquisa-fetcher-c416a6b7.js} +249 -34
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_2.cjs.entry.js +23 -8
- package/dist/cjs/snk-application.cjs.entry.js +98 -9
- package/dist/cjs/snk-attach.cjs.entry.js +396 -58
- package/dist/cjs/snk-crud.cjs.entry.js +14 -11
- package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
- package/dist/cjs/{snk-data-unit-1bc69073.js → snk-data-unit-82c08a8c.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +10 -11
- package/dist/cjs/snk-entity-list.cjs.entry.js +5 -3
- package/dist/cjs/snk-filter-bar.cjs.entry.js +68 -11
- package/dist/cjs/snk-filter-item.cjs.entry.js +3 -0
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -4
- package/dist/cjs/snk-filter-modal.cjs.entry.js +16 -1
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +2 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +2 -2
- package/dist/cjs/snk-form.cjs.entry.js +4 -4
- package/dist/cjs/snk-grid-config.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid.cjs.entry.js +45 -20
- package/dist/cjs/{snk-guides-viewer-7e87ffce.js → snk-guides-viewer-bd69fce4.js} +11 -12
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -10
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +4 -4
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +22 -11
- package/dist/cjs/snk-taskbar.cjs.entry.js +91 -7
- package/dist/cjs/{taskbar-elements-b8c428a9.js → taskbar-elements-1e4fb2e0.js} +9 -9
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/__mocks__/snk-application.js +7 -0
- package/dist/collection/components/snk-application/snk-application.js +111 -5
- package/dist/collection/components/snk-attach/snk-attach.js +194 -38
- 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 +111 -0
- package/dist/collection/components/snk-attach/structure/index.js +6 -3
- package/dist/collection/components/snk-crud/snk-crud.js +42 -4
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +11 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +4 -4
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +1 -1
- 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/snk-filter-item.js +3 -0
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +84 -2
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +0 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +23 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +175 -6
- package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +5 -1
- package/dist/collection/components/snk-grid/snk-grid.js +75 -16
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +1 -1
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -4
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +55 -3
- package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +18 -2
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +8 -8
- package/dist/collection/components/snk-taskbar/snk-taskbar.css +17 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +129 -7
- package/dist/collection/lib/@types/index.js +1 -0
- package/dist/collection/lib/configs/ConfigStorage.js +24 -14
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +1 -1
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +5 -3
- 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/dataunit-fetcher.js +31 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +48 -29
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +21 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +10 -4
- package/dist/collection/lib/index.js +1 -1
- package/dist/collection/lib/message/resources/snk-attach.msg.js +13 -0
- package/dist/components/ConfigStorage.js +25 -15
- package/dist/components/DataFetcher.js +5 -3
- package/dist/components/SnkMessageBuilder.js +13 -0
- package/dist/components/dataunit-fetcher.js +90 -37
- package/dist/components/index2.js +1 -0
- package/dist/components/snk-actions-button2.js +1 -0
- package/dist/components/snk-application2.js +94 -3
- package/dist/components/snk-attach2.js +400 -56
- package/dist/components/snk-crud.js +9 -3
- package/dist/components/snk-data-exporter2.js +1 -1
- package/dist/components/snk-detail-view2.js +4 -4
- package/dist/components/snk-entity-list.js +5 -3
- package/dist/components/snk-filter-bar2.js +71 -9
- package/dist/components/snk-filter-item2.js +3 -0
- package/dist/components/snk-filter-modal-item2.js +0 -1
- package/dist/components/snk-filter-modal.js +21 -3
- package/dist/components/snk-filter-multi-select.js +2 -1
- package/dist/components/snk-grid2.js +42 -15
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/components/snk-simple-crud2.js +17 -3
- package/dist/components/snk-taskbar2.js +103 -15
- package/dist/components/taskbar-actions-button2.js +18 -2
- package/dist/esm/{ConfigStorage-379a9cba.js → ConfigStorage-39ed8aeb.js} +27 -17
- package/dist/esm/{DataFetcher-aa159c5a.js → DataFetcher-a650ae58.js} +5 -3
- package/dist/esm/{ISave-4412b20c.js → ISave-d8c8bc59.js} +1 -0
- package/dist/esm/{SnkFormConfigManager-587e9030.js → SnkFormConfigManager-692e20c7.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-ca843d1b.js → SnkMessageBuilder-0fb796b9.js} +13 -0
- package/dist/esm/{auth-fetcher-c05dc474.js → auth-fetcher-17dc5b5e.js} +1 -1
- package/dist/esm/{form-config-fetcher-36219cd3.js → form-config-fetcher-f121f880.js} +1 -1
- package/dist/esm/{index-1564817d.js → index-0ece87a6.js} +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{dataunit-fetcher-e218c6d2.js → pesquisa-fetcher-ab16a2e8.js} +249 -35
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_2.entry.js +23 -8
- package/dist/esm/snk-application.entry.js +98 -9
- package/dist/esm/snk-attach.entry.js +397 -59
- package/dist/esm/snk-crud.entry.js +14 -11
- package/dist/esm/snk-data-exporter.entry.js +5 -5
- package/dist/esm/{snk-data-unit-6208ebf0.js → snk-data-unit-5d201fb3.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +10 -11
- package/dist/esm/snk-entity-list.entry.js +5 -3
- package/dist/esm/snk-filter-bar.entry.js +68 -11
- package/dist/esm/snk-filter-item.entry.js +3 -0
- package/dist/esm/snk-filter-modal-item.entry.js +3 -4
- package/dist/esm/snk-filter-modal.entry.js +16 -1
- package/dist/esm/snk-filter-multi-select.entry.js +2 -1
- package/dist/esm/snk-form-config.entry.js +2 -2
- package/dist/esm/snk-form.entry.js +4 -4
- package/dist/esm/snk-grid-config.entry.js +3 -3
- package/dist/esm/snk-grid.entry.js +45 -20
- package/dist/esm/{snk-guides-viewer-2134aba2.js → snk-guides-viewer-fde82cc1.js} +11 -12
- package/dist/esm/snk-guides-viewer.entry.js +9 -10
- package/dist/esm/snk-personalized-filter.entry.js +4 -4
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +21 -10
- package/dist/esm/snk-taskbar.entry.js +92 -8
- package/dist/esm/{taskbar-elements-26c981af.js → taskbar-elements-846c027c.js} +9 -9
- package/dist/sankhyablocks/{p-ff6064e7.js → p-05243555.js} +1 -1
- package/dist/sankhyablocks/{p-cb7419e0.entry.js → p-0b0b36ac.entry.js} +1 -1
- package/dist/sankhyablocks/p-11ad137d.entry.js +1 -0
- package/dist/sankhyablocks/{p-9e7d65a4.js → p-21749402.js} +1 -1
- package/dist/sankhyablocks/p-33718dfc.entry.js +1 -0
- package/dist/sankhyablocks/p-38289a55.js +1 -0
- package/dist/sankhyablocks/p-3e2e2424.entry.js +1 -0
- package/dist/sankhyablocks/p-50783a8b.js +1 -0
- package/dist/sankhyablocks/p-57212bb5.js +1 -0
- package/dist/sankhyablocks/p-5f5b58b6.entry.js +1 -0
- package/dist/sankhyablocks/p-67aedbe0.js +56 -0
- package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
- package/dist/sankhyablocks/{p-2028633c.js → p-725d04ba.js} +1 -1
- package/dist/sankhyablocks/p-827e4b01.entry.js +1 -0
- package/dist/sankhyablocks/p-84bb8f47.entry.js +1 -0
- package/dist/sankhyablocks/{p-6977a26c.entry.js → p-86801b08.entry.js} +1 -1
- package/dist/sankhyablocks/p-8c13d8d6.entry.js +1 -0
- package/dist/sankhyablocks/p-8c49760e.js +1 -0
- package/dist/sankhyablocks/p-91b7f78a.entry.js +1 -0
- package/dist/sankhyablocks/p-9d608b62.entry.js +1 -0
- package/dist/sankhyablocks/{p-0d7863ed.js → p-a13ccb86.js} +1 -1
- package/dist/sankhyablocks/p-b7004423.entry.js +1 -0
- package/dist/sankhyablocks/{p-9695f78b.js → p-be75153c.js} +1 -1
- package/dist/sankhyablocks/p-bf2acf72.entry.js +1 -0
- package/dist/sankhyablocks/p-c4874327.entry.js +1 -0
- package/dist/sankhyablocks/p-c6247955.js +65 -0
- package/dist/sankhyablocks/{p-247a8b36.entry.js → p-d1791da2.entry.js} +1 -1
- package/dist/sankhyablocks/p-d4802f81.entry.js +1 -0
- package/dist/sankhyablocks/{p-aaa1438e.entry.js → p-e3bd000e.entry.js} +1 -1
- package/dist/sankhyablocks/{p-32f0935f.js → p-f3d1c48e.js} +1 -1
- package/dist/sankhyablocks/p-fb842329.entry.js +1 -0
- package/dist/sankhyablocks/{p-729f5f5b.entry.js → p-fcdcb0e2.entry.js} +1 -1
- package/dist/sankhyablocks/p-fd0a8d68.entry.js +11 -0
- package/dist/sankhyablocks/{p-35fe6e61.entry.js → p-fdc4cb9b.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/subcomponents/snk-actions-form.d.ts +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 +12 -2
- 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 +28 -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 +31 -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 +15 -0
- package/dist/types/components/snk-attach/structure/index.d.ts +6 -3
- package/dist/types/components/snk-crud/snk-crud.d.ts +9 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +1 -1
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +19 -1
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +30 -1
- package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +7 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +10 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -1
- package/dist/types/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.d.ts +1 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +27 -1
- package/dist/types/components/snk-taskbar/subcomponents/field-search.d.ts +1 -0
- package/dist/types/components.d.ts +177 -13
- package/dist/types/lib/@types/index.d.ts +2 -1
- package/dist/types/lib/configs/ConfigStorage.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/dataunit-fetcher.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +1 -0
- package/dist/types/lib/index.d.ts +1 -1
- package/package.json +15 -6
- package/dist/cjs/pesquisa-fetcher-ef050a47.js +0 -167
- package/dist/esm/pesquisa-fetcher-dd3ca0a5.js +0 -165
- package/dist/sankhyablocks/p-0cd2e986.entry.js +0 -1
- package/dist/sankhyablocks/p-145c4434.js +0 -1
- package/dist/sankhyablocks/p-20726710.entry.js +0 -1
- package/dist/sankhyablocks/p-4396d1a6.js +0 -56
- package/dist/sankhyablocks/p-4775a293.entry.js +0 -1
- package/dist/sankhyablocks/p-4b0ea83f.entry.js +0 -1
- package/dist/sankhyablocks/p-5534e08c.js +0 -1
- package/dist/sankhyablocks/p-58218eb7.entry.js +0 -1
- package/dist/sankhyablocks/p-78777ae0.entry.js +0 -1
- package/dist/sankhyablocks/p-7915c452.entry.js +0 -1
- package/dist/sankhyablocks/p-953346b9.entry.js +0 -1
- package/dist/sankhyablocks/p-a037f5b4.entry.js +0 -1
- package/dist/sankhyablocks/p-a49b1019.entry.js +0 -1
- package/dist/sankhyablocks/p-a7923832.entry.js +0 -1
- package/dist/sankhyablocks/p-b52c2175.js +0 -1
- package/dist/sankhyablocks/p-ba627e85.js +0 -60
- package/dist/sankhyablocks/p-bf9b7149.entry.js +0 -11
- package/dist/sankhyablocks/p-c259545b.entry.js +0 -1
- package/dist/sankhyablocks/p-ca8e7da0.entry.js +0 -1
- package/dist/sankhyablocks/p-d1677df0.entry.js +0 -1
- package/dist/sankhyablocks/p-d4f9ee17.entry.js +0 -1
- package/dist/sankhyablocks/p-d9bb09b3.js +0 -6
- package/dist/sankhyablocks/p-e6380c60.js +0 -1
- package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +0 -15
- /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/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.js +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
@@ -4,21 +4,118 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
|
-
const DataFetcher = require('./DataFetcher-
|
8
|
-
const
|
7
|
+
const DataFetcher = require('./DataFetcher-99f0f6ed.js');
|
8
|
+
const pesquisaFetcher = require('./pesquisa-fetcher-c416a6b7.js');
|
9
|
+
require('./index-0922807b.js');
|
10
|
+
const ISave = require('./ISave-e91b70a7.js');
|
11
|
+
require('./filter-item-type.enum-a7ffdaa6.js');
|
12
|
+
require('./form-config-fetcher-9f1a13ca.js');
|
9
13
|
const constants = require('./constants-35ddd366.js');
|
10
|
-
const dataunitFetcher = require('./dataunit-fetcher-de65b9fc.js');
|
11
14
|
const PreloadManager = require('./PreloadManager-84466da6.js');
|
12
|
-
const
|
15
|
+
const authFetcher = require('./auth-fetcher-5161d082.js');
|
16
|
+
const taskbarElements = require('./taskbar-elements-1e4fb2e0.js');
|
13
17
|
require('./PrintUtils-bcaeb82f.js');
|
14
18
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
15
19
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
16
20
|
require('./ResourceIDUtils-5ff86aa7.js');
|
17
21
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
18
|
-
require('./index-0e663819.js');
|
19
22
|
require('./index-102ba62d.js');
|
20
23
|
|
24
|
+
const SERVICE$1 = {
|
25
|
+
save: "Attach.save",
|
26
|
+
delete: "Attach.remove",
|
27
|
+
view: "Attach.view",
|
28
|
+
repository: "RepositorioArquivoSP.abreArquivo"
|
29
|
+
};
|
21
30
|
class AttachFetcher {
|
31
|
+
constructor(dataUnitName) {
|
32
|
+
this.dataUnitName = dataUnitName;
|
33
|
+
}
|
34
|
+
async save({ dataUnit: dataUnitName, record, updatingFields: fields, operation }) {
|
35
|
+
var _a, _b;
|
36
|
+
const isInsert = operation == "INSERT";
|
37
|
+
const dataBody = isInsert ? fields : record;
|
38
|
+
if (!isInsert && (fields === null || fields === void 0 ? void 0 : fields.DESCRICAO) && (fields === null || fields === void 0 ? void 0 : fields.DESCRICAO) !== (record === null || record === void 0 ? void 0 : record.DESCRICAO)) {
|
39
|
+
throw new Error(ISave.SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED);
|
40
|
+
}
|
41
|
+
const reqBody = {
|
42
|
+
"anexo": {
|
43
|
+
"codata": isInsert ? fields === null || fields === void 0 ? void 0 : fields.REGISTER_KEY : record === null || record === void 0 ? void 0 : record.CODATA,
|
44
|
+
"sequencia": (dataBody === null || dataBody === void 0 ? void 0 : dataBody.SEQUENCIA) || "0",
|
45
|
+
"tipo": (dataBody === null || dataBody === void 0 ? void 0 : dataBody.TIPO) || "N",
|
46
|
+
"descricao": dataBody === null || dataBody === void 0 ? void 0 : dataBody.DESCRICAO,
|
47
|
+
"arquivo": (_b = (_a = fields.CAMINHO_ARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name,
|
48
|
+
"ehInclusao": isInsert ? "S" : "N",
|
49
|
+
"ehArquivoRepositorio": "N"
|
50
|
+
}
|
51
|
+
};
|
52
|
+
return new Promise((resolve, reject) => {
|
53
|
+
DataFetcher.DataFetcher.get().callServiceBroker(SERVICE$1.save, JSON.stringify(reqBody))
|
54
|
+
.then(result => {
|
55
|
+
var _a;
|
56
|
+
return resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { __owner__dataunit__name__: (_a = this.dataUnitName) !== null && _a !== void 0 ? _a : dataUnitName })]);
|
57
|
+
})
|
58
|
+
.catch(error => reject(error));
|
59
|
+
});
|
60
|
+
}
|
61
|
+
async edit(change) {
|
62
|
+
throw new Error("Method not implemented.");
|
63
|
+
}
|
64
|
+
async delete(record) {
|
65
|
+
var request = {
|
66
|
+
anexo: {
|
67
|
+
codata: record.CODATA,
|
68
|
+
tipo: record.TIPO,
|
69
|
+
descricao: record.DESCRICAO,
|
70
|
+
}
|
71
|
+
};
|
72
|
+
const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE$1.delete, JSON.stringify(request));
|
73
|
+
return Promise.resolve(result);
|
74
|
+
}
|
75
|
+
async getDownloadKey(record) {
|
76
|
+
var _a, _b, _c;
|
77
|
+
if (record.EHARQUIVOREPOSITORIO == 'S') {
|
78
|
+
const request = {
|
79
|
+
config: {
|
80
|
+
path: record.ARQUIVO,
|
81
|
+
tipoconteudo: record.TIPOCONTEUDO
|
82
|
+
}
|
83
|
+
};
|
84
|
+
const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE$1.repository, JSON.stringify(request));
|
85
|
+
return Promise.resolve({
|
86
|
+
chave: {
|
87
|
+
valor: (_b = (_a = result === null || result === void 0 ? void 0 : result.responseBody) === null || _a === void 0 ? void 0 : _a.chave) === null || _b === void 0 ? void 0 : _b.valor
|
88
|
+
}
|
89
|
+
});
|
90
|
+
}
|
91
|
+
const criteria = {
|
92
|
+
anexo: {
|
93
|
+
codata: record.CODATA,
|
94
|
+
codemp: record.CODEMP,
|
95
|
+
sequencia: record.SEQUENCIA,
|
96
|
+
tipo: record.TIPO,
|
97
|
+
descricao: record.DESCRICAO,
|
98
|
+
tipoConteudo: record.TIPOCONTEUDO
|
99
|
+
}
|
100
|
+
};
|
101
|
+
const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE$1.view, JSON.stringify(criteria));
|
102
|
+
if (result === null || result === void 0 ? void 0 : result.chaveAnexo) {
|
103
|
+
return Promise.resolve({
|
104
|
+
chave: {
|
105
|
+
valor: (_c = result === null || result === void 0 ? void 0 : result.chaveAnexo) === null || _c === void 0 ? void 0 : _c.idChaveAnexo
|
106
|
+
}
|
107
|
+
});
|
108
|
+
}
|
109
|
+
return Promise.reject(new Error("File not found."));
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
const SERVICE = {
|
114
|
+
save: "AnexoSistemaSP.salvar",
|
115
|
+
delete: "AnexoSistemaSP.excluir",
|
116
|
+
download: "AnexoSistemaSP.baixar",
|
117
|
+
};
|
118
|
+
class AnexoSistemaFetcher {
|
22
119
|
constructor(entityName, registerKey, dataUnitName) {
|
23
120
|
var _a;
|
24
121
|
this.entityName = entityName;
|
@@ -36,14 +133,13 @@ class AttachFetcher {
|
|
36
133
|
}
|
37
134
|
async save(change) {
|
38
135
|
var _a, _b;
|
39
|
-
const serviceName = "AnexoSistemaSP.salvar";
|
40
136
|
let { updatingFields: fields } = change;
|
41
137
|
fields = Object.assign(Object.assign({}, fields), { NOMEARQUIVO: (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0] });
|
42
138
|
try {
|
43
139
|
this.validateFields(fields);
|
44
140
|
const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
|
45
141
|
const reqBody = {
|
46
|
-
serviceName,
|
142
|
+
serviceName: SERVICE.save,
|
47
143
|
requestBody: {
|
48
144
|
params: {
|
49
145
|
resourceID: this.resourceID,
|
@@ -59,7 +155,7 @@ class AttachFetcher {
|
|
59
155
|
}
|
60
156
|
}
|
61
157
|
};
|
62
|
-
const result = await DataFetcher.DataFetcher.get().callServiceBroker(
|
158
|
+
const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody));
|
63
159
|
return Promise.resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { ARQUIVOOULINK: !!fields.LINK ? fields.LINK : fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name, __owner__dataunit__name__: this.dataUnitName })]);
|
64
160
|
}
|
65
161
|
catch (error) {
|
@@ -68,7 +164,6 @@ class AttachFetcher {
|
|
68
164
|
}
|
69
165
|
async edit(change) {
|
70
166
|
var _a, _b, _c;
|
71
|
-
const serviceName = "AnexoSistemaSP.salvar";
|
72
167
|
let { updatingFields: fields, record } = change;
|
73
168
|
const getFieldValue = (fieldValue) => {
|
74
169
|
if (fields[fieldValue] !== undefined)
|
@@ -82,7 +177,7 @@ class AttachFetcher {
|
|
82
177
|
try {
|
83
178
|
this.validateFields(fields);
|
84
179
|
const reqBody = {
|
85
|
-
serviceName,
|
180
|
+
serviceName: SERVICE.save,
|
86
181
|
requestBody: {
|
87
182
|
params: {
|
88
183
|
resourceID: this.resourceID,
|
@@ -100,7 +195,7 @@ class AttachFetcher {
|
|
100
195
|
}
|
101
196
|
}
|
102
197
|
};
|
103
|
-
const result = await DataFetcher.DataFetcher.get().callServiceBroker(
|
198
|
+
const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody));
|
104
199
|
return Promise.resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { ARQUIVOOULINK: !!fields.LINK ? fields.LINK : fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name, __owner__dataunit__name__: this.dataUnitName })]);
|
105
200
|
}
|
106
201
|
catch (error) {
|
@@ -109,10 +204,9 @@ class AttachFetcher {
|
|
109
204
|
}
|
110
205
|
delete(record) {
|
111
206
|
var _a;
|
112
|
-
const serviceName = "AnexoSistemaSP.excluir";
|
113
207
|
const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
|
114
208
|
const reqBody = {
|
115
|
-
serviceName,
|
209
|
+
serviceName: SERVICE.delete,
|
116
210
|
requestBody: {
|
117
211
|
paramsDelete: {
|
118
212
|
keyAttach: record.CHAVEARQUIVO,
|
@@ -124,17 +218,16 @@ class AttachFetcher {
|
|
124
218
|
}
|
125
219
|
};
|
126
220
|
return new Promise((resolve, reject) => {
|
127
|
-
DataFetcher.DataFetcher.get().callServiceBroker(
|
221
|
+
DataFetcher.DataFetcher.get().callServiceBroker(SERVICE.delete, JSON.stringify(reqBody))
|
128
222
|
.then(result => resolve(result))
|
129
223
|
.catch(error => reject(error));
|
130
224
|
});
|
131
225
|
}
|
132
226
|
getDownloadKey(record) {
|
133
227
|
var _a;
|
134
|
-
const serviceName = "AnexoSistemaSP.baixar";
|
135
228
|
const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
|
136
229
|
const reqBody = {
|
137
|
-
serviceName,
|
230
|
+
serviceName: SERVICE.download,
|
138
231
|
requestBody: {
|
139
232
|
paramsDown: {
|
140
233
|
nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
|
@@ -146,34 +239,37 @@ class AttachFetcher {
|
|
146
239
|
}
|
147
240
|
};
|
148
241
|
return new Promise((resolve, reject) => {
|
149
|
-
DataFetcher.DataFetcher.get().callServiceBroker(
|
242
|
+
DataFetcher.DataFetcher.get().callServiceBroker(SERVICE.download, JSON.stringify(reqBody))
|
150
243
|
.then(result => resolve(result))
|
151
244
|
.catch(error => reject(error));
|
152
245
|
});
|
153
246
|
}
|
154
247
|
}
|
155
248
|
|
156
|
-
class
|
249
|
+
class AnexoSistemaDataUnitFactory {
|
157
250
|
constructor(entityName, getMessage) {
|
158
251
|
this.entityName = entityName;
|
159
252
|
this.getMessage = getMessage;
|
160
253
|
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
161
254
|
}
|
162
|
-
initLoaders(dataUnit,
|
255
|
+
initLoaders(dataUnit, fetcher, onSuccess) {
|
163
256
|
if (!this.loader)
|
164
257
|
this.loader = dataUnit.dataLoader;
|
165
258
|
dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
166
|
-
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes,
|
259
|
+
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
|
167
260
|
if (recordIds.length)
|
168
261
|
onSuccess();
|
169
262
|
return recordIds;
|
170
263
|
});
|
171
|
-
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids,
|
264
|
+
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
|
172
265
|
if (recordIds.length)
|
173
266
|
onSuccess();
|
174
267
|
return recordIds;
|
175
268
|
});
|
176
269
|
}
|
270
|
+
metadataLoader(dataUnit) {
|
271
|
+
throw new Error("Method not implemented.");
|
272
|
+
}
|
177
273
|
dataLoader(dataUnit, request) {
|
178
274
|
return new Promise(resolve => {
|
179
275
|
this.loader(dataUnit, request).then(response => {
|
@@ -189,11 +285,11 @@ class AttachmentDataUnitBuilder {
|
|
189
285
|
});
|
190
286
|
});
|
191
287
|
}
|
192
|
-
saveLoader(changes,
|
288
|
+
saveLoader(changes, fetcher) {
|
193
289
|
return new Promise((resolve) => {
|
194
290
|
var _a;
|
195
291
|
const change = Array.isArray(changes) ? changes[0] : {};
|
196
|
-
const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ?
|
292
|
+
const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ? fetcher.edit.bind(fetcher) : fetcher.save.bind(fetcher);
|
197
293
|
savePromise(change).then((records) => {
|
198
294
|
resolve(records);
|
199
295
|
}).catch((error) => {
|
@@ -213,11 +309,11 @@ class AttachmentDataUnitBuilder {
|
|
213
309
|
});
|
214
310
|
});
|
215
311
|
}
|
216
|
-
removeLoader(dataUnit, ids,
|
312
|
+
removeLoader(dataUnit, ids, fetcher) {
|
217
313
|
return new Promise((resolve) => {
|
218
314
|
const { records } = dataUnit.getSelectionInfo();
|
219
315
|
const recordToDelete = records[0];
|
220
|
-
|
316
|
+
fetcher.delete(recordToDelete).then(() => {
|
221
317
|
PreloadManager.PreloadManager.removeRecords(dataUnit, [recordToDelete]);
|
222
318
|
return resolve(ids);
|
223
319
|
});
|
@@ -258,6 +354,175 @@ class AttachmentDataUnitBuilder {
|
|
258
354
|
}
|
259
355
|
}
|
260
356
|
|
357
|
+
const application$1 = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
358
|
+
const getMessage$1 = (key) => {
|
359
|
+
var _a, _b;
|
360
|
+
return (_b = (_a = application$1 === null || application$1 === void 0 ? void 0 : application$1.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage) === null || _b === void 0 ? void 0 : _b.call(_a, key, null);
|
361
|
+
};
|
362
|
+
const attachCrudConfig = {
|
363
|
+
grid: {
|
364
|
+
columns: [
|
365
|
+
{ name: "CODATA", orderIndex: 0, width: 0 },
|
366
|
+
{ name: "DESCRICAO", orderIndex: 1, width: 0 },
|
367
|
+
{ name: "ARQUIVO", orderIndex: 2, width: 0 },
|
368
|
+
{ name: "DTALTER", orderIndex: 3, width: 0 },
|
369
|
+
{ name: "USUARIO", orderIndex: 4, width: 0 },
|
370
|
+
],
|
371
|
+
},
|
372
|
+
form: {
|
373
|
+
emptyConfig: false,
|
374
|
+
fields: [
|
375
|
+
{
|
376
|
+
name: "DESCRICAO",
|
377
|
+
label: getMessage$1("snkAttach.attachMetadata.lblDescription"),
|
378
|
+
visible: true,
|
379
|
+
readOnly: false,
|
380
|
+
required: true,
|
381
|
+
},
|
382
|
+
{
|
383
|
+
name: "CAMINHO_ARQUIVO",
|
384
|
+
label: getMessage$1("snkAttach.attachMetadata.lblFile"),
|
385
|
+
visible: true,
|
386
|
+
readOnly: false,
|
387
|
+
required: true,
|
388
|
+
},
|
389
|
+
],
|
390
|
+
},
|
391
|
+
};
|
392
|
+
const attachFetcherMetadataBuilder = {
|
393
|
+
name: "Attach",
|
394
|
+
label: "Attach List",
|
395
|
+
fields: [
|
396
|
+
{ name: "CODATA", label: getMessage$1("snkAttach.attachMetadata.lblCode"), dataType: core.DataType.TEXT },
|
397
|
+
{ name: "DESCRICAO", label: getMessage$1("snkAttach.attachMetadata.lblDescription"), dataType: core.DataType.TEXT },
|
398
|
+
{ name: "ARQUIVO", label: getMessage$1("snkAttach.attachMetadata.lblFileOrLink"), dataType: core.DataType.TEXT },
|
399
|
+
{ name: "USUARIO", label: getMessage$1("snkAttach.attachMetadata.lblUser"), dataType: core.DataType.TEXT },
|
400
|
+
{ name: "DTALTER", label: getMessage$1("snkAttach.attachMetadata.lblDate"), dataType: core.DataType.TEXT },
|
401
|
+
{
|
402
|
+
name: "CAMINHO_ARQUIVO",
|
403
|
+
label: getMessage$1("snkAttach.attachMetadata.lblFileUpload"),
|
404
|
+
dataType: core.DataType.OBJECT,
|
405
|
+
userInterface: core.UserInterface.FILE,
|
406
|
+
readOnly: false,
|
407
|
+
required: true,
|
408
|
+
visible: true,
|
409
|
+
properties: {
|
410
|
+
subTitle: getMessage$1("snkAttach.attachMetadata.lblSubTitle"),
|
411
|
+
MAX_FILES: 1,
|
412
|
+
STORAGESTRATEGY: "SESSION",
|
413
|
+
INTERNAL_FILENAME: "Attach.upload",
|
414
|
+
}
|
415
|
+
},
|
416
|
+
],
|
417
|
+
};
|
418
|
+
|
419
|
+
const SERVICE_LOAD = "Attach.load";
|
420
|
+
class AttachFetcherDataUnitFactory {
|
421
|
+
constructor(getMessage) {
|
422
|
+
this.getMessage = getMessage;
|
423
|
+
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
424
|
+
}
|
425
|
+
initLoaders(dataUnit, fetcher, onSuccess) {
|
426
|
+
dataUnit.metadataLoader = (dataUnit) => this.metadataLoader(dataUnit);
|
427
|
+
dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
428
|
+
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
|
429
|
+
if (recordIds.length)
|
430
|
+
onSuccess();
|
431
|
+
return recordIds;
|
432
|
+
});
|
433
|
+
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
|
434
|
+
if (recordIds.length)
|
435
|
+
onSuccess();
|
436
|
+
return recordIds;
|
437
|
+
});
|
438
|
+
}
|
439
|
+
metadataLoader(_) {
|
440
|
+
return Promise.resolve(attachFetcherMetadataBuilder);
|
441
|
+
}
|
442
|
+
async dataLoader(_, request) {
|
443
|
+
if (!request.source) {
|
444
|
+
return Promise.resolve({ records: [] });
|
445
|
+
}
|
446
|
+
const criteria = {
|
447
|
+
criteria: {
|
448
|
+
codata: request.source,
|
449
|
+
tipoAnexo: "N"
|
450
|
+
}
|
451
|
+
};
|
452
|
+
const applicationDataFetcher = await this._application.getDataFetcher();
|
453
|
+
const { anexos: { anexo = [] } } = await applicationDataFetcher.callServiceBroker(SERVICE_LOAD, JSON.stringify(criteria));
|
454
|
+
const records = [];
|
455
|
+
anexo.forEach((param) => {
|
456
|
+
records.push(Object.assign({ __record__id__: core.StringUtils.generateUUID(), CAMINHO_ARQUIVO: [{
|
457
|
+
name: param === null || param === void 0 ? void 0 : param.ARQUIVO,
|
458
|
+
}] }, param));
|
459
|
+
});
|
460
|
+
return Promise.resolve({ records });
|
461
|
+
}
|
462
|
+
saveLoader(changes, fetcher) {
|
463
|
+
return new Promise((resolve) => {
|
464
|
+
const change = Array.isArray(changes) ? changes[0] : {};
|
465
|
+
fetcher.save(change)
|
466
|
+
.then(resolve)
|
467
|
+
.catch((error) => {
|
468
|
+
if (error.message === ISave.SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED) {
|
469
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.title'), this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.message'));
|
470
|
+
return resolve([]);
|
471
|
+
}
|
472
|
+
if (error.message === ISave.SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
|
473
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
|
474
|
+
return resolve([]);
|
475
|
+
}
|
476
|
+
if (error.message === ISave.SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
|
477
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
|
478
|
+
return resolve([]);
|
479
|
+
}
|
480
|
+
if (error.message) {
|
481
|
+
this._application.error((error.title || error.name), error.message);
|
482
|
+
return resolve([]);
|
483
|
+
}
|
484
|
+
resolve([]);
|
485
|
+
});
|
486
|
+
});
|
487
|
+
}
|
488
|
+
removeLoader(dataUnit, ids, fetcher) {
|
489
|
+
return new Promise((resolve) => {
|
490
|
+
dataUnit.getSelectionInfo().records.forEach(async (record) => {
|
491
|
+
this._application.hasAccess(authFetcher.AutorizationType.REMOVE)
|
492
|
+
.then(async (hasAccess) => {
|
493
|
+
if (hasAccess) {
|
494
|
+
await fetcher.delete(record);
|
495
|
+
resolve(ids);
|
496
|
+
}
|
497
|
+
});
|
498
|
+
});
|
499
|
+
});
|
500
|
+
}
|
501
|
+
getFilters() {
|
502
|
+
throw new Error('Method not implemented.');
|
503
|
+
}
|
504
|
+
getInterceptions(dataUnit, action, crudRef) {
|
505
|
+
return new Promise((resolve) => {
|
506
|
+
if (action.type === core.Action.EDITION_CANCELED) {
|
507
|
+
if (!dataUnit.isDirty())
|
508
|
+
return resolve(action);
|
509
|
+
return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
|
510
|
+
if (cancellationConfirmed) {
|
511
|
+
crudRef.goToView(constants.VIEW_MODE.GRID);
|
512
|
+
return resolve(action);
|
513
|
+
}
|
514
|
+
return resolve(undefined);
|
515
|
+
});
|
516
|
+
}
|
517
|
+
if (action.type === core.Action.DATA_SAVED) {
|
518
|
+
dataUnit.loadData();
|
519
|
+
return resolve(action);
|
520
|
+
}
|
521
|
+
resolve(action);
|
522
|
+
});
|
523
|
+
}
|
524
|
+
}
|
525
|
+
|
261
526
|
const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
262
527
|
const getMessage = (key) => {
|
263
528
|
var _a, _b;
|
@@ -304,7 +569,7 @@ const buildTaskBarManager = () => {
|
|
304
569
|
};
|
305
570
|
};
|
306
571
|
|
307
|
-
const
|
572
|
+
const anexoSistemaCrudConfig = {
|
308
573
|
grid: {
|
309
574
|
columns: [
|
310
575
|
{ name: "ARQUIVOOULINK", orderIndex: 0, width: 0 },
|
@@ -350,37 +615,60 @@ const SnkAttach = class {
|
|
350
615
|
constructor(hostRef) {
|
351
616
|
index.registerInstance(this, hostRef);
|
352
617
|
this.back = index.createEvent(this, "back", 7);
|
353
|
-
this.handleTaskbarClick = ({ detail: taskbar }) => {
|
618
|
+
this.handleTaskbarClick = async ({ detail: taskbar }) => {
|
354
619
|
if (["DOWNLOAD", "LINK"].includes(taskbar))
|
355
|
-
return this.downloadAttachment(this.
|
620
|
+
return this.downloadAttachment(this._currentDataUnit.getSelectedRecord());
|
621
|
+
if (this.fetcherType === "Attach" && ["SAVE"].includes(taskbar) && this._currentDataUnit.isDirty()) {
|
622
|
+
await this._currentDataUnit.setFieldValue("REGISTER_KEY", this.registerKey);
|
623
|
+
}
|
356
624
|
};
|
357
625
|
this.handleBack = () => {
|
358
|
-
this.
|
626
|
+
this._currentDataUnit.cancelEdition().then((cancelationConfirmed) => {
|
359
627
|
if (cancelationConfirmed)
|
360
628
|
this.back.emit();
|
361
629
|
});
|
362
630
|
};
|
363
631
|
this.handleFinish = () => {
|
364
|
-
if (!this.
|
632
|
+
if (!this._currentDataUnit.isDirty())
|
365
633
|
return this.back.emit();
|
366
|
-
this.
|
634
|
+
this._currentDataUnit.saveData().then(() => {
|
367
635
|
this.showFinishedToast();
|
368
636
|
this.back.emit();
|
369
637
|
});
|
370
638
|
};
|
639
|
+
this.fetcherType = "AnexoSistema";
|
640
|
+
this.fetcher = undefined;
|
641
|
+
this.dataUnit = undefined;
|
642
|
+
this.dataUnitBuilder = undefined;
|
371
643
|
this.registerKey = undefined;
|
372
644
|
this.entityName = undefined;
|
373
645
|
this.messagesBuilder = undefined;
|
374
|
-
this.
|
646
|
+
this._currentFetcher = undefined;
|
647
|
+
this._currentDataUnit = undefined;
|
375
648
|
this.crudConfig = undefined;
|
376
649
|
}
|
377
650
|
registerKeyWatcher(newRegisterKey, oldRegisterKey) {
|
378
|
-
var _a;
|
651
|
+
var _a, _b, _c, _d;
|
652
|
+
if (this._currentDataUnit == null) {
|
653
|
+
this.loadAttachmentDataUnit();
|
654
|
+
}
|
379
655
|
if (oldRegisterKey !== newRegisterKey) {
|
380
656
|
this.returnToGridMode();
|
381
|
-
|
382
|
-
|
383
|
-
|
657
|
+
if (this.fetcherType === "AnexoSistema") {
|
658
|
+
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
659
|
+
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
660
|
+
return (_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData();
|
661
|
+
}
|
662
|
+
if (this.fetcherType === "Attach") {
|
663
|
+
const hasMoreOneItem = ((_d = this.registerKey) === null || _d === void 0 ? void 0 : _d.split("_").length) > 1;
|
664
|
+
if (hasMoreOneItem)
|
665
|
+
return;
|
666
|
+
}
|
667
|
+
return this._currentDataUnit
|
668
|
+
.loadMetadata()
|
669
|
+
.then(() => {
|
670
|
+
this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
671
|
+
});
|
384
672
|
}
|
385
673
|
}
|
386
674
|
/**
|
@@ -403,56 +691,106 @@ const SnkAttach = class {
|
|
403
691
|
window.open(`${selectedRecord.LINK}`);
|
404
692
|
return;
|
405
693
|
}
|
406
|
-
this.
|
407
|
-
|
694
|
+
this._currentFetcher
|
695
|
+
.getDownloadKey(selectedRecord)
|
696
|
+
.then(({ chave }) => {
|
697
|
+
var _a;
|
698
|
+
let forceDownload = false;
|
699
|
+
if (!((_a = selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.ARQUIVO) === null || _a === void 0 ? void 0 : _a.endsWith(".pdf"))) {
|
700
|
+
forceDownload = true;
|
701
|
+
}
|
702
|
+
window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}${forceDownload ? "&forcarDownload=S" : ""}`);
|
408
703
|
});
|
409
704
|
}
|
410
705
|
returnToGridMode() {
|
411
|
-
|
706
|
+
var _a;
|
707
|
+
(_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.clearSelection();
|
412
708
|
if (this._crudElement)
|
413
709
|
this._crudElement.goToView(constants.VIEW_MODE.GRID);
|
414
710
|
}
|
415
711
|
loadAttachmentDataUnit() {
|
416
|
-
var _a;
|
417
712
|
try {
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
});
|
431
|
-
return this.dataUnit;
|
713
|
+
switch (this.fetcherType) {
|
714
|
+
case "AnexoSistema":
|
715
|
+
this.loadAnexoSistema();
|
716
|
+
break;
|
717
|
+
case "Attach":
|
718
|
+
this.loadAttach();
|
719
|
+
break;
|
720
|
+
default:
|
721
|
+
this._currentFetcher = this.fetcher;
|
722
|
+
this._currentDataUnit = this.dataUnit;
|
723
|
+
this._currentDataUnitBuilder = this.dataUnitBuilder;
|
724
|
+
}
|
432
725
|
}
|
433
726
|
catch (error) {
|
434
727
|
throw new Error('There was an error while creating the data unit');
|
435
728
|
}
|
436
729
|
}
|
730
|
+
loadAnexoSistema() {
|
731
|
+
var _a;
|
732
|
+
this._currentDataUnit = this._currentDataUnit || new pesquisaFetcher.DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
|
733
|
+
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
734
|
+
if (!this._currentDataUnit.metadata) {
|
735
|
+
this._currentDataUnit
|
736
|
+
.loadMetadata()
|
737
|
+
.then(() => this.crudConfig = anexoSistemaCrudConfig);
|
738
|
+
}
|
739
|
+
this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
|
740
|
+
this._currentDataUnit.addFilterProvider({
|
741
|
+
getFilter: () => this._currentDataUnitBuilder.getFilters(this.registerKey)
|
742
|
+
});
|
743
|
+
this._currentDataUnit.addInterceptor({
|
744
|
+
interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
|
745
|
+
});
|
746
|
+
this._currentDataUnit.loadData().then(this.disableEditFieldsNotInForm.bind(this));
|
747
|
+
}
|
748
|
+
loadAttach() {
|
749
|
+
var _a;
|
750
|
+
this._currentFetcher = new AttachFetcher();
|
751
|
+
this._currentDataUnit = new core.DataUnit();
|
752
|
+
this._currentDataUnit.addInterceptor({
|
753
|
+
interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
|
754
|
+
});
|
755
|
+
this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
|
756
|
+
(_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
|
757
|
+
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
758
|
+
this.returnToGridMode();
|
759
|
+
});
|
760
|
+
if (!this._currentDataUnit.metadata) {
|
761
|
+
this._currentDataUnit
|
762
|
+
.loadMetadata()
|
763
|
+
.then(() => {
|
764
|
+
this.crudConfig = attachCrudConfig;
|
765
|
+
this._currentDataUnit
|
766
|
+
.loadData(undefined, undefined, true, this.registerKey)
|
767
|
+
.then(this.disableEditFieldsNotInForm.bind(this));
|
768
|
+
});
|
769
|
+
}
|
770
|
+
}
|
437
771
|
disableEditFieldsNotInForm() {
|
438
772
|
var _a;
|
439
773
|
(_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid.columns.forEach(column => {
|
440
774
|
var _a;
|
441
775
|
const fieldName = column.name;
|
442
776
|
if (!((_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.form.fields.some(field => field.name === fieldName))) {
|
443
|
-
this.
|
777
|
+
this._currentDataUnit.disableField(fieldName);
|
444
778
|
}
|
445
779
|
});
|
446
780
|
}
|
447
781
|
componentWillLoad() {
|
448
782
|
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
449
|
-
|
783
|
+
}
|
784
|
+
componentWillRender() {
|
785
|
+
if (this._currentDataUnit == null) {
|
786
|
+
this.loadAttachmentDataUnit();
|
787
|
+
}
|
450
788
|
}
|
451
789
|
render() {
|
452
790
|
var _a, _b;
|
453
|
-
if (!this.
|
791
|
+
if (!this._currentDataUnit)
|
454
792
|
return null;
|
455
|
-
return (index.h("main", { class: "snk-attach__main" }, index.h("header", { class: "snk-attach__header" }, index.h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, index.h("div", { slot: "rightSlot" }, index.h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), index.h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, index.h("div", { class: "ez-box__container" }, index.h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this.
|
793
|
+
return (index.h("main", { class: "snk-attach__main" }, index.h("header", { class: "snk-attach__header" }, index.h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, index.h("div", { slot: "rightSlot" }, index.h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), index.h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, index.h("div", { class: "ez-box__container" }, index.h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder }, index.h("div", { slot: "snkSimpleCrudHeader" }, index.h("div", { class: "ez-flex ez-flex--column" }, index.h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), index.h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
|
456
794
|
}
|
457
795
|
static get watchers() { return {
|
458
796
|
"registerKey": ["registerKeyWatcher"]
|