@sankhyalabs/sankhyablocks 10.1.0-dev.52 → 10.1.0-dev.53
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-0bc94d36.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-bcbc38c0.js} +2 -3
- 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-3b94547d.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-38748460.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/form-config-fetcher.js +22 -4
- 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-9e9166ae.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-3b1ca96e.js} +1 -2
- 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-dfde62cb.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-8501d09e.js +225 -0
- package/dist/sankhyablocks/p-0dbd53d9.js +1 -0
- package/dist/sankhyablocks/{p-f5ad0720.js → p-19d1ca14.js} +1 -1
- package/dist/sankhyablocks/{p-ab5e12fa.js → p-1cc4cf61.js} +1 -1
- package/dist/sankhyablocks/p-1edd6be6.entry.js +1 -0
- package/dist/sankhyablocks/p-22ddc1a5.entry.js +1 -0
- package/dist/sankhyablocks/p-24b059ee.entry.js +1 -0
- package/dist/sankhyablocks/{p-5c250661.js → p-2c00b93d.js} +1 -1
- package/dist/sankhyablocks/p-3623fddf.entry.js +1 -0
- package/dist/sankhyablocks/p-43c94ba5.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-58709cf9.js +1 -0
- package/dist/sankhyablocks/p-589016e2.entry.js +1 -0
- package/dist/sankhyablocks/p-5d02c032.js +1 -0
- package/dist/sankhyablocks/p-5d50f59a.entry.js +1 -0
- package/dist/sankhyablocks/p-61776b68.entry.js +1 -0
- package/dist/sankhyablocks/p-6b8a1ec3.js +1 -0
- package/dist/sankhyablocks/p-7038cf62.entry.js +1 -0
- package/dist/sankhyablocks/{p-b1bb4cf1.js → p-70c2ee5c.js} +1 -1
- package/dist/sankhyablocks/p-7628e04f.entry.js +1 -0
- package/dist/sankhyablocks/p-7798788b.entry.js +1 -0
- package/dist/sankhyablocks/p-77c26de0.js +1 -0
- package/dist/sankhyablocks/p-7c34a0f7.entry.js +1 -0
- package/dist/sankhyablocks/p-a4a0d9b7.entry.js +1 -0
- package/dist/sankhyablocks/{p-4f7adf97.js → p-b1bf9564.js} +1 -1
- package/dist/sankhyablocks/p-b4c2a99c.entry.js +1 -0
- package/dist/sankhyablocks/p-b75af274.entry.js +1 -0
- package/dist/sankhyablocks/p-c538bd6c.entry.js +1 -0
- package/dist/sankhyablocks/{p-3704bf1b.js → p-d5810110.js} +1 -1
- package/dist/sankhyablocks/p-d7fd447e.entry.js +1 -0
- package/dist/sankhyablocks/p-d88278f8.js +28 -0
- package/dist/sankhyablocks/p-f076d742.js +60 -0
- package/dist/sankhyablocks/{p-8fe740b7.entry.js → p-f1ef090f.entry.js} +2 -2
- 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 +1 -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,933 @@
|
|
|
1
|
+
import { r as registerInstance, i as forceUpdate, h, f as Host, g as getElement, e as createEvent } from './index-04f73a26.js';
|
|
2
|
+
import { Action, StringUtils, KeyboardManager, ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
|
+
import { S as SnkDynaformGuidesViewer, a as SnkFormConfigManager } from './snk-dynaform-guides-view-1f1455d6.js';
|
|
4
|
+
import { buildFormMetadata, FormMetadata, buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
|
5
|
+
import { S as SnkMessageBuilder } from './DataFetcher-5ed0a377.js';
|
|
6
|
+
import './ISave-5b46d691.js';
|
|
7
|
+
import { P as PresentationMode } from './index-b40568ff.js';
|
|
8
|
+
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
9
|
+
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
10
|
+
import './dataunit-fetcher-3b1ca96e.js';
|
|
11
|
+
import './filter-item-type.enum-d45e026f.js';
|
|
12
|
+
import { U as UserConfigType } from './form-config-fetcher-db1bf140.js';
|
|
13
|
+
import { V as VIEW_MODE, a as TAB_NAMES, G as GROUP_NAMES } from './constants-7b422de0.js';
|
|
14
|
+
import { T as TaskbarElement } from './taskbar-elements-63651ca7.js';
|
|
15
|
+
import { buildFieldSearch, SHORTCUT_SEARCH_FIELD, ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
16
|
+
import { S as SimpleTaskbarProcessor, D as DEFAULT_TASKBAR_BUTTONS, g as getTopTaskBarId } from './taskbarUtils-8501d09e.js';
|
|
17
|
+
import { b as buildGuides, a as buildChildrenGuides, c as buildCustomGuides, d as buildGuidesMap, g as getFieldsToSave, u as updateTabInFieldsFromGroupList, e as buildNewGuideName } from './FormConfigHelper-efc29480.js';
|
|
18
|
+
import './ConfigStorage-e834d1ea.js';
|
|
19
|
+
import './PrintUtils-3e4ff0f5.js';
|
|
20
|
+
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
|
21
|
+
import '@sankhyalabs/core/dist/utils/SortingUtils';
|
|
22
|
+
import './ResourceIDUtils-a114189a.js';
|
|
23
|
+
import './index-ea250be6.js';
|
|
24
|
+
|
|
25
|
+
const snkDynaformDetailViewCss = ".sc-snk-dynaform-detail-view-h{display:flex;row-gap:24px;flex-direction:column;width:100%;height:100%;overflow:hidden}.level-path.sc-snk-dynaform-detail-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.grid-container.sc-snk-dynaform-detail-view{min-height:100px;height:100%;width:100%;display:flex;flex-wrap:wrap;text-decoration:none;border-radius:var(--border--radius-medium);background-color:var(--color--gray-70, #FFFFFF);border:1px solid var(--color--petroleum-100, #C8CCD3)}.detail-header.sc-snk-dynaform-detail-view{padding-bottom:0}snk-data-unit.sc-snk-dynaform-detail-view{flex:1;gap:var(--space--12, 12px);display:flex;flex-direction:column}snk-grid.sc-snk-dynaform-detail-view{height:100%;--snk-grid-margin:0px;--snk-grid-box-shadow:none}.form-and-detail-container.sc-snk-dynaform-detail-view{display:flex;flex-direction:column;height:100%;width:100%;overflow:auto;padding:var(--space--12, 12px)}.ez-tabselector-internal.sc-snk-dynaform-detail-view{margin:var(--space--8, 8px) 0}.selected-record-header.sc-snk-dynaform-detail-view{display:flex;align-items:center;flex-wrap:wrap;gap:var(--space--8, 8px) var(--space--12, 12px);padding:var(--space--12, 12px) var(--space--16, 16px);margin-bottom:var(--space--12, 12px);background:var(--color--gray-80, #F9F9F9);border-radius:var(--border--radius-12, 12px);font-family:var(--font--pattern);border:1px solid var(--color--petroleum-100, #C8CCD3);border-left:4px solid var(--color--ocean-green-500, #00B07E)}.selected-record-header--message.sc-snk-dynaform-detail-view{border-left-color:var(--color--primary, #007EFF)}.selected-record-header__message.sc-snk-dynaform-detail-view{font-size:var(--font-size--default, 14px);font-weight:var(--font-weight--medium, 500);color:var(--color--title-primary, #2B3A54)}.selected-record-header__chip.sc-snk-dynaform-detail-view{display:inline-flex;flex-direction:row;align-items:center;gap:var(--space--4, 4px);min-width:0}.selected-record-header__label.sc-snk-dynaform-detail-view{font-size:var(--font-size--xs, 11px);font-weight:var(--font-weight--medium, 500);text-transform:uppercase;letter-spacing:0.04em;color:var(--color--text-secondary, #6E7A8A)}.selected-record-header__value.sc-snk-dynaform-detail-view{font-size:var(--font-size--md, 15px);font-weight:var(--font-weight--semibold, 600);color:var(--color--ocean-green-1000, #00281D);line-height:1.2;word-break:break-word}.selected-record-header__separator.sc-snk-dynaform-detail-view{display:inline-block;align-self:stretch;width:1px;background:var(--color--petroleum-100, #C8CCD3);margin:0 var(--space--4, 4px)}";
|
|
26
|
+
|
|
27
|
+
const SnkDynaformDetailView = class {
|
|
28
|
+
constructor(hostRef) {
|
|
29
|
+
registerInstance(this, hostRef);
|
|
30
|
+
this._taskbarProcessor = new SimpleTaskbarProcessor(DEFAULT_TASKBAR_BUTTONS);
|
|
31
|
+
this._currentView = 0;
|
|
32
|
+
this.attachmentRegisterKey = undefined;
|
|
33
|
+
this._fieldToGetFocus = undefined;
|
|
34
|
+
this._hasToCreateFieldSearch = true;
|
|
35
|
+
this._selectedSheet = undefined;
|
|
36
|
+
this._internalErrorTabs = new Set();
|
|
37
|
+
this._selectedRecordPKDisplay = undefined;
|
|
38
|
+
this.formConfigManager = undefined;
|
|
39
|
+
this.dataUnitName = undefined;
|
|
40
|
+
this.resourceID = undefined;
|
|
41
|
+
this.entityName = undefined;
|
|
42
|
+
this.label = undefined;
|
|
43
|
+
this.dataUnit = undefined;
|
|
44
|
+
this.selectedForm = undefined;
|
|
45
|
+
this.dataState = undefined;
|
|
46
|
+
this.messagesBuilder = undefined;
|
|
47
|
+
this.canEdit = true;
|
|
48
|
+
this.taskbarCustomContainerId = undefined;
|
|
49
|
+
this.customEditors = undefined;
|
|
50
|
+
this.customRenders = undefined;
|
|
51
|
+
this.presentationMode = PresentationMode.SECONDARY;
|
|
52
|
+
}
|
|
53
|
+
observeDataUnit(newDataUnit, oldDataUnit) {
|
|
54
|
+
newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
|
55
|
+
oldDataUnit === null || oldDataUnit === void 0 ? void 0 : oldDataUnit.unsubscribe(this.dataUnitActionHandler);
|
|
56
|
+
}
|
|
57
|
+
observerDataState(newValue, oldValue) {
|
|
58
|
+
const openInsertion = !(oldValue === null || oldValue === void 0 ? void 0 : oldValue.insertionMode) && (newValue === null || newValue === void 0 ? void 0 : newValue.insertionMode);
|
|
59
|
+
const closeInsertion = (oldValue === null || oldValue === void 0 ? void 0 : oldValue.insertionMode) && !(newValue === null || newValue === void 0 ? void 0 : newValue.insertionMode);
|
|
60
|
+
if (openInsertion || closeInsertion) {
|
|
61
|
+
this.loadMetadata();
|
|
62
|
+
}
|
|
63
|
+
if (this._formMetadata == undefined) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (!this.selectedSheetIsDetail()) {
|
|
67
|
+
if (openInsertion) {
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
this.changeViewMode(VIEW_MODE.FORM);
|
|
70
|
+
}, 0);
|
|
71
|
+
}
|
|
72
|
+
if (closeInsertion) {
|
|
73
|
+
this.changeViewMode(VIEW_MODE.GRID);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Muda o modo de visualização do componente entre VIEW_MODE.GRID e VIEW_MODE.FORM
|
|
79
|
+
* @param mode - Novo modo que o componente deve ser apresentado.
|
|
80
|
+
*/
|
|
81
|
+
async changeViewMode(mode) {
|
|
82
|
+
if (!this._viewStack) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this._viewStack.show(mode);
|
|
86
|
+
this._currentView = mode;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Abre o configurador de grid.
|
|
90
|
+
*/
|
|
91
|
+
async configGrid() {
|
|
92
|
+
if (this._snkGrid) {
|
|
93
|
+
this._snkGrid.showConfig();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async showUp() {
|
|
97
|
+
if (this._snkFormView) {
|
|
98
|
+
this._snkFormView.showUp();
|
|
99
|
+
}
|
|
100
|
+
if (this._snkGrid) {
|
|
101
|
+
this._snkGrid.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
106
|
+
*/
|
|
107
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
108
|
+
var _a, _b;
|
|
109
|
+
const detailContext = this.normalizeDataUnitName();
|
|
110
|
+
(_a = this._snkGrid) === null || _a === void 0 ? void 0 : _a.addCustomEditor(fieldName, customEditor, detailContext);
|
|
111
|
+
(_b = this._snkFormView) === null || _b === void 0 ? void 0 : _b.addCustomEditor(fieldName, customEditor, detailContext);
|
|
112
|
+
}
|
|
113
|
+
async observerPropsCustomEditor(newValue) {
|
|
114
|
+
for (const fieldName in newValue) {
|
|
115
|
+
await this.addCustomEditor(fieldName, newValue[fieldName]);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Registra um render customizado para colunas da grid.
|
|
120
|
+
*/
|
|
121
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
122
|
+
var _a;
|
|
123
|
+
const detailContext = this.normalizeDataUnitName();
|
|
124
|
+
await ((_a = this._snkGrid) === null || _a === void 0 ? void 0 : _a.addGridCustomRender(fieldName, customRender, detailContext));
|
|
125
|
+
}
|
|
126
|
+
onContentCardChanged(evt) {
|
|
127
|
+
SnkDynaformGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this.formConfigManager).then(() => forceUpdate(this));
|
|
128
|
+
evt.stopPropagation();
|
|
129
|
+
}
|
|
130
|
+
async observeCustomRenders(newValue) {
|
|
131
|
+
for (const field in newValue) {
|
|
132
|
+
const customRender = newValue[field];
|
|
133
|
+
await this.addGridCustomRender(field, customRender);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
loadMetadata() {
|
|
137
|
+
if (!this.dataUnit || !this.formConfigManager) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (!this.formConfigManager.isLoaded) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const formConfig = this.formConfigManager.getConfig(this.dataUnit);
|
|
144
|
+
this._formMetadata = buildFormMetadata(formConfig == undefined || formConfig.fields.length === 0 ? undefined : formConfig, this.dataUnit, true);
|
|
145
|
+
this.initSelectedSheet();
|
|
146
|
+
}
|
|
147
|
+
initSelectedSheet() {
|
|
148
|
+
if (!this._formMetadata) {
|
|
149
|
+
this._selectedSheet = undefined;
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const sheets = this._formMetadata.getAllSheets();
|
|
153
|
+
if (!sheets || sheets.size === 0) {
|
|
154
|
+
this._selectedSheet = undefined;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
// Mantém a aba atual caso ela ainda exista e não seja a área principal.
|
|
158
|
+
if (this._selectedSheet && this._selectedSheet.name !== SnkDynaformDetailView.MAIN_TAB) {
|
|
159
|
+
const current = sheets.get(this._selectedSheet.name);
|
|
160
|
+
if (current) {
|
|
161
|
+
this._selectedSheet = current;
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Caso contrário, seleciona o primeiro sheet que não seja a área principal (primeira aba).
|
|
166
|
+
this._selectedSheet = this.getFirstNonMainSheet(sheets);
|
|
167
|
+
}
|
|
168
|
+
getFirstNonMainSheet(sheets) {
|
|
169
|
+
for (const [name, sheet] of sheets) {
|
|
170
|
+
if (name !== SnkDynaformDetailView.MAIN_TAB) {
|
|
171
|
+
return sheet;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
dataUnitReadyHandler(evt) {
|
|
177
|
+
this.dataUnit = evt.detail;
|
|
178
|
+
this.loadMetadata();
|
|
179
|
+
}
|
|
180
|
+
getFormFields() {
|
|
181
|
+
var _a, _b, _c;
|
|
182
|
+
const mainSheet = (_b = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getAllSheets()) === null || _b === void 0 ? void 0 : _b.get(SnkDynaformDetailView.MAIN_TAB);
|
|
183
|
+
return (_c = mainSheet === null || mainSheet === void 0 ? void 0 : mainSheet.fields) !== null && _c !== void 0 ? _c : [];
|
|
184
|
+
}
|
|
185
|
+
hasNonMainSheets() {
|
|
186
|
+
if (!this._formMetadata) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
for (const name of this._formMetadata.getAllSheets().keys()) {
|
|
190
|
+
if (name !== SnkDynaformDetailView.MAIN_TAB) {
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
selectedSheetIsDetail() {
|
|
197
|
+
return !!this._selectedSheet && FormMetadata.getDetailName(this._selectedSheet.name) != undefined;
|
|
198
|
+
}
|
|
199
|
+
isSheetDisabled(sheet) {
|
|
200
|
+
var _a;
|
|
201
|
+
if (FormMetadata.getDetailName(sheet.name) == undefined) {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
const currentRecord = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecord();
|
|
205
|
+
if (!currentRecord || !this.dataUnit) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
return this.dataUnit.isNewRecord(currentRecord.__record__id__) || this.dataUnit.isMultipleEdition;
|
|
209
|
+
}
|
|
210
|
+
buildInternalTabItems() {
|
|
211
|
+
if (!this._formMetadata) {
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
214
|
+
const sheets = Array.from(this._formMetadata.getAllSheets().values());
|
|
215
|
+
const nonMainSheets = sheets.filter((sheet) => sheet.name !== SnkDynaformDetailView.MAIN_TAB);
|
|
216
|
+
return nonMainSheets.map((sheet, index) => ({
|
|
217
|
+
tabKey: sheet.name,
|
|
218
|
+
label: sheet.label,
|
|
219
|
+
index,
|
|
220
|
+
disabled: this.isSheetDisabled(sheet),
|
|
221
|
+
rightIcon: this._internalErrorTabs.has(sheet.name) ? 'alert-circle-inverted' : undefined,
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
onInternalTabChange(tab) {
|
|
225
|
+
var _a, _b;
|
|
226
|
+
// A área principal (__main) é sempre visível e não é uma aba selecionável.
|
|
227
|
+
if (tab.tabKey === SnkDynaformDetailView.MAIN_TAB) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const matchedSheet = (_b = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getAllSheets()) === null || _b === void 0 ? void 0 : _b.get(tab.tabKey);
|
|
231
|
+
if (!matchedSheet || this.isSheetDisabled(matchedSheet)) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
this._selectedSheet = matchedSheet;
|
|
235
|
+
}
|
|
236
|
+
executeActionHandler(evt) {
|
|
237
|
+
var _a;
|
|
238
|
+
if (evt.detail === TaskbarElement.GRID_MODE) {
|
|
239
|
+
this.changeViewMode(VIEW_MODE.GRID);
|
|
240
|
+
evt.stopPropagation();
|
|
241
|
+
}
|
|
242
|
+
if (evt.detail === TaskbarElement.UPDATE_MULTIPLE && this.dataUnit) {
|
|
243
|
+
this.dataUnit.isMultipleEdition = true;
|
|
244
|
+
this.changeViewMode(VIEW_MODE.FORM);
|
|
245
|
+
evt.stopPropagation();
|
|
246
|
+
}
|
|
247
|
+
if (evt.detail === TaskbarElement.FORM_MODE || evt.detail === TaskbarElement.UPDATE || evt.detail === TaskbarElement.INSERT) {
|
|
248
|
+
this.changeViewMode(VIEW_MODE.FORM);
|
|
249
|
+
evt.stopPropagation();
|
|
250
|
+
}
|
|
251
|
+
if (evt.detail === TaskbarElement.ATTACH) {
|
|
252
|
+
(_a = this._snkAttach) === null || _a === void 0 ? void 0 : _a.open();
|
|
253
|
+
evt.stopPropagation();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
async getAttachmentRegisterKey() {
|
|
257
|
+
if (!this._snkDataUnit) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const recordCriteria = await this._snkDataUnit.getSelectedRecordsIDsInfo();
|
|
261
|
+
const joinedPrimaryKeys = recordCriteria.map(({ value }) => value).join('_');
|
|
262
|
+
return joinedPrimaryKeys;
|
|
263
|
+
}
|
|
264
|
+
async handleDataStateChange({ detail: dataState }) {
|
|
265
|
+
var _a;
|
|
266
|
+
this.dataState = dataState;
|
|
267
|
+
if (dataState.selectedRecord !== undefined && this._snkDataUnit) {
|
|
268
|
+
this.attachmentRegisterKey = (_a = await this.getAttachmentRegisterKey()) !== null && _a !== void 0 ? _a : undefined;
|
|
269
|
+
}
|
|
270
|
+
this._selectedRecordPKDisplay = this.buildSelectedRecordPKDisplay();
|
|
271
|
+
}
|
|
272
|
+
buildSelectedRecordPKDisplay() {
|
|
273
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
274
|
+
if (!this.dataUnit) {
|
|
275
|
+
return undefined;
|
|
276
|
+
}
|
|
277
|
+
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.insertionMode) {
|
|
278
|
+
const message = (_b = this.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage("snkCrud.newRecord");
|
|
279
|
+
return message ? { message } : undefined;
|
|
280
|
+
}
|
|
281
|
+
const selectedRecord = this.dataUnit.getSelectedRecord();
|
|
282
|
+
if (!selectedRecord) {
|
|
283
|
+
return undefined;
|
|
284
|
+
}
|
|
285
|
+
const items = [];
|
|
286
|
+
const fields = (_d = (_c = this.dataUnit.metadata) === null || _c === void 0 ? void 0 : _c.fields) !== null && _d !== void 0 ? _d : [];
|
|
287
|
+
for (const field of fields) {
|
|
288
|
+
if (((_e = field.properties) === null || _e === void 0 ? void 0 : _e.isPrimaryKey) !== "true") {
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
const rawValue = selectedRecord[field.name];
|
|
292
|
+
const value = (_f = rawValue === null || rawValue === void 0 ? void 0 : rawValue.value) !== null && _f !== void 0 ? _f : rawValue;
|
|
293
|
+
if (value === undefined || value === null || value === "") {
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
items.push({ label: (_g = field.label) !== null && _g !== void 0 ? _g : field.name, value: String(value) });
|
|
297
|
+
}
|
|
298
|
+
return items.length ? { items } : undefined;
|
|
299
|
+
}
|
|
300
|
+
renderSelectedRecordHeader() {
|
|
301
|
+
var _a;
|
|
302
|
+
if (!this.label && !this._selectedRecordPKDisplay) {
|
|
303
|
+
return undefined;
|
|
304
|
+
}
|
|
305
|
+
const display = this._selectedRecordPKDisplay;
|
|
306
|
+
if (!display) {
|
|
307
|
+
return undefined;
|
|
308
|
+
}
|
|
309
|
+
if (display.message) {
|
|
310
|
+
return (h("div", { class: "selected-record-header selected-record-header--message" }, h("span", { class: "selected-record-header__message" }, display.message)));
|
|
311
|
+
}
|
|
312
|
+
if (!((_a = display.items) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
313
|
+
return undefined;
|
|
314
|
+
}
|
|
315
|
+
return (h("div", { class: "selected-record-header", role: "group" }, display.items.map((item, index) => [
|
|
316
|
+
index > 0 && h("span", { class: "selected-record-header__separator", "aria-hidden": "true" }),
|
|
317
|
+
h("div", { class: "selected-record-header__chip" }, h("span", { class: "selected-record-header__label" }, item.label, ":"), h("span", { class: "selected-record-header__value" }, item.value))
|
|
318
|
+
])));
|
|
319
|
+
}
|
|
320
|
+
componentWillLoad() {
|
|
321
|
+
var _a;
|
|
322
|
+
this._configName = `dynaform.${this.entityName}`;
|
|
323
|
+
this.formConfigManager = new SnkFormConfigManager(this._configName, (_a = this.resourceID) !== null && _a !== void 0 ? _a : '', () => this.loadMetadata(), this.dataUnit);
|
|
324
|
+
this.formConfigManager.loadConfig();
|
|
325
|
+
if (this.messagesBuilder == undefined) {
|
|
326
|
+
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
componentWillRender() {
|
|
330
|
+
this.initializeTaskbarProcessor();
|
|
331
|
+
}
|
|
332
|
+
initializeTaskbarProcessor() {
|
|
333
|
+
if (!this.dataState) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const detailTaskbarManager = this.buildDetailTaskbarManager();
|
|
337
|
+
const topTaskbarId = getTopTaskBarId(this.dataState, this.presentationMode);
|
|
338
|
+
this._taskbarProcessor.process(topTaskbarId, detailTaskbarManager, this.dataState, [], []);
|
|
339
|
+
}
|
|
340
|
+
buildDetailTaskbarManager() {
|
|
341
|
+
const EDITION_MODE_BUTTONS = [
|
|
342
|
+
TaskbarElement.CANCEL,
|
|
343
|
+
TaskbarElement.SAVE,
|
|
344
|
+
];
|
|
345
|
+
const currentView = this._currentView;
|
|
346
|
+
return {
|
|
347
|
+
getButtons: (taskbarID, dataState, defaultButtons) => {
|
|
348
|
+
var _a, _b, _c;
|
|
349
|
+
if (!taskbarID) {
|
|
350
|
+
return [];
|
|
351
|
+
}
|
|
352
|
+
const isInEditionMode = (dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty);
|
|
353
|
+
if (isInEditionMode) {
|
|
354
|
+
return EDITION_MODE_BUTTONS;
|
|
355
|
+
}
|
|
356
|
+
let buttons = [...defaultButtons];
|
|
357
|
+
if (currentView === VIEW_MODE.FORM) {
|
|
358
|
+
const indexFormMode = buttons.indexOf(TaskbarElement.FORM_MODE);
|
|
359
|
+
if (indexFormMode > -1) {
|
|
360
|
+
buttons = [
|
|
361
|
+
...buttons.slice(0, indexFormMode),
|
|
362
|
+
TaskbarElement.GRID_MODE,
|
|
363
|
+
...buttons.slice(indexFormMode + 1),
|
|
364
|
+
];
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
if (((_c = (_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) !== null && _c !== void 0 ? _c : 0) > 1) {
|
|
368
|
+
const indexUpdate = buttons.indexOf(TaskbarElement.UPDATE);
|
|
369
|
+
if (indexUpdate > -1) {
|
|
370
|
+
buttons = [
|
|
371
|
+
...buttons.slice(0, indexUpdate),
|
|
372
|
+
TaskbarElement.UPDATE_MULTIPLE,
|
|
373
|
+
...buttons.slice(indexUpdate + 1),
|
|
374
|
+
];
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return buttons;
|
|
378
|
+
},
|
|
379
|
+
isEnabled: (_, dataState, buttonName, originalValue) => {
|
|
380
|
+
if (!dataState) {
|
|
381
|
+
return originalValue;
|
|
382
|
+
}
|
|
383
|
+
const hasSelectedRecord = dataState.selectedRecord !== undefined;
|
|
384
|
+
const buttonsRequiringSelection = [
|
|
385
|
+
TaskbarElement.UPDATE,
|
|
386
|
+
TaskbarElement.REMOVE,
|
|
387
|
+
TaskbarElement.ATTACH,
|
|
388
|
+
TaskbarElement.CLONE,
|
|
389
|
+
];
|
|
390
|
+
if (!hasSelectedRecord && buttonsRequiringSelection.includes(buttonName)) {
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
if (buttonName === TaskbarElement.PREVIOUS && !dataState.hasPrevious) {
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
if (buttonName === TaskbarElement.NEXT && !dataState.hasNext) {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
if (buttonName === TaskbarElement.INSERT && dataState.insertionMode) {
|
|
400
|
+
return false;
|
|
401
|
+
}
|
|
402
|
+
return originalValue;
|
|
403
|
+
},
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
async componentDidLoad() {
|
|
407
|
+
if (this.customEditors) {
|
|
408
|
+
await this.observerPropsCustomEditor(this.customEditors);
|
|
409
|
+
}
|
|
410
|
+
if (this.customRenders) {
|
|
411
|
+
await this.observeCustomRenders(this.customRenders);
|
|
412
|
+
}
|
|
413
|
+
this.initKeyboardManager();
|
|
414
|
+
}
|
|
415
|
+
disconnectedCallback() {
|
|
416
|
+
var _a;
|
|
417
|
+
(_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
|
|
418
|
+
}
|
|
419
|
+
async dataUnitActionHandler(action) {
|
|
420
|
+
var _a;
|
|
421
|
+
if (action.type === Action.FIELD_INVALIDATED) {
|
|
422
|
+
const sheetName = this.findSheetOfField((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fieldName);
|
|
423
|
+
if (sheetName) {
|
|
424
|
+
this._internalErrorTabs = new Set([...this._internalErrorTabs, sheetName]);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
findSheetOfField(fieldName) {
|
|
429
|
+
var _a;
|
|
430
|
+
if (!fieldName || !this._formMetadata) {
|
|
431
|
+
return undefined;
|
|
432
|
+
}
|
|
433
|
+
const sheets = this._formMetadata.getAllSheets();
|
|
434
|
+
for (const [sheetName, sheet] of sheets) {
|
|
435
|
+
if ((_a = sheet.fields) === null || _a === void 0 ? void 0 : _a.some((f) => f.name === fieldName)) {
|
|
436
|
+
return sheetName;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return undefined;
|
|
440
|
+
}
|
|
441
|
+
normalizeDataUnitName() {
|
|
442
|
+
var _a, _b;
|
|
443
|
+
return (_b = (_a = this.dataUnitName) === null || _a === void 0 ? void 0 : _a.replace(/\//g, '>')) !== null && _b !== void 0 ? _b : '';
|
|
444
|
+
}
|
|
445
|
+
getSettingsListForm() {
|
|
446
|
+
var _a, _b;
|
|
447
|
+
const hardList = [{
|
|
448
|
+
value: StringUtils.generateUUID(),
|
|
449
|
+
label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkCrud.findColumn", undefined)) !== null && _b !== void 0 ? _b : "",
|
|
450
|
+
disableCloseOnSelect: true,
|
|
451
|
+
eagerInitialize: true,
|
|
452
|
+
itemBuilder: (_, item) => this.getFieldsSearch(item)
|
|
453
|
+
}];
|
|
454
|
+
return hardList;
|
|
455
|
+
}
|
|
456
|
+
getFieldsSearch(item) {
|
|
457
|
+
var _a;
|
|
458
|
+
if (this._fieldSearch === undefined || this._hasToCreateFieldSearch) {
|
|
459
|
+
this._hasToCreateFieldSearch = false;
|
|
460
|
+
this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option));
|
|
461
|
+
}
|
|
462
|
+
return (_a = this._fieldSearch) !== null && _a !== void 0 ? _a : document.createElement('div');
|
|
463
|
+
}
|
|
464
|
+
fieldsOptionLoader(argument) {
|
|
465
|
+
const searchTerm = argument === null || argument === void 0 ? void 0 : argument.toLowerCase();
|
|
466
|
+
const allFields = this.getFormFields().map(field => { var _a; return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field.name); });
|
|
467
|
+
const filteredFields = allFields.filter(field => {
|
|
468
|
+
var _a, _b;
|
|
469
|
+
if (!field) {
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
return ((_a = field.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) ||
|
|
473
|
+
((_b = field.label) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTerm));
|
|
474
|
+
});
|
|
475
|
+
const options = filteredFields.map((field) => {
|
|
476
|
+
if (!field) {
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
return ({ value: field.name, label: field.label });
|
|
480
|
+
});
|
|
481
|
+
return Promise.resolve(options);
|
|
482
|
+
}
|
|
483
|
+
onSelectField(option) {
|
|
484
|
+
if (option == undefined) {
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
this._fieldToGetFocus = option.value;
|
|
488
|
+
}
|
|
489
|
+
clearFieldToFocusHandler() {
|
|
490
|
+
this._fieldToGetFocus = undefined;
|
|
491
|
+
}
|
|
492
|
+
getColumnSearch(item) {
|
|
493
|
+
var _a;
|
|
494
|
+
if (this._columnSearch !== undefined) {
|
|
495
|
+
return this._columnSearch;
|
|
496
|
+
}
|
|
497
|
+
this._columnSearch = buildFieldSearch(item, ({ argument }) => new Promise(accept => {
|
|
498
|
+
var _a;
|
|
499
|
+
(_a = this._snkGrid) === null || _a === void 0 ? void 0 : _a.filterColumns(argument).then((columns) => {
|
|
500
|
+
accept(columns
|
|
501
|
+
.filter(column => !column.hidden)
|
|
502
|
+
.map(column => ({ label: column.label, value: column.name })));
|
|
503
|
+
});
|
|
504
|
+
}), (option) => {
|
|
505
|
+
var _a;
|
|
506
|
+
if (option != undefined) {
|
|
507
|
+
(_a = this._snkGrid) === null || _a === void 0 ? void 0 : _a.locateColumn(option.value);
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
return (_a = this._columnSearch) !== null && _a !== void 0 ? _a : document.createElement('div');
|
|
511
|
+
}
|
|
512
|
+
buildTaskbarCustomActionsList() {
|
|
513
|
+
return [this.buildSearchColumnTaskbarAction()];
|
|
514
|
+
}
|
|
515
|
+
buildSearchColumnTaskbarAction() {
|
|
516
|
+
var _a, _b;
|
|
517
|
+
return {
|
|
518
|
+
value: StringUtils.generateUUID(),
|
|
519
|
+
label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage('snkGrid.findColumn', {})) !== null && _b !== void 0 ? _b : "",
|
|
520
|
+
disableCloseOnSelect: true,
|
|
521
|
+
eagerInitialize: true,
|
|
522
|
+
itemBuilder: (_, item) => { var _a; return (_a = this.getColumnSearch(item)) !== null && _a !== void 0 ? _a : document.createElement('div'); },
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
async initKeyboardManager() {
|
|
526
|
+
var _a;
|
|
527
|
+
this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
|
|
528
|
+
this._keyboardManager.bind(SHORTCUT_SEARCH_FIELD, async () => {
|
|
529
|
+
var _a;
|
|
530
|
+
await ((_a = this._snkFormView) === null || _a === void 0 ? void 0 : _a.showSearchField());
|
|
531
|
+
}, { description: (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findFields"), element: this._element });
|
|
532
|
+
}
|
|
533
|
+
renderTabSelector() {
|
|
534
|
+
if (!this.hasNonMainSheets()) {
|
|
535
|
+
return undefined;
|
|
536
|
+
}
|
|
537
|
+
const selectedKey = this._selectedSheet && this._selectedSheet.name !== SnkDynaformDetailView.MAIN_TAB
|
|
538
|
+
? this._selectedSheet.name
|
|
539
|
+
: undefined;
|
|
540
|
+
return (h("ez-tabselector", { class: "ez-tabselector-internal", tabs: this.buildInternalTabItems(), selectedTab: selectedKey, onEzChange: (evt) => this.onInternalTabChange(evt.detail) }));
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Renderiza o conteúdo da aba selecionada, seguindo as mesmas regras do
|
|
544
|
+
* formulário master (snk-dynaform-guides-view.getContent):
|
|
545
|
+
* - Sheet de detalhe (child[...]) → snk-dynaform-detail-view aninhado.
|
|
546
|
+
* - Sheet de formulário (ex.: "Geral") → snk-dynaform-form-view com os campos do sheet.
|
|
547
|
+
*/
|
|
548
|
+
renderSelectedSheetContent() {
|
|
549
|
+
if (!this._selectedSheet || this._selectedSheet.name === SnkDynaformDetailView.MAIN_TAB) {
|
|
550
|
+
return undefined;
|
|
551
|
+
}
|
|
552
|
+
const childEntityName = FormMetadata.getDetailName(this._selectedSheet.name);
|
|
553
|
+
if (childEntityName) {
|
|
554
|
+
return (h("snk-dynaform-detail-view", { key: `sub_${this.dataUnitName}_${this._selectedSheet.name}`, dataUnitName: `${this.dataUnitName}/${childEntityName}`, entityName: childEntityName, label: this._selectedSheet.label, resourceID: this.resourceID, canEdit: this.canEdit, messagesBuilder: this.messagesBuilder, customEditors: this.customEditors, customRenders: this.customRenders, presentationMode: this.presentationMode, taskbarCustomContainerId: this.taskbarCustomContainerId }));
|
|
555
|
+
}
|
|
556
|
+
return (h("snk-dynaform-form-view", { key: `sheet_${this._selectedSheet.name}`, name: this._selectedSheet.name, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this._selectedSheet.fields, fieldToFocus: this._fieldToGetFocus, label: this._selectedSheet.label, onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch }));
|
|
557
|
+
}
|
|
558
|
+
renderViewStack() {
|
|
559
|
+
var _a, _b;
|
|
560
|
+
return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, h("stack-item", { class: "ez-size-width--full ez-size-height--full" }, h("snk-grid", { class: "ez-size-width--full ez-size-height--full", ref: (ref) => {
|
|
561
|
+
if (ref)
|
|
562
|
+
this._snkGrid = ref;
|
|
563
|
+
}, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.changeViewMode(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: true, enableGridInsert: true, autoLoad: true, multipleEditionEnabled: true, multipleSelection: true, hideHeader: true, hideGridTaskbar: true })), h("stack-item", { class: "ez-size-width--full ez-size-height--full grid-container" }, h("div", { class: "form-and-detail-container" }, h("snk-dynaform-form-view", { ref: (ref) => {
|
|
564
|
+
if (ref)
|
|
565
|
+
this._snkFormView = ref;
|
|
566
|
+
}, name: SnkDynaformDetailView.MAIN_TAB, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch }, this.renderSelectedRecordHeader()), this.renderTabSelector(), this.renderSelectedSheetContent())), h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: (_a = this.attachmentRegisterKey) !== null && _a !== void 0 ? _a : '', messagesBuilder: this.messagesBuilder, entityName: (_b = this.entityName) !== null && _b !== void 0 ? _b : '' })));
|
|
567
|
+
}
|
|
568
|
+
render() {
|
|
569
|
+
return (h(Host, null, h("snk-data-unit", { ref: (el) => {
|
|
570
|
+
if (el)
|
|
571
|
+
this._snkDataUnit = el;
|
|
572
|
+
}, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("snk-taskbar", { key: "detailViewTaskbar", class: "form-taskbar", "data-element-id": "detail_top", configName: this._configName, messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, primaryButton: "INSERT", overflowStrategy: "hiddenItems", alignRigth: true, sizeButtons: 'small', presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm(), customActionsList: this.buildTaskbarCustomActionsList() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" })), this.renderViewStack())));
|
|
573
|
+
}
|
|
574
|
+
get _element() { return getElement(this); }
|
|
575
|
+
static get watchers() { return {
|
|
576
|
+
"dataUnit": ["observeDataUnit"],
|
|
577
|
+
"dataState": ["observerDataState"],
|
|
578
|
+
"customEditors": ["observerPropsCustomEditor"],
|
|
579
|
+
"customRenders": ["observeCustomRenders"]
|
|
580
|
+
}; }
|
|
581
|
+
};
|
|
582
|
+
SnkDynaformDetailView.MAIN_TAB = "__main";
|
|
583
|
+
SnkDynaformDetailView.style = snkDynaformDetailViewCss;
|
|
584
|
+
|
|
585
|
+
const snkDynaformFormConfigCss = ".sc-snk-dynaform-form-config-h{display:flex;flex-direction:column;height:100vh;width:100%;font-family:var(--font-pattern, \"Roboto\");background:white;color:#2b3a54;--snk-form-config-container-height:calc(100vh - 95px);outline:none}.form-config-body.sc-snk-dynaform-form-config{height:var(--snk-form-config-container-height);overflow:hidden;padding-top:var(--space--12, 12px)}.form-config-layout.sc-snk-dynaform-form-config{display:flex;flex-direction:row;height:100%;gap:20px;align-items:stretch}.main-editing-area.sc-snk-dynaform-form-config{display:flex;flex-direction:column;flex:1;min-width:0;height:100%;overflow:hidden;gap:12px}.main-editing-area.sc-snk-dynaform-form-config>snk-dynaform-fields-layout.sc-snk-dynaform-form-config{flex:1 1 auto;min-height:0;overflow:auto;flex-direction:row}.main-editing-area.sc-snk-dynaform-form-config>snk-dynaform-guides-configurator.sc-snk-dynaform-form-config{flex:0 0 auto}.main-fields-section.sc-snk-dynaform-form-config{flex:0 0 40vh;display:flex;flex-direction:column;min-height:0;overflow:hidden}.guide-header.sc-snk-dynaform-form-config{display:flex;width:100%;padding-bottom:12px;border-bottom:1px solid #dce0e8;height:30px;font-weight:500;font-size:16px}";
|
|
586
|
+
|
|
587
|
+
const SnkDynaformFormConfig = class {
|
|
588
|
+
constructor(hostRef) {
|
|
589
|
+
registerInstance(this, hostRef);
|
|
590
|
+
this.configClose = createEvent(this, "configClose", 7);
|
|
591
|
+
this.configChange = createEvent(this, "configChange", 7);
|
|
592
|
+
this.guidesMap = new Map();
|
|
593
|
+
this.availableFields = [];
|
|
594
|
+
this.guidesList = [];
|
|
595
|
+
this.groupsList = [];
|
|
596
|
+
this.mainGuide = undefined;
|
|
597
|
+
this.mainGroupsList = [];
|
|
598
|
+
this.selectedGuide = undefined;
|
|
599
|
+
this._formConfig = {};
|
|
600
|
+
this.configOptions = [];
|
|
601
|
+
this.originalConfigSelected = undefined;
|
|
602
|
+
this.configSelected = undefined;
|
|
603
|
+
this.hasChanges = false;
|
|
604
|
+
this.optionConfigChanged = false;
|
|
605
|
+
this.dataUnit = undefined;
|
|
606
|
+
this.configManager = undefined;
|
|
607
|
+
this.ignoreReadOnlyFormFields = undefined;
|
|
608
|
+
this.messagesBuilder = undefined;
|
|
609
|
+
this.customGuidesConfig = [];
|
|
610
|
+
}
|
|
611
|
+
handleFieldConfigChanged() {
|
|
612
|
+
this.hasChanges = true;
|
|
613
|
+
}
|
|
614
|
+
async handleFormConfigOptionSelected({ detail }) {
|
|
615
|
+
this.configSelected = detail;
|
|
616
|
+
this.selectedGuide = undefined;
|
|
617
|
+
await this.loadConfigByUser();
|
|
618
|
+
this.optionConfigChanged = !ObjectUtils.equals(this.configSelected, this.originalConfigSelected);
|
|
619
|
+
if (this.configSelected.origin === UserConfigType.DEFAULT) {
|
|
620
|
+
this.hasChanges = false;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
async handleAddFieldToGuide({ detail: fieldItem }) {
|
|
624
|
+
var _a, _b;
|
|
625
|
+
const hasValidSecondaryGuide = this.selectedGuide
|
|
626
|
+
&& !this.selectedGuide.isCustom
|
|
627
|
+
&& !this.selectedGuide.isDetail;
|
|
628
|
+
if (!hasValidSecondaryGuide && this.selectedGuide && (this.selectedGuide.isCustom || this.selectedGuide.isDetail)) {
|
|
629
|
+
this.showCanNotAddFieldToGuideDialog();
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
if (!hasValidSecondaryGuide && !this.mainGuide) {
|
|
633
|
+
this.showNoGuideSelectedDialog();
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
this.availableFields = [...this.availableFields.filter(f => f.name !== fieldItem.name)];
|
|
637
|
+
if (hasValidSecondaryGuide) {
|
|
638
|
+
await ((_a = this.refFieldsLayout) === null || _a === void 0 ? void 0 : _a.addFieldToLayout(fieldItem));
|
|
639
|
+
}
|
|
640
|
+
else {
|
|
641
|
+
await ((_b = this.refMainFieldsLayout) === null || _b === void 0 ? void 0 : _b.addFieldToLayout(fieldItem));
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
async handleSetFieldAsAvailable({ detail }) {
|
|
645
|
+
const hasField = this.availableFields.some(f => f.name === detail.name);
|
|
646
|
+
if (hasField)
|
|
647
|
+
return;
|
|
648
|
+
this.availableFields = [...this.availableFields, detail];
|
|
649
|
+
}
|
|
650
|
+
async handleRemoveFieldFromAvailable({ detail }) {
|
|
651
|
+
this.availableFields = this.availableFields.filter(f => f.name !== detail.name);
|
|
652
|
+
}
|
|
653
|
+
observeSelectedGuide(guide) {
|
|
654
|
+
var _a, _b;
|
|
655
|
+
if ((guide === null || guide === void 0 ? void 0 : guide.name) && ((_a = this.mainGuide) === null || _a === void 0 ? void 0 : _a.name) && guide.name === this.mainGuide.name) {
|
|
656
|
+
this.selectedGuide = undefined;
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
const guideGroups = (_b = this.guidesMap.get(guide === null || guide === void 0 ? void 0 : guide.name)) !== null && _b !== void 0 ? _b : [];
|
|
660
|
+
this.groupsList = [...guideGroups];
|
|
661
|
+
}
|
|
662
|
+
observeConfigManager() {
|
|
663
|
+
this.loadFormConfig();
|
|
664
|
+
}
|
|
665
|
+
showNoGuideSelectedDialog() {
|
|
666
|
+
const title = this.getMessage('snkFormConfig.noGuideSelected.title');
|
|
667
|
+
const message = this.getMessage('snkFormConfig.noGuideSelected.message');
|
|
668
|
+
ApplicationUtils.alert(title, message);
|
|
669
|
+
}
|
|
670
|
+
showCanNotAddFieldToGuideDialog() {
|
|
671
|
+
const title = this.getMessage('snkFormConfig.canNotAddFieldToGuide.title');
|
|
672
|
+
const message = this.getMessage('snkFormConfig.canNotAddFieldToGuide.message');
|
|
673
|
+
ApplicationUtils.alert(title, message);
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
677
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
678
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
679
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-form.msg.ts"
|
|
680
|
+
*/
|
|
681
|
+
getMessage(key, params) {
|
|
682
|
+
return this.messagesBuilder.getMessage(key, params);
|
|
683
|
+
}
|
|
684
|
+
async initializeUserConfig() {
|
|
685
|
+
if (this.configManager == undefined)
|
|
686
|
+
return;
|
|
687
|
+
try {
|
|
688
|
+
const userConfig = await this.configManager.fetchUserAvailableConfigs();
|
|
689
|
+
this.configOptions = userConfig;
|
|
690
|
+
const isDefault = this._formConfig != undefined ? this._formConfig.defaultConfiguration : true;
|
|
691
|
+
const origin = (isDefault ? UserConfigType.DEFAULT : UserConfigType.USER);
|
|
692
|
+
this.configSelected = userConfig === null || userConfig === void 0 ? void 0 : userConfig.find((config) => config.origin === origin);
|
|
693
|
+
this.originalConfigSelected = userConfig === null || userConfig === void 0 ? void 0 : userConfig.find((config) => config.origin === origin);
|
|
694
|
+
}
|
|
695
|
+
catch (error) {
|
|
696
|
+
console.error(this.getMessage('snkFormConfig.errors.failFetchUserConfig'));
|
|
697
|
+
console.error(error);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
async loadConfigByUser() {
|
|
701
|
+
if (!this.configManager || !this.configSelected)
|
|
702
|
+
return;
|
|
703
|
+
if (this.isConfigDefaultSelected()) {
|
|
704
|
+
await this.handleLoadDefaultConfig();
|
|
705
|
+
}
|
|
706
|
+
else {
|
|
707
|
+
this.loadFormConfig();
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
async handleLoadDefaultConfig() {
|
|
711
|
+
const defaultConfig = await this.configManager.fetchDefaultConfig();
|
|
712
|
+
if (defaultConfig) {
|
|
713
|
+
this.loadFormConfig(defaultConfig);
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
const emptyConfig = this.configManager.getEmptyConfig();
|
|
717
|
+
if (emptyConfig) {
|
|
718
|
+
this.loadFormConfig(emptyConfig);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
isConfigDefaultSelected() {
|
|
722
|
+
return this.configSelected.origin === UserConfigType.DEFAULT;
|
|
723
|
+
}
|
|
724
|
+
loadFormConfig(config) {
|
|
725
|
+
this._formConfig = config ? config : this.getConfig();
|
|
726
|
+
this.loadGuides();
|
|
727
|
+
this.initializeAvailableFields();
|
|
728
|
+
}
|
|
729
|
+
initializeAvailableFields() {
|
|
730
|
+
var _a;
|
|
731
|
+
if (((_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.fields) == undefined)
|
|
732
|
+
return;
|
|
733
|
+
const fieldsFormConfig = [...this._formConfig.fields];
|
|
734
|
+
const fieldsMetadata = this.dataUnit.metadata.fields;
|
|
735
|
+
this.availableFields = fieldsMetadata.filter(({ name: fieldName, visible: fieldVisible, properties }) => {
|
|
736
|
+
const hasCfg = fieldsFormConfig.some(({ name: fieldFormName }) => fieldFormName === fieldName);
|
|
737
|
+
/**
|
|
738
|
+
* Quando a visibilidade de um campo é alterada pelo dataunit, mas o desenvolvedor deseja que o mesmo continue
|
|
739
|
+
* sendo apresentado no configurador, precisamos fazer essa tratativa, verificando se o campo não tem configuração
|
|
740
|
+
*/
|
|
741
|
+
if (!hasCfg && properties.visibleOnConfig === true && !fieldVisible)
|
|
742
|
+
return properties.visibleOnConfig;
|
|
743
|
+
return fieldVisible === true && hasCfg === false;
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
getInitialOrder(guidesList) {
|
|
747
|
+
var _a, _b;
|
|
748
|
+
if (Array.isArray((_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.tabs)) {
|
|
749
|
+
return (_b = this._formConfig.tabs) === null || _b === void 0 ? void 0 : _b.length;
|
|
750
|
+
}
|
|
751
|
+
if (guidesList.length > 0) {
|
|
752
|
+
return Math.max(...guidesList.map(g => g.order));
|
|
753
|
+
}
|
|
754
|
+
return 0;
|
|
755
|
+
}
|
|
756
|
+
loadGuides() {
|
|
757
|
+
var _a, _b, _c, _d;
|
|
758
|
+
this.guidesList = [];
|
|
759
|
+
this.guidesList.push(...buildGuides(this._formConfig, this.getMessage('snkFormConfig.form.mainArea'), this.dataUnit, TAB_NAMES.general));
|
|
760
|
+
this.guidesList.push(...buildChildrenGuides(this.dataUnit, this.getInitialOrder(this.guidesList), this.guidesList));
|
|
761
|
+
this.guidesList.push(...buildCustomGuides(this.customGuidesConfig, this.guidesList));
|
|
762
|
+
this.guidesMap = buildGuidesMap((_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.fields, this.guidesList, this.dataUnit, TAB_NAMES.general);
|
|
763
|
+
this.mainGuide = this.guidesList.find(g => g.name === TAB_NAMES.main);
|
|
764
|
+
this.mainGroupsList = ((_b = this.mainGuide) === null || _b === void 0 ? void 0 : _b.name)
|
|
765
|
+
? [...((_d = (_c = this.guidesMap) === null || _c === void 0 ? void 0 : _c.get(this.mainGuide.name)) !== null && _d !== void 0 ? _d : [])]
|
|
766
|
+
: [];
|
|
767
|
+
this.ensureSelectedGuide();
|
|
768
|
+
}
|
|
769
|
+
ensureSelectedGuide() {
|
|
770
|
+
const stillValid = this.selectedGuide
|
|
771
|
+
&& this.guidesList.some(g => g.name === this.selectedGuide.name);
|
|
772
|
+
if (stillValid)
|
|
773
|
+
return;
|
|
774
|
+
const firstSelectable = this.guidesList
|
|
775
|
+
.filter(g => { var _a; return g.visible && g.name !== ((_a = this.mainGuide) === null || _a === void 0 ? void 0 : _a.name); })
|
|
776
|
+
.sort((a, b) => { var _a, _b; return ((_a = a.order) !== null && _a !== void 0 ? _a : Number.MAX_VALUE) - ((_b = b.order) !== null && _b !== void 0 ? _b : Number.MAX_VALUE); })[0];
|
|
777
|
+
this.selectedGuide = firstSelectable;
|
|
778
|
+
}
|
|
779
|
+
getConfig() {
|
|
780
|
+
let config = this.configManager.getConfig(this.dataUnit, false);
|
|
781
|
+
if (config.fields && config.fields.length === 0) {
|
|
782
|
+
config = undefined;
|
|
783
|
+
}
|
|
784
|
+
if (config == undefined) {
|
|
785
|
+
config = buildFormConfigFromDataUnit(this.dataUnit);
|
|
786
|
+
}
|
|
787
|
+
return ObjectUtils.copy(config);
|
|
788
|
+
}
|
|
789
|
+
handleSelectGuide({ detail: selectedGuide }) {
|
|
790
|
+
this.selectedGuide = selectedGuide;
|
|
791
|
+
}
|
|
792
|
+
handleLayoutChanged({ detail: newGroupList }) {
|
|
793
|
+
if (!this.selectedGuide)
|
|
794
|
+
return;
|
|
795
|
+
this.hasChanges = true;
|
|
796
|
+
this.groupsList = [...newGroupList];
|
|
797
|
+
this.guidesMap.set(this.selectedGuide.name, [...newGroupList]);
|
|
798
|
+
}
|
|
799
|
+
handleMainLayoutChanged({ detail: newGroupList }) {
|
|
800
|
+
var _a;
|
|
801
|
+
if (!((_a = this.mainGuide) === null || _a === void 0 ? void 0 : _a.name))
|
|
802
|
+
return;
|
|
803
|
+
this.hasChanges = true;
|
|
804
|
+
this.mainGroupsList = [...newGroupList];
|
|
805
|
+
this.guidesMap.set(this.mainGuide.name, [...newGroupList]);
|
|
806
|
+
}
|
|
807
|
+
getIsDefaultConfig() {
|
|
808
|
+
var _a;
|
|
809
|
+
const optionSelected = (_a = this.configSelected) === null || _a === void 0 ? void 0 : _a.origin;
|
|
810
|
+
return optionSelected === UserConfigType.DEFAULT
|
|
811
|
+
&& this.optionConfigChanged === true
|
|
812
|
+
&& this.hasChanges === false;
|
|
813
|
+
}
|
|
814
|
+
getTabsToSave() {
|
|
815
|
+
return this.guidesList.map(tab => {
|
|
816
|
+
return {
|
|
817
|
+
name: tab.name,
|
|
818
|
+
label: tab.name === TAB_NAMES.main ? tab.name : tab.label,
|
|
819
|
+
order: tab.name === TAB_NAMES.main ? 0 : tab.order,
|
|
820
|
+
visible: tab.visible,
|
|
821
|
+
};
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
async handleSaveConfig() {
|
|
825
|
+
var _a;
|
|
826
|
+
const savedConfig = await this.configManager.saveConfig(this.buildConfigToSave());
|
|
827
|
+
this.configSelected = (_a = this.configOptions) === null || _a === void 0 ? void 0 : _a.find((config) => {
|
|
828
|
+
return config.origin === (this.hasChanges ? UserConfigType.USER : UserConfigType.DEFAULT);
|
|
829
|
+
});
|
|
830
|
+
this.originalConfigSelected = this.configSelected;
|
|
831
|
+
this.hasChanges = false;
|
|
832
|
+
this.optionConfigChanged = false;
|
|
833
|
+
ApplicationUtils.info(this.getMessage('snkFormConfig.info.successfullyConfigSaved'), { iconName: 'check' });
|
|
834
|
+
this.configChange.emit(savedConfig);
|
|
835
|
+
}
|
|
836
|
+
buildConfigToSave() {
|
|
837
|
+
const formConfig = ObjectUtils.copy(this._formConfig);
|
|
838
|
+
formConfig.tabs = this.getTabsToSave();
|
|
839
|
+
formConfig.fields = getFieldsToSave(this.guidesMap);
|
|
840
|
+
formConfig.defaultConfiguration = this.getIsDefaultConfig();
|
|
841
|
+
return formConfig;
|
|
842
|
+
}
|
|
843
|
+
handleAvailableFieldListChanged({ detail: updatedList }) {
|
|
844
|
+
this.availableFields = [...updatedList];
|
|
845
|
+
}
|
|
846
|
+
handleSetFieldListAsAvailable({ detail: updatedList }) {
|
|
847
|
+
this.availableFields = [...this.availableFields, ...updatedList];
|
|
848
|
+
}
|
|
849
|
+
handleGuideDeleted({ detail: guide }) {
|
|
850
|
+
var _a, _b;
|
|
851
|
+
const guideName = guide.name;
|
|
852
|
+
const guideGroups = (_a = this.guidesMap.get(guideName)) !== null && _a !== void 0 ? _a : [];
|
|
853
|
+
const fieldsToAvailable = [];
|
|
854
|
+
guideGroups.forEach(group => fieldsToAvailable.push(...group.fields));
|
|
855
|
+
this.availableFields = [...this.availableFields, ...fieldsToAvailable];
|
|
856
|
+
this.guidesList = [...this.guidesList.filter(g => g.name !== guideName)];
|
|
857
|
+
this.guidesMap.delete(guideName);
|
|
858
|
+
if (((_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.name) === guideName) {
|
|
859
|
+
this.selectedGuide = undefined;
|
|
860
|
+
this.ensureSelectedGuide();
|
|
861
|
+
}
|
|
862
|
+
this.hasChanges = true;
|
|
863
|
+
}
|
|
864
|
+
handleGuideListChanged({ detail: updatedList }) {
|
|
865
|
+
this.hasChanges = true;
|
|
866
|
+
this.guidesList = [...updatedList];
|
|
867
|
+
}
|
|
868
|
+
handleGuideRenamed({ detail: updatedName }) {
|
|
869
|
+
var _a;
|
|
870
|
+
const previousGuide = this.selectedGuide;
|
|
871
|
+
if (!(previousGuide === null || previousGuide === void 0 ? void 0 : previousGuide.name))
|
|
872
|
+
return;
|
|
873
|
+
const previousName = previousGuide.name;
|
|
874
|
+
const guideGroups = (_a = this.guidesMap.get(previousName)) !== null && _a !== void 0 ? _a : [];
|
|
875
|
+
const updatedGroups = updateTabInFieldsFromGroupList(guideGroups, updatedName);
|
|
876
|
+
this.guidesMap.delete(previousName);
|
|
877
|
+
this.guidesMap.set(updatedName, updatedGroups);
|
|
878
|
+
const updatedGuide = {
|
|
879
|
+
name: updatedName,
|
|
880
|
+
label: updatedName,
|
|
881
|
+
visible: previousGuide.visible,
|
|
882
|
+
order: previousGuide.order,
|
|
883
|
+
};
|
|
884
|
+
this.guidesList = [...this.guidesList.map(guide => (guide.name === previousName) ? updatedGuide : guide)];
|
|
885
|
+
this.groupsList = [...updatedGroups];
|
|
886
|
+
this.selectedGuide = updatedGuide;
|
|
887
|
+
this.hasChanges = true;
|
|
888
|
+
}
|
|
889
|
+
handleCreateNewGuide() {
|
|
890
|
+
const newGuideName = buildNewGuideName(this.guidesList, this.getMessage.bind(this));
|
|
891
|
+
const newGuide = {
|
|
892
|
+
name: newGuideName,
|
|
893
|
+
label: newGuideName,
|
|
894
|
+
visible: true,
|
|
895
|
+
order: this.guidesList.length + 1,
|
|
896
|
+
};
|
|
897
|
+
const newGuideFixedGroup = {
|
|
898
|
+
name: GROUP_NAMES.noGroup,
|
|
899
|
+
fields: [],
|
|
900
|
+
};
|
|
901
|
+
this.guidesList = [...this.guidesList, newGuide];
|
|
902
|
+
this.guidesMap.set(newGuideName, [newGuideFixedGroup]);
|
|
903
|
+
this.selectedGuide = newGuide;
|
|
904
|
+
this.hasChanges = true;
|
|
905
|
+
}
|
|
906
|
+
getGuideNames() {
|
|
907
|
+
return [
|
|
908
|
+
...this.guidesList.map(g => g.name.toLowerCase()),
|
|
909
|
+
this.getMessage('snkFormConfig.form.mainArea').toLowerCase(),
|
|
910
|
+
];
|
|
911
|
+
}
|
|
912
|
+
async componentWillRender() {
|
|
913
|
+
if (this.messagesBuilder == undefined) {
|
|
914
|
+
const application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
|
|
915
|
+
this.messagesBuilder = application.messagesBuilder;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
async componentWillLoad() {
|
|
919
|
+
this.loadFormConfig();
|
|
920
|
+
await this.initializeUserConfig();
|
|
921
|
+
}
|
|
922
|
+
render() {
|
|
923
|
+
var _a;
|
|
924
|
+
return (h(Host, null, h("snk-dynaform-config-header", { configOptions: this.configOptions, selectedConfig: this.configSelected, messagesBuilder: this.messagesBuilder, hasChanges: this.hasChanges, optionConfigChanged: this.optionConfigChanged, onConfigClose: () => this.configClose.emit(), onSaveConfig: async () => await this.handleSaveConfig() }), h("div", { class: "form-config-body" }, h("div", { class: "form-config-layout" }, h("snk-dynaform-fields-selector", { dataUnit: this.dataUnit, availableFields: this.availableFields, onFieldListChanged: this.handleAvailableFieldListChanged.bind(this), messagesBuilder: this.messagesBuilder }), h("div", { class: "main-editing-area" }, this.mainGuide && (h("div", { class: "main-fields-section" }, h("snk-dynaform-fields-layout", { ref: ref => this.refMainFieldsLayout = ref, selectedGuide: this.mainGuide, guideNames: this.getGuideNames(), groupsList: this.mainGroupsList, messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, isMainSection: true, onLayoutChanged: this.handleMainLayoutChanged.bind(this), onSetFieldListAsAvailable: this.handleSetFieldListAsAvailable.bind(this) }))), h("snk-dynaform-guides-configurator", { messagesBuilder: this.messagesBuilder, guidesList: this.guidesList, selectedGuide: this.selectedGuide, mainGuideName: (_a = this.mainGuide) === null || _a === void 0 ? void 0 : _a.name, onGuideSelected: this.handleSelectGuide.bind(this), onGuideListChanged: this.handleGuideListChanged.bind(this), onCreateNewGuide: this.handleCreateNewGuide.bind(this), onGuideDeleted: this.handleGuideDeleted.bind(this) }), h("snk-dynaform-fields-layout", { ref: ref => this.refFieldsLayout = ref, selectedGuide: this.selectedGuide, guideNames: this.getGuideNames(), groupsList: this.groupsList, messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, onGuideRenamed: this.handleGuideRenamed.bind(this), onLayoutChanged: this.handleLayoutChanged.bind(this), onSetFieldListAsAvailable: this.handleSetFieldListAsAvailable.bind(this) }))))));
|
|
925
|
+
}
|
|
926
|
+
static get watchers() { return {
|
|
927
|
+
"selectedGuide": ["observeSelectedGuide"],
|
|
928
|
+
"configManager": ["observeConfigManager"]
|
|
929
|
+
}; }
|
|
930
|
+
};
|
|
931
|
+
SnkDynaformFormConfig.style = snkDynaformFormConfigCss;
|
|
932
|
+
|
|
933
|
+
export { SnkDynaformDetailView as snk_dynaform_detail_view, SnkDynaformFormConfig as snk_dynaform_form_config };
|