@xh/hoist 73.0.0-SNAPSHOT.1746553761854 → 73.0.0-SNAPSHOT.1746559391577

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
@@ -127,10 +127,6 @@
127
127
 
128
128
  ### 🎁 New Features
129
129
 
130
- * Improvements to Grid columns `HeaderFilter` component:
131
- * `GridFilterModel` `commitOnChage` now set to `false` by default
132
- * Addition of ability to append terms to active filter **only** when `commitOnChage:false`
133
- * Column header filtering functionality now similar to Excel on Windows
134
130
  * Introduced a new "JSON Search" feature to the Hoist Admin Console, accessible from the Config,
135
131
  User Preference, and JSON Blob tabs. Supports searching JSON values stored within these objects
136
132
  to filter and match data using JSON Path expressions.
@@ -139,6 +139,12 @@ export const deviceIcon: ColumnSpec = {
139
139
  }
140
140
  };
141
141
 
142
+ export const elapsedRenderer = numberRenderer({
143
+ label: 'ms',
144
+ nullDisplay: '-',
145
+ formatConfig: {thousandSeparated: false, mantissa: 0}
146
+ });
147
+
142
148
  export const elapsed: ColumnSpec = {
143
149
  field: {
144
150
  name: 'elapsed',
@@ -146,12 +152,17 @@ export const elapsed: ColumnSpec = {
146
152
  aggregator: 'AVG'
147
153
  },
148
154
  width: 130,
149
- align: 'right',
150
- renderer: numberRenderer({
151
- label: 'ms',
152
- nullDisplay: '-',
153
- formatConfig: {thousandSeparated: false, mantissa: 0}
154
- })
155
+ renderer: elapsedRenderer
156
+ };
157
+
158
+ export const elapsedMax: ColumnSpec = {
159
+ field: {
160
+ name: 'elapsedMax',
161
+ type: 'int',
162
+ aggregator: 'MAX'
163
+ },
164
+ width: 130,
165
+ renderer: elapsedRenderer
155
166
  };
156
167
 
157
168
  export const entryCount: ColumnSpec = {
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import {exportFilename, getAppModel} from '@xh/hoist/admin/AdminUtils';
8
8
  import * as Col from '@xh/hoist/admin/columns';
9
+ import {elapsedRenderer} from '@xh/hoist/admin/columns';
9
10
  import {
10
11
  ActivityTrackingDataFieldSpec,
11
12
  DataFieldsEditorModel
@@ -16,7 +17,7 @@ import {ColumnRenderer, ColumnSpec, GridModel, TreeStyle} from '@xh/hoist/cmp/gr
16
17
  import {GroupingChooserModel} from '@xh/hoist/cmp/grouping';
17
18
  import {HoistModel, LoadSpec, managed, PlainObject, XH} from '@xh/hoist/core';
18
19
  import {Cube, CubeFieldSpec, FieldSpec, StoreRecord} from '@xh/hoist/data';
19
- import {dateRenderer, dateTimeSecRenderer, fmtNumber, numberRenderer} from '@xh/hoist/format';
20
+ import {dateRenderer, dateTimeSecRenderer, numberRenderer} from '@xh/hoist/format';
20
21
  import {action, computed, makeObservable, observable} from '@xh/hoist/mobx';
21
22
  import {LocalDate} from '@xh/hoist/utils/datetime';
22
23
  import {compact, get, isEmpty, isEqual, round} from 'lodash';
@@ -329,6 +330,7 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
329
330
  Col.dayRange.field,
330
331
  Col.device.field,
331
332
  Col.elapsed.field,
333
+ Col.elapsedMax.field,
332
334
  Col.entryCount.field,
333
335
  Col.impersonating.field,
334
336
  Col.instance.field,
@@ -349,7 +351,11 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
349
351
  private createFilterChooserModel(): FilterChooserModel {
350
352
  // TODO - data fields?
351
353
  const ret = new FilterChooserModel({
352
- persistWith: {...this.persistWith, persistFavorites: false},
354
+ persistWith: {
355
+ ...this.persistWith,
356
+ // Faves persisted to local storage (vs trapped within a single VM view)
357
+ persistFavorites: {localStorageKey: 'xhAdminActivityTabState'}
358
+ },
353
359
  fieldSpecs: [
354
360
  {field: 'appEnvironment', displayName: 'Environment'},
355
361
  {field: 'appVersion'},
@@ -358,16 +364,7 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
358
364
  {field: 'correlationId'},
359
365
  {field: 'data'},
360
366
  {field: 'device'},
361
- {
362
- field: 'elapsed',
363
- valueRenderer: v => {
364
- return fmtNumber(v, {
365
- label: 'ms',
366
- formatConfig: {thousandSeparated: false, mantissa: 0}
367
- });
368
- },
369
- fieldType: 'number'
370
- },
367
+ {field: 'elapsed', fieldType: 'number', valueRenderer: elapsedRenderer},
371
368
  {field: 'instance'},
372
369
  {field: 'loadId'},
373
370
  {field: 'msg', displayName: 'Message'},
@@ -403,7 +400,11 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
403
400
 
404
401
  private createGroupingChooserModel(): GroupingChooserModel {
405
402
  return new GroupingChooserModel({
406
- persistWith: {...this.persistWith, persistFavorites: false},
403
+ persistWith: {
404
+ ...this.persistWith,
405
+ // Faves persisted to local storage (vs trapped within a single VM view)
406
+ persistFavorites: {localStorageKey: 'xhAdminActivityTabState'}
407
+ },
407
408
  dimensions: this.cube.dimensions,
408
409
  initialValue: ['username', 'category']
409
410
  });
@@ -440,7 +441,8 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
440
441
  {...Col.browser, hidden},
441
442
  {...Col.userAgent, hidden},
442
443
  {...Col.impersonating, hidden},
443
- {...Col.elapsed, headerName: 'Elapsed (avg)', hidden},
444
+ {...Col.elapsed, displayName: 'Elapsed (avg)', hidden},
445
+ {...Col.elapsedMax, displayName: 'Elapsed (max)', hidden},
444
446
  {...Col.dayRange, hidden},
445
447
  {...Col.entryCount},
446
448
  {field: 'count', hidden},
@@ -464,6 +466,9 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
464
466
  raw.month = raw.day.format(this._monthFormat);
465
467
  raw.dayRange = {min: raw.day, max: raw.day};
466
468
 
469
+ // Workaround lack of support for multiple aggregations on the same field.
470
+ raw.elapsedMax = raw.elapsed;
471
+
467
472
  const data = JSON.parse(raw.data);
468
473
  if (isEmpty(data)) return;
469
474
 
@@ -26,6 +26,7 @@ import {activityDetailView} from './detail/ActivityDetailView';
26
26
  import './ActivityTracking.scss';
27
27
 
28
28
  export const activityTrackingPanel = hoistCmp.factory({
29
+ displayName: 'ActivityTrackingPanel',
29
30
  model: creates(ActivityTrackingModel),
30
31
 
31
32
  render({model}) {
@@ -45,14 +45,9 @@ export class AggChartModel extends HoistModel {
45
45
  if (!activityTrackingModel) return [];
46
46
 
47
47
  const ret: SelectOption[] = [
48
- {
49
- label: 'Entries [count]',
50
- value: 'entryCount'
51
- },
52
- {
53
- label: 'Elapsed ms [avg]',
54
- value: 'elapsed'
55
- }
48
+ {label: 'Entries [count]', value: 'entryCount'},
49
+ {label: 'Elapsed [avg]', value: 'elapsed'},
50
+ {label: 'Elapsed [max]', value: 'elapsedMax'}
56
51
  ];
57
52
 
58
53
  if (secondaryDim) {
@@ -88,10 +83,16 @@ export class AggChartModel extends HoistModel {
88
83
  this.markPersist('metric', {...persistWith, path: 'chartMetric'});
89
84
  this.markPersist('incWeekends', {...persistWith, path: 'chartIncWeekends'});
90
85
 
91
- this.addReaction({
92
- track: () => [this.data, this.metric, this.incWeekends],
93
- run: () => this.loadChart()
94
- });
86
+ this.addReaction(
87
+ {
88
+ track: () => [this.data, this.metric, this.incWeekends],
89
+ run: () => this.loadChart()
90
+ },
91
+ {
92
+ track: () => this.selectableMetrics,
93
+ run: () => this.onSelectableMetricsChange()
94
+ }
95
+ );
95
96
  }
96
97
 
97
98
  //-----------------
@@ -215,4 +216,11 @@ export class AggChartModel extends HoistModel {
215
216
  private getDisplayName(fieldName: string) {
216
217
  return this.activityTrackingModel?.getDisplayName(fieldName) ?? fieldName;
217
218
  }
219
+
220
+ private onSelectableMetricsChange(): void {
221
+ const {metric} = this;
222
+ if (!this.selectableMetrics.some(it => it.value === metric)) {
223
+ this.metric = this.selectableMetrics[0]?.value;
224
+ }
225
+ }
218
226
  }
@@ -14,6 +14,7 @@ import {Icon} from '@xh/hoist/icon/Icon';
14
14
  import {AggChartModel} from './AggChartModel';
15
15
 
16
16
  export const aggChartPanel = hoistCmp.factory({
17
+ displayName: 'AggChartPanel',
17
18
  model: creates(AggChartModel),
18
19
 
19
20
  render({model, ...props}) {
@@ -12,6 +12,7 @@ import {popover} from '@xh/hoist/kit/blueprint';
12
12
  import {isEmpty} from 'lodash';
13
13
 
14
14
  export const dataFieldsEditor = hoistCmp.factory({
15
+ displayName: 'DataFieldsEditor',
15
16
  model: uses(DataFieldsEditorModel),
16
17
 
17
18
  render({model}) {
@@ -22,6 +22,7 @@ import {isNil} from 'lodash';
22
22
  import {ActivityDetailModel} from './ActivityDetailModel';
23
23
 
24
24
  export const activityDetailView = hoistCmp.factory({
25
+ displayName: 'ActivityDetailView',
25
26
  model: creates(ActivityDetailModel),
26
27
 
27
28
  render({model, ...props}) {
@@ -12,7 +12,9 @@ export declare const day: ColumnSpec;
12
12
  export declare const dayRange: ColumnSpec;
13
13
  export declare const device: ColumnSpec;
14
14
  export declare const deviceIcon: ColumnSpec;
15
+ export declare const elapsedRenderer: (v: number) => import("react").ReactNode;
15
16
  export declare const elapsed: ColumnSpec;
17
+ export declare const elapsedMax: ColumnSpec;
16
18
  export declare const entryCount: ColumnSpec;
17
19
  export declare const entryId: ColumnSpec;
18
20
  export declare const error: ColumnSpec;
@@ -30,4 +30,5 @@ export declare class AggChartModel extends HoistModel {
30
30
  private loadChart;
31
31
  private getSeriesData;
32
32
  private getDisplayName;
33
+ private onSelectableMetricsChange;
33
34
  }
@@ -60,10 +60,7 @@ export interface GridFilterModelConfig {
60
60
  * gridModel's store.
61
61
  */
62
62
  bind?: Store | View;
63
- /**
64
- * True to update filters immediately after each change made in the column-based filter UI.
65
- * Defaults to False.
66
- */
63
+ /** True (default) to update filters immediately after each change made in the column-based filter UI.*/
67
64
  commitOnChange?: boolean;
68
65
  /**
69
66
  * Specifies the fields this model supports for filtering. Should be configs for
@@ -11,7 +11,6 @@ export declare class ValuesTabModel extends HoistModel {
11
11
  pendingValues: any[];
12
12
  /** Bound search term for `StoreFilterField` */
13
13
  filterText: string;
14
- combineCurrentFilters: boolean;
15
14
  /** FieldFilter output by this model. */
16
15
  get filter(): FieldFilterSpec;
17
16
  get allVisibleRecsChecked(): boolean;
@@ -27,7 +26,6 @@ export declare class ValuesTabModel extends HoistModel {
27
26
  reset(): void;
28
27
  setRecsChecked(isChecked: boolean, values: any[]): void;
29
28
  toggleAllRecsChecked(): void;
30
- setPendingValues(): void;
31
29
  private getFilter;
32
30
  private doSyncWithFilter;
33
31
  private syncGrid;
package/cmp/grid/Types.ts CHANGED
@@ -90,10 +90,7 @@ export interface GridFilterModelConfig {
90
90
  */
91
91
  bind?: Store | View;
92
92
 
93
- /**
94
- * True to update filters immediately after each change made in the column-based filter UI.
95
- * Defaults to False.
96
- */
93
+ /** True (default) to update filters immediately after each change made in the column-based filter UI.*/
97
94
  commitOnChange?: boolean;
98
95
 
99
96
  /**
@@ -46,7 +46,7 @@ export class GridFilterModel extends HoistModel {
46
46
  static BLANK_PLACEHOLDER = '[blank]';
47
47
 
48
48
  constructor(
49
- {bind, commitOnChange = false, fieldSpecs, fieldSpecDefaults}: GridFilterModelConfig,
49
+ {bind, commitOnChange = true, fieldSpecs, fieldSpecDefaults}: GridFilterModelConfig,
50
50
  gridModel: GridModel
51
51
  ) {
52
52
  super();
@@ -1,17 +1,4 @@
1
1
  .xh-values-filter-tab {
2
- .store-filter-header {
3
- padding: 5px 7px;
4
- border-bottom: 1px solid var(--xh-grid-header-border-color);
5
- row-gap: 5px;
6
- .bp5-control-indicator {
7
- font-size: 1em;
8
- }
9
- span {
10
- font-size: var(--xh-grid-compact-header-font-size-px);
11
- color: var(--xh-grid-header-text-color);
12
- }
13
- }
14
-
15
2
  &__hidden-values-message {
16
3
  display: flex;
17
4
  padding: var(--xh-pad-half-px);
@@ -5,11 +5,10 @@
5
5
  * Copyright © 2025 Extremely Heavy Industries Inc.
6
6
  */
7
7
  import {grid} from '@xh/hoist/cmp/grid';
8
- import {div, hframe, placeholder, span, vbox, vframe} from '@xh/hoist/cmp/layout';
8
+ import {div, placeholder, vframe} from '@xh/hoist/cmp/layout';
9
9
  import {storeFilterField} from '@xh/hoist/cmp/store';
10
10
  import {hoistCmp, uses} from '@xh/hoist/core';
11
11
  import {button} from '@xh/hoist/desktop/cmp/button';
12
- import {checkbox} from '@xh/hoist/desktop/cmp/input';
13
12
  import {panel} from '@xh/hoist/desktop/cmp/panel';
14
13
  import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
15
14
  import {Icon} from '@xh/hoist/icon';
@@ -48,33 +47,7 @@ const tbar = hoistCmp.factory(() => {
48
47
  const body = hoistCmp.factory<ValuesTabModel>(({model}) => {
49
48
  const {isCustomFilter} = model.headerFilterModel;
50
49
  if (isCustomFilter) return customFilterPlaceholder();
51
- return vframe(storeFilterSelect(), grid(), hiddenValuesMessage());
52
- });
53
-
54
- const storeFilterSelect = hoistCmp.factory<ValuesTabModel>(({model}) => {
55
- const {gridModel, allVisibleRecsChecked, filterText, headerFilterModel} = model,
56
- {store} = gridModel;
57
- return vbox({
58
- className: 'store-filter-header',
59
- items: [
60
- hframe(
61
- checkbox({
62
- disabled: store.empty,
63
- displayUnsetState: true,
64
- value: allVisibleRecsChecked,
65
- onChange: () => model.toggleAllRecsChecked()
66
- }),
67
- span(`(Select All${filterText ? ' Search Results' : ''})`)
68
- ),
69
- hframe({
70
- omit: !filterText || store.empty || headerFilterModel.commitOnChange,
71
- items: [
72
- checkbox({bind: 'combineCurrentFilters'}),
73
- span(`Add current selection to filter`)
74
- ]
75
- })
76
- ]
77
- });
50
+ return vframe(grid(), hiddenValuesMessage());
78
51
  });
79
52
 
80
53
  const customFilterPlaceholder = hoistCmp.factory<ValuesTabModel>(({model}) => {
@@ -10,7 +10,7 @@ import {FieldFilterSpec} from '@xh/hoist/data';
10
10
  import {HeaderFilterModel} from '../HeaderFilterModel';
11
11
  import {checkbox} from '@xh/hoist/desktop/cmp/input';
12
12
  import {action, bindable, computed, makeObservable, observable} from '@xh/hoist/mobx';
13
- import {castArray, difference, flatten, isEmpty, map, partition, uniq, without} from 'lodash';
13
+ import {castArray, difference, isEmpty, partition, uniq, without} from 'lodash';
14
14
 
15
15
  export class ValuesTabModel extends HoistModel {
16
16
  override xhImpl = true;
@@ -26,12 +26,6 @@ export class ValuesTabModel extends HoistModel {
26
26
  /** Bound search term for `StoreFilterField` */
27
27
  @bindable filterText: string = null;
28
28
 
29
- /*
30
- * Available only when commit on change is false merge
31
- * current filter with pendingValues on commit
32
- */
33
- @bindable combineCurrentFilters: boolean = false;
34
-
35
29
  /** FieldFilter output by this model. */
36
30
  @computed.struct
37
31
  get filter(): FieldFilterSpec {
@@ -87,18 +81,11 @@ export class ValuesTabModel extends HoistModel {
87
81
  this.headerFilterModel = headerFilterModel;
88
82
  this.gridModel = this.createGridModel();
89
83
 
90
- this.addReaction(
91
- {
92
- track: () => this.pendingValues,
93
- run: () => this.syncGrid(),
94
- fireImmediately: true
95
- },
96
- {
97
- track: () => [this.filterText, this.combineCurrentFilters],
98
- run: () => this.setPendingValues(),
99
- debounce: 300
100
- }
101
- );
84
+ this.addReaction({
85
+ track: () => this.pendingValues,
86
+ run: () => this.syncGrid(),
87
+ fireImmediately: true
88
+ });
102
89
  }
103
90
 
104
91
  syncWithFilter() {
@@ -128,23 +115,6 @@ export class ValuesTabModel extends HoistModel {
128
115
  //-------------------
129
116
  // Implementation
130
117
  //-------------------
131
- @action
132
- setPendingValues() {
133
- if (!this.filterText) {
134
- this.doSyncWithFilter();
135
- this.syncGrid();
136
- return;
137
- }
138
-
139
- const {records} = this.gridModel.store,
140
- currentFilterValues = flatten(map(this.columnFilters, 'value')),
141
- values = map(records, it => it.get('value'));
142
-
143
- this.pendingValues = uniq(
144
- this.combineCurrentFilters ? [...currentFilterValues, ...values] : values
145
- );
146
- }
147
-
148
118
  private getFilter() {
149
119
  const {gridFilterModel, pendingValues, values, valueCount, field} = this,
150
120
  included = pendingValues.map(it => gridFilterModel.fromDisplayValue(it)),
@@ -247,10 +217,17 @@ export class ValuesTabModel extends HoistModel {
247
217
  onRowClicked: ({data: record}) => {
248
218
  this.setRecsChecked(!record.get('isChecked'), record.get('value'));
249
219
  },
250
- hideHeaders: true,
251
220
  columns: [
252
221
  {
253
222
  field: 'isChecked',
223
+ headerName: ({gridModel}) => {
224
+ return checkbox({
225
+ disabled: gridModel.store.empty,
226
+ displayUnsetState: true,
227
+ value: this.allVisibleRecsChecked,
228
+ onChange: () => this.toggleAllRecsChecked()
229
+ });
230
+ },
254
231
  width: 28,
255
232
  autosizable: false,
256
233
  pinned: true,
@@ -268,6 +245,7 @@ export class ValuesTabModel extends HoistModel {
268
245
  },
269
246
  {
270
247
  field: 'value',
248
+ displayName: '(Select All)',
271
249
  align: 'left',
272
250
  comparator: (v1, v2, sortDir, abs, {defaultComparator}) => {
273
251
  const mul = sortDir === 'desc' ? -1 : 1;
@@ -137,6 +137,10 @@
137
137
  color: var(--xh-text-color);
138
138
  }
139
139
 
140
+ .xh-toolbar--compact & {
141
+ height: 15px;
142
+ }
143
+
140
144
  // Matched to FilterChooser equivalent.
141
145
  & > .svg-inline--fa {
142
146
  width: 12px;
@@ -47,8 +47,10 @@ export interface GroupingChooserProps extends ButtonProps<GroupingChooserModel>
47
47
  * @see GroupingChooserModel
48
48
  */
49
49
  export const [GroupingChooser, groupingChooser] = hoistCmp.withFactory<GroupingChooserProps>({
50
+ displayName: 'GroupingChooser',
50
51
  model: uses(GroupingChooserModel),
51
52
  className: 'xh-grouping-chooser',
53
+
52
54
  render(
53
55
  {
54
56
  model,
@@ -103,15 +105,13 @@ export const [GroupingChooser, groupingChooser] = hoistCmp.withFactory<GroupingC
103
105
  ),
104
106
  content: favoritesIsOpen
105
107
  ? favoritesMenu({testId: favoritesMenuTestId})
106
- : editorIsOpen
107
- ? editor({
108
- popoverWidth,
109
- popoverMinHeight,
110
- popoverTitle,
111
- emptyText,
112
- testId: editorTestId
113
- })
114
- : null,
108
+ : editor({
109
+ popoverWidth,
110
+ popoverMinHeight,
111
+ popoverTitle,
112
+ emptyText,
113
+ testId: editorTestId
114
+ }),
115
115
  onInteraction: (nextOpenState, e) => {
116
116
  if (
117
117
  isOpen &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "73.0.0-SNAPSHOT.1746553761854",
3
+ "version": "73.0.0-SNAPSHOT.1746559391577",
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",