@schneideress/dashboardframework 0.0.11 → 0.0.12

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.
@@ -360,6 +360,10 @@ var RAEvent = {
360
360
  CopyWidget: "CopyWidget",
361
361
  /**triggers when user clicks on Move widget */
362
362
  MoveWidget: "MoveWidget",
363
+ /**triggers when user raise delete widget event */
364
+ WidgetDelete: "WidgetDelete",
365
+ /** used to add widget to widgetlist when user copies a widget to current dashboard */
366
+ AddWidget: "AddWidget",
363
367
  };
364
368
  /** @enum {string} */
365
369
  var RAEventKey = {
@@ -484,6 +488,21 @@ var RADashboardArea = /** @class */ (function () {
484
488
  function () {
485
489
  this.initiateGridsterConfig();
486
490
  };
491
+ /**
492
+ * @param {?} changes
493
+ * @return {?}
494
+ */
495
+ RADashboardArea.prototype.ngOnChanges = /**
496
+ * @param {?} changes
497
+ * @return {?}
498
+ */
499
+ function (changes) {
500
+ if (this.raDashboardEventBus && this.userDashboardId && this.areaKey) {
501
+ this.initiateGridsterConfig();
502
+ this.loadWidgets(this.userDashboardId, this.areaKey);
503
+ this.inititateEventBusSubscritions();
504
+ }
505
+ };
487
506
  /**To set GridsterConfig */
488
507
  /**
489
508
  * To set GridsterConfig
@@ -507,34 +526,53 @@ var RADashboardArea = /** @class */ (function () {
507
526
  areaContext.updateWidgets();
508
527
  });
509
528
  };
529
+ /** To initiate eventbus subsctiptions */
510
530
  /**
511
- * @param {?} changes
531
+ * To initiate eventbus subsctiptions
512
532
  * @return {?}
513
533
  */
514
- RADashboardArea.prototype.ngOnChanges = /**
515
- * @param {?} changes
534
+ RADashboardArea.prototype.inititateEventBusSubscritions = /**
535
+ * To initiate eventbus subsctiptions
516
536
  * @return {?}
517
537
  */
518
- function (changes) {
538
+ function () {
519
539
  var _this = this;
520
- if (changes.raDashboardEventBus && changes.raDashboardEventBus.currentValue != changes.raDashboardEventBus.previousValue) {
521
- this.conifgAddClick = this.raDashboardEventBus.subscribe(RAEvent.ConfigAddClick).subscribe((/**
522
- * @param {?} e
540
+ this.widgetDeleteEvent = this.raDashboardEventBus.subscribe(RAEvent.WidgetDelete).subscribe((/**
541
+ * @param {?} instanceId
542
+ * @return {?}
543
+ */
544
+ function (instanceId) {
545
+ _this.ngZone.run((/**
523
546
  * @return {?}
524
547
  */
525
- function (e) {
526
- _this.ngZone.run((/**
527
- * @return {?}
528
- */
529
- function () {
530
- _this.addWidget(e);
531
- }));
548
+ function () {
549
+ _this.deleteWidget(instanceId, true);
532
550
  }));
533
- }
534
- if (this.raDashboardEventBus && this.userDashboardId && this.areaKey) {
535
- this.initiateGridsterConfig();
536
- this.loadWidgets(this.userDashboardId, this.areaKey);
537
- }
551
+ }));
552
+ this.widgetAddEvent = this.raDashboardEventBus.subscribe(RAEvent.AddWidget).subscribe((/**
553
+ * @param {?} widgetInfo
554
+ * @return {?}
555
+ */
556
+ function (widgetInfo) {
557
+ _this.ngZone.run((/**
558
+ * @return {?}
559
+ */
560
+ function () {
561
+ _this.copyWidget(widgetInfo);
562
+ }));
563
+ }));
564
+ this.conifgAddClick = this.raDashboardEventBus.subscribe(RAEvent.ConfigAddClick).subscribe((/**
565
+ * @param {?} e
566
+ * @return {?}
567
+ */
568
+ function (e) {
569
+ _this.ngZone.run((/**
570
+ * @return {?}
571
+ */
572
+ function () {
573
+ _this.addWidget(e);
574
+ }));
575
+ }));
538
576
  };
539
577
  /**
540
578
  * @return {?}
@@ -544,11 +582,16 @@ var RADashboardArea = /** @class */ (function () {
544
582
  */
545
583
  function () {
546
584
  this.conifgAddClick.unsubscribe();
585
+ this.widgetAddEvent.unsubscribe();
586
+ this.widgetDeleteEvent.unsubscribe();
547
587
  };
588
+ /**To update position/dimention of all widgets in the area */
548
589
  /**
590
+ * To update position/dimention of all widgets in the area
549
591
  * @return {?}
550
592
  */
551
593
  RADashboardArea.prototype.updateWidgets = /**
594
+ * To update position/dimention of all widgets in the area
552
595
  * @return {?}
553
596
  */
554
597
  function () {
@@ -635,14 +678,17 @@ var RADashboardArea = /** @class */ (function () {
635
678
  /**
636
679
  * To remove a widget instance from dashboard and to save info in database
637
680
  * @param {?} widgetInstanceId
681
+ * @param {?=} isalertDisabled
638
682
  * @return {?}
639
683
  */
640
684
  RADashboardArea.prototype.deleteWidget = /**
641
685
  * To remove a widget instance from dashboard and to save info in database
642
686
  * @param {?} widgetInstanceId
687
+ * @param {?=} isalertDisabled
643
688
  * @return {?}
644
689
  */
645
- function (widgetInstanceId) {
690
+ function (widgetInstanceId, isalertDisabled) {
691
+ if (isalertDisabled === void 0) { isalertDisabled = false; }
646
692
  /** @type {?} */
647
693
  var widget = this.widgetList.filter((/**
648
694
  * @param {?} item
@@ -654,7 +700,9 @@ var RADashboardArea = /** @class */ (function () {
654
700
  if (widget.length > 0) {
655
701
  this.widgetList.splice(this.widgetList.indexOf(widget[0]), 1);
656
702
  this.setAreaHeight();
657
- this.notifier.notify('success', "Widget (" + widget[0].widgetInfo.widgetTitle + ") deleted successfully!");
703
+ if (!isalertDisabled) {
704
+ this.notifier.notify('success', "Widget (" + widget[0].widgetInfo.widgetTitle + ") deleted successfully!");
705
+ }
658
706
  }
659
707
  };
660
708
  /**To add widget instance to the database with the next available position and to make changes in
@@ -701,6 +749,29 @@ var RADashboardArea = /** @class */ (function () {
701
749
  //this.ngxService.stop();
702
750
  }));
703
751
  };
752
+ /** To add widget to current widget list ,invoked from copy widget window*/
753
+ /**
754
+ * To add widget to current widget list ,invoked from copy widget window
755
+ * @param {?} data
756
+ * @return {?}
757
+ */
758
+ RADashboardArea.prototype.copyWidget = /**
759
+ * To add widget to current widget list ,invoked from copy widget window
760
+ * @param {?} data
761
+ * @return {?}
762
+ */
763
+ function (data) {
764
+ /** @type {?} */
765
+ var gridsterItem = this.mapObjectsToGridsterItem(data);
766
+ if (this.options.api) {
767
+ gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
768
+ }
769
+ data.position_x = gridsterItem.x;
770
+ data.position_y = gridsterItem.y;
771
+ gridsterItem = this.mapObjectsToGridsterItem(data);
772
+ this.widgetList.push(gridsterItem);
773
+ this.setAreaHeight();
774
+ };
704
775
  /**To map IwidgetInfo object to gridsterItem */
705
776
  /**
706
777
  * To map IwidgetInfo object to gridsterItem