Skip to content

Commit

Permalink
Merge branch 'master' into input-typeahead
Browse files Browse the repository at this point in the history
  • Loading branch information
ndeshev committed May 25, 2022
2 parents d1341f9 + 8ef6289 commit 1a45258
Show file tree
Hide file tree
Showing 119 changed files with 2,088 additions and 426 deletions.
4 changes: 3 additions & 1 deletion docs/4-frameworks/01-React.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

In this tutorial, you will learn how to add UI5 Web Components to your application. You can add UI5 Web Components both to new React applications and to already existing ones.

In order to have a better development experience, we would recommend you take a look at our dedicated wrapper for UI5 Web Components in React, [UI5 Web Components for React](https://github.com/SAP/ui5-webcomponents-react) and check out [their tutorial](https://developers.sap.com/mission.react-spa.html) as well.
**Important:** The get the best development experience, we recommend using the [UI5 Web Components for React](https://github.com/SAP/ui5-webcomponents-react) and follow the [UI5 Web Components for React Тutorial](https://developers.sap.com/mission.react-spa.html). UI5 Web Components for React library is a React implementation of UI5 Web Components which overcomes several limitations of React in handling web components in general, explained in the "Additional Info" section below.

Here are the steps to use pure UI5 Web Components in React:

### Step 1. Create a new application. For example, with `create-react-app`.

Expand Down
2 changes: 1 addition & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@buxlabs/amd-to-es6": "0.16.1",
"@openui5/sap.ui.core": "1.101.0",
"@ui5/webcomponents-tools": "1.3.1",
"chromedriver": "100.0.0",
"chromedriver": "101.0.0",
"clean-css": "^5.2.2",
"copy-and-watch": "^0.1.5",
"cross-env": "^7.0.3",
Expand Down
8 changes: 6 additions & 2 deletions packages/base/src/asset-registries/Themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ const getThemeProperties = async (packageName, themeName) => {

if (!registeredThemes.has(themeName)) {
const regThemesStr = [...registeredThemes.values()].join(", ");
console.warn(`You have requested a non-registered theme - falling back to ${DEFAULT_THEME}. Registered themes are: ${regThemesStr}`); /* eslint-disable-line */
return themeStyles.get(`${packageName}_${DEFAULT_THEME}`);
console.warn(`You have requested a non-registered theme ${themeName} - falling back to ${DEFAULT_THEME}. Registered themes are: ${regThemesStr}`); /* eslint-disable-line */
return _getThemeProperties(packageName, DEFAULT_THEME);
}

return _getThemeProperties(packageName, themeName);
};

const _getThemeProperties = async (packageName, themeName) => {
const loader = loaders.get(`${packageName}/${themeName}`);
if (!loader) {
// no themes for package
Expand Down
2 changes: 0 additions & 2 deletions packages/base/src/features/F6Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class F6Navigation {
}

async _keydownHandler(event) {
event.preventDefault();

if (isF6Next(event)) {
this.updateGroups();
if (this.groups.length < 1) {
Expand Down
11 changes: 11 additions & 0 deletions packages/base/test/specs/Theming.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,15 @@ describe("Theming works", () => {
assert.strictEqual(res, true, "Theme parameters changed");
});

it("Tests fallback to default theme when setting unknown theme", async () => {
const unknownTheme = 'sap_unknown_theme';
await browser.url(`http://localhost:9191/test-resources/pages/AllTestElements.html?sap-ui-theme=${unknownTheme}`);

const res = await browser.executeAsync( async (done) => {
const cssVarValue = getComputedStyle(document.documentElement).getPropertyValue('--var1');
done(cssVarValue);
});

assert.strictEqual(res, ' red', "Default theme parameters loaded");
});
});
2 changes: 1 addition & 1 deletion packages/fiori/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
},
"devDependencies": {
"@ui5/webcomponents-tools": "1.3.1",
"chromedriver": "100.0.0"
"chromedriver": "101.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/fiori/src/themes/Page.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:host(:not([hidden])) {
width: 100%;
height: 100%;
display: inline-block;
display: block;
}

.ui5-page-root {
Expand Down
2 changes: 1 addition & 1 deletion packages/icons-business-suite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
},
"devDependencies": {
"@ui5/webcomponents-tools": "1.3.1",
"chromedriver": "100.0.0"
"chromedriver": "101.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/icons-tnt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
},
"devDependencies": {
"@ui5/webcomponents-tools": "1.3.1",
"chromedriver": "100.0.0"
"chromedriver": "101.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
},
"devDependencies": {
"@ui5/webcomponents-tools": "1.3.1",
"chromedriver": "100.0.0"
"chromedriver": "101.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/localization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"devDependencies": {
"@openui5/sap.ui.core": "1.101.0",
"@ui5/webcomponents-tools": "1.3.1",
"chromedriver": "100.0.0",
"chromedriver": "101.0.0",
"mkdirp": "^1.0.4",
"resolve": "^1.20.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
},
"devDependencies": {
"@ui5/webcomponents-tools": "1.3.1",
"chromedriver": "100.0.0"
"chromedriver": "101.0.0"
}
}
5 changes: 2 additions & 3 deletions packages/main/src/Breadcrumbs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@

{{#if _endsWithCurrentLocationLabel}}
<li class="ui5-breadcrumbs-current-location" @click="{{../_onLabelPress}}">
<span aria-label="{{_currentLocationAccName}}" role="link" id="{{this._id}}-labelWrapper">
<ui5-label
aria-current="page">
<span aria-current="page" aria-label="{{_currentLocationAccName}}" role="link" id="{{this._id}}-labelWrapper">
<ui5-label>
{{_currentLocationText}}
</ui5-label>
</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class Calendar extends CalendarPart {

const yearFormat = DateFormat.getDateInstance({ format: "y", calendarType: this.primaryCalendarType });
const localeData = getCachedLocaleDataInstance(getLocale());
this._headerMonthButtonText = localeData.getMonths("wide", this.primaryCalendarType)[this._calendarDate.getMonth()];
this._headerMonthButtonText = localeData.getMonthsStandAlone("wide", this.primaryCalendarType)[this._calendarDate.getMonth()];

if (this._currentPicker === "year") {
const rangeStart = new CalendarDate(this._calendarDate, this._primaryCalendarType);
Expand Down
77 changes: 68 additions & 9 deletions packages/main/src/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ const metadata = {
* <br>
*
* To browse all available icons, see the
* <ui5-link target="_blank" href="https://openui5.hana.ondemand.com/test-resources/sap/m/demokit/iconExplorer/webapp/index.html" class="api-table-content-cell-link">Icon Explorer</ui5-link>.
* <ui5-link target="_blank" href="https://openui5.hana.ondemand.com/test-resources/sap/m/demokit/iconExplorer/webapp/index.html" class="api-table-content-cell-link">SAP Icons</ui5-link>,
* <ui5-link target="_blank" href="https://openui5.hana.ondemand.com/test-resources/sap/m/demokit/iconExplorer/webapp/index.html#/overview/SAP-icons-TNT" class="api-table-content-cell-link">SAP Fiori Tools</ui5-link> and
* <ui5-link target="_blank" href="https://openui5.hana.ondemand.com/test-resources/sap/m/demokit/iconExplorer/webapp/index.html" class="api-table-content-cell-link">SAP Business Suite</ui5-link> collections.
* <br>
*
* Example:
Expand All @@ -52,6 +54,15 @@ const metadata = {
* Example:
* <br>
* <code>name='tnt/antenna'</code>, <code>name='tnt/actor'</code>, <code>name='tnt/api'</code>.
* <br><br>
*
* <b>Note:</b> To use the SAP Business Suite icons,
* you need to set the <code>business-suite</code> prefix in front of the icon's name.
* <br>
*
* Example:
* <br>
* <code>name='business-suite/3d'</code>, <code>name='business-suite/1x2-grid-layout'</code>, <code>name='business-suite/4x4-grid-layout'</code>.
* @type {string}
* @defaultvalue ""
* @public
Expand Down Expand Up @@ -162,30 +173,78 @@ const metadata = {
*
* The <code>ui5-icon</code> component represents an SVG icon.
* There are two main scenarios how the <code>ui5-icon</code> component is used:
* as a purely decorative element; or as a visually appealing clickable area in the form of an icon button.
* as a purely decorative element, <br>
* or as an interactive element that can be focused and clicked.
*
* <h3>Usage</h3>
*
* 1. <b>Get familiar with the icons collections.</b>
* <br>
* Before displaying an icon, you need to explore the icons collections to find and import the desired icon.
* <br>
* Currently there are 3 icons collection, available as 3 npm packages:
* <br>
*
* <ul>
* <li>
* <ui5-link target="_blank" href="https://www.npmjs.com/package/@ui5/webcomponents-icons" class="api-table-content-cell-link">@ui5/webcomponents-icons</ui5-link> represents the "SAP-icons" collection and includes the following
* <ui5-link target="_blank" href="https://openui5.hana.ondemand.com/test-resources/sap/m/demokit/iconExplorer/webapp/index.html#/overview/SAP-icons" class="api-table-content-cell-link">icons</ui5-link>.
* </li>
* <li>
* <ui5-link target="_blank" href="https://www.npmjs.com/package/@ui5/webcomponents-icons-tnt" class="api-table-content-cell-link">@ui5/webcomponents-icons-tnt</ui5-link> represents the "tnt" collection and includes the following
* <ui5-link target="_blank" href="https://openui5.hana.ondemand.com/test-resources/sap/m/demokit/iconExplorer/webapp/index.html#/overview/SAP-icons-TNT" class="api-table-content-cell-link">icons</ui5-link>.
* </li>
* <li>
* <ui5-link target="_blank" href="https://www.npmjs.com/package/@ui5/webcomponents-icons-business-suite" class="api-table-content-cell-link">@ui5/webcomponents-icons-icons-business-suite</ui5-link> represents the "business-suite" collection and includes the following
* <ui5-link target="_blank" href="https://sapui5.hana.ondemand.com/test-resources/sap/m/demokit/iconExplorer/webapp/index.html#/overview/BusinessSuiteInAppSymbols" class="api-table-content-cell-link">icons</ui5-link>.
* </li>
* </ul>
*
* 2. <b>After exploring the icons collections, add one or more of the packages as dependencies to your project.</b>
* <br>
* <code>npm i @ui5/webcomponents-icons</code><br>
* <code>npm i @ui5/webcomponents-icons-tnt</code><br>
* <code>npm i @ui5/webcomponents-icons-business-suite</code>
* <br><br>
* A large set of built-in icons is available
* and they can be used by setting the <code>name</code> property on the <code>ui5-icon</code>.
* But before using an icon, you need to import the desired icon.
*
* 3. <b>Then, import the desired icon</b>.
* <br>
* <code>import "@ui5/{package_name}/dist/{icon_name}.js";</code>
* <br><br>
*
* For the standard icon collection, you have to import an icon from the <code>@ui5/webcomponents-icons</code> package:
* <b>For Example</b>:
* <br>
* <code>import "@ui5/webcomponents-icons/dist/employee.js";</code>
*
* For the standard "SAP-icons" icon collection, import an icon from the <code>@ui5/webcomponents-icons</code> package:
* <br>
* <code>import "@ui5/webcomponents-icons/dist/employee.js";</code>
* <br><br>
*
* For the SAP Fiori Tools icon collection (supported since 1.0.0-rc.10), you have to import an icon from the <code>@ui5/webcomponents-icons-tnt</code> package:
* For the "tnt" (SAP Fiori Tools) icon collection, import an icon from the <code>@ui5/webcomponents-icons-tnt</code> package:
* <br>
* <code>import "@ui5/webcomponents-icons-tnt/dist/antenna.js";</code>
* <br><br>
*
* For the "business-suite" (SAP Business Suite) icon collection, import an icon from the <code>@ui5/webcomponents-icons-business-suite</code> package:
* <br>
* <code>import "@ui5/webcomponents-icons-business-suite/dist/ab-testing.js";</code>
* <br><br>
*
* 4. <b>Display the icon using the <code>ui5-icon</code> web component.</b><br>
* Set the icon collection ("SAP-icons", "tnt" or "business-suite" - "SAP-icons" is the default icon collection and can be skipped)<br>
* and the icon name to the <code>name</code> property.
* <br><br>
*
* <code>&lt;ui5-icon name="employee">&lt;/ui5-icon></code><br>
* <code>&lt;ui5-icon name="tnt/antenna">&lt;/ui5-icon></code><br>
* <code>&lt;ui5-icon name="business-suite/ab-testing">&lt;/ui5-icon></code>
*
* <h3>Keyboard Handling</h3>
*
* <ul>
* <li>[SPACE, ENTER, RETURN] - Fires the <code>click</code> event if the <code>interactive</code> property is set to true.</li>
* <li>[SHIFT] - If [SPACE] or [ENTER],[RETURN] is pressed, pressing [SHIFT] releases the ui5-icon without triggering the click event.</li>
* </ul>
* <br><br>
*
* <h3>ES6 Module Import</h3>
*
Expand Down
19 changes: 12 additions & 7 deletions packages/main/src/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ const metadata = {
* Defines whether the value will be autcompleted to match an item
*
* @type {boolean}
* @defaultvalue true
* @defaultvalue false
* @public
* @since 1.4.0
*/
disableAutocomplete: {
noTypeahead: {
type: Boolean,
},

Expand Down Expand Up @@ -321,7 +321,8 @@ const metadata = {

/**
* Sets the maximum number of characters available in the input field.
*
* <br><br>
* <b>Note:</b> This property is not compatible with the ui5-input type InputType.Number. If the ui5-input type is set to Number, the maxlength value is ignored.
* @type {Integer}
* @since 1.0.0-rc.5
* @public
Expand Down Expand Up @@ -689,12 +690,12 @@ class Input extends UI5Element {

// Keep the original typed in text intact
this.valueBeforeAutoComplete += value.slice(this.valueBeforeAutoComplete.length, value.length);
this._autocomplete(item, value);
this._handleTypeAhead(item, value);
}
}

async onAfterRendering() {
if (this.Suggestions) {
if (this.Suggestions && this.showSuggestions) {
this.Suggestions.toggle(this.open, {
preventFocusRestore: true,
});
Expand All @@ -711,7 +712,7 @@ class Input extends UI5Element {

_onkeydown(event) {
this._isKeyNavigation = true;
this._shouldAutocomplete = !this.disableAutocomplete && !(isBackSpace(event) || isDelete(event) || isEscape(event));
this._shouldAutocomplete = !this.noTypeahead && !(isBackSpace(event) || isDelete(event) || isEscape(event));

if (isUp(event)) {
return this._handleUp(event);
Expand Down Expand Up @@ -1077,7 +1078,7 @@ class Input extends UI5Element {
}
}

_autocomplete(item, filterValue) {
_handleTypeAhead(item, filterValue) {
if (!item) {
return;
}
Expand Down Expand Up @@ -1219,8 +1220,12 @@ class Input extends UI5Element {
*/
updateValueOnPreview(item) {
const noPreview = item.type === "Inactive" || item.group;
const innerInput = this.getInputDOMRefSync();
const itemValue = noPreview ? this.valueBeforeItemPreview : (item.effectiveTitle || item.textContent);

this.value = itemValue;
innerInput.value = itemValue;
innerInput.setSelectionRange(this.valueBeforeAutoComplete.length, this.value.length);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ const metadata = {
/**
* Fired when the <code>Close</code> button of any item is clicked
* <br><br>
* <b>Note:</b> This event is applicable to <code>ui5-li-notification</code> items only,
* <b>Note:</b> This event is only applicable to list items that can be closed (such as notification list items),
* not to be confused with <code>item-delete</code>.
*
* @event sap.ui.webcomponents.main.List#item-close
Expand All @@ -302,7 +302,7 @@ const metadata = {
/**
* Fired when the <code>Toggle</code> button of any item is clicked.
* <br><br>
* <b>Note:</b> This event is applicable to <code>ui5-li-notification-group</code> items only.
* <b>Note:</b> This event is only applicable to list items that can be toggled (such as notification group list items).
*
* @event sap.ui.webcomponents.main.List#item-toggle
* @param {HTMLElement} item the toggled item.
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/MonthPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class MonthPicker extends CalendarPart {
}

const localeData = getCachedLocaleDataInstance(getLocale());
const monthsNames = localeData.getMonths("wide", this._primaryCalendarType);
const monthsNames = localeData.getMonthsStandAlone("wide", this._primaryCalendarType);

const months = [];
const calendarDate = this._calendarDate; // store the value of the expensive getter
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/MultiComboBox.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
aria-autocomplete="both"
aria-describedby="{{ariaDescribedByText}}"
aria-required="{{required}}"
aria-label="{{ariaLabelText}}"
/>

{{#if icon}}
Expand Down
Loading

0 comments on commit 1a45258

Please sign in to comment.