@c8y/ngx-components 1011.0.33 → 1011.0.34

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.
@@ -4050,6 +4050,13 @@
4050
4050
  * <div *c8yOutlet="template"></div>
4051
4051
  * <div *c8yOutlet="DeviceStatusComponent; properties: { node }"></div>
4052
4052
  * <div *c8yOutlet="nodes"></div>
4053
+ *
4054
+ *
4055
+ * note: If template is instance of HTMLElement (for example, node compiled by angularJS) then there can be
4056
+ * only single instance rendered, as only one instance of HTMLElement can exist in DOM.
4057
+ * If there is need for displaying same element multiple times, please make sure to inject into
4058
+ * this element createCopy function, which should return another instance of given element.
4059
+ *
4053
4060
  */
4054
4061
  var OutletDirective = /** @class */ (function () {
4055
4062
  function OutletDirective(viewContainer, resolver, renderer, el) {
@@ -4083,7 +4090,17 @@
4083
4090
  else if (template instanceof Element) {
4084
4091
  var parent = this.renderer.parentNode(this.el.nativeElement);
4085
4092
  this.destroy();
4086
- this._element = template;
4093
+ /**
4094
+ * Because compiled element can be used only once, we need to create copy of it
4095
+ * in order to display it in multiple locations.
4096
+ * For example standard "More" menu, and its RWD version.
4097
+ */
4098
+ if (template.createCopy) {
4099
+ this._element = template.createCopy();
4100
+ }
4101
+ else {
4102
+ this._element = template;
4103
+ }
4087
4104
  this.renderer.insertBefore(parent, this._element, this.el.nativeElement);
4088
4105
  // case Component -> <div *c8yOutlet="DeviceStatusComponent; properties: { node }"></div>
4089
4106
  }
@@ -4565,24 +4582,45 @@
4565
4582
  /**
4566
4583
  * The current items to display in the ActionBar.
4567
4584
  */
4568
- this.items = [];
4569
- }
4570
- Object.defineProperty(ActionBarComponent.prototype, "hidden", {
4585
+ this.items$ = rxjs.of([]);
4586
+ /**
4587
+ * Provides observable for right action items.
4588
+ */
4589
+ this.right$ = rxjs.of([]);
4590
+ /**
4591
+ * Provides observable for left action items.
4592
+ */
4593
+ this.left$ = rxjs.of([]);
4594
+ /**
4595
+ * Provides observable for more action items.
4596
+ */
4597
+ this.more$ = rxjs.of([]);
4571
4598
  /**
4572
4599
  * Returns true if no items are present and hides the action bar.
4573
4600
  */
4574
- get: function () {
4575
- return !(this.items && this.items.length);
4576
- },
4577
- enumerable: false,
4578
- configurable: true
4579
- });
4580
- /**
4581
- * Returns the items sorted by priority and grouped by the placement passed.
4582
- * @param {placement} Which placement should be returned sorted.
4583
- */
4584
- ActionBarComponent.prototype.getSortedItems = function (placement) {
4585
- return lodashEs.sortBy(lodashEs.filter(this.items, { placement: placement }), this.byPriority);
4601
+ this.hidden$ = rxjs.of(true);
4602
+ /**
4603
+ * Binds hidden property to this component's native element
4604
+ */
4605
+ this.hidden = true;
4606
+ this.destroy$ = new rxjs.Subject();
4607
+ }
4608
+ ActionBarComponent.prototype.ngOnInit = function () {
4609
+ var _this = this;
4610
+ this.right$ = this.items$.pipe(operators.map(function (items) { return lodashEs.filter(items, { placement: 'right' }); }), operators.map(function (items) { return lodashEs.sortBy(items, _this.byPriority); }));
4611
+ this.left$ = this.items$.pipe(operators.map(function (items) { return lodashEs.filter(items, { placement: 'left' }); }), operators.map(function (items) { return lodashEs.sortBy(items, _this.byPriority); }));
4612
+ this.more$ = this.items$.pipe(operators.map(function (items) { return lodashEs.filter(items, { placement: 'more' }); }), operators.map(function (items) { return lodashEs.sortBy(items, _this.byPriority); }));
4613
+ this.hidden$ = this.items$.pipe(operators.map(function (items) {
4614
+ return !(items && items.length);
4615
+ }));
4616
+ this.hidden$
4617
+ .pipe(operators.takeUntil(this.destroy$)).subscribe(function (hidden) {
4618
+ _this.hidden = hidden;
4619
+ });
4620
+ };
4621
+ ActionBarComponent.prototype.ngOnDestroy = function () {
4622
+ this.destroy$.next();
4623
+ this.destroy$.complete();
4586
4624
  };
4587
4625
  ActionBarComponent.prototype.byPriority = function (item) {
4588
4626
  return -item.priority;
@@ -4592,7 +4630,7 @@
4592
4630
  ActionBarComponent.decorators = [
4593
4631
  { type: i0.Component, args: [{
4594
4632
  selector: 'c8y-action-bar',
4595
- template: "<div class=\"navbar-header\">\n <p class=\"text-label-small p-l-16 p-t-8 p-b-8 visible-xs\">\n <span class=\"text-primary\">{{'Action bar' | translate}}</span>\n </p>\n</div>\n\n<div id=\"page-toolbar\" class=\"navbar-collapse\" >\n <ul class=\"nav navbar-nav navbar-left\">\n <ng-container *ngFor=\"let item of getSortedItems('left')\">\n <ng-container *c8yOutlet=\"item.template\"></ng-container>\n </ng-container>\n </ul>\n <ul class=\"nav navbar-nav navbar-right\">\n <ng-container *ngFor=\"let item of getSortedItems('right')\">\n <ng-container *c8yOutlet=\"item.template\"></ng-container>\n </ng-container>\n <li class=\"no-remove more-wrapper\" *ngIf=\"getSortedItems('more').length > 0\">\n <div class=\"dropdown\" dropdown>\n <button\n title=\"{{ 'More' | translate }}\u2026\"\n class=\"dropdown-toggle c8y-dropdown d-flex\"\n dropdownToggle\n aria-haspopup=\"true\"\n aria-expanded=\"false\"\n >\n <span class=\"text-truncate\" translate>More\u2026</span>\n <i [c8yIcon]=\"'caret-down'\"></i>\n </button>\n <ul class=\"dropdown-menu dropdown-menu-right\" *dropdownMenu>\n <ng-container *ngFor=\"let item of getSortedItems('more')\">\n <ng-container *c8yOutlet=\"item.template\"></ng-container>\n </ng-container>\n </ul>\n <ul class=\"dropdown-menu visible-xs\"> \n <ng-container *ngFor=\"let item of getSortedItems('more')\">\n <ng-container *c8yOutlet=\"item.template\"></ng-container>\n </ng-container>\n </ul>\n </div>\n </li>\n </ul>\n</div>\n",
4633
+ template: "<div class=\"navbar-header\">\n <p class=\"text-label-small p-l-16 p-t-8 p-b-8 visible-xs\">\n <span class=\"text-primary\">{{ 'Action bar' | translate }}</span>\n </p>\n</div>\n\n<div id=\"page-toolbar\" class=\"navbar-collapse\">\n <ul class=\"nav navbar-nav navbar-left\">\n <ng-container *ngFor=\"let item of left$ | async\">\n <ng-container *c8yOutlet=\"item.template\"></ng-container>\n </ng-container>\n </ul>\n <ul class=\"nav navbar-nav navbar-right\">\n <ng-container *ngFor=\"let item of right$ | async\">\n <ng-container *c8yOutlet=\"item.template\"></ng-container>\n </ng-container>\n <li class=\"no-remove more-wrapper\" *ngIf=\"(more$ | async).length > 0\">\n <div class=\"dropdown\" dropdown>\n <button\n title=\"{{ 'More' | translate }}\u2026\"\n class=\"dropdown-toggle c8y-dropdown d-flex\"\n dropdownToggle\n aria-haspopup=\"true\"\n aria-expanded=\"false\"\n >\n <span class=\"text-truncate\" translate>More\u2026</span>\n <i [c8yIcon]=\"'caret-down'\"></i>\n </button>\n <ul class=\"dropdown-menu dropdown-menu-right hidden-xs\" *dropdownMenu>\n <ng-container *ngFor=\"let item of more$ | async\">\n <ng-container *c8yOutlet=\"item.template\"></ng-container>\n </ng-container>\n </ul>\n <ul class=\"dropdown-menu visible-xs\">\n <ng-container *ngFor=\"let item of more$ | async\">\n <ng-container *c8yOutlet=\"item.template\"></ng-container>\n </ng-container>\n </ul>\n </div>\n </li>\n </ul>\n</div>\n",
4596
4634
  host: { class: 'c8y-ui-action-bar' }
4597
4635
  },] }
4598
4636
  ];
@@ -4601,7 +4639,7 @@
4601
4639
  hasTabs: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.has-tabs',] }],
4602
4640
  isTabsHorizontal: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.horizontal-tabs',] }],
4603
4641
  uiActionBar: [{ type: i0.HostBinding, args: ['class.c8y-ui-action-bar',] }],
4604
- items: [{ type: i0.Input }],
4642
+ items$: [{ type: i0.Input }],
4605
4643
  hidden: [{ type: i0.HostBinding }]
4606
4644
  };
4607
4645
 
@@ -6171,7 +6209,7 @@
6171
6209
  BootstrapComponent.decorators = [
6172
6210
  { type: i0.Component, args: [{
6173
6211
  selector: 'c8y-bootstrap',
6174
- template: "<c8y-login *ngIf=\"!(ui.currentUser | async)\"></c8y-login>\n\n<div *ngIf=\"ui.currentUser | async\" [class.head-open]=\"headerService.headerOpen\">\n <c8y-header-bar #header></c8y-header-bar>\n <c8y-navigator-outlet\n [nodes]=\"navigator.items$ | async\"\n [open]=\"headerService.navigatorOpen$ | async\"\n >\n <header class=\"title navigator-slot-top\">\n <div class=\"tenant-brand\"></div>\n <c8y-app-icon\n [name]=\"(ui.state$ | async).app.name\"\n [contextPath]=\"(ui.state$ | async).app.contextPath\"\n ></c8y-app-icon>\n <span>{{ (ui.state$ | async).app | humanizeAppName | async }}</span>\n </header>\n <div class=\"powered-by navigator-slot-bottom\" *ngIf=\"showPoweredBy\">\n <p translate>powered by Cumulocity</p>\n </div>\n </c8y-navigator-outlet>\n\n <div class=\"alerts\">\n <c8y-alert-outlet></c8y-alert-outlet>\n </div>\n <c8y-tabs-outlet\n #tabsComponent\n [tabs]=\"tabs.items$ | async\"\n [navigatorOpen]=\"headerService.navigatorOpen$ | async\"\n [orientation]=\"tabs.orientation$ | async\"\n >\n </c8y-tabs-outlet>\n <c8y-action-bar\n #actionBarComponent\n [navigatorOpen]=\"headerService.navigatorOpen$ | async\"\n [hasTabs]=\"tabsComponent.hasTabs\"\n [isTabsHorizontal]=\"tabsComponent.isHorizontal\"\n [items]=\"actionBar.items$ | async\"\n >\n </c8y-action-bar>\n\n <div\n class=\"mcontainer\"\n [ngClass]=\"{\n open: headerService.navigatorOpen$ | async,\n 'no-apps-margin': noAppsMargin$ | async,\n 'horizontal-tabs': tabsComponent.isHorizontal,\n 'vertical-tabs': !tabsComponent.isHorizontal,\n 'has-tabs': tabsComponent.hasTabs,\n 'has-action-bar': !actionBarComponent.hidden\n }\"\n >\n <div class=\"container-fluid\">\n <router-outlet></router-outlet>\n <ng-content select=\"#c8y-legacy-view\"></ng-content>\n <!-- legacy ng-view, will not be migrated atm -->\n </div>\n </div>\n</div>\n<c8y-cookie-banner></c8y-cookie-banner>\n"
6212
+ template: "<c8y-login *ngIf=\"!(ui.currentUser | async)\"></c8y-login>\n\n<div *ngIf=\"ui.currentUser | async\" [class.head-open]=\"headerService.headerOpen\">\n <c8y-header-bar #header></c8y-header-bar>\n <c8y-navigator-outlet\n [nodes]=\"navigator.items$ | async\"\n [open]=\"headerService.navigatorOpen$ | async\"\n >\n <header class=\"title navigator-slot-top\">\n <div class=\"tenant-brand\"></div>\n <c8y-app-icon\n [name]=\"(ui.state$ | async).app.name\"\n [contextPath]=\"(ui.state$ | async).app.contextPath\"\n ></c8y-app-icon>\n <span>{{ (ui.state$ | async).app | humanizeAppName | async }}</span>\n </header>\n <div class=\"powered-by navigator-slot-bottom\" *ngIf=\"showPoweredBy\">\n <p translate>powered by Cumulocity</p>\n </div>\n </c8y-navigator-outlet>\n\n <div class=\"alerts\">\n <c8y-alert-outlet></c8y-alert-outlet>\n </div>\n <c8y-tabs-outlet\n #tabsComponent\n [tabs]=\"tabs.items$ | async\"\n [navigatorOpen]=\"headerService.navigatorOpen$ | async\"\n [orientation]=\"tabs.orientation$ | async\"\n >\n </c8y-tabs-outlet>\n <c8y-action-bar\n #actionBarComponent\n [navigatorOpen]=\"headerService.navigatorOpen$ | async\"\n [hasTabs]=\"tabsComponent.hasTabs\"\n [isTabsHorizontal]=\"tabsComponent.isHorizontal\"\n [items$]=\"actionBar.items$\"\n >\n </c8y-action-bar>\n\n <div\n class=\"mcontainer\"\n [ngClass]=\"{\n open: headerService.navigatorOpen$ | async,\n 'no-apps-margin': noAppsMargin$ | async,\n 'horizontal-tabs': tabsComponent.isHorizontal,\n 'vertical-tabs': !tabsComponent.isHorizontal,\n 'has-tabs': tabsComponent.hasTabs,\n 'has-action-bar': !actionBarComponent.hidden\n }\"\n >\n <div class=\"container-fluid\">\n <router-outlet></router-outlet>\n <ng-content select=\"#c8y-legacy-view\"></ng-content>\n <!-- legacy ng-view, will not be migrated atm -->\n </div>\n </div>\n</div>\n<c8y-cookie-banner></c8y-cookie-banner>\n"
6175
6213
  },] }
6176
6214
  ];
6177
6215
  BootstrapComponent.ctorParameters = function () { return [