@axinom/mosaic-ui 0.66.0-rc.2 → 0.66.0-rc.20
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/dist/components/DynamicDataList/DynamicListHeader/DynamicListHeader.d.ts.map +1 -1
- package/dist/components/Explorer/BulkEdit/FormFieldsConfigConverter.d.ts.map +1 -1
- package/dist/components/FieldSelection/FieldSelection.d.ts.map +1 -1
- package/dist/components/Filters/Filter/Filter.d.ts.map +1 -1
- package/dist/components/Filters/Filters.model.d.ts +5 -0
- package/dist/components/Filters/Filters.model.d.ts.map +1 -1
- package/dist/components/Filters/SelectionTypes/DateTimeFilter/DateTimeFilter.d.ts +2 -0
- package/dist/components/Filters/SelectionTypes/DateTimeFilter/DateTimeFilter.d.ts.map +1 -1
- package/dist/components/Filters/SelectionTypes/FreeTextFilter/FreeTextFilter.d.ts +2 -0
- package/dist/components/Filters/SelectionTypes/FreeTextFilter/FreeTextFilter.d.ts.map +1 -1
- package/dist/components/Filters/SelectionTypes/MultiOptionFilter/MultiOptionFilter.d.ts +2 -0
- package/dist/components/Filters/SelectionTypes/MultiOptionFilter/MultiOptionFilter.d.ts.map +1 -1
- package/dist/components/Filters/SelectionTypes/NumericTextFilter/NumericTextFilter.d.ts +2 -0
- package/dist/components/Filters/SelectionTypes/NumericTextFilter/NumericTextFilter.d.ts.map +1 -1
- package/dist/components/Filters/SelectionTypes/OptionsFilter/OptionsFilter.d.ts +2 -0
- package/dist/components/Filters/SelectionTypes/OptionsFilter/OptionsFilter.d.ts.map +1 -1
- package/dist/components/Filters/SelectionTypes/SearcheableOptionsFilter/SearcheableOptionsFilter.d.ts +2 -0
- package/dist/components/Filters/SelectionTypes/SearcheableOptionsFilter/SearcheableOptionsFilter.d.ts.map +1 -1
- package/dist/components/FormElements/Radio/Radio.d.ts.map +1 -1
- package/dist/components/FormElements/ToggleButton/ToggleButton.d.ts.map +1 -1
- package/dist/components/Hub/Tile/Tile.d.ts.map +1 -1
- package/dist/components/Icons/Icons.d.ts +4 -9
- package/dist/components/Icons/Icons.d.ts.map +1 -1
- package/dist/components/LandingPageTiles/TileLarge/TileLarge.d.ts.map +1 -1
- package/dist/components/LandingPageTiles/TileSmall/TileSmall.d.ts.map +1 -1
- package/dist/components/List/ListCheckBox/ListCheckBox.d.ts.map +1 -1
- package/dist/components/List/ListHeader/ColumnLabel/ColumnLabel.d.ts.map +1 -1
- package/dist/components/List/ListHeader/ListHeader.d.ts.map +1 -1
- package/dist/components/List/ListRow/ListRow.d.ts.map +1 -1
- package/dist/components/List/ListRow/ListRowCell/ListRowCell.d.ts +15 -0
- package/dist/components/List/ListRow/ListRowCell/ListRowCell.d.ts.map +1 -0
- package/dist/components/List/ListRow/ListRowCell/renderData.d.ts +9 -0
- package/dist/components/List/ListRow/ListRowCell/renderData.d.ts.map +1 -0
- package/dist/components/List/ListRow/Renderers/TagsRenderer/TagsRenderer.d.ts.map +1 -1
- package/dist/components/Loaders/ImageLoader/ImageLoader.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts.map +1 -1
- package/dist/components/VisualElements/ImgElement.d.ts +50 -0
- package/dist/components/VisualElements/ImgElement.d.ts.map +1 -0
- package/dist/components/VisualElements/SvgElement.d.ts +14 -0
- package/dist/components/VisualElements/SvgElement.d.ts.map +1 -0
- package/dist/components/VisualElements/index.d.ts +3 -0
- package/dist/components/VisualElements/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/helpers/idleCallbackHelpers.d.ts +42 -0
- package/dist/helpers/idleCallbackHelpers.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/hooks/useResize/ResizeIndicator.d.ts +8 -0
- package/dist/hooks/useResize/ResizeIndicator.d.ts.map +1 -0
- package/dist/hooks/useResize/useResize.d.ts +5 -2
- package/dist/hooks/useResize/useResize.d.ts.map +1 -1
- package/dist/index.es.js +4 -4
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/DynamicDataList/DynamicListHeader/DynamicListHeader.spec.tsx +2 -0
- package/src/components/DynamicDataList/DynamicListHeader/DynamicListHeader.tsx +62 -50
- package/src/components/Explorer/BulkEdit/FormFieldsConfigConverter.tsx +5 -21
- package/src/components/Explorer/Explorer.stories.tsx +17 -0
- package/src/components/FieldSelection/FieldSelection.scss +4 -0
- package/src/components/FieldSelection/FieldSelection.tsx +1 -0
- package/src/components/Filters/Filter/Filter.scss +34 -15
- package/src/components/Filters/Filter/Filter.spec.tsx +1 -1
- package/src/components/Filters/Filter/Filter.tsx +46 -34
- package/src/components/Filters/Filters.model.ts +6 -0
- package/src/components/Filters/SelectionTypes/DateTimeFilter/DateTimeFilter.tsx +6 -1
- package/src/components/Filters/SelectionTypes/FreeTextFilter/FreeTextFilter.tsx +4 -0
- package/src/components/Filters/SelectionTypes/MultiOptionFilter/MultiOptionFilter.tsx +9 -1
- package/src/components/Filters/SelectionTypes/NumericTextFilter/NumericTextFilter.tsx +5 -0
- package/src/components/Filters/SelectionTypes/OptionsFilter/OptionsFilter.scss +6 -10
- package/src/components/Filters/SelectionTypes/OptionsFilter/OptionsFilter.tsx +8 -0
- package/src/components/Filters/SelectionTypes/SearcheableOptionsFilter/SearcheableOptionsFilter.tsx +6 -1
- package/src/components/FormElements/Radio/Radio.tsx +3 -2
- package/src/components/FormElements/Select/Select.scss +11 -6
- package/src/components/FormElements/ToggleButton/ToggleButton.tsx +32 -27
- package/src/components/Hub/Hub.stories.tsx +3 -2
- package/src/components/Hub/Tile/Tile.spec.tsx +7 -2
- package/src/components/Hub/Tile/Tile.tsx +2 -1
- package/src/components/Icons/Icons.scss +1 -0
- package/src/components/Icons/Icons.spec.tsx +90 -41
- package/src/components/Icons/Icons.tsx +357 -765
- package/src/components/InfoTooltip/InfoTooltip.scss +1 -1
- package/src/components/InlineMenu/InlineMenu.scss +1 -1
- package/src/components/LandingPageTiles/LandingPageTiles.stories.tsx +3 -2
- package/src/components/LandingPageTiles/TileLarge/TileLarge.spec.tsx +5 -1
- package/src/components/LandingPageTiles/TileLarge/TileLarge.tsx +2 -1
- package/src/components/LandingPageTiles/TileSmall/TileSmall.spec.tsx +7 -2
- package/src/components/LandingPageTiles/TileSmall/TileSmall.tsx +2 -1
- package/src/components/List/ListCheckBox/ListCheckBox.tsx +1 -0
- package/src/components/List/ListHeader/ColumnLabel/ColumnLabel.spec.tsx +6 -6
- package/src/components/List/ListHeader/ColumnLabel/ColumnLabel.tsx +10 -13
- package/src/components/List/ListHeader/ListHeader.scss +0 -1
- package/src/components/List/ListHeader/ListHeader.spec.tsx +2 -0
- package/src/components/List/ListHeader/ListHeader.tsx +57 -51
- package/src/components/List/ListRow/ListRow.scss +0 -27
- package/src/components/List/ListRow/ListRow.spec.tsx +10 -8
- package/src/components/List/ListRow/ListRow.tsx +20 -152
- package/src/components/List/ListRow/ListRowCell/ListRowCell.scss +26 -0
- package/src/components/List/ListRow/ListRowCell/ListRowCell.spec.tsx +491 -0
- package/src/components/List/ListRow/ListRowCell/ListRowCell.tsx +57 -0
- package/src/components/List/ListRow/ListRowCell/renderData.tsx +124 -0
- package/src/components/List/ListRow/Renderers/TagsRenderer/TagsRenderer.scss +2 -1
- package/src/components/List/ListRow/Renderers/TagsRenderer/TagsRenderer.spec.tsx +187 -104
- package/src/components/List/ListRow/Renderers/TagsRenderer/TagsRenderer.tsx +134 -80
- package/src/components/Loaders/ImageLoader/ImageLoader.spec.tsx +13 -14
- package/src/components/Loaders/ImageLoader/ImageLoader.tsx +5 -3
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.tsx +13 -2
- package/src/components/Utils/Postgraphile/CreateConnectionRenderer.spec.ts +22 -75
- package/src/components/VisualElements/ImgElement.spec.tsx +92 -0
- package/src/components/VisualElements/ImgElement.tsx +72 -0
- package/src/components/VisualElements/SvgElement.spec.tsx +160 -0
- package/src/components/VisualElements/SvgElement.tsx +40 -0
- package/src/components/VisualElements/index.ts +7 -0
- package/src/components/index.ts +1 -0
- package/src/helpers/idleCallbackHelpers.ts +66 -0
- package/src/helpers/index.ts +5 -0
- package/src/hooks/useResize/ResizeIndicator.scss +7 -0
- package/src/hooks/useResize/ResizeIndicator.tsx +39 -0
- package/src/hooks/useResize/{useResize.ts → useResize.tsx} +38 -6
- package/src/styles/variables.scss +7 -6
|
@@ -2,6 +2,7 @@ import { Meta, StoryObj } from '@storybook/react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { MemoryRouter } from 'react-router-dom';
|
|
4
4
|
import { createGroups, getRandomInt } from '../../helpers/storybook';
|
|
5
|
+
import { SvgElement } from '../VisualElements/SvgElement';
|
|
5
6
|
import { LandingPageTiles } from './LandingPageTiles';
|
|
6
7
|
import { LandingPageItem } from './LandingPageTiles.model';
|
|
7
8
|
|
|
@@ -15,7 +16,7 @@ const defaultContainer = {
|
|
|
15
16
|
|
|
16
17
|
const DefaultIcon: React.FC = () => {
|
|
17
18
|
return (
|
|
18
|
-
<
|
|
19
|
+
<SvgElement viewBox="0 0 40 40">
|
|
19
20
|
<path
|
|
20
21
|
vectorEffect="non-scaling-stroke"
|
|
21
22
|
fill="none"
|
|
@@ -23,7 +24,7 @@ const DefaultIcon: React.FC = () => {
|
|
|
23
24
|
d="M39,39H1V1h38V39z M39.1,26l-8.4-8.7l-9.1,11.5
|
|
24
25
|
l-6.4-5.4L3.6,39.1 M12.8,7.8c-2.4,0-4.4,2-4.4,4.4s2,4.4,4.4,4.4s4.4-2,4.4-4.4S15.3,7.8,12.8,7.8z"
|
|
25
26
|
/>
|
|
26
|
-
</
|
|
27
|
+
</SvgElement>
|
|
27
28
|
);
|
|
28
29
|
};
|
|
29
30
|
|
|
@@ -84,7 +84,11 @@ describe('TileLarge', () => {
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
it('renders an icon when passed as a string URL', () => {
|
|
87
|
-
const wrapper =
|
|
87
|
+
const wrapper = mount(
|
|
88
|
+
<MemoryRouter>
|
|
89
|
+
<TileLarge {...mockProps} />
|
|
90
|
+
</MemoryRouter>,
|
|
91
|
+
);
|
|
88
92
|
const iconUrl = wrapper.find('img').prop('src');
|
|
89
93
|
|
|
90
94
|
expect(iconUrl).toBe(`${mockProps.icon}`);
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { Link } from 'react-router-dom';
|
|
4
4
|
import { useValueOrOnDemand } from '../../../hooks/useValueOrOnDemand/useValueOrOnDemand';
|
|
5
5
|
import { Loader } from '../../Loaders/Loader/Loader';
|
|
6
|
+
import { ImgElement } from '../../VisualElements';
|
|
6
7
|
import { LandingPageItem } from '../LandingPageTiles.model';
|
|
7
8
|
import classes from './TileLarge.scss';
|
|
8
9
|
|
|
@@ -56,7 +57,7 @@ export const TileLarge: React.FC<TileLargeProps> = ({
|
|
|
56
57
|
{React.isValidElement(icon)
|
|
57
58
|
? icon
|
|
58
59
|
: typeof icon === 'string' && (
|
|
59
|
-
<
|
|
60
|
+
<ImgElement src={icon} decorative={true} />
|
|
60
61
|
)}
|
|
61
62
|
</div>
|
|
62
63
|
<div className={classes.titlesSection}>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { shallow } from 'enzyme';
|
|
1
|
+
import { mount, shallow } from 'enzyme';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { MemoryRouter } from 'react-router';
|
|
3
4
|
import { TileSmall, TileSmallProps } from './TileSmall';
|
|
4
5
|
|
|
5
6
|
const mockProps: TileSmallProps = {
|
|
@@ -31,7 +32,11 @@ describe('TileSmall', () => {
|
|
|
31
32
|
});
|
|
32
33
|
|
|
33
34
|
it('renders an icon when passed a string URL', () => {
|
|
34
|
-
const wrapper =
|
|
35
|
+
const wrapper = mount(
|
|
36
|
+
<MemoryRouter>
|
|
37
|
+
<TileSmall {...mockProps} />
|
|
38
|
+
</MemoryRouter>,
|
|
39
|
+
);
|
|
35
40
|
const iconUrl = wrapper.find('img').prop('src');
|
|
36
41
|
|
|
37
42
|
expect(iconUrl).toBe(`${mockProps.icon}`);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Link } from 'react-router-dom';
|
|
4
|
+
import { ImgElement } from '../../VisualElements';
|
|
4
5
|
import { LandingPageItem } from '../LandingPageTiles.model';
|
|
5
6
|
import classes from './TileSmall.scss';
|
|
6
7
|
|
|
@@ -50,7 +51,7 @@ export const TileSmall: React.FC<TileSmallProps> = ({
|
|
|
50
51
|
{React.isValidElement(icon)
|
|
51
52
|
? icon
|
|
52
53
|
: typeof icon === 'string' && (
|
|
53
|
-
<
|
|
54
|
+
<ImgElement src={icon} decorative={true} />
|
|
54
55
|
)}
|
|
55
56
|
</div>
|
|
56
57
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallow } from 'enzyme';
|
|
1
|
+
import { mount, shallow } from 'enzyme';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SortData } from '../../List.model';
|
|
4
4
|
import { ColumnLabel } from './ColumnLabel';
|
|
@@ -37,7 +37,7 @@ describe('ColumnLabel', () => {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
it('renders the directional arrows by default', () => {
|
|
40
|
-
const wrapper =
|
|
40
|
+
const wrapper = mount(<ColumnLabel propertyName="test-prop" />);
|
|
41
41
|
|
|
42
42
|
const dirArrows = wrapper.find('svg');
|
|
43
43
|
const clickWrapper = wrapper.find('.clickWrapper');
|
|
@@ -77,7 +77,7 @@ describe('ColumnLabel', () => {
|
|
|
77
77
|
);
|
|
78
78
|
|
|
79
79
|
const columnTitle = wrapper.find('.clickWrapper');
|
|
80
|
-
columnTitle.simulate('click');
|
|
80
|
+
columnTitle.simulate('click', { stopPropagation: jest.fn() });
|
|
81
81
|
|
|
82
82
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
83
83
|
expect(spy).toHaveBeenCalledWith({
|
|
@@ -102,7 +102,7 @@ describe('ColumnLabel', () => {
|
|
|
102
102
|
);
|
|
103
103
|
|
|
104
104
|
const columnTitle = wrapper.find('.clickWrapper');
|
|
105
|
-
columnTitle.simulate('click');
|
|
105
|
+
columnTitle.simulate('click', { stopPropagation: jest.fn() });
|
|
106
106
|
|
|
107
107
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
108
108
|
expect(spy).toHaveBeenCalledWith({
|
|
@@ -126,7 +126,7 @@ describe('ColumnLabel', () => {
|
|
|
126
126
|
);
|
|
127
127
|
|
|
128
128
|
const columnTitle = wrapper.find('.clickWrapper');
|
|
129
|
-
columnTitle.simulate('click');
|
|
129
|
+
columnTitle.simulate('click', { stopPropagation: jest.fn() });
|
|
130
130
|
|
|
131
131
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
132
132
|
expect(spy).toHaveBeenCalledWith({
|
|
@@ -150,7 +150,7 @@ describe('ColumnLabel', () => {
|
|
|
150
150
|
);
|
|
151
151
|
|
|
152
152
|
const columnTitle = wrapper.find('.clickWrapper');
|
|
153
|
-
columnTitle.simulate('click');
|
|
153
|
+
columnTitle.simulate('click', { stopPropagation: jest.fn() });
|
|
154
154
|
|
|
155
155
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
156
156
|
expect(spy).toHaveBeenCalledWith({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React, { PropsWithChildren } from 'react';
|
|
3
3
|
import { noop } from '../../../../helpers/utils';
|
|
4
|
+
import { SvgElement } from '../../../VisualElements/SvgElement';
|
|
4
5
|
import { ColumnSortKeys, SortData } from '../../List.model';
|
|
5
6
|
import classes from './ColumnLabel.scss';
|
|
6
7
|
|
|
@@ -64,7 +65,11 @@ export const ColumnLabel = <T,>({
|
|
|
64
65
|
<div
|
|
65
66
|
className={clsx(classes.clickWrapper, classes.sortable)}
|
|
66
67
|
onClick={
|
|
67
|
-
propertyName &&
|
|
68
|
+
propertyName &&
|
|
69
|
+
((e) => {
|
|
70
|
+
onSortChanged(getSortDir(propertyName));
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
})
|
|
68
73
|
}
|
|
69
74
|
data-test-id={`list-label:${String(propertyName)}`}
|
|
70
75
|
data-test-sort-dir={direction ?? 'none'}
|
|
@@ -73,26 +78,18 @@ export const ColumnLabel = <T,>({
|
|
|
73
78
|
{label ?? propertyName}
|
|
74
79
|
</span>
|
|
75
80
|
<div className={classes.arrows}>
|
|
76
|
-
<
|
|
77
|
-
version="1.1"
|
|
78
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
79
|
-
viewBox="0 0 13 10"
|
|
80
|
-
>
|
|
81
|
+
<SvgElement viewBox="0 0 13 10">
|
|
81
82
|
<path
|
|
82
83
|
className={clsx({ [classes.sorted]: direction === 'asc' })}
|
|
83
84
|
d="M1.5,7.3l4.8-5.7l5.2,5.7"
|
|
84
85
|
></path>
|
|
85
|
-
</
|
|
86
|
-
<
|
|
87
|
-
version="1.1"
|
|
88
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
89
|
-
viewBox="0 0 13 10"
|
|
90
|
-
>
|
|
86
|
+
</SvgElement>
|
|
87
|
+
<SvgElement viewBox="0 0 13 10">
|
|
91
88
|
<path
|
|
92
89
|
className={clsx({ [classes.sorted]: direction === 'desc' })}
|
|
93
90
|
d="M11.5,2.8L6.7,8.5L1.5,2.8"
|
|
94
91
|
></path>
|
|
95
|
-
</
|
|
92
|
+
</SvgElement>
|
|
96
93
|
</div>
|
|
97
94
|
</div>
|
|
98
95
|
</div>
|
|
@@ -85,60 +85,66 @@ export const ListHeader = <T extends Data>({
|
|
|
85
85
|
alignItems: verticalTextAlign,
|
|
86
86
|
} as React.CSSProperties;
|
|
87
87
|
|
|
88
|
-
const { cols, mouseDown } = useResize(
|
|
88
|
+
const { cols, mouseDown, ResizeIndicator } = useResize(
|
|
89
|
+
columns,
|
|
90
|
+
onColumnSizesChanged,
|
|
91
|
+
);
|
|
89
92
|
|
|
90
93
|
return (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
ref={cols[i].ref}
|
|
100
|
-
className={clsx(classes.columnLabel)}
|
|
101
|
-
>
|
|
102
|
-
<ColumnLabel<T>
|
|
103
|
-
propertyName={column.propertyName}
|
|
104
|
-
label={column.label ?? (column.propertyName as string)}
|
|
105
|
-
sortable={column.sortable}
|
|
106
|
-
columnSortKeys={column?.columnSortKeys}
|
|
107
|
-
sortData={sortData}
|
|
108
|
-
onSortChanged={onSortChanged}
|
|
109
|
-
/>
|
|
94
|
+
<>
|
|
95
|
+
{ResizeIndicator}
|
|
96
|
+
<div
|
|
97
|
+
className={clsx(classes.container, 'list-header-container', className)}
|
|
98
|
+
style={customStyles}
|
|
99
|
+
data-test-id="list-header"
|
|
100
|
+
>
|
|
101
|
+
{columns.map((column, i) => (
|
|
110
102
|
<div
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
isDisabled={isCheckboxDisabled}
|
|
137
|
-
onCheckBoxToggled={onCheckboxToggled}
|
|
103
|
+
key={column.key ?? (column.propertyName as string)}
|
|
104
|
+
ref={cols[i].ref}
|
|
105
|
+
className={clsx(classes.columnLabel)}
|
|
106
|
+
>
|
|
107
|
+
<ColumnLabel<T>
|
|
108
|
+
propertyName={column.propertyName}
|
|
109
|
+
label={column.label ?? (column.propertyName as string)}
|
|
110
|
+
sortable={column.sortable}
|
|
111
|
+
columnSortKeys={column?.columnSortKeys}
|
|
112
|
+
sortData={sortData}
|
|
113
|
+
onSortChanged={onSortChanged}
|
|
114
|
+
/>
|
|
115
|
+
<div
|
|
116
|
+
onMouseDown={
|
|
117
|
+
!column.disableResizing
|
|
118
|
+
? (e) => {
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
mouseDown(i);
|
|
121
|
+
}
|
|
122
|
+
: undefined
|
|
123
|
+
}
|
|
124
|
+
onDoubleClick={() => onResetColumnSizes()}
|
|
125
|
+
className={clsx(classes.resizeHandle, {
|
|
126
|
+
[classes.resizeHandleDisabled]: column.disableResizing,
|
|
127
|
+
})}
|
|
138
128
|
/>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
129
|
+
</div>
|
|
130
|
+
))}
|
|
131
|
+
{hasActionColumn && (
|
|
132
|
+
<div
|
|
133
|
+
ref={cols[cols.length - 1].ref}
|
|
134
|
+
className={clsx(classes.columnLabel)}
|
|
135
|
+
>
|
|
136
|
+
{showItemCheckbox && (
|
|
137
|
+
<ListCheckBox
|
|
138
|
+
height={actionSize}
|
|
139
|
+
width={actionSize}
|
|
140
|
+
isChecked={itemSelected}
|
|
141
|
+
isDisabled={isCheckboxDisabled}
|
|
142
|
+
onCheckBoxToggled={onCheckboxToggled}
|
|
143
|
+
/>
|
|
144
|
+
)}
|
|
145
|
+
</div>
|
|
146
|
+
)}
|
|
147
|
+
</div>
|
|
148
|
+
</>
|
|
143
149
|
);
|
|
144
150
|
};
|
|
@@ -32,33 +32,6 @@
|
|
|
32
32
|
color: var(--disabled-text-color, $gray);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
.cellWrapper {
|
|
36
|
-
display: grid;
|
|
37
|
-
width: 100%;
|
|
38
|
-
height: 100%;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.cell {
|
|
42
|
-
max-width: 100%;
|
|
43
|
-
max-height: 100%;
|
|
44
|
-
|
|
45
|
-
span {
|
|
46
|
-
padding: 5px 0;
|
|
47
|
-
display: block;
|
|
48
|
-
width: 100%;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&.nowrap {
|
|
52
|
-
overflow: hidden;
|
|
53
|
-
|
|
54
|
-
span {
|
|
55
|
-
white-space: nowrap;
|
|
56
|
-
text-overflow: ellipsis;
|
|
57
|
-
overflow: hidden;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
35
|
.actions {
|
|
63
36
|
display: grid;
|
|
64
37
|
grid-template-rows: 1fr;
|
|
@@ -47,7 +47,7 @@ describe('ListRow', () => {
|
|
|
47
47
|
`(
|
|
48
48
|
'renders the defined columns in the defined order -> $name',
|
|
49
49
|
({ expectedColumns }: { expectedColumns: Column<TestExplorerData>[] }) => {
|
|
50
|
-
const wrapper =
|
|
50
|
+
const wrapper = mount(
|
|
51
51
|
<ListRow {...mockProps} columns={expectedColumns} />,
|
|
52
52
|
);
|
|
53
53
|
|
|
@@ -74,7 +74,7 @@ describe('ListRow', () => {
|
|
|
74
74
|
|
|
75
75
|
setLocale('en-US');
|
|
76
76
|
|
|
77
|
-
const wrapper =
|
|
77
|
+
const wrapper = mount(
|
|
78
78
|
<ListRow
|
|
79
79
|
data={rowData}
|
|
80
80
|
columns={expectedColumns}
|
|
@@ -115,7 +115,7 @@ describe('ListRow', () => {
|
|
|
115
115
|
];
|
|
116
116
|
const rowData = { value: 'something' };
|
|
117
117
|
|
|
118
|
-
const wrapper =
|
|
118
|
+
const wrapper = mount(
|
|
119
119
|
// @ts-expect-error Typings to not match up
|
|
120
120
|
<ListRow {...mockProps} data={rowData} columns={expectedColumns} />,
|
|
121
121
|
);
|
|
@@ -129,9 +129,7 @@ describe('ListRow', () => {
|
|
|
129
129
|
{ propertyName: "doesn't exist", size: '1fr', label: 'desc' },
|
|
130
130
|
];
|
|
131
131
|
|
|
132
|
-
const wrapper =
|
|
133
|
-
<ListRow {...mockProps} columns={expectedColumns} />,
|
|
134
|
-
);
|
|
132
|
+
const wrapper = mount(<ListRow {...mockProps} columns={expectedColumns} />);
|
|
135
133
|
|
|
136
134
|
const actualColumns = wrapper.find('.cellWrapper');
|
|
137
135
|
|
|
@@ -488,12 +486,16 @@ describe('ListRow', () => {
|
|
|
488
486
|
];
|
|
489
487
|
const rowData = { value: mockValue };
|
|
490
488
|
|
|
491
|
-
const wrapper =
|
|
489
|
+
const wrapper = mount(
|
|
492
490
|
// @ts-expect-error Typings to not match up
|
|
493
491
|
<ListRow {...mockProps} data={rowData} columns={expectedColumns} />,
|
|
494
492
|
);
|
|
495
493
|
|
|
496
|
-
|
|
494
|
+
// When a custom renderer returns a string, it's wrapped in a span with data-test-id
|
|
495
|
+
const span = wrapper
|
|
496
|
+
.find('span[data-test-id="list-entry-property:value"]')
|
|
497
|
+
.first();
|
|
498
|
+
const cell = span.closest('.cell');
|
|
497
499
|
|
|
498
500
|
expect(cell.prop('title')).toBe(mockValue);
|
|
499
501
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import { LocationDescriptor } from 'history';
|
|
3
|
-
import React, { PropsWithChildren, useCallback } from 'react';
|
|
3
|
+
import React, { PropsWithChildren, useCallback, useMemo } from 'react';
|
|
4
4
|
import { Link } from 'react-router-dom';
|
|
5
5
|
import { noop } from '../../../helpers/utils';
|
|
6
6
|
import { Data } from '../../../types/data';
|
|
7
|
-
import { getTooltipText } from '../../../utils/ToolTipHelpers';
|
|
8
7
|
import { ActionData } from '../../Actions/Actions.models';
|
|
9
8
|
import { Button } from '../../Buttons';
|
|
10
9
|
import { IconName } from '../../Icons';
|
|
@@ -12,6 +11,7 @@ import { InlineMenu } from '../../InlineMenu/InlineMenu';
|
|
|
12
11
|
import { Column, ListSelectMode } from '../List.model';
|
|
13
12
|
import { ListCheckBox } from '../ListCheckBox/ListCheckBox';
|
|
14
13
|
import classes from './ListRow.scss';
|
|
14
|
+
import { ListRowCell } from './ListRowCell/ListRowCell';
|
|
15
15
|
|
|
16
16
|
export interface ListRowProps<T extends Data> {
|
|
17
17
|
/** Spacing between columns */
|
|
@@ -76,124 +76,6 @@ export const setLocale = (locale: string): void => {
|
|
|
76
76
|
|
|
77
77
|
setLocale(navigator.language);
|
|
78
78
|
|
|
79
|
-
const renderData = <T extends Data>(
|
|
80
|
-
column: Column<T>,
|
|
81
|
-
rowData: T,
|
|
82
|
-
): {
|
|
83
|
-
columnData: React.ReactNode;
|
|
84
|
-
tooltip: string | undefined;
|
|
85
|
-
isDataTestIdSet: boolean;
|
|
86
|
-
} => {
|
|
87
|
-
const getTooltip = (value: unknown): string | undefined =>
|
|
88
|
-
column.tooltip !== false ? getTooltipText(value) : undefined;
|
|
89
|
-
|
|
90
|
-
if (!column.propertyName) {
|
|
91
|
-
const columnData = column.render?.(undefined, rowData);
|
|
92
|
-
|
|
93
|
-
if (typeof columnData === 'string') {
|
|
94
|
-
return {
|
|
95
|
-
columnData: (
|
|
96
|
-
<span
|
|
97
|
-
data-test-id={`list-entry-property:${
|
|
98
|
-
column.propertyName as string
|
|
99
|
-
}`}
|
|
100
|
-
>
|
|
101
|
-
{columnData}
|
|
102
|
-
</span>
|
|
103
|
-
),
|
|
104
|
-
isDataTestIdSet: true,
|
|
105
|
-
tooltip: getTooltip(columnData),
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return {
|
|
110
|
-
columnData,
|
|
111
|
-
tooltip: getTooltip(columnData),
|
|
112
|
-
isDataTestIdSet: false,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
const value: unknown = rowData[column.propertyName];
|
|
116
|
-
if (column.render) {
|
|
117
|
-
const columnData = column.render(value, rowData);
|
|
118
|
-
|
|
119
|
-
if (typeof columnData === 'string') {
|
|
120
|
-
return {
|
|
121
|
-
columnData: (
|
|
122
|
-
<span
|
|
123
|
-
data-test-id={`list-entry-property:${
|
|
124
|
-
column.propertyName as string
|
|
125
|
-
}`}
|
|
126
|
-
>
|
|
127
|
-
{columnData}
|
|
128
|
-
</span>
|
|
129
|
-
),
|
|
130
|
-
isDataTestIdSet: true,
|
|
131
|
-
tooltip: getTooltip(columnData),
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return {
|
|
136
|
-
columnData,
|
|
137
|
-
tooltip: getTooltip(columnData),
|
|
138
|
-
isDataTestIdSet: false,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (value === null || value === undefined) {
|
|
143
|
-
return {
|
|
144
|
-
columnData: (
|
|
145
|
-
<span
|
|
146
|
-
data-test-id={`list-entry-property:${column.propertyName as string}`}
|
|
147
|
-
/>
|
|
148
|
-
),
|
|
149
|
-
tooltip: undefined,
|
|
150
|
-
isDataTestIdSet: true,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (typeof value === 'number') {
|
|
155
|
-
const columnData = numberFormatter.format(value);
|
|
156
|
-
return {
|
|
157
|
-
columnData: (
|
|
158
|
-
<span
|
|
159
|
-
data-test-id={`list-entry-property:${column.propertyName as string}`}
|
|
160
|
-
>
|
|
161
|
-
{columnData}
|
|
162
|
-
</span>
|
|
163
|
-
),
|
|
164
|
-
tooltip: getTooltip(columnData),
|
|
165
|
-
isDataTestIdSet: true,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (value instanceof Date) {
|
|
170
|
-
const columnData = dateFormatter.format(value);
|
|
171
|
-
return {
|
|
172
|
-
columnData: (
|
|
173
|
-
<span
|
|
174
|
-
data-test-id={`list-entry-property:${column.propertyName as string}`}
|
|
175
|
-
>
|
|
176
|
-
{columnData}
|
|
177
|
-
</span>
|
|
178
|
-
),
|
|
179
|
-
tooltip: getTooltip(columnData),
|
|
180
|
-
isDataTestIdSet: true,
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return {
|
|
185
|
-
columnData: (
|
|
186
|
-
<span
|
|
187
|
-
data-test-id={`list-entry-property:${column.propertyName as string}`}
|
|
188
|
-
>
|
|
189
|
-
{String(value)}
|
|
190
|
-
</span>
|
|
191
|
-
),
|
|
192
|
-
tooltip: getTooltip(String(value)),
|
|
193
|
-
isDataTestIdSet: true,
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
|
|
197
79
|
/**
|
|
198
80
|
* Renders the rows for the list component
|
|
199
81
|
* @example
|
|
@@ -260,42 +142,28 @@ const ListRowComponent = <T extends Data>(
|
|
|
260
142
|
selectionMode === ListSelectMode.None &&
|
|
261
143
|
typeof onItemClicked !== 'function';
|
|
262
144
|
|
|
263
|
-
const generateCells
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
alignSelf: verticalTextAlign, // Vertical alignment based on props
|
|
280
|
-
textAlign: horizontalTextAlign, // Additional text alignment inside the cell
|
|
281
|
-
}}
|
|
282
|
-
data-test-id={
|
|
283
|
-
isDataTestIdSet
|
|
284
|
-
? null
|
|
285
|
-
: `list-entry-property:${column.propertyName as string}`
|
|
286
|
-
}
|
|
287
|
-
>
|
|
288
|
-
{columnData}
|
|
289
|
-
</div>
|
|
290
|
-
</div>
|
|
291
|
-
);
|
|
292
|
-
});
|
|
145
|
+
const generateCells = useMemo(() => {
|
|
146
|
+
return columns.map((column: Column<T>) => {
|
|
147
|
+
return (
|
|
148
|
+
<ListRowCell<T>
|
|
149
|
+
key={column.key ?? (column.propertyName as string)}
|
|
150
|
+
column={column}
|
|
151
|
+
data={data}
|
|
152
|
+
horizontalTextAlign={horizontalTextAlign}
|
|
153
|
+
verticalTextAlign={verticalTextAlign}
|
|
154
|
+
textWrap={textWrap}
|
|
155
|
+
dateFormatter={dateFormatter}
|
|
156
|
+
numberFormatter={numberFormatter}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
});
|
|
160
|
+
}, [columns, data, horizontalTextAlign, textWrap, verticalTextAlign]);
|
|
293
161
|
|
|
294
162
|
const inlineActionMenuData = inlineMenuActions
|
|
295
163
|
? inlineMenuActions(data)
|
|
296
164
|
: undefined;
|
|
297
165
|
|
|
298
|
-
|
|
166
|
+
return (
|
|
299
167
|
<div
|
|
300
168
|
className={clsx(classes.columnsRoot, {
|
|
301
169
|
[classes.selected]: itemSelected,
|
|
@@ -382,7 +250,7 @@ const ListRowComponent = <T extends Data>(
|
|
|
382
250
|
</div>
|
|
383
251
|
);
|
|
384
252
|
|
|
385
|
-
return Row;
|
|
253
|
+
// return Row;
|
|
386
254
|
};
|
|
387
255
|
|
|
388
256
|
export const ListRow = React.forwardRef(ListRowComponent) as <T extends Data>(
|