@jetbrains/ring-ui 6.0.49 → 6.0.50
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.
|
@@ -620,13 +620,10 @@ export default class Select extends Component {
|
|
|
620
620
|
let nextSelection;
|
|
621
621
|
if (!prevState.multipleMap[selected.key]) {
|
|
622
622
|
nextSelection = currentSelection.concat(selected);
|
|
623
|
-
this.props.onSelect && this.props.onSelect(selected, event);
|
|
624
623
|
}
|
|
625
624
|
else {
|
|
626
625
|
nextSelection = currentSelection.filter(item => item.key !== selected.key);
|
|
627
|
-
this.props.onDeselect && this.props.onDeselect(selected);
|
|
628
626
|
}
|
|
629
|
-
this.props.onChange(nextSelection, event);
|
|
630
627
|
const nextState = {
|
|
631
628
|
filterValue: '',
|
|
632
629
|
selected: nextSelection,
|
|
@@ -648,6 +645,13 @@ export default class Select extends Component {
|
|
|
648
645
|
}
|
|
649
646
|
return { ...prevState, ...nextState };
|
|
650
647
|
}, () => {
|
|
648
|
+
if (this.state.multipleMap[selected.key]) {
|
|
649
|
+
this.props.onSelect?.(selected, event);
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
this.props.onDeselect?.(selected);
|
|
653
|
+
}
|
|
654
|
+
this.props.onChange(this.state.selected, event);
|
|
651
655
|
if (tryKeepOpen) {
|
|
652
656
|
this._redrawPopup();
|
|
653
657
|
}
|
|
@@ -45,6 +45,7 @@ declare class SimpleTable<T extends SelectionItem> extends PureComponent<SimpleT
|
|
|
45
45
|
loaderClassName?: import("react").Validator<string | null | undefined> | undefined;
|
|
46
46
|
stickyHeaderOffset?: import("react").Validator<string | null | undefined> | undefined;
|
|
47
47
|
renderEmpty?: import("react").Validator<(() => import("react").ReactNode) | null | undefined> | undefined;
|
|
48
|
+
RowComponent?: import("react").Validator<typeof import("./row-with-focus-sensor").default | null | undefined> | undefined;
|
|
48
49
|
shortcuts?: import("react").Validator<import("../shortcuts/core").ShortcutsMap | null | undefined> | undefined;
|
|
49
50
|
};
|
|
50
51
|
static defaultProps: {
|
|
@@ -49,6 +49,7 @@ declare class SmartTable<T extends SelectionItem> extends PureComponent<SmartTab
|
|
|
49
49
|
loaderClassName?: import("react").Validator<string | null | undefined> | undefined;
|
|
50
50
|
stickyHeaderOffset?: import("react").Validator<string | null | undefined> | undefined;
|
|
51
51
|
renderEmpty?: import("react").Validator<(() => import("react").ReactNode) | null | undefined> | undefined;
|
|
52
|
+
RowComponent?: import("react").Validator<typeof import("./row-with-focus-sensor").default | null | undefined> | undefined;
|
|
52
53
|
selectable?: import("react").Validator<boolean | null | undefined> | undefined;
|
|
53
54
|
shortcuts?: import("react").Validator<import("../shortcuts/core").ShortcutsMap | null | undefined> | undefined;
|
|
54
55
|
onSelectionChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -8,6 +8,7 @@ import { FocusSensorAddProps, FocusSensorProps } from '../global/focus-sensor-ho
|
|
|
8
8
|
import { SelectionItem } from './selection';
|
|
9
9
|
import { SelectionShortcutsAddProps, SelectionShortcutsProps } from './selection-shortcuts-hoc';
|
|
10
10
|
import { DisableHoverAddProps, DisableHoverProps } from './disable-hover-hoc';
|
|
11
|
+
import Row from './row-with-focus-sensor';
|
|
11
12
|
import { Column, SortParams } from './header-cell';
|
|
12
13
|
export interface ReorderParams<T> {
|
|
13
14
|
data: T[];
|
|
@@ -49,6 +50,7 @@ export interface TableProps<T extends SelectionItem> extends FocusSensorAddProps
|
|
|
49
50
|
caption?: string | null | undefined;
|
|
50
51
|
stickyHeaderOffset?: string | undefined;
|
|
51
52
|
renderEmpty?: (() => ReactNode) | null | undefined;
|
|
53
|
+
RowComponent: typeof Row;
|
|
52
54
|
}
|
|
53
55
|
/**
|
|
54
56
|
* Interactive table with selection and keyboard navigation support.
|
|
@@ -79,6 +81,7 @@ export declare class Table<T extends SelectionItem> extends PureComponent<TableP
|
|
|
79
81
|
remoteSelection: boolean;
|
|
80
82
|
isDisabledSelectionVisible: () => boolean;
|
|
81
83
|
getCheckboxTooltip: () => undefined;
|
|
84
|
+
RowComponent: typeof Row;
|
|
82
85
|
wideFirstColumn: boolean;
|
|
83
86
|
};
|
|
84
87
|
state: {
|
|
@@ -45,6 +45,7 @@ export class Table extends PureComponent {
|
|
|
45
45
|
remoteSelection: false,
|
|
46
46
|
isDisabledSelectionVisible: () => false,
|
|
47
47
|
getCheckboxTooltip: () => undefined,
|
|
48
|
+
RowComponent: Row,
|
|
48
49
|
//TODO: change to false in 7.0
|
|
49
50
|
wideFirstColumn: true
|
|
50
51
|
};
|
|
@@ -110,7 +111,7 @@ export class Table extends PureComponent {
|
|
|
110
111
|
window.scrollTo(scrollX, scrollY);
|
|
111
112
|
};
|
|
112
113
|
render() {
|
|
113
|
-
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, maxColSpan } = this.props;
|
|
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, maxColSpan, RowComponent } = this.props;
|
|
114
115
|
// NOTE: Do not construct new object per render because it causes all rows rerendering
|
|
115
116
|
const headerProps = {
|
|
116
117
|
caption, selectable, draggable,
|
|
@@ -155,7 +156,7 @@ export class Table extends PureComponent {
|
|
|
155
156
|
return null;
|
|
156
157
|
}
|
|
157
158
|
const { ref, ...restProps } = props;
|
|
158
|
-
const row = (<
|
|
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)} maxColSpan={maxColSpan} {...restProps} key={restProps.key ?? getItemKey(value)}/>);
|
|
159
160
|
return isDragged
|
|
160
161
|
? (<table style={{ ...props.style }} className={style.draggingTable}>
|
|
161
162
|
<tbody>{row}</tbody>
|