logitude-dashboard-library 1.4.60 → 1.4.62

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.
@@ -0,0 +1,3 @@
1
+ <svg viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M3.24985 3.5V1.25C3.24985 0.83579 3.58564 0.5 3.99985 0.5H12.9998C13.4141 0.5 13.7498 0.83579 13.7498 1.25V11.75C13.7498 12.1642 13.4141 12.5 12.9998 12.5H10.7498V14.7493C10.7498 15.1639 10.4124 15.5 9.99475 15.5H1.00499C0.587942 15.5 0.25 15.1665 0.25 14.7493L0.25195 4.25065C0.252025 3.83608 0.58948 3.5 1.00706 3.5H3.24985ZM1.75181 5L1.75014 14H9.24985V5H1.75181ZM4.74985 3.5H10.7498V11H12.2498V2H4.74985V3.5Z" fill="#5FAFDA"/>
3
+ </svg>
@@ -274,7 +274,7 @@ $dark-grey: #717585;
274
274
  .widget-titles-container {
275
275
  display: flex;
276
276
  flex-wrap: wrap;
277
- width: calc(100% - 4rem);
277
+ width: calc(100% - 70px);
278
278
  padding: 0px 12px 12px 12px;
279
279
 
280
280
  .title-container {
@@ -321,7 +321,7 @@ $dark-grey: #717585;
321
321
  .widget-options-container {
322
322
  display: flex;
323
323
  align-items: center;
324
- width: 45px;
324
+ width: 68px;
325
325
  column-gap: 6px;
326
326
 
327
327
  svg {
@@ -0,0 +1,3 @@
1
+ <svg viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M3.24985 3.5V1.25C3.24985 0.83579 3.58564 0.5 3.99985 0.5H12.9998C13.4141 0.5 13.7498 0.83579 13.7498 1.25V11.75C13.7498 12.1642 13.4141 12.5 12.9998 12.5H10.7498V14.7493C10.7498 15.1639 10.4124 15.5 9.99475 15.5H1.00499C0.587942 15.5 0.25 15.1665 0.25 14.7493L0.25195 4.25065C0.252025 3.83608 0.58948 3.5 1.00706 3.5H3.24985ZM1.75181 5L1.75014 14H9.24985V5H1.75181ZM4.74985 3.5H10.7498V11H12.2498V2H4.74985V3.5Z" fill="#5FAFDA"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="14" height="16" viewBox="0 0 14 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M3.24985 3.5V1.25C3.24985 0.83579 3.58564 0.5 3.99985 0.5H12.9998C13.4141 0.5 13.7498 0.83579 13.7498 1.25V11.75C13.7498 12.1642 13.4141 12.5 12.9998 12.5H10.7498V14.7493C10.7498 15.1639 10.4124 15.5 9.99475 15.5H1.00499C0.587942 15.5 0.25 15.1665 0.25 14.7493L0.25195 4.25065C0.252025 3.83608 0.58948 3.5 1.00706 3.5H3.24985ZM1.75181 5L1.75014 14H9.24985V5H1.75181ZM4.74985 3.5H10.7498V11H12.2498V2H4.74985V3.5Z" fill="#5FAFDA"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M3.24985 3.5V1.25C3.24985 0.83579 3.58564 0.5 3.99985 0.5H12.9998C13.4141 0.5 13.7498 0.83579 13.7498 1.25V11.75C13.7498 12.1642 13.4141 12.5 12.9998 12.5H10.7498V14.7493C10.7498 15.1639 10.4124 15.5 9.99475 15.5H1.00499C0.587942 15.5 0.25 15.1665 0.25 14.7493L0.25195 4.25065C0.252025 3.83608 0.58948 3.5 1.00706 3.5H3.24985ZM1.75181 5L1.75014 14H9.24985V5H1.75181ZM4.74985 3.5H10.7498V11H12.2498V2H4.74985V3.5Z" fill="#5FAFDA"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M3.24985 3.5V1.25C3.24985 0.83579 3.58564 0.5 3.99985 0.5H12.9998C13.4141 0.5 13.7498 0.83579 13.7498 1.25V11.75C13.7498 12.1642 13.4141 12.5 12.9998 12.5H10.7498V14.7493C10.7498 15.1639 10.4124 15.5 9.99475 15.5H1.00499C0.587942 15.5 0.25 15.1665 0.25 14.7493L0.25195 4.25065C0.252025 3.83608 0.58948 3.5 1.00706 3.5H3.24985ZM1.75181 5L1.75014 14H9.24985V5H1.75181ZM4.74985 3.5H10.7498V11H12.2498V2H4.74985V3.5Z" fill="#5FAFDA"/>
3
+ </svg>
@@ -18,6 +18,7 @@ declare type DashboardDesignerProps = {
18
18
  openEditWidget: (widget: ReactWidgetPM) => void;
19
19
  onLayoutChange: (layouts: Layouts) => void;
20
20
  onWidgetDelete: (deleteProps: DeleteWidgetProps) => void;
21
+ onCopyWidget?: (id: string) => void;
21
22
  dataBinding: DashboardDataBinding;
22
23
  onSelectDataPoint: (dataPointSelection: DataPointSelection) => void;
23
24
  };
@@ -4,6 +4,7 @@ import { ReactWidgetPM } from "../../types/widget";
4
4
  import { DashboardDataBinding } from '../../types/DashboardDataBinding';
5
5
  declare type WidgetCardProps = {
6
6
  editBtnClicked(widget: any): any;
7
+ copyBtnClicked?(id: any): any;
7
8
  deleteBtnClicked(i: any): any;
8
9
  widget: ReactWidgetPM | undefined;
9
10
  widgetRef: ReactWidgetPM | undefined;
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ declare type DashboardProps = {
15
15
  lg: ReactWidgetPM[];
16
16
  }) => void;
17
17
  openEditWidget: (Widget: ReactWidgetPM) => void;
18
+ onCopyWidget?: (key: string) => void;
18
19
  openDeleteWidgetConfirmWindow: (deleteProps: DeleteWidgetProps) => void;
19
20
  onSelectDataPoint: (dataPointSelection: DataPointSelection) => void;
20
21
  };
package/dist/index.js CHANGED
@@ -246,7 +246,7 @@ var getLabelFormatByDateGroupType = function getLabelFormatByDateGroupType(label
246
246
  };
247
247
 
248
248
  var KpiChart = function KpiChart(props) {
249
- var _widget$current3;
249
+ var _widget$current4;
250
250
  var _useState = React.useState(false),
251
251
  dataLoaded = _useState[0],
252
252
  setDataLoaded = _useState[1];
@@ -286,12 +286,16 @@ var KpiChart = function KpiChart(props) {
286
286
  });
287
287
  };
288
288
  var kpiClick = function kpiClick() {
289
- var _widget$current, _widget$current2, _widget$current2$Widg;
289
+ var _widget$current, _widget$current2, _widget$current3, _widget$current3$Widg;
290
290
  var measureFieldId;
291
- if (widget !== null && widget !== void 0 && (_widget$current = widget.current) !== null && _widget$current !== void 0 && _widget$current.WidgetMeasures) measureFieldId = widget === null || widget === void 0 ? void 0 : (_widget$current2 = widget.current) === null || _widget$current2 === void 0 ? void 0 : (_widget$current2$Widg = _widget$current2.WidgetMeasures[0]) === null || _widget$current2$Widg === void 0 ? void 0 : _widget$current2$Widg.MeasureFieldId;
291
+ var currentWidgetMeasure = widget === null || widget === void 0 ? void 0 : (_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.WidgetMeasures[0];
292
+ if (widget !== null && widget !== void 0 && (_widget$current2 = widget.current) !== null && _widget$current2 !== void 0 && _widget$current2.WidgetMeasures) measureFieldId = widget === null || widget === void 0 ? void 0 : (_widget$current3 = widget.current) === null || _widget$current3 === void 0 ? void 0 : (_widget$current3$Widg = _widget$current3.WidgetMeasures[0]) === null || _widget$current3$Widg === void 0 ? void 0 : _widget$current3$Widg.MeasureFieldId;
292
293
  props.customChartProps.onSelectDataPoint({
293
294
  MeasureFieldId: measureFieldId,
294
- Widget: widget.current
295
+ Widget: widget.current,
296
+ MeasureCode: currentWidgetMeasure.MeasureCode,
297
+ Formula: currentWidgetMeasure.Formula,
298
+ GroupById: data === null || data === void 0 ? void 0 : data.GroupById
295
299
  });
296
300
  };
297
301
  function getRatioComponent() {
@@ -371,7 +375,7 @@ var KpiChart = function KpiChart(props) {
371
375
  return React__default.createElement("div", {
372
376
  className: "dl-kpi-label-container"
373
377
  }, React__default.createElement("span", {
374
- className: "dl-kpi-label-span"
378
+ className: "dl-kpi-label-span dl-kpi-textTrimming"
375
379
  }, labelFormated));
376
380
  }
377
381
  return !dataLoaded ? React__default.createElement("div", {
@@ -385,7 +389,7 @@ var KpiChart = function KpiChart(props) {
385
389
  animationDuration: "2s"
386
390
  })) : !error ? React__default.createElement("div", {
387
391
  onClick: kpiClick,
388
- className: ((_widget$current3 = widget.current) === null || _widget$current3 === void 0 ? void 0 : _widget$current3.Alighnment) == "Left" ? "dl-kpi-container-click" : "dl-kpi-container-click dl-kpi-center-container"
392
+ className: ((_widget$current4 = widget.current) === null || _widget$current4 === void 0 ? void 0 : _widget$current4.Alighnment) == "Left" ? "dl-kpi-container-click" : "dl-kpi-container-click dl-kpi-center-container"
389
393
  }, React__default.createElement("div", {
390
394
  className: "dl-kpi-container"
391
395
  }, getLabel(), getValueComponent(), getPreviousValueComponent())) : React__default.createElement("div", {
@@ -520,7 +524,9 @@ function buildDataSource(values, widget) {
520
524
  label: getLabelFormatByDateGroupType(e.Label, widget, false),
521
525
  id: {
522
526
  GroupById: e.GroupById,
523
- MeasureFieldId: series.MeasureFieldId
527
+ MeasureFieldId: series.MeasureFieldId,
528
+ MeasureCode: series.MeasureCode,
529
+ Formula: series.Formula
524
530
  },
525
531
  tooltext: buildToolTip(widget, null, series.Name, e.Label, 0),
526
532
  color: getSeriesPositionColor(index + 1)
@@ -538,7 +544,9 @@ function buildDataSet(seriesMeasures, widget) {
538
544
  value: e.Value,
539
545
  id: {
540
546
  GroupById: e.GroupById,
541
- MeasureFieldId: seriesMeasure.MeasureFieldId
547
+ MeasureFieldId: seriesMeasure.MeasureFieldId,
548
+ MeasureCode: seriesMeasure.MeasureCode,
549
+ Formula: seriesMeasure.Formula
542
550
  },
543
551
  tooltext: buildToolTip(widget, e.Value, seriesMeasure.Name, null, index)
544
552
  };
@@ -1062,6 +1070,8 @@ var FusionChart = React.forwardRef(function (props, comRef) {
1062
1070
  props.onSelectDataPoint({
1063
1071
  GroupById: dataObj.id.groupbyid,
1064
1072
  MeasureFieldId: dataObj.id.measurefieldid,
1073
+ MeasureCode: dataObj.id.measurecode,
1074
+ Formula: dataObj.id.formula,
1065
1075
  Widget: widget.current,
1066
1076
  GroupByIdSec: dataObj.id.groupbyidsec
1067
1077
  });
@@ -1169,8 +1179,34 @@ function SvgEditIcon(props) {
1169
1179
  })));
1170
1180
  }
1171
1181
 
1182
+ var _path$3;
1183
+ function _extends$4() {
1184
+ _extends$4 = Object.assign ? Object.assign.bind() : function (target) {
1185
+ for (var i = 1; i < arguments.length; i++) {
1186
+ var source = arguments[i];
1187
+ for (var key in source) {
1188
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1189
+ target[key] = source[key];
1190
+ }
1191
+ }
1192
+ }
1193
+ return target;
1194
+ };
1195
+ return _extends$4.apply(this, arguments);
1196
+ }
1197
+ function SvgCopyIcon(props) {
1198
+ return /*#__PURE__*/React.createElement("svg", _extends$4({
1199
+ viewBox: "0 0 22 22",
1200
+ fill: "none",
1201
+ xmlns: "http://www.w3.org/2000/svg"
1202
+ }, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
1203
+ d: "M3.25 3.5V1.25A.75.75 0 014 .5h9a.75.75 0 01.75.75v10.5a.75.75 0 01-.75.75h-2.25v2.25c0 .414-.338.75-.755.75h-8.99a.751.751 0 01-.755-.75l.002-10.5c0-.414.337-.75.755-.75H3.25zM1.752 5l-.002 9h7.5V5H1.752zM4.75 3.5h6V11h1.5V2h-7.5v1.5z",
1204
+ fill: "#5FAFDA"
1205
+ })));
1206
+ }
1207
+
1172
1208
  var WidgetCard = React.forwardRef(function (props, comRef) {
1173
- var _widget$current2, _widget$current3, _widget$current4, _widget$current5, _widget$current6, _widget$current7, _widget$current8;
1209
+ var _widget$current3, _widget$current4, _widget$current5, _widget$current6, _widget$current7, _widget$current8, _widget$current9;
1174
1210
  var widget = React.useRef();
1175
1211
  var _useState = React.useState(false),
1176
1212
  isLoading = _useState[0],
@@ -1184,12 +1220,18 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
1184
1220
  var editWidget = function editWidget() {
1185
1221
  props.editBtnClicked(widget.current);
1186
1222
  };
1223
+ var copyWidget = function copyWidget() {
1224
+ if (props && props.copyBtnClicked) {
1225
+ var _widget$current;
1226
+ props.copyBtnClicked((_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.key);
1227
+ }
1228
+ };
1187
1229
  React.useEffect(function () {
1188
1230
  var _props$dataBinding;
1189
1231
  widget.current = props.widget;
1190
1232
  (_props$dataBinding = props.dataBinding) === null || _props$dataBinding === void 0 ? void 0 : _props$dataBinding.onEditWidget.subscribe(function (e) {
1191
- var _widget$current;
1192
- if ((e === null || e === void 0 ? void 0 : e.key) != ((_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.key)) return;
1233
+ var _widget$current2;
1234
+ if ((e === null || e === void 0 ? void 0 : e.key) != ((_widget$current2 = widget.current) === null || _widget$current2 === void 0 ? void 0 : _widget$current2.key)) return;
1193
1235
  setIsLoading(true);
1194
1236
  widget.current = _extends({}, e);
1195
1237
  setIsLoading(false);
@@ -1240,7 +1282,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
1240
1282
  color: getCSSPropertyValue(widget.current, 'TitleFontColor', ''),
1241
1283
  textAlign: getCSSPropertyValue(widget === null || widget === void 0 ? void 0 : widget.current, 'TitleAlignment', '', undefined)
1242
1284
  },
1243
- "data-pr-tooltip": (_widget$current2 = widget.current) === null || _widget$current2 === void 0 ? void 0 : _widget$current2.Title,
1285
+ "data-pr-tooltip": (_widget$current3 = widget.current) === null || _widget$current3 === void 0 ? void 0 : _widget$current3.Title,
1244
1286
  "data-pr-position": "top",
1245
1287
  onMouseEnter: function onMouseEnter() {
1246
1288
  return showTooltip(true);
@@ -1251,19 +1293,23 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
1251
1293
  return showTooltip(true);
1252
1294
  }, 50);
1253
1295
  }
1254
- }, (_widget$current3 = widget.current) === null || _widget$current3 === void 0 ? void 0 : _widget$current3.Title)), React__default.createElement("div", {
1255
- className: (_widget$current4 = widget.current) !== null && _widget$current4 !== void 0 && _widget$current4.Subtitle && ((_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.Subtitle.length) > 0 ? "subtitle" : "subtitle margin-top-4",
1296
+ }, (_widget$current4 = widget.current) === null || _widget$current4 === void 0 ? void 0 : _widget$current4.Title)), React__default.createElement("div", {
1297
+ className: (_widget$current5 = widget.current) !== null && _widget$current5 !== void 0 && _widget$current5.Subtitle && ((_widget$current6 = widget.current) === null || _widget$current6 === void 0 ? void 0 : _widget$current6.Subtitle.length) > 0 ? "subtitle" : "subtitle margin-top-4",
1256
1298
  style: {
1257
1299
  fontSize: getCSSPropertyValue(widget.current, 'SubtitleFontSize', 'px'),
1258
1300
  textAlign: getCSSPropertyValue(widget === null || widget === void 0 ? void 0 : widget.current, 'TitleAlignment', '', undefined),
1259
1301
  color: getCSSPropertyValue(widget.current, 'SubtitleFontColor', '')
1260
1302
  }
1261
- }, (_widget$current6 = widget.current) === null || _widget$current6 === void 0 ? void 0 : _widget$current6.Subtitle)), props.isInEditMode && isWidgetHovered ? React__default.createElement("div", {
1262
- className: (_widget$current7 = widget.current) !== null && _widget$current7 !== void 0 && _widget$current7.Title && ((_widget$current8 = widget.current) === null || _widget$current8 === void 0 ? void 0 : _widget$current8.Title.length) > 0 ? "widget-options-container" : "widget-options-container margin-top-6"
1303
+ }, (_widget$current7 = widget.current) === null || _widget$current7 === void 0 ? void 0 : _widget$current7.Subtitle)), props.isInEditMode && isWidgetHovered ? React__default.createElement("div", {
1304
+ className: (_widget$current8 = widget.current) !== null && _widget$current8 !== void 0 && _widget$current8.Title && ((_widget$current9 = widget.current) === null || _widget$current9 === void 0 ? void 0 : _widget$current9.Title.length) > 0 ? "widget-options-container" : "widget-options-container margin-top-6"
1263
1305
  }, React__default.createElement(SvgEditIcon, {
1264
1306
  onClick: function onClick() {
1265
1307
  return editWidget();
1266
1308
  }
1309
+ }), React__default.createElement(SvgCopyIcon, {
1310
+ onClick: function onClick() {
1311
+ return copyWidget();
1312
+ }
1267
1313
  }), React__default.createElement(SvgDeleteIcon, {
1268
1314
  onClick: function onClick() {
1269
1315
  var _props$widget;
@@ -1279,9 +1325,9 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
1279
1325
  className: "dl-dashboard-widget"
1280
1326
  }, " ", GetChartComponent(), " "));
1281
1327
  function GetChartComponent() {
1282
- var _widget$current9, _widget$current10;
1283
- if (isLoading || !((_widget$current9 = widget.current) !== null && _widget$current9 !== void 0 && _widget$current9.TypeCode)) return null;
1284
- if (((_widget$current10 = widget.current) === null || _widget$current10 === void 0 ? void 0 : _widget$current10.TypeCode) == "kpi") return React__default.createElement(CustomChart, {
1328
+ var _widget$current10, _widget$current11;
1329
+ if (isLoading || !((_widget$current10 = widget.current) !== null && _widget$current10 !== void 0 && _widget$current10.TypeCode)) return null;
1330
+ if (((_widget$current11 = widget.current) === null || _widget$current11 === void 0 ? void 0 : _widget$current11.TypeCode) == "kpi") return React__default.createElement(CustomChart, {
1285
1331
  dataBinding: props.dataBinding,
1286
1332
  widget: widget.current,
1287
1333
  widgetRef: props.widgetRef,
@@ -1422,6 +1468,11 @@ var DashboardDesigner = function DashboardDesigner(props) {
1422
1468
  widget.ChangeSetOp = 'Update';
1423
1469
  props.openEditWidget(widget);
1424
1470
  }
1471
+ function copyWidget(key) {
1472
+ if (props && props.onCopyWidget) {
1473
+ props.onCopyWidget(key);
1474
+ }
1475
+ }
1425
1476
  function UpdatePlaceholderDimensions(layouts) {
1426
1477
  if (!layouts) return;
1427
1478
  var max = minimumPlaceholderRowsCount;
@@ -1480,6 +1531,7 @@ var DashboardDesigner = function DashboardDesigner(props) {
1480
1531
  editBtnClicked: editWidget,
1481
1532
  deleteBtnClicked: confirmDeleteWidget,
1482
1533
  onSelectDataPoint: props.onSelectDataPoint,
1534
+ copyBtnClicked: copyWidget,
1483
1535
  ref: function ref(el) {
1484
1536
  var _widget$Layout3;
1485
1537
  widgetCardRef.current[i] = {
@@ -1544,6 +1596,11 @@ var Dashboard = function Dashboard(props) {
1544
1596
  setPreviewWidgett(JSON.parse(JSON.stringify(props.widgetData)));
1545
1597
  }
1546
1598
  }, [props.widgetData]);
1599
+ var copyWidget = function copyWidget(key) {
1600
+ if (props && props.onCopyWidget) {
1601
+ props.onCopyWidget(key);
1602
+ }
1603
+ };
1547
1604
  var updateWidgets = function updateWidgets(layouts) {
1548
1605
  var layoutsDic = {};
1549
1606
  Object.keys(layouts).forEach(function (sizeType) {
@@ -1608,6 +1665,7 @@ var Dashboard = function Dashboard(props) {
1608
1665
  onWidgetDelete: function onWidgetDelete(deleteProps) {
1609
1666
  return props.openDeleteWidgetConfirmWindow(deleteProps);
1610
1667
  },
1668
+ onCopyWidget: copyWidget,
1611
1669
  openEditWidget: function openEditWidget(widget) {
1612
1670
  return props.openEditWidget(widget);
1613
1671
  }