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

feat: ui5-tree (new component) #1580

Merged
merged 30 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2849531
PoC: ui5-tree
vladitasev May 5, 2020
2ac2eab
expand button
vladitasev May 5, 2020
c1e3f75
introduce tree list item
vladitasev May 8, 2020
1ce9e1e
dispatch event to tree
vladitasev May 8, 2020
f8340f5
tree emits events
vladitasev May 8, 2020
cd054b5
modes and events
vladitasev May 8, 2020
d4dee00
add selected
vladitasev May 8, 2020
ee0258a
icons, header and walk
vladitasev May 8, 2020
5a388d5
simplify styles
vladitasev May 8, 2020
912b113
fix api
vladitasev May 8, 2020
1de01dd
minor
vladitasev May 8, 2020
b110423
keyboard handling
vladitasev May 11, 2020
a14bf9c
jsdoc part 1
vladitasev May 11, 2020
fa0c97a
jsdoc 2
vladitasev May 11, 2020
d058ad3
allow for dynamic usage
vladitasev May 11, 2020
0990582
sample and tests
vladitasev May 11, 2020
b91f247
docs/samples fixes, some tests
vladitasev May 12, 2020
0487420
compact cozy
vladitasev May 12, 2020
17fa025
fix width for IE
vladitasev May 12, 2020
06591c6
fix ie kb handling
vladitasev May 12, 2020
6d614b8
add IE comment
vladitasev May 12, 2020
5a33482
add role tree
vladitasev May 12, 2020
0d46ef4
more acc
vladitasev May 12, 2020
4e5ee05
acc tests
vladitasev May 12, 2020
d9403b7
return old code
vladitasev May 12, 2020
76049fa
visual design
vladitasev May 12, 2020
cbe3866
remove busy
vladitasev May 13, 2020
66e3aad
Merge remote-tracking branch 'origin/master' into ui5-tree
vladitasev May 13, 2020
6db1914
remove unnecessary CSS after list is now 100% width by default
vladitasev May 13, 2020
93281d2
fix failing test after hbs change
vladitasev May 13, 2020
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
2 changes: 2 additions & 0 deletions docs/Public Module Imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ For API documentation and samples, please check the [UI5 Web Components Playgrou
| Title | `ui5-title` | `import "@ui5/webcomponents/dist/Title.js";` |
| Toast | `ui5-toast` | `import "@ui5/webcomponents/dist/Toast.js";` |
| Toggle Button | `ui5-togglebutton` | `import "@ui5/webcomponents/dist/ToggleButton.js";` |
| Tree | `ui5-tree` | `import "@ui5/webcomponents/dist/Tree.js";` |
| Tree Item | `ui5-tree-item` | comes with `ui5-tree` |

### 2. Assets

Expand Down
3 changes: 1 addition & 2 deletions packages/main/bundle.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ import TimePicker from "./dist/TimePicker.js";
import Title from "./dist/Title.js";
import Toast from "./dist/Toast.js";
import ToggleButton from "./dist/ToggleButton.js";


import Tree from "./dist/Tree.js";

import List from "./dist/List.js";
import StandardListItem from "./dist/StandardListItem.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/List.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<div id="{{_id}}-before" tabindex="0" class="ui5-list-focusarea"></div>

<ul id="{{_id}}-listUl" class="ui5-list-ul" aria-multiselectable="{{isMultiSelect}}" aria-labelledby="{{ariaLabelledBy}}" role="listbox">
<ul id="{{_id}}-listUl" class="ui5-list-ul" aria-multiselectable="{{isMultiSelect}}" aria-labelledby="{{ariaLabelledBy}}" role="{{_role}}">
<slot></slot>

{{#if showNoDataText}}
Expand All @@ -41,4 +41,4 @@
{{/if}}

<div id="{{_id}}-after" tabindex="0" class="ui5-list-focusarea"></div>
</div>
</div>
23 changes: 19 additions & 4 deletions packages/main/src/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const metadata = {
slots: /** @lends sap.ui.webcomponents.main.List.prototype */ {

/**
* Defines the <code>ui5-li</code> header.
* Defines the <code>ui5-list</code> header.
* <br><br>
* <b>Note:</b> When <code>header</code> is set, the
* <code>headerText</code> property is ignored.
Expand Down Expand Up @@ -93,8 +93,8 @@ const metadata = {
/**
* Defines the mode of the <code>ui5-list</code>.
* <br><br>
* <b>Note:</b> Avalaible options are <code>None</code>, <code>SingleSelect</code>,
* <code>MultiSelect</code>, and <code>Delete</code>.
* <b>Note:</b> Available options are <code>None</code>, <code>SingleSelect</code>, <code>SingleSelectBegin</code>,
* <code>SingleSelectEnd</code>, <code>MultiSelect</code>, and <code>Delete</code>.
*
* @type {ListMode}
* @defaultvalue "None"
Expand Down Expand Up @@ -162,6 +162,17 @@ const metadata = {
busy: {
type: Boolean,
},

/**
* Used to externally manipulate the role of the list
*
* @private
*/
_role: {
type: String,
defaultValue: "listbox",
noAttribute: true,
},
},
events: /** @lends sap.ui.webcomponents.main.List.prototype */ {

Expand Down Expand Up @@ -227,7 +238,7 @@ const metadata = {

/**
* Fired when selection is changed by user interaction
* in <code>SingleSelect</code> and <code>MultiSelect</code> modes.
* in <code>SingleSelect</code>, <code>SingleSelectBegin</code>, <code>SingleSelectEnd</code> and <code>MultiSelect</code> modes.
*
* @event
* @param {Array} selectedItems An array of the selected items.
Expand Down Expand Up @@ -624,6 +635,10 @@ class List extends UI5Element {
}
}

focusItem(item) {
item.focus();
}

setForwardingFocus(forwardingFocus) {
this._forwardingFocus = forwardingFocus;
}
Expand Down
8 changes: 6 additions & 2 deletions packages/main/src/ListItem.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
@touchend="{{_ontouchend}}"
@click="{{_onclick}}"
aria-selected="{{ariaSelected}}"
role="option"
role="{{_accInfo.role}}"
aria-expanded="{{_accInfo.ariaExpanded}}"
aria-level="{{_accInfo.ariaLevel}}"
>
{{> listItemPreContent}}

{{#if placeSelectionElementBefore}}
{{> selectionElement}}
{{/if}}
Expand All @@ -40,7 +44,7 @@
{{/if}}
</li>


{{#*inline "listItemPreContent"}}{{/inline}}
{{#*inline "listItemContent"}}{{/inline}}
{{#*inline "imageBegin"}}{{/inline}}
{{#*inline "iconBegin"}}{{/inline}}
Expand Down
8 changes: 8 additions & 0 deletions packages/main/src/ListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@ class ListItem extends ListItemBase {
return this.i18nBundle.getText(DELETE);
}

get _accInfo() {
return {
role: "option",
ariaExpanded: undefined,
ariaLevel: undefined,
};
}

static async onDefine() {
await Promise.all([
fetchI18nBundle("@ui5/webcomponents"),
Expand Down
29 changes: 29 additions & 0 deletions packages/main/src/Tree.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<ui5-list
.mode="{{mode}}"
.headerText="{{headerText}}"
.footerText="{{footerText}}"
.noDataText="{{noDataText}}"
._role="{{_role}}"
@ui5-itemClick="{{_onListItemClick}}"
@ui5-itemDelete="{{_onListItemDelete}}"
@ui5-selectionChange="{{_onListSelectionChange}}"
>
<slot name="header" slot="header"></slot>
{{#each _listItems}}
<ui5-li-tree
._id="{{this.treeItem._id}}"
type="Active"
level="{{this.level}}"
icon="{{this.treeItem.icon}}"
.treeItem="{{this.treeItem}}"
.expanded="{{this.treeItem.expanded}}"
.selected="{{this.treeItem.selected}}"
.showToggleButton="{{this.treeItem.requiresToggleButton}}"
@ui5-toggle="{{../_onListItemToggle}}"
@ui5-stepIn="{{../_onListItemStepIn}}"
@ui5-stepOut="{{../_onListItemStepOut}}"
>
{{this.treeItem.text}}
</ui5-li-tree>
{{/each}}
</ui5-list>
Loading