@jetbrains/ring-ui 6.0.60 → 6.0.62
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/table/header.d.ts +1 -2
- package/components/table/header.js +1 -6
- package/components/table/row.d.ts +0 -1
- package/components/table/row.js +1 -6
- package/components/table/simple-table.d.ts +0 -1
- package/components/table/smart-table.d.ts +0 -1
- package/components/table/table.d.ts +0 -1
- package/components/table/table.js +6 -5
- package/components/tooltip/tooltip.js +7 -2
- package/package.json +1 -1
|
@@ -14,7 +14,6 @@ export interface HeaderProps {
|
|
|
14
14
|
sortOrder: boolean;
|
|
15
15
|
caption?: string | null | undefined;
|
|
16
16
|
checkboxDisabled?: boolean | undefined;
|
|
17
|
-
maxColSpan?: number;
|
|
18
17
|
}
|
|
19
18
|
declare module 'react-waypoint' {
|
|
20
19
|
namespace Waypoint {
|
|
@@ -51,7 +50,7 @@ export default class Header extends PureComponent<HeaderProps> {
|
|
|
51
50
|
};
|
|
52
51
|
id: string;
|
|
53
52
|
onCheckboxFocus: (event: SyntheticEvent<HTMLElement>) => void;
|
|
54
|
-
createCells(widths?: never[]):
|
|
53
|
+
createCells(widths?: never[]): import("react").JSX.Element[];
|
|
55
54
|
render(): import("react").JSX.Element;
|
|
56
55
|
}
|
|
57
56
|
export type HeaderAttrs = JSX.LibraryManagedAttributes<typeof Header, HeaderProps>;
|
|
@@ -42,15 +42,10 @@ export default class Header extends PureComponent {
|
|
|
42
42
|
{selectable &&
|
|
43
43
|
(<Checkbox aria-labelledby={this.id} disabled={checkboxDisabled} checked={checked} onChange={onCheckboxChange} onFocus={this.onCheckboxFocus}/>)}
|
|
44
44
|
</div>);
|
|
45
|
-
let colSpan = 0;
|
|
46
45
|
return columns.map((column, index) => {
|
|
47
46
|
const columnStyle = widths[index] ? { width: widths[index] } : undefined;
|
|
48
47
|
const props = { column, onSort, sortKey, sortOrder, style: columnStyle };
|
|
49
|
-
|
|
50
|
-
if (colSpan > (this.props.maxColSpan || Infinity)) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
return (<HeaderCell key={column.id} data-test={column.id} colSpan={column.colSpan} {...props}>
|
|
48
|
+
return (<HeaderCell key={column.id} data-test={column.id} {...props}>
|
|
54
49
|
{index === 0 && (draggable || selectable) && metaColumn}
|
|
55
50
|
</HeaderCell>);
|
|
56
51
|
});
|
|
@@ -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;
|
package/components/table/row.js
CHANGED
|
@@ -75,7 +75,7 @@ export default class Row extends PureComponent {
|
|
|
75
75
|
};
|
|
76
76
|
composedRowRef = createComposedRef();
|
|
77
77
|
render() {
|
|
78
|
-
const { item, columns: columnProps, selectable, selected, showFocus, draggable, alwaysShowDragHandle, dragHandleTitle, level, collapsible, parentCollapsible, collapsed,
|
|
78
|
+
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;
|
|
79
79
|
const classes = classNames(className, {
|
|
80
80
|
[style.row]: true,
|
|
81
81
|
[style.rowFocused]: showFocus,
|
|
@@ -112,17 +112,12 @@ export default class Row extends PureComponent {
|
|
|
112
112
|
(<Button className={style.rowCollapseExpandButton} icon={chevronDownIcon} onClick={() => onCollapse(item)}/>)}
|
|
113
113
|
</div>);
|
|
114
114
|
const columns = typeof columnProps === 'function' ? columnProps(item) : columnProps;
|
|
115
|
-
let colSpan = 0;
|
|
116
115
|
const cells = columns.map((column, index) => {
|
|
117
116
|
const getValue = column.getValue || (() => item[column.id]);
|
|
118
117
|
const getDataTest = column.getDataTest || (() => column.id);
|
|
119
118
|
const value = getValue(item, column);
|
|
120
119
|
const cellClasses = classNames({ [style.cellRight]: column.rightAlign }, column.className);
|
|
121
120
|
const showMetaColumn = draggable || selectable || collapsible || showDisabledSelection || !!level;
|
|
122
|
-
colSpan += column.colSpan || 1;
|
|
123
|
-
if (colSpan > (maxColSpan || Infinity)) {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
121
|
return (<Cell colSpan={column.colSpan} key={column.id} className={cellClasses} data-test={getDataTest(item, column)}>
|
|
127
122
|
{index === 0 && (showMetaColumn) && metaColumn}
|
|
128
123
|
{value}
|
|
@@ -22,7 +22,6 @@ declare class SimpleTable<T extends SelectionItem> extends PureComponent<SimpleT
|
|
|
22
22
|
onSort?: import("react").Validator<((params: import("./header-cell").SortParams) => void) | null | undefined> | undefined;
|
|
23
23
|
sortKey?: import("react").Validator<string | null | undefined> | undefined;
|
|
24
24
|
sortOrder?: import("react").Validator<boolean | null | undefined> | undefined;
|
|
25
|
-
maxColSpan?: import("react").Validator<number | null | undefined> | undefined;
|
|
26
25
|
alwaysShowDragHandle?: import("react").Validator<boolean | null | undefined> | undefined;
|
|
27
26
|
dragHandleTitle?: import("react").Validator<string | null | undefined> | undefined;
|
|
28
27
|
onReorder?: import("react").Validator<((params: import("./table").ReorderParams<SelectionItem>) => void) | null | undefined> | undefined;
|
|
@@ -26,7 +26,6 @@ declare class SmartTable<T extends SelectionItem> extends PureComponent<SmartTab
|
|
|
26
26
|
onSort?: import("react").Validator<((params: import("./header-cell").SortParams) => void) | null | undefined> | undefined;
|
|
27
27
|
sortKey?: import("react").Validator<string | null | undefined> | undefined;
|
|
28
28
|
sortOrder?: import("react").Validator<boolean | null | undefined> | undefined;
|
|
29
|
-
maxColSpan?: import("react").Validator<number | null | undefined> | undefined;
|
|
30
29
|
alwaysShowDragHandle?: import("react").Validator<boolean | null | undefined> | undefined;
|
|
31
30
|
dragHandleTitle?: import("react").Validator<string | null | undefined> | undefined;
|
|
32
31
|
onReorder?: import("react").Validator<((params: import("./table").ReorderParams<SelectionItem>) => void) | null | undefined> | undefined;
|
|
@@ -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;
|
|
@@ -111,13 +111,14 @@ export class Table extends PureComponent {
|
|
|
111
111
|
window.scrollTo(scrollX, scrollY);
|
|
112
112
|
};
|
|
113
113
|
render() {
|
|
114
|
-
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,
|
|
114
|
+
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;
|
|
115
115
|
// NOTE: Do not construct new object per render because it causes all rows rerendering
|
|
116
|
+
const columnsArray = typeof columns === 'function' ? columns(null) : columns;
|
|
116
117
|
const headerProps = {
|
|
117
118
|
caption, selectable, draggable,
|
|
118
|
-
columns:
|
|
119
|
+
columns: columnsArray, onSort, sortKey, sortOrder,
|
|
119
120
|
sticky: stickyHeader,
|
|
120
|
-
topStickOffset: stickyHeaderOffset
|
|
121
|
+
topStickOffset: stickyHeaderOffset
|
|
121
122
|
};
|
|
122
123
|
const selectedSize = selection.getSelected().size;
|
|
123
124
|
const allSelectedSize = selection.selectAll().getSelected().size;
|
|
@@ -137,7 +138,7 @@ export class Table extends PureComponent {
|
|
|
137
138
|
});
|
|
138
139
|
const renderList = ({ children, props }) => {
|
|
139
140
|
const empty = (<tr>
|
|
140
|
-
<td colSpan={
|
|
141
|
+
<td colSpan={columnsArray.length || 1} className={style.tableMessage}>
|
|
141
142
|
{renderEmpty ? renderEmpty() : null}
|
|
142
143
|
</td>
|
|
143
144
|
</tr>);
|
|
@@ -156,7 +157,7 @@ export class Table extends PureComponent {
|
|
|
156
157
|
return null;
|
|
157
158
|
}
|
|
158
159
|
const { ref, ...restProps } = props;
|
|
159
|
-
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)}
|
|
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)}/>);
|
|
160
161
|
return isDragged
|
|
161
162
|
? (<table style={{ ...props.style }} className={style.draggingTable}>
|
|
162
163
|
<tbody>{row}</tbody>
|
|
@@ -97,7 +97,12 @@ export default class Tooltip extends Component {
|
|
|
97
97
|
addListeners() {
|
|
98
98
|
if (this.containerNode != null) {
|
|
99
99
|
this.listeners.add(this.containerNode, 'mouseover', this.tryToShowPopup);
|
|
100
|
-
this.listeners.add(this.containerNode, 'mouseout',
|
|
100
|
+
this.listeners.add(this.containerNode, 'mouseout', ev => {
|
|
101
|
+
if (ev.relatedTarget && this.popup?.container?.contains(ev.relatedTarget)) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
this.hidePopup();
|
|
105
|
+
});
|
|
101
106
|
}
|
|
102
107
|
this.listeners.add(document, 'scroll', () => scheduleScroll(this.hidePopup), { passive: true });
|
|
103
108
|
}
|
|
@@ -120,7 +125,7 @@ export default class Tooltip extends Component {
|
|
|
120
125
|
return (<TooltipContext.Provider value={{ onNestedTooltipShow, onNestedTooltipHide }}>
|
|
121
126
|
<span {...ariaProps} {...restProps} ref={this.containerRef} data-test={dataTests('ring-tooltip', dataTest)} data-test-title={typeof title === 'string' ? title : undefined}>
|
|
122
127
|
{children}
|
|
123
|
-
<Popup trapFocus={false} hidden={!this.state.showPopup || this.state.showNestedPopup} onCloseAttempt={this.hidePopup} maxHeight={400} className={classNames(styles.tooltip, { [styles.long]: long })} attached={false} top={4} dontCloseOnAnchorClick ref={this.popupRef} {...popupProps}>{title}</Popup>
|
|
128
|
+
<Popup trapFocus={false} hidden={!this.state.showPopup || this.state.showNestedPopup} onCloseAttempt={this.hidePopup} maxHeight={400} className={classNames(styles.tooltip, { [styles.long]: long })} attached={false} onMouseOut={this.hidePopup} top={4} dontCloseOnAnchorClick ref={this.popupRef} {...popupProps}>{title}</Popup>
|
|
124
129
|
</span>
|
|
125
130
|
</TooltipContext.Provider>);
|
|
126
131
|
}
|