@xh/hoist 75.0.0-SNAPSHOT.1752891558856 → 75.0.0-SNAPSHOT.1753116344421
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 +1 -1
- package/admin/tabs/activity/tracking/ActivityTrackingModel.ts +2 -2
- package/admin/tabs/cluster/objects/ClusterObjectsModel.ts +1 -1
- package/build/types/cmp/grid/GridModel.d.ts +3 -3
- package/build/types/cmp/grouping/GroupingChooserModel.d.ts +1 -1
- package/build/types/cmp/zoneGrid/ZoneGridModel.d.ts +1 -1
- package/cmp/grid/Grid.ts +1 -1
- package/cmp/grid/GridModel.ts +11 -11
- package/cmp/grid/impl/InitPersist.ts +3 -3
- package/cmp/grid/impl/MenuSupport.ts +10 -6
- package/cmp/grouping/GroupingChooserModel.ts +5 -4
- package/cmp/zoneGrid/ZoneGridModel.ts +1 -1
- package/desktop/cmp/leftrightchooser/LeftRightChooser.ts +2 -9
- package/desktop/cmp/leftrightchooser/LeftRightChooserModel.ts +8 -5
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
### 🎁 New Features
|
|
6
6
|
|
|
7
|
-
* Added new `GridModel.
|
|
7
|
+
* Added new `GridModel.expandLevel` config to control the expansion state of tree/grouped grids.
|
|
8
8
|
* Replaces the use of the `agOptions.groupDefaultExpanded` on the component.
|
|
9
9
|
* The most recently expanded level is persistable with other grid state.
|
|
10
10
|
* The default grid context menu now supports a new item to allow users to expand/collapse out to
|
|
@@ -429,8 +429,8 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
|
|
|
429
429
|
exportOptions: {filename: exportFilename('activity-summary')},
|
|
430
430
|
emptyText: 'No activity reported...',
|
|
431
431
|
sortBy: ['cubeLabel'],
|
|
432
|
-
|
|
433
|
-
levelLabels: () => ['Total', ...this.groupingChooserModel.
|
|
432
|
+
expandLevel: 1,
|
|
433
|
+
levelLabels: () => ['Total', ...this.groupingChooserModel.valueDisplayNames],
|
|
434
434
|
columns: [
|
|
435
435
|
{
|
|
436
436
|
field: {
|
|
@@ -43,7 +43,7 @@ export class ClusterObjectsModel extends HoistModel {
|
|
|
43
43
|
@managed gridModel = new GridModel({
|
|
44
44
|
selModel: 'multiple',
|
|
45
45
|
treeMode: true,
|
|
46
|
-
|
|
46
|
+
expandLevel: 2,
|
|
47
47
|
autosizeOptions: {mode: 'managed', includeCollapsedChildren: true},
|
|
48
48
|
enableExport: true,
|
|
49
49
|
exportOptions: {filename: exportFilenameWithDate('cluster-objects'), columns: 'ALL'},
|
|
@@ -58,7 +58,7 @@ export interface GridConfig {
|
|
|
58
58
|
* Depth level to expand to on initial load. 0 = all collapsed, 1 = top level expanded, etc.
|
|
59
59
|
* Defaults to 0 for tree grids (i.e. treeMode = true), 1 for standard grouped grids.
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
expandLevel?: number;
|
|
62
62
|
/** True (default) to show a count of group member rows within each full-width group row. */
|
|
63
63
|
showGroupRowCounts?: boolean;
|
|
64
64
|
/** Size of text in grid. If undefined, will default and bind to `XH.sizingMode`. */
|
|
@@ -261,7 +261,7 @@ export declare class GridModel extends HoistModel {
|
|
|
261
261
|
expandState: any;
|
|
262
262
|
sortBy: GridSorter[];
|
|
263
263
|
groupBy: string[];
|
|
264
|
-
|
|
264
|
+
expandLevel: number;
|
|
265
265
|
get persistableColumnState(): ColumnState[];
|
|
266
266
|
showSummary: boolean | VSide;
|
|
267
267
|
emptyText: ReactNode;
|
|
@@ -435,7 +435,7 @@ export declare class GridModel extends HoistModel {
|
|
|
435
435
|
/** Collapse all parent rows in grouped or tree grid. */
|
|
436
436
|
collapseAll(): void;
|
|
437
437
|
/** Expand all parent rows in grouped or tree grid to the specified level. */
|
|
438
|
-
|
|
438
|
+
expandToLevel(level: number): void;
|
|
439
439
|
/**
|
|
440
440
|
* Sort this grid.
|
|
441
441
|
* This method is a no-op if provided any sorters without a corresponding column.
|
|
@@ -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(): {
|
|
@@ -73,7 +73,7 @@ export interface ZoneGridConfig {
|
|
|
73
73
|
/** Column ID(s) by which to do full-width grouping. */
|
|
74
74
|
groupBy?: Some<string>;
|
|
75
75
|
/** Group level to expand to on initial load. 0 = all collapsed, 1 = only top level expanded. */
|
|
76
|
-
|
|
76
|
+
expandLevel?: number;
|
|
77
77
|
/** True (default) to show a count of group member rows within each full-width group row. */
|
|
78
78
|
showGroupRowCounts?: boolean;
|
|
79
79
|
/** True to highlight the currently hovered row. */
|
package/cmp/grid/Grid.ts
CHANGED
|
@@ -246,7 +246,7 @@ export class GridLocalModel extends HoistModel {
|
|
|
246
246
|
navigateToNextCell: this.navigateToNextCell,
|
|
247
247
|
processCellForClipboard: this.processCellForClipboard,
|
|
248
248
|
initialGroupOrderComparator: model.groupSortFn ? this.groupSortComparator : undefined,
|
|
249
|
-
groupDefaultExpanded: model.
|
|
249
|
+
groupDefaultExpanded: model.expandLevel,
|
|
250
250
|
groupDisplayType: 'groupRows',
|
|
251
251
|
groupRowRendererParams: {
|
|
252
252
|
innerRenderer: model.groupRowRenderer,
|
package/cmp/grid/GridModel.ts
CHANGED
|
@@ -172,7 +172,7 @@ export interface GridConfig {
|
|
|
172
172
|
* Depth level to expand to on initial load. 0 = all collapsed, 1 = top level expanded, etc.
|
|
173
173
|
* Defaults to 0 for tree grids (i.e. treeMode = true), 1 for standard grouped grids.
|
|
174
174
|
*/
|
|
175
|
-
|
|
175
|
+
expandLevel?: number;
|
|
176
176
|
|
|
177
177
|
/** True (default) to show a count of group member rows within each full-width group row. */
|
|
178
178
|
showGroupRowCounts?: boolean;
|
|
@@ -426,7 +426,7 @@ export class GridModel extends HoistModel {
|
|
|
426
426
|
@observable.ref expandState: any = {};
|
|
427
427
|
@observable.ref sortBy: GridSorter[] = [];
|
|
428
428
|
@observable.ref groupBy: string[] = null;
|
|
429
|
-
@observable
|
|
429
|
+
@observable expandLevel: number = 0;
|
|
430
430
|
|
|
431
431
|
get persistableColumnState(): ColumnState[] {
|
|
432
432
|
return this.cleanColumnState(this.columnState);
|
|
@@ -540,7 +540,7 @@ export class GridModel extends HoistModel {
|
|
|
540
540
|
restoreDefaultsWarning = GridModel.DEFAULT_RESTORE_DEFAULTS_WARNING,
|
|
541
541
|
fullRowEditing = false,
|
|
542
542
|
clicksToEdit = 2,
|
|
543
|
-
|
|
543
|
+
expandLevel = treeMode ? 0 : 1,
|
|
544
544
|
levelLabels,
|
|
545
545
|
highlightRowOnClick = XH.isMobileApp,
|
|
546
546
|
experimental,
|
|
@@ -588,7 +588,7 @@ export class GridModel extends HoistModel {
|
|
|
588
588
|
this.clicksToExpand = clicksToExpand;
|
|
589
589
|
this.clicksToEdit = clicksToEdit;
|
|
590
590
|
this.highlightRowOnClick = highlightRowOnClick;
|
|
591
|
-
this.
|
|
591
|
+
this.expandLevel = expandLevel;
|
|
592
592
|
this.levelLabels = levelLabels;
|
|
593
593
|
|
|
594
594
|
throwIf(
|
|
@@ -644,9 +644,9 @@ export class GridModel extends HoistModel {
|
|
|
644
644
|
});
|
|
645
645
|
|
|
646
646
|
this.addReaction({
|
|
647
|
-
track: () => [this.
|
|
647
|
+
track: () => [this.expandLevel, this.isReady],
|
|
648
648
|
run: () => {
|
|
649
|
-
this.agApi?.setGridOption('groupDefaultExpanded', this.
|
|
649
|
+
this.agApi?.setGridOption('groupDefaultExpanded', this.expandLevel);
|
|
650
650
|
}
|
|
651
651
|
});
|
|
652
652
|
|
|
@@ -773,7 +773,7 @@ export class GridModel extends HoistModel {
|
|
|
773
773
|
const {selModel} = this,
|
|
774
774
|
row = this.agGridModel.getFirstSelectableRowNode();
|
|
775
775
|
|
|
776
|
-
// If displayed
|
|
776
|
+
// If displayed, or potentially expandable to display, select it.
|
|
777
777
|
if (row && (expandParentGroups || row.displayed)) {
|
|
778
778
|
const id = row.data.id;
|
|
779
779
|
if (id != null) {
|
|
@@ -1028,18 +1028,18 @@ export class GridModel extends HoistModel {
|
|
|
1028
1028
|
|
|
1029
1029
|
/** Expand all parent rows in grouped or tree grid. (Note, this is recursive for trees!) */
|
|
1030
1030
|
expandAll() {
|
|
1031
|
-
this.
|
|
1031
|
+
this.expandToLevel(this.maxDepth);
|
|
1032
1032
|
}
|
|
1033
1033
|
|
|
1034
1034
|
/** Collapse all parent rows in grouped or tree grid. */
|
|
1035
1035
|
collapseAll() {
|
|
1036
|
-
this.
|
|
1036
|
+
this.expandToLevel(0);
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
1039
1039
|
/** Expand all parent rows in grouped or tree grid to the specified level. */
|
|
1040
1040
|
@action
|
|
1041
|
-
|
|
1042
|
-
this.
|
|
1041
|
+
expandToLevel(level: number) {
|
|
1042
|
+
this.expandLevel = level;
|
|
1043
1043
|
}
|
|
1044
1044
|
|
|
1045
1045
|
/**
|
|
@@ -83,12 +83,12 @@ export function initPersist(
|
|
|
83
83
|
: rootPersistWith;
|
|
84
84
|
PersistenceProvider.create({
|
|
85
85
|
persistOptions: {
|
|
86
|
-
path: `${path}.
|
|
86
|
+
path: `${path}.expandLevel`,
|
|
87
87
|
...persistWith
|
|
88
88
|
},
|
|
89
89
|
target: {
|
|
90
|
-
getPersistableState: () => new PersistableState(gridModel.
|
|
91
|
-
setPersistableState: ({value}) => gridModel.
|
|
90
|
+
getPersistableState: () => new PersistableState(gridModel.expandLevel),
|
|
91
|
+
setPersistableState: ({value}) => gridModel.expandToLevel(value)
|
|
92
92
|
},
|
|
93
93
|
owner: gridModel
|
|
94
94
|
});
|
|
@@ -283,26 +283,30 @@ function levelExpandAction(gridModel: GridModel): RecordAction {
|
|
|
283
283
|
text: 'Expand to ...',
|
|
284
284
|
displayFn: () => {
|
|
285
285
|
// Don't show for degenerate shallow grid models, or if we don't have labels
|
|
286
|
-
const {maxDepth,
|
|
286
|
+
const {maxDepth, expandLevel} = 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
|
|
291
|
+
if (!levelLabels) {
|
|
292
|
+
return {hidden: true};
|
|
293
|
+
}
|
|
294
|
+
if (levelLabels.length < maxDepth + 1) {
|
|
291
295
|
gridModel.logDebug(
|
|
292
|
-
'
|
|
296
|
+
'Value produced by `GridModel.levelLabels` has insufficient length. No menu items shown.'
|
|
293
297
|
);
|
|
294
298
|
return {hidden: true};
|
|
295
299
|
}
|
|
296
300
|
|
|
297
301
|
const items = levelLabels.map((label, idx) => {
|
|
298
302
|
const isCurrLevel =
|
|
299
|
-
|
|
300
|
-
(
|
|
303
|
+
expandLevel === idx ||
|
|
304
|
+
(expandLevel > maxDepth && idx === levelLabels.length - 1);
|
|
301
305
|
|
|
302
306
|
return {
|
|
303
307
|
icon: isCurrLevel ? Icon.check() : null,
|
|
304
308
|
text: label,
|
|
305
|
-
actionFn: () => gridModel.
|
|
309
|
+
actionFn: () => gridModel.expandToLevel(idx)
|
|
306
310
|
};
|
|
307
311
|
});
|
|
308
312
|
return {items};
|
|
@@ -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
|
}
|
|
@@ -148,7 +148,7 @@ export interface ZoneGridConfig {
|
|
|
148
148
|
groupBy?: Some<string>;
|
|
149
149
|
|
|
150
150
|
/** Group level to expand to on initial load. 0 = all collapsed, 1 = only top level expanded. */
|
|
151
|
-
|
|
151
|
+
expandLevel?: number;
|
|
152
152
|
|
|
153
153
|
/** True (default) to show a count of group member rows within each full-width group row. */
|
|
154
154
|
showGroupRowCounts?: boolean;
|
|
@@ -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
|
|
36
|
+
grid({model: model.leftModel}),
|
|
44
37
|
chooserToolbar(),
|
|
45
|
-
grid({model: model.rightModel
|
|
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
|
|
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
|
-
|
|
170
|
-
flex: true,
|
|
173
|
+
...colSpec,
|
|
171
174
|
headerName: () =>
|
|
172
175
|
rightTitle + (showCounts ? ` (${this.rightModel.store.count})` : ''),
|
|
173
176
|
renderer: this.getTextColRenderer('right')
|
|
@@ -186,7 +189,7 @@ export class LeftRightChooserModel extends HoistModel {
|
|
|
186
189
|
onRowDoubleClicked: e => this.onRowDoubleClicked(e),
|
|
187
190
|
columns: [leftTextCol, groupCol],
|
|
188
191
|
contextMenu: false,
|
|
189
|
-
|
|
192
|
+
expandLevel: leftGroupingExpanded ? 1 : 0,
|
|
190
193
|
xhImpl: true
|
|
191
194
|
});
|
|
192
195
|
|
|
@@ -198,7 +201,7 @@ export class LeftRightChooserModel extends HoistModel {
|
|
|
198
201
|
onRowDoubleClicked: e => this.onRowDoubleClicked(e),
|
|
199
202
|
columns: [rightTextCol, groupCol],
|
|
200
203
|
contextMenu: false,
|
|
201
|
-
|
|
204
|
+
expandLevel: rightGroupingExpanded ? 1 : 0,
|
|
202
205
|
xhImpl: true
|
|
203
206
|
});
|
|
204
207
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "75.0.0-SNAPSHOT.
|
|
3
|
+
"version": "75.0.0-SNAPSHOT.1753116344421",
|
|
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",
|