@sap_oss/wdio-qmate-service 2.18.3 → 2.19.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/lib/reuse/helper/tableHelper.d.ts +15 -0
- package/lib/reuse/helper/tableHelper.js +206 -0
- package/lib/reuse/helper/tableHelper.js.map +1 -0
- package/lib/reuse/modules/ui5/table.d.ts +90 -61
- package/lib/reuse/modules/ui5/table.js +304 -174
- package/lib/reuse/modules/ui5/table.js.map +1 -1
- package/lib/reuse/modules/ui5/types/ui5.types.d.ts +1 -1
- package/package.json +1 -1
- package/test/helper/configurations/chrome.headless.conf.js +1 -1
- package/test/helper/configurations/chrome.test.conf.js +38 -0
- package/test/reuse/ui5/table/getAllColumnValuesByName.spec.js +33 -0
- package/test/reuse/ui5/table/getRowSelectorByIndex.spec.js +49 -0
- package/test/reuse/ui5/table/getSelectorForRowByIndex.spec.js +46 -9
- package/test/reuse/ui5/table/getSelectorsForRowsByValues.spec.js +43 -9
- package/test/reuse/ui5/table/helper.js +8 -0
- package/test/reuse/ui5/table/selectRowByIndex.spec.js +8 -17
- package/test/reuse/ui5/table/selectRowByValues.spec.js +113 -0
- package/test/reuse/ui5/table/test.table.conf.js +2 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Ui5ControlMetadata } from "../modules/ui5/types/ui5.types";
|
|
2
|
+
export declare class TableHelper {
|
|
3
|
+
static getTable(tableId: string): any;
|
|
4
|
+
static filterTableByMetadata(tableId: string, tableMetadataName: Ui5ControlMetadata, supportedTablesMetadata: string[]): any;
|
|
5
|
+
static getItems(table: any): any[];
|
|
6
|
+
static getColumnKeyByLabelText(table: any, labelText: string): string | null;
|
|
7
|
+
static getAllColumnValuesByScrolling(table: any, columnName: string, enableScrolling?: boolean, scrollDelay?: number): Promise<string[]>;
|
|
8
|
+
static getTableMetadata(tableId: string): Ui5ControlMetadata | undefined;
|
|
9
|
+
static filterItems(items: any[], values: string[]): Promise<string[] | undefined>;
|
|
10
|
+
static filterItemsWithoutTitle(items: any[]): any[];
|
|
11
|
+
static getIdsForItemsByCellValues(rows: any, targetValues: string[], enableHighlighting?: boolean): Promise<string[] | undefined>;
|
|
12
|
+
static highlightItems(items: any[]): Promise<void>;
|
|
13
|
+
static injectHighlightStyle(): void;
|
|
14
|
+
static serializeClass(): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableHelper = void 0;
|
|
4
|
+
class TableHelper {
|
|
5
|
+
static getTable(tableId) {
|
|
6
|
+
return sap.ui.getCore().getElementById(tableId);
|
|
7
|
+
}
|
|
8
|
+
static filterTableByMetadata(tableId, tableMetadataName, supportedTablesMetadata) {
|
|
9
|
+
if (!supportedTablesMetadata.includes(tableMetadataName)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
let table = TableHelper.getTable(tableId);
|
|
13
|
+
if (tableMetadataName === supportedTablesMetadata[0] && table.getTable !== undefined) {
|
|
14
|
+
table = table.getTable();
|
|
15
|
+
}
|
|
16
|
+
return table;
|
|
17
|
+
}
|
|
18
|
+
static getItems(table) {
|
|
19
|
+
let items = [];
|
|
20
|
+
if (table.getItems !== undefined) {
|
|
21
|
+
items = table.getItems();
|
|
22
|
+
}
|
|
23
|
+
else if (table.getRows !== undefined) {
|
|
24
|
+
items = table.getRows();
|
|
25
|
+
}
|
|
26
|
+
return items;
|
|
27
|
+
}
|
|
28
|
+
static getColumnKeyByLabelText(table, labelText) {
|
|
29
|
+
let columnKey = null;
|
|
30
|
+
/**
|
|
31
|
+
* Recursively search inside a control and its children for text/value bindings
|
|
32
|
+
*/
|
|
33
|
+
function findBindingPath(control) {
|
|
34
|
+
if (!control)
|
|
35
|
+
return null;
|
|
36
|
+
// Try text or value bindings
|
|
37
|
+
const textBinding = control.getBinding?.("text");
|
|
38
|
+
const valueBinding = control.getBinding?.("value");
|
|
39
|
+
if (textBinding?.getPath?.())
|
|
40
|
+
return textBinding.getPath();
|
|
41
|
+
if (valueBinding?.getPath?.())
|
|
42
|
+
return valueBinding.getPath();
|
|
43
|
+
// Recursively search common aggregation types
|
|
44
|
+
const aggregations = ["content", "items", "cells", "components", "formElements", "elements"];
|
|
45
|
+
for (const agg of aggregations) {
|
|
46
|
+
const children = control.getAggregation?.(agg);
|
|
47
|
+
if (Array.isArray(children)) {
|
|
48
|
+
for (const child of children) {
|
|
49
|
+
const path = findBindingPath(child);
|
|
50
|
+
if (path)
|
|
51
|
+
return path;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else if (children) {
|
|
55
|
+
const path = findBindingPath(children);
|
|
56
|
+
if (path)
|
|
57
|
+
return path;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const columns = table.getColumns?.();
|
|
63
|
+
if (!columns?.length)
|
|
64
|
+
return null;
|
|
65
|
+
const isUiTable = typeof columns[0].getLabel === "function";
|
|
66
|
+
if (isUiTable) {
|
|
67
|
+
// === sap.ui.table.Table ===
|
|
68
|
+
const rows = table.getRows?.();
|
|
69
|
+
if (!rows?.length)
|
|
70
|
+
return null;
|
|
71
|
+
const row = rows[0];
|
|
72
|
+
const cells = row.getCells?.();
|
|
73
|
+
columns.forEach((column, index) => {
|
|
74
|
+
const label = column.getLabel?.();
|
|
75
|
+
if (label?.getText?.() === labelText && cells?.[index]) {
|
|
76
|
+
columnKey = findBindingPath(cells[index]);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// === sap.m.Table ===
|
|
82
|
+
const items = table.getItems?.();
|
|
83
|
+
if (!items?.length)
|
|
84
|
+
return null;
|
|
85
|
+
const cells = items[0].getCells?.();
|
|
86
|
+
columns.forEach((column, index) => {
|
|
87
|
+
const header = column.getHeader?.();
|
|
88
|
+
if (header?.getText?.() === labelText && cells?.[index]) {
|
|
89
|
+
columnKey = findBindingPath(cells[index]);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return columnKey;
|
|
94
|
+
}
|
|
95
|
+
static async getAllColumnValuesByScrolling(table, columnName, enableScrolling = true, scrollDelay = 200) {
|
|
96
|
+
const oBinding = table.getBinding("rows");
|
|
97
|
+
if (!oBinding) {
|
|
98
|
+
console.warn("No row binding found.");
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
const iTotalRows = oBinding.getLength();
|
|
102
|
+
const iPageSize = table.getVisibleRowCount();
|
|
103
|
+
const aAllValues = [];
|
|
104
|
+
const columnKey = TableHelper.getColumnKeyByLabelText(table, columnName);
|
|
105
|
+
if (columnKey == null) {
|
|
106
|
+
console.warn("Column key could not be determined for column:", columnName);
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
if (!enableScrolling) {
|
|
110
|
+
const aContexts = oBinding.getContexts(0, iTotalRows);
|
|
111
|
+
for (const oContext of aContexts) {
|
|
112
|
+
const oData = oContext.getObject();
|
|
113
|
+
if (oData && oData.hasOwnProperty(columnKey)) {
|
|
114
|
+
aAllValues.push(oData[columnKey]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
for (let i = 0; i < iTotalRows; i += iPageSize) {
|
|
120
|
+
table.setFirstVisibleRow(i);
|
|
121
|
+
// Wait for rendering/data loading
|
|
122
|
+
await new Promise((resolve) => setTimeout(resolve, scrollDelay));
|
|
123
|
+
const aContexts = oBinding.getContexts(i, iPageSize);
|
|
124
|
+
for (const oContext of aContexts) {
|
|
125
|
+
const oData = oContext.getObject();
|
|
126
|
+
if (oData && oData.hasOwnProperty(columnKey)) {
|
|
127
|
+
aAllValues.push(oData[columnKey]);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return aAllValues;
|
|
133
|
+
}
|
|
134
|
+
static getTableMetadata(tableId) {
|
|
135
|
+
const table = TableHelper.getTable(tableId);
|
|
136
|
+
if (table && typeof table.getMetadata === "function") {
|
|
137
|
+
return table.getMetadata().getName();
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
throw new Error(`Table with ID ${tableId} not found or does not have metadata.`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
static async filterItems(items, values) {
|
|
144
|
+
const matchedItems = items.filter((item) => values.every((val) => Object.values(item.getBindingContext().getObject()).includes(val)));
|
|
145
|
+
if (!matchedItems.length)
|
|
146
|
+
return undefined;
|
|
147
|
+
await TableHelper.highlightItems(matchedItems);
|
|
148
|
+
return matchedItems.map((item) => item?.getId?.()).filter(Boolean);
|
|
149
|
+
}
|
|
150
|
+
static filterItemsWithoutTitle(items) {
|
|
151
|
+
// Filter items with undefined or empty title since titles in rows/columnListItems are only used for dividers of grouped items
|
|
152
|
+
return items.filter((item) => item.getTitle === undefined || item.getTitle() === "");
|
|
153
|
+
}
|
|
154
|
+
static async getIdsForItemsByCellValues(rows, targetValues, enableHighlighting = true) {
|
|
155
|
+
const matchedRows = rows.filter((row) => {
|
|
156
|
+
const cells = row.getCells();
|
|
157
|
+
return targetValues.every((val) => cells.some((cell) => {
|
|
158
|
+
const domRef = cell.getDomRef();
|
|
159
|
+
return domRef && domRef.innerText && domRef.innerText.includes(val);
|
|
160
|
+
}));
|
|
161
|
+
});
|
|
162
|
+
if (!matchedRows.length)
|
|
163
|
+
return undefined;
|
|
164
|
+
if (enableHighlighting)
|
|
165
|
+
await TableHelper.highlightItems(matchedRows);
|
|
166
|
+
return matchedRows.map((item) => item.getId());
|
|
167
|
+
}
|
|
168
|
+
static async highlightItems(items) {
|
|
169
|
+
if (!items || !items.length)
|
|
170
|
+
return;
|
|
171
|
+
TableHelper.injectHighlightStyle();
|
|
172
|
+
await new Promise((resolve) => {
|
|
173
|
+
setTimeout(() => {
|
|
174
|
+
items.forEach((item) => {
|
|
175
|
+
const domRef = item.getDomRef?.();
|
|
176
|
+
if (domRef) {
|
|
177
|
+
domRef.classList.add("rowHighlightFlash");
|
|
178
|
+
setTimeout(() => domRef.classList.remove("rowHighlightFlash"), 2000);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
setTimeout(resolve, 2250); // total time to wait before resolving
|
|
182
|
+
}, 250);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
static injectHighlightStyle() {
|
|
186
|
+
// @ts-ignore: error TS2584: Cannot find name 'document'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'.
|
|
187
|
+
if (!document.getElementById("highlightRowStyle")) {
|
|
188
|
+
// @ts-ignore: error TS2584: Cannot find name 'document'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'.
|
|
189
|
+
const style = document.createElement("style");
|
|
190
|
+
style.id = "highlightRowStyle";
|
|
191
|
+
style.innerHTML = `
|
|
192
|
+
.rowHighlightFlash {
|
|
193
|
+
background-color: #ffeaa7 !important;
|
|
194
|
+
transition: background-color 1s ease-out;
|
|
195
|
+
}
|
|
196
|
+
`;
|
|
197
|
+
// @ts-ignore: error TS2584: Cannot find name 'document'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'.
|
|
198
|
+
document.head.appendChild(style);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
static serializeClass() {
|
|
202
|
+
return TableHelper.toString();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.TableHelper = TableHelper;
|
|
206
|
+
//# sourceMappingURL=tableHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableHelper.js","sourceRoot":"","sources":["../../../src/reuse/helper/tableHelper.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,OAAe;QAC7B,OAAO,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,CAAC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,CAAC,IAAI,EAAE,EAAE;oBACrB,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;oBAClC,IAAI,MAAM,EAAE,CAAC;wBACX,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;wBAC1C,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,IAAI,CAAC,CAAC;oBACvE,CAAC;gBACH,CAAC,CAAC,CAAC;gBACH,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,sCAAsC;YACnE,CAAC,EAAE,GAAG,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,oBAAoB;QACzB,6JAA6J;QAC7J,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAClD,6JAA6J;YAC7J,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YAC9C,KAAK,CAAC,EAAE,GAAG,mBAAmB,CAAC;YAC/B,KAAK,CAAC,SAAS,GAAG;;;;;OAKjB,CAAC;YACF,6JAA6J;YAC7J,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,cAAc;QACnB,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC;IAChC,CAAC;CACF;AA3ND,kCA2NC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ui5Selector } from "./types/ui5.types";
|
|
1
|
+
import { Ui5Selector, Ui5ControlMetadata } from "./types/ui5.types";
|
|
2
2
|
/**
|
|
3
3
|
* @class table
|
|
4
4
|
* @memberof ui5
|
|
@@ -8,7 +8,11 @@ export declare class Table {
|
|
|
8
8
|
private ErrorHandler;
|
|
9
9
|
private static readonly SMART_TABLE_METADATA;
|
|
10
10
|
private static readonly TABLE_METADATA;
|
|
11
|
+
private static readonly UI_TABLE_METADATA;
|
|
11
12
|
private static readonly COLUMN_LIST_ITEM_METADATA;
|
|
13
|
+
private static readonly TABLE_ROW_METADATA;
|
|
14
|
+
private static readonly CHECKBOX_METADATA;
|
|
15
|
+
private static readonly SUPPORTED_TABLES_METADATA;
|
|
12
16
|
/**
|
|
13
17
|
* @function sortColumnAscending
|
|
14
18
|
* @memberOf ui5.table
|
|
@@ -93,49 +97,15 @@ export declare class Table {
|
|
|
93
97
|
* const numberOfRows = await ui5.table.getTotalNumberOfRowsByValues(selector, ["value1", "value2"]);
|
|
94
98
|
* const numberOfRows = await ui5.table.getTotalNumberOfRowsByValues(selector, "value");
|
|
95
99
|
**/
|
|
96
|
-
getTotalNumberOfRowsByValues(tableSelectorOrId: Ui5Selector | string, values: string | Array<string
|
|
100
|
+
getTotalNumberOfRowsByValues(tableSelectorOrId: Ui5Selector | string, values: string | Array<string>, enableHighlighting: boolean): Promise<number>;
|
|
97
101
|
/**
|
|
98
|
-
* @function
|
|
99
|
-
* @memberOf ui5.table
|
|
100
|
-
* @description Selects a row in the table by its index.
|
|
101
|
-
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
|
|
102
|
-
* @param {Number} index - The index of the row to select.
|
|
103
|
-
* @example await ui5.table.selectRowByIndex("application-ReportingTask-run-component---ReportList--ReportingTable", 0);
|
|
104
|
-
* @example const selector = {
|
|
105
|
-
* elementProperties: {
|
|
106
|
-
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
|
|
107
|
-
* metadata: "sap.ui.comp.smarttable.SmartTable",
|
|
108
|
-
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
|
|
109
|
-
* }
|
|
110
|
-
* };
|
|
111
|
-
* await ui5.table.selectRowByIndex(selector, 0);
|
|
112
|
-
*/
|
|
113
|
-
selectRowByIndex(tableSelectorOrId: Ui5Selector | string, index: number): Promise<void>;
|
|
114
|
-
/**
|
|
115
|
-
* @function openItemByIndex
|
|
116
|
-
* @memberOf ui5.table
|
|
117
|
-
* @description Opens the item in the table by its index.
|
|
118
|
-
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
|
|
119
|
-
* @param {Number} index - The index of the item to open.
|
|
120
|
-
* @example const selector = {
|
|
121
|
-
* elementProperties: {
|
|
122
|
-
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
|
|
123
|
-
* metadata: "sap.ui.comp.smarttable.SmartTable",
|
|
124
|
-
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
|
|
125
|
-
* }
|
|
126
|
-
* };
|
|
127
|
-
* await ui5.table.openItemByIndex(selector, 0);
|
|
128
|
-
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable";
|
|
129
|
-
* await ui5.table.openItemByIndex(id, 0);
|
|
130
|
-
*/
|
|
131
|
-
openItemByIndex(tableSelectorOrId: Ui5Selector | string, index: number): Promise<void>;
|
|
132
|
-
/**
|
|
133
|
-
* @function openItemByValues
|
|
102
|
+
* @function getSelectorsForRowsByValues
|
|
134
103
|
* @memberOf ui5.table
|
|
135
|
-
* @description
|
|
104
|
+
* @description Gets the selectors of rows in the table that contain the given values. If multiple values are provided, it only returns the selectors of rows that contain all of them.
|
|
136
105
|
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
|
|
137
106
|
* @param {String | Array<String>} values - The value(s) to match in the table rows.
|
|
138
|
-
* @
|
|
107
|
+
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable"
|
|
108
|
+
* await ui5.table.getSelectorsForRowsByValues(id, "February");
|
|
139
109
|
* @example const selector = {
|
|
140
110
|
* elementProperties: {
|
|
141
111
|
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
|
|
@@ -143,19 +113,15 @@ export declare class Table {
|
|
|
143
113
|
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
|
|
144
114
|
* }
|
|
145
115
|
* };
|
|
146
|
-
* await ui5.table.
|
|
147
|
-
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable";
|
|
148
|
-
* await ui5.table.openItemByValues(id, "value");
|
|
116
|
+
* await ui5.table.getSelectorsForRowsByValues(selector, ["January", "2022"]);
|
|
149
117
|
*/
|
|
150
|
-
|
|
118
|
+
getSelectorsForRowsByValues(tableSelectorOrId: Ui5Selector | string, values: string | Array<string>, enableHighlighting?: boolean): Promise<Array<Ui5Selector>>;
|
|
151
119
|
/**
|
|
152
|
-
* @function
|
|
120
|
+
* @function getSelectorForRowByIndex
|
|
153
121
|
* @memberOf ui5.table
|
|
154
|
-
* @description Gets the
|
|
122
|
+
* @description Gets the selector of a row in the table by its index.
|
|
155
123
|
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
|
|
156
|
-
* @param {
|
|
157
|
-
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable"
|
|
158
|
-
* await ui5.table.getSelectorsForRowsByValues(id, "February");
|
|
124
|
+
* @param {Number} index - The index of the item to open.
|
|
159
125
|
* @example const selector = {
|
|
160
126
|
* elementProperties: {
|
|
161
127
|
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
|
|
@@ -163,15 +129,19 @@ export declare class Table {
|
|
|
163
129
|
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
|
|
164
130
|
* }
|
|
165
131
|
* };
|
|
166
|
-
* await ui5.table.
|
|
132
|
+
* const rowSelector = await ui5.table.getSelectorForRowByIndex(selector, 0);
|
|
133
|
+
* @example id = "application-ReportingTask-run-component---ReportList--ReportingTable"
|
|
134
|
+
* const rowSelector = await ui5.table.getSelectorForRowByIndex(id, 0);
|
|
167
135
|
*/
|
|
168
|
-
|
|
136
|
+
getSelectorForRowByIndex(tableSelectorOrId: any, index: number): Promise<Ui5Selector>;
|
|
137
|
+
private getAllColumnValuesByName;
|
|
169
138
|
/**
|
|
170
|
-
* @function
|
|
139
|
+
* @function selectRowByIndex
|
|
171
140
|
* @memberOf ui5.table
|
|
172
|
-
* @description
|
|
141
|
+
* @description Selects a row in the table by its index.
|
|
173
142
|
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
|
|
174
|
-
* @param {Number} index - The index of the
|
|
143
|
+
* @param {Number} index - The index of the row to select.
|
|
144
|
+
* @example await ui5.table.selectRowByIndex("application-ReportingTask-run-component---ReportList--ReportingTable", 0);
|
|
175
145
|
* @example const selector = {
|
|
176
146
|
* elementProperties: {
|
|
177
147
|
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
|
|
@@ -179,11 +149,9 @@ export declare class Table {
|
|
|
179
149
|
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
|
|
180
150
|
* }
|
|
181
151
|
* };
|
|
182
|
-
*
|
|
183
|
-
* @example id = "application-ReportingTask-run-component---ReportList--ReportingTable"
|
|
184
|
-
* const rowSelector = await ui5.table.getSelectorForRowByIndex(id, 0);
|
|
152
|
+
* await ui5.table.selectRowByIndex(selector, 0);
|
|
185
153
|
*/
|
|
186
|
-
|
|
154
|
+
selectRowByIndex(tableSelectorOrId: Ui5Selector | string, index: number): Promise<void>;
|
|
187
155
|
/**
|
|
188
156
|
* @function selectAllRows
|
|
189
157
|
* @memberOf ui5.table
|
|
@@ -226,15 +194,76 @@ export declare class Table {
|
|
|
226
194
|
* await ui5.table.deselectAllRows(selector);
|
|
227
195
|
*/
|
|
228
196
|
deselectAllRows(tableSelectorOrId: Ui5Selector | string): Promise<void>;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
197
|
+
/**
|
|
198
|
+
* @function selectRowByValues
|
|
199
|
+
* @memberOf ui5.table
|
|
200
|
+
* @description Selects a row in the table by matching value(s). If multiple rows match, selects the one at the given global index (across all pages).
|
|
201
|
+
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table.
|
|
202
|
+
* @param {String | Array<String>} values - The value(s) to match in the table rows.
|
|
203
|
+
* @param {Number} [index=0] - The global index of the matching row to select (across all pages).
|
|
204
|
+
* @example const selector = {
|
|
205
|
+
* elementProperties: {
|
|
206
|
+
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
|
|
207
|
+
* metadata: "sap.ui.comp.smarttable.SmartTable",
|
|
208
|
+
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
|
|
209
|
+
* }
|
|
210
|
+
* };
|
|
211
|
+
* await ui5.table.selectRowByValues(selector, ["value1", "value2"]);
|
|
212
|
+
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable";
|
|
213
|
+
* await ui5.table.selectRowByValues(id, "value", 1);
|
|
214
|
+
*/
|
|
215
|
+
selectRowByValues(tableSelectorOrId: Ui5Selector | string, values: string | Array<string>, index?: number): Promise<undefined>;
|
|
216
|
+
/**
|
|
217
|
+
* @function openItemByIndex
|
|
218
|
+
* @memberOf ui5.table
|
|
219
|
+
* @description Opens the item in the table by its index.
|
|
220
|
+
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
|
|
221
|
+
* @param {Number} index - The index of the item to open.
|
|
222
|
+
* @example const selector = {
|
|
223
|
+
* elementProperties: {
|
|
224
|
+
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
|
|
225
|
+
* metadata: "sap.ui.comp.smarttable.SmartTable",
|
|
226
|
+
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
|
|
227
|
+
* }
|
|
228
|
+
* };
|
|
229
|
+
* await ui5.table.openItemByIndex(selector, 0);
|
|
230
|
+
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable";
|
|
231
|
+
* await ui5.table.openItemByIndex(id, 0);
|
|
232
|
+
*/
|
|
233
|
+
openItemByIndex(tableSelectorOrId: Ui5Selector | string, index: number): Promise<void>;
|
|
234
|
+
/**
|
|
235
|
+
* @function openItemByValues
|
|
236
|
+
* @memberOf ui5.table
|
|
237
|
+
* @description Opens the item in the table containing the given values. If multiple items match, it opens the index-th item.
|
|
238
|
+
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
|
|
239
|
+
* @param {String | Array<String>} values - The value(s) to match in the table rows.
|
|
240
|
+
* @param {Number} [index=0] - The index of the matching row to consider.
|
|
241
|
+
* @example const selector = {
|
|
242
|
+
* elementProperties: {
|
|
243
|
+
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
|
|
244
|
+
* metadata: "sap.ui.comp.smarttable.SmartTable",
|
|
245
|
+
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
|
|
246
|
+
* }
|
|
247
|
+
* };
|
|
248
|
+
* await ui5.table.openItemByValues(selector, ["value1", "value2"]);
|
|
249
|
+
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable";
|
|
250
|
+
* await ui5.table.openItemByValues(id, "value");
|
|
251
|
+
*/
|
|
252
|
+
openItemByValues(tableSelectorOrId: Ui5Selector | string, values: string | Array<string>, index: number | undefined, enableHighlighting: boolean): Promise<undefined>;
|
|
253
|
+
private static _resolveTableSelectorOrId;
|
|
254
|
+
private static _getId;
|
|
255
|
+
_getTableMetadata(tableId: string): Promise<Ui5ControlMetadata>;
|
|
232
256
|
private _constructTableSelector;
|
|
257
|
+
private _constructRowSelector;
|
|
258
|
+
private _getRowMetadataByTableMetadata;
|
|
233
259
|
private _extractRowCountFromTitle;
|
|
234
260
|
private _clickColumn;
|
|
235
261
|
private _getSortValueGridTable;
|
|
236
262
|
private _getSortIndicatorValue;
|
|
237
263
|
private _prepareAncestorSelector;
|
|
264
|
+
private _getSelectorTypeForRowSelection;
|
|
265
|
+
private _buildRowSelectionSelector;
|
|
266
|
+
private _checkCssItem;
|
|
238
267
|
}
|
|
239
268
|
declare const _default: Table;
|
|
240
269
|
export default _default;
|