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.
@@ -1,11 +1,18 @@
1
1
  import { Tag, Tooltip } from "antd";
2
2
  import { formatClassname } from "../../helpers/ClassesHelper";
3
3
  import CustomIcon from "../core/components/Icon/CustomIcon.jsx";
4
+ export const renderTooltip = ({
5
+ title = "",
6
+ items = [],
7
+ subTitle,
8
+ link,
9
+ fitContent,
10
+ }) => {
11
+ let content = `<div class="daf-tooltip-cont ${
12
+ fitContent ? "fit-content" : ""
13
+ }">`;
4
14
 
5
- export const renderTooltip = ({ title = "", items = [], subTitle, link, fitContent }) => {
6
- let content = `<div class="daf-tooltip-cont ${fitContent ? "fit-content" : ""}">`;
7
-
8
- content += `
15
+ content += `
9
16
  <div class="daf-tooltip-head">
10
17
  <div class="daf-tooltip-title">
11
18
  <div>
@@ -14,8 +21,8 @@ export const renderTooltip = ({ title = "", items = [], subTitle, link, fitConte
14
21
  </div>
15
22
  </div>
16
23
  ${
17
- link
18
- ? `
24
+ link
25
+ ? `
19
26
  <div class="flex flex-column justify-content-center">
20
27
  <a href="${link}" class="link-cont" target="_blank" rel="noopener noreferrer">
21
28
  <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 14 14" fill="none">
@@ -24,144 +31,190 @@ export const renderTooltip = ({ title = "", items = [], subTitle, link, fitConte
24
31
  </a>
25
32
  </div>
26
33
  `
27
- : ""
28
- }
34
+ : ""
35
+ }
29
36
  </div>
30
37
  `;
31
38
 
32
- content += '<div class="daf-tooltip-list">';
39
+ content += '<div class="daf-tooltip-list">';
33
40
 
34
- items.forEach((v) => {
35
- content += `
36
- <div class="${formatClassname(["daf-tooltip-list-item", v.isTotal && "is-total"])}">
41
+ items.forEach((v) => {
42
+ content += `
43
+ <div class="${formatClassname([
44
+ "daf-tooltip-list-item",
45
+ v.isTotal && "is-total",
46
+ ])}">
37
47
  ${
38
- v.color
39
- ? `
48
+ v.color
49
+ ? `
40
50
  <div class="flex flex-column justify-content-center">
41
51
  <span class="daf-tooltip-marker" style="background: ${v.color};"></span>
42
52
  </div>
43
53
  `
44
- : ""
45
- }
46
- <span class="daf-tooltip-name" style="${v.labelStyle || ""}">${v.label}</span>
47
- <span class="daf-tooltip-value" style="${v.valueStyle || ""}">${v.value}</span>
54
+ : ""
55
+ }
56
+ <span class="daf-tooltip-name" style="${v.labelStyle || ""}">${
57
+ v.label
58
+ }</span>
59
+ <span class="daf-tooltip-value" style="${v.valueStyle || ""}">${
60
+ v.value
61
+ }</span>
48
62
  </div>
49
63
  `;
50
- });
64
+ });
51
65
 
52
- content += "</div></div>";
53
- return content;
66
+ content += "</div></div>";
67
+ return content;
54
68
  };
55
69
 
56
70
  export const renderTooltipJsx = ({
57
- title = "",
58
- items = [],
59
- subTitle,
60
- className,
61
- link,
62
- onClickLink,
63
- total,
71
+ title = "",
72
+ items = [],
73
+ tags,
74
+ subTitle,
75
+ className,
76
+ link,
77
+ onClickLink,
78
+ total,
64
79
  }) => {
65
- return (
66
- <div className={formatClassname(["daf-tooltip-cont", className])}>
67
- <div className="daf-tooltip-head">
68
- <div className="daf-tooltip-title">
69
- <div>
70
- <Tooltip title={title}>
71
- <h4
72
- className={formatClassname([
73
- typeof total === "number" && "limited",
74
- ])}
75
- >
76
- {title}
77
- </h4>
78
- </Tooltip>
79
- {subTitle ? (
80
- <h5
81
- className={formatClassname([
82
- typeof total === "number" && "limited",
83
- ])}
84
- >
85
- {subTitle}
86
- </h5>
87
- ) : null}
88
- </div>
89
- <div style={{ height: "100%" }}>
90
- {typeof total === "number" ? (
91
- <div className="daf-tooltip-user-count">
92
- <div className="flex flex-column justify-content-center">
93
- <CustomIcon name="UsersCheck" width={13} height={13} />
94
- </div>
95
- <div className="flex flex-column justify-content-center">
96
- <span>{total}</span>
97
- </div>
98
- </div>
99
- ) : null}
100
- </div>
101
- </div>
102
- {link ? (
103
- typeof onClickLink === "function" || typeof link !== "string" ? (
104
- <div className="flex flex-column">
105
- <div className="link-cont" onClick={onClickLink}>
106
- <CustomIcon width={10} height={10} name="Link" />
107
- </div>
108
- </div>
109
- ) : (
110
- <div className="flex flex-column">
111
- <a
112
- href={link}
113
- className="link-cont"
114
- target="_blank"
115
- rel="noopener noreferrer"
116
- >
117
- <CustomIcon width={10} height={10} name="LinkNewTab" />
118
- </a>
119
- </div>
120
- )
121
- ) : null}
122
- </div>
123
- <div className="daf-tooltip-list">
124
- {items &&
125
- items.map((item, i) => (
126
- <div
127
- key={`tooltip-${i}-item`}
128
- className={formatClassname([
129
- "daf-tooltip-list-item",
130
- item.isTotal && "is-total",
131
- ])}
132
- >
133
- {!!item.color && (
134
- <div className="flex flex-column justify-content-center">
135
- <span
136
- className="daf-tooltip-marker"
137
- style={{ background: item.color }}
138
- />
139
- </div>
140
- )}
141
- <Tooltip title={item.label}>
142
- <span className="daf-tooltip-name">{item.label}</span>
143
- </Tooltip>
80
+ return (
81
+ <>
82
+ <div className={formatClassname(["daf-tooltip-cont", className])}>
83
+ <div className="daf-tooltip-head">
84
+ <div className="daf-tooltip-title">
85
+ <div>
86
+ <Tooltip title={title}>
87
+ <h4
88
+ className={formatClassname([
89
+ typeof total === "number" && "limited",
90
+ ])}
91
+ >
92
+ {title}
93
+ </h4>
94
+ </Tooltip>
95
+ {subTitle ? (
96
+ <h5
97
+ className={formatClassname([
98
+ typeof total === "number" && "limited",
99
+ ])}
100
+ >
101
+ {subTitle}
102
+ </h5>
103
+ ) : null}
104
+ </div>
105
+ <div style={{ height: "100%" }}>
106
+ {typeof total === "number" ? (
107
+ <div className="daf-tooltip-user-count">
108
+ <div className="flex flex-column justify-content-center">
109
+ <CustomIcon name="UsersCheck" width={13} height={13} />
110
+ </div>
111
+ <div className="flex flex-column justify-content-center">
112
+ <span>{total}</span>
113
+ </div>
114
+ </div>
115
+ ) : null}
116
+ </div>
117
+ </div>
118
+ {link ? (
119
+ typeof onClickLink === "function" || typeof link !== "string" ? (
120
+ <div className="flex flex-column">
121
+ <div className="link-cont" onClick={onClickLink}>
122
+ <CustomIcon width={10} height={10} name="Link" />
123
+ </div>
124
+ </div>
125
+ ) : (
126
+ <div className="flex flex-column">
127
+ <a
128
+ href={link}
129
+ className="link-cont"
130
+ target="_blank"
131
+ rel="noopener noreferrer"
132
+ >
133
+ <CustomIcon width={10} height={10} name="LinkNewTab" />
134
+ </a>
135
+ </div>
136
+ )
137
+ ) : null}
138
+ </div>
139
+ <div className="daf-tooltip-list">
140
+ {items &&
141
+ items.map((item, i) => (
142
+ <div
143
+ key={`tooltip-${i}-item`}
144
+ className={formatClassname([
145
+ "daf-tooltip-list-item",
146
+ item.isTotal && "is-total",
147
+ ])}
148
+ >
149
+ {!!item.color && (
150
+ <div className="flex flex-column justify-content-center">
151
+ <span
152
+ className="daf-tooltip-marker"
153
+ style={{ background: item.color }}
154
+ />
155
+ </div>
156
+ )}
157
+ <Tooltip title={item.label}>
158
+ <span className="daf-tooltip-name">{item.label}</span>
159
+ </Tooltip>
144
160
 
145
- <Tooltip title={item.value}>
146
- <div
147
- style={{
148
- height: "20px",
149
- display: "flex",
150
- alignItems: "center",
151
- }}
152
- >
153
- {item.tag ? (
154
- <Tag color={item.tag} className="mr-none">
155
- {item.value}
156
- </Tag>
157
- ) : (
158
- <span className="daf-tooltip-value">{item.value}</span>
159
- )}
160
- </div>
161
- </Tooltip>
162
- </div>
163
- ))}
164
- </div>
165
- </div>
166
- );
161
+ <Tooltip title={item.value}>
162
+ <div
163
+ style={{
164
+ height: "20px",
165
+ display: "flex",
166
+ alignItems: "center",
167
+ }}
168
+ >
169
+ {item.tag ? (
170
+ <Tag color={item.tag} className="mr-none">
171
+ {item.value}
172
+ </Tag>
173
+ ) : (
174
+ <span className="daf-tooltip-value">{item.value}</span>
175
+ )}
176
+ </div>
177
+ </Tooltip>
178
+ </div>
179
+ ))}
180
+ </div>
181
+
182
+ {tags && (
183
+ <div
184
+ style={{
185
+ gap: 4,
186
+ display: "flex",
187
+ fontSize: 12,
188
+ flexDirection: "column",
189
+ }}
190
+ >
191
+ <Tooltip title={tags.label}>
192
+ <span className="daf-tooltip-name">{tags.label}</span>
193
+ </Tooltip>
194
+ <div
195
+ style={{
196
+ display: "flex",
197
+ gap: 4,
198
+ flexWrap: "wrap",
199
+ }}
200
+ >
201
+ {tags.items.map((item, i) => (
202
+ <Tag
203
+ key={`tooltip-${i}-item`}
204
+ color={item?.color}
205
+ style={{
206
+ margin: 0,
207
+ }}
208
+ >
209
+ <Tooltip title={item.label}>
210
+ <span className="daf-tooltip-name">{item.label}</span>
211
+ </Tooltip>
212
+ </Tag>
213
+ ))}
214
+ </div>
215
+ </div>
216
+ )}
217
+ </div>
218
+ </>
219
+ );
167
220
  };