logitude-dashboard-library 3.2.56 → 3.2.57

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.
@@ -1274,4 +1274,93 @@ $dark-grey: #717585;
1274
1274
  display: block;
1275
1275
  overflow: hidden;
1276
1276
  text-overflow: ellipsis;
1277
+ }
1278
+
1279
+ // Widget Copy Dropdown (Duplicate / Copy)
1280
+ .widget-copy-dropdown-container {
1281
+ &-content {
1282
+ padding: 0 !important;
1283
+ border-radius: 4px !important;
1284
+ box-shadow: 0px 8px 16px 0px #0000001A !important;
1285
+ border: 1px solid #F3F4F5 !important;
1286
+ }
1287
+ }
1288
+
1289
+ .widget-copy-dropdown-menu {
1290
+ background: #FFFFFF;
1291
+ border-radius: 4px;
1292
+ width: 168px;
1293
+ height: 72px;
1294
+ padding: 8px;
1295
+ display: flex;
1296
+ flex-direction: column;
1297
+ justify-content: center;
1298
+
1299
+ .widget-copy-dropdown-item {
1300
+ padding: 6px 10px;
1301
+ font-family: "Manrope", sans-serif;
1302
+ font-weight: 500;
1303
+ font-size: 12px;
1304
+ line-height: 16px;
1305
+ color: #404040;
1306
+ cursor: pointer;
1307
+ white-space: nowrap;
1308
+
1309
+ &:hover {
1310
+ background-color: #F3F4F5;
1311
+ border-radius: 4px;
1312
+ }
1313
+ }
1314
+ }
1315
+
1316
+ // Widget Copied Notification
1317
+ .widget-copied-notification {
1318
+ position: absolute;
1319
+ top: 32px;
1320
+ left: 8px;
1321
+ background: #19395C;
1322
+ color: #FFFFFF;
1323
+ padding: 6px;
1324
+ border-radius: 4px;
1325
+ display: flex;
1326
+ align-items: center;
1327
+ gap: 4px;
1328
+ z-index: 1000;
1329
+ white-space: nowrap;
1330
+ width: calc(100% - 16px);
1331
+ max-width: calc(100% - 16px);
1332
+ animation: widgetCopiedFadeIn 0.2s ease;
1333
+
1334
+ .widget-copied-notification-check {
1335
+ font-size: 12px;
1336
+ line-height: 16px;
1337
+ }
1338
+
1339
+ .widget-copied-notification-title {
1340
+ font-family: "Manrope", sans-serif;
1341
+ font-weight: 600;
1342
+ font-size: 12px;
1343
+ line-height: 16px;
1344
+ max-width: calc(100% - 50px);
1345
+ overflow: hidden;
1346
+ text-overflow: ellipsis;
1347
+ }
1348
+
1349
+ .widget-copied-notification-text {
1350
+ font-family: "Manrope", sans-serif;
1351
+ font-weight: 500;
1352
+ font-size: 12px;
1353
+ line-height: 16px;
1354
+ }
1355
+ }
1356
+
1357
+ @keyframes widgetCopiedFadeIn {
1358
+ from {
1359
+ opacity: 0;
1360
+ transform: translateY(-4px);
1361
+ }
1362
+ to {
1363
+ opacity: 1;
1364
+ transform: translateY(0);
1365
+ }
1277
1366
  }
@@ -19,6 +19,7 @@ declare type DashboardDesignerProps = {
19
19
  onLayoutChange: (layouts: Layouts) => void;
20
20
  onWidgetDelete: (deleteProps: DeleteWidgetProps) => void;
21
21
  onCopyWidget?: (id: string) => void;
22
+ onCopyWidgetToClipboard?: (key: string, widget: ReactWidgetPM) => void;
22
23
  dataBinding: DashboardDataBinding;
23
24
  onSelectDataPoint: (dataPointSelection: DataPointSelection) => void;
24
25
  };
@@ -5,6 +5,8 @@ import { DashboardDataBinding } from '../../types/DashboardDataBinding';
5
5
  declare type WidgetCardProps = {
6
6
  editBtnClicked(widget: any): any;
7
7
  copyBtnClicked?(id: any): any;
8
+ duplicateBtnClicked?(id: any): any;
9
+ copyToClipboardBtnClicked?(key: any, widget: ReactWidgetPM): any;
8
10
  deleteBtnClicked(i: any): any;
9
11
  widget: ReactWidgetPM | undefined;
10
12
  widgetRef: ReactWidgetPM | undefined;
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ declare type DashboardProps = {
19
19
  }) => void;
20
20
  openEditWidget: (Widget: ReactWidgetPM) => void;
21
21
  onCopyWidget?: (key: string) => void;
22
+ onCopyWidgetToClipboard?: (key: string, widget: ReactWidgetPM) => void;
22
23
  openDeleteWidgetConfirmWindow: (deleteProps: DeleteWidgetProps) => void;
23
24
  onSelectDataPoint: (dataPointSelection: DataPointSelection) => void;
24
25
  };
package/dist/index.js CHANGED
@@ -2602,12 +2602,10 @@ function getMaxMeasureValue(seriesMeasures, widget) {
2602
2602
  var _seriesMeasure$Values;
2603
2603
 
2604
2604
  seriesMeasure === null || seriesMeasure === void 0 ? void 0 : (_seriesMeasure$Values = seriesMeasure.Values) === null || _seriesMeasure$Values === void 0 ? void 0 : _seriesMeasure$Values.forEach(function (valueItem) {
2605
- var _stackedTotalsByGroup;
2606
-
2607
2605
  var numericValue = toNumericValue(valueItem === null || valueItem === void 0 ? void 0 : valueItem.Value);
2608
2606
  if (numericValue === null) return;
2609
2607
  var groupId = valueItem === null || valueItem === void 0 ? void 0 : valueItem.GroupById;
2610
- var currentTotal = (_stackedTotalsByGroup = stackedTotalsByGroupId.get(groupId)) != null ? _stackedTotalsByGroup : 0;
2608
+ var currentTotal = stackedTotalsByGroupId.get(groupId) || 0;
2611
2609
  stackedTotalsByGroupId.set(groupId, currentTotal + numericValue);
2612
2610
  });
2613
2611
  });
@@ -4096,7 +4094,7 @@ var FusionChart$1 = React.forwardRef(function (props, comRef) {
4096
4094
  });
4097
4095
 
4098
4096
  var WidgetCard = React.forwardRef(function (props, comRef) {
4099
- var _widget$current13, _widget$current14, _widget$current15;
4097
+ var _widget$current15, _widget$current16, _widget$current17, _widget$current18;
4100
4098
 
4101
4099
  var widget = React.useRef();
4102
4100
 
@@ -4118,15 +4116,39 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
4118
4116
  headerErrorMessages = _useState4[0],
4119
4117
  setHeaderErrorMessages = _useState4[1];
4120
4118
 
4119
+ var _useState5 = React.useState(false),
4120
+ showCopiedNotification = _useState5[0],
4121
+ setShowCopiedNotification = _useState5[1];
4122
+
4123
+ var copyPopupRef = React.useRef(null);
4124
+ var copiedNotificationTimer = React.useRef(null);
4125
+
4121
4126
  var editWidget = function editWidget() {
4122
4127
  props.editBtnClicked(widget.current);
4123
4128
  };
4124
4129
 
4125
- var copyWidget = function copyWidget() {
4126
- if (props && props.copyBtnClicked) {
4130
+ var duplicateWidget = function duplicateWidget() {
4131
+ if (props && props.duplicateBtnClicked) {
4127
4132
  var _widget$current;
4128
4133
 
4129
- props.copyBtnClicked((_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.key);
4134
+ props.duplicateBtnClicked((_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.key);
4135
+ } else if (props && props.copyBtnClicked) {
4136
+ var _widget$current2;
4137
+
4138
+ props.copyBtnClicked((_widget$current2 = widget.current) === null || _widget$current2 === void 0 ? void 0 : _widget$current2.key);
4139
+ }
4140
+ };
4141
+
4142
+ var copyWidgetToClipboard = function copyWidgetToClipboard() {
4143
+ if (props && props.copyToClipboardBtnClicked && widget.current) {
4144
+ var _widget$current3;
4145
+
4146
+ props.copyToClipboardBtnClicked((_widget$current3 = widget.current) === null || _widget$current3 === void 0 ? void 0 : _widget$current3.key, widget.current);
4147
+ setShowCopiedNotification(true);
4148
+ if (copiedNotificationTimer.current) clearTimeout(copiedNotificationTimer.current);
4149
+ copiedNotificationTimer.current = setTimeout(function () {
4150
+ setShowCopiedNotification(false);
4151
+ }, 700);
4130
4152
  }
4131
4153
  };
4132
4154
 
@@ -4135,20 +4157,23 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
4135
4157
 
4136
4158
  widget.current = props.widget;
4137
4159
  (_props$dataBinding = props.dataBinding) === null || _props$dataBinding === void 0 ? void 0 : _props$dataBinding.onEditWidget.subscribe(function (e) {
4138
- var _widget$current2;
4160
+ var _widget$current4;
4139
4161
 
4140
- 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;
4162
+ if ((e === null || e === void 0 ? void 0 : e.key) != ((_widget$current4 = widget.current) === null || _widget$current4 === void 0 ? void 0 : _widget$current4.key)) return;
4141
4163
  setIsLoading(true);
4142
4164
  widget.current = _extends({}, e);
4143
4165
  setIsLoading(false);
4144
4166
  });
4145
4167
  (_props$dataBinding2 = props.dataBinding) === null || _props$dataBinding2 === void 0 ? void 0 : _props$dataBinding2.widgetUpdated.subscribe(function (updatedWidget) {
4146
- var _widget$current3;
4168
+ var _widget$current5;
4147
4169
 
4148
- if ((updatedWidget === null || updatedWidget === void 0 ? void 0 : updatedWidget.key) != ((_widget$current3 = widget.current) === null || _widget$current3 === void 0 ? void 0 : _widget$current3.key)) return;
4170
+ if ((updatedWidget === null || updatedWidget === void 0 ? void 0 : updatedWidget.key) != ((_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.key)) return;
4149
4171
  widget.current = _extends({}, updatedWidget);
4150
4172
  setTriggerId(uuid.v4());
4151
4173
  });
4174
+ return function () {
4175
+ if (copiedNotificationTimer.current) clearTimeout(copiedNotificationTimer.current);
4176
+ };
4152
4177
  }, []);
4153
4178
  React.useImperativeHandle(comRef, function () {
4154
4179
  return {
@@ -4173,10 +4198,10 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
4173
4198
  };
4174
4199
 
4175
4200
  var GetChartComponent = function GetChartComponent() {
4176
- var _widget$current4, _widget$current5, _widget$current6, _widget$current7, _widget$current8;
4201
+ var _widget$current6, _widget$current7, _widget$current8, _widget$current9, _widget$current10;
4177
4202
 
4178
- if (isLoading || !((_widget$current4 = widget.current) !== null && _widget$current4 !== void 0 && _widget$current4.TypeCode)) return "";
4179
- if (((_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.TypeCode) == "kpi") return React__default.createElement(CustomChart, {
4203
+ if (isLoading || !((_widget$current6 = widget.current) !== null && _widget$current6 !== void 0 && _widget$current6.TypeCode)) return "";
4204
+ if (((_widget$current7 = widget.current) === null || _widget$current7 === void 0 ? void 0 : _widget$current7.TypeCode) == "kpi") return React__default.createElement(CustomChart, {
4180
4205
  isInEditMode: props.isInEditMode,
4181
4206
  isPreviewModeActive: props.isPreviewModeActive,
4182
4207
  dataBinding: props.dataBinding,
@@ -4187,7 +4212,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
4187
4212
  return showErrorMsg(errorMsg);
4188
4213
  }
4189
4214
  });
4190
- if (((_widget$current6 = widget.current) === null || _widget$current6 === void 0 ? void 0 : _widget$current6.TypeCode) == "table" || ((_widget$current7 = widget.current) === null || _widget$current7 === void 0 ? void 0 : _widget$current7.TypeCode) == "pivot") return React__default.createElement(CustomChart, {
4215
+ if (((_widget$current8 = widget.current) === null || _widget$current8 === void 0 ? void 0 : _widget$current8.TypeCode) == "table" || ((_widget$current9 = widget.current) === null || _widget$current9 === void 0 ? void 0 : _widget$current9.TypeCode) == "pivot") return React__default.createElement(CustomChart, {
4191
4216
  isInEditMode: props.isInEditMode,
4192
4217
  isPreviewModeActive: props.isPreviewModeActive,
4193
4218
  dataBinding: props.dataBinding,
@@ -4195,7 +4220,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
4195
4220
  widgetRef: props.widgetRef,
4196
4221
  onSelectDataPoint: props.onSelectDataPoint
4197
4222
  });
4198
- if (((_widget$current8 = widget.current) === null || _widget$current8 === void 0 ? void 0 : _widget$current8.TypeCode) == "gauge") return React__default.createElement(FusionChart$1, {
4223
+ if (((_widget$current10 = widget.current) === null || _widget$current10 === void 0 ? void 0 : _widget$current10.TypeCode) == "gauge") return React__default.createElement(FusionChart$1, {
4199
4224
  ref: fusionChartRef,
4200
4225
  dataBinding: props.dataBinding,
4201
4226
  widget: widget.current,
@@ -4254,15 +4279,15 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
4254
4279
  };
4255
4280
 
4256
4281
  var isThereTitle = function isThereTitle() {
4257
- var _widget$current9, _widget$current10;
4282
+ var _widget$current11, _widget$current12;
4258
4283
 
4259
- return ((_widget$current9 = widget.current) === null || _widget$current9 === void 0 ? void 0 : _widget$current9.Title) && ((_widget$current10 = widget.current) === null || _widget$current10 === void 0 ? void 0 : _widget$current10.Title.length) > 0;
4284
+ return ((_widget$current11 = widget.current) === null || _widget$current11 === void 0 ? void 0 : _widget$current11.Title) && ((_widget$current12 = widget.current) === null || _widget$current12 === void 0 ? void 0 : _widget$current12.Title.length) > 0;
4260
4285
  };
4261
4286
 
4262
4287
  var isThereSubtitle = function isThereSubtitle() {
4263
- var _widget$current11, _widget$current12;
4288
+ var _widget$current13, _widget$current14;
4264
4289
 
4265
- return ((_widget$current11 = widget.current) === null || _widget$current11 === void 0 ? void 0 : _widget$current11.Subtitle) && ((_widget$current12 = widget.current) === null || _widget$current12 === void 0 ? void 0 : _widget$current12.Subtitle.length) > 0;
4290
+ return ((_widget$current13 = widget.current) === null || _widget$current13 === void 0 ? void 0 : _widget$current13.Subtitle) && ((_widget$current14 = widget.current) === null || _widget$current14 === void 0 ? void 0 : _widget$current14.Subtitle.length) > 0;
4266
4291
  };
4267
4292
 
4268
4293
  var tableHintMessage = function tableHintMessage() {
@@ -4311,7 +4336,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
4311
4336
  color: getCSSPropertyValue(widget.current, 'TitleFontColor', ''),
4312
4337
  textAlign: getCSSPropertyValue(widget === null || widget === void 0 ? void 0 : widget.current, 'TitleAlignment', '', undefined)
4313
4338
  }
4314
- }, (_widget$current13 = widget.current) === null || _widget$current13 === void 0 ? void 0 : _widget$current13.Title),
4339
+ }, (_widget$current15 = widget.current) === null || _widget$current15 === void 0 ? void 0 : _widget$current15.Title),
4315
4340
  position: ['top center'],
4316
4341
  arrowStyle: {
4317
4342
  color: '#19395C'
@@ -4320,7 +4345,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
4320
4345
  on: ['hover', 'focus']
4321
4346
  }, React__default.createElement("span", {
4322
4347
  className: "widget-title-tooltip-text"
4323
- }, (_widget$current14 = widget.current) === null || _widget$current14 === void 0 ? void 0 : _widget$current14.Title))), isTableOrPivotWidget() && isThereTitle() && isThereSubtitle() && React__default.createElement("div", {
4348
+ }, (_widget$current16 = widget.current) === null || _widget$current16 === void 0 ? void 0 : _widget$current16.Title))), isTableOrPivotWidget() && isThereTitle() && isThereSubtitle() && React__default.createElement("div", {
4324
4349
  className: "titles-vertical-seeparator"
4325
4350
  }), React__default.createElement("div", {
4326
4351
  className: isThereSubtitle() ? "subtitle" : "subtitle margin-top-4",
@@ -4330,25 +4355,57 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
4330
4355
  color: getCSSPropertyValue(widget.current, 'SubtitleFontColor', ''),
4331
4356
  minWidth: isThereSubtitle() && isTableOrPivotWidget() ? '5%' : undefined
4332
4357
  }
4333
- }, (_widget$current15 = widget.current) === null || _widget$current15 === void 0 ? void 0 : _widget$current15.Subtitle)), !isTitleAligmentRight() && isTableOrPivotWidget() && tableHintMessage(), props.isInEditMode && React__default.createElement("div", {
4358
+ }, (_widget$current17 = widget.current) === null || _widget$current17 === void 0 ? void 0 : _widget$current17.Subtitle)), !isTitleAligmentRight() && isTableOrPivotWidget() && tableHintMessage(), props.isInEditMode && React__default.createElement("div", {
4334
4359
  className: isThereTitle() ? "widget-options-container" : "widget-options-container margin-top-6"
4335
4360
  }, React__default.createElement("div", null, " ", React__default.createElement(SvgEditIcon, {
4336
4361
  className: "widget-card-edit-icon",
4337
4362
  onClick: function onClick() {
4338
4363
  return editWidget();
4339
4364
  }
4340
- }), " "), React__default.createElement("div", null, " ", React__default.createElement(SvgCopyIcon, {
4341
- className: "widget-card-copy-icon",
4365
+ }), " "), React__default.createElement(Popup, {
4366
+ ref: copyPopupRef,
4367
+ className: "widget-copy-dropdown-container",
4368
+ trigger: React__default.createElement("div", null, React__default.createElement(SvgCopyIcon, {
4369
+ className: "widget-card-copy-icon"
4370
+ })),
4371
+ position: ['bottom left', 'bottom center'],
4372
+ closeOnDocumentClick: true,
4373
+ closeOnEscape: true,
4374
+ arrow: false,
4375
+ offsetY: 2
4376
+ }, React__default.createElement("div", {
4377
+ className: "widget-copy-dropdown-menu"
4378
+ }, React__default.createElement("div", {
4379
+ className: "widget-copy-dropdown-item",
4342
4380
  onClick: function onClick() {
4343
- return copyWidget();
4381
+ var _copyPopupRef$current;
4382
+
4383
+ (_copyPopupRef$current = copyPopupRef.current) === null || _copyPopupRef$current === void 0 ? void 0 : _copyPopupRef$current.close();
4384
+ duplicateWidget();
4385
+ }
4386
+ }, "Duplicate"), React__default.createElement("div", {
4387
+ className: "widget-copy-dropdown-item",
4388
+ onClick: function onClick() {
4389
+ var _copyPopupRef$current2;
4390
+
4391
+ (_copyPopupRef$current2 = copyPopupRef.current) === null || _copyPopupRef$current2 === void 0 ? void 0 : _copyPopupRef$current2.close();
4392
+ copyWidgetToClipboard();
4344
4393
  }
4345
- }), " "), React__default.createElement("div", null, " ", React__default.createElement(SvgDeleteIcon, {
4394
+ }, "Copy"))), React__default.createElement("div", null, " ", React__default.createElement(SvgDeleteIcon, {
4346
4395
  onClick: function onClick() {
4347
4396
  var _props$widget;
4348
4397
 
4349
4398
  return props.deleteBtnClicked((_props$widget = props.widget) === null || _props$widget === void 0 ? void 0 : _props$widget.key);
4350
4399
  }
4351
- }), " ")), !props.isInEditMode && showHeaderErrorMessages && React__default.createElement("div", {
4400
+ }), " ")), showCopiedNotification && React__default.createElement("div", {
4401
+ className: "widget-copied-notification"
4402
+ }, React__default.createElement("span", {
4403
+ className: "widget-copied-notification-check"
4404
+ }, "\u2713"), React__default.createElement("span", {
4405
+ className: "widget-copied-notification-title"
4406
+ }, (_widget$current18 = widget.current) === null || _widget$current18 === void 0 ? void 0 : _widget$current18.Title), React__default.createElement("span", {
4407
+ className: "widget-copied-notification-text"
4408
+ }, "widget copied")), !props.isInEditMode && showHeaderErrorMessages && React__default.createElement("div", {
4352
4409
  className: "header-message-error"
4353
4410
  }, React__default.createElement(Popup, {
4354
4411
  className: "header-message-error-tooltip-container",
@@ -4524,6 +4581,12 @@ var DashboardDesigner = function DashboardDesigner(props) {
4524
4581
  }
4525
4582
  }
4526
4583
 
4584
+ function copyWidgetToClipboard(key, widget) {
4585
+ if (props && props.onCopyWidgetToClipboard) {
4586
+ props.onCopyWidgetToClipboard(key, widget);
4587
+ }
4588
+ }
4589
+
4527
4590
  function UpdatePlaceholderDimensions(layouts) {
4528
4591
  if (!layouts) return;
4529
4592
  var max = minimumPlaceholderRowsCount;
@@ -4596,7 +4659,8 @@ var DashboardDesigner = function DashboardDesigner(props) {
4596
4659
  editBtnClicked: editWidget,
4597
4660
  deleteBtnClicked: confirmDeleteWidget,
4598
4661
  onSelectDataPoint: props.onSelectDataPoint,
4599
- copyBtnClicked: copyWidget,
4662
+ duplicateBtnClicked: copyWidget,
4663
+ copyToClipboardBtnClicked: copyWidgetToClipboard,
4600
4664
  ref: function ref(el) {
4601
4665
  var _widget$Layout3;
4602
4666
 
@@ -4678,6 +4742,12 @@ var Dashboard = function Dashboard(props) {
4678
4742
  }
4679
4743
  };
4680
4744
 
4745
+ var copyWidgetToClipboard = function copyWidgetToClipboard(key, widget) {
4746
+ if (props && props.onCopyWidgetToClipboard) {
4747
+ props.onCopyWidgetToClipboard(key, widget);
4748
+ }
4749
+ };
4750
+
4681
4751
  var updateWidgets = function updateWidgets(layouts) {
4682
4752
  var layoutsDic = {};
4683
4753
  Object.keys(layouts).forEach(function (sizeType) {
@@ -4745,6 +4815,7 @@ var Dashboard = function Dashboard(props) {
4745
4815
  return props.openDeleteWidgetConfirmWindow(deleteProps);
4746
4816
  },
4747
4817
  onCopyWidget: copyWidget,
4818
+ onCopyWidgetToClipboard: copyWidgetToClipboard,
4748
4819
  openEditWidget: function openEditWidget(widget) {
4749
4820
  return props.openEditWidget(widget);
4750
4821
  }