Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add expand/collapse affordance in the left column header of ZoneGrids. #3790

Merged
merged 7 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 68.0.0-SNAPSHOT - unreleased

### 🎁 New Features

* Added expand/collapse affordance in the left column header of ZoneGrids.

### ⚙️ Technical

* Updated Admin Console's Cluster tab to refresh more frequently.
Expand Down
14 changes: 12 additions & 2 deletions cmp/grid/columns/Column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ export interface ColumnSpec {
*/
isTreeColumn?: boolean;

/**
* For ZoneGrids, the left most column will be set to true by Hoist. Similar to
* isTreeColumn, this flag is used in conjunction with the headerHasExpandCollapse flag to
* potentially provide a expand/collapse all icon in the column header.
*/
isLeftZoneColumn?: boolean;

/**
* Primary user-facing name for this Column. Sourced from the corresponding data
* `Field.displayName` from the parent `GridModel.store` config, if available, or defaulted
Expand All @@ -112,8 +119,8 @@ export interface ColumnSpec {
headerTooltip?: string;

/**
* True if this column header will host an expand/collapse all icon. `Column.isTreeColumn`
* must be enabled. Defaults to true.
* True if this column header will host an expand/collapse all icon. `Column.isTreeColumn` or
* `Column.isLeftZoneColumn` must be enabled. Defaults to true.
*/
headerHasExpandCollapse?: boolean;

Expand Down Expand Up @@ -424,6 +431,7 @@ export class Column {
fieldPath: Some<string>;
colId: string;
isTreeColumn: boolean;
isLeftZoneColumn: boolean;
lbwexler marked this conversation as resolved.
Show resolved Hide resolved
displayName: string;
headerName: ColumnHeaderNameFn | ReactNode;
headerTooltip: string;
Expand Down Expand Up @@ -497,6 +505,7 @@ export class Column {
field,
colId,
isTreeColumn,
isLeftZoneColumn,
displayName,
headerName,
headerTooltip,
Expand Down Expand Up @@ -568,6 +577,7 @@ export class Column {
throwIf(!this.colId, 'Must specify colId or field for a Column.');

this.isTreeColumn = withDefault(isTreeColumn, false);
this.isLeftZoneColumn = withDefault(isLeftZoneColumn, false);

// Note that parent GridModel might have already defaulted displayName from an associated
// `Store.field` when pre-processing Column configs - prior to calling this ctor. If that
Expand Down
2 changes: 1 addition & 1 deletion cmp/grid/impl/ColumnHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const columnHeader = hoistCmp.factory<ColumnHeaderProps>({
const {xhColumn} = model;
if (
!xhColumn ||
!xhColumn.isTreeColumn ||
!(xhColumn.isTreeColumn || xhColumn.isLeftZoneColumn) ||
!xhColumn.headerHasExpandCollapse ||
!model.rootsWithChildren
) {
Expand Down
1 change: 1 addition & 0 deletions cmp/zoneGrid/ZoneGridModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ export class ZoneGridModel extends HoistModel {
// Controlled properties
field: isLeft ? 'left_column' : 'right_column',
align: isLeft ? 'left' : 'right',
isLeftZoneColumn: isLeft,
flex: overrideSpec.width ? null : isLeft ? 2 : 1,
renderer: (value, context) => zoneGridRenderer(value, context, isLeft),
rendererIsComplex: true,
Expand Down
Loading