@schneideress/dashboardframework 0.0.250 → 0.0.251

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.
@@ -302,7 +302,7 @@ let RADashboardResponsiveService = class RADashboardResponsiveService {
302
302
  check = true;
303
303
  return check;
304
304
  }
305
- getGridsterConfig(isWidgetMgmnt) {
305
+ getGridsterConfig(isWidgetMgmnt, resize, canMove) {
306
306
  let config = GridsterConfigDefaultSettings;
307
307
  config.minCols = this.currentResInfo.maxCols;
308
308
  config.maxCols = this.currentResInfo.maxCols;
@@ -324,6 +324,13 @@ let RADashboardResponsiveService = class RADashboardResponsiveService {
324
324
  config.swap = true;
325
325
  config.draggable.enabled = true;
326
326
  }
327
+ if (!resize) {
328
+ config.resizable.enabled = false;
329
+ config.swap = false;
330
+ }
331
+ if (!canMove) {
332
+ config.draggable.enabled = false;
333
+ }
327
334
  return config;
328
335
  }
329
336
  /**To map IwidgetInfo object to gridsterItem */
@@ -331,6 +338,9 @@ let RADashboardResponsiveService = class RADashboardResponsiveService {
331
338
  if (widget.widgetSettings) {
332
339
  widget.settings = JSON.parse(widget.widgetSettings);
333
340
  }
341
+ if (widget.templateSettings) {
342
+ widget.templateSettings = JSON.parse(widget.templateSettings);
343
+ }
334
344
  let gridsterItem = {
335
345
  cols: this.getWidth(widget.width),
336
346
  rows: this.getHeight(widget.height),
@@ -442,27 +452,30 @@ let RADashboardArea = class RADashboardArea {
442
452
  this.isWidgetLoaded = true;
443
453
  this.loadWidgets(this.userDashboardId, this.areaKey);
444
454
  }
455
+ this.initiateGridsterConfig();
445
456
  if (changes.raDashboardEventBus && changes.raDashboardEventBus.currentValue != changes.raDashboardEventBus.previousValue) {
446
457
  this.inititateEventBusSubscritions();
447
458
  }
448
459
  }
449
460
  /**To set GridsterConfig */
450
461
  initiateGridsterConfig() {
451
- /**To override default configuration values to the gridster control */
452
- this.options = this.responsiveService.getGridsterConfig(this.isWidgetMgmnt);
453
- this.options.initCallback = (gridster) => {
454
- if (this.options.api) {
455
- this.gridcellHeight = this.options.api.getCurrentRowHeight();
456
- }
457
- };
458
- this.options.itemChangeCallback = (item) => {
459
- if (this.responsiveService.IsDesktopView) {
460
- if (item.widgetInfo && item.widgetInfo.widgetInstanceId) {
461
- this.updateWidgetPosition(item.widgetInfo.widgetInstanceId);
462
+ if (this.dashboardInfo) {
463
+ /**To override default configuration values to the gridster control */
464
+ this.options = this.responsiveService.getGridsterConfig(this.isWidgetMgmnt, this.dashboardInfo.templateConfig.widget.canResize, this.dashboardInfo.templateConfig.widget.canMove);
465
+ this.options.initCallback = (gridster) => {
466
+ if (this.options.api) {
467
+ this.gridcellHeight = this.options.api.getCurrentRowHeight();
462
468
  }
463
- }
464
- this.setAreaHeight();
465
- };
469
+ };
470
+ this.options.itemChangeCallback = (item) => {
471
+ if (this.responsiveService.IsDesktopView) {
472
+ if (item.widgetInfo && item.widgetInfo.widgetInstanceId) {
473
+ this.updateWidgetPosition(item.widgetInfo.widgetInstanceId);
474
+ }
475
+ }
476
+ this.setAreaHeight();
477
+ };
478
+ }
466
479
  }
467
480
  /** To initiate eventbus subsctiptions */
468
481
  inititateEventBusSubscritions() {
@@ -850,7 +863,7 @@ RADashboardArea = __decorate([
850
863
  Component({
851
864
  selector: 'ra-dashboard-area',
852
865
  template: "<div #gridWrapper class=\"wrap gridster gridster-mobile\" [ngStyle]=\"{'height': userWidgets.length > 0 ? (gridheight + 'px') : 'unset'}\">\r\n <!-- <div #gridWrapper class=\"wrap gridster\"> -->\r\n <gridster [options]=\"options\" style=\"height:100%;\" *ngIf=\"userWidgets.length > 0\">\r\n <gridster-item [item]=\"item\" *ngFor=\"let item of widgetList\">\r\n <ra-widget-container [dashboard-info]=\"dashboardInfo\" [app-config]=\"appConfig\" [event-bus]=\"raDashboardEventBus\"\r\n (widgetDeleted)=\"deleteWidget($event)\" [data]=\"item\" [global-filter]=\"globalFilter\"\r\n [grid-cell-height]=\"gridcellHeight\" *ngIf=\"gridcellHeight && gridcellHeight > 0\" [widget-width]=\"item.cols\"\r\n [widget-height]=\"item.rows\" [widget-instance-id]=\"item.widgetInstanceId\" [dom-resized]=\"domResized\"\r\n (updateAppliedFilters)=\"updateAppliedFilters($event)\">\r\n </ra-widget-container>\r\n </gridster-item>\r\n </gridster>\r\n\r\n <div class=\"empty-padding kiosk-hide\" *ngIf=\"showEmptyDashboard\">\r\n <div class=\"empty-wrapper\">\r\n <div></div>\r\n <div class=\"m-1 empty-prefix\">\r\n <i class=\"fal fa-edit edit-icon\"></i>\r\n <span class=\"empty-title\">{{'dashboard.emptydashboard'|translate}}</span>\r\n </div>\r\n <div class=\"empty-content light\">\r\n <div>\r\n <div class=\"col-sm-12 empty-msg\">\r\n {{'dashboard.emptydashboardmessage'|translate}} <br />\r\n {{'dashboard.emptydashboardmessage2'|translate}}\r\n </div>\r\n <button *ngIf=\"isWidgetMgmnt\" class=\"btn btnLib btn-sm m-1 dashboard-button light\" (click)=\"addNewWidget()\">\r\n <i class=\"fal fa-plus m-1\"></i>{{'dashboard.addawidgets'|translate}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <notifier-container></notifier-container>\r\n</div>",
853
- styles: ["gridster{width:inherit;resize:height;display:flex;background-color:#fff;overflow-y:hidden!important}.dvheader{width:100%;height:35px;background:#000;color:#fff;padding:7px 3px 5px 6px;text-transform:uppercase}gridster-item{box-sizing:border-box;z-index:1;position:absolute;overflow:hidden;transition:.3s;display:none;background:#fff;-webkit-user-select:text;-moz-user-select:text;user-select:text;box-shadow:0 1px 10px rgba(0,0,0,.05)}gridster-item:hover{box-shadow:0 1px 10px rgba(0,0,0,.15)}@media screen and (max-width:685px){.gridster-mobile{height:auto!important;margin-bottom:50px!important}}@media screen and (max-width:350px){.gridster-mobile{min-height:330px!important;margin-bottom:0!important}}.empty-padding{padding:40px 20px 20px;background-color:#ededed;display:flex;justify-content:center;align-content:center}.empty-wrapper{display:flex;background-color:#fff;border-radius:8px;min-height:125px;width:72%}.empty-prefix{color:#32ad3c;font-size:18px;display:flex;align-items:center;padding:10px 30px;min-width:-webkit-max-content;min-width:max-content;min-width:-moz-max-content}.empty-content{color:#333;border-left:1px solid #a9afb1;width:100%;display:flex;align-items:center;padding:15px 30px 10px 40px}.empty-msg{padding:0 0 5px;font-size:16px}.dashboard-button{padding:5px 10px 5px 5px!important}.btnLib{background-color:#ededed;color:#333!important}.btn-group-sm>.btn,.btn-sm{padding:5px 20px 5px 5px}.edit-icon{color:#32ad3c;font-size:24px;margin-right:15px}.empty-title{margin-top:10px}@media screen and (max-width:600px){.empty-padding{padding:10px;background-color:#ededed;width:100%;display:block}.empty-wrapper{display:flex;background-color:#fff;border-radius:8px;min-height:125px;width:100%}.empty-prefix{color:#32ad3c;font-size:16px;display:flex;height:40px;padding:6px 10px 8px}.empty-content{color:#333;display:flex;padding:5px 10px 10px;margin-top:44px;margin-left:-185px;border-left:none}.empty-msg{padding:12px 10px 10px 5px;font-size:14px;border-top:1px solid #a9afb1}.edit-icon{color:#32ad3c;font-size:20px;margin-right:6px}.empty-title{margin-top:6px}}"]
866
+ styles: ["gridster{width:inherit;resize:height;display:flex;background-color:#fff;overflow-y:hidden!important}.dvheader{width:100%;height:35px;background:#000;color:#fff;padding:7px 3px 5px 6px;text-transform:uppercase}gridster-item{box-sizing:border-box;z-index:1;position:absolute;overflow:hidden;transition:.3s;display:none;background:#fff;-webkit-user-select:text;-moz-user-select:text;user-select:text;box-shadow:0 1px 10px rgba(0,0,0,.05)}gridster-item:hover{box-shadow:0 1px 10px rgba(0,0,0,.15)}@media screen and (max-width:685px){.gridster-mobile{height:auto!important;margin-bottom:50px!important}}@media screen and (max-width:350px){.gridster-mobile{min-height:330px!important;margin-bottom:0!important}}.empty-padding{padding:40px 20px 20px;background-color:#fff;display:flex;justify-content:center;align-content:center}.empty-wrapper{display:flex;background-color:#fff;border-radius:8px;min-height:125px;width:72%}.empty-prefix{color:#32ad3c;font-size:18px;display:flex;align-items:center;padding:10px 30px;min-width:-webkit-max-content;min-width:max-content;min-width:-moz-max-content}.empty-content{color:#333;border-left:1px solid #a9afb1;width:100%;display:flex;align-items:center;padding:15px 30px 10px 40px}.empty-msg{padding:0 0 5px;font-size:16px}.dashboard-button{padding:5px 10px 5px 5px!important}.btnLib{background-color:#ededed;color:#333!important}.btn-group-sm>.btn,.btn-sm{padding:5px 20px 5px 5px}.edit-icon{color:#32ad3c;font-size:24px;margin-right:15px}.empty-title{margin-top:10px}@media screen and (max-width:600px){.empty-padding{padding:10px;background-color:#fff;width:100%;display:block}.empty-wrapper{display:flex;background-color:#fff;border-radius:8px;min-height:125px;width:100%}.empty-prefix{color:#32ad3c;font-size:16px;display:flex;height:40px;padding:6px 10px 8px}.empty-content{color:#333;display:flex;padding:5px 10px 10px;margin-top:44px;margin-left:-185px;border-left:none}.empty-msg{padding:12px 10px 10px 5px;font-size:14px;border-top:1px solid #a9afb1}.edit-icon{color:#32ad3c;font-size:20px;margin-right:6px}.empty-title{margin-top:6px}}"]
854
867
  }),
855
868
  __metadata("design:paramtypes", [RaDashboardService,
856
869
  NgZone,
@@ -1491,9 +1504,12 @@ let RAWidgetContainer = class RAWidgetContainer {
1491
1504
  let html = '<div id="ra-db-widget-menu"' + 'style="' + style + '" class="download-content dropdown-content widget-config-item dropdown-click" style="z-index: 1002;">';
1492
1505
  let settings = '';
1493
1506
  if (this.isWidgetMgmnt) {
1494
- settings += this.getHtmlForButton('wcEditWidget', 'fal fa-edit', this.editText);
1495
- settings += this.getHtmlForButton('wcCopyWidget', 'fal fa-copy', this.copyText);
1496
- settings += this.getHtmlForButton('wcMoveWidget', 'fal fa-arrows-alt', this.moveText);
1507
+ if (!this.data.widgetInfo.templateSettings.hideEdit)
1508
+ settings += this.getHtmlForButton('wcEditWidget', 'fal fa-edit', this.editText);
1509
+ if (!this.data.widgetInfo.templateSettings.hideCopy)
1510
+ settings += this.getHtmlForButton('wcCopyWidget', 'fal fa-copy', this.copyText);
1511
+ if (!this.data.widgetInfo.templateSettings.hideMove)
1512
+ settings += this.getHtmlForButton('wcMoveWidget', 'fal fa-arrows-alt', this.moveText);
1497
1513
  }
1498
1514
  let customPageParams = false;
1499
1515
  if (this.data.widgetInfo && this.data.widgetInfo.widgetSettings) {
@@ -1502,14 +1518,14 @@ let RAWidgetContainer = class RAWidgetContainer {
1502
1518
  customPageParams = true;
1503
1519
  }
1504
1520
  }
1505
- if ((this.detailPageUrl || customPageParams) && this.checkVisitLinkVisiblity()) {
1521
+ if (!this.data.widgetInfo.templateSettings.hideVisitPage && (this.detailPageUrl || customPageParams) && this.checkVisitLinkVisiblity()) {
1506
1522
  settings += '<a style="max-height: 30px;align-items: center;align-content: center; display: flex;" id="wcVisitWidget">';
1507
1523
  settings += '<i style="padding-left: 4px;font-size: 27px !important;" class="fal fa-angle-right"></i> ';
1508
1524
  settings += '<span style="padding-left: 11px;margin-top: 2px;" style="padding-left: 6px;">';
1509
1525
  settings += this.translateService.translate('Common.visitpage');
1510
1526
  settings += '</span></a>';
1511
1527
  }
1512
- if ((this.detailPageUrl && this.checkVisitLinkVisiblity()) || this.isWidgetMgmnt) {
1528
+ if (!this.data.widgetInfo.templateSettings.hideVisitPage && (this.detailPageUrl && this.checkVisitLinkVisiblity()) || this.isWidgetMgmnt) {
1513
1529
  html += '<div style="color: #9FA0A4;font-size: 12px;padding-top: 8px;padding-left: 12px;">';
1514
1530
  html += this.translateService.translate('Common.settings') + '</div>';
1515
1531
  html += settings;
@@ -1541,7 +1557,7 @@ let RAWidgetContainer = class RAWidgetContainer {
1541
1557
  if (this.isDownloadIconVisible && this.isWidgetMgmnt && this.showExcell) {
1542
1558
  html += this.getHr();
1543
1559
  }
1544
- if (this.isWidgetMgmnt) {
1560
+ if (this.isWidgetMgmnt && !this.data.widgetInfo.templateSettings.hideDelete) {
1545
1561
  html += '<a id="wcWidgetDelete"><i class="fal fa-times" style="padding-left: 3px;color: red;"></i><span>';
1546
1562
  html += this.deleteText;
1547
1563
  html += '</span></a>';