@energycap/components 0.30.1 → 0.30.2

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.
@@ -6196,13 +6196,21 @@ class TableSelectableRowContext {
6196
6196
  * without replacing the actual FormArray that the hosting component may be subscribed to for changes
6197
6197
  */
6198
6198
  this.rowAddedOrRemoved = new Subject();
6199
+ /**
6200
+ * Set to true to disable Shift-Click/Ctrl-Click functionality
6201
+ */
6202
+ this.disableAdvancedRowClickBehavior = false;
6203
+ /**
6204
+ * Set to list of indices of controls that should not toggle when master/header checkbox toggles
6205
+ */
6206
+ this.nonDependentCheckboxes = [];
6199
6207
  }
6200
6208
  }
6201
6209
  class TableSelectableRowComponent {
6202
6210
  constructor() {
6203
6211
  /**The ID root to use for the checkbox and table cell */
6204
6212
  this.id = '';
6205
- this._enabled = true;
6213
+ this._selectionEnabled = true;
6206
6214
  /*Required for all rows. The row index this component represents, to allow it to know how to handle shift+clicks.
6207
6215
  Defaults to -1 which will cause the directive to behave as a header row*/
6208
6216
  this.rowIndex = -1;
@@ -6210,10 +6218,17 @@ class TableSelectableRowComponent {
6210
6218
  * if the checkbox is not the first column in the table
6211
6219
  */
6212
6220
  this.lockedColOptions = { border: false, left: 0 };
6213
- /**Automatically set to true based on checkbox state, used to highlight the row to match our table selected row styles */
6221
+ /** Automatically set to true based on checkbox state, used to highlight the row to match our table selected row styles */
6214
6222
  this.isSelected = false;
6215
- /**automatically set to true if no rowIndex is provided or the row index is less than zero */
6223
+ /** Automatically set to true if no rowIndex is provided or the row index is less than zero */
6216
6224
  this.isHeader = false;
6225
+ /**
6226
+ * Set to true if you want the checkbox to be disabled.
6227
+ *
6228
+ * When you use this property, make sure you set `disableAdvancedRowClickBehavior: true`
6229
+ * in the `TableSelectableRowContext`, or undesired side-effects will occur.
6230
+ */
6231
+ this.isCheckboxDisabled = false;
6217
6232
  /* A reference that we can change when a control is replaced to force the master checkbox reference to update
6218
6233
  without also replacing the form array that the host component may be watching for selected row changes */
6219
6234
  this.dependentCheckboxesReference = { controls: [] };
@@ -6222,13 +6237,13 @@ class TableSelectableRowComponent {
6222
6237
  this.destroyed = new Subject();
6223
6238
  }
6224
6239
  /** Disables the selection functionality when false */
6225
- set enabled(value) { this._enabled = value !== false; }
6226
- get enabled() { return this._enabled; }
6240
+ set isSelectionEnabled(value) { this._selectionEnabled = value !== false; }
6241
+ get isSelectionEnabled() { return this._selectionEnabled; }
6227
6242
  /**Validate and populate the context as the table is dynamically built. Because the context is shared between the
6228
- * header and each of the rows, changes to it can be used to determine what is happening and hook up the correct
6229
- * subscriptions for selectAll. The user can provide an existing formArray for the rows and form control for the header,
6230
- * or it can just be the default empty ones created by the context class.
6231
- */
6243
+ * header and each of the rows, changes to it can be used to determine what is happening and hook up the correct
6244
+ * subscriptions for selectAll. The user can provide an existing formArray for the rows and form control for the header,
6245
+ * or it can just be the default empty ones created by the context class.
6246
+ */
6232
6247
  ngOnInit() {
6233
6248
  var _a, _b, _c;
6234
6249
  this.isHeader = this.rowIndex < 0;
@@ -6254,7 +6269,7 @@ class TableSelectableRowComponent {
6254
6269
  this.formControl = this.context.rowCheckboxes.at(this.rowIndex);
6255
6270
  this.checkboxAttributeID = `${this.id}_row${this.rowIndex}_ecCheckbox`;
6256
6271
  }
6257
- if (changes.enabled && !this.enabled && ((_a = this.formControl) === null || _a === void 0 ? void 0 : _a.value) === true) {
6272
+ if (changes.isSelectionEnabled && !this.isSelectionEnabled && ((_a = this.formControl) === null || _a === void 0 ? void 0 : _a.value) === true) {
6258
6273
  this.formControl.setValue(false);
6259
6274
  }
6260
6275
  if (changes.isSelected && this.formControl) {
@@ -6277,19 +6292,13 @@ class TableSelectableRowComponent {
6277
6292
  * Handle shift and control select as well as checkbox click like windows explorer or the original bill lists do.
6278
6293
  */
6279
6294
  rowClicked(event) {
6280
- var _a, _b, _c;
6281
- if (!this.isHeader && this.enabled) {
6295
+ if (!this.isHeader && this.isSelectionEnabled && !this.isCheckboxDisabled) {
6282
6296
  let targetEl = event === null || event === void 0 ? void 0 : event.target;
6283
- let 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');
6284
- //normally clicking on a row checks only that row and unchecks everything else.
6285
- //If the user wants to instead add that row to the current selection, they can either hold the control key or
6286
- //use the row checkbox.
6287
- if (!event.ctrlKey && !isCheckboxClick) {
6288
- this.clearAllRows();
6289
- }
6290
6297
  //clicking on a row always toggles that row. Sometimes the shift-select will toggle it back
6291
6298
  this.formControl.setValue(!this.formControl.value);
6292
- this.handleShiftSelect(event);
6299
+ if (!this.context.disableAdvancedRowClickBehavior) {
6300
+ this.handleShiftSelect(event);
6301
+ }
6293
6302
  }
6294
6303
  }
6295
6304
  watchForChanges() {
@@ -6299,13 +6308,20 @@ class TableSelectableRowComponent {
6299
6308
  if (this.isHeader) {
6300
6309
  this.context.rowAddedOrRemoved.pipe(debounceTime(10), takeUntil(this.destroyed)).subscribe(() => {
6301
6310
  this.context.lastClickedIndex = -1;
6302
- this.dependentCheckboxesReference = { controls: this.context.rowCheckboxes.controls };
6311
+ // exclude nonDependentCheckboxes (some may not be allowed to be deselected)
6312
+ let dependentCheckboxes = [];
6313
+ this.context.rowCheckboxes.controls.forEach((control, index) => {
6314
+ if (!this.context.nonDependentCheckboxes.includes(index)) {
6315
+ dependentCheckboxes.push(control);
6316
+ }
6317
+ });
6318
+ this.dependentCheckboxesReference = { controls: dependentCheckboxes };
6303
6319
  });
6304
6320
  }
6305
6321
  else {
6306
6322
  this.context.rowAddedOrRemoved.next();
6307
6323
  //watch for the checkbox state to change on a child row and set the row isSelected class / highlight to match
6308
- //this way the rows match even if external code updates the form model
6324
+ //this way the rows match even if external code updates the form model
6309
6325
  (_a = this.formControl) === null || _a === void 0 ? void 0 : _a.valueChanges.pipe(takeUntil(this.destroyed)).subscribe((value) => {
6310
6326
  this.isSelected = value;
6311
6327
  });
@@ -6352,18 +6368,19 @@ class TableSelectableRowComponent {
6352
6368
  TableSelectableRowComponent.decorators = [
6353
6369
  { type: Component, args: [{
6354
6370
  selector: '[ecTableSelectableRow]',
6355
- 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>",
6371
+ 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=\"isSelectionEnabled\">\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 [ignoreDisabledDependents]=\"false\">\r\n </ec-checkbox>\r\n </th>\r\n <td *ngIf=\"!isHeader && formControl\"\r\n class=\"checkbox\"\r\n [ecTableLockedColumn]=\"lockedColOptions\">\r\n <!-- Use [readonly] and not [disabled] for isCheckboxDisabled to prevent user interaction\r\n and allow the value to be visible to other components (for example, when they subscribe\r\n to valueChanges on the FormArray that contains all the checkbox FormControls). -->\r\n <ec-checkbox id=\"{{id}}_row{{rowIndex}}_checkbox\"\r\n [readonly]=\"isCheckboxDisabled\"\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>",
6356
6372
  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}:host.border-bottom-0 .checkbox{border-bottom:0}td.checkbox ec-checkbox ::ng-deep *{pointer-events:none}th.checkbox{vertical-align:var(--ec-table-selectable-row-vertical-align-checkbox-th,middle)}td.checkbox{vertical-align:var(--ec-table-selectable-row-vertical-align-checkbox-td,top)}"]
6357
6373
  },] }
6358
6374
  ];
6359
6375
  TableSelectableRowComponent.propDecorators = {
6360
6376
  id: [{ type: HostBinding, args: ['attr.id',] }, { type: Input }],
6361
- enabled: [{ type: HostBinding, args: ['class.is-enabled',] }, { type: Input, args: ['ecTableSelectableRow',] }],
6377
+ isSelectionEnabled: [{ type: HostBinding, args: ['class.is-enabled',] }, { type: Input, args: ['ecTableSelectableRow',] }],
6362
6378
  context: [{ type: Input, args: ['selectionContext',] }],
6363
6379
  rowIndex: [{ type: Input }],
6364
6380
  lockedColOptions: [{ type: Input }],
6365
6381
  isSelected: [{ type: HostBinding, args: ['class.is-selected',] }, { type: Input }],
6366
6382
  isHeader: [{ type: HostBinding, args: ['class.is-header',] }],
6383
+ isCheckboxDisabled: [{ type: Input }],
6367
6384
  rowClicked: [{ type: HostListener, args: ['click', ['$event'],] }]
6368
6385
  };
6369
6386
 
@@ -8156,6 +8173,10 @@ class ItemPickerSelectableContext extends TableSelectableRowContext {
8156
8173
  * the available/selected lists
8157
8174
  */
8158
8175
  this.selectedItemsMapChanged = new Subject();
8176
+ /**
8177
+ * AdvancedRowClickBehavior is disabled for ItemPicker.
8178
+ */
8179
+ this.disableAdvancedRowClickBehavior = true;
8159
8180
  }
8160
8181
  }
8161
8182
  class ItemPickerComponent {
@@ -8180,6 +8201,8 @@ class ItemPickerComponent {
8180
8201
  * update this gets set to the values
8181
8202
  */
8182
8203
  this.selectedItems = [];
8204
+ /** True if there are selected items and at least one can be removed */
8205
+ this.selectedItemsClearable = false;
8183
8206
  /** Track by used for the searchable table rows */
8184
8207
  this.trackByIndex = (index) => index;
8185
8208
  this.tableStatus = new Overlay('pending');
@@ -8201,26 +8224,44 @@ class ItemPickerComponent {
8201
8224
  this.destroyed.unsubscribe();
8202
8225
  }
8203
8226
  /**
8204
- * Called by the searchable table when a new set of items are returned from the getItems call
8205
- * @param results
8227
+ * Called by the searchable table when a new set of items are returned from the getItems call.
8228
+ * If any of the items have `preventRemove` set, their indices are added to the context.
8206
8229
  */
8207
8230
  onItemsChange(results) {
8208
- // Check to see if any of the items are marked to be selected by default and if so
8209
- // add them to the map.
8210
- results.items.forEach(item => {
8231
+ let newNonDependentCheckboxes = [];
8232
+ results.items.forEach((item, index) => {
8211
8233
  var _a, _b;
8234
+ // Check to see if any of the items are marked to be selected by default and if so
8235
+ // add them to the map.
8212
8236
  if (item.defaultSelected && !((_a = this.selectionContext) === null || _a === void 0 ? void 0 : _a.selectedItemsMap.has(item.id))) {
8213
8237
  (_b = this.selectionContext) === null || _b === void 0 ? void 0 : _b.selectedItemsMap.set(item.id, item);
8214
8238
  }
8239
+ // Check to see if any of the items are marked to prevent Removal, and if so
8240
+ // add them to the non-dependent checkboxes array. This will prevent the master
8241
+ // checkbox from toggling them.
8242
+ if (item.preventRemove) {
8243
+ newNonDependentCheckboxes.push(index);
8244
+ }
8215
8245
  });
8246
+ this.selectionContext.nonDependentCheckboxes = newNonDependentCheckboxes;
8216
8247
  this.availableItems = results.items;
8217
8248
  }
8218
8249
  /**
8219
8250
  * Called when the clear selection link button is clicked
8220
8251
  */
8221
8252
  onClearSelectionClick() {
8222
- this.selectionContext.selectedItemsMap = new Map();
8223
- this.selectionContext.rowCheckboxes.controls.forEach(control => control.setValue(false));
8253
+ // Remove removable items from map
8254
+ // This is safe. See https://stackoverflow.com/questions/35940216/es6-is-it-dangerous-to-delete-elements-from-set-map-during-set-map-iteration
8255
+ for (const [key, val] of this.selectionContext.selectedItemsMap) {
8256
+ if (!val.preventRemove) {
8257
+ this.selectionContext.selectedItemsMap.delete(key);
8258
+ }
8259
+ }
8260
+ this.selectionContext.rowCheckboxes.controls.forEach((control, index) => {
8261
+ if (!this.availableItems[index].preventRemove) {
8262
+ control.setValue(false);
8263
+ }
8264
+ });
8224
8265
  this.selectedItems = Array.from(this.selectionContext.selectedItemsMap.values());
8225
8266
  }
8226
8267
  /**
@@ -8263,6 +8304,7 @@ class ItemPickerComponent {
8263
8304
  }
8264
8305
  });
8265
8306
  this.selectedItems = Array.from((_a = this.selectionContext) === null || _a === void 0 ? void 0 : _a.selectedItemsMap.values());
8307
+ this.selectedItemsClearable = this.selectedItems.length > 0 && this.selectedItems.some(i => !i.preventRemove);
8266
8308
  });
8267
8309
  }
8268
8310
  /**
@@ -8306,7 +8348,7 @@ class ItemPickerComponent {
8306
8348
  ItemPickerComponent.decorators = [
8307
8349
  { type: Component, args: [{
8308
8350
  selector: 'ec-item-picker',
8309
- template: "<div ecOverlay\r\n class=\"d-flex flex-grow card\"\r\n [status]=\"tableStatus?.status\"\r\n [message]=\"tableStatus?.message\"\r\n [displayAsMask]=\"true\">\r\n <ec-searchable-table id=\"{{id}}_searchableTable\"\r\n class=\"flex-grow\"\r\n [fillParentHeight]=\"true\"\r\n [hideHeader]=\"true\"\r\n [hideSearchControl]=\"true\"\r\n [removeCard]=\"true\"\r\n [pageable]=\"true\"\r\n [pageSize]=\"50\"\r\n [objectType]=\"itemName\"\r\n [formModel]=\"formModel\"\r\n [ready]=\"ready\"\r\n [getItems]=\"getItems\"\r\n [selectable]=\"true\"\r\n [noDataMessage]=\"noDataMessage\"\r\n [selectionContext]=\"selectionContext\"\r\n [status]=\"tableStatus\"\r\n (itemsChange)=\"onItemsChange($event)\"\r\n [style.--ec-searchable-table-flex-properties]=\"(availableItems.length || tableStatus.status === 'pending' || tableStatus.status === 'error' ) ? '1 1 auto' : '0 1 auto'\"\r\n [style.--ec-searchable-table-height-caption-footer]=\"'calc(2.5rem + 1px)'\"\r\n [tableLayoutFixed]=\"true\">\r\n <header *ngIf=\"customAvailableHeaderTemplate\"\r\n class=\"card-header flex-shrink\"\r\n style=\"height: 3rem;\">\r\n <h3 class=\"card-title\">{{availableTitle | translate}}</h3>\r\n </header>\r\n <thead>\r\n <tr ecTableSelectableRow\r\n [selectionContext]=\"selectionContext\"\r\n class=\"border-bottom-0\">\r\n <ng-container *ngTemplateOutlet=\"internalizedAvailableHeaderTemplate;\"></ng-container>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <ng-container *ngFor=\"let item of availableItems; index as rowIndex; trackBy: trackByIndex\">\r\n <tr ecTableSelectableRow\r\n [selectionContext]=\"selectionContext\"\r\n [rowIndex]=\"rowIndex\"\r\n [isSelected]=\"selectionContext?.selectedItemsMap.has(item.id)\"\r\n [style.--ec-table-selectable-row-vertical-align-checkbox-td]=\"'middle'\">\r\n <ng-container *ngTemplateOutlet=\"internalizedAvailableItemTemplate; context: {$implicit: item}\">\r\n </ng-container>\r\n </tr>\r\n </ng-container>\r\n </tbody>\r\n </ec-searchable-table>\r\n\r\n <section class=\"selected-items flex-grow d-flex flex-column\">\r\n <ec-table [scrollable]=\"true\"\r\n class=\"flex-grow is-fixed\">\r\n <colgroup>\r\n <col>\r\n <col style=\"width: 2rem;\">\r\n </colgroup>\r\n <thead>\r\n <tr style=\"height: 3rem;\">\r\n <th colspan=\"2\"\r\n class=\"p-2 border-bottom-0\">\r\n <div class=\"d-flex align-items-center\">\r\n <span class=\"text-heading-2 font-color-primary flex-grow text-truncate\">{{selectedTitle | translate}}</span>\r\n <a *ngIf=\"selectedItems.length\"\r\n id=\"{{id}}_clearSelection\"\r\n class=\"pl-2 ml-auto font-size-base\"\r\n href=\"javascript:void(0)\"\r\n (click)=\"onClearSelectionClick()\"\r\n translate>ClearSelection_TC</a>\r\n </div>\r\n </th>\r\n </tr>\r\n </thead>\r\n\r\n <tbody>\r\n <ng-container *ngIf=\"selectedItems.length\">\r\n <tr *ngFor=\"let item of selectedItems; last as isLast\"\r\n [class.border-bottom]=\"!isLast\">\r\n <td class=\"p-2\">\r\n <ng-container\r\n *ngTemplateOutlet=\"internalizedSelectedItemTemplate; context: {$implicit: item}\">\r\n </ng-container>\r\n </td>\r\n\r\n <td class=\"actions-col text-right\"\r\n style=\"vertical-align: middle;\">\r\n <ec-button id=\"{{id}}_removeSelected_{{item.id}}\"\r\n type=\"icon\"\r\n icon=\"ec-icon icon-cancel\"\r\n (clicked)=\"removeSelectedItem(item)\">\r\n </ec-button>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n <tr *ngIf=\"!selectedItems.length\">\r\n <td *ngIf=\"!noSelectedItemsMessage\"\r\n colspan=\"2\"\r\n class=\"p-2 no-data-message\"\r\n translate\r\n [translateParams]=\"{itemName: itemName | translate}\">ItemPickerNoItemsSelected_SC</td>\r\n <td *ngIf=\"noSelectedItemsMessage\"\r\n colspan=\"2\"\r\n class=\"p-2 no-data-message\"\r\n translate>{{noSelectedItemsMessage}}</td>\r\n </tr>\r\n </tbody>\r\n </ec-table>\r\n\r\n <footer *ngIf=\"selectedItems.length\"\r\n class=\"d-flex flex-shrink px-2 border-top align-items-center\"\r\n style=\"height: calc(2.5rem + 1px);\">\r\n <span class=\"ml-auto text-caption-1 font-color-hint\">\r\n {{selectedItems.length}} {{itemName | translate}}\r\n </span>\r\n </footer>\r\n </section>\r\n</div>\r\n\r\n<ng-template #defaultAvailableHeaderTemplate>\r\n <th class=\"text-heading-2 font-color-primary border-bottom-0\">{{availableTitle | translate}}</th>\r\n</ng-template>\r\n\r\n<ng-template #defaultAvailableItemTemplate\r\n let-item>\r\n <td>{{item.label}}</td>\r\n</ng-template>\r\n\r\n<ng-template #defaultSelectedItemTemplate\r\n let-item>\r\n {{item.label}}\r\n</ng-template>",
8351
+ template: "<div ecOverlay\r\n class=\"d-flex flex-grow card\"\r\n [status]=\"tableStatus?.status\"\r\n [message]=\"tableStatus?.message\"\r\n [displayAsMask]=\"true\">\r\n <ec-searchable-table id=\"{{id}}_searchableTable\"\r\n class=\"flex-grow\"\r\n [fillParentHeight]=\"true\"\r\n [hideHeader]=\"true\"\r\n [hideSearchControl]=\"true\"\r\n [removeCard]=\"true\"\r\n [pageable]=\"true\"\r\n [pageSize]=\"50\"\r\n [objectType]=\"itemName\"\r\n [formModel]=\"formModel\"\r\n [ready]=\"ready\"\r\n [getItems]=\"getItems\"\r\n [selectable]=\"true\"\r\n [noDataMessage]=\"noDataMessage\"\r\n [selectionContext]=\"selectionContext\"\r\n [status]=\"tableStatus\"\r\n (itemsChange)=\"onItemsChange($event)\"\r\n [style.--ec-searchable-table-flex-properties]=\"(availableItems.length || tableStatus.status === 'pending' || tableStatus.status === 'error' ) ? '1 1 auto' : '0 1 auto'\"\r\n [style.--ec-searchable-table-height-caption-footer]=\"'calc(2.5rem + 1px)'\"\r\n [tableLayoutFixed]=\"true\">\r\n <header *ngIf=\"customAvailableHeaderTemplate\"\r\n class=\"card-header flex-shrink\"\r\n style=\"height: 3rem;\">\r\n <h3 class=\"card-title\">{{availableTitle | translate}}</h3>\r\n </header>\r\n <thead>\r\n <tr ecTableSelectableRow\r\n [selectionContext]=\"selectionContext\"\r\n class=\"border-bottom-0\">\r\n <ng-container *ngTemplateOutlet=\"internalizedAvailableHeaderTemplate;\"></ng-container>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <ng-container *ngFor=\"let item of availableItems; index as rowIndex; trackBy: trackByIndex\">\r\n <tr ecTableSelectableRow\r\n [selectionContext]=\"selectionContext\"\r\n [rowIndex]=\"rowIndex\"\r\n [isCheckboxDisabled]=\"item.preventRemove\"\r\n [isSelected]=\"selectionContext?.selectedItemsMap.has(item.id)\"\r\n [style.--ec-table-selectable-row-vertical-align-checkbox-td]=\"'middle'\">\r\n <ng-container *ngTemplateOutlet=\"internalizedAvailableItemTemplate; context: {$implicit: item}\">\r\n </ng-container>\r\n </tr>\r\n </ng-container>\r\n </tbody>\r\n </ec-searchable-table>\r\n\r\n <section id=\"{{id}}_selectedItems\" class=\"selected-items flex-grow d-flex flex-column\">\r\n <ec-table [scrollable]=\"true\"\r\n class=\"flex-grow is-fixed\">\r\n <colgroup>\r\n <col>\r\n <col style=\"width: 2rem;\">\r\n </colgroup>\r\n <thead>\r\n <tr style=\"height: 3rem;\">\r\n <th colspan=\"2\"\r\n class=\"p-2 border-bottom-0\">\r\n <div class=\"d-flex align-items-center\">\r\n <span class=\"text-heading-2 font-color-primary flex-grow text-truncate\">{{selectedTitle | translate}}</span>\r\n <a *ngIf=\"selectedItemsClearable\"\r\n id=\"{{id}}_clearSelection\"\r\n class=\"pl-2 ml-auto font-size-base\"\r\n href=\"javascript:void(0)\"\r\n (click)=\"onClearSelectionClick()\"\r\n translate>ClearSelection_TC</a>\r\n </div>\r\n </th>\r\n </tr>\r\n </thead>\r\n\r\n <tbody>\r\n <ng-container *ngIf=\"selectedItems.length\">\r\n <tr *ngFor=\"let item of selectedItems; last as isLast\"\r\n id=\"selected_row_{{item.id}}\"\r\n [class.border-bottom]=\"!isLast\">\r\n <td class=\"p-2\">\r\n <ng-container\r\n *ngTemplateOutlet=\"internalizedSelectedItemTemplate; context: {$implicit: item}\">\r\n </ng-container>\r\n </td>\r\n\r\n <td class=\"actions-col text-right\"\r\n style=\"vertical-align: middle;\">\r\n <ec-button id=\"{{id}}_removeSelected_{{item.id}}\"\r\n *ngIf=\"!item.preventRemove\"\r\n type=\"icon\"\r\n icon=\"ec-icon icon-cancel\"\r\n (clicked)=\"removeSelectedItem(item)\">\r\n </ec-button>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n <tr *ngIf=\"!selectedItems.length\">\r\n <td *ngIf=\"!noSelectedItemsMessage\"\r\n colspan=\"2\"\r\n class=\"p-2 no-data-message\"\r\n translate\r\n [translateParams]=\"{itemName: itemName | translate}\">ItemPickerNoItemsSelected_SC</td>\r\n <td *ngIf=\"noSelectedItemsMessage\"\r\n colspan=\"2\"\r\n class=\"p-2 no-data-message\"\r\n translate>{{noSelectedItemsMessage}}</td>\r\n </tr>\r\n </tbody>\r\n </ec-table>\r\n\r\n <footer id=\"selectedItemsFooter\"\r\n *ngIf=\"selectedItems.length\"\r\n class=\"d-flex flex-shrink px-2 border-top align-items-center\"\r\n style=\"height: calc(2.5rem + 1px);\">\r\n <span class=\"ml-auto text-caption-1 font-color-hint\">\r\n {{selectedItems.length}} {{itemName | translate}}\r\n </span>\r\n </footer>\r\n </section>\r\n</div>\r\n\r\n<ng-template #defaultAvailableHeaderTemplate>\r\n <th class=\"text-heading-2 font-color-primary border-bottom-0\">{{availableTitle | translate}}</th>\r\n</ng-template>\r\n\r\n<ng-template #defaultAvailableItemTemplate\r\n let-item>\r\n <td>{{item.label}}</td>\r\n</ng-template>\r\n\r\n<ng-template #defaultSelectedItemTemplate\r\n let-item>\r\n {{item.label}}\r\n</ng-template>",
8310
8352
  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}ec-searchable-table{border-right:2px solid var(--ec-border-color)}.selected-items{max-width:var(--ec-item-picker-max-width-selected-items,50%)}.no-data-message{white-space:normal}"]
8311
8353
  },] }
8312
8354
  ];