Skip to content

Commit 4e902af

Browse files
authored
feat(AnalyticalTable): add components that should not select a row when pressed (#7517)
Closes #7516
1 parent 776f8d7 commit 4e902af

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

packages/main/src/components/AnalyticalTable/Recipes.mdx

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,53 @@ For further details please refer to the [`react-table` v7 documentation](https:/
4040

4141
## How to select rows containing active elements?
4242

43-
We've restricted the propagation of `click` events of UI5 Web Components elements such as `Button`, `Link`, `Switch`, etc.
44-
In case you still want to select the row when clicking the respective element, you can "mark" the event to allow such behavior. <br />
43+
We've restricted the `click` events of UI5 Web Components elements such as `Button`, `Link`, `Switch`, etc. to not fire the `onRowSelect` or `onRowClick` events of the `AnalyticalTable`. This is to prevent unwanted selection or row click behavior when interacting with these elements.
44+
In case you still want to select or click the row when clicking the respective element, you can "mark" the event to allow such behavior.
45+
4546
Example: `<Link onClick={(e) => {e.markerAllowTableRowSelection = true;}>My Link Text</Link>`
4647

47-
For other elements or components, we recommend disabling event propagation by setting `event.stopPropagation()` on the respective event. Per default, propagation is not prevented!
48+
For other elements or components, we recommend either disabling event propagation by calling `event.stopPropagation()` in the respective handler, or checking for the target. **Per default, propagation is not prevented!**
49+
50+
<details>
51+
52+
<summary>UI5 Web Components that Block Row Selection by Default</summary>
53+
54+
- UI5-AI-BUTTON
55+
- UI5-AI-PROMPT-INPUT
56+
- UI5-AVATAR
57+
- UI5-BUTTON
58+
- UI5-CALENDAR
59+
- UI5-CHECKBOX
60+
- UI5-COLOR-PICKER
61+
- UI5-COMBOBOX
62+
- UI5-DATE-PICKER
63+
- UI5-DATERANGE-PICKER
64+
- UI5-DATETIME-PICKER
65+
- UI5-DURATION-PICKER
66+
- UI5-DYNAMIC-DATE-RANGE
67+
- UI5-FILE-UPLOADER
68+
- UI5-ICON
69+
- UI5-INPUT
70+
- UI5-LINK
71+
- UI5-MENU-ITEM
72+
- UI5-MENU-ITEM-GROUP
73+
- UI5-MULTI-COMBOBOX
74+
- UI5-MULTI-INPUT
75+
- UI5-RADIO-BUTTON
76+
- UI5-RANGE-SLIDER
77+
- UI5-RATING-INDICATOR
78+
- UI5-SEGMENTED-BUTTON
79+
- UI5-SELECT
80+
- UI5-SLIDER
81+
- UI5-SPLIT-BUTTON
82+
- UI5-STEP-INPUT
83+
- UI5-SWITCH
84+
- UI5-TEXT-AREA
85+
- UI5-TIME-PICKER
86+
- UI5-TOGGLE-BUTTON
87+
- UI5-UPLOAD-COLLECTION
88+
89+
</details>
4890

4991
## How to stop the table state from automatically resetting when the data changes?
5092

packages/main/src/components/AnalyticalTable/util/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export function getBy(obj, path, def) {
6060
}
6161

6262
export const tagNamesWhichShouldNotSelectARow = new Set([
63+
'UI5-AI-BUTTON',
64+
'UI5-AI-PROMPT-INPUT',
6365
'UI5-AVATAR',
6466
'UI5-BUTTON',
6567
'UI5-CALENDAR',
@@ -70,10 +72,13 @@ export const tagNamesWhichShouldNotSelectARow = new Set([
7072
'UI5-DATERANGE-PICKER',
7173
'UI5-DATETIME-PICKER',
7274
'UI5-DURATION-PICKER',
75+
'UI5-DYNAMIC-DATE-RANGE',
7376
'UI5-FILE-UPLOADER',
7477
'UI5-ICON',
7578
'UI5-INPUT',
7679
'UI5-LINK',
80+
'UI5-MENU-ITEM',
81+
'UI5-MENU-ITEM-GROUP',
7782
'UI5-MULTI-COMBOBOX',
7883
'UI5-MULTI-INPUT',
7984
'UI5-RADIO-BUTTON',
@@ -82,6 +87,7 @@ export const tagNamesWhichShouldNotSelectARow = new Set([
8287
'UI5-SEGMENTED-BUTTON',
8388
'UI5-SELECT',
8489
'UI5-SLIDER',
90+
'UI5-SPLIT-BUTTON',
8591
'UI5-STEP-INPUT',
8692
'UI5-SWITCH',
8793
'UI5-TEXT-AREA',

0 commit comments

Comments
 (0)