@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/data-list.js
DELETED
|
@@ -1,466 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty, c as _objectSpread2 } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { f as focusSensorHOC, d as disableHoverHOC, s as selectionShortcutsHOC } from './_helpers/disable-hover-hoc.js';
|
|
6
|
-
import { g as getUID } from './_helpers/get-uid.js';
|
|
7
|
-
import Shortcuts from './shortcuts.js';
|
|
8
|
-
import Loader from './loader.js';
|
|
9
|
-
import chevronRightIcon from '@jetbrains/icons/chevron-right';
|
|
10
|
-
import chevronDownIcon from '@jetbrains/icons/chevron-down';
|
|
11
|
-
import Link from './link.js';
|
|
12
|
-
import Text from './text.js';
|
|
13
|
-
import LoaderInline from './loader-inline.js';
|
|
14
|
-
import { B as Button } from './_helpers/button.js';
|
|
15
|
-
import Checkbox from './checkbox.js';
|
|
16
|
-
import './selection.js';
|
|
17
|
-
import 'combokeys';
|
|
18
|
-
import './_helpers/sniffer.js';
|
|
19
|
-
import 'sniffr';
|
|
20
|
-
import './_helpers/data-tests.js';
|
|
21
|
-
import './_helpers/dom.js';
|
|
22
|
-
import 'focus-visible';
|
|
23
|
-
import './_helpers/memoize.js';
|
|
24
|
-
import './_helpers/clickableLink.js';
|
|
25
|
-
import './_helpers/theme.js';
|
|
26
|
-
import 'conic-gradient';
|
|
27
|
-
import '@jetbrains/icons/chevron-10px';
|
|
28
|
-
import './icon.js';
|
|
29
|
-
import 'util-deprecate';
|
|
30
|
-
import '@jetbrains/icons/checkmark';
|
|
31
|
-
import '@jetbrains/icons/remove-10px';
|
|
32
|
-
|
|
33
|
-
var modules_09d014b4 = {"unit":"8px","height":"32px","compensate":"2px","dataListWrapper":"dataList_dataListWrapper__b7146dba","dataList":"dataList_dataList__b7146dba","itemContent":"dataList_itemContent__b7146dba","title":"dataList_title__b7146dba","disabledHover":"dataList_disabledHover__b7146dba","titleSelected":"dataList_titleSelected__b7146dba","titleFocused":"dataList_titleFocused__b7146dba","showMore":"dataList_showMore__b7146dba","boxes":"dataList_boxes__b7146dba","checkboxBox":"dataList_checkboxBox__b7146dba","collapseButton":"dataList_collapseButton__b7146dba","collapseIcon":"dataList_collapseIcon__b7146dba","loadingOverlay":"dataList_loadingOverlay__b7146dba","showMoreLoader":"dataList_showMoreLoader__b7146dba"};
|
|
34
|
-
|
|
35
|
-
class Title extends PureComponent {
|
|
36
|
-
constructor(...args) {
|
|
37
|
-
super(...args);
|
|
38
|
-
|
|
39
|
-
_defineProperty(this, "id", getUID('data-list-title'));
|
|
40
|
-
|
|
41
|
-
_defineProperty(this, "onCheckboxFocus", () => {
|
|
42
|
-
this.props.onFocusRestore();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
_defineProperty(this, "onCheckboxChange", () => {
|
|
46
|
-
this.toggleSelection();
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
toggleSelection() {
|
|
51
|
-
const {
|
|
52
|
-
selectable,
|
|
53
|
-
selected,
|
|
54
|
-
onSelect
|
|
55
|
-
} = this.props;
|
|
56
|
-
|
|
57
|
-
if (selectable) {
|
|
58
|
-
onSelect(!selected);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
render() {
|
|
63
|
-
const {
|
|
64
|
-
className,
|
|
65
|
-
title,
|
|
66
|
-
offset,
|
|
67
|
-
showFocus,
|
|
68
|
-
innerRef,
|
|
69
|
-
selectable,
|
|
70
|
-
selected,
|
|
71
|
-
collapserExpander
|
|
72
|
-
} = this.props;
|
|
73
|
-
const classes = classNames(className, {
|
|
74
|
-
[modules_09d014b4.title]: true,
|
|
75
|
-
[modules_09d014b4.titleFocused]: showFocus,
|
|
76
|
-
[modules_09d014b4.titleSelected]: selected
|
|
77
|
-
});
|
|
78
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
79
|
-
id: this.id,
|
|
80
|
-
className: classes,
|
|
81
|
-
style: {
|
|
82
|
-
paddingLeft: offset
|
|
83
|
-
},
|
|
84
|
-
ref: innerRef
|
|
85
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
86
|
-
className: modules_09d014b4.boxes
|
|
87
|
-
}, selectable && /*#__PURE__*/React.createElement("div", {
|
|
88
|
-
className: modules_09d014b4.checkboxBox
|
|
89
|
-
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
90
|
-
"aria-labelledby": this.id,
|
|
91
|
-
className: showFocus ? 'ring-checkbox_focus' : '',
|
|
92
|
-
checked: selected,
|
|
93
|
-
onFocus: this.onCheckboxFocus,
|
|
94
|
-
onChange: this.onCheckboxChange,
|
|
95
|
-
tabIndex: "-1"
|
|
96
|
-
})), collapserExpander), title);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
_defineProperty(Title, "propTypes", {
|
|
102
|
-
className: PropTypes.string,
|
|
103
|
-
title: PropTypes.node,
|
|
104
|
-
offset: PropTypes.number,
|
|
105
|
-
selectable: PropTypes.bool,
|
|
106
|
-
selected: PropTypes.bool,
|
|
107
|
-
onSelect: PropTypes.func,
|
|
108
|
-
showFocus: PropTypes.bool,
|
|
109
|
-
collapserExpander: PropTypes.node,
|
|
110
|
-
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func]),
|
|
111
|
-
// focusSensorHOC
|
|
112
|
-
onFocusRestore: PropTypes.func
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
_defineProperty(Title, "defaultProps", {
|
|
116
|
-
selectable: false,
|
|
117
|
-
selected: false,
|
|
118
|
-
showFocus: false
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
var Title$1 = focusSensorHOC(Title);
|
|
122
|
-
|
|
123
|
-
const moreLessButtonStates = {
|
|
124
|
-
UNUSED: 0,
|
|
125
|
-
MORE: 1,
|
|
126
|
-
MORE_LOADING: 2,
|
|
127
|
-
LESS: 3
|
|
128
|
-
};
|
|
129
|
-
const ITEM_LEFT_OFFSET = 32;
|
|
130
|
-
const LIST_LEFT_OFFSET = 24;
|
|
131
|
-
class Item extends PureComponent {
|
|
132
|
-
constructor(...args) {
|
|
133
|
-
super(...args);
|
|
134
|
-
|
|
135
|
-
_defineProperty(this, "onShowMore", () => {
|
|
136
|
-
const {
|
|
137
|
-
onItemMoreLess,
|
|
138
|
-
item
|
|
139
|
-
} = this.props;
|
|
140
|
-
onItemMoreLess(item, true);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
_defineProperty(this, "onShowLess", () => {
|
|
144
|
-
const {
|
|
145
|
-
onItemMoreLess,
|
|
146
|
-
item
|
|
147
|
-
} = this.props;
|
|
148
|
-
onItemMoreLess(item, false);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
_defineProperty(this, "onFocus", () => {
|
|
152
|
-
const {
|
|
153
|
-
onFocus,
|
|
154
|
-
item
|
|
155
|
-
} = this.props;
|
|
156
|
-
onFocus(item);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
_defineProperty(this, "onSelect", selected => {
|
|
160
|
-
const {
|
|
161
|
-
onSelect,
|
|
162
|
-
item
|
|
163
|
-
} = this.props;
|
|
164
|
-
onSelect(item, selected);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
_defineProperty(this, "renderItem", (model, parentShift) => {
|
|
168
|
-
const {
|
|
169
|
-
onFocus,
|
|
170
|
-
onSelect,
|
|
171
|
-
selection,
|
|
172
|
-
level,
|
|
173
|
-
itemFormatter
|
|
174
|
-
} = this.props;
|
|
175
|
-
const item = itemFormatter(model);
|
|
176
|
-
return /*#__PURE__*/React.createElement(Item, {
|
|
177
|
-
key: item.key || item.id,
|
|
178
|
-
item: model,
|
|
179
|
-
title: item.title,
|
|
180
|
-
items: item.items,
|
|
181
|
-
level: level + 1,
|
|
182
|
-
parentShift: parentShift,
|
|
183
|
-
itemFormatter: itemFormatter,
|
|
184
|
-
collapsible: item.collapsible,
|
|
185
|
-
collapsed: item.collapsed,
|
|
186
|
-
onCollapse: item.onCollapse,
|
|
187
|
-
onExpand: item.onExpand,
|
|
188
|
-
focused: selection.isFocused(model),
|
|
189
|
-
showFocus: selection.isFocused(model),
|
|
190
|
-
onFocus: onFocus,
|
|
191
|
-
selection: selection,
|
|
192
|
-
selectable: item.selectable,
|
|
193
|
-
selected: selection.isSelected(model),
|
|
194
|
-
onSelect: onSelect
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
render() {
|
|
200
|
-
const {
|
|
201
|
-
title,
|
|
202
|
-
items,
|
|
203
|
-
showMoreLessButton,
|
|
204
|
-
level,
|
|
205
|
-
parentShift,
|
|
206
|
-
showFocus,
|
|
207
|
-
selectable,
|
|
208
|
-
selected,
|
|
209
|
-
collapsible,
|
|
210
|
-
collapsed,
|
|
211
|
-
onCollapse,
|
|
212
|
-
onExpand
|
|
213
|
-
} = this.props;
|
|
214
|
-
let moreLessButton;
|
|
215
|
-
|
|
216
|
-
if (showMoreLessButton === moreLessButtonStates.MORE || showMoreLessButton === moreLessButtonStates.MORE_LOADING) {
|
|
217
|
-
moreLessButton = /*#__PURE__*/React.createElement(Text, {
|
|
218
|
-
info: true
|
|
219
|
-
}, /*#__PURE__*/React.createElement(Link, {
|
|
220
|
-
inherit: true,
|
|
221
|
-
pseudo: true,
|
|
222
|
-
onClick: this.onShowMore
|
|
223
|
-
}, 'Show more'), showMoreLessButton === moreLessButtonStates.MORE_LOADING && /*#__PURE__*/React.createElement(LoaderInline, {
|
|
224
|
-
className: modules_09d014b4.showMoreLoader
|
|
225
|
-
}));
|
|
226
|
-
} else if (showMoreLessButton === moreLessButtonStates.LESS) {
|
|
227
|
-
moreLessButton = /*#__PURE__*/React.createElement(Text, {
|
|
228
|
-
info: true
|
|
229
|
-
}, /*#__PURE__*/React.createElement(Link, {
|
|
230
|
-
inherit: true,
|
|
231
|
-
pseudo: true,
|
|
232
|
-
onClick: this.onShowLess
|
|
233
|
-
}, 'Show less'));
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
let collapserExpander = null;
|
|
237
|
-
|
|
238
|
-
if (collapsible) {
|
|
239
|
-
if (collapsed) {
|
|
240
|
-
collapserExpander = /*#__PURE__*/React.createElement(Button, {
|
|
241
|
-
title: "Expand",
|
|
242
|
-
onClick: onExpand,
|
|
243
|
-
icon: chevronRightIcon,
|
|
244
|
-
className: modules_09d014b4.collapseButton,
|
|
245
|
-
iconClassName: modules_09d014b4.collapseIcon,
|
|
246
|
-
"data-test": "ring-data-list-expand"
|
|
247
|
-
});
|
|
248
|
-
} else {
|
|
249
|
-
collapserExpander = /*#__PURE__*/React.createElement(Button, {
|
|
250
|
-
title: "Collapse",
|
|
251
|
-
onClick: onCollapse,
|
|
252
|
-
icon: chevronDownIcon,
|
|
253
|
-
className: modules_09d014b4.collapseButton,
|
|
254
|
-
iconClassName: modules_09d014b4.collapseIcon,
|
|
255
|
-
"data-test": "ring-data-list-collapse"
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const itemIsEmpty = !items.length || collapsible && collapsed;
|
|
261
|
-
const offset = level * LIST_LEFT_OFFSET + ITEM_LEFT_OFFSET + parentShift;
|
|
262
|
-
return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Title$1, {
|
|
263
|
-
title: title,
|
|
264
|
-
focused: showFocus,
|
|
265
|
-
showFocus: showFocus,
|
|
266
|
-
selectable: selectable,
|
|
267
|
-
selected: selected,
|
|
268
|
-
collapserExpander: collapserExpander,
|
|
269
|
-
onFocus: this.onFocus,
|
|
270
|
-
onSelect: this.onSelect,
|
|
271
|
-
offset: offset
|
|
272
|
-
}), !itemIsEmpty ? /*#__PURE__*/React.createElement("ul", {
|
|
273
|
-
className: modules_09d014b4.itemContent
|
|
274
|
-
}, items.map(model => this.renderItem(model, parentShift)), showMoreLessButton !== moreLessButtonStates.UNUSED ? /*#__PURE__*/React.createElement("li", {
|
|
275
|
-
className: modules_09d014b4.showMore
|
|
276
|
-
}, moreLessButton) : null) : null);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
_defineProperty(Item, "propTypes", {
|
|
282
|
-
item: PropTypes.object,
|
|
283
|
-
title: PropTypes.node,
|
|
284
|
-
items: PropTypes.array,
|
|
285
|
-
className: PropTypes.string,
|
|
286
|
-
level: PropTypes.number,
|
|
287
|
-
parentShift: PropTypes.number,
|
|
288
|
-
itemFormatter: PropTypes.func,
|
|
289
|
-
collapsible: PropTypes.bool,
|
|
290
|
-
collapsed: PropTypes.bool,
|
|
291
|
-
onCollapse: PropTypes.func,
|
|
292
|
-
onExpand: PropTypes.func,
|
|
293
|
-
showFocus: PropTypes.bool,
|
|
294
|
-
onFocus: PropTypes.func,
|
|
295
|
-
selection: PropTypes.object,
|
|
296
|
-
selectable: PropTypes.bool,
|
|
297
|
-
selected: PropTypes.bool,
|
|
298
|
-
onSelect: PropTypes.func,
|
|
299
|
-
showMoreLessButton: PropTypes.number,
|
|
300
|
-
onItemMoreLess: PropTypes.func
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
_defineProperty(Item, "defaultProps", {
|
|
304
|
-
items: [],
|
|
305
|
-
level: 0,
|
|
306
|
-
parentShift: 0,
|
|
307
|
-
showMoreLessButton: moreLessButtonStates.UNUSED,
|
|
308
|
-
onItemMoreLess: () => {}
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
class DataList extends PureComponent {
|
|
312
|
-
constructor(...args) {
|
|
313
|
-
super(...args);
|
|
314
|
-
|
|
315
|
-
_defineProperty(this, "shortcutsScope", getUID('ring-data-list-'));
|
|
316
|
-
|
|
317
|
-
_defineProperty(this, "onItemFocus", item => {
|
|
318
|
-
const {
|
|
319
|
-
selection,
|
|
320
|
-
onSelect
|
|
321
|
-
} = this.props;
|
|
322
|
-
onSelect(selection.focus(item));
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
_defineProperty(this, "onItemSelect", (item, selected) => {
|
|
326
|
-
const {
|
|
327
|
-
selection,
|
|
328
|
-
onSelect
|
|
329
|
-
} = this.props;
|
|
330
|
-
|
|
331
|
-
if (selected) {
|
|
332
|
-
onSelect(selection.select(item));
|
|
333
|
-
} else {
|
|
334
|
-
onSelect(selection.deselect(item));
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
_defineProperty(this, "onEqualPress", () => {
|
|
339
|
-
const {
|
|
340
|
-
selection,
|
|
341
|
-
itemFormatter
|
|
342
|
-
} = this.props;
|
|
343
|
-
const item = itemFormatter(selection.getFocused());
|
|
344
|
-
|
|
345
|
-
if (item.collapsed) {
|
|
346
|
-
item.onExpand();
|
|
347
|
-
} else {
|
|
348
|
-
item.onCollapse();
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
_defineProperty(this, "shortcutsMap", {
|
|
353
|
-
'=': this.onEqualPress
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
componentDidUpdate(prevProps) {
|
|
358
|
-
const {
|
|
359
|
-
data,
|
|
360
|
-
selection,
|
|
361
|
-
onSelect,
|
|
362
|
-
selectable
|
|
363
|
-
} = this.props;
|
|
364
|
-
|
|
365
|
-
if (data !== prevProps.data && !prevProps.remoteSelection) {
|
|
366
|
-
onSelect(selection.cloneWith({
|
|
367
|
-
data
|
|
368
|
-
}));
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
if (!selectable && prevProps.selectable) {
|
|
372
|
-
onSelect(selection.resetSelection());
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
render() {
|
|
377
|
-
const {
|
|
378
|
-
data,
|
|
379
|
-
className,
|
|
380
|
-
loading,
|
|
381
|
-
selection,
|
|
382
|
-
disabledHover,
|
|
383
|
-
itemFormatter,
|
|
384
|
-
focused,
|
|
385
|
-
innerRef
|
|
386
|
-
} = this.props;
|
|
387
|
-
|
|
388
|
-
const shortcutsMap = _objectSpread2(_objectSpread2({}, this.shortcutsMap), this.props.shortcutsMap);
|
|
389
|
-
|
|
390
|
-
const classes = classNames(className, {
|
|
391
|
-
[modules_09d014b4.dataList]: true,
|
|
392
|
-
[modules_09d014b4.disabledHover]: disabledHover,
|
|
393
|
-
[modules_09d014b4.multiSelection]: selection.getSelected().size > 0
|
|
394
|
-
});
|
|
395
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
396
|
-
className: modules_09d014b4.dataListWrapper,
|
|
397
|
-
"data-test": "ring-data-list",
|
|
398
|
-
ref: innerRef
|
|
399
|
-
}, focused && /*#__PURE__*/React.createElement(Shortcuts, {
|
|
400
|
-
map: shortcutsMap,
|
|
401
|
-
scope: this.shortcutsScope
|
|
402
|
-
}), /*#__PURE__*/React.createElement("ul", {
|
|
403
|
-
className: classes
|
|
404
|
-
}, data.map(model => {
|
|
405
|
-
const item = itemFormatter(model);
|
|
406
|
-
const {
|
|
407
|
-
id,
|
|
408
|
-
key,
|
|
409
|
-
title,
|
|
410
|
-
items
|
|
411
|
-
} = item;
|
|
412
|
-
const showMoreLessButton = this.props.itemMoreLessState(item);
|
|
413
|
-
return /*#__PURE__*/React.createElement(Item, {
|
|
414
|
-
key: key || id,
|
|
415
|
-
item: model,
|
|
416
|
-
title: title,
|
|
417
|
-
items: items,
|
|
418
|
-
itemFormatter: itemFormatter,
|
|
419
|
-
collapsible: item.collapsible,
|
|
420
|
-
collapsed: item.collapsed,
|
|
421
|
-
onCollapse: item.onCollapse,
|
|
422
|
-
onExpand: item.onExpand,
|
|
423
|
-
focused: selection.isFocused(model),
|
|
424
|
-
showFocus: selection.isFocused(model),
|
|
425
|
-
onFocus: this.onItemFocus,
|
|
426
|
-
selection: selection,
|
|
427
|
-
selectable: item.selectable,
|
|
428
|
-
selected: selection.isSelected(model),
|
|
429
|
-
onSelect: this.onItemSelect,
|
|
430
|
-
showMoreLessButton: showMoreLessButton,
|
|
431
|
-
onItemMoreLess: this.props.onItemMoreLess
|
|
432
|
-
});
|
|
433
|
-
})), loading && /*#__PURE__*/React.createElement("div", {
|
|
434
|
-
className: data.length > 0 ? modules_09d014b4.loadingOverlay : null
|
|
435
|
-
}, /*#__PURE__*/React.createElement(Loader, null)));
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
_defineProperty(DataList, "propTypes", {
|
|
441
|
-
className: PropTypes.string,
|
|
442
|
-
data: PropTypes.array.isRequired,
|
|
443
|
-
loading: PropTypes.bool,
|
|
444
|
-
focused: PropTypes.bool,
|
|
445
|
-
disabledHover: PropTypes.bool,
|
|
446
|
-
selection: PropTypes.object,
|
|
447
|
-
selectable: PropTypes.bool,
|
|
448
|
-
shortcutsMap: PropTypes.object,
|
|
449
|
-
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func]),
|
|
450
|
-
itemFormatter: PropTypes.func.isRequired,
|
|
451
|
-
onItemMoreLess: PropTypes.func,
|
|
452
|
-
itemMoreLessState: PropTypes.func,
|
|
453
|
-
onSelect: PropTypes.func,
|
|
454
|
-
remoteSelection: PropTypes.bool
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
_defineProperty(DataList, "defaultProps", {
|
|
458
|
-
loading: false,
|
|
459
|
-
onItemMoreLess: () => {},
|
|
460
|
-
itemMoreLessState: () => moreLessButtonStates.UNUSED,
|
|
461
|
-
remoteSelection: false
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
var dataList = disableHoverHOC(selectionShortcutsHOC(focusSensorHOC(DataList)));
|
|
465
|
-
|
|
466
|
-
export default dataList;
|