logitude-dashboard-library 1.2.28 → 1.2.29

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.
@@ -42,6 +42,7 @@ $dark-grey: #717585;
42
42
  align-content: center;
43
43
  align-items: center;
44
44
  font-weight: bolder;
45
+ padding: 0px 0px 0 13px;
45
46
  }
46
47
  .dl-heder-row{
47
48
  width: 100%;
@@ -2,9 +2,7 @@
2
2
  import ColumnChartComponent from "./ChartsComponents/ColumnChartComponent";
3
3
  import { Widget } from "../../types/widget";
4
4
  declare type DashboardDesignerProps = {
5
- onEditWidget: (widget: Widget) => void;
6
- onAddWidget: (widgetTypeCode: string) => void;
7
- onSaveDashboard: () => void;
5
+ openEditWidget: (widget: Widget) => void;
8
6
  };
9
7
  declare const DashboardDesigner: (props: DashboardDesignerProps) => JSX.Element;
10
8
  export declare const layoutGridProps: {
package/dist/index.d.ts CHANGED
@@ -1,9 +1,16 @@
1
1
  /// <reference types="react" />
2
2
  import "./styles.module.css";
3
+ import { DashboardPM } from './types/Dashboard';
4
+ import { Widget } from './types/widget';
3
5
  declare type DashboardProps = {
4
6
  token: string;
5
7
  tenant: number;
6
8
  userId: string;
9
+ dashboard: DashboardPM;
10
+ openAddEditWidget: (widget: Widget) => void;
11
+ openAddEditDashboard: (dashboard: DashboardPM) => void;
12
+ onChangeDashboard: (dashboard: DashboardPM) => void;
13
+ onSaveDashboard: (dashboard: DashboardPM) => void;
7
14
  };
8
15
  declare const Dashboard: (props: DashboardProps) => JSX.Element;
9
16
  export default Dashboard;
package/dist/index.js CHANGED
@@ -9,9 +9,6 @@ var ReactApexChart = _interopDefault(require('react-apexcharts'));
9
9
  var axios = _interopDefault(require('axios'));
10
10
  var overlaypanel = require('primereact/overlaypanel');
11
11
  var dropdown = require('primereact/dropdown');
12
- var dialog = require('primereact/dialog');
13
- var inputtext = require('primereact/inputtext');
14
- var inputtextarea = require('primereact/inputtextarea');
15
12
  var ripple = require('primereact/ripple');
16
13
 
17
14
  function _inheritsLoose(subClass, superClass) {
@@ -692,7 +689,7 @@ var DashboardDesigner = function DashboardDesigner(props) {
692
689
  }
693
690
 
694
691
  function editWidget(widget) {
695
- props.onEditWidget(widget);
692
+ props.openEditWidget(widget);
696
693
  }
697
694
 
698
695
  function FindWidget(el) {
@@ -880,120 +877,6 @@ var DashBoardService = /*#__PURE__*/function () {
880
877
  return DashBoardService;
881
878
  }();
882
879
 
883
- var Session = function Session() {};
884
-
885
- var DashboardDialogComponent = function DashboardDialogComponent(props) {
886
- var _useState = React.useState(''),
887
- name = _useState[0],
888
- setName = _useState[1];
889
-
890
- var _useState2 = React.useState(''),
891
- description = _useState2[0],
892
- setDescription = _useState2[1];
893
-
894
- var _useState3 = React.useState(props.display),
895
- displayAddDashboard = _useState3[0],
896
- setDisplayAddDashboard = _useState3[1];
897
-
898
- var _useState4 = React.useState({}),
899
- validation = _useState4[0],
900
- setValidation = _useState4[1];
901
-
902
- React.useEffect(function () {
903
- setDisplayAddDashboard(props.display);
904
- }, [props.display]);
905
-
906
- var onSave = function onSave() {
907
- if (!checkFormValidation()) return;
908
- var dashBoardService = new DashBoardService();
909
- var dasboard = {
910
- Name: name,
911
- Description: description,
912
- Tenant: Session.Tenant,
913
- UpdatedByUserId: Session.CurrentUserId,
914
- CreatedByUserId: Session.CurrentUserId
915
- };
916
- dashBoardService.add(dasboard).then(function (e) {
917
- onCancel();
918
- });
919
- };
920
-
921
- var checkFormValidation = function checkFormValidation() {
922
- var isValid = true;
923
- var formValidation = {};
924
-
925
- if ((name === null || name === void 0 ? void 0 : name.length) == 0) {
926
- formValidation['name'] = true;
927
- isValid = false;
928
- } else {
929
- formValidation['name'] = false;
930
- }
931
-
932
- console.log(formValidation['name']);
933
- setValidation(formValidation);
934
- return isValid;
935
- };
936
-
937
- var onCancel = function onCancel() {
938
- setDisplayAddDashboard(false);
939
- props.onClose();
940
- clear();
941
- };
942
-
943
- var clear = function clear() {
944
- setDescription('');
945
- setName('');
946
- };
947
-
948
- return React__default.createElement(dialog.Dialog, {
949
- header: "New Dashboard",
950
- visible: displayAddDashboard,
951
- style: {
952
- width: 'auto'
953
- },
954
- onHide: onCancel
955
- }, React__default.createElement("form", {
956
- id: "dashboard-crd",
957
- name: "dashboard-crd"
958
- }, React__default.createElement("div", {
959
- className: "form"
960
- }, React__default.createElement("div", {
961
- className: "form-field"
962
- }, React__default.createElement("label", {
963
- htmlFor: "dashboard-name"
964
- }, "Name"), React__default.createElement(inputtext.InputText, {
965
- id: "dashboard-name",
966
- className: "p-inputtext-sm " + (validation['name'] ? 'p-invalid' : ''),
967
- value: name,
968
- required: true,
969
- onChange: function onChange(e) {
970
- setName(e.target.value);
971
- }
972
- })), React__default.createElement("div", {
973
- className: "form-field"
974
- }, React__default.createElement("label", {
975
- htmlFor: "dashboard-description"
976
- }, "Description"), React__default.createElement(inputtextarea.InputTextarea, {
977
- id: "dashboard-description",
978
- className: "p-inputtext-sm",
979
- value: description,
980
- onChange: function onChange(e) {
981
- setDescription(e.target.value);
982
- }
983
- }))), React__default.createElement("div", {
984
- className: "dialog-footer dl-m-t-s"
985
- }, React__default.createElement(button.Button, {
986
- label: "Cancel",
987
- className: "p-button-text",
988
- onClick: onCancel
989
- }), React__default.createElement(button.Button, {
990
- label: "Ok",
991
- form: "frm",
992
- onClick: onSave,
993
- autoFocus: true
994
- }))));
995
- };
996
-
997
880
  var WidgetTypeListService = /*#__PURE__*/function () {
998
881
  function WidgetTypeListService() {
999
882
  this._ApiServices = new ApiServices();
@@ -1024,15 +907,18 @@ var Dashboard = function Dashboard(props) {
1024
907
  setCurrentDashbord = _useState2[1];
1025
908
 
1026
909
  var _useState3 = React.useState(false),
1027
- displayAddDashboard = _useState3[0],
1028
910
  setDisplayAddDashboard = _useState3[1];
1029
911
 
1030
912
  var _useState4 = React.useState(),
1031
913
  selectedWidget = _useState4[0];
1032
914
 
1033
- var _useState5 = React.useState(),
1034
- WidgetTypes = _useState5[0],
1035
- setWidgetTypes = _useState5[1];
915
+ var _useState5 = React.useState(false),
916
+ isInEditMode = _useState5[0],
917
+ setisInEditMode = _useState5[1];
918
+
919
+ var _useState6 = React.useState(),
920
+ WidgetTypes = _useState6[0],
921
+ setWidgetTypes = _useState6[1];
1036
922
 
1037
923
  var dashboardMoreButtonToggle = React.createRef();
1038
924
  var dashboardService = new DashBoardService();
@@ -1041,16 +927,8 @@ var Dashboard = function Dashboard(props) {
1041
927
  getDashboards();
1042
928
  getWidgetTypes();
1043
929
  }, []);
1044
- Session.CurrentUserId = props.userId;
1045
- Session.Tenant = props.tenant;
1046
- Session.Token = props.token;
1047
930
  if ((props === null || props === void 0 ? void 0 : (_props$token = props.token) === null || _props$token === void 0 ? void 0 : _props$token.length) > 0) localStorage.setItem("token", props === null || props === void 0 ? void 0 : props.token);
1048
931
 
1049
- var onDashboardDialogClose = function onDashboardDialogClose() {
1050
- getDashboards();
1051
- setDisplayAddDashboard(false);
1052
- };
1053
-
1054
932
  var getDashboards = function getDashboards() {
1055
933
  dashboardService.getDataByFilters(new ApiQueryFilters()).then(function (data) {
1056
934
  setDashbords(data.data.Result);
@@ -1064,6 +942,8 @@ var Dashboard = function Dashboard(props) {
1064
942
  });
1065
943
  };
1066
944
 
945
+ var EditDashBoard = function EditDashBoard() {};
946
+
1067
947
  var addWidget = function addWidget(widgetCode) {};
1068
948
 
1069
949
  return React.createElement("div", {
@@ -1087,19 +967,24 @@ var Dashboard = function Dashboard(props) {
1087
967
  className: "buttons-overlay"
1088
968
  }, React.createElement("div", {
1089
969
  className: "buttons-list"
1090
- }, React.createElement("div", null, "set token")))), React.createElement("div", {
970
+ }, React.createElement("div", {
971
+ onClick: function onClick() {
972
+ return EditDashBoard();
973
+ }
974
+ }, "Edit"), React.createElement("div", {
975
+ onClick: function onClick() {
976
+ return setisInEditMode(true);
977
+ }
978
+ }, "Edit Design")))), React.createElement("div", {
1091
979
  className: 'dl-flex-row'
1092
- }, React.createElement("div", null, React.createElement(button.Button, {
980
+ }, React.createElement("div", null, isInEditMode ? React.createElement(button.Button, {
1093
981
  icon: "pi pi-plus",
1094
982
  onClick: function onClick() {
1095
983
  return setDisplayAddDashboard(true);
1096
984
  },
1097
985
  className: "dl-dashboard-add p-button-rounded p-button-success",
1098
986
  "aria-label": "Search"
1099
- })), React.createElement(DashboardDialogComponent, {
1100
- display: displayAddDashboard,
1101
- onClose: onDashboardDialogClose
1102
- }), React.createElement("div", {
987
+ }) : null), React.createElement("div", {
1103
988
  style: {
1104
989
  width: "210px"
1105
990
  }
@@ -1134,14 +1019,8 @@ var Dashboard = function Dashboard(props) {
1134
1019
  })))), React.createElement("div", {
1135
1020
  className: 'dl-dashboard-body'
1136
1021
  }, React.createElement(DashboardDesigner, {
1137
- onEditWidget: function onEditWidget(widget) {
1138
- throw new Error('Function not implemented.');
1139
- },
1140
- onAddWidget: function onAddWidget(widgetTypeCode) {
1141
- throw new Error('Function not implemented.');
1142
- },
1143
- onSaveDashboard: function onSaveDashboard() {
1144
- throw new Error('Function not implemented.');
1022
+ openEditWidget: function openEditWidget(widget) {
1023
+ return props.openAddEditWidget(widget);
1145
1024
  }
1146
1025
  })));
1147
1026
  };