@dexteel/mesf-core 4.6.0 → 4.6.1
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 +3 -1
- package/dist/index.esm.js +50 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/pages/trendings/components/chart/models/TrendingModels.d.ts +4 -0
- package/dist/pages/trendings/components/chart/sections/trending-chart.d.ts +2 -1
- package/dist/pages/trendings/reducers/trendings.reducer.d.ts +10 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
|
+
## 4.6.1
|
|
3
|
+
- Fix manual scales
|
|
2
4
|
## 4.6.0
|
|
3
5
|
- Add Views and ViewTags functionalities to Trendings
|
|
4
6
|
## 4.5.9
|
|
@@ -84,4 +86,4 @@
|
|
|
84
86
|
## 2.1.5
|
|
85
87
|
- Fix exportExcel method. Now it supports when sheets structure is defined. **REQUIRES mesf-core-api@1.2.2**
|
|
86
88
|
## 2.1.3
|
|
87
|
-
- Implementation of **exportExcel** inside MESApiService. **REQUIRES mesf-core-api@1.2.0**
|
|
89
|
+
- Implementation of **exportExcel** inside MESApiService. **REQUIRES mesf-core-api@1.2.0**
|
package/dist/index.esm.js
CHANGED
|
@@ -8469,6 +8469,9 @@ var TrendingsReducer = createSlice({
|
|
|
8469
8469
|
setViewTags: function (state, _a) {
|
|
8470
8470
|
var payload = _a.payload;
|
|
8471
8471
|
state.viewTags = payload;
|
|
8472
|
+
},
|
|
8473
|
+
setGraphShouldUpdate: function (state) {
|
|
8474
|
+
state.graphShouldUpdate = +1;
|
|
8472
8475
|
}
|
|
8473
8476
|
}
|
|
8474
8477
|
});
|
|
@@ -9193,9 +9196,8 @@ var timeDifference = function (start, end) {
|
|
|
9193
9196
|
var TableComponent = function (_a) {
|
|
9194
9197
|
var chartData = _a.chartData, cursorData = _a.cursorData;
|
|
9195
9198
|
var classes = useTagsTableStyles();
|
|
9196
|
-
var _b = useTrendingContext(), _c = _b.state, viewTags = _c.viewTags, viewSelected = _c.viewSelected,
|
|
9197
|
-
var
|
|
9198
|
-
var _e = useState(""); _e[0]; _e[1];
|
|
9199
|
+
var _b = useTrendingContext(), _c = _b.state, viewTags = _c.viewTags, viewSelected = _c.viewSelected, _d = _b.actions, setViewTags = _d.setViewTags, setGraphShouldUpdate = _d.setGraphShouldUpdate;
|
|
9200
|
+
var _e = useState(''), error = _e[0], setError = _e[1];
|
|
9199
9201
|
var dataTable = useTagsDataTable({ viewTags: viewTags, chartData: chartData, cursorData: cursorData });
|
|
9200
9202
|
var _f = useState({}), editableTagNames = _f[0], setEditableTagNames = _f[1];
|
|
9201
9203
|
var handleChange = function (tagId, value, property) {
|
|
@@ -9204,6 +9206,7 @@ var TableComponent = function (_a) {
|
|
|
9204
9206
|
return tag.TagId === tagId ? __assign(__assign({}, tag), (_a = {}, _a[property] = value, _a.IsAutoScale = false, _a)) : tag;
|
|
9205
9207
|
});
|
|
9206
9208
|
setViewTags(newTags);
|
|
9209
|
+
setGraphShouldUpdate();
|
|
9207
9210
|
};
|
|
9208
9211
|
var handleChangeAlias = function (tagId, newName) {
|
|
9209
9212
|
var newTags = viewTags.map(function (tag) { return (tag.TagId === tagId ? __assign(__assign({}, tag), { Alias: newName }) : tag); });
|
|
@@ -9232,6 +9235,11 @@ var TableComponent = function (_a) {
|
|
|
9232
9235
|
setViewTags(newArr);
|
|
9233
9236
|
}
|
|
9234
9237
|
};
|
|
9238
|
+
var handleAbleScales = function (tagId, checked) {
|
|
9239
|
+
if (checked) {
|
|
9240
|
+
handleAutoScaleChange(tagId, checked);
|
|
9241
|
+
}
|
|
9242
|
+
};
|
|
9235
9243
|
var _g = useState(null), selectedRowIndex = _g[0], setSelectedRowIndex = _g[1];
|
|
9236
9244
|
var _h = useState(false), addTagModalOpen = _h[0], setAddTagModalOpen = _h[1];
|
|
9237
9245
|
var _j = useState(false), saveAsViewModalOpen = _j[0], setSaveAsViewModalOpen = _j[1];
|
|
@@ -9433,13 +9441,21 @@ var TableComponent = function (_a) {
|
|
|
9433
9441
|
React__default.createElement("td", { className: classes.color },
|
|
9434
9442
|
React__default.createElement(ColorPicker, { onChange: handleColorChange, color: tag.Color, elementId: tag.TagId })),
|
|
9435
9443
|
React__default.createElement("td", { className: classes.inputCol },
|
|
9436
|
-
React__default.createElement("input", { type: "text", style: { width: '100%' },
|
|
9444
|
+
React__default.createElement("input", { type: "text", style: __assign({ width: '100%' }, (tag.IsAutoScale ? {
|
|
9445
|
+
backgroundColor: 'rgba(239, 239, 239, 0.3)',
|
|
9446
|
+
color: 'rgba(84, 84, 84, 1)',
|
|
9447
|
+
border: '1px solid rgba(118, 118, 118, 0.3)'
|
|
9448
|
+
} : {})), value: tag.MinScale, onClick: function () { return handleAbleScales(tag.TagId, tag.IsAutoScale); }, onFocus: function (e) { return e.target.select(); }, onChange: function (e) {
|
|
9437
9449
|
var value = e.target.value;
|
|
9438
9450
|
var numericValue = Number(value);
|
|
9439
9451
|
handleChange(tag.TagId, numericValue, 'MinScale');
|
|
9440
9452
|
} })),
|
|
9441
9453
|
React__default.createElement("td", { className: classes.inputCol },
|
|
9442
|
-
React__default.createElement("input", { type: "text", style: { width: '100%' },
|
|
9454
|
+
React__default.createElement("input", { type: "text", style: __assign({ width: '100%' }, (tag.IsAutoScale ? {
|
|
9455
|
+
backgroundColor: 'rgba(239, 239, 239, 0.3)',
|
|
9456
|
+
color: 'rgba(84, 84, 84, 1)',
|
|
9457
|
+
border: '1px solid rgba(118, 118, 118, 0.3)'
|
|
9458
|
+
} : {})), value: tag.MaxScale, onClick: function () { return handleAbleScales(tag.TagId, tag.IsAutoScale); }, onFocus: function (e) { return e.target.select(); }, onChange: function (e) {
|
|
9443
9459
|
var value = e.target.value;
|
|
9444
9460
|
var numericValue = Number(value);
|
|
9445
9461
|
// Check if the value is a number and not empty
|
|
@@ -9868,53 +9884,62 @@ var TrendingChart = function (_a) {
|
|
|
9868
9884
|
var verticalLinePlugin = useGetVerticalLinePlugin(setChartArea, setLineTabCoords);
|
|
9869
9885
|
var xAxisDatePlugin = useXAxisDatePlugin();
|
|
9870
9886
|
var yAxisPlugin = useYAxisPlugin();
|
|
9887
|
+
var seriesVsTags = useRef({});
|
|
9871
9888
|
useEffect(function () {
|
|
9872
9889
|
var axes = [];
|
|
9873
9890
|
if (!series.length) {
|
|
9874
9891
|
return;
|
|
9875
9892
|
}
|
|
9876
9893
|
viewTags.forEach(function (tag, index) {
|
|
9877
|
-
var
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9894
|
+
var existingAxis = axes.findIndex(function (existingTag) {
|
|
9895
|
+
return areRangesSimilar(existingTag, tag);
|
|
9896
|
+
});
|
|
9897
|
+
if (existingAxis === -1) {
|
|
9898
|
+
axes.push(tag); // Add new axis if no similar one exists
|
|
9899
|
+
seriesVsTags.current[tag.TagId] = tag.TagId;
|
|
9900
|
+
}
|
|
9901
|
+
else {
|
|
9902
|
+
seriesVsTags.current[tag.TagId] = axes[existingAxis].TagId;
|
|
9885
9903
|
}
|
|
9886
9904
|
});
|
|
9887
9905
|
// Configure yAxes based on grouped axes
|
|
9888
|
-
var yAxesConfig = axes.map(function (axis
|
|
9906
|
+
var yAxesConfig = axes.map(function (axis) {
|
|
9889
9907
|
return {
|
|
9890
|
-
id: "y-axis-".concat(
|
|
9908
|
+
id: "y-axis-".concat(axis.TagId),
|
|
9891
9909
|
type: "linear",
|
|
9892
|
-
display: axis.
|
|
9910
|
+
display: axis.IsVisible,
|
|
9893
9911
|
scaleLabel: {
|
|
9894
9912
|
display: true,
|
|
9895
|
-
labelString: axis.
|
|
9896
|
-
},
|
|
9897
|
-
ticks: {
|
|
9898
|
-
min: axis.autoScale ? undefined : axis.minScale,
|
|
9899
|
-
max: axis.autoScale ? undefined : axis.maxScale
|
|
9913
|
+
labelString: axis.TagName
|
|
9900
9914
|
},
|
|
9915
|
+
min: axis.IsAutoScale ? undefined : axis.MinScale,
|
|
9916
|
+
max: axis.IsAutoScale ? undefined : axis.MaxScale,
|
|
9917
|
+
suggestedMin: axis.IsAutoScale ? undefined : axis.MinScale,
|
|
9918
|
+
suggestedMax: axis.IsAutoScale ? undefined : axis.MaxScale,
|
|
9919
|
+
stepSize: 10,
|
|
9901
9920
|
grid: {
|
|
9902
9921
|
display: true
|
|
9903
9922
|
},
|
|
9904
|
-
afterUpdate: function (
|
|
9905
|
-
var chart =
|
|
9923
|
+
afterUpdate: function (a) {
|
|
9924
|
+
var chart = a.chart;
|
|
9906
9925
|
var keys = Object.keys(chart.scales).filter(function (sc) { return sc !== 'x'; });
|
|
9926
|
+
var counterOfDefaultsScales = 0;
|
|
9907
9927
|
if (keys.length > 1) {
|
|
9908
9928
|
for (var scaleKey in chart.scales) {
|
|
9909
9929
|
var scale = chart.scales[scaleKey];
|
|
9910
9930
|
if (scale.max === 1 && scale.min === 0) {
|
|
9911
9931
|
chart.scales[scaleKey].display = false;
|
|
9912
9932
|
chart.scales[scaleKey].options.display = false;
|
|
9933
|
+
counterOfDefaultsScales++;
|
|
9913
9934
|
}
|
|
9914
9935
|
else {
|
|
9915
9936
|
chart.scales[scaleKey].display = true;
|
|
9916
9937
|
chart.scales[scaleKey].options.display = true;
|
|
9917
9938
|
}
|
|
9939
|
+
if (counterOfDefaultsScales === keys.length) {
|
|
9940
|
+
chart.scales[keys[0]].display = true;
|
|
9941
|
+
chart.scales[keys[0]].options.display = true;
|
|
9942
|
+
}
|
|
9918
9943
|
}
|
|
9919
9944
|
}
|
|
9920
9945
|
}
|
|
@@ -9929,11 +9954,9 @@ var TrendingChart = function (_a) {
|
|
|
9929
9954
|
});
|
|
9930
9955
|
var updatedSeries = series.map(function (serie, index) {
|
|
9931
9956
|
var tag = viewTags[index];
|
|
9932
|
-
var
|
|
9933
|
-
return areRangesSimilar(existingTag, tag);
|
|
9934
|
-
});
|
|
9957
|
+
var yAxisTagId = seriesVsTags.current[tag.TagId];
|
|
9935
9958
|
return {
|
|
9936
|
-
yAxisID:
|
|
9959
|
+
yAxisID: "y-axis-".concat(yAxisTagId),
|
|
9937
9960
|
data: serie.map(function (sample) { return ({
|
|
9938
9961
|
x: new Date(sample.timestamp),
|
|
9939
9962
|
y: sample.value
|