@xh/hoist 74.1.1 → 75.0.0-SNAPSHOT.1749666833237

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +5 -35
  2. package/build/types/cmp/grouping/GroupingChooserModel.d.ts +4 -8
  3. package/build/types/cmp/viewmanager/ViewInfo.d.ts +3 -7
  4. package/build/types/core/types/Interfaces.d.ts +1 -1
  5. package/build/types/desktop/cmp/grouping/GroupingChooser.d.ts +6 -17
  6. package/build/types/desktop/cmp/panel/Panel.d.ts +1 -1
  7. package/build/types/desktop/cmp/viewmanager/ViewManager.d.ts +10 -26
  8. package/build/types/mobile/cmp/grouping/GroupingChooser.d.ts +6 -2
  9. package/build/types/utils/impl/index.d.ts +0 -1
  10. package/cmp/grouping/GroupingChooserModel.ts +12 -25
  11. package/cmp/viewmanager/ViewInfo.ts +3 -7
  12. package/core/HoistAppModel.ts +0 -1
  13. package/core/exception/ExceptionHandler.ts +1 -1
  14. package/core/types/Interfaces.ts +2 -2
  15. package/desktop/cmp/button/AppMenuButton.ts +46 -3
  16. package/desktop/cmp/grouping/GroupingChooser.scss +35 -39
  17. package/desktop/cmp/grouping/GroupingChooser.ts +89 -157
  18. package/desktop/cmp/panel/Panel.ts +1 -1
  19. package/desktop/cmp/viewmanager/ViewManager.ts +16 -58
  20. package/desktop/cmp/viewmanager/ViewMenu.ts +2 -9
  21. package/mobile/appcontainer/FeedbackDialog.ts +0 -4
  22. package/mobile/appcontainer/OptionsDialog.ts +1 -3
  23. package/mobile/cmp/grid/impl/ColChooser.ts +2 -3
  24. package/mobile/cmp/grouping/GroupingChooser.scss +20 -41
  25. package/mobile/cmp/grouping/GroupingChooser.ts +89 -60
  26. package/mobile/cmp/panel/DialogPanel.scss +0 -5
  27. package/package.json +1 -1
  28. package/svc/TrackService.ts +3 -4
  29. package/tsconfig.tsbuildinfo +1 -1
  30. package/utils/impl/index.ts +0 -1
  31. package/utils/js/LangUtils.ts +1 -1
  32. package/build/types/utils/impl/MenuItems.d.ts +0 -13
  33. package/utils/impl/MenuItems.ts +0 -57
package/CHANGELOG.md CHANGED
@@ -1,54 +1,24 @@
1
1
  # Changelog
2
2
 
3
- ## v74.1.1 - 2025-07-02
4
-
5
- ### 🎁 New Features
6
-
7
- * Further refinements to the `GroupingChooser` desktop UI.
8
- * Added new props `favoritesSide` and `favoritesTitle`.
9
- * Deprecated `popoverTitle` prop - use `editorTitle` instead.
10
- * Moved "Save as Favorite" button to a new compact toolbar within the popover.
11
-
12
- ### 🐞 Bug Fixes
13
-
14
- * Fixed a bug where `TrackService` was not properly verifying that tracked `data` was below the
15
- configured `maxDataLength` limit.
16
-
17
- ## v74.1.0 - 2025-06-30
18
-
19
- ### 🎁 New Features
20
-
21
- * Updated the `GroupingChooser` UI to use a single popover for both updating the value and
22
- selecting/managing favorite groupings (if enabled).
23
- * Adjusted `GroupingChooserModel` API and some CSS class names and testIds of `GroupingChooser`
24
- internals, although those changes are very unlikely to require app-level adjustments.
25
- * Adjusted/removed (rarely used) desktop and mobile `GroupingChooser` props related to popover
26
- sizing and titling.
27
- * Updated the mobile UI to use a full-screen dialog, similar to `ColumnChooser`.
28
- * Added props to `ViewManager` to customize icons used for different types of views, and modified
29
- default icons for Global and Shared views.
30
- * Added `ViewManager.extraMenuItems` prop to allow insertion of custom, app-specific items into the
31
- component's standard menu.
3
+ ## v75.0.0-SNAPSHOT - unreleased
32
4
 
33
5
  ## v74.0.0 - 2025-06-11
34
6
 
35
7
  ### 💥 Breaking Changes (upgrade difficulty: 🟢 LOW - minor changes to ViewManagerModel, ChartModel)
36
8
 
37
9
  * Removed `ViewManagerModel.settleTime`. Now set via individual `PersistOptions.settleTime` instead.
38
- * ️Removed `ChartModel.showContextMenu`. Use a setting of `false` for the new
39
- `ChartModel.contextMenu` property instead.
10
+ * ️Removed `ChartModel.showContextMenu`. Use a setting of `false` for the new `ChartModel.contextMenu`
11
+ property instead.
40
12
 
41
13
  ### 🎁 New Features
42
-
43
14
  * Added `ViewManagerModel.preserveUnsavedChanges` flag to opt-out of that behaviour.
44
15
  * Added `PersistOptions.settleTime` to configure time to wait for state to settle before persisting.
45
16
  * Support for grid column level `onCellClicked` events.
46
17
  * General improvements to `MenuItem` api
47
- * New `MenuContext` object now sent as 2nd arg to `actionFn` and `prepareFn`.
48
- * New `ChartModel.contextMenu` property provides a fully customizable context menu for charts.
18
+ * New `MenuContext` object now sent as 2nd arg to `actionFn` and `prepareFn`.
19
+ * New `ChartModel.contextMenu` property provides a fully customizable context menu for charts.
49
20
 
50
21
  ### 🐞 Bug Fixes
51
-
52
22
  * Improved `ViewManagerModel.settleTime` by delegating to individual `PersistenceProviders`.
53
23
  * Fixed bug where grid column state could become unintentionally dirty when columns were hidden.
54
24
  * Improved `WebsocketService` heartbeat detection to auto-reconnect when the socket reports as open
@@ -8,10 +8,7 @@ export interface GroupingChooserConfig {
8
8
  dimensions?: (DimensionSpec | string)[];
9
9
  /** Initial value as an array of dimension names, or a function to produce such an array. */
10
10
  initialValue?: string[] | (() => string[]);
11
- /**
12
- * Initial favorites as an array of dim name arrays, or a function to produce such an array.
13
- * Ignored if `persistWith.persistFavorites: false`.
14
- */
11
+ /** Initial favorites as an array of dim name arrays, or a function to produce such an array. */
15
12
  initialFavorites?: string[][] | (() => string[][]);
16
13
  /** Options governing persistence. */
17
14
  persistWith?: GroupingChooserPersistOptions;
@@ -50,6 +47,7 @@ export declare class GroupingChooserModel extends HoistModel {
50
47
  persistFavorites: boolean;
51
48
  pendingValue: string[];
52
49
  editorIsOpen: boolean;
50
+ favoritesIsOpen: boolean;
53
51
  popoverRef: import("react").RefObject<HTMLElement> & import("react").RefCallback<HTMLElement>;
54
52
  private dimensions;
55
53
  private dimensionNames;
@@ -57,12 +55,12 @@ export declare class GroupingChooserModel extends HoistModel {
57
55
  get dimensionSpecs(): DimensionSpec[];
58
56
  get isValid(): boolean;
59
57
  get isAddEnabled(): boolean;
60
- get isAddFavoriteEnabled(): boolean;
61
58
  constructor({ dimensions, initialValue, initialFavorites, persistWith, allowEmpty, maxDepth, commitOnChange }: GroupingChooserConfig);
62
59
  setDimensions(dimensions: Array<DimensionSpec | string>): void;
63
60
  setValue(value: string[]): void;
64
61
  toggleEditor(): void;
65
- closeEditor(): void;
62
+ toggleFavoritesMenu(): void;
63
+ closePopover(): void;
66
64
  addPendingDim(dimName: string): void;
67
65
  replacePendingDimAtIdx(dimName: string, idx: number): void;
68
66
  removePendingDimAtIdx(idx: number): void;
@@ -76,10 +74,8 @@ export declare class GroupingChooserModel extends HoistModel {
76
74
  value: string[];
77
75
  label: string;
78
76
  }[];
79
- get hasFavorites(): boolean;
80
77
  setFavorites(favorites: string[][]): void;
81
78
  addFavorite(value: string[]): void;
82
- addPendingAsFavorite(): void;
83
79
  removeFavorite(value: string[]): void;
84
80
  isFavorite(value: string[]): boolean;
85
81
  private initPersist;
@@ -15,19 +15,15 @@ export declare class ViewInfo {
15
15
  readonly description: string;
16
16
  /** User owning this view. Null if the view is global.*/
17
17
  readonly owner: string;
18
- /**
19
- * True if the owner (which can be the current user) has made this view accessible to all other
20
- * users. Note always `false` for global views, to better distinguish the two sharing models.
21
- */
18
+ /** Is the owner making this view accessible to others? Always true for global views. */
22
19
  readonly isShared: boolean;
23
20
  /** True if this view is global and visible to all users. */
24
21
  readonly isGlobal: boolean;
25
22
  /** Optional group name used for bucketing this view in display. */
26
23
  readonly group: string;
27
24
  /**
28
- * True if this view should be pinned by default to all users' menus, where it will appear
29
- * unless the user has explicitly unpinned it. Only applicable for global views, can be enabled
30
- * by view managers to promote especially important global views and ensure users see them.
25
+ * Should this view be pinned by users by default?
26
+ * This value is intended to be used for global views only.
31
27
  */
32
28
  readonly isDefaultPinned: boolean;
33
29
  /**
@@ -177,7 +177,7 @@ export interface TrackOptions {
177
177
  /** Correlation ID to save along with track log. */
178
178
  correlationId?: string;
179
179
  /** App-supplied data to save along with track log.*/
180
- data?: PlainObject | Array<unknown>;
180
+ data?: PlainObject | PlainObject[];
181
181
  /**
182
182
  * Set true to log on the server all primitive values in the 'data' property.
183
183
  * May also be specified as list of specific property keys that should be logged.
@@ -1,34 +1,23 @@
1
1
  import { GroupingChooserModel } from '@xh/hoist/cmp/grouping';
2
- import { Side } from '@xh/hoist/core';
3
2
  import { ButtonProps } from '@xh/hoist/desktop/cmp/button';
4
3
  import '@xh/hoist/desktop/register';
4
+ import { ReactElement } from 'react';
5
5
  import './GroupingChooser.scss';
6
- import { ReactNode } from 'react';
7
6
  export interface GroupingChooserProps extends ButtonProps<GroupingChooserModel> {
8
- /** Title for value-editing portion of popover, or null to suppress. */
9
- editorTitle?: ReactNode;
10
7
  /** Text to represent empty state (i.e. value = null or []) */
11
8
  emptyText?: string;
12
- /**
13
- * Side of the popover, relative to the value-editing controls, on which the Favorites list
14
- * should be rendered, if enabled.
15
- */
16
- favoritesSide?: Side;
17
- /** Title for favorites-list portion of popover, or null to suppress. */
18
- favoritesTitle?: ReactNode;
19
9
  /** Min height in pixels of the popover menu itself. */
20
10
  popoverMinHeight?: number;
21
11
  /** Position of popover relative to target button. */
22
12
  popoverPosition?: 'bottom' | 'top';
23
- /** @deprecated - use `editorTitle` instead */
24
- popoverTitle?: ReactNode;
25
- /**
26
- * Width in pixels of the popover menu itself.
27
- * If unspecified, will default based on favorites enabled status + side.
28
- */
13
+ /** Title for popover (default "GROUP BY") or null to suppress. */
14
+ popoverTitle?: string;
15
+ /** Width in pixels of the popover menu itself. */
29
16
  popoverWidth?: number;
30
17
  /** True (default) to style target button as an input field - blends better in toolbars. */
31
18
  styleButtonAsInput?: boolean;
19
+ /** Icon clicked to launch favorites menu. Defaults to Icon.favorite() */
20
+ favoritesIcon?: ReactElement;
32
21
  }
33
22
  /**
34
23
  * Control for selecting a list of dimensions for grouping APIs, with built-in support for
@@ -44,7 +44,7 @@ export interface PanelProps extends HoistProps<PanelModel>, Omit<BoxProps, 'titl
44
44
  */
45
45
  tbar?: Some<ReactNode>;
46
46
  /**
47
- * A toolbar to be docked at the bottom of the panel.
47
+ * A toolbar to be docked at the top of the panel.
48
48
  * If specified as an array, items will be passed as children to a Toolbar component.
49
49
  */
50
50
  bbar?: Some<ReactNode>;
@@ -1,42 +1,26 @@
1
- import { HoistProps, MenuItemLike } from '@xh/hoist/core';
1
+ import { HoistProps } from '@xh/hoist/core';
2
2
  import { ViewManagerModel } from '@xh/hoist/cmp/viewmanager';
3
3
  import { ButtonProps } from '@xh/hoist/desktop/cmp/button';
4
- import { ReactElement } from 'react';
5
4
  import './ViewManager.scss';
5
+ /**
6
+ * Visibility options for save/revert button.
7
+ *
8
+ * 'never' to hide button.
9
+ * 'whenDirty' to only show when persistence state is dirty and button is therefore enabled.
10
+ * 'always' will always show button.
11
+ */
12
+ export type ViewManagerStateButtonMode = 'whenDirty' | 'always' | 'never';
6
13
  export interface ViewManagerProps extends HoistProps<ViewManagerModel> {
7
14
  menuButtonProps?: Partial<ButtonProps>;
8
15
  saveButtonProps?: Partial<ButtonProps>;
9
16
  revertButtonProps?: Partial<ButtonProps>;
10
- /** Button icon when on the default (in-code state) view. Default `Icon.bookmark`. */
11
- defaultViewIcon?: ReactElement;
12
- /** Button icon when the selected view is owned by the current user. Default `Icon.bookmark`. */
13
- ownedViewIcon?: ReactElement;
14
- /** Button icon when the selected view is shared by another user. Default `Icon.users`. */
15
- sharedViewIcon?: ReactElement;
16
- /** Button icon when the selected view is globally shared. Default `Icon.globe`. */
17
- globalViewIcon?: ReactElement;
18
17
  /** Default 'whenDirty' */
19
18
  showSaveButton?: ViewManagerStateButtonMode;
20
19
  /** Default 'never' */
21
20
  showRevertButton?: ViewManagerStateButtonMode;
22
- /** Side relative to the menu on which save/revert buttons should render. Default 'right'. */
21
+ /** Side the save and revert buttons should appear on (default 'right') */
23
22
  buttonSide?: 'left' | 'right';
24
- /**
25
- * Array of extra menu items. Can contain:
26
- * + `MenuItems` or configs to create them.
27
- * + `MenuDividers` or the special string token '-'.
28
- * + React Elements or strings, which will be interpreted as the `text` property for a MenuItem.
29
- */
30
- extraMenuItems?: MenuItemLike[];
31
23
  }
32
- /**
33
- * Visibility options for save/revert buttons inlined next to the ViewManager menu:
34
- * 'never' to always hide - user must save/revert via menu.
35
- * 'whenDirty' (default) to show only when view state is dirty and the button is enabled.
36
- * 'always' to always show, including when view not dirty and the button is disabled.
37
- * Useful to avoid jumpiness in toolbar layouts.
38
- */
39
- export type ViewManagerStateButtonMode = 'whenDirty' | 'always' | 'never';
40
24
  /**
41
25
  * Desktop ViewManager component - a button-based menu for saving and swapping between named
42
26
  * bundles of persisted component state (e.g. grid views, dashboards, and similar).
@@ -3,10 +3,14 @@ import { ButtonProps } from '@xh/hoist/mobile/cmp/button';
3
3
  import '@xh/hoist/mobile/register';
4
4
  import './GroupingChooser.scss';
5
5
  export interface GroupingChooserProps extends ButtonProps<GroupingChooserModel> {
6
- /** Custom title for editor dialog, or null to suppress. */
7
- dialogTitle?: string;
8
6
  /** Text to represent empty state (i.e. value = null or [])*/
9
7
  emptyText?: string;
8
+ /** Title for popover (default "GROUP BY") or null to suppress. */
9
+ popoverTitle?: string;
10
+ /** Min height in pixels of the popover inner content (excl. header & toolbar). */
11
+ popoverMinHeight?: number;
12
+ /** Width in pixels of the popover menu itself. */
13
+ popoverWidth?: number;
10
14
  }
11
15
  /**
12
16
  * Control for selecting a list of dimensions for grouping APIs.
@@ -2,4 +2,3 @@ export * from './Separators';
2
2
  export * from './TimeZone';
3
3
  export * from './Equals';
4
4
  export * from './IsOmitted';
5
- export * from './MenuItems';
@@ -23,10 +23,7 @@ export interface GroupingChooserConfig {
23
23
  /** Initial value as an array of dimension names, or a function to produce such an array. */
24
24
  initialValue?: string[] | (() => string[]);
25
25
 
26
- /**
27
- * Initial favorites as an array of dim name arrays, or a function to produce such an array.
28
- * Ignored if `persistWith.persistFavorites: false`.
29
- */
26
+ /** Initial favorites as an array of dim name arrays, or a function to produce such an array. */
30
27
  initialFavorites?: string[][] | (() => string[][]);
31
28
 
32
29
  /** Options governing persistence. */
@@ -77,6 +74,7 @@ export class GroupingChooserModel extends HoistModel {
77
74
  // Implementation fields for Control
78
75
  @observable.ref pendingValue: string[] = [];
79
76
  @observable editorIsOpen: boolean = false;
77
+ @observable favoritesIsOpen: boolean = false;
80
78
  popoverRef = createObservableRef<HTMLElement>();
81
79
 
82
80
  // Internal state
@@ -107,15 +105,6 @@ export class GroupingChooserModel extends HoistModel {
107
105
  return !atMaxDepth && !isEmpty(availableDims);
108
106
  }
109
107
 
110
- @computed
111
- get isAddFavoriteEnabled(): boolean {
112
- return (
113
- this.persistFavorites &&
114
- !isEmpty(this.pendingValue) &&
115
- !this.isFavorite(this.pendingValue)
116
- );
117
- }
118
-
119
108
  constructor({
120
109
  dimensions,
121
110
  initialValue = [],
@@ -180,11 +169,19 @@ export class GroupingChooserModel extends HoistModel {
180
169
  toggleEditor() {
181
170
  this.pendingValue = this.value;
182
171
  this.editorIsOpen = !this.editorIsOpen;
172
+ this.favoritesIsOpen = false;
173
+ }
174
+
175
+ @action
176
+ toggleFavoritesMenu() {
177
+ this.favoritesIsOpen = !this.favoritesIsOpen;
178
+ this.editorIsOpen = false;
183
179
  }
184
180
 
185
181
  @action
186
- closeEditor() {
182
+ closePopover() {
187
183
  this.editorIsOpen = false;
184
+ this.favoritesIsOpen = false;
188
185
  }
189
186
 
190
187
  //-------------------------
@@ -227,7 +224,7 @@ export class GroupingChooserModel extends HoistModel {
227
224
  if (!isEqual(value, pendingValue) && this.validateValue(pendingValue)) {
228
225
  this.setValue(pendingValue);
229
226
  }
230
- this.closeEditor();
227
+ this.closePopover();
231
228
  }
232
229
 
233
230
  validateValue(value: string[]) {
@@ -266,11 +263,6 @@ export class GroupingChooserModel extends HoistModel {
266
263
  );
267
264
  }
268
265
 
269
- @computed
270
- get hasFavorites() {
271
- return !isEmpty(this.favorites);
272
- }
273
-
274
266
  @action
275
267
  setFavorites(favorites: string[][]) {
276
268
  this.favorites = favorites.filter(v => this.validateValue(v));
@@ -282,11 +274,6 @@ export class GroupingChooserModel extends HoistModel {
282
274
  this.favorites = [...this.favorites, value];
283
275
  }
284
276
 
285
- @action
286
- addPendingAsFavorite() {
287
- this.addFavorite(this.pendingValue);
288
- }
289
-
290
277
  @action
291
278
  removeFavorite(value: string[]) {
292
279
  this.favorites = this.favorites.filter(v => !isEqual(v, value));
@@ -29,10 +29,7 @@ export class ViewInfo {
29
29
  /** User owning this view. Null if the view is global.*/
30
30
  readonly owner: string;
31
31
 
32
- /**
33
- * True if the owner (which can be the current user) has made this view accessible to all other
34
- * users. Note always `false` for global views, to better distinguish the two sharing models.
35
- */
32
+ /** Is the owner making this view accessible to others? Always true for global views. */
36
33
  readonly isShared: boolean;
37
34
 
38
35
  /** True if this view is global and visible to all users. */
@@ -42,9 +39,8 @@ export class ViewInfo {
42
39
  readonly group: string;
43
40
 
44
41
  /**
45
- * True if this view should be pinned by default to all users' menus, where it will appear
46
- * unless the user has explicitly unpinned it. Only applicable for global views, can be enabled
47
- * by view managers to promote especially important global views and ensure users see them.
42
+ * Should this view be pinned by users by default?
43
+ * This value is intended to be used for global views only.
48
44
  */
49
45
  readonly isDefaultPinned: boolean;
50
46
 
@@ -99,7 +99,6 @@ export class HoistAppModel extends HoistModel {
99
99
  const XH = window['XH'];
100
100
  await XH.prefService.clearAllAsync();
101
101
  XH.localStorageService.clear();
102
- XH.sessionStorageService.clear();
103
102
  }
104
103
  }
105
104
 
@@ -202,7 +202,7 @@ export class ExceptionHandler {
202
202
  XH.track({
203
203
  category: 'Client Error',
204
204
  severity: exception.isRoutine ? 'INFO' : 'ERROR',
205
- message: exception.message || 'Client Error',
205
+ message: exception.message ?? 'Client Error',
206
206
  correlationId: exception.correlationId,
207
207
  data,
208
208
  logData: ['userAlerted']
@@ -6,8 +6,8 @@
6
6
  */
7
7
 
8
8
  import {RuleLike} from '@xh/hoist/data';
9
+ import {MouseEvent, ReactElement, ReactNode, isValidElement} from 'react';
9
10
  import {isString} from 'lodash';
10
- import {isValidElement, MouseEvent, ReactElement, ReactNode} from 'react';
11
11
  import {LoadSpec} from '../load';
12
12
  import {Intent, PlainObject, Thunkable} from './Types';
13
13
 
@@ -224,7 +224,7 @@ export interface TrackOptions {
224
224
  correlationId?: string;
225
225
 
226
226
  /** App-supplied data to save along with track log.*/
227
- data?: PlainObject | Array<unknown>;
227
+ data?: PlainObject | PlainObject[];
228
228
 
229
229
  /**
230
230
  * Set true to log on the server all primitive values in the 'data' property.
@@ -4,13 +4,17 @@
4
4
  *
5
5
  * Copyright © 2025 Extremely Heavy Industries Inc.
6
6
  */
7
- import {hoistCmp, MenuItemLike, XH} from '@xh/hoist/core';
7
+ import {MenuItemProps} from '@blueprintjs/core';
8
+ import {hoistCmp, isMenuItem, MenuItemLike, XH} from '@xh/hoist/core';
8
9
  import {ButtonProps, button} from '@xh/hoist/desktop/cmp/button';
9
10
  import '@xh/hoist/desktop/register';
10
11
  import {Icon} from '@xh/hoist/icon';
11
- import {menu, popover} from '@xh/hoist/kit/blueprint';
12
- import {parseMenuItems} from '@xh/hoist/utils/impl';
12
+ import {menu, menuDivider, menuItem, popover} from '@xh/hoist/kit/blueprint';
13
+ import {wait} from '@xh/hoist/promise';
14
+ import {filterConsecutiveMenuSeparators, isOmitted} from '@xh/hoist/utils/impl';
13
15
  import {withDefault} from '@xh/hoist/utils/js';
16
+ import {clone, isEmpty} from 'lodash';
17
+ import {ReactNode} from 'react';
14
18
 
15
19
  export interface AppMenuButtonProps extends ButtonProps {
16
20
  /**
@@ -172,3 +176,42 @@ function buildMenuItems(props: AppMenuButtonProps) {
172
176
 
173
177
  return parseMenuItems([...extraItems, '-', ...defaultItems]);
174
178
  }
179
+
180
+ function parseMenuItems(items: MenuItemLike[]): ReactNode[] {
181
+ items = items.map(item => {
182
+ if (!isMenuItem(item)) return item;
183
+
184
+ item = clone(item);
185
+ item.items = clone(item.items);
186
+ item.prepareFn?.(item);
187
+ return item;
188
+ });
189
+
190
+ return items
191
+ .filter(it => !isMenuItem(it) || (!it.hidden && !isOmitted(it)))
192
+ .filter(filterConsecutiveMenuSeparators())
193
+ .map(item => {
194
+ if (item === '-') return menuDivider();
195
+ if (!isMenuItem(item)) return item;
196
+
197
+ const {actionFn} = item;
198
+
199
+ // Create menuItem from config
200
+ const cfg: MenuItemProps = {
201
+ text: item.text,
202
+ icon: item.icon,
203
+ intent: item.intent,
204
+ className: item.className,
205
+ onClick: actionFn ? e => wait().then(() => actionFn(e)) : null, // do async to allow menu to close
206
+ disabled: item.disabled
207
+ };
208
+
209
+ // Recursively parse any submenus
210
+ if (!isEmpty(item.items)) {
211
+ cfg.children = parseMenuItems(item.items);
212
+ cfg.popoverProps = {openOnTargetFocus: false};
213
+ }
214
+
215
+ return menuItem(cfg);
216
+ });
217
+ }
@@ -22,6 +22,11 @@
22
22
  color: var(--xh-text-color-muted);
23
23
  }
24
24
  }
25
+
26
+ // We must account for the favorites icon when eliding text
27
+ &--with-favorites {
28
+ padding-right: 30px !important;
29
+ }
25
30
  }
26
31
 
27
32
  // Outer box is sized via layoutSupport - all nested inner elements should stretch to fill.
@@ -34,16 +39,6 @@
34
39
  position: relative;
35
40
  }
36
41
 
37
- &-popover {
38
- // 60/40 split in favor of favorites in left/right orientation
39
- &--faves-right,
40
- &--faves-left {
41
- .xh-grouping-chooser__editor {
42
- width: 40%;
43
- }
44
- }
45
- }
46
-
47
42
  &__list {
48
43
  margin-bottom: var(--xh-pad-half-px);
49
44
  background-color: var(--xh-bg-alt);
@@ -126,47 +121,48 @@
126
121
  padding: 2px var(--xh-tbar-item-pad-px);
127
122
  }
128
123
 
129
- &__favorites {
130
- &--top {
131
- border-bottom: 1px solid var(--xh-popup-border-color);
132
- }
124
+ &__favorite-icon {
125
+ display: flex;
126
+ align-items: center;
127
+ justify-content: center;
128
+ width: 30px;
129
+ height: 20px;
130
+ position: absolute;
131
+ top: 0;
132
+ right: 0;
133
+ cursor: pointer;
134
+ color: var(--xh-text-color-muted);
133
135
 
134
- &--right {
135
- flex: 1;
136
- border-left: 1px solid var(--xh-popup-border-color);
136
+ &:hover {
137
+ color: var(--xh-text-color);
137
138
  }
138
139
 
139
- &--bottom {
140
- border-top: 1px solid var(--xh-popup-border-color);
140
+ .xh-toolbar--compact & {
141
+ height: 15px;
141
142
  }
142
143
 
143
- &--left {
144
- flex: 1;
145
- border-right: 1px solid var(--xh-popup-border-color);
144
+ // Matched to FilterChooser equivalent.
145
+ & > .svg-inline--fa {
146
+ width: 12px;
146
147
  }
148
+ }
147
149
 
148
- --xh-menu-border: none;
150
+ &__favorite {
151
+ align-items: center;
152
+ max-width: 50vw;
149
153
 
150
- .bp5-menu {
151
- padding: 0;
154
+ .xh-button {
155
+ padding: 0 !important;
156
+ min-width: 20px !important;
157
+ min-height: 20px !important;
158
+ visibility: hidden;
152
159
  }
153
160
 
154
- &__favorite {
155
- align-items: center;
161
+ &:hover {
162
+ background-color: var(--xh-bg-highlight);
156
163
 
157
164
  .xh-button {
158
- padding: 0 !important;
159
- min-width: 20px !important;
160
- min-height: 20px !important;
161
- visibility: hidden;
162
- }
163
-
164
- &:hover {
165
- background-color: var(--xh-bg-highlight);
166
-
167
- .xh-button {
168
- visibility: unset;
169
- }
165
+ visibility: unset;
170
166
  }
171
167
  }
172
168
  }