@seniorsistemas/angular-components 17.7.1 → 17.7.2

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.
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __assign, __extends, __spread, __awaiter, __generator, __param, __values, __rest, __read } from 'tslib';
2
- import { EventEmitter, Input, Output, Component, ContentChildren, ViewChild, HostListener, forwardRef, NgModule, ɵɵdefineInjectable, Injectable, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, Directive, KeyValueDiffers, HostBinding, Renderer2, TemplateRef, InjectionToken, Inject, ViewEncapsulation, ViewContainerRef, ChangeDetectorRef, Pipe, ɵɵinject, Optional, ContentChild } from '@angular/core';
2
+ import { EventEmitter, Input, Output, Component, ContentChildren, ViewChild, HostListener, forwardRef, NgModule, ɵɵdefineInjectable, Injectable, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, Directive, KeyValueDiffers, HostBinding, Renderer2, TemplateRef, InjectionToken, Inject, ViewEncapsulation, ViewContainerRef, ChangeDetectorRef, Pipe, ɵɵinject, Optional, ContentChild, ViewChildren } from '@angular/core';
3
3
  import { trigger, transition, style as style$7, animate, state, group, query, animateChild } from '@angular/animations';
4
4
  import { Subject, of, from, ReplaySubject, throwError, forkJoin } from 'rxjs';
5
5
  import { takeUntil, tap, map, switchMap, catchError, first, filter, take, delay, debounceTime, repeat, finalize } from 'rxjs/operators';
@@ -17164,18 +17164,34 @@ var TimelineItem = /** @class */ (function () {
17164
17164
  }());
17165
17165
 
17166
17166
  var WorkspaceSwitchComponent = /** @class */ (function () {
17167
- function WorkspaceSwitchComponent(eRef) {
17167
+ function WorkspaceSwitchComponent(eRef, changeDetectorRef) {
17168
17168
  this.eRef = eRef;
17169
+ this.changeDetectorRef = changeDetectorRef;
17169
17170
  this.footerButtonLabel = "Adicionar";
17170
17171
  this.showFooterButton = true;
17171
17172
  this.disabled = false;
17172
17173
  this.footerButtonClicked = new EventEmitter();
17173
17174
  this.selected = new EventEmitter();
17174
- this.open = false;
17175
+ this.height = 0;
17175
17176
  this.selectedItemIndex = 0;
17176
17177
  this.currentItemIndex = 0;
17178
+ this._open = false;
17177
17179
  this.tabindex = 0;
17178
17180
  }
17181
+ Object.defineProperty(WorkspaceSwitchComponent.prototype, "open", {
17182
+ get: function () {
17183
+ return this._open;
17184
+ },
17185
+ set: function (open) {
17186
+ this._open = open;
17187
+ this.changeDetectorRef.detectChanges();
17188
+ if (open) {
17189
+ this._calculateListMaxHeight();
17190
+ }
17191
+ },
17192
+ enumerable: true,
17193
+ configurable: true
17194
+ });
17179
17195
  WorkspaceSwitchComponent.prototype.onClickout = function (event) {
17180
17196
  if (!this.eRef.nativeElement.contains(event.target)) {
17181
17197
  this.open = false;
@@ -17199,11 +17215,13 @@ var WorkspaceSwitchComponent = /** @class */ (function () {
17199
17215
  else if (event.key === "ArrowDown") {
17200
17216
  if (this.currentItemIndex < this.workspaces.length - 1) {
17201
17217
  this.currentItemIndex++;
17218
+ this._scrollToCurrentItem();
17202
17219
  }
17203
17220
  }
17204
17221
  else if (event.key === "ArrowUp") {
17205
17222
  if (this.currentItemIndex > 0) {
17206
17223
  this.currentItemIndex--;
17224
+ this._scrollToCurrentItem();
17207
17225
  }
17208
17226
  }
17209
17227
  };
@@ -17234,8 +17252,21 @@ var WorkspaceSwitchComponent = /** @class */ (function () {
17234
17252
  this.open = false;
17235
17253
  this.footerButtonClicked.emit();
17236
17254
  };
17255
+ WorkspaceSwitchComponent.prototype._calculateListMaxHeight = function () {
17256
+ var workspaceListRef = this.eRef.nativeElement.querySelector("#workspace-list");
17257
+ var top = workspaceListRef.getBoundingClientRect().top;
17258
+ this.height = window.innerHeight - top - 20 - (this.showFooterButton ? 64 : 0);
17259
+ this.changeDetectorRef.detectChanges();
17260
+ };
17261
+ WorkspaceSwitchComponent.prototype._scrollToCurrentItem = function () {
17262
+ var currentItem = this.listItems.toArray()[this.currentItemIndex];
17263
+ if (currentItem) {
17264
+ currentItem.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
17265
+ }
17266
+ };
17237
17267
  WorkspaceSwitchComponent.ctorParameters = function () { return [
17238
- { type: ElementRef }
17268
+ { type: ElementRef },
17269
+ { type: ChangeDetectorRef }
17239
17270
  ]; };
17240
17271
  __decorate([
17241
17272
  Input()
@@ -17255,6 +17286,9 @@ var WorkspaceSwitchComponent = /** @class */ (function () {
17255
17286
  __decorate([
17256
17287
  Output()
17257
17288
  ], WorkspaceSwitchComponent.prototype, "selected", void 0);
17289
+ __decorate([
17290
+ ViewChildren('listItem')
17291
+ ], WorkspaceSwitchComponent.prototype, "listItems", void 0);
17258
17292
  __decorate([
17259
17293
  HostBinding("attr.tabindex")
17260
17294
  ], WorkspaceSwitchComponent.prototype, "tabindex", void 0);
@@ -17267,8 +17301,8 @@ var WorkspaceSwitchComponent = /** @class */ (function () {
17267
17301
  WorkspaceSwitchComponent = __decorate([
17268
17302
  Component({
17269
17303
  selector: "s-workspace-switch",
17270
- template: "<div\n class=\"workspace-switch\"\n [ngClass]=\"{ 'workspace-switch--disabled': disabled }\"\n (blur)=\"buttonOnBlur()\">\n <div class=\"button\" (click)=\"open = !open\">\n <div class=\"item\">\n <span class=\"title\">{{ workspaces[selectedItemIndex].title }}</span>\n <span class=\"subtitle\">{{ workspaces[selectedItemIndex].subtitle }}</span>\n </div>\n <div class=\"icons\">\n <span class=\"fas fa-chevron-up\"></span>\n <span class=\"fas fa-chevron-down\"></span>\n </div>\n </div>\n <div *ngIf=\"!disabled && open\" class=\"select\">\n <div\n *ngFor=\"let workspace of workspaces; let i = index\"\n class=\"workspace\"\n [ngClass]=\"{\n 'workspace--focused': i == currentItemIndex && !workspace.disabled,\n 'workspace--disabled': workspace.disabled\n }\"\n (click)=\"onSelectItem(workspace)\">\n <div class=\"item\">\n <span class=\"title\">{{ workspace.title }}</span>\n <span class=\"subtitle\">{{ workspace.subtitle }}</span>\n </div>\n <span *ngIf=\"i === selectedItemIndex\" class=\"active-icon fas fa-check\"></span>\n </div>\n <div *ngIf=\"showFooterButton\" class=\"footer\">\n <div class=\"footer__button\" (click)=\"onFooterButtonClick()\">\n <span class=\"footer__button__icon fas fa-plus\"></span>\n <span class=\"footer__button__title\">{{ footerButtonLabel }}</span>\n </div>\n </div>\n </div>\n</div>",
17271
- styles: [".workspace-switch{border-radius:4px;border:1px solid transparent;width:324px}.workspace-switch .button{-ms-flex-align:center;align-items:center;background-color:#fff;border:none;border-radius:3px;cursor:pointer;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-webkit-user-select:none;-ms-user-select:none;user-select:none;width:100%}.workspace-switch .button .icons{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;margin:0 12px}.workspace-switch .select{background-color:#fff;border-radius:4px;box-shadow:0 1px 5px rgba(0,0,0,.25);cursor:pointer;margin:20px 0;padding-top:4px;position:absolute;width:324px}.workspace-switch .select .workspace{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-webkit-user-select:none;-ms-user-select:none;user-select:none}.workspace-switch .select .workspace .active-icon{color:#7892a1;font-size:12px;margin:0 12px}.workspace-switch .select .workspace--focused{background-color:#f1f7f8}.workspace-switch .select .workspace--disabled .item .subtitle,.workspace-switch .select .workspace--disabled .item .title{color:#c1c1cc}.workspace-switch .select .workspace:hover:not(.workspace--disabled){background-color:#f1f7f8}.workspace-switch .select .footer{border-top:1px solid #ccc;padding:12px}.workspace-switch .select .footer .footer__button{-ms-flex-align:center;align-items:center;border:1px solid #d8d8d8;border-radius:4px;padding:8px 12px;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}.workspace-switch .select .footer .footer__button .footer__button__icon{color:#333;margin-right:8px}.workspace-switch .select .footer .footer__button:active{border:1px solid #428bca}.workspace-switch .item{-ms-flex-align:start;align-items:flex-start;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;padding:12px}.workspace-switch .item .title{color:#333;font-family:\"Open Sans\",sans-serif;font-size:14px;font-weight:700;line-height:150%;text-transform:uppercase}.workspace-switch .item .subtitle{color:#999;font-family:\"Open Sans\",sans-serif;font-size:12px;font-weight:400;line-height:150%}.workspace-switch:focus{border:1px solid #428bca}.workspace-switch--disabled .button{cursor:default}.workspace-switch--disabled .button .icons,.workspace-switch--disabled .item .subtitle,.workspace-switch--disabled .item .title{color:#ccc}"]
17304
+ template: "<div\n class=\"workspace-switch\"\n [ngClass]=\"{ 'workspace-switch--disabled': disabled }\"\n (blur)=\"buttonOnBlur()\">\n <div class=\"button\" (click)=\"open = !open\">\n <div class=\"item\">\n <span class=\"title\">{{ workspaces[selectedItemIndex].title }}</span>\n <span class=\"subtitle\">{{ workspaces[selectedItemIndex].subtitle }}</span>\n </div>\n <div class=\"icons\">\n <span class=\"fas fa-chevron-up\"></span>\n <span class=\"fas fa-chevron-down\"></span>\n </div>\n </div>\n <div *ngIf=\"!disabled && open\" class=\"drop-panel\">\n <ul\n id=\"workspace-list\"\n class=\"workspace-list\"\n [ngStyle]=\"{ 'max-height': height + 'px' }\">\n <li\n #listItem\n *ngFor=\"let workspace of workspaces; let i = index\"\n class=\"workspace\"\n [ngClass]=\"{\n 'workspace--focused': i == currentItemIndex && !workspace.disabled,\n 'workspace--disabled': workspace.disabled\n }\"\n (click)=\"onSelectItem(workspace)\">\n <div class=\"item\">\n <span class=\"title\">{{ workspace.title }}</span>\n <span class=\"subtitle\">{{ workspace.subtitle }}</span>\n </div>\n <span *ngIf=\"i === selectedItemIndex\" class=\"active-icon fas fa-check\"></span>\n </li>\n </ul>\n <div *ngIf=\"showFooterButton\" class=\"footer\">\n <div class=\"footer__button\" (click)=\"onFooterButtonClick()\">\n <span class=\"footer__button__icon fas fa-plus\"></span>\n <span class=\"footer__button__title\">{{ footerButtonLabel }}</span>\n </div>\n </div>\n </div>\n</div>",
17305
+ styles: [".workspace-switch{border-radius:4px;border:1px solid transparent;width:324px}.workspace-switch .button{-ms-flex-align:center;align-items:center;background-color:#fff;border:none;border-radius:3px;cursor:pointer;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-webkit-user-select:none;-ms-user-select:none;user-select:none;width:100%}.workspace-switch .button .icons{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;margin:0 12px}.workspace-switch .drop-panel{background-color:#fff;border-radius:4px;box-shadow:0 1px 5px rgba(0,0,0,.25);cursor:pointer;margin:20px 0;padding-top:4px;position:absolute;width:324px}.workspace-switch .drop-panel .workspace-list{list-style:none;overflow:auto;padding:0}.workspace-switch .drop-panel .workspace-list .workspace{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-webkit-user-select:none;-ms-user-select:none;user-select:none}.workspace-switch .drop-panel .workspace-list .workspace .active-icon{color:#7892a1;font-size:12px;margin:0 12px}.workspace-switch .drop-panel .workspace-list .workspace--focused{background-color:#f1f7f8}.workspace-switch .drop-panel .workspace-list .workspace--disabled .item .subtitle,.workspace-switch .drop-panel .workspace-list .workspace--disabled .item .title{color:#c1c1cc}.workspace-switch .drop-panel .workspace-list .workspace:hover:not(.workspace--disabled){background-color:#f1f7f8}.workspace-switch .drop-panel .footer{border-top:1px solid #ccc;padding:12px}.workspace-switch .drop-panel .footer .footer__button{-ms-flex-align:center;align-items:center;border:1px solid #d8d8d8;border-radius:4px;padding:8px 12px;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}.workspace-switch .drop-panel .footer .footer__button .footer__button__icon{color:#333;margin-right:8px}.workspace-switch .drop-panel .footer .footer__button:active{border:1px solid #428bca}.workspace-switch .item{-ms-flex-align:start;align-items:flex-start;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;padding:12px}.workspace-switch .item .title{color:#333;font-family:\"Open Sans\",sans-serif;font-size:14px;font-weight:700;line-height:150%;text-transform:uppercase}.workspace-switch .item .subtitle{color:#999;font-family:\"Open Sans\",sans-serif;font-size:12px;font-weight:400;line-height:150%}.workspace-switch:focus{border:1px solid #428bca}.workspace-switch--disabled .button{cursor:default}.workspace-switch--disabled .button .icons,.workspace-switch--disabled .item .subtitle,.workspace-switch--disabled .item .title{color:#ccc}"]
17272
17306
  })
17273
17307
  ], WorkspaceSwitchComponent);
17274
17308
  return WorkspaceSwitchComponent;