@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.
- package/bundles/schneideress-dashboardframework.umd.js +92 -21
- package/bundles/schneideress-dashboardframework.umd.js.map +1 -1
- package/bundles/schneideress-dashboardframework.umd.min.js +1 -1
- package/bundles/schneideress-dashboardframework.umd.min.js.map +1 -1
- package/esm2015/lib/ra-dashboard-area/ra.dashboard.area.js +82 -20
- package/esm2015/lib/ra.event.enum.js +5 -1
- package/esm5/lib/ra-dashboard-area/ra.dashboard.area.js +99 -22
- package/esm5/lib/ra.event.enum.js +5 -1
- package/fesm2015/schneideress-dashboardframework.js +75 -19
- package/fesm2015/schneideress-dashboardframework.js.map +1 -1
- package/fesm5/schneideress-dashboardframework.js +92 -21
- package/fesm5/schneideress-dashboardframework.js.map +1 -1
- package/lib/ra-dashboard-area/ra.dashboard.area.d.ts +9 -2
- package/lib/ra.event.enum.d.ts +5 -1
- package/package.json +1 -1
- package/schneideress-dashboardframework.metadata.json +1 -1
|
@@ -245,6 +245,10 @@ const RAEvent = {
|
|
|
245
245
|
CopyWidget: "CopyWidget",
|
|
246
246
|
/**triggers when user clicks on Move widget */
|
|
247
247
|
MoveWidget: "MoveWidget",
|
|
248
|
+
/**triggers when user raise delete widget event */
|
|
249
|
+
WidgetDelete: "WidgetDelete",
|
|
250
|
+
/** used to add widget to widgetlist when user copies a widget to current dashboard */
|
|
251
|
+
AddWidget: "AddWidget",
|
|
248
252
|
};
|
|
249
253
|
/** @enum {string} */
|
|
250
254
|
const RAEventKey = {
|
|
@@ -372,6 +376,17 @@ class RADashboardArea {
|
|
|
372
376
|
ngOnInit() {
|
|
373
377
|
this.initiateGridsterConfig();
|
|
374
378
|
}
|
|
379
|
+
/**
|
|
380
|
+
* @param {?} changes
|
|
381
|
+
* @return {?}
|
|
382
|
+
*/
|
|
383
|
+
ngOnChanges(changes) {
|
|
384
|
+
if (this.raDashboardEventBus && this.userDashboardId && this.areaKey) {
|
|
385
|
+
this.initiateGridsterConfig();
|
|
386
|
+
this.loadWidgets(this.userDashboardId, this.areaKey);
|
|
387
|
+
this.inititateEventBusSubscritions();
|
|
388
|
+
}
|
|
389
|
+
}
|
|
375
390
|
/**
|
|
376
391
|
* To set GridsterConfig
|
|
377
392
|
* @return {?}
|
|
@@ -391,36 +406,57 @@ class RADashboardArea {
|
|
|
391
406
|
});
|
|
392
407
|
}
|
|
393
408
|
/**
|
|
394
|
-
*
|
|
409
|
+
* To initiate eventbus subsctiptions
|
|
395
410
|
* @return {?}
|
|
396
411
|
*/
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
412
|
+
inititateEventBusSubscritions() {
|
|
413
|
+
this.widgetDeleteEvent = this.raDashboardEventBus.subscribe(RAEvent.WidgetDelete).subscribe((/**
|
|
414
|
+
* @param {?} instanceId
|
|
415
|
+
* @return {?}
|
|
416
|
+
*/
|
|
417
|
+
(instanceId) => {
|
|
418
|
+
this.ngZone.run((/**
|
|
401
419
|
* @return {?}
|
|
402
420
|
*/
|
|
403
|
-
(
|
|
404
|
-
this.
|
|
405
|
-
* @return {?}
|
|
406
|
-
*/
|
|
407
|
-
() => {
|
|
408
|
-
this.addWidget(e);
|
|
409
|
-
}));
|
|
421
|
+
() => {
|
|
422
|
+
this.deleteWidget(instanceId, true);
|
|
410
423
|
}));
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
424
|
+
}));
|
|
425
|
+
this.widgetAddEvent = this.raDashboardEventBus.subscribe(RAEvent.AddWidget).subscribe((/**
|
|
426
|
+
* @param {?} widgetInfo
|
|
427
|
+
* @return {?}
|
|
428
|
+
*/
|
|
429
|
+
(widgetInfo) => {
|
|
430
|
+
this.ngZone.run((/**
|
|
431
|
+
* @return {?}
|
|
432
|
+
*/
|
|
433
|
+
() => {
|
|
434
|
+
this.copyWidget(widgetInfo);
|
|
435
|
+
}));
|
|
436
|
+
}));
|
|
437
|
+
this.conifgAddClick = this.raDashboardEventBus.subscribe(RAEvent.ConfigAddClick).subscribe((/**
|
|
438
|
+
* @param {?} e
|
|
439
|
+
* @return {?}
|
|
440
|
+
*/
|
|
441
|
+
(e) => {
|
|
442
|
+
this.ngZone.run((/**
|
|
443
|
+
* @return {?}
|
|
444
|
+
*/
|
|
445
|
+
() => {
|
|
446
|
+
this.addWidget(e);
|
|
447
|
+
}));
|
|
448
|
+
}));
|
|
416
449
|
}
|
|
417
450
|
/**
|
|
418
451
|
* @return {?}
|
|
419
452
|
*/
|
|
420
453
|
ngOnDestroy() {
|
|
421
454
|
this.conifgAddClick.unsubscribe();
|
|
455
|
+
this.widgetAddEvent.unsubscribe();
|
|
456
|
+
this.widgetDeleteEvent.unsubscribe();
|
|
422
457
|
}
|
|
423
458
|
/**
|
|
459
|
+
* To update position/dimention of all widgets in the area
|
|
424
460
|
* @return {?}
|
|
425
461
|
*/
|
|
426
462
|
updateWidgets() {
|
|
@@ -493,9 +529,10 @@ class RADashboardArea {
|
|
|
493
529
|
/**
|
|
494
530
|
* To remove a widget instance from dashboard and to save info in database
|
|
495
531
|
* @param {?} widgetInstanceId
|
|
532
|
+
* @param {?=} isalertDisabled
|
|
496
533
|
* @return {?}
|
|
497
534
|
*/
|
|
498
|
-
deleteWidget(widgetInstanceId) {
|
|
535
|
+
deleteWidget(widgetInstanceId, isalertDisabled = false) {
|
|
499
536
|
/** @type {?} */
|
|
500
537
|
let widget = this.widgetList.filter((/**
|
|
501
538
|
* @param {?} item
|
|
@@ -507,7 +544,9 @@ class RADashboardArea {
|
|
|
507
544
|
if (widget.length > 0) {
|
|
508
545
|
this.widgetList.splice(this.widgetList.indexOf(widget[0]), 1);
|
|
509
546
|
this.setAreaHeight();
|
|
510
|
-
|
|
547
|
+
if (!isalertDisabled) {
|
|
548
|
+
this.notifier.notify('success', "Widget (" + widget[0].widgetInfo.widgetTitle + ") deleted successfully!");
|
|
549
|
+
}
|
|
511
550
|
}
|
|
512
551
|
}
|
|
513
552
|
/**
|
|
@@ -544,6 +583,23 @@ class RADashboardArea {
|
|
|
544
583
|
//this.ngxService.stop();
|
|
545
584
|
}));
|
|
546
585
|
}
|
|
586
|
+
/**
|
|
587
|
+
* To add widget to current widget list ,invoked from copy widget window
|
|
588
|
+
* @param {?} data
|
|
589
|
+
* @return {?}
|
|
590
|
+
*/
|
|
591
|
+
copyWidget(data) {
|
|
592
|
+
/** @type {?} */
|
|
593
|
+
let gridsterItem = this.mapObjectsToGridsterItem(data);
|
|
594
|
+
if (this.options.api) {
|
|
595
|
+
gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
|
|
596
|
+
}
|
|
597
|
+
data.position_x = gridsterItem.x;
|
|
598
|
+
data.position_y = gridsterItem.y;
|
|
599
|
+
gridsterItem = this.mapObjectsToGridsterItem(data);
|
|
600
|
+
this.widgetList.push(gridsterItem);
|
|
601
|
+
this.setAreaHeight();
|
|
602
|
+
}
|
|
547
603
|
/**
|
|
548
604
|
* To map IwidgetInfo object to gridsterItem
|
|
549
605
|
* @param {?} widget
|