@sap-ux/ui5-test-writer 1.16.3 → 1.18.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/dist/types.d.ts CHANGED
@@ -76,6 +76,7 @@ export type FEV4ManifestTarget = {
76
76
  paths?: Array<{
77
77
  key?: string;
78
78
  entitySet?: string;
79
+ annotationPath?: string;
79
80
  template?: string;
80
81
  primary?: unknown[];
81
82
  secondary?: unknown[];
@@ -133,16 +134,17 @@ export type ContactCardField = {
133
134
  property: string;
134
135
  };
135
136
  /**
136
- * A table column whose bound property carries a `Common.Text` annotation. `textProperty` is the
137
- * sortable text target (always present); `columnProperty` is the column's own property, omitted when
138
- * `UI.TextArrangement` is `TextOnly` (only the text is sortable). When several columns share one text
139
- * target, each emits its own `columnProperty` sort test but only the first emits the text-property
140
- * test; the rest set `skipTextPropertyTest`.
137
+ * A table column whose bound property carries a `Common.Text` annotation. `columnProperty` is the
138
+ * column's own (code) property; `textProperty` is the text target. Both are asserted independently.
139
+ * When columns share one text target, only the first emits the text-property test; the rest set
140
+ * `skipTextPropertyTest` but still assert their own code column. `textPropertyNotSortable` marks a
141
+ * nav-path target in an AnalyticalTable view (cannot sort across a navigation); skipped in the sort test only.
141
142
  */
142
143
  export type TextAnnotationColumn = {
143
- columnProperty?: string;
144
+ columnProperty: string;
144
145
  textProperty: string;
145
146
  skipTextPropertyTest?: boolean;
147
+ textPropertyNotSortable?: boolean;
146
148
  };
147
149
  export type BodySubSectionFeatureData = {
148
150
  id: string;
@@ -209,6 +211,8 @@ export type ListReportTab = {
209
211
  visible?: boolean;
210
212
  dynamicPath?: string;
211
213
  };
214
+ textAnnotationColumns: TextAnnotationColumn[];
215
+ columnPersonalizationSupported?: boolean;
212
216
  };
213
217
  export type ListReportFeatures = {
214
218
  name?: string;
@@ -272,6 +276,12 @@ export interface ActionButtonState {
272
276
  * For example: "_it/__OperationControl/deductDiscount"
273
277
  */
274
278
  dynamicPath?: string;
279
+ /**
280
+ * Set when the action has no `Core.OperationAvailable` annotation and is bound to a single
281
+ * instance: it is disabled with no selection and becomes enabled once a row is selected. Unlike
282
+ * `'dynamic'`, this flip is deterministic, so the generated test can assert both states.
283
+ */
284
+ selectionEnables?: boolean;
275
285
  /**
276
286
  * The invocation grouping type if specified (e.g., "Isolated", "ChangeSet").
277
287
  */
@@ -57,6 +57,7 @@ export declare function findOperationAvailableAnnotation(metadata: ConvertedMeta
57
57
  export declare function analyzeOperationAvailability(operationAvailable: OperationAvailableWithPaths | undefined, requiresSelection?: boolean): {
58
58
  enabled: boolean | 'dynamic';
59
59
  dynamicPath?: string;
60
+ selectionEnables?: boolean;
60
61
  };
61
62
  /**
62
63
  * Extracts the enum member value from an annotation.
@@ -94,7 +94,7 @@ export function findOperationAvailableAnnotation(metadata, actionMethodName) {
94
94
  */
95
95
  export function analyzeOperationAvailability(operationAvailable, requiresSelection) {
96
96
  if (operationAvailable === undefined) {
97
- return { enabled: !requiresSelection };
97
+ return { enabled: !requiresSelection, selectionEnables: requiresSelection === true };
98
98
  }
99
99
  if (typeof operationAvailable === 'boolean') {
100
100
  return { enabled: operationAvailable };
@@ -144,7 +144,7 @@ export function buildActionButtonState(item, metadata, criticalActions) {
144
144
  const actionTarget = item.ActionTarget;
145
145
  const isBound = actionTarget?.isBound === true;
146
146
  const requiresSelection = isBound && actionTarget?.parameters?.[0]?.isCollection !== true;
147
- const { enabled, dynamicPath } = analyzeOperationAvailability(operationAvailable, requiresSelection);
147
+ const { enabled, dynamicPath, selectionEnables } = analyzeOperationAvailability(operationAvailable, requiresSelection);
148
148
  return {
149
149
  label: item.Label || '',
150
150
  action: actionMethod,
@@ -153,6 +153,7 @@ export function buildActionButtonState(item, metadata, criticalActions) {
153
153
  visible: true,
154
154
  enabled,
155
155
  dynamicPath,
156
+ selectionEnables,
156
157
  invocationGrouping: item.InvocationGrouping ? extractEnumMemberValue(item.InvocationGrouping) : undefined,
157
158
  isCritical: criticalActions?.has(actionMethod) ?? false,
158
159
  parameterDialogFields: collectActionParameterNames(actionTarget)
@@ -184,7 +185,7 @@ export function buildActionStateFromSpecModelKey(aggregationKey, label, converte
184
185
  const isBound = actionDefinition?.isBound === true;
185
186
  const requiresSelection = isBound && actionDefinition?.parameters?.[0]?.isCollection !== true;
186
187
  const operationAvailable = findOperationAvailableAnnotation(convertedMetadata, actionMethod);
187
- const { enabled, dynamicPath } = analyzeOperationAvailability(operationAvailable, requiresSelection);
188
+ const { enabled, dynamicPath, selectionEnables } = analyzeOperationAvailability(operationAvailable, requiresSelection);
188
189
  return {
189
190
  label: label ?? '',
190
191
  action: actionMethod,
@@ -193,6 +194,7 @@ export function buildActionStateFromSpecModelKey(aggregationKey, label, converte
193
194
  visible: true,
194
195
  enabled,
195
196
  dynamicPath,
197
+ selectionEnables,
196
198
  isCritical: criticalActions?.has(actionMethod) ?? false,
197
199
  parameterDialogFields: collectActionParameterNames(actionDefinition)
198
200
  };
@@ -2,6 +2,7 @@ import type { Logger } from '@sap-ux/logger';
2
2
  import type { TreeAggregation, TreeAggregations, TreeModel } from '@sap/ux-specification/dist/types/src/parser/index.js';
3
3
  import type { ActionButtonsResult, ActionButtonState, ButtonState, FEV4ManifestTarget, ListReportFeatures, ListReportTab } from '../types.js';
4
4
  import { type I18nLabelResolver } from './i18nUtils.js';
5
+ import type { TextAnnotationColumnCandidate } from './tableUtils.js';
5
6
  import type { ConvertedMetadata } from '@sap-ux/vocabularies-types';
6
7
  import { safeCheckButtonVisibility } from './actionUtils.js';
7
8
  import type { PageWithModelV4 } from '@sap/ux-specification/dist/types/src/parser/application.js';
@@ -56,6 +57,17 @@ export declare function isALPManifestTarget(target: FEV4ManifestTarget): boolean
56
57
  * @returns true if the target (or any ListReport target) is an ALP
57
58
  */
58
59
  export declare function isALPFromManifest(manifest: Manifest, targetKey?: string): boolean;
60
+ /**
61
+ * Derives text-annotation candidates for a view by reading each bound column's `Common.Text` target off
62
+ * the shared entity type. Fallback for secondary multi-tab views, where `@sap/ux-specification` resolves
63
+ * `properties.text` only on the primary view but the annotation is in metadata for every view.
64
+ *
65
+ * @param columnProperties - the view's bound column property names (in column order)
66
+ * @param convertedMetadata - converted OData metadata, source of the `Common.Text` target
67
+ * @param entitySet - entity set backing the view (undefined yields no candidates)
68
+ * @returns candidate columns with their bound property and the text annotation target property
69
+ */
70
+ export declare function extractTextAnnotationCandidatesFromMetadata(columnProperties: string[], convertedMetadata: ConvertedMetadata, entitySet: string | undefined): TextAnnotationColumnCandidate[];
59
71
  /**
60
72
  * Gets List Report features from the page model using ux-specification.
61
73
  *
@@ -155,6 +167,26 @@ export declare function getCustomFilterFieldProperties(manifest: Manifest | unde
155
167
  * @returns true if the column-adaptation dialog is available for the table
156
168
  */
157
169
  export declare function isColumnPersonalizationEnabled(manifest: Manifest | undefined, targetKey: string | undefined, contextPath?: string): boolean;
170
+ /**
171
+ * Resolves column personalization for a single multi-tab view, selecting the LineItem entry by the
172
+ * view's `annotationPath` qualifier and falling back to the unqualified `@…UI.v1.LineItem`.
173
+ *
174
+ * @param manifest - the application manifest (may be undefined)
175
+ * @param targetKey - routing target key of the List Report page
176
+ * @param annotationPath - the view's `annotationPath` (its SV/SPV qualifier source)
177
+ * @returns true if the column-adaptation dialog is available for that view's table
178
+ */
179
+ export declare function isViewColumnPersonalizationEnabled(manifest: Manifest | undefined, targetKey: string | undefined, annotationPath?: string): boolean;
180
+ /**
181
+ * Resolves a view's MDC table type (e.g. `GridTable`, `AnalyticalTable`, `ResponsiveTable`) from the
182
+ * manifest, using the same qualifier matching as {@link isViewColumnPersonalizationEnabled}.
183
+ *
184
+ * @param manifest - the application manifest (may be undefined)
185
+ * @param targetKey - routing target key of the List Report page
186
+ * @param annotationPath - the view's `annotationPath` (its SV/SPV qualifier source)
187
+ * @returns the configured table type, or undefined when none is set (MDC default is ResponsiveTable)
188
+ */
189
+ export declare function getViewTableType(manifest: Manifest | undefined, targetKey: string | undefined, annotationPath?: string): string | undefined;
158
190
  /**
159
191
  * Determines the non-custom tab keys for a multi-tab List Report, used to target a specific
160
192
  * table via `onTable("<key>")`. Custom tabs (backed by an app fragment) are skipped as they
@@ -180,6 +212,7 @@ export declare function getTableIdentifiers(manifest: Manifest | undefined, targ
180
212
  export declare function getListReportViews(manifest: Manifest | undefined, targetKey: string | undefined): {
181
213
  key: string;
182
214
  entitySet?: string;
215
+ annotationPath?: string;
183
216
  }[];
184
217
  /**
185
218
  * Retrieves the value of `@com.sap.vocabularies.Common.v1.Label` for a specific property
@@ -207,17 +240,6 @@ export declare function getPropertyLabelFromMetadata(convertedMetadata: Converte
207
240
  * @returns true if the property is hidden from the filter adaptation dialog
208
241
  */
209
242
  export declare function isHiddenFilter(convertedMetadata: ConvertedMetadata, entitySetName: string | undefined, propertyName: string): boolean;
210
- /**
211
- * Returns true if the property's `UI.TextArrangement` is `TextOnly`, checking both the nested
212
- * (`Common.Text`) and sibling (property-level) locations. Under `TextOnly` the code property is not
213
- * sortable, so its sort test must be skipped.
214
- *
215
- * @param convertedMetadata - converted OData metadata (metadata merged with local annotations)
216
- * @param entitySetName - entity set owning the property (undefined → false)
217
- * @param propertyName - property to inspect
218
- * @returns true if the text arrangement is TextOnly
219
- */
220
- export declare function isTextOnlyArrangement(convertedMetadata: ConvertedMetadata, entitySetName: string | undefined, propertyName: string): boolean;
221
243
  /**
222
244
  * Checks the state of action buttons defined in UI.LineItem annotations for a given entity set.
223
245
  *
@@ -1,6 +1,6 @@
1
1
  import { getFilterFields, getSelectionFieldItems, getSelectionFieldItemsWithLabels, getTableColumnData, getAggregations } from './modelUtils.js';
2
2
  import { passthroughLabelResolver } from './i18nUtils.js';
3
- import { extractContactCardColumnsFromNode, extractContactCardColumnsFromTableNode, extractTableColumnsFromTableNode, extractTextAnnotationColumnsFromNode, resolvePrimaryTableNode, resolveViewTableNodes } from './tableUtils.js';
3
+ import { extractContactCardColumnsFromNode, extractContactCardColumnsFromTableNode, extractTableColumnsFromTableNode, extractTextAnnotationColumnsFromNode, extractTextAnnotationColumnsFromTableNode, extractBoundColumnPropertiesFromTableNode, resolvePrimaryTableNode, resolveViewTableNodes } from './tableUtils.js';
4
4
  import { parse, merge } from '@sap-ux/edmx-parser';
5
5
  import { convert } from '@sap-ux/annotation-converter';
6
6
  import { extractActionMethodName, buildActionButtonState, buildMenuActionState, isMenuActionItem, collectCriticalActionNames, safeCheckButtonVisibility, safeCheckButtonVisibilityFromMetadata } from './actionUtils.js';
@@ -86,6 +86,65 @@ export function isALPFromManifest(manifest, targetKey) {
86
86
  return target?.name === 'sap.fe.templates.ListReport' && isALPManifestTarget(target);
87
87
  });
88
88
  }
89
+ /**
90
+ * Resolves raw text-annotation candidates into the template shape, deduplicating the text-property test
91
+ * per text target. Each candidate asserts its own code column and text target independently; when columns
92
+ * share a text target, only the first emits the text-property test (the rest set `skipTextPropertyTest`).
93
+ *
94
+ * @param candidates - raw candidates (one table or one tab)
95
+ * @param isAnalyticalTable - true when the view renders an AnalyticalTable, which cannot sort nav-path targets
96
+ * @returns the text-annotation columns to emit tests for
97
+ */
98
+ function buildTextAnnotationColumns(candidates, isAnalyticalTable = false) {
99
+ const seenTextProperties = new Set();
100
+ return candidates.map((candidate) => {
101
+ const skipTextPropertyTest = seenTextProperties.has(candidate.textProperty);
102
+ seenTextProperties.add(candidate.textProperty);
103
+ // An AnalyticalTable can only sort properties of the aggregated entity, not a nav-path target.
104
+ const textPropertyNotSortable = isAnalyticalTable && candidate.textProperty.includes('/');
105
+ return {
106
+ columnProperty: candidate.columnProperty,
107
+ textProperty: candidate.textProperty,
108
+ skipTextPropertyTest,
109
+ textPropertyNotSortable
110
+ };
111
+ });
112
+ }
113
+ /**
114
+ * Derives text-annotation candidates for a view by reading each bound column's `Common.Text` target off
115
+ * the shared entity type. Fallback for secondary multi-tab views, where `@sap/ux-specification` resolves
116
+ * `properties.text` only on the primary view but the annotation is in metadata for every view.
117
+ *
118
+ * @param columnProperties - the view's bound column property names (in column order)
119
+ * @param convertedMetadata - converted OData metadata, source of the `Common.Text` target
120
+ * @param entitySet - entity set backing the view (undefined yields no candidates)
121
+ * @returns candidate columns with their bound property and the text annotation target property
122
+ */
123
+ export function extractTextAnnotationCandidatesFromMetadata(columnProperties, convertedMetadata, entitySet) {
124
+ if (!entitySet) {
125
+ return [];
126
+ }
127
+ const resolvedEntitySet = convertedMetadata.entitySets.find((es) => es.name === entitySet);
128
+ const entityProperties = resolvedEntitySet?.entityType?.entityProperties;
129
+ if (!entityProperties) {
130
+ return [];
131
+ }
132
+ const candidates = [];
133
+ for (const columnProperty of columnProperties) {
134
+ const property = entityProperties.find((p) => p.name === columnProperty);
135
+ const text = property?.annotations?.Common?.Text;
136
+ // `Common.Text` is a path expression at runtime; vocabularies-types widens it, so narrow via a guard.
137
+ const textPath = text && typeof text === 'object' && 'type' in text && text.type === 'Path' && typeof text.path === 'string'
138
+ ? text.path
139
+ : undefined;
140
+ // "None" (any casing) is the spec-model sentinel for "no text annotation".
141
+ if (!textPath || textPath.toLowerCase() === 'none') {
142
+ continue;
143
+ }
144
+ candidates.push({ columnProperty, textProperty: textPath });
145
+ }
146
+ return candidates;
147
+ }
89
148
  /**
90
149
  * Gets List Report features from the page model using ux-specification.
91
150
  *
@@ -157,23 +216,11 @@ export function getListReportFeatures(listReportPage, log, metadata, manifest, r
157
216
  // `@UI.HiddenFilter` properties cannot be added via the adaptation dialog; skip the check when metadata is missing.
158
217
  .filter((key) => !convertedMetadata || !isHiddenFilter(convertedMetadata, listReportPage.entitySet, key))
159
218
  : undefined;
160
- // A maintained text annotation emits a sort test for the text target property (no TextArrangement
161
- // required). The code column is also sorted, except under TextOnly where it is not sortable.
219
+ // A maintained text annotation emits sort tests for both the code column and its text target.
162
220
  const meta = convertedMetadata;
163
- const seenTextProperties = new Set();
221
+ const isAnalyticalTable = getViewTableType(manifest, listReportPage.name) === 'AnalyticalTable';
164
222
  const textAnnotationColumns = meta
165
- ? extractTextAnnotationColumnsFromNode(listReportPage.model.root).map((candidate) => {
166
- // Dedupe the text-property sort test per text target; each code column keeps its own.
167
- const skipTextPropertyTest = seenTextProperties.has(candidate.textProperty);
168
- seenTextProperties.add(candidate.textProperty);
169
- return {
170
- columnProperty: isTextOnlyArrangement(meta, listReportPage.entitySet, candidate.columnProperty)
171
- ? undefined
172
- : candidate.columnProperty,
173
- textProperty: candidate.textProperty,
174
- skipTextPropertyTest
175
- };
176
- })
223
+ ? buildTextAnnotationColumns(extractTextAnnotationColumnsFromNode(listReportPage.model.root), isAnalyticalTable)
177
224
  : [];
178
225
  return {
179
226
  name: listReportPage.name,
@@ -296,6 +343,7 @@ export function getListReportTabs(listReportPage, convertedMetadata, manifest, r
296
343
  }
297
344
  const viewNodes = resolveViewTableNodes(listReportPage.model.root);
298
345
  const nodeByKey = new Map(viewNodes.map((entry) => [entry.key, entry.node]));
346
+ const criticalActions = collectCriticalActionNames(convertedMetadata);
299
347
  const tabs = [];
300
348
  views.forEach((view, index) => {
301
349
  // Match the spec-model view node by key; fall back to model order (both lists exclude custom tabs).
@@ -309,12 +357,23 @@ export function getListReportTabs(listReportPage, convertedMetadata, manifest, r
309
357
  let deleteButton = buildButtonState();
310
358
  if (convertedMetadata && entitySet) {
311
359
  const actionNames = getToolBarActionItems(getToolBarActionsFromTableNode(tableNode));
312
- toolBarActions = safeCheckActionButtonStates(convertedMetadata, entitySet, actionNames, log);
360
+ toolBarActions = safeCheckActionButtonStates(convertedMetadata, entitySet, actionNames, log, criticalActions);
313
361
  const buttonVisibility = safeCheckButtonVisibilityFromMetadata(convertedMetadata, entitySet, log);
314
362
  createButton = buildButtonState(buttonVisibility?.create);
315
363
  deleteButton = buildButtonState(buttonVisibility?.delete);
316
364
  }
317
365
  toolBarActions = toolBarActions.concat(extractCustomToolBarActionsFromTableNode(tableNode, resolveLabel, convertedMetadata));
366
+ // Secondary tabs yield no spec-model candidates (only the primary view resolves `properties.text`),
367
+ // so fall back to the shared entity type's `Common.Text` metadata.
368
+ let textAnnotationColumns = [];
369
+ if (convertedMetadata) {
370
+ let candidates = extractTextAnnotationColumnsFromTableNode(tableNode);
371
+ if (candidates.length === 0) {
372
+ candidates = extractTextAnnotationCandidatesFromMetadata(extractBoundColumnPropertiesFromTableNode(tableNode), convertedMetadata, entitySet);
373
+ }
374
+ const isAnalyticalTable = getViewTableType(manifest, listReportPage.name, view.annotationPath) === 'AnalyticalTable';
375
+ textAnnotationColumns = buildTextAnnotationColumns(candidates, isAnalyticalTable);
376
+ }
318
377
  tabs.push({
319
378
  key: view.key,
320
379
  entitySet,
@@ -322,7 +381,9 @@ export function getListReportTabs(listReportPage, convertedMetadata, manifest, r
322
381
  contactCardColumns: extractContactCardColumnsFromTableNode(tableNode),
323
382
  toolBarActions,
324
383
  createButton,
325
- deleteButton
384
+ deleteButton,
385
+ textAnnotationColumns,
386
+ columnPersonalizationSupported: isViewColumnPersonalizationEnabled(manifest, listReportPage.name, view.annotationPath)
326
387
  });
327
388
  });
328
389
  return tabs;
@@ -455,10 +516,16 @@ export function isColumnPersonalizationEnabled(manifest, targetKey, contextPath)
455
516
  return true;
456
517
  }
457
518
  const lineItemConfig = findDefaultTableLineItemConfig(controlConfiguration, contextPath);
458
- const personalization = lineItemConfig?.tableSettings?.personalization;
459
- if (personalization === undefined) {
460
- return true;
461
- }
519
+ return interpretColumnPersonalization(lineItemConfig?.tableSettings?.personalization);
520
+ }
521
+ /**
522
+ * Interprets a `tableSettings.personalization` manifest value: a boolean is used directly; an object
523
+ * enables personalization only when `column === true`; `null`/`undefined` is the Fiori elements default (enabled).
524
+ *
525
+ * @param personalization - the raw `tableSettings.personalization` value
526
+ * @returns true if column personalization is enabled
527
+ */
528
+ function interpretColumnPersonalization(personalization) {
462
529
  if (typeof personalization === 'boolean') {
463
530
  return personalization;
464
531
  }
@@ -467,6 +534,57 @@ export function isColumnPersonalizationEnabled(manifest, targetKey, contextPath)
467
534
  }
468
535
  return true;
469
536
  }
537
+ /**
538
+ * Resolves column personalization for a single multi-tab view, selecting the LineItem entry by the
539
+ * view's `annotationPath` qualifier and falling back to the unqualified `@…UI.v1.LineItem`.
540
+ *
541
+ * @param manifest - the application manifest (may be undefined)
542
+ * @param targetKey - routing target key of the List Report page
543
+ * @param annotationPath - the view's `annotationPath` (its SV/SPV qualifier source)
544
+ * @returns true if the column-adaptation dialog is available for that view's table
545
+ */
546
+ export function isViewColumnPersonalizationEnabled(manifest, targetKey, annotationPath) {
547
+ if (!manifest || !targetKey) {
548
+ return true;
549
+ }
550
+ const target = manifest['sap.ui5']?.routing?.targets?.[targetKey];
551
+ const controlConfiguration = target?.options?.settings?.controlConfiguration;
552
+ if (!controlConfiguration || typeof controlConfiguration !== 'object') {
553
+ return true;
554
+ }
555
+ const lineItemTerm = '@com.sap.vocabularies.UI.v1.LineItem';
556
+ const hashIndex = annotationPath?.indexOf('#') ?? -1;
557
+ const qualifier = hashIndex >= 0 ? annotationPath?.slice(hashIndex + 1) : undefined;
558
+ const entry = (qualifier && controlConfiguration[`${lineItemTerm}#${qualifier}`]) || controlConfiguration[lineItemTerm];
559
+ const tableSettings = entry
560
+ ?.tableSettings;
561
+ return interpretColumnPersonalization(tableSettings?.personalization);
562
+ }
563
+ /**
564
+ * Resolves a view's MDC table type (e.g. `GridTable`, `AnalyticalTable`, `ResponsiveTable`) from the
565
+ * manifest, using the same qualifier matching as {@link isViewColumnPersonalizationEnabled}.
566
+ *
567
+ * @param manifest - the application manifest (may be undefined)
568
+ * @param targetKey - routing target key of the List Report page
569
+ * @param annotationPath - the view's `annotationPath` (its SV/SPV qualifier source)
570
+ * @returns the configured table type, or undefined when none is set (MDC default is ResponsiveTable)
571
+ */
572
+ export function getViewTableType(manifest, targetKey, annotationPath) {
573
+ if (!manifest || !targetKey) {
574
+ return undefined;
575
+ }
576
+ const target = manifest['sap.ui5']?.routing?.targets?.[targetKey];
577
+ const controlConfiguration = target?.options?.settings?.controlConfiguration;
578
+ if (!controlConfiguration || typeof controlConfiguration !== 'object') {
579
+ return undefined;
580
+ }
581
+ const lineItemTerm = '@com.sap.vocabularies.UI.v1.LineItem';
582
+ const hashIndex = annotationPath?.indexOf('#') ?? -1;
583
+ const qualifier = hashIndex >= 0 ? annotationPath?.slice(hashIndex + 1) : undefined;
584
+ const entry = (qualifier && controlConfiguration[`${lineItemTerm}#${qualifier}`]) || controlConfiguration[lineItemTerm];
585
+ const type = entry?.tableSettings?.type;
586
+ return typeof type === 'string' ? type : undefined;
587
+ }
470
588
  /**
471
589
  * Determines the non-custom tab keys for a multi-tab List Report, used to target a specific
472
590
  * table via `onTable("<key>")`. Custom tabs (backed by an app fragment) are skipped as they
@@ -527,7 +645,7 @@ export function getListReportViews(manifest, targetKey) {
527
645
  typeof path.key === 'string' &&
528
646
  path.key.length > 0 &&
529
647
  !(typeof path.template === 'string' && path.template.length > 0)) {
530
- views.push({ key: path.key, entitySet: path.entitySet });
648
+ views.push({ key: path.key, entitySet: path.entitySet, annotationPath: path.annotationPath });
531
649
  }
532
650
  }
533
651
  return views;
@@ -574,29 +692,6 @@ export function isHiddenFilter(convertedMetadata, entitySetName, propertyName) {
574
692
  // `HiddenFilter: false` as hidden. Coerce via `valueOf()` to read the underlying boolean.
575
693
  return property?.annotations?.UI?.HiddenFilter?.valueOf() === true;
576
694
  }
577
- /**
578
- * Returns true if the property's `UI.TextArrangement` is `TextOnly`, checking both the nested
579
- * (`Common.Text`) and sibling (property-level) locations. Under `TextOnly` the code property is not
580
- * sortable, so its sort test must be skipped.
581
- *
582
- * @param convertedMetadata - converted OData metadata (metadata merged with local annotations)
583
- * @param entitySetName - entity set owning the property (undefined → false)
584
- * @param propertyName - property to inspect
585
- * @returns true if the text arrangement is TextOnly
586
- */
587
- export function isTextOnlyArrangement(convertedMetadata, entitySetName, propertyName) {
588
- if (!entitySetName) {
589
- return false;
590
- }
591
- const entitySet = convertedMetadata.entitySets.find((es) => es.name === entitySetName);
592
- const property = entitySet?.entityType?.entityProperties?.find((p) => p.name === propertyName);
593
- // The converter also populates TextArrangement as a property-level sibling of Common.Text, a
594
- // shape vocabularies-types does not declare — hence the indexed access.
595
- const siblingArrangement = property?.annotations?.UI?.['TextArrangement'];
596
- const textArrangement = property?.annotations?.Common?.Text?.annotations?.UI?.TextArrangement ?? siblingArrangement;
597
- // The converted enum value stringifies to e.g. "UI.TextArrangementType/TextOnly".
598
- return textArrangement !== undefined && String(textArrangement).endsWith('/TextOnly');
599
- }
600
695
  /**
601
696
  * Checks the state of action buttons defined in UI.LineItem annotations for a given entity set.
602
697
  *
@@ -20,9 +20,8 @@ type ColumnModelItem = {
20
20
  };
21
21
  };
22
22
  /**
23
- * A column that carries a text annotation in the spec model. `columnProperty` is the
24
- * column's own bound property (used to look up the `UI.TextArrangement` annotation in the
25
- * OData metadata); `textProperty` is the `Common.Text` target property (used as the sort name).
23
+ * A column carrying a `Common.Text` annotation. `columnProperty` is the column's own bound property;
24
+ * `textProperty` is the text target. A nav-path text target is valid; only a nav-path `columnProperty` is excluded.
26
25
  */
27
26
  export type TextAnnotationColumnCandidate = {
28
27
  columnProperty: string;
@@ -110,5 +109,21 @@ export declare function extractContactCardColumnsFromNode(node: TreeAggregation)
110
109
  * @returns candidate columns with their bound property and the text annotation target property
111
110
  */
112
111
  export declare function extractTextAnnotationColumnsFromNode(node: TreeAggregation): TextAnnotationColumnCandidate[];
112
+ /**
113
+ * Returns the bound property names of a resolved table node's default-available columns, omitting
114
+ * nav-path and unidentifiable columns. Per-view column source for the metadata text-annotation fallback
115
+ * (only the primary view carries `properties.text`).
116
+ *
117
+ * @param tableNode - resolved 'table' aggregation node
118
+ * @returns ordered, de-duplicated list of bound column property names
119
+ */
120
+ export declare function extractBoundColumnPropertiesFromTableNode(tableNode: TreeAggregation): string[];
121
+ /**
122
+ * Extracts text-annotation columns from a resolved 'table' node (a single table or one multi-tab view).
123
+ *
124
+ * @param tableNode - resolved 'table' aggregation node
125
+ * @returns candidate columns with their bound property and the text annotation target property
126
+ */
127
+ export declare function extractTextAnnotationColumnsFromTableNode(tableNode: TreeAggregation): TextAnnotationColumnCandidate[];
113
128
  export {};
114
129
  //# sourceMappingURL=tableUtils.d.ts.map
@@ -190,6 +190,44 @@ export function extractTextAnnotationColumnsFromNode(node) {
190
190
  if (!tableNode) {
191
191
  return [];
192
192
  }
193
+ return extractTextAnnotationColumnsFromTableNode(tableNode);
194
+ }
195
+ /**
196
+ * Returns the bound property names of a resolved table node's default-available columns, omitting
197
+ * nav-path and unidentifiable columns. Per-view column source for the metadata text-annotation fallback
198
+ * (only the primary view carries `properties.text`).
199
+ *
200
+ * @param tableNode - resolved 'table' aggregation node
201
+ * @returns ordered, de-duplicated list of bound column property names
202
+ */
203
+ export function extractBoundColumnPropertiesFromTableNode(tableNode) {
204
+ const columnsAggregation = getAggregations(tableNode)['columns'];
205
+ if (!columnsAggregation) {
206
+ return [];
207
+ }
208
+ const columnItems = getAggregations(columnsAggregation);
209
+ const properties = [];
210
+ const seen = new Set();
211
+ Object.entries(columnItems).forEach(([columnKey, column]) => {
212
+ if (!isDefaultAvailableColumn(column)) {
213
+ return;
214
+ }
215
+ const columnProperty = getColumnIdentifier(column, columnKey);
216
+ if (!columnProperty || columnProperty.includes('/') || seen.has(columnProperty)) {
217
+ return;
218
+ }
219
+ seen.add(columnProperty);
220
+ properties.push(columnProperty);
221
+ });
222
+ return properties;
223
+ }
224
+ /**
225
+ * Extracts text-annotation columns from a resolved 'table' node (a single table or one multi-tab view).
226
+ *
227
+ * @param tableNode - resolved 'table' aggregation node
228
+ * @returns candidate columns with their bound property and the text annotation target property
229
+ */
230
+ export function extractTextAnnotationColumnsFromTableNode(tableNode) {
193
231
  const columnsAggregation = getAggregations(tableNode)['columns'];
194
232
  if (!columnsAggregation) {
195
233
  return [];
@@ -202,18 +240,15 @@ export function extractTextAnnotationColumnsFromNode(node) {
202
240
  return;
203
241
  }
204
242
  const text = column.properties?.text;
205
- // The spec model uses the sentinel value "None" (any casing) to mean "no text annotation is
206
- // maintained" — such columns must not produce a sort test.
243
+ // Spec-model sentinel "None" (any casing) means no text annotation is maintained.
207
244
  if (text?.artifactType !== 'Annotation' || !text.value || text.value.toLowerCase() === 'none') {
208
245
  return;
209
246
  }
210
- // A text target reached through a navigation property (e.g. "_DunningProcedure/DunningProcedure_Text")
211
- // is not exposed as a sortable column in the sort dialog, so it cannot be used as a sort name.
212
- if (text.value.includes('/')) {
247
+ const columnProperty = getColumnIdentifier(column, columnKey);
248
+ if (columnProperty?.includes('/')) {
213
249
  return;
214
250
  }
215
- const columnProperty = getColumnIdentifier(column, columnKey);
216
- // Deduplicate by code column: distinct columns may share one text target.
251
+ // Distinct columns may share one text target; dedupe by code column.
217
252
  if (!columnProperty || seenColumnProperties.has(columnProperty)) {
218
253
  return;
219
254
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/ui5-test-writer",
3
3
  "description": "SAP UI5 tests writer",
4
- "version": "1.16.3",
4
+ "version": "1.18.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -30,8 +30,8 @@
30
30
  "@sap-ux/annotation-converter": "0.10.22",
31
31
  "@sap-ux/ui5-application-writer": "2.1.5",
32
32
  "@sap-ux/logger": "1.0.3",
33
- "@sap-ux/fiori-generator-shared": "1.2.20",
34
33
  "@sap-ux/project-access": "2.3.0",
34
+ "@sap-ux/fiori-generator-shared": "1.2.20",
35
35
  "@sap-ux/preview-middleware": "1.2.25"
36
36
  },
37
37
  "devDependencies": {