@yomotech/view-toolkit 0.0.18 → 0.0.19

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.
@@ -1693,6 +1693,7 @@ class HeaderMenuComponent {
1693
1693
  platform;
1694
1694
  isLogined = false;
1695
1695
  headerItems = [];
1696
+ headerLayout = {};
1696
1697
  environment;
1697
1698
  projectSeleted;
1698
1699
  cartInfo = {
@@ -1715,7 +1716,7 @@ class HeaderMenuComponent {
1715
1716
  if (this.platform.ANDROID || this.platform.IOS) {
1716
1717
  this.utilityService.getLocalStorage(`loginedUser`).then((logined) => {
1717
1718
  if (logined && logined.token) {
1718
- this.requestService.getLoginUser(logined?.token).subscribe((userInfo) => {
1719
+ this.requestService.getLoginUser(logined?.token).subscribe(() => {
1719
1720
  this.isLogined = true;
1720
1721
  });
1721
1722
  }
@@ -1729,6 +1730,28 @@ class HeaderMenuComponent {
1729
1730
  }
1730
1731
  }, 500);
1731
1732
  }
1733
+ getStyle(styleObject) {
1734
+ if (!styleObject || typeof styleObject !== 'object') {
1735
+ return {};
1736
+ }
1737
+ const { classes, ...styleWithoutClasses } = styleObject;
1738
+ return styleWithoutClasses;
1739
+ }
1740
+ isVisible(header) {
1741
+ return header?.option?.visible !== false;
1742
+ }
1743
+ shouldShowDefaultButton(header) {
1744
+ if (!this.isVisible(header)) {
1745
+ return false;
1746
+ }
1747
+ if (header?.option?.islogin === true) {
1748
+ return this.isLogined;
1749
+ }
1750
+ if (header?.option?.islogin === false) {
1751
+ return !this.isLogined;
1752
+ }
1753
+ return true;
1754
+ }
1732
1755
  invokeSearchedItems(option, search) {
1733
1756
  this.searchItems.emit({ option: option, search: search });
1734
1757
  }
@@ -1739,16 +1762,18 @@ class HeaderMenuComponent {
1739
1762
  this.showTableContent.emit(option);
1740
1763
  }
1741
1764
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HeaderMenuComponent, deps: [{ token: i4$1.OktaAuthStateService }, { token: RequestService }, { token: UtilityService }, { token: i1.Platform }], target: i0.ɵɵFactoryTarget.Component });
1742
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: HeaderMenuComponent, isStandalone: true, selector: "vl-header-menu", inputs: { headerItems: "headerItems", environment: "environment", projectSeleted: "projectSeleted", cartInfo: "cartInfo" }, outputs: { buttonClick: "buttonClick", showTableContent: "showTableContent", searchItems: "searchItems" }, ngImport: i0, template: "<header class=\"header\" *ngIf=\"headerItems.length > 0\">\r\n <div *ngFor=\"let header of headerItems\"\r\n [ngSwitch]=\"header.scope?.reference ? header.scope?.reference.split('/').pop() : 'default'\">\r\n <div *ngSwitchCase=\"'logo'\" [class]=\"header?.option?.visible ? 'logo' : 'hidden'\">\r\n <img [src]=\"header.option.src\" [alt]=\"header.alt\" />\r\n </div>\r\n\r\n <div *ngSwitchCase=\"'searchInput'\" [class]=\"header?.option?.visible ? 'search-box' : 'hidden'\">\r\n <input #search (keyup.enter)=\"invokeSearchedItems(header.option, search)\" type=\"text\"\r\n [placeholder]=\"header.option.placeholder\" />\r\n <button *ngIf=\"header.option.button !== false\" (click)=\"invokeSearchedItems(header.option, search)\">\r\n <ng-container *ngIf=\"!header.caption; else textContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ header.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n\r\n <div *ngSwitchCase=\"'cart'\" [class]=\"header?.option?.visible ? 'cart' : 'hidden'\"\r\n (click)=\"invokeShowtableContent(header.option)\">\r\n <span>{{cartInfo.totalPrice | currency : header.option?.currency ? header.option.currency : 'USD'}}</span>\r\n <span>{{cartInfo.quantity}}</span>\r\n <i [class]=\"header.icon\"></i>\r\n </div>\r\n <div *ngSwitchCase=\"'default'\"\r\n [class]=\"header?.option.islogin ? isLogined ? 'header-buttons' : 'hidden' : header?.option.islogin == false ? isLogined ? 'hidden' : 'header-buttons' : 'header-buttons'\">\r\n <button (click)=\"invokeHeaderButtonClick(header.option)\">\r\n <ng-container *ngIf=\"!header.label; else textContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ header.label }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </div>\r\n</header>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i9.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: i5.CurrencyPipe, name: "currency" }] });
1765
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: HeaderMenuComponent, isStandalone: true, selector: "vl-header-menu", inputs: { headerItems: "headerItems", headerLayout: "headerLayout", environment: "environment", projectSeleted: "projectSeleted", cartInfo: "cartInfo" }, outputs: { buttonClick: "buttonClick", showTableContent: "showTableContent", searchItems: "searchItems" }, ngImport: i0, template: "<header *ngIf=\"headerItems.length > 0\" [ngStyle]=\"getStyle(headerLayout?.style)\">\r\n\r\n <ng-container *ngFor=\"let header of headerItems\"\r\n [ngSwitch]=\"header.scope?.reference ? header.scope?.reference.split('/').pop() : 'default'\">\r\n\r\n <!-- Logo -->\r\n <ng-container *ngSwitchCase=\"'logo'\">\r\n <div *ngIf=\"isVisible(header)\" [ngStyle]=\"getStyle(header?.option?.style)\">\r\n\r\n <img [src]=\"header.option.src\" [alt]=\"header.alt || 'Logo'\"\r\n [ngStyle]=\"getStyle(header?.scope?.style)\" />\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Search -->\r\n <ng-container *ngSwitchCase=\"'searchInput'\">\r\n <div *ngIf=\"isVisible(header)\" [ngStyle]=\"getStyle(header?.option?.style)\">\r\n\r\n <input #search type=\"text\" [placeholder]=\"header.option.placeholder\"\r\n (keyup.enter)=\"invokeSearchedItems(header.option, search)\"\r\n [ngStyle]=\"getStyle(header?.scope?.style)\" />\r\n\r\n <button *ngIf=\"header.option.button !== false\" type=\"button\"\r\n (click)=\"invokeSearchedItems(header.option, search)\" [ngStyle]=\"getStyle(header?.buttonStyle)\">\r\n <ng-container *ngIf=\"!header.caption; else searchTextContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n\r\n <ng-template #searchTextContent>\r\n {{ header.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Cart -->\r\n <ng-container *ngSwitchCase=\"'cart'\">\r\n <div *ngIf=\"isVisible(header)\" [ngStyle]=\"getStyle(header?.option?.style)\"\r\n (click)=\"invokeShowtableContent(header.option)\">\r\n\r\n <span [ngStyle]=\"getStyle(header?.priceStyle)\">\r\n {{ cartInfo.totalPrice | currency : header.option?.currency ? header.option.currency : 'USD' }}\r\n </span>\r\n\r\n <span [ngStyle]=\"getStyle(header?.quantityStyle)\">\r\n {{ cartInfo.quantity }}\r\n </span>\r\n\r\n <i [class]=\"header.icon\" [ngStyle]=\"getStyle(header?.iconStyle)\">\r\n </i>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Default Button -->\r\n <ng-container *ngSwitchCase=\"'default'\">\r\n <div *ngIf=\"shouldShowDefaultButton(header)\" [ngStyle]=\"getStyle(header?.option?.style)\">\r\n\r\n <button type=\"button\" (click)=\"invokeHeaderButtonClick(header.option)\"\r\n [ngStyle]=\"getStyle(header?.buttonStyle)\">\r\n <ng-container *ngIf=\"!header.label; else buttonTextContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n\r\n <ng-template #buttonTextContent>\r\n {{ header.label }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </ng-container>\r\n\r\n </ng-container>\r\n</header>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i9.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: i5.CurrencyPipe, name: "currency" }] });
1743
1766
  }
1744
1767
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HeaderMenuComponent, decorators: [{
1745
1768
  type: Component,
1746
1769
  args: [{ standalone: true, imports: [
1747
1770
  CommonModule,
1748
1771
  NzIconModule
1749
- ], selector: 'vl-header-menu', template: "<header class=\"header\" *ngIf=\"headerItems.length > 0\">\r\n <div *ngFor=\"let header of headerItems\"\r\n [ngSwitch]=\"header.scope?.reference ? header.scope?.reference.split('/').pop() : 'default'\">\r\n <div *ngSwitchCase=\"'logo'\" [class]=\"header?.option?.visible ? 'logo' : 'hidden'\">\r\n <img [src]=\"header.option.src\" [alt]=\"header.alt\" />\r\n </div>\r\n\r\n <div *ngSwitchCase=\"'searchInput'\" [class]=\"header?.option?.visible ? 'search-box' : 'hidden'\">\r\n <input #search (keyup.enter)=\"invokeSearchedItems(header.option, search)\" type=\"text\"\r\n [placeholder]=\"header.option.placeholder\" />\r\n <button *ngIf=\"header.option.button !== false\" (click)=\"invokeSearchedItems(header.option, search)\">\r\n <ng-container *ngIf=\"!header.caption; else textContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ header.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n\r\n <div *ngSwitchCase=\"'cart'\" [class]=\"header?.option?.visible ? 'cart' : 'hidden'\"\r\n (click)=\"invokeShowtableContent(header.option)\">\r\n <span>{{cartInfo.totalPrice | currency : header.option?.currency ? header.option.currency : 'USD'}}</span>\r\n <span>{{cartInfo.quantity}}</span>\r\n <i [class]=\"header.icon\"></i>\r\n </div>\r\n <div *ngSwitchCase=\"'default'\"\r\n [class]=\"header?.option.islogin ? isLogined ? 'header-buttons' : 'hidden' : header?.option.islogin == false ? isLogined ? 'hidden' : 'header-buttons' : 'header-buttons'\">\r\n <button (click)=\"invokeHeaderButtonClick(header.option)\">\r\n <ng-container *ngIf=\"!header.label; else textContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ header.label }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </div>\r\n</header>" }]
1772
+ ], selector: 'vl-header-menu', template: "<header *ngIf=\"headerItems.length > 0\" [ngStyle]=\"getStyle(headerLayout?.style)\">\r\n\r\n <ng-container *ngFor=\"let header of headerItems\"\r\n [ngSwitch]=\"header.scope?.reference ? header.scope?.reference.split('/').pop() : 'default'\">\r\n\r\n <!-- Logo -->\r\n <ng-container *ngSwitchCase=\"'logo'\">\r\n <div *ngIf=\"isVisible(header)\" [ngStyle]=\"getStyle(header?.option?.style)\">\r\n\r\n <img [src]=\"header.option.src\" [alt]=\"header.alt || 'Logo'\"\r\n [ngStyle]=\"getStyle(header?.scope?.style)\" />\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Search -->\r\n <ng-container *ngSwitchCase=\"'searchInput'\">\r\n <div *ngIf=\"isVisible(header)\" [ngStyle]=\"getStyle(header?.option?.style)\">\r\n\r\n <input #search type=\"text\" [placeholder]=\"header.option.placeholder\"\r\n (keyup.enter)=\"invokeSearchedItems(header.option, search)\"\r\n [ngStyle]=\"getStyle(header?.scope?.style)\" />\r\n\r\n <button *ngIf=\"header.option.button !== false\" type=\"button\"\r\n (click)=\"invokeSearchedItems(header.option, search)\" [ngStyle]=\"getStyle(header?.buttonStyle)\">\r\n <ng-container *ngIf=\"!header.caption; else searchTextContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n\r\n <ng-template #searchTextContent>\r\n {{ header.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Cart -->\r\n <ng-container *ngSwitchCase=\"'cart'\">\r\n <div *ngIf=\"isVisible(header)\" [ngStyle]=\"getStyle(header?.option?.style)\"\r\n (click)=\"invokeShowtableContent(header.option)\">\r\n\r\n <span [ngStyle]=\"getStyle(header?.priceStyle)\">\r\n {{ cartInfo.totalPrice | currency : header.option?.currency ? header.option.currency : 'USD' }}\r\n </span>\r\n\r\n <span [ngStyle]=\"getStyle(header?.quantityStyle)\">\r\n {{ cartInfo.quantity }}\r\n </span>\r\n\r\n <i [class]=\"header.icon\" [ngStyle]=\"getStyle(header?.iconStyle)\">\r\n </i>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Default Button -->\r\n <ng-container *ngSwitchCase=\"'default'\">\r\n <div *ngIf=\"shouldShowDefaultButton(header)\" [ngStyle]=\"getStyle(header?.option?.style)\">\r\n\r\n <button type=\"button\" (click)=\"invokeHeaderButtonClick(header.option)\"\r\n [ngStyle]=\"getStyle(header?.buttonStyle)\">\r\n <ng-container *ngIf=\"!header.label; else buttonTextContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n\r\n <ng-template #buttonTextContent>\r\n {{ header.label }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </ng-container>\r\n\r\n </ng-container>\r\n</header>" }]
1750
1773
  }], ctorParameters: () => [{ type: i4$1.OktaAuthStateService }, { type: RequestService }, { type: UtilityService }, { type: i1.Platform }], propDecorators: { headerItems: [{
1751
1774
  type: Input
1775
+ }], headerLayout: [{
1776
+ type: Input
1752
1777
  }], environment: [{
1753
1778
  type: Input
1754
1779
  }], projectSeleted: [{