@dexteel/mesf-core 4.8.1 → 4.8.3

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,8 @@
1
1
  # CHANGELOG
2
+ ## 4.8.3
3
+ - Trending: Add new icon to ViewTags table and Add tag modal to know if it is Digital or Real (#205 and #206)
4
+ ## 4.8.2
5
+ - Trending: Show only the significant digits in the date field of the table (#190)
2
6
  ## 4.8.0-1
3
7
  - Trending: Fix when removing view tag bug (#184)
4
8
  - Trending: Add new button to navigate to current date (#189 and #207)
package/dist/index.esm.js CHANGED
@@ -9975,8 +9975,94 @@ var ColorPicker = function (_a) {
9975
9975
  } })); })))));
9976
9976
  };
9977
9977
 
9978
+ var useTagsTableStyles = makeStyles$1(function (theme) { return ({
9979
+ checkbox: {
9980
+ '& input[type="checkbox"]': {
9981
+ zoom: 1.5
9982
+ },
9983
+ textAlign: 'center'
9984
+ },
9985
+ rowHover: {
9986
+ '&:hover': {
9987
+ backgroundColor: "#f2f2f2"
9988
+ }
9989
+ },
9990
+ topTitles: {
9991
+ border: "0.0625rem black solid",
9992
+ borderBottom: "none",
9993
+ backgroundColor: "#e9ecef"
9994
+ },
9995
+ bottomTitlesRow: {
9996
+ '& th': {
9997
+ border: "1px black solid"
9998
+ },
9999
+ backgroundColor: "#e9ecef"
10000
+ },
10001
+ doubleInput: {
10002
+ padding: "0",
10003
+ '& input[type="text"] ': {
10004
+ width: "100%",
10005
+ height: "17px",
10006
+ display: "block",
10007
+ margin: "0",
10008
+ padding: "0"
10009
+ }
10010
+ },
10011
+ inputCol: {
10012
+ width: "11.25rem",
10013
+ overflow: 'hidden',
10014
+ textOverflow: 'ellipsis',
10015
+ whiteSpace: 'nowrap'
10016
+ },
10017
+ aliasCol: {
10018
+ width: "18rem",
10019
+ overflow: 'hidden',
10020
+ textOverflow: 'ellipsis',
10021
+ whiteSpace: 'nowrap'
10022
+ },
10023
+ autoScale: {
10024
+ width: '7.5rem'
10025
+ },
10026
+ scale: {
10027
+ width: '37.5rem',
10028
+ padding: "0"
10029
+ },
10030
+ visible: {
10031
+ width: '3.75rem'
10032
+ },
10033
+ color: {
10034
+ width: '4.375rem'
10035
+ },
10036
+ unit: {
10037
+ width: '7.5rem'
10038
+ },
10039
+ numberInput: {
10040
+ '&::-webkit-inner-spin-button, &::-webkit-outer-spin-button': {
10041
+ '-webkit-appearance': 'none',
10042
+ margin: 0
10043
+ },
10044
+ '&': {
10045
+ '-moz-appearance': 'textfield'
10046
+ }
10047
+ },
10048
+ xStats: {
10049
+ // ...
10050
+ },
10051
+ dataType: {
10052
+ width: '30px',
10053
+ height: '30px',
10054
+ color: "white",
10055
+ display: 'flex',
10056
+ justifyContent: 'center',
10057
+ alignItems: 'center',
10058
+ cursor: 'pointer',
10059
+ border: "1px black solid"
10060
+ }
10061
+ }); });
10062
+
9978
10063
  var TagSelectionModal = function (_a) {
9979
10064
  var isOpen = _a.isOpen; _a.onClose; var onTagSelect = _a.onTagSelect;
10065
+ var classes = useTagsTableStyles();
9980
10066
  var _b = useState(true), isLoading = _b[0], setIsLoading = _b[1];
9981
10067
  var _c = useState(''), error = _c[0], setError = _c[1];
9982
10068
  var _d = useState([]), treeData = _d[0], setTreeData = _d[1];
@@ -10058,7 +10144,8 @@ var TagSelectionModal = function (_a) {
10058
10144
  IsAutoScale: true,
10059
10145
  MinScale: dbTag.minScale,
10060
10146
  MaxScale: dbTag.maxScale,
10061
- IsVisible: true
10147
+ IsVisible: true,
10148
+ TagType: dbTag.tagType
10062
10149
  }
10063
10150
  }];
10064
10151
  }
@@ -10115,7 +10202,14 @@ var TagSelectionModal = function (_a) {
10115
10202
  }
10116
10203
  return null;
10117
10204
  };
10118
- var renderTree = function (node) { return (React__default.createElement(TreeItem$1, { key: node.TagName, nodeId: node.TagName, label: node.shortName, endIcon: React__default.createElement(ArrowDropDownIcon, null), icon: node.children && node.children.length > 0 ? (React__default.createElement(FolderIcon, null)) : (React__default.createElement(InsertDriveFileIcon, null)) }, node.children && node.children.map(function (child) { return renderTree(child); }))); };
10205
+ var renderTree = function (node) {
10206
+ var _a;
10207
+ return (React__default.createElement(TreeItem$1, { key: node.TagName, nodeId: node.TagName, label: React__default.createElement("div", { style: { display: 'flex', alignItems: 'center' } },
10208
+ ((_a = node.tag) === null || _a === void 0 ? void 0 : _a.TagType) && (React__default.createElement("div", { className: classes.dataType, style: {
10209
+ backgroundColor: node.tag.TagType === 'A' ? 'blue' : 'red'
10210
+ } }, node.tag.TagType)),
10211
+ React__default.createElement("div", { style: { paddingLeft: "5px" } }, node.shortName)), endIcon: React__default.createElement(ArrowDropDownIcon, null), icon: node.children && node.children.length > 0 ? (React__default.createElement(FolderIcon, null)) : (React__default.createElement(InsertDriveFileIcon, null)) }, node.children && node.children.map(function (child) { return renderTree(child); })));
10212
+ };
10119
10213
  return (React__default.createElement(React__default.Fragment, null,
10120
10214
  React__default.createElement("div", { style: {
10121
10215
  display: isOpen ? "block" : "none",
@@ -10722,98 +10816,55 @@ var useTagsDataTable = function (_a) {
10722
10816
  }, [viewTags, chartData, cursorData]);
10723
10817
  };
10724
10818
 
10725
- var useTagsTableStyles = makeStyles$1(function (theme) { return ({
10726
- checkbox: {
10727
- '& input[type="checkbox"]': {
10728
- zoom: 1.5
10729
- },
10730
- textAlign: 'center'
10731
- },
10732
- rowHover: {
10733
- '&:hover': {
10734
- backgroundColor: "#f2f2f2"
10735
- }
10736
- },
10737
- topTitles: {
10738
- border: "0.0625rem black solid",
10739
- borderBottom: "none",
10740
- backgroundColor: "#e9ecef"
10741
- },
10742
- bottomTitlesRow: {
10743
- '& th': {
10744
- border: "1px black solid"
10745
- },
10746
- backgroundColor: "#e9ecef"
10747
- },
10748
- doubleInput: {
10749
- padding: "0",
10750
- '& input[type="text"] ': {
10751
- width: "100%",
10752
- height: "17px",
10753
- display: "block",
10754
- margin: "0",
10755
- padding: "0"
10756
- }
10757
- },
10758
- inputCol: {
10759
- width: "11.25rem",
10760
- overflow: 'hidden',
10761
- textOverflow: 'ellipsis',
10762
- whiteSpace: 'nowrap'
10763
- },
10764
- aliasCol: {
10765
- width: "15rem",
10766
- overflow: 'hidden',
10767
- textOverflow: 'ellipsis',
10768
- whiteSpace: 'nowrap'
10769
- },
10770
- autoScale: {
10771
- width: '7.5rem'
10772
- },
10773
- scale: {
10774
- width: '37.5rem',
10775
- padding: "0"
10776
- },
10777
- visible: {
10778
- width: '3.75rem'
10779
- },
10780
- color: {
10781
- width: '4.375rem'
10782
- },
10783
- unit: {
10784
- width: '7.5rem'
10785
- },
10786
- numberInput: {
10787
- '&::-webkit-inner-spin-button, &::-webkit-outer-spin-button': {
10788
- '-webkit-appearance': 'none',
10789
- margin: 0
10790
- },
10791
- '&': {
10792
- '-moz-appearance': 'textfield'
10793
- }
10794
- },
10795
- xStats: {
10796
- // ...
10819
+ var formatTimeDiffWithMs = function (start, end) {
10820
+ // Calculate total difference in milliseconds
10821
+ var totalMilliseconds = end - start;
10822
+ // Convert milliseconds to seconds, minutes, hours, days, and months for comparison
10823
+ var seconds = totalMilliseconds / 1000;
10824
+ var minutes = seconds / 60;
10825
+ var hours = minutes / 60;
10826
+ var days = hours / 24;
10827
+ var months = days / 30; // Approximation of a month
10828
+ var remainingSeconds = seconds % 60; // Remaining seconds after full minutes
10829
+ if (months > 12) {
10830
+ var years = months / 12;
10831
+ return "".concat(Math.floor(years), " years, ").concat(Math.floor(months % 12), " months");
10832
+ }
10833
+ else if (months > 6) {
10834
+ return "".concat(Math.floor(months), " months, ").concat(Math.floor(days % 30), " days");
10835
+ }
10836
+ else if (days > 10) {
10837
+ return "".concat(Math.floor(days), " days, ").concat(Math.floor(hours % 24), " hours");
10838
+ }
10839
+ else if (days > 1) {
10840
+ return "".concat(Math.floor(days), " days, ").concat(Math.floor(hours % 24), " hours");
10841
+ }
10842
+ else if (hours > 12) {
10843
+ return "".concat(Math.floor(hours), " hours, ").concat(Math.floor(minutes % 60), " minutes, ").concat(remainingSeconds.toFixed(2), " seconds");
10844
+ }
10845
+ else if (hours < 1) {
10846
+ // If there are 0 hours, return just minutes and remaining seconds
10847
+ return "".concat(Math.floor(minutes), " minutes, ").concat(remainingSeconds.toFixed(2), " seconds");
10848
+ }
10849
+ else {
10850
+ // For time intervals less than 12 hours but more than 1 hour, return hours, minutes, and remaining seconds
10851
+ return "".concat(Math.floor(hours), " hours, ").concat(Math.floor(minutes % 60), " minutes, ").concat(remainingSeconds.toFixed(2), " seconds");
10797
10852
  }
10798
- }); });
10799
-
10800
- var timeDifference = function (start, end) {
10801
- var differenceMilliseconds = start - end;
10802
- var seconds = Math.floor(differenceMilliseconds / 1000);
10803
- var minutes = Math.floor(seconds / 60);
10804
- var hours = Math.floor(minutes / 60);
10805
- var remainingMinutes = minutes % 60;
10806
- var remainingSeconds = seconds % 60;
10807
- return "".concat(hours, "h ").concat(remainingMinutes, "m ").concat(remainingSeconds, "s");
10808
10853
  };
10809
10854
 
10810
10855
  var TableComponent = function (_a) {
10811
10856
  var chartData = _a.chartData, cursorData = _a.cursorData, getTagsFromAPI = _a.getTagsFromAPI;
10812
10857
  var classes = useTagsTableStyles();
10813
10858
  var _b = useTrendingContext(), _c = _b.state, viewTags = _c.viewTags, viewSelected = _c.viewSelected, _d = _b.actions, setViewTags = _d.setViewTags, setGraphShouldUpdate = _d.setGraphShouldUpdate; _d.setViewSelected;
10814
- var _e = useState(''), error = _e[0], setError = _e[1];
10815
- var _f = useState(false); _f[0]; var setIsLoading = _f[1];
10816
- var _g = useState(null), viewTagForDelete = _g[0], setViewTagForDelete = _g[1];
10859
+ var _e = useState({}); _e[0]; _e[1];
10860
+ var _f = useState(''), error = _f[0], setError = _f[1];
10861
+ var _g = useState(false); _g[0]; var setIsLoading = _g[1];
10862
+ var _h = useState(null), viewTagForDelete = _h[0], setViewTagForDelete = _h[1];
10863
+ var _j = useState(null), selectedRowIndex = _j[0], setSelectedRowIndex = _j[1];
10864
+ var _k = useState(false), addTagModalOpen = _k[0], setAddTagModalOpen = _k[1];
10865
+ var _l = useState(false), saveAsViewModalOpen = _l[0], setSaveAsViewModalOpen = _l[1];
10866
+ var _m = useState(false), loadViewOpen = _m[0], setLoadViewOpen = _m[1];
10867
+ var _o = useState(''), snackbarMessage = _o[0], setSnackbarMessage = _o[1];
10817
10868
  var dataTable = useTagsDataTable({ viewTags: viewTags, chartData: chartData, cursorData: cursorData });
10818
10869
  var handleChange = function (tagId, value, property) {
10819
10870
  var newTags = viewTags.map(function (tag) {
@@ -10859,11 +10910,6 @@ var TableComponent = function (_a) {
10859
10910
  handleAutoScaleChange(tagId, checked);
10860
10911
  }
10861
10912
  };
10862
- var _h = useState(null), selectedRowIndex = _h[0], setSelectedRowIndex = _h[1];
10863
- var _j = useState(false), addTagModalOpen = _j[0], setAddTagModalOpen = _j[1];
10864
- var _k = useState(false), saveAsViewModalOpen = _k[0], setSaveAsViewModalOpen = _k[1];
10865
- var _l = useState(false), loadViewOpen = _l[0], setLoadViewOpen = _l[1];
10866
- var _m = useState(''), snackbarMessage = _m[0], setSnackbarMessage = _m[1];
10867
10913
  var handleClose = function () { return setAddTagModalOpen(false); };
10868
10914
  var ContextMenu = function (_a) {
10869
10915
  var x = _a.x, y = _a.y, options = _a.options;
@@ -10874,7 +10920,7 @@ var TableComponent = function (_a) {
10874
10920
  React__default.createElement("ul", null, options.map(function (option) { return (React__default.createElement("li", { key: option.id, onClick: option.onClick }, option.label)); }))));
10875
10921
  };
10876
10922
  // Position state for the context menu
10877
- var _o = useState({ x: 0, y: 0 }), contextMenuPosition = _o[0], setContextMenuPosition = _o[1];
10923
+ var _p = useState({ x: 0, y: 0 }), contextMenuPosition = _p[0], setContextMenuPosition = _p[1];
10878
10924
  var contextMenuOptions = [
10879
10925
  { id: 'delete', label: 'Remove Tag', onClick: function () { return handleDelete(); } },
10880
10926
  { id: 'add', label: 'Add Tag', onClick: function () { return setAddTagModalOpen(true); } },
@@ -11015,12 +11061,9 @@ var TableComponent = function (_a) {
11015
11061
  React__default.createElement("th", { className: classes.color }),
11016
11062
  React__default.createElement("th", { colSpan: 4, className: "".concat(classes.topTitles, " ").concat(classes.scale) }, "Scale"),
11017
11063
  React__default.createElement("th", { className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? (function () {
11018
- var date = new Date(cursorData.x1);
11019
- var formattedDate = date.toLocaleString('en-US', {
11020
- hour12: false,
11021
- month: 'short',
11022
- day: 'numeric'
11023
- });
11064
+ var dateX1 = new Date(cursorData.x1);
11065
+ var dateX2 = new Date(cursorData.x2);
11066
+ var formattedDate = dateX1.toLocaleString('en-US', __assign({ hour12: false, month: 'short', day: 'numeric' }, (dateX1.getFullYear() !== dateX2.getFullYear() && { year: 'numeric' })));
11024
11067
  var dateText = "".concat(formattedDate);
11025
11068
  return (React__default.createElement(React__default.Fragment, null,
11026
11069
  React__default.createElement("span", { style: {
@@ -11034,12 +11077,9 @@ var TableComponent = function (_a) {
11034
11077
  dateText));
11035
11078
  })() : null),
11036
11079
  React__default.createElement("th", { className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? (function () {
11037
- var date = new Date(cursorData.x2);
11038
- var formattedDate = date.toLocaleString('en-US', {
11039
- hour12: false,
11040
- month: 'short',
11041
- day: 'numeric'
11042
- });
11080
+ var dateX1 = new Date(cursorData.x1);
11081
+ var dateX2 = new Date(cursorData.x2);
11082
+ var formattedDate = dateX2.toLocaleString('en-US', __assign({ hour12: false, month: 'short', day: 'numeric' }, (dateX1.getFullYear() !== dateX2.getFullYear() && { year: 'numeric' })));
11043
11083
  var dateText = "".concat(formattedDate);
11044
11084
  return (React__default.createElement(React__default.Fragment, null,
11045
11085
  React__default.createElement("span", { style: {
@@ -11052,7 +11092,7 @@ var TableComponent = function (_a) {
11052
11092
  } }),
11053
11093
  dateText));
11054
11094
  })() : null),
11055
- React__default.createElement("th", { colSpan: 3, className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? timeDifference(cursorData.x2, cursorData.x1) : null)))),
11095
+ React__default.createElement("th", { colSpan: 3, className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? formatTimeDiffWithMs(cursorData.x1, cursorData.x2) : null)))),
11056
11096
  React__default.createElement("table", { style: { width: '100%', tableLayout: 'fixed', textAlign: "center" } },
11057
11097
  React__default.createElement("thead", null,
11058
11098
  React__default.createElement("tr", { className: classes.bottomTitlesRow },
@@ -11073,7 +11113,7 @@ var TableComponent = function (_a) {
11073
11113
  minute: '2-digit',
11074
11114
  second: '2-digit'
11075
11115
  });
11076
- var milliseconds = date.getMilliseconds().toString().padStart(2, '0');
11116
+ var milliseconds = (date.getMilliseconds() / 1000).toFixed(2).substring(2);
11077
11117
  var dateText = "".concat(formattedHour, ".").concat(milliseconds, " hs");
11078
11118
  return (React__default.createElement(React__default.Fragment, null, dateText));
11079
11119
  })() : null,
@@ -11088,7 +11128,7 @@ var TableComponent = function (_a) {
11088
11128
  minute: '2-digit',
11089
11129
  second: '2-digit'
11090
11130
  });
11091
- var milliseconds = date.getMilliseconds().toString().padStart(2, '0');
11131
+ var milliseconds = (date.getMilliseconds() / 1000).toFixed(2).substring(2);
11092
11132
  var dateText = "".concat(formattedHour, ".").concat(milliseconds, " hs");
11093
11133
  return (React__default.createElement(React__default.Fragment, null, dateText));
11094
11134
  })() : null,
@@ -11108,7 +11148,8 @@ var TableComponent = function (_a) {
11108
11148
  React__default.createElement("input", { type: "checkbox", checked: tag.IsVisible, onChange: function (e) { return handleVisibilityChange(tag.TagId, e.target.checked); } })),
11109
11149
  React__default.createElement("td", { className: classes.aliasCol },
11110
11150
  React__default.createElement(Tooltip, { title: tag.TagName, placement: "top", arrow: true, interactive: true, enterDelay: 500 },
11111
- React__default.createElement("div", null,
11151
+ React__default.createElement("div", { style: { display: 'flex', alignItems: 'center' } },
11152
+ React__default.createElement("div", { className: classes.dataType, style: { backgroundColor: tag.TagType === "Real" ? "blue" : "red" } }, tag.TagType === "Real" ? "A" : "D"),
11112
11153
  React__default.createElement("input", { type: "text", style: { width: '100%' }, value: tag.Alias || tag.TagName, onFocus: function (e) { return e.target.select(); }, onChange: function (e) {
11113
11154
  var newAlias = e.target.value;
11114
11155
  handleChangeAlias(tag.TagId, newAlias);