@energycap/components 0.27.4-ECAPID-402-MultiSelect-Component.20220126-0812 → 0.27.4-ECAPID-377-Implement-Sidebar.20220126-0948

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.
@@ -2653,6 +2653,12 @@
2653
2653
  * Item currently highlighted by keyboard navigation
2654
2654
  */
2655
2655
  this.highlightedItem = null;
2656
+ /**
2657
+ * Tells the menu to maintain the selected/lastSelected item. Turning this off is useful for
2658
+ * action type menus that are displayed on the screen at all times and you do not
2659
+ * want the item to be selected when clicked.
2660
+ */
2661
+ this.maintainSelectedItem = true;
2656
2662
  /**
2657
2663
  * Emitted when `selected` is changed. Emits the referenced object.
2658
2664
  *
@@ -2755,8 +2761,14 @@
2755
2761
  else {
2756
2762
  this.onSelection(item);
2757
2763
  }
2758
- this.selected = item;
2759
- this.lastSelected = item;
2764
+ if (this.maintainSelectedItem) {
2765
+ this.selected = item;
2766
+ this.lastSelected = item;
2767
+ }
2768
+ else {
2769
+ this.selected = null;
2770
+ this.lastSelected = null;
2771
+ }
2760
2772
  }
2761
2773
  };
2762
2774
  /**
@@ -3000,6 +3012,7 @@
3000
3012
  noDataText: [{ type: i0.Input }],
3001
3013
  enableKeyNav: [{ type: i0.Input }],
3002
3014
  highlightedItem: [{ type: i0.Input }],
3015
+ maintainSelectedItem: [{ type: i0.Input }],
3003
3016
  selectedChanged: [{ type: i0.Output }],
3004
3017
  menuClosed: [{ type: i0.Output }],
3005
3018
  labelTemplate: [{ type: i0.ViewChild, args: ['label', { static: true },] }],
@@ -8154,6 +8167,34 @@
8154
8167
  width: [{ type: i0.Input, args: ['ecIfViewportWidth',] }]
8155
8168
  };
8156
8169
 
8170
+ var HighlightTextPipe = /** @class */ (function () {
8171
+ function HighlightTextPipe() {
8172
+ }
8173
+ HighlightTextPipe.prototype.transform = function (value, searchText) {
8174
+ var transformedValue = '';
8175
+ if (value && searchText) {
8176
+ var regex = new RegExp(this.escapeRegex(searchText), 'gi');
8177
+ transformedValue = value.replace(regex, this.strongWrap);
8178
+ }
8179
+ else {
8180
+ transformedValue = value;
8181
+ }
8182
+ return transformedValue;
8183
+ };
8184
+ HighlightTextPipe.prototype.strongWrap = function (match) {
8185
+ return "<strong class=\"text-highlight\">" + match + "</strong>";
8186
+ };
8187
+ HighlightTextPipe.prototype.escapeRegex = function (value) {
8188
+ return value.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
8189
+ };
8190
+ return HighlightTextPipe;
8191
+ }());
8192
+ HighlightTextPipe.decorators = [
8193
+ { type: i0.Pipe, args: [{
8194
+ name: 'highlightText'
8195
+ },] }
8196
+ ];
8197
+
8157
8198
  /**
8158
8199
  * Format a time to the user's preference for display
8159
8200
  */
@@ -8558,48 +8599,6 @@
8558
8599
  currentTab: [{ type: i0.Input }]
8559
8600
  };
8560
8601
 
8561
- var MultiselectComponent = /** @class */ (function () {
8562
- function MultiselectComponent() {
8563
- this.addButtonLabel = '';
8564
- this.tags = [];
8565
- }
8566
- MultiselectComponent.prototype.ngOnInit = function () {
8567
- };
8568
- MultiselectComponent.prototype.ngAfterViewInit = function () {
8569
- if (this.combobox) {
8570
- this.combobox.hideToggleButton = true;
8571
- }
8572
- else {
8573
- console.warn('The multiselect requires an <ec-combobox> to be provided as transcluded content');
8574
- }
8575
- };
8576
- MultiselectComponent.prototype.addItem = function () {
8577
- var _a, _b, _c, _d;
8578
- console.log('adding item ', (_b = (_a = this.combobox) === null || _a === void 0 ? void 0 : _a.formModel) === null || _b === void 0 ? void 0 : _b.value);
8579
- if ((_d = (_c = this.combobox) === null || _c === void 0 ? void 0 : _c.formModel) === null || _d === void 0 ? void 0 : _d.value) {
8580
- this.tags.push({ label: this.combobox.formModel.value.label, type: 'info', isDismissable: true });
8581
- this.combobox.formModel.setValue(null);
8582
- }
8583
- };
8584
- MultiselectComponent.prototype.removeTag = function (tag) {
8585
- this.tags = this.tags.filter(function (t) { return t !== tag; });
8586
- //TODO: emit selectedChanged(tags)
8587
- };
8588
- return MultiselectComponent;
8589
- }());
8590
- MultiselectComponent.decorators = [
8591
- { type: i0.Component, args: [{
8592
- selector: 'ec-multiselect',
8593
- template: "<div class=\"d-flex mb-2\">\r\n <ng-content></ng-content>\r\n <ec-button class=\"textbox-group-btn-right\" label=\"{{addButtonLabel}}\" type=\"secondary\" (clicked)=\"addItem()\"></ec-button>\r\n</div>\r\n<ec-tags\r\n [tags]=\"tags\"\r\n (tagClosed)=\"removeTag($event)\">\r\n</ec-tags>\r\n",
8594
- styles: [":host{flex:1 1}"]
8595
- },] }
8596
- ];
8597
- MultiselectComponent.ctorParameters = function () { return []; };
8598
- MultiselectComponent.propDecorators = {
8599
- addButtonLabel: [{ type: i0.Input }],
8600
- combobox: [{ type: i0.ContentChild, args: [ComboboxComponent,] }]
8601
- };
8602
-
8603
8602
  var ComponentsModule = /** @class */ (function () {
8604
8603
  function ComponentsModule() {
8605
8604
  }
@@ -8633,7 +8632,6 @@
8633
8632
  TableComponent,
8634
8633
  SearchableTableComponent,
8635
8634
  ComboboxComponent,
8636
- MultiselectComponent,
8637
8635
  MenuComponent,
8638
8636
  PopupContainerDirective,
8639
8637
  DropdownComponent,
@@ -8681,7 +8679,7 @@
8681
8679
  TreeComponent,
8682
8680
  RelativeDatePipe,
8683
8681
  ResizableComponent,
8684
- MultiselectComponent
8682
+ HighlightTextPipe
8685
8683
  ],
8686
8684
  imports: [
8687
8685
  common.CommonModule,
@@ -8699,7 +8697,8 @@
8699
8697
  TimeDisplayPipe,
8700
8698
  MockDateDisplayPipe,
8701
8699
  RowCountPipe,
8702
- RelativeDatePipe
8700
+ RelativeDatePipe,
8701
+ HighlightTextPipe
8703
8702
  ],
8704
8703
  exports: [
8705
8704
  ButtonComponent,
@@ -8713,7 +8712,6 @@
8713
8712
  TableComponent,
8714
8713
  SearchableTableComponent,
8715
8714
  ComboboxComponent,
8716
- MultiselectComponent,
8717
8715
  MenuComponent,
8718
8716
  PopupContainerDirective,
8719
8717
  DropdownComponent,
@@ -8755,7 +8753,8 @@
8755
8753
  HierarchyTreeComponent,
8756
8754
  TreeComponent,
8757
8755
  RelativeDatePipe,
8758
- ResizableComponent
8756
+ ResizableComponent,
8757
+ HighlightTextPipe
8759
8758
  ]
8760
8759
  },] }
8761
8760
  ];
@@ -9899,6 +9898,7 @@
9899
9898
  exports.HierarchyBaseTestInjectorFactory = HierarchyBaseTestInjectorFactory;
9900
9899
  exports.HierarchyItem = HierarchyItem;
9901
9900
  exports.HierarchyTreeComponent = HierarchyTreeComponent;
9901
+ exports.HighlightTextPipe = HighlightTextPipe;
9902
9902
  exports.IfViewportWidthDirective = IfViewportWidthDirective;
9903
9903
  exports.ItemDisplayComponent = ItemDisplayComponent;
9904
9904
  exports.JsonDisplayComponent = JsonDisplayComponent;
@@ -9988,9 +9988,8 @@
9988
9988
  exports.urlValidationPattern = urlValidationPattern;
9989
9989
  exports.validateFormGroupValuesAreUnique = validateFormGroupValuesAreUnique;
9990
9990
  exports.ɵa = ResizableTableDirective;
9991
- exports.ɵb = MultiselectComponent;
9992
- exports.ɵc = AvatarService;
9993
- exports.ɵd = TableDetailRowComponent;
9991
+ exports.ɵb = AvatarService;
9992
+ exports.ɵc = TableDetailRowComponent;
9994
9993
 
9995
9994
  Object.defineProperty(exports, '__esModule', { value: true });
9996
9995