@sap-ux/ui5-test-writer 0.7.94 → 0.7.95
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.
|
@@ -255,7 +255,11 @@ function extractAllActionStates(dataFieldForActions, metadata, entityTypeName) {
|
|
|
255
255
|
function buildActionButtonState(item, metadata, entityTypeName) {
|
|
256
256
|
const actionMethod = extractActionMethodName(item.Action || '');
|
|
257
257
|
const operationAvailable = findOperationAvailableAnnotation(metadata, entityTypeName, actionMethod);
|
|
258
|
-
|
|
258
|
+
// Bound actions whose binding parameter is a single entity (not a collection) require
|
|
259
|
+
// row selection to be invoked, so they are disabled by default (no row selected).
|
|
260
|
+
// Collection-bound actions operate on the entity set and are always enabled.
|
|
261
|
+
const isEntityBound = item.ActionTarget?.isBound === true && item.ActionTarget?.parameters?.[0]?.isCollection !== true;
|
|
262
|
+
const { enabled, dynamicPath } = analyzeOperationAvailability(operationAvailable, isEntityBound);
|
|
259
263
|
return {
|
|
260
264
|
label: item.Label || '',
|
|
261
265
|
action: item.Action || '',
|
|
@@ -267,13 +271,15 @@ function buildActionButtonState(item, metadata, entityTypeName) {
|
|
|
267
271
|
}
|
|
268
272
|
/**
|
|
269
273
|
* Analyzes Core.OperationAvailable annotation to determine action availability.
|
|
274
|
+
* Single-entity bound actions (requiring row selection) are disabled by default when no annotation is present.
|
|
270
275
|
*
|
|
271
276
|
* @param operationAvailable The OperationAvailable annotation value
|
|
277
|
+
* @param isEntityBound Whether the action is bound to a single entity (requires row selection to enable)
|
|
272
278
|
* @returns Object containing enabled state and optional dynamic path
|
|
273
279
|
*/
|
|
274
|
-
function analyzeOperationAvailability(operationAvailable) {
|
|
280
|
+
function analyzeOperationAvailability(operationAvailable, isEntityBound) {
|
|
275
281
|
if (operationAvailable === undefined) {
|
|
276
|
-
return { enabled:
|
|
282
|
+
return { enabled: !isEntityBound };
|
|
277
283
|
}
|
|
278
284
|
if (typeof operationAvailable === 'boolean') {
|
|
279
285
|
return { enabled: operationAvailable };
|