@ui5/webcomponents-compat 0.0.0-07d38e78e
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/.env.production +1 -0
- package/.env.testing +4 -0
- package/.npsrc.json +3 -0
- package/CHANGELOG.md +25 -0
- package/README.md +45 -0
- package/dist/Assets.d.ts +3 -0
- package/dist/Assets.js +6 -0
- package/dist/Assets.js.map +1 -0
- package/dist/Table.d.ts +362 -0
- package/dist/Table.js +868 -0
- package/dist/Table.js.map +1 -0
- package/dist/TableCell.d.ts +37 -0
- package/dist/TableCell.js +63 -0
- package/dist/TableCell.js.map +1 -0
- package/dist/TableColumn.d.ts +63 -0
- package/dist/TableColumn.js +59 -0
- package/dist/TableColumn.js.map +1 -0
- package/dist/TableGroupRow.d.ts +44 -0
- package/dist/TableGroupRow.js +102 -0
- package/dist/TableGroupRow.js.map +1 -0
- package/dist/TableRow.d.ts +120 -0
- package/dist/TableRow.js +323 -0
- package/dist/TableRow.js.map +1 -0
- package/dist/bundle.common.bootstrap.d.ts +1 -0
- package/dist/bundle.common.bootstrap.js +3 -0
- package/dist/bundle.common.bootstrap.js.map +1 -0
- package/dist/bundle.esm.d.ts +3 -0
- package/dist/bundle.esm.js +13 -0
- package/dist/bundle.esm.js.map +1 -0
- package/dist/bundle.scoped.esm.d.ts +2 -0
- package/dist/bundle.scoped.esm.js +8 -0
- package/dist/bundle.scoped.esm.js.map +1 -0
- package/dist/css/themes/GrowingButton.css +1 -0
- package/dist/css/themes/Table.css +1 -0
- package/dist/css/themes/TableCell.css +1 -0
- package/dist/css/themes/TableColumn.css +1 -0
- package/dist/css/themes/TableGroupRow.css +1 -0
- package/dist/css/themes/TableRow.css +1 -0
- package/dist/css/themes/sap_fiori_3/parameters-bundle.css +1 -0
- package/dist/css/themes/sap_fiori_3_dark/parameters-bundle.css +1 -0
- package/dist/css/themes/sap_fiori_3_hcb/parameters-bundle.css +1 -0
- package/dist/css/themes/sap_fiori_3_hcw/parameters-bundle.css +1 -0
- package/dist/css/themes/sap_horizon/parameters-bundle.css +1 -0
- package/dist/css/themes/sap_horizon_dark/parameters-bundle.css +1 -0
- package/dist/css/themes/sap_horizon_hcb/parameters-bundle.css +1 -0
- package/dist/css/themes/sap_horizon_hcw/parameters-bundle.css +1 -0
- package/dist/custom-elements-internal.json +1021 -0
- package/dist/custom-elements.json +747 -0
- package/dist/generated/assets/i18n/messagebundle_ar.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_bg.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_ca.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_cnr.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_cs.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_cy.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_da.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_de.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_el.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_en.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_en_GB.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_en_US_sappsd.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_en_US_saprigi.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_en_US_saptrc.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_es.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_es_MX.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_et.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_fi.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_fr.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_fr_CA.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_hi.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_hr.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_hu.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_in.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_it.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_iw.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_ja.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_kk.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_ko.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_lt.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_lv.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_mk.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_ms.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_nl.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_no.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_pl.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_pt.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_pt_PT.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_ro.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_ru.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_sh.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_sk.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_sl.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_sr.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_sv.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_th.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_tr.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_uk.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_vi.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_zh_CN.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_zh_TW.json +1 -0
- package/dist/generated/assets/themes/sap_fiori_3/parameters-bundle.css.json +1 -0
- package/dist/generated/assets/themes/sap_fiori_3_dark/parameters-bundle.css.json +1 -0
- package/dist/generated/assets/themes/sap_fiori_3_hcb/parameters-bundle.css.json +1 -0
- package/dist/generated/assets/themes/sap_fiori_3_hcw/parameters-bundle.css.json +1 -0
- package/dist/generated/assets/themes/sap_horizon/parameters-bundle.css.json +1 -0
- package/dist/generated/assets/themes/sap_horizon_dark/parameters-bundle.css.json +1 -0
- package/dist/generated/assets/themes/sap_horizon_hcb/parameters-bundle.css.json +1 -0
- package/dist/generated/assets/themes/sap_horizon_hcw/parameters-bundle.css.json +1 -0
- package/dist/generated/i18n/i18n-defaults.d.ts +12 -0
- package/dist/generated/i18n/i18n-defaults.js +13 -0
- package/dist/generated/i18n/i18n-defaults.js.map +1 -0
- package/dist/generated/json-imports/Themes.d.ts +1 -0
- package/dist/generated/json-imports/Themes.js +25 -0
- package/dist/generated/json-imports/Themes.js.map +1 -0
- package/dist/generated/json-imports/i18n.d.ts +1 -0
- package/dist/generated/json-imports/i18n.js +120 -0
- package/dist/generated/json-imports/i18n.js.map +1 -0
- package/dist/generated/templates/TableCellTemplate.lit.d.ts +4 -0
- package/dist/generated/templates/TableCellTemplate.lit.js +5 -0
- package/dist/generated/templates/TableCellTemplate.lit.js.map +1 -0
- package/dist/generated/templates/TableColumnTemplate.lit.d.ts +4 -0
- package/dist/generated/templates/TableColumnTemplate.lit.js +5 -0
- package/dist/generated/templates/TableColumnTemplate.lit.js.map +1 -0
- package/dist/generated/templates/TableGroupRowTemplate.lit.d.ts +4 -0
- package/dist/generated/templates/TableGroupRowTemplate.lit.js +5 -0
- package/dist/generated/templates/TableGroupRowTemplate.lit.js.map +1 -0
- package/dist/generated/templates/TableRowTemplate.lit.d.ts +4 -0
- package/dist/generated/templates/TableRowTemplate.lit.js +16 -0
- package/dist/generated/templates/TableRowTemplate.lit.js.map +1 -0
- package/dist/generated/templates/TableTemplate.lit.d.ts +4 -0
- package/dist/generated/templates/TableTemplate.lit.js +15 -0
- package/dist/generated/templates/TableTemplate.lit.js.map +1 -0
- package/dist/generated/themes/GrowingButton.css.d.ts +3 -0
- package/dist/generated/themes/GrowingButton.css.js +9 -0
- package/dist/generated/themes/GrowingButton.css.js.map +1 -0
- package/dist/generated/themes/Table.css.d.ts +3 -0
- package/dist/generated/themes/Table.css.js +9 -0
- package/dist/generated/themes/Table.css.js.map +1 -0
- package/dist/generated/themes/TableCell.css.d.ts +3 -0
- package/dist/generated/themes/TableCell.css.js +9 -0
- package/dist/generated/themes/TableCell.css.js.map +1 -0
- package/dist/generated/themes/TableColumn.css.d.ts +3 -0
- package/dist/generated/themes/TableColumn.css.js +9 -0
- package/dist/generated/themes/TableColumn.css.js.map +1 -0
- package/dist/generated/themes/TableGroupRow.css.d.ts +3 -0
- package/dist/generated/themes/TableGroupRow.css.js +9 -0
- package/dist/generated/themes/TableGroupRow.css.js.map +1 -0
- package/dist/generated/themes/TableRow.css.d.ts +3 -0
- package/dist/generated/themes/TableRow.css.js +9 -0
- package/dist/generated/themes/TableRow.css.js.map +1 -0
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.d.ts +3 -0
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.js +4 -0
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.js.map +1 -0
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.d.ts +3 -0
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.js +4 -0
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.js.map +1 -0
- package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.d.ts +3 -0
- package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.js +4 -0
- package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.js.map +1 -0
- package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.d.ts +3 -0
- package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.js +4 -0
- package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.js.map +1 -0
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.d.ts +3 -0
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.js +4 -0
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.js.map +1 -0
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.d.ts +3 -0
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js +4 -0
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js.map +1 -0
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.d.ts +3 -0
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js +4 -0
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js.map +1 -0
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.d.ts +3 -0
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js +4 -0
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js.map +1 -0
- package/dist/types/TableColumnPopinDisplay.d.ts +17 -0
- package/dist/types/TableColumnPopinDisplay.js +19 -0
- package/dist/types/TableColumnPopinDisplay.js.map +1 -0
- package/dist/types/TableGrowingMode.d.ts +23 -0
- package/dist/types/TableGrowingMode.js +25 -0
- package/dist/types/TableGrowingMode.js.map +1 -0
- package/dist/types/TableMode.d.ts +22 -0
- package/dist/types/TableMode.js +24 -0
- package/dist/types/TableMode.js.map +1 -0
- package/dist/types/TableRowType.d.ts +17 -0
- package/dist/types/TableRowType.js +19 -0
- package/dist/types/TableRowType.js.map +1 -0
- package/dist/vscode.html-custom-data.json +136 -0
- package/dist/web-types.json +354 -0
- package/jsconfig.json +11 -0
- package/package-scripts.cjs +15 -0
- package/package.json +57 -0
- package/src/Table.hbs +121 -0
- package/src/TableCell.hbs +7 -0
- package/src/TableColumn.hbs +7 -0
- package/src/TableGroupRow.hbs +11 -0
- package/src/TableRow.hbs +85 -0
- package/src/i18n/messagebundle.properties +32 -0
- package/src/i18n/messagebundle_ar.properties +20 -0
- package/src/i18n/messagebundle_bg.properties +20 -0
- package/src/i18n/messagebundle_ca.properties +20 -0
- package/src/i18n/messagebundle_cnr.properties +20 -0
- package/src/i18n/messagebundle_cs.properties +20 -0
- package/src/i18n/messagebundle_cy.properties +20 -0
- package/src/i18n/messagebundle_da.properties +20 -0
- package/src/i18n/messagebundle_de.properties +20 -0
- package/src/i18n/messagebundle_el.properties +20 -0
- package/src/i18n/messagebundle_en.properties +20 -0
- package/src/i18n/messagebundle_en_GB.properties +20 -0
- package/src/i18n/messagebundle_en_US_sappsd.properties +311 -0
- package/src/i18n/messagebundle_en_US_saprigi.properties +20 -0
- package/src/i18n/messagebundle_en_US_saptrc.properties +311 -0
- package/src/i18n/messagebundle_es.properties +20 -0
- package/src/i18n/messagebundle_es_MX.properties +20 -0
- package/src/i18n/messagebundle_et.properties +20 -0
- package/src/i18n/messagebundle_fi.properties +20 -0
- package/src/i18n/messagebundle_fr.properties +20 -0
- package/src/i18n/messagebundle_fr_CA.properties +20 -0
- package/src/i18n/messagebundle_hi.properties +20 -0
- package/src/i18n/messagebundle_hr.properties +20 -0
- package/src/i18n/messagebundle_hu.properties +20 -0
- package/src/i18n/messagebundle_id.properties +20 -0
- package/src/i18n/messagebundle_in.properties +172 -0
- package/src/i18n/messagebundle_it.properties +20 -0
- package/src/i18n/messagebundle_iw.properties +20 -0
- package/src/i18n/messagebundle_ja.properties +20 -0
- package/src/i18n/messagebundle_kk.properties +20 -0
- package/src/i18n/messagebundle_ko.properties +20 -0
- package/src/i18n/messagebundle_lt.properties +20 -0
- package/src/i18n/messagebundle_lv.properties +20 -0
- package/src/i18n/messagebundle_mk.properties +20 -0
- package/src/i18n/messagebundle_ms.properties +20 -0
- package/src/i18n/messagebundle_nl.properties +20 -0
- package/src/i18n/messagebundle_no.properties +20 -0
- package/src/i18n/messagebundle_pl.properties +20 -0
- package/src/i18n/messagebundle_pt.properties +20 -0
- package/src/i18n/messagebundle_pt_PT.properties +20 -0
- package/src/i18n/messagebundle_ro.properties +20 -0
- package/src/i18n/messagebundle_ru.properties +20 -0
- package/src/i18n/messagebundle_sh.properties +20 -0
- package/src/i18n/messagebundle_sk.properties +20 -0
- package/src/i18n/messagebundle_sl.properties +20 -0
- package/src/i18n/messagebundle_sr.properties +20 -0
- package/src/i18n/messagebundle_sv.properties +20 -0
- package/src/i18n/messagebundle_th.properties +20 -0
- package/src/i18n/messagebundle_tr.properties +20 -0
- package/src/i18n/messagebundle_uk.properties +20 -0
- package/src/i18n/messagebundle_vi.properties +20 -0
- package/src/i18n/messagebundle_zh_CN.properties +20 -0
- package/src/i18n/messagebundle_zh_TW.properties +20 -0
- package/src/themes/GrowingButton.css +68 -0
- package/src/themes/Table.css +106 -0
- package/src/themes/TableCell.css +27 -0
- package/src/themes/TableColumn.css +25 -0
- package/src/themes/TableGroupRow.css +32 -0
- package/src/themes/TableRow.css +130 -0
- package/src/themes/base/GrowingButton-parameters.css +6 -0
- package/src/themes/base/Table-parameters.css +10 -0
- package/src/themes/base/TableColumn-parameters.css +3 -0
- package/src/themes/base/TableGroupRow-parameters.css +4 -0
- package/src/themes/base/TableRow-parameters.css +4 -0
- package/src/themes/base/sizes-parameters.css +22 -0
- package/src/themes/sap_fiori_3/parameters-bundle.css +6 -0
- package/src/themes/sap_fiori_3_dark/parameters-bundle.css +6 -0
- package/src/themes/sap_fiori_3_hcb/GrowingButton-parameters.css +8 -0
- package/src/themes/sap_fiori_3_hcb/Table-parameters.css +5 -0
- package/src/themes/sap_fiori_3_hcb/TableRow-parameters.css +5 -0
- package/src/themes/sap_fiori_3_hcb/parameters-bundle.css +6 -0
- package/src/themes/sap_fiori_3_hcw/GrowingButton-parameters.css +8 -0
- package/src/themes/sap_fiori_3_hcw/Table-parameters.css +5 -0
- package/src/themes/sap_fiori_3_hcw/TableRow-parameters.css +5 -0
- package/src/themes/sap_fiori_3_hcw/parameters-bundle.css +6 -0
- package/src/themes/sap_horizon/GrowingButton-parameters.css +6 -0
- package/src/themes/sap_horizon/Table-parameters.css +9 -0
- package/src/themes/sap_horizon/TableColumn-parameters.css +5 -0
- package/src/themes/sap_horizon/TableGroupRow-parameters.css +6 -0
- package/src/themes/sap_horizon/TableRow-parameters.css +5 -0
- package/src/themes/sap_horizon/parameters-bundle.css +8 -0
- package/src/themes/sap_horizon_dark/GrowingButton-parameters.css +6 -0
- package/src/themes/sap_horizon_dark/Table-parameters.css +9 -0
- package/src/themes/sap_horizon_dark/TableColumn-parameters.css +5 -0
- package/src/themes/sap_horizon_dark/TableGroupRow-parameters.css +6 -0
- package/src/themes/sap_horizon_dark/TableRow-parameters.css +5 -0
- package/src/themes/sap_horizon_dark/parameters-bundle.css +8 -0
- package/src/themes/sap_horizon_hcb/GrowingButton-parameters.css +8 -0
- package/src/themes/sap_horizon_hcb/Table-parameters.css +10 -0
- package/src/themes/sap_horizon_hcb/TableGroupRow-parameters.css +6 -0
- package/src/themes/sap_horizon_hcb/TableRow-parameters.css +5 -0
- package/src/themes/sap_horizon_hcb/parameters-bundle.css +6 -0
- package/src/themes/sap_horizon_hcw/GrowingButton-parameters.css +8 -0
- package/src/themes/sap_horizon_hcw/Table-parameters.css +10 -0
- package/src/themes/sap_horizon_hcw/TableGroupRow-parameters.css +6 -0
- package/src/themes/sap_horizon_hcw/TableRow-parameters.css +5 -0
- package/src/themes/sap_horizon_hcw/parameters-bundle.css +6 -0
- package/tsconfig.json +28 -0
package/dist/Table.js
ADDED
@@ -0,0 +1,868 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var Table_1;
|
8
|
+
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
9
|
+
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
10
|
+
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
11
|
+
import event from "@ui5/webcomponents-base/dist/decorators/event.js";
|
12
|
+
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
|
13
|
+
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
|
14
|
+
import ResizeHandler from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js";
|
15
|
+
import ItemNavigation from "@ui5/webcomponents-base/dist/delegate/ItemNavigation.js";
|
16
|
+
import Integer from "@ui5/webcomponents-base/dist/types/Integer.js";
|
17
|
+
import NavigationMode from "@ui5/webcomponents-base/dist/types/NavigationMode.js";
|
18
|
+
import { isTabNext, isTabPrevious, isSpace, isEnter, isCtrlA, isUpAlt, isDownAlt, isUpShift, isDownShift, isHomeCtrl, isEndCtrl, isHomeShift, isEndShift, } from "@ui5/webcomponents-base/dist/Keys.js";
|
19
|
+
import getNormalizedTarget from "@ui5/webcomponents-base/dist/util/getNormalizedTarget.js";
|
20
|
+
import getActiveElement from "@ui5/webcomponents-base/dist/util/getActiveElement.js";
|
21
|
+
import { getLastTabbableElement, getTabbableElements } from "@ui5/webcomponents-base/dist/util/TabbableElements.js";
|
22
|
+
import { getEffectiveAriaLabelText } from "@ui5/webcomponents-base/dist/util/AriaLabelHelper.js";
|
23
|
+
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
24
|
+
import debounce from "@ui5/webcomponents-base/dist/util/debounce.js";
|
25
|
+
import isElementInView from "@ui5/webcomponents-base/dist/util/isElementInView.js";
|
26
|
+
import BusyIndicator from "@ui5/webcomponents/dist/BusyIndicator.js";
|
27
|
+
import CheckBox from "@ui5/webcomponents/dist/CheckBox.js";
|
28
|
+
import TableGrowingMode from "./types/TableGrowingMode.js";
|
29
|
+
import TableMode from "./types/TableMode.js";
|
30
|
+
// Texts
|
31
|
+
import { LOAD_MORE_TEXT, ARIA_LABEL_SELECT_ALL_CHECKBOX, TABLE_HEADER_ROW_INFORMATION, TABLE_ROW_POSITION, } from "./generated/i18n/i18n-defaults.js";
|
32
|
+
// Template
|
33
|
+
import TableTemplate from "./generated/templates/TableTemplate.lit.js";
|
34
|
+
// Styles
|
35
|
+
import tableStyles from "./generated/themes/Table.css.js";
|
36
|
+
const GROWING_WITH_SCROLL_DEBOUNCE_RATE = 250; // ms
|
37
|
+
const PAGE_UP_DOWN_SIZE = 20;
|
38
|
+
var TableFocusTargetElement;
|
39
|
+
(function (TableFocusTargetElement) {
|
40
|
+
TableFocusTargetElement["Row"] = "tableRow";
|
41
|
+
TableFocusTargetElement["GroupRow"] = "tableGroupRow";
|
42
|
+
TableFocusTargetElement["ColumnHeader"] = "columnHeader";
|
43
|
+
TableFocusTargetElement["MoreButton"] = "moreButton";
|
44
|
+
})(TableFocusTargetElement || (TableFocusTargetElement = {}));
|
45
|
+
/**
|
46
|
+
* @class
|
47
|
+
*
|
48
|
+
* ### Overview
|
49
|
+
*
|
50
|
+
* The `ui5-table` component provides a set of sophisticated and convenient functions for responsive table design.
|
51
|
+
* It provides a comprehensive set of features for displaying and dealing with vast amounts of data.
|
52
|
+
*
|
53
|
+
* To render the `Table` properly, the order of the `columns` should match with the
|
54
|
+
* order of the item `cells` in the `rows`.
|
55
|
+
*
|
56
|
+
* Desktop and tablet devices are supported.
|
57
|
+
* On tablets, special consideration should be given to the number of visible columns
|
58
|
+
* and rows due to the limited performance of some devices.
|
59
|
+
*
|
60
|
+
* ### Selection
|
61
|
+
* To benefit from the selection mechanism of `ui5-table` component, you can use the available selection modes:
|
62
|
+
* `SingleSelect` and `MultiSelect`.
|
63
|
+
*
|
64
|
+
* In additition to the used mode, you can also specify the `ui5-table-row` type choosing between
|
65
|
+
* `Active` or `Inactive`.
|
66
|
+
*
|
67
|
+
* In `SingleSelect` mode, you can select both an `Active` and `Inactive` row via mouse or
|
68
|
+
* by pressing the `Space` or `Enter` keys.
|
69
|
+
*
|
70
|
+
* In `MultiSelect` mode, you can select both an `Active` and `Inactive` row by pressing the
|
71
|
+
* `Space` key when a row is on focus or via mouse click over the selection checkbox of the row.
|
72
|
+
* In order to select all the available rows at once, you can use the selection checkbox presented in the table's header.
|
73
|
+
*
|
74
|
+
* **Note:** Currently, when a column is shown as a pop-in, the visual indication for selection is not presented over it.
|
75
|
+
*
|
76
|
+
* ### Keyboard Handling
|
77
|
+
*
|
78
|
+
* #### Fast Navigation
|
79
|
+
* This component provides a build in fast navigation group which can be used via [F6] / [Shift] + [F6] / [Ctrl] + [Alt/Option] / [Down] or [Ctrl] + [Alt/Option] + [Up].
|
80
|
+
* In order to use this functionality, you need to import the following module:
|
81
|
+
* `import "@ui5/webcomponents-base/dist/features/F6Navigation.js"`
|
82
|
+
*
|
83
|
+
* Furthermore, you can interact with `ui5-table` via the following keys.
|
84
|
+
*
|
85
|
+
* - [F7] - If focus is on an interactive control inside an item, moves focus to the corresponding item.
|
86
|
+
* - [Ctrl]+[A] - Selects all items, if MultiSelect mode is enabled.
|
87
|
+
* - [Home]/[End] - Focuses the first/last item.
|
88
|
+
* - [Page Up]/[Page Down] - Moves focus up/down by page size (20 items by default).
|
89
|
+
* - [Alt]+[Down]/[Up] - Switches focus between header, last focused item, and More button (if applies) in either direction.
|
90
|
+
* - [Shift]+[Down]/[Up] - Selects the next/previous item in a MultiSelect table, if the current item is selected (Range selection). Otherwise, deselects them (Range deselection).
|
91
|
+
* - [Shift]+[Home]/[End] - Range selection to the first/last item of the List.
|
92
|
+
* - [Ctrl]+[Home]/[End] - Same behavior as HOME & END.
|
93
|
+
*
|
94
|
+
* ### ES6 Module Import
|
95
|
+
*
|
96
|
+
* - `import "@ui5/webcomponents-compat/dist/Table.js";`
|
97
|
+
* - `import "@ui5/webcomponents-compat/dist/TableColumn.js";` (`ui5-table-column`)
|
98
|
+
* - `import "@ui5/webcomponents-compat/dist/TableRow.js";` (`ui5-table-row`)
|
99
|
+
* - `import "@ui5/webcomponents-compat/dist/TableGroupRow.js";` (`ui5-table-group-row`)
|
100
|
+
* - `import "@ui5/webcomponents-compat/dist/TableCell.js";` (`ui5-table-cell`)
|
101
|
+
* @constructor
|
102
|
+
* @extends UI5Element
|
103
|
+
* @public
|
104
|
+
*/
|
105
|
+
let Table = Table_1 = class Table extends UI5Element {
|
106
|
+
static async onDefine() {
|
107
|
+
Table_1.i18nBundle = await getI18nBundle("@ui5/webcomponents");
|
108
|
+
}
|
109
|
+
constructor() {
|
110
|
+
super();
|
111
|
+
this.visibleColumns = []; // template loop should always have a defined array
|
112
|
+
// The ItemNavigation requires each item to 1) have a "forcedTabIndex" property and 2) be either a UI5Element, or have an id property (to find it in the component's shadow DOM by)
|
113
|
+
this._columnHeader = {
|
114
|
+
id: `${this._id}-columnHeader`,
|
115
|
+
forcedTabIndex: "0",
|
116
|
+
};
|
117
|
+
this._itemNavigation = new ItemNavigation(this, {
|
118
|
+
navigationMode: NavigationMode.Vertical,
|
119
|
+
affectedPropertiesNames: ["_columnHeader"],
|
120
|
+
getItemsCallback: () => [this._columnHeader, ...this.rows],
|
121
|
+
skipItemsSize: PAGE_UP_DOWN_SIZE,
|
122
|
+
});
|
123
|
+
this._handleResize = this.popinContent.bind(this);
|
124
|
+
this.fnOnRowFocused = this.onRowFocused.bind(this);
|
125
|
+
this.fnHandleF7 = this._handleF7.bind(this);
|
126
|
+
this.tableEndObserved = false;
|
127
|
+
// Stores the last focused element within the table.
|
128
|
+
this.lastFocusedElement = null;
|
129
|
+
// Indicates whether the table is forwarding focus before or after the current table row.
|
130
|
+
this._forwardingFocus = false;
|
131
|
+
// Stores the last focused nested element index (within a table row) for F7 navigation.
|
132
|
+
this._prevNestedElementIndex = 0;
|
133
|
+
// Indicates the Table bottom most part has been detected by the IntersectionObserver
|
134
|
+
// for the first time.
|
135
|
+
this.initialIntersection = true;
|
136
|
+
}
|
137
|
+
onBeforeRendering() {
|
138
|
+
const columnSettings = this.getColumnPropagationSettings();
|
139
|
+
const columnSettingsString = JSON.stringify(columnSettings);
|
140
|
+
const rowsCount = this.rows.length + 1;
|
141
|
+
const selectedRows = this.selectedRows;
|
142
|
+
this.rows.forEach((row, index) => {
|
143
|
+
if (row._columnsInfoString !== columnSettingsString) {
|
144
|
+
row._columnsInfo = columnSettings;
|
145
|
+
row._columnsInfoString = JSON.stringify(row._columnsInfo);
|
146
|
+
}
|
147
|
+
row.forcedAriaPosition = Table_1.i18nBundle.getText(TABLE_ROW_POSITION, index + 2, rowsCount);
|
148
|
+
row.forcedBusy = this.busy;
|
149
|
+
row.removeEventListener("ui5-_focused", this.fnOnRowFocused);
|
150
|
+
row.addEventListener("ui5-_focused", this.fnOnRowFocused);
|
151
|
+
row.removeEventListener("ui5-f7-pressed", this.fnHandleF7);
|
152
|
+
row.addEventListener("ui5-f7-pressed", this.fnHandleF7);
|
153
|
+
row.mode = this.mode;
|
154
|
+
});
|
155
|
+
this.visibleColumns = this.columns.filter((column, index) => {
|
156
|
+
return !this._hiddenColumns[index];
|
157
|
+
});
|
158
|
+
this._noDataDisplayed = !this.rows.length && !this.hideNoData;
|
159
|
+
this.visibleColumnsCount = this.visibleColumns.length;
|
160
|
+
if (this.isMultiSelect) {
|
161
|
+
// we have to count the selection column as well
|
162
|
+
this.visibleColumnsCount += 1;
|
163
|
+
}
|
164
|
+
this._allRowsSelected = selectedRows.length === this.rows.length;
|
165
|
+
this._prevFocusedRow = this._prevFocusedRow || this.rows[0];
|
166
|
+
}
|
167
|
+
onAfterRendering() {
|
168
|
+
if (this.growsOnScroll) {
|
169
|
+
this.observeTableEnd();
|
170
|
+
}
|
171
|
+
this.checkTableInViewport();
|
172
|
+
}
|
173
|
+
onEnterDOM() {
|
174
|
+
this.growingIntersectionObserver = this.getIntersectionObserver();
|
175
|
+
ResizeHandler.register(this.getDomRef(), this._handleResize);
|
176
|
+
this._itemNavigation.setCurrentItem(this.rows.length ? this.rows[0] : this._columnHeader);
|
177
|
+
}
|
178
|
+
onExitDOM() {
|
179
|
+
ResizeHandler.deregister(this.getDomRef(), this._handleResize);
|
180
|
+
this.growingIntersectionObserver.disconnect();
|
181
|
+
this.growingIntersectionObserver = null;
|
182
|
+
this.tableEndObserved = false;
|
183
|
+
}
|
184
|
+
_onkeydown(e) {
|
185
|
+
if (isTabNext(e) || isTabPrevious(e)) {
|
186
|
+
this._handleTab(e);
|
187
|
+
}
|
188
|
+
if (isCtrlA(e)) {
|
189
|
+
e.preventDefault();
|
190
|
+
this.isMultiSelect && this._selectAll();
|
191
|
+
}
|
192
|
+
if (isUpAlt(e) || isDownAlt(e)) {
|
193
|
+
this._handleArrowAlt(e);
|
194
|
+
}
|
195
|
+
if ((isUpShift(e) || isDownShift(e)) && this.isMultiSelect) {
|
196
|
+
this._handleArrowNav(e);
|
197
|
+
}
|
198
|
+
if (isHomeCtrl(e)) {
|
199
|
+
e.preventDefault();
|
200
|
+
this._itemNavigation._handleHome();
|
201
|
+
this._itemNavigation._applyTabIndex();
|
202
|
+
this._itemNavigation._focusCurrentItem();
|
203
|
+
}
|
204
|
+
if (isEndCtrl(e)) {
|
205
|
+
e.preventDefault();
|
206
|
+
this._itemNavigation._handleEnd();
|
207
|
+
this._itemNavigation._applyTabIndex();
|
208
|
+
this._itemNavigation._focusCurrentItem();
|
209
|
+
}
|
210
|
+
if ((isHomeShift(e) || isEndShift(e)) && this.isMultiSelect) {
|
211
|
+
this._handleHomeEndSelection(e);
|
212
|
+
}
|
213
|
+
}
|
214
|
+
_handleTab(e) {
|
215
|
+
const isNext = isTabNext(e);
|
216
|
+
const target = getNormalizedTarget(e.target);
|
217
|
+
const targetType = this.getFocusedElementType(e.target);
|
218
|
+
if (this.columnHeaderTabbables.includes(target)) {
|
219
|
+
if (isNext && this.columnHeaderLastElement === target) {
|
220
|
+
return this._focusNextElement();
|
221
|
+
}
|
222
|
+
return;
|
223
|
+
}
|
224
|
+
if (isNext && targetType === TableFocusTargetElement.ColumnHeader && !this.columnHeaderTabbables.length) {
|
225
|
+
return this._focusNextElement();
|
226
|
+
}
|
227
|
+
if (targetType === TableFocusTargetElement.Row || !targetType) {
|
228
|
+
return;
|
229
|
+
}
|
230
|
+
switch (targetType) {
|
231
|
+
case TableFocusTargetElement.GroupRow:
|
232
|
+
return isNext ? this._focusNextElement() : this._focusForwardElement(false);
|
233
|
+
case TableFocusTargetElement.ColumnHeader:
|
234
|
+
return !isNext && this._focusForwardElement(false);
|
235
|
+
case TableFocusTargetElement.MoreButton:
|
236
|
+
if (isNext) {
|
237
|
+
this._focusForwardElement(true);
|
238
|
+
}
|
239
|
+
else {
|
240
|
+
e.preventDefault();
|
241
|
+
this.currentElement?.focus();
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|
245
|
+
_focusNextElement() {
|
246
|
+
if (!this.growsWithButton) {
|
247
|
+
this._focusForwardElement(true);
|
248
|
+
}
|
249
|
+
else {
|
250
|
+
this.morеBtn.focus();
|
251
|
+
}
|
252
|
+
}
|
253
|
+
_handleArrowNav(e) {
|
254
|
+
const isRowFocused = this.currentElement.localName === "tr";
|
255
|
+
if (!isRowFocused) {
|
256
|
+
return;
|
257
|
+
}
|
258
|
+
const previouslySelectedRows = this.selectedRows;
|
259
|
+
const currentItem = this.currentItem;
|
260
|
+
const currentItemIdx = this.currentItemIdx;
|
261
|
+
const prevItemIdx = currentItemIdx - 1;
|
262
|
+
const nextItemIdx = currentItemIdx + 1;
|
263
|
+
const prevItem = this.rows[prevItemIdx];
|
264
|
+
const nextItem = this.rows[nextItemIdx];
|
265
|
+
const wasSelected = !!currentItem.selected;
|
266
|
+
if ((isUpShift(e) && !prevItem) || (isDownShift(e) && !nextItem)) {
|
267
|
+
return;
|
268
|
+
}
|
269
|
+
if (isUpShift(e)) {
|
270
|
+
currentItem.selected = currentItem.selected && !prevItem.selected;
|
271
|
+
prevItem.selected = currentItem.selected || (wasSelected && !currentItem.selected);
|
272
|
+
prevItem.focus();
|
273
|
+
}
|
274
|
+
if (isDownShift(e)) {
|
275
|
+
currentItem.selected = currentItem.selected && !nextItem.selected;
|
276
|
+
nextItem.selected = currentItem.selected || (wasSelected && !currentItem.selected);
|
277
|
+
nextItem.focus();
|
278
|
+
}
|
279
|
+
const selectedRows = this.selectedRows;
|
280
|
+
this.fireEvent("selection-change", {
|
281
|
+
selectedRows,
|
282
|
+
previouslySelectedRows,
|
283
|
+
});
|
284
|
+
}
|
285
|
+
_handleHomeEndSelection(e) {
|
286
|
+
const isRowFocused = this.currentElement.localName === "tr";
|
287
|
+
if (!isRowFocused) {
|
288
|
+
return;
|
289
|
+
}
|
290
|
+
const rows = this.rows;
|
291
|
+
const previouslySelectedRows = this.selectedRows;
|
292
|
+
const currentItemIdx = this.currentItemIdx;
|
293
|
+
if (isHomeShift(e)) {
|
294
|
+
rows.slice(0, currentItemIdx + 1).forEach(item => {
|
295
|
+
item.selected = true;
|
296
|
+
});
|
297
|
+
rows[0].focus();
|
298
|
+
}
|
299
|
+
if (isEndShift(e)) {
|
300
|
+
rows.slice(currentItemIdx).forEach(item => {
|
301
|
+
item.selected = true;
|
302
|
+
});
|
303
|
+
rows[rows.length - 1].focus();
|
304
|
+
}
|
305
|
+
const selectedRows = this.selectedRows;
|
306
|
+
this.fireEvent("selection-change", {
|
307
|
+
selectedRows,
|
308
|
+
previouslySelectedRows,
|
309
|
+
});
|
310
|
+
}
|
311
|
+
/**
|
312
|
+
* Handles Alt + Up/Down.
|
313
|
+
* Switches focus between column header, last focused item, and "More" button (if applicable).
|
314
|
+
* @private
|
315
|
+
*/
|
316
|
+
_handleArrowAlt(e) {
|
317
|
+
const shouldMoveUp = isUpAlt(e);
|
318
|
+
const target = e.target;
|
319
|
+
const focusedElementType = this.getFocusedElementType(target);
|
320
|
+
if (shouldMoveUp) {
|
321
|
+
switch (focusedElementType) {
|
322
|
+
case TableFocusTargetElement.Row:
|
323
|
+
case TableFocusTargetElement.GroupRow:
|
324
|
+
this._prevFocusedRow = target;
|
325
|
+
return this._onColumnHeaderClick(e);
|
326
|
+
case TableFocusTargetElement.ColumnHeader:
|
327
|
+
return this.morеBtn ? this.morеBtn.focus() : this._prevFocusedRow?.focus();
|
328
|
+
case TableFocusTargetElement.MoreButton:
|
329
|
+
return this._prevFocusedRow ? this._prevFocusedRow.focus() : this._onColumnHeaderClick(e);
|
330
|
+
}
|
331
|
+
}
|
332
|
+
else {
|
333
|
+
switch (focusedElementType) {
|
334
|
+
case TableFocusTargetElement.Row:
|
335
|
+
case TableFocusTargetElement.GroupRow:
|
336
|
+
this._prevFocusedRow = target;
|
337
|
+
return this.morеBtn ? this.morеBtn.focus() : this._onColumnHeaderClick(e);
|
338
|
+
case TableFocusTargetElement.ColumnHeader:
|
339
|
+
if (this._prevFocusedRow) {
|
340
|
+
this._prevFocusedRow.focus();
|
341
|
+
}
|
342
|
+
else if (this.morеBtn) {
|
343
|
+
this.morеBtn.focus();
|
344
|
+
}
|
345
|
+
return;
|
346
|
+
case TableFocusTargetElement.MoreButton:
|
347
|
+
return this._onColumnHeaderClick(e);
|
348
|
+
}
|
349
|
+
}
|
350
|
+
}
|
351
|
+
/**
|
352
|
+
* Determines the type of the currently focused element.
|
353
|
+
* @private
|
354
|
+
*/
|
355
|
+
getFocusedElementType(element) {
|
356
|
+
if (element === this.columnHeader) {
|
357
|
+
return TableFocusTargetElement.ColumnHeader;
|
358
|
+
}
|
359
|
+
if (element === this.morеBtn) {
|
360
|
+
return TableFocusTargetElement.MoreButton;
|
361
|
+
}
|
362
|
+
if (this.rows.includes(element)) {
|
363
|
+
const isGroupRow = element.hasAttribute("ui5-table-group-row");
|
364
|
+
return isGroupRow ? TableFocusTargetElement.GroupRow : TableFocusTargetElement.Row;
|
365
|
+
}
|
366
|
+
}
|
367
|
+
/**
|
368
|
+
* Toggles focus between the table row's root and the last focused nested element.
|
369
|
+
* @private
|
370
|
+
*/
|
371
|
+
_handleF7(e) {
|
372
|
+
const row = e.detail.row;
|
373
|
+
row.tabbableElements = getTabbableElements(row);
|
374
|
+
const activeElement = getActiveElement();
|
375
|
+
const lastFocusedElement = row.tabbableElements[this._prevNestedElementIndex] || row.tabbableElements[0];
|
376
|
+
const targetIndex = row.tabbableElements.indexOf(activeElement);
|
377
|
+
if (!row.tabbableElements.length) {
|
378
|
+
return;
|
379
|
+
}
|
380
|
+
if (activeElement === row.root) {
|
381
|
+
lastFocusedElement.focus();
|
382
|
+
}
|
383
|
+
else if (targetIndex > -1) {
|
384
|
+
this._prevNestedElementIndex = targetIndex;
|
385
|
+
row.root.focus();
|
386
|
+
}
|
387
|
+
}
|
388
|
+
_onfocusin(e) {
|
389
|
+
const target = getNormalizedTarget(e.target);
|
390
|
+
if (!this._isForwardElement(target)) {
|
391
|
+
this.lastFocusedElement = target;
|
392
|
+
return;
|
393
|
+
}
|
394
|
+
if (!this._forwardingFocus) {
|
395
|
+
if (this.lastFocusedElement) {
|
396
|
+
this.lastFocusedElement.focus();
|
397
|
+
}
|
398
|
+
else {
|
399
|
+
this.currentElement.focus();
|
400
|
+
}
|
401
|
+
e.stopImmediatePropagation();
|
402
|
+
}
|
403
|
+
this._forwardingFocus = false;
|
404
|
+
}
|
405
|
+
_onForwardBefore(e) {
|
406
|
+
this.lastFocusedElement = e.detail.target;
|
407
|
+
this._focusForwardElement(false);
|
408
|
+
e.stopImmediatePropagation();
|
409
|
+
}
|
410
|
+
_onForwardAfter(e) {
|
411
|
+
this.lastFocusedElement = e.detail.target;
|
412
|
+
if (!this.growsWithButton) {
|
413
|
+
this._focusForwardElement(true);
|
414
|
+
}
|
415
|
+
else {
|
416
|
+
this.morеBtn.focus();
|
417
|
+
}
|
418
|
+
}
|
419
|
+
_focusForwardElement(isAfter) {
|
420
|
+
this._forwardingFocus = true;
|
421
|
+
this.shadowRoot.querySelector(`#${this._id}-${isAfter ? "after" : "before"}`).focus();
|
422
|
+
}
|
423
|
+
_isForwardElement(element) {
|
424
|
+
const elementId = element.id;
|
425
|
+
const afterElement = this._getForwardElement(true);
|
426
|
+
const beforeElement = this._getForwardElement(false);
|
427
|
+
if (this._id === elementId || (beforeElement && beforeElement.id === elementId)) {
|
428
|
+
return true;
|
429
|
+
}
|
430
|
+
return !!(afterElement && afterElement.id === elementId);
|
431
|
+
}
|
432
|
+
_getForwardElement(isAfter) {
|
433
|
+
if (isAfter) {
|
434
|
+
return this._getAfterForwardElement();
|
435
|
+
}
|
436
|
+
return this._getBeforeForwardElement();
|
437
|
+
}
|
438
|
+
_getAfterForwardElement() {
|
439
|
+
if (!this._afterElement) {
|
440
|
+
this._afterElement = this.shadowRoot.querySelector(`[id="${this._id}-after"]`);
|
441
|
+
}
|
442
|
+
return this._afterElement;
|
443
|
+
}
|
444
|
+
_getBeforeForwardElement() {
|
445
|
+
if (!this._beforeElement) {
|
446
|
+
this._beforeElement = this.shadowRoot.querySelector(`[id="${this._id}-before"]`);
|
447
|
+
}
|
448
|
+
return this._beforeElement;
|
449
|
+
}
|
450
|
+
onRowFocused(e) {
|
451
|
+
this._itemNavigation.setCurrentItem(e.target);
|
452
|
+
}
|
453
|
+
_onColumnHeaderFocused() {
|
454
|
+
this._itemNavigation.setCurrentItem(this._columnHeader);
|
455
|
+
}
|
456
|
+
_onColumnHeaderClick(e) {
|
457
|
+
if (!e.target) {
|
458
|
+
this.columnHeader.focus();
|
459
|
+
}
|
460
|
+
const target = getNormalizedTarget(e.target);
|
461
|
+
const isNestedElement = this.columnHeaderTabbables.includes(target);
|
462
|
+
if (!isNestedElement) {
|
463
|
+
this.columnHeader.focus();
|
464
|
+
}
|
465
|
+
}
|
466
|
+
_onColumnHeaderKeydown(e) {
|
467
|
+
if (isSpace(e)) {
|
468
|
+
e.preventDefault();
|
469
|
+
this.isMultiSelect && this._selectAll();
|
470
|
+
}
|
471
|
+
}
|
472
|
+
_onLoadMoreKeydown(e) {
|
473
|
+
if (isSpace(e)) {
|
474
|
+
e.preventDefault();
|
475
|
+
this._loadMoreActive = true;
|
476
|
+
}
|
477
|
+
if (isEnter(e)) {
|
478
|
+
this._onLoadMoreClick();
|
479
|
+
this._loadMoreActive = true;
|
480
|
+
}
|
481
|
+
}
|
482
|
+
_onLoadMoreKeyup(e) {
|
483
|
+
if (isSpace(e)) {
|
484
|
+
this._onLoadMoreClick();
|
485
|
+
}
|
486
|
+
this._loadMoreActive = false;
|
487
|
+
}
|
488
|
+
_onLoadMoreClick() {
|
489
|
+
this.fireEvent("load-more");
|
490
|
+
}
|
491
|
+
observeTableEnd() {
|
492
|
+
if (!this.tableEndObserved) {
|
493
|
+
this.getIntersectionObserver().observe(this.tableEndDOM);
|
494
|
+
this.tableEndObserved = true;
|
495
|
+
}
|
496
|
+
}
|
497
|
+
onInteresection(entries) {
|
498
|
+
if (this.initialIntersection) {
|
499
|
+
this.initialIntersection = false;
|
500
|
+
return;
|
501
|
+
}
|
502
|
+
if (entries.some(entry => entry.isIntersecting)) {
|
503
|
+
debounce(this.loadMore.bind(this), GROWING_WITH_SCROLL_DEBOUNCE_RATE);
|
504
|
+
}
|
505
|
+
}
|
506
|
+
loadMore() {
|
507
|
+
this.fireEvent("load-more");
|
508
|
+
}
|
509
|
+
_handleSingleSelect(e) {
|
510
|
+
const row = this.getRowParent(e.target);
|
511
|
+
if (!row) {
|
512
|
+
return;
|
513
|
+
}
|
514
|
+
if (!row.selected) {
|
515
|
+
const previouslySelectedRows = this.selectedRows;
|
516
|
+
this.rows.forEach(item => {
|
517
|
+
if (item.selected) {
|
518
|
+
item.selected = false;
|
519
|
+
}
|
520
|
+
});
|
521
|
+
row.selected = true;
|
522
|
+
this.fireEvent("selection-change", {
|
523
|
+
selectedRows: [row],
|
524
|
+
previouslySelectedRows,
|
525
|
+
});
|
526
|
+
}
|
527
|
+
}
|
528
|
+
_handleMultiSelect(e) {
|
529
|
+
const row = this.getRowParent(e.target);
|
530
|
+
const previouslySelectedRows = this.selectedRows;
|
531
|
+
if (!row) {
|
532
|
+
return;
|
533
|
+
}
|
534
|
+
row.selected = !row.selected;
|
535
|
+
const selectedRows = this.selectedRows;
|
536
|
+
if (selectedRows.length === this.rows.length) {
|
537
|
+
this._allRowsSelected = true;
|
538
|
+
}
|
539
|
+
else {
|
540
|
+
this._allRowsSelected = false;
|
541
|
+
}
|
542
|
+
this.fireEvent("selection-change", {
|
543
|
+
selectedRows,
|
544
|
+
previouslySelectedRows,
|
545
|
+
});
|
546
|
+
}
|
547
|
+
_handleSelect(e) {
|
548
|
+
if (this.isSingleSelect) {
|
549
|
+
this._handleSingleSelect(e);
|
550
|
+
return;
|
551
|
+
}
|
552
|
+
if (this.isMultiSelect) {
|
553
|
+
this._handleMultiSelect(e);
|
554
|
+
}
|
555
|
+
}
|
556
|
+
_selectAll() {
|
557
|
+
const bAllSelected = !this._allRowsSelected;
|
558
|
+
const previouslySelectedRows = this.rows.filter(row => row.selected);
|
559
|
+
this._allRowsSelected = bAllSelected;
|
560
|
+
this.rows.forEach(row => {
|
561
|
+
row.selected = bAllSelected;
|
562
|
+
});
|
563
|
+
const selectedRows = bAllSelected ? this.rows : [];
|
564
|
+
this.fireEvent("selection-change", {
|
565
|
+
selectedRows,
|
566
|
+
previouslySelectedRows,
|
567
|
+
});
|
568
|
+
}
|
569
|
+
getRowParent(child) {
|
570
|
+
if (child.hasAttribute("ui5-table-row")) {
|
571
|
+
return child;
|
572
|
+
}
|
573
|
+
const parent = child.parentElement;
|
574
|
+
if (!parent) {
|
575
|
+
return;
|
576
|
+
}
|
577
|
+
if (parent.hasAttribute("ui5-table-row")) {
|
578
|
+
return parent;
|
579
|
+
}
|
580
|
+
return this.getRowParent(parent);
|
581
|
+
}
|
582
|
+
get columnHeader() {
|
583
|
+
const domRef = this.getDomRef();
|
584
|
+
return domRef ? domRef.querySelector(`#${this._id}-columnHeader`) : null;
|
585
|
+
}
|
586
|
+
get morеBtn() {
|
587
|
+
const domRef = this.getDomRef();
|
588
|
+
if (this.growsWithButton && domRef) {
|
589
|
+
return domRef.querySelector(`#${this._id}-growingButton`);
|
590
|
+
}
|
591
|
+
return null;
|
592
|
+
}
|
593
|
+
handleResize() {
|
594
|
+
this.checkTableInViewport();
|
595
|
+
this.popinContent();
|
596
|
+
}
|
597
|
+
checkTableInViewport() {
|
598
|
+
this._inViewport = isElementInView(this.getDomRef());
|
599
|
+
}
|
600
|
+
popinContent() {
|
601
|
+
const clientRect = this.getDomRef().getBoundingClientRect();
|
602
|
+
const tableWidth = clientRect.width;
|
603
|
+
const hiddenColumns = [];
|
604
|
+
const visibleColumnsIndexes = [];
|
605
|
+
// store the hidden columns
|
606
|
+
this.columns.forEach((column, index) => {
|
607
|
+
if (tableWidth < column.minWidth && column.minWidth !== Infinity) {
|
608
|
+
hiddenColumns[index] = {
|
609
|
+
index,
|
610
|
+
popinText: column.popinText,
|
611
|
+
demandPopin: column.demandPopin,
|
612
|
+
};
|
613
|
+
}
|
614
|
+
else {
|
615
|
+
visibleColumnsIndexes.push(index);
|
616
|
+
}
|
617
|
+
});
|
618
|
+
if (visibleColumnsIndexes.length) {
|
619
|
+
if (!this.isMultiSelect) {
|
620
|
+
this.columns[visibleColumnsIndexes[0]].first = true;
|
621
|
+
}
|
622
|
+
this.columns[visibleColumnsIndexes[visibleColumnsIndexes.length - 1]].last = true;
|
623
|
+
}
|
624
|
+
const hiddenColumnsChange = (this._hiddenColumns.length !== hiddenColumns.length) || this._hiddenColumns.some((column, index) => column !== hiddenColumns[index]);
|
625
|
+
const shownColumnsChange = hiddenColumns.length === 0;
|
626
|
+
// invalidate if hidden columns count has changed or columns are shown
|
627
|
+
if (hiddenColumnsChange || shownColumnsChange) {
|
628
|
+
this._hiddenColumns = hiddenColumns;
|
629
|
+
this.fireEvent("popin-change", {
|
630
|
+
poppedColumns: this._hiddenColumns,
|
631
|
+
});
|
632
|
+
}
|
633
|
+
}
|
634
|
+
/**
|
635
|
+
* Gets settings to be propagated from columns to rows.
|
636
|
+
*/
|
637
|
+
getColumnPropagationSettings() {
|
638
|
+
return this.columns.map((column, index) => {
|
639
|
+
return {
|
640
|
+
index,
|
641
|
+
minWidth: column.minWidth,
|
642
|
+
demandPopin: column.demandPopin,
|
643
|
+
text: column.textContent,
|
644
|
+
popinText: column.popinText,
|
645
|
+
popinDisplay: column.popinDisplay,
|
646
|
+
visible: !this._hiddenColumns[index],
|
647
|
+
};
|
648
|
+
}, this);
|
649
|
+
}
|
650
|
+
getIntersectionObserver() {
|
651
|
+
if (!this.growingIntersectionObserver) {
|
652
|
+
this.growingIntersectionObserver = new IntersectionObserver(this.onInteresection.bind(this), {
|
653
|
+
root: document,
|
654
|
+
rootMargin: "0px",
|
655
|
+
threshold: 1.0,
|
656
|
+
});
|
657
|
+
}
|
658
|
+
return this.growingIntersectionObserver;
|
659
|
+
}
|
660
|
+
get styles() {
|
661
|
+
return {
|
662
|
+
busy: {
|
663
|
+
position: this.busyIndPosition,
|
664
|
+
},
|
665
|
+
};
|
666
|
+
}
|
667
|
+
get growsWithButton() {
|
668
|
+
return this.growing === TableGrowingMode.Button;
|
669
|
+
}
|
670
|
+
get growsOnScroll() {
|
671
|
+
return this.growing === TableGrowingMode.Scroll;
|
672
|
+
}
|
673
|
+
get _growingButtonText() {
|
674
|
+
return this.growingButtonText || Table_1.i18nBundle.getText(LOAD_MORE_TEXT);
|
675
|
+
}
|
676
|
+
get ariaLabelText() {
|
677
|
+
const rowsCount = this.rows.length + 1;
|
678
|
+
const headerRowText = Table_1.i18nBundle.getText(TABLE_HEADER_ROW_INFORMATION, rowsCount);
|
679
|
+
const columnsTitle = this.columns.map(column => {
|
680
|
+
return column.textContent.trim();
|
681
|
+
}).join(" ");
|
682
|
+
return `${headerRowText} ${columnsTitle}`;
|
683
|
+
}
|
684
|
+
get tableAriaLabelText() {
|
685
|
+
return getEffectiveAriaLabelText(this);
|
686
|
+
}
|
687
|
+
get ariaLabelSelectAllText() {
|
688
|
+
return Table_1.i18nBundle.getText(ARIA_LABEL_SELECT_ALL_CHECKBOX);
|
689
|
+
}
|
690
|
+
get loadMoreAriaLabelledBy() {
|
691
|
+
if (this.moreDataText) {
|
692
|
+
return `${this._id}-growingButton-text ${this._id}-growingButton-subtext`;
|
693
|
+
}
|
694
|
+
return `${this._id}-growingButton-text`;
|
695
|
+
}
|
696
|
+
get tableEndDOM() {
|
697
|
+
return this.shadowRoot.querySelector(".ui5-table-end-marker");
|
698
|
+
}
|
699
|
+
get busyIndPosition() {
|
700
|
+
return this._inViewport ? "absolute" : "sticky";
|
701
|
+
}
|
702
|
+
get isMultiSelect() {
|
703
|
+
return this.mode === TableMode.MultiSelect;
|
704
|
+
}
|
705
|
+
get isSingleSelect() {
|
706
|
+
return this.mode === TableMode.SingleSelect;
|
707
|
+
}
|
708
|
+
get selectedRows() {
|
709
|
+
return this.rows.filter(row => row.selected);
|
710
|
+
}
|
711
|
+
get currentItemIdx() {
|
712
|
+
return this.rows.indexOf(this.currentItem);
|
713
|
+
}
|
714
|
+
get currentItem() {
|
715
|
+
return this.getRootNode().activeElement;
|
716
|
+
}
|
717
|
+
get currentElement() {
|
718
|
+
return this._itemNavigation._getCurrentItem();
|
719
|
+
}
|
720
|
+
get columnHeaderTabbables() {
|
721
|
+
return this.columnHeader ? getTabbableElements(this.columnHeader) : [];
|
722
|
+
}
|
723
|
+
get columnHeaderLastElement() {
|
724
|
+
return this.columnHeader && getLastTabbableElement(this.columnHeader);
|
725
|
+
}
|
726
|
+
};
|
727
|
+
__decorate([
|
728
|
+
property()
|
729
|
+
], Table.prototype, "noDataText", void 0);
|
730
|
+
__decorate([
|
731
|
+
property()
|
732
|
+
], Table.prototype, "growingButtonText", void 0);
|
733
|
+
__decorate([
|
734
|
+
property()
|
735
|
+
], Table.prototype, "growingButtonSubtext", void 0);
|
736
|
+
__decorate([
|
737
|
+
property({ type: Boolean })
|
738
|
+
], Table.prototype, "hideNoData", void 0);
|
739
|
+
__decorate([
|
740
|
+
property({ type: TableGrowingMode, defaultValue: TableGrowingMode.None })
|
741
|
+
], Table.prototype, "growing", void 0);
|
742
|
+
__decorate([
|
743
|
+
property({ type: Boolean })
|
744
|
+
], Table.prototype, "busy", void 0);
|
745
|
+
__decorate([
|
746
|
+
property({ validator: Integer, defaultValue: 1000 })
|
747
|
+
], Table.prototype, "busyDelay", void 0);
|
748
|
+
__decorate([
|
749
|
+
property({ type: Boolean })
|
750
|
+
], Table.prototype, "stickyColumnHeader", void 0);
|
751
|
+
__decorate([
|
752
|
+
property({ type: TableMode, defaultValue: TableMode.None })
|
753
|
+
], Table.prototype, "mode", void 0);
|
754
|
+
__decorate([
|
755
|
+
property({ defaultValue: undefined })
|
756
|
+
], Table.prototype, "accessibleName", void 0);
|
757
|
+
__decorate([
|
758
|
+
property({ defaultValue: "" })
|
759
|
+
], Table.prototype, "accessibleNameRef", void 0);
|
760
|
+
__decorate([
|
761
|
+
property({ type: Object, multiple: true })
|
762
|
+
], Table.prototype, "_hiddenColumns", void 0);
|
763
|
+
__decorate([
|
764
|
+
property({ type: Boolean })
|
765
|
+
], Table.prototype, "_noDataDisplayed", void 0);
|
766
|
+
__decorate([
|
767
|
+
property({ type: Boolean })
|
768
|
+
], Table.prototype, "_loadMoreActive", void 0);
|
769
|
+
__decorate([
|
770
|
+
property({ type: Object })
|
771
|
+
], Table.prototype, "_columnHeader", void 0);
|
772
|
+
__decorate([
|
773
|
+
property({ type: Boolean })
|
774
|
+
], Table.prototype, "_inViewport", void 0);
|
775
|
+
__decorate([
|
776
|
+
property({ type: Boolean })
|
777
|
+
], Table.prototype, "_allRowsSelected", void 0);
|
778
|
+
__decorate([
|
779
|
+
slot({
|
780
|
+
type: HTMLElement,
|
781
|
+
"default": true,
|
782
|
+
individualSlots: true,
|
783
|
+
invalidateOnChildChange: true,
|
784
|
+
})
|
785
|
+
], Table.prototype, "rows", void 0);
|
786
|
+
__decorate([
|
787
|
+
slot({
|
788
|
+
type: HTMLElement,
|
789
|
+
individualSlots: true,
|
790
|
+
invalidateOnChildChange: {
|
791
|
+
properties: true,
|
792
|
+
slots: false,
|
793
|
+
},
|
794
|
+
})
|
795
|
+
], Table.prototype, "columns", void 0);
|
796
|
+
Table = Table_1 = __decorate([
|
797
|
+
customElement({
|
798
|
+
tag: "ui5-table",
|
799
|
+
fastNavigation: true,
|
800
|
+
styles: tableStyles,
|
801
|
+
renderer: litRender,
|
802
|
+
template: TableTemplate,
|
803
|
+
dependencies: [BusyIndicator, CheckBox],
|
804
|
+
})
|
805
|
+
/** Fired when a row in `Active` mode is clicked or `Enter` key is pressed.
|
806
|
+
* @param {HTMLElement} row the activated row.
|
807
|
+
* @public
|
808
|
+
*/
|
809
|
+
,
|
810
|
+
event("row-click", {
|
811
|
+
detail: {
|
812
|
+
/**
|
813
|
+
* @public
|
814
|
+
*/
|
815
|
+
row: { type: HTMLElement },
|
816
|
+
},
|
817
|
+
})
|
818
|
+
/**
|
819
|
+
* Fired when `ui5-table-column` is shown as a pop-in instead of hiding it.
|
820
|
+
* @param {Array} poppedColumns popped-in columns.
|
821
|
+
* @since 2.0.0
|
822
|
+
* @public
|
823
|
+
*/
|
824
|
+
,
|
825
|
+
event("popin-change", {
|
826
|
+
detail: {
|
827
|
+
/**
|
828
|
+
* @public
|
829
|
+
*/
|
830
|
+
poppedColumns: {
|
831
|
+
type: Array,
|
832
|
+
},
|
833
|
+
},
|
834
|
+
})
|
835
|
+
/**
|
836
|
+
* Fired when the user presses the `More` button or scrolls to the table's end.
|
837
|
+
*
|
838
|
+
* **Note:** The event will be fired if `growing` is set to `Button` or `Scroll`.
|
839
|
+
* @public
|
840
|
+
* @since 2.0.0
|
841
|
+
*/
|
842
|
+
,
|
843
|
+
event("load-more")
|
844
|
+
/**
|
845
|
+
* Fired when selection is changed by user interaction
|
846
|
+
* in `SingleSelect` and `MultiSelect` modes.
|
847
|
+
* @param {Array} selectedRows An array of the selected rows.
|
848
|
+
* @param {Array} previouslySelectedRows An array of the previously selected rows.
|
849
|
+
* @public
|
850
|
+
* @since 2.0.0
|
851
|
+
*/
|
852
|
+
,
|
853
|
+
event("selection-change", {
|
854
|
+
detail: {
|
855
|
+
/**
|
856
|
+
* @public
|
857
|
+
*/
|
858
|
+
selectedRows: { type: Array },
|
859
|
+
/**
|
860
|
+
* @public
|
861
|
+
*/
|
862
|
+
previouslySelectedRows: { type: Array },
|
863
|
+
},
|
864
|
+
})
|
865
|
+
], Table);
|
866
|
+
Table.define();
|
867
|
+
export default Table;
|
868
|
+
//# sourceMappingURL=Table.js.map
|