From 6691958d6b5ec2afafc49fc784e62b055e3c56fc Mon Sep 17 00:00:00 2001
From: Lukas Harbarth 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.
+This is done internally using [patch-package](https://github.com/ds300/patch-package) to adjust the implementation in the **node_modules**. **Install** the `@ui5/webcomponents-react-cli` and `@ui5/webcomponents-compat` packages: **Run** the script: The `ui5-wcr` executable is provided by the `@ui5/webcomponents-react-cli` package. The `patch-compat-table` command applies the necessary patches. **Recommendation:** Add the script as `postinstall` script in the `package.json`, so it runs after every module update. 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.
-This is done internally using [patch-package](https://github.com/ds300/patch-package) to adjust the implementation in the **node_modules**.
+
+
diff --git a/packages/cli/README.md b/packages/cli/README.md
index c5f82d70c84..a3398f087e3 100644
--- a/packages/cli/README.md
+++ b/packages/cli/README.md
@@ -16,6 +16,7 @@ You can find an interactive documentation in our [Storybook](https://sap.github.
- [Wrapper generation](https://sap.github.io/ui5-webcomponents-react/v2/?path=/docs/knowledge-base-bring-your-own-web-components--docs)
- [Code-mod](https://sap.github.io/ui5-webcomponents-react/v2/?path=/docs/migration-guide--docs#codemod)
+- [Patch compatibility table](https://sap.github.io/ui5-webcomponents-react/v2/?path=/docs/legacy-components-docs--docs#experimental-patch-script)
## Contribute
diff --git a/packages/cli/package.json b/packages/cli/package.json
index f41a00e19cc..63b18a46bae 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -29,9 +29,12 @@
"access": "public"
},
"files": [
- "dist"
+ "dist",
+ "patches"
],
"dependencies": {
- "dedent": "1.6.0"
+ "dedent": "1.6.0",
+ "execa": "^9.5.3",
+ "patch-package": "^8.0.0"
}
}
diff --git a/packages/cli/patches/@ui5+webcomponents-compat+2.10.0.patch b/packages/cli/patches/@ui5+webcomponents-compat+2.10.0.patch
new file mode 100644
index 00000000000..83cd8a14d6e
--- /dev/null
+++ b/packages/cli/patches/@ui5+webcomponents-compat+2.10.0.patch
@@ -0,0 +1,130 @@
+diff --git a/node_modules/@ui5/webcomponents-compat/dist/Table.js b/node_modules/@ui5/webcomponents-compat/dist/Table.js
+index f72d58f..0c0cde5 100644
+--- a/node_modules/@ui5/webcomponents-compat/dist/Table.js
++++ b/node_modules/@ui5/webcomponents-compat/dist/Table.js
+@@ -653,14 +653,14 @@ let Table = Table_1 = class Table extends UI5Element {
+ });
+ }
+ getRowParent(child) {
+- if (child.hasAttribute("ui5-table-row")) {
++ if (child.hasAttribute("ui5-table-row-v1")) {
+ return child;
+ }
+ const parent = child.parentElement;
+ if (!parent) {
+ return;
+ }
+- if (parent.hasAttribute("ui5-table-row")) {
++ if (parent.hasAttribute("ui5-table-row-v1")) {
+ return parent;
+ }
+ return this.getRowParent(parent);
+@@ -867,7 +867,7 @@ __decorate([
+ ], Table, "i18nBundle", void 0);
+ Table = Table_1 = __decorate([
+ customElement({
+- tag: "ui5-table",
++ tag: "ui5-table-v1",
+ fastNavigation: true,
+ styles: tableStyles,
+ renderer: jsxRenderer,
+diff --git a/node_modules/@ui5/webcomponents-compat/dist/TableCell.js b/node_modules/@ui5/webcomponents-compat/dist/TableCell.js
+index dd6e17f..c9fce9d 100644
+--- a/node_modules/@ui5/webcomponents-compat/dist/TableCell.js
++++ b/node_modules/@ui5/webcomponents-compat/dist/TableCell.js
+@@ -67,7 +67,7 @@ __decorate([
+ ], TableCell, "i18nBundle", void 0);
+ TableCell = TableCell_1 = __decorate([
+ customElement({
+- tag: "ui5-table-cell",
++ tag: "ui5-table-cell-v1",
+ renderer: jsxRenderer,
+ template: TableCellTemplate,
+ styles: tableCellStyles,
+diff --git a/node_modules/@ui5/webcomponents-compat/dist/TableRow.js b/node_modules/@ui5/webcomponents-compat/dist/TableRow.js
+index 8fa9936..aac526b 100644
+--- a/node_modules/@ui5/webcomponents-compat/dist/TableRow.js
++++ b/node_modules/@ui5/webcomponents-compat/dist/TableRow.js
+@@ -94,7 +94,7 @@ let TableRow = TableRow_1 = class TableRow extends UI5Element {
+ const itemActive = this.type === TableRowType.Active;
+ const isSingleSelect = this.isSingleSelect;
+ const itemSelectable = isSingleSelect || this.isMultiSelect;
+- const isRowFocused = this._activeElementHasAttribute("ui5-table-row");
++ const isRowFocused = this._activeElementHasAttribute("ui5-table-row-v1");
+ const target = e.target;
+ const checkboxPressed = target.classList.contains("ui5-multi-select-checkbox");
+ const rowElements = Array.from(this.shadowRoot.querySelectorAll("tr") || []);
+@@ -137,7 +137,7 @@ let TableRow = TableRow_1 = class TableRow extends UI5Element {
+ this.deactivate();
+ }
+ _onfocusin(e, forceSelfFocus = false) {
+- if (forceSelfFocus || this._activeElementHasAttribute("ui5-table-cell")) {
++ if (forceSelfFocus || this._activeElementHasAttribute("ui5-table-cell-v1")) {
+ this.root.focus();
+ this.activate();
+ }
+@@ -160,7 +160,7 @@ let TableRow = TableRow_1 = class TableRow extends UI5Element {
+ this._onfocusin(e, true /* force row focus */);
+ this.deactivate();
+ }
+- if (this._activeElementHasAttribute("ui5-table-row")) {
++ if (this._activeElementHasAttribute("ui5-table-row-v1")) {
+ if (this.isSingleSelect) {
+ this._handleSelection();
+ }
+@@ -322,7 +322,7 @@ __decorate([
+ ], TableRow, "i18nBundle", void 0);
+ TableRow = TableRow_1 = __decorate([
+ customElement({
+- tag: "ui5-table-row",
++ tag: "ui5-table-row-v1",
+ styles: tableRowStyles,
+ renderer: jsxRenderer,
+ template: TableRowTemplate,
+diff --git a/node_modules/@ui5/webcomponents-compat/dist/css/themes/TableRow.css b/node_modules/@ui5/webcomponents-compat/dist/css/themes/TableRow.css
+index 6fd8559..3e74125 100644
+--- a/node_modules/@ui5/webcomponents-compat/dist/css/themes/TableRow.css
++++ b/node_modules/@ui5/webcomponents-compat/dist/css/themes/TableRow.css
+@@ -1 +1 @@
+-:host{--table-row-border-styles: var(--ui5-v2-10-0_table_row_outline_width) var(--sapContent_FocusStyle) var(--sapContent_FocusColor);display:contents}:host([_busy]) .ui5-table-row-root{opacity:.72;pointer-events:none}.ui5-table-row-root{background-color:var(--sapList_Background);color:var(--sapList_TextColor);border-top:1px solid var(--sapList_BorderColor);position:relative}.ui5-table-row-root,.ui5-table-popin-row{position:relative}.ui5-table-row-root:focus{outline:none}.ui5-table-row-root:focus:after,.ui5-table-row-root:focus~.ui5-table-popin-row:after{pointer-events:none;position:absolute;content:"";inset:var(--ui5-v2-10-0_table_focus_outline_offset);border:var(--table-row-border-styles)}.ui5-table-row-root:has(+.ui5-table-popin-row):focus:after{bottom:0;border-bottom:none}.ui5-table-row-root:focus~.ui5-table-popin-row:after{top:0;bottom:0;border-top:none;border-bottom:none}.ui5-table-row-root:focus~.ui5-table-popin-row:last-child:after{top:0;border-bottom:var(--table-row-border-styles)}.ui5-table-popin-row{background-color:var(--sapList_Background)}.ui5-table-popin-row.all-columns-popped-in.popin-header{border-top:1px solid var(--sapList_BorderColor)}.ui5-table-popin-row td:not(.ui5-table-row-navigated){padding-top:.5rem;padding-inline-start:1rem}:host([mode="MultiSelect"]) .ui5-table-popin-row td:not(.ui5-table-row-navigated){padding-inline-start:var(--ui5-v2-10-0_table_multiselect_popin_row_padding)}.ui5-table-popin-row:last-child td{padding-bottom:.5rem}.ui5-table-row-popin-title{color:var(--sapContent_LabelColor);font-family:"72override",var(--sapFontFamily);font-size:var(--sapFontSize)}.ui5-table-cell-display-inline{margin-inline-start:.5rem}.ui5-table-display-inline-container{display:flex;align-items:center}.ui5-table-multi-select-cell{padding:.25rem 0;box-sizing:border-box;text-align:center;vertical-align:middle}:host([mode="SingleSelect"]) .ui5-table-row-root{cursor:pointer}:host([mode="MultiSelect"]) .ui5-table-row-root .ui5-table-multi-select-cell{cursor:pointer}:host ::slotted([ui5-table-cell]:not([popined])){padding:.25rem .5rem}:host(:not([mode="MultiSelect"])) ::slotted([ui5-table-cell]:not([popined]):first-child){padding-inline-start:1rem}:host([type="Active"]) .ui5-table-row-root:hover,:host([mode="SingleSelect"]) .ui5-table-row-root:hover:not(:active){background-color:var(--sapList_Hover_Background)}:host([type="Active"]) .ui5-table-row-root:active,:host([selected][type="Active"]) .ui5-table-row-root:active{background-color:var(--sapList_Active_Background)}:host([type="Active"]) .ui5-table-row-root:active ::slotted([ui5-table-cell]){color:var(--sapList_Active_TextColor)}:host([selected]) .ui5-table-row-root:not(:active),:host([selected]) .ui5-table-row-root:not(:active)~tr{background-color:var(--sapList_SelectionBackgroundColor)}:host([selected]) tr:last-child{border-bottom:1px solid var(--sapList_SelectionBorderColor)}:host([selected][type="Active"]) .ui5-table-row-root:hover:not(:active),:host([selected][mode="SingleSelect"]) .ui5-table-row-root:hover:not(:active){background-color:var(--sapList_Hover_SelectionBackground)}:host([navigated]) .ui5-table-row-root:focus .ui5-table-div-navigated{width:.09375rem;top:2px;inset-inline-end:2px;bottom:1px}:host([navigated]) .ui5-table-row-navigated{vertical-align:middle;padding:0;position:relative}:host([navigated]) .ui5-table-div-navigated{width:.1875rem;position:absolute;inset:0;background-color:var(--sapList_SelectionBorderColor)}
++:host{--table-row-border-styles: var(--ui5-v2-10-0_table_row_outline_width) var(--sapContent_FocusStyle) var(--sapContent_FocusColor);display:contents}:host([_busy]) .ui5-table-row-root{opacity:.72;pointer-events:none}.ui5-table-row-root{background-color:var(--sapList_Background);color:var(--sapList_TextColor);border-top:1px solid var(--sapList_BorderColor);position:relative}.ui5-table-row-root,.ui5-table-popin-row{position:relative}.ui5-table-row-root:focus{outline:none}.ui5-table-row-root:focus:after,.ui5-table-row-root:focus~.ui5-table-popin-row:after{pointer-events:none;position:absolute;content:"";inset:var(--ui5-v2-10-0_table_focus_outline_offset);border:var(--table-row-border-styles)}.ui5-table-row-root:has(+.ui5-table-popin-row):focus:after{bottom:0;border-bottom:none}.ui5-table-row-root:focus~.ui5-table-popin-row:after{top:0;bottom:0;border-top:none;border-bottom:none}.ui5-table-row-root:focus~.ui5-table-popin-row:last-child:after{top:0;border-bottom:var(--table-row-border-styles)}.ui5-table-popin-row{background-color:var(--sapList_Background)}.ui5-table-popin-row.all-columns-popped-in.popin-header{border-top:1px solid var(--sapList_BorderColor)}.ui5-table-popin-row td:not(.ui5-table-row-navigated){padding-top:.5rem;padding-inline-start:1rem}:host([mode="MultiSelect"]) .ui5-table-popin-row td:not(.ui5-table-row-navigated){padding-inline-start:var(--ui5-v2-10-0_table_multiselect_popin_row_padding)}.ui5-table-popin-row:last-child td{padding-bottom:.5rem}.ui5-table-row-popin-title{color:var(--sapContent_LabelColor);font-family:"72override",var(--sapFontFamily);font-size:var(--sapFontSize)}.ui5-table-cell-display-inline{margin-inline-start:.5rem}.ui5-table-display-inline-container{display:flex;align-items:center}.ui5-table-multi-select-cell{padding:.25rem 0;box-sizing:border-box;text-align:center;vertical-align:middle}:host([mode="SingleSelect"]) .ui5-table-row-root{cursor:pointer}:host([mode="MultiSelect"]) .ui5-table-row-root .ui5-table-multi-select-cell{cursor:pointer}:host ::slotted([ui5-table-cell-v1]:not([popined])){padding:.25rem .5rem}:host(:not([mode="MultiSelect"])) ::slotted([ui5-table-cell-v1]:not([popined]):first-child){padding-inline-start:1rem}:host([type="Active"]) .ui5-table-row-root:hover,:host([mode="SingleSelect"]) .ui5-table-row-root:hover:not(:active){background-color:var(--sapList_Hover_Background)}:host([type="Active"]) .ui5-table-row-root:active,:host([selected][type="Active"]) .ui5-table-row-root:active{background-color:var(--sapList_Active_Background)}:host([type="Active"]) .ui5-table-row-root:active ::slotted([ui5-table-cell-v1]){color:var(--sapList_Active_TextColor)}:host([selected]) .ui5-table-row-root:not(:active),:host([selected]) .ui5-table-row-root:not(:active)~tr{background-color:var(--sapList_SelectionBackgroundColor)}:host([selected]) tr:last-child{border-bottom:1px solid var(--sapList_SelectionBorderColor)}:host([selected][type="Active"]) .ui5-table-row-root:hover:not(:active),:host([selected][mode="SingleSelect"]) .ui5-table-row-root:hover:not(:active){background-color:var(--sapList_Hover_SelectionBackground)}:host([navigated]) .ui5-table-row-root:focus .ui5-table-div-navigated{width:.09375rem;top:2px;inset-inline-end:2px;bottom:1px}:host([navigated]) .ui5-table-row-navigated{vertical-align:middle;padding:0;position:relative}:host([navigated]) .ui5-table-div-navigated{width:.1875rem;position:absolute;inset:0;background-color:var(--sapList_SelectionBorderColor)}
+diff --git a/node_modules/@ui5/webcomponents-compat/dist/generated/themes/TableRow.css.js b/node_modules/@ui5/webcomponents-compat/dist/generated/themes/TableRow.css.js
+index a30b695..e1f26f6 100644
+--- a/node_modules/@ui5/webcomponents-compat/dist/generated/themes/TableRow.css.js
++++ b/node_modules/@ui5/webcomponents-compat/dist/generated/themes/TableRow.css.js
+@@ -3,6 +3,6 @@ import defaultThemeBase from "@ui5/webcomponents-theming/dist/generated/themes/s
+ import defaultTheme from "./sap_horizon/parameters-bundle.css.js";
+ registerThemePropertiesLoader("@ui5/webcomponents-theming", "sap_horizon", async () => defaultThemeBase);
+ registerThemePropertiesLoader("@ui5/webcomponents-compat", "sap_horizon", async () => defaultTheme);
+-export default `:host{--table-row-border-styles: var(--ui5-v2-10-0_table_row_outline_width) var(--sapContent_FocusStyle) var(--sapContent_FocusColor);display:contents}:host([_busy]) .ui5-table-row-root{opacity:.72;pointer-events:none}.ui5-table-row-root{background-color:var(--sapList_Background);color:var(--sapList_TextColor);border-top:1px solid var(--sapList_BorderColor);position:relative}.ui5-table-row-root,.ui5-table-popin-row{position:relative}.ui5-table-row-root:focus{outline:none}.ui5-table-row-root:focus:after,.ui5-table-row-root:focus~.ui5-table-popin-row:after{pointer-events:none;position:absolute;content:"";inset:var(--ui5-v2-10-0_table_focus_outline_offset);border:var(--table-row-border-styles)}.ui5-table-row-root:has(+.ui5-table-popin-row):focus:after{bottom:0;border-bottom:none}.ui5-table-row-root:focus~.ui5-table-popin-row:after{top:0;bottom:0;border-top:none;border-bottom:none}.ui5-table-row-root:focus~.ui5-table-popin-row:last-child:after{top:0;border-bottom:var(--table-row-border-styles)}.ui5-table-popin-row{background-color:var(--sapList_Background)}.ui5-table-popin-row.all-columns-popped-in.popin-header{border-top:1px solid var(--sapList_BorderColor)}.ui5-table-popin-row td:not(.ui5-table-row-navigated){padding-top:.5rem;padding-inline-start:1rem}:host([mode="MultiSelect"]) .ui5-table-popin-row td:not(.ui5-table-row-navigated){padding-inline-start:var(--ui5-v2-10-0_table_multiselect_popin_row_padding)}.ui5-table-popin-row:last-child td{padding-bottom:.5rem}.ui5-table-row-popin-title{color:var(--sapContent_LabelColor);font-family:"72override",var(--sapFontFamily);font-size:var(--sapFontSize)}.ui5-table-cell-display-inline{margin-inline-start:.5rem}.ui5-table-display-inline-container{display:flex;align-items:center}.ui5-table-multi-select-cell{padding:.25rem 0;box-sizing:border-box;text-align:center;vertical-align:middle}:host([mode="SingleSelect"]) .ui5-table-row-root{cursor:pointer}:host([mode="MultiSelect"]) .ui5-table-row-root .ui5-table-multi-select-cell{cursor:pointer}:host ::slotted([ui5-table-cell]:not([popined])){padding:.25rem .5rem}:host(:not([mode="MultiSelect"])) ::slotted([ui5-table-cell]:not([popined]):first-child){padding-inline-start:1rem}:host([type="Active"]) .ui5-table-row-root:hover,:host([mode="SingleSelect"]) .ui5-table-row-root:hover:not(:active){background-color:var(--sapList_Hover_Background)}:host([type="Active"]) .ui5-table-row-root:active,:host([selected][type="Active"]) .ui5-table-row-root:active{background-color:var(--sapList_Active_Background)}:host([type="Active"]) .ui5-table-row-root:active ::slotted([ui5-table-cell]){color:var(--sapList_Active_TextColor)}:host([selected]) .ui5-table-row-root:not(:active),:host([selected]) .ui5-table-row-root:not(:active)~tr{background-color:var(--sapList_SelectionBackgroundColor)}:host([selected]) tr:last-child{border-bottom:1px solid var(--sapList_SelectionBorderColor)}:host([selected][type="Active"]) .ui5-table-row-root:hover:not(:active),:host([selected][mode="SingleSelect"]) .ui5-table-row-root:hover:not(:active){background-color:var(--sapList_Hover_SelectionBackground)}:host([navigated]) .ui5-table-row-root:focus .ui5-table-div-navigated{width:.09375rem;top:2px;inset-inline-end:2px;bottom:1px}:host([navigated]) .ui5-table-row-navigated{vertical-align:middle;padding:0;position:relative}:host([navigated]) .ui5-table-div-navigated{width:.1875rem;position:absolute;inset:0;background-color:var(--sapList_SelectionBorderColor)}
++export default `:host{--table-row-border-styles: var(--ui5-v2-10-0_table_row_outline_width) var(--sapContent_FocusStyle) var(--sapContent_FocusColor);display:contents}:host([_busy]) .ui5-table-row-root{opacity:.72;pointer-events:none}.ui5-table-row-root{background-color:var(--sapList_Background);color:var(--sapList_TextColor);border-top:1px solid var(--sapList_BorderColor);position:relative}.ui5-table-row-root,.ui5-table-popin-row{position:relative}.ui5-table-row-root:focus{outline:none}.ui5-table-row-root:focus:after,.ui5-table-row-root:focus~.ui5-table-popin-row:after{pointer-events:none;position:absolute;content:"";inset:var(--ui5-v2-10-0_table_focus_outline_offset);border:var(--table-row-border-styles)}.ui5-table-row-root:has(+.ui5-table-popin-row):focus:after{bottom:0;border-bottom:none}.ui5-table-row-root:focus~.ui5-table-popin-row:after{top:0;bottom:0;border-top:none;border-bottom:none}.ui5-table-row-root:focus~.ui5-table-popin-row:last-child:after{top:0;border-bottom:var(--table-row-border-styles)}.ui5-table-popin-row{background-color:var(--sapList_Background)}.ui5-table-popin-row.all-columns-popped-in.popin-header{border-top:1px solid var(--sapList_BorderColor)}.ui5-table-popin-row td:not(.ui5-table-row-navigated){padding-top:.5rem;padding-inline-start:1rem}:host([mode="MultiSelect"]) .ui5-table-popin-row td:not(.ui5-table-row-navigated){padding-inline-start:var(--ui5-v2-10-0_table_multiselect_popin_row_padding)}.ui5-table-popin-row:last-child td{padding-bottom:.5rem}.ui5-table-row-popin-title{color:var(--sapContent_LabelColor);font-family:"72override",var(--sapFontFamily);font-size:var(--sapFontSize)}.ui5-table-cell-display-inline{margin-inline-start:.5rem}.ui5-table-display-inline-container{display:flex;align-items:center}.ui5-table-multi-select-cell{padding:.25rem 0;box-sizing:border-box;text-align:center;vertical-align:middle}:host([mode="SingleSelect"]) .ui5-table-row-root{cursor:pointer}:host([mode="MultiSelect"]) .ui5-table-row-root .ui5-table-multi-select-cell{cursor:pointer}:host ::slotted([ui5-table-cell-v1]:not([popined])){padding:.25rem .5rem}:host(:not([mode="MultiSelect"])) ::slotted([ui5-table-cell-v1]:not([popined]):first-child){padding-inline-start:1rem}:host([type="Active"]) .ui5-table-row-root:hover,:host([mode="SingleSelect"]) .ui5-table-row-root:hover:not(:active){background-color:var(--sapList_Hover_Background)}:host([type="Active"]) .ui5-table-row-root:active,:host([selected][type="Active"]) .ui5-table-row-root:active{background-color:var(--sapList_Active_Background)}:host([type="Active"]) .ui5-table-row-root:active ::slotted([ui5-table-cell-v1]){color:var(--sapList_Active_TextColor)}:host([selected]) .ui5-table-row-root:not(:active),:host([selected]) .ui5-table-row-root:not(:active)~tr{background-color:var(--sapList_SelectionBackgroundColor)}:host([selected]) tr:last-child{border-bottom:1px solid var(--sapList_SelectionBorderColor)}:host([selected][type="Active"]) .ui5-table-row-root:hover:not(:active),:host([selected][mode="SingleSelect"]) .ui5-table-row-root:hover:not(:active){background-color:var(--sapList_Hover_SelectionBackground)}:host([navigated]) .ui5-table-row-root:focus .ui5-table-div-navigated{width:.09375rem;top:2px;inset-inline-end:2px;bottom:1px}:host([navigated]) .ui5-table-row-navigated{vertical-align:middle;padding:0;position:relative}:host([navigated]) .ui5-table-div-navigated{width:.1875rem;position:absolute;inset:0;background-color:var(--sapList_SelectionBorderColor)}
+ `;
+ //# sourceMappingURL=TableRow.css.js.map
+\ No newline at end of file
+diff --git a/node_modules/@ui5/webcomponents-compat/src/themes/TableRow.css b/node_modules/@ui5/webcomponents-compat/src/themes/TableRow.css
+index 76412c2..408311f 100644
+--- a/node_modules/@ui5/webcomponents-compat/src/themes/TableRow.css
++++ b/node_modules/@ui5/webcomponents-compat/src/themes/TableRow.css
+@@ -103,11 +103,11 @@
+ cursor: pointer;
+ }
+
+-:host ::slotted([ui5-table-cell]:not([popined])) {
++:host ::slotted([ui5-table-cell-v1]:not([popined])) {
+ padding: .25rem .5rem;
+ }
+
+-:host(:not([mode="MultiSelect"])) ::slotted([ui5-table-cell]:not([popined]):first-child) {
++:host(:not([mode="MultiSelect"])) ::slotted([ui5-table-cell-v1]:not([popined]):first-child) {
+ padding-inline-start: 1rem;
+ }
+
+@@ -123,7 +123,7 @@
+ background-color: var(--sapList_Active_Background);
+ }
+
+-:host([type="Active"]) .ui5-table-row-root:active ::slotted([ui5-table-cell]) {
++:host([type="Active"]) .ui5-table-row-root:active ::slotted([ui5-table-cell-v1]) {
+ color: var(--sapList_Active_TextColor);
+ }
+
diff --git a/packages/cli/patches/@ui5+webcomponents-react-compat+2.10.0.patch b/packages/cli/patches/@ui5+webcomponents-react-compat+2.10.0.patch
new file mode 100644
index 00000000000..043ab7621eb
--- /dev/null
+++ b/packages/cli/patches/@ui5+webcomponents-react-compat+2.10.0.patch
@@ -0,0 +1,39 @@
+diff --git a/node_modules/@ui5/webcomponents-react-compat/dist/components/Table/index.js b/node_modules/@ui5/webcomponents-react-compat/dist/components/Table/index.js
+index 250a159..3e6d6c2 100644
+--- a/node_modules/@ui5/webcomponents-react-compat/dist/components/Table/index.js
++++ b/node_modules/@ui5/webcomponents-react-compat/dist/components/Table/index.js
+@@ -56,7 +56,7 @@ import { withWebComponent } from '@ui5/webcomponents-react-base/dist/wrapper/wit
+ *
+ * __Note__: This is a UI5 Web Component! [Repository](https://github.com/SAP/ui5-webcomponents) | [Documentation](https://sap.github.io/ui5-webcomponents/)
+ */
+-const Table = withWebComponent('ui5-table', [
++const Table = withWebComponent('ui5-table-v1', [
+ 'accessibleName',
+ 'accessibleNameRef',
+ 'busyDelay',
+diff --git a/node_modules/@ui5/webcomponents-react-compat/dist/components/TableCell/index.js b/node_modules/@ui5/webcomponents-react-compat/dist/components/TableCell/index.js
+index 2e5338f..cce3387 100644
+--- a/node_modules/@ui5/webcomponents-react-compat/dist/components/TableCell/index.js
++++ b/node_modules/@ui5/webcomponents-react-compat/dist/components/TableCell/index.js
+@@ -6,6 +6,6 @@ import { withWebComponent } from '@ui5/webcomponents-react-base/dist/wrapper/wit
+ *
+ * __Note__: This is a UI5 Web Component! [Repository](https://github.com/SAP/ui5-webcomponents) | [Documentation](https://sap.github.io/ui5-webcomponents/)
+ */
+-const TableCell = withWebComponent('ui5-table-cell', [], [], [], []);
++const TableCell = withWebComponent('ui5-table-cell-v1', [], [], [], []);
+ TableCell.displayName = 'TableCell';
+ export { TableCell };
+diff --git a/node_modules/@ui5/webcomponents-react-compat/dist/components/TableRow/index.js b/node_modules/@ui5/webcomponents-react-compat/dist/components/TableRow/index.js
+index 6d568f3..e5ace7d 100644
+--- a/node_modules/@ui5/webcomponents-react-compat/dist/components/TableRow/index.js
++++ b/node_modules/@ui5/webcomponents-react-compat/dist/components/TableRow/index.js
+@@ -6,6 +6,7 @@ import { withWebComponent } from '@ui5/webcomponents-react-base/dist/wrapper/wit
+ *
+ * __Note__: This is a UI5 Web Component! [Repository](https://github.com/SAP/ui5-webcomponents) | [Documentation](https://sap.github.io/ui5-webcomponents/)
+ */
+-const TableRow = withWebComponent('ui5-table-row', ['type'], ['navigated', 'selected'], [], []);
++const TableRow = withWebComponent('ui5-table-row-v1', ['type'], ['navigated', 'selected'], [], []);
+ TableRow.displayName = 'TableRow';
+ export { TableRow };
++console.log("hello")
+\ No newline at end of file
diff --git a/packages/cli/src/bin/index.ts b/packages/cli/src/bin/index.ts
index cc76bfb6b5c..bce11758cf1 100755
--- a/packages/cli/src/bin/index.ts
+++ b/packages/cli/src/bin/index.ts
@@ -1,7 +1,10 @@
#!/usr/bin/env node
import { resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
import { parseArgs } from 'node:util';
+import path from 'path';
import * as process from 'process';
+import { $ } from 'execa';
const { positionals } = parseArgs({ allowPositionals: true, strict: false });
@@ -120,6 +123,20 @@ switch (command) {
await codemod.default(values.transform!, values.src!, values.typescript);
break;
}
+
+ case 'patch-compat-table': {
+ const patchesPath = path.relative(process.cwd(), fileURLToPath(new URL('../../patches', import.meta.url)));
+
+ try {
+ await $`patch-package --patch-dir ${patchesPath}`;
+ console.log('Patches applied successfully!');
+ } catch (error) {
+ console.error('Failed to apply patches:', error);
+ process.exit(1);
+ }
+
+ break;
+ }
default:
console.warn('Unknown command', command);
process.exit(1);
diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json
index fb2b71c6908..9ce96af28ff 100644
--- a/packages/cli/tsconfig.json
+++ b/packages/cli/tsconfig.json
@@ -8,5 +8,5 @@
"types": ["node"],
"skipLibCheck": true
},
- "include": ["src", "**/*.json"]
+ "include": ["src", "**/*.json", "patches"]
}
diff --git a/packages/compat/README.md b/packages/compat/README.md
index bd6a5aaa5e9..fb114c2a522 100644
--- a/packages/compat/README.md
+++ b/packages/compat/README.md
@@ -14,15 +14,23 @@ Components in this package will not receive any new features. Only critical bugs
npm install @ui5/webcomponents-react-compat
```
-## Importing Components
-
-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.
-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.
-
> ⚠️ **Warning:** It is not supported using the v1 `Table` and the v2 `Table` in the same application!
> ⚠️ **Warning:** Please only import components from this package via the file path!
+## Compatibility
+
+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.
+
+### Recommendation
+
+We strongly recommend migrating fully to the v2 `Table`, especially if the `FilterBar` or `VariantManagement` component is used!
+
+### Importing Components
+
+Importing components from the root (`import { Toolbar } from "@ui5/webcomponents-react-compat"`) is discouraged.
+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.
+
E.g.:
- `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:
- `TableCell` (`ui5-table-cell`): `import "@ui5/webcomponents-compat/dist/TableCell.js";`
- `TableRow` (`ui5-table-row`): `import "@ui5/webcomponents-compat/dist/TableRow.js";`
+### Experimental Patch Script
+
+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`.
+The script will change the custom element name by adding a `-v1` suffix (via `patch-package`) to all duplicate v1 table components.
+
+> ⚠️ **Experimental**: This script is in experimental state and not subject to semantic versioning.
+
+> ⚠️ **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.
+
+
+
+Using the script
+
+**What it does**
+
+
**Install** the `@ui5/webcomponents-react-cli` and `@ui5/webcomponents-compat` packages:
+Install the `@ui5/webcomponents-react-cli` and `@ui5/webcomponents-compat` packages:
``` // install `@ui5/webcomponents-compat` explicitly npm i @ui5/webcomponents-react-cli @ui5/webcomponents-compat ``` -**Run** the script:
+Run the script:
``` // ui5-wcr is an executable added by the `@ui5/webcomponents-react-cli` package @@ -82,7 +82,7 @@ ui5-wcr patch-compat-tableThe `ui5-wcr` executable is provided by the `@ui5/webcomponents-react-cli` package. The `patch-compat-table` command applies the necessary patches.
-**Recommendation:**
+Recommendation:
Add the script as `postinstall` script in the `package.json`, so it runs after every module update.
From 9ed2e1a9180b5aef001c3bbb5a3f02e5aeb39e56 Mon Sep 17 00:00:00 2001 From: Lukas HarbarthThe 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. -This is done internally using `patch-package` to adjust the implementation in the **node_modules**.
+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.
+This is done internally using patch-package
to adjust the implementation in the node_modules.
Install the `@ui5/webcomponents-react-cli` and `@ui5/webcomponents-compat` packages:
+Install the @ui5/webcomponents-react-cli
and @ui5/webcomponents-compat
packages:
The `ui5-wcr` executable is provided by the `@ui5/webcomponents-react-cli` package. The `patch-compat-table` command applies the necessary patches.
+The ui5-wcr
executable is provided by the @ui5/webcomponents-react-cli
package. The patch-compat-table
command applies the necessary patches.
Recommendation:
-Add the script as `postinstall` script in the `package.json`, so it runs after every module update.
+Add the script as postinstall
script in the package.json
, so it runs after every module update.
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.
This is done internally using patch-package
to adjust the implementation in the node_modules.
Note: Since the tag names and the related attribute are changed, any CSS selectors targeting these tags must be updated accordingly!
+ **How to use**Install the @ui5/webcomponents-react-cli
and @ui5/webcomponents-compat
packages:
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.
+
The script patches the @ui5/webcomponents-compat
and @ui5/webcomponents-react-compat
table component and subcomponents to render with a different custom element name (tag name) compared to the v2 implementation.
This is done internally using patch-package
to adjust the implementation in the node_modules.
Note: Since the tag names and the related attribute are changed, any CSS selectors targeting these tags must be updated accordingly!
+⚠️ Note: Since the tag names and the related attribute are changed, any CSS selectors targeting these tags must be updated accordingly!
**How to use** From 8ff656e0ad3e69816ee00d7b80741255052be0d9 Mon Sep 17 00:00:00 2001 From: Lukas Harbarth