@energycap/components 0.27.4 → 0.27.5

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
  */
@@ -8637,7 +8678,8 @@
8637
8678
  HierarchyTreeComponent,
8638
8679
  TreeComponent,
8639
8680
  RelativeDatePipe,
8640
- ResizableComponent
8681
+ ResizableComponent,
8682
+ HighlightTextPipe
8641
8683
  ],
8642
8684
  imports: [
8643
8685
  common.CommonModule,
@@ -8655,7 +8697,8 @@
8655
8697
  TimeDisplayPipe,
8656
8698
  MockDateDisplayPipe,
8657
8699
  RowCountPipe,
8658
- RelativeDatePipe
8700
+ RelativeDatePipe,
8701
+ HighlightTextPipe
8659
8702
  ],
8660
8703
  exports: [
8661
8704
  ButtonComponent,
@@ -8710,7 +8753,8 @@
8710
8753
  HierarchyTreeComponent,
8711
8754
  TreeComponent,
8712
8755
  RelativeDatePipe,
8713
- ResizableComponent
8756
+ ResizableComponent,
8757
+ HighlightTextPipe
8714
8758
  ]
8715
8759
  },] }
8716
8760
  ];
@@ -9854,6 +9898,7 @@
9854
9898
  exports.HierarchyBaseTestInjectorFactory = HierarchyBaseTestInjectorFactory;
9855
9899
  exports.HierarchyItem = HierarchyItem;
9856
9900
  exports.HierarchyTreeComponent = HierarchyTreeComponent;
9901
+ exports.HighlightTextPipe = HighlightTextPipe;
9857
9902
  exports.IfViewportWidthDirective = IfViewportWidthDirective;
9858
9903
  exports.ItemDisplayComponent = ItemDisplayComponent;
9859
9904
  exports.JsonDisplayComponent = JsonDisplayComponent;