@xh/hoist 75.0.0-SNAPSHOT.1752873581842 → 75.0.0-SNAPSHOT.1753115287677

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.
package/CHANGELOG.md CHANGED
@@ -4,27 +4,24 @@
4
4
 
5
5
  ### 🎁 New Features
6
6
 
7
- * New property `GridModel.expandToLevel` governs the expansion state of tree and grouped grids.
8
- Replaces the use of the `agOptions.groupDefaultExpanded` on the component.
9
- * Most recently chosen level is persistable with other grid state.
10
- * Default grid context menu has a menu item to trigger bulk expand/collapse to particular depth
11
- level for multi-level (e.g. depth > 2) grids. To enable, implement the `GridModel.levelLabels`
12
- property for your grid.
13
- * Added new `GroupingChooserModel.sortDimensions` config - can be set to false to respect the order
14
- in which dimensions are provided to the model.
15
-
16
- ### 🐞 Bug Fixes
17
-
18
- * DashCanvas: ensure `allowAdd=false` is not enforced if loadingState
19
- and hide `Add` context menu item in views in if `allowAdd=false`
20
- * DashCanvas: style with `position: relative;` to ensure that the empty state overlay is positioned
21
- within the canvas, not the next parent container up that has `position: relative;`.
22
-
23
- * `useContextModel` is now reactive to a change of an (observable) resolved model when it is set.
24
- Previously this value was cached on first render.
25
-
26
- * Fixes to framework components that bind to grids (e.g. `ColChooserButton`, `ColAutosizeButton`,
27
- `GridFindField`) to rebind to a new observable GridModel available via context.
7
+ * Added new `GridModel.expandToLevel` config to control the expansion state of tree/grouped grids.
8
+ * Replaces the use of the `agOptions.groupDefaultExpanded` on the component.
9
+ * The most recently expanded level is persistable with other grid state.
10
+ * The default grid context menu now supports a new item to allow users to expand/collapse out to
11
+ a specific level/depth. Set `GridModel.levelLabels` to activate this feature.
12
+ * Added new `GroupingChooserModel.sortDimensions` config. Set to `false` to respect the order in
13
+ which `dimensions` are provided to the model.
14
+
15
+ ### 🐞 Bug Fixes
16
+
17
+ * Fixed minor `DashCanvas` issues with `allowAdd: false`, ensuring it does not block additions made
18
+ via `loadState()` and hiding the `Add` context menu item in views as intended.
19
+ * Updated `DashCanvas` CSS to set `position: relative;`, ensuring that the empty state overlay is
20
+ positioned as intended and does not extend beyond the canvas.
21
+ * Improved the core `useContextModel` hook to make it reactive to a change of an (observable)
22
+ resolved model. Previously this value was cached on first render.
23
+ * Fixed framework components that bind to grids (e.g. `ColChooserButton`, `ColAutosizeButton`,
24
+ `GridFindField`), ensuring they automatically rebind to a new observable `GridModel` via context.
28
25
 
29
26
  ## v74.1.2 - 2025-07-03
30
27
 
@@ -430,7 +430,7 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
430
430
  emptyText: 'No activity reported...',
431
431
  sortBy: ['cubeLabel'],
432
432
  expandToLevel: 1,
433
- levelLabels: () => ['Total', ...this.groupingChooserModel.getValueDisplayNames()],
433
+ levelLabels: () => ['Total', ...this.groupingChooserModel.valueDisplayNames],
434
434
  columns: [
435
435
  {
436
436
  field: {
@@ -140,9 +140,10 @@ export interface GridConfig {
140
140
  */
141
141
  onCellContextMenu?: (e: CellContextMenuEvent) => void;
142
142
  /**
143
- * Array of labels (or a function returning one) that describes the individual depth
144
- * levels in a tree or grouped grid. If provided, will be used to construct expand/collapse
145
- * options in the default context menu.
143
+ * Array of strings (or a function returning one) providing user-facing labels for each depth
144
+ * level in a tree or grouped grid - e.g. `['Country', 'State', 'City']`. If set, the
145
+ * expand/collapse options in the default context menu will be enhanced to allow users to
146
+ * expand/collapse to a specific level.
146
147
  */
147
148
  levelLabels?: Thunkable<string[]>;
148
149
  /**
@@ -62,6 +62,7 @@ export declare class GroupingChooserModel extends HoistModel {
62
62
  get availableDims(): string[];
63
63
  get dimensionSpecs(): DimensionSpec[];
64
64
  get isValid(): boolean;
65
+ get valueDisplayNames(): string[];
65
66
  get isAddEnabled(): boolean;
66
67
  get isAddFavoriteEnabled(): boolean;
67
68
  constructor({ allowEmpty, commitOnChange, dimensions, initialFavorites, initialValue, maxDepth, persistWith, sortDimensions }: GroupingChooserConfig);
@@ -78,7 +79,6 @@ export declare class GroupingChooserModel extends HoistModel {
78
79
  commitPendingValueAndClose(): void;
79
80
  validateValue(value: string[]): boolean;
80
81
  getValueLabel(value: string[]): string;
81
- getValueDisplayNames(): string[];
82
82
  getDimDisplayName(dimName: string): string;
83
83
  onDragEnd(result: any): void;
84
84
  get favoritesOptions(): {
@@ -280,9 +280,10 @@ export interface GridConfig {
280
280
  onCellContextMenu?: (e: CellContextMenuEvent) => void;
281
281
 
282
282
  /**
283
- * Array of labels (or a function returning one) that describes the individual depth
284
- * levels in a tree or grouped grid. If provided, will be used to construct expand/collapse
285
- * options in the default context menu.
283
+ * Array of strings (or a function returning one) providing user-facing labels for each depth
284
+ * level in a tree or grouped grid - e.g. `['Country', 'State', 'City']`. If set, the
285
+ * expand/collapse options in the default context menu will be enhanced to allow users to
286
+ * expand/collapse to a specific level.
286
287
  */
287
288
  levelLabels?: Thunkable<string[]>;
288
289
 
@@ -772,7 +773,7 @@ export class GridModel extends HoistModel {
772
773
  const {selModel} = this,
773
774
  row = this.agGridModel.getFirstSelectableRowNode();
774
775
 
775
- // If displayed select it -- we never want to auto-expand parent rows
776
+ // If displayed, or potentially expandable to display, select it.
776
777
  if (row && (expandParentGroups || row.displayed)) {
777
778
  const id = row.data.id;
778
779
  if (id != null) {
@@ -286,10 +286,14 @@ function levelExpandAction(gridModel: GridModel): RecordAction {
286
286
  const {maxDepth, expandToLevel} = gridModel;
287
287
  if (maxDepth <= 1) return {hidden: true};
288
288
 
289
+ // Validate level labels.
289
290
  const levelLabels = executeIfFunction(gridModel.levelLabels);
290
- if (!levelLabels || levelLabels.length < maxDepth + 1) {
291
+ if (!levelLabels) {
292
+ return {hidden: true};
293
+ }
294
+ if (levelLabels.length < maxDepth + 1) {
291
295
  gridModel.logDebug(
292
- '"levelLabels" not provided or of insufficient length. No menu items shown.'
296
+ 'Value produced by `GridModel.levelLabels` has insufficient length. No menu items shown.'
293
297
  );
294
298
  return {hidden: true};
295
299
  }
@@ -121,6 +121,11 @@ export class GroupingChooserModel extends HoistModel {
121
121
  return this.validateValue(this.pendingValue);
122
122
  }
123
123
 
124
+ @computed
125
+ get valueDisplayNames(): string[] {
126
+ return this.value.map(dimName => this.getDimDisplayName(dimName));
127
+ }
128
+
124
129
  @computed
125
130
  get isAddEnabled(): boolean {
126
131
  const {pendingValue, maxDepth, dimensionNames, availableDims} = this,
@@ -274,10 +279,6 @@ export class GroupingChooserModel extends HoistModel {
274
279
  return value.map(dimName => this.getDimDisplayName(dimName)).join(' › ');
275
280
  }
276
281
 
277
- getValueDisplayNames(): string[] {
278
- return this.value.map(dimName => this.getDimDisplayName(dimName));
279
- }
280
-
281
282
  getDimDisplayName(dimName: string) {
282
283
  return this.dimensions[dimName]?.displayName ?? dimName;
283
284
  }
@@ -4,7 +4,6 @@
4
4
  *
5
5
  * Copyright © 2025 Extremely Heavy Industries Inc.
6
6
  */
7
- import {GridOptions} from '@ag-grid-community/core';
8
7
  import {grid} from '@xh/hoist/cmp/grid';
9
8
  import {hframe, vbox} from '@xh/hoist/cmp/layout';
10
9
  import {BoxProps, hoistCmp, HoistProps, uses} from '@xh/hoist/core';
@@ -28,21 +27,15 @@ export const [LeftRightChooser, leftRightChooser] = hoistCmp.withFactory<LeftRig
28
27
  className: 'xh-lr-chooser',
29
28
 
30
29
  render({model, ...props}, ref) {
31
- const agOptions: GridOptions = {
32
- defaultColDef: {
33
- resizable: false
34
- }
35
- };
36
-
37
30
  return vbox({
38
31
  ref,
39
32
  items: [
40
33
  hframe({
41
34
  className: 'xh-lr-chooser__grid-frame',
42
35
  items: [
43
- grid({model: model.leftModel, agOptions}),
36
+ grid({model: model.leftModel}),
44
37
  chooserToolbar(),
45
- grid({model: model.rightModel, agOptions})
38
+ grid({model: model.rightModel})
46
39
  ]
47
40
  }),
48
41
  description()
@@ -158,16 +158,19 @@ export class LeftRightChooserModel extends HoistModel {
158
158
  ]
159
159
  };
160
160
 
161
- const leftTextCol = {
161
+ const colSpec = {
162
162
  field: 'text',
163
163
  flex: true,
164
+ resizable: true
165
+ },
166
+ leftTextCol = {
167
+ ...colSpec,
164
168
  headerName: () =>
165
169
  leftTitle + (showCounts ? ` (${this.leftModel.store.count})` : ''),
166
170
  renderer: this.getTextColRenderer('left')
167
171
  },
168
172
  rightTextCol = {
169
- field: 'text',
170
- flex: true,
173
+ ...colSpec,
171
174
  headerName: () =>
172
175
  rightTitle + (showCounts ? ` (${this.rightModel.store.count})` : ''),
173
176
  renderer: this.getTextColRenderer('right')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "75.0.0-SNAPSHOT.1752873581842",
3
+ "version": "75.0.0-SNAPSHOT.1753115287677",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",