@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,5 +1,5 @@
|
|
|
1
|
-
import { c } from 'react
|
|
2
|
-
import {
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { use } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import unsortedIcon from '@jetbrains/icons/unsorted-12px';
|
|
5
5
|
import arrowDownIcon from '@jetbrains/icons/arrow-12px-down';
|
|
@@ -7,6 +7,7 @@ import arrowUpIcon from '@jetbrains/icons/arrow-12px-up';
|
|
|
7
7
|
import trashIcon from '@jetbrains/icons/trash-12px';
|
|
8
8
|
import Icon from '../icon/icon.js';
|
|
9
9
|
import { TablePropsContext, ColumnIndexContext } from './table-const.js';
|
|
10
|
+
import { keyboardFocusableAttrName } from './table-row-focus.js';
|
|
10
11
|
import { s as styles } from '../_helpers/table.js';
|
|
11
12
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
12
13
|
import 'util-deprecate';
|
|
@@ -14,35 +15,27 @@ import '../icon/icon.constants.js';
|
|
|
14
15
|
import '../_helpers/icon-svg.js';
|
|
15
16
|
import '../global/memoize.js';
|
|
16
17
|
|
|
17
|
-
function SortButton(
|
|
18
|
+
function SortButton(t0) {
|
|
18
19
|
var _column$sortOrder;
|
|
19
20
|
const $ = c(21);
|
|
20
|
-
if ($[0] !== "
|
|
21
|
+
if ($[0] !== "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6") {
|
|
21
22
|
for (let $i = 0; $i < 21; $i += 1) {
|
|
22
23
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
23
24
|
}
|
|
24
|
-
$[0] = "
|
|
25
|
+
$[0] = "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6";
|
|
25
26
|
}
|
|
26
|
-
const tableProps = useContext(TablePropsContext);
|
|
27
|
-
const columnIndex = useContext(ColumnIndexContext);
|
|
28
|
-
const column = tableProps?.columns[columnIndex];
|
|
29
|
-
if (!tableProps || !column) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
const sortOrder = (_column$sortOrder = column.sortOrder) !== null && _column$sortOrder !== void 0 ? _column$sortOrder : "none";
|
|
33
|
-
const glyph = sortOrder === "none" ? unsortedIcon : sortOrder === "ascending" ? arrowUpIcon : arrowDownIcon;
|
|
34
27
|
let children;
|
|
35
28
|
let className;
|
|
36
29
|
let onClick;
|
|
37
30
|
let restProps;
|
|
38
|
-
if ($[1] !==
|
|
31
|
+
if ($[1] !== t0) {
|
|
39
32
|
({
|
|
40
33
|
className,
|
|
41
34
|
children,
|
|
42
35
|
onClick,
|
|
43
36
|
...restProps
|
|
44
|
-
} =
|
|
45
|
-
$[1] =
|
|
37
|
+
} = t0);
|
|
38
|
+
$[1] = t0;
|
|
46
39
|
$[2] = children;
|
|
47
40
|
$[3] = className;
|
|
48
41
|
$[4] = onClick;
|
|
@@ -53,94 +46,96 @@ function SortButton(props) {
|
|
|
53
46
|
onClick = $[4];
|
|
54
47
|
restProps = $[5];
|
|
55
48
|
}
|
|
56
|
-
|
|
49
|
+
const tableProps = use(TablePropsContext);
|
|
50
|
+
const columnIndex = use(ColumnIndexContext);
|
|
51
|
+
const column = tableProps?.columns[columnIndex];
|
|
52
|
+
const sortOrder = (_column$sortOrder = column?.sortOrder) !== null && _column$sortOrder !== void 0 ? _column$sortOrder : "none";
|
|
53
|
+
const glyph = sortOrder === "none" ? unsortedIcon : sortOrder === "ascending" ? arrowUpIcon : arrowDownIcon;
|
|
54
|
+
let t1;
|
|
57
55
|
if ($[6] !== columnIndex || $[7] !== onClick || $[8] !== sortOrder || $[9] !== tableProps) {
|
|
58
|
-
|
|
56
|
+
t1 = e => {
|
|
59
57
|
onClick?.(e);
|
|
60
58
|
if (!e.defaultPrevented) {
|
|
61
59
|
const sequence = ["none", "ascending", "descending"];
|
|
62
60
|
const nextOrder = sequence[(sequence.indexOf(sortOrder) + 1) % sequence.length];
|
|
63
|
-
tableProps.onSort?.(columnIndex, nextOrder);
|
|
61
|
+
tableProps.onSort?.(columnIndex, nextOrder, tableProps.columns);
|
|
64
62
|
}
|
|
65
63
|
};
|
|
66
64
|
$[6] = columnIndex;
|
|
67
65
|
$[7] = onClick;
|
|
68
66
|
$[8] = sortOrder;
|
|
69
67
|
$[9] = tableProps;
|
|
70
|
-
$[10] =
|
|
68
|
+
$[10] = t1;
|
|
71
69
|
} else {
|
|
72
|
-
|
|
70
|
+
t1 = $[10];
|
|
73
71
|
}
|
|
74
|
-
const handleClick =
|
|
75
|
-
|
|
72
|
+
const handleClick = t1;
|
|
73
|
+
if (!tableProps || !column) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
let t2;
|
|
76
77
|
if ($[11] !== className) {
|
|
77
|
-
|
|
78
|
+
t2 = classNames(styles.headerButton, className);
|
|
78
79
|
$[11] = className;
|
|
79
|
-
$[12] =
|
|
80
|
+
$[12] = t2;
|
|
80
81
|
} else {
|
|
81
|
-
|
|
82
|
+
t2 = $[12];
|
|
82
83
|
}
|
|
83
|
-
let
|
|
84
|
+
let t3;
|
|
84
85
|
if ($[13] !== glyph) {
|
|
85
|
-
|
|
86
|
+
t3 = /*#__PURE__*/jsx(Icon, {
|
|
86
87
|
glyph: glyph,
|
|
87
88
|
"aria-hidden": true
|
|
88
89
|
});
|
|
89
90
|
$[13] = glyph;
|
|
90
|
-
$[14] =
|
|
91
|
+
$[14] = t3;
|
|
91
92
|
} else {
|
|
92
|
-
|
|
93
|
+
t3 = $[14];
|
|
93
94
|
}
|
|
94
|
-
let
|
|
95
|
-
if ($[15] !== children || $[16] !== handleClick || $[17] !== restProps || $[18] !==
|
|
96
|
-
|
|
95
|
+
let t4;
|
|
96
|
+
if ($[15] !== children || $[16] !== handleClick || $[17] !== restProps || $[18] !== t2 || $[19] !== t3) {
|
|
97
|
+
t4 = /*#__PURE__*/jsxs("button", {
|
|
97
98
|
type: "button",
|
|
98
|
-
className:
|
|
99
|
+
className: t2,
|
|
99
100
|
onClick: handleClick,
|
|
100
101
|
...restProps,
|
|
101
|
-
children: [children, " ",
|
|
102
|
+
children: [children, " ", t3]
|
|
102
103
|
});
|
|
103
104
|
$[15] = children;
|
|
104
105
|
$[16] = handleClick;
|
|
105
106
|
$[17] = restProps;
|
|
106
|
-
$[18] =
|
|
107
|
-
$[19] =
|
|
108
|
-
$[20] =
|
|
107
|
+
$[18] = t2;
|
|
108
|
+
$[19] = t3;
|
|
109
|
+
$[20] = t4;
|
|
109
110
|
} else {
|
|
110
|
-
|
|
111
|
+
t4 = $[20];
|
|
111
112
|
}
|
|
112
|
-
return
|
|
113
|
+
return t4;
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
116
|
* Include it in a column header to make the column deletable.
|
|
116
117
|
* Beware that `column.name ?? String(column.key)` is used in the aria-label.
|
|
117
118
|
* Handle clicks with {@link TableProps.onColumnDelete}.
|
|
118
119
|
*/
|
|
119
|
-
function DeleteColumnButton(
|
|
120
|
+
function DeleteColumnButton(t0) {
|
|
120
121
|
var _column$name;
|
|
121
122
|
const $ = c(17);
|
|
122
|
-
if ($[0] !== "
|
|
123
|
+
if ($[0] !== "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6") {
|
|
123
124
|
for (let $i = 0; $i < 17; $i += 1) {
|
|
124
125
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
125
126
|
}
|
|
126
|
-
$[0] = "
|
|
127
|
-
}
|
|
128
|
-
const tableProps = useContext(TablePropsContext);
|
|
129
|
-
const columnIndex = useContext(ColumnIndexContext);
|
|
130
|
-
const column = tableProps?.columns[columnIndex];
|
|
131
|
-
if (!tableProps || !column) {
|
|
132
|
-
return null;
|
|
127
|
+
$[0] = "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6";
|
|
133
128
|
}
|
|
134
129
|
let className;
|
|
135
130
|
let onClick;
|
|
136
131
|
let restProps;
|
|
137
|
-
if ($[1] !==
|
|
132
|
+
if ($[1] !== t0) {
|
|
138
133
|
({
|
|
139
134
|
className,
|
|
140
135
|
onClick,
|
|
141
136
|
...restProps
|
|
142
|
-
} =
|
|
143
|
-
$[1] =
|
|
137
|
+
} = t0);
|
|
138
|
+
$[1] = t0;
|
|
144
139
|
$[2] = className;
|
|
145
140
|
$[3] = onClick;
|
|
146
141
|
$[4] = restProps;
|
|
@@ -149,88 +144,94 @@ function DeleteColumnButton(props) {
|
|
|
149
144
|
onClick = $[3];
|
|
150
145
|
restProps = $[4];
|
|
151
146
|
}
|
|
152
|
-
|
|
147
|
+
const tableProps = use(TablePropsContext);
|
|
148
|
+
const columnIndex = use(ColumnIndexContext);
|
|
149
|
+
const column = tableProps?.columns[columnIndex];
|
|
150
|
+
let t1;
|
|
153
151
|
if ($[5] !== columnIndex || $[6] !== onClick || $[7] !== tableProps) {
|
|
154
|
-
|
|
152
|
+
t1 = e => {
|
|
155
153
|
onClick?.(e);
|
|
156
154
|
if (!e.defaultPrevented) {
|
|
157
|
-
tableProps.onColumnDelete?.(columnIndex);
|
|
155
|
+
tableProps.onColumnDelete?.(columnIndex, tableProps.columns);
|
|
158
156
|
}
|
|
159
157
|
};
|
|
160
158
|
$[5] = columnIndex;
|
|
161
159
|
$[6] = onClick;
|
|
162
160
|
$[7] = tableProps;
|
|
163
|
-
$[8] =
|
|
161
|
+
$[8] = t1;
|
|
164
162
|
} else {
|
|
165
|
-
|
|
163
|
+
t1 = $[8];
|
|
166
164
|
}
|
|
167
|
-
const handleClick =
|
|
168
|
-
|
|
165
|
+
const handleClick = t1;
|
|
166
|
+
if (!tableProps || !column) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
let t2;
|
|
169
170
|
if ($[9] !== className) {
|
|
170
|
-
|
|
171
|
+
t2 = classNames(styles.headerButton, styles.deleteColumnButton, className);
|
|
171
172
|
$[9] = className;
|
|
172
|
-
$[10] =
|
|
173
|
+
$[10] = t2;
|
|
173
174
|
} else {
|
|
174
|
-
|
|
175
|
+
t2 = $[10];
|
|
175
176
|
}
|
|
176
|
-
const
|
|
177
|
-
let
|
|
177
|
+
const t3 = `Delete column ${(_column$name = column.name) !== null && _column$name !== void 0 ? _column$name : String(column.key)}`;
|
|
178
|
+
let t4;
|
|
178
179
|
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
179
|
-
|
|
180
|
+
t4 = /*#__PURE__*/jsx(Icon, {
|
|
180
181
|
glyph: trashIcon
|
|
181
182
|
});
|
|
182
|
-
$[11] =
|
|
183
|
+
$[11] = t4;
|
|
183
184
|
} else {
|
|
184
|
-
|
|
185
|
+
t4 = $[11];
|
|
185
186
|
}
|
|
186
|
-
let
|
|
187
|
-
if ($[12] !== handleClick || $[13] !== restProps || $[14] !==
|
|
188
|
-
|
|
187
|
+
let t5;
|
|
188
|
+
if ($[12] !== handleClick || $[13] !== restProps || $[14] !== t2 || $[15] !== t3) {
|
|
189
|
+
t5 = /*#__PURE__*/jsx("button", {
|
|
189
190
|
type: "button",
|
|
190
|
-
className:
|
|
191
|
+
className: t2,
|
|
191
192
|
onClick: handleClick,
|
|
192
|
-
"aria-label":
|
|
193
|
+
"aria-label": t3,
|
|
193
194
|
...restProps,
|
|
194
|
-
children:
|
|
195
|
+
children: t4
|
|
195
196
|
});
|
|
196
197
|
$[12] = handleClick;
|
|
197
198
|
$[13] = restProps;
|
|
198
|
-
$[14] =
|
|
199
|
-
$[15] =
|
|
200
|
-
$[16] =
|
|
199
|
+
$[14] = t2;
|
|
200
|
+
$[15] = t3;
|
|
201
|
+
$[16] = t5;
|
|
201
202
|
} else {
|
|
202
|
-
|
|
203
|
+
t5 = $[16];
|
|
203
204
|
}
|
|
204
|
-
return
|
|
205
|
+
return t5;
|
|
205
206
|
}
|
|
206
207
|
/**
|
|
207
208
|
* A helper `<tr>` component for a custom {@link TableProps.renderItem} implementations.
|
|
208
209
|
* Applies the standard row classnames.
|
|
209
210
|
*/
|
|
210
211
|
function TableRow(props) {
|
|
211
|
-
const $ = c(
|
|
212
|
-
if ($[0] !== "
|
|
213
|
-
for (let $i = 0; $i <
|
|
212
|
+
const $ = c(13);
|
|
213
|
+
if ($[0] !== "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6") {
|
|
214
|
+
for (let $i = 0; $i < 13; $i += 1) {
|
|
214
215
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
215
216
|
}
|
|
216
|
-
$[0] = "
|
|
217
|
+
$[0] = "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6";
|
|
217
218
|
}
|
|
218
219
|
let className;
|
|
219
|
-
let
|
|
220
|
+
let keyboardFocusable;
|
|
220
221
|
let restProps;
|
|
221
222
|
if ($[1] !== props) {
|
|
222
223
|
({
|
|
223
|
-
|
|
224
|
+
keyboardFocusable,
|
|
224
225
|
className,
|
|
225
226
|
...restProps
|
|
226
227
|
} = props);
|
|
227
228
|
$[1] = props;
|
|
228
229
|
$[2] = className;
|
|
229
|
-
$[3] =
|
|
230
|
+
$[3] = keyboardFocusable;
|
|
230
231
|
$[4] = restProps;
|
|
231
232
|
} else {
|
|
232
233
|
className = $[2];
|
|
233
|
-
|
|
234
|
+
keyboardFocusable = $[3];
|
|
234
235
|
restProps = $[4];
|
|
235
236
|
}
|
|
236
237
|
let t0;
|
|
@@ -243,20 +244,31 @@ function TableRow(props) {
|
|
|
243
244
|
}
|
|
244
245
|
const classes = t0;
|
|
245
246
|
let t1;
|
|
246
|
-
if ($[7] !==
|
|
247
|
-
t1 =
|
|
248
|
-
|
|
249
|
-
className: classes,
|
|
247
|
+
if ($[7] !== keyboardFocusable || $[8] !== restProps) {
|
|
248
|
+
t1 = keyboardFocusable ? {
|
|
249
|
+
[keyboardFocusableAttrName]: "",
|
|
250
250
|
...restProps
|
|
251
|
+
} : restProps;
|
|
252
|
+
$[7] = keyboardFocusable;
|
|
253
|
+
$[8] = restProps;
|
|
254
|
+
$[9] = t1;
|
|
255
|
+
} else {
|
|
256
|
+
t1 = $[9];
|
|
257
|
+
}
|
|
258
|
+
const trRestProps = t1;
|
|
259
|
+
let t2;
|
|
260
|
+
if ($[10] !== classes || $[11] !== trRestProps) {
|
|
261
|
+
t2 = /*#__PURE__*/jsx("tr", {
|
|
262
|
+
className: classes,
|
|
263
|
+
...trRestProps
|
|
251
264
|
});
|
|
252
|
-
$[
|
|
253
|
-
$[
|
|
254
|
-
$[
|
|
255
|
-
$[10] = t1;
|
|
265
|
+
$[10] = classes;
|
|
266
|
+
$[11] = trRestProps;
|
|
267
|
+
$[12] = t2;
|
|
256
268
|
} else {
|
|
257
|
-
|
|
269
|
+
t2 = $[12];
|
|
258
270
|
}
|
|
259
|
-
return
|
|
271
|
+
return t2;
|
|
260
272
|
}
|
|
261
273
|
/**
|
|
262
274
|
* A helper `<td>` component for a custom {@link TableProps.renderItem} implementations.
|
|
@@ -264,11 +276,11 @@ function TableRow(props) {
|
|
|
264
276
|
*/
|
|
265
277
|
function TableCell(props) {
|
|
266
278
|
const $ = c(9);
|
|
267
|
-
if ($[0] !== "
|
|
279
|
+
if ($[0] !== "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6") {
|
|
268
280
|
for (let $i = 0; $i < 9; $i += 1) {
|
|
269
281
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
270
282
|
}
|
|
271
|
-
$[0] = "
|
|
283
|
+
$[0] = "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6";
|
|
272
284
|
}
|
|
273
285
|
let className;
|
|
274
286
|
let restProps;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const keyboardFocusableAttrName = "data-keyboard-focusable";
|
|
2
|
+
export declare function focusRow(row: HTMLTableRowElement): void;
|
|
3
|
+
export declare function onKeyDownTbody(e: React.KeyboardEvent<HTMLTableSectionElement>): void;
|
|
4
|
+
export declare function onBlurCaptureTbody(e: React.FocusEvent<HTMLTableSectionElement>): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const keyboardFocusableAttrName = 'data-keyboard-focusable';
|
|
2
|
+
const temporaryTabIndexAttrName = 'data-temporary-tabindex';
|
|
3
|
+
function focusRow(row) {
|
|
4
|
+
if (!row.hasAttribute('tabindex')) {
|
|
5
|
+
row.tabIndex = 0;
|
|
6
|
+
row.setAttribute(temporaryTabIndexAttrName, '');
|
|
7
|
+
}
|
|
8
|
+
row.focus();
|
|
9
|
+
}
|
|
10
|
+
function onKeyDownTbody(e) {
|
|
11
|
+
if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const tbody = e.currentTarget;
|
|
15
|
+
const currentRow = e.target.closest('tr');
|
|
16
|
+
if (!(currentRow instanceof HTMLTableRowElement) || currentRow.parentElement !== tbody) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let candidate = currentRow;
|
|
20
|
+
while (candidate) {
|
|
21
|
+
candidate = e.key === 'ArrowUp' ? candidate.previousElementSibling : candidate.nextElementSibling;
|
|
22
|
+
if (candidate?.hasAttribute(keyboardFocusableAttrName)) {
|
|
23
|
+
focusRow(candidate);
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function onBlurCaptureTbody(e) {
|
|
30
|
+
const tbody = e.currentTarget;
|
|
31
|
+
if (!(e.target instanceof HTMLTableRowElement) || e.target.parentElement !== tbody) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const row = e.target;
|
|
35
|
+
if (row.hasAttribute(temporaryTabIndexAttrName)) {
|
|
36
|
+
row.removeAttribute('tabindex');
|
|
37
|
+
row.removeAttribute(temporaryTabIndexAttrName);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { focusRow, keyboardFocusableAttrName, onBlurCaptureTbody, onKeyDownTbody };
|
|
@@ -11,12 +11,12 @@ interface Spacer {
|
|
|
11
11
|
height: number;
|
|
12
12
|
key: string;
|
|
13
13
|
}
|
|
14
|
-
export declare function useTableVirtualize({ enabled, length, scrollerRef, tableRef, estimateHeight, lookaheadPx, retentionMarginPx, minScrollAndResizeDeltaPx, }: {
|
|
14
|
+
export declare function useTableVirtualize<T>({ enabled, data, data: { length }, scrollerRef, tableRef, estimateHeight, lookaheadPx, retentionMarginPx, minScrollAndResizeDeltaPx, }: {
|
|
15
15
|
enabled: boolean;
|
|
16
|
-
|
|
16
|
+
data: T[];
|
|
17
17
|
scrollerRef: RefObject<HTMLElement | null> | undefined;
|
|
18
18
|
tableRef: RefObject<HTMLTableElement | null>;
|
|
19
|
-
estimateHeight: (index: number) => number;
|
|
19
|
+
estimateHeight: (item: T, index: number, items: T[]) => number;
|
|
20
20
|
lookaheadPx: number;
|
|
21
21
|
retentionMarginPx: number;
|
|
22
22
|
minScrollAndResizeDeltaPx: number;
|