@xh/hoist 71.0.0-SNAPSHOT.1735061320692 → 71.0.0-SNAPSHOT.1735062266455
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.
|
@@ -36,6 +36,11 @@ export interface QueryConfig {
|
|
|
36
36
|
includeRoot?: boolean;
|
|
37
37
|
/** True to include leaf nodes in return.*/
|
|
38
38
|
includeLeaves?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* True (default) to recursively omit single-child parents in the hierarchy.
|
|
41
|
+
* Apps can implement further omit logic using `omitFn`.
|
|
42
|
+
*/
|
|
43
|
+
omitRedundantNodes?: boolean;
|
|
39
44
|
/**
|
|
40
45
|
* Optional function to be called for each aggregate node to determine if it should be "locked",
|
|
41
46
|
* preventing drill-down into its children. Defaults to Cube.lockFn.
|
|
@@ -60,12 +65,13 @@ export declare class Query {
|
|
|
60
65
|
readonly filter: Filter;
|
|
61
66
|
readonly includeRoot: boolean;
|
|
62
67
|
readonly includeLeaves: boolean;
|
|
68
|
+
readonly omitRedundantNodes: boolean;
|
|
63
69
|
readonly cube: Cube;
|
|
64
70
|
readonly lockFn: LockFn;
|
|
65
71
|
readonly bucketSpecFn: BucketSpecFn;
|
|
66
72
|
readonly omitFn: OmitFn;
|
|
67
73
|
private readonly _testFn;
|
|
68
|
-
constructor({ cube, fields, dimensions, filter, includeRoot, includeLeaves, lockFn, bucketSpecFn, omitFn }: QueryConfig);
|
|
74
|
+
constructor({ cube, fields, dimensions, filter, includeRoot, includeLeaves, omitRedundantNodes, lockFn, bucketSpecFn, omitFn }: QueryConfig);
|
|
69
75
|
clone(overrides: Partial<QueryConfig>): Query;
|
|
70
76
|
test(record: StoreRecord): boolean;
|
|
71
77
|
/**
|
package/data/cube/Query.ts
CHANGED
|
@@ -52,6 +52,12 @@ export interface QueryConfig {
|
|
|
52
52
|
/** True to include leaf nodes in return.*/
|
|
53
53
|
includeLeaves?: boolean;
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* True (default) to recursively omit single-child parents in the hierarchy.
|
|
57
|
+
* Apps can implement further omit logic using `omitFn`.
|
|
58
|
+
*/
|
|
59
|
+
omitRedundantNodes?: boolean;
|
|
60
|
+
|
|
55
61
|
/**
|
|
56
62
|
* Optional function to be called for each aggregate node to determine if it should be "locked",
|
|
57
63
|
* preventing drill-down into its children. Defaults to Cube.lockFn.
|
|
@@ -79,6 +85,7 @@ export class Query {
|
|
|
79
85
|
readonly filter: Filter;
|
|
80
86
|
readonly includeRoot: boolean;
|
|
81
87
|
readonly includeLeaves: boolean;
|
|
88
|
+
readonly omitRedundantNodes: boolean;
|
|
82
89
|
readonly cube: Cube;
|
|
83
90
|
readonly lockFn: LockFn;
|
|
84
91
|
readonly bucketSpecFn: BucketSpecFn;
|
|
@@ -93,6 +100,7 @@ export class Query {
|
|
|
93
100
|
filter = null,
|
|
94
101
|
includeRoot = false,
|
|
95
102
|
includeLeaves = false,
|
|
103
|
+
omitRedundantNodes = true,
|
|
96
104
|
lockFn = cube.lockFn,
|
|
97
105
|
bucketSpecFn = cube.bucketSpecFn,
|
|
98
106
|
omitFn = cube.omitFn
|
|
@@ -102,6 +110,7 @@ export class Query {
|
|
|
102
110
|
this.dimensions = this.parseDimensions(dimensions);
|
|
103
111
|
this.includeRoot = includeRoot;
|
|
104
112
|
this.includeLeaves = includeLeaves;
|
|
113
|
+
this.omitRedundantNodes = omitRedundantNodes;
|
|
105
114
|
this.filter = parseFilter(filter);
|
|
106
115
|
this.lockFn = lockFn;
|
|
107
116
|
this.bucketSpecFn = bucketSpecFn;
|
|
@@ -117,6 +126,7 @@ export class Query {
|
|
|
117
126
|
filter: this.filter,
|
|
118
127
|
includeRoot: this.includeRoot,
|
|
119
128
|
includeLeaves: this.includeLeaves,
|
|
129
|
+
omitRedundantNodes: this.omitRedundantNodes,
|
|
120
130
|
lockFn: this.lockFn,
|
|
121
131
|
bucketSpecFn: this.bucketSpecFn,
|
|
122
132
|
omitFn: this.omitFn,
|
|
@@ -153,6 +163,7 @@ export class Query {
|
|
|
153
163
|
this.cube === other.cube &&
|
|
154
164
|
this.includeRoot === other.includeRoot &&
|
|
155
165
|
this.includeLeaves === other.includeLeaves &&
|
|
166
|
+
this.omitRedundantNodes === other.omitRedundantNodes &&
|
|
156
167
|
this.bucketSpecFn == other.bucketSpecFn &&
|
|
157
168
|
this.omitFn == other.omitFn &&
|
|
158
169
|
this.lockFn == other.lockFn
|
package/data/cube/row/BaseRow.ts
CHANGED
|
@@ -65,12 +65,14 @@ export abstract class BaseRow {
|
|
|
65
65
|
|
|
66
66
|
// 3a) Before attaching examine that we don't have a chain of redundant nodes
|
|
67
67
|
// (not sure if loop needed -- are these redundant relations transitive?)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
if (view.query.omitRedundantNodes) {
|
|
69
|
+
while (dataChildren?.length === 1) {
|
|
70
|
+
const childRow = dataChildren[0]._meta;
|
|
71
|
+
if (this.isRedundantChild(this, childRow)) {
|
|
72
|
+
dataChildren = childRow.data.children;
|
|
73
|
+
} else {
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "71.0.0-SNAPSHOT.
|
|
3
|
+
"version": "71.0.0-SNAPSHOT.1735062266455",
|
|
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",
|