@spteck/fluentui-react-charts 1.0.6 → 1.0.8
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/charts/BarChart/BarChart.d.ts +2 -1
- package/dist/charts/ComboChart/ComboChart.d.ts +2 -1
- package/dist/charts/Doughnut/DoughnutChart.d.ts +2 -1
- package/dist/charts/PieChart/PieChart.d.ts +2 -1
- package/dist/charts/areaChart/AreaChart.d.ts +2 -1
- package/dist/charts/barHorizontalChart/BarHotizontalChart.d.ts +2 -1
- package/dist/charts/bubbleChart/BubbleChart.d.ts +2 -1
- package/dist/charts/floatBarChart/FloatBarChart.d.ts +2 -1
- package/dist/charts/index.d.ts +14 -0
- package/dist/charts/lineChart/LineChart.d.ts +2 -1
- package/dist/charts/polarChart/PolarChart.d.ts +2 -1
- package/dist/charts/radarChart/RadarChart.d.ts +2 -1
- package/dist/charts/scatterChart/ScatterChart.d.ts +2 -1
- package/dist/charts/stackedLineChart/StackedLineChart.d.ts +2 -1
- package/dist/charts/steamChart/SteamChart.d.ts +2 -1
- package/dist/components/index.d.ts +0 -14
- package/dist/fluentui-react-charts.cjs.development.js +1367 -1066
- package/dist/fluentui-react-charts.cjs.development.js.map +1 -1
- package/dist/fluentui-react-charts.cjs.production.min.js +1 -1
- package/dist/fluentui-react-charts.cjs.production.min.js.map +1 -1
- package/dist/fluentui-react-charts.esm.js +1353 -1066
- package/dist/fluentui-react-charts.esm.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +4 -4
- package/src/assets/sample1.png +0 -0
- package/src/assets/sample2.png +0 -0
- package/src/assets/sample3.png +0 -0
- package/src/charts/BarChart/BarChart.tsx +0 -227
- package/src/charts/BarChart/README.MD +0 -335
- package/src/charts/BarChart/index.ts +0 -1
- package/src/charts/ComboChart/ComboChart.tsx +0 -209
- package/src/charts/ComboChart/README.MD +0 -347
- package/src/charts/ComboChart/index.ts +0 -1
- package/src/charts/Doughnut/DoughnutChart.tsx +0 -152
- package/src/charts/Doughnut/README.MD +0 -296
- package/src/charts/Doughnut/index.ts +0 -1
- package/src/charts/PieChart/PieChart.tsx +0 -148
- package/src/charts/PieChart/README.MD +0 -315
- package/src/charts/PieChart/index.ts +0 -1
- package/src/charts/areaChart/AreaChart.tsx +0 -195
- package/src/charts/areaChart/README.MD +0 -236
- package/src/charts/areaChart/index.ts +0 -1
- package/src/charts/barHorizontalChart/BarHotizontalChart.tsx +0 -200
- package/src/charts/barHorizontalChart/README.MD +0 -278
- package/src/charts/barHorizontalChart/index.ts +0 -2
- package/src/charts/bubbleChart/BubbleChart.tsx +0 -184
- package/src/charts/bubbleChart/README.MD +0 -275
- package/src/charts/bubbleChart/index.ts +0 -1
- package/src/charts/floatBarChart/FloatBarChart.tsx +0 -178
- package/src/charts/floatBarChart/README.MD +0 -354
- package/src/charts/floatBarChart/index.ts +0 -1
- package/src/charts/lineChart/LineChart.tsx +0 -200
- package/src/charts/lineChart/README.MD +0 -354
- package/src/charts/lineChart/index.ts +0 -1
- package/src/charts/polarChart/PolarChart.tsx +0 -161
- package/src/charts/polarChart/README.MD +0 -336
- package/src/charts/polarChart/index.ts +0 -1
- package/src/charts/radarChart/README.MD +0 -388
- package/src/charts/radarChart/RadarChart.tsx +0 -173
- package/src/charts/radarChart/index.ts +0 -1
- package/src/charts/scatterChart/README.MD +0 -335
- package/src/charts/scatterChart/ScatterChart.tsx +0 -155
- package/src/charts/scatterChart/index.ts +0 -1
- package/src/charts/stackedLineChart/README.MD +0 -396
- package/src/charts/stackedLineChart/StackedLineChart.tsx +0 -188
- package/src/charts/stackedLineChart/index.ts +0 -1
- package/src/charts/steamChart/README.MD +0 -414
- package/src/charts/steamChart/SteamChart.tsx +0 -236
- package/src/charts/steamChart/index.ts +0 -1
- package/src/components/RenderLabel/RenderLabel.tsx +0 -39
- package/src/components/RenderLabel/index.ts +0 -2
- package/src/components/RenderLabel/useRenderLabelStylesStyles.ts +0 -25
- package/src/components/RenderLegend/RenderLegend.tsx +0 -40
- package/src/components/RenderTooltip/RenderTooltip.tsx +0 -111
- package/src/components/buttonMenu/ButtonMenu.tsx +0 -186
- package/src/components/buttonMenu/IButtonMenuOption.ts +0 -9
- package/src/components/buttonMenu/IButtonMenuProps.tsx +0 -40
- package/src/components/dashboard/DashBoard.tsx +0 -314
- package/src/components/dashboard/ExampleDashboardUsage.tsx +0 -114
- package/src/components/dashboard/IDashboardProps.tsx +0 -11
- package/src/components/dashboard/NoDashboards.tsx +0 -26
- package/src/components/dashboard/index.ts +0 -3
- package/src/components/dashboard/selectZoom/SelectZoom.tsx +0 -189
- package/src/components/dashboard/useDashboardStyles.ts +0 -76
- package/src/components/index.ts +0 -17
- package/src/components/legendContainer/LegendContainer.tsx +0 -118
- package/src/components/legendeButton/LegendButton.tsx +0 -57
- package/src/components/renderSliceLegend/RenderSliceLegend.tsx +0 -46
- package/src/components/renderValueLegend/RenderValueLegend.tsx +0 -43
- package/src/components/stack/IStackProps.tsx +0 -94
- package/src/components/stack/Stack.tsx +0 -103
- package/src/components/svgImages/BusinessReportIcon.tsx +0 -218
- package/src/components/themeProvider/ThemeProvider.tsx +0 -48
- package/src/constants/Constants.tsx +0 -23
- package/src/graphGlobalStyles/useGraphGlobalStyles.ts +0 -28
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useChartFactory.tsx +0 -136
- package/src/hooks/useChartUtils.tsx +0 -187
- package/src/hooks/useIndexedDBCache.ts +0 -122
- package/src/hooks/useResponsiveLegend.ts +0 -35
- package/src/index.tsx +0 -5
- package/src/models/ChartDatum.ts +0 -4
- package/src/models/ICardChartContainer.tsx +0 -11
- package/src/models/IChart.ts +0 -50
- package/src/models/index.ts +0 -3
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React__default, {
|
|
3
|
-
import { Bar, Chart as Chart$1, Line, Bubble, Doughnut, Pie, PolarArea, Radar, Scatter } from 'react-chartjs-2';
|
|
4
|
-
import ChartDataLabels from 'chartjs-plugin-datalabels';
|
|
5
|
-
import { Tooltip, Button, tokens, Caption1, mergeClasses, Menu, MenuTrigger, MenuButton, MenuPopover, MenuList, MenuItem, webLightTheme, Text, makeStyles, shorthands, ToggleButton, Card, CardHeader } from '@fluentui/react-components';
|
|
1
|
+
import { tokens, mergeClasses, Text, makeStyles, shorthands, Caption1, Menu, MenuTrigger, Tooltip, MenuButton, MenuPopover, Button, MenuList, MenuItem, webLightTheme, ToggleButton, Card, CardHeader } from '@fluentui/react-components';
|
|
2
|
+
import React__default, { createElement, Fragment, isValidElement, useState, useEffect, useMemo, useRef, useCallback } from 'react';
|
|
6
3
|
import { css } from '@emotion/css';
|
|
7
|
-
import { ResizeObserver } from '@juggle/resize-observer';
|
|
8
4
|
import { bundleIcon, Settings20Filled, Settings20Regular } from '@fluentui/react-icons';
|
|
9
5
|
import { Icon } from '@iconify/react';
|
|
10
|
-
import {
|
|
6
|
+
import { Chart, CategoryScale, LinearScale, PointElement, LineElement, Tooltip as Tooltip$1, Filler, Legend, Title, BarElement, ArcElement, RadialLinearScale } from 'chart.js';
|
|
7
|
+
import ChartDataLabels from 'chartjs-plugin-datalabels';
|
|
8
|
+
import { Line, Bar, Bubble, Chart as Chart$1, Doughnut, Pie, PolarArea, Radar, Scatter } from 'react-chartjs-2';
|
|
9
|
+
import { ResizeObserver } from '@juggle/resize-observer';
|
|
10
|
+
import { openDB } from 'idb';
|
|
11
11
|
|
|
12
|
+
function _arrayLikeToArray(r, a) {
|
|
13
|
+
(null == a || a > r.length) && (a = r.length);
|
|
14
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
15
|
+
return n;
|
|
16
|
+
}
|
|
12
17
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
13
18
|
try {
|
|
14
19
|
var i = n[a](c),
|
|
@@ -34,6 +39,23 @@ function _asyncToGenerator(n) {
|
|
|
34
39
|
});
|
|
35
40
|
};
|
|
36
41
|
}
|
|
42
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
43
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
44
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
45
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
46
|
+
t && (r = t);
|
|
47
|
+
var o = 0;
|
|
48
|
+
return function () {
|
|
49
|
+
return o >= r.length ? {
|
|
50
|
+
done: !0
|
|
51
|
+
} : {
|
|
52
|
+
done: !1,
|
|
53
|
+
value: r[o++]
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
58
|
+
}
|
|
37
59
|
function _extends() {
|
|
38
60
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
39
61
|
for (var e = 1; e < arguments.length; e++) {
|
|
@@ -156,212 +178,220 @@ function _regeneratorDefine(e, r, n, t) {
|
|
|
156
178
|
function _taggedTemplateLiteralLoose(e, t) {
|
|
157
179
|
return t || (t = e.slice(0)), e.raw = t, e;
|
|
158
180
|
}
|
|
181
|
+
function _unsupportedIterableToArray(r, a) {
|
|
182
|
+
if (r) {
|
|
183
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
184
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
185
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
159
188
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
* Smart Fluent tooltip generator with chart-type awareness.
|
|
182
|
-
*/
|
|
183
|
-
function createFluentTooltip(theme) {
|
|
184
|
-
var fontFamily = theme.fontFamilyBase;
|
|
185
|
-
var fontSize = parseInt(theme.fontSizeBase200.replace('px', '')) || 14;
|
|
186
|
-
var tooltipBg = theme.colorNeutralBackground1;
|
|
187
|
-
var tooltipTitleColor = theme.colorNeutralForeground1;
|
|
188
|
-
var tooltipBodyColor = theme.colorNeutralForeground2;
|
|
189
|
-
var borderColor = theme.colorNeutralStroke2;
|
|
190
|
-
var callbacks = {
|
|
191
|
-
title: function title(context) {
|
|
192
|
-
var _context$0$label, _context$;
|
|
193
|
-
return (_context$0$label = (_context$ = context[0]) == null ? void 0 : _context$.label) != null ? _context$0$label : '';
|
|
189
|
+
var BusinessReportIcon = function BusinessReportIcon(_ref) {
|
|
190
|
+
var _ref$width = _ref.width,
|
|
191
|
+
width = _ref$width === void 0 ? 200 : _ref$width,
|
|
192
|
+
_ref$height = _ref.height,
|
|
193
|
+
height = _ref$height === void 0 ? 200 : _ref$height,
|
|
194
|
+
className = _ref.className,
|
|
195
|
+
style = _ref.style;
|
|
196
|
+
return React__default.createElement("svg", {
|
|
197
|
+
width: width,
|
|
198
|
+
height: height,
|
|
199
|
+
viewBox: "200 400 1400 1000",
|
|
200
|
+
className: className,
|
|
201
|
+
style: _extends({
|
|
202
|
+
fill: tokens.colorNeutralForeground2
|
|
203
|
+
}, style),
|
|
204
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
205
|
+
}, React__default.createElement("g", {
|
|
206
|
+
id: "BACKGROUND"
|
|
207
|
+
}, React__default.createElement("rect", {
|
|
208
|
+
style: {
|
|
209
|
+
fill: tokens.colorNeutralBackground1
|
|
194
210
|
},
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
// Scatter format { x, y }
|
|
206
|
-
if (typeof raw === 'object' && raw !== null && 'x' in raw && 'y' in raw) {
|
|
207
|
-
var _x = raw.x,
|
|
208
|
-
_y = raw.y;
|
|
209
|
-
return datasetLabel + " \u2014 x: " + _x + ", y: " + _y;
|
|
210
|
-
}
|
|
211
|
-
// Floating bar [min, max]
|
|
212
|
-
if (Array.isArray(raw) && raw.length === 2) {
|
|
213
|
-
var min = raw[0],
|
|
214
|
-
max = raw[1];
|
|
215
|
-
return datasetLabel + ": " + min + " \u2013 " + max;
|
|
216
|
-
}
|
|
217
|
-
// Default: single number or string
|
|
218
|
-
return datasetLabel + ": " + raw;
|
|
211
|
+
x: "200",
|
|
212
|
+
y: "400",
|
|
213
|
+
width: "1400",
|
|
214
|
+
height: "1000"
|
|
215
|
+
})), React__default.createElement("g", null, React__default.createElement("g", null, React__default.createElement("rect", {
|
|
216
|
+
x: "486.006",
|
|
217
|
+
y: "568.026",
|
|
218
|
+
style: {
|
|
219
|
+
fill: tokens.colorNeutralBackground1
|
|
219
220
|
},
|
|
220
|
-
|
|
221
|
-
|
|
221
|
+
width: "1038.994",
|
|
222
|
+
height: "768.164"
|
|
223
|
+
}), React__default.createElement("path", {
|
|
224
|
+
style: {
|
|
225
|
+
fill: tokens.colorNeutralStroke1
|
|
222
226
|
},
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
d: "M1527.5,1338.69H483.506V565.526H1527.5V1338.69z M488.506,1333.69H1522.5V570.526H488.506V1333.69z"
|
|
228
|
+
})), React__default.createElement("g", null, React__default.createElement("rect", {
|
|
229
|
+
x: "558.003",
|
|
230
|
+
y: "1086.698",
|
|
231
|
+
style: {
|
|
232
|
+
fill: tokens.colorNeutralForeground3,
|
|
233
|
+
opacity: 0.3
|
|
225
234
|
},
|
|
226
|
-
|
|
227
|
-
|
|
235
|
+
width: "85",
|
|
236
|
+
height: "164.492"
|
|
237
|
+
}), React__default.createElement("rect", {
|
|
238
|
+
x: "693.003",
|
|
239
|
+
y: "1004.672",
|
|
240
|
+
style: {
|
|
241
|
+
fill: tokens.colorNeutralForeground3,
|
|
242
|
+
opacity: 0.3
|
|
228
243
|
},
|
|
229
|
-
|
|
230
|
-
|
|
244
|
+
width: "85",
|
|
245
|
+
height: "246.519"
|
|
246
|
+
}), React__default.createElement("rect", {
|
|
247
|
+
x: "828.003",
|
|
248
|
+
y: "835.487",
|
|
249
|
+
style: {
|
|
250
|
+
fill: tokens.colorNeutralForeground3,
|
|
251
|
+
opacity: 0.3
|
|
231
252
|
},
|
|
232
|
-
|
|
233
|
-
|
|
253
|
+
width: "85",
|
|
254
|
+
height: "415.703"
|
|
255
|
+
}), React__default.createElement("rect", {
|
|
256
|
+
x: "963.003",
|
|
257
|
+
y: "955.6",
|
|
258
|
+
style: {
|
|
259
|
+
fill: tokens.colorNeutralForeground3,
|
|
260
|
+
opacity: 0.3
|
|
234
261
|
},
|
|
235
|
-
|
|
236
|
-
|
|
262
|
+
width: "85",
|
|
263
|
+
height: "295.591"
|
|
264
|
+
}), React__default.createElement("rect", {
|
|
265
|
+
x: "1098.003",
|
|
266
|
+
y: "825.238",
|
|
267
|
+
style: {
|
|
268
|
+
fill: tokens.colorNeutralForeground3,
|
|
269
|
+
opacity: 0.3
|
|
237
270
|
},
|
|
238
|
-
|
|
239
|
-
|
|
271
|
+
width: "85",
|
|
272
|
+
height: "425.952"
|
|
273
|
+
}), React__default.createElement("rect", {
|
|
274
|
+
x: "1233.003",
|
|
275
|
+
y: "847.489",
|
|
276
|
+
style: {
|
|
277
|
+
fill: tokens.colorNeutralForeground3,
|
|
278
|
+
opacity: 0.3
|
|
240
279
|
},
|
|
241
|
-
|
|
242
|
-
|
|
280
|
+
width: "85",
|
|
281
|
+
height: "403.701"
|
|
282
|
+
}), React__default.createElement("rect", {
|
|
283
|
+
x: "1368.003",
|
|
284
|
+
y: "699.989",
|
|
285
|
+
style: {
|
|
286
|
+
fill: tokens.colorNeutralForeground3,
|
|
287
|
+
opacity: 0.3
|
|
243
288
|
},
|
|
244
|
-
|
|
245
|
-
|
|
289
|
+
width: "85",
|
|
290
|
+
height: "551.201"
|
|
291
|
+
}), React__default.createElement("polygon", {
|
|
292
|
+
style: {
|
|
293
|
+
fill: tokens.colorBrandBackground
|
|
246
294
|
},
|
|
247
|
-
|
|
248
|
-
|
|
295
|
+
points: "583.634,1185.919 581.366,1181.462 723.336,1109.231 869.748,909.808 1003.791,1050.114 1141.593,912.312 1275.235,928.549 1409.365,774.548 1413.135,777.833 1277.265,933.832 1143.407,917.569 1003.709,1057.267 870.251,917.573 726.664,1113.149"
|
|
296
|
+
})), React__default.createElement("rect", {
|
|
297
|
+
x: "796.336",
|
|
298
|
+
y: "662.857",
|
|
299
|
+
style: {
|
|
300
|
+
fill: tokens.colorBrandBackground
|
|
249
301
|
},
|
|
250
|
-
|
|
251
|
-
|
|
302
|
+
width: "418.333",
|
|
303
|
+
height: "5"
|
|
304
|
+
}), React__default.createElement("rect", {
|
|
305
|
+
x: "937.543",
|
|
306
|
+
y: "717.857",
|
|
307
|
+
style: {
|
|
308
|
+
fill: tokens.colorBrandBackground
|
|
252
309
|
},
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
};
|
|
261
|
-
return {
|
|
262
|
-
enabled: true,
|
|
263
|
-
displayColors: true,
|
|
264
|
-
boxWidth: 10,
|
|
265
|
-
boxHeight: 10,
|
|
266
|
-
boxPadding: 5,
|
|
267
|
-
backgroundColor: tooltipBg,
|
|
268
|
-
borderColor: borderColor,
|
|
269
|
-
borderWidth: 1,
|
|
270
|
-
cornerRadius: 4,
|
|
271
|
-
padding: 10,
|
|
272
|
-
titleColor: tooltipTitleColor,
|
|
273
|
-
bodyColor: tooltipBodyColor,
|
|
274
|
-
titleFont: {
|
|
275
|
-
family: fontFamily,
|
|
276
|
-
size: fontSize
|
|
310
|
+
width: "135.92",
|
|
311
|
+
height: "5"
|
|
312
|
+
})), React__default.createElement("g", null, React__default.createElement("g", null, React__default.createElement("rect", {
|
|
313
|
+
x: "264.978",
|
|
314
|
+
y: "441.049",
|
|
315
|
+
style: {
|
|
316
|
+
fill: tokens.colorNeutralBackground1
|
|
277
317
|
},
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
318
|
+
width: "482.581",
|
|
319
|
+
height: "379.067"
|
|
320
|
+
}), React__default.createElement("path", {
|
|
321
|
+
style: {
|
|
322
|
+
fill: tokens.colorNeutralStroke1
|
|
281
323
|
},
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
* Returns a Chart.js ticks callback to truncate long labels and add optional prefix/suffix.
|
|
287
|
-
*/
|
|
288
|
-
var createAxisLabelFormatter = function createAxisLabelFormatter(_ref) {
|
|
289
|
-
var _ref$maxLength = _ref.maxLength,
|
|
290
|
-
maxLength = _ref$maxLength === void 0 ? 12 : _ref$maxLength,
|
|
291
|
-
_ref$suffix = _ref.suffix,
|
|
292
|
-
suffix = _ref$suffix === void 0 ? '' : _ref$suffix,
|
|
293
|
-
_ref$prefix = _ref.prefix,
|
|
294
|
-
prefix = _ref$prefix === void 0 ? '' : _ref$prefix;
|
|
295
|
-
return function (value) {
|
|
296
|
-
var label = typeof value === 'number' ? this.getLabelForValue(value) : String(value);
|
|
297
|
-
var trimmed = label.length > maxLength ? label.slice(0, maxLength) + '…' : label;
|
|
298
|
-
return "" + prefix + trimmed + suffix;
|
|
299
|
-
};
|
|
300
|
-
};
|
|
301
|
-
function debounce(fn, delay) {
|
|
302
|
-
var timer = null;
|
|
303
|
-
return function () {
|
|
304
|
-
var _this = this;
|
|
305
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
306
|
-
args[_key] = arguments[_key];
|
|
307
|
-
}
|
|
308
|
-
if (timer) clearTimeout(timer);
|
|
309
|
-
timer = setTimeout(function () {
|
|
310
|
-
return fn.apply(_this, args);
|
|
311
|
-
}, delay);
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* useChartUtils — shared theming and chart helpers.
|
|
316
|
-
*/
|
|
317
|
-
function useChartUtils(theme) {
|
|
318
|
-
return useMemo(function () {
|
|
319
|
-
return {
|
|
320
|
-
lightenColor: lightenColor,
|
|
321
|
-
getFluentPalette: getFluentPalette,
|
|
322
|
-
createFluentTooltip: createFluentTooltip,
|
|
323
|
-
createAxisLabelFormatter: createAxisLabelFormatter,
|
|
324
|
-
debounce: debounce
|
|
325
|
-
};
|
|
326
|
-
}, [theme]);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
var LegendButton = function LegendButton(_ref) {
|
|
330
|
-
var label = _ref.label,
|
|
331
|
-
isVisible = _ref.isVisible,
|
|
332
|
-
color = _ref.color,
|
|
333
|
-
onClick = _ref.onClick,
|
|
334
|
-
_ref$style = _ref.style,
|
|
335
|
-
style = _ref$style === void 0 ? {} : _ref$style,
|
|
336
|
-
buttonRef = _ref.buttonRef;
|
|
337
|
-
return React__default.createElement(Tooltip, {
|
|
338
|
-
content: label,
|
|
339
|
-
relationship: "label"
|
|
340
|
-
}, React__default.createElement(Button, {
|
|
341
|
-
ref: buttonRef,
|
|
342
|
-
shape: "circular",
|
|
343
|
-
size: "small",
|
|
344
|
-
appearance: isVisible ? 'primary' : 'outline',
|
|
345
|
-
onClick: onClick,
|
|
346
|
-
style: _extends({
|
|
347
|
-
backgroundColor: isVisible ? color : 'transparent',
|
|
348
|
-
color: isVisible ? '#fff' : tokens.colorNeutralForeground1,
|
|
349
|
-
borderColor: color,
|
|
350
|
-
borderWidth: 1,
|
|
351
|
-
width: '100px',
|
|
352
|
-
padding: '4px 8px',
|
|
353
|
-
textAlign: 'center'
|
|
354
|
-
}, style)
|
|
355
|
-
}, React__default.createElement(Caption1, {
|
|
356
|
-
as: "span",
|
|
324
|
+
d: "M750.06,822.616H262.478V438.549H750.06V822.616z M267.478,817.616H745.06V443.549H267.478V817.616z"
|
|
325
|
+
})), React__default.createElement("g", null, React__default.createElement("g", null, React__default.createElement("rect", {
|
|
326
|
+
x: "330.537",
|
|
327
|
+
y: "503.15",
|
|
357
328
|
style: {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
329
|
+
fill: tokens.colorNeutralForeground3,
|
|
330
|
+
opacity: 0.3
|
|
331
|
+
},
|
|
332
|
+
width: "108.842",
|
|
333
|
+
height: "61.633"
|
|
334
|
+
}), React__default.createElement("g", null, React__default.createElement("rect", {
|
|
335
|
+
x: "485.277",
|
|
336
|
+
y: "509.093",
|
|
337
|
+
style: {
|
|
338
|
+
fill: tokens.colorBrandBackground
|
|
339
|
+
},
|
|
340
|
+
width: "198.014",
|
|
341
|
+
height: "2.623"
|
|
342
|
+
}), React__default.createElement("rect", {
|
|
343
|
+
x: "485.277",
|
|
344
|
+
y: "532.656",
|
|
345
|
+
style: {
|
|
346
|
+
fill: tokens.colorNeutralForeground3,
|
|
347
|
+
opacity: 0.3
|
|
348
|
+
},
|
|
349
|
+
width: "198.014",
|
|
350
|
+
height: "2.623"
|
|
351
|
+
}), React__default.createElement("rect", {
|
|
352
|
+
x: "485.277",
|
|
353
|
+
y: "556.218",
|
|
354
|
+
style: {
|
|
355
|
+
fill: tokens.colorNeutralForeground3,
|
|
356
|
+
opacity: 0.3
|
|
357
|
+
},
|
|
358
|
+
width: "198.014",
|
|
359
|
+
height: "2.623"
|
|
360
|
+
}))), React__default.createElement("g", null, React__default.createElement("g", null, React__default.createElement("rect", {
|
|
361
|
+
x: "381.691",
|
|
362
|
+
y: "687.747",
|
|
363
|
+
style: {
|
|
364
|
+
fill: tokens.colorNeutralForeground3,
|
|
365
|
+
opacity: 0.3
|
|
366
|
+
},
|
|
367
|
+
width: "22.73",
|
|
368
|
+
height: "70.417"
|
|
369
|
+
}), React__default.createElement("rect", {
|
|
370
|
+
x: "404.421",
|
|
371
|
+
y: "653.482",
|
|
372
|
+
style: {
|
|
373
|
+
fill: tokens.colorBrandBackground
|
|
374
|
+
},
|
|
375
|
+
width: "22.73",
|
|
376
|
+
height: "104.682"
|
|
377
|
+
})), React__default.createElement("g", null, React__default.createElement("rect", {
|
|
378
|
+
x: "466.491",
|
|
379
|
+
y: "641.634",
|
|
380
|
+
style: {
|
|
381
|
+
fill: tokens.colorNeutralForeground3,
|
|
382
|
+
opacity: 0.3
|
|
383
|
+
},
|
|
384
|
+
width: "22.73",
|
|
385
|
+
height: "116.089"
|
|
386
|
+
}), React__default.createElement("rect", {
|
|
387
|
+
x: "489.221",
|
|
388
|
+
y: "714.758",
|
|
389
|
+
style: {
|
|
390
|
+
fill: tokens.colorBrandBackground
|
|
391
|
+
},
|
|
392
|
+
width: "22.73",
|
|
393
|
+
height: "42.965"
|
|
394
|
+
}))))));
|
|
365
395
|
};
|
|
366
396
|
|
|
367
397
|
/**
|
|
@@ -438,910 +468,541 @@ var Stack = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
438
468
|
});
|
|
439
469
|
Stack.displayName = "Stack";
|
|
440
470
|
|
|
441
|
-
var
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
471
|
+
var NoDashboards = function NoDashboards(props) {
|
|
472
|
+
var height = props.height;
|
|
473
|
+
return createElement(Fragment, null, createElement(Stack, {
|
|
474
|
+
style: {
|
|
475
|
+
height: height || "100%"
|
|
476
|
+
},
|
|
477
|
+
justifyContent: "Center",
|
|
478
|
+
alignItems: "Center"
|
|
479
|
+
}, createElement(BusinessReportIcon, {
|
|
480
|
+
width: 200,
|
|
481
|
+
height: 200
|
|
482
|
+
}), createElement(Text, {
|
|
483
|
+
size: 500,
|
|
484
|
+
weight: 'semibold'
|
|
485
|
+
}, "No Dashboards Available")));
|
|
452
486
|
};
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}), overflowItems.length > 0 && React__default.createElement(Menu, null, React__default.createElement(MenuTrigger, {
|
|
484
|
-
disableButtonEnhancement: true
|
|
485
|
-
}, React__default.createElement(MenuButton, {
|
|
486
|
-
size: "small",
|
|
487
|
-
appearance: "transparent"
|
|
488
|
-
}, "+", overflowItems.length)), React__default.createElement(MenuPopover, {
|
|
487
|
+
|
|
488
|
+
var useRenderLabelStyles = /*#__PURE__*/makeStyles({
|
|
489
|
+
labelContainer: /*#__PURE__*/_extends({
|
|
490
|
+
display: "flex",
|
|
491
|
+
flexDirection: "row",
|
|
492
|
+
justifyContent: "flex-start",
|
|
493
|
+
alignItems: "center"
|
|
494
|
+
}, /*#__PURE__*/shorthands.gap("6px")),
|
|
495
|
+
iconStyles: {
|
|
496
|
+
width: "26px"
|
|
497
|
+
},
|
|
498
|
+
item: {
|
|
499
|
+
paddingLeft: "15px"
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
var RenderLabel = function RenderLabel(props) {
|
|
504
|
+
var label = props.label,
|
|
505
|
+
icon = props.icon,
|
|
506
|
+
isRequired = props.isRequired;
|
|
507
|
+
var styles = useRenderLabelStyles();
|
|
508
|
+
return createElement(Fragment, null, createElement("div", {
|
|
509
|
+
className: styles.labelContainer
|
|
510
|
+
}, icon && isValidElement(icon) ? icon : createElement(Icon, {
|
|
511
|
+
icon: icon,
|
|
512
|
+
className: styles.iconStyles,
|
|
513
|
+
width: "20px",
|
|
514
|
+
height: "20px",
|
|
515
|
+
color: tokens.colorBrandForeground1
|
|
516
|
+
}), createElement(Caption1, {
|
|
489
517
|
style: {
|
|
490
|
-
|
|
491
|
-
maxWidth: '200px'
|
|
518
|
+
color: tokens.colorBrandForeground1
|
|
492
519
|
}
|
|
493
|
-
},
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
return React__default.createElement(MenuItem, {
|
|
497
|
-
key: label,
|
|
498
|
-
style: {
|
|
499
|
-
padding: 0
|
|
500
|
-
}
|
|
501
|
-
}, React__default.createElement(LegendButton, {
|
|
502
|
-
label: renderLabel(item),
|
|
503
|
-
color: getColor(item),
|
|
504
|
-
isVisible: isVisible,
|
|
505
|
-
onClick: function onClick() {
|
|
506
|
-
return toggleLabel(label);
|
|
507
|
-
},
|
|
508
|
-
style: {
|
|
509
|
-
width: '100px',
|
|
510
|
-
textAlign: 'left'
|
|
511
|
-
}
|
|
512
|
-
}));
|
|
513
|
-
}))))));
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
var BUTTON_WIDTH = 100;
|
|
517
|
-
var GAP = 10;
|
|
518
|
-
function useResponsiveLegend(items) {
|
|
519
|
-
var containerRef = useRef(null);
|
|
520
|
-
var _useState = useState(items.length),
|
|
521
|
-
maxVisible = _useState[0],
|
|
522
|
-
setMaxVisible = _useState[1];
|
|
523
|
-
var _useChartUtils = useChartUtils(),
|
|
524
|
-
debounce = _useChartUtils.debounce;
|
|
525
|
-
useEffect(function () {
|
|
526
|
-
var measure = function measure() {
|
|
527
|
-
var _containerRef$current, _containerRef$current2;
|
|
528
|
-
var containerWidth = (_containerRef$current = (_containerRef$current2 = containerRef.current) == null ? void 0 : _containerRef$current2.offsetWidth) != null ? _containerRef$current : 0;
|
|
529
|
-
var itemTotalWidth = BUTTON_WIDTH + GAP;
|
|
530
|
-
var count = Math.floor(containerWidth / itemTotalWidth);
|
|
531
|
-
setMaxVisible(count);
|
|
532
|
-
};
|
|
533
|
-
var debouncedMeasure = debounce(measure, 100); // debounce resize
|
|
534
|
-
var observer = new ResizeObserver(debouncedMeasure);
|
|
535
|
-
if (containerRef.current) observer.observe(containerRef.current);
|
|
536
|
-
measure(); // initial
|
|
537
|
-
return function () {
|
|
538
|
-
return observer.disconnect();
|
|
539
|
-
};
|
|
540
|
-
}, [items]);
|
|
541
|
-
return {
|
|
542
|
-
containerRef: containerRef,
|
|
543
|
-
visibleItems: items.slice(0, maxVisible),
|
|
544
|
-
overflowItems: items.slice(maxVisible)
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
var RenderLegend = function RenderLegend(_ref) {
|
|
549
|
-
var data = _ref.data,
|
|
550
|
-
visibleSeries = _ref.visibleSeries,
|
|
551
|
-
seriesColors = _ref.seriesColors,
|
|
552
|
-
toggleSeries = _ref.toggleSeries;
|
|
553
|
-
var _useResponsiveLegend = useResponsiveLegend(data),
|
|
554
|
-
containerRef = _useResponsiveLegend.containerRef,
|
|
555
|
-
visibleItems = _useResponsiveLegend.visibleItems,
|
|
556
|
-
overflowItems = _useResponsiveLegend.overflowItems;
|
|
557
|
-
return React__default.createElement(LegendContainer, {
|
|
558
|
-
containerRef: containerRef,
|
|
559
|
-
visibleItems: visibleItems,
|
|
560
|
-
overflowItems: overflowItems,
|
|
561
|
-
items: data,
|
|
562
|
-
visibleLabels: visibleSeries,
|
|
563
|
-
toggleLabel: toggleSeries,
|
|
564
|
-
renderLabel: function renderLabel(d) {
|
|
565
|
-
return d.label;
|
|
566
|
-
},
|
|
567
|
-
getColor: function getColor(d) {
|
|
568
|
-
return seriesColors[d.label];
|
|
520
|
+
}, label), createElement(Caption1, {
|
|
521
|
+
style: {
|
|
522
|
+
color: tokens.colorPaletteRedForeground1
|
|
569
523
|
}
|
|
570
|
-
});
|
|
524
|
+
}, isRequired ? " *" : "")));
|
|
571
525
|
};
|
|
572
526
|
|
|
573
|
-
var _templateObject, _templateObject2;
|
|
574
|
-
var
|
|
527
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
528
|
+
var useStyles = function useStyles() {
|
|
575
529
|
return {
|
|
576
|
-
|
|
530
|
+
gridContainer: css(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: grid;\n gap: 4px;\n padding: 8px;\n justify-content: center;\n "]))),
|
|
531
|
+
cell: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n width: 30px;\n height: 30px;\n border: 1px solid ", ";\n background-color: ", ";\n cursor: pointer;\n transition: background-color 150ms ease, transform 150ms ease;\n will-change: background-color, transform;\n "])), tokens.colorNeutralStroke1, tokens.colorNeutralBackground1),
|
|
532
|
+
hoveredCell: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n transform: scale(1.05);\n "])), tokens.colorNeutralBackground1Hover),
|
|
533
|
+
selectedCell: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), tokens.colorNeutralBackground1Selected),
|
|
534
|
+
menuPopover: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n min-width: fit-content;\n "]))),
|
|
535
|
+
bottomText: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n padding-left: 8px;\n padding-right: 8px;\n "]))),
|
|
536
|
+
zoomContainer: css({
|
|
577
537
|
display: 'flex',
|
|
578
|
-
flexDirection: '
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
})
|
|
585
|
-
chartArea: css(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n flex-grow: 1;\n min-height: 0;\n "]))),
|
|
586
|
-
legendArea: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n margin-top: 0px;\n padding-top: 0px;\n \n margin-Left: 10px;\n margin-Right: 10px;\n \n "])))
|
|
538
|
+
flexDirection: 'row',
|
|
539
|
+
alignItems: 'center',
|
|
540
|
+
gap: '6px',
|
|
541
|
+
width: '100%',
|
|
542
|
+
boxSizing: 'border-box',
|
|
543
|
+
padding: '8px 0px'
|
|
544
|
+
})
|
|
587
545
|
};
|
|
588
546
|
};
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
612
|
-
createFluentTooltip = _useChartUtils.createFluentTooltip;
|
|
613
|
-
var styles = useGraphGlobalStyles();
|
|
614
|
-
var seriesColors = useMemo(function () {
|
|
615
|
-
return data.reduce(function (acc, series, idx) {
|
|
616
|
-
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
617
|
-
var color = lightenColor(base, 0.3);
|
|
618
|
-
acc[series.label] = color;
|
|
619
|
-
return acc;
|
|
620
|
-
}, {});
|
|
621
|
-
}, [data]);
|
|
622
|
-
var toggleSeries = function toggleSeries(label) {
|
|
623
|
-
setVisibleSeries(function (prev) {
|
|
624
|
-
var isVisible = prev.includes(label);
|
|
625
|
-
var next = isVisible ? prev.filter(function (l) {
|
|
626
|
-
return l !== label;
|
|
627
|
-
}) : [].concat(prev, [label]);
|
|
628
|
-
return next.length === 0 && data.length > 0 ? [data[0].label] : next;
|
|
629
|
-
});
|
|
547
|
+
var SelectZoom = function SelectZoom(props) {
|
|
548
|
+
var onChange = props.onChange,
|
|
549
|
+
defaultValues = props.values,
|
|
550
|
+
maxCols = props.maxCols,
|
|
551
|
+
maxRows = props.maxRows;
|
|
552
|
+
var Settings = bundleIcon(Settings20Filled, Settings20Regular);
|
|
553
|
+
var styles = useStyles();
|
|
554
|
+
var _React$useState = useState(defaultValues),
|
|
555
|
+
values = _React$useState[0],
|
|
556
|
+
setValues = _React$useState[1];
|
|
557
|
+
var _React$useState2 = useState(null),
|
|
558
|
+
hovered = _React$useState2[0],
|
|
559
|
+
setHovered = _React$useState2[1];
|
|
560
|
+
var _React$useState3 = useState(false),
|
|
561
|
+
open = _React$useState3[0],
|
|
562
|
+
setOpen = _React$useState3[1];
|
|
563
|
+
useEffect(function () {
|
|
564
|
+
setValues(defaultValues);
|
|
565
|
+
}, [defaultValues]);
|
|
566
|
+
var onOpenChange = function onOpenChange(_, data) {
|
|
567
|
+
setOpen(data.open);
|
|
568
|
+
setHovered(null);
|
|
630
569
|
};
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
series.data.forEach(function (datum) {
|
|
636
|
-
categorySet.add(getPrimary(datum));
|
|
637
|
-
});
|
|
638
|
-
});
|
|
639
|
-
return Array.from(categorySet);
|
|
640
|
-
}, [data, getPrimary]);
|
|
641
|
-
// Construct Chart.js datasets
|
|
642
|
-
var chartData = useMemo(function () {
|
|
643
|
-
return {
|
|
644
|
-
labels: allCategories,
|
|
645
|
-
datasets: data.filter(function (series) {
|
|
646
|
-
return visibleSeries.includes(series.label);
|
|
647
|
-
}).map(function (series) {
|
|
648
|
-
return {
|
|
649
|
-
label: series.label,
|
|
650
|
-
backgroundColor: seriesColors[series.label],
|
|
651
|
-
data: allCategories.map(function (cat) {
|
|
652
|
-
var found = series.data.find(function (d) {
|
|
653
|
-
return getPrimary(d) === cat;
|
|
654
|
-
});
|
|
655
|
-
return found ? getSecondary(found) : 0;
|
|
656
|
-
}),
|
|
657
|
-
// Assign y-axis based on series type when stacked
|
|
658
|
-
yAxisID: stacked ? series.type === 'line' ? 'y1' : 'y' : 'y'
|
|
659
|
-
};
|
|
660
|
-
})
|
|
570
|
+
var handleCellClick = function handleCellClick(row, col) {
|
|
571
|
+
var newValues = {
|
|
572
|
+
spanCols: col + 1,
|
|
573
|
+
spanRows: row + 1
|
|
661
574
|
};
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
var
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
weight: theme.fontWeightSemibold
|
|
687
|
-
},
|
|
688
|
-
color: theme.colorNeutralForeground1,
|
|
689
|
-
padding: {
|
|
690
|
-
top: 20,
|
|
691
|
-
bottom: 20
|
|
692
|
-
}
|
|
693
|
-
},
|
|
694
|
-
datalabels: {
|
|
695
|
-
display: showDatalabels,
|
|
696
|
-
color: theme.colorNeutralForeground1,
|
|
697
|
-
font: {
|
|
698
|
-
family: theme.fontFamilyBase,
|
|
699
|
-
size: parseInt(theme.fontSizeBase200.replace('px', '')) || 14
|
|
700
|
-
}
|
|
701
|
-
},
|
|
702
|
-
legend: {
|
|
703
|
-
display: false
|
|
704
|
-
},
|
|
705
|
-
tooltip: createFluentTooltip(theme)
|
|
706
|
-
},
|
|
707
|
-
scales: _extends({
|
|
708
|
-
x: {
|
|
709
|
-
stacked: stacked,
|
|
710
|
-
ticks: {
|
|
711
|
-
callback: createAxisLabelFormatter({
|
|
712
|
-
maxLength: 10
|
|
713
|
-
}),
|
|
714
|
-
color: labelColor,
|
|
715
|
-
font: {
|
|
716
|
-
family: fontFamily,
|
|
717
|
-
size: fontSize
|
|
718
|
-
}
|
|
575
|
+
setValues(newValues);
|
|
576
|
+
onChange == null || onChange(newValues);
|
|
577
|
+
setOpen(false);
|
|
578
|
+
};
|
|
579
|
+
var handleCellHover = function handleCellHover(row, col) {
|
|
580
|
+
setHovered({
|
|
581
|
+
spanCols: col + 1,
|
|
582
|
+
spanRows: row + 1
|
|
583
|
+
});
|
|
584
|
+
};
|
|
585
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
586
|
+
setHovered(null);
|
|
587
|
+
};
|
|
588
|
+
var renderGridCells = function renderGridCells() {
|
|
589
|
+
var cells = [];
|
|
590
|
+
var _loop = function _loop(row) {
|
|
591
|
+
var _loop2 = function _loop2(col) {
|
|
592
|
+
var isSelected = row < values.spanRows && col < values.spanCols;
|
|
593
|
+
var isHovered = hovered && row < hovered.spanRows && col < hovered.spanCols;
|
|
594
|
+
cells.push(createElement("div", {
|
|
595
|
+
key: row + "-" + col,
|
|
596
|
+
className: styles.cell + " " + (isHovered ? styles.hoveredCell : "") + " " + (isSelected ? styles.selectedCell : ""),
|
|
597
|
+
onMouseEnter: function onMouseEnter() {
|
|
598
|
+
return handleCellHover(row, col);
|
|
719
599
|
},
|
|
720
|
-
|
|
721
|
-
|
|
600
|
+
onClick: function onClick() {
|
|
601
|
+
return handleCellClick(row, col);
|
|
722
602
|
}
|
|
723
|
-
}
|
|
724
|
-
y: {
|
|
725
|
-
type: 'linear',
|
|
726
|
-
position: 'left',
|
|
727
|
-
stacked: stacked,
|
|
728
|
-
ticks: {
|
|
729
|
-
callback: createAxisLabelFormatter({
|
|
730
|
-
maxLength: 10
|
|
731
|
-
}),
|
|
732
|
-
color: labelColor,
|
|
733
|
-
font: {
|
|
734
|
-
family: fontFamily,
|
|
735
|
-
size: fontSize
|
|
736
|
-
}
|
|
737
|
-
},
|
|
738
|
-
grid: {
|
|
739
|
-
color: gridColor
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}, stacked && {
|
|
743
|
-
y1: {
|
|
744
|
-
type: 'linear',
|
|
745
|
-
position: 'right',
|
|
746
|
-
ticks: {
|
|
747
|
-
callback: createAxisLabelFormatter({
|
|
748
|
-
maxLength: 10
|
|
749
|
-
}),
|
|
750
|
-
color: labelColor,
|
|
751
|
-
font: {
|
|
752
|
-
family: fontFamily,
|
|
753
|
-
size: fontSize
|
|
754
|
-
}
|
|
755
|
-
},
|
|
756
|
-
grid: {
|
|
757
|
-
drawOnChartArea: false
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
})
|
|
761
|
-
};
|
|
762
|
-
}, [title, showDatalabels, theme, fontFamily, fontSize, labelColor, gridColor, stacked, createFluentTooltip]);
|
|
763
|
-
return React__default.createElement("div", {
|
|
764
|
-
className: styles.chartWithLegend
|
|
765
|
-
}, React__default.createElement("div", {
|
|
766
|
-
className: styles.chartArea
|
|
767
|
-
}, React__default.createElement(Bar, {
|
|
768
|
-
data: chartData,
|
|
769
|
-
options: options
|
|
770
|
-
})), React__default.createElement("div", {
|
|
771
|
-
className: styles.legendArea
|
|
772
|
-
}, React__default.createElement(RenderLegend, {
|
|
773
|
-
data: data,
|
|
774
|
-
visibleSeries: visibleSeries,
|
|
775
|
-
seriesColors: seriesColors,
|
|
776
|
-
toggleSeries: toggleSeries
|
|
777
|
-
})));
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
Chart.register(ChartDataLabels);
|
|
781
|
-
Chart.register(CategoryScale, LinearScale, BarElement, LineElement, PointElement, Tooltip$1, Legend, Title);
|
|
782
|
-
function ComboChart(_ref) {
|
|
783
|
-
var data = _ref.data,
|
|
784
|
-
getPrimary = _ref.getPrimary,
|
|
785
|
-
getSecondary = _ref.getSecondary,
|
|
786
|
-
title = _ref.title,
|
|
787
|
-
_ref$showDataLabels = _ref.showDataLabels,
|
|
788
|
-
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
789
|
-
_ref$theme = _ref.theme,
|
|
790
|
-
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme;
|
|
791
|
-
var _useState = useState(function () {
|
|
792
|
-
return data.map(function (s) {
|
|
793
|
-
return s.label;
|
|
794
|
-
});
|
|
795
|
-
}),
|
|
796
|
-
visibleSeries = _useState[0],
|
|
797
|
-
setVisibleSeries = _useState[1];
|
|
798
|
-
var styles = useGraphGlobalStyles();
|
|
799
|
-
var _useChartUtils = useChartUtils(theme),
|
|
800
|
-
lightenColor = _useChartUtils.lightenColor,
|
|
801
|
-
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
802
|
-
createFluentTooltip = _useChartUtils.createFluentTooltip;
|
|
803
|
-
var seriesColors = useMemo(function () {
|
|
804
|
-
return data.reduce(function (acc, series, idx) {
|
|
805
|
-
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
806
|
-
acc[series.label] = lightenColor(base, 0.3);
|
|
807
|
-
return acc;
|
|
808
|
-
}, {});
|
|
809
|
-
}, [data, theme]);
|
|
810
|
-
var toggleSeries = function toggleSeries(label) {
|
|
811
|
-
setVisibleSeries(function (prev) {
|
|
812
|
-
var isVisible = prev.includes(label);
|
|
813
|
-
var next = isVisible ? prev.filter(function (l) {
|
|
814
|
-
return l !== label;
|
|
815
|
-
}) : [].concat(prev, [label]);
|
|
816
|
-
return next.length === 0 ? [data[0].label] : next;
|
|
817
|
-
});
|
|
818
|
-
};
|
|
819
|
-
var allCategories = useMemo(function () {
|
|
820
|
-
var set = new Set();
|
|
821
|
-
data.forEach(function (series) {
|
|
822
|
-
return series.data.forEach(function (d) {
|
|
823
|
-
return set.add(getPrimary(d));
|
|
824
|
-
});
|
|
825
|
-
});
|
|
826
|
-
return Array.from(set);
|
|
827
|
-
}, [data, getPrimary]);
|
|
828
|
-
var chartData = useMemo(function () {
|
|
829
|
-
var sortedSeries = data.filter(function (series) {
|
|
830
|
-
return visibleSeries.includes(series.label);
|
|
831
|
-
}).sort(function (a, b) {
|
|
832
|
-
// Ensure bars come before lines
|
|
833
|
-
if (a.type === 'bar' && b.type === 'line') return -1;
|
|
834
|
-
if (a.type === 'line' && b.type === 'bar') return 1;
|
|
835
|
-
return 0;
|
|
836
|
-
});
|
|
837
|
-
return {
|
|
838
|
-
labels: allCategories,
|
|
839
|
-
datasets: sortedSeries.map(function (series) {
|
|
840
|
-
var _series$yAxisID;
|
|
841
|
-
return {
|
|
842
|
-
type: series.type,
|
|
843
|
-
label: series.label,
|
|
844
|
-
yAxisID: (_series$yAxisID = series.yAxisID) != null ? _series$yAxisID : 'y',
|
|
845
|
-
data: allCategories.map(function (cat) {
|
|
846
|
-
var found = series.data.find(function (d) {
|
|
847
|
-
return getPrimary(d) === cat;
|
|
848
|
-
});
|
|
849
|
-
return found ? getSecondary(found) : 0;
|
|
850
|
-
}),
|
|
851
|
-
backgroundColor: seriesColors[series.label],
|
|
852
|
-
borderColor: seriesColors[series.label],
|
|
853
|
-
fill: series.type === 'bar',
|
|
854
|
-
tension: series.type === 'line' ? 0.4 : 0,
|
|
855
|
-
pointRadius: series.type === 'line' ? 3 : 0,
|
|
856
|
-
borderWidth: series.type === 'line' ? 2 : 1,
|
|
857
|
-
order: series.type === 'bar' ? 1 : 0
|
|
858
|
-
};
|
|
859
|
-
})
|
|
860
|
-
};
|
|
861
|
-
}, [data, visibleSeries, allCategories, getPrimary, getSecondary, seriesColors]);
|
|
862
|
-
var _useMemo = useMemo(function () {
|
|
863
|
-
return {
|
|
864
|
-
fontFamily: theme.fontFamilyBase,
|
|
865
|
-
fontSize: parseInt(theme.fontSizeBase200.replace('px', '')) || 14,
|
|
866
|
-
labelColor: theme.colorNeutralForeground1,
|
|
867
|
-
gridColor: theme.colorNeutralStroke2
|
|
603
|
+
}));
|
|
868
604
|
};
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
fontSize = _useMemo.fontSize,
|
|
872
|
-
labelColor = _useMemo.labelColor,
|
|
873
|
-
gridColor = _useMemo.gridColor;
|
|
874
|
-
var options = useMemo(function () {
|
|
875
|
-
return {
|
|
876
|
-
responsive: true,
|
|
877
|
-
maintainAspectRatio: false,
|
|
878
|
-
plugins: {
|
|
879
|
-
title: {
|
|
880
|
-
display: !!title,
|
|
881
|
-
text: title,
|
|
882
|
-
font: {
|
|
883
|
-
size: 14,
|
|
884
|
-
family: theme.fontFamilyBase,
|
|
885
|
-
weight: theme.fontWeightSemibold
|
|
886
|
-
},
|
|
887
|
-
color: theme.colorNeutralForeground1,
|
|
888
|
-
padding: {
|
|
889
|
-
top: 20,
|
|
890
|
-
bottom: 20
|
|
891
|
-
}
|
|
892
|
-
},
|
|
893
|
-
datalabels: {
|
|
894
|
-
display: showDataLabels,
|
|
895
|
-
color: theme.colorNeutralForeground1,
|
|
896
|
-
font: {
|
|
897
|
-
family: theme.fontFamilyBase,
|
|
898
|
-
size: parseInt(theme.fontSizeBase200.replace('px', '')) || 14
|
|
899
|
-
}
|
|
900
|
-
},
|
|
901
|
-
legend: {
|
|
902
|
-
display: false
|
|
903
|
-
},
|
|
904
|
-
tooltip: createFluentTooltip(theme)
|
|
905
|
-
},
|
|
906
|
-
scales: {
|
|
907
|
-
x: {
|
|
908
|
-
ticks: {
|
|
909
|
-
color: labelColor,
|
|
910
|
-
font: {
|
|
911
|
-
family: fontFamily,
|
|
912
|
-
size: fontSize
|
|
913
|
-
}
|
|
914
|
-
},
|
|
915
|
-
grid: {
|
|
916
|
-
color: gridColor
|
|
917
|
-
}
|
|
918
|
-
},
|
|
919
|
-
y: {
|
|
920
|
-
position: 'left',
|
|
921
|
-
ticks: {
|
|
922
|
-
color: labelColor,
|
|
923
|
-
font: {
|
|
924
|
-
family: fontFamily,
|
|
925
|
-
size: fontSize
|
|
926
|
-
}
|
|
927
|
-
},
|
|
928
|
-
grid: {
|
|
929
|
-
color: gridColor
|
|
930
|
-
},
|
|
931
|
-
stacked: false
|
|
932
|
-
}
|
|
605
|
+
for (var col = 0; col < maxCols; col++) {
|
|
606
|
+
_loop2(col);
|
|
933
607
|
}
|
|
934
608
|
};
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
_ref$height = _ref.height,
|
|
958
|
-
height = _ref$height === void 0 ? 200 : _ref$height,
|
|
959
|
-
className = _ref.className,
|
|
960
|
-
style = _ref.style;
|
|
961
|
-
return React__default.createElement("svg", {
|
|
962
|
-
width: width,
|
|
963
|
-
height: height,
|
|
964
|
-
viewBox: "200 400 1400 1000",
|
|
965
|
-
className: className,
|
|
966
|
-
style: _extends({
|
|
967
|
-
fill: tokens.colorNeutralForeground2
|
|
968
|
-
}, style),
|
|
969
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
970
|
-
}, React__default.createElement("g", {
|
|
971
|
-
id: "BACKGROUND"
|
|
972
|
-
}, React__default.createElement("rect", {
|
|
973
|
-
style: {
|
|
974
|
-
fill: tokens.colorNeutralBackground1
|
|
975
|
-
},
|
|
976
|
-
x: "200",
|
|
977
|
-
y: "400",
|
|
978
|
-
width: "1400",
|
|
979
|
-
height: "1000"
|
|
980
|
-
})), React__default.createElement("g", null, React__default.createElement("g", null, React__default.createElement("rect", {
|
|
981
|
-
x: "486.006",
|
|
982
|
-
y: "568.026",
|
|
983
|
-
style: {
|
|
984
|
-
fill: tokens.colorNeutralBackground1
|
|
985
|
-
},
|
|
986
|
-
width: "1038.994",
|
|
987
|
-
height: "768.164"
|
|
988
|
-
}), React__default.createElement("path", {
|
|
989
|
-
style: {
|
|
990
|
-
fill: tokens.colorNeutralStroke1
|
|
991
|
-
},
|
|
992
|
-
d: "M1527.5,1338.69H483.506V565.526H1527.5V1338.69z M488.506,1333.69H1522.5V570.526H488.506V1333.69z"
|
|
993
|
-
})), React__default.createElement("g", null, React__default.createElement("rect", {
|
|
994
|
-
x: "558.003",
|
|
995
|
-
y: "1086.698",
|
|
996
|
-
style: {
|
|
997
|
-
fill: tokens.colorNeutralForeground3,
|
|
998
|
-
opacity: 0.3
|
|
999
|
-
},
|
|
1000
|
-
width: "85",
|
|
1001
|
-
height: "164.492"
|
|
1002
|
-
}), React__default.createElement("rect", {
|
|
1003
|
-
x: "693.003",
|
|
1004
|
-
y: "1004.672",
|
|
1005
|
-
style: {
|
|
1006
|
-
fill: tokens.colorNeutralForeground3,
|
|
1007
|
-
opacity: 0.3
|
|
1008
|
-
},
|
|
1009
|
-
width: "85",
|
|
1010
|
-
height: "246.519"
|
|
1011
|
-
}), React__default.createElement("rect", {
|
|
1012
|
-
x: "828.003",
|
|
1013
|
-
y: "835.487",
|
|
1014
|
-
style: {
|
|
1015
|
-
fill: tokens.colorNeutralForeground3,
|
|
1016
|
-
opacity: 0.3
|
|
1017
|
-
},
|
|
1018
|
-
width: "85",
|
|
1019
|
-
height: "415.703"
|
|
1020
|
-
}), React__default.createElement("rect", {
|
|
1021
|
-
x: "963.003",
|
|
1022
|
-
y: "955.6",
|
|
1023
|
-
style: {
|
|
1024
|
-
fill: tokens.colorNeutralForeground3,
|
|
1025
|
-
opacity: 0.3
|
|
1026
|
-
},
|
|
1027
|
-
width: "85",
|
|
1028
|
-
height: "295.591"
|
|
1029
|
-
}), React__default.createElement("rect", {
|
|
1030
|
-
x: "1098.003",
|
|
1031
|
-
y: "825.238",
|
|
1032
|
-
style: {
|
|
1033
|
-
fill: tokens.colorNeutralForeground3,
|
|
1034
|
-
opacity: 0.3
|
|
1035
|
-
},
|
|
1036
|
-
width: "85",
|
|
1037
|
-
height: "425.952"
|
|
1038
|
-
}), React__default.createElement("rect", {
|
|
1039
|
-
x: "1233.003",
|
|
1040
|
-
y: "847.489",
|
|
609
|
+
for (var row = 0; row < maxRows; row++) {
|
|
610
|
+
_loop(row);
|
|
611
|
+
}
|
|
612
|
+
return cells;
|
|
613
|
+
};
|
|
614
|
+
// Compute popover width dynamically
|
|
615
|
+
var popoverWidth = useMemo(function () {
|
|
616
|
+
return 30 * maxCols + 4 * (maxCols - 1) + 32;
|
|
617
|
+
}, [maxCols]); // 30px for each cell, 4px gap, and 32px padding (16 left and right)
|
|
618
|
+
return createElement(Menu, {
|
|
619
|
+
open: open,
|
|
620
|
+
onOpenChange: onOpenChange
|
|
621
|
+
}, createElement(MenuTrigger, {
|
|
622
|
+
disableButtonEnhancement: true
|
|
623
|
+
}, createElement(Tooltip, {
|
|
624
|
+
content: "Configure",
|
|
625
|
+
relationship: "label"
|
|
626
|
+
}, createElement(MenuButton, {
|
|
627
|
+
icon: createElement(Settings, null),
|
|
628
|
+
size: "small",
|
|
629
|
+
appearance: "transparent"
|
|
630
|
+
}))), createElement(MenuPopover, {
|
|
1041
631
|
style: {
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
632
|
+
width: popoverWidth + "px",
|
|
633
|
+
minWidth: "120px",
|
|
634
|
+
padding: 8
|
|
635
|
+
}
|
|
636
|
+
}, createElement("div", {
|
|
637
|
+
className: styles.zoomContainer
|
|
638
|
+
}, createElement(RenderLabel, {
|
|
639
|
+
label: "Span (" + values.spanCols + " \xD7 " + values.spanRows + ")"
|
|
640
|
+
})), createElement("div", {
|
|
641
|
+
className: styles.gridContainer,
|
|
1050
642
|
style: {
|
|
1051
|
-
|
|
1052
|
-
|
|
643
|
+
gridTemplateColumns: "repeat(" + maxCols + ", 30px)",
|
|
644
|
+
gridTemplateRows: "repeat(" + maxRows + ", 30px)"
|
|
1053
645
|
},
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
646
|
+
onMouseLeave: handleMouseLeave
|
|
647
|
+
}, renderGridCells()), createElement(Caption1, {
|
|
648
|
+
className: styles.bottomText
|
|
649
|
+
}, "Click to set span")));
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
var LegendButton = function LegendButton(_ref) {
|
|
653
|
+
var label = _ref.label,
|
|
654
|
+
isVisible = _ref.isVisible,
|
|
655
|
+
color = _ref.color,
|
|
656
|
+
onClick = _ref.onClick,
|
|
657
|
+
_ref$style = _ref.style,
|
|
658
|
+
style = _ref$style === void 0 ? {} : _ref$style,
|
|
659
|
+
buttonRef = _ref.buttonRef;
|
|
660
|
+
return React__default.createElement(Tooltip, {
|
|
661
|
+
content: label,
|
|
662
|
+
relationship: "label"
|
|
663
|
+
}, React__default.createElement(Button, {
|
|
664
|
+
ref: buttonRef,
|
|
665
|
+
shape: "circular",
|
|
666
|
+
size: "small",
|
|
667
|
+
appearance: isVisible ? 'primary' : 'outline',
|
|
668
|
+
onClick: onClick,
|
|
669
|
+
style: _extends({
|
|
670
|
+
backgroundColor: isVisible ? color : 'transparent',
|
|
671
|
+
color: isVisible ? '#fff' : tokens.colorNeutralForeground1,
|
|
672
|
+
borderColor: color,
|
|
673
|
+
borderWidth: 1,
|
|
674
|
+
width: '100px',
|
|
675
|
+
padding: '4px 8px',
|
|
676
|
+
textAlign: 'center'
|
|
677
|
+
}, style)
|
|
678
|
+
}, React__default.createElement(Caption1, {
|
|
679
|
+
as: "span",
|
|
1057
680
|
style: {
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
681
|
+
display: 'block',
|
|
682
|
+
overflow: 'hidden',
|
|
683
|
+
textOverflow: 'ellipsis',
|
|
684
|
+
whiteSpace: 'nowrap',
|
|
685
|
+
lineHeight: '1.25'
|
|
686
|
+
}
|
|
687
|
+
}, label)));
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
var styles = {
|
|
691
|
+
wrapper: /*#__PURE__*/css({
|
|
692
|
+
display: 'flex',
|
|
693
|
+
flexWrap: 'nowrap',
|
|
694
|
+
overflow: 'hidden',
|
|
695
|
+
justifyContent: 'center',
|
|
696
|
+
gap: 10,
|
|
697
|
+
padding: 2,
|
|
698
|
+
width: '100%',
|
|
699
|
+
boxSizing: 'border-box'
|
|
700
|
+
})
|
|
701
|
+
};
|
|
702
|
+
function LegendContainer(props) {
|
|
703
|
+
var containerRef = props.containerRef,
|
|
704
|
+
visibleItems = props.visibleItems,
|
|
705
|
+
overflowItems = props.overflowItems,
|
|
706
|
+
visibleLabels = props.visibleLabels,
|
|
707
|
+
toggleLabel = props.toggleLabel,
|
|
708
|
+
renderLabel = props.renderLabel,
|
|
709
|
+
getColor = props.getColor;
|
|
710
|
+
return React__default.createElement(Stack, {
|
|
711
|
+
justifyContent: "center",
|
|
712
|
+
alignItems: "center",
|
|
713
|
+
marginLeft: "10px",
|
|
714
|
+
marginRight: "10px",
|
|
715
|
+
marginTop: "25px",
|
|
716
|
+
marginBottom: "20px"
|
|
717
|
+
}, React__default.createElement("div", {
|
|
718
|
+
ref: containerRef,
|
|
719
|
+
className: styles.wrapper
|
|
720
|
+
}, visibleItems.map(function (item) {
|
|
721
|
+
var label = item.label;
|
|
722
|
+
var isVisible = visibleLabels.length === 0 || visibleLabels.includes(label);
|
|
723
|
+
return React__default.createElement(LegendButton, {
|
|
724
|
+
key: label,
|
|
725
|
+
label: renderLabel(item),
|
|
726
|
+
color: getColor(item),
|
|
727
|
+
isVisible: isVisible,
|
|
728
|
+
onClick: function onClick() {
|
|
729
|
+
return toggleLabel(label);
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
}), overflowItems.length > 0 && React__default.createElement(Menu, null, React__default.createElement(MenuTrigger, {
|
|
733
|
+
disableButtonEnhancement: true
|
|
734
|
+
}, React__default.createElement(MenuButton, {
|
|
735
|
+
size: "small",
|
|
736
|
+
appearance: "transparent"
|
|
737
|
+
}, "+", overflowItems.length)), React__default.createElement(MenuPopover, {
|
|
1064
738
|
style: {
|
|
1065
|
-
|
|
739
|
+
minWidth: 'fit-content',
|
|
740
|
+
maxWidth: '200px'
|
|
741
|
+
}
|
|
742
|
+
}, React__default.createElement(MenuList, null, overflowItems.map(function (item) {
|
|
743
|
+
var label = item.label;
|
|
744
|
+
var isVisible = visibleLabels.length === 0 || visibleLabels.includes(label);
|
|
745
|
+
return React__default.createElement(MenuItem, {
|
|
746
|
+
key: label,
|
|
747
|
+
style: {
|
|
748
|
+
padding: 0
|
|
749
|
+
}
|
|
750
|
+
}, React__default.createElement(LegendButton, {
|
|
751
|
+
label: renderLabel(item),
|
|
752
|
+
color: getColor(item),
|
|
753
|
+
isVisible: isVisible,
|
|
754
|
+
onClick: function onClick() {
|
|
755
|
+
return toggleLabel(label);
|
|
756
|
+
},
|
|
757
|
+
style: {
|
|
758
|
+
width: '100px',
|
|
759
|
+
textAlign: 'left'
|
|
760
|
+
}
|
|
761
|
+
}));
|
|
762
|
+
}))))));
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Lightens a given hex color by a percentage amount (0 to 1).
|
|
767
|
+
*/
|
|
768
|
+
var lightenColor = function lightenColor(hex, amount) {
|
|
769
|
+
if (!/^#?[0-9A-Fa-f]{6}$/.test(hex)) return hex;
|
|
770
|
+
if (hex.startsWith('#')) hex = hex.slice(1);
|
|
771
|
+
var r = parseInt(hex.slice(0, 2), 16);
|
|
772
|
+
var g = parseInt(hex.slice(2, 4), 16);
|
|
773
|
+
var b = parseInt(hex.slice(4, 6), 16);
|
|
774
|
+
r = Math.min(255, Math.floor(r + (255 - r) * amount));
|
|
775
|
+
g = Math.min(255, Math.floor(g + (255 - g) * amount));
|
|
776
|
+
b = Math.min(255, Math.floor(b + (255 - b) * amount));
|
|
777
|
+
var toHex = function toHex(v) {
|
|
778
|
+
return v.toString(16).padStart(2, '0');
|
|
779
|
+
};
|
|
780
|
+
return "#" + toHex(r) + toHex(g) + toHex(b);
|
|
781
|
+
};
|
|
782
|
+
var getFluentPalette = function getFluentPalette(_theme) {
|
|
783
|
+
return ['#4e79a7', '#f28e2c', '#e15759', '#76b7b2', '#59a14f', '#edc949', '#af7aa1', '#ff9da7', '#9c755f', '#bab0ab', '#8cd17d', '#b6992d', '#d37295', '#fabfd2', '#79706e'];
|
|
784
|
+
};
|
|
785
|
+
/**
|
|
786
|
+
* Smart Fluent tooltip generator with chart-type awareness.
|
|
787
|
+
*/
|
|
788
|
+
function createFluentTooltip(theme) {
|
|
789
|
+
var fontFamily = theme.fontFamilyBase;
|
|
790
|
+
var fontSize = parseInt(theme.fontSizeBase200.replace('px', '')) || 14;
|
|
791
|
+
var tooltipBg = theme.colorNeutralBackground1;
|
|
792
|
+
var tooltipTitleColor = theme.colorNeutralForeground1;
|
|
793
|
+
var tooltipBodyColor = theme.colorNeutralForeground2;
|
|
794
|
+
var borderColor = theme.colorNeutralStroke2;
|
|
795
|
+
var callbacks = {
|
|
796
|
+
title: function title(context) {
|
|
797
|
+
var _context$0$label, _context$;
|
|
798
|
+
return (_context$0$label = (_context$ = context[0]) == null ? void 0 : _context$.label) != null ? _context$0$label : '';
|
|
1066
799
|
},
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
800
|
+
label: function label(item) {
|
|
801
|
+
var datasetLabel = 'label' in item.dataset && typeof item.dataset.label === 'string' ? item.dataset.label : 'Value';
|
|
802
|
+
var raw = item.raw;
|
|
803
|
+
// Bubble format { x, y, r }
|
|
804
|
+
if (typeof raw === 'object' && raw !== null && 'x' in raw && 'y' in raw && 'r' in raw) {
|
|
805
|
+
var x = raw.x,
|
|
806
|
+
y = raw.y,
|
|
807
|
+
r = raw.r;
|
|
808
|
+
return datasetLabel + " \u2014 x: " + x + ", y: " + y + ", r: " + r;
|
|
809
|
+
}
|
|
810
|
+
// Scatter format { x, y }
|
|
811
|
+
if (typeof raw === 'object' && raw !== null && 'x' in raw && 'y' in raw) {
|
|
812
|
+
var _x = raw.x,
|
|
813
|
+
_y = raw.y;
|
|
814
|
+
return datasetLabel + " \u2014 x: " + _x + ", y: " + _y;
|
|
815
|
+
}
|
|
816
|
+
// Floating bar [min, max]
|
|
817
|
+
if (Array.isArray(raw) && raw.length === 2) {
|
|
818
|
+
var min = raw[0],
|
|
819
|
+
max = raw[1];
|
|
820
|
+
return datasetLabel + ": " + min + " \u2013 " + max;
|
|
821
|
+
}
|
|
822
|
+
// Default: single number or string
|
|
823
|
+
return datasetLabel + ": " + raw;
|
|
1074
824
|
},
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
})), React__default.createElement("g", null, React__default.createElement("g", null, React__default.createElement("rect", {
|
|
1078
|
-
x: "264.978",
|
|
1079
|
-
y: "441.049",
|
|
1080
|
-
style: {
|
|
1081
|
-
fill: tokens.colorNeutralBackground1
|
|
825
|
+
beforeTitle: function beforeTitle() {
|
|
826
|
+
return '';
|
|
1082
827
|
},
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
}), React__default.createElement("path", {
|
|
1086
|
-
style: {
|
|
1087
|
-
fill: tokens.colorNeutralStroke1
|
|
828
|
+
afterTitle: function afterTitle() {
|
|
829
|
+
return '';
|
|
1088
830
|
},
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
x: "330.537",
|
|
1092
|
-
y: "503.15",
|
|
1093
|
-
style: {
|
|
1094
|
-
fill: tokens.colorNeutralForeground3,
|
|
1095
|
-
opacity: 0.3
|
|
831
|
+
beforeBody: function beforeBody() {
|
|
832
|
+
return '';
|
|
1096
833
|
},
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
}), React__default.createElement("g", null, React__default.createElement("rect", {
|
|
1100
|
-
x: "485.277",
|
|
1101
|
-
y: "509.093",
|
|
1102
|
-
style: {
|
|
1103
|
-
fill: tokens.colorBrandBackground
|
|
834
|
+
afterBody: function afterBody() {
|
|
835
|
+
return '';
|
|
1104
836
|
},
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
}), React__default.createElement("rect", {
|
|
1108
|
-
x: "485.277",
|
|
1109
|
-
y: "532.656",
|
|
1110
|
-
style: {
|
|
1111
|
-
fill: tokens.colorNeutralForeground3,
|
|
1112
|
-
opacity: 0.3
|
|
837
|
+
beforeLabel: function beforeLabel() {
|
|
838
|
+
return '';
|
|
1113
839
|
},
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
}), React__default.createElement("rect", {
|
|
1117
|
-
x: "485.277",
|
|
1118
|
-
y: "556.218",
|
|
1119
|
-
style: {
|
|
1120
|
-
fill: tokens.colorNeutralForeground3,
|
|
1121
|
-
opacity: 0.3
|
|
840
|
+
afterLabel: function afterLabel() {
|
|
841
|
+
return '';
|
|
1122
842
|
},
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
}))), React__default.createElement("g", null, React__default.createElement("g", null, React__default.createElement("rect", {
|
|
1126
|
-
x: "381.691",
|
|
1127
|
-
y: "687.747",
|
|
1128
|
-
style: {
|
|
1129
|
-
fill: tokens.colorNeutralForeground3,
|
|
1130
|
-
opacity: 0.3
|
|
843
|
+
labelColor: function labelColor() {
|
|
844
|
+
return undefined;
|
|
1131
845
|
},
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
}), React__default.createElement("rect", {
|
|
1135
|
-
x: "404.421",
|
|
1136
|
-
y: "653.482",
|
|
1137
|
-
style: {
|
|
1138
|
-
fill: tokens.colorBrandBackground
|
|
846
|
+
labelTextColor: function labelTextColor() {
|
|
847
|
+
return '';
|
|
1139
848
|
},
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
})), React__default.createElement("g", null, React__default.createElement("rect", {
|
|
1143
|
-
x: "466.491",
|
|
1144
|
-
y: "641.634",
|
|
1145
|
-
style: {
|
|
1146
|
-
fill: tokens.colorNeutralForeground3,
|
|
1147
|
-
opacity: 0.3
|
|
849
|
+
footer: function footer() {
|
|
850
|
+
return '';
|
|
1148
851
|
},
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
}), React__default.createElement("rect", {
|
|
1152
|
-
x: "489.221",
|
|
1153
|
-
y: "714.758",
|
|
1154
|
-
style: {
|
|
1155
|
-
fill: tokens.colorBrandBackground
|
|
852
|
+
beforeFooter: function beforeFooter() {
|
|
853
|
+
return '';
|
|
1156
854
|
},
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
}))))));
|
|
1160
|
-
};
|
|
1161
|
-
|
|
1162
|
-
var NoDashboards = function NoDashboards(props) {
|
|
1163
|
-
var height = props.height;
|
|
1164
|
-
return createElement(Fragment, null, createElement(Stack, {
|
|
1165
|
-
style: {
|
|
1166
|
-
height: height || "100%"
|
|
855
|
+
afterFooter: function afterFooter() {
|
|
856
|
+
return '';
|
|
1167
857
|
},
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
size: 500,
|
|
1175
|
-
weight: 'semibold'
|
|
1176
|
-
}, "No Dashboards Available")));
|
|
1177
|
-
};
|
|
1178
|
-
|
|
1179
|
-
var useRenderLabelStyles = /*#__PURE__*/makeStyles({
|
|
1180
|
-
labelContainer: /*#__PURE__*/_extends({
|
|
1181
|
-
display: "flex",
|
|
1182
|
-
flexDirection: "row",
|
|
1183
|
-
justifyContent: "flex-start",
|
|
1184
|
-
alignItems: "center"
|
|
1185
|
-
}, /*#__PURE__*/shorthands.gap("6px")),
|
|
1186
|
-
iconStyles: {
|
|
1187
|
-
width: "26px"
|
|
1188
|
-
},
|
|
1189
|
-
item: {
|
|
1190
|
-
paddingLeft: "15px"
|
|
1191
|
-
}
|
|
1192
|
-
});
|
|
1193
|
-
|
|
1194
|
-
var RenderLabel = function RenderLabel(props) {
|
|
1195
|
-
var label = props.label,
|
|
1196
|
-
icon = props.icon,
|
|
1197
|
-
isRequired = props.isRequired;
|
|
1198
|
-
var styles = useRenderLabelStyles();
|
|
1199
|
-
return createElement(Fragment, null, createElement("div", {
|
|
1200
|
-
className: styles.labelContainer
|
|
1201
|
-
}, icon && isValidElement(icon) ? icon : createElement(Icon, {
|
|
1202
|
-
icon: icon,
|
|
1203
|
-
className: styles.iconStyles,
|
|
1204
|
-
width: "20px",
|
|
1205
|
-
height: "20px",
|
|
1206
|
-
color: tokens.colorBrandForeground1
|
|
1207
|
-
}), createElement(Caption1, {
|
|
1208
|
-
style: {
|
|
1209
|
-
color: tokens.colorBrandForeground1
|
|
1210
|
-
}
|
|
1211
|
-
}, label), createElement(Caption1, {
|
|
1212
|
-
style: {
|
|
1213
|
-
color: tokens.colorPaletteRedForeground1
|
|
858
|
+
labelPointStyle: function labelPointStyle() {
|
|
859
|
+
return {
|
|
860
|
+
pointStyle: 'circle',
|
|
861
|
+
rotation: 0,
|
|
862
|
+
radius: 5
|
|
863
|
+
};
|
|
1214
864
|
}
|
|
1215
|
-
}
|
|
1216
|
-
};
|
|
1217
|
-
|
|
1218
|
-
var _templateObject$1, _templateObject2$1, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
1219
|
-
var useStyles = function useStyles() {
|
|
865
|
+
};
|
|
1220
866
|
return {
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
867
|
+
enabled: true,
|
|
868
|
+
displayColors: true,
|
|
869
|
+
boxWidth: 10,
|
|
870
|
+
boxHeight: 10,
|
|
871
|
+
boxPadding: 5,
|
|
872
|
+
backgroundColor: tooltipBg,
|
|
873
|
+
borderColor: borderColor,
|
|
874
|
+
borderWidth: 1,
|
|
875
|
+
cornerRadius: 4,
|
|
876
|
+
padding: 10,
|
|
877
|
+
titleColor: tooltipTitleColor,
|
|
878
|
+
bodyColor: tooltipBodyColor,
|
|
879
|
+
titleFont: {
|
|
880
|
+
family: fontFamily,
|
|
881
|
+
size: fontSize
|
|
882
|
+
},
|
|
883
|
+
bodyFont: {
|
|
884
|
+
family: fontFamily,
|
|
885
|
+
size: fontSize
|
|
886
|
+
},
|
|
887
|
+
callbacks: callbacks
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Returns a Chart.js ticks callback to truncate long labels and add optional prefix/suffix.
|
|
892
|
+
*/
|
|
893
|
+
var createAxisLabelFormatter = function createAxisLabelFormatter(_ref) {
|
|
894
|
+
var _ref$maxLength = _ref.maxLength,
|
|
895
|
+
maxLength = _ref$maxLength === void 0 ? 12 : _ref$maxLength,
|
|
896
|
+
_ref$suffix = _ref.suffix,
|
|
897
|
+
suffix = _ref$suffix === void 0 ? '' : _ref$suffix,
|
|
898
|
+
_ref$prefix = _ref.prefix,
|
|
899
|
+
prefix = _ref$prefix === void 0 ? '' : _ref$prefix;
|
|
900
|
+
return function (value) {
|
|
901
|
+
var label = typeof value === 'number' ? this.getLabelForValue(value) : String(value);
|
|
902
|
+
var trimmed = label.length > maxLength ? label.slice(0, maxLength) + '…' : label;
|
|
903
|
+
return "" + prefix + trimmed + suffix;
|
|
1227
904
|
};
|
|
1228
905
|
};
|
|
1229
|
-
|
|
1230
|
-
var
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
hovered = _React$useState2[0],
|
|
1241
|
-
setHovered = _React$useState2[1];
|
|
1242
|
-
var _React$useState3 = useState(false),
|
|
1243
|
-
open = _React$useState3[0],
|
|
1244
|
-
setOpen = _React$useState3[1];
|
|
1245
|
-
useEffect(function () {
|
|
1246
|
-
setValues(defaultValues);
|
|
1247
|
-
}, [defaultValues]);
|
|
1248
|
-
var onOpenChange = function onOpenChange(_, data) {
|
|
1249
|
-
setOpen(data.open);
|
|
1250
|
-
setHovered(null);
|
|
906
|
+
function debounce(fn, delay) {
|
|
907
|
+
var timer = null;
|
|
908
|
+
return function () {
|
|
909
|
+
var _this = this;
|
|
910
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
911
|
+
args[_key] = arguments[_key];
|
|
912
|
+
}
|
|
913
|
+
if (timer) clearTimeout(timer);
|
|
914
|
+
timer = setTimeout(function () {
|
|
915
|
+
return fn.apply(_this, args);
|
|
916
|
+
}, delay);
|
|
1251
917
|
};
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* useChartUtils — shared theming and chart helpers.
|
|
921
|
+
*/
|
|
922
|
+
function useChartUtils(theme) {
|
|
923
|
+
return useMemo(function () {
|
|
924
|
+
return {
|
|
925
|
+
lightenColor: lightenColor,
|
|
926
|
+
getFluentPalette: getFluentPalette,
|
|
927
|
+
createFluentTooltip: createFluentTooltip,
|
|
928
|
+
createAxisLabelFormatter: createAxisLabelFormatter,
|
|
929
|
+
debounce: debounce
|
|
1256
930
|
};
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
var
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
var
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
cells.push(createElement("div", {
|
|
1277
|
-
key: row + "-" + col,
|
|
1278
|
-
className: styles.cell + " " + (isHovered ? styles.hoveredCell : "") + " " + (isSelected ? styles.selectedCell : ""),
|
|
1279
|
-
onMouseEnter: function onMouseEnter() {
|
|
1280
|
-
return handleCellHover(row, col);
|
|
1281
|
-
},
|
|
1282
|
-
onClick: function onClick() {
|
|
1283
|
-
return handleCellClick(row, col);
|
|
1284
|
-
}
|
|
1285
|
-
}));
|
|
1286
|
-
};
|
|
1287
|
-
for (var col = 0; col < maxCols; col++) {
|
|
1288
|
-
_loop2(col);
|
|
1289
|
-
}
|
|
931
|
+
}, [theme]);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
var BUTTON_WIDTH = 100;
|
|
935
|
+
var GAP = 10;
|
|
936
|
+
function useResponsiveLegend(items) {
|
|
937
|
+
var containerRef = useRef(null);
|
|
938
|
+
var _useState = useState(items.length),
|
|
939
|
+
maxVisible = _useState[0],
|
|
940
|
+
setMaxVisible = _useState[1];
|
|
941
|
+
var _useChartUtils = useChartUtils(),
|
|
942
|
+
debounce = _useChartUtils.debounce;
|
|
943
|
+
useEffect(function () {
|
|
944
|
+
var measure = function measure() {
|
|
945
|
+
var _containerRef$current, _containerRef$current2;
|
|
946
|
+
var containerWidth = (_containerRef$current = (_containerRef$current2 = containerRef.current) == null ? void 0 : _containerRef$current2.offsetWidth) != null ? _containerRef$current : 0;
|
|
947
|
+
var itemTotalWidth = BUTTON_WIDTH + GAP;
|
|
948
|
+
var count = Math.floor(containerWidth / itemTotalWidth);
|
|
949
|
+
setMaxVisible(count);
|
|
1290
950
|
};
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
951
|
+
var debouncedMeasure = debounce(measure, 100); // debounce resize
|
|
952
|
+
var observer = new ResizeObserver(debouncedMeasure);
|
|
953
|
+
if (containerRef.current) observer.observe(containerRef.current);
|
|
954
|
+
measure(); // initial
|
|
955
|
+
return function () {
|
|
956
|
+
return observer.disconnect();
|
|
957
|
+
};
|
|
958
|
+
}, [items]);
|
|
959
|
+
return {
|
|
960
|
+
containerRef: containerRef,
|
|
961
|
+
visibleItems: items.slice(0, maxVisible),
|
|
962
|
+
overflowItems: items.slice(maxVisible)
|
|
1295
963
|
};
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
padding: 8
|
|
1317
|
-
}
|
|
1318
|
-
}, createElement("div", {
|
|
1319
|
-
style: {
|
|
1320
|
-
display: "flex",
|
|
1321
|
-
flexDirection: "row",
|
|
1322
|
-
alignItems: "center",
|
|
1323
|
-
gap: "6px",
|
|
1324
|
-
width: "100%",
|
|
1325
|
-
boxSizing: "border-box",
|
|
1326
|
-
padding: "8px"
|
|
1327
|
-
}
|
|
1328
|
-
}, createElement(RenderLabel, {
|
|
1329
|
-
label: "Selected Span (" + values.spanCols + " \xD7 " + values.spanRows + ")",
|
|
1330
|
-
icon: createElement(Icon, {
|
|
1331
|
-
icon: "fluent:number-row-20-regular",
|
|
1332
|
-
width: "32",
|
|
1333
|
-
height: "32"
|
|
1334
|
-
})
|
|
1335
|
-
})), createElement("div", {
|
|
1336
|
-
className: styles.gridContainer,
|
|
1337
|
-
style: {
|
|
1338
|
-
gridTemplateColumns: "repeat(" + maxCols + ", 30px)",
|
|
1339
|
-
gridTemplateRows: "repeat(" + maxRows + ", 30px)"
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
var RenderLegend = function RenderLegend(_ref) {
|
|
967
|
+
var data = _ref.data,
|
|
968
|
+
visibleSeries = _ref.visibleSeries,
|
|
969
|
+
seriesColors = _ref.seriesColors,
|
|
970
|
+
toggleSeries = _ref.toggleSeries;
|
|
971
|
+
var _useResponsiveLegend = useResponsiveLegend(data),
|
|
972
|
+
containerRef = _useResponsiveLegend.containerRef,
|
|
973
|
+
visibleItems = _useResponsiveLegend.visibleItems,
|
|
974
|
+
overflowItems = _useResponsiveLegend.overflowItems;
|
|
975
|
+
return React__default.createElement(LegendContainer, {
|
|
976
|
+
containerRef: containerRef,
|
|
977
|
+
visibleItems: visibleItems,
|
|
978
|
+
overflowItems: overflowItems,
|
|
979
|
+
items: data,
|
|
980
|
+
visibleLabels: visibleSeries,
|
|
981
|
+
toggleLabel: toggleSeries,
|
|
982
|
+
renderLabel: function renderLabel(d) {
|
|
983
|
+
return d.label;
|
|
1340
984
|
},
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
}
|
|
985
|
+
getColor: function getColor(d) {
|
|
986
|
+
return seriesColors[d.label];
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
var _templateObject$1, _templateObject2$1;
|
|
992
|
+
var useGraphGlobalStyles = function useGraphGlobalStyles() {
|
|
993
|
+
return {
|
|
994
|
+
chartWithLegend: css({
|
|
995
|
+
display: 'flex',
|
|
996
|
+
flexDirection: 'column',
|
|
997
|
+
height: '100%',
|
|
998
|
+
chartArea: {
|
|
999
|
+
flexGrow: 1,
|
|
1000
|
+
minHeight: 0
|
|
1001
|
+
}
|
|
1002
|
+
}),
|
|
1003
|
+
chartArea: css(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n flex-grow: 1;\n min-height: 0;\n "]))),
|
|
1004
|
+
legendArea: css(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n margin-top: 0px;\n padding-top: 0px;\n \n margin-Left: 10px;\n margin-Right: 10px;\n \n "])))
|
|
1005
|
+
};
|
|
1345
1006
|
};
|
|
1346
1007
|
|
|
1347
1008
|
Chart.register(CategoryScale, LinearScale, PointElement, LineElement, Tooltip$1, Filler, Legend, ChartDataLabels, Title);
|
|
@@ -1417,7 +1078,169 @@ function AreaChart(_ref) {
|
|
|
1417
1078
|
};
|
|
1418
1079
|
})
|
|
1419
1080
|
};
|
|
1420
|
-
}, [data, visibleSeries, allCategories, getPrimary, getSecondary, seriesColors]);
|
|
1081
|
+
}, [data, visibleSeries, allCategories, getPrimary, getSecondary, seriesColors]);
|
|
1082
|
+
var _useMemo = useMemo(function () {
|
|
1083
|
+
return {
|
|
1084
|
+
fontFamily: theme.fontFamilyBase,
|
|
1085
|
+
fontSize: parseInt(theme.fontSizeBase200.replace('px', '')) || 14,
|
|
1086
|
+
labelColor: theme.colorNeutralForeground1,
|
|
1087
|
+
gridColor: theme.colorNeutralStroke2
|
|
1088
|
+
};
|
|
1089
|
+
}, [theme]),
|
|
1090
|
+
fontFamily = _useMemo.fontFamily,
|
|
1091
|
+
fontSize = _useMemo.fontSize,
|
|
1092
|
+
labelColor = _useMemo.labelColor,
|
|
1093
|
+
gridColor = _useMemo.gridColor;
|
|
1094
|
+
var options = useMemo(function () {
|
|
1095
|
+
return {
|
|
1096
|
+
responsive: true,
|
|
1097
|
+
maintainAspectRatio: false,
|
|
1098
|
+
plugins: {
|
|
1099
|
+
title: {
|
|
1100
|
+
display: !!title,
|
|
1101
|
+
text: title,
|
|
1102
|
+
font: {
|
|
1103
|
+
size: 14,
|
|
1104
|
+
family: theme.fontFamilyBase,
|
|
1105
|
+
weight: theme.fontWeightSemibold
|
|
1106
|
+
},
|
|
1107
|
+
color: theme.colorNeutralForeground1,
|
|
1108
|
+
padding: {
|
|
1109
|
+
top: 20,
|
|
1110
|
+
bottom: 20
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1113
|
+
datalabels: {
|
|
1114
|
+
display: showDatalabels,
|
|
1115
|
+
color: theme.colorNeutralForeground1,
|
|
1116
|
+
font: {
|
|
1117
|
+
family: theme.fontFamilyBase,
|
|
1118
|
+
size: parseInt(theme.fontSizeBase200.replace('px', '')) || 14
|
|
1119
|
+
}
|
|
1120
|
+
},
|
|
1121
|
+
legend: {
|
|
1122
|
+
display: false
|
|
1123
|
+
},
|
|
1124
|
+
tooltip: createFluentTooltip(theme)
|
|
1125
|
+
},
|
|
1126
|
+
scales: {
|
|
1127
|
+
x: {
|
|
1128
|
+
stacked: stacked,
|
|
1129
|
+
ticks: {
|
|
1130
|
+
color: labelColor,
|
|
1131
|
+
font: {
|
|
1132
|
+
family: fontFamily,
|
|
1133
|
+
size: fontSize
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
grid: {
|
|
1137
|
+
color: gridColor
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
y: {
|
|
1141
|
+
stacked: stacked,
|
|
1142
|
+
ticks: {
|
|
1143
|
+
color: labelColor,
|
|
1144
|
+
font: {
|
|
1145
|
+
family: fontFamily,
|
|
1146
|
+
size: fontSize
|
|
1147
|
+
}
|
|
1148
|
+
},
|
|
1149
|
+
grid: {
|
|
1150
|
+
color: gridColor
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
}, [title, showDatalabels, theme, fontFamily, fontSize, labelColor, gridColor, stacked, createFluentTooltip]);
|
|
1156
|
+
return React__default.createElement("div", {
|
|
1157
|
+
className: styles.chartWithLegend
|
|
1158
|
+
}, React__default.createElement("div", {
|
|
1159
|
+
className: styles.chartArea
|
|
1160
|
+
}, React__default.createElement(Line, {
|
|
1161
|
+
data: chartData,
|
|
1162
|
+
options: options
|
|
1163
|
+
})), React__default.createElement(RenderLegend, {
|
|
1164
|
+
data: data,
|
|
1165
|
+
visibleSeries: visibleSeries,
|
|
1166
|
+
seriesColors: seriesColors,
|
|
1167
|
+
toggleSeries: toggleSeries
|
|
1168
|
+
}));
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
Chart.register(CategoryScale, LinearScale, BarElement, Tooltip$1, Legend, ChartDataLabels, Title);
|
|
1172
|
+
function BarChart(_ref) {
|
|
1173
|
+
var data = _ref.data,
|
|
1174
|
+
getPrimary = _ref.getPrimary,
|
|
1175
|
+
getSecondary = _ref.getSecondary,
|
|
1176
|
+
title = _ref.title,
|
|
1177
|
+
_ref$showDatalabels = _ref.showDatalabels,
|
|
1178
|
+
showDatalabels = _ref$showDatalabels === void 0 ? false : _ref$showDatalabels,
|
|
1179
|
+
_ref$stacked = _ref.stacked,
|
|
1180
|
+
stacked = _ref$stacked === void 0 ? false : _ref$stacked,
|
|
1181
|
+
theme = _ref.theme;
|
|
1182
|
+
var _useState = useState(function () {
|
|
1183
|
+
var _data$;
|
|
1184
|
+
return data.length > 1 ? data.map(function (s) {
|
|
1185
|
+
return s.label;
|
|
1186
|
+
}) : [(_data$ = data[0]) == null ? void 0 : _data$.label];
|
|
1187
|
+
}),
|
|
1188
|
+
visibleSeries = _useState[0],
|
|
1189
|
+
setVisibleSeries = _useState[1];
|
|
1190
|
+
var _useChartUtils = useChartUtils(theme),
|
|
1191
|
+
lightenColor = _useChartUtils.lightenColor,
|
|
1192
|
+
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
1193
|
+
createFluentTooltip = _useChartUtils.createFluentTooltip;
|
|
1194
|
+
var styles = useGraphGlobalStyles();
|
|
1195
|
+
var seriesColors = useMemo(function () {
|
|
1196
|
+
return data.reduce(function (acc, series, idx) {
|
|
1197
|
+
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
1198
|
+
var color = lightenColor(base, 0.3);
|
|
1199
|
+
acc[series.label] = color;
|
|
1200
|
+
return acc;
|
|
1201
|
+
}, {});
|
|
1202
|
+
}, [data]);
|
|
1203
|
+
var toggleSeries = function toggleSeries(label) {
|
|
1204
|
+
setVisibleSeries(function (prev) {
|
|
1205
|
+
var isVisible = prev.includes(label);
|
|
1206
|
+
var next = isVisible ? prev.filter(function (l) {
|
|
1207
|
+
return l !== label;
|
|
1208
|
+
}) : [].concat(prev, [label]);
|
|
1209
|
+
return next.length === 0 && data.length > 0 ? [data[0].label] : next;
|
|
1210
|
+
});
|
|
1211
|
+
};
|
|
1212
|
+
// Extract all unique x-axis categories (from all series)
|
|
1213
|
+
var allCategories = useMemo(function () {
|
|
1214
|
+
var categorySet = new Set();
|
|
1215
|
+
data.forEach(function (series) {
|
|
1216
|
+
series.data.forEach(function (datum) {
|
|
1217
|
+
categorySet.add(getPrimary(datum));
|
|
1218
|
+
});
|
|
1219
|
+
});
|
|
1220
|
+
return Array.from(categorySet);
|
|
1221
|
+
}, [data, getPrimary]);
|
|
1222
|
+
// Construct Chart.js datasets
|
|
1223
|
+
var chartData = useMemo(function () {
|
|
1224
|
+
return {
|
|
1225
|
+
labels: allCategories,
|
|
1226
|
+
datasets: data.filter(function (series) {
|
|
1227
|
+
return visibleSeries.includes(series.label);
|
|
1228
|
+
}).map(function (series) {
|
|
1229
|
+
return {
|
|
1230
|
+
label: series.label,
|
|
1231
|
+
backgroundColor: seriesColors[series.label],
|
|
1232
|
+
data: allCategories.map(function (cat) {
|
|
1233
|
+
var found = series.data.find(function (d) {
|
|
1234
|
+
return getPrimary(d) === cat;
|
|
1235
|
+
});
|
|
1236
|
+
return found ? getSecondary(found) : 0;
|
|
1237
|
+
}),
|
|
1238
|
+
// Assign y-axis based on series type when stacked
|
|
1239
|
+
yAxisID: stacked ? series.type === 'line' ? 'y1' : 'y' : 'y'
|
|
1240
|
+
};
|
|
1241
|
+
})
|
|
1242
|
+
};
|
|
1243
|
+
}, [data, visibleSeries, allCategories, seriesColors, stacked]);
|
|
1421
1244
|
var _useMemo = useMemo(function () {
|
|
1422
1245
|
return {
|
|
1423
1246
|
fontFamily: theme.fontFamilyBase,
|
|
@@ -1462,10 +1285,13 @@ function AreaChart(_ref) {
|
|
|
1462
1285
|
},
|
|
1463
1286
|
tooltip: createFluentTooltip(theme)
|
|
1464
1287
|
},
|
|
1465
|
-
scales: {
|
|
1288
|
+
scales: _extends({
|
|
1466
1289
|
x: {
|
|
1467
1290
|
stacked: stacked,
|
|
1468
1291
|
ticks: {
|
|
1292
|
+
callback: createAxisLabelFormatter({
|
|
1293
|
+
maxLength: 10
|
|
1294
|
+
}),
|
|
1469
1295
|
color: labelColor,
|
|
1470
1296
|
font: {
|
|
1471
1297
|
family: fontFamily,
|
|
@@ -1477,8 +1303,13 @@ function AreaChart(_ref) {
|
|
|
1477
1303
|
}
|
|
1478
1304
|
},
|
|
1479
1305
|
y: {
|
|
1306
|
+
type: 'linear',
|
|
1307
|
+
position: 'left',
|
|
1480
1308
|
stacked: stacked,
|
|
1481
1309
|
ticks: {
|
|
1310
|
+
callback: createAxisLabelFormatter({
|
|
1311
|
+
maxLength: 10
|
|
1312
|
+
}),
|
|
1482
1313
|
color: labelColor,
|
|
1483
1314
|
font: {
|
|
1484
1315
|
family: fontFamily,
|
|
@@ -1489,22 +1320,42 @@ function AreaChart(_ref) {
|
|
|
1489
1320
|
color: gridColor
|
|
1490
1321
|
}
|
|
1491
1322
|
}
|
|
1492
|
-
}
|
|
1323
|
+
}, stacked && {
|
|
1324
|
+
y1: {
|
|
1325
|
+
type: 'linear',
|
|
1326
|
+
position: 'right',
|
|
1327
|
+
ticks: {
|
|
1328
|
+
callback: createAxisLabelFormatter({
|
|
1329
|
+
maxLength: 10
|
|
1330
|
+
}),
|
|
1331
|
+
color: labelColor,
|
|
1332
|
+
font: {
|
|
1333
|
+
family: fontFamily,
|
|
1334
|
+
size: fontSize
|
|
1335
|
+
}
|
|
1336
|
+
},
|
|
1337
|
+
grid: {
|
|
1338
|
+
drawOnChartArea: false
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
})
|
|
1493
1342
|
};
|
|
1494
1343
|
}, [title, showDatalabels, theme, fontFamily, fontSize, labelColor, gridColor, stacked, createFluentTooltip]);
|
|
1495
1344
|
return React__default.createElement("div", {
|
|
1496
1345
|
className: styles.chartWithLegend
|
|
1497
1346
|
}, React__default.createElement("div", {
|
|
1498
1347
|
className: styles.chartArea
|
|
1499
|
-
}, React__default.createElement(
|
|
1348
|
+
}, React__default.createElement(Bar, {
|
|
1500
1349
|
data: chartData,
|
|
1501
1350
|
options: options
|
|
1502
|
-
})), React__default.createElement(
|
|
1351
|
+
})), React__default.createElement("div", {
|
|
1352
|
+
className: styles.legendArea
|
|
1353
|
+
}, React__default.createElement(RenderLegend, {
|
|
1503
1354
|
data: data,
|
|
1504
1355
|
visibleSeries: visibleSeries,
|
|
1505
1356
|
seriesColors: seriesColors,
|
|
1506
1357
|
toggleSeries: toggleSeries
|
|
1507
|
-
}));
|
|
1358
|
+
})));
|
|
1508
1359
|
}
|
|
1509
1360
|
|
|
1510
1361
|
Chart.register(CategoryScale, LinearScale, BarElement, Tooltip$1, Legend, Title, ChartDataLabels);
|
|
@@ -1821,6 +1672,180 @@ function BubbleChart(_ref) {
|
|
|
1821
1672
|
}))));
|
|
1822
1673
|
}
|
|
1823
1674
|
|
|
1675
|
+
Chart.register(ChartDataLabels);
|
|
1676
|
+
Chart.register(CategoryScale, LinearScale, BarElement, LineElement, PointElement, Tooltip$1, Legend, Title);
|
|
1677
|
+
function ComboChart(_ref) {
|
|
1678
|
+
var data = _ref.data,
|
|
1679
|
+
getPrimary = _ref.getPrimary,
|
|
1680
|
+
getSecondary = _ref.getSecondary,
|
|
1681
|
+
title = _ref.title,
|
|
1682
|
+
_ref$showDataLabels = _ref.showDataLabels,
|
|
1683
|
+
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
1684
|
+
_ref$theme = _ref.theme,
|
|
1685
|
+
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme;
|
|
1686
|
+
var _useState = useState(function () {
|
|
1687
|
+
return data.map(function (s) {
|
|
1688
|
+
return s.label;
|
|
1689
|
+
});
|
|
1690
|
+
}),
|
|
1691
|
+
visibleSeries = _useState[0],
|
|
1692
|
+
setVisibleSeries = _useState[1];
|
|
1693
|
+
var styles = useGraphGlobalStyles();
|
|
1694
|
+
var _useChartUtils = useChartUtils(theme),
|
|
1695
|
+
lightenColor = _useChartUtils.lightenColor,
|
|
1696
|
+
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
1697
|
+
createFluentTooltip = _useChartUtils.createFluentTooltip;
|
|
1698
|
+
var seriesColors = useMemo(function () {
|
|
1699
|
+
return data.reduce(function (acc, series, idx) {
|
|
1700
|
+
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
1701
|
+
acc[series.label] = lightenColor(base, 0.3);
|
|
1702
|
+
return acc;
|
|
1703
|
+
}, {});
|
|
1704
|
+
}, [data, theme]);
|
|
1705
|
+
var toggleSeries = function toggleSeries(label) {
|
|
1706
|
+
setVisibleSeries(function (prev) {
|
|
1707
|
+
var isVisible = prev.includes(label);
|
|
1708
|
+
var next = isVisible ? prev.filter(function (l) {
|
|
1709
|
+
return l !== label;
|
|
1710
|
+
}) : [].concat(prev, [label]);
|
|
1711
|
+
return next.length === 0 ? [data[0].label] : next;
|
|
1712
|
+
});
|
|
1713
|
+
};
|
|
1714
|
+
var allCategories = useMemo(function () {
|
|
1715
|
+
var set = new Set();
|
|
1716
|
+
data.forEach(function (series) {
|
|
1717
|
+
return series.data.forEach(function (d) {
|
|
1718
|
+
return set.add(getPrimary(d));
|
|
1719
|
+
});
|
|
1720
|
+
});
|
|
1721
|
+
return Array.from(set);
|
|
1722
|
+
}, [data, getPrimary]);
|
|
1723
|
+
var chartData = useMemo(function () {
|
|
1724
|
+
var sortedSeries = data.filter(function (series) {
|
|
1725
|
+
return visibleSeries.includes(series.label);
|
|
1726
|
+
}).sort(function (a, b) {
|
|
1727
|
+
// Ensure bars come before lines
|
|
1728
|
+
if (a.type === 'bar' && b.type === 'line') return -1;
|
|
1729
|
+
if (a.type === 'line' && b.type === 'bar') return 1;
|
|
1730
|
+
return 0;
|
|
1731
|
+
});
|
|
1732
|
+
return {
|
|
1733
|
+
labels: allCategories,
|
|
1734
|
+
datasets: sortedSeries.map(function (series) {
|
|
1735
|
+
var _series$yAxisID;
|
|
1736
|
+
return {
|
|
1737
|
+
type: series.type,
|
|
1738
|
+
label: series.label,
|
|
1739
|
+
yAxisID: (_series$yAxisID = series.yAxisID) != null ? _series$yAxisID : 'y',
|
|
1740
|
+
data: allCategories.map(function (cat) {
|
|
1741
|
+
var found = series.data.find(function (d) {
|
|
1742
|
+
return getPrimary(d) === cat;
|
|
1743
|
+
});
|
|
1744
|
+
return found ? getSecondary(found) : 0;
|
|
1745
|
+
}),
|
|
1746
|
+
backgroundColor: seriesColors[series.label],
|
|
1747
|
+
borderColor: seriesColors[series.label],
|
|
1748
|
+
fill: series.type === 'bar',
|
|
1749
|
+
tension: series.type === 'line' ? 0.4 : 0,
|
|
1750
|
+
pointRadius: series.type === 'line' ? 3 : 0,
|
|
1751
|
+
borderWidth: series.type === 'line' ? 2 : 1,
|
|
1752
|
+
order: series.type === 'bar' ? 1 : 0
|
|
1753
|
+
};
|
|
1754
|
+
})
|
|
1755
|
+
};
|
|
1756
|
+
}, [data, visibleSeries, allCategories, getPrimary, getSecondary, seriesColors]);
|
|
1757
|
+
var _useMemo = useMemo(function () {
|
|
1758
|
+
return {
|
|
1759
|
+
fontFamily: theme.fontFamilyBase,
|
|
1760
|
+
fontSize: parseInt(theme.fontSizeBase200.replace('px', '')) || 14,
|
|
1761
|
+
labelColor: theme.colorNeutralForeground1,
|
|
1762
|
+
gridColor: theme.colorNeutralStroke2
|
|
1763
|
+
};
|
|
1764
|
+
}, [theme]),
|
|
1765
|
+
fontFamily = _useMemo.fontFamily,
|
|
1766
|
+
fontSize = _useMemo.fontSize,
|
|
1767
|
+
labelColor = _useMemo.labelColor,
|
|
1768
|
+
gridColor = _useMemo.gridColor;
|
|
1769
|
+
var options = useMemo(function () {
|
|
1770
|
+
return {
|
|
1771
|
+
responsive: true,
|
|
1772
|
+
maintainAspectRatio: false,
|
|
1773
|
+
plugins: {
|
|
1774
|
+
title: {
|
|
1775
|
+
display: !!title,
|
|
1776
|
+
text: title,
|
|
1777
|
+
font: {
|
|
1778
|
+
size: 14,
|
|
1779
|
+
family: theme.fontFamilyBase,
|
|
1780
|
+
weight: theme.fontWeightSemibold
|
|
1781
|
+
},
|
|
1782
|
+
color: theme.colorNeutralForeground1,
|
|
1783
|
+
padding: {
|
|
1784
|
+
top: 20,
|
|
1785
|
+
bottom: 20
|
|
1786
|
+
}
|
|
1787
|
+
},
|
|
1788
|
+
datalabels: {
|
|
1789
|
+
display: showDataLabels,
|
|
1790
|
+
color: theme.colorNeutralForeground1,
|
|
1791
|
+
font: {
|
|
1792
|
+
family: theme.fontFamilyBase,
|
|
1793
|
+
size: parseInt(theme.fontSizeBase200.replace('px', '')) || 14
|
|
1794
|
+
}
|
|
1795
|
+
},
|
|
1796
|
+
legend: {
|
|
1797
|
+
display: false
|
|
1798
|
+
},
|
|
1799
|
+
tooltip: createFluentTooltip(theme)
|
|
1800
|
+
},
|
|
1801
|
+
scales: {
|
|
1802
|
+
x: {
|
|
1803
|
+
ticks: {
|
|
1804
|
+
color: labelColor,
|
|
1805
|
+
font: {
|
|
1806
|
+
family: fontFamily,
|
|
1807
|
+
size: fontSize
|
|
1808
|
+
}
|
|
1809
|
+
},
|
|
1810
|
+
grid: {
|
|
1811
|
+
color: gridColor
|
|
1812
|
+
}
|
|
1813
|
+
},
|
|
1814
|
+
y: {
|
|
1815
|
+
position: 'left',
|
|
1816
|
+
ticks: {
|
|
1817
|
+
color: labelColor,
|
|
1818
|
+
font: {
|
|
1819
|
+
family: fontFamily,
|
|
1820
|
+
size: fontSize
|
|
1821
|
+
}
|
|
1822
|
+
},
|
|
1823
|
+
grid: {
|
|
1824
|
+
color: gridColor
|
|
1825
|
+
},
|
|
1826
|
+
stacked: false
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
};
|
|
1830
|
+
}, [title, showDataLabels, theme, fontFamily, fontSize, labelColor, gridColor, createFluentTooltip]);
|
|
1831
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
1832
|
+
className: styles.chartWithLegend
|
|
1833
|
+
}, React__default.createElement("div", {
|
|
1834
|
+
className: styles.chartArea
|
|
1835
|
+
}, React__default.createElement(Chart$1, {
|
|
1836
|
+
type: "bar",
|
|
1837
|
+
data: chartData,
|
|
1838
|
+
options: options
|
|
1839
|
+
})), React__default.createElement("div", {
|
|
1840
|
+
className: styles.legendArea
|
|
1841
|
+
}, React__default.createElement(RenderLegend, {
|
|
1842
|
+
data: data,
|
|
1843
|
+
visibleSeries: visibleSeries,
|
|
1844
|
+
seriesColors: seriesColors,
|
|
1845
|
+
toggleSeries: toggleSeries
|
|
1846
|
+
}))));
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1824
1849
|
var RenderValueLegend = function RenderValueLegend(_ref) {
|
|
1825
1850
|
var entries = _ref.entries,
|
|
1826
1851
|
visibleLabels = _ref.visibleLabels,
|
|
@@ -3502,6 +3527,268 @@ var useDashboardStyles = function useDashboardStyles() {
|
|
|
3502
3527
|
};
|
|
3503
3528
|
};
|
|
3504
3529
|
|
|
3530
|
+
var CACHE = "application-cache";
|
|
3531
|
+
var openDatabase = /*#__PURE__*/function () {
|
|
3532
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
3533
|
+
return _regenerator().w(function (_context) {
|
|
3534
|
+
while (1) switch (_context.n) {
|
|
3535
|
+
case 0:
|
|
3536
|
+
return _context.a(2, openDB('app-cache-db', 1, {
|
|
3537
|
+
upgrade: function upgrade(db) {
|
|
3538
|
+
db.createObjectStore(CACHE);
|
|
3539
|
+
}
|
|
3540
|
+
}));
|
|
3541
|
+
}
|
|
3542
|
+
}, _callee);
|
|
3543
|
+
}));
|
|
3544
|
+
return function openDatabase() {
|
|
3545
|
+
return _ref.apply(this, arguments);
|
|
3546
|
+
};
|
|
3547
|
+
}();
|
|
3548
|
+
var getCachedData = /*#__PURE__*/function () {
|
|
3549
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(key) {
|
|
3550
|
+
var db, cached;
|
|
3551
|
+
return _regenerator().w(function (_context2) {
|
|
3552
|
+
while (1) switch (_context2.n) {
|
|
3553
|
+
case 0:
|
|
3554
|
+
_context2.n = 1;
|
|
3555
|
+
return openDatabase();
|
|
3556
|
+
case 1:
|
|
3557
|
+
db = _context2.v;
|
|
3558
|
+
_context2.n = 2;
|
|
3559
|
+
return db.get(CACHE, key);
|
|
3560
|
+
case 2:
|
|
3561
|
+
cached = _context2.v;
|
|
3562
|
+
return _context2.a(2, cached ? cached.data : undefined);
|
|
3563
|
+
}
|
|
3564
|
+
}, _callee2);
|
|
3565
|
+
}));
|
|
3566
|
+
return function getCachedData(_x) {
|
|
3567
|
+
return _ref2.apply(this, arguments);
|
|
3568
|
+
};
|
|
3569
|
+
}();
|
|
3570
|
+
var setCachedData = /*#__PURE__*/function () {
|
|
3571
|
+
var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(key, data) {
|
|
3572
|
+
var db;
|
|
3573
|
+
return _regenerator().w(function (_context3) {
|
|
3574
|
+
while (1) switch (_context3.n) {
|
|
3575
|
+
case 0:
|
|
3576
|
+
_context3.n = 1;
|
|
3577
|
+
return openDatabase();
|
|
3578
|
+
case 1:
|
|
3579
|
+
db = _context3.v;
|
|
3580
|
+
_context3.n = 2;
|
|
3581
|
+
return db.put(CACHE, {
|
|
3582
|
+
data: data,
|
|
3583
|
+
timestamp: Date.now()
|
|
3584
|
+
}, key);
|
|
3585
|
+
case 2:
|
|
3586
|
+
return _context3.a(2);
|
|
3587
|
+
}
|
|
3588
|
+
}, _callee3);
|
|
3589
|
+
}));
|
|
3590
|
+
return function setCachedData(_x2, _x3) {
|
|
3591
|
+
return _ref3.apply(this, arguments);
|
|
3592
|
+
};
|
|
3593
|
+
}();
|
|
3594
|
+
var deleteCachedData = /*#__PURE__*/function () {
|
|
3595
|
+
var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(key) {
|
|
3596
|
+
var db;
|
|
3597
|
+
return _regenerator().w(function (_context4) {
|
|
3598
|
+
while (1) switch (_context4.n) {
|
|
3599
|
+
case 0:
|
|
3600
|
+
_context4.n = 1;
|
|
3601
|
+
return openDatabase();
|
|
3602
|
+
case 1:
|
|
3603
|
+
db = _context4.v;
|
|
3604
|
+
_context4.n = 2;
|
|
3605
|
+
return db["delete"](CACHE, key);
|
|
3606
|
+
case 2:
|
|
3607
|
+
return _context4.a(2);
|
|
3608
|
+
}
|
|
3609
|
+
}, _callee4);
|
|
3610
|
+
}));
|
|
3611
|
+
return function deleteCachedData(_x4) {
|
|
3612
|
+
return _ref4.apply(this, arguments);
|
|
3613
|
+
};
|
|
3614
|
+
}();
|
|
3615
|
+
var clearCache = /*#__PURE__*/function () {
|
|
3616
|
+
var _ref5 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
3617
|
+
var db;
|
|
3618
|
+
return _regenerator().w(function (_context5) {
|
|
3619
|
+
while (1) switch (_context5.n) {
|
|
3620
|
+
case 0:
|
|
3621
|
+
_context5.n = 1;
|
|
3622
|
+
return openDatabase();
|
|
3623
|
+
case 1:
|
|
3624
|
+
db = _context5.v;
|
|
3625
|
+
_context5.n = 2;
|
|
3626
|
+
return db.clear(CACHE);
|
|
3627
|
+
case 2:
|
|
3628
|
+
return _context5.a(2);
|
|
3629
|
+
}
|
|
3630
|
+
}, _callee5);
|
|
3631
|
+
}));
|
|
3632
|
+
return function clearCache() {
|
|
3633
|
+
return _ref5.apply(this, arguments);
|
|
3634
|
+
};
|
|
3635
|
+
}();
|
|
3636
|
+
var clearExpiredCache = /*#__PURE__*/function () {
|
|
3637
|
+
var _ref6 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(maxAge) {
|
|
3638
|
+
var db, allKeys, now, _iterator, _step, key, cached;
|
|
3639
|
+
return _regenerator().w(function (_context6) {
|
|
3640
|
+
while (1) switch (_context6.n) {
|
|
3641
|
+
case 0:
|
|
3642
|
+
_context6.n = 1;
|
|
3643
|
+
return openDatabase();
|
|
3644
|
+
case 1:
|
|
3645
|
+
db = _context6.v;
|
|
3646
|
+
_context6.n = 2;
|
|
3647
|
+
return db.getAllKeys(CACHE);
|
|
3648
|
+
case 2:
|
|
3649
|
+
allKeys = _context6.v;
|
|
3650
|
+
now = Date.now();
|
|
3651
|
+
_iterator = _createForOfIteratorHelperLoose(allKeys);
|
|
3652
|
+
case 3:
|
|
3653
|
+
if ((_step = _iterator()).done) {
|
|
3654
|
+
_context6.n = 6;
|
|
3655
|
+
break;
|
|
3656
|
+
}
|
|
3657
|
+
key = _step.value;
|
|
3658
|
+
_context6.n = 4;
|
|
3659
|
+
return db.get(CACHE, key);
|
|
3660
|
+
case 4:
|
|
3661
|
+
cached = _context6.v;
|
|
3662
|
+
if (!(cached && now - cached.timestamp > maxAge)) {
|
|
3663
|
+
_context6.n = 5;
|
|
3664
|
+
break;
|
|
3665
|
+
}
|
|
3666
|
+
_context6.n = 5;
|
|
3667
|
+
return db["delete"](CACHE, key);
|
|
3668
|
+
case 5:
|
|
3669
|
+
_context6.n = 3;
|
|
3670
|
+
break;
|
|
3671
|
+
case 6:
|
|
3672
|
+
return _context6.a(2);
|
|
3673
|
+
}
|
|
3674
|
+
}, _callee6);
|
|
3675
|
+
}));
|
|
3676
|
+
return function clearExpiredCache(_x5) {
|
|
3677
|
+
return _ref6.apply(this, arguments);
|
|
3678
|
+
};
|
|
3679
|
+
}();
|
|
3680
|
+
var DEFAULT_MAX_AGE = 24 * 60 * 60 * 1000; // 1 day in milliseconds
|
|
3681
|
+
/**
|
|
3682
|
+
* Custom hook to manage IndexedDB cache with a specified maximum age.
|
|
3683
|
+
*
|
|
3684
|
+
* @template T - The type of data to be cached.
|
|
3685
|
+
* @param {number} [maxAge=DEFAULT_MAX_AGE] - The maximum age (in milliseconds) for cached data before it is considered expired.
|
|
3686
|
+
* @returns {UseIndexedDBCacheReturn<T>} An object containing methods to interact with the cache.
|
|
3687
|
+
*
|
|
3688
|
+
* @example
|
|
3689
|
+
* const { getData, setData, deleteData, clearAllCache } = useIndexedDBCache<MyDataType>(3600000);
|
|
3690
|
+
*
|
|
3691
|
+
* @function
|
|
3692
|
+
* @name useIndexedDBCache
|
|
3693
|
+
* @memberof hooks
|
|
3694
|
+
* @inner
|
|
3695
|
+
*
|
|
3696
|
+
* @typedef {Object} UseIndexedDBCacheReturn<T>
|
|
3697
|
+
* @property {function(string): Promise<T | undefined>} getData - Retrieves cached data by key.
|
|
3698
|
+
* @property {function(string, T): Promise<void>} setData - Caches data with a specified key.
|
|
3699
|
+
* @property {function(string): Promise<void>} deleteData - Deletes cached data by key.
|
|
3700
|
+
* @property {function(): Promise<void>} clearAllCache - Clears all cached data.
|
|
3701
|
+
*/
|
|
3702
|
+
var useIndexedDBCache = function useIndexedDBCache(maxAge) {
|
|
3703
|
+
if (maxAge === void 0) {
|
|
3704
|
+
maxAge = DEFAULT_MAX_AGE;
|
|
3705
|
+
}
|
|
3706
|
+
useEffect(function () {
|
|
3707
|
+
// Clear expired cache on component mount
|
|
3708
|
+
_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
3709
|
+
return _regenerator().w(function (_context7) {
|
|
3710
|
+
while (1) switch (_context7.n) {
|
|
3711
|
+
case 0:
|
|
3712
|
+
_context7.n = 1;
|
|
3713
|
+
return clearExpiredCache(maxAge);
|
|
3714
|
+
case 1:
|
|
3715
|
+
return _context7.a(2);
|
|
3716
|
+
}
|
|
3717
|
+
}, _callee7);
|
|
3718
|
+
}))();
|
|
3719
|
+
}, [maxAge]);
|
|
3720
|
+
var getData = /*#__PURE__*/function () {
|
|
3721
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(key) {
|
|
3722
|
+
return _regenerator().w(function (_context8) {
|
|
3723
|
+
while (1) switch (_context8.n) {
|
|
3724
|
+
case 0:
|
|
3725
|
+
_context8.n = 1;
|
|
3726
|
+
return getCachedData(key);
|
|
3727
|
+
case 1:
|
|
3728
|
+
return _context8.a(2, _context8.v);
|
|
3729
|
+
}
|
|
3730
|
+
}, _callee8);
|
|
3731
|
+
}));
|
|
3732
|
+
return function getData(_x6) {
|
|
3733
|
+
return _ref8.apply(this, arguments);
|
|
3734
|
+
};
|
|
3735
|
+
}();
|
|
3736
|
+
var setData = /*#__PURE__*/function () {
|
|
3737
|
+
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(key, data) {
|
|
3738
|
+
return _regenerator().w(function (_context9) {
|
|
3739
|
+
while (1) switch (_context9.n) {
|
|
3740
|
+
case 0:
|
|
3741
|
+
_context9.n = 1;
|
|
3742
|
+
return setCachedData(key, data);
|
|
3743
|
+
case 1:
|
|
3744
|
+
return _context9.a(2);
|
|
3745
|
+
}
|
|
3746
|
+
}, _callee9);
|
|
3747
|
+
}));
|
|
3748
|
+
return function setData(_x7, _x8) {
|
|
3749
|
+
return _ref9.apply(this, arguments);
|
|
3750
|
+
};
|
|
3751
|
+
}();
|
|
3752
|
+
var deleteData = /*#__PURE__*/function () {
|
|
3753
|
+
var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(key) {
|
|
3754
|
+
return _regenerator().w(function (_context0) {
|
|
3755
|
+
while (1) switch (_context0.n) {
|
|
3756
|
+
case 0:
|
|
3757
|
+
_context0.n = 1;
|
|
3758
|
+
return deleteCachedData(key);
|
|
3759
|
+
case 1:
|
|
3760
|
+
return _context0.a(2);
|
|
3761
|
+
}
|
|
3762
|
+
}, _callee0);
|
|
3763
|
+
}));
|
|
3764
|
+
return function deleteData(_x9) {
|
|
3765
|
+
return _ref0.apply(this, arguments);
|
|
3766
|
+
};
|
|
3767
|
+
}();
|
|
3768
|
+
var clearAllCache = /*#__PURE__*/function () {
|
|
3769
|
+
var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
3770
|
+
return _regenerator().w(function (_context1) {
|
|
3771
|
+
while (1) switch (_context1.n) {
|
|
3772
|
+
case 0:
|
|
3773
|
+
_context1.n = 1;
|
|
3774
|
+
return clearCache();
|
|
3775
|
+
case 1:
|
|
3776
|
+
return _context1.a(2);
|
|
3777
|
+
}
|
|
3778
|
+
}, _callee1);
|
|
3779
|
+
}));
|
|
3780
|
+
return function clearAllCache() {
|
|
3781
|
+
return _ref1.apply(this, arguments);
|
|
3782
|
+
};
|
|
3783
|
+
}();
|
|
3784
|
+
return {
|
|
3785
|
+
getData: getData,
|
|
3786
|
+
setData: setData,
|
|
3787
|
+
deleteData: deleteData,
|
|
3788
|
+
clearAllCache: clearAllCache
|
|
3789
|
+
};
|
|
3790
|
+
};
|
|
3791
|
+
|
|
3505
3792
|
var MINIMUM_DASHBOARD_WIDTH = 600;
|
|
3506
3793
|
var MAX_ROWS = 4;
|
|
3507
3794
|
var DASHBOARD_LAYOUT_CACHE_KEY = 'dashboard-layout-settings';
|
|
@@ -3605,7 +3892,7 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
3605
3892
|
};
|
|
3606
3893
|
}();
|
|
3607
3894
|
initializeData();
|
|
3608
|
-
}, [cardCharts
|
|
3895
|
+
}, [cardCharts]); // Only depend on cardCharts - getData/getOrderData are stable
|
|
3609
3896
|
// Save sizes to cache whenever they change
|
|
3610
3897
|
useEffect(function () {
|
|
3611
3898
|
var saveSizesToCache = /*#__PURE__*/function () {
|
|
@@ -3637,7 +3924,7 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
3637
3924
|
if (Object.keys(sizes).length > 0) {
|
|
3638
3925
|
saveSizesToCache();
|
|
3639
3926
|
}
|
|
3640
|
-
}, [sizes
|
|
3927
|
+
}, [sizes]); // Only depend on sizes - setData is stable
|
|
3641
3928
|
// Save card order to cache whenever it changes
|
|
3642
3929
|
useEffect(function () {
|
|
3643
3930
|
var saveOrderToCache = /*#__PURE__*/function () {
|
|
@@ -3672,7 +3959,7 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
3672
3959
|
if (CardChartContainer.length > 0) {
|
|
3673
3960
|
saveOrderToCache();
|
|
3674
3961
|
}
|
|
3675
|
-
}, [CardChartContainer
|
|
3962
|
+
}, [CardChartContainer]); // Only depend on CardChartContainer - setOrderData is stable
|
|
3676
3963
|
useEffect(function () {
|
|
3677
3964
|
if (containerWidth <= MINIMUM_DASHBOARD_WIDTH) {
|
|
3678
3965
|
setSizes(function () {
|
|
@@ -3796,5 +4083,5 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
3796
4083
|
}, renderCards));
|
|
3797
4084
|
};
|
|
3798
4085
|
|
|
3799
|
-
export { Dashboard, createAxisLabelFormatter, createFluentTooltip, getFluentPalette, lightenColor, useChartUtils, useChartUtils as useGraphUtils };
|
|
4086
|
+
export { AreaChart, BarChart, BarHorizontalChart, BubbleChart, ComboChart, Dashboard, DoughnutChart, FloatingBarChart, LineChart, PieChart, PolarChart, RadarChart, ScatterChart, StackedLineChart, SteamChart, createAxisLabelFormatter, createFluentTooltip, getFluentPalette, lightenColor, useChartUtils, useChartUtils as useGraphUtils };
|
|
3800
4087
|
//# sourceMappingURL=fluentui-react-charts.esm.js.map
|