datastake-daf 0.6.320 → 0.6.322

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.
@@ -12771,6 +12771,7 @@ const useHeader = _ref => {
12771
12771
  };
12772
12772
  }, []);
12773
12773
  const maxWidth = React.useMemo(() => mainContWidth - buttonContWidth - 24, [mainContWidth, buttonContWidth]);
12774
+ console.log(buttonContWidth, mainContWidth, maxWidth);
12774
12775
  const renderMainCont = () => /*#__PURE__*/jsxRuntime.jsxs("div", {
12775
12776
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
12776
12777
  className: formatClassname(["main-cont flex", className]),
@@ -12851,8 +12852,8 @@ const useHeader = _ref => {
12851
12852
  })]
12852
12853
  }), addedHeaderFirst ? /*#__PURE__*/jsxRuntime.jsxs("div", {
12853
12854
  className: "flex gap-2",
12855
+ ref: buttonCont,
12854
12856
  children: [addedHeader, hasButtons && /*#__PURE__*/jsxRuntime.jsx("div", {
12855
- ref: buttonCont,
12856
12857
  children: /*#__PURE__*/jsxRuntime.jsx(Buttons, {
12857
12858
  extraButtons: extraButtons,
12858
12859
  actionButtons: actionButtons
@@ -12860,8 +12861,8 @@ const useHeader = _ref => {
12860
12861
  })]
12861
12862
  }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
12862
12863
  className: "flex gap-2",
12864
+ ref: buttonCont,
12863
12865
  children: [hasButtons && /*#__PURE__*/jsxRuntime.jsx("div", {
12864
- ref: buttonCont,
12865
12866
  children: /*#__PURE__*/jsxRuntime.jsx(Buttons, {
12866
12867
  extraButtons: extraButtons,
12867
12868
  actionButtons: actionButtons
@@ -50198,7 +50199,6 @@ const Style$g = dt.div`
50198
50199
  display: flex;
50199
50200
  justify-content: space-between;
50200
50201
  align-items: space-between;
50201
- ${"" /* height: ${props => props.height || '300px'}; */}
50202
50202
 
50203
50203
  .weekDay {
50204
50204
  width: 16px;
@@ -50218,7 +50218,6 @@ const Style$g = dt.div`
50218
50218
  overflow: hidden;
50219
50219
  .event {
50220
50220
  width: 100%;
50221
- ${"" /* background: blue; */}
50222
50221
  border-radius: 2px;
50223
50222
  z-index: 1;
50224
50223
  margin-top: 2px;
@@ -50245,6 +50244,30 @@ const Style$g = dt.div`
50245
50244
  }
50246
50245
  }
50247
50246
  `;
50247
+ const StyleWrapper = dt.div`
50248
+ .legend {
50249
+ display: flex;
50250
+ flex-wrap: wrap;
50251
+ gap: 12px;
50252
+ margin-top: 12px;
50253
+ font-size: 12px;
50254
+ color: #333;
50255
+ justify-content: center;
50256
+
50257
+ .legend-item {
50258
+ display: flex;
50259
+ align-items: center;
50260
+ gap: 6px;
50261
+
50262
+ .legend-color {
50263
+ width: 12px;
50264
+ height: 12px;
50265
+ border-radius: 2px;
50266
+ display: inline-block;
50267
+ }
50268
+ }
50269
+ }
50270
+ `;
50248
50271
  dt.div`
50249
50272
  width: 200px;
50250
50273
  display: flex;
@@ -50428,7 +50451,9 @@ function StackChart(_ref) {
50428
50451
  doConstraints = true,
50429
50452
  colors,
50430
50453
  valueField = "value",
50431
- height = 300
50454
+ height = 300,
50455
+ isPdf = false,
50456
+ t = s => s
50432
50457
  } = _ref;
50433
50458
  const ref = React__default["default"].useRef();
50434
50459
  const {
@@ -50556,34 +50581,53 @@ function StackChart(_ref) {
50556
50581
  }));
50557
50582
  }
50558
50583
  }, [hoveredGroup]);
50559
- return /*#__PURE__*/jsxRuntime.jsxs(Style$g, _objectSpread2(_objectSpread2({}, isEmpty ? {
50560
- onMouseEnter: () => {
50561
- setHoveredGroup({
50562
- id: 0
50563
- });
50564
- },
50565
- onMouseLeave: () => {
50566
- setHoveredGroup(null);
50567
- },
50568
- onMouseMove: e => onMouseLeaveHandler(e, {}, 0)
50569
- } : {}), {}, {
50570
- className: formatClassname(["riskProfile", className]),
50571
- ref: ref,
50572
- style: {
50573
- height: "".concat(height, "px")
50574
- },
50575
- children: [typeof renderTooltip === "function" && !isEmpty ? hoveredGroup !== null ? renderTooltip({
50576
- mouseX,
50577
- mouseY,
50578
- item: hoveredGroup
50579
- }) : null : null, /*#__PURE__*/jsxRuntime.jsx("div", {
50580
- className: "timeline",
50584
+ return /*#__PURE__*/jsxRuntime.jsxs(StyleWrapper, {
50585
+ children: [/*#__PURE__*/jsxRuntime.jsxs(Style$g, _objectSpread2(_objectSpread2({}, isEmpty ? {
50586
+ onMouseEnter: () => {
50587
+ setHoveredGroup({
50588
+ id: 0
50589
+ });
50590
+ },
50591
+ onMouseLeave: () => {
50592
+ setHoveredGroup(null);
50593
+ },
50594
+ onMouseMove: e => onMouseLeaveHandler(e, {}, 0)
50595
+ } : {}), {}, {
50596
+ className: formatClassname(["riskProfile", className]),
50597
+ ref: ref,
50581
50598
  style: {
50582
50599
  height: "".concat(height, "px")
50583
50600
  },
50584
- children: content()
50601
+ children: [typeof renderTooltip === "function" && !isEmpty ? hoveredGroup !== null ? renderTooltip({
50602
+ mouseX,
50603
+ mouseY,
50604
+ item: hoveredGroup
50605
+ }) : null : null, /*#__PURE__*/jsxRuntime.jsx("div", {
50606
+ className: "timeline",
50607
+ style: {
50608
+ height: "".concat(height, "px")
50609
+ },
50610
+ children: content()
50611
+ })]
50612
+ })), isPdf && /*#__PURE__*/jsxRuntime.jsx("div", {
50613
+ className: "legend",
50614
+ children: Object.entries(seriesColors).map(_ref4 => {
50615
+ let [series, color] = _ref4;
50616
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
50617
+ className: "legend-item",
50618
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
50619
+ className: "legend-color",
50620
+ style: {
50621
+ backgroundColor: color || token.colorPrimary7
50622
+ }
50623
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
50624
+ className: "legend-label",
50625
+ children: t(series)
50626
+ })]
50627
+ }, series);
50628
+ })
50585
50629
  })]
50586
- }));
50630
+ });
50587
50631
  }
50588
50632
 
50589
50633
  const _excluded$3 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "fillOpacity", "height", "t", "isPdf", "extraLegendConfig", "width"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.320",
3
+ "version": "0.6.322",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -417,6 +417,7 @@ export const WithCustomObject = {
417
417
  social: "#864dd7",
418
418
  environmental: "#f9b836",
419
419
  },
420
+ isPdf: true,
420
421
  },
421
422
  render: (args) => {
422
423
  return <StackChart {...args} />;
@@ -4,7 +4,6 @@ export const Style = styled.div`
4
4
  display: flex;
5
5
  justify-content: space-between;
6
6
  align-items: space-between;
7
- ${"" /* height: ${props => props.height || '300px'}; */}
8
7
 
9
8
  .weekDay {
10
9
  width: 16px;
@@ -24,7 +23,6 @@ export const Style = styled.div`
24
23
  overflow: hidden;
25
24
  .event {
26
25
  width: 100%;
27
- ${"" /* background: blue; */}
28
26
  border-radius: 2px;
29
27
  z-index: 1;
30
28
  margin-top: 2px;
@@ -52,6 +50,31 @@ export const Style = styled.div`
52
50
  }
53
51
  `;
54
52
 
53
+ export const StyleWrapper = styled.div`
54
+ .legend {
55
+ display: flex;
56
+ flex-wrap: wrap;
57
+ gap: 12px;
58
+ margin-top: 12px;
59
+ font-size: 12px;
60
+ color: #333;
61
+ justify-content: center;
62
+
63
+ .legend-item {
64
+ display: flex;
65
+ align-items: center;
66
+ gap: 6px;
67
+
68
+ .legend-color {
69
+ width: 12px;
70
+ height: 12px;
71
+ border-radius: 2px;
72
+ display: inline-block;
73
+ }
74
+ }
75
+ }
76
+ `;
77
+
55
78
  export const EventsTooltip = styled.div`
56
79
  width: 200px;
57
80
  display: flex;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { Style } from "./classes.js";
2
+ import { Style, StyleWrapper } from "./classes.js";
3
3
  import { formatClassname } from "../../../../../helpers/ClassesHelper";
4
4
  import { Popover, theme } from "antd";
5
5
  import { renderTooltipJsx as renderDafTooltip } from "../../../../utils/tooltip.js";
@@ -83,6 +83,8 @@ export default function StackChart({
83
83
  colors,
84
84
  valueField = "value",
85
85
  height = 300,
86
+ isPdf = false,
87
+ t = (s) => s,
86
88
  }) {
87
89
  const ref = React.useRef();
88
90
  const { token } = useToken();
@@ -228,6 +230,7 @@ export default function StackChart({
228
230
  );
229
231
 
230
232
  return (
233
+ <StyleWrapper>
231
234
  <Style
232
235
  {...(isEmpty
233
236
  ? {
@@ -255,5 +258,19 @@ export default function StackChart({
255
258
  {content()}
256
259
  </div>
257
260
  </Style>
261
+ {isPdf && (
262
+ <div className="legend">
263
+ {Object.entries(seriesColors).map(([series, color]) => (
264
+ <div key={series} className="legend-item">
265
+ <span
266
+ className="legend-color"
267
+ style={{ backgroundColor: color || token.colorPrimary7 }}
268
+ />
269
+ <span className="legend-label">{t(series)}</span>
270
+ </div>
271
+ ))}
272
+ </div>
273
+ )}
274
+ </StyleWrapper>
258
275
  );
259
276
  }
@@ -150,6 +150,8 @@ export const useHeader = ({
150
150
  [mainContWidth, buttonContWidth],
151
151
  );
152
152
 
153
+ console.log(buttonContWidth, mainContWidth, maxWidth);
154
+
153
155
  const renderMainCont = () => (
154
156
  <div>
155
157
  <div className={formatClassname(["main-cont flex", className])} ref={mainCont}>
@@ -243,10 +245,10 @@ export const useHeader = ({
243
245
  </div>
244
246
 
245
247
  {addedHeaderFirst ? (
246
- <div className="flex gap-2">
248
+ <div className="flex gap-2" ref={buttonCont}>
247
249
  {addedHeader}
248
250
  {hasButtons && (
249
- <div ref={buttonCont}>
251
+ <div>
250
252
  <Buttons
251
253
  extraButtons={extraButtons}
252
254
  actionButtons={actionButtons}
@@ -255,9 +257,9 @@ export const useHeader = ({
255
257
  )}
256
258
  </div>
257
259
  ) : (
258
- <div className="flex gap-2">
260
+ <div className="flex gap-2" ref={buttonCont}>
259
261
  {hasButtons && (
260
- <div ref={buttonCont}>
262
+ <div>
261
263
  <Buttons
262
264
  extraButtons={extraButtons}
263
265
  actionButtons={actionButtons}