@jetbrains/ring-ui-built 8.0.0-beta.2 → 8.0.0-beta.4
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/heading.js +2 -2
- 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/table.js +1 -1
- package/components/_helpers/theme.js +50 -38
- package/components/alert/alert.js +2 -2
- 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 +2 -2
- 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.d.ts +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/collapsible-group/collapsible-group.d.ts +20 -0
- package/components/collapsible-group/collapsible-group.js +382 -0
- package/components/components/util-stories.js +63 -1
- 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 +4 -5
- 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-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 +68 -63
- package/components/editable-heading/editable-heading.d.ts +1 -2
- package/components/editable-heading/editable-heading.js +127 -113
- 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 +8 -16
- package/components/expand/collapsible-group.js +34 -364
- package/components/footer/footer.js +1 -1
- package/components/global/compose-refs.d.ts +2 -1
- package/components/global/compose-refs.js +44 -8
- package/components/global/create-stateful-context.js +11 -11
- package/components/global/focus-sensor-hoc.js +1 -0
- package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
- package/components/global/focus-with-temporary-tabindex.js +23 -0
- package/components/global/intersection-observer-context.d.ts +31 -11
- package/components/global/intersection-observer-context.js +55 -57
- package/components/global/is-within-interactive-element.d.ts +6 -0
- package/components/global/is-within-interactive-element.js +11 -0
- package/components/global/is-within-navigable-element.d.ts +6 -0
- package/components/global/is-within-navigable-element.js +11 -0
- package/components/global/parse-css-duration.d.ts +5 -0
- package/components/global/parse-css-duration.js +14 -0
- package/components/global/rerender-hoc.d.ts +4 -2
- package/components/global/rerender-hoc.js +11 -24
- package/components/global/schedule-with-cleanup.d.ts +12 -0
- package/components/global/schedule-with-cleanup.js +36 -0
- package/components/{legacy-table/selection.d.ts → global/table-selection.d.ts} +14 -14
- package/components/{legacy-table/selection.js → global/table-selection.js} +4 -4
- package/components/global/theme.d.ts +4 -3
- package/components/global/theme.js +2 -2
- package/components/header/header-icon.js +1 -1
- package/components/header/header.js +2 -2
- 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 +4 -4
- 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.d.ts +1 -1
- package/components/input/input.js +1 -1
- package/components/internal/column-animation.js +133 -0
- package/components/internal/table-header.js +1109 -0
- package/components/internal/virtual-items.js +353 -0
- 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 +4 -4
- 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.d.ts +1 -1
- 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/markdown/markdown.js +2 -2
- package/components/message/message.js +2 -2
- package/components/old-browsers-message/white-list.js +2 -2
- package/components/pager/pager.js +1 -1
- package/components/popup/popup.d.ts +2 -0
- package/components/popup/popup.js +6 -2
- 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.d.ts +1 -1
- package/components/select/select-popup.js +1 -1
- package/components/select/select.d.ts +4 -2
- 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 +35 -11
- package/components/table/default-item-renderer.js +118 -171
- package/components/table/internal/column-animation.d.ts +16 -0
- package/components/table/internal/table-header.d.ts +4 -0
- package/components/table/internal/virtual-items.d.ts +34 -0
- package/components/table/item-virtualization.d.ts +35 -0
- package/components/table/item-virtualization.js +71 -0
- package/components/table/table-const.d.ts +40 -6
- package/components/table/table-const.js +15 -6
- package/components/table/table-primitives.d.ts +21 -0
- package/components/table/table-primitives.js +123 -0
- package/components/table/table-props.d.ts +280 -0
- package/components/table/table-props.js +1 -0
- package/components/table/table.d.ts +205 -224
- package/components/table/table.js +356 -14
- 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 +3 -3
- package/components/upload/upload.d.ts +4 -3
- package/components/upload/upload.js +7 -29
- package/components/user-agreement/service.js +8 -8
- 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/components/util-stories.d.ts +26 -0
- package/package.json +7 -7
- package/components/_helpers/table2.js +0 -3
- package/components/date-picker/use-intersection-observer.d.ts +0 -6
- package/components/date-picker/use-intersection-observer.js +0 -93
- package/components/global/composeRefs.d.ts +0 -6
- package/components/global/composeRefs.js +0 -9
- 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
- package/components/table/table-base.js +0 -311
- package/components/table/table-component.d.ts +0 -53
- package/components/table/table-component.js +0 -316
- package/components/table/table-virtualize.d.ts +0 -32
- package/components/table/table-virtualize.js +0 -330
|
@@ -1,236 +1,183 @@
|
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { TablePropsContext, ColumnAnimationContext } from './table-const.js';
|
|
5
|
+
import { useComposedRef } from '../global/compose-refs.js';
|
|
6
|
+
import { useItemVirtualization } from './item-virtualization.js';
|
|
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
|
-
import '
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
12
|
-
import '
|
|
13
|
-
import '../icon/icon.js';
|
|
14
|
-
import 'util-deprecate';
|
|
15
|
-
import '../icon/icon.constants.js';
|
|
16
|
-
import '../_helpers/icon-svg.js';
|
|
17
|
-
import '../global/memoize.js';
|
|
10
|
+
import 'memoize-one';
|
|
11
|
+
import '../global/intersection-observer-context.js';
|
|
12
|
+
import '../internal/virtual-items.js';
|
|
13
|
+
import '../global/schedule-with-cleanup.js';
|
|
18
14
|
|
|
19
|
-
const INDENT_SIZE = 24;
|
|
20
|
-
/**
|
|
21
|
-
* @see TableProps.renderItem
|
|
22
|
-
*/
|
|
23
15
|
function DefaultItemRenderer(t0) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
for (let $i = 0; $i < 51; $i += 1) {
|
|
16
|
+
const $ = c(39);
|
|
17
|
+
if ($[0] !== "814543263ebfe37ed20c6e2945771deb8a681b9bdb7c32cb1fc590d5f0122c82") {
|
|
18
|
+
for (let $i = 0; $i < 39; $i += 1) {
|
|
28
19
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
29
20
|
}
|
|
30
|
-
$[0] = "
|
|
21
|
+
$[0] = "814543263ebfe37ed20c6e2945771deb8a681b9bdb7c32cb1fc590d5f0122c82";
|
|
31
22
|
}
|
|
32
23
|
let className;
|
|
33
24
|
let clickable;
|
|
34
25
|
let index;
|
|
26
|
+
let keyboardFocusable;
|
|
35
27
|
let level;
|
|
36
|
-
let
|
|
37
|
-
let onKeyDown;
|
|
28
|
+
let noItemVirtualization;
|
|
38
29
|
let restProps;
|
|
30
|
+
let selected;
|
|
39
31
|
let userRef;
|
|
40
32
|
if ($[1] !== t0) {
|
|
41
33
|
({
|
|
42
|
-
ref: userRef,
|
|
43
34
|
index,
|
|
35
|
+
keyboardFocusable,
|
|
44
36
|
clickable,
|
|
37
|
+
selected,
|
|
45
38
|
level,
|
|
39
|
+
noItemVirtualization,
|
|
40
|
+
ref: userRef,
|
|
46
41
|
className,
|
|
47
|
-
onKeyDown,
|
|
48
|
-
onBlur,
|
|
49
42
|
...restProps
|
|
50
43
|
} = t0);
|
|
51
44
|
$[1] = t0;
|
|
52
45
|
$[2] = className;
|
|
53
46
|
$[3] = clickable;
|
|
54
47
|
$[4] = index;
|
|
55
|
-
$[5] =
|
|
56
|
-
$[6] =
|
|
57
|
-
$[7] =
|
|
48
|
+
$[5] = keyboardFocusable;
|
|
49
|
+
$[6] = level;
|
|
50
|
+
$[7] = noItemVirtualization;
|
|
58
51
|
$[8] = restProps;
|
|
59
|
-
$[9] =
|
|
52
|
+
$[9] = selected;
|
|
53
|
+
$[10] = userRef;
|
|
60
54
|
} else {
|
|
61
55
|
className = $[2];
|
|
62
56
|
clickable = $[3];
|
|
63
57
|
index = $[4];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
keyboardFocusable = $[5];
|
|
59
|
+
level = $[6];
|
|
60
|
+
noItemVirtualization = $[7];
|
|
67
61
|
restProps = $[8];
|
|
68
|
-
|
|
62
|
+
selected = $[9];
|
|
63
|
+
userRef = $[10];
|
|
69
64
|
}
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const collapseItemIntoSpacer = useContext(CollapseItemIntoSpacerContext);
|
|
65
|
+
const localRef = useRef(null);
|
|
66
|
+
const composedRef = useComposedRef(userRef, localRef);
|
|
73
67
|
let t1;
|
|
74
|
-
if ($[
|
|
75
|
-
t1 =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
68
|
+
if ($[11] !== noItemVirtualization) {
|
|
69
|
+
t1 = (t2, _i, t3) => {
|
|
70
|
+
const [isIntersecting] = t2;
|
|
71
|
+
const [element] = t3;
|
|
72
|
+
return isIntersecting === false && !noItemVirtualization && element?.isConnected && !element.contains(document.activeElement) && !element.previousElementSibling?.contains(document.activeElement) && !element.nextElementSibling?.contains(document.activeElement) ? element.getBoundingClientRect().height : undefined;
|
|
79
73
|
};
|
|
80
|
-
$[
|
|
81
|
-
$[11] = ref;
|
|
74
|
+
$[11] = noItemVirtualization;
|
|
82
75
|
$[12] = t1;
|
|
83
76
|
} else {
|
|
84
77
|
t1 = $[12];
|
|
85
78
|
}
|
|
86
|
-
|
|
87
|
-
const {
|
|
88
|
-
data,
|
|
89
|
-
columns,
|
|
90
|
-
selection,
|
|
91
|
-
isItemKeyboardFocusable,
|
|
92
|
-
onItemFocus
|
|
93
|
-
} = useContext(TablePropsContext);
|
|
94
|
-
const item = data[index];
|
|
95
|
-
const selected = selection?.isSelected(item);
|
|
96
|
-
let t2;
|
|
97
|
-
if ($[13] !== data || $[14] !== index || $[15] !== isItemKeyboardFocusable || $[16] !== onItemFocus || $[17] !== onKeyDown) {
|
|
98
|
-
t2 = function handleKeyDown(e) {
|
|
99
|
-
onKeyDown?.(e);
|
|
100
|
-
if (!e.defaultPrevented && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
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;
|
|
79
|
+
const t2 = t1;
|
|
120
80
|
let t3;
|
|
121
|
-
if ($[
|
|
122
|
-
t3 =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} else {
|
|
127
|
-
t3 = $[21];
|
|
128
|
-
}
|
|
129
|
-
const focused = t3;
|
|
130
|
-
let t4;
|
|
131
|
-
let t5;
|
|
132
|
-
if ($[22] !== focused || $[23] !== ref) {
|
|
133
|
-
t4 = () => {
|
|
134
|
-
if (focused) {
|
|
135
|
-
ref.current?.focus();
|
|
136
|
-
}
|
|
81
|
+
if ($[13] !== index || $[14] !== t2) {
|
|
82
|
+
t3 = {
|
|
83
|
+
index,
|
|
84
|
+
refs: localRef,
|
|
85
|
+
onIntersectionChange: t2
|
|
137
86
|
};
|
|
138
|
-
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[24] = t4;
|
|
142
|
-
$[25] = t5;
|
|
87
|
+
$[13] = index;
|
|
88
|
+
$[14] = t2;
|
|
89
|
+
$[15] = t3;
|
|
143
90
|
} else {
|
|
144
|
-
|
|
145
|
-
|
|
91
|
+
t3 = $[15];
|
|
92
|
+
}
|
|
93
|
+
useItemVirtualization(t3);
|
|
94
|
+
const tableProps = use(TablePropsContext);
|
|
95
|
+
if (!tableProps) {
|
|
96
|
+
return null;
|
|
146
97
|
}
|
|
147
|
-
|
|
98
|
+
const animatedColumn = use(ColumnAnimationContext);
|
|
99
|
+
const {
|
|
100
|
+
data,
|
|
101
|
+
columns
|
|
102
|
+
} = tableProps;
|
|
103
|
+
const item = data[index];
|
|
104
|
+
const t4 = clickable && styles.clickableRow;
|
|
105
|
+
const t5 = selected && styles.selectedRow;
|
|
148
106
|
let t6;
|
|
149
|
-
if ($[
|
|
150
|
-
t6 =
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
};
|
|
156
|
-
$[26] = data;
|
|
157
|
-
$[27] = focused;
|
|
158
|
-
$[28] = onBlur;
|
|
159
|
-
$[29] = onItemFocus;
|
|
160
|
-
$[30] = t6;
|
|
107
|
+
if ($[16] !== className || $[17] !== t4 || $[18] !== t5) {
|
|
108
|
+
t6 = classNames(className, t4, t5);
|
|
109
|
+
$[16] = className;
|
|
110
|
+
$[17] = t4;
|
|
111
|
+
$[18] = t5;
|
|
112
|
+
$[19] = t6;
|
|
161
113
|
} else {
|
|
162
|
-
t6 = $[
|
|
114
|
+
t6 = $[19];
|
|
163
115
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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
|
+
let t7;
|
|
117
|
+
if ($[20] !== animatedColumn || $[21] !== columns || $[22] !== data || $[23] !== index || $[24] !== item || $[25] !== level) {
|
|
118
|
+
let t8;
|
|
119
|
+
if ($[27] !== animatedColumn || $[28] !== data || $[29] !== index || $[30] !== item || $[31] !== level) {
|
|
120
|
+
t8 = (column, columnIndex) => {
|
|
174
121
|
var _column$renderCell;
|
|
122
|
+
const {
|
|
123
|
+
key,
|
|
124
|
+
tdClassName,
|
|
125
|
+
indent
|
|
126
|
+
} = column;
|
|
175
127
|
return /*#__PURE__*/jsx(TableCell, {
|
|
176
|
-
className:
|
|
177
|
-
style:
|
|
178
|
-
paddingInlineStart: `${level *
|
|
128
|
+
className: classNames(columnIndex === animatedColumn?.columnIndex && animatedColumn.cellClassName, typeof tdClassName === "function" ? tdClassName(item, index, data) : tdClassName),
|
|
129
|
+
style: indent && level != null && level > 0 ? {
|
|
130
|
+
paddingInlineStart: `${level * 24}px`
|
|
179
131
|
} : undefined,
|
|
180
|
-
children: (_column$renderCell = column.renderCell?.(item, index, data)) !== null && _column$renderCell !== void 0 ? _column$renderCell : getDefaultCellValue(item, columnIndex)
|
|
181
|
-
},
|
|
132
|
+
children: (_column$renderCell = column.renderCell?.(item, index, data)) !== null && _column$renderCell !== void 0 ? _column$renderCell : getDefaultCellValue(item, columnIndex, key)
|
|
133
|
+
}, key);
|
|
182
134
|
};
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
135
|
+
$[27] = animatedColumn;
|
|
136
|
+
$[28] = data;
|
|
137
|
+
$[29] = index;
|
|
138
|
+
$[30] = item;
|
|
139
|
+
$[31] = level;
|
|
140
|
+
$[32] = t8;
|
|
188
141
|
} else {
|
|
189
|
-
|
|
142
|
+
t8 = $[32];
|
|
190
143
|
}
|
|
191
|
-
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
144
|
+
t7 = columns.map(t8);
|
|
145
|
+
$[20] = animatedColumn;
|
|
146
|
+
$[21] = columns;
|
|
147
|
+
$[22] = data;
|
|
148
|
+
$[23] = index;
|
|
149
|
+
$[24] = item;
|
|
150
|
+
$[25] = level;
|
|
151
|
+
$[26] = t7;
|
|
198
152
|
} else {
|
|
199
|
-
|
|
153
|
+
t7 = $[26];
|
|
200
154
|
}
|
|
201
|
-
let
|
|
202
|
-
if ($[
|
|
203
|
-
|
|
204
|
-
ref:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
tabIndex: t8,
|
|
208
|
-
onBlur: t9,
|
|
155
|
+
let t8;
|
|
156
|
+
if ($[33] !== composedRef || $[34] !== keyboardFocusable || $[35] !== restProps || $[36] !== t6 || $[37] !== t7) {
|
|
157
|
+
t8 = /*#__PURE__*/jsx(TableRow, {
|
|
158
|
+
ref: composedRef,
|
|
159
|
+
keyboardFocusable: keyboardFocusable,
|
|
160
|
+
className: t6,
|
|
209
161
|
...restProps,
|
|
210
|
-
children:
|
|
162
|
+
children: t7
|
|
211
163
|
});
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[48] = t8;
|
|
219
|
-
$[49] = t9;
|
|
220
|
-
$[50] = t11;
|
|
164
|
+
$[33] = composedRef;
|
|
165
|
+
$[34] = keyboardFocusable;
|
|
166
|
+
$[35] = restProps;
|
|
167
|
+
$[36] = t6;
|
|
168
|
+
$[37] = t7;
|
|
169
|
+
$[38] = t8;
|
|
221
170
|
} else {
|
|
222
|
-
|
|
171
|
+
t8 = $[38];
|
|
223
172
|
}
|
|
224
|
-
return
|
|
173
|
+
return t8;
|
|
225
174
|
}
|
|
226
|
-
function getDefaultCellValue(item, columnIndex) {
|
|
175
|
+
function getDefaultCellValue(item, columnIndex, columnKey) {
|
|
227
176
|
if (Array.isArray(item)) {
|
|
228
|
-
|
|
229
|
-
return String((_item$columnIndex = item[columnIndex]) !== null && _item$columnIndex !== void 0 ? _item$columnIndex : '');
|
|
177
|
+
return String(item[columnIndex]);
|
|
230
178
|
}
|
|
231
179
|
if (item !== null && typeof item === 'object') {
|
|
232
|
-
|
|
233
|
-
return String((_Object$values$column = Object.values(item)[columnIndex]) !== null && _Object$values$column !== void 0 ? _Object$values$column : '');
|
|
180
|
+
return String(item[String(columnKey)]);
|
|
234
181
|
}
|
|
235
182
|
if (columnIndex === 0) {
|
|
236
183
|
return String(item);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { Column } from '../table-props';
|
|
3
|
+
import type { ColumnAnimation } from '../table-const';
|
|
4
|
+
export interface ReorderSpec {
|
|
5
|
+
fromIndex: number;
|
|
6
|
+
insertionIndex: number;
|
|
7
|
+
}
|
|
8
|
+
export type ExpectColumnReorder = (reorderSpec: ReorderSpec) => void;
|
|
9
|
+
export declare function useColumnAnimation<T>({ disabled, tableRef, columns, }: {
|
|
10
|
+
disabled: boolean | undefined;
|
|
11
|
+
tableRef: RefObject<HTMLTableElement | null>;
|
|
12
|
+
columns: readonly Column<T>[];
|
|
13
|
+
}): {
|
|
14
|
+
columnAnimation: ColumnAnimation | null;
|
|
15
|
+
expectColumnReorder: ExpectColumnReorder;
|
|
16
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
export type VirtualItem = MaterializedItem | Spacer;
|
|
3
|
+
interface MaterializedItem {
|
|
4
|
+
type: 'materialized';
|
|
5
|
+
index: number;
|
|
6
|
+
}
|
|
7
|
+
interface Spacer {
|
|
8
|
+
type: 'spacer';
|
|
9
|
+
from: number;
|
|
10
|
+
to: number;
|
|
11
|
+
height: number;
|
|
12
|
+
key: string;
|
|
13
|
+
}
|
|
14
|
+
type CollapseItemIntoSpacerCallback = (index: number, height: number) => void;
|
|
15
|
+
export declare const CollapseItemIntoSpacerContext: import("react").Context<CollapseItemIntoSpacerCallback>;
|
|
16
|
+
export declare function useVirtualItems<T>({ enabled, data, data: { length }, scrollerRef, tableRef, estimateHeight, lookaheadPx, retentionMarginPx, minScrollAndResizeDeltaPx, }: {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
data: readonly T[];
|
|
19
|
+
scrollerRef: RefObject<HTMLElement | null> | undefined;
|
|
20
|
+
tableRef: RefObject<HTMLTableElement | null>;
|
|
21
|
+
estimateHeight: (item: T, index: number, items: readonly T[]) => number;
|
|
22
|
+
lookaheadPx: number;
|
|
23
|
+
retentionMarginPx: number;
|
|
24
|
+
minScrollAndResizeDeltaPx: number;
|
|
25
|
+
}): {
|
|
26
|
+
virtualItems: VirtualItem[];
|
|
27
|
+
intersectionObserverHandle: import("../../global/intersection-observer-context").IntersectionObserverHandle;
|
|
28
|
+
collapseItemIntoSpacer: CollapseItemIntoSpacerCallback;
|
|
29
|
+
};
|
|
30
|
+
export declare function SpacerRow({ spacer: { from, to, height }, colSpan }: {
|
|
31
|
+
spacer: Spacer;
|
|
32
|
+
colSpan: number;
|
|
33
|
+
}): import("react").JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Use in an item renderer to control item virtualization.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useItemVirtualization({ index, refs, onIntersectionChange, }: {
|
|
6
|
+
/**
|
|
7
|
+
* Index of the item.
|
|
8
|
+
*/
|
|
9
|
+
index: number;
|
|
10
|
+
/**
|
|
11
|
+
* One or more elements representing this item.
|
|
12
|
+
*
|
|
13
|
+
* When multiple elements are provided, the virtualization callback receives
|
|
14
|
+
* the intersection state of all of them.
|
|
15
|
+
*
|
|
16
|
+
* If you pass multiple refs, memoize the array (for example with `useMemo()`)
|
|
17
|
+
* to avoid restarting observation on every render.
|
|
18
|
+
*/
|
|
19
|
+
refs: RefObject<HTMLElement | null> | RefObject<HTMLElement | null>[];
|
|
20
|
+
/**
|
|
21
|
+
* Invoked when the `isIntersecting` state of the observed elements changes.
|
|
22
|
+
* Consider wrapping a callback to `useCallback()` to avoid restarting observation on every render.
|
|
23
|
+
*
|
|
24
|
+
* @param intersectionStates - Current intersection state of every observed element.
|
|
25
|
+
* Entries are initially `undefined` until the corresponding element
|
|
26
|
+
* has been reported by `IntersectionObserver`.
|
|
27
|
+
* @param changedIndex - Index of the element whose intersection state changed.
|
|
28
|
+
* @param elements - The observed elements. Note that some elements may
|
|
29
|
+
* already be disconnected from the DOM when this callback is invoked.
|
|
30
|
+
* Use additional checks like `element.isConnected`.
|
|
31
|
+
* @returns Return the height of an item to collapse the item into spacer,
|
|
32
|
+
* or `undefined` to keep the item rendered.
|
|
33
|
+
*/
|
|
34
|
+
onIntersectionChange: (intersectionStates: (boolean | undefined)[], changedIndex: number, elements: (Element | null)[]) => number | undefined;
|
|
35
|
+
}): void;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { use, useEffect } from 'react';
|
|
3
|
+
import { IntersectionObserverContext } from '../global/intersection-observer-context.js';
|
|
4
|
+
import { CollapseItemIntoSpacerContext } from '../internal/virtual-items.js';
|
|
5
|
+
import '../global/schedule-with-cleanup.js';
|
|
6
|
+
import '../_helpers/table.js';
|
|
7
|
+
import 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Use in an item renderer to control item virtualization.
|
|
11
|
+
*/
|
|
12
|
+
function useItemVirtualization(t0) {
|
|
13
|
+
const $ = c(8);
|
|
14
|
+
if ($[0] !== "15177a0e107705dc6d84a0fc97d3302da4c04a0058a1b771c145ee537ccae2cf") {
|
|
15
|
+
for (let $i = 0; $i < 8; $i += 1) {
|
|
16
|
+
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
17
|
+
}
|
|
18
|
+
$[0] = "15177a0e107705dc6d84a0fc97d3302da4c04a0058a1b771c145ee537ccae2cf";
|
|
19
|
+
}
|
|
20
|
+
const {
|
|
21
|
+
index,
|
|
22
|
+
refs,
|
|
23
|
+
onIntersectionChange
|
|
24
|
+
} = t0;
|
|
25
|
+
const handle = use(IntersectionObserverContext);
|
|
26
|
+
const collapseItemIntoSpacer = use(CollapseItemIntoSpacerContext);
|
|
27
|
+
let t1;
|
|
28
|
+
let t2;
|
|
29
|
+
if ($[1] !== collapseItemIntoSpacer || $[2] !== handle || $[3] !== index || $[4] !== onIntersectionChange || $[5] !== refs) {
|
|
30
|
+
t1 = () => {
|
|
31
|
+
const intersectionStates = Array.isArray(refs) ? refs.map(_temp) : [undefined];
|
|
32
|
+
const elements = Array.isArray(refs) ? refs.map(_temp2) : [refs.current];
|
|
33
|
+
const cleanups = [];
|
|
34
|
+
elements.forEach((element, elementIndex) => {
|
|
35
|
+
if (!element) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const cleanup = handle.observe(element, isIntersecting => {
|
|
39
|
+
intersectionStates[elementIndex] = isIntersecting;
|
|
40
|
+
const height = onIntersectionChange(intersectionStates, elementIndex, elements);
|
|
41
|
+
if (height != null) {
|
|
42
|
+
collapseItemIntoSpacer(index, height);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
cleanups.push(cleanup);
|
|
46
|
+
});
|
|
47
|
+
return () => cleanups.forEach(_temp3);
|
|
48
|
+
};
|
|
49
|
+
t2 = [collapseItemIntoSpacer, handle, index, onIntersectionChange, refs];
|
|
50
|
+
$[1] = collapseItemIntoSpacer;
|
|
51
|
+
$[2] = handle;
|
|
52
|
+
$[3] = index;
|
|
53
|
+
$[4] = onIntersectionChange;
|
|
54
|
+
$[5] = refs;
|
|
55
|
+
$[6] = t1;
|
|
56
|
+
$[7] = t2;
|
|
57
|
+
} else {
|
|
58
|
+
t1 = $[6];
|
|
59
|
+
t2 = $[7];
|
|
60
|
+
}
|
|
61
|
+
useEffect(t1, t2);
|
|
62
|
+
}
|
|
63
|
+
function _temp3(cleanup_0) {
|
|
64
|
+
return cleanup_0();
|
|
65
|
+
}
|
|
66
|
+
function _temp2(r) {
|
|
67
|
+
return r.current;
|
|
68
|
+
}
|
|
69
|
+
function _temp() {}
|
|
70
|
+
|
|
71
|
+
export { useItemVirtualization };
|
|
@@ -1,8 +1,42 @@
|
|
|
1
|
-
import type { TableProps } from './table';
|
|
1
|
+
import type { TableProps } from './table-props';
|
|
2
|
+
/**
|
|
3
|
+
* Use anywhere inside the table to get access to the props passed to it.
|
|
4
|
+
* Cast to `Context<TableProps<T>>` in usage place.
|
|
5
|
+
*/
|
|
2
6
|
export declare const TablePropsContext: import("react").Context<TableProps<unknown> | null>;
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
/**
|
|
40
|
+
* When a row only contains unformatted single-line text, it will be exactly of this height.
|
|
41
|
+
*/
|
|
5
42
|
export declare const defaultRowHeight = 37;
|
|
6
|
-
export declare const defaultLookaheadPx = 400;
|
|
7
|
-
export declare const defaultRetentionMarginPx = 450;
|
|
8
|
-
export declare const defaultMinScrollAndResizeDeltaPx = 50;
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Use anywhere inside the table to get access to the props passed to it.
|
|
5
|
+
* Cast to `Context<TableProps<T>>` in usage place.
|
|
6
|
+
*/
|
|
3
7
|
const TablePropsContext = /*#__PURE__*/createContext(null);
|
|
4
|
-
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Provides information about the currently animated column.
|
|
10
|
+
*
|
|
11
|
+
* Use in a custom cell renderer to animate reordered columns
|
|
12
|
+
* consistently with the default table renderer.
|
|
13
|
+
*/
|
|
14
|
+
const ColumnAnimationContext = /*#__PURE__*/createContext(null);
|
|
15
|
+
/**
|
|
16
|
+
* When a row only contains unformatted single-line text, it will be exactly of this height.
|
|
17
|
+
*/
|
|
6
18
|
const defaultRowHeight = 37;
|
|
7
|
-
const defaultLookaheadPx = 400;
|
|
8
|
-
const defaultRetentionMarginPx = 450;
|
|
9
|
-
const defaultMinScrollAndResizeDeltaPx = 50;
|
|
10
19
|
|
|
11
|
-
export {
|
|
20
|
+
export { ColumnAnimationContext, TablePropsContext, defaultRowHeight };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
export interface TableRowProps {
|
|
3
|
+
/**
|
|
4
|
+
* @see DefaultItemRendererProps.keyboardFocusable
|
|
5
|
+
*/
|
|
6
|
+
keyboardFocusable?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare const keyboardFocusableAttrName = "data-keyboard-focusable";
|
|
12
|
+
/**
|
|
13
|
+
* A helper `<tr>` component for custom {@link TableProps.renderItem} implementations.
|
|
14
|
+
* Applies the standard row class names.
|
|
15
|
+
*/
|
|
16
|
+
export declare function TableRow(props: TableRowProps & ComponentPropsWithRef<'tr'>): import("react").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* A helper `<td>` component for custom {@link TableProps.renderItem} implementations.
|
|
19
|
+
* Applies the standard cell class names, but not data-dependent `tdClassName`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function TableCell(props: ComponentPropsWithRef<'td'>): import("react").JSX.Element;
|