@jetbrains/ring-ui 4.2.5 → 4.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/auth/auth__core.js +5 -0
- package/components/auth/token-validator.js +4 -1
- package/components/dialog/dialog.js +4 -2
- package/components/list/list.js +20 -11
- package/components/table/row.js +12 -7
- package/components/table/table.examples.js +1 -0
- package/components/table/table.js +3 -1
- package/package.json +2 -2
|
@@ -343,6 +343,11 @@ export default class Auth {
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
async handleInitValidationError(error) {
|
|
346
|
+
if (error.cause === 'invalid_client') {
|
|
347
|
+
// eslint-disable-next-line no-console
|
|
348
|
+
console.error('RingUI Auth: invalid client detected. Logging out', error);
|
|
349
|
+
return await this.logout();
|
|
350
|
+
}
|
|
346
351
|
// Redirect flow
|
|
347
352
|
if (error.authRedirect && this.config.redirect) {
|
|
348
353
|
return this.sendRedirect(error);
|
|
@@ -147,7 +147,10 @@ export default class TokenValidator {
|
|
|
147
147
|
TokenValidator.shouldRefreshToken(response.error)
|
|
148
148
|
) {
|
|
149
149
|
// Token expired
|
|
150
|
-
throw new TokenValidator.TokenValidationError(
|
|
150
|
+
throw new TokenValidator.TokenValidationError(
|
|
151
|
+
response.error || errorResponse.message,
|
|
152
|
+
errorResponse.data?.error
|
|
153
|
+
);
|
|
151
154
|
}
|
|
152
155
|
|
|
153
156
|
// Request unexpectedly failed
|
|
@@ -34,6 +34,7 @@ export default class Dialog extends PureComponent {
|
|
|
34
34
|
show: PropTypes.bool.isRequired,
|
|
35
35
|
showCloseButton: PropTypes.bool,
|
|
36
36
|
closeButtonInside: PropTypes.bool,
|
|
37
|
+
closeButtonTitle: PropTypes.string,
|
|
37
38
|
onOverlayClick: PropTypes.func,
|
|
38
39
|
onEscPress: PropTypes.func,
|
|
39
40
|
onCloseClick: PropTypes.func,
|
|
@@ -119,7 +120,7 @@ export default class Dialog extends PureComponent {
|
|
|
119
120
|
render() {
|
|
120
121
|
const {show, showCloseButton, onOverlayClick, onCloseAttempt, onEscPress, onCloseClick,
|
|
121
122
|
children, className, contentClassName, trapFocus, 'data-test': dataTest, closeButtonInside,
|
|
122
|
-
portalTarget, label, ...restProps} = this.props;
|
|
123
|
+
portalTarget, label, closeButtonTitle, ...restProps} = this.props;
|
|
123
124
|
const classes = classNames(styles.container, className);
|
|
124
125
|
const shortcutsMap = this.getShortcutsMap();
|
|
125
126
|
|
|
@@ -166,7 +167,8 @@ export default class Dialog extends PureComponent {
|
|
|
166
167
|
})}
|
|
167
168
|
iconClassName={styles.closeIcon}
|
|
168
169
|
onClick={this.onCloseClick}
|
|
169
|
-
|
|
170
|
+
title={closeButtonTitle}
|
|
171
|
+
aria-label={closeButtonTitle || 'close dialog'}
|
|
170
172
|
/>
|
|
171
173
|
)
|
|
172
174
|
}
|
package/components/list/list.js
CHANGED
|
@@ -178,17 +178,8 @@ export default class List extends Component {
|
|
|
178
178
|
document.addEventListener('mousemove', this.onDocumentMouseMove);
|
|
179
179
|
document.addEventListener('keydown', this.onDocumentKeyDown, true);
|
|
180
180
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (activeIndex == null && shouldActivateFirstItem(this.props)) {
|
|
184
|
-
const firstActivatableIndex = data.findIndex(isActivatable);
|
|
185
|
-
if (firstActivatableIndex >= 0) {
|
|
186
|
-
this.setState({
|
|
187
|
-
activeIndex: firstActivatableIndex,
|
|
188
|
-
activeItem: data[firstActivatableIndex],
|
|
189
|
-
needScrollToActive: true
|
|
190
|
-
});
|
|
191
|
-
}
|
|
181
|
+
if (this.props.activeIndex == null && shouldActivateFirstItem(this.props)) {
|
|
182
|
+
this.activateFirst();
|
|
192
183
|
}
|
|
193
184
|
}
|
|
194
185
|
|
|
@@ -202,6 +193,13 @@ export default class List extends Component {
|
|
|
202
193
|
this.virtualizedList.recomputeRowHeights();
|
|
203
194
|
}
|
|
204
195
|
|
|
196
|
+
if (this.props.activeIndex == null &&
|
|
197
|
+
this.props.data !== prevProps.data &&
|
|
198
|
+
shouldActivateFirstItem(this.props)
|
|
199
|
+
) {
|
|
200
|
+
this.activateFirst();
|
|
201
|
+
}
|
|
202
|
+
|
|
205
203
|
this.checkOverflow();
|
|
206
204
|
}
|
|
207
205
|
|
|
@@ -277,6 +275,17 @@ export default class List extends Component {
|
|
|
277
275
|
return this._hasActivatableItems(this.props.data);
|
|
278
276
|
}
|
|
279
277
|
|
|
278
|
+
activateFirst = () => {
|
|
279
|
+
const firstActivatableIndex = this.props.data.findIndex(isActivatable);
|
|
280
|
+
if (firstActivatableIndex >= 0) {
|
|
281
|
+
this.setState({
|
|
282
|
+
activeIndex: firstActivatableIndex,
|
|
283
|
+
activeItem: this.props.data[firstActivatableIndex],
|
|
284
|
+
needScrollToActive: true
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
|
|
280
289
|
selectHandler = memoize(index => (event, tryKeepOpen = false) => {
|
|
281
290
|
const item = this.props.data[index];
|
|
282
291
|
if (!this.props.useMouseUp && item.onClick) {
|
package/components/table/row.js
CHANGED
|
@@ -16,7 +16,7 @@ import composeRefs from '../global/composeRefs';
|
|
|
16
16
|
import Cell from './cell';
|
|
17
17
|
import style from './table.css';
|
|
18
18
|
|
|
19
|
-
const DragHandle = ({alwaysShowDragHandle}) => {
|
|
19
|
+
const DragHandle = ({alwaysShowDragHandle, dragHandleTitle = 'Drag to reorder'}) => {
|
|
20
20
|
const classes = classNames(style.dragHandle, {
|
|
21
21
|
[style.visibleDragHandle]: alwaysShowDragHandle
|
|
22
22
|
});
|
|
@@ -24,14 +24,15 @@ const DragHandle = ({alwaysShowDragHandle}) => {
|
|
|
24
24
|
return (
|
|
25
25
|
<Button
|
|
26
26
|
data-movable-handle
|
|
27
|
-
title=
|
|
27
|
+
title={dragHandleTitle}
|
|
28
28
|
className={classes}
|
|
29
29
|
icon={dragIcon}
|
|
30
30
|
/>
|
|
31
31
|
);
|
|
32
32
|
};
|
|
33
33
|
DragHandle.propTypes = {
|
|
34
|
-
alwaysShowDragHandle: PropTypes.bool
|
|
34
|
+
alwaysShowDragHandle: PropTypes.bool,
|
|
35
|
+
dragHandleTitle: PropTypes.string
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
export default class Row extends PureComponent {
|
|
@@ -43,6 +44,7 @@ export default class Row extends PureComponent {
|
|
|
43
44
|
showFocus: PropTypes.bool,
|
|
44
45
|
draggable: PropTypes.bool,
|
|
45
46
|
alwaysShowDragHandle: PropTypes.bool,
|
|
47
|
+
dragHandleTitle: PropTypes.string,
|
|
46
48
|
selected: PropTypes.bool,
|
|
47
49
|
onHover: PropTypes.func,
|
|
48
50
|
onSelect: PropTypes.func,
|
|
@@ -127,7 +129,7 @@ export default class Row extends PureComponent {
|
|
|
127
129
|
render() {
|
|
128
130
|
const {
|
|
129
131
|
item, columns, selectable, selected,
|
|
130
|
-
showFocus, draggable, alwaysShowDragHandle, level,
|
|
132
|
+
showFocus, draggable, alwaysShowDragHandle, dragHandleTitle, level,
|
|
131
133
|
collapsible, parentCollapsible, collapsed,
|
|
132
134
|
onCollapse, onExpand, showDisabledSelection,
|
|
133
135
|
checkboxTooltip, innerRef, focused, autofocus, onFocusReset,
|
|
@@ -156,9 +158,12 @@ export default class Row extends PureComponent {
|
|
|
156
158
|
|
|
157
159
|
const metaColumn = (
|
|
158
160
|
<div className={metaColumnClasses} style={metaColumnStyle}>
|
|
159
|
-
{draggable &&
|
|
160
|
-
<DragHandle
|
|
161
|
-
|
|
161
|
+
{draggable && (
|
|
162
|
+
<DragHandle
|
|
163
|
+
alwaysShowDragHandle={alwaysShowDragHandle}
|
|
164
|
+
dragHandleTitle={dragHandleTitle}
|
|
165
|
+
/>
|
|
166
|
+
)}
|
|
162
167
|
|
|
163
168
|
{selectable &&
|
|
164
169
|
(
|
|
@@ -42,6 +42,7 @@ export class Table extends PureComponent {
|
|
|
42
42
|
sortOrder: PropTypes.bool,
|
|
43
43
|
draggable: PropTypes.bool,
|
|
44
44
|
alwaysShowDragHandle: PropTypes.bool,
|
|
45
|
+
dragHandleTitle: PropTypes.string,
|
|
45
46
|
getItemLevel: PropTypes.func,
|
|
46
47
|
isItemCollapsible: PropTypes.func,
|
|
47
48
|
isParentCollapsible: PropTypes.func,
|
|
@@ -175,7 +176,7 @@ export class Table extends PureComponent {
|
|
|
175
176
|
const {
|
|
176
177
|
data, selection, columns, caption, getItemKey, selectable, focused,
|
|
177
178
|
isItemSelectable, getItemLevel, getItemClassName, getItemDataTest,
|
|
178
|
-
draggable, alwaysShowDragHandle,
|
|
179
|
+
draggable, alwaysShowDragHandle, dragHandleTitle,
|
|
179
180
|
loading, onSort, sortKey, sortOrder, loaderClassName, stickyHeader,
|
|
180
181
|
stickyHeaderOffset, isItemCollapsible, isParentCollapsible, isItemCollapsed,
|
|
181
182
|
onItemCollapse, onItemExpand, isDisabledSelectionVisible, getCheckboxTooltip,
|
|
@@ -262,6 +263,7 @@ export class Table extends PureComponent {
|
|
|
262
263
|
className={classNames(getItemClassName(value), {[style.draggingRow]: isDragged})}
|
|
263
264
|
draggable={draggable}
|
|
264
265
|
alwaysShowDragHandle={alwaysShowDragHandle}
|
|
266
|
+
dragHandleTitle={dragHandleTitle}
|
|
265
267
|
columns={columns}
|
|
266
268
|
data-test={getItemDataTest(value)}
|
|
267
269
|
{...restProps}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetbrains/ring-ui",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.8",
|
|
4
4
|
"description": "JetBrains UI library",
|
|
5
5
|
"author": "JetBrains",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -221,5 +221,5 @@
|
|
|
221
221
|
"node": ">=7.4",
|
|
222
222
|
"npm": ">=6.0.0"
|
|
223
223
|
},
|
|
224
|
-
"gitHead": "
|
|
224
|
+
"gitHead": "de28120e16fa8f1f9d011af5e7e2e4930a2c3fc4"
|
|
225
225
|
}
|