datastake-daf 0.6.180 → 0.6.182
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 +658 -522
- package/dist/utils/index.js +573 -487
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Globe/index.jsx +20 -1
- package/src/@daf/core/components/Dashboard/Globe/style.js +28 -0
- package/src/@daf/core/components/Dashboard/Tooltip.stories.js +38 -21
- package/src/@daf/core/components/Icon/configs/Ant.js +14 -0
- package/src/@daf/core/components/Icon/configs/Bird.js +14 -0
- package/src/@daf/core/components/Icon/configs/Fish.js +14 -0
- package/src/@daf/core/components/Icon/configs/Leaf.js +13 -13
- package/src/@daf/core/components/Icon/configs/Tree.js +13 -6
- package/src/@daf/core/components/Icon/configs/WaterDrop.js +15 -0
- package/src/@daf/core/components/Icon/configs/index.js +8 -0
- package/src/@daf/core/components/Table/MoreTags/index.jsx +118 -95
- package/src/@daf/utils/tooltip.js +182 -129
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import CustomIcon from "../../Icon/CustomIcon.jsx";
|
|
|
8
8
|
import ComponentWithFocus from "../ComponentWithFocus/index.jsx";
|
|
9
9
|
import { formatClassname } from "../../../../../helpers/ClassesHelper";
|
|
10
10
|
import Filters from "../../Filters/FloatingFilters/index.js";
|
|
11
|
+
import { useResizeContext } from "../../../context/Resize/index.js";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Globe Component
|
|
@@ -129,6 +130,9 @@ function Globe({
|
|
|
129
130
|
[data],
|
|
130
131
|
);
|
|
131
132
|
|
|
133
|
+
// Get resize context for sidebar state
|
|
134
|
+
const { isCollapsed } = useResizeContext();
|
|
135
|
+
|
|
132
136
|
// Use custom hook to configure globe functionality
|
|
133
137
|
const { container, activeMarker, mapOptionsButtonsConfig, forceResize } = useGlobe({
|
|
134
138
|
data: mappedData,
|
|
@@ -171,9 +175,24 @@ function Globe({
|
|
|
171
175
|
}
|
|
172
176
|
}, [forceResize]);
|
|
173
177
|
|
|
178
|
+
// Force resize when sidebar state changes
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
if (forceResize) {
|
|
181
|
+
// Trigger resize when sidebar collapses/expands
|
|
182
|
+
const timer = setTimeout(() => {
|
|
183
|
+
forceResize();
|
|
184
|
+
}, 100);
|
|
185
|
+
|
|
186
|
+
return () => clearTimeout(timer);
|
|
187
|
+
}
|
|
188
|
+
}, [isCollapsed, forceResize]);
|
|
189
|
+
|
|
174
190
|
return (
|
|
175
191
|
<ComponentWithFocus>
|
|
176
|
-
<Style className={formatClassname([
|
|
192
|
+
<Style className={formatClassname([
|
|
193
|
+
showSider && activeMarker && "with-sider",
|
|
194
|
+
isCollapsed ? "sidebar-collapsed" : "sidebar-expanded"
|
|
195
|
+
])}>
|
|
177
196
|
{filtersConfig ? (
|
|
178
197
|
<Filters t={t} filtersConfig={filtersConfig} onFilterChange={onFilterChange} />
|
|
179
198
|
) : null}
|
|
@@ -7,6 +7,7 @@ const Style = styled.div`
|
|
|
7
7
|
width: 100%;
|
|
8
8
|
height: 472px;
|
|
9
9
|
min-height: 300px;
|
|
10
|
+
flex: 1;
|
|
10
11
|
|
|
11
12
|
@media (max-width: 768px) {
|
|
12
13
|
height: 350px;
|
|
@@ -17,6 +18,13 @@ const Style = styled.div`
|
|
|
17
18
|
height: 300px;
|
|
18
19
|
min-height: 200px;
|
|
19
20
|
}
|
|
21
|
+
|
|
22
|
+
/* Responsive height adjustments for sidebar state changes */
|
|
23
|
+
@media (min-width: 769px) {
|
|
24
|
+
height: calc(100vh - 200px);
|
|
25
|
+
min-height: 400px;
|
|
26
|
+
max-height: 600px;
|
|
27
|
+
}
|
|
20
28
|
|
|
21
29
|
.filter-cont {
|
|
22
30
|
position: absolute;
|
|
@@ -107,6 +115,9 @@ const Style = styled.div`
|
|
|
107
115
|
flex: 1;
|
|
108
116
|
background: rgb(0, 0, 0);
|
|
109
117
|
z-index: 1;
|
|
118
|
+
width: 100%;
|
|
119
|
+
height: 100%;
|
|
120
|
+
min-height: inherit;
|
|
110
121
|
|
|
111
122
|
/* Mapbox GL JS specific styles */
|
|
112
123
|
.mapboxgl-ctrl-top-right {
|
|
@@ -376,6 +387,23 @@ const Style = styled.div`
|
|
|
376
387
|
right: 300px;
|
|
377
388
|
}
|
|
378
389
|
}
|
|
390
|
+
|
|
391
|
+
/* Responsive adjustments for different sidebar states */
|
|
392
|
+
&.sidebar-collapsed {
|
|
393
|
+
height: calc(100vh - 180px);
|
|
394
|
+
|
|
395
|
+
@media (min-width: 769px) {
|
|
396
|
+
height: calc(100vh - 180px);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
&.sidebar-expanded {
|
|
401
|
+
height: calc(100vh - 200px);
|
|
402
|
+
|
|
403
|
+
@media (min-width: 769px) {
|
|
404
|
+
height: calc(100vh - 200px);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
379
407
|
|
|
380
408
|
.sider {
|
|
381
409
|
display: flex;
|
|
@@ -1,48 +1,65 @@
|
|
|
1
|
-
import { renderTooltip, renderTooltipJsx } from
|
|
2
|
-
import ReactHtmlParser from
|
|
3
|
-
import ThemeLayout from
|
|
1
|
+
import { renderTooltip, renderTooltipJsx } from "../../../utils/tooltip";
|
|
2
|
+
import ReactHtmlParser from "react-html-parser";
|
|
3
|
+
import ThemeLayout from "../ThemeLayout";
|
|
4
4
|
|
|
5
5
|
const Widget = (props) => {
|
|
6
6
|
return (
|
|
7
|
-
<div style={{ display:
|
|
8
|
-
<div
|
|
7
|
+
<div style={{ display: "flex", gap: 20 }}>
|
|
8
|
+
<div
|
|
9
|
+
style={{
|
|
10
|
+
borderRadius: 8,
|
|
11
|
+
border: "1px solid var(--base-gray-40)",
|
|
12
|
+
width: 250,
|
|
13
|
+
padding: "0 8px",
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
9
16
|
{renderTooltipJsx(props)}
|
|
10
17
|
</div>
|
|
11
|
-
<div
|
|
18
|
+
<div
|
|
19
|
+
style={{
|
|
20
|
+
borderRadius: 8,
|
|
21
|
+
border: "1px solid var(--base-gray-40)",
|
|
22
|
+
width: 250,
|
|
23
|
+
padding: "0 8px",
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
12
26
|
{ReactHtmlParser(renderTooltip(props))}
|
|
13
27
|
</div>
|
|
14
28
|
</div>
|
|
15
29
|
);
|
|
16
|
-
}
|
|
30
|
+
};
|
|
17
31
|
|
|
18
32
|
export default {
|
|
19
|
-
title:
|
|
33
|
+
title: "Dashboard/Tooltip",
|
|
20
34
|
component: Widget,
|
|
21
|
-
tags: [
|
|
35
|
+
tags: ["autodocs"],
|
|
22
36
|
decorators: [
|
|
23
37
|
(Story) => (
|
|
24
|
-
<div style={{ margin:
|
|
38
|
+
<div style={{ margin: "3em" }}>
|
|
25
39
|
<ThemeLayout>
|
|
26
40
|
<Story />
|
|
27
41
|
</ThemeLayout>
|
|
28
42
|
</div>
|
|
29
43
|
),
|
|
30
44
|
],
|
|
31
|
-
}
|
|
45
|
+
};
|
|
32
46
|
|
|
33
47
|
export const Primary = {
|
|
34
|
-
name:
|
|
48
|
+
name: "Action Widget",
|
|
35
49
|
args: {
|
|
36
|
-
|
|
37
|
-
|
|
50
|
+
title: "Triangulation",
|
|
51
|
+
items: [
|
|
38
52
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
53
|
+
color: "#4683DE",
|
|
54
|
+
label: "Single Source",
|
|
55
|
+
value: "91%",
|
|
56
|
+
},
|
|
43
57
|
],
|
|
58
|
+
tags: {
|
|
59
|
+
label: "Species",
|
|
60
|
+
items: [{ label: "Label 1", color: "red" }, { label: "Label 6" }],
|
|
61
|
+
},
|
|
44
62
|
total: 0,
|
|
45
|
-
|
|
63
|
+
link: "/app",
|
|
46
64
|
},
|
|
47
|
-
}
|
|
48
|
-
|
|
65
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
viewBox: "0 0 16 17",
|
|
3
|
+
children: (
|
|
4
|
+
<path
|
|
5
|
+
d="M10.2485 8.14595C10.2485 6.75528 9.30639 5.62792 8.14422 5.62792M10.2485 8.14595H13.7215L15.1998 10.0345M10.2485 8.14595C10.2485 9.13029 9.7765 9.98271 9.08855 10.3968M8.14422 10.664C8.48378 10.664 8.80456 10.5677 9.08855 10.3968M8.14422 10.664C7.80571 10.664 7.48588 10.5683 7.20256 10.3984M8.14422 10.664C6.98204 10.664 6.03992 11.7913 6.03992 13.182C6.03992 14.5727 6.98204 15.7 8.14422 15.7C9.30639 15.7 10.2485 14.5727 10.2485 13.182C10.2485 11.7913 9.30639 10.664 8.14422 10.664ZM6.03992 8.14595H2.36439L0.799805 10.0345M6.03992 8.14595C6.03992 7.67625 6.14739 7.23659 6.33451 6.86026M6.03992 8.14595C6.03992 9.13156 6.51315 9.98492 7.20256 10.3984M8.14422 5.62792C7.37457 5.62792 6.70142 6.12235 6.33451 6.86026M8.14422 5.62792C9.39754 5.62792 10.4136 4.65909 10.4136 3.46398C10.4136 2.26888 9.39754 1.30005 8.14422 1.30005C6.89089 1.30005 5.87487 2.26888 5.87487 3.46398C5.87487 4.65909 6.89089 5.62792 8.14422 5.62792ZM9.97173 6.89677L12.4278 6.36201L14.366 4.59513M6.33451 6.86026L3.87987 6.36201L1.89507 4.65415M9.08855 10.3968L11.6942 11.2001L13.7144 13.664M7.20256 10.3984L4.59422 11.2001L2.57402 13.664M6.54536 1.92956L5.91614 1.32956M9.73276 1.92956L10.362 1.32956"
|
|
6
|
+
stroke="currentColor"
|
|
7
|
+
strokeWidth="1.2"
|
|
8
|
+
strokeLinecap="round"
|
|
9
|
+
/>
|
|
10
|
+
),
|
|
11
|
+
tag: ["nature"],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default config;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
viewBox: "0 0 18 14",
|
|
3
|
+
children: (
|
|
4
|
+
<path
|
|
5
|
+
d="M5.36528 11.3267C7.95724 11.3267 10.0584 9.22646 10.0584 6.63571V3.38419C10.0584 2.74417 10.3079 2.1624 10.7148 1.7308M10.7148 1.7308L1.37599 11.1688C1.31806 11.2273 1.35953 11.3267 1.4419 11.3267H10.2902C12.8248 11.3267 14.8796 9.27196 14.8796 6.73734V4.23407M10.7148 1.7308C11.1544 1.26462 11.7777 0.973633 12.469 0.973633C13.3676 0.973633 14.1514 1.46533 14.5659 2.19436M7.24613 11.2649L9.00769 13.0264M14.5659 2.19436C14.7656 2.54541 14.8796 2.95149 14.8796 3.38419V4.23407M14.5659 2.19436L16.6038 2.89122C16.6763 2.91599 16.6892 3.01296 16.6257 3.0558L14.8796 4.23407M7.75605 13.0264H10.2593M12.869 3.35153C12.869 3.57244 12.6899 3.75153 12.469 3.75153C12.2481 3.75153 12.069 3.57244 12.069 3.35153C12.069 3.13061 12.2481 2.95153 12.469 2.95153C12.6899 2.95153 12.869 3.13061 12.869 3.35153Z"
|
|
6
|
+
stroke="currentColor"
|
|
7
|
+
strokeWidth="1.2"
|
|
8
|
+
strokeLinecap="round"
|
|
9
|
+
/>
|
|
10
|
+
),
|
|
11
|
+
tag: ["nature"],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default config;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
viewBox: "0 0 16 12",
|
|
3
|
+
children: (
|
|
4
|
+
<path
|
|
5
|
+
d="M3.56741 5.93035C4.57902 8.09831 6.58683 9.30582 8.87149 9.53885C11.4621 9.8031 13.8036 8.23893 15.1884 5.83299C15.2204 5.7773 15.2206 5.70857 15.1888 5.65277C14.0851 3.71962 12.2542 2.3725 10.0741 2.15012M3.56741 5.93035C5.0274 3.62225 7.47102 1.8846 10.0741 2.15012M3.56741 5.93035L1.64477 3.21433C1.5292 3.05108 1.2536 3.16468 1.2761 3.36342C1.36164 4.11879 1.36819 4.90109 1.28693 5.69774C1.20567 6.49439 1.04131 7.25926 0.805023 7.9818C0.742855 8.17191 0.98985 8.33882 1.13599 8.20226L3.56741 5.93035ZM10.0741 2.15012L7.75293 1.07025C7.2145 0.814429 6.59489 1.21061 6.48594 1.88036L6.31462 3.12355M6.41096 8.71041L6.36522 9.79811C6.33699 10.4693 6.85307 10.9789 7.42519 10.8514C7.43668 10.8488 7.44794 10.8449 7.45864 10.84L10.4089 9.4846M12.3922 5.16548C12.3896 5.36342 12.2481 5.52606 12.0763 5.52875C11.9044 5.53144 11.7673 5.37316 11.77 5.17523C11.7727 4.97729 11.9142 4.81465 12.086 4.81196C12.2578 4.80927 12.3949 4.96754 12.3922 5.16548Z"
|
|
6
|
+
stroke="currentColor"
|
|
7
|
+
strokeWidth
|
|
8
|
+
/>
|
|
9
|
+
),
|
|
10
|
+
tag: ["nature"],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export default config;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
const config = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
viewBox: "0 0 14 20",
|
|
3
|
+
children: (
|
|
4
|
+
<>
|
|
5
|
+
<path
|
|
6
|
+
d="M7.00001 7.20094V12.8152M0.902649 9.98574C0.902649 6.35375 3.13811 3.14767 6.54787 1.23316C6.82864 1.07551 7.17138 1.07551 7.45215 1.23316C10.8619 3.14767 13.0974 6.35375 13.0974 9.98574C13.0974 13.6247 10.8534 16.8361 7.43262 18.7493C7.1525 18.9059 6.81098 18.906 6.53092 18.7492C3.11304 16.836 0.902649 13.6246 0.902649 9.98574Z"
|
|
7
|
+
stroke="currentColor"
|
|
8
|
+
strokeWidth="1.5"
|
|
9
|
+
strokeLinecap="round"
|
|
10
|
+
/>
|
|
11
|
+
</>
|
|
12
|
+
),
|
|
13
|
+
tag: ["nature"],
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export default config;
|
|
16
|
+
export default config;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
const config = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
viewBox: "0 0 15 18",
|
|
3
|
+
children: (
|
|
4
|
+
<path
|
|
5
|
+
d="M7 17.3332V13.9999M10.475 7.38319H3.52497C2.54164 7.38319 2.19998 6.72486 2.77498 5.92486L6.24999 1.0582C6.65832 0.474864 7.34167 0.474864 7.74167 1.0582L11.2167 5.92486C11.8 6.72486 11.4583 7.38319 10.475 7.38319ZM11.6583 13.9999H2.35C1.03334 13.9999 0.583334 13.1249 1.35833 12.0582L4.68333 7.3832H9.325L12.65 12.0582C13.425 13.1249 12.975 13.9999 11.6583 13.9999Z"
|
|
6
|
+
stroke="currentColor"
|
|
7
|
+
strokeWidth="1.25"
|
|
8
|
+
strokeLinecap="round"
|
|
9
|
+
strokeLinejoin="round"
|
|
10
|
+
/>
|
|
11
|
+
),
|
|
12
|
+
tag: ["nature"],
|
|
13
|
+
};
|
|
7
14
|
|
|
8
|
-
export default config;
|
|
15
|
+
export default config;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
viewBox: "0 0 13 16",
|
|
3
|
+
children: (
|
|
4
|
+
<path
|
|
5
|
+
d="M11.5 9.33325C11.5 12.2788 9.26142 14.6666 6.5 14.6666C3.73858 14.6666 1.5 12.2788 1.5 9.33325C1.5 8.62598 1.62907 7.95087 1.86345 7.33325C2.60518 5.3787 6.5 1.33325 6.5 1.33325C6.5 1.33325 10.3948 5.3787 11.1366 7.33325C11.3709 7.95087 11.5 8.62598 11.5 9.33325Z"
|
|
6
|
+
stroke="currentColor"
|
|
7
|
+
strokeWidth="1.5"
|
|
8
|
+
strokeLinecap="round"
|
|
9
|
+
strokeLinejoin="round"
|
|
10
|
+
/>
|
|
11
|
+
),
|
|
12
|
+
tag: ["nature"],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default config;
|
|
@@ -196,6 +196,10 @@ import UpDownArrow from "./UpDownArrow";
|
|
|
196
196
|
import Clear from "./Clear";
|
|
197
197
|
import User from "./User";
|
|
198
198
|
import Integration from "./Integration";
|
|
199
|
+
import Ant from "./Ant";
|
|
200
|
+
import Bird from "./Bird";
|
|
201
|
+
import Fish from "./Fish";
|
|
202
|
+
import WaterDrop from "./WaterDrop";
|
|
199
203
|
|
|
200
204
|
const config = {
|
|
201
205
|
Right,
|
|
@@ -396,6 +400,10 @@ const config = {
|
|
|
396
400
|
UpDownArrow,
|
|
397
401
|
Clear,
|
|
398
402
|
Integration,
|
|
403
|
+
Ant,
|
|
404
|
+
Bird,
|
|
405
|
+
Fish,
|
|
406
|
+
WaterDrop,
|
|
399
407
|
};
|
|
400
408
|
|
|
401
409
|
export default config;
|
|
@@ -1,114 +1,137 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
|
-
import { Typography, Tag, Tooltip } from "antd"
|
|
3
|
-
import { useEffect, useRef, useState } from "react"
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import { Typography, Tag, Tooltip } from "antd";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
|
|
5
|
-
const { Text } = Typography
|
|
5
|
+
const { Text } = Typography;
|
|
6
6
|
|
|
7
7
|
export default function MoreTags({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
values = [],
|
|
9
|
+
maxWidthCont = 120,
|
|
10
|
+
maxTextCont = 100,
|
|
11
|
+
diff = 30,
|
|
12
12
|
}) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const ref = useRef();
|
|
14
|
+
const [width, setWidth] = useState(0);
|
|
15
|
+
const [indexToReturn, setIndexToReturn] = useState(0);
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const _maxWidthCont = values.length <= 1 ? maxWidthCont : maxWidthCont - 20;
|
|
18
|
+
const _maxWidthTxt = values.length <= 1 ? maxTextCont : 80;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
22
|
+
setWidth(entries[0].contentRect.width);
|
|
23
|
+
});
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
resizeObserver.observe(ref.current);
|
|
26
|
+
return () => resizeObserver.disconnect();
|
|
27
|
+
}, []);
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const _calculate = () => {
|
|
30
|
+
const tabs = ref.current.querySelectorAll(".check-tabs");
|
|
31
|
+
let filled = 0;
|
|
32
|
+
let indexToReturn;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
if (values.length === 1) {
|
|
35
|
+
setIndexToReturn(1);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
tabs.forEach((t, i) => {
|
|
40
|
+
if (typeof indexToReturn === "number") {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
filled = filled + t.clientWidth + 25;
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
const dif = width - filled;
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
if (dif < diff) {
|
|
49
|
+
indexToReturn = dif < 0 ? i - 1 : i;
|
|
50
|
+
setIndexToReturn(indexToReturn);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
setIndexToReturn(typeof indexToReturn === "number" ? indexToReturn : tabs.length - 1);
|
|
55
|
+
};
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
const hasMore = values.length && indexToReturn !== values.length - 1;
|
|
58
|
+
const toShow = hasMore ? values.slice(0, indexToReturn + 1) : values;
|
|
59
|
+
const other = hasMore ? values.slice(indexToReturn + 1, values.length + 1) : [];
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
_calculate();
|
|
63
|
+
}, [width, values]);
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
65
|
+
return (
|
|
66
|
+
<div className="daf-more-tags">
|
|
67
|
+
<div className="list">
|
|
68
|
+
{toShow.map((ac, i) =>
|
|
69
|
+
typeof ac.renderTag === "function" ? (
|
|
70
|
+
ac.renderTag()
|
|
71
|
+
) : (
|
|
72
|
+
<Tag
|
|
73
|
+
key={`${typeof ac === "object" ? ac.value : ac}-${i}`}
|
|
74
|
+
style={{
|
|
75
|
+
maxWidth: _maxWidthCont,
|
|
76
|
+
overflow: "hidden",
|
|
77
|
+
textOverflow: "ellipsis",
|
|
78
|
+
whiteSpace: "nowrap",
|
|
79
|
+
}}
|
|
80
|
+
color={ac.color}
|
|
81
|
+
>
|
|
82
|
+
<Tooltip title={typeof ac === "object" ? ac.label : ac}>
|
|
83
|
+
<span
|
|
84
|
+
style={{
|
|
85
|
+
maxWidth: _maxWidthTxt,
|
|
86
|
+
overflow: "hidden",
|
|
87
|
+
textOverflow: "ellipsis",
|
|
88
|
+
whiteSpace: "nowrap",
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
{typeof ac === "object" ? ac.label : ac}
|
|
92
|
+
</span>
|
|
93
|
+
</Tooltip>
|
|
94
|
+
</Tag>
|
|
95
|
+
),
|
|
96
|
+
)}
|
|
97
|
+
{other.length ? (
|
|
98
|
+
<Tooltip
|
|
99
|
+
title={other
|
|
100
|
+
.map((ac) => (typeof ac === "object" ? ac.label : ac))
|
|
101
|
+
.join(", ")}
|
|
102
|
+
>
|
|
103
|
+
<Tag>+{other.length}</Tag>
|
|
104
|
+
</Tooltip>
|
|
105
|
+
) : null}
|
|
106
|
+
</div>
|
|
107
|
+
<div className="list hidden" ref={ref}>
|
|
108
|
+
{values.map((ac, i) =>
|
|
109
|
+
typeof ac.renderTag === "function" ? (
|
|
110
|
+
ac.renderTag("check-tabs")
|
|
111
|
+
) : (
|
|
112
|
+
<Tag
|
|
113
|
+
color={ac.color}
|
|
114
|
+
key={`${ac}-${i}`}
|
|
115
|
+
className="check-tabs"
|
|
116
|
+
style={{ maxWidth: _maxWidthCont }}
|
|
117
|
+
>
|
|
118
|
+
<Text
|
|
119
|
+
ellipsis={{ tooltip: typeof ac === "object" ? ac.label : ac }}
|
|
120
|
+
style={{ maxWidth: _maxWidthTxt }}
|
|
121
|
+
>
|
|
122
|
+
{typeof ac === "object" ? ac.label : ac}
|
|
123
|
+
</Text>
|
|
124
|
+
</Tag>
|
|
125
|
+
),
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
);
|
|
107
130
|
}
|
|
108
131
|
|
|
109
132
|
MoreTags.propTypes = {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
133
|
+
values: PropTypes.array,
|
|
134
|
+
maxWidthCont: PropTypes.number,
|
|
135
|
+
maxTextCont: PropTypes.number,
|
|
136
|
+
diff: PropTypes.number,
|
|
137
|
+
};
|