Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(ui5-table): improve documentation #7951

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions packages/main/src/Interfaces.ts
Original file line number Diff line number Diff line change
@@ -111,24 +111,6 @@ interface IOption extends UI5Element {
*/
const ITableRow = "sap.ui.webc.main.ITableRow";

/**
* Interface for components that may be slotted inside a <code>ui5-table</code> as columns
*
* @name sap.ui.webc.main.ITableColumn
* @interface
* @public
*/
const ITableColumn = "sap.ui.webc.main.ITableColumn";

/**
* Interface for components that may be slotted inside a <code>ui5-table-row</code> as cells
*
* @name sap.ui.webc.main.ITableCell
* @interface
* @public
*/
const ITableCell = "sap.ui.webc.main.ITableCell";

/**
* Interface for components that represent a token and are usable in components such as <code>ui5-multi-input</code>
*
@@ -160,8 +142,6 @@ export {
IMultiComboBoxItem,
ISegmentedButtonItem,
IOption,
ITableCell,
ITableColumn,
ITableRow,
IToken,
ITreeItem,
84 changes: 31 additions & 53 deletions packages/main/src/Table.ts
Original file line number Diff line number Diff line change
@@ -66,6 +66,9 @@ const GROWING_WITH_SCROLL_DEBOUNCE_RATE = 250; // ms

const PAGE_UP_DOWN_SIZE = 20;

/**
* @public
*/
interface ITableRow extends UI5Element {
mode: `${TableMode}`,
selected: boolean,
@@ -171,11 +174,7 @@ enum TableFocusTargetElement {
* <code>import "@ui5/webcomponents/dist/TableCell.js";</code> (for <code>ui5-table-cell</code>)
*
* @constructor
* @author SAP SE
* @alias sap.ui.webc.main.Table
* @extends sap.ui.webc.base.UI5Element
* @tagname ui5-table
* @appenddocs sap.ui.webc.main.TableColumn sap.ui.webc.main.TableRow sap.ui.webc.main.TableGroupRow sap.ui.webc.main.TableCell
* @extends UI5Element
* @public
*/
@customElement({
@@ -188,26 +187,30 @@ enum TableFocusTargetElement {
})
/** Fired when a row in <code>Active</code> mode is clicked or <code>Enter</code> key is pressed.
*
* @event sap.ui.webc.main.Table#row-click
* @param {HTMLElement} row the activated row.
* @public
*/
@event("row-click", {
detail: {
/**
* @public
*/
row: { type: HTMLElement },
},
})

/**
* Fired when <code>ui5-table-column</code> is shown as a pop-in instead of hiding it.
*
* @event sap.ui.webc.main.Table#popin-change
* @param {Array} poppedColumns popped-in columns.
* @since 1.0.0-rc.6
* @public
*/
@event("popin-change", {
detail: {
/**
* @public
*/
poppedColumns: {
type: Array,
},
@@ -219,7 +222,6 @@ enum TableFocusTargetElement {
* <br><br>
*
* <b>Note:</b> The event will be fired if <code>growing</code> is set to <code>Button</code> or <code>Scroll</code>.
* @event sap.ui.webc.main.Table#load-more
* @public
* @since 1.0.0-rc.11
*/
@@ -237,17 +239,21 @@ enum TableFocusTargetElement {
*/
@event("selection-change", {
detail: {
/**
* @public
*/
selectedRows: { type: Array },
/**
* @public
*/
previouslySelectedRows: { type: Array },
},
})
class Table extends UI5Element {
/**
* Defines the text that will be displayed when there is no data and <code>hideNoData</code> is not present.
*
* @type {string}
* @name sap.ui.webc.main.Table.prototype.noDataText
* @defaultvalue ""
* @default ""
* @public
*/
@property()
@@ -262,9 +268,7 @@ class Table extends UI5Element {
* <br>
* <b>Note:</b> This property takes effect if <code>growing</code> is set to <code>Button</code>.
*
* @type {string}
* @name sap.ui.webc.main.Table.prototype.growingButtonText
* @defaultvalue ""
* @default ""
* @since 1.0.0-rc.15
* @public
*/
@@ -277,9 +281,7 @@ class Table extends UI5Element {
* <br><br>
* <b>Note:</b> This property takes effect if <code>growing</code> is set to <code>Button</code>.
*
* @type {string}
* @name sap.ui.webc.main.Table.prototype.growingButtonSubtext
* @defaultvalue ""
* @default ""
* @since 1.0.0-rc.15
* @public
*/
@@ -289,9 +291,7 @@ class Table extends UI5Element {
/**
* Defines if the value of <code>noDataText</code> will be diplayed when there is no rows present in the table.
*
* @type {boolean}
* @name sap.ui.webc.main.Table.prototype.hideNoData
* @defaultvalue false
* @default false
* @public
* @since 1.0.0-rc.15
*/
@@ -314,9 +314,8 @@ class Table extends UI5Element {
*
* <b>Restrictions:</b> <code>growing="Scroll"</code> is not supported for Internet Explorer,
* and the component will fallback to <code>growing="Button"</code>.
* @type {sap.ui.webc.main.types.TableGrowingMode}
* @name sap.ui.webc.main.Table.prototype.growing
* @defaultvalue "None"
*
* @default "None"
* @since 1.0.0-rc.12
* @public
*/
@@ -329,9 +328,8 @@ class Table extends UI5Element {
*
* In this state the component's opacity is reduced
* and busy indicator is displayed at the bottom of the table.
* @type {boolean}
* @name sap.ui.webc.main.Table.prototype.busy
* @defaultvalue false
*
* @default false
* @since 1.0.0-rc.12
* @public
*/
@@ -341,9 +339,7 @@ class Table extends UI5Element {
/**
* Defines the delay in milliseconds, after which the busy indicator will show up for this component.
*
* @type {sap.ui.webc.base.types.Integer}
* @name sap.ui.webc.main.Table.prototype.busyDelay
* @defaultValue 1000
* @default 1000
* @public
*/
@property({ validator: Integer, defaultValue: 1000 })
@@ -371,9 +367,7 @@ class Table extends UI5Element {
* </li>
* </ul>
*
* @type {boolean}
* @name sap.ui.webc.main.Table.prototype.stickyColumnHeader
* @defaultvalue false
* @default false
* @public
*/
@property({ type: Boolean })
@@ -382,9 +376,7 @@ class Table extends UI5Element {
/**
* Defines the mode of the component.
*
* @type {sap.ui.webc.main.types.TableMode}
* @name sap.ui.webc.main.Table.prototype.mode
* @defaultvalue "None"
* @default "None"
* @since 1.0.0-rc.15
* @public
*/
@@ -394,9 +386,7 @@ class Table extends UI5Element {
/**
* Defines the accessible ARIA name of the component.
*
* @type {string}
* @name sap.ui.webc.main.Table.prototype.accessibleName
* @defaultvalue: ""
* @default undefined
* @public
* @since 1.3.0
*/
@@ -406,9 +396,7 @@ class Table extends UI5Element {
/**
* Receives id(or many ids) of the elements that label the component.
*
* @type {string}
* @name sap.ui.webc.main.Table.prototype.accessibleNameRef
* @defaultvalue ""
* @default ""
* @public
* @since 1.3.0
*/
@@ -444,8 +432,8 @@ class Table extends UI5Element {

/**
* Defines whether all rows are selected or not when table is in MultiSelect mode.
* @type {boolean}
* @defaultvalue false
*
* @default false
* @since 1.0.0-rc.15
* @private
*/
@@ -457,9 +445,6 @@ class Table extends UI5Element {
* <br><br>
* <b>Note:</b> Use <code>ui5-table-row</code> for the intended design.
*
* @type {sap.ui.webc.main.ITableRow[]}
* @name sap.ui.webc.main.Table.prototype.default
* @slot rows
* @public
*/
@slot({
@@ -475,8 +460,6 @@ class Table extends UI5Element {
* <br><br>
* <b>Note:</b> Use <code>ui5-table-column</code> for the intended design.
*
* @type {sap.ui.webc.main.ITableColumn[]}
* @name sap.ui.webc.main.Table.prototype.columns
* @slot
* @public
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TableColumn has template so we have to provide interface. Same applies to for table cell

*/
@@ -771,7 +754,6 @@ class Table extends UI5Element {
* Handles Alt + Up/Down.
* Switches focus between column header, last focused item, and "More" button (if applicable).
* @private
* @param { KeyboardEvent } e
*/
_handleArrowAlt(e: KeyboardEvent) {
const shouldMoveUp: boolean = isUpAlt(e);
@@ -812,8 +794,6 @@ class Table extends UI5Element {
/**
* Determines the type of the currently focused element.
* @private
* @param {object} element The DOM element
* @returns {("columnHeader"|"tableRow"|"tableGroupRow"|"moreButton")} A string identifier
*/
getFocusedElementType(element: HTMLElement): TableFocusTargetElement | undefined {
if (element === this.columnHeader) {
@@ -833,7 +813,6 @@ class Table extends UI5Element {
/**
* Toggles focus between the table row's root and the last focused nested element.
* @private
* @param { CustomEvent } e "ui5-f7-pressed"
*/
_handleF7(e: CustomEvent<TableRowF7PressEventDetail>) {
const row = e.detail.row;
@@ -1157,7 +1136,6 @@ class Table extends UI5Element {
/**
* Gets settings to be propagated from columns to rows.
*
* @returns { array }
* @memberof Table
*/
getColumnPropagationSettings(): Array<TableColumnInfo> {
19 changes: 2 additions & 17 deletions packages/main/src/TableCell.ts
Original file line number Diff line number Diff line change
@@ -22,22 +22,10 @@ import {
*
* The <code>ui5-table-cell</code> component defines the structure of the data in a single <code>ui5-table</code> cell.
*
* <h3>CSS Shadow Parts</h3>
*
* <ui5-link target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/::part">CSS Shadow Parts</ui5-link> allow developers to style elements inside the Shadow DOM.
* <br>
* The <code>ui5-table-cell</code> exposes the following CSS Shadow Parts:
* <ul>
* <li>cell - Used to style the native <code>td</code> element</li>
* </ul>
*
* @constructor
* @author SAP SE
* @alias sap.ui.webc.main.TableCell
* @extends sap.ui.webc.base.UI5Element
* @tagname ui5-table-cell
* @implements sap.ui.webc.main.ITableCell
* @extends UI5Element
* @public
* @csspart cell - Used to style the native <code>td</code> element
*/
@customElement({
tag: "ui5-table-cell",
@@ -67,9 +55,6 @@ class TableCell extends UI5Element {
/**
* Specifies the content of the component.
*
* @type {Node[]}
* @slot
* @name sap.ui.webc.main.TableCell.prototype.default
* @public
*/
@slot({ type: HTMLElement, "default": true })
Loading