@sankhyalabs/sankhyablocks 8.16.0-dev.4 → 8.16.0-dev.40
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/{ConfigStorage-942ce74b.js → ConfigStorage-ecc0ed20.js} +3 -2
- package/dist/cjs/{IExporterProvider-597949f9.js → ContinuousInsertUtils-c7e35e3b.js} +39 -6
- package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-cadeef8e.js} +21 -15
- package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
- package/dist/cjs/{SnkFormConfigManager-1b13bacd.js → SnkFormConfigManager-f1c92f79.js} +74 -20
- package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-bae64d0d.js} +7 -3
- package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-d68841bc.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-688d3f05.js → dataunit-fetcher-a36ae041.js} +48 -20
- package/dist/cjs/{field-search-f56aa7d6.js → field-search-68e34bf4.js} +5 -1
- package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-ed497282.js} +5 -2
- package/dist/cjs/index-f9e81701.js +8 -28
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-680e198f.js → pesquisa-fetcher-490a86c3.js} +7 -2
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +17 -14
- package/dist/cjs/snk-application.cjs.entry.js +7 -7
- package/dist/cjs/snk-attach.cjs.entry.js +38 -29
- package/dist/cjs/{snk-form-config.cjs.entry.js → snk-config-options_3.cjs.entry.js} +381 -7
- package/dist/cjs/snk-crud.cjs.entry.js +16 -7
- package/dist/cjs/snk-data-exporter.cjs.entry.js +19 -18
- package/dist/cjs/{snk-data-unit-685272e7.js → snk-data-unit-b460f1da.js} +42 -22
- package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
- package/dist/cjs/snk-detail-view.cjs.entry.js +12 -13
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +1411 -0
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid.cjs.entry.js +58 -21
- package/dist/cjs/{snk-guides-viewer-67605336.js → snk-guides-viewer-de0a5c57.js} +27 -14
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
- package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +66 -27
- package/dist/cjs/snk-taskbar.cjs.entry.js +24 -1
- package/dist/collection/collection-manifest.json +11 -31
- package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
- package/dist/collection/components/snk-attach/snk-attach.js +25 -16
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -4
- package/dist/collection/components/snk-crud/snk-crud.js +97 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +3 -4
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +6 -6
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +70 -7
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +4 -4
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +5 -5
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +2 -2
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +4 -4
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +57 -20
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +59 -21
- package/dist/collection/components/snk-form/snk-form.js +2 -2
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +72 -18
- package/dist/collection/components/snk-form-config/snk-form-config.css +8 -3
- package/dist/collection/components/snk-form-config/snk-form-config.js +32 -3
- package/dist/collection/components/snk-grid/snk-grid.css +2 -0
- package/dist/collection/components/snk-grid/snk-grid.js +74 -8
- package/dist/collection/components/snk-print-selector/snk-print-selector.js +1 -1
- package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +0 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +91 -16
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +65 -0
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +3 -3
- package/dist/collection/lib/configs/ConfigStorage.js +1 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -4
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +34 -9
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +22 -16
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +9 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +4 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +6 -1
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -1
- package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
- package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
- package/dist/collection/lib/utils/ContinuousInsertUtils.js +31 -0
- package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
- package/dist/collection/sw.js +46 -0
- package/dist/components/ConfigStorage.js +1 -0
- package/dist/components/{IExporterProvider.js → ContinuousInsertUtils.js} +40 -5
- package/dist/components/DataFetcher.js +22 -16
- package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
- package/dist/components/SnkFormConfigManager.js +72 -18
- package/dist/components/SnkMessageBuilder.js +7 -3
- package/dist/components/dataunit-fetcher.js +47 -17
- package/dist/components/form-config-fetcher.js +4 -1
- package/dist/components/pesquisa-fetcher.js +6 -1
- package/dist/components/snk-actions-button2.js +12 -9
- package/dist/components/snk-attach2.js +34 -25
- package/dist/components/snk-crud.js +15 -2
- package/dist/components/snk-data-exporter2.js +12 -11
- package/dist/components/snk-data-unit2.js +44 -60
- package/dist/components/snk-detail-view2.js +28 -13
- package/dist/components/snk-exporter-email-sender2.js +1 -1
- package/dist/components/snk-filter-bar2.js +35 -22
- package/dist/components/snk-filter-binary-select.js +1 -1
- package/dist/components/snk-filter-checkbox-list.js +1 -1
- package/dist/components/snk-form-config2.js +17 -4
- package/dist/components/snk-form.js +2 -2
- package/dist/components/snk-grid2.js +51 -12
- package/dist/components/snk-personalized-filter-editor.js +1 -1
- package/dist/components/snk-print-selector.js +1 -1
- package/dist/components/snk-simple-bar2.js +1 -1
- package/dist/components/snk-simple-crud2.js +59 -16
- package/dist/components/snk-taskbar2.js +25 -2
- package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-7b36d041.js} +3 -2
- package/dist/esm/{IExporterProvider-63a188b6.js → ContinuousInsertUtils-3e520a07.js} +40 -8
- package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-a9c598f2.js} +22 -16
- package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
- package/dist/esm/{SnkFormConfigManager-d4554df9.js → SnkFormConfigManager-f1a0fc92.js} +74 -20
- package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-6fff4a4c.js} +7 -3
- package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-749d880f.js} +1 -1
- package/dist/esm/{constants-8457af36.js → constants-7302ee87.js} +1 -1
- package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-fd58c640.js} +48 -18
- package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
- package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-adbe5d34.js} +5 -2
- package/dist/esm/index-a7d3d3f1.js +8 -28
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-50fc7e6b.js} +7 -2
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +18 -15
- package/dist/esm/snk-application.entry.js +7 -7
- package/dist/esm/snk-attach.entry.js +39 -30
- package/dist/esm/{snk-form-config.entry.js → snk-config-options_3.entry.js} +382 -10
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +17 -8
- package/dist/esm/snk-data-exporter.entry.js +20 -19
- package/dist/esm/{snk-data-unit-63f83504.js → snk-data-unit-590225b5.js} +42 -22
- package/dist/esm/snk-data-unit.entry.js +5 -5
- package/dist/esm/snk-detail-view.entry.js +13 -14
- package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
- package/dist/esm/snk-field-config.entry.js +1 -1
- package/dist/esm/snk-filter-bar_4.entry.js +1404 -0
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-grid.entry.js +53 -16
- package/dist/esm/{snk-guides-viewer-151f6091.js → snk-guides-viewer-2f4dcdc5.js} +28 -15
- package/dist/esm/snk-guides-viewer.entry.js +9 -9
- package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-print-selector.entry.js +1 -1
- package/dist/esm/snk-simple-bar.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +63 -24
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +24 -1
- package/dist/sankhyablocks/p-052213ba.entry.js +1 -0
- package/dist/sankhyablocks/{p-df5451c7.js → p-06421fdb.js} +2 -2
- package/dist/sankhyablocks/p-0b6cd238.entry.js +1 -0
- package/dist/sankhyablocks/p-0e320bd2.entry.js +1 -0
- package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
- package/dist/sankhyablocks/p-17425c72.js +1 -0
- package/dist/sankhyablocks/{p-a1d72395.entry.js → p-212213d9.entry.js} +1 -1
- package/dist/sankhyablocks/p-23736d75.js +1 -0
- package/dist/sankhyablocks/p-275de842.entry.js +1 -0
- package/dist/sankhyablocks/p-2aae03a1.entry.js +1 -0
- package/dist/sankhyablocks/{p-8eb67fa4.entry.js → p-2d3f9482.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7663f597.entry.js → p-41793e17.entry.js} +1 -1
- package/dist/sankhyablocks/{p-72fc257b.entry.js → p-434817f0.entry.js} +1 -1
- package/dist/sankhyablocks/p-47bce500.js +60 -0
- package/dist/sankhyablocks/{p-aff76a53.js → p-4d9549cf.js} +2 -2
- package/dist/sankhyablocks/p-583517ba.entry.js +1 -0
- package/dist/sankhyablocks/p-5b51491f.entry.js +1 -0
- package/dist/sankhyablocks/p-5e51e833.entry.js +1 -0
- package/dist/sankhyablocks/{p-aaa3ee68.entry.js → p-5f157b09.entry.js} +1 -1
- package/dist/sankhyablocks/p-656f0e51.entry.js +1 -0
- package/dist/sankhyablocks/p-72c10005.entry.js +1 -0
- package/dist/sankhyablocks/p-7bd9683d.js +1 -0
- package/dist/sankhyablocks/p-7dd49d15.js +1 -0
- package/dist/sankhyablocks/{p-af8efd95.js → p-8a9638ae.js} +2 -2
- package/dist/sankhyablocks/{p-95df461f.entry.js → p-8b4fc28f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-41f8bfa3.entry.js → p-8c235d4c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b0ef4383.js → p-95ce311a.js} +1 -1
- package/dist/sankhyablocks/p-9f9b99d9.js +1 -0
- package/dist/sankhyablocks/p-ab1645fb.entry.js +1 -0
- package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
- package/dist/sankhyablocks/{p-913a9979.js → p-ca5ec380.js} +1 -1
- package/dist/sankhyablocks/p-cefb0ee1.entry.js +1 -0
- package/dist/sankhyablocks/{p-82a0bfb0.entry.js → p-dbe6174a.entry.js} +2 -2
- package/dist/sankhyablocks/p-f3434fc4.js +1 -0
- package/dist/sankhyablocks/p-fa6c5826.entry.js +1 -0
- package/dist/sankhyablocks/p-fadc8339.js +1 -0
- package/dist/sankhyablocks/{p-eae7a817.entry.js → p-fb34e0cf.entry.js} +1 -1
- package/dist/sankhyablocks/p-fd13b4d2.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
- package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +17 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +15 -0
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +3 -3
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +7 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +5 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +9 -4
- package/dist/types/components/snk-form-config/snk-form-config.d.ts +4 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +11 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +13 -0
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
- package/dist/types/components.d.ts +113 -0
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +12 -2
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +1 -1
- package/dist/types/lib/utils/ContinuousInsertUtils.d.ts +10 -0
- package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
- package/package.json +4 -3
- package/dist/cjs/snk-config-options.cjs.entry.js +0 -239
- package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -714
- package/dist/cjs/snk-filter-item.cjs.entry.js +0 -312
- package/dist/cjs/snk-filter-list.cjs.entry.js +0 -152
- package/dist/cjs/snk-filter-modal.cjs.entry.js +0 -249
- package/dist/cjs/snk-form.cjs.entry.js +0 -143
- package/dist/esm/snk-config-options.entry.js +0 -235
- package/dist/esm/snk-filter-bar.entry.js +0 -710
- package/dist/esm/snk-filter-item.entry.js +0 -308
- package/dist/esm/snk-filter-list.entry.js +0 -148
- package/dist/esm/snk-filter-modal.entry.js +0 -245
- package/dist/esm/snk-form.entry.js +0 -139
- package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
- package/dist/sankhyablocks/p-14b9f964.entry.js +0 -1
- package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
- package/dist/sankhyablocks/p-3a212712.js +0 -1
- package/dist/sankhyablocks/p-3a216b81.entry.js +0 -1
- package/dist/sankhyablocks/p-3b60db06.entry.js +0 -1
- package/dist/sankhyablocks/p-47b60deb.entry.js +0 -1
- package/dist/sankhyablocks/p-70a4af56.entry.js +0 -1
- package/dist/sankhyablocks/p-7505da04.entry.js +0 -1
- package/dist/sankhyablocks/p-75f83d1d.entry.js +0 -1
- package/dist/sankhyablocks/p-7a337364.js +0 -1
- package/dist/sankhyablocks/p-829d4045.js +0 -1
- package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
- package/dist/sankhyablocks/p-8fc470e5.entry.js +0 -1
- package/dist/sankhyablocks/p-941bf3ef.entry.js +0 -1
- package/dist/sankhyablocks/p-9863d682.js +0 -1
- package/dist/sankhyablocks/p-b11aa1e0.entry.js +0 -1
- package/dist/sankhyablocks/p-b4b21558.entry.js +0 -1
- package/dist/sankhyablocks/p-bad55caa.entry.js +0 -1
- package/dist/sankhyablocks/p-c053256c.entry.js +0 -1
- package/dist/sankhyablocks/p-c2495304.js +0 -1
- package/dist/sankhyablocks/p-c5268346.entry.js +0 -1
- package/dist/sankhyablocks/p-cefba299.js +0 -1
- package/dist/sankhyablocks/p-d3f53df2.entry.js +0 -1
- package/dist/sankhyablocks/p-dc7c9047.js +0 -1
- package/dist/sankhyablocks/p-e8763234.entry.js +0 -1
- package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
- package/dist/sankhyablocks/p-fcac4dfc.js +0 -1
- package/dist/sankhyablocks/p-fe79f83a.js +0 -60
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -0,0 +1 @@
|
|
1
|
+
import{ApplicationContext as e}from"@sankhyalabs/core";const a={saveInfo:{clone:"Duplicação realizada!",insert:"Inclusão realizada!",update:"Alteração realizada!"},cancelInfo:{clone:"Duplicação descartada!",insert:"A inclusão foi descartada!",update:"A edição foi descartada!"},confirm:{cancel:"Cancelar",delete:"Excluir",yes:"Sim",no:"Não"},removeInfo:"Registro removido com sucesso!",cancelConfirmationTitle:"Aviso",cancelConfirmation:"As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de cancelar?",removeConfirmationTitle:"Aviso",removeConfirmation:"Deseja realmente excluir o registro atual?",forbidden:"Sem permissão",forbiddenUpdate:"Não é possível fazer alterações. Verifique as permissões de acesso.",forbiddenInsert:"Não é possível incluir. Verifique as permissões de acesso.",forbiddenClone:"Não é possível duplicar. Verifique as permissões de acesso.",forbiddenRemove:"Não é possível remover. Verifique as permissões de acesso.",removeAllConfirmation:"Os <strong>{{size}} registros selecionados</strong> serão excluídos.<br/><br/><strong>Você realmente gostaria de continuar?</strong>",removeAllInfo:"Os {{size}} registros foram removidos com sucesso!",fieldNameRequired:"É necessário informar o nome da coluna."},o={addFilter:"Adicionar filtro",pinFilter:"Fixar filtro",unpinFilter:"Desfixar filtro",removeFilter:"Remover filtro",cleanFilter:"Limpar",applyFilter:"Aplicar",findFilter:"Buscar filtros...",findField:"Buscar filtros...",modalFindFilter:"Buscar filtro",emptyFiltersList:"Não há filtros disponíveis",emptyAppliedFiltersList:"Não há filtros aplicados",customFilter:"Filtro personalizado",defaultFilter:"Filtro padrão",failToLoadConfig:"Falha ao buscar configuração de filtros",clearAllFilters:"Limpar todos os filtros",successfullyCleaned:"Filtro limpo com sucesso!",activeFilter:"{{ACTIVE_FILTERS}} filtro aplicado",activeFilters:"{{ACTIVE_FILTERS}} filtros aplicados",noActiveFilters:"Nenhum filtro aplicado",modalDefaultFilterTitle:"Filtro padrão",modalInfoTextEditDefault:"Use o layout antigo para editar o seu filtro padrão, em breve traremos uma nova experiência.",modalInfoTextCreateDefault:"Use o layout antigo para criar o seu filtro padrão, em breve traremos uma nova experiência.",modalPersonalizedFilterTitle:"Filtro personalizado",modalPersonalizedFilterSubTitle:"Gerencie seus filtros",modalInfoTextCreateEditPersonalized:"Use o layout antigo para criar ou editar filtros, em breve traremos uma nova experiência",modalInfoTextCreateFilter:"Criar filtro personalizado",modalInfoTextNoFilterRegister:"Você não possui filtros cadastrados.",modalOkButtonLabel:"Aplicar",modalCancelButtonLabel:"Limpar",binarySelectTooltip:"Exibindo registros",multiListToltip:"selecionado(a)s",onlyStartToltip:"A partir de",onlyEndToltip:"Até",fullPeriodTooltip:"Data de {{LABEL}}: {{START_LABEL}} até {{END_LABEL}}",labelStart:"Inicial",labelEnd:"Final",fullIntervalTooltip:"{{LABEL}}: {{START_LABEL}} até {{END_LABEL}}",filters:"Filtros",personalizedCount:"{{activeCount}} selecionado(s)",filterModal:{title:"Filtros",okButtonLabel:"Aplicar",cancelButtonLabel:"Limpar tudo",customFilters:"Filtros personalizados",quickFilters:"Filtros rápidos",validations:{notFullFilled:{title:"Filtro parcialmente preenchido",message:"Favor completar todas as informações do filtro."},notSaved:{title:"Atenção",message:"As alterações realizadas não serão aplicadas.<br/><br/><b>Deseja mesmo continuar?</b>"}}}},r={titleUpdate:"Editar",titlePrevious:"Anterior",titleNext:"Próximo",titleRefresh:"Atualizar",titleClone:"Duplicar",titleRemove:"Excluir",titleMoreOptions:"Mais Opções",titleInsert:"Cadastrar",titleCancel:"Cancelar",titleSave:"Salvar",titleGridMode:"Modo Grade",titleFormMode:"Modo Formulário",titleConfigurator:"Configurações",titleAttach:"Anexar",forbidden:"Permissão não liberada"},i={errorArray:"CrudUtils.find deve receber um array de fields, ou uma lista separada por virgula."},s={emailSenderTitle:"Enviar por email",emailSenderBackButton:"Voltar",emailSenderNextButton:"Avançar",emailSenderCancelButton:"Cancelar",emailSenderSendButton:"Enviar",emailSenderOptStep_subtitle:"Primeiro, escolha o formato do arquivo",emailSenderOptStep_lblFormat:"Formato:",emailSenderOptStep_formatPDF:"PDF (.pdf)",emailSenderOptStep_formatXLS:"Planilha (.xls)",emailSenderOptStep_export:"Exportar:",emailSenderOptStep_allData:"Toda a grade",emailSenderOptStep_currentPage:"Somente a página atual",emailSenderOptStep_someRecords:"{{SELECTION_COUNT}} linhas selecionadas",emailSenderOptStep_oneRecord:"Somente a linha selecionada",emailSenderInfoStep_subtitle:"Informações de email",emailSenderInfoStep_sendTo:"Enviar para",emailSenderInfoStep_subject:"Assunto",emailSenderInfoStep_message:"Mensagem"},t={title:{clone:"Duplicar registro",insert:"Cadastrar registro",update:"Alterar registro",clean:"{{ENTITY_NAME}}"},findColumn:"Buscar campos",goBackTitle:"Voltar"},l={findColumn:"Busca de colunas",formConfigUnavaliable:{title:"Aviso",message:'A opção "Configurar formulário" será disponibilizada em breve. Enquanto isso, acesse a configuração do fomulário através dos layouts anteriores, HTML5 ou Flex.'}},n={error:{title:"Erro na Exportação",message:"O usuário não possui permissão para exportar o arquivo."},message:{exportSuccess:"Exportado com sucesso!"}},d={newVersionPopup:{title:"Boas vindas à nova interface da tela {{screenName}}",info:"Com uma jornada mais moderna, simples e intuitiva, a performance aprimorada da nova interface impulsionará a sua produtividade.",okButton:"Quero experimentar!",cancelButton:"Voltar à interface anterior"}},c={label:{nameField:"Nome do Campo *",typeValueDefault:"Tipo de valor padrão *",valueDefault:"Valor Padrão",clearDuplicate:"Limpar ao Duplicar",requiredField:"Campo Obrigatório",protectedField:"Campo Protegido"},options:{valueFixed:"Valor Fixo",variable:"Variável"}},m={title:"Configuração do formulário",goBackTitle:"Voltar",applyConfig:"Aplicar configuração",availableFields:{title:"Campos disponíveis",labelNoFields:"Nenhum campo disponível",labelOneField:"1 campo disponível",labelAvailableFields:"Campos disponíveis",labelSearchField:"Procurar campo"},form:{subTitleInfo:"Inclua estes campos nos grupos ou deixe-os separados no topo do formulário!",labelDropField:"Arraste e solte um campo aqui",labelNewGroup:"Adicionar novo grupo",mainArea:"Área principal",tabGeneral:"Geral"},confirm:{title:"Aviso",deleteTab:"Você realmente deseja excluir a aba",cancel:"As alterações realizadas serão descartadas.<br/><br/><b>Gostaria de continuar?</b>",exit:"Ao sair as alterações serão descartadas.<br/><br/><b>Você realmente gostaria de sair?</b>",apply:"A <b>{0}</b> irá substituir a sua configuração {1}!<br/><br/><b>Deseja continuar?</b>",group:"Não é possível salvar as configurações com um grupo vazio!",labelCancel:"Cancelar",labelDelete:"Excluir"},alert:{titleGroupExists:"Já existe um grupo com título",infoValidTitle:"Por favor, digite um título válido.",inTab:"na aba"},info:{successfullyConfigSaved:"As configurações foram salvas com sucesso!"}},u={titleRemove:"Remover",titleConfigurations:"Configurações",titleAdd:"Adicionar"},p={labelRename:"Renomear",labelHide:"Ocultar",labelShow:"Exibir",labelDelete:"Excluir"},f={titleConfigurations:"Configurações",subTitleModeConfig:"Modo de visualização",labelConfigGrid:"Configurar grade",labelConfigForm:"Configurar formulário",labelGrid:"Grade",labelForm:"Formulário"},b={findColumn:"Busca de colunas",cancelConfirmation:{title:"Aviso",message:"As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de cancelar?</b>"}},v={gridConfiguration:"Configuração da Grade",columnVisibilityOrder:"Defina visibilidade e ordem das colunas.",sortingSequence:"Sequência da ordenação",findColumn:"Localizar coluna",cancel:"Cancelar",complete:"Concluir",tab:{columns:"Colunas",lineOrdering:"Ordenação das linhas"},info:{successfullyConfigSaved:"As configurações foram salvas com sucesso!"},confirm:{cancel:"Descartar",save:"Salvar",alert:"Aviso",msgCancel:"As alterações realizadas serão descartadas. Gostaria de salvar antes de sair?"},group:{visible:"Visíveis",hidden:"Ocultas"}},g={group:{export:{default:"Exportar para",multiSelected:"Exportar {0} linhas selecionadas",selectedLine:"Exportar somente 1 linha selecionada",title:"Exportar"},custom:"Personalizado"},label:{currentPage:"Somente a página atual",allRecords:"Todos os registros",spreadsheet:"Planilha",cube:"Cubo",sendByEmail:"Enviar por email"},message:{emailSuccess:"E-mail enviado com sucesso",exportError:"Falha ao exportar dados",unknownFailure:"O motivo da falha não pode ser identificado.",exportPermission:"O usuário não possui permissão para exportar o arquivo."},title:{error:"Erro",permission:"Falha detectada"},limitExceeded:{title:"Atenção",description:"Apenas os {{limit}} primeiros registros serão exportados. Deseja continuar?",subdescription:"Caso seja necessária uma quantidade maior de registros exportados, utilize o Extrator de Dados através de um Relatório Personalizado.",cancel:"Cancelar",continue:"Continuar"}},A={modalTitle:"Configuração de valor variável",labelSystemConfig:"Usar definições do sistema",labelUserConfig:"Usar definições personalizadas",labelInstance:"Categoria",labelField:"Campo",labelDescription:"Descrição (obrigatório) *",labelType:"Tipo (obrigatório) *",labelTypeValues:{date:"Data",text:"Texto",integer:"Número Inteiro",decimal:"Número com Decimal"},labelExpression:"Expressão",labelCancel:"Cancelar",labelSave:"Salvar"},C={searchLabel:"Buscar campo",fieldLabel:"Campos de {{link}}",linkLabel:"Categorias de {{link}}",groupEmpty:"Não há categorias para seleção",searchEmpty:"Nenhum resultado encontrado"},F={backTitle:"Voltar"},S={title:"Anexar arquivos",description:"Faça o upload dos arquivos ou informe links que deseja anexar ao título",attachHint:"Fazer download do arquivo",breadcrumbTitle:"Anexar",finishedMessage:"O anexo foi finalizado com sucesso",finish:"Finalizar",cancelConfirmation:{title:"Atenção",message:"As alterações realizadas não serão aplicadas.<br/><br/><b>Deseja mesmo continuar?</b>"},alertValidation:{fileAndLinkAtTheSameTime:{title:"Atenção",message:"Não é permitido inserir o arquivo e o link ao mesmo tempo."},anyLinkOrFileFilled:{title:"Atenção",message:'É necessário preencher o campo "Link" ou anexar um arquivo.'},descriptionCannotBeChanged:{title:"Atenção",message:"O campo 'Descrição' não pode ser alterado."}},taskbar:{titleDownload:"Fazer download",titleLink:"Abrir link"},attachMetadata:{lblCode:"Código",lblDescription:"Descrição",lblFileOrLink:"Arquivo / Link",lblUser:"Usuário",lblDate:"Data de alteração",lblFile:"Arquivo",lblSubTitle:"Clique para selecionar um arquivo"}},x={info:{titleEdit:"Editar filtro personalizado",titleAdd:"Criar filtro personalizado",titleCollapsible:"Expressão a ser aplicada (gerada pelo assistente)",labelSearchField:"Buscar campo",labelOperator:"Operador",labelValueVarible:"Valor variável",titleTooltip:"Ao ativar um valor variável, é possível inserir um valor diferente sempre que o filtro for aplicado",labelAddNewExpression:"Adicionar nova linha de expressão",labelDeleteExpression:"Remover expressão",labelDeleteItem:"Remover item",labelDisabledAddGroupButton:"Filtros Personalizados possuem um limite de {{LIMIT_GROUP_LEVEL}} Grupos de Condições e Valores",labelDisabledAddExpressionButton:"Preencha campos obrigatórios ou indique valores variáveis nas expressões do grupo antes de adicionar mais itens",labelCancel:"Cancelar",labelSave:"Salvar",labelNameFilter:"Nome do filtro",labelExpression:"Expressão",badgeVariable:"variável",noDataFound:"Nenhum filtro encontrado",condition:"Condição",addGroup:"Adicionar grupo",addField:"Adicionar campo",applyExpression:"Expressão a ser aplicada:",tooltipDisabledAssistentMode:"Expressão não suportada pelo assistente.",activeModeAdvanced:"Ativar modo avançado",activeModeAssistent:"Ativar modo assistente"},confirmExpression:{title:"Aviso",description:"As informações da condição serão descartadas.</br></br><b>Gostaria de continuar?</b>"},confirmGroup:{title:"Aviso",description:"As informações do Grupo e suas Condições serão descartadas.</br></br><b>Gostaria de continuar?</b>"},confirmCancel:{title:"Aviso",description:"As alterações realizadas serão descartadas.</br></br><b>Gostaria de continuar?</b>"},confirmChangeModeAssistent:{title:"Aviso",description:"Ao modificar a expressão, o modo assistente será desabilitado.</br></br><b>Gostaria de continuar?</b>"},confirmChangeModeAdvanced:{title:"Aviso",description:"Ao retornar ao modo assistente suas alterações serão perdidas.</br></br><b>Gostaria de continuar?</b>"},confirmSaveModeAdvanced:{title:"Aviso",description:"Ao modificar a expressão, o modo assistente será desabilitado.</br></br><b>Gostaria de continuar?</b>"},operador:{firstLevel:"A seleção será habilitada a partir da adição da segunda linha de regras.",and:"Será verdadeiro se todas as condições forem obedecidas.",or:"Será verdadeiro se qualquer uma das condições for obedecida."},error:{title:"Atenção",description:"Há pelo menos um campo obrigatório não preenchido."},errorValidation:{title:"Erro na expressão"},confirmSave:{title:"Filtro criado com sucesso!"},confirmEdit:{title:"Filtro atualizado com sucesso!"},deleteConfirm:{title:"Aviso",message:"Deseja realmente excluir o filtro '{{filterName}}'?"},listActions:{edit:"Editar",delete:"Excluir"},footerActions:{clear:"Limpar",create:"Criar filtro"}},h={selected:"Selecionados:"},E={title:{actions:"Ações",error:"Erro",warning:"Aviso"},action:{incorrectAction:'A ação "{{description}}" não pode ser executada porque ela não foi salva corretamente.',emptyParamName:"<b>Regra Personalizada:</b><br/><br/>É necessário informar o atributo 'paramName'",nonExistentType:"Tipo de ação não implementada: {{this.actionType}}"},launchScreen:{emptyField:'A ação "{{description}}" não pôde ser executada porque o campo "{{localFieldLabel}}" está vazio.'},form:{fillParams:"Informe os parâmetros"},clientEvent:{cancelMessage:"Caso queira cancelar, feche esta mensagem."},buttons:{apply:"Aplicar",cancel:"Cancelar",yes:"Sim",no:"Não"}},T={title:{warning:"Aviso",printerSelection:"Seleção de impressora",remotePrintersTab:"Impressoras remotas",localPrintersTab:"Impressoras locais"},subtitle:{document:"Documento:",jobs:"Trabalhos:"},message:{canceledPrint:"A impressão será cancelada. Deseja mesmo continuar?",noPrinters:"Não há impressoras para seleção",savePrinter:"Usar sempre esta seleção"},button:{print:"Imprimir",cancel:"Cancelar",yes:"Sim",no:"Não"}};class D{constructor(D){this._defaults={snkApplication:d,snkDataUnit:a,snkFormConfig:m,snkConfigOptions:c,snkTaskbar:r,snkFieldConfig:u,snkFilterBar:o,snkConfigurator:f,snkTabConfig:p,crudUtils:i,snkGrid:b,snkGridConfig:v,snkExporter:s,snkDataExporter:g,snkCrud:t,snkSimpleCrud:l,fileViewer:n,snkFilterParamConfig:A,snkFilterFieldSearch:C,snkSimpleBar:F,snkAttach:S,snkPersonalizedFilter:x,snkEntityList:h,snkActionsButton:E,snkPrintSelector:T},this._currentOperation=L.CLEAN,this._domainName=D,this._application=e.getContextValue("__SNK__APPLICATION__"),this.loadAppMessages().then((e=>{this._appMessages=e}),(e=>{console.info("O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages",e)}))}set currentOperation(e){this._currentOperation=e}getMessage(e,a){if(null==e)return;var o=e.split(".");let r=this.resolveMessage(o,this.getDomainMessages());if(null==r&&(r=this.resolveMessage(o,this._defaults)),this.customMessageBuilder){const o=this.customMessageBuilder(e,r,a);r=o.message,a=o.params}return this.postProcess(r,a)}getDomainMessages(){if(this._appMessages)return this._domainName?this._appMessages[this._domainName]:this._appMessages.Global||this._appMessages}resolveMessage(e,a){if(null==a)return;const o=a[e[0]];return o?this.isOperationSensitive(o)?o[this._currentOperation]:1===e.length||null==o||"string"==typeof o?o:this.resolveMessage(e.slice(1),o):void 0}isOperationSensitive(e){return null!=e[L.CLONE]||null!=e[L.INSERT]||null!=e[L.UPDATE]||null!=e[L.CLEAN]}postProcess(e,a){if(e){const o=/(.*?)\{\{(.+?)\}\}/g;let r,i="",s=e;for(;null!==(r=o.exec(e));){const[o,t,l]=r,n=r.index+o.length;s=n<e.length?e.substring(n):"";let d=a?a[l]:void 0;null==d&&(d=""),i+=t+d}return i+s}return e}async loadAppMessages(){const e=await this._application.getApplicationPath();return(await import(`${e}/messages/appmessages.js`)).default}}var L;!function(e){e.CLONE="clone",e.INSERT="insert",e.UPDATE="update",e.CLEAN="clean"}(L||(L={}));export{L as O,D as S}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,c as i,h as e,H as s,g as r}from"./p-d2d301a6.js";import{ElementIDUtils as o,ObjectUtils as l}from"@sankhyalabs/core";import{F as a}from"./p-ff1990ad.js";import{E as n}from"./p-1a68fb59.js";import{C as d}from"./p-
|
1
|
+
import{r as t,c as i,h as e,H as s,g as r}from"./p-d2d301a6.js";import{ElementIDUtils as o,ObjectUtils as l}from"@sankhyalabs/core";import{F as a}from"./p-ff1990ad.js";import{E as n}from"./p-1a68fb59.js";import{C as d}from"./p-4d9549cf.js";import{F as h}from"./p-d9804798.js";import"./p-06421fdb.js";import"./p-f3434fc4.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";const c=class{constructor(e){t(this,e),this.filterChange=i(this,"filterChange",7),this.editPersonalizedFilter=i(this,"editPersonalizedFilter",7),this.addPersonalizedFilter=i(this,"addPersonalizedFilter",7),this.filterItem=void 0,this.configName=void 0,this.resourceID=void 0}observeFilterItem(t){var i,e;this._editor&&(this._editor.config=t),null===(e=null===(i=this._editor)||void 0===i?void 0:i.reloadList)||void 0===e||e.call(i),this.filterChange.emit(t)}getContentEditorConfig(){const t={presentationMode:n.MODAL};switch(this.filterItem.type){case a.BINARY_SELECT:return{tag:"snk-filter-binary-select",props:t};case a.MULTI_SELECT:return{tag:"snk-filter-multi-select"};case a.PERIOD:return{tag:"snk-filter-period",props:t};case a.SEARCH:return{tag:"snk-filter-search"};case a.NUMBER:return{tag:"snk-filter-number",props:t};case a.PERSONALIZED:return this.buildSnkFilterPersonalizedProps();case a.CHECK_BOX_LIST:return{tag:"snk-filter-checkbox-list",props:t};case a.MULTI_LIST:return{tag:"snk-entity-list",props:{maxHeightList:"640px",rightListSlotBuilder:t=>this.buildRightSlot(t)}}}return{tag:"snk-filter-text"}}buildSnkFilterPersonalizedProps(){return{tag:"snk-personalized-filter-editor",props:{onEditFilter:t=>this.editPersonalizedFilter.emit(t.detail),onAddFilter:()=>this.addPersonalizedFilter.emit()}}}isVisible(t){return!!this.filterItem.visible||void 0!==t}updateFilterValue(t){const i=void 0!==(null==t?void 0:t.value)?t.value:t;this.filterItem=Object.assign(Object.assign({},this.filterItem),null!=this.filterItem.groupedItems?{visible:i>0,value:i,groupedItems:t.items}:{value:this.filterItem.type===(a.SEARCH||a.CHECK_BOX_LIST)?t:i,visible:this.isVisible(i)})}handleDeleteFilter(t,i){i===a.PERSONALIZED&&d.removePersonalizedFilter(t,this.resourceID,this.configName)}componentDidLoad(){if(this._element){o.addIDInfo(this._element);const t=this._element.getAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idContentEditor=`${t}_${this.filterItem.id}`}}buildRightSlot(t){return e("ez-icon",{iconName:"delete",onClick:()=>this.removeValueFromConfig(t)})}removeValueFromConfig(t){var i,e,s;const r=null===(e=null===(i=this.filterItem)||void 0===i?void 0:i.value)||void 0===e?void 0:e.findIndex((({id:i})=>i===t.id)),o=l.copy(this.filterItem);null===(s=null==o?void 0:o.value)||void 0===s||s.splice(r,1),this.updateFilterValue(o.value)}canShowDetailModal(){const{CUSTOM_FILTER:t,OTHER_FILTERS:i}=h;return![t,i].includes(this.filterItem.filterType)&&this.filterItem.type!==a.BINARY_SELECT}render(){const{tag:t,props:i}=this.getContentEditorConfig();return e(s,null,e("div",{class:"ez-flex ez-flex--column grow"},this.canShowDetailModal()&&e("div",{class:"col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center"},e("div",{class:"ez-title ez-title--small ez-title--primary grow"},this.filterItem.detailModal)),e(t,Object.assign({ref:t=>this._editor=t,config:this.filterItem,value:this.filterItem.value,onValueChanged:t=>this.updateFilterValue(t.detail),"data-element-id":this._idContentEditor},i))))}get _element(){return r(this)}static get watchers(){return{filterItem:["observeFilterItem"]}}};c.style=".grow{flex-grow:1}.gap{gap:4px}";export{c as snk_filter_modal_item}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{h as t}from"./p-d2d301a6.js";class s{constructor(t){this._defaultButtons=t}process(t,s,n,e=[],o=[]){var a;this.customButtons=new Map,this.buttons="",this.disabledButtons=[].concat(e),null===(a=this.getButtonsArray(t,s,n))||void 0===a||a.forEach((a=>{let i;if("string"==typeof a)i=a;else{const t=a;this.customButtons.set(t.name,t),i=t.name}o.includes(i)||(this.isEnabled(t,s,i,n,e)||this.disabledButtons.push(i),this.buttons.length>0&&(this.buttons+=","),this.buttons+=i)}))}getButtonsArray(t,s,n){const e=this.getButtonsFromKey(t);return s?s.getButtons(t,n,[...e]):e}getButtonsFromKey(t){const s=this._defaultButtons[t];return"function"==typeof s?s():s}isEnabled(t,s,n,e,o){const a=!o.includes(n);return s&&s.isEnabled?s.isEnabled(t,e,n,a):a}}const n="taskbarActionsOpened",e=(s,n,e)=>t("ez-search",{class:"ez-actions-button--bottom-padding",canShowError:"false",showSelectedValue:"false",showOptionValue:"false",suppressEmptyOption:"true",label:s.label,value:"",optionLoader:n,onEzChange:t=>e(t.detail),ignoreLimitCharsToSearch:!0});async function o(t){requestAnimationFrame((async()=>{if(t){const s=t.t;if(!s)return;s.value=null,await s.setFocus()}}))}const a=async(t,s)=>{if(!t)return;if(await t.isOpened())return void await o(s);const e=()=>{o(s),t.removeEventListener(n,e)};t.addEventListener(n,e),await t.showActions()};export{s as T,e as b,a as o}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as t,h as i,H as s,g as e,c as n}from"./p-d2d301a6.js";import{ApplicationContext as o,StringUtils as r,ErrorException as a,WarningException as l,ObjectUtils as c,DateUtils as d,ArrayUtils as h,ElementIDUtils as u}from"@sankhyalabs/core";import{D as g}from"./p-f3434fc4.js";import{P as f}from"./p-eaad0aa8.js";import"./p-8a9638ae.js";import"./p-30cf616e.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-47bce500.js";import"./p-ff1990ad.js";import"./p-06421fdb.js";import{g as m}from"./p-7dd49d15.js";import{R as p}from"./p-688dcb4c.js";import{ApplicationUtils as v,DialogType as b}from"@sankhyalabs/ezui/dist/collection/utils";import{CheckMode as k}from"@sankhyalabs/ezui/dist/collection/components/ez-check/CheckMode";import{C as _}from"./p-4d9549cf.js";import{O as w}from"./p-95ce311a.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";class y{execute(t){var i;const s={actionID:t.actionID,refreshType:null===(i=t.actionConfig.javaCall)||void 0===i?void 0:i.refreshType};return new Promise((t=>{t({execSource:s,callback:this.callExecJava})}))}async callExecJava(t){const i={requestBody:{javaCall:t}};await g.get().callServiceBroker("ActionButtonsSP.executeJava",JSON.stringify(i))}}class C{execute(t){var i;const s={actionID:t.actionID,refreshType:null===(i=t.actionConfig.runScript)||void 0===i?void 0:i.refreshType};return new Promise((t=>{t({execSource:s,callback:this.callExecScript})}))}async callExecScript(t){const i={runScript:t};await g.get().callServiceBroker("ActionButtonsSP.executeScript",i)}}class x{constructor(){this._application=o.getContextValue("__SNK__APPLICATION__")}async execute(t,i){const s=t.resourceID;if(!s)return;let e=await this.buildLaunchObject(t,i);return this._application.openApp(s,e),null}buildLaunchObject(t,i){return new Promise((s=>{let e=t.actionConfig.params.param;if(e&&e.length>0){let n={},o=[];e.forEach((s=>{const e=s.localField;let l=i.getFieldValue(e);if(!l){let s=i.getField(e).label;throw s=r.isEmpty(i.getField(e).label)?e:s,new a(this._application.messagesBuilder.getMessage("snkActionsButton.title.error",void 0),this._application.messagesBuilder.getMessage("snkActionsButton.launchScreen.emptyField",{description:t.description,localFieldLabel:s}))}l=r.isEmpty(l.toString())?void 0:l.toString(),n[s.targetField]=l,o.push({fieldName:s.targetField,value:l})})),n.ACTION_PARAMETERS=o,n.call_time=Date.now(),s(n)}s(null)}))}}class S{execute(t){var i,s,e;const n=null===(i=t.actionConfig.dbCall)||void 0===i?void 0:i.name,o=null===(s=t.actionConfig.dbCall)||void 0===s?void 0:s.rootEntity,r={actionID:t.actionID,refreshType:null===(e=t.actionConfig.dbCall)||void 0===e?void 0:e.refreshType,procName:n,rootEntity:o};return new Promise((t=>{t({execSource:r,callback:this.callExecProcedure})}))}async callExecProcedure(t){const i={requestBody:{stpCall:t}};await g.get().callServiceBroker("ActionButtonsSP.executeSTP",JSON.stringify(i))}}var z,A;!function(t){t.LAUNCH_SCREEN="LC",t.JAVASCRIPT="SC",t.JAVA="RJ",t.PROCEDURE="SP",t.EMBEDDED="EB"}(z||(z={}));class O{constructor(t){this.actionType=t,this._application=o.getContextValue("__SNK__APPLICATION__")}get executor(){switch(this.actionType){case z.LAUNCH_SCREEN:return new x;case z.JAVASCRIPT:return new C;case z.JAVA:return new y;case z.PROCEDURE:return new S;default:throw new a(this._application.messagesBuilder.getMessage("snkActionsButton.title.error",void 0),this._application.messagesBuilder.getMessage("snkActionsButton.action.nonExistentType",{actionType:this.actionType}))}}}!function(t){t.NONE="NONE",t.PARENT="PARENT",t.MASTER="MASTER",t.ALL="ALL"}(A||(A={}));const P="__MASTER_ROW__";class N{constructor(t,i,s){var e;this._lastValuesCache={},this._actionsExecuteInterface=t,this._dataUnit=i,this._selectedRows=(null===(e=null==i?void 0:i.getSelectionInfo())||void 0===e?void 0:e.isAllRecords())?[]:null==i?void 0:i.getSelectionInfo().records,this._application=o.getContextValue("__SNK__APPLICATION__"),this._appResourceId=s}getPrimaryKeys(){return m(this._dataUnit).map((({name:t})=>t))}apply(t,i){this._application.closePopUp(),this._actionsExecuteInterface.execute(t,this._dataUnit).then((({execSource:s,callback:e})=>{this.resolvePromptParams(t,s,i).then((()=>{this.actionExecute(s,e)}))}))}async execute(t){var i;if(!t.actionConfig)throw new l(this._application.messagesBuilder.getMessage("snkActionsButton.title.warning",void 0),this._application.messagesBuilder.getMessage("snkActionsButton.action.incorrectAction",{description:t.description}));if(null===(i=t.actionConfig.params)||void 0===i?void 0:i.promptParam){const i=t.actionConfig.params.promptParam;let s=!1;for(let t=0;t<i.length;t++)if(!s&&"true"===i[t].saveLast){s=!0;break}s&&(t.actionConfig.params.promptParam=await this.loadSavedValuesIntoParams(t));const e=document.createElement("snk-actions-form");window.document.body.appendChild(e),e.action=c.copy(t),e.applyParameters=t=>{this.apply(t,s)},e.openPopup()}else t.type!=z.LAUNCH_SCREEN?this._actionsExecuteInterface.execute(t,this._dataUnit).then((({execSource:t,callback:i})=>{this.actionExecute(t,i)})):this._actionsExecuteInterface.execute(t,this._dataUnit)}loadSavedValuesIntoParams(t){return this.loadLastValues(t).then((i=>{let s=t.actionConfig.params.promptParam;return i&&i.param.forEach((t=>{s=s.map((i=>i.name!==t.paramName?i:Object.assign(Object.assign({},i),"B"===i.paramType?{value:"S"===t.$}:{value:t.$})))})),s}))}actionExecute(t,i){t.virtualPage=this.buildVirtualPage(),this.prepareAndExecute(t,i),this.recordsReloader(t.refreshType)}resolvePromptParams(t,i,s){return new Promise((e=>{let n=[];t.actionConfig.params.promptParam.forEach((t=>{n.push(this.buildPromptParam(t))})),this.putParamsOnExecSource(n,i),s&&this.saveLastValues(t,n),e()}))}buildPromptParam(t){let i,s,e=t.paramType,n=!1,o=t.value;switch(e){case f.DATE:e="D";break;case f.DATETIME:e="H";break;case f.DECIMAL:e="F",i={"sk-precision":Number(t.precision)};break;case f.BOOLEAN:e="S",n=!0,o=t.value?"S":"N";break;case f.ENTITY:i={"sk-entity-name":t.entityName,"sk-allow-show-hierarchical-mode":t.hierarchyEntity,"sk-data-type":"S"},t.hierarchyEntity&&t.entityPK&&(s=t.entityPK),o=t.value?Number(t.value):null;break;case f.OPTIONS:e="O";let r=t.options.split(";").map((function(t,i){let s,e;if(t.indexOf("=")>-1){let i=t.split("=");s=i[0],e=i[1]}else s=i+1,e=t;return{data:s,value:e}}));i={"sk-options":r}}return{description:t.label,required:"true"==t.required,fieldName:t.name,fieldNameOri:t.name,entityPK:s,paramType:t.paramType,type:e,isCheckbox:n,saveLast:t.saveLast,fieldProp:i,value:o,isGeneratedName:t.isGeneratedName}}putParamsOnExecSource(t,i){i.params={param:[]},t.forEach((t=>{if(t.isGeneratedName&&t.value)throw new a(this._application.messagesBuilder.getMessage("snkActionsButton.title.error",void 0),this._application.messagesBuilder.getMessage("snkActionsButton.action.emptyParamName",void 0));r.isEmpty(t.value)||i.params.param.push({type:this.getParamDataType(t.paramType),paramName:t.fieldName,$:this.getParamValue(t)})}))}getParamDataType(t){let i;switch(t){case"D":i="F";break;case"DT":case"DH":i="D";break;case"B":case"ENTITY":case"SO":i="S";break;default:i=t}return i}getParamValue(t){let i=t.value;return i?("DT"==t.paramType?i=d.formatDate(i):"DH"==t.paramType&&(i=d.formatDateTime(i)),i):i}async loadLastValues(t){const i=await this.buildResourceId(t.actionID);return new Promise(((t,s)=>{if(this._lastValuesCache[i])t(this._lastValuesCache[i]);else{const e={config:{chave:i,tipo:"T"}};g.get().callServiceBroker("SystemUtilsSP.getConf",e).then((s=>{var e,n;let o;(null===(n=null===(e=s.config)||void 0===e?void 0:e.data)||void 0===n?void 0:n.params)&&(o=s.config.data.params,Array.isArray(o.param)||(o.param=[o.param])),this._lastValuesCache[i]=o,t(o)})).catch((t=>{s(t)}))}}))}async saveLastValues(t,i){if(this._application){let s={params:{param:[]}};i.forEach((t=>{"true"==t.saveLast&&s.params.param.push({paramName:t.fieldName,$:t.value})}));const e=await this.buildResourceId(t.actionID);this._lastValuesCache[e]=s.params,this._application.saveConfig(e,s)}}async buildResourceId(t){return this._appResourceId+".actionconfig."+t}prepareAndExecute(t,i){this.addRows(t),i(t)}addRows(t){const i=this.getPrimaryKeys(),s={row:[]},e=this._selectedRows;for(const t in e){const n=e[t],o={};n.hasOwnProperty(P)&&(o.master="S",o.entityName=n.__ENTITY_NAME__,delete n[P],delete n.__ENTITY_NAME__),o.field||(o.field=[]);for(const t of i)o.field.push({fieldName:t,$:n[t]});s.row.push(o)}s.row.length>0&&(t.rows=s)}recordsReloader(t){switch(t){case A.NONE:break;case A.PARENT:case A.MASTER:case A.ALL:this._dataUnit.loadData();break;default:this._dataUnit.reloadCurrentRecord()}}buildVirtualPage(){var t,i,s,e;if(null===(i=null===(t=this._dataUnit)||void 0===t?void 0:t.getSelectionInfo())||void 0===i?void 0:i.isAllRecords())return{filters:{filters:null===(s=this._dataUnit)||void 0===s?void 0:s.getAppliedFilters()},orders:{orders:null===(e=this._dataUnit)||void 0===e?void 0:e.getSort()}}}}class D{async clientConfirm(t,i){return new Promise((s=>{const e=o.getContextValue("__SNK__APPLICATION__");let n="";t.content.event.hasOwnProperty("stpCall")?(i.requestBody=t.content.event.stpCall,n=z.PROCEDURE):t.content.event.hasOwnProperty("runScript")?(i.requestBody=t.content.event.runScript,n=z.JAVASCRIPT):t.content.event.hasOwnProperty("javaCall")&&(i.requestBody=t.content.event.javaCall,n=z.JAVA);let r={type:"S",sequence:t.content.event.sequence};i.requestBody.params?Array.isArray(i.requestBody.params.param)||(i.requestBody.params.param=[i.requestBody.params.param]):i.requestBody.params={param:[]},i.requestBody.params.param.push(r);const a=t.content.event.title.$,l=t.content.event.message.$;let c;switch(n){case z.JAVASCRIPT:c={runScript:i.requestBody};break;case z.PROCEDURE:c={requestBody:{stpCall:i.requestBody}};break;case z.JAVA:c={requestBody:{javaCall:i.requestBody}}}if("S"==t.content.event.showNoOption){r.paramName="__ESCOLHA_SIMNAO__";const t=document.createElement("snk-client-confirm");window.document.body.appendChild(t),t.titleMessage=a,t.message=l,t.accept=async()=>{r.$="S",await i.reCall(c),s()},t.cancel=async()=>{r.$="N",await i.reCall(c),s()},t.openPopup()}else e.confirm(a,l,null,"warn",{labelCancel:"Cancelar",labelConfirm:"Sim"}).then((async t=>{t&&(r.paramName="__CONFIRMACAO__",r.$="S",await i.reCall(c),s())}))}))}}const I=class{constructor(i){t(this,i),this.CLIENT_EVENT_CONFIRM_NAME="br.com.sankhya.actionbutton.clientconfirm",this.handleClick=t=>{const i=this._actions.find((i=>i.actionID==t.detail.id)),s=new O(i.type).executor;new N(s,this._dataUnit,this._resourceID).execute(Object.assign({},i)),this._showDropdown=!1},this._items=[],this._showDropdown=!1,this._actions=[],this._isOrderActions=!1}async getActions(){let t={param:{entityName:this._entityName,resourceID:this._resourceID}};return g.get().callServiceBroker("ActionButtonsSP.getActions",t).then((t=>{var i;(null===(i=t.actions)||void 0===i?void 0:i.action)&&(this._actions=this._isOrderActions?h.sortAlphabetically(t.actions.action,"description"):t.actions.action)}))}controlDropdown(){this._showDropdown=!this._showDropdown}canShowDropdown(){var t;return this._showDropdown&&(null===(t=this._items)||void 0===t?void 0:t.length)>0}positionDropdown(){var t;const i=null===(t=this._ezButton)||void 0===t?void 0:t.getBoundingClientRect();i&&this._dropdownParent&&(this._dropdownParent.style.top=i.y+i.height+5+"px",this._dropdownParent.style.left=i.x+"px")}closeDropdown(t){const i=null==t?void 0:t.target;i&&(i.closest(".snk-actions-button")||(this._showDropdown=!1))}setEvents(){document.removeEventListener("click",this.closeDropdown.bind(this)),document.addEventListener("click",this.closeDropdown.bind(this)),document.removeEventListener("scroll",this.positionDropdown.bind(this)),document.addEventListener("scroll",this.positionDropdown.bind(this))}async componentWillLoad(){this._application=o.getContextValue("__SNK__APPLICATION__"),this._isOrderActions=await this._application.getBooleanParam("global.ordenar.acoes.personalizadas");const t=this._element.parentElement;this._dataUnit=null==t?void 0:t.dataUnit,this._resourceID=null==t?void 0:t.resourceID,this._entityName=this._dataUnit.name.split("/")[2],null==this._resourceID&&(this._resourceID=await p.getResourceID()),this.setEvents(),this.getActions().then((()=>{this.loadItems()}))}async componentDidLoad(){if(this._element&&(u.addIDInfo(this._element),this.positionDropdown(),!await this._application.hasClientEvent(this.CLIENT_EVENT_CONFIRM_NAME))){const t=new D;this._application.addClientEvent(this.CLIENT_EVENT_CONFIRM_NAME,t.clientConfirm)}}componentDidUpdate(){this.positionDropdown()}loadItems(){this._actions&&0!=this._actions.length&&this._actions.forEach((t=>{this._items.push({id:t.actionID,label:t.description})}))}getElementID(t){return{[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:u.getInternalIDInfo(t)}}render(){return i(s,null,this._actions&&this._actions.length>0&&i("div",{class:`ez-padding-left--medium snk-actions-button\n ${this.canShowDropdown()?" ez-elevation--16":""}\n `},i("ez-button",Object.assign({ref:t=>this._ezButton=t,iconName:"acao",size:"small",mode:"icon",title:this._application.messagesBuilder.getMessage("snkActionsButton.title.actions",void 0),onClick:()=>this.controlDropdown()},this.getElementID("button"))),i("div",Object.assign({ref:t=>this._dropdownParent=t,class:(this.canShowDropdown()?"snk-actions-button__dropdown--show":"snk-actions-button__dropdown")+"\n "},this.getElementID("dropdown")),this.canShowDropdown()&&i("ez-dropdown",Object.assign({items:this._items,onEzClick:t=>this.handleClick(t)},this.getElementID("dropdown"))))),this.canShowDropdown()&&i("div",Object.assign({class:"ez-scrim ez-scrim--light"},this.getElementID("ezScrim"))))}get _element(){return e(this)}};I.style=".sc-snk-actions-button-h{display:flex;width:fit-content;height:fit-content}.snk-actions-button.sc-snk-actions-button{display:flex;width:fit-content;height:fit-content}.snk-actions-button__dropdown--show.sc-snk-actions-button{display:flex;flex-direction:column;position:fixed}.snk-actions-button__dropdown.sc-snk-actions-button>ez-dropdown.sc-snk-actions-button{position:relative}.snk-actions-button__dropdown.sc-snk-actions-button{display:none}";const E=class{constructor(i){t(this,i),this.configChange=n(this,"configChange",7),this.configCancel=n(this,"configCancel",7),this._orderListItems=[],this._orderPriorityList=[],this._columListItems=[],this._selectedIndex=-1,this._dataChanged=!1,this._componenteInternalKey=Date.now(),this.selectedIndex=0,this.columns=void 0,this.config=void 0,this.configName=void 0,this.resourceID=void 0}getMessage(t,i){return o.getContextValue("__SNK__APPLICATION__").messagesBuilder.getMessage(t,i)}getSortableColumns(){let t=[];return this.columns.filter((t=>{var i;return r.getBooleanValue(null===(i=null==t?void 0:t.props)||void 0===i?void 0:i.get("sortable"),!0)})).forEach((i=>{var s;let e=null===(s=this.config)||void 0===s?void 0:s.columns.find((t=>t.name===i.name)),n={name:i.name,label:i.label};e&&(n.orderIndex=e.orderIndex,n.ascending=e.ascending),i.hidden||t.push(n)})),t}createOrderList(){let t=this.getSortableColumns();t.sort(((t,i)=>0!=t.orderIndex||0!=i.orderIndex||null==t.ascending&&null==i.ascending?null!=t.ascending&&null!=i.ascending?t.orderIndex-i.orderIndex:null!=t.ascending||null!=i.ascending?null!=t.ascending?-1:null!=i.ascending?1:0:t.orderIndex-i.orderIndex:null!=t.ascending?-1:null!=i.ascending?1:0)),this._orderListItems=t}createColumnList(){let t={group:this.getMessage("snkGridConfig.group.visible"),items:[]},i={group:this.getMessage("snkGridConfig.group.hidden"),items:[],sort:w.asc.value};this.columns.forEach((s=>{let e={label:s.label};s.hidden?i.items.push(e):t.items.push(e)})),this._columListItems=[t,i]}createColumnListSlotDataElementId(t){return`configItem_${r.replaceAccentuatedChars(r.toCamelCase(t.label))}`}buildColumnListSlot(t,s){const e=this.createColumnListSlotDataElementId(t);return i("div",null,i("ez-check",{mode:k.SWITCH,id:k.SWITCH+((null==t?void 0:t.label)||"")+((null==s?void 0:s.group)||""),value:s.group===this.getMessage("snkGridConfig.group.visible"),"data-element-id":e,onEzChange:i=>{this.switchColumnGroup(i,t)}}))}createOrderListSlotDataElementId(t){return`${this._element.getAttribute(u.DATA_ELEMENT_ID_ATTRIBUTE_NAME)}_configItem_${r.toCamelCase(t.label)}`}buildOrderListSlot(t){const s=this.createOrderListSlotDataElementId(t);let e=w.none.value;return null!=(null==t?void 0:t.ascending)&&(e=1==t.ascending?w.asc.value:w.desc.value),i("div",null,i("snk-select-box",{selectedOption:e,key:"snk-select-box-"+this._componenteInternalKey+"-"+t,"data-element-id":s,onEzChange:i=>{i.stopPropagation(),this.updateOrder(i.detail,t.label)}}))}updateOrder(t,i){var s;this._dataChanged=!0;let e,n=[...this.columns],o=n.find((t=>t.label===i));o&&(o.sort=t.value===w.none.value?void 0:t.value),(null===(s=this._orderPriorityList)||void 0===s?void 0:s.length)>0?(this._orderPriorityList.find((t=>t.label===o.label)).sort=t,this._orderPriorityList.filter((t=>t.sort)).forEach(((t,i)=>{t.label===o.label&&(o.sortIndex=i)}))):(e=n.filter((t=>t.sort&&!0!==t.hidden)).map(((t,i)=>({label:t.label,orderIndex:i}))),e.forEach((t=>{n.find((i=>i.label===t.label)).sortIndex=t.orderIndex}))),this.columns=n}switchColumnGroup(t,i){t.stopPropagation();let s=[...this._columListItems];if(this._dataChanged=!0,!0===t.detail){let t=s.find((t=>t.group===this.getMessage("snkGridConfig.group.hidden"))),e=t.items.findIndex((t=>t.label===i.label));e>=0&&t.items.splice(e,1),s.find((t=>t.group===this.getMessage("snkGridConfig.group.visible"))).items.push(i),this._columListItems=s,this.createOrderList()}else if(!1===t.detail){let t=s.find((t=>t.group===this.getMessage("snkGridConfig.group.visible"))),e=t.items.findIndex((t=>t.label===i.label));e>=0&&t.items.splice(e,1),s.find((t=>t.group===this.getMessage("snkGridConfig.group.hidden"))).items.push(i),this._columListItems=s,this.createOrderList()}}finish(){if(!this._dataChanged)return void this.closeConfig();let t=[];this._columListItems.forEach((i=>{i.items.forEach((s=>{const e=this.columns.find((t=>t.label===s.label));let n=Object.assign({},e);n.hidden=i.group===this.getMessage("snkGridConfig.group.hidden"),t.push(n)}))})),this.columns=t,this._dataChanged=!1,this.closeConfig(),this.save()}saveGridConfigOnStorage(t){_.saveGridConfig(t,this.configName,this.resourceID).then((t=>{this.configChange.emit(t),this._orderList.clearHistory(),v.info(this.getMessage("snkGridConfig.info.successfullyConfigSaved"),{iconName:"check"})}))}reOrderPriorityColumns(t,i){let s=[];s=t.filter((t=>t.sort&&!0!==t.hidden)).map((t=>({label:t.label,orderIndex:0})));let e=0,n=[];return i.forEach((t=>{let i=s.find((i=>i.label===t.label));i&&(i.orderIndex=e,n.push(i),e++)})),n.length>0&&(s=n),s}save(){var t;let i;i=this.config?this.config:this.createConfigFromState(this.columns);let s,e=[];(null===(t=this._orderPriorityList)||void 0===t?void 0:t.length)>0&&(s=this.reOrderPriorityColumns(this.columns,this._orderPriorityList)),this.columns.forEach((t=>{let n=i.columns.find((i=>t.name===i.name));!0===t.hidden&&n||(n?n.width=t.width:!1===t.hidden&&(n={name:t.name,width:t.width,orderIndex:0}),n&&(t.sort?(n.ascending=t.sort.toUpperCase()===w.asc.value,s?function(t,i){if(s){let e=s.find((i=>i.label===t.label));e&&(i.orderIndex=e.orderIndex)}}(t,n):n.orderIndex=t.sortIndex):(delete n.ascending,n.orderIndex=0),e.push(n)))})),i.columns=e,this.saveGridConfigOnStorage(i)}createConfigFromState(t){let i={columns:[]};return t.forEach((t=>{if(!t.hidden){let s={name:t.name};t.width&&(s.width=t.width),t.sort?(s.ascending=t.sort.toUpperCase()===w.asc.value,s.orderIndex=t.sortIndex):s.orderIndex=0,s&&i.columns.push(s)}})),i}async locateColumn(t,i){var s;const e="Enter"===t.key;if(!(i=i||(null===(s=t.currentTarget)||void 0===s?void 0:s.value)))return void this.removeSelection();const n=await this.getMatchedIndexes(i),o=this.getNewSelectedIndex(n,e);this._selectedIndex=o,1===this.selectedIndex?this.updateOrderListSelection(o):this.updateColumnListSelection(o)}async getMatchedIndexes(t){const i=[];return 1===this.selectedIndex?(await this._orderList.getList()).forEach(((s,e)=>{this.compareWords(s,t)&&i.push(e)})):this.columns.forEach(((s,e)=>{this.compareWords(s,t)&&i.push(e)})),i}getNewSelectedIndex(t,i){if(0===t.length)return-1;if(i)for(const i of t)if(i>this._selectedIndex)return i;return t[0]}updateOrderListSelection(t){-1!==t?this._orderList.getList().then((i=>{const s=i[t];s?this._orderList.setSelection(s,!0):this._orderList.removeSelection()})):this._orderList.removeSelection()}updateColumnListSelection(t){if(-1===t)return void this._columnList.removeSelection();const i=this.columns[t];if(i){const t=this._columListItems.map((t=>t.items)).flat().find((t=>t.label===i.label));t?this._columnList.setSelection(t,!0):this._columnList.removeSelection()}else this._columnList.removeSelection()}removeSelection(){1===this.selectedIndex?this._orderList.removeSelection():this._columnList.removeSelection()}compareWords(t,i){var s,e;const n=null===(s=r.replaceAccentuatedChars(null==t?void 0:t.label))||void 0===s?void 0:s.toUpperCase(),o=null===(e=r.replaceAccentuatedChars(i))||void 0===e?void 0:e.toUpperCase();return!r.isEmpty(n)&&!r.isEmpty(o)&&n.includes(o)}getColumnNames(){const t=[];return t.push(this.getMessage("snkGridConfig.tab.columns")),t.push(this.getMessage("snkGridConfig.tab.lineOrdering")),t.join(",")}closeConfig(){if(this._orderList.scrollToTop(),this._columnList.scrollToTop(),this._searchElement.value="",this._dataChanged){let t={canClose:!1,labelCancel:this.getMessage("snkGridConfig.confirm.cancel"),labelConfirm:this.getMessage("snkGridConfig.confirm.save"),btnConfirmDanger:!1};v.confirm(this.getMessage("snkGridConfig.confirm.alert"),this.getMessage("snkGridConfig.confirm.msgCancel"),null,b.WARN,t).then((t=>{t?this.finish():(this._dataChanged=!1,this.configCancel.emit(),this._orderList.clearHistory(),this._componenteInternalKey=Date.now())}))}else this.configCancel.emit(),this._orderList.clearHistory()}handleTabChange(t){null!=(null==t?void 0:t.index)&&(this.selectedIndex!==t.index&&(0===t.index?this._orderList.scrollToTop():1===t.index&&this._columnList.scrollToTop(),this._searchElement.value=""),1===t.index&&this.createOrderList(),this.selectedIndex=t.index)}handleColumnListChange(t){var i;if(t.detail){let s=null===(i=t.detail.find((t=>t.group===this.getMessage("snkGridConfig.group.visible"))))||void 0===i?void 0:i.items;s&&(this._dataChanged=!0,this._orderListItems=s)}}handleOrderListChange(t){if(t.detail){let i=t.detail;i&&(this._dataChanged=!0,this._orderPriorityList=i)}}componentWillRender(){var t;(null===(t=this.columns)||void 0===t?void 0:t.length)>0&&this.createColumnList()}componentDidRender(){var t;(null===(t=this.columns)||void 0===t?void 0:t.length)>0&&this.locateColumn(new KeyboardEvent("arrow-right",{key:"ArrowRight"}),this._searchElement.value)}componentDidLoad(){u.addIDInfo(this._element)}render(){return i(s,null,i("div",{class:"grid-config__header"},i("div",{class:"title-container"},i("div",{class:""},i("label",{class:"title"},this.getMessage("snkGridConfig.gridConfiguration")),i("label",{class:"subtitle"},this.getMessage("snkGridConfig.columnVisibilityOrder"))),i("div",{class:"button-close"},i("ez-button",{mode:"icon",iconName:"close",size:"medium",onClick:()=>this.closeConfig()}))),i("div",{class:"tabselector-container"},i("ez-tabselector",{selectedIndex:this.selectedIndex,onEzChange:t=>{this.handleTabChange(t.detail)},tabs:this.getColumnNames()})),i("div",null,i("ez-text-input",{"data-element-id":"searchColums",ref:t=>this._searchElement=t,label:this.getMessage("snkGridConfig.findColumn"),onKeyUp:t=>this.locateColumn(t)},i("ez-icon",{slot:"leftIcon",size:"medium",iconName:"search"})))),i("div",{class:"grid-config__main"},i("ez-list",{ref:t=>this._columnList=t,class:0===this.selectedIndex?"":"hidden",dataSource:this._columListItems,onEzChange:t=>this.handleColumnListChange(t),ezDraggable:!0,ezSelectable:!0,itemSlotBuilder:(t,i)=>this.buildColumnListSlot(t,i),useGroups:!0,"data-element-id":"configCols"}),i("div",{class:1===this.selectedIndex?"group-name":"hidden"},this.getMessage("snkGridConfig.info.sortingSequence")),i("ez-list",{ref:t=>this._orderList=t,class:1===this.selectedIndex?"height-calc":"hidden",dataSource:this._orderListItems,ezSelectable:!0,onEzChange:t=>this.handleOrderListChange(t),ezDraggable:!0,itemSlotBuilder:t=>this.buildOrderListSlot(t),"data-element-id":"configDataOrder"})),i("div",{class:"grid-config__footer"},i("ez-button",{class:"padding-right--medium",label:this.getMessage("snkGridConfig.cancel"),onClick:()=>this.closeConfig()}),i("ez-button",{label:this.getMessage("snkGridConfig.complete"),class:"ez-button--primary",onClick:()=>this.finish()})))}static get assetsDirs(){return["../assets"]}get _element(){return e(this)}};E.style='.sc-snk-grid-config-h{--snk-grid-config__footer--padding-top:var(--space--medium, 12px);--snk-grid-config__main--padding-right:var(--space--medium, 12px);--snk-grid-config__tabselector-container--padding:var(--space--medium, 12px);--snk-grid-config__button-close--padding-left:var(--space--medium, 12px);--snk-grid-config__title--color:var(--title--primary, #2B3A54);--snk-grid-config__title--font-family:var(--font-pattern, "Roboto");--snk-grid-config__title--font-size:var(--title--large, 20px);--snk-grid-config__title--font-weight:var(--text-weight--extra-large, 700);--snk-grid-config__subtitle--font-family:var(--font-pattern, "Roboto");--snk-grid-config__subtitle--font-size:var(--text--medium, 14px);--snk-grid-config__group--font-family:var(--font-pattern, "Roboto");--snk-grid-config__group--font-size:var(--text--medium, 14px);--snk-grid-config__group--font-weight:var(--text-weight--large, 600);--snk-grid-config__group--padding-bottom:var(--space-small, 6px);--snk-grid-config__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-grid-config__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-grid-config__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-grid-config__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-grid-config__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-grid-config__scrollbar--width:var(--space--medium, 12px);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}@media screen and (min-width: 480px){.sc-snk-grid-config-h{width:359px;max-width:359px}}.padding-right--medium.sc-snk-grid-config{padding-right:var(--space--medium)}ez-list.sc-snk-grid-config{height:100%}.height-calc.sc-snk-grid-config{max-height:calc(100% - 24px)}.grid-config__footer.sc-snk-grid-config{display:flex;justify-content:flex-end;width:100%;padding-top:var(--snk-grid-config__footer--padding-top)}.hidden.sc-snk-grid-config{display:none}.tabselector-container.sc-snk-grid-config{padding:var(--snk-grid-config__tabselector-container--padding) 0}.button-close.sc-snk-grid-config{padding-left:var(--snk-grid-config__button-close--padding-left)}.title-container.sc-snk-grid-config{display:flex;justify-content:space-between;align-items:center;width:100%}.title.sc-snk-grid-config{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-grid-config__title--color);font-size:var(--snk-grid-config__title--font-size);font-family:var(--snk-grid-config__title--font-family);font-weight:var(--snk-grid-config__title--font-weight)}.subtitle.sc-snk-grid-config{color:var(--text--primary);font-size:var(--snk-grid-config__subtitle--font-size);font-family:var(--snk-grid-config__subtitle--font-family)}.grid-config__main.sc-snk-grid-config{overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-grid-config__scrollbar--color-clicked) var(--snk-grid-config__scrollbar--color-background);padding-right:var(--snk-grid-config__main--padding-right)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar{width:var(--snk-grid-config__scrollbar--width);max-width:var(--snk-grid-config__scrollbar--width);min-width:var(--snk-grid-config__scrollbar--width);background-color:var(--snk-grid-config__scrollbar--color-background)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-track{background-color:var(--snk-grid-config__scrollbar--color-background);border-radius:var(--snk-grid-config__scrollbar--border-radius)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb{background-color:var(--snk-grid-config__scrollbar--color-default);border-radius:var(--snk-grid-config__scrollbar--border-radius)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb:vertical:hover,.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-grid-config__scrollbar--color-hover)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb:vertical:active,.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-grid-config__scrollbar--color-clicked)}.group-name.sc-snk-grid-config{font-family:var(--snk-grid-config__group--font-family);font-size:var(--snk-grid-config__group--font-size);font-weight:var(--snk-grid-config__group--font-weight);padding-bottom:var(--snk-grid-config__group--padding-bottom)}';const j=class{constructor(i){t(this,i),this.ezChange=n(this,"ezChange",7),this.selectedOption=w.none}render(){return i("ez-combo-box",{class:"grid-config-combo ez-input--inverted",label:"",suppressSearch:!0,value:this.selectedOption,enabled:!0,canShowError:!1,suppressEmptyOption:!0},Object.keys(w).map((t=>i("option",{value:w[t].value},w[t].label))))}static get assetsDirs(){return["../assets"]}};j.style="ez-combo-box{width:100px}.grid-config-combo{--ez-text-input--height:28px;--ez-text-input__input--background-color:#fff;--ez-text-input__input--border-color:#dce0e8}";const L=class{constructor(i){t(this,i),this.taskbarActionSelected=n(this,"taskbarActionSelected",7),this.taskbarActionsOpened=n(this,"taskbarActionsOpened",7),this.taskbarActionsButtonDisconnected=n(this,"taskbarActionsButtonDisconnected",7),this._showDropdown=!1,this.title=void 0,this.enabled=void 0,this.actions=void 0}async handleKeyDown(t){"Escape"!==t.key&&"Esc"!==t.key||await this.hideActions()}async handleClose(){await this.hideActions()}async showActions(){this._showDropdown=!0,requestAnimationFrame((()=>{this._element.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))}async hideActions(){this._showDropdown=!1}async isOpened(){return this._showDropdown}controlDropdown(){this._showDropdown=!this._showDropdown}loadItems(){return this.actions.filter((t=>void 0!==t)).map((t=>{var i;return{id:t.value,label:t.label,value:t.value,type:null!==(i=t.type)&&void 0!==i?i:"item",children:t.children,iconName:t.iconName,subAction:t.subAction,group:t.group,disableCloseOnSelect:t.disableCloseOnSelect}}))}canShowDropdown(){var t;return this._showDropdown&&(null===(t=this.actions)||void 0===t?void 0:t.length)>0}onSelectAction(t){const i=this.actions.map((t=>Object.assign(Object.assign({},t),{id:t.value}))),s=this.getSelectedAction(t.id,i);this.taskbarActionSelected.emit(s),s.disableCloseOnSelect||(this._showDropdown=!1)}getSelectedAction(t,i){let s=null;for(const e of i){if(e.id===t){s=e;break}if((null==e?void 0:e.children)&&(s=this.getSelectedAction(t,e.children),s))break}return s}dropdownItemBuilder(t,s){const e=this.actions.find((i=>i.value===t.id));if(!e||!e.itemBuilder)return;const n=e.itemBuilder(this._element,e);return"string"==typeof n?i("div",{innerHTML:n}):n}initializeEagerItems(){var t;null===(t=this.actions)||void 0===t||t.forEach((t=>{var i;t&&t.eagerInitialize&&t.itemBuilder&&(null===(i=t.itemBuilder)||void 0===i||i.call(t,this._element,t))}))}componentDidLoad(){this.initializeEagerItems()}componentDidRender(){this._showDropdown&&this.taskbarActionsOpened.emit(this._element)}disconnectedCallback(){this.taskbarActionsButtonDisconnected.emit()}render(){return i(s,null,i("div",{class:this.canShowDropdown()?" ez-elevation--16":""},i("ez-button",{title:this.title,mode:"icon",iconName:"dots-vertical",size:"small",enabled:this.enabled,onClick:()=>this.controlDropdown()}),this.canShowDropdown()&&i("ez-dropdown",{items:this.loadItems(),onEzClick:t=>this.onSelectAction(t.detail),onEzOutsideClick:()=>this._showDropdown=!1,itemBuilder:(t,i)=>this.dropdownItemBuilder(t,i)})))}get _element(){return e(this)}};L.style=".sc-taskbar-actions-button-h{display:flex;width:fit-content;height:fit-content}";export{I as snk_actions_button,E as snk_grid_config,j as snk_select_box,L as taskbar_actions_button}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as t,c as s,h as i,H as e,g as a}from"./p-d2d301a6.js";import{Action as h,StringUtils as n,ApplicationContext as r,OVERFLOWED_CLASS_NAME as o,OverflowWatcher as l,OverflowDirection as d,ElementIDUtils as v}from"@sankhyalabs/core";import{A as u}from"./p-dc36cfbf.js";import{T as c,V as k,A as m,b,a as p}from"./p-7e7a7473.js";import{P as T}from"./p-30cf616e.js";import"./p-6dc031de.js";const f=class{constructor(i){t(this,i),this.actionClick=s(this,"actionClick",7),this.taskbarSaveLocker=s(this,"taskbarSaveLocker",7),this.taskbarSaveUnlocker=s(this,"taskbarSaveUnlocker",7),this.TASKBAR_ITEM_ID_PREFIX="TASKBAR_ITEM_",this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME="taskbar-custom-elements-container",this.ACTIONS_BUTTON_TAG="TASKBAR-ACTIONS-BUTTON",this.NOT_OVERFLOW_ELEMENTS=["moreOptions","dataExporter_snkDataExporter","actionsButton_snkActionsButton"],this._titleKeyByElement={[c.UPDATE]:"snkTaskbar.titleUpdate",[c.PREVIOUS]:"snkTaskbar.titlePrevious",[c.NEXT]:"snkTaskbar.titleNext",[c.REFRESH]:"snkTaskbar.titleRefresh",[c.CLONE]:"snkTaskbar.titleClone",[c.REMOVE]:"snkTaskbar.titleRemove",[c.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[c.INSERT]:"snkTaskbar.titleInsert",[c.CANCEL]:"snkTaskbar.titleCancel",[c.SAVE]:"snkTaskbar.titleSave",[c.GRID_MODE]:"snkTaskbar.titleGridMode",[c.FORM_MODE]:"snkTaskbar.titleFormMode",[c.CONFIGURATOR]:"snkTaskbar.titleConfigurator",[c.ATTACH]:"snkTaskbar.titleAttach"},this.onSaveEvent=t=>{switch(t.type){case h.FIELD_INVALIDATED:case h.INVALIDATE_CLEAN:case h.DATA_SAVED:case h.SAVING_ERROR:case h.SAVING_CANCELED:this._isWaitingForSave=!1;break;case h.SAVING_DATA:this._isWaitingForSave=!0}},this._permissions=void 0,this._overFlowedElements=[],this._customElements=void 0,this._customElementsId=void 0,this._slotContainer=void 0,this._hiddenActionsList=[],this._lastWidth=void 0,this._hasToUpdateOverFlow=!1,this._isWaitingForSave=!1,this.alignRigth=!1,this.customSlotId="TASKBAR_CUSTOM_ELEMENTS",this.customContainerId=void 0,this.overflowStrategy="hiddenItems",this.configName=void 0,this.resourceID=void 0,this.buttons=void 0,this.customButtons=void 0,this.actionsList=void 0,this.primaryButton=void 0,this.disabledButtons=void 0,this.dataUnit=void 0,this.presentationMode=T.PRIMARY,this.messagesBuilder=void 0}handleCustomSlotElementsLoaded(t){this.hasToSearchCustomElements(t)&&this.getCustomElements(!0)}handleTaskbarSaveLocker(){!0!==this._isWaitingForSave&&(this._isWaitingForSave=!0)}handleTaskbarSaveUnlocker(){!0===this._isWaitingForSave&&(this._isWaitingForSave=!1)}hasToSearchCustomElements(t){return this.customSlotId===t.detail&&!this._slotContainer}observeButtons(){this._definitions=void 0,requestAnimationFrame((()=>{requestAnimationFrame((()=>{var t;return null===(t=this._overFlowWatcher)||void 0===t?void 0:t.forceUpdate()}))}))}observeDisabledButtons(){var t;null===(t=this._overFlowWatcher)||void 0===t||t.forceUpdate()}observeLastWidth(t,s){0===s&&0!==t&&(this._hasToUpdateOverFlow=!0)}observeIsWaitingForSave(t,s){1==t&&0==s&&this.taskbarSaveLocker.emit(),0==t&&1==s&&this.taskbarSaveUnlocker.emit()}elementsFromString(t){const s=[];return null==t||t.split(",").forEach((t=>{t=t.trim(),(k[t]||this.isAllowed(t))&&s.push(t.trim())})),s}isAllowed(t){return t===m.CONFIGURATOR?!!this._permissions&&(this._permissions.isSup||this._permissions[u.CONFIG_GRID]||this._permissions[u.CONFIG]):!m[t]||!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getTitle(t){var s;let i;return i=this.isAllowed(t)?this._titleKeyByElement[t]:"snkTaskbar.forbidden",i?null===(s=this.messagesBuilder)||void 0===s?void 0:s.getMessage(i,{}):""}elementClick(t){if(this.dataUnit)switch(t){case c.PREVIOUS:this.dataUnit.previousRecord();break;case c.NEXT:this.dataUnit.nextRecord();break;case c.REFRESH:this.dataUnit.loadData();break;case c.CLONE:this.dataUnit.copySelected();break;case c.REMOVE:this.dataUnit.removeSelectedRecords();break;case c.INSERT:this.dataUnit.addRecord();break;case c.CANCEL:this.dataUnit.cancelEdition();break;case c.SAVE:this._isWaitingForSave||(this._isWaitingForSave=!0,this.dataUnit.saveData().finally((()=>{this._isWaitingForSave=!1})))}this.isEnabled(t)&&this.actionClick.emit(t)}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}validatePresentationMode(){Object.values(T).includes(this.presentationMode)||(this.presentationMode=T.PRIMARY)}getElement(t,s){let i=s===this.primaryButton?"ez-button--primary ":"";t>1&&(i+="ez-padding-left--medium");const e=c[s.toString()],a=this._element.dataset.exporterStoreKey||this.configName;return e?b(s,i,this.getIdElemBtnNative(s),(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),this.buildDynamicActionsList(),a,this.presentationMode):p(s,i,this.getIdElemBtnCustom(s),(t=>this.elementClick(t)),(t=>this.isEnabled(t)))}buildDynamicActionsList(){var t;return this._hiddenActionsList.length?[...null!==(t=this.actionsList)&&void 0!==t?t:[],{type:"divider",label:"",value:""},...this._hiddenActionsList]:this.actionsList}getIdElemBtnNative(t){return n.toCamelCase(t)}getIdElemBtnCustom(t){return n.toCamelCase(t.name)}isDivider(t){var s;return void 0!==t&&(null===(s=t.t)||void 0===s?void 0:s["data-taskbar-divider"])}removeEmpty(t){let s;return t.filter((t=>!(null==t||this.isDivider(s)&&this.isDivider(t)||(s=t,0))))}appendCustomElementsInTaskbar(){this._customElementsId.forEach((t=>{const s=t.replace(this.TASKBAR_ITEM_ID_PREFIX,""),i=this._customElements.get(s),e=this._element.querySelector(`#${t}`);e?null==e||e.appendChild(i):this.unlinkCustomElementFromTaskbar(i)}))}addCustomElementContainer(t){var s;const e=`${this.TASKBAR_ITEM_ID_PREFIX}${t}`;return this._customElementsId.includes(e)||(this._customElementsId.push(e),null===(s=this._overFlowWatcher)||void 0===s||s.addNotOverFlowElement(e)),i("span",{class:"ez-padding-left--medium",key:e,id:e})}getCustomElements(t){var s,i;this._customElementsId=[],this._customElements=new Map,this._slotContainer=this.buildSlotContainer(t),Array.from(null!==(i=null===(s=this._slotContainer)||void 0===s?void 0:s.children)&&void 0!==i?i:[]).forEach((t=>this._customElements.set(t.id,t)))}buildSlotContainer(t){let s;if(this.customContainerId){const t=document.querySelector(`#${this.customContainerId}`);s=null==t?void 0:t.querySelector(`#${this.customSlotId}`)}else s=this._element.querySelector(`#${this.customSlotId}`);return t&&!s&&(s=document.querySelector(`#${this.customSlotId}`)),s}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess(this.resourceID).then((t=>this._permissions=t)):this._permissions={},this.getCustomElements()}componentWillRender(){this.handleDefinitions(),this.validatePresentationMode(),this.updateOverFlowIfNeeded()}handleDefinitions(){null==this._definitions&&this._permissions&&(this._definitions=this.elementsFromString(this.buttons))}updateOverFlowIfNeeded(){this._hasToUpdateOverFlow&&(requestAnimationFrame((()=>{var t;return null===(t=this._overFlowWatcher)||void 0===t?void 0:t.forceUpdate()})),this._hasToUpdateOverFlow=!1)}handleOverFlow(t){const s=t.filter((t=>!this.hasToIgnoreOverFlow(t)));this.resetOverFlowedElements(),this.doOverFlowElements(s)}resetOverFlowedElements(){this._overFlowedElements.forEach((t=>{t.classList.remove(o)})),this._hiddenActionsList=[],this._overFlowedElements=[]}doOverFlowElements(t){t.forEach((t=>{t.classList.add(o),this._overFlowedElements.push(t),this.addItemToActionList(t)}))}addItemToActionList(t){const s=this.getTaskbarElementName(t);if(s&&this.isEnabled(s)&&this.isAllowed(s)){const i={value:s,label:this.getTaskbarElementLabel(t),iconName:this.getTaskbarElementIcon(t)};this._hiddenActionsList.push(i)}}getTaskbarElementName(t){var s;return null!==(s=t.getAttribute("data-taskbar-element"))&&void 0!==s?s:""}getTaskbarElementIcon(t){var s;return null!==(s=t.getAttribute("data-taskbar-icon"))&&void 0!==s?s:""}getTaskbarElementLabel(t){var s;return null!==(s=t.getAttribute("data-taskbar-label"))&&void 0!==s?s:""}hasToIgnoreOverFlow(t){return t.classList.contains(this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME)}handleOverFlowStrategy(){"hiddenItems"===this.overflowStrategy&&(this._overFlowWatcher=new l(this.buildOverFlowWatcherParams()))}buildOverFlowWatcherParams(){return{element:this._element,callback:this.handleOverFlow.bind(this),overFlowDirection:d.HORIZONTAL,notOverFlow:this.NOT_OVERFLOW_ELEMENTS}}componentDidLoad(){v.addIDInfo(this._element,null,{dataUnit:this.dataUnit}),this.handleOverFlowStrategy(),this.dataUnit.subscribe(this.onSaveEvent)}componentDidRender(){this.appendCustomElementsInTaskbar(),this.updateLastWidth()}updateLastWidth(){this._lastWidth=this._element.getBoundingClientRect().width}disconnectedCallback(){var t;this.unlinkAllCustomElements(),null===(t=this._overFlowWatcher)||void 0===t||t.destroy()}unlinkAllCustomElements(){var t;null===(t=this._customElementsId)||void 0===t||t.forEach((t=>{const s=t.replace(this.TASKBAR_ITEM_ID_PREFIX,""),i=this._customElements.get(s);this.unlinkCustomElementFromTaskbar(i)}))}unlinkCustomElementFromTaskbar(t){this._slotContainer.appendChild(t)}render(){if(void 0===this._definitions)return;let t=0;return i(e,{class:this.getHostClasses()},this.removeEmpty(this._definitions.map((s=>{var e,a;return t++,c[s]?this.getElement(t,c[s]):(null===(e=this.customButtons)||void 0===e?void 0:e.has(s))?this.getElement(t,this.customButtons.get(s)):this._customElements.has(s)?this.addCustomElementContainer(s):(null===(a=this._overFlowWatcher)||void 0===a||a.addNotOverFlowElement(s),i("slot",{name:s}))}))),i("div",{class:this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME},i("slot",{name:this.customSlotId})))}getHostClasses(){return"hiddenItems"!==this.overflowStrategy?"no-wrap":"full-width "+(this.alignRigth?"align-right":"")}get _element(){return a(this)}static get watchers(){return{buttons:["observeButtons"],disabledButtons:["observeDisabledButtons"],_lastWidth:["observeLastWidth"],_isWaitingForSave:["observeIsWaitingForSave"]}}};f.style=".sc-snk-taskbar-h{display:flex;flex-wrap:wrap}.no-wrap.sc-snk-taskbar-h{flex-wrap:nowrap}.full-width.sc-snk-taskbar-h{width:100%}.align-right.sc-snk-taskbar-h{justify-content:flex-end}.overflowed.sc-snk-taskbar{display:none}";export{f as snk_taskbar}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,c as i,h as o,F as a,H as n,g as s}from"./p-d2d301a6.js";import{S as c}from"./p-fa816fb2.js";import{ApplicationContext as e,ElementIDUtils as b}from"@sankhyalabs/core";import{C as r,a as l,K as f,c as g,T as h}from"./p-b0ef4383.js";const _=class{constructor(o){t(this,o),this.ezTabChange=i(this,"ezTabChange",7),this.editionTitleTab=i(this,"editionTitleTab",7),this.deleteTab=i(this,"deleteTab",7),this.hideTab=i(this,"hideTab",7),this.ezOrderChange=i(this,"ezOrderChange",7),this.canStartDrag=i(this,"canStartDrag",7),this._refTabActions=[],this._processedTabs=void 0,this._activeEditText=void 0,this._activeEditTextIndex=void 0,this._actionsHide=[],this._actionsShow=[],this.selectedIndex=void 0,this.selectedTab=void 0,this.tabs=void 0,this.tabItems=void 0,this.messagesBuilder=void 0}getMessage(t,i){return this.messagesBuilder.getMessage(t,i)}controlSortableTab(){this._sortableTab&&this._sortableTab.destroy(),this._sortableTab=new c(this._hostElem.querySelectorAll('[data-draggable-parent="tab"]'),{draggable:'[data-draggable-element="tab"]',mirror:{constrainDimensions:!0},distance:r.dragStartDistance}),this._sortableTab.on(l.dragStart,(t=>this.controlStartDraggingTab(t))),this._sortableTab.on(l.dragStop,(t=>this.controlStopDraggingTab(t)))}controlStartDraggingTab(t){var i,o;const a=null===(i=null==t?void 0:t.dragEvent)||void 0===i?void 0:i.originalEvent,n=null==a?void 0:a.target,s=null===(o=null==n?void 0:n.tagName)||void 0===o?void 0:o.toUpperCase();!0===this._activeEditText||"EZ-ACTIONS-BUTTON"===s?null==t||t.cancel():this.canStartDrag.emit()}controlStopDraggingTab(t){t.data.newIndex!==t.data.oldIndex&&setTimeout((()=>{this.ezOrderChange.emit((t.data.newIndex||0)+1)}),500)}handleTabClick(t){this.selectedIndex=t.index,this._focusedIndex=t.index,this.selectedTab=t.tabKey,this.ezTabChange.emit(t),this.setFocusedBtn(!1,t.index),this.setFocusedTab(t.index)}handleSlotChange(t){const i=t.target.assignedElements()[0];i&&i.classList.add("tab-config__slot")}scrollBackward(){const t=this._scrollContainer;t&&(t.scrollLeft-=t.clientWidth)}scrollFoward(){const t=this._scrollContainer;if(t){let i=null;t.querySelectorAll(".tab-config__tab").forEach((o=>{o.getBoundingClientRect().right<t.clientWidth&&(i=o)})),t.scrollLeft=i.offsetLeft+i.offsetWidth}}updateScroll(){const t=this._scrollContainer;if(t){const{scrollWidth:i,clientWidth:o,scrollLeft:a}=t,n=i-o-Math.ceil(a);this._startHidden=t.scrollLeft>0,this._endHidden=n>0,this._startHidden?this._backwardButton.classList.remove("tab-config__hidden"):this._backwardButton.classList.add("tab-config__hidden"),this._endHidden?this._forwardButton.classList.remove("tab-config__hidden"):this._forwardButton.classList.add("tab-config__hidden")}}domScrollHandler(){window.clearTimeout(this._scrollCallBackScroll),this._scrollCallBackScroll=window.setTimeout((()=>{this.updateScroll()}),200)}setFocusedTab(t){window.clearTimeout(this._scrollCallBackFocus),this._scrollCallBackFocus=window.setTimeout((()=>{const i=this._scrollContainer.querySelector(`#tab${t}`);null==i||i.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}),200)}controlKeyEventEnter(t){t.preventDefault();const i=this._processedTabs[this._focusedIndex];this.handleTabClick(i),this.setFocusedTab(i.index)}controlKeyEventArrow(t){let i;if(t.key===f.arrowLeft)i=!1;else{if(t.key!==f.arrowRight)return;i=!0}this._focusedIndex=void 0===this._focusedIndex?!1===i?void 0!==this.selectedIndex?this.selectedIndex-1:void 0:void 0!==this.selectedIndex?this.selectedIndex+1:void 0:!1===i?this._focusedIndex-1:this._focusedIndex+1,this._focusedIndex<0?this._focusedIndex=0:this._focusedIndex>this._processedTabs.length-1&&(this._focusedIndex=this._processedTabs.length-1),this.setFocusedBtn(!0,this._focusedIndex),this.setFocusedTab(this._focusedIndex)}controlKeyEventEscape(t){t.preventDefault();const i=this._processedTabs[this.selectedIndex];this._focusedIndex=void 0,this.handleTabClick(i),this.setFocusedTab(this.selectedIndex)}setFocusedParam(t){!0!==this._activeEditText&&null!=t&&(t.key!==f.enter?t.key!==f.arrowLeft&&t.key!==f.arrowRight?t.key!==f.tab&&t.key!==f.escape||this.controlKeyEventEscape(t):this.controlKeyEventArrow(t):this.controlKeyEventEnter(t))}setFocusedBtn(t,i){this._scrollContainer.querySelectorAll(".tab-config__tab").forEach((o=>{o.classList.remove("tab-config__tab--is-focused"),o.id==="tab"+i&&t&&o.classList.add("tab-config__tab--is-focused")}))}getStyledLabel(t){const i=this._hostElem.querySelector(`#${t}`);if(null!=i)return{fontSize:window.getComputedStyle(i).getPropertyValue("font-size"),fontWeight:window.getComputedStyle(i).getPropertyValue("font-weight"),fontFamily:window.getComputedStyle(i).getPropertyValue("font-family")}}cancelEditText(t){var i;t.stopPropagation(),this._activeEditText=!1,null!=this._scrollContainer&&(null===(i=this._scrollContainer.querySelector(".tab-config__tab--is-active"))||void 0===i||i.focus())}handleActions(t,i){const{value:o}=t.detail;o===g.rename?(this._activeEditText=!0,this._activeEditTextIndex=i.index):o===g.hide||o===g.show?this.hideTab.emit(i):o===g.delete&&this.deleteTab.emit(i)}handleSaveEditionText(t){const{value:i,newValue:o}=t.detail;i!==o?this._processedTabs.forEach((a=>{a.label===i&&(a.label=o,this.cancelEditText(t),this.editionTitleTab.emit(t))})):this.cancelEditText(t)}onHideActions(t){const i=this._refTabActions[t];i&&i.isOpened().then((t=>{t&&(null==i||i.hideActions())}))}componentWillLoad(){this._application=e.getContextValue("__SNK__APPLICATION__"),null!=this._application&&(this._actionsHide=[{value:g.rename,label:this.getMessage("snkTabConfig.labelRename")},{value:g.hide,label:this.getMessage("snkTabConfig.labelHide")},{value:g.delete,label:this.getMessage("snkTabConfig.labelDelete")}],this._actionsShow=[{value:g.rename,label:this.getMessage("snkTabConfig.labelRename")},{value:g.show,label:this.getMessage("snkTabConfig.labelShow")},{value:g.delete,label:this.getMessage("snkTabConfig.labelDelete")}])}componentWillRender(){this._processedTabs=[],this.tabs&&this.tabs.split(",").forEach((t=>{t=t.trim(),this._processedTabs.push({label:t,tabKey:t,index:this._processedTabs.length})})),this.tabItems.forEach((t=>{t.label=t.label!==h.main?t.label:this.getMessage("snkFormConfig.form.mainArea"),t.index=this._processedTabs.length,this._processedTabs.push(t)}))}componentDidRender(){this.updateScroll(),this.controlSortableTab()}componentDidLoad(){b.addIDInfo(this._hostElem,"itemConfig"),this._processedTabs.forEach(((t,i)=>{const o={id:t.label};b.addIDInfo(this._hostElem.querySelector(`#tab${i}`),"itemConfig",o)}))}render(){return o(n,null,o("button",{class:"tab-config__backward-button",ref:t=>this._backwardButton=t,onClick:()=>this.scrollBackward()}),o("div",{class:"tab-config__lower-bar"}),o("div",{class:"tab-config__scroll",ref:t=>this._scrollContainer=t,onScroll:()=>this.domScrollHandler(),onKeyDown:t=>this.setFocusedParam(t),"data-draggable-parent":"tab"},this._processedTabs.map(((t,i)=>{const n="tab"+i,s=i===this.selectedIndex||this.selectedTab&&t.tabKey===this.selectedTab;return s&&(this.selectedTab=t.tabKey,this.selectedIndex=i),o("button",{id:n,class:"tab-config__tab"+(s?" tab-config__tab--is-active":""),onClick:()=>this.handleTabClick(t),onDblClick:()=>{this._activeEditText=!0,this._activeEditTextIndex=i},"data-draggable-element":i>0?"tab":"",onMouseLeave:()=>this.onHideActions(i),key:t.label},!0===this._activeEditText&&this._activeEditTextIndex===i&&i>0||o(a,null,i>0&&o("ez-icon",{iconName:t.leftIcon||"drag-indicator",class:"tab-config__left-icon"}),!1===t.visible&&i>0&&o("ez-icon",{iconName:t.leftIcon||"eye-off",class:"tab-config__left-icon tab-config__left-icon--eye-off"}),o("span",{class:"tab-config__tab-label"+(!1===t.visible&&i>0?" tab-config__tab-label-disabled":""),title:t.label},t.label),i>0&&o("ez-actions-button",{class:"tab-config__actions-button",size:"small",ref:t=>this._refTabActions[i]=t,actions:!1===t.visible?this._actionsShow:this._actionsHide,isTransparent:!0,arrowActive:!0,onEzAction:i=>this.handleActions(i,t)}),o("slot",{name:n,onSlotchange:t=>{this.handleSlotChange(t)}})),!0===this._activeEditText&&i>0&&this._activeEditTextIndex===i&&o("ez-text-edit",{value:t.label,styled:this.getStyledLabel(n),class:"tab-config__edit-text",onSaveEdition:t=>this.handleSaveEditionText(t),onCancelEdition:t=>this.cancelEditText(t)}))}))),o("button",{class:"tab-config__forward-button",ref:t=>this._forwardButton=t,onClick:()=>this.scrollFoward()}))}get _hostElem(){return s(this)}};_.style='@keyframes activate{0%{clip-path:inset(calc(100% - 3px) 50% 0px 50%)}100%{clip-path:inset(calc(100% - 3px) 0px 0px 0px)}}.sc-snk-tab-config-h{--snk-tab-config--backward-icon:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z"/></svg>\');--snk-tab-config--forward-icon:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z"/></svg>\');--snk-tab-config__lower-bar--background-color:var(--color--disable-primary, #e5eaf0);--snk-tab-config__lower-bar--border:2px solid var(--color--disable-primary, #e5eaf0);--snk-tab-config__tab--color:var(--text--primary, #626e82);--snk-tab-config__tab--font-family:var(--font-pattern, "Roboto");--snk-tab-config__tab--font-size:var(--title--small, 14px);--snk-tab-config__tab--padding:var(--space--small, 6px) var(--space--medium, 12px);--snk-tab-config__tab-is-active--color:var(--color--primary, #008561);--snk-tab-config__tab-hover--color:var(--color--secondary, #383c45);--snk-tab-config__tab-is-focused--border:1px dashed var(--color--primary, #008561);--snk-tab-config__tab-label--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--snk-tab-config__tab-label--margin-bottom:var(--space--extra-small, 3px);--snk-tab-config__new-button-icon--color:var(--color--secondary-700, #1C1D22);--snk-tab-config__forward-button--background-color:var(--text--primary, #626e82);--snk-tab-config__forward-button-hover--background-color:var(--color--primary, #008561);--snk-tab-config__left-icon--padding-right:var(--space--small, 6px);--snk-tab-config__left-icon--color:var(--text--disable, #AFB6C0);--snk-tab-config__tab-label-disabled--color:var(--text--disable, #AFB6C0);--snk-tab-config__slot--margin-left:var(--space--small, 6px);display:flex;position:relative;width:100%;overflow:hidden}.tab-config__scroll.sc-snk-tab-config{display:flex;width:100%;scroll-behavior:smooth;overflow-x:auto;scrollbar-width:none}.tab-config__lower-bar.sc-snk-tab-config{position:absolute;left:0%;right:0%;top:91%;bottom:0%;border-radius:2px;background-color:var(--snk-tab-config__lower-bar--background-color);border:var(--snk-tab-config__lower-bar--border)}.tab-config__tab.sc-snk-tab-config{display:flex;border:none;background-color:unset;cursor:pointer;align-items:center;justify-content:center;min-width:fit-content;color:var(--snk-tab-config__tab--color);font-family:var(--snk-tab-config__tab--font-family);font-size:var(--snk-tab-config__tab--font-size);padding:var(--snk-tab-config__tab--padding)}.tab-config__tab.sc-snk-tab-config:focus,.tab-config__forward-button.sc-snk-tab-config,.tab-config__backward-button.sc-snk-tab-config{outline:none}.tab-config__tab--is-active.sc-snk-tab-config{position:relative;color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab.sc-snk-tab-config:hover{color:var(--snk-tab-config__tab-hover--color)}.tab-config__tab--is-active.sc-snk-tab-config:hover{color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab--is-active.sc-snk-tab-config::after{content:"";position:absolute;width:100%;height:100%;clip-path:inset(calc(100% - 3px) 0px 0px 0px);animation:activate 0.25s ease-in-out;background-color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab--is-focused.sc-snk-tab-config{border:var(--snk-tab-config__tab-is-focused--border)}.tab-config__tab-label.sc-snk-tab-config{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-shadow:var(--snk-tab-config__tab-label--text-shadow);margin-bottom:var(--snk-tab-config__tab-label--margin-bottom)}.tab-config__forward-button.sc-snk-tab-config,.tab-config__backward-button.sc-snk-tab-config{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;width:16px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.tab-config__new-button.sc-snk-tab-config{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.tab-config__new-button.sc-snk-tab-config ez-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__new-button-icon--color)}.tab-config__backward-button.sc-snk-tab-config{left:0px;box-shadow:10px 10px 5px 5px white;background:white}.tab-config__forward-button.sc-snk-tab-config{box-shadow:10px 10px 5px 20px white;background:white}.tab-config__forward-button.sc-snk-tab-config::after,.tab-config__backward-button.sc-snk-tab-config::after{content:\'\';display:flex;width:10px;height:16px;background-color:var(--snk-tab-config__forward-button--background-color)}.tab-config__forward-button.sc-snk-tab-config::after{-webkit-mask-image:var(--snk-tab-config--forward-icon);mask-image:var(--snk-tab-config--forward-icon)}.tab-config__backward-button.sc-snk-tab-config::after{-webkit-mask-image:var(--snk-tab-config--backward-icon);mask-image:var(--snk-tab-config--backward-icon)}.tab-config__forward-button.sc-snk-tab-config:hover::after,.tab-config__backward-button.sc-snk-tab-config:hover::after{background-color:var(--snk-tab-config__forward-button-hover--background-color)}.tab-config__new-button.sc-snk-tab-config:hover ez-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__forward-button-hover--background-color)}.tab-config__hidden.sc-snk-tab-config{display:none}.tab-config__scroll.sc-snk-tab-config::-webkit-scrollbar{display:none}.tab-config__left-icon.sc-snk-tab-config{padding-right:var(--snk-tab-config__left-icon--padding-right);--ez-icon--color:var(--snk-tab-config__left-icon--color)}.tab-config__left-icon--eye-off.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__left-icon--color)}.tab-config__right-icon.sc-snk-tab-config{visibility:hidden;padding-left:var(--snk-tab-config__left-icon--padding-right)}.tab-config__tab.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{visibility:visible}.tab-config__tab--is-active.sc-snk-tab-config .tab-config__right-icon.sc-snk-tab-config{visibility:visible;--ez-icon--color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__tab-hover--color)}.tab-config__tab--is-active.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__tab-is-active--color)}.tab-config__actions-button.sc-snk-tab-config{--ez-actions-button__btn-action--min-width:100px;visibility:hidden;opacity:0;transition:visibility 1s linear, opacity 0.3s linear}.tab-config__tab.sc-snk-tab-config:hover .tab-config__actions-button.sc-snk-tab-config{visibility:visible;opacity:1;transition:visibility 0.2s linear, opacity 0.10s linear}[data-draggable-element].sc-snk-tab-config{cursor:grab}.tab-config__tab-label-disabled.sc-snk-tab-config{color:var(--snk-tab-config__tab-label-disabled--color)}.tab-config__slot.sc-snk-tab-config{margin-left:var(--snk-tab-config__slot--margin-left)}';export{_ as snk_tab_config}
|
1
|
+
import{r as t,c as i,h as o,F as a,H as n,g as s}from"./p-d2d301a6.js";import{S as c}from"./p-fa816fb2.js";import{ApplicationContext as e,ElementIDUtils as b}from"@sankhyalabs/core";import{C as r,a as l,K as f,T as g,b as h}from"./p-95ce311a.js";const _=class{constructor(o){t(this,o),this.ezTabChange=i(this,"ezTabChange",7),this.editionTitleTab=i(this,"editionTitleTab",7),this.deleteTab=i(this,"deleteTab",7),this.hideTab=i(this,"hideTab",7),this.ezOrderChange=i(this,"ezOrderChange",7),this.canStartDrag=i(this,"canStartDrag",7),this._refTabActions=[],this._processedTabs=void 0,this._activeEditText=void 0,this._activeEditTextIndex=void 0,this._actionsHide=[],this._actionsShow=[],this.selectedIndex=void 0,this.selectedTab=void 0,this.tabs=void 0,this.tabItems=void 0,this.messagesBuilder=void 0}getMessage(t,i){return this.messagesBuilder.getMessage(t,i)}controlSortableTab(){this._sortableTab&&this._sortableTab.destroy(),this._sortableTab=new c(this._hostElem.querySelectorAll('[data-draggable-parent="tab"]'),{draggable:'[data-draggable-element="tab"]',mirror:{constrainDimensions:!0},distance:r.dragStartDistance}),this._sortableTab.on(l.dragStart,(t=>this.controlStartDraggingTab(t))),this._sortableTab.on(l.dragStop,(t=>this.controlStopDraggingTab(t)))}controlStartDraggingTab(t){var i,o;const a=null===(i=null==t?void 0:t.dragEvent)||void 0===i?void 0:i.originalEvent,n=null==a?void 0:a.target,s=null===(o=null==n?void 0:n.tagName)||void 0===o?void 0:o.toUpperCase();!0===this._activeEditText||"EZ-ACTIONS-BUTTON"===s?null==t||t.cancel():this.canStartDrag.emit()}controlStopDraggingTab(t){t.data.newIndex!==t.data.oldIndex&&setTimeout((()=>{this.ezOrderChange.emit((t.data.newIndex||0)+1)}),500)}handleTabClick(t){this.selectedIndex=t.index,this._focusedIndex=t.index,this.selectedTab=t.tabKey,this.ezTabChange.emit(t),this.setFocusedBtn(!1,t.index),this.setFocusedTab(t.index)}handleSlotChange(t){const i=t.target.assignedElements()[0];i&&i.classList.add("tab-config__slot")}scrollBackward(){const t=this._scrollContainer;t&&(t.scrollLeft-=t.clientWidth)}scrollFoward(){const t=this._scrollContainer;if(t){let i=null;t.querySelectorAll(".tab-config__tab").forEach((o=>{o.getBoundingClientRect().right<t.clientWidth&&(i=o)})),t.scrollLeft=i.offsetLeft+i.offsetWidth}}updateScroll(){const t=this._scrollContainer;if(t){const{scrollWidth:i,clientWidth:o,scrollLeft:a}=t,n=i-o-Math.ceil(a);this._startHidden=t.scrollLeft>0,this._endHidden=n>0,this._startHidden?this._backwardButton.classList.remove("tab-config__hidden"):this._backwardButton.classList.add("tab-config__hidden"),this._endHidden?this._forwardButton.classList.remove("tab-config__hidden"):this._forwardButton.classList.add("tab-config__hidden")}}domScrollHandler(){window.clearTimeout(this._scrollCallBackScroll),this._scrollCallBackScroll=window.setTimeout((()=>{this.updateScroll()}),200)}setFocusedTab(t){window.clearTimeout(this._scrollCallBackFocus),this._scrollCallBackFocus=window.setTimeout((()=>{const i=this._scrollContainer.querySelector(`#tab${t}`);null==i||i.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}),200)}controlKeyEventEnter(t){t.preventDefault();const i=this._processedTabs[this._focusedIndex];this.handleTabClick(i),this.setFocusedTab(i.index)}controlKeyEventArrow(t){let i;if(t.key===f.arrowLeft)i=!1;else{if(t.key!==f.arrowRight)return;i=!0}this._focusedIndex=void 0===this._focusedIndex?!1===i?void 0!==this.selectedIndex?this.selectedIndex-1:void 0:void 0!==this.selectedIndex?this.selectedIndex+1:void 0:!1===i?this._focusedIndex-1:this._focusedIndex+1,this._focusedIndex<0?this._focusedIndex=0:this._focusedIndex>this._processedTabs.length-1&&(this._focusedIndex=this._processedTabs.length-1),this.setFocusedBtn(!0,this._focusedIndex),this.setFocusedTab(this._focusedIndex)}controlKeyEventEscape(t){t.preventDefault();const i=this._processedTabs[this.selectedIndex];this._focusedIndex=void 0,this.handleTabClick(i),this.setFocusedTab(this.selectedIndex)}setFocusedParam(t){!0!==this._activeEditText&&null!=t&&(t.key!==f.enter?t.key!==f.arrowLeft&&t.key!==f.arrowRight?t.key!==f.tab&&t.key!==f.escape||this.controlKeyEventEscape(t):this.controlKeyEventArrow(t):this.controlKeyEventEnter(t))}setFocusedBtn(t,i){this._scrollContainer.querySelectorAll(".tab-config__tab").forEach((o=>{o.classList.remove("tab-config__tab--is-focused"),o.id==="tab"+i&&t&&o.classList.add("tab-config__tab--is-focused")}))}getStyledLabel(t){const i=this._hostElem.querySelector(`#${t}`);if(null!=i)return{fontSize:window.getComputedStyle(i).getPropertyValue("font-size"),fontWeight:window.getComputedStyle(i).getPropertyValue("font-weight"),fontFamily:window.getComputedStyle(i).getPropertyValue("font-family")}}cancelEditText(t){var i;t.stopPropagation(),this._activeEditText=!1,null!=this._scrollContainer&&(null===(i=this._scrollContainer.querySelector(".tab-config__tab--is-active"))||void 0===i||i.focus())}handleActions(t,i){const{value:o}=t.detail;o===g.rename?(this._activeEditText=!0,this._activeEditTextIndex=i.index):o===g.hide||o===g.show?this.hideTab.emit(i):o===g.delete&&this.deleteTab.emit(i)}handleSaveEditionText(t){const{value:i,newValue:o}=t.detail;i!==o?this._processedTabs.forEach((a=>{a.label===i&&(a.label=o,this.cancelEditText(t),this.editionTitleTab.emit(t))})):this.cancelEditText(t)}onHideActions(t){const i=this._refTabActions[t];i&&i.isOpened().then((t=>{t&&(null==i||i.hideActions())}))}componentWillLoad(){this._application=e.getContextValue("__SNK__APPLICATION__"),null!=this._application&&(this._actionsHide=[{value:g.rename,label:this.getMessage("snkTabConfig.labelRename")},{value:g.hide,label:this.getMessage("snkTabConfig.labelHide")},{value:g.delete,label:this.getMessage("snkTabConfig.labelDelete")}],this._actionsShow=[{value:g.rename,label:this.getMessage("snkTabConfig.labelRename")},{value:g.show,label:this.getMessage("snkTabConfig.labelShow")},{value:g.delete,label:this.getMessage("snkTabConfig.labelDelete")}])}componentWillRender(){this._processedTabs=[],this.tabs&&this.tabs.split(",").forEach((t=>{t=t.trim(),this._processedTabs.push({label:t,tabKey:t,index:this._processedTabs.length})})),this.tabItems.forEach((t=>{t.label=t.label!==h.main?t.label:this.getMessage("snkFormConfig.form.mainArea"),t.index=this._processedTabs.length,this._processedTabs.push(t)}))}componentDidRender(){this.updateScroll(),this.controlSortableTab()}componentDidLoad(){b.addIDInfo(this._hostElem,"itemConfig"),this._processedTabs.forEach(((t,i)=>{const o={id:t.label};b.addIDInfo(this._hostElem.querySelector(`#tab${i}`),"itemConfig",o)}))}render(){return o(n,null,o("button",{class:"tab-config__backward-button",ref:t=>this._backwardButton=t,onClick:()=>this.scrollBackward()}),o("div",{class:"tab-config__lower-bar"}),o("div",{class:"tab-config__scroll",ref:t=>this._scrollContainer=t,onScroll:()=>this.domScrollHandler(),onKeyDown:t=>this.setFocusedParam(t),"data-draggable-parent":"tab"},this._processedTabs.map(((t,i)=>{const n="tab"+i,s=i===this.selectedIndex||this.selectedTab&&t.tabKey===this.selectedTab;return s&&(this.selectedTab=t.tabKey,this.selectedIndex=i),o("button",{id:n,class:"tab-config__tab"+(s?" tab-config__tab--is-active":""),onClick:()=>this.handleTabClick(t),onDblClick:()=>{this._activeEditText=!0,this._activeEditTextIndex=i},"data-draggable-element":i>0?"tab":"",onMouseLeave:()=>this.onHideActions(i),key:t.label},!0===this._activeEditText&&this._activeEditTextIndex===i&&i>0||o(a,null,i>0&&o("ez-icon",{iconName:t.leftIcon||"drag-indicator",class:"tab-config__left-icon"}),!1===t.visible&&i>0&&o("ez-icon",{iconName:t.leftIcon||"eye-off",class:"tab-config__left-icon tab-config__left-icon--eye-off"}),o("span",{class:"tab-config__tab-label"+(!1===t.visible&&i>0?" tab-config__tab-label-disabled":""),title:t.label},t.label),i>0&&o("ez-actions-button",{class:"tab-config__actions-button",size:"small",ref:t=>this._refTabActions[i]=t,actions:!1===t.visible?this._actionsShow:this._actionsHide,isTransparent:!0,arrowActive:!0,onEzAction:i=>this.handleActions(i,t)}),o("slot",{name:n,onSlotchange:t=>{this.handleSlotChange(t)}})),!0===this._activeEditText&&i>0&&this._activeEditTextIndex===i&&o("ez-text-edit",{value:t.label,styled:this.getStyledLabel(n),class:"tab-config__edit-text",onSaveEdition:t=>this.handleSaveEditionText(t),onCancelEdition:t=>this.cancelEditText(t)}))}))),o("button",{class:"tab-config__forward-button",ref:t=>this._forwardButton=t,onClick:()=>this.scrollFoward()}))}get _hostElem(){return s(this)}};_.style='@keyframes activate{0%{clip-path:inset(calc(100% - 3px) 50% 0px 50%)}100%{clip-path:inset(calc(100% - 3px) 0px 0px 0px)}}.sc-snk-tab-config-h{--snk-tab-config--backward-icon:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z"/></svg>\');--snk-tab-config--forward-icon:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z"/></svg>\');--snk-tab-config__lower-bar--background-color:var(--color--disable-primary, #e5eaf0);--snk-tab-config__lower-bar--border:2px solid var(--color--disable-primary, #e5eaf0);--snk-tab-config__tab--color:var(--text--primary, #626e82);--snk-tab-config__tab--font-family:var(--font-pattern, "Roboto");--snk-tab-config__tab--font-size:var(--title--small, 14px);--snk-tab-config__tab--padding:var(--space--small, 6px) var(--space--medium, 12px);--snk-tab-config__tab-is-active--color:var(--color--primary, #008561);--snk-tab-config__tab-hover--color:var(--color--secondary, #383c45);--snk-tab-config__tab-is-focused--border:1px dashed var(--color--primary, #008561);--snk-tab-config__tab-label--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--snk-tab-config__tab-label--margin-bottom:var(--space--extra-small, 3px);--snk-tab-config__new-button-icon--color:var(--color--secondary-700, #1C1D22);--snk-tab-config__forward-button--background-color:var(--text--primary, #626e82);--snk-tab-config__forward-button-hover--background-color:var(--color--primary, #008561);--snk-tab-config__left-icon--padding-right:var(--space--small, 6px);--snk-tab-config__left-icon--color:var(--text--disable, #AFB6C0);--snk-tab-config__tab-label-disabled--color:var(--text--disable, #AFB6C0);--snk-tab-config__slot--margin-left:var(--space--small, 6px);display:flex;position:relative;width:100%;overflow:hidden}.tab-config__scroll.sc-snk-tab-config{display:flex;width:100%;scroll-behavior:smooth;overflow-x:auto;scrollbar-width:none}.tab-config__lower-bar.sc-snk-tab-config{position:absolute;left:0%;right:0%;top:91%;bottom:0%;border-radius:2px;background-color:var(--snk-tab-config__lower-bar--background-color);border:var(--snk-tab-config__lower-bar--border)}.tab-config__tab.sc-snk-tab-config{display:flex;border:none;background-color:unset;cursor:pointer;align-items:center;justify-content:center;min-width:fit-content;color:var(--snk-tab-config__tab--color);font-family:var(--snk-tab-config__tab--font-family);font-size:var(--snk-tab-config__tab--font-size);padding:var(--snk-tab-config__tab--padding)}.tab-config__tab.sc-snk-tab-config:focus,.tab-config__forward-button.sc-snk-tab-config,.tab-config__backward-button.sc-snk-tab-config{outline:none}.tab-config__tab--is-active.sc-snk-tab-config{position:relative;color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab.sc-snk-tab-config:hover{color:var(--snk-tab-config__tab-hover--color)}.tab-config__tab--is-active.sc-snk-tab-config:hover{color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab--is-active.sc-snk-tab-config::after{content:"";position:absolute;width:100%;height:100%;clip-path:inset(calc(100% - 3px) 0px 0px 0px);animation:activate 0.25s ease-in-out;background-color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab--is-focused.sc-snk-tab-config{border:var(--snk-tab-config__tab-is-focused--border)}.tab-config__tab-label.sc-snk-tab-config{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-shadow:var(--snk-tab-config__tab-label--text-shadow);margin-bottom:var(--snk-tab-config__tab-label--margin-bottom)}.tab-config__forward-button.sc-snk-tab-config,.tab-config__backward-button.sc-snk-tab-config{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;width:16px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.tab-config__new-button.sc-snk-tab-config{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.tab-config__new-button.sc-snk-tab-config ez-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__new-button-icon--color)}.tab-config__backward-button.sc-snk-tab-config{left:0px;box-shadow:10px 10px 5px 5px white;background:white}.tab-config__forward-button.sc-snk-tab-config{box-shadow:10px 10px 5px 20px white;background:white}.tab-config__forward-button.sc-snk-tab-config::after,.tab-config__backward-button.sc-snk-tab-config::after{content:\'\';display:flex;width:10px;height:16px;background-color:var(--snk-tab-config__forward-button--background-color)}.tab-config__forward-button.sc-snk-tab-config::after{-webkit-mask-image:var(--snk-tab-config--forward-icon);mask-image:var(--snk-tab-config--forward-icon)}.tab-config__backward-button.sc-snk-tab-config::after{-webkit-mask-image:var(--snk-tab-config--backward-icon);mask-image:var(--snk-tab-config--backward-icon)}.tab-config__forward-button.sc-snk-tab-config:hover::after,.tab-config__backward-button.sc-snk-tab-config:hover::after{background-color:var(--snk-tab-config__forward-button-hover--background-color)}.tab-config__new-button.sc-snk-tab-config:hover ez-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__forward-button-hover--background-color)}.tab-config__hidden.sc-snk-tab-config{display:none}.tab-config__scroll.sc-snk-tab-config::-webkit-scrollbar{display:none}.tab-config__left-icon.sc-snk-tab-config{padding-right:var(--snk-tab-config__left-icon--padding-right);--ez-icon--color:var(--snk-tab-config__left-icon--color)}.tab-config__left-icon--eye-off.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__left-icon--color)}.tab-config__right-icon.sc-snk-tab-config{visibility:hidden;padding-left:var(--snk-tab-config__left-icon--padding-right)}.tab-config__tab.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{visibility:visible}.tab-config__tab--is-active.sc-snk-tab-config .tab-config__right-icon.sc-snk-tab-config{visibility:visible;--ez-icon--color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__tab-hover--color)}.tab-config__tab--is-active.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__tab-is-active--color)}.tab-config__actions-button.sc-snk-tab-config{--ez-actions-button__btn-action--min-width:100px;visibility:hidden;opacity:0;transition:visibility 1s linear, opacity 0.3s linear}.tab-config__tab.sc-snk-tab-config:hover .tab-config__actions-button.sc-snk-tab-config{visibility:visible;opacity:1;transition:visibility 0.2s linear, opacity 0.10s linear}[data-draggable-element].sc-snk-tab-config{cursor:grab}.tab-config__tab-label-disabled.sc-snk-tab-config{color:var(--snk-tab-config__tab-label-disabled--color)}.tab-config__slot.sc-snk-tab-config{margin-left:var(--snk-tab-config__slot--margin-left)}';export{_ as snk_tab_config}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as o,c as r,h as t,g as i}from"./p-d2d301a6.js";import{ApplicationContext as n}from"@sankhyalabs/core";import{
|
1
|
+
import{r as o,c as r,h as t,g as i}from"./p-d2d301a6.js";import{ApplicationContext as n}from"@sankhyalabs/core";import{V as a}from"./p-95ce311a.js";import{A as s}from"./p-dc36cfbf.js";const l=class{constructor(t){o(this,t),this.configSelected=r(this,"configSelected",7),this.openConfig=r(this,"openConfig",7),this.save=r(this,"save",7),this.cancel=r(this,"cancel",7),this._opened=!1,this._permissions=void 0,this.showActionButtons=!1,this.configName=void 0,this.resourceID=void 0,this.viewMode=a.GRID,this.customContainerId=void 0,this.messagesBuilder=void 0}async open(){this._opened=!0,this.configSelected.emit(this.getViewModeValue()),this.modal.heightMode="full"}async close(){this.closeConfig()}closeConfig(){this._opened=!1}onViewModeChanged(o){this.viewMode=null==o?void 0:o.detail,this.configSelected.emit(this.viewMode)}onClickOpenConfig(){this.openConfig.emit(this.viewMode)}isAllowed(o){return!s[o]||!!this._permissions&&(this._permissions.isSup||this._permissions[o])}enableModeConfig(){return!(!this.isAllowed(s.CONFIG_GRID)||!this.isAllowed(s.CONFIG))}getViewModeValue(){return null!=this._permissions&&(this.isAllowed(s.CONFIG_GRID)?this.isAllowed(s.CONFIG)||(this.viewMode=a.GRID):this.viewMode=a.FORM),this.viewMode}getMessage(o){var r;return null===(r=this.messagesBuilder)||void 0===r?void 0:r.getMessage(o,{})}componentWillLoad(){this._application=n.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess(this.resourceID).then((o=>this._permissions=o)):this._permissions={}}componentDidRender(){if(!this.customContainerId)return;const o=document.querySelector(`#${this.customContainerId}`),r=null==o?void 0:o.querySelector("#SnkConfigContainerSlot");if(!r)return;const t=r.firstElementChild;if(!t)return;const i=this._element.querySelector("#slotContainer");null==i||i.appendChild(t)}render(){return t("ez-modal",{ref:o=>this.modal=o,opened:this._opened,"close-esc":!1,"close-outside-click":!1,"modal-size":"small",scrim:"light"},t("div",{class:"snk-configurator"},t("div",{class:"snk-configurator__header"},t("label",{class:"snk-configurator__title"},this.getMessage("snkConfigurator.titleConfigurations")),t("div",{class:"snk-configurator__button-close"},t("ez-button",{mode:"icon",iconName:"close",size:"medium",onClick:()=>this.closeConfig()}))),t("div",{class:"snk-configurator__main"},t("ez-collapsible-box",{boxBordered:!0,label:"Modo de visualização ",headerSize:"medium",class:"snk-configurator__collapsable-box"},t("ez-radio-button",{value:this.getViewModeValue().toString(),onEzChange:o=>this.onViewModeChanged(o),enabled:this.enableModeConfig()},t("ez-radio-button-option",{label:this.getMessage("snkConfigurator.labelGrid"),value:a.GRID}),t("ez-radio-button-option",{label:this.getMessage("snkConfigurator.labelForm"),value:a.FORM})),t("div",{class:"snk-configurator__collsable-box-action"},t("ez-button",{label:this.getMessage(this.viewMode===a.GRID?"snkConfigurator.labelConfigGrid":"snkConfigurator.labelConfigForm"),class:"snk-configurator__button-config ez-button--secondary",onClick:()=>this.onClickOpenConfig(),id:"openConfigurator"}))),t("div",{id:"slotContainer",class:"snk-configurator__outline"})),this.showActionButtons&&t("div",{class:"snk-configurator__action-buttons"},t("ez-button",{label:"Cancelar",onClick:()=>this.cancel.emit()}),t("ez-button",{label:"Salvar",onClick:()=>this.save.emit(),class:"ez-button--primary"}))))}get _element(){return i(this)}};l.style='.sc-snk-configurator-h{--snk-configurator__button-close--padding-left:var(--space--medium, 12px);--snk-configurator__title--color:var(--title--primary, #2B3A54);--snk-configurator__title--font-family:var(--font-pattern, "Roboto");--snk-configurator__title--font-size:var(--title--large, 20px);--snk-configurator__title--font-weight:var(--text-weight--extra-large, 700);--snk-configurator__subtitle--color:var(--title--primary, #2B3A54);--snk-configurator__subtitle--font-family:var(--font-pattern, "Roboto");--snk-configurator__subtitle--font-size:var(--text--medium, 14px);--snk-configurator__subtitle--font-weight:var(--text-weight--large, 600);--snk-configurator__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-configurator__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-configurator__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-configurator__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-configurator__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-configurator__scrollbar--width:var(--space--medium, 12px)}.snk-configurator.sc-snk-configurator{display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}.snk-configurator__collsable-box-action.sc-snk-configurator{width:100%}.snk-configurator__action-buttons.sc-snk-configurator{display:flex;flex-direction:row;justify-content:flex-end;gap:var(--space--medium)}.snk-configurator__outline.sc-snk-configurator{display:flex;flex-direction:column;gap:var(--space--small);margin-top:var(--space--small);margin-bottom:var(--space--large)}@media screen and (min-width: 480px){.snk-configurator.sc-snk-configurator{width:359px;max-width:359px}}.snk-configurator__button-config.sc-snk-configurator{--ez-button--min-width:100%}.snk-configurator__header.sc-snk-configurator{display:flex;justify-content:space-between;align-items:center;width:100%}.snk-configurator__title.sc-snk-configurator{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-configurator__title--color);font-size:var(--snk-configurator__title--font-size);font-family:var(--snk-configurator__title--font-family);font-weight:var(--snk-configurator__title--font-weight)}.snk-configurator__subtitle.sc-snk-configurator{display:flex;margin:0;padding-top:var(--space--medium);padding-bottom:var(--space--small);color:var(--snk-configurator__subtitle--color);font-size:var(--snk-configurator__subtitle--font-size);font-family:var(--snk-configurator__subtitle--font-family);font-weight:var(--snk-configurator__subtitle--font-weight)}.snk-configurator__button-close.sc-snk-configurator{padding-left:var(--snk-configurator__button-close--padding-left)}.snk-configurator__main.sc-snk-configurator{overflow-y:auto;scrollbar-width:thin;margin:var(--space--medium) 0;scrollbar-color:var(--snk-configurator__scrollbar--color-clicked) var(--snk-configurator__scrollbar--color-background)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar{background-color:var(--snk-configurator__scrollbar--color-background);width:var(--snk-configurator__scrollbar--width);max-width:var(--snk-configurator__scrollbar--width);min-width:var(--snk-configurator__scrollbar--width)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-track{background-color:var(--snk-configurator__scrollbar--color-background);border-radius:var(--snk-configurator__scrollbar--border-radius)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb{background-color:var(--snk-configurator__scrollbar--color-default);border-radius:var(--snk-configurator__scrollbar--border-radius)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:vertical:hover,.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-configurator__scrollbar--color-hover)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:vertical:active,.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-configurator__scrollbar--color-clicked)}';export{l as snk_configurator}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,h as e,H as i,g as s}from"./p-d2d301a6.js";import{P as r}from"./p-8d884fab.js";import{ApplicationUtils as h}from"@sankhyalabs/ezui/dist/collection/utils";import{ElementIDUtils as l,ApplicationContext as n}from"@sankhyalabs/core";import a from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container/modal-button-status";const o=class{constructor(e){t(this,e),this.APPLY="OK",this.CANCEL="CANCEL",this.CLOSE="CLOSE",this.REMOTE_PRINTERS_TAB="0",this.LOCAL_PRINTERS_TAB="1",this._hasRemotePrinters=!1,this._hasLocalPrinters=!1,this._localPrinters=[],this._isSingleJob=!1,this._saveSubstitute=!1,this.buildIdTabSelector=()=>{const t=[{label:this.getMessage("snkPrintSelector.title.localPrintersTab"),tabKey:this.LOCAL_PRINTERS_TAB,index:Number(this.LOCAL_PRINTERS_TAB)}];return this._printServerActive&&t.unshift({label:this.getMessage("snkPrintSelector.title.remotePrintersTab"),tabKey:this.REMOTE_PRINTERS_TAB,index:Number(this.REMOTE_PRINTERS_TAB)}),[...t]},this._printServerActive=!1,this._selectedPrinter=void 0,this._remotePrintersDataSource=[],this._localPrintersDataSource=[],this._printJobData=void 0}async openPrintSelector(t){return new Promise((e=>{this._printJobData=t,this._isSingleJob=1===this._printJobData.pendingPrinters.length,this._printServerActive=this._printJobData.printServerActive,this._printServerActive?this.buildRemotePrinters():(this.buildLocalPrinters(),this._viewStack.show(+this.LOCAL_PRINTERS_TAB)),this._ezPopup.opened=!0,this._printerResolver=e}))}closePrintSelector(){this._ezPopup.opened=!1,this.element.remove()}handleModalAction(t){switch(t){case this.APPLY:this.handleApply();break;case this.CANCEL:case this.CLOSE:this.handleCancel()}}async handleCancel(){await h.confirm(this.getMessage("snkPrintSelector.title.warning"),this.getMessage("snkPrintSelector.message.canceledPrint"))&&(this.closePrintSelector(),this._printerResolver({selectedPrinter:void 0,saveSubstitute:!1}))}handleApply(){this._printerResolver({selectedPrinter:this._selectedPrinter,saveSubstitute:this._saveSubstitute}),this.closePrintSelector()}onChangeTab(t){t.detail.tabKey===this.LOCAL_PRINTERS_TAB&&this.buildLocalPrinters(),this._viewStack.show(+t.detail.tabKey)}buildRemotePrinters(){const t=[];this._printJobData.printServers.forEach((e=>{t.push({group:e.printServerUri,items:e.printerList.map((t=>({label:t.printerName,group:e.printServerUri})))})})),this._remotePrintersDataSource=t,this._hasRemotePrinters=this._remotePrintersDataSource.length>0}buildLocalPrinters(){this._localPrintersDataSource.length>0||(this._localPrinters=r.getInstance().getLocalPrinters(),this._localPrintersDataSource=this._localPrinters.map((t=>({label:t.nome}))),this._hasLocalPrinters=this._localPrintersDataSource.length>0)}onSelectPrinter(t,e){if(e)return this._hasRemotePrinters&&this._remotePrintersList.removeSelection(),void(this._selectedPrinter=this._localPrinters.find((e=>e.nome===t.label)));this._hasLocalPrinters&&this._localPrintersList.removeSelection();const i=this._printJobData.printServers.find((e=>e.printServerUri===t.group));this._selectedPrinter=null==i?void 0:i.printerList.find((e=>e.printerName===t.label))}renderNoPrinters(){return e("div",{class:"ez-flex ez-flex--justify-center ez-flex--align-items-center ez-size-height--full ez-size-width--full"},e("span",{class:"ez-text ez-text--primary ez-text--medium"},this.getMessage("snkPrintSelector.message.noPrinters")))}buildPrinterIcon(){return e("ez-icon",{iconName:"print",style:{marginRight:"var(--space--small)"}})}getElementID(t){return{[l.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:l.getInternalIDInfo(t)}}getMessage(t){return this._application.messagesBuilder.getMessage(t,void 0)}componentWillLoad(){this._application=n.getContextValue("__SNK__APPLICATION__")}componentDidLoad(){this.element&&l.addIDInfo(this.element)}render(){return e(i,null,e("ez-popup",Object.assign({size:"small",heightMode:"full",useHeader:!1,ref:t=>this._ezPopup=t},this.getElementID("snk-print-selector")),e("ez-modal-container",{modalTitle:this.getMessage("snkPrintSelector.title.printerSelection"),okButtonLabel:this.getMessage("snkPrintSelector.button.print"),okButtonStatus:this._selectedPrinter?a.ENABLED:a.DISABLED,cancelButtonLabel:this.getMessage("snkPrintSelector.button.cancel"),onEzModalAction:t=>this.handleModalAction(t.detail)},this._isSingleJob&&e("div",{class:"ez-flex ez-margin-bottom--large"},e("div",{class:"ez-flex ez-margin-right--large"},e("span",{class:"ez-text ez-text--bold ez-text--medium ez-padding-right--small"},this.getMessage("snkPrintSelector.subtitle.document")),e("span",{class:"ez-text ez-text--primary ez-text--medium"},this._printJobData.pendingPrinters[0].docTypeDescription)),e("div",{class:"ez-flex ez-margin-right--large"},e("span",{class:"ez-text ez-text--bold ez-text--medium ez-padding-right--small"},this.getMessage("snkPrintSelector.subtitle.jobs")),e("span",{class:"ez-text ez-text--primary ez-text--medium"},this._printJobData.pendingPrinters[0].printJobCount))),e("ez-tabselector",{tabs:this.buildIdTabSelector(),onEzChange:t=>this.onChangeTab(t),selectedTab:this._printServerActive?this.REMOTE_PRINTERS_TAB:this.LOCAL_PRINTERS_TAB}),e("ez-view-stack",{ref:t=>this._viewStack=t},e("stack-item",{hidePolicy:"hide"},this._printServerActive&&e("div",{class:"list-scroll ez-size-height--full "+(this._isSingleJob?"with-header":"without-header")},e("ez-list",{ref:t=>this._remotePrintersList=t,class:"ez-padding-top--medium "+(this._hasRemotePrinters?"":"hidden"),dataSource:this._remotePrintersDataSource,onEzSelectItem:t=>this.onSelectPrinter(t.detail,!1),itemLeftSlotBuilder:this.buildPrinterIcon,useGroups:!0,ezSelectable:!0,hoverFeedback:!0,"data-element-id":"remotePrintersList"}),!this._hasRemotePrinters&&this.renderNoPrinters())),e("stack-item",{hidePolicy:"hide"},e("div",{class:"list-scroll ez-size-height--full "+(this._isSingleJob?"with-header":"without-header")},e("ez-list",{ref:t=>this._localPrintersList=t,class:"ez-padding-top--medium "+(this._hasLocalPrinters?"":"hidden"),dataSource:this._localPrintersDataSource,onEzSelectItem:t=>this.onSelectPrinter(t.detail,!0),itemLeftSlotBuilder:this.buildPrinterIcon,ezSelectable:!0,hoverFeedback:!0}),!this._hasLocalPrinters&&this.renderNoPrinters()))),e("ez-check",{label:this.getMessage("snkPrintSelector.message.savePrinter"),onEzChange:t=>this._saveSubstitute=t.detail
|
1
|
+
import{r as t,h as e,H as i,g as s}from"./p-d2d301a6.js";import{P as r}from"./p-8d884fab.js";import{ApplicationUtils as h}from"@sankhyalabs/ezui/dist/collection/utils";import{ElementIDUtils as l,ApplicationContext as n}from"@sankhyalabs/core";import a from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container/modal-button-status";const o=class{constructor(e){t(this,e),this.APPLY="OK",this.CANCEL="CANCEL",this.CLOSE="CLOSE",this.REMOTE_PRINTERS_TAB="0",this.LOCAL_PRINTERS_TAB="1",this._hasRemotePrinters=!1,this._hasLocalPrinters=!1,this._localPrinters=[],this._isSingleJob=!1,this._saveSubstitute=!1,this.buildIdTabSelector=()=>{const t=[{label:this.getMessage("snkPrintSelector.title.localPrintersTab"),tabKey:this.LOCAL_PRINTERS_TAB,index:Number(this.LOCAL_PRINTERS_TAB)}];return this._printServerActive&&t.unshift({label:this.getMessage("snkPrintSelector.title.remotePrintersTab"),tabKey:this.REMOTE_PRINTERS_TAB,index:Number(this.REMOTE_PRINTERS_TAB)}),[...t]},this._printServerActive=!1,this._selectedPrinter=void 0,this._remotePrintersDataSource=[],this._localPrintersDataSource=[],this._printJobData=void 0}async openPrintSelector(t){return new Promise((e=>{this._printJobData=t,this._isSingleJob=1===this._printJobData.pendingPrinters.length,this._printServerActive=this._printJobData.printServerActive,this._printServerActive?this.buildRemotePrinters():(this.buildLocalPrinters(),this._viewStack.show(+this.LOCAL_PRINTERS_TAB)),this._ezPopup.opened=!0,this._printerResolver=e}))}closePrintSelector(){this._ezPopup.opened=!1,this.element.remove()}handleModalAction(t){switch(t){case this.APPLY:this.handleApply();break;case this.CANCEL:case this.CLOSE:this.handleCancel()}}async handleCancel(){await h.confirm(this.getMessage("snkPrintSelector.title.warning"),this.getMessage("snkPrintSelector.message.canceledPrint"))&&(this.closePrintSelector(),this._printerResolver({selectedPrinter:void 0,saveSubstitute:!1}))}handleApply(){this._printerResolver({selectedPrinter:this._selectedPrinter,saveSubstitute:this._saveSubstitute}),this.closePrintSelector()}onChangeTab(t){t.detail.tabKey===this.LOCAL_PRINTERS_TAB&&this.buildLocalPrinters(),this._viewStack.show(+t.detail.tabKey)}buildRemotePrinters(){const t=[];this._printJobData.printServers.forEach((e=>{t.push({group:e.printServerUri,items:e.printerList.map((t=>({label:t.printerName,group:e.printServerUri})))})})),this._remotePrintersDataSource=t,this._hasRemotePrinters=this._remotePrintersDataSource.length>0}buildLocalPrinters(){this._localPrintersDataSource.length>0||(this._localPrinters=r.getInstance().getLocalPrinters(),this._localPrintersDataSource=this._localPrinters.map((t=>({label:t.nome}))),this._hasLocalPrinters=this._localPrintersDataSource.length>0)}onSelectPrinter(t,e){if(e)return this._hasRemotePrinters&&this._remotePrintersList.removeSelection(),void(this._selectedPrinter=this._localPrinters.find((e=>e.nome===t.label)));this._hasLocalPrinters&&this._localPrintersList.removeSelection();const i=this._printJobData.printServers.find((e=>e.printServerUri===t.group));this._selectedPrinter=null==i?void 0:i.printerList.find((e=>e.printerName===t.label))}renderNoPrinters(){return e("div",{class:"ez-flex ez-flex--justify-center ez-flex--align-items-center ez-size-height--full ez-size-width--full"},e("span",{class:"ez-text ez-text--primary ez-text--medium"},this.getMessage("snkPrintSelector.message.noPrinters")))}buildPrinterIcon(){return e("ez-icon",{iconName:"print",style:{marginRight:"var(--space--small)"}})}getElementID(t){return{[l.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:l.getInternalIDInfo(t)}}getMessage(t){return this._application.messagesBuilder.getMessage(t,void 0)}componentWillLoad(){this._application=n.getContextValue("__SNK__APPLICATION__")}componentDidLoad(){this.element&&l.addIDInfo(this.element)}render(){return e(i,null,e("ez-popup",Object.assign({size:"small",heightMode:"full",useHeader:!1,ref:t=>this._ezPopup=t},this.getElementID("snk-print-selector")),e("ez-modal-container",{modalTitle:this.getMessage("snkPrintSelector.title.printerSelection"),okButtonLabel:this.getMessage("snkPrintSelector.button.print"),okButtonStatus:this._selectedPrinter?a.ENABLED:a.DISABLED,cancelButtonLabel:this.getMessage("snkPrintSelector.button.cancel"),onEzModalAction:t=>this.handleModalAction(t.detail)},this._isSingleJob&&e("div",{class:"ez-flex ez-margin-bottom--large"},e("div",{class:"ez-flex ez-margin-right--large"},e("span",{class:"ez-text ez-text--bold ez-text--medium ez-padding-right--small"},this.getMessage("snkPrintSelector.subtitle.document")),e("span",{class:"ez-text ez-text--primary ez-text--medium"},this._printJobData.pendingPrinters[0].docTypeDescription)),e("div",{class:"ez-flex ez-margin-right--large"},e("span",{class:"ez-text ez-text--bold ez-text--medium ez-padding-right--small"},this.getMessage("snkPrintSelector.subtitle.jobs")),e("span",{class:"ez-text ez-text--primary ez-text--medium"},this._printJobData.pendingPrinters[0].printJobCount))),e("ez-tabselector",{tabs:this.buildIdTabSelector(),onEzChange:t=>this.onChangeTab(t),selectedTab:this._printServerActive?this.REMOTE_PRINTERS_TAB:this.LOCAL_PRINTERS_TAB}),e("ez-view-stack",{ref:t=>this._viewStack=t},e("stack-item",{hidePolicy:"hide"},this._printServerActive&&e("div",{class:"list-scroll ez-size-height--full "+(this._isSingleJob?"with-header":"without-header")},e("ez-list",{ref:t=>this._remotePrintersList=t,class:"ez-padding-top--medium "+(this._hasRemotePrinters?"":"hidden"),dataSource:this._remotePrintersDataSource,onEzSelectItem:t=>this.onSelectPrinter(t.detail,!1),itemLeftSlotBuilder:this.buildPrinterIcon,useGroups:!0,ezSelectable:!0,hoverFeedback:!0,"data-element-id":"remotePrintersList"}),!this._hasRemotePrinters&&this.renderNoPrinters())),e("stack-item",{hidePolicy:"hide"},e("div",{class:"list-scroll ez-size-height--full "+(this._isSingleJob?"with-header":"without-header")},e("ez-list",{ref:t=>this._localPrintersList=t,class:"ez-padding-top--medium "+(this._hasLocalPrinters?"":"hidden"),dataSource:this._localPrintersDataSource,onEzSelectItem:t=>this.onSelectPrinter(t.detail,!0),itemLeftSlotBuilder:this.buildPrinterIcon,ezSelectable:!0,hoverFeedback:!0}),!this._hasLocalPrinters&&this.renderNoPrinters()))),e("ez-check",{label:this.getMessage("snkPrintSelector.message.savePrinter"),onEzChange:t=>this._saveSubstitute=t.detail}))))}get element(){return s(this)}};o.style=".sc-snk-print-selector-h{max-height:100%}ez-modal-container.sc-snk-print-selector{--ez-modal-container-overflow-y:hidden}ez-list.sc-snk-print-selector{height:100%}.list-scroll.sc-snk-print-selector{height:100%;overflow-y:auto;padding-right:var(--snk-grid-config__main--padding-right)}.with-header.sc-snk-print-selector{max-height:calc(100% - 125px)}.without-header.sc-snk-print-selector{max-height:calc(100% - 85px)}.list-scroll.sc-snk-print-selector::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}.hidden.sc-snk-print-selector{display:none}";export{o as snk_print_selector}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import{ObjectUtils as t,DataUnit as e,DataType as r,DateUtils as n,StringUtils as s,ChangeOperation as a,ApplicationContext as i,UserInterface as o,DataUnitStorage as c}from"@sankhyalabs/core";import{D as l,d as u}from"./p-f3434fc4.js";import{DISTINCT_FILTER_NAME_PREFIX as d}from"@sankhyalabs/ezui/dist/collection/utils/constants";import{DataUnitTransient as h}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{ColumnFilterManager as m}from"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import f from"@sankhyalabs/core/dist/utils/SortingUtils";import{R as _}from"./p-688dcb4c.js";class g{constructor(t){this._list=[],this._equalsFunction=t}async load(t,e,r,n){let s=[].concat(this._list);null!=t&&(s=this._list.filter((e=>t(e)))),null!=e&&(s=s.sort(e));const a=s.length;if(null!=n){const t=r||0;s=s.slice(t,n?t+n:s.length)}return Promise.resolve({result:s,count:a})}async distict(t){const e=[];let r=!1;for(const n of this._list){const s=t(n);null!=s&&(null!=s.value?e.push(s):r=!0)}return r&&e.push({key:"",value:null}),Promise.resolve(new Map(e.map((t=>[t.key,t.value]))))}async push(t){this._list.push(...t)}async clear(){this._list=[]}async delete(t){this._list=this._list.filter((e=>{for(const r of t)if(this._equalsFunction(e,r))return!1;return!0}))}async update(t){this._list=this._list.map((e=>{const r=t.find((t=>this._equalsFunction(e,t)));return null==r?e:r}))}async insert(t,e){const r=this._list.indexOf(t);-1!=r?this._list=this._list.slice(0,r).concat(e).concat(this._list.slice(r)):this._list.push(...e)}isOperating(){return!0}async isEmpty(){return Promise.resolve(0===this._list.length)}async count(){return Promise.resolve(this._list.length)}getFromCache(){return t.copy(this._list)}}class p{static setLoadingStatus(t,e){this._loadingStatus.set(t.name,e)}static isCacheEnabled(t){return!0}static cacheRecords(t,e,r,n){p.setLoadingStatus(t,n),p.isCacheEnabled(t)?this.getRepository(t).push(e):r&&this._repositories.delete(t.name)}static getSortingFunction(t,e){return f.getSortingFunction(t,e)}static async getDistinct(t,e){if(!p.isCacheEnabled(t))return Promise.resolve(m.compileDistinct(e,t));let r;const n=t.getLastLoadRequest();if(null!=n){const s=m.getColumnFilters(n.filters,e);r=m.getFilterFunction(t,Array.from(s.values()))}return new Promise(((n,s)=>{p.getRepository(t).distict((n=>{if(null!=r&&!r(n))return;const s=n[e];if(null==s)return{key:null,value:null};const a=null!=s.value?s.value:s;return{key:t.getFormattedValue(e,s),value:a}})).then((t=>{n(null!=t?Array.from(t.entries()).map((([t,e])=>({label:t,value:e,check:!0}))):void 0)})).catch((t=>s(t)))}))}static async loadData(t,r,n){try{if(p.isCacheEnabled(t)){if(["EZ_GRID_LOADING_SOURCE",e.CHANGING_PAGE_LOADING_SOURCE,e.ALL_RECORDS_SELECTION_SOURCE].includes(r.source)&&!await p.getRepository(t).isEmpty())return p.loadFromCache(t,r);p.getRepository(t).clear().catch((()=>{}))}return n(t,r)}catch(t){return console.error(t),Promise.reject(t)}}static insertRecords(t,e,r){p.isCacheEnabled(t)&&p.getRepository(t).insert(e,r)}static updateRecords(t,e){p.isCacheEnabled(t)&&p.getRepository(t).update(e)}static removeRecords(t,e){p.isCacheEnabled(t)&&p.getRepository(t).delete(e)}static async countRecords(t){return p.isCacheEnabled(t)?p.getRepository(t).count():Promise.resolve(0)}static getRepository(t){const e=t.name;return p._repositories.has(e)||p._repositories.set(e,new g(((t,e)=>t.__record__id__===e.__record__id__))),p._repositories.get(e)}static async loadFromCache(t,e){return new Promise(((r,n)=>{const s=m.getColumnFilters(e.filters,""),{limit:a,offset:i,sort:o}=e;p.getRepository(t).load(m.getFilterFunction(t,Array.from(s.values())),p.getSortingFunction(t,o),i,a).then((e=>{const n=p._loadingStatus.get(t.name),{count:s,result:o}=e,c=0==s?0:i+1,l=i+Math.min(o.length,a);r({records:o,paginationInfo:{count:s,currentPage:i/a,firstRecord:c,lastRecord:l,hasMore:n||l<s,total:n?void 0:s}})})).catch((t=>n(t)))}))}static getCachedRecords(t){return p.getRepository(t).getFromCache()}}function y(t,e,r){let n=t?[...t]:[];n=function(t,e,r){const n=m.getColumnFilters(r,"");if(!(null==n?void 0:n.size))return t;const s=m.getFilterFunction(e,Array.from(n.values()));return null==s?t:t.filter(s)}(n,e,r.filters),n=function(t,e,r){if(null==r||0==r.length)return t;const n=p.getSortingFunction(e,r);return null==n?t:t.sort(n)}(n,e,r.sort);const{offset:s,limit:a}=r,i={recordsLength:n.length,offset:s,recordsPerPage:a};return Promise.resolve({records:v(n,s,a),paginationInfo:b(i)})}function v(t,e=0,r=0){return t&&t.length&&function(t,e){return t>=0&&e>=0}(e,r)?0===r&&0===e?t:t.slice(e,e+r):[]}function b({recordsLength:t=0,offset:e=0,recordsPerPage:r=0}){if(!t)return{currentPage:0,firstRecord:0,lastRecord:0,total:0,hasMore:!1};const n=e+r,s=n?Math.min(n,t):t;return{currentPage:0===r?0:Math.ceil(e/r),firstRecord:e+1,lastRecord:s,total:t,hasMore:s<t}}p._repositories=new Map,p._loadingStatus=new Map;class P{constructor(t,r,n){this.metadata=t,this.records=r,this._dataUnit=new e(P.IN_MEMORY_DATA_UNIT_NAME),this._dataUnit.pageSize=150,this._dataUnit.metadataLoader=()=>this.metadaLoader(),this._dataUnit.dataLoader=(t,e)=>this.inMemoryLoader(t,e,this.getRecordsToLoad()),this._dataUnit.saveLoader=(t,e)=>this.saveLoader(t,e),this._dataUnit.removeLoader=(t,e)=>this.removeLoader(t,e),this.dataUnit.loadMetadata().then((()=>{!1!==(null==n?void 0:n.autoLoad)&&this.dataUnit.loadData()}))}getRecordsToLoad(){null==this._initialRecords&&this.dataUnit.records.length>0&&(this._initialRecords=this.dataUnit.records);const t=this.dataUnit.getAddedRecords();return t?[...this._initialRecords,...t]:this._initialRecords}get dataUnit(){return this._dataUnit}get records(){return this.dataUnit.records}static getConvertedValue(t,e){return t.dataType===r.BOOLEAN?"S"===e:t.dataType===r.NUMBER?Number(e):t.dataType===r.DATE?n.strToDate(e,!0):t.dataType===r.OBJECT?JSON.parse(e):e}set records(t){const e=this._metadata?new Map(this._metadata.fields.map((t=>[t.name,t]))):void 0,r=null==t?void 0:t.map((t=>{if(t.__record__id__||(t.__record__id__=this.generateUniqueId()),null!=e)for(const r in t){const n=t[r];"string"==typeof n&&e.has(r)&&(t[r]=P.getConvertedValue(e.get(r),n))}return t}));this._initialRecords=r,this._dataUnit&&this._dataUnit.loadData()}get metadata(){return this._metadata}set metadata(t){this._metadata=t,this._dataUnit&&(this._dataUnit.metadata=this._metadata)}generateUniqueId(){return s.generateUUID()}inMemoryLoader(t,e,r){return y(r,t,e)}metadaLoader(){return Promise.resolve(this._metadata)}saveLoader(t,e){return new Promise((t=>{let r=[];e.forEach((t=>{let{record:e,updatingFields:n,operation:s}=t;const i=Object.assign(Object.assign({},e),n);if(s===a.INSERT||s===a.COPY)i.__old__id__=e.__record__id__,i.__record__id__=this.generateUniqueId(),this.records.push(i);else{const t=this.records.findIndex((t=>t.__record__id__==i.__record__id__));this.records[t]=i}r.push(i)})),t(r)}))}removeLoader(t,e){return new Promise((t=>{t(e)}))}}function D(t,e){var r,n;return void 0!==(null===(r=t[e])||void 0===r?void 0:r.value)?null===(n=t[e])||void 0===n?void 0:n.value:t[e]}P.IN_MEMORY_DATA_UNIT_NAME="InMemoryDataUnit";class I{canSlice(){return!1}processSortingSide(t,e,r){var n;const s=[],a=[];if(null!=t.sort){if(0===r.length)return{localSorting:t.sort,serverSorting:[]};for(const r of t.sort){const t=e.getField(r.field);"true"===(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.calculated)||(null==t?void 0:t.userInterface)===o.LONGTEXT?s.push(r):a.push(r)}}return{localSorting:s,serverSorting:a}}async load(t,e,r){var n,s;if(null==t.metadata)return Promise.resolve({records:[],loadingInfo:r});try{const a=null!==(s=null===(n=e.filters)||void 0===n?void 0:n.filter((t=>!t.name.startsWith("FILTRO_COLUNA_"))))&&void 0!==s?s:[],{localSorting:i,serverSorting:o}=this.processSortingSide(e,t,a),c=this.getFieldsList(t),u="DatasetSP.loadRecords",d=this.buildRequestBody(u,c,t,e,r,o,a),h=r.quiet?{urlParams:{quietMode:"true"}}:void 0,{result:m,pagerID:f}=await l.get().callServiceBroker(u,d,h),_=this.processRecords(t,c,m),g=null!=f,p=r.count+_.length,y=t.hasNewRecord(),v=!g&&i.length>0;return v&&y&&t.setWaitingToReload(!0),Promise.resolve({records:_,loadingInfo:Object.assign(Object.assign({},r),{pagerId:f,loadingInProgress:g,total:g?void 0:p,count:p,needReload:v&&!y})})}catch(t){return console.error(t),Promise.reject(t)}}async loadRowMetadata(t,e,r,n={}){try{const s="DatasetSP.loadRowMetadata",a=await this.buildRequestBodyLoadRowMetadata({snkDataUnit:t,fieldName:e,metadataName:r,serviceName:s,updatedFields:n});return await l.get().callServiceBroker(s,a)}catch(t){return console.error(t),Promise.reject(t)}}async buildRequestBodyLoadRowMetadata({snkDataUnit:t,serviceName:e,fieldName:r,metadataName:n,updatedFields:s}){const a=t.dataUnit,i=O.parseDataUnitName(a.name).entityName,o=(await t.getSelectedRecordsIDsInfo()).reduce(((t,e)=>(t[e.name]=e.value,t)),{}),c=a.getSelectedRecord(),l=a.metadata.fields.filter((({standAlone:t,name:e})=>!t&&!e.includes("."))).map((({name:t})=>t)),u=l.reduce(((t,e,r)=>{const n=D(c,e),a=D(s,e);return t[r]=void 0!==a?a:n,t}),{});return JSON.stringify({serviceName:e,requestBody:{dataSetID:a.dataUnitId,entityName:i,standAlone:!1,metadataName:n,fieldName:r,fields:l,record:{pk:o,oldPk:o,values:u}}})}getFieldsList(t){let e=["__record__id__","__record__label__"];return t.metadata.fields.forEach((t=>{t.standAlone||(e=e.concat(this.getFieldNames(t)))})),e}getStandAloneFieldsList(t){let e={};return t.metadata.fields.forEach((t=>{t.standAlone&&(e=Object.assign(Object.assign({},e),{[t.name]:{fieldType:t.dataType,userType:t.userInterface}}))})),e}getFieldNames(t){const e=this.getSearchDescriptionField(t);return null==e?t.name:[t.name,e]}buildRequestBody(t,e,r,n,s,a,i){const o=r.dataUnitId,c=O.parseDataUnitName(r.name).entityName,l=!(!n.limit&&!n.offset),u={serviceName:t,requestBody:{dataSetID:o,fields:e,entityName:c,pageNumber:s.pageNumber,totalRecordsCount:s.count,pagerID:s.pagerId,standAlone:!1,standAloneFieldsMD:Object.assign({__record__id__:{fieldType:"S",userType:"P"},__record__label__:{fieldType:"S",userType:"P"}},this.getStandAloneFieldsList(r)),tryJoinedFields:!0,parallelLoader:l,crudListener:`br.com.sankhya.bff.${this.getModuleName()}.BFFDataUnitDatasetAdapter`,txProperties:this.getTxProperties(r,n,a,i),useDefaultRowsLimit:!1}};return JSON.stringify(u)}getModuleName(){return i.getContextValue("__SNK__APPLICATION__").getModuleName().replace("-bff","")}getTxProperties(t,e,r,n){const s={"__DATA_UNIT_ADAPTER__[dataUnitName]":t.name};0!==n.length&&(s["__DATA_UNIT_ADAPTER__[criteria]"]=JSON.stringify(n)),null!=r&&0!==r.length&&(s["__DATA_UNIT_ADAPTER__[sorting]"]=JSON.stringify(r)),null!=e.parentRecordId&&(s["__DATA_UNIT_ADAPTER__[parentRecordId]"]=e.parentRecordId);const a=t.getGlobalLoaderProps();return null==a||0===a.size||Array.from(a.entries()).forEach((([t,e])=>{s[t]=e})),s}processRecords(t,e,r){return r.map((r=>{const n={__record__id__:r[0],__record__label__:r[1],__record__metadata__:r[r.length-1]._rmd};return t.metadata.fields.forEach((t=>{n[t.name]=this.buildFieldValue(t,e,r)})),n}))}buildFieldValue(t,e,r){const n=e.indexOf(t.name);if(n<0)return null;const a=r[n];if(s.isEmpty(a))return null;const i=this.getSearchDescriptionField(t);if(null!=i){const t=e.indexOf(i);if(t>=0)return{value:a,label:r[t]}}return t.userInterface===o.SEARCH?isNaN(Number(a))?a:Number(a):P.getConvertedValue(t,a)}getSearchDescriptionField(t){if(t.userInterface===o.SEARCH){const{ENTITYNAME:e,mergedFrom:r,DESCRIPTIONFIELD:n}=t.properties;if(!s.isEmpty(n))return null!=r?`${r}.${e}.${n}`:`${e}.${n}`}}}class N{static async debounce(t,e){const r=t.name;N._debouncingTimeouts[r]&&(clearTimeout(N._debouncingTimeouts[r]),delete N._debouncingTimeouts[r]),N._debouncingTimeouts[r]=setTimeout((()=>{delete N._debouncingTimeouts[r],e()}),100)}static async loadData(t,e){return new Promise(((r,n)=>{N.debounce(t,(()=>{p.loadData(t,e,this.loadFromServer).then((t=>r(t))).catch((t=>n(t)))}))}))}static getCachedRecords(t){return p.getCachedRecords(t)}static async loadFromServer(t,e,r){try{r=N.registryLoading(t,r);const n=await N.callLoader(t,e,r);if(null==n)return;const s=n.records,a=N.buildPaginationInfo(s.length,e,n.loadingInfo),i=null==a?s:s.slice(0,a.lastRecord);return Promise.resolve({records:i,paginationInfo:a})}catch(t){return console.error(t),Promise.reject(t)}}static async callLoader(t,e,r,n){null==n&&(n=new I);const s=await n.load(t,e,r),{records:a,loadingInfo:i}=s;if(N.isOldRequest(t,i))return Promise.resolve(void 0);const o=!n.canSlice()||0===i.count;if(p.cacheRecords(t,a,o,i.loadingInProgress),p.isCacheEnabled(t)&&i.loadingInProgress){const r=Object.assign(Object.assign({},e),{offset:i.count}),s=Object.assign(Object.assign({},i),{pageNumber:(i.pageNumber||0)+1,quiet:!0});this.callLoader(t,r,s,n).then((e=>N.afterLoadingPage(t,e.loadingInfo))).catch((t=>console.error(t)))}return Promise.resolve(s)}static afterLoadingPage(t,e){p.setLoadingStatus(t,e.loadingInProgress);const r=t.getPaginationInfo();if(null==r)return;const n=e.count;e.loadingInProgress?t.updatePagination(Object.assign(Object.assign({},r),{count:n,loadingInProgress:!0})):e.needReload?t.gotoPage(0):t.updatePagination(Object.assign(Object.assign({},r),{total:n,count:n,loadingInProgress:!1}))}static registryLoading(t,e){return null==e&&(e={requestTime:(new Date).getTime(),count:0}),N._requestTimeByDataUnit.set(t.name,e.requestTime),e}static isOldRequest(t,e){return N._requestTimeByDataUnit.get(t.name)>e.requestTime}static buildPaginationInfo(t,e,r){let{limit:n,offset:s}=e;if(!n)return;1===r.pageNumber&&(s=0);const{total:a,count:i,loadingInProgress:o}=r,c=0===i||0===t?0:s+1,l=s+Math.min(t,n);return{total:a,count:i,lastRecord:l,firstRecord:c,currentPage:s/n,hasMore:l<i||o}}}N._requestTimeByDataUnit=new Map,N._debouncingTimeouts={};const R=/dd:\/\/([^/]+)\/([^/?]+)/;class O{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchDataUnit",u.gql`query($name: String!) {
|
2
|
+
$queryAlias$: fetchDataUnit(name: $name){
|
3
|
+
name
|
4
|
+
fields{
|
5
|
+
name
|
6
|
+
defaultValue
|
7
|
+
label
|
8
|
+
visible
|
9
|
+
standAlone
|
10
|
+
readOnly
|
11
|
+
required
|
12
|
+
dataType
|
13
|
+
userInterface
|
14
|
+
calculated
|
15
|
+
group
|
16
|
+
order
|
17
|
+
properties{
|
18
|
+
name
|
19
|
+
value
|
20
|
+
}
|
21
|
+
dependencies{
|
22
|
+
masterFields
|
23
|
+
type
|
24
|
+
expression
|
25
|
+
}
|
26
|
+
}
|
27
|
+
children{
|
28
|
+
name
|
29
|
+
label
|
30
|
+
links{
|
31
|
+
source
|
32
|
+
target
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}`),this.templateByQuery.set("saveData",u.gql`mutation($changes: [InputBatchChange!]!) {
|
37
|
+
$queryAlias$: batchOperationDataUnit(changes: $changes){
|
38
|
+
oldId
|
39
|
+
id
|
40
|
+
label
|
41
|
+
ownerDataUnitName
|
42
|
+
fields {
|
43
|
+
name
|
44
|
+
value
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}`),this.templateByQuery.set("fetchDataRecord",u.gql`query($dataunit: String! $recordID: [String!]) {
|
48
|
+
$queryAlias$: fetchDataUnit(name: $dataunit){
|
49
|
+
record(id: $recordID){
|
50
|
+
id
|
51
|
+
label
|
52
|
+
fields {
|
53
|
+
name
|
54
|
+
value
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}`),this.templateByQuery.set("fetchDistinctColumn",u.gql`query($dataUnit: String!, $fieldName: String!, $argument: String, $filters: [InputFilter], $parentRecordId: String) {
|
59
|
+
$queryAlias$: selectDistinct(dataUnit: $dataUnit, fieldName: $fieldName, argument: $argument, filters: $filters, parentRecordId: $parentRecordId)
|
60
|
+
}`)}static parseDataUnitName(t){if(null==t)return;const e=R.exec(t);return e?{entityName:e[1],resourceID:e[2]}:void 0}getDataUnit(t,r,n,s){null==p.applicationResourceID&&_.getResourceID().then((t=>p.applicationResourceID=t));const a=`dd://${t}/${r}${s?"/"+s:""}`,i=null!=n?n.getChildDataunit(a):new e(a);return i.metadataLoader=t=>this.loadMetadata(t),i.dataLoader=(t,e)=>N.loadData(t,e),i.saveLoader=(t,e)=>this.saveData(i,e),i.removeLoader=(t,e)=>this.removeRecords(t,e),i.recordLoader=(t,e)=>this.loadRecord(t,e),i.allRecordsLoader=t=>N.getCachedRecords(t),i}loadMetadata(t){return new Promise(((e,r)=>{l.get().callGraphQL({values:{name:t.name},query:this.templateByQuery.get("fetchDataUnit")}).then((t=>{var r;const n={name:t.name,label:t.name,children:[...t.children],fields:[]};null===(r=t.fields)||void 0===r||r.forEach((t=>{let e;Array.isArray(t.properties)&&(e={},t.calculated&&(e.gridHeaderTooltip="Campos calculados não podem ser ordenados"),t.properties.forEach((t=>e[t.name]=t.value))),n.fields.push(Object.assign(Object.assign({},t),{properties:e}))})),n.fields.sort(((t,e)=>t.order-e.order)),e(n)})).catch((t=>{r(t)}))}))}loadSelectDistinct(t,e,r){const{parentRecordId:n,filters:s}=t.getLastLoadRequest()||{},a=s.filter((t=>t.name!==`${d}${e}`)),i={dataUnit:t.name,argument:r,fieldName:e,parentRecordId:n,filters:a};return new Promise(((t,e)=>{l.get().callGraphQL({values:i,query:this.templateByQuery.get("fetchDistinctColumn")}).then((e=>{t(e)})).catch((t=>{e(t)}))}))}addTransientProperties(t,e){const r=t.getGlobalLoaderProps();return null==r||0===r.size||(null==e&&(e={}),Array.from(r.entries()).forEach((([t,r])=>{e[`transient.${t}`]=r}))),e}getUpdatingFields(t,e){if(null==e)return;const r=Object.assign({},e);return Object.keys(r).forEach((e=>{const n=t.getField(e);null!=n&&n.standAlone&&delete r[e]})),this.addTransientProperties(t,r)}saveData(t,e){const n=[],s=[],i=e.map((e=>{const{dataUnit:i,record:o,operation:l}=e,u=c.get(i),d=this.getUpdatingFields(u,e.updatingFields);let h;null!=d&&(h=Object.entries(d).map((([t,e])=>{const n=u.getField(t);return{fieldName:t,dataType:n?n.dataType:r.TEXT,value:u.valueToString(t,e)}}))),i===t.name&&(l===a.INSERT||l===a.COPY?s.push(o.__record__id__):n.push(o.__record__id__));const m={dataUnit:i,fields:h,operation:l,recordId:o.__record__id__};return e.sourceId&&(m.sourceId=e.sourceId),o.__parent__record__id__&&(m.parentRecordId=o.__parent__record__id__),m}));return new Promise(((e,r)=>{const a=i.map((t=>function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]])}return r}(t,[])));l.get().callGraphQL({values:{changes:a},query:this.templateByQuery.get("saveData")}).then((r=>{const a=[];null==r||r.forEach((e=>{const r={__record__id__:e.id,__record__label__:e.label,__owner__dataunit__name__:e.ownerDataUnitName},n=c.get(r.__owner__dataunit__name__)||t;e.oldId&&(r.__old__id__=e.oldId),e.fields.forEach((({name:t,value:e})=>{var s;const a=null===(s=null==n?void 0:n.valueFromString)||void 0===s?void 0:s.call(n,t,e);r[t]=void 0!==a?a:e})),a.push(r)})),this.updateCache(t,a,n,s),e(a)})).catch((t=>{r(t)}))}))}updateCache(t,e,r,n){const s=new Map(e.map((t=>[t.__old__id__||t.__record__id__,t]))),a=n.map((t=>{const e=Object.assign({},s.get(t));return delete e.__old__id__,e}));a.length>0&&p.insertRecords(t,t.records[0],a);const i=r.map((t=>Object.assign({},s.get(t))));p.updateRecords(t,i)}getTransientInfo(t,e){const{records:n}=t.getSelectionInfo();return Object.entries(n.filter((t=>t.__record__id__==e))[0]).filter((([t])=>t.startsWith(h.DATA_UNIT_TRANSIENT_PREFIX_NAME))).map((([t,e])=>({fieldName:t,value:e,dataType:r.TEXT})))}removeRecords(t,e){const r=e.map((e=>({dataUnit:t.name,operation:a.DELETE,recordId:e,fields:this.getTransientInfo(t,e)})));return new Promise(((n,s)=>{l.get().callGraphQL({values:{changes:r},query:this.templateByQuery.get("saveData")}).then((()=>{p.removeRecords(t,t.records.filter((t=>e.includes(t.__record__id__)))),n(e)})).catch((t=>{s(t)}))}))}loadRecord(t,e){return new Promise(((r,n)=>{l.get().callGraphQL({values:{recordID:e,dataunit:t.name},query:this.templateByQuery.get("fetchDataRecord")}).then((e=>{const n=[];e.record.forEach((e=>{const r={__record__id__:e.id,__record__label__:e.label};e.fields.forEach((({name:e,value:n})=>{r[e]=t.valueFromString(e,n)})),n.push(r)})),r(n)})).catch((t=>{n(t)}))}))}}export{O as D,P as I,p as P,I as a,y as b,D as g}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{R as e,F as t}from"./p-
|
1
|
+
import{R as e,F as t}from"./p-06421fdb.js";import{F as i}from"./p-ff1990ad.js";import{ObjectUtils as s}from"@sankhyalabs/core";import{d as r,D as a}from"./p-f3434fc4.js";var n;function l(e,t){if(null==e)return e;if(e instanceof Date)return e.toISOString();if("object"==typeof e){if(e instanceof Array)return e.map((e=>l(i.MULTI_LIST===t?function(e,t){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(i[s[r]]=e[s[r]])}return i}(e,["label"]):e)));{const i=Object.assign({},e);return Object.keys(e).forEach((s=>{void 0!==e[s]?i[s]=l(e[s],t):delete i[s]})),i}}return e}class o{constructor(){this.templateByQuery=new Map,this.buildTemplates()}resolveURI(e,t){let i="filter-assistent-config://"+e;return t&&(i+="."+t),i}buildTemplates(){this.templateByQuery.set("fetchFilterFields",r.gql`
|
2
2
|
query($name: String!) {
|
3
3
|
$queryAlias$: fetchFilterFields(name: $name){
|
4
4
|
currentLink {
|
@@ -53,4 +53,4 @@ import{R as e,F as t}from"./p-df5451c7.js";import{F as i}from"./p-ff1990ad.js";i
|
|
53
53
|
valid
|
54
54
|
message
|
55
55
|
}
|
56
|
-
}`)}async loadPersonalizedFilter(e,t,i,s){return new Promise(((r,n)=>{a.get().callGraphQL({values:{name:this.resolveURI(e,i)+"/"+t+this.resolveLegacyConfigName(s)},query:this.templateByQuery.get("fetchFilterAssistent")}).then((e=>{e.assistent=JSON.parse(e.assistent),r(e)})).catch((e=>{n(e)}))}))}resolveLegacyConfigName(e){return e?`?legacyResourceID=${e}`:""}async savePersonalizedFilter(e,t,i){if(!e||0==Object.keys(e).length)return Promise.reject(new Error("personalizedFilter não pode ser vazio"));let s=JSON.parse(JSON.stringify(e));return s.assistent=JSON.stringify(s.assistent),new Promise(((e,r)=>{a.get().callGraphQL({values:{name:this.resolveURI(t,i),filterAssistent:s},query:this.templateByQuery.get("savePersonalizedFilter")}).then((t=>{e(t)})).catch((e=>{r(e)}))}))}async removePersonalizedFilter(e,t,i){return new Promise(((s,r)=>{a.get().callGraphQL({values:{name:this.resolveURI(t,i),filterId:e.id},query:this.templateByQuery.get("deletePersonalizedFilter")}).then((e=>{s(e)})).catch((e=>{r(e)}))}))}async validatePersonalizedFilter(e,t){return new Promise(((i,s)=>{a.get().callGraphQL({values:{dataUnitName:e,expression:t},query:this.templateByQuery.get("validateExpression")}).then((e=>{i(e)})).catch((e=>{s(e)}))}))}loadFields(e){return new Promise(((t,i)=>{a.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchFilterFields")}).then((e=>{var i;let s=e.fields;for(const e of s){if(Array.isArray(e.properties)&&e.properties.length>0){const t=e.properties.reduce(((e,t)=>(e[t.name]=t.value,e)),{});e.properties=t}(null===(i=null==e?void 0:e.properties)||void 0===i?void 0:i.options)&&(e.properties.options=JSON.parse(e.properties.options))}t(Object.assign(Object.assign({},e),{fields:s}))})).catch((e=>{i(e)}))}))}}!function(e){e.form="form",e.grid="grid",e.filterBar="filterBar"}(n||(n={}));class c{static addFilterBarLegacyConfig(e,t){this.validateConfigName(e,t),this.filterBarLegacyConfig.set(e,t)}static addFormLegacyConfig(e,t){this.validateConfigName(e,t),this.formLegacyConfig.set(e,t)}static addGridLegacyConfig(e,t){this.validateConfigName(e,t),this.gridLegacyConfig.set(e,t)}static preload(e,t,i){t&&(null==i?void 0:i.gridLegacyConfig)&&c.addGridLegacyConfig(t,i.gridLegacyConfig),t&&(null==i?void 0:i.formLegacyConfig)&&c.addFormLegacyConfig(t,i.formLegacyConfig),c.loadFormConfig(t,e),c.loadGridConfig(t,e)}static async loadFilterBarConfig(e,t,i){i=this.handleLegacyConfig(e,n.filterBar,i);const s=c.buildCacheID(e,n.filterBar,t);return c.configById.has(s)||c.configById.set(s,c.filterBarConfigFetcher.getConfig(t,e,i)),c.configById.get(s)}static async loadFormConfig(e,t){e=this.handleLegacyConfigAsString(e,n.form);const i=c.buildCacheID(e,n.form,t);return c.configById.has(i)||c.configById.set(i,c.formConfigFetcher.loadFormConfig(e,t)),c.configById.get(i)}static async loadGridConfig(e,t){e=this.handleLegacyConfigAsString(e,n.grid);const i=c.buildCacheID(e,n.grid,t);return c.configById.has(i)||c.configById.set(i,c.gridConfigFetcher.getConfig(e,t)),c.configById.get(i)}static async saveFilterBarConfig(e,t,i){return await this.deleteFilterBarConfigCache(t,i),this.filterBarConfigFetcher.saveConfig(e,i,t)}static async saveFormConfig(e,t,i){return t=this.handleLegacyConfigAsString(t,n.form),await this.deleteFormConfigCache(t,i),this.formConfigFetcher.saveConfig(e,t,i)}static async saveCardState(e,t,i){return this.formConfigFetcher.saveCardState(e,t,i)}static async saveGridConfig(e,t,i){if(null!=e)return await this.deleteGridConfigCache(t,i),this.gridConfigFetcher.saveConfig(e,t,i)}static async loadPersonalizedFilter(e,t,i){const s=this.filterBarLegacyConfig.get(i);return this.personalizedFilterFetcher.loadPersonalizedFilter(t,e,i,s)}static async savePersonalizedFilter(e,t,i){return await this.deleteFilterBarConfigCache(i,t),this.personalizedFilterFetcher.savePersonalizedFilter(e,t,i)}static async removePersonalizedFilter(e,t,i){return this.personalizedFilterFetcher.removePersonalizedFilter(e,t,i)}static async validatePersonalizedFilter(e,t){return this.personalizedFilterFetcher.validatePersonalizedFilter(e,t)}static async deleteGridConfigCache(e,t){await this.deleteConfigCache(e,t,n.grid)}static async deleteFormConfigCache(e,t){await this.deleteConfigCache(e,t,n.form)}static async deleteFilterBarConfigCache(e,t){await this.deleteConfigCache(e,t,n.filterBar)}static validateConfigName(e,t){if(!e)throw Error(this.CONFIG_NAME_ERROR_MESSAGE);if(!t)throw Error(this.LEGACY_CONFIG_NAME_ERROR_MESSAGE)}static handleLegacyConfig(e,t,i){let s;switch(t){case n.filterBar:s=this.filterBarLegacyConfig.get(e);break;case n.grid:s=this.gridLegacyConfig.get(e);break;case n.form:s=this.formLegacyConfig.get(e)}const r=i?Object.assign({},i):{};return s&&(r.legacyResourceID=s),r}static handleLegacyConfigAsString(e,t){const i=this.handleLegacyConfig(e,t).legacyResourceID;return i&&(e+=`?legacyResourceID=${i}`),e}static async deleteConfigCache(e,t,i){const s=c.buildCacheID(e,i,t);this.configById.delete(s)}static buildCacheID(e,t,i){return null==e?`req_${t}_${i}`:`req_${t}_${e}_${i}`}}c.CONFIG_NAME_ERROR_MESSAGE="ConfigName precisa ser informado.",c.LEGACY_CONFIG_NAME_ERROR_MESSAGE="LegacyConfigName precisa ser informado.",c.filterBarLegacyConfig=new Map,c.formLegacyConfig=new Map,c.gridLegacyConfig=new Map,c.configById=new Map,c.filterBarConfigFetcher=new class extends e{normalize(e){return e.map((e=>{const{id:t,value:i,fixed:s,visible:r,type:a,groupedItems:n}=e,o={id:t};if(i&&(o.value=l(i,a)),s&&(o.fixed=s),n){if(0===n.length)return;n.filter((e=>e.visible)).length>0&&(o.visible=!0),o.groupedItems=this.normalize(n)}else r&&(o.visible=!0);return o})).filter((e=>null!=e))}saveConfig(e,t,i){return this.saveResource(this.normalize(e),this.getPath(t,i))}getConfig(e,t,i){return new Promise(((s,r)=>{this.loadResource(this.getPath(e,t,i)).then((e=>{let t;if(e){const i=JSON.parse(e);t=this.buildFieldList(i.items)}s(t||[])})).catch((e=>{r(e)}))}))}buildFieldList(e){return e.map((e=>{var t,r;if(e.type===i.MULTI_LIST){const i=e.value;let a=null!==(r=null!==(t=null==i?void 0:i.elements)&&void 0!==t?t:null==i?void 0:i.members)&&void 0!==r?r:i;a=null!=a?a:[],a=Array.isArray(a)?a:[a],a=a.map((e=>Object.assign(Object.assign({},e),{id:void 0!==e.id?e.id:e.value}))),e.value=s.copy(a)}return e}))}getPath(e,t,i){let s=`cfg://filter/FilterBarState:${e}`;return t&&(s+=`.${t}`),i&&(s+=this.buildQueryString(i)),s}buildQueryString(e){let t="?";for(let i in e)e.hasOwnProperty(i)&&(t.length>1&&(t+="&"),t+=i+"="+e[i]);return t}},c.formConfigFetcher=new t,c.gridConfigFetcher=new class extends e{constructor(){super(...arguments),this.GRID_CONFIG_VERSION="V3:"}getConfig(e,t){const i=this.getPath(t,e);return new Promise(((e,t)=>{this.loadResource(i).then((t=>{let i;t&&(i=JSON.parse(t)),e(i)})).catch((e=>{t(e)}))}))}saveConfig(e,t,i){const s=this.getPath(i,t);return new Promise(((t,i)=>{this.saveResource(e,s).then((e=>{t(JSON.parse(e.resource))})).catch((e=>{i(e)}))}))}getPath(e,t){return t?`cfg://grid/${this.GRID_CONFIG_VERSION}${e}/${t}`:`cfg://grid/${this.GRID_CONFIG_VERSION}${e}`}},c.personalizedFilterFetcher=new o;export{c as C,o as P}
|
56
|
+
}`)}async loadPersonalizedFilter(e,t,i,s){return new Promise(((r,n)=>{a.get().callGraphQL({values:{name:this.resolveURI(e,i)+"/"+t+this.resolveLegacyConfigName(s)},query:this.templateByQuery.get("fetchFilterAssistent")}).then((e=>{e.assistent=JSON.parse(e.assistent),r(e)})).catch((e=>{n(e)}))}))}resolveLegacyConfigName(e){return e?`?legacyResourceID=${e}`:""}async savePersonalizedFilter(e,t,i){if(!e||0==Object.keys(e).length)return Promise.reject(new Error("personalizedFilter não pode ser vazio"));let s=JSON.parse(JSON.stringify(e));return s.assistent=JSON.stringify(s.assistent),new Promise(((e,r)=>{a.get().callGraphQL({values:{name:this.resolveURI(t,i),filterAssistent:s},query:this.templateByQuery.get("savePersonalizedFilter")}).then((t=>{e(t)})).catch((e=>{r(e)}))}))}async removePersonalizedFilter(e,t,i){return new Promise(((s,r)=>{a.get().callGraphQL({values:{name:this.resolveURI(t,i),filterId:e.id},query:this.templateByQuery.get("deletePersonalizedFilter")}).then((e=>{s(e)})).catch((e=>{r(e)}))}))}async validatePersonalizedFilter(e,t){return new Promise(((i,s)=>{a.get().callGraphQL({values:{dataUnitName:e,expression:t},query:this.templateByQuery.get("validateExpression")}).then((e=>{i(e)})).catch((e=>{s(e)}))}))}loadFields(e){return new Promise(((t,i)=>{a.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchFilterFields")}).then((e=>{var i;let s=e.fields;for(const e of s){if(Array.isArray(e.properties)&&e.properties.length>0){const t=e.properties.reduce(((e,t)=>(e[t.name]=t.value,e)),{});e.properties=t}(null===(i=null==e?void 0:e.properties)||void 0===i?void 0:i.options)&&(e.properties.options=JSON.parse(e.properties.options))}t(Object.assign(Object.assign({},e),{fields:s}))})).catch((e=>{i(e)}))}))}}!function(e){e.form="form",e.grid="grid",e.filterBar="filterBar"}(n||(n={}));class c{static addFilterBarLegacyConfig(e,t){this.validateConfigName(e,t),this.filterBarLegacyConfig.set(e,t)}static addFormLegacyConfig(e,t){this.validateConfigName(e,t),this.formLegacyConfig.set(e,t)}static addGridLegacyConfig(e,t){this.validateConfigName(e,t),this.gridLegacyConfig.set(e,t)}static preload(e,t,i){t&&(null==i?void 0:i.gridLegacyConfig)&&c.addGridLegacyConfig(t,i.gridLegacyConfig),t&&(null==i?void 0:i.formLegacyConfig)&&c.addFormLegacyConfig(t,i.formLegacyConfig),c.loadFormConfig(t,e),c.loadGridConfig(t,e)}static async loadFilterBarConfig(e,t,i){i=this.handleLegacyConfig(e,n.filterBar,i);const s=c.buildCacheID(e,n.filterBar,t);return c.configById.has(s)||c.configById.set(s,c.filterBarConfigFetcher.getConfig(t,e,i)),c.configById.get(s)}static async loadFormConfig(e,t){e=this.handleLegacyConfigAsString(e,n.form);const i=c.buildCacheID(e,n.form,t);return c.configById.has(i)||c.configById.set(i,c.formConfigFetcher.loadFormConfig(e,t)),c.configById.get(i)}static async loadGridConfig(e,t){e=this.handleLegacyConfigAsString(e,n.grid);const i=c.buildCacheID(e,n.grid,t);return c.configById.has(i)||c.configById.set(i,c.gridConfigFetcher.getConfig(e,t)),c.configById.get(i)}static async saveFilterBarConfig(e,t,i){return await this.deleteFilterBarConfigCache(t,i),this.filterBarConfigFetcher.saveConfig(e,i,t)}static async saveFormConfig(e,t,i){return t=this.handleLegacyConfigAsString(t,n.form),await this.deleteFormConfigCache(t,i),this.formConfigFetcher.saveConfig(e,t,i)}static async saveCardState(e,t,i){return this.formConfigFetcher.saveCardState(e,t,i)}static async saveGridConfig(e,t,i){if(null!=e)return t=this.handleLegacyConfigAsString(t,n.grid),await this.deleteGridConfigCache(t,i),this.gridConfigFetcher.saveConfig(e,t,i)}static async loadPersonalizedFilter(e,t,i){const s=this.filterBarLegacyConfig.get(i);return this.personalizedFilterFetcher.loadPersonalizedFilter(t,e,i,s)}static async savePersonalizedFilter(e,t,i){return await this.deleteFilterBarConfigCache(i,t),this.personalizedFilterFetcher.savePersonalizedFilter(e,t,i)}static async removePersonalizedFilter(e,t,i){return this.personalizedFilterFetcher.removePersonalizedFilter(e,t,i)}static async validatePersonalizedFilter(e,t){return this.personalizedFilterFetcher.validatePersonalizedFilter(e,t)}static async deleteGridConfigCache(e,t){await this.deleteConfigCache(e,t,n.grid)}static async deleteFormConfigCache(e,t){await this.deleteConfigCache(e,t,n.form)}static async deleteFilterBarConfigCache(e,t){await this.deleteConfigCache(e,t,n.filterBar)}static validateConfigName(e,t){if(!e)throw Error(this.CONFIG_NAME_ERROR_MESSAGE);if(!t)throw Error(this.LEGACY_CONFIG_NAME_ERROR_MESSAGE)}static handleLegacyConfig(e,t,i){let s;switch(t){case n.filterBar:s=this.filterBarLegacyConfig.get(e);break;case n.grid:s=this.gridLegacyConfig.get(e);break;case n.form:s=this.formLegacyConfig.get(e)}const r=i?Object.assign({},i):{};return s&&(r.legacyResourceID=s),r}static handleLegacyConfigAsString(e,t){const i=this.handleLegacyConfig(e,t).legacyResourceID;return i&&(e+=`?legacyResourceID=${i}`),e}static async deleteConfigCache(e,t,i){const s=c.buildCacheID(e,i,t);this.configById.delete(s)}static buildCacheID(e,t,i){return null==e?`req_${t}_${i}`:`req_${t}_${e}_${i}`}}c.CONFIG_NAME_ERROR_MESSAGE="ConfigName precisa ser informado.",c.LEGACY_CONFIG_NAME_ERROR_MESSAGE="LegacyConfigName precisa ser informado.",c.filterBarLegacyConfig=new Map,c.formLegacyConfig=new Map,c.gridLegacyConfig=new Map,c.configById=new Map,c.filterBarConfigFetcher=new class extends e{normalize(e){return e.map((e=>{const{id:t,value:i,fixed:s,visible:r,type:a,groupedItems:n}=e,o={id:t};if(i&&(o.value=l(i,a)),s&&(o.fixed=s),n){if(0===n.length)return;n.filter((e=>e.visible)).length>0&&(o.visible=!0),o.groupedItems=this.normalize(n)}else r&&(o.visible=!0);return o})).filter((e=>null!=e))}saveConfig(e,t,i){return this.saveResource(this.normalize(e),this.getPath(t,i))}getConfig(e,t,i){return new Promise(((s,r)=>{this.loadResource(this.getPath(e,t,i)).then((e=>{let t;if(e){const i=JSON.parse(e);t=this.buildFieldList(i.items)}s(t||[])})).catch((e=>{r(e)}))}))}buildFieldList(e){return e.map((e=>{var t,r;if(e.type===i.MULTI_LIST){const i=e.value;let a=null!==(r=null!==(t=null==i?void 0:i.elements)&&void 0!==t?t:null==i?void 0:i.members)&&void 0!==r?r:i;a=null!=a?a:[],a=Array.isArray(a)?a:[a],a=a.map((e=>Object.assign(Object.assign({},e),{id:void 0!==e.id?e.id:e.value}))),e.value=s.copy(a)}return e}))}getPath(e,t,i){let s=`cfg://filter/FilterBarState:${e}`;return t&&(s+=`.${t}`),i&&(s+=this.buildQueryString(i)),s}buildQueryString(e){let t="?";for(let i in e)e.hasOwnProperty(i)&&(t.length>1&&(t+="&"),t+=i+"="+e[i]);return t}},c.formConfigFetcher=new t,c.gridConfigFetcher=new class extends e{constructor(){super(...arguments),this.GRID_CONFIG_VERSION="V3:"}getConfig(e,t){const i=this.getPath(t,e);return new Promise(((e,t)=>{this.loadResource(i).then((t=>{let i;t&&(i=JSON.parse(t)),e(i)})).catch((e=>{t(e)}))}))}saveConfig(e,t,i){const s=this.getPath(i,t);return new Promise(((t,i)=>{this.saveResource(e,s).then((e=>{t(JSON.parse(e.resource))})).catch((e=>{i(e)}))}))}getPath(e,t){return t?`cfg://grid/${this.GRID_CONFIG_VERSION}${e}/${t}`:`cfg://grid/${this.GRID_CONFIG_VERSION}${e}`}},c.personalizedFilterFetcher=new o;export{c as C,o as P}
|
@@ -0,0 +1 @@
|
|
1
|
+
export{S as snk_data_unit}from"./p-fd13b4d2.js";import"./p-d2d301a6.js";import"@sankhyalabs/core";import"@sankhyalabs/ezui/dist/collection/utils";import"./p-17425c72.js";import"./p-47bce500.js";import"./p-f3434fc4.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"@sankhyalabs/core/dist/dataunit/metadata/DataType";import"./p-7dd49d15.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as e,c as i,h as t,F as s,H as l,g as r}from"./p-d2d301a6.js";import{ElementIDUtils as a,UserInterface as n,ApplicationContext as o}from"@sankhyalabs/core";import{F as d}from"./p-ff1990ad.js";import{E as h}from"./p-1a68fb59.js";import{EzScrollDirection as c}from"@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection";import{CheckMode as m}from"@sankhyalabs/ezui/dist/collection/utils";const z=class{constructor(t){e(this,t),this.deleteFilter=i(this,"deleteFilter",7),this.editFilter=i(this,"editFilter",7),this.addFilter=i(this,"addFilter",7),this.valueChanged=i(this,"valueChanged",7),this.originalItems=[],this.messagesBuilder=void 0,this.presentationMode=h.MODAL,this.config=void 0,this.value=void 0,this.items=[]}async show(){const e=document.querySelector("#param_0");e&&e.setFocus()}configWatcher(e){this.items=this.originalItems=e.groupedItems||[]}getMessage(e,i){var t;return this.messagesBuilder?this.messagesBuilder.getMessage(e,i):(null===(t=this._application)||void 0===t?void 0:t.messagesBuilder)?this._application.messagesBuilder.getMessage(e,i):void 0}getItemContent(e){var i,s;const l=!!(null===(s=null===(i=e.props)||void 0===i?void 0:i.personalizedFilter)||void 0===s?void 0:s.parameters.length);return t("div",{class:this.isModalMode()?"":"SnkFilterPersonalized_list-item--chip"},t("li",{class:this.isModalMode()?"SnkFilterPersonalized_list-item--modal":""},t("div",{class:"ez-flex ez-flex--align-items-center ez-margin-right--small ez-size-width--full"},t((()=>t("ez-check",Object.assign({class:"SnkFilterPersonalized_checkbox",id:`param_${e.id}`,key:e.id,value:e.visible,label:e.label,onEzChange:({detail:i})=>this.handleItemChange.bind(this)(i,e.id)},{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${a.getInternalIDInfo(`checkboxFilter_${e.id}`)}`}))),null),this.buildModalListActions(e,l))),e.visible&&l&&t("div",{class:"ez-row ez-padding--small"},this.getFormField(e)))}buildModalListActions(e,i){if(this.isModalMode())return this.isModalMode()?t("div",{class:"SnkFilterPersonalized_list-actions"},t("ez-button",{size:"small",mode:"icon",iconName:"edit",title:this.getMessage("snkPersonalizedFilter.listActions.edit"),onClick:()=>this.editFilter.emit(e.id)}),t("ez-button",{size:"small",mode:"icon",iconName:"delete",title:this.getMessage("snkPersonalizedFilter.listActions.delete"),onClick:this.handleDeleteFilter.bind(this,e)})):i&&t("ez-badge",Object.assign({class:"ez-badge--warning-subtle ez-margin-right--small",label:this.getMessage("snkPersonalizedFilter.info.badgeVariable"),size:"medium"},{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${a.getInternalIDInfo(`variableBadge_${e.id}`)}`}))}isModalMode(){return this.presentationMode===h.MODAL}doSearch(e,i,t){const s=Object.assign({},t.searchContext);return s.searchOptions=Object.assign(Object.assign({},s.searchOptions),{showInactives:"true"}),new Promise(((t,l)=>{this._application.executePreparedSearch(e,i,s).then((e=>{t(e)})).catch((e=>{l(e)}))}))}getFormField(e){var i,s;return(null===(s=null===(i=null==e?void 0:e.props)||void 0===i?void 0:i.personalizedFilter)||void 0===s?void 0:s.parameters).map(((i,s)=>{var l,r,a;const o=Object.assign(Object.assign({},i),{id:e.id}),d=null===(l=e.value)||void 0===l?void 0:l[s],h="param_"+s;switch(i.userInterface){case n.SEARCH:return t("ez-search",{id:h,suppressEmptyOption:!0,value:d,onEzChange:e=>this.handleFilterItemChange(e.detail,o),label:i.label,optionLoader:({mode:e,argument:t})=>this.doSearch(e,t,i)});case n.SWITCH:case n.CHECKBOX:return t("ez-check",{id:h,class:"ez-padding-bottom--medium",mode:n.SWITCH===i.userInterface?m.SWITCH:m.REGULAR,value:d,label:i.label,onEzChange:e=>this.handleFilterItemChange(e.detail,o)});case n.DECIMALNUMBER:return t("ez-number-input",{id:h,label:i.label,value:d,precision:(null===(r=i.props)||void 0===r?void 0:r.precision)||2,onEzChange:e=>this.handleFilterItemChange(e.detail,o)});case n.INTEGERNUMBER:return t("ez-number-input",{id:h,label:i.label,value:d,precision:null===(a=i.props)||void 0===a?void 0:a.precision,onEzChange:e=>this.handleFilterItemChange(e.detail,o)});case n.OPTIONSELECTOR:return t("ez-combo-box",{id:h,label:i.label,value:d,options:i.options,onEzChange:e=>this.handleFilterItemChange(e.detail,o)});case n.DATE:return t("ez-date-input",{id:h,label:i.label,value:this.parseDate(d),onEzChange:e=>this.handleFilterItemChange(e.detail,o)});case n.DATETIME:return t("ez-date-time-input",{id:h,label:i.label,value:this.parseDate(d),onEzChange:e=>this.handleFilterItemChange(e.detail,o)});default:return t("ez-text-input",{id:h,label:i.label,value:d,onEzChange:e=>this.handleFilterItemChange(e.detail,o)})}}))}parseDate(e){if("string"==typeof e){let i=new Date(e);return i.setMinutes(i.getMinutes()+i.getTimezoneOffset()),i}return e}getVisibleCount(e){return e.reduce(((e,i)=>i.visible?e+1:e),0)}handleItemChange(e,i){this.items=this.originalItems=this.originalItems.map((t=>{const s=t.id===i?e:t.visible;return Object.assign(Object.assign({},t),{visible:s,active:s})})),this.emitChange()}handleSearchFilterList({detail:e=""}){this.items=e?this.originalItems.filter((i=>i.label.toLowerCase().includes(e.toLowerCase()))):this.originalItems}handleFilterItemChange(e,i){var t;const s=this.items.find((({id:e})=>e===i.id)),{parameters:l=[]}=(null===(t=s.props)||void 0===t?void 0:t.personalizedFilter)||{},r=l.findIndex((e=>e.name===i.name));l[r]=i,s.props.personalizedFilter.parameters=l,s.value||(s.value=[]),s.value[r]=e;const a=[...this.items,s];this.items=Array.from(new Set(a)),this.emitChange()}handleClearFilters(){this.emitChange(!0)}emitChange(e=!1){e&&(this.items=this.originalItems);const i=this.items.map((i=>Object.assign(Object.assign({},i),{visible:!e&&i.visible}))),t=this.getVisibleCount(i);this.valueChanged.emit({value:t,items:i})}handleDeleteFilter(e){this._application.confirm(this.getMessage("snkPersonalizedFilter.deleteConfirm.title"),this.getMessage("snkPersonalizedFilter.deleteConfirm.message",{filterName:e.label})).then((i=>{i&&(this.deleteFilter.emit(e),this.items=this.originalItems=this.originalItems.filter((i=>i.id!==e.id)),this.emitChange())}))}componentDidLoad(){this._element&&a.addIDInfoIfNotExists(this._element,"filterContentEditor")}componentWillLoad(){var e;this._application=o.getContextValue("__SNK__APPLICATION__"),this.items=this.originalItems=(null===(e=this.config)||void 0===e?void 0:e.groupedItems)||[]}buildModeModalHeader(){if(this.presentationMode===h.MODAL)return t("div",{class:"ez-margin-bottom--medium"},t(s,null,t("ez-filter-input",Object.assign({label:this.config.label,onEzChange:this.handleSearchFilterList.bind(this)},{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${a.getInternalIDInfo("filterSearch")}`})),t("span",{class:"ez-text ez-title--small ez-title--primary"}," ",this.config.detailTitle," ")))}buildModeModalFooter(){if(this.presentationMode===h.MODAL)return t("div",{class:"ez-flex ez-flex--justify-end grow ez-margin-top--medium ez-margin-bottom--small"},t("ez-button",{class:"ez-button--tertiary ez-margin-right--small",size:"medium",label:this.getMessage("snkPersonalizedFilter.footerActions.clear"),onClick:this.handleClearFilters.bind(this)}),t("ez-button",{class:"ez-button--secondary ez-margin-right--small",size:"medium",label:this.getMessage("snkPersonalizedFilter.footerActions.create"),onClick:()=>this.addFilter.emit()}))}buildContainerFiltersCreated(){return this.items.length?t("ez-scroller",{class:"SnkFilterPersonalized_list-scroller",direction:c.VERTICAL},t("ul",{class:"SnkFilterPersonalized_list-container "+(this.isModalMode()?"":"SnkFilterPersonalized_list-container-chip")},this.items.map((e=>this.getItemContent(e))))):t("div",{class:"ez-margin--auto"},t("span",{class:"ez-text ez-text--secondary ez-text--small"},this.getMessage("snkPersonalizedFilter.info.noDataFound")))}render(){if(this.config&&this.config.type===d.PERSONALIZED)return t(l,null,this.buildModeModalHeader(),this.buildContainerFiltersCreated(),this.buildModeModalFooter())}get _element(){return r(this)}static get watchers(){return{config:["configWatcher"]}}};z.style=".sc-snk-personalized-filter-editor-h{--snk-filter-personalized__max-height:21;--snk-filter-personalized__max-width:21.5}.SnkFilterPersonalized_list-container.sc-snk-personalized-filter-editor{margin:0;padding:0;list-style:none;display:flex;flex-direction:column}.SnkFilterPersonalized_list-container-chip.sc-snk-personalized-filter-editor{width:400px}.SnkFilterPersonalized_list-scroller.sc-snk-personalized-filter-editor{display:block;max-height:calc(var(--space--2xl) * var(--snk-filter-personalized__max-height));cursor:auto;--ez-scroller__max-height:300px}.SnkFilterPersonalized_checkbox.sc-snk-personalized-filter-editor{display:grid;grid-template-columns:auto auto;justify-content:start}.SnkFilterPersonalized_list-container.sc-snk-personalized-filter-editor:has(.SnkFilterPersonalized_list-item--chip){gap:var(--space--small, 6px);max-width:calc(var(--space--md) * var(--snk-filter-personalized__max-width))}.SnkFilterPersonalized_list-item--modal.sc-snk-personalized-filter-editor{display:flex;border-radius:var(--border--radius-regular)}.SnkFilterPersonalized_list-item--modal.sc-snk-personalized-filter-editor:hover{background-color:var(--background--medium, #f0f3f7)}.SnkFilterPersonalized_list-actions.sc-snk-personalized-filter-editor{display:none;align-items:center}.SnkFilterPersonalized_list-item--modal.sc-snk-personalized-filter-editor:hover .SnkFilterPersonalized_list-actions.sc-snk-personalized-filter-editor{display:flex}.SnkFilterPersonalized_list-item--chip.sc-snk-personalized-filter-editor{display:flex;flex-direction:column;border:var(--border--small, 1px solid) var(--color-strokes, #DCE0E8);border-radius:var(--border--radius-regular)}.SnkFilterPersonalized_list-item--chip.sc-snk-personalized-filter-editor .sc-snk-personalized-filter-editor:first-of-type{gap:var(--space--3xs)}";export{z as snk_personalized_filter_editor}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as t,c as i,h as s,H as e,g as a}from"./p-d2d301a6.js";import{StringUtils as o,ElementIDUtils as h,ApplicationContext as n,JSUtils as r,FloatingManager as d}from"@sankhyalabs/core";import{T as c}from"./p-7e7a7473.js";import"./p-f3434fc4.js";import"./p-8a9638ae.js";import{P as l}from"./p-30cf616e.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-47bce500.js";import"./p-ff1990ad.js";import"./p-06421fdb.js";import{V as m}from"./p-95ce311a.js";import{A as u}from"./p-ca5ec380.js";import"./p-6dc031de.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";const p=class{constructor(s){t(this,s),this.actionClick=i(this,"actionClick",7),this.configuratorSave=i(this,"configuratorSave",7),this.configuratorCancel=i(this,"configuratorCancel",7),this.formItemsReady=i(this,"formItemsReady",7),this.viewModeChanged=i(this,"viewModeChanged",7),this._keyDownHandler=async t=>this.keyDownListener(t),this._viewHistory=[],this._customEditors=new Map,this._customRenders=new Map,this._dataUnit=void 0,this._dataState=void 0,this.attachmentRegisterKey=void 0,this._currentViewMode=m.GRID,this._canEdit=void 0,this._resourceID=void 0,this.configName=void 0,this.filterBarTitle=void 0,this.selectionToastConfig=void 0,this.showActionButtons=!1,this.actionsList=void 0,this.taskbarManager=void 0,this.recordsValidator=void 0,this.statusResolver=void 0,this.multipleSelection=!0,this.presentationMode=l.PRIMARY,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.gridLegacyConfigName=void 0,this.filterBarLegacyConfigName=void 0,this.formLegacyConfigName=void 0,this.disablePersonalizedFilter=void 0,this.autoLoad=void 0,this.autoFocus=!0,this.enableGridInsert=!1,this.domainMessagesBuilder=void 0,this.ignoreReadOnlyFormFields=void 0,this.setCustomFormTitle=void 0,this.customContainerId=`SNK-CRUD-CUSTOM-CONTAINER-${o.generateUUID()}`}async goToView(t){this.executeAction(t)}async openConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.open()}async closeConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.close()}async reloadFilterBar(){var t;null===(t=this._snkGrid)||void 0===t||t.reloadFilterBar()}async getFilterBar(){return await this._snkGrid.getFilterBar()}async addCustomEditor(t,i){if(this._guidesViewer&&this._snkGrid)return this._guidesViewer.addCustomEditor(t,i),void this._snkGrid.addCustomEditor(t,i);const s=new Map(this._customEditors);s.set(t,i),this._customEditors=s}async addGridCustomRender(t,i){if(this._snkGrid)return void this._snkGrid.addGridCustomRender(t,i);const s=new Map(this._customRenders);s.set(t,i),this._customRenders=s}async addCustomValueFormatter(t,i){this._snkGrid.addCustomValueFormatter(t,i)}async removeCustomValueFormatter(t){this._snkGrid.removeCustomValueFormatter(t)}async setFieldProp(t,i,s){await this._guidesViewer.setFieldProp(t,i,s)}currentViewModeWatcher(t){this._viewHistory=[...this._viewHistory.slice(-1),t]}async gridToForm(t=!1){this._backToGrid=!t&&await this._viewStack.getSelectedIndex()===m.GRID,this.setViewMode(m.FORM)}async executeAction(t){return t===c.GRID_MODE?this.setViewMode(m.GRID):t===c.FORM_MODE||t===c.UPDATE?this.gridToForm(t!==c.UPDATE):t===c.CONFIGURATOR?this._snkConfigurator.open():"ATTACH"===t?this.setViewMode(m.ATTACHMENT):void 0}backView(){const t=this._viewHistory.at(-2)||m.GRID;this.setViewMode(t)}setViewMode(t){this._viewStack.show(t),this._currentViewMode=t,t===m.GRID?this._snkGrid.setFocus():t===m.FORM&&this._guidesViewer.setFocus(),this.viewModeChanged.emit(t)}openConfig(t){this._snkConfigurator.close(),t===m.GRID?this._snkGrid.showConfig():t===m.FORM&&this._guidesViewer.showFormConfig()}addDataElementID(){h.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}insertionModeHandler(){this.enableGridInsert||this.gridToForm()}cancelHandler(){this._backToGrid&&this.setViewMode(m.GRID)}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}setCustomRenders(){if(this._snkGrid)for(const[t,i]of this._customRenders)this._snkGrid.addGridCustomRender(t,i),this._customRenders.delete(t)}setCustomEditors(){if(this._snkGrid&&this._guidesViewer)for(const[t,i]of this._customEditors)this._guidesViewer.addCustomEditor(t,i),this._snkGrid.addCustomEditor(t,i),this._customEditors.delete(t)}componentDidRender(){this.setCustomRenders(),this.setCustomEditors()}componentWillLoad(){this._application=n.getContextValue("__SNK__APPLICATION__");let t=this._element.parentElement;for(this._application.hasAccess(u.UPDATE,this._resourceID).then((t=>this._canEdit=t));t;){if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){this._snkDataUnit=t,this._snkDataUnit.addEventListener("insertionMode",(()=>this.insertionModeHandler())),this._snkDataUnit.addEventListener("cancelEdition",(()=>this.cancelHandler())),this._snkDataUnit.domainMessagesBuilder=this.domainMessagesBuilder,this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit?this.initDataUnit():this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail,this.initDataUnit()})),this._snkDataUnit.addEventListener("dataStateChange",this.handleDataStateChange.bind(this));break}t=t.parentElement}this.configName||(this.configName=this._application.configName)}componentDidLoad(){this.initKeyboardManager()}disconnectedCallback(){this.removeShortcuts(),window.removeEventListener("keydown",this._keyDownHandler)}async handleDataStateChange(t){var i;this._dataState=t.detail,void 0!==this._dataState.selectedRecord&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey());const s=await this._snkDataUnit.getFieldsWithRmPrecision();for(const t of s||[]){if(!t)continue;const s=null===(i=this._dataState.rowMetadata)||void 0===i?void 0:i.getProp("rm_precision",t);(s||0===s)&&(await this.setFieldProp(t,"precision",s),await this.setFieldProp(t,"prettyPrecision",s))}}async initKeyboardManager(){var t;const i=await(null===(t=this._application)||void 0===t?void 0:t.getKeyboardManager());if(i){const s=this._dataUnit||await this._snkDataUnit.getDataUnit();async function e(){const t=document.activeElement,i=t==document.body;i||t.blur(),await s.saveData(),i||null==t.setFocus?i||t.focus():t.setFocus()}i.bind("F6",this.toggleView.bind(this),{description:"Alterna entre modo formulário e grade.",element:this._element}).bind("F7",e.bind(this),{description:"Salva os dados.",element:this._element}).bind("ctrl + \\",e.bind(this),{description:"Salva os dados.",element:this._element}).bind("F8",s.addRecord.bind(s),{description:"Adiciona um novo registro.",element:this._element}).bind("F9",s.removeSelectedRecords.bind(s),{description:"Remove o registro selecionado.",element:this._element}).bind("ctrl + F9",s.removeSelectedRecords.bind(s),{description:"Remove o registro selecionado.",element:this._element}).bind("ctrl + .",(()=>0===s.getSelectionInfo().records.length?s.selectFirst():s.nextRecord()),{description:"Avança para o próximo registro.",element:this._element}).bind("ctrl + ,",s.previousRecord.bind(s),{description:"Retorna ao registro anterior.",element:this._element}).bind("F5",(async()=>{const t=await this._viewStack.getSelectedIndex();m.GRID===t&&s.loadData()}),{description:"Atualiza os dados.",element:this._element}).bind("Escape",(()=>{s.isDirty()&&s.cancelEdition()}),{debounceTime:1e3,description:"Cancela uma ação.",element:this._element})}}async removeShortcuts(){var t;const i=await(null===(t=this._application)||void 0===t?void 0:t.getKeyboardManager());i&&i.unbind("F6").unbind("F7").unbind("ctrl + \\").unbind("F8").unbind("F9").unbind("ctrl + F9").unbind("ctrl + .").unbind("ctrl + ,").unbind("F5").unbind("Escape")}async toggleView(){const t=await this._viewStack.getSelectedIndex();this.setViewMode(m.GRID===t?m.FORM:m.GRID)}async initDataUnit(){this.addDataElementID(),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),null==this._resourceID&&(this._resourceID=this._snkDataUnit.resourceID,null==this._resourceID&&(this._resourceID=await this._application.getResourceID()))}handleConfiguratorEvent(t,i){t.stopImmediatePropagation(),"SAVE"!==i?this.configuratorCancel.emit():this.configuratorSave.emit()}async keyDownListener(t){t.ctrlKey&&null!=t.key&&"F"===t.key.toUpperCase()&&null!=this._element&&(r.isHiddenElement(this._element)||(d.closeAll(),this._currentViewMode===m.GRID?await this._snkGrid.findColumn():await this._guidesViewer.findField(),t.preventDefault()))}connectedCallback(){window.addEventListener("keydown",this._keyDownHandler,{capture:!0})}render(){if(null!=this._resourceID)return this._snkDataUnit.ignoreSaveMessage=this._currentViewMode===m.GRID&&!this.enableGridInsert,s(e,null,s("ez-view-stack",{ref:t=>this._viewStack=t,"data-element-id":"crud"},s("stack-item",null,s("snk-grid",{ref:t=>this._snkGrid=t,filterBarTitle:this.filterBarTitle,"data-element-id":"crud_grid",configName:this.configName,onGridDoubleClick:()=>this.gridToForm(!0),taskbarManager:this.taskbarManager,onActionClick:t=>this.executeAction(t.detail),messagesBuilder:this.messagesBuilder,actionsList:this.actionsList,statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,presentationMode:this.presentationMode,recordsValidator:this.recordsValidator,selectionToastConfig:this.selectionToastConfig,useEnterLikeTab:this.useEnterLikeTab,canEdit:this._canEdit,resourceID:this._resourceID,disablePersonalizedFilter:this.disablePersonalizedFilter,gridLegacyConfigName:this.gridLegacyConfigName,filterBarLegacyConfigName:this.filterBarLegacyConfigName,autoLoad:this.autoLoad,autoFocus:this.autoFocus,enableGridInsert:this.enableGridInsert},s("slot",{name:"GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"SnkGridHeader"}),s("slot",{name:"SnkGridFooter"}),s("slot",{name:"SnkGridTaskBar"}))),s("stack-item",null,s("snk-guides-viewer",{ref:t=>this._guidesViewer=t,entityPath:this._snkDataUnit.entityName,messagesBuilder:this.messagesBuilder,onExit:()=>this.setViewMode(m.GRID),dataState:this._dataState,dataUnit:this._dataUnit,actionsList:this.actionsList,taskbarManager:this.taskbarManager,configName:this.configName,onActionClick:t=>this.executeAction(t.detail),presentationMode:this.presentationMode,"data-element-id":"crud_form",canEdit:this._canEdit,recordsValidator:this.recordsValidator,resourceID:this._resourceID,detailTaskbarCustomContainerId:this.customContainerId,formLegacyConfigName:this.formLegacyConfigName,enableGridInsert:this.enableGridInsert,getCustomTitle:this.setCustomFormTitle,ignoreReadOnlyFormFields:this.ignoreReadOnlyFormFields},s("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"SnkFormTaskBar"}))),s("stack-item",null,s("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this._snkDataUnit.entityName,onBack:this.backView.bind(this)})),s("snk-configurator",{ref:t=>this._snkConfigurator=t,viewMode:this._currentViewMode,messagesBuilder:this.messagesBuilder,onConfigSelected:t=>this.setViewMode(t.detail),onOpenConfig:t=>this.openConfig(t.detail),showActionButtons:this.showActionButtons,onSave:t=>this.handleConfiguratorEvent(t,"SAVE"),onCancel:t=>this.handleConfiguratorEvent(t,"CANCEL"),resourceID:this._resourceID,customContainerId:this.customContainerId})),s("div",{id:`${this.customContainerId}`},s("slot",{name:"SnkConfigContainerSlot"}),s("slot",{name:"DETAIL_GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"})))}get _element(){return a(this)}static get watchers(){return{_currentViewMode:["currentViewModeWatcher"]}}};p.style=".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";export{p as snk_crud}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,c as i,h as s,g as e}from"./p-d2d301a6.js";import{ElementIDUtils as o}from"@sankhyalabs/core";import{F as l}from"./p-ff1990ad.js";const n=class{constructor(s){t(this,s),this.valueChanged=i(this,"valueChanged",7),this.config=void 0,this.optionsList=[]}componentDidLoad(){this._element&&o.addIDInfo(this._element,"filterContentEditor")}handleToggleCheck(t,i){var s,e;let o=null!==(s=this.config.value)&&void 0!==s?s:{};o[t.name]=i,this.config=Object.assign(Object.assign({},this.config),{value:o}),this.valueChanged.emit(null===(e=this.config)||void 0===e?void 0:e.value)}renderOptions(){return this.optionsList.map((t=>s("ez-check",{label:t.label,
|
1
|
+
import{r as t,c as i,h as s,g as e}from"./p-d2d301a6.js";import{ElementIDUtils as o}from"@sankhyalabs/core";import{F as l}from"./p-ff1990ad.js";const n=class{constructor(s){t(this,s),this.valueChanged=i(this,"valueChanged",7),this.config=void 0,this.optionsList=[]}componentDidLoad(){this._element&&o.addIDInfo(this._element,"filterContentEditor")}handleToggleCheck(t,i){var s,e;let o=null!==(s=this.config.value)&&void 0!==s?s:{};o[t.name]=i,this.config=Object.assign(Object.assign({},this.config),{value:o}),this.valueChanged.emit(null===(e=this.config)||void 0===e?void 0:e.value)}renderOptions(){return this.optionsList.map((t=>s("ez-check",{label:t.label,onEzChange:i=>this.handleToggleCheck(t,i.detail),value:!!this.isChecked(t.name)})))}isChecked(t){var i;return null===(i=this.config.value)||void 0===i?void 0:i[t]}buidOptions(){var t,i,s;const e=null!==(s=null===(i=null===(t=this.config)||void 0===t?void 0:t.props)||void 0===i?void 0:i.options)&&void 0!==s?s:[];this.optionsList=[...e]}componentWillRender(){this.buidOptions()}render(){if(this.config&&this.config.type===l.CHECK_BOX_LIST)return s("div",{class:"ez-flex ez-flex--column"},this.renderOptions())}get _element(){return e(this)}};export{n as snk_filter_checkbox_list}
|