@energycap/components 0.26.3 → 0.26.4-ECAP-11517-disable-selectable-table-rows.20211115-1649

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.
@@ -725,6 +725,29 @@
725
725
  resizableColumns: [{ type: i0.Input }]
726
726
  };
727
727
 
728
+ var ResizableColumnComponent = /** @class */ (function () {
729
+ function ResizableColumnComponent(el) {
730
+ this.el = el;
731
+ this.onResize = new i0.EventEmitter();
732
+ }
733
+ ResizableColumnComponent.prototype.emitWidth = function (width) {
734
+ this.onResize.emit(width);
735
+ };
736
+ return ResizableColumnComponent;
737
+ }());
738
+ ResizableColumnComponent.decorators = [
739
+ { type: i0.Component, args: [{
740
+ selector: 'th.is-resizable',
741
+ template: "<div class=\"content-wrapper\">\r\n <div class=\"content\">\r\n <ng-content></ng-content>\r\n </div>\r\n</div>\r\n<div class=\"handle\"></div>\r\n"
742
+ },] }
743
+ ];
744
+ ResizableColumnComponent.ctorParameters = function () { return [
745
+ { type: i0.ElementRef }
746
+ ]; };
747
+ ResizableColumnComponent.propDecorators = {
748
+ onResize: [{ type: i0.Output }]
749
+ };
750
+
728
751
  var TableMasterRowComponent = /** @class */ (function () {
729
752
  function TableMasterRowComponent(renderer, el) {
730
753
  this.renderer = renderer;
@@ -868,29 +891,6 @@
868
891
  detailRowTemplate: [{ type: i0.ViewChild, args: ['detailRow', { read: i0.TemplateRef, static: true },] }]
869
892
  };
870
893
 
871
- var ResizableColumnComponent = /** @class */ (function () {
872
- function ResizableColumnComponent(el) {
873
- this.el = el;
874
- this.onResize = new i0.EventEmitter();
875
- }
876
- ResizableColumnComponent.prototype.emitWidth = function (width) {
877
- this.onResize.emit(width);
878
- };
879
- return ResizableColumnComponent;
880
- }());
881
- ResizableColumnComponent.decorators = [
882
- { type: i0.Component, args: [{
883
- selector: 'th.is-resizable',
884
- template: "<div class=\"content-wrapper\">\r\n <div class=\"content\">\r\n <ng-content></ng-content>\r\n </div>\r\n</div>\r\n<div class=\"handle\"></div>\r\n"
885
- },] }
886
- ];
887
- ResizableColumnComponent.ctorParameters = function () { return [
888
- { type: i0.ElementRef }
889
- ]; };
890
- ResizableColumnComponent.propDecorators = {
891
- onResize: [{ type: i0.Output }]
892
- };
893
-
894
894
  var TableComponent = /** @class */ (function () {
895
895
  function TableComponent(renderer, el) {
896
896
  this.renderer = renderer;
@@ -965,11 +965,6 @@
965
965
  }
966
966
  }
967
967
  };
968
- TableComponent.prototype.ngOnInit = function () {
969
- if (this.selectionContext) {
970
- this.selectable = true;
971
- }
972
- };
973
968
  TableComponent.prototype.ngAfterContentInit = function () {
974
969
  var _this = this;
975
970
  this.hasMasterDetailRows = !!this.masterRows.length;
@@ -1093,7 +1088,7 @@
1093
1088
  sortable: [{ type: i0.HostBinding, args: ['class.is-sortable',] }, { type: i0.Input }],
1094
1089
  selectionContext: [{ type: i0.Input }],
1095
1090
  selectionToolbarTemplate: [{ type: i0.Input }],
1096
- selectable: [{ type: i0.HostBinding, args: ['class.is-selectable',] }],
1091
+ selectable: [{ type: i0.HostBinding, args: ['class.is-selectable',] }, { type: i0.Input }],
1097
1092
  isForm: [{ type: i0.HostBinding, args: ['class.is-form-table',] }, { type: i0.Input }],
1098
1093
  sort: [{ type: i0.Input }],
1099
1094
  sortChange: [{ type: i0.Output }],
@@ -5862,8 +5857,7 @@
5862
5857
  this.sortable = false;
5863
5858
  this.autofocus = false;
5864
5859
  /**Set to a space-separated set of strings that should be added to the ec-table class attribute
5865
- * this allows finer control over styling, including the ability to turn on selectable highlights
5866
- * by including is-selectable
5860
+ * this allows finer control over styling.
5867
5861
  */
5868
5862
  this.tableClasses = '';
5869
5863
  /** Emits when table sort has changed */
@@ -5938,6 +5932,8 @@
5938
5932
  this.searchboxReadonly = false;
5939
5933
  /** Optional text to add to the results count in the table footer. This text will be added after the count and objectType. */
5940
5934
  this.additionalCountText = '';
5935
+ /** Enables table row selection and row highlighting styles when true */
5936
+ this.selectable = false;
5941
5937
  /**
5942
5938
  * Text displayed in the footer.
5943
5939
  * Sometimes `noDataMessage`, sometimes `noSearchResultsMessage`
@@ -6087,7 +6083,7 @@
6087
6083
  SearchableTableComponent.decorators = [
6088
6084
  { type: i0.Component, args: [{
6089
6085
  selector: 'ec-searchable-table',
6090
- template: "<header *ngIf=\"!hideHeader\"\r\n class=\"d-flex flex-shrink align-items-center mb-3\">\r\n <ec-textbox id=\"{{id}}_searchbox\"\r\n *ngIf=\"!hideSearchControl\"\r\n class=\"mb-0 flex-grow mr-2\"\r\n [autofocus]=\"autofocus\"\r\n [formModel]=\"searchModel\"\r\n [tabindex]=\"searchboxTabIndex\"\r\n [placeholder]=\"searchboxPlaceholder\"\r\n [readonly]=\"searchboxReadonly\"></ec-textbox>\r\n <div class=\"flex-grow\">\r\n <ng-content select=\".searchable-table-controls\"></ng-content>\r\n </div>\r\n</header>\r\n<section id=\"{{id}}_card\"\r\n class=\"card m-0 d-flex flex-column bg-content\"\r\n [class.is-translucent]=\"status.status !== 'error'\"\r\n ecOverlay\r\n [status]=\"status.status\"\r\n [message]=\"status.message\"\r\n [displayAsMask]=\"true\">\r\n <ng-content select=\".card-header\"></ng-content>\r\n <ec-table id=\"{{id}}_table\"\r\n class=\"flex-shrink-max {{tableClasses}}\"\r\n [class.is-fixed]=\"tableLayoutFixed\"\r\n [sortable]=\"sortable\"\r\n [sort]=\"sort\"\r\n (sortChange)=\"onSortChange($event)\"\r\n [resizable]=\"resizable\"\r\n [scrollable]=\"true\"\r\n [selectionContext]=\"selectionContext\"\r\n [selectionToolbarTemplate]=\"selectionToolbarTemplate\"\r\n [resizableColumns]=\"resizableColumns\">\r\n <ng-content></ng-content>\r\n </ec-table>\r\n\r\n <!-- pagination footer visible if table is page-able and there are more than one page of results -->\r\n <footer *ngIf=\"!hideFooter && pageable && searchResults.totalItemsBeforePaging! > pageSize!\" class=\"d-flex flex-shrink align-items-center border-top\">\r\n <ec-table-pagination id=\"{{id}}_pager\"\r\n class=\"font-color-primary\"\r\n [totalItems]=\"searchResults.totalItemsBeforePaging\"\r\n [pageSize]=\"pageSize\"\r\n [maxTabs]=\"maxTabs\"\r\n [pageNumber]=\"pageInfo?.pageNumber\"\r\n (pageChanged)=\"onPageChange($event)\">\r\n </ec-table-pagination>\r\n <div id=\"resultsCount\"\r\n *ngIf=\"searchResults?.items?.length\"\r\n class=\"ml-auto mr-2 font-color-hint text-truncate\" \r\n title=\"{{resultsCount}} {{additionalCountText}}\">{{resultsCount}} {{additionalCountText}}</div>\r\n </footer>\r\n\r\n <!-- default footer: visible if hideFooter is false and table is not page-able or there are only one page of results (always shows if there is a caption to indicate no results) -->\r\n <footer *ngIf=\"(!hideFooter && (!pageable || searchResults.totalItemsBeforePaging! <= pageSize!)) || tableCaption\"\r\n class=\"p-2 d-flex\"\r\n [class.has-results]=\"searchResults?.items?.length\">\r\n <ng-content *ngIf=\"!tableCaption\"\r\n select=\".searchable-table-footer\"></ng-content>\r\n <div id=\"tableCaption\"\r\n *ngIf=\"tableCaption\"\r\n [innerHTML]=\"tableCaption\"></div>\r\n <div id=\"resultsCount\"\r\n *ngIf=\"searchResults?.items?.length\"\r\n class=\"ml-auto text-truncate\"\r\n title=\"{{resultsCount}} {{additionalCountText}}\">{{resultsCount}} {{additionalCountText}}</div>\r\n </footer>\r\n</section>",
6086
+ template: "<header *ngIf=\"!hideHeader\"\r\n class=\"d-flex flex-shrink align-items-center mb-3\">\r\n <ec-textbox id=\"{{id}}_searchbox\"\r\n *ngIf=\"!hideSearchControl\"\r\n class=\"mb-0 flex-grow mr-2\"\r\n [autofocus]=\"autofocus\"\r\n [formModel]=\"searchModel\"\r\n [tabindex]=\"searchboxTabIndex\"\r\n [placeholder]=\"searchboxPlaceholder\"\r\n [readonly]=\"searchboxReadonly\"></ec-textbox>\r\n <div class=\"flex-grow\">\r\n <ng-content select=\".searchable-table-controls\"></ng-content>\r\n </div>\r\n</header>\r\n<section id=\"{{id}}_card\"\r\n class=\"card m-0 d-flex flex-column bg-content\"\r\n [class.is-translucent]=\"status.status !== 'error'\"\r\n ecOverlay\r\n [status]=\"status.status\"\r\n [message]=\"status.message\"\r\n [displayAsMask]=\"true\">\r\n <ng-content select=\".card-header\"></ng-content>\r\n <ec-table id=\"{{id}}_table\"\r\n class=\"flex-shrink-max {{tableClasses}}\"\r\n [class.is-fixed]=\"tableLayoutFixed\"\r\n [sortable]=\"sortable\"\r\n [sort]=\"sort\"\r\n (sortChange)=\"onSortChange($event)\"\r\n [resizable]=\"resizable\"\r\n [scrollable]=\"true\"\r\n [selectable]=\"selectable\"\r\n [selectionContext]=\"selectionContext\"\r\n [selectionToolbarTemplate]=\"selectionToolbarTemplate\"\r\n [resizableColumns]=\"resizableColumns\">\r\n <ng-content></ng-content>\r\n </ec-table>\r\n\r\n <!-- pagination footer visible if table is page-able and there are more than one page of results -->\r\n <footer *ngIf=\"!hideFooter && pageable && searchResults.totalItemsBeforePaging! > pageSize!\" class=\"d-flex flex-shrink align-items-center border-top\">\r\n <ec-table-pagination id=\"{{id}}_pager\"\r\n class=\"font-color-primary\"\r\n [totalItems]=\"searchResults.totalItemsBeforePaging\"\r\n [pageSize]=\"pageSize\"\r\n [maxTabs]=\"maxTabs\"\r\n [pageNumber]=\"pageInfo?.pageNumber\"\r\n (pageChanged)=\"onPageChange($event)\">\r\n </ec-table-pagination>\r\n <div id=\"resultsCount\"\r\n *ngIf=\"searchResults?.items?.length\"\r\n class=\"ml-auto mr-2 font-color-hint text-truncate\" \r\n title=\"{{resultsCount}} {{additionalCountText}}\">{{resultsCount}} {{additionalCountText}}</div>\r\n </footer>\r\n\r\n <!-- default footer: visible if hideFooter is false and table is not page-able or there are only one page of results (always shows if there is a caption to indicate no results) -->\r\n <footer *ngIf=\"(!hideFooter && (!pageable || searchResults.totalItemsBeforePaging! <= pageSize!)) || tableCaption\"\r\n class=\"p-2 d-flex\"\r\n [class.has-results]=\"searchResults?.items?.length\">\r\n <ng-content *ngIf=\"!tableCaption\"\r\n select=\".searchable-table-footer\"></ng-content>\r\n <div id=\"tableCaption\"\r\n *ngIf=\"tableCaption\"\r\n [innerHTML]=\"tableCaption\"></div>\r\n <div id=\"resultsCount\"\r\n *ngIf=\"searchResults?.items?.length\"\r\n class=\"ml-auto text-truncate\"\r\n title=\"{{resultsCount}} {{additionalCountText}}\">{{resultsCount}} {{additionalCountText}}</div>\r\n </footer>\r\n</section>",
6091
6087
  styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}:host{display:flex;flex:1 1;flex-direction:column;min-height:0}footer{font-size:.75rem;line-height:1rem}footer.has-results{border-top:1px solid rgba(26,26,35,.18);color:rgba(26,26,35,.38);text-align:right}"]
6092
6088
  },] }
6093
6089
  ];
@@ -6128,7 +6124,8 @@
6128
6124
  selectionContext: [{ type: i0.Input }],
6129
6125
  selectionToolbarTemplate: [{ type: i0.Input }],
6130
6126
  resizableColumns: [{ type: i0.ContentChildren, args: [ResizableColumnComponent, { descendants: true },] }],
6131
- additionalCountText: [{ type: i0.Input }]
6127
+ additionalCountText: [{ type: i0.Input }],
6128
+ selectable: [{ type: i0.Input }]
6132
6129
  };
6133
6130
 
6134
6131
  /**
@@ -6791,6 +6788,7 @@
6791
6788
  function TableSelectableRowComponent() {
6792
6789
  /**The ID root to use for the checkbox and table cell */
6793
6790
  this.id = '';
6791
+ this._enabled = true;
6794
6792
  /*Required for all rows. The row index this component represents, to allow it to know how to handle shift+clicks.
6795
6793
  Defaults to -1 which will cause the directive to behave as a header row*/
6796
6794
  this.rowIndex = -1;
@@ -6809,6 +6807,13 @@
6809
6807
  /**Sends an event when the component is destroyed so that it can unsubscribe from any observables */
6810
6808
  this.destroyed = new rxjs.Subject();
6811
6809
  }
6810
+ Object.defineProperty(TableSelectableRowComponent.prototype, "enabled", {
6811
+ get: function () { return this._enabled; },
6812
+ /** Disables the selection functionality when false */
6813
+ set: function (value) { this._enabled = value !== false; },
6814
+ enumerable: false,
6815
+ configurable: true
6816
+ });
6812
6817
  /**Validate and populate the context as the table is dynamically built. Because the context is shared between the
6813
6818
  * header and each of the rows, changes to it can be used to determine what is happening and hook up the correct
6814
6819
  * subscriptions for selectAll. The user can provide an existing formArray for the rows and form control for the header,
@@ -6838,6 +6843,9 @@
6838
6843
  this.formControl = this.context.rowCheckboxes.at(this.rowIndex);
6839
6844
  this.checkboxAttributeID = this.id + "_row" + this.rowIndex + "_ecCheckbox";
6840
6845
  }
6846
+ if (changes.enabled && !this.enabled) {
6847
+ this.formControl.setValue(false);
6848
+ }
6841
6849
  };
6842
6850
  /** Tell the header checkbox to refresh the selectAll subscription because a row was removed*/
6843
6851
  TableSelectableRowComponent.prototype.ngOnDestroy = function () {
@@ -6857,7 +6865,7 @@
6857
6865
  */
6858
6866
  TableSelectableRowComponent.prototype.rowClicked = function (event) {
6859
6867
  var _a, _b, _c;
6860
- if (!this.isHeader) {
6868
+ if (!this.isHeader && this.enabled) {
6861
6869
  var targetEl = event === null || event === void 0 ? void 0 : event.target;
6862
6870
  var isCheckboxClick = (_c = (_b = (_a = targetEl === null || targetEl === void 0 ? void 0 : targetEl.classList) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === null || _c === void 0 ? void 0 : _c.includes('row-checkbox');
6863
6871
  //normally clicking on a row checks only that row and unchecks everything else.
@@ -6933,12 +6941,13 @@
6933
6941
  TableSelectableRowComponent.decorators = [
6934
6942
  { type: i0.Component, args: [{
6935
6943
  selector: '[ecTableSelectableRow]',
6936
- template: "<!-- any elements of the existing table row that must go before the row selection checkbox can be marked with a class of before-checkbox -->\r\n<ng-content select=\".before-checkbox\"></ng-content>\r\n<th *ngIf=\"isHeader\"\r\n class=\"checkbox\"\r\n [ecTableLockedColumn]=\"lockedColOptions\">\r\n <ec-checkbox id=\"{{id}}_selectAll\"\r\n class=\"m-0\"\r\n *ngIf=\"context?.selectAllCheckbox\"\r\n [formModel]=\"context?.selectAllCheckbox\"\r\n [dependentCheckboxesGroup]=\"dependentCheckboxesReference\">\r\n </ec-checkbox>\r\n</th>\r\n<td *ngIf=\"!isHeader && formControl\" \r\n class=\"checkbox\"\r\n [ecTableLockedColumn]=\"lockedColOptions\">\r\n <ec-checkbox id=\"{{id}}_row{{rowIndex}}_checkbox\"\r\n [attr.id]=\"checkboxAttributeID\"\r\n class=\"m-0 row-checkbox\"\r\n [formModel]=\"formControl\">\r\n </ec-checkbox>\r\n</td>\r\n<!-- The rest of the table row -->\r\n<ng-content></ng-content>\r\n",
6937
- styles: [":host:not(.is-header){cursor:pointer}:host .checkbox{padding-left:1px;padding-right:1px;width:1.125rem}:host .checkbox:first-child{padding-left:.5rem;width:1.5625rem}td.checkbox ec-checkbox ::ng-deep *{pointer-events:none}"]
6944
+ template: "<!-- any elements of the existing table row that must go before the row selection checkbox can be marked with a class of before-checkbox -->\r\n<ng-content select=\".before-checkbox\"></ng-content>\r\n<ng-container *ngIf=\"enabled\">\r\n <th *ngIf=\"isHeader\"\r\n class=\"checkbox\"\r\n [ecTableLockedColumn]=\"lockedColOptions\">\r\n <ec-checkbox id=\"{{id}}_selectAll\"\r\n class=\"m-0\"\r\n *ngIf=\"context?.selectAllCheckbox\"\r\n [formModel]=\"context?.selectAllCheckbox\"\r\n [dependentCheckboxesGroup]=\"dependentCheckboxesReference\">\r\n </ec-checkbox>\r\n </th>\r\n <td *ngIf=\"!isHeader && formControl\"\r\n class=\"checkbox\"\r\n [ecTableLockedColumn]=\"lockedColOptions\">\r\n <ec-checkbox id=\"{{id}}_row{{rowIndex}}_checkbox\"\r\n [attr.id]=\"checkboxAttributeID\"\r\n class=\"m-0 row-checkbox\"\r\n [formModel]=\"formControl\">\r\n </ec-checkbox>\r\n </td>\r\n</ng-container>\r\n<!-- The rest of the table row -->\r\n<ng-content></ng-content>",
6945
+ styles: [":host.is-enabled:not(.is-header){cursor:pointer}:host .checkbox{padding-left:1px;padding-right:1px;width:1.125rem}:host .checkbox:first-child{padding-left:.5rem;width:1.5625rem}td.checkbox ec-checkbox ::ng-deep *{pointer-events:none}"]
6938
6946
  },] }
6939
6947
  ];
6940
6948
  TableSelectableRowComponent.propDecorators = {
6941
6949
  id: [{ type: i0.HostBinding, args: ['attr.id',] }, { type: i0.Input }],
6950
+ enabled: [{ type: i0.HostBinding, args: ['class.is-enabled',] }, { type: i0.Input, args: ['ecTableSelectableRow',] }],
6942
6951
  context: [{ type: i0.Input, args: ['selectionContext',] }],
6943
6952
  rowIndex: [{ type: i0.Input }],
6944
6953
  lockedColOptions: [{ type: i0.Input }],
@@ -7622,7 +7631,7 @@
7622
7631
  ToastComponent.decorators = [
7623
7632
  { type: i0.Component, args: [{
7624
7633
  selector: 'ec-toast',
7625
- template: "<ec-banner id=\"{{toastItem?.id}}_banner\"\r\n [type]=\"toastItem?.type\"\r\n bannerStyle=\"toast\"\r\n [customIcon]=\"toastItem?.icon\"\r\n [showCloseBtn]=\"toastItem?.dismissible\"\r\n [autoHideOnClose]=\"false\"\r\n (closed)=\"closeClicked()\">\r\n <div class=\"d-flex\">\r\n <p id=\"{{toastItem?.id}}_message\"\r\n class=\"mb-0\">{{toastItem?.message}}</p>\r\n <a id=\"{{toastItem?.id}}_action\"\r\n *ngIf=\"toastItem?.action && toastItem?.actionLabel\"\r\n class=\"text-link ml-2\"\r\n (click)=\"toastItem!.action!()\">{{toastItem?.actionLabel | translate}}</a>\r\n </div>\r\n</ec-banner>",
7634
+ template: "<ec-banner id=\"{{toastItem?.id}}_banner\"\r\n [type]=\"toastItem?.type\"\r\n bannerStyle=\"toast\"\r\n [customIcon]=\"toastItem?.icon\"\r\n [showCloseBtn]=\"toastItem?.dismissible\"\r\n [autoHideOnClose]=\"false\"\r\n (closed)=\"closeClicked()\">\r\n <div class=\"d-flex\">\r\n <div id=\"{{toastItem?.id}}_message\"\r\n [innerHTML]=\"toastItem?.message | translate\"></div>\r\n <a id=\"{{toastItem?.id}}_action\"\r\n *ngIf=\"toastItem?.action && toastItem?.actionLabel\"\r\n class=\"text-link ml-2\"\r\n (click)=\"toastItem!.action!()\">{{toastItem?.actionLabel | translate}}</a>\r\n </div>\r\n</ec-banner>",
7626
7635
  styles: [":host{bottom:0;display:block;left:50%;position:fixed;transform:translate(-50%,150%);transition:transform var(--toast-animation-duration,.25s);transition-timing-function:ease-in;z-index:70}:host.is-open{transform:translate(-50%,calc(var(--toast-bottom, 0rem)*-1 - 1.5rem));transition-timing-function:cubic-bezier(.18,.89,.32,1.28)}"]
7627
7636
  },] }
7628
7637
  ];