@jetbrains/ring-ui 5.0.35 → 5.0.37

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 (241) hide show
  1. package/components/date-picker/date-popup.js +3 -1
  2. package/components/editable-heading/editable-heading.css +69 -0
  3. package/components/editable-heading/editable-heading.d.ts +21 -0
  4. package/components/editable-heading/editable-heading.js +34 -0
  5. package/components/input/input.css +2 -0
  6. package/components/query-assist/query-assist.js +1 -1
  7. package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -4
  8. package/dist/_helpers/anchor.js +0 -1
  9. package/dist/_helpers/card.js +0 -3
  10. package/dist/_helpers/dialog__body-scroll-preventer.js +0 -11
  11. package/dist/_helpers/footer.js +2 -13
  12. package/dist/_helpers/query-assist__suggestions.js +0 -10
  13. package/dist/_helpers/select__filter.js +0 -11
  14. package/dist/_helpers/services-link.js +0 -2
  15. package/dist/_helpers/sidebar.js +0 -12
  16. package/dist/_helpers/theme.js +0 -3
  17. package/dist/_helpers/title.js +0 -9
  18. package/dist/alert/alert.js +2 -32
  19. package/dist/alert/container.js +0 -5
  20. package/dist/alert-service/alert-service.js +0 -26
  21. package/dist/analytics/analytics.js +0 -22
  22. package/dist/analytics/analytics__custom-plugin.js +0 -38
  23. package/dist/analytics/analytics__fus-plugin.js +0 -20
  24. package/dist/analytics/analytics__ga-plugin.js +0 -13
  25. package/dist/analytics/analytics__plugin-utils.js +0 -8
  26. package/dist/analytics-ng/analytics-ng.js +3 -9
  27. package/dist/auth/auth.js +2 -3
  28. package/dist/auth/auth__core.js +30 -243
  29. package/dist/auth/background-flow.js +2 -25
  30. package/dist/auth/down-notification.js +0 -7
  31. package/dist/auth/iframe-flow.js +2 -26
  32. package/dist/auth/landing.js +2 -6
  33. package/dist/auth/request-builder.js +0 -11
  34. package/dist/auth/response-parser.js +4 -26
  35. package/dist/auth/storage.js +4 -60
  36. package/dist/auth/token-validator.js +6 -42
  37. package/dist/auth/window-flow.js +2 -34
  38. package/dist/auth-dialog/auth-dialog.js +2 -12
  39. package/dist/auth-dialog-service/auth-dialog-service.js +2 -4
  40. package/dist/auth-ng/auth-ng.js +6 -22
  41. package/dist/auth-ng/auth-ng.mock.js +0 -4
  42. package/dist/autofocus-ng/autofocus-ng.js +0 -5
  43. package/dist/avatar/avatar.js +4 -17
  44. package/dist/avatar/fallback-avatar.js +2 -9
  45. package/dist/avatar-editor-ng/avatar-editor-ng.js +1 -17
  46. package/dist/badge/badge.js +0 -3
  47. package/dist/button/button.js +0 -8
  48. package/dist/button-group/button-group.js +0 -3
  49. package/dist/button-group/caption.js +0 -2
  50. package/dist/button-group-ng/button-group-ng.js +0 -4
  51. package/dist/button-ng/button-ng.js +3 -21
  52. package/dist/button-set/button-set.js +0 -3
  53. package/dist/button-set-ng/button-set-ng.js +0 -2
  54. package/dist/button-toolbar/button-toolbar.js +0 -3
  55. package/dist/button-toolbar-ng/button-toolbar-ng.js +0 -2
  56. package/dist/caret/caret.js +2 -53
  57. package/dist/checkbox/checkbox.js +0 -12
  58. package/dist/code/code.js +3 -25
  59. package/dist/compiler-ng/compiler-ng.js +0 -5
  60. package/dist/confirm/confirm.js +0 -6
  61. package/dist/confirm-service/confirm-service.js +10 -8
  62. package/dist/content-layout/content-layout.js +0 -7
  63. package/dist/contenteditable/contenteditable.js +6 -13
  64. package/dist/data-list/data-list.js +4 -28
  65. package/dist/data-list/item.js +0 -15
  66. package/dist/data-list/selection.js +0 -27
  67. package/dist/date-picker/consts.js +0 -7
  68. package/dist/date-picker/date-input.js +0 -20
  69. package/dist/date-picker/date-picker.js +2 -36
  70. package/dist/date-picker/date-popup.js +21 -72
  71. package/dist/date-picker/day.js +0 -14
  72. package/dist/date-picker/month-names.js +0 -9
  73. package/dist/date-picker/month-slider.js +0 -10
  74. package/dist/date-picker/month.js +2 -4
  75. package/dist/date-picker/months.js +6 -13
  76. package/dist/date-picker/years.js +0 -14
  77. package/dist/dialog/dialog.js +0 -19
  78. package/dist/dialog-ng/dialog-ng.js +17 -105
  79. package/dist/docked-panel-ng/docked-panel-ng.js +6 -29
  80. package/dist/dropdown/dropdown.js +2 -33
  81. package/dist/dropdown-menu/dropdown-menu.js +4 -8
  82. package/dist/editable-heading/editable-heading.d.ts +21 -0
  83. package/dist/editable-heading/editable-heading.js +85 -0
  84. package/dist/error-bubble/error-bubble.js +2 -4
  85. package/dist/error-message/error-message.js +0 -3
  86. package/dist/footer-ng/footer-ng.js +0 -13
  87. package/dist/form-ng/form-ng.js +1 -21
  88. package/dist/global/angular-component-factory.js +0 -10
  89. package/dist/global/compose.js +0 -1
  90. package/dist/global/composeRefs.js +0 -1
  91. package/dist/global/controls-height.js +0 -2
  92. package/dist/global/create-stateful-context.js +0 -5
  93. package/dist/global/data-tests.js +0 -4
  94. package/dist/global/dom.js +2 -11
  95. package/dist/global/focus-sensor-hoc.js +4 -33
  96. package/dist/global/fuzzy-highlight.js +2 -16
  97. package/dist/global/get-event-key.js +8 -17
  98. package/dist/global/get-uid.js +0 -2
  99. package/dist/global/linear-function.js +0 -2
  100. package/dist/global/listeners.js +0 -13
  101. package/dist/global/memoize.js +0 -2
  102. package/dist/global/normalize-indent.js +2 -5
  103. package/dist/global/react-dom-renderer.js +0 -8
  104. package/dist/global/react-render-adapter.js +0 -7
  105. package/dist/global/rerender-hoc.js +0 -7
  106. package/dist/global/ring-angular-component.js +0 -5
  107. package/dist/global/schedule-raf.js +0 -5
  108. package/dist/global/trivial-template-tag.js +2 -3
  109. package/dist/global/url.js +0 -27
  110. package/dist/grid/col.js +0 -4
  111. package/dist/grid/grid.js +0 -3
  112. package/dist/grid/row.js +0 -5
  113. package/dist/group/group.js +0 -3
  114. package/dist/header/header.js +0 -5
  115. package/dist/header/logo.js +0 -4
  116. package/dist/header/profile.js +0 -7
  117. package/dist/header/services.js +0 -11
  118. package/dist/header/smart-profile.js +4 -18
  119. package/dist/header/smart-services.js +0 -17
  120. package/dist/header/tray-icon.js +2 -3
  121. package/dist/header/tray.js +0 -3
  122. package/dist/heading/heading.js +0 -5
  123. package/dist/http/http.js +20 -65
  124. package/dist/http/http.mock.js +2 -14
  125. package/dist/hub-source/hub-source.js +0 -32
  126. package/dist/hub-source/hub-source__user.js +0 -1
  127. package/dist/hub-source/hub-source__users-groups.js +0 -12
  128. package/dist/icon/icon.js +0 -13
  129. package/dist/icon/icon__constants.js +0 -4
  130. package/dist/icon/icon__svg.js +0 -10
  131. package/dist/icon-ng/icon-ng.js +2 -7
  132. package/dist/input/input.js +0 -30
  133. package/dist/input-ng/input-ng.js +0 -17
  134. package/dist/island/adaptive-island-hoc.js +0 -7
  135. package/dist/island/content.js +0 -25
  136. package/dist/island/header.js +0 -7
  137. package/dist/island/island.js +0 -4
  138. package/dist/island-legacy/content-legacy.js +0 -2
  139. package/dist/island-legacy/header-legacy.js +0 -2
  140. package/dist/island-legacy/island-legacy.js +0 -2
  141. package/dist/island-ng/island-content-ng.js +0 -3
  142. package/dist/link/clickableLink.js +2 -10
  143. package/dist/link/link.js +2 -9
  144. package/dist/link-ng/link-ng.js +0 -2
  145. package/dist/list/consts.js +0 -4
  146. package/dist/list/list.js +6 -128
  147. package/dist/list/list__custom.js +0 -4
  148. package/dist/list/list__hint.js +0 -3
  149. package/dist/list/list__item.js +0 -8
  150. package/dist/list/list__link.js +2 -3
  151. package/dist/list/list__separator.js +0 -1
  152. package/dist/list/list__title.js +0 -1
  153. package/dist/list/list__users-groups-source.js +4 -17
  154. package/dist/loader/loader.js +0 -10
  155. package/dist/loader/loader__core.js +6 -70
  156. package/dist/loader-inline/loader-inline.js +0 -3
  157. package/dist/loader-ng/loader-ng.js +0 -7
  158. package/dist/loader-screen/loader-screen.js +0 -3
  159. package/dist/loader-screen-ng/loader-screen-ng.js +2 -14
  160. package/dist/login-dialog/login-dialog.js +0 -15
  161. package/dist/login-dialog/service.js +2 -4
  162. package/dist/markdown/code.js +0 -2
  163. package/dist/markdown/heading.js +0 -1
  164. package/dist/markdown/link.js +0 -1
  165. package/dist/markdown/markdown.js +0 -2
  166. package/dist/message/message.js +0 -24
  167. package/dist/message-bundle-ng/message-bundle-ng.js +2 -45
  168. package/dist/old-browsers-message/old-browsers-message.js +2 -21
  169. package/dist/old-browsers-message/white-list.js +2 -6
  170. package/dist/pager/pager.js +2 -39
  171. package/dist/panel/panel.js +0 -3
  172. package/dist/permissions/permissions.js +1 -43
  173. package/dist/permissions/permissions__cache.js +12 -63
  174. package/dist/permissions-ng/permissions-ng.js +11 -19
  175. package/dist/place-under-ng/place-under-ng.js +0 -19
  176. package/dist/popup/popup.consts.js +0 -11
  177. package/dist/popup/popup.js +6 -68
  178. package/dist/popup/position.js +8 -30
  179. package/dist/popup-menu/popup-menu.js +4 -13
  180. package/dist/progress-bar/progress-bar.js +0 -14
  181. package/dist/promised-click-ng/promised-click-ng.js +3 -22
  182. package/dist/query-assist/query-assist.js +17 -201
  183. package/dist/radio/radio.js +0 -6
  184. package/dist/radio/radio__item.js +0 -9
  185. package/dist/radio-ng/radio-ng.js +0 -4
  186. package/dist/save-field-ng/save-field-ng.js +1 -37
  187. package/dist/select/select.js +18 -208
  188. package/dist/select/select__popup.js +4 -76
  189. package/dist/select-ng/select-ng.js +18 -74
  190. package/dist/select-ng/select-ng__lazy.js +2 -17
  191. package/dist/select-ng/select-ng__options.js +3 -29
  192. package/dist/shortcuts/core.js +4 -56
  193. package/dist/shortcuts/shortcuts-hoc.js +0 -4
  194. package/dist/shortcuts/shortcuts.js +0 -10
  195. package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +0 -13
  196. package/dist/shortcuts-ng/shortcuts-ng.js +16 -46
  197. package/dist/sidebar-ng/sidebar-ng.js +2 -12
  198. package/dist/storage/storage.js +2 -5
  199. package/dist/storage/storage__fallback.js +2 -48
  200. package/dist/storage/storage__local.js +0 -23
  201. package/dist/style.css +1 -1
  202. package/dist/tab-trap/tab-trap.js +0 -37
  203. package/dist/table/cell.js +0 -2
  204. package/dist/table/disable-hover-hoc.js +0 -9
  205. package/dist/table/header-cell.js +0 -8
  206. package/dist/table/header.js +0 -16
  207. package/dist/table/multitable.js +0 -23
  208. package/dist/table/row-with-focus-sensor.js +0 -12
  209. package/dist/table/row.js +0 -18
  210. package/dist/table/selection-adapter.js +0 -2
  211. package/dist/table/selection-shortcuts-hoc.js +8 -42
  212. package/dist/table/selection.js +0 -50
  213. package/dist/table/smart-table.js +0 -9
  214. package/dist/table/table.js +6 -37
  215. package/dist/table-legacy-ng/table-legacy-ng.js +12 -42
  216. package/dist/table-legacy-ng/table-legacy-ng__selection-navigate-actions.js +0 -31
  217. package/dist/table-legacy-ng/table-legacy-ng__selection.js +0 -32
  218. package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +2 -5
  219. package/dist/tabs/collapsible-more.js +0 -5
  220. package/dist/tabs/collapsible-tab.js +0 -4
  221. package/dist/tabs/collapsible-tabs.js +8 -28
  222. package/dist/tabs/dumb-tabs.js +0 -8
  223. package/dist/tabs/smart-tabs.js +0 -6
  224. package/dist/tabs/tab-link.js +0 -1
  225. package/dist/tabs/tab.js +0 -2
  226. package/dist/tabs-ng/tabs-ng.js +13 -29
  227. package/dist/tag/tag.js +0 -24
  228. package/dist/tags-input/tags-input.js +0 -76
  229. package/dist/tags-list/tags-list.js +0 -6
  230. package/dist/template-ng/template-ng.js +0 -12
  231. package/dist/text/text.js +0 -3
  232. package/dist/theme-ng/theme-ng.js +0 -8
  233. package/dist/title-ng/title-ng.js +6 -17
  234. package/dist/toggle/toggle.js +0 -4
  235. package/dist/tooltip/tooltip.js +4 -35
  236. package/dist/tooltip-ng/tooltip-ng.js +2 -8
  237. package/dist/user-agreement/service.js +0 -62
  238. package/dist/user-agreement/user-agreement.js +0 -8
  239. package/dist/user-card/smart-user-card-tooltip.js +2 -8
  240. package/dist/user-card/tooltip.js +0 -3
  241. package/package.json +22 -22
@@ -7,11 +7,9 @@ function extractPropTypes(_ref) {
7
7
  let {
8
8
  propTypes
9
9
  } = _ref;
10
-
11
10
  if (propTypes == null) {
12
11
  return propTypes;
13
12
  }
14
-
15
13
  const {
16
14
  selection,
17
15
  selectable,
@@ -21,54 +19,43 @@ function extractPropTypes(_ref) {
21
19
  } = propTypes;
22
20
  return restPropTypes;
23
21
  }
24
-
25
22
  function selectionShortcutsHOC(ComposedComponent) {
26
23
  class SelectionShortcuts extends PureComponent {
27
24
  constructor() {
28
25
  super(...arguments);
29
-
30
26
  _defineProperty(this, "onUpPress", () => {
31
27
  const {
32
28
  selection,
33
29
  onSelect
34
30
  } = this.props;
35
31
  const newSelection = selection.moveUp();
36
-
37
32
  if (newSelection) {
38
33
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelection);
39
34
  }
40
-
41
35
  return false;
42
36
  });
43
-
44
37
  _defineProperty(this, "onDownPress", () => {
45
38
  const {
46
39
  selection,
47
40
  onSelect
48
41
  } = this.props;
49
42
  const newSelection = selection.moveDown();
50
-
51
43
  if (newSelection) {
52
44
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelection);
53
45
  }
54
-
55
46
  return false;
56
47
  });
57
-
58
48
  _defineProperty(this, "shiftSelectionMode", void 0);
59
-
60
49
  _defineProperty(this, "onShiftKeyDown", () => {
61
50
  const {
62
51
  selection
63
52
  } = this.props;
64
-
65
53
  if (selection.isSelected(selection.getFocused())) {
66
54
  this.shiftSelectionMode = 'deletion';
67
55
  } else {
68
56
  this.shiftSelectionMode = 'addition';
69
57
  }
70
58
  });
71
-
72
59
  _defineProperty(this, "shiftSelect", selection => {
73
60
  if (this.shiftSelectionMode === 'addition') {
74
61
  return selection.select();
@@ -76,7 +63,6 @@ function selectionShortcutsHOC(ComposedComponent) {
76
63
  return selection.deselect();
77
64
  }
78
65
  });
79
-
80
66
  _defineProperty(this, "onShiftUpPress", e => {
81
67
  e.preventDefault();
82
68
  const {
@@ -84,21 +70,17 @@ function selectionShortcutsHOC(ComposedComponent) {
84
70
  selection,
85
71
  onSelect
86
72
  } = this.props;
87
-
88
73
  if (!selectable) {
89
74
  return;
90
75
  }
91
-
92
76
  const newSelection = this.shiftSelect(selection);
93
77
  const newMovedSelection = newSelection.moveUp();
94
-
95
78
  if (newMovedSelection) {
96
79
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(newMovedSelection);
97
80
  } else {
98
81
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelection);
99
82
  }
100
83
  });
101
-
102
84
  _defineProperty(this, "onShiftDownPress", e => {
103
85
  e.preventDefault();
104
86
  const {
@@ -106,87 +88,71 @@ function selectionShortcutsHOC(ComposedComponent) {
106
88
  selection,
107
89
  onSelect
108
90
  } = this.props;
109
-
110
91
  if (!selectable) {
111
92
  return;
112
93
  }
113
-
114
94
  const newSelection = this.shiftSelect(selection);
115
95
  const newMovedSelection = newSelection.moveDown();
116
-
117
96
  if (newMovedSelection) {
118
97
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(newMovedSelection);
119
98
  } else {
120
99
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelection);
121
100
  }
122
101
  });
123
-
124
102
  _defineProperty(this, "onHomePress", () => {
125
103
  const {
126
104
  selection,
127
105
  onSelect
128
106
  } = this.props;
129
107
  const newSelection = selection.moveStart();
130
-
131
108
  if (newSelection) {
132
109
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelection);
133
110
  }
134
-
135
111
  return false;
136
112
  });
137
-
138
113
  _defineProperty(this, "onEndPress", () => {
139
114
  const {
140
115
  selection,
141
116
  onSelect
142
117
  } = this.props;
143
118
  const newSelection = selection.moveEnd();
144
-
145
119
  if (newSelection) {
146
120
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelection);
147
121
  }
148
-
149
122
  return false;
150
123
  });
151
-
152
124
  _defineProperty(this, "onSpacePress", () => {
153
125
  const {
154
126
  selectable,
155
127
  selection,
156
128
  onSelect
157
129
  } = this.props;
158
-
159
130
  if (!selectable) {
160
131
  return true;
161
132
  }
162
-
163
133
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(selection.toggleSelection());
164
134
  return false;
165
135
  });
166
-
167
136
  _defineProperty(this, "onEscPress", () => {
168
137
  const {
169
138
  selection,
170
139
  onSelect
171
140
  } = this.props;
172
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(selection.reset()); //this.restoreFocusWithoutScroll();
141
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(selection.reset());
142
+ //this.restoreFocusWithoutScroll();
173
143
  });
174
-
175
144
  _defineProperty(this, "onCmdAPress", () => {
176
145
  const {
177
146
  selectable,
178
147
  selection,
179
148
  onSelect
180
149
  } = this.props;
181
-
182
150
  if (!selectable) {
183
151
  return true;
184
152
  }
185
-
186
153
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(selection.selectAll());
187
154
  return false;
188
155
  });
189
-
190
156
  _defineProperty(this, "shortcutsMap", {
191
157
  up: this.onUpPress,
192
158
  down: this.onDownPress,
@@ -201,7 +167,6 @@ function selectionShortcutsHOC(ComposedComponent) {
201
167
  'ctrl+a': this.onCmdAPress
202
168
  });
203
169
  }
204
-
205
170
  render() {
206
171
  const {
207
172
  selection,
@@ -214,21 +179,22 @@ function selectionShortcutsHOC(ComposedComponent) {
214
179
  selection: selection,
215
180
  selectable: selectable,
216
181
  onSelect: onSelect,
217
- shortcutsMap: { ...this.shortcutsMap,
182
+ shortcutsMap: {
183
+ ...this.shortcutsMap,
218
184
  ...this.props.shortcuts
219
185
  }
220
186
  }));
221
187
  }
222
-
223
188
  }
224
-
225
- SelectionShortcuts.propTypes = { ...extractPropTypes(ComposedComponent),
189
+ SelectionShortcuts.propTypes = {
190
+ ...extractPropTypes(ComposedComponent),
226
191
  selection: PropTypes.instanceOf(Selection).isRequired,
227
192
  selectable: PropTypes.bool,
228
193
  onSelect: PropTypes.func,
229
194
  shortcuts: PropTypes.object
230
195
  };
231
- SelectionShortcuts.defaultProps = { ...ComposedComponent.defaultProps,
196
+ SelectionShortcuts.defaultProps = {
197
+ ...ComposedComponent.defaultProps,
232
198
  selectable: true,
233
199
  onSelect: () => {},
234
200
  shortcuts: {}
@@ -10,21 +10,13 @@ class Selection {
10
10
  getChildren = () => [],
11
11
  isItemSelectable = () => true
12
12
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13
-
14
13
  _defineProperty(this, "_rawData", void 0);
15
-
16
14
  _defineProperty(this, "_getChildren", void 0);
17
-
18
15
  _defineProperty(this, "_data", void 0);
19
-
20
16
  _defineProperty(this, "_selected", void 0);
21
-
22
17
  _defineProperty(this, "_focused", void 0);
23
-
24
18
  _defineProperty(this, "_getKey", void 0);
25
-
26
19
  _defineProperty(this, "_isItemSelectable", void 0);
27
-
28
20
  this._rawData = data;
29
21
  this._getChildren = getChildren;
30
22
  this._data = this._buildData(data);
@@ -33,15 +25,12 @@ class Selection {
33
25
  this._getKey = getKey;
34
26
  this._isItemSelectable = isItemSelectable;
35
27
  }
36
-
37
28
  _buildData(data) {
38
29
  return new Set(data);
39
30
  }
40
-
41
31
  _buildSelected(data, selected) {
42
32
  return new Set(selected);
43
33
  }
44
-
45
34
  cloneWith(_ref) {
46
35
  let {
47
36
  data,
@@ -50,7 +39,6 @@ class Selection {
50
39
  } = _ref;
51
40
  const newData = data || this._rawData;
52
41
  let newSelected;
53
-
54
42
  if (data && !selected) {
55
43
  newSelected = new Set([...this._buildData(newData)].filter(item => [...this._selected].some(it => this._getKey(item) === this._getKey(it))));
56
44
  newSelected = this._buildSelected(this._buildData(newData), newSelected);
@@ -59,11 +47,8 @@ class Selection {
59
47
  } else {
60
48
  newSelected = this._selected;
61
49
  }
62
-
63
50
  newSelected = new Set([...newSelected].filter(item => this._isItemSelectable(item)));
64
-
65
51
  const cloneFocus = () => [...this._buildData(data)].filter(item => this._focused && this._getKey(item) === this._getKey(this._focused))[0];
66
-
67
52
  const newFocused = focused === undefined ? this._focused : focused;
68
53
  return new this.constructor({
69
54
  data: newData,
@@ -74,155 +59,121 @@ class Selection {
74
59
  isItemSelectable: this._isItemSelectable
75
60
  });
76
61
  }
77
-
78
62
  focus(value) {
79
63
  return this.cloneWith({
80
64
  focused: value
81
65
  });
82
66
  }
83
-
84
67
  moveUp() {
85
68
  const focused = this._focused;
86
69
  const data = [...this._data];
87
-
88
70
  if (!focused) {
89
71
  return this.cloneWith({
90
72
  focused: data[data.length - 1]
91
73
  });
92
74
  }
93
-
94
75
  const nextItem = data[data.indexOf(focused) - 1];
95
-
96
76
  if (nextItem) {
97
77
  return this.cloneWith({
98
78
  focused: nextItem
99
79
  });
100
80
  }
101
-
102
81
  return undefined;
103
82
  }
104
-
105
83
  moveDown() {
106
84
  const focused = this._focused;
107
85
  const data = [...this._data];
108
-
109
86
  if (!focused) {
110
87
  return this.cloneWith({
111
88
  focused: data[0]
112
89
  });
113
90
  }
114
-
115
91
  const nextItem = data[data.indexOf(focused) + 1];
116
-
117
92
  if (nextItem) {
118
93
  return this.cloneWith({
119
94
  focused: nextItem
120
95
  });
121
96
  }
122
-
123
97
  return undefined;
124
98
  }
125
-
126
99
  moveStart() {
127
100
  const data = [...this._data];
128
-
129
101
  if (data.length) {
130
102
  return this.cloneWith({
131
103
  focused: data[0]
132
104
  });
133
105
  }
134
-
135
106
  return undefined;
136
107
  }
137
-
138
108
  moveEnd() {
139
109
  const data = [...this._data];
140
-
141
110
  if (data.length) {
142
111
  return this.cloneWith({
143
112
  focused: data.pop()
144
113
  });
145
114
  }
146
-
147
115
  return undefined;
148
116
  }
149
-
150
117
  select() {
151
118
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
152
-
153
119
  if (!value || !this._isItemSelectable(value)) {
154
120
  return this;
155
121
  }
156
-
157
122
  const selected = new Set(this._selected);
158
123
  selected.add(value);
159
124
  return this.cloneWith({
160
125
  selected
161
126
  });
162
127
  }
163
-
164
128
  deselect() {
165
129
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
166
-
167
130
  if (!value || !this._isItemSelectable(value)) {
168
131
  return this;
169
132
  }
170
-
171
133
  const selected = new Set(this._selected);
172
134
  selected.delete(value);
173
135
  return this.cloneWith({
174
136
  selected
175
137
  });
176
138
  }
177
-
178
139
  toggleSelection() {
179
140
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
180
-
181
141
  if (this.isSelected(value)) {
182
142
  return this.deselect(value);
183
143
  } else {
184
144
  return this.select(value);
185
145
  }
186
146
  }
187
-
188
147
  selectAll() {
189
148
  return this.cloneWith({
190
149
  selected: [...this._data]
191
150
  });
192
151
  }
193
-
194
152
  resetFocus() {
195
153
  return this.cloneWith({
196
154
  focused: null
197
155
  });
198
156
  }
199
-
200
157
  resetSelection() {
201
158
  return this.cloneWith({
202
159
  selected: new Set()
203
160
  });
204
161
  }
205
-
206
162
  reset() {
207
163
  return this.resetFocus().resetSelection();
208
164
  }
209
-
210
165
  isFocused(value) {
211
166
  return this._focused === value;
212
167
  }
213
-
214
168
  isSelected(value) {
215
169
  return value != null && this._selected.has(value);
216
170
  }
217
-
218
171
  getFocused() {
219
172
  return this._focused;
220
173
  }
221
-
222
174
  getSelected() {
223
175
  return new Set(this._selected);
224
176
  }
225
-
226
177
  getActive() {
227
178
  if (this._selected.size) {
228
179
  return new Set(this._selected);
@@ -232,7 +183,6 @@ class Selection {
232
183
  return new Set();
233
184
  }
234
185
  }
235
-
236
186
  }
237
187
 
238
188
  export { Selection as default };
@@ -62,18 +62,15 @@ const {
62
62
  onSelect: __onSelect__,
63
63
  ...restPropTypes
64
64
  } = (_Table$propTypes = TableContainer.propTypes) !== null && _Table$propTypes !== void 0 ? _Table$propTypes : {};
65
-
66
65
  class SmartTable extends PureComponent {
67
66
  constructor() {
68
67
  super(...arguments);
69
-
70
68
  _defineProperty(this, "state", {
71
69
  selection: new Selection({
72
70
  data: this.props.data,
73
71
  isItemSelectable: this.props.isItemSelectable
74
72
  })
75
73
  });
76
-
77
74
  _defineProperty(this, "onSelect", selection => {
78
75
  this.setState({
79
76
  selection
@@ -81,14 +78,12 @@ class SmartTable extends PureComponent {
81
78
  this.props.onSelectionChange(selection);
82
79
  });
83
80
  }
84
-
85
81
  UNSAFE_componentWillReceiveProps(nextProps) {
86
82
  const {
87
83
  data,
88
84
  isItemSelectable,
89
85
  selection
90
86
  } = nextProps;
91
-
92
87
  if (this.props.remoteSelection && this.props.selection !== selection) {
93
88
  this.setState({
94
89
  selection
@@ -102,22 +97,18 @@ class SmartTable extends PureComponent {
102
97
  });
103
98
  }
104
99
  }
105
-
106
100
  render() {
107
101
  return /*#__PURE__*/React.createElement(TableContainer, _extends({}, this.props, {
108
102
  selection: this.state.selection,
109
103
  onSelect: this.onSelect
110
104
  }));
111
105
  }
112
-
113
106
  }
114
-
115
107
  _defineProperty(SmartTable, "propTypes", {
116
108
  onSelectionChange: PropTypes.func,
117
109
  isItemSelectable: PropTypes.func,
118
110
  ...restPropTypes
119
111
  });
120
-
121
112
  _defineProperty(SmartTable, "defaultProps", {
122
113
  onSelectionChange: () => {}
123
114
  });
@@ -58,16 +58,13 @@ import './cell.js';
58
58
  /**
59
59
  * Interactive table with selection and keyboard navigation support.
60
60
  */
61
-
62
61
  class Table extends PureComponent {
63
62
  constructor() {
64
63
  super(...arguments);
65
-
66
64
  _defineProperty(this, "state", {
67
65
  shortcutsScope: getUID('ring-table-'),
68
66
  userSelectNone: false
69
67
  });
70
-
71
68
  _defineProperty(this, "onMouseDown", e => {
72
69
  if (e.shiftKey) {
73
70
  this.setState({
@@ -75,7 +72,6 @@ class Table extends PureComponent {
75
72
  });
76
73
  }
77
74
  });
78
-
79
75
  _defineProperty(this, "onMouseUp", () => {
80
76
  if (this.state.userSelectNone) {
81
77
  this.setState({
@@ -83,7 +79,6 @@ class Table extends PureComponent {
83
79
  });
84
80
  }
85
81
  });
86
-
87
82
  _defineProperty(this, "onRowFocus", row => {
88
83
  const {
89
84
  selection,
@@ -91,20 +86,17 @@ class Table extends PureComponent {
91
86
  } = this.props;
92
87
  onSelect(selection.focus(row));
93
88
  });
94
-
95
89
  _defineProperty(this, "onRowSelect", (row, selected) => {
96
90
  const {
97
91
  selection,
98
92
  onSelect
99
93
  } = this.props;
100
-
101
94
  if (selected) {
102
95
  onSelect(selection.select(row));
103
96
  } else {
104
97
  onSelect(selection.deselect(row));
105
98
  }
106
99
  });
107
-
108
100
  _defineProperty(this, "onSortEnd", _ref => {
109
101
  let {
110
102
  oldIndex,
@@ -117,7 +109,6 @@ class Table extends PureComponent {
117
109
  newIndex
118
110
  });
119
111
  });
120
-
121
112
  _defineProperty(this, "onCheckboxChange", e => {
122
113
  const {
123
114
  checked
@@ -126,16 +117,13 @@ class Table extends PureComponent {
126
117
  selection,
127
118
  onSelect
128
119
  } = this.props;
129
-
130
120
  if (checked) {
131
121
  onSelect(selection.selectAll());
132
122
  } else {
133
123
  onSelect(selection.reset());
134
124
  }
135
-
136
125
  this.restoreFocusWithoutScroll();
137
126
  });
138
-
139
127
  _defineProperty(this, "restoreFocusWithoutScroll", () => {
140
128
  const {
141
129
  scrollX,
@@ -145,11 +133,9 @@ class Table extends PureComponent {
145
133
  window.scrollTo(scrollX, scrollY);
146
134
  });
147
135
  }
148
-
149
136
  componentDidMount() {
150
137
  document.addEventListener('mouseup', this.onMouseUp);
151
138
  }
152
-
153
139
  componentDidUpdate(_ref2) {
154
140
  let {
155
141
  data,
@@ -158,22 +144,18 @@ class Table extends PureComponent {
158
144
  selectable,
159
145
  remoteSelection
160
146
  } = _ref2;
161
-
162
147
  if (data !== this.props.data && remoteSelection) {
163
148
  onSelect(selection.cloneWith({
164
149
  data: this.props.data
165
150
  }));
166
151
  }
167
-
168
152
  if (!this.props.selectable && this.props.selectable !== selectable) {
169
153
  onSelect(selection.resetSelection());
170
154
  }
171
155
  }
172
-
173
156
  componentWillUnmount() {
174
157
  document.removeEventListener('mouseup', this.onMouseUp);
175
158
  }
176
-
177
159
  render() {
178
160
  const {
179
161
  data,
@@ -207,8 +189,8 @@ class Table extends PureComponent {
207
189
  onItemDoubleClick,
208
190
  onItemClick,
209
191
  renderEmpty
210
- } = this.props; // NOTE: Do not construct new object per render because it causes all rows rerendering
211
-
192
+ } = this.props;
193
+ // NOTE: Do not construct new object per render because it causes all rows rerendering
212
194
  const headerProps = {
213
195
  caption,
214
196
  selectable,
@@ -235,7 +217,6 @@ class Table extends PureComponent {
235
217
  [modules_1db4bbca.userSelectNone]: this.state.userSelectNone,
236
218
  [modules_1db4bbca.disabledHover]: this.props.disabledHover
237
219
  });
238
-
239
220
  const renderList = _ref3 => {
240
221
  let {
241
222
  children,
@@ -253,18 +234,15 @@ class Table extends PureComponent {
253
234
  "data-test": "ring-table-body"
254
235
  }), tbody));
255
236
  };
256
-
257
237
  const renderItem = _ref4 => {
258
238
  let {
259
239
  value,
260
240
  props = {},
261
241
  isDragged
262
242
  } = _ref4;
263
-
264
243
  if (value == null) {
265
244
  return null;
266
245
  }
267
-
268
246
  const {
269
247
  ref,
270
248
  ...restProps
@@ -300,12 +278,12 @@ class Table extends PureComponent {
300
278
  "data-test": getItemDataTest(value)
301
279
  }, restProps));
302
280
  return isDragged ? /*#__PURE__*/React.createElement("table", {
303
- style: { ...props.style,
281
+ style: {
282
+ ...props.style,
304
283
  borderSpacing: 0
305
284
  }
306
285
  }, /*#__PURE__*/React.createElement("tbody", null, row)) : row;
307
286
  };
308
-
309
287
  return /*#__PURE__*/React.createElement("div", {
310
288
  className: wrapperClasses,
311
289
  "data-test": "ring-table-wrapper",
@@ -332,9 +310,7 @@ class Table extends PureComponent {
332
310
  className: loaderClassName
333
311
  })));
334
312
  }
335
-
336
313
  }
337
-
338
314
  _defineProperty(Table, "defaultProps", {
339
315
  isItemSelectable: () => true,
340
316
  loading: false,
@@ -360,7 +336,6 @@ _defineProperty(Table, "defaultProps", {
360
336
  isDisabledSelectionVisible: () => false,
361
337
  getCheckboxTooltip: () => undefined
362
338
  });
363
-
364
339
  Table.propTypes = {
365
340
  className: PropTypes.string,
366
341
  loaderClassName: PropTypes.string,
@@ -404,23 +379,17 @@ Table.propTypes = {
404
379
  remoteSelection: PropTypes.bool,
405
380
  renderEmpty: PropTypes.func
406
381
  };
407
-
408
- const getContainer = () => disableHoverHOC(selectionShortcutsHOC(focusSensorHOC(Table))); // eslint-disable-next-line react/no-multi-comp
409
-
410
-
382
+ const getContainer = () => disableHoverHOC(selectionShortcutsHOC(focusSensorHOC(Table)));
383
+ // eslint-disable-next-line react/no-multi-comp
411
384
  class TableContainer extends Component {
412
385
  constructor() {
413
386
  super(...arguments);
414
-
415
387
  _defineProperty(this, "Table", getContainer());
416
388
  }
417
-
418
389
  render() {
419
390
  return /*#__PURE__*/React.createElement(this.Table, this.props);
420
391
  }
421
-
422
392
  }
423
-
424
393
  _defineProperty(TableContainer, "propTypes", getContainer().propTypes);
425
394
 
426
395
  export { Table, TableContainer as default };