@jetbrains/ring-ui-built 7.0.0-beta.2 → 7.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/_helpers/_rollupPluginBabelHelpers.js +1 -504
- package/components/_helpers/anchor.js +7 -5
- package/components/_helpers/button__classes.js +15 -13
- package/components/_helpers/caption.js +11 -17
- package/components/_helpers/card.js +92 -96
- package/components/_helpers/dialog__body-scroll-preventer.js +10 -17
- package/components/_helpers/icon__svg.js +27 -23
- package/components/_helpers/input.js +150 -171
- package/components/_helpers/query-assist__suggestions.js +78 -93
- package/components/_helpers/select__filter.js +56 -67
- package/components/_helpers/services-link.js +23 -29
- package/components/_helpers/sidebar.js +91 -93
- package/components/_helpers/tab-link.js +8 -6
- package/components/_helpers/theme.js +41 -50
- package/components/_helpers/title.js +59 -69
- package/components/alert/alert.js +112 -156
- package/components/alert/container.js +32 -39
- package/components/alert-service/alert-service.js +104 -161
- package/components/analytics/analytics.js +12 -20
- package/components/analytics/analytics__custom-plugin.js +52 -68
- package/components/auth/auth.js +2 -27
- package/components/auth/auth__core.d.ts +1 -1
- package/components/auth/auth__core.js +742 -1428
- package/components/auth/background-flow.js +84 -121
- package/components/auth/down-notification.js +31 -69
- package/components/auth/iframe-flow.js +70 -123
- package/components/auth/request-builder.js +46 -77
- package/components/auth/response-parser.js +84 -112
- package/components/auth/storage.js +160 -318
- package/components/auth/token-validator.js +132 -227
- package/components/auth/window-flow.js +84 -121
- package/components/auth-dialog/auth-dialog.js +99 -150
- package/components/auth-dialog-service/auth-dialog-service.js +6 -26
- package/components/avatar/avatar-example-datauri.js +1 -1
- package/components/avatar/avatar.js +94 -123
- package/components/avatar/fallback-avatar.js +20 -34
- package/components/badge/badge.js +32 -38
- package/components/breadcrumbs/breadcrumbs.js +13 -17
- package/components/button/button.js +67 -80
- package/components/button-group/button-group.js +27 -36
- package/components/button-set/button-set.js +19 -27
- package/components/button-toolbar/button-toolbar.js +17 -25
- package/components/caret/caret.js +184 -211
- package/components/checkbox/checkbox.js +69 -86
- package/components/clipboard/clipboard-fallback.js +7 -7
- package/components/clipboard/clipboard.js +36 -128
- package/components/code/code.js +83 -151
- package/components/collapse/collapse-content.js +42 -60
- package/components/collapse/collapse-context.js +2 -2
- package/components/collapse/collapse-control.js +12 -12
- package/components/collapse/collapse.js +12 -17
- package/components/collapse/consts.js +4 -4
- package/components/collapse/utils.js +1 -3
- package/components/confirm/confirm.js +57 -87
- package/components/confirm-service/confirm-service.js +23 -44
- package/components/content-layout/content-layout.js +41 -56
- package/components/content-layout/sidebar.js +1 -1
- package/components/contenteditable/contenteditable.js +38 -46
- package/components/control-help/control-help.js +5 -3
- package/components/control-label/control-label.js +9 -8
- package/components/data-list/data-list.js +113 -156
- package/components/data-list/data-list.mock.js +3 -5
- package/components/data-list/item.js +120 -140
- package/components/data-list/selection.js +77 -135
- package/components/data-list/title.js +2 -10
- package/components/date-picker/consts.js +16 -22
- package/components/date-picker/date-input.js +99 -124
- package/components/date-picker/date-picker.js +140 -184
- package/components/date-picker/date-popup.js +280 -327
- package/components/date-picker/day.js +71 -94
- package/components/date-picker/month-names.js +41 -59
- package/components/date-picker/month-slider.js +42 -61
- package/components/date-picker/month.js +17 -24
- package/components/date-picker/months.js +44 -49
- package/components/date-picker/weekdays.js +12 -21
- package/components/date-picker/years.js +77 -98
- package/components/dialog/dialog.js +151 -187
- package/components/dialog/dialog__body-scroll-preventer.js +0 -3
- package/components/dropdown/anchor.js +0 -6
- package/components/dropdown/dropdown.js +134 -154
- package/components/dropdown-menu/dropdown-menu.js +59 -87
- package/components/editable-heading/editable-heading.js +69 -116
- package/components/error-bubble/error-bubble.js +29 -54
- package/components/error-message/error-message.js +34 -49
- package/components/footer/footer.js +27 -28
- package/components/global/compose.js +1 -8
- package/components/global/composeRefs.d.ts +0 -3
- package/components/global/composeRefs.js +8 -15
- package/components/global/controls-height.js +2 -2
- package/components/global/create-stateful-context.js +14 -13
- package/components/global/data-tests.js +7 -12
- package/components/global/dom.js +49 -82
- package/components/global/focus-sensor-hoc.js +99 -106
- package/components/global/fuzzy-highlight.js +23 -34
- package/components/global/get-event-key.js +8 -8
- package/components/global/get-uid.js +3 -7
- package/components/global/inject-styles.js +7 -14
- package/components/global/listeners.js +28 -47
- package/components/global/memoize.js +6 -10
- package/components/global/normalize-indent.js +19 -46
- package/components/global/promise-with-timeout.js +6 -8
- package/components/global/prop-types.js +3 -5
- package/components/global/react-dom-renderer.js +29 -40
- package/components/global/rerender-hoc.js +16 -32
- package/components/global/schedule-raf.js +4 -4
- package/components/global/sniffer.js +1 -1
- package/components/global/theme.js +1 -18
- package/components/global/trivial-template-tag.js +4 -9
- package/components/global/typescript-utils.js +2 -6
- package/components/global/url.js +20 -23
- package/components/global/use-event-callback.js +7 -4
- package/components/grid/col.js +27 -39
- package/components/grid/grid.js +18 -27
- package/components/grid/row.js +23 -30
- package/components/group/group.js +16 -22
- package/components/header/header-icon.js +19 -31
- package/components/header/header.d.ts +0 -1
- package/components/header/header.js +30 -64
- package/components/header/links.js +6 -3
- package/components/header/logo.js +15 -26
- package/components/header/profile.js +124 -150
- package/components/header/services-link.js +1 -3
- package/components/header/services.js +64 -97
- package/components/header/smart-profile.js +101 -178
- package/components/header/smart-services.js +55 -90
- package/components/header/tray.js +21 -30
- package/components/heading/heading.js +21 -20
- package/components/http/http.js +162 -319
- package/components/http/http.mock.js +50 -98
- package/components/hub-source/hub-source.js +77 -182
- package/components/hub-source/hub-source__user.js +9 -37
- package/components/hub-source/hub-source__users-groups.js +34 -60
- package/components/i18n/i18n-context.js +7 -8
- package/components/i18n/i18n.js +3 -6
- package/components/icon/icon.js +60 -74
- package/components/icon/icon__svg.js +0 -5
- package/components/icon/index.js +0 -5
- package/components/input/input.js +1 -11
- package/components/island/adaptive-island-hoc.js +29 -37
- package/components/island/content.js +100 -110
- package/components/island/header.js +56 -66
- package/components/island/island.js +25 -33
- package/components/island-legacy/content-legacy.js +16 -22
- package/components/island-legacy/header-legacy.js +19 -25
- package/components/island-legacy/island-legacy.js +16 -22
- package/components/link/clickableLink.js +33 -42
- package/components/link/link.js +47 -55
- package/components/list/consts.js +2 -2
- package/components/list/list.js +399 -486
- package/components/list/list__custom.js +51 -61
- package/components/list/list__hint.js +9 -17
- package/components/list/list__item.js +147 -178
- package/components/list/list__link.js +38 -47
- package/components/list/list__separator.js +15 -24
- package/components/list/list__title.js +25 -34
- package/components/list/list__users-groups-source.js +55 -121
- package/components/loader/loader.js +38 -60
- package/components/loader/loader__core.js +123 -184
- package/components/loader-inline/loader-inline.js +24 -32
- package/components/loader-screen/loader-screen.js +24 -40
- package/components/login-dialog/login-dialog.js +81 -121
- package/components/login-dialog/service.js +6 -29
- package/components/markdown/markdown.js +16 -24
- package/components/message/message.js +170 -201
- package/components/old-browsers-message/old-browsers-message.js +11 -14
- package/components/old-browsers-message/old-browsers-message__stop.js +1 -4
- package/components/old-browsers-message/white-list.js +8 -13
- package/components/pager/pager.js +212 -257
- package/components/panel/panel.js +16 -22
- package/components/permissions/permissions.js +118 -161
- package/components/permissions/permissions__cache.js +191 -218
- package/components/popup/popup.consts.js +1 -1
- package/components/popup/popup.js +237 -288
- package/components/popup/popup.target.js +9 -7
- package/components/popup/position.js +94 -101
- package/components/popup-menu/popup-menu.js +33 -67
- package/components/progress-bar/progress-bar.js +57 -68
- package/components/query-assist/query-assist.js +583 -652
- package/components/query-assist/query-assist__suggestions.js +2 -26
- package/components/radio/radio.js +15 -27
- package/components/radio/radio__item.js +52 -62
- package/components/scrollable-section/scrollable-section.js +22 -32
- package/components/select/select.js +693 -793
- package/components/select/select__filter.js +1 -26
- package/components/select/select__popup.js +316 -413
- package/components/shortcuts/core.js +147 -195
- package/components/shortcuts/shortcut-title.js +6 -10
- package/components/shortcuts/shortcuts-hoc.js +23 -41
- package/components/shortcuts/shortcuts.js +41 -64
- package/components/slider/slider.js +93 -112
- package/components/slider/slider.utils.js +16 -23
- package/components/storage/storage.js +3 -27
- package/components/storage/storage__fallback.js +137 -210
- package/components/storage/storage__local.js +89 -147
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +35 -53
- package/components/table/cell.js +11 -21
- package/components/table/disable-hover-hoc.js +27 -42
- package/components/table/header-cell.js +59 -75
- package/components/table/header.js +89 -110
- package/components/table/multitable.js +83 -89
- package/components/table/row-with-focus-sensor.js +25 -57
- package/components/table/row.js +169 -200
- package/components/table/selection-adapter.js +2 -2
- package/components/table/selection-shortcuts-hoc.js +108 -113
- package/components/table/selection.js +150 -217
- package/components/table/simple-table.js +19 -55
- package/components/table/smart-table.js +42 -76
- package/components/table/table.js +267 -327
- package/components/tabs/collapsible-more.js +47 -73
- package/components/tabs/collapsible-tab.js +32 -36
- package/components/tabs/collapsible-tabs.js +89 -148
- package/components/tabs/custom-item.js +4 -2
- package/components/tabs/dumb-tabs.js +60 -92
- package/components/tabs/smart-tabs.js +29 -61
- package/components/tabs/tab-link.js +1 -3
- package/components/tabs/tab.js +15 -24
- package/components/tabs/tabs.js +1 -26
- package/components/tag/tag.d.ts +0 -2
- package/components/tag/tag.js +120 -162
- package/components/tags-input/tags-input.js +222 -304
- package/components/tags-list/tags-list.js +45 -61
- package/components/text/text.js +28 -37
- package/components/toggle/toggle.js +51 -61
- package/components/tooltip/tooltip.js +109 -141
- package/components/user-agreement/service.js +259 -400
- package/components/user-agreement/user-agreement.js +80 -108
- package/components/user-card/card.js +1 -25
- package/components/user-card/smart-user-card-tooltip.js +52 -103
- package/components/user-card/tooltip.js +35 -65
- package/components/user-card/user-card.js +1 -25
- package/package.json +1 -1
- package/components/global/react-render-adapter.d.ts +0 -1
- package/components/global/react-render-adapter.js +0 -6
- package/components/header/tray-icon.d.ts +0 -1
- package/components/header/tray-icon.js +0 -26
package/components/list/list.js
CHANGED
@@ -1,14 +1,6 @@
|
|
1
|
-
import { _ as _defineProperty, a as
|
2
|
-
import 'core-js/modules/es.symbol.js';
|
1
|
+
import { _ as _defineProperty, a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
3
2
|
import 'core-js/modules/es.symbol.description.js';
|
4
|
-
import 'core-js/modules/
|
5
|
-
import 'core-js/modules/es.array.find.js';
|
6
|
-
import 'core-js/modules/es.array.find-index.js';
|
7
|
-
import 'core-js/modules/es.array.includes.js';
|
8
|
-
import 'core-js/modules/es.array.map.js';
|
9
|
-
import 'core-js/modules/es.object.assign.js';
|
10
|
-
import 'core-js/modules/es.object.to-string.js';
|
11
|
-
import 'core-js/modules/es.string.includes.js';
|
3
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
12
4
|
import { Component, createElement } from 'react';
|
13
5
|
import PropTypes from 'prop-types';
|
14
6
|
import classNames from 'classnames';
|
@@ -35,72 +27,52 @@ import { Type, Dimension, DEFAULT_ITEM_TYPE } from './consts.js';
|
|
35
27
|
import { m as modules_3b67a421 } from '../_helpers/list.js';
|
36
28
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
37
29
|
import 'core-js/modules/es.array.reduce.js';
|
38
|
-
import 'core-js/modules/es.object.entries.js';
|
39
|
-
import 'core-js/modules/es.regexp.to-string.js';
|
40
|
-
import 'core-js/modules/es.array.iterator.js';
|
41
|
-
import 'core-js/modules/es.map.js';
|
42
|
-
import 'core-js/modules/es.weak-map.js';
|
43
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
44
|
-
import 'core-js/modules/es.array.filter.js';
|
45
30
|
import 'core-js/modules/es.regexp.exec.js';
|
46
|
-
import 'core-js/modules/es.set.js';
|
47
|
-
import 'core-js/modules/es.string.split.js';
|
48
|
-
import 'core-js/modules/web.dom-collections.for-each.js';
|
49
31
|
import '../shortcuts/core.js';
|
50
|
-
import 'core-js/modules/es.array.slice.js';
|
51
|
-
import 'core-js/modules/es.array.splice.js';
|
52
|
-
import 'core-js/modules/es.string.match.js';
|
53
32
|
import 'combokeys';
|
54
33
|
import '../global/sniffer.js';
|
55
34
|
import 'sniffr';
|
56
35
|
import '../link/link.js';
|
57
36
|
import '../link/clickableLink.js';
|
58
37
|
import '../_helpers/link.js';
|
59
|
-
import 'core-js/modules/es.array.index-of.js';
|
60
38
|
import '../avatar/avatar.js';
|
61
39
|
import '../global/url.js';
|
62
40
|
import 'core-js/modules/es.string.replace.js';
|
63
41
|
import '../avatar/fallback-avatar.js';
|
64
|
-
import 'core-js/modules/es.array.from.js';
|
65
42
|
import '../checkbox/checkbox.js';
|
66
43
|
import '@jetbrains/icons/checkmark-12px';
|
67
44
|
import '@jetbrains/icons/remove-12px';
|
68
45
|
import '../icon/icon.js';
|
69
46
|
import '../icon/icon__constants.js';
|
70
47
|
import '../_helpers/icon__svg.js';
|
71
|
-
import 'core-js/modules/es.string.starts-with.js';
|
72
48
|
import '../global/prop-types.js';
|
73
49
|
import '../global/composeRefs.js';
|
74
50
|
import '../control-help/control-help.js';
|
75
51
|
import '../global/get-event-key.js';
|
76
52
|
|
77
|
-
|
53
|
+
const _excluded = ["selectedLabel", "originalModel"];
|
78
54
|
function noop() {}
|
79
|
-
|
55
|
+
const warnEmptyKey = deprecate(() => {}, 'No key passed for list item with non-string label. It is considered as a bad practice and has been deprecated, please provide a key.');
|
80
56
|
/**
|
81
57
|
* @param {Type} listItemType
|
82
58
|
* @param {Object} item list item
|
83
59
|
*/
|
84
60
|
function isItemType(listItemType, item) {
|
85
|
-
|
61
|
+
let type = item.rgItemType;
|
86
62
|
if (type == null) {
|
87
63
|
type = DEFAULT_ITEM_TYPE;
|
88
64
|
}
|
89
65
|
return type === listItemType;
|
90
66
|
}
|
91
|
-
|
67
|
+
const nonActivatableTypes = [Type.SEPARATOR, Type.TITLE, Type.MARGIN];
|
92
68
|
function isActivatable(item) {
|
93
69
|
return item != null && !nonActivatableTypes.includes(item.rgItemType) && !item.disabled;
|
94
70
|
}
|
95
71
|
function getDataHash(data) {
|
96
|
-
return data.map(
|
97
|
-
return "".concat(it.key, "-").concat(it.disabled);
|
98
|
-
}).join('-');
|
72
|
+
return data.map(it => "".concat(it.key, "-").concat(it.disabled)).join('-');
|
99
73
|
}
|
100
|
-
|
101
|
-
|
102
|
-
};
|
103
|
-
var ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
|
74
|
+
const shouldActivateFirstItem = props => props.activateFirstItem || props.activateSingleItem && props.data.length === 1;
|
75
|
+
const ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
|
104
76
|
/**
|
105
77
|
* @name List
|
106
78
|
* @constructor
|
@@ -109,15 +81,12 @@ var ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
|
|
109
81
|
/**
|
110
82
|
* Displays a list of items.
|
111
83
|
*/
|
112
|
-
|
113
|
-
|
84
|
+
class List extends Component {
|
85
|
+
constructor() {
|
114
86
|
var _this;
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
}
|
119
|
-
_this = _callSuper(this, List, [].concat(args));
|
120
|
-
_defineProperty(_this, "state", {
|
87
|
+
super(...arguments);
|
88
|
+
_this = this;
|
89
|
+
_defineProperty(this, "state", {
|
121
90
|
activeIndex: null,
|
122
91
|
prevActiveIndex: null,
|
123
92
|
prevData: [],
|
@@ -128,37 +97,33 @@ var List = /*#__PURE__*/function (_Component) {
|
|
128
97
|
disabledHover: false,
|
129
98
|
scrolledToBottom: false
|
130
99
|
});
|
131
|
-
_defineProperty(
|
132
|
-
_defineProperty(
|
133
|
-
_defineProperty(
|
134
|
-
_defineProperty(
|
135
|
-
_defineProperty(
|
136
|
-
_defineProperty(
|
137
|
-
|
138
|
-
return
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
activeItem: _this.props.data[index],
|
146
|
-
needScrollToActive: false
|
147
|
-
});
|
148
|
-
}
|
100
|
+
_defineProperty(this, "scheduleScrollListener", scheduleRAF());
|
101
|
+
_defineProperty(this, "scheduleHoverListener", scheduleRAF());
|
102
|
+
_defineProperty(this, "virtualizedList", void 0);
|
103
|
+
_defineProperty(this, "unmounted", void 0);
|
104
|
+
_defineProperty(this, "container", void 0);
|
105
|
+
_defineProperty(this, "hoverHandler", memoize(index => () => this.scheduleHoverListener(() => {
|
106
|
+
if (this.state.disabledHover) {
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
if (this.container) {
|
110
|
+
this.setState({
|
111
|
+
activeIndex: index,
|
112
|
+
activeItem: this.props.data[index],
|
113
|
+
needScrollToActive: false
|
149
114
|
});
|
150
|
-
}
|
151
|
-
}));
|
115
|
+
}
|
116
|
+
})));
|
152
117
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
153
|
-
_defineProperty(
|
118
|
+
_defineProperty(this, "_bufferSize", 10);
|
154
119
|
// keep X items above and below of the visible area
|
155
120
|
// reuse size cache for similar items
|
156
|
-
_defineProperty(
|
157
|
-
if (index === 0 || index ===
|
121
|
+
_defineProperty(this, "sizeCacheKey", index => {
|
122
|
+
if (index === 0 || index === this.props.data.length + 1) {
|
158
123
|
return Type.MARGIN;
|
159
124
|
}
|
160
|
-
|
161
|
-
|
125
|
+
const item = this.props.data[index - 1];
|
126
|
+
const isFirst = index === 1;
|
162
127
|
switch (item.rgItemType) {
|
163
128
|
case Type.SEPARATOR:
|
164
129
|
case Type.TITLE:
|
@@ -176,51 +141,44 @@ var List = /*#__PURE__*/function (_Component) {
|
|
176
141
|
return Type.ITEM;
|
177
142
|
}
|
178
143
|
});
|
179
|
-
_defineProperty(
|
180
|
-
defaultHeight:
|
144
|
+
_defineProperty(this, "_cache", new CellMeasurerCache({
|
145
|
+
defaultHeight: this.defaultItemHeight(),
|
181
146
|
fixedWidth: true,
|
182
|
-
keyMapper:
|
183
|
-
}));
|
184
|
-
_defineProperty(_this, "_hasActivatableItems", memoizeOne(function (items) {
|
185
|
-
return items.some(isActivatable);
|
147
|
+
keyMapper: this.sizeCacheKey
|
186
148
|
}));
|
187
|
-
_defineProperty(
|
188
|
-
|
149
|
+
_defineProperty(this, "_hasActivatableItems", memoizeOne(items => items.some(isActivatable)));
|
150
|
+
_defineProperty(this, "activateFirst", () => {
|
151
|
+
const firstActivatableIndex = this.props.data.findIndex(isActivatable);
|
189
152
|
if (firstActivatableIndex >= 0) {
|
190
|
-
|
153
|
+
this.setState({
|
191
154
|
activeIndex: firstActivatableIndex,
|
192
|
-
activeItem:
|
155
|
+
activeItem: this.props.data[firstActivatableIndex],
|
193
156
|
needScrollToActive: true
|
194
157
|
});
|
195
158
|
}
|
196
159
|
});
|
197
|
-
_defineProperty(
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
}
|
211
|
-
};
|
212
|
-
}));
|
213
|
-
_defineProperty(_this, "checkboxHandler", memoize(function (index) {
|
214
|
-
return function (event) {
|
215
|
-
return _this.selectHandler(index)(event, true);
|
216
|
-
};
|
160
|
+
_defineProperty(this, "selectHandler", memoize(index => function (event) {
|
161
|
+
let tryKeepOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
162
|
+
const item = _this.props.data[index];
|
163
|
+
if (!_this.props.useMouseUp && item.onClick) {
|
164
|
+
item.onClick(item, event);
|
165
|
+
} else if (_this.props.useMouseUp && item.onMouseUp) {
|
166
|
+
item.onMouseUp(item, event);
|
167
|
+
}
|
168
|
+
if (_this.props.onSelect) {
|
169
|
+
_this.props.onSelect(item, event, {
|
170
|
+
tryKeepOpen
|
171
|
+
});
|
172
|
+
}
|
217
173
|
}));
|
218
|
-
_defineProperty(
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
174
|
+
_defineProperty(this, "checkboxHandler", memoize(index => event => this.selectHandler(index)(event, true)));
|
175
|
+
_defineProperty(this, "upHandler", e => {
|
176
|
+
const {
|
177
|
+
data,
|
178
|
+
disableMoveOverflow
|
179
|
+
} = this.props;
|
180
|
+
const index = this.state.activeIndex;
|
181
|
+
let newIndex;
|
224
182
|
if (index === null || index === 0) {
|
225
183
|
if (!disableMoveOverflow) {
|
226
184
|
newIndex = data.length - 1;
|
@@ -230,15 +188,16 @@ var List = /*#__PURE__*/function (_Component) {
|
|
230
188
|
} else {
|
231
189
|
newIndex = index - 1;
|
232
190
|
}
|
233
|
-
|
191
|
+
this.moveHandler(newIndex, this.upHandler, e);
|
234
192
|
});
|
235
|
-
_defineProperty(
|
236
|
-
|
237
|
-
data
|
238
|
-
disableMoveOverflow
|
239
|
-
disableMoveDownOverflow
|
240
|
-
|
241
|
-
|
193
|
+
_defineProperty(this, "downHandler", e => {
|
194
|
+
const {
|
195
|
+
data,
|
196
|
+
disableMoveOverflow,
|
197
|
+
disableMoveDownOverflow
|
198
|
+
} = this.props;
|
199
|
+
const index = this.state.activeIndex;
|
200
|
+
let newIndex;
|
242
201
|
if (index === null) {
|
243
202
|
newIndex = 0;
|
244
203
|
} else if (index + 1 === data.length) {
|
@@ -250,43 +209,43 @@ var List = /*#__PURE__*/function (_Component) {
|
|
250
209
|
} else {
|
251
210
|
newIndex = index + 1;
|
252
211
|
}
|
253
|
-
|
212
|
+
this.moveHandler(newIndex, this.downHandler, e);
|
254
213
|
});
|
255
|
-
_defineProperty(
|
256
|
-
|
214
|
+
_defineProperty(this, "homeHandler", e => {
|
215
|
+
this.moveHandler(0, this.downHandler, e);
|
257
216
|
});
|
258
|
-
_defineProperty(
|
259
|
-
|
217
|
+
_defineProperty(this, "endHandler", e => {
|
218
|
+
this.moveHandler(this.props.data.length - 1, this.upHandler, e);
|
260
219
|
});
|
261
|
-
_defineProperty(
|
262
|
-
if (
|
263
|
-
|
220
|
+
_defineProperty(this, "onDocumentMouseMove", () => {
|
221
|
+
if (this.state.disabledHover) {
|
222
|
+
this.setState({
|
264
223
|
disabledHover: false
|
265
224
|
});
|
266
225
|
}
|
267
226
|
});
|
268
|
-
_defineProperty(
|
269
|
-
|
270
|
-
if (!
|
271
|
-
|
227
|
+
_defineProperty(this, "onDocumentKeyDown", e => {
|
228
|
+
const metaKeys = [16, 17, 18, 19, 20, 91]; // eslint-disable-line @typescript-eslint/no-magic-numbers
|
229
|
+
if (!this.state.disabledHover && !metaKeys.includes(e.keyCode)) {
|
230
|
+
this.setState({
|
272
231
|
disabledHover: true
|
273
232
|
});
|
274
233
|
}
|
275
234
|
});
|
276
|
-
_defineProperty(
|
277
|
-
|
235
|
+
_defineProperty(this, "mouseHandler", () => {
|
236
|
+
this.setState({
|
278
237
|
scrolling: false
|
279
238
|
});
|
280
239
|
});
|
281
|
-
_defineProperty(
|
282
|
-
|
240
|
+
_defineProperty(this, "scrollHandler", () => {
|
241
|
+
this.setState({
|
283
242
|
scrolling: true
|
284
|
-
},
|
243
|
+
}, this.scrollEndHandler);
|
285
244
|
});
|
286
|
-
_defineProperty(
|
287
|
-
if (
|
288
|
-
|
289
|
-
|
245
|
+
_defineProperty(this, "enterHandler", (event, shortcut) => {
|
246
|
+
if (this.state.activeIndex !== null) {
|
247
|
+
const item = this.props.data[this.state.activeIndex];
|
248
|
+
this.selectHandler(this.state.activeIndex)(event);
|
290
249
|
if (item.href && !event.defaultPrevented) {
|
291
250
|
if (shortcut != null && ['command+enter', 'ctrl+enter'].includes(shortcut)) {
|
292
251
|
window.open(item.href, '_blank');
|
@@ -301,53 +260,51 @@ var List = /*#__PURE__*/function (_Component) {
|
|
301
260
|
return true; // propagate event to the parent component (e.g., QueryAssist)
|
302
261
|
}
|
303
262
|
});
|
304
|
-
_defineProperty(
|
305
|
-
|
263
|
+
_defineProperty(this, "clearSelected", () => {
|
264
|
+
this.setState({
|
306
265
|
activeIndex: null,
|
307
266
|
needScrollToActive: false
|
308
267
|
});
|
309
268
|
});
|
310
|
-
_defineProperty(
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
});
|
322
|
-
}
|
323
|
-
if (scrolledToBottom) {
|
324
|
-
_this.props.onScrollToBottom();
|
325
|
-
}
|
269
|
+
_defineProperty(this, "scrollEndHandler", () => this.scheduleScrollListener(() => {
|
270
|
+
const innerContainer = this.inner;
|
271
|
+
if (innerContainer) {
|
272
|
+
const maxScrollingPosition = innerContainer.scrollHeight;
|
273
|
+
const sensitivity = this.defaultItemHeight() / 2;
|
274
|
+
const currentScrollingPosition = innerContainer.scrollTop + innerContainer.clientHeight + sensitivity;
|
275
|
+
const scrolledToBottom = maxScrollingPosition > 0 && currentScrollingPosition >= maxScrollingPosition;
|
276
|
+
if (!this.unmounted) {
|
277
|
+
this.setState({
|
278
|
+
scrolledToBottom
|
279
|
+
});
|
326
280
|
}
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
281
|
+
if (scrolledToBottom) {
|
282
|
+
this.props.onScrollToBottom();
|
283
|
+
}
|
284
|
+
}
|
285
|
+
}));
|
286
|
+
_defineProperty(this, "checkOverflow", () => {
|
287
|
+
if (this.inner) {
|
288
|
+
this.setState({
|
289
|
+
hasOverflow: this.inner.scrollHeight - this.inner.clientHeight > 1
|
333
290
|
});
|
334
291
|
}
|
335
292
|
});
|
336
|
-
_defineProperty(
|
337
|
-
|
338
|
-
index =
|
339
|
-
style
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
293
|
+
_defineProperty(this, "renderItem", _ref => {
|
294
|
+
let {
|
295
|
+
index = 1,
|
296
|
+
style,
|
297
|
+
isScrolling = false,
|
298
|
+
parent,
|
299
|
+
key
|
300
|
+
} = _ref;
|
301
|
+
let itemKey;
|
302
|
+
let el;
|
303
|
+
const realIndex = index - 1;
|
304
|
+
const item = this.props.data[realIndex];
|
305
|
+
const itemId = this.getId(item);
|
349
306
|
// top and bottom margins
|
350
|
-
if (index === 0 || index ===
|
307
|
+
if (index === 0 || index === this.props.data.length + 1 || item.rgItemType === Type.MARGIN) {
|
351
308
|
itemKey = key || "".concat(Type.MARGIN, "_").concat(index);
|
352
309
|
el = /*#__PURE__*/jsx("div", {
|
353
310
|
style: {
|
@@ -356,39 +313,37 @@ var List = /*#__PURE__*/function (_Component) {
|
|
356
313
|
});
|
357
314
|
} else {
|
358
315
|
// Hack around SelectNG implementation
|
359
|
-
item
|
360
|
-
|
361
|
-
var restProps = _objectWithoutProperties(item, _excluded);
|
362
|
-
var cleanedProps = restProps;
|
316
|
+
const restProps = _objectWithoutProperties(item, _excluded);
|
317
|
+
const cleanedProps = restProps;
|
363
318
|
if (cleanedProps.url) {
|
364
319
|
cleanedProps.href = cleanedProps.url;
|
365
320
|
}
|
366
321
|
if (cleanedProps.href) {
|
367
322
|
cleanedProps.rgItemType = Type.LINK;
|
368
323
|
}
|
369
|
-
|
324
|
+
const itemProps = Object.assign({
|
370
325
|
rgItemType: DEFAULT_ITEM_TYPE
|
371
326
|
}, restProps);
|
372
327
|
itemKey = key || itemId;
|
373
|
-
itemProps.hover = realIndex ===
|
328
|
+
itemProps.hover = realIndex === this.state.activeIndex;
|
374
329
|
if (itemProps.hoverClassName != null && itemProps.hover) {
|
375
330
|
itemProps.className = classNames(itemProps.className, itemProps.hoverClassName);
|
376
331
|
}
|
377
|
-
itemProps.onMouseOver =
|
332
|
+
itemProps.onMouseOver = this.hoverHandler(realIndex);
|
378
333
|
itemProps.tabIndex = -1;
|
379
334
|
itemProps.scrolling = isScrolling;
|
380
|
-
|
381
|
-
if (
|
335
|
+
const selectHandler = this.selectHandler(realIndex);
|
336
|
+
if (this.props.useMouseUp) {
|
382
337
|
itemProps.onMouseUp = selectHandler;
|
383
338
|
} else {
|
384
339
|
itemProps.onClick = selectHandler;
|
385
340
|
}
|
386
|
-
itemProps.onCheckboxChange =
|
341
|
+
itemProps.onCheckboxChange = this.checkboxHandler(realIndex);
|
387
342
|
if (itemProps.compact == null) {
|
388
|
-
itemProps.compact =
|
343
|
+
itemProps.compact = this.props.compact;
|
389
344
|
}
|
390
|
-
|
391
|
-
|
345
|
+
let ItemComponent;
|
346
|
+
const isFirst = index === 1;
|
392
347
|
switch (itemProps.rgItemType) {
|
393
348
|
case Type.SEPARATOR:
|
394
349
|
ItemComponent = ListSeparator;
|
@@ -396,15 +351,15 @@ var List = /*#__PURE__*/function (_Component) {
|
|
396
351
|
break;
|
397
352
|
case Type.LINK:
|
398
353
|
ItemComponent = ListLink;
|
399
|
-
|
354
|
+
this.addItemDataTestToProp(itemProps);
|
400
355
|
break;
|
401
356
|
case Type.ITEM:
|
402
357
|
ItemComponent = ListItem;
|
403
|
-
|
358
|
+
this.addItemDataTestToProp(itemProps);
|
404
359
|
break;
|
405
360
|
case Type.CUSTOM:
|
406
361
|
ItemComponent = ListCustom;
|
407
|
-
|
362
|
+
this.addItemDataTestToProp(itemProps);
|
408
363
|
break;
|
409
364
|
case Type.TITLE:
|
410
365
|
itemProps.isFirst = isFirst;
|
@@ -418,12 +373,14 @@ var List = /*#__PURE__*/function (_Component) {
|
|
418
373
|
}));
|
419
374
|
}
|
420
375
|
return parent ? /*#__PURE__*/jsx(CellMeasurer, {
|
421
|
-
cache:
|
376
|
+
cache: this._cache,
|
422
377
|
parent: parent,
|
423
378
|
rowIndex: index,
|
424
379
|
columnIndex: 0,
|
425
|
-
children:
|
426
|
-
|
380
|
+
children: _ref2 => {
|
381
|
+
let {
|
382
|
+
registerChild
|
383
|
+
} = _ref2;
|
427
384
|
return /*#__PURE__*/jsx("div", {
|
428
385
|
ref: registerChild,
|
429
386
|
style: style,
|
@@ -444,326 +401,282 @@ var List = /*#__PURE__*/function (_Component) {
|
|
444
401
|
})
|
445
402
|
}, itemKey);
|
446
403
|
});
|
447
|
-
_defineProperty(
|
404
|
+
_defineProperty(this, "addItemDataTestToProp", props => {
|
448
405
|
props['data-test'] = joinDataTestAttributes('ring-list-item', props['data-test']);
|
449
406
|
return props;
|
450
407
|
});
|
451
|
-
_defineProperty(
|
452
|
-
|
408
|
+
_defineProperty(this, "virtualizedListRef", el => {
|
409
|
+
this.virtualizedList = el;
|
453
410
|
});
|
454
|
-
_defineProperty(
|
455
|
-
|
411
|
+
_defineProperty(this, "containerRef", el => {
|
412
|
+
this.container = el;
|
456
413
|
});
|
457
|
-
_defineProperty(
|
458
|
-
_defineProperty(
|
459
|
-
_defineProperty(
|
460
|
-
_defineProperty(
|
461
|
-
up:
|
462
|
-
down:
|
463
|
-
home:
|
464
|
-
end:
|
465
|
-
enter:
|
466
|
-
'meta+enter':
|
467
|
-
'ctrl+enter':
|
468
|
-
'command+enter':
|
469
|
-
'shift+enter':
|
414
|
+
_defineProperty(this, "_inner", void 0);
|
415
|
+
_defineProperty(this, "id", getUID('list-'));
|
416
|
+
_defineProperty(this, "shortcutsScope", this.id);
|
417
|
+
_defineProperty(this, "shortcutsMap", {
|
418
|
+
up: this.upHandler,
|
419
|
+
down: this.downHandler,
|
420
|
+
home: this.homeHandler,
|
421
|
+
end: this.endHandler,
|
422
|
+
enter: this.enterHandler,
|
423
|
+
'meta+enter': this.enterHandler,
|
424
|
+
'ctrl+enter': this.enterHandler,
|
425
|
+
'command+enter': this.enterHandler,
|
426
|
+
'shift+enter': this.enterHandler
|
470
427
|
});
|
471
|
-
return _this;
|
472
428
|
}
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
429
|
+
static getDerivedStateFromProps(nextProps, prevState) {
|
430
|
+
const {
|
431
|
+
prevActiveIndex,
|
432
|
+
prevData,
|
433
|
+
activeItem
|
434
|
+
} = prevState;
|
435
|
+
const {
|
436
|
+
data,
|
437
|
+
activeIndex,
|
438
|
+
restoreActiveIndex
|
439
|
+
} = nextProps;
|
440
|
+
const nextState = {
|
441
|
+
prevActiveIndex: activeIndex,
|
442
|
+
prevData: data
|
443
|
+
};
|
444
|
+
if (data !== prevData) {
|
445
|
+
Object.assign(nextState, {
|
446
|
+
activeIndex: null,
|
447
|
+
activeItem: null
|
489
448
|
});
|
490
449
|
}
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
this.virtualizedList.recomputeRowHeights();
|
496
|
-
}
|
497
|
-
if (this.props.activeIndex == null && getDataHash(this.props.data) !== getDataHash(prevProps.data) && shouldActivateFirstItem(this.props)) {
|
498
|
-
this.activateFirst();
|
499
|
-
}
|
500
|
-
this.checkOverflow();
|
501
|
-
}
|
502
|
-
}, {
|
503
|
-
key: "componentWillUnmount",
|
504
|
-
value: function componentWillUnmount() {
|
505
|
-
this.unmounted = true;
|
506
|
-
document.removeEventListener('mousemove', this.onDocumentMouseMove);
|
507
|
-
document.removeEventListener('keydown', this.onDocumentKeyDown, true);
|
508
|
-
}
|
509
|
-
}, {
|
510
|
-
key: "hasActivatableItems",
|
511
|
-
value: function hasActivatableItems() {
|
512
|
-
return this._hasActivatableItems(this.props.data);
|
513
|
-
}
|
514
|
-
}, {
|
515
|
-
key: "moveHandler",
|
516
|
-
value: function moveHandler(index, retryCallback, e) {
|
517
|
-
var correctedIndex;
|
518
|
-
if (this.props.data.length === 0 || !this.hasActivatableItems()) {
|
519
|
-
return;
|
520
|
-
} else if (this.props.data.length < index) {
|
521
|
-
correctedIndex = 0;
|
522
|
-
} else {
|
523
|
-
correctedIndex = index;
|
524
|
-
}
|
525
|
-
var item = this.props.data[correctedIndex];
|
526
|
-
this.setState({
|
527
|
-
activeIndex: correctedIndex,
|
528
|
-
activeItem: item,
|
450
|
+
if (activeIndex != null && activeIndex !== prevActiveIndex && data[activeIndex] != null) {
|
451
|
+
Object.assign(nextState, {
|
452
|
+
activeIndex,
|
453
|
+
activeItem: data[activeIndex],
|
529
454
|
needScrollToActive: true
|
530
|
-
}, function onSet() {
|
531
|
-
if (!isActivatable(item)) {
|
532
|
-
retryCallback(e);
|
533
|
-
return;
|
534
|
-
}
|
535
|
-
if (e.key !== 'Home' && e.key !== 'End') {
|
536
|
-
preventDefault(e);
|
537
|
-
}
|
538
455
|
});
|
456
|
+
} else if (data !== prevData && restoreActiveIndex && activeItem != null && activeItem.key != null) {
|
457
|
+
// Restore active index if there is an item with the same "key" property
|
458
|
+
const index = data.findIndex(item => item.key === activeItem.key);
|
459
|
+
if (index >= 0) {
|
460
|
+
Object.assign(nextState, {
|
461
|
+
activeIndex: index,
|
462
|
+
activeItem: data[index]
|
463
|
+
});
|
464
|
+
}
|
539
465
|
}
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
466
|
+
return nextState;
|
467
|
+
}
|
468
|
+
componentDidMount() {
|
469
|
+
document.addEventListener('mousemove', this.onDocumentMouseMove);
|
470
|
+
document.addEventListener('keydown', this.onDocumentKeyDown, true);
|
471
|
+
if (this.props.activeIndex == null && shouldActivateFirstItem(this.props)) {
|
472
|
+
this.activateFirst();
|
546
473
|
}
|
547
|
-
}
|
548
|
-
|
549
|
-
|
550
|
-
|
474
|
+
}
|
475
|
+
shouldComponentUpdate(nextProps, nextState) {
|
476
|
+
return nextProps !== this.props || Object.keys(nextState).some(key => nextState[key] !== this.state[key]);
|
477
|
+
}
|
478
|
+
componentDidUpdate(prevProps) {
|
479
|
+
if (this.virtualizedList && prevProps.data !== this.props.data) {
|
480
|
+
this.virtualizedList.recomputeRowHeights();
|
551
481
|
}
|
552
|
-
|
553
|
-
|
554
|
-
value: function defaultItemHeight() {
|
555
|
-
return this.props.compact ? Dimension.COMPACT_ITEM_HEIGHT : Dimension.ITEM_HEIGHT;
|
482
|
+
if (this.props.activeIndex == null && getDataHash(this.props.data) !== getDataHash(prevProps.data) && shouldActivateFirstItem(this.props)) {
|
483
|
+
this.activateFirst();
|
556
484
|
}
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
485
|
+
this.checkOverflow();
|
486
|
+
}
|
487
|
+
componentWillUnmount() {
|
488
|
+
this.unmounted = true;
|
489
|
+
document.removeEventListener('mousemove', this.onDocumentMouseMove);
|
490
|
+
document.removeEventListener('keydown', this.onDocumentKeyDown, true);
|
491
|
+
}
|
492
|
+
hasActivatableItems() {
|
493
|
+
return this._hasActivatableItems(this.props.data);
|
494
|
+
}
|
495
|
+
moveHandler(index, retryCallback, e) {
|
496
|
+
let correctedIndex;
|
497
|
+
if (this.props.data.length === 0 || !this.hasActivatableItems()) {
|
498
|
+
return;
|
499
|
+
} else if (this.props.data.length < index) {
|
500
|
+
correctedIndex = 0;
|
501
|
+
} else {
|
502
|
+
correctedIndex = index;
|
561
503
|
}
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
504
|
+
const item = this.props.data[correctedIndex];
|
505
|
+
this.setState({
|
506
|
+
activeIndex: correctedIndex,
|
507
|
+
activeItem: item,
|
508
|
+
needScrollToActive: true
|
509
|
+
}, function onSet() {
|
510
|
+
if (!isActivatable(item)) {
|
511
|
+
retryCallback(e);
|
512
|
+
return;
|
570
513
|
}
|
571
|
-
|
572
|
-
|
573
|
-
}, {
|
574
|
-
key: "getId",
|
575
|
-
value: function getId(item) {
|
576
|
-
return item != null ? "".concat(this.id, ":").concat(item.key || this._deprecatedGenerateKeyFromContent(item)) : undefined;
|
577
|
-
}
|
578
|
-
}, {
|
579
|
-
key: "inner",
|
580
|
-
get: function get() {
|
581
|
-
if (!this._inner) {
|
582
|
-
this._inner = this.container && this.container.querySelector('.ring-list__i');
|
514
|
+
if (e.key !== 'Home' && e.key !== 'End') {
|
515
|
+
preventDefault(e);
|
583
516
|
}
|
584
|
-
|
517
|
+
});
|
518
|
+
}
|
519
|
+
getFirst() {
|
520
|
+
return this.props.data.find(item => item.rgItemType === Type.ITEM || item.rgItemType === Type.CUSTOM);
|
521
|
+
}
|
522
|
+
getSelected() {
|
523
|
+
return this.state.activeIndex != null ? this.props.data[this.state.activeIndex] : null;
|
524
|
+
}
|
525
|
+
defaultItemHeight() {
|
526
|
+
return this.props.compact ? Dimension.COMPACT_ITEM_HEIGHT : Dimension.ITEM_HEIGHT;
|
527
|
+
}
|
528
|
+
getVisibleListHeight(maxHeight) {
|
529
|
+
return maxHeight - this.defaultItemHeight() - Dimension.INNER_PADDING;
|
530
|
+
}
|
531
|
+
_deprecatedGenerateKeyFromContent(itemProps) {
|
532
|
+
const identificator = itemProps.label || itemProps.description;
|
533
|
+
const isString = typeof identificator === 'string' || identificator instanceof String;
|
534
|
+
if (identificator && !isString) {
|
535
|
+
warnEmptyKey();
|
536
|
+
return "".concat(itemProps.rgItemType, "_").concat(JSON.stringify(identificator));
|
585
537
|
}
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
rowCount = _ref3.rowCount,
|
595
|
-
isScrolling = _ref3.isScrolling,
|
596
|
-
_ref3$onChildScroll = _ref3.onChildScroll,
|
597
|
-
onChildScroll = _ref3$onChildScroll === void 0 ? noop : _ref3$onChildScroll,
|
598
|
-
scrollTop = _ref3.scrollTop,
|
599
|
-
registerChild = _ref3.registerChild;
|
600
|
-
var dirOverride = {
|
601
|
-
direction: 'inherit'
|
602
|
-
}; // Virtualized sets "direction: ltr" by default https://github.com/bvaughn/react-virtualized/issues/457
|
603
|
-
return /*#__PURE__*/jsx(AutoSizer, {
|
604
|
-
disableHeight: true,
|
605
|
-
onResize: this.props.onResize,
|
606
|
-
children: function children(_ref4) {
|
607
|
-
var width = _ref4.width;
|
608
|
-
return /*#__PURE__*/jsx("div", {
|
609
|
-
ref: registerChild,
|
610
|
-
children: /*#__PURE__*/jsx(VirtualizedList, {
|
611
|
-
"aria-label": _this3.props.ariaLabel,
|
612
|
-
ref: _this3.virtualizedListRef,
|
613
|
-
className: classNames('ring-list__i', {
|
614
|
-
[modules_3b67a421.overscrollNone]: _this3.props.preventListOverscroll
|
615
|
-
}),
|
616
|
-
autoHeight: autoHeight,
|
617
|
-
style: maxHeight ? _objectSpread2({
|
618
|
-
maxHeight,
|
619
|
-
height: 'auto'
|
620
|
-
}, dirOverride) : dirOverride,
|
621
|
-
autoContainerWidth: true,
|
622
|
-
height: height,
|
623
|
-
width: width,
|
624
|
-
isScrolling: isScrolling,
|
625
|
-
onScroll: function onScroll(e) {
|
626
|
-
onChildScroll(e);
|
627
|
-
_this3.scrollEndHandler();
|
628
|
-
},
|
629
|
-
scrollTop: scrollTop,
|
630
|
-
rowCount: rowCount,
|
631
|
-
estimatedRowSize: _this3.defaultItemHeight(),
|
632
|
-
rowHeight: _this3._cache.rowHeight,
|
633
|
-
rowRenderer: _this3.renderItem,
|
634
|
-
overscanRowCount: _this3._bufferSize
|
635
|
-
// ensure rerendering
|
636
|
-
,
|
637
|
-
noop: function noop() {},
|
638
|
-
scrollToIndex: !_this3.props.disableScrollToActive && _this3.state.needScrollToActive && _this3.state.activeIndex != null ? _this3.state.activeIndex + 1 : undefined,
|
639
|
-
scrollToAlignment: "center",
|
640
|
-
deferredMeasurementCache: _this3._cache,
|
641
|
-
onRowsRendered: _this3.checkOverflow
|
642
|
-
})
|
643
|
-
});
|
644
|
-
}
|
645
|
-
});
|
538
|
+
return "".concat(itemProps.rgItemType, "_").concat(identificator);
|
539
|
+
}
|
540
|
+
getId(item) {
|
541
|
+
return item != null ? "".concat(this.id, ":").concat(item.key || this._deprecatedGenerateKeyFromContent(item)) : undefined;
|
542
|
+
}
|
543
|
+
get inner() {
|
544
|
+
if (!this._inner) {
|
545
|
+
this._inner = this.container && this.container.querySelector('.ring-list__i');
|
646
546
|
}
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
547
|
+
return this._inner;
|
548
|
+
}
|
549
|
+
renderVirtualizedInner(_ref3) {
|
550
|
+
let {
|
551
|
+
height,
|
552
|
+
maxHeight,
|
553
|
+
autoHeight = false,
|
554
|
+
rowCount,
|
555
|
+
isScrolling,
|
556
|
+
onChildScroll = noop,
|
557
|
+
scrollTop,
|
558
|
+
registerChild
|
559
|
+
} = _ref3;
|
560
|
+
const dirOverride = {
|
561
|
+
direction: 'inherit'
|
562
|
+
}; // Virtualized sets "direction: ltr" by default https://github.com/bvaughn/react-virtualized/issues/457
|
563
|
+
return /*#__PURE__*/jsx(AutoSizer, {
|
564
|
+
disableHeight: true,
|
565
|
+
onResize: this.props.onResize,
|
566
|
+
children: _ref4 => {
|
567
|
+
let {
|
568
|
+
width
|
569
|
+
} = _ref4;
|
570
|
+
return /*#__PURE__*/jsx("div", {
|
571
|
+
ref: registerChild,
|
572
|
+
children: /*#__PURE__*/jsx(VirtualizedList, {
|
573
|
+
"aria-label": this.props.ariaLabel,
|
574
|
+
ref: this.virtualizedListRef,
|
575
|
+
className: classNames('ring-list__i', {
|
576
|
+
[modules_3b67a421.overscrollNone]: this.props.preventListOverscroll
|
577
|
+
}),
|
578
|
+
autoHeight: autoHeight,
|
579
|
+
style: maxHeight ? _objectSpread2({
|
580
|
+
maxHeight,
|
581
|
+
height: 'auto'
|
582
|
+
}, dirOverride) : dirOverride,
|
583
|
+
autoContainerWidth: true,
|
584
|
+
height: height,
|
585
|
+
width: width,
|
586
|
+
isScrolling: isScrolling,
|
587
|
+
onScroll: e => {
|
588
|
+
onChildScroll(e);
|
589
|
+
this.scrollEndHandler();
|
590
|
+
},
|
591
|
+
scrollTop: scrollTop,
|
592
|
+
rowCount: rowCount,
|
593
|
+
estimatedRowSize: this.defaultItemHeight(),
|
594
|
+
rowHeight: this._cache.rowHeight,
|
595
|
+
rowRenderer: this.renderItem,
|
596
|
+
overscanRowCount: this._bufferSize
|
597
|
+
// ensure rerendering
|
598
|
+
,
|
599
|
+
noop: () => {},
|
600
|
+
scrollToIndex: !this.props.disableScrollToActive && this.state.needScrollToActive && this.state.activeIndex != null ? this.state.activeIndex + 1 : undefined,
|
601
|
+
scrollToAlignment: "center",
|
602
|
+
deferredMeasurementCache: this._cache,
|
603
|
+
onRowsRendered: this.checkOverflow
|
604
|
+
})
|
656
605
|
});
|
657
606
|
}
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
607
|
+
});
|
608
|
+
}
|
609
|
+
renderVirtualized(maxHeight, rowCount) {
|
610
|
+
if (maxHeight) {
|
611
|
+
return this.renderVirtualizedInner({
|
612
|
+
height: maxHeight,
|
613
|
+
maxHeight,
|
614
|
+
rowCount
|
665
615
|
});
|
666
616
|
}
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
children: /*#__PURE__*/jsx("div", {
|
682
|
-
"aria-label": this.props.ariaLabel,
|
683
|
-
role: "grid",
|
684
|
-
style: maxHeight ? {
|
685
|
-
maxHeight: this.getVisibleListHeight(maxHeight)
|
686
|
-
} : undefined,
|
687
|
-
children: items
|
688
|
-
})
|
689
|
-
});
|
617
|
+
return /*#__PURE__*/jsx(WindowScroller, {
|
618
|
+
children: props => this.renderVirtualizedInner(_objectSpread2(_objectSpread2({}, props), {}, {
|
619
|
+
rowCount,
|
620
|
+
autoHeight: true
|
621
|
+
}))
|
622
|
+
});
|
623
|
+
}
|
624
|
+
renderSimple(maxHeight, rowCount) {
|
625
|
+
const items = [];
|
626
|
+
for (let index = 0; index < rowCount; index++) {
|
627
|
+
items.push(this.renderItem({
|
628
|
+
index,
|
629
|
+
isScrolling: this.state.scrolling
|
630
|
+
}));
|
690
631
|
}
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
632
|
+
return /*#__PURE__*/jsx("div", {
|
633
|
+
className: classNames('ring-list__i', modules_3b67a421.simpleInner),
|
634
|
+
onScroll: this.scrollHandler,
|
635
|
+
onMouseMove: this.mouseHandler,
|
636
|
+
children: /*#__PURE__*/jsx("div", {
|
637
|
+
"aria-label": this.props.ariaLabel,
|
638
|
+
role: "grid",
|
639
|
+
style: maxHeight ? {
|
640
|
+
maxHeight: this.getVisibleListHeight(maxHeight)
|
641
|
+
} : undefined,
|
642
|
+
children: items
|
643
|
+
})
|
644
|
+
});
|
645
|
+
}
|
646
|
+
/** @override */
|
647
|
+
render() {
|
648
|
+
const hint = this.getSelected() && this.props.hintOnSelection || this.props.hint;
|
649
|
+
const fadeStyles = hint ? {
|
650
|
+
bottom: Dimension.ITEM_HEIGHT
|
651
|
+
} : undefined;
|
652
|
+
const rowCount = this.props.data.length + 2;
|
653
|
+
const maxHeight = this.props.maxHeight && this.getVisibleListHeight(this.props.maxHeight);
|
654
|
+
const classes = classNames(modules_3b67a421.list, this.props.className);
|
655
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
656
|
+
children: [/*#__PURE__*/jsx(ActiveItemContext.Updater, {
|
657
|
+
value: this.getId(this.state.activeItem),
|
658
|
+
skipUpdate: this.props.hidden || !isActivatable(this.state.activeItem)
|
659
|
+
}), /*#__PURE__*/jsxs("div", {
|
660
|
+
id: this.props.id,
|
661
|
+
ref: this.containerRef,
|
662
|
+
className: classes,
|
663
|
+
onMouseOut: this.props.onMouseOut,
|
664
|
+
onBlur: this.props.onMouseOut,
|
665
|
+
onMouseLeave: this.clearSelected,
|
666
|
+
"data-test": "ring-list",
|
667
|
+
children: [this.props.shortcuts && /*#__PURE__*/jsx(Shortcuts, {
|
668
|
+
map: this.props.shortcutsMap ? _objectSpread2(_objectSpread2({}, this.shortcutsMap), this.props.shortcutsMap) : this.shortcutsMap,
|
669
|
+
scope: this.shortcutsScope
|
670
|
+
}), this.props.renderOptimization ? this.renderVirtualized(maxHeight, rowCount) : this.renderSimple(maxHeight, rowCount), this.state.hasOverflow && !this.state.scrolledToBottom && /*#__PURE__*/jsx("div", {
|
671
|
+
className: modules_3b67a421.fade,
|
672
|
+
style: fadeStyles
|
673
|
+
}), hint && /*#__PURE__*/jsx(ListHint, {
|
674
|
+
label: hint
|
723
675
|
})]
|
724
|
-
})
|
725
|
-
}
|
726
|
-
}
|
727
|
-
|
728
|
-
value: function getDerivedStateFromProps(nextProps, prevState) {
|
729
|
-
var prevActiveIndex = prevState.prevActiveIndex,
|
730
|
-
prevData = prevState.prevData,
|
731
|
-
activeItem = prevState.activeItem;
|
732
|
-
var data = nextProps.data,
|
733
|
-
activeIndex = nextProps.activeIndex,
|
734
|
-
restoreActiveIndex = nextProps.restoreActiveIndex;
|
735
|
-
var nextState = {
|
736
|
-
prevActiveIndex: activeIndex,
|
737
|
-
prevData: data
|
738
|
-
};
|
739
|
-
if (data !== prevData) {
|
740
|
-
Object.assign(nextState, {
|
741
|
-
activeIndex: null,
|
742
|
-
activeItem: null
|
743
|
-
});
|
744
|
-
}
|
745
|
-
if (activeIndex != null && activeIndex !== prevActiveIndex && data[activeIndex] != null) {
|
746
|
-
Object.assign(nextState, {
|
747
|
-
activeIndex,
|
748
|
-
activeItem: data[activeIndex],
|
749
|
-
needScrollToActive: true
|
750
|
-
});
|
751
|
-
} else if (data !== prevData && restoreActiveIndex && activeItem != null && activeItem.key != null) {
|
752
|
-
// Restore active index if there is an item with the same "key" property
|
753
|
-
var index = data.findIndex(function (item) {
|
754
|
-
return item.key === activeItem.key;
|
755
|
-
});
|
756
|
-
if (index >= 0) {
|
757
|
-
Object.assign(nextState, {
|
758
|
-
activeIndex: index,
|
759
|
-
activeItem: data[index]
|
760
|
-
});
|
761
|
-
}
|
762
|
-
}
|
763
|
-
return nextState;
|
764
|
-
}
|
765
|
-
}]);
|
766
|
-
}(Component);
|
676
|
+
})]
|
677
|
+
});
|
678
|
+
}
|
679
|
+
}
|
767
680
|
_defineProperty(List, "propTypes", {
|
768
681
|
id: PropTypes.string,
|
769
682
|
className: PropTypes.string,
|