@xh/hoist 75.0.0-SNAPSHOT.1753280710081 → 75.0.0-SNAPSHOT.1753369138152

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.
@@ -1,15 +1,14 @@
1
- import { FilterLike } from './Types';
2
- import { Filter } from './Filter';
3
1
  import { Some } from '@xh/hoist/core';
2
+ import { Filter } from './Filter';
3
+ import { FilterLike } from './Types';
4
4
  /**
5
5
  * Parse a filter from an object or array representation.
6
6
  *
7
7
  * @param spec - one or more filters or specs to create one.
8
8
  * * An existing Filter instance will be returned directly as-is.
9
- * * A null value will also be returned as-is. A null filter represents no filter at all,
10
- * or the equivalent of a filter that always passes every record.
9
+ * * Null/undefined or empty array will return `null`, representing no filter.
11
10
  * * A raw Function will be converted to a `FunctionFilter` with key 'default'.
12
- * * Arrays will be converted to a `CompoundFilter` with a default 'AND' operator.
11
+ * * Non-empty arrays will return a `CompoundFilter` with a default 'AND' operator.
13
12
  * * Config objects will be returned as an appropriate concrete `Filter` subclass based on
14
13
  * their properties.
15
14
  *
@@ -9,7 +9,7 @@ export interface ExpandToLevelButtonProps extends Omit<ButtonProps, 'title'> {
9
9
  /** Position for menu, as per Blueprint docs. */
10
10
  popoverPosition?: Position;
11
11
  /** Title for the menu popover - defaults to "Expand To Level". */
12
- title: ReactNode;
12
+ title?: ReactNode;
13
13
  }
14
14
  /**
15
15
  * A menu button to expand a multi-level grouped or tree grid out to a desired level.
@@ -5,24 +5,21 @@
5
5
  * Copyright © 2025 Extremely Heavy Industries Inc.
6
6
  */
7
7
 
8
+ import {Some} from '@xh/hoist/core';
9
+ import {CompoundFilter, FunctionFilter} from '@xh/hoist/data';
8
10
  import {castArray, flatMap, groupBy, isArray, isFunction} from 'lodash';
9
-
10
- import {FieldFilterSpec, FilterLike} from './Types';
11
- import {Filter} from './Filter';
12
11
  import {FieldFilter} from './FieldFilter';
13
- import {FunctionFilter} from './FunctionFilter';
14
- import {CompoundFilter} from './CompoundFilter';
15
- import {Some} from '@xh/hoist/core';
12
+ import {Filter} from './Filter';
13
+ import {FieldFilterSpec, FilterLike} from './Types';
16
14
 
17
15
  /**
18
16
  * Parse a filter from an object or array representation.
19
17
  *
20
18
  * @param spec - one or more filters or specs to create one.
21
19
  * * An existing Filter instance will be returned directly as-is.
22
- * * A null value will also be returned as-is. A null filter represents no filter at all,
23
- * or the equivalent of a filter that always passes every record.
20
+ * * Null/undefined or empty array will return `null`, representing no filter.
24
21
  * * A raw Function will be converted to a `FunctionFilter` with key 'default'.
25
- * * Arrays will be converted to a `CompoundFilter` with a default 'AND' operator.
22
+ * * Non-empty arrays will return a `CompoundFilter` with a default 'AND' operator.
26
23
  * * Config objects will be returned as an appropriate concrete `Filter` subclass based on
27
24
  * their properties.
28
25
  *
@@ -32,7 +29,8 @@ export function parseFilter(spec: FilterLike): Filter {
32
29
  let s = spec as any;
33
30
 
34
31
  // Degenerate cases
35
- if (!s || s instanceof Filter) return s as Filter;
32
+ if (s instanceof Filter) return s as Filter;
33
+ if (!s || (isArray(s) && s.length === 0)) return null;
36
34
 
37
35
  // Normalize special forms
38
36
  if (isFunction(s)) s = {key: 'default', testFn: s};
@@ -23,7 +23,7 @@ export interface ExpandToLevelButtonProps extends Omit<ButtonProps, 'title'> {
23
23
  popoverPosition?: Position;
24
24
 
25
25
  /** Title for the menu popover - defaults to "Expand To Level". */
26
- title: ReactNode;
26
+ title?: ReactNode;
27
27
  }
28
28
 
29
29
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "75.0.0-SNAPSHOT.1753280710081",
3
+ "version": "75.0.0-SNAPSHOT.1753369138152",
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",