ng-tailwind 2.30.356 → 2.30.358

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.
@@ -1763,8 +1763,10 @@
1763
1763
  var _this = this;
1764
1764
  this.ngtDropdownContainer = ngtDropdownContainer;
1765
1765
  this.autoYReverse = true;
1766
+ this.closeTimeout = 1000;
1766
1767
  this.openMethod = exports.NgtDropdownOpenMethod.HOVER;
1767
1768
  this.onToggle = new core.EventEmitter();
1769
+ this.onHostClick = new core.EventEmitter();
1768
1770
  this.name = uuid();
1769
1771
  this.isYPositionReversed = false;
1770
1772
  this.isXPositionReversed = false;
@@ -1796,12 +1798,9 @@
1796
1798
  }
1797
1799
  };
1798
1800
  NgtDropdownComponent.prototype.close = function () {
1799
- var _this = this;
1800
- if (this.closeTimeout) {
1801
- setTimeout(function () { return _this.hideContainer(); }, this.closeTimeout);
1802
- return;
1803
- }
1804
- this.hideContainer();
1801
+ this.isOpen = false;
1802
+ this.containerXPosition = null;
1803
+ this.containerYPosition = null;
1805
1804
  };
1806
1805
  NgtDropdownComponent.prototype.toggle = function () {
1807
1806
  var _this = this;
@@ -1821,12 +1820,17 @@
1821
1820
  this.watchHover(host, container);
1822
1821
  }
1823
1822
  };
1824
- NgtDropdownComponent.prototype.onClick = function (event) {
1825
- if (this.openMethod == exports.NgtDropdownOpenMethod.CLICK) {
1823
+ NgtDropdownComponent.prototype.onClick = function (event, host, container) {
1824
+ var _a;
1825
+ (_a = this.onHostClick) === null || _a === void 0 ? void 0 : _a.emit();
1826
+ if (this.isClickMethod()) {
1826
1827
  event.preventDefault();
1827
1828
  event.stopPropagation();
1828
1829
  this.toggle();
1829
1830
  }
1831
+ if (this.openMethod == exports.NgtDropdownOpenMethod.POPOVER_CLICK) {
1832
+ this.watchHover(host, container);
1833
+ }
1830
1834
  };
1831
1835
  NgtDropdownComponent.prototype.onRightClick = function (event) {
1832
1836
  if (this.openMethod == exports.NgtDropdownOpenMethod.RIGHT_CLICK) {
@@ -1885,7 +1889,7 @@
1885
1889
  _this.close();
1886
1890
  clearInterval(interval);
1887
1891
  }
1888
- }, 1000);
1892
+ }, this.closeTimeout);
1889
1893
  };
1890
1894
  NgtDropdownComponent.prototype.isInHover = function (host, container) {
1891
1895
  return host.parentElement.querySelector(':hover') == host ||
@@ -1895,17 +1899,16 @@
1895
1899
  this.subscriptions.forEach(function (subscription) { return subscription.unsubscribe(); });
1896
1900
  this.subscriptions = [];
1897
1901
  };
1898
- NgtDropdownComponent.prototype.hideContainer = function () {
1899
- this.isOpen = false;
1900
- this.containerXPosition = null;
1901
- this.containerYPosition = null;
1902
+ NgtDropdownComponent.prototype.isClickMethod = function () {
1903
+ return this.openMethod == exports.NgtDropdownOpenMethod.CLICK
1904
+ || this.openMethod == exports.NgtDropdownOpenMethod.POPOVER_CLICK;
1902
1905
  };
1903
1906
  return NgtDropdownComponent;
1904
1907
  }());
1905
1908
  NgtDropdownComponent.decorators = [
1906
1909
  { type: core.Component, args: [{
1907
1910
  selector: 'ngt-dropdown',
1908
- template: "<div class=\"sm:relative\">\n <div (mouseenter)=\"onHover(host, container)\" (click)=\"onClick($event)\" (contextmenu)=\"onRightClick($event)\" #host>\n <ng-content select='[host]'></ng-content>\n </div>\n\n <div [hidden]='!isOpen'\n class=\"{{ shouldReverseYPosition() ? 'mb-12 bottom-0' : 'mt-4' }} {{ shouldReverseXPosition() ? 'left-0': 'right-0' }} ngt-dropdown-container sm:mr-0 mr-3 max-w-xs absolute\"\n [@openClose]=\"isOpen ? 'open' : 'closed'\" (mouseenter)=\"onHover(host, container)\"\n (click)='closeOnSelectOption()' style=\"z-index: 1100 !important;\" #container>\n\n <ng-content select='[container]'></ng-content>\n </div>\n</div>\n\n<button *ngIf=\"isOpen && openMethod != 'HOVER'\" class=\"fixed z-40 inset-0 h-full w-full opacity-0 cursor-default\"\n (click)='toggle()'>\n</button>",
1911
+ template: "<div class=\"sm:relative\">\n <div (mouseenter)=\"onHover(host, container)\" (click)=\"onClick($event, host, container)\" (contextmenu)=\"onRightClick($event)\" #host>\n <ng-content select='[host]'></ng-content>\n </div>\n\n <div [hidden]='!isOpen'\n class=\"{{ shouldReverseYPosition() ? 'mb-12 bottom-0' : 'mt-4' }} {{ shouldReverseXPosition() ? 'left-0': 'right-0' }} ngt-dropdown-container sm:mr-0 mr-3 max-w-xs absolute\"\n [@openClose]=\"isOpen ? 'open' : 'closed'\" (mouseenter)=\"onHover(host, container)\"\n (click)='closeOnSelectOption()' style=\"z-index: 1100 !important;\" #container>\n\n <ng-content select='[container]'></ng-content>\n </div>\n</div>\n\n<button *ngIf=\"isOpen && openMethod != 'HOVER'\" class=\"fixed z-40 inset-0 h-full w-full opacity-0 cursor-default\"\n (click)='toggle()'>\n</button>\n",
1909
1912
  animations: [
1910
1913
  animations.trigger('openClose', [
1911
1914
  animations.state('open', animations.style({ opacity: 1, transform: 'translateY(0px)' })),
@@ -1930,11 +1933,13 @@
1930
1933
  closeOnClick: [{ type: core.Input }],
1931
1934
  closeTimeout: [{ type: core.Input }],
1932
1935
  openMethod: [{ type: core.Input }],
1933
- onToggle: [{ type: core.Output }]
1936
+ onToggle: [{ type: core.Output }],
1937
+ onHostClick: [{ type: core.Output }]
1934
1938
  };
1935
1939
  exports.NgtDropdownOpenMethod = void 0;
1936
1940
  (function (NgtDropdownOpenMethod) {
1937
1941
  NgtDropdownOpenMethod["CLICK"] = "CLICK";
1942
+ NgtDropdownOpenMethod["POPOVER_CLICK"] = "POPOVER_CLICK";
1938
1943
  NgtDropdownOpenMethod["RIGHT_CLICK"] = "RIGHT_CLICK";
1939
1944
  NgtDropdownOpenMethod["HOVER"] = "HOVER";
1940
1945
  })(exports.NgtDropdownOpenMethod || (exports.NgtDropdownOpenMethod = {}));
@@ -7700,28 +7705,43 @@
7700
7705
  this.ngtTranslateService = ngtTranslateService;
7701
7706
  this.injector = injector;
7702
7707
  this.openMethod = exports.NgtPopoverOpenMethod.HOVER;
7703
- this.stylesToCompile = ['h', 'w', 'px', 'py', 'shadow', 'text', 'border', 'color.border', 'color.bg', 'color.text'];
7708
+ this.onClick = new core.EventEmitter();
7709
+ this.stylesToCompile = ['h', 'w', 'px', 'py', 'm', 'mx', 'my', 'shadow', 'text', 'border', 'color.border', 'color.bg', 'color.text'];
7704
7710
  if (this.ngtStylizableDirective) {
7705
7711
  this.ngtStyle = this.ngtStylizableDirective.getNgtStylizableService();
7706
7712
  }
7707
7713
  else {
7708
7714
  this.ngtStyle = new NgtStylizableService();
7709
7715
  }
7710
- this.ngtStyle.load(this.injector, 'NgtHelper', {
7716
+ this.ngtStyle.load(this.injector, 'NgtPopover', {
7711
7717
  text: 'text-sm',
7712
7718
  fontCase: '',
7719
+ py: 'py-3',
7720
+ px: 'px-2',
7721
+ border: 'border',
7713
7722
  color: {
7723
+ border: 'border-gray-400',
7714
7724
  text: 'text-black',
7715
- bg: 'bg-gray-200'
7716
- }
7725
+ bg: 'bg-white'
7726
+ },
7717
7727
  });
7718
7728
  }
7729
+ NgtPopoverComponent.prototype.fireClickEvent = function () {
7730
+ var _this = this;
7731
+ this.onClick.emit();
7732
+ setTimeout(function () {
7733
+ var event = new MouseEvent('click', { bubbles: true });
7734
+ event.preventDefault();
7735
+ event.stopPropagation();
7736
+ _this.hostDiv.nativeElement.dispatchEvent(event);
7737
+ }, 50);
7738
+ };
7719
7739
  return NgtPopoverComponent;
7720
7740
  }());
7721
7741
  NgtPopoverComponent.decorators = [
7722
7742
  { type: core.Component, args: [{
7723
7743
  selector: 'ngt-popover',
7724
- template: "<ngt-dropdown class=\"flex w-full hover:opacity-100\" [closeOnClick]=\"closeOnClick\" [openMethod]=\"openMethod\"\n [autoXReverse]=\"false\" [autoYReverse]=\"false\" [reverseYPosition]=\"!placeOnBottom\" [closeTimeout]=\"closeTimeout\"\n #dropdownRef>\n <div host>\n <ng-content></ng-content>\n </div>\n\n <div class=\"bg-gray-100 px-2 text-sm rounded-lg hover:opacity-100 text-gray-800 shadow-lg\"\n [class.-mb-4]='dropdownRef.isYPositionReversed' [ngClass]=\"ngtStyle.compile(stylesToCompile)\"\n container>\n\n <ng-content select=\"[popover-content]\"></ng-content>\n </div>\n</ngt-dropdown>\n"
7744
+ template: "<ngt-dropdown class=\"flex w-full hover:opacity-100\" [closeOnClick]=\"closeOnClick\" [openMethod]=\"openMethod\"\n [autoYReverse]=\"false\" [reverseXPosition]=\"!placeOnLeft\" [reverseYPosition]=\"!placeOnBottom\"\n [closeTimeout]=\"closeTimeout\" (onHostClick)=\"fireClickEvent()\" #dropdownRef>\n <div #hostDiv host>\n <ng-content></ng-content>\n </div>\n\n <div class=\"bg-gray-100 rounded-lg hover:opacity-100 text-gray-800 shadow-lg -mb-4\"\n [ngClass]=\"ngtStyle.compile(stylesToCompile)\" container>\n\n <ng-content select=\"[popover-content]\"></ng-content>\n </div>\n</ngt-dropdown>\n"
7725
7745
  },] }
7726
7746
  ];
7727
7747
  NgtPopoverComponent.ctorParameters = function () { return [
@@ -7731,14 +7751,18 @@
7731
7751
  ]; };
7732
7752
  NgtPopoverComponent.propDecorators = {
7733
7753
  dropdownRef: [{ type: core.ViewChild, args: ['dropdownRef', { static: true },] }],
7754
+ hostDiv: [{ type: core.ViewChild, args: ['hostDiv',] }],
7734
7755
  closeTimeout: [{ type: core.Input }],
7735
7756
  openMethod: [{ type: core.Input }],
7736
7757
  closeOnClick: [{ type: core.Input }],
7737
- placeOnBottom: [{ type: core.Input }]
7758
+ placeOnBottom: [{ type: core.Input }],
7759
+ placeOnLeft: [{ type: core.Input }],
7760
+ onClick: [{ type: core.Output }]
7738
7761
  };
7739
7762
  exports.NgtPopoverOpenMethod = void 0;
7740
7763
  (function (NgtPopoverOpenMethod) {
7741
7764
  NgtPopoverOpenMethod["CLICK"] = "CLICK";
7765
+ NgtPopoverOpenMethod["POPOVER_CLICK"] = "POPOVER_CLICK";
7742
7766
  NgtPopoverOpenMethod["RIGHT_CLICK"] = "RIGHT_CLICK";
7743
7767
  NgtPopoverOpenMethod["HOVER"] = "HOVER";
7744
7768
  })(exports.NgtPopoverOpenMethod || (exports.NgtPopoverOpenMethod = {}));