logitude-dashboard-library 3.1.34 → 3.1.35
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/features/Dashboard/ChartsComponents/FusionCharts/FusionChartObjectBuilder.d.ts +1 -0
- package/dist/features/Dashboard/ChartsComponents/FusionCharts/FusionChartObjectHelper.d.ts +3 -0
- package/dist/features/Dashboard/ChartsComponents/FusionCharts/GaugeChart.d.ts +12 -0
- package/dist/index.js +230 -9
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +230 -9
- package/dist/index.modern.js.map +1 -1
- package/dist/services/DashboardAnalyticsService.d.ts +1 -0
- package/dist/types/widget.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,3 +2,4 @@ import { ChartObject } from "fusioncharts";
|
|
|
2
2
|
import { SeriesMeasure } from "../../../../types/SeriesMeasure";
|
|
3
3
|
import { ReactWidgetPM } from "../../../../types/widget";
|
|
4
4
|
export declare function BuildFusionChartObject(seriesMeasures: SeriesMeasure[], widget: ReactWidgetPM): ChartObject;
|
|
5
|
+
export declare const getGaugeObject: (data: any, widget: ReactWidgetPM) => ChartObject;
|
|
@@ -90,6 +90,9 @@ export interface ChartInfo {
|
|
|
90
90
|
decimalSeparator: string | null;
|
|
91
91
|
thousandSeparator: string | null;
|
|
92
92
|
formatNumberScale: string | null;
|
|
93
|
+
manageResize: string | null;
|
|
94
|
+
valueBelowPivot: string | null;
|
|
95
|
+
showValue: string | null;
|
|
93
96
|
}
|
|
94
97
|
export declare function getSeriesPositionColor(position: number): string | null;
|
|
95
98
|
export declare function getSeriesHoverPositionColor(position: number): string | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DashboardDataBinding } from "../../../../types/DashboardDataBinding";
|
|
3
|
+
import { DataPointSelection } from "../../../../types/SeriesMeasure";
|
|
4
|
+
import { ReactWidgetPM } from "../../../../types/widget";
|
|
5
|
+
export declare type FusionChartProps = {
|
|
6
|
+
widget: ReactWidgetPM | undefined;
|
|
7
|
+
widgetRef: ReactWidgetPM | undefined;
|
|
8
|
+
dataBinding: DashboardDataBinding;
|
|
9
|
+
onSelectDataPoint: (dataPointSelection: DataPointSelection) => void;
|
|
10
|
+
};
|
|
11
|
+
declare const FusionChart: React.ForwardRefExoticComponent<FusionChartProps & React.RefAttributes<unknown>>;
|
|
12
|
+
export default FusionChart;
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var Charts = _interopDefault(require('fusioncharts/fusioncharts.charts'));
|
|
|
15
15
|
var FusionTheme = _interopDefault(require('fusioncharts/themes/fusioncharts.theme.fusion'));
|
|
16
16
|
var useResizeObserver = _interopDefault(require('use-resize-observer'));
|
|
17
17
|
var Popup = _interopDefault(require('reactjs-popup'));
|
|
18
|
+
var Charts$1 = _interopDefault(require('fusioncharts/fusioncharts.widgets'));
|
|
18
19
|
|
|
19
20
|
function _extends() {
|
|
20
21
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -219,6 +220,14 @@ var DashboardAnalyticsService = /*#__PURE__*/function () {
|
|
|
219
220
|
return this._ApiServices.post("/api/" + this.controller + "/PostGetTableData", widget);
|
|
220
221
|
};
|
|
221
222
|
|
|
223
|
+
_proto.getGaugeData = function getGaugeData(widget, signal) {
|
|
224
|
+
if (signal === void 0) {
|
|
225
|
+
signal = undefined;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return this._ApiServices.post("/api/" + this.controller + "/PostGetGaugeData", widget, signal);
|
|
229
|
+
};
|
|
230
|
+
|
|
222
231
|
return DashboardAnalyticsService;
|
|
223
232
|
}();
|
|
224
233
|
|
|
@@ -1389,6 +1398,42 @@ function BuildFusionChartObject(seriesMeasures, widget) {
|
|
|
1389
1398
|
}
|
|
1390
1399
|
}
|
|
1391
1400
|
|
|
1401
|
+
var getWidgetRanges = function getWidgetRanges(widget, value) {
|
|
1402
|
+
var gaugeRanges = widget.GaugeRanges && widget.GaugeRanges.length > 0 ? JSON.parse(widget.GaugeRanges) : null;
|
|
1403
|
+
if (gaugeRanges == null || isNullOrUndefinedOrEmpty(value)) return [];
|
|
1404
|
+
|
|
1405
|
+
if (value < gaugeRanges[0].minValue) {
|
|
1406
|
+
gaugeRanges[0].minValue = value;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
if (value > gaugeRanges[2].maxValue) {
|
|
1410
|
+
gaugeRanges[2].maxValue = value;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
return gaugeRanges;
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1416
|
+
var getGaugeObject = function getGaugeObject(data, widget) {
|
|
1417
|
+
var fusionObject = getDefaultChartobject();
|
|
1418
|
+
fusionObject.type = 'angulargauge';
|
|
1419
|
+
var chartInfo = getDefaultChartInfo(widget);
|
|
1420
|
+
chartInfo.manageResize = "1";
|
|
1421
|
+
chartInfo.valueBelowPivot = "1";
|
|
1422
|
+
chartInfo.showValue = "1";
|
|
1423
|
+
fusionObject.dataSource = {
|
|
1424
|
+
"chart": chartInfo,
|
|
1425
|
+
"colorRange": {
|
|
1426
|
+
"color": getWidgetRanges(widget, data === null || data === void 0 ? void 0 : data.Value)
|
|
1427
|
+
},
|
|
1428
|
+
"dials": {
|
|
1429
|
+
"dial": [{
|
|
1430
|
+
"value": data.Value
|
|
1431
|
+
}]
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
return fusionObject;
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1392
1437
|
function getBarObject(seriesMeasures, widget) {
|
|
1393
1438
|
var chart = getDefaultChartobject();
|
|
1394
1439
|
chart.type = isGroupByFieldDateTime(widget.GroupByFieldDataType) ? "msbar2d" : "scrollbar2d";
|
|
@@ -2197,8 +2242,177 @@ function SvgCopyIcon(props) {
|
|
|
2197
2242
|
})));
|
|
2198
2243
|
}
|
|
2199
2244
|
|
|
2245
|
+
ReactFC.fcRoot(FusionCharts, Charts$1, FusionTheme);
|
|
2246
|
+
FusionCharts.options['license']({
|
|
2247
|
+
key: 'prD4C-8eiA7A3A3C7E6G4B4A3J4C7B2D3D2nyqE1C3fd1npaE4D4tlA-21D7E4F4F1F1E1F4F1A10A8C2C5F5E2F2D1hwqD1B5D1aG4A19A32twbC6D3G4lhJ-7A9C11A5B-13ddA2I3A1B9B3D7A2B4G2H3H1F-7smC8B2XB4cetB8A7A5mxD3SG4F2tvgB2A3B2E4C3I3C7B3A4A3A2D3D2G4J-7==',
|
|
2248
|
+
creditLabel: false
|
|
2249
|
+
});
|
|
2250
|
+
var FusionChart$1 = React.forwardRef(function (props, comRef) {
|
|
2251
|
+
var _useState = React.useState(false),
|
|
2252
|
+
dataLoaded = _useState[0],
|
|
2253
|
+
setDataLoaded = _useState[1];
|
|
2254
|
+
|
|
2255
|
+
var _useState2 = React.useState(),
|
|
2256
|
+
error = _useState2[0],
|
|
2257
|
+
setError = _useState2[1];
|
|
2258
|
+
|
|
2259
|
+
var _useState3 = React.useState(uuid.v4()),
|
|
2260
|
+
fusionKey = _useState3[0],
|
|
2261
|
+
setFusionKey = _useState3[1];
|
|
2262
|
+
|
|
2263
|
+
var chartData = React.useRef(null);
|
|
2264
|
+
|
|
2265
|
+
var _useState4 = React.useState(null),
|
|
2266
|
+
resizeTimer = _useState4[0],
|
|
2267
|
+
setResizeTimer = _useState4[1];
|
|
2268
|
+
|
|
2269
|
+
var axiosController = React.useRef(new AbortController());
|
|
2270
|
+
var widget = React.useRef();
|
|
2271
|
+
|
|
2272
|
+
var _useState5 = React.useState({}),
|
|
2273
|
+
args = _useState5[0],
|
|
2274
|
+
setArgs = _useState5[1];
|
|
2275
|
+
|
|
2276
|
+
var _useState6 = React.useState(uuid.v4()),
|
|
2277
|
+
chartContainerId = _useState6[0];
|
|
2278
|
+
|
|
2279
|
+
var progressRef = React.useRef(null);
|
|
2280
|
+
var fusionRef = React.useRef(null);
|
|
2281
|
+
var isDummyChangesActive = React.useRef(false);
|
|
2282
|
+
React.useEffect(function () {
|
|
2283
|
+
var _props$dataBinding;
|
|
2284
|
+
|
|
2285
|
+
axiosController.current = new AbortController();
|
|
2286
|
+
widget.current = props.widget;
|
|
2287
|
+
getChartData();
|
|
2288
|
+
(_props$dataBinding = props.dataBinding) === null || _props$dataBinding === void 0 ? void 0 : _props$dataBinding.widgetUpdated.subscribe(function (updatedWidget) {
|
|
2289
|
+
var _widget$current;
|
|
2290
|
+
|
|
2291
|
+
if ((updatedWidget === null || updatedWidget === void 0 ? void 0 : updatedWidget.key) != ((_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.key)) return;
|
|
2292
|
+
widget.current = _extends({}, updatedWidget);
|
|
2293
|
+
|
|
2294
|
+
if (chartData && chartData.current) {
|
|
2295
|
+
var _data = JSON.parse(JSON.stringify(chartData.current));
|
|
2296
|
+
|
|
2297
|
+
isDummyChangesActive.current = true;
|
|
2298
|
+
handleData(_data, true);
|
|
2299
|
+
}
|
|
2300
|
+
});
|
|
2301
|
+
window.addEventListener("resize", handleResize);
|
|
2302
|
+
return function () {
|
|
2303
|
+
var _axiosController$curr;
|
|
2304
|
+
|
|
2305
|
+
window.removeEventListener("resize", handleResize);
|
|
2306
|
+
setDataLoaded(false);
|
|
2307
|
+
|
|
2308
|
+
if (axiosController && axiosController !== null && axiosController !== void 0 && (_axiosController$curr = axiosController.current) !== null && _axiosController$curr !== void 0 && _axiosController$curr.abort) {
|
|
2309
|
+
var _axiosController$curr2;
|
|
2310
|
+
|
|
2311
|
+
axiosController === null || axiosController === void 0 ? void 0 : (_axiosController$curr2 = axiosController.current) === null || _axiosController$curr2 === void 0 ? void 0 : _axiosController$curr2.abort();
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
}, []);
|
|
2315
|
+
|
|
2316
|
+
var handleResize = function handleResize() {
|
|
2317
|
+
clearTimeout(resizeTimer);
|
|
2318
|
+
setResizeTimer(setTimeout(function () {
|
|
2319
|
+
setFusionKey(uuid.v4());
|
|
2320
|
+
}, 200));
|
|
2321
|
+
};
|
|
2322
|
+
|
|
2323
|
+
React.useImperativeHandle(comRef, function () {
|
|
2324
|
+
return {
|
|
2325
|
+
onResizeFinish: function onResizeFinish() {
|
|
2326
|
+
setFusionKey(uuid.v4());
|
|
2327
|
+
}
|
|
2328
|
+
};
|
|
2329
|
+
});
|
|
2330
|
+
|
|
2331
|
+
var getChartData = function getChartData() {
|
|
2332
|
+
if (Session.Tenant == 0) {
|
|
2333
|
+
handleData(null);
|
|
2334
|
+
return;
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
var dashboardAnalyticsService = new DashboardAnalyticsService();
|
|
2338
|
+
|
|
2339
|
+
var postWidget = _extends({}, widget.current);
|
|
2340
|
+
|
|
2341
|
+
postWidget.onChange = undefined;
|
|
2342
|
+
var signal = undefined;
|
|
2343
|
+
|
|
2344
|
+
if (axiosController) {
|
|
2345
|
+
var _axiosController$curr3;
|
|
2346
|
+
|
|
2347
|
+
axiosController === null || axiosController === void 0 ? void 0 : (_axiosController$curr3 = axiosController.current) === null || _axiosController$curr3 === void 0 ? void 0 : _axiosController$curr3.abort();
|
|
2348
|
+
var updatedAxiosController = new AbortController();
|
|
2349
|
+
axiosController.current = updatedAxiosController;
|
|
2350
|
+
signal = updatedAxiosController === null || updatedAxiosController === void 0 ? void 0 : updatedAxiosController.signal;
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
dashboardAnalyticsService.getGaugeData(postWidget, signal).then(function (result) {
|
|
2354
|
+
handleData(result === null || result === void 0 ? void 0 : result.data);
|
|
2355
|
+
chartData.current = result === null || result === void 0 ? void 0 : result.data;
|
|
2356
|
+
setDataLoaded(true);
|
|
2357
|
+
}, function (error) {
|
|
2358
|
+
var _error$response, _error$response$data, _error$response2, _error$response2$data;
|
|
2359
|
+
|
|
2360
|
+
console.log('error', error);
|
|
2361
|
+
if (error !== null && error !== void 0 && (_error$response = error.response) !== null && _error$response !== void 0 && (_error$response$data = _error$response.data) !== null && _error$response$data !== void 0 && _error$response$data.ErrorMessage) setError(error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : _error$response2$data.ErrorMessage);else setError(error.message);
|
|
2362
|
+
setDataLoaded(true);
|
|
2363
|
+
});
|
|
2364
|
+
};
|
|
2365
|
+
|
|
2366
|
+
var handleData = function handleData(data, isDummyChange) {
|
|
2367
|
+
if (isDummyChange === void 0) {
|
|
2368
|
+
isDummyChange = false;
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
var chart = getGaugeObject(data, widget.current);
|
|
2372
|
+
setArgs(chart);
|
|
2373
|
+
|
|
2374
|
+
if (!isDummyChange) {
|
|
2375
|
+
setDataLoaded(true);
|
|
2376
|
+
} else {
|
|
2377
|
+
setTimeout(function () {
|
|
2378
|
+
isDummyChangesActive.current = false;
|
|
2379
|
+
}, 100);
|
|
2380
|
+
}
|
|
2381
|
+
};
|
|
2382
|
+
|
|
2383
|
+
return !dataLoaded ? React__default.createElement("div", {
|
|
2384
|
+
ref: progressRef,
|
|
2385
|
+
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
2386
|
+
}, React__default.createElement(progressspinner.ProgressSpinner, {
|
|
2387
|
+
style: {
|
|
2388
|
+
width: '40px',
|
|
2389
|
+
height: '40px'
|
|
2390
|
+
},
|
|
2391
|
+
strokeWidth: "4",
|
|
2392
|
+
animationDuration: "2s"
|
|
2393
|
+
})) : !error ? React__default.createElement("div", {
|
|
2394
|
+
className: 'db-fc-parent-container',
|
|
2395
|
+
ref: fusionRef
|
|
2396
|
+
}, React__default.createElement("div", {
|
|
2397
|
+
className: 'db-fc-container',
|
|
2398
|
+
key: fusionKey,
|
|
2399
|
+
id: chartContainerId
|
|
2400
|
+
}, React__default.createElement(ReactFC, Object.assign({}, args)))) : React__default.createElement("div", {
|
|
2401
|
+
className: "dl-flex-content-center dl-full-hight",
|
|
2402
|
+
style: {
|
|
2403
|
+
width: '100%'
|
|
2404
|
+
}
|
|
2405
|
+
}, React__default.createElement("div", {
|
|
2406
|
+
className: "dl-tooltip"
|
|
2407
|
+
}, React__default.createElement(SvgRedWarning, {
|
|
2408
|
+
className: "red-warning-icon"
|
|
2409
|
+
}), React__default.createElement("span", {
|
|
2410
|
+
className: "dl-tooltiptext"
|
|
2411
|
+
}, error)));
|
|
2412
|
+
});
|
|
2413
|
+
|
|
2200
2414
|
var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
2201
|
-
var _widget$
|
|
2415
|
+
var _widget$current12, _widget$current13, _widget$current14;
|
|
2202
2416
|
|
|
2203
2417
|
var widget = React.useRef();
|
|
2204
2418
|
|
|
@@ -2267,7 +2481,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
2267
2481
|
};
|
|
2268
2482
|
|
|
2269
2483
|
var GetChartComponent = function GetChartComponent() {
|
|
2270
|
-
var _widget$current4, _widget$current5, _widget$current6;
|
|
2484
|
+
var _widget$current4, _widget$current5, _widget$current6, _widget$current7;
|
|
2271
2485
|
|
|
2272
2486
|
if (isLoading || !((_widget$current4 = widget.current) !== null && _widget$current4 !== void 0 && _widget$current4.TypeCode)) return "";
|
|
2273
2487
|
if (((_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.TypeCode) == "kpi" || ((_widget$current6 = widget.current) === null || _widget$current6 === void 0 ? void 0 : _widget$current6.TypeCode) == "table") return React__default.createElement(CustomChart, {
|
|
@@ -2278,6 +2492,13 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
2278
2492
|
widgetRef: props.widgetRef,
|
|
2279
2493
|
onSelectDataPoint: props.onSelectDataPoint
|
|
2280
2494
|
});
|
|
2495
|
+
if (((_widget$current7 = widget.current) === null || _widget$current7 === void 0 ? void 0 : _widget$current7.TypeCode) == "gauge") return React__default.createElement(FusionChart$1, {
|
|
2496
|
+
ref: fusionChartRef,
|
|
2497
|
+
dataBinding: props.dataBinding,
|
|
2498
|
+
widget: widget.current,
|
|
2499
|
+
widgetRef: props.widgetRef,
|
|
2500
|
+
onSelectDataPoint: props.onSelectDataPoint
|
|
2501
|
+
});
|
|
2281
2502
|
return React__default.createElement(FusionChart, {
|
|
2282
2503
|
ref: fusionChartRef,
|
|
2283
2504
|
dataBinding: props.dataBinding,
|
|
@@ -2307,15 +2528,15 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
2307
2528
|
};
|
|
2308
2529
|
|
|
2309
2530
|
var isThereTitle = function isThereTitle() {
|
|
2310
|
-
var _widget$
|
|
2531
|
+
var _widget$current8, _widget$current9;
|
|
2311
2532
|
|
|
2312
|
-
return ((_widget$
|
|
2533
|
+
return ((_widget$current8 = widget.current) === null || _widget$current8 === void 0 ? void 0 : _widget$current8.Title) && ((_widget$current9 = widget.current) === null || _widget$current9 === void 0 ? void 0 : _widget$current9.Title.length) > 0;
|
|
2313
2534
|
};
|
|
2314
2535
|
|
|
2315
2536
|
var isThereSubtitle = function isThereSubtitle() {
|
|
2316
|
-
var _widget$
|
|
2537
|
+
var _widget$current10, _widget$current11;
|
|
2317
2538
|
|
|
2318
|
-
return ((_widget$
|
|
2539
|
+
return ((_widget$current10 = widget.current) === null || _widget$current10 === void 0 ? void 0 : _widget$current10.Subtitle) && ((_widget$current11 = widget.current) === null || _widget$current11 === void 0 ? void 0 : _widget$current11.Subtitle.length) > 0;
|
|
2319
2540
|
};
|
|
2320
2541
|
|
|
2321
2542
|
var tableHintMessage = function tableHintMessage() {
|
|
@@ -2360,7 +2581,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
2360
2581
|
color: getCSSPropertyValue(widget.current, 'TitleFontColor', ''),
|
|
2361
2582
|
textAlign: getCSSPropertyValue(widget === null || widget === void 0 ? void 0 : widget.current, 'TitleAlignment', '', undefined)
|
|
2362
2583
|
}
|
|
2363
|
-
}, (_widget$
|
|
2584
|
+
}, (_widget$current12 = widget.current) === null || _widget$current12 === void 0 ? void 0 : _widget$current12.Title),
|
|
2364
2585
|
position: ['top center'],
|
|
2365
2586
|
arrowStyle: {
|
|
2366
2587
|
color: '#262626'
|
|
@@ -2369,7 +2590,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
2369
2590
|
on: ['hover', 'focus']
|
|
2370
2591
|
}, React__default.createElement("span", {
|
|
2371
2592
|
className: "widget-title-tooltip-text"
|
|
2372
|
-
}, (_widget$
|
|
2593
|
+
}, (_widget$current13 = widget.current) === null || _widget$current13 === void 0 ? void 0 : _widget$current13.Title))), isTableWidget() && isThereTitle() && isThereSubtitle() && React__default.createElement("div", {
|
|
2373
2594
|
className: "titles-vertical-seeparator"
|
|
2374
2595
|
}), React__default.createElement("div", {
|
|
2375
2596
|
className: isThereSubtitle() ? "subtitle" : "subtitle margin-top-4",
|
|
@@ -2379,7 +2600,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
2379
2600
|
color: getCSSPropertyValue(widget.current, 'SubtitleFontColor', ''),
|
|
2380
2601
|
minWidth: isThereSubtitle() && isTableWidget() ? '5%' : undefined
|
|
2381
2602
|
}
|
|
2382
|
-
}, (_widget$
|
|
2603
|
+
}, (_widget$current14 = widget.current) === null || _widget$current14 === void 0 ? void 0 : _widget$current14.Subtitle)), !isTitleAligmentRight() && isTableWidget() && tableHintMessage(), props.isInEditMode && React__default.createElement("div", {
|
|
2383
2604
|
className: isThereTitle() ? "widget-options-container" : "widget-options-container margin-top-6"
|
|
2384
2605
|
}, React__default.createElement(SvgEditIcon, {
|
|
2385
2606
|
onClick: function onClick() {
|