@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.
Files changed (214) hide show
  1. package/components/_helpers/anchor.js +1 -1
  2. package/components/_helpers/avatar-info.js +1 -1
  3. package/components/_helpers/heading.js +2 -2
  4. package/components/_helpers/icon-svg.js +1 -1
  5. package/components/_helpers/legacy-table.js +3 -0
  6. package/components/_helpers/tab-link.js +1 -1
  7. package/components/_helpers/table.js +1 -1
  8. package/components/_helpers/theme.js +50 -38
  9. package/components/alert/alert.js +2 -2
  10. package/components/alert-service/alert-service.js +1 -1
  11. package/components/auth/auth-core.js +1 -1
  12. package/components/auth/auth.js +1 -1
  13. package/components/auth/down-notification.js +1 -1
  14. package/components/auth/iframe-flow.js +2 -2
  15. package/components/auth/storage.js +1 -1
  16. package/components/auth-dialog/auth-dialog.js +1 -1
  17. package/components/auth-dialog-service/auth-dialog-service.js +2 -2
  18. package/components/avatar/avatar-info.js +1 -1
  19. package/components/avatar/avatar.js +1 -1
  20. package/components/avatar/fallback-avatar.js +1 -1
  21. package/components/avatar-stack/avatar-stack.js +1 -1
  22. package/components/banner/banner.js +1 -1
  23. package/components/button/button.js +1 -1
  24. package/components/button-group/button-group.js +1 -1
  25. package/components/checkbox/checkbox.d.ts +1 -1
  26. package/components/checkbox/checkbox.js +1 -1
  27. package/components/clipboard/clipboard.js +1 -1
  28. package/components/collapse/collapse-content.js +5 -5
  29. package/components/collapse/collapse-control.js +5 -5
  30. package/components/collapse/collapse.js +4 -4
  31. package/components/collapsible-group/collapsible-group.d.ts +20 -0
  32. package/components/collapsible-group/collapsible-group.js +382 -0
  33. package/components/components/util-stories.js +63 -1
  34. package/components/confirm/confirm.js +1 -1
  35. package/components/confirm-service/confirm-service.js +2 -2
  36. package/components/contenteditable/contenteditable.js +1 -1
  37. package/components/control-help/control-help.js +1 -1
  38. package/components/control-label/control-label.js +1 -1
  39. package/components/data-list/data-list.d.ts +1 -1
  40. package/components/data-list/data-list.js +1 -1
  41. package/components/data-list/data-list.mock.d.ts +1 -1
  42. package/components/data-list/data-list.mock.js +1 -1
  43. package/components/data-list/item.d.ts +1 -1
  44. package/components/data-list/item.js +1 -1
  45. package/components/data-list/selection.d.ts +1 -1
  46. package/components/data-list/selection.js +2 -2
  47. package/components/data-list/title.js +1 -1
  48. package/components/date-picker/date-input.js +1 -1
  49. package/components/date-picker/date-picker.js +1 -2
  50. package/components/date-picker/date-popup.js +4 -5
  51. package/components/date-picker/month-names.js +1 -1
  52. package/components/date-picker/month-slider.js +1 -1
  53. package/components/date-picker/month.js +1 -1
  54. package/components/date-picker/months.js +4 -5
  55. package/components/date-picker/use-scroll-behavior.js +45 -44
  56. package/components/date-picker/weekdays.js +1 -1
  57. package/components/date-picker/years.js +6 -7
  58. package/components/dialog/dialog.d.ts +2 -2
  59. package/components/dialog/dialog.js +3 -3
  60. package/components/dropdown/anchor.js +1 -1
  61. package/components/dropdown/dropdown.js +1 -1
  62. package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
  63. package/components/dropdown-menu/dropdown-menu.js +68 -63
  64. package/components/editable-heading/editable-heading.d.ts +1 -2
  65. package/components/editable-heading/editable-heading.js +127 -113
  66. package/components/error-bubble/error-bubble.js +1 -1
  67. package/components/error-message/error-message.js +1 -1
  68. package/components/expand/collapsible-group.d.ts +8 -16
  69. package/components/expand/collapsible-group.js +34 -364
  70. package/components/footer/footer.js +1 -1
  71. package/components/global/compose-refs.d.ts +2 -1
  72. package/components/global/compose-refs.js +44 -8
  73. package/components/global/create-stateful-context.js +11 -11
  74. package/components/global/focus-sensor-hoc.js +1 -0
  75. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  76. package/components/global/focus-with-temporary-tabindex.js +23 -0
  77. package/components/global/intersection-observer-context.d.ts +31 -11
  78. package/components/global/intersection-observer-context.js +55 -57
  79. package/components/global/is-within-interactive-element.d.ts +6 -0
  80. package/components/global/is-within-interactive-element.js +11 -0
  81. package/components/global/is-within-navigable-element.d.ts +6 -0
  82. package/components/global/is-within-navigable-element.js +11 -0
  83. package/components/global/parse-css-duration.d.ts +5 -0
  84. package/components/global/parse-css-duration.js +14 -0
  85. package/components/global/rerender-hoc.d.ts +4 -2
  86. package/components/global/rerender-hoc.js +11 -24
  87. package/components/global/schedule-with-cleanup.d.ts +12 -0
  88. package/components/global/schedule-with-cleanup.js +36 -0
  89. package/components/{legacy-table/selection.d.ts → global/table-selection.d.ts} +14 -14
  90. package/components/{legacy-table/selection.js → global/table-selection.js} +4 -4
  91. package/components/global/theme.d.ts +4 -3
  92. package/components/global/theme.js +2 -2
  93. package/components/header/header-icon.js +1 -1
  94. package/components/header/header.js +2 -2
  95. package/components/header/links.js +1 -1
  96. package/components/header/logo.js +1 -1
  97. package/components/header/profile.js +1 -1
  98. package/components/header/services.js +1 -1
  99. package/components/header/smart-profile.js +1 -1
  100. package/components/header/smart-services.js +1 -1
  101. package/components/heading/heading.js +4 -4
  102. package/components/i18n/i18n-context.js +4 -4
  103. package/components/icon/icon-svg.js +1 -1
  104. package/components/icon/icon.js +1 -1
  105. package/components/icon/index.js +1 -1
  106. package/components/input/input.d.ts +1 -1
  107. package/components/input/input.js +1 -1
  108. package/components/internal/column-animation.js +133 -0
  109. package/components/internal/table-header.js +1109 -0
  110. package/components/internal/virtual-items.js +353 -0
  111. package/components/island/adaptive-island-hoc.js +3 -3
  112. package/components/island/content.d.ts +7 -2
  113. package/components/island/content.js +27 -18
  114. package/components/island/header.js +1 -1
  115. package/components/island/island.js +1 -1
  116. package/components/legacy-table/cell.js +1 -1
  117. package/components/legacy-table/header-cell.js +4 -4
  118. package/components/legacy-table/header.js +2 -2
  119. package/components/legacy-table/multitable.d.ts +1 -1
  120. package/components/legacy-table/row-with-focus-sensor.js +2 -2
  121. package/components/legacy-table/row.d.ts +1 -1
  122. package/components/legacy-table/row.js +4 -4
  123. package/components/legacy-table/selection-adapter.d.ts +3 -3
  124. package/components/legacy-table/selection-shortcuts-hoc.d.ts +5 -5
  125. package/components/legacy-table/simple-table.d.ts +2 -2
  126. package/components/legacy-table/simple-table.js +4 -4
  127. package/components/legacy-table/smart-table.d.ts +5 -5
  128. package/components/legacy-table/smart-table.js +5 -5
  129. package/components/legacy-table/table.js +2 -2
  130. package/components/list/list-item.js +1 -1
  131. package/components/list/list-users-groups-source.js +1 -1
  132. package/components/list/list.js +1 -1
  133. package/components/login-dialog/login-dialog.js +1 -1
  134. package/components/login-dialog/service.js +2 -2
  135. package/components/markdown/markdown.js +2 -2
  136. package/components/message/message.js +2 -2
  137. package/components/old-browsers-message/white-list.js +2 -2
  138. package/components/pager/pager.js +1 -1
  139. package/components/popup/popup.d.ts +2 -0
  140. package/components/popup/popup.js +6 -2
  141. package/components/popup/popup.target.d.ts +3 -2
  142. package/components/popup/popup.target.js +32 -28
  143. package/components/popup-menu/popup-menu.js +1 -1
  144. package/components/query-assist/query-assist-suggestions.js +1 -1
  145. package/components/query-assist/query-assist.d.ts +3 -1
  146. package/components/query-assist/query-assist.js +2 -2
  147. package/components/radio/radio-item.d.ts +3 -3
  148. package/components/radio/radio-item.js +32 -18
  149. package/components/radio/radio.d.ts +2 -2
  150. package/components/radio/radio.js +2 -2
  151. package/components/scrollable-section/scrollable-section.js +1 -1
  152. package/components/select/chevron-button.js +1 -1
  153. package/components/select/select-filter.js +1 -1
  154. package/components/select/select-popup.d.ts +1 -1
  155. package/components/select/select-popup.js +1 -1
  156. package/components/select/select.d.ts +4 -2
  157. package/components/select/select.js +1 -1
  158. package/components/slider/slider.js +100 -96
  159. package/components/storage/storage-local.js +1 -1
  160. package/components/storage/storage.js +1 -1
  161. package/components/style.css +1 -1
  162. package/components/tab-trap/tab-trap.d.ts +3 -3
  163. package/components/tab-trap/tab-trap.js +83 -80
  164. package/components/table/default-item-renderer.d.ts +35 -11
  165. package/components/table/default-item-renderer.js +118 -171
  166. package/components/table/internal/column-animation.d.ts +16 -0
  167. package/components/table/internal/table-header.d.ts +4 -0
  168. package/components/table/internal/virtual-items.d.ts +34 -0
  169. package/components/table/item-virtualization.d.ts +35 -0
  170. package/components/table/item-virtualization.js +71 -0
  171. package/components/table/table-const.d.ts +40 -6
  172. package/components/table/table-const.js +15 -6
  173. package/components/table/table-primitives.d.ts +21 -0
  174. package/components/table/table-primitives.js +123 -0
  175. package/components/table/table-props.d.ts +280 -0
  176. package/components/table/table-props.js +1 -0
  177. package/components/table/table.d.ts +205 -224
  178. package/components/table/table.js +356 -14
  179. package/components/tabs/collapsible-more.js +1 -1
  180. package/components/tabs/collapsible-tab.js +1 -1
  181. package/components/tabs/collapsible-tabs.js +1 -1
  182. package/components/tabs/dumb-tabs.js +1 -1
  183. package/components/tabs/smart-tabs.js +1 -1
  184. package/components/tabs/tab-link.js +1 -1
  185. package/components/tabs/tabs.js +1 -1
  186. package/components/tag/tag.js +1 -1
  187. package/components/tags-input/tags-input.d.ts +3 -1
  188. package/components/tags-input/tags-input.js +1 -1
  189. package/components/tags-list/tags-list.js +1 -1
  190. package/components/toggle/toggle.js +1 -1
  191. package/components/tooltip/tooltip.js +3 -3
  192. package/components/upload/upload.d.ts +4 -3
  193. package/components/upload/upload.js +7 -29
  194. package/components/user-agreement/service.js +8 -8
  195. package/components/user-agreement/user-agreement.js +1 -1
  196. package/components/user-card/card.js +1 -1
  197. package/components/user-card/smart-user-card-tooltip.js +1 -1
  198. package/components/user-card/tooltip.js +1 -1
  199. package/components/user-card/user-card.js +1 -1
  200. package/components/util-stories.d.ts +26 -0
  201. package/package.json +7 -7
  202. package/components/_helpers/table2.js +0 -3
  203. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  204. package/components/date-picker/use-intersection-observer.js +0 -93
  205. package/components/global/composeRefs.d.ts +0 -6
  206. package/components/global/composeRefs.js +0 -9
  207. package/components/global/use-event-callback.d.ts +0 -1
  208. package/components/global/use-event-callback.js +0 -44
  209. package/components/table/table-base.d.ts +0 -24
  210. package/components/table/table-base.js +0 -311
  211. package/components/table/table-component.d.ts +0 -53
  212. package/components/table/table-component.js +0 -316
  213. package/components/table/table-virtualize.d.ts +0 -32
  214. package/components/table/table-virtualize.js +0 -330
@@ -1,316 +0,0 @@
1
- import { c } from 'react-compiler-runtime';
2
- import { useRef } from 'react';
3
- import classNames from 'classnames';
4
- import { IntersectionObserverContext } from '../global/intersection-observer-context.js';
5
- import { useTableVirtualize, SpacerRow } from './table-virtualize.js';
6
- import { DefaultItemRenderer } from './default-item-renderer.js';
7
- import { defaultMinScrollAndResizeDeltaPx, defaultRetentionMarginPx, defaultLookaheadPx, TablePropsContext, CollapseItemIntoSpacerContext, defaultRowHeight, ColumnIndexContext } from './table-const.js';
8
- import { s as styles } from '../_helpers/table.js';
9
- import { jsxs, jsx } from 'react/jsx-runtime';
10
- import '../global/use-event-callback.js';
11
- import './table-base.js';
12
- import '@jetbrains/icons/unsorted-12px';
13
- import '@jetbrains/icons/arrow-12px-down';
14
- import '@jetbrains/icons/arrow-12px-up';
15
- import '@jetbrains/icons/trash-12px';
16
- import '../icon/icon.js';
17
- import 'util-deprecate';
18
- import '../icon/icon.constants.js';
19
- import '../_helpers/icon-svg.js';
20
- import '../global/memoize.js';
21
-
22
- function Table(props) {
23
- var _userRef;
24
- const $ = c(66);
25
- if ($[0] !== "c5cbf342ef76906cf21ee6f16da41c5d4e7db7a707456ae37dfa4f28ed5d910a") {
26
- for (let $i = 0; $i < 66; $i += 1) {
27
- $[$i] = Symbol.for("react.memo_cache_sentinel");
28
- }
29
- $[0] = "c5cbf342ef76906cf21ee6f16da41c5d4e7db7a707456ae37dfa4f28ed5d910a";
30
- }
31
- let className;
32
- let columns;
33
- let data;
34
- let renderItem;
35
- let restProps;
36
- let scrollerRef;
37
- let t0;
38
- let t1;
39
- let t2;
40
- let t3;
41
- let t4;
42
- let tbodyClassName;
43
- let theadClassName;
44
- let theadTrClassName;
45
- let userRef;
46
- if ($[1] !== props) {
47
- const {
48
- data: t5,
49
- columns: t6,
50
- getKey,
51
- selection,
52
- isItemKeyboardFocusable,
53
- onItemFocus,
54
- onItemMove,
55
- onSort,
56
- onColumnDelete,
57
- onColumnMove,
58
- renderItem: t7,
59
- virtualizeRows: t8,
60
- scrollerRef: t9,
61
- estimateHeight: t10,
62
- lookaheadPx: t11,
63
- retentionMarginPx: t12,
64
- minScrollAndResizeDeltaPx: t13,
65
- columnEditButton,
66
- ref: t14,
67
- className: t15,
68
- theadClassName: t16,
69
- theadTrClassName: t17,
70
- tbodyClassName: t18,
71
- ...t19
72
- } = props;
73
- data = t5;
74
- columns = t6;
75
- renderItem = t7;
76
- t0 = t8;
77
- scrollerRef = t9;
78
- t1 = t10;
79
- t2 = t11;
80
- t3 = t12;
81
- t4 = t13;
82
- userRef = t14;
83
- className = t15;
84
- theadClassName = t16;
85
- theadTrClassName = t17;
86
- tbodyClassName = t18;
87
- restProps = t19;
88
- $[1] = props;
89
- $[2] = className;
90
- $[3] = columns;
91
- $[4] = data;
92
- $[5] = renderItem;
93
- $[6] = restProps;
94
- $[7] = scrollerRef;
95
- $[8] = t0;
96
- $[9] = t1;
97
- $[10] = t2;
98
- $[11] = t3;
99
- $[12] = t4;
100
- $[13] = tbodyClassName;
101
- $[14] = theadClassName;
102
- $[15] = theadTrClassName;
103
- $[16] = userRef;
104
- } else {
105
- className = $[2];
106
- columns = $[3];
107
- data = $[4];
108
- renderItem = $[5];
109
- restProps = $[6];
110
- scrollerRef = $[7];
111
- t0 = $[8];
112
- t1 = $[9];
113
- t2 = $[10];
114
- t3 = $[11];
115
- t4 = $[12];
116
- tbodyClassName = $[13];
117
- theadClassName = $[14];
118
- theadTrClassName = $[15];
119
- userRef = $[16];
120
- }
121
- const virtualizeRows = t0 === undefined ? false : t0;
122
- const estimateHeight = t1 === undefined ? _temp : t1;
123
- const lookaheadPx = t2 === undefined ? defaultLookaheadPx : t2;
124
- const retentionMarginPx = t3 === undefined ? defaultRetentionMarginPx : t3;
125
- const minScrollAndResizeDeltaPx = t4 === undefined ? defaultMinScrollAndResizeDeltaPx : t4;
126
- const selfRef = useRef(null);
127
- const tableRef = (_userRef = userRef) !== null && _userRef !== void 0 ? _userRef : selfRef;
128
- let t5;
129
- if ($[17] !== data.length || $[18] !== estimateHeight || $[19] !== lookaheadPx || $[20] !== minScrollAndResizeDeltaPx || $[21] !== retentionMarginPx || $[22] !== scrollerRef || $[23] !== tableRef || $[24] !== virtualizeRows) {
130
- t5 = {
131
- enabled: virtualizeRows,
132
- length: data.length,
133
- scrollerRef,
134
- tableRef,
135
- estimateHeight,
136
- lookaheadPx,
137
- retentionMarginPx,
138
- minScrollAndResizeDeltaPx
139
- };
140
- $[17] = data.length;
141
- $[18] = estimateHeight;
142
- $[19] = lookaheadPx;
143
- $[20] = minScrollAndResizeDeltaPx;
144
- $[21] = retentionMarginPx;
145
- $[22] = scrollerRef;
146
- $[23] = tableRef;
147
- $[24] = virtualizeRows;
148
- $[25] = t5;
149
- } else {
150
- t5 = $[25];
151
- }
152
- const {
153
- virtualItems,
154
- intersectionObserverHandle,
155
- collapseItemIntoSpacer
156
- } = useTableVirtualize(t5);
157
- let t6;
158
- if ($[26] !== className) {
159
- t6 = classNames(styles.table, className);
160
- $[26] = className;
161
- $[27] = t6;
162
- } else {
163
- t6 = $[27];
164
- }
165
- let t7;
166
- if ($[28] !== theadTrClassName) {
167
- t7 = classNames(styles.headerRow, theadTrClassName);
168
- $[28] = theadTrClassName;
169
- $[29] = t7;
170
- } else {
171
- t7 = $[29];
172
- }
173
- let t8;
174
- if ($[30] !== columns) {
175
- t8 = columns.map(_temp2);
176
- $[30] = columns;
177
- $[31] = t8;
178
- } else {
179
- t8 = $[31];
180
- }
181
- let t9;
182
- if ($[32] !== t7 || $[33] !== t8) {
183
- t9 = /*#__PURE__*/jsx("tr", {
184
- className: t7,
185
- children: t8
186
- });
187
- $[32] = t7;
188
- $[33] = t8;
189
- $[34] = t9;
190
- } else {
191
- t9 = $[34];
192
- }
193
- let t10;
194
- if ($[35] !== t9 || $[36] !== theadClassName) {
195
- t10 = /*#__PURE__*/jsx("thead", {
196
- className: theadClassName,
197
- children: t9
198
- });
199
- $[35] = t9;
200
- $[36] = theadClassName;
201
- $[37] = t10;
202
- } else {
203
- t10 = $[37];
204
- }
205
- let t11;
206
- if ($[38] !== collapseItemIntoSpacer || $[39] !== columns.length || $[40] !== data || $[41] !== props || $[42] !== renderItem || $[43] !== virtualItems) {
207
- let t12;
208
- if ($[45] !== collapseItemIntoSpacer || $[46] !== columns.length || $[47] !== data || $[48] !== props || $[49] !== renderItem) {
209
- t12 = virtualItem => {
210
- if (virtualItem.type === "spacer") {
211
- return /*#__PURE__*/jsx(SpacerRow, {
212
- spacer: virtualItem,
213
- colSpan: columns.length
214
- }, virtualItem.key);
215
- }
216
- const index = virtualItem.index;
217
- const item = data[index];
218
- const key = props.getKey(item, index);
219
- return /*#__PURE__*/jsx(CollapseItemIntoSpacerContext.Provider, {
220
- value: height => collapseItemIntoSpacer(index, height),
221
- children: renderItem ? renderItem(item, index, data) : /*#__PURE__*/jsx(DefaultItemRenderer, {
222
- index: index
223
- })
224
- }, key);
225
- };
226
- $[45] = collapseItemIntoSpacer;
227
- $[46] = columns.length;
228
- $[47] = data;
229
- $[48] = props;
230
- $[49] = renderItem;
231
- $[50] = t12;
232
- } else {
233
- t12 = $[50];
234
- }
235
- t11 = virtualItems.map(t12);
236
- $[38] = collapseItemIntoSpacer;
237
- $[39] = columns.length;
238
- $[40] = data;
239
- $[41] = props;
240
- $[42] = renderItem;
241
- $[43] = virtualItems;
242
- $[44] = t11;
243
- } else {
244
- t11 = $[44];
245
- }
246
- let t12;
247
- if ($[51] !== t11 || $[52] !== tbodyClassName) {
248
- t12 = /*#__PURE__*/jsx("tbody", {
249
- className: tbodyClassName,
250
- children: t11
251
- });
252
- $[51] = t11;
253
- $[52] = tbodyClassName;
254
- $[53] = t12;
255
- } else {
256
- t12 = $[53];
257
- }
258
- let t13;
259
- if ($[54] !== restProps || $[55] !== t10 || $[56] !== t12 || $[57] !== t6 || $[58] !== tableRef) {
260
- t13 = /*#__PURE__*/jsxs("table", {
261
- className: t6,
262
- ref: tableRef,
263
- ...restProps,
264
- children: [t10, t12]
265
- });
266
- $[54] = restProps;
267
- $[55] = t10;
268
- $[56] = t12;
269
- $[57] = t6;
270
- $[58] = tableRef;
271
- $[59] = t13;
272
- } else {
273
- t13 = $[59];
274
- }
275
- let t14;
276
- if ($[60] !== intersectionObserverHandle || $[61] !== t13) {
277
- t14 = /*#__PURE__*/jsx(IntersectionObserverContext.Provider, {
278
- value: intersectionObserverHandle,
279
- children: t13
280
- });
281
- $[60] = intersectionObserverHandle;
282
- $[61] = t13;
283
- $[62] = t14;
284
- } else {
285
- t14 = $[62];
286
- }
287
- let t15;
288
- if ($[63] !== props || $[64] !== t14) {
289
- t15 = /*#__PURE__*/jsx(TablePropsContext.Provider, {
290
- value: props,
291
- children: t14
292
- });
293
- $[63] = props;
294
- $[64] = t14;
295
- $[65] = t15;
296
- } else {
297
- t15 = $[65];
298
- }
299
- return t15;
300
- }
301
- function _temp2(column, columnIndex) {
302
- var _ref, _column$renderHeader;
303
- return /*#__PURE__*/jsx("th", {
304
- className: classNames(styles.headerCell, column.thClassName),
305
- "aria-sort": column.sortOrder,
306
- children: /*#__PURE__*/jsx(ColumnIndexContext.Provider, {
307
- value: columnIndex,
308
- children: (_ref = (_column$renderHeader = column.renderHeader?.()) !== null && _column$renderHeader !== void 0 ? _column$renderHeader : column.name) !== null && _ref !== void 0 ? _ref : String(column.key)
309
- })
310
- }, column.key);
311
- }
312
- function _temp() {
313
- return defaultRowHeight;
314
- }
315
-
316
- export { Table as default };
@@ -1,32 +0,0 @@
1
- import { type RefObject } from 'react';
2
- export type VirtualItem = RenderedItem | Spacer;
3
- interface RenderedItem {
4
- type: 'rendered';
5
- index: number;
6
- }
7
- interface Spacer {
8
- type: 'spacer';
9
- from: number;
10
- to: number;
11
- height: number;
12
- key: string;
13
- }
14
- export declare function useTableVirtualize({ enabled, length, scrollerRef, tableRef, estimateHeight, lookaheadPx, retentionMarginPx, minScrollAndResizeDeltaPx, }: {
15
- enabled: boolean;
16
- length: number;
17
- scrollerRef: RefObject<HTMLElement | null> | undefined;
18
- tableRef: RefObject<HTMLTableElement | null>;
19
- estimateHeight: (index: number) => number;
20
- lookaheadPx: number;
21
- retentionMarginPx: number;
22
- minScrollAndResizeDeltaPx: number;
23
- }): {
24
- virtualItems: VirtualItem[];
25
- intersectionObserverHandle: import("../global/intersection-observer-context").IntersectionObserverHandle | null;
26
- collapseItemIntoSpacer: (index: number, height: number) => void;
27
- };
28
- export declare function SpacerRow({ spacer: { from, to, height }, colSpan }: {
29
- spacer: Spacer;
30
- colSpan: number;
31
- }): import("react").JSX.Element;
32
- export {};
@@ -1,330 +0,0 @@
1
- import { c } from 'react-compiler-runtime';
2
- import { useRef, useState, useEffect } from 'react';
3
- import useEventCallback from '../global/use-event-callback.js';
4
- import { useIntersectionObserverHandle } from '../global/intersection-observer-context.js';
5
- import { s as styles } from '../_helpers/table.js';
6
- import { jsx } from 'react/jsx-runtime';
7
-
8
- const virtualizationThrottleDelay = 50;
9
- function useTableVirtualize(t0) {
10
- const $ = c(33);
11
- if ($[0] !== "43a8daad27f2d756ec5346c25f1057b419a001b3d7cb998cd41acf333e829c58") {
12
- for (let $i = 0; $i < 33; $i += 1) {
13
- $[$i] = Symbol.for("react.memo_cache_sentinel");
14
- }
15
- $[0] = "43a8daad27f2d756ec5346c25f1057b419a001b3d7cb998cd41acf333e829c58";
16
- }
17
- const {
18
- enabled,
19
- length,
20
- scrollerRef,
21
- tableRef,
22
- estimateHeight,
23
- lookaheadPx,
24
- retentionMarginPx,
25
- minScrollAndResizeDeltaPx
26
- } = t0;
27
- let t1;
28
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
29
- t1 = [];
30
- $[1] = t1;
31
- } else {
32
- t1 = $[1];
33
- }
34
- const itemsMaterialization = useRef(t1);
35
- let t2;
36
- if ($[2] !== estimateHeight || $[3] !== length) {
37
- t2 = () => [{
38
- type: "spacer",
39
- from: 0,
40
- to: length,
41
- height: Array.from({
42
- length
43
- }, (_, i) => estimateHeight(i)).reduce(_temp, 0),
44
- key: `${styles.spacerRow}-0`
45
- }];
46
- $[2] = estimateHeight;
47
- $[3] = length;
48
- $[4] = t2;
49
- } else {
50
- t2 = $[4];
51
- }
52
- const [virtualItems, setVirtualItems] = useState(t2);
53
- let t3;
54
- if ($[5] !== estimateHeight || $[6] !== lookaheadPx || $[7] !== scrollerRef || $[8] !== tableRef) {
55
- t3 = () => {
56
- var _scrollerRef$current$;
57
- if (!tableRef.current) {
58
- return;
59
- }
60
- const containerHeight = (_scrollerRef$current$ = scrollerRef?.current?.clientHeight) !== null && _scrollerRef$current$ !== void 0 ? _scrollerRef$current$ : window.innerHeight;
61
- for (const spacerRow of tableRef.current.querySelectorAll(`.${styles.spacerRow}`)) {
62
- const rect = spacerRow.getBoundingClientRect();
63
- const spacerIntersectsLookaheadArea = rect.top < containerHeight + lookaheadPx && rect.bottom > -lookaheadPx;
64
- if (!spacerIntersectsLookaheadArea) {
65
- continue;
66
- }
67
- const visibleOffsetStart = Math.max(0, -rect.top);
68
- const visibleOffsetEnd = Math.min(rect.height, containerHeight - rect.top);
69
- const materializeOffsetStart = visibleOffsetStart - lookaheadPx;
70
- const materializeOffsetEnd = visibleOffsetEnd + lookaheadPx;
71
- let offsetInSpacer = 0;
72
- const from = Number(spacerRow.dataset.from);
73
- const to = Number(spacerRow.dataset.to);
74
- for (let i_0 = from; i_0 < to; i_0++) {
75
- const itemMaterialization = itemsMaterialization.current[i_0];
76
- const itemHeight = typeof itemMaterialization === "number" ? itemMaterialization : estimateHeight(i_0);
77
- const itemOffsetStart = offsetInSpacer;
78
- const itemOffsetEnd = offsetInSpacer + itemHeight;
79
- if (itemOffsetStart < materializeOffsetEnd && itemOffsetEnd > materializeOffsetStart) {
80
- itemsMaterialization.current[i_0] = true;
81
- } else {
82
- if (itemOffsetStart > materializeOffsetEnd) {
83
- break;
84
- }
85
- }
86
- offsetInSpacer = offsetInSpacer + itemHeight;
87
- }
88
- }
89
- };
90
- $[5] = estimateHeight;
91
- $[6] = lookaheadPx;
92
- $[7] = scrollerRef;
93
- $[8] = tableRef;
94
- $[9] = t3;
95
- } else {
96
- t3 = $[9];
97
- }
98
- const materializeVisibleSpacerItems = useEventCallback(t3);
99
- let t4;
100
- if ($[10] !== estimateHeight || $[11] !== length) {
101
- t4 = () => {
102
- const newVirtualItems = [];
103
- let spacerCounter = 0;
104
- for (let i_1 = 0; i_1 < length; i_1++) {
105
- const itemMaterialization_0 = itemsMaterialization.current[i_1];
106
- if (itemMaterialization_0 === true) {
107
- newVirtualItems.push({
108
- type: "rendered",
109
- index: i_1
110
- });
111
- } else {
112
- const lastItemOrSpacer = newVirtualItems[newVirtualItems.length - 1];
113
- const lastSpacer = lastItemOrSpacer?.type === "spacer" ? lastItemOrSpacer : undefined;
114
- const height = typeof itemMaterialization_0 === "number" ? itemMaterialization_0 : estimateHeight(i_1);
115
- if (lastSpacer) {
116
- lastSpacer.to = i_1 + 1;
117
- lastSpacer.height = lastSpacer.height + height;
118
- } else {
119
- newVirtualItems.push({
120
- type: "spacer",
121
- from: i_1,
122
- to: i_1 + 1,
123
- height,
124
- key: `${styles.spacerRow}-${spacerCounter++}`
125
- });
126
- }
127
- }
128
- }
129
- setVirtualItems(newVirtualItems);
130
- };
131
- $[10] = estimateHeight;
132
- $[11] = length;
133
- $[12] = t4;
134
- } else {
135
- t4 = $[12];
136
- }
137
- const recomputeVirtualItems = useEventCallback(t4);
138
- const timerIdRef = useRef(null);
139
- const callbacksRef = useRef(null);
140
- let t5;
141
- if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
142
- t5 = (...t6) => {
143
- const callbacks = t6;
144
- if (timerIdRef.current != null) {
145
- callbacks.forEach(cb => {
146
- callbacksRef.current.delete(cb);
147
- callbacksRef.current.add(cb);
148
- });
149
- return;
150
- }
151
- callbacksRef.current = new Set(callbacks);
152
- timerIdRef.current = window.setTimeout(() => {
153
- callbacksRef.current.forEach(_temp2);
154
- timerIdRef.current = null;
155
- callbacksRef.current = null;
156
- }, virtualizationThrottleDelay);
157
- };
158
- $[13] = t5;
159
- } else {
160
- t5 = $[13];
161
- }
162
- const throttle = useEventCallback(t5);
163
- let t6;
164
- let t7;
165
- if ($[14] !== enabled || $[15] !== materializeVisibleSpacerItems || $[16] !== minScrollAndResizeDeltaPx || $[17] !== recomputeVirtualItems || $[18] !== scrollerRef || $[19] !== throttle) {
166
- t6 = () => {
167
- if (!enabled) {
168
- return;
169
- }
170
- const scroller = scrollerRef?.current;
171
- let lastHandledScrollTop = -Infinity;
172
- let lastHandledHeight = -Infinity;
173
- let lastHandledWidth = -Infinity;
174
- const handleViewportChange = function handleViewportChange() {
175
- const scrollTop = scroller ? scroller.scrollTop : window.scrollY;
176
- const height_0 = scroller ? scroller.clientHeight : window.innerHeight;
177
- const width = scroller ? scroller.clientWidth : window.innerWidth;
178
- if (Math.abs(scrollTop - lastHandledScrollTop) >= minScrollAndResizeDeltaPx || Math.abs(height_0 - lastHandledHeight) >= minScrollAndResizeDeltaPx || Math.abs(width - lastHandledWidth) >= minScrollAndResizeDeltaPx) {
179
- lastHandledScrollTop = scrollTop;
180
- lastHandledHeight = height_0;
181
- lastHandledWidth = width;
182
- throttle(materializeVisibleSpacerItems, recomputeVirtualItems);
183
- }
184
- };
185
- const scrollTarget = scroller !== null && scroller !== void 0 ? scroller : window;
186
- scrollTarget.addEventListener("scroll", handleViewportChange, {
187
- passive: true
188
- });
189
- const resizeObserver = new ResizeObserver(handleViewportChange);
190
- const resizeTarget = scroller !== null && scroller !== void 0 ? scroller : document.documentElement;
191
- resizeObserver.observe(resizeTarget);
192
- handleViewportChange();
193
- return () => {
194
- scrollTarget.removeEventListener("scroll", handleViewportChange);
195
- resizeObserver.unobserve(resizeTarget);
196
- resizeObserver.disconnect();
197
- };
198
- };
199
- t7 = [enabled, materializeVisibleSpacerItems, minScrollAndResizeDeltaPx, recomputeVirtualItems, scrollerRef, throttle];
200
- $[14] = enabled;
201
- $[15] = materializeVisibleSpacerItems;
202
- $[16] = minScrollAndResizeDeltaPx;
203
- $[17] = recomputeVirtualItems;
204
- $[18] = scrollerRef;
205
- $[19] = throttle;
206
- $[20] = t6;
207
- $[21] = t7;
208
- } else {
209
- t6 = $[20];
210
- t7 = $[21];
211
- }
212
- useEffect(t6, t7);
213
- const intersectionObserverHandle = useIntersectionObserverHandle(scrollerRef, scrollerRef ? retentionMarginPx : undefined, !scrollerRef ? retentionMarginPx : undefined);
214
- let t8;
215
- if ($[22] !== enabled || $[23] !== recomputeVirtualItems || $[24] !== throttle) {
216
- t8 = (index, height_1) => {
217
- if (!enabled) {
218
- return;
219
- }
220
- itemsMaterialization.current[index] = height_1;
221
- throttle(recomputeVirtualItems);
222
- };
223
- $[22] = enabled;
224
- $[23] = recomputeVirtualItems;
225
- $[24] = throttle;
226
- $[25] = t8;
227
- } else {
228
- t8 = $[25];
229
- }
230
- const collapseItemIntoSpacer = useEventCallback(t8);
231
- let t9;
232
- if ($[26] !== enabled || $[27] !== length) {
233
- t9 = Array.from({
234
- length: enabled ? 0 : length
235
- }, _temp3);
236
- $[26] = enabled;
237
- $[27] = length;
238
- $[28] = t9;
239
- } else {
240
- t9 = $[28];
241
- }
242
- const allVisibleVirtualItems = t9;
243
- const t10 = enabled ? virtualItems : allVisibleVirtualItems;
244
- let t11;
245
- if ($[29] !== collapseItemIntoSpacer || $[30] !== intersectionObserverHandle || $[31] !== t10) {
246
- t11 = {
247
- virtualItems: t10,
248
- intersectionObserverHandle,
249
- collapseItemIntoSpacer
250
- };
251
- $[29] = collapseItemIntoSpacer;
252
- $[30] = intersectionObserverHandle;
253
- $[31] = t10;
254
- $[32] = t11;
255
- } else {
256
- t11 = $[32];
257
- }
258
- return t11;
259
- }
260
- function _temp3(__0, index_0) {
261
- return {
262
- type: "rendered",
263
- index: index_0
264
- };
265
- }
266
- function _temp2(cb_0) {
267
- return cb_0();
268
- }
269
- function _temp(a, b) {
270
- return a + b;
271
- }
272
- function SpacerRow(t0) {
273
- const $ = c(10);
274
- if ($[0] !== "43a8daad27f2d756ec5346c25f1057b419a001b3d7cb998cd41acf333e829c58") {
275
- for (let $i = 0; $i < 10; $i += 1) {
276
- $[$i] = Symbol.for("react.memo_cache_sentinel");
277
- }
278
- $[0] = "43a8daad27f2d756ec5346c25f1057b419a001b3d7cb998cd41acf333e829c58";
279
- }
280
- const {
281
- spacer: t1,
282
- colSpan
283
- } = t0;
284
- const {
285
- from,
286
- to,
287
- height
288
- } = t1;
289
- let t2;
290
- if ($[1] !== height) {
291
- t2 = {
292
- height
293
- };
294
- $[1] = height;
295
- $[2] = t2;
296
- } else {
297
- t2 = $[2];
298
- }
299
- let t3;
300
- if ($[3] !== colSpan || $[4] !== t2) {
301
- t3 = /*#__PURE__*/jsx("td", {
302
- className: styles.spacerCell,
303
- colSpan: colSpan,
304
- style: t2
305
- });
306
- $[3] = colSpan;
307
- $[4] = t2;
308
- $[5] = t3;
309
- } else {
310
- t3 = $[5];
311
- }
312
- let t4;
313
- if ($[6] !== from || $[7] !== t3 || $[8] !== to) {
314
- t4 = /*#__PURE__*/jsx("tr", {
315
- className: styles.spacerRow,
316
- "data-from": from,
317
- "data-to": to,
318
- children: t3
319
- });
320
- $[6] = from;
321
- $[7] = t3;
322
- $[8] = to;
323
- $[9] = t4;
324
- } else {
325
- t4 = $[9];
326
- }
327
- return t4;
328
- }
329
-
330
- export { SpacerRow, useTableVirtualize };