@xh/hoist 75.0.0-SNAPSHOT.1753115287677 → 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 +1 -1
- package/admin/tabs/cluster/objects/ClusterObjectsModel.ts +1 -1
- package/build/types/cmp/grid/GridModel.d.ts +3 -3
- package/build/types/cmp/zoneGrid/ZoneGridModel.d.ts +1 -1
- package/cmp/grid/Grid.ts +1 -1
- package/cmp/grid/GridModel.ts +10 -10
- package/cmp/grid/impl/InitPersist.ts +3 -3
- package/cmp/grid/impl/MenuSupport.ts +4 -4
- package/cmp/zoneGrid/ZoneGridModel.ts +1 -1
- package/desktop/cmp/leftrightchooser/LeftRightChooserModel.ts +2 -2
- 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,7 +429,7 @@ 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
|
-
|
|
432
|
+
expandLevel: 1,
|
|
433
433
|
levelLabels: () => ['Total', ...this.groupingChooserModel.valueDisplayNames],
|
|
434
434
|
columns: [
|
|
435
435
|
{
|
|
@@ -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.
|
|
@@ -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
|
|
|
@@ -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,7 +283,7 @@ 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
289
|
// Validate level labels.
|
|
@@ -300,13 +300,13 @@ function levelExpandAction(gridModel: GridModel): RecordAction {
|
|
|
300
300
|
|
|
301
301
|
const items = levelLabels.map((label, idx) => {
|
|
302
302
|
const isCurrLevel =
|
|
303
|
-
|
|
304
|
-
(
|
|
303
|
+
expandLevel === idx ||
|
|
304
|
+
(expandLevel > maxDepth && idx === levelLabels.length - 1);
|
|
305
305
|
|
|
306
306
|
return {
|
|
307
307
|
icon: isCurrLevel ? Icon.check() : null,
|
|
308
308
|
text: label,
|
|
309
|
-
actionFn: () => gridModel.
|
|
309
|
+
actionFn: () => gridModel.expandToLevel(idx)
|
|
310
310
|
};
|
|
311
311
|
});
|
|
312
312
|
return {items};
|
|
@@ -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;
|
|
@@ -189,7 +189,7 @@ export class LeftRightChooserModel extends HoistModel {
|
|
|
189
189
|
onRowDoubleClicked: e => this.onRowDoubleClicked(e),
|
|
190
190
|
columns: [leftTextCol, groupCol],
|
|
191
191
|
contextMenu: false,
|
|
192
|
-
|
|
192
|
+
expandLevel: leftGroupingExpanded ? 1 : 0,
|
|
193
193
|
xhImpl: true
|
|
194
194
|
});
|
|
195
195
|
|
|
@@ -201,7 +201,7 @@ export class LeftRightChooserModel extends HoistModel {
|
|
|
201
201
|
onRowDoubleClicked: e => this.onRowDoubleClicked(e),
|
|
202
202
|
columns: [rightTextCol, groupCol],
|
|
203
203
|
contextMenu: false,
|
|
204
|
-
|
|
204
|
+
expandLevel: rightGroupingExpanded ? 1 : 0,
|
|
205
205
|
xhImpl: true
|
|
206
206
|
});
|
|
207
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",
|