datastake-daf 0.6.195 → 0.6.196
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/index.js +179 -295
- package/dist/utils/index.js +3 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Widget/CarouselWidget/index.jsx +1 -4
- package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/index.jsx +77 -79
- package/src/@daf/core/components/Dashboard/Widget/WidgetCard/WidgetCard.stories.js +143 -19
- package/src/@daf/core/components/Dashboard/Widget/WidgetCard/WidgetCardContainer.jsx +79 -0
- package/src/@daf/core/components/Dashboard/Widget/WidgetCard/index.js +68 -28
- package/src/@daf/core/components/Dashboard/Widget/WidgetCard/style.js +24 -1
- package/src/@daf/core/components/Dashboard/Widget/WidgetPlaceholder/WidgetPlaceholder.stories.js +0 -1
- package/src/@daf/core/components/Dashboard/Widget/WidgetPlaceholder/_style.scss +1 -1
- package/src/@daf/core/components/Dashboard/Widget/WidgetPlaceholder/index.jsx +2 -7
- package/src/@daf/core/components/Table/StickyTable/index.jsx +71 -75
- package/src/constants/locales/en/translation.js +1 -0
- package/src/constants/locales/fr/translation.js +1 -0
- package/src/constants/locales/sp/translation.js +1 -0
- package/.env +0 -8
- package/.vscode/settings.json +0 -13
- package/src/@daf/core/components/Dashboard/Widget/ScrollWidget/ScrollWidget.stories.jsx +0 -39
- package/src/@daf/core/components/Dashboard/Widget/ScrollWidget/index.jsx +0 -22
|
@@ -5,94 +5,90 @@ import PropTypes from "prop-types";
|
|
|
5
5
|
import ComponentWithFocus from "../../Dashboard/ComponentWithFocus/index.jsx";
|
|
6
6
|
|
|
7
7
|
export default function StickyTable({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
size = null,
|
|
9
|
+
maxHeight = 300,
|
|
10
|
+
containerHeight = 525,
|
|
11
|
+
dataSource = [],
|
|
12
|
+
columns = {},
|
|
13
|
+
pagination = false,
|
|
14
|
+
doEmptyRows = true,
|
|
15
|
+
...props
|
|
16
16
|
}) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return dataSource;
|
|
20
|
-
}
|
|
17
|
+
const data = React.useMemo(() => {
|
|
18
|
+
const MIN_ROWS = 4;
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
if (dataSource.length < MIN_ROWS) {
|
|
21
|
+
const paddedData = [...dataSource];
|
|
22
|
+
while (paddedData.length < MIN_ROWS) {
|
|
23
|
+
paddedData.push({ empty: true });
|
|
24
|
+
}
|
|
25
|
+
return paddedData;
|
|
26
|
+
}
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
while (paddedData.length < MIN_ROWS) {
|
|
27
|
-
paddedData.push({ empty: true });
|
|
28
|
-
}
|
|
29
|
-
return paddedData;
|
|
30
|
-
}
|
|
28
|
+
return dataSource;
|
|
29
|
+
}, [dataSource]);
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const Wrapper = React.useMemo(() => {
|
|
32
|
+
return data.length > 5 ? ComponentWithFocus : "div";
|
|
33
|
+
}, [data.length]);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
</div>
|
|
62
|
-
</Style>
|
|
63
|
-
</Wrapper>
|
|
64
|
-
);
|
|
35
|
+
return (
|
|
36
|
+
<Wrapper>
|
|
37
|
+
<Style>
|
|
38
|
+
<div
|
|
39
|
+
className="daf-table-wrapper"
|
|
40
|
+
style={{
|
|
41
|
+
maxHeight: containerHeight,
|
|
42
|
+
overflowY: "auto",
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<div className="daf-sticky-table">
|
|
46
|
+
<Table
|
|
47
|
+
{...props}
|
|
48
|
+
size={size}
|
|
49
|
+
scroll
|
|
50
|
+
sticky
|
|
51
|
+
style={{ maxHeight }}
|
|
52
|
+
dataSource={data}
|
|
53
|
+
columns={columns}
|
|
54
|
+
pagination={pagination}
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</Style>
|
|
59
|
+
</Wrapper>
|
|
60
|
+
);
|
|
65
61
|
}
|
|
66
62
|
|
|
67
63
|
const Style = styled.div`
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
max-width: calc(100% - 48px);
|
|
65
|
+
margin-left: var(--size-lg);
|
|
66
|
+
overflow: hidden;
|
|
71
67
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
.daf-table {
|
|
69
|
+
padding: 0px;
|
|
70
|
+
margin-top: 0px;
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
.ant-tag {
|
|
73
|
+
text-align: center;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
80
76
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
.daf-select-filters .filters {
|
|
78
|
+
padding-top: 16px;
|
|
79
|
+
padding-left: 0;
|
|
80
|
+
padding-right: 0;
|
|
81
|
+
}
|
|
86
82
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
.daf-table {
|
|
84
|
+
padding-top: 16px;
|
|
85
|
+
}
|
|
90
86
|
`;
|
|
91
87
|
|
|
92
88
|
StickyTable.propTypes = {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
size: PropTypes.any,
|
|
90
|
+
maxHeight: PropTypes.number,
|
|
91
|
+
dataSource: PropTypes.array,
|
|
92
|
+
columns: PropTypes.object,
|
|
93
|
+
pagination: PropTypes.any,
|
|
98
94
|
};
|
package/.env
DELETED
package/.vscode/settings.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"cSpell.words": ["cukura"],
|
|
3
|
-
"files.autoSave": "afterDelay",
|
|
4
|
-
"editor.wordWrap": "on",
|
|
5
|
-
"editor.autoClosingBrackets": "always",
|
|
6
|
-
"editor.autoClosingComments": "always",
|
|
7
|
-
"editor.autoClosingQuotes": "always",
|
|
8
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
9
|
-
"editor.formatOnPaste": true,
|
|
10
|
-
"editor.formatOnSave": true,
|
|
11
|
-
"notebook.defaultFormatter": "esbenp.prettier-vscode",
|
|
12
|
-
"javascript.format.semicolons": "insert"
|
|
13
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import ScrollWidget from "./index";
|
|
2
|
-
import ThemeLayout from "../../../ThemeLayout";
|
|
3
|
-
import DashboardLayout from "../../DashboardLayout";
|
|
4
|
-
import ProjectWidget from "../ProjectWidget";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: "Dashboard/Widgets/ScrollWidget",
|
|
8
|
-
component: ScrollWidget,
|
|
9
|
-
tags: ["autodocs"],
|
|
10
|
-
decorators: [
|
|
11
|
-
(Story) => (
|
|
12
|
-
<div style={{ margin: "3em" }}>
|
|
13
|
-
<ThemeLayout>
|
|
14
|
-
<Story />
|
|
15
|
-
</ThemeLayout>
|
|
16
|
-
</div>
|
|
17
|
-
),
|
|
18
|
-
],
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const Primary = {
|
|
22
|
-
name: "Scroll Widget",
|
|
23
|
-
args: {
|
|
24
|
-
title: "Scroll Widget Title",
|
|
25
|
-
},
|
|
26
|
-
render: (args) => (
|
|
27
|
-
<DashboardLayout>
|
|
28
|
-
<ScrollWidget {...args}>
|
|
29
|
-
<section className="nowrap">
|
|
30
|
-
<ProjectWidget hideSDGList />
|
|
31
|
-
<ProjectWidget hideSDGList />
|
|
32
|
-
<ProjectWidget hideSDGList />
|
|
33
|
-
<ProjectWidget hideSDGList />
|
|
34
|
-
<ProjectWidget hideSDGList />
|
|
35
|
-
</section>
|
|
36
|
-
</ScrollWidget>
|
|
37
|
-
</DashboardLayout>
|
|
38
|
-
),
|
|
39
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import Widget from "../index.jsx";
|
|
2
|
-
|
|
3
|
-
export default function ScrollWidget({ classname, widgetClassname, children, ...props }) {
|
|
4
|
-
return (
|
|
5
|
-
<Widget className={widgetClassname} {...props}>
|
|
6
|
-
<div
|
|
7
|
-
style={{
|
|
8
|
-
overflowX: "auto",
|
|
9
|
-
overflowY: "hidden",
|
|
10
|
-
width: "100%",
|
|
11
|
-
display: "flex",
|
|
12
|
-
gap: "10px",
|
|
13
|
-
alignItems: "stretch",
|
|
14
|
-
scrollbarWidth: "thin",
|
|
15
|
-
scrollbarColor: "#ccc transparent",
|
|
16
|
-
}}
|
|
17
|
-
>
|
|
18
|
-
{children}
|
|
19
|
-
</div>
|
|
20
|
-
</Widget>
|
|
21
|
-
);
|
|
22
|
-
}
|