Skip to content

Commit d43ba9f

Browse files
authored
Merge pull request #270 from Ferlab-Ste-Justine/feat/SKFP-664/resizable-grid-view
feat(grid): SKFP-664 add a resizable grid view
2 parents c1dcd69 + c0d41a7 commit d43ba9f

File tree

15 files changed

+1315
-4
lines changed

15 files changed

+1315
-4
lines changed

package-lock.json

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ui/package-lock.json

+116-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ui/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ferlab/ui",
3-
"version": "5.5.10",
3+
"version": "6.0.0",
44
"description": "Core components for scientific research data portals",
55
"publishConfig": {
66
"access": "public"
@@ -49,6 +49,7 @@
4949
"@types/lodash": "^4.14.168",
5050
"@types/md5": "^2.3.2",
5151
"@types/react": "^16.9.51",
52+
"@types/react-grid-layout": "^1.3.2",
5253
"@types/react-router-dom": "^5.1.6",
5354
"@types/uuid": "^8.3.0",
5455
"@typescript-eslint/eslint-plugin": "^4.10.0",
@@ -92,6 +93,7 @@
9293
"less2sass": "^1.0.3",
9394
"md5": "^2.3.0",
9495
"query-string": "^7.0.1",
96+
"react-grid-layout": "^1.3.4",
9597
"react-icons": "^4.2.0",
9698
"simplebar-react": "^2.4.3",
9799
"uuid": "^8.3.2",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
.popover {
3+
div[class$="-inner-content"] {
4+
padding: 12px;
5+
}
6+
}
7+
8+
.resetWrapper {
9+
text-align: right;
10+
}
11+
12+
.reset {
13+
padding: 0;
14+
}
15+
16+
.listWrapper {
17+
max-height: 315px;
18+
overflow: auto;
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import React from 'react';
2+
import { SettingOutlined } from '@ant-design/icons';
3+
import { Button, Checkbox, List, Popover, Space, Tooltip } from 'antd';
4+
5+
import styles from './index.module.scss';
6+
7+
type TResizableItem = {
8+
id: string;
9+
label: string;
10+
value: boolean;
11+
};
12+
13+
type TResizableItemSelector = {
14+
items: TResizableItem[];
15+
onReset: () => void;
16+
onChange: (id: string, checkbox: boolean) => void;
17+
dictionary?: {
18+
[p: string]: any;
19+
};
20+
};
21+
22+
const ResizableItemSelector = ({ dictionary, items, onChange, onReset }: TResizableItemSelector): JSX.Element => (
23+
<Popover
24+
align={{ offset: [-9, 0] }}
25+
content={
26+
<Space direction="vertical">
27+
<div className={styles.listWrapper}>
28+
<Space direction="vertical">
29+
{items.map((item) => (
30+
<Checkbox
31+
checked={item.value}
32+
key={item.id}
33+
onChange={(e) => {
34+
onChange(item.id, e.target.checked);
35+
}}
36+
>
37+
{item.label}
38+
</Checkbox>
39+
))}
40+
</Space>
41+
<div className={styles.resetWrapper}>
42+
<Button className={styles.reset} onClick={onReset} size="small" type="link">
43+
{dictionary?.columnSelector?.reset || 'Reset'}
44+
</Button>
45+
</div>
46+
</div>
47+
</Space>
48+
}
49+
overlayClassName={styles.popover}
50+
placement="bottomLeft"
51+
trigger="click"
52+
>
53+
<Tooltip title={dictionary?.columnSelector?.tooltips?.columns || 'Columns'}>
54+
<Button icon={<SettingOutlined />} size="small" type="text"></Button>
55+
</Tooltip>
56+
</Popover>
57+
);
58+
59+
export default ResizableItemSelector;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.wrapper {
2+
width: 100%;
3+
4+
.graphSelector {
5+
width: 100%;
6+
display: flex;
7+
justify-content: flex-end;
8+
margin-top: 2px;
9+
}
10+
}

0 commit comments

Comments
 (0)