@xh/hoist 90.0.0 → 90.1.0
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 +136 -54
- package/admin/columns/Tracking.ts +9 -3
- package/admin/tabs/activity/tracking/ActivityTrackingModel.ts +155 -47
- package/admin/tabs/activity/tracking/ActivityTrackingPanel.ts +25 -4
- package/admin/tabs/activity/tracking/chart/AggChartModel.ts +2 -3
- package/appcontainer/ImpersonationBarModel.ts +8 -5
- package/build/types/admin/tabs/activity/tracking/ActivityTrackingModel.d.ts +25 -5
- package/build/types/cmp/cubegrid/CubeGrid.d.ts +26 -0
- package/build/types/cmp/cubegrid/CubeGridModel.d.ts +103 -0
- package/build/types/cmp/cubegrid/CubeGridPivotModel.d.ts +181 -0
- package/build/types/cmp/cubegrid/Types.d.ts +85 -0
- package/build/types/cmp/cubegrid/index.d.ts +4 -0
- package/build/types/cmp/dataview/DataViewModel.d.ts +6 -10
- package/build/types/cmp/grid/GridModel.d.ts +8 -33
- package/build/types/cmp/grid/Types.d.ts +51 -1
- package/build/types/cmp/grid/columns/Column.d.ts +2 -1
- package/build/types/cmp/grid/columns/ColumnGroup.d.ts +6 -0
- package/build/types/cmp/grid/helpers/GridCountLabel.d.ts +6 -3
- package/build/types/cmp/grid/impl/ColumnWidthCalculator.d.ts +6 -0
- package/build/types/cmp/grid/impl/GridLikeModel.d.ts +3 -0
- package/build/types/cmp/grid/impl/MenuSupport.d.ts +13 -0
- package/build/types/cmp/pdfviewer/PdfViewer.d.ts +14 -0
- package/build/types/cmp/pdfviewer/PdfViewerModel.d.ts +150 -0
- package/build/types/cmp/pdfviewer/Types.d.ts +55 -0
- package/build/types/cmp/pdfviewer/impl/PdfFindInputModel.d.ts +14 -0
- package/build/types/cmp/pdfviewer/impl/PdfViewerToolbarModel.d.ts +34 -0
- package/build/types/cmp/pdfviewer/impl/ZoomOptions.d.ts +10 -0
- package/build/types/cmp/pdfviewer/index.d.ts +3 -0
- package/build/types/cmp/statcard/StatCard.d.ts +90 -0
- package/build/types/cmp/statcard/index.d.ts +1 -0
- package/build/types/cmp/store/StoreFilterField.d.ts +8 -9
- package/build/types/cmp/store/impl/StoreFilterFieldImplModel.d.ts +4 -4
- package/build/types/cmp/zoneGrid/ZoneGridModel.d.ts +6 -10
- package/build/types/core/types/Types.d.ts +6 -0
- package/build/types/data/Field.d.ts +8 -1
- package/build/types/data/Store.d.ts +12 -0
- package/build/types/data/cube/Cube.d.ts +2 -0
- package/build/types/data/cube/CubeField.d.ts +3 -2
- package/build/types/data/cube/Query.d.ts +66 -4
- package/build/types/data/cube/View.d.ts +82 -4
- package/build/types/data/cube/ViewRowData.d.ts +13 -0
- package/build/types/data/cube/aggregate/MedianAggregator.d.ts +19 -0
- package/build/types/data/cube/aggregate/SumIfSameAggregator.d.ts +30 -0
- package/build/types/data/cube/impl/RowCache.d.ts +5 -0
- package/build/types/data/cube/impl/RowDataGenerator.d.ts +26 -0
- package/build/types/data/cube/impl/ViewDiagnostics.d.ts +27 -0
- package/build/types/data/cube/pivot/PivotCellRow.d.ts +27 -0
- package/build/types/data/cube/pivot/PivotPath.d.ts +45 -0
- package/build/types/data/cube/pivot/impl/PivotCells.d.ts +111 -0
- package/build/types/data/cube/pivot/impl/PivotReference.d.ts +39 -0
- package/build/types/data/cube/pivot/impl/PivotStructure.d.ts +105 -0
- package/build/types/data/cube/row/BaseRow.d.ts +12 -0
- package/build/types/data/cube/row/LeafRow.d.ts +4 -4
- package/build/types/data/cube/row/ParentRow.d.ts +20 -4
- package/build/types/data/cube/row/RowUpdate.d.ts +2 -0
- package/build/types/data/index.d.ts +3 -0
- package/build/types/desktop/cmp/button/grid/ColAutosizeButton.d.ts +6 -3
- package/build/types/desktop/cmp/button/grid/ColChooserButton.d.ts +7 -3
- package/build/types/desktop/cmp/button/grid/ExpandToLevelButton.d.ts +6 -3
- package/build/types/desktop/cmp/button/grid/ExportButton.d.ts +6 -3
- package/build/types/desktop/cmp/grid/find/GridFindField.d.ts +8 -9
- package/build/types/desktop/cmp/grid/find/impl/GridFindFieldImplModel.d.ts +3 -4
- package/build/types/desktop/cmp/pdfviewer/impl/PdfViewerToolbar.d.ts +12 -0
- package/build/types/desktop/cmp/statcard/impl/StatCardInfoImpl.d.ts +12 -0
- package/build/types/dynamics/desktop.d.ts +2 -0
- package/build/types/dynamics/mobile.d.ts +1 -0
- package/build/types/icon/Icon.d.ts +12 -0
- package/build/types/kit/pdfjs/index.d.ts +23 -0
- package/build/types/kit/pdfjs/styles.d.ts +2 -0
- package/build/types/kit/swiper/index.d.ts +7 -7
- package/build/types/mobile/cmp/button/grid/ColAutosizeButton.d.ts +6 -3
- package/build/types/mobile/cmp/button/grid/ColChooserButton.d.ts +6 -3
- package/build/types/mobile/cmp/button/grid/ExpandCollapseButton.d.ts +4 -4
- package/build/types/mobile/cmp/button/grid/ExpandToLevelButton.d.ts +4 -4
- package/build/types/mobile/cmp/pdfviewer/impl/PdfViewerToolbar.d.ts +12 -0
- package/cmp/README.md +3 -0
- package/cmp/ag-grid/AgGrid.ts +25 -3
- package/cmp/cubegrid/CubeGrid.ts +60 -0
- package/cmp/cubegrid/CubeGridModel.ts +365 -0
- package/cmp/cubegrid/CubeGridPivotModel.ts +943 -0
- package/cmp/cubegrid/README.md +343 -0
- package/cmp/cubegrid/Types.ts +105 -0
- package/cmp/cubegrid/index.ts +10 -0
- package/cmp/dataview/DataViewModel.ts +13 -8
- package/cmp/grid/Grid.scss +21 -5
- package/cmp/grid/GridModel.ts +41 -47
- package/cmp/grid/Types.ts +58 -1
- package/cmp/grid/columns/Column.ts +3 -1
- package/cmp/grid/columns/ColumnGroup.ts +10 -0
- package/cmp/grid/helpers/GridCountLabel.ts +12 -5
- package/cmp/grid/impl/ColumnGroupHeader.ts +18 -4
- package/cmp/grid/impl/ColumnWidthCalculator.ts +24 -0
- package/cmp/grid/impl/GridLikeModel.ts +17 -0
- package/cmp/grid/impl/MenuSupport.ts +36 -20
- package/cmp/pdfviewer/PdfViewer.scss +48 -0
- package/cmp/pdfviewer/PdfViewer.ts +102 -0
- package/cmp/pdfviewer/PdfViewerModel.ts +641 -0
- package/cmp/pdfviewer/README.md +224 -0
- package/cmp/pdfviewer/Types.ts +72 -0
- package/cmp/pdfviewer/impl/PdfFindInputModel.ts +44 -0
- package/cmp/pdfviewer/impl/PdfViewerToolbarModel.ts +45 -0
- package/cmp/pdfviewer/impl/ZoomOptions.ts +36 -0
- package/cmp/pdfviewer/index.ts +9 -0
- package/cmp/statcard/StatCard.scss +181 -0
- package/cmp/statcard/StatCard.ts +320 -0
- package/cmp/statcard/index.ts +1 -0
- package/cmp/store/StoreFilterField.ts +8 -9
- package/cmp/store/impl/StoreFilterFieldImplModel.ts +14 -14
- package/cmp/zoneGrid/ZoneGridModel.ts +13 -8
- package/core/types/Types.ts +7 -0
- package/data/Field.ts +10 -0
- package/data/Store.ts +25 -2
- package/data/cube/Cube.ts +5 -0
- package/data/cube/CubeField.ts +5 -0
- package/data/cube/Query.ts +170 -17
- package/data/cube/README.md +77 -2
- package/data/cube/View.ts +211 -32
- package/data/cube/ViewRowData.ts +22 -0
- package/data/cube/aggregate/MedianAggregator.ts +88 -0
- package/data/cube/aggregate/SumIfSameAggregator.ts +128 -0
- package/data/cube/impl/RowCache.ts +32 -11
- package/data/cube/impl/RowDataGenerator.ts +96 -4
- package/data/cube/impl/ViewDiagnostics.ts +47 -0
- package/data/cube/pivot/PivotCellRow.ts +73 -0
- package/data/cube/pivot/PivotPath.ts +67 -0
- package/data/cube/pivot/impl/PivotCells.ts +538 -0
- package/data/cube/pivot/impl/PivotReference.ts +125 -0
- package/data/cube/pivot/impl/PivotStructure.ts +500 -0
- package/data/cube/row/BaseRow.ts +26 -0
- package/data/cube/row/LeafRow.ts +9 -8
- package/data/cube/row/ParentRow.ts +58 -25
- package/data/cube/row/RowUpdate.ts +8 -0
- package/data/index.ts +3 -0
- package/desktop/appcontainer/AppContainer.ts +5 -1
- package/desktop/cmp/button/grid/ColAutosizeButton.ts +21 -5
- package/desktop/cmp/button/grid/ColChooserButton.ts +11 -5
- package/desktop/cmp/button/grid/ExpandToLevelButton.ts +20 -5
- package/desktop/cmp/button/grid/ExportButton.ts +19 -7
- package/desktop/cmp/dash/canvas/DashCanvas.ts +26 -2
- package/desktop/cmp/grid/find/GridFindField.ts +8 -9
- package/desktop/cmp/grid/find/impl/GridFindFieldImplModel.ts +15 -16
- package/desktop/cmp/grid/impl/colchooser/ColChooserBucketModel.ts +1 -1
- package/desktop/cmp/pdfviewer/impl/PdfViewerToolbar.ts +190 -0
- package/desktop/cmp/statcard/impl/StatCardInfoImpl.ts +27 -0
- package/docs/README.md +6 -2
- package/docs/doc-registry.json +21 -5
- package/docs/upgrade-notes/v90-upgrade-notes.md +130 -0
- package/docs/version-compatibility.md +2 -1
- package/dynamics/desktop.ts +4 -0
- package/dynamics/mobile.ts +2 -0
- package/format/FormatNumber.ts +6 -2
- package/icon/Icon.ts +18 -0
- package/icon/index.ts +32 -0
- package/kit/README.md +2 -0
- package/kit/pdfjs/PdfJs.scss +25 -0
- package/kit/pdfjs/index.ts +103 -0
- package/kit/pdfjs/pdf_viewer.css +6481 -0
- package/kit/pdfjs/styles.ts +12 -0
- package/mcp/README.md +13 -0
- package/mcp/data/import-paths.ts +4 -8
- package/mcp/data/index-cache.ts +2 -1
- package/mcp/data/ts-registry.ts +8 -29
- package/mcp/util/paths.ts +26 -0
- package/mobile/appcontainer/AppContainer.ts +3 -1
- package/mobile/cmp/button/grid/ColAutosizeButton.ts +20 -5
- package/mobile/cmp/button/grid/ColChooserButton.ts +12 -5
- package/mobile/cmp/button/grid/ExpandCollapseButton.ts +10 -6
- package/mobile/cmp/button/grid/ExpandToLevelButton.ts +10 -6
- package/mobile/cmp/pdfviewer/impl/PdfViewerToolbar.ts +137 -0
- package/package.json +14 -8
- package/public/msal-redirect-bridge.min.js +1 -1
- package/styles/vars.scss +59 -0
package/cmp/grid/GridModel.ts
CHANGED
|
@@ -130,8 +130,11 @@ import type {
|
|
|
130
130
|
ColumnGroupState,
|
|
131
131
|
ColumnState,
|
|
132
132
|
ColumnStateOptions,
|
|
133
|
+
GridEnsureVisibleOptions,
|
|
134
|
+
GridLikeModel,
|
|
133
135
|
GridModelPersistOptions,
|
|
134
|
-
|
|
136
|
+
GridSelectFirstOptions,
|
|
137
|
+
GridSelectOptions,
|
|
135
138
|
GroupRowRenderer,
|
|
136
139
|
RowClassFn,
|
|
137
140
|
RowClassRuleFn
|
|
@@ -499,7 +502,7 @@ export interface GridModelDefaults {
|
|
|
499
502
|
*
|
|
500
503
|
* @mcpHint model backing all grid components
|
|
501
504
|
*/
|
|
502
|
-
export class GridModel extends HoistModel {
|
|
505
|
+
export class GridModel extends HoistModel implements GridLikeModel {
|
|
503
506
|
/**
|
|
504
507
|
* Ceilings (ms) on how long deferred grid work may be held back, calibrated to what going
|
|
505
508
|
* stale costs the user: a deferred sort leaves row order wrong, while a deferred autosize
|
|
@@ -943,20 +946,7 @@ export class GridModel extends HoistModel {
|
|
|
943
946
|
* @param records - one or more record(s) / ID(s) to select.
|
|
944
947
|
* @param opts - additional post-selection options
|
|
945
948
|
*/
|
|
946
|
-
async selectAsync(
|
|
947
|
-
records: Some<StoreRecordOrId>,
|
|
948
|
-
opts: {
|
|
949
|
-
/**
|
|
950
|
-
* True (default) to scroll the grid or expand nodes as needed to make selection
|
|
951
|
-
* visible if it is within a collapsed node or outside of the visible scroll window.
|
|
952
|
-
*/
|
|
953
|
-
ensureVisible?: boolean;
|
|
954
|
-
/** Position of the selection in the viewport - default null scrolls minimally. */
|
|
955
|
-
ensureVisiblePosition?: GridScrollPosition;
|
|
956
|
-
/** True (default) to clear previous selection (rather than add to it). */
|
|
957
|
-
clearSelection?: boolean;
|
|
958
|
-
} = {}
|
|
959
|
-
) {
|
|
949
|
+
async selectAsync(records: Some<StoreRecordOrId>, opts: GridSelectOptions = {}) {
|
|
960
950
|
const {ensureVisible = true, ensureVisiblePosition = null, clearSelection = true} = opts;
|
|
961
951
|
this.selModel.select(records, clearSelection);
|
|
962
952
|
if (ensureVisible) {
|
|
@@ -971,20 +961,7 @@ export class GridModel extends HoistModel {
|
|
|
971
961
|
* any pre-existing selection unchanged, which is what apps typically want when reloading an
|
|
972
962
|
* already-populated grid.
|
|
973
963
|
*/
|
|
974
|
-
async selectFirstAsync(
|
|
975
|
-
opts: {
|
|
976
|
-
/**
|
|
977
|
-
* True (default) to expand nodes as needed to allow selection when the first selectable
|
|
978
|
-
* node is in a collapsed group.
|
|
979
|
-
*/
|
|
980
|
-
expandParentGroups?: boolean;
|
|
981
|
-
/**
|
|
982
|
-
* True (default) to scroll the grid or expand nodes as needed to make selection
|
|
983
|
-
* visible if it is outside of the visible scroll window.
|
|
984
|
-
*/
|
|
985
|
-
ensureVisible?: boolean;
|
|
986
|
-
} = {}
|
|
987
|
-
) {
|
|
964
|
+
async selectFirstAsync(opts: GridSelectFirstOptions = {}) {
|
|
988
965
|
const {expandParentGroups = true, ensureVisible = true} = opts;
|
|
989
966
|
await this.whenReadyAsync();
|
|
990
967
|
if (!this.isReady) return;
|
|
@@ -1028,12 +1005,7 @@ export class GridModel extends HoistModel {
|
|
|
1028
1005
|
*
|
|
1029
1006
|
* @param opts - additional scrolling options
|
|
1030
1007
|
*/
|
|
1031
|
-
async ensureSelectionVisibleAsync(
|
|
1032
|
-
opts: {
|
|
1033
|
-
/** Position of the selection in the viewport - default null scrolls minimally. */
|
|
1034
|
-
position?: GridScrollPosition;
|
|
1035
|
-
} = {}
|
|
1036
|
-
) {
|
|
1008
|
+
async ensureSelectionVisibleAsync(opts: GridEnsureVisibleOptions = {}) {
|
|
1037
1009
|
await this.whenReadyAsync();
|
|
1038
1010
|
if (!this.isReady) return;
|
|
1039
1011
|
|
|
@@ -1055,10 +1027,7 @@ export class GridModel extends HoistModel {
|
|
|
1055
1027
|
*/
|
|
1056
1028
|
async ensureRecordsVisibleAsync(
|
|
1057
1029
|
records: Some<StoreRecord>,
|
|
1058
|
-
opts: {
|
|
1059
|
-
/** Position of the record in the viewport - default null scrolls minimally. */
|
|
1060
|
-
position?: GridScrollPosition;
|
|
1061
|
-
} = {}
|
|
1030
|
+
opts: GridEnsureVisibleOptions = {}
|
|
1062
1031
|
) {
|
|
1063
1032
|
const {position = null} = opts;
|
|
1064
1033
|
|
|
@@ -1149,6 +1118,10 @@ export class GridModel extends HoistModel {
|
|
|
1149
1118
|
return this.store.empty;
|
|
1150
1119
|
}
|
|
1151
1120
|
|
|
1121
|
+
get innerGridModel(): GridModel {
|
|
1122
|
+
return this;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1152
1125
|
/**
|
|
1153
1126
|
* Records in the order this grid renders them - sorted by {@link groupBy} and {@link sortBy},
|
|
1154
1127
|
* and flattened depth-first for tree grids. Leaf records only - group rows have no StoreRecord.
|
|
@@ -2118,18 +2091,27 @@ export class GridModel extends HoistModel {
|
|
|
2118
2091
|
storeOrConfig?: Store | StoreConfig
|
|
2119
2092
|
): ColumnOrGroupSpec[] {
|
|
2120
2093
|
const store = storeOrConfig || this.store,
|
|
2121
|
-
|
|
2122
|
-
fieldsByName: Record<string, Field | FieldSpec> = {};
|
|
2094
|
+
storeFieldsByName: Record<string, Field | FieldSpec> = {};
|
|
2123
2095
|
|
|
2124
2096
|
// Extract field definitions in all supported forms: pull Field instances/configs from
|
|
2125
2097
|
// storeFields first...
|
|
2126
|
-
|
|
2098
|
+
store?.fields?.forEach(sf => {
|
|
2127
2099
|
if (sf && !isString(sf)) {
|
|
2128
|
-
|
|
2100
|
+
storeFieldsByName[sf.name] = sf;
|
|
2129
2101
|
}
|
|
2130
2102
|
});
|
|
2131
2103
|
|
|
2132
|
-
|
|
2104
|
+
return this.enhanceColConfigs(colConfigs, storeFieldsByName);
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
// Store fields are resolved once and shared across the recursion.
|
|
2108
|
+
private enhanceColConfigs(
|
|
2109
|
+
colConfigs: ColumnOrGroupSpec[],
|
|
2110
|
+
storeFieldsByName: Record<string, Field | FieldSpec>
|
|
2111
|
+
): ColumnOrGroupSpec[] {
|
|
2112
|
+
// Col-level `field` configs stay scoped to their own level; copy-on-write so the common
|
|
2113
|
+
// case shares the store's map.
|
|
2114
|
+
let fieldsByName = storeFieldsByName;
|
|
2133
2115
|
colConfigs.forEach(cc => {
|
|
2134
2116
|
if (
|
|
2135
2117
|
isColumnSpec(cc) &&
|
|
@@ -2137,6 +2119,7 @@ export class GridModel extends HoistModel {
|
|
|
2137
2119
|
!isString(cc.field) &&
|
|
2138
2120
|
!fieldsByName[cc.field.name]
|
|
2139
2121
|
) {
|
|
2122
|
+
if (fieldsByName === storeFieldsByName) fieldsByName = {...storeFieldsByName};
|
|
2140
2123
|
fieldsByName[cc.field.name] = cc.field;
|
|
2141
2124
|
}
|
|
2142
2125
|
});
|
|
@@ -2151,7 +2134,7 @@ export class GridModel extends HoistModel {
|
|
|
2151
2134
|
if (!isColumnSpec(col)) {
|
|
2152
2135
|
return {
|
|
2153
2136
|
...col,
|
|
2154
|
-
children: this.
|
|
2137
|
+
children: this.enhanceColConfigs(col.children, storeFieldsByName)
|
|
2155
2138
|
};
|
|
2156
2139
|
}
|
|
2157
2140
|
|
|
@@ -2160,7 +2143,7 @@ export class GridModel extends HoistModel {
|
|
|
2160
2143
|
|
|
2161
2144
|
if (!field) return col;
|
|
2162
2145
|
|
|
2163
|
-
const {displayName, description, type} = field,
|
|
2146
|
+
const {displayName, shortDisplayName, description, type} = field,
|
|
2164
2147
|
isNum = numTypes.includes(type),
|
|
2165
2148
|
isDate = dateTypes.includes(type),
|
|
2166
2149
|
align = isNum ? 'right' : undefined,
|
|
@@ -2170,12 +2153,23 @@ export class GridModel extends HoistModel {
|
|
|
2170
2153
|
? Column.DESC_FIRST
|
|
2171
2154
|
: Column.ASC_FIRST;
|
|
2172
2155
|
|
|
2156
|
+
// A column that names itself keeps that name. Otherwise its header takes the field's
|
|
2157
|
+
// short name, and its export the full one.
|
|
2158
|
+
const shortName =
|
|
2159
|
+
col.displayName == null &&
|
|
2160
|
+
col.headerName === undefined &&
|
|
2161
|
+
shortDisplayName != null &&
|
|
2162
|
+
shortDisplayName !== displayName
|
|
2163
|
+
? {headerName: shortDisplayName, exportName: displayName}
|
|
2164
|
+
: null;
|
|
2165
|
+
|
|
2173
2166
|
// TODO: Set the editor based on field type
|
|
2174
2167
|
return {
|
|
2175
2168
|
displayName,
|
|
2176
2169
|
description,
|
|
2177
2170
|
sortingOrder,
|
|
2178
2171
|
align,
|
|
2172
|
+
...shortName,
|
|
2179
2173
|
...col
|
|
2180
2174
|
};
|
|
2181
2175
|
});
|
package/cmp/grid/Types.ts
CHANGED
|
@@ -12,7 +12,10 @@ import type {
|
|
|
12
12
|
FilterMatchMode,
|
|
13
13
|
FilterValueSource,
|
|
14
14
|
Store,
|
|
15
|
-
StoreRecord
|
|
15
|
+
StoreRecord,
|
|
16
|
+
StoreRecordId,
|
|
17
|
+
StoreRecordOrId,
|
|
18
|
+
StoreSelectionModel
|
|
16
19
|
} from '@xh/hoist/data';
|
|
17
20
|
import type {
|
|
18
21
|
CellClassParams,
|
|
@@ -87,6 +90,60 @@ export type GridGroupSortFn = (
|
|
|
87
90
|
/** Position of a row in the viewport when scrolled into view - default null scrolls minimally. */
|
|
88
91
|
export type GridScrollPosition = 'top' | 'middle' | 'bottom';
|
|
89
92
|
|
|
93
|
+
/** Options for {@link GridModel.selectAsync}. */
|
|
94
|
+
export interface GridSelectOptions {
|
|
95
|
+
/**
|
|
96
|
+
* True (default) to scroll the grid or expand nodes as needed to make selection visible if it
|
|
97
|
+
* is within a collapsed node or outside of the visible scroll window.
|
|
98
|
+
*/
|
|
99
|
+
ensureVisible?: boolean;
|
|
100
|
+
/** Position of the selection in the viewport - default null scrolls minimally. */
|
|
101
|
+
ensureVisiblePosition?: GridScrollPosition;
|
|
102
|
+
/** True (default) to clear previous selection (rather than add to it). */
|
|
103
|
+
clearSelection?: boolean;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Options for {@link GridModel.selectFirstAsync}. */
|
|
107
|
+
export interface GridSelectFirstOptions {
|
|
108
|
+
/**
|
|
109
|
+
* True (default) to expand nodes as needed to allow selection when the first selectable node
|
|
110
|
+
* is in a collapsed group.
|
|
111
|
+
*/
|
|
112
|
+
expandParentGroups?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* True (default) to scroll the grid or expand nodes as needed to make selection visible if it
|
|
115
|
+
* is outside of the visible scroll window.
|
|
116
|
+
*/
|
|
117
|
+
ensureVisible?: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Options for {@link GridModel.ensureSelectionVisibleAsync} and `ensureRecordsVisibleAsync`. */
|
|
121
|
+
export interface GridEnsureVisibleOptions {
|
|
122
|
+
/** Position of the record(s) in the viewport - default null scrolls minimally. */
|
|
123
|
+
position?: GridScrollPosition;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* A GridModel, or a model wrapping one that exposes its store and selection - what grid-bound
|
|
128
|
+
* fields and buttons accept. Implemented by {@link GridModel}, `ZoneGridModel`, `DataViewModel`
|
|
129
|
+
* and `CubeGridModel`.
|
|
130
|
+
*/
|
|
131
|
+
export interface GridLikeModel extends HoistModel {
|
|
132
|
+
/** The GridModel behind this model - itself, for a GridModel. */
|
|
133
|
+
readonly innerGridModel: GridModel;
|
|
134
|
+
readonly store: Store;
|
|
135
|
+
readonly empty: boolean;
|
|
136
|
+
readonly selModel: StoreSelectionModel;
|
|
137
|
+
readonly hasSelection: boolean;
|
|
138
|
+
readonly selectedRecords: StoreRecord[];
|
|
139
|
+
readonly selectedRecord: StoreRecord;
|
|
140
|
+
readonly selectedId: StoreRecordId;
|
|
141
|
+
selectAsync(records: Some<StoreRecordOrId>, opts?: GridSelectOptions): Promise<void>;
|
|
142
|
+
preSelectFirstAsync(): Promise<void>;
|
|
143
|
+
selectFirstAsync(opts?: GridSelectFirstOptions): Promise<void>;
|
|
144
|
+
ensureSelectionVisibleAsync(opts?: GridEnsureVisibleOptions): Promise<void>;
|
|
145
|
+
}
|
|
146
|
+
|
|
90
147
|
/**
|
|
91
148
|
* Closure to generate CSS class names for a row.
|
|
92
149
|
* @param record - the StoreRecord associated with the rendered row.
|
|
@@ -123,7 +123,8 @@ export interface ColumnSpec {
|
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* User-facing text/element displayed in the Column header, or a function to produce the same.
|
|
126
|
-
* Defaulted from `displayName
|
|
126
|
+
* Defaulted from the field's `shortDisplayName` unless this Column sets its own `displayName`,
|
|
127
|
+
* then from `displayName`.
|
|
127
128
|
*/
|
|
128
129
|
headerName?: ColumnHeaderNameFn | ReactNode;
|
|
129
130
|
|
|
@@ -676,6 +677,7 @@ export class Column {
|
|
|
676
677
|
this.description = description ?? this.fieldSpec?.description;
|
|
677
678
|
|
|
678
679
|
// In contrast, headerName supports a null or '' value when no header label is desired.
|
|
680
|
+
// GridModel may have defaulted it from the field's `shortDisplayName` already.
|
|
679
681
|
this.headerName = withDefault(headerName, this.displayName);
|
|
680
682
|
|
|
681
683
|
this.headerTooltip = withDefault(headerTooltip, this.description);
|
|
@@ -47,6 +47,11 @@ export interface ColumnGroupSpec {
|
|
|
47
47
|
headerAlign?: HAlign;
|
|
48
48
|
/** Tooltip text for grid header. */
|
|
49
49
|
headerTooltip?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Name to display within the column chooser. Defaults to `headerName` when that is a string,
|
|
52
|
+
* otherwise derived from `groupId`. Specify when `headerName` is a function or element.
|
|
53
|
+
*/
|
|
54
|
+
chooserName?: string;
|
|
50
55
|
/** True to render borders on column group edges. */
|
|
51
56
|
borders?: boolean;
|
|
52
57
|
|
|
@@ -92,6 +97,7 @@ export class ColumnGroup {
|
|
|
92
97
|
readonly headerClass: Some<string> | ColumnHeaderClassFn;
|
|
93
98
|
readonly headerAlign: HAlign;
|
|
94
99
|
readonly headerTooltip: string;
|
|
100
|
+
readonly chooserName: string;
|
|
95
101
|
readonly borders: boolean;
|
|
96
102
|
readonly groupShowMode: ColumnGroupShowMode;
|
|
97
103
|
readonly collapsed: boolean;
|
|
@@ -123,6 +129,7 @@ export class ColumnGroup {
|
|
|
123
129
|
headerClass,
|
|
124
130
|
headerAlign,
|
|
125
131
|
headerTooltip,
|
|
132
|
+
chooserName,
|
|
126
133
|
agOptions,
|
|
127
134
|
borders,
|
|
128
135
|
groupShowMode,
|
|
@@ -143,6 +150,9 @@ export class ColumnGroup {
|
|
|
143
150
|
this.headerClass = headerClass;
|
|
144
151
|
this.headerAlign = headerAlign;
|
|
145
152
|
this.headerTooltip = headerTooltip;
|
|
153
|
+
this.chooserName =
|
|
154
|
+
chooserName ??
|
|
155
|
+
(isString(this.headerName) ? this.headerName : genDisplayName(this.groupId));
|
|
146
156
|
this.borders = withDefault(borders, true);
|
|
147
157
|
this.groupShowMode = groupShowMode;
|
|
148
158
|
this.collapsed = withDefault(collapsed, false);
|
|
@@ -9,11 +9,15 @@ import type {BoxProps, HoistProps} from '@xh/hoist/core';
|
|
|
9
9
|
import {hoistCmp, useContextModel} from '@xh/hoist/core';
|
|
10
10
|
import {fmtNumber} from '@xh/hoist/format';
|
|
11
11
|
import {logError, pluralize, singularize, withDefault} from '@xh/hoist/utils/js';
|
|
12
|
-
import {
|
|
12
|
+
import {isGridLikeModel} from '../impl/GridLikeModel';
|
|
13
|
+
import type {GridLikeModel} from '../Types';
|
|
13
14
|
|
|
14
15
|
export interface GridCountLabelProps extends HoistProps, BoxProps {
|
|
15
|
-
/**
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* GridModel, or a model wrapping one, to which this component should bind. Will find the
|
|
18
|
+
* nearest in context if not provided.
|
|
19
|
+
*/
|
|
20
|
+
gridModel?: GridLikeModel;
|
|
17
21
|
|
|
18
22
|
/**
|
|
19
23
|
* True to count nested child records.
|
|
@@ -41,13 +45,16 @@ export const [GridCountLabel, gridCountLabel] = hoistCmp.withFactory<GridCountLa
|
|
|
41
45
|
className: 'xh-grid-count-label',
|
|
42
46
|
|
|
43
47
|
render({
|
|
44
|
-
gridModel,
|
|
48
|
+
gridModel: boundModel,
|
|
45
49
|
includeChildren = false,
|
|
46
50
|
showSelectionCount = 'auto',
|
|
47
51
|
unit = 'record',
|
|
48
52
|
...props
|
|
49
53
|
}) {
|
|
50
|
-
gridModel = withDefault(
|
|
54
|
+
const gridModel = withDefault(
|
|
55
|
+
boundModel,
|
|
56
|
+
useContextModel<GridLikeModel>(isGridLikeModel)
|
|
57
|
+
)?.innerGridModel;
|
|
51
58
|
|
|
52
59
|
if (!gridModel) {
|
|
53
60
|
logError(
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
import type {ColumnGroup, GridModel} from '@xh/hoist/cmp/grid';
|
|
8
8
|
import {div, span} from '@xh/hoist/cmp/layout';
|
|
9
9
|
import type {HoistProps} from '@xh/hoist/core';
|
|
10
|
-
import {hoistCmp, HoistModel, creates} from '@xh/hoist/core';
|
|
10
|
+
import {XH, hoistCmp, HoistModel, creates} from '@xh/hoist/core';
|
|
11
11
|
import {Icon} from '@xh/hoist/icon';
|
|
12
12
|
import {bindable} from '@xh/hoist/mobx';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import {isFunction} from 'lodash';
|
|
14
|
+
import {isFunction, isString, isUndefined} from 'lodash';
|
|
15
15
|
import type {ReactNode} from 'react';
|
|
16
16
|
|
|
17
17
|
import type {AgProvidedColumnGroup, IHeaderGroupParams} from '@xh/hoist/kit/ag-grid';
|
|
@@ -37,8 +37,9 @@ export const columnGroupHeader = hoistCmp.factory<ColumnGroupHeaderProps>({
|
|
|
37
37
|
const expandIcon = () => {
|
|
38
38
|
if (!isExpandable) return null;
|
|
39
39
|
|
|
40
|
+
// Shows open or closed state, as tree rows do.
|
|
40
41
|
const icon = isExpanded
|
|
41
|
-
? Icon.
|
|
42
|
+
? Icon.chevronDown({size: 'sm'})
|
|
42
43
|
: Icon.chevronRight({size: 'sm'});
|
|
43
44
|
return div(icon);
|
|
44
45
|
};
|
|
@@ -55,12 +56,25 @@ export const columnGroupHeader = hoistCmp.factory<ColumnGroupHeaderProps>({
|
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
// If no app tooltip dynamically toggle a tooltip to display elided header
|
|
60
|
+
let onMouseEnter = null;
|
|
61
|
+
if (XH.isDesktop && isUndefined(xhColumnGroup?.headerTooltip)) {
|
|
62
|
+
onMouseEnter = ({target: el}) => {
|
|
63
|
+
if (el.offsetWidth < el.scrollWidth) {
|
|
64
|
+
const title = isString(headerName) ? headerName : displayName;
|
|
65
|
+
el.setAttribute('title', title);
|
|
66
|
+
} else {
|
|
67
|
+
el.removeAttribute('title');
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
58
72
|
return div({
|
|
59
73
|
className: classNames(
|
|
60
74
|
className,
|
|
61
75
|
isExpandable ? 'xh-grid-group-header--expandable' : null
|
|
62
76
|
),
|
|
63
|
-
items: [span(headerName), expandIcon()],
|
|
77
|
+
items: [span({onMouseEnter, item: headerName}), expandIcon()],
|
|
64
78
|
onClick: e => {
|
|
65
79
|
if (!isExpandable) return;
|
|
66
80
|
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type {GridAutosizeOptions} from '@xh/hoist/cmp/grid/GridAutosizeOptions';
|
|
9
|
+
import type {SizingMode} from '@xh/hoist/core';
|
|
9
10
|
import {XH} from '@xh/hoist/core';
|
|
11
|
+
import {Icon} from '@xh/hoist/icon';
|
|
10
12
|
import type {CellClassParams} from '@xh/hoist/kit/ag-grid';
|
|
11
13
|
import type {Filter, StoreRecord} from '@xh/hoist/data';
|
|
12
14
|
import {CompoundFilter, FieldFilter} from '@xh/hoist/data';
|
|
@@ -243,6 +245,22 @@ export class ColumnWidthCalculator {
|
|
|
243
245
|
return Math.ceil(headerEl.clientWidth) + bufferPx;
|
|
244
246
|
}
|
|
245
247
|
|
|
248
|
+
/**
|
|
249
|
+
* Width of a plain-text header label, with the header font and padding of a sizing mode, and
|
|
250
|
+
* optionally the expand icon of a collapsible column group.
|
|
251
|
+
*/
|
|
252
|
+
calcHeaderTextWidth(sizingMode: SizingMode, text: string, withExpandIcon = false): number {
|
|
253
|
+
try {
|
|
254
|
+
const headerEl = this.getHeaderEl();
|
|
255
|
+
this.setHeaderClassNames(sizingMode, false, false, '');
|
|
256
|
+
if (withExpandIcon) headerEl.classList.add('xh-grid-autosize-header--expand');
|
|
257
|
+
headerEl.firstChild.textContent = text;
|
|
258
|
+
return Math.ceil(headerEl.clientWidth);
|
|
259
|
+
} finally {
|
|
260
|
+
this.resetHeaderClassNames();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
246
264
|
isColumnFiltered(filter: Filter, column: Column): boolean {
|
|
247
265
|
if (filter instanceof FieldFilter) {
|
|
248
266
|
return filter.field === column.field;
|
|
@@ -299,6 +317,12 @@ export class ColumnWidthCalculator {
|
|
|
299
317
|
menuIcon.classList.add('xh-grid-header-menu-icon');
|
|
300
318
|
headerEl.appendChild(menuIcon);
|
|
301
319
|
|
|
320
|
+
// As ColumnGroupHeader renders it.
|
|
321
|
+
const expandIcon = document.createElement('div');
|
|
322
|
+
expandIcon.classList.add('xh-grid-header-expand-icon');
|
|
323
|
+
expandIcon.innerHTML = Icon.chevronRight({size: 'sm', asHtml: true});
|
|
324
|
+
headerEl.appendChild(expandIcon);
|
|
325
|
+
|
|
302
326
|
document.body.appendChild(headerEl);
|
|
303
327
|
this._headerEl = headerEl;
|
|
304
328
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file belongs to Hoist, an application development toolkit
|
|
3
|
+
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
+
*
|
|
5
|
+
* Copyright © 2026 Extremely Heavy Industries Inc.
|
|
6
|
+
*/
|
|
7
|
+
import type {GridLikeModel} from '@xh/hoist/cmp/grid';
|
|
8
|
+
import {GridModel} from '@xh/hoist/cmp/grid';
|
|
9
|
+
import type {HoistModel} from '@xh/hoist/core';
|
|
10
|
+
|
|
11
|
+
/** True for a GridModel, or any model exposing one as `innerGridModel`. */
|
|
12
|
+
export function isGridLikeModel(it: unknown): it is GridLikeModel {
|
|
13
|
+
return (
|
|
14
|
+
!!(it as HoistModel)?.isHoistModel &&
|
|
15
|
+
(it as GridLikeModel).innerGridModel instanceof GridModel
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Copyright © 2026 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
|
-
import {isEmpty, isFunction, isNil, isString, sortBy, uniq} from 'lodash';
|
|
7
|
+
import {compact, isEmpty, isFunction, isNil, isString, sortBy, uniq} from 'lodash';
|
|
8
8
|
import {copyToClipboard, TEST_ID} from '@xh/hoist/utils/js';
|
|
9
9
|
import {hoistCmp, type HoistProps, type HSide, isMenuHeading, type Some, XH} from '@xh/hoist/core';
|
|
10
10
|
import type {Column, GridModel} from '@xh/hoist/cmp/grid';
|
|
@@ -345,7 +345,8 @@ function createPinColumnItem(gridModel: GridModel): RecordAction {
|
|
|
345
345
|
return new RecordAction({
|
|
346
346
|
text: 'Pin Column',
|
|
347
347
|
icon: Icon.pin(),
|
|
348
|
-
|
|
348
|
+
// Pinning relocates the column, so a column that cannot move cannot pin either.
|
|
349
|
+
displayFn: ({column}) => ({hidden: !column?.movable || !gridModel.enableColumnPinning}),
|
|
349
350
|
items: [pinItem('Left', 'left'), pinItem('Right', 'right'), pinItem('Unpin', null)]
|
|
350
351
|
});
|
|
351
352
|
}
|
|
@@ -371,43 +372,58 @@ function createSortItems(gridModel: GridModel, column: Column): RecordAction[] {
|
|
|
371
372
|
});
|
|
372
373
|
}
|
|
373
374
|
|
|
374
|
-
|
|
375
|
-
|
|
375
|
+
/** Levels that expand and collapse together - the rows of a GridModel, or a pivot's columns. */
|
|
376
|
+
export interface ExpandLevelTarget {
|
|
377
|
+
maxDepth: number;
|
|
378
|
+
/** Label per level, by index. A null label leaves its level out of "Expand to...". */
|
|
379
|
+
resolvedLevelLabels: string[];
|
|
380
|
+
isCurrentExpandLevel(idx: number): boolean;
|
|
381
|
+
expandToLevel(level: number): void;
|
|
382
|
+
expandAll(): void;
|
|
383
|
+
collapseAll(): void;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/** @internal - Expand All, Collapse All and Expand to... items for the target's levels. */
|
|
387
|
+
export function createExpandCollapseItem(target: ExpandLevelTarget): RecordAction[] {
|
|
388
|
+
if (!target || target.maxDepth === 0) return null;
|
|
376
389
|
|
|
377
390
|
return [
|
|
378
391
|
new RecordAction({
|
|
379
392
|
text: 'Expand All',
|
|
380
393
|
icon: Icon.groupRowExpanded(),
|
|
381
|
-
actionFn: () =>
|
|
394
|
+
actionFn: () => target.expandAll()
|
|
382
395
|
}),
|
|
383
396
|
new RecordAction({
|
|
384
397
|
text: 'Collapse All',
|
|
385
398
|
icon: Icon.groupRowCollapsed(),
|
|
386
|
-
actionFn: () =>
|
|
399
|
+
actionFn: () => target.collapseAll()
|
|
387
400
|
}),
|
|
388
|
-
levelExpandAction(
|
|
401
|
+
levelExpandAction(target)
|
|
389
402
|
];
|
|
390
403
|
}
|
|
391
404
|
|
|
392
|
-
function levelExpandAction(
|
|
405
|
+
function levelExpandAction(target: ExpandLevelTarget): RecordAction {
|
|
393
406
|
return new RecordAction({
|
|
394
407
|
text: 'Expand to...',
|
|
395
408
|
displayFn: () => {
|
|
396
|
-
const {maxDepth, resolvedLevelLabels} =
|
|
397
|
-
|
|
398
|
-
// Don't show for flat grid models or if we don't have labels
|
|
409
|
+
const {maxDepth, resolvedLevelLabels} = target;
|
|
399
410
|
if (!maxDepth || !resolvedLevelLabels) return {hidden: true};
|
|
400
411
|
|
|
401
|
-
const items =
|
|
402
|
-
|
|
412
|
+
const items = compact(
|
|
413
|
+
resolvedLevelLabels.map((label, idx) => {
|
|
414
|
+
if (label == null) return null;
|
|
415
|
+
const isCurrLevel = target.isCurrentExpandLevel(idx);
|
|
403
416
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
417
|
+
return {
|
|
418
|
+
icon: isCurrLevel ? Icon.check() : null,
|
|
419
|
+
text: label,
|
|
420
|
+
actionFn: () => wait().then(() => target.expandToLevel(idx))
|
|
421
|
+
};
|
|
422
|
+
})
|
|
423
|
+
);
|
|
424
|
+
|
|
425
|
+
// A lone level adds nothing to Expand All.
|
|
426
|
+
return items.length < 2 ? {hidden: true} : {items};
|
|
411
427
|
}
|
|
412
428
|
});
|
|
413
429
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file belongs to Hoist, an application development toolkit
|
|
3
|
+
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
+
*
|
|
5
|
+
* Copyright © 2026 Extremely Heavy Industries Inc.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.xh-pdf-viewer {
|
|
9
|
+
background-color: var(--xh-pdf-viewer-bg);
|
|
10
|
+
|
|
11
|
+
&__body {
|
|
12
|
+
position: relative;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__container {
|
|
17
|
+
position: absolute;
|
|
18
|
+
inset: 0;
|
|
19
|
+
overflow: auto;
|
|
20
|
+
|
|
21
|
+
&:focus-visible {
|
|
22
|
+
outline: var(--xh-focus-outline);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&__placeholder,
|
|
27
|
+
&__error {
|
|
28
|
+
position: absolute;
|
|
29
|
+
inset: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__placeholder {
|
|
33
|
+
gap: var(--xh-pad-half-px);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//------------------------
|
|
38
|
+
// Toolbar
|
|
39
|
+
//------------------------
|
|
40
|
+
.xh-pdf-viewer__toolbar {
|
|
41
|
+
.xh-pdf-viewer__page-input {
|
|
42
|
+
text-align: center;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.xh-pdf-viewer__find-count {
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
}
|
|
48
|
+
}
|