@jetbrains/ring-ui-built 7.0.66 → 7.0.71
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 +16 -24
- 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,23 +1,19 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
-
|
|
4
1
|
let Selection$1 = class Selection {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
_defineProperty(this, "_isItemSelectable", void 0);
|
|
2
|
+
_rawData;
|
|
3
|
+
_getChildren;
|
|
4
|
+
_data;
|
|
5
|
+
_selected;
|
|
6
|
+
_focused;
|
|
7
|
+
_getKey;
|
|
8
|
+
_isItemSelectable;
|
|
9
|
+
constructor({
|
|
10
|
+
data = [],
|
|
11
|
+
selected = new Set(),
|
|
12
|
+
focused = null,
|
|
13
|
+
getKey = item => item.id,
|
|
14
|
+
getChildren = () => [],
|
|
15
|
+
isItemSelectable = () => true
|
|
16
|
+
} = {}) {
|
|
21
17
|
this._rawData = data;
|
|
22
18
|
this._getChildren = getChildren;
|
|
23
19
|
this._data = this._buildData(data);
|
|
@@ -32,12 +28,11 @@ let Selection$1 = class Selection {
|
|
|
32
28
|
_buildSelected(data, selected) {
|
|
33
29
|
return new Set(selected);
|
|
34
30
|
}
|
|
35
|
-
cloneWith(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} = _ref;
|
|
31
|
+
cloneWith({
|
|
32
|
+
data,
|
|
33
|
+
selected,
|
|
34
|
+
focused
|
|
35
|
+
}) {
|
|
41
36
|
const newData = data || this._rawData;
|
|
42
37
|
let newSelected;
|
|
43
38
|
if (data && !selected) {
|
|
@@ -115,8 +110,7 @@ let Selection$1 = class Selection {
|
|
|
115
110
|
}
|
|
116
111
|
return undefined;
|
|
117
112
|
}
|
|
118
|
-
select() {
|
|
119
|
-
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
|
|
113
|
+
select(value = this._focused) {
|
|
120
114
|
if (!value || !this._isItemSelectable(value)) {
|
|
121
115
|
return this;
|
|
122
116
|
}
|
|
@@ -126,8 +120,7 @@ let Selection$1 = class Selection {
|
|
|
126
120
|
selected
|
|
127
121
|
});
|
|
128
122
|
}
|
|
129
|
-
deselect() {
|
|
130
|
-
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
|
|
123
|
+
deselect(value = this._focused) {
|
|
131
124
|
if (!value || !this._isItemSelectable(value)) {
|
|
132
125
|
return this;
|
|
133
126
|
}
|
|
@@ -137,8 +130,7 @@ let Selection$1 = class Selection {
|
|
|
137
130
|
selected
|
|
138
131
|
});
|
|
139
132
|
}
|
|
140
|
-
toggleSelection() {
|
|
141
|
-
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
|
|
133
|
+
toggleSelection(value = this._focused) {
|
|
142
134
|
if (this.isSelected(value)) {
|
|
143
135
|
return this.deselect(value);
|
|
144
136
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty, 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 { PureComponent } from 'react';
|
|
5
3
|
import classNames from 'classnames';
|
|
@@ -13,12 +11,11 @@ import 'memoize-one';
|
|
|
13
11
|
import '../global/get-uid.js';
|
|
14
12
|
import '../shortcuts/shortcuts.js';
|
|
15
13
|
import '../shortcuts/core.js';
|
|
16
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
17
14
|
import 'combokeys';
|
|
18
15
|
import '../global/sniffer.js';
|
|
19
16
|
import 'sniffr';
|
|
20
17
|
import '../loader/loader.js';
|
|
21
|
-
import '../
|
|
18
|
+
import '../_helpers/loader-core.js';
|
|
22
19
|
import '../global/dom.js';
|
|
23
20
|
import './header.js';
|
|
24
21
|
import '../checkbox/checkbox.js';
|
|
@@ -28,7 +25,6 @@ import '../icon/icon.js';
|
|
|
28
25
|
import 'util-deprecate';
|
|
29
26
|
import '../icon/icon.constants.js';
|
|
30
27
|
import '../_helpers/icon-svg.js';
|
|
31
|
-
import 'core-js/modules/es.string.replace.js';
|
|
32
28
|
import '../global/memoize.js';
|
|
33
29
|
import '../control-help/control-help.js';
|
|
34
30
|
import './header-cell.js';
|
|
@@ -53,7 +49,6 @@ import 'react-dom';
|
|
|
53
49
|
import '../global/schedule-raf.js';
|
|
54
50
|
import '../tab-trap/tab-trap.js';
|
|
55
51
|
import '../popup/position.js';
|
|
56
|
-
import 'core-js/modules/es.array.sort.js';
|
|
57
52
|
import '../popup/popup.consts.js';
|
|
58
53
|
import '../popup/popup.target.js';
|
|
59
54
|
import '../popup/position-css.js';
|
|
@@ -61,24 +56,23 @@ import '../_helpers/theme.js';
|
|
|
61
56
|
import './cell.js';
|
|
62
57
|
|
|
63
58
|
class SimpleTable extends PureComponent {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
59
|
+
static defaultProps = {
|
|
60
|
+
selectable: false,
|
|
61
|
+
wideFirstColumn: false
|
|
62
|
+
};
|
|
63
|
+
state = {
|
|
64
|
+
selection: new Selection$1({
|
|
65
|
+
data: this.props.data
|
|
66
|
+
})
|
|
67
|
+
};
|
|
68
|
+
classes = classNames(style.disabledHover, this.props.className);
|
|
73
69
|
render() {
|
|
74
|
-
return jsx(TableContainer,
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
return jsx(TableContainer, {
|
|
71
|
+
...this.props,
|
|
72
|
+
className: this.classes,
|
|
73
|
+
...this.state
|
|
74
|
+
});
|
|
77
75
|
}
|
|
78
76
|
}
|
|
79
|
-
_defineProperty(SimpleTable, "defaultProps", {
|
|
80
|
-
selectable: false,
|
|
81
|
-
wideFirstColumn: false
|
|
82
|
-
});
|
|
83
77
|
|
|
84
78
|
export { SimpleTable as default };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty, 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 { PureComponent } from 'react';
|
|
5
3
|
import TableContainer from './table.js';
|
|
@@ -12,12 +10,11 @@ import 'memoize-one';
|
|
|
12
10
|
import '../global/get-uid.js';
|
|
13
11
|
import '../shortcuts/shortcuts.js';
|
|
14
12
|
import '../shortcuts/core.js';
|
|
15
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
16
13
|
import 'combokeys';
|
|
17
14
|
import '../global/sniffer.js';
|
|
18
15
|
import 'sniffr';
|
|
19
16
|
import '../loader/loader.js';
|
|
20
|
-
import '../
|
|
17
|
+
import '../_helpers/loader-core.js';
|
|
21
18
|
import '../global/dom.js';
|
|
22
19
|
import './header.js';
|
|
23
20
|
import '../checkbox/checkbox.js';
|
|
@@ -27,7 +24,6 @@ import '../icon/icon.js';
|
|
|
27
24
|
import 'util-deprecate';
|
|
28
25
|
import '../icon/icon.constants.js';
|
|
29
26
|
import '../_helpers/icon-svg.js';
|
|
30
|
-
import 'core-js/modules/es.string.replace.js';
|
|
31
27
|
import '../global/memoize.js';
|
|
32
28
|
import '../control-help/control-help.js';
|
|
33
29
|
import '../_helpers/table.js';
|
|
@@ -53,7 +49,6 @@ import 'react-dom';
|
|
|
53
49
|
import '../global/schedule-raf.js';
|
|
54
50
|
import '../tab-trap/tab-trap.js';
|
|
55
51
|
import '../popup/position.js';
|
|
56
|
-
import 'core-js/modules/es.array.sort.js';
|
|
57
52
|
import '../popup/popup.consts.js';
|
|
58
53
|
import '../popup/popup.target.js';
|
|
59
54
|
import '../popup/position-css.js';
|
|
@@ -61,21 +56,15 @@ import '../_helpers/theme.js';
|
|
|
61
56
|
import './cell.js';
|
|
62
57
|
|
|
63
58
|
class SmartTable extends PureComponent {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
this.setState({
|
|
74
|
-
selection
|
|
75
|
-
});
|
|
76
|
-
this.props.onSelectionChange(selection);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
59
|
+
static defaultProps = {
|
|
60
|
+
onSelectionChange: () => {}
|
|
61
|
+
};
|
|
62
|
+
state = {
|
|
63
|
+
selection: new Selection$1({
|
|
64
|
+
data: this.props.data,
|
|
65
|
+
isItemSelectable: this.props.isItemSelectable
|
|
66
|
+
})
|
|
67
|
+
};
|
|
79
68
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
80
69
|
const {
|
|
81
70
|
data,
|
|
@@ -95,15 +84,19 @@ class SmartTable extends PureComponent {
|
|
|
95
84
|
});
|
|
96
85
|
}
|
|
97
86
|
}
|
|
87
|
+
onSelect = selection => {
|
|
88
|
+
this.setState({
|
|
89
|
+
selection
|
|
90
|
+
});
|
|
91
|
+
this.props.onSelectionChange(selection);
|
|
92
|
+
};
|
|
98
93
|
render() {
|
|
99
|
-
return jsx(TableContainer,
|
|
94
|
+
return jsx(TableContainer, {
|
|
95
|
+
...this.props,
|
|
100
96
|
selection: this.state.selection,
|
|
101
97
|
onSelect: this.onSelect
|
|
102
|
-
})
|
|
98
|
+
});
|
|
103
99
|
}
|
|
104
100
|
}
|
|
105
|
-
_defineProperty(SmartTable, "defaultProps", {
|
|
106
|
-
onSelectionChange: () => {}
|
|
107
|
-
});
|
|
108
101
|
|
|
109
102
|
export { SmartTable as default };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '
|
|
3
|
-
import { PureComponent, createElement, Component } from 'react';
|
|
4
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { Component, PureComponent, createElement } from 'react';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
3
|
import classNames from 'classnames';
|
|
6
4
|
import { arrayMove, List } from 'react-movable';
|
|
7
5
|
import focusSensorHOC from '../global/focus-sensor-hoc.js';
|
|
@@ -16,11 +14,10 @@ import RowWithFocusSensorCallbacks from './row-with-focus-sensor.js';
|
|
|
16
14
|
import '../global/compose-refs.js';
|
|
17
15
|
import 'memoize-one';
|
|
18
16
|
import '../shortcuts/core.js';
|
|
19
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
20
17
|
import 'combokeys';
|
|
21
18
|
import '../global/sniffer.js';
|
|
22
19
|
import 'sniffr';
|
|
23
|
-
import '../
|
|
20
|
+
import '../_helpers/loader-core.js';
|
|
24
21
|
import '../global/dom.js';
|
|
25
22
|
import '../checkbox/checkbox.js';
|
|
26
23
|
import '@jetbrains/icons/checkmark-12px';
|
|
@@ -29,7 +26,6 @@ import '../icon/icon.js';
|
|
|
29
26
|
import 'util-deprecate';
|
|
30
27
|
import '../icon/icon.constants.js';
|
|
31
28
|
import '../_helpers/icon-svg.js';
|
|
32
|
-
import 'core-js/modules/es.string.replace.js';
|
|
33
29
|
import '../global/memoize.js';
|
|
34
30
|
import '../control-help/control-help.js';
|
|
35
31
|
import './header-cell.js';
|
|
@@ -51,103 +47,58 @@ import 'react-dom';
|
|
|
51
47
|
import '../global/schedule-raf.js';
|
|
52
48
|
import '../tab-trap/tab-trap.js';
|
|
53
49
|
import '../popup/position.js';
|
|
54
|
-
import 'core-js/modules/es.array.sort.js';
|
|
55
50
|
import '../popup/popup.consts.js';
|
|
56
51
|
import '../popup/popup.target.js';
|
|
57
52
|
import '../popup/position-css.js';
|
|
58
53
|
import '../_helpers/theme.js';
|
|
59
54
|
import './cell.js';
|
|
60
55
|
|
|
61
|
-
const _excluded = ["ref"];
|
|
62
56
|
/**
|
|
63
57
|
* Interactive table with selection and keyboard navigation support.
|
|
64
58
|
*/
|
|
65
59
|
class Table extends PureComponent {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (selected) {
|
|
99
|
-
onSelect(selection.select(row));
|
|
100
|
-
} else {
|
|
101
|
-
onSelect(selection.deselect(row));
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
_defineProperty(this, "onSortEnd", _ref => {
|
|
105
|
-
let {
|
|
106
|
-
oldIndex,
|
|
107
|
-
newIndex
|
|
108
|
-
} = _ref;
|
|
109
|
-
const data = arrayMove(this.props.data, oldIndex, newIndex);
|
|
110
|
-
this.props.onReorder({
|
|
111
|
-
data,
|
|
112
|
-
oldIndex,
|
|
113
|
-
newIndex
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
_defineProperty(this, "onCheckboxChange", e => {
|
|
117
|
-
const {
|
|
118
|
-
checked
|
|
119
|
-
} = e.currentTarget;
|
|
120
|
-
const {
|
|
121
|
-
selection,
|
|
122
|
-
onSelect
|
|
123
|
-
} = this.props;
|
|
124
|
-
if (checked) {
|
|
125
|
-
onSelect(selection.selectAll());
|
|
126
|
-
} else {
|
|
127
|
-
onSelect(selection.reset());
|
|
128
|
-
}
|
|
129
|
-
this.restoreFocusWithoutScroll();
|
|
130
|
-
});
|
|
131
|
-
_defineProperty(this, "restoreFocusWithoutScroll", () => {
|
|
132
|
-
const {
|
|
133
|
-
scrollX,
|
|
134
|
-
scrollY
|
|
135
|
-
} = window;
|
|
136
|
-
this.props.onFocusRestore();
|
|
137
|
-
window.scrollTo(scrollX, scrollY);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
60
|
+
static defaultProps = {
|
|
61
|
+
isItemSelectable: () => true,
|
|
62
|
+
loading: false,
|
|
63
|
+
onSort: () => {},
|
|
64
|
+
onReorder: () => {},
|
|
65
|
+
getItemKey: item => item.id,
|
|
66
|
+
sortKey: 'id',
|
|
67
|
+
sortOrder: true,
|
|
68
|
+
draggable: false,
|
|
69
|
+
alwaysShowDragHandle: false,
|
|
70
|
+
stickyHeader: true,
|
|
71
|
+
getItemLevel: () => 0,
|
|
72
|
+
getItemClassName: () => null,
|
|
73
|
+
getMetaColumnClassName: () => null,
|
|
74
|
+
getItemDataTest: () => null,
|
|
75
|
+
isItemCollapsible: () => false,
|
|
76
|
+
isParentCollapsible: () => false,
|
|
77
|
+
isItemCollapsed: () => false,
|
|
78
|
+
onItemCollapse: () => {},
|
|
79
|
+
onItemExpand: () => {},
|
|
80
|
+
onItemDoubleClick: () => {},
|
|
81
|
+
onItemClick: () => {},
|
|
82
|
+
remoteSelection: false,
|
|
83
|
+
isDisabledSelectionVisible: () => false,
|
|
84
|
+
getCheckboxTooltip: () => undefined,
|
|
85
|
+
RowComponent: RowWithFocusSensorCallbacks,
|
|
86
|
+
wideFirstColumn: false
|
|
87
|
+
};
|
|
88
|
+
state = {
|
|
89
|
+
shortcutsScope: getUID('ring-table-'),
|
|
90
|
+
userSelectNone: false
|
|
91
|
+
};
|
|
140
92
|
componentDidMount() {
|
|
141
93
|
document.addEventListener('mouseup', this.onMouseUp);
|
|
142
94
|
}
|
|
143
|
-
componentDidUpdate(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
} = _ref2;
|
|
95
|
+
componentDidUpdate({
|
|
96
|
+
data,
|
|
97
|
+
selection,
|
|
98
|
+
onSelect,
|
|
99
|
+
selectable,
|
|
100
|
+
remoteSelection
|
|
101
|
+
}) {
|
|
151
102
|
if (data !== this.props.data && remoteSelection) {
|
|
152
103
|
onSelect(selection.cloneWith({
|
|
153
104
|
data: this.props.data
|
|
@@ -160,6 +111,72 @@ class Table extends PureComponent {
|
|
|
160
111
|
componentWillUnmount() {
|
|
161
112
|
document.removeEventListener('mouseup', this.onMouseUp);
|
|
162
113
|
}
|
|
114
|
+
onMouseDown = e => {
|
|
115
|
+
if (e.shiftKey) {
|
|
116
|
+
this.setState({
|
|
117
|
+
userSelectNone: true
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
onMouseUp = () => {
|
|
122
|
+
if (this.state.userSelectNone) {
|
|
123
|
+
this.setState({
|
|
124
|
+
userSelectNone: false
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
onRowFocus = row => {
|
|
129
|
+
const {
|
|
130
|
+
selection,
|
|
131
|
+
onSelect
|
|
132
|
+
} = this.props;
|
|
133
|
+
onSelect(selection.focus(row));
|
|
134
|
+
};
|
|
135
|
+
onRowSelect = (row, selected) => {
|
|
136
|
+
const {
|
|
137
|
+
selection,
|
|
138
|
+
onSelect
|
|
139
|
+
} = this.props;
|
|
140
|
+
if (selected) {
|
|
141
|
+
onSelect(selection.select(row));
|
|
142
|
+
} else {
|
|
143
|
+
onSelect(selection.deselect(row));
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
onSortEnd = ({
|
|
147
|
+
oldIndex,
|
|
148
|
+
newIndex
|
|
149
|
+
}) => {
|
|
150
|
+
const data = arrayMove(this.props.data, oldIndex, newIndex);
|
|
151
|
+
this.props.onReorder({
|
|
152
|
+
data,
|
|
153
|
+
oldIndex,
|
|
154
|
+
newIndex
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
onCheckboxChange = e => {
|
|
158
|
+
const {
|
|
159
|
+
checked
|
|
160
|
+
} = e.currentTarget;
|
|
161
|
+
const {
|
|
162
|
+
selection,
|
|
163
|
+
onSelect
|
|
164
|
+
} = this.props;
|
|
165
|
+
if (checked) {
|
|
166
|
+
onSelect(selection.selectAll());
|
|
167
|
+
} else {
|
|
168
|
+
onSelect(selection.reset());
|
|
169
|
+
}
|
|
170
|
+
this.restoreFocusWithoutScroll();
|
|
171
|
+
};
|
|
172
|
+
restoreFocusWithoutScroll = () => {
|
|
173
|
+
const {
|
|
174
|
+
scrollX,
|
|
175
|
+
scrollY
|
|
176
|
+
} = window;
|
|
177
|
+
this.props.onFocusRestore();
|
|
178
|
+
window.scrollTo(scrollX, scrollY);
|
|
179
|
+
};
|
|
163
180
|
render() {
|
|
164
181
|
const {
|
|
165
182
|
data,
|
|
@@ -226,11 +243,10 @@ class Table extends PureComponent {
|
|
|
226
243
|
[style.userSelectNone]: this.state.userSelectNone,
|
|
227
244
|
[style.disabledHover]: this.props.disabledHover
|
|
228
245
|
});
|
|
229
|
-
const renderList =
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
} = _ref3;
|
|
246
|
+
const renderList = ({
|
|
247
|
+
children,
|
|
248
|
+
props
|
|
249
|
+
}) => {
|
|
234
250
|
const empty = jsx("tr", {
|
|
235
251
|
children: jsx("td", {
|
|
236
252
|
colSpan: columnsArray.length || 1,
|
|
@@ -242,27 +258,29 @@ class Table extends PureComponent {
|
|
|
242
258
|
return jsxs("table", {
|
|
243
259
|
className: classes,
|
|
244
260
|
"data-test": 'ring-table',
|
|
245
|
-
children: [jsx(Header,
|
|
261
|
+
children: [jsx(Header, {
|
|
262
|
+
...headerProps
|
|
263
|
+
}), jsx("tbody", {
|
|
264
|
+
...props,
|
|
246
265
|
"data-test": 'ring-table-body',
|
|
247
266
|
children: tbody
|
|
248
|
-
})
|
|
267
|
+
})]
|
|
249
268
|
});
|
|
250
269
|
};
|
|
251
|
-
const renderItem =
|
|
270
|
+
const renderItem = ({
|
|
271
|
+
value,
|
|
272
|
+
props = {},
|
|
273
|
+
isDragged
|
|
274
|
+
}) => {
|
|
252
275
|
var _restProps$key;
|
|
253
|
-
let {
|
|
254
|
-
value,
|
|
255
|
-
props = {},
|
|
256
|
-
isDragged
|
|
257
|
-
} = _ref4;
|
|
258
276
|
if (value === null || value === undefined) {
|
|
259
277
|
return null;
|
|
260
278
|
}
|
|
261
279
|
const {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
const row = /*#__PURE__*/createElement(RowComponent,
|
|
280
|
+
ref,
|
|
281
|
+
...restProps
|
|
282
|
+
} = props;
|
|
283
|
+
const row = /*#__PURE__*/createElement(RowComponent, {
|
|
266
284
|
innerRef: ref,
|
|
267
285
|
level: getItemLevel(value),
|
|
268
286
|
item: value,
|
|
@@ -290,12 +308,14 @@ class Table extends PureComponent {
|
|
|
290
308
|
alwaysShowDragHandle: alwaysShowDragHandle,
|
|
291
309
|
dragHandleTitle: dragHandleTitle,
|
|
292
310
|
columns: columns,
|
|
293
|
-
"data-test": getItemDataTest(value)
|
|
294
|
-
|
|
311
|
+
"data-test": getItemDataTest(value),
|
|
312
|
+
...restProps,
|
|
295
313
|
key: (_restProps$key = restProps.key) !== null && _restProps$key !== void 0 ? _restProps$key : getItemKey(value)
|
|
296
|
-
})
|
|
314
|
+
});
|
|
297
315
|
return isDragged ? jsx("table", {
|
|
298
|
-
style:
|
|
316
|
+
style: {
|
|
317
|
+
...props.style
|
|
318
|
+
},
|
|
299
319
|
className: style.draggingTable,
|
|
300
320
|
children: jsx("tbody", {
|
|
301
321
|
children: row
|
|
@@ -330,44 +350,15 @@ class Table extends PureComponent {
|
|
|
330
350
|
});
|
|
331
351
|
}
|
|
332
352
|
}
|
|
333
|
-
_defineProperty(Table, "defaultProps", {
|
|
334
|
-
isItemSelectable: () => true,
|
|
335
|
-
loading: false,
|
|
336
|
-
onSort: () => {},
|
|
337
|
-
onReorder: () => {},
|
|
338
|
-
getItemKey: item => item.id,
|
|
339
|
-
sortKey: 'id',
|
|
340
|
-
sortOrder: true,
|
|
341
|
-
draggable: false,
|
|
342
|
-
alwaysShowDragHandle: false,
|
|
343
|
-
stickyHeader: true,
|
|
344
|
-
getItemLevel: () => 0,
|
|
345
|
-
getItemClassName: () => null,
|
|
346
|
-
getMetaColumnClassName: () => null,
|
|
347
|
-
getItemDataTest: () => null,
|
|
348
|
-
isItemCollapsible: () => false,
|
|
349
|
-
isParentCollapsible: () => false,
|
|
350
|
-
isItemCollapsed: () => false,
|
|
351
|
-
onItemCollapse: () => {},
|
|
352
|
-
onItemExpand: () => {},
|
|
353
|
-
onItemDoubleClick: () => {},
|
|
354
|
-
onItemClick: () => {},
|
|
355
|
-
remoteSelection: false,
|
|
356
|
-
isDisabledSelectionVisible: () => false,
|
|
357
|
-
getCheckboxTooltip: () => undefined,
|
|
358
|
-
RowComponent: RowWithFocusSensorCallbacks,
|
|
359
|
-
wideFirstColumn: false
|
|
360
|
-
});
|
|
361
353
|
const getContainer = () => disableHoverHOC(selectionShortcutsHOC(focusSensorHOC(Table)));
|
|
362
354
|
// eslint-disable-next-line react/no-multi-comp
|
|
363
355
|
class TableContainer extends Component {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
// https://stackoverflow.com/a/53882322/6304152
|
|
367
|
-
_defineProperty(this, "Table", getContainer());
|
|
368
|
-
}
|
|
356
|
+
// https://stackoverflow.com/a/53882322/6304152
|
|
357
|
+
Table = getContainer();
|
|
369
358
|
render() {
|
|
370
|
-
return jsx(this.Table,
|
|
359
|
+
return jsx(this.Table, {
|
|
360
|
+
...this.props
|
|
361
|
+
});
|
|
371
362
|
}
|
|
372
363
|
}
|
|
373
364
|
|