@sankhyalabs/sankhyablocks 10.1.0-dev.51 → 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-293bc3d2.js → SnkMultiSelectionListDataSource-0bc94d36.js} +71 -24
- 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 -229
- 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 +16 -11
- 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-b4ca3437.js → snk-guides-viewer-3054d541.js} +2 -2
- 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-crud/subcomponents/snk-detail-view/snk-detail-view.css +4 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +6 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +1 -1
- package/dist/collection/components/snk-crud/utils/taskbarUtils.js +14 -0
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +67 -20
- 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 +14 -7
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +22 -4
- package/dist/components/ContinuousInsertUtils.js +67 -20
- 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 -198
- package/dist/components/snk-detail-view2.js +8 -2
- 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-f6cabd15.js → SnkMultiSelectionListDataSource-9e9166ae.js} +71 -24
- 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 -204
- 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 +14 -9
- 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-cc37535b.js → snk-guides-viewer-95fefcaa.js} +2 -2
- 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-2c00b93d.js +1 -0
- 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-771b137e.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-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +1 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +8 -0
- 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-0afc64df.entry.js +0 -1
- package/dist/sankhyablocks/p-10f27dc6.entry.js +0 -1
- package/dist/sankhyablocks/p-134702f6.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-33492640.entry.js +0 -1
- package/dist/sankhyablocks/p-3870748a.js +0 -28
- 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-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-95b36bd3.entry.js +0 -1
- package/dist/sankhyablocks/p-9e77e136.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-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-e8df1dea.entry.js +0 -1
- package/dist/sankhyablocks/p-ef9343c3.entry.js +0 -1
- package/dist/sankhyablocks/p-f1bbf065.entry.js +0 -1
- package/dist/sankhyablocks/p-f4184ce7.js +0 -1
- package/dist/sankhyablocks/p-fec88660.entry.js +0 -1
|
@@ -0,0 +1,731 @@
|
|
|
1
|
+
import { r as registerInstance, e as createEvent, h, f as Host, i as forceUpdate, g as getElement } from './index-04f73a26.js';
|
|
2
|
+
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
3
|
+
import { ObjectUtils, StringUtils, ArrayUtils } from '@sankhyalabs/core';
|
|
4
|
+
import { S as Sortable } from './sortable.esm-bc277c12.js';
|
|
5
|
+
import { a as TAB_NAMES, G as GROUP_NAMES } from './constants-7b422de0.js';
|
|
6
|
+
import { S as SORTABLE_PATH, f as getFieldsStructure, I as ID_AVAILABLE_FIELDS } from './FormConfigHelper-efc29480.js';
|
|
7
|
+
|
|
8
|
+
const snkDynaformConfigHeaderCss = ".sc-snk-dynaform-config-header-h{display:flex;padding-top:var(--space--12, 12px);align-items:center;width:100%;justify-content:space-between}.left-group.sc-snk-dynaform-config-header{display:flex;gap:var(--space--8, 8px);align-items:center}.right-group.sc-snk-dynaform-config-header{display:flex}";
|
|
9
|
+
|
|
10
|
+
const SnkDynaformConfigHeader = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
registerInstance(this, hostRef);
|
|
13
|
+
this.configClose = createEvent(this, "configClose", 7);
|
|
14
|
+
this.saveConfig = createEvent(this, "saveConfig", 7);
|
|
15
|
+
this.isEditingGuide = false;
|
|
16
|
+
this.isEditingGroup = false;
|
|
17
|
+
this.configOptions = [];
|
|
18
|
+
this.selectedConfig = undefined;
|
|
19
|
+
this.messagesBuilder = undefined;
|
|
20
|
+
this.hasChanges = false;
|
|
21
|
+
this.optionConfigChanged = false;
|
|
22
|
+
}
|
|
23
|
+
handleIsEditingGuideName({ detail }) {
|
|
24
|
+
this.isEditingGuide = detail;
|
|
25
|
+
}
|
|
26
|
+
handleIsEditingGroupName({ detail }) {
|
|
27
|
+
this.isEditingGroup = detail;
|
|
28
|
+
}
|
|
29
|
+
saveFormConfig() {
|
|
30
|
+
if (this.isEditingGuide || this.isEditingGroup) {
|
|
31
|
+
const title = this.getMessage('snkFormConfig.confirm.title');
|
|
32
|
+
const message = this.isEditingGuide
|
|
33
|
+
? this.getMessage('snkFormConfig.alert.titleGuideEditing')
|
|
34
|
+
: this.getMessage('snkFormConfig.alert.titleGroupEditing');
|
|
35
|
+
ApplicationUtils.alert(title, message);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.saveConfig.emit();
|
|
39
|
+
}
|
|
40
|
+
async closeFormConfig() {
|
|
41
|
+
if (this.hasChanges) {
|
|
42
|
+
const title = this.getMessage('snkFormConfig.confirm.title');
|
|
43
|
+
const msg = this.getMessage('snkFormConfig.confirm.cancel');
|
|
44
|
+
const confirm = await ApplicationUtils.confirm(title, msg);
|
|
45
|
+
if (!confirm)
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.configClose.emit();
|
|
49
|
+
}
|
|
50
|
+
getMessage(key, params) {
|
|
51
|
+
return this.messagesBuilder.getMessage(key, params);
|
|
52
|
+
}
|
|
53
|
+
openConfirmDialog(msg = '', title = this.getMessage('snkFormConfig.confirm.title')) {
|
|
54
|
+
return ApplicationUtils.confirm(title, msg);
|
|
55
|
+
}
|
|
56
|
+
async applyOptionConfig() {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
const name = (_b = (_a = this.selectedConfig) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this.getMessage('snkFormConfig.configs.selectedConfig');
|
|
59
|
+
const msg = this.getMessage('snkFormConfig.confirm.apply').replace('{0}', name);
|
|
60
|
+
const confirm = await this.openConfirmDialog(msg);
|
|
61
|
+
if (confirm) {
|
|
62
|
+
this.saveConfig.emit();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
renderSaveActions() {
|
|
66
|
+
if (!this.hasChanges && !this.optionConfigChanged)
|
|
67
|
+
return;
|
|
68
|
+
if (this.hasChanges) {
|
|
69
|
+
return (h("div", { class: "right-group" }, h("ez-button", { title: this.getMessage('snkFormConfig.actions.cancel'), label: this.getMessage('snkFormConfig.actions.cancel'), onClick: this.closeFormConfig.bind(this), size: "medium" }), h("ez-button", { title: this.getMessage('snkFormConfig.actions.save'), label: this.getMessage('snkFormConfig.actions.save'), class: 'ez-button--primary ez-padding-left--medium', onClick: () => this.saveFormConfig(), size: "medium" })));
|
|
70
|
+
}
|
|
71
|
+
return (h("div", { class: "right-group" }, h("ez-button", { title: this.getMessage('snkFormConfig.actions.cancel'), label: this.getMessage('snkFormConfig.actions.cancel'), onClick: this.closeFormConfig.bind(this), size: "medium" }), h("ez-button", { title: this.getMessage('snkFormConfig.actions.save'), label: this.getMessage('snkFormConfig.applyConfig'), class: 'ez-button--primary ez-padding-left--medium', onClick: async () => await this.applyOptionConfig(), size: "medium" })));
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
return (h(Host, null, h("div", { class: 'left-group' }, h("ez-button", { mode: "icon", title: this.getMessage('snkFormConfig.goBackTitle'), iconName: "arrow_back", size: "small", onClick: this.closeFormConfig.bind(this), id: "formConfigToBack" }), h("h1", { class: "ez-title ez-title--primary ez-title--extra-large ez-padding--small" }, this.getMessage('snkFormConfig.title')), h("snk-dynaform-configs-button", { hasChanges: this.hasChanges, configOptions: this.configOptions, selectedConfig: this.selectedConfig, messagesBuilder: this.messagesBuilder })), this.renderSaveActions()));
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
SnkDynaformConfigHeader.style = snkDynaformConfigHeaderCss;
|
|
78
|
+
|
|
79
|
+
const snkDynaformConfigsButtonCss = ".dropdown-container.sc-snk-dynaform-configs-button{font-family:'Roboto';font-size:12px;font-weight:400;display:flex;flex-direction:column;color:#2b3a54;width:200px}.main-item.sc-snk-dynaform-configs-button{padding:12px;font-size:14px;cursor:pointer;transition:all .2s ease-in-out;display:flex;flex-direction:row;gap:8px;align-items:center;justify-content:start}.main-item.sc-snk-dynaform-configs-button ez-icon.sc-snk-dynaform-configs-button{--ez-icon--color:#008561}.main-item.sc-snk-dynaform-configs-button:nth-of-type(1){padding-bottom:6px}.main-item.sc-snk-dynaform-configs-button:nth-of-type(2){padding-top:6px}.main-item.sc-snk-dynaform-configs-button:hover{background-color:#FAFCFF}.item-label.sc-snk-dynaform-configs-button{display:flex}";
|
|
80
|
+
|
|
81
|
+
const SnkDynaformConfigsButton = class {
|
|
82
|
+
constructor(hostRef) {
|
|
83
|
+
registerInstance(this, hostRef);
|
|
84
|
+
this.formConfigOptionSelected = createEvent(this, "formConfigOptionSelected", 7);
|
|
85
|
+
this.configOptions = [];
|
|
86
|
+
this.selectedConfig = undefined;
|
|
87
|
+
this.hasChanges = false;
|
|
88
|
+
this.messagesBuilder = undefined;
|
|
89
|
+
}
|
|
90
|
+
getMessage(key, params) {
|
|
91
|
+
return this.messagesBuilder.getMessage(key, params);
|
|
92
|
+
}
|
|
93
|
+
async showShareConfigOptions() {
|
|
94
|
+
if (this._refOptionsPopover && this._refShareConfigBtn) {
|
|
95
|
+
await this._refOptionsPopover.showUnder(this._refShareConfigBtn);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async handleSelectOption(option) {
|
|
99
|
+
if (ObjectUtils.equals(option, this.selectedConfig))
|
|
100
|
+
return;
|
|
101
|
+
if (this.hasChanges) {
|
|
102
|
+
const title = this.getMessage('snkFormConfig.confirm.title');
|
|
103
|
+
const msg = this.getMessage('snkFormConfig.confirm.cancel');
|
|
104
|
+
const confirm = await ApplicationUtils.confirm(title, msg);
|
|
105
|
+
if (!confirm)
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this.selectedConfig = option;
|
|
109
|
+
this.formConfigOptionSelected.emit(option);
|
|
110
|
+
await this._refOptionsPopover.hide();
|
|
111
|
+
}
|
|
112
|
+
getButtonLabel() {
|
|
113
|
+
var _a, _b;
|
|
114
|
+
return (_b = (_a = this.selectedConfig) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this.getMessage('snkFormConfig.configs.buttonLabel');
|
|
115
|
+
}
|
|
116
|
+
renderConfigOptions() {
|
|
117
|
+
return this.configOptions.map((option) => {
|
|
118
|
+
return (h("div", { class: `main-item`, onClick: async () => await this.handleSelectOption(option) }, h("span", { class: 'item-label' }, " ", option.name), this.renderCheckIcon(option)));
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
renderCheckIcon(option) {
|
|
122
|
+
if (this.selectedConfig && this.selectedConfig.origin === option.origin)
|
|
123
|
+
return h("ez-icon", { iconName: "check" });
|
|
124
|
+
}
|
|
125
|
+
render() {
|
|
126
|
+
return (h(Host, null, h("ez-button", { ref: ref => this._refShareConfigBtn = ref, label: this.getButtonLabel(), onClick: async () => await this.showShareConfigOptions() }, h("ez-icon", { slot: "rightIcon", iconName: "chevron-down" })), h("ez-popover-plus", { ref: ref => this._refOptionsPopover = ref, autoClose: true, overlayType: "none" }, h("div", { class: 'dropdown-container' }, this.renderConfigOptions()))));
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
SnkDynaformConfigsButton.style = snkDynaformConfigsButtonCss;
|
|
130
|
+
|
|
131
|
+
const snkDynaformFieldsLayoutCss = ".sc-snk-dynaform-fields-layout-h{display:flex;padding:12px;box-shadow:var(--shadow--small, 0 0 16px rgba(0, 38, 111, 0.07));border-radius:var(--border--radius-medium, 6px);height:100%;min-height:0;flex-direction:column;box-sizing:border-box}.is-main-section.sc-snk-dynaform-fields-layout-h{height:100%;border:1px solid var(--color--gray-90, #EAEAEA);flex:1 1 auto;min-height:0;flex-direction:row;overflow:auto}.is-main-section.sc-snk-dynaform-fields-layout-h .layout-container.sc-snk-dynaform-fields-layout{flex:1 1 auto;min-height:0;width:100%}.layout-container.sc-snk-dynaform-fields-layout{container-type:inline-size;display:flex;flex-direction:column;overflow:hidden;flex:1 1 auto;min-height:0;width:100%}.layout-container.sc-snk-dynaform-fields-layout>ez-scroller.sc-snk-dynaform-fields-layout{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}.guide-header.sc-snk-dynaform-fields-layout{display:flex;width:100%;font-size:20px;border-bottom:1px solid #dce0e8;margin-bottom:6px;align-items:center;height:45px}.guide-header.sc-snk-dynaform-fields-layout ez-button.sc-snk-dynaform-fields-layout{transition:all 0.2s ease-in-out;visibility:hidden;opacity:0}.guide-header.sc-snk-dynaform-fields-layout:hover ez-button.sc-snk-dynaform-fields-layout{visibility:visible;opacity:1}.guide-header-label.sc-snk-dynaform-fields-layout{display:block;padding:10px 0}.group-config.sc-snk-dynaform-fields-layout{padding:12px 0;display:flex;flex-direction:column;width:100%}.group-content.sc-snk-dynaform-fields-layout{display:grid;gap:12px;min-height:65px;width:100%;padding:6px 0;grid-template-columns:repeat(auto-fill, minmax(250px, 1fr))}.group-content.empty-content.sc-snk-dynaform-fields-layout{position:relative}.group-content.empty-content.sc-snk-dynaform-fields-layout::before{content:var(--empty-content-message, \"Arraste e solte um campo aqui\");color:#cbcfd7;font-size:16px;font-weight:500;text-align:center;position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none;transition:opacity 0.3s;height:100%;box-sizing:border-box;padding:10px;background:#f9f9f9;border:1px dashed #dce0e8;border-radius:6px}.no-group-container.sc-snk-dynaform-fields-layout{padding:12px 0;width:100%;border-bottom:1px solid #dce0e8}.no-group-container.sc-snk-dynaform-fields-layout::before{content:var(--no-group-message, \"Inclua estes campos nos grupos ou deixe-os separados no topo do formulário\");width:100%;display:block;font-size:16px;font-weight:400;color:#AFB6C0;padding-bottom:12px}.add-group-container.sc-snk-dynaform-fields-layout{display:flex;align-items:center;border-top:1px solid #dce0e8;padding-top:22px;padding-bottom:12px;gap:6px;cursor:pointer;justify-content:center;width:100%;height:55px}.no-guide-selected.sc-snk-dynaform-fields-layout{display:block;margin:auto;font-size:24px;color:#AFB6C0;font-weight:500}.message-container.sc-snk-dynaform-fields-layout{margin:auto;display:flex;flex-direction:column;justify-content:center;align-items:center}.message-config-detail.sc-snk-dynaform-fields-layout{display:block;margin:auto;font-size:var(--font-size--medium, 16px);color:#AFB6C0;font-weight:var(--font-weight--medium, 500)}.ghost.sc-snk-dynaform-fields-layout{opacity:.5;background:#c8fbe2}";
|
|
132
|
+
|
|
133
|
+
const SnkDynaformFieldsLayout = class {
|
|
134
|
+
constructor(hostRef) {
|
|
135
|
+
registerInstance(this, hostRef);
|
|
136
|
+
this.isEditingGuideName = createEvent(this, "isEditingGuideName", 7);
|
|
137
|
+
this.isEditingGroupName = createEvent(this, "isEditingGroupName", 7);
|
|
138
|
+
this.layoutChanged = createEvent(this, "layoutChanged", 7);
|
|
139
|
+
this.setFieldListAsAvailable = createEvent(this, "setFieldListAsAvailable", 7);
|
|
140
|
+
this.guideRenamed = createEvent(this, "guideRenamed", 7);
|
|
141
|
+
this.ID_GROUPS = 'container-groups';
|
|
142
|
+
this.ID_FIELDS = 'container-fields';
|
|
143
|
+
this.reservedGuideNames = [TAB_NAMES.main.toLowerCase(), TAB_NAMES.general.toLocaleLowerCase()];
|
|
144
|
+
this.groupsListMemory = [];
|
|
145
|
+
this.groupsRefList = [];
|
|
146
|
+
this.sortableInstances = [];
|
|
147
|
+
this.isEditGuideNameActive = false;
|
|
148
|
+
this.selectedGuide = undefined;
|
|
149
|
+
this.groupsList = [];
|
|
150
|
+
this.guideNames = [];
|
|
151
|
+
this.dataUnit = undefined;
|
|
152
|
+
this.isMainSection = false;
|
|
153
|
+
this.messagesBuilder = undefined;
|
|
154
|
+
}
|
|
155
|
+
onMessagesBuilderChange() {
|
|
156
|
+
this.setCustomCSSProperties();
|
|
157
|
+
}
|
|
158
|
+
handleFieldConfigChanged({ detail: updatedField }) {
|
|
159
|
+
var _a;
|
|
160
|
+
if (((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.name) && updatedField.tab && updatedField.tab !== this.selectedGuide.name) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const groupToUpdate = this.groupsListMemory.find(g => g.name === updatedField.group);
|
|
164
|
+
if (!groupToUpdate)
|
|
165
|
+
return;
|
|
166
|
+
const updatedFields = groupToUpdate.fields.map(field => {
|
|
167
|
+
return (field.name === updatedField.name) ? updatedField : field;
|
|
168
|
+
});
|
|
169
|
+
const updatedGroupList = this.groupsListMemory.map(group => {
|
|
170
|
+
return (group.name === groupToUpdate.name)
|
|
171
|
+
? { name: group.name, fields: updatedFields }
|
|
172
|
+
: group;
|
|
173
|
+
});
|
|
174
|
+
this.applyGroupUpdate(updatedGroupList);
|
|
175
|
+
}
|
|
176
|
+
observeSelectedGuide() {
|
|
177
|
+
this.isEditGuideNameActive = false;
|
|
178
|
+
forceUpdate(this);
|
|
179
|
+
this.isEditingGroupName.emit(false);
|
|
180
|
+
}
|
|
181
|
+
observeGroupList(newValue) {
|
|
182
|
+
this.groupsListMemory = [...newValue];
|
|
183
|
+
}
|
|
184
|
+
observeIsEditGuideNameActive(newValue) {
|
|
185
|
+
this.isEditingGuideName.emit(newValue);
|
|
186
|
+
}
|
|
187
|
+
async addFieldToLayout(incomingField) {
|
|
188
|
+
incomingField.group = GROUP_NAMES.noGroup;
|
|
189
|
+
incomingField.tab = this.selectedGuide.name;
|
|
190
|
+
const fixedFieldsGroup = this.getFixedFieldsGroup();
|
|
191
|
+
const newFixedFieldsGroup = {
|
|
192
|
+
name: GROUP_NAMES.noGroup,
|
|
193
|
+
fields: fixedFieldsGroup ? [...fixedFieldsGroup.fields, incomingField] : [incomingField],
|
|
194
|
+
};
|
|
195
|
+
const updatedGroupListMemory = fixedFieldsGroup
|
|
196
|
+
? [newFixedFieldsGroup, ...this.groupsListMemory.slice(1)]
|
|
197
|
+
: [newFixedFieldsGroup, ...this.groupsListMemory];
|
|
198
|
+
this.applyGroupUpdate(updatedGroupListMemory);
|
|
199
|
+
}
|
|
200
|
+
getFixedFieldsGroup() {
|
|
201
|
+
return this.groupsListMemory.find(g => g.name === GROUP_NAMES.noGroup);
|
|
202
|
+
}
|
|
203
|
+
getMessage(key, params) {
|
|
204
|
+
return this.messagesBuilder.getMessage(key, params);
|
|
205
|
+
}
|
|
206
|
+
handleAddGroup() {
|
|
207
|
+
const newGroup = { name: this.buildNewGroupName(), fields: [] };
|
|
208
|
+
const updatedGroupsList = [...this.groupsListMemory, newGroup];
|
|
209
|
+
this.applyGroupUpdate(updatedGroupsList);
|
|
210
|
+
}
|
|
211
|
+
buildNewGroupName() {
|
|
212
|
+
var _a, _b;
|
|
213
|
+
const newGroupMessage = this.getMessage('snkFormConfig.form.newGroup');
|
|
214
|
+
const qtdWithNewGroupName = (_b = (_a = this.groupsListMemory.filter(g => g.name.includes(newGroupMessage))) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
215
|
+
return qtdWithNewGroupName === 0 ? newGroupMessage : `${newGroupMessage} (${qtdWithNewGroupName})`;
|
|
216
|
+
}
|
|
217
|
+
makeDynamicFieldsContainersDraggable() {
|
|
218
|
+
const draggableGroups = this.groupsList.filter((g) => g.name !== GROUP_NAMES.noGroup);
|
|
219
|
+
draggableGroups.forEach(group => {
|
|
220
|
+
this.makeFieldContainerDraggable(this.getFieldsContainerId(group.name));
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
getInstanceSuffix() {
|
|
224
|
+
var _a, _b;
|
|
225
|
+
return StringUtils.replaceBlankCharacters((_b = (_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '');
|
|
226
|
+
}
|
|
227
|
+
getGroupsContainerId() {
|
|
228
|
+
return `${this.ID_GROUPS}-${this.getInstanceSuffix()}`;
|
|
229
|
+
}
|
|
230
|
+
getNoGroupContainerId() {
|
|
231
|
+
return `${GROUP_NAMES.noGroup}-${this.getInstanceSuffix()}`;
|
|
232
|
+
}
|
|
233
|
+
getFieldsContainerId(groupName) {
|
|
234
|
+
return `${this.ID_FIELDS}-${this.getInstanceSuffix()}-${StringUtils.replaceBlankCharacters(groupName)}`;
|
|
235
|
+
}
|
|
236
|
+
handleSortGroups(evt) {
|
|
237
|
+
var _a;
|
|
238
|
+
const htmlStructure = (_a = evt.to) === null || _a === void 0 ? void 0 : _a.children;
|
|
239
|
+
if (!htmlStructure)
|
|
240
|
+
return;
|
|
241
|
+
const groupsOrder = Array.from(htmlStructure).map(el => el.getAttribute('data-group-name'));
|
|
242
|
+
const updatedOrderGroupsList = [];
|
|
243
|
+
const fixedGroup = this.getFixedFieldsGroup();
|
|
244
|
+
if (fixedGroup) {
|
|
245
|
+
updatedOrderGroupsList.push(fixedGroup);
|
|
246
|
+
}
|
|
247
|
+
groupsOrder.forEach(groupName => {
|
|
248
|
+
const group = this.groupsListMemory.find(g => g.name === groupName);
|
|
249
|
+
if (group) {
|
|
250
|
+
updatedOrderGroupsList.push(group);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
this.applyGroupUpdate(updatedOrderGroupsList);
|
|
254
|
+
}
|
|
255
|
+
handleFieldsChanged(evt) {
|
|
256
|
+
let updatedGroupsList = [...this.groupsListMemory];
|
|
257
|
+
updatedGroupsList = [...this.handleFieldsOnGroupUpdate(updatedGroupsList, evt, SORTABLE_PATH.FROM)];
|
|
258
|
+
updatedGroupsList = [...this.handleFieldsOnGroupUpdate(updatedGroupsList, evt, SORTABLE_PATH.TO)];
|
|
259
|
+
this.applyGroupUpdate(updatedGroupsList);
|
|
260
|
+
}
|
|
261
|
+
applyGroupUpdate(updatedGroupList) {
|
|
262
|
+
var _a;
|
|
263
|
+
(_a = this.groupsRefList) === null || _a === void 0 ? void 0 : _a.forEach((group) => group === null || group === void 0 ? void 0 : group.cancelEdition());
|
|
264
|
+
if (ObjectUtils.equals(updatedGroupList, this.groupsListMemory)) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
this.groupsListMemory = [...updatedGroupList];
|
|
268
|
+
this.layoutChanged.emit(this.groupsListMemory);
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
handleFieldsOnGroupUpdate(groupList, evt, path) {
|
|
272
|
+
const element = evt[path];
|
|
273
|
+
if (!this.el.contains(element))
|
|
274
|
+
return groupList;
|
|
275
|
+
const isAvailableFields = element.id === ID_AVAILABLE_FIELDS;
|
|
276
|
+
return isAvailableFields ? groupList : this.updateGroupList(groupList, element, path, evt);
|
|
277
|
+
}
|
|
278
|
+
updateGroupList(groupList, element, path, evt) {
|
|
279
|
+
const groupName = element.getAttribute('data-group-name');
|
|
280
|
+
const updatedGroup = {
|
|
281
|
+
name: groupName,
|
|
282
|
+
fields: getFieldsStructure(evt, path, groupName, this.selectedGuide.name),
|
|
283
|
+
};
|
|
284
|
+
return this.upsertGroup(groupList, updatedGroup);
|
|
285
|
+
}
|
|
286
|
+
upsertGroup(groupList, newGroup) {
|
|
287
|
+
if (groupList.some(group => group.name === newGroup.name)) {
|
|
288
|
+
return this.replaceGroup(groupList, newGroup);
|
|
289
|
+
}
|
|
290
|
+
return newGroup.name === GROUP_NAMES.noGroup
|
|
291
|
+
? [newGroup, ...groupList]
|
|
292
|
+
: [...groupList, newGroup];
|
|
293
|
+
}
|
|
294
|
+
replaceGroup(groupList, newGroup) {
|
|
295
|
+
return groupList.map(group => group.name === newGroup.name ? newGroup : group);
|
|
296
|
+
}
|
|
297
|
+
destroySortableInstances() {
|
|
298
|
+
this.sortableInstances.forEach(instance => {
|
|
299
|
+
var _a;
|
|
300
|
+
try {
|
|
301
|
+
(_a = instance === null || instance === void 0 ? void 0 : instance.destroy) === null || _a === void 0 ? void 0 : _a.call(instance);
|
|
302
|
+
}
|
|
303
|
+
catch ( /* noop */_b) { /* noop */ }
|
|
304
|
+
});
|
|
305
|
+
this.sortableInstances = [];
|
|
306
|
+
}
|
|
307
|
+
makeGroupsDraggable() {
|
|
308
|
+
try {
|
|
309
|
+
const element = this.getContainerElement(this.getGroupsContainerId());
|
|
310
|
+
if (!element)
|
|
311
|
+
return;
|
|
312
|
+
this.sortableInstances.push(new Sortable(element, {
|
|
313
|
+
group: 'groups',
|
|
314
|
+
ghostClass: 'ghost',
|
|
315
|
+
direction: 'horizontal',
|
|
316
|
+
animation: 15,
|
|
317
|
+
onSort: (evt) => this.handleSortGroups(evt),
|
|
318
|
+
}));
|
|
319
|
+
}
|
|
320
|
+
catch (e) {
|
|
321
|
+
console.error(this.getMessage('snkFormConfig.errors.failMakeGroupsDraggable'), this.getGroupsContainerId());
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
makeFieldContainerDraggable(containerId) {
|
|
325
|
+
try {
|
|
326
|
+
const element = this.getContainerElement(containerId);
|
|
327
|
+
if (!element)
|
|
328
|
+
return;
|
|
329
|
+
this.sortableInstances.push(new Sortable(element, {
|
|
330
|
+
group: 'fields',
|
|
331
|
+
ghostClass: 'ghost',
|
|
332
|
+
direction: 'vertical',
|
|
333
|
+
animation: 15,
|
|
334
|
+
onAdd: (evt) => this.handleFieldsChanged(evt),
|
|
335
|
+
onRemove: (evt) => this.handleFieldsChanged(evt),
|
|
336
|
+
onSort: (evt) => this.handleFieldsChanged(evt),
|
|
337
|
+
}));
|
|
338
|
+
}
|
|
339
|
+
catch (e) {
|
|
340
|
+
console.error(this.getMessage('snkFormConfig.errors.failMakeFieldContainerDraggable'), containerId);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
getContainerElement(id) {
|
|
344
|
+
return this.el.querySelector(`[id="${id}"]`);
|
|
345
|
+
}
|
|
346
|
+
handleSetFieldAsAvailable(field) {
|
|
347
|
+
var _a;
|
|
348
|
+
const groupName = (_a = field.group) !== null && _a !== void 0 ? _a : GROUP_NAMES.noGroup;
|
|
349
|
+
const group = this.groupsListMemory.find(group => group.name === groupName);
|
|
350
|
+
const fields = group.fields.filter(f => f.name !== field.name);
|
|
351
|
+
const updatedGroup = { name: groupName, fields };
|
|
352
|
+
const updatedList = [...this.replaceGroup(this.groupsListMemory, updatedGroup)];
|
|
353
|
+
this.applyGroupUpdate(updatedList);
|
|
354
|
+
}
|
|
355
|
+
removeGroup(group) {
|
|
356
|
+
var _a, _b;
|
|
357
|
+
const groupFields = (_b = (_a = this.groupsListMemory.find(f => f.name === group.name)) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : [];
|
|
358
|
+
const updatedGroupList = [...this.groupsListMemory.filter(g => g.name !== group.name)];
|
|
359
|
+
if (this.applyGroupUpdate(updatedGroupList)) {
|
|
360
|
+
this.setFieldListAsAvailable.emit(groupFields);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
handleRenameGroup(editDetails) {
|
|
364
|
+
const { value: actualName, newValue: newGroupName } = editDetails.detail;
|
|
365
|
+
const updatedGroupList = this.groupsListMemory.map(group => {
|
|
366
|
+
if (group.name !== actualName)
|
|
367
|
+
return Object.assign({}, group);
|
|
368
|
+
const updatedFields = group.fields.map(f => {
|
|
369
|
+
return Object.assign(Object.assign({}, f), { group: newGroupName });
|
|
370
|
+
});
|
|
371
|
+
return { name: newGroupName, fields: updatedFields };
|
|
372
|
+
});
|
|
373
|
+
this.applyGroupUpdate(updatedGroupList);
|
|
374
|
+
}
|
|
375
|
+
canSaveGroup(newLabel, index) {
|
|
376
|
+
const hasOtherWithThisName = this.groupsList.some(group => {
|
|
377
|
+
var _a;
|
|
378
|
+
return ((_a = group.name) !== null && _a !== void 0 ? _a : '').toLocaleLowerCase() === (newLabel !== null && newLabel !== void 0 ? newLabel : '').toLocaleLowerCase();
|
|
379
|
+
});
|
|
380
|
+
if (!hasOtherWithThisName)
|
|
381
|
+
return true;
|
|
382
|
+
const title = this.getMessage('snkFormConfig.confirm.title');
|
|
383
|
+
const message = this.buildDuplicatedGroupNameContent(newLabel);
|
|
384
|
+
ApplicationUtils.alert(title, message).then(() => { var _a; return (_a = this.groupsRefList[index]) === null || _a === void 0 ? void 0 : _a.applyFocusTextEdit(); });
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
buildDuplicatedGroupNameContent(newLabel) {
|
|
388
|
+
const tabName = this.selectedGuide.name;
|
|
389
|
+
return `
|
|
390
|
+
${this.getMessage('snkFormConfig.alert.titleGroupExists')}
|
|
391
|
+
<b>${newLabel}</b>
|
|
392
|
+
${this.getMessage('snkFormConfig.alert.inTab')}
|
|
393
|
+
<b>${tabName === TAB_NAMES.main ? this.getMessage('snkFormConfig.form.mainArea') : tabName}</b>.
|
|
394
|
+
<br/><br/>
|
|
395
|
+
${this.getMessage('snkFormConfig.alert.infoValidTitle')}
|
|
396
|
+
`;
|
|
397
|
+
}
|
|
398
|
+
buildDuplicatedTabNameContent(newLabel) {
|
|
399
|
+
return `
|
|
400
|
+
${this.getMessage('snkFormConfig.alert.titleGuideExists')}
|
|
401
|
+
<b>${newLabel}</b>.
|
|
402
|
+
<br/><br/>
|
|
403
|
+
${this.getMessage('snkFormConfig.alert.infoValidTitle')}
|
|
404
|
+
`;
|
|
405
|
+
}
|
|
406
|
+
buildReservedTabNameContent(newLabel) {
|
|
407
|
+
return `
|
|
408
|
+
${this.getMessage('snkFormConfig.alert.titleGuideReservedName')}
|
|
409
|
+
<br/><br/>
|
|
410
|
+
<b>${newLabel}</b>.
|
|
411
|
+
<br/><br/>
|
|
412
|
+
${this.getMessage('snkFormConfig.alert.infoValidTitle')}
|
|
413
|
+
`;
|
|
414
|
+
}
|
|
415
|
+
renderFields(fields) {
|
|
416
|
+
if (fields.length === 0)
|
|
417
|
+
return;
|
|
418
|
+
return fields.map(field => (h("snk-dynaform-field-item", { key: field.name, fieldConfig: field, onLayoutConfig: true, dataUnit: this.dataUnit, messagesBuilder: this.messagesBuilder, onSetFieldAsAvailable: (e) => this.handleSetFieldAsAvailable(e.detail) })));
|
|
419
|
+
}
|
|
420
|
+
renderDraggableGroups() {
|
|
421
|
+
const draggableGroups = this.groupsList.filter(g => g.name !== GROUP_NAMES.noGroup);
|
|
422
|
+
return (draggableGroups.map((group, index) => {
|
|
423
|
+
var _a;
|
|
424
|
+
return (h("div", { key: group.name, class: 'group-config', "data-group-name": group.name }, h("ez-collapsible-box", { ref: ref => this.groupsRefList[index] = ref, label: group.name, headerSize: "large", editable: true, removable: true, "icon-placement": "left", onEzRemove: () => this.removeGroup(group), onEzSaveEditLabel: (event => this.handleRenameGroup(event)), onEzEditLabelMode: ({ detail }) => this.isEditingGroupName.emit(detail), conditionalSave: (newLabel) => this.canSaveGroup(newLabel, index) }, h("div", { id: this.getFieldsContainerId(group.name), class: `group-content ${!((_a = group.fields) === null || _a === void 0 ? void 0 : _a.length) ? 'empty-content' : ''}`, "data-group-name": group.name }, this.renderFields(group.fields)))));
|
|
425
|
+
}));
|
|
426
|
+
}
|
|
427
|
+
renderFixedFields() {
|
|
428
|
+
var _a, _b;
|
|
429
|
+
const noGroupFields = (_b = (_a = this.groupsList.find(g => g.name === GROUP_NAMES.noGroup)) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : [];
|
|
430
|
+
return this.renderFields(noGroupFields);
|
|
431
|
+
}
|
|
432
|
+
handleRenameGuide(editDetails) {
|
|
433
|
+
const { value: actualValue, newValue } = editDetails.detail;
|
|
434
|
+
this.isEditGuideNameActive = false;
|
|
435
|
+
if (newValue === actualValue) {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
const duplicatedName = this.guideNames.includes(newValue.toLowerCase());
|
|
439
|
+
const forbiddenName = this.reservedGuideNames.includes(newValue.toLowerCase());
|
|
440
|
+
if (forbiddenName || duplicatedName) {
|
|
441
|
+
const title = this.getMessage('snkFormConfig.confirm.title');
|
|
442
|
+
const message = forbiddenName ? this.buildReservedTabNameContent(newValue) : this.buildDuplicatedTabNameContent(newValue);
|
|
443
|
+
ApplicationUtils.alert(title, message).then(() => this._refTextEdit.applyFocusSelect());
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
this.guideRenamed.emit(newValue);
|
|
447
|
+
}
|
|
448
|
+
cancelEditGuideName() {
|
|
449
|
+
this.isEditGuideNameActive = false;
|
|
450
|
+
}
|
|
451
|
+
async startGuideNameEdition() {
|
|
452
|
+
this.isEditGuideNameActive = true;
|
|
453
|
+
setTimeout(async () => {
|
|
454
|
+
await this._refTextEdit.applyFocusSelect();
|
|
455
|
+
}, 200);
|
|
456
|
+
}
|
|
457
|
+
getTextEditStyle() {
|
|
458
|
+
return {
|
|
459
|
+
fontSize: '20px',
|
|
460
|
+
fontWeight: '500',
|
|
461
|
+
fontFamily: 'Roboto',
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
renderGuideName() {
|
|
465
|
+
var _a, _b;
|
|
466
|
+
if (this.isEditGuideNameActive) {
|
|
467
|
+
return (h("div", { class: 'guide-header' }, h("ez-text-edit", { class: "collapsible-box__text-edit", ref: ref => this._refTextEdit = ref, value: (_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.label, styled: this.getTextEditStyle(), onSaveEdition: (ev) => this.handleRenameGuide(ev), onCancelEdition: () => this.cancelEditGuideName() })));
|
|
468
|
+
}
|
|
469
|
+
return (h("div", { class: 'guide-header' }, h("span", { class: 'guide-header-label' }, (_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.label), this.renderEditGuideNameButton()));
|
|
470
|
+
}
|
|
471
|
+
renderEditGuideNameButton() {
|
|
472
|
+
var _a;
|
|
473
|
+
if (this.isMainSection || ((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.name) === TAB_NAMES.main)
|
|
474
|
+
return;
|
|
475
|
+
return (h("ez-button", { mode: "icon", class: "ez-button--tertiary", onClick: () => this.startGuideNameEdition(), size: "medium", iconName: 'edit', title: this.getMessage('snkFormConfig.buttons.rename') }));
|
|
476
|
+
}
|
|
477
|
+
setCustomCSSProperties() {
|
|
478
|
+
document.documentElement.style.setProperty('--empty-content-message', `"${this.getMessage('snkFormConfig.form.labelDropField')}"`);
|
|
479
|
+
document.documentElement.style.setProperty('--no-group-message', `"${this.getMessage('snkFormConfig.form.subTitleInfo')}"`);
|
|
480
|
+
}
|
|
481
|
+
componentWillLoad() {
|
|
482
|
+
var _a;
|
|
483
|
+
this.groupsListMemory = [...((_a = this.groupsList) !== null && _a !== void 0 ? _a : [])];
|
|
484
|
+
}
|
|
485
|
+
componentDidRender() {
|
|
486
|
+
this.destroySortableInstances();
|
|
487
|
+
this.makeGroupsDraggable();
|
|
488
|
+
this.makeDynamicFieldsContainersDraggable();
|
|
489
|
+
this.makeFieldContainerDraggable(this.getNoGroupContainerId());
|
|
490
|
+
this.setCustomCSSProperties();
|
|
491
|
+
}
|
|
492
|
+
disconnectedCallback() {
|
|
493
|
+
this.destroySortableInstances();
|
|
494
|
+
}
|
|
495
|
+
render() {
|
|
496
|
+
var _a;
|
|
497
|
+
if (!this.selectedGuide) {
|
|
498
|
+
return (h(Host, { class: 'ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container' }, h("span", { class: 'no-guide-selected' }, this.getMessage('snkFormConfig.form.noGuideSelected'))));
|
|
499
|
+
}
|
|
500
|
+
if (this.selectedGuide.isCustom || this.selectedGuide.isDetail) {
|
|
501
|
+
return (h(Host, { class: 'ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container' }, h("div", { class: 'message-container' }, h("h1", { class: 'no-guide-selected' }, this.getMessage('snkFormConfig.form.canNotEditCustomGuide')), h("span", { class: 'message-config-detail' }, this.getMessage('snkFormConfig.form.canNotEditDetailGuide')))));
|
|
502
|
+
}
|
|
503
|
+
const isMain = this.isMainSection || ((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.name) === TAB_NAMES.main;
|
|
504
|
+
const hostClass = `ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container${isMain ? ' is-main-section' : ''}`;
|
|
505
|
+
return (h(Host, { class: hostClass }, this.renderGuideName(), h("div", { class: 'layout-container' }, h("ez-scroller", { direction: 'vertical', activeShadow: true }, h("div", { class: 'no-group-container' }, h("div", { id: this.getNoGroupContainerId(), class: 'group-content', "data-group-name": GROUP_NAMES.noGroup }, this.renderFixedFields())), h("hr", null), h("div", { id: this.getGroupsContainerId(), class: 'groups-container' }, this.renderDraggableGroups()))), h("div", { class: 'add-group-container', onClick: this.handleAddGroup.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus" }), h("span", null, this.getMessage('snkFormConfig.form.createNewGroup')))));
|
|
506
|
+
}
|
|
507
|
+
get el() { return getElement(this); }
|
|
508
|
+
static get watchers() { return {
|
|
509
|
+
"messagesBuilder": ["onMessagesBuilderChange"],
|
|
510
|
+
"selectedGuide": ["observeSelectedGuide"],
|
|
511
|
+
"groupsList": ["observeGroupList"],
|
|
512
|
+
"isEditGuideNameActive": ["observeIsEditGuideNameActive"]
|
|
513
|
+
}; }
|
|
514
|
+
};
|
|
515
|
+
SnkDynaformFieldsLayout.style = snkDynaformFieldsLayoutCss;
|
|
516
|
+
|
|
517
|
+
const snkDynaformFieldsSelectorCss = ".sc-snk-dynaform-fields-selector-h{width:33.33333%;display:flex;box-shadow:var(--shadow--small, 0 0 16px rgba(0, 38, 111, 0.07));border-radius:var(--border--radius-medium, 6px);height:var(--snk-form-config-container-height);max-width:260px}.fields-label.sc-snk-dynaform-fields-selector{display:block;font-size:16px;font-weight:500;width:100%}.fields-count.sc-snk-dynaform-fields-selector{display:block;color:#AFB6C0;font-size:14px;padding:12px 0;font-weight:400;width:100%}.fields-container.sc-snk-dynaform-fields-selector{display:flex;flex-direction:column;gap:12px;height:calc(100vh - 220px);width:100%}.ghost.sc-snk-dynaform-fields-selector{opacity:.5;background:#c8fbe2}.filter-input.sc-snk-dynaform-fields-selector{padding-right:var(--space--2xs, 8px)}";
|
|
518
|
+
|
|
519
|
+
const SnkDynaformFieldsSelector = class {
|
|
520
|
+
constructor(hostRef) {
|
|
521
|
+
registerInstance(this, hostRef);
|
|
522
|
+
this.fieldListChanged = createEvent(this, "fieldListChanged", 7);
|
|
523
|
+
this.availableFields = [];
|
|
524
|
+
this.dataUnit = undefined;
|
|
525
|
+
this.filterTerm = '';
|
|
526
|
+
this.messagesBuilder = undefined;
|
|
527
|
+
}
|
|
528
|
+
onAddField(evt) {
|
|
529
|
+
const newIndex = evt.newIndex;
|
|
530
|
+
const item = evt.item;
|
|
531
|
+
const fieldConfig = item.fieldConfig;
|
|
532
|
+
const updatedFields = this.addItemInPosition(newIndex, fieldConfig);
|
|
533
|
+
this.fieldListChanged.emit(updatedFields);
|
|
534
|
+
}
|
|
535
|
+
addItemInPosition(newIndex, fieldConfig) {
|
|
536
|
+
return [
|
|
537
|
+
...this.availableFields.slice(0, newIndex),
|
|
538
|
+
fieldConfig,
|
|
539
|
+
...this.availableFields.slice(newIndex),
|
|
540
|
+
];
|
|
541
|
+
}
|
|
542
|
+
onRemoveField(evt) {
|
|
543
|
+
const item = evt.item;
|
|
544
|
+
const fieldName = item.fieldConfig.name;
|
|
545
|
+
const updatedFields = [...this.availableFields.filter(f => f.name !== fieldName)];
|
|
546
|
+
this.fieldListChanged.emit(updatedFields);
|
|
547
|
+
requestAnimationFrame(() => item.remove());
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
renderFields() {
|
|
551
|
+
const fieldsToShow = ArrayUtils.applyStringFilter(this.filterTerm, this.availableFields);
|
|
552
|
+
return fieldsToShow.map(field => (h("snk-dynaform-field-item", { key: field.name, dataUnit: this.dataUnit, fieldConfig: field, messagesBuilder: this.messagesBuilder })));
|
|
553
|
+
}
|
|
554
|
+
getCountText() {
|
|
555
|
+
if (!this.availableFields.length)
|
|
556
|
+
return this.getMessage('snkFormConfig.availableFields.labelNoFields');
|
|
557
|
+
if (this.availableFields.length === 1)
|
|
558
|
+
return this.getMessage('snkFormConfig.availableFields.labelOneField');
|
|
559
|
+
return `${this.availableFields.length} ${this.getMessage('snkFormConfig.availableFields.labelAvailableFields')}`;
|
|
560
|
+
}
|
|
561
|
+
initializeDraggableContainer() {
|
|
562
|
+
new Sortable(this.el.querySelector(`#${ID_AVAILABLE_FIELDS}`), {
|
|
563
|
+
group: 'fields',
|
|
564
|
+
direction: 'vertical',
|
|
565
|
+
ghostClass: 'ghost',
|
|
566
|
+
animation: 15,
|
|
567
|
+
onAdd: (evt) => this.onAddField(evt),
|
|
568
|
+
onRemove: (evt) => this.onRemoveField(evt),
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
getMessage(key, params) {
|
|
572
|
+
var _a;
|
|
573
|
+
return (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params);
|
|
574
|
+
}
|
|
575
|
+
componentDidRender() {
|
|
576
|
+
this.initializeDraggableContainer();
|
|
577
|
+
}
|
|
578
|
+
render() {
|
|
579
|
+
return (h(Host, { class: 'ez-col ez-col--sd-4 ez-col--tb-4 ez-padding--medium' }, h("span", { class: 'fields-label ez-padding-bottom--small' }, this.getMessage('snkFormConfig.availableFields.title')), h("ez-filter-input", { class: 'filter-input', slot: "content", mode: "slim", label: this.getMessage('snkFormConfig.availableFields.labelSearchField'), onEzChange: evt => this.filterTerm = evt.detail }), h("span", { class: 'fields-count' }, this.getCountText()), h("ez-scroller", { direction: 'vertical', activeShadow: true }, h("div", { id: ID_AVAILABLE_FIELDS, class: 'fields-container' }, this.renderFields()))));
|
|
580
|
+
}
|
|
581
|
+
get el() { return getElement(this); }
|
|
582
|
+
};
|
|
583
|
+
SnkDynaformFieldsSelector.style = snkDynaformFieldsSelectorCss;
|
|
584
|
+
|
|
585
|
+
const snkDynaformGuidesConfiguratorCss = ".guides-tab-configurator.sc-snk-dynaform-guides-configurator{display:flex;flex-direction:column;width:100%;gap:var(--spece--8, 8px)}.tab-bar-row.sc-snk-dynaform-guides-configurator{display:flex;flex-direction:row;align-items:center;gap:var(--space--12, 12px);width:100%}.guides-tabselector.sc-snk-dynaform-guides-configurator{flex:1;min-width:0}.tab-actions.sc-snk-dynaform-guides-configurator{display:inline-flex;align-items:center;gap:var(--space--2, 2px);margin-left:var(--space--6, 6px)}.tab-actions.sc-snk-dynaform-guides-configurator ez-button.sc-snk-dynaform-guides-configurator{width:var(--space--20, 20px);align-items:center;justify-content:center;display:flex}.hidden-guides-bar.sc-snk-dynaform-guides-configurator{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;gap:var(--space--8, 8px);padding:var(--space--8, 8px) 0;border-top:1px solid #dce0e8}.hidden-guides-label.sc-snk-dynaform-guides-configurator{font-size:var(--space--12, 12px);color:#afb6c0;white-space:nowrap}.hidden-guide-chip.sc-snk-dynaform-guides-configurator{display:flex;align-items:center;gap:4px;padding:2px var(--space--8, 8px);border:1px solid #dce0e8;border-radius:var(--space--12, 12px);background:#f5f7fa;transition:background 0.15s ease-in-out}.hidden-guide-chip.sc-snk-dynaform-guides-configurator:hover{background:#e2eaf4}.hidden-guide-chip.sc-snk-dynaform-guides-configurator ez-button.sc-snk-dynaform-guides-configurator{width:var(--space--20, 20px);align-items:center;justify-content:center;display:flex}.chip-label.sc-snk-dynaform-guides-configurator{font-size:13px;max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}";
|
|
586
|
+
|
|
587
|
+
const SnkDynaformGuidesConfigurator = class {
|
|
588
|
+
constructor(hostRef) {
|
|
589
|
+
registerInstance(this, hostRef);
|
|
590
|
+
this.guideSelected = createEvent(this, "guideSelected", 7);
|
|
591
|
+
this.guideListChanged = createEvent(this, "guideListChanged", 7);
|
|
592
|
+
this.guideDeleted = createEvent(this, "guideDeleted", 7);
|
|
593
|
+
this.createNewGuide = createEvent(this, "createNewGuide", 7);
|
|
594
|
+
this.sortLogic = (a, b) => {
|
|
595
|
+
var _a, _b;
|
|
596
|
+
const orderA = (_a = a.order) !== null && _a !== void 0 ? _a : Number.MAX_VALUE;
|
|
597
|
+
const orderB = (_b = b.order) !== null && _b !== void 0 ? _b : Number.MAX_VALUE;
|
|
598
|
+
return orderA - orderB;
|
|
599
|
+
};
|
|
600
|
+
this.handleAddGuide = () => {
|
|
601
|
+
this.createNewGuide.emit();
|
|
602
|
+
};
|
|
603
|
+
this.mainGuide = undefined;
|
|
604
|
+
this.visibleGuides = [];
|
|
605
|
+
this.hiddenGuides = [];
|
|
606
|
+
this.guidesList = [];
|
|
607
|
+
this.selectedGuide = undefined;
|
|
608
|
+
this.mainGuideName = undefined;
|
|
609
|
+
this.messagesBuilder = undefined;
|
|
610
|
+
}
|
|
611
|
+
observeGuidesList(newGuides) {
|
|
612
|
+
this.initGuidesConfig(newGuides);
|
|
613
|
+
}
|
|
614
|
+
observeMainGuideName() {
|
|
615
|
+
this.initGuidesConfig(this.guidesList);
|
|
616
|
+
}
|
|
617
|
+
observeSelectedGuide(newGuide) {
|
|
618
|
+
this.guideSelected.emit(newGuide);
|
|
619
|
+
}
|
|
620
|
+
componentWillLoad() {
|
|
621
|
+
this.initGuidesConfig(this.guidesList);
|
|
622
|
+
}
|
|
623
|
+
getMessage(key, params) {
|
|
624
|
+
return this.messagesBuilder.getMessage(key, params);
|
|
625
|
+
}
|
|
626
|
+
initGuidesConfig(newGuides) {
|
|
627
|
+
const mainName = this.mainGuideName;
|
|
628
|
+
const isMain = (guide) => !!mainName && guide.name === mainName;
|
|
629
|
+
const visibleAux = newGuides.filter(guide => guide.visible && !isMain(guide));
|
|
630
|
+
const hiddenAux = newGuides.filter(guide => !guide.visible && !isMain(guide));
|
|
631
|
+
this.visibleGuides = [...visibleAux].sort(this.sortLogic);
|
|
632
|
+
this.hiddenGuides = [...hiddenAux].sort(this.sortLogic);
|
|
633
|
+
this.mainGuide = newGuides.find(g => isMain(g));
|
|
634
|
+
}
|
|
635
|
+
handleSelectGuide(guide, evt) {
|
|
636
|
+
evt.stopPropagation();
|
|
637
|
+
this.selectedGuide = guide;
|
|
638
|
+
}
|
|
639
|
+
toggleGuideVisibility(guide, evt) {
|
|
640
|
+
evt.stopPropagation();
|
|
641
|
+
const updatedGuide = Object.assign(Object.assign({}, guide), { visible: !guide.visible });
|
|
642
|
+
let visibleAux;
|
|
643
|
+
let hiddenAux;
|
|
644
|
+
if (guide.visible) {
|
|
645
|
+
visibleAux = this.visibleGuides.filter(g => g.name !== guide.name);
|
|
646
|
+
hiddenAux = [...this.hiddenGuides, updatedGuide];
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
visibleAux = [...this.visibleGuides, updatedGuide];
|
|
650
|
+
hiddenAux = this.hiddenGuides.filter(g => g.name !== guide.name);
|
|
651
|
+
}
|
|
652
|
+
this.applyGuidesUpdate([...visibleAux, ...hiddenAux]);
|
|
653
|
+
}
|
|
654
|
+
adjustListOrder(guideList) {
|
|
655
|
+
return guideList.map((g, index) => (Object.assign(Object.assign({}, g), { order: index })));
|
|
656
|
+
}
|
|
657
|
+
applyGuidesUpdate(updatedGuideList) {
|
|
658
|
+
let newGuidesList = this.adjustListOrder(updatedGuideList);
|
|
659
|
+
if (this.mainGuide) {
|
|
660
|
+
newGuidesList = [this.mainGuide, ...newGuidesList];
|
|
661
|
+
}
|
|
662
|
+
if (!ObjectUtils.equals(newGuidesList, this.guidesList)) {
|
|
663
|
+
this.guideListChanged.emit(newGuidesList);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
async handleDeleteGuide(guide, e) {
|
|
667
|
+
e.stopPropagation();
|
|
668
|
+
const title = this.getMessage('snkFormConfig.confirm.title');
|
|
669
|
+
const message = this.getMessage('snkFormConfig.confirm.deleteGuide').replace('{0}', guide.label);
|
|
670
|
+
const canRemove = await ApplicationUtils.confirm(title, message);
|
|
671
|
+
if (!canRemove)
|
|
672
|
+
return;
|
|
673
|
+
this.guideDeleted.emit(guide);
|
|
674
|
+
const deletedMessage = this.getMessage('snkFormConfig.info.successfullyGuideDeleted').replace('{0}', guide.label);
|
|
675
|
+
ApplicationUtils.info(deletedMessage);
|
|
676
|
+
}
|
|
677
|
+
buildTabs() {
|
|
678
|
+
return this.visibleGuides.map((guide, i) => ({
|
|
679
|
+
tabKey: guide.name,
|
|
680
|
+
label: guide.label,
|
|
681
|
+
index: i,
|
|
682
|
+
}));
|
|
683
|
+
}
|
|
684
|
+
handleTabChange(tab) {
|
|
685
|
+
var _a;
|
|
686
|
+
if (!tab)
|
|
687
|
+
return;
|
|
688
|
+
const guide = this.guidesList.find(g => g.name === tab.tabKey);
|
|
689
|
+
if (guide && guide.name !== ((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.name)) {
|
|
690
|
+
this.selectedGuide = guide;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
handleReorder(reorderedTabs) {
|
|
694
|
+
const visibleReordered = reorderedTabs
|
|
695
|
+
.map(t => this.visibleGuides.find(g => g.name === t.tabKey))
|
|
696
|
+
.filter(Boolean);
|
|
697
|
+
this.applyGuidesUpdate([...visibleReordered, ...this.hiddenGuides]);
|
|
698
|
+
}
|
|
699
|
+
renderTabActions() {
|
|
700
|
+
return this.visibleGuides.map((guide, i) => {
|
|
701
|
+
const slotIndex = i;
|
|
702
|
+
const isProtected = guide.isCustom || guide.isDetail;
|
|
703
|
+
return (h("div", { key: guide.name, slot: `tab${slotIndex}`, class: "tab-actions", onClick: (e) => e.stopPropagation() }, h("ez-button", { mode: "icon", class: "ez-button--tertiary tab-action-btn", size: "small", iconName: "eye-off", title: this.getMessage('snkFormConfig.guidesConfigurator.actions.hide'), onClick: (e) => this.toggleGuideVisibility(guide, e) }), h("ez-button", { mode: "icon", class: "ez-button--tertiary tab-action-btn", size: "small", iconName: "delete", isDisabled: isProtected, title: isProtected
|
|
704
|
+
? this.getMessage('snkFormConfig.guidesConfigurator.canNotDeleteCustomGuide')
|
|
705
|
+
: this.getMessage('snkFormConfig.guidesConfigurator.actions.delete'), onClick: (e) => this.handleDeleteGuide(guide, e) })));
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
renderHiddenGuidesBar() {
|
|
709
|
+
if (this.hiddenGuides.length === 0)
|
|
710
|
+
return null;
|
|
711
|
+
return (h("div", { class: "hidden-guides-bar" }, h("span", { class: "hidden-guides-label" }, this.getMessage('snkFormConfig.guidesConfigurator.hiddenGuides'), ":"), this.hiddenGuides.map(guide => {
|
|
712
|
+
const isProtected = guide.isCustom || guide.isDetail;
|
|
713
|
+
return (h("div", { key: guide.name, class: "hidden-guide-chip", title: guide.label }, h("span", { class: "chip-label", onClick: (e) => this.handleSelectGuide(guide, e) }, guide.label), h("ez-button", { mode: "icon", class: "ez-button--tertiary", size: "small", iconName: "eye", title: this.getMessage('snkFormConfig.guidesConfigurator.actions.show'), onClick: (e) => this.toggleGuideVisibility(guide, e) }), h("ez-button", { mode: "icon", class: "ez-button--tertiary", size: "small", iconName: "delete", isDisabled: isProtected, title: isProtected
|
|
714
|
+
? this.getMessage('snkFormConfig.guidesConfigurator.canNotDeleteCustomGuide')
|
|
715
|
+
: this.getMessage('snkFormConfig.guidesConfigurator.actions.delete'), onClick: (e) => this.handleDeleteGuide(guide, e) })));
|
|
716
|
+
})));
|
|
717
|
+
}
|
|
718
|
+
render() {
|
|
719
|
+
var _a;
|
|
720
|
+
const tabs = this.buildTabs();
|
|
721
|
+
return (h("div", { class: "guides-tab-configurator" }, h("div", { class: "tab-bar-row" }, h("ez-tabselector", { class: "guides-tabselector", tabs: tabs, selectedTab: (_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.name, reorderable: true, onEzChange: (evt) => this.handleTabChange(evt.detail), onEzReorder: (evt) => this.handleReorder(evt.detail) }, this.renderTabActions()), h("ez-button", { label: this.getMessage('snkFormConfig.guidesConfigurator.createNewGuide'), variant: "secondary", size: "medium", leftIconName: "plus", onClick: this.handleAddGuide })), this.renderHiddenGuidesBar()));
|
|
722
|
+
}
|
|
723
|
+
static get watchers() { return {
|
|
724
|
+
"guidesList": ["observeGuidesList"],
|
|
725
|
+
"mainGuideName": ["observeMainGuideName"],
|
|
726
|
+
"selectedGuide": ["observeSelectedGuide"]
|
|
727
|
+
}; }
|
|
728
|
+
};
|
|
729
|
+
SnkDynaformGuidesConfigurator.style = snkDynaformGuidesConfiguratorCss;
|
|
730
|
+
|
|
731
|
+
export { SnkDynaformConfigHeader as snk_dynaform_config_header, SnkDynaformConfigsButton as snk_dynaform_configs_button, SnkDynaformFieldsLayout as snk_dynaform_fields_layout, SnkDynaformFieldsSelector as snk_dynaform_fields_selector, SnkDynaformGuidesConfigurator as snk_dynaform_guides_configurator };
|