@energycap/components 0.39.25-ECAP-26374-menu-item-html-captions.20240923-1505 → 0.39.25-ECAP-26539-Item-Picker-Select-All.20240924-0934

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.
@@ -6,6 +6,7 @@ import { PagingInfo } from '../../display/table/table-pagination.component';
6
6
  import { TableSelectableRowContext } from '../../display/table/table-selectable-row.component';
7
7
  import { Overlay } from '../../display/view-overlay/view-overlay.component';
8
8
  import { MenuItem } from '../menu/menu.component';
9
+ import { TranslateService } from '@ngx-translate/core';
9
10
  import * as i0 from "@angular/core";
10
11
  export interface PickerItem<TValue = any, SItems = any> extends MenuItem {
11
12
  id: string;
@@ -28,12 +29,20 @@ export declare class ItemPickerSelectableContext<T> extends TableSelectableRowCo
28
29
  * AdvancedRowClickBehavior is disabled for ItemPicker.
29
30
  */
30
31
  readonly disableAdvancedRowClickBehavior: boolean;
32
+ /** When true the user has opted to select all items across all pages. Due to api pagination
33
+ * we don't have all of the items locally, so the host will need to tell the API to operate on all
34
+ * via api filters or other means.
35
+ */
36
+ isSelectingAllItems: boolean;
31
37
  }
32
38
  export declare class ItemPickerComponent<T> implements OnInit, OnChanges, OnDestroy {
39
+ private translateService;
33
40
  /** Identifier for the component. This will be added to the beginning of all internal action elements */
34
41
  id?: string;
35
42
  /** Title displayed above the available items table */
36
43
  availableTitle: string;
44
+ /** Help popover next to the available title. If supplied will show, otherwise is hidden */
45
+ availableTitleHelpPopover: string;
37
46
  /** Title displayed above the selected items list */
38
47
  selectedTitle: string;
39
48
  /** The type of item being selected. Ex. Meters, Addresses */
@@ -61,6 +70,12 @@ export declare class ItemPickerComponent<T> implements OnInit, OnChanges, OnDest
61
70
  * interpolation will be used.
62
71
  */
63
72
  noSelectedItemsMessage?: string;
73
+ /** Used to enable select all items across pages. When true the button to select all items will be visible in the available items header when
74
+ * the header checkbox is checked and there are multiple pages of results
75
+ */
76
+ enableSelectAllItems: boolean;
77
+ /** Used to display a message in the selected items table when the select all items button is clicked */
78
+ selectAllItemsMessage: string;
64
79
  /** List of available items to pick from */
65
80
  availableItems: PickerItem[];
66
81
  /**
@@ -74,6 +89,17 @@ export declare class ItemPickerComponent<T> implements OnInit, OnChanges, OnDest
74
89
  /** Track by used for the searchable table rows */
75
90
  trackByIndex: (index: number) => number;
76
91
  tableStatus: Overlay;
92
+ /** Text to display next to the checkbox in the available items header. Used to dislay how many items are
93
+ * selected when select all items is enabled
94
+ */
95
+ availableCheckboxText: string;
96
+ /** When set to true the select all items button will show in the available items header. This is
97
+ * shown when the user has enabled select all for the item picker and the user selects the header checkbox
98
+ * with more than one page of results.
99
+ */
100
+ showSelectAllItemsButton: boolean;
101
+ /** The total number of items returned from the api across all pages */
102
+ totalItemsBeforePaging?: number;
77
103
  /**
78
104
  * Template used to display the available and selected items as well as the available item header.
79
105
  * This will be set to the default template if a custom is not provided
@@ -87,7 +113,7 @@ export declare class ItemPickerComponent<T> implements OnInit, OnChanges, OnDest
87
113
  private defaultSelectedItemTemplate;
88
114
  /** Used to shut down our subscriptions when the component is destroyed */
89
115
  private destroyed;
90
- constructor();
116
+ constructor(translateService: TranslateService);
91
117
  ngOnInit(): void;
92
118
  /**
93
119
  * Watch for changes and react if the custom item template value changes
@@ -108,11 +134,23 @@ export declare class ItemPickerComponent<T> implements OnInit, OnChanges, OnDest
108
134
  * @param removeItem
109
135
  */
110
136
  removeSelectedItem(removeItem: PickerItem): void;
137
+ /**
138
+ * Click handler for the select all items button
139
+ */
140
+ selectAllItems(): void;
141
+ /**
142
+ * Removes all items from the selected items map. This was split from the onClearSelectionClick function to allow
143
+ * selectAllItems to call this function but keep the row checkbox values in place. This was needed because when you are
144
+ * selecting all items across all pages we want the current page of items to remain checked.
145
+ *
146
+ */
147
+ private clearSelectedItemsMap;
111
148
  /**
112
149
  * Watch for changes to the row checkboxes form array and update the selected items
113
150
  * list
114
151
  */
115
152
  private setupRowCheckboxesWatcher;
153
+ private updateAvailableCheckboxText;
116
154
  /**
117
155
  * Watch to be told if changes to the map were made outside of the component and if so update
118
156
  * the array displayed in the selected list and select checkboxes for visible available items
@@ -120,5 +158,5 @@ export declare class ItemPickerComponent<T> implements OnInit, OnChanges, OnDest
120
158
  private setupSelectedItemsChangedWatcher;
121
159
  private setInternalizedTemplates;
122
160
  static ɵfac: i0.ɵɵFactoryDeclaration<ItemPickerComponent<any>, never>;
123
- static ɵcmp: i0.ɵɵComponentDeclaration<ItemPickerComponent<any>, "ec-item-picker", never, { "id": "id"; "availableTitle": "availableTitle"; "selectedTitle": "selectedTitle"; "itemName": "itemName"; "formModel": "formModel"; "customAvailableHeaderTemplate": "customAvailableHeaderTemplate"; "customAvailableItemTemplate": "customAvailableItemTemplate"; "customSelectedItemTemplate": "customSelectedItemTemplate"; "ready": "ready"; "getItems": "getItems"; "selectionContext": "selectionContext"; "noDataMessage": "noDataMessage"; "noSelectedItemsMessage": "noSelectedItemsMessage"; }, {}, never, never, false, never>;
161
+ static ɵcmp: i0.ɵɵComponentDeclaration<ItemPickerComponent<any>, "ec-item-picker", never, { "id": "id"; "availableTitle": "availableTitle"; "availableTitleHelpPopover": "availableTitleHelpPopover"; "selectedTitle": "selectedTitle"; "itemName": "itemName"; "formModel": "formModel"; "customAvailableHeaderTemplate": "customAvailableHeaderTemplate"; "customAvailableItemTemplate": "customAvailableItemTemplate"; "customSelectedItemTemplate": "customSelectedItemTemplate"; "ready": "ready"; "getItems": "getItems"; "selectionContext": "selectionContext"; "noDataMessage": "noDataMessage"; "noSelectedItemsMessage": "noSelectedItemsMessage"; "enableSelectAllItems": "enableSelectAllItems"; "selectAllItemsMessage": "selectAllItemsMessage"; }, {}, never, never, false, never>;
124
162
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energycap/components",
3
- "version": "0.39.25-ECAP-26374-menu-item-html-captions.20240923-1505",
3
+ "version": "0.39.25-ECAP-26539-Item-Picker-Select-All.20240924-0934",
4
4
  "dependencies": {
5
5
  "tslib": "^2.0.0"
6
6
  },
@@ -44,5 +44,8 @@
44
44
  "LearnMore_SC": "Learn more",
45
45
  "SelectZipFiles_ELS": "Select ZIP files...",
46
46
  "Browse_TC": "Browse",
47
- "is invalid": "is invalid"
47
+ "is invalid": "is invalid",
48
+ "AllItemPickerItemsSelected_SC": "All {{count}} {{itemName}} selected",
49
+ "SelectAllItemPickerItems_TC": "Select all {{count}} {{itemName}}",
50
+ "CountSelected_TC": "{{count}} selected"
48
51
  }