@sankhyalabs/sankhyablocks 10.1.0-dev.52 → 10.1.0-dev.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-a1fab5ca.js → ConfigStorage-4201dd3d.js} +2 -2
- package/dist/cjs/{DataFetcher-384d2ce8.js → DataFetcher-b3a8075d.js} +2830 -2
- package/dist/cjs/FormConfigHelper-c5f5473a.js +342 -0
- package/dist/cjs/{ISave-ecbe9336.js → ISave-4674c283.js} +1 -1
- package/dist/cjs/{PersonalizedFilterUtils-eccb267a.js → PersonalizedFilterUtils-263e4d24.js} +52 -5
- package/dist/cjs/{SnkFormConfigManager-44386305.js → SnkFormConfigManager-c3a49038.js} +2 -2
- package/dist/cjs/{SnkMultiSelectionListDataSource-d341dd02.js → SnkMultiSelectionListDataSource-3a13fd34.js} +4 -4
- package/dist/cjs/{auth-fetcher-6b134ec4.js → auth-fetcher-0ecc53ff.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-b9822794.js → dataunit-fetcher-c7e66f0d.js} +13 -4
- package/dist/cjs/{filter-type.enum-2bb46d2a.js → filter-type.enum-b3b388af.js} +7 -0
- package/dist/cjs/{form-config-fetcher-45d1964c.js → form-config-fetcher-f80dbc3b.js} +23 -5
- package/dist/cjs/index-1894343a.js +24 -36
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +4 -5
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_9.cjs.entry.js +5 -6
- package/dist/cjs/snk-application.cjs.entry.js +7 -8
- package/dist/cjs/snk-attach_11.cjs.entry.js +2950 -0
- package/dist/cjs/snk-crud.cjs.entry.js +31 -243
- package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -6
- package/dist/cjs/{snk-data-unit-4b6dc396.js → snk-data-unit-35f10e01.js} +11 -11
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -4
- package/dist/cjs/snk-detail-view.cjs.entry.js +9 -10
- package/dist/cjs/snk-dynaform-config-header_5.cjs.entry.js +739 -0
- package/dist/cjs/snk-dynaform-detail-view_2.cjs.entry.js +938 -0
- package/dist/cjs/snk-dynaform-field-config_2.cjs.entry.js +327 -0
- package/dist/cjs/snk-dynaform-guides-view-e98f7f3a.js +747 -0
- package/dist/cjs/snk-dynaform-guides-view.cjs.entry.js +23 -0
- package/dist/cjs/snk-dynaform.cjs.entry.js +675 -0
- package/dist/cjs/{snk-expression-group_2.cjs.entry.js → snk-expression-group_4.cjs.entry.js} +421 -18
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +41 -44
- package/dist/cjs/snk-form_2.cjs.entry.js +4 -5
- package/dist/cjs/snk-grid.cjs.entry.js +7 -8
- package/dist/cjs/{snk-guides-viewer-8e7a503b.js → snk-guides-viewer-3054d541.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +5 -6
- package/dist/cjs/snk-layout-form-config.cjs.entry.js +4 -5
- package/dist/cjs/snk-pesquisa.cjs.entry.js +4 -5
- package/dist/cjs/taskbarUtils-383c596e.js +231 -0
- package/dist/collection/collection-manifest.json +17 -0
- package/dist/collection/components/snk-dynaform/interfaces/PropsCustomEditor.js +1 -0
- package/dist/collection/components/snk-dynaform/interfaces/PropsCustomRender.js +1 -0
- package/dist/collection/components/snk-dynaform/snk-dynaform.css +64 -0
- package/dist/collection/components/snk-dynaform/snk-dynaform.js +1657 -0
- package/dist/collection/components/snk-dynaform/subcomponents/CardFormResizeObserver.js +26 -0
- package/dist/collection/components/snk-dynaform/subcomponents/GuideBuilder.js +51 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.css +112 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.js +992 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.css +64 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.js +588 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-guides-view/snk-dynaform-guides-view.css +98 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-guides-view/snk-dynaform-guides-view.js +1167 -0
- package/dist/collection/components/snk-dynaform-form-config/FormConfigHelper.js +325 -0
- package/dist/collection/components/snk-dynaform-form-config/SnkFormConfigManager.js +212 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.css +17 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.js +236 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.css +41 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.js +170 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.css +22 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.js +408 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-item.css +88 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-item.js +209 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.css +167 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.js +655 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.css +42 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.js +171 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-form-config.css +66 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-form-config.js +557 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.css +80 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.js +326 -0
- package/dist/collection/components/snk-grid/snk-grid.css +4 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +11 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +22 -4
- package/dist/components/dataunit-fetcher.js +11 -1
- package/dist/components/form-config-fetcher.js +22 -4
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.js +12 -0
- package/dist/components/snk-crud.js +1 -212
- package/dist/components/snk-dynaform-config-header.d.ts +11 -0
- package/dist/components/snk-dynaform-config-header.js +6 -0
- package/dist/components/snk-dynaform-config-header2.js +103 -0
- package/dist/components/snk-dynaform-configs-button.d.ts +11 -0
- package/dist/components/snk-dynaform-configs-button.js +6 -0
- package/dist/components/snk-dynaform-configs-button2.js +76 -0
- package/dist/components/snk-dynaform-detail-view.d.ts +11 -0
- package/dist/components/snk-dynaform-detail-view.js +6 -0
- package/dist/components/snk-dynaform-detail-view2.js +1835 -0
- package/dist/components/snk-dynaform-field-config.d.ts +11 -0
- package/dist/components/snk-dynaform-field-config.js +6 -0
- package/dist/components/snk-dynaform-field-config2.js +605 -0
- package/dist/components/snk-dynaform-field-item.d.ts +11 -0
- package/dist/components/snk-dynaform-field-item.js +6 -0
- package/dist/components/snk-dynaform-field-item2.js +96 -0
- package/dist/components/snk-dynaform-fields-layout.d.ts +11 -0
- package/dist/components/snk-dynaform-fields-layout.js +6 -0
- package/dist/components/snk-dynaform-fields-layout2.js +428 -0
- package/dist/components/snk-dynaform-fields-selector.d.ts +11 -0
- package/dist/components/snk-dynaform-fields-selector.js +6 -0
- package/dist/components/snk-dynaform-fields-selector2.js +104 -0
- package/dist/components/snk-dynaform-form-config.d.ts +11 -0
- package/dist/components/snk-dynaform-form-config.js +6 -0
- package/dist/components/snk-dynaform-form-config2.js +430 -0
- package/dist/components/snk-dynaform-form-view.d.ts +11 -0
- package/dist/components/snk-dynaform-form-view.js +6 -0
- package/dist/components/snk-dynaform-form-view2.js +270 -0
- package/dist/components/snk-dynaform-guides-configurator.d.ts +11 -0
- package/dist/components/snk-dynaform-guides-configurator.js +6 -0
- package/dist/components/snk-dynaform-guides-configurator2.js +173 -0
- package/dist/components/snk-dynaform-guides-view.d.ts +11 -0
- package/dist/components/snk-dynaform-guides-view.js +6 -0
- package/dist/components/snk-dynaform.d.ts +11 -0
- package/dist/components/snk-dynaform.js +1003 -0
- package/dist/components/snk-grid2.js +1 -1
- package/dist/components/taskbarUtils.js +224 -0
- package/dist/esm/{ConfigStorage-76872695.js → ConfigStorage-e834d1ea.js} +2 -2
- package/dist/esm/{DataFetcher-e60f8d53.js → DataFetcher-5ed0a377.js} +2830 -3
- package/dist/esm/FormConfigHelper-efc29480.js +328 -0
- package/dist/esm/{ISave-4929c071.js → ISave-5b46d691.js} +1 -1
- package/dist/esm/{PersonalizedFilterUtils-d2439a9a.js → PersonalizedFilterUtils-45b5803c.js} +49 -2
- package/dist/esm/{SnkFormConfigManager-83f6b22f.js → SnkFormConfigManager-bfd575c2.js} +2 -2
- package/dist/esm/{SnkMultiSelectionListDataSource-18abafb1.js → SnkMultiSelectionListDataSource-22b50dd6.js} +4 -4
- package/dist/esm/{auth-fetcher-1a31c1e4.js → auth-fetcher-5283045d.js} +1 -1
- package/dist/esm/{dataunit-fetcher-c176e002.js → dataunit-fetcher-2200fdd6.js} +12 -3
- package/dist/esm/{filter-type.enum-f6a8fe23.js → filter-type.enum-62b7fe88.js} +8 -1
- package/dist/esm/{form-config-fetcher-b44b2727.js → form-config-fetcher-db1bf140.js} +23 -5
- package/dist/esm/index-04f73a26.js +24 -36
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-grid_2.entry.js +4 -5
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_9.entry.js +5 -6
- package/dist/esm/snk-application.entry.js +6 -7
- package/dist/esm/snk-attach_11.entry.js +2936 -0
- package/dist/esm/snk-crud.entry.js +6 -218
- package/dist/esm/snk-data-exporter.entry.js +5 -6
- package/dist/esm/{snk-data-unit-d8cfa950.js → snk-data-unit-e8bd4143.js} +2 -2
- package/dist/esm/snk-data-unit.entry.js +3 -4
- package/dist/esm/snk-detail-view.entry.js +7 -8
- package/dist/esm/snk-dynaform-config-header_5.entry.js +731 -0
- package/dist/esm/snk-dynaform-detail-view_2.entry.js +933 -0
- package/dist/esm/snk-dynaform-field-config_2.entry.js +322 -0
- package/dist/esm/snk-dynaform-guides-view-1f1455d6.js +744 -0
- package/dist/esm/snk-dynaform-guides-view.entry.js +15 -0
- package/dist/esm/snk-dynaform.entry.js +671 -0
- package/dist/esm/{snk-expression-group_2.entry.js → snk-expression-group_4.entry.js} +405 -4
- package/dist/esm/snk-filter-bar_4.entry.js +5 -8
- package/dist/esm/snk-form_2.entry.js +4 -5
- package/dist/esm/snk-grid.entry.js +7 -8
- package/dist/esm/{snk-guides-viewer-adf39ea2.js → snk-guides-viewer-95fefcaa.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +5 -6
- package/dist/esm/snk-layout-form-config.entry.js +4 -5
- package/dist/esm/snk-pesquisa.entry.js +4 -5
- package/dist/esm/taskbarUtils-682ca78c.js +225 -0
- package/dist/sankhyablocks/p-06b6c284.entry.js +1 -0
- package/dist/sankhyablocks/p-09e2255b.entry.js +1 -0
- package/dist/sankhyablocks/p-0dbd53d9.js +1 -0
- package/dist/sankhyablocks/{p-5c250661.js → p-1a04f537.js} +1 -1
- package/dist/sankhyablocks/{p-ab5e12fa.js → p-1cc4cf61.js} +1 -1
- package/dist/sankhyablocks/{p-f5ad0720.js → p-2040953e.js} +1 -1
- package/dist/sankhyablocks/p-22ddc1a5.entry.js +1 -0
- package/dist/sankhyablocks/p-24b059ee.entry.js +1 -0
- package/dist/sankhyablocks/p-2b581179.entry.js +1 -0
- package/dist/sankhyablocks/p-449dfe55.entry.js +1 -0
- package/dist/sankhyablocks/p-451b5bcc.entry.js +1 -0
- package/dist/sankhyablocks/p-46d7e2de.js +1 -0
- package/dist/sankhyablocks/{p-3c990841.js → p-51e853f2.js} +1 -1
- package/dist/sankhyablocks/p-51f1485c.entry.js +1 -0
- package/dist/sankhyablocks/p-58709cf9.js +1 -0
- package/dist/sankhyablocks/p-589016e2.entry.js +1 -0
- package/dist/sankhyablocks/p-5c6eede7.js +60 -0
- package/dist/sankhyablocks/p-5d02c032.js +1 -0
- package/dist/sankhyablocks/p-5d50f59a.entry.js +1 -0
- package/dist/sankhyablocks/p-670c43e3.entry.js +1 -0
- package/dist/sankhyablocks/{p-b1bb4cf1.js → p-70c2ee5c.js} +1 -1
- package/dist/sankhyablocks/p-77c26de0.js +1 -0
- package/dist/sankhyablocks/p-92c71225.entry.js +1 -0
- package/dist/sankhyablocks/p-9c89a76a.entry.js +1 -0
- package/dist/sankhyablocks/{p-4f7adf97.js → p-b1bf9564.js} +1 -1
- package/dist/sankhyablocks/p-c538bd6c.entry.js +1 -0
- package/dist/sankhyablocks/p-ccd61eb8.entry.js +1 -0
- package/dist/sankhyablocks/{p-3704bf1b.js → p-d5810110.js} +1 -1
- package/dist/sankhyablocks/p-d88278f8.js +28 -0
- package/dist/sankhyablocks/p-dc45e9e5.entry.js +1 -0
- package/dist/sankhyablocks/{p-8fe740b7.entry.js → p-dc83c70f.entry.js} +2 -2
- package/dist/sankhyablocks/p-e5362a5c.js +1 -0
- package/dist/sankhyablocks/p-edd44079.entry.js +1 -0
- package/dist/sankhyablocks/p-eff38390.entry.js +1 -0
- package/dist/sankhyablocks/p-ff28e5e4.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-dynaform/interfaces/PropsCustomEditor.d.ts +4 -0
- package/dist/types/components/snk-dynaform/interfaces/PropsCustomRender.d.ts +4 -0
- package/dist/types/components/snk-dynaform/subcomponents/CardFormResizeObserver.d.ts +1 -0
- package/dist/types/components/snk-dynaform/subcomponents/GuideBuilder.d.ts +14 -0
- package/dist/types/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.d.ts +158 -0
- package/dist/types/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.d.ts +107 -0
- package/dist/types/components/snk-dynaform-form-config/FormConfigHelper.d.ts +36 -0
- package/dist/types/components/snk-dynaform-form-config/SnkFormConfigManager.d.ts +35 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.d.ts +23 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.d.ts +19 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.d.ts +56 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.d.ts +74 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.d.ts +21 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-form-config.d.ts +95 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.d.ts +35 -0
- package/dist/types/components.d.ts +2403 -1322
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +1 -0
- package/package.json +5 -1
- package/react/components.d.ts +12 -0
- package/react/components.js +12 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/SnkMessageBuilder-a9300ebe.js +0 -2833
- package/dist/cjs/default-filters-a09bf82b.js +0 -8
- package/dist/cjs/index-62760a9c.js +0 -49
- package/dist/cjs/index-8d94b7e0.js +0 -7
- package/dist/cjs/snk-attach.cjs.entry.js +0 -948
- package/dist/cjs/snk-default-filter.cjs.entry.js +0 -77
- package/dist/cjs/snk-filter-advanced-mode_3.cjs.entry.js +0 -99
- package/dist/cjs/snk-filter-detail.cjs.entry.js +0 -198
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +0 -408
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +0 -109
- package/dist/cjs/snk-image-input.cjs.entry.js +0 -160
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +0 -358
- package/dist/cjs/snk-simple-crud.cjs.entry.js +0 -865
- package/dist/esm/SnkMessageBuilder-1eb7a1af.js +0 -2831
- package/dist/esm/default-filters-50105e43.js +0 -8
- package/dist/esm/index-620ac460.js +0 -7
- package/dist/esm/index-8acbae97.js +0 -49
- package/dist/esm/snk-attach.entry.js +0 -944
- package/dist/esm/snk-default-filter.entry.js +0 -73
- package/dist/esm/snk-filter-advanced-mode_3.entry.js +0 -93
- package/dist/esm/snk-filter-detail.entry.js +0 -194
- package/dist/esm/snk-filter-field-search_2.entry.js +0 -403
- package/dist/esm/snk-filter-modal-item.entry.js +0 -105
- package/dist/esm/snk-image-input.entry.js +0 -156
- package/dist/esm/snk-personalized-filter.entry.js +0 -354
- package/dist/esm/snk-simple-crud.entry.js +0 -861
- package/dist/sankhyablocks/p-0a4cdcde.entry.js +0 -1
- package/dist/sankhyablocks/p-0afc64df.entry.js +0 -1
- package/dist/sankhyablocks/p-10f27dc6.entry.js +0 -1
- package/dist/sankhyablocks/p-20f03230.entry.js +0 -1
- package/dist/sankhyablocks/p-2af8aca3.js +0 -1
- package/dist/sankhyablocks/p-3870748a.js +0 -28
- package/dist/sankhyablocks/p-3d294185.entry.js +0 -1
- package/dist/sankhyablocks/p-438a225f.entry.js +0 -1
- package/dist/sankhyablocks/p-4d04bc75.entry.js +0 -1
- package/dist/sankhyablocks/p-554c0e54.js +0 -1
- package/dist/sankhyablocks/p-57c184a2.entry.js +0 -1
- package/dist/sankhyablocks/p-68c1a093.js +0 -1
- package/dist/sankhyablocks/p-6a4b21dd.js +0 -1
- package/dist/sankhyablocks/p-6ae7543b.entry.js +0 -1
- package/dist/sankhyablocks/p-6e278003.js +0 -60
- package/dist/sankhyablocks/p-82bcb4cf.entry.js +0 -1
- package/dist/sankhyablocks/p-84345e7a.js +0 -1
- package/dist/sankhyablocks/p-95af0bb1.entry.js +0 -1
- package/dist/sankhyablocks/p-a905712a.entry.js +0 -1
- package/dist/sankhyablocks/p-aff2d081.entry.js +0 -1
- package/dist/sankhyablocks/p-b0a357b4.entry.js +0 -1
- package/dist/sankhyablocks/p-b568c1d4.js +0 -1
- package/dist/sankhyablocks/p-bab4cde4.entry.js +0 -1
- package/dist/sankhyablocks/p-bd3c1aaa.entry.js +0 -1
- package/dist/sankhyablocks/p-cc64239c.entry.js +0 -1
- package/dist/sankhyablocks/p-cd00a3d1.entry.js +0 -1
- package/dist/sankhyablocks/p-d9ec8c4b.entry.js +0 -1
- package/dist/sankhyablocks/p-dbdbb77a.entry.js +0 -1
- package/dist/sankhyablocks/p-e8df1dea.entry.js +0 -1
- package/dist/sankhyablocks/p-ef9343c3.entry.js +0 -1
- package/dist/sankhyablocks/p-f4184ce7.js +0 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import './DataFetcher-5ed0a377.js';
|
|
2
|
+
import './ISave-5b46d691.js';
|
|
3
|
+
import '@sankhyalabs/core';
|
|
4
|
+
import { P as PresentationMode } from './index-b40568ff.js';
|
|
5
|
+
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
6
|
+
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
7
|
+
import './dataunit-fetcher-2200fdd6.js';
|
|
8
|
+
import './filter-item-type.enum-d45e026f.js';
|
|
9
|
+
import './form-config-fetcher-db1bf140.js';
|
|
10
|
+
import { V as VIEW_MODE } from './constants-7b422de0.js';
|
|
11
|
+
import { T as TaskbarElement } from './taskbar-elements-63651ca7.js';
|
|
12
|
+
|
|
13
|
+
class SimpleTaskbarProcessor {
|
|
14
|
+
/**
|
|
15
|
+
* Cria uma nova instância do processador de taskbar.
|
|
16
|
+
* @param defaultButtons - Array com os botões padrão a serem exibidos
|
|
17
|
+
*/
|
|
18
|
+
constructor(defaultButtons) {
|
|
19
|
+
this._defaultButtons = [];
|
|
20
|
+
this._defaultButtons = [...defaultButtons];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Processa a taskbar aplicando regras de visibilidade e habilitação.
|
|
24
|
+
* @param taskbarID - Identificador único da taskbar
|
|
25
|
+
* @param taskbarManager - Gerenciador de taskbar com regras customizadas
|
|
26
|
+
* @param dataState - Estado atual dos dados
|
|
27
|
+
* @param disabledButtons - Array de botões desabilitados
|
|
28
|
+
* @param invisibleButtons - Array de botões invisíveis
|
|
29
|
+
*/
|
|
30
|
+
process(taskbarID, taskbarManager, dataState, disabledButtons = [], invisibleButtons = []) {
|
|
31
|
+
var _a;
|
|
32
|
+
this.taskbarID = taskbarID;
|
|
33
|
+
this.customButtons = new Map();
|
|
34
|
+
this.buttonsArray = [];
|
|
35
|
+
this.disabledButtons = [...disabledButtons];
|
|
36
|
+
(_a = this.getButtonsArray(taskbarManager, dataState)) === null || _a === void 0 ? void 0 : _a.forEach((btnDef) => {
|
|
37
|
+
let buttonName;
|
|
38
|
+
if (typeof btnDef === "string") {
|
|
39
|
+
buttonName = btnDef;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.customButtons.set(btnDef.name, btnDef);
|
|
43
|
+
buttonName = btnDef.name;
|
|
44
|
+
}
|
|
45
|
+
if (!invisibleButtons.includes(buttonName)) {
|
|
46
|
+
if (!this.isEnabled(taskbarManager, buttonName, dataState, disabledButtons)) {
|
|
47
|
+
this.disabledButtons.push(buttonName);
|
|
48
|
+
}
|
|
49
|
+
this.buttonsArray.push(buttonName);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
this.buttons = this.buttonsArray.join(",");
|
|
53
|
+
}
|
|
54
|
+
getButtonsArray(taskbarManager, dataState) {
|
|
55
|
+
if (taskbarManager) {
|
|
56
|
+
return taskbarManager.getButtons(this.taskbarID, dataState, [...this._defaultButtons]);
|
|
57
|
+
}
|
|
58
|
+
return this._defaultButtons;
|
|
59
|
+
}
|
|
60
|
+
isEnabled(taskbarManager, buttonName, dataState, disabled) {
|
|
61
|
+
const originalValue = !disabled.includes(buttonName);
|
|
62
|
+
if (taskbarManager && taskbarManager.isEnabled) {
|
|
63
|
+
return taskbarManager.isEnabled(this.taskbarID, dataState, buttonName, originalValue);
|
|
64
|
+
}
|
|
65
|
+
return originalValue;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const DEFAULT_TASKBAR_BUTTONS = [
|
|
70
|
+
TaskbarElement.FORM_MODE,
|
|
71
|
+
TaskbarElement.PREVIOUS,
|
|
72
|
+
TaskbarElement.NEXT,
|
|
73
|
+
TaskbarElement.REFRESH,
|
|
74
|
+
TaskbarElement.SPACER,
|
|
75
|
+
TaskbarElement.ACTIONS_BUTTON,
|
|
76
|
+
TaskbarElement.DATA_EXPORTER,
|
|
77
|
+
TaskbarElement.ATTACH,
|
|
78
|
+
TaskbarElement.CLONE,
|
|
79
|
+
TaskbarElement.UPDATE,
|
|
80
|
+
TaskbarElement.REMOVE,
|
|
81
|
+
TaskbarElement.INSERT,
|
|
82
|
+
TaskbarElement.CONFIGURATOR,
|
|
83
|
+
TaskbarElement.MORE_OPTIONS,
|
|
84
|
+
];
|
|
85
|
+
var CustomTaskbarButton;
|
|
86
|
+
(function (CustomTaskbarButton) {
|
|
87
|
+
CustomTaskbarButton["FILTER"] = "FILTER";
|
|
88
|
+
CustomTaskbarButton["ENTITY_SEARCH"] = "ENTITY_SEARCH";
|
|
89
|
+
})(CustomTaskbarButton || (CustomTaskbarButton = {}));
|
|
90
|
+
/**
|
|
91
|
+
* Insere os botões customizados à esquerda do elemento SPACER na lista de botões.
|
|
92
|
+
* Caso o SPACER não seja encontrado, os botões são inseridos no início da lista.
|
|
93
|
+
*/
|
|
94
|
+
function insertCustomButtonsBeforeSpacer(buttons, customButtons) {
|
|
95
|
+
const spacerIndex = buttons.findIndex(btn => btn === TaskbarElement.SPACER || (typeof btn === 'string' && btn === 'SPACER'));
|
|
96
|
+
if (spacerIndex > -1) {
|
|
97
|
+
return [
|
|
98
|
+
...buttons.slice(0, spacerIndex),
|
|
99
|
+
...customButtons,
|
|
100
|
+
...buttons.slice(spacerIndex),
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
return [...customButtons, ...buttons];
|
|
104
|
+
}
|
|
105
|
+
function buildNavigationDisabledBtns(dataState) {
|
|
106
|
+
const navigationDisabled = [];
|
|
107
|
+
if (!(dataState === null || dataState === void 0 ? void 0 : dataState.hasPrevious)) {
|
|
108
|
+
navigationDisabled.push(TaskbarElement.PREVIOUS);
|
|
109
|
+
}
|
|
110
|
+
if (!(dataState === null || dataState === void 0 ? void 0 : dataState.hasNext)) {
|
|
111
|
+
navigationDisabled.push(TaskbarElement.NEXT);
|
|
112
|
+
}
|
|
113
|
+
return navigationDisabled;
|
|
114
|
+
}
|
|
115
|
+
function buildNativeTaskbarManager(currentViewMode, mergeTaskbarManager, messagesBuilder) {
|
|
116
|
+
var _a, _b;
|
|
117
|
+
const CUSTOM_BUTTONS = [
|
|
118
|
+
{
|
|
119
|
+
name: CustomTaskbarButton.FILTER,
|
|
120
|
+
hint: (_a = messagesBuilder === null || messagesBuilder === void 0 ? void 0 : messagesBuilder.getMessage("snkCrud.customButtons.filter")) !== null && _a !== void 0 ? _a : "Abre o painel de filtros",
|
|
121
|
+
iconName: "filter",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: CustomTaskbarButton.ENTITY_SEARCH,
|
|
125
|
+
hint: (_b = messagesBuilder === null || messagesBuilder === void 0 ? void 0 : messagesBuilder.getMessage("snkCrud.customButtons.entitySearch")) !== null && _b !== void 0 ? _b : "Busca na entidade",
|
|
126
|
+
iconName: "search",
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
const EDITION_MODE_BUTTONS = [
|
|
130
|
+
TaskbarElement.CANCEL,
|
|
131
|
+
TaskbarElement.SAVE,
|
|
132
|
+
];
|
|
133
|
+
return {
|
|
134
|
+
getButtons: (taskbarID, dataState, defaultButtons) => {
|
|
135
|
+
var _a, _b;
|
|
136
|
+
if (!taskbarID) {
|
|
137
|
+
console.warn('taskbarID não fornecido');
|
|
138
|
+
return [];
|
|
139
|
+
}
|
|
140
|
+
const isInEditionMode = (dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty);
|
|
141
|
+
if (isInEditionMode) {
|
|
142
|
+
return EDITION_MODE_BUTTONS;
|
|
143
|
+
}
|
|
144
|
+
if (currentViewMode === VIEW_MODE.FORM) {
|
|
145
|
+
const indexFormMode = defaultButtons.indexOf(TaskbarElement.FORM_MODE);
|
|
146
|
+
if (indexFormMode > -1) {
|
|
147
|
+
defaultButtons = [
|
|
148
|
+
...defaultButtons.slice(0, indexFormMode),
|
|
149
|
+
TaskbarElement.GRID_MODE,
|
|
150
|
+
...defaultButtons.slice(indexFormMode + 1)
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (((_b = (_a = dataState === null || dataState === void 0 ? void 0 : dataState.selectionInfo) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.length) > 1) {
|
|
155
|
+
const indexUpdate = defaultButtons.indexOf(TaskbarElement.UPDATE);
|
|
156
|
+
if (indexUpdate > -1) {
|
|
157
|
+
defaultButtons = [
|
|
158
|
+
...defaultButtons.slice(0, indexUpdate),
|
|
159
|
+
TaskbarElement.UPDATE_MULTIPLE,
|
|
160
|
+
...defaultButtons.slice(indexUpdate + 1)
|
|
161
|
+
];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const defaultsWithCustomButtons = insertCustomButtonsBeforeSpacer(defaultButtons, CUSTOM_BUTTONS);
|
|
165
|
+
if (mergeTaskbarManager === null || mergeTaskbarManager === void 0 ? void 0 : mergeTaskbarManager.getButtons) {
|
|
166
|
+
return mergeTaskbarManager.getButtons(taskbarID, dataState, defaultsWithCustomButtons);
|
|
167
|
+
}
|
|
168
|
+
return defaultsWithCustomButtons;
|
|
169
|
+
},
|
|
170
|
+
isEnabled: (_, dataState, buttonName, originalValue) => {
|
|
171
|
+
var _a;
|
|
172
|
+
if (!dataState) {
|
|
173
|
+
return originalValue;
|
|
174
|
+
}
|
|
175
|
+
const hasSelectedRecord = dataState.selectedRecord !== undefined;
|
|
176
|
+
const buttonsRequiringSelection = [
|
|
177
|
+
TaskbarElement.UPDATE,
|
|
178
|
+
TaskbarElement.REMOVE,
|
|
179
|
+
TaskbarElement.ATTACH,
|
|
180
|
+
TaskbarElement.CLONE,
|
|
181
|
+
];
|
|
182
|
+
if (!hasSelectedRecord && buttonsRequiringSelection.includes(buttonName)) {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
const navigationDisabled = buildNavigationDisabledBtns(dataState);
|
|
186
|
+
if (navigationDisabled.includes(buttonName)) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
return (_a = mergeTaskbarManager === null || mergeTaskbarManager === void 0 ? void 0 : mergeTaskbarManager.isEnabled(_, dataState, buttonName, originalValue)) !== null && _a !== void 0 ? _a : originalValue;
|
|
190
|
+
},
|
|
191
|
+
getMoreOptions(taskbarId, configName, dataState, currentActions) {
|
|
192
|
+
var _a;
|
|
193
|
+
return (_a = mergeTaskbarManager === null || mergeTaskbarManager === void 0 ? void 0 : mergeTaskbarManager.getMoreOptions) === null || _a === void 0 ? void 0 : _a.call(mergeTaskbarManager, taskbarId, configName, dataState, currentActions);
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function getHeaderTaskbarId(dataState, presentationMode) {
|
|
198
|
+
var _a;
|
|
199
|
+
const hasSelectedRecord = dataState && !!((_a = dataState.selectionInfo) === null || _a === void 0 ? void 0 : _a.length);
|
|
200
|
+
const taskbarIdPrefixLookup = {
|
|
201
|
+
primary: "snkGridHeaderTaskbar",
|
|
202
|
+
secondary: "snkGridHeaderTaskbar",
|
|
203
|
+
singleTaskbar: "snkGridHeaderTaskbar.singleTaskbar",
|
|
204
|
+
};
|
|
205
|
+
const taskbarIdPrefix = taskbarIdPrefixLookup[presentationMode];
|
|
206
|
+
let headerTaskbarId = hasSelectedRecord ? `${taskbarIdPrefix}.selected` : `${taskbarIdPrefix}.unselected`;
|
|
207
|
+
if ((dataState === null || dataState === void 0 ? void 0 : dataState.isDirty) && presentationMode === PresentationMode.SINGLE_TASKBAR) {
|
|
208
|
+
headerTaskbarId = "snkGridHeaderTaskbar.singleTaskbar.finish_edition";
|
|
209
|
+
}
|
|
210
|
+
return headerTaskbarId;
|
|
211
|
+
}
|
|
212
|
+
function getTopTaskBarId(dataState, presentationMode) {
|
|
213
|
+
const suffixLookup = {
|
|
214
|
+
primary: '',
|
|
215
|
+
secondary: '.secondary',
|
|
216
|
+
singleTaskbar: '.singleTaskbar',
|
|
217
|
+
};
|
|
218
|
+
const sufix = suffixLookup[presentationMode];
|
|
219
|
+
if (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty) {
|
|
220
|
+
return `snkGridTopTaskbar.finish_edition${sufix}`;
|
|
221
|
+
}
|
|
222
|
+
return `snkGridTopTaskbar.regular${sufix}`;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export { CustomTaskbarButton as C, DEFAULT_TASKBAR_BUTTONS as D, SimpleTaskbarProcessor as S, getHeaderTaskbarId as a, buildNativeTaskbarManager as b, getTopTaskBarId as g };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,e as i,h as s,f as e,F as n,g as a}from"./p-2c9d0870.js";import{ApplicationContext as o,DataType as r,Action as l,UserInterface as h,StringUtils as d,DataUnitLoaderUtils as c,DataUnit as u,ElementIDUtils as v,ObjectUtils as m,KeyboardManager as f}from"@sankhyalabs/core";import{D as p,S as g}from"./p-5d02c032.js";import{S as b}from"./p-b1bf9564.js";import{P as k}from"./p-0f3698af.js";import{P as _,D as y,I as w}from"./p-5c6eede7.js";import{F as C}from"./p-ff1990ad.js";import{F as z}from"./p-d88278f8.js";import{V as A,S as x}from"./p-9019a32f.js";import{A as S}from"./p-d5810110.js";import{T as O}from"./p-3072136e.js";import{A as F,F as I}from"./p-0dbd53d9.js";import{focusOnFieldSerch as E,SEARCH_FIELD_FULL_WIDTH as P,FormLayout as N,ApplicationUtils as T,CSSVarsUtils as L,buildFieldSearch as D}from"@sankhyalabs/ezui/dist/collection/utils";import{DataBinder as j}from"@sankhyalabs/ezui/dist/collection/utils/form";import{g as R,b as M,s as U,a as V,d as B}from"./p-af673291.js";import{P as K,a as G,D as $}from"./p-58709cf9.js";import{E as q}from"./p-1a68fb59.js";import{C as H,P as Q}from"./p-51e853f2.js";import{s as J}from"./p-a73b6b00.js";import{S as W,T as X,R as Y,a as Z,b as tt}from"./p-1a04f537.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{S as it}from"./p-1cc4cf61.js";import{C as st}from"./p-e5a3711f.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-7dd49d15.js";import"./p-8f3f2306.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";class et{constructor(t){this.dataUnitName=t}async save({dataUnit:t,record:i,updatingFields:s,operation:e}){var n,a;const o="INSERT"==e,r=o?s:i;if(!o&&(null==s?void 0:s.DESCRICAO)&&(null==s?void 0:s.DESCRICAO)!==(null==i?void 0:i.DESCRICAO))throw new Error(b.DESCRIPTION_CANNOT_BE_CHANGED);const l={anexo:{codata:o?null==s?void 0:s.REGISTER_KEY:null==i?void 0:i.CODATA,sequencia:(null==r?void 0:r.SEQUENCIA)||"0",tipo:(null==r?void 0:r.TIPO)||"N",descricao:null==r?void 0:r.DESCRICAO,arquivo:null===(a=null===(n=s.CAMINHO_ARQUIVO)||void 0===n?void 0:n[0])||void 0===a?void 0:a.name,ehInclusao:o?"S":"N",ehArquivoRepositorio:"N"}};return new Promise(((i,e)=>{p.get().callServiceBroker("Attach.save",JSON.stringify(l)).then((e=>{var n;return i([Object.assign(Object.assign(Object.assign({},e),s),{__owner__dataunit__name__:null!==(n=this.dataUnitName)&&void 0!==n?n:t})])})).catch((t=>e(t)))}))}async edit(t){throw new Error("Method not implemented.")}async delete(t){var i={anexo:{codata:t.CODATA,tipo:t.TIPO,descricao:t.DESCRICAO}};const s=await p.get().callServiceBroker("Attach.remove",JSON.stringify(i));return Promise.resolve(s)}async getDownloadKey(t){var i,s,e;if("S"==t.EHARQUIVOREPOSITORIO){const e={config:{path:t.ARQUIVO,tipoconteudo:t.TIPOCONTEUDO}},n=await p.get().callServiceBroker("RepositorioArquivoSP.abreArquivo",JSON.stringify(e));return Promise.resolve({chave:{valor:null===(s=null===(i=null==n?void 0:n.responseBody)||void 0===i?void 0:i.chave)||void 0===s?void 0:s.valor}})}const n={anexo:{codata:t.CODATA,codemp:t.CODEMP,sequencia:t.SEQUENCIA,tipo:t.TIPO,descricao:t.DESCRICAO,tipoConteudo:t.TIPOCONTEUDO}},a=await p.get().callServiceBroker("Attach.view",JSON.stringify(n));return(null==a?void 0:a.chaveAnexo)?Promise.resolve({chave:{valor:null===(e=null==a?void 0:a.chaveAnexo)||void 0===e?void 0:e.idChaveAnexo}}):Promise.reject(new Error("File not found."))}}const nt="AnexoSistemaSP.salvar",at="AnexoSistemaSP.excluir",ot="AnexoSistemaSP.baixar";class rt{constructor(t,i){var s;this.entityName=t,this.dataUnitName=i,this.validateFields=t=>{if(t.LINK&&t.NOMEARQUIVO)throw new Error(b.LINK_AND_FILE_AT_THE_SAME_TIME);if(!t.LINK&&!t.NOMEARQUIVO)throw new Error(b.ANY_LINK_OR_FILE_FILLED);if(!this._registerKey)throw new Error("Register key can not be null")},this.resourceID=window.resourceID||(null===(s=window.workspace)||void 0===s?void 0:s.resourceID)}set registerKey(t){this._registerKey=t}async save(t){var i,s;let{updatingFields:e}=t;e=Object.assign(Object.assign({},e),{NOMEARQUIVO:null===(i=e.NOMEARQUIVO)||void 0===i?void 0:i[0]});try{this.validateFields(e);const t=e.LINK?null:e.NOMEARQUIVO,i={serviceName:nt,requestBody:{params:{resourceID:this.resourceID,description:e.DESCRICAO,fileSelect:t?1:0,keySession:null===(s=null==t?void 0:t.properties)||void 0===s?void 0:s.fileNameTmp,nameAttach:null==t?void 0:t.name,link:e.LINK,nameEntity:this.entityName,pkEntity:this._registerKey,typeAcess:e.TIPOACESSO,typeApres:e.TIPOAPRES}}},n=await p.get().callServiceBroker(nt,JSON.stringify(i));return Promise.resolve([Object.assign(Object.assign(Object.assign({},n),e),{ARQUIVOOULINK:e.LINK?e.LINK:null==t?void 0:t.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}async edit(t){var i,s,e;let{updatingFields:n,record:a}=t;const o=t=>void 0!==n[t]?n[t]:a[t],r=o("NOMEARQUIVO"),l=null===(s=null===(i=n.NOMEARQUIVO)||void 0===i?void 0:i[0])||void 0===s?void 0:s.downloadURL;n=Object.assign(Object.assign({},n),{DESCRICAO:o("DESCRICAO"),LINK:o("LINK"),TIPOACESSO:o("TIPOACESSO"),TIPOAPRES:o("TIPOAPRES"),CHAVEARQUIVO:a.CHAVEARQUIVO,NOMEARQUIVO:null==r?void 0:r[0]});const h=n.LINK?null:n.NOMEARQUIVO;try{this.validateFields(n);const t={serviceName:nt,requestBody:{params:{resourceID:this.resourceID,nuAttach:null==a?void 0:a.NUATTACH,description:n.DESCRICAO,fileSelect:l?1:0,keySession:null===(e=null==h?void 0:h.properties)||void 0===e?void 0:e.fileNameTmp,keyAttach:n.CHAVEARQUIVO,nameAttach:null==h?void 0:h.name,link:n.LINK,nameEntity:this.entityName,pkEntity:this._registerKey,typeAcess:n.TIPOACESSO,typeApres:n.TIPOAPRES}}},i=await p.get().callServiceBroker(nt,JSON.stringify(t));return Promise.resolve([Object.assign(Object.assign(Object.assign({},i),n),{ARQUIVOOULINK:n.LINK?n.LINK:null==h?void 0:h.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}delete(t){var i;const s=(null===(i=t.NOMEARQUIVO)||void 0===i?void 0:i[0])||{},e={serviceName:at,requestBody:{paramsDelete:{keyAttach:t.CHAVEARQUIVO,nameAttach:null==s?void 0:s.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO}}};return new Promise(((t,i)=>{p.get().callServiceBroker(at,JSON.stringify(e)).then((i=>t(i))).catch((t=>i(t)))}))}getDownloadKey(t){var i;const s=(null===(i=t.NOMEARQUIVO)||void 0===i?void 0:i[0])||{},e={serviceName:ot,requestBody:{paramsDown:{nameAttach:null==s?void 0:s.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO,keyAttach:t.CHAVEARQUIVO}}};return new Promise(((t,i)=>{p.get().callServiceBroker(ot,JSON.stringify(e)).then((i=>t(i))).catch((t=>i(t)))}))}}class lt{constructor(t,i){this.entityName=t,this.getMessage=i,this._application=o.getContextValue("__SNK__APPLICATION__")}initLoaders(t,i,s){this.loader||(this.loader=t.dataLoader),t.dataLoader=(t,i)=>this.dataLoader(t,i),t.saveLoader=(t,e)=>this.saveLoader(e,i).then((t=>(t.length&&s(),t))),t.removeLoader=(t,e)=>this.removeLoader(t,e,i).then((t=>(t.length&&s(),t)))}metadataLoader(t){throw new Error("Method not implemented.")}dataLoader(t,i){return new Promise((s=>{this.loader(t,i).then((t=>{const i=((null==t?void 0:t.records)||[]).map((t=>{let i;return t.LINK||(i=[{name:t.NOMEARQUIVO}]),Object.assign(Object.assign({},t),{ARQUIVOOULINK:t.LINK?t.LINK:t.NOMEARQUIVO,NOMEARQUIVO:i})}));s(Object.assign(Object.assign({},t),{records:i}))}))}))}saveLoader(t,i){return new Promise((s=>{var e;const n=Array.isArray(t)?t[0]:{};((null===(e=null==n?void 0:n.record)||void 0===e?void 0:e.NUATTACH)>=0?i.edit.bind(i):i.save.bind(i))(n).then((t=>{s(t)})).catch((t=>t.message===b.LINK_AND_FILE_AT_THE_SAME_TIME?(this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),s([])):t.message===b.ANY_LINK_OR_FILE_FILLED?(this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),s([])):t.message?(this._application.error(t.title||t.name,t.message),s([])):void s([])))}))}removeLoader(t,i,s){return new Promise((e=>{const{records:n}=t.getSelectionInfo(),a=n[0];s.delete(a).then((()=>(_.removeRecords(t,[a]),e(i))))}))}getFilters(t){return[{name:"AttachmentsByPK",expression:"this.PKREGISTRO = :PKREGISTRO",params:[{name:"PKREGISTRO",dataType:r.TEXT,value:`${t}_${this.entityName}`}]}]}getInterceptions(t,i,s){return new Promise((e=>i.type===l.EDITION_CANCELED?t.isDirty()?this._application.confirm(this.getMessage("snkAttach.cancelConfirmation.title"),this.getMessage("snkAttach.cancelConfirmation.message")).then((t=>t?(s.goToView(A.GRID),e(i)):e(void 0))):e(i):i.type===l.DATA_SAVED?(t.loadData(),e(i)):void e(i)))}}let ht;const dt=t=>(ht||(ht=new g),ht.getMessage(t)),ct={grid:{columns:[{name:"CODATA",orderIndex:0,width:0},{name:"DESCRICAO",orderIndex:1,width:0},{name:"ARQUIVO",orderIndex:2,width:0},{name:"DTALTER",orderIndex:3,width:0},{name:"USUARIO",orderIndex:4,width:0}]},form:{emptyConfig:!1,fields:[{name:"DESCRICAO",label:dt("snkAttach.attachMetadata.lblDescription"),visible:!0,readOnly:!1,required:!0},{name:"CAMINHO_ARQUIVO",label:dt("snkAttach.attachMetadata.lblFile"),visible:!0,readOnly:!1,required:!0}]}},ut={name:"Attach",label:"Attach List",fields:[{name:"CODATA",label:dt("snkAttach.attachMetadata.lblCode"),dataType:r.TEXT},{name:"DESCRICAO",label:dt("snkAttach.attachMetadata.lblDescription"),dataType:r.TEXT,readOnly:!1},{name:"ARQUIVO",label:dt("snkAttach.attachMetadata.lblFileOrLink"),dataType:r.TEXT},{name:"USUARIO",label:dt("snkAttach.attachMetadata.lblUser"),dataType:r.TEXT},{name:"DTALTER",label:dt("snkAttach.attachMetadata.lblDate"),dataType:r.TEXT},{name:"CAMINHO_ARQUIVO",label:dt("snkAttach.attachMetadata.lblFileUpload"),dataType:r.OBJECT,userInterface:h.FILE,readOnly:!1,required:!0,visible:!0,properties:{subTitle:dt("snkAttach.attachMetadata.lblSubTitle"),MAX_FILES:1,STORAGESTRATEGY:"SESSION",INTERNAL_FILENAME:"Attach.upload"}}]};class vt{constructor(t){this.getMessage=t,this._records=[],this._application=o.getContextValue("__SNK__APPLICATION__")}initLoaders(t,i,s){t.metadataLoader=t=>this.metadataLoader(t),t.dataLoader=(t,i)=>this.dataLoader(t,i),t.saveLoader=(t,e)=>this.saveLoader(e,i).then((t=>(t.length&&s(),t))),t.removeLoader=(t,e)=>this.removeLoader(t,e,i).then((t=>(t.length&&s(),t)))}metadataLoader(t){return Promise.resolve(ut)}async dataLoader(t,i){if(!i.source)return Promise.resolve({records:this._records});if(!Number.isNaN(Number(i.source))){const t={criteria:{codata:i.source,tipoAnexo:"N"}},s=await this._application.getDataFetcher(),{anexos:{anexo:e=[]}}=await s.callServiceBroker("Attach.load",JSON.stringify(t)),n=[];e.forEach((t=>{n.push(Object.assign({__record__id__:d.generateUUID(),CAMINHO_ARQUIVO:[{name:null==t?void 0:t.ARQUIVO}]},t))})),this._records=n}return c.buildLoadDataResponse(this._records,t,i)}saveLoader(t,i){return new Promise((s=>{const e=Array.isArray(t)?t[0]:{};i.save(e).then(s).catch((t=>t.message===b.DESCRIPTION_CANNOT_BE_CHANGED?(this._application.alert(this.getMessage("snkAttach.alertValidation.descriptionCannotBeChanged.title"),this.getMessage("snkAttach.alertValidation.descriptionCannotBeChanged.message")),s([])):t.message===b.LINK_AND_FILE_AT_THE_SAME_TIME?(this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),s([])):t.message===b.ANY_LINK_OR_FILE_FILLED?(this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),s([])):t.message?(this._application.error(t.title||t.name,t.message),s([])):void s([])))}))}removeLoader(t,i,s){return new Promise((e=>{t.getSelectionInfo().records.forEach((async t=>{this._application.hasAccess(S.REMOVE).then((async n=>{n&&(await s.delete(t),e(i))}))}))}))}getFilters(){throw new Error("Method not implemented.")}getInterceptions(t,i,s){return new Promise((e=>{var n,a,o,r,h,d;switch(i.type){case l.EDITION_CANCELED:return t.isDirty()?this._application.confirm(this.getMessage("snkAttach.cancelConfirmation.title"),this.getMessage("snkAttach.cancelConfirmation.message")).then((t=>t?(s.goToView(A.GRID),e(i)):e(void 0))):e(i);case l.DATA_SAVED:return t.loadData(void 0,void 0,!1,null===(o=null===(a=null===(n=null==i?void 0:i.payload)||void 0===n?void 0:n.records)||void 0===a?void 0:a[0])||void 0===o?void 0:o.REGISTER_KEY),e(i);case l.RECORDS_REMOVED:return t.loadData(void 0,void 0,!1,null===(d=null===(h=null===(r=null==i?void 0:i.payload)||void 0===r?void 0:r.cachedRecords)||void 0===h?void 0:h[0])||void 0===d?void 0:d.CODATA),e(i)}e(i)}))}}let mt;const ft=t=>{var i;if(!mt){const t=o.getContextValue("__SNK__APPLICATION__");mt=null==t?void 0:t.messagesBuilder}return null===(i=null==mt?void 0:mt.getMessage)||void 0===i?void 0:i.call(mt,t,null)},pt={DOWNLOAD:{hint:ft("snkAttach.taskbar.titleDownload"),name:"DOWNLOAD",iconName:"file-download"},LINK:{hint:ft("snkAttach.taskbar.titleLink"),name:"LINK",iconName:"launch"}},gt=()=>{const t=[O.REMOVE,"DOWNLOAD","LINK"];return{getButtons:(t,i,s)=>{const e=s.indexOf(O.REFRESH);if((null==i?void 0:i.insertionMode)||(null==i?void 0:i.isDirty))return s.reverse();-1!==e&&s.splice(e,1);const{selectedRecord:n}=i||{},a=(null==n?void 0:n.LINK)?pt.LINK:pt.DOWNLOAD;s.splice(s.indexOf(O.DIVIDER)+1,0,O.REMOVE,a,O.DIVIDER);const o=[O.CLONE,O.DATA_EXPORTER],r=Array.from(new Set(s.filter((t=>!o.includes(t)))));return r.splice(r.indexOf(a)+1,0,O.DIVIDER),r},isEnabled:(i,s,e)=>{const n=void 0!==(null==s?void 0:s.selectedRecord);return!(t.includes(e)&&!n)}}},bt={grid:{columns:[{name:"ARQUIVOOULINK",orderIndex:0,width:0},{name:"DESCRICAO",orderIndex:1,width:0},{name:"DHCAD",orderIndex:2,width:0},{name:"DHALTER",orderIndex:3,width:0},{name:"TIPOAPRES",orderIndex:4,width:0},{name:"TIPOACESSO",orderIndex:5,width:0},{name:"CODUSU",orderIndex:6,width:0},{name:"CODUSUALT",orderIndex:7,width:0}]},form:{emptyConfig:!1,fields:[{name:"DESCRICAO",required:!0},{name:"TIPOAPRES",required:!0},{name:"TIPOACESSO",required:!0},{name:"LINK"},{name:"NOMEARQUIVO"}]}},kt=class{constructor(s){t(this,s),this.ezClosePopup=i(this,"ezClosePopup",7),this.handleTaskbarClick=async({detail:t})=>{if(["DOWNLOAD","LINK"].includes(t))return this.downloadAttachment(this._currentDataUnit.getSelectedRecord());"Attach"===this.fetcherType&&["SAVE"].includes(t)&&this._currentDataUnit.isDirty()&&await this._currentDataUnit.setFieldValue("REGISTER_KEY",this.registerKey)},this.handleBack=()=>{this._currentDataUnit.cancelEdition().then((t=>{t&&this.close()}))},this.handleFinish=()=>{if(!this._currentDataUnit.isDirty())return this.close();this.validateAnexoSistema()&&this._currentDataUnit.saveData().then((()=>{this.showFinishedToast(),this.close()}))},this._isOpen=!1,this.gridLegacyConfigName=void 0,this.fetcherType=void 0,this.fetcher=void 0,this.dataUnit=void 0,this.dataUnitBuilder=void 0,this.registerKey=void 0,this.entityName=void 0,this.messagesBuilder=void 0,this._currentFetcher=void 0,this._currentDataUnit=void 0,this.crudConfig=void 0,this._appResourceID=void 0}async open(){this._isOpen=!0,this._currentDataUnit||await this.initAttach(),this._refPopup&&(this._refPopup.opened=!0),this.fetcherType||(this.fetcherType="AnexoSistema"),null==this._currentDataUnit&&this.loadAttachmentDataUnit()}async close(){this._isOpen=!1,this._refPopup&&(this._refPopup.opened=!1)}async registerKeyWatcher(t,i){var s;null==this._currentDataUnit&&this.loadAttachmentDataUnit(),i!==t&&(this._currentFetcher instanceof rt&&(this._currentFetcher.registerKey=t),await(null===(s=this._currentDataUnit)||void 0===s?void 0:s.loadData()))}getAnexoSistemaFetcherInstance(){var t;const i=new rt(this.entityName,null===(t=this._currentDataUnit)||void 0===t?void 0:t.name);return i.registerKey=this.registerKey,i}async initAttach(){var t,i,s,e,n;if(this.fetcherType||this.registerKey){if(this.fetcherType||(this.fetcherType="AnexoSistema"),this.returnToGridMode(),"AnexoSistema"===this.fetcherType)return this._currentFetcher=this.getAnexoSistemaFetcherInstance(),null===(t=this._currentDataUnitBuilder)||void 0===t||t.initLoaders(this._currentDataUnit,this._currentFetcher,this.returnToGridMode.bind(this)),void await(null===(i=this._currentDataUnit)||void 0===i?void 0:i.loadData());if("Attach"===this.fetcherType&&(null===(s=this.registerKey)||void 0===s?void 0:s.split("_").length)>1)return;await(null===(e=this._currentDataUnit)||void 0===e?void 0:e.loadMetadata()),await(null===(n=this._currentDataUnit)||void 0===n?void 0:n.loadData(void 0,void 0,!0,this.registerKey))}}getMessage(t,i){if(this.messagesBuilder)return this.messagesBuilder.getMessage(t,i)}showFinishedToast(){this._application.info(this.getMessage("snkAttach.finishedMessage"),{iconName:"check"})}downloadAttachment(t){if(!t)throw new Error(this.getMessage("snkAttach.alertValidation.noRecordSelected.message"));t.LINK?window.open(`${t.LINK}`):this._currentFetcher.getDownloadKey(t).then((({chave:i})=>{var s;let e=!1;(null===(s=null==t?void 0:t.ARQUIVO)||void 0===s?void 0:s.endsWith(".pdf"))||(e=!0),window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${i.valor}${e?"&forcarDownload=S":""}`)}))}returnToGridMode(){var t;null===(t=this._currentDataUnit)||void 0===t||t.clearSelection(),this._crudElement&&this._crudElement.goToView(A.GRID)}async loadAttachmentDataUnit(){try{switch(this.fetcherType){case"AnexoSistema":await this.loadAnexoSistema();break;case"Attach":await this.loadAttach();break;default:this._currentFetcher=this.fetcher,this._currentDataUnit=this.dataUnit,this._currentDataUnitBuilder=this.dataUnitBuilder}}catch(t){throw new Error("There was an error while creating the data unit")}}async loadAnexoSistema(){var t,i;let s;this._currentDataUnit=(new y).getDataUnit("AnexoSistema","br.com.sankhya.core.v3.anexoSistema"),this._currentFetcher=this.getAnexoSistemaFetcherInstance(),this._currentDataUnit.metadata||(await(null===(t=this._currentDataUnit)||void 0===t?void 0:t.loadMetadata()),this.crudConfig=this.entityName?{form:null==bt?void 0:bt.form}:Object.assign({},bt),s={grid:null==bt?void 0:bt.grid}),this.initDataUnitLoaders(),this._currentDataUnit.addFilterProvider({getFilter:()=>this._currentDataUnitBuilder.getFilters(this.registerKey)}),this._currentDataUnit.addInterceptor({interceptAction:t=>this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit,t,this._crudElement)}),await(null===(i=this._currentDataUnit)||void 0===i?void 0:i.loadData()),this.disableEditFieldsNotInForm(s)}async loadAttach(){var t,i;let s;this._currentFetcher=new et,this._currentDataUnit=new u(w.IN_MEMORY_DATA_UNIT_NAME),this._currentDataUnit.pageSize=150,this.initDataUnitLoaders(),this._currentDataUnit.addInterceptor({interceptAction:t=>{var i;return t.type===l.METADATA_LOADED&&(this.crudConfig=this.entityName?{form:null==ct?void 0:ct.form}:Object.assign({},ct),s={grid:null==ct?void 0:ct.grid},null===(i=this._crudElement)||void 0===i||i.updateConfig()),this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit,t,this._crudElement)}}),this._currentDataUnit.metadata||(await(null===(t=this._currentDataUnit)||void 0===t?void 0:t.loadMetadata()),this.crudConfig=this.entityName?{form:null==ct?void 0:ct.form}:Object.assign({},ct),s={grid:null==ct?void 0:ct.grid},await(null===(i=this._currentDataUnit)||void 0===i?void 0:i.loadData(void 0,void 0,!0,this.registerKey)),this.disableEditFieldsNotInForm(s))}initDataUnitLoaders(){var t,i;"AnexoSistema"===this.fetcherType&&(this._currentFetcher=this.getAnexoSistemaFetcherInstance(),this._currentDataUnitBuilder=new lt(this.entityName,this.getMessage.bind(this)),null===(t=this._currentDataUnitBuilder)||void 0===t||t.initLoaders(this._currentDataUnit,this._currentFetcher,this.returnToGridMode.bind(this))),"Attach"===this.fetcherType&&(this._currentFetcher=new et,this._currentDataUnitBuilder=new vt(this.getMessage.bind(this)),null===(i=this._currentDataUnitBuilder)||void 0===i||i.initLoaders(this._currentDataUnit,this._currentFetcher,(async()=>{this.returnToGridMode(),await this._currentDataUnit.loadData(void 0,void 0,!0,this.registerKey)})))}disableEditFieldsNotInForm(t){var i,s,e,n,a;const o=(null===(s=null===(i=this._crudElement)||void 0===i?void 0:i.gridConfig)||void 0===s?void 0:s.columns)||(null===(e=null==t?void 0:t.grid)||void 0===e?void 0:e.columns)||(null===(a=null===(n=this.crudConfig)||void 0===n?void 0:n.grid)||void 0===a?void 0:a.columns);this.getGridLegacyConfigName()&&this._currentDataUnit.disableField("ARQUIVOOULINK"),null==o||o.forEach((t=>{var i,s;const e=t.name;(null===(s=null===(i=this.crudConfig)||void 0===i?void 0:i.form)||void 0===s?void 0:s.fields.some((t=>(null==t?void 0:t.name)===e)))||this._currentDataUnit.disableField(e)}))}validateAnexoSistema(){var t;if(this._currentFetcher instanceof rt)try{let i=this._currentDataUnit.getSelectedRecord();i=Object.assign(Object.assign({},i),{NOMEARQUIVO:null===(t=i.NOMEARQUIVO)||void 0===t?void 0:t[0]}),this._currentFetcher.validateFields(i)}catch(t){if(t.message===b.LINK_AND_FILE_AT_THE_SAME_TIME)return this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),!1;if(t.message===b.ANY_LINK_OR_FILE_FILLED)return this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),!1}return!0}async componentWillLoad(){this._application=o.getContextValue("__SNK__APPLICATION__"),this._application&&(this._appResourceID=await this._application.getResourceID()),await this.initAttach()}async handleOnDataStateChange({detail:t}){"Attach"===this.fetcherType&&(t.insertionMode?this._currentDataUnit.enableField("DESCRICAO"):this._currentDataUnit.disableField("DESCRICAO"),await this._currentDataUnit.loadMetadata())}isScreenVariation(){var t;return!!(null===(t=this._appResourceID)||void 0===t?void 0:t.includes("__"))}getGridLegacyConfigName(){if(!this.isScreenVariation())return this.gridLegacyConfigName?this.gridLegacyConfigName:this.entityName?"GrdCfgHtml5:grdcfg.dynaform.anexo."+this.entityName:this.entityName}render(){var t,i;return s("ez-popup",{ref:t=>this._refPopup=t,size:"x-large",ezTitle:this.getMessage("snkAttach.title"),useHeader:!1,autoClose:!1,onEzClosePopup:()=>this.close()},this._isOpen&&this._currentDataUnit&&s("main",{class:"snk-attach__main"},s("header",{class:"snk-attach__header"},s("section",null,s("ez-button",{class:"ez-padding-right--medium",title:this.getMessage("snkSimpleBar.backTitle"),mode:"icon",iconName:"arrow_back",size:"medium",onClick:()=>this.handleBack()}),s("div",{class:"snk-attach__file-info"},s("span",{class:"ez-title--primary ez-text ez-text--large ez-text--bold"},this.getMessage("snkAttach.title")),s("span",{class:"ez-text ez-text--medium ez-text--secondary"},this.getMessage("snkAttach.description")))),s("ez-button",{class:"ez-button--primary",label:this.getMessage("snkAttach.finish"),onClick:this.handleFinish})),s("div",{class:"snk-attach__crud-section"},s("snk-simple-crud",{ref:t=>this._crudElement=t,dataUnit:this._currentDataUnit,taskbarManager:gt(),gridConfig:null===(t=this.crudConfig)||void 0===t?void 0:t.grid,formConfig:null===(i=this.crudConfig)||void 0===i?void 0:i.form,useCancelConfirm:!1,onActionClick:this.handleTaskbarClick,messagesBuilder:this.messagesBuilder,onDataStateChange:this.handleOnDataStateChange.bind(this),multipleSelection:!0,configName:this.isScreenVariation()?void 0:this.entityName?"AnexoSistema_"+this.entityName:void 0,ignoreReadOnlyFormFields:!!this.entityName,gridLegacyConfigName:this.getGridLegacyConfigName(),outlineMode:!0}))))}static get watchers(){return{registerKey:["registerKeyWatcher"]}}};kt.style=".snk-attach__header.sc-snk-attach{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--space--6, 6px)}.snk-attach__header.sc-snk-attach>section.sc-snk-attach{display:flex;align-items:center}.snk-attach__file-info.sc-snk-attach{display:flex;flex-direction:column;justify-content:center;gap:var(--space--8, 8px)}.snk-attach__main.sc-snk-attach{display:flex;flex-direction:column;height:100%}.ez-box__container.sc-snk-attach{height:100%}.snk-attach__crud-section.sc-snk-attach{padding:1px;display:flex;flex-direction:column;height:100%;width:100%}";const _t=class{constructor(s){t(this,s),this.actionSelected=i(this,"actionSelected",7),this.OFFSET_HEIGHT=5,this.getMessage=void 0,this.hasDefaultFilter=!1,this._opened=!1}repositionDropDown(){if(!this._refIcon||!this._refDropdown)return;const t=this._refIcon.getBoundingClientRect(),i=this._refDropdown.getBoundingClientRect();this._refDropdown.style.top=t.y+t.height+this.OFFSET_HEIGHT+"px",this._refDropdown.style.left=t.x+t.width/2-i.width+"px"}toggleDropdown(){this._opened=!this._opened}closeDropdown(t){const i=null==t?void 0:t.target;i&&(i.closest("#dropdown-parent-demo")||(this._opened=!1))}buildItems(){return[{id:F.EDIT,label:this.getMessage("defaultFilter.edit")},{id:F.REMOVE,label:this.getMessage("defaultFilter.remove")}]}onValueSelected({detail:t}){this._opened=!1,this.actionSelected.emit(t.id)}openCreateNewFilter(){this.actionSelected.emit(F.CREATE)}componentDidRender(){this.repositionDropDown()}componentWillLoad(){this._items=this.buildItems(),document.removeEventListener("scroll",this.repositionDropDown.bind(this)),document.addEventListener("scroll",this.repositionDropDown.bind(this))}render(){return this.hasDefaultFilter?s(e,null,s("button",{class:"default_container",onClick:this.toggleDropdown.bind(this)},s("span",null,this.getMessage("defaultFilter.title")),s("ez-icon",{ref:t=>this._refIcon=t,iconName:"dots-vertical"})),this._opened&&s("ez-dropdown",{ref:t=>this._refDropdown=t,items:this._items,onEzClick:this.onValueSelected.bind(this),onEzOutsideClick:this.closeDropdown.bind(this)})):s(e,null,s("button",{class:"default_container new_filter",onClick:this.openCreateNewFilter.bind(this)},s("span",null,this.getMessage("defaultFilter.create"))))}};_t.style=".sc-snk-default-filter-h{display:flex;justify-content:flex-end}.default_container.sc-snk-default-filter{border:none;background:none;display:flex;align-items:center;gap:var(--space--3xs, 4px);font-family:var(--font-pattern);color:var(--title--primary, #2b3a54);font-size:var(--text--medium, 14px);padding:0;outline:none}.default_container.sc-snk-default-filter ez-icon.sc-snk-default-filter{cursor:pointer}.default_container.sc-snk-default-filter ez-icon.sc-snk-default-filter:hover{color:var(--color--primary-600)}.new_filter.sc-snk-default-filter{cursor:pointer;margin:0 var(--space--3xs, 4px)}.new_filter.sc-snk-default-filter:hover{color:var(--color--primary-600)}";const yt=class{constructor(e){t(this,e),this.snkContentCardChanged=i(this,"snkContentCardChanged",7),this.snkRequestClearFieldToFocus=i(this,"snkRequestClearFieldToFocus",7),this._customEditors=new Map,this._fieldProps=new Map,this.dataUnitObserver=async t=>{var i;if(t.type===l.RECORDS_COPIED){const s=this.buildSourceRecordPK(t);null===(i=this.getImageField())||void 0===i||i.forEach((async t=>{var i;null===(i=this.dataUnit)||void 0===i||i.setFieldValue(t.name,JSON.stringify(s))}))}},this.customUiBuilders=new Map([[h.IMAGE,t=>{var{name:i}=t,e=function(t,i){var s={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&i.indexOf(e)<0&&(s[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(e=Object.getOwnPropertySymbols(t);n<e.length;n++)i.indexOf(e[n])<0&&Object.prototype.propertyIsEnumerable.call(t,e[n])&&(s[e[n]]=t[e[n]])}return s}(t,["name"]);return s("snk-image-input",Object.assign({dataUnit:this.dataUnit,maxSize:1/0,fieldName:i,entityName:this.entityPath},e))}]]),this._singleColumn=!1,this._currentFormLayout=void 0,this.fieldSearch=void 0,this.label=void 0,this.name=void 0,this.fields=void 0,this.formMetadata=void 0,this.dataUnit=void 0,this.recordsValidator=void 0,this.fieldToFocus=void 0,this.customEditors=void 0,this.fieldsProps=void 0,this.entityPath=void 0}async showUp(){var t,i;this._formView&&(null===(i=(t=this._formView).showUp)||void 0===i||i.call(t))}async addCustomEditor(t,i,s){var e,n;if(this._formView)return void(null===(n=(e=this._formView).addCustomEditor)||void 0===n||n.call(e,t,i,s));const a=new Map(this._customEditors);a.set(t,{customEditor:i,detailContext:null!=s?s:""}),this._customEditors=a}async setFieldProp(t,i,s){const e=this._fieldProps.get(t)||[];this._fieldProps.set(t,[...e,{propName:i,value:s}])}async showSearchField(){if(!this._headerContainer||!this._ezPopoverFieldColumn)return;const t=this._headerContainer.getBoundingClientRect();this.fieldSearch&&(await E(this.fieldSearch),this._ezPopoverFieldColumn.showUnder(this._headerContainer,{horizontalGap:t.width-P,verticalGap:-1*t.height}))}observePropsCustomEditor(t){for(const i in t)this.addCustomEditor(i,t[i])}async observeFieldsProps(t){for(const i in t){const s=t[i],e=Object.keys(s);for(const t of e)await this.setFieldProp(i,t,s[t])}}async observeDataUnit(t,i){t!==i&&t&&t.subscribe(this.dataUnitObserver)}bindFields(t){var i;null==this._dataBinder&&null!=this.dataUnit&&(this._dataBinder=new j(this.dataUnit)),this._dataBinder&&this.dataUnit&&this.formMetadata&&this._dataBinder.bind(t,null===(i=this.dataUnit)||void 0===i?void 0:i.dataUnitId,this.formMetadata,this.recordsValidator)}disconnectedCallback(){null!=this._dataBinder&&this._dataBinder.onDisconnectedCallback(),this.dataUnit&&this.dataUnit.unsubscribe(this.dataUnitObserver)}componentDidLoad(){this.customEditors&&this.observePropsCustomEditor(this.customEditors),this.fieldsProps&&this.observeFieldsProps(this.fieldsProps),this.initLayoutFormConfig()}async initLayoutFormConfig(){const t=o.getContextValue("__SNK__APPLICATION__"),i=await(null==t?void 0:t.getLayoutFormConfig());i&&(this.setSingleColumn(i),this.registerNotifyListeners(i))}setSingleColumn(t){this._singleColumn=(null==t?void 0:t.config)===N.CASCADE||(null==t?void 0:t.config)===N.CLASSIC_CASCADE,this._currentFormLayout=null==t?void 0:t.config}registerNotifyListeners(t){var i;t&&(null===(i=t.onConfigChange)||void 0===i||i.call(t,(t=>{this._singleColumn=t===N.CASCADE||t===N.CLASSIC_CASCADE,this._currentFormLayout=t})))}componentDidRender(){var t;this.setCustomEditors(),this.setFieldProps(),this.fieldToFocus&&(null===(t=this.fields)||void 0===t?void 0:t.some((t=>t.name===this.fieldToFocus)))&&requestAnimationFrame((()=>{var t,i;null===(t=this._dataBinder)||void 0===t||t.setFocus(this.fieldToFocus),null===(i=this.snkRequestClearFieldToFocus)||void 0===i||i.emit()}))}setCustomEditors(){var t,i;if(this._formView)for(const[s,e]of this._customEditors)null===(i=(t=this._formView).addCustomEditor)||void 0===i||i.call(t,s,e.customEditor,e.detailContext),this._customEditors.delete(s)}setFieldProps(){if(this._formView)for(const[t,i]of this._fieldProps)i.forEach((i=>{var s,e;null===(e=(s=this._formView).setFieldProp)||void 0===e||e.call(s,t,i.propName,i.value),this._fieldProps.delete(t)}))}buildSourceRecordPK(t){var i,s,e;const n=(null===(i=t.payload)||void 0===i?void 0:i[0])||{},a=JSON.parse(atob(n.__record__source__id__||""));if(delete a.__DATA_UNIT_NAME__,!this.dataUnit)return{};const o=null!==(s=R(this.dataUnit))&&void 0!==s?s:{},r=Object.keys(o),l={};for(const t of r)l[t]=null===(e=a[t])||void 0===e?void 0:e.value;return l}getImageField(){var t;return null===(t=this.dataUnit)||void 0===t?void 0:t.metadata.fields.filter((t=>t.userInterface===h.IMAGE))}render(){return s(e,null,s("slot",null),s("ez-form-view",{ref:t=>this._formView=t,fields:this.fields,onEzContentReady:t=>this.bindFields(t.detail),singleColumn:this._singleColumn,customUiBuilders:this.customUiBuilders,formLayout:this._currentFormLayout}),this.fieldSearch&&s("ez-popover",{ref:t=>this._ezPopoverFieldColumn=t,overlayType:"none"},this.fieldSearch))}static get watchers(){return{customEditors:["observePropsCustomEditor"],fieldsProps:["observeFieldsProps"],dataUnit:["observeDataUnit"]}}};yt.style=".sc-snk-dynaform-form-view-h{display:flex;flex-direction:column;width:100%;flex-wrap:wrap;background-color:var(--background--xlight);padding:var(--space--12, 12px);border-radius:var(--border--radius-medium);border:1px solid var(--color--petroleum-100, #C8CCD3);--ez-form-card-summary-field-content-weight:700}ez-form-view.sc-snk-dynaform-form-view{padding:var(--space--6 ,6px) 0;--ez-form-view__item--padding:0}.level-path.sc-snk-dynaform-form-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.summary-wrapper.sc-snk-dynaform-form-view{display:flex;overflow:hidden}.summary-header.sc-snk-dynaform-form-view{border-bottom:1px solid var(--color--strokes);margin-bottom:var(--space--medium);padding-bottom:var(--space--medium)}.summary-container.sc-snk-dynaform-form-view{display:flex;flex-direction:column}.summary-container.sc-snk-dynaform-form-view{padding-right:calc(var(--space--extra-large) / 1.5)}.summary-field.sc-snk-dynaform-form-view{min-width:30px;max-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.summary-field__title.sc-snk-dynaform-form-view{color:var(--text--primary, #626e82);font-size:var(--title--small);white-space:nowrap;font-weight:var(--text-weight--medium)}.summary-field__content.sc-snk-dynaform-form-view{color:var(--title--primary, #2b3a54);font-size:var(--text--large);font-weight:var(--ez-form-card-summary-field-content-weight)}";const wt=class{constructor(s){t(this,s),this.ezExpressionChange=i(this,"ezExpressionChange",7),this.filterAssistent=void 0,this.application=void 0}getMessage(t,i){return this.application.messagesBuilder.getMessage(t,i)}render(){var t;return s(e,null,s("span",{class:"ez-title ez-title--small ez-padding-bottom--small snk-filter-advanced-mode__title"},this.getMessage("snkPersonalizedFilter.info.applyExpression")),s("ez-text-area",{rows:9,label:this.getMessage("snkPersonalizedFilter.info.labelExpression"),value:null===(t=this.filterAssistent)||void 0===t?void 0:t.expression,onEzChange:t=>this.ezExpressionChange.emit(t.detail)}))}};wt.style=".sc-snk-filter-advanced-mode-h{display:block;--snk-personalized-filter--title--color:var(--title--primary, #2B3A54)}.snk-filter-advanced-mode__title.sc-snk-filter-advanced-mode{color:var(--snk-personalized-filter--title--color)}";const Ct=class{constructor(s){t(this,s),this.ezChangeFilter=i(this,"ezChangeFilter",7),this.filterAssistent=void 0,this.messagesBuilder=void 0,this.filterId=void 0,this.entityUri=void 0,this.application=void 0,this.isDefaultFilter=!1}getMessage(t,i){return this.application.messagesBuilder.getMessage(t,i)}async handleFilterGroupChange(){const t=await this._mainExpressionGroup.getExpressionGroup();this.filterAssistent=Object.assign(Object.assign({},this.filterAssistent),{assistent:t}),this.filterAssistent.parameters=K.buildVariableParameters(this.filterAssistent.assistent),this.filterAssistent.expression=K.buildGroupExpression(this.filterAssistent.assistent),this.ezChangeFilter.emit(this.filterAssistent)}render(){var t,i;return s(e,null,s("div",{class:"ez-padding-top--small snk-personalized-filter__group"},s("snk-expression-group",{ref:t=>this._mainExpressionGroup=t,group:null===(t=this.filterAssistent)||void 0===t?void 0:t.assistent,messagesBuilder:this.messagesBuilder,onEzFilterGroupChange:this.handleFilterGroupChange.bind(this),filterId:this.filterId,entityURI:this.entityUri,isDefaultFilter:this.isDefaultFilter})),s("div",{class:"ez-margin-top--auto"},s("div",{class:"snk-personalized-filter__expression-input--line"}),s("ez-collapsible-box",{label:this.getMessage("snkPersonalizedFilter.info.titleCollapsible"),headerSize:"medium",value:!0},s("div",{class:"ez-box"},s("div",{class:"ez-box__container--external"},s("div",{class:"ez-box__container--internal"},s("span",{class:"ez-box__container--title"},this.getMessage("snkPersonalizedFilter.info.labelExpression")),s("span",{class:"ez-box__container--expression"},null===(i=this.filterAssistent)||void 0===i?void 0:i.expression)))))))}};Ct.style=".sc-snk-filter-assistent-mode-h{display:flex;flex-direction:column;height:100%;--text-area--font-family:var(--font-pattern, Arial);--text-area__label--floating--top:var(--space--small, 6px);--snk-filter-assistent-mode__container--border-radius:var(--border--radius-medium, 12px);--snk-filter-assistent-mode__container--background:var(--background--medium, #f0f3f7);--snk-filter-assistent-mode__container--margin:var(--space--small, 6px) var(--space--medium, 12px)}.ez-box__container--external.sc-snk-filter-assistent-mode{height:100px;width:100%;overflow-y:auto;background-color:var(--snk-filter-assistent-mode__container--background);border-radius:var(--snk-filter-assistent-mode__container--border-radius)}.ez-box__container--internal.sc-snk-filter-assistent-mode{margin:var(--snk-filter-assistent-mode__container--margin)}.ez-box__container--title.sc-snk-filter-assistent-mode{display:block;user-select:none;font-family:var(--text-area--font-family);font-size:var(--text--extra-small);color:var(--title--primary);top:var(--text-area__label--floating--top)}.ez-box__container--expression.sc-snk-filter-assistent-mode{display:block;font-family:var(--text-area--font-family);font-size:var(--text--medium);color:var(--title--primary);top:var(--text-area__label--floating--top)}.snk-personalized-filter__expression-input--line.sc-snk-filter-assistent-mode{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}";const zt=class{constructor(s){t(this,s),this.filterChange=i(this,"filterChange",7),this.config=void 0,this.getMessage=void 0,this.showHardFixed=!0,this.removalBlocked=!1}async setFocusField(){var t,i,s,e;this._editor&&(this._editor.setFocus?null===(i=null===(t=this._editor)||void 0===t?void 0:t.setFocus)||void 0===i||i.call(t):this._editor.focus&&(null===(e=null===(s=this._editor)||void 0===s?void 0:s.focus)||void 0===e||e.call(s)))}async clearValue(){this._editor&&this._editor.clearValue&&await this._editor.clearValue()}observeConfig(t){var i,s;this._editor&&(this._editor.config=t),null===(s=null===(i=this._editor)||void 0===i?void 0:i.reloadList)||void 0===s||s.call(i),this._customElementObject=this.getContentEditor()}componentDidLoad(){if(this._element){v.addIDInfo(this._element);const t=this._element.getAttribute(v.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idContentEditor=`${t}_${this.config.id}`}}changeConfig(t){this.filterChange.emit(t)}getContentEditor(){switch(this.config.type){case C.BINARY_SELECT:return{tag:"snk-filter-binary-select"};case C.MULTI_SELECT:return{tag:"snk-filter-multi-select"};case C.PERIOD:return{tag:"snk-filter-period"};case C.SEARCH:return{tag:"snk-filter-search"};case C.NUMBER:return{tag:"snk-filter-number"};case C.PERSONALIZED:return{tag:"snk-personalized-filter-editor",props:{presentationMode:q.CHIP,onValueChanged:t=>this.handleValueChanged(t)}};case C.CHECK_BOX_LIST:return{tag:"snk-filter-checkbox-list",props:{onValueChanged:t=>this.config=Object.assign(Object.assign({},this.config),{value:t.detail})}};case C.MULTI_LIST:return{tag:"snk-entity-list",props:{onValueChanged:t=>this.config=Object.assign(Object.assign({},this.config),{value:t.detail})}}}return{tag:"snk-filter-text"}}handleValueChanged({detail:t}){const i=(null==t?void 0:t.items)||this.config.groupedItems;this.config=Object.assign(Object.assign({},this.config),{groupedItems:i,visible:(i||[]).filter((t=>t.visible)).length>0})}removeItem(){const t=this.config.type===C.MULTI_LIST&&Array.isArray(this.config.value)?this.config.value.map((t=>Object.assign(Object.assign({},t),{check:!1}))):void 0,i=Object.assign(Object.assign({},this.config),{visible:!1,fixed:!1,value:t});null!=i.groupedItems&&(i.groupedItems=i.groupedItems.map((t=>Object.assign(Object.assign({},t),{visible:!1,fixed:!1,value:void 0})))),this.changeConfig(i)}removeItemFromGroup(t){return Object.assign(Object.assign({},t),{visible:!1,fixed:!1,value:void 0})}getPopUpHeaderButtons(){return s(n,null,!this.removalBlocked&&!this.config.removalBlocked&&this.buildIcon(this.getMessage("snkFilterBar.removeFilter"),"delete",(()=>this.removeItem())),this.showHardFixed&&!this.config.hardFixed&&this.buildIcon(this.getMessage(this.config.fixed?"snkFilterBar.unpinFilter":"snkFilterBar.pinFilter"),this.config.fixed?"un-pin":"push-pin",(()=>this.changeConfig(Object.assign(Object.assign({},this.config),{fixed:!this.config.fixed})))))}buildIcon(t,i,e){return s("button",{onClick:()=>e(),class:"sc-snk-filter-bar snk-filter-item__editor-header-button",ref:i=>i&&this.buildIdButton(i,t)},s("ez-icon",Object.assign({title:t,iconName:i},{[v.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${v.getInternalIDInfo(`_${t}`)}`})))}buildIdButton(t,i){if(!t)return;const s={id:i};t.removeAttribute(v.DATA_ELEMENT_ID_ATTRIBUTE_NAME),v.addIDInfoIfNotExists(t,"button",s)}clearBinarySelectValues(){var t;const i=this._editor||{};null===(t=i.resetValues)||void 0===t||t.call(i),this.config=m.copy(this.originalConfig),this.changeConfig(Object.assign(Object.assign({},this.config),{value:void 0}))}apply(){if(!K.validateVariableValues(this.config,this._editor.value))return T.alert(this.getMessage("snkFilterBar.filterModal.validations.notFullFilled.title"),this.getMessage("snkFilterBar.filterModal.validations.notFullFilled.message"));const t=void 0!==this._editor.value?this._editor.value:this.config.value;this.changeConfig(Object.assign(Object.assign({},this.config),{visible:this.isVisible(),value:t}))}isVisible(){return!(this.config.groupedItems&&this.config.groupedItems.length>0)||this.config.groupedItems.filter((t=>t.visible)).length>0}clear(){var t;if(this.config.type!==C.BINARY_SELECT){if(C.MULTI_LIST===this.config.type){const i=m.copy(this.config);return null===(t=i.value)||void 0===t||t.forEach((t=>!!t&&(t.check=!1))),void(this.config=m.copy(i))}this.changeConfig(Object.assign(Object.assign({},this.config),{value:void 0}))}else this.clearBinarySelectValues()}filterCanBeCleared(){return this.config.type!==C.PERSONALIZED}onKeyDonwListener(t){"Enter"===t.key&&this.apply()}buildRightSlot(t){return s("ez-icon",{iconName:"delete",onClick:()=>this.removeValueFromConfig(t)})}removeValueFromConfig(t){var i,s;if(this.config){const e=m.copy(this.config),n=null===(i=e.value)||void 0===i?void 0:i.findIndex((i=>(null==i?void 0:i.id)===t.id));null===(s=e.value)||void 0===s||s.splice(n,1),this.config=m.copy(e)}}componentWillLoad(){this.originalConfig=m.copy(this.config),this._customElementObject=this.getContentEditor()}render(){const{tag:t,props:i}=this._customElementObject;return s(e,null,s("div",{class:"col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center"},s("div",{class:"ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header"},this.config.detailTitle),this.getPopUpHeaderButtons()),s(t,Object.assign({maxHeightList:"240px",ref:t=>this._editor=t,value:this.config.value,config:this.config,onKeyDown:t=>this.onKeyDonwListener(t),"data-element-id":this._idContentEditor,getMessage:this.getMessage,rightListSlotBuilder:t=>this.buildRightSlot(t)},i)),s("hr",{class:"sc-snk-filter-bar snk-filter__popover-rule"}),s("div",{class:"ez-col ez-col--sd-12 ez-align--right"},this.filterCanBeCleared()&&s("ez-button",{label:this.getMessage("snkFilterBar.cleanFilter"),onClick:()=>this.clear(),size:"small"}),s("ez-button",{ref:t=>this._applyButton=t,label:this.getMessage("snkFilterBar.applyFilter"),onClick:()=>this.apply(),size:"small",class:"ez-button--primary ez-padding-left--medium"})))}get _element(){return a(this)}static get watchers(){return{config:["observeConfig"]}}},At=class{constructor(s){t(this,s),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}getContentEditorConfig(){const t={presentationMode:q.MODAL};switch(this.filterItem.type){case C.BINARY_SELECT:return{tag:"snk-filter-binary-select",props:t};case C.MULTI_SELECT:return{tag:"snk-filter-multi-select"};case C.PERIOD:return{tag:"snk-filter-period",props:t};case C.SEARCH:return{tag:"snk-filter-search"};case C.NUMBER:return{tag:"snk-filter-number",props:t};case C.PERSONALIZED:return this.buildSnkFilterPersonalizedProps();case C.CHECK_BOX_LIST:return{tag:"snk-filter-checkbox-list",props:t};case C.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){var i,s;const e=void 0!==(null==t?void 0:t.value)?t.value:t;this.filterItem=Object.assign(Object.assign({},this.filterItem),null!=this.filterItem.groupedItems?{visible:e>0,value:e,groupedItems:t.items}:{value:this.filterItem.type===(C.SEARCH||C.CHECK_BOX_LIST)?t:e,visible:this.isVisible(e)}),this._editor&&(this._editor.config=this.filterItem),null===(s=null===(i=this._editor)||void 0===i?void 0:i.reloadList)||void 0===s||s.call(i),this.filterChange.emit(this.filterItem)}handleDeleteFilter(t,i){i===C.PERSONALIZED&&H.removePersonalizedFilter(t,this.resourceID,this.configName)}componentDidLoad(){if(this._element){v.addIDInfo(this._element);const t=this._element.getAttribute(v.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idContentEditor=`${t}_${this.filterItem.id}`}}buildRightSlot(t){return s("ez-icon",{iconName:"delete",onClick:()=>this.removeValueFromConfig(t)})}removeValueFromConfig(t){var i,s,e;const n=null===(s=null===(i=this.filterItem)||void 0===i?void 0:i.value)||void 0===s?void 0:s.findIndex((({id:i})=>i===t.id)),a=m.copy(this.filterItem);null===(e=null==a?void 0:a.value)||void 0===e||e.splice(n,1),this.updateFilterValue(a.value)}canShowDetailModal(){const{CUSTOM_FILTER:t,OTHER_FILTERS:i}=I;return![t,i].includes(this.filterItem.filterType)&&this.filterItem.type!==C.BINARY_SELECT}render(){const{tag:t,props:i}=this.getContentEditorConfig();return s(e,null,s("div",{class:"ez-flex ez-flex--column grow"},this.canShowDetailModal()&&s("label",{class:"ez-text ez-text--medium ez-text--primary ez-margin-bottom--extra-small",htmlFor:`filter-item-${this.filterItem.id}`},this.filterItem.detailModal),s(t,Object.assign({ref:t=>this._editor=t,id:`filter-item-${this.filterItem.id}`,config:this.filterItem,value:this.filterItem.value,onValueChanged:t=>this.updateFilterValue(t.detail),"data-element-id":this._idContentEditor},i))))}get _element(){return a(this)}};At.style=".grow{flex-grow:1}.gap{gap:4px}";const xt=class{constructor(s){t(this,s),this.imageError=i(this,"imageError",7),this.dataUnitObserver=async t=>{var i;if([l.NEXT_SELECTED,l.PREVIOUS_SELECTED].includes(t.type))return void await this.loadImage();const s=(null===(i=t.payload)||void 0===i?void 0:i.selection)||[];t.type===l.SELECTION_CHANGED&&s.length>0?await this.loadImage():t.type!==l.RECORDS_ADDED?t.type!==l.EDITION_CANCELED||await this.loadImage():await this.clearImage()},this.dataUnit=void 0,this.fieldName=void 0,this.entityName=void 0,this.enabled=!0,this.acceptType=void 0,this.maxSize=void 0,this.label=void 0,this.imageValue=void 0,this.loading=!0}async reloadImage(t){await this.loadImage(t)}getMessage(t,i){return this.messagesBuilder||(this.messagesBuilder=new g),this.messagesBuilder.getMessage(t,i)}async clearImage(){var t;null===(t=this._loadAbortController)||void 0===t||t.abort(),this.imageValue=void 0}async handleImageChange(t){const i=t.detail;if(!i)return await this.clearImage(),void await this.updatedataUnitField(!0);const s=await M(i);if(this.maxSize&&s.size>1024*this.maxSize){const t=this.getMessage("snkImageInput.errorImageSize")+this.maxSize+"(KB)";return this.imageError.emit(t),void(this.application&&await this.application.error(this.getMessage("snkImageInput.errorTitle"),t))}this.imageValue=i,await U(s,this.entityName,this.fieldName),await this.updatedataUnitField()}async updatedataUnitField(t=!1){this.dataUnit&&this.dataUnit.getSelectedRecord()&&(t?await this.dataUnit.setFieldValue(this.fieldName,"deletado"):await this.dataUnit.setFieldValue(this.fieldName,`$file.session.key{${V(this.entityName,this.fieldName)}}`))}async handleImageError(t){this.imageError.emit(t.detail),this.application&&await this.application.error(this.getMessage("snkImageInput.errorTitle"),t.detail)}getPksFromDataUnit(){if(!this.dataUnit)return;const t=this.dataUnit.getSelectedRecord();if(!t)return;const i=t[this.fieldName];if(i)try{return JSON.parse(i)}catch(t){return void console.error("Error parsing PK from data unit field:",t)}}async loadImage(t){var i,s;null===(i=this._loadAbortController)||void 0===i||i.abort();const e=new AbortController;if(this._loadAbortController=e,this.loading=!0,this.dataUnit&&this.entityName){t=null!==(s=null!=t?t:this.getPksFromDataUnit())&&void 0!==s?s:R(this.dataUnit);const i=await B(t,this.fieldName,this.entityName,e.signal);if(e.signal.aborted)return;this.imageValue=i}this.loading=!1}async componentWillLoad(){this.application=o.getContextValue("__SNK__APPLICATION__"),this.messagesBuilder||(this.messagesBuilder=new g),this.dataUnit&&this.dataUnit.subscribe(this.dataUnitObserver)}disconnectedCallback(){this.dataUnit&&this.dataUnit.unsubscribe(this.dataUnitObserver)}async componentDidLoad(){await this.loadImage()}render(){return s(e,null,s("ez-image-input",{enabled:this.enabled,label:this.label,name:this.fieldName,value:this.imageValue,maxFileSize:this.maxSize?1024*this.maxSize:void 0,accept:this.acceptType||"image/png,image/jpeg,image/gif",onEzChange:t=>this.handleImageChange(t),onEzError:t=>this.handleImageError(t),loading:this.loading}))}};xt.style=":host{display:block}";const St=class{constructor(s){t(this,s),this.ezCancel=i(this,"ezCancel",7),this.ezSave=i(this,"ezSave",7),this.ezAfterSave=i(this,"ezAfterSave",7),this._personalizedFilterFetcher=new Q,this._filterMetadataStorage=new Map,this._dataSourceFetcher={fetchData:async t=>{let i=null==t?void 0:t.uri;if(d.isEmpty(i)&&(i=this.entityUri),!this._filterMetadataStorage.has(i)){const t=await this._personalizedFilterFetcher.loadFields(i);this._filterMetadataStorage.set(i,t)}return this._filterMetadataStorage.get(i)}},this._filterAssistentMode=!0,this._filterAssistent=void 0,this.messagesBuilder=void 0,this.entityUri=void 0,this.filterId=void 0,this.configName=void 0,this.resourceID=void 0,this.isDefaultFilter=!1}async createPersonalizedFilter(){const t={name:"",active:!0,expression:"",parameters:[],assistent:{id:d.generateUUID(),items:[{id:d.generateUUID(),entityName:"",fieldName:"",description:"",fieldLabel:this.getMessage("snkPersonalizedFilter.info.labelDefaultValue"),type:void 0,expression:void 0,operand:void 0,paramVariable:!1,value:void 0,systemConfig:null,userConfig:null}],childrenGroups:[],operand:G.AND}};this.isDefaultFilter&&this.buildDataDefaultFilter(t),this._originalFilterAssistent=m.copy(t),this._filterAssistent=m.copy(t)}loadFilter(t,i){null!=t&&i!=t&&null!=this.resourceID&&(t!==$.id?H.loadPersonalizedFilter(t,this.resourceID,this.configName).then((t=>{const i=this.applyDefaultValues(t);this._filterAssistent=i,this._originalFilterAssistent=m.copy(i),this._filterAssistentMode=this._filterAssistent.hasOwnProperty("assistent")&&null!=this._filterAssistent.assistent})):H.loadDefaultFilter(t,this.resourceID,this.configName).then((t=>{const i=this.applyDefaultValues(t);this._filterAssistent=i,this._originalFilterAssistent=m.copy(i),this._filterAssistentMode=this._filterAssistent.hasOwnProperty("assistent")&&null!=this._filterAssistent.assistent})))}componentWillLoad(){var t;null==J.get(`filterFieldsDataSource.${this.entityUri}`)&&J.set(`filterFieldsDataSource.${this.entityUri}`,this._dataSourceFetcher),this.messagesBuilder||(this._application=o.getContextValue("__SNK__APPLICATION__"),this.messagesBuilder=null===(t=this._application)||void 0===t?void 0:t.messagesBuilder),this.loadFilter(this.filterId,void 0)}componentDidRender(){var t;null===(t=this._viewStackRef)||void 0===t||t.show(this._filterAssistentMode?0:1),this._elButtonMode&&this._elButtonMode.setAttribute(v.DATA_ELEMENT_ID_ATTRIBUTE_NAME,v.getInternalIDInfo(this._filterAssistentMode?"advancedMode_ezButton":"assistentMode_ezButton"))}buildDataDefaultFilter(t){t.name=$.name,t.id=$.id}getMessage(t,i){return this._application.messagesBuilder.getMessage(t,i)}async saveFilter(){let t;t=this.isDefaultFilter?await H.saveDefaultFilter(this._filterAssistent,this.resourceID,this.configName):await H.savePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName),this._elButtonSave.enabled=!1,T.info(this.getMessage(`snkPersonalizedFilter.${this._filterAssistent.id?"confirmEdit":"confirmSave"}.title`),{iconName:"check"});const i=Object.assign(Object.assign({},t),this._filterAssistent);i.parameters=K.buildVariableParameters(this._filterAssistent.assistent),this._originalFilterAssistent=m.copy(i),this._filterAssistent=m.copy(i),this.ezAfterSave.emit()}removeFilter(){H.removePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName)}hasChangesToSave(){return JSON.stringify(this._filterAssistent)===JSON.stringify(this._originalFilterAssistent)}async handleSave(){if(this._filterAssistentMode){if(!K.validateFields(this._filterAssistent.assistent)||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));this.saveAssistentMode()}else{if(!this._filterAssistent.expression||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));if(!await this.validateExpressionBeforeSaving())return;this.saveAdvancedMode()}}saveAssistentMode(){const{assistent:t,expression:i}=this._filterAssistent,s=t?K.buildGroupExpression(t):i;this._filterAssistent.expression=s,this.ezSave.emit(s),this.saveFilter()}saveAdvancedMode(){this._originalFilterAssistent.expression!==this._filterAssistent.expression&&this._filterAssistent.assistent?T.confirm(this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.description")).then((t=>{t&&this.saveAndTransformToAdvancedMode()})):this._filterAssistent.assistent?this.saveAssistentMode():this.saveAndTransformToAdvancedMode()}saveAndTransformToAdvancedMode(){this._filterAssistent.assistent=void 0,this.ezSave.emit(this._filterAssistent.expression),this.saveFilter()}async validateExpressionBeforeSaving(){const{valid:t,message:i=""}=await this._personalizedFilterFetcher.validatePersonalizedFilter(this.entityUri,this._filterAssistent.expression);return t||this._application.error(this.getMessage("snkPersonalizedFilter.errorValidation.title"),i.replace(/.*Exception: /,"")),t}handleCancel(){if(this.hasChangesToSave())return this.ezCancel.emit();T.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"),this.getMessage("snkPersonalizedFilter.confirmCancel.description")).then((t=>{var i;t&&(this._filterAssistent=m.copy(null!==(i=this._originalFilterAssistent)&&void 0!==i?i:{}),this.ezCancel.emit(),this._elButtonSave.enabled=!1)}))}handleTitleChange(t){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{name:t}),this._elButtonSave.enabled=!this.hasChangesToSave()}applyDefaultValues(t){return this.addLabelToItems(t),this.addFilterGroupCondition(t),t}addFilterGroupCondition(t){t.assistent&&!t.assistent.operand&&(t.assistent.operand=G.AND)}addLabelToItems(t){t.assistent&&t.assistent.items&&t.assistent.items.length>0&&t.assistent.items.forEach((i=>{if(null==i.fieldLabel){const s=(t.parameters||[]).find((t=>t.fieldName===i.fieldName));s&&(i.fieldLabel=s.label)}}))}handleExpressionChangeAdvancedMode(t){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:t}),this._elButtonSave.enabled=!this.hasChangesToSave()}handleChangeFilterAssistentMode(t){this._elButtonSave.enabled=!this.hasChangesToSave(),this._filterAssistent=Object.assign({},t)}selectField(t){if(!("name"in t))return;const i=this.buildExpression(t.entityName,t.name,t.entityPath);this._elAdvancedMode.querySelector("ez-text-area").appendTextToSelection(i)}buildExpression(t,i,s){return s.length>0&&s.shift(),s.length>0?`${s.join("->")}->${i}`:`${t}.${i}`}onAddField(t){this._elAdvancedMode.querySelector("ez-text-area").setFocus(),t.setBlur(),this._elFilterFieldSearch&&this._elFilterFieldSearch.show(t,{horizontalGap:0,verticalGap:12,fromRight:!0})}renderButtonAddField(){if(!this._filterAssistentMode)return s(n,null,s("ez-button",{class:"snk-personalized-filter__button-mode",label:this.getMessage("snkPersonalizedFilter.info.addField"),enabled:!0,onClick:t=>this.onAddField(t.target)},s("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:"plus"})),s("snk-filter-field-search",{class:"ez-padding-left--medium",ref:t=>this._elFilterFieldSearch=t,onEzSelectFilterItem:t=>this.selectField(t.detail),fieldsDataSource:this._dataSourceFetcher}))}buildContainerPersonalizedFilter(){return s("ez-view-stack",{ref:t=>this._viewStackRef=t},s("stack-item",null,this._filterAssistentMode&&s("snk-filter-assistent-mode",{filterAssistent:this._filterAssistent,messagesBuilder:this.messagesBuilder,filterId:this.filterId,entityUri:this.entityUri,application:this._application,onEzChangeFilter:t=>this.handleChangeFilterAssistentMode(t.detail),isDefaultFilter:this.isDefaultFilter})),s("stack-item",null,s("snk-filter-advanced-mode",{ref:t=>this._elAdvancedMode=t,filterAssistent:this._filterAssistent,application:this._application,onEzExpressionChange:t=>this.handleExpressionChangeAdvancedMode(t.detail)})))}handleModeChange(){var t,i;if(this._filterAssistentMode)T.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.description")).then((t=>{if(t&&(this._filterAssistentMode=!this._filterAssistentMode,!this.hasChangesToSave())){const t=K.buildGroupExpression(this._filterAssistent.assistent);this._filterAssistent.expression=t,this._elButtonSave.enabled=!this.hasChangesToSave()}}));else if((null===(t=this._filterAssistent)||void 0===t?void 0:t.expression)===(null===(i=this._originalFilterAssistent)||void 0===i?void 0:i.expression))this._filterAssistentMode=!this._filterAssistentMode;else{const t=this._filterAssistent.expression,i=K.buildGroupExpression(this._filterAssistent.assistent);t!==i?T.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.description")).then((t=>{t&&(this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:i}),this._filterAssistentMode=!this._filterAssistentMode)})):this._filterAssistentMode=!this._filterAssistentMode}}buildTitle(){return this.getMessage(this.isDefaultFilter&&!this.filterId?"snkPersonalizedFilter.info.titleCreateDefault":this.isDefaultFilter&&this.filterId?"snkPersonalizedFilter.info.titleEditDefault":this.filterId?"snkPersonalizedFilter.info.titleEdit":"snkPersonalizedFilter.info.titleAdd")}render(){var t,i,n,a;if((null===(t=this._filterAssistent)||void 0===t?void 0:t.assistent)||!this._filterAssistentMode)return s(e,null,s("div",{class:"snk-personalized-filter"},s("div",null,s("snk-simple-bar",{label:this.buildTitle(),onExit:()=>this.handleCancel()},s("div",{class:"snk-personalized-filter__header-actions",slot:"rightSlot"},s("ez-button",{label:this.getMessage("snkPersonalizedFilter.info.labelCancel"),onClick:()=>this.handleCancel()}),s("ez-button",{ref:t=>this._elButtonSave=t,enabled:!1,class:"ez-button--primary",label:this.getMessage("snkPersonalizedFilter.info.labelSave"),onClick:this.handleSave.bind(this)})))),s("div",{class:"ez-box ez-margin-bottom--medium ez-box__main"},s("div",{class:"ez-box__container"},s("div",{class:"ez-flex ez-flex--column ez-size-width--full"},s("div",{class:"ez-flex"},s("ez-tooltip",{message:this.getMessage("snkPersonalizedFilter.info.textInputDisabled"),active:this.isDefaultFilter},s("ez-text-input",{class:"ez-padding-right--medium",label:this.getMessage("snkPersonalizedFilter.info.labelNameFilter"),value:null===(i=this._filterAssistent)||void 0===i?void 0:i.name,onEzChange:t=>this.handleTitleChange(t.detail),enabled:!this.isDefaultFilter})),this.renderButtonAddField(),s("ez-button",{ref:t=>this._elButtonMode=t,class:"snk-personalized-filter__button-mode",label:this.getMessage(this._filterAssistentMode?"snkPersonalizedFilter.info.activeModeAdvanced":"snkPersonalizedFilter.info.activeModeAssistent"),onClick:()=>this.handleModeChange(),"data-tooltip":this._filterAssistentMode||(null===(n=this._filterAssistent)||void 0===n?void 0:n.assistent)?void 0:this.getMessage("snkPersonalizedFilter.info.tooltipDisabledAssistentMode"),"data-flow":"bottom",enabled:!this._filterAssistent.name||Boolean(this._filterAssistentMode||(null===(a=this._filterAssistent)||void 0===a?void 0:a.assistent))})),this.buildContainerPersonalizedFilter())))))}static get watchers(){return{filterId:["loadFilter"]}}};St.style=".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}.snk-personalized-filter__button-mode.sc-snk-personalized-filter{height:35px}";const Ot=class{constructor(s){t(this,s),this.clickBreadcrumbItem=i(this,"clickBreadcrumbItem",3),this.exit=i(this,"exit",3),this.label=void 0,this.breadcrumbItens=void 0,this.messagesBuilder=void 0}getMessage(t,i){var s;return this.messagesBuilder?this.messagesBuilder.getMessage(t,i):(null===(s=this._application)||void 0===s?void 0:s.messagesBuilder)?this._application.messagesBuilder.getMessage(t,i):void 0}componentDidLoad(){this._element&&(v.addIDInfo(this._element),this._application=o.getContextValue("__SNK__APPLICATION__"))}render(){return s("div",{class:"simple-bar__container ez-margin-vertical--small ez-padding--extra-small"},s("div",{class:"simple-bar__left-slot"},s("ez-button",{class:"ez-padding-right--medium",title:this.getMessage("snkSimpleBar.backTitle"),mode:"icon",iconName:"arrow_back",size:"medium",onClick:()=>this.exit.emit()}),s("div",{class:"simple-bar__column"},s("h1",{class:"ez-title ez-title--primary ez-title--extra-large"},this.label),s("ez-breadcrumb",{items:this.breadcrumbItens,onSelectedItem:({detail:t})=>this.clickBreadcrumbItem.emit(t)}))),s("div",{class:"simple-bar__right-slot"},s("slot",{name:"rightSlot"})))}get _element(){return a(this)}};Ot.style=".sc-snk-simple-bar-h{display:flex;height:100%;width:100%}.simple-bar__container.sc-snk-simple-bar{flex:1;display:flex;align-items:stretch;gap:var(--space--small)}.simple-bar__left-slot.sc-snk-simple-bar{min-width:280px;flex:1;display:flex;align-items:center}.simple-bar__right-slot.sc-snk-simple-bar{flex:1;display:flex;align-items:center;justify-content:flex-end}.simple-bar__column.sc-snk-simple-bar{flex:1;display:flex;flex-direction:column}";const Ft=["INSERT","REFRESH","PREVIOUS","NEXT","DIVIDER","MORE_OPTIONS"],It=["INSERT","REFRESH","PREVIOUS","NEXT","DIVIDER","CLONE","REMOVE","DIVIDER","MORE_OPTIONS"],Et=class{constructor(s){t(this,s),this.dataStateChange=i(this,"dataStateChange",3),this.dataUnitReady=i(this,"dataUnitReady",3),this.actionClick=i(this,"actionClick",7),this.formItemsReady=i(this,"formItemsReady",7),this.configuratorSave=i(this,"configuratorSave",7),this.configuratorCancel=i(this,"configuratorCancel",7),this._multiSelectionListDataSource=new W,this._formConfigFetcher=new z,this._customEditors=new Map,this._customRenders=new Map,this._container=void 0,this._showPopUpGridConfig=!1,this._currentViewMode=A.GRID,this._config=void 0,this._fieldToGetFocus=void 0,this._customContainerId=`SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${d.generateUUID()}`,this.enableLockManagerLoadingComp=!1,this.enableLockManagerTaskbarClick=!1,this.dataState=void 0,this.dataUnit=void 0,this.entityName=void 0,this.mode=x.SERVER,this.gridConfig=void 0,this.formConfig=void 0,this._formFields=[],this._fieldsProps=new Map,this.enableContinuousInsert=!1,this.multipleSelection=void 0,this.useCancelConfirm=!0,this.pageSize=150,this.resourceID=void 0,this.enableGridInsert=!1,this.paginationCounterMode="auto",this.taskbarManager=void 0,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.actionsList=void 0,this.configName=void 0,this.showConfiguratorButtons=!1,this.gridLegacyConfigName=void 0,this.formLegacyConfigName=void 0,this.ignoreReadOnlyFormFields=!1,this.autoFocus=!0,this.domainMessagesBuilder=void 0,this.multipleEditionEnabled=!0,this.layoutFormConfig=!0,this.disableGridEdition=!1,this.autoLoad=void 0,this.outlineMode=!1}async addCustomEditor(t,i){if(this._grid&&this._form)return this._grid.addCustomEditor(t,i),void this._form.addCustomEditor(t,i);const s=new Map(this._customEditors);s.set(t,i),this._customEditors=s}async addGridCustomRender(t,i){if(this._grid)return void this._grid.addGridCustomRender(t,i);const s=new Map(this._customRenders);s.set(t,i),this._customRenders=s}async handleResourceIDChanged(t,i){d.isEmpty(t)||t!==i&&(await this.loadFormConfig(!0),await this.loadGridConfig(!0))}async addCustomValueFormatter(t,i){this._grid.addCustomValueFormatter(t,i)}async removeCustomValueFormatter(t){this._grid.removeCustomValueFormatter(t)}async setFieldProp(t,i,s){const e=new Map(this._fieldsProps),n=this._fieldsProps.get(t);e.set(t,Object.assign(Object.assign({},n),{[i]:s})),this._fieldsProps=e}loadTaskbarProcessor(){const t={};t[Pt.FORM_REGULAR]=this.getButtons(!1,[O.GRID_MODE],!0),t[Pt.GRID_REGULAR]=this.getButtons(!1,[O.DATA_EXPORTER,O.FORM_MODE]),t[Pt.FORM_SELECTED]=this.getButtons(!0,[O.GRID_MODE],!0),t[Pt.GRID_SELECTED]=this.getGridSelectedButtonsCallBack.bind(this),t[Pt.FINISH_EDITION]=this.getFinishEditionButtonsCallback.bind(this),t[Pt.MULTIPLE_EDITION]=[O.CANCEL],this._taskbarProcessor=new X(t)}getGridSelectedButtonsCallBack(){var t,i,s;return this.multipleEditionEnabled&&1!==(null===(s=null===(i=null===(t=this.dataState)||void 0===t?void 0:t.selectionInfo)||void 0===i?void 0:i.records)||void 0===s?void 0:s.length)?this.getButtons(!0,[O.UPDATE_MULTIPLE,O.DATA_EXPORTER,O.FORM_MODE]):this.getButtons(!0,[O.DATA_EXPORTER,O.FORM_MODE])}getFinishEditionButtonsCallback(){const t=[O.CANCEL,O.SAVE];return this.enableGridInsert&&this._currentViewMode!==A.ATTACHMENT&&t.push(this._currentViewMode===A.GRID?O.FORM_MODE:O.GRID_MODE),t}getButtons(t,i,s){let e=t?It:Ft;return(s||this.mode===x.IN_MEMORY)&&(e=e.filter((t=>t!==O.REFRESH))),this.addConfigButton(e.concat(i))}addConfigButton(t){return void 0===this.configName||this.configName&&this.gridLegacyConfigName?t:t.concat(O.CONFIGURATOR)}get application(){return o.getContextValue("__SNK__APPLICATION__")}async goToView(t){this._currentViewMode=t,this._viewStack&&(t===A.GRID&&(this.dataUnit.isMultipleEdition=!1),this._viewStack.show(t)),t===A.GRID&&requestAnimationFrame((()=>this.focusToGrid())),t===A.FORM&&requestAnimationFrame((()=>this.focusToForm()))}actionClickListener(t){this.handleTaskbarAction(t.detail),t.stopPropagation()}handleTaskbarAction(t){switch(t){case O.CONFIGURATOR:this._snkConfigurator.open();break;case O.GRID_MODE:this.goToView(A.GRID);break;case O.FORM_MODE:this.goToView(A.FORM);break;case O.UPDATE_MULTIPLE:this.dataUnit.isMultipleEdition=!0,this.goToView(A.FORM)}}async onChangeEntityName(t){if(this.dataUnit)return;const i=o.getContextValue("__SNK__APPLICATION__");this.dataUnit=await i.getDataUnit(t,null,null,this.configName)}onModeChange(){this.mode==x.IN_MEMORY&&this.initInMemoryDataUnit()}observeDataState(t,i){this.handleDataStateChange(t,i)}async observeFormLegacy(t,i){await this.handleUpdateFormLegacyConfig(t,i)}async observeGridLegacy(t,i){await this.handleUpdateGridLegacyConfig(t,i)}async handleDataStateChange(t,i){m.objectToString(i)!=m.objectToString(t)&&this.dataStateChange.emit(t),await this.processRmPrecision()}async processRmPrecision(){var t,i;const s=await this._snkDataUnit.getFieldsWithRmPrecision();for(const e of s||[]){if(!e)continue;const s=null===(i=null===(t=this.dataState)||void 0===t?void 0:t.rowMetadata)||void 0===i?void 0:i.getProp("rm_precision",e);(s||0===s)&&(await this.setFieldProp(e,"precision",s),await this.setFieldProp(e,"prettyPrecision",s))}this._rmPrecisionCustomValueFormatter.setDataState(this.dataState)}async handleUpdateGridLegacyConfig(t,i){null!=t&&t!=i&&this._gridConfigAlreadyLoaded&&await this.loadGridConfig(!0)}async handleUpdateFormLegacyConfig(t,i){null!=t&&t!=i&&this._formConfigAlreadyLoaded&&await this.loadFormConfig(!0)}async openConfig(t){await this._snkConfigurator.close(),t===A.GRID?await this.openGridConfig():t===A.FORM&&await this.openFormConfig()}async openGridConfig(){var t,i,s,e;const n=null!==(i=await(null===(t=this._grid)||void 0===t?void 0:t.getColumns()))&&void 0!==i?i:[],a=null!==(e=await(null===(s=this._grid)||void 0===s?void 0:s.getColumnsState()))&&void 0!==e?e:[];this._snkGridConfig.columns=a.filter((t=>t.name)),this._snkGridConfig.originalColumns=n.filter((t=>t.name)),this._snkGridConfig.selectedIndex=0,this._showPopUpGridConfig=!0}async openFormConfig(){(this.formLegacyConfigName||this.configName)&&await this._snkSimpleFormConfig.show()}addGridLegacyConfigName(){this.gridLegacyConfigName&&this.configName&&H.addGridLegacyConfig(this.configName,this.gridLegacyConfigName)}loadGridConfig(t){if(void 0!==this.configName&&(null==this.gridConfig&&!this._gridConfigAlreadyLoaded||t))return this.addGridLegacyConfigName(),this._gridConfigAlreadyLoaded=!0,new Promise(((t,i)=>{H.loadGridConfig(this.configName,this.resolveResourceID()).then((i=>{this.setGridConfig(i),t()})).catch((t=>{i(t)}))}))}formConfigIsLoaded(){return null!=this.formConfig||this._formConfigAlreadyLoaded}async loadFormConfig(t=!1,i=!1){if(void 0===this.configName)return;if(null==this._formConfigManager&&(this._formConfigManager=new it(this.configName,this.resolveResourceID(),void 0,this.dataUnit),this._formConfigManager.setConfig(this.formConfig)),this.formConfigIsLoaded()&&!t)return;this._formConfigAlreadyLoaded=!0;let s=await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);if(null!=s)return this._formConfigManager.setConfig(s),void this.setFormConfig(s,i);this.setFormConfig(await this._formConfigManager.loadConfig())}async componentWillRender(){this.loadTaskbarProcessor(),this._resourceID=await this.application.getResourceID(),this.dataExporterProviderStore(),this.dataExporterProviderStore(),this._taskbarProcessor.process(this.getTaskBarId(),this.taskbarManager,this.dataState,this.getTaskBarDisabledButtons()),void 0!==this.configName&&(null!=this.gridConfig||this._gridConfigAlreadyLoaded||(await this.addGridLegacyConfigName(),await this.loadGridConfig(),await this.loadFormConfig()))}componentDidRender(){this._rmPrecisionCustomValueFormatter.setGrid(this._grid),this.addGridCustomValueFormattters(),this.setFieldsProps(),this.setCustomRenders(),this.setCustomEditors()}componentWillLoad(){this.processMetadata(),this.onModeChange(),this.configDatasource(),this._rmPrecisionCustomValueFormatter=new Y,this._continuousInsertUtils=new st(this.application,this.resolveResourceID(),this.configName),this.enableGridInsert&&this._continuousInsertUtils.getConfig().then((t=>this.enableContinuousInsert=t))}componentDidLoad(){L.applyVarsGrid(this._element,this._grid),this.initKeyboardManager(),this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this))}async dataUnitActionHandler(t){t.type!==l.EDITION_CANCELED&&t.type!==l.DATA_SAVED||this.dataUnit.isMultipleEdition&&this.goToView(A.GRID)}getMessage(t,i){var s;return null===(s=this.messagesBuilder)||void 0===s?void 0:s.getMessage(t,i)}disconnectedCallback(){var t;null===(t=this._keyboardManager)||void 0===t||t.unbindAllShortcutKeys()}setCustomRenders(){if(this._grid)for(const[t,i]of this._customRenders)this._grid.addGridCustomRender(t,i),this._customRenders.delete(t)}setCustomEditors(){if(this._grid&&this._form)for(const[t,i]of this._customEditors)this._grid.addCustomEditor(t,i),this._form.addCustomEditor(t,i),this._customEditors.delete(t)}configDatasource(){this._multiSelectionListDataSource.setApplication(this.application),this._multiSelectionListDataSource.setDataUnit(this.dataUnit)}setFieldsProps(){if(this._form)for(const[t,i]of this._fieldsProps){for(const s in i)this._form.setFieldProp(t,s,i[s]);this._fieldsProps.delete(t)}}getTaskBarId(){var t,i;return(null===(t=this.dataState)||void 0===t?void 0:t.isDirty)?Pt.FINISH_EDITION:this.dataUnit.isMultipleEdition?Pt.MULTIPLE_EDITION:(null===(i=this.dataState)||void 0===i?void 0:i.selectionInfo)&&!this.dataState.selectionInfo.isAllRecords()&&this.dataState.selectionInfo.length>0?this._currentViewMode===A.GRID?Pt.GRID_SELECTED:Pt.FORM_SELECTED:this._currentViewMode===A.GRID?Pt.GRID_REGULAR:Pt.FORM_REGULAR}initInMemoryDataUnit(){this._inMemoryLoader=new w(this._metadata,void 0,{autoLoad:this.autoLoad}),this.dataUnit=this._inMemoryLoader.dataUnit,this.dataUnitReady.emit(this.dataUnit)}setMetadata(t){return this._inMemoryLoader?this._inMemoryLoader.metadata=t:this.dataUnit&&(this.dataUnit.metadata=t),Promise.resolve()}setRecords(t){return this._inMemoryLoader?this._inMemoryLoader.records=t:this.dataUnit&&(this.dataUnit.records=t),Promise.resolve()}getRecords(){return Promise.resolve(this.dataUnit.records)}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 updateConfig(){null==this._formConfigManager&&(this._formConfigManager=new it(this.configName,this.resolveResourceID())),this._formConfigManager.setConfig(this.formConfig)}processMetadata(){const t=this._element.querySelectorAll("snk-field-metadata"),i=[],s={fields:[],emptyConfig:!1};t.forEach((t=>{const e={name:t.getAttribute("name")||t.getAttribute("label"),label:t.getAttribute("label"),dataType:r[t.getAttribute("dataType")]||r.TEXT,userInterface:h[t.getAttribute("userInterface")]||h.SHORTTEXT,readOnly:"true"==t.getAttribute("readOnly"),required:"true"==t.getAttribute("required"),tab:t.getAttribute("tab")||void 0,visible:"false"!=t.getAttribute("visible")};s.fields.push({name:e.name,tab:e.tab,visible:e.visible}),i.push(e)})),i.length>0&&(this.formConfig||(this.formConfig=s),this._metadata={name:"SimpleCrud",label:"SimpleCrud",fields:i})}addGridCustomValueFormattters(){var t,i,s;const e=(null===(t=this._metadata)||void 0===t?void 0:t.fields)||(null===(s=null===(i=this.dataUnit)||void 0===i?void 0:i.metadata)||void 0===s?void 0:s.fields);if(!e)return;const n=[];e.forEach((t=>{var i;(null===(i=t.properties)||void 0===i?void 0:i.rm_precision)&&!n.includes(t.name)&&n.push(t.name)})),n.forEach((t=>{this.addCustomValueFormatter(t,this._rmPrecisionCustomValueFormatter)}))}onDataStateChange(t){this.dataState=Object.assign({},t.detail)}getTaskBarDisabledButtons(){var t,i,s,e,n,a;const o=[];return(null===(t=this.dataState)||void 0===t?void 0:t.hasNext)||o.push(O.NEXT),(null===(i=this.dataState)||void 0===i?void 0:i.hasPrevious)||o.push(O.PREVIOUS),(null===(e=null===(s=this.dataState)||void 0===s?void 0:s.selectionInfo)||void 0===e?void 0:e.isEmpty())&&o.push(O.FORM_MODE),(null===(a=null===(n=this.dataState)||void 0===n?void 0:n.selectionInfo)||void 0===a?void 0:a.length)>1&&o.push(O.CLONE),o}handleCancelEdit(){var t;(null===(t=this.dataState)||void 0===t?void 0:t.recordsIsEmpty)&&(this.goToView(A.GRID),this.dataUnit.clearSelection())}handleConfiguratorEvent(t,i){t.stopImmediatePropagation(),"SAVE"!==i?this.configuratorCancel.emit():this.configuratorSave.emit()}onSelectField(t){null!=t&&(this._fieldToGetFocus=t.value)}getFieldSearch(t,i){return null!=this._fieldSearch||(this._splitButtonForm=t,this._fieldSearch=D(i,(({argument:t})=>this.fieldsOptionLoader(t)),(t=>this.onSelectField(t)))),this._fieldSearch}getFormFields(){var t,i;return null!==(i=null===(t=this.formConfig)||void 0===t?void 0:t.fields)&&void 0!==i?i:this._formFields}handleFormSetFields(t){m.equals(this._formFields,t)||(this._formFields=null!=t?t:[])}fieldsOptionLoader(t){const i=null==t?void 0:t.toLowerCase(),s=this.getFormFields().map((t=>{var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getField(t.name)})).filter((t=>{var s,e;return(null===(s=t.name)||void 0===s?void 0:s.toLowerCase().includes(i))||(null===(e=t.label)||void 0===e?void 0:e.toLowerCase().includes(i))})).map((t=>({value:t.name,label:t.label})));return Promise.resolve(s)}isGridInsertActive(){return this.enableGridInsert&&this.dataUnit.hasNewRecord()}getColumnSearch(t,i){return null!=this._columnSearch||(this._splitButton=t,this._columnSearch=D(i,(({argument:t})=>new Promise((i=>{this._grid.filterColumns(t).then((t=>{i(t.filter((t=>!t.hidden)).map((t=>({label:t.label,value:t.name}))))}))}))),(t=>{null!=t&&this._grid.locateColumn(t.value)}))),this._columnSearch}getActionsList(){const t=[];if(this.enableGridInsert&&t.push(this._continuousInsertUtils.actionContinuousInsert(this.enableContinuousInsert,(()=>{this.enableContinuousInsert=!this.enableContinuousInsert,this._continuousInsertUtils.handleSaveConfig(this.enableContinuousInsert)}))),this.isGridInsertActive())return t;if(null!=this.taskbarManager&&null!=this.taskbarManager.getMoreOptions){const i=this.getTopTaskBarId();return t.concat(this.taskbarManager.getMoreOptions(i,this.configName,this.dataState,this.actionsList))}return t.concat(this.actionsList)}getSettingsListGrid(){return[{value:d.generateUUID(),label:this.getMessage("snkSimpleCrud.findColumn"),disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(t,i)=>this.getColumnSearch(t,i)}]}getSettingsListForm(){return[{value:d.generateUUID(),label:this.getMessage("snkSimpleCrud.findFields"),disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(t,i)=>this.getFieldSearch(t,i)}]}getTopTaskBarId(){var t;return(null===(t=this.dataState)||void 0===t?void 0:t.isDirty)?`snkGridTopTaskbar.finish_edition${k.PRIMARY}`:`snkGridTopTaskbar.regular${k.PRIMARY}`}clearFieldToFocusHandler(){this._fieldToGetFocus=void 0}gridConfigChangeHandler(t){t.stopPropagation(),this.configName&&H.saveGridConfig(t.detail,this.configName,this.resolveResourceID())}modalConfigChangeHandler(t){const i=t.detail;this._grid.setColumnsState(i.columns).then((()=>{this.setGridConfig(i),this.closeGridConfig(),this.dataExporterProviderStore()})),t.stopPropagation()}async dataExporterProviderStore(){if(null==this.dataUnit)return;if(null==this._grid)return;const t=new tt(this.dataUnit,this._grid);J.set("exporterProviders",Object.assign(Object.assign({},J.get("exporterProviders")),{[this.getDataExporterStoreKey()]:t}))}getDataExporterStoreKey(){return`SnkSimpleCrudDataExporter:${null==this.configName?this.dataUnit.name:this.configName}`}setGridConfig(t){this.gridConfig=t,Z.assertDefaultSorting(this.gridConfig,this.dataUnit)}setFormConfig(t,i){this.formConfig&&!i||(this.formConfig=t)}closeGridConfig(){this._showPopUpGridConfig=!1}getPageSize(){return this.mode===x.IN_MEMORY?0:null==this.pageSize?150:this.pageSize}resolveResourceID(){return d.isEmpty(this.resourceID)?this._resourceID:this.resourceID}getFormConfig(){var t;const i=null===(t=this._formConfigManager)||void 0===t?void 0:t.getConfig(this.dataUnit,this.ignoreReadOnlyFormFields);return this.configName||i?i:this.formConfig}updateFormConfig(){let t=this.formConfig;null==this.formLegacyConfigName&&(t=Object.assign(Object.assign({},this.formConfig),{fields:this.dataUnit.metadata.fields})),this.setFormConfig(t,!0),null==this._formConfigManager&&(this._formConfigManager=new it(this.configName,this.resolveResourceID())),this._formConfigManager.setConfig(this.formConfig)}handleDataUnitOnInsertionMode(){this.enableGridInsert||this.goToView(A.FORM)}async initKeyboardManager(){var t;this._keyboardManager=new f({propagate:!1,element:this._element});const i=this.dataUnit||await(null===(t=this._snkDataUnit)||void 0===t?void 0:t.getDataUnit());null!=i&&this._keyboardManager.bind("F7",(()=>i.saveData()),{description:this.getMessage("snkSimpleCrud.keyboardShortcuts.saveData"),element:this._element}).bind("F8",i.addRecord.bind(i),{description:this.getMessage("snkSimpleCrud.keyboardShortcuts.addRecord"),element:this._element}).bind("F9",i.removeSelectedRecords.bind(i),{description:this.getMessage("snkSimpleCrud.keyboardShortcuts.removeRecord"),element:this._element}).bind("Escape",(()=>{i.isDirty()&&i.cancelEdition()}),{debounceTime:1e3,description:this.getMessage("snkSimpleCrud.keyboardShortcuts.cancelAction"),element:this._element})}async handleFormConfigSaved(){await this.loadFormConfig(!0,!0)}focusToGrid(){this._grid.focus()}focusToForm(){this._form.focus()}renderTaskbarContent(t){var i;return s("snk-taskbar",{class:"ez-box--no-outline ez-box "+(this._currentViewMode===A.FORM?(this.outlineMode?"ez-box--outline":"ez-box--shadow-xsmall")+" ez-padding--small":""),dataUnit:this.dataUnit,primaryButton:(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"SAVE":"INSERT","data-element-id":"grid_left",messagesBuilder:this.messagesBuilder,buttons:this._taskbarProcessor.buttons,actionsList:this.getActionsList(),actionsSettingsList:t===A.GRID?this.getSettingsListGrid():this.getSettingsListForm(),disabledButtons:this._taskbarProcessor.disabledButtons,customButtons:this._taskbarProcessor.customButtons,"data-exporter-store-key":this.getDataExporterStoreKey(),slot:"leftButtons",presentationMode:k.SECONDARY,tabindex:"0"},s("slot",{name:"TASKBAR_CUSTOM_ELEMENTS"}))}render(){var t;if(null!=this.dataUnit)return s("snk-data-unit",{ref:t=>this._snkDataUnit=t,class:"simple-crud__container",dataUnit:this.dataUnit,useCancelConfirm:this.useCancelConfirm,onDataStateChange:t=>this.onDataStateChange(t),onCancelEdition:this.handleCancelEdit.bind(this),pageSize:this.getPageSize(),onInsertionMode:this.handleDataUnitOnInsertionMode.bind(this),onDataUnitReady:t=>this.dataUnitReady.emit(t.detail),onMessagesBuilderUpdated:t=>this.messagesBuilder=t.detail,onDataUnitFieldsHidded:this.updateFormConfig.bind(this),domainMessagesBuilder:this.domainMessagesBuilder},s("header",null,s("slot",{name:"snkSimpleCrudHeader"})),s("section",{class:`ez-box ez-box--no-outline ${this.outlineMode?"ez-box--outline":"ez-box--shadow"} simple-crud__container-section`,ref:t=>this._container=t,tabindex:"0"},s("ez-view-stack",{ref:t=>this._viewStack=t,"data-element-id":"simple-crud"},s("stack-item",null,s("ez-grid",{class:"ez-margin-bottom--large ez-box--no-outline",ref:t=>this._grid=t,dataUnit:this.dataUnit,config:this.gridConfig,"no-header":!0,multipleSelection:this.multipleSelection,onEzDoubleClick:()=>this.goToView(A.FORM),onConfigChange:t=>this.gridConfigChangeHandler(t),columnfilterDataSource:this.dataUnit.name&&this.dataUnit.name.includes(w.IN_MEMORY_DATA_UNIT_NAME)?void 0:this._multiSelectionListDataSource,useEnterLikeTab:this.useEnterLikeTab,autoFocus:this.autoFocus,enableGridInsert:this.enableGridInsert,enableContinuousInsert:this.enableContinuousInsert,enableLockManagerTaskbarClick:this.enableLockManagerTaskbarClick,enableLockManagerLoadingComp:this.enableLockManagerLoadingComp,outlineMode:this.outlineMode,tabindex:"0",paginationCounterMode:this.paginationCounterMode,canEdit:!this.disableGridEdition},this.renderTaskbarContent(A.GRID),s("div",{slot:"footer"},s("slot",{name:"snkSimpleCrudFooter"})))),s("stack-item",null,this.renderTaskbarContent(A.FORM),s("ez-form",{ref:t=>this._form=t,class:"ez-margin-top--large ez-box--no-outline",dataUnit:this.dataUnit,config:this.getFormConfig(),fieldToFocus:this._fieldToGetFocus,onEzFormSetFields:t=>this.handleFormSetFields(t.detail),onEzFormRequestClearFieldToFocus:this.clearFieldToFocusHandler.bind(this),elementFocusSearchField:this._container,tabindex:"0"}),s("slot",{name:"snkSimpleCrudFormFooter"}),s("snk-simple-form-config",{ref:t=>this._snkSimpleFormConfig=t,dataUnit:this.dataUnit,onSnkConfigSaved:this.handleFormConfigSaved.bind(this),configName:null!==(t=this.formLegacyConfigName)&&void 0!==t?t:this.configName,messagesBuilder:this.messagesBuilder})),this.messagesBuilder&&s("snk-configurator",{ref:t=>this._snkConfigurator=t,viewMode:this._currentViewMode,messagesBuilder:this.messagesBuilder,onConfigSelected:t=>this.goToView(t.detail),onOpenConfig:t=>this.openConfig(t.detail),showActionButtons:this.showConfiguratorButtons,onSave:t=>this.handleConfiguratorEvent(t,"SAVE"),onCancel:t=>this.handleConfiguratorEvent(t,"CANCEL"),resourceID:this.resolveResourceID(),customContainerId:this._customContainerId,layoutFormConfig:this.layoutFormConfig})),s("div",{id:`${this._customContainerId}`},s("slot",{name:"SnkConfigContainerSlot"}))),s("ez-popup",{size:"medium",heightMode:"auto",useHeader:!1,opened:this._showPopUpGridConfig,onEzClosePopup:()=>this.closeGridConfig()},s("snk-grid-config",{ref:t=>this._snkGridConfig=t,config:this.gridConfig,"data-element-id":this._element.getAttribute(v.DATA_ELEMENT_ID_ATTRIBUTE_NAME),selectedIndex:0,configName:this.configName,onConfigChange:t=>this.modalConfigChangeHandler(t),onConfigCancel:()=>this.closeGridConfig(),resourceID:this.resolveResourceID()})))}get _element(){return a(this)}static get watchers(){return{resourceID:["handleResourceIDChanged"],entityName:["onChangeEntityName"],mode:["onModeChange"],dataState:["observeDataState"],formLegacyConfigName:["observeFormLegacy"],gridLegacyConfigName:["observeGridLegacy"]}}};var Pt;!function(t){t.FORM_REGULAR="snkSimpleCrudTaskbar.form_regular",t.GRID_REGULAR="snkSimpleCrudTaskbar.grid_regular",t.FORM_SELECTED="snkSimpleCrudTaskbar.form_selected",t.GRID_SELECTED="snkSimpleCrudTaskbar.grid_selected",t.FINISH_EDITION="snkSimpleCrudTaskbar.finish_edition",t.MULTIPLE_EDITION="snkSimpleCrudTaskbar.multiple_edition"}(Pt||(Pt={})),Et.style=".sc-snk-simple-crud-h{display:flex;height:100%;width:100%;--snk-simple-crud-grid--min-height:300px}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:auto 1fr;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}.simple-crud__form--hidden.sc-snk-simple-crud{display:none}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;--ez-grid__container--shadow--outline:none;--ez-grid--min-height:var(--snk-simple-crud-grid--min-height)}ez-form.sc-snk-simple-crud{min-height:300px}";export{kt as snk_attach,_t as snk_default_filter,yt as snk_dynaform_form_view,wt as snk_filter_advanced_mode,Ct as snk_filter_assistent_mode,zt as snk_filter_detail,At as snk_filter_modal_item,xt as snk_image_input,St as snk_personalized_filter,Ot as snk_simple_bar,Et as snk_simple_crud}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,e as i,i as s,h as e,f as a,g as o}from"./p-2c9d0870.js";import{Action as h,StringUtils as n,KeyboardManager as r}from"@sankhyalabs/core";import{S as d}from"./p-1cc4cf61.js";import{FormMetadata as l,buildFormMetadata as c}from"@sankhyalabs/ezui/dist/collection/utils/form";import{S as u}from"./p-5d02c032.js";import"./p-b1bf9564.js";import{P as m}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-5c6eede7.js";import"./p-ff1990ad.js";import"./p-d88278f8.js";import{V as v}from"./p-9019a32f.js";import{T as p}from"./p-3072136e.js";import{S as g}from"./p-70c2ee5c.js";import{buildFieldSearch as f,SHORTCUT_SEARCH_FIELD as b}from"@sankhyalabs/ezui/dist/collection/utils";import"./p-51e853f2.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-a73b6b00.js";class k{constructor(t,i,s,e){this._parentGuide=t,this._formMetadata=i,this._dataUnit=s,this._messageBuilder=e,this._messageBuilder||(this._messageBuilder=new u)}get id(){return this._parentGuide.id}getMessage(t,i){return this._messageBuilder.getMessage(t,i)}buildGuideItem(t){const i=Object.assign({},this._parentGuide);delete i.expanded,delete i.children;const s=this._dataUnit.getSelectedRecord();if(!s)return i;const e=this._dataUnit.isNewRecord(s.__record__id__),a=Array.from(this._formMetadata.getAllSheets().values()).map((i=>{const{name:s,label:a}=i,o=null!=l.getDetailName(s.split("::").pop()),h=o&&e,n=this._parentGuide.id,r=o?`${n}::${s}`:`${n}__FORM:${s}`;return o&&t.has(r)&&!h?t.get(r).buildGuideItem(t):{id:r,label:a,disabled:h,tooltip:h?this.getMessage("snkCrud.guide.tooltip.disabledDetail"):void 0}})),o=a.shift();return o.label=e?this.getMessage("snkCrud.newRecord"):s.__record__label__,o.children=a,i.children=[o],i}}const w=class{constructor(s){t(this,s),this.snkDetailGuidesChange=i(this,"snkDetailGuidesChange",7),this.snkSwitchGuide=i(this,"snkSwitchGuide",7),this.formItemsReady=i(this,"formItemsReady",7),this._disabledButtons=void 0,this._currentView=void 0,this.attachmentRegisterKey=void 0,this._fieldToGetFocus=void 0,this._hasToCreateFieldSearch=!0,this.formConfigManager=void 0,this.dataUnitName=void 0,this.resourceID=void 0,this.guideItemPath=void 0,this.entityName=void 0,this.label=void 0,this.dataUnit=void 0,this.selectedForm=void 0,this.dataState=void 0,this.messagesBuilder=void 0,this.branchGuide=void 0,this.canEdit=!0,this.taskbarCustomContainerId=void 0,this.customEditors=void 0,this.customRenders=void 0,this.presentationMode=m.SECONDARY}observeDataUnit(t,i){null==t||t.subscribe(this.dataUnitActionHandler.bind(this)),null==i||i.unsubscribe(this.dataUnitActionHandler)}observerDataState(t,i){const s=!(null==i?void 0:i.insertionMode)&&(null==t?void 0:t.insertionMode),e=(null==i?void 0:i.insertionMode)&&!(null==t?void 0:t.insertionMode);if((s||e)&&this.loadMetadata(),null==this._formMetadata)return;const a=null==t?void 0:t.selectedRecord,o=null==i?void 0:i.selectedRecord;(null==a?void 0:a.__record__id__)!==(null==o?void 0:o.__record__id__)&&this.snkDetailGuidesChange.emit(new k(this.branchGuide,this._formMetadata,this.dataUnit,this.messagesBuilder)),s&&setTimeout((()=>{this.changeViewMode(v.FORM)}),0),e&&this.changeViewMode(v.GRID);const h=[];this.dataState.hasPrevious||h.push(p.PREVIOUS),this.dataState.hasNext||h.push(p.NEXT),this.dataState.insertionMode&&h.push(p.INSERT),this._disabledButtons=h}async changeViewMode(t){this.emitSwitchEvent(t)}async configGrid(){this._snkGrid&&this._snkGrid.showConfig()}async showUp(){this._snkFormView&&this._snkFormView.showUp(),this._snkGrid&&this._snkGrid.scrollIntoView({behavior:"smooth",block:"start"})}async addCustomEditor(t,i){var s;const e=this.normalizeBranchGuideId(null===(s=this.branchGuide)||void 0===s?void 0:s.id);this._snkGrid.addCustomEditor(t,i,e),this._snkFormView.addCustomEditor(t,i,e)}async observerPropsCustomEditor(t){for(const i in t)await this.addCustomEditor(i,t[i])}async addGridCustomRender(t,i){var s;const e=this.normalizeBranchGuideId(null===(s=this.branchGuide)||void 0===s?void 0:s.id);await this._snkGrid.addGridCustomRender(t,i,e)}onContentCardChanged(t){g.updateContentCard(t.detail.formName,t.detail.cardConfig,t.detail.propertyChanged,this.formConfigManager).then((()=>s(this))),t.stopPropagation()}async observeCustomRenders(t){for(const i in t){const s=t[i];await this.addGridCustomRender(i,s)}}updateLabel(){const t=this.guideItemPath?this.guideItemPath.length:0;if(t>0){const i=t>0?this.guideItemPath.map((t=>t.label)):void 0;this.label=i.pop(),this._levelPath=i.length>0?i.join(" / "):void 0}else this.label="",this._levelPath=void 0}getFormGuideId(t){var i;if(!t){if(null==(null===(i=this.dataState)||void 0===i?void 0:i.selectedRecord))return;const s=Array.from(this._formMetadata.getAllSheets().keys());if(!s||0==s.length)return;t=s[0]}return`${this.stripFormPattern(this.branchGuide.id)}__FORM:${t}`}stripFormPattern(t){return t.replace(w.REGEX_FORM_ID,"")}loadMetadata(){if(!this.dataUnit)return;if(!this.formConfigManager.isLoaded)return;const t=this.formConfigManager.getConfig(this.dataUnit);this._formMetadata=c(null==t||0===t.fields.length?void 0:t,this.dataUnit,!0)}dataUnitReadyHandler(t){this.dataUnit=t.detail,this.loadMetadata()}updateViewStack(t){var i,s;this._viewStack=t,this._currentView=this.selectedForm?1:0,null===(s=null===(i=this._viewStack)||void 0===i?void 0:i.show)||void 0===s||s.call(i,this._currentView)}getFormFields(){return this.selectedForm&&this._formMetadata?this._formMetadata.getSheet(this.selectedForm).fields:[]}emitSwitchEvent(t){t===v.GRID&&(this.dataUnit.isMultipleEdition=!1);const i=t===v.GRID?this.stripFormPattern(this.branchGuide.id):this.getFormGuideId();i&&this.snkSwitchGuide.emit(i)}executeActionHandler(t){t.detail===p.GRID_MODE&&(this.emitSwitchEvent(v.GRID),t.stopPropagation()),t.detail===p.UPDATE_MULTIPLE&&(this.dataUnit.isMultipleEdition=!0,this.emitSwitchEvent(v.FORM),t.stopPropagation()),t.detail!==p.FORM_MODE&&t.detail!==p.UPDATE||(this.emitSwitchEvent(v.FORM),t.stopPropagation()),t.detail===p.ATTACH&&(this._snkAttach.open(),t.stopPropagation())}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}async handleDataStateChange({detail:t}){this.dataState=t,void 0!==t.selectedRecord&&this._snkDataUnit&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey())}componentWillLoad(){this._configName=`dynaform.${this.entityName}`,this.formConfigManager=new d(this._configName,this.resourceID,(()=>this.loadMetadata()),this.dataUnit),this.formConfigManager.loadConfig(),null==this.messagesBuilder&&(this.messagesBuilder=new u(this.entityName))}async componentDidLoad(){await this.observerPropsCustomEditor(this.customEditors),await this.observeCustomRenders(this.customRenders),this.initKeyboardManager()}disconnectedCallback(){var t;null===(t=this._keyboardManager)||void 0===t||t.unbindAllShortcutKeys()}async dataUnitActionHandler(t){t.type===h.FIELD_INVALIDATED?this.addErrorBadgeToBranchGuide():t.type===h.DATA_LOADED&&this.handleDataLoaded()}handleDataLoaded(){var t;(null===(t=this.dataUnit)||void 0===t?void 0:t.getSelectedRecord())||this.dataUnit.selectFirst()}addErrorBadgeToBranchGuide(){this.branchGuide=Object.assign(Object.assign({},this.branchGuide),{badge:"error"}),this.snkDetailGuidesChange.emit(new k(this.branchGuide,this._formMetadata,this.dataUnit,this.messagesBuilder))}normalizeBranchGuideId(t){return null==t?void 0:t.replace(/child\[(.*?)\]/g,"$1").replace(/::/g,">")}getSettingsListForm(){return[{value:n.generateUUID(),label:this.messagesBuilder.getMessage("snkCrud.findColumn",void 0),disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(t,i)=>this.getFieldsSearch(i)}]}getFieldsSearch(t){return(null==this._fieldSearch||this._hasToCreateFieldSearch)&&(this._hasToCreateFieldSearch=!1,this._fieldSearch=f(t,(({argument:t})=>this.fieldsOptionLoader(t)),(t=>this.onSelectField(t)))),this._fieldSearch}fieldsOptionLoader(t){const i=null==t?void 0:t.toLowerCase(),s=this.getFormFields().map((t=>{var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getField(t.name)})).filter((t=>{var s,e;return(null===(s=t.name)||void 0===s?void 0:s.toLowerCase().includes(i))||(null===(e=t.label)||void 0===e?void 0:e.toLowerCase().includes(i))})).map((t=>({value:t.name,label:t.label})));return Promise.resolve(s)}onSelectField(t){null!=t&&(this._fieldToGetFocus=t.value)}clearFieldToFocusHandler(){this._fieldToGetFocus=void 0}async initKeyboardManager(){this._keyboardManager=new r({propagate:!1,element:this._element}),this._keyboardManager.bind(b,(async()=>{await this._snkFormView.showSearchField()}),{description:this.messagesBuilder.getMessage("snkSimpleCrud.findFields"),element:this._element})}render(){return this.updateLabel(),e(a,null,e("snk-data-unit",{ref:t=>this._snkDataUnit=t,dataUnitName:`${this.dataUnitName}`,onDataUnitReady:t=>this.dataUnitReadyHandler(t),entityName:this.entityName,onDataStateChange:this.handleDataStateChange.bind(this),ignoreSaveMessage:this._currentView===v.GRID,messagesBuilder:this.messagesBuilder,configName:this._configName},e("ez-view-stack",{ref:t=>this.updateViewStack(t)},e("stack-item",null,e("div",{class:"ez-box ez-box--shadow grid-container"},e("div",{class:"ez-title--primary ez-size-width--full ez-padding--large detail-header"},e("div",{class:"ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center"},this._levelPath?e("span",{class:"level-path"},this._levelPath+" /"):void 0,this.label)),e("snk-grid",{class:"ez-size-width--full",ref:t=>this._snkGrid=t,configName:this._configName,messagesBuilder:this.messagesBuilder,onGridDoubleClick:()=>this.emitSwitchEvent(v.FORM),onActionClick:t=>this.executeActionHandler(t),presentationMode:this.presentationMode,canEdit:this.canEdit,isDetail:!0,taskbarCustomContainerId:this.taskbarCustomContainerId,gridHeaderCustomSlotId:"DETAIL_GRID_HEADER_CUSTOM_ELEMENTS",topTaskbarCustomSlotId:"DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS",outlineMode:!1,enableGridInsert:!0,autoLoad:!0,multipleEditionEnabled:!0,multipleSelection:!0}))),e("stack-item",null,e("snk-form-view",{ref:t=>this._snkFormView=t,canExpand:!1,canFix:!1,name:this.selectedForm,formMetadata:this._formMetadata,dataUnit:this.dataUnit,fields:this.getFormFields(),fieldToFocus:this._fieldToGetFocus,label:this.label,levelPath:this._levelPath,onFormItemsReady:({detail:t})=>this.formItemsReady.emit(t),onSnkRequestClearFieldToFocus:this.clearFieldToFocusHandler.bind(this),fieldSearch:this._fieldSearch,entityPath:this.entityName},e("snk-taskbar",{key:"guideViewerTaskbar",class:"form-taskbar","data-element-id":"guideViewer",configName:this._configName,messagesBuilder:this.messagesBuilder,disabledButtons:this._disabledButtons,buttons:"INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,ACTIONS_BUTTON,DIVIDER,GRID_MODE,CONFIGURATOR",primaryButton:"INSERT",presentationMode:this.presentationMode,onActionClick:t=>this.executeActionHandler(t),dataUnit:this.dataUnit,resourceID:this.resourceID,customContainerId:this.taskbarCustomContainerId,customSlotId:"DETAIL_TASKBAR_CUSTOM_ELEMENTS",actionsSettingsList:this.getSettingsListForm()},e("slot",{name:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"}))))),e("snk-attach",{ref:t=>this._snkAttach=t,registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this.entityName})))}get _element(){return o(this)}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observerDataState"],customEditors:["observerPropsCustomEditor"],customRenders:["observeCustomRenders"]}}};w.REGEX_FORM_ID=/__FORM:[^:]+/g,w.style=".sc-snk-detail-view-h{display:flex;row-gap:24px;flex-direction:column;width:100%;height:100%}.level-path.sc-snk-detail-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.form-taskbar.sc-snk-detail-view{padding-bottom:var(--space--medium)}.grid-container.sc-snk-detail-view{background-color:#FFF;min-height:100px;height:100%}.detail-header.sc-snk-detail-view{padding-bottom:0}snk-data-unit.sc-snk-detail-view{flex:1}snk-grid.sc-snk-detail-view{height:calc(100% - 56px);--snk-grid__header-padding:var(--space--4, 4px);--snk-grid-padding:var(--space--8, 8px);--snk-grid-box-shadow:unset}";export{w as snk_detail_view}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var T,e;!function(T){T.EDIT="edit",T.REMOVE="remove",T.CREATE="create"}(T||(T={})),function(T){T.QUICK_FILTER="QUICK_FILTER",T.CUSTOM_FILTER="CUSTOM_FILTER",T.OTHER_FILTERS="OTHER_FILTERS",T.DEFAULT_FILTER="DEFAULT_FILTER"}(e||(e={}));const t=e;export{T as A,t as F}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as t}from"./p-
|
|
1
|
+
import{D as t}from"./p-5d02c032.js";import"./p-b1bf9564.js";import{SortMode as i,ApplicationContext as s,ObjectUtils as e,StringUtils as r,NumberUtils as n,DataType as o,UserInterface as l,DateUtils as a}from"@sankhyalabs/core";import{D as u}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import{UserInterface as d}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{P as c}from"./p-5c6eede7.js";import"./p-ff1990ad.js";import"./p-d88278f8.js";import"./p-9019a32f.js";import{g as h}from"./p-7dd49d15.js";import{I as f}from"./p-8f3f2306.js";import v from"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";class m{static assertDefaultSorting(t,s){t&&s&&(s.defaultSorting=t.columns.filter((t=>null!=t.ascending)).sort(((t,i)=>t.orderIndex-i.orderIndex)).map((({name:t,ascending:e})=>{const{dataType:r}=s.getField(t);return{field:t,dataType:r,mode:e?i.ASC:i.DESC}})))}static parseCrudResults(t,i){Array.isArray(t)||(t=[t]);const s=[];for(const e of t){let t={fields:new Map};for(let s in e){let r=e[s];if(r.hasOwnProperty("$")&&t.fields.set(s,r.$),i)break}s.push(t)}return s.length>1?s:s[0]}static find(i,e,r,n=!0,o,l){let a=[],u=[],d={},c=s.getContextValue("__SNK__APPLICATION__");if(e){if(!Array.isArray(e))throw new Error(c.messagesBuilder.getMessage("crudUtils.errorArray",null));e.forEach((t=>{a.push({name:t})}))}if(r)for(const t in r)r.hasOwnProperty(t)&&u.push({nome:t,valor:r[t]});o&&(d={expression:{$:o}});let h={requestBody:{entity:{name:i,criterio:u,fields:{field:a},literalCriteria:d,orderby:l}}};return new Promise((i=>{t.get().callServiceBroker("mge@crud.find",JSON.stringify(h)).then((t=>{var s;let e=null===(s=t.entidades)||void 0===s?void 0:s.entidade;e||i(null);const r=this.parseCrudResults(e,n);i(r)}))}))}}class p{setGrid(t){this._grid||(this._grid=t,this.refreshSelectedRows())}setDataState(t){this._dataState&&e.equals(null==t?void 0:t.metadataByRow,this._dataState.metadataByRow)||(this._dataState=t,this.refreshSelectedRows())}format(t,i,s){var e;if(r.isEmpty(t))return t;const o=null===(e=this._dataState)||void 0===e?void 0:e.metadataByRow.get(s),l=null==o?void 0:o.getProp("rm_precision",i.name);if(l||0===l)return n.format(t,l,l);if(null==i?void 0:i.props){const s=null==i?void 0:i.props.get("precision"),e=null==i?void 0:i.props.get("prettyPrecision");if(void 0!==s&&void 0!==e)return n.format(t,s,e)}return t}refreshSelectedRows(){var t;null===(t=this._grid)||void 0===t||t.refreshSelectedRows()}}class b{constructor(t,i){this.MAX_WIDTH_COD=60,this.MIN_WIDTH_COD=10,this.DEFAULT_FONT_SIZE=13,this.dataUnit=t,this.grid=i}async getColumnsMetadata(){var t;return this.columnsState=await(null===(t=this.grid)||void 0===t?void 0:t.getColumnsState())||[],await this.buildColumnsMetadata(this.columnsState)}getColumnsState(){return this.columnsState}async buildColumnsMetadata(t){var i;const s=[],e=this.collectSearchPlusDescriptionIds(t);for(const r of t){if(this.isHiddenColumn(r))continue;if(e.has(r.name))continue;const t=null===(i=this.dataUnit)||void 0===i?void 0:i.getField(r.name),n=await this.grid.getCustomValueFormatter(r.name),o=this.isSearchUserInterface(t),l=o?"Cód. ":r.label;let a={id:r.name,label:l,width:o?l.length*this.DEFAULT_FONT_SIZE:r.width,type:null==t?void 0:t.dataType,userInterface:null==t?void 0:t.userInterface,customFormatter:n},u=o?this.buildDescriptionColumn(t,r):void 0;if(u){const t=this.getWidthByMetaData(null==r?void 0:r.width,null==a?void 0:a.width,null==u?void 0:u.width);a=Object.assign(Object.assign({},a),{width:null==t?void 0:t.codWidth}),u=Object.assign(Object.assign({},u),{width:null==t?void 0:t.descWidth,label:(null==u?void 0:u.label)||(null==r?void 0:r.label)})}s.push(a),u&&s.push(u)}return s||[]}collectSearchPlusDescriptionIds(t){var i;const s=new Set;for(const e of t){if(this.isHiddenColumn(e))continue;const t=null===(i=this.dataUnit)||void 0===i?void 0:i.getField(e.name);if(!this.isSearchUserInterface(t))continue;const r=this.buildDescriptionColumnId(t);r&&s.add(r)}return s}isHiddenColumn(t){return t.hidden&&"RECDESP"!==t.name}isSearchUserInterface(t){return(null==t?void 0:t.userInterface)===d.SEARCH||(null==t?void 0:t.userInterface)===d.SEARCHPLUS}buildDescriptionColumnId(t){const i=null==t?void 0:t.properties;if(null==(null==i?void 0:i.DESCRIPTIONFIELD))return;const s=`${i.ENTITYNAME}.${i.DESCRIPTIONFIELD}`;return i.mergedFrom?`${i.mergedFrom}.${s}`:s}buildDescriptionColumn(t,i){var s;const e=this.buildDescriptionColumnId(t);if(!e)return;const r=null===(s=null==t?void 0:t.properties)||void 0===s?void 0:s.DESCRIPTIONENTITY;return{id:e,label:r,width:r?r.length*this.DEFAULT_FONT_SIZE-60:i.width,type:o.TEXT,userInterface:d.LONGTEXT,descriptionFrom:t.name}}getWidthByMetaData(t,i,s){const e=i+s,r=s/e;let n=Math.round(t*(i/e)),o=Math.round(t*r);return n>this.MAX_WIDTH_COD?(n=this.MAX_WIDTH_COD,o=t-this.MAX_WIDTH_COD):n<this.MIN_WIDTH_COD&&(n=this.MIN_WIDTH_COD,o=t-this.MIN_WIDTH_COD),{codWidth:n,descWidth:o}}}class y extends b{getSelectedNumber(){return this.dataUnit.getSelectionInfo().length}getTotalRecords(){var t,i,s;const{total:e}=(null===(t=this.dataUnit)||void 0===t?void 0:t.getPaginationInfo())||{};return null!=e?e:null===(s=null===(i=this.dataUnit)||void 0===i?void 0:i.records)||void 0===s?void 0:s.length}getSelectedIDs(){return h(this.dataUnit)}getRecordID(){var t,i,s;return null===(s=null===(i=null===(t=this.dataUnit)||void 0===t?void 0:t.records)||void 0===i?void 0:i[0])||void 0===s?void 0:s.__record__id__}async getRecords(t){if(0===this.dataUnit.records.length)return[];switch(t){case f.ALL:return this.dataUnit.getSelectionInfo().getAllRecords();case f.SELECTION:return this.resolveRecordsFromSelection();case f.PAGE:return this.dataUnit.records;default:return this.resolveRecordsFromSelection()}}resolveRecordsFromSelection(){const t=this.dataUnit.getSelectionInfo();if(t.isEmpty())return this.dataUnit.records;const i=t.isAllRecords()?t.getAllRecords():t.records;return i.length?i:this.dataUnit.records}getHiddenOptions(){return[u.EXPORT_BY_EMAIL,u.EXPORT_PDF_TO_EMAIL,u.EXPORT_XLS_TO_EMAIL,u.EXPORT_PAGE_TO_PDF,u.EXPORT_PAGE_TO_XLS]}formatValue(t,i){const{id:s,descriptionFrom:e}=i,r=t[e||s];if(null==r)return"";if(null!=e)return r.label;if(this.dataUnit.getField(s).userInterface===l.SEARCH)return r.value;if(i.customFormatter){const s=this.getColumnsState().find((t=>i.id===t.name));return i.customFormatter.format(r,s,t.__record__id__)}return this.dataUnit.getFormattedValue(s,r)}}class g{constructor(t){this._defaultButtons=t}process(t,i,s,e=[],r=[]){var n;this.customButtons=new Map,this.buttons="",this.disabledButtons=[].concat(e),null===(n=this.getButtonsArray(t,i,s))||void 0===n||n.forEach((n=>{let o;if("string"==typeof n)o=n;else{const t=n;this.customButtons.set(t.name,t),o=t.name}r.includes(o)||(this.isEnabled(t,i,o,s,e)||this.disabledButtons.push(o),this.buttons.length>0&&(this.buttons+=","),this.buttons+=o)}))}getButtonsArray(t,i,s){const e=this.getButtonsFromKey(t);return i?i.getButtons(t,s,[...e]):e}getButtonsFromKey(t){const i=this._defaultButtons[t];return"function"==typeof i?i():i}isEnabled(t,i,s,e,r){const n=!r.includes(s);return i&&i.isEnabled?i.isEnabled(t,e,s,n):n}}class S{setDataUnit(t){this._dataUnit=t}setApplication(t){this._application=t}formatLabel(t,i){const{userInterface:s}=this._dataUnit.getField(t);return s===l.DATETIME?a.formatDate(this._dataUnit.valueFromString(t,i)):String(this._dataUnit.getFormattedValue(t,i))}async getStaticOptions(t,i){return Promise.resolve(null==t?void 0:await c.getDistinct(this._dataUnit,t,null==i?void 0:i.onlyLabel))}fetchData(t,i){return new Promise((s=>{this._application.executeSelectDistinct(this._dataUnit,i,t).then((t=>{s(t.map((t=>this._dataUnit.getField(i).userInterface===l.SEARCH?Object.assign(Object.assign({},JSON.parse(t)),{check:!0}):{value:t,label:this.formatLabel(i,t),check:!0})))}))}))}sortItems(t,i){return v.defaultSorterMultSelectionOption(this._dataUnit,t,i)}}export{b as C,p as R,S,g as T,m as a,y as b}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ObjectUtils as t,StringUtils as i}from"@sankhyalabs/core";import{C as e}from"./p-
|
|
1
|
+
import{ObjectUtils as t,StringUtils as i}from"@sankhyalabs/core";import{C as e}from"./p-51e853f2.js";import{F as s}from"./p-d88278f8.js";import{a as r}from"./p-9019a32f.js";class n{constructor(t,i,e,s){this._resourceID=i,this._configName=t,this._onConfigChange=e,this._dataUnit=s}addFormLegacyConfig(t){this._configName&&e.addFormLegacyConfig(this._configName,t)}async loadConfig(){return new Promise((t=>{e.loadFormConfig(this._configName,this._resourceID).then((i=>{i=this.buildFormMetadataUITabs(i),this.setConfig(i),t(i)})).catch((t=>{console.warn(t)}))}))}getEmptyConfig(){return this.buildFormMetadataUITabs({fields:[],emptyConfig:!0},!0)}saveConfig(i){const s=t.copy(i);return new Promise((t=>{e.saveFormConfig(i,this._configName,this._resourceID).then((i=>{this.setConfig(Object.assign(Object.assign({},s),i)),t(Object.assign(Object.assign({},s),i))}))}))}saveCardState(t,i,s){return new Promise((r=>{var n;const l=(null===(n=this._config)||void 0===n?void 0:n.cardsState)||new Map,o=l.get(t);l.set(t,"fixed"===s?this.updateFixSequence(Object.assign(Object.assign({},o),{fixed:i.fixed}),l):Object.assign(Object.assign({},o),{[s]:i[s]})),e.saveCardState(l,this._configName,this._resourceID).then((t=>{this._config=Object.assign(Object.assign({},this._config),{cardsState:l}),r(t)}))}))}updateFixSequence(t,i){let e=-1;return Array.from(i.values()).forEach((i=>{i.fixed||delete t.fixSequence,null!=i.fixSequence&&(e=Math.max(e,i.fixSequence))})),t.fixed?t.fixSequence=e+1:delete t.fixSequence,t}hasConfig(t){var i;const e=null!=t?t:this._config;return!(!e||!(null===(i=e.fields)||void 0===i?void 0:i.length))}getFieldsList(t,i=!1){var e,s;const r=null===(e=this._config)||void 0===e?void 0:e.fields;return this.hasConfig()&&!i?r.map((({label:t,name:i,readOnly:e,visible:s,required:r,tab:n,group:l})=>{var o;if(null==t){const t=null===(o=this._dataUnit)||void 0===o?void 0:o.getField(i);if(!t)return;return Object.assign(Object.assign({},t),{name:null!=i?i:t.name,readOnly:null!=e?e:t.readOnly,visible:null!=s?s:t.visible,required:null!=r?r:t.required,tab:n,group:l})}return{name:i,label:t,readOnly:e,visible:s,required:r,tab:n,group:l}})).filter((i=>this.isFieldVisible(i,t))):this._dataUnit&&(null===(s=this._dataUnit.metadata)||void 0===s?void 0:s.fields)?this._dataUnit.metadata.fields.filter((i=>this.isFieldVisible(i,t))).map((({label:t,name:i,readOnly:e,visible:s,required:r,properties:n})=>({label:t,name:i,readOnly:e,visible:s,required:r,tab:null==n?void 0:n.UITabName}))):[]}isFieldVisible(t,e){if(void 0===t||!1===t.visible)return!1;if(null==e)return!0;const s=i.replaceAccentuatedCharsLower((t.label||t.name).toLocaleLowerCase()),r=i.replaceAccentuatedCharsLower(e.toLocaleLowerCase());return s.includes(r)}getFormConfig(t,i,e=!1){let s=this.getFieldsList(void 0,e);return i&&(s=s.filter((i=>{if(t){const e=t.getField(i.name);if(e&&e.readOnly)return!1}return!i.readOnly}))),Object.assign(Object.assign({},this._config),{fields:s})}setConfig(t){this.isLoaded=!0;const{cardsState:i,summary:e,defaultVars:s}=this._config||{};this._config=Object.assign({},t),i&&(this._config.cardsState=i),e&&(this._config.summary=e),s&&(this._config.defaultVars=s),this._onConfigChange&&this._onConfigChange(Object.assign({},this._config))}getConfig(t,i){return this.getFormConfig(t,i)}getFormConfigFetcher(){return null==this._formConfigFetcher&&(this._formConfigFetcher=new s),this._formConfigFetcher}async fetchUserAvailableConfigs(){return null!=this._configName?Promise.resolve(void 0):this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName,this._resourceID)}async fetchLegacyConfig(){return this.getFormConfigFetcher().fetchLegacyConfig(this._configName,this._resourceID)}async fetchDefaultConfig(){return this.getFormConfigFetcher().fetchDefaultConfig(this._configName,this._resourceID)}parseObjectList(t){return t?Array.isArray(t)?t:[t]:[]}buildFormMetadataUITabs(t,i=!1){var e,s,n;const l=this.hasConfig(t);if(!i&&(!this._dataUnit||l))return t;(t=this.getFormConfig(this._dataUnit,!1,!0)).tabs=this.parseObjectList(t.tabs),t.emptyConfig=!1,t.defaultConfiguration=!0;const o=null!==(s=null===(e=this._dataUnit.metadata)||void 0===e?void 0:e.fields)&&void 0!==s?s:[];for(const i of o){const e=t.fields.find((t=>t.name===i.name)),s=null===(n=i.properties)||void 0===n?void 0:n.UITabName;s&&s!==r.main&&(t.tabs.some((t=>t.label===s))||t.tabs.push({label:s,name:s,order:0,visible:!0}),e&&(e.tab=s))}return t}}export{n as S}
|