@jetbrains/ring-ui 4.2.6 → 4.2.9
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/pager/pager.js +14 -14
- 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
|
}
|
|
@@ -69,7 +69,7 @@ export default class Pager extends PureComponent {
|
|
|
69
69
|
return {selected, data};
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
getPagesAmount() {
|
|
73
73
|
const {total, pageSize} = this.props;
|
|
74
74
|
return Math.ceil(total / pageSize);
|
|
75
75
|
}
|
|
@@ -89,7 +89,7 @@ export default class Pager extends PureComponent {
|
|
|
89
89
|
handleNextClick = () => {
|
|
90
90
|
const {currentPage, onLoadPage} = this.props;
|
|
91
91
|
const nextPage = currentPage + 1;
|
|
92
|
-
const total = this.
|
|
92
|
+
const total = this.getPagesAmount();
|
|
93
93
|
if (currentPage !== total) {
|
|
94
94
|
this.props.onPageChange(nextPage);
|
|
95
95
|
} else if (this.props.openTotal) {
|
|
@@ -154,7 +154,8 @@ export default class Pager extends PureComponent {
|
|
|
154
154
|
|
|
155
155
|
const prevLinkAvailable = this.props.currentPage !== 1;
|
|
156
156
|
|
|
157
|
-
const nextLinkAvailable = this.props.openTotal ||
|
|
157
|
+
const nextLinkAvailable = this.props.openTotal ||
|
|
158
|
+
this.props.currentPage !== this.getPagesAmount();
|
|
158
159
|
|
|
159
160
|
const nextIcon = (
|
|
160
161
|
<Icon glyph={chevronRightIcon} key="icon"/>
|
|
@@ -232,17 +233,16 @@ export default class Pager extends PureComponent {
|
|
|
232
233
|
|
|
233
234
|
getPagerContent() {
|
|
234
235
|
const {currentPage, visiblePagesLimit} = this.props;
|
|
235
|
-
const
|
|
236
|
+
const pagesAmount = this.getPagesAmount();
|
|
236
237
|
|
|
237
|
-
if (
|
|
238
|
+
if (pagesAmount < 2 && !this.props.openTotal) {
|
|
238
239
|
return null;
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
let start = 1;
|
|
242
|
-
let end =
|
|
243
|
+
let end = pagesAmount;
|
|
243
244
|
|
|
244
|
-
|
|
245
|
-
if (totalPages >= visiblePagesLimit + 6) {
|
|
245
|
+
if (pagesAmount >= visiblePagesLimit) {
|
|
246
246
|
const leftHalfFrameSize = Math.ceil(visiblePagesLimit / 2) - 1;
|
|
247
247
|
const rightHalfFrameSize = visiblePagesLimit - leftHalfFrameSize - 1;
|
|
248
248
|
|
|
@@ -255,8 +255,8 @@ export default class Pager extends PureComponent {
|
|
|
255
255
|
end += tail;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
if (end >
|
|
259
|
-
const tail = end -
|
|
258
|
+
if (end > pagesAmount) {
|
|
259
|
+
const tail = end - pagesAmount;
|
|
260
260
|
start -= tail;
|
|
261
261
|
end -= tail;
|
|
262
262
|
}
|
|
@@ -271,7 +271,7 @@ export default class Pager extends PureComponent {
|
|
|
271
271
|
buttons.push(this.getButton(i, i, i, i === currentPage));
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
const lastPageButtonAvailable = (end <
|
|
274
|
+
const lastPageButtonAvailable = (end < pagesAmount && !this.props.openTotal) ||
|
|
275
275
|
(this.props.openTotal && this.props.canLoadLastPageWithOpenTotal);
|
|
276
276
|
|
|
277
277
|
return (
|
|
@@ -292,9 +292,9 @@ export default class Pager extends PureComponent {
|
|
|
292
292
|
|
|
293
293
|
{buttons}
|
|
294
294
|
|
|
295
|
-
{end <
|
|
295
|
+
{end < pagesAmount && this.getButton(end + 1, '...')}
|
|
296
296
|
|
|
297
|
-
{end ===
|
|
297
|
+
{end === pagesAmount && this.props.openTotal && (
|
|
298
298
|
<Button
|
|
299
299
|
href={this.generateHref(end + 1)}
|
|
300
300
|
disabled={this.props.loader}
|
|
@@ -307,7 +307,7 @@ export default class Pager extends PureComponent {
|
|
|
307
307
|
(
|
|
308
308
|
<ButtonGroup>
|
|
309
309
|
{this.getButton(
|
|
310
|
-
this.props.openTotal ? -1 :
|
|
310
|
+
this.props.openTotal ? -1 : pagesAmount,
|
|
311
311
|
this.props.translations.lastPage
|
|
312
312
|
)}
|
|
313
313
|
</ButtonGroup>
|
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.9",
|
|
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": "f3629bb73589725e9470d3bd9912382d36754098"
|
|
225
225
|
}
|