@jetbrains/ring-ui-built 7.0.65 → 7.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/_helpers/anchor.js +12 -17
- package/components/_helpers/avatar-info.js +4 -5
- package/components/_helpers/button.classes.js +20 -21
- package/components/_helpers/caption.js +3 -3
- package/components/_helpers/card.js +26 -32
- package/components/_helpers/dialog-body-scroll-preventer.js +1 -2
- package/components/_helpers/icon-svg.js +9 -12
- package/components/_helpers/input.js +78 -86
- package/components/_helpers/loader-core.js +260 -0
- package/components/_helpers/query-assist-suggestions.js +0 -1
- package/components/_helpers/select-filter.js +19 -26
- package/components/_helpers/services-link.js +9 -12
- package/components/_helpers/sidebar.js +36 -44
- package/components/_helpers/tab-link.js +9 -11
- package/components/_helpers/theme.js +20 -24
- package/components/_helpers/title.js +12 -17
- package/components/alert/alert.js +41 -49
- package/components/alert/container.js +9 -12
- package/components/alert-service/alert-service.js +23 -32
- package/components/analytics/analytics-custom-plugin.js +12 -17
- package/components/analytics/analytics.js +1 -3
- package/components/auth/auth-core.js +128 -170
- package/components/auth/auth.js +3 -10
- package/components/auth/background-flow.js +5 -8
- package/components/auth/down-notification.js +9 -17
- package/components/auth/iframe-flow.js +13 -19
- package/components/auth/request-builder.js +4 -9
- package/components/auth/response-parser.js +9 -12
- package/components/auth/storage.js +12 -18
- package/components/auth/token-validator.js +19 -30
- package/components/auth/window-flow.js +22 -27
- package/components/auth-dialog/auth-dialog.js +40 -48
- package/components/auth-dialog-service/auth-dialog-service.js +10 -13
- package/components/avatar/avatar.figma.js +6 -6
- package/components/avatar/avatar.js +58 -59
- package/components/avatar/fallback-avatar.js +8 -11
- package/components/avatar-stack/avatar-stack.figma.js +10 -11
- package/components/avatar-stack/avatar-stack.js +25 -31
- package/components/banner/banner.js +0 -6
- package/components/breadcrumbs/breadcrumbs.figma.js +8 -6
- package/components/breadcrumbs/breadcrumbs.js +4 -5
- package/components/button/button.figma.js +15 -10
- package/components/button/button.js +59 -64
- package/components/button-group/button-group.js +11 -15
- package/components/button-group/caption.js +0 -1
- package/components/button-set/button-set.js +9 -12
- package/components/button-toolbar/button-toolbar.js +8 -11
- package/components/caret/caret.js +20 -28
- package/components/checkbox/checkbox-group.figma.js +8 -10
- package/components/checkbox/checkbox.figma.js +5 -5
- package/components/checkbox/checkbox.js +27 -35
- package/components/clipboard/clipboard-fallback.js +3 -3
- package/components/clipboard/clipboard.js +3 -16
- package/components/code/code.js +8 -14
- package/components/collapse/collapse-content.js +10 -15
- package/components/collapse/collapse-control.js +5 -7
- package/components/collapse/collapse.js +9 -11
- package/components/collapse/utils.js +1 -1
- package/components/confirm/confirm.js +17 -26
- package/components/confirm-service/confirm-service.js +30 -31
- package/components/content-layout/content-layout.js +21 -28
- package/components/content-layout/sidebar.js +0 -2
- package/components/contenteditable/contenteditable.js +23 -28
- package/components/control-help/control-help.js +8 -10
- package/components/control-label/control-label.js +12 -17
- package/components/data-list/data-list.js +57 -65
- package/components/data-list/data-list.mock.js +0 -4
- package/components/data-list/item.js +65 -72
- package/components/data-list/selection.js +11 -19
- package/components/data-list/title.js +0 -4
- package/components/date-picker/consts.js +3 -4
- package/components/date-picker/date-input.js +25 -33
- package/components/date-picker/date-picker.js +179 -193
- package/components/date-picker/date-popup.js +135 -127
- package/components/date-picker/day.d.ts +1 -1
- package/components/date-picker/day.js +24 -30
- package/components/date-picker/month-names.js +7 -12
- package/components/date-picker/month-slider.js +16 -22
- package/components/date-picker/month.js +3 -5
- package/components/date-picker/months.js +6 -6
- package/components/date-picker/weekdays.js +0 -1
- package/components/date-picker/years.js +20 -26
- package/components/dialog/dialog-body-scroll-preventer.js +0 -1
- package/components/dialog/dialog.js +73 -83
- package/components/dropdown/anchor.js +0 -4
- package/components/dropdown/dropdown.js +98 -114
- package/components/dropdown-menu/dropdown-menu.js +80 -79
- package/components/editable-heading/editable-heading.js +48 -54
- package/components/error-bubble/error-bubble.figma.js +4 -4
- package/components/error-bubble/error-bubble.js +9 -13
- package/components/error-message/error-message.js +1 -6
- package/components/footer/footer.js +11 -15
- package/components/global/compose-refs.js +1 -4
- package/components/global/compose.js +1 -4
- package/components/global/configuration.js +3 -3
- package/components/global/controls-height.js +0 -1
- package/components/global/create-stateful-context.js +10 -14
- package/components/global/data-tests.js +2 -10
- package/components/global/dom.js +6 -19
- package/components/global/focus-sensor-hoc.js +74 -87
- package/components/global/fuzzy-highlight.js +3 -8
- package/components/global/get-uid.js +1 -1
- package/components/global/inject-styles.js +5 -6
- package/components/global/listeners.js +2 -11
- package/components/global/memoize.js +0 -2
- package/components/global/normalize-indent.js +2 -6
- package/components/global/promise-with-timeout.js +4 -5
- package/components/global/react-dom-renderer.js +4 -9
- package/components/global/rerender-hoc.js +8 -11
- package/components/global/schedule-raf.js +1 -2
- package/components/global/theme.js +0 -5
- package/components/global/trivial-template-tag.js +1 -6
- package/components/global/url.js +2 -6
- package/components/global/use-event-callback.js +2 -3
- package/components/grid/col.js +7 -18
- package/components/grid/grid.js +9 -14
- package/components/grid/row.js +7 -11
- package/components/group/group.js +9 -12
- package/components/header/header-icon.js +8 -13
- package/components/header/header.js +16 -27
- package/components/header/links.js +7 -10
- package/components/header/logo.js +12 -16
- package/components/header/profile.js +73 -83
- package/components/header/services-link.js +0 -2
- package/components/header/services.js +32 -43
- package/components/header/smart-profile.js +44 -59
- package/components/header/smart-services.js +33 -45
- package/components/header/tray.js +8 -10
- package/components/heading/heading.js +27 -27
- package/components/http/http.js +120 -125
- package/components/http/http.mock.js +6 -10
- package/components/hub-source/hub-source-user.js +6 -13
- package/components/hub-source/hub-source-users-groups.js +8 -12
- package/components/hub-source/hub-source.js +8 -10
- package/components/i18n/i18n-context.js +4 -7
- package/components/i18n/i18n.js +5 -5
- package/components/icon/icon-svg.js +0 -4
- package/components/icon/icon.js +28 -32
- package/components/icon/index.js +0 -4
- package/components/input/input.figma.js +8 -8
- package/components/input/input.js +0 -4
- package/components/island/adaptive-island-hoc.js +19 -23
- package/components/island/content.js +70 -75
- package/components/island/header.js +21 -21
- package/components/island/island.js +11 -14
- package/components/link/clickable-link.js +30 -37
- package/components/link/link.js +27 -29
- package/components/list/list-custom.js +6 -11
- package/components/list/list-item.js +49 -56
- package/components/list/list-separator.js +0 -1
- package/components/list/list-title.js +0 -1
- package/components/list/list-users-groups-source.js +14 -22
- package/components/list/list.classes.js +8 -9
- package/components/list/list.js +387 -404
- package/components/loader/loader-core.js +2 -265
- package/components/loader/loader.d.ts +8 -0
- package/components/loader/loader.js +43 -29
- package/components/loader-inline/loader-inline.js +9 -12
- package/components/loader-screen/loader-screen.js +10 -14
- package/components/login-dialog/login-dialog.js +46 -54
- package/components/login-dialog/service.js +13 -15
- package/components/message/message.js +65 -79
- package/components/old-browsers-message/old-browsers-message-stop.js +0 -3
- package/components/old-browsers-message/old-browsers-message.js +1 -4
- package/components/old-browsers-message/white-list.js +5 -7
- package/components/pager/pager.js +73 -88
- package/components/panel/panel.js +9 -12
- package/components/permissions/permissions-cache.js +6 -8
- package/components/permissions/permissions.js +19 -21
- package/components/popup/popup.js +136 -145
- package/components/popup/popup.target.js +8 -10
- package/components/popup/position-css.js +19 -27
- package/components/popup/position.js +22 -28
- package/components/popup-menu/popup-menu.js +27 -37
- package/components/progress-bar/progress-bar.js +26 -32
- package/components/query-assist/query-assist-suggestions.js +0 -6
- package/components/query-assist/query-assist.js +432 -468
- package/components/radio/radio-item.js +30 -40
- package/components/radio/radio.js +6 -10
- package/components/scrollable-section/scrollable-section.js +7 -10
- package/components/select/select-filter.js +0 -6
- package/components/select/select-popup.js +155 -174
- package/components/select/select.js +464 -479
- package/components/shortcuts/core.js +40 -45
- package/components/shortcuts/shortcut-title.js +0 -1
- package/components/shortcuts/shortcuts-hoc.js +9 -15
- package/components/shortcuts/shortcuts.js +3 -5
- package/components/slider/slider.js +53 -66
- package/components/slider/slider.utils.js +1 -4
- package/components/storage/storage-local.js +2 -8
- package/components/storage/storage.js +0 -5
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +21 -30
- package/components/table/cell.js +3 -4
- package/components/table/disable-hover-hoc.js +24 -28
- package/components/table/header-cell.js +30 -38
- package/components/table/header.js +20 -28
- package/components/table/multitable.js +81 -101
- package/components/table/row-with-focus-sensor.js +17 -28
- package/components/table/row.js +89 -99
- package/components/table/selection-adapter.js +0 -2
- package/components/table/selection-shortcuts-hoc.js +159 -161
- package/components/table/selection.js +23 -31
- package/components/table/simple-table.js +16 -22
- package/components/table/smart-table.js +19 -26
- package/components/table/table.js +137 -146
- package/components/tabs/collapsible-more.js +34 -47
- package/components/tabs/collapsible-tab.js +28 -33
- package/components/tabs/collapsible-tabs.js +18 -26
- package/components/tabs/custom-item.js +3 -6
- package/components/tabs/dumb-tabs.js +48 -64
- package/components/tabs/smart-tabs.js +14 -23
- package/components/tabs/tab-link.js +0 -2
- package/components/tabs/tab.js +0 -1
- package/components/tabs/tabs.js +0 -7
- package/components/tag/tag.js +30 -35
- package/components/tags-input/tags-input.js +192 -218
- package/components/tags-list/tags-list.js +26 -31
- package/components/text/text.js +16 -19
- package/components/toggle/toggle.js +19 -23
- package/components/tooltip/tooltip.js +110 -121
- package/components/upload/upload.js +19 -28
- package/components/user-agreement/service.js +247 -252
- package/components/user-agreement/toolbox.eula.js +160 -1
- package/components/user-agreement/user-agreement.js +23 -32
- package/components/user-card/card.js +0 -5
- package/components/user-card/smart-user-card-tooltip.js +41 -50
- package/components/user-card/tooltip.js +32 -38
- package/components/user-card/user-card.js +0 -5
- package/package.json +9 -3
- package/components/_helpers/_rollupPluginBabelHelpers.js +0 -72
package/components/table/row.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty, a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
2
|
import { PureComponent } from 'react';
|
|
5
3
|
import classNames from 'classnames';
|
|
@@ -20,8 +18,6 @@ import '../icon/icon.js';
|
|
|
20
18
|
import 'util-deprecate';
|
|
21
19
|
import '../icon/icon.constants.js';
|
|
22
20
|
import '../_helpers/icon-svg.js';
|
|
23
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
24
|
-
import 'core-js/modules/es.string.replace.js';
|
|
25
21
|
import '../global/memoize.js';
|
|
26
22
|
import '../control-help/control-help.js';
|
|
27
23
|
import '@jetbrains/icons/chevron-12px-down';
|
|
@@ -40,19 +36,16 @@ import '../global/sniffer.js';
|
|
|
40
36
|
import 'sniffr';
|
|
41
37
|
import '../tab-trap/tab-trap.js';
|
|
42
38
|
import '../popup/position.js';
|
|
43
|
-
import 'core-js/modules/es.array.sort.js';
|
|
44
39
|
import '../popup/popup.consts.js';
|
|
45
40
|
import '../popup/popup.target.js';
|
|
46
41
|
import '../popup/position-css.js';
|
|
47
42
|
import '../_helpers/theme.js';
|
|
48
43
|
import 'memoize-one';
|
|
49
44
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
dragHandleTitle = 'Drag to reorder'
|
|
55
|
-
} = _ref;
|
|
45
|
+
const DragHandle = ({
|
|
46
|
+
alwaysShowDragHandle,
|
|
47
|
+
dragHandleTitle = 'Drag to reorder'
|
|
48
|
+
}) => {
|
|
56
49
|
const classes = classNames(style.dragHandle, {
|
|
57
50
|
[style.visibleDragHandle]: alwaysShowDragHandle
|
|
58
51
|
});
|
|
@@ -64,43 +57,46 @@ const DragHandle = _ref => {
|
|
|
64
57
|
});
|
|
65
58
|
};
|
|
66
59
|
class Row extends PureComponent {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
60
|
+
static defaultProps = {
|
|
61
|
+
selectable: true,
|
|
62
|
+
showFocus: false,
|
|
63
|
+
draggable: false,
|
|
64
|
+
alwaysShowDragHandle: false,
|
|
65
|
+
selected: false,
|
|
66
|
+
onHover: () => {},
|
|
67
|
+
onSelect: () => {},
|
|
68
|
+
onDoubleClick: () => {},
|
|
69
|
+
onClick: () => {},
|
|
70
|
+
level: 0,
|
|
71
|
+
collapsible: false,
|
|
72
|
+
parentCollapsible: false,
|
|
73
|
+
collapsed: false,
|
|
74
|
+
onCollapse: () => {},
|
|
75
|
+
onExpand: () => {}
|
|
76
|
+
};
|
|
77
|
+
id = getUID('table-row-');
|
|
78
|
+
onMouseEnter = e => {
|
|
79
|
+
const {
|
|
80
|
+
item,
|
|
81
|
+
onHover
|
|
82
|
+
} = this.props;
|
|
83
|
+
onHover(item, e);
|
|
84
|
+
};
|
|
85
|
+
onClick = e => {
|
|
86
|
+
const {
|
|
87
|
+
item
|
|
88
|
+
} = this.props;
|
|
89
|
+
this.props.onClick(item, e);
|
|
90
|
+
if (e.shiftKey) {
|
|
90
91
|
this.toggleSelection();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
_defineProperty(this, "rowRef", el => {
|
|
100
|
-
this.row = el;
|
|
101
|
-
});
|
|
102
|
-
_defineProperty(this, "composedRowRef", createComposedRef());
|
|
103
|
-
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
onCheckboxFocus = () => {
|
|
95
|
+
this.props.onFocusRestore();
|
|
96
|
+
};
|
|
97
|
+
onCheckboxChange = () => {
|
|
98
|
+
this.toggleSelection();
|
|
99
|
+
};
|
|
104
100
|
toggleSelection() {
|
|
105
101
|
const {
|
|
106
102
|
selectable,
|
|
@@ -112,37 +108,47 @@ class Row extends PureComponent {
|
|
|
112
108
|
onSelect(item, !selected);
|
|
113
109
|
}
|
|
114
110
|
}
|
|
111
|
+
onDoubleClick = () => {
|
|
112
|
+
const {
|
|
113
|
+
item
|
|
114
|
+
} = this.props;
|
|
115
|
+
this.props.onDoubleClick(item);
|
|
116
|
+
};
|
|
117
|
+
row;
|
|
118
|
+
rowRef = el => {
|
|
119
|
+
this.row = el;
|
|
120
|
+
};
|
|
121
|
+
composedRowRef = createComposedRef();
|
|
115
122
|
render() {
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
restProps = _objectWithoutProperties(_this$props, _excluded);
|
|
123
|
+
const {
|
|
124
|
+
item,
|
|
125
|
+
columns: columnProps,
|
|
126
|
+
selectable,
|
|
127
|
+
selected,
|
|
128
|
+
showFocus,
|
|
129
|
+
draggable,
|
|
130
|
+
alwaysShowDragHandle,
|
|
131
|
+
dragHandleTitle,
|
|
132
|
+
level,
|
|
133
|
+
collapsible,
|
|
134
|
+
parentCollapsible,
|
|
135
|
+
collapsed,
|
|
136
|
+
onCollapse,
|
|
137
|
+
onExpand,
|
|
138
|
+
showDisabledSelection,
|
|
139
|
+
onSelect,
|
|
140
|
+
checkboxTooltip,
|
|
141
|
+
innerRef,
|
|
142
|
+
focused,
|
|
143
|
+
autofocus,
|
|
144
|
+
onFocusReset,
|
|
145
|
+
onFocusRestore,
|
|
146
|
+
onHover,
|
|
147
|
+
className,
|
|
148
|
+
metaColumnClassName,
|
|
149
|
+
'data-test': dataTest,
|
|
150
|
+
...restProps
|
|
151
|
+
} = this.props;
|
|
146
152
|
const classes = classNames(className, {
|
|
147
153
|
[style.row]: true,
|
|
148
154
|
[style.rowFocused]: showFocus,
|
|
@@ -157,7 +163,7 @@ class Row extends PureComponent {
|
|
|
157
163
|
const COLLAPSIBLE_PARENT_OFFSET = 20;
|
|
158
164
|
const gap = level * SUBITEM_OFFSET + (parentCollapsible ? COLLAPSIBLE_PARENT_OFFSET : 0);
|
|
159
165
|
const metaColumnStyle = {
|
|
160
|
-
paddingLeft:
|
|
166
|
+
paddingLeft: `${gap}px`
|
|
161
167
|
};
|
|
162
168
|
const metaColumn = jsxs("div", {
|
|
163
169
|
className: metaColumnClasses,
|
|
@@ -208,36 +214,20 @@ class Row extends PureComponent {
|
|
|
208
214
|
children: [index === 0 && showMetaColumn && metaColumn, value]
|
|
209
215
|
}, column.id);
|
|
210
216
|
});
|
|
211
|
-
return jsx("tr",
|
|
217
|
+
return jsx("tr", {
|
|
212
218
|
id: this.id,
|
|
213
219
|
ref: this.composedRowRef(this.rowRef, innerRef),
|
|
214
220
|
className: classes,
|
|
215
221
|
tabIndex: 0,
|
|
216
|
-
"data-test": joinDataTestAttributes('ring-table-row', dataTest)
|
|
217
|
-
|
|
222
|
+
"data-test": joinDataTestAttributes('ring-table-row', dataTest),
|
|
223
|
+
...testAttrs,
|
|
224
|
+
...restProps,
|
|
218
225
|
onMouseMove: this.onMouseEnter,
|
|
219
226
|
onClick: this.onClick,
|
|
220
227
|
onDoubleClick: this.onDoubleClick,
|
|
221
228
|
children: cells
|
|
222
|
-
})
|
|
229
|
+
});
|
|
223
230
|
}
|
|
224
231
|
}
|
|
225
|
-
_defineProperty(Row, "defaultProps", {
|
|
226
|
-
selectable: true,
|
|
227
|
-
showFocus: false,
|
|
228
|
-
draggable: false,
|
|
229
|
-
alwaysShowDragHandle: false,
|
|
230
|
-
selected: false,
|
|
231
|
-
onHover: () => {},
|
|
232
|
-
onSelect: () => {},
|
|
233
|
-
onDoubleClick: () => {},
|
|
234
|
-
onClick: () => {},
|
|
235
|
-
level: 0,
|
|
236
|
-
collapsible: false,
|
|
237
|
-
parentCollapsible: false,
|
|
238
|
-
collapsed: false,
|
|
239
|
-
onCollapse: () => {},
|
|
240
|
-
onExpand: () => {}
|
|
241
|
-
});
|
|
242
232
|
|
|
243
233
|
export { Row as default };
|
|
@@ -1,178 +1,176 @@
|
|
|
1
|
-
import { b as _objectSpread2, _ as _defineProperty, a as _objectWithoutProperties } 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
|
|
|
6
|
-
const _excluded = ["selection", "selectable", "onSelect", "shortcuts"];
|
|
7
4
|
function selectionShortcutsHOC(ComposedComponent) {
|
|
8
5
|
class SelectionShortcuts extends PureComponent {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
'ctrl+a': this.onCmdAPress
|
|
152
|
-
});
|
|
153
|
-
}
|
|
6
|
+
onUpPress = () => {
|
|
7
|
+
const {
|
|
8
|
+
selection,
|
|
9
|
+
onSelect
|
|
10
|
+
} = this.props;
|
|
11
|
+
const newSelection = selection.moveUp();
|
|
12
|
+
if (newSelection) {
|
|
13
|
+
onSelect?.(newSelection);
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
};
|
|
17
|
+
onDownPress = () => {
|
|
18
|
+
const {
|
|
19
|
+
selection,
|
|
20
|
+
onSelect
|
|
21
|
+
} = this.props;
|
|
22
|
+
const newSelection = selection.moveDown();
|
|
23
|
+
if (newSelection) {
|
|
24
|
+
onSelect?.(newSelection);
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
};
|
|
28
|
+
shiftSelectionMode;
|
|
29
|
+
onShiftKeyDown = () => {
|
|
30
|
+
const {
|
|
31
|
+
selection
|
|
32
|
+
} = this.props;
|
|
33
|
+
if (selection.isSelected(selection.getFocused())) {
|
|
34
|
+
this.shiftSelectionMode = 'deletion';
|
|
35
|
+
} else {
|
|
36
|
+
this.shiftSelectionMode = 'addition';
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
shiftSelect = selection => {
|
|
40
|
+
if (this.shiftSelectionMode === 'addition') {
|
|
41
|
+
return selection.select();
|
|
42
|
+
}
|
|
43
|
+
return selection.deselect();
|
|
44
|
+
};
|
|
45
|
+
onShiftUpPress = e => {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
const {
|
|
48
|
+
selectable,
|
|
49
|
+
selection,
|
|
50
|
+
onSelect
|
|
51
|
+
} = this.props;
|
|
52
|
+
if (!selectable) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const newSelection = this.shiftSelect(selection);
|
|
56
|
+
const newMovedSelection = newSelection.moveUp();
|
|
57
|
+
if (newMovedSelection) {
|
|
58
|
+
onSelect?.(newMovedSelection);
|
|
59
|
+
} else {
|
|
60
|
+
onSelect?.(newSelection);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
onShiftDownPress = e => {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
const {
|
|
66
|
+
selectable,
|
|
67
|
+
selection,
|
|
68
|
+
onSelect
|
|
69
|
+
} = this.props;
|
|
70
|
+
if (!selectable) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const newSelection = this.shiftSelect(selection);
|
|
74
|
+
const newMovedSelection = newSelection.moveDown();
|
|
75
|
+
if (newMovedSelection) {
|
|
76
|
+
onSelect?.(newMovedSelection);
|
|
77
|
+
} else {
|
|
78
|
+
onSelect?.(newSelection);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
onHomePress = () => {
|
|
82
|
+
const {
|
|
83
|
+
selection,
|
|
84
|
+
onSelect
|
|
85
|
+
} = this.props;
|
|
86
|
+
const newSelection = selection.moveStart();
|
|
87
|
+
if (newSelection) {
|
|
88
|
+
onSelect?.(newSelection);
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
};
|
|
92
|
+
onEndPress = () => {
|
|
93
|
+
const {
|
|
94
|
+
selection,
|
|
95
|
+
onSelect
|
|
96
|
+
} = this.props;
|
|
97
|
+
const newSelection = selection.moveEnd();
|
|
98
|
+
if (newSelection) {
|
|
99
|
+
onSelect?.(newSelection);
|
|
100
|
+
}
|
|
101
|
+
return false;
|
|
102
|
+
};
|
|
103
|
+
onSpacePress = () => {
|
|
104
|
+
const {
|
|
105
|
+
selectable,
|
|
106
|
+
selection,
|
|
107
|
+
onSelect
|
|
108
|
+
} = this.props;
|
|
109
|
+
if (!selectable) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
onSelect?.(selection.toggleSelection());
|
|
113
|
+
return false;
|
|
114
|
+
};
|
|
115
|
+
onEscPress = () => {
|
|
116
|
+
const {
|
|
117
|
+
selection,
|
|
118
|
+
onSelect
|
|
119
|
+
} = this.props;
|
|
120
|
+
onSelect?.(selection.reset());
|
|
121
|
+
//this.restoreFocusWithoutScroll();
|
|
122
|
+
};
|
|
123
|
+
onCmdAPress = () => {
|
|
124
|
+
const {
|
|
125
|
+
selectable,
|
|
126
|
+
selection,
|
|
127
|
+
onSelect
|
|
128
|
+
} = this.props;
|
|
129
|
+
if (!selectable) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
onSelect?.(selection.selectAll());
|
|
133
|
+
return false;
|
|
134
|
+
};
|
|
135
|
+
shortcutsMap = {
|
|
136
|
+
up: this.onUpPress,
|
|
137
|
+
down: this.onDownPress,
|
|
138
|
+
shift: this.onShiftKeyDown,
|
|
139
|
+
'shift+up': this.onShiftUpPress,
|
|
140
|
+
'shift+down': this.onShiftDownPress,
|
|
141
|
+
home: this.onHomePress,
|
|
142
|
+
end: this.onEndPress,
|
|
143
|
+
space: this.onSpacePress,
|
|
144
|
+
esc: this.onEscPress,
|
|
145
|
+
'command+a': this.onCmdAPress,
|
|
146
|
+
'ctrl+a': this.onCmdAPress
|
|
147
|
+
};
|
|
154
148
|
render() {
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
149
|
+
const {
|
|
150
|
+
selection,
|
|
151
|
+
selectable,
|
|
152
|
+
onSelect,
|
|
153
|
+
shortcuts,
|
|
154
|
+
...restProps
|
|
155
|
+
} = this.props;
|
|
156
|
+
return jsx(ComposedComponent, {
|
|
157
|
+
...restProps,
|
|
164
158
|
selection: selection,
|
|
165
159
|
selectable: selectable,
|
|
166
160
|
onSelect: onSelect,
|
|
167
|
-
shortcutsMap:
|
|
168
|
-
|
|
161
|
+
shortcutsMap: {
|
|
162
|
+
...this.shortcutsMap,
|
|
163
|
+
...this.props.shortcuts
|
|
164
|
+
}
|
|
165
|
+
});
|
|
169
166
|
}
|
|
170
167
|
}
|
|
171
|
-
SelectionShortcuts.defaultProps =
|
|
168
|
+
SelectionShortcuts.defaultProps = {
|
|
169
|
+
...ComposedComponent.defaultProps,
|
|
172
170
|
selectable: true,
|
|
173
171
|
onSelect: () => {},
|
|
174
172
|
shortcuts: {}
|
|
175
|
-
}
|
|
173
|
+
};
|
|
176
174
|
return SelectionShortcuts;
|
|
177
175
|
}
|
|
178
176
|
|