@dexteel/mesf-core 4.7.3 → 4.7.4

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/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
1
  # CHANGELOG
2
+ ## 4.7.4
3
+ - Trending: Change size of the date navigator arrows to improve the responsive behavior
4
+ - Trendings: Fix too many numbers on table bug. Show only the 3 digits after the comma
5
+ - Trending: Set new limits on the draggable line cursors. Now one cursor cannot exceed the position of the other cursor
6
+ - Trending: In add tag modal, when you select a tag, the popup doesn't close
7
+ - Trending: Fix cannot edit unit bug
2
8
  ## 4.7.3
3
9
  - Trendings: Fix date time navigation when the scope is 'custom'. Navigator takes difference between start date and end date
4
10
  ## 4.7.2
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { LicenseManager } from 'ag-grid-enterprise';
2
2
  import { Typography, TextField, makeStyles as makeStyles$1, Button as Button$1, Grid as Grid$1, Dialog as Dialog$1, DialogTitle as DialogTitle$2, DialogContent as DialogContent$2, DialogContentText, DialogActions as DialogActions$2, FormHelperText, CircularProgress as CircularProgress$1, Badge, FormControlLabel, Checkbox, Snackbar as Snackbar$1, Paper as Paper$1, MenuItem as MenuItem$1, useTheme as useTheme$1, Tooltip, createStyles as createStyles$1, FormControl as FormControl$1, Select as Select$1, Box, Divider, IconButton as IconButton$1, debounce, List, ListItem, ListItemText } from '@material-ui/core';
3
- import { values, get, isNil as isNil$1, isEmpty, isNaN } from 'lodash-es';
3
+ import { values, get, isNil as isNil$1, isEmpty, isNaN, round } from 'lodash-es';
4
4
  import * as React from 'react';
5
5
  import React__default, { useState, useRef, useEffect, Component, createContext, useContext, useMemo, useCallback, lazy, Suspense } from 'react';
6
6
  import { Alert as Alert$1, Modal as Modal$1, Navbar, Container, Nav, NavDropdown } from 'react-bootstrap';
@@ -10273,11 +10273,12 @@ var useTrendingStyles = makeStyles$1(function (theme) { return ({
10273
10273
  fontSize: "13px !important",
10274
10274
  height: "15px !important",
10275
10275
  paddingRight: "3px",
10276
- paddingLeft: "5px"
10276
+ paddingLeft: "3px"
10277
10277
  },
10278
10278
  "& .MuiInput-underline:before": {
10279
10279
  borderBottomColor: "rgba(0, 0, 0, 0.42)"
10280
- }
10280
+ },
10281
+ padding: 0
10281
10282
  },
10282
10283
  select: {
10283
10284
  "& .MuiInput-root": {
@@ -10295,7 +10296,8 @@ var useTrendingStyles = makeStyles$1(function (theme) { return ({
10295
10296
  },
10296
10297
  "& .MuiInput-underline:before": {
10297
10298
  borderBottomColor: "rgba(0, 0, 0, 0.42)"
10298
- }
10299
+ },
10300
+ padding: 0
10299
10301
  },
10300
10302
  labelOptions: {
10301
10303
  paddingLeft: "2rem",
@@ -10323,8 +10325,15 @@ var useTrendingStyles = makeStyles$1(function (theme) { return ({
10323
10325
  },
10324
10326
  navigatorButton: {
10325
10327
  "& .MuiSvgIcon-root": {
10326
- cursor: "pointer !important"
10327
- }
10328
+ cursor: "pointer !important",
10329
+ height: '24px',
10330
+ width: '24px',
10331
+ '& svg': {
10332
+ // Adjust the icon size as well
10333
+ fontSize: '1.5rem'
10334
+ }
10335
+ },
10336
+ color: 'black'
10328
10337
  }
10329
10338
  }); });
10330
10339
 
@@ -10619,6 +10628,10 @@ var TableComponent = function (_a) {
10619
10628
  var newTags = viewTags.map(function (tag) { return tag.TagId === tagId ? __assign(__assign({}, tag), { IsVisible: value }) : tag; });
10620
10629
  setViewTags(newTags);
10621
10630
  };
10631
+ var handleUnitChange = function (tagId, newUnit) {
10632
+ var newTags = viewTags.map(function (tag) { return (tag.TagId === tagId ? __assign(__assign({}, tag), { Unit: newUnit }) : tag); });
10633
+ setViewTags(newTags);
10634
+ };
10622
10635
  var handleAutoScaleChange = function (tagId, checked) {
10623
10636
  var newTags = viewTags.map(function (t) { return t.TagId == tagId ? __assign(__assign({}, t), { IsAutoScale: !checked }) : t; });
10624
10637
  setViewTags(newTags);
@@ -10669,7 +10682,6 @@ var TableComponent = function (_a) {
10669
10682
  ];
10670
10683
  var handleTagSelect = function (selectedTag) {
10671
10684
  handleAddTag(selectedTag);
10672
- handleClose();
10673
10685
  };
10674
10686
  var handleDelete = function (index) { return __awaiter(void 0, void 0, void 0, function () {
10675
10687
  var tagToDelete, resp;
@@ -10887,17 +10899,24 @@ var TableComponent = function (_a) {
10887
10899
  }
10888
10900
  } })),
10889
10901
  React__default.createElement("td", { className: "".concat(classes.autoScale, " ").concat(classes.checkbox) },
10890
- React__default.createElement("input", { type: "text", style: { width: '100%' }, disabled: true, value: tag.Unit, onFocus: function (e) { return e.target.select(); } })),
10902
+ React__default.createElement("input", { type: "text", style: __assign({ width: '100%' }, (tag.IsAutoScale ? {
10903
+ backgroundColor: 'rgba(239, 239, 239, 0.3)',
10904
+ color: 'rgba(84, 84, 84, 1)',
10905
+ border: '1px solid rgba(118, 118, 118, 0.3)'
10906
+ } : {})), onClick: function () { return handleAbleScales(tag.TagId, tag.IsAutoScale); }, onChange: function (e) {
10907
+ var value = e.target.value;
10908
+ handleUnitChange(tag.TagId, value);
10909
+ }, value: tag.Unit, onFocus: function (e) { return e.target.select(); } })),
10891
10910
  React__default.createElement("td", { className: "".concat(classes.autoScale, " ").concat(classes.checkbox) },
10892
10911
  React__default.createElement("input", { type: "checkbox", checked: tag.IsAutoScale, onChange: function (e) { return handleAutoScaleChange(tag.TagId, tag.IsAutoScale); } })),
10893
- React__default.createElement("td", null, (_a = dataTable[tag.TagName]) === null || _a === void 0 ? void 0 : _a.y1),
10894
- React__default.createElement("td", { className: classes.doubleInput }, (_b = dataTable[tag.TagName]) === null || _b === void 0 ? void 0 : _b.y2),
10895
- React__default.createElement("td", null, (_c = dataTable[tag.TagName]) === null || _c === void 0 ? void 0 : _c.y2y1),
10912
+ React__default.createElement("td", null, round((_a = dataTable[tag.TagName]) === null || _a === void 0 ? void 0 : _a.y1, 3)),
10913
+ React__default.createElement("td", { className: classes.doubleInput }, round((_b = dataTable[tag.TagName]) === null || _b === void 0 ? void 0 : _b.y2, 3)),
10914
+ React__default.createElement("td", null, round((_c = dataTable[tag.TagName]) === null || _c === void 0 ? void 0 : _c.y2y1, 3)),
10896
10915
  React__default.createElement("td", null,
10897
- !isNaN(((_d = dataTable[tag.TagName]) === null || _d === void 0 ? void 0 : _d.pmin.y) * 0) ? (_e = dataTable[tag.TagName]) === null || _e === void 0 ? void 0 : _e.pmin.y : 0,
10916
+ !isNaN(((_d = dataTable[tag.TagName]) === null || _d === void 0 ? void 0 : _d.pmin.y) * 0) ? round((_e = dataTable[tag.TagName]) === null || _e === void 0 ? void 0 : _e.pmin.y, 3) : 0,
10898
10917
  " "),
10899
10918
  React__default.createElement("td", null,
10900
- !isNaN(((_f = dataTable[tag.TagName]) === null || _f === void 0 ? void 0 : _f.pmax.y) * 0) ? (_g = dataTable[tag.TagName]) === null || _g === void 0 ? void 0 : _g.pmax.y : 0,
10919
+ !isNaN(((_f = dataTable[tag.TagName]) === null || _f === void 0 ? void 0 : _f.pmax.y) * 0) ? round((_g = dataTable[tag.TagName]) === null || _g === void 0 ? void 0 : _g.pmax.y) : 0,
10901
10920
  " ")));
10902
10921
  }) : React__default.createElement("div", { style: { padding: '2rem' } },
10903
10922
  React__default.createElement("div", { style: { padding: "1rem" } }, "No tag view detected. "),
@@ -11105,13 +11124,20 @@ var Header = function (_a) {
11105
11124
  };
11106
11125
  useEffect(function () {
11107
11126
  var changeOptions = function () {
11108
- // console.log("change options");
11109
- setChartOptions(function (prevOptions) { return (__assign(__assign({}, prevOptions), { elements: {
11110
- line: {
11111
- stepped: customOptions.stepped,
11112
- lineTension: 0.1
11127
+ setChartOptions(function (prevOptions) {
11128
+ var newScales = __assign({}, prevOptions.scales);
11129
+ Object.keys(newScales).forEach(function (key) {
11130
+ if (key) {
11131
+ newScales[key] = __assign(__assign({}, newScales[key]), { grid: __assign(__assign({}, newScales[key].grid), { display: customOptions.showGrid }) });
11113
11132
  }
11114
- }, scales: __assign(__assign({}, prevOptions.scales), { x: __assign(__assign({}, prevOptions.scales.x), { grid: __assign(__assign({}, prevOptions.scales.x.grid), { display: customOptions.showGrid }) }), y: __assign(__assign({}, prevOptions.scales.y), { grid: __assign(__assign({}, prevOptions.scales.y.grid), { display: customOptions.showGrid }) }) }) })); });
11133
+ });
11134
+ return __assign(__assign({}, prevOptions), { elements: {
11135
+ line: {
11136
+ stepped: customOptions.stepped,
11137
+ lineTension: 0.1
11138
+ }
11139
+ }, scales: newScales });
11140
+ });
11115
11141
  };
11116
11142
  changeOptions();
11117
11143
  }, [customOptions]);
@@ -11119,9 +11145,10 @@ var Header = function (_a) {
11119
11145
  setChartOptions(function (prevOptions) { return (__assign(__assign({}, prevOptions), { scales: __assign(__assign({}, prevOptions.scales), { x: __assign(__assign({}, prevOptions.scales.x), { min: state.timeScopeStart.getTime(), max: state.timeScopeEnd.getTime() }) }) })); });
11120
11146
  }, [state.timeScopeStart, state.timeScopeEnd]);
11121
11147
  return (React__default.createElement(Grid$1, { item: true, xs: 12, container: true, justifyContent: "space-between", alignItems: "center", style: { height: "15%" } },
11122
- React__default.createElement(Grid$1, { md: 5, item: true, container: true, justifyContent: "flex-start", alignItems: "center", spacing: 1, wrap: "wrap" },
11123
- React__default.createElement(IconButton$1, { color: "primary", onClick: function () { return handleDateNavigator("subtract"); }, className: classes.navigatorButton },
11124
- React__default.createElement(ChevronLeft, { fontSize: "large" })),
11148
+ React__default.createElement(Grid$1, { md: 6, item: true, container: true, justifyContent: "flex-start", alignItems: "center", wrap: "wrap" },
11149
+ React__default.createElement(Grid$1, { item: true },
11150
+ React__default.createElement(IconButton$1, { color: "primary", onClick: function () { return handleDateNavigator("subtract"); }, className: classes.navigatorButton },
11151
+ React__default.createElement(ChevronLeft, { fontSize: "large" }))),
11125
11152
  React__default.createElement(Grid$1, { item: true },
11126
11153
  React__default.createElement(TextField, { type: "datetime-local", className: classes.datetimePicker, label: "Start", variant: "outlined", value: moment(state.timeScopeStart).format("YYYY-MM-DDTHH:mm:ss"), onChange: function (e) { return handleDateChange(e.target.value, "start"); }, InputLabelProps: {
11127
11154
  shrink: true,
@@ -11144,16 +11171,17 @@ var Header = function (_a) {
11144
11171
  shrink: true,
11145
11172
  style: { marginLeft: "10px" }
11146
11173
  } })),
11147
- React__default.createElement(IconButton$1, { color: "primary", onClick: function () { return handleDateNavigator("add"); }, className: classes.navigatorButton },
11148
- React__default.createElement(ChevronRight, { fontSize: "large" }))),
11149
- React__default.createElement(Grid$1, { md: 7, item: true, container: true, justifyContent: "space-between" },
11174
+ React__default.createElement(Grid$1, { item: true },
11175
+ React__default.createElement(IconButton$1, { onClick: function () { return handleDateNavigator("add"); }, className: "".concat(classes.navigatorButton) },
11176
+ React__default.createElement(ChevronRight, { fontSize: "large" })))),
11177
+ React__default.createElement(Grid$1, { md: 6, item: true, container: true, justifyContent: "space-between" },
11150
11178
  React__default.createElement(Grid$1, { item: true, container: true, wrap: "nowrap", spacing: 1 },
11151
11179
  React__default.createElement(Grid$1, { item: true, container: true },
11152
11180
  React__default.createElement(CustomOptionsComponent, { customOptions: customOptions, setCustomOptions: setCustomOptions }))))));
11153
11181
  };
11154
11182
 
11155
11183
  var DraggableLineControl = function (_a) {
11156
- var initialLeft = _a.initialLeft, onUpdate = _a.onUpdate, color = _a.color, chartArea = _a.chartArea;
11184
+ var initialLeft = _a.initialLeft, otherLineCoord = _a.otherLineCoord, onUpdate = _a.onUpdate, color = _a.color, chartArea = _a.chartArea;
11157
11185
  var _b = useState(false), isDragging = _b[0], setIsDragging = _b[1];
11158
11186
  var _c = useState(initialLeft), left = _c[0], setLeft = _c[1];
11159
11187
  var ref = useRef(null);
@@ -11168,6 +11196,13 @@ var DraggableLineControl = function (_a) {
11168
11196
  chartArea.width - chartArea.right;
11169
11197
  chartArea.left;
11170
11198
  var newLeft = Math.min(Math.max(e.clientX - ref.current.offsetParent.getBoundingClientRect().left, chartArea.left), chartArea.right);
11199
+ // Line limit
11200
+ if (color === 'red' && newLeft > (otherLineCoord - 20)) {
11201
+ newLeft = otherLineCoord - 20;
11202
+ }
11203
+ else if (color === 'blue' && newLeft < (otherLineCoord + 20)) {
11204
+ newLeft = otherLineCoord + 20;
11205
+ }
11171
11206
  setLeft(newLeft);
11172
11207
  onUpdate(newLeft); // Actualiza la posición de la línea en el gráfico
11173
11208
  };
@@ -11420,7 +11455,7 @@ var TrendingChart = function (_a) {
11420
11455
  }
11421
11456
  }, [chartShouldInitCursors, state.graphShouldUpdate]);
11422
11457
  return (React__default.createElement(Paper$1, { style: { height: '100%', position: 'relative' } },
11423
- lineTabCoords && chartArea ? (React__default.createElement(DraggableLineControl, { color: 'red', chartArea: chartArea, initialLeft: lineTabCoords === null || lineTabCoords === void 0 ? void 0 : lineTabCoords.x1, onUpdate: function (newLeft) {
11458
+ lineTabCoords && chartArea ? (React__default.createElement(DraggableLineControl, { color: 'red', chartArea: chartArea, initialLeft: lineTabCoords === null || lineTabCoords === void 0 ? void 0 : lineTabCoords.x1, otherLineCoord: lineTabCoords === null || lineTabCoords === void 0 ? void 0 : lineTabCoords.x2, onUpdate: function (newLeft) {
11424
11459
  setLineTabCoords(function (prevCoords) {
11425
11460
  prevCoords.x1 = newLeft;
11426
11461
  return prevCoords;
@@ -11429,7 +11464,7 @@ var TrendingChart = function (_a) {
11429
11464
  chartRef.current.mouseX = newLeft;
11430
11465
  debouncedUpdateChart();
11431
11466
  } })) : null,
11432
- lineTabCoords && chartArea ? (React__default.createElement(DraggableLineControl, { color: 'blue', initialLeft: lineTabCoords === null || lineTabCoords === void 0 ? void 0 : lineTabCoords.x2, chartArea: chartArea, onUpdate: function (newLeft) {
11467
+ lineTabCoords && chartArea ? (React__default.createElement(DraggableLineControl, { color: 'blue', initialLeft: lineTabCoords === null || lineTabCoords === void 0 ? void 0 : lineTabCoords.x2, otherLineCoord: lineTabCoords === null || lineTabCoords === void 0 ? void 0 : lineTabCoords.x1, chartArea: chartArea, onUpdate: function (newLeft) {
11433
11468
  setLineTabCoords(function (prevCoords) {
11434
11469
  prevCoords.x2 = newLeft;
11435
11470
  return prevCoords;