@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.
@@ -2402,6 +2402,12 @@ class MenuComponent {
2402
2402
  * Item currently highlighted by keyboard navigation
2403
2403
  */
2404
2404
  this.highlightedItem = null;
2405
+ /**
2406
+ * Tells the menu to maintain the selected/lastSelected item. Turning this off is useful for
2407
+ * action type menus that are displayed on the screen at all times and you do not
2408
+ * want the item to be selected when clicked.
2409
+ */
2410
+ this.maintainSelectedItem = true;
2405
2411
  /**
2406
2412
  * Emitted when `selected` is changed. Emits the referenced object.
2407
2413
  *
@@ -2503,8 +2509,14 @@ class MenuComponent {
2503
2509
  else {
2504
2510
  this.onSelection(item);
2505
2511
  }
2506
- this.selected = item;
2507
- this.lastSelected = item;
2512
+ if (this.maintainSelectedItem) {
2513
+ this.selected = item;
2514
+ this.lastSelected = item;
2515
+ }
2516
+ else {
2517
+ this.selected = null;
2518
+ this.lastSelected = null;
2519
+ }
2508
2520
  }
2509
2521
  }
2510
2522
  /**
@@ -2743,6 +2755,7 @@ MenuComponent.propDecorators = {
2743
2755
  noDataText: [{ type: Input }],
2744
2756
  enableKeyNav: [{ type: Input }],
2745
2757
  highlightedItem: [{ type: Input }],
2758
+ maintainSelectedItem: [{ type: Input }],
2746
2759
  selectedChanged: [{ type: Output }],
2747
2760
  menuClosed: [{ type: Output }],
2748
2761
  labelTemplate: [{ type: ViewChild, args: ['label', { static: true },] }],
@@ -7504,6 +7517,31 @@ IfViewportWidthDirective.propDecorators = {
7504
7517
  width: [{ type: Input, args: ['ecIfViewportWidth',] }]
7505
7518
  };
7506
7519
 
7520
+ class HighlightTextPipe {
7521
+ transform(value, searchText) {
7522
+ let transformedValue = '';
7523
+ if (value && searchText) {
7524
+ const regex = new RegExp(this.escapeRegex(searchText), 'gi');
7525
+ transformedValue = value.replace(regex, this.strongWrap);
7526
+ }
7527
+ else {
7528
+ transformedValue = value;
7529
+ }
7530
+ return transformedValue;
7531
+ }
7532
+ strongWrap(match) {
7533
+ return `<strong class="text-highlight">${match}</strong>`;
7534
+ }
7535
+ escapeRegex(value) {
7536
+ return value.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
7537
+ }
7538
+ }
7539
+ HighlightTextPipe.decorators = [
7540
+ { type: Pipe, args: [{
7541
+ name: 'highlightText'
7542
+ },] }
7543
+ ];
7544
+
7507
7545
  /**
7508
7546
  * Format a time to the user's preference for display
7509
7547
  */
@@ -7890,47 +7928,6 @@ WizardProgressComponent.propDecorators = {
7890
7928
  currentTab: [{ type: Input }]
7891
7929
  };
7892
7930
 
7893
- class MultiselectComponent {
7894
- constructor() {
7895
- this.addButtonLabel = '';
7896
- this.tags = [];
7897
- }
7898
- ngOnInit() {
7899
- }
7900
- ngAfterViewInit() {
7901
- if (this.combobox) {
7902
- this.combobox.hideToggleButton = true;
7903
- }
7904
- else {
7905
- console.warn('The multiselect requires an <ec-combobox> to be provided as transcluded content');
7906
- }
7907
- }
7908
- addItem() {
7909
- var _a, _b, _c, _d;
7910
- console.log('adding item ', (_b = (_a = this.combobox) === null || _a === void 0 ? void 0 : _a.formModel) === null || _b === void 0 ? void 0 : _b.value);
7911
- if ((_d = (_c = this.combobox) === null || _c === void 0 ? void 0 : _c.formModel) === null || _d === void 0 ? void 0 : _d.value) {
7912
- this.tags.push({ label: this.combobox.formModel.value.label, type: 'info', isDismissable: true });
7913
- this.combobox.formModel.setValue(null);
7914
- }
7915
- }
7916
- removeTag(tag) {
7917
- this.tags = this.tags.filter(t => t !== tag);
7918
- //TODO: emit selectedChanged(tags)
7919
- }
7920
- }
7921
- MultiselectComponent.decorators = [
7922
- { type: Component, args: [{
7923
- selector: 'ec-multiselect',
7924
- 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",
7925
- styles: [":host{flex:1 1}"]
7926
- },] }
7927
- ];
7928
- MultiselectComponent.ctorParameters = () => [];
7929
- MultiselectComponent.propDecorators = {
7930
- addButtonLabel: [{ type: Input }],
7931
- combobox: [{ type: ContentChild, args: [ComboboxComponent,] }]
7932
- };
7933
-
7934
7931
  class ComponentsModule {
7935
7932
  /**
7936
7933
  * Providing services through the forRoot pattern here ensures that the components module and the importing
@@ -7961,7 +7958,6 @@ ComponentsModule.decorators = [
7961
7958
  TableComponent,
7962
7959
  SearchableTableComponent,
7963
7960
  ComboboxComponent,
7964
- MultiselectComponent,
7965
7961
  MenuComponent,
7966
7962
  PopupContainerDirective,
7967
7963
  DropdownComponent,
@@ -8009,7 +8005,7 @@ ComponentsModule.decorators = [
8009
8005
  TreeComponent,
8010
8006
  RelativeDatePipe,
8011
8007
  ResizableComponent,
8012
- MultiselectComponent
8008
+ HighlightTextPipe
8013
8009
  ],
8014
8010
  imports: [
8015
8011
  CommonModule,
@@ -8027,7 +8023,8 @@ ComponentsModule.decorators = [
8027
8023
  TimeDisplayPipe,
8028
8024
  MockDateDisplayPipe,
8029
8025
  RowCountPipe,
8030
- RelativeDatePipe
8026
+ RelativeDatePipe,
8027
+ HighlightTextPipe
8031
8028
  ],
8032
8029
  exports: [
8033
8030
  ButtonComponent,
@@ -8041,7 +8038,6 @@ ComponentsModule.decorators = [
8041
8038
  TableComponent,
8042
8039
  SearchableTableComponent,
8043
8040
  ComboboxComponent,
8044
- MultiselectComponent,
8045
8041
  MenuComponent,
8046
8042
  PopupContainerDirective,
8047
8043
  DropdownComponent,
@@ -8083,7 +8079,8 @@ ComponentsModule.decorators = [
8083
8079
  HierarchyTreeComponent,
8084
8080
  TreeComponent,
8085
8081
  RelativeDatePipe,
8086
- ResizableComponent
8082
+ ResizableComponent,
8083
+ HighlightTextPipe
8087
8084
  ]
8088
8085
  },] }
8089
8086
  ];
@@ -9036,5 +9033,5 @@ class HierarchyBaseTestInjectorFactory {
9036
9033
  * Generated bundle index. Do not edit.
9037
9034
  */
9038
9035
 
9039
- export { AppBarComponent, AvatarComponent, BannerComponent, ButtonComponent, CacheService, CheckboxComponent, ClickAreaForDirective, CollapsibleToggleComponent, ComboboxComponent, ComponentsModule, ConfirmComponent, ConfirmDialogContext, CopyButtonDirective, CustomValidators, DateDisplayPipe, DateTimeHelper, DialogCloseDuration, DialogCloseEvent, DialogCloseLatestEvent, DialogComponent, DialogEvent, DialogGroupComponent, DialogOpenDuration, DialogOpenEndEvent, DialogOpenStartEvent, DialogResult, DialogService, DropdownComponent, ErrorService, FileTypeExtensions, FileUploadComponent, FormControlBase, FormControlComponent, FormGroupComponent, FormGroupHelper, HierarchyBase, HierarchyBaseTestInjectorFactory, HierarchyItem, HierarchyMocks, HierarchyTreeComponent, IfViewportWidthDirective, ItemDisplayComponent, JsonDisplayComponent, JsonHelper, MenuComponent, MockActivatedRoute, MockDateDisplayPipe, MockDialog, MockDialogContent, MockTranslateService, MockTranslationHelperService, NavGroup, NavItemActiveDirective, NumericboxComponent, Overlay, PageBaseComponent, PageBaseComponentTestHelper, PageBaseComponentTestInjectorFactory, PageInitResult, PageStatus, PageStatuses, PageTitleComponent, PageViewComponent, PanelCloseDuration, PanelOpenDuration, PopoverComponent, PopupContainerDirective, RadioButtonComponent, RadioButtonOption, RelativeDatePipe, ResizableBase, ResizableColumnComponent, ResizableComponent, RowCountPipe, ScrollService, SearchableTableComponent, SelectComponent, SpinnerComponent, SplashComponent, SplashService, SpyFactory, TableComponent, TableLockedColumnComponent, TableMasterHeaderRowComponent, TableMasterRowComponent, TablePaginationComponent, TableSelectableRowComponent, TableSelectableRowContext, TabsComponent, Tag, TagsComponent, TelemetryService, TelemetryTrackerService, TextboxComponent, TimeDisplayPipe, ToastComponent, ToastEvent, ToastService, ToasterComponent, TreeComponent, UnicodeStrings, UserPreferenceService, ValidationMessageService, ViewOverlayComponent, WindowService, WizardBaseComponent, WizardButtonsComponent, WizardProgressComponent, canadianPostalCodeRegex, clickEvent, dateInputFormatRegex, findAllSpacesPattern, forEachFormControl, getApiError, getControlValue, getDecimalPattern, integerPattern, isApiError, menuAnimationSpeed, mockRouterFactory, numericboxValidation, orderByIgnoreCase, otherZipCodeRegex, phoneNumberValidationPattern, sortByIgnoreCase, textboxValidation, unitedStatesZipCodeRegex, urlValidationPattern, validateFormGroupValuesAreUnique, ResizableTableDirective as ɵa, MultiselectComponent as ɵb, AvatarService as ɵc, TableDetailRowComponent as ɵd };
9036
+ export { AppBarComponent, AvatarComponent, BannerComponent, ButtonComponent, CacheService, CheckboxComponent, ClickAreaForDirective, CollapsibleToggleComponent, ComboboxComponent, ComponentsModule, ConfirmComponent, ConfirmDialogContext, CopyButtonDirective, CustomValidators, DateDisplayPipe, DateTimeHelper, DialogCloseDuration, DialogCloseEvent, DialogCloseLatestEvent, DialogComponent, DialogEvent, DialogGroupComponent, DialogOpenDuration, DialogOpenEndEvent, DialogOpenStartEvent, DialogResult, DialogService, DropdownComponent, ErrorService, FileTypeExtensions, FileUploadComponent, FormControlBase, FormControlComponent, FormGroupComponent, FormGroupHelper, HierarchyBase, HierarchyBaseTestInjectorFactory, HierarchyItem, HierarchyMocks, HierarchyTreeComponent, HighlightTextPipe, IfViewportWidthDirective, ItemDisplayComponent, JsonDisplayComponent, JsonHelper, MenuComponent, MockActivatedRoute, MockDateDisplayPipe, MockDialog, MockDialogContent, MockTranslateService, MockTranslationHelperService, NavGroup, NavItemActiveDirective, NumericboxComponent, Overlay, PageBaseComponent, PageBaseComponentTestHelper, PageBaseComponentTestInjectorFactory, PageInitResult, PageStatus, PageStatuses, PageTitleComponent, PageViewComponent, PanelCloseDuration, PanelOpenDuration, PopoverComponent, PopupContainerDirective, RadioButtonComponent, RadioButtonOption, RelativeDatePipe, ResizableBase, ResizableColumnComponent, ResizableComponent, RowCountPipe, ScrollService, SearchableTableComponent, SelectComponent, SpinnerComponent, SplashComponent, SplashService, SpyFactory, TableComponent, TableLockedColumnComponent, TableMasterHeaderRowComponent, TableMasterRowComponent, TablePaginationComponent, TableSelectableRowComponent, TableSelectableRowContext, TabsComponent, Tag, TagsComponent, TelemetryService, TelemetryTrackerService, TextboxComponent, TimeDisplayPipe, ToastComponent, ToastEvent, ToastService, ToasterComponent, TreeComponent, UnicodeStrings, UserPreferenceService, ValidationMessageService, ViewOverlayComponent, WindowService, WizardBaseComponent, WizardButtonsComponent, WizardProgressComponent, canadianPostalCodeRegex, clickEvent, dateInputFormatRegex, findAllSpacesPattern, forEachFormControl, getApiError, getControlValue, getDecimalPattern, integerPattern, isApiError, menuAnimationSpeed, mockRouterFactory, numericboxValidation, orderByIgnoreCase, otherZipCodeRegex, phoneNumberValidationPattern, sortByIgnoreCase, textboxValidation, unitedStatesZipCodeRegex, urlValidationPattern, validateFormGroupValuesAreUnique, ResizableTableDirective as ɵa, AvatarService as ɵb, TableDetailRowComponent as ɵc };
9040
9037
  //# sourceMappingURL=energycap-components.js.map