datastake-daf 0.6.190 → 0.6.192
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/.env +8 -0
- package/.vscode/settings.json +13 -0
- package/dist/components/index.js +30 -43
- package/dist/utils/index.js +0 -3
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Widget/CarouselWidget/index.jsx +4 -1
- package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/index.jsx +78 -77
- package/src/@daf/core/components/Dashboard/Widget/ScrollWidget/ScrollWidget.stories.jsx +39 -0
- package/src/@daf/core/components/Dashboard/Widget/ScrollWidget/index.jsx +22 -0
- package/src/@daf/core/components/Dashboard/Widget/WidgetCard/WidgetCard.stories.js +1 -6
- package/src/@daf/core/components/Dashboard/Widget/WidgetCard/index.js +29 -40
- package/src/@daf/core/components/Dashboard/Widget/WidgetCard/style.js +0 -11
- package/src/@daf/core/components/Table/StickyTable/index.jsx +75 -71
- package/src/constants/locales/en/translation.js +0 -1
- package/src/constants/locales/fr/translation.js +0 -1
- package/src/constants/locales/sp/translation.js +0 -1
package/.env
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|
package/dist/components/index.js
CHANGED
|
@@ -11067,7 +11067,7 @@ var _templateObject$c;
|
|
|
11067
11067
|
const _excluded$s = ["size", "maxHeight", "containerHeight", "dataSource", "columns", "pagination", "doEmptyRows"];
|
|
11068
11068
|
function StickyTable(_ref) {
|
|
11069
11069
|
let {
|
|
11070
|
-
size =
|
|
11070
|
+
size = "small",
|
|
11071
11071
|
maxHeight = 300,
|
|
11072
11072
|
containerHeight = 525,
|
|
11073
11073
|
dataSource = [],
|
|
@@ -11077,6 +11077,9 @@ function StickyTable(_ref) {
|
|
|
11077
11077
|
} = _ref,
|
|
11078
11078
|
props = _objectWithoutProperties(_ref, _excluded$s);
|
|
11079
11079
|
const data = React__default["default"].useMemo(() => {
|
|
11080
|
+
if (!doEmptyRows) {
|
|
11081
|
+
return dataSource;
|
|
11082
|
+
}
|
|
11080
11083
|
const MIN_ROWS = 4;
|
|
11081
11084
|
if (dataSource.length < MIN_ROWS) {
|
|
11082
11085
|
const paddedData = [...dataSource];
|
|
@@ -11088,7 +11091,7 @@ function StickyTable(_ref) {
|
|
|
11088
11091
|
return paddedData;
|
|
11089
11092
|
}
|
|
11090
11093
|
return dataSource;
|
|
11091
|
-
}, [dataSource]);
|
|
11094
|
+
}, [dataSource, doEmptyRows]);
|
|
11092
11095
|
const Wrapper = React__default["default"].useMemo(() => {
|
|
11093
11096
|
return data.length > 5 ? ComponentWithFocus : "div";
|
|
11094
11097
|
}, [data.length]);
|
|
@@ -11118,7 +11121,7 @@ function StickyTable(_ref) {
|
|
|
11118
11121
|
})
|
|
11119
11122
|
});
|
|
11120
11123
|
}
|
|
11121
|
-
const Style$I = dt.div(_templateObject$c || (_templateObject$c = _taggedTemplateLiteral(["\n
|
|
11124
|
+
const Style$I = dt.div(_templateObject$c || (_templateObject$c = _taggedTemplateLiteral(["\n\tmax-width: calc(100% - 48px);\n\tmargin-left: var(--size-lg);\n\toverflow: hidden;\n\n\t.daf-table {\n\t\tpadding: 0px;\n\t\tmargin-top: 0px;\n\n\t\t.ant-tag {\n\t\t\ttext-align: center;\n\t\t}\n\t}\n\n\t.daf-select-filters .filters {\n\t\tpadding-top: 16px;\n\t\tpadding-left: 0;\n\t\tpadding-right: 0;\n\t}\n\n\t.daf-table {\n\t\tpadding-top: 16px;\n\t}\n"])));
|
|
11122
11125
|
StickyTable.propTypes = {
|
|
11123
11126
|
size: PropTypes__default["default"].any,
|
|
11124
11127
|
maxHeight: PropTypes__default["default"].number,
|
|
@@ -14002,9 +14005,8 @@ const determineHasChildren = ({
|
|
|
14002
14005
|
|
|
14003
14006
|
const sortByPosition = (items, getConfig) => {
|
|
14004
14007
|
return items.sort((a, b) => {
|
|
14005
|
-
|
|
14006
|
-
const
|
|
14007
|
-
const positionB = ((_getConfig2 = getConfig(b)) === null || _getConfig2 === void 0 ? void 0 : _getConfig2.position) || 0;
|
|
14008
|
+
const positionA = getConfig(a)?.position || 0;
|
|
14009
|
+
const positionB = getConfig(b)?.position || 0;
|
|
14008
14010
|
return positionA - positionB;
|
|
14009
14011
|
});
|
|
14010
14012
|
};
|
|
@@ -14021,7 +14023,7 @@ const resolveDynamicLabel = (labelConfig, item, defaultLabel) => {
|
|
|
14021
14023
|
const parts = labelKey.split(' is ');
|
|
14022
14024
|
if (parts.length === 2) {
|
|
14023
14025
|
const [conditionKey, conditionValue] = parts;
|
|
14024
|
-
if (
|
|
14026
|
+
if (item?.[conditionKey] === conditionValue) {
|
|
14025
14027
|
return labelConfig[labelKey];
|
|
14026
14028
|
}
|
|
14027
14029
|
}
|
|
@@ -20921,8 +20923,8 @@ function ProjectWidget(_ref) {
|
|
|
20921
20923
|
onLinkClick,
|
|
20922
20924
|
image,
|
|
20923
20925
|
linkIcon = "Link",
|
|
20924
|
-
sdgList,
|
|
20925
|
-
items,
|
|
20926
|
+
sdgList = [],
|
|
20927
|
+
items = [],
|
|
20926
20928
|
onCardClick,
|
|
20927
20929
|
hideSDGList = false,
|
|
20928
20930
|
t = x => x
|
|
@@ -20934,9 +20936,9 @@ function ProjectWidget(_ref) {
|
|
|
20934
20936
|
} = useToken$i();
|
|
20935
20937
|
return /*#__PURE__*/jsxRuntime.jsxs(antd.Card, _objectSpread2(_objectSpread2({
|
|
20936
20938
|
style: {
|
|
20937
|
-
flex: 1,
|
|
20938
|
-
width:
|
|
20939
|
-
minWidth: "200px"
|
|
20939
|
+
// flex: 1,
|
|
20940
|
+
width: 318
|
|
20941
|
+
// minWidth: "200px",
|
|
20940
20942
|
},
|
|
20941
20943
|
hoverable: true,
|
|
20942
20944
|
onMouseEnter: () => setIsHovered(true),
|
|
@@ -20950,7 +20952,8 @@ function ProjectWidget(_ref) {
|
|
|
20950
20952
|
}
|
|
20951
20953
|
}) : /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20952
20954
|
style: {
|
|
20953
|
-
height: "103px"
|
|
20955
|
+
height: "103px",
|
|
20956
|
+
borderBottom: "1px solid var(--base-gray-30)"
|
|
20954
20957
|
},
|
|
20955
20958
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
|
|
20956
20959
|
image: antd.Empty.PRESENTED_IMAGE_SIMPLE
|
|
@@ -20994,12 +20997,6 @@ const Style$x = dt.div`
|
|
|
20994
20997
|
.daf-widget {
|
|
20995
20998
|
background-color: ${props => props.backgroundColor} !important;
|
|
20996
20999
|
border-color: ${props => props.backgroundBorderColor} !important;
|
|
20997
|
-
transition: box-shadow 0.2s ease-in-out;
|
|
20998
|
-
${props => props.width ? `width: ${props.width} !important;` : ''}
|
|
20999
|
-
|
|
21000
|
-
&:hover {
|
|
21001
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
21002
|
-
}
|
|
21003
21000
|
}
|
|
21004
21001
|
|
|
21005
21002
|
.widget-card-logo-icon {
|
|
@@ -21012,11 +21009,6 @@ const Style$x = dt.div`
|
|
|
21012
21009
|
align-items: center;
|
|
21013
21010
|
border: 1px solid #E5E7EB;
|
|
21014
21011
|
}
|
|
21015
|
-
|
|
21016
|
-
.disabled-anchor {
|
|
21017
|
-
cursor: not-allowed;
|
|
21018
|
-
opacity: 0.5;
|
|
21019
|
-
}
|
|
21020
21012
|
`;
|
|
21021
21013
|
|
|
21022
21014
|
const {
|
|
@@ -21034,16 +21026,12 @@ const WidgetCard = _ref => {
|
|
|
21034
21026
|
loading = false,
|
|
21035
21027
|
iconColor,
|
|
21036
21028
|
buttonIcon,
|
|
21037
|
-
imageUrl
|
|
21038
|
-
buttonConfig = {},
|
|
21039
|
-
width,
|
|
21040
|
-
t = () => {}
|
|
21029
|
+
imageUrl
|
|
21041
21030
|
} = _ref;
|
|
21042
21031
|
useToken$h();
|
|
21043
21032
|
return /*#__PURE__*/jsxRuntime.jsx(Style$x, {
|
|
21044
21033
|
backgroundColor: backgroundColor,
|
|
21045
21034
|
backgroundBorderColor: backgroundBorderColor,
|
|
21046
|
-
width: width,
|
|
21047
21035
|
children: /*#__PURE__*/jsxRuntime.jsxs(Widget, {
|
|
21048
21036
|
title: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
21049
21037
|
style: {
|
|
@@ -21068,24 +21056,19 @@ const WidgetCard = _ref => {
|
|
|
21068
21056
|
addedHeader: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
21069
21057
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
21070
21058
|
className: "flex-1"
|
|
21071
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
21072
|
-
|
|
21073
|
-
|
|
21074
|
-
|
|
21075
|
-
|
|
21076
|
-
|
|
21077
|
-
|
|
21078
|
-
name: buttonIcon,
|
|
21079
|
-
size: 16,
|
|
21080
|
-
color: buttonConfig !== null && buttonConfig !== void 0 && buttonConfig.disabled ? "#6C737F" : iconColor || antd.theme.colorPrimary
|
|
21081
|
-
})
|
|
21059
|
+
}), /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
21060
|
+
className: "widget-card-logo-icon",
|
|
21061
|
+
href: link,
|
|
21062
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
21063
|
+
name: buttonIcon,
|
|
21064
|
+
size: 16,
|
|
21065
|
+
color: iconColor || antd.theme.colorPrimary
|
|
21082
21066
|
})
|
|
21083
21067
|
})]
|
|
21084
21068
|
}),
|
|
21085
21069
|
loading: loading,
|
|
21086
21070
|
className: "with-tabs",
|
|
21087
21071
|
children: [description && /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
21088
|
-
className: "mt-4",
|
|
21089
21072
|
children: description
|
|
21090
21073
|
}), data === null || data === void 0 ? void 0 : data.map(item => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
21091
21074
|
style: {
|
|
@@ -21122,11 +21105,15 @@ function CarouselWidget(_ref) {
|
|
|
21122
21105
|
* @param {number} currentSlide - The index of the current slide after change
|
|
21123
21106
|
* @private
|
|
21124
21107
|
*/
|
|
21125
|
-
|
|
21108
|
+
const onChange = currentSlide => {
|
|
21109
|
+
console.log(currentSlide);
|
|
21110
|
+
};
|
|
21126
21111
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
21127
21112
|
title: title,
|
|
21128
21113
|
className: "with-border-header h-w-btn-header",
|
|
21129
|
-
children: /*#__PURE__*/jsxRuntime.jsx(antd.Carousel, _objectSpread2(_objectSpread2({
|
|
21114
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.Carousel, _objectSpread2(_objectSpread2({
|
|
21115
|
+
afterChange: onChange
|
|
21116
|
+
}, rest), {}, {
|
|
21130
21117
|
children: children
|
|
21131
21118
|
}))
|
|
21132
21119
|
});
|
package/dist/utils/index.js
CHANGED
|
@@ -6180,7 +6180,6 @@ const userHasInterface = (user, app, intf) => {
|
|
|
6180
6180
|
};
|
|
6181
6181
|
|
|
6182
6182
|
const en = {
|
|
6183
|
-
"Currently unavailable": "Currently unavailable",
|
|
6184
6183
|
Description: "Description",
|
|
6185
6184
|
"missing-inputs": "Missing Inputs",
|
|
6186
6185
|
"all-inputs-fullfilled": "All inputs in this section are fullfilled",
|
|
@@ -7373,7 +7372,6 @@ const en = {
|
|
|
7373
7372
|
};
|
|
7374
7373
|
|
|
7375
7374
|
const fr = {
|
|
7376
|
-
"Currently unavailable": "Actuellement indisponible",
|
|
7377
7375
|
"Description": "Description",
|
|
7378
7376
|
"missing-inputs": "Données Manquantes",
|
|
7379
7377
|
"all-inputs-fullfilled": "Toutes les données de cette section ont été saisies.",
|
|
@@ -9206,7 +9204,6 @@ const fr = {
|
|
|
9206
9204
|
};
|
|
9207
9205
|
|
|
9208
9206
|
const sp = {
|
|
9209
|
-
"Currently unavailable": "Actualmente no disponible",
|
|
9210
9207
|
"Description": "Descripción",
|
|
9211
9208
|
"missing-inputs": "Datos que Faltan",
|
|
9212
9209
|
"all-inputs-fullfilled": "Todas las entradas de esta sección están completas.",
|
package/package.json
CHANGED
|
@@ -53,13 +53,16 @@ function CarouselWidget({title, children, ...rest}) {
|
|
|
53
53
|
* @param {number} currentSlide - The index of the current slide after change
|
|
54
54
|
* @private
|
|
55
55
|
*/
|
|
56
|
+
const onChange = (currentSlide) => {
|
|
57
|
+
console.log(currentSlide);
|
|
58
|
+
};
|
|
56
59
|
|
|
57
60
|
return (
|
|
58
61
|
<Widget
|
|
59
62
|
title={title}
|
|
60
63
|
className="with-border-header h-w-btn-header"
|
|
61
64
|
>
|
|
62
|
-
<Carousel {...rest}>
|
|
65
|
+
<Carousel afterChange={onChange} {...rest}>
|
|
63
66
|
{children}
|
|
64
67
|
</Carousel>
|
|
65
68
|
</Widget>
|
|
@@ -7,85 +7,86 @@ const { Meta } = Card;
|
|
|
7
7
|
const { useToken } = theme;
|
|
8
8
|
|
|
9
9
|
export default function ProjectWidget({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
title,
|
|
11
|
+
description,
|
|
12
|
+
onLinkClick,
|
|
13
|
+
image,
|
|
14
|
+
linkIcon = "Link",
|
|
15
|
+
sdgList = [],
|
|
16
|
+
items = [],
|
|
17
|
+
onCardClick,
|
|
18
|
+
hideSDGList = false,
|
|
19
|
+
t = (x) => x,
|
|
20
|
+
...props
|
|
21
21
|
}) {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
23
|
+
const { token } = useToken();
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
25
|
+
return (
|
|
26
|
+
<Card
|
|
27
|
+
style={{
|
|
28
|
+
// flex: 1,
|
|
29
|
+
width: 318,
|
|
30
|
+
// minWidth: "200px",
|
|
31
|
+
}}
|
|
32
|
+
hoverable
|
|
33
|
+
onMouseEnter={() => setIsHovered(true)}
|
|
34
|
+
onMouseLeave={() => setIsHovered(false)}
|
|
35
|
+
onClick={onCardClick}
|
|
36
|
+
cover={
|
|
37
|
+
<ImageContainer>
|
|
38
|
+
{image ? (
|
|
39
|
+
<div
|
|
40
|
+
className="image"
|
|
41
|
+
style={{
|
|
42
|
+
backgroundImage: `url(${image})`,
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
) : (
|
|
46
|
+
<div
|
|
47
|
+
style={{
|
|
48
|
+
height: "103px",
|
|
49
|
+
borderBottom: "1px solid var(--base-gray-30)",
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
|
53
|
+
</div>
|
|
54
|
+
)}
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
56
|
+
{onLinkClick && (
|
|
57
|
+
<div className="icon-container" onClick={onLinkClick}>
|
|
58
|
+
<CustomIcon
|
|
59
|
+
name={linkIcon}
|
|
60
|
+
width={16}
|
|
61
|
+
height={16}
|
|
62
|
+
color={isHovered ? token.colorPrimary7 : "black"}
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
)}
|
|
66
|
+
</ImageContainer>
|
|
67
|
+
}
|
|
68
|
+
{...props}
|
|
69
|
+
>
|
|
70
|
+
<Meta title={title || undefined} description={description || undefined} />
|
|
71
|
+
<ProjectWidgetItems>
|
|
72
|
+
{items.map((item, index) => (
|
|
73
|
+
<li key={index} className="project-widget-item">
|
|
74
|
+
<Label>{item.label}</Label>
|
|
75
|
+
{item.render()}
|
|
76
|
+
</li>
|
|
77
|
+
))}
|
|
78
|
+
</ProjectWidgetItems>
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
80
|
+
{!hideSDGList && (
|
|
81
|
+
<div
|
|
82
|
+
style={{
|
|
83
|
+
borderTop: "1px solid var(--base-gray-30)",
|
|
84
|
+
paddingTop: "10px",
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<SdgList sdgList={sdgList} t={t} />
|
|
88
|
+
</div>
|
|
89
|
+
)}
|
|
90
|
+
</Card>
|
|
91
|
+
);
|
|
91
92
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
}
|
|
@@ -3,7 +3,6 @@ import Widget from '../index.jsx'
|
|
|
3
3
|
import { theme, Tooltip, Tag } from 'antd'
|
|
4
4
|
import CustomIcon from '../../../Icon/CustomIcon.jsx'
|
|
5
5
|
import Style from './style.js'
|
|
6
|
-
import { formatClassname } from '../../../../../../helpers/ClassesHelper.js'
|
|
7
6
|
|
|
8
7
|
const { useToken } = theme;
|
|
9
8
|
|
|
@@ -19,49 +18,39 @@ const WidgetCard = ({
|
|
|
19
18
|
iconColor,
|
|
20
19
|
buttonIcon,
|
|
21
20
|
imageUrl,
|
|
22
|
-
buttonConfig = {},
|
|
23
|
-
width,
|
|
24
|
-
t = () => {},
|
|
25
21
|
}) => {
|
|
26
22
|
const { token } = useToken();
|
|
27
23
|
return (
|
|
28
|
-
<Style backgroundColor={backgroundColor} backgroundBorderColor={backgroundBorderColor}
|
|
24
|
+
<Style backgroundColor={backgroundColor} backgroundBorderColor={backgroundBorderColor}>
|
|
29
25
|
<Widget
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
{data?.map((item) => (
|
|
59
|
-
<div key={item} style={{display: "flex", justifyContent: "space-between"}}>
|
|
60
|
-
{item.isTag ? <Tag style={{width: '90px', textAlign: 'center', borderRadius: '10px'}} color={item.tagColor || 'default'}>{item.label}</Tag> : <span>{item.label}</span>}
|
|
61
|
-
<span>{item.value}</span>
|
|
62
|
-
</div>
|
|
63
|
-
))}
|
|
64
|
-
</Widget>
|
|
26
|
+
title={
|
|
27
|
+
<div style={{display: "flex", alignItems: "center"}}>
|
|
28
|
+
{imageUrl ? <img src={imageUrl} className="widget-card-logo-icon mr-2" />
|
|
29
|
+
: <div className="widget-card-logo-icon mr-2">
|
|
30
|
+
<CustomIcon name={logoIcon} width={25} height={25} />
|
|
31
|
+
</div>
|
|
32
|
+
}
|
|
33
|
+
<Tooltip title={title}>{title}</Tooltip>
|
|
34
|
+
</div>
|
|
35
|
+
}
|
|
36
|
+
addedHeader={
|
|
37
|
+
<>
|
|
38
|
+
<div className="flex-1" /><a className="widget-card-logo-icon" href={link}>
|
|
39
|
+
<CustomIcon name={buttonIcon} size={16} color={iconColor || theme.colorPrimary} />
|
|
40
|
+
</a>
|
|
41
|
+
</>
|
|
42
|
+
}
|
|
43
|
+
loading={loading}
|
|
44
|
+
className="with-tabs"
|
|
45
|
+
>
|
|
46
|
+
{description && <p>{description}</p>}
|
|
47
|
+
{data?.map((item) => (
|
|
48
|
+
<div key={item} style={{display: "flex", justifyContent: "space-between"}}>
|
|
49
|
+
{item.isTag ? <Tag style={{width: '90px', textAlign: 'center', borderRadius: '10px'}} color={item.tagColor || 'default'}>{item.label}</Tag> : <span>{item.label}</span>}
|
|
50
|
+
<span>{item.value}</span>
|
|
51
|
+
</div>
|
|
52
|
+
))}
|
|
53
|
+
</Widget>
|
|
65
54
|
</Style>
|
|
66
55
|
)
|
|
67
56
|
}
|
|
@@ -4,12 +4,6 @@ const Style = styled.div`
|
|
|
4
4
|
.daf-widget {
|
|
5
5
|
background-color: ${props => props.backgroundColor} !important;
|
|
6
6
|
border-color: ${props => props.backgroundBorderColor} !important;
|
|
7
|
-
transition: box-shadow 0.2s ease-in-out;
|
|
8
|
-
${props => props.width ? `width: ${props.width} !important;` : ''}
|
|
9
|
-
|
|
10
|
-
&:hover {
|
|
11
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
12
|
-
}
|
|
13
7
|
}
|
|
14
8
|
|
|
15
9
|
.widget-card-logo-icon {
|
|
@@ -22,11 +16,6 @@ const Style = styled.div`
|
|
|
22
16
|
align-items: center;
|
|
23
17
|
border: 1px solid #E5E7EB;
|
|
24
18
|
}
|
|
25
|
-
|
|
26
|
-
.disabled-anchor {
|
|
27
|
-
cursor: not-allowed;
|
|
28
|
-
opacity: 0.5;
|
|
29
|
-
}
|
|
30
19
|
`;
|
|
31
20
|
|
|
32
21
|
export default Style;
|
|
@@ -5,90 +5,94 @@ 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 = "small",
|
|
9
|
+
maxHeight = 300,
|
|
10
|
+
containerHeight = 525,
|
|
11
|
+
dataSource = [],
|
|
12
|
+
columns = {},
|
|
13
|
+
pagination = false,
|
|
14
|
+
doEmptyRows = true,
|
|
15
|
+
...props
|
|
16
16
|
}) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const data = React.useMemo(() => {
|
|
18
|
+
if (!doEmptyRows) {
|
|
19
|
+
return dataSource;
|
|
20
|
+
}
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
const paddedData = [...dataSource];
|
|
22
|
-
while (paddedData.length < MIN_ROWS) {
|
|
23
|
-
paddedData.push({ empty: true });
|
|
24
|
-
}
|
|
25
|
-
return paddedData;
|
|
26
|
-
}
|
|
22
|
+
const MIN_ROWS = 4;
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
if (dataSource.length < MIN_ROWS) {
|
|
25
|
+
const paddedData = [...dataSource];
|
|
26
|
+
while (paddedData.length < MIN_ROWS) {
|
|
27
|
+
paddedData.push({ empty: true });
|
|
28
|
+
}
|
|
29
|
+
return paddedData;
|
|
30
|
+
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, [data.length]);
|
|
32
|
+
return dataSource;
|
|
33
|
+
}, [dataSource, doEmptyRows]);
|
|
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
|
-
|
|
35
|
+
const Wrapper = React.useMemo(() => {
|
|
36
|
+
return data.length > 5 ? ComponentWithFocus : "div";
|
|
37
|
+
}, [data.length]);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Wrapper>
|
|
41
|
+
<Style>
|
|
42
|
+
<div
|
|
43
|
+
className="daf-table-wrapper"
|
|
44
|
+
style={{
|
|
45
|
+
maxHeight: containerHeight,
|
|
46
|
+
overflowY: "auto",
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<div className="daf-sticky-table">
|
|
50
|
+
<Table
|
|
51
|
+
{...props}
|
|
52
|
+
size={size}
|
|
53
|
+
scroll
|
|
54
|
+
sticky
|
|
55
|
+
style={{ maxHeight }}
|
|
56
|
+
dataSource={data}
|
|
57
|
+
columns={columns}
|
|
58
|
+
pagination={pagination}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</Style>
|
|
63
|
+
</Wrapper>
|
|
64
|
+
);
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
const Style = styled.div`
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
max-width: calc(100% - 48px);
|
|
69
|
+
margin-left: var(--size-lg);
|
|
70
|
+
overflow: hidden;
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
.daf-table {
|
|
73
|
+
padding: 0px;
|
|
74
|
+
margin-top: 0px;
|
|
71
75
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
.ant-tag {
|
|
77
|
+
text-align: center;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
76
80
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
.daf-select-filters .filters {
|
|
82
|
+
padding-top: 16px;
|
|
83
|
+
padding-left: 0;
|
|
84
|
+
padding-right: 0;
|
|
85
|
+
}
|
|
82
86
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
.daf-table {
|
|
88
|
+
padding-top: 16px;
|
|
89
|
+
}
|
|
86
90
|
`;
|
|
87
91
|
|
|
88
92
|
StickyTable.propTypes = {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
size: PropTypes.any,
|
|
94
|
+
maxHeight: PropTypes.number,
|
|
95
|
+
dataSource: PropTypes.array,
|
|
96
|
+
columns: PropTypes.object,
|
|
97
|
+
pagination: PropTypes.any,
|
|
94
98
|
};
|