@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
package/components/table/row.js
CHANGED
|
@@ -14,9 +14,9 @@ import Cell from './cell';
|
|
|
14
14
|
import style from './table.css';
|
|
15
15
|
const DragHandle = ({ alwaysShowDragHandle, dragHandleTitle = 'Drag to reorder' }) => {
|
|
16
16
|
const classes = classNames(style.dragHandle, {
|
|
17
|
-
[style.visibleDragHandle]: alwaysShowDragHandle
|
|
17
|
+
[style.visibleDragHandle]: alwaysShowDragHandle,
|
|
18
18
|
});
|
|
19
|
-
return
|
|
19
|
+
return <Button data-movable-handle title={dragHandleTitle} className={classes} icon={dragIcon}/>;
|
|
20
20
|
};
|
|
21
21
|
export default class Row extends PureComponent {
|
|
22
22
|
static defaultProps = {
|
|
@@ -34,7 +34,7 @@ export default class Row extends PureComponent {
|
|
|
34
34
|
parentCollapsible: false,
|
|
35
35
|
collapsed: false,
|
|
36
36
|
onCollapse: () => { },
|
|
37
|
-
onExpand: () => { }
|
|
37
|
+
onExpand: () => { },
|
|
38
38
|
};
|
|
39
39
|
id = getUID('table-row-');
|
|
40
40
|
onMouseEnter = (e) => {
|
|
@@ -70,59 +70,52 @@ export default class Row extends PureComponent {
|
|
|
70
70
|
};
|
|
71
71
|
composedRowRef = createComposedRef();
|
|
72
72
|
render() {
|
|
73
|
-
const { item, columns: columnProps, selectable, selected, showFocus, draggable, alwaysShowDragHandle, dragHandleTitle, level, collapsible, parentCollapsible, collapsed,
|
|
73
|
+
const { item, columns: columnProps, selectable, selected, showFocus, draggable, alwaysShowDragHandle, dragHandleTitle, level, collapsible, parentCollapsible, collapsed, onCollapse, onExpand, showDisabledSelection, onSelect, checkboxTooltip, innerRef, focused, autofocus, onFocusReset, onFocusRestore, onHover, className, metaColumnClassName, 'data-test': dataTest, ...restProps } = this.props;
|
|
74
74
|
const classes = classNames(className, {
|
|
75
75
|
[style.row]: true,
|
|
76
76
|
[style.rowFocused]: showFocus,
|
|
77
|
-
[style.rowSelected]: selected
|
|
77
|
+
[style.rowSelected]: selected,
|
|
78
78
|
});
|
|
79
79
|
const testAttrs = {
|
|
80
80
|
'data-test-focused': showFocus || undefined,
|
|
81
|
-
'data-test-selected': selected || undefined
|
|
81
|
+
'data-test-selected': selected || undefined,
|
|
82
82
|
};
|
|
83
83
|
const metaColumnClasses = classNames(metaColumnClassName, style.metaColumn);
|
|
84
84
|
const SUBITEM_OFFSET = 30;
|
|
85
85
|
const COLLAPSIBLE_PARENT_OFFSET = 20;
|
|
86
86
|
const gap = level * SUBITEM_OFFSET + (parentCollapsible ? COLLAPSIBLE_PARENT_OFFSET : 0);
|
|
87
87
|
const metaColumnStyle = {
|
|
88
|
-
paddingLeft: `${gap}px
|
|
88
|
+
paddingLeft: `${gap}px`,
|
|
89
89
|
};
|
|
90
90
|
const metaColumn = (<div className={metaColumnClasses} style={metaColumnStyle}>
|
|
91
|
-
{draggable &&
|
|
91
|
+
{draggable && <DragHandle alwaysShowDragHandle={alwaysShowDragHandle} dragHandleTitle={dragHandleTitle}/>}
|
|
92
92
|
|
|
93
|
-
{selectable &&
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</Tooltip>)}
|
|
93
|
+
{selectable && (<Tooltip title={checkboxTooltip}>
|
|
94
|
+
<Checkbox aria-labelledby={this.id} className={showFocus ? 'ring-checkbox_focus' : ''} checked={selected} onFocus={this.onCheckboxFocus} onChange={this.onCheckboxChange} tabIndex={-1}/>
|
|
95
|
+
</Tooltip>)}
|
|
97
96
|
|
|
98
|
-
{!selectable && showDisabledSelection &&
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</Tooltip>)}
|
|
97
|
+
{!selectable && showDisabledSelection && (<Tooltip title={checkboxTooltip}>
|
|
98
|
+
<Checkbox aria-labelledby={this.id} checked={selected} disabled/>
|
|
99
|
+
</Tooltip>)}
|
|
102
100
|
|
|
103
|
-
{collapsible && collapsed &&
|
|
104
|
-
(<Button className={style.rowCollapseExpandButton} icon={chevronRightIcon} onClick={() => onExpand(item)}/>)}
|
|
101
|
+
{collapsible && collapsed && (<Button className={style.rowCollapseExpandButton} icon={chevronRightIcon} onClick={() => onExpand(item)}/>)}
|
|
105
102
|
|
|
106
|
-
{collapsible && !collapsed &&
|
|
107
|
-
(<Button className={style.rowCollapseExpandButton} icon={chevronDownIcon} onClick={() => onCollapse(item)}/>)}
|
|
103
|
+
{collapsible && !collapsed && (<Button className={style.rowCollapseExpandButton} icon={chevronDownIcon} onClick={() => onCollapse(item)}/>)}
|
|
108
104
|
</div>);
|
|
109
105
|
const columns = typeof columnProps === 'function' ? columnProps(item) : columnProps;
|
|
110
|
-
let colSpan = 0;
|
|
111
106
|
const cells = columns.map((column, index) => {
|
|
112
107
|
const getValue = column.getValue || (() => item[column.id]);
|
|
113
108
|
const getDataTest = column.getDataTest || (() => column.id);
|
|
114
109
|
const value = getValue(item, column);
|
|
115
110
|
const cellClasses = classNames({ [style.cellRight]: column.rightAlign }, column.className);
|
|
116
111
|
const showMetaColumn = draggable || selectable || collapsible || showDisabledSelection || !!level;
|
|
117
|
-
colSpan += column.colSpan || 1;
|
|
118
|
-
if (colSpan > (maxColSpan || Infinity)) {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
112
|
return (<Cell colSpan={column.colSpan} key={column.id} className={cellClasses} data-test={getDataTest(item, column)}>
|
|
122
|
-
{index === 0 &&
|
|
113
|
+
{index === 0 && showMetaColumn && metaColumn}
|
|
123
114
|
{value}
|
|
124
115
|
</Cell>);
|
|
125
116
|
});
|
|
126
|
-
return (<tr id={this.id} ref={this.composedRowRef(this.rowRef, innerRef)} className={classes} tabIndex={0} data-test={dataTests('ring-table-row', dataTest)} {...testAttrs} {...restProps} onMouseMove={this.onMouseEnter} onClick={this.onClick} onDoubleClick={this.onDoubleClick}>
|
|
117
|
+
return (<tr id={this.id} ref={this.composedRowRef(this.rowRef, innerRef)} className={classes} tabIndex={0} data-test={dataTests('ring-table-row', dataTest)} {...testAttrs} {...restProps} onMouseMove={this.onMouseEnter} onClick={this.onClick} onDoubleClick={this.onDoubleClick}>
|
|
118
|
+
{cells}
|
|
119
|
+
</tr>);
|
|
127
120
|
}
|
|
128
121
|
}
|
|
@@ -113,7 +113,7 @@ export default function selectionShortcutsHOC(ComposedComponent) {
|
|
|
113
113
|
space: this.onSpacePress,
|
|
114
114
|
esc: this.onEscPress,
|
|
115
115
|
'command+a': this.onCmdAPress,
|
|
116
|
-
'ctrl+a': this.onCmdAPress
|
|
116
|
+
'ctrl+a': this.onCmdAPress,
|
|
117
117
|
};
|
|
118
118
|
render() {
|
|
119
119
|
const { selection, selectable, onSelect, shortcuts, ...restProps } = this.props;
|
|
@@ -124,7 +124,7 @@ export default function selectionShortcutsHOC(ComposedComponent) {
|
|
|
124
124
|
...ComposedComponent.defaultProps,
|
|
125
125
|
selectable: true,
|
|
126
126
|
onSelect: () => { },
|
|
127
|
-
shortcuts: {}
|
|
127
|
+
shortcuts: {},
|
|
128
128
|
};
|
|
129
129
|
return SelectionShortcuts;
|
|
130
130
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export interface SelectionItem {
|
|
2
2
|
id: string | number;
|
|
3
|
-
[key: string]: unknown;
|
|
4
3
|
}
|
|
5
4
|
export interface TableSelectionConfig<T extends SelectionItem> {
|
|
6
5
|
data?: readonly T[] | undefined;
|
|
@@ -17,13 +16,13 @@ export interface CloneWithConfig<T> {
|
|
|
17
16
|
}
|
|
18
17
|
export default class Selection<T extends SelectionItem> {
|
|
19
18
|
private _rawData;
|
|
20
|
-
protected _getChildren: (
|
|
19
|
+
protected _getChildren: (item: T) => readonly T[];
|
|
21
20
|
protected _data: Set<T>;
|
|
22
21
|
protected _selected: Set<T>;
|
|
23
22
|
protected _focused: T | null;
|
|
24
23
|
private _getKey;
|
|
25
24
|
protected _isItemSelectable: (item: T) => boolean | undefined;
|
|
26
|
-
constructor({ data, selected, focused, getKey, getChildren, isItemSelectable }?: TableSelectionConfig<T>);
|
|
25
|
+
constructor({ data, selected, focused, getKey, getChildren, isItemSelectable, }?: TableSelectionConfig<T>);
|
|
27
26
|
protected _buildData(data: readonly T[] | null | undefined): Set<T>;
|
|
28
27
|
protected _buildSelected(data: Set<T>, selected: Set<T>): Set<T>;
|
|
29
28
|
cloneWith({ data, selected, focused }: CloneWithConfig<T>): Selection<T>;
|
|
@@ -6,7 +6,7 @@ export default class Selection {
|
|
|
6
6
|
_focused;
|
|
7
7
|
_getKey;
|
|
8
8
|
_isItemSelectable;
|
|
9
|
-
constructor({ data = [], selected = new Set(), focused = null, getKey = item => item.id, getChildren = () => [], isItemSelectable = () => true } = {}) {
|
|
9
|
+
constructor({ data = [], selected = new Set(), focused = null, getKey = item => item.id, getChildren = () => [], isItemSelectable = () => true, } = {}) {
|
|
10
10
|
this._rawData = data;
|
|
11
11
|
this._getChildren = getChildren;
|
|
12
12
|
this._data = this._buildData(data);
|
|
@@ -25,8 +25,7 @@ export default class Selection {
|
|
|
25
25
|
const newData = data || this._rawData;
|
|
26
26
|
let newSelected;
|
|
27
27
|
if (data && !selected) {
|
|
28
|
-
newSelected = new Set([...this._buildData(newData)].
|
|
29
|
-
filter(item => [...this._selected].some(it => this._getKey(item) === this._getKey(it))));
|
|
28
|
+
newSelected = new Set([...this._buildData(newData)].filter(item => [...this._selected].some(it => this._getKey(item) === this._getKey(it))));
|
|
30
29
|
newSelected = this._buildSelected(this._buildData(newData), newSelected);
|
|
31
30
|
}
|
|
32
31
|
else if (selected) {
|
|
@@ -41,10 +40,10 @@ export default class Selection {
|
|
|
41
40
|
return new this.constructor({
|
|
42
41
|
data: newData,
|
|
43
42
|
selected: newSelected,
|
|
44
|
-
focused:
|
|
43
|
+
focused: data && !focused ? cloneFocus() : newFocused,
|
|
45
44
|
getKey: this._getKey,
|
|
46
45
|
getChildren: this._getChildren,
|
|
47
|
-
isItemSelectable: this._isItemSelectable
|
|
46
|
+
isItemSelectable: this._isItemSelectable,
|
|
48
47
|
});
|
|
49
48
|
}
|
|
50
49
|
focus(value) {
|
|
@@ -6,16 +6,16 @@ import Selection from './selection';
|
|
|
6
6
|
class SimpleTable extends PureComponent {
|
|
7
7
|
static defaultProps = {
|
|
8
8
|
selectable: false,
|
|
9
|
-
wideFirstColumn: false
|
|
9
|
+
wideFirstColumn: false,
|
|
10
10
|
};
|
|
11
11
|
state = {
|
|
12
12
|
selection: new Selection({
|
|
13
|
-
data: this.props.data
|
|
14
|
-
})
|
|
13
|
+
data: this.props.data,
|
|
14
|
+
}),
|
|
15
15
|
};
|
|
16
16
|
classes = classNames(style.disabledHover, this.props.className);
|
|
17
17
|
render() {
|
|
18
|
-
return
|
|
18
|
+
return <Table {...this.props} className={this.classes} {...this.state}/>;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
export default SimpleTable;
|
|
@@ -3,13 +3,13 @@ import Table from './table';
|
|
|
3
3
|
import Selection from './selection';
|
|
4
4
|
class SmartTable extends PureComponent {
|
|
5
5
|
static defaultProps = {
|
|
6
|
-
onSelectionChange: () => { }
|
|
6
|
+
onSelectionChange: () => { },
|
|
7
7
|
};
|
|
8
8
|
state = {
|
|
9
9
|
selection: new Selection({
|
|
10
10
|
data: this.props.data,
|
|
11
|
-
isItemSelectable: this.props.isItemSelectable
|
|
12
|
-
})
|
|
11
|
+
isItemSelectable: this.props.isItemSelectable,
|
|
12
|
+
}),
|
|
13
13
|
};
|
|
14
14
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
15
15
|
const { data, isItemSelectable, selection } = nextProps;
|
|
@@ -18,7 +18,7 @@ class SmartTable extends PureComponent {
|
|
|
18
18
|
}
|
|
19
19
|
else if (this.props.data !== data || this.props.isItemSelectable !== isItemSelectable) {
|
|
20
20
|
this.setState({
|
|
21
|
-
selection: new Selection({ data, isItemSelectable })
|
|
21
|
+
selection: new Selection({ data, isItemSelectable }),
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -27,7 +27,7 @@ class SmartTable extends PureComponent {
|
|
|
27
27
|
this.props.onSelectionChange(selection);
|
|
28
28
|
};
|
|
29
29
|
render() {
|
|
30
|
-
return
|
|
30
|
+
return <Table {...this.props} selection={this.state.selection} onSelect={this.onSelect}/>;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
export default SmartTable;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
@import "../global/variables.css";
|
|
2
2
|
|
|
3
|
-
@value compensate: 2px;
|
|
4
|
-
@value compensated: calc(calc(4 * var(--ring-unit)) - compensate);
|
|
5
|
-
|
|
6
3
|
.tableWrapper {
|
|
4
|
+
--ring-table-compensate: 2px;
|
|
5
|
+
--ring-table-compensated: calc(calc(4 * var(--ring-unit)) - var(--ring-table-compensate));
|
|
6
|
+
--ring-table-top: -3px;
|
|
7
|
+
|
|
7
8
|
position: relative;
|
|
8
9
|
}
|
|
9
10
|
|
|
@@ -109,7 +110,7 @@
|
|
|
109
110
|
.row {
|
|
110
111
|
outline: none;
|
|
111
112
|
|
|
112
|
-
line-height: compensated;
|
|
113
|
+
line-height: var(--ring-table-compensated);
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
/* stylelint-disable-next-line selector-max-specificity */
|
|
@@ -194,17 +195,15 @@
|
|
|
194
195
|
float: left;
|
|
195
196
|
|
|
196
197
|
height: 16px;
|
|
197
|
-
padding-right: compensate;
|
|
198
|
+
padding-right: var(--ring-table-compensate);
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
.metaColumn.headerMetaColumn {
|
|
201
202
|
padding-top: 1px;
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
@value top: -3px;
|
|
205
|
-
|
|
206
205
|
.dragHandle {
|
|
207
|
-
top: top;
|
|
206
|
+
top: var(--ring-table-top);
|
|
208
207
|
left: calc(-2 * var(--ring-unit));
|
|
209
208
|
|
|
210
209
|
cursor: grab;
|
|
@@ -216,7 +215,7 @@
|
|
|
216
215
|
.dragHandle.dragHandle {
|
|
217
216
|
position: absolute;
|
|
218
217
|
|
|
219
|
-
height: calc(calc(4 * var(--ring-unit)) - top);
|
|
218
|
+
height: calc(calc(4 * var(--ring-unit)) - var(--ring-table-top));
|
|
220
219
|
padding: 0;
|
|
221
220
|
}
|
|
222
221
|
|
|
@@ -18,7 +18,6 @@ export interface ReorderParams<T> {
|
|
|
18
18
|
export interface TableProps<T extends SelectionItem> extends FocusSensorAddProps<HTMLTableRowElement>, SelectionShortcutsAddProps<T>, DisableHoverAddProps {
|
|
19
19
|
data: readonly T[];
|
|
20
20
|
columns: readonly Column<T>[] | ((item: T | null) => readonly Column<T>[]);
|
|
21
|
-
maxColSpan?: number;
|
|
22
21
|
isItemSelectable: (item: T) => boolean;
|
|
23
22
|
loading: boolean;
|
|
24
23
|
onSort: (params: SortParams) => void;
|
|
@@ -44,11 +44,11 @@ export class Table extends PureComponent {
|
|
|
44
44
|
isDisabledSelectionVisible: () => false,
|
|
45
45
|
getCheckboxTooltip: () => undefined,
|
|
46
46
|
RowComponent: Row,
|
|
47
|
-
wideFirstColumn: false
|
|
47
|
+
wideFirstColumn: false,
|
|
48
48
|
};
|
|
49
49
|
state = {
|
|
50
50
|
shortcutsScope: getUID('ring-table-'),
|
|
51
|
-
userSelectNone: false
|
|
51
|
+
userSelectNone: false,
|
|
52
52
|
};
|
|
53
53
|
componentDidMount() {
|
|
54
54
|
document.addEventListener('mouseup', this.onMouseUp);
|
|
@@ -108,13 +108,19 @@ export class Table extends PureComponent {
|
|
|
108
108
|
window.scrollTo(scrollX, scrollY);
|
|
109
109
|
};
|
|
110
110
|
render() {
|
|
111
|
-
const { data, selection, columns, caption, getItemKey, selectable, focused, isItemSelectable, getItemLevel, getItemClassName, getMetaColumnClassName, getItemDataTest, draggable, alwaysShowDragHandle, dragHandleTitle, loading, onSort, sortKey, sortOrder, loaderClassName, stickyHeader, stickyHeaderOffset, isItemCollapsible, isParentCollapsible, isItemCollapsed, onItemCollapse, onItemExpand, isDisabledSelectionVisible, getCheckboxTooltip, onItemDoubleClick, onItemClick, renderEmpty,
|
|
111
|
+
const { data, selection, columns, caption, getItemKey, selectable, focused, isItemSelectable, getItemLevel, getItemClassName, getMetaColumnClassName, getItemDataTest, draggable, alwaysShowDragHandle, dragHandleTitle, loading, onSort, sortKey, sortOrder, loaderClassName, stickyHeader, stickyHeaderOffset, isItemCollapsible, isParentCollapsible, isItemCollapsed, onItemCollapse, onItemExpand, isDisabledSelectionVisible, getCheckboxTooltip, onItemDoubleClick, onItemClick, renderEmpty, RowComponent, } = this.props;
|
|
112
112
|
// NOTE: Do not construct new object per render because it causes all rows rerendering
|
|
113
|
+
const columnsArray = typeof columns === 'function' ? columns(null) : columns;
|
|
113
114
|
const headerProps = {
|
|
114
|
-
caption,
|
|
115
|
-
|
|
115
|
+
caption,
|
|
116
|
+
selectable,
|
|
117
|
+
draggable,
|
|
118
|
+
columns: columnsArray,
|
|
119
|
+
onSort,
|
|
120
|
+
sortKey,
|
|
121
|
+
sortOrder,
|
|
116
122
|
sticky: stickyHeader,
|
|
117
|
-
topStickOffset: stickyHeaderOffset,
|
|
123
|
+
topStickOffset: stickyHeaderOffset,
|
|
118
124
|
};
|
|
119
125
|
const selectedSize = selection.getSelected().size;
|
|
120
126
|
const allSelectedSize = selection.selectAll().getSelected().size;
|
|
@@ -123,24 +129,22 @@ export class Table extends PureComponent {
|
|
|
123
129
|
headerProps.checkboxDisabled = this.props.data.length === 0;
|
|
124
130
|
const wrapperClasses = classNames({
|
|
125
131
|
[style.tableWrapper]: true,
|
|
126
|
-
[style.loading]: loading
|
|
132
|
+
[style.loading]: loading,
|
|
127
133
|
});
|
|
128
134
|
const classes = classNames(this.props.className, {
|
|
129
135
|
[style.table]: true,
|
|
130
136
|
[style.wideFirstColumn]: this.props.wideFirstColumn,
|
|
131
137
|
[style.multiSelection]: selection.getSelected().size > 0,
|
|
132
138
|
[style.userSelectNone]: this.state.userSelectNone,
|
|
133
|
-
[style.disabledHover]: this.props.disabledHover
|
|
139
|
+
[style.disabledHover]: this.props.disabledHover,
|
|
134
140
|
});
|
|
135
141
|
const renderList = ({ children, props }) => {
|
|
136
142
|
const empty = (<tr>
|
|
137
|
-
<td colSpan={
|
|
143
|
+
<td colSpan={columnsArray.length || 1} className={style.tableMessage}>
|
|
138
144
|
{renderEmpty ? renderEmpty() : null}
|
|
139
145
|
</td>
|
|
140
146
|
</tr>);
|
|
141
|
-
const tbody = Array.isArray(children) && children.length > 0
|
|
142
|
-
? children
|
|
143
|
-
: empty;
|
|
147
|
+
const tbody = Array.isArray(children) && children.length > 0 ? children : empty;
|
|
144
148
|
return (<table className={classes} data-test="ring-table">
|
|
145
149
|
<Header {...headerProps}/>
|
|
146
150
|
<tbody {...props} data-test="ring-table-body">
|
|
@@ -153,22 +157,17 @@ export class Table extends PureComponent {
|
|
|
153
157
|
return null;
|
|
154
158
|
}
|
|
155
159
|
const { ref, ...restProps } = props;
|
|
156
|
-
const row = (<RowComponent innerRef={ref} level={getItemLevel(value)} item={value} showFocus={selection.isFocused(value)} autofocus={selection.isFocused(value)} focused={focused && selection.isFocused(value)} selectable={selectable && isItemSelectable(value)} selected={selectable && selection.isSelected(value)} onFocus={this.onRowFocus} onSelect={this.onRowSelect} onDoubleClick={onItemDoubleClick} onClick={onItemClick} collapsible={isItemCollapsible(value)} parentCollapsible={isParentCollapsible(value)} collapsed={isItemCollapsed(value)} onCollapse={onItemCollapse} onExpand={onItemExpand} showDisabledSelection={isDisabledSelectionVisible(value)} checkboxTooltip={getCheckboxTooltip(value)} className={classNames(getItemClassName(value), { [style.draggingRow]: isDragged })} metaColumnClassName={getMetaColumnClassName(value)} draggable={draggable} alwaysShowDragHandle={alwaysShowDragHandle} dragHandleTitle={dragHandleTitle} columns={columns} data-test={getItemDataTest(value)}
|
|
157
|
-
return isDragged
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
</table>)
|
|
161
|
-
: row;
|
|
160
|
+
const row = (<RowComponent innerRef={ref} level={getItemLevel(value)} item={value} showFocus={selection.isFocused(value)} autofocus={selection.isFocused(value)} focused={focused && selection.isFocused(value)} selectable={selectable && isItemSelectable(value)} selected={selectable && selection.isSelected(value)} onFocus={this.onRowFocus} onSelect={this.onRowSelect} onDoubleClick={onItemDoubleClick} onClick={onItemClick} collapsible={isItemCollapsible(value)} parentCollapsible={isParentCollapsible(value)} collapsed={isItemCollapsed(value)} onCollapse={onItemCollapse} onExpand={onItemExpand} showDisabledSelection={isDisabledSelectionVisible(value)} checkboxTooltip={getCheckboxTooltip(value)} className={classNames(getItemClassName(value), { [style.draggingRow]: isDragged })} metaColumnClassName={getMetaColumnClassName(value)} draggable={draggable} alwaysShowDragHandle={alwaysShowDragHandle} dragHandleTitle={dragHandleTitle} columns={columns} data-test={getItemDataTest(value)} {...restProps} key={restProps.key ?? getItemKey(value)}/>);
|
|
161
|
+
return isDragged ? (<table style={{ ...props.style }} className={style.draggingTable}>
|
|
162
|
+
<tbody>{row}</tbody>
|
|
163
|
+
</table>) : (row);
|
|
162
164
|
};
|
|
163
165
|
return (<div className={wrapperClasses} data-test="ring-table-wrapper" ref={this.props.innerRef}>
|
|
164
|
-
{focused &&
|
|
165
|
-
(<Shortcuts map={this.props.shortcutsMap} scope={this.state.shortcutsScope}/>)}
|
|
166
|
+
{focused && <Shortcuts map={this.props.shortcutsMap} scope={this.state.shortcutsScope}/>}
|
|
166
167
|
|
|
167
168
|
{/* Handler detects that user holds Shift key */}
|
|
168
169
|
<div role="presentation" onMouseDown={this.onMouseDown}>
|
|
169
|
-
{draggable
|
|
170
|
-
? (<List values={data} renderList={renderList} renderItem={renderItem} onChange={this.onSortEnd}/>)
|
|
171
|
-
: renderList({ children: data.map((value, index) => renderItem({ value, index })) })}
|
|
170
|
+
{draggable ? (<List values={data} renderList={renderList} renderItem={renderItem} onChange={this.onSortEnd}/>) : (renderList({ children: data.map((value, index) => renderItem({ value, index })) }))}
|
|
172
171
|
</div>
|
|
173
172
|
|
|
174
173
|
{loading && (<div className={style.loadingOverlay}>
|
|
@@ -1,21 +1,45 @@
|
|
|
1
1
|
[
|
|
2
|
-
{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
{
|
|
3
|
+
"id": 1,
|
|
4
|
+
"country": "Russia",
|
|
5
|
+
"city": "Moscow",
|
|
6
|
+
"url": "https://en.wikipedia.org/wiki/Russia",
|
|
7
|
+
"children": [
|
|
8
|
+
{"id": 11, "country": "Tatarstan", "city": "Kazan", "url": "https://en.wikipedia.org/wiki/Tatarstan"},
|
|
9
|
+
{"id": 12, "country": "Chechnya", "city": "Grosniy", "url": "https://en.wikipedia.org/wiki/Chechnya"}
|
|
10
|
+
]
|
|
11
|
+
},
|
|
6
12
|
{"id": 2, "country": "France", "city": "Paris", "url": "https://en.wikipedia.org/wiki/France"},
|
|
7
13
|
{"id": 3, "country": "Sweden", "city": "Stockholm", "url": "https://en.wikipedia.org/wiki/Sweden"},
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
{
|
|
15
|
+
"id": 4,
|
|
16
|
+
"country": "USA",
|
|
17
|
+
"city": "NYC",
|
|
18
|
+
"url": "https://en.wikipedia.org/wiki/USA",
|
|
19
|
+
"children": [
|
|
20
|
+
{"id": 41, "country": "California", "city": "Los Angeles", "url": "https://en.wikipedia.org/wiki/California"},
|
|
21
|
+
{
|
|
22
|
+
"id": 42,
|
|
23
|
+
"country": "New York",
|
|
24
|
+
"city": "NYC",
|
|
25
|
+
"url": "https://en.wikipedia.org/wiki/New York",
|
|
26
|
+
"children": [
|
|
27
|
+
{
|
|
28
|
+
"id": 421,
|
|
29
|
+
"country": "NYC",
|
|
30
|
+
"city": "NYC",
|
|
31
|
+
"url": "https://en.wikipedia.org/wiki/NYC",
|
|
32
|
+
"children": [
|
|
33
|
+
{"id": 4211, "country": "Manhattan", "city": "NYC", "url": "https://en.wikipedia.org/wiki/Manhattan"},
|
|
34
|
+
{"id": 4212, "country": "Brooklyn", "city": "NYC", "url": "https://en.wikipedia.org/wiki/Brooklyn"},
|
|
35
|
+
{"id": 4213, "country": "Queens", "city": "NYC", "url": "https://en.wikipedia.org/wiki/Queens"}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{"id": 43, "country": "Texas", "city": "Houston", "url": "https://en.wikipedia.org/wiki/Texas"}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
19
43
|
{"id": 5, "country": "South Africa", "city": "Johannesburg", "url": "https://en.wikipedia.org/wiki/South Africa"},
|
|
20
44
|
{"id": 6, "country": "Finland", "city": "Helsinki", "url": "https://en.wikipedia.org/wiki/Finland"},
|
|
21
45
|
{"id": 7, "country": "Latvia", "city": "Riga", "url": "https://en.wikipedia.org/wiki/Latvia"},
|
|
@@ -24,7 +48,12 @@
|
|
|
24
48
|
{"id": 11, "country": "China", "city": "Beijing", "url": "https://en.wikipedia.org/wiki/China"},
|
|
25
49
|
{"id": 12, "country": "Germany", "city": "Berlin", "url": "https://en.wikipedia.org/wiki/Germany"},
|
|
26
50
|
{"id": 13, "country": "Luxembourg", "city": "Luxembourg", "url": "https://en.wikipedia.org/wiki/Luxembourg"},
|
|
27
|
-
{
|
|
51
|
+
{
|
|
52
|
+
"id": 14,
|
|
53
|
+
"country": "Belgium",
|
|
54
|
+
"city": "Brussels",
|
|
55
|
+
"url": "http://statbel.fgov.be/fr/statistiques/chiffres/population/structure/natact/beletr/"
|
|
56
|
+
},
|
|
28
57
|
{"id": 15, "country": "Italy", "city": "Rome", "url": "https://en.wikipedia.org/wiki/Italy"},
|
|
29
58
|
{"id": 16, "country": "Spain", "city": "Madrid", "url": "https://en.wikipedia.org/wiki/Spain"},
|
|
30
59
|
{"id": 17, "country": "Portugal", "city": "Lisbon", "url": "https://en.wikipedia.org/wiki/Portugal"},
|
|
@@ -17,5 +17,5 @@ export interface MoreButtonProps {
|
|
|
17
17
|
morePopupItemClassName?: string | undefined;
|
|
18
18
|
morePopupBeforeEnd: ReactNode;
|
|
19
19
|
}
|
|
20
|
-
export declare const MoreButton: import("react").MemoExoticComponent<({ items, selected, onSelect, moreClassName, moreActiveClassName, morePopupClassName, morePopupItemClassName, morePopupBeforeEnd }: MoreButtonProps) => import("react").JSX.Element | null>;
|
|
20
|
+
export declare const MoreButton: import("react").MemoExoticComponent<({ items, selected, onSelect, moreClassName, moreActiveClassName, morePopupClassName, morePopupItemClassName, morePopupBeforeEnd, }: MoreButtonProps) => import("react").JSX.Element | null>;
|
|
21
21
|
export declare const FakeMoreButton: import("react").MemoExoticComponent<({ moreClassName, moreActiveClassName, hasActiveChildren }: FakeMoreButtonProps) => import("react").JSX.Element>;
|
|
@@ -13,14 +13,11 @@ export const AnchorLink = ({ hasActiveChildren, moreClassName, moreActiveClassNa
|
|
|
13
13
|
const classnames = classNames(styles.title, hasActiveChildren && styles.selected, hasActiveChildren && moreActiveClassName, moreClassName);
|
|
14
14
|
return (<Link title={'More'} className={classnames} {...restProps}>
|
|
15
15
|
{'More'}
|
|
16
|
-
<Icon glyph={chevronDownIcon} className={styles.chevron}
|
|
16
|
+
<Icon glyph={chevronDownIcon} className={styles.chevron}/>
|
|
17
|
+
</Link>);
|
|
17
18
|
};
|
|
18
|
-
const morePopupDirections = [
|
|
19
|
-
|
|
20
|
-
Directions.BOTTOM_LEFT,
|
|
21
|
-
Directions.BOTTOM_RIGHT
|
|
22
|
-
];
|
|
23
|
-
export const MoreButton = memo(({ items, selected, onSelect, moreClassName, moreActiveClassName, morePopupClassName, morePopupItemClassName, morePopupBeforeEnd }) => {
|
|
19
|
+
const morePopupDirections = [Directions.BOTTOM_CENTER, Directions.BOTTOM_LEFT, Directions.BOTTOM_RIGHT];
|
|
20
|
+
export const MoreButton = memo(({ items, selected, onSelect, moreClassName, moreActiveClassName, morePopupClassName, morePopupItemClassName, morePopupBeforeEnd, }) => {
|
|
24
21
|
const onSelectHandler = useCallback((listItem) => {
|
|
25
22
|
if (listItem.disabled === true || listItem.custom === true) {
|
|
26
23
|
return;
|
|
@@ -33,25 +30,25 @@ export const MoreButton = memo(({ items, selected, onSelect, moreClassName, more
|
|
|
33
30
|
const popupItems = getTabTitles({
|
|
34
31
|
items,
|
|
35
32
|
selected,
|
|
36
|
-
collapsed: true
|
|
33
|
+
collapsed: true,
|
|
37
34
|
}).map(tab => {
|
|
38
35
|
const disabled = tab.props.disabled === true;
|
|
39
36
|
const custom = tab.props.child.type === CustomItem;
|
|
40
|
-
return
|
|
37
|
+
return {
|
|
41
38
|
template: tab,
|
|
42
39
|
key: tab.key,
|
|
43
40
|
rgItemType: ListProps.Type.CUSTOM,
|
|
44
41
|
className: morePopupItemClassName,
|
|
45
42
|
disabled,
|
|
46
|
-
custom
|
|
47
|
-
}
|
|
43
|
+
custom,
|
|
44
|
+
};
|
|
48
45
|
});
|
|
49
46
|
if (morePopupBeforeEnd) {
|
|
50
47
|
popupItems.push({
|
|
51
48
|
template: morePopupBeforeEnd,
|
|
52
49
|
key: 'before-end-content',
|
|
53
50
|
className: styles.morePopupBeforeEnd,
|
|
54
|
-
rgItemType: ListProps.Type.CUSTOM
|
|
51
|
+
rgItemType: ListProps.Type.CUSTOM,
|
|
55
52
|
});
|
|
56
53
|
}
|
|
57
54
|
return popupItems;
|
|
@@ -62,10 +59,10 @@ export const MoreButton = memo(({ items, selected, onSelect, moreClassName, more
|
|
|
62
59
|
return null;
|
|
63
60
|
}
|
|
64
61
|
return (<div className={classNames(styles.title, moreClassName, hasActiveChild && moreActiveClassName)}>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
<Dropdown hoverMode anchor={popupAnchor}>
|
|
63
|
+
{popup}
|
|
64
|
+
</Dropdown>
|
|
65
|
+
</div>);
|
|
69
66
|
});
|
|
70
67
|
MoreButton.displayName = 'MoreButton';
|
|
71
68
|
export const FakeMoreButton = memo(({ moreClassName, moreActiveClassName, hasActiveChildren }) => (<div className={classNames(styles.moreButton, styles.title)}>
|
|
@@ -4,7 +4,7 @@ import styles from './tabs.css';
|
|
|
4
4
|
import TabLink from './tab-link';
|
|
5
5
|
import { CustomItem } from './custom-item';
|
|
6
6
|
function noop() { }
|
|
7
|
-
const TabTitle = React.memo(function TabTitle({ selected, child, handleSelect = noop, collapsed = false, tabIndex }) {
|
|
7
|
+
const TabTitle = React.memo(function TabTitle({ selected, child, handleSelect = noop, collapsed = false, tabIndex, }) {
|
|
8
8
|
if (child == null || typeof child !== 'object' || child.type === CustomItem) {
|
|
9
9
|
return child;
|
|
10
10
|
}
|
|
@@ -14,7 +14,7 @@ const TabTitle = React.memo(function TabTitle({ selected, child, handleSelect =
|
|
|
14
14
|
[styles.collapsed]: collapsed,
|
|
15
15
|
[activeClassName ?? '']: selected,
|
|
16
16
|
[collapsedClassName ?? '']: collapsed,
|
|
17
|
-
[collapsedActiveClassName ?? '']: collapsed && selected
|
|
17
|
+
[collapsedActiveClassName ?? '']: collapsed && selected,
|
|
18
18
|
});
|
|
19
19
|
return (<TabLink title={title} isSelected={selected} active href={href} className={titleClasses} disabled={disabled} onPlainLeftClick={handleSelect} tabIndex={tabIndex} collapsed={collapsed} {...titleProps}/>);
|
|
20
20
|
});
|
|
@@ -11,6 +11,6 @@ export interface CollapsibleTabsProps {
|
|
|
11
11
|
initialVisibleItems?: number | null | undefined;
|
|
12
12
|
morePopupBeforeEnd?: ReactNode;
|
|
13
13
|
}
|
|
14
|
-
export declare const CollapsibleTabs: ({ children, selected, onSelect, moreClassName, moreActiveClassName, morePopupClassName, morePopupBeforeEnd, morePopupItemClassName, initialVisibleItems }: CollapsibleTabsProps) => import("react").JSX.Element;
|
|
15
|
-
declare const _default: import("react").MemoExoticComponent<({ children, selected, onSelect, moreClassName, moreActiveClassName, morePopupClassName, morePopupBeforeEnd, morePopupItemClassName, initialVisibleItems }: CollapsibleTabsProps) => import("react").JSX.Element>;
|
|
14
|
+
export declare const CollapsibleTabs: ({ children, selected, onSelect, moreClassName, moreActiveClassName, morePopupClassName, morePopupBeforeEnd, morePopupItemClassName, initialVisibleItems, }: CollapsibleTabsProps) => import("react").JSX.Element;
|
|
15
|
+
declare const _default: import("react").MemoExoticComponent<({ children, selected, onSelect, moreClassName, moreActiveClassName, morePopupClassName, morePopupBeforeEnd, morePopupItemClassName, initialVisibleItems, }: CollapsibleTabsProps) => import("react").JSX.Element>;
|
|
16
16
|
export default _default;
|