@sapui5/sap.fe.macros 1.139.0 → 1.141.0
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/package.json +1 -1
- package/src/sap/fe/macros/.library +1 -1
- package/src/sap/fe/macros/Chart.js +53 -2
- package/src/sap/fe/macros/Chart.tsx +55 -0
- package/src/sap/fe/macros/CollaborativeDraftHandler.js +230 -0
- package/src/sap/fe/macros/CollaborativeDraftHandler.tsx +218 -0
- package/src/sap/fe/macros/CommonHelper.js +59 -15
- package/src/sap/fe/macros/CommonHelper.ts +65 -14
- package/src/sap/fe/macros/ConditionalSwitch.js +174 -0
- package/src/sap/fe/macros/ConditionalSwitch.tsx +141 -0
- package/src/sap/fe/macros/ConditionalSwitchProperty.js +78 -0
- package/src/sap/fe/macros/ConditionalSwitchProperty.tsx +62 -0
- package/src/sap/fe/macros/Field.js +78 -64
- package/src/sap/fe/macros/Field.ts +97 -68
- package/src/sap/fe/macros/FooterContent.js +5 -2
- package/src/sap/fe/macros/FooterContent.tsx +4 -1
- package/src/sap/fe/macros/MacroAPI.js +9 -4
- package/src/sap/fe/macros/MacroAPI.ts +9 -4
- package/src/sap/fe/macros/MessageButton.js +1 -2
- package/src/sap/fe/macros/MessageButton.tsx +0 -1
- package/src/sap/fe/macros/MultiValueField.js +10 -7
- package/src/sap/fe/macros/MultiValueField.tsx +7 -3
- package/src/sap/fe/macros/Page.js +5 -7
- package/src/sap/fe/macros/Page.tsx +4 -6
- package/src/sap/fe/macros/Paginator.js +9 -4
- package/src/sap/fe/macros/Paginator.tsx +12 -3
- package/src/sap/fe/macros/RichTextEditor.js +3 -2
- package/src/sap/fe/macros/RichTextEditor.tsx +2 -1
- package/src/sap/fe/macros/Share.js +14 -2
- package/src/sap/fe/macros/Share.tsx +13 -0
- package/src/sap/fe/macros/Status.js +251 -0
- package/src/sap/fe/macros/Status.tsx +212 -0
- package/src/sap/fe/macros/ValueHelp.js +4 -28
- package/src/sap/fe/macros/ValueHelp.tsx +2 -42
- package/src/sap/fe/macros/ai/EasyFillDialog.js +11 -17
- package/src/sap/fe/macros/ai/EasyFillDialog.tsx +11 -16
- package/src/sap/fe/macros/ai/EasyFilterBar.js +246 -97
- package/src/sap/fe/macros/ai/EasyFilterBar.tsx +302 -106
- package/src/sap/fe/macros/ai/EasyFilterDataFetcher.js +76 -33
- package/src/sap/fe/macros/ai/EasyFilterDataFetcher.ts +89 -40
- package/src/sap/fe/macros/ai/SummarizationButton.js +2 -2
- package/src/sap/fe/macros/ai/SummarizationButton.tsx +1 -1
- package/src/sap/fe/macros/chart/Chart.js +2 -2
- package/src/sap/fe/macros/chart/Chart.tsx +1 -1
- package/src/sap/fe/macros/chart/ChartHelper.js +1 -2
- package/src/sap/fe/macros/chart/ChartHelper.ts +0 -1
- package/src/sap/fe/macros/chart/ChartRuntime.js +1 -2
- package/src/sap/fe/macros/chart/ChartRuntime.ts +0 -1
- package/src/sap/fe/macros/chart/MdcChartTemplate.js +5 -5
- package/src/sap/fe/macros/chart/MdcChartTemplate.tsx +5 -5
- package/src/sap/fe/macros/contentSwitcher/ContentSwitcher.js +9 -2
- package/src/sap/fe/macros/contentSwitcher/ContentSwitcher.tsx +8 -0
- package/src/sap/fe/macros/controls/BuildingBlockObjectProperty.js +5 -1
- package/src/sap/fe/macros/controls/BuildingBlockObjectProperty.ts +4 -0
- package/src/sap/fe/macros/controls/BuildingBlockWithTemplating.js +4 -2
- package/src/sap/fe/macros/controls/BuildingBlockWithTemplating.ts +3 -1
- package/src/sap/fe/macros/controls/FilterBar.js +14 -5
- package/src/sap/fe/macros/controls/FilterBar.ts +3 -0
- package/src/sap/fe/macros/controls/NumberWithUnitOrCurrency.js +2 -2
- package/src/sap/fe/macros/controls/NumberWithUnitOrCurrency.tsx +2 -2
- package/src/sap/fe/macros/controls/RadioButtons.js +61 -38
- package/src/sap/fe/macros/controls/RadioButtons.tsx +39 -18
- package/src/sap/fe/macros/controls/Section.js +4 -3
- package/src/sap/fe/macros/controls/Section.ts +3 -2
- package/src/sap/fe/macros/controls/section/SubSection.js +63 -8
- package/src/sap/fe/macros/controls/section/SubSection.ts +67 -1
- package/src/sap/fe/macros/coreUI/OperationParameterDialog.js +43 -4
- package/src/sap/fe/macros/coreUI/OperationParameterDialog.tsx +48 -1
- package/src/sap/fe/macros/designtime/Designtime.helper.js +28 -1
- package/src/sap/fe/macros/designtime/Designtime.helper.ts +27 -0
- package/src/sap/fe/macros/field/Field.js +2 -2
- package/src/sap/fe/macros/field/Field.tsx +1 -1
- package/src/sap/fe/macros/field/FieldBaseDelegate.js +13 -7
- package/src/sap/fe/macros/field/FieldBaseDelegate.ts +12 -8
- package/src/sap/fe/macros/field/FieldFormatOptions.js +25 -2
- package/src/sap/fe/macros/field/FieldFormatOptions.ts +13 -0
- package/src/sap/fe/macros/field/FieldHelper.js +2 -2
- package/src/sap/fe/macros/field/FieldHelper.ts +1 -4
- package/src/sap/fe/macros/field/FieldRuntime.js +1 -2
- package/src/sap/fe/macros/field/FieldRuntime.ts +0 -1
- package/src/sap/fe/macros/field/FieldTemplating.js +3 -3
- package/src/sap/fe/macros/field/FieldTemplating.ts +4 -2
- package/src/sap/fe/macros/filter/FilterUtils.js +233 -5
- package/src/sap/fe/macros/filter/FilterUtils.ts +291 -7
- package/src/sap/fe/macros/filterBar/FilterBar.block.js +5 -3
- package/src/sap/fe/macros/filterBar/FilterBar.block.tsx +4 -2
- package/src/sap/fe/macros/filterBar/FilterBar.js +2 -2
- package/src/sap/fe/macros/filterBar/FilterBar.tsx +1 -1
- package/src/sap/fe/macros/filterBar/FilterBarAPI.js +63 -27
- package/src/sap/fe/macros/filterBar/FilterBarAPI.ts +49 -3
- package/src/sap/fe/macros/filterBar/FilterBarDelegate.js +5 -3
- package/src/sap/fe/macros/filterBar/FilterBarDelegate.ts +5 -2
- package/src/sap/fe/macros/filterBar/mixin/FilterBarAPIStateHandler.js +7 -2
- package/src/sap/fe/macros/filterBar/mixin/FilterBarAPIStateHandler.ts +6 -1
- package/src/sap/fe/macros/form/Form.block.js +7 -8
- package/src/sap/fe/macros/form/Form.block.ts +4 -6
- package/src/sap/fe/macros/form/Form.js +1 -4
- package/src/sap/fe/macros/form/Form.tsx +0 -3
- package/src/sap/fe/macros/form/FormContainer.block.js +555 -5
- package/src/sap/fe/macros/form/FormContainer.block.ts +665 -7
- package/src/sap/fe/macros/form/FormContainer.fragment.xml +1 -0
- package/src/sap/fe/macros/form/FormDelegate.js +24 -8
- package/src/sap/fe/macros/form/FormDelegate.ts +29 -7
- package/src/sap/fe/macros/form/FormHelper.js +1 -2
- package/src/sap/fe/macros/form/FormHelper.ts +0 -1
- package/src/sap/fe/macros/fpm/CustomFragment.block.js +1 -2
- package/src/sap/fe/macros/fpm/CustomFragment.block.ts +0 -1
- package/src/sap/fe/macros/internal/ActionCommand.block.js +1 -2
- package/src/sap/fe/macros/internal/ActionCommand.block.ts +0 -1
- package/src/sap/fe/macros/internal/DataPoint.js +3 -2
- package/src/sap/fe/macros/internal/DataPoint.tsx +10 -1
- package/src/sap/fe/macros/internal/FilterField.block.js +19 -5
- package/src/sap/fe/macros/internal/FilterField.block.ts +16 -4
- package/src/sap/fe/macros/internal/field/DisplayStyle.js +9 -3
- package/src/sap/fe/macros/internal/field/DisplayStyle.tsx +10 -2
- package/src/sap/fe/macros/internal/field/EditStyle.js +21 -4
- package/src/sap/fe/macros/internal/field/EditStyle.tsx +18 -4
- package/src/sap/fe/macros/internal/field/FieldStructureHelper.js +3 -2
- package/src/sap/fe/macros/internal/field/FieldStructureHelper.ts +5 -1
- package/src/sap/fe/macros/internal/filterField/FilterFieldTemplate.fragment.xml +1 -0
- package/src/sap/fe/macros/internal/helpers/ActionHelper.js +36 -5
- package/src/sap/fe/macros/internal/helpers/ActionHelper.ts +34 -4
- package/src/sap/fe/macros/internal/valuehelp/AdditionalValueHelper.js +46 -8
- package/src/sap/fe/macros/internal/valuehelp/AdditionalValueHelper.ts +60 -6
- package/src/sap/fe/macros/internal/valuehelp/TableDelegate.js +38 -2
- package/src/sap/fe/macros/internal/valuehelp/TableDelegate.ts +37 -2
- package/src/sap/fe/macros/internal/valuehelp/ValueListDialogTable.fragment.xml +1 -1
- package/src/sap/fe/macros/internal/valuehelp/ValueListHelper.js +10 -3
- package/src/sap/fe/macros/internal/valuehelp/ValueListHelper.ts +13 -2
- package/src/sap/fe/macros/library.js +1 -1
- package/src/sap/fe/macros/mdc/adapter/StateFilterToSelectionVariant.js +2 -1
- package/src/sap/fe/macros/mdc/adapter/StateFilterToSelectionVariant.ts +1 -0
- package/src/sap/fe/macros/messagebundle.properties +24 -4
- package/src/sap/fe/macros/messagebundle_ar.properties +8 -2
- package/src/sap/fe/macros/messagebundle_bg.properties +8 -2
- package/src/sap/fe/macros/messagebundle_ca.properties +11 -5
- package/src/sap/fe/macros/messagebundle_cnr.properties +8 -2
- package/src/sap/fe/macros/messagebundle_cs.properties +7 -1
- package/src/sap/fe/macros/messagebundle_cy.properties +9 -3
- package/src/sap/fe/macros/messagebundle_da.properties +8 -2
- package/src/sap/fe/macros/messagebundle_de.properties +13 -7
- package/src/sap/fe/macros/messagebundle_el.properties +7 -1
- package/src/sap/fe/macros/messagebundle_en.properties +11 -5
- package/src/sap/fe/macros/messagebundle_en_GB.properties +9 -3
- package/src/sap/fe/macros/messagebundle_en_US_saprigi.properties +11 -5
- package/src/sap/fe/macros/messagebundle_es.properties +10 -4
- package/src/sap/fe/macros/messagebundle_es_MX.properties +11 -5
- package/src/sap/fe/macros/messagebundle_et.properties +9 -3
- package/src/sap/fe/macros/messagebundle_fi.properties +7 -1
- package/src/sap/fe/macros/messagebundle_fr.properties +9 -3
- package/src/sap/fe/macros/messagebundle_fr_CA.properties +8 -2
- package/src/sap/fe/macros/messagebundle_hi.properties +8 -2
- package/src/sap/fe/macros/messagebundle_hr.properties +8 -2
- package/src/sap/fe/macros/messagebundle_hu.properties +7 -1
- package/src/sap/fe/macros/messagebundle_id.properties +15 -9
- package/src/sap/fe/macros/messagebundle_it.properties +7 -1
- package/src/sap/fe/macros/messagebundle_iw.properties +8 -2
- package/src/sap/fe/macros/messagebundle_ja.properties +13 -7
- package/src/sap/fe/macros/messagebundle_kk.properties +11 -5
- package/src/sap/fe/macros/messagebundle_ko.properties +8 -2
- package/src/sap/fe/macros/messagebundle_lt.properties +9 -3
- package/src/sap/fe/macros/messagebundle_lv.properties +8 -2
- package/src/sap/fe/macros/messagebundle_mk.properties +8 -2
- package/src/sap/fe/macros/messagebundle_ms.properties +7 -1
- package/src/sap/fe/macros/messagebundle_nl.properties +7 -1
- package/src/sap/fe/macros/messagebundle_no.properties +7 -1
- package/src/sap/fe/macros/messagebundle_pl.properties +8 -2
- package/src/sap/fe/macros/messagebundle_pt.properties +7 -1
- package/src/sap/fe/macros/messagebundle_pt_PT.properties +7 -1
- package/src/sap/fe/macros/messagebundle_ro.properties +8 -2
- package/src/sap/fe/macros/messagebundle_ru.properties +10 -4
- package/src/sap/fe/macros/messagebundle_sh.properties +8 -2
- package/src/sap/fe/macros/messagebundle_sk.properties +7 -1
- package/src/sap/fe/macros/messagebundle_sl.properties +7 -1
- package/src/sap/fe/macros/messagebundle_sr.properties +8 -2
- package/src/sap/fe/macros/messagebundle_sv.properties +7 -1
- package/src/sap/fe/macros/messagebundle_th.properties +8 -2
- package/src/sap/fe/macros/messagebundle_tr.properties +7 -1
- package/src/sap/fe/macros/messagebundle_uk.properties +10 -4
- package/src/sap/fe/macros/messagebundle_vi.properties +10 -4
- package/src/sap/fe/macros/messagebundle_zh_CN.properties +7 -1
- package/src/sap/fe/macros/messagebundle_zh_TW.properties +8 -2
- package/src/sap/fe/macros/messages/MessageButton.js +39 -18
- package/src/sap/fe/macros/messages/MessageButton.ts +42 -19
- package/src/sap/fe/macros/messages/MessagePopover.js +4 -2
- package/src/sap/fe/macros/messages/MessagePopover.ts +6 -4
- package/src/sap/fe/macros/microchart/MicroChart.js +2 -2
- package/src/sap/fe/macros/microchart/MicroChart.tsx +1 -1
- package/src/sap/fe/macros/microchart/MicroChartContainer.js +1 -2
- package/src/sap/fe/macros/microchart/MicroChartContainer.ts +1 -2
- package/src/sap/fe/macros/microchart/MicroChartHelper.js +2 -3
- package/src/sap/fe/macros/microchart/MicroChartHelper.tsx +1 -2
- package/src/sap/fe/macros/share/ShareAPI.js +4 -29
- package/src/sap/fe/macros/share/ShareAPI.ts +1 -32
- package/src/sap/fe/macros/situations/SituationsPopover.js +3 -1
- package/src/sap/fe/macros/situations/SituationsPopover.ts +2 -0
- package/src/sap/fe/macros/table/ActionsTemplating.js +4 -8
- package/src/sap/fe/macros/table/ActionsTemplating.tsx +5 -8
- package/src/sap/fe/macros/table/BasicSearch.js +1 -1
- package/src/sap/fe/macros/table/BasicSearch.ts +2 -1
- package/src/sap/fe/macros/table/Column.js +14 -2
- package/src/sap/fe/macros/table/Column.ts +7 -0
- package/src/sap/fe/macros/table/ColumnExportSettings.js +83 -15
- package/src/sap/fe/macros/table/ColumnExportSettings.ts +44 -0
- package/src/sap/fe/macros/table/ColumnOverride.js +14 -2
- package/src/sap/fe/macros/table/ColumnOverride.ts +7 -0
- package/src/sap/fe/macros/table/MdcTableTemplate.js +7 -5
- package/src/sap/fe/macros/table/MdcTableTemplate.tsx +21 -11
- package/src/sap/fe/macros/table/QuickFilterSelector.js +12 -3
- package/src/sap/fe/macros/table/QuickFilterSelector.tsx +15 -2
- package/src/sap/fe/macros/table/Table.block.js +188 -147
- package/src/sap/fe/macros/table/Table.block.tsx +41 -11
- package/src/sap/fe/macros/table/Table.js +16 -10
- package/src/sap/fe/macros/table/Table.tsx +16 -10
- package/src/sap/fe/macros/table/TableAPI.js +224 -184
- package/src/sap/fe/macros/table/TableAPI.ts +63 -19
- package/src/sap/fe/macros/table/TableEventHandlerProvider.js +6 -6
- package/src/sap/fe/macros/table/TableEventHandlerProvider.ts +5 -4
- package/src/sap/fe/macros/table/TableHelper.js +2 -3
- package/src/sap/fe/macros/table/TableHelper.ts +1 -2
- package/src/sap/fe/macros/table/TableRuntime.js +24 -5
- package/src/sap/fe/macros/table/TableRuntime.ts +31 -3
- package/src/sap/fe/macros/table/TreeTable.js +16 -10
- package/src/sap/fe/macros/table/TreeTable.tsx +16 -10
- package/src/sap/fe/macros/table/Utils.js +8 -3
- package/src/sap/fe/macros/table/Utils.ts +12 -3
- package/src/sap/fe/macros/table/delegates/ALPTableDelegate.js +1 -2
- package/src/sap/fe/macros/table/delegates/ALPTableDelegate.ts +0 -1
- package/src/sap/fe/macros/table/delegates/TableDelegate.js +69 -34
- package/src/sap/fe/macros/table/delegates/TableDelegate.ts +75 -33
- package/src/sap/fe/macros/table/delegates/TreeTableDelegate.js +1 -2
- package/src/sap/fe/macros/table/delegates/TreeTableDelegate.ts +0 -1
- package/src/sap/fe/macros/table/massEdit/MassEditDialog.js +10 -10
- package/src/sap/fe/macros/table/massEdit/MassEditDialog.tsx +11 -9
- package/src/sap/fe/macros/table/massEdit/MassEditDialogHelper.js +14 -12
- package/src/sap/fe/macros/table/massEdit/MassEditDialogHelper.tsx +11 -10
- package/src/sap/fe/macros/table/mixin/ContextMenuHandler.js +34 -4
- package/src/sap/fe/macros/table/mixin/ContextMenuHandler.ts +45 -2
- package/src/sap/fe/macros/table/mixin/EmptyRowsHandler.js +55 -12
- package/src/sap/fe/macros/table/mixin/EmptyRowsHandler.ts +71 -9
- package/src/sap/fe/macros/table/mixin/TableAPIStateHandler.js +53 -2
- package/src/sap/fe/macros/table/mixin/TableAPIStateHandler.ts +55 -0
- package/src/sap/fe/macros/table/mixin/TableExport.js +22 -3
- package/src/sap/fe/macros/table/mixin/TableExport.ts +25 -4
- package/src/sap/fe/macros/table/mixin/TableHierarchy.js +5 -1
- package/src/sap/fe/macros/table/mixin/TableHierarchy.ts +7 -0
- package/src/sap/fe/macros/table/mixin/TableSharing.js +4 -2
- package/src/sap/fe/macros/table/mixin/TableSharing.ts +10 -1
- package/src/sap/fe/macros/valuehelp/ValueHelpDelegate.js +36 -10
- package/src/sap/fe/macros/valuehelp/ValueHelpDelegate.ts +44 -9
- package/src/sap/fe/macros/visualfilters/VisualFilter.js +5 -4
- package/src/sap/fe/macros/visualfilters/VisualFilter.tsx +3 -2
- package/src/sap/fe/macros/visualfilters/VisualFilterRuntime.js +2 -3
- package/src/sap/fe/macros/visualfilters/VisualFilterRuntime.ts +1 -2
|
@@ -1,21 +1,37 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AnnotationPath, AnnotationTerm, EntitySet, Property } from "@sap-ux/vocabularies-types";
|
|
2
|
+
import type {
|
|
3
|
+
ConnectedFieldsType,
|
|
4
|
+
ConnectedFieldsTypeTypes,
|
|
5
|
+
DataField,
|
|
6
|
+
DataFieldAbstractTypes,
|
|
7
|
+
DataFieldForAnnotation,
|
|
8
|
+
DataPointType,
|
|
9
|
+
FieldGroup,
|
|
10
|
+
ReferenceFacet
|
|
11
|
+
} from "@sap-ux/vocabularies-types/vocabularies/UI";
|
|
2
12
|
import { UIAnnotationTypes } from "@sap-ux/vocabularies-types/vocabularies/UI";
|
|
3
|
-
import type
|
|
13
|
+
import { type PropertiesOf } from "sap/fe/base/ClassSupport";
|
|
4
14
|
import {
|
|
5
15
|
blockAggregation,
|
|
6
16
|
blockAttribute,
|
|
7
17
|
blockEvent,
|
|
8
18
|
defineBuildingBlock
|
|
9
19
|
} from "sap/fe/core/buildingBlocks/templating/BuildingBlockSupport";
|
|
10
|
-
import type
|
|
20
|
+
import { xml, type TemplateProcessorSettings } from "sap/fe/core/buildingBlocks/templating/BuildingBlockTemplateProcessor";
|
|
11
21
|
import BuildingBlockTemplatingBase from "sap/fe/core/buildingBlocks/templating/BuildingBlockTemplatingBase";
|
|
12
22
|
import { getInvolvedDataModelObjects } from "sap/fe/core/converters/MetaModelConverter";
|
|
13
23
|
import type { BaseAction } from "sap/fe/core/converters/controls/Common/Action";
|
|
14
|
-
import type { FormElement } from "sap/fe/core/converters/controls/Common/Form";
|
|
24
|
+
import type { AnnotationFormElement, CustomFormElement, FormElement } from "sap/fe/core/converters/controls/Common/Form";
|
|
15
25
|
import { createFormDefinition } from "sap/fe/core/converters/controls/Common/Form";
|
|
16
26
|
import type { ConfigurableObject } from "sap/fe/core/converters/helpers/ConfigurableObject";
|
|
17
|
-
import
|
|
27
|
+
import * as StableIDHelper from "sap/fe/core/helpers/StableIdHelper";
|
|
28
|
+
import type { DataModelObjectPath } from "sap/fe/core/templating/DataModelPathHelper";
|
|
29
|
+
import { enhanceDataModelPath, getContextRelativeTargetObjectPath } from "sap/fe/core/templating/DataModelPathHelper";
|
|
30
|
+
import { getRequiredExpressionForConnectedDataField, isMultiValueField } from "sap/fe/core/templating/UIFormatters";
|
|
18
31
|
import type Context from "sap/ui/model/odata/v4/Context";
|
|
32
|
+
import CommonHelper from "../CommonHelper";
|
|
33
|
+
import { getVisibleExpression } from "../field/FieldTemplating";
|
|
34
|
+
import FormHelper from "./FormHelper";
|
|
19
35
|
|
|
20
36
|
/**
|
|
21
37
|
* Building block for creating a FormContainer based on the provided OData V4 metadata.
|
|
@@ -34,9 +50,8 @@ import type Context from "sap/ui/model/odata/v4/Context";
|
|
|
34
50
|
* />
|
|
35
51
|
* </pre>
|
|
36
52
|
* @private
|
|
37
|
-
* @experimental
|
|
38
53
|
*/
|
|
39
|
-
@defineBuildingBlock({ name: "FormContainer", namespace: "sap.fe.macros"
|
|
54
|
+
@defineBuildingBlock({ name: "FormContainer", namespace: "sap.fe.macros" })
|
|
40
55
|
export default class FormContainerBlock extends BuildingBlockTemplatingBase {
|
|
41
56
|
@blockAttribute({ type: "string" })
|
|
42
57
|
id?: string;
|
|
@@ -126,6 +141,8 @@ export default class FormContainerBlock extends BuildingBlockTemplatingBase {
|
|
|
126
141
|
@blockEvent()
|
|
127
142
|
onChange?: string;
|
|
128
143
|
|
|
144
|
+
contentId: string | undefined;
|
|
145
|
+
|
|
129
146
|
constructor(props: PropertiesOf<FormContainerBlock>, externalConfiguration: unknown, settings: TemplateProcessorSettings) {
|
|
130
147
|
super(props);
|
|
131
148
|
this.entitySet = this.contextPath!;
|
|
@@ -159,5 +176,646 @@ export default class FormContainerBlock extends BuildingBlockTemplatingBase {
|
|
|
159
176
|
|
|
160
177
|
this.dataFieldCollection = oFormDefinition.formContainers[0].formElements;
|
|
161
178
|
}
|
|
179
|
+
// We need the view id for the form elements stable ids generation
|
|
180
|
+
this.contentId = settings.viewId as string;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Returns the template for the FormContainer.
|
|
185
|
+
* @returns The XML template string.
|
|
186
|
+
*/
|
|
187
|
+
public getTemplate(): string {
|
|
188
|
+
const overflowToolbarID = this.id ? StableIDHelper.generate([this.id, "FormActionsToolbar"]) : undefined;
|
|
189
|
+
const dataModelObject = getInvolvedDataModelObjects(this.contextPath, this.metaPath) as DataModelObjectPath<EntitySet> | undefined;
|
|
190
|
+
const bindingString = FormHelper.generateBindingExpression(this.navigationPath, dataModelObject);
|
|
191
|
+
|
|
192
|
+
return xml`
|
|
193
|
+
<f:FormContainer
|
|
194
|
+
xmlns="sap.m"
|
|
195
|
+
xmlns:f="sap.ui.layout.form"
|
|
196
|
+
xmlns:macro="sap.fe.macros"
|
|
197
|
+
xmlns:macroForm="sap.fe.macros.form"
|
|
198
|
+
xmlns:internalMacro="sap.fe.macros.internal"
|
|
199
|
+
xmlns:core="sap.ui.core"
|
|
200
|
+
xmlns:controls="sap.fe.macros.controls"
|
|
201
|
+
xmlns:dt="sap.ui.dt"
|
|
202
|
+
xmlns:macrodata="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
|
|
203
|
+
xmlns:fpm="sap.fe.macros.fpm"
|
|
204
|
+
xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"
|
|
205
|
+
template:require="{
|
|
206
|
+
MODEL: 'sap/ui/model/odata/v4/AnnotationHelper',
|
|
207
|
+
ID: 'sap/fe/core/helpers/StableIdHelper',
|
|
208
|
+
COMMON: 'sap/fe/macros/CommonHelper',
|
|
209
|
+
FORM: 'sap/fe/macros/form/FormHelper',
|
|
210
|
+
UI: 'sap/fe/core/templating/UIFormatters',
|
|
211
|
+
DataField: 'sap/fe/core/templating/DataFieldFormatters',
|
|
212
|
+
FieldTemplating: 'sap/fe/macros/field/FieldTemplating',
|
|
213
|
+
Property: 'sap/fe/core/templating/PropertyFormatters',
|
|
214
|
+
FIELD: 'sap/fe/macros/field/FieldHelper',
|
|
215
|
+
MACRO: 'sap/fe/macros/MacroTemplating'
|
|
216
|
+
}"
|
|
217
|
+
|
|
218
|
+
core:require="{FormContainerRuntime: 'sap/fe/macros/form/FormContainerAPI'}"
|
|
219
|
+
dt:designtime="${this.designtimeSettings}"
|
|
220
|
+
id="${this.id || undefined}"
|
|
221
|
+
visible="${this.visible}"
|
|
222
|
+
macrodata:navigationPath="${this.navigationPath}"
|
|
223
|
+
macrodata:etName="${this.contextPath.getObject("./@sapui.name")}"
|
|
224
|
+
macrodata:UiHiddenPresent="${this.hasUiHiddenAnnotation}"
|
|
225
|
+
>
|
|
226
|
+
|
|
227
|
+
<template:if test="${this.title}">
|
|
228
|
+
<f:title>
|
|
229
|
+
<core:Title level="${this.titleLevel}" text="${this.title}" />
|
|
230
|
+
</f:title>
|
|
231
|
+
</template:if>
|
|
232
|
+
|
|
233
|
+
<template:if test="${this.actions}">
|
|
234
|
+
<template:then>
|
|
235
|
+
<f:toolbar>
|
|
236
|
+
<OverflowToolbar
|
|
237
|
+
id="${overflowToolbarID}"
|
|
238
|
+
${this.attr("binding", bindingString)}
|
|
239
|
+
>
|
|
240
|
+
<Title level="${this.titleLevel}" text="${this.title}" />
|
|
241
|
+
<ToolbarSpacer />
|
|
242
|
+
<template:repeat list="{actions>}" var="action">
|
|
243
|
+
<core:Fragment fragmentName="sap.fe.macros.form.FormActionButtons" type="XML" />
|
|
244
|
+
</template:repeat>
|
|
245
|
+
</OverflowToolbar>
|
|
246
|
+
</f:toolbar>
|
|
247
|
+
</template:then>
|
|
248
|
+
</template:if>
|
|
249
|
+
|
|
250
|
+
<f:dependents>
|
|
251
|
+
<macroForm:FormContainerAPI formContainerId="${this.id}" showDetails="{internal>showDetails}" />
|
|
252
|
+
</f:dependents>
|
|
253
|
+
|
|
254
|
+
<f:formElements>
|
|
255
|
+
${this.getTemplatedFormElements()}
|
|
256
|
+
</f:formElements>
|
|
257
|
+
|
|
258
|
+
</f:FormContainer>`;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Returns the templated form elements.
|
|
263
|
+
* @returns The XML string for the form elements.
|
|
264
|
+
*/
|
|
265
|
+
public getTemplatedFormElements(): string {
|
|
266
|
+
return xml`
|
|
267
|
+
<template:with path="dataFieldCollection>" var="formElements">
|
|
268
|
+
${this.getInnerTemplatedFormElements()}
|
|
269
|
+
</template:with>`;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Returns the inner templated form elements, including DataPoint and Contact templates.
|
|
274
|
+
* @returns The XML string for the inner form elements.
|
|
275
|
+
*/
|
|
276
|
+
public getInnerTemplatedFormElements(): string {
|
|
277
|
+
let getDataPointTemplate = "";
|
|
278
|
+
|
|
279
|
+
if (this.dataFieldCollection && this.dataFieldCollection.length > 0) {
|
|
280
|
+
// We need to consider the first element that has an annotationPath
|
|
281
|
+
const firstElementWithAnnotationPath = this.dataFieldCollection.find((df) => !!df.annotationPath);
|
|
282
|
+
let idPrefix = "";
|
|
283
|
+
const isEditableHeader = this.id?.includes("HeaderFacet::FormContainer") === true;
|
|
284
|
+
let formElementId = "undefined";
|
|
285
|
+
if (this.id) {
|
|
286
|
+
if (isEditableHeader) {
|
|
287
|
+
formElementId = `${this.id}::FormElement`;
|
|
288
|
+
idPrefix = `${this.id}::FormElement`;
|
|
289
|
+
} else {
|
|
290
|
+
formElementId = `${StableIDHelper.generate([this.id, "FormElement", this.dataFieldCollection[0].key])}`;
|
|
291
|
+
idPrefix = `${StableIDHelper.generate([this.id, "FormElement", this.dataFieldCollection[0].key])}`;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (firstElementWithAnnotationPath?.annotationPath) {
|
|
295
|
+
const computedDataModelObject = getInvolvedDataModelObjects(
|
|
296
|
+
this.contextPath.getModel().createBindingContext(firstElementWithAnnotationPath?.annotationPath || "")
|
|
297
|
+
) as DataModelObjectPath<EntitySet> | undefined;
|
|
298
|
+
const bindingString = FormHelper.generateBindingExpression(this.navigationPath, computedDataModelObject);
|
|
299
|
+
const designtime = computedDataModelObject?.targetObject?.annotations?.UI?.AdaptationHidden
|
|
300
|
+
? "not-adaptable-tree"
|
|
301
|
+
: "sap/fe/macros/form/FormElement.designtime";
|
|
302
|
+
|
|
303
|
+
getDataPointTemplate = xml`
|
|
304
|
+
<template:then>
|
|
305
|
+
<template:with path="formElements>0/annotationPath" var="dataPoint">
|
|
306
|
+
<f:FormElement
|
|
307
|
+
dt:designtime="${designtime}"
|
|
308
|
+
id="${formElementId}"
|
|
309
|
+
label="{dataPoint>@@FIELD.computeLabelText}"
|
|
310
|
+
visible="${getVisibleExpression(computedDataModelObject as DataModelObjectPath<DataFieldAbstractTypes | DataPointType | Property>)}"
|
|
311
|
+
${this.attr("binding", bindingString)}
|
|
312
|
+
>
|
|
313
|
+
<f:fields>
|
|
314
|
+
<macro:Field
|
|
315
|
+
idPrefix="${idPrefix}"
|
|
316
|
+
vhIdPrefix="${this.id ? StableIDHelper.generate([this.id, "FieldValueHelp"]) : ""}"
|
|
317
|
+
contextPath="${this.entitySet?.getPath()}"
|
|
318
|
+
metaPath="${this.dataFieldCollection[0].annotationPath}"
|
|
319
|
+
editMode="${this.displayMode === true ? "Display" : undefined}"
|
|
320
|
+
onChange="${this.onChange}"
|
|
321
|
+
>
|
|
322
|
+
<formatOptions textAlignMode="Form" showEmptyIndicator="true" />
|
|
323
|
+
</macro:Field>
|
|
324
|
+
</f:fields>
|
|
325
|
+
</f:FormElement>
|
|
326
|
+
</template:with>
|
|
327
|
+
</template:then>
|
|
328
|
+
`;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
const getContactTemplate = xml`
|
|
333
|
+
<template:elseif
|
|
334
|
+
test="{= \${formElements>0/annotationPath}.indexOf('com.sap.vocabularies.Communication.v1.Contact') > -1 }"
|
|
335
|
+
>
|
|
336
|
+
<template:with path="formElements>0/annotationPath" var="metaPath">
|
|
337
|
+
<f:FormElement
|
|
338
|
+
dt:designtime="{= \${metaPath>./@com.sap.vocabularies.UI.v1.AdaptationHidden} ? 'not-adaptable-tree' : 'sap/fe/macros/form/FormElement.designtime' }"
|
|
339
|
+
binding="{= FORM.generateBindingExpression(\${this.navigationPath},\${contextPath>@@UI.getDataModelObjectPath})}"
|
|
340
|
+
>
|
|
341
|
+
<f:label>
|
|
342
|
+
<Label
|
|
343
|
+
text="{metaPath>fn/$Path@com.sap.vocabularies.Common.v1.Label}"
|
|
344
|
+
visible="{= FieldTemplating.getVisibleExpression(\${dataField>@@UI.getDataModelObjectPath})}"
|
|
345
|
+
>
|
|
346
|
+
<layoutData>
|
|
347
|
+
<f:ColumnElementData cellsLarge="12" />
|
|
348
|
+
</layoutData>
|
|
349
|
+
</Label>
|
|
350
|
+
</f:label>
|
|
351
|
+
<f:fields>
|
|
352
|
+
<macro:Contact
|
|
353
|
+
metaPath="{metaPath>@@COMMON.getMetaPath}"
|
|
354
|
+
contextPath="{contextPath>@@COMMON.getMetaPath}"
|
|
355
|
+
visible="true"
|
|
356
|
+
/>
|
|
357
|
+
</f:fields>
|
|
358
|
+
</f:FormElement>
|
|
359
|
+
</template:with>
|
|
360
|
+
</template:elseif>`;
|
|
361
|
+
|
|
362
|
+
return xml`
|
|
363
|
+
<template:if test="{= \${formElements>0/annotationPath}.indexOf('com.sap.vocabularies.UI.v1.DataPoint') > -1 }">
|
|
364
|
+
${getDataPointTemplate}
|
|
365
|
+
${getContactTemplate}
|
|
366
|
+
<template:else>
|
|
367
|
+
${this.getDataFieldsForAnnotations()}
|
|
368
|
+
</template:else>
|
|
369
|
+
</template:if>
|
|
370
|
+
`;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Generates the template for a form element with connected fields.
|
|
375
|
+
* @param formElement The form element.
|
|
376
|
+
* @returns The XML string for the connected fields form element.
|
|
377
|
+
*/
|
|
378
|
+
getConnectedFieldsFormElement(formElement: AnnotationFormElement): string {
|
|
379
|
+
let connectedFieldElements = "";
|
|
380
|
+
|
|
381
|
+
for (const connectedField of formElement.connectedFields!) {
|
|
382
|
+
const model = this.contextPath.getModel();
|
|
383
|
+
const tempName = connectedField.originalObject?.fullyQualifiedName;
|
|
384
|
+
const path = tempName?.substring(tempName.lastIndexOf("/") + 1);
|
|
385
|
+
const bindingContext = model.createBindingContext(formElement.annotationPath + "Target/$AnnotationPath/Data/" + path);
|
|
386
|
+
const delimiter = CommonHelper.getDelimiter(connectedField.originalTemplate ?? "");
|
|
387
|
+
const notLastIndexCondition =
|
|
388
|
+
formElement.connectedFields!.indexOf(connectedField) !== formElement.connectedFields!.length - 1
|
|
389
|
+
? xml`<Text
|
|
390
|
+
text="${delimiter}"
|
|
391
|
+
class="sapUiSmallMarginBeginEnd"
|
|
392
|
+
width="100%"
|
|
393
|
+
/>`
|
|
394
|
+
: "";
|
|
395
|
+
|
|
396
|
+
const computedIdPrefix = this.id
|
|
397
|
+
? StableIDHelper.generate([
|
|
398
|
+
this.id,
|
|
399
|
+
"SemanticFormElement",
|
|
400
|
+
formElement.key,
|
|
401
|
+
(connectedField.originalObject as DataField)?.Value.path
|
|
402
|
+
])
|
|
403
|
+
: "";
|
|
404
|
+
const computedVhIdPrefix = this.id ? StableIDHelper.generate([this.id, formElement.key, "FieldValueHelp"]) : "";
|
|
405
|
+
|
|
406
|
+
let connectedFieldElement = "";
|
|
407
|
+
|
|
408
|
+
connectedFieldElement = xml`
|
|
409
|
+
<macro:Field
|
|
410
|
+
idPrefix="${computedIdPrefix}"
|
|
411
|
+
vhIdPrefix="${computedVhIdPrefix}"
|
|
412
|
+
contextPath="${this.entitySet?.getPath()}"
|
|
413
|
+
metaPath="${bindingContext.getPath()}"
|
|
414
|
+
onChange="${this.onChange}"
|
|
415
|
+
ariaLabelledBy="${this.id ? StableIDHelper.generate([this.id, "SemanticFormElementLabel", formElement.key]) : ""}"
|
|
416
|
+
>
|
|
417
|
+
<formatOptions
|
|
418
|
+
textLinesEdit="${formElement.formatOptions?.textLinesEdit}"
|
|
419
|
+
textMaxLines="${formElement.formatOptions?.textMaxLines}"
|
|
420
|
+
textMaxCharactersDisplay="${formElement.formatOptions?.textMaxCharactersDisplay}"
|
|
421
|
+
textMaxLength="${formElement.formatOptions?.textMaxLength}"
|
|
422
|
+
textExpandBehaviorDisplay="${formElement.formatOptions?.textExpandBehaviorDisplay}"
|
|
423
|
+
textAlignMode="Form"
|
|
424
|
+
showEmptyIndicator="true"
|
|
425
|
+
fieldEditStyle="${formElement.formatOptions?.fieldEditStyle}"
|
|
426
|
+
radioButtonsHorizontalLayout="${formElement.formatOptions?.radioButtonsHorizontalLayout}"
|
|
427
|
+
/>
|
|
428
|
+
<macro:layoutData>
|
|
429
|
+
<FlexItemData growFactor="{= %{ui>/isEditable} ? 1 : 0}" />
|
|
430
|
+
</macro:layoutData>
|
|
431
|
+
</macro:Field>
|
|
432
|
+
${notLastIndexCondition}
|
|
433
|
+
`;
|
|
434
|
+
|
|
435
|
+
connectedFieldElements += connectedFieldElement;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
const dataModelObjectForConnectedFields = getInvolvedDataModelObjects(
|
|
439
|
+
this.contextPath.getModel().createBindingContext(formElement.annotationPath ?? "")
|
|
440
|
+
) as DataModelObjectPath<EntitySet> | undefined;
|
|
441
|
+
let formElementId = "";
|
|
442
|
+
if (this.id) {
|
|
443
|
+
if (this.contentId) {
|
|
444
|
+
formElementId = `${this.contentId}--${StableIDHelper.generate([this.id, "SemanticFormElement", formElement.key])}`;
|
|
445
|
+
} else {
|
|
446
|
+
formElementId = `${StableIDHelper.generate([this.id, "SemanticFormElement", formElement.key])}`;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
const visibleExpression = formElement.isPartOfPreview
|
|
450
|
+
? getVisibleExpression(
|
|
451
|
+
dataModelObjectForConnectedFields as DataModelObjectPath<DataFieldAbstractTypes | DataPointType | Property>
|
|
452
|
+
)
|
|
453
|
+
: "{= ${internal>showDetails} === true}";
|
|
454
|
+
const bindingString = FormHelper.generateBindingExpression(this.navigationPath, dataModelObjectForConnectedFields);
|
|
455
|
+
const targetObject = (dataModelObjectForConnectedFields?.targetObject as unknown as DataFieldForAnnotation)?.Target
|
|
456
|
+
?.$target as AnnotationTerm<ConnectedFieldsTypeTypes>;
|
|
457
|
+
|
|
458
|
+
const designtime = dataModelObjectForConnectedFields?.targetObject?.annotations?.UI?.AdaptationHidden
|
|
459
|
+
? "not-adaptable-tree"
|
|
460
|
+
: "sap/fe/macros/form/FormElement.designtime";
|
|
461
|
+
const isRequired = getRequiredExpressionForConnectedDataField(
|
|
462
|
+
dataModelObjectForConnectedFields as DataModelObjectPath<AnnotationPath<ConnectedFieldsType>>
|
|
463
|
+
)?.toString();
|
|
464
|
+
|
|
465
|
+
return xml`
|
|
466
|
+
<f:FormElement
|
|
467
|
+
xmlns:f="sap.ui.layout.form"
|
|
468
|
+
dt:designtime="${designtime}"
|
|
469
|
+
id="${formElementId}"
|
|
470
|
+
visible="${visibleExpression}"
|
|
471
|
+
${this.attr("binding", bindingString)}
|
|
472
|
+
>
|
|
473
|
+
<f:label>
|
|
474
|
+
<Label
|
|
475
|
+
text="${targetObject?.Label ?? formElement.label}"
|
|
476
|
+
id="${this.id ? StableIDHelper.generate([this.id, "SemanticFormElementLabel", formElement.key]) : ""}"
|
|
477
|
+
|
|
478
|
+
/>
|
|
479
|
+
</f:label>
|
|
480
|
+
<f:fields>
|
|
481
|
+
<controls:FieldWrapper required="${isRequired}">
|
|
482
|
+
<HBox wrap="Wrap">
|
|
483
|
+
${connectedFieldElements}
|
|
484
|
+
</HBox>
|
|
485
|
+
</controls:FieldWrapper>
|
|
486
|
+
</f:fields>
|
|
487
|
+
</f:FormElement>
|
|
488
|
+
`;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Generates the template for a form element representing a multivalue field.
|
|
493
|
+
* @param formElement The form element.
|
|
494
|
+
* @returns The XML string for the multi-value field form element.
|
|
495
|
+
*/
|
|
496
|
+
getMultiValueFieldFormElement(formElement: AnnotationFormElement): string {
|
|
497
|
+
const computedDataModelObject = getInvolvedDataModelObjects(
|
|
498
|
+
this.contextPath.getModel().createBindingContext(formElement.annotationPath ?? "")
|
|
499
|
+
) as DataModelObjectPath<EntitySet> | undefined;
|
|
500
|
+
const visibleExpression = formElement.isPartOfPreview
|
|
501
|
+
? getVisibleExpression(computedDataModelObject as DataModelObjectPath<DataFieldAbstractTypes | DataPointType | Property>)
|
|
502
|
+
: "{= ${internal>showDetails} === true}";
|
|
503
|
+
const bindingString = FormHelper.generateBindingExpression(this.navigationPath, computedDataModelObject);
|
|
504
|
+
const formElementId = this.id ? `${StableIDHelper.generate([this.id, "FormElement", formElement.key])}` : "undefined";
|
|
505
|
+
const multiValueFieldId = this.id
|
|
506
|
+
? `${StableIDHelper.generate([this.id, "FormElement", formElement.key, "MultiValueField"])}`
|
|
507
|
+
: "undefined";
|
|
508
|
+
const vhIdPrefix = this.id ? StableIDHelper.generate([this.id, "FieldValueHelp"]) : "";
|
|
509
|
+
const designtime = computedDataModelObject?.targetObject?.annotations?.UI?.AdaptationHidden
|
|
510
|
+
? "not-adaptable-tree"
|
|
511
|
+
: "sap/fe/macros/form/FormElement.designtime";
|
|
512
|
+
|
|
513
|
+
return xml`
|
|
514
|
+
<f:FormElement
|
|
515
|
+
xmlns:macros="sap.fe.macros"
|
|
516
|
+
xmlns:multivaluefield="sap.fe.macros.multivaluefield"
|
|
517
|
+
dt:designtime="${designtime}"
|
|
518
|
+
id="${formElementId}"
|
|
519
|
+
label="${formElement.label}"
|
|
520
|
+
visible="${visibleExpression}"
|
|
521
|
+
${this.attr("binding", bindingString)}
|
|
522
|
+
>
|
|
523
|
+
<f:fields>
|
|
524
|
+
<macros:MultiValueField
|
|
525
|
+
id="${multiValueFieldId}"
|
|
526
|
+
vhIdPrefix="${vhIdPrefix}"
|
|
527
|
+
contextPath="${this.entitySet?.getPath()}"
|
|
528
|
+
metaPath="${formElement.annotationPath}"
|
|
529
|
+
>
|
|
530
|
+
<macros:formatOptions>
|
|
531
|
+
<multivaluefield:FormatOptions showEmptyIndicator="true" />
|
|
532
|
+
</macros:formatOptions>
|
|
533
|
+
</macros:MultiValueField>
|
|
534
|
+
</f:fields>
|
|
535
|
+
</f:FormElement>`;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Generates the template for form elements representing a checkbox group.
|
|
540
|
+
* @param formElement The form element.
|
|
541
|
+
* @returns The XML string for the checkbox group form elements.
|
|
542
|
+
*/
|
|
543
|
+
getFieldGroupFormElement(formElement: AnnotationFormElement): string {
|
|
544
|
+
let fieldGroupElements = "";
|
|
545
|
+
//We template each element of the checkbox group
|
|
546
|
+
for (const groupElement of formElement.fieldGroupElements!) {
|
|
547
|
+
const model = this.contextPath.getModel();
|
|
548
|
+
const tempName = groupElement.fullyQualifiedName;
|
|
549
|
+
const path = tempName?.substring(tempName.lastIndexOf("/") + 1);
|
|
550
|
+
const bindingContext = model.createBindingContext(formElement.annotationPath + "Target/$AnnotationPath/Data/" + path);
|
|
551
|
+
const groupElementDataModelObject = getInvolvedDataModelObjects<DataFieldAbstractTypes | DataPointType>(bindingContext);
|
|
552
|
+
const computedIdPrefix = this.id
|
|
553
|
+
? `${StableIDHelper.generate([
|
|
554
|
+
this.id,
|
|
555
|
+
"CheckBoxGroup",
|
|
556
|
+
formElement.key,
|
|
557
|
+
(groupElementDataModelObject.targetObject as DataField | DataPointType)?.Value?.path
|
|
558
|
+
])}`
|
|
559
|
+
: "";
|
|
560
|
+
|
|
561
|
+
const isBooleanFieldGroup =
|
|
562
|
+
(groupElementDataModelObject.targetObject as DataField | DataPointType)?.Value?.$target?.type === "Edm.Boolean";
|
|
563
|
+
|
|
564
|
+
const fieldGroupElement = isBooleanFieldGroup
|
|
565
|
+
? xml`
|
|
566
|
+
<macro:Field
|
|
567
|
+
idPrefix="${computedIdPrefix}"
|
|
568
|
+
contextPath="${this.entitySet?.getPath()}"
|
|
569
|
+
metaPath="${bindingContext.getPath()}"
|
|
570
|
+
onChange="${this.onChange}"
|
|
571
|
+
ariaLabelledBy="${this.id ? StableIDHelper.generate([this.id, "FieldGroupFormElementLabel", formElement.key]) : ""}"
|
|
572
|
+
>
|
|
573
|
+
<formatOptions isFieldGroupItem="true" textAlignMode="Form" />
|
|
574
|
+
</macro:Field>
|
|
575
|
+
`
|
|
576
|
+
: "";
|
|
577
|
+
|
|
578
|
+
fieldGroupElements += fieldGroupElement;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
const computedDataModelObject = getInvolvedDataModelObjects(
|
|
582
|
+
this.contextPath.getModel().createBindingContext(formElement.annotationPath ?? "")
|
|
583
|
+
) as DataModelObjectPath<EntitySet> | undefined;
|
|
584
|
+
const visibleExpression = formElement.isPartOfPreview
|
|
585
|
+
? getVisibleExpression(computedDataModelObject as DataModelObjectPath<DataFieldAbstractTypes | DataPointType | Property>)
|
|
586
|
+
: "{= ${internal>showDetails} === true}";
|
|
587
|
+
const bindingString = FormHelper.generateBindingExpression(this.navigationPath, computedDataModelObject);
|
|
588
|
+
let fieldGroupFormElementId = "";
|
|
589
|
+
let labelID = "";
|
|
590
|
+
if (this.id) {
|
|
591
|
+
if (this.contentId) {
|
|
592
|
+
fieldGroupFormElementId = `${this.contentId}--${StableIDHelper.generate([
|
|
593
|
+
this.id,
|
|
594
|
+
"FieldGroupFormElement",
|
|
595
|
+
formElement.key
|
|
596
|
+
])}`;
|
|
597
|
+
labelID = `${this.contentId}--${StableIDHelper.generate([this.id, "FieldGroupFormElementLabel", formElement.key])}`;
|
|
598
|
+
} else {
|
|
599
|
+
fieldGroupFormElementId = `${StableIDHelper.generate([this.id, "FieldGroupFormElement", formElement.key])}`;
|
|
600
|
+
labelID = `${StableIDHelper.generate([this.id, "FieldGroupFormElementLabel", formElement.key])}`;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
const targetObject = (computedDataModelObject?.targetObject as unknown as DataFieldForAnnotation)?.Target?.$target as FieldGroup;
|
|
604
|
+
|
|
605
|
+
const designtime = computedDataModelObject?.targetObject?.annotations?.UI?.AdaptationHidden
|
|
606
|
+
? "not-adaptable-tree"
|
|
607
|
+
: "sap/fe/macros/form/FormElement.designtime";
|
|
608
|
+
|
|
609
|
+
return xml`
|
|
610
|
+
<f:FormElement
|
|
611
|
+
xmlns:f="sap.ui.layout.form"
|
|
612
|
+
dt:designtime="${designtime}"
|
|
613
|
+
id="${fieldGroupFormElementId}"
|
|
614
|
+
visible="${visibleExpression}"
|
|
615
|
+
${this.attr("binding", bindingString)}
|
|
616
|
+
>
|
|
617
|
+
<f:label>
|
|
618
|
+
<Label
|
|
619
|
+
text="${targetObject?.Label ?? formElement.label}"
|
|
620
|
+
id="${labelID}"
|
|
621
|
+
/>
|
|
622
|
+
</f:label>
|
|
623
|
+
<f:fields>
|
|
624
|
+
<controls:RequiredFlexBox>
|
|
625
|
+
<FlexBox
|
|
626
|
+
direction="${formElement.formatOptions?.fieldGroupHorizontalLayout === true ? "Row" : "Column"}"
|
|
627
|
+
wrap="Wrap"
|
|
628
|
+
columnGap="1rem"
|
|
629
|
+
>
|
|
630
|
+
<items>
|
|
631
|
+
${fieldGroupElements}
|
|
632
|
+
</items>
|
|
633
|
+
</FlexBox>
|
|
634
|
+
</controls:RequiredFlexBox>
|
|
635
|
+
</f:fields>
|
|
636
|
+
</f:FormElement>
|
|
637
|
+
`;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Generates the template for a form element representing a field.
|
|
642
|
+
* @param formElement The form element.
|
|
643
|
+
* @returns The XML string for the field form element.
|
|
644
|
+
*/
|
|
645
|
+
getFieldFormElement(formElement: AnnotationFormElement): string {
|
|
646
|
+
const computedDataModelObject = getInvolvedDataModelObjects(
|
|
647
|
+
this.contextPath.getModel().createBindingContext(formElement.annotationPath ?? "")
|
|
648
|
+
) as DataModelObjectPath<EntitySet> | undefined;
|
|
649
|
+
const bindingString = FormHelper.generateBindingExpression(this.navigationPath, computedDataModelObject);
|
|
650
|
+
const computedVhIdPrefix = StableIDHelper.generate([this.id, "FieldValueHelp"]);
|
|
651
|
+
let formElementId = "undefined";
|
|
652
|
+
const visibleExpression = formElement.isPartOfPreview
|
|
653
|
+
? getVisibleExpression(computedDataModelObject as DataModelObjectPath<DataFieldAbstractTypes | DataPointType | Property>)
|
|
654
|
+
: "{= ${internal>showDetails} === true}";
|
|
655
|
+
const computedIdPrefix = this.id ? `${StableIDHelper.generate([this.id, "FormElement", formElement.key])}` : "";
|
|
656
|
+
if (this.id) {
|
|
657
|
+
if (this.contentId) {
|
|
658
|
+
formElementId = `${this.contentId}--${StableIDHelper.generate([this.id, "FormElement", formElement.key])}`;
|
|
659
|
+
} else {
|
|
660
|
+
formElementId = `${StableIDHelper.generate([this.id, "FormElement", formElement.key])}`;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
const designtime = computedDataModelObject?.targetObject?.annotations?.UI?.AdaptationHidden
|
|
664
|
+
? "not-adaptable-tree"
|
|
665
|
+
: "sap/fe/macros/form/FormElement.designtime";
|
|
666
|
+
|
|
667
|
+
return xml`
|
|
668
|
+
<f:FormElement
|
|
669
|
+
xmlns:f="sap.ui.layout.form"
|
|
670
|
+
dt:designtime="${designtime}"
|
|
671
|
+
id="${formElementId}"
|
|
672
|
+
label="${formElement.label}"
|
|
673
|
+
visible="${visibleExpression}"
|
|
674
|
+
${this.attr("binding", bindingString)}
|
|
675
|
+
>
|
|
676
|
+
<f:fields>
|
|
677
|
+
<macro:Field
|
|
678
|
+
idPrefix="${computedIdPrefix}"
|
|
679
|
+
vhIdPrefix="${computedVhIdPrefix}"
|
|
680
|
+
contextPath="${this.contextPath.getPath()}"
|
|
681
|
+
metaPath="${formElement.annotationPath}"
|
|
682
|
+
onChange="${this.onChange}"
|
|
683
|
+
readOnly="${formElement.readOnly}"
|
|
684
|
+
semanticObject="${formElement.semanticObject}"
|
|
685
|
+
>
|
|
686
|
+
<formatOptions
|
|
687
|
+
textLinesEdit="${formElement.formatOptions?.textLinesEdit}"
|
|
688
|
+
textMaxLines="${formElement.formatOptions?.textMaxLines}"
|
|
689
|
+
textMaxLength="${formElement.formatOptions?.textMaxLength}"
|
|
690
|
+
textMaxCharactersDisplay="${formElement.formatOptions?.textMaxCharactersDisplay}"
|
|
691
|
+
textExpandBehaviorDisplay="${formElement.formatOptions?.textExpandBehaviorDisplay}"
|
|
692
|
+
textAlignMode="Form"
|
|
693
|
+
showEmptyIndicator="true"
|
|
694
|
+
fieldEditStyle="${formElement.formatOptions?.fieldEditStyle}"
|
|
695
|
+
radioButtonsHorizontalLayout="${formElement.formatOptions?.radioButtonsHorizontalLayout}"
|
|
696
|
+
dateTimePattern="${formElement.formatOptions?.pattern}"
|
|
697
|
+
useRadioButtonsForBoolean="${formElement.formatOptions?.useRadioButtonsForBoolean}"
|
|
698
|
+
/>
|
|
699
|
+
</macro:Field>
|
|
700
|
+
</f:fields>
|
|
701
|
+
</f:FormElement>
|
|
702
|
+
`;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Generates the template for a custom form element.
|
|
707
|
+
* @param formElement The custom form element.
|
|
708
|
+
* @returns The XML string for the custom form element.
|
|
709
|
+
*/
|
|
710
|
+
getCustomFormElement(formElement: CustomFormElement): string {
|
|
711
|
+
const propertyPath = this.contextPath.getPath() + "/" + formElement.propertyPath;
|
|
712
|
+
const computedDataModelObject = getInvolvedDataModelObjects(this.contextPath.getModel().createBindingContext(propertyPath)) as
|
|
713
|
+
| DataModelObjectPath<EntitySet>
|
|
714
|
+
| undefined;
|
|
715
|
+
const bindingString = FormHelper.generateBindingExpression(this.navigationPath, computedDataModelObject);
|
|
716
|
+
let formElementId = "";
|
|
717
|
+
if (this.id) {
|
|
718
|
+
if (this.contentId) {
|
|
719
|
+
formElementId = `${this.contentId}--${StableIDHelper.generate([this.id, formElement.id])}`;
|
|
720
|
+
} else {
|
|
721
|
+
formElementId = `${StableIDHelper.generate([this.id, formElement.id])}`;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
const designtime = computedDataModelObject?.targetObject?.annotations?.UI?.AdaptationHidden
|
|
725
|
+
? "not-adaptable-tree"
|
|
726
|
+
: "sap/fe/macros/form/FormElement.designtime";
|
|
727
|
+
const formElementKey = StableIDHelper.generate([this.id, formElement.key]);
|
|
728
|
+
return xml`
|
|
729
|
+
<f:FormElement
|
|
730
|
+
dt:designtime="${designtime}"
|
|
731
|
+
id="${formElementId}"
|
|
732
|
+
label="${formElement.label}"
|
|
733
|
+
visible="${formElement.visible}"
|
|
734
|
+
${this.attr("binding", bindingString)}
|
|
735
|
+
>
|
|
736
|
+
<f:fields>
|
|
737
|
+
<macroForm:CustomFormElement
|
|
738
|
+
metaPath="${formElement.propertyPath}"
|
|
739
|
+
contextPath="${this.contextPath.getPath()}"
|
|
740
|
+
formElementKey="${formElementKey}"
|
|
741
|
+
>
|
|
742
|
+
<fpm:CustomFragment
|
|
743
|
+
id="${formElementKey}"
|
|
744
|
+
fragmentName="${formElement.template}"
|
|
745
|
+
contextPath="${this.contextPath.getPath()}"
|
|
746
|
+
/>
|
|
747
|
+
</macroForm:CustomFormElement>
|
|
748
|
+
</f:fields>
|
|
749
|
+
</f:FormElement>
|
|
750
|
+
`;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Returns the template for a slot column for the given form element.
|
|
755
|
+
* @param formElement The form element.
|
|
756
|
+
* @returns The XML string for the slot column.
|
|
757
|
+
*/
|
|
758
|
+
getSlotColumn(formElement: FormElement): string {
|
|
759
|
+
return xml`<slot name="${formElement.key}" />`;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Determines if the given data field is a multivalue field.
|
|
764
|
+
* @param dataField The data field to check.
|
|
765
|
+
* @returns True if the data field is a multivalue field, false otherwise.
|
|
766
|
+
*/
|
|
767
|
+
isMultiValueDataField(dataField: FormElement): boolean {
|
|
768
|
+
let isMultiValueFieldCondition = false;
|
|
769
|
+
if (dataField.annotationPath) {
|
|
770
|
+
const bindingContext = this.contextPath.getModel().createBindingContext(dataField.annotationPath);
|
|
771
|
+
const valuePath = bindingContext.getObject()?.Value?.$Path;
|
|
772
|
+
if (valuePath) {
|
|
773
|
+
isMultiValueFieldCondition = isMultiValueField(
|
|
774
|
+
enhanceDataModelPath(getInvolvedDataModelObjects(bindingContext), valuePath)
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
return isMultiValueFieldCondition;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Generates the template for all data fields for annotations.
|
|
784
|
+
* @returns The XML string for the data fields.
|
|
785
|
+
*/
|
|
786
|
+
getDataFieldsForAnnotations(): string {
|
|
787
|
+
let returnString = "";
|
|
788
|
+
|
|
789
|
+
if (this.dataFieldCollection !== undefined) {
|
|
790
|
+
for (const dataField of this.dataFieldCollection) {
|
|
791
|
+
switch (dataField.type) {
|
|
792
|
+
case "Annotation":
|
|
793
|
+
if (
|
|
794
|
+
(dataField as AnnotationFormElement).connectedFields &&
|
|
795
|
+
(dataField as AnnotationFormElement).connectedFields!.length > 0
|
|
796
|
+
) {
|
|
797
|
+
returnString += this.getConnectedFieldsFormElement(dataField);
|
|
798
|
+
} else if (this.isMultiValueDataField(dataField)) {
|
|
799
|
+
returnString += this.getMultiValueFieldFormElement(dataField);
|
|
800
|
+
} else if (
|
|
801
|
+
(dataField as AnnotationFormElement).fieldGroupElements &&
|
|
802
|
+
(dataField as AnnotationFormElement).fieldGroupElements!.length > 0
|
|
803
|
+
) {
|
|
804
|
+
returnString += this.getFieldGroupFormElement(dataField);
|
|
805
|
+
} else {
|
|
806
|
+
returnString += this.getFieldFormElement(dataField);
|
|
807
|
+
}
|
|
808
|
+
break;
|
|
809
|
+
case "Default":
|
|
810
|
+
returnString += this.getCustomFormElement(dataField as CustomFormElement);
|
|
811
|
+
break;
|
|
812
|
+
default:
|
|
813
|
+
returnString += this.getSlotColumn(dataField);
|
|
814
|
+
break;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
return xml`${returnString}`;
|
|
162
820
|
}
|
|
163
821
|
}
|