You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -56,7 +56,7 @@ import { withWebComponent } from '@ui5/webcomponents-react-base/dist/wrapper/wit
6
+
*
7
+
* __Note__: This is a UI5 Web Component! [Repository](https://github.com/SAP/ui5-webcomponents) | [Documentation](https://sap.github.io/ui5-webcomponents/)
@@ -6,6 +6,6 @@ import { withWebComponent } from '@ui5/webcomponents-react-base/dist/wrapper/wit
19
+
*
20
+
* __Note__: This is a UI5 Web Component! [Repository](https://github.com/SAP/ui5-webcomponents) | [Documentation](https://sap.github.io/ui5-webcomponents/)
@@ -6,6 +6,7 @@ import { withWebComponent } from '@ui5/webcomponents-react-base/dist/wrapper/wit
31
+
*
32
+
* __Note__: This is a UI5 Web Component! [Repository](https://github.com/SAP/ui5-webcomponents) | [Documentation](https://sap.github.io/ui5-webcomponents/)
Copy file name to clipboardExpand all lines: packages/compat/README.md
+67-5Lines changed: 67 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -14,15 +14,23 @@ Components in this package will not receive any new features. Only critical bugs
14
14
npm install @ui5/webcomponents-react-compat
15
15
```
16
16
17
-
## Importing Components
18
-
19
-
As the v1 `ui5-table` (`Table`) component is part of this package and some custom element names are equal to the new v2 `ui5-table`, importing components from the root (`import { Table } from "@ui5/webcomponents-react-compat"`) is discouraged.
20
-
The primary reason is that tree-shaking capabilities are limited in the default configurations of most bundlers in dev mode. As a result, custom elements for the v1 table will still be defined, even if only the `Toolbar` is imported. This can cause unexpected behavior if the v2 table is also used in the same app.
21
-
22
17
> ⚠️ **Warning:** It is not supported using the v1 `Table` and the v2 `Table` in the same application!
23
18
24
19
> ⚠️ **Warning:** Please only import components from this package via the file path!
25
20
21
+
## Compatibility
22
+
23
+
The legacy v1 (compat) `Table` and the modern v2 `Table` component and some subcomponents both register the same custom element names for `ui5-table`, `ui5-table-row` and `ui5-table-cell`, which will lead to conflicts when they coexist in the same application.
24
+
25
+
### Recommendation
26
+
27
+
We strongly recommend migrating fully to the v2 `Table`, especially if the `FilterBar` or `VariantManagement` component is used!
28
+
29
+
### Importing Components
30
+
31
+
Importing components from the root (`import { Toolbar } from "@ui5/webcomponents-react-compat"`) is discouraged.
32
+
The primary reason is that tree-shaking capabilities are limited in the default configurations of most bundlers in dev mode. As a result, custom elements for the v1 table will still be defined, even if only the `Toolbar` is imported. This can cause unexpected behavior if the v2 table is also used in the same app.
33
+
26
34
E.g.:
27
35
28
36
-`import { Table } from '@ui5/webcomponents-react-compat/dist/components/Table/index.js';`
@@ -36,6 +44,60 @@ Following are the imports of duplicate custom element names:
The `patch-compat-table` script (included in the `@ui5/webcomponents-react-cli` package) is developed to address specific compatibility issues that arise when using the legacy v1 Table component in conjunction with the `FilterBar` or `VariantManagement` components. These components internally rely on the v2 `Table`, and therefore conflicts will occur when using the v1 `Table`.
50
+
The script will change the custom element name by adding a `-v1` suffix (via `patch-package`) to all duplicate v1 table components.
51
+
52
+
> ⚠️ **Experimental**: This script is in experimental state and not subject to semantic versioning.
53
+
54
+
> ⚠️ **Temporary Solution:** This script is intended as a temporary workaround. It is strongly recommended to plan for a migration to the v2 Table component to ensure long-term compatibility and support.
55
+
56
+
<detailsstyle="cursor:auto;">
57
+
58
+
<summary><h4style="display: inline; margin: 0; font-size:18px; cursor:pointer;">Using the script</h4></summary>
59
+
60
+
<br />
61
+
62
+
**What it does**
63
+
64
+
<p>The script patches the `@ui5/webcomponents-compat` and `@ui5/webcomponents-react-compat` table component and subcomponents components and subcomponents to render with a different custom element name (tag name) compared to the v2 implementation.
65
+
This is done internally using [patch-package](https://github.com/ds300/patch-package) to adjust the implementation in the **node_modules**.</p>
66
+
67
+
**How to use**
68
+
69
+
<p>**Install** the `@ui5/webcomponents-react-cli` and `@ui5/webcomponents-compat` packages:</p>
70
+
71
+
```
72
+
// install `@ui5/webcomponents-compat` explicitly
73
+
npm i @ui5/webcomponents-react-cli @ui5/webcomponents-compat
74
+
```
75
+
76
+
<p>**Run** the script:</p>
77
+
78
+
```
79
+
// ui5-wcr is an executable added by the `@ui5/webcomponents-react-cli` package
80
+
ui5-wcr patch-compat-table
81
+
```
82
+
83
+
<p>The `ui5-wcr` executable is provided by the `@ui5/webcomponents-react-cli` package. The `patch-compat-table` command applies the necessary patches.</p>
84
+
85
+
<p>**Recommendation:**</p>
86
+
87
+
<p>Add the script as `postinstall` script in the `package.json`, so it runs after every module update.</p>
88
+
89
+
```
90
+
{
91
+
"//": "rest of your applications package.json",
92
+
"scripts": {
93
+
"//": "your other scripts",
94
+
"postinstall": "ui5-wcr patch-compat-table"
95
+
}
96
+
}
97
+
```
98
+
99
+
</details>
100
+
39
101
## Documentation
40
102
41
103
You can find an interactive documentation in our [Storybook](https://sap.github.io/ui5-webcomponents-react/) (Legacy Components).
0 commit comments