@xh/hoist 77.0.0-SNAPSHOT.1760194879110 → 77.0.0-SNAPSHOT.1760631134539

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.
@@ -73,7 +73,7 @@ export class ImpersonationBarModel extends HoistModel {
73
73
  try {
74
74
  await XH.identityService.impersonateAsync(pendingTarget);
75
75
  } catch (e) {
76
- this.pendingTarget = '';
76
+ this.pendingTarget = null;
77
77
  XH.handleException(e, {logOnServer: false}); // likely to be an unknown user
78
78
  }
79
79
  };
@@ -97,6 +97,7 @@ export declare class Query {
97
97
  readonly fields: CubeField[];
98
98
  readonly dimensions: CubeField[];
99
99
  readonly filter: Filter;
100
+ readonly hasFilter: boolean;
100
101
  readonly includeRoot: boolean;
101
102
  readonly includeLeaves: boolean;
102
103
  readonly provideLeaves: boolean;
@@ -127,6 +127,7 @@ export class Query {
127
127
  readonly fields: CubeField[];
128
128
  readonly dimensions: CubeField[];
129
129
  readonly filter: Filter;
130
+ readonly hasFilter: boolean;
130
131
  readonly includeRoot: boolean;
131
132
  readonly includeLeaves: boolean;
132
133
  readonly provideLeaves: boolean;
@@ -164,6 +165,7 @@ export class Query {
164
165
  this.omitFn = omitFn;
165
166
 
166
167
  this._testFn = this.filter?.getTestFn(this.cube.store) ?? null;
168
+ this.hasFilter = this._testFn != null;
167
169
  }
168
170
 
169
171
  clone(overrides: Partial<QueryConfig>) {
package/data/cube/View.ts CHANGED
@@ -309,12 +309,12 @@ export class View extends HoistBase {
309
309
  appliedDimensions: PlainObject,
310
310
  leafMap: Map<StoreRecordId, LeafRow>
311
311
  ): BaseRow[] {
312
- if (isEmpty(records)) return [];
312
+ if (!records?.length) return [];
313
313
 
314
314
  const rootId = parentId + Cube.RECORD_ID_DELIMITER;
315
315
 
316
- if (isEmpty(dimensions)) {
317
- return map(records, r => {
316
+ if (!dimensions?.length) {
317
+ return records.map(r => {
318
318
  const id = rootId + r.id,
319
319
  leaf = this.cachedRow(id, null, () => new LeafRow(this, id, r));
320
320
  leafMap.set(r.id, leaf);
@@ -355,16 +355,17 @@ export class View extends HoistBase {
355
355
  parentId: string,
356
356
  appliedDimensions: PlainObject
357
357
  ): BaseRow[] {
358
- if (!this.query.bucketSpecFn) return rows;
358
+ const {query} = this;
359
359
 
360
- const bucketSpec = this.query.bucketSpecFn(rows);
361
- if (!bucketSpec) return rows;
360
+ if (!query.bucketSpecFn) return rows;
361
+ if (!query.includeLeaves && rows[0]?.isLeaf) return rows;
362
362
 
363
- if (!this.query.includeLeaves && rows[0]?.isLeaf) return rows;
363
+ const bucketSpec = query.bucketSpecFn(rows);
364
+ if (!bucketSpec) return rows;
364
365
 
365
366
  const {name: bucketName, bucketFn} = bucketSpec,
366
- buckets = {},
367
- ret = [];
367
+ buckets: Record<string, BaseRow[]> = {},
368
+ ret: BaseRow[] = [];
368
369
 
369
370
  // Determine which bucket to put this row into (if any)
370
371
  rows.forEach(row => {
@@ -372,8 +373,8 @@ export class View extends HoistBase {
372
373
  if (isNil(bucketVal)) {
373
374
  ret.push(row);
374
375
  } else {
375
- if (!buckets[bucketVal]) buckets[bucketVal] = [];
376
- buckets[bucketVal].push(row);
376
+ const bucketRows = buckets[bucketVal] ??= [];
377
+ bucketRows.push(row);
377
378
  }
378
379
  });
379
380
 
@@ -454,8 +455,13 @@ export class View extends HoistBase {
454
455
 
455
456
  private filterRecords() {
456
457
  const {query, cube} = this,
458
+ {hasFilter} = query,
457
459
  ret = new Map();
458
- cube.store.records.filter(r => query.test(r)).forEach(r => ret.set(r.id, r));
460
+
461
+ cube.store.records.forEach(r => {
462
+ if (!hasFilter || query.test(r)) ret.set(r.id, r);
463
+ });
464
+
459
465
  this._recordMap = ret;
460
466
  }
461
467
 
@@ -54,6 +54,7 @@ export const impersonationBar = hoistCmp.factory({
54
54
  options: targets,
55
55
  enableCreate: true,
56
56
  placeholder: 'Select User...',
57
+ createMessageFn: q => `Impersonate new user "${q}"`,
57
58
  width: 250,
58
59
  menuWidth: 300,
59
60
  onCommit: model.onCommit
@@ -36,7 +36,7 @@ export const impersonationBar = hoistCmp.factory({
36
36
  enableFilter: true,
37
37
  enableFullscreen: true,
38
38
  placeholder: 'Select a user to impersonate...',
39
- createMessageFn: q => `Impersonate ${q}`,
39
+ createMessageFn: q => `Impersonate new user "${q}"`,
40
40
  onCommit: model.onCommit
41
41
  }),
42
42
  button({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "77.0.0-SNAPSHOT.1760194879110",
3
+ "version": "77.0.0-SNAPSHOT.1760631134539",
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",