@sankhyalabs/sankhyablocks 10.1.0-dev.52 → 10.1.0-dev.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-a1fab5ca.js → ConfigStorage-4201dd3d.js} +2 -2
- package/dist/cjs/{DataFetcher-384d2ce8.js → DataFetcher-b3a8075d.js} +2830 -2
- package/dist/cjs/FormConfigHelper-c5f5473a.js +342 -0
- package/dist/cjs/{ISave-ecbe9336.js → ISave-4674c283.js} +1 -1
- package/dist/cjs/{PersonalizedFilterUtils-eccb267a.js → PersonalizedFilterUtils-263e4d24.js} +52 -5
- package/dist/cjs/{SnkFormConfigManager-44386305.js → SnkFormConfigManager-c3a49038.js} +2 -2
- package/dist/cjs/{SnkMultiSelectionListDataSource-d341dd02.js → SnkMultiSelectionListDataSource-3a13fd34.js} +4 -4
- package/dist/cjs/{auth-fetcher-6b134ec4.js → auth-fetcher-0ecc53ff.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-b9822794.js → dataunit-fetcher-c7e66f0d.js} +13 -4
- package/dist/cjs/{filter-type.enum-2bb46d2a.js → filter-type.enum-b3b388af.js} +7 -0
- package/dist/cjs/{form-config-fetcher-45d1964c.js → form-config-fetcher-f80dbc3b.js} +23 -5
- package/dist/cjs/index-1894343a.js +24 -36
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +4 -5
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_9.cjs.entry.js +5 -6
- package/dist/cjs/snk-application.cjs.entry.js +7 -8
- package/dist/cjs/snk-attach_11.cjs.entry.js +2950 -0
- package/dist/cjs/snk-crud.cjs.entry.js +31 -243
- package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -6
- package/dist/cjs/{snk-data-unit-4b6dc396.js → snk-data-unit-35f10e01.js} +11 -11
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -4
- package/dist/cjs/snk-detail-view.cjs.entry.js +9 -10
- package/dist/cjs/snk-dynaform-config-header_5.cjs.entry.js +739 -0
- package/dist/cjs/snk-dynaform-detail-view_2.cjs.entry.js +938 -0
- package/dist/cjs/snk-dynaform-field-config_2.cjs.entry.js +327 -0
- package/dist/cjs/snk-dynaform-guides-view-e98f7f3a.js +747 -0
- package/dist/cjs/snk-dynaform-guides-view.cjs.entry.js +23 -0
- package/dist/cjs/snk-dynaform.cjs.entry.js +675 -0
- package/dist/cjs/{snk-expression-group_2.cjs.entry.js → snk-expression-group_4.cjs.entry.js} +421 -18
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +41 -44
- package/dist/cjs/snk-form_2.cjs.entry.js +4 -5
- package/dist/cjs/snk-grid.cjs.entry.js +7 -8
- package/dist/cjs/{snk-guides-viewer-8e7a503b.js → snk-guides-viewer-3054d541.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +5 -6
- package/dist/cjs/snk-layout-form-config.cjs.entry.js +4 -5
- package/dist/cjs/snk-pesquisa.cjs.entry.js +4 -5
- package/dist/cjs/taskbarUtils-383c596e.js +231 -0
- package/dist/collection/collection-manifest.json +17 -0
- package/dist/collection/components/snk-dynaform/interfaces/PropsCustomEditor.js +1 -0
- package/dist/collection/components/snk-dynaform/interfaces/PropsCustomRender.js +1 -0
- package/dist/collection/components/snk-dynaform/snk-dynaform.css +64 -0
- package/dist/collection/components/snk-dynaform/snk-dynaform.js +1657 -0
- package/dist/collection/components/snk-dynaform/subcomponents/CardFormResizeObserver.js +26 -0
- package/dist/collection/components/snk-dynaform/subcomponents/GuideBuilder.js +51 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.css +112 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.js +992 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.css +64 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.js +588 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-guides-view/snk-dynaform-guides-view.css +98 -0
- package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-guides-view/snk-dynaform-guides-view.js +1167 -0
- package/dist/collection/components/snk-dynaform-form-config/FormConfigHelper.js +325 -0
- package/dist/collection/components/snk-dynaform-form-config/SnkFormConfigManager.js +212 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.css +17 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.js +236 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.css +41 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.js +170 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.css +22 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.js +408 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-item.css +88 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-item.js +209 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.css +167 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.js +655 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.css +42 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.js +171 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-form-config.css +66 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-form-config.js +557 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.css +80 -0
- package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.js +326 -0
- package/dist/collection/components/snk-grid/snk-grid.css +4 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +11 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +22 -4
- package/dist/components/dataunit-fetcher.js +11 -1
- package/dist/components/form-config-fetcher.js +22 -4
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.js +12 -0
- package/dist/components/snk-crud.js +1 -212
- package/dist/components/snk-dynaform-config-header.d.ts +11 -0
- package/dist/components/snk-dynaform-config-header.js +6 -0
- package/dist/components/snk-dynaform-config-header2.js +103 -0
- package/dist/components/snk-dynaform-configs-button.d.ts +11 -0
- package/dist/components/snk-dynaform-configs-button.js +6 -0
- package/dist/components/snk-dynaform-configs-button2.js +76 -0
- package/dist/components/snk-dynaform-detail-view.d.ts +11 -0
- package/dist/components/snk-dynaform-detail-view.js +6 -0
- package/dist/components/snk-dynaform-detail-view2.js +1835 -0
- package/dist/components/snk-dynaform-field-config.d.ts +11 -0
- package/dist/components/snk-dynaform-field-config.js +6 -0
- package/dist/components/snk-dynaform-field-config2.js +605 -0
- package/dist/components/snk-dynaform-field-item.d.ts +11 -0
- package/dist/components/snk-dynaform-field-item.js +6 -0
- package/dist/components/snk-dynaform-field-item2.js +96 -0
- package/dist/components/snk-dynaform-fields-layout.d.ts +11 -0
- package/dist/components/snk-dynaform-fields-layout.js +6 -0
- package/dist/components/snk-dynaform-fields-layout2.js +428 -0
- package/dist/components/snk-dynaform-fields-selector.d.ts +11 -0
- package/dist/components/snk-dynaform-fields-selector.js +6 -0
- package/dist/components/snk-dynaform-fields-selector2.js +104 -0
- package/dist/components/snk-dynaform-form-config.d.ts +11 -0
- package/dist/components/snk-dynaform-form-config.js +6 -0
- package/dist/components/snk-dynaform-form-config2.js +430 -0
- package/dist/components/snk-dynaform-form-view.d.ts +11 -0
- package/dist/components/snk-dynaform-form-view.js +6 -0
- package/dist/components/snk-dynaform-form-view2.js +270 -0
- package/dist/components/snk-dynaform-guides-configurator.d.ts +11 -0
- package/dist/components/snk-dynaform-guides-configurator.js +6 -0
- package/dist/components/snk-dynaform-guides-configurator2.js +173 -0
- package/dist/components/snk-dynaform-guides-view.d.ts +11 -0
- package/dist/components/snk-dynaform-guides-view.js +6 -0
- package/dist/components/snk-dynaform.d.ts +11 -0
- package/dist/components/snk-dynaform.js +1003 -0
- package/dist/components/snk-grid2.js +1 -1
- package/dist/components/taskbarUtils.js +224 -0
- package/dist/esm/{ConfigStorage-76872695.js → ConfigStorage-e834d1ea.js} +2 -2
- package/dist/esm/{DataFetcher-e60f8d53.js → DataFetcher-5ed0a377.js} +2830 -3
- package/dist/esm/FormConfigHelper-efc29480.js +328 -0
- package/dist/esm/{ISave-4929c071.js → ISave-5b46d691.js} +1 -1
- package/dist/esm/{PersonalizedFilterUtils-d2439a9a.js → PersonalizedFilterUtils-45b5803c.js} +49 -2
- package/dist/esm/{SnkFormConfigManager-83f6b22f.js → SnkFormConfigManager-bfd575c2.js} +2 -2
- package/dist/esm/{SnkMultiSelectionListDataSource-18abafb1.js → SnkMultiSelectionListDataSource-22b50dd6.js} +4 -4
- package/dist/esm/{auth-fetcher-1a31c1e4.js → auth-fetcher-5283045d.js} +1 -1
- package/dist/esm/{dataunit-fetcher-c176e002.js → dataunit-fetcher-2200fdd6.js} +12 -3
- package/dist/esm/{filter-type.enum-f6a8fe23.js → filter-type.enum-62b7fe88.js} +8 -1
- package/dist/esm/{form-config-fetcher-b44b2727.js → form-config-fetcher-db1bf140.js} +23 -5
- package/dist/esm/index-04f73a26.js +24 -36
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-grid_2.entry.js +4 -5
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_9.entry.js +5 -6
- package/dist/esm/snk-application.entry.js +6 -7
- package/dist/esm/snk-attach_11.entry.js +2936 -0
- package/dist/esm/snk-crud.entry.js +6 -218
- package/dist/esm/snk-data-exporter.entry.js +5 -6
- package/dist/esm/{snk-data-unit-d8cfa950.js → snk-data-unit-e8bd4143.js} +2 -2
- package/dist/esm/snk-data-unit.entry.js +3 -4
- package/dist/esm/snk-detail-view.entry.js +7 -8
- package/dist/esm/snk-dynaform-config-header_5.entry.js +731 -0
- package/dist/esm/snk-dynaform-detail-view_2.entry.js +933 -0
- package/dist/esm/snk-dynaform-field-config_2.entry.js +322 -0
- package/dist/esm/snk-dynaform-guides-view-1f1455d6.js +744 -0
- package/dist/esm/snk-dynaform-guides-view.entry.js +15 -0
- package/dist/esm/snk-dynaform.entry.js +671 -0
- package/dist/esm/{snk-expression-group_2.entry.js → snk-expression-group_4.entry.js} +405 -4
- package/dist/esm/snk-filter-bar_4.entry.js +5 -8
- package/dist/esm/snk-form_2.entry.js +4 -5
- package/dist/esm/snk-grid.entry.js +7 -8
- package/dist/esm/{snk-guides-viewer-adf39ea2.js → snk-guides-viewer-95fefcaa.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +5 -6
- package/dist/esm/snk-layout-form-config.entry.js +4 -5
- package/dist/esm/snk-pesquisa.entry.js +4 -5
- package/dist/esm/taskbarUtils-682ca78c.js +225 -0
- package/dist/sankhyablocks/p-06b6c284.entry.js +1 -0
- package/dist/sankhyablocks/p-09e2255b.entry.js +1 -0
- package/dist/sankhyablocks/p-0dbd53d9.js +1 -0
- package/dist/sankhyablocks/{p-5c250661.js → p-1a04f537.js} +1 -1
- package/dist/sankhyablocks/{p-ab5e12fa.js → p-1cc4cf61.js} +1 -1
- package/dist/sankhyablocks/{p-f5ad0720.js → p-2040953e.js} +1 -1
- package/dist/sankhyablocks/p-22ddc1a5.entry.js +1 -0
- package/dist/sankhyablocks/p-24b059ee.entry.js +1 -0
- package/dist/sankhyablocks/p-2b581179.entry.js +1 -0
- package/dist/sankhyablocks/p-449dfe55.entry.js +1 -0
- package/dist/sankhyablocks/p-451b5bcc.entry.js +1 -0
- package/dist/sankhyablocks/p-46d7e2de.js +1 -0
- package/dist/sankhyablocks/{p-3c990841.js → p-51e853f2.js} +1 -1
- package/dist/sankhyablocks/p-51f1485c.entry.js +1 -0
- package/dist/sankhyablocks/p-58709cf9.js +1 -0
- package/dist/sankhyablocks/p-589016e2.entry.js +1 -0
- package/dist/sankhyablocks/p-5c6eede7.js +60 -0
- package/dist/sankhyablocks/p-5d02c032.js +1 -0
- package/dist/sankhyablocks/p-5d50f59a.entry.js +1 -0
- package/dist/sankhyablocks/p-670c43e3.entry.js +1 -0
- package/dist/sankhyablocks/{p-b1bb4cf1.js → p-70c2ee5c.js} +1 -1
- package/dist/sankhyablocks/p-77c26de0.js +1 -0
- package/dist/sankhyablocks/p-92c71225.entry.js +1 -0
- package/dist/sankhyablocks/p-9c89a76a.entry.js +1 -0
- package/dist/sankhyablocks/{p-4f7adf97.js → p-b1bf9564.js} +1 -1
- package/dist/sankhyablocks/p-c538bd6c.entry.js +1 -0
- package/dist/sankhyablocks/p-ccd61eb8.entry.js +1 -0
- package/dist/sankhyablocks/{p-3704bf1b.js → p-d5810110.js} +1 -1
- package/dist/sankhyablocks/p-d88278f8.js +28 -0
- package/dist/sankhyablocks/p-dc45e9e5.entry.js +1 -0
- package/dist/sankhyablocks/{p-8fe740b7.entry.js → p-dc83c70f.entry.js} +2 -2
- package/dist/sankhyablocks/p-e5362a5c.js +1 -0
- package/dist/sankhyablocks/p-edd44079.entry.js +1 -0
- package/dist/sankhyablocks/p-eff38390.entry.js +1 -0
- package/dist/sankhyablocks/p-ff28e5e4.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-dynaform/interfaces/PropsCustomEditor.d.ts +4 -0
- package/dist/types/components/snk-dynaform/interfaces/PropsCustomRender.d.ts +4 -0
- package/dist/types/components/snk-dynaform/subcomponents/CardFormResizeObserver.d.ts +1 -0
- package/dist/types/components/snk-dynaform/subcomponents/GuideBuilder.d.ts +14 -0
- package/dist/types/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.d.ts +158 -0
- package/dist/types/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.d.ts +107 -0
- package/dist/types/components/snk-dynaform-form-config/FormConfigHelper.d.ts +36 -0
- package/dist/types/components/snk-dynaform-form-config/SnkFormConfigManager.d.ts +35 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.d.ts +23 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.d.ts +19 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.d.ts +56 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.d.ts +74 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.d.ts +21 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-form-config.d.ts +95 -0
- package/dist/types/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.d.ts +35 -0
- package/dist/types/components.d.ts +2403 -1322
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +1 -0
- package/package.json +5 -1
- package/react/components.d.ts +12 -0
- package/react/components.js +12 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/SnkMessageBuilder-a9300ebe.js +0 -2833
- package/dist/cjs/default-filters-a09bf82b.js +0 -8
- package/dist/cjs/index-62760a9c.js +0 -49
- package/dist/cjs/index-8d94b7e0.js +0 -7
- package/dist/cjs/snk-attach.cjs.entry.js +0 -948
- package/dist/cjs/snk-default-filter.cjs.entry.js +0 -77
- package/dist/cjs/snk-filter-advanced-mode_3.cjs.entry.js +0 -99
- package/dist/cjs/snk-filter-detail.cjs.entry.js +0 -198
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +0 -408
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +0 -109
- package/dist/cjs/snk-image-input.cjs.entry.js +0 -160
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +0 -358
- package/dist/cjs/snk-simple-crud.cjs.entry.js +0 -865
- package/dist/esm/SnkMessageBuilder-1eb7a1af.js +0 -2831
- package/dist/esm/default-filters-50105e43.js +0 -8
- package/dist/esm/index-620ac460.js +0 -7
- package/dist/esm/index-8acbae97.js +0 -49
- package/dist/esm/snk-attach.entry.js +0 -944
- package/dist/esm/snk-default-filter.entry.js +0 -73
- package/dist/esm/snk-filter-advanced-mode_3.entry.js +0 -93
- package/dist/esm/snk-filter-detail.entry.js +0 -194
- package/dist/esm/snk-filter-field-search_2.entry.js +0 -403
- package/dist/esm/snk-filter-modal-item.entry.js +0 -105
- package/dist/esm/snk-image-input.entry.js +0 -156
- package/dist/esm/snk-personalized-filter.entry.js +0 -354
- package/dist/esm/snk-simple-crud.entry.js +0 -861
- package/dist/sankhyablocks/p-0a4cdcde.entry.js +0 -1
- package/dist/sankhyablocks/p-0afc64df.entry.js +0 -1
- package/dist/sankhyablocks/p-10f27dc6.entry.js +0 -1
- package/dist/sankhyablocks/p-20f03230.entry.js +0 -1
- package/dist/sankhyablocks/p-2af8aca3.js +0 -1
- package/dist/sankhyablocks/p-3870748a.js +0 -28
- package/dist/sankhyablocks/p-3d294185.entry.js +0 -1
- package/dist/sankhyablocks/p-438a225f.entry.js +0 -1
- package/dist/sankhyablocks/p-4d04bc75.entry.js +0 -1
- package/dist/sankhyablocks/p-554c0e54.js +0 -1
- package/dist/sankhyablocks/p-57c184a2.entry.js +0 -1
- package/dist/sankhyablocks/p-68c1a093.js +0 -1
- package/dist/sankhyablocks/p-6a4b21dd.js +0 -1
- package/dist/sankhyablocks/p-6ae7543b.entry.js +0 -1
- package/dist/sankhyablocks/p-6e278003.js +0 -60
- package/dist/sankhyablocks/p-82bcb4cf.entry.js +0 -1
- package/dist/sankhyablocks/p-84345e7a.js +0 -1
- package/dist/sankhyablocks/p-95af0bb1.entry.js +0 -1
- package/dist/sankhyablocks/p-a905712a.entry.js +0 -1
- package/dist/sankhyablocks/p-aff2d081.entry.js +0 -1
- package/dist/sankhyablocks/p-b0a357b4.entry.js +0 -1
- package/dist/sankhyablocks/p-b568c1d4.js +0 -1
- package/dist/sankhyablocks/p-bab4cde4.entry.js +0 -1
- package/dist/sankhyablocks/p-bd3c1aaa.entry.js +0 -1
- package/dist/sankhyablocks/p-cc64239c.entry.js +0 -1
- package/dist/sankhyablocks/p-cd00a3d1.entry.js +0 -1
- package/dist/sankhyablocks/p-d9ec8c4b.entry.js +0 -1
- package/dist/sankhyablocks/p-dbdbb77a.entry.js +0 -1
- package/dist/sankhyablocks/p-e8df1dea.entry.js +0 -1
- package/dist/sankhyablocks/p-ef9343c3.entry.js +0 -1
- package/dist/sankhyablocks/p-f4184ce7.js +0 -1
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { DataType, UserInterface } from '@sankhyalabs/core';
|
|
2
|
+
import { DEFAULT_TYPE, GROUP_NAMES, TAB_NAMES } from '../../lib/utils/constants';
|
|
3
|
+
const iconMap = new Map([
|
|
4
|
+
[UserInterface.DATE, 'calendar'],
|
|
5
|
+
[UserInterface.DATETIME, 'calendar-clock'],
|
|
6
|
+
[UserInterface.ELAPSEDTIME, 'timer-outline'],
|
|
7
|
+
[UserInterface.TIME, 'timer-outline'],
|
|
8
|
+
[UserInterface.DECIMALNUMBER, 'number'],
|
|
9
|
+
[UserInterface.INTEGERNUMBER, 'number'],
|
|
10
|
+
[UserInterface.FILE, 'zip'],
|
|
11
|
+
[UserInterface.IMAGE, 'pdf'],
|
|
12
|
+
[UserInterface.HTML, 'tag_code'],
|
|
13
|
+
[UserInterface.SEARCH, 'search'],
|
|
14
|
+
[UserInterface.SEARCHPLUS, 'search'],
|
|
15
|
+
[UserInterface.OPTIONSELECTOR, 'list'],
|
|
16
|
+
[UserInterface.CHECKBOX, 'list'],
|
|
17
|
+
[UserInterface.SWITCH, 'boolean'],
|
|
18
|
+
[UserInterface.PASSWORD, 'eye-off'],
|
|
19
|
+
]);
|
|
20
|
+
export const ID_AVAILABLE_FIELDS = 'container-available-fields';
|
|
21
|
+
export var SORTABLE_PATH;
|
|
22
|
+
(function (SORTABLE_PATH) {
|
|
23
|
+
SORTABLE_PATH["FROM"] = "from";
|
|
24
|
+
SORTABLE_PATH["TO"] = "to";
|
|
25
|
+
})(SORTABLE_PATH || (SORTABLE_PATH = {}));
|
|
26
|
+
export function getFieldsStructure(evt, path, group, tab) {
|
|
27
|
+
var _a;
|
|
28
|
+
const htmlStructure = (_a = evt === null || evt === void 0 ? void 0 : evt[path]) === null || _a === void 0 ? void 0 : _a.children;
|
|
29
|
+
if (!htmlStructure)
|
|
30
|
+
return [];
|
|
31
|
+
return Array.from(htmlStructure).map(({ fieldConfig }) => {
|
|
32
|
+
return Object.assign(Object.assign({}, fieldConfig), { group, tab });
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export function updateTabInFieldsFromGroupList(guideGroups, updatedName) {
|
|
36
|
+
return guideGroups.map(group => {
|
|
37
|
+
return Object.assign(Object.assign({}, group), { fields: group.fields.map(field => (Object.assign(Object.assign({}, field), { tab: updatedName }))) });
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export function getValidatedFieldValue(fieldValue, dataUnit, fieldName) {
|
|
41
|
+
var _a;
|
|
42
|
+
if (fieldValue == undefined || !dataUnit || !fieldName)
|
|
43
|
+
return;
|
|
44
|
+
const dataType = (_a = dataUnit.getField(fieldName)) === null || _a === void 0 ? void 0 : _a.dataType;
|
|
45
|
+
if (dataType == undefined)
|
|
46
|
+
return;
|
|
47
|
+
if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.waitmessage) !== undefined)
|
|
48
|
+
return undefined;
|
|
49
|
+
const isNonObjectValue = dataType !== DataType.OBJECT &&
|
|
50
|
+
dataType !== DataType.DATE &&
|
|
51
|
+
typeof fieldValue === 'object';
|
|
52
|
+
const processedValue = isNonObjectValue ? fieldValue.value : fieldValue;
|
|
53
|
+
return dataType === DataType.OBJECT
|
|
54
|
+
? JSON.stringify(processedValue)
|
|
55
|
+
: processedValue;
|
|
56
|
+
}
|
|
57
|
+
export function getEnabledByProperty(attribName, propertyName, fieldDescriptor) {
|
|
58
|
+
if (!fieldDescriptor)
|
|
59
|
+
return true;
|
|
60
|
+
const fieldProperties = fieldDescriptor.properties || {};
|
|
61
|
+
const fromAttribName = fieldDescriptor[attribName] !== true;
|
|
62
|
+
return fieldProperties.hasOwnProperty(propertyName)
|
|
63
|
+
? fieldProperties[propertyName] !== 'S'
|
|
64
|
+
: fromAttribName;
|
|
65
|
+
}
|
|
66
|
+
export function getValueByProperty(property, fieldDescriptor, defaultValue) {
|
|
67
|
+
if (fieldDescriptor && fieldDescriptor[property] === true) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
return defaultValue;
|
|
71
|
+
}
|
|
72
|
+
export function getIconName(userInterface) {
|
|
73
|
+
return iconMap.get(userInterface) || 'text';
|
|
74
|
+
}
|
|
75
|
+
export function buildNewGuideName(guidesList, getMessage) {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
const newGuideText = getMessage('snkFormConfig.form.newGuide');
|
|
78
|
+
const qtdWithNewGuideName = (_b = (_a = guidesList.filter(g => g.name.includes(newGuideText))) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
79
|
+
return qtdWithNewGuideName === 0 ? newGuideText : `${newGuideText} (${qtdWithNewGuideName})`;
|
|
80
|
+
}
|
|
81
|
+
export function getFieldsToSave(guidesMap) {
|
|
82
|
+
const fieldsToSave = [];
|
|
83
|
+
guidesMap.forEach((groups, guideName) => {
|
|
84
|
+
groups.forEach(({ fields }) => {
|
|
85
|
+
fields === null || fields === void 0 ? void 0 : fields.forEach((fieldConfig) => {
|
|
86
|
+
fieldsToSave.push(buildFieldToSave(Object.assign(Object.assign({}, fieldConfig), { tab: guideName })));
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
return fieldsToSave;
|
|
91
|
+
}
|
|
92
|
+
export function buildGuidesMap(rawFields, tabs, dataUnit, generalTab) {
|
|
93
|
+
const fields = handleFieldsTabNames(rawFields, dataUnit, generalTab);
|
|
94
|
+
const guidesMap = initGuidesMap(tabs);
|
|
95
|
+
if (!(fields === null || fields === void 0 ? void 0 : fields.length))
|
|
96
|
+
return guidesMap;
|
|
97
|
+
for (let guideName of guidesMap.keys()) {
|
|
98
|
+
const fieldsFromGuide = getFieldsFromGuide(fields, guideName, generalTab);
|
|
99
|
+
const fieldsByGroupMap = getGroupsFromGuide(fieldsFromGuide, dataUnit, generalTab);
|
|
100
|
+
const groupsList = parserGroupMapIntoList(fieldsByGroupMap);
|
|
101
|
+
guidesMap.set(guideName, groupsList);
|
|
102
|
+
}
|
|
103
|
+
return guidesMap;
|
|
104
|
+
}
|
|
105
|
+
export function buildGuides(config, mainArea, dataUnit, generalTabName = TAB_NAMES.general) {
|
|
106
|
+
const normalizedFields = handleFieldsTabNames(config === null || config === void 0 ? void 0 : config.fields, dataUnit, generalTabName);
|
|
107
|
+
let tabs = config.tabs ? [...config.tabs] : buildTabsFromFields(normalizedFields);
|
|
108
|
+
tabs = getPossibleGuides(tabs);
|
|
109
|
+
tabs = initializeTabsNames(tabs);
|
|
110
|
+
const guides = handleMainTab(tabs, mainArea);
|
|
111
|
+
return ensureFieldResolvedGuides(guides, normalizedFields);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Garante que exista uma guia para cada aba referenciada pelos campos (após a resolução feita
|
|
115
|
+
* em resolveFieldTab). É necessário porque a "Geral" não é uma UITabName e, portanto, pode não
|
|
116
|
+
* estar presente em config.tabs (que pode inclusive vir como array vazio); sem esta garantia os
|
|
117
|
+
* campos "Geral" seriam descartados. A área principal (__main) é tratada por handleMainTab e
|
|
118
|
+
* ignorada aqui. Guias já existentes (por nome ou rótulo) não são duplicadas.
|
|
119
|
+
*/
|
|
120
|
+
function ensureFieldResolvedGuides(tabs, normalizedFields) {
|
|
121
|
+
const result = [...tabs];
|
|
122
|
+
let nextOrder = result.length;
|
|
123
|
+
const seen = new Set();
|
|
124
|
+
(normalizedFields !== null && normalizedFields !== void 0 ? normalizedFields : []).forEach(field => {
|
|
125
|
+
const tabName = field.tab;
|
|
126
|
+
if (!tabName || tabName === TAB_NAMES.main || seen.has(tabName)) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
seen.add(tabName);
|
|
130
|
+
const alreadyExists = result.some(guide => guide.name === tabName || guide.label === tabName);
|
|
131
|
+
if (alreadyExists) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
result.push({ name: tabName, label: tabName, visible: true, order: nextOrder++ });
|
|
135
|
+
});
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
export function buildChildrenGuides(dataUnit, initialOrderIndex = 0, guidesList) {
|
|
139
|
+
var _a;
|
|
140
|
+
if (!dataUnit || !dataUnit.metadata) {
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
const children = ((_a = dataUnit.metadata) === null || _a === void 0 ? void 0 : _a.children) || [];
|
|
144
|
+
const childrenWithNoGuide = [];
|
|
145
|
+
for (const child of children) {
|
|
146
|
+
const guideOnConfig = guidesList.find(guide => child.label === guide.label);
|
|
147
|
+
if (guideOnConfig) {
|
|
148
|
+
guideOnConfig.isCustom = true;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
childrenWithNoGuide.push({
|
|
152
|
+
label: child.label,
|
|
153
|
+
name: child.name,
|
|
154
|
+
visible: true,
|
|
155
|
+
isCustom: true,
|
|
156
|
+
order: initialOrderIndex++
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return childrenWithNoGuide;
|
|
160
|
+
}
|
|
161
|
+
export function buildCustomGuides(customGuidesList, guidesList) {
|
|
162
|
+
let initialOrderIndex = guidesList.length;
|
|
163
|
+
const customGuidesToAdd = getCustomGuidesNotIncludedInList(customGuidesList, guidesList);
|
|
164
|
+
return customGuidesToAdd.map(guide => {
|
|
165
|
+
return {
|
|
166
|
+
name: guide.id,
|
|
167
|
+
label: guide.label,
|
|
168
|
+
visible: true,
|
|
169
|
+
isCustom: true,
|
|
170
|
+
order: initialOrderIndex++
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function isCustomGuideIncludedInList(guidesList, guide) {
|
|
175
|
+
return guidesList.some(fromList => fromList.name === guide.id || fromList.label === guide.label);
|
|
176
|
+
}
|
|
177
|
+
function getCustomGuidesNotIncludedInList(customGuidesList, guidesList) {
|
|
178
|
+
return customGuidesList.filter(guide => !isCustomGuideIncludedInList(guidesList, guide));
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Define a aba efetiva de um campo seguindo as MESMAS regras do formulário renderizado
|
|
182
|
+
* (ezui buildFormMetadata/handleFields):
|
|
183
|
+
* - Campo com aba explícita mantém a aba.
|
|
184
|
+
* - Campo sem aba que seja chave primária vai para a área principal (__main).
|
|
185
|
+
* - Demais campos sem aba vão para a aba "Geral" (aba secundária), e não para a área principal.
|
|
186
|
+
*
|
|
187
|
+
* Usa-se o literal TAB_NAMES.general ("Geral"), e não a mensagem traduzida, para manter o
|
|
188
|
+
* configurador em sintonia com o ezui (que utiliza o literal "Geral") em qualquer idioma.
|
|
189
|
+
*/
|
|
190
|
+
function resolveFieldTab(field, dataUnit, generalTabName) {
|
|
191
|
+
var _a, _b;
|
|
192
|
+
if (field.tab) {
|
|
193
|
+
return getTabName(field.tab, generalTabName);
|
|
194
|
+
}
|
|
195
|
+
const isPrimaryKey = !!((_b = (_a = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(field.name)) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.isPrimaryKey);
|
|
196
|
+
return isPrimaryKey ? TAB_NAMES.main : generalTabName;
|
|
197
|
+
}
|
|
198
|
+
function handleFieldsTabNames(allFields, dataUnit, generalTabName = TAB_NAMES.general) {
|
|
199
|
+
return (allFields !== null && allFields !== void 0 ? allFields : []).map(field => (Object.assign(Object.assign({}, field), { tab: resolveFieldTab(field, dataUnit, generalTabName) })));
|
|
200
|
+
}
|
|
201
|
+
function initializeTabsNames(tabs) {
|
|
202
|
+
return tabs.map((tab) => {
|
|
203
|
+
return Object.assign(Object.assign({}, tab), { name: tab.name ? tab.name : tab.label });
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
function handleMainTab(tabs, mainTabName) {
|
|
207
|
+
const mainTab = { name: TAB_NAMES.main, label: mainTabName, visible: true };
|
|
208
|
+
const hasTabMain = tabs.some((tab) => tab.name === TAB_NAMES.main);
|
|
209
|
+
if (hasTabMain) {
|
|
210
|
+
tabs = tabs.map(tab => tab.name === TAB_NAMES.main ? mainTab : tab);
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
tabs.unshift(mainTab);
|
|
214
|
+
}
|
|
215
|
+
return tabs;
|
|
216
|
+
}
|
|
217
|
+
function getPossibleGuides(tabs) {
|
|
218
|
+
return [...tabs];
|
|
219
|
+
}
|
|
220
|
+
function initGuidesMap(tabs) {
|
|
221
|
+
const map = new Map();
|
|
222
|
+
let possibleGuides = getPossibleGuides(tabs);
|
|
223
|
+
possibleGuides.forEach(tab => {
|
|
224
|
+
map.set(tab.name, []);
|
|
225
|
+
});
|
|
226
|
+
return map;
|
|
227
|
+
}
|
|
228
|
+
function handleFieldLabel(field, fieldDescriptor) {
|
|
229
|
+
if (!field.label) {
|
|
230
|
+
field.label = fieldDescriptor.label;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function handleFieldTab(field, generalTabName) {
|
|
234
|
+
if (!field.tab) {
|
|
235
|
+
field.tab = generalTabName;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function handleFieldGroup(field) {
|
|
239
|
+
if (!field.group) {
|
|
240
|
+
field.group = GROUP_NAMES.noGroup;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function isVisibleOnConfig(fieldDescriptor) {
|
|
244
|
+
var _a;
|
|
245
|
+
/**
|
|
246
|
+
* Quando um campo é ocultado pelo dev, mas queremos manter ele na config precisamos fazer essa tratativa.
|
|
247
|
+
*/
|
|
248
|
+
return ((_a = fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.properties) === null || _a === void 0 ? void 0 : _a.visibleOnConfig) === true && (fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.visible) === false;
|
|
249
|
+
}
|
|
250
|
+
function getGroupsFromGuide(fieldsFromGuide, dataUnit, generalTabName) {
|
|
251
|
+
const groupsMap = new Map();
|
|
252
|
+
groupsMap.set(GROUP_NAMES.noGroup, []);
|
|
253
|
+
for (let field of fieldsFromGuide) {
|
|
254
|
+
const fieldDescriptor = dataUnit.getField(field.name);
|
|
255
|
+
if (!(fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.visible) && !isVisibleOnConfig(fieldDescriptor))
|
|
256
|
+
continue;
|
|
257
|
+
handleFieldLabel(field, fieldDescriptor);
|
|
258
|
+
handleFieldTab(field, generalTabName);
|
|
259
|
+
handleFieldGroup(field);
|
|
260
|
+
if (groupsMap.has(field.group)) {
|
|
261
|
+
groupsMap.get(field.group).push(field);
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
groupsMap.set(field.group, [field]);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return groupsMap;
|
|
268
|
+
}
|
|
269
|
+
function getFieldsFromGuide(fields, guideName, generalTabName) {
|
|
270
|
+
return fields.filter(field => {
|
|
271
|
+
const fieldTab = getTabName(field.tab, generalTabName);
|
|
272
|
+
return fieldTab === guideName;
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
function getTabName(tab, generalTabName) {
|
|
276
|
+
var _a;
|
|
277
|
+
if (typeof tab === 'string')
|
|
278
|
+
return tab;
|
|
279
|
+
return (_a = tab === null || tab === void 0 ? void 0 : tab.label) !== null && _a !== void 0 ? _a : generalTabName;
|
|
280
|
+
}
|
|
281
|
+
function parserGroupMapIntoList(groupsMap) {
|
|
282
|
+
const groupsList = [];
|
|
283
|
+
for (let groupName of groupsMap.keys()) {
|
|
284
|
+
groupsList.push({ name: groupName, fields: groupsMap.get(groupName) });
|
|
285
|
+
}
|
|
286
|
+
return groupsList;
|
|
287
|
+
}
|
|
288
|
+
function canAddTab(tab, guideList) {
|
|
289
|
+
return tab && !(guideList.map(g => g.name).includes(tab));
|
|
290
|
+
}
|
|
291
|
+
function buildTabsFromFields(fields) {
|
|
292
|
+
const guideList = [];
|
|
293
|
+
let order = 1;
|
|
294
|
+
fields === null || fields === void 0 ? void 0 : fields.forEach((field) => {
|
|
295
|
+
const tab = field.tab;
|
|
296
|
+
if (canAddTab(tab, guideList)) {
|
|
297
|
+
guideList.push({ name: tab, label: tab, visible: true, order });
|
|
298
|
+
order = order + 1;
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
return guideList;
|
|
302
|
+
}
|
|
303
|
+
function buildFieldToSave(fieldConfig) {
|
|
304
|
+
const fieldToSave = {
|
|
305
|
+
cleanOnCopy: fieldConfig.cleanOnCopy || false,
|
|
306
|
+
group: fieldConfig.group === GROUP_NAMES.noGroup ? undefined : fieldConfig.group,
|
|
307
|
+
label: fieldConfig.label,
|
|
308
|
+
name: fieldConfig.name,
|
|
309
|
+
required: fieldConfig.required,
|
|
310
|
+
readOnly: fieldConfig.readOnly,
|
|
311
|
+
tab: fieldConfig.tab,
|
|
312
|
+
};
|
|
313
|
+
if (fieldConfig.defaultValue != undefined) {
|
|
314
|
+
if (fieldConfig.defaultValue.type == undefined) {
|
|
315
|
+
fieldToSave.defaultValue = {
|
|
316
|
+
type: DEFAULT_TYPE.fixed,
|
|
317
|
+
value: fieldConfig.defaultValue,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
fieldToSave.defaultValue = fieldConfig.defaultValue;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return fieldToSave;
|
|
325
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
|
2
|
+
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
|
3
|
+
import { FormConfigFetcher } from '../../lib/http/data-fetcher/fetchers/form-config-fetcher';
|
|
4
|
+
import { TAB_NAMES } from '../../lib/utils/constants';
|
|
5
|
+
export class SnkFormConfigManager {
|
|
6
|
+
constructor(configName, resourceID, onConfigChange, dataUnit) {
|
|
7
|
+
this._resourceID = resourceID;
|
|
8
|
+
this._configName = configName;
|
|
9
|
+
this._onConfigChange = onConfigChange;
|
|
10
|
+
this._dataUnit = dataUnit;
|
|
11
|
+
}
|
|
12
|
+
addFormLegacyConfig(legacyConfigName) {
|
|
13
|
+
if (this._configName) {
|
|
14
|
+
ConfigStorage.addFormLegacyConfig(this._configName, legacyConfigName);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async loadConfig() {
|
|
18
|
+
return new Promise(resolve => {
|
|
19
|
+
ConfigStorage.loadFormConfig(this._configName, this._resourceID)
|
|
20
|
+
.then((config) => {
|
|
21
|
+
config = this.buildFormMetadataUITabs(config);
|
|
22
|
+
this.setConfig(config);
|
|
23
|
+
resolve(config);
|
|
24
|
+
})
|
|
25
|
+
.catch((error) => {
|
|
26
|
+
console.warn(error);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
getEmptyConfig() {
|
|
31
|
+
return this.buildFormMetadataUITabs({ fields: [], emptyConfig: true }, true);
|
|
32
|
+
}
|
|
33
|
+
saveConfig(config) {
|
|
34
|
+
const configToSave = ObjectUtils.copy(config);
|
|
35
|
+
return new Promise(accept => {
|
|
36
|
+
ConfigStorage.saveFormConfig(config, this._configName, this._resourceID)
|
|
37
|
+
.then((response) => {
|
|
38
|
+
this.setConfig(Object.assign(Object.assign({}, configToSave), response));
|
|
39
|
+
accept(Object.assign(Object.assign({}, configToSave), response));
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
saveCardState(cardId, cardConfig, propertyChanged) {
|
|
44
|
+
return new Promise(resolve => {
|
|
45
|
+
var _a;
|
|
46
|
+
const cardsState = ((_a = this._config) === null || _a === void 0 ? void 0 : _a.cardsState) || new Map;
|
|
47
|
+
const currentConfig = cardsState.get(cardId);
|
|
48
|
+
cardsState.set(cardId, propertyChanged === "fixed" ?
|
|
49
|
+
this.updateFixSequence(Object.assign(Object.assign({}, currentConfig), { fixed: cardConfig.fixed }), cardsState)
|
|
50
|
+
: Object.assign(Object.assign({}, currentConfig), { [propertyChanged]: cardConfig[propertyChanged] }));
|
|
51
|
+
ConfigStorage.saveCardState(cardsState, this._configName, this._resourceID)
|
|
52
|
+
.then(savedCardConfig => {
|
|
53
|
+
this._config = Object.assign(Object.assign({}, this._config), { cardsState });
|
|
54
|
+
resolve(savedCardConfig);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
updateFixSequence(updatingCardConfig, cardsState) {
|
|
59
|
+
let maxSequence = -1;
|
|
60
|
+
Array.from(cardsState.values()).forEach(cardConfig => {
|
|
61
|
+
if (!cardConfig.fixed) {
|
|
62
|
+
delete updatingCardConfig.fixSequence;
|
|
63
|
+
}
|
|
64
|
+
if (cardConfig.fixSequence != undefined) {
|
|
65
|
+
maxSequence = Math.max(maxSequence, cardConfig.fixSequence);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
if (updatingCardConfig.fixed) {
|
|
69
|
+
updatingCardConfig.fixSequence = maxSequence + 1;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
delete updatingCardConfig.fixSequence;
|
|
73
|
+
}
|
|
74
|
+
return updatingCardConfig;
|
|
75
|
+
}
|
|
76
|
+
hasConfig(config) {
|
|
77
|
+
var _a;
|
|
78
|
+
const currentConfig = config !== null && config !== void 0 ? config : this._config;
|
|
79
|
+
if (currentConfig && ((_a = currentConfig.fields) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
getFieldsList(descriptionFilter, forceEmptyConfig = false) {
|
|
85
|
+
var _a, _b;
|
|
86
|
+
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
87
|
+
const hasConfig = this.hasConfig();
|
|
88
|
+
if (hasConfig && !forceEmptyConfig) {
|
|
89
|
+
return fields.map(({ label, name, readOnly, visible, required, tab, group }) => {
|
|
90
|
+
var _a;
|
|
91
|
+
if (label == undefined) {
|
|
92
|
+
const currentField = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
|
93
|
+
if (!currentField)
|
|
94
|
+
return;
|
|
95
|
+
return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab, group: group });
|
|
96
|
+
}
|
|
97
|
+
return { name, label, readOnly, visible, required, tab, group };
|
|
98
|
+
})
|
|
99
|
+
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
100
|
+
}
|
|
101
|
+
if (!this._dataUnit || !((_b = this._dataUnit.metadata) === null || _b === void 0 ? void 0 : _b.fields)) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
const filteredFields = this._dataUnit.metadata.fields
|
|
105
|
+
.filter(field => this.isFieldVisible(field, descriptionFilter))
|
|
106
|
+
.map(({ label, name, readOnly, visible, required, properties }) => ({ label, name, readOnly, visible, required, tab: properties === null || properties === void 0 ? void 0 : properties.UITabName }));
|
|
107
|
+
return filteredFields;
|
|
108
|
+
}
|
|
109
|
+
isFieldVisible(field, descriptionFilter) {
|
|
110
|
+
if (field === undefined || field.visible === false) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (descriptionFilter == undefined) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
const normalizedText = StringUtils.replaceAccentuatedCharsLower((field.label || field.name).toLocaleLowerCase());
|
|
117
|
+
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
|
118
|
+
return normalizedText.includes(normalizedFilter);
|
|
119
|
+
}
|
|
120
|
+
getFormConfig(dataUnit, ignoreReadOnlyFormFields, forceEmptyConfig = false) {
|
|
121
|
+
let fields = this.getFieldsList(undefined, forceEmptyConfig);
|
|
122
|
+
if (ignoreReadOnlyFormFields) {
|
|
123
|
+
fields = fields.filter(field => {
|
|
124
|
+
if (dataUnit) {
|
|
125
|
+
const def = dataUnit.getField(field.name);
|
|
126
|
+
if (def && def.readOnly) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return !field.readOnly;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return Object.assign(Object.assign({}, this._config), { fields });
|
|
134
|
+
}
|
|
135
|
+
setConfig(config) {
|
|
136
|
+
this.isLoaded = true;
|
|
137
|
+
const { cardsState, summary, defaultVars } = this._config || {};
|
|
138
|
+
this._config = Object.assign({}, config);
|
|
139
|
+
if (cardsState) {
|
|
140
|
+
this._config.cardsState = cardsState;
|
|
141
|
+
}
|
|
142
|
+
if (summary) {
|
|
143
|
+
this._config.summary = summary;
|
|
144
|
+
}
|
|
145
|
+
if (defaultVars) {
|
|
146
|
+
this._config.defaultVars = defaultVars;
|
|
147
|
+
}
|
|
148
|
+
if (this._onConfigChange) {
|
|
149
|
+
this._onConfigChange(Object.assign({}, this._config));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
getConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
153
|
+
return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields);
|
|
154
|
+
}
|
|
155
|
+
getFormConfigFetcher() {
|
|
156
|
+
if (this._formConfigFetcher == undefined) {
|
|
157
|
+
this._formConfigFetcher = new FormConfigFetcher();
|
|
158
|
+
}
|
|
159
|
+
return this._formConfigFetcher;
|
|
160
|
+
}
|
|
161
|
+
async fetchUserAvailableConfigs() {
|
|
162
|
+
if (this._configName != undefined) {
|
|
163
|
+
//FIXME: Precisamos preparar o backend para retornar as configurações disponíveis para details;
|
|
164
|
+
return Promise.resolve(undefined);
|
|
165
|
+
}
|
|
166
|
+
return this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName, this._resourceID);
|
|
167
|
+
}
|
|
168
|
+
async fetchLegacyConfig() {
|
|
169
|
+
return this.getFormConfigFetcher().fetchLegacyConfig(this._configName, this._resourceID);
|
|
170
|
+
}
|
|
171
|
+
async fetchDefaultConfig() {
|
|
172
|
+
return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
|
|
173
|
+
}
|
|
174
|
+
parseObjectList(object) {
|
|
175
|
+
if (!object) {
|
|
176
|
+
return [];
|
|
177
|
+
}
|
|
178
|
+
return Array.isArray(object) ? object : [object];
|
|
179
|
+
}
|
|
180
|
+
buildFormMetadataUITabs(config, forceEmptyConfig = false) {
|
|
181
|
+
var _a, _b, _c;
|
|
182
|
+
const hasConfig = this.hasConfig(config);
|
|
183
|
+
if (!forceEmptyConfig && (!this._dataUnit || hasConfig)) {
|
|
184
|
+
return config;
|
|
185
|
+
}
|
|
186
|
+
config = this.getFormConfig(this._dataUnit, false, true);
|
|
187
|
+
config.tabs = this.parseObjectList(config.tabs);
|
|
188
|
+
config.emptyConfig = false;
|
|
189
|
+
config.defaultConfiguration = true;
|
|
190
|
+
const fields = (_b = (_a = this._dataUnit.metadata) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : [];
|
|
191
|
+
for (const currentField of fields) {
|
|
192
|
+
const field = config.fields.find(field => field.name === currentField.name);
|
|
193
|
+
const uiTabName = (_c = currentField.properties) === null || _c === void 0 ? void 0 : _c.UITabName;
|
|
194
|
+
if (!uiTabName || uiTabName === TAB_NAMES.main) {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const haveTab = config.tabs.some((tab) => tab.label === uiTabName);
|
|
198
|
+
if (!haveTab) {
|
|
199
|
+
config.tabs.push({
|
|
200
|
+
label: uiTabName,
|
|
201
|
+
name: uiTabName,
|
|
202
|
+
order: 0,
|
|
203
|
+
visible: true,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
if (field) {
|
|
207
|
+
field.tab = uiTabName;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return config;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
:host{
|
|
2
|
+
display: flex;
|
|
3
|
+
padding-top: var(--space--12, 12px);
|
|
4
|
+
align-items: center;
|
|
5
|
+
width: 100%;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.left-group{
|
|
10
|
+
display: flex;
|
|
11
|
+
gap: var(--space--8, 8px);
|
|
12
|
+
align-items: center;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.right-group{
|
|
16
|
+
display: flex;
|
|
17
|
+
}
|