UNPKG

@awsui/components-react

Version:

AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A

95 lines (94 loc) 4.84 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var dom_1 = require("@awsui/test-utils-core/dom"); var styles_selectors_js_1 = require("../../../table/styles.selectors.js"); var styles_selectors_js_2 = require("../../../table/selection-control/styles.selectors.js"); var styles_selectors_js_3 = require("../../../table/resizer/styles.selectors.js"); var collection_preferences_1 = require("../collection-preferences"); var container_1 = require("../container"); var pagination_1 = require("../pagination"); var text_filter_1 = require("../text-filter"); var TableWrapper = (function (_super) { __extends(TableWrapper, _super); function TableWrapper() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.containerWrapper = new container_1.default(_this.getElement()); return _this; } TableWrapper.prototype.findNativeTable = function () { return this.find("." + styles_selectors_js_1.default.wrapper + " > ." + styles_selectors_js_1.default.table); }; TableWrapper.prototype.findActiveTHead = function () { return this.findByClassName(styles_selectors_js_1.default['thead-active']); }; TableWrapper.prototype.findHeaderSlot = function () { return this.findByClassName(styles_selectors_js_1.default['header-controls']); }; TableWrapper.prototype.findHeaderRegion = function () { return this.findHeaderSlot(); }; TableWrapper.prototype.findFooterSlot = function () { return this.containerWrapper.findFooter(); }; TableWrapper.prototype.findColumnHeaders = function () { return this.findActiveTHead().findAll('tr > *'); }; TableWrapper.prototype.findColumnResizer = function (columnIndex) { return this.findActiveTHead().find("th:nth-child(" + columnIndex + ") ." + styles_selectors_js_3.default.resizer); }; TableWrapper.prototype.findBodyCell = function (rowIndex, columnIndex) { return this.findNativeTable().find("tbody tr:nth-child(" + rowIndex + ") td:nth-child(" + columnIndex + ")"); }; TableWrapper.prototype.findRows = function () { return this.findNativeTable().findAllByClassName(styles_selectors_js_1.default.row); }; TableWrapper.prototype.findSelectedRows = function () { return this.findAllByClassName(styles_selectors_js_1.default['row-selected']); }; TableWrapper.prototype.findEmptyRegion = function () { return this.findEmptySlot(); }; TableWrapper.prototype.findEmptySlot = function () { return this.findByClassName(styles_selectors_js_1.default.empty); }; TableWrapper.prototype.findLoadingText = function () { return this.findByClassName(styles_selectors_js_1.default.loading); }; TableWrapper.prototype.findAscSortedColumn = function () { return this.findNativeTable().findByClassName(styles_selectors_js_1.default['header-cell-ascending']); }; TableWrapper.prototype.findDescSortedColumn = function () { return this.findNativeTable().findByClassName(styles_selectors_js_1.default['header-cell-descending']); }; TableWrapper.prototype.findRowSelectionArea = function (rowIndex) { return this.findNativeTable().find("tbody tr:nth-child(" + rowIndex + ") ." + styles_selectors_js_2.default.root + " label"); }; TableWrapper.prototype.findSelectAllTrigger = function () { return this.findActiveTHead().find("." + styles_selectors_js_2.default.root + " label"); }; TableWrapper.prototype.findTextFilter = function () { return this.findComponent("." + styles_selectors_js_1.default['tools-filtering'], text_filter_1.default); }; TableWrapper.prototype.findCollectionPreferences = function () { return this.findComponent("." + styles_selectors_js_1.default['tools-preferences'], collection_preferences_1.default); }; TableWrapper.prototype.findPagination = function () { return this.findComponent("." + styles_selectors_js_1.default['tools-pagination'], pagination_1.default); }; TableWrapper.rootSelector = styles_selectors_js_1.default.root; return TableWrapper; }(dom_1.ComponentWrapper)); exports.default = TableWrapper;