ng-inail-common 2.0.25 → 2.0.28

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.
@@ -4657,6 +4657,7 @@
4657
4657
 
4658
4658
  var KEYCODE_TAB = 9;
4659
4659
  var FOCUSABLE_SELECTOR = 'a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])';
4660
+ var PREVENT_PADDING_STYLE_CLASS = 'inail-modal-prevent-padding-style';
4660
4661
  var ModalComponent = /** @class */ (function (_super) {
4661
4662
  __extends(ModalComponent, _super);
4662
4663
  function ModalComponent(cdr) {
@@ -4665,6 +4666,7 @@
4665
4666
  _this.closeButtonTitle = 'Chiudi modale';
4666
4667
  _this.close = new core.EventEmitter();
4667
4668
  _this.width = 'M';
4669
+ _this.preventPageScroll = true;
4668
4670
  _this.closeOnClick = function () { return _this.showModal(false); };
4669
4671
  _this.setFocusOnLastPageActiveElement = function () {
4670
4672
  if (_this.pageActiveElement != undefined) {
@@ -4707,17 +4709,54 @@
4707
4709
  };
4708
4710
  ModalComponent.prototype.showModal = function (show) {
4709
4711
  var _this = this;
4712
+ if (show && !this.preventPageScroll) {
4713
+ this.inserisciPreventBodyPaddingStyle();
4714
+ }
4710
4715
  window['$']("#" + this.id).modal(show ? 'show' : 'hide');
4711
4716
  if (show) {
4712
4717
  setTimeout(function () { return _this.trapFocus(); }, 500);
4713
- setPageScroll(false);
4718
+ if (this.preventPageScroll) {
4719
+ setPageScroll(false);
4720
+ }
4714
4721
  }
4715
4722
  else {
4716
4723
  this.close.emit();
4717
- setPageScroll(true);
4724
+ if (this.preventPageScroll) {
4725
+ this.ripristinaPageScroll();
4726
+ }
4727
+ else {
4728
+ this.rimuoviPreventBodyPaddingStyle();
4729
+ }
4718
4730
  setTimeout(function () { return _this.setFocusOnLastPageActiveElement(); }, 500);
4719
4731
  }
4720
4732
  };
4733
+ /**
4734
+ * L'inserimento di questo style ha lo scopo di effettuare l'override
4735
+ * della regola sul padding-right inserita da bootstrap in fase di apertura della modale
4736
+ * la quale causa un restringimento del body se la scrollbar non viene rimossa.
4737
+ */
4738
+ ModalComponent.prototype.inserisciPreventBodyPaddingStyle = function () {
4739
+ if (!window['$']("." + PREVENT_PADDING_STYLE_CLASS).length) {
4740
+ window['$']('<style>', { class: "" + PREVENT_PADDING_STYLE_CLASS }).text('body.modal-open { padding-right: 0!important; }').appendTo('head');
4741
+ }
4742
+ };
4743
+ ModalComponent.prototype.rimuoviPreventBodyPaddingStyle = function () {
4744
+ setTimeout(function () { var _a; return (_a = window['$']("." + PREVENT_PADDING_STYLE_CLASS)) === null || _a === void 0 ? void 0 : _a.remove(); }, 500);
4745
+ };
4746
+ ModalComponent.prototype.ripristinaPageScroll = function () {
4747
+ var counter = 0;
4748
+ // Evita il glitch grafico che fa restringere ed allargare
4749
+ // il body alla chiusura della modale
4750
+ // causato dall'inserimento del paddingRight ad opera
4751
+ // di bootstrap
4752
+ var handle = setInterval(function () {
4753
+ if (document.body.style.paddingRight == "" || counter == 100) {
4754
+ clearInterval(handle);
4755
+ setPageScroll(true);
4756
+ }
4757
+ counter++;
4758
+ }, 5);
4759
+ };
4721
4760
  ModalComponent.prototype.trapFocus = function () {
4722
4761
  var thisModal = window['$']("#" + this.id);
4723
4762
  var focusableEls = thisModal.find(".modal-content").find(FOCUSABLE_SELECTOR);
@@ -4774,7 +4813,8 @@
4774
4813
  close: [{ type: core.Output }],
4775
4814
  show: [{ type: core.Input }],
4776
4815
  width: [{ type: core.Input }],
4777
- setFocusOnError: [{ type: core.Input }]
4816
+ setFocusOnError: [{ type: core.Input }],
4817
+ preventPageScroll: [{ type: core.Input }]
4778
4818
  };
4779
4819
 
4780
4820
  var AlertComponent = /** @class */ (function (_super) {
@@ -4782,7 +4822,11 @@
4782
4822
  function AlertComponent(_cdr) {
4783
4823
  var _this = _super.call(this, _cdr) || this;
4784
4824
  _this._cdr = _cdr;
4785
- _this.okOnClick = function () { return _this.showModal(false); };
4825
+ _this.closeButtonTitle = 'Chiudi modale';
4826
+ _this.close = new core.EventEmitter();
4827
+ _this.width = 'M';
4828
+ _this.preventPageScroll = true;
4829
+ _this.okOnClick = function () { var _a; return (_a = _this.show) === null || _a === void 0 ? void 0 : _a.emit(false); };
4786
4830
  _this.logPrefix = '[inail-alert]';
4787
4831
  _this.title = 'Messaggio informativo';
4788
4832
  _this.width = 'S';
@@ -4804,11 +4848,11 @@
4804
4848
  _super.prototype.ngOnDestroy.call(this);
4805
4849
  };
4806
4850
  return AlertComponent;
4807
- }(ModalComponent));
4851
+ }(BasicUxElementComponent));
4808
4852
  AlertComponent.decorators = [
4809
4853
  { type: core.Component, args: [{
4810
4854
  selector: 'inail-alert',
4811
- template: "<inail-modal [id]=\"id\"\n [show]=\"show\"\n [class]=\"class\"\n [title]=\"title\"\n [closeButtonTitle]=\"closeButtonTitle\"\n [logOnConsole]=\"logOnConsole\"\n [width]=\"this.width\"\n (close)=\"close.emit($event)\"\n (log)=\"log.emit($event)\">\n <div class=\"row\">\n <p *ngIf=\"message\" [innerHTML]=\"message\"></p>\n <p *ngIf=\"!message\">\n <ng-content></ng-content>\n </p>\n </div>\n <div class=\"row alert-footer\">\n <button type=\"button\"\n (click)=\"okOnClick()\"\n class=\"btn btn-primary pull-right\">Ok\n </button>\n </div>\n</inail-modal>\n",
4855
+ template: "<inail-modal #modalComponent\n [id]=\"id\"\n [show]=\"show\"\n [preventPageScroll]=\"preventPageScroll\"\n [class]=\"class\"\n [title]=\"title\"\n [closeButtonTitle]=\"closeButtonTitle\"\n [logOnConsole]=\"logOnConsole\"\n [width]=\"this.width\"\n (close)=\"close.emit($event)\"\n (log)=\"log.emit($event)\">\n <div class=\"row\">\n <p *ngIf=\"message\" [innerHTML]=\"message\"></p>\n <p *ngIf=\"!message\">\n <ng-content></ng-content>\n </p>\n </div>\n <div class=\"row alert-footer\">\n <button type=\"button\"\n (click)=\"okOnClick()\"\n class=\"btn btn-primary pull-right\">Ok\n </button>\n </div>\n</inail-modal>\n",
4812
4856
  changeDetection: CHANGE_DETECTION_STRATEGY,
4813
4857
  encapsulation: core.ViewEncapsulation.None,
4814
4858
  styles: [".alert-footer{padding-bottom:20px!important;padding-top:20px!important}.alert-footer button{margin-right:0!important}"]
@@ -4818,7 +4862,15 @@
4818
4862
  { type: core.ChangeDetectorRef }
4819
4863
  ]; };
4820
4864
  AlertComponent.propDecorators = {
4821
- message: [{ type: core.Input }]
4865
+ title: [{ type: core.Input }],
4866
+ closeButtonTitle: [{ type: core.Input }],
4867
+ close: [{ type: core.Output }],
4868
+ show: [{ type: core.Input }],
4869
+ width: [{ type: core.Input }],
4870
+ setFocusOnError: [{ type: core.Input }],
4871
+ preventPageScroll: [{ type: core.Input }],
4872
+ message: [{ type: core.Input }],
4873
+ modalComponent: [{ type: core.ViewChild, args: ['modalComponent',] }]
4822
4874
  };
4823
4875
 
4824
4876
  var ConfirmComponent = /** @class */ (function (_super) {
@@ -4826,11 +4878,14 @@
4826
4878
  function ConfirmComponent(_cdr) {
4827
4879
  var _this = _super.call(this, _cdr) || this;
4828
4880
  _this._cdr = _cdr;
4881
+ _this.closeButtonTitle = 'Chiudi modale';
4882
+ _this.close = new core.EventEmitter();
4883
+ _this.width = 'M';
4884
+ _this.preventPageScroll = true;
4829
4885
  _this.confirmButtonLabel = 'Si';
4830
4886
  _this.rejectButtonLabel = 'No';
4831
4887
  _this.confirm = new core.EventEmitter();
4832
4888
  _this.reject = new core.EventEmitter();
4833
- _this.cancel = new core.EventEmitter();
4834
4889
  _this.logPrefix = '[inail-confirm]';
4835
4890
  _this.title = 'Conferma operazione';
4836
4891
  _this.message = 'Confermare l\'operazione richiesta?';
@@ -4853,23 +4908,26 @@
4853
4908
  _super.prototype.ngOnDestroy.call(this);
4854
4909
  };
4855
4910
  ConfirmComponent.prototype.confirmOnClick = function () {
4856
- this.showModal(false);
4911
+ this.action = 'y';
4912
+ this.show.emit(false);
4857
4913
  this.confirm.emit();
4914
+ this.action = undefined;
4858
4915
  };
4859
4916
  ConfirmComponent.prototype.rejectOnClick = function () {
4860
- this.showModal(false);
4917
+ this.action = 'n';
4918
+ this.show.emit(false);
4861
4919
  this.reject.emit();
4920
+ this.action = undefined;
4862
4921
  };
4863
- ConfirmComponent.prototype.cancelOnClick = function () {
4864
- this.showModal(false);
4865
- this.cancel.emit();
4922
+ ConfirmComponent.prototype.onClose = function () {
4923
+ this.close.emit(this.action || 'x');
4866
4924
  };
4867
4925
  return ConfirmComponent;
4868
- }(ModalComponent));
4926
+ }(BasicUxElementComponent));
4869
4927
  ConfirmComponent.decorators = [
4870
4928
  { type: core.Component, args: [{
4871
4929
  selector: 'inail-confirm',
4872
- template: "<inail-modal [id]=\"id\"\n [show]=\"show\"\n [class]=\"class\"\n [title]=\"title\"\n [closeButtonTitle]=\"closeButtonTitle\"\n [logOnConsole]=\"logOnConsole\"\n [width]=\"width\"\n (close)=\"cancelOnClick()\"\n (log)=\"log.emit($event)\">\n <div class=\"row\">\n <p *ngIf=\"message\" [innerHTML]=\"message\"></p>\n <p *ngIf=\"!message\">\n <ng-content></ng-content>\n </p>\n </div>\n <div class=\"row confirm-footer\">\n <inail-button [label]=\"rejectButtonLabel\"\n (onclick)=\"rejectOnClick()\">\n </inail-button>\n <inail-button [class]=\"'pull-right'\"\n [setFocusOnError]=\"setFocusOnError\"\n [label]=\"confirmButtonLabel\"\n (onclick)=\"confirmOnClick()\">\n </inail-button>\n </div>\n</inail-modal>\n",
4930
+ template: "<inail-modal #modalComponent\n [id]=\"id\"\n [show]=\"show\"\n [preventPageScroll]=\"preventPageScroll\"\n [class]=\"class\"\n [title]=\"title\"\n [closeButtonTitle]=\"closeButtonTitle\"\n [logOnConsole]=\"logOnConsole\"\n [width]=\"width\"\n (close)=\"onClose()\"\n (log)=\"log.emit($event)\">\n <div class=\"row\">\n <p *ngIf=\"message\" [innerHTML]=\"message\"></p>\n <p *ngIf=\"!message\">\n <ng-content></ng-content>\n </p>\n </div>\n <div class=\"row confirm-footer\">\n <inail-button [label]=\"rejectButtonLabel\"\n (onclick)=\"rejectOnClick()\">\n </inail-button>\n <inail-button [class]=\"'pull-right'\"\n [setFocusOnError]=\"setFocusOnError\"\n [label]=\"confirmButtonLabel\"\n (onclick)=\"confirmOnClick()\">\n </inail-button>\n </div>\n</inail-modal>\n",
4873
4931
  changeDetection: CHANGE_DETECTION_STRATEGY,
4874
4932
  encapsulation: core.ViewEncapsulation.None,
4875
4933
  styles: [".confirm-footer{padding-bottom:20px!important;padding-top:20px!important}.confirm-footer button{margin-right:0!important}"]
@@ -4879,12 +4937,19 @@
4879
4937
  { type: core.ChangeDetectorRef }
4880
4938
  ]; };
4881
4939
  ConfirmComponent.propDecorators = {
4940
+ title: [{ type: core.Input }],
4941
+ closeButtonTitle: [{ type: core.Input }],
4942
+ close: [{ type: core.Output }],
4943
+ show: [{ type: core.Input }],
4944
+ width: [{ type: core.Input }],
4945
+ setFocusOnError: [{ type: core.Input }],
4946
+ preventPageScroll: [{ type: core.Input }],
4882
4947
  message: [{ type: core.Input }],
4883
4948
  confirmButtonLabel: [{ type: core.Input }],
4884
4949
  rejectButtonLabel: [{ type: core.Input }],
4885
4950
  confirm: [{ type: core.Output }],
4886
4951
  reject: [{ type: core.Output }],
4887
- cancel: [{ type: core.Output }]
4952
+ modalComponent: [{ type: core.ViewChild, args: ['modalComponent',] }]
4888
4953
  };
4889
4954
 
4890
4955
  var DEFAULT_TABLE_LENGTH = 10;
@@ -5705,7 +5770,7 @@
5705
5770
  TableComponent.decorators = [
5706
5771
  { type: core.Component, args: [{
5707
5772
  selector: 'inail-table',
5708
- template: "<div class=\"tabella table-responsive inail-table {{getResponsiveClass()}} noPaddingLeft {{class}}\">\n\n <h3 *ngIf=\"title\"\n class=\"col-xs-9 table-title pull-left noPaddingLeft {{titleClass}}\"\n [innerHTML]=\"title\">\n </h3>\n\n <a *ngIf=\"detailsLink\"\n href=\"javascript:void(0)\"\n (click)=\"detailsClick.emit()\"\n class=\"col-xs-3 col-sm-2 linkDettagli pull-right\"\n [innerHTML]=\"detailsLink\">\n </a>\n\n <div *ngIf=\"description\"\n class=\"col-xs-12 caption marginBottom noPaddingLeft\"\n [innerHTML]=\"description\">\n </div>\n\n <inail-table-page-length-selector *ngIf=\"visualizzaPaginazione()\"\n [value]=\"getPageSize()\"\n [tableId]=\"id\"\n [options]=\"elementsPerPageOptions\"\n (valueChange)=\"lengthOnChange($event)\"\n [logOnConsole]=\"logOnConsole\"\n (log)=\"log.emit($event)\">\n </inail-table-page-length-selector>\n\n <ng-container *ngIf=\"true\">\n\n <table id=\"{{id}}\"\n class=\"table display dataTable {{tableClass}}\"\n [ngClass]=\"{'tabella-base': !tallRows, 'bg-white': bgWhite, 'bg-transparent': !bgWhite}\">\n\n <caption *ngIf=\"caption\"\n [ngClass]=\"{'sr-only': captionHidden}\"\n [innerHTML]=\"caption\">\n </caption>\n\n <ng-content select=\"thead\"></ng-content>\n\n <ng-container *ngIf=\"!noDataFound\">\n <ng-content select=\"tbody\"></ng-content>\n </ng-container>\n\n <tbody *ngIf=\"noDataFound\">\n <tr role=\"row\">\n <td class=\"content-text\"\n style=\"padding: 30px; text-align: center\"\n [colSpan]=\"numeroColonne\"\n [innerHTML]=\"noDataFoundText\">\n </td>\n </tr>\n </tbody>\n </table>\n\n <div #baseFooter\n class=\"col-xs-12 baseFooter noPaddingLeft\"\n *ngIf=\"visualizzaBaseFooter\">\n <ng-content select=\"[baseFooter]\"></ng-content>\n </div>\n\n </ng-container>\n\n <inail-table-page-selector *ngIf=\"visualizzaPaginazione() && !this.noDataFound\"\n [listSize]=\"getListSize()\"\n [pageSize]=\"getPageSize()\"\n [currentPage]=\"getCurrentPage()\"\n [tableId]=\"id\"\n (select)=\"pageOnChange($event)\"\n [logOnConsole]=\"logOnConsole\"\n (log)=\"log.emit($event)\">\n </inail-table-page-selector>\n\n</div>\n",
5773
+ template: "<div class=\"tabella table-responsive inail-table {{getResponsiveClass()}} noPaddingLeft {{class}} noPaddingRight\">\n\n <h3 *ngIf=\"title\"\n class=\"col-xs-9 table-title pull-left noPaddingLeft {{titleClass}}\"\n [innerHTML]=\"title\">\n </h3>\n\n <a *ngIf=\"detailsLink\"\n href=\"javascript:void(0)\"\n (click)=\"detailsClick.emit()\"\n class=\"col-xs-3 col-sm-2 linkDettagli pull-right\"\n [innerHTML]=\"detailsLink\">\n </a>\n\n <div *ngIf=\"description\"\n class=\"col-xs-12 caption marginBottom noPaddingLeft\"\n [innerHTML]=\"description\">\n </div>\n\n <inail-table-page-length-selector *ngIf=\"visualizzaPaginazione()\"\n [value]=\"getPageSize()\"\n [tableId]=\"id\"\n [options]=\"elementsPerPageOptions\"\n (valueChange)=\"lengthOnChange($event)\"\n [logOnConsole]=\"logOnConsole\"\n (log)=\"log.emit($event)\">\n </inail-table-page-length-selector>\n\n <ng-container *ngIf=\"true\">\n\n <table id=\"{{id}}\"\n class=\"table display dataTable {{tableClass}}\"\n [ngClass]=\"{'tabella-base': !tallRows, 'bg-white': bgWhite, 'bg-transparent': !bgWhite}\">\n\n <caption *ngIf=\"caption\"\n [ngClass]=\"{'sr-only': captionHidden}\"\n [innerHTML]=\"caption\">\n </caption>\n\n <ng-content select=\"thead\"></ng-content>\n\n <ng-container *ngIf=\"!noDataFound\">\n <ng-content select=\"tbody\"></ng-content>\n </ng-container>\n\n <tbody *ngIf=\"noDataFound\">\n <tr role=\"row\">\n <td class=\"content-text\"\n style=\"padding: 30px; text-align: center\"\n [colSpan]=\"numeroColonne\"\n [innerHTML]=\"noDataFoundText\">\n </td>\n </tr>\n </tbody>\n </table>\n\n <div #baseFooter\n class=\"col-xs-12 baseFooter noPaddingLeft\"\n *ngIf=\"visualizzaBaseFooter\">\n <ng-content select=\"[baseFooter]\"></ng-content>\n </div>\n\n </ng-container>\n\n <inail-table-page-selector *ngIf=\"visualizzaPaginazione() && !this.noDataFound\"\n [listSize]=\"getListSize()\"\n [pageSize]=\"getPageSize()\"\n [currentPage]=\"getCurrentPage()\"\n [tableId]=\"id\"\n (select)=\"pageOnChange($event)\"\n [logOnConsole]=\"logOnConsole\"\n (log)=\"log.emit($event)\">\n </inail-table-page-selector>\n\n</div>\n",
5709
5774
  changeDetection: CHANGE_DETECTION_STRATEGY,
5710
5775
  encapsulation: core.ViewEncapsulation.None,
5711
5776
  styles: [".inail-table a.linkDettagli{color:#106cdb;-webkit-text-decoration-line:none;text-decoration-line:none}.inail-table a.linkDettagli:hover{-webkit-text-decoration-line:underline;text-decoration-line:underline}.inail-table table.table.dataTable.bg-white>tbody>tr:not(:hover){background-color:#fff}.inail-table table.table.dataTable.bg-transparent>tbody>tr:not(:hover){background-color:initial}"]