@energycap/components 0.28.7 → 0.28.8

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.
@@ -0,0 +1,108 @@
1
+ import { OnChanges, OnDestroy, OnInit, TemplateRef } from '@angular/core';
2
+ import { FormGroup } from '@angular/forms';
3
+ import { Observable, Subject } from 'rxjs';
4
+ import { TableSearchResults } from '../../display/table/searchable-table.component';
5
+ import { PagingInfo } from '../../display/table/table-pagination.component';
6
+ import { TableSelectableRowContext } from '../../display/table/table-selectable-row.component';
7
+ import { Overlay } from '../../display/view-overlay/view-overlay.component';
8
+ import { MenuItem } from '../menu/menu.component';
9
+ export interface PickerItem<TValue = any, SItems = any> extends MenuItem {
10
+ id: string;
11
+ /** When set to true the available item will be automatically added to the selected list */
12
+ defaultSelected?: boolean;
13
+ /** Redefining to get the typing */
14
+ value: TValue;
15
+ }
16
+ export declare class ItemPickerSelectableContext<T> extends TableSelectableRowContext {
17
+ /** id/value map of the selected items. Used for keeping track of what is selected */
18
+ selectedItemsMap: Map<string, PickerItem<T>>;
19
+ /**
20
+ * Gives a way to tell the picker component that the map was modified externally and to update
21
+ * the available/selected lists
22
+ */
23
+ selectedItemsMapChanged: Subject<void>;
24
+ }
25
+ export declare class ItemPickerComponent<T> implements OnInit, OnChanges, OnDestroy {
26
+ /** Identifier for the component. This will be added to the beginning of all internal action elements */
27
+ id?: string;
28
+ /** Title displayed above the available items table */
29
+ availableTitle: string;
30
+ /** Title displayed above the selected items list */
31
+ selectedTitle: string;
32
+ /** The type of item being selected. Ex. Meters, Addresses */
33
+ itemName: string;
34
+ /** Form group that is given to the internal Searchable Table */
35
+ formModel?: FormGroup;
36
+ /** Template for when a custom header is needed for the available items table */
37
+ customAvailableHeaderTemplate?: TemplateRef<any>;
38
+ /** Template for when a custom available item is needed. Default template is a label only */
39
+ customAvailableItemTemplate?: TemplateRef<any>;
40
+ /** Template for when a custom selected item is needed. Default template is a label only */
41
+ customSelectedItemTemplate?: TemplateRef<any>;
42
+ /** Used by the internal Searchable Table to know when the page is ready */
43
+ ready?: Observable<void>;
44
+ /** Used by Searchable Table to retrieve the available items */
45
+ getItems?: (search?: string, pageChangeInfo?: PagingInfo) => Observable<TableSearchResults>;
46
+ /** Used to maintain the available items checkbox selection as well as the selected items list */
47
+ selectionContext: ItemPickerSelectableContext<T>;
48
+ /** Used by the internal Searchable Table when there is no available items to choose from based on the getItems results. Do not supply
49
+ * to inherit the default message.
50
+ */
51
+ noDataMessage: string;
52
+ /** List of available items to pick from */
53
+ availableItems: PickerItem[];
54
+ /**
55
+ * Selected items array. Created from the selected items map. Binding to the
56
+ * map iterate values caused angular "expression changed" errors so after a map
57
+ * update this gets set to the values
58
+ */
59
+ selectedItems: PickerItem[];
60
+ /** Track by used for the searchable table rows */
61
+ trackByIndex: (index: number) => number;
62
+ tableStatus: Overlay;
63
+ /**
64
+ * Template used to display the available and selected items as well as the available item header.
65
+ * This will be set to the default template if a custom is not provided
66
+ */
67
+ internalizedAvailableHeaderTemplate: TemplateRef<any>;
68
+ internalizedAvailableItemTemplate: TemplateRef<any>;
69
+ internalizedSelectedItemTemplate: TemplateRef<any>;
70
+ /** Default templates used if a custom template is not provided */
71
+ private defaultAvailableHeaderTemplate;
72
+ private defaultAvailableItemTemplate;
73
+ private defaultSelectedItemTemplate;
74
+ /** Used to shut down our subscriptions when the component is destroyed */
75
+ private destroyed;
76
+ constructor();
77
+ ngOnInit(): void;
78
+ /**
79
+ * Watch for changes and react if the custom item template value changes
80
+ */
81
+ ngOnChanges(): void;
82
+ ngOnDestroy(): void;
83
+ /**
84
+ * Called by the searchable table when a new set of items are returned from the getItems call
85
+ * @param results
86
+ */
87
+ onItemsChange(results: TableSearchResults): void;
88
+ /**
89
+ * Called when the clear selection link button is clicked
90
+ */
91
+ onClearSelectionClick(): void;
92
+ /**
93
+ * Called when the remove item button is clicked for a selected item
94
+ * @param removeItem
95
+ */
96
+ removeSelectedItem(removeItem: PickerItem): void;
97
+ /**
98
+ * Watch for changes to the row checkboxes form array and update the selected items
99
+ * list
100
+ */
101
+ private setupRowCheckboxesWatcher;
102
+ /**
103
+ * Watch to be told if changes to the map were made outside of the component and if so update
104
+ * the array displayed in the selected list and select checkboxes for visible available items
105
+ */
106
+ private setupSelectedItemsChangedWatcher;
107
+ private setInternalizedTemplates;
108
+ }
@@ -149,6 +149,8 @@ export declare class SearchableTableComponent implements OnInit, OnDestroy, OnCh
149
149
  removeCard: boolean;
150
150
  /** Classes to add to the overlay/card element */
151
151
  overlayClasses: string;
152
+ /** When true the overlay and table will not have flex-shrink-max but instead flex-grow */
153
+ fillParentHeight?: boolean;
152
154
  /**
153
155
  * PagingInfo for the current page.
154
156
  */
@@ -4,6 +4,7 @@ export declare class WizardButtonsComponent {
4
4
  nextLabel?: string;
5
5
  backLabel?: string;
6
6
  cancelLabel?: string;
7
+ saveLabel?: string;
7
8
  cancelId?: string;
8
9
  saveId?: string;
9
10
  tabindex: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energycap/components",
3
- "version": "0.28.7",
3
+ "version": "0.28.8",
4
4
  "dependencies": {
5
5
  "tslib": "^2.0.0"
6
6
  },
package/public-api.d.ts CHANGED
@@ -94,3 +94,4 @@ export * from './lib/display/hierarchy/hierarchy-mocks.spec';
94
94
  export * from './lib/shared/testing/hierarchy-base-test-injector-factory.spec';
95
95
  export * from './lib/display/hierarchy/hierarchy-tree/hierarchy-tree.component';
96
96
  export * from './lib/display/tree/tree.component';
97
+ export * from './lib/controls/item-picker/item-picker.component';
@@ -37,5 +37,7 @@
37
37
  "PasswordInvalidValidationMessage_LC": "does not meet all requirements",
38
38
  "Next_TC": "Next",
39
39
  "Back_TC": "Back",
40
- "DomainValidationMessage_SC": "must be a valid domain name"
40
+ "DomainValidationMessage_SC": "must be a valid domain name",
41
+ "ClearSelection_TC": "Clear Selection",
42
+ "ItemPickerNoItemsSelected_SC": "No {{itemName}} selected. Select from the available {{itemName}} list."
41
43
  }