@jetbrains/ring-ui-built 8.0.0-beta.4 → 8.0.0-beta.5
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/alert.js +3 -0
- package/components/_helpers/caption.js +1 -1
- package/components/_helpers/header.js +1 -1
- package/components/_helpers/table.js +1 -1
- package/components/alert/alert-actions.d.ts +4 -0
- package/components/alert/alert-actions.js +51 -0
- package/components/alert/alert-heading.d.ts +4 -0
- package/components/alert/alert-heading.js +62 -0
- package/components/alert/alert.d.ts +14 -1
- package/components/alert/alert.js +43 -25
- package/components/alert-service/alert-service.d.ts +2 -1
- package/components/alert-service/alert-service.js +15 -5
- package/components/auth/auth-core.d.ts +5 -9
- package/components/auth/auth-core.js +71 -17
- package/components/auth/auth.js +7 -1
- package/components/auth/down-notification.js +7 -1
- package/components/auth/storage.js +7 -1
- package/components/clipboard/clipboard.js +7 -1
- package/components/date-picker/consts.d.ts +1 -0
- package/components/date-picker/date-input.js +3 -2
- package/components/header/header.js +7 -1
- package/components/header/smart-profile.js +7 -1
- package/components/http/http.d.ts +2 -2
- package/components/http/http.js +2 -2
- package/components/i18n/i18n.d.ts +1 -0
- package/components/i18n/i18n.js +2 -0
- package/components/internal/reorder-animation-context.js +159 -0
- package/components/internal/reorder-handle.js +750 -0
- package/components/internal/reorder-layout-context.js +141 -0
- package/components/internal/table-header.js +221 -645
- package/components/internal/{virtual-items.js → virtualization.js} +29 -14
- package/components/old-browsers-message/white-list.js +2 -2
- package/components/storage/storage-local.js +7 -1
- package/components/storage/storage.js +7 -1
- package/components/style.css +1 -1
- package/components/table/default-item-renderer.d.ts +7 -1
- package/components/table/default-item-renderer.js +119 -67
- package/components/table/internal/reorder-animation-context.d.ts +21 -0
- package/components/table/internal/reorder-handle.d.ts +9 -0
- package/components/table/internal/reorder-layout-context.d.ts +16 -0
- package/components/table/internal/table-header.d.ts +1 -4
- package/components/table/internal/{virtual-items.d.ts → virtualization.d.ts} +10 -3
- package/components/table/item-virtualization.d.ts +5 -3
- package/components/table/item-virtualization.js +13 -11
- package/components/table/reorder-animation.d.ts +37 -0
- package/components/table/reorder-animation.js +18 -0
- package/components/table/reorder-item-layout.d.ts +32 -0
- package/components/table/reorder-item-layout.js +57 -0
- package/components/table/table-const.d.ts +0 -32
- package/components/table/table-const.js +1 -8
- package/components/table/table-primitives.d.ts +43 -0
- package/components/table/table-primitives.js +62 -5
- package/components/table/table-props.d.ts +29 -5
- package/components/table/table.d.ts +31 -5
- package/components/table/table.js +177 -170
- package/components/user-agreement/service.js +7 -1
- package/components/user-card/card.js +7 -1
- package/components/user-card/smart-user-card-tooltip.d.ts +1 -1
- package/components/user-card/smart-user-card-tooltip.js +7 -1
- package/components/user-card/tooltip.js +7 -1
- package/components/user-card/user-card.js +7 -1
- package/components/util-stories.d.ts +2 -2
- package/package.json +2 -2
- package/components/internal/column-animation.js +0 -133
- package/components/table/internal/column-animation.d.ts +0 -16
|
@@ -32,6 +32,12 @@ export interface DefaultItemRendererProps {
|
|
|
32
32
|
* and track the visibility yourself.
|
|
33
33
|
*/
|
|
34
34
|
noItemVirtualization?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* When set to `true`, does not report the item's boundaries to the reorder system.
|
|
37
|
+
* Useful when you include `DefaultItemRenderer` as a part of a custom row renderer
|
|
38
|
+
* that registers boundaries itself.
|
|
39
|
+
*/
|
|
40
|
+
noReorderLayout?: boolean;
|
|
35
41
|
}
|
|
36
42
|
/**
|
|
37
43
|
* Standard component for rendering a table row.
|
|
@@ -46,4 +52,4 @@ export interface DefaultItemRendererProps {
|
|
|
46
52
|
* accessible controls, such as checkboxes or buttons with accessible
|
|
47
53
|
* labels.
|
|
48
54
|
*/
|
|
49
|
-
export declare function DefaultItemRenderer<T>({ index, keyboardFocusable, clickable, selected, level, noItemVirtualization, ref: userRef, className, ...restProps }: DefaultItemRendererProps & ComponentPropsWithRef<'tr'>): import("react").JSX.Element | null;
|
|
55
|
+
export declare function DefaultItemRenderer<T>({ index, keyboardFocusable, clickable, selected, level, noItemVirtualization, noReorderLayout, ref: userRef, className, ...restProps }: DefaultItemRendererProps & ComponentPropsWithRef<'tr'>): import("react").JSX.Element | null;
|
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
import { c } from 'react/compiler-runtime';
|
|
2
2
|
import { useRef, use } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { TablePropsContext
|
|
4
|
+
import { TablePropsContext } from './table-const.js';
|
|
5
5
|
import { useComposedRef } from '../global/compose-refs.js';
|
|
6
6
|
import { useItemVirtualization } from './item-virtualization.js';
|
|
7
7
|
import { TableRow, TableCell } from './table-primitives.js';
|
|
8
|
+
import { ReorderAnimationContext } from '../internal/reorder-animation-context.js';
|
|
9
|
+
import { useReorderItemLayout } from './reorder-item-layout.js';
|
|
8
10
|
import { s as styles } from '../_helpers/table.js';
|
|
9
11
|
import { jsx } from 'react/jsx-runtime';
|
|
10
12
|
import 'memoize-one';
|
|
13
|
+
import '../internal/virtualization.js';
|
|
11
14
|
import '../global/intersection-observer-context.js';
|
|
12
|
-
import '../internal/virtual-items.js';
|
|
13
15
|
import '../global/schedule-with-cleanup.js';
|
|
16
|
+
import '../internal/reorder-handle.js';
|
|
17
|
+
import '@jetbrains/icons/drag-12px';
|
|
18
|
+
import '../icon/icon.js';
|
|
19
|
+
import 'util-deprecate';
|
|
20
|
+
import '../icon/icon.constants.js';
|
|
21
|
+
import '../_helpers/icon-svg.js';
|
|
22
|
+
import '../global/memoize.js';
|
|
23
|
+
import '../global/parse-css-duration.js';
|
|
24
|
+
import '../internal/reorder-layout-context.js';
|
|
14
25
|
|
|
15
26
|
function DefaultItemRenderer(t0) {
|
|
16
|
-
const $ = c(
|
|
17
|
-
if ($[0] !== "
|
|
18
|
-
for (let $i = 0; $i <
|
|
27
|
+
const $ = c(47);
|
|
28
|
+
if ($[0] !== "bc245d0d0a3699b5ab0d750beda2a663dcc05f6d122b039db369f77f976f7ee8") {
|
|
29
|
+
for (let $i = 0; $i < 47; $i += 1) {
|
|
19
30
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
20
31
|
}
|
|
21
|
-
$[0] = "
|
|
32
|
+
$[0] = "bc245d0d0a3699b5ab0d750beda2a663dcc05f6d122b039db369f77f976f7ee8";
|
|
22
33
|
}
|
|
23
34
|
let className;
|
|
24
35
|
let clickable;
|
|
@@ -26,6 +37,7 @@ function DefaultItemRenderer(t0) {
|
|
|
26
37
|
let keyboardFocusable;
|
|
27
38
|
let level;
|
|
28
39
|
let noItemVirtualization;
|
|
40
|
+
let noReorderLayout;
|
|
29
41
|
let restProps;
|
|
30
42
|
let selected;
|
|
31
43
|
let userRef;
|
|
@@ -37,6 +49,7 @@ function DefaultItemRenderer(t0) {
|
|
|
37
49
|
selected,
|
|
38
50
|
level,
|
|
39
51
|
noItemVirtualization,
|
|
52
|
+
noReorderLayout,
|
|
40
53
|
ref: userRef,
|
|
41
54
|
className,
|
|
42
55
|
...restProps
|
|
@@ -48,9 +61,10 @@ function DefaultItemRenderer(t0) {
|
|
|
48
61
|
$[5] = keyboardFocusable;
|
|
49
62
|
$[6] = level;
|
|
50
63
|
$[7] = noItemVirtualization;
|
|
51
|
-
$[8] =
|
|
52
|
-
$[9] =
|
|
53
|
-
$[10] =
|
|
64
|
+
$[8] = noReorderLayout;
|
|
65
|
+
$[9] = restProps;
|
|
66
|
+
$[10] = selected;
|
|
67
|
+
$[11] = userRef;
|
|
54
68
|
} else {
|
|
55
69
|
className = $[2];
|
|
56
70
|
clickable = $[3];
|
|
@@ -58,66 +72,102 @@ function DefaultItemRenderer(t0) {
|
|
|
58
72
|
keyboardFocusable = $[5];
|
|
59
73
|
level = $[6];
|
|
60
74
|
noItemVirtualization = $[7];
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
75
|
+
noReorderLayout = $[8];
|
|
76
|
+
restProps = $[9];
|
|
77
|
+
selected = $[10];
|
|
78
|
+
userRef = $[11];
|
|
64
79
|
}
|
|
65
80
|
const localRef = useRef(null);
|
|
66
81
|
const composedRef = useComposedRef(userRef, localRef);
|
|
67
82
|
let t1;
|
|
68
|
-
if ($[
|
|
83
|
+
if ($[12] !== noItemVirtualization) {
|
|
69
84
|
t1 = (t2, _i, t3) => {
|
|
70
85
|
const [isIntersecting] = t2;
|
|
71
86
|
const [element] = t3;
|
|
72
87
|
return isIntersecting === false && !noItemVirtualization && element?.isConnected && !element.contains(document.activeElement) && !element.previousElementSibling?.contains(document.activeElement) && !element.nextElementSibling?.contains(document.activeElement) ? element.getBoundingClientRect().height : undefined;
|
|
73
88
|
};
|
|
74
|
-
$[
|
|
75
|
-
$[
|
|
89
|
+
$[12] = noItemVirtualization;
|
|
90
|
+
$[13] = t1;
|
|
76
91
|
} else {
|
|
77
|
-
t1 = $[
|
|
92
|
+
t1 = $[13];
|
|
78
93
|
}
|
|
79
94
|
const t2 = t1;
|
|
80
95
|
let t3;
|
|
81
|
-
if ($[
|
|
96
|
+
if ($[14] !== index || $[15] !== t2) {
|
|
82
97
|
t3 = {
|
|
83
98
|
index,
|
|
84
99
|
refs: localRef,
|
|
85
100
|
onIntersectionChange: t2
|
|
86
101
|
};
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
102
|
+
$[14] = index;
|
|
103
|
+
$[15] = t2;
|
|
104
|
+
$[16] = t3;
|
|
90
105
|
} else {
|
|
91
|
-
t3 = $[
|
|
106
|
+
t3 = $[16];
|
|
92
107
|
}
|
|
93
108
|
useItemVirtualization(t3);
|
|
109
|
+
let t4;
|
|
110
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
111
|
+
t4 = () => {
|
|
112
|
+
var _r$top, _r$bottom;
|
|
113
|
+
const r = localRef.current?.getBoundingClientRect();
|
|
114
|
+
return {
|
|
115
|
+
start: (_r$top = r?.top) !== null && _r$top !== void 0 ? _r$top : 0,
|
|
116
|
+
end: (_r$bottom = r?.bottom) !== null && _r$bottom !== void 0 ? _r$bottom : 0
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
$[17] = t4;
|
|
120
|
+
} else {
|
|
121
|
+
t4 = $[17];
|
|
122
|
+
}
|
|
123
|
+
let t5;
|
|
124
|
+
if ($[18] !== index || $[19] !== noReorderLayout) {
|
|
125
|
+
t5 = {
|
|
126
|
+
disabled: noReorderLayout,
|
|
127
|
+
index,
|
|
128
|
+
getBounds: t4
|
|
129
|
+
};
|
|
130
|
+
$[18] = index;
|
|
131
|
+
$[19] = noReorderLayout;
|
|
132
|
+
$[20] = t5;
|
|
133
|
+
} else {
|
|
134
|
+
t5 = $[20];
|
|
135
|
+
}
|
|
136
|
+
useReorderItemLayout(t5);
|
|
94
137
|
const tableProps = use(TablePropsContext);
|
|
95
138
|
if (!tableProps) {
|
|
96
139
|
return null;
|
|
97
140
|
}
|
|
98
|
-
const
|
|
141
|
+
const {
|
|
142
|
+
reorderAnimation
|
|
143
|
+
} = use(ReorderAnimationContext);
|
|
144
|
+
const isAnimatedItem = reorderAnimation?.direction === "items" && reorderAnimation.index === index;
|
|
145
|
+
const animatedColumnIndex = reorderAnimation?.direction === "columns" ? reorderAnimation.index : undefined;
|
|
146
|
+
const animateClassName = reorderAnimation?.className;
|
|
99
147
|
const {
|
|
100
148
|
data,
|
|
101
149
|
columns
|
|
102
150
|
} = tableProps;
|
|
103
151
|
const item = data[index];
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
152
|
+
const t6 = clickable && styles.clickableRow;
|
|
153
|
+
const t7 = selected && styles.selectedRow;
|
|
154
|
+
const t8 = isAnimatedItem && animateClassName;
|
|
155
|
+
let t9;
|
|
156
|
+
if ($[21] !== className || $[22] !== t6 || $[23] !== t7 || $[24] !== t8) {
|
|
157
|
+
t9 = classNames(className, t6, t7, t8);
|
|
158
|
+
$[21] = className;
|
|
159
|
+
$[22] = t6;
|
|
160
|
+
$[23] = t7;
|
|
161
|
+
$[24] = t8;
|
|
162
|
+
$[25] = t9;
|
|
113
163
|
} else {
|
|
114
|
-
|
|
164
|
+
t9 = $[25];
|
|
115
165
|
}
|
|
116
|
-
let
|
|
117
|
-
if ($[
|
|
118
|
-
let
|
|
119
|
-
if ($[
|
|
120
|
-
|
|
166
|
+
let t10;
|
|
167
|
+
if ($[26] !== animateClassName || $[27] !== animatedColumnIndex || $[28] !== columns || $[29] !== data || $[30] !== index || $[31] !== item || $[32] !== level) {
|
|
168
|
+
let t11;
|
|
169
|
+
if ($[34] !== animateClassName || $[35] !== animatedColumnIndex || $[36] !== data || $[37] !== index || $[38] !== item || $[39] !== level) {
|
|
170
|
+
t11 = (column, columnIndex) => {
|
|
121
171
|
var _column$renderCell;
|
|
122
172
|
const {
|
|
123
173
|
key,
|
|
@@ -125,52 +175,54 @@ function DefaultItemRenderer(t0) {
|
|
|
125
175
|
indent
|
|
126
176
|
} = column;
|
|
127
177
|
return /*#__PURE__*/jsx(TableCell, {
|
|
128
|
-
className: classNames(columnIndex ===
|
|
178
|
+
className: classNames(columnIndex === animatedColumnIndex && animateClassName, typeof tdClassName === "function" ? tdClassName(item, index, data) : tdClassName),
|
|
129
179
|
style: indent && level != null && level > 0 ? {
|
|
130
180
|
paddingInlineStart: `${level * 24}px`
|
|
131
181
|
} : undefined,
|
|
132
182
|
children: (_column$renderCell = column.renderCell?.(item, index, data)) !== null && _column$renderCell !== void 0 ? _column$renderCell : getDefaultCellValue(item, columnIndex, key)
|
|
133
183
|
}, key);
|
|
134
184
|
};
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
185
|
+
$[34] = animateClassName;
|
|
186
|
+
$[35] = animatedColumnIndex;
|
|
187
|
+
$[36] = data;
|
|
188
|
+
$[37] = index;
|
|
189
|
+
$[38] = item;
|
|
190
|
+
$[39] = level;
|
|
191
|
+
$[40] = t11;
|
|
141
192
|
} else {
|
|
142
|
-
|
|
193
|
+
t11 = $[40];
|
|
143
194
|
}
|
|
144
|
-
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
195
|
+
t10 = columns.map(t11);
|
|
196
|
+
$[26] = animateClassName;
|
|
197
|
+
$[27] = animatedColumnIndex;
|
|
198
|
+
$[28] = columns;
|
|
199
|
+
$[29] = data;
|
|
200
|
+
$[30] = index;
|
|
201
|
+
$[31] = item;
|
|
202
|
+
$[32] = level;
|
|
203
|
+
$[33] = t10;
|
|
152
204
|
} else {
|
|
153
|
-
|
|
205
|
+
t10 = $[33];
|
|
154
206
|
}
|
|
155
|
-
let
|
|
156
|
-
if ($[
|
|
157
|
-
|
|
207
|
+
let t11;
|
|
208
|
+
if ($[41] !== composedRef || $[42] !== keyboardFocusable || $[43] !== restProps || $[44] !== t10 || $[45] !== t9) {
|
|
209
|
+
t11 = /*#__PURE__*/jsx(TableRow, {
|
|
158
210
|
ref: composedRef,
|
|
159
211
|
keyboardFocusable: keyboardFocusable,
|
|
160
|
-
className:
|
|
212
|
+
className: t9,
|
|
161
213
|
...restProps,
|
|
162
|
-
children:
|
|
214
|
+
children: t10
|
|
163
215
|
});
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
216
|
+
$[41] = composedRef;
|
|
217
|
+
$[42] = keyboardFocusable;
|
|
218
|
+
$[43] = restProps;
|
|
219
|
+
$[44] = t10;
|
|
220
|
+
$[45] = t9;
|
|
221
|
+
$[46] = t11;
|
|
170
222
|
} else {
|
|
171
|
-
|
|
223
|
+
t11 = $[46];
|
|
172
224
|
}
|
|
173
|
-
return
|
|
225
|
+
return t11;
|
|
174
226
|
}
|
|
175
227
|
function getDefaultCellValue(item, columnIndex, columnKey) {
|
|
176
228
|
if (Array.isArray(item)) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { Column } from '../table-props';
|
|
3
|
+
import type { ReorderAnimation } from '../reorder-animation';
|
|
4
|
+
export interface ReorderSpec {
|
|
5
|
+
direction: 'columns' | 'items';
|
|
6
|
+
fromIndex: number;
|
|
7
|
+
insertionIndex: number;
|
|
8
|
+
}
|
|
9
|
+
interface ReorderAnimationContextValue {
|
|
10
|
+
reorderAnimation: ReorderAnimation | null;
|
|
11
|
+
expectReorder: (reorderSpec: ReorderSpec) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const ReorderAnimationContext: import("react").Context<ReorderAnimationContextValue>;
|
|
14
|
+
export declare function useReorderAnimationContextValue<T>({ noColumnReorderAnimation, noItemReorderAnimation, tableRef, data, columns, }: {
|
|
15
|
+
noColumnReorderAnimation: boolean | undefined;
|
|
16
|
+
noItemReorderAnimation: boolean | undefined;
|
|
17
|
+
tableRef: RefObject<HTMLTableElement | null>;
|
|
18
|
+
data: readonly T[];
|
|
19
|
+
columns: readonly Column<T>[];
|
|
20
|
+
}): ReorderAnimationContextValue;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef } from 'react';
|
|
2
|
+
import type { DragState } from '../table-primitives';
|
|
3
|
+
export declare function ReorderHandle<T>({ direction, index, noDragFrame, noHandleTranslate, onUserDrag, ref: userRef, className, onKeyDown, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onLostPointerCapture, ...restProps }: {
|
|
4
|
+
direction: 'columns' | 'items';
|
|
5
|
+
index: number;
|
|
6
|
+
noDragFrame?: boolean;
|
|
7
|
+
noHandleTranslate?: boolean;
|
|
8
|
+
onUserDrag?: (state: DragState) => void;
|
|
9
|
+
} & ComponentPropsWithRef<'button'>): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface ItemBounds {
|
|
2
|
+
start: number;
|
|
3
|
+
end: number;
|
|
4
|
+
}
|
|
5
|
+
export interface InsertionPoint {
|
|
6
|
+
itemIndex: number;
|
|
7
|
+
after: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface ReorderLayoutContextValue {
|
|
10
|
+
registerReorderItem(index: number, getBounds: () => ItemBounds): () => void;
|
|
11
|
+
getItemBounds(index: number): ItemBounds | undefined;
|
|
12
|
+
getClosestInsertionPoint(clientOffset: number, canReorder: (insertionIndex: number) => boolean): InsertionPoint | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare const ReorderLayoutContext: import("react").Context<ReorderLayoutContextValue>;
|
|
15
|
+
export declare function useReorderLayoutContextValue(): ReorderLayoutContextValue;
|
|
16
|
+
export {};
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function TableHeader<T>({ expectColumnReorder }: {
|
|
3
|
-
expectColumnReorder: ExpectColumnReorder;
|
|
4
|
-
}): import("react").JSX.Element | null;
|
|
1
|
+
export declare function TableHeader<T>(): import("react").JSX.Element | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
|
+
import { type IntersectionObserverHandle } from '../../global/intersection-observer-context';
|
|
2
3
|
export type VirtualItem = MaterializedItem | Spacer;
|
|
3
4
|
interface MaterializedItem {
|
|
4
5
|
type: 'materialized';
|
|
@@ -12,7 +13,11 @@ interface Spacer {
|
|
|
12
13
|
key: string;
|
|
13
14
|
}
|
|
14
15
|
type CollapseItemIntoSpacerCallback = (index: number, height: number) => void;
|
|
15
|
-
|
|
16
|
+
interface VirtualizationContextValue {
|
|
17
|
+
intersectionObserverHandle: IntersectionObserverHandle;
|
|
18
|
+
collapseItemIntoSpacer: CollapseItemIntoSpacerCallback;
|
|
19
|
+
}
|
|
20
|
+
export declare const VirtualizationContext: import("react").Context<VirtualizationContextValue>;
|
|
16
21
|
export declare function useVirtualItems<T>({ enabled, data, data: { length }, scrollerRef, tableRef, estimateHeight, lookaheadPx, retentionMarginPx, minScrollAndResizeDeltaPx, }: {
|
|
17
22
|
enabled: boolean;
|
|
18
23
|
data: readonly T[];
|
|
@@ -24,8 +29,10 @@ export declare function useVirtualItems<T>({ enabled, data, data: { length }, sc
|
|
|
24
29
|
minScrollAndResizeDeltaPx: number;
|
|
25
30
|
}): {
|
|
26
31
|
virtualItems: VirtualItem[];
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
virtualizationContextValue: {
|
|
33
|
+
intersectionObserverHandle: IntersectionObserverHandle;
|
|
34
|
+
collapseItemIntoSpacer: (index: number, height: number) => void;
|
|
35
|
+
};
|
|
29
36
|
};
|
|
30
37
|
export declare function SpacerRow({ spacer: { from, to, height }, colSpan }: {
|
|
31
38
|
spacer: Spacer;
|
|
@@ -13,13 +13,15 @@ export declare function useItemVirtualization({ index, refs, onIntersectionChang
|
|
|
13
13
|
* When multiple elements are provided, the virtualization callback receives
|
|
14
14
|
* the intersection state of all of them.
|
|
15
15
|
*
|
|
16
|
-
* If you pass multiple refs,
|
|
17
|
-
*
|
|
16
|
+
* If you pass multiple refs, pass a stable array reference to avoid restarting
|
|
17
|
+
* observation on every render — for example, memoize it with `useMemo()`,
|
|
18
|
+
* unless you use the React Compiler.
|
|
18
19
|
*/
|
|
19
20
|
refs: RefObject<HTMLElement | null> | RefObject<HTMLElement | null>[];
|
|
20
21
|
/**
|
|
21
22
|
* Invoked when the `isIntersecting` state of the observed elements changes.
|
|
22
|
-
*
|
|
23
|
+
* Pass a stable function reference to avoid restarting observation on every render —
|
|
24
|
+
* for example, wrap it with `useCallback()`, unless you use the React Compiler.
|
|
23
25
|
*
|
|
24
26
|
* @param intersectionStates - Current intersection state of every observed element.
|
|
25
27
|
* Entries are initially `undefined` until the corresponding element
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c } from 'react/compiler-runtime';
|
|
2
2
|
import { use, useEffect } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { VirtualizationContext } from '../internal/virtualization.js';
|
|
4
|
+
import '../global/intersection-observer-context.js';
|
|
5
5
|
import '../global/schedule-with-cleanup.js';
|
|
6
6
|
import '../_helpers/table.js';
|
|
7
7
|
import 'react/jsx-runtime';
|
|
@@ -11,22 +11,24 @@ import 'react/jsx-runtime';
|
|
|
11
11
|
*/
|
|
12
12
|
function useItemVirtualization(t0) {
|
|
13
13
|
const $ = c(8);
|
|
14
|
-
if ($[0] !== "
|
|
14
|
+
if ($[0] !== "28d3fc0a1c743c2e72a27a83caad5b78c5438f38b7abdd065da2a832e4f9fcec") {
|
|
15
15
|
for (let $i = 0; $i < 8; $i += 1) {
|
|
16
16
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
17
17
|
}
|
|
18
|
-
$[0] = "
|
|
18
|
+
$[0] = "28d3fc0a1c743c2e72a27a83caad5b78c5438f38b7abdd065da2a832e4f9fcec";
|
|
19
19
|
}
|
|
20
20
|
const {
|
|
21
21
|
index,
|
|
22
22
|
refs,
|
|
23
23
|
onIntersectionChange
|
|
24
24
|
} = t0;
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const {
|
|
26
|
+
intersectionObserverHandle,
|
|
27
|
+
collapseItemIntoSpacer
|
|
28
|
+
} = use(VirtualizationContext);
|
|
27
29
|
let t1;
|
|
28
30
|
let t2;
|
|
29
|
-
if ($[1] !== collapseItemIntoSpacer || $[2] !==
|
|
31
|
+
if ($[1] !== collapseItemIntoSpacer || $[2] !== index || $[3] !== intersectionObserverHandle || $[4] !== onIntersectionChange || $[5] !== refs) {
|
|
30
32
|
t1 = () => {
|
|
31
33
|
const intersectionStates = Array.isArray(refs) ? refs.map(_temp) : [undefined];
|
|
32
34
|
const elements = Array.isArray(refs) ? refs.map(_temp2) : [refs.current];
|
|
@@ -35,7 +37,7 @@ function useItemVirtualization(t0) {
|
|
|
35
37
|
if (!element) {
|
|
36
38
|
return;
|
|
37
39
|
}
|
|
38
|
-
const cleanup =
|
|
40
|
+
const cleanup = intersectionObserverHandle.observe(element, isIntersecting => {
|
|
39
41
|
intersectionStates[elementIndex] = isIntersecting;
|
|
40
42
|
const height = onIntersectionChange(intersectionStates, elementIndex, elements);
|
|
41
43
|
if (height != null) {
|
|
@@ -46,10 +48,10 @@ function useItemVirtualization(t0) {
|
|
|
46
48
|
});
|
|
47
49
|
return () => cleanups.forEach(_temp3);
|
|
48
50
|
};
|
|
49
|
-
t2 = [collapseItemIntoSpacer,
|
|
51
|
+
t2 = [collapseItemIntoSpacer, intersectionObserverHandle, index, onIntersectionChange, refs];
|
|
50
52
|
$[1] = collapseItemIntoSpacer;
|
|
51
|
-
$[2] =
|
|
52
|
-
$[3] =
|
|
53
|
+
$[2] = index;
|
|
54
|
+
$[3] = intersectionObserverHandle;
|
|
53
55
|
$[4] = onIntersectionChange;
|
|
54
56
|
$[5] = refs;
|
|
55
57
|
$[6] = t1;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Information about a column or item currently being animated after reorder.
|
|
3
|
+
*
|
|
4
|
+
* Available through {@link useReorderAnimation} to allow custom cell
|
|
5
|
+
* renderers to animate reordered columns and items consistently with the default
|
|
6
|
+
* table renderer.
|
|
7
|
+
*/
|
|
8
|
+
export interface ReorderAnimation {
|
|
9
|
+
/**
|
|
10
|
+
* What is animated: columns or items (rows).
|
|
11
|
+
*/
|
|
12
|
+
direction: 'columns' | 'items';
|
|
13
|
+
/**
|
|
14
|
+
* Index of the column or item being animated.
|
|
15
|
+
*/
|
|
16
|
+
index: number;
|
|
17
|
+
/**
|
|
18
|
+
* Current animation phase.
|
|
19
|
+
*/
|
|
20
|
+
phase: 'initial' | 'fade-out';
|
|
21
|
+
/**
|
|
22
|
+
* CSS class to apply to the animated row, cell, or another element used to
|
|
23
|
+
* render the animation on this phase.
|
|
24
|
+
*
|
|
25
|
+
* The class sets `background-color` and `transition`. If your custom styles
|
|
26
|
+
* also define `transition` on the same element, they may conflict with the
|
|
27
|
+
* animation.
|
|
28
|
+
*/
|
|
29
|
+
className: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Provides information about the currently animated column or item after reorder.
|
|
33
|
+
*
|
|
34
|
+
* Use in a custom cell renderer to animate reordered columns and items
|
|
35
|
+
* consistently with the default table renderer.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useReorderAnimation(): ReorderAnimation | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { use } from 'react';
|
|
2
|
+
import { ReorderAnimationContext } from '../internal/reorder-animation-context.js';
|
|
3
|
+
import 'react/compiler-runtime';
|
|
4
|
+
import '../global/parse-css-duration.js';
|
|
5
|
+
import '../global/schedule-with-cleanup.js';
|
|
6
|
+
import '../_helpers/table.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Provides information about the currently animated column or item after reorder.
|
|
10
|
+
*
|
|
11
|
+
* Use in a custom cell renderer to animate reordered columns and items
|
|
12
|
+
* consistently with the default table renderer.
|
|
13
|
+
*/
|
|
14
|
+
function useReorderAnimation() {
|
|
15
|
+
return use(ReorderAnimationContext).reorderAnimation;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { useReorderAnimation };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers the physical boundaries of a custom-rendered item with the reorder
|
|
3
|
+
* system, so that the insertion indicator and insertion point calculation are
|
|
4
|
+
* correct for items that span multiple rows or have non-standard sizing.
|
|
5
|
+
*
|
|
6
|
+
* `DefaultItemRenderer` calls this automatically. Use this hook in a custom item
|
|
7
|
+
* renderer when the default boundary measurement is insufficient — for example,
|
|
8
|
+
* when the item spans multiple rows, or when you don't use
|
|
9
|
+
* the `DefaultItemRenderer` at all.
|
|
10
|
+
*
|
|
11
|
+
* If you include `DefaultItemRenderer` inside your custom renderer, set its
|
|
12
|
+
* `noReorderLayout` prop to `true` to prevent double registration.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useReorderItemLayout({ disabled, index, getBounds, }: {
|
|
15
|
+
/**
|
|
16
|
+
* When `true`, the item is not registered. Use to disable without violating
|
|
17
|
+
* the rules of hooks.
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Index of the item in the `data` array.
|
|
22
|
+
*/
|
|
23
|
+
index: number;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the item's top and bottom client coordinates (in pixels, relative
|
|
26
|
+
* to the viewport).
|
|
27
|
+
*/
|
|
28
|
+
getBounds: () => {
|
|
29
|
+
start: number;
|
|
30
|
+
end: number;
|
|
31
|
+
};
|
|
32
|
+
}): void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { use, useEffect } from 'react';
|
|
3
|
+
import { ReorderLayoutContext } from '../internal/reorder-layout-context.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Registers the physical boundaries of a custom-rendered item with the reorder
|
|
7
|
+
* system, so that the insertion indicator and insertion point calculation are
|
|
8
|
+
* correct for items that span multiple rows or have non-standard sizing.
|
|
9
|
+
*
|
|
10
|
+
* `DefaultItemRenderer` calls this automatically. Use this hook in a custom item
|
|
11
|
+
* renderer when the default boundary measurement is insufficient — for example,
|
|
12
|
+
* when the item spans multiple rows, or when you don't use
|
|
13
|
+
* the `DefaultItemRenderer` at all.
|
|
14
|
+
*
|
|
15
|
+
* If you include `DefaultItemRenderer` inside your custom renderer, set its
|
|
16
|
+
* `noReorderLayout` prop to `true` to prevent double registration.
|
|
17
|
+
*/
|
|
18
|
+
function useReorderItemLayout(t0) {
|
|
19
|
+
const $ = c(7);
|
|
20
|
+
if ($[0] !== "f6c2f22ac6ea5d08fd2648f9af507c996aa6e89216dff089c71921e1eb0bbd40") {
|
|
21
|
+
for (let $i = 0; $i < 7; $i += 1) {
|
|
22
|
+
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
23
|
+
}
|
|
24
|
+
$[0] = "f6c2f22ac6ea5d08fd2648f9af507c996aa6e89216dff089c71921e1eb0bbd40";
|
|
25
|
+
}
|
|
26
|
+
const {
|
|
27
|
+
disabled,
|
|
28
|
+
index,
|
|
29
|
+
getBounds
|
|
30
|
+
} = t0;
|
|
31
|
+
const {
|
|
32
|
+
registerReorderItem
|
|
33
|
+
} = use(ReorderLayoutContext);
|
|
34
|
+
let t1;
|
|
35
|
+
let t2;
|
|
36
|
+
if ($[1] !== disabled || $[2] !== getBounds || $[3] !== index || $[4] !== registerReorderItem) {
|
|
37
|
+
t1 = () => {
|
|
38
|
+
if (disabled) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
return registerReorderItem(index, getBounds);
|
|
42
|
+
};
|
|
43
|
+
t2 = [index, getBounds, registerReorderItem, disabled];
|
|
44
|
+
$[1] = disabled;
|
|
45
|
+
$[2] = getBounds;
|
|
46
|
+
$[3] = index;
|
|
47
|
+
$[4] = registerReorderItem;
|
|
48
|
+
$[5] = t1;
|
|
49
|
+
$[6] = t2;
|
|
50
|
+
} else {
|
|
51
|
+
t1 = $[5];
|
|
52
|
+
t2 = $[6];
|
|
53
|
+
}
|
|
54
|
+
useEffect(t1, t2);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { useReorderItemLayout };
|
|
@@ -4,38 +4,6 @@ import type { TableProps } from './table-props';
|
|
|
4
4
|
* Cast to `Context<TableProps<T>>` in usage place.
|
|
5
5
|
*/
|
|
6
6
|
export declare const TablePropsContext: import("react").Context<TableProps<unknown> | null>;
|
|
7
|
-
/**
|
|
8
|
-
* Information about a column reorder animation.
|
|
9
|
-
*
|
|
10
|
-
* Available through {@link ColumnAnimationContext} to allow custom cell
|
|
11
|
-
* renderers to animate reordered columns consistently with the default
|
|
12
|
-
* table renderer.
|
|
13
|
-
*/
|
|
14
|
-
export interface ColumnAnimation {
|
|
15
|
-
/**
|
|
16
|
-
* Index of the column being animated.
|
|
17
|
-
*/
|
|
18
|
-
columnIndex: number;
|
|
19
|
-
/**
|
|
20
|
-
* Current animation phase.
|
|
21
|
-
*/
|
|
22
|
-
phase: 'initial' | 'fade-out';
|
|
23
|
-
/**
|
|
24
|
-
* CSS class to apply to the animated cell or another element used to
|
|
25
|
-
* render the animation.
|
|
26
|
-
*
|
|
27
|
-
* The class only defines the `background-color` and `transition`
|
|
28
|
-
* properties.
|
|
29
|
-
*/
|
|
30
|
-
cellClassName: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Provides information about the currently animated column.
|
|
34
|
-
*
|
|
35
|
-
* Use in a custom cell renderer to animate reordered columns
|
|
36
|
-
* consistently with the default table renderer.
|
|
37
|
-
*/
|
|
38
|
-
export declare const ColumnAnimationContext: import("react").Context<ColumnAnimation | null>;
|
|
39
7
|
/**
|
|
40
8
|
* When a row only contains unformatted single-line text, it will be exactly of this height.
|
|
41
9
|
*/
|