@sankhyalabs/sankhyablocks 10.1.0-dev.52 → 10.1.0-dev.54
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-a1fab5ca.js → ConfigStorage-4201dd3d.js} +2 -2
- package/dist/cjs/{DataFetcher-384d2ce8.js → DataFetcher-b3a8075d.js} +2830 -2
- package/dist/cjs/FormConfigHelper-c5f5473a.js +342 -0
- package/dist/cjs/{ISave-ecbe9336.js → ISave-4674c283.js} +1 -1
- package/dist/cjs/{PersonalizedFilterUtils-eccb267a.js → PersonalizedFilterUtils-263e4d24.js} +52 -5
- package/dist/cjs/{SnkFormConfigManager-44386305.js → SnkFormConfigManager-c3a49038.js} +2 -2
- package/dist/cjs/{SnkMultiSelectionListDataSource-d341dd02.js → SnkMultiSelectionListDataSource-3a13fd34.js} +4 -4
- package/dist/cjs/{auth-fetcher-6b134ec4.js → auth-fetcher-0ecc53ff.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-b9822794.js → dataunit-fetcher-c7e66f0d.js} +13 -4
- package/dist/cjs/{filter-type.enum-2bb46d2a.js → filter-type.enum-b3b388af.js} +7 -0
- package/dist/cjs/{form-config-fetcher-45d1964c.js → form-config-fetcher-f80dbc3b.js} +23 -5
- package/dist/cjs/index-1894343a.js +24 -36
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +4 -5
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_9.cjs.entry.js +5 -6
- package/dist/cjs/snk-application.cjs.entry.js +7 -8
- package/dist/cjs/snk-attach_11.cjs.entry.js +2950 -0
- package/dist/cjs/snk-crud.cjs.entry.js +31 -243
- package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -6
- package/dist/cjs/{snk-data-unit-4b6dc396.js → snk-data-unit-35f10e01.js} +11 -11
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -4
- package/dist/cjs/snk-detail-view.cjs.entry.js +9 -10
- package/dist/cjs/snk-dynaform-config-header_5.cjs.entry.js +739 -0
- package/dist/cjs/snk-dynaform-detail-view_2.cjs.entry.js +938 -0
- package/dist/cjs/snk-dynaform-field-config_2.cjs.entry.js +327 -0
- package/dist/cjs/snk-dynaform-guides-view-e98f7f3a.js +747 -0
- package/dist/cjs/snk-dynaform-guides-view.cjs.entry.js +23 -0
- package/dist/cjs/snk-dynaform.cjs.entry.js +675 -0
- package/dist/cjs/{snk-expression-group_2.cjs.entry.js → snk-expression-group_4.cjs.entry.js} +421 -18
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +41 -44
- package/dist/cjs/snk-form_2.cjs.entry.js +4 -5
- package/dist/cjs/snk-grid.cjs.entry.js +7 -8
- package/dist/cjs/{snk-guides-viewer-8e7a503b.js → snk-guides-viewer-3054d541.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +5 -6
- package/dist/cjs/snk-layout-form-config.cjs.entry.js +4 -5
- package/dist/cjs/snk-pesquisa.cjs.entry.js +4 -5
- package/dist/cjs/taskbarUtils-383c596e.js +231 -0
- package/dist/collection/collection-manifest.json +17 -0
- package/dist/collection/components/snk-dynaform/interfaces/PropsCustomEditor.js +1 -0
- package/dist/collection/components/snk-dynaform/interfaces/PropsCustomRender.js +1 -0
- package/dist/collection/components/snk-dynaform/snk-dynaform.css +64 -0
- package/dist/collection/components/snk-dynaform/snk-dynaform.js +1657 -0
- package/dist/collection/components/snk-dynaform/subcomponents/CardFormResizeObserver.js +26 -0
- package/dist/collection/components/snk-dynaform/subcomponents/GuideBuilder.js +51 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.css +112 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.js +992 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.css +64 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.js +588 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-guides-view/snk-dynaform-guides-view.css +98 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-guides-view/snk-dynaform-guides-view.js +1167 -0
- package/dist/collection/components/snk-dynaform-form-config/FormConfigHelper.js +325 -0
- package/dist/collection/components/snk-dynaform-form-config/SnkFormConfigManager.js +212 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.css +17 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.js +236 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.css +41 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.js +170 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.css +22 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.js +408 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-item.css +88 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-item.js +209 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.css +167 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.js +655 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.css +42 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.js +171 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-form-config.css +66 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-form-config.js +557 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.css +80 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.js +326 -0
- package/dist/collection/components/snk-grid/snk-grid.css +4 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +11 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +22 -4
- package/dist/components/dataunit-fetcher.js +11 -1
- package/dist/components/form-config-fetcher.js +22 -4
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.js +12 -0
- package/dist/components/snk-crud.js +1 -212
- package/dist/components/snk-dynaform-config-header.d.ts +11 -0
- package/dist/components/snk-dynaform-config-header.js +6 -0
- package/dist/components/snk-dynaform-config-header2.js +103 -0
- package/dist/components/snk-dynaform-configs-button.d.ts +11 -0
- package/dist/components/snk-dynaform-configs-button.js +6 -0
- package/dist/components/snk-dynaform-configs-button2.js +76 -0
- package/dist/components/snk-dynaform-detail-view.d.ts +11 -0
- package/dist/components/snk-dynaform-detail-view.js +6 -0
- package/dist/components/snk-dynaform-detail-view2.js +1835 -0
- package/dist/components/snk-dynaform-field-config.d.ts +11 -0
- package/dist/components/snk-dynaform-field-config.js +6 -0
- package/dist/components/snk-dynaform-field-config2.js +605 -0
- package/dist/components/snk-dynaform-field-item.d.ts +11 -0
- package/dist/components/snk-dynaform-field-item.js +6 -0
- package/dist/components/snk-dynaform-field-item2.js +96 -0
- package/dist/components/snk-dynaform-fields-layout.d.ts +11 -0
- package/dist/components/snk-dynaform-fields-layout.js +6 -0
- package/dist/components/snk-dynaform-fields-layout2.js +428 -0
- package/dist/components/snk-dynaform-fields-selector.d.ts +11 -0
- package/dist/components/snk-dynaform-fields-selector.js +6 -0
- package/dist/components/snk-dynaform-fields-selector2.js +104 -0
- package/dist/components/snk-dynaform-form-config.d.ts +11 -0
- package/dist/components/snk-dynaform-form-config.js +6 -0
- package/dist/components/snk-dynaform-form-config2.js +430 -0
- package/dist/components/snk-dynaform-form-view.d.ts +11 -0
- package/dist/components/snk-dynaform-form-view.js +6 -0
- package/dist/components/snk-dynaform-form-view2.js +270 -0
- package/dist/components/snk-dynaform-guides-configurator.d.ts +11 -0
- package/dist/components/snk-dynaform-guides-configurator.js +6 -0
- package/dist/components/snk-dynaform-guides-configurator2.js +173 -0
- package/dist/components/snk-dynaform-guides-view.d.ts +11 -0
- package/dist/components/snk-dynaform-guides-view.js +6 -0
- package/dist/components/snk-dynaform.d.ts +11 -0
- package/dist/components/snk-dynaform.js +1003 -0
- package/dist/components/snk-grid2.js +1 -1
- package/dist/components/taskbarUtils.js +224 -0
- package/dist/esm/{ConfigStorage-76872695.js → ConfigStorage-e834d1ea.js} +2 -2
- package/dist/esm/{DataFetcher-e60f8d53.js → DataFetcher-5ed0a377.js} +2830 -3
- package/dist/esm/FormConfigHelper-efc29480.js +328 -0
- package/dist/esm/{ISave-4929c071.js → ISave-5b46d691.js} +1 -1
- package/dist/esm/{PersonalizedFilterUtils-d2439a9a.js → PersonalizedFilterUtils-45b5803c.js} +49 -2
- package/dist/esm/{SnkFormConfigManager-83f6b22f.js → SnkFormConfigManager-bfd575c2.js} +2 -2
- package/dist/esm/{SnkMultiSelectionListDataSource-18abafb1.js → SnkMultiSelectionListDataSource-22b50dd6.js} +4 -4
- package/dist/esm/{auth-fetcher-1a31c1e4.js → auth-fetcher-5283045d.js} +1 -1
- package/dist/esm/{dataunit-fetcher-c176e002.js → dataunit-fetcher-2200fdd6.js} +12 -3
- package/dist/esm/{filter-type.enum-f6a8fe23.js → filter-type.enum-62b7fe88.js} +8 -1
- package/dist/esm/{form-config-fetcher-b44b2727.js → form-config-fetcher-db1bf140.js} +23 -5
- package/dist/esm/index-04f73a26.js +24 -36
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-grid_2.entry.js +4 -5
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_9.entry.js +5 -6
- package/dist/esm/snk-application.entry.js +6 -7
- package/dist/esm/snk-attach_11.entry.js +2936 -0
- package/dist/esm/snk-crud.entry.js +6 -218
- package/dist/esm/snk-data-exporter.entry.js +5 -6
- package/dist/esm/{snk-data-unit-d8cfa950.js → snk-data-unit-e8bd4143.js} +2 -2
- package/dist/esm/snk-data-unit.entry.js +3 -4
- package/dist/esm/snk-detail-view.entry.js +7 -8
- package/dist/esm/snk-dynaform-config-header_5.entry.js +731 -0
- package/dist/esm/snk-dynaform-detail-view_2.entry.js +933 -0
- package/dist/esm/snk-dynaform-field-config_2.entry.js +322 -0
- package/dist/esm/snk-dynaform-guides-view-1f1455d6.js +744 -0
- package/dist/esm/snk-dynaform-guides-view.entry.js +15 -0
- package/dist/esm/snk-dynaform.entry.js +671 -0
- package/dist/esm/{snk-expression-group_2.entry.js → snk-expression-group_4.entry.js} +405 -4
- package/dist/esm/snk-filter-bar_4.entry.js +5 -8
- package/dist/esm/snk-form_2.entry.js +4 -5
- package/dist/esm/snk-grid.entry.js +7 -8
- package/dist/esm/{snk-guides-viewer-adf39ea2.js → snk-guides-viewer-95fefcaa.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +5 -6
- package/dist/esm/snk-layout-form-config.entry.js +4 -5
- package/dist/esm/snk-pesquisa.entry.js +4 -5
- package/dist/esm/taskbarUtils-682ca78c.js +225 -0
- package/dist/sankhyablocks/p-06b6c284.entry.js +1 -0
- package/dist/sankhyablocks/p-09e2255b.entry.js +1 -0
- package/dist/sankhyablocks/p-0dbd53d9.js +1 -0
- package/dist/sankhyablocks/{p-5c250661.js → p-1a04f537.js} +1 -1
- package/dist/sankhyablocks/{p-ab5e12fa.js → p-1cc4cf61.js} +1 -1
- package/dist/sankhyablocks/{p-f5ad0720.js → p-2040953e.js} +1 -1
- package/dist/sankhyablocks/p-22ddc1a5.entry.js +1 -0
- package/dist/sankhyablocks/p-24b059ee.entry.js +1 -0
- package/dist/sankhyablocks/p-2b581179.entry.js +1 -0
- package/dist/sankhyablocks/p-449dfe55.entry.js +1 -0
- package/dist/sankhyablocks/p-451b5bcc.entry.js +1 -0
- package/dist/sankhyablocks/p-46d7e2de.js +1 -0
- package/dist/sankhyablocks/{p-3c990841.js → p-51e853f2.js} +1 -1
- package/dist/sankhyablocks/p-51f1485c.entry.js +1 -0
- package/dist/sankhyablocks/p-58709cf9.js +1 -0
- package/dist/sankhyablocks/p-589016e2.entry.js +1 -0
- package/dist/sankhyablocks/p-5c6eede7.js +60 -0
- package/dist/sankhyablocks/p-5d02c032.js +1 -0
- package/dist/sankhyablocks/p-5d50f59a.entry.js +1 -0
- package/dist/sankhyablocks/p-670c43e3.entry.js +1 -0
- package/dist/sankhyablocks/{p-b1bb4cf1.js → p-70c2ee5c.js} +1 -1
- package/dist/sankhyablocks/p-77c26de0.js +1 -0
- package/dist/sankhyablocks/p-92c71225.entry.js +1 -0
- package/dist/sankhyablocks/p-9c89a76a.entry.js +1 -0
- package/dist/sankhyablocks/{p-4f7adf97.js → p-b1bf9564.js} +1 -1
- package/dist/sankhyablocks/p-c538bd6c.entry.js +1 -0
- package/dist/sankhyablocks/p-ccd61eb8.entry.js +1 -0
- package/dist/sankhyablocks/{p-3704bf1b.js → p-d5810110.js} +1 -1
- package/dist/sankhyablocks/p-d88278f8.js +28 -0
- package/dist/sankhyablocks/p-dc45e9e5.entry.js +1 -0
- package/dist/sankhyablocks/{p-8fe740b7.entry.js → p-dc83c70f.entry.js} +2 -2
- package/dist/sankhyablocks/p-e5362a5c.js +1 -0
- package/dist/sankhyablocks/p-edd44079.entry.js +1 -0
- package/dist/sankhyablocks/p-eff38390.entry.js +1 -0
- package/dist/sankhyablocks/p-ff28e5e4.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-dynaform/interfaces/PropsCustomEditor.d.ts +4 -0
- package/dist/types/components/snk-dynaform/interfaces/PropsCustomRender.d.ts +4 -0
- package/dist/types/components/snk-dynaform/subcomponents/CardFormResizeObserver.d.ts +1 -0
- package/dist/types/components/snk-dynaform/subcomponents/GuideBuilder.d.ts +14 -0
- package/dist/types/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.d.ts +158 -0
- package/dist/types/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.d.ts +107 -0
- package/dist/types/components/snk-dynaform-form-config/FormConfigHelper.d.ts +36 -0
- package/dist/types/components/snk-dynaform-form-config/SnkFormConfigManager.d.ts +35 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.d.ts +23 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.d.ts +19 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.d.ts +56 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.d.ts +74 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.d.ts +21 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-form-config.d.ts +95 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.d.ts +35 -0
- package/dist/types/components.d.ts +2403 -1322
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +1 -0
- package/package.json +5 -1
- package/react/components.d.ts +12 -0
- package/react/components.js +12 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/SnkMessageBuilder-a9300ebe.js +0 -2833
- package/dist/cjs/default-filters-a09bf82b.js +0 -8
- package/dist/cjs/index-62760a9c.js +0 -49
- package/dist/cjs/index-8d94b7e0.js +0 -7
- package/dist/cjs/snk-attach.cjs.entry.js +0 -948
- package/dist/cjs/snk-default-filter.cjs.entry.js +0 -77
- package/dist/cjs/snk-filter-advanced-mode_3.cjs.entry.js +0 -99
- package/dist/cjs/snk-filter-detail.cjs.entry.js +0 -198
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +0 -408
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +0 -109
- package/dist/cjs/snk-image-input.cjs.entry.js +0 -160
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +0 -358
- package/dist/cjs/snk-simple-crud.cjs.entry.js +0 -865
- package/dist/esm/SnkMessageBuilder-1eb7a1af.js +0 -2831
- package/dist/esm/default-filters-50105e43.js +0 -8
- package/dist/esm/index-620ac460.js +0 -7
- package/dist/esm/index-8acbae97.js +0 -49
- package/dist/esm/snk-attach.entry.js +0 -944
- package/dist/esm/snk-default-filter.entry.js +0 -73
- package/dist/esm/snk-filter-advanced-mode_3.entry.js +0 -93
- package/dist/esm/snk-filter-detail.entry.js +0 -194
- package/dist/esm/snk-filter-field-search_2.entry.js +0 -403
- package/dist/esm/snk-filter-modal-item.entry.js +0 -105
- package/dist/esm/snk-image-input.entry.js +0 -156
- package/dist/esm/snk-personalized-filter.entry.js +0 -354
- package/dist/esm/snk-simple-crud.entry.js +0 -861
- package/dist/sankhyablocks/p-0a4cdcde.entry.js +0 -1
- package/dist/sankhyablocks/p-0afc64df.entry.js +0 -1
- package/dist/sankhyablocks/p-10f27dc6.entry.js +0 -1
- package/dist/sankhyablocks/p-20f03230.entry.js +0 -1
- package/dist/sankhyablocks/p-2af8aca3.js +0 -1
- package/dist/sankhyablocks/p-3870748a.js +0 -28
- package/dist/sankhyablocks/p-3d294185.entry.js +0 -1
- package/dist/sankhyablocks/p-438a225f.entry.js +0 -1
- package/dist/sankhyablocks/p-4d04bc75.entry.js +0 -1
- package/dist/sankhyablocks/p-554c0e54.js +0 -1
- package/dist/sankhyablocks/p-57c184a2.entry.js +0 -1
- package/dist/sankhyablocks/p-68c1a093.js +0 -1
- package/dist/sankhyablocks/p-6a4b21dd.js +0 -1
- package/dist/sankhyablocks/p-6ae7543b.entry.js +0 -1
- package/dist/sankhyablocks/p-6e278003.js +0 -60
- package/dist/sankhyablocks/p-82bcb4cf.entry.js +0 -1
- package/dist/sankhyablocks/p-84345e7a.js +0 -1
- package/dist/sankhyablocks/p-95af0bb1.entry.js +0 -1
- package/dist/sankhyablocks/p-a905712a.entry.js +0 -1
- package/dist/sankhyablocks/p-aff2d081.entry.js +0 -1
- package/dist/sankhyablocks/p-b0a357b4.entry.js +0 -1
- package/dist/sankhyablocks/p-b568c1d4.js +0 -1
- package/dist/sankhyablocks/p-bab4cde4.entry.js +0 -1
- package/dist/sankhyablocks/p-bd3c1aaa.entry.js +0 -1
- package/dist/sankhyablocks/p-cc64239c.entry.js +0 -1
- package/dist/sankhyablocks/p-cd00a3d1.entry.js +0 -1
- package/dist/sankhyablocks/p-d9ec8c4b.entry.js +0 -1
- package/dist/sankhyablocks/p-dbdbb77a.entry.js +0 -1
- package/dist/sankhyablocks/p-e8df1dea.entry.js +0 -1
- package/dist/sankhyablocks/p-ef9343c3.entry.js +0 -1
- package/dist/sankhyablocks/p-f4184ce7.js +0 -1
|
@@ -1,948 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-1894343a.js');
|
|
6
|
-
const core = require('@sankhyalabs/core');
|
|
7
|
-
const DataFetcher = require('./DataFetcher-384d2ce8.js');
|
|
8
|
-
const ISave = require('./ISave-ecbe9336.js');
|
|
9
|
-
require('./index-e3e39724.js');
|
|
10
|
-
const dataunitFetcher = require('./dataunit-fetcher-b9822794.js');
|
|
11
|
-
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
12
|
-
require('./form-config-fetcher-45d1964c.js');
|
|
13
|
-
const constants = require('./constants-6d82e405.js');
|
|
14
|
-
const authFetcher = require('./auth-fetcher-6b134ec4.js');
|
|
15
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-a9300ebe.js');
|
|
16
|
-
const taskbarElements = require('./taskbar-elements-80eddec8.js');
|
|
17
|
-
require('./PrintUtils-bcaeb82f.js');
|
|
18
|
-
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
19
|
-
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
20
|
-
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
21
|
-
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
22
|
-
require('./ResourceIDUtils-5ff86aa7.js');
|
|
23
|
-
require('./index-f0fe7e6e.js');
|
|
24
|
-
|
|
25
|
-
const SERVICE$1 = {
|
|
26
|
-
save: "Attach.save",
|
|
27
|
-
delete: "Attach.remove",
|
|
28
|
-
view: "Attach.view",
|
|
29
|
-
repository: "RepositorioArquivoSP.abreArquivo"
|
|
30
|
-
};
|
|
31
|
-
class AttachFetcher {
|
|
32
|
-
constructor(dataUnitName) {
|
|
33
|
-
this.dataUnitName = dataUnitName;
|
|
34
|
-
}
|
|
35
|
-
async save({ dataUnit: dataUnitName, record, updatingFields: fields, operation }) {
|
|
36
|
-
var _a, _b;
|
|
37
|
-
const isInsert = operation == "INSERT";
|
|
38
|
-
const dataBody = isInsert ? fields : record;
|
|
39
|
-
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)) {
|
|
40
|
-
throw new Error(ISave.SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED);
|
|
41
|
-
}
|
|
42
|
-
const reqBody = {
|
|
43
|
-
"anexo": {
|
|
44
|
-
"codata": isInsert ? fields === null || fields === void 0 ? void 0 : fields.REGISTER_KEY : record === null || record === void 0 ? void 0 : record.CODATA,
|
|
45
|
-
"sequencia": (dataBody === null || dataBody === void 0 ? void 0 : dataBody.SEQUENCIA) || "0",
|
|
46
|
-
"tipo": (dataBody === null || dataBody === void 0 ? void 0 : dataBody.TIPO) || "N",
|
|
47
|
-
"descricao": dataBody === null || dataBody === void 0 ? void 0 : dataBody.DESCRICAO,
|
|
48
|
-
"arquivo": (_b = (_a = fields.CAMINHO_ARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name,
|
|
49
|
-
"ehInclusao": isInsert ? "S" : "N",
|
|
50
|
-
"ehArquivoRepositorio": "N"
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
return new Promise((resolve, reject) => {
|
|
54
|
-
DataFetcher.DataFetcher.get().callServiceBroker(SERVICE$1.save, JSON.stringify(reqBody))
|
|
55
|
-
.then(result => {
|
|
56
|
-
var _a;
|
|
57
|
-
return resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { __owner__dataunit__name__: (_a = this.dataUnitName) !== null && _a !== void 0 ? _a : dataUnitName })]);
|
|
58
|
-
})
|
|
59
|
-
.catch(error => reject(error));
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
async edit(change) {
|
|
63
|
-
throw new Error("Method not implemented.");
|
|
64
|
-
}
|
|
65
|
-
async delete(record) {
|
|
66
|
-
var request = {
|
|
67
|
-
anexo: {
|
|
68
|
-
codata: record.CODATA,
|
|
69
|
-
tipo: record.TIPO,
|
|
70
|
-
descricao: record.DESCRICAO,
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE$1.delete, JSON.stringify(request));
|
|
74
|
-
return Promise.resolve(result);
|
|
75
|
-
}
|
|
76
|
-
async getDownloadKey(record) {
|
|
77
|
-
var _a, _b, _c;
|
|
78
|
-
if (record.EHARQUIVOREPOSITORIO == 'S') {
|
|
79
|
-
const request = {
|
|
80
|
-
config: {
|
|
81
|
-
path: record.ARQUIVO,
|
|
82
|
-
tipoconteudo: record.TIPOCONTEUDO
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE$1.repository, JSON.stringify(request));
|
|
86
|
-
return Promise.resolve({
|
|
87
|
-
chave: {
|
|
88
|
-
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
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
const criteria = {
|
|
93
|
-
anexo: {
|
|
94
|
-
codata: record.CODATA,
|
|
95
|
-
codemp: record.CODEMP,
|
|
96
|
-
sequencia: record.SEQUENCIA,
|
|
97
|
-
tipo: record.TIPO,
|
|
98
|
-
descricao: record.DESCRICAO,
|
|
99
|
-
tipoConteudo: record.TIPOCONTEUDO
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE$1.view, JSON.stringify(criteria));
|
|
103
|
-
if (result === null || result === void 0 ? void 0 : result.chaveAnexo) {
|
|
104
|
-
return Promise.resolve({
|
|
105
|
-
chave: {
|
|
106
|
-
valor: (_c = result === null || result === void 0 ? void 0 : result.chaveAnexo) === null || _c === void 0 ? void 0 : _c.idChaveAnexo
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
return Promise.reject(new Error("File not found."));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const SERVICE = {
|
|
115
|
-
save: "AnexoSistemaSP.salvar",
|
|
116
|
-
delete: "AnexoSistemaSP.excluir",
|
|
117
|
-
download: "AnexoSistemaSP.baixar",
|
|
118
|
-
};
|
|
119
|
-
class AnexoSistemaFetcher {
|
|
120
|
-
constructor(entityName, dataUnitName) {
|
|
121
|
-
var _a;
|
|
122
|
-
this.entityName = entityName;
|
|
123
|
-
this.dataUnitName = dataUnitName;
|
|
124
|
-
this.validateFields = (fields) => {
|
|
125
|
-
if (!!fields.LINK && !!fields.NOMEARQUIVO)
|
|
126
|
-
throw new Error(ISave.SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME);
|
|
127
|
-
if (!fields.LINK && !fields.NOMEARQUIVO)
|
|
128
|
-
throw new Error(ISave.SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED);
|
|
129
|
-
if (!this._registerKey)
|
|
130
|
-
throw new Error('Register key can not be null');
|
|
131
|
-
};
|
|
132
|
-
this.resourceID = (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID));
|
|
133
|
-
}
|
|
134
|
-
set registerKey(registerKey) {
|
|
135
|
-
this._registerKey = registerKey;
|
|
136
|
-
}
|
|
137
|
-
async save(change) {
|
|
138
|
-
var _a, _b;
|
|
139
|
-
let { updatingFields: fields } = change;
|
|
140
|
-
fields = Object.assign(Object.assign({}, fields), { NOMEARQUIVO: (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0] });
|
|
141
|
-
try {
|
|
142
|
-
this.validateFields(fields);
|
|
143
|
-
const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
|
|
144
|
-
const reqBody = {
|
|
145
|
-
serviceName: SERVICE.save,
|
|
146
|
-
requestBody: {
|
|
147
|
-
params: {
|
|
148
|
-
resourceID: this.resourceID,
|
|
149
|
-
description: fields.DESCRICAO,
|
|
150
|
-
fileSelect: fileInfo ? 1 : 0,
|
|
151
|
-
keySession: (_b = fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.properties) === null || _b === void 0 ? void 0 : _b.fileNameTmp,
|
|
152
|
-
nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
|
|
153
|
-
link: fields.LINK,
|
|
154
|
-
nameEntity: this.entityName,
|
|
155
|
-
pkEntity: this._registerKey,
|
|
156
|
-
typeAcess: fields.TIPOACESSO,
|
|
157
|
-
typeApres: fields.TIPOAPRES,
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody));
|
|
162
|
-
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 })]);
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
return Promise.reject(error);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
async edit(change) {
|
|
169
|
-
var _a, _b, _c;
|
|
170
|
-
let { updatingFields: fields, record } = change;
|
|
171
|
-
const getFieldValue = (fieldValue) => {
|
|
172
|
-
if (fields[fieldValue] !== undefined)
|
|
173
|
-
return fields[fieldValue];
|
|
174
|
-
return record[fieldValue];
|
|
175
|
-
};
|
|
176
|
-
const attachField = getFieldValue('NOMEARQUIVO');
|
|
177
|
-
const hasNewAttachment = (_b = (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.downloadURL;
|
|
178
|
-
fields = Object.assign(Object.assign({}, fields), { DESCRICAO: getFieldValue('DESCRICAO'), LINK: getFieldValue('LINK'), TIPOACESSO: getFieldValue('TIPOACESSO'), TIPOAPRES: getFieldValue('TIPOAPRES'), CHAVEARQUIVO: record.CHAVEARQUIVO, NOMEARQUIVO: attachField === null || attachField === void 0 ? void 0 : attachField[0] });
|
|
179
|
-
const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
|
|
180
|
-
try {
|
|
181
|
-
this.validateFields(fields);
|
|
182
|
-
const reqBody = {
|
|
183
|
-
serviceName: SERVICE.save,
|
|
184
|
-
requestBody: {
|
|
185
|
-
params: {
|
|
186
|
-
resourceID: this.resourceID,
|
|
187
|
-
nuAttach: record === null || record === void 0 ? void 0 : record.NUATTACH,
|
|
188
|
-
description: fields.DESCRICAO,
|
|
189
|
-
fileSelect: hasNewAttachment ? 1 : 0,
|
|
190
|
-
keySession: (_c = fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.properties) === null || _c === void 0 ? void 0 : _c.fileNameTmp,
|
|
191
|
-
keyAttach: fields.CHAVEARQUIVO,
|
|
192
|
-
nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
|
|
193
|
-
link: fields.LINK,
|
|
194
|
-
nameEntity: this.entityName,
|
|
195
|
-
pkEntity: this._registerKey,
|
|
196
|
-
typeAcess: fields.TIPOACESSO,
|
|
197
|
-
typeApres: fields.TIPOAPRES,
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody));
|
|
202
|
-
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 })]);
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
return Promise.reject(error);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
delete(record) {
|
|
209
|
-
var _a;
|
|
210
|
-
const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
|
|
211
|
-
const reqBody = {
|
|
212
|
-
serviceName: SERVICE.delete,
|
|
213
|
-
requestBody: {
|
|
214
|
-
paramsDelete: {
|
|
215
|
-
keyAttach: record.CHAVEARQUIVO,
|
|
216
|
-
nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
|
|
217
|
-
nameEntity: record.NOMEINSTANCIA,
|
|
218
|
-
nuAttach: record.NUATTACH,
|
|
219
|
-
pkEntity: record.PKREGISTRO
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
return new Promise((resolve, reject) => {
|
|
224
|
-
DataFetcher.DataFetcher.get().callServiceBroker(SERVICE.delete, JSON.stringify(reqBody))
|
|
225
|
-
.then(result => resolve(result))
|
|
226
|
-
.catch(error => reject(error));
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
getDownloadKey(record) {
|
|
230
|
-
var _a;
|
|
231
|
-
const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
|
|
232
|
-
const reqBody = {
|
|
233
|
-
serviceName: SERVICE.download,
|
|
234
|
-
requestBody: {
|
|
235
|
-
paramsDown: {
|
|
236
|
-
nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
|
|
237
|
-
nameEntity: record.NOMEINSTANCIA,
|
|
238
|
-
nuAttach: record.NUATTACH,
|
|
239
|
-
pkEntity: record.PKREGISTRO,
|
|
240
|
-
keyAttach: record.CHAVEARQUIVO,
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
return new Promise((resolve, reject) => {
|
|
245
|
-
DataFetcher.DataFetcher.get().callServiceBroker(SERVICE.download, JSON.stringify(reqBody))
|
|
246
|
-
.then(result => resolve(result))
|
|
247
|
-
.catch(error => reject(error));
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
class AnexoSistemaDataUnitFactory {
|
|
253
|
-
constructor(entityName, getMessage) {
|
|
254
|
-
this.entityName = entityName;
|
|
255
|
-
this.getMessage = getMessage;
|
|
256
|
-
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
257
|
-
}
|
|
258
|
-
initLoaders(dataUnit, fetcher, onSuccess) {
|
|
259
|
-
if (!this.loader)
|
|
260
|
-
this.loader = dataUnit.dataLoader;
|
|
261
|
-
dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
|
262
|
-
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
|
|
263
|
-
if (recordIds.length)
|
|
264
|
-
onSuccess();
|
|
265
|
-
return recordIds;
|
|
266
|
-
});
|
|
267
|
-
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
|
|
268
|
-
if (recordIds.length)
|
|
269
|
-
onSuccess();
|
|
270
|
-
return recordIds;
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
metadataLoader(dataUnit) {
|
|
274
|
-
throw new Error("Method not implemented.");
|
|
275
|
-
}
|
|
276
|
-
dataLoader(dataUnit, request) {
|
|
277
|
-
return new Promise(resolve => {
|
|
278
|
-
this.loader(dataUnit, request).then(response => {
|
|
279
|
-
const records = ((response === null || response === void 0 ? void 0 : response.records) || []).map(record => {
|
|
280
|
-
let fileInfo;
|
|
281
|
-
if (!record.LINK)
|
|
282
|
-
fileInfo = [{
|
|
283
|
-
name: record.NOMEARQUIVO,
|
|
284
|
-
}];
|
|
285
|
-
return Object.assign(Object.assign({}, record), { ARQUIVOOULINK: !!record.LINK ? record.LINK : record.NOMEARQUIVO, NOMEARQUIVO: fileInfo });
|
|
286
|
-
});
|
|
287
|
-
resolve(Object.assign(Object.assign({}, response), { records }));
|
|
288
|
-
});
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
saveLoader(changes, fetcher) {
|
|
292
|
-
return new Promise((resolve) => {
|
|
293
|
-
var _a;
|
|
294
|
-
const change = Array.isArray(changes) ? changes[0] : {};
|
|
295
|
-
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);
|
|
296
|
-
savePromise(change).then((records) => {
|
|
297
|
-
resolve(records);
|
|
298
|
-
}).catch((error) => {
|
|
299
|
-
if (error.message === ISave.SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
|
|
300
|
-
this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
|
|
301
|
-
return resolve([]);
|
|
302
|
-
}
|
|
303
|
-
if (error.message === ISave.SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
|
|
304
|
-
this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
|
|
305
|
-
return resolve([]);
|
|
306
|
-
}
|
|
307
|
-
if (error.message) {
|
|
308
|
-
this._application.error((error.title || error.name), error.message);
|
|
309
|
-
return resolve([]);
|
|
310
|
-
}
|
|
311
|
-
resolve([]);
|
|
312
|
-
});
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
removeLoader(dataUnit, ids, fetcher) {
|
|
316
|
-
return new Promise((resolve) => {
|
|
317
|
-
const { records } = dataUnit.getSelectionInfo();
|
|
318
|
-
const recordToDelete = records[0];
|
|
319
|
-
fetcher.delete(recordToDelete).then(() => {
|
|
320
|
-
dataunitFetcher.PreloadManager.removeRecords(dataUnit, [recordToDelete]);
|
|
321
|
-
return resolve(ids);
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
getFilters(registerKey) {
|
|
326
|
-
return [
|
|
327
|
-
{
|
|
328
|
-
name: 'AttachmentsByPK',
|
|
329
|
-
expression: 'this.PKREGISTRO = :PKREGISTRO',
|
|
330
|
-
params: [{
|
|
331
|
-
name: "PKREGISTRO",
|
|
332
|
-
dataType: core.DataType.TEXT,
|
|
333
|
-
value: `${registerKey}_${this.entityName}`
|
|
334
|
-
}]
|
|
335
|
-
}
|
|
336
|
-
];
|
|
337
|
-
}
|
|
338
|
-
getInterceptions(dataUnit, action, crudRef) {
|
|
339
|
-
return new Promise((resolve) => {
|
|
340
|
-
if (action.type === core.Action.EDITION_CANCELED) {
|
|
341
|
-
if (!dataUnit.isDirty())
|
|
342
|
-
return resolve(action);
|
|
343
|
-
return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
|
|
344
|
-
if (cancellationConfirmed) {
|
|
345
|
-
crudRef.goToView(constants.VIEW_MODE.GRID);
|
|
346
|
-
return resolve(action);
|
|
347
|
-
}
|
|
348
|
-
return resolve(undefined);
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
if (action.type === core.Action.DATA_SAVED) {
|
|
352
|
-
dataUnit.loadData();
|
|
353
|
-
return resolve(action);
|
|
354
|
-
}
|
|
355
|
-
resolve(action);
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
let messageBuilderInstance;
|
|
361
|
-
const getMessage$1 = (key) => {
|
|
362
|
-
if (!messageBuilderInstance) {
|
|
363
|
-
messageBuilderInstance = new SnkMessageBuilder.SnkMessageBuilder();
|
|
364
|
-
}
|
|
365
|
-
return messageBuilderInstance.getMessage(key);
|
|
366
|
-
};
|
|
367
|
-
const attachCrudConfig = {
|
|
368
|
-
grid: {
|
|
369
|
-
columns: [
|
|
370
|
-
{ name: "CODATA", orderIndex: 0, width: 0 },
|
|
371
|
-
{ name: "DESCRICAO", orderIndex: 1, width: 0 },
|
|
372
|
-
{ name: "ARQUIVO", orderIndex: 2, width: 0 },
|
|
373
|
-
{ name: "DTALTER", orderIndex: 3, width: 0 },
|
|
374
|
-
{ name: "USUARIO", orderIndex: 4, width: 0 },
|
|
375
|
-
],
|
|
376
|
-
},
|
|
377
|
-
form: {
|
|
378
|
-
emptyConfig: false,
|
|
379
|
-
fields: [
|
|
380
|
-
{
|
|
381
|
-
name: "DESCRICAO",
|
|
382
|
-
label: getMessage$1("snkAttach.attachMetadata.lblDescription"),
|
|
383
|
-
visible: true,
|
|
384
|
-
readOnly: false,
|
|
385
|
-
required: true,
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
name: "CAMINHO_ARQUIVO",
|
|
389
|
-
label: getMessage$1("snkAttach.attachMetadata.lblFile"),
|
|
390
|
-
visible: true,
|
|
391
|
-
readOnly: false,
|
|
392
|
-
required: true,
|
|
393
|
-
},
|
|
394
|
-
],
|
|
395
|
-
},
|
|
396
|
-
};
|
|
397
|
-
const attachFetcherMetadataBuilder = {
|
|
398
|
-
name: "Attach",
|
|
399
|
-
label: "Attach List",
|
|
400
|
-
fields: [
|
|
401
|
-
{ name: "CODATA", label: getMessage$1("snkAttach.attachMetadata.lblCode"), dataType: core.DataType.TEXT },
|
|
402
|
-
{ name: "DESCRICAO", label: getMessage$1("snkAttach.attachMetadata.lblDescription"), dataType: core.DataType.TEXT, readOnly: false },
|
|
403
|
-
{ name: "ARQUIVO", label: getMessage$1("snkAttach.attachMetadata.lblFileOrLink"), dataType: core.DataType.TEXT },
|
|
404
|
-
{ name: "USUARIO", label: getMessage$1("snkAttach.attachMetadata.lblUser"), dataType: core.DataType.TEXT },
|
|
405
|
-
{ name: "DTALTER", label: getMessage$1("snkAttach.attachMetadata.lblDate"), dataType: core.DataType.TEXT },
|
|
406
|
-
{
|
|
407
|
-
name: "CAMINHO_ARQUIVO",
|
|
408
|
-
label: getMessage$1("snkAttach.attachMetadata.lblFileUpload"),
|
|
409
|
-
dataType: core.DataType.OBJECT,
|
|
410
|
-
userInterface: core.UserInterface.FILE,
|
|
411
|
-
readOnly: false,
|
|
412
|
-
required: true,
|
|
413
|
-
visible: true,
|
|
414
|
-
properties: {
|
|
415
|
-
subTitle: getMessage$1("snkAttach.attachMetadata.lblSubTitle"),
|
|
416
|
-
MAX_FILES: 1,
|
|
417
|
-
STORAGESTRATEGY: "SESSION",
|
|
418
|
-
INTERNAL_FILENAME: "Attach.upload",
|
|
419
|
-
}
|
|
420
|
-
},
|
|
421
|
-
],
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
const SERVICE_LOAD = "Attach.load";
|
|
425
|
-
class AttachFetcherDataUnitFactory {
|
|
426
|
-
constructor(getMessage) {
|
|
427
|
-
this.getMessage = getMessage;
|
|
428
|
-
this._records = [];
|
|
429
|
-
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
430
|
-
}
|
|
431
|
-
initLoaders(dataUnit, fetcher, onSuccess) {
|
|
432
|
-
dataUnit.metadataLoader = (dataUnit) => this.metadataLoader(dataUnit);
|
|
433
|
-
dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
|
434
|
-
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
|
|
435
|
-
if (recordIds.length)
|
|
436
|
-
onSuccess();
|
|
437
|
-
return recordIds;
|
|
438
|
-
});
|
|
439
|
-
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
|
|
440
|
-
if (recordIds.length)
|
|
441
|
-
onSuccess();
|
|
442
|
-
return recordIds;
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
metadataLoader(_) {
|
|
446
|
-
return Promise.resolve(attachFetcherMetadataBuilder);
|
|
447
|
-
}
|
|
448
|
-
async dataLoader(dataUnit, request) {
|
|
449
|
-
if (!request.source) {
|
|
450
|
-
return Promise.resolve({ records: this._records });
|
|
451
|
-
}
|
|
452
|
-
if (!Number.isNaN(Number(request.source))) {
|
|
453
|
-
const criteria = {
|
|
454
|
-
criteria: {
|
|
455
|
-
codata: request.source,
|
|
456
|
-
tipoAnexo: "N"
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
const applicationDataFetcher = await this._application.getDataFetcher();
|
|
460
|
-
const { anexos: { anexo = [] } } = await applicationDataFetcher.callServiceBroker(SERVICE_LOAD, JSON.stringify(criteria));
|
|
461
|
-
const records = [];
|
|
462
|
-
anexo.forEach((param) => {
|
|
463
|
-
records.push(Object.assign({ __record__id__: core.StringUtils.generateUUID(), CAMINHO_ARQUIVO: [{
|
|
464
|
-
name: param === null || param === void 0 ? void 0 : param.ARQUIVO,
|
|
465
|
-
}] }, param));
|
|
466
|
-
});
|
|
467
|
-
this._records = records;
|
|
468
|
-
}
|
|
469
|
-
return core.DataUnitLoaderUtils.buildLoadDataResponse(this._records, dataUnit, request);
|
|
470
|
-
}
|
|
471
|
-
saveLoader(changes, fetcher) {
|
|
472
|
-
return new Promise((resolve) => {
|
|
473
|
-
const change = Array.isArray(changes) ? changes[0] : {};
|
|
474
|
-
fetcher.save(change)
|
|
475
|
-
.then(resolve)
|
|
476
|
-
.catch((error) => {
|
|
477
|
-
if (error.message === ISave.SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED) {
|
|
478
|
-
this._application.alert(this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.title'), this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.message'));
|
|
479
|
-
return resolve([]);
|
|
480
|
-
}
|
|
481
|
-
if (error.message === ISave.SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
|
|
482
|
-
this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
|
|
483
|
-
return resolve([]);
|
|
484
|
-
}
|
|
485
|
-
if (error.message === ISave.SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
|
|
486
|
-
this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
|
|
487
|
-
return resolve([]);
|
|
488
|
-
}
|
|
489
|
-
if (error.message) {
|
|
490
|
-
this._application.error((error.title || error.name), error.message);
|
|
491
|
-
return resolve([]);
|
|
492
|
-
}
|
|
493
|
-
resolve([]);
|
|
494
|
-
});
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
removeLoader(dataUnit, ids, fetcher) {
|
|
498
|
-
return new Promise((resolve) => {
|
|
499
|
-
dataUnit.getSelectionInfo().records.forEach(async (record) => {
|
|
500
|
-
this._application.hasAccess(authFetcher.AutorizationType.REMOVE)
|
|
501
|
-
.then(async (hasAccess) => {
|
|
502
|
-
if (hasAccess) {
|
|
503
|
-
await fetcher.delete(record);
|
|
504
|
-
resolve(ids);
|
|
505
|
-
}
|
|
506
|
-
});
|
|
507
|
-
});
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
getFilters() {
|
|
511
|
-
throw new Error('Method not implemented.');
|
|
512
|
-
}
|
|
513
|
-
getInterceptions(dataUnit, action, crudRef) {
|
|
514
|
-
return new Promise((resolve) => {
|
|
515
|
-
var _a, _b, _c, _d, _e, _f;
|
|
516
|
-
switch (action.type) {
|
|
517
|
-
case core.Action.EDITION_CANCELED:
|
|
518
|
-
if (!dataUnit.isDirty())
|
|
519
|
-
return resolve(action);
|
|
520
|
-
return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
|
|
521
|
-
if (cancellationConfirmed) {
|
|
522
|
-
crudRef.goToView(constants.VIEW_MODE.GRID);
|
|
523
|
-
return resolve(action);
|
|
524
|
-
}
|
|
525
|
-
return resolve(undefined);
|
|
526
|
-
});
|
|
527
|
-
case core.Action.DATA_SAVED:
|
|
528
|
-
dataUnit.loadData(undefined, undefined, false, (_c = (_b = (_a = action === null || action === void 0 ? void 0 : action.payload) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.REGISTER_KEY);
|
|
529
|
-
return resolve(action);
|
|
530
|
-
case core.Action.RECORDS_REMOVED:
|
|
531
|
-
dataUnit.loadData(undefined, undefined, false, (_f = (_e = (_d = action === null || action === void 0 ? void 0 : action.payload) === null || _d === void 0 ? void 0 : _d.cachedRecords) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.CODATA);
|
|
532
|
-
return resolve(action);
|
|
533
|
-
}
|
|
534
|
-
resolve(action);
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
let messagesBuilder;
|
|
540
|
-
const getMessage = (key) => {
|
|
541
|
-
var _a;
|
|
542
|
-
if (!messagesBuilder) {
|
|
543
|
-
const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
544
|
-
messagesBuilder = application === null || application === void 0 ? void 0 : application.messagesBuilder;
|
|
545
|
-
}
|
|
546
|
-
return (_a = messagesBuilder === null || messagesBuilder === void 0 ? void 0 : messagesBuilder.getMessage) === null || _a === void 0 ? void 0 : _a.call(messagesBuilder, key, null);
|
|
547
|
-
};
|
|
548
|
-
const TaskbarAttachButtons = {
|
|
549
|
-
DOWNLOAD: {
|
|
550
|
-
hint: getMessage("snkAttach.taskbar.titleDownload"),
|
|
551
|
-
name: "DOWNLOAD",
|
|
552
|
-
iconName: 'file-download'
|
|
553
|
-
},
|
|
554
|
-
LINK: {
|
|
555
|
-
hint: getMessage("snkAttach.taskbar.titleLink"),
|
|
556
|
-
name: "LINK",
|
|
557
|
-
iconName: "launch"
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
const buildTaskBarManager = () => {
|
|
561
|
-
const disabledButtonsWithoutSelection = [
|
|
562
|
-
taskbarElements.TaskbarElement.REMOVE,
|
|
563
|
-
"DOWNLOAD",
|
|
564
|
-
"LINK"
|
|
565
|
-
];
|
|
566
|
-
return {
|
|
567
|
-
getButtons: (_, dataState, currentButtons) => {
|
|
568
|
-
const refreshBtnIndex = currentButtons.indexOf(taskbarElements.TaskbarElement.REFRESH);
|
|
569
|
-
if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty)) {
|
|
570
|
-
return currentButtons.reverse();
|
|
571
|
-
}
|
|
572
|
-
else if (refreshBtnIndex !== -1) {
|
|
573
|
-
currentButtons.splice(refreshBtnIndex, 1);
|
|
574
|
-
}
|
|
575
|
-
const { selectedRecord } = dataState || {};
|
|
576
|
-
const taskbarTobeAdded = !!(selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.LINK) ? TaskbarAttachButtons.LINK : TaskbarAttachButtons.DOWNLOAD;
|
|
577
|
-
currentButtons.splice(currentButtons.indexOf(taskbarElements.TaskbarElement.DIVIDER) + 1, 0, taskbarElements.TaskbarElement.REMOVE, taskbarTobeAdded, taskbarElements.TaskbarElement.DIVIDER);
|
|
578
|
-
const buttonsToRemove = [taskbarElements.TaskbarElement.CLONE, taskbarElements.TaskbarElement.DATA_EXPORTER];
|
|
579
|
-
const updatedButtons = Array.from(new Set(currentButtons.filter((button) => !buttonsToRemove.includes(button))));
|
|
580
|
-
updatedButtons.splice(updatedButtons.indexOf(taskbarTobeAdded) + 1, 0, taskbarElements.TaskbarElement.DIVIDER);
|
|
581
|
-
return updatedButtons;
|
|
582
|
-
},
|
|
583
|
-
isEnabled: (_, dataState, currentButton) => {
|
|
584
|
-
const hasSelectedRecord = (dataState === null || dataState === void 0 ? void 0 : dataState.selectedRecord) !== undefined;
|
|
585
|
-
const disabledButton = disabledButtonsWithoutSelection.includes(currentButton);
|
|
586
|
-
if (disabledButton && !hasSelectedRecord)
|
|
587
|
-
return false;
|
|
588
|
-
return true;
|
|
589
|
-
}
|
|
590
|
-
};
|
|
591
|
-
};
|
|
592
|
-
|
|
593
|
-
const anexoSistemaCrudConfig = {
|
|
594
|
-
grid: {
|
|
595
|
-
columns: [
|
|
596
|
-
{ name: "ARQUIVOOULINK", orderIndex: 0, width: 0 },
|
|
597
|
-
{ name: "DESCRICAO", orderIndex: 1, width: 0 },
|
|
598
|
-
{ name: "DHCAD", orderIndex: 2, width: 0 },
|
|
599
|
-
{ name: "DHALTER", orderIndex: 3, width: 0 },
|
|
600
|
-
{ name: "TIPOAPRES", orderIndex: 4, width: 0 },
|
|
601
|
-
{ name: "TIPOACESSO", orderIndex: 5, width: 0 },
|
|
602
|
-
{ name: "CODUSU", orderIndex: 6, width: 0 },
|
|
603
|
-
{ name: "CODUSUALT", orderIndex: 7, width: 0 }
|
|
604
|
-
]
|
|
605
|
-
},
|
|
606
|
-
form: {
|
|
607
|
-
emptyConfig: false,
|
|
608
|
-
fields: [
|
|
609
|
-
{
|
|
610
|
-
name: "DESCRICAO",
|
|
611
|
-
required: true
|
|
612
|
-
},
|
|
613
|
-
{
|
|
614
|
-
name: "TIPOAPRES",
|
|
615
|
-
required: true,
|
|
616
|
-
},
|
|
617
|
-
{
|
|
618
|
-
name: "TIPOACESSO",
|
|
619
|
-
required: true,
|
|
620
|
-
},
|
|
621
|
-
{
|
|
622
|
-
name: "LINK"
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
name: "NOMEARQUIVO"
|
|
626
|
-
}
|
|
627
|
-
]
|
|
628
|
-
},
|
|
629
|
-
};
|
|
630
|
-
|
|
631
|
-
const snkAttachCss = ".snk-attach__header.sc-snk-attach{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--space--6, 6px)}.snk-attach__header.sc-snk-attach>section.sc-snk-attach{display:flex;align-items:center}.snk-attach__file-info.sc-snk-attach{display:flex;flex-direction:column;justify-content:center;gap:var(--space--8, 8px)}.snk-attach__main.sc-snk-attach{display:flex;flex-direction:column;height:100%}.ez-box__container.sc-snk-attach{height:100%}.snk-attach__crud-section.sc-snk-attach{padding:1px;display:flex;flex-direction:column;height:100%;width:100%}";
|
|
632
|
-
|
|
633
|
-
const RESOURCE_ID = 'AnexoSistema';
|
|
634
|
-
const DATA_UNIT_NAME = 'br.com.sankhya.core.v3.anexoSistema';
|
|
635
|
-
const GRID_LEGACY_CONFIG_NAME = 'GrdCfgHtml5:grdcfg.dynaform.anexo';
|
|
636
|
-
const LINKORFILE_COLUMN_NAME = "ARQUIVOOULINK";
|
|
637
|
-
const SnkAttach = class {
|
|
638
|
-
constructor(hostRef) {
|
|
639
|
-
index.registerInstance(this, hostRef);
|
|
640
|
-
this.ezClosePopup = index.createEvent(this, "ezClosePopup", 7);
|
|
641
|
-
this.handleTaskbarClick = async ({ detail: taskbar }) => {
|
|
642
|
-
if (["DOWNLOAD", "LINK"].includes(taskbar))
|
|
643
|
-
return this.downloadAttachment(this._currentDataUnit.getSelectedRecord());
|
|
644
|
-
if (this.fetcherType === "Attach" && ["SAVE"].includes(taskbar) && this._currentDataUnit.isDirty()) {
|
|
645
|
-
await this._currentDataUnit.setFieldValue("REGISTER_KEY", this.registerKey);
|
|
646
|
-
}
|
|
647
|
-
};
|
|
648
|
-
this.handleBack = () => {
|
|
649
|
-
this._currentDataUnit.cancelEdition().then((cancelationConfirmed) => {
|
|
650
|
-
if (cancelationConfirmed)
|
|
651
|
-
this.close();
|
|
652
|
-
});
|
|
653
|
-
};
|
|
654
|
-
this.handleFinish = () => {
|
|
655
|
-
if (!this._currentDataUnit.isDirty())
|
|
656
|
-
return this.close();
|
|
657
|
-
if (!this.validateAnexoSistema()) {
|
|
658
|
-
return;
|
|
659
|
-
}
|
|
660
|
-
this._currentDataUnit.saveData().then(() => {
|
|
661
|
-
this.showFinishedToast();
|
|
662
|
-
this.close();
|
|
663
|
-
});
|
|
664
|
-
};
|
|
665
|
-
this._isOpen = false;
|
|
666
|
-
this.gridLegacyConfigName = undefined;
|
|
667
|
-
this.fetcherType = undefined;
|
|
668
|
-
this.fetcher = undefined;
|
|
669
|
-
this.dataUnit = undefined;
|
|
670
|
-
this.dataUnitBuilder = undefined;
|
|
671
|
-
this.registerKey = undefined;
|
|
672
|
-
this.entityName = undefined;
|
|
673
|
-
this.messagesBuilder = undefined;
|
|
674
|
-
this._currentFetcher = undefined;
|
|
675
|
-
this._currentDataUnit = undefined;
|
|
676
|
-
this.crudConfig = undefined;
|
|
677
|
-
this._appResourceID = undefined;
|
|
678
|
-
}
|
|
679
|
-
// Garante que o popup só abre via método open()
|
|
680
|
-
// Não há mais caminhos alternativos de abertura
|
|
681
|
-
/**
|
|
682
|
-
* Abre o popup do SnkAttach.
|
|
683
|
-
*/
|
|
684
|
-
/**
|
|
685
|
-
* Abre o popup do SnkAttach.
|
|
686
|
-
* Inicializa o componente apenas na abertura.
|
|
687
|
-
*/
|
|
688
|
-
async open() {
|
|
689
|
-
this._isOpen = true;
|
|
690
|
-
// Inicialização só ocorre na abertura
|
|
691
|
-
if (!this._currentDataUnit) {
|
|
692
|
-
await this.initAttach();
|
|
693
|
-
}
|
|
694
|
-
if (this._refPopup) {
|
|
695
|
-
this._refPopup.opened = true;
|
|
696
|
-
}
|
|
697
|
-
if (!this.fetcherType) {
|
|
698
|
-
this.fetcherType = "AnexoSistema";
|
|
699
|
-
}
|
|
700
|
-
if (this._currentDataUnit == null) {
|
|
701
|
-
this.loadAttachmentDataUnit();
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
/**
|
|
705
|
-
* Fecha o popup do SnkAttach.
|
|
706
|
-
*/
|
|
707
|
-
async close() {
|
|
708
|
-
this._isOpen = false;
|
|
709
|
-
if (this._refPopup) {
|
|
710
|
-
this._refPopup.opened = false;
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
async registerKeyWatcher(newRegisterKey, oldRegisterKey) {
|
|
714
|
-
var _a;
|
|
715
|
-
if (this._currentDataUnit == null) {
|
|
716
|
-
this.loadAttachmentDataUnit();
|
|
717
|
-
}
|
|
718
|
-
if (oldRegisterKey !== newRegisterKey) {
|
|
719
|
-
if (this._currentFetcher instanceof AnexoSistemaFetcher) {
|
|
720
|
-
this._currentFetcher.registerKey = newRegisterKey;
|
|
721
|
-
}
|
|
722
|
-
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData());
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
getAnexoSistemaFetcherInstance() {
|
|
726
|
-
var _a;
|
|
727
|
-
const anexoSistemaFetcher = new AnexoSistemaFetcher(this.entityName, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
728
|
-
anexoSistemaFetcher.registerKey = this.registerKey;
|
|
729
|
-
return anexoSistemaFetcher;
|
|
730
|
-
}
|
|
731
|
-
async initAttach() {
|
|
732
|
-
var _a, _b, _c, _d, _e;
|
|
733
|
-
if (!this.fetcherType && !this.registerKey)
|
|
734
|
-
return;
|
|
735
|
-
if (!this.fetcherType) {
|
|
736
|
-
this.fetcherType = "AnexoSistema";
|
|
737
|
-
}
|
|
738
|
-
this.returnToGridMode();
|
|
739
|
-
if (this.fetcherType === "AnexoSistema") {
|
|
740
|
-
this._currentFetcher = this.getAnexoSistemaFetcherInstance();
|
|
741
|
-
(_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
742
|
-
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData());
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
if (this.fetcherType === "Attach") {
|
|
746
|
-
const hasMoreOneItem = ((_c = this.registerKey) === null || _c === void 0 ? void 0 : _c.split("_").length) > 1;
|
|
747
|
-
if (hasMoreOneItem)
|
|
748
|
-
return;
|
|
749
|
-
}
|
|
750
|
-
await ((_d = this._currentDataUnit) === null || _d === void 0 ? void 0 : _d.loadMetadata());
|
|
751
|
-
await ((_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadData(undefined, undefined, true, this.registerKey));
|
|
752
|
-
}
|
|
753
|
-
/**
|
|
754
|
-
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
755
|
-
* através de um pequeno modulo na estrutura da aplicação:
|
|
756
|
-
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
757
|
-
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-attach.msg.ts"
|
|
758
|
-
*/
|
|
759
|
-
getMessage(key, params) {
|
|
760
|
-
if (this.messagesBuilder)
|
|
761
|
-
return this.messagesBuilder.getMessage(key, params);
|
|
762
|
-
}
|
|
763
|
-
showFinishedToast() {
|
|
764
|
-
this._application.info(this.getMessage('snkAttach.finishedMessage'), { iconName: "check" });
|
|
765
|
-
}
|
|
766
|
-
downloadAttachment(selectedRecord) {
|
|
767
|
-
if (!selectedRecord)
|
|
768
|
-
throw new Error(this.getMessage("snkAttach.alertValidation.noRecordSelected.message"));
|
|
769
|
-
if (selectedRecord.LINK) {
|
|
770
|
-
window.open(`${selectedRecord.LINK}`);
|
|
771
|
-
return;
|
|
772
|
-
}
|
|
773
|
-
this._currentFetcher
|
|
774
|
-
.getDownloadKey(selectedRecord)
|
|
775
|
-
.then(({ chave }) => {
|
|
776
|
-
var _a;
|
|
777
|
-
let forceDownload = false;
|
|
778
|
-
if (!((_a = selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.ARQUIVO) === null || _a === void 0 ? void 0 : _a.endsWith(".pdf"))) {
|
|
779
|
-
forceDownload = true;
|
|
780
|
-
}
|
|
781
|
-
window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}${forceDownload ? "&forcarDownload=S" : ""}`);
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
returnToGridMode() {
|
|
785
|
-
var _a;
|
|
786
|
-
(_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.clearSelection();
|
|
787
|
-
if (this._crudElement)
|
|
788
|
-
this._crudElement.goToView(constants.VIEW_MODE.GRID);
|
|
789
|
-
}
|
|
790
|
-
async loadAttachmentDataUnit() {
|
|
791
|
-
try {
|
|
792
|
-
switch (this.fetcherType) {
|
|
793
|
-
case "AnexoSistema":
|
|
794
|
-
await this.loadAnexoSistema();
|
|
795
|
-
break;
|
|
796
|
-
case "Attach":
|
|
797
|
-
await this.loadAttach();
|
|
798
|
-
break;
|
|
799
|
-
default:
|
|
800
|
-
this._currentFetcher = this.fetcher;
|
|
801
|
-
this._currentDataUnit = this.dataUnit;
|
|
802
|
-
this._currentDataUnitBuilder = this.dataUnitBuilder;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
catch (error) {
|
|
806
|
-
throw new Error('There was an error while creating the data unit');
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
async loadAnexoSistema() {
|
|
810
|
-
var _a, _b;
|
|
811
|
-
this._currentDataUnit = new dataunitFetcher.DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
|
|
812
|
-
this._currentFetcher = this.getAnexoSistemaFetcherInstance();
|
|
813
|
-
let gridValidateForm;
|
|
814
|
-
if (!this._currentDataUnit.metadata) {
|
|
815
|
-
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata());
|
|
816
|
-
this.crudConfig = this.entityName ? { form: anexoSistemaCrudConfig === null || anexoSistemaCrudConfig === void 0 ? void 0 : anexoSistemaCrudConfig.form } : Object.assign({}, anexoSistemaCrudConfig);
|
|
817
|
-
gridValidateForm = { grid: anexoSistemaCrudConfig === null || anexoSistemaCrudConfig === void 0 ? void 0 : anexoSistemaCrudConfig.grid };
|
|
818
|
-
}
|
|
819
|
-
this.initDataUnitLoaders();
|
|
820
|
-
this._currentDataUnit.addFilterProvider({
|
|
821
|
-
getFilter: () => this._currentDataUnitBuilder.getFilters(this.registerKey)
|
|
822
|
-
});
|
|
823
|
-
this._currentDataUnit.addInterceptor({
|
|
824
|
-
interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
|
|
825
|
-
});
|
|
826
|
-
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData());
|
|
827
|
-
this.disableEditFieldsNotInForm(gridValidateForm);
|
|
828
|
-
}
|
|
829
|
-
async loadAttach() {
|
|
830
|
-
var _a, _b;
|
|
831
|
-
this._currentFetcher = new AttachFetcher();
|
|
832
|
-
this._currentDataUnit = new core.DataUnit(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
|
833
|
-
this._currentDataUnit.pageSize = 150;
|
|
834
|
-
let gridValidateForm;
|
|
835
|
-
this.initDataUnitLoaders();
|
|
836
|
-
this._currentDataUnit.addInterceptor({
|
|
837
|
-
interceptAction: (action) => {
|
|
838
|
-
var _a;
|
|
839
|
-
if (action.type === core.Action.METADATA_LOADED) {
|
|
840
|
-
this.crudConfig = this.entityName ? { form: attachCrudConfig === null || attachCrudConfig === void 0 ? void 0 : attachCrudConfig.form } : Object.assign({}, attachCrudConfig);
|
|
841
|
-
gridValidateForm = { grid: attachCrudConfig === null || attachCrudConfig === void 0 ? void 0 : attachCrudConfig.grid };
|
|
842
|
-
(_a = this._crudElement) === null || _a === void 0 ? void 0 : _a.updateConfig();
|
|
843
|
-
}
|
|
844
|
-
return this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement);
|
|
845
|
-
}
|
|
846
|
-
});
|
|
847
|
-
if (!this._currentDataUnit.metadata) {
|
|
848
|
-
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata());
|
|
849
|
-
this.crudConfig = this.entityName ? { form: attachCrudConfig === null || attachCrudConfig === void 0 ? void 0 : attachCrudConfig.form } : Object.assign({}, attachCrudConfig);
|
|
850
|
-
gridValidateForm = { grid: attachCrudConfig === null || attachCrudConfig === void 0 ? void 0 : attachCrudConfig.grid };
|
|
851
|
-
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData(undefined, undefined, true, this.registerKey));
|
|
852
|
-
this.disableEditFieldsNotInForm(gridValidateForm);
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
initDataUnitLoaders() {
|
|
856
|
-
var _a, _b;
|
|
857
|
-
if (this.fetcherType === "AnexoSistema") {
|
|
858
|
-
this._currentFetcher = this.getAnexoSistemaFetcherInstance();
|
|
859
|
-
this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
|
|
860
|
-
(_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
861
|
-
}
|
|
862
|
-
if (this.fetcherType === "Attach") {
|
|
863
|
-
this._currentFetcher = new AttachFetcher();
|
|
864
|
-
this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
|
|
865
|
-
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
|
|
866
|
-
this.returnToGridMode();
|
|
867
|
-
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
disableEditFieldsNotInForm(gridValidateForm) {
|
|
872
|
-
var _a, _b, _c, _d, _e;
|
|
873
|
-
const gridColumns = ((_b = (_a = this._crudElement) === null || _a === void 0 ? void 0 : _a.gridConfig) === null || _b === void 0 ? void 0 : _b.columns) || ((_c = gridValidateForm === null || gridValidateForm === void 0 ? void 0 : gridValidateForm.grid) === null || _c === void 0 ? void 0 : _c.columns) || ((_e = (_d = this.crudConfig) === null || _d === void 0 ? void 0 : _d.grid) === null || _e === void 0 ? void 0 : _e.columns);
|
|
874
|
-
if (!!this.getGridLegacyConfigName()) {
|
|
875
|
-
this._currentDataUnit.disableField(LINKORFILE_COLUMN_NAME);
|
|
876
|
-
}
|
|
877
|
-
gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach(column => {
|
|
878
|
-
var _a, _b;
|
|
879
|
-
const fieldName = column.name;
|
|
880
|
-
if (!((_b = (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.form) === null || _b === void 0 ? void 0 : _b.fields.some(field => (field === null || field === void 0 ? void 0 : field.name) === fieldName))) {
|
|
881
|
-
this._currentDataUnit.disableField(fieldName);
|
|
882
|
-
}
|
|
883
|
-
});
|
|
884
|
-
}
|
|
885
|
-
validateAnexoSistema() {
|
|
886
|
-
var _a;
|
|
887
|
-
if (this._currentFetcher instanceof AnexoSistemaFetcher) {
|
|
888
|
-
try {
|
|
889
|
-
let fields = this._currentDataUnit.getSelectedRecord();
|
|
890
|
-
fields = Object.assign(Object.assign({}, fields), { NOMEARQUIVO: (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0] });
|
|
891
|
-
this._currentFetcher.validateFields(fields);
|
|
892
|
-
}
|
|
893
|
-
catch (error) {
|
|
894
|
-
if (error.message === ISave.SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
|
|
895
|
-
this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
|
|
896
|
-
return false;
|
|
897
|
-
}
|
|
898
|
-
if (error.message === ISave.SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
|
|
899
|
-
this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
|
|
900
|
-
return false;
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
return true;
|
|
905
|
-
}
|
|
906
|
-
async componentWillLoad() {
|
|
907
|
-
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
908
|
-
if (this._application) {
|
|
909
|
-
this._appResourceID = await this._application.getResourceID();
|
|
910
|
-
}
|
|
911
|
-
await this.initAttach();
|
|
912
|
-
}
|
|
913
|
-
// Removido: não inicializa DataUnit no ciclo de vida, apenas na abertura
|
|
914
|
-
async handleOnDataStateChange({ detail }) {
|
|
915
|
-
if (this.fetcherType !== 'Attach')
|
|
916
|
-
return;
|
|
917
|
-
if (!detail.insertionMode) {
|
|
918
|
-
this._currentDataUnit.disableField('DESCRICAO');
|
|
919
|
-
}
|
|
920
|
-
else {
|
|
921
|
-
this._currentDataUnit.enableField('DESCRICAO');
|
|
922
|
-
}
|
|
923
|
-
await this._currentDataUnit.loadMetadata();
|
|
924
|
-
}
|
|
925
|
-
;
|
|
926
|
-
isScreenVariation() {
|
|
927
|
-
var _a;
|
|
928
|
-
return !!((_a = this._appResourceID) === null || _a === void 0 ? void 0 : _a.includes('__'));
|
|
929
|
-
}
|
|
930
|
-
getGridLegacyConfigName() {
|
|
931
|
-
if (this.isScreenVariation()) {
|
|
932
|
-
return undefined;
|
|
933
|
-
}
|
|
934
|
-
if (this.gridLegacyConfigName)
|
|
935
|
-
return this.gridLegacyConfigName;
|
|
936
|
-
return this.entityName ? GRID_LEGACY_CONFIG_NAME + "." + this.entityName : this.entityName;
|
|
937
|
-
}
|
|
938
|
-
render() {
|
|
939
|
-
var _a, _b;
|
|
940
|
-
return (index.h("ez-popup", { ref: (el) => this._refPopup = el, size: 'x-large', ezTitle: this.getMessage("snkAttach.title"), useHeader: false, autoClose: false, onEzClosePopup: () => this.close() }, this._isOpen && this._currentDataUnit && (index.h("main", { class: "snk-attach__main" }, index.h("header", { class: "snk-attach__header" }, index.h("section", null, index.h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.handleBack() }), index.h("div", { class: "snk-attach__file-info" }, index.h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold" }, this.getMessage("snkAttach.title")), index.h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))), index.h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })), index.h("div", { class: "snk-attach__crud-section" }, 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, onDataStateChange: this.handleOnDataStateChange.bind(this), multipleSelection: true, configName: this.isScreenVariation() ? undefined : (this.entityName ? "AnexoSistema_" + this.entityName : undefined), ignoreReadOnlyFormFields: this.entityName ? true : false, gridLegacyConfigName: this.getGridLegacyConfigName(), outlineMode: true }))))));
|
|
941
|
-
}
|
|
942
|
-
static get watchers() { return {
|
|
943
|
-
"registerKey": ["registerKeyWatcher"]
|
|
944
|
-
}; }
|
|
945
|
-
};
|
|
946
|
-
SnkAttach.style = snkAttachCss;
|
|
947
|
-
|
|
948
|
-
exports.snk_attach = SnkAttach;
|