@jetbrains/ring-ui 5.0.36 → 5.0.38
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/editable-heading/editable-heading.d.ts +4 -2
- package/components/editable-heading/editable-heading.js +3 -3
- 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 +18 -71
- 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 +4 -2
- package/dist/editable-heading/editable-heading.js +7 -6
- 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 +37 -37
|
@@ -95,18 +95,15 @@ const CollapsibleTabs = _ref => {
|
|
|
95
95
|
const measureRef = React.useRef(null);
|
|
96
96
|
const selectedIndex = React.useMemo(() => {
|
|
97
97
|
var _children$filter$find;
|
|
98
|
-
|
|
99
98
|
return (_children$filter$find = children.filter(tab => tab.props.alwaysHidden !== true).findIndex(tab => tab.props.id === selected)) !== null && _children$filter$find !== void 0 ? _children$filter$find : null;
|
|
100
99
|
}, [children, selected]);
|
|
101
100
|
const visibleElements = React.useMemo(() => {
|
|
102
101
|
let items;
|
|
103
|
-
|
|
104
102
|
if (preparedElements.ready) {
|
|
105
103
|
items = preparedElements.visible;
|
|
106
104
|
} else {
|
|
107
105
|
items = initialVisibleItems ? children.filter(item => item.props.alwaysHidden !== true).slice(0, initialVisibleItems) : [];
|
|
108
106
|
}
|
|
109
|
-
|
|
110
107
|
return getTabTitles({
|
|
111
108
|
items,
|
|
112
109
|
selected,
|
|
@@ -122,7 +119,6 @@ const CollapsibleTabs = _ref => {
|
|
|
122
119
|
let renderMore = children.some(tab => tab.props.alwaysHidden);
|
|
123
120
|
const tabsToRender = [];
|
|
124
121
|
let filledWidth = renderMore ? more !== null && more !== void 0 ? more : 0 : 0;
|
|
125
|
-
|
|
126
122
|
for (let i = 0; i < tabsSizes.length; i++) {
|
|
127
123
|
if (filledWidth + tabsSizes[i] < containerWidth + MEASURE_TOLERANCE) {
|
|
128
124
|
filledWidth += tabsSizes[i];
|
|
@@ -131,7 +127,6 @@ const CollapsibleTabs = _ref => {
|
|
|
131
127
|
break;
|
|
132
128
|
}
|
|
133
129
|
}
|
|
134
|
-
|
|
135
130
|
if (tabsToRender.length < tabsSizes.length && !renderMore) {
|
|
136
131
|
for (let i = tabsToRender.length - 1; i >= 0; i--) {
|
|
137
132
|
if (filledWidth + more < containerWidth + MEASURE_TOLERANCE) {
|
|
@@ -144,10 +139,8 @@ const CollapsibleTabs = _ref => {
|
|
|
144
139
|
}
|
|
145
140
|
}
|
|
146
141
|
}
|
|
147
|
-
|
|
148
142
|
if (selectedIndex > tabsToRender.length - 1) {
|
|
149
143
|
const selectedWidth = tabsSizes[selectedIndex];
|
|
150
|
-
|
|
151
144
|
for (let i = tabsToRender.length - 1; i >= 0; i--) {
|
|
152
145
|
if (filledWidth + selectedWidth < containerWidth + MEASURE_TOLERANCE) {
|
|
153
146
|
filledWidth += selectedWidth;
|
|
@@ -158,43 +151,35 @@ const CollapsibleTabs = _ref => {
|
|
|
158
151
|
}
|
|
159
152
|
}
|
|
160
153
|
}
|
|
161
|
-
|
|
162
154
|
if (elements.lastVisibleIndex !== tabsToRender.length - 1) {
|
|
163
155
|
setLastVisibleIndex(tabsToRender.length - 1);
|
|
164
156
|
}
|
|
165
|
-
}, [children, elements.lastVisibleIndex, elements.sizes, selectedIndex]);
|
|
166
|
-
|
|
157
|
+
}, [children, elements.lastVisibleIndex, elements.sizes, selectedIndex]);
|
|
158
|
+
// Prepare list of visible and hidden elements
|
|
167
159
|
React.useEffect(() => {
|
|
168
160
|
const timeout = setTimeout(() => {
|
|
169
161
|
var _elements$lastVisible2;
|
|
170
|
-
|
|
171
162
|
const res = children.reduce((accumulator, tab) => {
|
|
172
163
|
var _elements$lastVisible;
|
|
173
|
-
|
|
174
164
|
if (tab.props.alwaysHidden !== true && accumulator.visible.length - 1 < ((_elements$lastVisible = elements.lastVisibleIndex) !== null && _elements$lastVisible !== void 0 ? _elements$lastVisible : 0)) {
|
|
175
165
|
accumulator.visible.push(tab);
|
|
176
166
|
} else {
|
|
177
167
|
accumulator.hidden.push(tab);
|
|
178
168
|
}
|
|
179
|
-
|
|
180
169
|
return accumulator;
|
|
181
170
|
}, {
|
|
182
171
|
visible: [],
|
|
183
172
|
hidden: [],
|
|
184
173
|
ready: elements.lastVisibleIndex !== null
|
|
185
174
|
});
|
|
186
|
-
|
|
187
175
|
if (selectedIndex > ((_elements$lastVisible2 = elements.lastVisibleIndex) !== null && _elements$lastVisible2 !== void 0 ? _elements$lastVisible2 : 0)) {
|
|
188
176
|
const selectedItem = children.find(tab => !tab.props.alwaysHidden && tab.props.id === selected);
|
|
189
|
-
|
|
190
177
|
if (selectedItem != null) {
|
|
191
178
|
res.visible.push(selectedItem);
|
|
192
179
|
}
|
|
193
180
|
}
|
|
194
|
-
|
|
195
181
|
const allVisibleTheSame = res.visible.length === preparedElements.visible.length && res.visible.every((item, index) => item === preparedElements.visible[index]);
|
|
196
182
|
const allHiddenTheSame = res.hidden.length === preparedElements.hidden.length && res.hidden.every((item, index) => item === preparedElements.hidden[index]);
|
|
197
|
-
|
|
198
183
|
if (!allVisibleTheSame || !allHiddenTheSame || preparedElements.ready !== res.ready) {
|
|
199
184
|
fastdom.mutate(() => setPreparedElements(res));
|
|
200
185
|
}
|
|
@@ -202,24 +187,22 @@ const CollapsibleTabs = _ref => {
|
|
|
202
187
|
return () => {
|
|
203
188
|
clearTimeout(timeout);
|
|
204
189
|
};
|
|
205
|
-
}, [children, elements.lastVisibleIndex, preparedElements, selected, selectedIndex]);
|
|
206
|
-
|
|
190
|
+
}, [children, elements.lastVisibleIndex, preparedElements, selected, selectedIndex]);
|
|
191
|
+
// Get list of all possibly visible elements to render in a measure container
|
|
207
192
|
const childrenToMeasure = React.useMemo(() => {
|
|
208
193
|
const items = children.filter(tab => tab.props.alwaysHidden !== true);
|
|
209
194
|
return getTabTitles({
|
|
210
195
|
items,
|
|
211
196
|
tabIndex: -1
|
|
212
197
|
});
|
|
213
|
-
}, [children]);
|
|
214
|
-
|
|
198
|
+
}, [children]);
|
|
199
|
+
// Initial measure for tabs and more button sizes
|
|
215
200
|
React.useEffect(() => {
|
|
216
201
|
if (measureRef.current == null) {
|
|
217
202
|
return undefined;
|
|
218
203
|
}
|
|
219
|
-
|
|
220
204
|
const measureTask = fastdom.measure(() => {
|
|
221
205
|
var _container$children;
|
|
222
|
-
|
|
223
206
|
const container = measureRef.current;
|
|
224
207
|
const descendants = [...((_container$children = container === null || container === void 0 ? void 0 : container.children) !== null && _container$children !== void 0 ? _container$children : [])];
|
|
225
208
|
const moreButton = descendants.pop();
|
|
@@ -239,7 +222,6 @@ const CollapsibleTabs = _ref => {
|
|
|
239
222
|
});
|
|
240
223
|
const newSummaryWidth = tabsWidth.reduce((acc, curr) => acc + curr, 0);
|
|
241
224
|
const oldSummaryWidth = elements.sizes.tabs.reduce((acc, curr) => acc + curr, 0);
|
|
242
|
-
|
|
243
225
|
if (elements.sizes.more !== moreButtonWidth || newSummaryWidth !== oldSummaryWidth) {
|
|
244
226
|
fastdom.mutate(() => setSizes({
|
|
245
227
|
more: moreButtonWidth,
|
|
@@ -250,15 +232,13 @@ const CollapsibleTabs = _ref => {
|
|
|
250
232
|
return () => {
|
|
251
233
|
fastdom.clear(measureTask);
|
|
252
234
|
};
|
|
253
|
-
}, [children, elements.sizes.more, elements.sizes.tabs]);
|
|
254
|
-
|
|
235
|
+
}, [children, elements.sizes.more, elements.sizes.tabs]);
|
|
236
|
+
// Start observers to listen resizing and mutation
|
|
255
237
|
React.useEffect(() => {
|
|
256
238
|
if (measureRef.current === null) {
|
|
257
239
|
return undefined;
|
|
258
240
|
}
|
|
259
|
-
|
|
260
241
|
let measureTask = () => {};
|
|
261
|
-
|
|
262
242
|
const resizeObserver = new ResizeObserver(entries => {
|
|
263
243
|
entries.forEach(entry => {
|
|
264
244
|
fastdom.clear(measureTask);
|
package/dist/tabs/dumb-tabs.js
CHANGED
|
@@ -70,14 +70,11 @@ import './collapsible-tab.js';
|
|
|
70
70
|
class Tabs extends PureComponent {
|
|
71
71
|
constructor() {
|
|
72
72
|
super(...arguments);
|
|
73
|
-
|
|
74
73
|
_defineProperty(this, "handleSelect", memoize(key => () => this.props.onSelect(key)));
|
|
75
|
-
|
|
76
74
|
_defineProperty(this, "getTabTitle", (child, i) => {
|
|
77
75
|
if (child == null || typeof child !== 'object' || child.type === CustomItem) {
|
|
78
76
|
return child;
|
|
79
77
|
}
|
|
80
|
-
|
|
81
78
|
const {
|
|
82
79
|
selected
|
|
83
80
|
} = this.props;
|
|
@@ -107,7 +104,6 @@ class Tabs extends PureComponent {
|
|
|
107
104
|
}, titleProps));
|
|
108
105
|
});
|
|
109
106
|
}
|
|
110
|
-
|
|
111
107
|
render() {
|
|
112
108
|
const {
|
|
113
109
|
className,
|
|
@@ -136,9 +132,7 @@ class Tabs extends PureComponent {
|
|
|
136
132
|
return (props.id || String(i)) === selected;
|
|
137
133
|
})));
|
|
138
134
|
}
|
|
139
|
-
|
|
140
135
|
}
|
|
141
|
-
|
|
142
136
|
_defineProperty(Tabs, "propTypes", {
|
|
143
137
|
selected: PropTypes.string,
|
|
144
138
|
className: PropTypes.string,
|
|
@@ -148,10 +142,8 @@ _defineProperty(Tabs, "propTypes", {
|
|
|
148
142
|
'data-test': PropTypes.string,
|
|
149
143
|
autoCollapse: PropTypes.bool
|
|
150
144
|
});
|
|
151
|
-
|
|
152
145
|
_defineProperty(Tabs, "defaultProps", {
|
|
153
146
|
onSelect() {}
|
|
154
|
-
|
|
155
147
|
});
|
|
156
148
|
|
|
157
149
|
export { Tabs as default };
|
package/dist/tabs/smart-tabs.js
CHANGED
|
@@ -70,18 +70,14 @@ import './custom-item.js';
|
|
|
70
70
|
class SmartTabs extends PureComponent {
|
|
71
71
|
constructor(props) {
|
|
72
72
|
super(props);
|
|
73
|
-
|
|
74
73
|
_defineProperty(this, "state", void 0);
|
|
75
|
-
|
|
76
74
|
_defineProperty(this, "handleSelect", selected => this.setState({
|
|
77
75
|
selected
|
|
78
76
|
}));
|
|
79
|
-
|
|
80
77
|
this.state = {
|
|
81
78
|
selected: this.props.initSelected || Array.isArray(this.props.children) && this.props.children[0].props.id || '0'
|
|
82
79
|
};
|
|
83
80
|
}
|
|
84
|
-
|
|
85
81
|
render() {
|
|
86
82
|
const {
|
|
87
83
|
children,
|
|
@@ -95,9 +91,7 @@ class SmartTabs extends PureComponent {
|
|
|
95
91
|
onSelect: this.handleSelect
|
|
96
92
|
}, restProps), children);
|
|
97
93
|
}
|
|
98
|
-
|
|
99
94
|
}
|
|
100
|
-
|
|
101
95
|
_defineProperty(SmartTabs, "propTypes", {
|
|
102
96
|
children: PropTypes.arrayOf(PropTypes.element).isRequired,
|
|
103
97
|
initSelected: PropTypes.string,
|
package/dist/tabs/tab-link.js
CHANGED
package/dist/tabs/tab.js
CHANGED
package/dist/tabs-ng/tabs-ng.js
CHANGED
|
@@ -24,23 +24,20 @@ angularModule.directive('rgTabs', ["$location", "$rootScope", function rgTabsDir
|
|
|
24
24
|
$scope.panes = [];
|
|
25
25
|
$scope.current = null;
|
|
26
26
|
$scope.styles = modules_02138f4a;
|
|
27
|
-
|
|
28
27
|
function getTabIdFromUrl() {
|
|
29
28
|
return $location.search()[$scope.tabParameter];
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
function doSelect(newPane, skipUrlUpdate) {
|
|
33
31
|
if (newPane === $scope.current || newPane.ngDisabled) {
|
|
34
32
|
return;
|
|
35
33
|
}
|
|
36
|
-
|
|
37
34
|
for (let index = 0; index < $scope.panes.length; index++) {
|
|
38
|
-
const pane = $scope.panes[index];
|
|
35
|
+
const pane = $scope.panes[index];
|
|
39
36
|
|
|
37
|
+
// Update current tab
|
|
40
38
|
if (pane === newPane || pane.tabId === newPane) {
|
|
41
39
|
$scope.current = newPane;
|
|
42
40
|
pane.selected = true;
|
|
43
|
-
|
|
44
41
|
if (!skipUrlUpdate) {
|
|
45
42
|
$location.search($scope.tabParameter, newPane.tabId);
|
|
46
43
|
}
|
|
@@ -50,35 +47,28 @@ angularModule.directive('rgTabs', ["$location", "$rootScope", function rgTabsDir
|
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
|
-
|
|
54
50
|
function getNextPaneIndex(reverseOrder) {
|
|
55
51
|
const currentTabIndex = $scope.panes.indexOf($scope.current);
|
|
56
52
|
let next = currentTabIndex;
|
|
57
|
-
|
|
58
53
|
do {
|
|
59
54
|
next += reverseOrder ? -1 : 1;
|
|
60
55
|
} while (next > -1 && next < $scope.panes.length && $scope.panes[next].ngDisabled);
|
|
61
|
-
|
|
62
56
|
if (next >= $scope.panes.length) {
|
|
63
57
|
next = $scope.panes.length - 1;
|
|
64
58
|
} else if (next < 0) {
|
|
65
59
|
next = 0;
|
|
66
|
-
}
|
|
67
|
-
|
|
60
|
+
}
|
|
68
61
|
|
|
62
|
+
// if no suitable tab found till the end of array
|
|
69
63
|
if ($scope.panes[next].ngDisabled) {
|
|
70
64
|
return currentTabIndex;
|
|
71
65
|
}
|
|
72
|
-
|
|
73
66
|
return next;
|
|
74
67
|
}
|
|
75
|
-
|
|
76
68
|
function getCurrentTab() {
|
|
77
69
|
const currentTabId = getTabIdFromUrl();
|
|
78
|
-
|
|
79
70
|
if (currentTabId) {
|
|
80
71
|
const currentTab = $scope.panes.find(pane => pane.tabId === currentTabId);
|
|
81
|
-
|
|
82
72
|
if (currentTab && !currentTab.ngDisabled) {
|
|
83
73
|
return currentTab;
|
|
84
74
|
} else {
|
|
@@ -87,53 +77,47 @@ angularModule.directive('rgTabs', ["$location", "$rootScope", function rgTabsDir
|
|
|
87
77
|
} else {
|
|
88
78
|
return $scope.panes[0];
|
|
89
79
|
}
|
|
90
|
-
}
|
|
80
|
+
}
|
|
91
81
|
|
|
82
|
+
// controller methods
|
|
92
83
|
|
|
93
84
|
function checkCurrentTab() {
|
|
94
85
|
if ($scope.panes.length) {
|
|
95
86
|
doSelect(getCurrentTab(), true);
|
|
96
87
|
}
|
|
97
88
|
}
|
|
98
|
-
|
|
99
89
|
this.addTab = tab => {
|
|
100
90
|
$scope.panes.push(tab);
|
|
101
|
-
|
|
102
91
|
if ($scope.panes.length === 1 || tab.tabId === getTabIdFromUrl()) {
|
|
103
92
|
doSelect(tab, true);
|
|
104
93
|
}
|
|
105
94
|
};
|
|
106
|
-
|
|
107
95
|
this.removeTab = tab => {
|
|
108
96
|
const index = $scope.panes.indexOf(tab);
|
|
109
97
|
$scope.panes.splice(index, 1);
|
|
110
98
|
checkCurrentTab();
|
|
111
99
|
};
|
|
100
|
+
this.checkPane = checkCurrentTab;
|
|
112
101
|
|
|
113
|
-
|
|
102
|
+
// scope
|
|
114
103
|
|
|
115
|
-
$scope.$on('$destroy', $rootScope.$on('$routeUpdate', checkCurrentTab));
|
|
104
|
+
$scope.$on('$destroy', $rootScope.$on('$routeUpdate', checkCurrentTab));
|
|
116
105
|
|
|
106
|
+
// Exposed methods
|
|
117
107
|
$scope.control = {};
|
|
118
|
-
|
|
119
108
|
$scope.control.isLast = () => $scope.panes.indexOf($scope.current) === $scope.panes.length - 1;
|
|
120
|
-
|
|
121
109
|
$scope.control.isFirst = () => $scope.panes.indexOf($scope.current) === 0;
|
|
122
|
-
|
|
123
110
|
$scope.control.select = pane => {
|
|
124
111
|
doSelect(pane, $scope.disableLocationChanging);
|
|
125
112
|
};
|
|
126
|
-
|
|
127
113
|
$scope.control.next = () => {
|
|
128
114
|
const next = getNextPaneIndex();
|
|
129
115
|
doSelect($scope.panes[next], $scope.disableLocationChanging);
|
|
130
116
|
};
|
|
131
|
-
|
|
132
117
|
$scope.control.prev = () => {
|
|
133
118
|
const prev = getNextPaneIndex(true);
|
|
134
119
|
doSelect($scope.panes[prev], $scope.disableLocationChanging);
|
|
135
120
|
};
|
|
136
|
-
|
|
137
121
|
$scope.keyMap = {
|
|
138
122
|
next: $scope.control.next,
|
|
139
123
|
prev: $scope.control.prev,
|
|
@@ -141,16 +125,16 @@ angularModule.directive('rgTabs', ["$location", "$rootScope", function rgTabsDir
|
|
|
141
125
|
$scope.focus = !$scope.focus;
|
|
142
126
|
return !$scope.focus;
|
|
143
127
|
}
|
|
144
|
-
};
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// For some reason ng-class doesn't work properly on tabs.
|
|
145
131
|
// From time to time several tabs look like selected despite correct scope state.
|
|
146
132
|
// I think this bug depends on the frequency of addTab calls (actually on digests)
|
|
147
133
|
// and ng-class detection of added and removed classes becomes broken.
|
|
148
134
|
// @maxim.erekhinskiy
|
|
149
|
-
|
|
150
135
|
$scope.tabClass = pane => classNames(modules_02138f4a.title, modules_02138f4a.titleLegacy, {
|
|
151
136
|
[modules_02138f4a.selected]: pane.selected
|
|
152
137
|
});
|
|
153
|
-
|
|
154
138
|
this.$onInit = () => {
|
|
155
139
|
if (!$scope.tabParameter) {
|
|
156
140
|
$scope.tabParameter = 'tab';
|
package/dist/tag/tag.js
CHANGED
|
@@ -21,15 +21,12 @@ var modules_2f9be069 = {"unit":"8px","max-height":"20px","tag":"tag_rui_2f49 res
|
|
|
21
21
|
/**
|
|
22
22
|
* @name Tag
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
24
|
class Tag extends PureComponent {
|
|
26
25
|
constructor() {
|
|
27
26
|
super(...arguments);
|
|
28
|
-
|
|
29
27
|
_defineProperty(this, "state", {
|
|
30
28
|
focused: false
|
|
31
29
|
});
|
|
32
|
-
|
|
33
30
|
_defineProperty(this, "onDocumentClick", event => {
|
|
34
31
|
if (this.tagNode) {
|
|
35
32
|
this.setState({
|
|
@@ -37,37 +34,29 @@ class Tag extends PureComponent {
|
|
|
37
34
|
});
|
|
38
35
|
}
|
|
39
36
|
});
|
|
40
|
-
|
|
41
37
|
_defineProperty(this, "tagNode", void 0);
|
|
42
|
-
|
|
43
38
|
_defineProperty(this, "tagRef", el => {
|
|
44
39
|
this.tagNode = el;
|
|
45
40
|
});
|
|
46
41
|
}
|
|
47
|
-
|
|
48
42
|
componentDidUpdate(prevProps) {
|
|
49
43
|
if (this.props.focused !== prevProps.focused) {
|
|
50
44
|
this.setState({
|
|
51
45
|
focused: this.props.focused
|
|
52
46
|
});
|
|
53
47
|
}
|
|
54
|
-
|
|
55
48
|
if (this.state.focused) {
|
|
56
49
|
var _this$tagNode;
|
|
57
|
-
|
|
58
50
|
(_this$tagNode = this.tagNode) === null || _this$tagNode === void 0 ? void 0 : _this$tagNode.focus();
|
|
59
51
|
}
|
|
60
|
-
|
|
61
52
|
this.setDocumentClickListener(this.state.focused);
|
|
62
53
|
}
|
|
63
|
-
|
|
64
54
|
componentWillUnmount() {
|
|
65
55
|
this.setDocumentClickListener(false);
|
|
66
56
|
this.setState({
|
|
67
57
|
focused: false
|
|
68
58
|
});
|
|
69
59
|
}
|
|
70
|
-
|
|
71
60
|
setDocumentClickListener(setListener) {
|
|
72
61
|
if (setListener) {
|
|
73
62
|
document.addEventListener('click', this.onDocumentClick);
|
|
@@ -75,7 +64,6 @@ class Tag extends PureComponent {
|
|
|
75
64
|
document.removeEventListener('click', this.onDocumentClick);
|
|
76
65
|
}
|
|
77
66
|
}
|
|
78
|
-
|
|
79
67
|
renderCustomIcon() {
|
|
80
68
|
if (this.props.rgTagIcon) {
|
|
81
69
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -84,10 +72,8 @@ class Tag extends PureComponent {
|
|
|
84
72
|
glyph: this.props.rgTagIcon
|
|
85
73
|
});
|
|
86
74
|
}
|
|
87
|
-
|
|
88
75
|
return null;
|
|
89
76
|
}
|
|
90
|
-
|
|
91
77
|
_renderImageElement(avatarSrc) {
|
|
92
78
|
const classes = classNames({
|
|
93
79
|
[modules_2f9be069.customIcon]: this.props.icon,
|
|
@@ -99,25 +85,20 @@ class Tag extends PureComponent {
|
|
|
99
85
|
src: avatarSrc || this.props.icon
|
|
100
86
|
});
|
|
101
87
|
}
|
|
102
|
-
|
|
103
88
|
renderImage() {
|
|
104
89
|
if (this.props.icon && !this.props.avatar) {
|
|
105
90
|
return this._renderImageElement();
|
|
106
91
|
}
|
|
107
|
-
|
|
108
92
|
return null;
|
|
109
93
|
}
|
|
110
|
-
|
|
111
94
|
renderAvatar() {
|
|
112
95
|
if (this.props.avatar) {
|
|
113
96
|
return /*#__PURE__*/React.createElement("span", {
|
|
114
97
|
className: modules_2f9be069.avatarContainer
|
|
115
98
|
}, this._renderImageElement(this.props.avatar));
|
|
116
99
|
}
|
|
117
|
-
|
|
118
100
|
return null;
|
|
119
101
|
}
|
|
120
|
-
|
|
121
102
|
renderRemoveIcon() {
|
|
122
103
|
if (!this.props.readOnly) {
|
|
123
104
|
return /*#__PURE__*/React.createElement(Button, {
|
|
@@ -132,10 +113,8 @@ class Tag extends PureComponent {
|
|
|
132
113
|
}
|
|
133
114
|
});
|
|
134
115
|
}
|
|
135
|
-
|
|
136
116
|
return null;
|
|
137
117
|
}
|
|
138
|
-
|
|
139
118
|
render() {
|
|
140
119
|
const classes = classNames('ring-js-shortcuts', modules_2f9be069.tag, {
|
|
141
120
|
[modules_2f9be069.focused]: this.state.focused,
|
|
@@ -165,9 +144,7 @@ class Tag extends PureComponent {
|
|
|
165
144
|
}, this.props.children))
|
|
166
145
|
}), this.renderRemoveIcon());
|
|
167
146
|
}
|
|
168
|
-
|
|
169
147
|
}
|
|
170
|
-
|
|
171
148
|
_defineProperty(Tag, "propTypes", {
|
|
172
149
|
onRemove: PropTypes.func,
|
|
173
150
|
onClick: PropTypes.func,
|
|
@@ -185,7 +162,6 @@ _defineProperty(Tag, "propTypes", {
|
|
|
185
162
|
className: PropTypes.string,
|
|
186
163
|
render: PropTypes.func
|
|
187
164
|
});
|
|
188
|
-
|
|
189
165
|
_defineProperty(Tag, "defaultProps", {
|
|
190
166
|
onRemove: () => {},
|
|
191
167
|
onClick: () => {},
|