@jetbrains/ring-ui 7.0.124 → 8.0.0-beta.10
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 +1 -9
- package/components/auth-dialog-service/auth-dialog-service.js +2 -2
- package/components/avatar/avatar-info.js +0 -2
- package/components/avatar/avatar-size.d.ts +0 -4
- package/components/avatar/avatar-size.js +0 -4
- package/components/avatar/avatar.js +0 -6
- package/components/avatar/fallback-avatar.js +0 -28
- package/components/avatar-stack/avatar-stack.js +1 -1
- package/components/button/button.css +4 -4
- package/components/button/button.d.ts +0 -4
- package/components/button/button.js +2 -7
- package/components/button-group/button-group.css +23 -23
- package/components/button-toolbar/button-toolbar.css +2 -2
- package/components/checkbox/checkbox.d.ts +1 -1
- package/components/collapse/collapse-content.js +7 -16
- package/components/collapse/collapse-context.d.ts +1 -0
- package/components/collapse/collapse-context.js +1 -0
- package/components/collapse/collapse-control.js +2 -2
- package/components/collapse/collapse.css +8 -2
- package/components/collapse/collapse.js +10 -2
- package/components/collapsible-group/collapsible-group.css +1 -1
- package/components/collapsible-group/collapsible-group.d.ts +5 -1
- package/components/collapsible-group/collapsible-group.js +13 -22
- package/components/confirm-service/confirm-service.js +2 -2
- package/components/contenteditable/contenteditable.js +1 -2
- package/components/data-list/data-list.d.ts +4 -4
- package/components/data-list/data-list.js +2 -2
- package/components/data-list/data-list.mock.d.ts +1 -1
- package/components/data-list/item.d.ts +1 -1
- package/components/data-list/selection.d.ts +1 -1
- package/components/data-list/selection.js +1 -1
- package/components/date-picker/month.d.ts +0 -2
- package/components/date-picker/month.js +5 -5
- package/components/date-picker/months.js +8 -7
- package/components/date-picker/use-scroll-behavior.js +5 -6
- package/components/date-picker/years.js +11 -10
- package/components/dialog/dialog.d.ts +2 -2
- package/components/dialog/dialog.js +2 -2
- package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
- package/components/dropdown-menu/dropdown-menu.js +4 -4
- package/components/editable-heading/editable-heading.d.ts +1 -2
- package/components/editable-heading/editable-heading.js +5 -6
- package/components/global/compose-refs.d.ts +2 -1
- package/components/global/compose-refs.js +24 -8
- package/components/global/configuration.d.ts +0 -5
- package/components/global/configuration.js +0 -7
- package/components/global/create-stateful-context.js +5 -5
- package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
- package/components/global/focus-with-temporary-tabindex.js +21 -0
- package/components/global/intersection-observer-context.d.ts +46 -0
- package/components/global/intersection-observer-context.js +91 -0
- package/components/global/is-within-interactive-element.d.ts +6 -0
- package/components/global/is-within-interactive-element.js +26 -0
- package/components/global/is-within-navigable-element.d.ts +6 -0
- package/components/global/is-within-navigable-element.js +27 -0
- package/components/global/parse-css-duration.d.ts +5 -0
- package/components/global/parse-css-duration.js +13 -0
- package/components/global/rerender-hoc.d.ts +4 -2
- package/components/global/rerender-hoc.js +4 -4
- package/components/global/schedule-with-cleanup.d.ts +12 -0
- package/components/global/schedule-with-cleanup.js +34 -0
- package/components/{table/selection.d.ts → global/table-selection.d.ts} +15 -15
- package/components/{table/selection.js → global/table-selection.js} +3 -3
- package/components/global/theme.d.ts +4 -3
- package/components/global/theme.js +8 -8
- package/components/global/variables.css +0 -10
- package/components/global/variables.interface.d.ts +0 -4
- package/components/global/variables_dark.css +0 -7
- package/components/i18n/i18n-context.js +1 -1
- package/components/icon/icon-svg.js +2 -3
- package/components/icon/icon.css +0 -27
- package/components/icon/icon.d.ts +0 -1
- package/components/icon/icon.js +2 -4
- package/components/input/input.d.ts +1 -1
- package/components/island/adaptive-island-hoc.js +4 -4
- package/components/island/content.d.ts +7 -2
- package/components/island/content.js +5 -5
- package/components/{table → legacy-table}/cell.js +1 -1
- package/components/{table → legacy-table}/header-cell.js +1 -1
- package/components/{table → legacy-table}/header.js +1 -1
- package/components/legacy-table/legacy-table.css +260 -0
- package/components/{table → legacy-table}/multitable.d.ts +1 -1
- package/components/{table → legacy-table}/row.d.ts +1 -1
- package/components/{table → legacy-table}/row.js +1 -1
- package/components/legacy-table/selection-adapter.d.ts +6 -0
- package/components/{table → legacy-table}/selection-shortcuts-hoc.d.ts +5 -5
- package/components/{table → legacy-table}/simple-table.d.ts +2 -2
- package/components/{table → legacy-table}/simple-table.js +3 -3
- package/components/{table → legacy-table}/smart-table.d.ts +5 -5
- package/components/{table → legacy-table}/smart-table.js +3 -3
- package/components/legacy-table/table.d.ts +109 -0
- package/components/legacy-table/table.js +191 -0
- package/components/list/consts.d.ts +0 -1
- package/components/list/consts.js +0 -1
- package/components/list/list.d.ts +0 -4
- package/components/login-dialog/service.js +2 -2
- package/components/popup/popup.target.d.ts +3 -2
- package/components/popup/popup.target.js +4 -6
- package/components/query-assist/query-assist.d.ts +3 -1
- package/components/query-assist/query-assist.js +2 -2
- package/components/radio/radio-item.d.ts +3 -3
- package/components/radio/radio-item.js +3 -4
- package/components/radio/radio.d.ts +2 -2
- package/components/radio/radio.js +1 -1
- package/components/select/select-popup.d.ts +3 -2
- package/components/select/select-popup.js +3 -3
- package/components/select/select.d.ts +6 -2
- package/components/select/select.js +2 -4
- package/components/selection-toolbar/selection-toolbar.css +86 -0
- package/components/selection-toolbar/selection-toolbar.d.ts +11 -0
- package/components/selection-toolbar/selection-toolbar.js +23 -0
- package/components/slider/slider.js +4 -5
- package/components/tab-trap/tab-trap.d.ts +3 -3
- package/components/tab-trap/tab-trap.js +3 -5
- package/components/table/default-item-renderer.d.ts +55 -0
- package/components/table/default-item-renderer.js +77 -0
- package/components/table/internal/reorder-animation-context.d.ts +21 -0
- package/components/table/internal/reorder-animation-context.js +60 -0
- package/components/table/internal/reorder-handle.d.ts +9 -0
- package/components/table/internal/reorder-handle.js +334 -0
- package/components/table/internal/reorder-layout-context.d.ts +16 -0
- package/components/table/internal/reorder-layout-context.js +69 -0
- package/components/table/internal/table-header.d.ts +1 -0
- package/components/table/internal/table-header.js +143 -0
- package/components/table/internal/virtualization.d.ts +41 -0
- package/components/table/internal/virtualization.js +186 -0
- package/components/table/item-virtualization.d.ts +37 -0
- package/components/table/item-virtualization.js +26 -0
- package/components/table/reorder-animation.d.ts +37 -0
- package/components/table/reorder-animation.js +11 -0
- package/components/table/reorder-item-layout.d.ts +32 -0
- package/components/table/reorder-item-layout.js +23 -0
- package/components/table/table-const.d.ts +10 -0
- package/components/table/table-const.js +10 -0
- package/components/table/table-primitives.d.ts +64 -0
- package/components/table/table-primitives.js +34 -0
- package/components/table/table-props.d.ts +304 -0
- package/components/table/table-props.js +1 -0
- package/components/table/table.css +156 -167
- package/components/table/table.d.ts +231 -107
- package/components/table/table.js +319 -183
- package/components/tags-input/tags-input.d.ts +3 -1
- package/components/tooltip/tooltip.d.ts +2 -1
- package/components/tooltip/tooltip.js +6 -5
- package/components/upload/upload.d.ts +4 -3
- package/components/upload/upload.js +3 -7
- package/components/user-agreement/service.js +2 -2
- package/components/util-stories.d.ts +26 -0
- package/components/util-stories.js +61 -0
- package/package.json +45 -48
- package/components/content-layout/content-layout.css +0 -109
- package/components/content-layout/content-layout.d.ts +0 -20
- package/components/content-layout/content-layout.js +0 -40
- package/components/content-layout/sidebar.d.ts +0 -26
- package/components/content-layout/sidebar.js +0 -71
- package/components/date-picker/use-intersection-observer.d.ts +0 -6
- package/components/date-picker/use-intersection-observer.js +0 -48
- package/components/expand/collapsible-group.css +0 -76
- package/components/expand/collapsible-group.d.ts +0 -8
- package/components/expand/collapsible-group.js +0 -14
- package/components/global/composeRefs.d.ts +0 -6
- package/components/global/composeRefs.js +0 -7
- package/components/global/use-event-callback.d.ts +0 -4
- package/components/global/use-event-callback.js +0 -20
- package/components/grid/col.d.ts +0 -16
- package/components/grid/col.js +0 -35
- package/components/grid/grid.css +0 -920
- package/components/grid/grid.d.ts +0 -13
- package/components/grid/grid.js +0 -19
- package/components/grid/row.d.ts +0 -21
- package/components/grid/row.js +0 -41
- package/components/old-browsers-message/__mocks__/old-browsers-message.js +0 -1
- package/components/old-browsers-message/old-browsers-message-stop.d.ts +0 -1
- package/components/old-browsers-message/old-browsers-message-stop.js +0 -2
- package/components/old-browsers-message/old-browsers-message.css +0 -26
- package/components/old-browsers-message/old-browsers-message.d.ts +0 -5
- package/components/old-browsers-message/old-browsers-message.js +0 -86
- package/components/old-browsers-message/white-list.d.ts +0 -2
- package/components/old-browsers-message/white-list.js +0 -24
- package/components/table/selection-adapter.d.ts +0 -6
- /package/components/{table → legacy-table}/cell.d.ts +0 -0
- /package/components/{table → legacy-table}/disable-hover-hoc.d.ts +0 -0
- /package/components/{table → legacy-table}/disable-hover-hoc.js +0 -0
- /package/components/{table → legacy-table}/header-cell.d.ts +0 -0
- /package/components/{table → legacy-table}/header.d.ts +0 -0
- /package/components/{table → legacy-table}/multitable.js +0 -0
- /package/components/{table → legacy-table}/row-with-focus-sensor.d.ts +0 -0
- /package/components/{table → legacy-table}/row-with-focus-sensor.js +0 -0
- /package/components/{table → legacy-table}/selection-adapter.js +0 -0
- /package/components/{table → legacy-table}/selection-shortcuts-hoc.js +0 -0
- /package/components/{table → legacy-table}/table.examples2.json +0 -0
|
@@ -17,11 +17,11 @@ export default function adaptiveIslandHOC(ComposedComponent) {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
render() {
|
|
20
|
-
return (<PhaseContext
|
|
21
|
-
<ScrollHandlerContext
|
|
20
|
+
return (<PhaseContext value={this.state.phase}>
|
|
21
|
+
<ScrollHandlerContext value={this.onContentScroll}>
|
|
22
22
|
<ComposedComponent {...this.props}/>
|
|
23
|
-
</ScrollHandlerContext
|
|
24
|
-
</PhaseContext
|
|
23
|
+
</ScrollHandlerContext>
|
|
24
|
+
</PhaseContext>);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Component, type HTMLAttributes } from 'react';
|
|
1
|
+
import { Component, type Ref, type HTMLAttributes } from 'react';
|
|
2
2
|
import createResizeDetector from 'element-resize-detector';
|
|
3
3
|
export interface IslandContentProps extends Omit<HTMLAttributes<HTMLElement>, 'onScroll'> {
|
|
4
|
+
ref?: Ref<Content>;
|
|
4
5
|
fade?: boolean | null | undefined;
|
|
5
6
|
onScrollToBottom?: (() => void) | null | undefined;
|
|
6
7
|
scrollableWrapperClassName?: string | null | undefined;
|
|
7
8
|
}
|
|
8
9
|
export interface IslandContentInnerProps extends IslandContentProps {
|
|
10
|
+
ref?: Ref<Content>;
|
|
9
11
|
onScroll: (node: HTMLElement) => void;
|
|
10
12
|
bottomBorder: boolean;
|
|
11
13
|
}
|
|
@@ -29,5 +31,8 @@ declare class Content extends Component<IslandContentInnerProps> {
|
|
|
29
31
|
setScrollableNodeAndCalculatePosition: (node: HTMLElement | null) => void;
|
|
30
32
|
render(): import("react").JSX.Element;
|
|
31
33
|
}
|
|
32
|
-
declare const ContentWrapper:
|
|
34
|
+
declare const ContentWrapper: {
|
|
35
|
+
({ ...props }: IslandContentProps): import("react").JSX.Element;
|
|
36
|
+
displayName: string;
|
|
37
|
+
};
|
|
33
38
|
export default ContentWrapper;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Component } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import createResizeDetector from 'element-resize-detector';
|
|
4
4
|
import scheduleRAF from '../global/schedule-raf';
|
|
@@ -57,7 +57,7 @@ class Content extends Component {
|
|
|
57
57
|
this.calculateScrollPosition();
|
|
58
58
|
};
|
|
59
59
|
render() {
|
|
60
|
-
const { children, className, bottomBorder, scrollableWrapperClassName, onScroll, onScrollToBottom, fade, tabIndex, ...restProps } = this.props;
|
|
60
|
+
const { ref, children, className, bottomBorder, scrollableWrapperClassName, onScroll, onScrollToBottom, fade, tabIndex, ...restProps } = this.props;
|
|
61
61
|
const { scrolledToTop, scrolledToBottom } = this.state;
|
|
62
62
|
const classes = classNames(styles.content, className, {
|
|
63
63
|
[styles.contentWithTopFade]: fade && !scrolledToTop,
|
|
@@ -75,11 +75,11 @@ class Content extends Component {
|
|
|
75
75
|
</div>);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
const ContentWrapper =
|
|
78
|
+
const ContentWrapper = ({ ...props }) => (<ScrollHandlerContext.Consumer>
|
|
79
79
|
{onScroll => {
|
|
80
80
|
const addProps = onScroll ? { onScroll, bottomBorder: true } : {};
|
|
81
|
-
return <Content {...props} {...addProps}
|
|
81
|
+
return <Content {...props} {...addProps}/>;
|
|
82
82
|
}}
|
|
83
|
-
</ScrollHandlerContext.Consumer>)
|
|
83
|
+
</ScrollHandlerContext.Consumer>);
|
|
84
84
|
ContentWrapper.displayName = 'ContentWrapper';
|
|
85
85
|
export default ContentWrapper;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import dataTests from '../global/data-tests';
|
|
4
|
-
import style from './table.css';
|
|
4
|
+
import style from './legacy-table.css';
|
|
5
5
|
export default class Cell extends PureComponent {
|
|
6
6
|
render() {
|
|
7
7
|
const classes = classNames(style.cell, this.props.className);
|
|
@@ -4,7 +4,7 @@ import sortableIcon from '@jetbrains/icons/unsorted-12px';
|
|
|
4
4
|
import sortedIcon from '@jetbrains/icons/chevron-12px-down';
|
|
5
5
|
import Icon from '../icon/icon';
|
|
6
6
|
import dataTests from '../global/data-tests';
|
|
7
|
-
import style from './table.css';
|
|
7
|
+
import style from './legacy-table.css';
|
|
8
8
|
export default class HeaderCell extends PureComponent {
|
|
9
9
|
static defaultProps = {
|
|
10
10
|
onSort: () => { },
|
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
import Checkbox from '../checkbox/checkbox';
|
|
4
4
|
import getUID from '../global/get-uid';
|
|
5
5
|
import HeaderCell from './header-cell';
|
|
6
|
-
import style from './table.css';
|
|
6
|
+
import style from './legacy-table.css';
|
|
7
7
|
export default class Header extends PureComponent {
|
|
8
8
|
static defaultProps = {
|
|
9
9
|
selectable: true,
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
@import '../global/variables.css';
|
|
2
|
+
|
|
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
|
+
|
|
8
|
+
position: relative;
|
|
9
|
+
font-variant-numeric: var(--ring-font-variant-numeric);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.table {
|
|
13
|
+
width: 100%;
|
|
14
|
+
|
|
15
|
+
border-spacing: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.userSelectNone {
|
|
19
|
+
user-select: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.headerCell {
|
|
23
|
+
composes: font-smaller-lower from '../global/global.css';
|
|
24
|
+
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
height: calc(var(--ring-unit) * 3);
|
|
27
|
+
padding-right: calc(var(--ring-unit) * 5);
|
|
28
|
+
|
|
29
|
+
text-align: left;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
|
|
32
|
+
color: var(--ring-secondary-color);
|
|
33
|
+
|
|
34
|
+
font-weight: normal;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.headerCell:first-child {
|
|
38
|
+
padding-left: calc(var(--ring-unit) * 4);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.headerCell:last-child {
|
|
42
|
+
width: 100%;
|
|
43
|
+
padding-right: calc(var(--ring-unit) * 4);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.headerCell:first-child:only-child {
|
|
47
|
+
width: initial;
|
|
48
|
+
max-width: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.headerCell.headerCellSorted {
|
|
52
|
+
font-weight: var(--ring-font-weight-bold);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.headerCell.headerCellSortable {
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.headerCell .sorter {
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 5px;
|
|
62
|
+
|
|
63
|
+
display: none;
|
|
64
|
+
|
|
65
|
+
margin-left: 5px;
|
|
66
|
+
|
|
67
|
+
user-select: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.headerCell.headerCellSortable .sorter {
|
|
71
|
+
display: inline-block;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.sortedUp .icon {
|
|
75
|
+
transform: rotate(180deg);
|
|
76
|
+
transform-origin: center 44%;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.caption {
|
|
80
|
+
padding-top: var(--ring-unit);
|
|
81
|
+
padding-bottom: 6px;
|
|
82
|
+
|
|
83
|
+
color: var(--ring-text-color);
|
|
84
|
+
border-bottom: 0;
|
|
85
|
+
|
|
86
|
+
font-size: var(--ring-font-size);
|
|
87
|
+
font-weight: var(--ring-font-weight-bold);
|
|
88
|
+
line-height: var(--ring-line-height-lower);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.tableHead::after {
|
|
92
|
+
position: absolute;
|
|
93
|
+
|
|
94
|
+
width: 100%;
|
|
95
|
+
|
|
96
|
+
height: 1px;
|
|
97
|
+
|
|
98
|
+
content: '';
|
|
99
|
+
|
|
100
|
+
background-color: var(--ring-line-color);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.subHeaderSticky {
|
|
104
|
+
position: sticky;
|
|
105
|
+
|
|
106
|
+
z-index: var(--ring-fixed-z-index);
|
|
107
|
+
top: 0;
|
|
108
|
+
|
|
109
|
+
background-color: rgba(var(--ring-content-background-components), 0.9);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.row {
|
|
113
|
+
outline: none;
|
|
114
|
+
|
|
115
|
+
line-height: var(--ring-table-compensated);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* stylelint-disable-next-line selector-max-specificity */
|
|
119
|
+
.table:not(.disabledHover) .row:hover {
|
|
120
|
+
background-color: var(--ring-hover-background-color);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.rowSelected {
|
|
124
|
+
background-color: var(--ring-selected-background-color);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.rowFocused {
|
|
128
|
+
background-color: var(--ring-hover-background-color);
|
|
129
|
+
}
|
|
130
|
+
/* stylelint-disable-next-line selector-max-specificity */
|
|
131
|
+
.rowFocused .cell:nth-child(1) {
|
|
132
|
+
box-shadow: inset 2px 0 var(--ring-main-color);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.loadingOverlay {
|
|
136
|
+
position: absolute;
|
|
137
|
+
top: 0;
|
|
138
|
+
right: 0;
|
|
139
|
+
bottom: 0;
|
|
140
|
+
left: 0;
|
|
141
|
+
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
|
|
146
|
+
background-color: var(--ring-table-loader-background-color);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.cell {
|
|
150
|
+
composes: ellipsis from '../global/global.css';
|
|
151
|
+
|
|
152
|
+
box-sizing: content-box;
|
|
153
|
+
|
|
154
|
+
min-width: 0;
|
|
155
|
+
|
|
156
|
+
height: calc(4 * var(--ring-unit));
|
|
157
|
+
padding: 0;
|
|
158
|
+
padding-right: calc(var(--ring-unit) * 5);
|
|
159
|
+
|
|
160
|
+
color: var(--ring-text-color);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.cell:first-child {
|
|
164
|
+
padding-left: calc(var(--ring-unit) * 4);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.cell:last-child {
|
|
168
|
+
width: 100%;
|
|
169
|
+
|
|
170
|
+
/* Markup hack, allows cell to have content which is wider than cell and collapses it */
|
|
171
|
+
|
|
172
|
+
max-width: 0;
|
|
173
|
+
padding-right: calc(var(--ring-unit) * 4);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.wideFirstColumn .cell:first-child {
|
|
177
|
+
min-width: calc(var(--ring-unit) * 37);
|
|
178
|
+
max-width: calc(var(--ring-unit) * 77);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.cell:first-child:only-child {
|
|
182
|
+
width: initial;
|
|
183
|
+
max-width: none;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.cellUnlimited {
|
|
187
|
+
width: 100%;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.cellRight {
|
|
191
|
+
text-align: right;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.metaColumn {
|
|
195
|
+
position: relative;
|
|
196
|
+
|
|
197
|
+
float: left;
|
|
198
|
+
|
|
199
|
+
height: 16px;
|
|
200
|
+
padding-right: var(--ring-table-compensate);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.metaColumn.headerMetaColumn {
|
|
204
|
+
padding-top: 1px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.dragHandle {
|
|
208
|
+
top: var(--ring-table-top);
|
|
209
|
+
left: calc(-2 * var(--ring-unit));
|
|
210
|
+
|
|
211
|
+
cursor: grab;
|
|
212
|
+
|
|
213
|
+
opacity: 0;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* override button */
|
|
217
|
+
.dragHandle.dragHandle {
|
|
218
|
+
position: absolute;
|
|
219
|
+
|
|
220
|
+
height: calc(calc(4 * var(--ring-unit)) - var(--ring-table-top));
|
|
221
|
+
padding: 0;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.dragHandle.visibleDragHandle,
|
|
225
|
+
.row:hover .dragHandle {
|
|
226
|
+
opacity: 1;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.rowCollapseExpandButton {
|
|
230
|
+
padding-right: calc(var(--ring-unit) / 2);
|
|
231
|
+
padding-left: 7px;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.draggingRow {
|
|
235
|
+
z-index: var(--ring-overlay-z-index);
|
|
236
|
+
|
|
237
|
+
background-color: var(--ring-hover-background-color);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.draggingRow .dragHandle {
|
|
241
|
+
cursor: grabbing;
|
|
242
|
+
|
|
243
|
+
opacity: 1;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.draggingRow .dragHandle svg {
|
|
247
|
+
color: var(--ring-main-color);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.draggingTable {
|
|
251
|
+
z-index: var(--ring-overlay-z-index);
|
|
252
|
+
|
|
253
|
+
border-spacing: 0;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.tableMessage {
|
|
257
|
+
padding: calc(var(--ring-unit) * 2) calc(var(--ring-unit) * 4);
|
|
258
|
+
|
|
259
|
+
color: var(--ring-secondary-color);
|
|
260
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PureComponent, type ReactElement } from 'react';
|
|
2
2
|
import { type TableAttrs } from './table';
|
|
3
|
-
import { type SelectionItem } from '
|
|
3
|
+
import { type SelectionItem } from '../global/table-selection';
|
|
4
4
|
type TableComponent = ReactElement<TableAttrs<SelectionItem>>;
|
|
5
5
|
export interface MultiTableProps {
|
|
6
6
|
children: TableComponent[];
|
|
@@ -55,7 +55,7 @@ export default class Row<T extends object> extends PureComponent<RowProps<T>> {
|
|
|
55
55
|
onDoubleClick: () => void;
|
|
56
56
|
row?: HTMLElement | null;
|
|
57
57
|
rowRef: (el: HTMLElement | null) => void;
|
|
58
|
-
composedRowRef: import("memoize-one").MemoizedFn<(...refs: (React.Ref<HTMLElement> | undefined)[]) => (value: T_1 | null) => void>;
|
|
58
|
+
composedRowRef: import("memoize-one").MemoizedFn<(...refs: (React.Ref<HTMLElement> | undefined)[]) => (value: T_1 | null) => () => void>;
|
|
59
59
|
render(): React.JSX.Element;
|
|
60
60
|
}
|
|
61
61
|
export type RowAttrs<T extends object> = React.JSX.LibraryManagedAttributes<typeof Row, RowProps<T>>;
|
|
@@ -11,7 +11,7 @@ import dataTests from '../global/data-tests';
|
|
|
11
11
|
import getUID from '../global/get-uid';
|
|
12
12
|
import { createComposedRef } from '../global/compose-refs';
|
|
13
13
|
import Cell from './cell';
|
|
14
|
-
import style from './table.css';
|
|
14
|
+
import style from './legacy-table.css';
|
|
15
15
|
const DragHandle = ({ alwaysShowDragHandle, dragHandleTitle = 'Drag to reorder' }) => {
|
|
16
16
|
const classes = classNames(style.dragHandle, {
|
|
17
17
|
[style.visibleDragHandle]: alwaysShowDragHandle,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type TableSelection from '../global/table-selection';
|
|
2
|
+
import type { SelectionItem } from '../global/table-selection';
|
|
3
|
+
export default function selectionAdapter(getSelection: () => TableSelection<SelectionItem>): {
|
|
4
|
+
readonly size: number;
|
|
5
|
+
readonly items: SelectionItem[];
|
|
6
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { type ComponentClass } from 'react';
|
|
2
2
|
import { type ShortcutsMap } from '../shortcuts/core';
|
|
3
|
-
import type
|
|
3
|
+
import type TableSelection from '../global/table-selection';
|
|
4
4
|
export interface SelectionShortcutsOuterProps<T extends object> {
|
|
5
|
-
selection:
|
|
5
|
+
selection: TableSelection<T>;
|
|
6
6
|
selectable?: boolean | undefined;
|
|
7
|
-
onSelect?: ((selection:
|
|
7
|
+
onSelect?: ((selection: TableSelection<T>) => void) | undefined;
|
|
8
8
|
shortcuts?: ShortcutsMap | undefined;
|
|
9
9
|
}
|
|
10
10
|
export interface SelectionShortcutsAddProps<T extends object> {
|
|
11
|
-
selection:
|
|
11
|
+
selection: TableSelection<T>;
|
|
12
12
|
selectable: boolean;
|
|
13
|
-
onSelect: (selection:
|
|
13
|
+
onSelect: (selection: TableSelection<T>) => void;
|
|
14
14
|
shortcutsMap: ShortcutsMap;
|
|
15
15
|
}
|
|
16
16
|
export type SelectionShortcutsProps<T extends object, P> = Omit<P, keyof SelectionShortcutsAddProps<T>> & SelectionShortcutsOuterProps<T>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
2
|
import { type TableAttrs } from './table';
|
|
3
|
-
import
|
|
3
|
+
import TableSelection, { type SelectionItem } from '../global/table-selection';
|
|
4
4
|
export interface SimpleTableProps<T extends SelectionItem> extends Omit<TableAttrs<T>, 'selection' | 'onSelect' | 'selectable'> {
|
|
5
5
|
}
|
|
6
6
|
declare class SimpleTable<T extends SelectionItem> extends PureComponent<SimpleTableProps<T>> {
|
|
@@ -9,7 +9,7 @@ declare class SimpleTable<T extends SelectionItem> extends PureComponent<SimpleT
|
|
|
9
9
|
wideFirstColumn: boolean;
|
|
10
10
|
};
|
|
11
11
|
state: {
|
|
12
|
-
selection:
|
|
12
|
+
selection: TableSelection<T>;
|
|
13
13
|
};
|
|
14
14
|
classes: string;
|
|
15
15
|
render(): import("react").JSX.Element;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import Table from './table';
|
|
4
|
-
import
|
|
5
|
-
import style from './table.css';
|
|
4
|
+
import TableSelection from '../global/table-selection';
|
|
5
|
+
import style from './legacy-table.css';
|
|
6
6
|
class SimpleTable extends PureComponent {
|
|
7
7
|
static defaultProps = {
|
|
8
8
|
selectable: false,
|
|
9
9
|
wideFirstColumn: false,
|
|
10
10
|
};
|
|
11
11
|
state = {
|
|
12
|
-
selection: new
|
|
12
|
+
selection: new TableSelection({
|
|
13
13
|
data: this.props.data,
|
|
14
14
|
}),
|
|
15
15
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
2
|
import { type TableAttrs } from './table';
|
|
3
|
-
import
|
|
3
|
+
import TableSelection, { type SelectionItem } from '../global/table-selection';
|
|
4
4
|
export interface SmartTableProps<T extends SelectionItem> extends Omit<TableAttrs<T>, 'selection' | 'onSelect'> {
|
|
5
|
-
onSelectionChange: (selection:
|
|
6
|
-
selection?:
|
|
5
|
+
onSelectionChange: (selection: TableSelection<T>) => void;
|
|
6
|
+
selection?: TableSelection<T>;
|
|
7
7
|
}
|
|
8
8
|
declare class SmartTable<T extends SelectionItem> extends PureComponent<SmartTableProps<T>> {
|
|
9
9
|
static defaultProps: {
|
|
10
10
|
onSelectionChange: () => void;
|
|
11
11
|
};
|
|
12
12
|
state: {
|
|
13
|
-
selection:
|
|
13
|
+
selection: TableSelection<T>;
|
|
14
14
|
};
|
|
15
15
|
UNSAFE_componentWillReceiveProps(nextProps: SmartTableProps<T>): void;
|
|
16
|
-
onSelect: (selection:
|
|
16
|
+
onSelect: (selection: TableSelection<T>) => void;
|
|
17
17
|
render(): import("react").JSX.Element;
|
|
18
18
|
}
|
|
19
19
|
export default SmartTable;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
2
|
import Table from './table';
|
|
3
|
-
import
|
|
3
|
+
import TableSelection from '../global/table-selection';
|
|
4
4
|
class SmartTable extends PureComponent {
|
|
5
5
|
static defaultProps = {
|
|
6
6
|
onSelectionChange: () => { },
|
|
7
7
|
};
|
|
8
8
|
state = {
|
|
9
|
-
selection: new
|
|
9
|
+
selection: new TableSelection({
|
|
10
10
|
data: this.props.data,
|
|
11
11
|
isItemSelectable: this.props.isItemSelectable,
|
|
12
12
|
}),
|
|
@@ -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
|
|
21
|
+
selection: new TableSelection({ data, isItemSelectable }),
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name Table
|
|
3
|
+
*/
|
|
4
|
+
import { Component, PureComponent, type ReactNode, type SyntheticEvent } from 'react';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { type OnChangeMeta } from 'react-movable/lib/types';
|
|
7
|
+
import { type FocusSensorAddProps, type FocusSensorProps } from '../global/focus-sensor-hoc';
|
|
8
|
+
import { type SelectionShortcutsAddProps, type SelectionShortcutsProps } from './selection-shortcuts-hoc';
|
|
9
|
+
import { type DisableHoverAddProps, type DisableHoverProps } from './disable-hover-hoc';
|
|
10
|
+
import Row from './row-with-focus-sensor';
|
|
11
|
+
import { type Column, type SortParams } from './header-cell';
|
|
12
|
+
export interface ReorderParams<T> {
|
|
13
|
+
data: T[];
|
|
14
|
+
oldIndex: number;
|
|
15
|
+
newIndex: number;
|
|
16
|
+
}
|
|
17
|
+
export interface TableProps<T extends object> extends FocusSensorAddProps<HTMLTableRowElement>, SelectionShortcutsAddProps<T>, DisableHoverAddProps {
|
|
18
|
+
data: readonly T[];
|
|
19
|
+
columns: readonly Column<T>[] | ((item: T | null) => readonly Column<T>[]);
|
|
20
|
+
isItemSelectable: (item: T) => boolean;
|
|
21
|
+
loading: boolean;
|
|
22
|
+
onSort: (params: SortParams) => void;
|
|
23
|
+
onReorder: (params: ReorderParams<T>) => void;
|
|
24
|
+
getItemKey: (item: T) => string | number;
|
|
25
|
+
sortKey: string;
|
|
26
|
+
sortOrder: boolean;
|
|
27
|
+
draggable: boolean;
|
|
28
|
+
alwaysShowDragHandle: boolean;
|
|
29
|
+
dragHandleTitle?: string;
|
|
30
|
+
stickyHeader: boolean;
|
|
31
|
+
wideFirstColumn: boolean;
|
|
32
|
+
getItemLevel: (item: T) => number;
|
|
33
|
+
getItemClassName: (item: T) => string | null | undefined;
|
|
34
|
+
getMetaColumnClassName: (item: T) => string | null | undefined;
|
|
35
|
+
getItemDataTest: (item: T) => string | null | undefined;
|
|
36
|
+
isItemCollapsible: (item: T) => boolean;
|
|
37
|
+
isParentCollapsible: (item: T) => boolean;
|
|
38
|
+
isItemCollapsed: (item: T) => boolean;
|
|
39
|
+
onItemCollapse: (item: T) => void;
|
|
40
|
+
onItemExpand: (item: T) => void;
|
|
41
|
+
onItemDoubleClick: (item: T) => void;
|
|
42
|
+
onItemClick: (item: T, e: React.MouseEvent<HTMLTableRowElement>) => void;
|
|
43
|
+
remoteSelection: boolean;
|
|
44
|
+
isDisabledSelectionVisible: (item: T) => boolean;
|
|
45
|
+
getCheckboxTooltip: (item: T) => string | undefined;
|
|
46
|
+
className?: string | null | undefined;
|
|
47
|
+
wrapperClassName?: string | null | undefined;
|
|
48
|
+
headerClassName?: string | null | undefined;
|
|
49
|
+
cellClassName?: string | null | undefined;
|
|
50
|
+
loaderClassName?: string | undefined;
|
|
51
|
+
caption?: string | null | undefined;
|
|
52
|
+
stickyHeaderOffset?: string | undefined;
|
|
53
|
+
renderEmpty?: (() => ReactNode) | null | undefined;
|
|
54
|
+
RowComponent: typeof Row;
|
|
55
|
+
renderLoader?: ((loaderClassName?: string) => ReactNode) | null | undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Interactive table with selection and keyboard navigation support.
|
|
59
|
+
*/
|
|
60
|
+
export declare class Table<T extends object> extends PureComponent<TableProps<T>> {
|
|
61
|
+
static defaultProps: {
|
|
62
|
+
isItemSelectable: () => boolean;
|
|
63
|
+
loading: boolean;
|
|
64
|
+
onSort: () => void;
|
|
65
|
+
onReorder: () => void;
|
|
66
|
+
getItemKey: (item: object) => string | number;
|
|
67
|
+
sortKey: string;
|
|
68
|
+
sortOrder: boolean;
|
|
69
|
+
draggable: boolean;
|
|
70
|
+
alwaysShowDragHandle: boolean;
|
|
71
|
+
stickyHeader: boolean;
|
|
72
|
+
getItemLevel: () => number;
|
|
73
|
+
getItemClassName: () => null;
|
|
74
|
+
getMetaColumnClassName: () => null;
|
|
75
|
+
getItemDataTest: () => null;
|
|
76
|
+
isItemCollapsible: () => boolean;
|
|
77
|
+
isParentCollapsible: () => boolean;
|
|
78
|
+
isItemCollapsed: () => boolean;
|
|
79
|
+
onItemCollapse: () => void;
|
|
80
|
+
onItemExpand: () => void;
|
|
81
|
+
onItemDoubleClick: () => void;
|
|
82
|
+
onItemClick: () => void;
|
|
83
|
+
remoteSelection: boolean;
|
|
84
|
+
isDisabledSelectionVisible: () => boolean;
|
|
85
|
+
getCheckboxTooltip: () => undefined;
|
|
86
|
+
RowComponent: typeof Row;
|
|
87
|
+
wideFirstColumn: boolean;
|
|
88
|
+
};
|
|
89
|
+
state: {
|
|
90
|
+
shortcutsScope: string;
|
|
91
|
+
userSelectNone: boolean;
|
|
92
|
+
};
|
|
93
|
+
componentDidMount(): void;
|
|
94
|
+
componentDidUpdate({ data, selection, onSelect, selectable, remoteSelection }: TableProps<T>): void;
|
|
95
|
+
componentWillUnmount(): void;
|
|
96
|
+
onMouseDown: (e: React.MouseEvent) => void;
|
|
97
|
+
onMouseUp: () => void;
|
|
98
|
+
onRowFocus: (row: T) => void;
|
|
99
|
+
onRowSelect: (row: T, selected: boolean) => void;
|
|
100
|
+
onSortEnd: ({ oldIndex, newIndex }: OnChangeMeta) => void;
|
|
101
|
+
onCheckboxChange: (e: SyntheticEvent<HTMLInputElement>) => void;
|
|
102
|
+
restoreFocusWithoutScroll: () => void;
|
|
103
|
+
render(): React.JSX.Element;
|
|
104
|
+
}
|
|
105
|
+
export type TableAttrs<T extends object> = DisableHoverProps<SelectionShortcutsProps<T, FocusSensorProps<TableProps<T>, HTMLTableRowElement, typeof Table>>>;
|
|
106
|
+
export default class TableContainer<T extends object> extends Component<TableAttrs<T>> {
|
|
107
|
+
Table: React.ComponentClass<DisableHoverProps<SelectionShortcutsProps<T, FocusSensorProps<TableProps<T>, HTMLTableRowElement, typeof Table>>>, any>;
|
|
108
|
+
render(): React.JSX.Element;
|
|
109
|
+
}
|