@xh/hoist 73.0.0-SNAPSHOT.1745417754393 → 73.0.0-SNAPSHOT.1745445775316

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 CHANGED
@@ -2,9 +2,13 @@
2
2
 
3
3
  ## v73.0.0-SNAPSHOT - unreleased
4
4
 
5
+ ### 🐞 Bug Fixes
6
+ * Made `GridModel.defaultGroupSortFn` null-safe and improved type signature.
7
+
5
8
  ### ⚙️ Typescript API Adjustments
6
9
 
7
10
  * Corrected `StoreCountLabelProps` interface.
11
+ * Corrected `GridGroupSortFn` param types.
8
12
 
9
13
  ## v72.5.1 - 2025-04-15
10
14
 
@@ -534,6 +534,10 @@ export declare class GridModel extends HoistModel {
534
534
  * @param timeout - timeout in ms
535
535
  */
536
536
  whenReadyAsync(timeout?: number): Promise<boolean>;
537
+ /**
538
+ * Sorts ungrouped items to the bottom.
539
+ */
540
+ defaultGroupSortFn: (a: string, b: string) => number;
537
541
  private buildColumn;
538
542
  private autosizeColsInternalAsync;
539
543
  private gatherLeaves;
@@ -553,7 +557,6 @@ export declare class GridModel extends HoistModel {
553
557
  private parseExperimental;
554
558
  private parseChooserModel;
555
559
  private isGroupSpec;
556
- defaultGroupSortFn: (a: any, b: any) => any;
557
560
  private readonly LEFT_BORDER_CLASS;
558
561
  private readonly RIGHT_BORDER_CLASS;
559
562
  private enhanceConfigWithGroupBorders;
@@ -25,7 +25,7 @@ export interface ColumnState {
25
25
  * @returns 0 if group values are equal, a negative number if `a` sorts first,
26
26
  * and a positive number if `b` sorts first.
27
27
  */
28
- export type GridGroupSortFn = (groupAVal: any, groupBVal: any, groupField: string, metadata: {
28
+ export type GridGroupSortFn = (groupAVal: string, groupBVal: string, groupField: string, metadata: {
29
29
  gridModel: GridModel;
30
30
  nodeA: IRowNode;
31
31
  nodeB: IRowNode;
@@ -1432,6 +1432,18 @@ export class GridModel extends HoistModel {
1432
1432
  return this.isReady;
1433
1433
  }
1434
1434
 
1435
+ /**
1436
+ * Sorts ungrouped items to the bottom.
1437
+ */
1438
+ defaultGroupSortFn = (a: string, b: string): number => {
1439
+ a = a ?? '';
1440
+ b = b ?? '';
1441
+ if (a === b) return 0;
1442
+ if (a === '') return 1;
1443
+ if (b === '') return -1;
1444
+ return a.localeCompare(b);
1445
+ };
1446
+
1435
1447
  //-----------------------
1436
1448
  // Implementation
1437
1449
  //-----------------------
@@ -1775,14 +1787,6 @@ export class GridModel extends HoistModel {
1775
1787
  return 'children' in col;
1776
1788
  }
1777
1789
 
1778
- defaultGroupSortFn = (a, b) => {
1779
- // Place ungrouped items at bottom.
1780
- if (a === b) return 0;
1781
- if (a === '') return 1;
1782
- if (b === '') return -1;
1783
- return a.localeCompare(b);
1784
- };
1785
-
1786
1790
  private readonly LEFT_BORDER_CLASS = 'xh-cell--group-border-left';
1787
1791
  private readonly RIGHT_BORDER_CLASS = 'xh-cell--group-border-right';
1788
1792
 
package/cmp/grid/Types.ts CHANGED
@@ -46,8 +46,8 @@ export interface ColumnState {
46
46
  * and a positive number if `b` sorts first.
47
47
  */
48
48
  export type GridGroupSortFn = (
49
- groupAVal: any,
50
- groupBVal: any,
49
+ groupAVal: string,
50
+ groupBVal: string,
51
51
  groupField: string,
52
52
  metadata: {
53
53
  gridModel: GridModel;
@@ -264,9 +264,9 @@ export class InstancesModel extends HoistModel {
264
264
  showGroupRowCounts: false,
265
265
  groupRowRenderer: ({value, node}) => propsGridGroupRenderer({value, node, model: this}),
266
266
  groupSortFn: (a, b) => {
267
- a = a === 'Watchlist' ? 0 : 1;
268
- b = b === 'Watchlist' ? 0 : 1;
269
- return a - b;
267
+ const sortValA = a === 'Watchlist' ? 0 : 1,
268
+ sortValB = b === 'Watchlist' ? 0 : 1;
269
+ return sortValA - sortValB;
270
270
  },
271
271
  store: {
272
272
  fields: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "73.0.0-SNAPSHOT.1745417754393",
3
+ "version": "73.0.0-SNAPSHOT.1745445775316",
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",