@jetbrains/ring-ui-built 7.0.65 → 7.0.70
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/_helpers/anchor.js +12 -17
- package/components/_helpers/avatar-info.js +4 -5
- package/components/_helpers/button.classes.js +20 -21
- package/components/_helpers/caption.js +3 -3
- package/components/_helpers/card.js +26 -32
- package/components/_helpers/dialog-body-scroll-preventer.js +1 -2
- package/components/_helpers/icon-svg.js +9 -12
- package/components/_helpers/input.js +78 -86
- package/components/_helpers/loader-core.js +260 -0
- package/components/_helpers/query-assist-suggestions.js +0 -1
- package/components/_helpers/select-filter.js +19 -26
- package/components/_helpers/services-link.js +9 -12
- package/components/_helpers/sidebar.js +36 -44
- package/components/_helpers/tab-link.js +9 -11
- package/components/_helpers/theme.js +20 -24
- package/components/_helpers/title.js +12 -17
- package/components/alert/alert.js +41 -49
- package/components/alert/container.js +9 -12
- package/components/alert-service/alert-service.js +23 -32
- package/components/analytics/analytics-custom-plugin.js +12 -17
- package/components/analytics/analytics.js +1 -3
- package/components/auth/auth-core.js +128 -170
- package/components/auth/auth.js +3 -10
- package/components/auth/background-flow.js +5 -8
- package/components/auth/down-notification.js +9 -17
- package/components/auth/iframe-flow.js +13 -19
- package/components/auth/request-builder.js +4 -9
- package/components/auth/response-parser.js +9 -12
- package/components/auth/storage.js +12 -18
- package/components/auth/token-validator.js +19 -30
- package/components/auth/window-flow.js +22 -27
- package/components/auth-dialog/auth-dialog.js +40 -48
- package/components/auth-dialog-service/auth-dialog-service.js +10 -13
- package/components/avatar/avatar.figma.js +6 -6
- package/components/avatar/avatar.js +58 -59
- package/components/avatar/fallback-avatar.js +8 -11
- package/components/avatar-stack/avatar-stack.figma.js +10 -11
- package/components/avatar-stack/avatar-stack.js +25 -31
- package/components/banner/banner.js +0 -6
- package/components/breadcrumbs/breadcrumbs.figma.js +8 -6
- package/components/breadcrumbs/breadcrumbs.js +4 -5
- package/components/button/button.figma.js +15 -10
- package/components/button/button.js +59 -64
- package/components/button-group/button-group.js +11 -15
- package/components/button-group/caption.js +0 -1
- package/components/button-set/button-set.js +9 -12
- package/components/button-toolbar/button-toolbar.js +8 -11
- package/components/caret/caret.js +20 -28
- package/components/checkbox/checkbox-group.figma.js +8 -10
- package/components/checkbox/checkbox.figma.js +5 -5
- package/components/checkbox/checkbox.js +27 -35
- package/components/clipboard/clipboard-fallback.js +3 -3
- package/components/clipboard/clipboard.js +3 -16
- package/components/code/code.js +8 -14
- package/components/collapse/collapse-content.js +10 -15
- package/components/collapse/collapse-control.js +5 -7
- package/components/collapse/collapse.js +9 -11
- package/components/collapse/utils.js +1 -1
- package/components/confirm/confirm.js +17 -26
- package/components/confirm-service/confirm-service.js +30 -31
- package/components/content-layout/content-layout.js +21 -28
- package/components/content-layout/sidebar.js +0 -2
- package/components/contenteditable/contenteditable.js +23 -28
- package/components/control-help/control-help.js +8 -10
- package/components/control-label/control-label.js +12 -17
- package/components/data-list/data-list.js +57 -65
- package/components/data-list/data-list.mock.js +0 -4
- package/components/data-list/item.js +65 -72
- package/components/data-list/selection.js +11 -19
- package/components/data-list/title.js +0 -4
- package/components/date-picker/consts.js +3 -4
- package/components/date-picker/date-input.js +25 -33
- package/components/date-picker/date-picker.js +179 -193
- package/components/date-picker/date-popup.js +135 -127
- package/components/date-picker/day.d.ts +1 -1
- package/components/date-picker/day.js +24 -30
- package/components/date-picker/month-names.js +7 -12
- package/components/date-picker/month-slider.js +16 -22
- package/components/date-picker/month.js +3 -5
- package/components/date-picker/months.js +6 -6
- package/components/date-picker/weekdays.js +0 -1
- package/components/date-picker/years.js +20 -26
- package/components/dialog/dialog-body-scroll-preventer.js +0 -1
- package/components/dialog/dialog.js +73 -83
- package/components/dropdown/anchor.js +0 -4
- package/components/dropdown/dropdown.js +98 -114
- package/components/dropdown-menu/dropdown-menu.js +80 -79
- package/components/editable-heading/editable-heading.js +48 -54
- package/components/error-bubble/error-bubble.figma.js +4 -4
- package/components/error-bubble/error-bubble.js +9 -13
- package/components/error-message/error-message.js +1 -6
- package/components/footer/footer.js +11 -15
- package/components/global/compose-refs.js +1 -4
- package/components/global/compose.js +1 -4
- package/components/global/configuration.js +3 -3
- package/components/global/controls-height.js +0 -1
- package/components/global/create-stateful-context.js +10 -14
- package/components/global/data-tests.js +2 -10
- package/components/global/dom.js +6 -19
- package/components/global/focus-sensor-hoc.js +74 -87
- package/components/global/fuzzy-highlight.js +3 -8
- package/components/global/get-uid.js +1 -1
- package/components/global/inject-styles.js +5 -6
- package/components/global/listeners.js +2 -11
- package/components/global/memoize.js +0 -2
- package/components/global/normalize-indent.js +2 -6
- package/components/global/promise-with-timeout.js +4 -5
- package/components/global/react-dom-renderer.js +4 -9
- package/components/global/rerender-hoc.js +8 -11
- package/components/global/schedule-raf.js +1 -2
- package/components/global/theme.js +0 -5
- package/components/global/trivial-template-tag.js +1 -6
- package/components/global/url.js +2 -6
- package/components/global/use-event-callback.js +2 -3
- package/components/grid/col.js +7 -18
- package/components/grid/grid.js +9 -14
- package/components/grid/row.js +7 -11
- package/components/group/group.js +9 -12
- package/components/header/header-icon.js +8 -13
- package/components/header/header.js +16 -27
- package/components/header/links.js +7 -10
- package/components/header/logo.js +12 -16
- package/components/header/profile.js +73 -83
- package/components/header/services-link.js +0 -2
- package/components/header/services.js +32 -43
- package/components/header/smart-profile.js +44 -59
- package/components/header/smart-services.js +33 -45
- package/components/header/tray.js +8 -10
- package/components/heading/heading.js +27 -27
- package/components/http/http.js +120 -125
- package/components/http/http.mock.js +6 -10
- package/components/hub-source/hub-source-user.js +6 -13
- package/components/hub-source/hub-source-users-groups.js +8 -12
- package/components/hub-source/hub-source.js +8 -10
- package/components/i18n/i18n-context.js +4 -7
- package/components/i18n/i18n.js +5 -5
- package/components/icon/icon-svg.js +0 -4
- package/components/icon/icon.js +28 -32
- package/components/icon/index.js +0 -4
- package/components/input/input.figma.js +8 -8
- package/components/input/input.js +0 -4
- package/components/island/adaptive-island-hoc.js +19 -23
- package/components/island/content.js +70 -75
- package/components/island/header.js +21 -21
- package/components/island/island.js +11 -14
- package/components/link/clickable-link.js +30 -37
- package/components/link/link.js +27 -29
- package/components/list/list-custom.js +6 -11
- package/components/list/list-item.js +49 -56
- package/components/list/list-separator.js +0 -1
- package/components/list/list-title.js +0 -1
- package/components/list/list-users-groups-source.js +14 -22
- package/components/list/list.classes.js +8 -9
- package/components/list/list.js +387 -404
- package/components/loader/loader-core.js +2 -265
- package/components/loader/loader.d.ts +8 -0
- package/components/loader/loader.js +43 -29
- package/components/loader-inline/loader-inline.js +9 -12
- package/components/loader-screen/loader-screen.js +10 -14
- package/components/login-dialog/login-dialog.js +46 -54
- package/components/login-dialog/service.js +13 -15
- package/components/message/message.js +65 -79
- package/components/old-browsers-message/old-browsers-message-stop.js +0 -3
- package/components/old-browsers-message/old-browsers-message.js +1 -4
- package/components/old-browsers-message/white-list.js +5 -7
- package/components/pager/pager.js +73 -88
- package/components/panel/panel.js +9 -12
- package/components/permissions/permissions-cache.js +6 -8
- package/components/permissions/permissions.js +19 -21
- package/components/popup/popup.js +136 -145
- package/components/popup/popup.target.js +8 -10
- package/components/popup/position-css.js +19 -27
- package/components/popup/position.js +22 -28
- package/components/popup-menu/popup-menu.js +27 -37
- package/components/progress-bar/progress-bar.js +26 -32
- package/components/query-assist/query-assist-suggestions.js +0 -6
- package/components/query-assist/query-assist.js +432 -468
- package/components/radio/radio-item.js +30 -40
- package/components/radio/radio.js +6 -10
- package/components/scrollable-section/scrollable-section.js +7 -10
- package/components/select/select-filter.js +0 -6
- package/components/select/select-popup.js +155 -174
- package/components/select/select.js +464 -479
- package/components/shortcuts/core.js +40 -45
- package/components/shortcuts/shortcut-title.js +0 -1
- package/components/shortcuts/shortcuts-hoc.js +9 -15
- package/components/shortcuts/shortcuts.js +3 -5
- package/components/slider/slider.js +53 -66
- package/components/slider/slider.utils.js +1 -4
- package/components/storage/storage-local.js +2 -8
- package/components/storage/storage.js +0 -5
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +21 -30
- package/components/table/cell.js +3 -4
- package/components/table/disable-hover-hoc.js +24 -28
- package/components/table/header-cell.js +30 -38
- package/components/table/header.js +20 -28
- package/components/table/multitable.js +81 -101
- package/components/table/row-with-focus-sensor.js +17 -28
- package/components/table/row.js +89 -99
- package/components/table/selection-adapter.js +0 -2
- package/components/table/selection-shortcuts-hoc.js +159 -161
- package/components/table/selection.js +23 -31
- package/components/table/simple-table.js +16 -22
- package/components/table/smart-table.js +19 -26
- package/components/table/table.js +137 -146
- package/components/tabs/collapsible-more.js +34 -47
- package/components/tabs/collapsible-tab.js +28 -33
- package/components/tabs/collapsible-tabs.js +18 -26
- package/components/tabs/custom-item.js +3 -6
- package/components/tabs/dumb-tabs.js +48 -64
- package/components/tabs/smart-tabs.js +14 -23
- package/components/tabs/tab-link.js +0 -2
- package/components/tabs/tab.js +0 -1
- package/components/tabs/tabs.js +0 -7
- package/components/tag/tag.js +30 -35
- package/components/tags-input/tags-input.js +192 -218
- package/components/tags-list/tags-list.js +26 -31
- package/components/text/text.js +16 -19
- package/components/toggle/toggle.js +19 -23
- package/components/tooltip/tooltip.js +110 -121
- package/components/upload/upload.js +19 -28
- package/components/user-agreement/service.js +247 -252
- package/components/user-agreement/toolbox.eula.js +160 -1
- package/components/user-agreement/user-agreement.js +23 -32
- package/components/user-card/card.js +0 -5
- package/components/user-card/smart-user-card-tooltip.js +41 -50
- package/components/user-card/tooltip.js +32 -38
- package/components/user-card/user-card.js +0 -5
- package/package.json +9 -3
- package/components/_helpers/_rollupPluginBabelHelpers.js +0 -72
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
2
|
import { PureComponent } from 'react';
|
|
5
3
|
import classNames from 'classnames';
|
|
@@ -17,8 +15,6 @@ export { default as Container } from './container.js';
|
|
|
17
15
|
import { Color } from '../icon/icon.constants.js';
|
|
18
16
|
import 'util-deprecate';
|
|
19
17
|
import '../_helpers/icon-svg.js';
|
|
20
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
21
|
-
import 'core-js/modules/es.string.replace.js';
|
|
22
18
|
import '../global/memoize.js';
|
|
23
19
|
import '@jetbrains/icons/chevron-down';
|
|
24
20
|
import '@jetbrains/icons/chevron-12px-down';
|
|
@@ -38,7 +34,6 @@ import '../global/sniffer.js';
|
|
|
38
34
|
import 'sniffr';
|
|
39
35
|
import '../tab-trap/tab-trap.js';
|
|
40
36
|
import '../popup/position.js';
|
|
41
|
-
import 'core-js/modules/es.array.sort.js';
|
|
42
37
|
import '../popup/popup.consts.js';
|
|
43
38
|
import '../popup/position-css.js';
|
|
44
39
|
|
|
@@ -87,36 +82,22 @@ const TypeToIconColor = {
|
|
|
87
82
|
* **Alert** is a component for displaying contextual notifications. If you want to display a stack of notifications, use **Alerts** instead.
|
|
88
83
|
*/
|
|
89
84
|
class Alert extends PureComponent {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
});
|
|
107
|
-
/**
|
|
108
|
-
* @param {SyntheticEvent} evt
|
|
109
|
-
* @private
|
|
110
|
-
*/
|
|
111
|
-
_defineProperty(this, "_handleCaptionsLinksClick", evt => {
|
|
112
|
-
if (evt.target instanceof Element && evt.target.matches('a')) {
|
|
113
|
-
this.closeRequest(evt);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
_defineProperty(this, "storeAlertRef", node => {
|
|
117
|
-
this.node = node;
|
|
118
|
-
});
|
|
119
|
-
}
|
|
85
|
+
/** @override */
|
|
86
|
+
static defaultProps = {
|
|
87
|
+
theme: Theme.DARK,
|
|
88
|
+
closeable: true,
|
|
89
|
+
showWithAnimation: true,
|
|
90
|
+
type: AlertType.MESSAGE,
|
|
91
|
+
inline: true,
|
|
92
|
+
isClosing: false,
|
|
93
|
+
isShaking: false,
|
|
94
|
+
timeout: 0,
|
|
95
|
+
onClose: () => {},
|
|
96
|
+
onCloseRequest: () => {}
|
|
97
|
+
};
|
|
98
|
+
state = {
|
|
99
|
+
height: null
|
|
100
|
+
};
|
|
120
101
|
componentDidMount() {
|
|
121
102
|
if (this.props.timeout > 0) {
|
|
122
103
|
this.hideTimeout = window.setTimeout(this.closeRequest, this.props.timeout);
|
|
@@ -130,12 +111,34 @@ class Alert extends PureComponent {
|
|
|
130
111
|
componentWillUnmount() {
|
|
131
112
|
clearTimeout(this.hideTimeout);
|
|
132
113
|
}
|
|
114
|
+
node;
|
|
115
|
+
hideTimeout;
|
|
116
|
+
static Type = AlertType;
|
|
117
|
+
closeRequest = event => {
|
|
118
|
+
this.startCloseAnimation();
|
|
119
|
+
return this.props.onCloseRequest(event);
|
|
120
|
+
};
|
|
121
|
+
startCloseAnimation = () => {
|
|
122
|
+
const height = getRect(this.node).height;
|
|
123
|
+
this.setState({
|
|
124
|
+
height
|
|
125
|
+
});
|
|
126
|
+
};
|
|
133
127
|
_close() {
|
|
134
128
|
this.startCloseAnimation();
|
|
135
129
|
setTimeout(() => {
|
|
136
130
|
this.props.onClose();
|
|
137
131
|
}, ANIMATION_TIME);
|
|
138
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* @param {SyntheticEvent} evt
|
|
135
|
+
* @private
|
|
136
|
+
*/
|
|
137
|
+
_handleCaptionsLinksClick = evt => {
|
|
138
|
+
if (evt.target instanceof Element && evt.target.matches('a')) {
|
|
139
|
+
this.closeRequest(evt);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
139
142
|
/**
|
|
140
143
|
* @private
|
|
141
144
|
*/
|
|
@@ -170,6 +173,9 @@ class Alert extends PureComponent {
|
|
|
170
173
|
}
|
|
171
174
|
return '';
|
|
172
175
|
}
|
|
176
|
+
storeAlertRef = node => {
|
|
177
|
+
this.node = node;
|
|
178
|
+
};
|
|
173
179
|
render() {
|
|
174
180
|
const {
|
|
175
181
|
type,
|
|
@@ -211,19 +217,5 @@ class Alert extends PureComponent {
|
|
|
211
217
|
});
|
|
212
218
|
}
|
|
213
219
|
}
|
|
214
|
-
/** @override */
|
|
215
|
-
_defineProperty(Alert, "defaultProps", {
|
|
216
|
-
theme: Theme.DARK,
|
|
217
|
-
closeable: true,
|
|
218
|
-
showWithAnimation: true,
|
|
219
|
-
type: AlertType.MESSAGE,
|
|
220
|
-
inline: true,
|
|
221
|
-
isClosing: false,
|
|
222
|
-
isShaking: false,
|
|
223
|
-
timeout: 0,
|
|
224
|
-
onClose: () => {},
|
|
225
|
-
onCloseRequest: () => {}
|
|
226
|
-
});
|
|
227
|
-
_defineProperty(Alert, "Type", AlertType);
|
|
228
220
|
|
|
229
221
|
export { ANIMATION_TIME, AlertType, Alert as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { PureComponent, Children, isValidElement, cloneElement } from 'react';
|
|
4
3
|
import { createPortal } from 'react-dom';
|
|
@@ -6,25 +5,23 @@ import classNames from 'classnames';
|
|
|
6
5
|
|
|
7
6
|
var styles = {"alertContainer":"ring-container-alertContainer","alertInContainer":"ring-container-alertInContainer ring-alert-alert"};
|
|
8
7
|
|
|
9
|
-
const _excluded = ["children", "className"];
|
|
10
8
|
class Alerts extends PureComponent {
|
|
11
9
|
render() {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
restProps = _objectWithoutProperties(_this$props, _excluded);
|
|
10
|
+
const {
|
|
11
|
+
children,
|
|
12
|
+
className,
|
|
13
|
+
...restProps
|
|
14
|
+
} = this.props;
|
|
18
15
|
const classes = classNames(styles.alertContainer, className);
|
|
19
16
|
const show = Children.count(children) > 0;
|
|
20
17
|
if (!show) {
|
|
21
18
|
return null;
|
|
22
19
|
}
|
|
23
|
-
return /*#__PURE__*/createPortal(jsx("div",
|
|
20
|
+
return /*#__PURE__*/createPortal(jsx("div", {
|
|
24
21
|
"data-test": 'alert-container',
|
|
25
22
|
className: classes,
|
|
26
|
-
"aria-live": 'polite'
|
|
27
|
-
|
|
23
|
+
"aria-live": 'polite',
|
|
24
|
+
...restProps,
|
|
28
25
|
children: Children.map(children, child => {
|
|
29
26
|
if (! /*#__PURE__*/isValidElement(child)) {
|
|
30
27
|
return child;
|
|
@@ -34,7 +31,7 @@ class Alerts extends PureComponent {
|
|
|
34
31
|
className: alertClassNames
|
|
35
32
|
});
|
|
36
33
|
})
|
|
37
|
-
})
|
|
34
|
+
}), document.body);
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
37
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty, a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { jsx } from 'react/jsx-runtime';
|
|
4
2
|
import { createRoot } from 'react-dom/client';
|
|
5
3
|
import getUID from '../global/get-uid.js';
|
|
@@ -15,8 +13,6 @@ import '../icon/icon.js';
|
|
|
15
13
|
import 'util-deprecate';
|
|
16
14
|
import '../icon/icon.constants.js';
|
|
17
15
|
import '../_helpers/icon-svg.js';
|
|
18
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
19
|
-
import 'core-js/modules/es.string.replace.js';
|
|
20
16
|
import '../global/memoize.js';
|
|
21
17
|
import '../loader-inline/loader-inline.js';
|
|
22
18
|
import '../global/data-tests.js';
|
|
@@ -40,24 +36,19 @@ import '../global/sniffer.js';
|
|
|
40
36
|
import 'sniffr';
|
|
41
37
|
import '../tab-trap/tab-trap.js';
|
|
42
38
|
import '../popup/position.js';
|
|
43
|
-
import 'core-js/modules/es.array.sort.js';
|
|
44
39
|
import '../popup/popup.consts.js';
|
|
45
40
|
import '../popup/position-css.js';
|
|
46
41
|
|
|
47
|
-
const _excluded = ["message", "key"],
|
|
48
|
-
_excluded2 = ["onCloseRequest", "onClose"];
|
|
49
42
|
const DEFAULT_ALERT_TIMEOUT = 10000; // 10 seconds
|
|
50
43
|
/**
|
|
51
44
|
* @name Alert Service
|
|
52
45
|
*/
|
|
53
46
|
class AlertService {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
_defineProperty(this, "reactRoot", createRoot(this.containerElement));
|
|
60
|
-
}
|
|
47
|
+
defaultTimeout = DEFAULT_ALERT_TIMEOUT;
|
|
48
|
+
// This alerts are stored in inverse order (last shown is first in array)
|
|
49
|
+
showingAlerts = [];
|
|
50
|
+
containerElement = document.createElement('div');
|
|
51
|
+
reactRoot = createRoot(this.containerElement);
|
|
61
52
|
_getShowingAlerts() {
|
|
62
53
|
return [...this.showingAlerts];
|
|
63
54
|
}
|
|
@@ -68,13 +59,14 @@ class AlertService {
|
|
|
68
59
|
return jsx(Alerts, {
|
|
69
60
|
children: alerts.map(alert => {
|
|
70
61
|
const {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return jsx(Alert,
|
|
62
|
+
message,
|
|
63
|
+
key,
|
|
64
|
+
...rest
|
|
65
|
+
} = alert;
|
|
66
|
+
return jsx(Alert, {
|
|
67
|
+
...rest,
|
|
76
68
|
children: message
|
|
77
|
-
}
|
|
69
|
+
}, key);
|
|
78
70
|
})
|
|
79
71
|
});
|
|
80
72
|
}
|
|
@@ -109,14 +101,12 @@ class AlertService {
|
|
|
109
101
|
this.renderAlerts();
|
|
110
102
|
}, ANIMATION_TIME);
|
|
111
103
|
}
|
|
112
|
-
addAlert(message, type) {
|
|
113
|
-
let timeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.defaultTimeout;
|
|
114
|
-
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
104
|
+
addAlert(message, type, timeout = this.defaultTimeout, options = {}) {
|
|
115
105
|
const {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
106
|
+
onCloseRequest,
|
|
107
|
+
onClose,
|
|
108
|
+
...restOptions
|
|
109
|
+
} = options;
|
|
120
110
|
const sameAlert = this.findSameAlert(message, type);
|
|
121
111
|
if (sameAlert) {
|
|
122
112
|
sameAlert.isShaking = true;
|
|
@@ -124,21 +114,22 @@ class AlertService {
|
|
|
124
114
|
this.stopShakingWhenAnimationDone(sameAlert);
|
|
125
115
|
return sameAlert.key;
|
|
126
116
|
}
|
|
127
|
-
const alert =
|
|
117
|
+
const alert = {
|
|
128
118
|
key: getUID('alert-service-'),
|
|
129
119
|
message,
|
|
130
120
|
type,
|
|
131
121
|
timeout,
|
|
132
122
|
isClosing: false,
|
|
133
123
|
onCloseRequest: () => {
|
|
134
|
-
onCloseRequest
|
|
124
|
+
onCloseRequest?.();
|
|
135
125
|
this.startAlertClosing(alert);
|
|
136
126
|
},
|
|
137
127
|
onClose: () => {
|
|
138
|
-
onClose
|
|
128
|
+
onClose?.();
|
|
139
129
|
this.removeWithoutAnimation(alert.key);
|
|
140
|
-
}
|
|
141
|
-
|
|
130
|
+
},
|
|
131
|
+
...restOptions
|
|
132
|
+
};
|
|
142
133
|
this.showingAlerts = [alert, ...this.showingAlerts];
|
|
143
134
|
this.renderAlerts();
|
|
144
135
|
return alert.key;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { _ as _defineProperty, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
|
|
3
1
|
const DEFAULT_FLUSH_INTERVAL = 10000;
|
|
4
2
|
const DEFAULT_FLUSH_MAX_PACK_SIZE = 100;
|
|
5
3
|
class AnalyticsCustomPlugin {
|
|
4
|
+
_data;
|
|
5
|
+
_flush;
|
|
6
|
+
_isDevelopment;
|
|
7
|
+
_flushInterval;
|
|
8
|
+
_flushMaxPackSize;
|
|
9
|
+
_hasSendSchedule;
|
|
6
10
|
constructor(send, isDevelopment, flushInterval) {
|
|
7
|
-
_defineProperty(this, "_data", void 0);
|
|
8
|
-
_defineProperty(this, "_flush", void 0);
|
|
9
|
-
_defineProperty(this, "_isDevelopment", void 0);
|
|
10
|
-
_defineProperty(this, "_flushInterval", void 0);
|
|
11
|
-
_defineProperty(this, "_flushMaxPackSize", void 0);
|
|
12
|
-
_defineProperty(this, "_hasSendSchedule", void 0);
|
|
13
11
|
this._data = [];
|
|
14
12
|
this.config({
|
|
15
13
|
send,
|
|
@@ -35,10 +33,7 @@ class AnalyticsCustomPlugin {
|
|
|
35
33
|
this._processEvent('page', 'view', data);
|
|
36
34
|
}
|
|
37
35
|
_initSendSchedule() {
|
|
38
|
-
window.addEventListener('beforeunload', () =>
|
|
39
|
-
var _this$_flush;
|
|
40
|
-
return (_this$_flush = this._flush) === null || _this$_flush === void 0 ? void 0 : _this$_flush.call(this);
|
|
41
|
-
});
|
|
36
|
+
window.addEventListener('beforeunload', () => this._flush?.());
|
|
42
37
|
if (this._flush) {
|
|
43
38
|
setInterval(this._flush, this._flushInterval);
|
|
44
39
|
}
|
|
@@ -56,15 +51,15 @@ class AnalyticsCustomPlugin {
|
|
|
56
51
|
action,
|
|
57
52
|
timestamp: Date.now()
|
|
58
53
|
};
|
|
59
|
-
this._addDataToFlushingPack(data ?
|
|
54
|
+
this._addDataToFlushingPack(data ? {
|
|
55
|
+
...baseSendingData,
|
|
60
56
|
data
|
|
61
|
-
}
|
|
57
|
+
} : baseSendingData);
|
|
62
58
|
}
|
|
63
59
|
_addDataToFlushingPack(sendingData) {
|
|
64
60
|
this._data.push(sendingData);
|
|
65
|
-
if (this._flushMaxPackSize && this._data.length >= this._flushMaxPackSize) {
|
|
66
|
-
|
|
67
|
-
(_this$_flush2 = this._flush) === null || _this$_flush2 === void 0 || _this$_flush2.call(this);
|
|
61
|
+
if (this._flushMaxPackSize !== undefined && this._data.length >= this._flushMaxPackSize) {
|
|
62
|
+
this._flush?.();
|
|
68
63
|
}
|
|
69
64
|
}
|
|
70
65
|
}
|