@jetbrains/ring-ui-built 8.0.0-beta.2 → 8.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/_helpers/anchor.js +1 -1
- package/components/_helpers/avatar-info.js +1 -1
- package/components/_helpers/icon-svg.js +1 -1
- package/components/_helpers/legacy-table.js +3 -0
- package/components/_helpers/tab-link.js +1 -1
- package/components/_helpers/theme.js +49 -37
- package/components/alert/alert.js +1 -1
- package/components/alert-service/alert-service.js +1 -1
- package/components/auth/auth-core.js +1 -1
- package/components/auth/auth.js +1 -1
- package/components/auth/down-notification.js +1 -1
- package/components/auth/iframe-flow.js +1 -1
- package/components/auth/storage.js +1 -1
- package/components/auth-dialog/auth-dialog.js +1 -1
- package/components/auth-dialog-service/auth-dialog-service.js +2 -2
- package/components/avatar/avatar-info.js +1 -1
- package/components/avatar/avatar.js +1 -1
- package/components/avatar/fallback-avatar.js +1 -1
- package/components/avatar-stack/avatar-stack.js +1 -1
- package/components/banner/banner.js +1 -1
- package/components/button/button.js +1 -1
- package/components/button-group/button-group.js +1 -1
- package/components/checkbox/checkbox.js +1 -1
- package/components/clipboard/clipboard.js +1 -1
- package/components/collapse/collapse-content.js +5 -5
- package/components/collapse/collapse-control.js +5 -5
- package/components/collapse/collapse.js +4 -4
- package/components/confirm/confirm.js +1 -1
- package/components/confirm-service/confirm-service.js +2 -2
- package/components/contenteditable/contenteditable.js +1 -1
- package/components/control-help/control-help.js +1 -1
- package/components/control-label/control-label.js +1 -1
- package/components/data-list/data-list.d.ts +1 -1
- package/components/data-list/data-list.js +1 -1
- package/components/data-list/data-list.mock.d.ts +1 -1
- package/components/data-list/data-list.mock.js +1 -1
- package/components/data-list/item.d.ts +1 -1
- package/components/data-list/item.js +1 -1
- package/components/data-list/selection.d.ts +1 -1
- package/components/data-list/selection.js +2 -2
- package/components/data-list/title.js +1 -1
- package/components/date-picker/date-input.js +1 -1
- package/components/date-picker/date-picker.js +1 -2
- package/components/date-picker/date-popup.js +1 -2
- package/components/date-picker/month-names.js +1 -1
- package/components/date-picker/month-slider.js +1 -1
- package/components/date-picker/month.js +1 -1
- package/components/date-picker/months.js +4 -5
- package/components/date-picker/use-intersection-observer.js +1 -1
- package/components/date-picker/use-scroll-behavior.js +45 -44
- package/components/date-picker/weekdays.js +1 -1
- package/components/date-picker/years.js +6 -7
- package/components/dialog/dialog.d.ts +2 -2
- package/components/dialog/dialog.js +3 -3
- package/components/dropdown/anchor.js +1 -1
- package/components/dropdown/dropdown.js +1 -1
- package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
- package/components/dropdown-menu/dropdown-menu.js +62 -57
- package/components/editable-heading/editable-heading.d.ts +1 -2
- package/components/editable-heading/editable-heading.js +13 -12
- package/components/error-bubble/error-bubble.js +1 -1
- package/components/error-message/error-message.js +1 -1
- package/components/expand/collapsible-group.d.ts +5 -1
- package/components/expand/collapsible-group.js +15 -14
- package/components/footer/footer.js +1 -1
- package/components/global/create-stateful-context.js +11 -11
- package/components/global/intersection-observer-context.d.ts +2 -2
- package/components/global/intersection-observer-context.js +12 -12
- package/components/global/rerender-hoc.d.ts +4 -2
- package/components/global/rerender-hoc.js +10 -24
- package/components/{legacy-table/selection.d.ts → global/table-selection.d.ts} +14 -14
- package/components/{legacy-table/selection.js → global/table-selection.js} +3 -3
- package/components/global/theme.d.ts +4 -3
- package/components/global/theme.js +1 -1
- package/components/header/header-icon.js +1 -1
- package/components/header/header.js +1 -1
- package/components/header/links.js +1 -1
- package/components/header/logo.js +1 -1
- package/components/header/profile.js +1 -1
- package/components/header/services.js +1 -1
- package/components/header/smart-profile.js +1 -1
- package/components/header/smart-services.js +1 -1
- package/components/heading/heading.js +1 -1
- package/components/i18n/i18n-context.js +4 -4
- package/components/icon/icon-svg.js +1 -1
- package/components/icon/icon.js +1 -1
- package/components/icon/index.js +1 -1
- package/components/input/input.js +1 -1
- package/components/island/adaptive-island-hoc.js +3 -3
- package/components/island/content.d.ts +7 -2
- package/components/island/content.js +27 -18
- package/components/island/header.js +1 -1
- package/components/island/island.js +1 -1
- package/components/legacy-table/cell.js +1 -1
- package/components/legacy-table/header-cell.js +2 -2
- package/components/legacy-table/header.js +2 -2
- package/components/legacy-table/multitable.d.ts +1 -1
- package/components/legacy-table/row-with-focus-sensor.js +2 -2
- package/components/legacy-table/row.js +4 -4
- package/components/legacy-table/selection-adapter.d.ts +3 -3
- package/components/legacy-table/selection-shortcuts-hoc.d.ts +5 -5
- package/components/legacy-table/simple-table.d.ts +2 -2
- package/components/legacy-table/simple-table.js +4 -4
- package/components/legacy-table/smart-table.d.ts +5 -5
- package/components/legacy-table/smart-table.js +5 -5
- package/components/legacy-table/table.js +2 -2
- package/components/list/list-item.js +1 -1
- package/components/list/list-users-groups-source.js +1 -1
- package/components/list/list.js +1 -1
- package/components/login-dialog/login-dialog.js +1 -1
- package/components/login-dialog/service.js +2 -2
- package/components/message/message.js +1 -1
- package/components/pager/pager.js +1 -1
- package/components/popup/popup.js +1 -1
- package/components/popup/popup.target.d.ts +3 -2
- package/components/popup/popup.target.js +32 -28
- package/components/popup-menu/popup-menu.js +1 -1
- package/components/query-assist/query-assist-suggestions.js +1 -1
- package/components/query-assist/query-assist.d.ts +3 -1
- package/components/query-assist/query-assist.js +2 -2
- package/components/radio/radio-item.d.ts +3 -3
- package/components/radio/radio-item.js +32 -18
- package/components/radio/radio.d.ts +2 -2
- package/components/radio/radio.js +2 -2
- package/components/scrollable-section/scrollable-section.js +1 -1
- package/components/select/chevron-button.js +1 -1
- package/components/select/select-filter.js +1 -1
- package/components/select/select-popup.js +1 -1
- package/components/select/select.d.ts +3 -1
- package/components/select/select.js +1 -1
- package/components/slider/slider.js +100 -96
- package/components/storage/storage-local.js +1 -1
- package/components/storage/storage.js +1 -1
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.d.ts +3 -3
- package/components/tab-trap/tab-trap.js +83 -80
- package/components/table/default-item-renderer.d.ts +20 -9
- package/components/table/default-item-renderer.js +83 -142
- package/components/table/table-component.d.ts +43 -16
- package/components/table/table-component.js +162 -188
- package/components/table/table-primitives.d.ts +28 -0
- package/components/table/{table-base.js → table-primitives.js} +110 -98
- package/components/table/table-row-focus.d.ts +4 -0
- package/components/table/table-row-focus.js +41 -0
- package/components/table/table-virtualize.d.ts +3 -3
- package/components/table/table-virtualize.js +111 -112
- package/components/table/table.d.ts +9 -24
- package/components/table/table.js +4 -3
- package/components/tabs/collapsible-more.js +1 -1
- package/components/tabs/collapsible-tab.js +1 -1
- package/components/tabs/collapsible-tabs.js +1 -1
- package/components/tabs/dumb-tabs.js +1 -1
- package/components/tabs/smart-tabs.js +1 -1
- package/components/tabs/tab-link.js +1 -1
- package/components/tabs/tabs.js +1 -1
- package/components/tag/tag.js +1 -1
- package/components/tags-input/tags-input.d.ts +3 -1
- package/components/tags-input/tags-input.js +1 -1
- package/components/tags-list/tags-list.js +1 -1
- package/components/toggle/toggle.js +1 -1
- package/components/tooltip/tooltip.js +2 -2
- package/components/upload/upload.d.ts +4 -3
- package/components/upload/upload.js +7 -29
- package/components/user-agreement/service.js +2 -2
- package/components/user-agreement/user-agreement.js +1 -1
- package/components/user-card/card.js +1 -1
- package/components/user-card/smart-user-card-tooltip.js +1 -1
- package/components/user-card/tooltip.js +1 -1
- package/components/user-card/user-card.js +1 -1
- package/package.json +6 -6
- package/components/_helpers/table2.js +0 -3
- package/components/global/use-event-callback.d.ts +0 -1
- package/components/global/use-event-callback.js +0 -44
- package/components/table/table-base.d.ts +0 -24
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { c } from 'react
|
|
2
|
-
import { useRef,
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { useRef, use } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import { mergeRefs } from 'react-merge-refs';
|
|
4
5
|
import { CollapseItemIntoSpacerContext, TablePropsContext } from './table-const.js';
|
|
5
6
|
import { useIsIntersectingListener } from '../global/intersection-observer-context.js';
|
|
6
|
-
import { TableRow, TableCell } from './table-
|
|
7
|
+
import { TableRow, TableCell } from './table-primitives.js';
|
|
7
8
|
import { s as styles } from '../_helpers/table.js';
|
|
8
9
|
import { jsx } from 'react/jsx-runtime';
|
|
9
10
|
import '@jetbrains/icons/unsorted-12px';
|
|
@@ -15,162 +16,107 @@ import 'util-deprecate';
|
|
|
15
16
|
import '../icon/icon.constants.js';
|
|
16
17
|
import '../_helpers/icon-svg.js';
|
|
17
18
|
import '../global/memoize.js';
|
|
19
|
+
import './table-row-focus.js';
|
|
18
20
|
|
|
19
21
|
const INDENT_SIZE = 24;
|
|
20
22
|
/**
|
|
21
23
|
* @see TableProps.renderItem
|
|
22
24
|
*/
|
|
23
25
|
function DefaultItemRenderer(t0) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
for (let $i = 0; $i < 51; $i += 1) {
|
|
26
|
+
const $ = c(35);
|
|
27
|
+
if ($[0] !== "550d56d2b4709142d4ace07b800bfd11367b60c980b981f1e1be21c6b691222c") {
|
|
28
|
+
for (let $i = 0; $i < 35; $i += 1) {
|
|
28
29
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
29
30
|
}
|
|
30
|
-
$[0] = "
|
|
31
|
+
$[0] = "550d56d2b4709142d4ace07b800bfd11367b60c980b981f1e1be21c6b691222c";
|
|
31
32
|
}
|
|
32
33
|
let className;
|
|
33
34
|
let clickable;
|
|
34
35
|
let index;
|
|
36
|
+
let keyboardFocusable;
|
|
35
37
|
let level;
|
|
36
|
-
let onBlur;
|
|
37
|
-
let onKeyDown;
|
|
38
38
|
let restProps;
|
|
39
|
+
let selected;
|
|
39
40
|
let userRef;
|
|
40
41
|
if ($[1] !== t0) {
|
|
41
42
|
({
|
|
42
|
-
ref: userRef,
|
|
43
43
|
index,
|
|
44
|
+
keyboardFocusable,
|
|
44
45
|
clickable,
|
|
46
|
+
selected,
|
|
45
47
|
level,
|
|
48
|
+
ref: userRef,
|
|
46
49
|
className,
|
|
47
|
-
onKeyDown,
|
|
48
|
-
onBlur,
|
|
49
50
|
...restProps
|
|
50
51
|
} = t0);
|
|
51
52
|
$[1] = t0;
|
|
52
53
|
$[2] = className;
|
|
53
54
|
$[3] = clickable;
|
|
54
55
|
$[4] = index;
|
|
55
|
-
$[5] =
|
|
56
|
-
$[6] =
|
|
57
|
-
$[7] =
|
|
58
|
-
$[8] =
|
|
56
|
+
$[5] = keyboardFocusable;
|
|
57
|
+
$[6] = level;
|
|
58
|
+
$[7] = restProps;
|
|
59
|
+
$[8] = selected;
|
|
59
60
|
$[9] = userRef;
|
|
60
61
|
} else {
|
|
61
62
|
className = $[2];
|
|
62
63
|
clickable = $[3];
|
|
63
64
|
index = $[4];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
keyboardFocusable = $[5];
|
|
66
|
+
level = $[6];
|
|
67
|
+
restProps = $[7];
|
|
68
|
+
selected = $[8];
|
|
68
69
|
userRef = $[9];
|
|
69
70
|
}
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const collapseItemIntoSpacer = useContext(CollapseItemIntoSpacerContext);
|
|
71
|
+
const localRef = useRef(null);
|
|
72
|
+
const collapseItemIntoSpacer = use(CollapseItemIntoSpacerContext);
|
|
73
73
|
let t1;
|
|
74
|
-
if ($[10] !== collapseItemIntoSpacer
|
|
74
|
+
if ($[10] !== collapseItemIntoSpacer) {
|
|
75
75
|
t1 = isIntersecting => {
|
|
76
|
-
if (
|
|
77
|
-
collapseItemIntoSpacer(
|
|
76
|
+
if (localRef.current && !isIntersecting) {
|
|
77
|
+
collapseItemIntoSpacer(localRef.current.getBoundingClientRect().height);
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
$[10] = collapseItemIntoSpacer;
|
|
81
|
-
$[11] =
|
|
82
|
-
$[12] = t1;
|
|
81
|
+
$[11] = t1;
|
|
83
82
|
} else {
|
|
84
|
-
t1 = $[
|
|
83
|
+
t1 = $[11];
|
|
84
|
+
}
|
|
85
|
+
useIsIntersectingListener(localRef, t1);
|
|
86
|
+
const tableProps = use(TablePropsContext);
|
|
87
|
+
if (!tableProps) {
|
|
88
|
+
return null;
|
|
85
89
|
}
|
|
86
|
-
useIsIntersectingListener(ref, t1);
|
|
87
90
|
const {
|
|
88
91
|
data,
|
|
89
|
-
columns
|
|
90
|
-
|
|
91
|
-
isItemKeyboardFocusable,
|
|
92
|
-
onItemFocus
|
|
93
|
-
} = useContext(TablePropsContext);
|
|
92
|
+
columns
|
|
93
|
+
} = tableProps;
|
|
94
94
|
const item = data[index];
|
|
95
|
-
const selected = selection?.isSelected(item);
|
|
96
95
|
let t2;
|
|
97
|
-
if ($[
|
|
98
|
-
t2 =
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const step = e.key === "ArrowUp" ? -1 : 1;
|
|
102
|
-
for (let i = index + step; 0 <= i && i < data.length; i = i + step, i) {
|
|
103
|
-
if (isItemKeyboardFocusable?.(data[i], i, data)) {
|
|
104
|
-
onItemFocus?.(data[i], i, data);
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
$[13] = data;
|
|
111
|
-
$[14] = index;
|
|
112
|
-
$[15] = isItemKeyboardFocusable;
|
|
113
|
-
$[16] = onItemFocus;
|
|
114
|
-
$[17] = onKeyDown;
|
|
115
|
-
$[18] = t2;
|
|
116
|
-
} else {
|
|
117
|
-
t2 = $[18];
|
|
118
|
-
}
|
|
119
|
-
const handleKeyDown = t2;
|
|
120
|
-
let t3;
|
|
121
|
-
if ($[19] !== item || $[20] !== selection) {
|
|
122
|
-
t3 = selection?.isFocused(item);
|
|
123
|
-
$[19] = item;
|
|
124
|
-
$[20] = selection;
|
|
125
|
-
$[21] = t3;
|
|
96
|
+
if ($[12] !== userRef) {
|
|
97
|
+
t2 = mergeRefs([userRef, localRef]);
|
|
98
|
+
$[12] = userRef;
|
|
99
|
+
$[13] = t2;
|
|
126
100
|
} else {
|
|
127
|
-
|
|
101
|
+
t2 = $[13];
|
|
128
102
|
}
|
|
129
|
-
const
|
|
130
|
-
|
|
103
|
+
const t3 = clickable && styles.clickableRow;
|
|
104
|
+
const t4 = selected && styles.selectedRow;
|
|
131
105
|
let t5;
|
|
132
|
-
if ($[
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
t5 = [focused, ref];
|
|
139
|
-
$[22] = focused;
|
|
140
|
-
$[23] = ref;
|
|
141
|
-
$[24] = t4;
|
|
142
|
-
$[25] = t5;
|
|
106
|
+
if ($[14] !== className || $[15] !== t3 || $[16] !== t4) {
|
|
107
|
+
t5 = classNames(className, t3, t4);
|
|
108
|
+
$[14] = className;
|
|
109
|
+
$[15] = t3;
|
|
110
|
+
$[16] = t4;
|
|
111
|
+
$[17] = t5;
|
|
143
112
|
} else {
|
|
144
|
-
|
|
145
|
-
t5 = $[25];
|
|
113
|
+
t5 = $[17];
|
|
146
114
|
}
|
|
147
|
-
useEffect(t4, t5);
|
|
148
115
|
let t6;
|
|
149
|
-
if ($[
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
onItemFocus?.(null, -1, data);
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
$[26] = data;
|
|
157
|
-
$[27] = focused;
|
|
158
|
-
$[28] = onBlur;
|
|
159
|
-
$[29] = onItemFocus;
|
|
160
|
-
$[30] = t6;
|
|
161
|
-
} else {
|
|
162
|
-
t6 = $[30];
|
|
163
|
-
}
|
|
164
|
-
const handleBlur = t6;
|
|
165
|
-
const T0 = TableRow;
|
|
166
|
-
const t7 = classNames(className, clickable && styles.clickableRow, selected && styles.selectedRow);
|
|
167
|
-
const t8 = focused ? 0 : undefined;
|
|
168
|
-
const t9 = focused ? handleBlur : undefined;
|
|
169
|
-
let t10;
|
|
170
|
-
if ($[31] !== columns || $[32] !== data || $[33] !== index || $[34] !== item || $[35] !== level) {
|
|
171
|
-
let t11;
|
|
172
|
-
if ($[37] !== data || $[38] !== index || $[39] !== item || $[40] !== level) {
|
|
173
|
-
t11 = (column, columnIndex) => {
|
|
116
|
+
if ($[18] !== columns || $[19] !== data || $[20] !== index || $[21] !== item || $[22] !== level) {
|
|
117
|
+
let t7;
|
|
118
|
+
if ($[24] !== data || $[25] !== index || $[26] !== item || $[27] !== level) {
|
|
119
|
+
t7 = (column, columnIndex) => {
|
|
174
120
|
var _column$renderCell;
|
|
175
121
|
return /*#__PURE__*/jsx(TableCell, {
|
|
176
122
|
className: column.tdClassName?.(item, index, data),
|
|
@@ -180,48 +126,43 @@ function DefaultItemRenderer(t0) {
|
|
|
180
126
|
children: (_column$renderCell = column.renderCell?.(item, index, data)) !== null && _column$renderCell !== void 0 ? _column$renderCell : getDefaultCellValue(item, columnIndex)
|
|
181
127
|
}, column.key);
|
|
182
128
|
};
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
129
|
+
$[24] = data;
|
|
130
|
+
$[25] = index;
|
|
131
|
+
$[26] = item;
|
|
132
|
+
$[27] = level;
|
|
133
|
+
$[28] = t7;
|
|
188
134
|
} else {
|
|
189
|
-
|
|
135
|
+
t7 = $[28];
|
|
190
136
|
}
|
|
191
|
-
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
137
|
+
t6 = columns.map(t7);
|
|
138
|
+
$[18] = columns;
|
|
139
|
+
$[19] = data;
|
|
140
|
+
$[20] = index;
|
|
141
|
+
$[21] = item;
|
|
142
|
+
$[22] = level;
|
|
143
|
+
$[23] = t6;
|
|
198
144
|
} else {
|
|
199
|
-
|
|
145
|
+
t6 = $[23];
|
|
200
146
|
}
|
|
201
|
-
let
|
|
202
|
-
if ($[
|
|
203
|
-
|
|
204
|
-
ref:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
tabIndex: t8,
|
|
208
|
-
onBlur: t9,
|
|
147
|
+
let t7;
|
|
148
|
+
if ($[29] !== keyboardFocusable || $[30] !== restProps || $[31] !== t2 || $[32] !== t5 || $[33] !== t6) {
|
|
149
|
+
t7 = /*#__PURE__*/jsx(TableRow, {
|
|
150
|
+
ref: t2,
|
|
151
|
+
keyboardFocusable: keyboardFocusable,
|
|
152
|
+
className: t5,
|
|
209
153
|
...restProps,
|
|
210
|
-
children:
|
|
154
|
+
children: t6
|
|
211
155
|
});
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[48] = t8;
|
|
219
|
-
$[49] = t9;
|
|
220
|
-
$[50] = t11;
|
|
156
|
+
$[29] = keyboardFocusable;
|
|
157
|
+
$[30] = restProps;
|
|
158
|
+
$[31] = t2;
|
|
159
|
+
$[32] = t5;
|
|
160
|
+
$[33] = t6;
|
|
161
|
+
$[34] = t7;
|
|
221
162
|
} else {
|
|
222
|
-
|
|
163
|
+
t7 = $[34];
|
|
223
164
|
}
|
|
224
|
-
return
|
|
165
|
+
return t7;
|
|
225
166
|
}
|
|
226
167
|
function getDefaultCellValue(item, columnIndex) {
|
|
227
168
|
if (Array.isArray(item)) {
|
|
@@ -1,44 +1,71 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentPropsWithRef } from 'react';
|
|
2
2
|
import type { TableProps } from './table';
|
|
3
3
|
/**
|
|
4
4
|
* The new Table component. Use it instead of tables in the `legacy-table` folder.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* For every prop and component referenced here, see the corresponding docs
|
|
7
|
+
* for detailed behavior.
|
|
8
|
+
*
|
|
9
|
+
* ## Minimal usage
|
|
10
|
+
*
|
|
11
|
+
* You need the following props:
|
|
7
12
|
* - `data`
|
|
8
13
|
* - `getKey`
|
|
9
14
|
* - `columns`
|
|
10
15
|
* - `key`
|
|
11
|
-
* - `
|
|
16
|
+
* - `name` (not required but needed in most cases)
|
|
17
|
+
* - `renderCell` (not required but needed in most cases)
|
|
12
18
|
*
|
|
13
19
|
* ## Selection
|
|
14
20
|
*
|
|
15
|
-
*
|
|
21
|
+
* Selection is handled on item level via `renderItem` (often with
|
|
22
|
+
* `DefaultItemRenderer`) and its props:
|
|
23
|
+
*
|
|
24
|
+
* - `clickable`
|
|
25
|
+
* - `selected`
|
|
26
|
+
* - `onClick` or `onPointerUp`, etc.
|
|
16
27
|
*
|
|
17
|
-
*
|
|
18
|
-
* - `isItemClickable`
|
|
19
|
-
* - `DefaultItemRenderer.onClick`
|
|
28
|
+
* You may use the TableSelection from `global/table-selection.ts` for the selection control:
|
|
20
29
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
30
|
+
* - `selected={tableSelection.isSelected(item)}`
|
|
31
|
+
* - `onClick={() => setTableSelection(tableSelection.toggle(item))}`
|
|
32
|
+
*
|
|
33
|
+
* See the stories for examples with this utility.
|
|
34
|
+
*
|
|
35
|
+
* Additionally, for accessibility, you will likely need a cell with a checkbox
|
|
36
|
+
* to toggle item selection.
|
|
23
37
|
*
|
|
24
38
|
* ## Sorting
|
|
39
|
+
*
|
|
25
40
|
* You need the following to support sorting:
|
|
26
41
|
*
|
|
27
42
|
* - Include `<SortButton />` in a column header
|
|
28
|
-
* - Set initial `Column.sortOrder` to `none
|
|
29
|
-
*
|
|
43
|
+
* - Set initial `Column.sortOrder` to `none`. Do not leave `undefined`
|
|
44
|
+
* for accessibility reasons.
|
|
30
45
|
* - Handle `TableProps.onSort` callback in the client code. It is expected
|
|
31
|
-
*
|
|
32
|
-
*
|
|
46
|
+
* to update `columns` by setting the new `sortOrder` value for
|
|
47
|
+
* the corresponding column, and updating the data accordingly.
|
|
48
|
+
*
|
|
49
|
+
* ## Focus
|
|
50
|
+
*
|
|
51
|
+
* The table supports the ["roving tabindex"](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Guides/Keyboard-navigable_JavaScript_widgets#technique_1_roving_tabindex)
|
|
52
|
+
* technique to focus rows with the up/down arrow keys and, possibly, with the pointer.
|
|
53
|
+
* To support it, use the following props of the `DefaultItemRenderer`:
|
|
54
|
+
*
|
|
55
|
+
* - `keyboardFocusable`
|
|
56
|
+
* - Possibly `onClick` invoking `focusRow(e.currentTarget)`
|
|
57
|
+
*
|
|
58
|
+
* In your custom row renderer, use `TableRow`, which also has the `keyboardFocusable` prop.
|
|
33
59
|
*
|
|
34
60
|
* ## Deleting columns
|
|
61
|
+
*
|
|
35
62
|
* You need the following to support deleting columns:
|
|
36
63
|
*
|
|
37
64
|
* - Make sure the `column` has a proper `name` or `key` prop, which will be
|
|
38
|
-
*
|
|
65
|
+
* automatically included in the aria-label of `<DeleteColumnButton />`.
|
|
39
66
|
* - Include `<DeleteColumnButton />` in a column header
|
|
40
67
|
* - Handle `TableProps.onColumnDelete` callback in the client code. It is expected
|
|
41
|
-
*
|
|
68
|
+
* to update `columns` by removing the corresponding column.
|
|
42
69
|
*
|
|
43
70
|
* ## Row virtualization
|
|
44
71
|
*
|
|
@@ -50,4 +77,4 @@ import type { TableProps } from './table';
|
|
|
50
77
|
* the default height (e.g. multiline or custom content)
|
|
51
78
|
* - Fine-tuning props: `lookaheadPx`, `retentionMarginPx`, `minScrollAndResizeDeltaPx`
|
|
52
79
|
*/
|
|
53
|
-
export default function Table<T>(props: TableProps<T> &
|
|
80
|
+
export default function Table<T>(props: TableProps<T> & ComponentPropsWithRef<'table'>): import("react").JSX.Element;
|