@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/header.js
DELETED
|
@@ -1,658 +0,0 @@
|
|
|
1
|
-
import { _ as _objectWithoutProperties, a as _extends, b as _defineProperty, c as _objectSpread2 } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { Component, Children, PureComponent } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { w as withTheme, T as Theme } from './_helpers/theme.js';
|
|
6
|
-
import { m as modules_47759f5e } from './_helpers/logo.js';
|
|
7
|
-
export { L as Logo } from './_helpers/logo.js';
|
|
8
|
-
import { B as Button } from './_helpers/button.js';
|
|
9
|
-
import Avatar, { Size } from './avatar.js';
|
|
10
|
-
import Dropdown from './dropdown.js';
|
|
11
|
-
import PopupMenu from './popup-menu.js';
|
|
12
|
-
import Auth, { USER_CHANGED_EVENT, LOGOUT_POSTPONED_EVENT, USER_CHANGE_POSTPONED_EVENT } from './auth.js';
|
|
13
|
-
import alertService from './alert-service.js';
|
|
14
|
-
import servicesIcon from '@jetbrains/icons/services-20px';
|
|
15
|
-
import { P as Popup } from './_helpers/popup.js';
|
|
16
|
-
import Link from './link.js';
|
|
17
|
-
import HTTP from './http.js';
|
|
18
|
-
import './icon.js';
|
|
19
|
-
import 'util-deprecate';
|
|
20
|
-
import './_helpers/memoize.js';
|
|
21
|
-
import 'focus-visible';
|
|
22
|
-
import '@jetbrains/icons/chevron-10px';
|
|
23
|
-
import './_helpers/clickableLink.js';
|
|
24
|
-
import './_helpers/url.js';
|
|
25
|
-
import './_helpers/dom.js';
|
|
26
|
-
import './_helpers/data-tests.js';
|
|
27
|
-
import './_helpers/list.js';
|
|
28
|
-
import 'react-virtualized/dist/es/List';
|
|
29
|
-
import 'react-virtualized/dist/es/AutoSizer';
|
|
30
|
-
import 'react-virtualized/dist/es/WindowScroller';
|
|
31
|
-
import 'react-virtualized/dist/es/CellMeasurer';
|
|
32
|
-
import 'memoize-one';
|
|
33
|
-
import './_helpers/get-uid.js';
|
|
34
|
-
import './_helpers/schedule-raf.js';
|
|
35
|
-
import './shortcuts.js';
|
|
36
|
-
import 'combokeys';
|
|
37
|
-
import './_helpers/sniffer.js';
|
|
38
|
-
import 'sniffr';
|
|
39
|
-
import './checkbox.js';
|
|
40
|
-
import '@jetbrains/icons/checkmark';
|
|
41
|
-
import '@jetbrains/icons/remove-10px';
|
|
42
|
-
import './_helpers/background-flow.js';
|
|
43
|
-
import 'es6-error';
|
|
44
|
-
import './alert.js';
|
|
45
|
-
import '@jetbrains/icons/exception';
|
|
46
|
-
import '@jetbrains/icons/warning';
|
|
47
|
-
import '@jetbrains/icons/close';
|
|
48
|
-
import './loader-inline.js';
|
|
49
|
-
import 'conic-gradient';
|
|
50
|
-
import 'react-dom';
|
|
51
|
-
import './group.js';
|
|
52
|
-
import './storage.js';
|
|
53
|
-
import 'deep-equal';
|
|
54
|
-
import 'simply-uuid';
|
|
55
|
-
import './tab-trap.js';
|
|
56
|
-
import './_helpers/popup.target.js';
|
|
57
|
-
|
|
58
|
-
const compose = (...funcs) => funcs.reduce((acc, func) => arg => acc(func(arg)), arg => arg);
|
|
59
|
-
|
|
60
|
-
const wrapChild = child => child && /*#__PURE__*/React.createElement("div", {
|
|
61
|
-
className: modules_47759f5e.trayItem
|
|
62
|
-
}, child);
|
|
63
|
-
|
|
64
|
-
class Tray extends Component {
|
|
65
|
-
render() {
|
|
66
|
-
const _this$props = this.props,
|
|
67
|
-
{
|
|
68
|
-
children,
|
|
69
|
-
className
|
|
70
|
-
} = _this$props,
|
|
71
|
-
restProps = _objectWithoutProperties(_this$props, ["children", "className"]);
|
|
72
|
-
|
|
73
|
-
const classes = classNames(modules_47759f5e.tray, className);
|
|
74
|
-
return /*#__PURE__*/React.createElement("div", _extends({}, restProps, {
|
|
75
|
-
className: classes
|
|
76
|
-
}), Children.map(children, wrapChild));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
_defineProperty(Tray, "propTypes", {
|
|
82
|
-
className: PropTypes.string,
|
|
83
|
-
children: PropTypes.node
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
class TrayIcon extends Component {
|
|
87
|
-
render() {
|
|
88
|
-
const _this$props = this.props,
|
|
89
|
-
{
|
|
90
|
-
className,
|
|
91
|
-
rotatable: rotatable
|
|
92
|
-
} = _this$props,
|
|
93
|
-
restProps = _objectWithoutProperties(_this$props, ["className", "rotatable"]);
|
|
94
|
-
|
|
95
|
-
const classes = classNames(modules_47759f5e.icon, className, {
|
|
96
|
-
[modules_47759f5e.rotatable]: rotatable,
|
|
97
|
-
[modules_47759f5e.rotated]: rotatable && restProps.active
|
|
98
|
-
});
|
|
99
|
-
return /*#__PURE__*/React.createElement(Button, _extends({}, restProps, {
|
|
100
|
-
className: classes
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
_defineProperty(TrayIcon, "propTypes", _objectSpread2(_objectSpread2({}, Button.propTypes), {}, {
|
|
107
|
-
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]).isRequired,
|
|
108
|
-
rotatable: PropTypes.bool
|
|
109
|
-
}));
|
|
110
|
-
|
|
111
|
-
_defineProperty(TrayIcon, "defaultProps", _objectSpread2({}, Button.defaultProps));
|
|
112
|
-
|
|
113
|
-
const rgItemType = PopupMenu.ListProps.Type.LINK;
|
|
114
|
-
class Profile extends PureComponent {
|
|
115
|
-
render() {
|
|
116
|
-
const _this$props = this.props,
|
|
117
|
-
{
|
|
118
|
-
className,
|
|
119
|
-
closeOnSelect,
|
|
120
|
-
hasUpdates,
|
|
121
|
-
onLogout,
|
|
122
|
-
user,
|
|
123
|
-
profileUrl,
|
|
124
|
-
LinkComponent,
|
|
125
|
-
onSwitchUser,
|
|
126
|
-
renderPopupItems,
|
|
127
|
-
onRevertPostponement,
|
|
128
|
-
showApplyChangedUser,
|
|
129
|
-
showLogIn,
|
|
130
|
-
showLogOut,
|
|
131
|
-
showSwitchUser,
|
|
132
|
-
renderGuest,
|
|
133
|
-
translations,
|
|
134
|
-
size,
|
|
135
|
-
round,
|
|
136
|
-
loading,
|
|
137
|
-
onLogin
|
|
138
|
-
} = _this$props,
|
|
139
|
-
props = _objectWithoutProperties(_this$props, ["className", "closeOnSelect", "hasUpdates", "onLogout", "user", "profileUrl", "LinkComponent", "onSwitchUser", "renderPopupItems", "onRevertPostponement", "showApplyChangedUser", "showLogIn", "showLogOut", "showSwitchUser", "renderGuest", "translations", "size", "round", "loading", "onLogin"]);
|
|
140
|
-
|
|
141
|
-
if (!user) {
|
|
142
|
-
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
143
|
-
className: classNames(modules_47759f5e.profileEmpty, className)
|
|
144
|
-
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
145
|
-
size: size,
|
|
146
|
-
round: round
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (user.guest) {
|
|
151
|
-
return renderGuest(this.props);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const anchorClassName = classNames(modules_47759f5e.avatarWrapper, {
|
|
155
|
-
[modules_47759f5e.hasUpdates]: hasUpdates
|
|
156
|
-
});
|
|
157
|
-
const anchor = /*#__PURE__*/React.createElement("button", {
|
|
158
|
-
type: "button",
|
|
159
|
-
className: anchorClassName
|
|
160
|
-
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
161
|
-
url: user.profile && user.profile.avatar && user.profile.avatar.url,
|
|
162
|
-
size: size,
|
|
163
|
-
round: round
|
|
164
|
-
}));
|
|
165
|
-
const items = [showApplyChangedUser && {
|
|
166
|
-
rgItemType,
|
|
167
|
-
label: translations.applyChangedUser || 'Apply changed user',
|
|
168
|
-
className: modules_47759f5e.profileMenuItem,
|
|
169
|
-
onClick: onRevertPostponement
|
|
170
|
-
}, showLogIn && {
|
|
171
|
-
rgItemType,
|
|
172
|
-
label: translations.login || 'Log in',
|
|
173
|
-
className: modules_47759f5e.profileMenuItem,
|
|
174
|
-
onClick: onRevertPostponement
|
|
175
|
-
}, {
|
|
176
|
-
rgItemType: PopupMenu.ListProps.Type.LINK,
|
|
177
|
-
label: translations.profile || 'Profile',
|
|
178
|
-
target: '_self',
|
|
179
|
-
// Full page reload in Angular
|
|
180
|
-
href: profileUrl,
|
|
181
|
-
LinkComponent
|
|
182
|
-
}, showSwitchUser && {
|
|
183
|
-
rgItemType,
|
|
184
|
-
label: translations.switchUser || 'Switch user',
|
|
185
|
-
className: modules_47759f5e.profileMenuItem,
|
|
186
|
-
onClick: onSwitchUser
|
|
187
|
-
}, showLogOut && {
|
|
188
|
-
rgItemType,
|
|
189
|
-
label: translations.logout || 'Log out',
|
|
190
|
-
onClick: onLogout
|
|
191
|
-
}].filter(it => !!it);
|
|
192
|
-
return /*#__PURE__*/React.createElement(Dropdown, _extends({}, props, {
|
|
193
|
-
title: user.name,
|
|
194
|
-
anchor: anchor,
|
|
195
|
-
"data-test": "ring-profile",
|
|
196
|
-
className: classNames(modules_47759f5e.profile, className)
|
|
197
|
-
}), /*#__PURE__*/React.createElement(PopupMenu, {
|
|
198
|
-
closeOnSelect: closeOnSelect,
|
|
199
|
-
data: renderPopupItems(items),
|
|
200
|
-
left: -2,
|
|
201
|
-
top: -8,
|
|
202
|
-
sidePadding: 32
|
|
203
|
-
}));
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
_defineProperty(Profile, "propTypes", {
|
|
209
|
-
className: PropTypes.string,
|
|
210
|
-
closeOnSelect: PropTypes.bool,
|
|
211
|
-
hasUpdates: PropTypes.bool,
|
|
212
|
-
loading: PropTypes.bool,
|
|
213
|
-
onLogin: PropTypes.func,
|
|
214
|
-
onLogout: PropTypes.func,
|
|
215
|
-
onSwitchUser: PropTypes.func,
|
|
216
|
-
profileUrl: PropTypes.string,
|
|
217
|
-
renderPopupItems: PropTypes.func,
|
|
218
|
-
LinkComponent: PropTypes.oneOfType([PropTypes.instanceOf(Component), PropTypes.func, PropTypes.string]),
|
|
219
|
-
translations: PropTypes.shape({
|
|
220
|
-
profile: PropTypes.string,
|
|
221
|
-
login: PropTypes.string,
|
|
222
|
-
logout: PropTypes.string,
|
|
223
|
-
applyChangedUser: PropTypes.string,
|
|
224
|
-
switchUser: PropTypes.string
|
|
225
|
-
}),
|
|
226
|
-
user: PropTypes.shape({
|
|
227
|
-
guest: PropTypes.bool,
|
|
228
|
-
profile: PropTypes.object,
|
|
229
|
-
name: PropTypes.string
|
|
230
|
-
}),
|
|
231
|
-
size: PropTypes.number,
|
|
232
|
-
round: PropTypes.bool,
|
|
233
|
-
showLogIn: PropTypes.bool,
|
|
234
|
-
showLogOut: PropTypes.bool,
|
|
235
|
-
showSwitchUser: PropTypes.bool,
|
|
236
|
-
showApplyChangedUser: PropTypes.bool,
|
|
237
|
-
onRevertPostponement: PropTypes.func,
|
|
238
|
-
renderGuest: PropTypes.func
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
_defineProperty(Profile, "defaultProps", {
|
|
242
|
-
closeOnSelect: true,
|
|
243
|
-
renderPopupItems: items => items,
|
|
244
|
-
translations: {},
|
|
245
|
-
size: Size.Size32,
|
|
246
|
-
renderGuest: ({
|
|
247
|
-
loading,
|
|
248
|
-
onLogin,
|
|
249
|
-
className,
|
|
250
|
-
translations
|
|
251
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
252
|
-
className: classNames(modules_47759f5e.profileEmpty, className)
|
|
253
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
254
|
-
primary: true,
|
|
255
|
-
"data-test": "ring-header-login-button",
|
|
256
|
-
disabled: loading,
|
|
257
|
-
loader: loading,
|
|
258
|
-
onClick: onLogin
|
|
259
|
-
}, translations.login || 'Log in...'))
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
_defineProperty(Profile, "Size", Size);
|
|
263
|
-
|
|
264
|
-
const CERTIFICATE_MISMATCH_HEADER = 'x-client-certificate-token-mismatch';
|
|
265
|
-
class SmartProfile extends PureComponent {
|
|
266
|
-
constructor(...args) {
|
|
267
|
-
super(...args);
|
|
268
|
-
|
|
269
|
-
_defineProperty(this, "state", {
|
|
270
|
-
user: null,
|
|
271
|
-
size: Profile.defaultProps.size,
|
|
272
|
-
isLogoutPostponed: false,
|
|
273
|
-
isUserChangePostponed: false
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
_defineProperty(this, "login", async () => {
|
|
277
|
-
this.setState({
|
|
278
|
-
loading: true
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
try {
|
|
282
|
-
await this.props.auth.login();
|
|
283
|
-
} catch (err) {// do nothing
|
|
284
|
-
} finally {
|
|
285
|
-
this.setState({
|
|
286
|
-
loading: false
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
_defineProperty(this, "logout", () => this.props.auth.logout());
|
|
292
|
-
|
|
293
|
-
_defineProperty(this, "switchUser", () => this.props.auth.switchUser());
|
|
294
|
-
|
|
295
|
-
_defineProperty(this, "onRevertPostponement", () => {
|
|
296
|
-
if (this.state.isLogoutPostponed) {
|
|
297
|
-
this.props.auth.login();
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
if (this.state.isUserChangePostponed) {
|
|
301
|
-
this.props.auth.updateUser();
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
componentDidMount() {
|
|
307
|
-
this.requestUser();
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
async requestUser() {
|
|
311
|
-
try {
|
|
312
|
-
const {
|
|
313
|
-
auth
|
|
314
|
-
} = this.props;
|
|
315
|
-
const user = await auth.requestUser();
|
|
316
|
-
this.checkUserCertificateMismatch(user);
|
|
317
|
-
this.setState({
|
|
318
|
-
user
|
|
319
|
-
});
|
|
320
|
-
auth.addListener(USER_CHANGED_EVENT, newUser => {
|
|
321
|
-
this.setState({
|
|
322
|
-
user: newUser,
|
|
323
|
-
isLogoutPostponed: false,
|
|
324
|
-
isUserChangePostponed: false
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
auth.addListener(LOGOUT_POSTPONED_EVENT, () => {
|
|
328
|
-
this.setState({
|
|
329
|
-
isLogoutPostponed: true
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
auth.addListener(USER_CHANGE_POSTPONED_EVENT, () => {
|
|
333
|
-
this.setState({
|
|
334
|
-
isUserChangePostponed: true
|
|
335
|
-
});
|
|
336
|
-
});
|
|
337
|
-
} catch (e) {// noop
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
checkUserCertificateMismatch(user) {
|
|
342
|
-
var _userMeta$headers;
|
|
343
|
-
|
|
344
|
-
const {
|
|
345
|
-
auth,
|
|
346
|
-
translations
|
|
347
|
-
} = this.props;
|
|
348
|
-
const userMeta = auth.http.getMetaForResponse(user);
|
|
349
|
-
|
|
350
|
-
if (userMeta !== null && userMeta !== void 0 && (_userMeta$headers = userMeta.headers) !== null && _userMeta$headers !== void 0 && _userMeta$headers.has(CERTIFICATE_MISMATCH_HEADER)) {
|
|
351
|
-
const message = (translations === null || translations === void 0 ? void 0 : translations.certificateMismatch) || `You are authenticated as ${user.login || user.name}. To authenticate with the client certificate for your account, log out, then click the "Log in with certificate" option on the login page.`;
|
|
352
|
-
alertService.warning(message, 0);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
render() {
|
|
357
|
-
const {
|
|
358
|
-
user,
|
|
359
|
-
loading,
|
|
360
|
-
isLogoutPostponed,
|
|
361
|
-
isUserChangePostponed
|
|
362
|
-
} = this.state;
|
|
363
|
-
|
|
364
|
-
const _this$props = this.props,
|
|
365
|
-
{
|
|
366
|
-
auth,
|
|
367
|
-
profileUrl
|
|
368
|
-
} = _this$props,
|
|
369
|
-
props = _objectWithoutProperties(_this$props, ["auth", "profileUrl"]);
|
|
370
|
-
|
|
371
|
-
const url = profileUrl || (user ? `${auth.config.serverUri}users/${user.id}` : '');
|
|
372
|
-
return /*#__PURE__*/React.createElement(Profile, _extends({
|
|
373
|
-
onLogin: this.login,
|
|
374
|
-
onLogout: this.logout,
|
|
375
|
-
onSwitchUser: this.switchUser,
|
|
376
|
-
loading: loading,
|
|
377
|
-
user: user,
|
|
378
|
-
profileUrl: url,
|
|
379
|
-
showApplyChangedUser: isUserChangePostponed,
|
|
380
|
-
showLogIn: isLogoutPostponed,
|
|
381
|
-
showLogOut: !isLogoutPostponed,
|
|
382
|
-
showSwitchUser: auth._canShowDialogs() && !isLogoutPostponed && !isUserChangePostponed,
|
|
383
|
-
onRevertPostponement: this.onRevertPostponement
|
|
384
|
-
}, props));
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
_defineProperty(SmartProfile, "propTypes", {
|
|
390
|
-
auth: PropTypes.instanceOf(Auth).isRequired,
|
|
391
|
-
className: PropTypes.string,
|
|
392
|
-
translations: PropTypes.object,
|
|
393
|
-
profileUrl: PropTypes.string,
|
|
394
|
-
size: Profile.propTypes.size,
|
|
395
|
-
round: Profile.propTypes.round
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
_defineProperty(SmartProfile, "Size", Profile.Size);
|
|
399
|
-
|
|
400
|
-
var modules_74a7bf8b = {"unit":"8px","services":"services_services__58797e59","active":"services_active__58797e59","item":"services_item__58797e59","itemLogo":"services_itemLogo__58797e59","activeItem":"services_activeItem__58797e59 services_item__58797e59 services_active__58797e59","line":"services_line__58797e59","itemStacked":"services_itemStacked__58797e59","activeItemStacked":"services_activeItemStacked__58797e59 services_itemStacked__58797e59 services_active__58797e59"};
|
|
401
|
-
|
|
402
|
-
class ServicesLink extends PureComponent {
|
|
403
|
-
render() {
|
|
404
|
-
const _this$props = this.props,
|
|
405
|
-
{
|
|
406
|
-
service
|
|
407
|
-
} = _this$props,
|
|
408
|
-
props = _objectWithoutProperties(_this$props, ["service"]);
|
|
409
|
-
|
|
410
|
-
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
411
|
-
target: "_self",
|
|
412
|
-
href: service.homeUrl
|
|
413
|
-
}, props), WrapText => service.iconUrl ? [/*#__PURE__*/React.createElement("span", {
|
|
414
|
-
key: "icon",
|
|
415
|
-
className: modules_74a7bf8b.itemLogo,
|
|
416
|
-
style: {
|
|
417
|
-
backgroundImage: `url(${service.iconUrl})`
|
|
418
|
-
}
|
|
419
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
420
|
-
key: "text"
|
|
421
|
-
}, /*#__PURE__*/React.createElement(WrapText, null, service.name))] : /*#__PURE__*/React.createElement(WrapText, null, service.name));
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
_defineProperty(ServicesLink, "propTypes", {
|
|
427
|
-
isActive: PropTypes.bool,
|
|
428
|
-
service: PropTypes.shape({
|
|
429
|
-
applicationName: PropTypes.string,
|
|
430
|
-
iconUrl: PropTypes.string,
|
|
431
|
-
homeUrl: PropTypes.string,
|
|
432
|
-
name: PropTypes.string
|
|
433
|
-
})
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
const makeAnchor = loading => {
|
|
437
|
-
const Anchor = ({
|
|
438
|
-
active
|
|
439
|
-
}) => /*#__PURE__*/React.createElement(TrayIcon, {
|
|
440
|
-
loader: loading,
|
|
441
|
-
active: active,
|
|
442
|
-
icon: servicesIcon,
|
|
443
|
-
"aria-label": "Services"
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
Anchor.propTypes = {
|
|
447
|
-
active: PropTypes.bool
|
|
448
|
-
};
|
|
449
|
-
return Anchor;
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
class Services extends PureComponent {
|
|
453
|
-
constructor(...args) {
|
|
454
|
-
super(...args);
|
|
455
|
-
|
|
456
|
-
_defineProperty(this, "serviceIsActive", service => service.id === this.props.clientId);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
render() {
|
|
460
|
-
const _this$props = this.props,
|
|
461
|
-
{
|
|
462
|
-
clientId,
|
|
463
|
-
loading,
|
|
464
|
-
services,
|
|
465
|
-
initShown
|
|
466
|
-
} = _this$props,
|
|
467
|
-
props = _objectWithoutProperties(_this$props, ["clientId", "loading", "services", "initShown"]);
|
|
468
|
-
|
|
469
|
-
if (!services) {
|
|
470
|
-
return /*#__PURE__*/React.createElement(TrayIcon, _extends({}, props, {
|
|
471
|
-
loader: loading,
|
|
472
|
-
active: loading,
|
|
473
|
-
icon: servicesIcon,
|
|
474
|
-
"aria-label": "Services"
|
|
475
|
-
}));
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
const sortedServices = [...services].sort(Services.sort);
|
|
479
|
-
const servicesWithIcons = sortedServices.filter(service => service.iconUrl);
|
|
480
|
-
const servicesWithOutIcons = sortedServices.filter(service => !service.iconUrl);
|
|
481
|
-
const separatorIsRequired = servicesWithIcons.length !== 0 && servicesWithOutIcons.length !== 0;
|
|
482
|
-
return /*#__PURE__*/React.createElement(Dropdown, _extends({}, props, {
|
|
483
|
-
anchor: makeAnchor(loading),
|
|
484
|
-
initShown: initShown
|
|
485
|
-
}), /*#__PURE__*/React.createElement(Popup, {
|
|
486
|
-
className: modules_74a7bf8b.services,
|
|
487
|
-
top: -3
|
|
488
|
-
}, servicesWithIcons.map(service => {
|
|
489
|
-
const isActive = this.serviceIsActive(service);
|
|
490
|
-
return /*#__PURE__*/React.createElement(Services.Link, {
|
|
491
|
-
active: isActive,
|
|
492
|
-
className: isActive ? modules_74a7bf8b.activeItem : modules_74a7bf8b.item,
|
|
493
|
-
key: service.id,
|
|
494
|
-
service: service
|
|
495
|
-
});
|
|
496
|
-
}), separatorIsRequired && /*#__PURE__*/React.createElement("div", {
|
|
497
|
-
className: modules_74a7bf8b.line,
|
|
498
|
-
key: "separator"
|
|
499
|
-
}), servicesWithOutIcons.map(service => {
|
|
500
|
-
const isActive = this.serviceIsActive(service);
|
|
501
|
-
return /*#__PURE__*/React.createElement(Services.Link, {
|
|
502
|
-
active: isActive,
|
|
503
|
-
className: isActive ? modules_74a7bf8b.activeItemStacked : modules_74a7bf8b.itemStacked,
|
|
504
|
-
key: service.id,
|
|
505
|
-
service: service
|
|
506
|
-
});
|
|
507
|
-
})));
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
_defineProperty(Services, "sort", (a, b) => {
|
|
513
|
-
const aApplicationName = a.applicationName || '';
|
|
514
|
-
const bApplicationName = b.applicationName || '';
|
|
515
|
-
return aApplicationName.localeCompare(bApplicationName) || a.name.localeCompare(b.name);
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
_defineProperty(Services, "propTypes", {
|
|
519
|
-
className: PropTypes.string,
|
|
520
|
-
clientId: PropTypes.string,
|
|
521
|
-
initShown: PropTypes.bool,
|
|
522
|
-
loading: PropTypes.bool,
|
|
523
|
-
onClick: PropTypes.func,
|
|
524
|
-
services: PropTypes.arrayOf(ServicesLink.propTypes.service)
|
|
525
|
-
});
|
|
526
|
-
|
|
527
|
-
_defineProperty(Services, "Link", ServicesLink);
|
|
528
|
-
|
|
529
|
-
function noop() {}
|
|
530
|
-
|
|
531
|
-
class SmartServices extends Component {
|
|
532
|
-
constructor(...args) {
|
|
533
|
-
super(...args);
|
|
534
|
-
|
|
535
|
-
_defineProperty(this, "state", {
|
|
536
|
-
visible: true,
|
|
537
|
-
loading: false,
|
|
538
|
-
services: null
|
|
539
|
-
});
|
|
540
|
-
|
|
541
|
-
_defineProperty(this, "stopLoading", () => {
|
|
542
|
-
this.setState({
|
|
543
|
-
loading: false
|
|
544
|
-
});
|
|
545
|
-
});
|
|
546
|
-
|
|
547
|
-
_defineProperty(this, "getServicesContent", () => {
|
|
548
|
-
this.setState({
|
|
549
|
-
loading: true
|
|
550
|
-
});
|
|
551
|
-
this.getServices(SmartServices.allFields).then(services => {
|
|
552
|
-
this.setState({
|
|
553
|
-
services
|
|
554
|
-
});
|
|
555
|
-
this.stopLoading();
|
|
556
|
-
}).catch(this.stopLoading);
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
componentDidMount() {
|
|
561
|
-
const {
|
|
562
|
-
auth
|
|
563
|
-
} = this.props;
|
|
564
|
-
this.http = new HTTP(auth, auth.getAPIPath());
|
|
565
|
-
this.getServices(SmartServices.countFields).then(services => {
|
|
566
|
-
if (!services.length) {
|
|
567
|
-
this.setState({
|
|
568
|
-
visible: false
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
}).catch(noop);
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
getServices(fields) {
|
|
575
|
-
return this.http.get(`services/header?fields=${fields}`);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
render() {
|
|
579
|
-
const {
|
|
580
|
-
services,
|
|
581
|
-
visible,
|
|
582
|
-
loading
|
|
583
|
-
} = this.state;
|
|
584
|
-
|
|
585
|
-
const _this$props = this.props,
|
|
586
|
-
{
|
|
587
|
-
auth
|
|
588
|
-
} = _this$props,
|
|
589
|
-
props = _objectWithoutProperties(_this$props, ["auth"]);
|
|
590
|
-
|
|
591
|
-
if (!visible) {
|
|
592
|
-
return null;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
return /*#__PURE__*/React.createElement(Services, _extends({}, props, {
|
|
596
|
-
clientId: auth.config.clientId,
|
|
597
|
-
initShown: true,
|
|
598
|
-
loading: loading,
|
|
599
|
-
onClick: this.getServicesContent,
|
|
600
|
-
services: services
|
|
601
|
-
}));
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
_defineProperty(SmartServices, "propTypes", {
|
|
607
|
-
auth: PropTypes.instanceOf(Auth).isRequired
|
|
608
|
-
});
|
|
609
|
-
|
|
610
|
-
_defineProperty(SmartServices, "allFields", 'id,name,applicationName,homeUrl,iconUrl');
|
|
611
|
-
|
|
612
|
-
_defineProperty(SmartServices, "countFields", 'key');
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* @name Header
|
|
616
|
-
*/
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* Displays a configurable page header. See available presentation options in the knobs panel.
|
|
620
|
-
*/
|
|
621
|
-
|
|
622
|
-
class Header extends Component {
|
|
623
|
-
render() {
|
|
624
|
-
const _this$props = this.props,
|
|
625
|
-
{
|
|
626
|
-
children,
|
|
627
|
-
className,
|
|
628
|
-
spaced,
|
|
629
|
-
theme
|
|
630
|
-
} = _this$props,
|
|
631
|
-
restProps = _objectWithoutProperties(_this$props, ["children", "className", "spaced", "theme"]);
|
|
632
|
-
|
|
633
|
-
const classes = classNames(modules_47759f5e.header, modules_47759f5e[theme], className, {
|
|
634
|
-
[modules_47759f5e.headerSpaced]: spaced
|
|
635
|
-
});
|
|
636
|
-
return /*#__PURE__*/React.createElement("header", _extends({}, restProps, {
|
|
637
|
-
className: classes
|
|
638
|
-
}), children);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
_defineProperty(Header, "propTypes", {
|
|
644
|
-
theme: PropTypes.oneOf(['light', 'dark']),
|
|
645
|
-
className: PropTypes.string,
|
|
646
|
-
children: PropTypes.node,
|
|
647
|
-
spaced: PropTypes.bool
|
|
648
|
-
});
|
|
649
|
-
|
|
650
|
-
_defineProperty(Header, "defaultProps", {
|
|
651
|
-
spaced: true
|
|
652
|
-
});
|
|
653
|
-
|
|
654
|
-
var header = withTheme(Theme.DARK)(Header);
|
|
655
|
-
const RerenderableHeader = compose(withTheme(Theme.DARK))(Header);
|
|
656
|
-
|
|
657
|
-
export default header;
|
|
658
|
-
export { Profile, RerenderableHeader, Services, SmartProfile, SmartServices, Tray, TrayIcon };
|