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