@dexteel/mesf-core 4.5.3 → 4.5.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,6 @@
1
1
  # CHANGELOG
2
+ ## 4.5.4
3
+ - Add arrows dates navigator
2
4
  ## 4.5.3
3
5
  - Use color picker in trendings
4
6
  ## 4.5.0
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- 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, Box, FormControl as FormControl$1, Select as Select$1, createStyles as createStyles$1, List, ListItem, ListItemText } from '@material-ui/core';
1
+ 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, Box, IconButton as IconButton$1, FormControl as FormControl$1, Select as Select$1, createStyles as createStyles$1, List, ListItem, ListItemText } from '@material-ui/core';
2
2
  import { values, get, isNil as isNil$1, isEmpty } from 'lodash-es';
3
3
  import * as React from 'react';
4
4
  import React__default, { useState, useRef, useEffect, Component, createContext, useContext, useMemo, useCallback, lazy, Suspense } from 'react';
@@ -20,6 +20,7 @@ import Grid from '@material-ui/core/Grid';
20
20
  import { isNil, get as get$1 } from 'lodash';
21
21
  import { DndProvider } from 'react-dnd';
22
22
  import { HTML5Backend } from 'react-dnd-html5-backend';
23
+ import { ArrowRight, ChevronLeft, ChevronRight } from '@material-ui/icons';
23
24
  import axios from 'axios';
24
25
  import { _adapters, Chart, CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip as Tooltip$1, Legend, TimeScale } from 'chart.js';
25
26
  import moment from 'moment';
@@ -68,7 +69,6 @@ import 'ag-grid-enterprise/styles/ag-theme-balham.min.css';
68
69
  import 'ag-grid-community/styles/ag-grid.css';
69
70
  import 'ag-grid-community/styles/ag-theme-alpine.css';
70
71
  import { isAncestor, Tree } from '@minoru/react-dnd-treeview';
71
- import { ArrowRight } from '@material-ui/icons';
72
72
  import ImageIcon from '@material-ui/icons/Image';
73
73
  import ListAltIcon from '@material-ui/icons/ListAlt';
74
74
  import DescriptionIcon from '@material-ui/icons/Description';
@@ -8686,6 +8686,13 @@ var TrendingsReducer = createSlice({
8686
8686
  reducers: {
8687
8687
  setTotalScope: function (state, _a) {
8688
8688
  var payload = _a.payload; _a.type;
8689
+ if (!isNil$1(payload.start) && !isNil$1(payload.end) && !isNil$1(payload.scope)) {
8690
+ //from arrow navigators
8691
+ state.timeScopeStart = payload.start;
8692
+ state.timeScopeEnd = payload.end;
8693
+ state.scope = payload.scope;
8694
+ return;
8695
+ }
8689
8696
  if (!isNil$1(payload.scope)) {
8690
8697
  if (payload.scope !== "custom") {
8691
8698
  switch (payload.scope) {
@@ -8724,7 +8731,7 @@ var TrendingsReducer = createSlice({
8724
8731
  state.scope = payload.scope;
8725
8732
  return;
8726
8733
  }
8727
- if (!isNil$1(payload.start) && !isNil$1(payload.end)) {
8734
+ if (!isNil$1(payload.start) && !isNil$1(payload.end) && isNil$1(payload.scope)) {
8728
8735
  // from graph
8729
8736
  state.timeScopeStart = payload.start;
8730
8737
  state.timeScopeEnd = payload.end;
@@ -8875,6 +8882,11 @@ var useTrendingStyles = makeStyles$1(function (theme) { return ({
8875
8882
  '& input[type="checkbox"]': {
8876
8883
  zoom: 1.5
8877
8884
  }
8885
+ },
8886
+ navigatorButton: {
8887
+ "& .MuiSvgIcon-root": {
8888
+ cursor: "pointer !important"
8889
+ }
8878
8890
  }
8879
8891
  }); });
8880
8892
 
@@ -8898,6 +8910,17 @@ var CustomOptionsComponent = function (_a) {
8898
8910
  "Stepped"))));
8899
8911
  };
8900
8912
 
8913
+ var dateNavigator = function (startDate, endDate, scope, operator) {
8914
+ if (scope === "custom")
8915
+ return;
8916
+ else {
8917
+ var _a = scope.split(" "), quantity = _a[0], duration = _a[1];
8918
+ var newStartDate = moment(startDate)[operator](quantity, duration[0]).toDate();
8919
+ var newEndDate = moment(endDate)[operator](quantity, duration[0]).toDate();
8920
+ return { newStartDate: newStartDate, newEndDate: newEndDate };
8921
+ }
8922
+ };
8923
+
8901
8924
  Chart.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip$1, Legend, TimeScale, zoomPlugin);
8902
8925
  function getVerticalLinePlugin(setCursorData) {
8903
8926
  return {
@@ -9011,6 +9034,12 @@ var Trending = function (_a) {
9011
9034
  });
9012
9035
  }
9013
9036
  };
9037
+ var handleDateNavigator = function (operator) {
9038
+ var newDates = dateNavigator(state.timeScopeStart, state.timeScopeEnd, state.scope, operator);
9039
+ if (newDates) {
9040
+ actions.setTotalScope({ start: newDates.newStartDate, end: newDates.newEndDate, scope: state.scope });
9041
+ }
9042
+ };
9014
9043
  var _j = useState({
9015
9044
  animation: {
9016
9045
  duration: 0
@@ -9026,7 +9055,6 @@ var Trending = function (_a) {
9026
9055
  maxTicksLimit: 20,
9027
9056
  callback: function (value, index, values) {
9028
9057
  // Extract the time and date from the current value
9029
- console.log("VALUE", value);
9030
9058
  var currentDate = new Date(value);
9031
9059
  var time = currentDate.toLocaleTimeString("en-US", {
9032
9060
  hour12: false,
@@ -9234,6 +9262,8 @@ var Trending = function (_a) {
9234
9262
  return (React__default.createElement(Grid$1, { container: true, style: { width: "95svw", height: "81svh", margin: 0 } },
9235
9263
  React__default.createElement(Grid$1, { item: true, xs: 12, container: true, justifyContent: "space-between", alignItems: "center", style: { height: "15%" } },
9236
9264
  React__default.createElement(Grid$1, { md: 5, item: true, container: true, justifyContent: "flex-start", alignItems: "center", spacing: 1, wrap: "wrap" },
9265
+ React__default.createElement(IconButton$1, { color: "primary", onClick: function () { return handleDateNavigator("subtract"); }, className: classes.navigatorButton },
9266
+ React__default.createElement(ChevronLeft, { fontSize: "large" })),
9237
9267
  React__default.createElement(Grid$1, { item: true },
9238
9268
  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: {
9239
9269
  shrink: true,
@@ -9255,7 +9285,9 @@ var Trending = function (_a) {
9255
9285
  React__default.createElement(TextField, { label: "End", variant: "outlined", className: classes.datetimePicker, type: "datetime-local", value: moment(state.timeScopeEnd).format("YYYY-MM-DDTHH:mm:ss"), onChange: function (e) { return handleDateChange(e.target.value, "end"); }, InputLabelProps: {
9256
9286
  shrink: true,
9257
9287
  style: { marginLeft: "10px" }
9258
- } }))),
9288
+ } })),
9289
+ React__default.createElement(IconButton$1, { color: "primary", onClick: function () { return handleDateNavigator("add"); }, className: classes.navigatorButton },
9290
+ React__default.createElement(ChevronRight, { fontSize: "large" }))),
9259
9291
  React__default.createElement(Grid$1, { md: 7, item: true, container: true, justifyContent: "space-between" },
9260
9292
  React__default.createElement(Grid$1, { item: true, container: true, wrap: "nowrap", spacing: 1 },
9261
9293
  React__default.createElement(Grid$1, { item: true, container: true },
@@ -23,6 +23,10 @@ export declare const useTrendingContext: () => {
23
23
  scope?: import("../models/scopes.model").scopeType | undefined;
24
24
  start?: Date | undefined;
25
25
  end: Date;
26
+ } | {
27
+ scope: import("../models/scopes.model").scopeType;
28
+ start: Date;
29
+ end: Date;
26
30
  };
27
31
  type: string;
28
32
  }): void;
@@ -1 +1 @@
1
- export declare const useTrendingStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"datetimePicker" | "select" | "labelOptions">;
1
+ export declare const useTrendingStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"datetimePicker" | "select" | "labelOptions" | "navigatorButton">;
@@ -0,0 +1,5 @@
1
+ import { scopeType } from "../models/scopes.model";
2
+ export declare const dateNavigator: (startDate: Date, endDate: Date, scope: scopeType, operator: "add" | "subtract") => {
3
+ newStartDate: Date;
4
+ newEndDate: Date;
5
+ } | undefined;
@@ -21,6 +21,10 @@ export declare const TrendingsReducer: import("@reduxjs/toolkit").Slice<{
21
21
  scope?: scopeType;
22
22
  start?: Date;
23
23
  end: Date;
24
+ } | {
25
+ scope: scopeType;
26
+ start: Date;
27
+ end: Date;
24
28
  };
25
29
  type: string;
26
30
  }): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexteel/mesf-core",
3
- "version": "4.5.3",
3
+ "version": "4.5.4",
4
4
  "author": "Dexteel Team",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",