@jetbrains/ring-ui 7.0.0-beta.8 → 7.0.0
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/babel.config.js +20 -14
- package/components/alert/alert.css +7 -7
- package/components/alert/alert.d.ts +2 -2
- package/components/alert/alert.js +10 -12
- package/components/alert/container.js +1 -1
- package/components/alert-service/alert-service.js +4 -2
- package/components/analytics/analytics__custom-plugin.js +1 -1
- package/components/auth/auth.js +1 -1
- package/components/auth/auth__core.js +36 -36
- package/components/auth/background-flow.js +2 -2
- package/components/auth/down-notification.js +3 -1
- package/components/auth/iframe-flow.js +4 -2
- package/components/auth/request-builder.js +5 -5
- package/components/auth/storage.js +10 -9
- package/components/auth/token-validator.js +8 -15
- package/components/auth-dialog/auth-dialog.js +8 -8
- package/components/auth-dialog-service/auth-dialog-service.js +4 -4
- package/components/avatar/avatar.js +9 -7
- package/components/avatar/fallback-avatar.js +15 -12
- package/components/button/button.css +36 -25
- package/components/button/button.js +9 -9
- package/components/button/button__classes.d.ts +1 -1
- package/components/button/button__classes.js +3 -4
- package/components/button-group/button-group.css +25 -13
- package/components/button-group/caption.js +1 -1
- package/components/button-toolbar/button-toolbar.d.ts +1 -1
- package/components/button-toolbar/button-toolbar.js +2 -2
- package/components/caret/caret.js +8 -8
- package/components/checkbox/checkbox.css +8 -5
- package/components/checkbox/checkbox.js +1 -1
- package/components/clipboard/clipboard-fallback.js +2 -6
- package/components/clipboard/clipboard.js +5 -5
- package/components/code/code.d.ts +1 -1
- package/components/code/code.js +2 -2
- package/components/code/highlight.css +3 -1
- package/components/collapse/collapse-content.d.ts +1 -2
- package/components/collapse/collapse-content.js +25 -14
- package/components/collapse/collapse-context.js +1 -1
- package/components/collapse/collapse-control.js +5 -3
- package/components/collapse/collapse.css +21 -20
- package/components/collapse/collapse.js +2 -2
- package/components/confirm/confirm.d.ts +2 -2
- package/components/confirm/confirm.js +2 -2
- package/components/confirm-service/confirm-service.d.ts +1 -1
- package/components/confirm-service/confirm-service.js +6 -6
- package/components/content-layout/content-layout.css +6 -5
- package/components/content-layout/content-layout.js +7 -6
- package/components/content-layout/sidebar.js +5 -5
- package/components/contenteditable/contenteditable.d.ts +1 -1
- package/components/contenteditable/contenteditable.js +3 -4
- package/components/control-label/control-label.js +5 -3
- package/components/data-list/data-list.css +3 -3
- package/components/data-list/data-list.d.ts +2 -2
- package/components/data-list/data-list.js +6 -7
- package/components/data-list/data-list.mock.js +57 -47
- package/components/data-list/item.js +14 -16
- package/components/data-list/selection.js +5 -7
- package/components/data-list/title.js +5 -6
- package/components/date-picker/consts.js +2 -2
- package/components/date-picker/date-input.js +4 -4
- package/components/date-picker/date-picker.css +23 -18
- package/components/date-picker/date-picker.d.ts +2 -1
- package/components/date-picker/date-picker.js +13 -19
- package/components/date-picker/date-popup.js +30 -36
- package/components/date-picker/day.js +6 -9
- package/components/date-picker/formats.js +647 -1
- package/components/date-picker/month-names.js +6 -8
- package/components/date-picker/month-slider.js +2 -2
- package/components/date-picker/month.js +1 -3
- package/components/date-picker/months.js +2 -6
- package/components/date-picker/weekdays.js +2 -3
- package/components/date-picker/years.js +3 -3
- package/components/dialog/dialog.d.ts +1 -0
- package/components/dialog/dialog.js +20 -13
- package/components/dialog/dialog__body-scroll-preventer.js +1 -1
- package/components/dropdown/dropdown.css +2 -4
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +5 -5
- package/components/dropdown-menu/dropdown-menu.js +5 -5
- package/components/editable-heading/editable-heading.css +5 -2
- package/components/editable-heading/editable-heading.js +21 -19
- package/components/error-bubble/error-bubble.js +1 -1
- package/components/error-message/error-message.js +2 -4
- package/components/footer/footer.js +11 -15
- package/components/form/form.stories.js +45 -63
- package/components/global/create-stateful-context.js +2 -4
- package/components/global/data-tests.js +5 -6
- package/components/global/dom.js +8 -11
- package/components/global/focus-sensor-hoc.js +5 -6
- package/components/global/fuzzy-highlight.js +1 -1
- package/components/global/get-event-key.js +2 -2
- package/components/global/global.css +0 -3
- package/components/global/linear-function.js +1 -1
- package/components/global/normalize-indent.js +2 -6
- package/components/global/react-dom-renderer.js +2 -3
- package/components/global/theme.d.ts +4 -2
- package/components/global/theme.js +14 -12
- package/components/global/url.js +8 -8
- package/components/global/variables.css +1 -8
- package/components/global/variables_dark.css +0 -1
- package/components/grid/col.js +6 -6
- package/components/grid/grid.css +174 -173
- package/components/grid/grid.js +1 -1
- package/components/grid/row.js +13 -6
- package/components/group/group.js +1 -1
- package/components/header/header-icon.js +2 -2
- package/components/header/header.css +19 -15
- package/components/header/header.js +3 -5
- package/components/header/links.js +1 -1
- package/components/header/logo.js +1 -1
- package/components/header/profile.d.ts +2 -2
- package/components/header/profile.js +9 -9
- package/components/header/services-link.js +1 -1
- package/components/header/services.js +4 -5
- package/components/header/smart-profile.js +4 -3
- package/components/header/smart-services.js +9 -5
- package/components/header/tray.js +1 -1
- package/components/heading/heading.css +0 -1
- package/components/heading/heading.js +2 -2
- package/components/http/http.d.ts +3 -3
- package/components/http/http.js +25 -29
- package/components/http/http.mock.js +9 -6
- package/components/hub-source/hub-source.js +5 -7
- package/components/hub-source/hub-source__user.js +1 -1
- package/components/hub-source/hub-source__users-groups.js +6 -7
- package/components/i18n/README.md +3 -4
- package/components/i18n/i18n-context.js +2 -4
- package/components/icon/icon.css +1 -1
- package/components/icon/icon.js +7 -9
- package/components/icon/icon__svg.js +6 -6
- package/components/input/input.css +1 -1
- package/components/input/input.js +11 -14
- package/components/input-size/input-size.stories.js +42 -22
- package/components/island/adaptive-island-hoc.js +1 -1
- package/components/island/content.js +4 -6
- package/components/island/header.js +8 -10
- package/components/island/island.css +5 -5
- package/components/island/island.js +1 -1
- package/components/link/clickableLink.js +3 -1
- package/components/link/link.js +5 -3
- package/components/list/consts.js +1 -1
- package/components/list/list.d.ts +1 -1
- package/components/list/list.js +35 -57
- package/components/list/list__custom.js +3 -5
- package/components/list/list__hint.js +3 -1
- package/components/list/list__item.js +11 -9
- package/components/list/list__link.js +1 -1
- package/components/list/list__separator.js +2 -2
- package/components/list/list__title.js +7 -3
- package/components/list/list__users-groups-source.js +6 -8
- package/components/loader/loader.js +1 -1
- package/components/loader/loader__core.js +5 -5
- package/components/loader-inline/loader-inline.css +0 -3
- package/components/loader-inline/loader-inline.js +5 -7
- package/components/loader-screen/loader-screen.js +1 -1
- package/components/login-dialog/login-dialog.js +4 -4
- package/components/login-dialog/service.js +5 -5
- package/components/markdown/markdown.css +6 -6
- package/components/markdown/markdown.d.ts +2 -2
- package/components/markdown/markdown.js +4 -6
- package/components/message/message.css +2 -1
- package/components/message/message.js +30 -21
- package/components/old-browsers-message/old-browsers-message.js +2 -2
- package/components/old-browsers-message/white-list.js +2 -3
- package/components/pager/pager.js +28 -29
- package/components/permissions/permissions.js +8 -13
- package/components/permissions/permissions__cache.js +6 -7
- package/components/popup/popup.consts.js +8 -2
- package/components/popup/popup.js +27 -33
- package/components/popup/popup.target.js +4 -4
- package/components/popup/position.js +21 -28
- package/components/popup-menu/popup-menu.js +1 -1
- package/components/progress-bar/progress-bar.css +10 -8
- package/components/progress-bar/progress-bar.d.ts +2 -2
- package/components/progress-bar/progress-bar.js +2 -2
- package/components/query-assist/query-assist.css +0 -3
- package/components/query-assist/query-assist.js +73 -84
- package/components/query-assist/query-assist__suggestions.js +10 -9
- package/components/radio/radio.css +6 -2
- package/components/radio/radio.js +1 -3
- package/components/scrollable-section/scrollable-section.css +5 -6
- package/components/scrollable-section/scrollable-section.js +1 -1
- package/components/select/select.css +5 -7
- package/components/select/select.d.ts +1 -1
- package/components/select/select.js +96 -110
- package/components/select/select__filter.js +1 -1
- package/components/select/select__popup.js +40 -51
- package/components/shortcuts/core.js +8 -6
- package/components/shortcuts/shortcut-title.js +6 -6
- package/components/shortcuts/shortcuts.js +1 -1
- package/components/sidebar/sidebar.css +3 -1
- package/components/slider/slider.css +14 -14
- package/components/slider/slider.js +7 -7
- package/components/tab-trap/tab-trap.js +7 -9
- package/components/table/cell.js +3 -1
- package/components/table/disable-hover-hoc.js +2 -2
- package/components/table/header-cell.js +5 -3
- package/components/table/header.d.ts +2 -10
- package/components/table/header.js +10 -12
- package/components/table/multitable.js +5 -3
- package/components/table/row.d.ts +0 -1
- package/components/table/row.js +20 -27
- package/components/table/selection-adapter.js +1 -1
- package/components/table/selection-shortcuts-hoc.js +2 -2
- package/components/table/selection.d.ts +2 -3
- package/components/table/selection.js +4 -5
- package/components/table/simple-table.js +4 -4
- package/components/table/smart-table.js +5 -5
- package/components/table/table.css +8 -9
- package/components/table/table.d.ts +0 -1
- package/components/table/table.js +22 -23
- package/components/table/table.stories.json +45 -16
- package/components/tabs/collapsible-more.d.ts +1 -1
- package/components/tabs/collapsible-more.js +13 -16
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.d.ts +2 -2
- package/components/tabs/collapsible-tabs.js +13 -22
- package/components/tabs/dumb-tabs.js +6 -9
- package/components/tabs/smart-tabs.js +4 -4
- package/components/tabs/tab-link.js +1 -3
- package/components/tabs/tabs.css +7 -9
- package/components/tag/tag.css +7 -7
- package/components/tag/tag.d.ts +1 -1
- package/components/tag/tag.js +9 -12
- package/components/tags-input/tags-input.js +15 -19
- package/components/tags-list/tags-list.d.ts +2 -2
- package/components/tags-list/tags-list.js +6 -5
- package/components/text/text.js +5 -3
- package/components/toggle/toggle.css +12 -10
- package/components/toggle/toggle.d.ts +2 -2
- package/components/toggle/toggle.js +4 -3
- package/components/tooltip/tooltip.d.ts +4 -1
- package/components/tooltip/tooltip.js +19 -10
- package/components/user-agreement/service.js +15 -13
- package/components/user-agreement/user-agreement.js +3 -5
- package/components/user-card/card.js +10 -9
- package/components/user-card/smart-user-card-tooltip.js +5 -7
- package/components/user-card/tooltip.js +4 -4
- package/components/user-card/user-card.css +4 -0
- package/jslint-xml.js +20 -19
- package/package.json +66 -58
- package/postcss.config.js +3 -4
- package/typings.d.ts +2 -4
- package/webpack.config.js +20 -25
- package/components/badge/badge.css +0 -42
- package/components/badge/badge.d.ts +0 -14
- package/components/badge/badge.js +0 -29
- package/components/island-legacy/content-legacy.d.ts +0 -5
- package/components/island-legacy/content-legacy.js +0 -12
- package/components/island-legacy/header-legacy.d.ts +0 -5
- package/components/island-legacy/header-legacy.js +0 -14
- package/components/island-legacy/island-legacy.css +0 -98
- package/components/island-legacy/island-legacy.d.ts +0 -7
- package/components/island-legacy/island-legacy.js +0 -14
- package/components/table-legacy/table-legacy.css +0 -346
- package/components/table-legacy/table-legacy__toolbar.css +0 -25
|
@@ -55,14 +55,14 @@ export default class SelectPopup extends PureComponent {
|
|
|
55
55
|
tags: null,
|
|
56
56
|
ringPopupTarget: null,
|
|
57
57
|
onSelectAll: noop,
|
|
58
|
-
onEmptyPopupEnter: noop
|
|
58
|
+
onEmptyPopupEnter: noop,
|
|
59
59
|
};
|
|
60
60
|
state = {
|
|
61
61
|
popupFilterShortcutsOptions: {
|
|
62
62
|
modal: true,
|
|
63
|
-
disabled: true
|
|
63
|
+
disabled: true,
|
|
64
64
|
},
|
|
65
|
-
tagsActiveIndex: null
|
|
65
|
+
tagsActiveIndex: null,
|
|
66
66
|
};
|
|
67
67
|
componentDidMount() {
|
|
68
68
|
window.document.addEventListener('mouseup', this.mouseUpHandler);
|
|
@@ -80,16 +80,13 @@ export default class SelectPopup extends PureComponent {
|
|
|
80
80
|
}
|
|
81
81
|
caret;
|
|
82
82
|
handleNavigation(event, navigateLeft) {
|
|
83
|
-
if (this.isEventTargetFilter(event) && this.caret != null &&
|
|
84
|
-
Number(this.caret.getPosition()) > 0 ||
|
|
83
|
+
if ((this.isEventTargetFilter(event) && this.caret != null && Number(this.caret.getPosition()) > 0) ||
|
|
85
84
|
!Array.isArray(this.props.selected)) {
|
|
86
85
|
return;
|
|
87
86
|
}
|
|
88
87
|
let newIndex = null;
|
|
89
88
|
if (navigateLeft) {
|
|
90
|
-
newIndex = this.state.tagsActiveIndex === null
|
|
91
|
-
? this.props.selected.length - 1
|
|
92
|
-
: this.state.tagsActiveIndex - 1;
|
|
89
|
+
newIndex = this.state.tagsActiveIndex === null ? this.props.selected.length - 1 : this.state.tagsActiveIndex - 1;
|
|
93
90
|
}
|
|
94
91
|
else if (this.state.tagsActiveIndex !== null) {
|
|
95
92
|
newIndex = this.state.tagsActiveIndex + 1;
|
|
@@ -99,7 +96,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
99
96
|
this.focusFilter();
|
|
100
97
|
}
|
|
101
98
|
this.setState({
|
|
102
|
-
tagsActiveIndex: newIndex
|
|
99
|
+
tagsActiveIndex: newIndex,
|
|
103
100
|
});
|
|
104
101
|
}
|
|
105
102
|
removeTag(tag, event) {
|
|
@@ -110,7 +107,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
110
107
|
if (_tag) {
|
|
111
108
|
this.onListSelect(_tag, event, { tryKeepOpen: true });
|
|
112
109
|
this.setState({
|
|
113
|
-
tagsActiveIndex: null
|
|
110
|
+
tagsActiveIndex: null,
|
|
114
111
|
});
|
|
115
112
|
this.focusFilter();
|
|
116
113
|
}
|
|
@@ -150,8 +147,8 @@ export default class SelectPopup extends PureComponent {
|
|
|
150
147
|
this.setState({
|
|
151
148
|
popupFilterShortcutsOptions: {
|
|
152
149
|
modal: true,
|
|
153
|
-
disabled: shortcutsDisabled
|
|
154
|
-
}
|
|
150
|
+
disabled: shortcutsDisabled,
|
|
151
|
+
},
|
|
155
152
|
});
|
|
156
153
|
}
|
|
157
154
|
mouseDownHandler = () => {
|
|
@@ -184,9 +181,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
184
181
|
if (this.props.filter || this.props.tags) {
|
|
185
182
|
return (<div className={styles.filterWrapper} data-test="ring-select-popup-filter">
|
|
186
183
|
{!this.props.tags && (<Icon glyph={this.props.filterIcon ?? searchIcon} className={styles.filterIcon} data-test-custom="ring-select-popup-filter-icon"/>)}
|
|
187
|
-
<FilterWithShortcuts rgShortcutsOptions={this.state.popupFilterShortcutsOptions} rgShortcutsMap={this.popupFilterShortcutsMap} value={this.props.filterValue} inputRef={this.composedFilterRef(this.filterRef, this.props.filterRef)} onBlur={this.popupFilterOnBlur} onFocus={this.onFilterFocus} className="ring-js-shortcuts" inputClassName={classNames({ [styles.filterWithTagsInput]: this.props.tags })} placeholder={typeof this.props.filter === 'object'
|
|
188
|
-
? this.props.filter.placeholder
|
|
189
|
-
: undefined} height={this.props.tags ? ControlsHeight.S : ControlsHeight.L} onChange={this.props.onFilter} onClick={this.onClickHandler} onClear={this.props.tags ? undefined : this.props.onClear} data-test-custom="ring-select-popup-filter-input" listId={this.props.listId} enableShortcuts={Object.keys(this.popupFilterShortcutsMap)}/>
|
|
184
|
+
<FilterWithShortcuts rgShortcutsOptions={this.state.popupFilterShortcutsOptions} rgShortcutsMap={this.popupFilterShortcutsMap} value={this.props.filterValue} inputRef={this.composedFilterRef(this.filterRef, this.props.filterRef)} onBlur={this.popupFilterOnBlur} onFocus={this.onFilterFocus} className="ring-js-shortcuts" inputClassName={classNames({ [styles.filterWithTagsInput]: this.props.tags })} placeholder={typeof this.props.filter === 'object' ? this.props.filter.placeholder : undefined} height={this.props.tags ? ControlsHeight.S : ControlsHeight.L} onChange={this.props.onFilter} onClick={this.onClickHandler} onClear={this.props.tags ? undefined : this.props.onClear} data-test-custom="ring-select-popup-filter-input" listId={this.props.listId} enableShortcuts={Object.keys(this.popupFilterShortcutsMap)}/>
|
|
190
185
|
</div>);
|
|
191
186
|
}
|
|
192
187
|
return null;
|
|
@@ -195,7 +190,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
195
190
|
handleTagClick = memoize((tag) => () => {
|
|
196
191
|
if (Array.isArray(this.props.selected)) {
|
|
197
192
|
this.setState({
|
|
198
|
-
tagsActiveIndex: this.props.selected.indexOf(tag)
|
|
193
|
+
tagsActiveIndex: this.props.selected.indexOf(tag),
|
|
199
194
|
});
|
|
200
195
|
}
|
|
201
196
|
});
|
|
@@ -206,17 +201,17 @@ export default class SelectPopup extends PureComponent {
|
|
|
206
201
|
return undefined;
|
|
207
202
|
}
|
|
208
203
|
getTags() {
|
|
209
|
-
return Array.isArray(this.props.selected) && (<div>
|
|
210
|
-
|
|
211
|
-
|
|
204
|
+
return (Array.isArray(this.props.selected) && (<div>
|
|
205
|
+
<TagsList tags={this.props.selected} activeIndex={this.state.tagsActiveIndex} handleRemove={this.handleRemoveTag} handleClick={this.handleTagClick} disabled={this.props.disabled} customTagComponent={this.getCustomTag(this.props.tags)}/>
|
|
206
|
+
</div>));
|
|
212
207
|
}
|
|
213
208
|
getFilterWithTags() {
|
|
214
209
|
if (this.props.tags) {
|
|
215
210
|
const classes = classNames([
|
|
216
211
|
styles.filterWithTags,
|
|
217
212
|
{
|
|
218
|
-
[styles.filterWithTagsFocused]: !this.state.popupFilterShortcutsOptions.disabled
|
|
219
|
-
}
|
|
213
|
+
[styles.filterWithTagsFocused]: !this.state.popupFilterShortcutsOptions.disabled,
|
|
214
|
+
},
|
|
220
215
|
]);
|
|
221
216
|
return (<div className={classes}>
|
|
222
217
|
{this.getTags()}
|
|
@@ -228,13 +223,13 @@ export default class SelectPopup extends PureComponent {
|
|
|
228
223
|
getBottomLine() {
|
|
229
224
|
const { loading, message, data } = this.props;
|
|
230
225
|
const hasMoreThanOneItem = data.length > 1;
|
|
231
|
-
return (loading || message) && (<div className={classNames(styles.bottomLine, {
|
|
232
|
-
[styles.bottomLineOverItem]: hasMoreThanOneItem
|
|
226
|
+
return ((loading || message) && (<div className={classNames(styles.bottomLine, {
|
|
227
|
+
[styles.bottomLineOverItem]: hasMoreThanOneItem,
|
|
233
228
|
})}>
|
|
234
|
-
|
|
229
|
+
{loading && <LoaderInline />}
|
|
235
230
|
|
|
236
|
-
|
|
237
|
-
|
|
231
|
+
{message && <div className={styles.message}>{message}</div>}
|
|
232
|
+
</div>));
|
|
238
233
|
}
|
|
239
234
|
handleListResize = () => {
|
|
240
235
|
this.forceUpdate();
|
|
@@ -263,16 +258,14 @@ export default class SelectPopup extends PureComponent {
|
|
|
263
258
|
getSelectAll = () => {
|
|
264
259
|
const multiple = this.props.multiple;
|
|
265
260
|
const activeFilters = this.props.data.filter(item => !item.disabled);
|
|
266
|
-
return Array.isArray(this.props.selected) && (<div className={styles.selectAll}>
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
{multiple.renderSelectedItemsDescription?.(this.props.selected, activeFilters.length) || (<Text info>{`${this.props.selected.length} selected`}</Text>)}
|
|
275
|
-
</div>);
|
|
261
|
+
return (Array.isArray(this.props.selected) && (<div className={styles.selectAll}>
|
|
262
|
+
{activeFilters.length === 0 ? (<span />) : (<Button text inline onClick={this.handleSelectAll}>
|
|
263
|
+
{activeFilters.length !== this.props.selected.length
|
|
264
|
+
? multiple.selectAllLabel || 'Select all'
|
|
265
|
+
: multiple.deselectAllLabel || 'Deselect all'}
|
|
266
|
+
</Button>)}
|
|
267
|
+
{multiple.renderSelectedItemsDescription?.(this.props.selected, activeFilters.length) || (<Text info>{`${this.props.selected.length} selected`}</Text>)}
|
|
268
|
+
</div>));
|
|
276
269
|
};
|
|
277
270
|
// Cache the value because this method is called
|
|
278
271
|
// inside `render` function which can be called N times
|
|
@@ -293,7 +286,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
293
286
|
const anchorNode = this.props.anchorElement;
|
|
294
287
|
const containerNode = getPopupContainer(ringPopupTarget) || document.documentElement;
|
|
295
288
|
return anchorNode != null
|
|
296
|
-
? Math.min(directions.reduce((maxHeight, direction) =>
|
|
289
|
+
? Math.min(directions.reduce((maxHeight, direction) => Math.max(maxHeight, maxHeightForDirection(direction, anchorNode, getStyles(containerNode).position !== 'static' ? containerNode : null) ?? 0), minMaxHeight), userDefinedMaxHeight)
|
|
297
290
|
: userDefinedMaxHeight;
|
|
298
291
|
});
|
|
299
292
|
popupRef = (el) => {
|
|
@@ -310,38 +303,34 @@ export default class SelectPopup extends PureComponent {
|
|
|
310
303
|
composedFilterRef = createComposedRef();
|
|
311
304
|
shortcutsScope = getUID('select-popup-');
|
|
312
305
|
shortcutsMap = {
|
|
313
|
-
tab: this.tabPress
|
|
306
|
+
tab: this.tabPress,
|
|
314
307
|
};
|
|
315
308
|
popupFilterShortcutsMap = {
|
|
316
|
-
up: event =>
|
|
317
|
-
down: event =>
|
|
318
|
-
home: event =>
|
|
319
|
-
end: event =>
|
|
320
|
-
enter: event => (this.list
|
|
321
|
-
? this.list.enterHandler(event)
|
|
322
|
-
: this.props.onEmptyPopupEnter(event)),
|
|
309
|
+
up: event => this.list && this.list.upHandler(event),
|
|
310
|
+
down: event => this.list && this.list.downHandler(event),
|
|
311
|
+
home: event => this.list && this.list.homeHandler(event),
|
|
312
|
+
end: event => this.list && this.list.endHandler(event),
|
|
313
|
+
enter: event => (this.list ? this.list.enterHandler(event) : this.props.onEmptyPopupEnter(event)),
|
|
323
314
|
esc: event => this.props.onCloseAttempt(event, true),
|
|
324
315
|
tab: event => this.tabPress(event),
|
|
325
316
|
backspace: event => this.handleBackspace(event),
|
|
326
317
|
del: () => this.removeSelectedTag(),
|
|
327
318
|
left: event => this.handleNavigation(event, true),
|
|
328
|
-
right: event => this.handleNavigation(event)
|
|
319
|
+
right: event => this.handleNavigation(event),
|
|
329
320
|
};
|
|
330
321
|
render() {
|
|
331
|
-
const { toolbar, topbar, className, multiple, hidden, isInputMode, anchorElement, minWidth, onCloseAttempt, onOutsideClick, directions, top, left, offset, style, dir, filter } = this.props;
|
|
322
|
+
const { toolbar, topbar, className, multiple, hidden, isInputMode, anchorElement, minWidth, onCloseAttempt, onOutsideClick, directions, top, left, offset, style, dir, filter, } = this.props;
|
|
332
323
|
const classes = classNames(styles.popup, className);
|
|
333
324
|
return (<PopupTargetContext.Consumer>
|
|
334
325
|
{ringPopupTarget => {
|
|
335
326
|
const filterWithTags = this.getFilterWithTags();
|
|
336
|
-
const selectAll = multiple && typeof multiple === 'object' && !multiple.limit &&
|
|
337
|
-
multiple.selectAll && this.getSelectAll();
|
|
327
|
+
const selectAll = multiple && typeof multiple === 'object' && !multiple.limit && multiple.selectAll && this.getSelectAll();
|
|
338
328
|
const list = this.getList(this.props.ringPopupTarget || ringPopupTarget);
|
|
339
329
|
const bottomLine = this.getBottomLine();
|
|
340
330
|
const hasContent = filterWithTags || selectAll || list || bottomLine || toolbar || topbar;
|
|
341
331
|
return (<Popup trapFocus={false} ref={this.popupRef} hidden={hidden || !hasContent} attached={isInputMode} className={classes} dontCloseOnAnchorClick anchorElement={anchorElement} minWidth={minWidth} onCloseAttempt={onCloseAttempt} onOutsideClick={onOutsideClick} directions={directions} top={top} left={left} offset={offset} onMouseDown={this.mouseDownHandler} target={this.props.ringPopupTarget} autoCorrectTopOverflow={false} style={style}>
|
|
342
332
|
<div dir={dir}>
|
|
343
|
-
{!hidden && filter &&
|
|
344
|
-
(<Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>)}
|
|
333
|
+
{!hidden && filter && <Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>}
|
|
345
334
|
{topbar}
|
|
346
335
|
{/* Add empty div to prevent the change of List position in DOM*/}
|
|
347
336
|
{hidden ? <div /> : filterWithTags}
|
|
@@ -4,7 +4,7 @@ class Shortcuts {
|
|
|
4
4
|
ALLOW_SHORTCUTS_SELECTOR = '.ring-js-shortcuts';
|
|
5
5
|
ROOT_SCOPE = {
|
|
6
6
|
scopeId: 'ROOT',
|
|
7
|
-
options: {}
|
|
7
|
+
options: {},
|
|
8
8
|
};
|
|
9
9
|
_scopes = {};
|
|
10
10
|
_scopeChain = [];
|
|
@@ -72,7 +72,7 @@ class Shortcuts {
|
|
|
72
72
|
*/
|
|
73
73
|
bindMap(map, options) {
|
|
74
74
|
if (!(map instanceof Object)) {
|
|
75
|
-
throw new Error(
|
|
75
|
+
throw new Error("Shortcuts map shouldn't be empty");
|
|
76
76
|
}
|
|
77
77
|
for (const key in map) {
|
|
78
78
|
if (map.hasOwnProperty(key)) {
|
|
@@ -148,7 +148,7 @@ class Shortcuts {
|
|
|
148
148
|
return { scopeId, options };
|
|
149
149
|
}
|
|
150
150
|
hasKey(key, scope) {
|
|
151
|
-
return !!
|
|
151
|
+
return !!this._scopes[scope]?.[key];
|
|
152
152
|
}
|
|
153
153
|
_defaultFilter = (e, element, key) => {
|
|
154
154
|
// if the element or its parents have the class "ring-js-shortcuts" then no need to stop
|
|
@@ -157,8 +157,7 @@ class Shortcuts {
|
|
|
157
157
|
key == null ||
|
|
158
158
|
element.matches(this.ALLOW_SHORTCUTS_SELECTOR) ||
|
|
159
159
|
element.closest(this.ALLOW_SHORTCUTS_SELECTOR) != null ||
|
|
160
|
-
(element.dataset.enabledShortcuts != null &&
|
|
161
|
-
element.dataset.enabledShortcuts.split(',').includes(key))) {
|
|
160
|
+
(element.dataset.enabledShortcuts != null && element.dataset.enabledShortcuts.split(',').includes(key))) {
|
|
162
161
|
return false;
|
|
163
162
|
}
|
|
164
163
|
const elementContentEditableAttribute = element.contentEditable;
|
|
@@ -168,7 +167,10 @@ class Shortcuts {
|
|
|
168
167
|
};
|
|
169
168
|
_getKeyboardEventType(params) {
|
|
170
169
|
if (!params.type && sniffr.os.name === 'windows') {
|
|
171
|
-
const isSystemShortcut = typeof params.key === 'string' &&
|
|
170
|
+
const isSystemShortcut = typeof params.key === 'string' &&
|
|
171
|
+
params.key.match(/ctrl/i) &&
|
|
172
|
+
params.key.match(/shift/i) &&
|
|
173
|
+
params.key.match(/[0-9]/);
|
|
172
174
|
/**
|
|
173
175
|
* Windows system shortcuts (ctrl+shift+[0-9] are caught by the OS on 'keydown', so let's use 'keyup'
|
|
174
176
|
*/
|
|
@@ -17,7 +17,7 @@ const macSymbolsMap = {
|
|
|
17
17
|
left: '←',
|
|
18
18
|
up: '↑',
|
|
19
19
|
right: '→',
|
|
20
|
-
down: '↓'
|
|
20
|
+
down: '↓',
|
|
21
21
|
};
|
|
22
22
|
const winSymbolsMap = {
|
|
23
23
|
enter: 'Enter',
|
|
@@ -37,14 +37,14 @@ const winSymbolsMap = {
|
|
|
37
37
|
left: '←',
|
|
38
38
|
up: '↑',
|
|
39
39
|
right: '→',
|
|
40
|
-
down: '↓'
|
|
40
|
+
down: '↓',
|
|
41
41
|
};
|
|
42
42
|
export function getShortcutTitle(shortcut) {
|
|
43
43
|
const MAC_OS = sniffer.os.name === 'macos';
|
|
44
44
|
const KEY_SEPARATOR = MAC_OS ? '' : '+';
|
|
45
45
|
const symbolsMap = MAC_OS ? macSymbolsMap : winSymbolsMap;
|
|
46
|
-
return shortcut
|
|
47
|
-
split(/\+/g)
|
|
48
|
-
map(symbol => symbolsMap[symbol] || symbol.toUpperCase())
|
|
49
|
-
join(KEY_SEPARATOR);
|
|
46
|
+
return shortcut
|
|
47
|
+
.split(/\+/g)
|
|
48
|
+
.map(symbol => symbolsMap[symbol] || symbol.toUpperCase())
|
|
49
|
+
.join(KEY_SEPARATOR);
|
|
50
50
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@value dark from "../global/variables_dark.css";
|
|
2
|
-
|
|
3
1
|
.slider {
|
|
4
2
|
--ring-slider-thumb-color: var(--ring-content-background-color);
|
|
5
3
|
--ring-slider-thumb-border: var(--ring-main-color);
|
|
@@ -22,7 +20,7 @@
|
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
:global(.ring-ui-theme-dark) {
|
|
26
24
|
.slider {
|
|
27
25
|
--ring-slider-thumb-color: var(--ring-main-color);
|
|
28
26
|
--ring-slider-thumb-border: var(--ring-white-text-color);
|
|
@@ -53,7 +51,7 @@
|
|
|
53
51
|
left: 0;
|
|
54
52
|
|
|
55
53
|
height: inherit;
|
|
56
|
-
margin-top:calc(var(--ring-unit) / -2);
|
|
54
|
+
margin-top: calc(var(--ring-unit) / -2);
|
|
57
55
|
|
|
58
56
|
border-radius: calc(var(--ring-unit) / 2);
|
|
59
57
|
|
|
@@ -85,7 +83,9 @@
|
|
|
85
83
|
|
|
86
84
|
border-radius: var(--ring-unit);
|
|
87
85
|
background-color: var(--ring-slider-thumb-color);
|
|
88
|
-
box-shadow:
|
|
86
|
+
box-shadow:
|
|
87
|
+
0 1px 2px 0 var(--ring-popup-secondary-shadow-color),
|
|
88
|
+
0 2px 8px 0 var(--ring-popup-shadow-components);
|
|
89
89
|
|
|
90
90
|
&.disabled {
|
|
91
91
|
cursor: default;
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
.markValue {
|
|
125
125
|
position: absolute;
|
|
126
126
|
|
|
127
|
-
margin-top:
|
|
127
|
+
margin-top: calc(var(--ring-unit) * -4);
|
|
128
128
|
margin-left: calc(var(--ring-unit) / -4);
|
|
129
129
|
|
|
130
130
|
transform: translateX(calc(-50% + 2px));
|
|
@@ -157,17 +157,17 @@
|
|
|
157
157
|
line-height: var(--ring-line-height-lowest);
|
|
158
158
|
|
|
159
159
|
&::after {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
position: absolute;
|
|
161
|
+
top: 100%;
|
|
162
|
+
left: calc(50% - 3px);
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
content: " ";
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
border-top: 3px solid var(--ring-main-color);
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
border-right: 3px solid transparent;
|
|
169
|
+
border-left: 3px solid transparent;
|
|
170
|
+
}
|
|
171
171
|
|
|
172
172
|
&.disabled {
|
|
173
173
|
color: var(--ring-slider-tag-disabled-text-color);
|
|
@@ -6,7 +6,7 @@ import Shortcuts from '../shortcuts/shortcuts';
|
|
|
6
6
|
import getUID from '../global/get-uid';
|
|
7
7
|
import styles from './slider.css';
|
|
8
8
|
import { adjustValues, calculateMarks, calculateValue, HUNDRED, toPercent, toRange, validateValue } from './slider.utils';
|
|
9
|
-
export const Slider = ({ defaultValue, value, min = 0, max = HUNDRED, step = 1, disabled, marks, showTicks, showTag, className, renderTag, onChange }) => {
|
|
9
|
+
export const Slider = ({ defaultValue, value, min = 0, max = HUNDRED, step = 1, disabled, marks, showTicks, showTag, className, renderTag, onChange, }) => {
|
|
10
10
|
const ref = useRef(null);
|
|
11
11
|
const previouslyDragged = useRef(false);
|
|
12
12
|
const [values, setValues] = useState(defaultValue ?? min);
|
|
@@ -126,19 +126,19 @@ export const Slider = ({ defaultValue, value, min = 0, max = HUNDRED, step = 1,
|
|
|
126
126
|
return (<div ref={ref} role="presentation" // contains interactive elements
|
|
127
127
|
className={classNames(styles.slider, className, {
|
|
128
128
|
[styles.disabled]: disabled,
|
|
129
|
-
[styles.marked]: !!marks || showTag
|
|
129
|
+
[styles.marked]: !!marks || showTag,
|
|
130
130
|
})} tabIndex={-1} onMouseDown={handleMouseDown}>
|
|
131
131
|
<Shortcuts map={shortcutsMap} scope={shortcutsScope}/>
|
|
132
132
|
<div className={classNames(styles.rail, {
|
|
133
133
|
[styles.rounded]: !showTicks,
|
|
134
|
-
[styles.disabled]: disabled
|
|
134
|
+
[styles.disabled]: disabled,
|
|
135
135
|
})}/>
|
|
136
136
|
<div style={{
|
|
137
137
|
left: `${trackStart}%`,
|
|
138
|
-
width: `${trackLength}
|
|
138
|
+
width: `${trackLength}%`,
|
|
139
139
|
}} className={classNames(styles.track, {
|
|
140
140
|
[styles.rounded]: !showTicks,
|
|
141
|
-
[styles.disabled]: disabled
|
|
141
|
+
[styles.disabled]: disabled,
|
|
142
142
|
})}/>
|
|
143
143
|
{validValues.map((numValue, index) => {
|
|
144
144
|
const percent = toPercent(numValue, min, max);
|
|
@@ -147,7 +147,7 @@ export const Slider = ({ defaultValue, value, min = 0, max = HUNDRED, step = 1,
|
|
|
147
147
|
<Fragment key={index}>
|
|
148
148
|
<div tabIndex={0} aria-label="Pick value" role="slider" aria-valuemin={min} aria-valuemax={max} aria-valuenow={numValue} data-index={index} style={{ left: `${percent}%` }} className={classNames(styles.thumb, {
|
|
149
149
|
[styles.disabled]: disabled,
|
|
150
|
-
[styles.dragged]: isDragging && draggedIndex === index
|
|
150
|
+
[styles.dragged]: isDragging && draggedIndex === index,
|
|
151
151
|
})} onMouseDown={handleMouseDown}/>
|
|
152
152
|
{showTag && (<div style={{ left: `${percent}%` }} className={classNames(styles.tag, { [styles.disabled]: disabled })} role="tooltip">
|
|
153
153
|
{renderTag ? renderTag(numValue) : numValue}
|
|
@@ -171,7 +171,7 @@ export const Slider = ({ defaultValue, value, min = 0, max = HUNDRED, step = 1,
|
|
|
171
171
|
// eslint-disable-next-line react/no-array-index-key
|
|
172
172
|
key={index} className={classNames(styles.tick, {
|
|
173
173
|
[styles.active]: isActive,
|
|
174
|
-
[styles.disabled]: disabled
|
|
174
|
+
[styles.disabled]: disabled,
|
|
175
175
|
})} style={{ left: `${percent}%` }}/>);
|
|
176
176
|
})}
|
|
177
177
|
</div>);
|
|
@@ -31,14 +31,11 @@ const TabTrap = forwardRef(function TabTrap({ children, trapDisabled = false, au
|
|
|
31
31
|
focusFirst();
|
|
32
32
|
}
|
|
33
33
|
else if (!trapDisabled) {
|
|
34
|
-
const previousFocusedElementIsInContainer = previousFocusedNodeRef.current &&
|
|
35
|
-
nodeRef.current?.contains(previousFocusedNodeRef.current);
|
|
34
|
+
const previousFocusedElementIsInContainer = previousFocusedNodeRef.current && nodeRef.current?.contains(previousFocusedNodeRef.current);
|
|
36
35
|
// The component wrapped in TabTrap can already have a focused element (e.g. Date Picker),
|
|
37
36
|
// so we need to check if it does. If so, we don't need to focus anything.
|
|
38
|
-
const currentlyFocusedElementIsInContainer = nodeRef.current?.
|
|
39
|
-
|
|
40
|
-
if (!nodeRef.current ||
|
|
41
|
-
(!previousFocusedElementIsInContainer && !currentlyFocusedElementIsInContainer)) {
|
|
37
|
+
const currentlyFocusedElementIsInContainer = nodeRef.current?.contains(document.activeElement);
|
|
38
|
+
if (!nodeRef.current || (!previousFocusedElementIsInContainer && !currentlyFocusedElementIsInContainer)) {
|
|
42
39
|
trapWithoutFocusRef.current = true;
|
|
43
40
|
trapButtonNodeRef.current?.focus();
|
|
44
41
|
}
|
|
@@ -66,8 +63,7 @@ const TabTrap = forwardRef(function TabTrap({ children, trapDisabled = false, au
|
|
|
66
63
|
if (!node) {
|
|
67
64
|
return;
|
|
68
65
|
}
|
|
69
|
-
const tabables = [...node.querySelectorAll(FOCUSABLE_ELEMENTS)].
|
|
70
|
-
filter(item => item.tabIndex >= 0);
|
|
66
|
+
const tabables = [...node.querySelectorAll(FOCUSABLE_ELEMENTS)].filter(item => item.tabIndex >= 0);
|
|
71
67
|
const toBeFocused = first ? tabables[0] : tabables[tabables.length - 1];
|
|
72
68
|
if (toBeFocused) {
|
|
73
69
|
toBeFocused.focus();
|
|
@@ -79,7 +75,9 @@ const TabTrap = forwardRef(function TabTrap({ children, trapDisabled = false, au
|
|
|
79
75
|
}
|
|
80
76
|
if (focusBackOnExit) {
|
|
81
77
|
const prevFocused = event.nativeEvent.relatedTarget;
|
|
82
|
-
if (prevFocused != null &&
|
|
78
|
+
if (prevFocused != null &&
|
|
79
|
+
nodeRef.current != null &&
|
|
80
|
+
prevFocused instanceof Element &&
|
|
83
81
|
nodeRef.current.contains(prevFocused)) {
|
|
84
82
|
restoreFocus();
|
|
85
83
|
}
|
package/components/table/cell.js
CHANGED
|
@@ -5,6 +5,8 @@ import style from './table.css';
|
|
|
5
5
|
export default class Cell extends PureComponent {
|
|
6
6
|
render() {
|
|
7
7
|
const classes = classNames(style.cell, this.props.className);
|
|
8
|
-
return (<td {...this.props} className={classes} data-test={dataTests('ring-table-cell', this.props['data-test'])}>
|
|
8
|
+
return (<td {...this.props} className={classes} data-test={dataTests('ring-table-cell', this.props['data-test'])}>
|
|
9
|
+
{this.props.children}
|
|
10
|
+
</td>);
|
|
9
11
|
}
|
|
10
12
|
}
|
|
@@ -3,7 +3,7 @@ export default function disableHoverHOC(ComposedComponent) {
|
|
|
3
3
|
return class DisableHover extends PureComponent {
|
|
4
4
|
static defaultProps = ComposedComponent.defaultProps;
|
|
5
5
|
state = {
|
|
6
|
-
disabledHover: false
|
|
6
|
+
disabledHover: false,
|
|
7
7
|
};
|
|
8
8
|
componentDidMount() {
|
|
9
9
|
document.addEventListener('mousemove', this.onMouseMove);
|
|
@@ -25,7 +25,7 @@ export default function disableHoverHOC(ComposedComponent) {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
render() {
|
|
28
|
-
return
|
|
28
|
+
return <ComposedComponent {...this.props} disabledHover={this.state.disabledHover}/>;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
}
|
|
@@ -7,7 +7,7 @@ import dataTests from '../global/data-tests';
|
|
|
7
7
|
import style from './table.css';
|
|
8
8
|
export default class HeaderCell extends PureComponent {
|
|
9
9
|
static defaultProps = {
|
|
10
|
-
onSort: () => { }
|
|
10
|
+
onSort: () => { },
|
|
11
11
|
};
|
|
12
12
|
sortable;
|
|
13
13
|
sorted;
|
|
@@ -30,11 +30,13 @@ export default class HeaderCell extends PureComponent {
|
|
|
30
30
|
[style.headerCellSortable]: this.sortable,
|
|
31
31
|
[style.headerCellSorted]: this.sorted,
|
|
32
32
|
[style.sortedUp]: sortOrder && this.sorted,
|
|
33
|
-
[style.cellRight]: column.rightAlign
|
|
33
|
+
[style.cellRight]: column.rightAlign,
|
|
34
34
|
});
|
|
35
35
|
return (<th {...restProps} className={classes} onClick={this.onClick} data-test={dataTests('ring-table-header-cell', dataTest)}>
|
|
36
36
|
{/* onClick only used to stop propagation */}
|
|
37
|
-
<span onClick={this.onChildrenClick} role="presentation">
|
|
37
|
+
<span onClick={this.onChildrenClick} role="presentation">
|
|
38
|
+
{this.props.children}
|
|
39
|
+
</span>
|
|
38
40
|
|
|
39
41
|
{column.getHeaderValue ? column.getHeaderValue() : column.title}
|
|
40
42
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEventHandler, PureComponent,
|
|
1
|
+
import { ChangeEventHandler, PureComponent, SyntheticEvent } from 'react';
|
|
2
2
|
import { Column, SortParams } from './header-cell';
|
|
3
3
|
export interface HeaderProps {
|
|
4
4
|
columns: readonly Column[];
|
|
@@ -13,14 +13,6 @@ export interface HeaderProps {
|
|
|
13
13
|
sortOrder: boolean;
|
|
14
14
|
caption?: string | null | undefined;
|
|
15
15
|
checkboxDisabled?: boolean | undefined;
|
|
16
|
-
maxColSpan?: number;
|
|
17
|
-
}
|
|
18
|
-
declare module 'react-waypoint' {
|
|
19
|
-
namespace Waypoint {
|
|
20
|
-
interface WaypointProps {
|
|
21
|
-
children?: ReactNode;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
16
|
}
|
|
25
17
|
export default class Header extends PureComponent<HeaderProps> {
|
|
26
18
|
static defaultProps: {
|
|
@@ -36,7 +28,7 @@ export default class Header extends PureComponent<HeaderProps> {
|
|
|
36
28
|
};
|
|
37
29
|
id: string;
|
|
38
30
|
onCheckboxFocus: (event: SyntheticEvent<HTMLElement>) => void;
|
|
39
|
-
createCells(widths?: never[]):
|
|
31
|
+
createCells(widths?: never[]): import("react").JSX.Element[];
|
|
40
32
|
render(): import("react").JSX.Element;
|
|
41
33
|
}
|
|
42
34
|
export type HeaderAttrs = JSX.LibraryManagedAttributes<typeof Header, HeaderProps>;
|
|
@@ -14,7 +14,7 @@ export default class Header extends PureComponent {
|
|
|
14
14
|
onSort: () => { },
|
|
15
15
|
onCheckboxChange: () => { },
|
|
16
16
|
sortKey: 'id',
|
|
17
|
-
sortOrder: true
|
|
17
|
+
sortOrder: true,
|
|
18
18
|
};
|
|
19
19
|
id = getUID('table-header-');
|
|
20
20
|
onCheckboxFocus = (event) => {
|
|
@@ -24,18 +24,12 @@ export default class Header extends PureComponent {
|
|
|
24
24
|
const { selectable, draggable, columns, checked, checkboxDisabled, onCheckboxChange, onSort, sortKey, sortOrder } = this.props;
|
|
25
25
|
const metaColumnClasses = classNames(style.metaColumn, style.headerMetaColumn);
|
|
26
26
|
const metaColumn = (<div className={metaColumnClasses}>
|
|
27
|
-
{selectable &&
|
|
28
|
-
(<Checkbox aria-labelledby={this.id} disabled={checkboxDisabled} checked={checked} onChange={onCheckboxChange} onFocus={this.onCheckboxFocus}/>)}
|
|
27
|
+
{selectable && (<Checkbox aria-labelledby={this.id} disabled={checkboxDisabled} checked={checked} onChange={onCheckboxChange} onFocus={this.onCheckboxFocus}/>)}
|
|
29
28
|
</div>);
|
|
30
|
-
let colSpan = 0;
|
|
31
29
|
return columns.map((column, index) => {
|
|
32
30
|
const columnStyle = widths[index] ? { width: widths[index] } : undefined;
|
|
33
31
|
const props = { column, onSort, sortKey, sortOrder, style: columnStyle };
|
|
34
|
-
|
|
35
|
-
if (colSpan > (this.props.maxColSpan || Infinity)) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
return (<HeaderCell key={column.id} data-test={column.id} colSpan={column.colSpan} {...props}>
|
|
32
|
+
return (<HeaderCell key={column.id} data-test={column.id} {...props}>
|
|
39
33
|
{index === 0 && (draggable || selectable) && metaColumn}
|
|
40
34
|
</HeaderCell>);
|
|
41
35
|
});
|
|
@@ -45,13 +39,17 @@ export default class Header extends PureComponent {
|
|
|
45
39
|
const regularCells = this.createCells();
|
|
46
40
|
return (<thead id={this.id} data-test="ring-table-header" style={{ top: topStickOffset }} className={classNames({
|
|
47
41
|
[style.tableHead]: true,
|
|
48
|
-
[style.subHeaderSticky]: sticky
|
|
42
|
+
[style.subHeaderSticky]: sticky,
|
|
49
43
|
})}>
|
|
50
44
|
{caption && (<tr data-test="ring-table-header-row">
|
|
51
|
-
<th className={classNames(style.headerCell, style.caption)} colSpan={regularCells.length + 1} data-test="ring-table-header-cell">
|
|
45
|
+
<th className={classNames(style.headerCell, style.caption)} colSpan={regularCells.length + 1} data-test="ring-table-header-cell">
|
|
46
|
+
{caption}
|
|
47
|
+
</th>
|
|
52
48
|
</tr>)}
|
|
53
49
|
|
|
54
|
-
<tr className={style.subHeader} data-test="ring-table-header-row">
|
|
50
|
+
<tr className={style.subHeader} data-test="ring-table-header-row">
|
|
51
|
+
{regularCells}
|
|
52
|
+
</tr>
|
|
55
53
|
</thead>);
|
|
56
54
|
}
|
|
57
55
|
}
|
|
@@ -66,12 +66,14 @@ export default class MultiTable extends PureComponent {
|
|
|
66
66
|
down: this.onDownPress,
|
|
67
67
|
esc: this.onEscPress,
|
|
68
68
|
'command+a': this.onCmdAPress,
|
|
69
|
-
'ctrl+a': this.onCmdAPress
|
|
69
|
+
'ctrl+a': this.onCmdAPress,
|
|
70
70
|
};
|
|
71
71
|
render() {
|
|
72
|
-
return (<div data-test="ring-multitable">
|
|
72
|
+
return (<div data-test="ring-multitable">
|
|
73
|
+
{Children.map(this.props.children, child => {
|
|
73
74
|
const props = { shortcuts: this.shortcuts };
|
|
74
75
|
return cloneElement(child, props);
|
|
75
|
-
})}
|
|
76
|
+
})}
|
|
77
|
+
</div>);
|
|
76
78
|
}
|
|
77
79
|
}
|
|
@@ -6,7 +6,6 @@ import { SelectionItem } from './selection';
|
|
|
6
6
|
export interface RowProps<T extends SelectionItem> extends Omit<HTMLAttributes<HTMLTableRowElement>, 'onClick' | 'onDoubleClick' | 'onSelect'>, FocusSensorAddProps<HTMLTableRowElement> {
|
|
7
7
|
item: T;
|
|
8
8
|
columns: readonly Column<T>[] | ((item: T) => readonly Column<T>[]);
|
|
9
|
-
maxColSpan?: number;
|
|
10
9
|
selectable: boolean;
|
|
11
10
|
showFocus: boolean;
|
|
12
11
|
draggable: boolean;
|