@qoretechnologies/reqore 0.36.2 → 0.36.3
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/.eslintrc.js +40 -0
- package/dist/components/Breadcrumbs/item.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/item.js +1 -5
- package/dist/components/Breadcrumbs/item.js.map +1 -1
- package/dist/components/Comment/index.d.ts.map +1 -1
- package/dist/components/Comment/index.js +6 -5
- package/dist/components/Comment/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +1 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +2 -2
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +2 -2
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +1 -1
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +3 -2
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/KeyValueTable/index.d.ts +1 -1
- package/dist/components/KeyValueTable/index.d.ts.map +1 -1
- package/dist/components/KeyValueTable/index.js +2 -1
- package/dist/components/KeyValueTable/index.js.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +8 -9
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/item.d.ts +1 -2
- package/dist/components/Menu/item.d.ts.map +1 -1
- package/dist/components/Menu/item.js +1 -5
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/Paging/index.d.ts +1 -1
- package/dist/components/Paging/index.d.ts.map +1 -1
- package/dist/components/Paging/index.js +1 -1
- package/dist/components/Paging/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +2 -1
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +1 -9
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/RadioGroup/index.d.ts.map +1 -1
- package/dist/components/RadioGroup/index.js +3 -3
- package/dist/components/RadioGroup/index.js.map +1 -1
- package/dist/components/Sidebar/index.d.ts +2 -2
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/item.d.ts +6 -6
- package/dist/components/Sidebar/item.d.ts.map +1 -1
- package/dist/components/Sidebar/item.js +3 -9
- package/dist/components/Sidebar/item.js.map +1 -1
- package/dist/components/Table/body.d.ts +2 -0
- package/dist/components/Table/body.d.ts.map +1 -1
- package/dist/components/Table/body.js +3 -1
- package/dist/components/Table/body.js.map +1 -1
- package/dist/components/Table/helpers.js.map +1 -1
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +3 -2
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts +3 -1
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +6 -7
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +3 -2
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/TimeAgo/index.js +2 -2
- package/dist/components/TimeAgo/index.js.map +1 -1
- package/dist/components/Tree/index.d.ts +2 -2
- package/dist/components/Tree/index.d.ts.map +1 -1
- package/dist/components/Tree/index.js +6 -20
- package/dist/components/Tree/index.js.map +1 -1
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/helpers/sidebar.d.ts +3 -2
- package/dist/helpers/sidebar.d.ts.map +1 -1
- package/dist/helpers/sidebar.js +4 -2
- package/dist/helpers/sidebar.js.map +1 -1
- package/dist/helpers/utils.d.ts +1 -1
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js.map +1 -1
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +1 -7
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/hooks/useTheme.js.map +1 -1
- package/dist/hooks/useWhyDidYouUpdate.js +1 -1
- package/dist/hooks/useWhyDidYouUpdate.js.map +1 -1
- package/package.json +7 -1
- package/src/components/Breadcrumbs/item.tsx +0 -1
- package/src/components/Comment/index.tsx +6 -4
- package/src/components/ControlGroup/index.tsx +1 -3
- package/src/components/Dropdown/index.tsx +5 -6
- package/src/components/Dropdown/list.tsx +6 -1
- package/src/components/Input/index.tsx +2 -2
- package/src/components/KeyValueTable/index.tsx +4 -2
- package/src/components/Menu/index.tsx +1 -2
- package/src/components/Menu/item.tsx +1 -7
- package/src/components/Paging/index.tsx +0 -1
- package/src/components/Panel/index.tsx +3 -2
- package/src/components/Popover/index.tsx +0 -5
- package/src/components/RadioGroup/index.tsx +2 -1
- package/src/components/Sidebar/index.tsx +2 -2
- package/src/components/Sidebar/item.tsx +7 -10
- package/src/components/Table/body.tsx +7 -1
- package/src/components/Table/helpers.ts +1 -1
- package/src/components/Table/index.tsx +5 -2
- package/src/components/Table/row.tsx +12 -9
- package/src/components/Tabs/item.tsx +2 -2
- package/src/components/TimeAgo/index.tsx +2 -2
- package/src/components/Tree/index.tsx +1 -17
- package/src/containers/UIProvider.tsx +1 -1
- package/src/helpers/sidebar.ts +20 -36
- package/src/helpers/utils.ts +1 -1
- package/src/hooks/usePopover.tsx +1 -7
- package/src/hooks/useTheme.ts +1 -1
- package/src/hooks/useWhyDidYouUpdate.ts +1 -1
- package/src/stories/KeyValueTable/KeyValueTable.stories.tsx +18 -0
- package/src/stories/Table/Table.stories.tsx +18 -1
- package/tests.json +1 -1
- package/dist/hooks/useShareForwardedRef.d.ts +0 -3
- package/dist/hooks/useShareForwardedRef.d.ts.map +0 -1
- package/dist/hooks/useShareForwardedRef.js +0 -25
- package/dist/hooks/useShareForwardedRef.js.map +0 -1
- package/dist/types/icons____.d.ts +0 -2
- package/dist/types/icons____.d.ts.map +0 -1
- package/dist/types/icons____.js +0 -5
- package/dist/types/icons____.js.map +0 -1
- package/src/hooks/useShareForwardedRef.ts +0 -23
- package/src/types/icons____.ts +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { size } from 'lodash';
|
|
1
|
+
import { omit, size } from 'lodash';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { ReqoreButton, ReqoreColumn, ReqoreControlGroup, ReqoreDropdown } from '../..';
|
|
4
4
|
import { TReqoreIntent } from '../../constants/theme';
|
|
@@ -96,10 +96,11 @@ export const ReqoreComment = ({
|
|
|
96
96
|
{size(actions) ? (
|
|
97
97
|
<ReqoreColumn justifyContent='flex-end'>
|
|
98
98
|
<ReqoreControlGroup minimal size='small'>
|
|
99
|
-
{actions.map(({ label, actions,
|
|
99
|
+
{actions.map(({ label, actions, ...rest }, index) =>
|
|
100
100
|
size(actions) ? (
|
|
101
101
|
<ReqoreDropdown
|
|
102
|
-
{...rest}
|
|
102
|
+
{...omit(rest, ['show'])}
|
|
103
|
+
key={index}
|
|
103
104
|
label={label}
|
|
104
105
|
componentProps={{
|
|
105
106
|
minimal: true,
|
|
@@ -111,7 +112,8 @@ export const ReqoreComment = ({
|
|
|
111
112
|
/>
|
|
112
113
|
) : (
|
|
113
114
|
<ReqoreButton
|
|
114
|
-
{...rest}
|
|
115
|
+
{...omit(rest, ['show'])}
|
|
116
|
+
key={index}
|
|
115
117
|
onClick={
|
|
116
118
|
rest.onClick
|
|
117
119
|
? (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
@@ -131,9 +131,6 @@ const ReqoreControlGroup = memo(
|
|
|
131
131
|
stack,
|
|
132
132
|
isInsideStackGroup,
|
|
133
133
|
isInsideVerticalGroup,
|
|
134
|
-
isFirstInLastGroup,
|
|
135
|
-
isLastInFirstGroup,
|
|
136
|
-
isLastInLastGroup,
|
|
137
134
|
intent,
|
|
138
135
|
customTheme,
|
|
139
136
|
isFirst,
|
|
@@ -430,6 +427,7 @@ const ReqoreControlGroup = memo(
|
|
|
430
427
|
? [
|
|
431
428
|
children.slice(overflowingChildren),
|
|
432
429
|
<ReqoreButton
|
|
430
|
+
key='control-group-menu'
|
|
433
431
|
icon='MenuLine'
|
|
434
432
|
customTheme={customTheme}
|
|
435
433
|
tooltip={{
|
|
@@ -13,7 +13,10 @@ import ReqoreDropdownList, {
|
|
|
13
13
|
TDropdownItemOnClick,
|
|
14
14
|
} from './list';
|
|
15
15
|
|
|
16
|
-
export interface IReqoreDropdownProps
|
|
16
|
+
export interface IReqoreDropdownProps
|
|
17
|
+
extends Partial<
|
|
18
|
+
Omit<IPopoverOptions, 'openOnMount' | 'show' | 'targetElement' | 'wrapperProps'>
|
|
19
|
+
> {
|
|
17
20
|
items?: IReqoreDropdownItem[];
|
|
18
21
|
multiSelect?: boolean;
|
|
19
22
|
buttonStyle?: React.CSSProperties;
|
|
@@ -50,7 +53,7 @@ const ReqoreDropdownListWrapper = ({
|
|
|
50
53
|
);
|
|
51
54
|
};
|
|
52
55
|
|
|
53
|
-
function ReqoreDropdown<T
|
|
56
|
+
function ReqoreDropdown<T = IReqoreButtonProps>({
|
|
54
57
|
items,
|
|
55
58
|
component,
|
|
56
59
|
label,
|
|
@@ -72,21 +75,17 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
|
72
75
|
closeOnOutsideClick,
|
|
73
76
|
blur,
|
|
74
77
|
closeOnAnyClick,
|
|
75
|
-
content,
|
|
76
78
|
delay,
|
|
77
79
|
maxHeight,
|
|
78
80
|
maxWidth,
|
|
79
81
|
noArrow = true,
|
|
80
82
|
transparent,
|
|
81
|
-
show,
|
|
82
|
-
targetElement,
|
|
83
83
|
useTargetWidth,
|
|
84
84
|
listWidth,
|
|
85
85
|
listHeight,
|
|
86
86
|
passPopoverData,
|
|
87
87
|
inputProps,
|
|
88
88
|
scrollToSelected,
|
|
89
|
-
wrapperProps,
|
|
90
89
|
paging,
|
|
91
90
|
...rest
|
|
92
91
|
}: IReqoreDropdownProps & T) {
|
|
@@ -9,6 +9,7 @@ import ReqoreMenu from '../Menu';
|
|
|
9
9
|
import ReqoreMenuDivider from '../Menu/divider';
|
|
10
10
|
import ReqoreMenuItem, { IReqoreMenuItemProps } from '../Menu/item';
|
|
11
11
|
import { ReqoreVerticalSpacer } from '../Spacer';
|
|
12
|
+
import { IReqoreDropdownDividerProps } from './item';
|
|
12
13
|
|
|
13
14
|
export type TDropdownItemOnClick = (item: IReqoreDropdownItem) => void;
|
|
14
15
|
export interface IReqoreDropdownItem
|
|
@@ -133,7 +134,11 @@ const ReqoreDropdownList = memo(
|
|
|
133
134
|
{finalItems.map(
|
|
134
135
|
({ onClick, dividerAlign, divider, ...item }: IReqoreDropdownItem, index: number) =>
|
|
135
136
|
divider ? (
|
|
136
|
-
<ReqoreMenuDivider
|
|
137
|
+
<ReqoreMenuDivider
|
|
138
|
+
key={index}
|
|
139
|
+
{...(item as unknown as IReqoreDropdownDividerProps)}
|
|
140
|
+
align={dividerAlign}
|
|
141
|
+
/>
|
|
137
142
|
) : (
|
|
138
143
|
<ReqoreMenuItem
|
|
139
144
|
key={index}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { omit } from 'lodash';
|
|
1
2
|
import { rgba } from 'polished';
|
|
2
3
|
import React, { forwardRef, useState } from 'react';
|
|
3
4
|
import styled, { css } from 'styled-components';
|
|
@@ -177,7 +178,6 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
177
178
|
flat,
|
|
178
179
|
rounded,
|
|
179
180
|
minimal,
|
|
180
|
-
children,
|
|
181
181
|
readOnly,
|
|
182
182
|
customTheme,
|
|
183
183
|
intent,
|
|
@@ -216,7 +216,7 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
216
216
|
</StyledIconWrapper>
|
|
217
217
|
)}
|
|
218
218
|
<StyledInput
|
|
219
|
-
{...rest}
|
|
219
|
+
{...omit(rest, ['children'])}
|
|
220
220
|
effect={{
|
|
221
221
|
interactive: !rest?.disabled && !readOnly,
|
|
222
222
|
...rest?.effect,
|
|
@@ -30,6 +30,7 @@ export interface IReqoreKeyValueTableProps
|
|
|
30
30
|
| 'zoomable'
|
|
31
31
|
| 'wrapperSize'
|
|
32
32
|
| 'paging'
|
|
33
|
+
| 'onRowClick'
|
|
33
34
|
> {
|
|
34
35
|
data: { [key: string | number]: TReqoreKeyValueTableValue };
|
|
35
36
|
|
|
@@ -73,7 +74,7 @@ export const ReqoreKeyValueTable = ({
|
|
|
73
74
|
...rest
|
|
74
75
|
}: IReqoreKeyValueTableProps) => {
|
|
75
76
|
const { columns, items } = useMemo(() => {
|
|
76
|
-
|
|
77
|
+
const columns: IReqoreTableColumn[] = [
|
|
77
78
|
{
|
|
78
79
|
dataId: 'tableKey',
|
|
79
80
|
grow: 1,
|
|
@@ -115,6 +116,7 @@ export const ReqoreKeyValueTable = ({
|
|
|
115
116
|
content: JSON.stringify(value),
|
|
116
117
|
noArrow: true,
|
|
117
118
|
useTargetWidth: true,
|
|
119
|
+
delay: 400,
|
|
118
120
|
}),
|
|
119
121
|
content: (data) =>
|
|
120
122
|
valueRenderer?.(data, ReqoreTableValue) || <ReqoreTableValue value={data.value} />,
|
|
@@ -139,7 +141,7 @@ export const ReqoreKeyValueTable = ({
|
|
|
139
141
|
});
|
|
140
142
|
}
|
|
141
143
|
|
|
142
|
-
|
|
144
|
+
const items: IReqoreTableRowData[] = [];
|
|
143
145
|
|
|
144
146
|
keys(data).map((key) => {
|
|
145
147
|
items.push({
|
|
@@ -84,8 +84,7 @@ const ReqoreMenu = forwardRef<HTMLDivElement, IReqoreMenuProps>(
|
|
|
84
84
|
>
|
|
85
85
|
{React.Children.map(children, (child) => {
|
|
86
86
|
return child
|
|
87
|
-
?
|
|
88
|
-
React.cloneElement(child, {
|
|
87
|
+
? React.cloneElement(child, {
|
|
89
88
|
_insidePopover,
|
|
90
89
|
_popoverId,
|
|
91
90
|
customTheme: child.props?.customTheme || theme,
|
|
@@ -7,13 +7,8 @@ import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
|
7
7
|
import { IReqoreComponent } from '../../types/global';
|
|
8
8
|
import { IReqoreButtonProps } from '../Button';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
export interface IReqoreMenuItemProps
|
|
12
|
-
extends IReqoreComponent,
|
|
13
|
-
React.HTMLAttributes<HTMLElement>,
|
|
14
|
-
IReqoreButtonProps {
|
|
10
|
+
export interface IReqoreMenuItemProps extends IReqoreComponent, IReqoreButtonProps {
|
|
15
11
|
label?: string | number;
|
|
16
|
-
as?: JSX.Element | React.ElementType | never;
|
|
17
12
|
selected?: boolean;
|
|
18
13
|
itemId?: string;
|
|
19
14
|
onRightIconClick?: (itemId?: string, event?: React.MouseEvent<HTMLElement>) => void;
|
|
@@ -93,7 +88,6 @@ const ReqoreMenuItem = forwardRef<HTMLButtonElement, IReqoreMenuItemProps>(
|
|
|
93
88
|
return (
|
|
94
89
|
<ReqoreControlGroup stack={!!onRightIconClick} fluid fill>
|
|
95
90
|
<ReqoreButton
|
|
96
|
-
//@ts-ignore
|
|
97
91
|
as={as}
|
|
98
92
|
{...rest}
|
|
99
93
|
flat={flat}
|
|
@@ -473,12 +473,11 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
473
473
|
return null;
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
-
|
|
476
|
+
const {
|
|
477
477
|
id,
|
|
478
478
|
actions,
|
|
479
479
|
label,
|
|
480
480
|
intent,
|
|
481
|
-
className,
|
|
482
481
|
as: CustomElement,
|
|
483
482
|
props = {},
|
|
484
483
|
group,
|
|
@@ -486,6 +485,8 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
486
485
|
...rest
|
|
487
486
|
}: IReqorePanelAction = action;
|
|
488
487
|
|
|
488
|
+
let { className }: IReqorePanelAction = action;
|
|
489
|
+
|
|
489
490
|
// If the show prop is 'hover', add the hidden class to the action
|
|
490
491
|
className = classNames(className, show === 'hover' ? 'reqore-panel-action-hidden' : '');
|
|
491
492
|
|
|
@@ -31,8 +31,6 @@ const Popover = memo(
|
|
|
31
31
|
}: IReqorePopoverProps) => {
|
|
32
32
|
const [ref, setRef] = useState(undefined);
|
|
33
33
|
|
|
34
|
-
console.log(rest);
|
|
35
|
-
|
|
36
34
|
const popoverData: IPopoverControls = usePopover({ targetElement: ref, ...rest });
|
|
37
35
|
|
|
38
36
|
useEffect(() => {
|
|
@@ -40,7 +38,6 @@ const Popover = memo(
|
|
|
40
38
|
}, [popoverData]);
|
|
41
39
|
|
|
42
40
|
if (isReqoreComponent) {
|
|
43
|
-
console.log(Component);
|
|
44
41
|
return (
|
|
45
42
|
<Component
|
|
46
43
|
{...componentProps}
|
|
@@ -54,9 +51,7 @@ const Popover = memo(
|
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
return (
|
|
57
|
-
// @ts-ignore
|
|
58
54
|
<StyledPopover
|
|
59
|
-
// @ts-ignore
|
|
60
55
|
as={wrapperTag}
|
|
61
56
|
className='reqore-popover-wrapper'
|
|
62
57
|
ref={setRef}
|
|
@@ -38,10 +38,11 @@ const ReqoreRadioGroup = ({
|
|
|
38
38
|
...rest
|
|
39
39
|
}: IReqoreRadioGroupProps) => (
|
|
40
40
|
<ReqoreControlGroup {...rest} vertical={vertical}>
|
|
41
|
-
{items.map(({ value, divider, ...itemRest }) =>
|
|
41
|
+
{items.map(({ value, divider, ...itemRest }, index) =>
|
|
42
42
|
divider ? (
|
|
43
43
|
<ReqoreMenuDivider
|
|
44
44
|
{...itemRest}
|
|
45
|
+
key={index}
|
|
45
46
|
size={size || itemRest.size}
|
|
46
47
|
effect={{ textAlign: 'left', ...itemRest.effect }}
|
|
47
48
|
margin={margin}
|
|
@@ -34,10 +34,10 @@ export interface IQorusSidebarItem {
|
|
|
34
34
|
activePaths?: string[];
|
|
35
35
|
submenu?: IQorusSidebarItem[];
|
|
36
36
|
id: string;
|
|
37
|
-
as?:
|
|
37
|
+
as?: React.ElementType | string;
|
|
38
38
|
icon?: IReqoreIconName;
|
|
39
39
|
exact?: boolean;
|
|
40
|
-
element?:
|
|
40
|
+
element?: React.ElementType;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export interface IQorusSidebarProps {
|
|
@@ -18,8 +18,8 @@ export interface SidebarItemProps {
|
|
|
18
18
|
tooltip?: string;
|
|
19
19
|
children?: any;
|
|
20
20
|
expandedSection?: string;
|
|
21
|
-
onFavoriteClick?:
|
|
22
|
-
onUnfavoriteClick?:
|
|
21
|
+
onFavoriteClick?: (id: string) => void;
|
|
22
|
+
onUnfavoriteClick?: (id: string) => void;
|
|
23
23
|
favoriteItems?: any;
|
|
24
24
|
formatItemName?: (itemName: string) => string;
|
|
25
25
|
currentPath?: string;
|
|
@@ -34,14 +34,14 @@ export interface ISidebarTooltipProps {
|
|
|
34
34
|
isCollapsed?: boolean;
|
|
35
35
|
children: any;
|
|
36
36
|
itemData: IQorusSidebarItem;
|
|
37
|
-
isActive
|
|
38
|
-
isSubcategory
|
|
39
|
-
isSubitem
|
|
40
|
-
onClick
|
|
37
|
+
isActive?: boolean;
|
|
38
|
+
isSubcategory?: boolean;
|
|
39
|
+
isSubitem?: boolean;
|
|
40
|
+
onClick?: any;
|
|
41
41
|
useNativeTitle?: boolean;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const SidebarItemTooltip
|
|
44
|
+
const SidebarItemTooltip = ({
|
|
45
45
|
isCollapsed,
|
|
46
46
|
children,
|
|
47
47
|
itemData,
|
|
@@ -55,7 +55,6 @@ const SidebarItemTooltip: Function = ({
|
|
|
55
55
|
|
|
56
56
|
if (useNativeTitle) {
|
|
57
57
|
return (
|
|
58
|
-
//@ts-ignore
|
|
59
58
|
<Element
|
|
60
59
|
{...itemData.props}
|
|
61
60
|
onClick={(e) => {
|
|
@@ -75,7 +74,6 @@ const SidebarItemTooltip: Function = ({
|
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
return (
|
|
78
|
-
//@ts-ignore
|
|
79
77
|
<ReqorePopover
|
|
80
78
|
component={Element}
|
|
81
79
|
componentProps={{
|
|
@@ -215,7 +213,6 @@ const SidebarItemWrapper = ({
|
|
|
215
213
|
const { element: Element } = itemData;
|
|
216
214
|
|
|
217
215
|
return (
|
|
218
|
-
//@ts-ignore
|
|
219
216
|
<Element
|
|
220
217
|
isCollapsed={isCollapsed}
|
|
221
218
|
backgroundColor={theme.sidebar?.main || theme.main}
|
|
@@ -17,6 +17,8 @@ export interface IReqoreTableSectionBodyProps extends IReqoreTableRowOptions {
|
|
|
17
17
|
};
|
|
18
18
|
type: 'left' | 'right' | 'main';
|
|
19
19
|
onScrollChange?: (isScrolled: boolean) => void;
|
|
20
|
+
setHoveredRow?: (index: number) => void;
|
|
21
|
+
hoveredRow?: number;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
const StyledList = styled(List)`
|
|
@@ -85,7 +87,11 @@ const ReqoreTableBody = forwardRef<HTMLDivElement, IReqoreTableSectionBodyProps>
|
|
|
85
87
|
itemCount={itemCount}
|
|
86
88
|
// If the defined height is less than the count of items' height
|
|
87
89
|
// use that height instead
|
|
88
|
-
height={
|
|
90
|
+
height={
|
|
91
|
+
(!height && height !== 0) || height > itemCount * rowHeight
|
|
92
|
+
? itemCount * rowHeight
|
|
93
|
+
: height
|
|
94
|
+
}
|
|
89
95
|
className='reqore-table-body'
|
|
90
96
|
itemSize={rest.flat ? TABLE_SIZE_TO_PX[size] : TABLE_SIZE_TO_PX[size] + 1}
|
|
91
97
|
itemData={{
|
|
@@ -180,7 +180,7 @@ const StyledTablesWrapper = styled.div`
|
|
|
180
180
|
|
|
181
181
|
const ReqoreTable = ({
|
|
182
182
|
className,
|
|
183
|
-
height
|
|
183
|
+
height,
|
|
184
184
|
width,
|
|
185
185
|
columns,
|
|
186
186
|
data = [],
|
|
@@ -217,6 +217,7 @@ const ReqoreTable = ({
|
|
|
217
217
|
const mainTableRef = useRef<HTMLDivElement>(null);
|
|
218
218
|
const mainHeaderRef = useRef<HTMLDivElement>(null);
|
|
219
219
|
|
|
220
|
+
const [hoveredRow, setHoveredRow] = useState<number>();
|
|
220
221
|
const [isScrolled, setIsScrolled] = useState<boolean>(false);
|
|
221
222
|
const [_data, setData] = useState<IReqoreTableData>(data || []);
|
|
222
223
|
const [_sort, setSort] = useState<IReqoreTableSort | undefined>(fixSort(sort));
|
|
@@ -249,7 +250,7 @@ const ReqoreTable = ({
|
|
|
249
250
|
}, [_selectedQuant]);
|
|
250
251
|
|
|
251
252
|
const finalColumns = useMemo(() => {
|
|
252
|
-
|
|
253
|
+
const fullColumns = [..._internalColumns];
|
|
253
254
|
|
|
254
255
|
if (selectable) {
|
|
255
256
|
fullColumns.unshift({
|
|
@@ -669,6 +670,8 @@ const ReqoreTable = ({
|
|
|
669
670
|
<ReqoreTableBody
|
|
670
671
|
ref={refs[type]}
|
|
671
672
|
refs={refs}
|
|
673
|
+
hoveredRow={hoveredRow}
|
|
674
|
+
setHoveredRow={setHoveredRow}
|
|
672
675
|
type={type}
|
|
673
676
|
data={items}
|
|
674
677
|
columns={tableColumns}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
import { isFunction, isString } from 'lodash';
|
|
3
|
-
import React, { ReactElement
|
|
3
|
+
import React, { ReactElement } from 'react';
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
5
|
import { IReqoreTableColumn, IReqoreTableData, IReqoreTableRowClick } from '.';
|
|
6
6
|
import { ReqoreButton, ReqoreControlGroup } from '../..';
|
|
@@ -28,6 +28,8 @@ export interface IReqoreTableRowOptions {
|
|
|
28
28
|
flat?: boolean;
|
|
29
29
|
cellComponent?: IReqoreCustomTableBodyCell;
|
|
30
30
|
rowComponent?: IReqoreCustomTableRow;
|
|
31
|
+
setHoveredRow?: (index: number) => void;
|
|
32
|
+
hoveredRow?: number;
|
|
31
33
|
}
|
|
32
34
|
export interface IReqoreCustomTableRowProps extends IReqoreTableRowOptions {
|
|
33
35
|
style?: React.CSSProperties;
|
|
@@ -90,11 +92,12 @@ const ReqoreTableRow = ({
|
|
|
90
92
|
flat,
|
|
91
93
|
cellComponent,
|
|
92
94
|
rowComponent,
|
|
95
|
+
setHoveredRow,
|
|
96
|
+
hoveredRow,
|
|
93
97
|
},
|
|
94
98
|
style,
|
|
95
99
|
index,
|
|
96
100
|
}: IReqoreTableRowProps) => {
|
|
97
|
-
const [isHovered, setIsHovered] = useState<boolean>(false);
|
|
98
101
|
const isSelected =
|
|
99
102
|
data[index]._selectId &&
|
|
100
103
|
selected.find((selectId) => selectId.toString() === data[index]._selectId.toString());
|
|
@@ -145,12 +148,12 @@ const ReqoreTableRow = ({
|
|
|
145
148
|
|
|
146
149
|
if (isString(content)) {
|
|
147
150
|
// Separate the content string by colon
|
|
148
|
-
|
|
151
|
+
const [type, intentOrColor] = content.split(':');
|
|
149
152
|
// Check if the intent starts with hash for tags
|
|
150
|
-
|
|
153
|
+
const intent: TReqoreIntent = intentOrColor?.startsWith('#')
|
|
151
154
|
? undefined
|
|
152
155
|
: (intentOrColor as TReqoreIntent);
|
|
153
|
-
|
|
156
|
+
const color: TReqoreHexColor =
|
|
154
157
|
intentOrColor?.startsWith('#') && type === 'tag'
|
|
155
158
|
? (intentOrColor as TReqoreHexColor)
|
|
156
159
|
: undefined;
|
|
@@ -218,7 +221,7 @@ const ReqoreTableRow = ({
|
|
|
218
221
|
flat,
|
|
219
222
|
even: index % 2 === 0 ? true : false,
|
|
220
223
|
intent: cell?.intent || data[index]._intent || intent,
|
|
221
|
-
hovered:
|
|
224
|
+
hovered: hoveredRow === index,
|
|
222
225
|
interactive: !!cell?.onClick || !!onRowClick,
|
|
223
226
|
interactiveCell: !!cell?.onClick,
|
|
224
227
|
onClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
|
@@ -246,15 +249,15 @@ const ReqoreTableRow = ({
|
|
|
246
249
|
<RowComponent
|
|
247
250
|
style={style}
|
|
248
251
|
className='reqore-table-row'
|
|
249
|
-
interactive={!!onRowClick}
|
|
252
|
+
interactive={!!onRowClick && !data[index]._disabled}
|
|
250
253
|
onMouseEnter={() => {
|
|
251
254
|
// Set hovered is this row is interactive
|
|
252
255
|
if (onRowClick || (selectable && data[index]._selectId && !data[index]._disabled)) {
|
|
253
|
-
|
|
256
|
+
setHoveredRow(index);
|
|
254
257
|
}
|
|
255
258
|
}}
|
|
256
259
|
onMouseLeave={() => {
|
|
257
|
-
|
|
260
|
+
setHoveredRow(undefined);
|
|
258
261
|
}}
|
|
259
262
|
>
|
|
260
263
|
{renderCells(columns, data)}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { omit } from 'lodash';
|
|
1
2
|
import { forwardRef, memo } from 'react';
|
|
2
3
|
import styled, { css } from 'styled-components';
|
|
3
4
|
import { IReqoreTabsListItem } from '.';
|
|
@@ -129,7 +130,6 @@ const ReqoreTabsListItem = memo(
|
|
|
129
130
|
className,
|
|
130
131
|
flat = true,
|
|
131
132
|
wrapTabNames,
|
|
132
|
-
id,
|
|
133
133
|
padded,
|
|
134
134
|
...rest
|
|
135
135
|
}: IReqoreTabListItemProps,
|
|
@@ -168,7 +168,7 @@ const ReqoreTabsListItem = memo(
|
|
|
168
168
|
tooltip={tooltip}
|
|
169
169
|
customTheme={theme}
|
|
170
170
|
className={`reqore-tabs-list-item ${active ? 'reqore-tabs-list-item-active' : ''}`}
|
|
171
|
-
{...rest}
|
|
171
|
+
{...omit(rest, ['id'])}
|
|
172
172
|
>
|
|
173
173
|
{label}
|
|
174
174
|
</ReqoreButton>
|
|
@@ -4,11 +4,11 @@ import { useInterval } from 'react-use';
|
|
|
4
4
|
import { getTimeAgoIntervalDelay } from '../../helpers/time';
|
|
5
5
|
|
|
6
6
|
export const TimeAgo = ({ time }: { time: number | string }) => {
|
|
7
|
-
const
|
|
7
|
+
const setUpdate = useState<number>(Date.now());
|
|
8
8
|
const _time = typeof time === 'number' ? time : Date.parse(time);
|
|
9
9
|
|
|
10
10
|
useInterval(() => {
|
|
11
|
-
|
|
11
|
+
setUpdate[1](Date.now());
|
|
12
12
|
}, getTimeAgoIntervalDelay(_time));
|
|
13
13
|
|
|
14
14
|
return timeago(_time);
|
|
@@ -13,7 +13,7 @@ import { getExportActions, getZoomActions, sizeToZoom, zoomToSize } from '../Tab
|
|
|
13
13
|
import ReqoreTag from '../Tag';
|
|
14
14
|
|
|
15
15
|
export interface IReqoreTreeProps extends IReqorePanelProps, IWithReqoreSize {
|
|
16
|
-
data:
|
|
16
|
+
data: Record<string, unknown> | Array<any>;
|
|
17
17
|
mode?: 'tree' | 'copy';
|
|
18
18
|
expanded?: boolean;
|
|
19
19
|
showTypes?: boolean;
|
|
@@ -36,7 +36,6 @@ export const StyledTreeLabel = styled(ReqoreMessage)`
|
|
|
36
36
|
|
|
37
37
|
export const ReqoreTree = ({
|
|
38
38
|
data,
|
|
39
|
-
mode = 'tree',
|
|
40
39
|
size = 'normal',
|
|
41
40
|
expanded,
|
|
42
41
|
showTypes,
|
|
@@ -154,21 +153,6 @@ export const ReqoreTree = ({
|
|
|
154
153
|
});
|
|
155
154
|
};
|
|
156
155
|
|
|
157
|
-
const renderText = (data, tabs = '') => {
|
|
158
|
-
let text = '';
|
|
159
|
-
|
|
160
|
-
Object.keys(data).forEach((key) => {
|
|
161
|
-
if (typeof data[key] !== 'object' || !data[key]) {
|
|
162
|
-
text += `${tabs}${key}: ${data[key]}\r\n`;
|
|
163
|
-
} else {
|
|
164
|
-
text += `${tabs}${key}:\r\n`;
|
|
165
|
-
text += renderText(data[key], `${tabs}\t`);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
return text;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
156
|
const actions = useMemo(() => {
|
|
173
157
|
let _actions: IReqorePanelAction[] = [];
|
|
174
158
|
|
|
@@ -66,7 +66,7 @@ const StyledPortal = styled.div`
|
|
|
66
66
|
`}
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
|
-
const ReqorePortal = forwardRef<HTMLDivElement,
|
|
69
|
+
const ReqorePortal = forwardRef<HTMLDivElement, object>((_props, ref) => {
|
|
70
70
|
return (
|
|
71
71
|
<ReqoreThemeProvider>
|
|
72
72
|
<StyledPortal id='reqore-portal' ref={ref} />
|