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