Skip to content

Commit e9d8395

Browse files
committed
OpenUI5 Documentation Update 02.02.2024
1 parent 957b662 commit e9d8395

3 files changed

+20
-19
lines changed

docs/Best_Practices_for_Developers_28fcd55.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ Some APIs may be only partially deprecated, for instance passing a non-object `v
9090

9191
- Use `sap.ui.require` for requiring an existing module.
9292

93-
- Add only valid module IDs from the API Reference \(documented as `Module: .../.../..`\) to the dependency list. For example, use `sap/m/library` for `sap/m/SortOrder`, and require `sap/ui/model/FilterType` as it's a genuine module \(`Module: sap/ui/model/FilterType`\).
93+
- Add only valid module IDs from the API Reference \(documented as Module: .../.../..\) to the dependency list. For example, use `sap/m/library` for the enum type `sap.ui.core.SortOrder`.
94+
95+
For the enum type `sap.ui.model.Filter`, however, require `sap/ui/model/FilterType` as it's a genuine module \(Module: `sap/ui/model/FilterType`\).
9496

9597

9698
<table>
@@ -135,7 +137,7 @@ Some APIs may be only partially deprecated, for instance passing a non-object `v
135137
```js
136138
sap.ui.define([
137139
"sap/m/library", // target use: SortOrder
138-
"sap/ui/model/FilterType" // remains same
140+
"sap/ui/model/FilterType", // remains same
139141
"sap/ui/layout/form/SimpleForm"
140142
], (sapMLib, FilterType, SimpleForm) => {
141143
"use strict";
@@ -167,7 +169,7 @@ Some APIs may be only partially deprecated, for instance passing a non-object `v
167169

168170
**Third-Party Libraries**
169171

170-
When requiring third-party libraries that export global names and support AMD at the same time, ensure having a `shim` with `amd:true` defined via [`sap.ui.loader.config`](https://sdk.openui5.org/api/sap.ui.loader%23methods/sap.ui.loader.config) beforehand. Use the required module value instead of the global name of the third-party lib.
172+
When requiring third-party libraries that export global names and support AMD at the same time, ensure having a `shim` with `amd:true` defined via [`sap.ui.loader.config`](https://sdk.openui5.org/api/sap.ui.loader%23methods/sap.ui.loader.config) beforehand. Use the required module value instead of the global name of the third-party library.
171173

172174
**Troubleshooting**
173175

@@ -190,7 +192,7 @@ In the following we'll focus on crucial aspects of app development, specifically
190192
#### Asynchronous Loading
191193
192194
- Use asynchronous loading for views, fragments, and components to enhance performance; see, for example, [Legacy Factories Replacement](Legacy_Factories_Replacement_491bd9c.md).
193-
- Implement the `sap.ui.core.IAsyncContentCreation` marker interface in your [Component.js File](Component_js_File_27ce0e4.md) to allow the content to be created fully asynchronously and for a stricter handling of certain types of errors during its view processing.
195+
- Implement the `sap.ui.core.IAsyncContentCreation` marker interface in your [Component.js file](Component_js_File_27ce0e4.md) to allow the content to be created fully asynchronously and for a stricter handling of certain types of errors during its view processing.
194196
- Load libraries via the new asynchronous APIs in advance before accessing code. Ensure that dependent librares are preloaded through the `manifest.json` in the `sap.ui5/dependencies/libs` section if not already maintained there. For more information, see [Ensure that Library Preloads are Enabled](Performance_Speed_Up_Your_App_408b40e.md#loio408b40efed3c416681e1bd8cdd8910d4__section_LibraryPreloads).
195197
196198
**Additional Information:**
@@ -253,7 +255,7 @@ When creating instances of OpenUI5 controls programmatically \(i.e. not declarat
253255
254256
- Don't use the section `sap.ui5/resources/js` as it's deprecated. Use regular dependencies in the `Component.js` file instead.
255257
256-
- Unless the component intends to load specific OpenUI5 libs manually on demand, avoid adding `{ lazy: true }` to the `sap.ui5/dependencies/libs` section.
258+
- Unless the component intends to load specific OpenUI5 libraries manually on demand, avoid adding `{ lazy: true }` to the `sap.ui5/dependencies/libs` section.
257259
258260
259261
**Dependency Management**
@@ -285,7 +287,7 @@ Prevent bundling modules \(`Component-preload.js`\) into strings.
285287

286288
- Use the `loadFragment` method of the `sap.ui.core.mvc.Controller` to load fragments asynchronously.
287289

288-
- XML Templating: Don't use global names. Ensure that the target function or object is defined as a module and require the defined module via [`core:require` in the XML](Require_Modules_in_XML_View_and_Fragment_b11d853.md). Use `template:require` if the XML content needs preprocessing.
290+
- Don't use global names in your XML. Ensure that the target function or object is defined as a module and require the defined module via [`core:require` in the XML](Require_Modules_in_XML_View_and_Fragment_b11d853.md). Use `template:require` if the XML content needs preprocessing.
289291
290292
291293
**Additional Information:**
@@ -349,13 +351,11 @@ Implement strict error handling to address critical issues.
349351

350352
- Ensure a dependency on the renderer or embed it within the control class.
351353

352-
- Migrate to the rendering `apiVersion 2` or `apiVersion 4`.
354+
- Migrate to the rendering `apiVersion 2` or `apiVersion 4`.For more information, see the [API Reference](https://sdk.openui5.org/api/sap.ui.core.RenderManager%23overview) .
353355

354356
- When utilizing [`RenderManager#icon`](https://sdk.openui5.org/api/sap.ui.core.RenderManager%23methods/icon) during rendering, include a dependency to `sap/ui/core/IconPool` in your code.
355357

356-
- Don't use `Control.prototype.rerender` to rerender a control as it's deprecated. Use [`Control.prototype.invalidate`](https://sdk.openui5.org/api/sap.ui.core.Control%23methods/invalidate) instead.
357-
358-
- If you want to be informed once a control's rerendering is triggered, override `Control.prototype.invalidate`.
358+
- Don't use `Control#rerender` to rerender a control as it's deprecated. Use [`Control#invalidate`](https://sdk.openui5.org/api/sap.ui.core.Control%23methods/invalidate) instead.
359359

360360

361361
**Additional Information:**
@@ -373,7 +373,7 @@ Implement strict error handling to address critical issues.
373373

374374
#### Library Dependency and Init
375375

376-
- Don't use `sap.ui.getCore().initLibrary` to initialize the library as it's deprecated. Use the import of `sap/ui/core/Lib.js` and call its [`Lib.init()`](https://sdk.openui5.org/api/sap.ui.core.Lib%23methods/sap.ui.core.Lib.init) instead.
376+
- Don't use `sap.ui.getCore().initLibrary` to initialize the library as it's deprecated. Use the import of `sap/ui/core/Lib` and call its [`Lib.init()`](https://sdk.openui5.org/api/sap.ui.core.Lib%23methods/sap.ui.core.Lib.init) instead.
377377

378378
- Don't use the global namespace of the library to add types. Use the return value of `Lib.init` instead to add them.
379379
@@ -383,7 +383,7 @@ Implement strict error handling to address critical issues.
383383
384384
- Define the `appData/manifest/i18n` section in the `.library` file or the `sap.app/i18n` section in the `manifest.json`, so that the framework can load resource bundles in advance.
385385
386-
- Properly define library dependencies in all places where it is required.
386+
- Properly define library dependencies in all places where it is required. For more information, see [Dependencies to Libraries](Descriptor_Dependencies_to_Libraries_and_Components_8521ad1.md#loio8521ad1955f340f9a6207d615c88d7fd__section_DEPLIB)
387387
388388
389389
**Additional Information:**
@@ -396,12 +396,11 @@ Implement strict error handling to address critical issues.
396396
397397
#### Bundling
398398
399-
- Prevent bundling modules \(`Component-preload.js`\) into strings.
400-
401-
- Avoid generating the application bundle with an outdated standard Grunt task. Leverage UI5 Tooling to build the bundle.
399+
Prevent bundling modules \(`Component-preload.js`\) into strings.
402400
403-
- Avoid declaring `var`, `let`, or `const` in the global scope above `sap.ui.define`.
401+
- Avoid generating the application bundle with an outdated standard Grunt task. Leverage UI5 Tooling to build the bundle.
404402
403+
- Avoid declaring `var`, `let`, or `const` in the global scope above `sap.ui.define`.
405404
406405
- For third-party libraries, set `requiresTopLevelScope="false"` to the `/library/appData/packaging/raw-module` tag within the `.library` file, **provided that** the third-party library is allowed to be bundled together and does not require access to the global scope. Otherwise, consider [excluding the third-party library from the bundle](https://sap.github.io/ui5-tooling/v3/pages/Configuration/#excludes_1).
407406

docs/Dates_Times_Timestamps_and_Time_Zones_6c9e61d.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ When talking about dates, times, or timestamps, we'll use the following definiti
2424
> - `Date#getTime` returns a timestamp and not a time in our terminology,
2525
> - `Date#getDate` returns only the day of a date and not the entire date.
2626
27-
The intermediate client-side processing of these entities typically uses the JavaScript `Date` object, which represents a timestamp. This may cause issues if dates are used and time zone handling comes into play. Typically, timestamps are displayed in the time zone of the browser. It is also possible to display a timestamp in a different time zone, for example in the `America/New_York` time zone, by using [`sap.ui.model.odata.type.DateTimeWithTimezone`](https://sdk.openui5.org/api/sap.ui.model.odata.type.DateTimeWithTimezone) or [`sap.ui.core.format.DateFormat.getDateTimeWithTimezoneInstance`](https://sdk.openui5.org/api/sap.ui.core.format.DateFormat.getDateTimeWithTimezoneInstance).
27+
The intermediate client-side processing of these entities typically uses the JavaScript `Date` object, which represents a timestamp. This may cause issues if dates are used and time zone handling comes into play. Typically, timestamps are displayed in the time zone of the browser. It is also possible to display a timestamp in a different time zone, for example in the `America/New_York` time zone, by using [`sap.ui.model.odata.type.DateTimeWithTimezone`](https://sdk.openui5.org/api/sap.ui.model.odata.type.DateTimeWithTimezone) or [`sap.ui.core.format.DateFormat.getDateTimeWithTimezoneInstance`](https://sdk.openui5.org/api/sap.ui.core.format.DateFormat%23methods/sap.ui.core.format.DateFormat.getDateTimeWithTimezoneInstance).
2828

29-
For testing purposes, you can use the `sap-timezone` URL parameter to switch from the browser's time zone to any provided time zone. For example, with `?sap-timezone=Pacific/Honolulu` the Honolulu time zone \(GMT-10:00\), and with `?sap-timezone=Pacific/Kiritimati` the Kiritimati time zone \(GMT+14:00\) is used for formatting and parsing timestamps, except for the timestamps that are formatted or parsed with [`sap.ui.model.odata.type.DateTimeWithTimezone`](https://sdk.openui5.org/api/sap.ui.model.odata.type.DateTimeWithTimezone) or [`sap.ui.core.format.DateFormat.getDateTimeWithTimezoneInstance`](https://sdk.openui5.org/api/sap.ui.core.format.DateFormat.getDateTimeWithTimezoneInstance).
29+
For testing purposes, you can use the `sap-timezone` URL parameter to switch from the browser's time zone to any provided time zone. For example, with `?sap-timezone=Pacific/Honolulu` the Honolulu time zone \(GMT-10:00\), and with `?sap-timezone=Pacific/Kiritimati` the Kiritimati time zone \(GMT+14:00\) is used for formatting and parsing timestamps, except for the timestamps that are formatted or parsed with [`sap.ui.model.odata.type.DateTimeWithTimezone`](https://sdk.openui5.org/api/sap.ui.model.odata.type.DateTimeWithTimezone) or [`sap.ui.core.format.DateFormat.getDateTimeWithTimezoneInstance`](https://sdk.openui5.org/api/sap.ui.core.format.DateFormat%23methods/sap.ui.core.format.DateFormat.getDateTimeWithTimezoneInstance).
3030

3131
> ### Caution:
3232
> If you use a configured time zone, **your application may break** if it uses the JavaScript `Date` object in combination with functions that use the local browser time zone, for example `oDate.getHours()` or `oDate.getDate()`. To avoid such issues, we strongly recommend the following approach:
3333
>
3434
> - Use data binding with the corresponding OpenUI5 OData types wherever possible in your application.
35-
> - Always use [`UI5Date.getInstance`](https://sdk.openui5.org/api/module:sap/ui/core/date/UI5Date/methods/sap/ui/core/date/UI5Date.getInstance) to create new date instances. For more information, see the [UI5Date section](Dates_Times_Timestamps_and_Time_Zones_6c9e61d.md#loio6c9e61dc157a40c19460660ece8368bc__section_ui5date) below.
35+
> - Always use [`UI5Date.getInstance`](https://sdk.openui5.org/api/module:sap/ui/core/date/UI5Date%23methods/sap/ui/core/date/UI5Date.getInstance) to create new date instances. For more information, see the [UI5Date section](Dates_Times_Timestamps_and_Time_Zones_6c9e61d.md#loio6c9e61dc157a40c19460660ece8368bc__section_ui5date) below.
3636
3737
This topic describes the different OData Edm types and the corresponding OpenUI5 data type, how to display timestamps in a specific time zone, a list of best practices for handling timestamps, dates, and times in OpenUI5, and a list of common pitfalls.
3838

docs/Descriptor_Dependencies_to_Libraries_and_Components_8521ad1.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ The performance-relevant attributes have been introduced with the version 3 of t
1616

1717
***
1818

19+
<a name="loio8521ad1955f340f9a6207d615c88d7fd__section_DEPLIB"/>
20+
1921
### Dependencies to Libraries
2022

2123
The following dependencies to libraries can be implemented:

0 commit comments

Comments
 (0)