@gravitee/ui-particles-angular 4.12.0 → 4.13.0

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.
@@ -2517,7 +2517,12 @@
2517
2517
  this.icon = '';
2518
2518
  this.active = false;
2519
2519
  this.outlined = false;
2520
+ this.unsubscribe$ = new rxjs.Subject();
2520
2521
  }
2522
+ GioMenuItemComponent.prototype.ngOnDestroy = function () {
2523
+ this.unsubscribe$.next();
2524
+ this.unsubscribe$.unsubscribe();
2525
+ };
2521
2526
  GioMenuItemComponent.prototype.onMouseLeave = function () {
2522
2527
  if (this.active) {
2523
2528
  this.gioMenuService.overlay({ open: false });
@@ -2525,25 +2530,34 @@
2525
2530
  };
2526
2531
  GioMenuItemComponent.prototype.onMouseEnter = function ($event) {
2527
2532
  if (this.active) {
2528
- var target = $event.target;
2529
- var menuItem = target.closest('.gio-menu-item');
2533
+ var menuItem = $event.target;
2530
2534
  this.gioMenuService.overlay({ open: true, top: menuItem.getBoundingClientRect().top, parent: menuItem });
2531
2535
  }
2532
2536
  };
2533
2537
  GioMenuItemComponent.prototype.onClick = function ($event) {
2534
2538
  var _this = this;
2535
- setTimeout(function () { return _this.onMouseEnter($event); }, 0);
2539
+ rxjs.of(true)
2540
+ .pipe(operators.takeUntil(this.unsubscribe$), operators.delay(0), operators.tap(function () { return _this.onMouseEnter($event); }))
2541
+ .subscribe();
2536
2542
  };
2537
- GioMenuItemComponent.prototype.onKeydownHandler = function (event) {
2538
- var _a;
2539
- if (event.key === ' ' || event.key === 'Enter') {
2540
- (_a = this.gioMenuItem) === null || _a === void 0 ? void 0 : _a.nativeElement.click();
2541
- }
2543
+ GioMenuItemComponent.prototype.onKeydownHandler = function ($event) {
2544
+ var _this = this;
2545
+ rxjs.of($event.key === 'Enter' && $event.target)
2546
+ .pipe(operators.takeUntil(this.unsubscribe$), operators.filter(function (enterKey) { return !!enterKey; }), operators.switchMap(function () { return rxjs.of($event.target); }), operators.tap(function (menuItem) {
2547
+ _this.gioMenuService.overlay({ open: false });
2548
+ if (_this.active) {
2549
+ _this.gioMenuService.overlay({ open: true, top: menuItem.getBoundingClientRect().top, parent: menuItem, focus: true });
2550
+ }
2551
+ else {
2552
+ menuItem.click();
2553
+ }
2554
+ }))
2555
+ .subscribe();
2542
2556
  };
2543
2557
  return GioMenuItemComponent;
2544
2558
  }());
2545
2559
  GioMenuItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: GioMenuItemComponent, deps: [{ token: GioMenuService }], target: i0__namespace.ɵɵFactoryTarget.Component });
2546
- GioMenuItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: GioMenuItemComponent, selector: "gio-menu-item", inputs: { icon: "icon", active: "active", outlined: "outlined" }, host: { listeners: { "click": "onClick($event)", "keydown": "onKeydownHandler($event)" } }, viewQueries: [{ propertyName: "gioMenuItem", first: true, predicate: ["gioMenuItem"], descendants: true }], ngImport: i0__namespace, template: "<!--\n\n Copyright (C) 2022 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<div\n class=\"gio-menu-item\"\n #gioMenuItem\n [class.gio-menu-item__active]=\"active\"\n [class.gio-menu-item__outlined]=\"outlined\"\n (click)=\"onClick($event)\"\n (mouseenter)=\"onMouseEnter($event)\"\n (mouseleave)=\"onMouseLeave()\"\n>\n <mat-icon *ngIf=\"icon\" class=\"gio-menu-item__icon\" [svgIcon]=\"icon\"></mat-icon>\n <span class=\"gio-menu-item__title\"><ng-content></ng-content></span>\n</div>\n", styles: [":host{display:block}.gio-menu-item{display:flex;width:192px;height:36px;flex:none;flex-direction:row;flex-grow:0;align-items:center;padding:16px;margin:4px 0;background:#1c1e39;border-radius:4px;color:#f7f8fd;cursor:pointer}.gio-menu-item__active{background:#494b61}.gio-menu-item__outlined{border:1px solid #606274;border-radius:4px}.gio-menu-item__icon{position:absolute;width:20px;height:20px}.gio-menu-item__title:not(:first-child){margin:18px 0 18px 32px}:host-context(.gio-menu__reduced) .gio-menu-item{width:44px;justify-content:center;padding:0;margin:8px 0}:host-context(.gio-menu__reduced) .gio-menu-item__title{display:none}:host-context(.gio-menu__reduced .gio-menu-footer) .gio-menu-item{margin:20px 0}:host-context(.gio-menu__reduced .gio-menu-footer) .gio-menu-item__outlined{margin:20px 0}.gio-menu-item:hover:not(.gio-menu-item__active){background:#33354d}\n"], components: [{ type: i1__namespace$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i2__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2560
+ GioMenuItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: GioMenuItemComponent, selector: "gio-menu-item", inputs: { icon: "icon", active: "active", outlined: "outlined" }, host: { listeners: { "click": "onClick($event)", "keydown": "onKeydownHandler($event)" } }, ngImport: i0__namespace, template: "<!--\n\n Copyright (C) 2022 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<div\n class=\"gio-menu-item\"\n [class.gio-menu-item__active]=\"active\"\n [class.gio-menu-item__outlined]=\"outlined\"\n (click)=\"onClick($event)\"\n (mouseenter)=\"onMouseEnter($event)\"\n (mouseleave)=\"onMouseLeave()\"\n>\n <mat-icon *ngIf=\"icon\" class=\"gio-menu-item__icon\" [svgIcon]=\"icon\"></mat-icon>\n <span class=\"gio-menu-item__title\"><ng-content></ng-content></span>\n</div>\n", styles: [":host{display:block}.gio-menu-item{display:flex;width:192px;height:36px;flex:none;flex-direction:row;flex-grow:0;align-items:center;padding:16px;margin:4px 0;background:#1c1e39;border-radius:4px;color:#f7f8fd;cursor:pointer}.gio-menu-item__active{background:#494b61}.gio-menu-item__outlined{border:1px solid #606274;border-radius:4px}.gio-menu-item__icon{position:absolute;width:20px;height:20px}.gio-menu-item__title:not(:first-child){margin:18px 0 18px 32px}:host-context(.gio-menu__reduced) .gio-menu-item{width:44px;justify-content:center;padding:0;margin:8px 0}:host-context(.gio-menu__reduced) .gio-menu-item__title{display:none}:host-context(.gio-menu__reduced .gio-menu-footer) .gio-menu-item{margin:20px 0}:host-context(.gio-menu__reduced .gio-menu-footer) .gio-menu-item__outlined{margin:20px 0}.gio-menu-item:hover:not(.gio-menu-item__active){background:#33354d}\n"], components: [{ type: i1__namespace$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i2__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2547
2561
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: GioMenuItemComponent, decorators: [{
2548
2562
  type: i0.Component,
2549
2563
  args: [{
@@ -2557,9 +2571,6 @@
2557
2571
  type: i0.Input
2558
2572
  }], outlined: [{
2559
2573
  type: i0.Input
2560
- }], gioMenuItem: [{
2561
- type: i0.ViewChild,
2562
- args: ['gioMenuItem', { static: false }]
2563
2574
  }], onClick: [{
2564
2575
  type: i0.HostListener,
2565
2576
  args: ['click', ['$event']]
@@ -2947,7 +2958,7 @@
2947
2958
  _this.gioSubmenu.nativeElement.style.top = top + "px";
2948
2959
  _this.gioSubmenu.nativeElement.style.height = 'auto';
2949
2960
  _this.gioSubmenu.nativeElement.style.maxHeight = "calc(100vh - " + (top + 8) + "px)";
2950
- }))
2961
+ }), operators.filter(function (overlayOptions) { return !!overlayOptions.focus; }), operators.delay(200), operators.switchMap(function () { return rxjs.of(_this.gioSubmenu.nativeElement.querySelectorAll('gio-submenu-item')); }), operators.filter(function (submenuItems) { return submenuItems.length > 0; }), operators.tap(function (submenuItems) { return submenuItems[0].focus(); }))
2951
2962
  .subscribe();
2952
2963
  this.gioMenuService.reduce
2953
2964
  .pipe(operators.takeUntil(this.unsubscribe$), operators.filter(function (reduced) { return !reduced; }), operators.tap(function () {
@@ -2958,6 +2969,10 @@
2958
2969
  }))
2959
2970
  .subscribe();
2960
2971
  };
2972
+ GioSubmenuComponent.prototype.ngOnDestroy = function () {
2973
+ this.unsubscribe$.next();
2974
+ this.unsubscribe$.unsubscribe();
2975
+ };
2961
2976
  GioSubmenuComponent.prototype.onMouseEnter = function () {
2962
2977
  this.hover = true;
2963
2978
  this.gioMenuService.overlay(this.overlayOptions);
@@ -2966,14 +2981,16 @@
2966
2981
  this.hover = false;
2967
2982
  this.gioMenuService.overlay({ open: false });
2968
2983
  };
2969
- GioSubmenuComponent.prototype.ngOnDestroy = function () {
2970
- this.unsubscribe$.next();
2971
- this.unsubscribe$.unsubscribe();
2984
+ GioSubmenuComponent.prototype.onKeydownHandler = function (event) {
2985
+ var _this = this;
2986
+ rxjs.of(this.reduced && event.key === 'Escape')
2987
+ .pipe(operators.filter(function (reducedAndEcape) { return reducedAndEcape; }), operators.tap(function () { return _this.gioMenuService.overlay({ open: false }); }), operators.delay(100), operators.tap(function () { var _a; return (_a = _this.overlayOptions.parent) === null || _a === void 0 ? void 0 : _a.focus(); }))
2988
+ .subscribe();
2972
2989
  };
2973
2990
  return GioSubmenuComponent;
2974
2991
  }());
2975
2992
  GioSubmenuComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: GioSubmenuComponent, deps: [{ token: GioMenuService }], target: i0__namespace.ɵɵFactoryTarget.Component });
2976
- GioSubmenuComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: GioSubmenuComponent, selector: "gio-submenu", viewQueries: [{ propertyName: "gioSubmenu", first: true, predicate: ["gioSubmenu"], descendants: true }], ngImport: i0__namespace, template: "<!--\n\n Copyright (C) 2022 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<div\n #gioSubmenu\n class=\"gio-submenu\"\n [class.gio-submenu__loaded]=\"loaded\"\n [class.gio-submenu__reduced]=\"reduced\"\n [class.gio-submenu__overlay]=\"overlayOptions.open\"\n (mouseenter)=\"onMouseEnter()\"\n (mouseleave)=\"onMouseLeave()\"\n>\n <div #title class=\"gio-submenu__title\" [class.hide]=\"!title.children.length || reduced\">\n <ng-content select=\"[gioSubmenuTitle]\"></ng-content>\n </div>\n <ng-content></ng-content>\n</div>\n", styles: [":host{z-index:100}.gio-submenu{display:none;width:266px;height:100%;flex:none;flex-direction:column;flex-grow:0;justify-content:flex-start;padding:16px;background:#100c27}.gio-submenu__reduced{position:absolute;overflow:auto;margin:0 0 0 8px;border-radius:8px;opacity:0;visibility:hidden}.gio-submenu__loaded{display:flex}.gio-submenu__overlay,.gio-submenu:hover{opacity:1;transition:opacity .23s,visibility .23s;visibility:visible}.gio-submenu__title{padding-bottom:8px;color:#fff}.gio-submenu .hide{display:none}\n"] });
2993
+ GioSubmenuComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: GioSubmenuComponent, selector: "gio-submenu", host: { listeners: { "keydown": "onKeydownHandler($event)" } }, viewQueries: [{ propertyName: "gioSubmenu", first: true, predicate: ["gioSubmenu"], descendants: true }], ngImport: i0__namespace, template: "<!--\n\n Copyright (C) 2022 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<div\n #gioSubmenu\n class=\"gio-submenu\"\n [class.gio-submenu__loaded]=\"loaded\"\n [class.gio-submenu__reduced]=\"reduced\"\n [class.gio-submenu__overlay]=\"overlayOptions.open\"\n (mouseenter)=\"onMouseEnter()\"\n (mouseleave)=\"onMouseLeave()\"\n>\n <div #title class=\"gio-submenu__title\" [class.hide]=\"!title.children.length || reduced\">\n <ng-content select=\"[gioSubmenuTitle]\"></ng-content>\n </div>\n <ng-content></ng-content>\n</div>\n", styles: [":host{z-index:100}.gio-submenu{display:none;width:266px;height:100%;flex:none;flex-direction:column;flex-grow:0;justify-content:flex-start;padding:16px;background:#100c27}.gio-submenu__reduced{position:absolute;overflow:auto;margin:0 0 0 8px;border-radius:8px;opacity:0;visibility:hidden}.gio-submenu__loaded{display:flex}.gio-submenu__overlay,.gio-submenu:hover{opacity:1;transition:opacity .15s,visibility .15s;visibility:visible}.gio-submenu__title{padding-bottom:8px;color:#fff}.gio-submenu .hide{display:none}\n"] });
2977
2994
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: GioSubmenuComponent, decorators: [{
2978
2995
  type: i0.Component,
2979
2996
  args: [{
@@ -2984,6 +3001,9 @@
2984
3001
  }], ctorParameters: function () { return [{ type: GioMenuService }]; }, propDecorators: { gioSubmenu: [{
2985
3002
  type: i0.ViewChild,
2986
3003
  args: ['gioSubmenu', { static: false }]
3004
+ }], onKeydownHandler: [{
3005
+ type: i0.HostListener,
3006
+ args: ['keydown', ['$event']]
2987
3007
  }] } });
2988
3008
 
2989
3009
  /*
@@ -3041,7 +3061,7 @@
3041
3061
  }
3042
3062
  GioSubmenuItemComponent.prototype.onKeydownHandler = function (event) {
3043
3063
  var _a;
3044
- if (event.key === ' ' || event.key === 'Enter') {
3064
+ if (event.key === 'Enter') {
3045
3065
  (_a = this.gioSubmenuItem) === null || _a === void 0 ? void 0 : _a.nativeElement.click();
3046
3066
  }
3047
3067
  };