@jetbrains/ring-ui 5.0.35 → 5.0.37
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/date-picker/date-popup.js +3 -1
- package/components/editable-heading/editable-heading.css +69 -0
- package/components/editable-heading/editable-heading.d.ts +21 -0
- package/components/editable-heading/editable-heading.js +34 -0
- package/components/input/input.css +2 -0
- package/components/query-assist/query-assist.js +1 -1
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -4
- package/dist/_helpers/anchor.js +0 -1
- package/dist/_helpers/card.js +0 -3
- package/dist/_helpers/dialog__body-scroll-preventer.js +0 -11
- package/dist/_helpers/footer.js +2 -13
- package/dist/_helpers/query-assist__suggestions.js +0 -10
- package/dist/_helpers/select__filter.js +0 -11
- package/dist/_helpers/services-link.js +0 -2
- package/dist/_helpers/sidebar.js +0 -12
- package/dist/_helpers/theme.js +0 -3
- package/dist/_helpers/title.js +0 -9
- package/dist/alert/alert.js +2 -32
- package/dist/alert/container.js +0 -5
- package/dist/alert-service/alert-service.js +0 -26
- package/dist/analytics/analytics.js +0 -22
- package/dist/analytics/analytics__custom-plugin.js +0 -38
- package/dist/analytics/analytics__fus-plugin.js +0 -20
- package/dist/analytics/analytics__ga-plugin.js +0 -13
- package/dist/analytics/analytics__plugin-utils.js +0 -8
- package/dist/analytics-ng/analytics-ng.js +3 -9
- package/dist/auth/auth.js +2 -3
- package/dist/auth/auth__core.js +30 -243
- package/dist/auth/background-flow.js +2 -25
- package/dist/auth/down-notification.js +0 -7
- package/dist/auth/iframe-flow.js +2 -26
- package/dist/auth/landing.js +2 -6
- package/dist/auth/request-builder.js +0 -11
- package/dist/auth/response-parser.js +4 -26
- package/dist/auth/storage.js +4 -60
- package/dist/auth/token-validator.js +6 -42
- package/dist/auth/window-flow.js +2 -34
- package/dist/auth-dialog/auth-dialog.js +2 -12
- package/dist/auth-dialog-service/auth-dialog-service.js +2 -4
- package/dist/auth-ng/auth-ng.js +6 -22
- package/dist/auth-ng/auth-ng.mock.js +0 -4
- package/dist/autofocus-ng/autofocus-ng.js +0 -5
- package/dist/avatar/avatar.js +4 -17
- package/dist/avatar/fallback-avatar.js +2 -9
- package/dist/avatar-editor-ng/avatar-editor-ng.js +1 -17
- package/dist/badge/badge.js +0 -3
- package/dist/button/button.js +0 -8
- package/dist/button-group/button-group.js +0 -3
- package/dist/button-group/caption.js +0 -2
- package/dist/button-group-ng/button-group-ng.js +0 -4
- package/dist/button-ng/button-ng.js +3 -21
- package/dist/button-set/button-set.js +0 -3
- package/dist/button-set-ng/button-set-ng.js +0 -2
- package/dist/button-toolbar/button-toolbar.js +0 -3
- package/dist/button-toolbar-ng/button-toolbar-ng.js +0 -2
- package/dist/caret/caret.js +2 -53
- package/dist/checkbox/checkbox.js +0 -12
- package/dist/code/code.js +3 -25
- package/dist/compiler-ng/compiler-ng.js +0 -5
- package/dist/confirm/confirm.js +0 -6
- package/dist/confirm-service/confirm-service.js +10 -8
- package/dist/content-layout/content-layout.js +0 -7
- package/dist/contenteditable/contenteditable.js +6 -13
- package/dist/data-list/data-list.js +4 -28
- package/dist/data-list/item.js +0 -15
- package/dist/data-list/selection.js +0 -27
- package/dist/date-picker/consts.js +0 -7
- package/dist/date-picker/date-input.js +0 -20
- package/dist/date-picker/date-picker.js +2 -36
- package/dist/date-picker/date-popup.js +21 -72
- package/dist/date-picker/day.js +0 -14
- package/dist/date-picker/month-names.js +0 -9
- package/dist/date-picker/month-slider.js +0 -10
- package/dist/date-picker/month.js +2 -4
- package/dist/date-picker/months.js +6 -13
- package/dist/date-picker/years.js +0 -14
- package/dist/dialog/dialog.js +0 -19
- package/dist/dialog-ng/dialog-ng.js +17 -105
- package/dist/docked-panel-ng/docked-panel-ng.js +6 -29
- package/dist/dropdown/dropdown.js +2 -33
- package/dist/dropdown-menu/dropdown-menu.js +4 -8
- package/dist/editable-heading/editable-heading.d.ts +21 -0
- package/dist/editable-heading/editable-heading.js +85 -0
- package/dist/error-bubble/error-bubble.js +2 -4
- package/dist/error-message/error-message.js +0 -3
- package/dist/footer-ng/footer-ng.js +0 -13
- package/dist/form-ng/form-ng.js +1 -21
- package/dist/global/angular-component-factory.js +0 -10
- package/dist/global/compose.js +0 -1
- package/dist/global/composeRefs.js +0 -1
- package/dist/global/controls-height.js +0 -2
- package/dist/global/create-stateful-context.js +0 -5
- package/dist/global/data-tests.js +0 -4
- package/dist/global/dom.js +2 -11
- package/dist/global/focus-sensor-hoc.js +4 -33
- package/dist/global/fuzzy-highlight.js +2 -16
- package/dist/global/get-event-key.js +8 -17
- package/dist/global/get-uid.js +0 -2
- package/dist/global/linear-function.js +0 -2
- package/dist/global/listeners.js +0 -13
- package/dist/global/memoize.js +0 -2
- package/dist/global/normalize-indent.js +2 -5
- package/dist/global/react-dom-renderer.js +0 -8
- package/dist/global/react-render-adapter.js +0 -7
- package/dist/global/rerender-hoc.js +0 -7
- package/dist/global/ring-angular-component.js +0 -5
- package/dist/global/schedule-raf.js +0 -5
- package/dist/global/trivial-template-tag.js +2 -3
- package/dist/global/url.js +0 -27
- package/dist/grid/col.js +0 -4
- package/dist/grid/grid.js +0 -3
- package/dist/grid/row.js +0 -5
- package/dist/group/group.js +0 -3
- package/dist/header/header.js +0 -5
- package/dist/header/logo.js +0 -4
- package/dist/header/profile.js +0 -7
- package/dist/header/services.js +0 -11
- package/dist/header/smart-profile.js +4 -18
- package/dist/header/smart-services.js +0 -17
- package/dist/header/tray-icon.js +2 -3
- package/dist/header/tray.js +0 -3
- package/dist/heading/heading.js +0 -5
- package/dist/http/http.js +20 -65
- package/dist/http/http.mock.js +2 -14
- package/dist/hub-source/hub-source.js +0 -32
- package/dist/hub-source/hub-source__user.js +0 -1
- package/dist/hub-source/hub-source__users-groups.js +0 -12
- package/dist/icon/icon.js +0 -13
- package/dist/icon/icon__constants.js +0 -4
- package/dist/icon/icon__svg.js +0 -10
- package/dist/icon-ng/icon-ng.js +2 -7
- package/dist/input/input.js +0 -30
- package/dist/input-ng/input-ng.js +0 -17
- package/dist/island/adaptive-island-hoc.js +0 -7
- package/dist/island/content.js +0 -25
- package/dist/island/header.js +0 -7
- package/dist/island/island.js +0 -4
- package/dist/island-legacy/content-legacy.js +0 -2
- package/dist/island-legacy/header-legacy.js +0 -2
- package/dist/island-legacy/island-legacy.js +0 -2
- package/dist/island-ng/island-content-ng.js +0 -3
- package/dist/link/clickableLink.js +2 -10
- package/dist/link/link.js +2 -9
- package/dist/link-ng/link-ng.js +0 -2
- package/dist/list/consts.js +0 -4
- package/dist/list/list.js +6 -128
- package/dist/list/list__custom.js +0 -4
- package/dist/list/list__hint.js +0 -3
- package/dist/list/list__item.js +0 -8
- package/dist/list/list__link.js +2 -3
- package/dist/list/list__separator.js +0 -1
- package/dist/list/list__title.js +0 -1
- package/dist/list/list__users-groups-source.js +4 -17
- package/dist/loader/loader.js +0 -10
- package/dist/loader/loader__core.js +6 -70
- package/dist/loader-inline/loader-inline.js +0 -3
- package/dist/loader-ng/loader-ng.js +0 -7
- package/dist/loader-screen/loader-screen.js +0 -3
- package/dist/loader-screen-ng/loader-screen-ng.js +2 -14
- package/dist/login-dialog/login-dialog.js +0 -15
- package/dist/login-dialog/service.js +2 -4
- package/dist/markdown/code.js +0 -2
- package/dist/markdown/heading.js +0 -1
- package/dist/markdown/link.js +0 -1
- package/dist/markdown/markdown.js +0 -2
- package/dist/message/message.js +0 -24
- package/dist/message-bundle-ng/message-bundle-ng.js +2 -45
- package/dist/old-browsers-message/old-browsers-message.js +2 -21
- package/dist/old-browsers-message/white-list.js +2 -6
- package/dist/pager/pager.js +2 -39
- package/dist/panel/panel.js +0 -3
- package/dist/permissions/permissions.js +1 -43
- package/dist/permissions/permissions__cache.js +12 -63
- package/dist/permissions-ng/permissions-ng.js +11 -19
- package/dist/place-under-ng/place-under-ng.js +0 -19
- package/dist/popup/popup.consts.js +0 -11
- package/dist/popup/popup.js +6 -68
- package/dist/popup/position.js +8 -30
- package/dist/popup-menu/popup-menu.js +4 -13
- package/dist/progress-bar/progress-bar.js +0 -14
- package/dist/promised-click-ng/promised-click-ng.js +3 -22
- package/dist/query-assist/query-assist.js +17 -201
- package/dist/radio/radio.js +0 -6
- package/dist/radio/radio__item.js +0 -9
- package/dist/radio-ng/radio-ng.js +0 -4
- package/dist/save-field-ng/save-field-ng.js +1 -37
- package/dist/select/select.js +18 -208
- package/dist/select/select__popup.js +4 -76
- package/dist/select-ng/select-ng.js +18 -74
- package/dist/select-ng/select-ng__lazy.js +2 -17
- package/dist/select-ng/select-ng__options.js +3 -29
- package/dist/shortcuts/core.js +4 -56
- package/dist/shortcuts/shortcuts-hoc.js +0 -4
- package/dist/shortcuts/shortcuts.js +0 -10
- package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +0 -13
- package/dist/shortcuts-ng/shortcuts-ng.js +16 -46
- package/dist/sidebar-ng/sidebar-ng.js +2 -12
- package/dist/storage/storage.js +2 -5
- package/dist/storage/storage__fallback.js +2 -48
- package/dist/storage/storage__local.js +0 -23
- package/dist/style.css +1 -1
- package/dist/tab-trap/tab-trap.js +0 -37
- package/dist/table/cell.js +0 -2
- package/dist/table/disable-hover-hoc.js +0 -9
- package/dist/table/header-cell.js +0 -8
- package/dist/table/header.js +0 -16
- package/dist/table/multitable.js +0 -23
- package/dist/table/row-with-focus-sensor.js +0 -12
- package/dist/table/row.js +0 -18
- package/dist/table/selection-adapter.js +0 -2
- package/dist/table/selection-shortcuts-hoc.js +8 -42
- package/dist/table/selection.js +0 -50
- package/dist/table/smart-table.js +0 -9
- package/dist/table/table.js +6 -37
- package/dist/table-legacy-ng/table-legacy-ng.js +12 -42
- package/dist/table-legacy-ng/table-legacy-ng__selection-navigate-actions.js +0 -31
- package/dist/table-legacy-ng/table-legacy-ng__selection.js +0 -32
- package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +2 -5
- package/dist/tabs/collapsible-more.js +0 -5
- package/dist/tabs/collapsible-tab.js +0 -4
- package/dist/tabs/collapsible-tabs.js +8 -28
- package/dist/tabs/dumb-tabs.js +0 -8
- package/dist/tabs/smart-tabs.js +0 -6
- package/dist/tabs/tab-link.js +0 -1
- package/dist/tabs/tab.js +0 -2
- package/dist/tabs-ng/tabs-ng.js +13 -29
- package/dist/tag/tag.js +0 -24
- package/dist/tags-input/tags-input.js +0 -76
- package/dist/tags-list/tags-list.js +0 -6
- package/dist/template-ng/template-ng.js +0 -12
- package/dist/text/text.js +0 -3
- package/dist/theme-ng/theme-ng.js +0 -8
- package/dist/title-ng/title-ng.js +6 -17
- package/dist/toggle/toggle.js +0 -4
- package/dist/tooltip/tooltip.js +4 -35
- package/dist/tooltip-ng/tooltip-ng.js +2 -8
- package/dist/user-agreement/service.js +0 -62
- package/dist/user-agreement/user-agreement.js +0 -8
- package/dist/user-card/smart-user-card-tooltip.js +2 -8
- package/dist/user-card/tooltip.js +0 -3
- package/package.json +22 -22
package/dist/popup/popup.js
CHANGED
|
@@ -21,79 +21,58 @@ import 'sniffr';
|
|
|
21
21
|
var modules_2f69e2e2 = {"popup":"popup_rui_7cd4 font_rui_8bff","hidden":"hidden_rui_7cd4","showing":"showing_rui_7cd4","attached":"attached_rui_7cd4"};
|
|
22
22
|
|
|
23
23
|
const stop = e => e.stopPropagation();
|
|
24
|
-
|
|
25
24
|
const getPopupContainer = target => typeof target === 'string' ? document.querySelector(`[data-portaltarget=${target}]`) : target;
|
|
26
25
|
/**
|
|
27
26
|
* @constructor
|
|
28
27
|
* @name Popup
|
|
29
28
|
* @extends {ReactComponent}
|
|
30
29
|
*/
|
|
31
|
-
|
|
32
30
|
class Popup extends PureComponent {
|
|
33
31
|
constructor() {
|
|
34
32
|
super(...arguments);
|
|
35
|
-
|
|
36
33
|
_defineProperty(this, "state", {
|
|
37
34
|
display: Display.SHOWING
|
|
38
35
|
});
|
|
39
|
-
|
|
40
36
|
_defineProperty(this, "popup", void 0);
|
|
41
|
-
|
|
42
37
|
_defineProperty(this, "node", void 0);
|
|
43
|
-
|
|
44
38
|
_defineProperty(this, "parent", void 0);
|
|
45
|
-
|
|
46
39
|
_defineProperty(this, "container", void 0);
|
|
47
|
-
|
|
48
40
|
_defineProperty(this, "ringPopupTarget", void 0);
|
|
49
|
-
|
|
50
41
|
_defineProperty(this, "listeners", new Listeners());
|
|
51
|
-
|
|
52
42
|
_defineProperty(this, "redrawScheduler", scheduleRAF(true));
|
|
53
|
-
|
|
54
43
|
_defineProperty(this, "uid", getUID('popup-'));
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
_defineProperty(this, "calculateDisplay", prevState => ({
|
|
45
|
+
...prevState,
|
|
57
46
|
display: this.props.hidden ? Display.SHOWING : Display.SHOWN
|
|
58
47
|
}));
|
|
59
|
-
|
|
60
48
|
_defineProperty(this, "portalRef", el => {
|
|
61
49
|
this.node = el;
|
|
62
50
|
this.parent = el && el.parentElement;
|
|
63
|
-
|
|
64
51
|
if (el && this.getContainer()) {
|
|
65
52
|
this._redraw();
|
|
66
53
|
}
|
|
67
54
|
});
|
|
68
|
-
|
|
69
55
|
_defineProperty(this, "popupRef", el => {
|
|
70
56
|
this.popup = el;
|
|
71
|
-
|
|
72
57
|
this._redraw();
|
|
73
58
|
});
|
|
74
|
-
|
|
75
59
|
_defineProperty(this, "containerRef", el => {
|
|
76
60
|
this.container = el;
|
|
77
61
|
});
|
|
78
|
-
|
|
79
62
|
_defineProperty(this, "_updateDirection", newDirection => {
|
|
80
63
|
if (this.state.direction !== newDirection) {
|
|
81
64
|
this.setState({
|
|
82
65
|
direction: newDirection
|
|
83
66
|
});
|
|
84
|
-
|
|
85
67
|
if (this.props.onDirectionChange) {
|
|
86
68
|
this.props.onDirectionChange(newDirection);
|
|
87
69
|
}
|
|
88
70
|
}
|
|
89
71
|
});
|
|
90
|
-
|
|
91
72
|
_defineProperty(this, "_updatePosition", () => {
|
|
92
73
|
const popup = this.popup;
|
|
93
|
-
|
|
94
74
|
if (popup) {
|
|
95
75
|
popup.style.position = 'absolute';
|
|
96
|
-
|
|
97
76
|
if (this.isVisible()) {
|
|
98
77
|
const {
|
|
99
78
|
styles: style,
|
|
@@ -102,90 +81,69 @@ class Popup extends PureComponent {
|
|
|
102
81
|
Object.entries(style).forEach(_ref => {
|
|
103
82
|
let [key, value] = _ref;
|
|
104
83
|
const propKey = key;
|
|
105
|
-
|
|
106
84
|
if (typeof value === 'number') {
|
|
107
85
|
popup.style[propKey] = `${value}px`;
|
|
108
86
|
} else {
|
|
109
87
|
popup.style[propKey] = value.toString();
|
|
110
88
|
}
|
|
111
89
|
});
|
|
112
|
-
|
|
113
90
|
if (direction != null) {
|
|
114
91
|
this._updateDirection(direction);
|
|
115
92
|
}
|
|
116
93
|
}
|
|
117
|
-
|
|
118
94
|
this.setState(this.calculateDisplay);
|
|
119
95
|
}
|
|
120
96
|
});
|
|
121
|
-
|
|
122
97
|
_defineProperty(this, "_redraw", () => {
|
|
123
98
|
if (this.isVisible()) {
|
|
124
99
|
this.redrawScheduler(this._updatePosition);
|
|
125
100
|
}
|
|
126
101
|
});
|
|
127
|
-
|
|
128
102
|
_defineProperty(this, "_listenersEnabled", void 0);
|
|
129
|
-
|
|
130
103
|
_defineProperty(this, "_onEscPress", evt => {
|
|
131
104
|
this.props.onEscPress(evt);
|
|
132
|
-
|
|
133
105
|
this._onCloseAttempt(evt, true);
|
|
134
106
|
});
|
|
135
|
-
|
|
136
107
|
_defineProperty(this, "_onDocumentClick", evt => {
|
|
137
108
|
var _this$_getAnchor;
|
|
138
|
-
|
|
139
109
|
if (this.container && evt.target instanceof Node && this.container.contains(evt.target) || !this._listenersEnabled || this.props.dontCloseOnAnchorClick && evt.target instanceof Node && (_this$_getAnchor = this._getAnchor()) !== null && _this$_getAnchor !== void 0 && _this$_getAnchor.contains(evt.target)) {
|
|
140
110
|
return;
|
|
141
111
|
}
|
|
142
|
-
|
|
143
112
|
this.props.onOutsideClick(evt);
|
|
144
|
-
|
|
145
113
|
this._onCloseAttempt(evt, false);
|
|
146
114
|
});
|
|
147
|
-
|
|
148
115
|
_defineProperty(this, "shortcutsScope", this.uid);
|
|
149
|
-
|
|
150
116
|
_defineProperty(this, "shortcutsMap", {
|
|
151
117
|
esc: this._onEscPress
|
|
152
118
|
});
|
|
153
119
|
}
|
|
154
|
-
|
|
155
120
|
componentDidMount() {
|
|
156
121
|
if (!this.props.client) {
|
|
157
122
|
this.setState({
|
|
158
123
|
client: true
|
|
159
124
|
});
|
|
160
125
|
}
|
|
161
|
-
|
|
162
126
|
if (!this.props.hidden) {
|
|
163
127
|
this._setListenersEnabled(true);
|
|
164
128
|
}
|
|
165
129
|
}
|
|
166
|
-
|
|
167
130
|
componentDidUpdate(prevProps, prevState) {
|
|
168
131
|
const {
|
|
169
132
|
hidden
|
|
170
133
|
} = this.props;
|
|
171
|
-
|
|
172
134
|
if (this.props !== prevProps) {
|
|
173
135
|
if (prevProps.hidden !== hidden) {
|
|
174
136
|
this._setListenersEnabled(!hidden);
|
|
175
137
|
}
|
|
176
|
-
|
|
177
138
|
this._redraw();
|
|
178
139
|
}
|
|
179
|
-
|
|
180
140
|
if (this.props.onShow && !hidden && this.state.display === Display.SHOWN && (prevProps.hidden || prevState.display !== Display.SHOWN)) {
|
|
181
141
|
this.props.onShow();
|
|
182
142
|
}
|
|
183
143
|
}
|
|
184
|
-
|
|
185
144
|
componentWillUnmount() {
|
|
186
145
|
this._setListenersEnabled(false);
|
|
187
146
|
}
|
|
188
|
-
|
|
189
147
|
shouldUseShortcuts() {
|
|
190
148
|
const {
|
|
191
149
|
shortcuts,
|
|
@@ -193,12 +151,10 @@ class Popup extends PureComponent {
|
|
|
193
151
|
} = this.props;
|
|
194
152
|
return shortcuts && !hidden;
|
|
195
153
|
}
|
|
196
|
-
|
|
197
154
|
getContainer() {
|
|
198
155
|
const target = this.props.target || this.ringPopupTarget;
|
|
199
156
|
return target && getPopupContainer(target);
|
|
200
157
|
}
|
|
201
|
-
|
|
202
158
|
position() {
|
|
203
159
|
const {
|
|
204
160
|
directions,
|
|
@@ -227,11 +183,9 @@ class Popup extends PureComponent {
|
|
|
227
183
|
minWidth
|
|
228
184
|
});
|
|
229
185
|
}
|
|
230
|
-
|
|
231
186
|
_getAnchor() {
|
|
232
187
|
return this.props.anchorElement || this.parent;
|
|
233
188
|
}
|
|
234
|
-
|
|
235
189
|
/**
|
|
236
190
|
* @param {boolean} enable
|
|
237
191
|
* @private
|
|
@@ -241,15 +195,11 @@ class Popup extends PureComponent {
|
|
|
241
195
|
setTimeout(() => {
|
|
242
196
|
this._listenersEnabled = true;
|
|
243
197
|
this.listeners.add(window, 'resize', this._redraw);
|
|
244
|
-
|
|
245
198
|
if (this.props.autoPositioningOnScroll) {
|
|
246
199
|
this.listeners.add(window, 'scroll', this._redraw);
|
|
247
200
|
}
|
|
248
|
-
|
|
249
201
|
this.listeners.add(document, 'pointerdown', this._onDocumentClick, true);
|
|
250
|
-
|
|
251
202
|
let el = this._getAnchor();
|
|
252
|
-
|
|
253
203
|
while (el) {
|
|
254
204
|
this.listeners.add(el, 'scroll', this._redraw);
|
|
255
205
|
el = el.parentElement;
|
|
@@ -257,7 +207,6 @@ class Popup extends PureComponent {
|
|
|
257
207
|
}, 0);
|
|
258
208
|
return;
|
|
259
209
|
}
|
|
260
|
-
|
|
261
210
|
if (!enable && this._listenersEnabled) {
|
|
262
211
|
this.listeners.removeAll();
|
|
263
212
|
this._listenersEnabled = false;
|
|
@@ -267,16 +216,12 @@ class Popup extends PureComponent {
|
|
|
267
216
|
* Returns visibility state
|
|
268
217
|
* @return {boolean}
|
|
269
218
|
*/
|
|
270
|
-
|
|
271
|
-
|
|
272
219
|
isVisible() {
|
|
273
220
|
return !this.props.hidden;
|
|
274
221
|
}
|
|
275
|
-
|
|
276
222
|
_onCloseAttempt(evt, isEsc) {
|
|
277
223
|
this.props.onCloseAttempt(evt, isEsc);
|
|
278
224
|
}
|
|
279
|
-
|
|
280
225
|
getInternalContent() {
|
|
281
226
|
const {
|
|
282
227
|
trapFocus,
|
|
@@ -288,7 +233,6 @@ class Popup extends PureComponent {
|
|
|
288
233
|
focusBackOnExit: true
|
|
289
234
|
}, children) : children;
|
|
290
235
|
}
|
|
291
|
-
|
|
292
236
|
render() {
|
|
293
237
|
const {
|
|
294
238
|
className,
|
|
@@ -315,7 +259,8 @@ class Popup extends PureComponent {
|
|
|
315
259
|
this.ringPopupTarget = value;
|
|
316
260
|
return /*#__PURE__*/React.createElement("span", {
|
|
317
261
|
// prevent bubbling through portal
|
|
318
|
-
onClick: stop
|
|
262
|
+
onClick: stop
|
|
263
|
+
// This handler only blocks bubbling through React portal
|
|
319
264
|
,
|
|
320
265
|
role: "presentation",
|
|
321
266
|
ref: this.portalRef
|
|
@@ -338,25 +283,20 @@ class Popup extends PureComponent {
|
|
|
338
283
|
className: classes,
|
|
339
284
|
style: style,
|
|
340
285
|
onMouseDown: onMouseDown,
|
|
341
|
-
onMouseUp: onMouseUp
|
|
286
|
+
onMouseUp: onMouseUp
|
|
287
|
+
// mouse handlers are used to track clicking on inner elements
|
|
342
288
|
,
|
|
343
289
|
role: "presentation"
|
|
344
290
|
}, this.getInternalContent())), this.getContainer() || document.body));
|
|
345
291
|
});
|
|
346
292
|
}
|
|
347
|
-
|
|
348
293
|
}
|
|
349
|
-
|
|
350
294
|
_defineProperty(Popup, "defaultProps", {
|
|
351
295
|
shortcuts: true,
|
|
352
296
|
hidden: false,
|
|
353
|
-
|
|
354
297
|
onOutsideClick() {},
|
|
355
|
-
|
|
356
298
|
onEscPress() {},
|
|
357
|
-
|
|
358
299
|
onCloseAttempt() {},
|
|
359
|
-
|
|
360
300
|
dontCloseOnAnchorClick: false,
|
|
361
301
|
keepMounted: false,
|
|
362
302
|
directions: DEFAULT_DIRECTIONS,
|
|
@@ -372,14 +312,12 @@ _defineProperty(Popup, "defaultProps", {
|
|
|
372
312
|
autoFocusFirst: false,
|
|
373
313
|
legacy: false
|
|
374
314
|
});
|
|
375
|
-
|
|
376
315
|
_defineProperty(Popup, "PopupProps", {
|
|
377
316
|
Directions,
|
|
378
317
|
Dimension,
|
|
379
318
|
MinWidth,
|
|
380
319
|
MaxHeight
|
|
381
320
|
});
|
|
382
|
-
|
|
383
321
|
Popup.propTypes = {
|
|
384
322
|
anchorElement: PropTypes.instanceOf(Node),
|
|
385
323
|
target: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Element)]),
|
package/dist/popup/position.js
CHANGED
|
@@ -10,13 +10,11 @@ function getScrollingCoordinates(container) {
|
|
|
10
10
|
left: container.scrollLeft
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
|
|
14
13
|
return {
|
|
15
14
|
top: getDocumentScrollTop(),
|
|
16
15
|
left: getDocumentScrollLeft()
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
function getPositionStyles(popup, anchorRect, anchorLeft, anchorTop, offset) {
|
|
21
19
|
const popupWidth = popup.offsetWidth;
|
|
22
20
|
const popupHeight = popup.offsetHeight;
|
|
@@ -79,7 +77,6 @@ function getPositionStyles(popup, anchorRect, anchorLeft, anchorTop, offset) {
|
|
|
79
77
|
}
|
|
80
78
|
};
|
|
81
79
|
}
|
|
82
|
-
|
|
83
80
|
function verticalOverflow(styles, scrollingCoordinates, attrs) {
|
|
84
81
|
const containerHeight = attrs.container !== null ? attrs.container.clientHeight : getWindowHeight();
|
|
85
82
|
const viewportMinX = scrollingCoordinates.top + attrs.sidePadding;
|
|
@@ -90,7 +87,6 @@ function verticalOverflow(styles, scrollingCoordinates, attrs) {
|
|
|
90
87
|
const bottomOverflow = Math.max(verticalDiff, 0);
|
|
91
88
|
return topOverflow + bottomOverflow;
|
|
92
89
|
}
|
|
93
|
-
|
|
94
90
|
function horizontalOverflow(styles, scrollingCoordinates, attrs) {
|
|
95
91
|
const containerWidth = attrs.container !== null ? attrs.container.clientWidth : window.innerWidth;
|
|
96
92
|
const viewportMinY = scrollingCoordinates.left + attrs.sidePadding;
|
|
@@ -101,13 +97,11 @@ function horizontalOverflow(styles, scrollingCoordinates, attrs) {
|
|
|
101
97
|
const rightOverflow = Math.max(horizontalDiff, 0);
|
|
102
98
|
return leftOverflow + rightOverflow;
|
|
103
99
|
}
|
|
104
|
-
|
|
105
100
|
const positionPropKeys = ['directions', 'autoPositioning', 'autoCorrectTopOverflow', 'sidePadding', 'top', 'left', 'offset', 'maxHeight', 'minWidth'];
|
|
106
101
|
const defaultcontainerRect = {
|
|
107
102
|
top: 0,
|
|
108
103
|
left: 0
|
|
109
104
|
};
|
|
110
|
-
|
|
111
105
|
function handleTopOffScreen(_ref) {
|
|
112
106
|
let {
|
|
113
107
|
sidePadding,
|
|
@@ -127,59 +121,49 @@ function handleTopOffScreen(_ref) {
|
|
|
127
121
|
LEFT_TOP
|
|
128
122
|
} = Directions;
|
|
129
123
|
const openedToTop = direction != null && [TOP_LEFT, TOP_RIGHT, TOP_CENTER, RIGHT_TOP, LEFT_TOP].includes(direction);
|
|
130
|
-
|
|
131
124
|
if (!openedToTop) {
|
|
132
125
|
return styles;
|
|
133
126
|
}
|
|
134
|
-
|
|
135
127
|
const isAttachedToAnchorTop = direction != null && [TOP_LEFT, TOP_CENTER, TOP_RIGHT].includes(direction);
|
|
136
128
|
const attachingPointY = isAttachedToAnchorTop ? anchorRect.top : anchorRect.bottom;
|
|
137
129
|
const effectiveHeight = maxHeight && typeof maxHeight === 'number' ? Math.min(popupScrollHeight, maxHeight) : popupScrollHeight;
|
|
138
130
|
const hypotheticalTop = attachingPointY - effectiveHeight;
|
|
139
|
-
|
|
140
131
|
if (hypotheticalTop <= sidePadding) {
|
|
141
132
|
styles.top = sidePadding + scroll.top;
|
|
142
133
|
styles.maxHeight = attachingPointY - sidePadding + BORDER_COMPENSATION;
|
|
143
134
|
}
|
|
144
|
-
|
|
145
135
|
return styles;
|
|
146
136
|
}
|
|
147
|
-
|
|
148
137
|
function maxHeightForDirection(direction, anchorNode, containerNode) {
|
|
149
138
|
const container = containerNode || document.documentElement;
|
|
150
139
|
const domRect = anchorNode.getBoundingClientRect();
|
|
151
140
|
const containerRect = container.getBoundingClientRect();
|
|
152
141
|
const topMaxHeight = Math.max(domRect.top - containerRect.top, 0);
|
|
153
|
-
const containerHeight = Math.max(containerRect.height,
|
|
142
|
+
const containerHeight = Math.max(containerRect.height,
|
|
143
|
+
// XXX
|
|
154
144
|
// If container is the document element
|
|
155
145
|
// then we check client height too because we may have situation when
|
|
156
146
|
// "height" from "getBoundingClientRect" less then "clientHeight".
|
|
157
147
|
container === document.documentElement ? container.clientHeight : 0);
|
|
158
148
|
const bottomMaxHeight = Math.max(containerHeight - (topMaxHeight + domRect.height), 0);
|
|
159
|
-
|
|
160
149
|
switch (direction) {
|
|
161
150
|
case Directions.TOP_LEFT:
|
|
162
151
|
case Directions.TOP_CENTER:
|
|
163
152
|
case Directions.TOP_RIGHT:
|
|
164
153
|
return topMaxHeight;
|
|
165
|
-
|
|
166
154
|
case Directions.BOTTOM_LEFT:
|
|
167
155
|
case Directions.BOTTOM_CENTER:
|
|
168
156
|
case Directions.BOTTOM_RIGHT:
|
|
169
157
|
return bottomMaxHeight;
|
|
170
|
-
|
|
171
158
|
case Directions.LEFT_BOTTOM:
|
|
172
159
|
case Directions.RIGHT_BOTTOM:
|
|
173
160
|
return domRect.height + bottomMaxHeight;
|
|
174
|
-
|
|
175
161
|
case Directions.LEFT_TOP:
|
|
176
162
|
case Directions.RIGHT_TOP:
|
|
177
163
|
return domRect.height + topMaxHeight;
|
|
178
|
-
|
|
179
164
|
case Directions.RIGHT_CENTER:
|
|
180
165
|
case Directions.LEFT_CENTER:
|
|
181
166
|
return domRect.height / 2 + Math.min(bottomMaxHeight / 2, topMaxHeight / 2);
|
|
182
|
-
|
|
183
167
|
default:
|
|
184
168
|
return null;
|
|
185
169
|
}
|
|
@@ -210,18 +194,18 @@ function position(attrs) {
|
|
|
210
194
|
const scroll = getScrollingCoordinates(container);
|
|
211
195
|
const anchorLeft = anchorRect.left + scroll.left + left - containerRect.left;
|
|
212
196
|
const anchorTop = anchorRect.top + scroll.top + top - containerRect.top;
|
|
213
|
-
|
|
214
197
|
if (popup) {
|
|
215
|
-
const overflowAttrs = {
|
|
198
|
+
const overflowAttrs = {
|
|
199
|
+
...attrs,
|
|
216
200
|
popup
|
|
217
201
|
};
|
|
218
202
|
const directionsMatrix = getPositionStyles(popup, anchorRect, anchorLeft, anchorTop, offset);
|
|
219
|
-
|
|
220
203
|
if (!autoPositioning || directions.length === 1) {
|
|
221
204
|
styles = directionsMatrix[directions[0]];
|
|
222
205
|
chosenDirection = directions[0];
|
|
223
206
|
} else {
|
|
224
|
-
const sortedByIncreasingOverflow = directions.
|
|
207
|
+
const sortedByIncreasingOverflow = directions.
|
|
208
|
+
// Fall back to the first option
|
|
225
209
|
concat(directions[0]).filter(direction => directionsMatrix[direction]).map(direction => ({
|
|
226
210
|
styles: directionsMatrix[direction],
|
|
227
211
|
direction
|
|
@@ -238,26 +222,22 @@ function position(attrs) {
|
|
|
238
222
|
});
|
|
239
223
|
styles = sortedByIncreasingOverflow[0].styles;
|
|
240
224
|
chosenDirection = sortedByIncreasingOverflow[0].direction;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
|
|
225
|
+
}
|
|
226
|
+
// because of the anchor negative margin top and left also may become negative
|
|
244
227
|
['left', 'top'].forEach(key => {
|
|
245
228
|
if (styles[key] < 0) {
|
|
246
229
|
styles[key] = 0;
|
|
247
230
|
}
|
|
248
231
|
});
|
|
249
232
|
}
|
|
250
|
-
|
|
251
233
|
if (maxHeight === MaxHeight.SCREEN || maxHeight === 'screen') {
|
|
252
234
|
// this feature works properly only when direction is BOTTOM_* or *_BOTTOM
|
|
253
235
|
styles.maxHeight = window.innerHeight + scroll.top - styles.top - Dimension.MARGIN;
|
|
254
236
|
} else if (maxHeight) {
|
|
255
237
|
styles.maxHeight = maxHeight;
|
|
256
238
|
}
|
|
257
|
-
|
|
258
239
|
if (autoCorrectTopOverflow) {
|
|
259
240
|
var _popup$scrollHeight;
|
|
260
|
-
|
|
261
241
|
styles = handleTopOffScreen({
|
|
262
242
|
sidePadding,
|
|
263
243
|
styles,
|
|
@@ -268,13 +248,11 @@ function position(attrs) {
|
|
|
268
248
|
scroll
|
|
269
249
|
});
|
|
270
250
|
}
|
|
271
|
-
|
|
272
251
|
if (minWidth === MinWidth.TARGET || minWidth === 'target') {
|
|
273
252
|
styles.minWidth = anchorRect.width;
|
|
274
253
|
} else if (minWidth) {
|
|
275
254
|
styles.minWidth = anchorRect.width < minWidth ? minWidth : anchorRect.width;
|
|
276
255
|
}
|
|
277
|
-
|
|
278
256
|
return {
|
|
279
257
|
styles,
|
|
280
258
|
direction: chosenDirection
|
|
@@ -58,26 +58,20 @@ const {
|
|
|
58
58
|
/**
|
|
59
59
|
* @name Popup Menu
|
|
60
60
|
*/
|
|
61
|
-
|
|
62
61
|
class PopupMenu extends Popup {
|
|
63
62
|
constructor() {
|
|
64
63
|
super(...arguments);
|
|
65
|
-
|
|
66
64
|
_defineProperty(this, "onSelect", (item, event) => {
|
|
67
65
|
if (this.props.closeOnSelect) {
|
|
68
66
|
this._onCloseAttempt(event);
|
|
69
67
|
}
|
|
70
|
-
|
|
71
68
|
this.props.onSelect(item, event);
|
|
72
69
|
});
|
|
73
|
-
|
|
74
70
|
_defineProperty(this, "list", void 0);
|
|
75
|
-
|
|
76
71
|
_defineProperty(this, "listRef", el => {
|
|
77
72
|
this.list = el;
|
|
78
73
|
});
|
|
79
74
|
}
|
|
80
|
-
|
|
81
75
|
/** @override */
|
|
82
76
|
getInternalContent() {
|
|
83
77
|
const {
|
|
@@ -92,20 +86,17 @@ class PopupMenu extends Popup {
|
|
|
92
86
|
onSelect: this.onSelect
|
|
93
87
|
})));
|
|
94
88
|
}
|
|
95
|
-
|
|
96
89
|
}
|
|
97
|
-
|
|
98
90
|
_defineProperty(PopupMenu, "isItemType", List.isItemType);
|
|
99
|
-
|
|
100
91
|
_defineProperty(PopupMenu, "ListProps", List.ListProps);
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
_defineProperty(PopupMenu, "defaultProps", {
|
|
93
|
+
...List.defaultProps,
|
|
103
94
|
...Popup.defaultProps,
|
|
104
95
|
renderOptimization: false,
|
|
105
96
|
closeOnSelect: false
|
|
106
97
|
});
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
PopupMenu.propTypes = {
|
|
99
|
+
...popupPropTypes,
|
|
109
100
|
...List.propTypes,
|
|
110
101
|
closeOnSelect: PropTypes.bool
|
|
111
102
|
};
|
|
@@ -8,24 +8,18 @@ var modules_fb7af416 = {"dark":"dark_rui_eb55","unit":"8px","progressBar":"progr
|
|
|
8
8
|
/**
|
|
9
9
|
* @name Progress Bar
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
11
|
class ProgressBar extends PureComponent {
|
|
13
12
|
constructor() {
|
|
14
13
|
super(...arguments);
|
|
15
|
-
|
|
16
14
|
_defineProperty(this, "progressbarWrapper", void 0);
|
|
17
|
-
|
|
18
15
|
_defineProperty(this, "progressbarWrapperRef", el => {
|
|
19
16
|
this.progressbarWrapper = el;
|
|
20
17
|
});
|
|
21
|
-
|
|
22
18
|
_defineProperty(this, "progressbar", void 0);
|
|
23
|
-
|
|
24
19
|
_defineProperty(this, "progressbarRef", el => {
|
|
25
20
|
this.progressbar = el;
|
|
26
21
|
});
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
/**
|
|
30
24
|
* @param {number} value The progress task value
|
|
31
25
|
* @param {number} max The maximum value
|
|
@@ -37,7 +31,6 @@ class ProgressBar extends PureComponent {
|
|
|
37
31
|
const percents = value * HUNDRED_PERCENT / max;
|
|
38
32
|
return percents > HUNDRED_PERCENT ? HUNDRED_PERCENT : percents;
|
|
39
33
|
}
|
|
40
|
-
|
|
41
34
|
render() {
|
|
42
35
|
const {
|
|
43
36
|
className,
|
|
@@ -67,12 +60,9 @@ class ProgressBar extends PureComponent {
|
|
|
67
60
|
}
|
|
68
61
|
}));
|
|
69
62
|
}
|
|
70
|
-
|
|
71
63
|
}
|
|
72
|
-
|
|
73
64
|
_defineProperty(ProgressBar, "propTypes", {
|
|
74
65
|
label: PropTypes.string,
|
|
75
|
-
|
|
76
66
|
/**
|
|
77
67
|
* Sets the ring-progress-bar_global class to position the progress bar on top of the screen.
|
|
78
68
|
* Should be placed directly inside body, will be positioned right below .ring-header
|
|
@@ -80,28 +70,24 @@ _defineProperty(ProgressBar, "propTypes", {
|
|
|
80
70
|
* @type {boolean}
|
|
81
71
|
*/
|
|
82
72
|
global: PropTypes.bool,
|
|
83
|
-
|
|
84
73
|
/**
|
|
85
74
|
* Custom class
|
|
86
75
|
* @type {string}
|
|
87
76
|
*/
|
|
88
77
|
className: PropTypes.string,
|
|
89
78
|
style: PropTypes.object,
|
|
90
|
-
|
|
91
79
|
/**
|
|
92
80
|
* A floating point number that specifies minimum completion rate for a task to be considered
|
|
93
81
|
* complete. Default value is 1.0.
|
|
94
82
|
* @type {number}
|
|
95
83
|
*/
|
|
96
84
|
max: PropTypes.number,
|
|
97
|
-
|
|
98
85
|
/**
|
|
99
86
|
* A floating point number that specifies current task completion rate.
|
|
100
87
|
* @type {number}
|
|
101
88
|
*/
|
|
102
89
|
value: PropTypes.number
|
|
103
90
|
});
|
|
104
|
-
|
|
105
91
|
_defineProperty(ProgressBar, "defaultProps", {
|
|
106
92
|
max: 1.0,
|
|
107
93
|
value: 0,
|
|
@@ -18,7 +18,6 @@ import 'react';
|
|
|
18
18
|
|
|
19
19
|
const angularModule = angular.module('Ring.promised-click', []);
|
|
20
20
|
const DEFAULT_MODE = 'active';
|
|
21
|
-
|
|
22
21
|
class PromisedClickController extends RingAngularComponent {
|
|
23
22
|
constructor() {
|
|
24
23
|
super(...arguments);
|
|
@@ -30,20 +29,16 @@ class PromisedClickController extends RingAngularComponent {
|
|
|
30
29
|
} = this.$inject;
|
|
31
30
|
this.element = $element[0];
|
|
32
31
|
this.active = false;
|
|
33
|
-
|
|
34
32
|
if ($attrs.rgPromisedClick) {
|
|
35
33
|
this.onClick(e => $parse($attrs.rgPromisedClick)($scope, {
|
|
36
34
|
event: e
|
|
37
35
|
}));
|
|
38
36
|
}
|
|
39
|
-
|
|
40
37
|
let currentMode = null;
|
|
41
|
-
|
|
42
38
|
this.toggleActive = enable => {
|
|
43
39
|
if (currentMode === 'loader') {
|
|
44
40
|
applyMethodToClasses(enable ? 'add' : 'remove')(this.element.classList, modules_e81895c9.loader);
|
|
45
41
|
const loaderNode = this.element.querySelector(LOADER_BACKGROUND_SELECTOR);
|
|
46
|
-
|
|
47
42
|
if (loaderNode) {
|
|
48
43
|
applyMethodToClasses(enable ? 'add' : 'remove')(this.element.querySelector(LOADER_BACKGROUND_SELECTOR).classList, modules_e81895c9.loaderBackground);
|
|
49
44
|
}
|
|
@@ -51,13 +46,10 @@ class PromisedClickController extends RingAngularComponent {
|
|
|
51
46
|
applyMethodToClasses(enable ? 'add' : 'remove')(this.element.classList, modules_e81895c9.active);
|
|
52
47
|
}
|
|
53
48
|
};
|
|
54
|
-
|
|
55
49
|
const setModeParams = mode => {
|
|
56
50
|
currentMode = mode;
|
|
57
51
|
};
|
|
58
|
-
|
|
59
52
|
setModeParams($attrs.promisedMode || DEFAULT_MODE);
|
|
60
|
-
|
|
61
53
|
if ($attrs.promisedMode && $attrs.promisedMode.indexOf('{{') !== -1) {
|
|
62
54
|
$attrs.$observe('promisedMode', newMode => {
|
|
63
55
|
if (newMode !== currentMode) {
|
|
@@ -67,7 +59,6 @@ class PromisedClickController extends RingAngularComponent {
|
|
|
67
59
|
});
|
|
68
60
|
}
|
|
69
61
|
}
|
|
70
|
-
|
|
71
62
|
onClick(callback) {
|
|
72
63
|
this.element.addEventListener('click', e => {
|
|
73
64
|
if (this.active) {
|
|
@@ -77,49 +68,39 @@ class PromisedClickController extends RingAngularComponent {
|
|
|
77
68
|
}
|
|
78
69
|
});
|
|
79
70
|
}
|
|
80
|
-
|
|
81
71
|
process(callback, e) {
|
|
82
72
|
const {
|
|
83
73
|
$scope
|
|
84
74
|
} = this.$inject;
|
|
85
75
|
this.promise = callback(e);
|
|
86
|
-
|
|
87
76
|
if (this.promise) {
|
|
88
77
|
this.activate();
|
|
89
|
-
}
|
|
90
|
-
// otherwise a button may be "pressed" twice – by click and with class change.
|
|
91
|
-
|
|
78
|
+
}
|
|
92
79
|
|
|
80
|
+
// Do not use $evalAsync here. This code should be invoked in the same animation frame
|
|
81
|
+
// otherwise a button may be "pressed" twice – by click and with class change.
|
|
93
82
|
if (!$scope.$root.$$phase) {
|
|
94
83
|
// eslint-disable-line angular/no-private-call
|
|
95
84
|
$scope.$apply();
|
|
96
85
|
}
|
|
97
86
|
}
|
|
98
|
-
|
|
99
87
|
activate() {
|
|
100
88
|
this.active = true;
|
|
101
89
|
this.toggleActive(true);
|
|
102
|
-
|
|
103
90
|
const done = () => {
|
|
104
91
|
this.active = false;
|
|
105
92
|
this.toggleActive(false);
|
|
106
93
|
};
|
|
107
|
-
|
|
108
94
|
this.promise.then(done, done);
|
|
109
95
|
}
|
|
110
|
-
|
|
111
96
|
}
|
|
112
|
-
|
|
113
97
|
PromisedClickController.$inject = [];
|
|
114
|
-
|
|
115
98
|
_defineProperty(PromisedClickController, "$inject", ['$scope', '$element', '$attrs', '$parse']);
|
|
116
|
-
|
|
117
99
|
function rgPromisedClickDirective() {
|
|
118
100
|
return {
|
|
119
101
|
controller: PromisedClickController
|
|
120
102
|
};
|
|
121
103
|
}
|
|
122
|
-
|
|
123
104
|
angularModule.directive('rgPromisedClick', rgPromisedClickDirective);
|
|
124
105
|
var PromisedClick = angularModule.name;
|
|
125
106
|
|