-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into gridFullWidthScroll
# Conflicts: # CHANGELOG.md
- Loading branch information
Showing
37 changed files
with
2,785 additions
and
640 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* This file belongs to Hoist, an application development toolkit | ||
* developed by Extremely Heavy Industries (www.xh.io | [email protected]) | ||
* | ||
* Copyright © 2023 Extremely Heavy Industries Inc. | ||
*/ | ||
|
||
import {Column, ColumnRenderer, ColumnSortSpec} from '@xh/hoist/cmp/grid'; | ||
import {PersistOptions} from '@xh/hoist/core'; | ||
|
||
export type Zone = 'tl' | 'tr' | 'bl' | 'br'; | ||
|
||
export interface ZoneMapping { | ||
/** Field to display. Must match a Field found in the Store */ | ||
field: string; | ||
/** True to prefix the field value with its name */ | ||
showLabel?: boolean; | ||
} | ||
|
||
export interface ZoneLimit { | ||
/** Min number of fields that should be mapped to the zone */ | ||
min?: number; | ||
/** Max number of fields that should be mapped to the zone */ | ||
max?: number; | ||
/** Array of allowed fields for the zone */ | ||
only?: string[]; | ||
} | ||
|
||
export interface ZoneField { | ||
field: string; | ||
displayName: string; | ||
label: string; | ||
renderer: ColumnRenderer; | ||
column: Column; | ||
chooserGroup: string; | ||
sortable: boolean; | ||
sortingOrder: ColumnSortSpec[]; | ||
} | ||
|
||
export interface ZoneGridModelPersistOptions extends PersistOptions { | ||
/** True to include mapping information (default true) */ | ||
persistMapping?: boolean; | ||
/** True to include grouping information (default true) */ | ||
persistGrouping?: boolean; | ||
/** True to include sorting information (default true) */ | ||
persistSort?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* This file belongs to Hoist, an application development toolkit | ||
* developed by Extremely Heavy Industries (www.xh.io | [email protected]) | ||
* | ||
* Copyright © 2023 Extremely Heavy Industries Inc. | ||
*/ | ||
import {hoistCmp, HoistProps, LayoutProps, TestSupportProps, uses, XH} from '@xh/hoist/core'; | ||
import {fragment} from '@xh/hoist/cmp/layout'; | ||
import {GridOptions} from '@xh/hoist/kit/ag-grid'; | ||
import {grid} from '@xh/hoist/cmp/grid'; | ||
import {splitLayoutProps} from '@xh/hoist/utils/react'; | ||
import {zoneMapper as desktopZoneMapper} from '@xh/hoist/dynamics/desktop'; | ||
import {zoneMapper as mobileZoneMapper} from '@xh/hoist/dynamics/mobile'; | ||
import {ZoneGridModel} from './ZoneGridModel'; | ||
|
||
export interface ZoneGridProps extends HoistProps<ZoneGridModel>, LayoutProps, TestSupportProps { | ||
/** | ||
* Options for ag-Grid's API. | ||
* | ||
* This constitutes an 'escape hatch' for applications that need to get to the underlying | ||
* ag-Grid API. It should be used with care. Settings made here might be overwritten and/or | ||
* interfere with the implementation of this component and its use of the ag-Grid API. | ||
* | ||
* Note that changes to these options after the component's initial render will be ignored. | ||
*/ | ||
agOptions?: GridOptions; | ||
} | ||
|
||
/** | ||
* A ZoneGrid is a specialized version of the Grid component. | ||
* | ||
* It displays its data with multi-line full-width rows, each broken into four zones for | ||
* top/bottom and left/right - (tl, tr, bl, br). Zone mappings determine which of the | ||
* available fields should be extracted from the record and rendered into each zone. | ||
*/ | ||
export const [ZoneGrid, zoneGrid] = hoistCmp.withFactory<ZoneGridProps>({ | ||
displayName: 'ZoneGrid', | ||
model: uses(ZoneGridModel), | ||
className: 'xh-zone-grid', | ||
|
||
render({model, className, testId, ...props}, ref) { | ||
const {gridModel, mapperModel} = model, | ||
[layoutProps] = splitLayoutProps(props), | ||
platformZoneMapper = XH.isMobileApp ? mobileZoneMapper : desktopZoneMapper; | ||
|
||
return fragment( | ||
grid({ | ||
...layoutProps, | ||
className, | ||
testId, | ||
ref, | ||
model: gridModel, | ||
agOptions: { | ||
suppressRowGroupHidesColumns: true, | ||
suppressMakeColumnVisibleAfterUnGroup: true, | ||
...props.agOptions | ||
} | ||
}), | ||
mapperModel ? platformZoneMapper() : null | ||
); | ||
} | ||
}); |
Oops, something went wrong.