@jetbrains/ring-ui 4.1.0-beta.3 → 4.1.1
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/CHANGELOG.md +13 -0
- package/README.md +17 -15
- package/babel.config.js +3 -2
- package/components/alert/alert.js +9 -3
- package/components/alert/alert.test.js +21 -48
- package/components/alert/container.css +1 -1
- package/components/alert/container.test.js +3 -13
- package/components/alert-service/alert-service.examples.css +18 -0
- package/components/alert-service/alert-service.examples.js +21 -0
- package/components/alert-service/alert-service.js +10 -3
- package/components/analytics/analytics__fus-plugin.js +3 -3
- package/components/analytics/analytics__ga-plugin.js +2 -2
- package/components/auth/auth.test.js +14 -7
- package/components/auth/auth__core.js +64 -33
- package/components/auth-dialog/auth-dialog.css +2 -3
- package/components/auth-dialog/auth-dialog.js +4 -1
- package/components/auth-dialog/auth-dialog.test.js +3 -19
- package/components/avatar/avatar.css +4 -1
- package/components/avatar/avatar.examples.js +3 -2
- package/components/avatar/avatar.js +34 -6
- package/components/avatar/avatar.test.js +20 -17
- package/components/avatar/fallback-avatar.js +136 -0
- package/components/avatar-editor-ng/avatar-editor-ng.css +2 -2
- package/components/avatar-editor-ng/avatar-editor-ng.js +2 -1
- package/components/avatar-editor-ng/{avatar-editor-ng.html → avatar-editor-ng__template.js} +2 -2
- package/components/badge/badge.test.js +13 -20
- package/components/button/button.css +2 -2
- package/components/button/button.js +4 -1
- package/components/button/button.test.js +32 -33
- package/components/button-group/button-group.js +1 -1
- package/components/button-group/caption.js +1 -1
- package/components/button-ng/button-ng.js +1 -1
- package/components/button-set-ng/button-set-ng.js +3 -1
- package/components/checkbox/checkbox.css +1 -1
- package/components/code/code.js +2 -5
- package/components/confirm/confirm.js +1 -0
- package/components/confirm-service/confirm-service.js +5 -5
- package/components/content-layout/content-layout.css +1 -1
- package/components/data-list/data-list.css +1 -1
- package/components/date-picker/date-input.js +5 -4
- package/components/date-picker/date-picker.css +34 -22
- package/components/date-picker/date-picker.js +16 -14
- package/components/date-picker/date-popup.js +22 -7
- package/components/date-picker/month-names.js +8 -5
- package/components/date-picker/month.js +6 -2
- package/components/date-picker/weekdays.js +10 -2
- package/components/dialog/dialog.examples.js +3 -1
- package/components/dialog/dialog.js +10 -5
- package/components/dialog/dialog.test.js +1 -1
- package/components/dialog/dialog__body-scroll-preventer.js +51 -31
- package/components/dialog-ng/dialog-ng.js +10 -10
- package/components/dialog-ng/{dialog-ng.html → dialog-ng__template.js} +2 -2
- package/components/dropdown/dropdown.examples.js +36 -1
- package/components/dropdown/dropdown.test.js +2 -2
- package/components/dropdown-menu/dropdown-menu.examples.js +47 -0
- package/components/dropdown-menu/dropdown-menu.js +117 -0
- package/components/dropdown-menu/dropdown-menu.test.js +76 -0
- package/components/error-bubble/error-bubble-legacy.css +1 -1
- package/components/error-bubble/error-bubble.css +1 -1
- package/components/error-bubble/error-bubble.examples.js +1 -1
- package/components/error-page/error-page.css +2 -2
- package/components/footer-ng/footer-ng.js +13 -3
- package/components/form/form.css +2 -2
- package/components/form-ng/form-ng.js +3 -1
- package/components/global/global.css +1 -1
- package/components/global/theme.js +1 -1
- package/components/global/variables.css +8 -1
- package/components/grid/grid.css +10 -9
- package/components/header/header.css +1 -1
- package/components/header/header.examples.js +7 -8
- package/components/header/profile.js +10 -11
- package/components/http/http.js +1 -1
- package/components/icon/icon.css +5 -4
- package/components/input/input-legacy.css +7 -7
- package/components/island/header.js +2 -2
- package/components/island/island.css +8 -3
- package/components/island-legacy/island-legacy.css +3 -1
- package/components/list/list.js +6 -1
- package/components/list/list__custom.js +9 -3
- package/components/list/list__item.js +8 -2
- package/components/list/list__link.js +2 -1
- package/components/loader-inline/loader-inline.css +1 -1
- package/components/loader-screen/loader-screen.css +1 -1
- package/components/message/message.css +1 -1
- package/components/message/message.examples.js +8 -7
- package/components/pager/pager.js +5 -3
- package/components/permissions/permissions.js +1 -1
- package/components/popup/popup.js +1 -1
- package/components/popup/popup.test.js +15 -13
- package/components/progress-bar/progress-bar.css +1 -1
- package/components/progress-bar/progress-bar.examples.js +3 -3
- package/components/progress-bar/progress-bar.js +5 -2
- package/components/progress-bar/progress-bar.test.js +12 -13
- package/components/progress-bar-ng/progress-bar-ng.examples.js +3 -3
- package/components/query-assist/query-assist.css +13 -3
- package/components/query-assist/query-assist.examples.js +3 -4
- package/components/query-assist/query-assist.js +56 -12
- package/components/query-assist/query-assist.test.js +37 -5
- package/components/save-field-ng/save-field-ng.css +0 -3
- package/components/save-field-ng/save-field-ng.js +3 -1
- package/components/save-field-ng/{save-field-ng.html → save-field-ng__template.js} +2 -2
- package/components/select/select.css +12 -7
- package/components/select/select.examples.js +13 -0
- package/components/select/select.js +30 -43
- package/components/select/select.test.js +4 -5
- package/components/select/select__popup.js +1 -0
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.css +1 -1
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.js +1 -1
- package/components/shortcuts-hint-ng/{shortcuts-hint-ng.html → shortcuts-hint-ng__template.js} +2 -2
- package/components/sidebar/sidebar.css +1 -0
- package/components/sidebar-ng/sidebar-ng.js +6 -2
- package/components/sidebar-ng/{sidebar-ng__button.html → sidebar-ng__button-template.js} +2 -2
- package/components/sidebar-ng/{sidebar-ng.html → sidebar-ng__template.js} +2 -2
- package/components/table/header.js +9 -1
- package/components/table/row.js +2 -1
- package/components/table/table.css +2 -1
- package/components/table-legacy/table-legacy.css +2 -2
- package/components/table-legacy/table-legacy__toolbar.css +2 -2
- package/components/table-legacy-ng/table-legacy-ng.js +38 -5
- package/components/table-legacy-ng/table-legacy-ng__pager.js +7 -1
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.js +5 -9
- package/components/tabs/tab-link.js +4 -2
- package/components/tabs/tabs.css +32 -5
- package/components/tabs-ng/tabs-ng.js +4 -2
- package/components/tabs-ng/{tabs-ng.html → tabs-ng__template.js} +6 -2
- package/components/tag/tag.css +5 -2
- package/components/tag/tag.examples.js +3 -0
- package/components/tag/tag.js +19 -16
- package/components/tags-input/tag-input.examples.js +1 -1
- package/components/tags-input/tags-input.js +5 -2
- package/components/template-ng/template-ng.js +1 -1
- package/components/tooltip/tooltip.js +7 -2
- package/components/user-agreement/user-agreement.css +1 -5
- package/components/user-agreement/user-agreement.examples.js +7 -6
- package/components/user-agreement/user-agreement.js +11 -3
- package/package.json +85 -83
- package/webpack.config.js +14 -10
- package/components/button-set-ng/button-set-ng.html +0 -1
- package/components/footer-ng/footer-ng.html +0 -13
- package/components/form-ng/form-ng__error-bubble.html +0 -3
- package/components/table-legacy-ng/table-legacy-ng.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__column.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__header.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__pager.html +0 -7
- package/components/table-legacy-ng/table-legacy-ng__row.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__title.html +0 -9
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -123
- package/dist/_helpers/background-flow.js +0 -232
- package/dist/_helpers/badge.js +0 -3
- package/dist/_helpers/button.js +0 -145
- package/dist/_helpers/clickableLink.js +0 -65
- package/dist/_helpers/data-tests.js +0 -15
- package/dist/_helpers/disable-hover-hoc.js +0 -407
- package/dist/_helpers/dom.js +0 -101
- package/dist/_helpers/get-uid.js +0 -15
- package/dist/_helpers/linear-function.js +0 -17
- package/dist/_helpers/list.js +0 -1327
- package/dist/_helpers/logo.js +0 -36
- package/dist/_helpers/memoize.js +0 -17
- package/dist/_helpers/popup.js +0 -691
- package/dist/_helpers/popup.target.js +0 -27
- package/dist/_helpers/rerender-hoc.js +0 -49
- package/dist/_helpers/schedule-raf.js +0 -31
- package/dist/_helpers/sniffer.js +0 -6
- package/dist/_helpers/theme.js +0 -40
- package/dist/_helpers/url.js +0 -125
- package/dist/alert-service.js +0 -149
- package/dist/alert.js +0 -284
- package/dist/analytics.js +0 -116
- package/dist/auth-dialog-service.js +0 -56
- package/dist/auth-dialog.js +0 -122
- package/dist/auth.js +0 -1744
- package/dist/avatar.js +0 -152
- package/dist/badge.js +0 -52
- package/dist/button-group.js +0 -48
- package/dist/button-set.js +0 -27
- package/dist/button-toolbar.js +0 -30
- package/dist/button.js +0 -12
- package/dist/caret.js +0 -262
- package/dist/checkbox.js +0 -108
- package/dist/confirm-service.js +0 -102
- package/dist/confirm.js +0 -113
- package/dist/content-layout.js +0 -184
- package/dist/contenteditable.js +0 -81
- package/dist/data-list.js +0 -466
- package/dist/date-picker.js +0 -1398
- package/dist/dialog.js +0 -223
- package/dist/dropdown.js +0 -250
- package/dist/error-bubble.js +0 -56
- package/dist/error-message.js +0 -53
- package/dist/footer.js +0 -124
- package/dist/grid.js +0 -148
- package/dist/group.js +0 -34
- package/dist/header.js +0 -658
- package/dist/heading.js +0 -76
- package/dist/http.js +0 -207
- package/dist/hub-source.js +0 -130
- package/dist/icon.js +0 -211
- package/dist/input.js +0 -228
- package/dist/island.js +0 -314
- package/dist/link.js +0 -117
- package/dist/list.js +0 -29
- package/dist/loader-inline.js +0 -165
- package/dist/loader-screen.js +0 -45
- package/dist/loader.js +0 -338
- package/dist/login-dialog.js +0 -173
- package/dist/logo.js +0 -8
- package/dist/message.js +0 -226
- package/dist/old-browsers-message.js +0 -129
- package/dist/pager.js +0 -325
- package/dist/panel.js +0 -34
- package/dist/permissions.js +0 -466
- package/dist/popup-menu.js +0 -93
- package/dist/popup.js +0 -16
- package/dist/progress-bar.js +0 -111
- package/dist/proxy-attrs.js +0 -19
- package/dist/query-assist.js +0 -1081
- package/dist/radio.js +0 -112
- package/dist/select.js +0 -1920
- package/dist/selection.js +0 -213
- package/dist/shortcuts.js +0 -307
- package/dist/storage.js +0 -373
- package/dist/style.css +0 -1
- package/dist/tab-trap.js +0 -174
- package/dist/table.js +0 -903
- package/dist/tabs.js +0 -721
- package/dist/tag.js +0 -187
- package/dist/tags-input.js +0 -440
- package/dist/tags-list.js +0 -91
- package/dist/text.js +0 -38
- package/dist/toggle.js +0 -80
- package/dist/tooltip.js +0 -202
- package/dist/user-card.js +0 -218
package/dist/_helpers/list.js
DELETED
|
@@ -1,1327 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty, c as _objectSpread2, _ as _objectWithoutProperties, a as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { memo, createContext, useState, useContext, useEffect, Component, PureComponent, cloneElement } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import VirtualizedList from 'react-virtualized/dist/es/List';
|
|
6
|
-
import AutoSizer from 'react-virtualized/dist/es/AutoSizer';
|
|
7
|
-
import WindowScroller from 'react-virtualized/dist/es/WindowScroller';
|
|
8
|
-
import { CellMeasurerCache, CellMeasurer } from 'react-virtualized/dist/es/CellMeasurer';
|
|
9
|
-
import deprecate from 'util-deprecate';
|
|
10
|
-
import memoizeOne from 'memoize-one';
|
|
11
|
-
import { j as joinDataTestAttributes } from './data-tests.js';
|
|
12
|
-
import { g as getUID } from './get-uid.js';
|
|
13
|
-
import { s as scheduleRAF } from './schedule-raf.js';
|
|
14
|
-
import { m as memoize } from './memoize.js';
|
|
15
|
-
import { p as preventDefault } from './dom.js';
|
|
16
|
-
import Shortcuts from '../shortcuts.js';
|
|
17
|
-
import Link, { linkHOC } from '../link.js';
|
|
18
|
-
import Avatar, { Size } from '../avatar.js';
|
|
19
|
-
import Checkbox from '../checkbox.js';
|
|
20
|
-
import Icon from '../icon.js';
|
|
21
|
-
|
|
22
|
-
function createStatefulContext(initialValue, name = '') {
|
|
23
|
-
const ValueContext = /*#__PURE__*/createContext(initialValue);
|
|
24
|
-
const UpdateContext = /*#__PURE__*/createContext(() => {});
|
|
25
|
-
|
|
26
|
-
function Provider({
|
|
27
|
-
children
|
|
28
|
-
}) {
|
|
29
|
-
const [value, update] = useState(initialValue);
|
|
30
|
-
return /*#__PURE__*/React.createElement(ValueContext.Provider, {
|
|
31
|
-
value: value
|
|
32
|
-
}, /*#__PURE__*/React.createElement(UpdateContext.Provider, {
|
|
33
|
-
value: update
|
|
34
|
-
}, children));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
Provider.propTypes = {
|
|
38
|
-
children: PropTypes.node
|
|
39
|
-
};
|
|
40
|
-
Provider.displayName = `${name}Provider`;
|
|
41
|
-
|
|
42
|
-
function useUpdate(value, skipUpdate) {
|
|
43
|
-
const update = useContext(UpdateContext);
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
if (!skipUpdate) {
|
|
46
|
-
update(value);
|
|
47
|
-
}
|
|
48
|
-
}, [update, value, skipUpdate]);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function Updater({
|
|
52
|
-
value,
|
|
53
|
-
skipUpdate
|
|
54
|
-
}) {
|
|
55
|
-
useUpdate(value, skipUpdate);
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
Updater.displayName = `${name}Updater`;
|
|
60
|
-
return {
|
|
61
|
-
ValueContext,
|
|
62
|
-
UpdateContext,
|
|
63
|
-
Provider,
|
|
64
|
-
useUpdate,
|
|
65
|
-
Updater: /*#__PURE__*/memo(Updater)
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
var modules_3b67a421 = {"unit":"8px","listSpacing":"8px","error":"list_error__47370e13","list":"list_list__47370e13","simpleInner":"list_simpleInner__47370e13","scrolling":"list_scrolling__47370e13","separator":"list_separator__47370e13","separator_first":"list_separator_first__47370e13","item":"list_item__47370e13","itemContainer":"list_itemContainer__47370e13","compact":"list_compact__47370e13","add":"list_add__47370e13","top":"list_top__47370e13","left":"list_left__47370e13","label":"list_label__47370e13","description":"list_description__47370e13","right":"list_right__47370e13","details":"list_details__47370e13","padded":"list_padded__47370e13","hint":"list_hint__47370e13","action":"list_action__47370e13","actionLink":"list_actionLink__47370e13","hover":"list_hover__47370e13","icon":"list_icon__47370e13","highlight":"list_highlight__47370e13","service":"list_service__47370e13","glyph":"list_glyph__47370e13","avatar":"list_avatar__47370e13 list_glyph__47370e13","rightGlyph":"list_rightGlyph__47370e13 list_glyph__47370e13","checkboxContainer":"list_checkboxContainer__47370e13","title":"list_title__47370e13","title_first":"list_title_first__47370e13","text":"list_text__47370e13","fade":"list_fade__47370e13","disabled":"list_disabled__47370e13"};
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @constructor
|
|
73
|
-
* @extends {ReactComponent}
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
class ListLink extends PureComponent {
|
|
77
|
-
render() {
|
|
78
|
-
const _this$props = this.props,
|
|
79
|
-
{
|
|
80
|
-
scrolling,
|
|
81
|
-
'data-test': dataTest,
|
|
82
|
-
className,
|
|
83
|
-
label,
|
|
84
|
-
hover,
|
|
85
|
-
description,
|
|
86
|
-
rgItemType,
|
|
87
|
-
url,
|
|
88
|
-
onCheckboxChange,
|
|
89
|
-
disabled,
|
|
90
|
-
LinkComponent,
|
|
91
|
-
compact,
|
|
92
|
-
hoverClassName
|
|
93
|
-
} = _this$props,
|
|
94
|
-
restProps = _objectWithoutProperties(_this$props, ["scrolling", "data-test", "className", "label", "hover", "description", "rgItemType", "url", "onCheckboxChange", "disabled", "LinkComponent", "compact", "hoverClassName"]);
|
|
95
|
-
|
|
96
|
-
const classes = classNames(modules_3b67a421.item, className, {
|
|
97
|
-
[modules_3b67a421.actionLink]: !disabled,
|
|
98
|
-
[modules_3b67a421.compact]: compact,
|
|
99
|
-
[modules_3b67a421.scrolling]: scrolling
|
|
100
|
-
});
|
|
101
|
-
const Comp = LinkComponent ? linkHOC(LinkComponent) : Link;
|
|
102
|
-
return /*#__PURE__*/React.createElement(Comp, _extends({
|
|
103
|
-
pseudo: !this.props.href
|
|
104
|
-
}, restProps, {
|
|
105
|
-
hover: hover && !disabled,
|
|
106
|
-
className: classes,
|
|
107
|
-
"data-test": joinDataTestAttributes('ring-list-link', dataTest)
|
|
108
|
-
}), label);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
_defineProperty(ListLink, "propTypes", _objectSpread2(_objectSpread2({}, Link.propTypes), {}, {
|
|
114
|
-
description: PropTypes.string,
|
|
115
|
-
label: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
|
|
116
|
-
rgItemType: PropTypes.number,
|
|
117
|
-
scrolling: PropTypes.bool,
|
|
118
|
-
url: PropTypes.string,
|
|
119
|
-
LinkComponent: PropTypes.oneOfType([PropTypes.instanceOf(Component), PropTypes.func, PropTypes.string]),
|
|
120
|
-
onCheckboxChange: PropTypes.func,
|
|
121
|
-
compact: PropTypes.bool
|
|
122
|
-
}));
|
|
123
|
-
|
|
124
|
-
var modules_5b0fb3e8 = {"unit":"8px","footer-height":"64px","breakpoint-small":"640px","breakpoint-middle":"960px","breakpoint-large":"1200px","extra-small-screen-media":"(max-width:639px)","small-screen-media":"(min-width:640px) and (max-width:959px)","middle-screen-media":"(min-width:960px) and (max-width:1199px)","large-screen-media":"(min-width:1200px)","clearfix":"global_clearfix__0f8f4370","font":"global_font__0f8f4370","font-lower":"global_fontLower__0f8f4370 global_font__0f8f4370","font-smaller":"global_fontSmaller__0f8f4370 global_fontLower__0f8f4370 global_font__0f8f4370","font-smaller-lower":"global_fontSmallerLower__0f8f4370 global_fontSmaller__0f8f4370 global_fontLower__0f8f4370 global_font__0f8f4370","font-larger-lower":"global_fontLargerLower__0f8f4370 global_fontLower__0f8f4370 global_font__0f8f4370","font-larger":"global_fontLarger__0f8f4370 global_fontLargerLower__0f8f4370 global_fontLower__0f8f4370 global_font__0f8f4370","thin-font":"global_thinFont__0f8f4370","monospace-font":"global_monospaceFont__0f8f4370","ellipsis":"global_ellipsis__0f8f4370","resetButton":"global_resetButton__0f8f4370"};
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* @constructor
|
|
128
|
-
* @extends {ReactComponent}
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
const RING_UNIT = 8;
|
|
132
|
-
const DEFAULT_PADDING = 16;
|
|
133
|
-
const CHECKBOX_WIDTH = 28;
|
|
134
|
-
class ListItem extends PureComponent {
|
|
135
|
-
constructor(...args) {
|
|
136
|
-
super(...args);
|
|
137
|
-
|
|
138
|
-
_defineProperty(this, "id", getUID('list-item-'));
|
|
139
|
-
|
|
140
|
-
_defineProperty(this, "stopBubbling", e => e.stopPropagation());
|
|
141
|
-
|
|
142
|
-
_defineProperty(this, "_isString", val => typeof val === 'string' || val instanceof String);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
render() {
|
|
146
|
-
const _this$props = this.props,
|
|
147
|
-
{
|
|
148
|
-
scrolling,
|
|
149
|
-
className,
|
|
150
|
-
disabled,
|
|
151
|
-
checkbox,
|
|
152
|
-
avatar,
|
|
153
|
-
subavatar,
|
|
154
|
-
glyph,
|
|
155
|
-
icon,
|
|
156
|
-
rightGlyph,
|
|
157
|
-
description,
|
|
158
|
-
label,
|
|
159
|
-
title,
|
|
160
|
-
details,
|
|
161
|
-
hover,
|
|
162
|
-
rgItemType,
|
|
163
|
-
level,
|
|
164
|
-
tabIndex,
|
|
165
|
-
compact,
|
|
166
|
-
onClick,
|
|
167
|
-
onCheckboxChange,
|
|
168
|
-
onMouseOver,
|
|
169
|
-
onMouseDown,
|
|
170
|
-
onMouseUp,
|
|
171
|
-
rightNodes,
|
|
172
|
-
leftNodes
|
|
173
|
-
} = _this$props,
|
|
174
|
-
restProps = _objectWithoutProperties(_this$props, ["scrolling", "className", "disabled", "checkbox", "avatar", "subavatar", "glyph", "icon", "rightGlyph", "description", "label", "title", "details", "hover", "rgItemType", "level", "tabIndex", "compact", "onClick", "onCheckboxChange", "onMouseOver", "onMouseDown", "onMouseUp", "rightNodes", "leftNodes"]);
|
|
175
|
-
|
|
176
|
-
const checkable = checkbox !== undefined;
|
|
177
|
-
const hasLeftNodes = leftNodes || glyph || avatar;
|
|
178
|
-
const showCheckbox = checkable && (checkbox || !hasLeftNodes || hover && !disabled);
|
|
179
|
-
const classes = classNames(modules_3b67a421.item, modules_5b0fb3e8.resetButton, className, {
|
|
180
|
-
[modules_3b67a421.action]: !disabled,
|
|
181
|
-
[modules_3b67a421.hover]: hover && !disabled,
|
|
182
|
-
[modules_3b67a421.compact]: compact,
|
|
183
|
-
[modules_3b67a421.scrolling]: scrolling,
|
|
184
|
-
[modules_3b67a421.disabled]: disabled
|
|
185
|
-
});
|
|
186
|
-
const detailsClasses = classNames({
|
|
187
|
-
[modules_3b67a421.details]: details,
|
|
188
|
-
[modules_3b67a421.padded]: icon !== undefined || checkbox !== undefined || glyph !== undefined
|
|
189
|
-
});
|
|
190
|
-
const style = {
|
|
191
|
-
paddingLeft: `${(+level || 0) * RING_UNIT + DEFAULT_PADDING + (showCheckbox ? CHECKBOX_WIDTH : 0)}px`
|
|
192
|
-
};
|
|
193
|
-
let computedTitle = null;
|
|
194
|
-
|
|
195
|
-
if (this._isString(title)) {
|
|
196
|
-
// if title is specified and is a string then use it
|
|
197
|
-
computedTitle = title;
|
|
198
|
-
} else {
|
|
199
|
-
// otherwise use label if it is a string;
|
|
200
|
-
// label can also be an element, use empty string in this case
|
|
201
|
-
computedTitle = this._isString(label) ? label : '';
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const dataTest = joinDataTestAttributes({
|
|
205
|
-
'ring-list-item': (restProps['data-test'] || '').indexOf('ring-list-item') === -1,
|
|
206
|
-
'ring-list-item-action': !disabled,
|
|
207
|
-
'ring-list-item-selected': checkbox
|
|
208
|
-
}, restProps['data-test']);
|
|
209
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
210
|
-
className: modules_3b67a421.itemContainer,
|
|
211
|
-
"data-test": dataTest
|
|
212
|
-
}, showCheckbox && /*#__PURE__*/React.createElement("div", {
|
|
213
|
-
className: modules_3b67a421.checkboxContainer
|
|
214
|
-
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
215
|
-
"aria-labelledby": this.id,
|
|
216
|
-
checked: checkbox,
|
|
217
|
-
disabled: disabled,
|
|
218
|
-
onChange: onCheckboxChange,
|
|
219
|
-
onClick: this.stopBubbling
|
|
220
|
-
})), /*#__PURE__*/React.createElement("button", {
|
|
221
|
-
id: this.id,
|
|
222
|
-
type: "button",
|
|
223
|
-
tabIndex: tabIndex,
|
|
224
|
-
onClick: onClick,
|
|
225
|
-
onMouseOver: onMouseOver,
|
|
226
|
-
onMouseDown: onMouseDown,
|
|
227
|
-
onFocus: onMouseOver,
|
|
228
|
-
onMouseUp: onMouseUp,
|
|
229
|
-
className: classes,
|
|
230
|
-
style: style
|
|
231
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
232
|
-
className: modules_3b67a421.top,
|
|
233
|
-
onMouseOut: this.stopBubbling,
|
|
234
|
-
onBlur: this.stopBubbling
|
|
235
|
-
}, !showCheckbox && /*#__PURE__*/React.createElement("div", {
|
|
236
|
-
className: modules_3b67a421.left
|
|
237
|
-
}, leftNodes, glyph && /*#__PURE__*/React.createElement(Icon, {
|
|
238
|
-
className: modules_3b67a421.glyph,
|
|
239
|
-
glyph: glyph,
|
|
240
|
-
size: this.props.iconSize
|
|
241
|
-
}), avatar && /*#__PURE__*/React.createElement(Avatar, {
|
|
242
|
-
className: modules_3b67a421.avatar,
|
|
243
|
-
url: avatar,
|
|
244
|
-
size: Size.Size20,
|
|
245
|
-
subavatar: subavatar
|
|
246
|
-
})), /*#__PURE__*/React.createElement("span", {
|
|
247
|
-
className: modules_3b67a421.label,
|
|
248
|
-
title: computedTitle,
|
|
249
|
-
"data-test": "ring-list-item-label"
|
|
250
|
-
}, label), description && /*#__PURE__*/React.createElement("span", {
|
|
251
|
-
className: modules_3b67a421.description,
|
|
252
|
-
"data-test": "ring-list-item-description"
|
|
253
|
-
}, description), /*#__PURE__*/React.createElement("div", {
|
|
254
|
-
className: modules_3b67a421.right
|
|
255
|
-
}, rightGlyph && /*#__PURE__*/React.createElement(Icon, {
|
|
256
|
-
className: modules_3b67a421.rightGlyph,
|
|
257
|
-
glyph: rightGlyph,
|
|
258
|
-
size: this.props.iconSize
|
|
259
|
-
}), icon && /*#__PURE__*/React.createElement("div", {
|
|
260
|
-
className: modules_3b67a421.icon,
|
|
261
|
-
style: {
|
|
262
|
-
backgroundImage: `url("${icon}")`
|
|
263
|
-
}
|
|
264
|
-
}), rightNodes)), details && /*#__PURE__*/React.createElement("div", {
|
|
265
|
-
className: detailsClasses
|
|
266
|
-
}, details)));
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
_defineProperty(ListItem, "propTypes", {
|
|
272
|
-
scrolling: PropTypes.bool,
|
|
273
|
-
hover: PropTypes.bool,
|
|
274
|
-
details: PropTypes.string,
|
|
275
|
-
disabled: PropTypes.bool,
|
|
276
|
-
className: PropTypes.string,
|
|
277
|
-
tabIndex: PropTypes.number,
|
|
278
|
-
checkbox: PropTypes.bool,
|
|
279
|
-
description: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.array]),
|
|
280
|
-
avatar: PropTypes.string,
|
|
281
|
-
subavatar: PropTypes.string,
|
|
282
|
-
glyph: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
283
|
-
icon: PropTypes.string,
|
|
284
|
-
iconSize: PropTypes.number,
|
|
285
|
-
rightNodes: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.array]),
|
|
286
|
-
leftNodes: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.array]),
|
|
287
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
288
|
-
title: PropTypes.string,
|
|
289
|
-
level: PropTypes.number,
|
|
290
|
-
rgItemType: PropTypes.number,
|
|
291
|
-
rightGlyph: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
292
|
-
compact: PropTypes.bool,
|
|
293
|
-
onClick: PropTypes.func,
|
|
294
|
-
onCheckboxChange: PropTypes.func,
|
|
295
|
-
onMouseOver: PropTypes.func,
|
|
296
|
-
onMouseDown: PropTypes.func,
|
|
297
|
-
onMouseUp: PropTypes.func,
|
|
298
|
-
'data-test': PropTypes.string
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
// react-dom getEventKey function extracted
|
|
302
|
-
const normalizeKey = {
|
|
303
|
-
Esc: 'Escape',
|
|
304
|
-
Spacebar: ' ',
|
|
305
|
-
Left: 'ArrowLeft',
|
|
306
|
-
Up: 'ArrowUp',
|
|
307
|
-
Right: 'ArrowRight',
|
|
308
|
-
Down: 'ArrowDown',
|
|
309
|
-
Del: 'Delete',
|
|
310
|
-
Win: 'OS',
|
|
311
|
-
Menu: 'ContextMenu',
|
|
312
|
-
Apps: 'ContextMenu',
|
|
313
|
-
Scroll: 'ScrollLock',
|
|
314
|
-
MozPrintableKey: 'Unidentified'
|
|
315
|
-
};
|
|
316
|
-
const translateToKey = {
|
|
317
|
-
8: 'Backspace',
|
|
318
|
-
9: 'Tab',
|
|
319
|
-
12: 'Clear',
|
|
320
|
-
13: 'Enter',
|
|
321
|
-
16: 'Shift',
|
|
322
|
-
17: 'Control',
|
|
323
|
-
18: 'Alt',
|
|
324
|
-
19: 'Pause',
|
|
325
|
-
20: 'CapsLock',
|
|
326
|
-
27: 'Escape',
|
|
327
|
-
32: ' ',
|
|
328
|
-
33: 'PageUp',
|
|
329
|
-
34: 'PageDown',
|
|
330
|
-
35: 'End',
|
|
331
|
-
36: 'Home',
|
|
332
|
-
37: 'ArrowLeft',
|
|
333
|
-
38: 'ArrowUp',
|
|
334
|
-
39: 'ArrowRight',
|
|
335
|
-
40: 'ArrowDown',
|
|
336
|
-
45: 'Insert',
|
|
337
|
-
46: 'Delete',
|
|
338
|
-
112: 'F1',
|
|
339
|
-
113: 'F2',
|
|
340
|
-
114: 'F3',
|
|
341
|
-
115: 'F4',
|
|
342
|
-
116: 'F5',
|
|
343
|
-
117: 'F6',
|
|
344
|
-
118: 'F7',
|
|
345
|
-
119: 'F8',
|
|
346
|
-
120: 'F9',
|
|
347
|
-
121: 'F10',
|
|
348
|
-
122: 'F11',
|
|
349
|
-
123: 'F12',
|
|
350
|
-
144: 'NumLock',
|
|
351
|
-
145: 'ScrollLock',
|
|
352
|
-
224: 'Meta'
|
|
353
|
-
};
|
|
354
|
-
const ENTER = 13;
|
|
355
|
-
const SPACE = 32;
|
|
356
|
-
|
|
357
|
-
function getEventCharCode(nativeEvent) {
|
|
358
|
-
let charCode;
|
|
359
|
-
const keyCode = nativeEvent.keyCode;
|
|
360
|
-
|
|
361
|
-
if ('charCode' in nativeEvent) {
|
|
362
|
-
charCode = nativeEvent.charCode; // FF does not set `charCode` for the Enter-key, check against `keyCode`.
|
|
363
|
-
|
|
364
|
-
if (charCode === 0 && keyCode === ENTER) {
|
|
365
|
-
charCode = ENTER;
|
|
366
|
-
}
|
|
367
|
-
} else {
|
|
368
|
-
// IE8 does not implement `charCode`, but `keyCode` has the correct value.
|
|
369
|
-
charCode = keyCode;
|
|
370
|
-
} // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
|
|
371
|
-
// Must not discard the (non-)printable Enter-key.
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
if (charCode >= SPACE || charCode === ENTER) {
|
|
375
|
-
return charCode;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
return 0;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
function getEventKey(nativeEvent) {
|
|
382
|
-
if (nativeEvent.key) {
|
|
383
|
-
// Normalize inconsistent values reported by browsers due to
|
|
384
|
-
// implementations of a working draft specification.
|
|
385
|
-
// FireFox implements `key` but returns `MozPrintableKey` for all
|
|
386
|
-
// printable characters (normalized to `Unidentified`), ignore it.
|
|
387
|
-
const key = normalizeKey[nativeEvent.key] || nativeEvent.key;
|
|
388
|
-
|
|
389
|
-
if (key !== 'Unidentified') {
|
|
390
|
-
return key;
|
|
391
|
-
}
|
|
392
|
-
} // Browser does not implement `key`, polyfill as much of it as we can.
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
if (nativeEvent.type === 'keypress') {
|
|
396
|
-
const charCode = getEventCharCode(nativeEvent); // The enter-key is technically both printable and non-printable and can
|
|
397
|
-
// thus be captured by `keypress`, no other non-printable key should.
|
|
398
|
-
|
|
399
|
-
return charCode === SPACE ? 'Enter' : String.fromCharCode(charCode);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
|
|
403
|
-
// While user keyboard layout determines the actual meaning of each
|
|
404
|
-
// `keyCode` value, almost all function keys have a universal value.
|
|
405
|
-
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
return '';
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
class ListCustom extends PureComponent {
|
|
412
|
-
constructor(...args) {
|
|
413
|
-
super(...args);
|
|
414
|
-
|
|
415
|
-
_defineProperty(this, "handleKeyPress", event => {
|
|
416
|
-
const key = getEventKey(event);
|
|
417
|
-
|
|
418
|
-
if (key === 'Enter' || key === ' ') {
|
|
419
|
-
this.props.onClick(event);
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
render() {
|
|
425
|
-
const _this$props = this.props,
|
|
426
|
-
{
|
|
427
|
-
scrolling,
|
|
428
|
-
hover,
|
|
429
|
-
className,
|
|
430
|
-
disabled,
|
|
431
|
-
template,
|
|
432
|
-
rgItemType,
|
|
433
|
-
tabIndex,
|
|
434
|
-
onClick,
|
|
435
|
-
onCheckboxChange,
|
|
436
|
-
onMouseOver,
|
|
437
|
-
onMouseUp
|
|
438
|
-
} = _this$props,
|
|
439
|
-
restProps = _objectWithoutProperties(_this$props, ["scrolling", "hover", "className", "disabled", "template", "rgItemType", "tabIndex", "onClick", "onCheckboxChange", "onMouseOver", "onMouseUp"]);
|
|
440
|
-
|
|
441
|
-
const classes = classNames(modules_3b67a421.item, className, {
|
|
442
|
-
[modules_3b67a421.action]: !disabled,
|
|
443
|
-
[modules_3b67a421.hover]: hover && !disabled,
|
|
444
|
-
[modules_3b67a421.scrolling]: scrolling
|
|
445
|
-
});
|
|
446
|
-
const dataTest = joinDataTestAttributes('ring-list-item-custom', {
|
|
447
|
-
'ring-list-item-action': !disabled
|
|
448
|
-
}, restProps['data-test']);
|
|
449
|
-
const content = typeof template === 'function' ? template(this.props) : template;
|
|
450
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
451
|
-
role: "button",
|
|
452
|
-
tabIndex: tabIndex,
|
|
453
|
-
onClick: onClick,
|
|
454
|
-
onKeyPress: this.handleKeyPress,
|
|
455
|
-
onMouseOver: onMouseOver,
|
|
456
|
-
onFocus: onMouseOver,
|
|
457
|
-
onMouseUp: onMouseUp,
|
|
458
|
-
className: classes,
|
|
459
|
-
"data-test": dataTest
|
|
460
|
-
}, content);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
_defineProperty(ListCustom, "propTypes", {
|
|
466
|
-
scrolling: PropTypes.bool,
|
|
467
|
-
hover: PropTypes.bool,
|
|
468
|
-
className: PropTypes.string,
|
|
469
|
-
disabled: PropTypes.bool,
|
|
470
|
-
rgItemType: PropTypes.number,
|
|
471
|
-
tabIndex: PropTypes.number,
|
|
472
|
-
template: PropTypes.oneOfType([PropTypes.func, PropTypes.element, PropTypes.string]),
|
|
473
|
-
onClick: PropTypes.func,
|
|
474
|
-
onMouseOver: PropTypes.func,
|
|
475
|
-
onMouseUp: PropTypes.func,
|
|
476
|
-
onCheckboxChange: PropTypes.func,
|
|
477
|
-
'data-test': PropTypes.string
|
|
478
|
-
});
|
|
479
|
-
|
|
480
|
-
_defineProperty(ListCustom, "defaultProps", {
|
|
481
|
-
hover: false
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
class ListTitle extends PureComponent {
|
|
485
|
-
render() {
|
|
486
|
-
const {
|
|
487
|
-
className,
|
|
488
|
-
description,
|
|
489
|
-
label,
|
|
490
|
-
isFirst
|
|
491
|
-
} = this.props;
|
|
492
|
-
const classes = classNames(modules_3b67a421.title, className, {
|
|
493
|
-
[modules_3b67a421.title_first]: isFirst
|
|
494
|
-
});
|
|
495
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
496
|
-
className: classes,
|
|
497
|
-
"data-test": "ring-list-title"
|
|
498
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
499
|
-
className: classNames(modules_3b67a421.label, modules_3b67a421.text),
|
|
500
|
-
"data-test": "ring-list-title-label"
|
|
501
|
-
}, label), /*#__PURE__*/React.createElement("div", {
|
|
502
|
-
className: modules_3b67a421.description,
|
|
503
|
-
"data-test": "ring-list-title-description"
|
|
504
|
-
}, description));
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
_defineProperty(ListTitle, "propTypes", {
|
|
510
|
-
className: PropTypes.string,
|
|
511
|
-
description: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
|
|
512
|
-
label: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
|
|
513
|
-
isFirst: PropTypes.bool
|
|
514
|
-
});
|
|
515
|
-
|
|
516
|
-
class ListSeparator extends PureComponent {
|
|
517
|
-
render() {
|
|
518
|
-
const {
|
|
519
|
-
description,
|
|
520
|
-
isFirst,
|
|
521
|
-
className
|
|
522
|
-
} = this.props;
|
|
523
|
-
const classes = classNames(modules_3b67a421.separator, className, {
|
|
524
|
-
[modules_3b67a421.separator_first]: isFirst
|
|
525
|
-
});
|
|
526
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
527
|
-
className: classes
|
|
528
|
-
}, description);
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
_defineProperty(ListSeparator, "propTypes", {
|
|
534
|
-
className: PropTypes.string,
|
|
535
|
-
description: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
|
|
536
|
-
isFirst: PropTypes.bool
|
|
537
|
-
});
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* @constructor
|
|
541
|
-
* @extends {ReactComponent}
|
|
542
|
-
*/
|
|
543
|
-
|
|
544
|
-
class ListHint extends PureComponent {
|
|
545
|
-
render() {
|
|
546
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
547
|
-
className: classNames(modules_3b67a421.item, modules_3b67a421.hint),
|
|
548
|
-
"data-test": "ring-list-hint"
|
|
549
|
-
}, this.props.label);
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
_defineProperty(ListHint, "propTypes", {
|
|
555
|
-
label: PropTypes.node
|
|
556
|
-
});
|
|
557
|
-
|
|
558
|
-
/**
|
|
559
|
-
* @enum {number}
|
|
560
|
-
*/
|
|
561
|
-
const Type = {
|
|
562
|
-
SEPARATOR: 0,
|
|
563
|
-
LINK: 1,
|
|
564
|
-
ITEM: 2,
|
|
565
|
-
HINT: 3,
|
|
566
|
-
CUSTOM: 4,
|
|
567
|
-
TITLE: 5,
|
|
568
|
-
MARGIN: 6
|
|
569
|
-
};
|
|
570
|
-
const Dimension = {
|
|
571
|
-
ITEM_PADDING: 16,
|
|
572
|
-
ITEM_HEIGHT: 32,
|
|
573
|
-
COMPACT_ITEM_HEIGHT: 24,
|
|
574
|
-
SEPARATOR_HEIGHT: 25,
|
|
575
|
-
SEPARATOR_FIRST_HEIGHT: 16,
|
|
576
|
-
SEPARATOR_TEXT_HEIGHT: 18,
|
|
577
|
-
TITLE_HEIGHT: 42,
|
|
578
|
-
INNER_PADDING: 8,
|
|
579
|
-
MARGIN: 8
|
|
580
|
-
};
|
|
581
|
-
const DEFAULT_ITEM_TYPE = Type.ITEM;
|
|
582
|
-
|
|
583
|
-
const scheduleScrollListener = scheduleRAF();
|
|
584
|
-
const scheduleHoverListener = scheduleRAF();
|
|
585
|
-
|
|
586
|
-
function noop() {}
|
|
587
|
-
|
|
588
|
-
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.');
|
|
589
|
-
/**
|
|
590
|
-
* @param {Type} listItemType
|
|
591
|
-
* @param {Object} item list item
|
|
592
|
-
*/
|
|
593
|
-
|
|
594
|
-
function isItemType(listItemType, item) {
|
|
595
|
-
let type = item.rgItemType;
|
|
596
|
-
|
|
597
|
-
if (type == null) {
|
|
598
|
-
type = DEFAULT_ITEM_TYPE;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
return type === listItemType;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
const nonActivatableTypes = [Type.SEPARATOR, Type.TITLE, Type.MARGIN];
|
|
605
|
-
|
|
606
|
-
function isActivatable(item) {
|
|
607
|
-
return item != null && !nonActivatableTypes.includes(item.rgItemType) && !item.disabled;
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
const shouldActivateFirstItem = props => props.activateFirstItem || props.activateSingleItem && props.data.length === 1;
|
|
611
|
-
|
|
612
|
-
const ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
|
|
613
|
-
/**
|
|
614
|
-
* @name List
|
|
615
|
-
* @constructor
|
|
616
|
-
* @extends {ReactComponent}
|
|
617
|
-
*/
|
|
618
|
-
|
|
619
|
-
/**
|
|
620
|
-
* Displays a list of items.
|
|
621
|
-
*/
|
|
622
|
-
|
|
623
|
-
class List extends Component {
|
|
624
|
-
constructor(...args) {
|
|
625
|
-
super(...args);
|
|
626
|
-
|
|
627
|
-
_defineProperty(this, "state", {
|
|
628
|
-
activeIndex: null,
|
|
629
|
-
prevActiveIndex: null,
|
|
630
|
-
prevData: [],
|
|
631
|
-
activeItem: null,
|
|
632
|
-
needScrollToActive: false,
|
|
633
|
-
scrolling: false,
|
|
634
|
-
hasOverflow: false,
|
|
635
|
-
disabledHover: false,
|
|
636
|
-
scrolledToBottom: false
|
|
637
|
-
});
|
|
638
|
-
|
|
639
|
-
_defineProperty(this, "hoverHandler", memoize(index => () => scheduleHoverListener(() => {
|
|
640
|
-
if (this.state.disabledHover) {
|
|
641
|
-
return;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
if (this.container) {
|
|
645
|
-
this.setState({
|
|
646
|
-
activeIndex: index,
|
|
647
|
-
activeItem: this.props.data[index],
|
|
648
|
-
needScrollToActive: false
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
})));
|
|
652
|
-
|
|
653
|
-
_defineProperty(this, "_activatableItems", false);
|
|
654
|
-
|
|
655
|
-
_defineProperty(this, "_bufferSize", 10);
|
|
656
|
-
|
|
657
|
-
_defineProperty(this, "sizeCacheKey", index => {
|
|
658
|
-
if (index === 0 || index === this.props.data.length + 1) {
|
|
659
|
-
return Type.MARGIN;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
const item = this.props.data[index - 1];
|
|
663
|
-
const isFirst = index === 1;
|
|
664
|
-
|
|
665
|
-
switch (item.rgItemType) {
|
|
666
|
-
case Type.SEPARATOR:
|
|
667
|
-
case Type.TITLE:
|
|
668
|
-
return `${item.rgItemType}${isFirst ? '_first' : ''}${item.description ? '_desc' : ''}`;
|
|
669
|
-
|
|
670
|
-
case Type.MARGIN:
|
|
671
|
-
return Type.MARGIN;
|
|
672
|
-
|
|
673
|
-
case Type.CUSTOM:
|
|
674
|
-
return `${Type.CUSTOM}_${item.key}`;
|
|
675
|
-
|
|
676
|
-
case Type.ITEM:
|
|
677
|
-
case Type.LINK:
|
|
678
|
-
default:
|
|
679
|
-
if (item.details) {
|
|
680
|
-
return `${Type.ITEM}_${item.details}`;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
return Type.ITEM;
|
|
684
|
-
}
|
|
685
|
-
});
|
|
686
|
-
|
|
687
|
-
_defineProperty(this, "_cache", new CellMeasurerCache({
|
|
688
|
-
defaultHeight: this.defaultItemHeight(),
|
|
689
|
-
fixedWidth: true,
|
|
690
|
-
keyMapper: this.sizeCacheKey
|
|
691
|
-
}));
|
|
692
|
-
|
|
693
|
-
_defineProperty(this, "_hasActivatableItems", memoizeOne(items => items.some(isActivatable)));
|
|
694
|
-
|
|
695
|
-
_defineProperty(this, "selectHandler", memoize(index => (event, tryKeepOpen = false) => {
|
|
696
|
-
const item = this.props.data[index];
|
|
697
|
-
|
|
698
|
-
if (!this.props.useMouseUp && item.onClick) {
|
|
699
|
-
item.onClick(item, event);
|
|
700
|
-
} else if (this.props.useMouseUp && item.onMouseUp) {
|
|
701
|
-
item.onMouseUp(item, event);
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
if (this.props.onSelect) {
|
|
705
|
-
this.props.onSelect(item, event, {
|
|
706
|
-
tryKeepOpen
|
|
707
|
-
});
|
|
708
|
-
}
|
|
709
|
-
}));
|
|
710
|
-
|
|
711
|
-
_defineProperty(this, "checkboxHandler", memoize(index => event => this.selectHandler(index)(event, true)));
|
|
712
|
-
|
|
713
|
-
_defineProperty(this, "upHandler", e => {
|
|
714
|
-
const {
|
|
715
|
-
data,
|
|
716
|
-
disableMoveOverflow
|
|
717
|
-
} = this.props;
|
|
718
|
-
const index = this.state.activeIndex;
|
|
719
|
-
let newIndex;
|
|
720
|
-
|
|
721
|
-
if (index === null || index === 0) {
|
|
722
|
-
if (!disableMoveOverflow) {
|
|
723
|
-
newIndex = data.length - 1;
|
|
724
|
-
} else {
|
|
725
|
-
return;
|
|
726
|
-
}
|
|
727
|
-
} else {
|
|
728
|
-
newIndex = index - 1;
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
this.moveHandler(newIndex, this.upHandler, e);
|
|
732
|
-
});
|
|
733
|
-
|
|
734
|
-
_defineProperty(this, "downHandler", e => {
|
|
735
|
-
const {
|
|
736
|
-
data,
|
|
737
|
-
disableMoveOverflow,
|
|
738
|
-
disableMoveDownOverflow
|
|
739
|
-
} = this.props;
|
|
740
|
-
const index = this.state.activeIndex;
|
|
741
|
-
let newIndex;
|
|
742
|
-
|
|
743
|
-
if (index === null) {
|
|
744
|
-
newIndex = 0;
|
|
745
|
-
} else if (index + 1 === data.length) {
|
|
746
|
-
if (!disableMoveOverflow && !disableMoveDownOverflow) {
|
|
747
|
-
newIndex = 0;
|
|
748
|
-
} else {
|
|
749
|
-
return;
|
|
750
|
-
}
|
|
751
|
-
} else {
|
|
752
|
-
newIndex = index + 1;
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
this.moveHandler(newIndex, this.downHandler, e);
|
|
756
|
-
});
|
|
757
|
-
|
|
758
|
-
_defineProperty(this, "homeHandler", e => {
|
|
759
|
-
this.moveHandler(0, this.downHandler, e);
|
|
760
|
-
});
|
|
761
|
-
|
|
762
|
-
_defineProperty(this, "endHandler", e => {
|
|
763
|
-
this.moveHandler(this.props.data.length - 1, this.upHandler, e);
|
|
764
|
-
});
|
|
765
|
-
|
|
766
|
-
_defineProperty(this, "onDocumentMouseMove", () => {
|
|
767
|
-
if (this.state.disabledHover) {
|
|
768
|
-
this.setState({
|
|
769
|
-
disabledHover: false
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
});
|
|
773
|
-
|
|
774
|
-
_defineProperty(this, "onDocumentKeyDown", e => {
|
|
775
|
-
const metaKeys = [16, 17, 18, 19, 20, 91]; // eslint-disable-line no-magic-numbers
|
|
776
|
-
|
|
777
|
-
if (!this.state.disabledHover && !metaKeys.includes(e.keyCode)) {
|
|
778
|
-
this.setState({
|
|
779
|
-
disabledHover: true
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
});
|
|
783
|
-
|
|
784
|
-
_defineProperty(this, "mouseHandler", () => {
|
|
785
|
-
this.setState({
|
|
786
|
-
scrolling: false
|
|
787
|
-
});
|
|
788
|
-
});
|
|
789
|
-
|
|
790
|
-
_defineProperty(this, "scrollHandler", () => {
|
|
791
|
-
this.setState({
|
|
792
|
-
scrolling: true
|
|
793
|
-
}, this.scrollEndHandler);
|
|
794
|
-
});
|
|
795
|
-
|
|
796
|
-
_defineProperty(this, "enterHandler", (event, shortcut) => {
|
|
797
|
-
if (this.state.activeIndex !== null) {
|
|
798
|
-
const item = this.props.data[this.state.activeIndex];
|
|
799
|
-
this.selectHandler(this.state.activeIndex)(event);
|
|
800
|
-
|
|
801
|
-
if (item.href && !event.defaultPrevented) {
|
|
802
|
-
if (['command+enter', 'ctrl+enter'].includes(shortcut)) {
|
|
803
|
-
window.open(item.href, '_blank');
|
|
804
|
-
} else if (shortcut === 'shift+enter') {
|
|
805
|
-
window.open(item.href);
|
|
806
|
-
} else {
|
|
807
|
-
window.location.href = item.href;
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
return false; // do not propagate event
|
|
812
|
-
} else {
|
|
813
|
-
return true; // propagate event to the parent component (e.g., QueryAssist)
|
|
814
|
-
}
|
|
815
|
-
});
|
|
816
|
-
|
|
817
|
-
_defineProperty(this, "clearSelected", () => {
|
|
818
|
-
this.setState({
|
|
819
|
-
activeIndex: null,
|
|
820
|
-
needScrollToActive: false
|
|
821
|
-
});
|
|
822
|
-
});
|
|
823
|
-
|
|
824
|
-
_defineProperty(this, "scrollEndHandler", () => scheduleScrollListener(() => {
|
|
825
|
-
const innerContainer = this.inner;
|
|
826
|
-
|
|
827
|
-
if (innerContainer) {
|
|
828
|
-
const maxScrollingPosition = innerContainer.scrollHeight;
|
|
829
|
-
const sensitivity = this.defaultItemHeight() / 2;
|
|
830
|
-
const currentScrollingPosition = innerContainer.scrollTop + innerContainer.clientHeight + sensitivity;
|
|
831
|
-
const scrolledToBottom = maxScrollingPosition > 0 && currentScrollingPosition >= maxScrollingPosition;
|
|
832
|
-
|
|
833
|
-
if (!this.unmounted) {
|
|
834
|
-
this.setState({
|
|
835
|
-
scrolledToBottom
|
|
836
|
-
});
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
if (scrolledToBottom) {
|
|
840
|
-
this.props.onScrollToBottom();
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
}));
|
|
844
|
-
|
|
845
|
-
_defineProperty(this, "checkOverflow", () => {
|
|
846
|
-
if (this.inner) {
|
|
847
|
-
this.setState({
|
|
848
|
-
hasOverflow: this.inner.scrollHeight - this.inner.clientHeight > 1
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
});
|
|
852
|
-
|
|
853
|
-
_defineProperty(this, "renderItem", ({
|
|
854
|
-
index,
|
|
855
|
-
style,
|
|
856
|
-
isScrolling,
|
|
857
|
-
parent,
|
|
858
|
-
key
|
|
859
|
-
}) => {
|
|
860
|
-
let itemKey;
|
|
861
|
-
let el;
|
|
862
|
-
const realIndex = index - 1;
|
|
863
|
-
const item = this.props.data[realIndex];
|
|
864
|
-
const itemId = this.getId(item); // top and bottom margins
|
|
865
|
-
|
|
866
|
-
if (index === 0 || index === this.props.data.length + 1 || item.rgItemType === Type.MARGIN) {
|
|
867
|
-
itemKey = key || `${Type.MARGIN}_${index}`;
|
|
868
|
-
el = /*#__PURE__*/React.createElement("div", {
|
|
869
|
-
style: {
|
|
870
|
-
height: Dimension.MARGIN
|
|
871
|
-
}
|
|
872
|
-
});
|
|
873
|
-
} else {
|
|
874
|
-
// Hack around SelectNG implementation
|
|
875
|
-
const cleanedProps = _objectWithoutProperties(item, ["selectedLabel", "originalModel"]);
|
|
876
|
-
|
|
877
|
-
const itemProps = Object.assign({
|
|
878
|
-
rgItemType: DEFAULT_ITEM_TYPE
|
|
879
|
-
}, cleanedProps);
|
|
880
|
-
|
|
881
|
-
if (itemProps.url) {
|
|
882
|
-
itemProps.href = itemProps.url;
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
if (itemProps.href) {
|
|
886
|
-
itemProps.rgItemType = Type.LINK;
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
itemKey = key || itemId;
|
|
890
|
-
itemProps.hover = realIndex === this.state.activeIndex;
|
|
891
|
-
|
|
892
|
-
if (itemProps.hoverClassName != null && itemProps.hover) {
|
|
893
|
-
itemProps.className = classNames(itemProps.className, itemProps.hoverClassName);
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
itemProps.onMouseOver = this.hoverHandler(realIndex);
|
|
897
|
-
itemProps.tabIndex = -1;
|
|
898
|
-
itemProps.scrolling = isScrolling;
|
|
899
|
-
const selectHandler = this.selectHandler(realIndex);
|
|
900
|
-
|
|
901
|
-
if (this.props.useMouseUp) {
|
|
902
|
-
itemProps.onMouseUp = selectHandler;
|
|
903
|
-
} else {
|
|
904
|
-
itemProps.onClick = selectHandler;
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
itemProps.onCheckboxChange = this.checkboxHandler(realIndex);
|
|
908
|
-
|
|
909
|
-
if (itemProps.compact == null) {
|
|
910
|
-
itemProps.compact = this.props.compact;
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
let ItemComponent;
|
|
914
|
-
const isFirst = index === 1;
|
|
915
|
-
|
|
916
|
-
switch (itemProps.rgItemType) {
|
|
917
|
-
case Type.SEPARATOR:
|
|
918
|
-
ItemComponent = ListSeparator;
|
|
919
|
-
itemProps.isFirst = isFirst;
|
|
920
|
-
break;
|
|
921
|
-
|
|
922
|
-
case Type.LINK:
|
|
923
|
-
ItemComponent = ListLink;
|
|
924
|
-
this.addItemDataTestToProp(itemProps);
|
|
925
|
-
break;
|
|
926
|
-
|
|
927
|
-
case Type.ITEM:
|
|
928
|
-
ItemComponent = ListItem;
|
|
929
|
-
this.addItemDataTestToProp(itemProps);
|
|
930
|
-
break;
|
|
931
|
-
|
|
932
|
-
case Type.CUSTOM:
|
|
933
|
-
ItemComponent = ListCustom;
|
|
934
|
-
this.addItemDataTestToProp(itemProps);
|
|
935
|
-
break;
|
|
936
|
-
|
|
937
|
-
case Type.TITLE:
|
|
938
|
-
itemProps.isFirst = isFirst;
|
|
939
|
-
ItemComponent = ListTitle;
|
|
940
|
-
break;
|
|
941
|
-
|
|
942
|
-
default:
|
|
943
|
-
throw new Error(`Unknown menu element type: ${itemProps.rgItemType}`);
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
el = /*#__PURE__*/React.createElement(ItemComponent, itemProps);
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
return parent ? /*#__PURE__*/React.createElement(CellMeasurer, {
|
|
950
|
-
cache: this._cache,
|
|
951
|
-
key: itemKey,
|
|
952
|
-
parent: parent,
|
|
953
|
-
rowIndex: index,
|
|
954
|
-
columnIndex: 0
|
|
955
|
-
}, ({
|
|
956
|
-
registerChild
|
|
957
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
958
|
-
ref: registerChild,
|
|
959
|
-
style: style,
|
|
960
|
-
role: "row",
|
|
961
|
-
id: itemId
|
|
962
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
963
|
-
role: "cell"
|
|
964
|
-
}, el))) : /*#__PURE__*/cloneElement(el, {
|
|
965
|
-
key: itemKey
|
|
966
|
-
});
|
|
967
|
-
});
|
|
968
|
-
|
|
969
|
-
_defineProperty(this, "addItemDataTestToProp", props => {
|
|
970
|
-
props['data-test'] = joinDataTestAttributes('ring-list-item', props['data-test']);
|
|
971
|
-
return props;
|
|
972
|
-
});
|
|
973
|
-
|
|
974
|
-
_defineProperty(this, "virtualizedListRef", el => {
|
|
975
|
-
this.virtualizedList = el;
|
|
976
|
-
});
|
|
977
|
-
|
|
978
|
-
_defineProperty(this, "containerRef", el => {
|
|
979
|
-
this.container = el;
|
|
980
|
-
});
|
|
981
|
-
|
|
982
|
-
_defineProperty(this, "id", getUID('list-'));
|
|
983
|
-
|
|
984
|
-
_defineProperty(this, "shortcutsScope", this.id);
|
|
985
|
-
|
|
986
|
-
_defineProperty(this, "shortcutsMap", {
|
|
987
|
-
up: this.upHandler,
|
|
988
|
-
down: this.downHandler,
|
|
989
|
-
home: this.homeHandler,
|
|
990
|
-
end: this.endHandler,
|
|
991
|
-
enter: this.enterHandler,
|
|
992
|
-
'meta+enter': this.enterHandler,
|
|
993
|
-
'ctrl+enter': this.enterHandler,
|
|
994
|
-
'command+enter': this.enterHandler,
|
|
995
|
-
'shift+enter': this.enterHandler
|
|
996
|
-
});
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
static getDerivedStateFromProps(nextProps, prevState) {
|
|
1000
|
-
const {
|
|
1001
|
-
prevActiveIndex,
|
|
1002
|
-
prevData,
|
|
1003
|
-
activeItem
|
|
1004
|
-
} = prevState;
|
|
1005
|
-
const {
|
|
1006
|
-
data,
|
|
1007
|
-
activeIndex,
|
|
1008
|
-
restoreActiveIndex
|
|
1009
|
-
} = nextProps;
|
|
1010
|
-
const nextState = {
|
|
1011
|
-
prevActiveIndex: activeIndex,
|
|
1012
|
-
prevData: data
|
|
1013
|
-
};
|
|
1014
|
-
|
|
1015
|
-
if (data !== prevData) {
|
|
1016
|
-
Object.assign(nextState, {
|
|
1017
|
-
activeIndex: null,
|
|
1018
|
-
activeItem: null
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
if (activeIndex != null && activeIndex !== prevActiveIndex && data[activeIndex] != null) {
|
|
1023
|
-
Object.assign(nextState, {
|
|
1024
|
-
activeIndex,
|
|
1025
|
-
activeItem: data[activeIndex],
|
|
1026
|
-
needScrollToActive: true
|
|
1027
|
-
});
|
|
1028
|
-
} else if (data !== prevData && restoreActiveIndex && activeItem != null && activeItem.key != null) {
|
|
1029
|
-
// Restore active index if there is an item with the same "key" property
|
|
1030
|
-
const index = data.findIndex(item => item.key === activeItem.key);
|
|
1031
|
-
|
|
1032
|
-
if (index >= 0) {
|
|
1033
|
-
Object.assign(nextState, {
|
|
1034
|
-
activeIndex: index,
|
|
1035
|
-
activeItem: data[index]
|
|
1036
|
-
});
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
if (activeIndex == null && prevState.activeIndex == null && shouldActivateFirstItem(nextProps)) {
|
|
1041
|
-
const firstActivatableIndex = data.findIndex(isActivatable);
|
|
1042
|
-
|
|
1043
|
-
if (firstActivatableIndex >= 0) {
|
|
1044
|
-
Object.assign(nextState, {
|
|
1045
|
-
activeIndex: firstActivatableIndex,
|
|
1046
|
-
activeItem: data[firstActivatableIndex],
|
|
1047
|
-
needScrollToActive: true
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
return nextState;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
componentDidMount() {
|
|
1056
|
-
document.addEventListener('mousemove', this.onDocumentMouseMove);
|
|
1057
|
-
document.addEventListener('keydown', this.onDocumentKeyDown, true);
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
shouldComponentUpdate(nextProps, nextState) {
|
|
1061
|
-
return nextProps !== this.props || Object.keys(nextState).some(key => nextState[key] !== this.state[key]);
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
componentDidUpdate(prevProps) {
|
|
1065
|
-
if (this.virtualizedList && prevProps.data !== this.props.data) {
|
|
1066
|
-
this.virtualizedList.recomputeRowHeights();
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
this.checkOverflow();
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
componentWillUnmount() {
|
|
1073
|
-
this.unmounted = true;
|
|
1074
|
-
document.removeEventListener('mousemove', this.onDocumentMouseMove);
|
|
1075
|
-
document.removeEventListener('keydown', this.onDocumentKeyDown, true);
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
hasActivatableItems() {
|
|
1079
|
-
return this._hasActivatableItems(this.props.data);
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
moveHandler(index, retryCallback, e) {
|
|
1083
|
-
let correctedIndex;
|
|
1084
|
-
|
|
1085
|
-
if (this.props.data.length === 0 || !this.hasActivatableItems()) {
|
|
1086
|
-
return;
|
|
1087
|
-
} else if (this.props.data.length < index) {
|
|
1088
|
-
correctedIndex = 0;
|
|
1089
|
-
} else {
|
|
1090
|
-
correctedIndex = index;
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
const item = this.props.data[correctedIndex];
|
|
1094
|
-
this.setState({
|
|
1095
|
-
activeIndex: correctedIndex,
|
|
1096
|
-
activeItem: item,
|
|
1097
|
-
needScrollToActive: true
|
|
1098
|
-
}, function onSet() {
|
|
1099
|
-
if (!isActivatable(item)) {
|
|
1100
|
-
retryCallback(e);
|
|
1101
|
-
return;
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
if (e.key !== 'Home' && e.key !== 'End') {
|
|
1105
|
-
preventDefault(e);
|
|
1106
|
-
}
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
getFirst() {
|
|
1111
|
-
return this.props.data.find(item => item.rgItemType === Type.ITEM || item.rgItemType === Type.CUSTOM);
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
getSelected() {
|
|
1115
|
-
return this.props.data[this.state.activeIndex];
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
defaultItemHeight() {
|
|
1119
|
-
return this.props.compact ? Dimension.COMPACT_ITEM_HEIGHT : Dimension.ITEM_HEIGHT;
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
getVisibleListHeight(props) {
|
|
1123
|
-
return props.maxHeight - this.defaultItemHeight() - Dimension.INNER_PADDING;
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
_deprecatedGenerateKeyFromContent(itemProps) {
|
|
1127
|
-
const identificator = itemProps.label || itemProps.description;
|
|
1128
|
-
const isString = typeof identificator === 'string' || identificator instanceof String;
|
|
1129
|
-
|
|
1130
|
-
if (identificator && !isString) {
|
|
1131
|
-
warnEmptyKey();
|
|
1132
|
-
`${itemProps.rgItemType}_${JSON.stringify(identificator)}`;
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
return `${itemProps.rgItemType}_${identificator}`;
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
getId(item) {
|
|
1139
|
-
return item != null ? `${this.id}:${item.key || this._deprecatedGenerateKeyFromContent(item)}` : null;
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
get inner() {
|
|
1143
|
-
if (!this._inner) {
|
|
1144
|
-
this._inner = this.container && this.container.querySelector('.ring-list__i');
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
return this._inner;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
renderVirtualizedInner({
|
|
1151
|
-
height,
|
|
1152
|
-
maxHeight,
|
|
1153
|
-
autoHeight = false,
|
|
1154
|
-
rowCount,
|
|
1155
|
-
isScrolling,
|
|
1156
|
-
onChildScroll = noop,
|
|
1157
|
-
scrollTop,
|
|
1158
|
-
registerChild
|
|
1159
|
-
}) {
|
|
1160
|
-
const dirOverride = {
|
|
1161
|
-
direction: 'auto'
|
|
1162
|
-
}; // Virtualized sets "direction: ltr" by default https://github.com/bvaughn/react-virtualized/issues/457
|
|
1163
|
-
|
|
1164
|
-
return /*#__PURE__*/React.createElement(AutoSizer, {
|
|
1165
|
-
disableHeight: true,
|
|
1166
|
-
onResize: this.props.onResize
|
|
1167
|
-
}, ({
|
|
1168
|
-
width
|
|
1169
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
1170
|
-
ref: registerChild
|
|
1171
|
-
}, /*#__PURE__*/React.createElement(VirtualizedList, {
|
|
1172
|
-
"aria-label": this.props.ariaLabel,
|
|
1173
|
-
ref: this.virtualizedListRef,
|
|
1174
|
-
className: "ring-list__i",
|
|
1175
|
-
autoHeight: autoHeight,
|
|
1176
|
-
style: maxHeight ? _objectSpread2({
|
|
1177
|
-
maxHeight,
|
|
1178
|
-
height: 'auto'
|
|
1179
|
-
}, dirOverride) : dirOverride,
|
|
1180
|
-
autoContainerWidth: true,
|
|
1181
|
-
height: height,
|
|
1182
|
-
width: width,
|
|
1183
|
-
isScrolling: isScrolling,
|
|
1184
|
-
onScroll: e => {
|
|
1185
|
-
onChildScroll(e);
|
|
1186
|
-
this.scrollEndHandler(e);
|
|
1187
|
-
},
|
|
1188
|
-
scrollTop: scrollTop,
|
|
1189
|
-
rowCount: rowCount,
|
|
1190
|
-
estimatedRowSize: this.defaultItemHeight(),
|
|
1191
|
-
rowHeight: this._cache.rowHeight,
|
|
1192
|
-
rowRenderer: this.renderItem,
|
|
1193
|
-
overscanRowCount: this._bufferSize // ensure rerendering
|
|
1194
|
-
,
|
|
1195
|
-
noop: () => {},
|
|
1196
|
-
scrollToIndex: !this.props.disableScrollToActive && this.state.needScrollToActive && this.state.activeIndex != null ? this.state.activeIndex + 1 : undefined,
|
|
1197
|
-
scrollToAlignment: "center",
|
|
1198
|
-
deferredMeasurementCache: this._cache,
|
|
1199
|
-
onRowsRendered: this.checkOverflow
|
|
1200
|
-
})));
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
renderVirtualized(maxHeight, rowCount) {
|
|
1204
|
-
if (maxHeight) {
|
|
1205
|
-
return this.renderVirtualizedInner({
|
|
1206
|
-
height: maxHeight,
|
|
1207
|
-
maxHeight,
|
|
1208
|
-
rowCount
|
|
1209
|
-
});
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
return /*#__PURE__*/React.createElement(WindowScroller, null, props => this.renderVirtualizedInner(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
1213
|
-
rowCount,
|
|
1214
|
-
autoHeight: true
|
|
1215
|
-
})));
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
renderSimple(maxHeight, rowCount) {
|
|
1219
|
-
const items = [];
|
|
1220
|
-
|
|
1221
|
-
for (let index = 0; index < rowCount; index++) {
|
|
1222
|
-
items.push(this.renderItem({
|
|
1223
|
-
index,
|
|
1224
|
-
isScrolling: this.state.scrolling
|
|
1225
|
-
}));
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1229
|
-
className: classNames('ring-list__i', modules_3b67a421.simpleInner),
|
|
1230
|
-
onScroll: this.scrollHandler,
|
|
1231
|
-
onMouseMove: this.mouseHandler
|
|
1232
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1233
|
-
"aria-label": this.props.ariaLabel,
|
|
1234
|
-
style: maxHeight ? {
|
|
1235
|
-
maxHeight: this.getVisibleListHeight(this.props)
|
|
1236
|
-
} : null
|
|
1237
|
-
}, items));
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
/** @override */
|
|
1241
|
-
render() {
|
|
1242
|
-
const hint = this.getSelected() && this.props.hintOnSelection || this.props.hint;
|
|
1243
|
-
const fadeStyles = hint ? {
|
|
1244
|
-
bottom: Dimension.ITEM_HEIGHT
|
|
1245
|
-
} : null;
|
|
1246
|
-
const rowCount = this.props.data.length + 2;
|
|
1247
|
-
const maxHeight = this.props.maxHeight && this.getVisibleListHeight(this.props);
|
|
1248
|
-
const classes = classNames(modules_3b67a421.list, this.props.className);
|
|
1249
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ActiveItemContext.Updater, {
|
|
1250
|
-
value: this.getId(this.state.activeItem),
|
|
1251
|
-
skipUpdate: this.props.hidden || !isActivatable(this.state.activeItem)
|
|
1252
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
1253
|
-
id: this.props.id,
|
|
1254
|
-
ref: this.containerRef,
|
|
1255
|
-
className: classes,
|
|
1256
|
-
onMouseOut: this.props.onMouseOut,
|
|
1257
|
-
onBlur: this.props.onMouseOut,
|
|
1258
|
-
onMouseLeave: this.clearSelected,
|
|
1259
|
-
"data-test": "ring-list"
|
|
1260
|
-
}, this.props.shortcuts && /*#__PURE__*/React.createElement(Shortcuts, {
|
|
1261
|
-
map: this.shortcutsMap,
|
|
1262
|
-
scope: this.shortcutsScope
|
|
1263
|
-
}), this.props.renderOptimization ? this.renderVirtualized(maxHeight, rowCount) : this.renderSimple(maxHeight, rowCount), this.state.hasOverflow && !this.state.scrolledToBottom && /*#__PURE__*/React.createElement("div", {
|
|
1264
|
-
className: modules_3b67a421.fade,
|
|
1265
|
-
style: fadeStyles
|
|
1266
|
-
}), hint && /*#__PURE__*/React.createElement(ListHint, {
|
|
1267
|
-
label: hint
|
|
1268
|
-
})));
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
_defineProperty(List, "propTypes", {
|
|
1274
|
-
id: PropTypes.string,
|
|
1275
|
-
className: PropTypes.string,
|
|
1276
|
-
hint: PropTypes.node,
|
|
1277
|
-
hintOnSelection: PropTypes.string,
|
|
1278
|
-
data: PropTypes.array,
|
|
1279
|
-
maxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
1280
|
-
activeIndex: PropTypes.number,
|
|
1281
|
-
restoreActiveIndex: PropTypes.bool,
|
|
1282
|
-
activateSingleItem: PropTypes.bool,
|
|
1283
|
-
activateFirstItem: PropTypes.bool,
|
|
1284
|
-
shortcuts: PropTypes.bool,
|
|
1285
|
-
onMouseOut: PropTypes.func,
|
|
1286
|
-
onSelect: PropTypes.func,
|
|
1287
|
-
onScrollToBottom: PropTypes.func,
|
|
1288
|
-
onResize: PropTypes.func,
|
|
1289
|
-
useMouseUp: PropTypes.bool,
|
|
1290
|
-
visible: PropTypes.bool,
|
|
1291
|
-
renderOptimization: PropTypes.bool,
|
|
1292
|
-
disableMoveOverflow: PropTypes.bool,
|
|
1293
|
-
disableMoveDownOverflow: PropTypes.bool,
|
|
1294
|
-
compact: PropTypes.bool,
|
|
1295
|
-
disableScrollToActive: PropTypes.bool,
|
|
1296
|
-
hidden: PropTypes.bool,
|
|
1297
|
-
ariaLabel: PropTypes.string
|
|
1298
|
-
});
|
|
1299
|
-
|
|
1300
|
-
_defineProperty(List, "defaultProps", {
|
|
1301
|
-
data: [],
|
|
1302
|
-
restoreActiveIndex: false,
|
|
1303
|
-
// restore active item using its "key" property
|
|
1304
|
-
activateSingleItem: false,
|
|
1305
|
-
// if there is only one item, activate it
|
|
1306
|
-
activateFirstItem: false,
|
|
1307
|
-
// if there no active items, activate the first one
|
|
1308
|
-
onMouseOut: noop,
|
|
1309
|
-
onSelect: noop,
|
|
1310
|
-
onScrollToBottom: noop,
|
|
1311
|
-
onResize: noop,
|
|
1312
|
-
shortcuts: false,
|
|
1313
|
-
renderOptimization: true,
|
|
1314
|
-
disableMoveDownOverflow: false,
|
|
1315
|
-
ariaLabel: 'List'
|
|
1316
|
-
});
|
|
1317
|
-
|
|
1318
|
-
_defineProperty(List, "isItemType", isItemType);
|
|
1319
|
-
|
|
1320
|
-
_defineProperty(List, "ListHint", ListHint);
|
|
1321
|
-
|
|
1322
|
-
_defineProperty(List, "ListProps", {
|
|
1323
|
-
Type,
|
|
1324
|
-
Dimension
|
|
1325
|
-
});
|
|
1326
|
-
|
|
1327
|
-
export { ActiveItemContext as A, List as L, getEventKey as g };
|