ag-common 0.0.654 → 0.0.656
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/ui/components/LineChart/Base.js +11 -2
- package/dist/ui/components/LineChart/TooltipContent.d.ts +2 -1
- package/dist/ui/components/LineChart/TooltipContent.js +2 -2
- package/dist/ui/components/LineChart/dateHelpers.d.ts +1 -0
- package/dist/ui/components/LineChart/dateHelpers.js +9 -1
- package/dist/ui/components/LineChart/interpolate.d.ts +1 -0
- package/dist/ui/components/LineChart/interpolate.js +2 -0
- package/package.json +1 -1
|
@@ -34,6 +34,12 @@ const Svg = styled_1.default.svg `
|
|
|
34
34
|
padding: 2px;
|
|
35
35
|
width: calc(100% - 5px);
|
|
36
36
|
height: calc(100% - 5px);
|
|
37
|
+
|
|
38
|
+
@keyframes dash {
|
|
39
|
+
to {
|
|
40
|
+
stroke-dashoffset: 1000;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
37
43
|
`;
|
|
38
44
|
const LineChart = (p) => {
|
|
39
45
|
var _a;
|
|
@@ -97,10 +103,13 @@ const LineChart = (p) => {
|
|
|
97
103
|
return (react_1.default.createElement(react_1.default.Fragment, { key: JSON.stringify(p2) },
|
|
98
104
|
(p2.origX === ((_c = (_b = (_a = UT.pos) === null || _a === void 0 ? void 0 : _a.data.selectedXs) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.x) ||
|
|
99
105
|
p2.x1 === p2.x2) && (react_1.default.createElement("circle", { cx: `${p2.x2}%`, cy: `${p2.y2}%`, r: "8px", fill: p.colours[p2.name] })),
|
|
100
|
-
p2.x1 !== p2.x2 && (react_1.default.createElement("line", { strokeOpacity: legendItems.part.find((f) => f.name === p2.name) ? 1 : 0.3, x1: `${p2.x1}%`, x2: `${p2.x2}%`, y1: `${p2.y1}%`, y2: `${p2.y2}%`, style: { stroke: p.colours[p2.name] }
|
|
106
|
+
p2.x1 !== p2.x2 && (react_1.default.createElement("line", { strokeOpacity: legendItems.part.find((f) => f.name === p2.name) ? 1 : 0.3, x1: `${p2.x1}%`, x2: `${p2.x2}%`, y1: `${p2.y1}%`, y2: `${p2.y2}%`, style: Object.assign({ stroke: p.colours[p2.name] }, (p2.isToday && {
|
|
107
|
+
strokeDasharray: 10,
|
|
108
|
+
animation: 'dash 50s linear reverse infinite',
|
|
109
|
+
})) }))));
|
|
101
110
|
})));
|
|
102
111
|
return (react_1.default.createElement(Base, { className: p.className, "data-type": "lcb", onMouseLeave: () => UT.setPos(undefined), style: style },
|
|
103
|
-
react_1.default.createElement(UT.Comp, { pos: UT.pos }, (p2) => (react_1.default.createElement(TooltipContent_1.TooltipContent, Object.assign({}, p2, { colours: p.colours, data: p.data, lt: lt2, tt: tt2, legendItems: legendItems })))),
|
|
112
|
+
react_1.default.createElement(UT.Comp, { pos: UT.pos }, (p2) => (react_1.default.createElement(TooltipContent_1.TooltipContent, Object.assign({}, p2, { colours: p.colours, data: p.data, lt: lt2, tt: tt2, legendItems: legendItems, style: style })))),
|
|
104
113
|
react_1.default.createElement(FlexRow_1.FlexRow, { noWrap: true },
|
|
105
114
|
react_1.default.createElement(LegendY_1.LegendY, { data: p.data, style: style }),
|
|
106
115
|
SvgC),
|
|
@@ -4,4 +4,5 @@ import type { ILegendItems } from './getLegendItems';
|
|
|
4
4
|
import type { ILineChartTooltip } from './types';
|
|
5
5
|
export declare const TooltipContent: (p: ILineChartTooltip & {
|
|
6
6
|
legendItems: ILegendItems;
|
|
7
|
-
|
|
7
|
+
style: IVarStyles;
|
|
8
|
+
}) => React.JSX.Element;
|
|
@@ -31,10 +31,10 @@ const Total = styled_1.default.span `
|
|
|
31
31
|
text-decoration: underline;
|
|
32
32
|
}
|
|
33
33
|
`;
|
|
34
|
-
const TooltipContent = (p
|
|
34
|
+
const TooltipContent = (p) => {
|
|
35
35
|
var _a, _b, _c, _d;
|
|
36
36
|
const name = (_d = (_a = p.tt) === null || _a === void 0 ? void 0 : _a.call(p, (_c = (_b = p.selectedXs) === null || _b === void 0 ? void 0 : _b[0].x) !== null && _c !== void 0 ? _c : 0)) !== null && _d !== void 0 ? _d : '';
|
|
37
|
-
return (react_1.default.createElement(Base, { style: Object.assign(Object.assign({}, style), { border: `solid 1px ${style.borderColor}` }) },
|
|
37
|
+
return (react_1.default.createElement(Base, { style: Object.assign(Object.assign({}, p.style), { border: `solid 1px ${p.style.borderColor}` }) },
|
|
38
38
|
react_1.default.createElement(Title, null, name),
|
|
39
39
|
react_1.default.createElement(Row, null,
|
|
40
40
|
react_1.default.createElement("span", null, "total"),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.timeTooltipTitle = exports.timeLegendTitle = void 0;
|
|
3
|
+
exports.isToday = exports.timeTooltipTitle = exports.timeLegendTitle = void 0;
|
|
4
4
|
const date_1 = require("../../helpers/date");
|
|
5
5
|
const timeLegendTitle = (s) => {
|
|
6
6
|
const ret = (0, date_1.getDMY)(new Date(s), { short: true });
|
|
@@ -26,3 +26,11 @@ const timeTooltipTitle = (s) => {
|
|
|
26
26
|
return `${dmy} ${diff}`;
|
|
27
27
|
};
|
|
28
28
|
exports.timeTooltipTitle = timeTooltipTitle;
|
|
29
|
+
const isToday = (s) => {
|
|
30
|
+
if (!s) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
const td = new Date().getTime() - Number(s);
|
|
34
|
+
return td < 0;
|
|
35
|
+
};
|
|
36
|
+
exports.isToday = isToday;
|
|
@@ -4,6 +4,7 @@ exports.interpolate = void 0;
|
|
|
4
4
|
const common_1 = require("../../../common");
|
|
5
5
|
const math_1 = require("../../../common/helpers/math");
|
|
6
6
|
const date_1 = require("../../helpers/date");
|
|
7
|
+
const dateHelpers_1 = require("./dateHelpers");
|
|
7
8
|
const interpolate = (raw) => {
|
|
8
9
|
const points = [];
|
|
9
10
|
const xs = raw.map((r) => r.x);
|
|
@@ -46,6 +47,7 @@ const interpolate = (raw) => {
|
|
|
46
47
|
name: p.name,
|
|
47
48
|
origX: p.x,
|
|
48
49
|
origY: p.y,
|
|
50
|
+
isToday: (0, dateHelpers_1.isToday)(p.x),
|
|
49
51
|
};
|
|
50
52
|
});
|
|
51
53
|
points.push(...(0, common_1.distinctBy)(p, (s) => JSON.stringify(s)));
|
package/package.json
CHANGED