@sapui5/sap.fe.core 1.97.0 → 1.99.1
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 +5 -4
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/AnnotationHelper.js +377 -405
- package/src/sap/fe/core/AnnotationHelper.ts +385 -0
- package/src/sap/fe/core/AppComponent.js +6 -3
- package/src/sap/fe/core/AppStateHandler.js +229 -181
- package/src/sap/fe/core/AppStateHandler.ts +171 -0
- package/src/sap/fe/core/BaseController.js +3 -2
- package/src/sap/fe/core/BusyLocker.js +105 -121
- package/src/sap/fe/core/BusyLocker.ts +98 -0
- package/src/sap/fe/core/CommonUtils.js +2073 -2379
- package/src/sap/fe/core/CommonUtils.ts +2078 -0
- package/src/sap/fe/core/ExtensionAPI.js +16 -7
- package/src/sap/fe/core/PageController.js +84 -119
- package/src/sap/fe/core/PageController.ts +101 -0
- package/src/sap/fe/core/RouterProxy.js +986 -807
- package/src/sap/fe/core/RouterProxy.ts +838 -0
- package/src/sap/fe/core/Synchronization.js +51 -35
- package/src/sap/fe/core/Synchronization.ts +29 -0
- package/src/sap/fe/core/TemplateComponent.js +173 -155
- package/src/sap/fe/core/TemplateComponent.ts +166 -0
- package/src/sap/fe/core/TemplateModel.js +97 -54
- package/src/sap/fe/core/TemplateModel.ts +64 -0
- package/src/sap/fe/core/TransactionHelper.js +1576 -1579
- package/src/sap/fe/core/TransactionHelper.ts +1706 -0
- package/src/sap/fe/core/actions/draft.js +560 -581
- package/src/sap/fe/core/actions/draft.ts +594 -0
- package/src/sap/fe/core/actions/messageHandling.js +545 -511
- package/src/sap/fe/core/actions/messageHandling.ts +532 -0
- package/src/sap/fe/core/actions/nonDraft.js +17 -19
- package/src/sap/fe/core/actions/nonDraft.ts +12 -0
- package/src/sap/fe/core/actions/operations.js +1074 -1211
- package/src/sap/fe/core/actions/operations.ts +1162 -0
- package/src/sap/fe/core/actions/sticky.js +102 -105
- package/src/sap/fe/core/actions/sticky.ts +102 -0
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +3 -2
- package/src/sap/fe/core/controllerextensions/EditFlow.js +229 -260
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +3 -2
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +288 -13
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +27 -23
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +82 -46
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +113 -25
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +135 -44
- package/src/sap/fe/core/controllerextensions/MassEdit.js +172 -0
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +22 -9
- package/src/sap/fe/core/controllerextensions/PageReady.js +3 -3
- package/src/sap/fe/core/controllerextensions/PageReady.ts +12 -8
- package/src/sap/fe/core/controllerextensions/Paginator.js +37 -9
- package/src/sap/fe/core/controllerextensions/Placeholder.js +8 -4
- package/src/sap/fe/core/controllerextensions/Routing.js +25 -5
- package/src/sap/fe/core/controllerextensions/RoutingListener.js +3 -2
- package/src/sap/fe/core/controllerextensions/Share.js +22 -8
- package/src/sap/fe/core/controllerextensions/SideEffects.js +9 -9
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +22 -21
- package/src/sap/fe/core/controllerextensions/ViewState.js +3 -2
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +2 -1
- package/src/sap/fe/core/controls/CommandExecution.js +3 -2
- package/src/sap/fe/core/controls/ConditionalWrapper.js +3 -2
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +3 -2
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +9 -5
- package/src/sap/fe/core/controls/FieldWrapper.js +18 -23
- package/src/sap/fe/core/controls/FilterBar.js +3 -2
- package/src/sap/fe/core/controls/FormElementWrapper.js +3 -7
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +3 -2
- package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +2 -1
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +3 -2
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +5 -4
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +3 -2
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +3 -2
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +106 -0
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +79 -0
- package/src/sap/fe/core/converters/ConverterContext.js +14 -2
- package/src/sap/fe/core/converters/ConverterContext.ts +14 -3
- package/src/sap/fe/core/converters/ManifestSettings.js +1 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +4 -0
- package/src/sap/fe/core/converters/ManifestWrapper.js +56 -32
- package/src/sap/fe/core/converters/ManifestWrapper.ts +24 -6
- package/src/sap/fe/core/converters/MetaModelConverter.js +67 -6
- package/src/sap/fe/core/converters/MetaModelConverter.ts +70 -14
- package/src/sap/fe/core/converters/TemplateConverter.js +1 -1
- package/src/sap/fe/core/converters/TemplateConverter.ts +2 -2
- package/src/sap/fe/core/converters/annotations/DataField.js +3 -3
- package/src/sap/fe/core/converters/annotations/DataField.ts +1 -1
- package/src/sap/fe/core/converters/common/AnnotationConverter.js +33 -21
- package/src/sap/fe/core/converters/controls/Common/Action.js +11 -2
- package/src/sap/fe/core/converters/controls/Common/Action.ts +8 -2
- package/src/sap/fe/core/converters/controls/Common/Chart.js +5 -3
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +11 -3
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +3 -3
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +2 -2
- package/src/sap/fe/core/converters/controls/Common/Form.js +20 -10
- package/src/sap/fe/core/converters/controls/Common/Form.ts +24 -4
- package/src/sap/fe/core/converters/controls/Common/KPI.js +69 -4
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +72 -0
- package/src/sap/fe/core/converters/controls/Common/Table.js +390 -398
- package/src/sap/fe/core/converters/controls/Common/Table.ts +497 -484
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +527 -0
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +655 -0
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +489 -37
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +506 -58
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +2 -2
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +1 -1
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +17 -9
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +24 -9
- package/src/sap/fe/core/converters/helpers/Aggregation.js +18 -3
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +28 -5
- package/src/sap/fe/core/converters/helpers/IssueManager.js +7 -1
- package/src/sap/fe/core/converters/helpers/IssueManager.ts +6 -0
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +4 -4
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +3 -3
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +13 -6
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +26 -15
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +11 -2
- package/src/sap/fe/core/formatters/CriticalityFormatter.js +1 -1
- package/src/sap/fe/core/formatters/CriticalityFormatter.ts +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.js +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.ts +4 -10
- package/src/sap/fe/core/formatters/KPIFormatter.js +1 -1
- package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -1
- package/src/sap/fe/core/formatters/TableFormatter.js +39 -28
- package/src/sap/fe/core/formatters/TableFormatter.ts +43 -28
- package/src/sap/fe/core/formatters/ValueFormatter.js +30 -5
- package/src/sap/fe/core/formatters/ValueFormatter.ts +30 -7
- package/src/sap/fe/core/fpm/Component.js +3 -2
- package/src/sap/fe/core/helpers/AppStartupHelper.js +359 -0
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +391 -0
- package/src/sap/fe/core/helpers/BindingExpression.js +484 -437
- package/src/sap/fe/core/helpers/BindingExpression.ts +480 -463
- package/src/sap/fe/core/helpers/ClassSupport.js +27 -15
- package/src/sap/fe/core/helpers/ClassSupport.ts +31 -20
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +63 -59
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +56 -0
- package/src/sap/fe/core/helpers/EditState.js +81 -84
- package/src/sap/fe/core/helpers/EditState.ts +81 -0
- package/src/sap/fe/core/helpers/ExcelFormatHelper.js +62 -48
- package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +49 -0
- package/src/sap/fe/core/helpers/FPMHelper.js +52 -56
- package/src/sap/fe/core/helpers/FPMHelper.ts +62 -0
- package/src/sap/fe/core/helpers/KeepAliveHelper.js +4 -5
- package/src/sap/fe/core/helpers/KeepAliveHelper.ts +10 -10
- package/src/sap/fe/core/helpers/MassEditHelper.js +687 -0
- package/src/sap/fe/core/helpers/ModelHelper.js +229 -225
- package/src/sap/fe/core/helpers/ModelHelper.ts +227 -0
- package/src/sap/fe/core/helpers/PasteHelper.js +210 -132
- package/src/sap/fe/core/helpers/PasteHelper.ts +196 -0
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +332 -313
- package/src/sap/fe/core/helpers/SemanticDateOperators.ts +330 -0
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +66 -67
- package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +73 -0
- package/src/sap/fe/core/helpers/StableIdHelper.js +4 -7
- package/src/sap/fe/core/helpers/StableIdHelper.ts +2 -6
- package/src/sap/fe/core/jsx-runtime/jsx.js +1 -1
- package/src/sap/fe/core/jsx-runtime/jsx.ts +1 -1
- package/src/sap/fe/core/library.js +30 -3
- package/src/sap/fe/core/library.support.js +12 -5
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +62 -0
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +66 -0
- package/src/sap/fe/core/messagebundle.properties +61 -13
- package/src/sap/fe/core/messagebundle_ar.properties +33 -2
- package/src/sap/fe/core/messagebundle_bg.properties +33 -2
- package/src/sap/fe/core/messagebundle_ca.properties +33 -2
- package/src/sap/fe/core/messagebundle_cs.properties +34 -3
- package/src/sap/fe/core/messagebundle_cy.properties +33 -2
- package/src/sap/fe/core/messagebundle_da.properties +33 -2
- package/src/sap/fe/core/messagebundle_de.properties +33 -2
- package/src/sap/fe/core/messagebundle_el.properties +33 -2
- package/src/sap/fe/core/messagebundle_en.properties +32 -1
- package/src/sap/fe/core/messagebundle_en_GB.properties +32 -1
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +36 -1
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +33 -2
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +33 -2
- package/src/sap/fe/core/messagebundle_es.properties +33 -2
- package/src/sap/fe/core/messagebundle_es_MX.properties +33 -2
- package/src/sap/fe/core/messagebundle_et.properties +33 -2
- package/src/sap/fe/core/messagebundle_fi.properties +34 -3
- package/src/sap/fe/core/messagebundle_fr.properties +38 -7
- package/src/sap/fe/core/messagebundle_fr_CA.properties +33 -2
- package/src/sap/fe/core/messagebundle_hi.properties +33 -2
- package/src/sap/fe/core/messagebundle_hr.properties +33 -2
- package/src/sap/fe/core/messagebundle_hu.properties +34 -3
- package/src/sap/fe/core/messagebundle_id.properties +36 -5
- package/src/sap/fe/core/messagebundle_it.properties +33 -2
- package/src/sap/fe/core/messagebundle_iw.properties +33 -2
- package/src/sap/fe/core/messagebundle_ja.properties +33 -2
- package/src/sap/fe/core/messagebundle_kk.properties +33 -2
- package/src/sap/fe/core/messagebundle_ko.properties +33 -2
- package/src/sap/fe/core/messagebundle_lt.properties +33 -2
- package/src/sap/fe/core/messagebundle_lv.properties +33 -2
- package/src/sap/fe/core/messagebundle_ms.properties +33 -2
- package/src/sap/fe/core/messagebundle_nl.properties +33 -2
- package/src/sap/fe/core/messagebundle_no.properties +33 -2
- package/src/sap/fe/core/messagebundle_pl.properties +33 -2
- package/src/sap/fe/core/messagebundle_pt.properties +34 -3
- package/src/sap/fe/core/messagebundle_pt_PT.properties +33 -2
- package/src/sap/fe/core/messagebundle_ro.properties +33 -2
- package/src/sap/fe/core/messagebundle_ru.properties +33 -2
- package/src/sap/fe/core/messagebundle_sh.properties +33 -2
- package/src/sap/fe/core/messagebundle_sk.properties +33 -2
- package/src/sap/fe/core/messagebundle_sl.properties +33 -2
- package/src/sap/fe/core/messagebundle_sv.properties +34 -3
- package/src/sap/fe/core/messagebundle_th.properties +33 -2
- package/src/sap/fe/core/messagebundle_tr.properties +33 -2
- package/src/sap/fe/core/messagebundle_uk.properties +33 -2
- package/src/sap/fe/core/messagebundle_vi.properties +33 -2
- package/src/sap/fe/core/messagebundle_zh_CN.properties +33 -2
- package/src/sap/fe/core/messagebundle_zh_TW.properties +33 -2
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +2 -2
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +3 -1
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +269 -202
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +212 -0
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +4 -3
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +9 -5
- package/src/sap/fe/core/services/NavigationServiceFactory.js +406 -300
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +316 -0
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +149 -81
- package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +80 -0
- package/src/sap/fe/core/services/RoutingServiceFactory.js +987 -1152
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +898 -0
- package/src/sap/fe/core/services/ShellServicesFactory.js +31 -2
- package/src/sap/fe/core/services/ShellServicesFactory.ts +45 -11
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +42 -85
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +57 -100
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +461 -478
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +453 -0
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +10 -8
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +8 -0
- package/src/sap/fe/core/support/AnnotationIssue.support.js +15 -3
- package/src/sap/fe/core/support/AnnotationIssue.support.ts +16 -2
- package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.js +2 -2
- package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.ts +1 -1
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.js +38 -0
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.ts +18 -0
- package/src/sap/fe/core/templating/DataModelPathHelper.js +10 -48
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +14 -46
- package/src/sap/fe/core/templating/DisplayModeFormatter.js +114 -0
- package/src/sap/fe/core/templating/DisplayModeFormatter.ts +86 -0
- package/src/sap/fe/core/templating/FieldControlHelper.js +8 -8
- package/src/sap/fe/core/templating/FieldControlHelper.ts +25 -7
- package/src/sap/fe/core/templating/FilterHelper.js +139 -70
- package/src/sap/fe/core/templating/FilterHelper.ts +140 -70
- package/src/sap/fe/core/templating/PropertyHelper.js +2 -2
- package/src/sap/fe/core/templating/PropertyHelper.ts +1 -1
- package/src/sap/fe/core/templating/UIFormatters.js +45 -110
- package/src/sap/fe/core/templating/UIFormatters.ts +39 -75
- package/src/sap/fe/core/type/Email.js +1 -1
- package/src/sap/fe/core/type/Email.ts +4 -6
- package/ui5.yaml +0 -3
- package/src/sap/fe/core/controls/filterbar.d.js +0 -8
- package/src/sap/fe/core/controls/filterbar.d.ts +0 -0
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
import ConverterContext from "../../../ConverterContext";
|
|
2
|
+
import {
|
|
3
|
+
and,
|
|
4
|
+
annotationExpression,
|
|
5
|
+
bindingExpression,
|
|
6
|
+
BindingExpression,
|
|
7
|
+
compileBinding,
|
|
8
|
+
constant,
|
|
9
|
+
equal,
|
|
10
|
+
length,
|
|
11
|
+
Expression,
|
|
12
|
+
greaterOrEqual,
|
|
13
|
+
ifElse,
|
|
14
|
+
isBinding,
|
|
15
|
+
isConstant,
|
|
16
|
+
not,
|
|
17
|
+
notEqual,
|
|
18
|
+
or,
|
|
19
|
+
greaterThan
|
|
20
|
+
} from "sap/fe/core/helpers/BindingExpression";
|
|
21
|
+
import { CreationMode, NavigationSettingsConfiguration, TemplateType, ViewPathConfiguration } from "../../../ManifestSettings";
|
|
22
|
+
import { singletonPathVisitor, UI } from "../../../helpers/BindingHelper";
|
|
23
|
+
import { PropertyAnnotationValue } from "@sap-ux/vocabularies-types";
|
|
24
|
+
import { getTargetObjectPath, isPathDeletable, isPathInsertable, isPathUpdatable } from "sap/fe/core/templating/DataModelPathHelper";
|
|
25
|
+
import { TableControlConfiguration } from "../Table";
|
|
26
|
+
|
|
27
|
+
export type StandardActionConfigType = {
|
|
28
|
+
isTemplated?: BindingExpression<boolean>;
|
|
29
|
+
visible: BindingExpression<boolean>;
|
|
30
|
+
enabled: BindingExpression<boolean>;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type ExpressionRestrictionsType = {
|
|
34
|
+
expression: Expression<boolean>;
|
|
35
|
+
isOnlyCurrentEntityExpression: boolean;
|
|
36
|
+
};
|
|
37
|
+
type StandardActionsRestrictionsType = Record<string, ExpressionRestrictionsType>;
|
|
38
|
+
|
|
39
|
+
export type StandardActionsContext = {
|
|
40
|
+
collectionPath: string;
|
|
41
|
+
hiddenAnnotation: {
|
|
42
|
+
create: Expression<boolean>;
|
|
43
|
+
"delete": Expression<boolean>;
|
|
44
|
+
update: Expression<boolean>;
|
|
45
|
+
};
|
|
46
|
+
isExternalCreateConfigured: boolean;
|
|
47
|
+
isDraftOrStickySupported: boolean;
|
|
48
|
+
isViewWithMultipleVisualizations: boolean;
|
|
49
|
+
newAction?: {
|
|
50
|
+
name?: string;
|
|
51
|
+
available?: Expression<boolean>;
|
|
52
|
+
};
|
|
53
|
+
tableManifestConfiguration: TableControlConfiguration;
|
|
54
|
+
restrictions: StandardActionsRestrictionsType;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Generates the context for the standard actions.
|
|
59
|
+
*
|
|
60
|
+
* @param {ConverterContext} converterContext
|
|
61
|
+
* @param {NavigationSettingsConfiguration} navigationSettings
|
|
62
|
+
* @param {TableControlConfiguration} tableManifestConfiguration
|
|
63
|
+
* @param {ViewPathConfiguration} viewConfiguration
|
|
64
|
+
* @returns The context for table actions
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
export function generateStandardActionsContext(
|
|
68
|
+
converterContext: ConverterContext,
|
|
69
|
+
navigationSettings: NavigationSettingsConfiguration,
|
|
70
|
+
tableManifestConfiguration: TableControlConfiguration,
|
|
71
|
+
viewConfiguration?: ViewPathConfiguration
|
|
72
|
+
): StandardActionsContext {
|
|
73
|
+
return {
|
|
74
|
+
collectionPath: getTargetObjectPath(converterContext.getDataModelObjectPath()),
|
|
75
|
+
hiddenAnnotation: {
|
|
76
|
+
create: isActionAnnotatedHidden(converterContext, "CreateHidden"),
|
|
77
|
+
"delete": isActionAnnotatedHidden(converterContext, "DeleteHidden"),
|
|
78
|
+
update: isActionAnnotatedHidden(converterContext, "UpdateHidden")
|
|
79
|
+
},
|
|
80
|
+
isExternalCreateConfigured: isExternalCreateConfigured(navigationSettings),
|
|
81
|
+
isDraftOrStickySupported: isDraftOrStickySupported(converterContext),
|
|
82
|
+
isViewWithMultipleVisualizations: viewConfiguration
|
|
83
|
+
? converterContext.getManifestWrapper().hasMultipleVisualizations(viewConfiguration)
|
|
84
|
+
: false,
|
|
85
|
+
newAction: getNewAction(converterContext),
|
|
86
|
+
tableManifestConfiguration: tableManifestConfiguration,
|
|
87
|
+
restrictions: getRestrictions(converterContext)
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Checks if an external created is configured for the navigation.
|
|
93
|
+
*
|
|
94
|
+
* @param {NavigationSettingsConfiguration} navigationSettings
|
|
95
|
+
* @returns {boolean}
|
|
96
|
+
*/
|
|
97
|
+
export function isExternalCreateConfigured(navigationSettings: NavigationSettingsConfiguration): boolean {
|
|
98
|
+
const navigation = navigationSettings?.create;
|
|
99
|
+
return (navigation && navigation.outbound && navigation.outboundDetail) !== undefined;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Checks if draft is supported.
|
|
104
|
+
*
|
|
105
|
+
* @param {ConverterContext} converterContext
|
|
106
|
+
* @returns {boolean}
|
|
107
|
+
*/
|
|
108
|
+
export function isDraftSupported(converterContext: ConverterContext): boolean {
|
|
109
|
+
const currentEntitySet = converterContext.getEntitySet();
|
|
110
|
+
const bIsDraftRoot = currentEntitySet && currentEntitySet.annotations?.Common?.DraftRoot ? true : false;
|
|
111
|
+
const bIsDraftNode = currentEntitySet && currentEntitySet.annotations?.Common?.DraftNode ? true : false;
|
|
112
|
+
const bIsDraftParentEntityForContainment =
|
|
113
|
+
converterContext.getDataModelObjectPath().targetObject?.containsTarget &&
|
|
114
|
+
(converterContext.getDataModelObjectPath().startingEntitySet?.annotations?.Common?.DraftRoot ||
|
|
115
|
+
converterContext.getDataModelObjectPath().startingEntitySet?.annotations?.Common?.DraftNode)
|
|
116
|
+
? true
|
|
117
|
+
: false;
|
|
118
|
+
|
|
119
|
+
return bIsDraftRoot || bIsDraftNode || (!converterContext.getEntitySet() && bIsDraftParentEntityForContainment);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Checks if sticky or draft is supported.
|
|
124
|
+
*
|
|
125
|
+
* @param {ConverterContext} converterContext
|
|
126
|
+
* @returns {boolean}
|
|
127
|
+
*/
|
|
128
|
+
export function isDraftOrStickySupported(converterContext: ConverterContext): boolean {
|
|
129
|
+
const bIsDraftSupported = isDraftSupported(converterContext);
|
|
130
|
+
const bIsStickySessionSupported = converterContext.getDataModelObjectPath().startingEntitySet?.annotations?.Session
|
|
131
|
+
?.StickySessionSupported
|
|
132
|
+
? true
|
|
133
|
+
: false;
|
|
134
|
+
|
|
135
|
+
return bIsDraftSupported || bIsStickySessionSupported;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Gets the configured newAction into annotation.
|
|
140
|
+
*
|
|
141
|
+
* @param {ConverterContext} converterContext
|
|
142
|
+
* @returns {any}
|
|
143
|
+
*/
|
|
144
|
+
export function getNewAction(converterContext: ConverterContext): any {
|
|
145
|
+
const currentEntitySet = converterContext.getEntitySet();
|
|
146
|
+
const newActionName: BindingExpression<string> = (
|
|
147
|
+
currentEntitySet?.annotations?.Common?.DraftRoot?.NewAction ||
|
|
148
|
+
currentEntitySet?.annotations?.Session?.StickySessionSupported?.NewAction
|
|
149
|
+
)?.toString();
|
|
150
|
+
if (newActionName) {
|
|
151
|
+
let availableProperty: any = converterContext?.getEntityType().actions[newActionName]?.annotations?.Core?.OperationAvailable;
|
|
152
|
+
availableProperty = availableProperty !== undefined ? availableProperty : true;
|
|
153
|
+
return {
|
|
154
|
+
name: newActionName,
|
|
155
|
+
available: annotationExpression(availableProperty)
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Gets the binding expression for the action visibility configured into annotation.
|
|
163
|
+
*
|
|
164
|
+
* @param {ConverterContext} converterContext
|
|
165
|
+
* @param {string} sAnnotationTerm
|
|
166
|
+
* @returns {Expression<boolean>}
|
|
167
|
+
*/
|
|
168
|
+
export function isActionAnnotatedHidden(converterContext: ConverterContext, sAnnotationTerm: string): Expression<boolean> {
|
|
169
|
+
const currentEntitySet = converterContext.getEntitySet();
|
|
170
|
+
const dataModelObjectPath = converterContext.getDataModelObjectPath();
|
|
171
|
+
// Consider only the last level of navigation. The others are already considered in the element binding of the page.
|
|
172
|
+
const visitedNavigationPaths =
|
|
173
|
+
dataModelObjectPath.navigationProperties.length > 0
|
|
174
|
+
? [dataModelObjectPath.navigationProperties[dataModelObjectPath.navigationProperties.length - 1].name]
|
|
175
|
+
: [];
|
|
176
|
+
return currentEntitySet
|
|
177
|
+
? annotationExpression(
|
|
178
|
+
((currentEntitySet?.annotations.UI as any)?.[sAnnotationTerm] as PropertyAnnotationValue<boolean>) || false,
|
|
179
|
+
visitedNavigationPaths,
|
|
180
|
+
undefined,
|
|
181
|
+
(path: string) => singletonPathVisitor(path, converterContext, visitedNavigationPaths)
|
|
182
|
+
)
|
|
183
|
+
: constant(false);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Gets the annotated restrictions for the actions.
|
|
188
|
+
*
|
|
189
|
+
* @param {ConverterContext} converterContext
|
|
190
|
+
* @returns {StandardActionsRestrictionsType}
|
|
191
|
+
*/
|
|
192
|
+
export function getRestrictions(converterContext: ConverterContext): StandardActionsRestrictionsType {
|
|
193
|
+
const dataModelObjectPath = converterContext.getDataModelObjectPath();
|
|
194
|
+
const restrictionsDef = [
|
|
195
|
+
{
|
|
196
|
+
key: "isInsertable",
|
|
197
|
+
"function": isPathInsertable
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
key: "isUpdatable",
|
|
201
|
+
"function": isPathUpdatable
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
key: "isDeletable",
|
|
205
|
+
"function": isPathDeletable
|
|
206
|
+
}
|
|
207
|
+
];
|
|
208
|
+
const result: Record<string, ExpressionRestrictionsType> = {};
|
|
209
|
+
restrictionsDef.forEach(function(def) {
|
|
210
|
+
const defFunction = def["function"];
|
|
211
|
+
result[def.key] = {
|
|
212
|
+
expression: defFunction.apply(null, [dataModelObjectPath]),
|
|
213
|
+
isOnlyCurrentEntityExpression: !!(defFunction.apply(null, [dataModelObjectPath, undefined, true]) as any)
|
|
214
|
+
?.currentEntityRestriction
|
|
215
|
+
};
|
|
216
|
+
});
|
|
217
|
+
return result;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Checks if templating for insert/update actions is mandatory.
|
|
222
|
+
*
|
|
223
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
224
|
+
* @param {boolean} isDraftOrSticky
|
|
225
|
+
* @param {boolean} isCreateAlwaysHidden
|
|
226
|
+
* @returns {boolean}
|
|
227
|
+
*/
|
|
228
|
+
export function getInsertUpdateActionsTemplating(
|
|
229
|
+
standardActionsContext: StandardActionsContext,
|
|
230
|
+
isDraftOrSticky: boolean,
|
|
231
|
+
isCreateAlwaysHidden: boolean
|
|
232
|
+
): boolean {
|
|
233
|
+
return (isDraftOrSticky || standardActionsContext.isExternalCreateConfigured) && !isCreateAlwaysHidden;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Gets the binding expressions for the properties of the action Create.
|
|
238
|
+
*
|
|
239
|
+
* @param {ConverterContext} converterContext
|
|
240
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
241
|
+
* @returns {StandardActionConfigType}
|
|
242
|
+
*/
|
|
243
|
+
export function getStandardActionCreate(
|
|
244
|
+
converterContext: ConverterContext,
|
|
245
|
+
standardActionsContext: StandardActionsContext
|
|
246
|
+
): StandardActionConfigType {
|
|
247
|
+
const createVisibility = getCreateVisibility(converterContext, standardActionsContext);
|
|
248
|
+
return {
|
|
249
|
+
isTemplated: compileBinding(getCreateTemplating(standardActionsContext, createVisibility)),
|
|
250
|
+
visible: compileBinding(createVisibility),
|
|
251
|
+
enabled: compileBinding(getCreateEnablement(converterContext, standardActionsContext, createVisibility))
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Gets the binding expressions for the properties of the action Delete.
|
|
257
|
+
*
|
|
258
|
+
* @param {ConverterContext} converterContext
|
|
259
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
260
|
+
* @returns {StandardActionConfigType}
|
|
261
|
+
*/
|
|
262
|
+
export function getStandardActionDelete(
|
|
263
|
+
converterContext: ConverterContext,
|
|
264
|
+
standardActionsContext: StandardActionsContext
|
|
265
|
+
): StandardActionConfigType {
|
|
266
|
+
const deleteVisibility = getDeleteVisibility(converterContext, standardActionsContext);
|
|
267
|
+
|
|
268
|
+
return {
|
|
269
|
+
isTemplated: compileBinding(getDefaultTemplating(deleteVisibility)),
|
|
270
|
+
visible: compileBinding(deleteVisibility),
|
|
271
|
+
enabled: compileBinding(getDeleteEnablement(converterContext, standardActionsContext, deleteVisibility))
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Gets the binding expressions for the properties of the action Paste.
|
|
277
|
+
*
|
|
278
|
+
* @param {ConverterContext} converterContext
|
|
279
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
280
|
+
* @param {boolean} isInsertUpdateActionsTemplated
|
|
281
|
+
* @returns {StandardActionConfigType}
|
|
282
|
+
*/
|
|
283
|
+
export function getStandardActionPaste(
|
|
284
|
+
converterContext: ConverterContext,
|
|
285
|
+
standardActionsContext: StandardActionsContext,
|
|
286
|
+
isInsertUpdateActionsTemplated: boolean
|
|
287
|
+
): StandardActionConfigType {
|
|
288
|
+
const createVisibility = getCreateVisibility(converterContext, standardActionsContext);
|
|
289
|
+
const createEnablement = getCreateEnablement(converterContext, standardActionsContext, createVisibility);
|
|
290
|
+
const pasteVisibility = getPasteVisibility(converterContext, standardActionsContext, createVisibility, isInsertUpdateActionsTemplated);
|
|
291
|
+
return {
|
|
292
|
+
visible: compileBinding(pasteVisibility),
|
|
293
|
+
enabled: compileBinding(getPasteEnablement(pasteVisibility, createEnablement))
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Gets the binding expressions for the properties of the action MassEdit.
|
|
299
|
+
*
|
|
300
|
+
* @param {ConverterContext} converterContext
|
|
301
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
302
|
+
* @returns {StandardActionConfigType}
|
|
303
|
+
*/
|
|
304
|
+
export function getStandardActionMassEdit(
|
|
305
|
+
converterContext: ConverterContext,
|
|
306
|
+
standardActionsContext: StandardActionsContext
|
|
307
|
+
): StandardActionConfigType {
|
|
308
|
+
const massEditVisibility = getMassEditVisibility(converterContext, standardActionsContext);
|
|
309
|
+
|
|
310
|
+
return {
|
|
311
|
+
isTemplated: compileBinding(getDefaultTemplating(massEditVisibility)),
|
|
312
|
+
visible: compileBinding(massEditVisibility),
|
|
313
|
+
enabled: compileBinding(getMassEditEnablement(converterContext, standardActionsContext, massEditVisibility))
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Gets the binding expression for the templating of the action Create.
|
|
319
|
+
*
|
|
320
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
321
|
+
* @param {Expression<boolean>} createVisibility
|
|
322
|
+
* @returns {Expression<boolean> }
|
|
323
|
+
*/
|
|
324
|
+
export function getCreateTemplating(
|
|
325
|
+
standardActionsContext: StandardActionsContext,
|
|
326
|
+
createVisibility: Expression<boolean>
|
|
327
|
+
): Expression<boolean> {
|
|
328
|
+
const isCreationRow = standardActionsContext.tableManifestConfiguration.creationMode === CreationMode.CreationRow;
|
|
329
|
+
const newAction = standardActionsContext.newAction;
|
|
330
|
+
const isInsertable = standardActionsContext.restrictions.isInsertable.expression;
|
|
331
|
+
|
|
332
|
+
//Templating of Create Button is not done:
|
|
333
|
+
// - If Button is never visible or CreationMode is on CreationRow
|
|
334
|
+
// - Otherwise If new action is configured and never available
|
|
335
|
+
// - Otherwise If delete restrictions coming from NavigationRestrictions are constantly false
|
|
336
|
+
// - Otherwise If there is no external create action
|
|
337
|
+
// - Otherwise if there is delete restrictions on the current entitySet set to false
|
|
338
|
+
|
|
339
|
+
return ifElse(
|
|
340
|
+
or(and(isConstant(createVisibility), equal(createVisibility, false)), isCreationRow),
|
|
341
|
+
false,
|
|
342
|
+
ifElse(
|
|
343
|
+
and(isConstant(newAction?.available), equal(newAction?.available, false)),
|
|
344
|
+
false,
|
|
345
|
+
ifElse(
|
|
346
|
+
and(not(standardActionsContext.restrictions.isInsertable.isOnlyCurrentEntityExpression), isConstant(isInsertable)),
|
|
347
|
+
isInsertable,
|
|
348
|
+
ifElse(
|
|
349
|
+
standardActionsContext.isExternalCreateConfigured,
|
|
350
|
+
true,
|
|
351
|
+
not(and(isConstant(isInsertable), equal(isInsertable, constant(false))))
|
|
352
|
+
)
|
|
353
|
+
)
|
|
354
|
+
)
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Gets the binding expression for the templating of the non-Create actions.
|
|
360
|
+
*
|
|
361
|
+
* @param {Expression<boolean>} actionVisibility
|
|
362
|
+
* @returns {Expression<boolean> }
|
|
363
|
+
*/
|
|
364
|
+
export function getDefaultTemplating(actionVisibility: Expression<boolean>): Expression<boolean> {
|
|
365
|
+
return not(and(isConstant(actionVisibility), equal(actionVisibility, false)));
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Gets the binding expression for the property visible of the action Create.
|
|
370
|
+
*
|
|
371
|
+
* @param {ConverterContext} converterContext
|
|
372
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
373
|
+
* @returns {Expression<boolean> }
|
|
374
|
+
*/
|
|
375
|
+
export function getCreateVisibility(
|
|
376
|
+
converterContext: ConverterContext,
|
|
377
|
+
standardActionsContext: StandardActionsContext
|
|
378
|
+
): Expression<boolean> {
|
|
379
|
+
const isInsertable = standardActionsContext.restrictions.isInsertable.expression;
|
|
380
|
+
const isCreateHidden = standardActionsContext.hiddenAnnotation.create;
|
|
381
|
+
const newAction = standardActionsContext.newAction;
|
|
382
|
+
|
|
383
|
+
//Create Button is visible:
|
|
384
|
+
// - If the creation mode is external
|
|
385
|
+
// - If we're on the list report and create is not hidden
|
|
386
|
+
// - Otherwise this depends on the value of the the UI.IsEditable
|
|
387
|
+
// - Otherwise
|
|
388
|
+
// - If we're on the list report ->
|
|
389
|
+
// - If UI.CreateHidden points to a property path -> provide a negated binding to this path
|
|
390
|
+
// - Otherwise, create is visible
|
|
391
|
+
// - Otherwise
|
|
392
|
+
// - This depends on the value of the the UI.IsEditable
|
|
393
|
+
return ifElse(
|
|
394
|
+
standardActionsContext.isExternalCreateConfigured,
|
|
395
|
+
ifElse(
|
|
396
|
+
converterContext.getTemplateType() === TemplateType.ListReport,
|
|
397
|
+
not(isCreateHidden),
|
|
398
|
+
and(not(isCreateHidden), UI.IsEditable)
|
|
399
|
+
),
|
|
400
|
+
ifElse(
|
|
401
|
+
or(
|
|
402
|
+
and(isConstant(newAction?.available), equal(newAction?.available, false)),
|
|
403
|
+
and(isConstant(isInsertable), equal(isInsertable, false), !newAction),
|
|
404
|
+
and(isConstant(isCreateHidden), equal(isCreateHidden, true)),
|
|
405
|
+
standardActionsContext.isViewWithMultipleVisualizations,
|
|
406
|
+
converterContext.getTemplateType() === TemplateType.AnalyticalListPage
|
|
407
|
+
),
|
|
408
|
+
false,
|
|
409
|
+
ifElse(
|
|
410
|
+
converterContext.getTemplateType() === TemplateType.ListReport,
|
|
411
|
+
ifElse(isBinding(isCreateHidden), not(isCreateHidden), true),
|
|
412
|
+
and(not(isCreateHidden), UI.IsEditable)
|
|
413
|
+
)
|
|
414
|
+
)
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Gets the binding expression for the property visible of the action Delete.
|
|
420
|
+
*
|
|
421
|
+
* @param {ConverterContext} converterContext
|
|
422
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
423
|
+
* @returns {Expression<boolean> }
|
|
424
|
+
*/
|
|
425
|
+
export function getDeleteVisibility(
|
|
426
|
+
converterContext: ConverterContext,
|
|
427
|
+
standardActionsContext: StandardActionsContext
|
|
428
|
+
): Expression<boolean> {
|
|
429
|
+
const isDeleteHidden = standardActionsContext.hiddenAnnotation.delete;
|
|
430
|
+
const pathDeletableExpression = standardActionsContext.restrictions.isDeletable.expression;
|
|
431
|
+
|
|
432
|
+
//Delete Button is visible:
|
|
433
|
+
// Prerequisites:
|
|
434
|
+
// - If we're not on multiple visualizations configuration or ALP
|
|
435
|
+
//
|
|
436
|
+
// - If restrictions on deletable set to false -> not visible
|
|
437
|
+
// - Otherwise
|
|
438
|
+
// - If UI.DeleteHidden is true -> not visible
|
|
439
|
+
// - Otherwise
|
|
440
|
+
// - If we're on OP -> depending of the editMode and restrictions on deletable
|
|
441
|
+
// - Otherwise
|
|
442
|
+
// - If UI.DeleteHidden points to a property path -> provide a negated binding to this path
|
|
443
|
+
// - Otherwise, delete is visible
|
|
444
|
+
|
|
445
|
+
return ifElse(
|
|
446
|
+
or(standardActionsContext.isViewWithMultipleVisualizations, converterContext.getTemplateType() === TemplateType.AnalyticalListPage),
|
|
447
|
+
false,
|
|
448
|
+
ifElse(
|
|
449
|
+
and(isConstant(pathDeletableExpression), equal(pathDeletableExpression, false)),
|
|
450
|
+
false,
|
|
451
|
+
ifElse(
|
|
452
|
+
and(isConstant(isDeleteHidden), equal(isDeleteHidden, constant(true))),
|
|
453
|
+
false,
|
|
454
|
+
ifElse(
|
|
455
|
+
converterContext.getTemplateType() !== TemplateType.ListReport,
|
|
456
|
+
and(not(isDeleteHidden), equal(bindingExpression("/editMode", "ui"), "Editable")),
|
|
457
|
+
ifElse(isBinding(isDeleteHidden), not(isDeleteHidden), true)
|
|
458
|
+
)
|
|
459
|
+
)
|
|
460
|
+
)
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Gets the binding expression for the property visible of the action Paste.
|
|
466
|
+
*
|
|
467
|
+
* @param {ConverterContext} converterContext
|
|
468
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
469
|
+
* @param {Expression<boolean>} createVisibility
|
|
470
|
+
* @param {boolean} isInsertUpdateActionsTemplated
|
|
471
|
+
* @returns {Expression<boolean> }
|
|
472
|
+
*/
|
|
473
|
+
export function getPasteVisibility(
|
|
474
|
+
converterContext: ConverterContext,
|
|
475
|
+
standardActionsContext: StandardActionsContext,
|
|
476
|
+
createVisibility: Expression<boolean>,
|
|
477
|
+
isInsertUpdateActionsTemplated: boolean
|
|
478
|
+
): Expression<boolean> {
|
|
479
|
+
// If Create is visible, enablePaste is not disabled into manifest and we are on OP/blocks outside Fiori elements templates
|
|
480
|
+
// Then button will be visible according to insertable restrictions and create visibility
|
|
481
|
+
// Otherwise it's not visible
|
|
482
|
+
return ifElse(
|
|
483
|
+
and(
|
|
484
|
+
notEqual(standardActionsContext.tableManifestConfiguration.enablePaste, false),
|
|
485
|
+
createVisibility,
|
|
486
|
+
isInsertUpdateActionsTemplated
|
|
487
|
+
),
|
|
488
|
+
[TemplateType.ListReport, TemplateType.AnalyticalListPage].indexOf(converterContext.getTemplateType()) === -1 &&
|
|
489
|
+
standardActionsContext.restrictions.isInsertable.expression,
|
|
490
|
+
false
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Gets the binding expression for the property visible of the action MassEdit.
|
|
496
|
+
*
|
|
497
|
+
* @param {ConverterContext} converterContext
|
|
498
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
499
|
+
* @returns {Expression<boolean> }
|
|
500
|
+
*/
|
|
501
|
+
export function getMassEditVisibility(
|
|
502
|
+
converterContext: ConverterContext,
|
|
503
|
+
standardActionsContext: StandardActionsContext
|
|
504
|
+
): Expression<boolean> {
|
|
505
|
+
const isUpdateHidden = standardActionsContext.hiddenAnnotation.update,
|
|
506
|
+
pathUpdatableExpression = standardActionsContext.restrictions.isUpdatable.expression,
|
|
507
|
+
bMassEditEnabledInManifest: boolean = standardActionsContext.tableManifestConfiguration?.enableMassEdit || false;
|
|
508
|
+
const templateBindingExpression =
|
|
509
|
+
converterContext.getTemplateType() === TemplateType.ObjectPage
|
|
510
|
+
? equal(UI.IsEditable, true)
|
|
511
|
+
: converterContext.getTemplateType() === TemplateType.ListReport;
|
|
512
|
+
//MassEdit is visible
|
|
513
|
+
// If
|
|
514
|
+
// - there is no static restrictions set to false
|
|
515
|
+
// - and enableMassEdit is not set to false into the manifest
|
|
516
|
+
// - and the selectionMode is relevant
|
|
517
|
+
// Then MassEdit is always visible in LR or dynamically visible in OP according to ui>Editable and hiddenAnnotation
|
|
518
|
+
// Button is hidden for all other cases
|
|
519
|
+
return ifElse(
|
|
520
|
+
and(not(and(isConstant(pathUpdatableExpression), equal(pathUpdatableExpression, false))), bMassEditEnabledInManifest),
|
|
521
|
+
and(templateBindingExpression, not(isUpdateHidden)),
|
|
522
|
+
false
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Gets the binding expression for the property enabled of the action Create.
|
|
528
|
+
*
|
|
529
|
+
* @param {ConverterContext} converterContext
|
|
530
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
531
|
+
* @param {Expression<boolean>} createVisibility
|
|
532
|
+
* @returns {Expression<boolean> }
|
|
533
|
+
*/
|
|
534
|
+
export function getCreateEnablement(
|
|
535
|
+
converterContext: ConverterContext,
|
|
536
|
+
standardActionsContext: StandardActionsContext,
|
|
537
|
+
createVisibility: Expression<boolean>
|
|
538
|
+
): Expression<boolean> {
|
|
539
|
+
const isInsertable = standardActionsContext.restrictions.isInsertable.expression;
|
|
540
|
+
const CollectionType = converterContext.resolveAbsolutePath<any>(standardActionsContext.collectionPath).target?._type;
|
|
541
|
+
return and(
|
|
542
|
+
createVisibility,
|
|
543
|
+
ifElse(
|
|
544
|
+
CollectionType === "EntitySet",
|
|
545
|
+
true,
|
|
546
|
+
ifElse(
|
|
547
|
+
converterContext.getTemplateType() !== TemplateType.ObjectPage,
|
|
548
|
+
isInsertable,
|
|
549
|
+
and(isInsertable, equal(bindingExpression("/editMode", "ui"), "Editable"))
|
|
550
|
+
)
|
|
551
|
+
)
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Gets the binding expression for the property enabled of the action Delete.
|
|
557
|
+
*
|
|
558
|
+
* @param {ConverterContext} converterContext
|
|
559
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
560
|
+
* @param {Expression<boolean>} deleteVisibility
|
|
561
|
+
* @returns {Expression<boolean> }
|
|
562
|
+
*/
|
|
563
|
+
export function getDeleteEnablement(
|
|
564
|
+
converterContext: ConverterContext,
|
|
565
|
+
standardActionsContext: StandardActionsContext,
|
|
566
|
+
deleteVisibility: Expression<boolean>
|
|
567
|
+
): Expression<boolean> {
|
|
568
|
+
const isDeletable = standardActionsContext.restrictions.isDeletable.expression;
|
|
569
|
+
const isOnlyDynamicOnCurrentEntity =
|
|
570
|
+
standardActionsContext.restrictions.isDeletable.isOnlyCurrentEntityExpression && !isConstant(isDeletable);
|
|
571
|
+
const numberOfSelectedContexts = bindingExpression("numberOfSelectedContexts", "internal");
|
|
572
|
+
const numberOfDeletableContexts = bindingExpression("deletableContexts", "internal");
|
|
573
|
+
const numberOfUnSavedContexts = bindingExpression("unSavedContexts", "internal");
|
|
574
|
+
|
|
575
|
+
return and(
|
|
576
|
+
deleteVisibility,
|
|
577
|
+
ifElse(
|
|
578
|
+
or(converterContext.getTemplateType() !== TemplateType.ObjectPage, isOnlyDynamicOnCurrentEntity),
|
|
579
|
+
ifElse(
|
|
580
|
+
or(
|
|
581
|
+
and(notEqual(numberOfDeletableContexts, undefined), greaterThan(length(numberOfDeletableContexts), 0)),
|
|
582
|
+
and(notEqual(numberOfUnSavedContexts, undefined), greaterThan(length(numberOfUnSavedContexts), 0))
|
|
583
|
+
),
|
|
584
|
+
bindingExpression("deleteEnabled", "internal"),
|
|
585
|
+
false
|
|
586
|
+
),
|
|
587
|
+
and(notEqual(numberOfSelectedContexts, 0), isDeletable)
|
|
588
|
+
)
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Gets the binding expression for the property enabled of the action Paste.
|
|
594
|
+
*
|
|
595
|
+
* @param {Expression<boolean>} pasteVisibility
|
|
596
|
+
* @param {Expression<boolean>} createEnablement
|
|
597
|
+
* @returns {Expression<boolean> }
|
|
598
|
+
*/
|
|
599
|
+
export function getPasteEnablement(pasteVisibility: Expression<boolean>, createEnablement: Expression<boolean>): Expression<boolean> {
|
|
600
|
+
return and(pasteVisibility, createEnablement);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Gets the binding expression for the property enabled of the action MassEdit.
|
|
605
|
+
*
|
|
606
|
+
* @param {ConverterContext} converterContext
|
|
607
|
+
* @param {StandardActionsContext} standardActionsContext
|
|
608
|
+
* @param {Expression<boolean>} massEditVisibility
|
|
609
|
+
* @returns {Expression<boolean> }
|
|
610
|
+
*/
|
|
611
|
+
export function getMassEditEnablement(
|
|
612
|
+
converterContext: ConverterContext,
|
|
613
|
+
standardActionsContext: StandardActionsContext,
|
|
614
|
+
massEditVisibility: Expression<boolean>
|
|
615
|
+
): Expression<boolean> {
|
|
616
|
+
const pathUpdatableExpression = standardActionsContext.restrictions.isUpdatable.expression;
|
|
617
|
+
const isOnlyDynamicOnCurrentEntity: any =
|
|
618
|
+
standardActionsContext.restrictions.isUpdatable.isOnlyCurrentEntityExpression && !isConstant(pathUpdatableExpression);
|
|
619
|
+
const numberOfSelectedContexts = greaterOrEqual(bindingExpression("numberOfSelectedContexts", "internal"), 1);
|
|
620
|
+
const numberOfUpdatableContexts = greaterOrEqual(length(bindingExpression("updatableContexts", "internal")), 1);
|
|
621
|
+
const bIsDraftSupported = isDraftSupported(converterContext);
|
|
622
|
+
const bDisplayMode = isInDisplayMode(converterContext);
|
|
623
|
+
|
|
624
|
+
// numberOfUpdatableContexts needs to be added to the binding in case
|
|
625
|
+
// 1. Update is dependent on current entity property (isOnlyDynamicOnCurrentEntity is true).
|
|
626
|
+
// 2. The table is read only and draft enabled(like LR), in this case only active contexts can be mass edited.
|
|
627
|
+
// So, update depends on 'IsActiveEntity' value which needs to be checked runtime.
|
|
628
|
+
const runtimeBinding = ifElse(
|
|
629
|
+
or(and(bDisplayMode, bIsDraftSupported), isOnlyDynamicOnCurrentEntity),
|
|
630
|
+
and(numberOfSelectedContexts, numberOfUpdatableContexts),
|
|
631
|
+
and(numberOfSelectedContexts)
|
|
632
|
+
);
|
|
633
|
+
|
|
634
|
+
return and(massEditVisibility, ifElse(isOnlyDynamicOnCurrentEntity, runtimeBinding, and(runtimeBinding, pathUpdatableExpression)));
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Tells if the table in template is in display mode.
|
|
639
|
+
*
|
|
640
|
+
* @param {ConverterContext} converterContext
|
|
641
|
+
* @param {ViewPathConfiguration} viewConfiguration
|
|
642
|
+
* @returns {boolean}
|
|
643
|
+
*/
|
|
644
|
+
export function isInDisplayMode(converterContext: ConverterContext, viewConfiguration?: ViewPathConfiguration): boolean {
|
|
645
|
+
const templateType = converterContext.getTemplateType();
|
|
646
|
+
if (
|
|
647
|
+
templateType === TemplateType.ListReport ||
|
|
648
|
+
templateType === TemplateType.AnalyticalListPage ||
|
|
649
|
+
(viewConfiguration && converterContext.getManifestWrapper().hasMultipleVisualizations(viewConfiguration))
|
|
650
|
+
) {
|
|
651
|
+
return true;
|
|
652
|
+
}
|
|
653
|
+
// updatable will be handled at the property level
|
|
654
|
+
return false;
|
|
655
|
+
}
|