@jetbrains/ring-ui 4.1.6 → 4.1.10
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/README.md +1 -13
- package/components/auth/auth.test.js +7 -9
- package/components/auth/auth__core.js +30 -4
- package/components/auth-dialog/auth-dialog.examples.js +2 -3
- package/components/auth-dialog/auth-dialog.js +45 -2
- package/components/select/select.js +8 -0
- package/components/select-ng/select-ng__lazy.js +3 -4
- package/dist/_helpers/button__classes.js +1 -1
- package/dist/_helpers/checkbox.js +1 -1
- package/dist/_helpers/date-picker.js +1 -1
- package/dist/_helpers/inject-styles.js +1 -1
- package/dist/_helpers/input.js +1 -1
- package/dist/_helpers/query-assist__suggestions.js +1 -1
- package/dist/_helpers/tabs.js +1 -1
- package/dist/auth/auth__core.js +32 -5
- package/dist/auth-dialog/auth-dialog.js +47 -3
- package/dist/markdown/markdown.js +1 -1
- package/dist/select/select.js +10 -0
- package/dist/select-ng/select-ng__lazy.js +8 -4
- package/dist/style.css +1 -1
- package/package.json +37 -37
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ export const Demo = () => {
|
|
|
37
37
|
|
|
38
38
|
The bundle size will depend on the amount of components you imported.
|
|
39
39
|
|
|
40
|
-
### Generating app
|
|
40
|
+
### Generating app (deprecated)
|
|
41
41
|
|
|
42
42
|
1. Install Yeoman and Ring UI generator: `npm install -g yo@next-4 @jetbrains/generator-ring-ui`
|
|
43
43
|
2. Go to the root directory of your project (create one if necessary), run `yo @jetbrains/ring-ui` and enter the name of the project. Then run `npm install` to install all the necessary npm dependencies.
|
|
@@ -86,18 +86,6 @@ in a same build process, you can use the following configuration:
|
|
|
86
86
|
module.exports = webpackConfig;
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
### Yeoman scaffolding
|
|
90
|
-
|
|
91
|
-
1. Install Yeoman and Ring UI generator: `npm install -g yo @jetbrains/generator-ring-ui`
|
|
92
|
-
2. Go to the root directory of your project (create one if necessary) and run `yo @jetbrains/ring-ui`. After you enter the name of the project all the necessary npm dependencies will be installed.
|
|
93
|
-
3. Your project is ready to be developed. The following commands are available:
|
|
94
|
-
- `npm start` to run a local development server
|
|
95
|
-
- `npm test` to launch karma tests
|
|
96
|
-
- `npm run lint` to lint your code
|
|
97
|
-
- `npm run build` to build a production bundle
|
|
98
|
-
- `npm run create-component` to create a new component template with styles and tests
|
|
99
|
-
|
|
100
|
-
|
|
101
89
|
## Contributing
|
|
102
90
|
|
|
103
91
|
See [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
@@ -516,19 +516,17 @@ describe('Auth', () => {
|
|
|
516
516
|
}
|
|
517
517
|
});
|
|
518
518
|
|
|
519
|
-
it('should show login overlay if token refresh fails and window login enabled',
|
|
519
|
+
it('should show login overlay if token refresh fails and window login enabled', done => {
|
|
520
520
|
auth._backgroundFlow._timeout = 100;
|
|
521
521
|
sandbox.stub(BackgroundFlow.prototype, '_redirectFrame');
|
|
522
522
|
sandbox.stub(Auth.prototype, '_showAuthDialog');
|
|
523
523
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
Auth.prototype._showAuthDialog.should.have.been.
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
});
|
|
531
|
-
}
|
|
524
|
+
auth.requestToken();
|
|
525
|
+
|
|
526
|
+
setTimeout(() => {
|
|
527
|
+
Auth.prototype._showAuthDialog.should.have.been.called;
|
|
528
|
+
done();
|
|
529
|
+
}, auth._backgroundFlow._timeout * 2);
|
|
532
530
|
});
|
|
533
531
|
});
|
|
534
532
|
|
|
@@ -52,6 +52,7 @@ const DEFAULT_CONFIG = {
|
|
|
52
52
|
login: 'Log in',
|
|
53
53
|
loginTo: 'Log in to %serviceName%',
|
|
54
54
|
cancel: 'Cancel',
|
|
55
|
+
tryAgainLabel: 'Try again',
|
|
55
56
|
postpone: 'Postpone',
|
|
56
57
|
youHaveLoggedInAs: 'You have logged in as another user: %userName%',
|
|
57
58
|
applyChange: 'Apply change',
|
|
@@ -405,9 +406,27 @@ export default class Auth {
|
|
|
405
406
|
try {
|
|
406
407
|
return await this._backgroundFlow.authorize();
|
|
407
408
|
} catch (error) {
|
|
408
|
-
|
|
409
409
|
if (this._canShowDialogs()) {
|
|
410
|
-
return
|
|
410
|
+
return new Promise(resolve => {
|
|
411
|
+
const onTryAgain = async () => {
|
|
412
|
+
try {
|
|
413
|
+
const result = await this._backgroundFlow.authorize();
|
|
414
|
+
resolve(result);
|
|
415
|
+
} catch (retryError) {
|
|
416
|
+
this._showAuthDialog({
|
|
417
|
+
nonInteractive: true,
|
|
418
|
+
error: retryError,
|
|
419
|
+
onTryAgain
|
|
420
|
+
});
|
|
421
|
+
throw retryError;
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
this._showAuthDialog({
|
|
425
|
+
nonInteractive: true,
|
|
426
|
+
error,
|
|
427
|
+
onTryAgain
|
|
428
|
+
});
|
|
429
|
+
});
|
|
411
430
|
} else {
|
|
412
431
|
const authRequest = await this._requestBuilder.prepareAuthRequest();
|
|
413
432
|
this._redirectCurrentPage(authRequest.url);
|
|
@@ -516,7 +535,7 @@ export default class Auth {
|
|
|
516
535
|
this.logout();
|
|
517
536
|
}
|
|
518
537
|
|
|
519
|
-
_showAuthDialog({nonInteractive, error, canCancel} = {}) {
|
|
538
|
+
_showAuthDialog({nonInteractive, error, canCancel, onTryAgain} = {}) {
|
|
520
539
|
const {embeddedLogin, onPostponeLogout, translations} = this.config;
|
|
521
540
|
const cancelable = this.user.guest || canCancel;
|
|
522
541
|
|
|
@@ -557,15 +576,22 @@ export default class Auth {
|
|
|
557
576
|
}
|
|
558
577
|
};
|
|
559
578
|
|
|
579
|
+
const onTryAgainClick = async () => {
|
|
580
|
+
await onTryAgain();
|
|
581
|
+
closeDialog();
|
|
582
|
+
};
|
|
583
|
+
|
|
560
584
|
const hide = this._authDialogService({
|
|
561
585
|
...this._service,
|
|
562
586
|
loginCaption: translations.login,
|
|
563
587
|
loginToCaption: translations.loginTo,
|
|
564
588
|
confirmLabel: translations.login,
|
|
589
|
+
tryAgainLabel: translations.tryAgainLabel,
|
|
565
590
|
cancelLabel: cancelable ? translations.cancel : translations.postpone,
|
|
566
591
|
errorMessage: this._extractErrorMessage(error, true),
|
|
567
592
|
onConfirm,
|
|
568
|
-
onCancel
|
|
593
|
+
onCancel,
|
|
594
|
+
onTryAgain: onTryAgain ? onTryAgainClick : null
|
|
569
595
|
});
|
|
570
596
|
|
|
571
597
|
const stopTokenListening = this._storage.onTokenChange(token => {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import youtrackLogo from '!file-loader!@jetbrains/logos/youtrack/youtrack.svg';
|
|
4
|
+
|
|
3
5
|
import reactDecorator from '../../.storybook/react-decorator';
|
|
4
6
|
|
|
5
7
|
import Button from '@jetbrains/ring-ui/components/button/button';
|
|
6
8
|
|
|
7
9
|
import AuthDialog from '@jetbrains/ring-ui/components/auth-dialog/auth-dialog';
|
|
8
10
|
|
|
9
|
-
import youtrackLogo from '!file-loader!@jetbrains/logos/youtrack/youtrack.svg';
|
|
10
|
-
|
|
11
|
-
|
|
12
11
|
export default {
|
|
13
12
|
title: 'Components/Auth Dialog',
|
|
14
13
|
decorators: [reactDecorator()],
|
|
@@ -28,9 +28,11 @@ export default class AuthDialog extends Component {
|
|
|
28
28
|
cancelOnEsc: PropTypes.bool,
|
|
29
29
|
confirmLabel: PropTypes.string,
|
|
30
30
|
cancelLabel: PropTypes.string,
|
|
31
|
+
tryAgainLabel: PropTypes.string,
|
|
31
32
|
|
|
32
33
|
onConfirm: PropTypes.func,
|
|
33
|
-
onCancel: PropTypes.func
|
|
34
|
+
onCancel: PropTypes.func,
|
|
35
|
+
onTryAgain: PropTypes.func
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
static defaultProps = {
|
|
@@ -44,12 +46,38 @@ export default class AuthDialog extends Component {
|
|
|
44
46
|
onCancel: () => {}
|
|
45
47
|
};
|
|
46
48
|
|
|
49
|
+
state = {
|
|
50
|
+
retrying: false
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
componentDidMount() {
|
|
54
|
+
window.addEventListener('online', this.onRetryPress);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
componentWillUnmount() {
|
|
58
|
+
window.removeEventListener('online', this.onRetryPress);
|
|
59
|
+
}
|
|
60
|
+
|
|
47
61
|
onEscPress = () => {
|
|
48
62
|
if (this.props.cancelOnEsc) {
|
|
49
63
|
this.props.onCancel();
|
|
50
64
|
}
|
|
51
65
|
};
|
|
52
66
|
|
|
67
|
+
onRetryPress = async () => {
|
|
68
|
+
if (!this.props.onTryAgain || this.state.retrying) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this.setState({retrying: true});
|
|
72
|
+
try {
|
|
73
|
+
await this.props.onTryAgain();
|
|
74
|
+
} catch (e) {
|
|
75
|
+
// do nothing, error is handled in onTryAgain
|
|
76
|
+
} finally {
|
|
77
|
+
this.setState({retrying: false});
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
53
81
|
render() {
|
|
54
82
|
const {
|
|
55
83
|
show,
|
|
@@ -61,10 +89,14 @@ export default class AuthDialog extends Component {
|
|
|
61
89
|
loginToCaption,
|
|
62
90
|
confirmLabel,
|
|
63
91
|
cancelLabel,
|
|
92
|
+
tryAgainLabel,
|
|
64
93
|
onConfirm,
|
|
65
|
-
onCancel
|
|
94
|
+
onCancel,
|
|
95
|
+
onTryAgain
|
|
66
96
|
} = this.props;
|
|
67
97
|
|
|
98
|
+
const {retrying} = this.state;
|
|
99
|
+
|
|
68
100
|
const defaultTitle = serviceName ? loginToCaption : loginCaption;
|
|
69
101
|
const title = (this.props.title || defaultTitle).replace('%serviceName%', serviceName);
|
|
70
102
|
|
|
@@ -99,6 +131,17 @@ export default class AuthDialog extends Component {
|
|
|
99
131
|
>
|
|
100
132
|
{confirmLabel}
|
|
101
133
|
</Button>
|
|
134
|
+
{onTryAgain && (
|
|
135
|
+
<Button
|
|
136
|
+
className={styles.button}
|
|
137
|
+
data-test="auth-dialog-retry-button"
|
|
138
|
+
onClick={() => this.onRetryPress()}
|
|
139
|
+
loader={retrying}
|
|
140
|
+
disabled={retrying}
|
|
141
|
+
>
|
|
142
|
+
{tryAgainLabel}
|
|
143
|
+
</Button>
|
|
144
|
+
)}
|
|
102
145
|
<Button
|
|
103
146
|
className={styles.button}
|
|
104
147
|
data-test="auth-dialog-cancel-button"
|
|
@@ -738,6 +738,14 @@ export default class Select extends Component {
|
|
|
738
738
|
}
|
|
739
739
|
};
|
|
740
740
|
|
|
741
|
+
_openPopupIfClosed = () => {
|
|
742
|
+
if (this.props.disabled || this.state.showPopup) {
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
this.props.onBeforeOpen();
|
|
746
|
+
this._showPopup();
|
|
747
|
+
};
|
|
748
|
+
|
|
741
749
|
_filterChangeHandler = e => {
|
|
742
750
|
this._setFilter(e.target.value, e);
|
|
743
751
|
};
|
|
@@ -38,11 +38,11 @@ class SelectLazy {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
attachEvents() {
|
|
41
|
-
this.container.addEventListener('click', this.onClick);
|
|
41
|
+
this.container.addEventListener('click', this.onClick, {capture: true});
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
detachEvents() {
|
|
45
|
-
this.container.removeEventListener('click', this.onClick);
|
|
45
|
+
this.container.removeEventListener('click', this.onClick, {capture: true});
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
render(props) {
|
|
@@ -59,8 +59,7 @@ class SelectLazy {
|
|
|
59
59
|
this.detachEvents();
|
|
60
60
|
if (this.type === 'dropdown') {
|
|
61
61
|
this.ctrl.selectInstance = render(this.reactSelect, this.container);
|
|
62
|
-
|
|
63
|
-
this.ctrl.selectInstance._clickHandler();
|
|
62
|
+
this.ctrl.selectInstance._openPopupIfClosed();
|
|
64
63
|
} else {
|
|
65
64
|
this.ctrl.selectInstance = hydrate(this.reactSelect, this.container);
|
|
66
65
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import Theme from '../global/theme.js';
|
|
3
3
|
|
|
4
|
-
var modules_e81895c9 = {"unit":"8px","button-shadow":"inset 0 0 0 1px","height":"24px","loaderWidth":"64px","light":"
|
|
4
|
+
var modules_e81895c9 = {"unit":"8px","button-shadow":"inset 0 0 0 1px","height":"24px","loaderWidth":"64px","light":"light_rui_8c91","active":"active_rui_8c91 active_rui_e33e","withIcon":"withIcon_rui_8c91","icon":"icon_rui_8c91","primary":"primary_rui_8c91","danger":"danger_rui_8c91","loaderBackground":"loaderBackground_rui_8c91","dark":"dark_rui_8c91","dropdownIcon":"dropdownIcon_rui_8c91","button":"button_rui_8c91 button_rui_e33e button_rui_40c7 button_rui_ec74","loader":"loader_rui_8c91","text":"text_rui_8c91","content":"content_rui_8c91","text-loading":"textLoading_rui_8c91","inline":"inline_rui_8c91","withNormalIconLight":"withNormalIconLight_rui_8c91","withNormalIconDark":"withNormalIconDark_rui_8c91","withDangerIconLight":"withDangerIconLight_rui_8c91","withDangerIconDark":"withDangerIconDark_rui_8c91","progress":"progress_rui_8c91","delayed":"delayed_rui_8c91","short":"short_rui_8c91"};
|
|
5
5
|
|
|
6
6
|
function getButtonClasses(_ref) {
|
|
7
7
|
let {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_3199090e = {"unit":"8px","checkboxSize":"14px","checkbox":"
|
|
1
|
+
var modules_3199090e = {"unit":"8px","checkboxSize":"14px","checkbox":"checkbox_rui_a0fd","cell":"cell_rui_a0fd","icon":"icon_rui_a0fd","check":"check_rui_a0fd icon_rui_a0fd","minus":"minus_rui_a0fd icon_rui_a0fd","input":"input_rui_a0fd","focus":"focus_rui_a0fd","label":"label_rui_a0fd"};
|
|
2
2
|
|
|
3
3
|
export { modules_3199090e as m };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_0c7b7d96 = {"unit":"8px","cellSize":"24px","calHeight":"288px","calWidth":"296px","yearHeight":"32px","yearWidth":"48px","container":"
|
|
1
|
+
var modules_0c7b7d96 = {"unit":"8px","cellSize":"24px","calHeight":"288px","calWidth":"296px","yearHeight":"32px","yearWidth":"48px","container":"container_rui_f337","hoverable":"hoverable_rui_f337","datePicker":"datePicker_rui_f337","displayDate":"displayDate_rui_f337","displayRange":"displayRange_rui_f337","clear":"clear_rui_f337","datePopup":"datePopup_rui_f337","filterWrapper":"filterWrapper_rui_f337 filterWrapper_rui_7e99","filter":"filter_rui_f337 filter_rui_7e99","filterIcon":"filterIcon_rui_f337 filterIcon_rui_7e99","fromInput":"fromInput_rui_f337","fromInputWithDivider":"fromInputWithDivider_rui_f337","toInput":"toInput_rui_f337","dateInput":"dateInput_rui_f337","timeInputWithDivider":"timeInputWithDivider_rui_f337","weekdays":"weekdays_rui_f337","weekday":"weekday_rui_f337","weekend":"weekend_rui_f337","calendar":"calendar_rui_f337","months":"months_rui_f337","days":"days_rui_f337","month":"month_rui_f337","monthTitle":"monthTitle_rui_f337","day":"day_rui_f337 resetButton_rui_750f","between":"between_rui_f337","activeBetween":"activeBetween_rui_f337","current":"current_rui_f337","active":"active_rui_f337","disabled":"disabled_rui_f337","from":"from_rui_f337","to":"to_rui_f337","Monday":"Monday_rui_f337","spread":"spread_rui_f337","activeSpread":"activeSpread_rui_f337","first":"first_rui_f337","Tuesday":"Tuesday_rui_f337","Friday":"Friday_rui_f337","Saturday":"Saturday_rui_f337","Sunday":"Sunday_rui_f337","empty":"empty_rui_f337","today":"today_rui_f337","year":"year_rui_f337 hoverable_rui_f337 resetButton_rui_750f","monthNames":"monthNames_rui_f337","monthName":"monthName_rui_f337 hoverable_rui_f337 resetButton_rui_750f","monthSlider":"monthSlider_rui_f337 resetButton_rui_750f","dragging":"dragging_rui_f337","range":"range_rui_f337","years":"years_rui_f337","currentYear":"currentYear_rui_f337"};
|
|
2
2
|
|
|
3
3
|
export { modules_0c7b7d96 as m };
|
|
@@ -4,7 +4,7 @@ import memoize from '../global/memoize.js';
|
|
|
4
4
|
import radialGradientMask from '../global/radial-gradient-mask.js';
|
|
5
5
|
import Theme from '../global/theme.js';
|
|
6
6
|
|
|
7
|
-
var modules_e49a3529 = {"unit":"8px","loader":"
|
|
7
|
+
var modules_e49a3529 = {"unit":"8px","loader":"loader_rui_423e","spin":"spin_rui_423e","pulse":"pulse_rui_423e","children":"children_rui_423e"};
|
|
8
8
|
|
|
9
9
|
const IMAGE_SIZE = 32;
|
|
10
10
|
var injectStyles = memoize(() => {
|
package/dist/_helpers/input.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_88cfaf40 = {"unit":"8px","iconOffset":"22px","container":"
|
|
1
|
+
var modules_88cfaf40 = {"unit":"8px","iconOffset":"22px","container":"container_rui_65d4 fontLower_rui_750f font_rui_750f","compact":"compact_rui_65d4","input":"input_rui_65d4","clearable":"clearable_rui_65d4","light":"light_rui_65d4","dark":"dark_rui_65d4","withIcon":"withIcon_rui_65d4","label":"label_rui_65d4","icon":"icon_rui_65d4","clear":"clear_rui_65d4","empty":"empty_rui_65d4","active":"active_rui_65d4","noLabel":"noLabel_rui_65d4","error":"error_rui_65d4","underline":"underline_rui_65d4","focusUnderline":"focusUnderline_rui_65d4","errorUnderline":"errorUnderline_rui_65d4","errorText":"errorText_rui_65d4","sizeS":"sizeS_rui_65d4","sizeM":"sizeM_rui_65d4","sizeL":"sizeL_rui_65d4","sizeFULL":"sizeFULL_rui_65d4"};
|
|
2
2
|
|
|
3
3
|
export { modules_88cfaf40 as m };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import List from '../list/list.js';
|
|
3
3
|
|
|
4
|
-
var modules_da7ab055 = {"unit":"8px","overInputZIndex":"2","inputGap":"24px","light":"
|
|
4
|
+
var modules_da7ab055 = {"unit":"8px","overInputZIndex":"2","inputGap":"24px","light":"light_rui_7422","queryAssist":"queryAssist_rui_7422 font_rui_750f","input":"input_rui_7422","placeholder":"placeholder_rui_7422 resetButton_rui_750f","letter-text":"letterText_rui_7422","letterDefault":"letterDefault_rui_7422","letter-field-name":"letterFieldName_rui_7422","letter-field-value":"letterFieldValue_rui_7422","letter-operator":"letterOperator_rui_7422","letter-error":"letterError_rui_7422","iconInner":"iconInner_rui_7422","highlight":"highlight_rui_7422","service":"service_rui_7422","dark":"dark_rui_7422","icon":"icon_rui_7422","loader":"loader_rui_7422","actions":"actions_rui_7422","24px":"_24px_rui_7422","inputGap2":"inputGap2_rui_7422","inputLeftGap":"inputLeftGap_rui_7422","inputDisabled":"inputDisabled_rui_7422","placeholderSpaced":"placeholderSpaced_rui_7422","letter":"letter_rui_7422","loaderOnTheRight":"loaderOnTheRight_rui_7422","focusUnderline":"focusUnderline_rui_7422"};
|
|
5
5
|
|
|
6
6
|
const ICON_ID_LENGTH = 44;
|
|
7
7
|
class QueryAssistSuggestions {
|
package/dist/_helpers/tabs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_02138f4a = {"unit":"8px","line-shadow":"inset 0 -1px 0 0","selected-line-shadow":"inset 0 -3px 0 0","tabs":"
|
|
1
|
+
var modules_02138f4a = {"unit":"8px","line-shadow":"inset 0 -1px 0 0","selected-line-shadow":"inset 0 -3px 0 0","tabs":"tabs_rui_a11f font_rui_750f","titles":"titles_rui_a11f","light":"light_rui_a11f","dark":"dark_rui_a11f","title":"title_rui_a11f font_rui_750f","selected":"selected_rui_a11f","collapsed":"collapsed_rui_a11f","titleLegacy":"titleLegacy_rui_a11f","visible":"visible_rui_a11f","container":"container_rui_a11f","hidden":"hidden_rui_a11f","hiddenBold":"hiddenBold_rui_a11f","hiddenRegular":"hiddenRegular_rui_a11f","tabCounter":"tabCounter_rui_a11f","autoCollapseContainer":"autoCollapseContainer_rui_a11f","autoCollapse":"autoCollapse_rui_a11f","rendered":"rendered_rui_a11f","adjusted":"adjusted_rui_a11f","measure":"measure_rui_a11f","morePopup":"morePopup_rui_a11f","chevron":"chevron_rui_a11f","morePopupBeforeEnd":"morePopupBeforeEnd_rui_a11f"};
|
|
2
2
|
|
|
3
3
|
export { modules_02138f4a as m };
|
package/dist/auth/auth__core.js
CHANGED
|
@@ -86,6 +86,7 @@ const DEFAULT_CONFIG = {
|
|
|
86
86
|
login: 'Log in',
|
|
87
87
|
loginTo: 'Log in to %serviceName%',
|
|
88
88
|
cancel: 'Cancel',
|
|
89
|
+
tryAgainLabel: 'Try again',
|
|
89
90
|
postpone: 'Postpone',
|
|
90
91
|
youHaveLoggedInAs: 'You have logged in as another user: %userName%',
|
|
91
92
|
applyChange: 'Apply change',
|
|
@@ -475,9 +476,27 @@ class Auth {
|
|
|
475
476
|
return await this._backgroundFlow.authorize();
|
|
476
477
|
} catch (error) {
|
|
477
478
|
if (this._canShowDialogs()) {
|
|
478
|
-
return
|
|
479
|
-
|
|
480
|
-
|
|
479
|
+
return new Promise(resolve => {
|
|
480
|
+
const onTryAgain = async () => {
|
|
481
|
+
try {
|
|
482
|
+
const result = await this._backgroundFlow.authorize();
|
|
483
|
+
resolve(result);
|
|
484
|
+
} catch (retryError) {
|
|
485
|
+
this._showAuthDialog({
|
|
486
|
+
nonInteractive: true,
|
|
487
|
+
error: retryError,
|
|
488
|
+
onTryAgain
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
throw retryError;
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
this._showAuthDialog({
|
|
496
|
+
nonInteractive: true,
|
|
497
|
+
error,
|
|
498
|
+
onTryAgain
|
|
499
|
+
});
|
|
481
500
|
});
|
|
482
501
|
} else {
|
|
483
502
|
const authRequest = await this._requestBuilder.prepareAuthRequest();
|
|
@@ -603,7 +622,8 @@ class Auth {
|
|
|
603
622
|
let {
|
|
604
623
|
nonInteractive,
|
|
605
624
|
error,
|
|
606
|
-
canCancel
|
|
625
|
+
canCancel,
|
|
626
|
+
onTryAgain
|
|
607
627
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
608
628
|
const {
|
|
609
629
|
embeddedLogin,
|
|
@@ -654,14 +674,21 @@ class Auth {
|
|
|
654
674
|
}
|
|
655
675
|
};
|
|
656
676
|
|
|
677
|
+
const onTryAgainClick = async () => {
|
|
678
|
+
await onTryAgain();
|
|
679
|
+
closeDialog();
|
|
680
|
+
};
|
|
681
|
+
|
|
657
682
|
const hide = this._authDialogService({ ...this._service,
|
|
658
683
|
loginCaption: translations.login,
|
|
659
684
|
loginToCaption: translations.loginTo,
|
|
660
685
|
confirmLabel: translations.login,
|
|
686
|
+
tryAgainLabel: translations.tryAgainLabel,
|
|
661
687
|
cancelLabel: cancelable ? translations.cancel : translations.postpone,
|
|
662
688
|
errorMessage: this._extractErrorMessage(error, true),
|
|
663
689
|
onConfirm,
|
|
664
|
-
onCancel
|
|
690
|
+
onCancel,
|
|
691
|
+
onTryAgain: onTryAgain ? onTryAgainClick : null
|
|
665
692
|
});
|
|
666
693
|
|
|
667
694
|
const stopTokenListening = this._storage.onTokenChange(token => {
|
|
@@ -49,11 +49,42 @@ class AuthDialog extends Component {
|
|
|
49
49
|
constructor() {
|
|
50
50
|
super(...arguments);
|
|
51
51
|
|
|
52
|
+
_defineProperty(this, "state", {
|
|
53
|
+
retrying: false
|
|
54
|
+
});
|
|
55
|
+
|
|
52
56
|
_defineProperty(this, "onEscPress", () => {
|
|
53
57
|
if (this.props.cancelOnEsc) {
|
|
54
58
|
this.props.onCancel();
|
|
55
59
|
}
|
|
56
60
|
});
|
|
61
|
+
|
|
62
|
+
_defineProperty(this, "onRetryPress", async () => {
|
|
63
|
+
if (!this.props.onTryAgain || this.state.retrying) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
this.setState({
|
|
68
|
+
retrying: true
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
await this.props.onTryAgain();
|
|
73
|
+
} catch (e) {// do nothing, error is handled in onTryAgain
|
|
74
|
+
} finally {
|
|
75
|
+
this.setState({
|
|
76
|
+
retrying: false
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
componentDidMount() {
|
|
83
|
+
window.addEventListener('online', this.onRetryPress);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
componentWillUnmount() {
|
|
87
|
+
window.removeEventListener('online', this.onRetryPress);
|
|
57
88
|
}
|
|
58
89
|
|
|
59
90
|
render() {
|
|
@@ -67,9 +98,14 @@ class AuthDialog extends Component {
|
|
|
67
98
|
loginToCaption,
|
|
68
99
|
confirmLabel,
|
|
69
100
|
cancelLabel,
|
|
101
|
+
tryAgainLabel,
|
|
70
102
|
onConfirm,
|
|
71
|
-
onCancel
|
|
103
|
+
onCancel,
|
|
104
|
+
onTryAgain
|
|
72
105
|
} = this.props;
|
|
106
|
+
const {
|
|
107
|
+
retrying
|
|
108
|
+
} = this.state;
|
|
73
109
|
const defaultTitle = serviceName ? loginToCaption : loginCaption;
|
|
74
110
|
const title = (this.props.title || defaultTitle).replace('%serviceName%', serviceName);
|
|
75
111
|
return /*#__PURE__*/React.createElement(Dialog, {
|
|
@@ -95,7 +131,13 @@ class AuthDialog extends Component {
|
|
|
95
131
|
className: modules_ae521deb.firstButton,
|
|
96
132
|
"data-test": "auth-dialog-confirm-button",
|
|
97
133
|
onClick: onConfirm
|
|
98
|
-
}, confirmLabel), /*#__PURE__*/React.createElement(Button, {
|
|
134
|
+
}, confirmLabel), onTryAgain && /*#__PURE__*/React.createElement(Button, {
|
|
135
|
+
className: modules_ae521deb.button,
|
|
136
|
+
"data-test": "auth-dialog-retry-button",
|
|
137
|
+
onClick: () => this.onRetryPress(),
|
|
138
|
+
loader: retrying,
|
|
139
|
+
disabled: retrying
|
|
140
|
+
}, tryAgainLabel), /*#__PURE__*/React.createElement(Button, {
|
|
99
141
|
className: modules_ae521deb.button,
|
|
100
142
|
"data-test": "auth-dialog-cancel-button",
|
|
101
143
|
onClick: onCancel
|
|
@@ -116,8 +158,10 @@ _defineProperty(AuthDialog, "propTypes", {
|
|
|
116
158
|
cancelOnEsc: PropTypes.bool,
|
|
117
159
|
confirmLabel: PropTypes.string,
|
|
118
160
|
cancelLabel: PropTypes.string,
|
|
161
|
+
tryAgainLabel: PropTypes.string,
|
|
119
162
|
onConfirm: PropTypes.func,
|
|
120
|
-
onCancel: PropTypes.func
|
|
163
|
+
onCancel: PropTypes.func,
|
|
164
|
+
onTryAgain: PropTypes.func
|
|
121
165
|
});
|
|
122
166
|
|
|
123
167
|
_defineProperty(AuthDialog, "defaultProps", {
|
|
@@ -21,7 +21,7 @@ import '../_helpers/link.js';
|
|
|
21
21
|
import '../heading/heading.js';
|
|
22
22
|
import 'util-deprecate';
|
|
23
23
|
|
|
24
|
-
var modules_9c709e64 = {"unit":"8px","p-margin":"10px","inline":"
|
|
24
|
+
var modules_9c709e64 = {"unit":"8px","p-margin":"10px","inline":"inline_rui_b3aa","markdown":"markdown_rui_b3aa font_rui_750f"};
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* @name Markdown
|
package/dist/select/select.js
CHANGED
|
@@ -391,6 +391,16 @@ class Select extends Component {
|
|
|
391
391
|
}
|
|
392
392
|
});
|
|
393
393
|
|
|
394
|
+
_defineProperty(this, "_openPopupIfClosed", () => {
|
|
395
|
+
if (this.props.disabled || this.state.showPopup) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
this.props.onBeforeOpen();
|
|
400
|
+
|
|
401
|
+
this._showPopup();
|
|
402
|
+
});
|
|
403
|
+
|
|
394
404
|
_defineProperty(this, "_filterChangeHandler", e => {
|
|
395
405
|
this._setFilter(e.target.value, e);
|
|
396
406
|
});
|
|
@@ -115,11 +115,15 @@ class SelectLazy {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
attachEvents() {
|
|
118
|
-
this.container.addEventListener('click', this.onClick
|
|
118
|
+
this.container.addEventListener('click', this.onClick, {
|
|
119
|
+
capture: true
|
|
120
|
+
});
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
detachEvents() {
|
|
122
|
-
this.container.removeEventListener('click', this.onClick
|
|
124
|
+
this.container.removeEventListener('click', this.onClick, {
|
|
125
|
+
capture: true
|
|
126
|
+
});
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
render(props) {
|
|
@@ -137,9 +141,9 @@ class SelectLazy {
|
|
|
137
141
|
this.detachEvents();
|
|
138
142
|
|
|
139
143
|
if (this.type === 'dropdown') {
|
|
140
|
-
this.ctrl.selectInstance = render(this.reactSelect, this.container);
|
|
144
|
+
this.ctrl.selectInstance = render(this.reactSelect, this.container);
|
|
141
145
|
|
|
142
|
-
this.ctrl.selectInstance.
|
|
146
|
+
this.ctrl.selectInstance._openPopupIfClosed();
|
|
143
147
|
} else {
|
|
144
148
|
this.ctrl.selectInstance = hydrate(this.reactSelect, this.container);
|
|
145
149
|
}
|