@jetbrains/ring-ui-built 7.0.125 → 8.0.0-beta.11

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 (273) hide show
  1. package/components/_helpers/anchor.js +1 -1
  2. package/components/_helpers/avatar-info.js +3 -5
  3. package/components/_helpers/caption.js +1 -1
  4. package/components/_helpers/dialog.js +3 -0
  5. package/components/_helpers/icon-svg.js +37 -52
  6. package/components/_helpers/legacy-table.js +3 -0
  7. package/components/_helpers/tab-link.js +1 -1
  8. package/components/_helpers/table.js +2 -2
  9. package/components/_helpers/theme.js +49 -37
  10. package/components/alert/alert-actions.js +1 -1
  11. package/components/alert/alert-heading.js +1 -1
  12. package/components/alert/alert.js +2 -2
  13. package/components/alert-service/alert-service.js +2 -2
  14. package/components/auth/auth-core.js +2 -2
  15. package/components/auth/auth.js +2 -2
  16. package/components/auth/down-notification.js +2 -2
  17. package/components/auth/iframe-flow.js +15 -10
  18. package/components/auth/storage.js +2 -2
  19. package/components/auth-dialog/auth-dialog.js +11 -6
  20. package/components/auth-dialog-service/auth-dialog-service.js +19 -11
  21. package/components/avatar/avatar-info.js +1 -1
  22. package/components/avatar/avatar-size.d.ts +0 -4
  23. package/components/avatar/avatar-size.js +0 -4
  24. package/components/avatar/avatar.js +1 -8
  25. package/components/avatar/fallback-avatar.js +3 -48
  26. package/components/avatar-stack/avatar-stack.js +5 -5
  27. package/components/banner/banner.js +5 -6
  28. package/components/button/button.d.ts +0 -4
  29. package/components/button/button.js +4 -10
  30. package/components/button-group/button-group.js +1 -1
  31. package/components/button-toolbar/button-toolbar.js +1 -1
  32. package/components/checkbox/checkbox.d.ts +1 -1
  33. package/components/checkbox/checkbox.js +1 -2
  34. package/components/clipboard/clipboard.js +2 -2
  35. package/components/code/code.js +1 -2
  36. package/components/collapse/collapse-content.js +35 -43
  37. package/components/collapse/collapse-context.d.ts +1 -0
  38. package/components/collapse/collapse-context.js +1 -0
  39. package/components/collapse/collapse-control.js +5 -5
  40. package/components/collapse/collapse.js +34 -25
  41. package/components/collapsible-group/collapsible-group.d.ts +5 -1
  42. package/components/collapsible-group/collapsible-group.js +80 -98
  43. package/components/components/util-stories.js +63 -1
  44. package/components/confirm/confirm.js +30 -21
  45. package/components/confirm-service/confirm-service.js +21 -13
  46. package/components/contenteditable/contenteditable.js +4 -5
  47. package/components/control-help/control-help.js +1 -1
  48. package/components/control-label/control-label.js +1 -1
  49. package/components/data-list/data-list.d.ts +4 -4
  50. package/components/data-list/data-list.js +5 -5
  51. package/components/data-list/data-list.mock.d.ts +1 -1
  52. package/components/data-list/data-list.mock.js +2 -2
  53. package/components/data-list/item.d.ts +1 -1
  54. package/components/data-list/item.js +3 -3
  55. package/components/data-list/selection.d.ts +1 -1
  56. package/components/data-list/selection.js +2 -2
  57. package/components/data-list/title.js +1 -2
  58. package/components/date-picker/date-input.js +2 -2
  59. package/components/date-picker/date-picker.js +2 -3
  60. package/components/date-picker/date-popup.js +4 -5
  61. package/components/date-picker/month-names.js +1 -1
  62. package/components/date-picker/month-slider.js +1 -1
  63. package/components/date-picker/month.d.ts +0 -2
  64. package/components/date-picker/month.js +17 -18
  65. package/components/date-picker/months.js +43 -36
  66. package/components/date-picker/use-scroll-behavior.js +45 -45
  67. package/components/date-picker/weekdays.js +1 -1
  68. package/components/date-picker/years.js +61 -55
  69. package/components/dialog/dialog-body-scroll-preventer.js +49 -2
  70. package/components/dialog/dialog-controls.d.ts +13 -0
  71. package/components/dialog/dialog-controls.js +113 -0
  72. package/components/dialog/dialog-geometry.d.ts +31 -0
  73. package/components/dialog/dialog-geometry.js +63 -0
  74. package/components/dialog/dialog.d.ts +15 -7
  75. package/components/dialog/dialog.js +185 -37
  76. package/components/dropdown/anchor.js +3 -3
  77. package/components/dropdown/dropdown.js +3 -3
  78. package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
  79. package/components/dropdown-menu/dropdown-menu.js +63 -58
  80. package/components/editable-heading/editable-heading.d.ts +1 -2
  81. package/components/editable-heading/editable-heading.js +14 -13
  82. package/components/error-bubble/error-bubble.js +1 -1
  83. package/components/error-message/error-message.js +1 -2
  84. package/components/footer/footer.js +1 -1
  85. package/components/global/compose-refs.d.ts +2 -1
  86. package/components/global/compose-refs.js +44 -8
  87. package/components/global/configuration.d.ts +0 -5
  88. package/components/global/configuration.js +2 -10
  89. package/components/global/controls-height.js +1 -1
  90. package/components/global/create-stateful-context.js +11 -11
  91. package/components/global/focus-sensor-hoc.js +1 -0
  92. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  93. package/components/global/focus-with-temporary-tabindex.js +23 -0
  94. package/components/global/get-viewport-size.d.ts +5 -0
  95. package/components/global/get-viewport-size.js +6 -0
  96. package/components/global/intersection-observer-context.d.ts +46 -0
  97. package/components/global/intersection-observer-context.js +138 -0
  98. package/components/global/is-within-interactive-element.d.ts +6 -0
  99. package/components/global/is-within-interactive-element.js +11 -0
  100. package/components/global/is-within-navigable-element.d.ts +6 -0
  101. package/components/global/is-within-navigable-element.js +11 -0
  102. package/components/global/parse-css-duration.d.ts +5 -0
  103. package/components/global/parse-css-duration.js +14 -0
  104. package/components/global/rerender-hoc.d.ts +4 -2
  105. package/components/global/rerender-hoc.js +11 -24
  106. package/components/global/schedule-with-cleanup.d.ts +12 -0
  107. package/components/global/schedule-with-cleanup.js +36 -0
  108. package/components/{table/selection.d.ts → global/table-selection.d.ts} +15 -15
  109. package/components/{table/selection.js → global/table-selection.js} +5 -5
  110. package/components/global/theme.d.ts +4 -3
  111. package/components/global/theme.js +1 -1
  112. package/components/global/variables.interface.d.ts +0 -4
  113. package/components/header/header-icon.js +3 -3
  114. package/components/header/header.js +3 -3
  115. package/components/header/links.js +1 -1
  116. package/components/header/logo.js +1 -2
  117. package/components/header/profile.js +5 -5
  118. package/components/header/services.js +3 -3
  119. package/components/header/smart-profile.js +3 -3
  120. package/components/header/smart-services.js +3 -3
  121. package/components/heading/heading.js +1 -1
  122. package/components/http/http.js +6 -23
  123. package/components/i18n/i18n-context.js +4 -4
  124. package/components/icon/icon-svg.js +1 -2
  125. package/components/icon/icon.d.ts +0 -1
  126. package/components/icon/icon.js +2 -6
  127. package/components/icon/index.js +1 -2
  128. package/components/input/input.d.ts +1 -1
  129. package/components/input/input.js +3 -3
  130. package/components/internal/reorder-animation-context.js +159 -0
  131. package/components/internal/reorder-handle.js +750 -0
  132. package/components/internal/reorder-layout-context.js +141 -0
  133. package/components/internal/table-header.js +685 -0
  134. package/components/internal/virtualization.js +368 -0
  135. package/components/island/adaptive-island-hoc.js +3 -3
  136. package/components/island/content.d.ts +7 -2
  137. package/components/island/content.js +27 -18
  138. package/components/island/header.js +4 -3
  139. package/components/island/island.js +1 -1
  140. package/components/{table → legacy-table}/cell.js +1 -1
  141. package/components/{table → legacy-table}/header-cell.js +2 -3
  142. package/components/{table → legacy-table}/header.js +2 -3
  143. package/components/{table → legacy-table}/multitable.d.ts +1 -1
  144. package/components/{table → legacy-table}/row-with-focus-sensor.js +3 -3
  145. package/components/{table → legacy-table}/row.d.ts +1 -1
  146. package/components/{table → legacy-table}/row.js +5 -5
  147. package/components/legacy-table/selection-adapter.d.ts +6 -0
  148. package/components/{table → legacy-table}/selection-shortcuts-hoc.d.ts +5 -5
  149. package/components/{table → legacy-table}/simple-table.d.ts +2 -2
  150. package/components/{table → legacy-table}/simple-table.js +5 -5
  151. package/components/{table → legacy-table}/smart-table.d.ts +5 -5
  152. package/components/{table → legacy-table}/smart-table.js +6 -6
  153. package/components/legacy-table/table.d.ts +109 -0
  154. package/components/legacy-table/table.js +369 -0
  155. package/components/list/consts.d.ts +0 -1
  156. package/components/list/consts.js +0 -1
  157. package/components/list/list-item.js +3 -5
  158. package/components/list/list-users-groups-source.js +1 -2
  159. package/components/list/list.d.ts +0 -4
  160. package/components/list/list.js +1 -2
  161. package/components/login-dialog/login-dialog.js +17 -12
  162. package/components/login-dialog/service.js +19 -11
  163. package/components/message/message.js +1 -1
  164. package/components/pager/pager.js +3 -3
  165. package/components/popup/popup.js +1 -1
  166. package/components/popup/popup.target.d.ts +3 -2
  167. package/components/popup/popup.target.js +32 -28
  168. package/components/popup-menu/popup-menu.js +1 -1
  169. package/components/query-assist/query-assist-suggestions.js +1 -2
  170. package/components/query-assist/query-assist.d.ts +3 -1
  171. package/components/query-assist/query-assist.js +2 -2
  172. package/components/radio/radio-item.d.ts +3 -3
  173. package/components/radio/radio-item.js +33 -19
  174. package/components/radio/radio.d.ts +2 -2
  175. package/components/radio/radio.js +2 -2
  176. package/components/scrollable-section/scrollable-section.js +1 -1
  177. package/components/select/chevron-button.js +3 -3
  178. package/components/select/select-filter.js +3 -3
  179. package/components/select/select-popup.d.ts +3 -2
  180. package/components/select/select-popup.js +9 -4
  181. package/components/select/select.d.ts +6 -2
  182. package/components/select/select.js +5 -4
  183. package/components/selection-toolbar/selection-toolbar.d.ts +11 -0
  184. package/components/selection-toolbar/selection-toolbar.js +200 -0
  185. package/components/slider/slider.js +100 -97
  186. package/components/storage/storage-local.js +2 -2
  187. package/components/storage/storage.js +2 -2
  188. package/components/style.css +1 -1
  189. package/components/tab-trap/tab-trap.d.ts +3 -3
  190. package/components/tab-trap/tab-trap.js +83 -80
  191. package/components/table/default-item-renderer.d.ts +55 -0
  192. package/components/table/default-item-renderer.js +240 -0
  193. package/components/table/internal/reorder-animation-context.d.ts +21 -0
  194. package/components/table/internal/reorder-handle.d.ts +9 -0
  195. package/components/table/internal/reorder-layout-context.d.ts +16 -0
  196. package/components/table/internal/table-header.d.ts +1 -0
  197. package/components/table/internal/virtualization.d.ts +41 -0
  198. package/components/table/item-virtualization.d.ts +37 -0
  199. package/components/table/item-virtualization.js +73 -0
  200. package/components/table/reorder-animation.d.ts +37 -0
  201. package/components/table/reorder-animation.js +18 -0
  202. package/components/table/reorder-item-layout.d.ts +32 -0
  203. package/components/table/reorder-item-layout.js +57 -0
  204. package/components/table/table-const.d.ts +10 -0
  205. package/components/table/table-const.js +13 -0
  206. package/components/table/table-primitives.d.ts +64 -0
  207. package/components/table/table-primitives.js +180 -0
  208. package/components/table/table-props.d.ts +304 -0
  209. package/components/table/table-props.js +1 -0
  210. package/components/table/table.d.ts +231 -107
  211. package/components/table/table.js +351 -346
  212. package/components/tabs/collapsible-more.js +1 -1
  213. package/components/tabs/collapsible-tab.js +1 -1
  214. package/components/tabs/collapsible-tabs.js +1 -1
  215. package/components/tabs/dumb-tabs.js +1 -1
  216. package/components/tabs/smart-tabs.js +1 -1
  217. package/components/tabs/tab-link.js +1 -1
  218. package/components/tabs/tabs.js +1 -1
  219. package/components/tag/tag.js +1 -1
  220. package/components/tags-input/tags-input.d.ts +3 -1
  221. package/components/tags-input/tags-input.js +4 -4
  222. package/components/tags-list/tags-list.js +2 -2
  223. package/components/toggle/toggle.js +1 -1
  224. package/components/tooltip/tooltip.d.ts +2 -1
  225. package/components/tooltip/tooltip.js +5 -3
  226. package/components/upload/upload.d.ts +4 -3
  227. package/components/upload/upload.js +7 -30
  228. package/components/user-agreement/service.js +12 -4
  229. package/components/user-agreement/user-agreement.js +24 -20
  230. package/components/user-card/card.js +4 -4
  231. package/components/user-card/smart-user-card-tooltip.js +3 -3
  232. package/components/user-card/tooltip.js +3 -3
  233. package/components/user-card/user-card.js +5 -5
  234. package/components/util-stories.d.ts +26 -0
  235. package/package.json +11 -12
  236. package/components/__mocks__/old-browsers-message.js +0 -3
  237. package/components/_helpers/dialog-body-scroll-preventer.js +0 -50
  238. package/components/_helpers/grid.js +0 -3
  239. package/components/_helpers/sidebar.js +0 -110
  240. package/components/content-layout/content-layout.d.ts +0 -20
  241. package/components/content-layout/content-layout.js +0 -50
  242. package/components/content-layout/sidebar.d.ts +0 -26
  243. package/components/content-layout/sidebar.js +0 -5
  244. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  245. package/components/date-picker/use-intersection-observer.js +0 -93
  246. package/components/expand/collapsible-group.d.ts +0 -8
  247. package/components/expand/collapsible-group.js +0 -52
  248. package/components/global/composeRefs.d.ts +0 -6
  249. package/components/global/composeRefs.js +0 -9
  250. package/components/global/use-event-callback.d.ts +0 -4
  251. package/components/global/use-event-callback.js +0 -49
  252. package/components/grid/col.d.ts +0 -16
  253. package/components/grid/col.js +0 -63
  254. package/components/grid/grid.d.ts +0 -13
  255. package/components/grid/grid.js +0 -27
  256. package/components/grid/row.d.ts +0 -21
  257. package/components/grid/row.js +0 -72
  258. package/components/old-browsers-message/old-browsers-message-stop.d.ts +0 -1
  259. package/components/old-browsers-message/old-browsers-message-stop.js +0 -5
  260. package/components/old-browsers-message/old-browsers-message.d.ts +0 -5
  261. package/components/old-browsers-message/old-browsers-message.js +0 -89
  262. package/components/old-browsers-message/white-list.d.ts +0 -2
  263. package/components/old-browsers-message/white-list.js +0 -30
  264. package/components/table/selection-adapter.d.ts +0 -6
  265. /package/components/{table → legacy-table}/cell.d.ts +0 -0
  266. /package/components/{table → legacy-table}/disable-hover-hoc.d.ts +0 -0
  267. /package/components/{table → legacy-table}/disable-hover-hoc.js +0 -0
  268. /package/components/{table → legacy-table}/header-cell.d.ts +0 -0
  269. /package/components/{table → legacy-table}/header.d.ts +0 -0
  270. /package/components/{table → legacy-table}/multitable.js +0 -0
  271. /package/components/{table → legacy-table}/row-with-focus-sensor.d.ts +0 -0
  272. /package/components/{table → legacy-table}/selection-adapter.js +0 -0
  273. /package/components/{table → legacy-table}/selection-shortcuts-hoc.js +0 -0
@@ -1,369 +1,374 @@
1
- import { Component, PureComponent, createElement } from 'react';
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useRef, Fragment } from 'react';
2
3
  import classNames from 'classnames';
3
- import { arrayMove, List } from 'react-movable';
4
- import focusSensorHOC from '../global/focus-sensor-hoc.js';
5
- import getUID from '../global/get-uid.js';
6
- import Shortcuts from '../shortcuts/shortcuts.js';
7
- import Loader from '../loader/loader.js';
8
- import Header from './header.js';
9
- import selectionShortcutsHOC from './selection-shortcuts-hoc.js';
10
- import disableHoverHOC from './disable-hover-hoc.js';
11
- import RowWithFocusSensorCallbacks from './row-with-focus-sensor.js';
12
- import { s as style } from '../_helpers/table.js';
13
- import { jsx, jsxs } from 'react/jsx-runtime';
14
- import '../global/compose-refs.js';
4
+ import { useVirtualItems, SpacerRow, VirtualizationContext } from '../internal/virtualization.js';
5
+ import { DefaultItemRenderer } from './default-item-renderer.js';
6
+ import { TablePropsContext, defaultRowHeight } from './table-const.js';
7
+ import { focusWithTemporaryTabIndex } from '../global/focus-with-temporary-tabindex.js';
8
+ import { useReorderAnimationContextValue, ReorderAnimationContext } from '../internal/reorder-animation-context.js';
9
+ import { useComposedRef } from '../global/compose-refs.js';
10
+ import { TableHeader } from '../internal/table-header.js';
11
+ import { keyboardFocusableAttrName } from './table-primitives.js';
12
+ import { isWithinNavigableElement } from '../global/is-within-navigable-element.js';
13
+ import { useReorderLayoutContextValue, ReorderLayoutContext } from '../internal/reorder-layout-context.js';
14
+ import { s as styles } from '../_helpers/table.js';
15
+ import { jsxs, jsx } from 'react/jsx-runtime';
16
+ import '../global/intersection-observer-context.js';
17
+ import '../global/schedule-with-cleanup.js';
18
+ import './item-virtualization.js';
19
+ import './reorder-item-layout.js';
15
20
  import 'memoize-one';
16
- import '../shortcuts/core.js';
17
- import 'core-js/modules/es.array.includes.js';
18
- import 'combokeys';
19
- import '../global/sniffer.js';
20
- import 'sniffr';
21
- import '../_helpers/loader-core.js';
22
- import '../global/dom.js';
23
- import '../checkbox/checkbox.js';
24
- import '@jetbrains/icons/checkmark-12px';
25
- import '@jetbrains/icons/remove-12px';
21
+ import '../internal/reorder-handle.js';
22
+ import '@jetbrains/icons/drag-12px';
26
23
  import '../icon/icon.js';
27
24
  import 'util-deprecate';
28
25
  import '../icon/icon.constants.js';
29
26
  import '../_helpers/icon-svg.js';
30
- import 'react-compiler-runtime';
31
- import '../global/configuration.js';
32
27
  import '../global/memoize.js';
33
- import '../control-help/control-help.js';
34
- import '../global/data-tests.js';
35
- import './header-cell.js';
28
+ import '../global/parse-css-duration.js';
29
+ import '@jetbrains/icons/arrow-12px-down';
30
+ import '@jetbrains/icons/arrow-12px-up';
31
+ import '@jetbrains/icons/settings-12px';
32
+ import '@jetbrains/icons/trash-12px';
36
33
  import '@jetbrains/icons/unsorted-12px';
37
- import '@jetbrains/icons/chevron-12px-down';
38
- import './row.js';
39
- import '@jetbrains/icons/chevron-right';
40
- import '@jetbrains/icons/chevron-down';
41
- import '@jetbrains/icons/drag';
42
- import '../button/button.js';
43
- import '../link/clickable-link.js';
44
- import '../global/controls-height.js';
45
- import '../_helpers/button.classes.js';
46
- import '../tooltip/tooltip.js';
47
- import '../popup/popup.js';
48
- import 'react-dom';
49
- import '../global/schedule-raf.js';
50
- import '../tab-trap/tab-trap.js';
51
- import '../popup/position.js';
52
- import '../popup/popup.consts.js';
53
- import '../popup/popup.target.js';
54
- import '../popup/position-css.js';
55
- import '../_helpers/theme.js';
56
- import './cell.js';
34
+ import '../global/is-within-interactive-element.js';
57
35
 
58
- class Table extends PureComponent {
59
- static defaultProps = {
60
- isItemSelectable: () => true,
61
- loading: false,
62
- onSort: () => {},
63
- onReorder: () => {},
64
- getItemKey: item => {
65
- // Default behavior stays backward compatible: use item's "id" if present
66
- if ('id' in item) {
67
- return item.id;
68
- }
69
- // If there's no id provided on item and no getKey supplied, fail fast with a clear message
70
- throw new Error('Table: getItemKey is required when items have no "id" property');
71
- },
72
- sortKey: 'id',
73
- sortOrder: true,
74
- draggable: false,
75
- alwaysShowDragHandle: false,
76
- stickyHeader: true,
77
- getItemLevel: () => 0,
78
- getItemClassName: () => null,
79
- getMetaColumnClassName: () => null,
80
- getItemDataTest: () => null,
81
- isItemCollapsible: () => false,
82
- isParentCollapsible: () => false,
83
- isItemCollapsed: () => false,
84
- onItemCollapse: () => {},
85
- onItemExpand: () => {},
86
- onItemDoubleClick: () => {},
87
- onItemClick: () => {},
88
- remoteSelection: false,
89
- isDisabledSelectionVisible: () => false,
90
- getCheckboxTooltip: () => undefined,
91
- RowComponent: RowWithFocusSensorCallbacks,
92
- wideFirstColumn: false
93
- };
94
- state = {
95
- shortcutsScope: getUID('ring-table-'),
96
- userSelectNone: false
97
- };
98
- componentDidMount() {
99
- document.addEventListener('mouseup', this.onMouseUp);
100
- }
101
- componentDidUpdate({
102
- data,
103
- selection,
104
- onSelect,
105
- selectable,
106
- remoteSelection
107
- }) {
108
- if (data !== this.props.data && remoteSelection) {
109
- onSelect(selection.cloneWith({
110
- data: this.props.data
111
- }));
112
- }
113
- if (!this.props.selectable && this.props.selectable !== selectable) {
114
- onSelect(selection.resetSelection());
36
+ function Table(props) {
37
+ const $ = c(68);
38
+ if ($[0] !== "0b2671256cf6184450b7f5a987c20b706c8cb7e8a0bf848df36efecc0eb647dc") {
39
+ for (let $i = 0; $i < 68; $i += 1) {
40
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
115
41
  }
42
+ $[0] = "0b2671256cf6184450b7f5a987c20b706c8cb7e8a0bf848df36efecc0eb647dc";
116
43
  }
117
- componentWillUnmount() {
118
- document.removeEventListener('mouseup', this.onMouseUp);
119
- }
120
- onMouseDown = e => {
121
- if (e.shiftKey) {
122
- this.setState({
123
- userSelectNone: true
124
- });
125
- }
126
- };
127
- onMouseUp = () => {
128
- if (this.state.userSelectNone) {
129
- this.setState({
130
- userSelectNone: false
131
- });
132
- }
133
- };
134
- onRowFocus = row => {
135
- const {
136
- selection,
137
- onSelect
138
- } = this.props;
139
- onSelect(selection.focus(row));
140
- };
141
- onRowSelect = (row, selected) => {
142
- const {
143
- selection,
144
- onSelect
145
- } = this.props;
146
- if (selected) {
147
- onSelect(selection.select(row));
148
- } else {
149
- onSelect(selection.deselect(row));
150
- }
151
- };
152
- onSortEnd = ({
153
- oldIndex,
154
- newIndex
155
- }) => {
156
- const data = arrayMove(this.props.data, oldIndex, newIndex);
157
- this.props.onReorder({
158
- data,
159
- oldIndex,
160
- newIndex
161
- });
162
- };
163
- onCheckboxChange = e => {
44
+ let className;
45
+ let columns;
46
+ let data;
47
+ let getKey;
48
+ let noColumnReorderAnimation;
49
+ let noItemReorderAnimation;
50
+ let renderItem;
51
+ let restProps;
52
+ let scrollerRef;
53
+ let t0;
54
+ let t1;
55
+ let t2;
56
+ let t3;
57
+ let t4;
58
+ let tbodyClassName;
59
+ let userRef;
60
+ if ($[1] !== props) {
164
61
  const {
165
- checked
166
- } = e.currentTarget;
167
- const {
168
- selection,
169
- onSelect
170
- } = this.props;
171
- if (checked) {
172
- onSelect(selection.selectAll());
173
- } else {
174
- onSelect(selection.reset());
175
- }
176
- this.restoreFocusWithoutScroll();
177
- };
178
- restoreFocusWithoutScroll = () => {
179
- const {
180
- scrollX,
181
- scrollY
182
- } = window;
183
- this.props.onFocusRestore();
184
- window.scrollTo(scrollX, scrollY);
185
- };
186
- render() {
187
- const {
188
- data,
189
- selection,
190
- columns,
191
- caption,
192
- getItemKey,
193
- selectable,
194
- focused,
195
- isItemSelectable,
196
- getItemLevel,
197
- getItemClassName,
198
- getMetaColumnClassName,
199
- getItemDataTest,
200
- draggable,
201
- alwaysShowDragHandle,
202
- dragHandleTitle,
203
- loading,
204
- onSort,
205
- sortKey,
206
- sortOrder,
207
- loaderClassName,
62
+ data: t5,
63
+ columns: t6,
64
+ getKey: t7,
65
+ noHeader,
208
66
  stickyHeader,
209
- stickyHeaderOffset,
210
- isItemCollapsible,
211
- isParentCollapsible,
212
- isItemCollapsed,
213
- onItemCollapse,
214
- onItemExpand,
215
- isDisabledSelectionVisible,
216
- getCheckboxTooltip,
217
- onItemDoubleClick,
218
- onItemClick,
219
- renderEmpty,
220
- RowComponent,
221
- renderLoader
222
- } = this.props;
223
- // NOTE: Do not construct new object per render because it causes all rows rerendering
224
- const columnsArray = typeof columns === 'function' ? columns(null) : columns;
225
- const headerProps = {
226
- caption,
227
- selectable,
228
- draggable,
229
- columns: columnsArray,
230
67
  onSort,
231
- sortKey,
232
- sortOrder,
233
- sticky: stickyHeader,
234
- topStickOffset: stickyHeaderOffset,
235
- className: this.props.headerClassName
236
- };
237
- const selectedSize = selection.getSelected().size;
238
- const allSelectedSize = selection.selectAll().getSelected().size;
239
- headerProps.checked = selectedSize > 0 && selectedSize === allSelectedSize;
240
- headerProps.onCheckboxChange = this.onCheckboxChange;
241
- headerProps.checkboxDisabled = this.props.data.length === 0;
242
- const wrapperClasses = classNames(style.tableWrapper, this.props.wrapperClassName);
243
- const classes = classNames(this.props.className, {
244
- [style.table]: true,
245
- [style.wideFirstColumn]: this.props.wideFirstColumn,
246
- [style.userSelectNone]: this.state.userSelectNone,
247
- [style.disabledHover]: this.props.disabledHover
248
- });
249
- const renderList = ({
250
- children,
251
- props
252
- }) => {
253
- const empty = /*#__PURE__*/jsx("tr", {
254
- children: /*#__PURE__*/jsx("td", {
255
- colSpan: columnsArray.length || 1,
256
- className: style.tableMessage,
257
- children: renderEmpty ? renderEmpty() : null
258
- })
259
- });
260
- const tbody = Array.isArray(children) && children.length > 0 ? children : empty;
261
- return /*#__PURE__*/jsxs("table", {
262
- className: classes,
263
- "data-test": "ring-table",
264
- children: [/*#__PURE__*/jsx(Header, {
265
- ...headerProps
266
- }), /*#__PURE__*/jsx("tbody", {
267
- ...props,
268
- "data-test": "ring-table-body",
269
- children: tbody
270
- })]
271
- });
68
+ onColumnDelete,
69
+ onColumnReorder,
70
+ noColumnReorderAnimation: t8,
71
+ canReorderItem,
72
+ onItemReorder,
73
+ noItemReorderAnimation: t9,
74
+ renderItem: t10,
75
+ virtualizeRows: t11,
76
+ scrollerRef: t12,
77
+ estimateHeight: t13,
78
+ lookaheadPx: t14,
79
+ retentionMarginPx: t15,
80
+ minScrollAndResizeDeltaPx: t16,
81
+ columnEditing,
82
+ onColumnEditingRequest,
83
+ columnEditButton,
84
+ theadClassName,
85
+ theadTrClassName,
86
+ tbodyClassName: t17,
87
+ ref: t18,
88
+ className: t19,
89
+ ...t20
90
+ } = props;
91
+ data = t5;
92
+ columns = t6;
93
+ getKey = t7;
94
+ noColumnReorderAnimation = t8;
95
+ noItemReorderAnimation = t9;
96
+ renderItem = t10;
97
+ t0 = t11;
98
+ scrollerRef = t12;
99
+ t1 = t13;
100
+ t2 = t14;
101
+ t3 = t15;
102
+ t4 = t16;
103
+ tbodyClassName = t17;
104
+ userRef = t18;
105
+ className = t19;
106
+ restProps = t20;
107
+ $[1] = props;
108
+ $[2] = className;
109
+ $[3] = columns;
110
+ $[4] = data;
111
+ $[5] = getKey;
112
+ $[6] = noColumnReorderAnimation;
113
+ $[7] = noItemReorderAnimation;
114
+ $[8] = renderItem;
115
+ $[9] = restProps;
116
+ $[10] = scrollerRef;
117
+ $[11] = t0;
118
+ $[12] = t1;
119
+ $[13] = t2;
120
+ $[14] = t3;
121
+ $[15] = t4;
122
+ $[16] = tbodyClassName;
123
+ $[17] = userRef;
124
+ } else {
125
+ className = $[2];
126
+ columns = $[3];
127
+ data = $[4];
128
+ getKey = $[5];
129
+ noColumnReorderAnimation = $[6];
130
+ noItemReorderAnimation = $[7];
131
+ renderItem = $[8];
132
+ restProps = $[9];
133
+ scrollerRef = $[10];
134
+ t0 = $[11];
135
+ t1 = $[12];
136
+ t2 = $[13];
137
+ t3 = $[14];
138
+ t4 = $[15];
139
+ tbodyClassName = $[16];
140
+ userRef = $[17];
141
+ }
142
+ const virtualizeRows = t0 === undefined ? false : t0;
143
+ const estimateHeight = t1 === undefined ? _temp : t1;
144
+ const lookaheadPx = t2 === undefined ? 400 : t2;
145
+ const retentionMarginPx = t3 === undefined ? 450 : t3;
146
+ const minScrollAndResizeDeltaPx = t4 === undefined ? 50 : t4;
147
+ const localRef = useRef(null);
148
+ let t5;
149
+ if ($[18] !== columns || $[19] !== data || $[20] !== noColumnReorderAnimation || $[21] !== noItemReorderAnimation) {
150
+ t5 = {
151
+ noColumnReorderAnimation,
152
+ noItemReorderAnimation,
153
+ tableRef: localRef,
154
+ data,
155
+ columns
272
156
  };
273
- const renderItem = ({
274
- value,
275
- props = {},
276
- isDragged
277
- }) => {
278
- var _restProps$key;
279
- if (value === null || value === undefined) {
280
- return null;
157
+ $[18] = columns;
158
+ $[19] = data;
159
+ $[20] = noColumnReorderAnimation;
160
+ $[21] = noItemReorderAnimation;
161
+ $[22] = t5;
162
+ } else {
163
+ t5 = $[22];
164
+ }
165
+ const reorderAnimationContextValue = useReorderAnimationContextValue(t5);
166
+ let t6;
167
+ if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
168
+ t6 = function handleRowNavigation(e) {
169
+ if (e.defaultPrevented || isWithinNavigableElement(e.target)) {
170
+ return;
171
+ }
172
+ const arrowUp = e.key === "ArrowUp";
173
+ const arrowDown = e.key === "ArrowDown";
174
+ if (!arrowUp && !arrowDown) {
175
+ return;
176
+ }
177
+ const currentRow = e.target.closest("tr");
178
+ if (currentRow?.parentElement?.parentElement !== localRef.current) {
179
+ return;
281
180
  }
282
- const {
283
- ref,
284
- ...restProps
285
- } = props;
286
- const row = /*#__PURE__*/createElement(RowComponent, {
287
- innerRef: ref,
288
- level: getItemLevel(value),
289
- item: value,
290
- showFocus: selection.isFocused(value),
291
- autofocus: selection.isFocused(value),
292
- focused: focused && selection.isFocused(value),
293
- selectable: selectable && isItemSelectable(value),
294
- selected: selectable && selection.isSelected(value),
295
- onFocus: this.onRowFocus,
296
- onSelect: this.onRowSelect,
297
- onDoubleClick: onItemDoubleClick,
298
- onClick: onItemClick,
299
- collapsible: isItemCollapsible(value),
300
- parentCollapsible: isParentCollapsible(value),
301
- collapsed: isItemCollapsed(value),
302
- onCollapse: onItemCollapse,
303
- onExpand: onItemExpand,
304
- showDisabledSelection: isDisabledSelectionVisible(value),
305
- checkboxTooltip: getCheckboxTooltip(value),
306
- className: classNames(getItemClassName(value), {
307
- [style.draggingRow]: isDragged
308
- }),
309
- metaColumnClassName: getMetaColumnClassName(value),
310
- draggable: draggable,
311
- alwaysShowDragHandle: alwaysShowDragHandle,
312
- dragHandleTitle: dragHandleTitle,
313
- columns: columns,
314
- "data-test": getItemDataTest(value),
315
- cellClassName: this.props.cellClassName,
316
- ...restProps,
317
- key: (_restProps$key = restProps.key) !== null && _restProps$key !== void 0 ? _restProps$key : getItemKey(value)
318
- });
319
- return isDragged ? /*#__PURE__*/jsx("table", {
320
- style: {
321
- ...props.style
322
- },
323
- className: style.draggingTable,
324
- children: /*#__PURE__*/jsx("tbody", {
325
- children: row
326
- })
327
- }) : row;
181
+ let candidate = currentRow;
182
+ while (candidate) {
183
+ candidate = arrowUp ? candidate.previousElementSibling : candidate.nextElementSibling;
184
+ if (candidate?.hasAttribute(keyboardFocusableAttrName)) {
185
+ focusWithTemporaryTabIndex(candidate);
186
+ e.preventDefault();
187
+ return;
188
+ }
189
+ }
190
+ };
191
+ $[23] = t6;
192
+ } else {
193
+ t6 = $[23];
194
+ }
195
+ const handleRowNavigation = t6;
196
+ let t7;
197
+ if ($[24] !== data || $[25] !== estimateHeight || $[26] !== lookaheadPx || $[27] !== minScrollAndResizeDeltaPx || $[28] !== retentionMarginPx || $[29] !== scrollerRef || $[30] !== virtualizeRows) {
198
+ t7 = {
199
+ enabled: virtualizeRows,
200
+ data,
201
+ scrollerRef,
202
+ tableRef: localRef,
203
+ estimateHeight,
204
+ lookaheadPx,
205
+ retentionMarginPx,
206
+ minScrollAndResizeDeltaPx
328
207
  };
329
- return /*#__PURE__*/jsxs("div", {
330
- className: wrapperClasses,
331
- "data-test": "ring-table-wrapper",
332
- ref: this.props.innerRef,
333
- children: [focused && /*#__PURE__*/jsx(Shortcuts, {
334
- map: this.props.shortcutsMap,
335
- scope: this.state.shortcutsScope
336
- }), /*#__PURE__*/jsx("div", {
337
- role: "presentation",
338
- onMouseDown: this.onMouseDown,
339
- children: draggable ? /*#__PURE__*/jsx(List, {
340
- values: data,
341
- renderList: renderList,
342
- renderItem: renderItem,
343
- onChange: this.onSortEnd
344
- }) : renderList({
345
- children: data.map((value, index) => renderItem({
346
- value}))
347
- })
348
- }), loading && /*#__PURE__*/jsx("div", {
349
- className: style.loadingOverlay,
350
- children: renderLoader ? renderLoader(loaderClassName) : /*#__PURE__*/jsx(Loader, {
351
- className: loaderClassName
352
- })
353
- })]
208
+ $[24] = data;
209
+ $[25] = estimateHeight;
210
+ $[26] = lookaheadPx;
211
+ $[27] = minScrollAndResizeDeltaPx;
212
+ $[28] = retentionMarginPx;
213
+ $[29] = scrollerRef;
214
+ $[30] = virtualizeRows;
215
+ $[31] = t7;
216
+ } else {
217
+ t7 = $[31];
218
+ }
219
+ const {
220
+ virtualItems,
221
+ virtualizationContextValue
222
+ } = useVirtualItems(t7);
223
+ const itemReorderLayoutContextValue = useReorderLayoutContextValue();
224
+ let t8;
225
+ if ($[32] !== className) {
226
+ t8 = classNames(styles.table, className);
227
+ $[32] = className;
228
+ $[33] = t8;
229
+ } else {
230
+ t8 = $[33];
231
+ }
232
+ const t9 = useComposedRef(userRef, localRef);
233
+ let t10;
234
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
235
+ t10 = /*#__PURE__*/jsx(TableHeader, {});
236
+ $[34] = t10;
237
+ } else {
238
+ t10 = $[34];
239
+ }
240
+ const t11 = virtualizeRows ? virtualItems : data;
241
+ let t12;
242
+ if ($[35] !== columns || $[36] !== data || $[37] !== getKey || $[38] !== renderItem || $[39] !== t11 || $[40] !== virtualizeRows) {
243
+ let t13;
244
+ if ($[42] !== columns || $[43] !== data || $[44] !== getKey || $[45] !== renderItem || $[46] !== virtualizeRows) {
245
+ t13 = (item, index) => {
246
+ let dataItem;
247
+ let dataItemIndex;
248
+ if (virtualizeRows) {
249
+ const virtualItem = item;
250
+ if (virtualItem.type === "spacer") {
251
+ return /*#__PURE__*/jsx(SpacerRow, {
252
+ spacer: virtualItem,
253
+ colSpan: columns.length
254
+ }, virtualItem.key);
255
+ }
256
+ dataItemIndex = virtualItem.index;
257
+ if (dataItemIndex < 0 || dataItemIndex >= data.length) {
258
+ return null;
259
+ }
260
+ dataItem = data[dataItemIndex];
261
+ } else {
262
+ dataItem = item;
263
+ dataItemIndex = index;
264
+ }
265
+ return /*#__PURE__*/jsx(Fragment, {
266
+ children: renderItem ? renderItem(dataItem, dataItemIndex, data) : /*#__PURE__*/jsx(DefaultItemRenderer, {
267
+ index: dataItemIndex
268
+ })
269
+ }, getKey(dataItem, dataItemIndex, data));
270
+ };
271
+ $[42] = columns;
272
+ $[43] = data;
273
+ $[44] = getKey;
274
+ $[45] = renderItem;
275
+ $[46] = virtualizeRows;
276
+ $[47] = t13;
277
+ } else {
278
+ t13 = $[47];
279
+ }
280
+ t12 = t11.map(t13);
281
+ $[35] = columns;
282
+ $[36] = data;
283
+ $[37] = getKey;
284
+ $[38] = renderItem;
285
+ $[39] = t11;
286
+ $[40] = virtualizeRows;
287
+ $[41] = t12;
288
+ } else {
289
+ t12 = $[41];
290
+ }
291
+ let t13;
292
+ if ($[48] !== itemReorderLayoutContextValue || $[49] !== t12) {
293
+ t13 = /*#__PURE__*/jsx(ReorderLayoutContext, {
294
+ value: itemReorderLayoutContextValue,
295
+ children: t12
354
296
  });
297
+ $[48] = itemReorderLayoutContextValue;
298
+ $[49] = t12;
299
+ $[50] = t13;
300
+ } else {
301
+ t13 = $[50];
355
302
  }
356
- }
357
- const getContainer = () => disableHoverHOC(selectionShortcutsHOC(focusSensorHOC(Table)));
358
- // eslint-disable-next-line react/no-multi-comp
359
- class TableContainer extends Component {
360
- // https://stackoverflow.com/a/53882322/6304152
361
- Table = getContainer();
362
- render() {
363
- return /*#__PURE__*/jsx(this.Table, {
364
- ...this.props
303
+ let t14;
304
+ if ($[51] !== t13 || $[52] !== virtualizationContextValue) {
305
+ t14 = /*#__PURE__*/jsx(VirtualizationContext, {
306
+ value: virtualizationContextValue,
307
+ children: t13
308
+ });
309
+ $[51] = t13;
310
+ $[52] = virtualizationContextValue;
311
+ $[53] = t14;
312
+ } else {
313
+ t14 = $[53];
314
+ }
315
+ let t15;
316
+ if ($[54] !== t14 || $[55] !== tbodyClassName) {
317
+ t15 = /*#__PURE__*/jsx("tbody", {
318
+ className: tbodyClassName,
319
+ onKeyDown: handleRowNavigation,
320
+ children: t14
321
+ });
322
+ $[54] = t14;
323
+ $[55] = tbodyClassName;
324
+ $[56] = t15;
325
+ } else {
326
+ t15 = $[56];
327
+ }
328
+ let t16;
329
+ if ($[57] !== restProps || $[58] !== t15 || $[59] !== t8 || $[60] !== t9) {
330
+ t16 = /*#__PURE__*/jsxs("table", {
331
+ className: t8,
332
+ ref: t9,
333
+ ...restProps,
334
+ children: [t10, t15]
365
335
  });
336
+ $[57] = restProps;
337
+ $[58] = t15;
338
+ $[59] = t8;
339
+ $[60] = t9;
340
+ $[61] = t16;
341
+ } else {
342
+ t16 = $[61];
366
343
  }
344
+ let t17;
345
+ if ($[62] !== reorderAnimationContextValue || $[63] !== t16) {
346
+ t17 = /*#__PURE__*/jsx(ReorderAnimationContext, {
347
+ value: reorderAnimationContextValue,
348
+ children: t16
349
+ });
350
+ $[62] = reorderAnimationContextValue;
351
+ $[63] = t16;
352
+ $[64] = t17;
353
+ } else {
354
+ t17 = $[64];
355
+ }
356
+ let t18;
357
+ if ($[65] !== props || $[66] !== t17) {
358
+ t18 = /*#__PURE__*/jsx(TablePropsContext, {
359
+ value: props,
360
+ children: t17
361
+ });
362
+ $[65] = props;
363
+ $[66] = t17;
364
+ $[67] = t18;
365
+ } else {
366
+ t18 = $[67];
367
+ }
368
+ return t18;
369
+ }
370
+ function _temp() {
371
+ return defaultRowHeight;
367
372
  }
368
373
 
369
- export { Table, TableContainer as default };
374
+ export { Table as default };